@crystaldesign/diva-backoffice 25.7.0-beta.20 → 25.7.0-beta.22
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 +62 -39
- package/build/types/backoffice/src/ui/AGGrid/index.d.ts +0 -3
- package/build/types/backoffice/src/ui/AGGrid/index.d.ts.map +1 -1
- package/build/types/backoffice/src/ui/IDMEnricherEditor/components/PriceFactorCellRenderer/index.d.ts +4 -1
- package/build/types/backoffice/src/ui/IDMEnricherEditor/components/PriceFactorCellRenderer/index.d.ts.map +1 -1
- package/package.json +9 -9
package/build/esm/index.js
CHANGED
@@ -111,9 +111,6 @@ import { sort as sort$1 } from 'fast-sort';
|
|
111
111
|
import { v4 } from 'uuid';
|
112
112
|
import hash from 'object-hash';
|
113
113
|
import { AgGridReact } from 'ag-grid-react';
|
114
|
-
import 'ag-grid-community/styles/ag-grid.css';
|
115
|
-
import 'ag-grid-community/styles/ag-theme-alpine.css';
|
116
|
-
import 'ag-grid-enterprise';
|
117
114
|
import Collapsible from 'react-collapsible';
|
118
115
|
import QuestionOutlined from '@ant-design/icons/QuestionOutlined';
|
119
116
|
import { TransformWrapper, TransformComponent } from 'react-zoom-pan-pinch';
|
@@ -34294,11 +34291,12 @@ function PriceFactorCellRenderer(props) {
|
|
34294
34291
|
column = props.column,
|
34295
34292
|
onSave = props.onSave,
|
34296
34293
|
api = props.api,
|
34297
|
-
|
34294
|
+
isNotInAGGrid = props.isNotInAGGrid;
|
34298
34295
|
var _useTranslation = useTranslation(),
|
34299
34296
|
t = _useTranslation.t,
|
34300
34297
|
i18n = _useTranslation.i18n;
|
34301
|
-
var
|
34298
|
+
var clickTimer = useRef(null);
|
34299
|
+
var applySave = useCallback(/*#__PURE__*/function () {
|
34302
34300
|
var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(data, value) {
|
34303
34301
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
34304
34302
|
while (1) switch (_context.prev = _context.next) {
|
@@ -34320,10 +34318,36 @@ function PriceFactorCellRenderer(props) {
|
|
34320
34318
|
}
|
34321
34319
|
}, _callee);
|
34322
34320
|
}));
|
34323
|
-
return function
|
34321
|
+
return function (_x, _x2) {
|
34324
34322
|
return _ref.apply(this, arguments);
|
34325
34323
|
};
|
34326
|
-
}();
|
34324
|
+
}(), [onSave, node, colDef === null || colDef === void 0 ? void 0 : colDef.field]);
|
34325
|
+
var _usePriceFactor = usePriceFactor({
|
34326
|
+
data: data,
|
34327
|
+
initialValue: value,
|
34328
|
+
onSave: applySave,
|
34329
|
+
onRefreshCell: function onRefreshCell() {
|
34330
|
+
return api === null || api === void 0 ? void 0 : api.refreshCells({
|
34331
|
+
suppressFlash: true,
|
34332
|
+
rowNodes: node ? [node] : undefined,
|
34333
|
+
columns: column ? [column] : undefined
|
34334
|
+
});
|
34335
|
+
}
|
34336
|
+
}),
|
34337
|
+
type = _usePriceFactor.type,
|
34338
|
+
entries = _usePriceFactor.entries,
|
34339
|
+
isModalOpen = _usePriceFactor.isModalOpen,
|
34340
|
+
handleModalOpen = _usePriceFactor.handleModalOpen,
|
34341
|
+
handleModalClose = _usePriceFactor.handleModalClose,
|
34342
|
+
handleTypeChange = _usePriceFactor.handleTypeChange,
|
34343
|
+
handleAddEntry = _usePriceFactor.handleAddEntry,
|
34344
|
+
handleRemoveEntry = _usePriceFactor.handleRemoveEntry,
|
34345
|
+
handleEntryValueChange = _usePriceFactor.handleEntryValueChange,
|
34346
|
+
handleSave = _usePriceFactor.handleSave;
|
34347
|
+
var handleOpenModal = useCallback(function () {
|
34348
|
+
handleModalOpen();
|
34349
|
+
api === null || api === void 0 || api.stopEditing();
|
34350
|
+
}, [handleModalOpen, api]);
|
34327
34351
|
useEffect(function () {
|
34328
34352
|
//
|
34329
34353
|
// This is a workaround to prevent the row to go into edit mode when the cell is clicked.
|
@@ -34339,47 +34363,44 @@ function PriceFactorCellRenderer(props) {
|
|
34339
34363
|
if (rowElement && cellElement && rowElement.getAttribute('row-id') === (node === null || node === void 0 ? void 0 : node.id) && cellElement.getAttribute('col-id') === (colDef === null || colDef === void 0 ? void 0 : colDef.field)) {
|
34340
34364
|
e.preventDefault();
|
34341
34365
|
e.stopPropagation();
|
34342
|
-
|
34343
|
-
api === null || api === void 0 || api.stopEditing();
|
34366
|
+
handleOpenModal();
|
34344
34367
|
return false;
|
34345
34368
|
}
|
34346
34369
|
return true;
|
34347
34370
|
};
|
34348
|
-
if (
|
34349
|
-
document.addEventListener('click', handleClick, true);
|
34350
|
-
} else {
|
34371
|
+
if (!isNotInAGGrid) {
|
34351
34372
|
document.addEventListener('dblclick', handleClick, true);
|
34352
34373
|
}
|
34353
34374
|
return function () {
|
34354
|
-
if (
|
34355
|
-
document.removeEventListener('click', handleClick, true);
|
34356
|
-
} else {
|
34375
|
+
if (!isNotInAGGrid) {
|
34357
34376
|
document.removeEventListener('dblclick', handleClick, true);
|
34358
34377
|
}
|
34359
34378
|
};
|
34360
|
-
}, [api, node === null || node === void 0 ? void 0 : node.id, colDef === null || colDef === void 0 ? void 0 : colDef.field,
|
34361
|
-
|
34362
|
-
|
34363
|
-
|
34364
|
-
|
34365
|
-
|
34366
|
-
|
34367
|
-
|
34368
|
-
|
34369
|
-
|
34370
|
-
|
34371
|
-
}
|
34372
|
-
}
|
34373
|
-
|
34374
|
-
|
34375
|
-
|
34376
|
-
|
34377
|
-
|
34378
|
-
|
34379
|
-
|
34380
|
-
|
34381
|
-
|
34382
|
-
|
34379
|
+
}, [api, node === null || node === void 0 ? void 0 : node.id, colDef === null || colDef === void 0 ? void 0 : colDef.field, isNotInAGGrid, handleOpenModal]);
|
34380
|
+
|
34381
|
+
/*
|
34382
|
+
* if the component is used outside of an ag-grid cell, we have to handle the click event differently
|
34383
|
+
* we debounce the click event to prevent multiple clicks from opening and immediately closing the modal
|
34384
|
+
*/
|
34385
|
+
var onClick = useCallback(function () {
|
34386
|
+
if (isNotInAGGrid) {
|
34387
|
+
if (clickTimer.current) clearTimeout(clickTimer.current);
|
34388
|
+
clickTimer.current = setTimeout(function () {
|
34389
|
+
handleOpenModal();
|
34390
|
+
}, 200);
|
34391
|
+
}
|
34392
|
+
}, [isNotInAGGrid, handleOpenModal]);
|
34393
|
+
var onDoubleClick = useCallback(function () {
|
34394
|
+
if (isNotInAGGrid) {
|
34395
|
+
if (clickTimer.current) clearTimeout(clickTimer.current);
|
34396
|
+
handleOpenModal();
|
34397
|
+
}
|
34398
|
+
}, [isNotInAGGrid, handleOpenModal]);
|
34399
|
+
useEffect(function () {
|
34400
|
+
return function () {
|
34401
|
+
if (clickTimer.current) clearTimeout(clickTimer.current);
|
34402
|
+
};
|
34403
|
+
}, []);
|
34383
34404
|
var isDiscount = type === 'discount';
|
34384
34405
|
var isSingleDefaultEntry = entries.length === 1 && isDefaultValue(entries[0].value, type);
|
34385
34406
|
var hasInvalidEntries = entries.some(function (entry) {
|
@@ -34388,6 +34409,8 @@ function PriceFactorCellRenderer(props) {
|
|
34388
34409
|
return /*#__PURE__*/jsxs(Fragment, {
|
34389
34410
|
children: [/*#__PURE__*/jsx("div", {
|
34390
34411
|
className: cell,
|
34412
|
+
onClick: onClick,
|
34413
|
+
onDoubleClick: onDoubleClick,
|
34391
34414
|
children: formatListValue(value || [], type, i18n.language)
|
34392
34415
|
}), /*#__PURE__*/jsxs(Modal$2, {
|
34393
34416
|
title: colDef === null || colDef === void 0 ? void 0 : colDef.headerName,
|
@@ -34582,7 +34605,7 @@ function PriceFactorInput(props) {
|
|
34582
34605
|
id: "price-factor-input",
|
34583
34606
|
className: classnames(input, _defineProperty({}, disabled$1, props.disabled)),
|
34584
34607
|
children: /*#__PURE__*/jsx(PriceFactorCellRenderer, _objectSpread$d(_objectSpread$d({}, props), {}, {
|
34585
|
-
|
34608
|
+
isNotInAGGrid: true
|
34586
34609
|
}))
|
34587
34610
|
})
|
34588
34611
|
})]
|
@@ -1,7 +1,4 @@
|
|
1
1
|
import React from 'react';
|
2
|
-
import 'ag-grid-community/styles/ag-grid.css';
|
3
|
-
import 'ag-grid-community/styles/ag-theme-alpine.css';
|
4
|
-
import 'ag-grid-enterprise';
|
5
2
|
declare const AGGrid: React.MemoExoticComponent<({ id, filter, override, loading }: {
|
6
3
|
id: string;
|
7
4
|
filter: any;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/AGGrid/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8C,MAAM,OAAO,CAAC;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/AGGrid/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA8C,MAAM,OAAO,CAAC;AAmBnE,QAAA,MAAM,MAAM,gEAC0B;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,GAAG,CAAC;IAAC,QAAQ,CAAC,EAAE;QAAE,gBAAgB,EAAE,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;KAAE,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,uBAwOzI,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
@@ -11,6 +11,9 @@ export default function PriceFactorCellRenderer(props: Partial<CustomCellRendere
|
|
11
11
|
manualPrices: string[];
|
12
12
|
}, number[], DivaContext>> & {
|
13
13
|
onSave?: (data: any, value: number[]) => Promise<void>;
|
14
|
-
|
14
|
+
/**
|
15
|
+
* if true, the component is used outside of an ag-grid cell, thus we have to handle the click event differently
|
16
|
+
*/
|
17
|
+
isNotInAGGrid?: boolean;
|
15
18
|
}): React.JSX.Element;
|
16
19
|
//# sourceMappingURL=index.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMEnricherEditor/components/PriceFactorCellRenderer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMEnricherEditor/components/PriceFactorCellRenderer/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyC,MAAM,OAAO,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAQzD,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAC7C,KAAK,EAAE,OAAO,CACZ,uBAAuB,CACrB;IACE,MAAM,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAClC,UAAU,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACtC,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,EACD,MAAM,EAAE,EACR,WAAW,CACZ,CACF,GAAG;IACF,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvD;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,qBAqLF"}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@crystaldesign/diva-backoffice",
|
3
|
-
"version": "25.7.0-beta.
|
3
|
+
"version": "25.7.0-beta.22",
|
4
4
|
"license": "COMMERCIAL",
|
5
5
|
"devDependencies": {
|
6
6
|
"@testing-library/jest-dom": "^6.5.0",
|
@@ -15,13 +15,13 @@
|
|
15
15
|
"dependencies": {
|
16
16
|
"@ant-design/icons": "5.4.0",
|
17
17
|
"@babel/runtime": "7.24.7",
|
18
|
-
"@crystaldesign/content-box": "25.7.0-beta.
|
19
|
-
"@crystaldesign/content-item": "25.7.0-beta.
|
20
|
-
"@crystaldesign/diva-core": "25.7.0-beta.
|
21
|
-
"@crystaldesign/diva-utils": "25.7.0-beta.
|
22
|
-
"@crystaldesign/media-upload": "25.7.0-beta.
|
23
|
-
"@crystaldesign/rtf-editor": "25.7.0-beta.
|
24
|
-
"@crystaldesign/spreadsheet": "25.7.0-beta.
|
18
|
+
"@crystaldesign/content-box": "25.7.0-beta.22",
|
19
|
+
"@crystaldesign/content-item": "25.7.0-beta.22",
|
20
|
+
"@crystaldesign/diva-core": "25.7.0-beta.22",
|
21
|
+
"@crystaldesign/diva-utils": "25.7.0-beta.22",
|
22
|
+
"@crystaldesign/media-upload": "25.7.0-beta.22",
|
23
|
+
"@crystaldesign/rtf-editor": "25.7.0-beta.22",
|
24
|
+
"@crystaldesign/spreadsheet": "25.7.0-beta.22",
|
25
25
|
"@google/model-viewer": "3.5.0",
|
26
26
|
"ag-charts-community": "^10.1.0",
|
27
27
|
"ag-charts-react": "^10.1.0",
|
@@ -51,5 +51,5 @@
|
|
51
51
|
},
|
52
52
|
"module": "build/esm/index.js",
|
53
53
|
"types": "./build/types/backoffice/src/index.d.ts",
|
54
|
-
"gitHead": "
|
54
|
+
"gitHead": "9c5ac31c405252d8200e0ba266037ce7c28f904c"
|
55
55
|
}
|