@crystaldesign/diva-backoffice 26.13.0-rc.0 → 26.13.0-rc.10
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
|
@@ -29925,7 +29925,7 @@ var useMediaUpload = function useMediaUpload(_ref) {
|
|
|
29925
29925
|
var small = "small-NY1-k";
|
|
29926
29926
|
var medium = "medium---QcO";
|
|
29927
29927
|
var big = "big--E39S";
|
|
29928
|
-
var css_248z$18 = ".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";
|
|
29928
|
+
var css_248z$18 = ".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";
|
|
29929
29929
|
styleInject(css_248z$18);
|
|
29930
29930
|
|
|
29931
29931
|
var MediaUpload = observer(function (_ref) {
|
|
@@ -32685,10 +32685,15 @@ var advancedProps = function advancedProps(title) {
|
|
|
32685
32685
|
visible = _ref3.visible;
|
|
32686
32686
|
var ref = useRef(null);
|
|
32687
32687
|
useEffect(function () {
|
|
32688
|
-
if (visible)
|
|
32688
|
+
if (!visible) return;
|
|
32689
|
+
// antd mounts and shows the dropdown content only after this effect, so the input can be selected one task later
|
|
32690
|
+
var timeout = setTimeout(function () {
|
|
32689
32691
|
var _ref$current2;
|
|
32690
|
-
(_ref$current2 = ref.current) === null || _ref$current2 === void 0
|
|
32691
|
-
}
|
|
32692
|
+
return (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.select();
|
|
32693
|
+
});
|
|
32694
|
+
return function () {
|
|
32695
|
+
return clearTimeout(timeout);
|
|
32696
|
+
};
|
|
32692
32697
|
}, [visible]);
|
|
32693
32698
|
return /*#__PURE__*/jsx("div", {
|
|
32694
32699
|
style: {
|
|
@@ -32791,9 +32796,15 @@ var searchProps = function searchProps(title, filter) {
|
|
|
32791
32796
|
visible = _ref4.visible;
|
|
32792
32797
|
var ref1 = useRef(null);
|
|
32793
32798
|
useEffect(function () {
|
|
32794
|
-
if (visible)
|
|
32795
|
-
|
|
32796
|
-
|
|
32799
|
+
if (!visible) return;
|
|
32800
|
+
// antd mounts and shows the dropdown content only after this effect, so the input can be selected one task later
|
|
32801
|
+
var timeout = setTimeout(function () {
|
|
32802
|
+
var _ref1$current;
|
|
32803
|
+
return (_ref1$current = ref1.current) === null || _ref1$current === void 0 ? void 0 : _ref1$current.select();
|
|
32804
|
+
});
|
|
32805
|
+
return function () {
|
|
32806
|
+
return clearTimeout(timeout);
|
|
32807
|
+
};
|
|
32797
32808
|
}, [visible]);
|
|
32798
32809
|
return /*#__PURE__*/jsxs("div", {
|
|
32799
32810
|
style: {
|
|
@@ -35685,6 +35696,33 @@ function getNewChildData(parent) {
|
|
|
35685
35696
|
};
|
|
35686
35697
|
}
|
|
35687
35698
|
|
|
35699
|
+
/**
|
|
35700
|
+
* The type the children of `org` get as parentType: retailer channels and campaigns belong to a retailer, dealers to a supplier,
|
|
35701
|
+
* a shell organization passes on the type of its ancestors.
|
|
35702
|
+
*/
|
|
35703
|
+
function getChildParentType(org, inheritedParentType) {
|
|
35704
|
+
var _org$type;
|
|
35705
|
+
if (org.type === 'RETAILERCHILD') return 'RETAILER';
|
|
35706
|
+
if (org.type === 'DEALER') return 'SUPPLIER';
|
|
35707
|
+
return (_org$type = org.type) !== null && _org$type !== void 0 ? _org$type : inheritedParentType;
|
|
35708
|
+
}
|
|
35709
|
+
|
|
35710
|
+
/**
|
|
35711
|
+
* Whether an organization of `type` may be created below `parent`, the same type rules diva-auth applies when it creates one.
|
|
35712
|
+
*
|
|
35713
|
+
* @param type the stored type of the new organization, undefined for a shell, retailer channel or dealer
|
|
35714
|
+
* @param parent the organization the new one is added to
|
|
35715
|
+
* @param parentType the type the children of `parent` get, see {@link getChildParentType}
|
|
35716
|
+
*/
|
|
35717
|
+
function canHaveChildOfType(type, parent, parentType) {
|
|
35718
|
+
var _parent$settings;
|
|
35719
|
+
if (!type) return true;
|
|
35720
|
+
if (type === 'CAMPAIGN') return parentType === 'RETAILER' && !!((_parent$settings = parent.settings) !== null && _parent$settings !== void 0 && _parent$settings.isCampaign);
|
|
35721
|
+
if (parentType === 'RETAILER' || parentType === 'SUPPLIER') return false;
|
|
35722
|
+
if (parentType === 'ASSOCIATION' && type === 'SUPPLIER') return false;
|
|
35723
|
+
return true;
|
|
35724
|
+
}
|
|
35725
|
+
|
|
35688
35726
|
function ownKeys$1R(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; }
|
|
35689
35727
|
function _objectSpread$1R(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1R(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1R(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
35690
35728
|
var SOURCE_MAPPING = {
|
|
@@ -35702,18 +35740,23 @@ var NOT_COPIED_FIELDS = ['_id', 'parent', 'parentOrganizations', 'childOrganizat
|
|
|
35702
35740
|
|
|
35703
35741
|
// bind the organization 1:1 to an external Meta or LeadTable campaign, the copy needs its own
|
|
35704
35742
|
var NOT_COPIED_CAMPAIGN_FIELDS = ['metaAdSetId', 'metaCampaignId', 'leadTableCampaignId', 'leadTableCustomerId', 'leadTableUrl'];
|
|
35705
|
-
function
|
|
35743
|
+
function getOrgs(org, inheritedParentType) {
|
|
35706
35744
|
var _org$children;
|
|
35707
|
-
var result = arguments.length >
|
|
35708
|
-
|
|
35745
|
+
var result = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
35746
|
+
var childParentType = getChildParentType(org, inheritedParentType);
|
|
35747
|
+
result.push({
|
|
35748
|
+
org: org,
|
|
35749
|
+
childParentType: childParentType
|
|
35750
|
+
});
|
|
35709
35751
|
(_org$children = org.children) === null || _org$children === void 0 || _org$children.forEach(function (child) {
|
|
35710
|
-
return
|
|
35752
|
+
return getOrgs(child, childParentType, result);
|
|
35711
35753
|
});
|
|
35712
35754
|
return result;
|
|
35713
35755
|
}
|
|
35714
35756
|
|
|
35715
35757
|
/**
|
|
35716
35758
|
* Button that asks for the parent of the copy and then opens the create form prefilled with the values of the source.
|
|
35759
|
+
* Only parents the type of the source may be created below can be chosen.
|
|
35717
35760
|
*/
|
|
35718
35761
|
var DuplicateOrganization = function DuplicateOrganization(_ref) {
|
|
35719
35762
|
var action = _ref.action,
|
|
@@ -35732,114 +35775,142 @@ var DuplicateOrganization = function DuplicateOrganization(_ref) {
|
|
|
35732
35775
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
35733
35776
|
loading = _useState4[0],
|
|
35734
35777
|
setLoading = _useState4[1];
|
|
35735
|
-
var _useState5 = useState(
|
|
35778
|
+
var _useState5 = useState(),
|
|
35736
35779
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
35737
|
-
|
|
35738
|
-
|
|
35739
|
-
var _useState7 = useState(),
|
|
35780
|
+
sourceData = _useState6[0],
|
|
35781
|
+
setSourceData = _useState6[1];
|
|
35782
|
+
var _useState7 = useState(true),
|
|
35740
35783
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
35741
|
-
|
|
35742
|
-
|
|
35743
|
-
var
|
|
35744
|
-
|
|
35745
|
-
|
|
35746
|
-
|
|
35784
|
+
sameLevel = _useState8[0],
|
|
35785
|
+
setSameLevel = _useState8[1];
|
|
35786
|
+
var _useState9 = useState(),
|
|
35787
|
+
_useState10 = _slicedToArray(_useState9, 2),
|
|
35788
|
+
otherParentId = _useState10[0],
|
|
35789
|
+
setOtherParentId = _useState10[1];
|
|
35790
|
+
var openingRef = useRef(0);
|
|
35791
|
+
var allowedParents = useMemo(function () {
|
|
35792
|
+
return sourceData ? getOrgs(tree).filter(function (_ref2) {
|
|
35793
|
+
var org = _ref2.org,
|
|
35794
|
+
childParentType = _ref2.childParentType;
|
|
35795
|
+
return canHaveChildOfType(sourceData.type, org, childParentType);
|
|
35796
|
+
}).map(function (_ref3) {
|
|
35797
|
+
var org = _ref3.org;
|
|
35798
|
+
return org;
|
|
35799
|
+
}) : [];
|
|
35800
|
+
}, [tree, sourceData]);
|
|
35801
|
+
var sameLevelAllowed = !!parent.writePermission && allowedParents.some(function (org) {
|
|
35802
|
+
return org.id === parent.id;
|
|
35803
|
+
});
|
|
35804
|
+
var writableParents = allowedParents.filter(function (org) {
|
|
35805
|
+
return org.writePermission;
|
|
35806
|
+
});
|
|
35807
|
+
var target = sameLevel ? sameLevelAllowed ? parent : undefined : writableParents.find(function (org) {
|
|
35747
35808
|
return org.id === otherParentId;
|
|
35748
35809
|
});
|
|
35749
|
-
var openDialog = function
|
|
35750
|
-
|
|
35751
|
-
|
|
35752
|
-
setOpen(true);
|
|
35753
|
-
};
|
|
35754
|
-
var openForm = /*#__PURE__*/function () {
|
|
35755
|
-
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
35756
|
-
var _sourceData$settings;
|
|
35757
|
-
var apiInterface, createUrl, sourceData, _sourceData, values, campaignSettings;
|
|
35810
|
+
var openDialog = /*#__PURE__*/function () {
|
|
35811
|
+
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
35812
|
+
var opening, data;
|
|
35758
35813
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
35759
35814
|
while (1) switch (_context.prev = _context.next) {
|
|
35760
35815
|
case 0:
|
|
35761
|
-
|
|
35762
|
-
|
|
35763
|
-
|
|
35764
|
-
|
|
35765
|
-
|
|
35766
|
-
case 2:
|
|
35767
|
-
apiInterface = action.apiInterface;
|
|
35768
|
-
createUrl = _typeof(apiInterface) == 'object' && typeof apiInterface.create == 'string' ? apiInterface.create : undefined;
|
|
35816
|
+
// a read of an earlier opening may settle after this one, only the latest opening may change the dialog
|
|
35817
|
+
opening = ++openingRef.current;
|
|
35818
|
+
setSourceData(undefined);
|
|
35819
|
+
setOtherParentId(undefined);
|
|
35820
|
+
setOpen(true);
|
|
35769
35821
|
setLoading(true);
|
|
35770
35822
|
_context.prev = 5;
|
|
35771
35823
|
_context.next = 8;
|
|
35772
35824
|
return new _default$c({
|
|
35773
|
-
apiInterface: apiInterface,
|
|
35825
|
+
apiInterface: action.apiInterface,
|
|
35774
35826
|
type: 'Button'
|
|
35775
35827
|
}, root).read(SOURCE_MAPPING, {
|
|
35776
35828
|
id: source.id
|
|
35777
35829
|
});
|
|
35778
35830
|
case 8:
|
|
35779
|
-
|
|
35780
|
-
if (
|
|
35831
|
+
data = _context.sent;
|
|
35832
|
+
if (data !== null && data !== void 0 && data._id) {
|
|
35781
35833
|
_context.next = 11;
|
|
35782
35834
|
break;
|
|
35783
35835
|
}
|
|
35784
35836
|
throw new Error("Organization ".concat(source.id, " could not be loaded"));
|
|
35785
35837
|
case 11:
|
|
35786
|
-
|
|
35787
|
-
|
|
35788
|
-
|
|
35789
|
-
|
|
35790
|
-
_context.t0 = _context["catch"](5);
|
|
35791
|
-
root.addError(t('backoffice.orgtree.duplicateAction.loadError', 'Die Organisation konnte nicht geladen werden.'));
|
|
35838
|
+
if (!(opening !== openingRef.current)) {
|
|
35839
|
+
_context.next = 13;
|
|
35840
|
+
break;
|
|
35841
|
+
}
|
|
35792
35842
|
return _context.abrupt("return");
|
|
35843
|
+
case 13:
|
|
35844
|
+
setSourceData(data);
|
|
35845
|
+
setSameLevel(!!parent.writePermission);
|
|
35846
|
+
_context.next = 23;
|
|
35847
|
+
break;
|
|
35793
35848
|
case 17:
|
|
35794
35849
|
_context.prev = 17;
|
|
35795
|
-
|
|
35796
|
-
|
|
35797
|
-
|
|
35798
|
-
|
|
35799
|
-
values = Object.fromEntries(Object.entries(sourceData).filter(function (_ref3) {
|
|
35800
|
-
var _ref4 = _slicedToArray(_ref3, 1),
|
|
35801
|
-
key = _ref4[0];
|
|
35802
|
-
return !NOT_COPIED_FIELDS.includes(key);
|
|
35803
|
-
}));
|
|
35804
|
-
campaignSettings = (_sourceData$settings = sourceData.settings) === null || _sourceData$settings === void 0 ? void 0 : _sourceData$settings.campaignSettings;
|
|
35805
|
-
if (campaignSettings) {
|
|
35806
|
-
values.settings = _objectSpread$1R(_objectSpread$1R({}, sourceData.settings), {}, {
|
|
35807
|
-
campaignSettings: Object.fromEntries(Object.entries(campaignSettings).filter(function (_ref5) {
|
|
35808
|
-
var _ref6 = _slicedToArray(_ref5, 1),
|
|
35809
|
-
key = _ref6[0];
|
|
35810
|
-
return !NOT_COPIED_CAMPAIGN_FIELDS.includes(key);
|
|
35811
|
-
}))
|
|
35812
|
-
});
|
|
35850
|
+
_context.t0 = _context["catch"](5);
|
|
35851
|
+
if (!(opening !== openingRef.current)) {
|
|
35852
|
+
_context.next = 21;
|
|
35853
|
+
break;
|
|
35813
35854
|
}
|
|
35814
|
-
|
|
35815
|
-
|
|
35816
|
-
|
|
35817
|
-
|
|
35818
|
-
|
|
35819
|
-
|
|
35820
|
-
|
|
35821
|
-
|
|
35822
|
-
|
|
35823
|
-
id: target.id
|
|
35824
|
-
},
|
|
35825
|
-
data: _objectSpread$1R(_objectSpread$1R({}, values), {}, {
|
|
35826
|
-
displayName: t('backoffice.orgtree.duplicateAction.copyName', {
|
|
35827
|
-
defaultValue: '{{name}} (Kopie)',
|
|
35828
|
-
name: sourceData.displayName
|
|
35829
|
-
})
|
|
35830
|
-
}, getNewChildData(target)),
|
|
35831
|
-
callback: onDuplicated
|
|
35832
|
-
});
|
|
35833
|
-
case 25:
|
|
35855
|
+
return _context.abrupt("return");
|
|
35856
|
+
case 21:
|
|
35857
|
+
root.addError(t('backoffice.orgtree.duplicateAction.loadError', 'Die Organisation konnte nicht geladen werden.'));
|
|
35858
|
+
setOpen(false);
|
|
35859
|
+
case 23:
|
|
35860
|
+
_context.prev = 23;
|
|
35861
|
+
if (opening === openingRef.current) setLoading(false);
|
|
35862
|
+
return _context.finish(23);
|
|
35863
|
+
case 26:
|
|
35834
35864
|
case "end":
|
|
35835
35865
|
return _context.stop();
|
|
35836
35866
|
}
|
|
35837
|
-
}, _callee, null, [[5,
|
|
35867
|
+
}, _callee, null, [[5, 17, 23, 26]]);
|
|
35838
35868
|
}));
|
|
35839
|
-
return function
|
|
35840
|
-
return
|
|
35869
|
+
return function openDialog() {
|
|
35870
|
+
return _ref4.apply(this, arguments);
|
|
35841
35871
|
};
|
|
35842
35872
|
}();
|
|
35873
|
+
var openForm = function openForm() {
|
|
35874
|
+
var _sourceData$settings;
|
|
35875
|
+
if (!target || !sourceData) return;
|
|
35876
|
+
var apiInterface = action.apiInterface;
|
|
35877
|
+
var createUrl = _typeof(apiInterface) == 'object' && typeof apiInterface.create == 'string' ? apiInterface.create : undefined;
|
|
35878
|
+
setOpen(false);
|
|
35879
|
+
var values = Object.fromEntries(Object.entries(sourceData).filter(function (_ref5) {
|
|
35880
|
+
var _ref6 = _slicedToArray(_ref5, 1),
|
|
35881
|
+
key = _ref6[0];
|
|
35882
|
+
return !NOT_COPIED_FIELDS.includes(key);
|
|
35883
|
+
}));
|
|
35884
|
+
var campaignSettings = (_sourceData$settings = sourceData.settings) === null || _sourceData$settings === void 0 ? void 0 : _sourceData$settings.campaignSettings;
|
|
35885
|
+
if (campaignSettings) {
|
|
35886
|
+
values.settings = _objectSpread$1R(_objectSpread$1R({}, sourceData.settings), {}, {
|
|
35887
|
+
campaignSettings: Object.fromEntries(Object.entries(campaignSettings).filter(function (_ref7) {
|
|
35888
|
+
var _ref8 = _slicedToArray(_ref7, 1),
|
|
35889
|
+
key = _ref8[0];
|
|
35890
|
+
return !NOT_COPIED_CAMPAIGN_FIELDS.includes(key);
|
|
35891
|
+
}))
|
|
35892
|
+
});
|
|
35893
|
+
}
|
|
35894
|
+
root.detailStore.openRightDetail({
|
|
35895
|
+
configurationId: action.id,
|
|
35896
|
+
type: action.type,
|
|
35897
|
+
title: typeof action.title == 'function' ? action.title(source) : action.title,
|
|
35898
|
+
// the form fills ${parentId} from the mapping data
|
|
35899
|
+
apiInterface: {
|
|
35900
|
+
create: createUrl === null || createUrl === void 0 ? void 0 : createUrl.replace('${organizationId}', encodeURIComponent(source.id))
|
|
35901
|
+
},
|
|
35902
|
+
mappingData: {
|
|
35903
|
+
id: target.id
|
|
35904
|
+
},
|
|
35905
|
+
data: _objectSpread$1R(_objectSpread$1R({}, values), {}, {
|
|
35906
|
+
displayName: t('backoffice.orgtree.duplicateAction.copyName', {
|
|
35907
|
+
defaultValue: '{{name}} (Kopie)',
|
|
35908
|
+
name: sourceData.displayName
|
|
35909
|
+
})
|
|
35910
|
+
}, getNewChildData(target)),
|
|
35911
|
+
callback: onDuplicated
|
|
35912
|
+
});
|
|
35913
|
+
};
|
|
35843
35914
|
return (
|
|
35844
35915
|
/*#__PURE__*/
|
|
35845
35916
|
// the dialog is rendered inside the tree node, keep its clicks from selecting the node
|
|
@@ -35859,9 +35930,9 @@ var DuplicateOrganization = function DuplicateOrganization(_ref) {
|
|
|
35859
35930
|
okText: t('backoffice.orgtree.duplicateAction.ok', 'Weiter'),
|
|
35860
35931
|
cancelText: t('backoffice.orgtree.duplicateAction.cancel', 'Abbrechen'),
|
|
35861
35932
|
okButtonProps: {
|
|
35862
|
-
disabled: !target
|
|
35933
|
+
disabled: !target,
|
|
35934
|
+
loading: loading
|
|
35863
35935
|
},
|
|
35864
|
-
confirmLoading: loading,
|
|
35865
35936
|
onOk: openForm,
|
|
35866
35937
|
onCancel: function onCancel() {
|
|
35867
35938
|
return setOpen(false);
|
|
@@ -35873,6 +35944,7 @@ var DuplicateOrganization = function DuplicateOrganization(_ref) {
|
|
|
35873
35944
|
},
|
|
35874
35945
|
children: [/*#__PURE__*/jsx(Radio.Group, {
|
|
35875
35946
|
value: sameLevel,
|
|
35947
|
+
disabled: !sourceData,
|
|
35876
35948
|
onChange: function onChange(e) {
|
|
35877
35949
|
return setSameLevel(e.target.value);
|
|
35878
35950
|
},
|
|
@@ -35880,7 +35952,7 @@ var DuplicateOrganization = function DuplicateOrganization(_ref) {
|
|
|
35880
35952
|
direction: "vertical",
|
|
35881
35953
|
children: [/*#__PURE__*/jsx(Radio, {
|
|
35882
35954
|
value: true,
|
|
35883
|
-
disabled: !
|
|
35955
|
+
disabled: !sameLevelAllowed,
|
|
35884
35956
|
children: t('backoffice.orgtree.duplicateAction.sameLevel', {
|
|
35885
35957
|
defaultValue: 'Gleiche Ebene ({{parent}})',
|
|
35886
35958
|
parent: parent.displayName
|
|
@@ -35902,7 +35974,7 @@ var DuplicateOrganization = function DuplicateOrganization(_ref) {
|
|
|
35902
35974
|
var _option$label;
|
|
35903
35975
|
return ((_option$label = option === null || option === void 0 ? void 0 : option.label) !== null && _option$label !== void 0 ? _option$label : '').toLowerCase().includes(input.toLowerCase());
|
|
35904
35976
|
},
|
|
35905
|
-
options:
|
|
35977
|
+
options: writableParents.map(function (org) {
|
|
35906
35978
|
return {
|
|
35907
35979
|
value: org.id,
|
|
35908
35980
|
label: org.displayName
|
|
@@ -35947,6 +36019,11 @@ var OrgItem = function OrgItem(_ref) {
|
|
|
35947
36019
|
var _useTranslation = useTranslation(),
|
|
35948
36020
|
t = _useTranslation.t;
|
|
35949
36021
|
var root = useStore();
|
|
36022
|
+
var _useDivaCore = useDivaCore(),
|
|
36023
|
+
userHasPermission = _useDivaCore.actions.userHasPermission;
|
|
36024
|
+
// end customers cannot set the organization type (and its API2 servers) in the create form, so they may only copy shells and retailer channels;
|
|
36025
|
+
// campaigns show as RETAILERCHILD too but store their own type
|
|
36026
|
+
var canDuplicate = (!data.type || data.type === 'RETAILERCHILD') && !data.storedType || userHasPermission('backoffice_admin_organizations');
|
|
35950
36027
|
return /*#__PURE__*/jsxs("div", {
|
|
35951
36028
|
id: data.id,
|
|
35952
36029
|
className: classNames(label$4, itemChain.find(function (i) {
|
|
@@ -35979,7 +36056,7 @@ var OrgItem = function OrgItem(_ref) {
|
|
|
35979
36056
|
setUpdate(update + 1);
|
|
35980
36057
|
(_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);
|
|
35981
36058
|
}
|
|
35982
|
-
}, "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, {
|
|
36059
|
+
}, "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, {
|
|
35983
36060
|
action: configuration.duplicateAction,
|
|
35984
36061
|
source: data,
|
|
35985
36062
|
parent: itemChain[itemChain.length - 2],
|
|
@@ -93865,6 +93942,7 @@ function Router() {
|
|
|
93865
93942
|
}
|
|
93866
93943
|
var Router$1 = observer(Router);
|
|
93867
93944
|
|
|
93945
|
+
var CLEAR_BUTTONS = 'button.ant-select-clear, button.ant-input-clear-icon, button.ant-picker-clear, .ant-color-picker-clear';
|
|
93868
93946
|
var MainLayout = function MainLayout(_ref) {
|
|
93869
93947
|
var _ref$navigation = _ref.navigation,
|
|
93870
93948
|
navigation = _ref$navigation === void 0 ? /*#__PURE__*/jsx(Navigation$4, {}) : _ref$navigation,
|
|
@@ -93883,6 +93961,19 @@ var MainLayout = function MainLayout(_ref) {
|
|
|
93883
93961
|
header.classList.toggle('lightmode', !isDark);
|
|
93884
93962
|
}
|
|
93885
93963
|
}, [root.contentStore.theme]);
|
|
93964
|
+
useEffect(function () {
|
|
93965
|
+
// Capture phase: runs before the browser moves the focus, so a clear button rendered since the last Tab is skipped as well
|
|
93966
|
+
var skipClearButtons = function skipClearButtons(e) {
|
|
93967
|
+
if (e.key != 'Tab') return;
|
|
93968
|
+
document.querySelectorAll(CLEAR_BUTTONS).forEach(function (clear) {
|
|
93969
|
+
return clear.tabIndex = -1;
|
|
93970
|
+
});
|
|
93971
|
+
};
|
|
93972
|
+
document.addEventListener('keydown', skipClearButtons, true);
|
|
93973
|
+
return function () {
|
|
93974
|
+
return document.removeEventListener('keydown', skipClearButtons, true);
|
|
93975
|
+
};
|
|
93976
|
+
}, []);
|
|
93886
93977
|
return /*#__PURE__*/jsx(ConfigProvider, {
|
|
93887
93978
|
theme: {
|
|
93888
93979
|
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.13.0-rc.
|
|
3
|
+
"version": "26.13.0-rc.10",
|
|
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.13.0-rc.
|
|
20
|
-
"@crystaldesign/content-box": "26.13.0-rc.
|
|
21
|
-
"@crystaldesign/content-item": "26.13.0-rc.
|
|
22
|
-
"@crystaldesign/diva-agent": "26.13.0-rc.
|
|
23
|
-
"@crystaldesign/diva-core": "26.13.0-rc.
|
|
24
|
-
"@crystaldesign/diva-utils": "26.13.0-rc.
|
|
25
|
-
"@crystaldesign/mass-configurator": "26.13.0-rc.
|
|
26
|
-
"@crystaldesign/media-upload": "26.13.0-rc.
|
|
27
|
-
"@crystaldesign/rtf-editor": "26.13.0-rc.
|
|
28
|
-
"@crystaldesign/spreadsheet": "26.13.0-rc.
|
|
19
|
+
"@crystaldesign/classification": "26.13.0-rc.10",
|
|
20
|
+
"@crystaldesign/content-box": "26.13.0-rc.10",
|
|
21
|
+
"@crystaldesign/content-item": "26.13.0-rc.10",
|
|
22
|
+
"@crystaldesign/diva-agent": "26.13.0-rc.10",
|
|
23
|
+
"@crystaldesign/diva-core": "26.13.0-rc.10",
|
|
24
|
+
"@crystaldesign/diva-utils": "26.13.0-rc.10",
|
|
25
|
+
"@crystaldesign/mass-configurator": "26.13.0-rc.10",
|
|
26
|
+
"@crystaldesign/media-upload": "26.13.0-rc.10",
|
|
27
|
+
"@crystaldesign/rtf-editor": "26.13.0-rc.10",
|
|
28
|
+
"@crystaldesign/spreadsheet": "26.13.0-rc.10",
|
|
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": "3bd1a13e37c171cb6494f7aaf547d7af7b84b3e5"
|
|
67
67
|
}
|