@crystaldesign/diva-backoffice 26.6.0-beta.7 → 26.6.0-beta.8

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.
@@ -47255,12 +47255,16 @@ var TableDetailInfos = observer(function () {
47255
47255
  });
47256
47256
 
47257
47257
  function PartlistPos(_ref) {
47258
+ var _partlist$lastUpdated;
47258
47259
  var organizationId = _ref.organizationId,
47259
47260
  catalog = _ref.catalog,
47260
47261
  partlist = _ref.partlist,
47261
47262
  apiConfig = _ref.apiConfig,
47262
47263
  hooks = _ref.hooks,
47263
- setNodeDataValue = _ref.setNodeDataValue;
47264
+ setNodeDataValue = _ref.setNodeDataValue,
47265
+ onPartlistPosExcelImportComplete = _ref.onPartlistPosExcelImportComplete,
47266
+ _ref$spreadsheetRemou = _ref.spreadsheetRemountNonce,
47267
+ spreadsheetRemountNonce = _ref$spreadsheetRemou === void 0 ? 0 : _ref$spreadsheetRemou;
47264
47268
  var _useTranslation = useTranslation(),
47265
47269
  t = _useTranslation.t;
47266
47270
  var addFeature = useCallback(function (value) {
@@ -47290,6 +47294,7 @@ function PartlistPos(_ref) {
47290
47294
  var ref = useRef(null);
47291
47295
  var _useDivaCore = useDivaCore(),
47292
47296
  jwt = _useDivaCore.state.jwt;
47297
+ var partlistPosSpreadsheetKey = "".concat(partlist._id, "-").concat(String((_partlist$lastUpdated = partlist.lastUpdatedDate) !== null && _partlist$lastUpdated !== void 0 ? _partlist$lastUpdated : ''), "-").concat(spreadsheetRemountNonce);
47293
47298
  var visibility = useMemo(function () {
47294
47299
  return [{
47295
47300
  name: t('backoffice.idmCatalog.partlistpos.label.visiblityDic.v0'),
@@ -47592,10 +47597,34 @@ function PartlistPos(_ref) {
47592
47597
  authToken: jwt,
47593
47598
  acceptedFileTypes: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
47594
47599
  uploadHint: t('backoffice.idmEnricher.importexcel.uploadhint'),
47595
- onUploadComplete: function onUploadComplete() {
47596
- var _ref$current;
47597
- (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.refresh();
47598
- }
47600
+ onUploadComplete: function () {
47601
+ var _onUploadComplete = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
47602
+ var _ref$current;
47603
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
47604
+ while (1) switch (_context.prev = _context.next) {
47605
+ case 0:
47606
+ if (!onPartlistPosExcelImportComplete) {
47607
+ _context.next = 5;
47608
+ break;
47609
+ }
47610
+ _context.next = 3;
47611
+ return onPartlistPosExcelImportComplete();
47612
+ case 3:
47613
+ _context.next = 6;
47614
+ break;
47615
+ case 5:
47616
+ (_ref$current = ref.current) === null || _ref$current === void 0 || _ref$current.refresh();
47617
+ case 6:
47618
+ case "end":
47619
+ return _context.stop();
47620
+ }
47621
+ }, _callee);
47622
+ }));
47623
+ function onUploadComplete() {
47624
+ return _onUploadComplete.apply(this, arguments);
47625
+ }
47626
+ return onUploadComplete;
47627
+ }()
47599
47628
  }, {
47600
47629
  type: 'export',
47601
47630
  key: 'download',
@@ -47614,13 +47643,15 @@ function PartlistPos(_ref) {
47614
47643
  applicationData: applicationData,
47615
47644
  configuration: configuration,
47616
47645
  hooks: hooks
47617
- }, partlist._id)]
47646
+ }, partlistPosSpreadsheetKey)]
47618
47647
  });
47619
47648
  }
47620
47649
 
