@crystaldesign/diva-backoffice 25.8.0-beta.20 → 25.8.0-beta.21

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.
@@ -123,6 +123,7 @@ import WarningOutlined from '@ant-design/icons/lib/icons/WarningOutlined';
123
123
  import Modal$3 from 'antd/es/modal';
124
124
  import Spin$1 from 'antd/es/spin';
125
125
  import Flex from 'antd/es/flex';
126
+ import { useTranslation as useTranslation$1 } from 'react-i18next';
126
127
  import JSZip from 'jszip';
127
128
  import { DropzoneAreaBase } from 'react-mui-dropzone';
128
129
  import Switch$1 from 'antd/es/switch';
@@ -17039,7 +17040,7 @@ var JsonEditor$2 = function JsonEditor(_ref) {
17039
17040
  });
17040
17041
  };
17041
17042
 
17042
- var _excluded$3 = ["key", "name"];
17043
+ var _excluded$4 = ["key", "name"];
17043
17044
  function ownKeys$U(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; }
17044
17045
  function _objectSpread$U(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$U(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$U(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17045
17046
  var FormList$2 = function FormList(_ref) {
@@ -17075,7 +17076,7 @@ var FormList$2 = function FormList(_ref) {
17075
17076
  children: [fields.map(function (_ref3) {
17076
17077
  var key = _ref3.key,
17077
17078
  name = _ref3.name,
17078
- restField = _objectWithoutProperties(_ref3, _excluded$3);
17079
+ restField = _objectWithoutProperties(_ref3, _excluded$4);
17079
17080
  return /*#__PURE__*/jsxs("div", {
17080
17081
  id: key.toString(),
17081
17082
  style: {
@@ -17617,7 +17618,7 @@ var wrapper$6 = "wrapper-4xyke";
17617
17618
  var css_248z$u = ".wrapper-4xyke {\n display: flex;\n flex-direction: column;\n min-height: 50px;\n justify-content: flex-end;\n font-size: 12px;\n}\n";
17618
17619
  styleInject(css_248z$u);
17619
17620
 
17620
- var _excluded$2 = ["apiInterface", "selectMapping", "apiMapping", "onChange", "value", "search", "options", "autoSelectFirst", "title", "sharedState"];
17621
+ var _excluded$3 = ["apiInterface", "selectMapping", "apiMapping", "onChange", "value", "search", "options", "autoSelectFirst", "title", "sharedState"];
17621
17622
  function ownKeys$S(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; }
17622
17623
  function _objectSpread$S(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$S(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$S(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
17623
17624
  var SelectWrapper$1 = function SelectWrapper(_ref, ref) {
@@ -17631,7 +17632,7 @@ var SelectWrapper$1 = function SelectWrapper(_ref, ref) {
17631
17632
  autoSelectFirst = _ref.autoSelectFirst,
17632
17633
  title = _ref.title,
17633
17634
  sharedState = _ref.sharedState,
17634
- selectProps = _objectWithoutProperties(_ref, _excluded$2);
17635
+ selectProps = _objectWithoutProperties(_ref, _excluded$3);
17635
17636
  var state = useSelectSimpleData({
17636
17637
  apiInterface: apiInterface,
17637
17638
  selectMapping: selectMapping,
@@ -25631,7 +25632,7 @@ function LinkCell (_ref) {
25631
25632
  }
25632
25633
  }
25633
25634
 
25634
- var _excluded$1 = ["index"],
25635
+ var _excluded$2 = ["index"],
25635
25636
  _excluded2 = ["children", "dataIndex", "record", "handleSave", "column"];
25636
25637
  function ownKeys$y(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; }
25637
25638
  function _objectSpread$y(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$y(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$y(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -25639,7 +25640,7 @@ var LOG$4 = getLogger('Backoffice', 'CellRenderer');
25639
25640
  var EditableContext = /*#__PURE__*/React.createContext(null);
25640
25641
  var CustomRow = function CustomRow(_ref) {
25641
25642
  _ref.index;
25642
- var props = _objectWithoutProperties(_ref, _excluded$1);
25643
+ var props = _objectWithoutProperties(_ref, _excluded$2);
25643
25644
  var _Form$useForm = Form$1.useForm(),
25644
25645
  _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
25645
25646
  form = _Form$useForm2[0];
@@ -27528,7 +27529,7 @@ function filter(f, data) {
27528
27529
  }) : result;
27529
27530
  }
27530
27531
 
27531
- var _excluded = ["_id"];
27532
+ var _excluded$1 = ["_id"];
27532
27533
  function ownKeys$t(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; }
27533
27534
  function _objectSpread$t(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$t(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$t(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
27534
27535
  function useTableData$1 (_ref) {
@@ -27612,7 +27613,7 @@ function useTableData$1 (_ref) {
27612
27613
  setState(newState);
27613
27614
  var formData = new FormData();
27614
27615
  processedDataRow._id;
27615
- var value = _objectWithoutProperties(processedDataRow, _excluded);
27616
+ var value = _objectWithoutProperties(processedDataRow, _excluded$1);
27616
27617
  apiHandler.create(undefined, (_configuration$create = configuration.createMapping) !== null && _configuration$create !== void 0 ? _configuration$create : configuration.mapping, _objectSpread$t(_objectSpread$t({}, catalogItem), {}, {
27617
27618
  filterContex: filterContex,
27618
27619
  value: JSON.stringify([value])
@@ -34873,24 +34874,24 @@ function getPriceFeatureGroups(selectedSerie, language) {
34873
34874
  if (!(selectedSerie !== null && selectedSerie !== void 0 && selectedSerie.pricefeaturegroups)) {
34874
34875
  return [];
34875
34876
  }
34876
- var priceFeatureGroups = (_selectedSerie$pricef = selectedSerie.pricefeaturegroups) === null || _selectedSerie$pricef === void 0 ? void 0 : _selectedSerie$pricef.map(function (priceFeatureGroups, i) {
34877
+ var priceFeatureGroups = (_selectedSerie$pricef = selectedSerie.pricefeaturegroups) === null || _selectedSerie$pricef === void 0 ? void 0 : _selectedSerie$pricef.map(function (priceFeatureGroupKey, i) {
34877
34878
  var _selectedSerie$pricef2, _selectedSerie$pricef3;
34878
34879
  return {
34879
- id: priceFeatureGroups,
34880
- displayText: (_selectedSerie$pricef2 = (_selectedSerie$pricef3 = selectedSerie.pricefeaturegroupsDisplayTexts) === null || _selectedSerie$pricef3 === void 0 || (_selectedSerie$pricef3 = _selectedSerie$pricef3[i]) === null || _selectedSerie$pricef3 === void 0 ? void 0 : _selectedSerie$pricef3[language.toUpperCase()]) !== null && _selectedSerie$pricef2 !== void 0 ? _selectedSerie$pricef2 : priceFeatureGroups,
34880
+ id: 'PRFG' + priceFeatureGroupKey,
34881
+ displayText: (_selectedSerie$pricef2 = (_selectedSerie$pricef3 = selectedSerie.pricefeaturegroupsDisplayTexts) === null || _selectedSerie$pricef3 === void 0 || (_selectedSerie$pricef3 = _selectedSerie$pricef3[i]) === null || _selectedSerie$pricef3 === void 0 ? void 0 : _selectedSerie$pricef3[language.toUpperCase()]) !== null && _selectedSerie$pricef2 !== void 0 ? _selectedSerie$pricef2 : priceFeatureGroupKey,
34881
34882
  keys: [],
34882
34883
  keysDisplayTexts: []
34883
34884
  };
34884
34885
  });
34885
- (_selectedSerie$pricef4 = selectedSerie.pricefeaturegroupsKeys) === null || _selectedSerie$pricef4 === void 0 || _selectedSerie$pricef4.forEach(function (priceFeatureGroupKey, i) {
34886
- var pfgSplit = priceFeatureGroupKey.split('_');
34887
- var pfgId = pfgSplit[0].replace('PRFG', '');
34886
+ (_selectedSerie$pricef4 = selectedSerie.pricefeaturegroupsKeys) === null || _selectedSerie$pricef4 === void 0 || _selectedSerie$pricef4.forEach(function (priceGroupKey, i) {
34887
+ var pfgSplit = priceGroupKey.split('_');
34888
+ var pfgId = pfgSplit[0];
34888
34889
  var pfg = priceFeatureGroups.find(function (pfg) {
34889
34890
  return pfg.id == pfgId;
34890
34891
  });
34891
34892
  if (pfg) {
34892
34893
  var _selectedSerie$pricef5;
34893
- pfg.keys.push(priceFeatureGroupKey);
34894
+ pfg.keys.push(priceGroupKey);
34894
34895
  pfg.keysDisplayTexts.push((_selectedSerie$pricef5 = selectedSerie.pricefeaturegroupsKeysDisplayTexts) === null || _selectedSerie$pricef5 === void 0 || (_selectedSerie$pricef5 = _selectedSerie$pricef5[i]) === null || _selectedSerie$pricef5 === void 0 ? void 0 : _selectedSerie$pricef5[language.toUpperCase()]);
34895
34896
  }
34896
34897
  });
@@ -34903,18 +34904,33 @@ var disabled$1 = "disabled-Llkqu";
34903
34904
  var css_248z$b = ".wrapper-5t6RT {\n display: flex;\n flex-direction: column;\n min-height: 50px;\n justify-content: flex-end;\n font-size: 12px;\n}\n\n.input-leHam {\n position: relative;\n width: 200px;\n height: 32px;\n border: 1px solid #d9d9d9;\n background: #ffffff;\n padding: 0 11px;\n border-radius: 6px;\n font-size: 14px;\n line-height: 30px;\n cursor: pointer;\n}\n\n.darkmode .input-leHam {\n background: #141414;\n border: 1px solid #424242;\n}\n\n.input-leHam.disabled-Llkqu {\n cursor: default;\n color: rgba(0, 0, 0, 0.25);\n}\n\n.darkmode .input-leHam.disabled-Llkqu {\n color: rgba(255, 255, 255, 0.25);\n}\n\n.input-leHam:hover {\n border-color: #4096ff;\n}\n";
34904
34905
  styleInject(css_248z$b);
34905
34906
 
34907
+ var _excluded = ["onSave", "value"];
34906
34908
  function ownKeys$d(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; }
34907
34909
  function _objectSpread$d(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$d(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$d(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
34908
- function PriceFactorInput(props) {
34910
+ function PriceFactorInput(_ref) {
34911
+ var _onSave = _ref.onSave,
34912
+ value = _ref.value,
34913
+ props = _objectWithoutProperties(_ref, _excluded);
34914
+ var _useState = useState(value),
34915
+ _useState2 = _slicedToArray(_useState, 2),
34916
+ innerValue = _useState2[0],
34917
+ setInnerValue = _useState2[1];
34918
+ useEffect(function () {
34919
+ setInnerValue(value);
34920
+ }, [value]);
34909
34921
  return /*#__PURE__*/jsxs("div", {
34910
34922
  className: classnames(wrapper$3, props.className),
34911
34923
  children: [props.title, /*#__PURE__*/jsx(Tooltip$1, {
34912
34924
  title: props.tooltip,
34913
34925
  children: /*#__PURE__*/jsx("div", {
34914
- id: "price-factor-input",
34915
- className: classnames(input, _defineProperty({}, disabled$1, props.disabled)),
34926
+ className: classnames(input, 'price-factor-input', _defineProperty({}, disabled$1, props.disabled)),
34916
34927
  children: /*#__PURE__*/jsx(PriceFactorCellRenderer, _objectSpread$d(_objectSpread$d({}, props), {}, {
34917
- isNotInAGGrid: true
34928
+ isNotInAGGrid: true,
34929
+ value: innerValue,
34930
+ onSave: function onSave(data, value) {
34931
+ setInnerValue(value);
34932
+ return _onSave(data, value);
34933
+ }
34918
34934
  }))
34919
34935
  })
34920
34936
  })]
@@ -34923,9 +34939,46 @@ function PriceFactorInput(props) {
34923
34939
 
34924
34940
  var inputHeader = "input-header--4KDP";
34925
34941
  var factorInput = "factor-input-MX85Z";
34926
- var css_248z$a = ".input-header--4KDP .ag-header-cell-text {\n width: 100%;\n}\n\n.factor-input-MX85Z {\n min-height: 0;\n flex: 1;\n}\n\n.factor-input-MX85Z #price-factor-input {\n width: 100%;\n background-color: var(--ag-input-background-color);\n border: var(--ag-input-border);\n border-radius: var(--ag-input-border-radius);\n color: var(--ag-input-text-color);\n height: var(--ag-input-height);\n line-height: var(--ag-input-height);\n font-size: var(--ag-font-size);\n}\n\n.factor-input-MX85Z #price-factor-input:hover {\n border-color: #4096ff;\n}\n";
34942
+ var css_248z$a = ".input-header--4KDP .ag-header-cell-text {\n width: 100%;\n}\n\n.input-header--4KDP .ag-header-group-cell-label {\n width: 100%;\n max-width: 250px;\n}\n\n.input-header--4KDP .ag-header-group-text {\n width: 100%;\n}\n\n.factor-input-MX85Z {\n min-height: 0;\n flex: 1;\n}\n\n.factor-input-MX85Z .price-factor-input {\n width: 100%;\n background-color: var(--ag-input-background-color);\n border: var(--ag-input-border);\n border-radius: var(--ag-input-border-radius);\n color: var(--ag-input-text-color);\n height: var(--ag-input-height);\n line-height: var(--ag-input-height);\n font-size: var(--ag-font-size);\n}\n\n.factor-input-MX85Z .price-factor-input:hover {\n border-color: #4096ff;\n}\n";
34927
34943
  styleInject(css_248z$a);
34928
34944
 
34945
+ function PriceFactorHeaderComponent(_ref) {
34946
+ var onSave = _ref.onSave,
34947
+ onPriorityChange = _ref.onPriorityChange,
34948
+ priority = _ref.priority,
34949
+ priorityForced = _ref.priorityForced,
34950
+ value = _ref.value,
34951
+ inputTooltip = _ref.inputTooltip,
34952
+ checkboxTooltip = _ref.checkboxTooltip;
34953
+ var _useTranslation = useTranslation$1(),
34954
+ t = _useTranslation.t;
34955
+ var _useState = useState(priority || priorityForced),
34956
+ _useState2 = _slicedToArray(_useState, 2),
34957
+ innerChecked = _useState2[0],
34958
+ setInnerChecked = _useState2[1];
34959
+ useEffect(function () {
34960
+ setInnerChecked(priority || priorityForced);
34961
+ }, [priority, priorityForced]);
34962
+ return /*#__PURE__*/jsxs(Fragment, {
34963
+ children: [/*#__PURE__*/jsx(PriceFactorInput, {
34964
+ onSave: onSave,
34965
+ value: value,
34966
+ className: factorInput,
34967
+ tooltip: t(inputTooltip)
34968
+ }), /*#__PURE__*/jsx(Tooltip$1, {
34969
+ title: t("".concat(checkboxTooltip, ".").concat(priorityForced ? 'forced' : priority ? 'true' : 'false')),
34970
+ children: /*#__PURE__*/jsx(Checkbox, {
34971
+ checked: innerChecked,
34972
+ disabled: priorityForced,
34973
+ onChange: function onChange(e) {
34974
+ setInnerChecked(e.target.checked);
34975
+ onPriorityChange(e.target.checked);
34976
+ }
34977
+ })
34978
+ })]
34979
+ });
34980
+ }
34981
+
34929
34982
  function ownKeys$c(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; }
34930
34983
  function _objectSpread$c(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$c(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$c(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
34931
34984
  var Prices = observer(function (_ref) {
@@ -34940,6 +34993,77 @@ var Prices = observer(function (_ref) {
34940
34993
  t = _useTranslation.t;
34941
34994
  var _useEnricherContext = useEnricherContext(['pricelists']),
34942
34995
  selectedSerie = _useEnricherContext.selectedSerie;
34996
+ var updatePfgPriceFactor = useCallback(function (priceFeatureGroupItem, value) {
34997
+ if (!selectedSerie) return;
34998
+
34999
+ // Create copies of the objects to modify
35000
+ var newFactors = _objectSpread$c({}, pricelist.pfgPricefactors);
35001
+ var serieFactors = _objectSpread$c({}, newFactors[selectedSerie.serieNo]);
35002
+ if (value.length === 0) {
35003
+ // Remove the empty price feature group
35004
+ delete serieFactors[priceFeatureGroupItem];
35005
+
35006
+ // If serie factors is now empty, remove the entire serie entry
35007
+ if (Object.keys(serieFactors).length === 0) {
35008
+ delete newFactors[selectedSerie.serieNo];
35009
+ } else {
35010
+ newFactors[selectedSerie.serieNo] = serieFactors;
35011
+ }
35012
+
35013
+ // If no more series exist, set pfgPricefactors to undefined
35014
+ if (Object.keys(newFactors).length === 0) {
35015
+ setNodeDataValue({
35016
+ pfgPricefactors: undefined
35017
+ });
35018
+ return;
35019
+ }
35020
+ } else {
35021
+ // Add/update the value
35022
+ serieFactors[priceFeatureGroupItem] = value;
35023
+ newFactors[selectedSerie.serieNo] = serieFactors;
35024
+ }
35025
+ setNodeDataValue({
35026
+ pfgPricefactors: newFactors
35027
+ });
35028
+ }, [selectedSerie]);
35029
+ var updatePfgPriority = useCallback(function (priceFeatureGroupItem, value) {
35030
+ var _newPriority$selected;
35031
+ if (!selectedSerie) return;
35032
+ var newPriority = _objectSpread$c({}, pricelist.pfgPricefactorsPriority);
35033
+ var seriesPriority = new Set((_newPriority$selected = newPriority[selectedSerie.serieNo]) !== null && _newPriority$selected !== void 0 ? _newPriority$selected : []);
35034
+ if (value === true) {
35035
+ seriesPriority.add(priceFeatureGroupItem);
35036
+ } else {
35037
+ seriesPriority["delete"](priceFeatureGroupItem);
35038
+ }
35039
+ if (seriesPriority.size === 0) {
35040
+ delete newPriority[selectedSerie.serieNo];
35041
+ } else {
35042
+ newPriority[selectedSerie.serieNo] = Array.from(seriesPriority);
35043
+ }
35044
+ setNodeDataValue({
35045
+ pfgPricefactorsPriority: newPriority
35046
+ });
35047
+ }, [selectedSerie]);
35048
+ var updatePgPriority = useCallback(function (priceFeatureGroupItem, value) {
35049
+ var _newPriority$selected2;
35050
+ if (!selectedSerie) return;
35051
+ var newPriority = _objectSpread$c({}, pricelist.pgPricefactorsPriority);
35052
+ var seriesPriority = new Set((_newPriority$selected2 = newPriority[selectedSerie.serieNo]) !== null && _newPriority$selected2 !== void 0 ? _newPriority$selected2 : []);
35053
+ if (value === true) {
35054
+ seriesPriority.add(priceFeatureGroupItem);
35055
+ } else {
35056
+ seriesPriority["delete"](priceFeatureGroupItem);
35057
+ }
35058
+ if (seriesPriority.size === 0) {
35059
+ delete newPriority[selectedSerie.serieNo];
35060
+ } else {
35061
+ newPriority[selectedSerie.serieNo] = Array.from(seriesPriority);
35062
+ }
35063
+ setNodeDataValue({
35064
+ pgPricefactorsPriority: newPriority
35065
+ });
35066
+ }, [selectedSerie]);
34943
35067
  var updatePgPriceFactor = useCallback(function (priceFeatureGroupItem, value) {
34944
35068
  if (!selectedSerie) return;
34945
35069
 
@@ -35174,15 +35298,56 @@ var Prices = observer(function (_ref) {
35174
35298
  sortable: false,
35175
35299
  editable: false
35176
35300
  }].concat(_toConsumableArray((_priceFeatureGroups$m = priceFeatureGroups === null || priceFeatureGroups === void 0 ? void 0 : priceFeatureGroups.map(function (priceFeatureGroup) {
35177
- var _priceFeatureGroup$ke, _priceFeatureGroup$ke2;
35301
+ var _pricelist$pfgPricefa, _pricelist$pfgPricefa2, _priceFeatureGroup$ke, _priceFeatureGroup$ke2;
35178
35302
  return {
35179
35303
  headerName: priceFeatureGroup.displayText,
35304
+ headerClass: inputHeader,
35305
+ headerGroupComponentParams: {
35306
+ additionalElement: /*#__PURE__*/jsx(PriceFactorHeaderComponent, {
35307
+ onSave: (/*#__PURE__*/function () {
35308
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data, value) {
35309
+ return _regeneratorRuntime.wrap(function _callee3$(_context3) {
35310
+ while (1) switch (_context3.prev = _context3.next) {
35311
+ case 0:
35312
+ updatePfgPriceFactor(priceFeatureGroup.id, value);
35313
+ case 1:
35314
+ case "end":
35315
+ return _context3.stop();
35316
+ }
35317
+ }, _callee3);
35318
+ }));
35319
+ return function (_x5, _x6) {
35320
+ return _ref4.apply(this, arguments);
35321
+ };
35322
+ }()),
35323
+ value: (_pricelist$pfgPricefa = pricelist.pfgPricefactors) === null || _pricelist$pfgPricefa === void 0 || (_pricelist$pfgPricefa = _pricelist$pfgPricefa[selectedSerie === null || selectedSerie === void 0 ? void 0 : selectedSerie.serieNo]) === null || _pricelist$pfgPricefa === void 0 ? void 0 : _pricelist$pfgPricefa[priceFeatureGroup.id],
35324
+ onPriorityChange: (/*#__PURE__*/function () {
35325
+ var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(value) {
35326
+ return _regeneratorRuntime.wrap(function _callee4$(_context4) {
35327
+ while (1) switch (_context4.prev = _context4.next) {
35328
+ case 0:
35329
+ updatePfgPriority(priceFeatureGroup.id, value);
35330
+ case 1:
35331
+ case "end":
35332
+ return _context4.stop();
35333
+ }
35334
+ }, _callee4);
35335
+ }));
35336
+ return function (_x7) {
35337
+ return _ref5.apply(this, arguments);
35338
+ };
35339
+ }()),
35340
+ priority: !!((_pricelist$pfgPricefa2 = pricelist.pfgPricefactorsPriority) !== null && _pricelist$pfgPricefa2 !== void 0 && (_pricelist$pfgPricefa2 = _pricelist$pfgPricefa2[selectedSerie === null || selectedSerie === void 0 ? void 0 : selectedSerie.serieNo]) !== null && _pricelist$pfgPricefa2 !== void 0 && _pricelist$pfgPricefa2.includes(priceFeatureGroup.id)),
35341
+ inputTooltip: 'backoffice.idmCatalog.prices.priceFactor.label.pfg',
35342
+ checkboxTooltip: 'backoffice.idmCatalog.prices.priceFactor.label.pfgPriority'
35343
+ })
35344
+ },
35180
35345
  marryChildren: true,
35181
- children: _toConsumableArray((_priceFeatureGroup$ke = (_priceFeatureGroup$ke2 = priceFeatureGroup.keys) === null || _priceFeatureGroup$ke2 === void 0 ? void 0 : _priceFeatureGroup$ke2.map(function (priceFeatureGroupItem, j) {
35182
- var _priceFeatureGroup$ke3, _pricelist$pgPricefac;
35346
+ children: _toConsumableArray((_priceFeatureGroup$ke = (_priceFeatureGroup$ke2 = priceFeatureGroup.keys) === null || _priceFeatureGroup$ke2 === void 0 ? void 0 : _priceFeatureGroup$ke2.map(function (priceGroup, j) {
35347
+ var _priceFeatureGroup$ke3, _pricelist$pgPricefac, _pricelist$pgPricefac2, _pricelist$pfgPricefa3;
35183
35348
  return {
35184
- headerName: priceFeatureGroupItem,
35185
- field: "prices.".concat(priceFeatureGroupItem),
35349
+ headerName: priceGroup,
35350
+ field: "prices.".concat(priceGroup),
35186
35351
  editable: !viewOnly,
35187
35352
  filter: false,
35188
35353
  sortable: false,
@@ -35192,31 +35357,49 @@ var Prices = observer(function (_ref) {
35192
35357
  cellRenderer: PriceDisplayCellRenderer,
35193
35358
  cellRendererParams: {
35194
35359
  commas: pricelist.commas,
35195
- item: priceFeatureGroupItem
35360
+ item: priceGroup
35196
35361
  },
35197
- additionalFields: ["origPrices.".concat(priceFeatureGroupItem)],
35362
+ additionalFields: ["origPrices.".concat(priceGroup)],
35198
35363
  headerClass: inputHeader,
35199
35364
  headerComponentParams: {
35200
- additionalElement: /*#__PURE__*/jsx(PriceFactorInput, {
35365
+ additionalElement: /*#__PURE__*/jsx(PriceFactorHeaderComponent, {
35201
35366
  onSave: (/*#__PURE__*/function () {
35202
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(data, value) {
35203
- return _regeneratorRuntime.wrap(function _callee3$(_context3) {
35204
- while (1) switch (_context3.prev = _context3.next) {
35367
+ var _ref6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(data, value) {
35368
+ return _regeneratorRuntime.wrap(function _callee5$(_context5) {
35369
+ while (1) switch (_context5.prev = _context5.next) {
35370
+ case 0:
35371
+ updatePgPriceFactor(priceGroup, value);
35372
+ case 1:
35373
+ case "end":
35374
+ return _context5.stop();
35375
+ }
35376
+ }, _callee5);
35377
+ }));
35378
+ return function (_x8, _x9) {
35379
+ return _ref6.apply(this, arguments);
35380
+ };
35381
+ }()),
35382
+ value: (_pricelist$pgPricefac = pricelist.pgPricefactors) === null || _pricelist$pgPricefac === void 0 || (_pricelist$pgPricefac = _pricelist$pgPricefac[selectedSerie === null || selectedSerie === void 0 ? void 0 : selectedSerie.serieNo]) === null || _pricelist$pgPricefac === void 0 ? void 0 : _pricelist$pgPricefac[priceGroup],
35383
+ onPriorityChange: (/*#__PURE__*/function () {
35384
+ var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(value) {
35385
+ return _regeneratorRuntime.wrap(function _callee6$(_context6) {
35386
+ while (1) switch (_context6.prev = _context6.next) {
35205
35387
  case 0:
35206
- updatePgPriceFactor(priceFeatureGroupItem, value);
35388
+ updatePgPriority(priceGroup, value);
35207
35389
  case 1:
35208
35390
  case "end":
35209
- return _context3.stop();
35391
+ return _context6.stop();
35210
35392
  }
35211
- }, _callee3);
35393
+ }, _callee6);
35212
35394
  }));
35213
- return function (_x5, _x6) {
35214
- return _ref4.apply(this, arguments);
35395
+ return function (_x10) {
35396
+ return _ref7.apply(this, arguments);
35215
35397
  };
35216
35398
  }()),
35217
- value: (_pricelist$pgPricefac = pricelist.pgPricefactors) === null || _pricelist$pgPricefac === void 0 || (_pricelist$pgPricefac = _pricelist$pgPricefac[selectedSerie === null || selectedSerie === void 0 ? void 0 : selectedSerie.serieNo]) === null || _pricelist$pgPricefac === void 0 ? void 0 : _pricelist$pgPricefac[priceFeatureGroupItem],
35218
- className: factorInput,
35219
- tooltip: t('backoffice.idmCatalog.prices.priceFactor.label.pfg')
35399
+ priority: !!((_pricelist$pgPricefac2 = pricelist.pgPricefactorsPriority) !== null && _pricelist$pgPricefac2 !== void 0 && (_pricelist$pgPricefac2 = _pricelist$pgPricefac2[selectedSerie === null || selectedSerie === void 0 ? void 0 : selectedSerie.serieNo]) !== null && _pricelist$pgPricefac2 !== void 0 && _pricelist$pgPricefac2.includes(priceGroup)),
35400
+ priorityForced: !!((_pricelist$pfgPricefa3 = pricelist.pfgPricefactorsPriority) !== null && _pricelist$pfgPricefa3 !== void 0 && (_pricelist$pfgPricefa3 = _pricelist$pfgPricefa3[selectedSerie === null || selectedSerie === void 0 ? void 0 : selectedSerie.serieNo]) !== null && _pricelist$pfgPricefa3 !== void 0 && _pricelist$pfgPricefa3.includes(priceFeatureGroup.id)),
35401
+ inputTooltip: 'backoffice.idmCatalog.prices.priceFactor.label.pg',
35402
+ checkboxTooltip: 'backoffice.idmCatalog.prices.priceFactor.label.pgPriority'
35220
35403
  })
35221
35404
  }
35222
35405
  };
@@ -35279,19 +35462,19 @@ var Prices = observer(function (_ref) {
35279
35462
  value: (_pricelist$seriePrice = pricelist.seriePricefactors) === null || _pricelist$seriePrice === void 0 ? void 0 : _pricelist$seriePrice[selectedSerie === null || selectedSerie === void 0 ? void 0 : selectedSerie.serieNo],
35280
35463
  title: t('backoffice.idmCatalog.prices.priceFactor.label.series'),
35281
35464
  onSave: (/*#__PURE__*/function () {
35282
- var _ref5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_, value) {
35283
- return _regeneratorRuntime.wrap(function _callee4$(_context4) {
35284
- while (1) switch (_context4.prev = _context4.next) {
35465
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_, value) {
35466
+ return _regeneratorRuntime.wrap(function _callee7$(_context7) {
35467
+ while (1) switch (_context7.prev = _context7.next) {
35285
35468
  case 0:
35286
35469
  updateSeriePriceFactor(value);
35287
35470
  case 1:
35288
35471
  case "end":
35289
- return _context4.stop();
35472
+ return _context7.stop();
35290
35473
  }
35291
- }, _callee4);
35474
+ }, _callee7);
35292
35475
  }));
35293
- return function (_x7, _x8) {
35294
- return _ref5.apply(this, arguments);
35476
+ return function (_x11, _x12) {
35477
+ return _ref8.apply(this, arguments);
35295
35478
  };
35296
35479
  }()),
35297
35480
  disabled: !selectedSerie
@@ -35548,6 +35731,21 @@ var TablePriceList = observer(function () {
35548
35731
  cellDataType: 'object',
35549
35732
  editable: false,
35550
35733
  hide: true
35734
+ }, {
35735
+ field: 'pfgPricefactors',
35736
+ cellDataType: 'object',
35737
+ editable: false,
35738
+ hide: true
35739
+ }, {
35740
+ field: 'pgPricefactorsPriority',
35741
+ cellDataType: 'object',
35742
+ editable: false,
35743
+ hide: true
35744
+ }, {
35745
+ field: 'pfgPricefactorsPriority',
35746
+ cellDataType: 'object',
35747
+ editable: false,
35748
+ hide: true
35551
35749
  }]
35552
35750
  };
35553
35751
  }, [apiInterface, i18n.language, viewOnly]);
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ interface PriceFactorHeaderComponentProps {
3
+ /**
4
+ * Callback to save the price factor value
5
+ * @param data - The data to save
6
+ * @param value - The value to save
7
+ */
8
+ onSave: (data: any, value: number[]) => Promise<void>;
9
+ /**
10
+ * Callback to save the priority value
11
+ * @param value - The value to save
12
+ */
13
+ onPriorityChange: (value: boolean) => Promise<void>;
14
+ /**
15
+ * The priority value
16
+ */
17
+ priority: boolean;
18
+ /**
19
+ * If true, the priority is set and cannot be changed, for example at PG if PFG has priority
20
+ */
21
+ priorityForced?: boolean;
22
+ /**
23
+ * The value of the price factor
24
+ */
25
+ value: number[];
26
+ /**
27
+ * The tooltip key for the input
28
+ */
29
+ inputTooltip: string;
30
+ /**
31
+ * The tooltip base key for the checkbox, the key will be appended with .true, .false or .forced depending on the priority value
32
+ */
33
+ checkboxTooltip: string;
34
+ }
35
+ export default function PriceFactorHeaderComponent({ onSave, onPriorityChange, priority, priorityForced, value, inputTooltip, checkboxTooltip, }: PriceFactorHeaderComponentProps): React.JSX.Element;
36
+ export {};
37
+ //# sourceMappingURL=PriceFactorHeaderComponent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PriceFactorHeaderComponent.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMEnricherEditor/Tables/Prices/PriceFactorHeaderComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAMnD,UAAU,+BAA+B;IACvC;;;;OAIG;IACH,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD;;;OAGG;IACH,gBAAgB,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACpD;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAAC,EACjD,MAAM,EACN,gBAAgB,EAChB,QAAQ,EACR,cAAc,EACd,KAAK,EACL,YAAY,EACZ,eAAe,GAChB,EAAE,+BAA+B,qBAwBjC"}
@@ -1,12 +1,12 @@
1
1
  import React from 'react';
2
2
  interface PriceFactorInputProps {
3
3
  value: number[];
4
- onSave?: (data: any, value: number[]) => Promise<void>;
4
+ onSave: (data: any, value: number[]) => Promise<void>;
5
5
  disabled?: boolean;
6
6
  title?: string;
7
7
  tooltip?: string;
8
8
  className?: string;
9
9
  }
10
- export default function PriceFactorInput(props: PriceFactorInputProps): React.JSX.Element;
10
+ export default function PriceFactorInput({ onSave, value, ...props }: PriceFactorInputProps): React.JSX.Element;
11
11
  export {};
12
12
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/ui/IDMEnricherEditor/Tables/Prices/PriceFactorInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,qBAWpE"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../../src/ui/IDMEnricherEditor/Tables/Prices/PriceFactorInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAMnD,UAAU,qBAAqB;IAC7B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,qBAyB1F"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMEnricherEditor/Tables/Prices/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAkB,MAAM,0BAA0B,CAAC;AAcrE,UAAU,WAAW;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,GAAG,CAAC;IACf,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,MAAM,qFAA8F,WAAW;;CA+U1H,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMEnricherEditor/Tables/Prices/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+B,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAkB,MAAM,0BAA0B,CAAC;AAerE,UAAU,WAAW;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,EAAE,GAAG,CAAC;IACf,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,MAAM,qFAA8F,WAAW;;CAwb1H,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMEnricherEditor/modules/TablePriceList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAevE,eAAO,MAAM,cAAc;;CAmRzB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMEnricherEditor/modules/TablePriceList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAevE,eAAO,MAAM,cAAc;;CAqSzB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystaldesign/diva-backoffice",
3
- "version": "25.8.0-beta.20",
3
+ "version": "25.8.0-beta.21",
4
4
  "license": "COMMERCIAL",
5
5
  "devDependencies": {
6
6
  "@testing-library/jest-dom": "^6.5.0",
@@ -15,13 +15,13 @@
15
15
  "dependencies": {
16
16
  "@ant-design/icons": "5.4.0",
17
17
  "@babel/runtime": "7.24.7",
18
- "@crystaldesign/content-box": "25.8.0-beta.20",
19
- "@crystaldesign/content-item": "25.8.0-beta.20",
20
- "@crystaldesign/diva-core": "25.8.0-beta.20",
21
- "@crystaldesign/diva-utils": "25.8.0-beta.20",
22
- "@crystaldesign/media-upload": "25.8.0-beta.20",
23
- "@crystaldesign/rtf-editor": "25.8.0-beta.20",
24
- "@crystaldesign/spreadsheet": "25.8.0-beta.20",
18
+ "@crystaldesign/content-box": "25.8.0-beta.21",
19
+ "@crystaldesign/content-item": "25.8.0-beta.21",
20
+ "@crystaldesign/diva-core": "25.8.0-beta.21",
21
+ "@crystaldesign/diva-utils": "25.8.0-beta.21",
22
+ "@crystaldesign/media-upload": "25.8.0-beta.21",
23
+ "@crystaldesign/rtf-editor": "25.8.0-beta.21",
24
+ "@crystaldesign/spreadsheet": "25.8.0-beta.21",
25
25
  "@google/model-viewer": "3.5.0",
26
26
  "ag-charts-community": "^10.1.0",
27
27
  "ag-charts-react": "^10.1.0",
@@ -51,5 +51,5 @@
51
51
  },
52
52
  "module": "build/esm/index.js",
53
53
  "types": "./build/types/backoffice/src/index.d.ts",
54
- "gitHead": "9c1dd6cded06b2f44d1b0e6ae5234fa07c37d992"
54
+ "gitHead": "2e373e8caa31e00fd42b81b50aa22074718cecf7"
55
55
  }