datastake-daf 0.6.757 → 0.6.758

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.
@@ -9877,44 +9877,44 @@ function useAjaxModal$2({
9877
9877
  }
9878
9878
 
9879
9879
  const mergeObject = obj => {
9880
- return Object.entries(obj || {}).reduce((acc, [key, value]) => {
9880
+ return Object.entries(obj || {}).reduce((acc, _ref) => {
9881
+ let [key, value] = _ref;
9881
9882
  if (typeof value === "object" && !Array.isArray(value) && value !== null) {
9882
- return {
9883
- ...acc,
9884
- ...value
9885
- };
9883
+ return _objectSpread2(_objectSpread2({}, acc), value);
9886
9884
  }
9887
- return {
9888
- ...acc,
9885
+ return _objectSpread2(_objectSpread2({}, acc), {}, {
9889
9886
  [key]: value
9890
- };
9887
+ });
9891
9888
  }, {});
9892
9889
  };
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
- }) => {
9890
+ const handleDataLinkGroupWithTableKeys = _ref2 => {
9891
+ var _inputConfig$meta, _config$meta2, _inputConfig$meta3, _inputConfig$meta4, _inputConfig$meta5;
9892
+ let {
9893
+ config,
9894
+ inputConfig,
9895
+ inputKey,
9896
+ value,
9897
+ level,
9898
+ t,
9899
+ rootForm,
9900
+ allData,
9901
+ user,
9902
+ getApiBaseUrl = () => {},
9903
+ getAppHeader = () => {},
9904
+ app,
9905
+ TreeNodeComponent
9906
+ } = _ref2;
9908
9907
  if (!(config.type === 'dataLinkGroup' || config.type === 'dataLink')) {
9909
9908
  return null;
9910
9909
  }
9911
- if (inputConfig?.type !== 'dataLink' || !inputConfig?.meta?.tableKeys) {
9910
+ 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)) {
9912
9911
  const parentInputKeys = Object.keys(config.inputs || {});
9913
9912
  const isHandledBySiblingDataLink = parentInputKeys.some(otherInputKey => {
9914
9913
  const otherConfig = config.inputs[otherInputKey];
9915
- if (otherConfig?.type === 'dataLink') {
9916
- const siblingTableKeys = otherConfig?.meta?.tableKeys || [];
9917
- const additionalTableKeys = config.meta?.additionalTableKeys || [];
9914
+ if ((otherConfig === null || otherConfig === void 0 ? void 0 : otherConfig.type) === 'dataLink') {
9915
+ var _otherConfig$meta, _config$meta;
9916
+ const siblingTableKeys = (otherConfig === null || otherConfig === void 0 || (_otherConfig$meta = otherConfig.meta) === null || _otherConfig$meta === void 0 ? void 0 : _otherConfig$meta.tableKeys) || [];
9917
+ const additionalTableKeys = ((_config$meta = config.meta) === null || _config$meta === void 0 ? void 0 : _config$meta.additionalTableKeys) || [];
9918
9918
  const allSiblingKeys = [...siblingTableKeys, ...additionalTableKeys];
9919
9919
  return allSiblingKeys.includes(inputKey) && otherInputKey !== inputKey;
9920
9920
  }
@@ -9928,23 +9928,26 @@ const handleDataLinkGroupWithTableKeys = ({
9928
9928
  return null;
9929
9929
  }
9930
9930
  const tableKeys = inputConfig.meta.tableKeys;
9931
- const additionalTableKeys = config.meta?.additionalTableKeys || [];
9931
+ const additionalTableKeys = ((_config$meta2 = config.meta) === null || _config$meta2 === void 0 ? void 0 : _config$meta2.additionalTableKeys) || [];
9932
9932
  const parentInputKeys = Object.keys(config.inputs || {});
9933
9933
  const siblingInputsMatchingTableKeys = parentInputKeys.filter(siblingKey => siblingKey !== inputKey).filter(siblingKey => tableKeys.includes(siblingKey) || additionalTableKeys.includes(siblingKey));
9934
9934
  [...new Set([...tableKeys, ...siblingInputsMatchingTableKeys])];
9935
- const isAjaxModal = React.useMemo(() => !!inputConfig?.meta?.namespace, [inputConfig]);
9935
+ const isAjaxModal = React.useMemo(() => {
9936
+ var _inputConfig$meta2;
9937
+ return !!(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta2 = inputConfig.meta) !== null && _inputConfig$meta2 !== void 0 && _inputConfig$meta2.namespace);
9938
+ }, [inputConfig]);
9936
9939
  const ajaxModalValues = useAjaxModal$2({
9937
9940
  name: inputKey,
9938
9941
  user,
9939
- namespace: inputConfig?.meta?.namespace,
9940
- skipFetch: inputConfig?.meta?.skipFetch,
9942
+ namespace: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta3 = inputConfig.meta) === null || _inputConfig$meta3 === void 0 ? void 0 : _inputConfig$meta3.namespace,
9943
+ skipFetch: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta4 = inputConfig.meta) === null || _inputConfig$meta4 === void 0 ? void 0 : _inputConfig$meta4.skipFetch,
9941
9944
  isAjaxModal,
9942
- formScope: inputConfig?.meta?.formScope,
9945
+ formScope: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta5 = inputConfig.meta) === null || _inputConfig$meta5 === void 0 ? void 0 : _inputConfig$meta5.formScope,
9943
9946
  APP: app,
9944
9947
  apiBaseUrl: getApiBaseUrl(),
9945
9948
  _getAppHeader: getAppHeader
9946
9949
  });
9947
- const dataLinkForm = ajaxModalValues?.form;
9950
+ const dataLinkForm = ajaxModalValues === null || ajaxModalValues === void 0 ? void 0 : ajaxModalValues.form;
9948
9951
  const createInputsAndValues = item => {
9949
9952
  const inputs = {};
9950
9953
  const values = {};
@@ -9956,12 +9959,12 @@ const handleDataLinkGroupWithTableKeys = ({
9956
9959
  'videos': 'Video'
9957
9960
  };
9958
9961
  tableKeys.filter(tableKey => tableKey !== 'datastakeId').forEach(tableKey => {
9959
- const formInputConfig = dataLinkForm?.[tableKey] || dataLinkForm?.['identification']?.[tableKey];
9962
+ var _dataLinkForm$identif;
9963
+ 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]);
9960
9964
  if (formInputConfig) {
9961
- inputs[tableKey] = {
9962
- ...formInputConfig,
9965
+ inputs[tableKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
9963
9966
  label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : formInputConfig.label || formInputConfig.tableLabel || tableKey
9964
- };
9967
+ });
9965
9968
  if (formInputConfig.label && typeof formInputConfig.label === 'object') {
9966
9969
  const dynamicLabelKeys = Object.keys(formInputConfig.label);
9967
9970
  let resolvedLabel = null;
@@ -9969,7 +9972,7 @@ const handleDataLinkGroupWithTableKeys = ({
9969
9972
  const parts = labelKey.split(' is ');
9970
9973
  if (parts.length === 2) {
9971
9974
  const [conditionKey, conditionValue] = parts;
9972
- if (item?.[conditionKey] === conditionValue) {
9975
+ if ((item === null || item === void 0 ? void 0 : item[conditionKey]) === conditionValue) {
9973
9976
  resolvedLabel = formInputConfig.label[labelKey];
9974
9977
  break;
9975
9978
  }
@@ -9977,37 +9980,37 @@ const handleDataLinkGroupWithTableKeys = ({
9977
9980
  }
9978
9981
  inputs[tableKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey);
9979
9982
  }
9980
- values[tableKey] = item?.[tableKey];
9983
+ values[tableKey] = item === null || item === void 0 ? void 0 : item[tableKey];
9981
9984
  } else {
9985
+ var _item$linking;
9982
9986
  inputs[tableKey] = {
9983
9987
  label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey,
9984
- type: inputConfig?.type
9988
+ type: inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.type
9985
9989
  };
9986
- values[tableKey] = item?.linking?.SCL?.[item?.[tableKey]]?.name || item?.[tableKey];
9990
+ 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]);
9987
9991
  }
9988
9992
  });
9989
9993
  siblingInputsMatchingTableKeys.forEach(siblingKey => {
9990
9994
  const siblingConfig = config.inputs[siblingKey];
9991
9995
  if (siblingConfig) {
9992
- inputs[siblingKey] = {
9993
- ...siblingConfig,
9996
+ inputs[siblingKey] = _objectSpread2(_objectSpread2({}, siblingConfig), {}, {
9994
9997
  label: siblingConfig.label || siblingKey
9995
- };
9996
- values[siblingKey] = item?.[siblingKey];
9998
+ });
9999
+ values[siblingKey] = item === null || item === void 0 ? void 0 : item[siblingKey];
9997
10000
  }
9998
10001
  });
9999
- if (dataLinkForm?.identification && typeof dataLinkForm.identification === 'object') {
10002
+ if (dataLinkForm !== null && dataLinkForm !== void 0 && dataLinkForm.identification && typeof dataLinkForm.identification === 'object') {
10000
10003
  Object.keys(dataLinkForm.identification).filter(fieldKey => fieldKey !== 'datastakeId' && !tableKeys.includes(fieldKey)).filter(fieldKey => {
10001
10004
  const formInputConfig = dataLinkForm.identification[fieldKey];
10002
10005
  return formInputConfig && typeof formInputConfig === 'object' && !Array.isArray(formInputConfig);
10003
10006
  }).forEach(fieldKey => {
10007
+ var _item$linking2;
10004
10008
  const formInputConfig = dataLinkForm.identification[fieldKey];
10005
- inputs[fieldKey] = {
10006
- ...formInputConfig,
10009
+ inputs[fieldKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
10007
10010
  label: uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : formInputConfig.label || formInputConfig.tableLabel || fieldKey
10008
- };
10009
- if (formInputConfig?.label && typeof formInputConfig?.label === 'object') {
10010
- const dynamicLabelKeys = Object.keys(formInputConfig?.label);
10011
+ });
10012
+ if (formInputConfig !== null && formInputConfig !== void 0 && formInputConfig.label && typeof (formInputConfig === null || formInputConfig === void 0 ? void 0 : formInputConfig.label) === 'object') {
10013
+ const dynamicLabelKeys = Object.keys(formInputConfig === null || formInputConfig === void 0 ? void 0 : formInputConfig.label);
10011
10014
  let resolvedLabel = null;
10012
10015
  for (const labelKey of dynamicLabelKeys) {
10013
10016
  const parts = labelKey.split(' is ');
@@ -10016,7 +10019,7 @@ const handleDataLinkGroupWithTableKeys = ({
10016
10019
  const flattenedItem = Object.assign({}, item.location, {
10017
10020
  address: item.address
10018
10021
  });
10019
- if (flattenedItem?.[conditionKey] === conditionValue) {
10022
+ if ((flattenedItem === null || flattenedItem === void 0 ? void 0 : flattenedItem[conditionKey]) === conditionValue) {
10020
10023
  resolvedLabel = formInputConfig.label[labelKey];
10021
10024
  break;
10022
10025
  }
@@ -10024,7 +10027,7 @@ const handleDataLinkGroupWithTableKeys = ({
10024
10027
  }
10025
10028
  inputs[fieldKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : fieldKey);
10026
10029
  }
10027
- values[fieldKey] = item?.linking?.SCL?.[item?.[fieldKey]]?.name || item?.[fieldKey];
10030
+ 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]);
10028
10031
  });
10029
10032
  }
10030
10033
  return {
@@ -10034,16 +10037,17 @@ const handleDataLinkGroupWithTableKeys = ({
10034
10037
  };
10035
10038
  if (Array.isArray(value)) {
10036
10039
  return value.map((item, itemIndex) => {
10040
+ var _merged$inputKey;
10037
10041
  const merged = mergeObject(item);
10038
- const datastakeIdValue = merged?.[inputKey]?.datastakeId || merged?.datastakeId;
10042
+ 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);
10039
10043
  const {
10040
10044
  inputs,
10041
10045
  values
10042
10046
  } = createInputsAndValues(merged);
10043
10047
  return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
10044
- nodeKey: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
10048
+ nodeKey: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
10045
10049
  config: {
10046
- label: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
10050
+ label: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
10047
10051
  type: 'custom-datalink-group',
10048
10052
  inputs: inputs
10049
10053
  },
@@ -10057,11 +10061,12 @@ const handleDataLinkGroupWithTableKeys = ({
10057
10061
  getApiBaseUrl: getApiBaseUrl,
10058
10062
  getAppHeader: getAppHeader,
10059
10063
  app: app
10060
- }, `${inputKey}-${itemIndex}`);
10064
+ }, "".concat(inputKey, "-").concat(itemIndex));
10061
10065
  });
10062
10066
  } else {
10067
+ var _merged$inputKey2;
10063
10068
  const merged = mergeObject(value);
10064
- const datastakeIdValue = merged?.[inputKey]?.datastakeId || merged?.datastakeId;
10069
+ 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);
10065
10070
  const {
10066
10071
  inputs,
10067
10072
  values
@@ -10083,46 +10088,41 @@ const handleDataLinkGroupWithTableKeys = ({
10083
10088
  getApiBaseUrl: getApiBaseUrl,
10084
10089
  getAppHeader: getAppHeader,
10085
10090
  app: app
10086
- }, `${inputKey}-group`);
10091
+ }, "".concat(inputKey, "-group"));
10087
10092
  }
10088
10093
  };
10089
10094
 
10090
- const handleDataLinkWithTableKeys = _ref => {
10091
- var _inputConfig$meta, _inputConfig$meta3, _inputConfig$meta4, _inputConfig$meta5;
10092
- let {
10093
- inputConfig,
10094
- inputKey,
10095
- value,
10096
- level,
10097
- t,
10098
- rootForm,
10099
- allData,
10100
- user,
10101
- getApiBaseUrl = () => {},
10102
- getAppHeader = () => {},
10103
- app,
10104
- TreeNodeComponent
10105
- } = _ref;
10106
- 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)) {
10095
+ const handleDataLinkWithTableKeys = ({
10096
+ inputConfig,
10097
+ inputKey,
10098
+ value,
10099
+ level,
10100
+ t,
10101
+ rootForm,
10102
+ allData,
10103
+ user,
10104
+ getApiBaseUrl = () => {},
10105
+ getAppHeader = () => {},
10106
+ app,
10107
+ TreeNodeComponent
10108
+ }) => {
10109
+ if (inputConfig?.type !== 'dataLink' || !inputConfig?.meta?.tableKeys) {
10107
10110
  return null;
10108
10111
  }
10109
10112
  const tableKeys = inputConfig.meta.tableKeys;
10110
- const isAjaxModal = React.useMemo(() => {
10111
- var _inputConfig$meta2;
10112
- return !!(inputConfig !== null && inputConfig !== void 0 && (_inputConfig$meta2 = inputConfig.meta) !== null && _inputConfig$meta2 !== void 0 && _inputConfig$meta2.namespace);
10113
- }, [inputConfig]);
10113
+ const isAjaxModal = React.useMemo(() => !!inputConfig?.meta?.namespace, [inputConfig]);
10114
10114
  const ajaxModalValues = useAjaxModal$2({
10115
10115
  name: inputKey,
10116
10116
  user,
10117
- namespace: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta3 = inputConfig.meta) === null || _inputConfig$meta3 === void 0 ? void 0 : _inputConfig$meta3.namespace,
10118
- skipFetch: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta4 = inputConfig.meta) === null || _inputConfig$meta4 === void 0 ? void 0 : _inputConfig$meta4.skipFetch,
10117
+ namespace: inputConfig?.meta?.namespace,
10118
+ skipFetch: inputConfig?.meta?.skipFetch,
10119
10119
  isAjaxModal,
10120
- formScope: inputConfig === null || inputConfig === void 0 || (_inputConfig$meta5 = inputConfig.meta) === null || _inputConfig$meta5 === void 0 ? void 0 : _inputConfig$meta5.formScope,
10120
+ formScope: inputConfig?.meta?.formScope,
10121
10121
  APP: app,
10122
10122
  apiBaseUrl: getApiBaseUrl(),
10123
10123
  _getAppHeader: getAppHeader
10124
10124
  });
10125
- const dataLinkForm = ajaxModalValues === null || ajaxModalValues === void 0 ? void 0 : ajaxModalValues.form;
10125
+ const dataLinkForm = ajaxModalValues?.form;
10126
10126
  const createInputsAndValues = item => {
10127
10127
  const inputs = {};
10128
10128
  const values = {};
@@ -10135,20 +10135,19 @@ const handleDataLinkWithTableKeys = _ref => {
10135
10135
  };
10136
10136
  const isUploadFieldEmpty = (fieldKey, itemToCheck) => {
10137
10137
  if (uploadTypeFields.includes(fieldKey)) {
10138
- const itemValue = itemToCheck === null || itemToCheck === void 0 ? void 0 : itemToCheck[fieldKey];
10138
+ const itemValue = itemToCheck?.[fieldKey];
10139
10139
  return itemValue === undefined || itemValue === null || Array.isArray(itemValue) && itemValue.length === 0;
10140
10140
  }
10141
10141
  return false;
10142
10142
  };
10143
10143
  const processedTableKeys = processConditionalTableKeys(tableKeys, item);
10144
10144
  processedTableKeys.filter(tableKey => tableKey !== 'datastakeId').filter(tableKey => !isUploadFieldEmpty(tableKey, item)).forEach(tableKey => {
10145
- var _dataLinkForm$identif;
10146
- 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]);
10145
+ const formInputConfig = dataLinkForm?.[tableKey] || dataLinkForm?.['identification']?.[tableKey];
10147
10146
  if (formInputConfig) {
10148
- var _item$linking, _formInputConfig$meta, _formInputConfig$tabl;
10149
- inputs[tableKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
10147
+ inputs[tableKey] = {
10148
+ ...formInputConfig,
10150
10149
  label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : formInputConfig.label || formInputConfig.tableLabel || tableKey
10151
- });
10150
+ };
10152
10151
  if (formInputConfig.label && typeof formInputConfig.label === 'object') {
10153
10152
  const dynamicLabelKeys = Object.keys(formInputConfig.label);
10154
10153
  let resolvedLabel = null;
@@ -10156,7 +10155,7 @@ const handleDataLinkWithTableKeys = _ref => {
10156
10155
  const parts = labelKey.split(' is ');
10157
10156
  if (parts.length === 2) {
10158
10157
  const [conditionKey, conditionValue] = parts;
10159
- if ((item === null || item === void 0 ? void 0 : item[conditionKey]) === conditionValue) {
10158
+ if (item?.[conditionKey] === conditionValue) {
10160
10159
  resolvedLabel = formInputConfig.label[labelKey];
10161
10160
  break;
10162
10161
  }
@@ -10164,17 +10163,16 @@ const handleDataLinkWithTableKeys = _ref => {
10164
10163
  }
10165
10164
  inputs[tableKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey);
10166
10165
  }
10167
- 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[formInputConfig === null || formInputConfig === void 0 || (_formInputConfig$meta = formInputConfig.meta) === null || _formInputConfig$meta === void 0 ? void 0 : _formInputConfig$meta.onNewSetValueKey] || (item === null || item === void 0 ? void 0 : item[formInputConfig === null || formInputConfig === void 0 || (_formInputConfig$tabl = formInputConfig.tableLabel) === null || _formInputConfig$tabl === void 0 ? void 0 : _formInputConfig$tabl.toLowerCase()]) || (item === null || item === void 0 ? void 0 : item[tableKey]);
10166
+ values[tableKey] = item?.linking?.SCL?.[item?.[tableKey]]?.name || item[formInputConfig?.meta?.onNewSetValueKey] || item?.[formInputConfig?.tableLabel?.toLowerCase()] || item?.[tableKey];
10168
10167
  } else {
10169
- var _item$linking2;
10170
10168
  inputs[tableKey] = {
10171
10169
  label: uploadTypeFields.includes(tableKey) ? uploadTypeLabels[tableKey] : tableKey,
10172
- type: inputConfig === null || inputConfig === void 0 ? void 0 : inputConfig.type
10170
+ type: inputConfig?.type
10173
10171
  };
10174
- values[tableKey] = (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[tableKey]]) === null || _item$linking2 === void 0 ? void 0 : _item$linking2.name) || (item === null || item === void 0 ? void 0 : item[tableKey]);
10172
+ values[tableKey] = item?.linking?.SCL?.[item?.[tableKey]]?.name || item?.[tableKey];
10175
10173
  }
10176
10174
  });
10177
- if (dataLinkForm !== null && dataLinkForm !== void 0 && dataLinkForm.identification && typeof dataLinkForm.identification === 'object') {
10175
+ if (dataLinkForm?.identification && typeof dataLinkForm.identification === 'object') {
10178
10176
  Object.keys(dataLinkForm.identification).filter(fieldKey => {
10179
10177
  if (uploadTypeFields.includes(fieldKey)) {
10180
10178
  return !isUploadFieldEmpty(fieldKey, item);
@@ -10184,11 +10182,11 @@ const handleDataLinkWithTableKeys = _ref => {
10184
10182
  const formInputConfig = dataLinkForm.identification[fieldKey];
10185
10183
  return formInputConfig && typeof formInputConfig === 'object' && !Array.isArray(formInputConfig);
10186
10184
  }).forEach(fieldKey => {
10187
- var _item$linking3, _formInputConfig$tabl2;
10188
10185
  const formInputConfig = dataLinkForm.identification[fieldKey];
10189
- inputs[fieldKey] = _objectSpread2(_objectSpread2({}, formInputConfig), {}, {
10186
+ inputs[fieldKey] = {
10187
+ ...formInputConfig,
10190
10188
  label: uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : formInputConfig.label || formInputConfig.tableLabel || fieldKey
10191
- });
10189
+ };
10192
10190
  if (formInputConfig.label && typeof formInputConfig.label === 'object') {
10193
10191
  const dynamicLabelKeys = Object.keys(formInputConfig.label);
10194
10192
  let resolvedLabel = null;
@@ -10196,7 +10194,7 @@ const handleDataLinkWithTableKeys = _ref => {
10196
10194
  const parts = labelKey.split(' is ');
10197
10195
  if (parts.length === 2) {
10198
10196
  const [conditionKey, conditionValue] = parts;
10199
- if ((item === null || item === void 0 ? void 0 : item[conditionKey]) === conditionValue) {
10197
+ if (item?.[conditionKey] === conditionValue) {
10200
10198
  resolvedLabel = formInputConfig.label[labelKey];
10201
10199
  break;
10202
10200
  }
@@ -10204,7 +10202,7 @@ const handleDataLinkWithTableKeys = _ref => {
10204
10202
  }
10205
10203
  inputs[fieldKey].label = resolvedLabel || Object.values(formInputConfig.label)[0] || (uploadTypeFields.includes(fieldKey) ? uploadTypeLabels[fieldKey] : fieldKey);
10206
10204
  }
10207
- values[fieldKey] = (item === null || item === void 0 || (_item$linking3 = item.linking) === null || _item$linking3 === void 0 || (_item$linking3 = _item$linking3.SCL) === null || _item$linking3 === void 0 || (_item$linking3 = _item$linking3[item === null || item === void 0 ? void 0 : item[fieldKey]]) === null || _item$linking3 === void 0 ? void 0 : _item$linking3.name) || (item === null || item === void 0 ? void 0 : item[formInputConfig === null || formInputConfig === void 0 || (_formInputConfig$tabl2 = formInputConfig.tableLabel) === null || _formInputConfig$tabl2 === void 0 ? void 0 : _formInputConfig$tabl2.toLowerCase()]) || (item === null || item === void 0 ? void 0 : item[fieldKey]);
10205
+ values[fieldKey] = item?.linking?.SCL?.[item?.[fieldKey]]?.name || item?.[formInputConfig?.tableLabel?.toLowerCase()] || item?.[fieldKey];
10208
10206
  });
10209
10207
  }
10210
10208
  return {
@@ -10214,7 +10212,7 @@ const handleDataLinkWithTableKeys = _ref => {
10214
10212
  };
10215
10213
  if (Array.isArray(value)) {
10216
10214
  return value.map((item, itemIndex) => {
10217
- const datastakeIdValue = item === null || item === void 0 ? void 0 : item.datastakeId;
10215
+ const datastakeIdValue = item?.datastakeId;
10218
10216
  const {
10219
10217
  inputs,
10220
10218
  values
@@ -10223,9 +10221,9 @@ const handleDataLinkWithTableKeys = _ref => {
10223
10221
  return null;
10224
10222
  }
10225
10223
  return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
10226
- nodeKey: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
10224
+ nodeKey: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
10227
10225
  config: {
10228
- label: datastakeIdValue || t("No ID ".concat(itemIndex + 1)),
10226
+ label: datastakeIdValue || t(`No ID ${itemIndex + 1}`),
10229
10227
  type: 'custom-datalink',
10230
10228
  inputs: inputs
10231
10229
  },
@@ -10239,10 +10237,10 @@ const handleDataLinkWithTableKeys = _ref => {
10239
10237
  getApiBaseUrl: getApiBaseUrl,
10240
10238
  getAppHeader: getAppHeader,
10241
10239
  app: app
10242
- }, "".concat(inputKey, "-").concat(itemIndex));
10240
+ }, `${inputKey}-${itemIndex}`);
10243
10241
  });
10244
10242
  } else {
10245
- const datastakeIdValue = value === null || value === void 0 ? void 0 : value.datastakeId;
10243
+ const datastakeIdValue = value?.datastakeId;
10246
10244
  const {
10247
10245
  inputs,
10248
10246
  values
@@ -10267,7 +10265,7 @@ const handleDataLinkWithTableKeys = _ref => {
10267
10265
  getApiBaseUrl: getApiBaseUrl,
10268
10266
  getAppHeader: getAppHeader,
10269
10267
  app: app
10270
- }, "".concat(inputKey, "-single"));
10268
+ }, `${inputKey}-single`);
10271
10269
  }
10272
10270
  };
10273
10271
 
@@ -30403,7 +30401,6 @@ const EditForm$1 = _ref => {
30403
30401
  }), changeLinking, changeInputMeta, t, highlightMandatory)
30404
30402
  }, i);
30405
30403
  } else {
30406
- var _input$meta16;
30407
30404
  const inputId = input.dataId || k;
30408
30405
  const value = values[inputId];
30409
30406
  const commentValue = (inputsMeta[k] || {}).comment;
@@ -30417,7 +30414,7 @@ const EditForm$1 = _ref => {
30417
30414
  children: [getFormTitles$1(formTitles, inputData.name, i), /*#__PURE__*/jsxRuntime.jsx(GetFormItem$1, {
30418
30415
  inputKey: k,
30419
30416
  inputData: inputData,
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,
30417
+ inputId: inputId,
30421
30418
  input: input,
30422
30419
  highlightMandatory: highlightMandatory,
30423
30420
  changeInputMeta: changeInputMeta,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.757",
3
+ "version": "0.6.758",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -534,7 +534,7 @@ export const EditForm = ({
534
534
  <GetFormItem
535
535
  inputKey={k}
536
536
  inputData={inputData}
537
- inputId={input?.type === "dataLink" ? (input?.meta?.path || inputId) : inputId}
537
+ inputId={inputId}
538
538
  input={input}
539
539
  highlightMandatory={highlightMandatory}
540
540
  changeInputMeta={changeInputMeta}