datastake-daf 0.6.192 → 0.6.194

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.
@@ -11067,7 +11067,7 @@ var _templateObject$c;
11067
11067
  const _excluded$s = ["size", "maxHeight", "containerHeight", "dataSource", "columns", "pagination", "doEmptyRows"];
11068
11068
  function StickyTable(_ref) {
11069
11069
  let {
11070
- size = "small",
11070
+ size = null,
11071
11071
  maxHeight = 300,
11072
11072
  containerHeight = 525,
11073
11073
  dataSource = [],
@@ -11077,9 +11077,6 @@ function StickyTable(_ref) {
11077
11077
  } = _ref,
11078
11078
  props = _objectWithoutProperties(_ref, _excluded$s);
11079
11079
  const data = React__default["default"].useMemo(() => {
11080
- if (!doEmptyRows) {
11081
- return dataSource;
11082
- }
11083
11080
  const MIN_ROWS = 4;
11084
11081
  if (dataSource.length < MIN_ROWS) {
11085
11082
  const paddedData = [...dataSource];
@@ -11091,7 +11088,7 @@ function StickyTable(_ref) {
11091
11088
  return paddedData;
11092
11089
  }
11093
11090
  return dataSource;
11094
- }, [dataSource, doEmptyRows]);
11091
+ }, [dataSource]);
11095
11092
  const Wrapper = React__default["default"].useMemo(() => {
11096
11093
  return data.length > 5 ? ComponentWithFocus : "div";
11097
11094
  }, [data.length]);
@@ -11121,7 +11118,7 @@ function StickyTable(_ref) {
11121
11118
  })
11122
11119
  });
11123
11120
  }
