datastake-daf 0.6.797 → 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 +60 -41
- package/dist/pages/index.js +10422 -1429
- package/dist/utils/index.js +57 -2
- 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/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
|
@@ -8501,20 +8501,22 @@ const useHeader = _ref => {
|
|
|
8501
8501
|
const {
|
|
8502
8502
|
useToken: useToken$m
|
|
8503
8503
|
} = antd.theme;
|
|
8504
|
-
function BreadCrumbs({
|
|
8505
|
-
|
|
8506
|
-
|
|
8507
|
-
|
|
8504
|
+
function BreadCrumbs(_ref) {
|
|
8505
|
+
let {
|
|
8506
|
+
breadcrumbs = [],
|
|
8507
|
+
mainContWidth = 0
|
|
8508
|
+
} = _ref;
|
|
8508
8509
|
const [splitIndex, setSplitIndex] = React.useState(0);
|
|
8509
8510
|
const {
|
|
8510
8511
|
token
|
|
8511
8512
|
} = useToken$m();
|
|
8512
|
-
const _renderBreadcrumb = (b, i, isLast
|
|
8513
|
+
const _renderBreadcrumb = function (b, i, isLast) {
|
|
8514
|
+
let noOnClickLast = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
8513
8515
|
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
8514
8516
|
className: "flex breadcrumb-item",
|
|
8515
|
-
onClick: noOnClickLast && isLast ? undefined : b
|
|
8517
|
+
onClick: noOnClickLast && isLast ? undefined : b === null || b === void 0 ? void 0 : b.onClick,
|
|
8516
8518
|
children: [/*#__PURE__*/jsxRuntime.jsx("span", {
|
|
8517
|
-
children: b
|
|
8519
|
+
children: b === null || b === void 0 ? void 0 : b.label
|
|
8518
8520
|
}), !isLast && /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
8519
8521
|
className: "flex flex-column justify-content-center",
|
|
8520
8522
|
children: /*#__PURE__*/jsxRuntime.jsx(CustomIcon, {
|
|
@@ -8524,7 +8526,7 @@ function BreadCrumbs({
|
|
|
8524
8526
|
color: token.baseGray50
|
|
8525
8527
|
})
|
|
8526
8528
|
})]
|
|
8527
|
-
},
|
|
8529
|
+
}, "breadcrumb-item-".concat(i));
|
|
8528
8530
|
};
|
|
8529
8531
|
React.useEffect(() => {
|
|
8530
8532
|
const _placeholderCont = document.getElementById("header-breadcrumbs");
|
|
@@ -8567,7 +8569,7 @@ function BreadCrumbs({
|
|
|
8567
8569
|
placement: "bottomRight",
|
|
8568
8570
|
menu: {
|
|
8569
8571
|
items: groupedBreadCrumbs[2].map((it, i) => ({
|
|
8570
|
-
key:
|
|
8572
|
+
key: "items-".concat(i),
|
|
8571
8573
|
label: it.label,
|
|
8572
8574
|
onClick: it.onClick
|
|
8573
8575
|
}))
|
|
@@ -9613,25 +9615,27 @@ const renderFieldData = (type, value, user, config, getApiBaseUrl = () => {}, ge
|
|
|
9613
9615
|
}
|
|
9614
9616
|
};
|
|
9615
9617
|
|
|
9616
|
-
const renderValue =
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
|
|
9625
|
-
|
|
9626
|
-
|
|
9627
|
-
|
|
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;
|
|
9628
9631
|
const inputKeys = Object.keys(config.inputs).sort((a, b) => {
|
|
9629
|
-
|
|
9630
|
-
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;
|
|
9631
9635
|
return positionA - positionB;
|
|
9632
9636
|
});
|
|
9633
9637
|
const values = inputKeys.map(inputKey => {
|
|
9634
|
-
let inputValue = value
|
|
9638
|
+
let inputValue = value === null || value === void 0 ? void 0 : value[inputKey];
|
|
9635
9639
|
if (inputValue === null || inputValue === undefined || inputValue === '') {
|
|
9636
9640
|
return '';
|
|
9637
9641
|
} else if (typeof inputValue === 'object' && inputValue !== null) {
|
|
@@ -9672,8 +9676,8 @@ const renderValue = ({
|
|
|
9672
9676
|
} else {
|
|
9673
9677
|
displayValue = String(value);
|
|
9674
9678
|
}
|
|
9675
|
-
const fieldType = config
|
|
9676
|
-
let cssClass =
|
|
9679
|
+
const fieldType = (config === null || config === void 0 ? void 0 : config.type) || 'text';
|
|
9680
|
+
let cssClass = "tree-value ".concat(fieldType, "-type");
|
|
9677
9681
|
if (displayValue === '-') {
|
|
9678
9682
|
cssClass += ' empty';
|
|
9679
9683
|
}
|
|
@@ -9683,19 +9687,21 @@ const renderValue = ({
|
|
|
9683
9687
|
children: displayValue
|
|
9684
9688
|
});
|
|
9685
9689
|
};
|
|
9686
|
-
const determineHasChildren =
|
|
9687
|
-
|
|
9688
|
-
|
|
9689
|
-
|
|
9690
|
-
|
|
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') {
|
|
9691
9697
|
return false;
|
|
9692
9698
|
}
|
|
9693
|
-
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) {
|
|
9694
9700
|
return true;
|
|
9695
9701
|
}
|
|
9696
|
-
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' ||
|
|
9697
9703
|
// Add this line
|
|
9698
|
-
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);
|
|
9699
9705
|
};
|
|
9700
9706
|
|
|
9701
9707
|
const sortByPosition = (items, getConfig) => {
|
|
@@ -29366,10 +29372,20 @@ const Sections = _ref2 => {
|
|
|
29366
29372
|
const [openKeys, setOpenKeys] = React.useState([]);
|
|
29367
29373
|
const [formGroups, setFormGroups] = React.useState([]);
|
|
29368
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]);
|
|
29369
29385
|
|
|
29370
29386
|
// Build form groups with highlight/disable state
|
|
29371
29387
|
React.useEffect(() => {
|
|
29372
|
-
const _formGroups =
|
|
29388
|
+
const _formGroups = formConfigToUse === null || formConfigToUse === void 0 ? void 0 : formConfigToUse.map(c => {
|
|
29373
29389
|
var _c$options, _c$options2;
|
|
29374
29390
|
const _highlighted = getHighlighted(_objectSpread2({}, c), _objectSpread2({}, data));
|
|
29375
29391
|
const disabled = getDisabled({
|
|
@@ -29385,19 +29401,20 @@ const Sections = _ref2 => {
|
|
|
29385
29401
|
});
|
|
29386
29402
|
setHasMissing(!!_formGroups.find(f => f.hasMissing));
|
|
29387
29403
|
setFormGroups(_formGroups);
|
|
29388
|
-
}, [
|
|
29404
|
+
}, [formConfigToUse, highlightMandatory]);
|
|
29389
29405
|
|
|
29390
29406
|
// Initial selection logic
|
|
29391
29407
|
React.useEffect(() => {
|
|
29392
29408
|
var _match$params;
|
|
29393
29409
|
let sGroup;
|
|
29394
29410
|
if (match !== null && match !== void 0 && (_match$params = match.params) !== null && _match$params !== void 0 && _match$params.formId) {
|
|
29411
|
+
var _formConf$;
|
|
29395
29412
|
// Special case: only group id
|
|
29396
|
-
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);
|
|
29397
29414
|
} else {
|
|
29398
29415
|
// General case: full path
|
|
29399
29416
|
sGroup = "".concat(group || '').concat(subsection ? "/".concat(subsection) : '').concat(subgroup ? "/".concat(subgroup) : '').concat(formid ? "/".concat(formid) : '');
|
|
29400
|
-
if (!group && formConf.length) {
|
|
29417
|
+
if (!group && formConf !== null && formConf !== void 0 && formConf.length) {
|
|
29401
29418
|
sGroup = formConf[0].id;
|
|
29402
29419
|
}
|
|
29403
29420
|
}
|
|
@@ -29449,13 +29466,15 @@ const Sections = _ref2 => {
|
|
|
29449
29466
|
var _match$params3;
|
|
29450
29467
|
let sGroup;
|
|
29451
29468
|
if (match !== null && match !== void 0 && (_match$params3 = match.params) !== null && _match$params3 !== void 0 && _match$params3.formId) {
|
|
29469
|
+
var _formConf$2;
|
|
29452
29470
|
// Special case fallback
|
|
29453
|
-
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);
|
|
29454
29472
|
} else {
|
|
29455
29473
|
// General fallback
|
|
29456
29474
|
sGroup = "".concat(group || '').concat(subsection ? "/".concat(subsection) : '').concat(subgroup ? "/".concat(subgroup) : '').concat(formid ? "/".concat(formid) : '');
|
|
29457
|
-
if (!group && formConf.length) {
|
|
29458
|
-
|
|
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;
|
|
29459
29478
|
}
|
|
29460
29479
|
}
|
|
29461
29480
|
setSelectedGroup(sGroup);
|