datastake-daf 0.6.796 → 0.6.798
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.
- package/dist/components/index.js +50 -33
- package/dist/pages/index.js +10423 -1430
- package/dist/utils/index.js +58 -3
- package/package.json +1 -1
- package/src/@daf/core/components/EditForm/sections.jsx +18 -8
- package/src/@daf/pages/Edit/hooks/usePrepareForm.js +178 -0
- package/src/@daf/pages/Edit/index.jsx +356 -0
- package/src/@daf/pages/View/hooks/useViewUrlParams.js +23 -1
- package/src/@daf/pages/View/index.jsx +1 -0
- package/src/@daf/utils/arrays.js +1 -0
- package/src/@daf/utils/numbers.js +1 -1
- package/src/helpers/Forms.js +60 -0
- package/src/pages.js +4 -1
- package/src/utils.js +4 -2
- package/dist/style/datastake/mapbox-gl.css +0 -330
package/dist/components/index.js
CHANGED
|
@@ -9615,25 +9615,27 @@ const renderFieldData = (type, value, user, config, getApiBaseUrl = () => {}, ge
|
|
|
9615
9615
|
}
|
|
9616
9616
|
};
|
|
9617
9617
|
|
|
9618
|
-
const renderValue =
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
|
|
9625
|
-
|
|
9626
|
-
|
|
9627
|
-
|
|
9628
|
-
|
|
9629
|
-
|
|
9618
|
+
const renderValue = _ref => {
|
|
9619
|
+
let {
|
|
9620
|
+
value,
|
|
9621
|
+
hasChildren,
|
|
9622
|
+
config,
|
|
9623
|
+
user,
|
|
9624
|
+
getApiBaseUrl = () => {},
|
|
9625
|
+
getAppHeader = () => {},
|
|
9626
|
+
app,
|
|
9627
|
+
allData = {}
|
|
9628
|
+
} = _ref;
|
|
9629
|
+
if ((config === null || config === void 0 ? void 0 : config.type) === 'groupInputs') {
|
|
9630
|
+
if (!(config !== null && config !== void 0 && config.inputs)) return null;
|
|
9630
9631
|
const inputKeys = Object.keys(config.inputs).sort((a, b) => {
|
|
9631
|
-
|
|
9632
|
-
const
|
|
9632
|
+
var _config$inputs$a, _config$inputs$b;
|
|
9633
|
+
const positionA = ((_config$inputs$a = config.inputs[a]) === null || _config$inputs$a === void 0 ? void 0 : _config$inputs$a.position) || 0;
|
|
9634
|
+
const positionB = ((_config$inputs$b = config.inputs[b]) === null || _config$inputs$b === void 0 ? void 0 : _config$inputs$b.position) || 0;
|
|
9633
9635
|
return positionA - positionB;
|
|
9634
9636
|
});
|
|
9635
9637
|
const values = inputKeys.map(inputKey => {
|
|
9636
|
-
let inputValue = value
|
|
9638
|
+
let inputValue = value === null || value === void 0 ? void 0 : value[inputKey];
|
|
9637
9639
|
if (inputValue === null || inputValue === undefined || inputValue === '') {
|
|
9638
9640
|
return '';
|
|
9639
9641
|
} else if (typeof inputValue === 'object' && inputValue !== null) {
|
|
@@ -9674,8 +9676,8 @@ const renderValue = ({
|
|
|
9674
9676
|
} else {
|
|
9675
9677
|
displayValue = String(value);
|
|
9676
9678
|
}
|
|
9677
|
-
const fieldType = config
|
|
9678
|
-
let cssClass =
|
|
9679
|
+
const fieldType = (config === null || config === void 0 ? void 0 : config.type) || 'text';
|
|
9680
|
+
let cssClass = "tree-value ".concat(fieldType, "-type");
|
|
9679
9681
|
if (displayValue === '-') {
|
|
9680
9682
|
cssClass += ' empty';
|
|
9681
9683
|
}
|
|
@@ -9685,19 +9687,21 @@ const renderValue = ({
|
|
|
9685
9687
|
children: displayValue
|
|
9686
9688
|
});
|
|
9687
9689
|
};
|
|
9688
|
-
const determineHasChildren =
|
|
9689
|
-
|
|
9690
|
-
|
|
9691
|
-
|
|
9692
|
-
|
|
9690
|
+
const determineHasChildren = _ref2 => {
|
|
9691
|
+
var _config$meta;
|
|
9692
|
+
let {
|
|
9693
|
+
config,
|
|
9694
|
+
level
|
|
9695
|
+
} = _ref2;
|
|
9696
|
+
if ((config === null || config === void 0 ? void 0 : config.type) === 'groupInputs') {
|
|
9693
9697
|
return false;
|
|
9694
9698
|
}
|
|
9695
|
-
if (config
|
|
9699
|
+
if ((config === null || config === void 0 ? void 0 : config.type) === 'header' && config !== null && config !== void 0 && config.inputs && Object.keys(config.inputs).length > 0) {
|
|
9696
9700
|
return true;
|
|
9697
9701
|
}
|
|
9698
|
-
return config
|
|
9702
|
+
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' ||
|
|
9699
9703
|
// Add this line
|
|
9700
|
-
config
|
|
9704
|
+
(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);
|
|
9701
9705
|
};
|
|
9702
9706
|
|
|
9703
9707
|
const sortByPosition = (items, getConfig) => {
|
|
@@ -29368,10 +29372,20 @@ const Sections = _ref2 => {
|
|
|
29368
29372
|
const [openKeys, setOpenKeys] = React.useState([]);
|
|
29369
29373
|
const [formGroups, setFormGroups] = React.useState([]);
|
|
29370
29374
|
const [selectedGroup, setSelectedGroup] = React.useState(null);
|
|
29375
|
+
const formConfigToUse = React.useMemo(() => {
|
|
29376
|
+
var _Object$keys;
|
|
29377
|
+
if (Array.isArray(formConf)) {
|
|
29378
|
+
return formConf;
|
|
29379
|
+
}
|
|
29380
|
+
if (typeof formConf === 'object' && (_Object$keys = Object.keys(formConf)) !== null && _Object$keys !== void 0 && _Object$keys.length) {
|
|
29381
|
+
return formConf;
|
|
29382
|
+
}
|
|
29383
|
+
return [];
|
|
29384
|
+
}, [formConf]);
|
|
29371
29385
|
|
|
29372
29386
|
// Build form groups with highlight/disable state
|
|
29373
29387
|
React.useEffect(() => {
|
|
29374
|
-
const _formGroups =
|
|
29388
|
+
const _formGroups = formConfigToUse === null || formConfigToUse === void 0 ? void 0 : formConfigToUse.map(c => {
|
|
29375
29389
|
var _c$options, _c$options2;
|
|
29376
29390
|
const _highlighted = getHighlighted(_objectSpread2({}, c), _objectSpread2({}, data));
|
|
29377
29391
|
const disabled = getDisabled({
|
|
@@ -29387,19 +29401,20 @@ const Sections = _ref2 => {
|
|
|
29387
29401
|
});
|
|
29388
29402
|
setHasMissing(!!_formGroups.find(f => f.hasMissing));
|
|
29389
29403
|
setFormGroups(_formGroups);
|
|
29390
|
-
}, [
|
|
29404
|
+
}, [formConfigToUse, highlightMandatory]);
|
|
29391
29405
|
|
|
29392
29406
|
// Initial selection logic
|
|
29393
29407
|
React.useEffect(() => {
|
|
29394
29408
|
var _match$params;
|
|
29395
29409
|
let sGroup;
|
|
29396
29410
|
if (match !== null && match !== void 0 && (_match$params = match.params) !== null && _match$params !== void 0 && _match$params.formId) {
|
|
29411
|
+
var _formConf$;
|
|
29397
29412
|
// Special case: only group id
|
|
29398
|
-
sGroup = group || (formConf.length ? formConf[0]
|
|
29413
|
+
sGroup = group || (formConf !== null && formConf !== void 0 && formConf.length ? formConf === null || formConf === void 0 || (_formConf$ = formConf[0]) === null || _formConf$ === void 0 ? void 0 : _formConf$.id : null);
|
|
29399
29414
|
} else {
|
|
29400
29415
|
// General case: full path
|
|
29401
29416
|
sGroup = "".concat(group || '').concat(subsection ? "/".concat(subsection) : '').concat(subgroup ? "/".concat(subgroup) : '').concat(formid ? "/".concat(formid) : '');
|
|
29402
|
-
if (!group && formConf.length) {
|
|
29417
|
+
if (!group && formConf !== null && formConf !== void 0 && formConf.length) {
|
|
29403
29418
|
sGroup = formConf[0].id;
|
|
29404
29419
|
}
|
|
29405
29420
|
}
|
|
@@ -29451,13 +29466,15 @@ const Sections = _ref2 => {
|
|
|
29451
29466
|
var _match$params3;
|
|
29452
29467
|
let sGroup;
|
|
29453
29468
|
if (match !== null && match !== void 0 && (_match$params3 = match.params) !== null && _match$params3 !== void 0 && _match$params3.formId) {
|
|
29469
|
+
var _formConf$2;
|
|
29454
29470
|
// Special case fallback
|
|
29455
|
-
sGroup = group || (formConf.length ? formConf[0].id : null);
|
|
29471
|
+
sGroup = group || (formConf !== null && formConf !== void 0 && formConf.length ? formConf === null || formConf === void 0 || (_formConf$2 = formConf[0]) === null || _formConf$2 === void 0 ? void 0 : _formConf$2.id : null);
|
|
29456
29472
|
} else {
|
|
29457
29473
|
// General fallback
|
|
29458
29474
|
sGroup = "".concat(group || '').concat(subsection ? "/".concat(subsection) : '').concat(subgroup ? "/".concat(subgroup) : '').concat(formid ? "/".concat(formid) : '');
|
|
29459
|
-
if (!group && formConf.length) {
|
|
29460
|
-
|
|
29475
|
+
if (!group && formConf !== null && formConf !== void 0 && formConf.length) {
|
|
29476
|
+
var _formConf$3;
|
|
29477
|
+
sGroup = formConf === null || formConf === void 0 || (_formConf$3 = formConf[0]) === null || _formConf$3 === void 0 ? void 0 : _formConf$3.id;
|
|
29461
29478
|
}
|
|
29462
29479
|
}
|
|
29463
29480
|
setSelectedGroup(sGroup);
|
|
@@ -51208,7 +51225,7 @@ const BaseScreen = _ref => {
|
|
|
51208
51225
|
*/
|
|
51209
51226
|
const renderNumber = (val, doubleDigit = false) => {
|
|
51210
51227
|
if (typeof val !== 'number') {
|
|
51211
|
-
return '
|
|
51228
|
+
return '-';
|
|
51212
51229
|
}
|
|
51213
51230
|
const _string = Number(val).toLocaleString('en-us');
|
|
51214
51231
|
if (doubleDigit) {
|