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

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
  });
@@ -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.11",
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.11",
19
+ "@crystaldesign/content-item": "26.4.0-beta.11",
20
+ "@crystaldesign/diva-core": "26.4.0-beta.11",
21
+ "@crystaldesign/diva-utils": "26.4.0-beta.11",
22
+ "@crystaldesign/media-upload": "26.4.0-beta.11",
23
+ "@crystaldesign/rtf-editor": "26.4.0-beta.11",
24
+ "@crystaldesign/spreadsheet": "26.4.0-beta.11",
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": "63f71447081467b6a07e9b802d9a62865cf4d195"
56
56
  }