datastake-daf 0.6.823 → 0.6.824

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.
@@ -185,6 +185,16 @@ const findOptions = (value, options) => {
185
185
  return value;
186
186
  };
187
187
  const isEmptyOrSpaces = str => typeof str === 'string' ? str === null || str.match(/^ *$/) !== null : true;
188
+ const safeJsonParse = function (value) {
189
+ let fallback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : value;
190
+ if (typeof value !== 'string') return value;
191
+ try {
192
+ return JSON.parse(value);
193
+ } catch (_unused) {
194
+ console.warn('Failed to parse JSON:', value);
195
+ return fallback;
196
+ }
197
+ };
188
198
  const cleanJSON = json => {
189
199
  for (let key in json) {
190
200
  if (json[key] === undefined) {
@@ -4817,7 +4827,7 @@ const config$2 = {
4817
4827
  AddDocument: config$3
4818
4828
  };
4819
4829
 
4820
- const _excluded$G = ["width", "height", "size", "name", "fill"];
4830
+ const _excluded$E = ["width", "height", "size", "name", "fill"];
4821
4831
  const CustomIcon = _ref => {
4822
4832
  let {
4823
4833
  width = 14,
@@ -4826,7 +4836,7 @@ const CustomIcon = _ref => {
4826
4836
  name = "",
4827
4837
  fill = "none"
4828
4838
  } = _ref,
4829
- props = _objectWithoutProperties(_ref, _excluded$G);
4839
+ props = _objectWithoutProperties(_ref, _excluded$E);
4830
4840
  const conf = config$2[name];
4831
4841
  if (conf) {
4832
4842
  return /*#__PURE__*/jsxRuntime.jsx("svg", _objectSpread2(_objectSpread2({}, props), {}, {
@@ -5115,7 +5125,7 @@ createCommonjsModule(function (module, exports) {
5115
5125
  !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])+"]"}}}));
5116
5126
  });
5117
5127
 
5118
- const _excluded$F = ["view", "module", "scope", "form", "meta", "createdAt", "updatedAt"];
5128
+ const _excluded$D = ["view", "module", "scope", "form", "meta", "createdAt", "updatedAt"];
5119
5129
  dayjs__default["default"].extend(customParseFormat);
5120
5130
  dayjs__default["default"].extend(utc);
5121
5131
  dayjs__default["default"].extend(utc);
@@ -5491,7 +5501,7 @@ const filterCreateData = data => {
5491
5501
  createdAt,
5492
5502
  updatedAt
5493
5503
  } = data,
5494
- rest = _objectWithoutProperties(data, _excluded$F);
5504
+ rest = _objectWithoutProperties(data, _excluded$D);
5495
5505
  const _meta = isObjectEmpty(meta) ? undefined : meta;
5496
5506
  return _objectSpread2(_objectSpread2({}, rest), {}, {
5497
5507
  meta: _meta
@@ -6023,7 +6033,7 @@ SelectFilters.propTypes = {
6023
6033
  apiUrl: PropTypes__default["default"].string
6024
6034
  };
6025
6035
 
6026
- const _excluded$E = ["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"];
6036
+ const _excluded$C = ["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"];
6027
6037
  function DAFTable(_ref) {
6028
6038
  let {
6029
6039
  columns = [],
@@ -6054,7 +6064,7 @@ function DAFTable(_ref) {
6054
6064
  app,
6055
6065
  doEmptyRows
6056
6066
  } = _ref,
6057
- rest = _objectWithoutProperties(_ref, _excluded$E);
6067
+ rest = _objectWithoutProperties(_ref, _excluded$C);
6058
6068
  const source = React.useMemo(() => {
6059
6069
  if (data && Array.isArray(data)) {
6060
6070
  return data;
@@ -6113,7 +6123,7 @@ function DAFTable(_ref) {
6113
6123
 
6114
6124
  const paginationPageSize = pagination === null || pagination === void 0 ? void 0 : pagination.pageSize;
6115
6125
  const dataSource = React.useMemo(() => {
6116
- const pageSize = paginationPageSize ? paginationPageSize : source.length > 10 ? source.length : 10;
6126
+ const pageSize = paginationPageSize ? paginationPageSize : (source === null || source === void 0 ? void 0 : source.length) > 10 ? source === null || source === void 0 ? void 0 : source.length : 10;
6117
6127
  if (doEmptyRows && pageSize) {
6118
6128
  const emptyDataSource = [];
6119
6129
  for (let i = 0; i < pageSize; i++) {
@@ -6879,7 +6889,7 @@ function ComponentWithFocus(_ref) {
6879
6889
  }
6880
6890
 
6881
6891
  var _templateObject$h;
6882
- const _excluded$D = ["size", "maxHeight", "containerHeight", "dataSource", "columns", "pagination", "doEmptyRows"];
6892
+ const _excluded$B = ["size", "maxHeight", "containerHeight", "dataSource", "columns", "pagination", "doEmptyRows"];
6883
6893
  function StickyTable(_ref) {
6884
6894
  let {
6885
6895
  size = "small",
@@ -6890,7 +6900,7 @@ function StickyTable(_ref) {
6890
6900
  pagination = false,
6891
6901
  doEmptyRows = true
6892
6902
  } = _ref,
6893
- props = _objectWithoutProperties(_ref, _excluded$D);
6903
+ props = _objectWithoutProperties(_ref, _excluded$B);
6894
6904
  const data = React__default["default"].useMemo(() => {
6895
6905
  if (!doEmptyRows) {
6896
6906
  return dataSource;
@@ -7418,7 +7428,7 @@ const BTN_SIZE = {
7418
7428
  LG: 'large'
7419
7429
  };
7420
7430
 
7421
- const _excluded$C = ["content", "size", "type", "icon", "onClick", "disabled", "loading", "title", "style", "className"];
7431
+ const _excluded$A = ["content", "size", "type", "icon", "onClick", "disabled", "loading", "title", "style", "className"];
7422
7432
  function DafButton(_ref) {
7423
7433
  let {
7424
7434
  content = '',
@@ -7432,7 +7442,7 @@ function DafButton(_ref) {
7432
7442
  style = {},
7433
7443
  className = ''
7434
7444
  } = _ref,
7435
- restProps = _objectWithoutProperties(_ref, _excluded$C);
7445
+ restProps = _objectWithoutProperties(_ref, _excluded$A);
7436
7446
  return /*#__PURE__*/jsxRuntime.jsx(antd.Button, _objectSpread2(_objectSpread2({
7437
7447
  icon: icon,
7438
7448
  type: type,
@@ -7551,12 +7561,12 @@ const Style$R = styled__default["default"].div`
7551
7561
  }
7552
7562
  `;
7553
7563
 
7554
- const _excluded$B = ["children"];
7564
+ const _excluded$z = ["children"];
7555
7565
  const BorderedButton = _ref => {
7556
7566
  let {
7557
7567
  children
7558
7568
  } = _ref,
7559
- props = _objectWithoutProperties(_ref, _excluded$B);
7569
+ props = _objectWithoutProperties(_ref, _excluded$z);
7560
7570
  return /*#__PURE__*/jsxRuntime.jsx(Style$R, {
7561
7571
  className: "d-btn-cont",
7562
7572
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, _objectSpread2(_objectSpread2({}, props), {}, {
@@ -7696,12 +7706,12 @@ Badge.propTypes = {
7696
7706
  props: PropTypes__default["default"].object
7697
7707
  };
7698
7708
 
7699
- const _excluded$A = ["icon"];
7709
+ const _excluded$y = ["icon"];
7700
7710
  function GetIcon(_ref) {
7701
7711
  let {
7702
7712
  icon
7703
7713
  } = _ref,
7704
- props = _objectWithoutProperties(_ref, _excluded$A);
7714
+ props = _objectWithoutProperties(_ref, _excluded$y);
7705
7715
  let Icon = Icons__namespace.CloseOutlined;
7706
7716
  if (Icons__namespace[icon]) {
7707
7717
  Icon = Icons__namespace[icon];
@@ -8031,7 +8041,7 @@ const MultiSelectStyled = styled__default["default"](antd.Select)`
8031
8041
  }
8032
8042
  `;
8033
8043
 
8034
- const _excluded$z = ["options", "defaultSelected", "onChange", "textWhenMultiple", "withCount", "oneAlwaysSelected", "canUnselectLast", "isAvatarGroup", "maxAvatarCount", "dropDownWidth", "topAvatarValue", "isSingle", "selectionType"];
8044
+ const _excluded$x = ["options", "defaultSelected", "onChange", "textWhenMultiple", "withCount", "oneAlwaysSelected", "canUnselectLast", "isAvatarGroup", "maxAvatarCount", "dropDownWidth", "topAvatarValue", "isSingle", "selectionType"];
8035
8045
  const {
8036
8046
  useToken: useToken$p
8037
8047
  } = antd.theme;
@@ -8124,7 +8134,7 @@ function Multiselect(_ref) {
8124
8134
  isSingle = false,
8125
8135
  selectionType = SELECTION_TYPES.DEFAULT
8126
8136
  } = _ref,
8127
- restProps = _objectWithoutProperties(_ref, _excluded$z);
8137
+ restProps = _objectWithoutProperties(_ref, _excluded$x);
8128
8138
  const {
8129
8139
  token
8130
8140
  } = useToken$p();
@@ -8844,7 +8854,7 @@ DAFHeader.propTypes = {
8844
8854
  filtersConfig: PropTypes__default["default"].any
8845
8855
  };
8846
8856
 
8847
- const _excluded$y = ["tabs", "onChange", "value", "className"];
8857
+ const _excluded$w = ["tabs", "onChange", "value", "className"];
8848
8858
  function TabsHeader(_ref) {
8849
8859
  let {
8850
8860
  tabs = [],
@@ -8852,7 +8862,7 @@ function TabsHeader(_ref) {
8852
8862
  value = '',
8853
8863
  className = 'mt-2'
8854
8864
  } = _ref,
8855
- rest = _objectWithoutProperties(_ref, _excluded$y);
8865
+ rest = _objectWithoutProperties(_ref, _excluded$w);
8856
8866
  return /*#__PURE__*/jsxRuntime.jsx("div", {
8857
8867
  className: formatClassname(['daf-tabs-header pl-6 pr-6', className]),
8858
8868
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Tabs, _objectSpread2({
@@ -8949,7 +8959,7 @@ DrawerHeader.propTypes = {
8949
8959
  tabsConfig: PropTypes__default["default"].any
8950
8960
  };
8951
8961
 
8952
- const _excluded$x = ["label", "onClick", "icon", "type", "tooltip", "disabled", "loading", "style", "className"];
8962
+ const _excluded$v = ["label", "onClick", "icon", "type", "tooltip", "disabled", "loading", "style", "className"];
8953
8963
  const useFooter = _ref => {
8954
8964
  let {
8955
8965
  leftContent,
@@ -8984,7 +8994,7 @@ const useFooter = _ref => {
8984
8994
  style = {},
8985
8995
  className = ""
8986
8996
  } = button,
8987
- restProps = _objectWithoutProperties(button, _excluded$x);
8997
+ restProps = _objectWithoutProperties(button, _excluded$v);
8988
8998
  return /*#__PURE__*/jsxRuntime.jsx(DafButton, _objectSpread2({
8989
8999
  content: label,
8990
9000
  type: type,
@@ -11865,7 +11875,7 @@ Widget.propTypes = {
11865
11875
  };
11866
11876
  Widget.displayName = 'Widget';
11867
11877
 
11868
- const _excluded$w = ["loading", "title", "image", "description", "imgAlt", "noDescriptionText", "isPdf"];
11878
+ const _excluded$u = ["loading", "title", "image", "description", "imgAlt", "noDescriptionText", "isPdf"];
11869
11879
  function ImageWidget(_ref) {
11870
11880
  let {
11871
11881
  loading = false,
@@ -11876,7 +11886,7 @@ function ImageWidget(_ref) {
11876
11886
  noDescriptionText,
11877
11887
  isPdf = false
11878
11888
  } = _ref,
11879
- props = _objectWithoutProperties(_ref, _excluded$w);
11889
+ props = _objectWithoutProperties(_ref, _excluded$u);
11880
11890
  const expandable = isPdf ? false : props.expandable;
11881
11891
  return /*#__PURE__*/jsxRuntime.jsx(Widget, _objectSpread2(_objectSpread2({
11882
11892
  loading: loading,
@@ -11936,7 +11946,7 @@ function ImageWidget(_ref) {
11936
11946
  ImageWidget.displayName = 'ImageWidget';
11937
11947
 
11938
11948
  var _templateObject$e;
11939
- const _excluded$v = ["title", "loading", "data", "current", "defaultActiveTab", "widgetClassname", "className", "direction"];
11949
+ const _excluded$t = ["title", "loading", "data", "current", "defaultActiveTab", "widgetClassname", "className", "direction"];
11940
11950
  function FlowWidget(_ref) {
11941
11951
  let {
11942
11952
  title,
@@ -11948,7 +11958,7 @@ function FlowWidget(_ref) {
11948
11958
  className,
11949
11959
  direction = "horizontal"
11950
11960
  } = _ref,
11951
- rest = _objectWithoutProperties(_ref, _excluded$v);
11961
+ rest = _objectWithoutProperties(_ref, _excluded$t);
11952
11962
  const [activeTab, setActiveTab] = React.useState();
11953
11963
  React.useEffect(() => {
11954
11964
  if (defaultActiveTab) {
@@ -15679,7 +15689,7 @@ Map$3.propTypes = {
15679
15689
  link: PropTypes__default["default"].any
15680
15690
  };
15681
15691
 
15682
- const _excluded$u = ["isExpanded", "shouldRenderMap", "renderKey", "title", "loading", "t", "user", "data", "height", "widgetConfig"];
15692
+ const _excluded$s = ["isExpanded", "shouldRenderMap", "renderKey", "title", "loading", "t", "user", "data", "height", "widgetConfig"];
15683
15693
  function InExpandableWidgetMap(_ref) {
15684
15694
  let {
15685
15695
  isExpanded,
@@ -15693,7 +15703,7 @@ function InExpandableWidgetMap(_ref) {
15693
15703
  height,
15694
15704
  widgetConfig
15695
15705
  } = _ref,
15696
- rest = _objectWithoutProperties(_ref, _excluded$u);
15706
+ rest = _objectWithoutProperties(_ref, _excluded$s);
15697
15707
  const [mapKey, setMapKey] = React.useState(0);
15698
15708
  const [isMapReady, setIsMapReady] = React.useState(false);
15699
15709
  React.useEffect(() => {
@@ -17893,14 +17903,14 @@ const MapConfig = ({
17893
17903
  });
17894
17904
  };
17895
17905
 
17896
- const _excluded$t = ["config", "title", "loading"];
17906
+ const _excluded$r = ["config", "title", "loading"];
17897
17907
  const Details = _ref => {
17898
17908
  let {
17899
17909
  config = [],
17900
17910
  title,
17901
17911
  loading = false
17902
17912
  } = _ref,
17903
- rest = _objectWithoutProperties(_ref, _excluded$t);
17913
+ rest = _objectWithoutProperties(_ref, _excluded$r);
17904
17914
  return /*#__PURE__*/jsxRuntime.jsx(Widget, _objectSpread2(_objectSpread2({
17905
17915
  className: "with-border-header h-w-btn-header card",
17906
17916
  loading: loading,
@@ -17916,14 +17926,14 @@ const Details = _ref => {
17916
17926
  }));
17917
17927
  };
17918
17928
 
17919
- const _excluded$s = ["config", "title", "loading"];
17929
+ const _excluded$q = ["config", "title", "loading"];
17920
17930
  const KeyIndicatorsDetails = _ref => {
17921
17931
  let {
17922
17932
  config,
17923
17933
  title,
17924
17934
  loading = false
17925
17935
  } = _ref,
17926
- rest = _objectWithoutProperties(_ref, _excluded$s);
17936
+ rest = _objectWithoutProperties(_ref, _excluded$q);
17927
17937
  return /*#__PURE__*/jsxRuntime.jsx(Widget, _objectSpread2(_objectSpread2({
17928
17938
  className: "with-border-header h-w-btn-header",
17929
17939
  title: title,
@@ -17953,7 +17963,7 @@ const Style$G = styled__default["default"].div`
17953
17963
  }
17954
17964
  `;
17955
17965
 
17956
- const _excluded$r = ["children", "config", "detailsTitle", "firstColumnWidth"];
17966
+ const _excluded$p = ["children", "config", "detailsTitle", "firstColumnWidth"];
17957
17967
  const DetailsSection = _ref => {
17958
17968
  let {
17959
17969
  children,
@@ -17961,7 +17971,7 @@ const DetailsSection = _ref => {
17961
17971
  detailsTitle,
17962
17972
  firstColumnWidth = "250px"
17963
17973
  } = _ref,
17964
- rest = _objectWithoutProperties(_ref, _excluded$r);
17974
+ rest = _objectWithoutProperties(_ref, _excluded$p);
17965
17975
  return /*#__PURE__*/jsxRuntime.jsx(Style$G, {
17966
17976
  firstColumnWidth: firstColumnWidth,
17967
17977
  children: /*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -18137,14 +18147,14 @@ const getGoalConfig = () => {
18137
18147
  };
18138
18148
 
18139
18149
  var _templateObject$c;
18140
- const _excluded$q = ["title", "activeSdgGoals", "t"];
18150
+ const _excluded$o = ["title", "activeSdgGoals", "t"];
18141
18151
  function SDGWidget(_ref) {
18142
18152
  let {
18143
18153
  title = "Sustainable Development Goals",
18144
18154
  activeSdgGoals = [],
18145
18155
  t = key => key
18146
18156
  } = _ref,
18147
- props = _objectWithoutProperties(_ref, _excluded$q);
18157
+ props = _objectWithoutProperties(_ref, _excluded$o);
18148
18158
  const sdgConfig = getGoalConfig();
18149
18159
  return /*#__PURE__*/jsxRuntime.jsx(Widget, _objectSpread2(_objectSpread2({
18150
18160
  title: title,
@@ -18442,7 +18452,7 @@ function SdgList({
18442
18452
  });
18443
18453
  }
18444
18454
 
18445
- const _excluded$p = ["title", "description", "onLinkClick", "image", "linkIcon", "sdgList", "items", "onCardClick", "hideSDGList", "t"];
18455
+ const _excluded$n = ["title", "description", "onLinkClick", "image", "linkIcon", "sdgList", "items", "onCardClick", "hideSDGList", "t"];
18446
18456
  const {
18447
18457
  Meta
18448
18458
  } = antd.Card;
@@ -18462,7 +18472,7 @@ function ProjectWidget(_ref) {
18462
18472
  hideSDGList = false,
18463
18473
  t = x => x
18464
18474
  } = _ref,
18465
- props = _objectWithoutProperties(_ref, _excluded$p);
18475
+ props = _objectWithoutProperties(_ref, _excluded$n);
18466
18476
  const [isHovered, setIsHovered] = React__default["default"].useState(false);
18467
18477
  const {
18468
18478
  token
@@ -18734,13 +18744,13 @@ const WidgetCard = _ref => {
18734
18744
  });
18735
18745
  };
18736
18746
 
18737
- const _excluded$o = ["title", "children"];
18747
+ const _excluded$m = ["title", "children"];
18738
18748
  const CarouselWidget = /*#__PURE__*/React.forwardRef((_ref, ref) => {
18739
18749
  let {
18740
18750
  title,
18741
18751
  children
18742
18752
  } = _ref,
18743
- rest = _objectWithoutProperties(_ref, _excluded$o);
18753
+ rest = _objectWithoutProperties(_ref, _excluded$m);
18744
18754
  /**
18745
18755
  * Handles carousel slide change events
18746
18756
  * @param {number} currentSlide - The index of the current slide after change
@@ -18904,7 +18914,7 @@ const EmptyStateContainer = styled__default["default"].div`
18904
18914
  }
18905
18915
  `;
18906
18916
 
18907
- const _excluded$n = ["title", "images", "height", "fallback", "activeDotColor", "inactiveDotColor", "arrowIconColor", "arrowHoverIconColor", "customArrows", "emptyLogo", "emptyText"];
18917
+ const _excluded$l = ["title", "images", "height", "fallback", "activeDotColor", "inactiveDotColor", "arrowIconColor", "arrowHoverIconColor", "customArrows", "emptyLogo", "emptyText"];
18908
18918
  function ImageCarousel(_ref) {
18909
18919
  let {
18910
18920
  title,
@@ -18919,7 +18929,7 @@ function ImageCarousel(_ref) {
18919
18929
  emptyLogo = antd.Empty.PRESENTED_IMAGE_SIMPLE,
18920
18930
  emptyText = "No Image"
18921
18931
  } = _ref,
18922
- rest = _objectWithoutProperties(_ref, _excluded$n);
18932
+ rest = _objectWithoutProperties(_ref, _excluded$l);
18923
18933
  const [previewVisible, setPreviewVisible] = React.useState(false);
18924
18934
  const [current, setCurrent] = React.useState(0);
18925
18935
  const carouselRef = React.useRef(null);
@@ -19288,7 +19298,7 @@ const getVegetationConfig = () => {
19288
19298
  };
19289
19299
 
19290
19300
  var _templateObject$a, _templateObject2$3;
19291
- const _excluded$m = ["title", "activeVegetationConditions", "filterKeys", "columnsPerRow", "itemWidth", "itemHeight", "growthObservations", "t"];
19301
+ const _excluded$k = ["title", "activeVegetationConditions", "filterKeys", "columnsPerRow", "itemWidth", "itemHeight", "growthObservations", "t"];
19292
19302
  function VegetationWidget(_ref) {
19293
19303
  let {
19294
19304
  title = "Vegetation Health",
@@ -19300,7 +19310,7 @@ function VegetationWidget(_ref) {
19300
19310
  growthObservations = [],
19301
19311
  t = key => key
19302
19312
  } = _ref,
19303
- props = _objectWithoutProperties(_ref, _excluded$m);
19313
+ props = _objectWithoutProperties(_ref, _excluded$k);
19304
19314
  let vegetationConfig = getVegetationConfig();
19305
19315
  const allVegetationKeys = vegetationConfig.map(item => item.key);
19306
19316
  if (filterKeys && Array.isArray(filterKeys)) {
@@ -19416,7 +19426,7 @@ const getFaunaConfig = () => {
19416
19426
  };
19417
19427
 
19418
19428
  var _templateObject$9, _templateObject2$2;
19419
- const _excluded$l = ["title", "faunaPresent", "filterKeys", "columnsPerRow", "itemWidth", "itemHeight", "t"];
19429
+ const _excluded$j = ["title", "faunaPresent", "filterKeys", "columnsPerRow", "itemWidth", "itemHeight", "t"];
19420
19430
  function FaunaWidget(_ref) {
19421
19431
  let {
19422
19432
  title = "Observed Fauna",
@@ -19427,7 +19437,7 @@ function FaunaWidget(_ref) {
19427
19437
  itemHeight = 100,
19428
19438
  t = key => key
19429
19439
  } = _ref,
19430
- props = _objectWithoutProperties(_ref, _excluded$l);
19440
+ props = _objectWithoutProperties(_ref, _excluded$j);
19431
19441
  let faunaConfig = getFaunaConfig();
19432
19442
 
19433
19443
  // Filter to show only specific keys if filterKeys is provided
@@ -19492,7 +19502,7 @@ const getInvasiveSpeciesConfig = () => {
19492
19502
  };
19493
19503
 
19494
19504
  var _templateObject$8, _templateObject2$1;
19495
- const _excluded$k = ["title", "invasiveSpecies", "hasInvasiveSpecies", "filterKeys", "columnsPerRow", "itemWidth", "itemHeight", "t"];
19505
+ const _excluded$i = ["title", "invasiveSpecies", "hasInvasiveSpecies", "filterKeys", "columnsPerRow", "itemWidth", "itemHeight", "t"];
19496
19506
  function InvasiveSpeciesWidget(_ref) {
19497
19507
  let {
19498
19508
  title = "Invasive Species",
@@ -19504,7 +19514,7 @@ function InvasiveSpeciesWidget(_ref) {
19504
19514
  itemHeight = 100,
19505
19515
  t = key => key
19506
19516
  } = _ref,
19507
- props = _objectWithoutProperties(_ref, _excluded$k);
19517
+ props = _objectWithoutProperties(_ref, _excluded$i);
19508
19518
  let invasiveSpeciesConfig = getInvasiveSpeciesConfig();
19509
19519
 
19510
19520
  // Filter to show only specific keys if filterKeys is provided
@@ -24927,7 +24937,7 @@ const RepeatableModals = ({
24927
24937
  }) : null;
24928
24938
  };
24929
24939
 
24930
- const _excluded$j = ["viewGroup"],
24940
+ const _excluded$h = ["viewGroup"],
24931
24941
  _excluded2$1 = ["label", "icon", "position"];
24932
24942
  const Content$1 = _ref => {
24933
24943
  let {
@@ -24999,7 +25009,7 @@ const Content$1 = _ref => {
24999
25009
  if (groups[gKey].viewGroup === key) {
25000
25010
  // eslint-disable-next-line no-unused-vars
25001
25011
  const _groups$gKey = groups[gKey],
25002
- gCfg = _objectWithoutProperties(_groups$gKey, _excluded$j);
25012
+ gCfg = _objectWithoutProperties(_groups$gKey, _excluded$h);
25003
25013
  items[gKey] = gCfg;
25004
25014
  }
25005
25015
  return items;
@@ -25286,7 +25296,7 @@ const Content$1 = _ref => {
25286
25296
  });
25287
25297
  };
25288
25298
 
25289
- const _excluded$i = ["t", "open", "title", "children", "onClose", "onSuccess", "cancelBtnText", "saveBtnText", "className", "loading", "disabled", "withModalFormWrapper"];
25299
+ const _excluded$g = ["t", "open", "title", "children", "onClose", "onSuccess", "cancelBtnText", "saveBtnText", "className", "loading", "disabled", "withModalFormWrapper"];
25290
25300
  function Modal(_ref) {
25291
25301
  let {
25292
25302
  t = text => text,
@@ -25302,7 +25312,7 @@ function Modal(_ref) {
25302
25312
  disabled = false,
25303
25313
  withModalFormWrapper = true
25304
25314
  } = _ref,
25305
- props = _objectWithoutProperties(_ref, _excluded$i);
25315
+ props = _objectWithoutProperties(_ref, _excluded$g);
25306
25316
  return /*#__PURE__*/jsxRuntime.jsxs(antd.Modal, _objectSpread2(_objectSpread2({
25307
25317
  width: 650,
25308
25318
  footer: null,
@@ -30794,6 +30804,7 @@ function Repeatable({
30794
30804
  });
30795
30805
  }
30796
30806
 
30807
+ /* eslint-disable no-eval */
30797
30808
  const isRiskComment = inputData => {
30798
30809
  if (inputData) {
30799
30810
  if (inputData.name === 'assessment') {
@@ -30806,10 +30817,7 @@ const isRiskComment = inputData => {
30806
30817
  };
30807
30818
 
30808
30819
  // options, k, setValues, values, excludedKeys, i, formTitles, getData, MainForm, plainForms, setAddress, onValuesChange, data, allData, changeLinking, changeInputMeta, t, highlightMandatory
30809
- function renderNestedInputs$1(options, k) {
30810
- for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
30811
- args[_key - 2] = arguments[_key];
30812
- }
30820
+ function renderNestedInputs$1(options, k, ...args) {
30813
30821
  if (options[k].repeatable) {
30814
30822
  return renderRepeatable$1(options, k, ...args);
30815
30823
  } else {
@@ -30837,11 +30845,10 @@ function renderRepeatable$1(options, k, setValues, values, excludedKeys, i, form
30837
30845
  children: [getFormTitles$1(formTitles, formId, i), ['h2', 'h3', 'h4', 'h5', 'h6'].includes(form.type) ? getInputHeadLines$1(form.type, i, form, values) : /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
30838
30846
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Form.List, {
30839
30847
  name: formId,
30840
- children: (fields, _ref) => {
30841
- let {
30842
- add,
30843
- remove
30844
- } = _ref;
30848
+ children: (fields, {
30849
+ add,
30850
+ remove
30851
+ }) => {
30845
30852
  const formData = form.repeatable ? values[formId] || [] : values[formId] ? [values[formId]] : [];
30846
30853
  if (fields.length === 0) {
30847
30854
  const formInputs = form.inputs;
@@ -30891,10 +30898,14 @@ function renderRepeatable$1(options, k, setValues, values, excludedKeys, i, form
30891
30898
  const _val = {
30892
30899
  [formId]: formData.map((d, j) => i === j ? val : d)
30893
30900
  };
30894
- onValuesChange(_val, _objectSpread2(_objectSpread2({}, values), _val));
30895
- setValues(_objectSpread2(_objectSpread2({}, values), {}, {
30901
+ onValuesChange(_val, {
30902
+ ...values,
30903
+ ..._val
30904
+ });
30905
+ setValues({
30906
+ ...values,
30896
30907
  [formId]: formData.map((d, j) => i === j ? val : d)
30897
- }));
30908
+ });
30898
30909
  };
30899
30910
  return /*#__PURE__*/jsxRuntime.jsx(Repeatable, {
30900
30911
  form: form,
@@ -30950,156 +30961,154 @@ const getGroupContent = (form, values, i, formId, excludedKeys, getData, setValu
30950
30961
  highlightMandatory
30951
30962
  });
30952
30963
  };
30953
- const GroupContent = _ref2 => {
30954
- var _form$meta;
30955
- let {
30956
- form,
30957
- values = {},
30958
- i,
30959
- formId,
30960
- excludedKeys,
30961
- getData,
30962
- setValues,
30963
- MainForm,
30964
- options,
30965
- plainForms,
30966
- setAddress,
30967
- onValuesChange,
30968
- allData,
30969
- changeInputMeta,
30970
- highlightMandatory
30971
- } = _ref2;
30964
+ const GroupContent = ({
30965
+ form,
30966
+ values = {},
30967
+ i,
30968
+ formId,
30969
+ excludedKeys,
30970
+ getData,
30971
+ setValues,
30972
+ MainForm,
30973
+ options,
30974
+ plainForms,
30975
+ setAddress,
30976
+ onValuesChange,
30977
+ allData,
30978
+ changeInputMeta,
30979
+ highlightMandatory
30980
+ }) => {
30972
30981
  const {
30973
30982
  user,
30974
30983
  t
30975
30984
  } = useEditContext();
30976
30985
  const label = getInputLabel$1(form, values);
30977
- const notPartOfTheForm = (form === null || form === void 0 ? void 0 : form.type) === 'ajaxSubGroup' ? true : !!(form !== null && form !== void 0 && (_form$meta = form.meta) !== null && _form$meta !== void 0 && _form$meta.isSubGroup);
30986
+ const notPartOfTheForm = form?.type === 'ajaxSubGroup' ? true : !!form?.meta?.isSubGroup;
30978
30987
  const hasLabel = label && (typeof label === 'string' && (label || '').trim() !== '' || typeof label === 'object') ? true : false;
30979
30988
  const formValues = values[form.dataId];
30980
- const renderInputs = () => {
30981
- var _form$meta2;
30982
- return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
30983
- children: [form !== null && form !== void 0 && (_form$meta2 = form.meta) !== null && _form$meta2 !== void 0 && _form$meta2.groupInfo ? /*#__PURE__*/jsxRuntime.jsx(GroupInfos, {
30984
- config: form.meta.groupInfo,
30985
- user: user,
30986
- t: t
30987
- }) : null, Object.keys(form.inputs || {}).filter(i => !excludedKeys.includes(i)).map((inp, ii) => {
30988
- var _ref3, _values$meta, _values$meta2, _input$meta, _inputData$rules, _input$meta2;
30989
- const isAjaxSubGroup = (form === null || form === void 0 ? void 0 : form.type) === "ajaxSubGroup";
30990
- const input = form.inputs[inp];
30991
- const inputId = input.dataId || inp;
30992
- const inputValues = notPartOfTheForm ? Array.isArray(values[formId]) ? values[formId] || {} : values[formId] || {} : values;
30993
- const value = inputValues[inputId];
30994
- const commentValue = inputValues["".concat(inputId, "Comment")];
30995
- const inputData = getData(formId, input, value, commentValue, "".concat(formId, ".").concat(inputId), "".concat(formId, ".").concat(inputId));
30996
- const subtitles = form.subtitles || null;
30997
- const inputMeta = notPartOfTheForm ? isAjaxSubGroup ? ((_ref3 = values[formId] || {}) === null || _ref3 === void 0 || (_ref3 = _ref3.meta) === null || _ref3 === void 0 || (_ref3 = _ref3.inputs) === null || _ref3 === void 0 ? void 0 : _ref3[inputId]) || {} : (((values === null || values === void 0 || (_values$meta = values.meta) === null || _values$meta === void 0 ? void 0 : _values$meta.inputs) || {})[formId] || {})[inputId] || {} : ((values === null || values === void 0 || (_values$meta2 = values.meta) === null || _values$meta2 === void 0 ? void 0 : _values$meta2.inputs) || {})[inputId] || {};
30998
- inputData.repeatIndex = undefined;
30999
- inputData.inputName = inputId;
31000
- inputData.repeatValues = inputValues;
31001
- if (inputData.groupInputs && Array.isArray(inputData.groupInputs)) {
31002
- inputData.groupInputs = inputData.groupInputs.map(gpI => {
31003
- gpI.data.inputName = gpI.data.name;
31004
- gpI.data.repeatIndex = undefined;
31005
- gpI.data.name = formId;
31006
- return gpI;
30989
+ const renderInputs = () => /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
30990
+ children: [form?.meta?.groupInfo ? /*#__PURE__*/jsxRuntime.jsx(GroupInfos, {
30991
+ config: form.meta.groupInfo,
30992
+ user: user,
30993
+ t: t
30994
+ }) : null, Object.keys(form.inputs || {}).filter(i => !excludedKeys.includes(i)).map((inp, ii) => {
30995
+ const isAjaxSubGroup = form?.type === "ajaxSubGroup";
30996
+ const input = form.inputs[inp];
30997
+ const inputId = input.dataId || inp;
30998
+ const inputValues = notPartOfTheForm ? Array.isArray(values[formId]) ? values[formId] || {} : values[formId] || {} : values;
30999
+ const value = inputValues[inputId];
31000
+ const commentValue = inputValues[`${inputId}Comment`];
31001
+ const inputData = getData(formId, input, value, commentValue, `${formId}.${inputId}`, `${formId}.${inputId}`);
31002
+ const subtitles = form.subtitles || null;
31003
+ const inputMeta = notPartOfTheForm ? isAjaxSubGroup ? (values[formId] || {})?.meta?.inputs?.[inputId] || {} : ((values?.meta?.inputs || {})[formId] || {})[inputId] || {} : (values?.meta?.inputs || {})[inputId] || {};
31004
+ inputData.repeatIndex = undefined;
31005
+ inputData.inputName = inputId;
31006
+ inputData.repeatValues = inputValues;
31007
+ if (inputData.groupInputs && Array.isArray(inputData.groupInputs)) {
31008
+ inputData.groupInputs = inputData.groupInputs.map(gpI => {
31009
+ gpI.data.inputName = gpI.data.name;
31010
+ gpI.data.repeatIndex = undefined;
31011
+ gpI.data.name = formId;
31012
+ return gpI;
31013
+ });
31014
+ }
31015
+ const isRisk = isRiskComment(inputData);
31016
+ const isHighlighted = highlightMandatory && input?.meta?.mandatory && inputIsEmpty(input, inputValues, inputMeta);
31017
+ const btnOnClick = () => {
31018
+ if (typeof inputData.commentValue === 'string') {
31019
+ onValuesChange({}, {
31020
+ ...values,
31021
+ [`${inputData.inputName}`]: null
31007
31022
  });
31008
31023
  }
31009
- const isRisk = isRiskComment(inputData);
31010
- const isHighlighted = highlightMandatory && (input === null || input === void 0 || (_input$meta = input.meta) === null || _input$meta === void 0 ? void 0 : _input$meta.mandatory) && inputIsEmpty(input, inputValues, inputMeta);
31011
- const btnOnClick = () => {
31012
- if (typeof inputData.commentValue === 'string') {
31013
- onValuesChange({}, _objectSpread2(_objectSpread2({}, values), {}, {
31014
- ["".concat(inputData.inputName)]: null
31015
- }));
31016
- }
31024
+ const inputValues = Array.isArray(values[formId]) ? values[formId] || {} : values[formId] || {};
31025
+ inputValues[`${inputData.inputName}Comment`] = typeof inputData.commentValue !== 'string' ? '' : null;
31026
+ if (Array.isArray(values[formId])) {
31027
+ values[formId] = inputValues;
31028
+ } else {
31029
+ values[formId] = inputValues;
31030
+ }
31031
+ setValues({
31032
+ ...values
31033
+ });
31034
+ };
31035
+ const btnOnClick2 = () => {
31036
+ if (typeof inputData.commentValue !== 'string') {
31017
31037
  const inputValues = Array.isArray(values[formId]) ? values[formId] || {} : values[formId] || {};
31018
- inputValues["".concat(inputData.inputName, "Comment")] = typeof inputData.commentValue !== 'string' ? '' : null;
31038
+ inputValues[`${inputData.inputName}Comment`] = typeof inputData.commentValue !== 'string' ? '' : null;
31019
31039
  if (Array.isArray(values[formId])) {
31020
31040
  values[formId] = inputValues;
31021
31041
  } else {
31022
31042
  values[formId] = inputValues;
31023
31043
  }
31024
- setValues(_objectSpread2({}, values));
31025
- };
31026
- const btnOnClick2 = () => {
31027
- if (typeof inputData.commentValue !== 'string') {
31028
- const inputValues = Array.isArray(values[formId]) ? values[formId] || {} : values[formId] || {};
31029
- inputValues["".concat(inputData.inputName, "Comment")] = typeof inputData.commentValue !== 'string' ? '' : null;
31030
- if (Array.isArray(values[formId])) {
31031
- values[formId] = inputValues;
31032
- } else {
31033
- values[formId] = inputValues;
31034
- }
31035
- setValues(_objectSpread2({}, values));
31036
- }
31037
- };
31038
- const rules = inputData !== null && inputData !== void 0 && (_inputData$rules = inputData.rules) !== null && _inputData$rules !== void 0 && _inputData$rules.length ? inputData.rules.filter(rule => !Object.keys(rule || {}).includes('accept') && !Object.keys(rule || {}).includes('max')) : ((input === null || input === void 0 || (_input$meta2 = input.meta) === null || _input$meta2 === void 0 ? void 0 : _input$meta2.rules) || []).filter(rule => {
31039
- if (rule.metaIf && typeof rule.metaIf === 'string') {
31040
- var _values$meta3, _values$meta4;
31041
- const [name, cond, value] = rule.metaIf.split(' ');
31042
- const val = name.includes('./') ? values === null || values === void 0 || (_values$meta3 = values.meta) === null || _values$meta3 === void 0 || (_values$meta3 = _values$meta3.inputs) === null || _values$meta3 === void 0 || (_values$meta3 = _values$meta3[formId]) === null || _values$meta3 === void 0 ? void 0 : _values$meta3[name.split('./')[1]] : values === null || values === void 0 || (_values$meta4 = values.meta) === null || _values$meta4 === void 0 || (_values$meta4 = _values$meta4.inputs) === null || _values$meta4 === void 0 ? void 0 : _values$meta4[name.split('./')[1]];
31043
- if (cond === 'is') {
31044
- return !!(val !== null && val !== void 0 && val[value]);
31045
- }
31046
- }
31047
- return !Object.keys(rule || {}).includes('accept') && !Object.keys(rule || {}).includes('max');
31048
- });
31049
- const requiredRule = rules.find(r => r.required);
31050
- if (requiredRule && input.type === 'text') {
31051
- rules.push({
31052
- whitespace: true,
31053
- message: requiredRule.message || ''
31044
+ setValues({
31045
+ ...values
31054
31046
  });
31055
31047
  }
31056
- return showHideInput$1(input, values, undefined, inputValues, setValues) ? /*#__PURE__*/jsxRuntime.jsx(React__default["default"].Fragment, {
31057
- children: /*#__PURE__*/jsxRuntime.jsxs("div", {
31058
- style: {
31059
- position: 'relative'
31060
- },
31061
- children: [getSubtitles$1(subtitles, input.position, values, undefined, inputValues), ['h2', 'h3', 'h4', 'h5', 'h6'].includes(input.type) ? getInputHeadLines$1(input.type, i, input, values) : isRisk ? /*#__PURE__*/jsxRuntime.jsx(RiskGroup, {
31062
- input: input,
31063
- inputTypeComponent: inputTypeComponent$1,
31064
- inputData: inputData,
31065
- MainForm: MainForm,
31066
- options: options,
31067
- setValues: setValues,
31068
- formId: formId,
31069
- inputId: inputId,
31070
- inputOnBlur: inputOnBlur,
31071
- values: values,
31072
- getInputLabel: getInputLabel$1,
31073
- plainForms: plainForms,
31074
- setAddress: setAddress,
31075
- btnOnClick: btnOnClick,
31076
- btnOnClick2: btnOnClick2,
31077
- locationName: (allData || {}).locationName,
31078
- subGroupTitle: (allData || {}).subGroupTitle
31079
- }) : /*#__PURE__*/jsxRuntime.jsx(GroupContentFormItem, {
31080
- values,
31081
- formId,
31082
- setValues,
31083
- MainForm,
31084
- options,
31085
- plainForms,
31086
- setAddress,
31087
- inputData,
31088
- inputId,
31089
- input,
31090
- rules,
31091
- inputMeta,
31092
- changeInputMeta,
31093
- notPartOfTheForm,
31094
- isAjaxSubGroup,
31095
- isHighlighted
31096
- })]
31097
- }, ii)
31098
- }, "".concat(i).concat(ii)) : null;
31099
- })]
31100
- });
31101
- };
31102
- const isNa = (formValues === null || formValues === void 0 ? void 0 : formValues.valuation) === 'na';
31048
+ };
31049
+ const rules = inputData?.rules?.length ? inputData.rules.filter(rule => !Object.keys(rule || {}).includes('accept') && !Object.keys(rule || {}).includes('max')) : (input?.meta?.rules || []).filter(rule => {
31050
+ if (rule.metaIf && typeof rule.metaIf === 'string') {
31051
+ const [name, cond, value] = rule.metaIf.split(' ');
31052
+ const val = name.includes('./') ? values?.meta?.inputs?.[formId]?.[name.split('./')[1]] : values?.meta?.inputs?.[name.split('./')[1]];
31053
+ if (cond === 'is') {
31054
+ return !!val?.[value];
31055
+ }
31056
+ }
31057
+ return !Object.keys(rule || {}).includes('accept') && !Object.keys(rule || {}).includes('max');
31058
+ });
31059
+ const requiredRule = rules.find(r => r.required);
31060
+ if (requiredRule && input.type === 'text') {
31061
+ rules.push({
31062
+ whitespace: true,
31063
+ message: requiredRule.message || ''
31064
+ });
31065
+ }
31066
+ return showHideInput$1(input, values, undefined, inputValues, setValues) ? /*#__PURE__*/jsxRuntime.jsx(React__default["default"].Fragment, {
31067
+ children: /*#__PURE__*/jsxRuntime.jsxs("div", {
31068
+ style: {
31069
+ position: 'relative'
31070
+ },
31071
+ children: [getSubtitles$1(subtitles, input.position, values, undefined, inputValues), ['h2', 'h3', 'h4', 'h5', 'h6'].includes(input.type) ? getInputHeadLines$1(input.type, i, input, values) : isRisk ? /*#__PURE__*/jsxRuntime.jsx(RiskGroup, {
31072
+ input: input,
31073
+ inputTypeComponent: inputTypeComponent$1,
31074
+ inputData: inputData,
31075
+ MainForm: MainForm,
31076
+ options: options,
31077
+ setValues: setValues,
31078
+ formId: formId,
31079
+ inputId: inputId,
31080
+ inputOnBlur: inputOnBlur,
31081
+ values: values,
31082
+ getInputLabel: getInputLabel$1,
31083
+ plainForms: plainForms,
31084
+ setAddress: setAddress,
31085
+ btnOnClick: btnOnClick,
31086
+ btnOnClick2: btnOnClick2,
31087
+ locationName: (allData || {}).locationName,
31088
+ subGroupTitle: (allData || {}).subGroupTitle
31089
+ }) : /*#__PURE__*/jsxRuntime.jsx(GroupContentFormItem, {
31090
+ values,
31091
+ formId,
31092
+ setValues,
31093
+ MainForm,
31094
+ options,
31095
+ plainForms,
31096
+ setAddress,
31097
+ inputData,
31098
+ inputId,
31099
+ input,
31100
+ rules,
31101
+ inputMeta,
31102
+ changeInputMeta,
31103
+ notPartOfTheForm,
31104
+ isAjaxSubGroup,
31105
+ isHighlighted
31106
+ })]
31107
+ }, ii)
31108
+ }, `${i}${ii}`) : null;
31109
+ })]
31110
+ });
31111
+ const isNa = formValues?.valuation === 'na';
31103
31112
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
31104
31113
  children: [hasLabel ? options.isRisk && options.dontShowTitle ? /*#__PURE__*/jsxRuntime.jsx("div", {
31105
31114
  className: "risk-header",
@@ -31107,46 +31116,44 @@ const GroupContent = _ref2 => {
31107
31116
  children: label
31108
31117
  })
31109
31118
  }) : /*#__PURE__*/jsxRuntime.jsx("h3", {
31110
- className: "".concat(form.titleClass ? form.titleClass : 'title-semibold-4', " ").concat(i ? 'mt-3 mb-1' : ''),
31119
+ className: `${form.titleClass ? form.titleClass : 'title-semibold-4'} ${i ? 'mt-3 mb-1' : ''}`,
31111
31120
  children: label
31112
31121
  }) : null, /*#__PURE__*/jsxRuntime.jsxs("div", {
31113
- className: "repeatable ".concat(hasLabel ? "mb-4" : ""),
31122
+ className: `repeatable ${hasLabel ? "mb-4" : ""}`,
31114
31123
  children: [form.titleLabel ? /*#__PURE__*/jsxRuntime.jsx("label", {
31115
31124
  children: getInputProp(form.titleLabel, values)
31116
- }) : null, formValues !== null && formValues !== void 0 && formValues.noPlanningRequired ? /*#__PURE__*/jsxRuntime.jsx(GroupInfoHOC, {
31125
+ }) : null, formValues?.noPlanningRequired ? /*#__PURE__*/jsxRuntime.jsx(GroupInfoHOC, {
31117
31126
  t: t,
31118
31127
  isNa: isNa,
31119
31128
  isSuccess: !isNa
31120
31129
  // TODO: translate
31121
31130
  ,
31122
31131
  config: {
31123
- title: t("No ".concat((formValues === null || formValues === void 0 ? void 0 : formValues.stage) || 'planning', " required"))
31132
+ title: t(`No ${formValues?.stage || 'planning'} required`)
31124
31133
  },
31125
31134
  children: renderInputs()
31126
31135
  }) : renderInputs()]
31127
31136
  })]
31128
31137
  });
31129
31138
  };
31130
- const GroupContentFormItem = _ref4 => {
31131
- var _rules$find, _inputMeta$reviews, _input$meta3, _values$formId, _input$meta4, _input$meta7, _input$meta8, _input$meta9, _values$meta10, _values$meta11, _values$parent, _input$meta10, _input$meta11, _inputData$value, _input$meta12, _input$meta13, _inputMeta$comment, _lastReview$comment, _lastReview$reviewer, _lastReview$reviewer2;
31132
- let {
31133
- values,
31134
- formId,
31135
- setValues,
31136
- MainForm,
31137
- options,
31138
- plainForms,
31139
- setAddress,
31140
- inputData,
31141
- inputId,
31142
- input,
31143
- rules,
31144
- inputMeta,
31145
- changeInputMeta,
31146
- notPartOfTheForm = true,
31147
- isAjaxSubGroup,
31148
- isHighlighted
31149
- } = _ref4;
31139
+ const GroupContentFormItem = ({
31140
+ values,
31141
+ formId,
31142
+ setValues,
31143
+ MainForm,
31144
+ options,
31145
+ plainForms,
31146
+ setAddress,
31147
+ inputData,
31148
+ inputId,
31149
+ input,
31150
+ rules,
31151
+ inputMeta,
31152
+ changeInputMeta,
31153
+ notPartOfTheForm = true,
31154
+ isAjaxSubGroup,
31155
+ isHighlighted
31156
+ }) => {
31150
31157
  const {
31151
31158
  t,
31152
31159
  user,
@@ -31160,10 +31167,10 @@ const GroupContentFormItem = _ref4 => {
31160
31167
  staticWidth,
31161
31168
  fullWidth
31162
31169
  } = useEditContext();
31163
- const [isShown, setIsShown] = React.useState(!!(inputMeta !== null && inputMeta !== void 0 && inputMeta.comment));
31164
- let maxRule = (_rules$find = rules.find(rule => rule.max)) === null || _rules$find === void 0 ? void 0 : _rules$find.max;
31170
+ const [isShown, setIsShown] = React.useState(!!inputMeta?.comment);
31171
+ let maxRule = rules.find(rule => rule.max)?.max;
31165
31172
  const requiredRule = rules.find(r => r.required);
31166
- const lastReview = ((inputMeta === null || inputMeta === void 0 ? void 0 : inputMeta.reviews) || [])[((inputMeta === null || inputMeta === void 0 || (_inputMeta$reviews = inputMeta.reviews) === null || _inputMeta$reviews === void 0 ? void 0 : _inputMeta$reviews.length) || 0) - 1];
31173
+ const lastReview = (inputMeta?.reviews || [])[(inputMeta?.reviews?.length || 0) - 1];
31167
31174
  if (!maxRule && input.type === 'textarea') {
31168
31175
  maxRule = MAX_TEXT_AREA_LENGTH;
31169
31176
  }
@@ -31182,35 +31189,38 @@ const GroupContentFormItem = _ref4 => {
31182
31189
  }
31183
31190
  setIsShown(true);
31184
31191
  if (notPartOfTheForm || isAjaxSubGroup) {
31185
- var _values$meta5;
31186
- const _defaultMeta = ((values === null || values === void 0 || (_values$meta5 = values.meta) === null || _values$meta5 === void 0 ? void 0 : _values$meta5.inputs) || {})[formId] || {};
31192
+ const _defaultMeta = (values?.meta?.inputs || {})[formId] || {};
31187
31193
  const _defaultData = MainForm.getFieldValue(formId);
31188
31194
  if (isAjaxSubGroup) {
31189
- var _defaultData$meta, _defaultData$meta2;
31190
31195
  changeInputMeta({
31191
31196
  key: formId,
31192
31197
  type: input.type,
31193
31198
  otherValues: {
31194
- [formId]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
31199
+ [formId]: {
31200
+ ..._defaultData,
31195
31201
  meta: {
31196
- inputs: _objectSpread2(_objectSpread2({}, (_defaultData === null || _defaultData === void 0 || (_defaultData$meta = _defaultData.meta) === null || _defaultData$meta === void 0 ? void 0 : _defaultData$meta.inputs) || {}), {}, {
31197
- [inputId]: _objectSpread2(_objectSpread2({}, ((_defaultData === null || _defaultData === void 0 || (_defaultData$meta2 = _defaultData.meta) === null || _defaultData$meta2 === void 0 ? void 0 : _defaultData$meta2.inputs) || {})[inputId] || {}), {}, {
31202
+ inputs: {
31203
+ ...(_defaultData?.meta?.inputs || {}),
31204
+ [inputId]: {
31205
+ ...((_defaultData?.meta?.inputs || {})[inputId] || {}),
31198
31206
  comment: ''
31199
- })
31200
- })
31207
+ }
31208
+ }
31201
31209
  }
31202
- })
31210
+ }
31203
31211
  }
31204
31212
  });
31205
31213
  } else {
31206
31214
  changeInputMeta({
31207
31215
  key: formId,
31208
31216
  type: input.type,
31209
- value: _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31210
- [inputId]: _objectSpread2(_objectSpread2({}, _defaultMeta[inputId] || {}), {}, {
31217
+ value: {
31218
+ ..._defaultMeta,
31219
+ [inputId]: {
31220
+ ...(_defaultMeta[inputId] || {}),
31211
31221
  comment: ''
31212
- })
31213
- })
31222
+ }
31223
+ }
31214
31224
  });
31215
31225
  }
31216
31226
  } else {
@@ -31227,58 +31237,62 @@ const GroupContentFormItem = _ref4 => {
31227
31237
  if (!isReview) {
31228
31238
  return;
31229
31239
  }
31230
- const reviewSuccess = lastReview === null || lastReview === void 0 ? void 0 : lastReview.reviewSuccess;
31240
+ const reviewSuccess = lastReview?.reviewSuccess;
31231
31241
  if (notPartOfTheForm || isAjaxSubGroup) {
31232
- var _values$meta6;
31233
- const _defaultMeta = ((values === null || values === void 0 || (_values$meta6 = values.meta) === null || _values$meta6 === void 0 ? void 0 : _values$meta6.inputs) || {})[formId] || {};
31242
+ const _defaultMeta = (values?.meta?.inputs || {})[formId] || {};
31234
31243
  const _defaultData = MainForm.getFieldValue(formId);
31235
31244
  if (isAjaxSubGroup) {
31236
- var _defaultData$meta3, _defaultData$meta4, _defaultData$meta5, _defaultData$meta6;
31237
31245
  changeInputMeta({
31238
31246
  key: formId,
31239
31247
  type: input.type,
31240
31248
  otherValues: {
31241
- [formId]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
31249
+ [formId]: {
31250
+ ..._defaultData,
31242
31251
  meta: {
31243
- inputs: _objectSpread2(_objectSpread2({}, (_defaultData === null || _defaultData === void 0 || (_defaultData$meta3 = _defaultData.meta) === null || _defaultData$meta3 === void 0 ? void 0 : _defaultData$meta3.inputs) || {}), {}, {
31244
- [inputId]: _objectSpread2(_objectSpread2({}, ((_defaultData === null || _defaultData === void 0 || (_defaultData$meta4 = _defaultData.meta) === null || _defaultData$meta4 === void 0 ? void 0 : _defaultData$meta4.inputs) || {})[inputId] || {}), {}, {
31245
- reviews: reviewSuccess ? ((((_defaultData === null || _defaultData === void 0 || (_defaultData$meta5 = _defaultData.meta) === null || _defaultData$meta5 === void 0 ? void 0 : _defaultData$meta5.inputs) || {})[inputId] || {}).reviews || []).filter(v => v.createdAt !== lastReview.createdAt) : [...((((_defaultData === null || _defaultData === void 0 || (_defaultData$meta6 = _defaultData.meta) === null || _defaultData$meta6 === void 0 ? void 0 : _defaultData$meta6.inputs) || {})[inputId] || {}).reviews || []), {
31252
+ inputs: {
31253
+ ...(_defaultData?.meta?.inputs || {}),
31254
+ [inputId]: {
31255
+ ...((_defaultData?.meta?.inputs || {})[inputId] || {}),
31256
+ reviews: reviewSuccess ? (((_defaultData?.meta?.inputs || {})[inputId] || {}).reviews || []).filter(v => v.createdAt !== lastReview.createdAt) : [...(((_defaultData?.meta?.inputs || {})[inputId] || {}).reviews || []), {
31246
31257
  reviewer: user,
31247
31258
  createdAt: new Date().toISOString(),
31248
31259
  reviewSuccess: true
31249
31260
  }]
31250
- })
31251
- })
31261
+ }
31262
+ }
31252
31263
  }
31253
- })
31264
+ }
31254
31265
  }
31255
31266
  });
31256
31267
  } else {
31257
31268
  changeInputMeta({
31258
31269
  key: formId,
31259
31270
  type: input.type,
31260
- value: _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31261
- [inputId]: _objectSpread2(_objectSpread2({}, _defaultMeta[inputId] || {}), {}, {
31271
+ value: {
31272
+ ..._defaultMeta,
31273
+ [inputId]: {
31274
+ ...(_defaultMeta[inputId] || {}),
31262
31275
  reviews: reviewSuccess ? ((_defaultMeta[inputId] || {}).reviews || []).filter(v => v.createdAt !== lastReview.createdAt) : [...((_defaultMeta[inputId] || {}).reviews || []), {
31263
31276
  reviewer: user,
31264
31277
  createdAt: new Date().toISOString(),
31265
31278
  reviewSuccess: true
31266
31279
  }]
31267
- })
31268
- })
31280
+ }
31281
+ }
31269
31282
  });
31270
31283
  }
31271
31284
  } else {
31272
31285
  changeInputMeta({
31273
31286
  key: inputId,
31274
31287
  type: input.type,
31275
- value: _objectSpread2(_objectSpread2({}, inputMeta), {}, {
31288
+ value: {
31289
+ ...inputMeta,
31276
31290
  reviews: reviewSuccess ? (inputMeta.reviews || []).filter(v => v.createdAt !== lastReview.createdAt) : [...(inputMeta.reviews || []), {
31277
31291
  reviewer: user,
31278
31292
  createdAt: new Date().toISOString(),
31279
31293
  reviewSuccess: true
31280
31294
  }]
31281
- })
31295
+ }
31282
31296
  });
31283
31297
  }
31284
31298
  };
@@ -31286,111 +31300,118 @@ const GroupContentFormItem = _ref4 => {
31286
31300
  if (!isReview) {
31287
31301
  return;
31288
31302
  }
31289
- const reviewError = lastReview === null || lastReview === void 0 ? void 0 : lastReview.reviewError;
31303
+ const reviewError = lastReview?.reviewError;
31290
31304
  if (notPartOfTheForm || isAjaxSubGroup) {
31291
- var _values$meta7;
31292
- const _defaultMeta = ((values === null || values === void 0 || (_values$meta7 = values.meta) === null || _values$meta7 === void 0 ? void 0 : _values$meta7.inputs) || {})[formId] || {};
31305
+ const _defaultMeta = (values?.meta?.inputs || {})[formId] || {};
31293
31306
  const _defaultData = MainForm.getFieldValue(formId);
31294
31307
  if (isAjaxSubGroup) {
31295
- var _defaultData$meta7, _defaultData$meta8, _defaultData$meta9, _defaultData$meta10;
31296
31308
  changeInputMeta({
31297
31309
  key: formId,
31298
31310
  type: input.type,
31299
31311
  otherValues: {
31300
- [formId]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
31312
+ [formId]: {
31313
+ ..._defaultData,
31301
31314
  meta: {
31302
- inputs: _objectSpread2(_objectSpread2({}, (_defaultData === null || _defaultData === void 0 || (_defaultData$meta7 = _defaultData.meta) === null || _defaultData$meta7 === void 0 ? void 0 : _defaultData$meta7.inputs) || {}), {}, {
31303
- [inputId]: _objectSpread2(_objectSpread2({}, ((_defaultData === null || _defaultData === void 0 || (_defaultData$meta8 = _defaultData.meta) === null || _defaultData$meta8 === void 0 ? void 0 : _defaultData$meta8.inputs) || {})[inputId] || {}), {}, {
31304
- reviews: reviewError ? ((((_defaultData === null || _defaultData === void 0 || (_defaultData$meta9 = _defaultData.meta) === null || _defaultData$meta9 === void 0 ? void 0 : _defaultData$meta9.inputs) || {})[inputId] || {}).reviews || []).filter(v => v.createdAt !== lastReview.createdAt) : [...((((_defaultData === null || _defaultData === void 0 || (_defaultData$meta10 = _defaultData.meta) === null || _defaultData$meta10 === void 0 ? void 0 : _defaultData$meta10.inputs) || {})[inputId] || {}).reviews || []), {
31315
+ inputs: {
31316
+ ...(_defaultData?.meta?.inputs || {}),
31317
+ [inputId]: {
31318
+ ...((_defaultData?.meta?.inputs || {})[inputId] || {}),
31319
+ reviews: reviewError ? (((_defaultData?.meta?.inputs || {})[inputId] || {}).reviews || []).filter(v => v.createdAt !== lastReview.createdAt) : [...(((_defaultData?.meta?.inputs || {})[inputId] || {}).reviews || []), {
31305
31320
  reviewer: user,
31306
31321
  createdAt: new Date().toISOString(),
31307
31322
  reviewError: true,
31308
31323
  comment: ''
31309
31324
  }]
31310
- })
31311
- })
31325
+ }
31326
+ }
31312
31327
  }
31313
- })
31328
+ }
31314
31329
  }
31315
31330
  });
31316
31331
  } else {
31317
31332
  changeInputMeta({
31318
31333
  key: formId,
31319
31334
  type: input.type,
31320
- value: _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31321
- [inputId]: _objectSpread2(_objectSpread2({}, _defaultMeta[inputId] || {}), {}, {
31335
+ value: {
31336
+ ..._defaultMeta,
31337
+ [inputId]: {
31338
+ ...(_defaultMeta[inputId] || {}),
31322
31339
  reviews: reviewError ? ((_defaultMeta[inputId] || {}).reviews || []).filter(v => v.createdAt !== lastReview.createdAt) : [...((_defaultMeta[inputId] || {}).reviews || []), {
31323
31340
  reviewer: user,
31324
31341
  createdAt: new Date().toISOString(),
31325
31342
  reviewError: true,
31326
31343
  comment: ''
31327
31344
  }]
31328
- })
31329
- })
31345
+ }
31346
+ }
31330
31347
  });
31331
31348
  }
31332
31349
  } else {
31333
31350
  changeInputMeta({
31334
31351
  key: inputId,
31335
31352
  type: input.type,
31336
- value: _objectSpread2(_objectSpread2({}, inputMeta), {}, {
31353
+ value: {
31354
+ ...inputMeta,
31337
31355
  reviews: reviewError ? (inputMeta.reviews || []).filter(v => v.createdAt !== lastReview.createdAt) : [...(inputMeta.reviews || []), {
31338
31356
  reviewer: user,
31339
31357
  createdAt: new Date().toISOString(),
31340
31358
  reviewError: true,
31341
31359
  comment: ''
31342
31360
  }]
31343
- })
31361
+ }
31344
31362
  });
31345
31363
  }
31346
31364
  };
31347
- const requiredComment = (inputMeta === null || inputMeta === void 0 ? void 0 : inputMeta.notApplicable) && (input === null || input === void 0 || (_input$meta3 = input.meta) === null || _input$meta3 === void 0 ? void 0 : _input$meta3.requiredCommentOnNotApplicable) && (values === null || values === void 0 || (_values$formId = values[formId]) === null || _values$formId === void 0 ? void 0 : _values$formId.valuation) !== 'na';
31365
+ const requiredComment = inputMeta?.notApplicable && input?.meta?.requiredCommentOnNotApplicable && values?.[formId]?.valuation !== 'na';
31348
31366
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
31349
31367
  children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
31350
31368
  className: "flex input-cont",
31351
- children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, _objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2(_objectSpread2({
31352
- required: inputData.rules && inputData.rules instanceof Array && inputData.rules.filter(r => r.required).length > 0 ? true : false
31353
- }, ['total100', 'group'].includes(input.type) ? {} : {
31354
- name: notPartOfTheForm ? [formId, inputId] : inputId,
31355
- fieldKey: notPartOfTheForm ? [formId, inputId] : inputId,
31356
- initialValue: notPartOfTheForm ? (values[formId] || {})[inputId] : values[inputId]
31357
- }), ['upload', 'imageUpload', 'videoUpload'].includes(input.type) ? {
31358
- valuePropName: "fileList",
31359
- getValueFromEvent: e => {
31360
- if (Array.isArray(e)) {
31361
- return e;
31362
- }
31363
- return e && e.fileList && e.fileList.map(f => {
31364
- if (f.response) {
31365
- return f.response;
31369
+ children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
31370
+ required: inputData.rules && inputData.rules instanceof Array && inputData.rules.filter(r => r.required).length > 0 ? true : false,
31371
+ ...(['total100', 'group'].includes(input.type) ? {} : {
31372
+ name: notPartOfTheForm ? [formId, inputId] : inputId,
31373
+ fieldKey: notPartOfTheForm ? [formId, inputId] : inputId,
31374
+ initialValue: notPartOfTheForm ? (values[formId] || {})[inputId] : values[inputId]
31375
+ }),
31376
+ ...(['upload', 'imageUpload', 'videoUpload'].includes(input.type) ? {
31377
+ valuePropName: "fileList",
31378
+ getValueFromEvent: e => {
31379
+ if (Array.isArray(e)) {
31380
+ return e;
31366
31381
  }
31367
- return f;
31368
- });
31369
- }
31370
- } : {}), inputOnBlur.includes(input.type) ? {
31371
- trigger: "onBlur"
31372
- } : {}), {}, {
31382
+ return e && e.fileList && e.fileList.map(f => {
31383
+ if (f.response) {
31384
+ return f.response;
31385
+ }
31386
+ return f;
31387
+ });
31388
+ }
31389
+ } : {}),
31390
+ ...(inputOnBlur.includes(input.type) ? {
31391
+ trigger: "onBlur"
31392
+ } : {}),
31373
31393
  style: input.showOnView === false ? {
31374
31394
  display: 'none'
31375
- } : {}
31376
- }, ['switch'].includes(input.type) ? {
31377
- labelCol: {
31378
- span: 20
31379
- },
31380
- style: _objectSpread2(_objectSpread2({}, input.showOnView === false ? {
31381
- display: 'none'
31382
- } : {}), {}, {
31383
- flexDirection: 'row',
31384
- justifyContent: 'space-between'
31385
- })
31386
- } : {}), {}, {
31395
+ } : {},
31396
+ ...(['switch'].includes(input.type) ? {
31397
+ labelCol: {
31398
+ span: 20
31399
+ },
31400
+ style: {
31401
+ ...(input.showOnView === false ? {
31402
+ display: 'none'
31403
+ } : {}),
31404
+ flexDirection: 'row',
31405
+ justifyContent: 'space-between'
31406
+ }
31407
+ } : {}),
31387
31408
  label: !noActionsInputs.includes(input.type) ? /*#__PURE__*/jsxRuntime.jsx("div", {
31388
- className: (input === null || input === void 0 || (_input$meta4 = input.meta) === null || _input$meta4 === void 0 ? void 0 : _input$meta4.code) && "mr-10",
31409
+ className: input?.meta?.code && "mr-10",
31389
31410
  children: getInputLabel$1(input, values)
31390
31411
  }) : null,
31391
31412
  rules: rules,
31392
- className: formatClassname([input.comment ? "flex-1 with-comment i-".concat(input.type) : "i-".concat(input.type, " flex-1 "), noActionsInputs.includes(input.type) && 'no-actions-input']),
31393
- "data-id": "".concat(formId, ".").concat(inputId),
31413
+ className: formatClassname([input.comment ? `flex-1 with-comment i-${input.type}` : `i-${input.type} flex-1 `, noActionsInputs.includes(input.type) && 'no-actions-input']),
31414
+ "data-id": `${formId}.${inputId}`,
31394
31415
  extra: /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
31395
31416
  children: !noActionsInputs.includes(input.type) ? /*#__PURE__*/jsxRuntime.jsxs("div", {
31396
31417
  className: formatClassname(["ml-4 input-actions"]),
@@ -31400,7 +31421,7 @@ const GroupContentFormItem = _ref4 => {
31400
31421
  title: t('Add review note'),
31401
31422
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
31402
31423
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
31403
- className: formatClassname(["review-btn review-error-btn", (lastReview === null || lastReview === void 0 ? void 0 : lastReview.reviewError) && 'primary']),
31424
+ className: formatClassname(["review-btn review-error-btn", lastReview?.reviewError && 'primary']),
31404
31425
  type: "link",
31405
31426
  onClick: onClickReviewError,
31406
31427
  children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
@@ -31416,7 +31437,7 @@ const GroupContentFormItem = _ref4 => {
31416
31437
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
31417
31438
  type: "link",
31418
31439
  onClick: onClickReviewSuccess,
31419
- className: formatClassname(["review-btn review-success-btn", (lastReview === null || lastReview === void 0 ? void 0 : lastReview.reviewSuccess) && 'primary']),
31440
+ className: formatClassname(["review-btn review-success-btn", lastReview?.reviewSuccess && 'primary']),
31420
31441
  children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
31421
31442
  name: "CheckSquare",
31422
31443
  width: 16,
@@ -31433,59 +31454,65 @@ const GroupContentFormItem = _ref4 => {
31433
31454
  className: formatClassname(["default p-0", inputMeta.notApplicable && 'primary']),
31434
31455
  type: "link",
31435
31456
  onClick: () => {
31436
- var _input$meta5, _input$meta6;
31437
31457
  const value = getDefaultInputValue(input);
31438
- const commentMeta = input !== null && input !== void 0 && (_input$meta5 = input.meta) !== null && _input$meta5 !== void 0 && _input$meta5.requiredCommentOnNotApplicable ? {
31458
+ const commentMeta = input?.meta?.requiredCommentOnNotApplicable ? {
31439
31459
  comment: ''
31440
31460
  } : {};
31441
- if (input !== null && input !== void 0 && (_input$meta6 = input.meta) !== null && _input$meta6 !== void 0 && _input$meta6.requiredCommentOnNotApplicable) {
31461
+ if (input?.meta?.requiredCommentOnNotApplicable) {
31442
31462
  setIsShown(true);
31443
31463
  }
31444
31464
  if (notPartOfTheForm || isAjaxSubGroup) {
31445
- var _values$meta8;
31446
31465
  const _defaultData = MainForm.getFieldValue(formId);
31447
- const _defaultMeta = ((values === null || values === void 0 || (_values$meta8 = values.meta) === null || _values$meta8 === void 0 ? void 0 : _values$meta8.inputs) || {})[formId] || {};
31466
+ const _defaultMeta = (values?.meta?.inputs || {})[formId] || {};
31448
31467
  if (isAjaxSubGroup) {
31449
- var _defaultData$meta11;
31450
31468
  changeInputMeta({
31451
31469
  key: formId,
31452
31470
  type: input.type,
31453
31471
  otherValues: {
31454
- [formId]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
31472
+ [formId]: {
31473
+ ..._defaultData,
31455
31474
  [inputId]: value,
31456
31475
  meta: {
31457
- inputs: _objectSpread2(_objectSpread2({}, (_defaultData === null || _defaultData === void 0 || (_defaultData$meta11 = _defaultData.meta) === null || _defaultData$meta11 === void 0 ? void 0 : _defaultData$meta11.inputs) || {}), {}, {
31458
- [inputId]: inputMeta.notApplicable ? _objectSpread2({
31476
+ inputs: {
31477
+ ...(_defaultData?.meta?.inputs || {}),
31478
+ [inputId]: inputMeta.notApplicable ? {
31459
31479
  notApplicable: false,
31460
- notAvailable: false
31461
- }, commentMeta) : _objectSpread2({
31480
+ notAvailable: false,
31481
+ ...commentMeta
31482
+ } : {
31462
31483
  notApplicable: true,
31463
- notAvailable: false
31464
- }, commentMeta)
31465
- })
31484
+ notAvailable: false,
31485
+ ...commentMeta
31486
+ }
31487
+ }
31466
31488
  }
31467
- })
31489
+ }
31468
31490
  }
31469
31491
  });
31470
31492
  } else {
31471
31493
  changeInputMeta({
31472
31494
  key: formId,
31473
31495
  type: input.type,
31474
- value: inputMeta.notApplicable ? _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31475
- [inputId]: _objectSpread2({
31496
+ value: inputMeta.notApplicable ? {
31497
+ ..._defaultMeta,
31498
+ [inputId]: {
31476
31499
  notApplicable: false,
31477
- notAvailable: false
31478
- }, commentMeta)
31479
- }) : _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31480
- [inputId]: _objectSpread2({
31500
+ notAvailable: false,
31501
+ ...commentMeta
31502
+ }
31503
+ } : {
31504
+ ..._defaultMeta,
31505
+ [inputId]: {
31481
31506
  notApplicable: true,
31482
- notAvailable: false
31483
- }, commentMeta)
31484
- }),
31507
+ notAvailable: false,
31508
+ ...commentMeta
31509
+ }
31510
+ },
31485
31511
  otherValues: {
31486
- [formId]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
31512
+ [formId]: {
31513
+ ..._defaultData,
31487
31514
  [inputId]: value
31488
- })
31515
+ }
31489
31516
  }
31490
31517
  });
31491
31518
  }
@@ -31506,7 +31533,7 @@ const GroupContentFormItem = _ref4 => {
31506
31533
  });
31507
31534
  }
31508
31535
  },
31509
- disabled: !((_input$meta7 = input.meta) !== null && _input$meta7 !== void 0 && _input$meta7.notApplicable),
31536
+ disabled: !input.meta?.notApplicable,
31510
31537
  children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
31511
31538
  name: "NotApplicable",
31512
31539
  width: 16,
@@ -31520,24 +31547,24 @@ const GroupContentFormItem = _ref4 => {
31520
31547
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
31521
31548
  className: formatClassname(["default p-0", inputMeta.notAvailable && 'primary']),
31522
31549
  type: "link",
31523
- disabled: !((_input$meta8 = input.meta) !== null && _input$meta8 !== void 0 && _input$meta8.notAvailable),
31550
+ disabled: !input.meta?.notAvailable,
31524
31551
  onClick: () => {
31525
31552
  const value = getDefaultInputValue(input);
31526
31553
  if (notPartOfTheForm || isAjaxSubGroup) {
31527
- var _values$meta9;
31528
31554
  const _defaultData = MainForm.getFieldValue(formId);
31529
- const _defaultMeta = ((values === null || values === void 0 || (_values$meta9 = values.meta) === null || _values$meta9 === void 0 ? void 0 : _values$meta9.inputs) || {})[formId] || {};
31555
+ const _defaultMeta = (values?.meta?.inputs || {})[formId] || {};
31530
31556
  if (isAjaxSubGroup) {
31531
31557
  if (isAjaxSubGroup) {
31532
- var _defaultData$meta12;
31533
31558
  changeInputMeta({
31534
31559
  key: formId,
31535
31560
  type: input.type,
31536
31561
  otherValues: {
31537
- [formId]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
31562
+ [formId]: {
31563
+ ..._defaultData,
31538
31564
  [inputId]: value,
31539
31565
  meta: {
31540
- inputs: _objectSpread2(_objectSpread2({}, (_defaultData === null || _defaultData === void 0 || (_defaultData$meta12 = _defaultData.meta) === null || _defaultData$meta12 === void 0 ? void 0 : _defaultData$meta12.inputs) || {}), {}, {
31566
+ inputs: {
31567
+ ...(_defaultData?.meta?.inputs || {}),
31541
31568
  [inputId]: inputMeta.notAvailable ? {
31542
31569
  notApplicable: false,
31543
31570
  notAvailable: false
@@ -31545,9 +31572,9 @@ const GroupContentFormItem = _ref4 => {
31545
31572
  notApplicable: false,
31546
31573
  notAvailable: true
31547
31574
  }
31548
- })
31575
+ }
31549
31576
  }
31550
- })
31577
+ }
31551
31578
  }
31552
31579
  });
31553
31580
  }
@@ -31555,21 +31582,24 @@ const GroupContentFormItem = _ref4 => {
31555
31582
  changeInputMeta({
31556
31583
  key: formId,
31557
31584
  type: input.type,
31558
- value: inputMeta.notAvailable ? _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31585
+ value: inputMeta.notAvailable ? {
31586
+ ..._defaultMeta,
31559
31587
  [inputId]: {
31560
31588
  notApplicable: false,
31561
31589
  notAvailable: false
31562
31590
  }
31563
- }) : _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31591
+ } : {
31592
+ ..._defaultMeta,
31564
31593
  [inputId]: {
31565
31594
  notApplicable: false,
31566
31595
  notAvailable: true
31567
31596
  }
31568
- }),
31597
+ },
31569
31598
  otherValues: {
31570
- [formId]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
31599
+ [formId]: {
31600
+ ..._defaultData,
31571
31601
  [inputId]: value
31572
- })
31602
+ }
31573
31603
  }
31574
31604
  });
31575
31605
  }
@@ -31600,33 +31630,38 @@ const GroupContentFormItem = _ref4 => {
31600
31630
  }), /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
31601
31631
  title: t('Add comment'),
31602
31632
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
31603
- children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, _objectSpread2(_objectSpread2({
31633
+ children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
31604
31634
  type: "link",
31605
- disabled: !((_input$meta9 = input.meta) !== null && _input$meta9 !== void 0 && _input$meta9.comment)
31606
- }, !isShown ? {
31607
- className: 'default p-0'
31608
- } : {
31609
- className: 'p-0 primary'
31610
- }), {}, {
31635
+ disabled: !input.meta?.comment,
31636
+ ...(!isShown ? {
31637
+ className: 'default p-0'
31638
+ } : {
31639
+ className: 'p-0 primary'
31640
+ }),
31611
31641
  onClick: onClickComment,
31612
31642
  children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
31613
31643
  name: "AddComment",
31614
31644
  width: 16,
31615
31645
  height: 16
31616
31646
  })
31617
- }))
31647
+ })
31618
31648
  })
31619
31649
  })]
31620
31650
  }) : null]
31621
31651
  }) : null
31622
31652
  }),
31623
31653
  children: isReview ? /*#__PURE__*/jsxRuntime.jsx(BasicInput, {
31624
- data: _objectSpread2(_objectSpread2({}, values[formId] || {}), {}, {
31625
- meta: _objectSpread2(_objectSpread2({}, (values === null || values === void 0 ? void 0 : values.meta) || {}), {}, {
31626
- inputs: _objectSpread2(_objectSpread2({}, (values === null || values === void 0 || (_values$meta10 = values.meta) === null || _values$meta10 === void 0 ? void 0 : _values$meta10.inputs) || {}), ((values === null || values === void 0 || (_values$meta11 = values.meta) === null || _values$meta11 === void 0 ? void 0 : _values$meta11.inputs) || {})[formId] || {})
31627
- })
31628
- }),
31629
- linkingData: (values === null || values === void 0 ? void 0 : values.linking) || (values === null || values === void 0 || (_values$parent = values.parent) === null || _values$parent === void 0 ? void 0 : _values$parent.linking),
31654
+ data: {
31655
+ ...(values[formId] || {}),
31656
+ meta: {
31657
+ ...(values?.meta || {}),
31658
+ inputs: {
31659
+ ...(values?.meta?.inputs || {}),
31660
+ ...((values?.meta?.inputs || {})[formId] || {})
31661
+ }
31662
+ }
31663
+ },
31664
+ linkingData: values?.linking || values?.parent?.linking,
31630
31665
  name: input.dataId,
31631
31666
  config: input,
31632
31667
  t: t,
@@ -31638,12 +31673,13 @@ const GroupContentFormItem = _ref4 => {
31638
31673
  getToken: getToken,
31639
31674
  app: app,
31640
31675
  valueOnlyString: true
31641
- }) : inputTypeComponent$1[input.type] ? inputTypeComponent$1[input.type](_objectSpread2(_objectSpread2({}, inputData), {}, {
31676
+ }) : inputTypeComponent$1[input.type] ? inputTypeComponent$1[input.type]({
31677
+ ...inputData,
31642
31678
  name: inputId,
31643
31679
  maxWidth,
31644
31680
  staticWidth,
31645
31681
  fullWidth
31646
- }), {
31682
+ }, {
31647
31683
  form: MainForm,
31648
31684
  forms: options,
31649
31685
  allForms: plainForms,
@@ -31661,10 +31697,10 @@ const GroupContentFormItem = _ref4 => {
31661
31697
  staticWidth,
31662
31698
  fullWidth
31663
31699
  }) : console.log(input)
31664
- })), (_input$meta10 = input.meta) !== null && _input$meta10 !== void 0 && _input$meta10.code ? /*#__PURE__*/jsxRuntime.jsx("div", {
31700
+ }), input.meta?.code ? /*#__PURE__*/jsxRuntime.jsx("div", {
31665
31701
  className: "code",
31666
31702
  children: /*#__PURE__*/jsxRuntime.jsx("span", {
31667
- children: (_input$meta11 = input.meta) === null || _input$meta11 === void 0 ? void 0 : _input$meta11.code
31703
+ children: input.meta?.code
31668
31704
  })
31669
31705
  }) : null]
31670
31706
  }), maxRule ? ['imageUpload', 'videoUpload', 'upload'].includes(input.type) ? /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -31684,16 +31720,16 @@ const GroupContentFormItem = _ref4 => {
31684
31720
  className: "max-char-span",
31685
31721
  children: t('max-char', {
31686
31722
  chars: maxRule,
31687
- filled: (inputData === null || inputData === void 0 || (_inputData$value = inputData.value) === null || _inputData$value === void 0 ? void 0 : _inputData$value.length) || 0
31723
+ filled: inputData?.value?.length || 0
31688
31724
  })
31689
31725
  })
31690
- }) : null, (_input$meta12 = input.meta) !== null && _input$meta12 !== void 0 && _input$meta12.comment && isShown ? /*#__PURE__*/jsxRuntime.jsxs("div", {
31726
+ }) : null, input.meta?.comment && isShown ? /*#__PURE__*/jsxRuntime.jsxs("div", {
31691
31727
  className: "input-content",
31692
31728
  children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
31693
31729
  className: "comment-textarea",
31694
- initialValue: (inputMeta === null || inputMeta === void 0 ? void 0 : inputMeta.comment) || '',
31730
+ initialValue: inputMeta?.comment || '',
31695
31731
  hidden: !isShown,
31696
- name: "".concat(formId, "-").concat(inputId, "-comment"),
31732
+ name: `${formId}-${inputId}-comment`,
31697
31733
  required: requiredComment,
31698
31734
  rules: requiredComment ? [{
31699
31735
  required: true,
@@ -31710,35 +31746,38 @@ const GroupContentFormItem = _ref4 => {
31710
31746
  onConfirm: () => {
31711
31747
  setIsShown(false);
31712
31748
  if (notPartOfTheForm) {
31713
- var _values$meta12;
31714
- const _defaultMeta = ((values === null || values === void 0 || (_values$meta12 = values.meta) === null || _values$meta12 === void 0 ? void 0 : _values$meta12.inputs) || {})[formId] || {};
31749
+ const _defaultMeta = (values?.meta?.inputs || {})[formId] || {};
31715
31750
  const _defaultData = MainForm.getFieldValue(formId);
31716
31751
  if (isAjaxSubGroup) {
31717
- var _defaultData$meta13, _defaultData$meta14;
31718
31752
  changeInputMeta({
31719
31753
  key: formId,
31720
31754
  type: input.type,
31721
31755
  otherValues: {
31722
- [formId]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
31756
+ [formId]: {
31757
+ ..._defaultData,
31723
31758
  meta: {
31724
- inputs: _objectSpread2(_objectSpread2({}, (_defaultData === null || _defaultData === void 0 || (_defaultData$meta13 = _defaultData.meta) === null || _defaultData$meta13 === void 0 ? void 0 : _defaultData$meta13.inputs) || {}), {}, {
31725
- [inputId]: _objectSpread2(_objectSpread2({}, ((_defaultData === null || _defaultData === void 0 || (_defaultData$meta14 = _defaultData.meta) === null || _defaultData$meta14 === void 0 ? void 0 : _defaultData$meta14.inputs) || {})[inputId] || {}), {}, {
31759
+ inputs: {
31760
+ ...(_defaultData?.meta?.inputs || {}),
31761
+ [inputId]: {
31762
+ ...((_defaultData?.meta?.inputs || {})[inputId] || {}),
31726
31763
  comment: null
31727
- })
31728
- })
31764
+ }
31765
+ }
31729
31766
  }
31730
- })
31767
+ }
31731
31768
  }
31732
31769
  });
31733
31770
  } else {
31734
31771
  changeInputMeta({
31735
31772
  key: formId,
31736
31773
  type: input.type,
31737
- value: _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31738
- [inputId]: _objectSpread2(_objectSpread2({}, _defaultMeta[inputId] || {}), {}, {
31774
+ value: {
31775
+ ..._defaultMeta,
31776
+ [inputId]: {
31777
+ ...(_defaultMeta[inputId] || {}),
31739
31778
  comment: null
31740
- })
31741
- })
31779
+ }
31780
+ }
31742
31781
  });
31743
31782
  }
31744
31783
  } else {
@@ -31753,7 +31792,7 @@ const GroupContentFormItem = _ref4 => {
31753
31792
  },
31754
31793
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Button, {
31755
31794
  type: "link",
31756
- disabled: !((_input$meta13 = input.meta) !== null && _input$meta13 !== void 0 && _input$meta13.comment),
31795
+ disabled: !input.meta?.comment,
31757
31796
  className: "p-0",
31758
31797
  children: /*#__PURE__*/jsxRuntime.jsx(Icons.DeleteOutlined, {
31759
31798
  width: 16,
@@ -31765,41 +31804,44 @@ const GroupContentFormItem = _ref4 => {
31765
31804
  children: inputTypeComponent$1.comment(inputData, {
31766
31805
  form: MainForm,
31767
31806
  forms: options,
31768
- value: (inputMeta === null || inputMeta === void 0 ? void 0 : inputMeta.comment) || '',
31807
+ value: inputMeta?.comment || '',
31769
31808
  maxWidth,
31770
31809
  staticWidth,
31771
31810
  fullWidth,
31772
31811
  onChange: val => {
31773
31812
  if (notPartOfTheForm) {
31774
- var _values$meta13;
31775
- const _defaultMeta = ((values === null || values === void 0 || (_values$meta13 = values.meta) === null || _values$meta13 === void 0 ? void 0 : _values$meta13.inputs) || {})[formId] || {};
31813
+ const _defaultMeta = (values?.meta?.inputs || {})[formId] || {};
31776
31814
  const _defaultData = MainForm.getFieldValue(formId);
31777
31815
  if (isAjaxSubGroup) {
31778
- var _defaultData$meta15, _defaultData$meta16;
31779
31816
  changeInputMeta({
31780
31817
  key: formId,
31781
31818
  type: input.type,
31782
31819
  otherValues: {
31783
- [formId]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
31820
+ [formId]: {
31821
+ ..._defaultData,
31784
31822
  meta: {
31785
- inputs: _objectSpread2(_objectSpread2({}, (_defaultData === null || _defaultData === void 0 || (_defaultData$meta15 = _defaultData.meta) === null || _defaultData$meta15 === void 0 ? void 0 : _defaultData$meta15.inputs) || {}), {}, {
31786
- [inputId]: _objectSpread2(_objectSpread2({}, ((_defaultData === null || _defaultData === void 0 || (_defaultData$meta16 = _defaultData.meta) === null || _defaultData$meta16 === void 0 ? void 0 : _defaultData$meta16.inputs) || {})[inputId] || {}), {}, {
31823
+ inputs: {
31824
+ ...(_defaultData?.meta?.inputs || {}),
31825
+ [inputId]: {
31826
+ ...((_defaultData?.meta?.inputs || {})[inputId] || {}),
31787
31827
  comment: val
31788
- })
31789
- })
31828
+ }
31829
+ }
31790
31830
  }
31791
- })
31831
+ }
31792
31832
  }
31793
31833
  });
31794
31834
  } else {
31795
31835
  changeInputMeta({
31796
31836
  key: formId,
31797
31837
  type: input.type,
31798
- value: _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31799
- [inputId]: _objectSpread2(_objectSpread2({}, _defaultMeta[inputId] || {}), {}, {
31838
+ value: {
31839
+ ..._defaultMeta,
31840
+ [inputId]: {
31841
+ ...(_defaultMeta[inputId] || {}),
31800
31842
  comment: val
31801
- })
31802
- })
31843
+ }
31844
+ }
31803
31845
  });
31804
31846
  }
31805
31847
  } else {
@@ -31820,16 +31862,16 @@ const GroupContentFormItem = _ref4 => {
31820
31862
  className: "max-char-span",
31821
31863
  children: t('max-char', {
31822
31864
  chars: MAX_COMMENTS_LENGTH,
31823
- filled: (inputMeta === null || inputMeta === void 0 || (_inputMeta$comment = inputMeta.comment) === null || _inputMeta$comment === void 0 ? void 0 : _inputMeta$comment.length) || 0
31865
+ filled: inputMeta?.comment?.length || 0
31824
31866
  })
31825
31867
  })]
31826
- }) : null, lastReview !== null && lastReview !== void 0 && lastReview.reviewError ? /*#__PURE__*/jsxRuntime.jsx("div", {
31868
+ }) : null, lastReview?.reviewError ? /*#__PURE__*/jsxRuntime.jsx("div", {
31827
31869
  className: "input-content",
31828
31870
  children: isReview ? /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
31829
31871
  children: [/*#__PURE__*/jsxRuntime.jsx(antd.Form.Item, {
31830
31872
  className: "comment-textarea",
31831
- initialValue: (lastReview === null || lastReview === void 0 ? void 0 : lastReview.comment) || '',
31832
- name: "".concat(formId, "-").concat(inputId, "-reviewErrorComment"),
31873
+ initialValue: lastReview?.comment || '',
31874
+ name: `${formId}-${inputId}-reviewErrorComment`,
31833
31875
  label: /*#__PURE__*/jsxRuntime.jsx("div", {
31834
31876
  className: "flex w-100",
31835
31877
  children: /*#__PURE__*/jsxRuntime.jsx("div", {
@@ -31840,71 +31882,78 @@ const GroupContentFormItem = _ref4 => {
31840
31882
  children: inputTypeComponent$1.comment(inputData, {
31841
31883
  form: MainForm,
31842
31884
  forms: options,
31843
- value: (lastReview === null || lastReview === void 0 ? void 0 : lastReview.comment) || '',
31885
+ value: lastReview?.comment || '',
31844
31886
  maxWidth,
31845
31887
  staticWidth,
31846
31888
  fullWidth,
31847
31889
  onChange: val => {
31848
31890
  if (notPartOfTheForm) {
31849
- var _values$meta14;
31850
- const _defaultMeta = ((values === null || values === void 0 || (_values$meta14 = values.meta) === null || _values$meta14 === void 0 ? void 0 : _values$meta14.inputs) || {})[formId] || {};
31891
+ const _defaultMeta = (values?.meta?.inputs || {})[formId] || {};
31851
31892
  const _defaultData = MainForm.getFieldValue(formId);
31852
31893
  if (isAjaxSubGroup) {
31853
- var _defaultData$meta17, _defaultData$meta18, _defaultData$meta19;
31854
31894
  changeInputMeta({
31855
31895
  key: formId,
31856
31896
  type: input.type,
31857
31897
  otherValues: {
31858
- [formId]: _objectSpread2(_objectSpread2({}, _defaultData), {}, {
31898
+ [formId]: {
31899
+ ..._defaultData,
31859
31900
  meta: {
31860
- inputs: _objectSpread2(_objectSpread2({}, (_defaultData === null || _defaultData === void 0 || (_defaultData$meta17 = _defaultData.meta) === null || _defaultData$meta17 === void 0 ? void 0 : _defaultData$meta17.inputs) || {}), {}, {
31861
- [inputId]: _objectSpread2(_objectSpread2({}, ((_defaultData === null || _defaultData === void 0 || (_defaultData$meta18 = _defaultData.meta) === null || _defaultData$meta18 === void 0 ? void 0 : _defaultData$meta18.inputs) || {})[inputId] || {}), {}, {
31862
- reviews: ((((_defaultData === null || _defaultData === void 0 || (_defaultData$meta19 = _defaultData.meta) === null || _defaultData$meta19 === void 0 ? void 0 : _defaultData$meta19.inputs) || {})[inputId] || {}).reviews || []).map(v => {
31901
+ inputs: {
31902
+ ...(_defaultData?.meta?.inputs || {}),
31903
+ [inputId]: {
31904
+ ...((_defaultData?.meta?.inputs || {})[inputId] || {}),
31905
+ reviews: (((_defaultData?.meta?.inputs || {})[inputId] || {}).reviews || []).map(v => {
31863
31906
  if (v.createdAt === lastReview.createdAt) {
31864
- return _objectSpread2(_objectSpread2({}, v), {}, {
31907
+ return {
31908
+ ...v,
31865
31909
  comment: val
31866
- });
31910
+ };
31867
31911
  }
31868
31912
  return v;
31869
31913
  })
31870
- })
31871
- })
31914
+ }
31915
+ }
31872
31916
  }
31873
- })
31917
+ }
31874
31918
  }
31875
31919
  });
31876
31920
  } else {
31877
31921
  changeInputMeta({
31878
31922
  key: formId,
31879
31923
  type: input.type,
31880
- value: _objectSpread2(_objectSpread2({}, _defaultMeta), {}, {
31881
- [inputId]: _objectSpread2(_objectSpread2({}, _defaultMeta[inputId] || {}), {}, {
31924
+ value: {
31925
+ ..._defaultMeta,
31926
+ [inputId]: {
31927
+ ...(_defaultMeta[inputId] || {}),
31882
31928
  reviews: ((_defaultMeta[inputId] || {}).reviews || []).map(v => {
31883
31929
  if (v.createdAt === lastReview.createdAt) {
31884
- return _objectSpread2(_objectSpread2({}, v), {}, {
31930
+ return {
31931
+ ...v,
31885
31932
  comment: val
31886
- });
31933
+ };
31887
31934
  }
31888
31935
  return v;
31889
31936
  })
31890
- })
31891
- })
31937
+ }
31938
+ }
31892
31939
  });
31893
31940
  }
31894
31941
  } else {
31895
31942
  changeInputMeta({
31896
31943
  key: inputId,
31897
31944
  type: input.type,
31898
- value: _objectSpread2(_objectSpread2({}, inputMeta), {}, {
31899
- reviews: ((inputMeta === null || inputMeta === void 0 ? void 0 : inputMeta.reviews) || []).map(v => {
31945
+ value: {
31946
+ ...inputMeta,
31947
+ reviews: (inputMeta?.reviews || []).map(v => {
31900
31948
  if (v.createdAt === lastReview.createdAt) {
31901
- return _objectSpread2(_objectSpread2({}, v), {}, {
31949
+ return {
31950
+ ...v,
31902
31951
  comment: val
31903
- });
31952
+ };
31904
31953
  }
31905
31954
  return v;
31906
31955
  })
31907
- })
31956
+ }
31908
31957
  });
31909
31958
  }
31910
31959
  },
@@ -31916,7 +31965,7 @@ const GroupContentFormItem = _ref4 => {
31916
31965
  className: "max-char-span",
31917
31966
  children: t('max-char', {
31918
31967
  chars: MAX_COMMENTS_LENGTH,
31919
- filled: ((_lastReview$comment = lastReview.comment) === null || _lastReview$comment === void 0 ? void 0 : _lastReview$comment.length) || 0
31968
+ filled: lastReview.comment?.length || 0
31920
31969
  })
31921
31970
  })]
31922
31971
  }) : /*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -31937,7 +31986,7 @@ const GroupContentFormItem = _ref4 => {
31937
31986
  }), /*#__PURE__*/jsxRuntime.jsx("div", {
31938
31987
  className: "flex flex-column justify-center mr-1",
31939
31988
  children: /*#__PURE__*/jsxRuntime.jsx("span", {
31940
- children: (lastReview === null || lastReview === void 0 || (_lastReview$reviewer = lastReview.reviewer) === null || _lastReview$reviewer === void 0 ? void 0 : _lastReview$reviewer.firstName) + ' ' + (lastReview === null || lastReview === void 0 || (_lastReview$reviewer2 = lastReview.reviewer) === null || _lastReview$reviewer2 === void 0 ? void 0 : _lastReview$reviewer2.lastName) + ' - ' + moment__default["default"](lastReview.createdAt).format('DD MMM YYYY')
31989
+ children: lastReview?.reviewer?.firstName + ' ' + lastReview?.reviewer?.lastName + ' - ' + moment__default["default"](lastReview.createdAt).format('DD MMM YYYY')
31941
31990
  })
31942
31991
  })]
31943
31992
  })]
@@ -39681,7 +39730,7 @@ function AjaxSelect(props) {
39681
39730
  }, props));
39682
39731
  }
39683
39732
 
39684
- const _excluded$h = ["placeholder"];
39733
+ const _excluded$f = ["placeholder"];
39685
39734
  const propHasValue = val => {
39686
39735
  if (Array.isArray(val)) {
39687
39736
  return val.length > 0 ? true : false;
@@ -40436,7 +40485,7 @@ const inputTypeComponent = {
40436
40485
  },
40437
40486
  commentHint
40438
40487
  } = _ref15,
40439
- props = _objectWithoutProperties(_ref15.props, _excluded$h);
40488
+ props = _objectWithoutProperties(_ref15.props, _excluded$f);
40440
40489
  let {
40441
40490
  onChange,
40442
40491
  value
@@ -42113,7 +42162,7 @@ const useCombinedPrefilledValues = (combinedPrefilledValues, values, parentValue
42113
42162
  }, [values, parentValues, combinedPrefilledValues, setValues, MainForm]);
42114
42163
  };
42115
42164
 
42116
- const _excluded$g = ["icon"];
42165
+ const _excluded$e = ["icon"];
42117
42166
  function DynamicForm(_ref) {
42118
42167
  var _data$meta;
42119
42168
  let {
@@ -42733,7 +42782,7 @@ function DynamicForm(_ref) {
42733
42782
  let {
42734
42783
  icon: Icon
42735
42784
  } = _ref3,
42736
- form = _objectWithoutProperties(_ref3, _excluded$g);
42785
+ form = _objectWithoutProperties(_ref3, _excluded$e);
42737
42786
  return /*#__PURE__*/jsxRuntime.jsxs(antd.Button, {
42738
42787
  type: "link",
42739
42788
  size: "large",
@@ -42956,7 +43005,7 @@ const StyledSelect = styled__default["default"](antd.Select)`
42956
43005
  }
42957
43006
  `;
42958
43007
 
42959
- const _excluded$f = ["onChange", "value"];
43008
+ const _excluded$d = ["onChange", "value"];
42960
43009
  function AuthForm(_ref) {
42961
43010
  var _steps$currentStep;
42962
43011
  let {
@@ -43094,7 +43143,7 @@ function AuthForm(_ref) {
43094
43143
  {
43095
43144
  var _field$options;
43096
43145
  const _ref3 = field.props || {},
43097
- restSelectProps = _objectWithoutProperties(_ref3, _excluded$f);
43146
+ restSelectProps = _objectWithoutProperties(_ref3, _excluded$d);
43098
43147
  inputNode = /*#__PURE__*/jsxRuntime.jsx(StyledSelect, _objectSpread2(_objectSpread2({
43099
43148
  placeholder: field.placeholder,
43100
43149
  disabled: field.disabled
@@ -43264,7 +43313,7 @@ function MultiBarProgress(_ref) {
43264
43313
  }
43265
43314
  const Style$x = styled__default["default"].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"])));
43266
43315
 
43267
- const _excluded$e = ["tooltipTitle", "percentage", "strokeColor", "showInfo"];
43316
+ const _excluded$c = ["tooltipTitle", "percentage", "strokeColor", "showInfo"];
43268
43317
  function MultiColorProgressBar(_ref) {
43269
43318
  let {
43270
43319
  tooltipTitle,
@@ -43276,7 +43325,7 @@ function MultiColorProgressBar(_ref) {
43276
43325
  },
43277
43326
  showInfo = false
43278
43327
  } = _ref,
43279
- rest = _objectWithoutProperties(_ref, _excluded$e);
43328
+ rest = _objectWithoutProperties(_ref, _excluded$c);
43280
43329
  return /*#__PURE__*/jsxRuntime.jsx(antd.Tooltip, {
43281
43330
  title: tooltipTitle,
43282
43331
  children: /*#__PURE__*/jsxRuntime.jsx(antd.Progress, _objectSpread2({
@@ -43351,7 +43400,7 @@ function ProgressBarWithIcon(_ref) {
43351
43400
  });
43352
43401
  }
43353
43402
 
43354
- const _excluded$d = ["value", "options", "onChange", "className", "width"];
43403
+ const _excluded$b = ["value", "options", "onChange", "className", "width"];
43355
43404
  const ProgressTabs = _ref => {
43356
43405
  let {
43357
43406
  value = 'setup',
@@ -43372,7 +43421,7 @@ const ProgressTabs = _ref => {
43372
43421
  className = '',
43373
43422
  width = '100%'
43374
43423
  } = _ref,
43375
- rest = _objectWithoutProperties(_ref, _excluded$d);
43424
+ rest = _objectWithoutProperties(_ref, _excluded$b);
43376
43425
  // Transform options to include icons and handle disabled state
43377
43426
  const transformedOptions = options.map(option => _objectSpread2(_objectSpread2({}, option), {}, {
43378
43427
  label: /*#__PURE__*/jsxRuntime.jsxs("div", {
@@ -45924,7 +45973,7 @@ const renderRows = ({
45924
45973
  });
45925
45974
  };
45926
45975
 
45927
- const _excluded$c = ["page", "pageSize"];
45976
+ const _excluded$a = ["page", "pageSize"];
45928
45977
  function DataStoreTable$1(_ref) {
45929
45978
  let {
45930
45979
  mod,
@@ -46022,7 +46071,7 @@ function DataStoreTable$1(_ref) {
46022
46071
  page,
46023
46072
  pageSize
46024
46073
  } = activeFilters,
46025
- rest = _objectWithoutProperties(activeFilters, _excluded$c);
46074
+ rest = _objectWithoutProperties(activeFilters, _excluded$a);
46026
46075
  const params = _objectSpread2({
46027
46076
  pagination: {
46028
46077
  page,
@@ -46342,7 +46391,7 @@ const getLinkedColumns = ({
46342
46391
  ellipsis: true
46343
46392
  }];
46344
46393
 
46345
- const _excluded$b = ["administrativeLevel1", "administrativeLevel2"];
46394
+ const _excluded$9 = ["administrativeLevel1", "administrativeLevel2"];
46346
46395
  function DataStoreView(_ref) {
46347
46396
  let {
46348
46397
  mod,
@@ -46405,7 +46454,7 @@ function DataStoreView(_ref) {
46405
46454
  administrativeLevel1,
46406
46455
  administrativeLevel2
46407
46456
  } = _ref2,
46408
- rest = _objectWithoutProperties(_ref2, _excluded$b);
46457
+ rest = _objectWithoutProperties(_ref2, _excluded$9);
46409
46458
  const levels = [administrativeLevel1, administrativeLevel2].filter(p => !!p);
46410
46459
  let levelsRes = {
46411
46460
  data: []
@@ -47903,14 +47952,14 @@ const TabsStyled = styled__default["default"](antd.Tabs)`
47903
47952
 
47904
47953
  `;
47905
47954
 
47906
- const _excluded$a = ["defaultActiveKey", "items", "onChange"];
47955
+ const _excluded$8 = ["defaultActiveKey", "items", "onChange"];
47907
47956
  const StyledTabs = _ref => {
47908
47957
  let {
47909
47958
  defaultActiveKey,
47910
47959
  items,
47911
47960
  onChange
47912
47961
  } = _ref,
47913
- rest = _objectWithoutProperties(_ref, _excluded$a);
47962
+ rest = _objectWithoutProperties(_ref, _excluded$8);
47914
47963
  return /*#__PURE__*/jsxRuntime.jsx(TabsStyled, _objectSpread2({
47915
47964
  defaultActiveKey: defaultActiveKey,
47916
47965
  items: items,
@@ -47981,7 +48030,7 @@ const Container$1 = styled__default["default"].div`
47981
48030
  width: ${props => props.isPdf ? props.width ? props.width : '1000px' : 'calc(100% - 48px)'};
47982
48031
  `;
47983
48032
 
47984
- const _excluded$9 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "isPercentage", "seriesField", "formattedYAxis", "formattedXAxis", "color", "height", "t", "isPdf", "legendConfig", "width", "xAxisConfig"];
48033
+ const _excluded$7 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "isPercentage", "seriesField", "formattedYAxis", "formattedXAxis", "color", "height", "t", "isPdf", "legendConfig", "width", "xAxisConfig"];
47985
48034
  const {
47986
48035
  useToken: useToken$i
47987
48036
  } = antd.theme;
@@ -48071,7 +48120,7 @@ function BarChart(_ref) {
48071
48120
  width,
48072
48121
  xAxisConfig = {}
48073
48122
  } = _ref;
48074
- _objectWithoutProperties(_ref, _excluded$9);
48123
+ _objectWithoutProperties(_ref, _excluded$7);
48075
48124
  const containerRef = React__default["default"].useRef(null);
48076
48125
  const chartRef = React__default["default"].useRef(null);
48077
48126
  const {
@@ -48155,7 +48204,7 @@ function BarChart(_ref) {
48155
48204
  });
48156
48205
  }
48157
48206
 
48158
- const _excluded$8 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isSmooth", "seriesField", "isArea", "formattedYAxis", "formattedXAxis", "color", "isPercentage", "height", "autoHideXLabel", "t", "isPdf", "legendConfig", "width", "yAxis", "xAxis"];
48207
+ const _excluded$6 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isSmooth", "seriesField", "isArea", "formattedYAxis", "formattedXAxis", "color", "isPercentage", "height", "autoHideXLabel", "t", "isPdf", "legendConfig", "width", "yAxis", "xAxis"];
48159
48208
  const {
48160
48209
  useToken: useToken$h
48161
48210
  } = antd.theme;
@@ -48244,7 +48293,7 @@ function LineChart(_ref) {
48244
48293
  yAxis: customYAxis,
48245
48294
  xAxis: customXAxis
48246
48295
  } = _ref;
48247
- _objectWithoutProperties(_ref, _excluded$8);
48296
+ _objectWithoutProperties(_ref, _excluded$6);
48248
48297
  const containerRef = React__default["default"].useRef(null);
48249
48298
  const chartRef = React__default["default"].useRef(null);
48250
48299
  const {
@@ -48346,7 +48395,7 @@ function LineChart(_ref) {
48346
48395
  });
48347
48396
  }
48348
48397
 
48349
- const _excluded$7 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "seriesField", "isPercentage", "showBackground", "formattedYAxis", "formattedXAxis", "color", "height", "groupField", "width", "legendConfig", "isPdf", "yAxis", "xAxis"];
48398
+ const _excluded$5 = ["data", "xFieldKey", "yFieldKey", "renderTooltipContent", "tooltipConfig", "animated", "isStack", "isGroup", "seriesField", "isPercentage", "showBackground", "formattedYAxis", "formattedXAxis", "color", "height", "groupField", "width", "legendConfig", "isPdf", "yAxis", "xAxis"];
48350
48399
  const {
48351
48400
  useToken: useToken$g
48352
48401
  } = antd.theme;
@@ -48451,7 +48500,7 @@ function ColumnChart(_ref) {
48451
48500
  yAxis: customYAxis,
48452
48501
  xAxis: customXAxis
48453
48502
  } = _ref;
48454
- _objectWithoutProperties(_ref, _excluded$7);
48503
+ _objectWithoutProperties(_ref, _excluded$5);
48455
48504
  const containerRef = React__default["default"].useRef(null);
48456
48505
  const chartRef = React__default["default"].useRef(null);
48457
48506
  const {
@@ -48719,7 +48768,7 @@ function RadialBarChart(_ref) {
48719
48768
  });
48720
48769
  }
48721
48770
 
48722
- const _excluded$6 = ["data", "angleField", "colorField", "color", "height", "innerRadius", "radius", "legend", "label", "statistic", "tooltip", "renderTooltipContent", "tooltipConfig", "meta", "animation", "t", "isPdf", "legendConfig"];
48771
+ const _excluded$4 = ["data", "angleField", "colorField", "color", "height", "innerRadius", "radius", "legend", "label", "statistic", "tooltip", "renderTooltipContent", "tooltipConfig", "meta", "animation", "t", "isPdf", "legendConfig"];
48723
48772
  const {
48724
48773
  useToken: useToken$e
48725
48774
  } = antd.theme;
@@ -48794,7 +48843,7 @@ function DonutPie(_ref) {
48794
48843
  isPdf = false,
48795
48844
  legendConfig = {}
48796
48845
  } = _ref,
48797
- rest = _objectWithoutProperties(_ref, _excluded$6);
48846
+ rest = _objectWithoutProperties(_ref, _excluded$4);
48798
48847
  const containerRef = React.useRef(null);
48799
48848
  const chartRef = React.useRef(null);
48800
48849
  const {
@@ -49314,7 +49363,7 @@ function StackChart(_ref) {
49314
49363
  });
49315
49364
  }
49316
49365
 
49317
- const _excluded$5 = ["data", "xFieldKey", "yFieldKey", "seriesField", "renderTooltipContent", "tooltipConfig", "animated", "color", "formattedYAxis", "formattedXAxis", "fillOpacity", "height", "t", "isPdf", "legendConfig", "width"];
49366
+ const _excluded$3 = ["data", "xFieldKey", "yFieldKey", "seriesField", "renderTooltipContent", "tooltipConfig", "animated", "color", "formattedYAxis", "formattedXAxis", "fillOpacity", "height", "t", "isPdf", "legendConfig", "width"];
49318
49367
  const {
49319
49368
  useToken: useToken$c
49320
49369
  } = antd.theme;
@@ -49391,7 +49440,7 @@ const AreaChart = _ref => {
49391
49440
  legendConfig = {},
49392
49441
  width
49393
49442
  } = _ref,
49394
- rest = _objectWithoutProperties(_ref, _excluded$5);
49443
+ rest = _objectWithoutProperties(_ref, _excluded$3);
49395
49444
  const containerRef = React.useRef(null);
49396
49445
  const chartRef = React.useRef(null);
49397
49446
  const {
@@ -49479,7 +49528,7 @@ const AreaChart = _ref => {
49479
49528
  });
49480
49529
  };
49481
49530
 
49482
- const _excluded$4 = ["data", "xFieldKey", "yFieldKey", "seriesField", "renderTooltipContent", "tooltipConfig", "animated", "color", "formattedYAxis", "formattedXAxis", "score", "height", "isPdf", "legendConfig"];
49531
+ const _excluded$2 = ["data", "xFieldKey", "yFieldKey", "seriesField", "renderTooltipContent", "tooltipConfig", "animated", "color", "formattedYAxis", "formattedXAxis", "score", "height", "isPdf", "legendConfig"];
49483
49532
  const {
49484
49533
  useToken: useToken$b
49485
49534
  } = antd.theme;
@@ -49504,7 +49553,7 @@ const RadarChart = _ref => {
49504
49553
  isPdf = false,
49505
49554
  legendConfig = {}
49506
49555
  } = _ref,
49507
- rest = _objectWithoutProperties(_ref, _excluded$4);
49556
+ rest = _objectWithoutProperties(_ref, _excluded$2);
49508
49557
  const containerRef = React.useRef(null);
49509
49558
  const chartRef = React.useRef(null);
49510
49559
  const {
@@ -51887,7 +51936,7 @@ function StakeholderMappings(_ref3) {
51887
51936
  }
51888
51937
  var index = withProvider(StakeholderMappings);
51889
51938
 
51890
- const _excluded$3 = ["t", "checkboxConfig", "defaultTableFilters", "columns", "children", "data", "loading", "APP", "getApiBaseUrl", "selectOptions", "selectFilters", "showCreate", "location", "goTo", "getRedirectLink", "defaultUrlParams", "view", "module", "filtersConfig", "isMobile"];
51939
+ const _excluded$1 = ["t", "checkboxConfig", "defaultTableFilters", "columns", "children", "data", "loading", "APP", "getApiBaseUrl", "selectOptions", "selectFilters", "showCreate", "location", "goTo", "getRedirectLink", "defaultUrlParams", "view", "module", "filtersConfig", "isMobile"];
51891
51940
  const BaseScreen = _ref => {
51892
51941
  var _data$data;
51893
51942
  let {
@@ -51925,7 +51974,7 @@ const BaseScreen = _ref => {
51925
51974
  filtersConfig,
51926
51975
  isMobile
51927
51976
  } = _ref,
51928
- rest = _objectWithoutProperties(_ref, _excluded$3);
51977
+ rest = _objectWithoutProperties(_ref, _excluded$1);
51929
51978
  const [showFilters, setShowFilters] = React.useState(false);
51930
51979
  const [hasError, setHasError] = React.useState(false);
51931
51980
  const {
@@ -52913,10 +52962,12 @@ class AdminService extends BaseService {
52913
52962
  });
52914
52963
  }
52915
52964
  getItems({
52916
- item
52965
+ item,
52966
+ params
52917
52967
  }) {
52918
52968
  return this.apiGet({
52919
- url: `/management/items/${item}`
52969
+ url: `/management/items/${item}`,
52970
+ params
52920
52971
  });
52921
52972
  }
52922
52973
  getItemForm({
@@ -53595,6 +53646,17 @@ const renderTypeTag = ({
53595
53646
  children: label
53596
53647
  });
53597
53648
  };
53649
+ const getTabs$2 = ({
53650
+ t
53651
+ }) => {
53652
+ return [{
53653
+ key: "active",
53654
+ label: t("Active")
53655
+ }, {
53656
+ key: "deleted",
53657
+ label: t("admin::deleted")
53658
+ }];
53659
+ };
53598
53660
 
53599
53661
  const getColumns$9 = ({
53600
53662
  t,
@@ -53920,11 +53982,11 @@ const filtersConfig$d = {
53920
53982
  datastakeId: ""
53921
53983
  };
53922
53984
  const view$2 = "admin-users";
53923
- const defaultUrlParams$5 = {
53985
+ const defaultUrlParams$6 = {
53924
53986
  activeTab: "active"
53925
53987
  };
53926
53988
  const defaultTableFilters$2 = {};
53927
- const getTabs$3 = ({
53989
+ const getTabs$1 = ({
53928
53990
  totalPending = 0,
53929
53991
  t
53930
53992
  }) => [{
@@ -53939,6 +54001,50 @@ const getTabs$3 = ({
53939
54001
  label: t("Suspended")
53940
54002
  }];
53941
54003
 
54004
+ const useGetQueryParams = ({
54005
+ location
54006
+ }) => {
54007
+ const queryParams = React.useMemo(() => {
54008
+ const params = new URLSearchParams(location?.search);
54009
+ return Object.fromEntries(params.entries());
54010
+ }, [location.search]);
54011
+ const params = React.useMemo(() => {
54012
+ const {
54013
+ page,
54014
+ pageSize,
54015
+ search,
54016
+ searchParams: rawSearchParams,
54017
+ sortBy,
54018
+ sortDir,
54019
+ status,
54020
+ product,
54021
+ ...rest
54022
+ } = queryParams;
54023
+ return {
54024
+ paginationQuery: {
54025
+ skip: page,
54026
+ take: pageSize
54027
+ },
54028
+ searchParams: {
54029
+ qs: search,
54030
+ fields: safeJsonParse(rawSearchParams)
54031
+ },
54032
+ otherParams: {
54033
+ ...rest,
54034
+ ...(product && {
54035
+ "products.typeOfProduct": product
54036
+ }),
54037
+ ...(status && {
54038
+ published: status === "submitted" ? true : false
54039
+ })
54040
+ },
54041
+ sortBy,
54042
+ sortDir
54043
+ };
54044
+ }, [queryParams]);
54045
+ return params;
54046
+ };
54047
+
53942
54048
  function useAdminTable({
53943
54049
  goTo,
53944
54050
  location,
@@ -54033,6 +54139,103 @@ function useAdminTable({
54033
54139
  setLoading
54034
54140
  };
54035
54141
  }
54142
+ const useGetParams = ({
54143
+ location
54144
+ }) => {
54145
+ const {
54146
+ paginationQuery,
54147
+ searchParams,
54148
+ otherParams,
54149
+ sortBy,
54150
+ sortDir
54151
+ } = useGetQueryParams({
54152
+ location
54153
+ });
54154
+ const cleanSearchParams = Object.fromEntries(Object.entries(searchParams).filter(([_, value]) => value != null && value !== ''));
54155
+ const hasPagination = paginationQuery.skip != null || paginationQuery.take != null;
54156
+ const {
54157
+ activeTab,
54158
+ ...rest
54159
+ } = otherParams;
54160
+ const params = React.useMemo(() => {
54161
+ if (!hasPagination) {
54162
+ return undefined;
54163
+ }
54164
+ return {
54165
+ pagination: paginationQuery,
54166
+ ...(Object.keys(rest)?.length > 0 && rest),
54167
+ ...(Object.keys(cleanSearchParams)?.length > 0 && {
54168
+ search: cleanSearchParams
54169
+ }),
54170
+ tab: activeTab
54171
+ };
54172
+ }, [location.search, hasPagination, paginationQuery, rest, cleanSearchParams, activeTab]);
54173
+ return params;
54174
+ };
54175
+ function useSubjectsAdminTable({
54176
+ goTo,
54177
+ location,
54178
+ selectFiltersConfig,
54179
+ view,
54180
+ defaultUrlParams,
54181
+ module,
54182
+ filtersConfig,
54183
+ getRedirectLink,
54184
+ getData,
54185
+ defaultPageSize,
54186
+ refetchTrigger
54187
+ }) {
54188
+ const [initFetchDone, setInitFetchDone] = React.useState(false);
54189
+ const [loading, setLoading] = React.useState(false);
54190
+ const [data, setData] = React.useState([]);
54191
+ const filter = useFilters({
54192
+ goTo,
54193
+ location,
54194
+ selectFiltersConfig,
54195
+ view,
54196
+ defaultUrlParams,
54197
+ module,
54198
+ filtersConfig,
54199
+ defaultPageSize: defaultPageSize || 20,
54200
+ getRedirectLink
54201
+ });
54202
+ const activeTab = React.useMemo(() => filter.activeFilters.activeTab, [filter.activeFilters]);
54203
+ const canClearSearch = React.useMemo(() => {
54204
+ return !!filter.activeFilters.search;
54205
+ }, [filter.activeFilters]);
54206
+ const fetchData = React.useCallback(async () => {
54207
+ try {
54208
+ setLoading(true);
54209
+ const {
54210
+ data
54211
+ } = await getData();
54212
+ setData(data.data || data || []);
54213
+ filter.setPagination(prev => ({
54214
+ ...prev,
54215
+ total: data?.meta?.total || data?.length || 0
54216
+ }));
54217
+ if (!initFetchDone) {
54218
+ setInitFetchDone(true);
54219
+ }
54220
+ setLoading(false);
54221
+ } catch (err) {
54222
+ console.log(err);
54223
+ }
54224
+ }, [filter.activeFilters, refetchTrigger, location.search]);
54225
+ React.useEffect(() => {
54226
+ fetchData();
54227
+ }, [fetchData, refetchTrigger]);
54228
+ return {
54229
+ filter,
54230
+ activeTab,
54231
+ canClearSearch,
54232
+ data,
54233
+ loading,
54234
+ initFetchDone,
54235
+ fetchData,
54236
+ setLoading
54237
+ };
54238
+ }
54036
54239
 
54037
54240
  function UserTable(_ref) {
54038
54241
  let {
@@ -54067,7 +54270,7 @@ function UserTable(_ref) {
54067
54270
  location,
54068
54271
  selectFiltersConfig: selectFiltersConfig$d,
54069
54272
  view: view$2,
54070
- defaultUrlParams: defaultUrlParams$5,
54273
+ defaultUrlParams: defaultUrlParams$6,
54071
54274
  module,
54072
54275
  filtersConfig: filtersConfig$d,
54073
54276
  getRedirectLink,
@@ -54127,7 +54330,7 @@ function UserTable(_ref) {
54127
54330
  t: t,
54128
54331
  headerTitle: headerTitle,
54129
54332
  actionButton: actionButton,
54130
- tabs: getTabs$3({
54333
+ tabs: getTabs$1({
54131
54334
  totalPending: totalPending,
54132
54335
  t
54133
54336
  }),
@@ -54508,11 +54711,11 @@ const filtersConfig$c = {
54508
54711
  datastakeId: ""
54509
54712
  };
54510
54713
  const view$1 = "accounts";
54511
- const defaultUrlParams$4 = {
54714
+ const defaultUrlParams$5 = {
54512
54715
  activeTab: "active"
54513
54716
  };
54514
54717
  const defaultTableFilters$1 = {};
54515
- const getTabs$2 = ({
54718
+ const getTabs = ({
54516
54719
  totalPending = 0,
54517
54720
  t
54518
54721
  }) => [{
@@ -54816,7 +55019,7 @@ function AccountTable(_ref) {
54816
55019
  location,
54817
55020
  selectFiltersConfig: selectFiltersConfig$c,
54818
55021
  view: view$1,
54819
- defaultUrlParams: defaultUrlParams$4,
55022
+ defaultUrlParams: defaultUrlParams$5,
54820
55023
  module,
54821
55024
  defaultPageSize,
54822
55025
  filtersConfig: filtersConfig$c,
@@ -54899,7 +55102,7 @@ function AccountTable(_ref) {
54899
55102
  // disabled: selectedAccounts.length < 2,
54900
55103
  // },
54901
55104
  ],
54902
- tabs: getTabs$2({
55105
+ tabs: getTabs({
54903
55106
  totalPending: totalPending,
54904
55107
  t
54905
55108
  }),
@@ -54978,17 +55181,6 @@ function AccountTable(_ref) {
54978
55181
  });
54979
55182
  }
54980
55183
 
54981
- const getTabs$1 = ({
54982
- t
54983
- }) => {
54984
- return [{
54985
- key: "active",
54986
- label: t("Active")
54987
- }, {
54988
- key: "deleted",
54989
- label: t("admin::deleted")
54990
- }];
54991
- };
54992
55184
  const selectFiltersConfig$b = {
54993
55185
  category: {
54994
55186
  type: "select",
@@ -55034,7 +55226,7 @@ const filtersConfig$b = {
55034
55226
  name: "",
55035
55227
  datastakeId: ""
55036
55228
  };
55037
- const defaultUrlParams$3 = {
55229
+ const defaultUrlParams$4 = {
55038
55230
  activeTab: "active"
55039
55231
  };
55040
55232
  const checkboxConfig$b = {
@@ -55612,7 +55804,6 @@ function CombineLocationModal({
55612
55804
  });
55613
55805
  }
55614
55806
 
55615
- const _excluded$2 = ["pagination", "tab", "filters", "search", "sort"];
55616
55807
  const {
55617
55808
  useToken: useToken$4
55618
55809
  } = antd.theme;
@@ -55642,53 +55833,10 @@ function LocationTable(_ref) {
55642
55833
  token
55643
55834
  } = useToken$4();
55644
55835
  const [isCombineModalOpen, setIsModalOpen] = React.useState(false);
55645
- const getDataWithStringPagination = async _ref2 => {
55646
- let {
55647
- params
55648
- } = _ref2;
55649
- const {
55650
- pagination,
55651
- tab,
55652
- filters,
55653
- search,
55654
- sort
55655
- } = params;
55656
- _objectWithoutProperties(params, _excluded$2);
55657
- let paginationObj = {
55658
- page: 1,
55659
- pageSize: 20
55660
- };
55661
- if (pagination) {
55662
- try {
55663
- paginationObj = typeof pagination === 'string' ? JSON.parse(pagination) : pagination;
55664
- } catch (e) {
55665
- console.error('Failed to parse pagination', e);
55666
- }
55667
- }
55668
- const pageSize = Number(paginationObj.pageSize) || Number(paginationObj.take) || 20;
55669
- let pageNumber = 1;
55670
- if (paginationObj.page || paginationObj.current) {
55671
- pageNumber = Number(paginationObj.page) || Number(paginationObj.current);
55672
- } else if (typeof paginationObj.skip === 'number') {
55673
- pageNumber = Math.floor(paginationObj.skip / pageSize) + 1;
55674
- }
55675
- pageNumber = pageNumber || 1;
55676
- let activeTab = tab || "active";
55677
- if (!tab && filters) {
55678
- try {
55679
- const parsedFilters = typeof filters === 'string' ? JSON.parse(filters) : filters;
55680
- activeTab = parsedFilters.activeTab || "active";
55681
- } catch (e) {
55682
- activeTab = "active";
55683
- }
55684
- }
55685
- const transformedParams = {
55686
- pagination: {
55687
- skip: pageNumber,
55688
- take: pageSize
55689
- },
55690
- tab: activeTab
55691
- };
55836
+ const transformedParams = useGetParams({
55837
+ location
55838
+ });
55839
+ const getDataWithStringPagination = async () => {
55692
55840
  return getData({
55693
55841
  params: transformedParams
55694
55842
  });
@@ -55697,19 +55845,17 @@ function LocationTable(_ref) {
55697
55845
  filter,
55698
55846
  activeTab,
55699
55847
  canClearSearch,
55700
- totalPending,
55701
55848
  data,
55702
55849
  loading,
55703
55850
  initFetchDone,
55704
55851
  fetchData,
55705
- fetchPendingAccounts,
55706
55852
  setLoading
55707
- } = useAdminTable({
55853
+ } = useSubjectsAdminTable({
55708
55854
  goTo,
55709
55855
  location,
55710
55856
  selectFiltersConfig: selectFiltersConfig$b,
55711
55857
  view,
55712
- defaultUrlParams: defaultUrlParams$3,
55858
+ defaultUrlParams: defaultUrlParams$4,
55713
55859
  module,
55714
55860
  defaultPageSize,
55715
55861
  filtersConfig: filtersConfig$b,
@@ -55746,7 +55892,7 @@ function LocationTable(_ref) {
55746
55892
  tooltip: t("admin::merge-locations"),
55747
55893
  disabled: selectedLocations.length < 2
55748
55894
  }],
55749
- tabs: getTabs$1({
55895
+ tabs: getTabs$2({
55750
55896
  t
55751
55897
  }),
55752
55898
  isMobile: isMobile,
@@ -55819,17 +55965,6 @@ function LocationTable(_ref) {
55819
55965
  });
55820
55966
  }
55821
55967
 
55822
- const getTabs = ({
55823
- t
55824
- }) => {
55825
- return [{
55826
- key: "active",
55827
- label: t("Active")
55828
- }, {
55829
- key: "deleted",
55830
- label: t("admin::deleted")
55831
- }];
55832
- };
55833
55968
  const selectFiltersConfig$a = {
55834
55969
  category: {
55835
55970
  type: "select",
@@ -55875,7 +56010,7 @@ const filtersConfig$a = {
55875
56010
  name: "",
55876
56011
  datastakeId: ""
55877
56012
  };
55878
- const defaultUrlParams$2 = {
56013
+ const defaultUrlParams$3 = {
55879
56014
  activeTab: "active"
55880
56015
  };
55881
56016
  const checkboxConfig$a = {
@@ -56354,7 +56489,6 @@ function CombineSubjectsModal({
56354
56489
  });
56355
56490
  }
56356
56491
 
56357
- const _excluded$1 = ["pagination", "tab", "filters", "search", "sort"];
56358
56492
  const {
56359
56493
  useToken: useToken$2
56360
56494
  } = antd.theme;
@@ -56384,53 +56518,10 @@ function SubjectsTable(_ref) {
56384
56518
  token
56385
56519
  } = useToken$2();
56386
56520
  const [isCombineModalOpen, setIsModalOpen] = React.useState(false);
56387
- const getDataWithStringPagination = async _ref2 => {
56388
- let {
56389
- params
56390
- } = _ref2;
56391
- const {
56392
- pagination,
56393
- tab,
56394
- filters,
56395
- search,
56396
- sort
56397
- } = params;
56398
- _objectWithoutProperties(params, _excluded$1);
56399
- let paginationObj = {
56400
- page: 1,
56401
- pageSize: 20
56402
- };
56403
- if (pagination) {
56404
- try {
56405
- paginationObj = typeof pagination === 'string' ? JSON.parse(pagination) : pagination;
56406
- } catch (e) {
56407
- console.error('Failed to parse pagination', e);
56408
- }
56409
- }
56410
- const pageSize = Number(paginationObj.pageSize) || Number(paginationObj.take) || 20;
56411
- let pageNumber = 1;
56412
- if (paginationObj.page || paginationObj.current) {
56413
- pageNumber = Number(paginationObj.page) || Number(paginationObj.current);
56414
- } else if (typeof paginationObj.skip === 'number') {
56415
- pageNumber = Math.floor(paginationObj.skip / pageSize) + 1;
56416
- }
56417
- pageNumber = pageNumber || 1;
56418
- let activeTab = tab || "active";
56419
- if (!tab && filters) {
56420
- try {
56421
- const parsedFilters = typeof filters === 'string' ? JSON.parse(filters) : filters;
56422
- activeTab = parsedFilters.activeTab || "active";
56423
- } catch (e) {
56424
- activeTab = "active";
56425
- }
56426
- }
56427
- const transformedParams = {
56428
- pagination: {
56429
- skip: pageNumber,
56430
- take: pageSize
56431
- },
56432
- tab: activeTab
56433
- };
56521
+ const transformedParams = useGetParams({
56522
+ location
56523
+ });
56524
+ const getDataWithStringPagination = async () => {
56434
56525
  return getData({
56435
56526
  params: transformedParams
56436
56527
  });
@@ -56439,19 +56530,17 @@ function SubjectsTable(_ref) {
56439
56530
  filter,
56440
56531
  activeTab,
56441
56532
  canClearSearch,
56442
- totalPending,
56443
56533
  data,
56444
56534
  loading,
56445
56535
  initFetchDone,
56446
56536
  fetchData,
56447
- fetchPendingAccounts,
56448
56537
  setLoading
56449
- } = useAdminTable({
56538
+ } = useSubjectsAdminTable({
56450
56539
  goTo,
56451
56540
  location,
56452
56541
  selectFiltersConfig: selectFiltersConfig$a,
56453
56542
  view,
56454
- defaultUrlParams: defaultUrlParams$2,
56543
+ defaultUrlParams: defaultUrlParams$3,
56455
56544
  module,
56456
56545
  defaultPageSize,
56457
56546
  filtersConfig: filtersConfig$a,
@@ -56485,9 +56574,9 @@ function SubjectsTable(_ref) {
56485
56574
  icon: "Merge",
56486
56575
  onClick: () => setIsModalOpen(true),
56487
56576
  tooltip: t("merge-subjects"),
56488
- disabled: selectedSubjects.length < 2
56577
+ disabled: (selectedSubjects === null || selectedSubjects === void 0 ? void 0 : selectedSubjects.length) < 2
56489
56578
  }],
56490
- tabs: getTabs({
56579
+ tabs: getTabs$2({
56491
56580
  t
56492
56581
  }),
56493
56582
  isMobile: isMobile,
@@ -56501,13 +56590,13 @@ function SubjectsTable(_ref) {
56501
56590
  checkboxConfig: checkboxConfig$a,
56502
56591
  defaultTableFilters: {},
56503
56592
  breadcrumbs: breadcrumbs,
56504
- children: [selectedSubjects.length > 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
56593
+ children: [(selectedSubjects === null || selectedSubjects === void 0 ? void 0 : selectedSubjects.length) > 0 && /*#__PURE__*/jsxRuntime.jsx("div", {
56505
56594
  className: "flex flex-row ml-6 mt-5",
56506
56595
  style: {
56507
56596
  flexWrap: "wrap",
56508
56597
  gap: "8px"
56509
56598
  },
56510
- children: selectedSubjects.map(account => /*#__PURE__*/jsxRuntime.jsxs(antd.Tag, {
56599
+ children: selectedSubjects === null || selectedSubjects === void 0 ? void 0 : selectedSubjects.map(account => /*#__PURE__*/jsxRuntime.jsxs(antd.Tag, {
56511
56600
  className: "flex flex-row gap-2 items-center",
56512
56601
  onClick: () => setSelectedSubjects(prev => prev.filter(a => a.datastakeId !== account.datastakeId)),
56513
56602
  style: {
@@ -57088,7 +57177,7 @@ const selectFiltersConfig$9 = {
57088
57177
  const filtersConfig$9 = {
57089
57178
  search: ""
57090
57179
  };
57091
- const defaultUrlParams$1 = {
57180
+ const defaultUrlParams$2 = {
57092
57181
  search: "",
57093
57182
  userRole: null,
57094
57183
  status: null
@@ -57134,7 +57223,7 @@ function Users({
57134
57223
  goTo,
57135
57224
  location,
57136
57225
  selectFiltersConfig: selectFiltersConfig$9,
57137
- defaultUrlParams: defaultUrlParams$1,
57226
+ defaultUrlParams: defaultUrlParams$2,
57138
57227
  module,
57139
57228
  filtersConfig: filtersConfig$9,
57140
57229
  getRedirectLink
@@ -58586,6 +58675,9 @@ const filtersConfig$8 = {
58586
58675
  name: "",
58587
58676
  datastakeId: ""
58588
58677
  };
58678
+ const defaultUrlParams$1 = {
58679
+ activeTab: "active"
58680
+ };
58589
58681
  const checkboxConfig$8 = {
58590
58682
  name: "Name",
58591
58683
  datastakeId: "ID"
@@ -58717,52 +58809,10 @@ function DocumentsTable({
58717
58809
  const {
58718
58810
  token
58719
58811
  } = useToken$1();
58720
- const getDataWithStringPagination = async ({
58721
- params
58722
- }) => {
58723
- const {
58724
- pagination,
58725
- tab,
58726
- filters,
58727
- search,
58728
- sort,
58729
- ...otherParams
58730
- } = params;
58731
- let paginationObj = {
58732
- page: 1,
58733
- pageSize: 20
58734
- };
58735
- if (pagination) {
58736
- try {
58737
- paginationObj = typeof pagination === 'string' ? JSON.parse(pagination) : pagination;
58738
- } catch (e) {
58739
- console.error('Failed to parse pagination', e);
58740
- }
58741
- }
58742
- const pageSize = Number(paginationObj.pageSize) || Number(paginationObj.take) || 20;
58743
- let pageNumber = 1;
58744
- if (paginationObj.page || paginationObj.current) {
58745
- pageNumber = Number(paginationObj.page) || Number(paginationObj.current);
58746
- } else if (typeof paginationObj.skip === 'number') {
58747
- pageNumber = Math.floor(paginationObj.skip / pageSize) + 1;
58748
- }
58749
- pageNumber = pageNumber || 1;
58750
- let activeTab = tab || "active";
58751
- if (!tab && filters) {
58752
- try {
58753
- const parsedFilters = typeof filters === 'string' ? JSON.parse(filters) : filters;
58754
- activeTab = parsedFilters.activeTab || "active";
58755
- } catch (e) {
58756
- activeTab = "active";
58757
- }
58758
- }
58759
- const transformedParams = {
58760
- pagination: {
58761
- skip: pageNumber,
58762
- take: pageSize
58763
- },
58764
- tab: activeTab
58765
- };
58812
+ const transformedParams = useGetParams({
58813
+ location
58814
+ });
58815
+ const getDataWithStringPagination = async () => {
58766
58816
  return getData({
58767
58817
  params: transformedParams
58768
58818
  });
@@ -58771,19 +58821,17 @@ function DocumentsTable({
58771
58821
  filter,
58772
58822
  activeTab,
58773
58823
  canClearSearch,
58774
- totalPending,
58775
58824
  data,
58776
58825
  loading,
58777
58826
  initFetchDone,
58778
58827
  fetchData,
58779
- fetchPendingAccounts,
58780
58828
  setLoading
58781
- } = useAdminTable({
58829
+ } = useSubjectsAdminTable({
58782
58830
  goTo,
58783
58831
  location,
58784
58832
  selectFiltersConfig: selectFiltersConfig$8,
58785
58833
  view,
58786
- // defaultUrlParams,
58834
+ defaultUrlParams: defaultUrlParams$1,
58787
58835
  module,
58788
58836
  defaultPageSize,
58789
58837
  filtersConfig: filtersConfig$8,
@@ -58828,11 +58876,12 @@ function DocumentsTable({
58828
58876
  // disabled: selectedDocuments.length < 2,
58829
58877
  // },
58830
58878
  // ]}
58831
- // tabs={getTabs({ t })}
58832
- ,
58833
- isMobile: isMobile
58834
- // activeTab={activeTab}
58835
58879
  ,
58880
+ tabs: getTabs$2({
58881
+ t
58882
+ }),
58883
+ isMobile: isMobile,
58884
+ activeTab: activeTab,
58836
58885
  showFilters: showFilters,
58837
58886
  setShowFilters: setShowFilters,
58838
58887
  hasError: hasError,
@@ -59042,7 +59091,7 @@ const getColumns = ({
59042
59091
  className: "daf-default-cell"
59043
59092
  });
59044
59093
  }
59045
- (options?.eventCategoryOptions || options?.categoryOptions || [])?.map(item => ({
59094
+ (options?.eventCategoryOptions || options?.eventsType || [])?.map(item => ({
59046
59095
  value: item.value,
59047
59096
  label: typeof item.label === 'object' ? Object.values(item.label)[1] : item.label
59048
59097
  }));
@@ -59136,50 +59185,24 @@ function EventsTable({
59136
59185
  const {
59137
59186
  token
59138
59187
  } = useToken();
59139
- const getDataWithStringPagination = async ({
59140
- params
59141
- }) => {
59142
- const {
59143
- pagination,
59144
- tab,
59145
- filters,
59146
- search,
59147
- sort,
59148
- ...otherParams
59149
- } = params;
59150
-
59151
- // Don't send pagination to API - we'll fetch all data and slice on frontend
59152
- let activeTab = tab || "active";
59153
- if (!tab && filters) {
59154
- try {
59155
- const parsedFilters = typeof filters === 'string' ? JSON.parse(filters) : filters;
59156
- activeTab = parsedFilters.activeTab || "active";
59157
- } catch (e) {
59158
- activeTab = "active";
59159
- }
59160
- }
59161
-
59162
- // Fetch all data without pagination - we'll slice on frontend based on URL params
59163
- const transformedParams = {
59164
- tab: activeTab,
59165
- ...otherParams
59166
- };
59188
+ const transformedParams = useGetParams({
59189
+ location
59190
+ });
59191
+ const getDataWithStringPagination = async () => {
59167
59192
  return getData({
59168
59193
  params: transformedParams
59169
59194
  });
59170
59195
  };
59171
59196
  const {
59172
59197
  filter,
59173
- // activeTab,
59198
+ activeTab,
59174
59199
  canClearSearch,
59175
- totalPending,
59176
59200
  data,
59177
59201
  loading,
59178
59202
  initFetchDone,
59179
59203
  fetchData,
59180
- fetchPendingAccounts,
59181
59204
  setLoading
59182
- } = useAdminTable({
59205
+ } = useSubjectsAdminTable({
59183
59206
  goTo,
59184
59207
  location,
59185
59208
  selectFiltersConfig: selectFiltersConfig$7,
@@ -59193,12 +59216,8 @@ function EventsTable({
59193
59216
  refetchTrigger
59194
59217
  });
59195
59218
  const selectOptions = React.useMemo(() => {
59196
- return {
59197
- category: config.options?.category,
59198
- country: config.options?.countries,
59199
- sources: []
59200
- };
59201
- }, [config.options]);
59219
+ return options;
59220
+ }, [options]);
59202
59221
  const columns = React.useMemo(() => {
59203
59222
  return getColumns({
59204
59223
  t,
@@ -59226,11 +59245,12 @@ function EventsTable({
59226
59245
  // disabled: selectedEvents.length < 2,
59227
59246
  // },
59228
59247
  // ]}
59229
- // tabs={getTabs({ t })}
59230
- ,
59231
- isMobile: isMobile
59232
- // activeTab={activeTab}
59233
59248
  ,
59249
+ tabs: getTabs$2({
59250
+ t
59251
+ }),
59252
+ isMobile: isMobile,
59253
+ activeTab: activeTab,
59234
59254
  showFilters: showFilters,
59235
59255
  setShowFilters: setShowFilters,
59236
59256
  hasError: hasError,