datastake-daf 0.6.104 → 0.6.105

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.
@@ -13147,7 +13147,7 @@ PdfView.propTypes = {
13147
13147
  documentId: PropTypes__default["default"].string
13148
13148
  };
13149
13149
 
13150
- const ajaxSelectFieldData = async (value, config, getApiBaseUrl = () => {}, getAppHeader = () => {}, app) => {
13150
+ const ajaxSelectFieldData = async (value, config, getApiBaseUrl = () => {}, getAppHeader = () => {}, app, formValues = {}) => {
13151
13151
  const url = getApiBaseUrl();
13152
13152
  const queryOptionsApps = ["kota", "nashiriki", "straatos"];
13153
13153
  const queryOptionsAppEndpoints = {
@@ -13165,7 +13165,15 @@ const ajaxSelectFieldData = async (value, config, getApiBaseUrl = () => {}, getA
13165
13165
  const filtersMatch = methodWithFilters.match(/\((.*)\)/s);
13166
13166
  if (filtersMatch && filtersMatch[1]) {
13167
13167
  try {
13168
- filters = JSON.parse(filtersMatch[1]);
13168
+ const parsedFilters = JSON.parse(filtersMatch[1]);
13169
+ filters = {};
13170
+ Object.keys(parsedFilters).forEach(filterKey => {
13171
+ const fieldName = parsedFilters[filterKey];
13172
+ const formValue = formValues[fieldName];
13173
+ if (formValue !== undefined && formValue !== null && formValue !== '' && formValue !== fieldName) {
13174
+ filters[filterKey] = formValue;
13175
+ }
13176
+ });
13169
13177
  } catch (error) {
13170
13178
  console.error('Error parsing filters:', error);
13171
13179
  filters = {};
@@ -13203,13 +13211,14 @@ const AjaxSelectRenderer = ({
13203
13211
  config,
13204
13212
  getApiBaseUrl = () => {},
13205
13213
  getAppHeader = () => {},
13206
- app
13214
+ app,
13215
+ formValues = {}
13207
13216
  }) => {
13208
13217
  const [displayValue, setDisplayValue] = React.useState('Loading...');
13209
13218
  React.useEffect(() => {
13210
13219
  const fetchData = async () => {
13211
13220
  try {
13212
- const data = await ajaxSelectFieldData(value, config, getApiBaseUrl, getAppHeader, app);
13221
+ const data = await ajaxSelectFieldData(value, config, getApiBaseUrl, getAppHeader, app, formValues);
13213
13222
  if (Array.isArray(data) && data.length > 0) {
13214
13223
  const option = findOptions(value, data);
13215
13224
  setDisplayValue(option || value || 'Unknown');
@@ -13226,7 +13235,7 @@ const AjaxSelectRenderer = ({
13226
13235
  } else {
13227
13236
  setDisplayValue(value || 'No configuration');
13228
13237
  }
13229
- }, [value, config, getApiBaseUrl]);
13238
+ }, [value, config, getApiBaseUrl, formValues]);
13230
13239
  return /*#__PURE__*/jsxRuntime.jsx("span", {
13231
13240
  children: displayValue
13232
13241
  });
@@ -13531,7 +13540,7 @@ const processConditionalTableKeys = (tableKeys, item) => {
13531
13540
  });
13532
13541
  return processedKeys;
13533
13542
  };
13534
- const renderFieldData = (type, value, user, config, getApiBaseUrl = () => {}, getAppHeader = () => {}, app, allValues) => {
13543
+ const renderFieldData = (type, value, user, config, getApiBaseUrl = () => {}, getAppHeader = () => {}, app, allValues, formValues = {}) => {
13535
13544
  switch (type) {
13536
13545
  case 'year':
13537
13546
  return value !== '-' ? renderDateFormatted(value, 'YYYY', 'en') : '-';
@@ -13559,7 +13568,8 @@ const renderFieldData = (type, value, user, config, getApiBaseUrl = () => {}, ge
13559
13568
  config: config,
13560
13569
  getApiBaseUrl: getApiBaseUrl,
13561
13570
  getAppHeader: getAppHeader,
13562
- app: app
13571
+ app: app,
13572
+ formValues: formValues
13563
13573
  });
13564
13574
  case 'percentage':
13565
13575
  return `${value} %`;
@@ -13591,7 +13601,8 @@ const renderValue = ({
13591
13601
  user,
13592
13602
  getApiBaseUrl = () => {},
13593
13603
  getAppHeader = () => {},
13594
- app
13604
+ app,
13605
+ allData = {}
13595
13606
  }) => {
13596
13607
  if (config?.type === 'groupInputs') {
13597
13608
  if (!config?.inputs) return null;
@@ -13616,6 +13627,9 @@ const renderValue = ({
13616
13627
  return String(inputValue);
13617
13628
  }
13618
13629
  }).filter(val => val !== '');
13630
+ console.log({
13631
+ allData
13632
+ });
13619
13633
  const combinedValue = values.join(' ');
13620
13634
  return combinedValue ? /*#__PURE__*/jsxRuntime.jsx("span", {
13621
13635
  className: "tree-value groupInputs-type",
@@ -13647,7 +13661,7 @@ const renderValue = ({
13647
13661
  if (displayValue === '-') {
13648
13662
  cssClass += ' empty';
13649
13663
  }
13650
- displayValue = renderFieldData(fieldType, displayValue, user, config, getApiBaseUrl, getAppHeader, app, value);
13664
+ displayValue = renderFieldData(fieldType, displayValue, user, config, getApiBaseUrl, getAppHeader, app, value, allData);
13651
13665
  return /*#__PURE__*/jsxRuntime.jsx("span", {
13652
13666
  className: cssClass,
13653
13667
  children: displayValue
@@ -14517,15 +14531,9 @@ const TreeNode = _ref => {
14517
14531
  user,
14518
14532
  getApiBaseUrl,
14519
14533
  getAppHeader,
14520
- app
14534
+ app,
14535
+ allData
14521
14536
  });
14522
- if (nodeKey === 'keyIncidents') {
14523
- console.log({
14524
- config,
14525
- value,
14526
- hasChildren
14527
- });
14528
- }
14529
14537
  const renderChildren = () => {
14530
14538
  if (!hasChildren) return null;
14531
14539
  let children = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.104",
3
+ "version": "0.6.105",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -28,10 +28,7 @@ const TreeNode = ({ nodeKey, config, value, level = 0, isLast = false, t, rootFo
28
28
  const label = resolveDynamicLabel(config?.label, allData || value, nodeKey);
29
29
  const nodeType = config?.type || 'field';
30
30
 
31
- let renderNodeValue = () => renderValue({ value, hasChildren: originalHasChildren, config, user, getApiBaseUrl, getAppHeader, app });
32
- if(nodeKey === 'keyIncidents') {
33
- console.log({config, value, hasChildren})
34
- }
31
+ let renderNodeValue = () => renderValue({ value, hasChildren: originalHasChildren, config, user, getApiBaseUrl, getAppHeader, app, allData });
35
32
 
36
33
  const renderChildren = () => {
37
34
  if (!hasChildren) return null;