datastake-daf 0.6.170 → 0.6.172
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 +131 -101
- package/dist/utils/index.js +42 -0
- package/package.json +1 -1
- package/src/@daf/core/components/EditForm/_index.scss +3 -3
- 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/ViewForm/_index.scss +1 -1
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", {
|
|
@@ -12416,8 +12410,11 @@ const useHeader = _ref => {
|
|
|
12416
12410
|
loading,
|
|
12417
12411
|
renderExtraComponents,
|
|
12418
12412
|
app = '',
|
|
12419
|
-
isViewMode = false
|
|
12413
|
+
isViewMode = false,
|
|
12414
|
+
filtersConfig = {}
|
|
12420
12415
|
} = _ref;
|
|
12416
|
+
const [showFilters, setShowFilters] = React.useState(false);
|
|
12417
|
+
const hasFilters = !!filtersConfig;
|
|
12421
12418
|
const downloadButtonAction = app && app === 'sbg' && isViewMode ? null : {
|
|
12422
12419
|
onClick: onDownload,
|
|
12423
12420
|
disabled: downloadDisabled,
|
|
@@ -12437,7 +12434,16 @@ const useHeader = _ref => {
|
|
|
12437
12434
|
noMinWidth: true,
|
|
12438
12435
|
className: 'download-btn'
|
|
12439
12436
|
};
|
|
12440
|
-
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;
|
|
12441
12447
|
const extraButtons = onDownload && _actionButtons.length >= 3 ? [..._extraButtons, downloadButtonAction] : _extraButtons;
|
|
12442
12448
|
const mainCont = React.useRef();
|
|
12443
12449
|
const buttonCont = React.useRef();
|
|
@@ -12477,99 +12483,120 @@ const useHeader = _ref => {
|
|
|
12477
12483
|
}, []);
|
|
12478
12484
|
const maxWidth = React.useMemo(() => mainContWidth - buttonContWidth - 24, [mainContWidth, buttonContWidth]);
|
|
12479
12485
|
const renderMainCont = () => /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
12480
|
-
className: formatClassname(["main-cont flex", className]),
|
|
12481
|
-
ref: mainCont,
|
|
12482
12486
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
12483
|
-
className: "
|
|
12484
|
-
|
|
12485
|
-
|
|
12486
|
-
|
|
12487
|
-
|
|
12488
|
-
|
|
12489
|
-
},
|
|
12490
|
-
children: [goBackTo && /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
|
|
12491
|
-
className: "flex mr-xs no-min-width",
|
|
12492
|
-
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"]),
|
|
12493
12493
|
style: {
|
|
12494
|
-
|
|
12495
|
-
|
|
12496
|
-
minWidth: "25px",
|
|
12497
|
-
borderRadius: "4px",
|
|
12498
|
-
opacity: loading ? 0 : 1
|
|
12494
|
+
maxWidth,
|
|
12495
|
+
alignItems: "center"
|
|
12499
12496
|
},
|
|
12500
|
-
children: /*#__PURE__*/jsxRuntime.jsx(
|
|
12501
|
-
|
|
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
|
+
},
|
|
12502
12521
|
style: {
|
|
12503
|
-
|
|
12504
|
-
width: "12px",
|
|
12505
|
-
color: "var(--base-gray-70)"
|
|
12522
|
+
marginTop: '10px'
|
|
12506
12523
|
}
|
|
12507
|
-
})
|
|
12508
|
-
|
|
12509
|
-
|
|
12510
|
-
|
|
12511
|
-
|
|
12512
|
-
|
|
12513
|
-
},
|
|
12514
|
-
|
|
12515
|
-
|
|
12516
|
-
|
|
12517
|
-
|
|
12518
|
-
|
|
12519
|
-
|
|
12520
|
-
|
|
12521
|
-
|
|
12522
|
-
|
|
12523
|
-
|
|
12524
|
-
|
|
12525
|
-
|
|
12526
|
-
|
|
12527
|
-
|
|
12528
|
-
|
|
12529
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Icons.InfoCircleOutlined, {})
|
|
12530
|
-
}) : typeof tooltip === "object" ? /*#__PURE__*/jsxRuntime.jsx(antd.Popover, {
|
|
12531
|
-
rootClassName: formatClassname(["header-tooltip", tooltip.className]),
|
|
12532
|
-
title: tooltip.title,
|
|
12533
|
-
content: tooltip.content,
|
|
12534
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Icons.InfoCircleOutlined, {})
|
|
12535
|
-
}) : null
|
|
12536
|
-
}), typeof renderExtraComponents === "function" ? renderExtraComponents() : null, hasTags && /*#__PURE__*/jsxRuntime.jsx(Tags, {
|
|
12537
|
-
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
|
+
})]
|
|
12538
12546
|
})]
|
|
12539
|
-
})
|
|
12540
|
-
}) : typeof title === "function" ? title(maxWidth) : title, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
12541
|
-
style: {
|
|
12542
|
-
marginLeft: goBackTo ? "33px" : 0
|
|
12543
|
-
},
|
|
12544
|
-
className: "support-text",
|
|
12545
|
-
children: /*#__PURE__*/jsxRuntime.jsx(Paragraph, {
|
|
12546
|
-
ellipsis: {
|
|
12547
|
-
tooltip: supportText,
|
|
12548
|
-
rows: 1
|
|
12549
|
-
},
|
|
12547
|
+
}) : typeof title === "function" ? title(maxWidth) : title, /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
12550
12548
|
style: {
|
|
12551
|
-
|
|
12549
|
+
marginLeft: goBackTo ? "33px" : 0
|
|
12552
12550
|
},
|
|
12553
|
-
|
|
12554
|
-
|
|
12555
|
-
|
|
12556
|
-
|
|
12557
|
-
|
|
12558
|
-
|
|
12559
|
-
|
|
12560
|
-
|
|
12561
|
-
|
|
12562
|
-
|
|
12563
|
-
|
|
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]
|
|
12564
12580
|
})]
|
|
12565
|
-
})
|
|
12566
|
-
|
|
12567
|
-
|
|
12568
|
-
|
|
12569
|
-
|
|
12570
|
-
|
|
12571
|
-
|
|
12572
|
-
|
|
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
|
+
})
|
|
12573
12600
|
})]
|
|
12574
12601
|
});
|
|
12575
12602
|
return {
|
|
@@ -12693,7 +12720,8 @@ function DAFHeader(_ref) {
|
|
|
12693
12720
|
loading,
|
|
12694
12721
|
renderExtraComponents,
|
|
12695
12722
|
app = "",
|
|
12696
|
-
isViewMode = false
|
|
12723
|
+
isViewMode = false,
|
|
12724
|
+
filtersConfig = {}
|
|
12697
12725
|
} = _ref;
|
|
12698
12726
|
const showBreadcrumbs = !!breadcrumbs.length;
|
|
12699
12727
|
const {
|
|
@@ -12715,7 +12743,8 @@ function DAFHeader(_ref) {
|
|
|
12715
12743
|
loading,
|
|
12716
12744
|
renderExtraComponents,
|
|
12717
12745
|
app,
|
|
12718
|
-
isViewMode
|
|
12746
|
+
isViewMode,
|
|
12747
|
+
filtersConfig
|
|
12719
12748
|
});
|
|
12720
12749
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
12721
12750
|
className: "daf-header",
|
|
@@ -12736,7 +12765,8 @@ DAFHeader.propTypes = {
|
|
|
12736
12765
|
tags: PropTypes__default["default"].any,
|
|
12737
12766
|
actionButtons: PropTypes__default["default"].array,
|
|
12738
12767
|
extraButtons: PropTypes__default["default"].array,
|
|
12739
|
-
downloadDisabled: PropTypes__default["default"].any
|
|
12768
|
+
downloadDisabled: PropTypes__default["default"].any,
|
|
12769
|
+
filtersConfig: PropTypes__default["default"].any
|
|
12740
12770
|
};
|
|
12741
12771
|
|
|
12742
12772
|
const _excluded$m = ["tabs", "onChange", "value", "className"];
|
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
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
flex-direction: column;
|
|
165
165
|
overflow-y: auto;
|
|
166
166
|
height: 100%; // Ensure content takes full height
|
|
167
|
-
padding: 20px 20px
|
|
167
|
+
padding: 20px 20px 20px 20px; // Add bottom padding for better scrolling
|
|
168
168
|
|
|
169
169
|
&.risk-template.no-padding {
|
|
170
170
|
padding: 0;
|
|
@@ -354,7 +354,7 @@
|
|
|
354
354
|
padding-top: var(--size-lg);
|
|
355
355
|
overflow: auto;
|
|
356
356
|
flex-direction: column;
|
|
357
|
-
padding: 20px 100px
|
|
357
|
+
padding: 20px 100px 0 100px;
|
|
358
358
|
&.has-section {
|
|
359
359
|
width: calc(100% - 200px);
|
|
360
360
|
}
|
|
@@ -1229,7 +1229,7 @@
|
|
|
1229
1229
|
padding-top: var(--size-lg);
|
|
1230
1230
|
overflow: auto;
|
|
1231
1231
|
flex-direction: column;
|
|
1232
|
-
padding: var(--size-lg) var(--size-lg)
|
|
1232
|
+
padding: var(--size-lg) var(--size-lg) 0 var(--size-lg);
|
|
1233
1233
|
|
|
1234
1234
|
.main-form {
|
|
1235
1235
|
min-width: 400px;
|
|
@@ -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
|
};
|
|
@@ -231,7 +231,7 @@
|
|
|
231
231
|
display: flex;
|
|
232
232
|
flex-direction: column;
|
|
233
233
|
overflow-y: auto;
|
|
234
|
-
padding: var(--size-lg) var(--size-lg)
|
|
234
|
+
padding: var(--size-lg) var(--size-lg) 0 var(--size-lg);
|
|
235
235
|
|
|
236
236
|
&.no-padding {
|
|
237
237
|
padding: 0px;
|