47621
47650
  var TablePartlists = observer(function () {
47622
47651
  var _useTranslation = useTranslation(),
47623
47652
  t = _useTranslation.t;
47653
+ var _useDivaCore = useDivaCore(),
47654
+ jwt = _useDivaCore.state.jwt;
47624
47655
  var spreadsheetRef = useRef(null);
47625
47656
  var _useModule = useModule(['partlists']),
47626
47657
  selectedCatalog = _useModule.selectedCatalog,
@@ -47639,6 +47670,62 @@ var TablePartlists = observer(function () {
47639
47670
  _React$useState4 = _slicedToArray(_React$useState3, 2),
47640
47671
  selectedNodeId = _React$useState4[0],
47641
47672
  setSelectedNodeId = _React$useState4[1];
47673
+ var _React$useState5 = React.useState(0),
47674
+ _React$useState6 = _slicedToArray(_React$useState5, 2),
47675
+ partlistPosSpreadsheetRemountNonce = _React$useState6[0],
47676
+ setPartlistPosSpreadsheetRemountNonce = _React$useState6[1];
47677
+ var selectedPartlistRef = useRef(selectedPartlist);
47678
+ selectedPartlistRef.current = selectedPartlist;
47679
+
47680
+ // Excel import does not go through the grid transaction path, so hooks.onDataUpdated never runs for that row.
47681
+ // Reload the partlist document like a fresh row selection, then remount PartlistPos so feature columns match.
47682
+ var onPartlistPosExcelImportComplete = useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
47683
+ var _spreadsheetRef$curre, _selectedPartlistRef$;
47684
+ var partlistId, res;
47685
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
47686
+ while (1) switch (_context.prev = _context.next) {
47687
+ case 0:
47688
+ (_spreadsheetRef$curre = spreadsheetRef.current) === null || _spreadsheetRef$curre === void 0 || _spreadsheetRef$curre.refresh();
47689
+ partlistId = (_selectedPartlistRef$ = selectedPartlistRef.current) === null || _selectedPartlistRef$ === void 0 ? void 0 : _selectedPartlistRef$._id;
47690
+ if (!(partlistId && jwt && catalogId)) {
47691
+ _context.next = 17;
47692
+ break;
47693
+ }
47694
+ _context.prev = 3;
47695
+ _context.next = 6;
47696
+ return fetch("".concat(apiConfig.idmService, "/catalogs/").concat(catalogId, "/partlists/").concat(partlistId), {
47697
+ headers: {
47698
+ Authorization: "Bearer ".concat(jwt)
47699
+ }
47700
+ });
47701
+ case 6:
47702
+ res = _context.sent;
47703
+ if (!res.ok) {
47704
+ _context.next = 13;
47705
+ break;
47706
+ }
47707
+ _context.t0 = setSelectedPartlist;
47708
+ _context.next = 11;
47709
+ return res.json();
47710
+ case 11:
47711
+ _context.t1 = _context.sent;
47712
+ (0, _context.t0)(_context.t1);
47713
+ case 13:
47714
+ _context.next = 17;
47715
+ break;
47716
+ case 15:
47717
+ _context.prev = 15;
47718
+ _context.t2 = _context["catch"](3);
47719
+ case 17:
47720
+ setPartlistPosSpreadsheetRemountNonce(function (n) {
47721
+ return n + 1;
47722
+ });
47723
+ case 18:
47724
+ case "end":
47725
+ return _context.stop();
47726
+ }
47727
+ }, _callee, null, [[3, 15]]);
47728
+ })), [apiConfig.idmService, catalogId, jwt]);
47642
47729
  var setNodeDataValue = useCallback(function (data) {
47643
47730
  spreadsheetRef.current.setNodeDataValue(selectedNodeId, data);
47644
47731
  }, [selectedNodeId]);
