@crystaldesign/diva-backoffice 26.12.0-beta.37 → 26.12.0-beta.39
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 +111 -77
- 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/AssortmentManager/ArticleData/logic/articleColumns.d.ts.map +1 -1
- 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
|
@@ -51433,7 +51433,9 @@ function placeholderEnumColumnFormatter(enumData, placeHolderField, template) {
|
|
|
51433
51433
|
var value = _ref6.value,
|
|
51434
51434
|
data = _ref6.data;
|
|
51435
51435
|
var placeholder = get(data, placeHolderField);
|
|
51436
|
-
|
|
51436
|
+
var effective = isSet(value) ? value : placeholder;
|
|
51437
|
+
// not labelled: the template would render an empty value as " - ", which the cell shows and a copy/fill stores
|
|
51438
|
+
return isSet(effective) ? label(effective) : '';
|
|
51437
51439
|
};
|
|
51438
51440
|
}
|
|
51439
51441
|
|
|
@@ -68851,6 +68853,12 @@ var errorItem = "error-item-kyNLD";
|
|
|
68851
68853
|
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
68854
|
styleInject(css_248z$a);
|
|
68853
68855
|
|
|
68856
|
+
// An aborted all-or-nothing import may carry the flag without any row entry, and it saved nothing either way.
|
|
68857
|
+
var hasBulkErrors = function hasBulkErrors(errors) {
|
|
68858
|
+
var _errors$add, _errors$update, _errors$remove, _errors$restore;
|
|
68859
|
+
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);
|
|
68860
|
+
};
|
|
68861
|
+
|
|
68854
68862
|
/**
|
|
68855
68863
|
* Custom hook for managing upload modal state and functionality
|
|
68856
68864
|
*
|
|
@@ -68939,7 +68947,7 @@ function useUploadModal(_ref) {
|
|
|
68939
68947
|
// Polled to its end even once the modal closed (isCurrent only guards the UI): the planners must learn that the import saved.
|
|
68940
68948
|
var pollImportJob = /*#__PURE__*/function () {
|
|
68941
68949
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(jobId, catalogsBaseUrl, isCurrent, markSaved) {
|
|
68942
|
-
var pollStart, statusResponse, job, _result$errors
|
|
68950
|
+
var pollStart, statusResponse, job, _result$errors, result, _formRef$current;
|
|
68943
68951
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
68944
68952
|
while (1) switch (_context.prev = _context.next) {
|
|
68945
68953
|
case 0:
|
|
@@ -68983,20 +68991,18 @@ function useUploadModal(_ref) {
|
|
|
68983
68991
|
case 15:
|
|
68984
68992
|
job = _context.sent;
|
|
68985
68993
|
if (!(job.status === 'Completed')) {
|
|
68986
|
-
_context.next =
|
|
68994
|
+
_context.next = 23;
|
|
68987
68995
|
break;
|
|
68988
68996
|
}
|
|
68989
|
-
//
|
|
68990
|
-
markSaved();
|
|
68997
|
+
result = job.result || {}; // An aborted import saved nothing; a partially failed one still saved its other rows.
|
|
68998
|
+
if (!((_result$errors = result.errors) !== null && _result$errors !== void 0 && _result$errors.transactionAborted)) markSaved();
|
|
68991
68999
|
if (isCurrent()) {
|
|
68992
|
-
_context.next =
|
|
69000
|
+
_context.next = 21;
|
|
68993
69001
|
break;
|
|
68994
69002
|
}
|
|
68995
69003
|
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) {
|
|
69004
|
+
case 21:
|
|
69005
|
+
if (hasBulkErrors(result.errors)) {
|
|
69000
69006
|
setError(result.errors);
|
|
69001
69007
|
} else {
|
|
69002
69008
|
onUploadComplete === null || onUploadComplete === void 0 || onUploadComplete(result);
|
|
@@ -69004,9 +69010,9 @@ function useUploadModal(_ref) {
|
|
|
69004
69010
|
setCurrentFile(undefined);
|
|
69005
69011
|
}
|
|
69006
69012
|
return _context.abrupt("return");
|
|
69007
|
-
case
|
|
69013
|
+
case 23:
|
|
69008
69014
|
if (!(job.status === 'Failed')) {
|
|
69009
|
-
_context.next =
|
|
69015
|
+
_context.next = 26;
|
|
69010
69016
|
break;
|
|
69011
69017
|
}
|
|
69012
69018
|
if (isCurrent()) {
|
|
@@ -69014,10 +69020,10 @@ function useUploadModal(_ref) {
|
|
|
69014
69020
|
setProgress(0);
|
|
69015
69021
|
}
|
|
69016
69022
|
return _context.abrupt("return");
|
|
69017
|
-
case
|
|
69023
|
+
case 26:
|
|
69018
69024
|
_context.next = 1;
|
|
69019
69025
|
break;
|
|
69020
|
-
case
|
|
69026
|
+
case 28:
|
|
69021
69027
|
case "end":
|
|
69022
69028
|
return _context.stop();
|
|
69023
69029
|
}
|
|
@@ -69040,7 +69046,7 @@ function useUploadModal(_ref) {
|
|
|
69040
69046
|
var onSave = /*#__PURE__*/function () {
|
|
69041
69047
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(values) {
|
|
69042
69048
|
var _formData$get;
|
|
69043
|
-
var opId, isCurrent, markSaved, formData, requestQueryParams, uploadUrl, startTime, fileSize, estimatedUploadTimeMs, progressInterval, updateProgressBasedOnTime, response, responseData, catalogsBaseUrl, _responseData$errors
|
|
69049
|
+
var opId, isCurrent, markSaved, formData, requestQueryParams, uploadUrl, startTime, fileSize, estimatedUploadTimeMs, progressInterval, updateProgressBasedOnTime, response, responseData, catalogsBaseUrl, _responseData$errors, _formRef$current3, errorBody, errorMessage, errorResponse;
|
|
69044
69050
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
69045
69051
|
while (1) switch (_context2.prev = _context2.next) {
|
|
69046
69052
|
case 0:
|
|
@@ -69101,7 +69107,7 @@ function useUploadModal(_ref) {
|
|
|
69101
69107
|
});
|
|
69102
69108
|
case 24:
|
|
69103
69109
|
if (!response.ok) {
|
|
69104
|
-
_context2.next =
|
|
69110
|
+
_context2.next = 40;
|
|
69105
69111
|
break;
|
|
69106
69112
|
}
|
|
69107
69113
|
_context2.next = 27;
|
|
@@ -69118,40 +69124,38 @@ function useUploadModal(_ref) {
|
|
|
69118
69124
|
_context2.next = 32;
|
|
69119
69125
|
return pollImportJob(responseData.jobId, catalogsBaseUrl, isCurrent, markSaved);
|
|
69120
69126
|
case 32:
|
|
69121
|
-
_context2.next =
|
|
69127
|
+
_context2.next = 38;
|
|
69122
69128
|
break;
|
|
69123
69129
|
case 34:
|
|
69124
|
-
markSaved();
|
|
69130
|
+
if (!((_responseData$errors = responseData.errors) !== null && _responseData$errors !== void 0 && _responseData$errors.transactionAborted)) markSaved();
|
|
69125
69131
|
if (isCurrent()) {
|
|
69126
69132
|
_context2.next = 37;
|
|
69127
69133
|
break;
|
|
69128
69134
|
}
|
|
69129
69135
|
return _context2.abrupt("return");
|
|
69130
69136
|
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) {
|
|
69137
|
+
if (hasBulkErrors(responseData.errors)) {
|
|
69134
69138
|
setError(responseData.errors);
|
|
69135
69139
|
} else {
|
|
69136
69140
|
onUploadComplete === null || onUploadComplete === void 0 || onUploadComplete(responseData);
|
|
69137
69141
|
(_formRef$current3 = formRef.current) === null || _formRef$current3 === void 0 || _formRef$current3.reset();
|
|
69138
69142
|
setCurrentFile(undefined);
|
|
69139
69143
|
}
|
|
69140
|
-
case
|
|
69141
|
-
_context2.next =
|
|
69144
|
+
case 38:
|
|
69145
|
+
_context2.next = 49;
|
|
69142
69146
|
break;
|
|
69143
|
-
case
|
|
69147
|
+
case 40:
|
|
69144
69148
|
if (isCurrent()) {
|
|
69145
|
-
_context2.next =
|
|
69149
|
+
_context2.next = 42;
|
|
69146
69150
|
break;
|
|
69147
69151
|
}
|
|
69148
69152
|
return _context2.abrupt("return");
|
|
69149
|
-
case
|
|
69150
|
-
_context2.next =
|
|
69153
|
+
case 42:
|
|
69154
|
+
_context2.next = 44;
|
|
69151
69155
|
return response.text()["catch"](function () {
|
|
69152
69156
|
return '';
|
|
69153
69157
|
});
|
|
69154
|
-
case
|
|
69158
|
+
case 44:
|
|
69155
69159
|
errorBody = _context2.sent;
|
|
69156
69160
|
errorMessage = errorBody || response.statusText || t('backoffice.idmEnricher.import.uploadfailed');
|
|
69157
69161
|
try {
|
|
@@ -69163,28 +69167,28 @@ function useUploadModal(_ref) {
|
|
|
69163
69167
|
}
|
|
69164
69168
|
setError(errorMessage);
|
|
69165
69169
|
setProgress(0);
|
|
69166
|
-
case
|
|
69167
|
-
_context2.next =
|
|
69170
|
+
case 49:
|
|
69171
|
+
_context2.next = 54;
|
|
69168
69172
|
break;
|
|
69169
|
-
case
|
|
69170
|
-
_context2.prev =
|
|
69173
|
+
case 51:
|
|
69174
|
+
_context2.prev = 51;
|
|
69171
69175
|
_context2.t0 = _context2["catch"](16);
|
|
69172
69176
|
if (isCurrent()) {
|
|
69173
69177
|
setError(_context2.t0 instanceof Error ? _context2.t0.message : t('backoffice.idmEnricher.import.uploadfailed'));
|
|
69174
69178
|
setProgress(0);
|
|
69175
69179
|
}
|
|
69176
|
-
case
|
|
69177
|
-
_context2.prev =
|
|
69180
|
+
case 54:
|
|
69181
|
+
_context2.prev = 54;
|
|
69178
69182
|
clearInterval(progressInterval);
|
|
69179
69183
|
if (isCurrent()) {
|
|
69180
69184
|
setLoading(false);
|
|
69181
69185
|
}
|
|
69182
|
-
return _context2.finish(
|
|
69183
|
-
case
|
|
69186
|
+
return _context2.finish(54);
|
|
69187
|
+
case 58:
|
|
69184
69188
|
case "end":
|
|
69185
69189
|
return _context2.stop();
|
|
69186
69190
|
}
|
|
69187
|
-
}, _callee2, null, [[16,
|
|
69191
|
+
}, _callee2, null, [[16, 51, 54, 58]]);
|
|
69188
69192
|
}));
|
|
69189
69193
|
return function onSave(_x5) {
|
|
69190
69194
|
return _ref3.apply(this, arguments);
|
|
@@ -69236,7 +69240,7 @@ function ErrorDisplay(_ref) {
|
|
|
69236
69240
|
children: [/*#__PURE__*/jsx(Tag, {
|
|
69237
69241
|
color: "blue",
|
|
69238
69242
|
children: operationType
|
|
69239
|
-
}), /*#__PURE__*/jsx(Tag, {
|
|
69243
|
+
}), typeof fieldError.index === 'number' && /*#__PURE__*/jsx(Tag, {
|
|
69240
69244
|
color: "orange",
|
|
69241
69245
|
children: t('backoffice.uploadModal.row', {
|
|
69242
69246
|
rowNumber: fieldError.index + 1
|
|
@@ -69313,7 +69317,24 @@ function ErrorDisplay(_ref) {
|
|
|
69313
69317
|
});
|
|
69314
69318
|
};
|
|
69315
69319
|
var fieldPanels = renderFieldPanels();
|
|
69316
|
-
|
|
69320
|
+
var hasPanels = !!fieldPanels && fieldPanels.length > 0;
|
|
69321
|
+
if (errors.transactionAborted) {
|
|
69322
|
+
var abortedDefault = 'Import abgebrochen - es wurde nichts importiert. Bitte die Fehler beheben und die Datei erneut hochladen.';
|
|
69323
|
+
return /*#__PURE__*/jsx(Alert
|
|
69324
|
+
// Local guard: i18n init keeps returnEmptyString at true, so an empty translation ignores defaultValue - every key of this dialog shares that hole.
|
|
69325
|
+
, {
|
|
69326
|
+
message: t('backoffice.uploadModal.transactionAborted', {
|
|
69327
|
+
defaultValue: abortedDefault
|
|
69328
|
+
}) || abortedDefault,
|
|
69329
|
+
description: hasPanels ? /*#__PURE__*/jsx(Collapse, {
|
|
69330
|
+
size: "small",
|
|
69331
|
+
children: fieldPanels
|
|
69332
|
+
}) : undefined,
|
|
69333
|
+
type: "error",
|
|
69334
|
+
showIcon: true
|
|
69335
|
+
});
|
|
69336
|
+
}
|
|
69337
|
+
if (!hasPanels) {
|
|
69317
69338
|
return null;
|
|
69318
69339
|
}
|
|
69319
69340
|
return /*#__PURE__*/jsx(Alert, {
|
|
@@ -81530,6 +81551,10 @@ var PROPERTY_FORMAT_HINT = {
|
|
|
81530
81551
|
key: 'backoffice.idmEnricher.enrichment.propertyFormat.list',
|
|
81531
81552
|
defaultValue: 'List - entries separated by ; (e.g. A;B;C)'
|
|
81532
81553
|
},
|
|
81554
|
+
listComma: {
|
|
81555
|
+
key: 'backoffice.idmEnricher.enrichment.propertyFormat.listComma',
|
|
81556
|
+
defaultValue: 'List - entries separated by , (e.g. A,B,C)'
|
|
81557
|
+
},
|
|
81533
81558
|
allOrList: {
|
|
81534
81559
|
key: 'backoffice.idmEnricher.enrichment.propertyFormat.allOrList',
|
|
81535
81560
|
defaultValue: '1 = all, otherwise a list separated by ;'
|
|
@@ -81619,7 +81644,7 @@ function buildPropertyColumn(_ref) {
|
|
|
81619
81644
|
}
|
|
81620
81645
|
});
|
|
81621
81646
|
}
|
|
81622
|
-
var hint = PROPERTY_FORMAT_HINT[editorKind];
|
|
81647
|
+
var hint = PROPERTY_FORMAT_HINT[encoding === 'list:,' ? 'listComma' : editorKind];
|
|
81623
81648
|
var formatHint = hint ? t(hint.key, {
|
|
81624
81649
|
defaultValue: hint.defaultValue
|
|
81625
81650
|
}) : undefined;
|
|
@@ -81646,6 +81671,7 @@ function buildPropertyColumn(_ref) {
|
|
|
81646
81671
|
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
81672
|
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
81673
|
var PROPERTY_ENTITY_OF_VIEW = {
|
|
81674
|
+
series: 'catalog',
|
|
81649
81675
|
items: 'article',
|
|
81650
81676
|
features: 'option',
|
|
81651
81677
|
options: 'optionValue'
|
|
@@ -82016,11 +82042,9 @@ var EnrichmentTable = observer(function (_ref) {
|
|
|
82016
82042
|
var description = (_propertyMeta$key2 = propertyMeta[key]) === null || _propertyMeta$key2 === void 0 ? void 0 : _propertyMeta$key2.description;
|
|
82017
82043
|
var codexKey = (_propertyMeta$key3 = propertyMeta[key]) === null || _propertyMeta$key3 === void 0 ? void 0 : _propertyMeta$key3.codexKey;
|
|
82018
82044
|
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.
|
|
82045
|
+
// The engine's encoding of the key wins; without a parsed entity the definition's type decides.
|
|
82022
82046
|
var parsedEntity = PROPERTY_ENTITY_OF_VIEW[type];
|
|
82023
|
-
var encoding = (_ref5 = (_ref6 = parsedEntity ? propertyEncodingOf(
|
|
82047
|
+
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
82048
|
var editorKind = editorKindOf(encoding);
|
|
82025
82049
|
var columnConfig = editorKind === 'text' ? collapseSecondaryLanguages(createTranslatedColumnConfig('translatedProp.' + key, headerLabel, propertyLanguages, false, 'withPlaceholder', {
|
|
82026
82050
|
placeHolderField: 'origProp.' + key,
|
|
@@ -82510,6 +82534,14 @@ var TableGroups = observer(function () {
|
|
|
82510
82534
|
|
|
82511
82535
|
/** Represents a single price entry with its value and validation state */
|
|
82512
82536
|
|
|
82537
|
+
/** Largest discount in percent that can be entered */
|
|
82538
|
+
var MAX_DISCOUNT = 99.99999;
|
|
82539
|
+
|
|
82540
|
+
/** Removes floating point noise, e.g. (1 - 0.8745) * 100 = 12.549999999999994 */
|
|
82541
|
+
var removeFloatNoise = function removeFloatNoise(value) {
|
|
82542
|
+
return parseFloat(value.toFixed(10));
|
|
82543
|
+
};
|
|
82544
|
+
|
|
82513
82545
|
/** State container for both factor and discount entries */
|
|
82514
82546
|
|
|
82515
82547
|
/**
|
|
@@ -82524,7 +82556,7 @@ var formatListValue = function formatListValue(values, type, locale) {
|
|
|
82524
82556
|
if (!(values !== null && values !== void 0 && values.length)) return '-';
|
|
82525
82557
|
var formatter = new Intl.NumberFormat(locale, {
|
|
82526
82558
|
minimumFractionDigits: 1,
|
|
82527
|
-
maximumFractionDigits:
|
|
82559
|
+
maximumFractionDigits: 10
|
|
82528
82560
|
});
|
|
82529
82561
|
return values.map(function (value) {
|
|
82530
82562
|
return formatter.format(value);
|
|
@@ -82534,7 +82566,7 @@ var formatListValue = function formatListValue(values, type, locale) {
|
|
|
82534
82566
|
/**
|
|
82535
82567
|
* Converts an internal value to its display representation
|
|
82536
82568
|
* For factors: keeps the decimal value
|
|
82537
|
-
* For discounts: converts from negative factor to percentage string (e.g., "0.
|
|
82569
|
+
* For discounts: converts from negative factor to percentage string (e.g., "0.8745" -> "12.55")
|
|
82538
82570
|
* @param value - The internal value to convert
|
|
82539
82571
|
* @param type - The type of price modification
|
|
82540
82572
|
* @returns The display value as string
|
|
@@ -82542,27 +82574,28 @@ var formatListValue = function formatListValue(values, type, locale) {
|
|
|
82542
82574
|
var convertToDisplayValue = function convertToDisplayValue(value, type) {
|
|
82543
82575
|
if (type === 'factor') return value;
|
|
82544
82576
|
var numValue = parseFloat(value);
|
|
82545
|
-
return isNaN(numValue) ? '0' :
|
|
82577
|
+
return isNaN(numValue) ? '0' : removeFloatNoise((1 - numValue) * 100).toString();
|
|
82546
82578
|
};
|
|
82547
82579
|
|
|
82548
82580
|
/**
|
|
82549
82581
|
* Converts a display value back to its internal representation
|
|
82550
82582
|
* For factors: keeps the input value
|
|
82551
|
-
* For discounts: converts the input as a negative factor (e.g., "
|
|
82583
|
+
* For discounts: converts the input as a negative factor (e.g., "12.55" -> "0.8745" for a 12.55% discount);
|
|
82584
|
+
* an empty or non-numeric input is kept as is, so it fails validation
|
|
82552
82585
|
* @param value - The display value to convert
|
|
82553
82586
|
* @param type - The type of price modification
|
|
82554
82587
|
* @returns The internal value as string
|
|
82555
82588
|
*/
|
|
82556
82589
|
var convertFromDisplayValue = function convertFromDisplayValue(value, type) {
|
|
82557
82590
|
if (type === 'factor') return value;
|
|
82558
|
-
var numValue =
|
|
82559
|
-
return isNaN(numValue) ?
|
|
82591
|
+
var numValue = parseFloat(value);
|
|
82592
|
+
return isNaN(numValue) ? value : removeFloatNoise(1 - numValue / 100).toString();
|
|
82560
82593
|
};
|
|
82561
82594
|
|
|
82562
82595
|
/**
|
|
82563
82596
|
* Validates if an input value is valid for the given type
|
|
82564
82597
|
* For factors: must be >= 1
|
|
82565
|
-
* For discounts: must be
|
|
82598
|
+
* For discounts: the discount must be between 0 and 99.99999 percent
|
|
82566
82599
|
* @param value - The value to validate
|
|
82567
82600
|
* @param type - The type of price modification
|
|
82568
82601
|
* @returns True if the value is valid for the given type
|
|
@@ -82570,41 +82603,40 @@ var convertFromDisplayValue = function convertFromDisplayValue(value, type) {
|
|
|
82570
82603
|
var isValidInput = function isValidInput(value, type) {
|
|
82571
82604
|
var numValue = parseFloat(value);
|
|
82572
82605
|
if (isNaN(numValue)) return false;
|
|
82573
|
-
|
|
82606
|
+
if (type === 'factor') return numValue >= 1;
|
|
82607
|
+
var discount = removeFloatNoise((1 - numValue) * 100);
|
|
82608
|
+
return discount >= 0 && discount <= MAX_DISCOUNT;
|
|
82574
82609
|
};
|
|
82575
82610
|
|
|
82576
82611
|
/**
|
|
82577
82612
|
* Checks if a value is effective (should be saved)
|
|
82578
82613
|
* For factors: must be > 1 (1 is valid but not effective)
|
|
82579
|
-
* For discounts: must be
|
|
82614
|
+
* For discounts: must be < 1 (a 0% discount is valid but not effective)
|
|
82580
82615
|
* @param value - The value to check
|
|
82581
82616
|
* @param type - The type of price modification
|
|
82582
82617
|
* @returns True if the value should be saved
|
|
82583
82618
|
*/
|
|
82584
82619
|
var isEffectiveValue = function isEffectiveValue(value, type) {
|
|
82585
82620
|
var numValue = parseFloat(value);
|
|
82586
|
-
return type === 'factor' ? numValue > 1 : numValue
|
|
82621
|
+
return type === 'factor' ? numValue > 1 : numValue < 1;
|
|
82587
82622
|
};
|
|
82588
82623
|
|
|
82589
82624
|
/**
|
|
82590
|
-
* Gets the default value for
|
|
82591
|
-
*
|
|
82592
|
-
* Discount: "0" (valid but not effective)
|
|
82593
|
-
* @param type - The type of price modification
|
|
82625
|
+
* Gets the default value for both types: the factor "1", which leaves the price unchanged
|
|
82626
|
+
* (shown as "1" for factors and "0" % for discounts; valid but not effective)
|
|
82594
82627
|
* @returns The default value as string
|
|
82595
82628
|
*/
|
|
82596
|
-
var getDefaultValue = function getDefaultValue(
|
|
82597
|
-
return
|
|
82629
|
+
var getDefaultValue = function getDefaultValue() {
|
|
82630
|
+
return '1';
|
|
82598
82631
|
};
|
|
82599
82632
|
|
|
82600
82633
|
/**
|
|
82601
|
-
* Checks if a value is the default value
|
|
82634
|
+
* Checks if a value is the default value
|
|
82602
82635
|
* @param value - The value to check
|
|
82603
|
-
* @
|
|
82604
|
-
* @returns True if the value is the default value for its type
|
|
82636
|
+
* @returns True if the value is the default value
|
|
82605
82637
|
*/
|
|
82606
|
-
var isDefaultValue = function isDefaultValue(value
|
|
82607
|
-
return value === getDefaultValue(
|
|
82638
|
+
var isDefaultValue = function isDefaultValue(value) {
|
|
82639
|
+
return value === getDefaultValue();
|
|
82608
82640
|
};
|
|
82609
82641
|
|
|
82610
82642
|
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 +82694,7 @@ function usePriceFactor(_ref) {
|
|
|
82662
82694
|
// Ensure at least one entry
|
|
82663
82695
|
if (initialEntries.length === 0) {
|
|
82664
82696
|
initialEntries.push({
|
|
82665
|
-
value: getDefaultValue(
|
|
82697
|
+
value: getDefaultValue(),
|
|
82666
82698
|
isValid: true
|
|
82667
82699
|
});
|
|
82668
82700
|
}
|
|
@@ -82683,14 +82715,14 @@ function usePriceFactor(_ref) {
|
|
|
82683
82715
|
var newEntries = hasChangedCurrentType ? [] : entries[newType];
|
|
82684
82716
|
setEntries(function (prev) {
|
|
82685
82717
|
return _objectSpread$b(_objectSpread$b({}, prev), {}, _defineProperty({}, newType, newEntries.length > 0 ? newEntries : [{
|
|
82686
|
-
value: getDefaultValue(
|
|
82718
|
+
value: getDefaultValue(),
|
|
82687
82719
|
isValid: true
|
|
82688
82720
|
}]));
|
|
82689
82721
|
});
|
|
82690
82722
|
setHasChangedCurrentType(false);
|
|
82691
82723
|
};
|
|
82692
82724
|
var handleAddEntry = function handleAddEntry() {
|
|
82693
|
-
var defaultValue = getDefaultValue(
|
|
82725
|
+
var defaultValue = getDefaultValue();
|
|
82694
82726
|
updateEntries([].concat(_toConsumableArray(entries[type]), [{
|
|
82695
82727
|
value: defaultValue,
|
|
82696
82728
|
isValid: true
|
|
@@ -82701,7 +82733,7 @@ function usePriceFactor(_ref) {
|
|
|
82701
82733
|
if (currentEntries.length === 1) {
|
|
82702
82734
|
// Reset to default when removing last entry
|
|
82703
82735
|
updateEntries([{
|
|
82704
|
-
value: getDefaultValue(
|
|
82736
|
+
value: getDefaultValue(),
|
|
82705
82737
|
isValid: true
|
|
82706
82738
|
}]);
|
|
82707
82739
|
} else {
|
|
@@ -82715,6 +82747,7 @@ function usePriceFactor(_ref) {
|
|
|
82715
82747
|
var newEntries = _toConsumableArray(entries[type]);
|
|
82716
82748
|
newEntries[index] = {
|
|
82717
82749
|
value: actualValue,
|
|
82750
|
+
input: displayValue,
|
|
82718
82751
|
isValid: isValidInput(actualValue, type)
|
|
82719
82752
|
};
|
|
82720
82753
|
updateEntries(newEntries);
|
|
@@ -82726,7 +82759,7 @@ function usePriceFactor(_ref) {
|
|
|
82726
82759
|
while (1) switch (_context.prev = _context.next) {
|
|
82727
82760
|
case 0:
|
|
82728
82761
|
currentEntries = entries[type]; // Don't save if we only have a default entry
|
|
82729
|
-
if (!(currentEntries.length === 1 && isDefaultValue(currentEntries[0].value
|
|
82762
|
+
if (!(currentEntries.length === 1 && isDefaultValue(currentEntries[0].value))) {
|
|
82730
82763
|
_context.next = 7;
|
|
82731
82764
|
break;
|
|
82732
82765
|
}
|
|
@@ -82747,7 +82780,7 @@ function usePriceFactor(_ref) {
|
|
|
82747
82780
|
case 9:
|
|
82748
82781
|
// Filter out default and invalid values
|
|
82749
82782
|
effectiveValues = currentEntries.filter(function (entry) {
|
|
82750
|
-
return !isDefaultValue(entry.value
|
|
82783
|
+
return !isDefaultValue(entry.value) && isEffectiveValue(entry.value, type);
|
|
82751
82784
|
}).map(function (entry) {
|
|
82752
82785
|
return parseFloat(entry.value);
|
|
82753
82786
|
});
|
|
@@ -82786,7 +82819,7 @@ var space = "space-T5Mkd";
|
|
|
82786
82819
|
var input$1 = "input-SK-Fo";
|
|
82787
82820
|
var addButton = "addButton-AVN8Y";
|
|
82788
82821
|
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:
|
|
82822
|
+
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
82823
|
styleInject(css_248z$3);
|
|
82791
82824
|
|
|
82792
82825
|
function PriceFactorCellRenderer(props) {
|
|
@@ -82908,7 +82941,7 @@ function PriceFactorCellRenderer(props) {
|
|
|
82908
82941
|
};
|
|
82909
82942
|
}, []);
|
|
82910
82943
|
var isDiscount = type === 'discount';
|
|
82911
|
-
var isSingleDefaultEntry = entries.length === 1 && isDefaultValue(entries[0].value
|
|
82944
|
+
var isSingleDefaultEntry = entries.length === 1 && isDefaultValue(entries[0].value);
|
|
82912
82945
|
var hasInvalidEntries = entries.some(function (entry) {
|
|
82913
82946
|
return entry.isValid === false;
|
|
82914
82947
|
});
|
|
@@ -82948,21 +82981,22 @@ function PriceFactorCellRenderer(props) {
|
|
|
82948
82981
|
}), /*#__PURE__*/jsx(List$1, {
|
|
82949
82982
|
dataSource: entries,
|
|
82950
82983
|
renderItem: function renderItem(entry, index) {
|
|
82984
|
+
var _entry$input;
|
|
82951
82985
|
return /*#__PURE__*/jsx(List$1.Item, {
|
|
82952
82986
|
children: /*#__PURE__*/jsx(Form$2.Item, {
|
|
82953
82987
|
validateStatus: entry.isValid === false ? 'error' : undefined,
|
|
82954
|
-
help: entry.isValid === false ? t(isDiscount ? 'backoffice.idmCatalog.prices.priceFactor.error.
|
|
82988
|
+
help: entry.isValid === false ? t(isDiscount ? 'backoffice.idmCatalog.prices.priceFactor.error.invalidDiscount' : 'backoffice.idmCatalog.prices.priceFactor.error.invalidFactor') : undefined,
|
|
82955
82989
|
className: space,
|
|
82956
82990
|
children: /*#__PURE__*/jsxs(Space, {
|
|
82957
82991
|
children: [/*#__PURE__*/jsx(Input$1, {
|
|
82958
82992
|
type: "number",
|
|
82959
|
-
value: convertToDisplayValue(entry.value, type),
|
|
82993
|
+
value: (_entry$input = entry.input) !== null && _entry$input !== void 0 ? _entry$input : convertToDisplayValue(entry.value, type),
|
|
82960
82994
|
onChange: function onChange(e) {
|
|
82961
82995
|
return handleEntryValueChange(index, e.target.value);
|
|
82962
82996
|
},
|
|
82963
|
-
step: isDiscount ? '
|
|
82997
|
+
step: isDiscount ? 'any' : '0.1',
|
|
82964
82998
|
min: isDiscount ? '0' : '1',
|
|
82965
|
-
max: isDiscount ?
|
|
82999
|
+
max: isDiscount ? String(MAX_DISCOUNT) : undefined,
|
|
82966
83000
|
className: input$1,
|
|
82967
83001
|
addonAfter: isDiscount ? '%' : undefined
|
|
82968
83002
|
}), /*#__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":""}
|
package/build/types/backoffice/src/ui/AssortmentManager/ArticleData/logic/articleColumns.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"articleColumns.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/AssortmentManager/ArticleData/logic/articleColumns.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAoB,MAAM,4BAA4B,CAAC;AAE3F,OAAO,EAA0B,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAC;AAIvE,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC1C,KAAK,aAAa,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,UAAqB,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,UAMjC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,UAIjC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,8BAG/B,CAAC;AAoBF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,aAAa,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAIvF,CAAC;AA+DH;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAOjH;
|
|
1
|
+
{"version":3,"file":"articleColumns.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/AssortmentManager/ArticleData/logic/articleColumns.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAoB,MAAM,4BAA4B,CAAC;AAE3F,OAAO,EAA0B,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEnD,OAAO,EAAE,SAAS,EAAE,MAAM,4CAA4C,CAAC;AAIvE,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC1C,KAAK,aAAa,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;AAE1E;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,UAAqB,CAAC;AAEpD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,UAMjC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,UAIjC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,8BAG/B,CAAC;AAoBF;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,EAAE,aAAa,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAIvF,CAAC;AA+DH;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,UAAU,GAAG,SAAS,EAAE,IAAI,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAOjH;AAqRD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,CAAC,EAAE,SAAS,EACZ,wBAAwB,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC,cAAc,CAAC,EACjE,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,CAAM,GAC1C,aAAa,EAAE,CAkFjB"}
|
|
@@ -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.39",
|
|
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.39",
|
|
20
|
+
"@crystaldesign/content-item": "26.12.0-beta.39",
|
|
21
|
+
"@crystaldesign/diva-agent": "26.12.0-beta.39",
|
|
22
|
+
"@crystaldesign/diva-core": "26.12.0-beta.39",
|
|
23
|
+
"@crystaldesign/diva-utils": "26.12.0-beta.39",
|
|
24
|
+
"@crystaldesign/media-upload": "26.12.0-beta.39",
|
|
25
|
+
"@crystaldesign/rtf-editor": "26.12.0-beta.39",
|
|
26
|
+
"@crystaldesign/spreadsheet": "26.12.0-beta.39",
|
|
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": "f96b0d8575dc62c81e5d95787bbd0e6ab7bc4023"
|
|
61
61
|
}
|