datastake-daf 0.6.756 → 0.6.757

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.
@@ -9689,28 +9689,30 @@ const handleSectionChildren = _ref => {
9689
9689
  });
9690
9690
  };
9691
9691
 
9692
- const handleArrayChildren = ({
9693
- value,
9694
- config,
9695
- label,
9696
- level,
9697
- t,
9698
- rootForm,
9699
- allData,
9700
- user,
9701
- getApiBaseUrl = () => {},
9702
- getAppHeader = () => {},
9703
- app,
9704
- TreeNodeComponent
9705
- }) => {
9692
+ const handleArrayChildren = _ref => {
9693
+ let {
9694
+ value,
9695
+ config,
9696
+ label,
9697
+ level,
9698
+ t,
9699
+ rootForm,
9700
+ allData,
9701
+ user,
9702
+ getApiBaseUrl = () => {},
9703
+ getAppHeader = () => {},
9704
+ app,
9705
+ TreeNodeComponent
9706
+ } = _ref;
9706
9707
  if (!Array.isArray(value)) {
9707
9708
  return null;
9708
9709
  }
9709
9710
  return value.map((item, itemIndex) => /*#__PURE__*/jsxRuntime.jsx("div", {
9710
9711
  className: "array-item",
9711
9712
  children: Object.keys(config.inputs).sort((a, b) => {
9712
- const positionA = config.inputs[a]?.position || 0;
9713
- const positionB = config.inputs[b]?.position || 0;
9713
+ var _config$inputs$a, _config$inputs$b;
9714
+ const positionA = ((_config$inputs$a = config.inputs[a]) === null || _config$inputs$a === void 0 ? void 0 : _config$inputs$a.position) || 0;
9715
+ const positionB = ((_config$inputs$b = config.inputs[b]) === null || _config$inputs$b === void 0 ? void 0 : _config$inputs$b.position) || 0;
9714
9716
  return positionA - positionB;
9715
9717
  }).map(subInputKey => {
9716
9718
  const subInputConfig = config.inputs[subInputKey];
@@ -9728,9 +9730,9 @@ const handleArrayChildren = ({
9728
9730
  getApiBaseUrl: getApiBaseUrl,
9729
9731
  getAppHeader: getAppHeader,
9730
9732
  app: app
9731
- }, `${itemIndex}-${subInputKey}`);
9733
+ }, "".concat(itemIndex, "-").concat(subInputKey));
9732
9734
  })
9733
- }, `${itemIndex}`));
9735
+ }, "".concat(itemIndex)));
9734
9736
  };
9735
9737
 
9736
9738
  const noDafApps = ['tif', 'cukura']; //PACKAGE_CHANGE_LATER (remove sbg)