@@ -47658,7 +47745,9 @@ var TablePartlists = observer(function () {
47658
47745
  catalog: selectedCatalog,
47659
47746
  apiConfig: apiConfig,
47660
47747
  partlist: selectedPartlist,
47661
- setNodeDataValue: setNodeDataValue
47748
+ spreadsheetRemountNonce: partlistPosSpreadsheetRemountNonce,
47749
+ setNodeDataValue: setNodeDataValue,
47750
+ onPartlistPosExcelImportComplete: onPartlistPosExcelImportComplete
47662
47751
  },
47663
47752
  condition: function condition() {
47664
47753
  return (selectedPartlist === null || selectedPartlist === void 0 ? void 0 : selectedPartlist._id) !== undefined;
@@ -1,12 +1,16 @@
1
1
  import React from 'react';
2
2
  import { ApiConfig } from '@crystaldesign/diva-core';
3
3
  import { DivaSpreadsheetHooks } from '@crystaldesign/spreadsheet';
4
- export default function PartlistPos({ organizationId, catalog, partlist, apiConfig, hooks, setNodeDataValue, }: {
4
+ export default function PartlistPos({ organizationId, catalog, partlist, apiConfig, hooks, setNodeDataValue, onPartlistPosExcelImportComplete, spreadsheetRemountNonce, }: {
5
5
  organizationId: string;
6
6
  catalog: any;
7
7
  partlist: any;
8
8
  apiConfig: ApiConfig;
9
9
  hooks?: DivaSpreadsheetHooks<any>;
10
10
  setNodeDataValue: (data: Record<string, any>) => boolean;
11
+ /** Refreshes partlists, reloads the partlist from the API (featureRefs etc.), remounts the PartlistPos grid. */
12
+ onPartlistPosExcelImportComplete?: () => void | Promise<void>;
13
+ /** Changing this value remounts the partlistpos Spreadsheet (e.g. after Excel import). */
14
+ spreadsheetRemountNonce?: number;
11
15
  }): React.JSX.Element;
12
16
  //# sourceMappingURL=PartlistPos.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PartlistPos.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/IDMCatalogEditor/Tables/PartlistPos.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAqC,MAAM,0BAA0B,CAAC;AACxF,OAAO,EAAE,oBAAoB,EAAmD,MAAM,4BAA4B,CAAC;AAQnH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,cAAc,EACd,OAAO,EACP,QAAQ,EACR,SAAS,EACT,KAAK,EACL,gBAAgB,GACjB,EAAE;IACD,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,GAAG,CAAC;IACb,QAAQ,EAAE,GAAG,CAAC;IACd,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAClC,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC;CAC1D,qBAsWA"}
1
+ {"version":3,"file":"PartlistPos.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/IDMCatalogEditor/Tables/PartlistPos.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAqC,MAAM,0BAA0B,CAAC;AACxF,OAAO,EAAE,oBAAoB,EAAmD,MAAM,4BAA4B,CAAC;AAQnH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,cAAc,EACd,OAAO,EACP,QAAQ,EACR,SAAS,EACT,KAAK,EACL,gBAAgB,EAChB,gCAAgC,EAChC,uBAA2B,GAC5B,EAAE;IACD,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,GAAG,CAAC;IACb,QAAQ,EAAE,GAAG,CAAC;IACd,SAAS,EAAE,SAAS,CAAC;IACrB,KAAK,CAAC,EAAE,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAClC,gBAAgB,EAAE,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC;IACzD,gHAAgH;IAChH,gCAAgC,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,0FAA0F;IAC1F,uBAAuB,CAAC,EAAE,MAAM,CAAC;CAClC,qBA4WA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMCatalogEditor/modules/TablePartlists/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAmB5D,eAAO,MAAM,cAAc;;CAqMzB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMCatalogEditor/modules/TablePartlists/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAa5D,eAAO,MAAM,cAAc;;CAiOzB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystaldesign/diva-backoffice",
3
- "version": "26.6.0-beta.7",
3
+ "version": "26.6.0-beta.8",
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": "6.1.0",
17
17
  "@babel/runtime": "7.24.7",
18
- "@crystaldesign/content-box": "26.6.0-beta.7",
19
- "@crystaldesign/content-item": "26.6.0-beta.7",
20
- "@crystaldesign/diva-core": "26.6.0-beta.7",
21
- "@crystaldesign/diva-utils": "26.6.0-beta.7",
22
- "@crystaldesign/media-upload": "26.6.0-beta.7",
23
- "@crystaldesign/rtf-editor": "26.6.0-beta.7",
24
- "@crystaldesign/spreadsheet": "26.6.0-beta.7",
18
+ "@crystaldesign/content-box": "26.6.0-beta.8",
19
+ "@crystaldesign/content-item": "26.6.0-beta.8",
20
+ "@crystaldesign/diva-core": "26.6.0-beta.8",
21
+ "@crystaldesign/diva-utils": "26.6.0-beta.8",
22
+ "@crystaldesign/media-upload": "26.6.0-beta.8",
23
+ "@crystaldesign/rtf-editor": "26.6.0-beta.8",
24
+ "@crystaldesign/spreadsheet": "26.6.0-beta.8",
25
25
  "@google/genai": "^1.22.0",
26
26
  "@google/model-viewer": "3.5.0",
27
27
  "ag-charts-community": "^10.1.0",
@@ -53,5 +53,5 @@
53
53
  },
54
54
  "module": "build/esm/index.js",
55
55
  "types": "./build/types/backoffice/src/index.d.ts",
56
- "gitHead": "6a8ff185f14acc01bc8d081fe3340ab56ee26e97"
56
+ "gitHead": "8be50be9e24be3403f8db90efeecf0cfb9e86cbd"
57
57
  }