@crystaldesign/diva-backoffice 26.12.0-beta.37 → 26.12.0-beta.38
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 +108 -76
- package/build/types/backoffice/src/tests/unit/ui/IDMEnricherEditor/components/PriceFactorCellRenderer/priceFactorHelpers.test.d.ts +2 -0
- package/build/types/backoffice/src/tests/unit/ui/IDMEnricherEditor/components/PriceFactorCellRenderer/priceFactorHelpers.test.d.ts.map +1 -0
- package/build/types/backoffice/src/tests/unit/ui/IDMEnricherEditor/components/PriceFactorCellRenderer/usePriceFactor.test.d.ts +2 -0
- package/build/types/backoffice/src/tests/unit/ui/IDMEnricherEditor/components/PriceFactorCellRenderer/usePriceFactor.test.d.ts.map +1 -0
- package/build/types/backoffice/src/ui/CommonComponents/UploadModal/ErrorDisplay.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/CommonComponents/UploadModal/types.d.ts +2 -0
- package/build/types/backoffice/src/ui/CommonComponents/UploadModal/types.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/CommonComponents/UploadModal/useUploadState.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/IDMEnricherEditor/components/PriceFactorCellRenderer/priceFactorHelpers.d.ts +15 -13
- package/build/types/backoffice/src/ui/IDMEnricherEditor/components/PriceFactorCellRenderer/priceFactorHelpers.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/IDMEnricherEditor/components/PriceFactorCellRenderer/usePriceFactor.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/IDMEnricherEditor/modules/TableEnrichment/index.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/IDMEnricherEditor/modules/TableEnrichment/propertyColumn.d.ts.map +1 -1
- package/package.json +10 -10
package/build/esm/index.js
CHANGED
|
@@ -68851,6 +68851,12 @@ var errorItem = "error-item-kyNLD";
|
|
|
68851
68851
|
var css_248z$a = ".upload-modal-footer-W5737 {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n gap: 10px;\n}\n\n.upload-modal-footer-W5737 > .upload-button-QkWYP {\n width: 300px;\n}\n\n.error-group-lmQSx {\n margin-bottom: 8px;\n}\n\n.error-item-kyNLD {\n padding: 4px 0;\n display: flex;\n align-items: flex-start;\n gap: 8px;\n flex-wrap: wrap;\n}\n\n.row-index-jmU3D {\n font-weight: 600;\n margin-right: 8px;\n}\n";
|
|
68852
68852
|
styleInject(css_248z$a);
|
|
68853
68853
|
|
|
68854
|
+
// An aborted all-or-nothing import may carry the flag without any row entry, and it saved nothing either way.
|
|
68855
|
+
var hasBulkErrors = function hasBulkErrors(errors) {
|
|
68856
|
+
var _errors$add, _errors$update, _errors$remove, _errors$restore;
|
|
68857
|
+
return !!errors && !!(errors.transactionAborted || (_errors$add = errors.add) !== null && _errors$add !== void 0 && _errors$add.length || (_errors$update = errors.update) !== null && _errors$update !== void 0 && _errors$update.length || (_errors$remove = errors.remove) !== null && _errors$remove !== void 0 && _errors$remove.length || (_errors$restore = errors.restore) !== null && _errors$restore !== void 0 && _errors$restore.length);
|
|
68858
|
+
};
|
|
68859
|
+
|
|
68854
68860
|
/**
|
|
68855
68861
|
* Custom hook for managing upload modal state and functionality
|
|
68856
68862
|
*
|
|
@@ -68939,7 +68945,7 @@ function useUploadModal(_ref) {
|
|
|
68939
68945
|
// Polled to its end even once the modal closed (isCurrent only guards the UI): the planners must learn that the import saved.
|
|
68940
68946
|
var pollImportJob = /*#__PURE__*/function () {
|
|
68941
68947
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(jobId, catalogsBaseUrl, isCurrent, markSaved) {
|
|
68942
|
-
var pollStart, statusResponse, job, _result$errors
|
|
68948
|
+
var pollStart, statusResponse, job, _result$errors, result, _formRef$current;
|
|
68943
68949
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
68944
68950
|
while (1) switch (_context.prev = _context.next) {
|
|
68945
68951
|
case 0:
|
|
@@ -68983,20 +68989,18 @@ function useUploadModal(_ref) {
|
|
|
68983
68989
|
case 15:
|
|
68984
68990
|
job = _context.sent;
|
|
68985
68991
|
if (!(job.status === 'Completed')) {
|
|
68986
|
-
_context.next =
|
|
68992
|
+
_context.next = 23;
|
|
68987
68993
|
break;
|
|
68988
68994
|
}
|
|
68989
|
-
//
|
|
68990
|
-
markSaved();
|
|
68995
|
+
result = job.result || {}; // An aborted import saved nothing; a partially failed one still saved its other rows.
|
|
68996
|
+
if (!((_result$errors = result.errors) !== null && _result$errors !== void 0 && _result$errors.transactionAborted)) markSaved();
|
|
68991
68997
|
if (isCurrent()) {
|
|
68992
|
-
_context.next =
|
|
68998
|
+
_context.next = 21;
|
|
68993
68999
|
break;
|
|
68994
69000
|
}
|
|
68995
69001
|
return _context.abrupt("return");
|
|
68996
|
-
case
|
|
68997
|
-
result
|
|
68998
|
-
hasPartialErrors = result.errors && (((_result$errors$add = result.errors.add) === null || _result$errors$add === void 0 ? void 0 : _result$errors$add.length) || ((_result$errors$update = result.errors.update) === null || _result$errors$update === void 0 ? void 0 : _result$errors$update.length) || ((_result$errors$remove = result.errors.remove) === null || _result$errors$remove === void 0 ? void 0 : _result$errors$remove.length) || ((_result$errors$restor = result.errors.restore) === null || _result$errors$restor === void 0 ? void 0 : _result$errors$restor.length));
|
|
68999
|
-
if (hasPartialErrors) {
|
|
69002
|
+
case 21:
|
|
69003
|
+
if (hasBulkErrors(result.errors)) {
|
|
69000
69004
|
setError(result.errors);
|
|
69001
69005
|
} else {
|
|
69002
69006
|
onUploadComplete === null || onUploadComplete === void 0 || onUploadComplete(result);
|
|
@@ -69004,9 +69008,9 @@ function useUploadModal(_ref) {
|
|
|
69004
69008
|
setCurrentFile(undefined);
|
|
69005
69009
|
}
|
|
69006
69010
|
return _context.abrupt("return");
|
|
69007
|
-
case
|
|
69011
|
+
case 23:
|
|
69008
69012
|
if (!(job.status === 'Failed')) {
|
|
69009
|
-
_context.next =
|
|
69013
|
+
_context.next = 26;
|
|
69010
69014
|
break;
|
|
69011
69015
|
}
|
|
69012
69016
|
if (isCurrent()) {
|
|
@@ -69014,10 +69018,10 @@ function useUploadModal(_ref) {
|
|
|
69014
69018
|
setProgress(0);
|
|
69015
69019
|
}
|
|
69016
69020
|
return _context.abrupt("return");
|
|
69017
|
-
case
|
|
69021
|
+
case 26:
|
|
69018
69022
|
_context.next = 1;
|
|
69019
69023
|
break;
|
|
69020
|
-
case
|
|
69024
|
+
case 28:
|
|
69021
69025
|
case "end":
|
|
69022
69026
|
return _context.stop();
|
|
69023
69027
|
}
|
|
@@ -69040,7 +69044,7 @@ function useUploadModal(_ref) {
|
|
|
69040
69044
|
var onSave = /*#__PURE__*/function () {
|
|
69041
69045
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(values) {
|
|
69042
69046
|
var _formData$get;
|
|
69043
|
-
var opId, isCurrent, markSaved, formData, requestQueryParams, uploadUrl, startTime, fileSize, estimatedUploadTimeMs, progressInterval, updateProgressBasedOnTime, response, responseData, catalogsBaseUrl, _responseData$errors
|
|
69047
|
+
var opId, isCurrent, markSaved, formData, requestQueryParams, uploadUrl, startTime, fileSize, estimatedUploadTimeMs, progressInterval, updateProgressBasedOnTime, response, responseData, catalogsBaseUrl, _responseData$errors, _formRef$current3, errorBody, errorMessage, errorResponse;
|
|
69044
69048
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
69045
69049
|
while (1) switch (_context2.prev = _context2.next) {
|
|
69046
69050
|
case 0:
|
|
@@ -69101,7 +69105,7 @@ function useUploadModal(_ref) {
|
|
|
69101
69105
|
});
|
|
69102
69106
|
case 24:
|
|
69103
69107
|
if (!response.ok) {
|
|
69104
|
-
_context2.next =
|
|
69108
|
+
_context2.next = 40;
|
|
69105
69109
|
break;
|
|
69106
69110
|
}
|
|
69107
69111
|
_context2.next = 27;
|
|
@@ -69118,40 +69122,38 @@ function useUploadModal(_ref) {
|
|
|
69118
69122
|
_context2.next = 32;
|
|
69119
69123
|
return pollImportJob(responseData.jobId, catalogsBaseUrl, isCurrent, markSaved);
|
|
69120
69124
|
case 32:
|
|
69121
|
-
_context2.next =
|
|
69125
|
+
_context2.next = 38;
|
|
69122
69126
|
break;
|
|
69123
69127
|
case 34:
|
|
69124
|
-
markSaved();
|
|
69128
|
+
if (!((_responseData$errors = responseData.errors) !== null && _responseData$errors !== void 0 && _responseData$errors.transactionAborted)) markSaved();
|
|
69125
69129
|
if (isCurrent()) {
|
|
69126
69130
|
_context2.next = 37;
|
|
69127
69131
|
break;
|
|
69128
69132
|
}
|
|
69129
69133
|
return _context2.abrupt("return");
|
|
69130
69134
|
case 37:
|
|
69131
|
-
|
|
69132
|
-
hasPartialErrors = responseData.errors && (((_responseData$errors$ = responseData.errors.add) === null || _responseData$errors$ === void 0 ? void 0 : _responseData$errors$.length) || ((_responseData$errors$2 = responseData.errors.update) === null || _responseData$errors$2 === void 0 ? void 0 : _responseData$errors$2.length) || ((_responseData$errors$3 = responseData.errors.remove) === null || _responseData$errors$3 === void 0 ? void 0 : _responseData$errors$3.length) || ((_responseData$errors$4 = responseData.errors.restore) === null || _responseData$errors$4 === void 0 ? void 0 : _responseData$errors$4.length));
|
|
69133
|
-
if (hasPartialErrors) {
|
|
69135
|
+
if (hasBulkErrors(responseData.errors)) {
|
|
69134
69136
|
setError(responseData.errors);
|
|
69135
69137
|
} else {
|
|
69136
69138
|
onUploadComplete === null || onUploadComplete === void 0 || onUploadComplete(responseData);
|
|
69137
69139
|
(_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 || _formRef$current3.reset();
|
|
69138
69140
|
setCurrentFile(undefined);
|
|
69139
69141
|
}
|
|
69140
|
-
case
|
|
69141
|
-
_context2.next =
|
|
69142
|
+
case 38:
|
|
69143
|
+
_context2.next = 49;
|
|
69142
69144
|
break;
|
|
69143
|
-
case
|
|
69145
|
+
case 40:
|
|
69144
69146
|
if (isCurrent()) {
|
|
69145
|
-
_context2.next =
|
|
69147
|
+
_context2.next = 42;
|
|
69146
69148
|
break;
|
|
69147
69149
|
}
|
|
69148
69150
|
return _context2.abrupt("return");
|
|
69149
|
-
case
|
|
69150
|
-
_context2.next =
|
|
69151
|
+
case 42:
|
|
69152
|
+
_context2.next = 44;
|
|
69151
69153
|
return response.text()["catch"](function () {
|
|
69152
69154
|
return '';
|
|
69153
69155
|
});
|
|
69154
|
-
case
|
|
69156
|
+
case 44:
|
|
69155
69157
|
errorBody = _context2.sent;
|
|
69156
69158
|
errorMessage = errorBody || response.statusText || t('backoffice.idmEnricher.import.uploadfailed');
|
|
69157
69159
|
try {
|
|
@@ -69163,28 +69165,28 @@ function useUploadModal(_ref) {
|
|
|
69163
69165
|
}
|
|
69164
69166
|
setError(errorMessage);
|
|
69165
69167
|
setProgress(0);
|
|
69166
|
-
case
|
|
69167
|
-
_context2.next =
|
|
69168
|
+
case 49:
|
|
69169
|
+
_context2.next = 54;
|
|
69168
69170
|
break;
|
|
69169
|
-
case
|
|
69170
|
-
_context2.prev =
|
|
69171
|
+
case 51:
|
|
69172
|
+
_context2.prev = 51;
|
|
69171
69173
|
_context2.t0 = _context2["catch"](16);
|
|
69172
69174
|
if (isCurrent()) {
|
|
69173
69175
|
setError(_context2.t0 instanceof Error ? _context2.t0.message : t('backoffice.idmEnricher.import.uploadfailed'));
|
|
69174
69176
|
setProgress(0);
|
|
69175
69177
|
}
|
|
69176
|
-
case
|
|
69177
|
-
_context2.prev =
|
|
69178
|
+
case 54:
|
|
69179
|
+
_context2.prev = 54;
|
|
69178
69180
|
clearInterval(progressInterval);
|
|
69179
69181
|
if (isCurrent()) {
|
|
69180
69182
|
setLoading(false);
|
|
69181
69183
|
}
|
|
69182
|
-
return _context2.finish(
|
|
69183
|
-
case
|
|
69184
|
+
return _context2.finish(54);
|
|
69185
|
+
case 58:
|
|
69184
69186
|
case "end":
|
|
69185
69187
|
return _context2.stop();
|
|
69186
69188
|
}
|
|
69187
|
-
}, _callee2, null, [[16,
|
|
69189
|
+
}, _callee2, null, [[16, 51, 54, 58]]);
|
|
69188
69190
|
}));
|
|
69189
69191
|
return function onSave(_x5) {
|
|
69190
69192
|
return _ref3.apply(this, arguments);
|
|
@@ -69236,7 +69238,7 @@ function ErrorDisplay(_ref) {
|
|
|
69236
69238
|
children: [/*#__PURE__*/jsx(Tag, {
|
|
69237
69239
|
color: "blue",
|
|
69238
69240
|
children: operationType
|
|
69239
|
-
}), /*#__PURE__*/jsx(Tag, {
|
|
69241
|
+
}), typeof fieldError.index === 'number' && /*#__PURE__*/jsx(Tag, {
|
|
69240
69242
|
color: "orange",
|
|
69241
69243
|
children: t('backoffice.uploadModal.row', {
|
|
69242
69244
|
rowNumber: fieldError.index + 1
|
|
@@ -69313,7 +69315,24 @@ function ErrorDisplay(_ref) {
|
|
|
69313
69315
|
});
|
|
69314
69316
|
};
|
|
69315
69317
|
var fieldPanels = renderFieldPanels();
|
|
69316
|
-
|
|
69318
|
+
var hasPanels = !!fieldPanels && fieldPanels.length > 0;
|
|
69319
|
+
if (errors.transactionAborted) {
|
|
69320
|
+
var abortedDefault = 'Import abgebrochen - es wurde nichts importiert. Bitte die Fehler beheben und die Datei erneut hochladen.';
|
|
69321
|
+
return /*#__PURE__*/jsx(Alert
|
|
69322
|
+
// Local guard: i18n init keeps returnEmptyString at true, so an empty translation ignores defaultValue - every key of this dialog shares that hole.
|
|
69323
|
+
, {
|
|
69324
|
+
message: t('backoffice.uploadModal.transactionAborted', {
|
|
69325
|
+
defaultValue: abortedDefault
|
|
69326
|
+
}) || abortedDefault,
|
|
69327
|
+
description: hasPanels ? /*#__PURE__*/jsx(Collapse, {
|
|
69328
|
+
size: "small",
|
|
69329
|
+
children: fieldPanels
|
|
69330
|
+
}) : undefined,
|
|
69331
|
+
type: "error",
|
|
69332
|
+
showIcon: true
|
|
69333
|
+
});
|
|
69334
|
+
}
|
|
69335
|
+
if (!hasPanels) {
|
|
69317
69336
|
return null;
|
|
69318
69337
|
}
|
|
69319
69338
|
return /*#__PURE__*/jsx(Alert, {
|
|
@@ -81530,6 +81549,10 @@ var PROPERTY_FORMAT_HINT = {
|
|
|
81530
81549
|
key: 'backoffice.idmEnricher.enrichment.propertyFormat.list',
|
|
81531
81550
|
defaultValue: 'List - entries separated by ; (e.g. A;B;C)'
|
|
81532
81551
|
},
|
|
81552
|
+
listComma: {
|
|
81553
|
+
key: 'backoffice.idmEnricher.enrichment.propertyFormat.listComma',
|
|
81554
|
+
defaultValue: 'List - entries separated by , (e.g. A,B,C)'
|
|
81555
|
+
},
|
|
81533
81556
|
allOrList: {
|
|
81534
81557
|
key: 'backoffice.idmEnricher.enrichment.propertyFormat.allOrList',
|
|
81535
81558
|
defaultValue: '1 = all, otherwise a list separated by ;'
|
|
@@ -81619,7 +81642,7 @@ function buildPropertyColumn(_ref) {
|
|
|
81619
81642
|
}
|
|
81620
81643
|
});
|
|
81621
81644
|
}
|
|
81622
|
-
var hint = PROPERTY_FORMAT_HINT[editorKind];
|
|
81645
|
+
var hint = PROPERTY_FORMAT_HINT[encoding === 'list:,' ? 'listComma' : editorKind];
|
|
81623
81646
|
var formatHint = hint ? t(hint.key, {
|
|
81624
81647
|
defaultValue: hint.defaultValue
|
|
81625
81648
|
}) : undefined;
|
|
@@ -81646,6 +81669,7 @@ function buildPropertyColumn(_ref) {
|
|
|
81646
81669
|
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; }
|
|
81647
81670
|
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; }
|
|
81648
81671
|
var PROPERTY_ENTITY_OF_VIEW = {
|
|
81672
|
+
series: 'catalog',
|
|
81649
81673
|
items: 'article',
|
|
81650
81674
|
features: 'option',
|
|
81651
81675
|
options: 'optionValue'
|
|
@@ -82016,11 +82040,9 @@ var EnrichmentTable = observer(function (_ref) {
|
|
|
82016
82040
|
var description = (_propertyMeta$key2 = propertyMeta[key]) === null || _propertyMeta$key2 === void 0 ? void 0 : _propertyMeta$key2.description;
|
|
82017
82041
|
var codexKey = (_propertyMeta$key3 = propertyMeta[key]) === null || _propertyMeta$key3 === void 0 ? void 0 : _propertyMeta$key3.codexKey;
|
|
82018
82042
|
var headerLabel = description ? "".concat(description, " (").concat(key, ")") : key;
|
|
82019
|
-
// The
|
|
82020
|
-
// view whose rows ARE a parsed entity. On one that is not (series), nothing parses the value, so the
|
|
82021
|
-
// definition's coarse type is the whole truth, exactly as it is for an organization's own keys.
|
|
82043
|
+
// The engine's encoding of the key wins; without a parsed entity the definition's type decides.
|
|
82022
82044
|
var parsedEntity = PROPERTY_ENTITY_OF_VIEW[type];
|
|
82023
|
-
var encoding = (_ref5 = (_ref6 = parsedEntity ? propertyEncodingOf(
|
|
82045
|
+
var encoding = (_ref5 = (_ref6 = parsedEntity ? propertyEncodingOf(key, parsedEntity) : undefined) !== null && _ref6 !== void 0 ? _ref6 : ENCODING_OF_DEFINITION_TYPE[propType !== null && propType !== void 0 ? propType : '']) !== null && _ref5 !== void 0 ? _ref5 : 'string';
|
|
82024
82046
|
var editorKind = editorKindOf(encoding);
|
|
82025
82047
|
var columnConfig = editorKind === 'text' ? collapseSecondaryLanguages(createTranslatedColumnConfig('translatedProp.' + key, headerLabel, propertyLanguages, false, 'withPlaceholder', {
|
|
82026
82048
|
placeHolderField: 'origProp.' + key,
|
|
@@ -82510,6 +82532,14 @@ var TableGroups = observer(function () {
|
|
|
82510
82532
|
|
|
82511
82533
|
/** Represents a single price entry with its value and validation state */
|
|
82512
82534
|
|
|
82535
|
+
/** Largest discount in percent that can be entered */
|
|
82536
|
+
var MAX_DISCOUNT = 99.99999;
|
|
82537
|
+
|
|
82538
|
+
/** Removes floating point noise, e.g. (1 - 0.8745) * 100 = 12.549999999999994 */
|
|
82539
|
+
var removeFloatNoise = function removeFloatNoise(value) {
|
|
82540
|
+
return parseFloat(value.toFixed(10));
|
|
82541
|
+
};
|
|
82542
|
+
|
|
82513
82543
|
/** State container for both factor and discount entries */
|
|
82514
82544
|
|
|
82515
82545
|
/**
|
|
@@ -82524,7 +82554,7 @@ var formatListValue = function formatListValue(values, type, locale) {
|
|
|
82524
82554
|
if (!(values !== null && values !== void 0 && values.length)) return '-';
|
|
82525
82555
|
var formatter = new Intl.NumberFormat(locale, {
|
|
82526
82556
|
minimumFractionDigits: 1,
|
|
82527
|
-
maximumFractionDigits:
|
|
82557
|
+
maximumFractionDigits: 10
|
|
82528
82558
|
});
|
|
82529
82559
|
return values.map(function (value) {
|
|
82530
82560
|
return formatter.format(value);
|
|
@@ -82534,7 +82564,7 @@ var formatListValue = function formatListValue(values, type, locale) {
|
|
|
82534
82564
|
/**
|
|
82535
82565
|
* Converts an internal value to its display representation
|
|
82536
82566
|
* For factors: keeps the decimal value
|
|
82537
|
-
* For discounts: converts from negative factor to percentage string (e.g., "0.
|
|
82567
|
+
* For discounts: converts from negative factor to percentage string (e.g., "0.8745" -> "12.55")
|
|
82538
82568
|
* @param value - The internal value to convert
|
|
82539
82569
|
* @param type - The type of price modification
|
|
82540
82570
|
* @returns The display value as string
|
|
@@ -82542,27 +82572,28 @@ var formatListValue = function formatListValue(values, type, locale) {
|
|
|
82542
82572
|
var convertToDisplayValue = function convertToDisplayValue(value, type) {
|
|
82543
82573
|
if (type === 'factor') return value;
|
|
82544
82574
|
var numValue = parseFloat(value);
|
|
82545
|
-
return isNaN(numValue) ? '0' :
|
|
82575
|
+
return isNaN(numValue) ? '0' : removeFloatNoise((1 - numValue) * 100).toString();
|
|
82546
82576
|
};
|
|
82547
82577
|
|
|
82548
82578
|
/**
|
|
82549
82579
|
* Converts a display value back to its internal representation
|
|
82550
82580
|
* For factors: keeps the input value
|
|
82551
|
-
* For discounts: converts the input as a negative factor (e.g., "
|
|
82581
|
+
* For discounts: converts the input as a negative factor (e.g., "12.55" -> "0.8745" for a 12.55% discount);
|
|
82582
|
+
* an empty or non-numeric input is kept as is, so it fails validation
|
|
82552
82583
|
* @param value - The display value to convert
|
|
82553
82584
|
* @param type - The type of price modification
|
|
82554
82585
|
* @returns The internal value as string
|
|
82555
82586
|
*/
|
|
82556
82587
|
var convertFromDisplayValue = function convertFromDisplayValue(value, type) {
|
|
82557
82588
|
if (type === 'factor') return value;
|
|
82558
|
-
var numValue =
|
|
82559
|
-
return isNaN(numValue) ?
|
|
82589
|
+
var numValue = parseFloat(value);
|
|
82590
|
+
return isNaN(numValue) ? value : removeFloatNoise(1 - numValue / 100).toString();
|
|
82560
82591
|
};
|
|
82561
82592
|
|
|
82562
82593
|
/**
|
|
82563
82594
|
* Validates if an input value is valid for the given type
|
|
82564
82595
|
* For factors: must be >= 1
|
|
82565
|
-
* For discounts: must be
|
|
82596
|
+
* For discounts: the discount must be between 0 and 99.99999 percent
|
|
82566
82597
|
* @param value - The value to validate
|
|
82567
82598
|
* @param type - The type of price modification
|
|
82568
82599
|
* @returns True if the value is valid for the given type
|
|
@@ -82570,41 +82601,40 @@ var convertFromDisplayValue = function convertFromDisplayValue(value, type) {
|
|
|
82570
82601
|
var isValidInput = function isValidInput(value, type) {
|
|
82571
82602
|
var numValue = parseFloat(value);
|
|
82572
82603
|
if (isNaN(numValue)) return false;
|
|
82573
|
-
|
|
82604
|
+
if (type === 'factor') return numValue >= 1;
|
|
82605
|
+
var discount = removeFloatNoise((1 - numValue) * 100);
|
|
82606
|
+
return discount >= 0 && discount <= MAX_DISCOUNT;
|
|
82574
82607
|
};
|
|
82575
82608
|
|
|
82576
82609
|
/**
|
|
82577
82610
|
* Checks if a value is effective (should be saved)
|
|
82578
82611
|
* For factors: must be > 1 (1 is valid but not effective)
|
|
82579
|
-
* For discounts: must be
|
|
82612
|
+
* For discounts: must be < 1 (a 0% discount is valid but not effective)
|
|
82580
82613
|
* @param value - The value to check
|
|
82581
82614
|
* @param type - The type of price modification
|
|
82582
82615
|
* @returns True if the value should be saved
|
|
82583
82616
|
*/
|
|
82584
82617
|
var isEffectiveValue = function isEffectiveValue(value, type) {
|
|
82585
82618
|
var numValue = parseFloat(value);
|
|
82586
|
-
return type === 'factor' ? numValue > 1 : numValue
|
|
82619
|
+
return type === 'factor' ? numValue > 1 : numValue < 1;
|
|
82587
82620
|
};
|
|
82588
82621
|
|
|
82589
82622
|
/**
|
|
82590
|
-
* Gets the default value for
|
|
82591
|
-
*
|
|
82592
|
-
* Discount: "0" (valid but not effective)
|
|
82593
|
-
* @param type - The type of price modification
|
|
82623
|
+
* Gets the default value for both types: the factor "1", which leaves the price unchanged
|
|
82624
|
+
* (shown as "1" for factors and "0" % for discounts; valid but not effective)
|
|
82594
82625
|
* @returns The default value as string
|
|
82595
82626
|
*/
|
|
82596
|
-
var getDefaultValue = function getDefaultValue(
|
|
82597
|
-
return
|
|
82627
|
+
var getDefaultValue = function getDefaultValue() {
|
|
82628
|
+
return '1';
|
|
82598
82629
|
};
|
|
82599
82630
|
|
|
82600
82631
|
/**
|
|
82601
|
-
* Checks if a value is the default value
|
|
82632
|
+
* Checks if a value is the default value
|
|
82602
82633
|
* @param value - The value to check
|
|
82603
|
-
* @
|
|
82604
|
-
* @returns True if the value is the default value for its type
|
|
82634
|
+
* @returns True if the value is the default value
|
|
82605
82635
|
*/
|
|
82606
|
-
var isDefaultValue = function isDefaultValue(value
|
|
82607
|
-
return value === getDefaultValue(
|
|
82636
|
+
var isDefaultValue = function isDefaultValue(value) {
|
|
82637
|
+
return value === getDefaultValue();
|
|
82608
82638
|
};
|
|
82609
82639
|
|
|
82610
82640
|
function ownKeys$b(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; }
|
|
@@ -82662,7 +82692,7 @@ function usePriceFactor(_ref) {
|
|
|
82662
82692
|
// Ensure at least one entry
|
|
82663
82693
|
if (initialEntries.length === 0) {
|
|
82664
82694
|
initialEntries.push({
|
|
82665
|
-
value: getDefaultValue(
|
|
82695
|
+
value: getDefaultValue(),
|
|
82666
82696
|
isValid: true
|
|
82667
82697
|
});
|
|
82668
82698
|
}
|
|
@@ -82683,14 +82713,14 @@ function usePriceFactor(_ref) {
|
|
|
82683
82713
|
var newEntries = hasChangedCurrentType ? [] : entries[newType];
|
|
82684
82714
|
setEntries(function (prev) {
|
|
82685
82715
|
return _objectSpread$b(_objectSpread$b({}, prev), {}, _defineProperty({}, newType, newEntries.length > 0 ? newEntries : [{
|
|
82686
|
-
value: getDefaultValue(
|
|
82716
|
+
value: getDefaultValue(),
|
|
82687
82717
|
isValid: true
|
|
82688
82718
|
}]));
|
|
82689
82719
|
});
|
|
82690
82720
|
setHasChangedCurrentType(false);
|
|
82691
82721
|
};
|
|
82692
82722
|
var handleAddEntry = function handleAddEntry() {
|
|
82693
|
-
var defaultValue = getDefaultValue(
|
|
82723
|
+
var defaultValue = getDefaultValue();
|
|
82694
82724
|
updateEntries([].concat(_toConsumableArray(entries[type]), [{
|
|
82695
82725
|
value: defaultValue,
|
|
82696
82726
|
isValid: true
|
|
@@ -82701,7 +82731,7 @@ function usePriceFactor(_ref) {
|
|
|
82701
82731
|
if (currentEntries.length === 1) {
|
|
82702
82732
|
// Reset to default when removing last entry
|
|
82703
82733
|
updateEntries([{
|
|
82704
|
-
value: getDefaultValue(
|
|
82734
|
+
value: getDefaultValue(),
|
|
82705
82735
|
isValid: true
|
|
82706
82736
|
}]);
|
|
82707
82737
|
} else {
|
|
@@ -82715,6 +82745,7 @@ function usePriceFactor(_ref) {
|
|
|
82715
82745
|
var newEntries = _toConsumableArray(entries[type]);
|
|
82716
82746
|
newEntries[index] = {
|
|
82717
82747
|
value: actualValue,
|
|
82748
|
+
input: displayValue,
|
|
82718
82749
|
isValid: isValidInput(actualValue, type)
|
|
82719
82750
|
};
|
|
82720
82751
|
updateEntries(newEntries);
|
|
@@ -82726,7 +82757,7 @@ function usePriceFactor(_ref) {
|
|
|
82726
82757
|
while (1) switch (_context.prev = _context.next) {
|
|
82727
82758
|
case 0:
|
|
82728
82759
|
currentEntries = entries[type]; // Don't save if we only have a default entry
|
|
82729
|
-
if (!(currentEntries.length === 1 && isDefaultValue(currentEntries[0].value
|
|
82760
|
+
if (!(currentEntries.length === 1 && isDefaultValue(currentEntries[0].value))) {
|
|
82730
82761
|
_context.next = 7;
|
|
82731
82762
|
break;
|
|
82732
82763
|
}
|
|
@@ -82747,7 +82778,7 @@ function usePriceFactor(_ref) {
|
|
|
82747
82778
|
case 9:
|
|
82748
82779
|
// Filter out default and invalid values
|
|
82749
82780
|
effectiveValues = currentEntries.filter(function (entry) {
|
|
82750
|
-
return !isDefaultValue(entry.value
|
|
82781
|
+
return !isDefaultValue(entry.value) && isEffectiveValue(entry.value, type);
|
|
82751
82782
|
}).map(function (entry) {
|
|
82752
82783
|
return parseFloat(entry.value);
|
|
82753
82784
|
});
|
|
@@ -82786,7 +82817,7 @@ var space = "space-T5Mkd";
|
|
|
82786
82817
|
var input$1 = "input-SK-Fo";
|
|
82787
82818
|
var addButton = "addButton-AVN8Y";
|
|
82788
82819
|
var helpText = "helpText-QYQQF";
|
|
82789
|
-
var css_248z$3 = ".cell-Noc7s {\n min-width: 50px;\n height: 100%;\n}\n\n.typeSelector-Y8Yly {\n margin-bottom: 16px;\n}\n\n.space-T5Mkd {\n width: 100%;\n}\n\n.input-SK-Fo {\n width:
|
|
82820
|
+
var css_248z$3 = ".cell-Noc7s {\n min-width: 50px;\n height: 100%;\n}\n\n.typeSelector-Y8Yly {\n margin-bottom: 16px;\n}\n\n.space-T5Mkd {\n width: 100%;\n}\n\n.input-SK-Fo {\n width: 160px;\n}\n\n.addButton-AVN8Y {\n margin-top: 16px;\n text-align: right;\n}\n\n.helpText-QYQQF {\n margin-top: 8px;\n font-size: 12px;\n color: #666;\n}\n";
|
|
82790
82821
|
styleInject(css_248z$3);
|
|
82791
82822
|
|
|
82792
82823
|
function PriceFactorCellRenderer(props) {
|
|
@@ -82908,7 +82939,7 @@ function PriceFactorCellRenderer(props) {
|
|
|
82908
82939
|
};
|
|
82909
82940
|
}, []);
|
|
82910
82941
|
var isDiscount = type === 'discount';
|
|
82911
|
-
var isSingleDefaultEntry = entries.length === 1 && isDefaultValue(entries[0].value
|
|
82942
|
+
var isSingleDefaultEntry = entries.length === 1 && isDefaultValue(entries[0].value);
|
|
82912
82943
|
var hasInvalidEntries = entries.some(function (entry) {
|
|
82913
82944
|
return entry.isValid === false;
|
|
82914
82945
|
});
|
|
@@ -82948,21 +82979,22 @@ function PriceFactorCellRenderer(props) {
|
|
|
82948
82979
|
}), /*#__PURE__*/jsx(List$1, {
|
|
82949
82980
|
dataSource: entries,
|
|
82950
82981
|
renderItem: function renderItem(entry, index) {
|
|
82982
|
+
var _entry$input;
|
|
82951
82983
|
return /*#__PURE__*/jsx(List$1.Item, {
|
|
82952
82984
|
children: /*#__PURE__*/jsx(Form$2.Item, {
|
|
82953
82985
|
validateStatus: entry.isValid === false ? 'error' : undefined,
|
|
82954
|
-
help: entry.isValid === false ? t(isDiscount ? 'backoffice.idmCatalog.prices.priceFactor.error.
|
|
82986
|
+
help: entry.isValid === false ? t(isDiscount ? 'backoffice.idmCatalog.prices.priceFactor.error.invalidDiscount' : 'backoffice.idmCatalog.prices.priceFactor.error.invalidFactor') : undefined,
|
|
82955
82987
|
className: space,
|
|
82956
82988
|
children: /*#__PURE__*/jsxs(Space, {
|
|
82957
82989
|
children: [/*#__PURE__*/jsx(Input$1, {
|
|
82958
82990
|
type: "number",
|
|
82959
|
-
value: convertToDisplayValue(entry.value, type),
|
|
82991
|
+
value: (_entry$input = entry.input) !== null && _entry$input !== void 0 ? _entry$input : convertToDisplayValue(entry.value, type),
|
|
82960
82992
|
onChange: function onChange(e) {
|
|
82961
82993
|
return handleEntryValueChange(index, e.target.value);
|
|
82962
82994
|
},
|
|
82963
|
-
step: isDiscount ? '
|
|
82995
|
+
step: isDiscount ? 'any' : '0.1',
|
|
82964
82996
|
min: isDiscount ? '0' : '1',
|
|
82965
|
-
max: isDiscount ?
|
|
82997
|
+
max: isDiscount ? String(MAX_DISCOUNT) : undefined,
|
|
82966
82998
|
className: input$1,
|
|
82967
82999
|
addonAfter: isDiscount ? '%' : undefined
|
|
82968
83000
|
}), /*#__PURE__*/jsx(Button, {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"priceFactorHelpers.test.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/tests/unit/ui/IDMEnricherEditor/components/PriceFactorCellRenderer/priceFactorHelpers.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"usePriceFactor.test.d.ts","sourceRoot":"","sources":["../../../../../../../../../../src/tests/unit/ui/IDMEnricherEditor/components/PriceFactorCellRenderer/usePriceFactor.test.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorDisplay.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/CommonComponents/UploadModal/ErrorDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAM5C,UAAU,iBAAiB;IACzB,MAAM,EAAE,iBAAiB,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE,iBAAiB,
|
|
1
|
+
{"version":3,"file":"ErrorDisplay.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/CommonComponents/UploadModal/ErrorDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAM5C,UAAU,iBAAiB;IACzB,MAAM,EAAE,iBAAiB,CAAC;CAC3B;AAED;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,YAAY,CAAC,EAAE,MAAM,EAAE,EAAE,iBAAiB,4BAuHjE"}
|
|
@@ -25,6 +25,8 @@ export interface BulkErrorResponse {
|
|
|
25
25
|
update?: BulkError[];
|
|
26
26
|
remove?: BulkError[];
|
|
27
27
|
restore?: BulkError[];
|
|
28
|
+
/** The whole request was rejected: no row was saved, including rows without an error entry of their own. */
|
|
29
|
+
transactionAborted?: boolean;
|
|
28
30
|
}
|
|
29
31
|
/**
|
|
30
32
|
* Union type for upload errors - either simple string or structured bulk errors
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/CommonComponents/UploadModal/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/CommonComponents/UploadModal/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC;IAClB,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB,4GAA4G;IAC5G,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,iBAAiB,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,kDAAkD;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,gBAAgB,CAAC,EAAE,aAAa,EAAE,CAAC;IACnC,kDAAkD;IAClD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAC;IACjB,uHAAuH;IACvH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,IAAI,CAAC;IAC3C,2CAA2C;IAC3C,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,8CAA8C;IAC9C,UAAU,EAAE,MAAM,CAAC;IACnB,uDAAuD;IACvD,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB;IAC5D,+BAA+B;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,0CAA0C;IAC1C,MAAM,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAqB,SAAQ,oBAAoB;IAChE,sCAAsC;IACtC,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;CACnC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useUploadState.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/CommonComponents/UploadModal/useUploadState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"useUploadState.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/CommonComponents/UploadModal/useUploadState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAqB,MAAM,SAAS,CAAC;AAQ/E;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,EACrC,SAAS,EACT,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,EACX,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,OAAO,EACP,OAAO,EACP,UAAU,EACV,OAAO,GACR,EAAE,oBAAoB;;;;qBAyGS,GAAG;;;;EAuGlC"}
|
|
@@ -4,9 +4,13 @@ export type PriceType = 'factor' | 'discount';
|
|
|
4
4
|
export interface PriceEntry {
|
|
5
5
|
/** The value as string to support input handling */
|
|
6
6
|
value: string;
|
|
7
|
+
/** The text as typed by the user; shown instead of the converted value so typing is not overwritten */
|
|
8
|
+
input?: string;
|
|
7
9
|
/** Whether the current value is valid according to type rules */
|
|
8
10
|
isValid: boolean;
|
|
9
11
|
}
|
|
12
|
+
/** Largest discount in percent that can be entered */
|
|
13
|
+
export declare const MAX_DISCOUNT = 99.99999;
|
|
10
14
|
/** State container for both factor and discount entries */
|
|
11
15
|
export interface EntryState {
|
|
12
16
|
/** List of price factor entries (values > 1) */
|
|
@@ -26,7 +30,7 @@ export declare const formatListValue: (values: number[], type: PriceType, locale
|
|
|
26
30
|
/**
|
|
27
31
|
* Converts an internal value to its display representation
|
|
28
32
|
* For factors: keeps the decimal value
|
|
29
|
-
* For discounts: converts from negative factor to percentage string (e.g., "0.
|
|
33
|
+
* For discounts: converts from negative factor to percentage string (e.g., "0.8745" -> "12.55")
|
|
30
34
|
* @param value - The internal value to convert
|
|
31
35
|
* @param type - The type of price modification
|
|
32
36
|
* @returns The display value as string
|
|
@@ -35,7 +39,8 @@ export declare const convertToDisplayValue: (value: string, type: PriceType) =>
|
|
|
35
39
|
/**
|
|
36
40
|
* Converts a display value back to its internal representation
|
|
37
41
|
* For factors: keeps the input value
|
|
38
|
-
* For discounts: converts the input as a negative factor (e.g., "
|
|
42
|
+
* For discounts: converts the input as a negative factor (e.g., "12.55" -> "0.8745" for a 12.55% discount);
|
|
43
|
+
* an empty or non-numeric input is kept as is, so it fails validation
|
|
39
44
|
* @param value - The display value to convert
|
|
40
45
|
* @param type - The type of price modification
|
|
41
46
|
* @returns The internal value as string
|
|
@@ -44,7 +49,7 @@ export declare const convertFromDisplayValue: (value: string, type: PriceType) =
|
|
|
44
49
|
/**
|
|
45
50
|
* Validates if an input value is valid for the given type
|
|
46
51
|
* For factors: must be >= 1
|
|
47
|
-
* For discounts: must be
|
|
52
|
+
* For discounts: the discount must be between 0 and 99.99999 percent
|
|
48
53
|
* @param value - The value to validate
|
|
49
54
|
* @param type - The type of price modification
|
|
50
55
|
* @returns True if the value is valid for the given type
|
|
@@ -53,25 +58,22 @@ export declare const isValidInput: (value: string, type: PriceType) => boolean;
|
|
|
53
58
|
/**
|
|
54
59
|
* Checks if a value is effective (should be saved)
|
|
55
60
|
* For factors: must be > 1 (1 is valid but not effective)
|
|
56
|
-
* For discounts: must be
|
|
61
|
+
* For discounts: must be < 1 (a 0% discount is valid but not effective)
|
|
57
62
|
* @param value - The value to check
|
|
58
63
|
* @param type - The type of price modification
|
|
59
64
|
* @returns True if the value should be saved
|
|
60
65
|
*/
|
|
61
66
|
export declare const isEffectiveValue: (value: string, type: PriceType) => boolean;
|
|
62
67
|
/**
|
|
63
|
-
* Gets the default value for
|
|
64
|
-
*
|
|
65
|
-
* Discount: "0" (valid but not effective)
|
|
66
|
-
* @param type - The type of price modification
|
|
68
|
+
* Gets the default value for both types: the factor "1", which leaves the price unchanged
|
|
69
|
+
* (shown as "1" for factors and "0" % for discounts; valid but not effective)
|
|
67
70
|
* @returns The default value as string
|
|
68
71
|
*/
|
|
69
|
-
export declare const getDefaultValue: (
|
|
72
|
+
export declare const getDefaultValue: () => string;
|
|
70
73
|
/**
|
|
71
|
-
* Checks if a value is the default value
|
|
74
|
+
* Checks if a value is the default value
|
|
72
75
|
* @param value - The value to check
|
|
73
|
-
* @
|
|
74
|
-
* @returns True if the value is the default value for its type
|
|
76
|
+
* @returns True if the value is the default value
|
|
75
77
|
*/
|
|
76
|
-
export declare const isDefaultValue: (value: string
|
|
78
|
+
export declare const isDefaultValue: (value: string) => boolean;
|
|
77
79
|
//# sourceMappingURL=priceFactorHelpers.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"priceFactorHelpers.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMEnricherEditor/components/PriceFactorCellRenderer/priceFactorHelpers.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE9C,0EAA0E;AAC1E,MAAM,WAAW,UAAU;IACzB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,2DAA2D;AAC3D,MAAM,WAAW,UAAU;IACzB,gDAAgD;IAChD,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,wDAAwD;IACxD,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,WAAY,MAAM,EAAE,QAAQ,SAAS,UAAU,MAAM,KAAG,MASnF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,UAAW,MAAM,QAAQ,SAAS,KAAG,MAItE,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"priceFactorHelpers.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMEnricherEditor/components/PriceFactorCellRenderer/priceFactorHelpers.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE9C,0EAA0E;AAC1E,MAAM,WAAW,UAAU;IACzB,oDAAoD;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,uGAAuG;IACvG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,sDAAsD;AACtD,eAAO,MAAM,YAAY,WAAW,CAAC;AAKrC,2DAA2D;AAC3D,MAAM,WAAW,UAAU;IACzB,gDAAgD;IAChD,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,wDAAwD;IACxD,QAAQ,EAAE,UAAU,EAAE,CAAC;CACxB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,WAAY,MAAM,EAAE,QAAQ,SAAS,UAAU,MAAM,KAAG,MASnF,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,UAAW,MAAM,QAAQ,SAAS,KAAG,MAItE,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,uBAAuB,UAAW,MAAM,QAAQ,SAAS,KAAG,MAIxE,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,UAAW,MAAM,QAAQ,SAAS,KAAG,OAM7D,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,UAAW,MAAM,QAAQ,SAAS,KAAG,OAGjE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,QAAO,MAAa,CAAC;AAEjD;;;;GAIG;AACH,eAAO,MAAM,cAAc,UAAW,MAAM,KAAG,OAE9C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePriceFactor.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMEnricherEditor/components/PriceFactorCellRenderer/usePriceFactor.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,UAAU,EAOX,MAAM,sBAAsB,CAAC;AAE9B,UAAU,cAAc;IACtB,IAAI,EAAE,GAAG,CAAC;IACV,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,UAAU,eAAe;IACvB,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,gBAAgB,EAAE,CAAC,OAAO,EAAE,SAAS,KAAK,IAAI,CAAC;IAC/C,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,sBAAsB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAAE,IAAS,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,cAAc,GAAG,eAAe,
|
|
1
|
+
{"version":3,"file":"usePriceFactor.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMEnricherEditor/components/PriceFactorCellRenderer/usePriceFactor.ts"],"names":[],"mappings":"AACA,OAAO,EACL,SAAS,EACT,UAAU,EAOX,MAAM,sBAAsB,CAAC;AAE9B,UAAU,cAAc;IACtB,IAAI,EAAE,GAAG,CAAC;IACV,YAAY,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,aAAa,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,UAAU,eAAe;IACvB,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,UAAU,EAAE,CAAC;IACtB,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,gBAAgB,EAAE,CAAC,OAAO,EAAE,SAAS,KAAK,IAAI,CAAC;IAC/C,cAAc,EAAE,MAAM,IAAI,CAAC;IAC3B,iBAAiB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,sBAAsB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,IAAI,CAAC;IACtE,UAAU,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACjC;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,EAAE,IAAS,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,cAAc,GAAG,eAAe,CAmIlH"}
|
package/build/types/backoffice/src/ui/IDMEnricherEditor/modules/TableEnrichment/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMEnricherEditor/modules/TableEnrichment/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMEnricherEditor/modules/TableEnrichment/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA4D,MAAM,OAAO,CAAC;AAoEjF,QAAA,MAAM,oBAAoB,yBAEzB,CAAC;AACF,QAAA,MAAM,iBAAiB,yBAEtB,CAAC;AAEF,QAAA,MAAM,cAAc,yBAEnB,CAAC;AAEF,QAAA,MAAM,gBAAgB,yBAErB,CAAC;AAEF,QAAA,MAAM,eAAe,yBAEpB,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,cAAc,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyColumn.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMEnricherEditor/modules/TableEnrichment/propertyColumn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAgC,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,EAML,KAAK,gBAAgB,EAEtB,MAAM,kCAAkC,CAAC;AAG1C,8IAA8I;AAC9I,eAAO,MAAM,oBAAoB,EAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"propertyColumn.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMEnricherEditor/modules/TableEnrichment/propertyColumn.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAgC,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,EAML,KAAK,gBAAgB,EAEtB,MAAM,kCAAkC,CAAC;AAG1C,8IAA8I;AAC9I,eAAO,MAAM,oBAAoB,EAAE;IAAE,CAAC,IAAI,EAAE,MAAM,GAAG;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAE,CAAA;CASzF,CAAC;AAEF,MAAM,WAAW,kBAAkB;IACjC,8HAA8H;IAC9H,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,CAAC,EAAE,SAAS,CAAC;CACd;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,EAAE,EAAE,kBAAkB,GAAG,UAAU,CAAC,GAAG,CAAC,CAyE1H"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crystaldesign/diva-backoffice",
|
|
3
|
-
"version": "26.12.0-beta.
|
|
3
|
+
"version": "26.12.0-beta.38",
|
|
4
4
|
"description": "Ant Design backoffice shell (configuration modules) and the Diva Data Engine component hosting the IDM and enricher editors.",
|
|
5
5
|
"license": "COMMERCIAL",
|
|
6
6
|
"devDependencies": {
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@ant-design/icons": "6.3.4",
|
|
18
18
|
"@babel/runtime": "7.24.7",
|
|
19
|
-
"@crystaldesign/content-box": "26.12.0-beta.
|
|
20
|
-
"@crystaldesign/content-item": "26.12.0-beta.
|
|
21
|
-
"@crystaldesign/diva-agent": "26.12.0-beta.
|
|
22
|
-
"@crystaldesign/diva-core": "26.12.0-beta.
|
|
23
|
-
"@crystaldesign/diva-utils": "26.12.0-beta.
|
|
24
|
-
"@crystaldesign/media-upload": "26.12.0-beta.
|
|
25
|
-
"@crystaldesign/rtf-editor": "26.12.0-beta.
|
|
26
|
-
"@crystaldesign/spreadsheet": "26.12.0-beta.
|
|
19
|
+
"@crystaldesign/content-box": "26.12.0-beta.38",
|
|
20
|
+
"@crystaldesign/content-item": "26.12.0-beta.38",
|
|
21
|
+
"@crystaldesign/diva-agent": "26.12.0-beta.38",
|
|
22
|
+
"@crystaldesign/diva-core": "26.12.0-beta.38",
|
|
23
|
+
"@crystaldesign/diva-utils": "26.12.0-beta.38",
|
|
24
|
+
"@crystaldesign/media-upload": "26.12.0-beta.38",
|
|
25
|
+
"@crystaldesign/rtf-editor": "26.12.0-beta.38",
|
|
26
|
+
"@crystaldesign/spreadsheet": "26.12.0-beta.38",
|
|
27
27
|
"@dnd-kit/core": "^6.1.0",
|
|
28
28
|
"@dnd-kit/sortable": "^8.0.0",
|
|
29
29
|
"@dnd-kit/utilities": "^3.2.2",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
},
|
|
58
58
|
"module": "build/esm/index.js",
|
|
59
59
|
"types": "./build/types/backoffice/src/index.d.ts",
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "86af24a84325ee470f7dce9d1159a6577fde22bf"
|
|
61
61
|
}
|