@@ -9875,44 +9877,44 @@ function useAjaxModal$2({
9875
9877
  }
9876
9878
 
9877
9879
  const mergeObject = obj => {
9878
- return Object.entries(obj || {}).reduce((acc, _ref) => {
9879
- let [key, value] = _ref;
9880
+ return Object.entries(obj || {}).reduce((acc, [key, value]) => {
9880
9881
  if (typeof value === "object" && !Array.isArray(value) && value !== null) {
9881
- return _objectSpread2(_objectSpread2({}, acc), value);
9882
+ return {
9883
+ ...acc,
9884
+ ...value
9885
+ };
9882
9886
  }
9883
- return _objectSpread2(_objectSpread2({}, acc), {}, {
9887
+ return {
9888
+ ...acc,
9884
9889
  [key]: value
9885
- });
9890
+ };
9886
9891
  }, {});
9887
9892
  };
9888
- const handleDataLinkGroupWithTableKeys = _ref2 => {
9889
- var _inputConfig$meta, _config$meta2, _inputConfig$meta3, _inputConfig$meta4, _inputConfig$meta5;
9890
- let {
9891
- config,
9892
- inputConfig,
9893
- inputKey,
9894
- value,
9895
- level,
9896
- t,
9897
- rootForm,
9898
- allData,
9899
- user,
9900
- getApiBaseUrl = () => {},
9901
- getAppHeader = () => {},
9902
- app,
9903
- TreeNodeComponent
9904
- } = _ref2;
9893
+ const handleDataLinkGroupWithTableKeys = ({
9894
+ config,
9895
+ inputConfig,
9896
+ inputKey,
9897
+ value,
9898
+ level,
9899
+ t,
9900
+ rootForm,
9901
+ allData,
9902
+ user,
9903
+ getApiBaseUrl = () => {},
9904
+ getAppHeader = () => {},
9905
+ app,
9906
+ TreeNodeComponent
9907
+ }) => {
9905
9908
  if (!(config.type === 'dataLinkGroup' || config.type === 'dataLink')) {
9906
9909
  return null;
9907
9910
  }
9908
- if ((inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.type) !== 'dataLink' || !(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta = inputConfig.meta) !== null && _inputConfig$meta !== void 0 && _inputConfig$meta.tableKeys)) {
9911
+ if (inputConfig?.type !== 'dataLink' || !inputConfig?.meta?.tableKeys) {
9909
9912
  const parentInputKeys = Object.keys(config.inputs || {});
9910
9913
  const isHandledBySiblingDataLink = parentInputKeys.some(otherInputKey => {
9911
9914
  const otherConfig = config.inputs[otherInputKey];
9912
- if ((otherConfig === null || otherConfig === void 0 ? void 0 : otherConfig.type) === 'dataLink') {
9913
- var _otherConfig$meta, _config$meta;
9914
- const siblingTableKeys = (otherConfig === null || otherConfig === void 0 || (_otherConfig$meta = otherConfig.meta) === null || _otherConfig$meta === void 0 ? void 0 : _otherConfig$meta.tableKeys) || [];
9915
- const additionalTableKeys = ((_config$meta = config.meta) === null || _config$meta === void 0 ? void 0 : _config$meta.additionalTableKeys) || [];
9915
+ if (otherConfig?.type === 'dataLink') {
9916
+ const siblingTableKeys = otherConfig?.meta?.tableKeys || [];
9917
+ const additionalTableKeys = config.meta?.additionalTableKeys || [];
9916
9918
  const allSiblingKeys = [...siblingTableKeys, ...additionalTableKeys];
9917
9919
  return allSiblingKeys.includes(inputKey) && otherInputKey !== inputKey;
9918
9920
  }
@@ -9926,26 +9928,23 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
9926
9928
  return null;
9927
9929
  }
9928
9930
  const tableKeys = inputConfig.meta.tableKeys;
9929
- const additionalTableKeys = ((_config$meta2 = config.meta) === null || _config$meta2 === void 0 ? void 0 : _config$meta2.additionalTableKeys) || [];
9931
+ const additionalTableKeys = config.meta?.additionalTableKeys || [];
9930
9932
  const parentInputKeys = Object.keys(config.inputs || {});
9931
9933
  const siblingInputsMatchingTableKeys = parentInputKeys.filter(siblingKey => siblingKey !== inputKey).filter(siblingKey => tableKeys.includes(siblingKey) || additionalTableKeys.includes(siblingKey));
9932
9934
  [...new Set([...tableKeys, ...siblingInputsMatchingTableKeys])];
9933
- const isAjaxModal = React.useMemo(() => {
9934
- var _inputConfig$meta2;
9935
- return !!(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta2 = inputConfig.meta) !== null && _inputConfig$meta2 !== void 0 && _inputConfig$meta2.namespace);
9936
- }, [inputConfig]);
9935
+ const isAjaxModal = React.useMemo(() => !!inputConfig?.meta?.namespace, [inputConfig]);
9937
9936
  const ajaxModalValues = useAjaxModal$2({
9938
9937
  name: inputKey,
9939
9938
  user,
9940
- namespace: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta3 = inputConfig.meta) === null || _inputConfig$meta3 === void 0 ? void 0 : _inputConfig$meta3.namespace,
9941
- skipFetch: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta4 = inputConfig.meta) === null || _inputConfig$meta4 === void 0 ? void 0 : _inputConfig$meta4.skipFetch,
9939
+ namespace: inputConfig?.meta?.namespace,
9940
+ skipFetch: inputConfig?.meta?.skipFetch,
9942
9941
  isAjaxModal,
9943
- formScope: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta5 = inputConfig.meta) === null || _inputConfig$meta5 === void 0 ? void 0 : _inputConfig$meta5.formScope,
9942
+ formScope: inputConfig?.meta?.formScope,
9944
9943
  APP: app,
9945
9944
  apiBaseUrl: getApiBaseUrl(),
9946
9945
  _getAppHeader: getAppHeader
9947
9946
  });
9948
- const dataLinkForm = ajaxModalValues === null || ajaxModalValues === void 0 ? void 0 : ajaxModalValues.form;
9947
+ const dataLinkForm = ajaxModalValues?.form;
9949
9948
  const createInputsAndValues = item => {
9950
9949
  const inputs = {};
9951
9950
  const values = {};
@@ -9957,12 +9956,12 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
9957
9956
  'videos': 'Video'
9958
9957
  };
9959
9958
  tableKeys.filter(tableKey => tableKey !== 'datastakeId').forEach(tableKey => {
9960
- var _dataLinkForm$identif;
9961
- const formInputConfig = (dataLinkForm === null || dataLinkForm === void 0 ? void 0 : dataLinkForm[tableKey]) || (dataLinkForm === null || dataLinkForm === void 0 || (_dataLinkForm$identif = dataLinkForm['identification']) === null || _dataLinkForm$identif === void 0 ? void 0 : _dataLinkForm$identif[tableKey]);
9959
+ const formInputConfig = dataLinkForm?.[tableKey] || dataLinkForm?.['identification']?.[tableKey];
9962
9960
  if (formInputConfig) {
9963
- inputs[tableKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
9961
+ inputs[tableKey] = {
9962
+ ...formInputConfig,
9964
9963
  label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : formInputConfig.label || formInputConfig.tableLabel || tableKey
9965
- });
9964
+ };
9966
9965
  if (formInputConfig.label && typeof formInputConfig.label === 'object') {
9967
9966
  const dynamicLabelKeys = Object.keys(formInputConfig.label);
9968
9967
  let resolvedLabel = null;
@@ -9970,7 +9969,7 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
9970
9969
  const parts = labelKey.split(' is ');
9971
9970
  if (parts.length === 2) {
9972
9971
  const [conditionKey, conditionValue] = parts;
9973
- if ((item === null || item === void 0 ? void 0 : item[conditionKey]) === conditionValue) {
9972
+ if (item?.[conditionKey] === conditionValue) {
9974
9973
  resolvedLabel = formInputConfig.label[labelKey];
9975
9974
  break;
9976
9975
  }
@@ -9978,37 +9977,37 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
9978
9977
  }
9979
9978
  inputs[tableKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey);
9980
9979
  }
9981
- values[tableKey] = item === null || item === void 0 ? void 0 : item[tableKey];
9980
+ values[tableKey] = item?.[tableKey];
9982
9981
  } else {
9983
- var _item$linking;
9984
9982
  inputs[tableKey] = {
9985
9983
  label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey,
9986
- type: inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.type
9984
+ type: inputConfig?.type
9987
9985
  };
9988
- values[tableKey] = (item === null || item === void 0 || (_item$linking = item.linking) === null || _item$linking === void 0 || (_item$linking = _item$linking.SCL) === null || _item$linking === void 0 || (_item$linking = _item$linking[item === null || item === void 0 ? void 0 : item[tableKey]]) === null || _item$linking === void 0 ? void 0 : _item$linking.name) || (item === null || item === void 0 ? void 0 : item[tableKey]);
9986
+ values[tableKey] = item?.linking?.SCL?.[item?.[tableKey]]?.name || item?.[tableKey];
9989
9987
  }
9990
9988
  });
9991
9989
  siblingInputsMatchingTableKeys.forEach(siblingKey => {
9992
9990
  const siblingConfig = config.inputs[siblingKey];
9993
9991
  if (siblingConfig) {
9994
- inputs[siblingKey] = _objectSpread2(_objectSpread2({}, siblingConfig), {}, {
9992
+ inputs[siblingKey] = {
9993
+ ...siblingConfig,
9995
9994
  label: siblingConfig.label || siblingKey
9996
- });
9997
- values[siblingKey] = item === null || item === void 0 ? void 0 : item[siblingKey];
9995
+ };
9996
+ values[siblingKey] = item?.[siblingKey];
9998
9997
  }
9999
9998
  });
10000
- if (dataLinkForm !== null && dataLinkForm !== void 0 && dataLinkForm.identification && typeof dataLinkForm.identification === 'object') {
9999
+ if (dataLinkForm?.identification && typeof dataLinkForm.identification === 'object') {
10001
10000
  Object.keys(dataLinkForm.identification).filter(fieldKey => fieldKey !== 'datastakeId' && !tableKeys.includes(fieldKey)).filter(fieldKey => {
10002
10001
  const formInputConfig = dataLinkForm.identification[fieldKey];
10003
10002
  return formInputConfig && typeof formInputConfig === 'object' && !Array.isArray(formInputConfig);
10004
10003
  }).forEach(fieldKey => {
10005
- var _item$linking2;
10006
10004
  const formInputConfig = dataLinkForm.identification[fieldKey];
10007
- inputs[fieldKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
10005
+ inputs[fieldKey] = {
10006
+ ...formInputConfig,
10008
10007
  label: uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : formInputConfig.label || formInputConfig.tableLabel || fieldKey
10009
- });
10010
- if (formInputConfig !== null && formInputConfig !== void 0 && formInputConfig.label && typeof (formInputConfig === null || formInputConfig === void 0 ? void 0 : formInputConfig.label) === 'object') {
10011
- const dynamicLabelKeys = Object.keys(formInputConfig === null || formInputConfig === void 0 ? void 0 : formInputConfig.label);
10008
+ };
10009
+ if (formInputConfig?.label && typeof formInputConfig?.label === 'object') {
10010
+ const dynamicLabelKeys = Object.keys(formInputConfig?.label);
10012
10011
  let resolvedLabel = null;
10013
10012
  for (const labelKey of dynamicLabelKeys) {
10014
10013
  const parts = labelKey.split(' is ');
@@ -10017,7 +10016,7 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
10017
10016
  const flattenedItem = Object.assign({}, item.location, {
10018
10017
  address: item.address
10019
10018
  });
10020
- if ((flattenedItem === null || flattenedItem === void 0 ? void 0 : flattenedItem[conditionKey]) === conditionValue) {
10019
+ if (flattenedItem?.[conditionKey] === conditionValue) {
10021
10020
  resolvedLabel = formInputConfig.label[labelKey];
10022
10021
  break;
10023
10022
  }
@@ -10025,7 +10024,7 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
10025
10024
  }
10026
10025
  inputs[fieldKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : fieldKey);
10027
10026
  }
10028
- values[fieldKey] = (item === null || item === void 0 || (_item$linking2 = item.linking) === null || _item$linking2 === void 0 || (_item$linking2 = _item$linking2.SCL) === null || _item$linking2 === void 0 || (_item$linking2 = _item$linking2[item === null || item === void 0 ? void 0 : item[fieldKey]]) === null || _item$linking2 === void 0 ? void 0 : _item$linking2.name) || (item === null || item === void 0 ? void 0 : item[fieldKey]);
10027
+ values[fieldKey] = item?.linking?.SCL?.[item?.[fieldKey]]?.name || item?.[fieldKey];
10029
10028
  });
10030
10029
  }
10031
10030
  return {
@@ -10035,17 +10034,16 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
10035
10034
  };
10036
10035
  if (Array.isArray(value)) {
10037
10036
  return value.map((item, itemIndex) => {
10038
- var _merged$inputKey;
10039
10037
  const merged = mergeObject(item);
10040
- const datastakeIdValue = (merged === null || merged === void 0 || (_merged$inputKey = merged[inputKey]) === null || _merged$inputKey === void 0 ? void 0 : _merged$inputKey.datastakeId) || (merged === null || merged === void 0 ? void 0 : merged.datastakeId);
10038
+ const datastakeIdValue = merged?.[inputKey]?.datastakeId || merged?.datastakeId;
10041
10039
  const {
10042
10040
  inputs,
10043
10041
  values
10044
10042
  } = createInputsAndValues(merged);
10045
10043
  return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
10046
- nodeKey: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
10044
+ nodeKey: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
10047
10045
  config: {
10048
- label: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
10046
+ label: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
10049
10047
  type: 'custom-datalink-group',
10050
10048
  inputs: inputs
10051
10049
  },
@@ -10059,12 +10057,11 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
10059
10057
  getApiBaseUrl: getApiBaseUrl,
10060
10058
  getAppHeader: getAppHeader,
10061
10059
  app: app
10062
- }, "".concat(inputKey, "-").concat(itemIndex));
10060
+ }, `${inputKey}-${itemIndex}`);
10063
10061
  });
10064
10062
  } else {
10065
- var _merged$inputKey2;
10066
10063
  const merged = mergeObject(value);
10067
- const datastakeIdValue = (merged === null || merged === void 0 || (_merged$inputKey2 = merged[inputKey]) === null || _merged$inputKey2 === void 0 ? void 0 : _merged$inputKey2.datastakeId) || (merged === null || merged === void 0 ? void 0 : merged.datastakeId);
10064
+ const datastakeIdValue = merged?.[inputKey]?.datastakeId || merged?.datastakeId;
10068
10065
  const {
10069
10066
  inputs,
10070
10067
  values
@@ -10086,7 +10083,7 @@ const handleDataLinkGroupWithTableKeys = _ref2 => {
10086
10083
  getApiBaseUrl: getApiBaseUrl,
10087
10084
  getAppHeader: getAppHeader,
10088
10085
  app: app
10089
- }, "".concat(inputKey, "-group"));
10086
+ }, `${inputKey}-group`);
10090
10087
  }
