@crystaldesign/diva-backoffice 26.14.0-beta.11 → 26.14.0-beta.13
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/build/esm/index.js +184 -93
- package/build/types/backoffice/src/layout/MainLayout.d.ts.map +1 -1
- package/build/types/backoffice/src/tests/unit/ui/TreeChart/canHaveChildOfType.test.d.ts +2 -0
- package/build/types/backoffice/src/tests/unit/ui/TreeChart/canHaveChildOfType.test.d.ts.map +1 -0
- package/build/types/backoffice/src/ui/TreeChart/DuplicateOrganization/index.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/TreeChart/OrgItem/index.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/TreeChart/canHaveChildOfType.d.ts +15 -0
- package/build/types/backoffice/src/ui/TreeChart/canHaveChildOfType.d.ts.map +1 -0
- package/build/types/backoffice/src/ui/TreeChart/types.d.ts +2 -0
- package/build/types/backoffice/src/ui/TreeChart/types.d.ts.map +1 -1
- package/package.json +12 -12
package/build/esm/index.js
CHANGED
|
@@ -29931,7 +29931,7 @@ var useMediaUpload = function useMediaUpload(_ref) {
|
|
|
29931
29931
|
var small = "small-NY1-k";
|
|
29932
29932
|
var medium = "medium---QcO";
|
|
29933
29933
|
var big = "big--E39S";
|
|
29934
|
-
var css_248z$19 = ".diva-component-DIVA_BACKOFFICE_NEW .ant-upload-wrapper {\n width: 100%;\n height: 100%;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-spin-nested-loading {\n width: 100%;\n height: 100%;\n}\n.diva-component-DIVA_BACKOFFICE_NEW .ant-table-wrapper, .diva-component-DIVA_BACKOFFICE_NEW .ant-table {\n height: inherit;\n overflow: auto;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-drawer-body .ant-spin-nested-loading {\n width: 100%;\n height: 80%;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-spin-container {\n width: 100%;\n height: 100%;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .andt-table .ant-spin-container {\n display: flex;\n flex-direction: column;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-space-item .andt-table .ant-spin-container {\n height: calc(60vh - 90px);\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .andt-table .ant-table-container {\n height: calc(100% - 80px);\n}\n.diva-component-DIVA_BACKOFFICE_NEW .ant-upload-list {\n width: 100%;\n height: 100%;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-upload-list-item-container {\n width: 100% !important;\n height: 100% !important;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-upload-select {\n width: 100% !important;\n height: 100% !important;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .small-NY1-k {\n width: 104px;\n height: 104px;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .medium---QcO {\n width: 200px;\n height: 200px;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .big--E39S {\n width: 400px;\n height: 400px;\n}\n";
|
|
29934
|
+
var css_248z$19 = ".diva-component-DIVA_BACKOFFICE_NEW .ant-upload-wrapper {\n width: 100%;\n height: 100%;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-spin-nested-loading {\n width: 100%;\n height: 100%;\n}\n.diva-component-DIVA_BACKOFFICE_NEW .ant-table-wrapper, .diva-component-DIVA_BACKOFFICE_NEW .ant-table {\n height: inherit;\n overflow: auto;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-drawer-body .ant-spin-nested-loading {\n width: 100%;\n height: 80%;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-spin-container {\n width: 100%;\n height: 100%;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .andt-table .ant-spin-container {\n display: flex;\n flex-direction: column;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-space-item .andt-table .ant-spin-container {\n height: calc(60vh - 90px);\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .andt-table .ant-table-container {\n height: calc(100% - 80px);\n}\n.diva-component-DIVA_BACKOFFICE_NEW .ant-upload-list {\n width: 100%;\n height: 100%;\n}\n\n/* since antd 6.3.1 the picture-card list only has a min-height; the 100% heights of the select and item below need a fixed one */\n.diva-component-DIVA_BACKOFFICE_NEW .ant-upload-list-picture-card {\n height: var(--ant-upload-picture-card-size);\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-upload-list-item-container {\n width: 100% !important;\n height: 100% !important;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .ant-upload-select {\n width: 100% !important;\n height: 100% !important;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .small-NY1-k {\n width: 104px;\n height: 104px;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .medium---QcO {\n width: 200px;\n height: 200px;\n}\n\n.diva-component-DIVA_BACKOFFICE_NEW .big--E39S {\n width: 400px;\n height: 400px;\n}\n";
|
|
29935
29935
|
styleInject(css_248z$19);
|
|
29936
29936
|
|
|
29937
29937
|
var MediaUpload = observer(function (_ref) {
|
|
@@ -32691,10 +32691,15 @@ var advancedProps = function advancedProps(title) {
|
|
|
32691
32691
|
visible = _ref3.visible;
|
|
32692
32692
|
var ref = useRef(null);
|
|
32693
32693
|
useEffect(function () {
|
|
32694
|
-
if (visible)
|
|
32694
|
+
if (!visible) return;
|
|
32695
|
+
// antd mounts and shows the dropdown content only after this effect, so the input can be selected one task later
|
|
32696
|
+
var timeout = setTimeout(function () {
|
|
32695
32697
|
var _ref$current2;
|
|
32696
|
-
(_ref$current2 = ref.current) === null || _ref$current2 === void 0
|
|
32697
|
-
}
|
|
32698
|
+
return (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.select();
|
|
32699
|
+
});
|
|
32700
|
+
return function () {
|
|
32701
|
+
return clearTimeout(timeout);
|
|
32702
|
+
};
|
|
32698
32703
|
}, [visible]);
|
|
32699
32704
|
return /*#__PURE__*/jsx("div", {
|
|
32700
32705
|
style: {
|
|
@@ -32797,9 +32802,15 @@ var searchProps = function searchProps(title, filter) {
|
|
|
32797
32802
|
visible = _ref4.visible;
|
|
32798
32803
|
var ref1 = useRef(null);
|
|
32799
32804
|
useEffect(function () {
|
|
32800
|
-
if (visible)
|
|
32801
|
-
|
|
32802
|
-
|
|
32805
|
+
if (!visible) return;
|
|
32806
|
+
// antd mounts and shows the dropdown content only after this effect, so the input can be selected one task later
|
|
32807
|
+
var timeout = setTimeout(function () {
|
|
32808
|
+
var _ref1$current;
|
|
32809
|
+
return (_ref1$current = ref1.current) === null || _ref1$current === void 0 ? void 0 : _ref1$current.select();
|
|
32810
|
+
});
|
|
32811
|
+
return function () {
|
|
32812
|
+
return clearTimeout(timeout);
|
|
32813
|
+
};
|
|
32803
32814
|
}, [visible]);
|
|
32804
32815
|
return /*#__PURE__*/jsxs("div", {
|
|
32805
32816
|
style: {
|
|
@@ -35691,6 +35702,33 @@ function getNewChildData(parent) {
|
|
|
35691
35702
|
};
|
|
35692
35703
|
}
|
|
35693
35704
|
|
|
35705
|
+
/**
|
|
35706
|
+
* The type the children of `org` get as parentType: retailer channels and campaigns belong to a retailer, dealers to a supplier,
|
|
35707
|
+
* a shell organization passes on the type of its ancestors.
|
|
35708
|
+
*/
|
|
35709
|
+
function getChildParentType(org, inheritedParentType) {
|
|
35710
|
+
var _org$type;
|
|
35711
|
+
if (org.type === 'RETAILERCHILD') return 'RETAILER';
|
|
35712
|
+
if (org.type === 'DEALER') return 'SUPPLIER';
|
|
35713
|
+
return (_org$type = org.type) !== null && _org$type !== void 0 ? _org$type : inheritedParentType;
|
|
35714
|
+
}
|
|
35715
|
+
|
|
35716
|
+
/**
|
|
35717
|
+
* Whether an organization of `type` may be created below `parent`, the same type rules diva-auth applies when it creates one.
|
|
35718
|
+
*
|
|
35719
|
+
* @param type the stored type of the new organization, undefined for a shell, retailer channel or dealer
|
|
35720
|
+
* @param parent the organization the new one is added to
|
|
35721
|
+
* @param parentType the type the children of `parent` get, see {@link getChildParentType}
|
|
35722
|
+
*/
|
|
35723
|
+
function canHaveChildOfType(type, parent, parentType) {
|
|
35724
|
+
var _parent$settings;
|
|
35725
|
+
if (!type) return true;
|
|
35726
|
+
if (type === 'CAMPAIGN') return parentType === 'RETAILER' && !!((_parent$settings = parent.settings) !== null && _parent$settings !== void 0 && _parent$settings.isCampaign);
|
|
35727
|
+
if (parentType === 'RETAILER' || parentType === 'SUPPLIER') return false;
|
|
35728
|
+
if (parentType === 'ASSOCIATION' && type === 'SUPPLIER') return false;
|
|
35729
|
+
return true;
|
|
35730
|
+
}
|
|
35731
|
+
|
|
35694
35732
|
function ownKeys$1U(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
35695
35733
|
function _objectSpread$1U(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1U(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1U(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
35696
35734
|
var SOURCE_MAPPING = {
|
|
@@ -35708,18 +35746,23 @@ var NOT_COPIED_FIELDS = ['_id', 'parent', 'parentOrganizations', 'childOrganizat
|
|
|
35708
35746
|
|
|
35709
35747
|
// bind the organization 1:1 to an external Meta or LeadTable campaign, the copy needs its own
|
|
35710
35748
|
var NOT_COPIED_CAMPAIGN_FIELDS = ['metaAdSetId', 'metaCampaignId', 'leadTableCampaignId', 'leadTableCustomerId', 'leadTableUrl'];
|
|
35711
|
-
function
|
|
35749
|
+
function getOrgs(org, inheritedParentType) {
|
|
35712
35750
|
var _org$children;
|
|
35713
|
-
var result = arguments.length >
|
|
35714
|
-
|
|
35751
|
+
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
35752
|
+
var childParentType = getChildParentType(org, inheritedParentType);
|
|
35753
|
+
result.push({
|
|
35754
|
+
org: org,
|
|
35755
|
+
childParentType: childParentType
|
|
35756
|
+
});
|
|
35715
35757
|
(_org$children = org.children) === null || _org$children === void 0 || _org$children.forEach(function (child) {
|
|
35716
|
-
return
|
|
35758
|
+
return getOrgs(child, childParentType, result);
|
|
35717
35759
|
});
|
|
35718
35760
|
return result;
|
|
35719
35761
|
}
|
|
35720
35762
|
|
|
35721
35763
|
/**
|
|
35722
35764
|
* Button that asks for the parent of the copy and then opens the create form prefilled with the values of the source.
|
|
35765
|
+
* Only parents the type of the source may be created below can be chosen.
|
|
35723
35766
|
*/
|
|
35724
35767
|
var DuplicateOrganization = function DuplicateOrganization(_ref) {
|
|
35725
35768
|
var action = _ref.action,
|
|
@@ -35738,114 +35781,142 @@ var DuplicateOrganization = function DuplicateOrganization(_ref) {
|
|
|
35738
35781
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
35739
35782
|
loading = _useState4[0],
|
|
35740
35783
|
setLoading = _useState4[1];
|
|
35741
|
-
var _useState5 = useState(
|
|
35784
|
+
var _useState5 = useState(),
|
|
35742
35785
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
35743
|
-
|
|
35744
|
-
|
|
35745
|
-
var _useState7 = useState(),
|
|
35786
|
+
sourceData = _useState6[0],
|
|
35787
|
+
setSourceData = _useState6[1];
|
|
35788
|
+
var _useState7 = useState(true),
|
|
35746
35789
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
35747
|
-
|
|
35748
|
-
|
|
35749
|
-
var
|
|
35750
|
-
|
|
35751
|
-
|
|
35752
|
-
|
|
35790
|
+
sameLevel = _useState8[0],
|
|
35791
|
+
setSameLevel = _useState8[1];
|
|
35792
|
+
var _useState9 = useState(),
|
|
35793
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
35794
|
+
otherParentId = _useState10[0],
|
|
35795
|
+
setOtherParentId = _useState10[1];
|
|
35796
|
+
var openingRef = useRef(0);
|
|
35797
|
+
var allowedParents = useMemo(function () {
|
|
35798
|
+
return sourceData ? getOrgs(tree).filter(function (_ref2) {
|
|
35799
|
+
var org = _ref2.org,
|
|
35800
|
+
childParentType = _ref2.childParentType;
|
|
35801
|
+
return canHaveChildOfType(sourceData.type, org, childParentType);
|
|
35802
|
+
}).map(function (_ref3) {
|
|
35803
|
+
var org = _ref3.org;
|
|
35804
|
+
return org;
|
|
35805
|
+
}) : [];
|
|
35806
|
+
}, [tree, sourceData]);
|
|
35807
|
+
var sameLevelAllowed = !!parent.writePermission && allowedParents.some(function (org) {
|
|
35808
|
+
return org.id === parent.id;
|
|
35809
|
+
});
|
|
35810
|
+
var writableParents = allowedParents.filter(function (org) {
|
|
35811
|
+
return org.writePermission;
|
|
35812
|
+
});
|
|
35813
|
+
var target = sameLevel ? sameLevelAllowed ? parent : undefined : writableParents.find(function (org) {
|
|
35753
35814
|
return org.id === otherParentId;
|
|
35754
35815
|
});
|
|
35755
|
-
var openDialog = function
|
|
35756
|
-
|
|
35757
|
-
|
|
35758
|
-
setOpen(true);
|
|
35759
|
-
};
|
|
35760
|
-
var openForm = /*#__PURE__*/function () {
|
|
35761
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
35762
|
-
var _sourceData$settings;
|
|
35763
|
-
var apiInterface, createUrl, sourceData, _sourceData, values, campaignSettings;
|
|
35816
|
+
var openDialog = /*#__PURE__*/function () {
|
|
35817
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
35818
|
+
var opening, data;
|
|
35764
35819
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
35765
35820
|
while (1) switch (_context.prev = _context.next) {
|
|
35766
35821
|
case 0:
|
|
35767
|
-
|
|
35768
|
-
|
|
35769
|
-
|
|
35770
|
-
|
|
35771
|
-
|
|
35772
|
-
case 2:
|
|
35773
|
-
apiInterface = action.apiInterface;
|
|
35774
|
-
createUrl = _typeof(apiInterface) == 'object' && typeof apiInterface.create == 'string' ? apiInterface.create : undefined;
|
|
35822
|
+
// a read of an earlier opening may settle after this one, only the latest opening may change the dialog
|
|
35823
|
+
opening = ++openingRef.current;
|
|
35824
|
+
setSourceData(undefined);
|
|
35825
|
+
setOtherParentId(undefined);
|
|
35826
|
+
setOpen(true);
|
|
35775
35827
|
setLoading(true);
|
|
35776
35828
|
_context.prev = 5;
|
|
35777
35829
|
_context.next = 8;
|
|
35778
35830
|
return new _default$c({
|
|
35779
|
-
apiInterface: apiInterface,
|
|
35831
|
+
apiInterface: action.apiInterface,
|
|
35780
35832
|
type: 'Button'
|
|
35781
35833
|
}, root).read(SOURCE_MAPPING, {
|
|
35782
35834
|
id: source.id
|
|
35783
35835
|
});
|
|
35784
35836
|
case 8:
|
|
35785
|
-
|
|
35786
|
-
if (
|
|
35837
|
+
data = _context.sent;
|
|
35838
|
+
if (data !== null && data !== void 0 && data._id) {
|
|
35787
35839
|
_context.next = 11;
|
|
35788
35840
|
break;
|
|
35789
35841
|
}
|
|
35790
35842
|
throw new Error("Organization ".concat(source.id, " could not be loaded"));
|
|
35791
35843
|
case 11:
|
|
35792
|
-
|
|
35793
|
-
|
|
35794
|
-
|
|
35795
|
-
|
|
35796
|
-
_context.t0 = _context["catch"](5);
|
|
35797
|
-
root.addError(t('backoffice.orgtree.duplicateAction.loadError', 'Die Organisation konnte nicht geladen werden.'));
|
|
35844
|
+
if (!(opening !== openingRef.current)) {
|
|
35845
|
+
_context.next = 13;
|
|
35846
|
+
break;
|
|
35847
|
+
}
|
|
35798
35848
|
return _context.abrupt("return");
|
|
35849
|
+
case 13:
|
|
35850
|
+
setSourceData(data);
|
|
35851
|
+
setSameLevel(!!parent.writePermission);
|
|
35852
|
+
_context.next = 23;
|
|
35853
|
+
break;
|
|
35799
35854
|
case 17:
|
|
35800
35855
|
_context.prev = 17;
|
|
35801
|
-
|
|
35802
|
-
|
|
35803
|
-
|
|
35804
|
-
|
|
35805
|
-
values = Object.fromEntries(Object.entries(sourceData).filter(function (_ref3) {
|
|
35806
|
-
var _ref4 = _slicedToArray(_ref3, 1),
|
|
35807
|
-
key = _ref4[0];
|
|
35808
|
-
return !NOT_COPIED_FIELDS.includes(key);
|
|
35809
|
-
}));
|
|
35810
|
-
campaignSettings = (_sourceData$settings = sourceData.settings) === null || _sourceData$settings === void 0 ? void 0 : _sourceData$settings.campaignSettings;
|
|
35811
|
-
if (campaignSettings) {
|
|
35812
|
-
values.settings = _objectSpread$1U(_objectSpread$1U({}, sourceData.settings), {}, {
|
|
35813
|
-
campaignSettings: Object.fromEntries(Object.entries(campaignSettings).filter(function (_ref5) {
|
|
35814
|
-
var _ref6 = _slicedToArray(_ref5, 1),
|
|
35815
|
-
key = _ref6[0];
|
|
35816
|
-
return !NOT_COPIED_CAMPAIGN_FIELDS.includes(key);
|
|
35817
|
-
}))
|
|
35818
|
-
});
|
|
35856
|
+
_context.t0 = _context["catch"](5);
|
|
35857
|
+
if (!(opening !== openingRef.current)) {
|
|
35858
|
+
_context.next = 21;
|
|
35859
|
+
break;
|
|
35819
35860
|
}
|
|
35820
|
-
|
|
35821
|
-
|
|
35822
|
-
|
|
35823
|
-
|
|
35824
|
-
|
|
35825
|
-
|
|
35826
|
-
|
|
35827
|
-
|
|
35828
|
-
|
|
35829
|
-
id: target.id
|
|
35830
|
-
},
|
|
35831
|
-
data: _objectSpread$1U(_objectSpread$1U({}, values), {}, {
|
|
35832
|
-
displayName: t('backoffice.orgtree.duplicateAction.copyName', {
|
|
35833
|
-
defaultValue: '{{name}} (Kopie)',
|
|
35834
|
-
name: sourceData.displayName
|
|
35835
|
-
})
|
|
35836
|
-
}, getNewChildData(target)),
|
|
35837
|
-
callback: onDuplicated
|
|
35838
|
-
});
|
|
35839
|
-
case 25:
|
|
35861
|
+
return _context.abrupt("return");
|
|
35862
|
+
case 21:
|
|
35863
|
+
root.addError(t('backoffice.orgtree.duplicateAction.loadError', 'Die Organisation konnte nicht geladen werden.'));
|
|
35864
|
+
setOpen(false);
|
|
35865
|
+
case 23:
|
|
35866
|
+
_context.prev = 23;
|
|
35867
|
+
if (opening === openingRef.current) setLoading(false);
|
|
35868
|
+
return _context.finish(23);
|
|
35869
|
+
case 26:
|
|
35840
35870
|
case "end":
|
|
35841
35871
|
return _context.stop();
|
|
35842
35872
|
}
|
|
35843
|
-
}, _callee, null, [[5,
|
|
35873
|
+
}, _callee, null, [[5, 17, 23, 26]]);
|
|
35844
35874
|
}));
|
|
35845
|
-
return function
|
|
35846
|
-
return
|
|
35875
|
+
return function openDialog() {
|
|
35876
|
+
return _ref4.apply(this, arguments);
|
|
35847
35877
|
};
|
|
35848
35878
|
}();
|
|
35879
|
+
var openForm = function openForm() {
|
|
35880
|
+
var _sourceData$settings;
|
|
35881
|
+
if (!target || !sourceData) return;
|
|
35882
|
+
var apiInterface = action.apiInterface;
|
|
35883
|
+
var createUrl = _typeof(apiInterface) == 'object' && typeof apiInterface.create == 'string' ? apiInterface.create : undefined;
|
|
35884
|
+
setOpen(false);
|
|
35885
|
+
var values = Object.fromEntries(Object.entries(sourceData).filter(function (_ref5) {
|
|
35886
|
+
var _ref6 = _slicedToArray(_ref5, 1),
|
|
35887
|
+
key = _ref6[0];
|
|
35888
|
+
return !NOT_COPIED_FIELDS.includes(key);
|
|
35889
|
+
}));
|
|
35890
|
+
var campaignSettings = (_sourceData$settings = sourceData.settings) === null || _sourceData$settings === void 0 ? void 0 : _sourceData$settings.campaignSettings;
|
|
35891
|
+
if (campaignSettings) {
|
|
35892
|
+
values.settings = _objectSpread$1U(_objectSpread$1U({}, sourceData.settings), {}, {
|
|
35893
|
+
campaignSettings: Object.fromEntries(Object.entries(campaignSettings).filter(function (_ref7) {
|
|
35894
|
+
var _ref8 = _slicedToArray(_ref7, 1),
|
|
35895
|
+
key = _ref8[0];
|
|
35896
|
+
return !NOT_COPIED_CAMPAIGN_FIELDS.includes(key);
|
|
35897
|
+
}))
|
|
35898
|
+
});
|
|
35899
|
+
}
|
|
35900
|
+
root.detailStore.openRightDetail({
|
|
35901
|
+
configurationId: action.id,
|
|
35902
|
+
type: action.type,
|
|
35903
|
+
title: typeof action.title == 'function' ? action.title(source) : action.title,
|
|
35904
|
+
// the form fills ${parentId} from the mapping data
|
|
35905
|
+
apiInterface: {
|
|
35906
|
+
create: createUrl === null || createUrl === void 0 ? void 0 : createUrl.replace('${organizationId}', encodeURIComponent(source.id))
|
|
35907
|
+
},
|
|
35908
|
+
mappingData: {
|
|
35909
|
+
id: target.id
|
|
35910
|
+
},
|
|
35911
|
+
data: _objectSpread$1U(_objectSpread$1U({}, values), {}, {
|
|
35912
|
+
displayName: t('backoffice.orgtree.duplicateAction.copyName', {
|
|
35913
|
+
defaultValue: '{{name}} (Kopie)',
|
|
35914
|
+
name: sourceData.displayName
|
|
35915
|
+
})
|
|
35916
|
+
}, getNewChildData(target)),
|
|
35917
|
+
callback: onDuplicated
|
|
35918
|
+
});
|
|
35919
|
+
};
|
|
35849
35920
|
return (
|
|
35850
35921
|
/*#__PURE__*/
|
|
35851
35922
|
// the dialog is rendered inside the tree node, keep its clicks from selecting the node
|
|
@@ -35865,9 +35936,9 @@ var DuplicateOrganization = function DuplicateOrganization(_ref) {
|
|
|
35865
35936
|
okText: t('backoffice.orgtree.duplicateAction.ok', 'Weiter'),
|
|
35866
35937
|
cancelText: t('backoffice.orgtree.duplicateAction.cancel', 'Abbrechen'),
|
|
35867
35938
|
okButtonProps: {
|
|
35868
|
-
disabled: !target
|
|
35939
|
+
disabled: !target,
|
|
35940
|
+
loading: loading
|
|
35869
35941
|
},
|
|
35870
|
-
confirmLoading: loading,
|
|
35871
35942
|
onOk: openForm,
|
|
35872
35943
|
onCancel: function onCancel() {
|
|
35873
35944
|
return setOpen(false);
|
|
@@ -35879,6 +35950,7 @@ var DuplicateOrganization = function DuplicateOrganization(_ref) {
|
|
|
35879
35950
|
},
|
|
35880
35951
|
children: [/*#__PURE__*/jsx(Radio.Group, {
|
|
35881
35952
|
value: sameLevel,
|
|
35953
|
+
disabled: !sourceData,
|
|
35882
35954
|
onChange: function onChange(e) {
|
|
35883
35955
|
return setSameLevel(e.target.value);
|
|
35884
35956
|
},
|
|
@@ -35886,7 +35958,7 @@ var DuplicateOrganization = function DuplicateOrganization(_ref) {
|
|
|
35886
35958
|
direction: "vertical",
|
|
35887
35959
|
children: [/*#__PURE__*/jsx(Radio, {
|
|
35888
35960
|
value: true,
|
|
35889
|
-
disabled: !
|
|
35961
|
+
disabled: !sameLevelAllowed,
|
|
35890
35962
|
children: t('backoffice.orgtree.duplicateAction.sameLevel', {
|
|
35891
35963
|
defaultValue: 'Gleiche Ebene ({{parent}})',
|
|
35892
35964
|
parent: parent.displayName
|
|
@@ -35908,7 +35980,7 @@ var DuplicateOrganization = function DuplicateOrganization(_ref) {
|
|
|
35908
35980
|
var _option$label;
|
|
35909
35981
|
return ((_option$label = option === null || option === void 0 ? void 0 : option.label) !== null && _option$label !== void 0 ? _option$label : '').toLowerCase().includes(input.toLowerCase());
|
|
35910
35982
|
},
|
|
35911
|
-
options:
|
|
35983
|
+
options: writableParents.map(function (org) {
|
|
35912
35984
|
return {
|
|
35913
35985
|
value: org.id,
|
|
35914
35986
|
label: org.displayName
|
|
@@ -35953,6 +36025,11 @@ var OrgItem = function OrgItem(_ref) {
|
|
|
35953
36025
|
var _useTranslation = useTranslation(),
|
|
35954
36026
|
t = _useTranslation.t;
|
|
35955
36027
|
var root = useStore();
|
|
36028
|
+
var _useDivaCore = useDivaCore(),
|
|
36029
|
+
userHasPermission = _useDivaCore.actions.userHasPermission;
|
|
36030
|
+
// end customers cannot set the organization type (and its API2 servers) in the create form, so they may only copy shells and retailer channels;
|
|
36031
|
+
// campaigns show as RETAILERCHILD too but store their own type
|
|
36032
|
+
var canDuplicate = (!data.type || data.type === 'RETAILERCHILD') && !data.storedType || userHasPermission('backoffice_admin_organizations');
|
|
35956
36033
|
return /*#__PURE__*/jsxs("div", {
|
|
35957
36034
|
id: data.id,
|
|
35958
36035
|
className: classNames(label$4, itemChain.find(function (i) {
|
|
@@ -35985,7 +36062,7 @@ var OrgItem = function OrgItem(_ref) {
|
|
|
35985
36062
|
setUpdate(update + 1);
|
|
35986
36063
|
(_configuration$create = configuration.createAction) === null || _configuration$create === void 0 || (_configuration$create2 = _configuration$create.callback) === null || _configuration$create2 === void 0 || _configuration$create2.call(_configuration$create, data);
|
|
35987
36064
|
}
|
|
35988
|
-
}, "create"), configuration.duplicateAction && data.readPermission && itemChain.length > 1 && ((_itemChain2 = itemChain[itemChain.length - 1]) === null || _itemChain2 === void 0 ? void 0 : _itemChain2.id) == data.id && /*#__PURE__*/jsx(DuplicateOrganization$1, {
|
|
36065
|
+
}, "create"), configuration.duplicateAction && canDuplicate && data.readPermission && itemChain.length > 1 && ((_itemChain2 = itemChain[itemChain.length - 1]) === null || _itemChain2 === void 0 ? void 0 : _itemChain2.id) == data.id && /*#__PURE__*/jsx(DuplicateOrganization$1, {
|
|
35989
36066
|
action: configuration.duplicateAction,
|
|
35990
36067
|
source: data,
|
|
35991
36068
|
parent: itemChain[itemChain.length - 2],
|
|
@@ -95324,6 +95401,7 @@ function Router() {
|
|
|
95324
95401
|
}
|
|
95325
95402
|
var Router$1 = observer(Router);
|
|
95326
95403
|
|
|
95404
|
+
var CLEAR_BUTTONS = 'button.ant-select-clear, button.ant-input-clear-icon, button.ant-picker-clear, .ant-color-picker-clear';
|
|
95327
95405
|
var MainLayout = function MainLayout(_ref) {
|
|
95328
95406
|
var _ref$navigation = _ref.navigation,
|
|
95329
95407
|
navigation = _ref$navigation === void 0 ? /*#__PURE__*/jsx(Navigation$4, {}) : _ref$navigation,
|
|
@@ -95342,6 +95420,19 @@ var MainLayout = function MainLayout(_ref) {
|
|
|
95342
95420
|
header.classList.toggle('lightmode', !isDark);
|
|
95343
95421
|
}
|
|
95344
95422
|
}, [root.contentStore.theme]);
|
|
95423
|
+
useEffect(function () {
|
|
95424
|
+
// Capture phase: runs before the browser moves the focus, so a clear button rendered since the last Tab is skipped as well
|
|
95425
|
+
var skipClearButtons = function skipClearButtons(e) {
|
|
95426
|
+
if (e.key != 'Tab') return;
|
|
95427
|
+
document.querySelectorAll(CLEAR_BUTTONS).forEach(function (clear) {
|
|
95428
|
+
return clear.tabIndex = -1;
|
|
95429
|
+
});
|
|
95430
|
+
};
|
|
95431
|
+
document.addEventListener('keydown', skipClearButtons, true);
|
|
95432
|
+
return function () {
|
|
95433
|
+
return document.removeEventListener('keydown', skipClearButtons, true);
|
|
95434
|
+
};
|
|
95435
|
+
}, []);
|
|
95345
95436
|
return /*#__PURE__*/jsx(ConfigProvider, {
|
|
95346
95437
|
theme: {
|
|
95347
95438
|
algorithm: theme$1 == 'darkmode' ? theme.darkAlgorithm : theme.defaultAlgorithm
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MainLayout.d.ts","sourceRoot":"","sources":["../../../../../src/layout/MainLayout.tsx"],"names":[],"mappings":"AACA,OAAO,KAA4B,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MainLayout.d.ts","sourceRoot":"","sources":["../../../../../src/layout/MainLayout.tsx"],"names":[],"mappings":"AACA,OAAO,KAA4B,MAAM,OAAO,CAAC;AAgBjD,UAAU,KAAK;IACb,yDAAyD;IACzD,UAAU,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC7B,qDAAqD;IACrD,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;mDAE0E,KAAK;;;AA8ChF,wBAAoC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canHaveChildOfType.test.d.ts","sourceRoot":"","sources":["../../../../../../../../src/tests/unit/ui/TreeChart/canHaveChildOfType.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/TreeChart/DuplicateOrganization/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/TreeChart/DuplicateOrganization/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoC,MAAM,OAAO,CAAC;AAIzD,OAAO,EAAE,YAAY,EAAW,MAAM,wBAAwB,CAAC;AAK/D,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAwB/B,UAAU,KAAK;IACb,MAAM,EAAE,YAAY,CAAC;IACrB,oCAAoC;IACpC,MAAM,EAAE,GAAG,CAAC;IACZ,+DAA+D;IAC/D,MAAM,EAAE,GAAG,CAAC;IACZ,0DAA0D;IAC1D,IAAI,EAAE,GAAG,CAAC;IACV,YAAY,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,CAAC;CACnC;0EAmB8E,KAAK;;;AAoHpF,wBAA+C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/TreeChart/OrgItem/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAQrD,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,GAAG,CAAC;IACV,aAAa,EAAE,oBAAoB,CAAC;IACpC,SAAS,EAAE,GAAG,EAAE,CAAC;IACjB,KAAK,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC9D,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;iHAqBsG,KAAK;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/TreeChart/OrgItem/index.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAQrD,KAAK,KAAK,GAAG;IACX,IAAI,EAAE,GAAG,CAAC;IACV,aAAa,EAAE,oBAAoB,CAAC;IACpC,SAAS,EAAE,GAAG,EAAE,CAAC;IACjB,KAAK,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;IAC9D,QAAQ,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;iHAqBsG,KAAK;;;AAsG7G,wBAAiC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Org } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The type the children of `org` get as parentType: retailer channels and campaigns belong to a retailer, dealers to a supplier,
|
|
4
|
+
* a shell organization passes on the type of its ancestors.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getChildParentType(org: Org, inheritedParentType?: string): string | undefined;
|
|
7
|
+
/**
|
|
8
|
+
* Whether an organization of `type` may be created below `parent`, the same type rules diva-auth applies when it creates one.
|
|
9
|
+
*
|
|
10
|
+
* @param type the stored type of the new organization, undefined for a shell, retailer channel or dealer
|
|
11
|
+
* @param parent the organization the new one is added to
|
|
12
|
+
* @param parentType the type the children of `parent` get, see {@link getChildParentType}
|
|
13
|
+
*/
|
|
14
|
+
export declare function canHaveChildOfType(type: string | undefined, parent: Org, parentType?: string): boolean;
|
|
15
|
+
//# sourceMappingURL=canHaveChildOfType.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"canHaveChildOfType.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/TreeChart/canHaveChildOfType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAE9B;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,GAAG,EAAE,mBAAmB,CAAC,EAAE,MAAM,sBAIxE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,CAAC,EAAE,MAAM,WAM5F"}
|
|
@@ -22,6 +22,8 @@ export interface Org {
|
|
|
22
22
|
children?: Org[];
|
|
23
23
|
onClick?: () => void;
|
|
24
24
|
type?: string;
|
|
25
|
+
/** The type stored on the organization; `type` shows campaigns as RETAILERCHILD */
|
|
26
|
+
storedType?: string;
|
|
25
27
|
readPermission?: boolean;
|
|
26
28
|
deletePermission?: boolean;
|
|
27
29
|
writePermission?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/TreeChart/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE5F,MAAM,WAAW,oBAAqB,SAAQ,sBAAsB;IAClE,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,eAAe,CAAC,EAAE,YAAY,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACrC;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/TreeChart/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAE5F,MAAM,WAAW,oBAAqB,SAAQ,sBAAsB;IAClE,IAAI,EAAE,SAAS,CAAC;IAChB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,eAAe,CAAC,EAAE,YAAY,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC7B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,GAAG;IAClB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,mFAAmF;IACnF,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,EAAE;QAAE,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC;CACrC;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crystaldesign/diva-backoffice",
|
|
3
|
-
"version": "26.14.0-beta.
|
|
3
|
+
"version": "26.14.0-beta.13",
|
|
4
4
|
"description": "Ant Design backoffice shell (configuration modules), the Diva Data Engine component hosting the IDM and enricher editors, and the Produkt Onboarding component hosting the Assortment Manager.",
|
|
5
5
|
"license": "COMMERCIAL",
|
|
6
6
|
"devDependencies": {
|
|
@@ -16,16 +16,16 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@ant-design/icons": "6.3.4",
|
|
18
18
|
"@babel/runtime": "7.24.7",
|
|
19
|
-
"@crystaldesign/classification": "26.14.0-beta.
|
|
20
|
-
"@crystaldesign/content-box": "26.14.0-beta.
|
|
21
|
-
"@crystaldesign/content-item": "26.14.0-beta.
|
|
22
|
-
"@crystaldesign/diva-agent": "26.14.0-beta.
|
|
23
|
-
"@crystaldesign/diva-core": "26.14.0-beta.
|
|
24
|
-
"@crystaldesign/diva-utils": "26.14.0-beta.
|
|
25
|
-
"@crystaldesign/mass-configurator": "26.14.0-beta.
|
|
26
|
-
"@crystaldesign/media-upload": "26.14.0-beta.
|
|
27
|
-
"@crystaldesign/rtf-editor": "26.14.0-beta.
|
|
28
|
-
"@crystaldesign/spreadsheet": "26.14.0-beta.
|
|
19
|
+
"@crystaldesign/classification": "26.14.0-beta.13",
|
|
20
|
+
"@crystaldesign/content-box": "26.14.0-beta.13",
|
|
21
|
+
"@crystaldesign/content-item": "26.14.0-beta.13",
|
|
22
|
+
"@crystaldesign/diva-agent": "26.14.0-beta.13",
|
|
23
|
+
"@crystaldesign/diva-core": "26.14.0-beta.13",
|
|
24
|
+
"@crystaldesign/diva-utils": "26.14.0-beta.13",
|
|
25
|
+
"@crystaldesign/mass-configurator": "26.14.0-beta.13",
|
|
26
|
+
"@crystaldesign/media-upload": "26.14.0-beta.13",
|
|
27
|
+
"@crystaldesign/rtf-editor": "26.14.0-beta.13",
|
|
28
|
+
"@crystaldesign/spreadsheet": "26.14.0-beta.13",
|
|
29
29
|
"@dnd-kit/core": "^6.1.0",
|
|
30
30
|
"@dnd-kit/sortable": "^8.0.0",
|
|
31
31
|
"@dnd-kit/utilities": "^3.2.2",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"suiteName": "diva-backoffice",
|
|
64
64
|
"outputDirectory": "./test-reports"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "a5967600ef123c38e9515354b4c65dbdc487135f"
|
|
67
67
|
}
|