@crystaldesign/diva-backoffice 26.4.0-beta.10 → 26.4.0-beta.12

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.
@@ -13765,6 +13765,7 @@ function loadConfiguration(t, root, config, lang, apiConfig) {
13765
13765
  },
13766
13766
  MediaUploadOrganizationLogo: {
13767
13767
  type: 'MediaUpload',
13768
+ fileTypes: ['image/jpeg', 'image/jpg', 'image/png'],
13768
13769
  size: 'medium',
13769
13770
  title: t('backoffice.media.uploadorglogo.title'),
13770
13771
  apiInterface: {
@@ -14040,6 +14041,7 @@ function loadConfiguration(t, root, config, lang, apiConfig) {
14040
14041
  },
14041
14042
  MediaUploadOrganizationLogoMobile: {
14042
14043
  type: 'MediaUpload',
14044
+ fileTypes: ['image/jpeg', 'image/jpg', 'image/png'],
14043
14045
  size: 'medium',
14044
14046
  title: t('backoffice.media.uploadorglogomobile.title'),
14045
14047
  apiInterface: {
@@ -26968,6 +26970,10 @@ var useMediaUpload = function useMediaUpload(_ref) {
26968
26970
  _useState4 = _slicedToArray(_useState3, 2),
26969
26971
  fileList = _useState4[0],
26970
26972
  setFileList = _useState4[1];
26973
+ var _useState5 = useState(false),
26974
+ _useState6 = _slicedToArray(_useState5, 2),
26975
+ wrongFileType = _useState6[0],
26976
+ setWrongFileType = _useState6[1];
26971
26977
  var _useMemo = useMemo(function () {
26972
26978
  return {
26973
26979
  apiHandler: root.getApiHandler(id),
@@ -27070,6 +27076,16 @@ var useMediaUpload = function useMediaUpload(_ref) {
27070
27076
  return _ref5.apply(this, arguments);
27071
27077
  };
27072
27078
  }();
27079
+ var beforeUpload = function beforeUpload(file) {
27080
+ if (configuration.fileTypes && !configuration.fileTypes.find(function (type) {
27081
+ return file.type == type;
27082
+ })) {
27083
+ setWrongFileType(true);
27084
+ return false;
27085
+ }
27086
+ setWrongFileType(false);
27087
+ return true;
27088
+ };
27073
27089
  return {
27074
27090
  loading: loading,
27075
27091
  onRemove: onRemove,
@@ -27080,7 +27096,9 @@ var useMediaUpload = function useMediaUpload(_ref) {
27080
27096
  });
27081
27097
  }),
27082
27098
  size: configuration.size || 'medium',
27083
- title: configuration.title
27099
+ title: configuration.title,
27100
+ beforeUpload: beforeUpload,
27101
+ wrongFileType: wrongFileType
27084
27102
  };
27085
27103
  };
27086
27104
 
@@ -27098,9 +27116,13 @@ var MediaUpload = observer(function (_ref) {
27098
27116
  loading = _useMediaUpload.loading,
27099
27117
  fileList = _useMediaUpload.fileList,
27100
27118
  customRequest = _useMediaUpload.customRequest,
27119
+ _beforeUpload = _useMediaUpload.beforeUpload,
27120
+ wrongFileType = _useMediaUpload.wrongFileType,
27101
27121
  onRemove = _useMediaUpload.onRemove,
27102
27122
  size = _useMediaUpload.size,
27103
27123
  title = _useMediaUpload.title;
27124
+ var _useTranslation = useTranslation(),
27125
+ t = _useTranslation.t;
27104
27126
  return /*#__PURE__*/jsxs("div", {
27105
27127
  style: {
27106
27128
  width: 'min-content'
@@ -27109,9 +27131,9 @@ var MediaUpload = observer(function (_ref) {
27109
27131
  title: title
27110
27132
  }), /*#__PURE__*/jsx("div", {
27111
27133
  className: size == 'big' ? big : size == 'small' ? small : medium,
27112
- children: /*#__PURE__*/jsx(Spin, {
27134
+ children: /*#__PURE__*/jsxs(Spin, {
27113
27135
  spinning: loading,
27114
- children: /*#__PURE__*/jsx(Upload$2, {
27136
+ children: [/*#__PURE__*/jsx(Upload$2, {
27115
27137
  name: 'file',
27116
27138
  disabled: loading,
27117
27139
  maxCount: 1,
@@ -27119,8 +27141,18 @@ var MediaUpload = observer(function (_ref) {
27119
27141
  onRemove: onRemove,
27120
27142
  fileList: fileList,
27121
27143
  customRequest: customRequest,
27144
+ beforeUpload: function beforeUpload(file) {
27145
+ return _beforeUpload(file);
27146
+ },
27122
27147
  children: fileList.length == 0 ? /*#__PURE__*/jsx(PlusOutlined$1, {}) : undefined
27123
- })
27148
+ }), wrongFileType && /*#__PURE__*/jsx(Alert, {
27149
+ title: t('backoffice.mediaupload.wrongfiletype'),
27150
+ type: "error",
27151
+ closable: {
27152
+ closeIcon: true,
27153
+ 'aria-label': 'close'
27154
+ }
27155
+ })]
27124
27156
  })
27125
27157
  })]
27126
27158
  });
@@ -38170,7 +38202,7 @@ var Prices = observer(function (_ref) {
38170
38202
  setNodeDataValue({
38171
38203
  pfgPricefactors: newFactors
38172
38204
  });
38173
- }, [selectedSerie]);
38205
+ }, [selectedSerie, pricelist, setNodeDataValue]);
38174
38206
  var updatePfgPriority = useCallback(function (priceFeatureGroupItem, value) {
38175
38207
  var _newPriority$selected;
38176
38208
  if (!selectedSerie) return;
@@ -38787,10 +38819,13 @@ var TablePriceList = observer(function () {
38787
38819
  },
38788
38820
  onDataUpdated: function onDataUpdated(event) {
38789
38821
  var current = event.updates.find(function (update) {
38790
- return update.node.id && update.node.id === selectedNodeId;
38822
+ var _update$node, _update$node2;
38823
+ return ((_update$node = update.node) === null || _update$node === void 0 ? void 0 : _update$node.id) && ((_update$node2 = update.node) === null || _update$node2 === void 0 ? void 0 : _update$node2.id) === selectedNodeId;
38791
38824
  });
38792
38825
  if (current) {
38793
38826
  setSelectedPriceList(current.data);
38827
+ } else {
38828
+ setSelectedPriceList(undefined);
38794
38829
  }
38795
38830
  }
38796
38831
  };
@@ -42875,12 +42910,12 @@ var Features$2 = /*#__PURE__*/forwardRef(function Features(_ref, ref) {
42875
42910
  }, [selectedCatalog === null || selectedCatalog === void 0 ? void 0 : selectedCatalog._id, organizationId]);
42876
42911
  var apiInterface = useMemo(function () {
42877
42912
  return {
42878
- read: apiConfig.idmService + '/v3.0/catalogs/${catalogId}/features',
42879
- create: apiConfig.idmService + '/v3.0/catalogs/${catalogId}/features',
42880
- restore: apiConfig.idmService + '/v3.0/catalogs/${catalogId}/features/${_id}',
42881
- "delete": apiConfig.idmService + '/v3.0/catalogs/${catalogId}/features/${_id}',
42882
- update: apiConfig.idmService + '/v3.0/catalogs/${catalogId}/features/${_id}',
42883
- bulk: apiConfig.idmService + '/v3.0/catalogs/${catalogId}/features/bulk'
42913
+ read: apiConfig.idmService + '/catalogs/${catalogId}/features',
42914
+ create: apiConfig.idmService + '/catalogs/${catalogId}/features',
42915
+ restore: apiConfig.idmService + '/catalogs/${catalogId}/features/${_id}',
42916
+ "delete": apiConfig.idmService + '/catalogs/${catalogId}/features/${_id}',
42917
+ update: apiConfig.idmService + '/catalogs/${catalogId}/features/${_id}',
42918
+ bulk: apiConfig.idmService + '/catalogs/${catalogId}/features/bulk'
42884
42919
  };
42885
42920
  }, [apiConfig.idmService]);
42886
42921
  var configuration = useMemo(function () {
@@ -42918,7 +42953,7 @@ var Features$2 = /*#__PURE__*/forwardRef(function Features(_ref, ref) {
42918
42953
  displayLabelTemplate: '${value}',
42919
42954
  lookupLabelTemplate: '${name} (${value})',
42920
42955
  apiInterface: {
42921
- read: apiConfig.idmService + '/v3.0/features'
42956
+ read: apiConfig.idmService + '/features'
42922
42957
  },
42923
42958
  lookupKey: 'featureNo',
42924
42959
  lookupValue: 'featureText',
@@ -43028,12 +43063,12 @@ function Features$1(_ref) {
43028
43063
  return {
43029
43064
  type: 'dotnetSSM',
43030
43065
  apiInterface: {
43031
- read: apiConfig.idmService + '/v3.0/features',
43032
- create: readOnly ? undefined : apiConfig.idmService + '/v3.0/features',
43033
- restore: readOnly ? undefined : apiConfig.idmService + '/v3.0/features/${_id}/restore',
43034
- "delete": readOnly ? undefined : apiConfig.idmService + '/v3.0/features/${_id}',
43035
- update: readOnly ? undefined : apiConfig.idmService + '/v3.0/features/${_id}',
43036
- bulk: readOnly ? undefined : apiConfig.idmService + '/v3.0/features/bulk'
43066
+ read: apiConfig.idmService + '/features',
43067
+ create: readOnly ? undefined : apiConfig.idmService + '/features',
43068
+ restore: readOnly ? undefined : apiConfig.idmService + '/features/${_id}/restore',
43069
+ "delete": readOnly ? undefined : apiConfig.idmService + '/features/${_id}',
43070
+ update: readOnly ? undefined : apiConfig.idmService + '/features/${_id}',
43071
+ bulk: readOnly ? undefined : apiConfig.idmService + '/features/bulk'
43037
43072
  },
43038
43073
  dateFormat: 'DD.MM.YYYY, HH:mm:ss',
43039
43074
  colDef: [{
@@ -43143,7 +43178,7 @@ var TableFeatures$2 = observer(function () {
43143
43178
  case 0:
43144
43179
  _context.prev = 0;
43145
43180
  _context.next = 3;
43146
- return fetch(apiConfig.idmService + "/v3.0/catalogs/".concat(catalogId, "/features/global"), {
43181
+ return fetch(apiConfig.idmService + "/catalogs/".concat(catalogId, "/features/global"), {
43147
43182
  method: 'POST',
43148
43183
  headers: {
43149
43184
  Authorization: "Bearer ".concat(jwt)
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMEnricherEditor/modules/TablePriceList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAevE,eAAO,MAAM,cAAc;;CAkUzB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../../src/ui/IDMEnricherEditor/modules/TablePriceList/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAkD,MAAM,OAAO,CAAC;AAevE,eAAO,MAAM,cAAc;;CAoUzB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/MediaUpload/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAKzC,UAAU,KAAK;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;;AAED,wBAuBG"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/MediaUpload/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoB,MAAM,OAAO,CAAC;AAMzC,UAAU,KAAK;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;;AAED,wBA8BG"}
@@ -3,6 +3,7 @@ export interface MediaUploadConfiguration extends BaseModulConfiguration {
3
3
  type: 'MediaUpload';
4
4
  refApiInterface: ApiInterface;
5
5
  size?: 'small' | 'medium' | 'big';
6
+ fileTypes?: string[];
6
7
  targetApiInterface?: ApiInterface;
7
8
  targetMapping?: Mapping;
8
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/MediaUpload/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACpF,MAAM,WAAW,wBAAyB,SAAQ,sBAAsB;IACtE,IAAI,EAAE,aAAa,CAAC;IACpB,eAAe,EAAE,YAAY,CAAC;IAC9B,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAClC,kBAAkB,CAAC,EAAE,YAAY,CAAC;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/MediaUpload/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,sBAAsB,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACpF,MAAM,WAAW,wBAAyB,SAAQ,sBAAsB;IACtE,IAAI,EAAE,aAAa,CAAC;IACpB,eAAe,EAAE,YAAY,CAAC;IAC9B,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IAClC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,kBAAkB,CAAC,EAAE,YAAY,CAAC;IAClC,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB"}
@@ -32,6 +32,8 @@ declare const useMediaUpload: ({ id }: Props) => {
32
32
  }[];
33
33
  size: "small" | "big" | "medium";
34
34
  title: string | undefined;
35
+ beforeUpload: (file: UploadFile) => boolean;
36
+ wrongFileType: boolean;
35
37
  };
36
38
  export default useMediaUpload;
37
39
  //# sourceMappingURL=useMediaUpload.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useMediaUpload.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/MediaUpload/useMediaUpload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAMzE,UAAU,KAAK;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,QAAA,MAAM,cAAc,WAAY,KAAK;;;8BA2CI,mBAAmB,CAAC,UAAU,CAAC;;;;;;;;;;;;sBA1B9D,MAAA,iBACE;;;;;;;;;;;;;CA8DX,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"useMediaUpload.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/MediaUpload/useMediaUpload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAMzE,UAAU,KAAK;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,QAAA,MAAM,cAAc,WAAY,KAAK;;;8BA4CI,mBAAmB,CAAC,UAAU,CAAC;;;;;;;;;;;;sBA7B9C,MAAO,iBAAiB;;;;;;;;;;;;;yBA0DpB,UAAU;;CAqBvC,CAAC;AAEF,eAAe,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystaldesign/diva-backoffice",
3
- "version": "26.4.0-beta.10",
3
+ "version": "26.4.0-beta.12",
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.4.0-beta.10",
19
- "@crystaldesign/content-item": "26.4.0-beta.10",
20
- "@crystaldesign/diva-core": "26.4.0-beta.10",
21
- "@crystaldesign/diva-utils": "26.4.0-beta.10",
22
- "@crystaldesign/media-upload": "26.4.0-beta.10",
23
- "@crystaldesign/rtf-editor": "26.4.0-beta.10",
24
- "@crystaldesign/spreadsheet": "26.4.0-beta.10",
18
+ "@crystaldesign/content-box": "26.4.0-beta.12",
19
+ "@crystaldesign/content-item": "26.4.0-beta.12",
20
+ "@crystaldesign/diva-core": "26.4.0-beta.12",
21
+ "@crystaldesign/diva-utils": "26.4.0-beta.12",
22
+ "@crystaldesign/media-upload": "26.4.0-beta.12",
23
+ "@crystaldesign/rtf-editor": "26.4.0-beta.12",
24
+ "@crystaldesign/spreadsheet": "26.4.0-beta.12",
25
25
  "@google/model-viewer": "3.5.0",
26
26
  "ag-charts-community": "^10.1.0",
27
27
  "ag-charts-react": "^10.1.0",
@@ -52,5 +52,5 @@
52
52
  },
53
53
  "module": "build/esm/index.js",
54
54
  "types": "./build/types/backoffice/src/index.d.ts",
55
- "gitHead": "8b8f54cbbcc7547695e70826b8694eb2ec5d888b"
55
+ "gitHead": "50af4780f8aebef52b0dc8967ff4b9f6a46547f6"
56
56
  }