10091
10088
  };
10092
10089
 
@@ -30406,6 +30403,7 @@ const EditForm$1 = _ref => {
30406
30403
  }), changeLinking, changeInputMeta, t, highlightMandatory)
30407
30404
  }, i);
30408
30405
  } else {
30406
+ var _input$meta16;
30409
30407
  const inputId = input.dataId || k;
30410
30408
  const value = values[inputId];
30411
30409
  const commentValue = (inputsMeta[k] || {}).comment;
@@ -30419,7 +30417,7 @@ const EditForm$1 = _ref => {
30419
30417
  children: [getFormTitles$1(formTitles, inputData.name, i), /*#__PURE__*/jsxRuntime.jsx(GetFormItem$1, {
30420
30418
  inputKey: k,
30421
30419
  inputData: inputData,
30422
- inputId: inputId,
30420
+ inputId: (input === null || input === void 0 ? void 0 : input.type) === "dataLink" ? (input === null || input === void 0 || (_input$meta16 = input.meta) === null || _input$meta16 === void 0 ? void 0 : _input$meta16.path) || inputId : inputId,
30423
30421
  input: input,
30424
30422
  highlightMandatory: highlightMandatory,
30425
30423
  changeInputMeta: changeInputMeta,
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const defaultBreadCrumbsLabels = {
6
+ events: "Events",
7
+ accounts: "Accounts",
8
+ modules: "Modules",
9
+ settings: "Settings",
10
+ user: "Users",
11
+ analysis: "Analysis",
12
+ 'data-store': "Data Store",
13
+ data: "Data",
14
+ partners: "Partners",
15
+ locations: "Locations",
16
+ 'information-channels': 'Channels',
17
+ 'find-information': 'Query',
18
+ stakeholders: "Stakeholders",
19
+ documents: "Documents",
20
+ mines: "Mines",
21
+ summary: "Summary",
22
+ edit: "Edit",
23
+ details: "Details"
24
+ };
25
+
26
+ exports.defaultBreadCrumbsLabels = defaultBreadCrumbsLabels;