datastake-daf 0.6.761 → 0.6.762

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.
@@ -9511,29 +9511,24 @@ const processConditionalTableKeys = (tableKeys, item) => {
9511
9511
  });
9512
9512
  return processedKeys;
9513
9513
  };
9514
- const renderFieldData = function (type, value, user, config) {
9515
- let getApiBaseUrl = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : () => {};
9516
- let getAppHeader = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : () => {};
9517
- let app = arguments.length > 6 ? arguments[6] : undefined;
9518
- let allValues = arguments.length > 7 ? arguments[7] : undefined;
9519
- let formValues = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : {};
9514
+ const renderFieldData = (type, value, user, config, getApiBaseUrl = () => {}, getAppHeader = () => {}, app, allValues, formValues = {}) => {
9520
9515
  switch (type) {
9521
9516
  case 'year':
9522
9517
  return value !== '-' ? renderDateFormatted(value, 'YYYY', 'en') : '-';
9523
9518
  case 'date':
9524
9519
  {
9525
- const language = user !== null && user !== void 0 && user.language && (user === null || user === void 0 ? void 0 : user.language) === 'sp' ? 'es' : user === null || user === void 0 ? void 0 : user.language;
9520
+ const language = user?.language && user?.language === 'sp' ? 'es' : user?.language;
9526
9521
  return value !== '-' ? renderDateFormatted(value, 'DD MMM YYYY', language || 'en') : '-';
9527
9522
  }
9528
9523
  case 'select':
9529
9524
  {
9530
- const options = (config === null || config === void 0 ? void 0 : config.options) || [];
9525
+ const options = config?.options || [];
9531
9526
  const option = findOptions(value, options);
9532
9527
  return option;
9533
9528
  }
9534
9529
  case 'multiselect':
9535
9530
  {
9536
- const options = (config === null || config === void 0 ? void 0 : config.options) || [];
9531
+ const options = config?.options || [];
9537
9532
  const _val = typeof value === 'string' ? value.split(',').map(v => v.trim()) : value;
9538
9533
  const option = findOptions(_val, options);
9539
9534
  return option.join(', ');
@@ -9548,7 +9543,7 @@ const renderFieldData = function (type, value, user, config) {
9548
9543
  formValues: formValues
9549
9544
  });
9550
9545
  case 'percentage':
9551
- return value === '-' || value === null || value === undefined ? '-' : "".concat(value, " %");
9546
+ return value === '-' || value === null || value === undefined ? '-' : `${value} %`;
9552
9547
  case 'geolocation':
9553
9548
  {
9554
9549
  const val = JSON.parse(value) || {};
@@ -9562,7 +9557,7 @@ const renderFieldData = function (type, value, user, config) {
9562
9557
  case 'upload':
9563
9558
  case 'videoUpload':
9564
9559
  {
9565
- const documentName = allValues === null || allValues === void 0 ? void 0 : allValues.map(item => item === null || item === void 0 ? void 0 : item.name).join(', ');
9560
+ const documentName = allValues?.map(item => item?.name).join(', ');
9566
9561
  return documentName;
9567
9562
  }
9568
9563
  default:
@@ -9570,27 +9565,25 @@ const renderFieldData = function (type, value, user, config) {
9570
9565
  }
9571
9566
  };
9572
9567
 
9573
- const renderValue = _ref => {
9574
- let {
9575
- value,
9576
- hasChildren,
9577
- config,
9578
- user,
9579
- getApiBaseUrl = () => {},
9580
- getAppHeader = () => {},
9581
- app,
9582
- allData = {}
9583
- } = _ref;
9584
- if ((config === null || config === void 0 ? void 0 : config.type) === 'groupInputs') {
9585
- if (!(config !== null && config !== void 0 && config.inputs)) return null;
9568
+ const renderValue = ({
9569
+ value,
9570
+ hasChildren,
9571
+ config,
9572
+ user,
9573
+ getApiBaseUrl = () => {},
9574
+ getAppHeader = () => {},
9575
+ app,
9576
+ allData = {}
9577
+ }) => {
9578
+ if (config?.type === 'groupInputs') {
9579
+ if (!config?.inputs) return null;
9586
9580
  const inputKeys = Object.keys(config.inputs).sort((a, b) => {
9587
- var _config$inputs$a, _config$inputs$b;
9588
- const positionA = ((_config$inputs$a = config.inputs[a]) === null || _config$inputs$a === void 0 ? void 0 : _config$inputs$a.position) || 0;
9589
- const positionB = ((_config$inputs$b = config.inputs[b]) === null || _config$inputs$b === void 0 ? void 0 : _config$inputs$b.position) || 0;
9581
+ const positionA = config.inputs[a]?.position || 0;
9582
+ const positionB = config.inputs[b]?.position || 0;
9590
9583
  return positionA - positionB;
9591
9584
  });
9592
9585
  const values = inputKeys.map(inputKey => {
9593
- let inputValue = value === null || value === void 0 ? void 0 : value[inputKey];
9586
+ let inputValue = value?.[inputKey];
9594
9587
  if (inputValue === null || inputValue === undefined || inputValue === '') {
9595
9588
  return '';
9596
9589
  } else if (typeof inputValue === 'object' && inputValue !== null) {
@@ -9631,8 +9624,8 @@ const renderValue = _ref => {
9631
9624
  } else {
9632
9625
  displayValue = String(value);
9633
9626
  }
9634
- const fieldType = (config === null || config === void 0 ? void 0 : config.type) || 'text';
9635
- let cssClass = "tree-value ".concat(fieldType, "-type");
9627
+ const fieldType = config?.type || 'text';
9628
+ let cssClass = `tree-value ${fieldType}-type`;
9636
9629
  if (displayValue === '-') {
9637
9630
  cssClass += ' empty';
9638
9631
  }
@@ -9642,21 +9635,19 @@ const renderValue = _ref => {
9642
9635
  children: displayValue
9643
9636
  });
9644
9637
  };
9645
- const determineHasChildren = _ref2 => {
9646
- var _config$meta;
9647
- let {
9648
- config,
9649
- level
9650
- } = _ref2;
9651
- if ((config === null || config === void 0 ? void 0 : config.type) === 'groupInputs') {
9638
+ const determineHasChildren = ({
9639
+ config,
9640
+ level
9641
+ }) => {
9642
+ if (config?.type === 'groupInputs') {
9652
9643
  return false;
9653
9644
  }
9654
- if ((config === null || config === void 0 ? void 0 : config.type) === 'header' && config !== null && config !== void 0 && config.inputs && Object.keys(config.inputs).length > 0) {
9645
+ if (config?.type === 'header' && config?.inputs && Object.keys(config.inputs).length > 0) {
9655
9646
  return true;
9656
9647
  }
9657
- return (config === null || config === void 0 ? void 0 : config.inputs) || (config === null || config === void 0 ? void 0 : config.type) === 'group' || (config === null || config === void 0 ? void 0 : config.type) === 'dataLinkGroup' || (config === null || config === void 0 ? void 0 : config.type) === 'section' || (config === null || config === void 0 ? void 0 : config.type) === 'ajaxSubGroup' ||
9648
+ return config?.inputs || config?.type === 'group' || config?.type === 'dataLinkGroup' || config?.type === 'section' || config?.type === 'ajaxSubGroup' ||
9658
9649
  // Add this line
9659
- (config === null || config === void 0 ? void 0 : config.type) === 'dataLink' && (config === null || config === void 0 || (_config$meta = config.meta) === null || _config$meta === void 0 ? void 0 : _config$meta.tableKeys) || level === 0 && config && typeof config === 'object' && Object.keys(config).some(key => key !== 'id' && key !== 'label' && key !== 'position' && key !== 'subTitle' && typeof config[key] === 'object' && config[key] !== null);
9650
+ config?.type === 'dataLink' && config?.meta?.tableKeys || level === 0 && config && typeof config === 'object' && Object.keys(config).some(key => key !== 'id' && key !== 'label' && key !== 'position' && key !== 'subTitle' && typeof config[key] === 'object' && config[key] !== null);
9660
9651
  };
9661
9652
 
9662
9653
  const sortByPosition = (items, getConfig) => {
@@ -10322,20 +10313,21 @@ const handleDataLinkWithTableKeys = ({
10322
10313
  }
10323
10314
  };
10324
10315
 
10325
- const handleGroupChildren = ({
10326
- config,
10327
- value,
10328
- allData,
10329
- level,
10330
- t,
10331
- rootForm,
10332
- user,
10333
- getApiBaseUrl = () => {},
10334
- getAppHeader = () => {},
10335
- app,
10336
- TreeNodeComponent
10337
- }) => {
10338
- if (!config?.inputs) {
10316
+ const handleGroupChildren = _ref => {
10317
+ let {
10318
+ config,
10319
+ value,
10320
+ allData,
10321
+ level,
10322
+ t,
10323
+ rootForm,
10324
+ user,
10325
+ getApiBaseUrl = () => {},
10326
+ getAppHeader = () => {},
10327
+ app,
10328
+ TreeNodeComponent
10329
+ } = _ref;
10330
+ if (!(config !== null && config !== void 0 && config.inputs)) {
10339
10331
  return null;
10340
10332
  }
10341
10333
  const inputKeys = Object.keys(config.inputs);
@@ -10348,7 +10340,7 @@ const handleGroupChildren = ({
10348
10340
  if (value && typeof value === 'object' && value[inputKey]) {
10349
10341
  inputValue = value[inputKey];
10350
10342
  } else {
10351
- inputValue = allData?.[inputKey];
10343
+ inputValue = allData === null || allData === void 0 ? void 0 : allData[inputKey];
10352
10344
  }
10353
10345
  return /*#__PURE__*/jsxRuntime.jsx(TreeNodeComponent, {
10354
10346
  nodeKey: inputKey,
@@ -10498,12 +10490,11 @@ const AjaxSubGroup$2 = ({
10498
10490
  };
10499
10491
 
10500
10492
  const handleAjaxSubGroupChildren = props => {
10501
- if (props.config?.type !== 'ajaxSubGroup' || !Array.isArray(props.value)) {
10493
+ var _props$config;
10494
+ if (((_props$config = props.config) === null || _props$config === void 0 ? void 0 : _props$config.type) !== 'ajaxSubGroup' || !Array.isArray(props.value)) {
10502
10495
  return null;
10503
10496
  }
10504
- return [/*#__PURE__*/jsxRuntime.jsx(AjaxSubGroup$2, {
10505
- ...props
10506
- }, "ajax-subgroup")];
10497
+ return [/*#__PURE__*/jsxRuntime.jsx(AjaxSubGroup$2, _objectSpread2({}, props), "ajax-subgroup")];
10507
10498
  };
10508
10499
 
10509
10500
  const TreeNode = _ref => {
@@ -13244,7 +13244,7 @@ const getActionWidgetsConfig = ({
13244
13244
  t
13245
13245
  }) => [{
13246
13246
  icon: "MineSite",
13247
- title: t("nashiriki::create-mine-site"),
13247
+ title: t("Create Mine Site"),
13248
13248
  onClick: () => goTo(getRedirectLink("/app/production-sites?create=true"))
13249
13249
  }, {
13250
13250
  icon: "FileEdit",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datastake-daf",
3
- "version": "0.6.761",
3
+ "version": "0.6.762",
4
4
  "dependencies": {
5
5
  "@ant-design/icons": "^5.2.5",
6
6
  "@antv/g2": "^5.1.1",
@@ -1,7 +1,7 @@
1
1
  export const getActionWidgetsConfig = ({ goTo, getRedirectLink, APP, t }) => [
2
2
  {
3
3
  icon: "MineSite",
4
- title: t("nashiriki::create-mine-site"),
4
+ title: t("Create Mine Site"),
5
5
  onClick: () => goTo(getRedirectLink("/app/production-sites?create=true")),
6
6
  },
7
7
  {