11124
- const Style$I = dt.div(_templateObject$c || (_templateObject$c = _taggedTemplateLiteral(["\n\tmax-width: calc(100% - 48px);\n\tmargin-left: var(--size-lg);\n\toverflow: hidden;\n\n\t.daf-table {\n\t\tpadding: 0px;\n\t\tmargin-top: 0px;\n\n\t\t.ant-tag {\n\t\t\ttext-align: center;\n\t\t}\n\t}\n\n\t.daf-select-filters .filters {\n\t\tpadding-top: 16px;\n\t\tpadding-left: 0;\n\t\tpadding-right: 0;\n\t}\n\n\t.daf-table {\n\t\tpadding-top: 16px;\n\t}\n"])));
11121
+ const Style$I = dt.div(_templateObject$c || (_templateObject$c = _taggedTemplateLiteral(["\n max-width: calc(100% - 48px);\n margin-left: var(--size-lg);\n overflow: hidden;\n\n .daf-table {\n padding: 0px;\n margin-top: 0px;\n\n .ant-tag {\n text-align: center;\n }\n }\n\n .daf-select-filters .filters {\n padding-top: 16px;\n padding-left: 0;\n padding-right: 0;\n }\n\n .daf-table {\n padding-top: 16px;\n }\n"])));
11125
11122
  StickyTable.propTypes = {
11126
11123
  size: PropTypes__default["default"].any,
11127
11124
  maxHeight: PropTypes__default["default"].number,
@@ -14005,8 +14002,9 @@ const determineHasChildren = ({
14005
14002
 
14006
14003
  const sortByPosition = (items, getConfig) => {
14007
14004
  return items.sort((a, b) => {
14008
- const positionA = getConfig(a)?.position || 0;
14009
- const positionB = getConfig(b)?.position || 0;
14005
+ var _getConfig, _getConfig2;
14006
+ const positionA = ((_getConfig = getConfig(a)) === null || _getConfig === void 0 ? void 0 : _getConfig.position) || 0;
14007
+ const positionB = ((_getConfig2 = getConfig(b)) === null || _getConfig2 === void 0 ? void 0 : _getConfig2.position) || 0;
14010
14008
  return positionA - positionB;
14011
14009
  });
14012
14010
  };
@@ -14023,7 +14021,7 @@ const resolveDynamicLabel = (labelConfig, item, defaultLabel) => {
14023
14021
  const parts = labelKey.split(' is ');
14024
14022
  if (parts.length === 2) {
14025
14023
  const [conditionKey, conditionValue] = parts;
14026
- if (item?.[conditionKey] === conditionValue) {
14024
+ if ((item === null || item === void 0 ? void 0 : item[conditionKey]) === conditionValue) {
14027
14025
  return labelConfig[labelKey];
14028
14026
  }
14029
14027
  }
@@ -18754,17 +18752,6 @@ const Style$A = dt.div`
18754
18752
  position: relative;
18755
18753
  width: 100%;
18756
18754
  height: 472px;
18757
- min-height: 300px;
18758
-
18759
- @media (max-width: 768px) {
18760
- height: 350px;
18761
- min-height: 250px;
18762
- }
18763
-
18764
- @media (max-width: 480px) {
18765
- height: 300px;
18766
- min-height: 200px;
18767
- }
18768
18755
 
18769
18756
  .filter-cont {
18770
18757
  position: absolute;
@@ -20052,6 +20039,22 @@ const useGlobe = ({
20052
20039
  };
20053
20040
  };
20054
20041
 
20042
+ typeof localStorage.getItem('is_collapsed') === 'string' ? localStorage.getItem('is_collapsed') === 'true' ? true : false : true;
20043
+ typeof localStorage.getItem('is_nested_sidebar_collapsed') === 'string' ? localStorage.getItem('is_nested_sidebar_collapsed') === 'true' : true;
20044
+ const ResizeContext = /*#__PURE__*/React.createContext({
20045
+ resizeLoading: false,
20046
+ windowWidth: 0,
20047
+ resizeDif: 0,
20048
+ isCollapsed: false,
20049
+ setIsCollapsed: () => {},
20050
+ isNestedSidebarCollapsed: false,
20051
+ setIsNestedSidebarCollapsed: () => {}
20052
+ });
20053
+ const useResizeContext = () => {
20054
+ const values = React.useContext(ResizeContext);
20055
+ return values;
20056
+ };
20057
+
20055
20058
  function Globe(_ref) {
20056
20059
  var _activeMarker$data, _activeMarker$data2;
20057
20060
  let {
@@ -20092,6 +20095,11 @@ function Globe(_ref) {
20092
20095
  });
20093
20096
  }), [data]);
20094
20097
 
20098
+ // Get resize context for sidebar state changes
20099
+ const {
20100
+ isCollapsed
20101
+ } = useResizeContext();
20102
+
20095
20103
  // Use custom hook to configure globe functionality
20096
20104
  const {
20097
20105
  container,
@@ -20135,6 +20143,33 @@ function Globe(_ref) {
20135
20143
  return () => clearTimeout(timer);
20136
20144
  }
20137
20145
  }, [forceResize]);
20146
+
20147
+ // Force resize when sidebar state changes (handles width changes)
20148
+ React.useEffect(() => {
20149
+ if (forceResize) {
20150
+ // Trigger resize when sidebar collapses/expands
20151
+ const timer = setTimeout(() => {
20152
+ forceResize();
20153
+ }, 100);
20154
+ return () => clearTimeout(timer);
20155
+ }
20156
+ }, [isCollapsed, forceResize]);
20157
+
20158
+ // Force resize when window width changes (handles sidebar width changes)
20159
+ React.useEffect(() => {
20160
+ if (forceResize) {
20161
+ const handleResize = () => {
20162
+ // Small delay to ensure DOM has updated
20163
+ setTimeout(() => {
20164
+ forceResize();
20165
+ }, 100);
20166
+ };
20167
+ window.addEventListener('resize', handleResize);
20168
+ return () => {
20169
+ window.removeEventListener('resize', handleResize);
20170
+ };
20171
+ }
20172
+ }, [forceResize]);
20138
20173
  return /*#__PURE__*/jsxRuntime.jsx(ComponentWithFocus, {
20139
20174
  children: /*#__PURE__*/jsxRuntime.jsxs(Style$A, {
20140
20175
  className: formatClassname([showSider && activeMarker && "with-sider"]),
@@ -20923,8 +20958,8 @@ function ProjectWidget(_ref) {
20923
20958
  onLinkClick,
20924
20959
  image,
20925
20960
  linkIcon = "Link",
20926
- sdgList = [],
20927
- items = [],
20961
+ sdgList,
20962
+ items,
20928
20963
  onCardClick,
20929
20964
  hideSDGList = false,
20930
20965
  t = x => x
@@ -20936,9 +20971,9 @@ function ProjectWidget(_ref) {
20936
20971
  } = useToken$i();
20937
20972
  return /*#__PURE__*/jsxRuntime.jsxs(antd.Card, _objectSpread2(_objectSpread2({
20938
20973
  style: {
20939
- // flex: 1,
20940
- width: 318
20941
- // minWidth: "200px",
20974
+ flex: 1,
20975
+ width: "100%",
20976
+ minWidth: "200px"
20942
20977
  },
20943
20978
  hoverable: true,
20944
20979
  onMouseEnter: () => setIsHovered(true),
@@ -20952,8 +20987,7 @@ function ProjectWidget(_ref) {
20952
20987
  }
20953
20988
  }) : /*#__PURE__*/jsxRuntime.jsx("div", {
20954
20989
  style: {
20955
- height: "103px",
20956
- borderBottom: "1px solid var(--base-gray-30)"
20990
+ height: "103px"
20957
20991
  },
20958
20992
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Empty, {
20959
20993
  image: antd.Empty.PRESENTED_IMAGE_SIMPLE
@@ -37141,6 +37175,13 @@ const inputTypeComponent$1 = {
37141
37175
  },
37142
37176
  children: (opts || []).map((option, i) => {
37143
37177
  const otherProps = {};
37178
+
37179
+ // Handle disabled property from option
37180
+ if (option.disabled !== undefined) {
37181
+ otherProps.disabled = option.disabled;
37182
+ }
37183
+
37184
+ // Handle other dynamic properties from option.options
37144
37185
  if (option.options) {
37145
37186
  Object.keys(option.options).forEach(prop => {
37146
37187
  if (eval(option.options[prop])) {
@@ -37152,10 +37193,17 @@ const inputTypeComponent$1 = {
37152
37193
  }
37153
37194
  return option.items ? /*#__PURE__*/jsxRuntime.jsx(antd.Select.OptGroup, {
37154
37195
  label: option.label,
37155
- children: option.items.map((og, j) => /*#__PURE__*/jsxRuntime.jsx(antd.Select.Option, {
37156
- value: og.value,
37157
- children: og.label
37158
- }, `${i}${j}`))
37196
+ children: option.items.map((og, j) => {
37197
+ const groupOtherProps = {};
37198
+ if (og.disabled !== undefined) {
37199
+ groupOtherProps.disabled = og.disabled;
37200
+ }
37201
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Select.Option, {
37202
+ value: og.value,
37203
+ ...groupOtherProps,
37204
+ children: og.label
37205
+ }, `${i}${j}`);
37206
+ })
37159
37207
  }) : /*#__PURE__*/jsxRuntime.jsx(antd.Select.Option, {
37160
37208
  value: option.value,
37161
37209
  ...otherProps,
@@ -37262,6 +37310,13 @@ const inputTypeComponent$1 = {
37262
37310
  placeholder: getMetaPlaceholer(inputMeta, t) || getInputProp(props.placeholder, formsValue) || t('Select all relevant options'),
37263
37311
  children: (opts || []).map((option, i) => {
37264
37312
  const otherProps = {};
37313
+
37314
+ // Handle disabled property from option
37315
+ if (option.disabled !== undefined) {
37316
+ otherProps.disabled = option.disabled;
37317
+ }
37318
+
37319
+ // Handle other dynamic properties from option.options
37265
37320
  if (option.options) {
37266
37321
  Object.keys(option.options).forEach(prop => {
37267
37322
  if (eval(option.options[prop])) {
@@ -37271,15 +37326,24 @@ const inputTypeComponent$1 = {
37271
37326
  }
37272
37327
  });
37273
37328
  }
37329
+
37330
+ // If option is disabled and currently selected, remove it from selection
37274
37331
  if (otherProps.disabled && (value || []).includes(option.value)) {
37275
37332
  updateFormValues$1(repeatIndex, repeatValues, inputName, (value || []).filter(v => v !== option.value), formsValue, name, form);
37276
37333
  }
37277
37334
  return option.items ? /*#__PURE__*/jsxRuntime.jsx(antd.Select.OptGroup, {
37278
37335
  label: option.label,
37279
- children: option.items.map((og, j) => /*#__PURE__*/jsxRuntime.jsx(antd.Select.Option, {
37280
- value: og.value,
37281
- children: og.label
37282
- }, `${i}${j}`))
37336
+ children: option.items.map((og, j) => {
37337
+ const groupOtherProps = {};
37338
+ if (og.disabled !== undefined) {
37339
+ groupOtherProps.disabled = og.disabled;
37340
+ }
37341
+ return /*#__PURE__*/jsxRuntime.jsx(antd.Select.Option, {
37342
+ value: og.value,
37343
+ ...groupOtherProps,
37344
+ children: og.label
37345
+ }, `${i}${j}`);
37346
+ })
37283
37347
  }) : /*#__PURE__*/jsxRuntime.jsx(antd.Select.Option, {
37284
37348
  value: option.value,
37285
37349
  ...otherProps,
@@ -51534,22 +51598,6 @@ function useConfig(data) {
51534
51598
  return config;
51535
51599
  }
51536
51600
 
51537
- typeof localStorage.getItem('is_collapsed') === 'string' ? localStorage.getItem('is_collapsed') === 'true' ? true : false : true;
51538
- typeof localStorage.getItem('is_nested_sidebar_collapsed') === 'string' ? localStorage.getItem('is_nested_sidebar_collapsed') === 'true' : true;
51539
- const ResizeContext = /*#__PURE__*/React.createContext({
51540
- resizeLoading: false,
51541
- windowWidth: 0,
51542
- resizeDif: 0,
51543
- isCollapsed: false,
51544
- setIsCollapsed: () => {},
51545
- isNestedSidebarCollapsed: false,
51546
- setIsNestedSidebarCollapsed: () => {}
51547
- });
51548
- const useResizeContext = () => {
51549
- const values = React.useContext(ResizeContext);
51550
- return values;
51551
- };
51552
-
51553
51601
  const DAYS = ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"];
51554
51602
  function UserActivity({
51555
51603
  loading,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.192",
3
+ "version": "0.6.194",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -15,7 +15,7 @@
15
15
  "buffer": "^6.0.3",
16
16
  "countries-list": "^2.6.1",
17
17
  "country-city-location": "^1.0.13",
18
- "datastake-daf": "^0.5.780",
18
+ "datastake-daf": "0.6.184",
19
19
  "dayjs": "^1.11.12",
20
20
  "deepmerge": "^4.3.1",
21
21
  "dot-object": "^2.1.5",
@@ -8,6 +8,7 @@ import CustomIcon from "../../Icon/CustomIcon.jsx";
8
8
  import ComponentWithFocus from "../ComponentWithFocus/index.jsx";
9
9
  import { formatClassname } from "../../../../../helpers/ClassesHelper";
10
10
  import Filters from "../../Filters/FloatingFilters/index.js";
11
+ import { useResizeContext } from "../../../context/Resize/index.js";
11
12
 
12
13
  /**
13
14
  * Globe Component
@@ -129,6 +130,9 @@ function Globe({
129
130
  [data],
130
131
  );
131
132
 
133
+ // Get resize context for sidebar state changes
134
+ const { isCollapsed } = useResizeContext();
135
+
132
136
  // Use custom hook to configure globe functionality
133
137
  const { container, activeMarker, mapOptionsButtonsConfig, forceResize } = useGlobe({
134
138
  data: mappedData,
@@ -171,6 +175,37 @@ function Globe({
171
175
  }
172
176
  }, [forceResize]);
173
177
 
178
+ // Force resize when sidebar state changes (handles width changes)
179
+ useEffect(() => {
180
+ if (forceResize) {
181
+ // Trigger resize when sidebar collapses/expands
182
+ const timer = setTimeout(() => {
183
+ forceResize();
184
+ }, 100);
185
+
186
+ return () => clearTimeout(timer);
187
+ }
188
+ }, [isCollapsed, forceResize]);
189
+
190
+ // Force resize when window width changes (handles sidebar width changes)
191
+ useEffect(() => {
192
+ if (forceResize) {
193
+ const handleResize = () => {
194
+ // Small delay to ensure DOM has updated
195
+ setTimeout(() => {
196
+ forceResize();
197
+ }, 100);
198
+ };
199
+
200
+ window.addEventListener('resize', handleResize);
201
+
202
+ return () => {
203
+ window.removeEventListener('resize', handleResize);
204
+ };
205
+ }
206
+ }, [forceResize]);
207
+
208
+
174
209
  return (
175
210
  <ComponentWithFocus>
176
211
  <Style className={formatClassname([showSider && activeMarker && "with-sider"])}>
@@ -6,17 +6,6 @@ const Style = styled.div`
6
6
  position: relative;
7
7
  width: 100%;
8
8
  height: 472px;
9
- min-height: 300px;
10
-
11
- @media (max-width: 768px) {
12
- height: 350px;
13
- min-height: 250px;
14
- }
15
-
16
- @media (max-width: 480px) {
17
- height: 300px;
18
- min-height: 200px;
19
- }
20
9
 
21
10
  .filter-cont {
22
11
  position: absolute;
@@ -7,86 +7,85 @@ const { Meta } = Card;
7
7
  const { useToken } = theme;
8
8
 
9
9
  export default function ProjectWidget({
10
- title,
11
- description,
12
- onLinkClick,
13
- image,
14
- linkIcon = "Link",
15
- sdgList = [],
16
- items = [],
17
- onCardClick,
18
- hideSDGList = false,
19
- t = (x) => x,
20
- ...props
10
+ title,
11
+ description,
12
+ onLinkClick,
13
+ image,
14
+ linkIcon = "Link",
15
+ sdgList,
16
+ items,
17
+ onCardClick,
18
+ hideSDGList = false,
19
+ t = (x) => x,
20
+ ...props
21
21
  }) {
22
- const [isHovered, setIsHovered] = React.useState(false);
23
- const { token } = useToken();
22
+ const [isHovered, setIsHovered] = React.useState(false);
23
+ const { token } = useToken();
24
24
 
25
- return (
26
- <Card
27
- style={{
28
- // flex: 1,
29
- width: 318,
30
- // minWidth: "200px",
31
- }}
32
- hoverable
33
- onMouseEnter={() => setIsHovered(true)}
34
- onMouseLeave={() => setIsHovered(false)}
35
- onClick={onCardClick}
36
- cover={
37
- <ImageContainer>
38
- {image ? (
39
- <div
40
- className="image"
41
- style={{
42
- backgroundImage: `url(${image})`,
43
- }}
44
- />
45
- ) : (
46
- <div
47
- style={{
48
- height: "103px",
49
- borderBottom: "1px solid var(--base-gray-30)",
50
- }}
51
- >
52
- <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
53
- </div>
54
- )}
25
+ return (
26
+ <Card
27
+ style={{
28
+ flex: 1,
29
+ width: "100%",
30
+ minWidth: "200px",
31
+ }}
32
+ hoverable
33
+ onMouseEnter={() => setIsHovered(true)}
34
+ onMouseLeave={() => setIsHovered(false)}
35
+ onClick={onCardClick}
36
+ cover={
37
+ <ImageContainer>
38
+ {image ? (
39
+ <div
40
+ className="image"
41
+ style={{
42
+ backgroundImage: `url(${image})`,
43
+ }}
44
+ />
45
+ ) : (
46
+ <div
47
+ style={{
48
+ height: "103px",
49
+ }}
50
+ >
51
+ <Empty image={Empty.PRESENTED_IMAGE_SIMPLE} />
52
+ </div>
53
+ )}
55
54
 
56
- {onLinkClick && (
57
- <div className="icon-container" onClick={onLinkClick}>
58
- <CustomIcon
59
- name={linkIcon}
60
- width={16}
61
- height={16}
62
- color={isHovered ? token.colorPrimary7 : "black"}
63
- />
64
- </div>
65
- )}
66
- </ImageContainer>
67
- }
68
- {...props}
69
- >
70
- <Meta title={title || undefined} description={description || undefined} />
71
- <ProjectWidgetItems>
72
- {items.map((item, index) => (
73
- <li key={index} className="project-widget-item">
74
- <Label>{item.label}</Label>
75
- {item.render()}
76
- </li>
77
- ))}
78
- </ProjectWidgetItems>
55
+ {onLinkClick && (
56
+ <div className="icon-container" onClick={onLinkClick}>
57
+ <CustomIcon
58
+ name={linkIcon}
59
+ width={16}
60
+ height={16}
61
+ color={isHovered ? token.colorPrimary7 : "black"}
62
+ />
63
+ </div>
64
+ )}
65
+ </ImageContainer>
66
+ }
67
+ {...props}
68
+ >
69
+ <Meta title={title || undefined} description={description || undefined} />
70
+ <ProjectWidgetItems>
71
+ {items.map((item, index) => (
72
+ <li key={index} className="project-widget-item">
73
+ <Label>{item.label}</Label>
74
+ {item.render()}
75
+ </li>
76
+ ))}
77
+ </ProjectWidgetItems>
79
78
 
80
- {!hideSDGList && (
81
- <div
82
- style={{
83
- borderTop: "1px solid var(--base-gray-30)",
84
- paddingTop: "10px",
85
- }}
86
- >
87
- <SdgList sdgList={sdgList} t={t} />
88
- </div>
89
- )}
90
- </Card>
91
- );
79
+ {!hideSDGList && (
80
+ <div
81
+ style={{
82
+ borderTop: "1px solid var(--base-gray-30)",
83
+ paddingTop: "10px",
84
+ }}
85
+ >
86
+ <SdgList sdgList={sdgList} t={t} />
87
+ </div>
88
+ )}
89
+ </Card>
90
+ );
92
91
  }
@@ -21,6 +21,7 @@ const Options = [
21
21
  {
22
22
  label: "Option 3",
23
23
  value: "option3",
24
+ disabled: true,
24
25
  },
25
26
  {
26
27
  label: "Option 4",
@@ -692,6 +692,13 @@ export const inputTypeComponent = {
692
692
  >
693
693
  {(opts || []).map((option, i) => {
694
694
  const otherProps = {};
695
+
696
+ // Handle disabled property from option
697
+ if (option.disabled !== undefined) {
698
+ otherProps.disabled = option.disabled;
699
+ }
700
+
701
+ // Handle other dynamic properties from option.options
695
702
  if (option.options) {
696
703
  Object.keys(option.options).forEach(prop => {
697
704
  if (eval(option.options[prop])) {
@@ -701,13 +708,20 @@ export const inputTypeComponent = {
701
708
  }
702
709
  });
703
710
  }
711
+
704
712
  return option.items ?
705
713
  <Select.OptGroup label={option.label}>
706
- {option.items.map((og, j) =>
707
- <Select.Option value={og.value} key={`${i}${j}`}>
708
- {og.label}
709
- </Select.Option>
710
- )}
714
+ {option.items.map((og, j) => {
715
+ const groupOtherProps = {};
716
+ if (og.disabled !== undefined) {
717
+ groupOtherProps.disabled = og.disabled;
718
+ }
719
+ return (
720
+ <Select.Option value={og.value} key={`${i}${j}`} {...groupOtherProps}>
721
+ {og.label}
722
+ </Select.Option>
723
+ );
724
+ })}
711
725
  </Select.OptGroup> :
712
726
  <Select.Option value={option.value} key={option.value} {...otherProps}>
713
727
  {isEvaluation ? (
@@ -798,6 +812,13 @@ export const inputTypeComponent = {
798
812
  >
799
813
  {(opts || []).map((option, i) => {
800
814
  const otherProps = {};
815
+
816
+ // Handle disabled property from option
817
+ if (option.disabled !== undefined) {
818
+ otherProps.disabled = option.disabled;
819
+ }
820
+
821
+ // Handle other dynamic properties from option.options
801
822
  if (option.options) {
802
823
  Object.keys(option.options).forEach(prop => {
803
824
  if (eval(option.options[prop])) {
@@ -807,16 +828,25 @@ export const inputTypeComponent = {
807
828
  }
808
829
  });
809
830
  }
831
+
832
+ // If option is disabled and currently selected, remove it from selection
810
833
  if (otherProps.disabled && (value || []).includes(option.value)) {
811
834
  updateFormValues(repeatIndex, repeatValues, inputName, (value || []).filter(v => v !== option.value), formsValue, name, form)
812
835
  }
836
+
813
837
  return option.items ?
814
838
  <Select.OptGroup label={option.label}>
815
- {option.items.map((og, j) =>
816
- <Select.Option value={og.value} key={`${i}${j}`}>
817
- {og.label}
818
- </Select.Option>
819
- )}
839
+ {option.items.map((og, j) => {
840
+ const groupOtherProps = {};
841
+ if (og.disabled !== undefined) {
842
+ groupOtherProps.disabled = og.disabled;
843
+ }
844
+ return (
845
+ <Select.Option value={og.value} key={`${i}${j}`} {...groupOtherProps}>
846
+ {og.label}
847
+ </Select.Option>
848
+ );
849
+ })}
820
850
  </Select.OptGroup> :
821
851
  <Select.Option value={option.value} key={i} {...otherProps}>
822
852
  {option.label}
@@ -5,94 +5,90 @@ import PropTypes from "prop-types";
5
5
  import ComponentWithFocus from "../../Dashboard/ComponentWithFocus/index.jsx";
6
6
 
7
7
  export default function StickyTable({
8
- size = "small",
9
- maxHeight = 300,
10
- containerHeight = 525,
11
- dataSource = [],
12
- columns = {},
13
- pagination = false,
14
- doEmptyRows = true,
15
- ...props
8
+ size = null,
9
+ maxHeight = 300,
10
+ containerHeight = 525,
11
+ dataSource = [],
12
+ columns = {},
13
+ pagination = false,
14
+ doEmptyRows = true,
15
+ ...props
16
16
  }) {
17
- const data = React.useMemo(() => {
18
- if (!doEmptyRows) {
19
- return dataSource;
20
- }
17
+ const data = React.useMemo(() => {
18
+ const MIN_ROWS = 4;
21
19
 
22
- const MIN_ROWS = 4;
20
+ if (dataSource.length < MIN_ROWS) {
21
+ const paddedData = [...dataSource];
22
+ while (paddedData.length < MIN_ROWS) {
23
+ paddedData.push({ empty: true });
24
+ }
25
+ return paddedData;
26
+ }
23
27
 
24
- if (dataSource.length < MIN_ROWS) {
25
- const paddedData = [...dataSource];
26
- while (paddedData.length < MIN_ROWS) {
27
- paddedData.push({ empty: true });
28
- }
29
- return paddedData;
30
- }
28
+ return dataSource;
29
+ }, [dataSource]);
31
30
 
32
- return dataSource;
33
- }, [dataSource, doEmptyRows]);
31
+ const Wrapper = React.useMemo(() => {
32
+ return data.length > 5 ? ComponentWithFocus : "div";
33
+ }, [data.length]);
34
34
 
35
- const Wrapper = React.useMemo(() => {
36
- return data.length > 5 ? ComponentWithFocus : "div";
37
- }, [data.length]);
38
-
39
- return (
40
- <Wrapper>
41
- <Style>
42
- <div
43
- className="daf-table-wrapper"
44
- style={{
45
- maxHeight: containerHeight,
46
- overflowY: "auto",
47
- }}
48
- >
49
- <div className="daf-sticky-table">
50
- <Table
51
- {...props}
52
- size={size}
53
- scroll
54
- sticky
55
- style={{ maxHeight }}
56
- dataSource={data}
57
- columns={columns}
58
- pagination={pagination}
59
- />
60
- </div>
61
- </div>
62
- </Style>
63
- </Wrapper>
64
- );
35
+ return (
36
+ <Wrapper>
37
+ <Style>
38
+ <div
39
+ className="daf-table-wrapper"
40
+ style={{
41
+ maxHeight: containerHeight,
42
+ overflowY: "auto",
43
+ }}
44
+ >
45
+ <div className="daf-sticky-table">
46
+ <Table
47
+ {...props}
48
+ size={size}
49
+ scroll
50
+ sticky
51
+ style={{ maxHeight }}
52
+ dataSource={data}
53
+ columns={columns}
54
+ pagination={pagination}
55
+ />
56
+ </div>
57
+ </div>
58
+ </Style>
59
+ </Wrapper>
60
+ );
65
61
  }
66
62
 
67
63
  const Style = styled.div`
68
- max-width: calc(100% - 48px);
69
- margin-left: var(--size-lg);
70
- overflow: hidden;
64
+ max-width: calc(100% - 48px);
65
+ margin-left: var(--size-lg);
66
+ overflow: hidden;
71
67
 
72
- .daf-table {
73
- padding: 0px;
74
- margin-top: 0px;
68
+ .daf-table {
69
+ padding: 0px;
70
+ margin-top: 0px;
75
71
 
76
- .ant-tag {
77
- text-align: center;
78
- }
79
- }
72
+ .ant-tag {
73
+ text-align: center;
74
+ }
75
+ }
80
76
 
81
- .daf-select-filters .filters {
82
- padding-top: 16px;
83
- padding-left: 0;
84
- padding-right: 0;
85
- }
77
+ .daf-select-filters .filters {
78
+ padding-top: 16px;
79
+ padding-left: 0;
80
+ padding-right: 0;
81
+ }
86
82
 
87
- .daf-table {
88
- padding-top: 16px;
89
- }
83
+ .daf-table {
84
+ padding-top: 16px;
85
+ }
90
86
  `;
91
87
 
92
88
  StickyTable.propTypes = {
93
- size: PropTypes.any,
94
- maxHeight: PropTypes.number,
95
- dataSource: PropTypes.array,
96
- columns: PropTypes.object,
97
- pagination: PropTypes.any,
89
+ size: PropTypes.any,
90
+ maxHeight: PropTypes.number,
91
+ dataSource: PropTypes.array,
92
+ columns: PropTypes.object,
93
+ pagination: PropTypes.any,
98
94
  };
package/.env DELETED
@@ -1,8 +0,0 @@
1
- REACT_APP_API_KEY=
2
- REACT_APP_AUTH_DOMAIN=
3
- REACT_APP_PROJECT_ID=
4
- REACT_APP_STORAGE_BUCKED=
5
- REACT_APP_SENDER_ID=
6
- REACT_APP_APP_ID=
7
- REACT_APP_MEASUREMENT_ID=
8
- REACT_APP_VAPID_KEY=
@@ -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,39 +0,0 @@
1
- import ScrollWidget from "./index";
2
- import ThemeLayout from "../../../ThemeLayout";
3
- import DashboardLayout from "../../DashboardLayout";
4
- import ProjectWidget from "../ProjectWidget";
5
-
6
- export default {
7
- title: "Dashboard/Widgets/ScrollWidget",
8
- component: ScrollWidget,
9
- tags: ["autodocs"],
10
- decorators: [
11
- (Story) => (
12
- <div style={{ margin: "3em" }}>
13
- <ThemeLayout>
14
- <Story />
15
- </ThemeLayout>
16
- </div>
17
- ),
18
- ],
19
- };
20
-
21
- export const Primary = {
22
- name: "Scroll Widget",
23
- args: {
24
- title: "Scroll Widget Title",
25
- },
26
- render: (args) => (
27
- <DashboardLayout>
28
- <ScrollWidget {...args}>
29
- <section className="nowrap">
30
- <ProjectWidget hideSDGList />
31
- <ProjectWidget hideSDGList />
32
- <ProjectWidget hideSDGList />
33
- <ProjectWidget hideSDGList />
34
- <ProjectWidget hideSDGList />
35
- </section>
36
- </ScrollWidget>
37
- </DashboardLayout>
38
- ),
39
- };
@@ -1,22 +0,0 @@
1
- import Widget from "../index.jsx";
2
-
3
- export default function ScrollWidget({ classname, widgetClassname, children, ...props }) {
4
- return (
5
- <Widget className={widgetClassname} {...props}>
6
- <div
7
- style={{
8
- overflowX: "auto",
9
- overflowY: "hidden",
10
- width: "100%",
11
- display: "flex",
12
- gap: "10px",
13
- alignItems: "stretch",
14
- scrollbarWidth: "thin",
15
- scrollbarColor: "#ccc transparent",
16
- }}
17
- >
18
- {children}
19
- </div>
20
- </Widget>
21
- );
22
- }