datastake-daf 0.6.173 → 0.6.174
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 +214 -59
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Widget/Widget.stories.js +9 -0
- package/src/@daf/core/components/Dashboard/Widget/index.jsx +7 -2
- package/src/@daf/core/components/Filters/FloatingFilters/FloatingFilters.stories.jsx +61 -0
- package/src/@daf/core/components/Filters/FloatingFilters/components/Slider/index.jsx +120 -0
- package/src/@daf/core/components/Filters/FloatingFilters/index.js +38 -35
- package/src/@daf/core/components/ProgressBar/MultiColorProgressBar/MultiColorProgressBar.stories.js +16 -0
- package/src/@daf/core/components/ProgressBar/MultiColorProgressBar/index.jsx +53 -0
- package/src/@daf/core/components/UI/SDGIcon/index.jsx +11 -3
- package/src/@daf/core/components/UI/SDGIcon/styles.js +2 -0
- package/src/index.js +4 -1
package/dist/components/index.js
CHANGED
|
@@ -3065,7 +3065,7 @@ const config$3 = {
|
|
|
3065
3065
|
Integration: config$4
|
|
3066
3066
|
};
|
|
3067
3067
|
|
|
3068
|
-
const _excluded$
|
|
3068
|
+
const _excluded$v = ["width", "height", "size", "name", "fill"];
|
|
3069
3069
|
const CustomIcon = _ref => {
|
|
3070
3070
|
let {
|
|
3071
3071
|
width = 14,
|
|
@@ -3074,7 +3074,7 @@ const CustomIcon = _ref => {
|
|
|
3074
3074
|
name = "",
|
|
3075
3075
|
fill = "none"
|
|
3076
3076
|
} = _ref,
|
|
3077
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
3077
|
+
props = _objectWithoutProperties(_ref, _excluded$v);
|
|
3078
3078
|
const conf = config$3[name];
|
|
3079
3079
|
if (conf) {
|
|
3080
3080
|
return /*#__PURE__*/jsxRuntime.jsx("svg", _objectSpread2(_objectSpread2({}, props), {}, {
|
|
@@ -9276,7 +9276,7 @@ createCommonjsModule(function (module, exports) {
|
|
|
9276
9276
|
!function(e,n){module.exports=n();}(commonjsGlobal,(function(){return {name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var n=["th","st","nd","rd"],t=e%100;return "["+e+(n[(t-20)%10]||n[t]||n[0])+"]"}}}));
|
|
9277
9277
|
});
|
|
9278
9278
|
|
|
9279
|
-
const _excluded$
|
|
9279
|
+
const _excluded$u = ["view", "module", "scope", "form", "meta"];
|
|
9280
9280
|
dayjs__default["default"].extend(customParseFormat);
|
|
9281
9281
|
dayjs__default["default"].extend(utc);
|
|
9282
9282
|
dayjs__default["default"].extend(utc);
|
|
@@ -9650,7 +9650,7 @@ const filterCreateData = data => {
|
|
|
9650
9650
|
form,
|
|
9651
9651
|
meta
|
|
9652
9652
|
} = data,
|
|
9653
|
-
rest = _objectWithoutProperties(data, _excluded$
|
|
9653
|
+
rest = _objectWithoutProperties(data, _excluded$u);
|
|
9654
9654
|
const _meta = isObjectEmpty(meta) ? undefined : meta;
|
|
9655
9655
|
return _objectSpread2(_objectSpread2({}, rest), {}, {
|
|
9656
9656
|
meta: _meta
|
|
@@ -10029,7 +10029,7 @@ SelectFilters.propTypes = {
|
|
|
10029
10029
|
apiUrl: PropTypes__default["default"].string
|
|
10030
10030
|
};
|
|
10031
10031
|
|
|
10032
|
-
const _excluded$
|
|
10032
|
+
const _excluded$t = ["columns", "data", "defaultFilters", "style", "pagination", "loading", "onChange", "onFilterChange", "selectOptions", "filtersConfig", "rowSelection", "setShowFilters", "rowKey", "showFilters", "hideOnLoading", "sourcesKey", "className", "projects", "t", "selectedProject", "sourceId", "projectSources", "language", "scrollX", "apiUrl", "app", "doEmptyRows"];
|
|
10033
10033
|
function DAFTable(_ref) {
|
|
10034
10034
|
let {
|
|
10035
10035
|
columns = [],
|
|
@@ -10060,7 +10060,7 @@ function DAFTable(_ref) {
|
|
|
10060
10060
|
app,
|
|
10061
10061
|
doEmptyRows
|
|
10062
10062
|
} = _ref,
|
|
10063
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
10063
|
+
rest = _objectWithoutProperties(_ref, _excluded$t);
|
|
10064
10064
|
const [source, setSource] = React.useState([]);
|
|
10065
10065
|
const projectData = (projects || []).find(p => p.id === selectedProject);
|
|
10066
10066
|
const [filtersInit, setFiltersInit] = React.useState(!loading);
|
|
@@ -10782,7 +10782,7 @@ Pagination.propTypes = {
|
|
|
10782
10782
|
isMobile: PropTypes__default["default"].bool
|
|
10783
10783
|
};
|
|
10784
10784
|
|
|
10785
|
-
const _excluded$
|
|
10785
|
+
const _excluded$s = ["size", "maxHeight", "dataSource", "columns", "pagination"];
|
|
10786
10786
|
function StickyTable(_ref) {
|
|
10787
10787
|
let {
|
|
10788
10788
|
size = null,
|
|
@@ -10791,7 +10791,7 @@ function StickyTable(_ref) {
|
|
|
10791
10791
|
columns = {},
|
|
10792
10792
|
pagination = false
|
|
10793
10793
|
} = _ref,
|
|
10794
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
10794
|
+
props = _objectWithoutProperties(_ref, _excluded$s);
|
|
10795
10795
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
10796
10796
|
className: "daf-sticky-table",
|
|
10797
10797
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Table, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
@@ -11256,7 +11256,7 @@ const BTN_SIZE = {
|
|
|
11256
11256
|
LG: 'large'
|
|
11257
11257
|
};
|
|
11258
11258
|
|
|
11259
|
-
const _excluded$
|
|
11259
|
+
const _excluded$r = ["content", "size", "type", "icon", "onClick", "disabled", "loading", "title", "style", "className"];
|
|
11260
11260
|
function DafButton(_ref) {
|
|
11261
11261
|
let {
|
|
11262
11262
|
content = '',
|
|
@@ -11270,7 +11270,7 @@ function DafButton(_ref) {
|
|
|
11270
11270
|
style = {},
|
|
11271
11271
|
className = ''
|
|
11272
11272
|
} = _ref,
|
|
11273
|
-
restProps = _objectWithoutProperties(_ref, _excluded$
|
|
11273
|
+
restProps = _objectWithoutProperties(_ref, _excluded$r);
|
|
11274
11274
|
return /*#__PURE__*/jsxRuntime.jsx(antd.Button, _objectSpread2(_objectSpread2({
|
|
11275
11275
|
icon: icon,
|
|
11276
11276
|
type: type,
|
|
@@ -11504,12 +11504,12 @@ const Style$I = dt.div`
|
|
|
11504
11504
|
}
|
|
11505
11505
|
`;
|
|
11506
11506
|
|
|
11507
|
-
const _excluded$
|
|
11507
|
+
const _excluded$q = ["children"];
|
|
11508
11508
|
const BorderedButton = _ref => {
|
|
11509
11509
|
let {
|
|
11510
11510
|
children
|
|
11511
11511
|
} = _ref,
|
|
11512
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
11512
|
+
props = _objectWithoutProperties(_ref, _excluded$q);
|
|
11513
11513
|
return /*#__PURE__*/jsxRuntime.jsx(Style$I, {
|
|
11514
11514
|
className: "d-btn-cont",
|
|
11515
11515
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
@@ -11649,12 +11649,12 @@ Badge.propTypes = {
|
|
|
11649
11649
|
props: PropTypes__default["default"].object
|
|
11650
11650
|
};
|
|
11651
11651
|
|
|
11652
|
-
const _excluded$
|
|
11652
|
+
const _excluded$p = ["icon"];
|
|
11653
11653
|
function GetIcon(_ref) {
|
|
11654
11654
|
let {
|
|
11655
11655
|
icon
|
|
11656
11656
|
} = _ref,
|
|
11657
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
11657
|
+
props = _objectWithoutProperties(_ref, _excluded$p);
|
|
11658
11658
|
let Icon = Icons__namespace.CloseOutlined;
|
|
11659
11659
|
if (Icons__namespace[icon]) {
|
|
11660
11660
|
Icon = Icons__namespace[icon];
|
|
@@ -11973,7 +11973,7 @@ GoToSelect.propTypes = {
|
|
|
11973
11973
|
t: PropTypes__default["default"].func
|
|
11974
11974
|
};
|
|
11975
11975
|
|
|
11976
|
-
const _excluded$
|
|
11976
|
+
const _excluded$o = ["options", "defaultSelected", "onChange", "textWhenMultiple", "withCount", "oneAlwaysSelected", "canUnselectLast", "isAvatarGroup", "maxAvatarCount", "dropDownWidth", "topAvatarValue", "isSingle", "selectionType"];
|
|
11977
11977
|
const {
|
|
11978
11978
|
useToken: useToken$k
|
|
11979
11979
|
} = antd.theme;
|
|
@@ -12066,7 +12066,7 @@ function Multiselect(_ref) {
|
|
|
12066
12066
|
isSingle = false,
|
|
12067
12067
|
selectionType = SELECTION_TYPES.DEFAULT
|
|
12068
12068
|
} = _ref,
|
|
12069
|
-
restProps = _objectWithoutProperties(_ref, _excluded$
|
|
12069
|
+
restProps = _objectWithoutProperties(_ref, _excluded$o);
|
|
12070
12070
|
const {
|
|
12071
12071
|
token
|
|
12072
12072
|
} = useToken$k();
|
|
@@ -12769,7 +12769,7 @@ DAFHeader.propTypes = {
|
|
|
12769
12769
|
filtersConfig: PropTypes__default["default"].any
|
|
12770
12770
|
};
|
|
12771
12771
|
|
|
12772
|
-
const _excluded$
|
|
12772
|
+
const _excluded$n = ["tabs", "onChange", "value", "className"];
|
|
12773
12773
|
function TabsHeader(_ref) {
|
|
12774
12774
|
let {
|
|
12775
12775
|
tabs = [],
|
|
@@ -12777,7 +12777,7 @@ function TabsHeader(_ref) {
|
|
|
12777
12777
|
value = '',
|
|
12778
12778
|
className = 'mt-2'
|
|
12779
12779
|
} = _ref,
|
|
12780
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
12780
|
+
rest = _objectWithoutProperties(_ref, _excluded$n);
|
|
12781
12781
|
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
12782
12782
|
className: formatClassname(['daf-tabs-header pl-6 pr-6', className]),
|
|
12783
12783
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Tabs, _objectSpread2({
|
|
@@ -12874,7 +12874,7 @@ DrawerHeader.propTypes = {
|
|
|
12874
12874
|
tabsConfig: PropTypes__default["default"].any
|
|
12875
12875
|
};
|
|
12876
12876
|
|
|
12877
|
-
const _excluded$
|
|
12877
|
+
const _excluded$m = ["label", "onClick", "icon", "type", "tooltip", "disabled", "loading", "style", "className"];
|
|
12878
12878
|
const useFooter = _ref => {
|
|
12879
12879
|
let {
|
|
12880
12880
|
leftContent,
|
|
@@ -12909,7 +12909,7 @@ const useFooter = _ref => {
|
|
|
12909
12909
|
style = {},
|
|
12910
12910
|
className = ""
|
|
12911
12911
|
} = button,
|
|
12912
|
-
restProps = _objectWithoutProperties(button, _excluded$
|
|
12912
|
+
restProps = _objectWithoutProperties(button, _excluded$m);
|
|
12913
12913
|
return /*#__PURE__*/jsxRuntime.jsx(DafButton, _objectSpread2({
|
|
12914
12914
|
content: label,
|
|
12915
12915
|
type: type,
|
|
@@ -15239,7 +15239,8 @@ function Widget(_ref) {
|
|
|
15239
15239
|
defaultExpanded,
|
|
15240
15240
|
isCollapsable = false,
|
|
15241
15241
|
defaultCollapsed = false,
|
|
15242
|
-
onExpandChange
|
|
15242
|
+
onExpandChange,
|
|
15243
|
+
description
|
|
15243
15244
|
} = _ref;
|
|
15244
15245
|
const [showFilters, setShowFilters] = React.useState(false);
|
|
15245
15246
|
const [isCollapsed, setIsCollapsed] = React.useState(defaultCollapsed);
|
|
@@ -15277,11 +15278,15 @@ function Widget(_ref) {
|
|
|
15277
15278
|
className: "widget-header flex-column",
|
|
15278
15279
|
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
15279
15280
|
className: "flex flex-row widget-header-items",
|
|
15280
|
-
children: [/*#__PURE__*/jsxRuntime.
|
|
15281
|
-
|
|
15282
|
-
|
|
15283
|
-
children:
|
|
15284
|
-
|
|
15281
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
15282
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("div", {
|
|
15283
|
+
className: "title cont",
|
|
15284
|
+
children: /*#__PURE__*/jsxRuntime.jsx("h1", {
|
|
15285
|
+
children: title
|
|
15286
|
+
})
|
|
15287
|
+
}), /*#__PURE__*/jsxRuntime.jsx("p", {
|
|
15288
|
+
children: description
|
|
15289
|
+
})]
|
|
15285
15290
|
}), tooltip && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
15286
15291
|
className: "cont icon-cont",
|
|
15287
15292
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
@@ -15396,10 +15401,11 @@ Widget.propTypes = {
|
|
|
15396
15401
|
addedHeaderFirst: PropTypes__default["default"].bool,
|
|
15397
15402
|
isCollapsable: PropTypes__default["default"].bool,
|
|
15398
15403
|
defaultCollapsed: PropTypes__default["default"].bool,
|
|
15399
|
-
onExpandChange: PropTypes__default["default"].func
|
|
15404
|
+
onExpandChange: PropTypes__default["default"].func,
|
|
15405
|
+
description: PropTypes__default["default"].string
|
|
15400
15406
|
};
|
|
15401
15407
|
|
|
15402
|
-
const _excluded$
|
|
15408
|
+
const _excluded$l = ["loading", "title", "image", "description", "imgAlt", "noDescriptionText"];
|
|
15403
15409
|
function ImageWidget(_ref) {
|
|
15404
15410
|
let {
|
|
15405
15411
|
loading = false,
|
|
@@ -15409,7 +15415,7 @@ function ImageWidget(_ref) {
|
|
|
15409
15415
|
imgAlt,
|
|
15410
15416
|
noDescriptionText
|
|
15411
15417
|
} = _ref,
|
|
15412
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
15418
|
+
props = _objectWithoutProperties(_ref, _excluded$l);
|
|
15413
15419
|
return /*#__PURE__*/jsxRuntime.jsx(Widget, _objectSpread2(_objectSpread2({
|
|
15414
15420
|
loading: loading,
|
|
15415
15421
|
title: title,
|
|
@@ -15466,7 +15472,7 @@ function ImageWidget(_ref) {
|
|
|
15466
15472
|
}
|
|
15467
15473
|
|
|
15468
15474
|
var _templateObject$a;
|
|
15469
|
-
const _excluded$
|
|
15475
|
+
const _excluded$k = ["title", "loading", "data", "current", "defaultActiveTab", "widgetClassname", "className", "direction"];
|
|
15470
15476
|
function FlowWidget(_ref) {
|
|
15471
15477
|
let {
|
|
15472
15478
|
title,
|
|
@@ -15478,7 +15484,7 @@ function FlowWidget(_ref) {
|
|
|
15478
15484
|
className,
|
|
15479
15485
|
direction = "horizontal"
|
|
15480
15486
|
} = _ref,
|
|
15481
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
15487
|
+
rest = _objectWithoutProperties(_ref, _excluded$k);
|
|
15482
15488
|
const [activeTab, setActiveTab] = React.useState();
|
|
15483
15489
|
React.useEffect(() => {
|
|
15484
15490
|
if (defaultActiveTab) {
|
|
@@ -18252,6 +18258,112 @@ const Style$B = dt.div`
|
|
|
18252
18258
|
}
|
|
18253
18259
|
`;
|
|
18254
18260
|
|
|
18261
|
+
const {
|
|
18262
|
+
Option
|
|
18263
|
+
} = antd.Select;
|
|
18264
|
+
const DEFAULT_STEP = 20;
|
|
18265
|
+
const DEFAULT_MIN = 0;
|
|
18266
|
+
const DEFAULT_MAX = 100;
|
|
18267
|
+
const STEP_SISTERS = ["#F04438", "#FF7A45", "#FFA940", "#95DE64", "#12B76A"]; // NOT REAL STEP SISTERS, JUST COLORS. 😂
|
|
18268
|
+
|
|
18269
|
+
function SliderItem({
|
|
18270
|
+
filter,
|
|
18271
|
+
onFilterChange
|
|
18272
|
+
}) {
|
|
18273
|
+
const [range, setRange] = React.useState([DEFAULT_MIN, DEFAULT_MAX]);
|
|
18274
|
+
const min = filter?.min ?? DEFAULT_MIN;
|
|
18275
|
+
const max = filter?.max ?? DEFAULT_MAX;
|
|
18276
|
+
const step = filter?.step ?? DEFAULT_STEP;
|
|
18277
|
+
const marks = React.useMemo(() => {
|
|
18278
|
+
const marksObj = {};
|
|
18279
|
+
for (let i = min; i <= max; i += step) {
|
|
18280
|
+
marksObj[i] = `${i}%`;
|
|
18281
|
+
}
|
|
18282
|
+
return marksObj;
|
|
18283
|
+
}, [min, max, step]);
|
|
18284
|
+
const getColorForValue = (start, end) => {
|
|
18285
|
+
const s = Number(start);
|
|
18286
|
+
const e = Number(end);
|
|
18287
|
+
if (Number.isNaN(s) || Number.isNaN(e)) return "transparent";
|
|
18288
|
+
const valueToStartIndex = v => {
|
|
18289
|
+
let idx = Math.floor((v - min) / step);
|
|
18290
|
+
if (idx < 0) idx = 0;
|
|
18291
|
+
if (idx >= STEP_SISTERS.length) idx = STEP_SISTERS.length - 1;
|
|
18292
|
+
return idx;
|
|
18293
|
+
};
|
|
18294
|
+
const valueToEndIndex = v => {
|
|
18295
|
+
let idx = Math.ceil((v - min) / step) - 1;
|
|
18296
|
+
if (idx < 0) idx = 0;
|
|
18297
|
+
if (idx >= STEP_SISTERS.length) idx = STEP_SISTERS.length - 1;
|
|
18298
|
+
return idx;
|
|
18299
|
+
};
|
|
18300
|
+
let startIndex = valueToStartIndex(Math.min(s, e));
|
|
18301
|
+
let endIndex = valueToEndIndex(Math.max(s, e));
|
|
18302
|
+
if (endIndex < startIndex) endIndex = startIndex;
|
|
18303
|
+
const colorsInRange = STEP_SISTERS.slice(startIndex, endIndex + 1);
|
|
18304
|
+
if (colorsInRange.length === 0) return "transparent";
|
|
18305
|
+
if (colorsInRange.length === 1) return colorsInRange[0];
|
|
18306
|
+
const sliceSize = 100 / colorsInRange.length;
|
|
18307
|
+
const gradientStops = colorsInRange.map((color, i) => {
|
|
18308
|
+
const startPct = +(i * sliceSize).toFixed(4);
|
|
18309
|
+
const endPct = +((i + 1) * sliceSize).toFixed(4);
|
|
18310
|
+
return `${color} ${startPct}% ${endPct}%`;
|
|
18311
|
+
}).join(", ");
|
|
18312
|
+
return `linear-gradient(to right, ${gradientStops})`;
|
|
18313
|
+
};
|
|
18314
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
18315
|
+
className: "form-row",
|
|
18316
|
+
children: [/*#__PURE__*/jsxRuntime.jsx("label", {
|
|
18317
|
+
children: filter?.label
|
|
18318
|
+
}), /*#__PURE__*/jsxRuntime.jsx(antd.Select, {
|
|
18319
|
+
value: `${range[0]} - ${range[1]}`,
|
|
18320
|
+
dropdownRender: () => /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
18321
|
+
style: {
|
|
18322
|
+
padding: "10px"
|
|
18323
|
+
},
|
|
18324
|
+
children: /*#__PURE__*/jsxRuntime.jsx(antd.ConfigProvider, {
|
|
18325
|
+
theme: {
|
|
18326
|
+
components: {
|
|
18327
|
+
Slider: {
|
|
18328
|
+
dotSize: 13
|
|
18329
|
+
}
|
|
18330
|
+
}
|
|
18331
|
+
},
|
|
18332
|
+
children: /*#__PURE__*/jsxRuntime.jsx(antd.Slider, {
|
|
18333
|
+
range: true,
|
|
18334
|
+
min: min,
|
|
18335
|
+
max: max,
|
|
18336
|
+
value: range,
|
|
18337
|
+
step: null,
|
|
18338
|
+
onChange: val => {
|
|
18339
|
+
setRange(val);
|
|
18340
|
+
onFilterChange({
|
|
18341
|
+
[filter?.key]: val
|
|
18342
|
+
});
|
|
18343
|
+
},
|
|
18344
|
+
tooltip: {
|
|
18345
|
+
open: false
|
|
18346
|
+
},
|
|
18347
|
+
marks: marks,
|
|
18348
|
+
styles: {
|
|
18349
|
+
track: {
|
|
18350
|
+
background: "transparent"
|
|
18351
|
+
},
|
|
18352
|
+
tracks: {
|
|
18353
|
+
background: getColorForValue(range[0], range[1])
|
|
18354
|
+
}
|
|
18355
|
+
}
|
|
18356
|
+
})
|
|
18357
|
+
})
|
|
18358
|
+
}),
|
|
18359
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(Option, {
|
|
18360
|
+
value: `${range[0]}-${range[1]}`,
|
|
18361
|
+
children: [range[0], " - ", range[1]]
|
|
18362
|
+
}, `${range[0]}-${range[1]}`)
|
|
18363
|
+
})]
|
|
18364
|
+
});
|
|
18365
|
+
}
|
|
18366
|
+
|
|
18255
18367
|
function Filters({
|
|
18256
18368
|
t,
|
|
18257
18369
|
filtersConfig,
|
|
@@ -18275,6 +18387,11 @@ function Filters({
|
|
|
18275
18387
|
})
|
|
18276
18388
|
})]
|
|
18277
18389
|
});
|
|
18390
|
+
case "slider":
|
|
18391
|
+
return /*#__PURE__*/jsxRuntime.jsx(SliderItem, {
|
|
18392
|
+
filter: filter,
|
|
18393
|
+
onFilterChange: onFilterChange
|
|
18394
|
+
});
|
|
18278
18395
|
default:
|
|
18279
18396
|
return null;
|
|
18280
18397
|
}
|
|
@@ -20159,14 +20276,14 @@ const MapConfig = ({
|
|
|
20159
20276
|
});
|
|
20160
20277
|
};
|
|
20161
20278
|
|
|
20162
|
-
const _excluded$
|
|
20279
|
+
const _excluded$j = ["config", "title", "loading"];
|
|
20163
20280
|
const Details = _ref => {
|
|
20164
20281
|
let {
|
|
20165
20282
|
config = [],
|
|
20166
20283
|
title,
|
|
20167
20284
|
loading = false
|
|
20168
20285
|
} = _ref,
|
|
20169
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
20286
|
+
rest = _objectWithoutProperties(_ref, _excluded$j);
|
|
20170
20287
|
return /*#__PURE__*/jsxRuntime.jsx(Widget, _objectSpread2(_objectSpread2({
|
|
20171
20288
|
className: "with-border-header h-w-btn-header card",
|
|
20172
20289
|
loading: loading,
|
|
@@ -20182,14 +20299,14 @@ const Details = _ref => {
|
|
|
20182
20299
|
}));
|
|
20183
20300
|
};
|
|
20184
20301
|
|
|
20185
|
-
const _excluded$
|
|
20302
|
+
const _excluded$i = ["config", "title", "loading"];
|
|
20186
20303
|
const KeyIndicatorsDetails = _ref => {
|
|
20187
20304
|
let {
|
|
20188
20305
|
config,
|
|
20189
20306
|
title,
|
|
20190
20307
|
loading = false
|
|
20191
20308
|
} = _ref,
|
|
20192
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
20309
|
+
rest = _objectWithoutProperties(_ref, _excluded$i);
|
|
20193
20310
|
return /*#__PURE__*/jsxRuntime.jsx(Widget, _objectSpread2(_objectSpread2({
|
|
20194
20311
|
className: "with-border-header h-w-btn-header",
|
|
20195
20312
|
title: title,
|
|
@@ -20219,7 +20336,7 @@ const Style$y = dt.div`
|
|
|
20219
20336
|
}
|
|
20220
20337
|
`;
|
|
20221
20338
|
|
|
20222
|
-
const _excluded$
|
|
20339
|
+
const _excluded$h = ["children", "config", "detailsTitle", "firstColumnWidth"];
|
|
20223
20340
|
const DetailsSection = _ref => {
|
|
20224
20341
|
let {
|
|
20225
20342
|
children,
|
|
@@ -20227,7 +20344,7 @@ const DetailsSection = _ref => {
|
|
|
20227
20344
|
detailsTitle,
|
|
20228
20345
|
firstColumnWidth = "250px"
|
|
20229
20346
|
} = _ref,
|
|
20230
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
20347
|
+
rest = _objectWithoutProperties(_ref, _excluded$h);
|
|
20231
20348
|
return /*#__PURE__*/jsxRuntime.jsx(Style$y, {
|
|
20232
20349
|
firstColumnWidth: firstColumnWidth,
|
|
20233
20350
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
@@ -20403,14 +20520,14 @@ const getGoalConfig = () => {
|
|
|
20403
20520
|
};
|
|
20404
20521
|
|
|
20405
20522
|
var _templateObject$8;
|
|
20406
|
-
const _excluded$
|
|
20523
|
+
const _excluded$g = ["title", "activeSdgGoals", "t"];
|
|
20407
20524
|
function SDGWidget(_ref) {
|
|
20408
20525
|
let {
|
|
20409
20526
|
title = "Sustainable Development Goals",
|
|
20410
20527
|
activeSdgGoals = [],
|
|
20411
20528
|
t = key => key
|
|
20412
20529
|
} = _ref,
|
|
20413
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
20530
|
+
props = _objectWithoutProperties(_ref, _excluded$g);
|
|
20414
20531
|
const sdgConfig = getGoalConfig();
|
|
20415
20532
|
return /*#__PURE__*/jsxRuntime.jsx(Widget, _objectSpread2(_objectSpread2({
|
|
20416
20533
|
title: title,
|
|
@@ -20506,15 +20623,18 @@ const SDGList = dt.ul`
|
|
|
20506
20623
|
justify-content: center;
|
|
20507
20624
|
background: var(--base-gray-30);
|
|
20508
20625
|
color: var(--base-gray-90);
|
|
20626
|
+
border-radius: 8px;
|
|
20627
|
+
border: 1px solid var(--base-gray-30);
|
|
20509
20628
|
}
|
|
20510
20629
|
`;
|
|
20511
20630
|
|
|
20512
20631
|
const GAP_BETWEEN_SDGS = 4;
|
|
20513
|
-
function SDGIcons({
|
|
20514
|
-
|
|
20515
|
-
|
|
20516
|
-
|
|
20517
|
-
|
|
20632
|
+
function SDGIcons(_ref) {
|
|
20633
|
+
let {
|
|
20634
|
+
sdgList = [],
|
|
20635
|
+
t = str => str,
|
|
20636
|
+
iconSize = 24
|
|
20637
|
+
} = _ref;
|
|
20518
20638
|
const containerRef = React__default["default"].useRef(null);
|
|
20519
20639
|
const [width, setWidth] = React__default["default"].useState(0);
|
|
20520
20640
|
React__default["default"].useEffect(() => {
|
|
@@ -20555,10 +20675,10 @@ function SDGIcons({
|
|
|
20555
20675
|
children: [visibleSdgs.map((sdg, index) => /*#__PURE__*/jsxRuntime.jsx("li", {
|
|
20556
20676
|
className: "project-widget-item",
|
|
20557
20677
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
20558
|
-
title: t(
|
|
20678
|
+
title: t("SDGS::".concat(sdg)),
|
|
20559
20679
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
20560
20680
|
style: {
|
|
20561
|
-
backgroundImage:
|
|
20681
|
+
backgroundImage: "url(".concat(SDG_IMAGES[sdg].img, ")"),
|
|
20562
20682
|
height: iconSize,
|
|
20563
20683
|
width: iconSize
|
|
20564
20684
|
},
|
|
@@ -20577,21 +20697,25 @@ function SDGIcons({
|
|
|
20577
20697
|
maxWidth: 200
|
|
20578
20698
|
},
|
|
20579
20699
|
children: sdgList.slice(visibleSdgs.length).map((sdg, idx) => /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
20580
|
-
title: t(
|
|
20700
|
+
title: t("SDGS::".concat(sdg)),
|
|
20581
20701
|
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
20582
20702
|
style: {
|
|
20583
20703
|
width: iconSize,
|
|
20584
20704
|
height: iconSize,
|
|
20585
|
-
backgroundImage:
|
|
20705
|
+
backgroundImage: "url(".concat(SDG_IMAGES[sdg].img, ")"),
|
|
20586
20706
|
backgroundSize: "cover",
|
|
20587
20707
|
borderRadius: 4
|
|
20588
20708
|
},
|
|
20589
|
-
title: t(
|
|
20709
|
+
title: t("SDGS::".concat(sdg))
|
|
20590
20710
|
})
|
|
20591
20711
|
}, idx))
|
|
20592
20712
|
}),
|
|
20593
20713
|
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
20594
20714
|
className: "sdg-item-image sdg-item-more",
|
|
20715
|
+
style: {
|
|
20716
|
+
height: iconSize,
|
|
20717
|
+
width: iconSize
|
|
20718
|
+
},
|
|
20595
20719
|
children: ["+", hiddenCount]
|
|
20596
20720
|
})
|
|
20597
20721
|
})
|
|
@@ -20614,7 +20738,7 @@ function SdgList({
|
|
|
20614
20738
|
});
|
|
20615
20739
|
}
|
|
20616
20740
|
|
|
20617
|
-
const _excluded$
|
|
20741
|
+
const _excluded$f = ["title", "description", "onLinkClick", "image", "linkIcon", "sdgList", "items", "onCardClick", "hideSDGList", "t"];
|
|
20618
20742
|
const {
|
|
20619
20743
|
Meta
|
|
20620
20744
|
} = antd.Card;
|
|
@@ -20634,7 +20758,7 @@ function ProjectWidget(_ref) {
|
|
|
20634
20758
|
hideSDGList = false,
|
|
20635
20759
|
t = x => x
|
|
20636
20760
|
} = _ref,
|
|
20637
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
20761
|
+
props = _objectWithoutProperties(_ref, _excluded$f);
|
|
20638
20762
|
const [isHovered, setIsHovered] = React__default["default"].useState(false);
|
|
20639
20763
|
const {
|
|
20640
20764
|
token
|
|
@@ -20797,13 +20921,13 @@ const WidgetCard = _ref => {
|
|
|
20797
20921
|
});
|
|
20798
20922
|
};
|
|
20799
20923
|
|
|
20800
|
-
const _excluded$
|
|
20924
|
+
const _excluded$e = ["title", "children"];
|
|
20801
20925
|
function CarouselWidget(_ref) {
|
|
20802
20926
|
let {
|
|
20803
20927
|
title,
|
|
20804
20928
|
children
|
|
20805
20929
|
} = _ref,
|
|
20806
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
20930
|
+
rest = _objectWithoutProperties(_ref, _excluded$e);
|
|
20807
20931
|
/**
|
|
20808
20932
|
* Handles carousel slide change events
|
|
20809
20933
|
* @param {number} currentSlide - The index of the current slide after change
|
|
@@ -20823,7 +20947,7 @@ function CarouselWidget(_ref) {
|
|
|
20823
20947
|
});
|
|
20824
20948
|
}
|
|
20825
20949
|
|
|
20826
|
-
const _excluded$
|
|
20950
|
+
const _excluded$d = ["title", "images", "height", "fallback"];
|
|
20827
20951
|
function ImageCarousel(_ref) {
|
|
20828
20952
|
let {
|
|
20829
20953
|
title,
|
|
@@ -20831,7 +20955,7 @@ function ImageCarousel(_ref) {
|
|
|
20831
20955
|
height = 400,
|
|
20832
20956
|
fallback = "/assets/images/empty-box.svg"
|
|
20833
20957
|
} = _ref,
|
|
20834
|
-
rest = _objectWithoutProperties(_ref, _excluded$
|
|
20958
|
+
rest = _objectWithoutProperties(_ref, _excluded$d);
|
|
20835
20959
|
const [previewVisible, setPreviewVisible] = React.useState(false);
|
|
20836
20960
|
const [current, setCurrent] = React.useState(0);
|
|
20837
20961
|
const carouselRef = React.useRef(null);
|
|
@@ -26012,7 +26136,7 @@ const RepeatableModals = ({
|
|
|
26012
26136
|
}) : null;
|
|
26013
26137
|
};
|
|
26014
26138
|
|
|
26015
|
-
const _excluded$
|
|
26139
|
+
const _excluded$c = ["viewGroup"],
|
|
26016
26140
|
_excluded2 = ["label", "icon", "position"];
|
|
26017
26141
|
const Content = _ref => {
|
|
26018
26142
|
let {
|
|
@@ -26080,7 +26204,7 @@ const Content = _ref => {
|
|
|
26080
26204
|
if (groups[gKey].viewGroup === key) {
|
|
26081
26205
|
// eslint-disable-next-line no-unused-vars
|
|
26082
26206
|
const _groups$gKey = groups[gKey],
|
|
26083
|
-
gCfg = _objectWithoutProperties(_groups$gKey, _excluded$
|
|
26207
|
+
gCfg = _objectWithoutProperties(_groups$gKey, _excluded$c);
|
|
26084
26208
|
items[gKey] = gCfg;
|
|
26085
26209
|
}
|
|
26086
26210
|
return items;
|
|
@@ -42188,7 +42312,7 @@ const getGrouContent = (form, values, i, formId, excludedKeys, getData, setValue
|
|
|
42188
42312
|
});
|
|
42189
42313
|
};
|
|
42190
42314
|
|
|
42191
|
-
const _excluded$
|
|
42315
|
+
const _excluded$b = ["icon"];
|
|
42192
42316
|
function DynamicForm(_ref) {
|
|
42193
42317
|
var _data$meta;
|
|
42194
42318
|
let {
|
|
@@ -42743,7 +42867,7 @@ function DynamicForm(_ref) {
|
|
|
42743
42867
|
let {
|
|
42744
42868
|
icon: Icon
|
|
42745
42869
|
} = _ref3,
|
|
42746
|
-
form = _objectWithoutProperties(_ref3, _excluded$
|
|
42870
|
+
form = _objectWithoutProperties(_ref3, _excluded$b);
|
|
42747
42871
|
return /*#__PURE__*/jsxRuntime.jsxs(antd.Button, {
|
|
42748
42872
|
type: "link",
|
|
42749
42873
|
size: "large",
|
|
@@ -43019,6 +43143,35 @@ function MultiBarProgress(_ref) {
|
|
|
43019
43143
|
}
|
|
43020
43144
|
const Style$r = dt.div(_templateObject$5 || (_templateObject$5 = _taggedTemplateLiteral(["\n\theight: 6px;\n\twidth: 100%;\n\tbackground: var(--base-gray-40);\n\tborder-radius: 8px;\n\tdisplay: flex;\n\toverflow: hidden;\n\tdiv {\n\t\theight: 100%;\n\t}\n"])));
|
|
43021
43145
|
|
|
43146
|
+
const _excluded$a = ["tooltipTitle", "percentage", "strokeColor", "showInfo"];
|
|
43147
|
+
function MultiColorProgressBar(_ref) {
|
|
43148
|
+
let {
|
|
43149
|
+
tooltipTitle,
|
|
43150
|
+
percentage,
|
|
43151
|
+
strokeColor = {
|
|
43152
|
+
'0%': '#32D583',
|
|
43153
|
+
'50%': '#FEC84B',
|
|
43154
|
+
'100%': '#F97066'
|
|
43155
|
+
},
|
|
43156
|
+
showInfo = false
|
|
43157
|
+
} = _ref,
|
|
43158
|
+
rest = _objectWithoutProperties(_ref, _excluded$a);
|
|
43159
|
+
return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
|
|
43160
|
+
title: tooltipTitle,
|
|
43161
|
+
children: /*#__PURE__*/jsxRuntime.jsx(antd.Progress, _objectSpread2({
|
|
43162
|
+
percent: percentage,
|
|
43163
|
+
strokeColor: strokeColor,
|
|
43164
|
+
showInfo: showInfo
|
|
43165
|
+
}, rest))
|
|
43166
|
+
});
|
|
43167
|
+
}
|
|
43168
|
+
MultiColorProgressBar.propTypes = {
|
|
43169
|
+
tooltipTitle: PropTypes__default["default"].string,
|
|
43170
|
+
percentage: PropTypes__default["default"].number,
|
|
43171
|
+
strokeColor: PropTypes__default["default"].object,
|
|
43172
|
+
showInfo: PropTypes__default["default"].bool
|
|
43173
|
+
};
|
|
43174
|
+
|
|
43022
43175
|
var _templateObject$4;
|
|
43023
43176
|
const Style$q = dt.div(_templateObject$4 || (_templateObject$4 = _taggedTemplateLiteral(["\n .icon-background {\n width: ", "px;\n height: ", "px;\n background-color: #69d99e;\n border-radius: 50%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n"])), _ref => {
|
|
43024
43177
|
let {
|
|
@@ -60236,6 +60389,7 @@ exports.MoreMenu = MoreMenu;
|
|
|
60236
60389
|
exports.MoreOptions = MoreOptions;
|
|
60237
60390
|
exports.MoreTags = MoreTags;
|
|
60238
60391
|
exports.MultiBarProgress = MultiBarProgress;
|
|
60392
|
+
exports.MultiColorProgressBar = MultiColorProgressBar;
|
|
60239
60393
|
exports.Multiselect = Multiselect;
|
|
60240
60394
|
exports.NotFound = NotFound;
|
|
60241
60395
|
exports.Pagination = Pagination;
|
|
@@ -60254,6 +60408,7 @@ exports.ProjectVisualisationSelect = CustomSelect;
|
|
|
60254
60408
|
exports.ProjectWidget = ProjectWidget;
|
|
60255
60409
|
exports.RadarChart = RadarChart;
|
|
60256
60410
|
exports.RadialBarChart = RadialBarChart;
|
|
60411
|
+
exports.SDGIcons = SDGIcons;
|
|
60257
60412
|
exports.SDGWidget = SDGWidget;
|
|
60258
60413
|
exports.SearchFilters = SearchFilters;
|
|
60259
60414
|
exports.Segment = Segment;
|
package/package.json
CHANGED
|
@@ -55,3 +55,12 @@ export const Primary = {
|
|
|
55
55
|
// },
|
|
56
56
|
},
|
|
57
57
|
};
|
|
58
|
+
|
|
59
|
+
export const WithDescription = {
|
|
60
|
+
name: "Widget with Description",
|
|
61
|
+
args: {
|
|
62
|
+
className: "with-border-header",
|
|
63
|
+
title: "Widget Title",
|
|
64
|
+
description: "This is a description of the widget.",
|
|
65
|
+
},
|
|
66
|
+
};
|
|
@@ -35,6 +35,7 @@ export default function Widget({
|
|
|
35
35
|
isCollapsable = false,
|
|
36
36
|
defaultCollapsed = false,
|
|
37
37
|
onExpandChange,
|
|
38
|
+
description,
|
|
38
39
|
}) {
|
|
39
40
|
const [showFilters, setShowFilters] = useState(false);
|
|
40
41
|
const [isCollapsed, setIsCollapsed] = useState(defaultCollapsed);
|
|
@@ -77,8 +78,11 @@ export default function Widget({
|
|
|
77
78
|
{!noTitle && (
|
|
78
79
|
<div className="widget-header flex-column">
|
|
79
80
|
<div className="flex flex-row widget-header-items">
|
|
80
|
-
<div
|
|
81
|
-
<
|
|
81
|
+
<div>
|
|
82
|
+
<div className="title cont">
|
|
83
|
+
<h1>{title}</h1>
|
|
84
|
+
</div>
|
|
85
|
+
<p>{description}</p>
|
|
82
86
|
</div>
|
|
83
87
|
|
|
84
88
|
{tooltip && (
|
|
@@ -213,4 +217,5 @@ Widget.propTypes = {
|
|
|
213
217
|
isCollapsable: PropTypes.bool,
|
|
214
218
|
defaultCollapsed: PropTypes.bool,
|
|
215
219
|
onExpandChange: PropTypes.func,
|
|
220
|
+
description: PropTypes.string,
|
|
216
221
|
};
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
},
|
|
51
|
+
],
|
|
52
|
+
onFilterChange: (changedFilter) => {
|
|
53
|
+
console.log("Filter changed:", changedFilter);
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
render: (args) => (
|
|
57
|
+
<div style={{ position: "relative", height: "400px" }}>
|
|
58
|
+
<SearchFilters {...args} />
|
|
59
|
+
</div>
|
|
60
|
+
),
|
|
61
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { Select, Slider, ConfigProvider } from "antd";
|
|
2
|
+
import { useState, useMemo } from "react";
|
|
3
|
+
|
|
4
|
+
const { Option } = Select;
|
|
5
|
+
|
|
6
|
+
const DEFAULT_STEP = 20;
|
|
7
|
+
const DEFAULT_MIN = 0;
|
|
8
|
+
const DEFAULT_MAX = 100;
|
|
9
|
+
|
|
10
|
+
const STEP_SISTERS = ["#F04438", "#FF7A45", "#FFA940", "#95DE64", "#12B76A"]; // NOT REAL STEP SISTERS, JUST COLORS. 😂
|
|
11
|
+
|
|
12
|
+
export default function SliderItem({ filter, onFilterChange }) {
|
|
13
|
+
const [range, setRange] = useState([DEFAULT_MIN, DEFAULT_MAX]);
|
|
14
|
+
|
|
15
|
+
const min = filter?.min ?? DEFAULT_MIN;
|
|
16
|
+
const max = filter?.max ?? DEFAULT_MAX;
|
|
17
|
+
const step = filter?.step ?? DEFAULT_STEP;
|
|
18
|
+
|
|
19
|
+
const marks = useMemo(() => {
|
|
20
|
+
const marksObj = {};
|
|
21
|
+
for (let i = min; i <= max; i += step) {
|
|
22
|
+
marksObj[i] = `${i}%`;
|
|
23
|
+
}
|
|
24
|
+
return marksObj;
|
|
25
|
+
}, [min, max, step]);
|
|
26
|
+
|
|
27
|
+
const getColorForValue = (start, end) => {
|
|
28
|
+
const s = Number(start);
|
|
29
|
+
const e = Number(end);
|
|
30
|
+
if (Number.isNaN(s) || Number.isNaN(e)) return "transparent";
|
|
31
|
+
|
|
32
|
+
const valueToStartIndex = (v) => {
|
|
33
|
+
let idx = Math.floor((v - min) / step);
|
|
34
|
+
if (idx < 0) idx = 0;
|
|
35
|
+
if (idx >= STEP_SISTERS.length) idx = STEP_SISTERS.length - 1;
|
|
36
|
+
return idx;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const valueToEndIndex = (v) => {
|
|
40
|
+
let idx = Math.ceil((v - min) / step) - 1;
|
|
41
|
+
if (idx < 0) idx = 0;
|
|
42
|
+
if (idx >= STEP_SISTERS.length) idx = STEP_SISTERS.length - 1;
|
|
43
|
+
return idx;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
let startIndex = valueToStartIndex(Math.min(s, e));
|
|
47
|
+
let endIndex = valueToEndIndex(Math.max(s, e));
|
|
48
|
+
|
|
49
|
+
if (endIndex < startIndex) endIndex = startIndex;
|
|
50
|
+
|
|
51
|
+
const colorsInRange = STEP_SISTERS.slice(startIndex, endIndex + 1);
|
|
52
|
+
|
|
53
|
+
if (colorsInRange.length === 0) return "transparent";
|
|
54
|
+
if (colorsInRange.length === 1) return colorsInRange[0];
|
|
55
|
+
|
|
56
|
+
const sliceSize = 100 / colorsInRange.length;
|
|
57
|
+
const gradientStops = colorsInRange
|
|
58
|
+
.map((color, i) => {
|
|
59
|
+
const startPct = +(i * sliceSize).toFixed(4);
|
|
60
|
+
const endPct = +((i + 1) * sliceSize).toFixed(4);
|
|
61
|
+
return `${color} ${startPct}% ${endPct}%`;
|
|
62
|
+
})
|
|
63
|
+
.join(", ");
|
|
64
|
+
|
|
65
|
+
return `linear-gradient(to right, ${gradientStops})`;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div className="form-row">
|
|
70
|
+
<label>{filter?.label}</label>
|
|
71
|
+
<Select
|
|
72
|
+
value={`${range[0]} - ${range[1]}`}
|
|
73
|
+
dropdownRender={() => (
|
|
74
|
+
<div style={{ padding: "10px" }}>
|
|
75
|
+
<ConfigProvider
|
|
76
|
+
theme={{
|
|
77
|
+
components: {
|
|
78
|
+
Slider: {
|
|
79
|
+
dotSize: 13,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
}}
|
|
83
|
+
>
|
|
84
|
+
<Slider
|
|
85
|
+
range
|
|
86
|
+
min={min}
|
|
87
|
+
max={max}
|
|
88
|
+
value={range}
|
|
89
|
+
step={null}
|
|
90
|
+
onChange={(val) => {
|
|
91
|
+
setRange(val);
|
|
92
|
+
onFilterChange({ [filter?.key]: val });
|
|
93
|
+
}}
|
|
94
|
+
tooltip={{
|
|
95
|
+
open: false,
|
|
96
|
+
}}
|
|
97
|
+
marks={marks}
|
|
98
|
+
styles={{
|
|
99
|
+
track: {
|
|
100
|
+
background: "transparent",
|
|
101
|
+
},
|
|
102
|
+
tracks: {
|
|
103
|
+
background: getColorForValue(range[0], range[1]),
|
|
104
|
+
},
|
|
105
|
+
}}
|
|
106
|
+
/>
|
|
107
|
+
</ConfigProvider>
|
|
108
|
+
</div>
|
|
109
|
+
)}
|
|
110
|
+
>
|
|
111
|
+
<Option
|
|
112
|
+
value={`${range[0]}-${range[1]}`}
|
|
113
|
+
key={`${range[0]}-${range[1]}`}
|
|
114
|
+
>
|
|
115
|
+
{range[0]} - {range[1]}
|
|
116
|
+
</Option>
|
|
117
|
+
</Select>
|
|
118
|
+
</div>
|
|
119
|
+
);
|
|
120
|
+
}
|
|
@@ -2,44 +2,47 @@ import { Button, Select } from "antd";
|
|
|
2
2
|
import CustomIcon from "../../Icon/CustomIcon.jsx";
|
|
3
3
|
import { Fragment, useState } from "react";
|
|
4
4
|
import Style from "./style.js";
|
|
5
|
+
import SliderItem from "./components/Slider/index.jsx";
|
|
5
6
|
|
|
6
7
|
export default function Filters({ t, filtersConfig, onFilterChange }) {
|
|
7
|
-
|
|
8
|
+
const [opened, setOpened] = useState(false);
|
|
8
9
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
10
|
+
const renderFilter = (filter) => {
|
|
11
|
+
switch (filter.type) {
|
|
12
|
+
case "select":
|
|
13
|
+
return (
|
|
14
|
+
<div className="form-row">
|
|
15
|
+
<label>{filter.label}</label>
|
|
16
|
+
<Select
|
|
17
|
+
allowClear
|
|
18
|
+
placeholder={filter.placeholder}
|
|
19
|
+
value={filter.value}
|
|
20
|
+
options={filter.options}
|
|
21
|
+
onChange={(c) => onFilterChange({ [filter.key]: c })}
|
|
22
|
+
/>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
case "slider":
|
|
26
|
+
return <SliderItem filter={filter} onFilterChange={onFilterChange} />;
|
|
27
|
+
default:
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
28
31
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
return (
|
|
33
|
+
<Style>
|
|
34
|
+
<Button onClick={() => setOpened((p) => !p)}>
|
|
35
|
+
{t("Filter")}
|
|
36
|
+
<CustomIcon width={16} height={16} name="Filter" />
|
|
37
|
+
</Button>
|
|
35
38
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
{opened ? (
|
|
40
|
+
<div className="filters">
|
|
41
|
+
{filtersConfig?.map((filter) => (
|
|
42
|
+
<Fragment key={filter.key}>{renderFilter(filter)}</Fragment>
|
|
43
|
+
))}
|
|
44
|
+
</div>
|
|
45
|
+
) : null}
|
|
46
|
+
</Style>
|
|
47
|
+
);
|
|
45
48
|
}
|
package/src/@daf/core/components/ProgressBar/MultiColorProgressBar/MultiColorProgressBar.stories.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import MultiColorProgressBar from "./index";
|
|
2
|
+
import ThemeLayout from "../../ThemeLayout";
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: "Components/Progress/MultiColorProgressBar",
|
|
6
|
+
component: MultiColorProgressBar,
|
|
7
|
+
tags: ["autodocs"],
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const Primary = {
|
|
11
|
+
name: "Default",
|
|
12
|
+
args: {
|
|
13
|
+
percentage: 100,
|
|
14
|
+
tooltipTitle: "Custom Tooltip",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Tooltip, Progress } from 'antd'
|
|
3
|
+
import PropTypes from 'prop-types'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* MultiColorProgressBar Component
|
|
7
|
+
*
|
|
8
|
+
* A progress bar component that displays progress with a gradient color scheme and tooltip support.
|
|
9
|
+
* Built on top of Ant Design's Progress component, this wrapper provides a multi-color gradient
|
|
10
|
+
* that transitions from green (0%) to yellow (50%) to red (100%) by default.
|
|
11
|
+
*
|
|
12
|
+
* @param {Object} props - The component props
|
|
13
|
+
* @param {string} [props.tooltipTitle] - Text to display in the tooltip on hover
|
|
14
|
+
* @param {number} props.percentage - The progress percentage (0-100)
|
|
15
|
+
* @param {Object} [props.strokeColor] - Gradient color configuration object with percentage keys
|
|
16
|
+
* @param {string} [props.strokeColor."0%"] - Start color of the gradient (default: '#32D583' - green)
|
|
17
|
+
* @param {string} [props.strokeColor."50%"] - Middle color of the gradient (default: '#FEC84B' - yellow)
|
|
18
|
+
* @param {string} [props.strokeColor."100%"] - End color of the gradient (default: '#F97066' - red)
|
|
19
|
+
* @param {boolean} [props.showInfo=false] - Whether to display the percentage text on the progress bar
|
|
20
|
+
* @param {...Object} [props.rest] - Additional props passed to the underlying Ant Design Progress component
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
function MultiColorProgressBar({
|
|
24
|
+
tooltipTitle,
|
|
25
|
+
percentage,
|
|
26
|
+
strokeColor = {
|
|
27
|
+
'0%': '#32D583',
|
|
28
|
+
'50%': '#FEC84B',
|
|
29
|
+
'100%': '#F97066',
|
|
30
|
+
},
|
|
31
|
+
showInfo = false,
|
|
32
|
+
...rest
|
|
33
|
+
}) {
|
|
34
|
+
return (
|
|
35
|
+
<Tooltip title={tooltipTitle}>
|
|
36
|
+
<Progress
|
|
37
|
+
percent={percentage}
|
|
38
|
+
strokeColor={strokeColor}
|
|
39
|
+
showInfo={showInfo}
|
|
40
|
+
{...rest}
|
|
41
|
+
/>
|
|
42
|
+
</Tooltip>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
MultiColorProgressBar.propTypes = {
|
|
47
|
+
tooltipTitle: PropTypes.string,
|
|
48
|
+
percentage: PropTypes.number,
|
|
49
|
+
strokeColor: PropTypes.object,
|
|
50
|
+
showInfo: PropTypes.bool,
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export default MultiColorProgressBar
|
|
@@ -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.js";
|
|
4
|
+
import { SDGList } from "./styles.js";
|
|
5
5
|
|
|
6
6
|
const GAP_BETWEEN_SDGS = 4;
|
|
7
7
|
|
|
@@ -90,7 +90,15 @@ export default function SDGIcons({
|
|
|
90
90
|
</div>
|
|
91
91
|
}
|
|
92
92
|
>
|
|
93
|
-
<div
|
|
93
|
+
<div
|
|
94
|
+
className="sdg-item-image sdg-item-more"
|
|
95
|
+
style={{
|
|
96
|
+
height: iconSize,
|
|
97
|
+
width: iconSize,
|
|
98
|
+
}}
|
|
99
|
+
>
|
|
100
|
+
+{hiddenCount}
|
|
101
|
+
</div>
|
|
94
102
|
</Popover>
|
|
95
103
|
</li>
|
|
96
104
|
)}
|
package/src/index.js
CHANGED
|
@@ -23,7 +23,6 @@ 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
|
-
|
|
27
26
|
// Filters
|
|
28
27
|
export {
|
|
29
28
|
default as SelectFilters,
|
|
@@ -89,6 +88,7 @@ export { AjaxSelectMain as AjaxSelect } from "./@daf/core/components/EditForm/co
|
|
|
89
88
|
// Progress Bar
|
|
90
89
|
export { default as ProgressBar } from "./@daf/core/components/ProgressBar/index.jsx";
|
|
91
90
|
export { default as MultiBarProgress } from "./@daf/core/components/ProgressBar/MultiBarProgress/index.jsx";
|
|
91
|
+
export { default as MultiColorProgressBar } from "./@daf/core/components/ProgressBar/MultiColorProgressBar/index.jsx";
|
|
92
92
|
export { default as ProgressBarSideIcon } from "./@daf/core/components/ProgressBar/components/SideIcon/index.jsx";
|
|
93
93
|
export { default as ProgressTabs } from "./@daf/core/components/ProgressTabs/index.jsx";
|
|
94
94
|
|
|
@@ -162,3 +162,6 @@ export { default as InformationChannelsSubject } from "./@daf/core/components/Sc
|
|
|
162
162
|
export { default as InformationChannelsView } from "./@daf/core/components/Screens/InformationChannels/InformationChannel/index.js";
|
|
163
163
|
export { default as InformationChannelsDataPoint } from "./@daf/core/components/Screens/InformationChannels/DataPoint/index.js";
|
|
164
164
|
export { InformationChannelProvider } from "./@daf/core/components/Screens/InformationChannels/context/index.js";
|
|
165
|
+
|
|
166
|
+
// UI
|
|
167
|
+
export { default as SDGIcons } from "./@daf/core/components/UI/SDGIcon/index.jsx";
|