@mcurros2/microm 1.1.331-0 → 1.1.333-0

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/dist/index.js CHANGED
@@ -98,8 +98,9 @@ var $bW9pc = parcelRequire("bW9pc");
98
98
 
99
99
  var $adBvK = parcelRequire("adBvK");
100
100
  function $6bcc21fcfcabd5ad$export$2dc5b0d03dd97d36(props) {
101
- const { entity: entity, getDataOnInit: getDataOnInit, initialFormMode: initialFormMode = 'view', onSaved: onSaved, onCancel: onCancel } = props;
101
+ const { entity: entity, getDataOnInit: getDataOnInit, initialFormMode: initialFormMode = 'view', onSaved: onSaved, onCancel: onCancel, ...rest } = props;
102
102
  const entityForm = (0, $bW9pc.useEntityForm)({
103
+ ...rest,
103
104
  entity: entity,
104
105
  initialFormMode: initialFormMode,
105
106
  validateInputOnBlur: true,
@@ -8255,10 +8256,11 @@ const $ad822dbf504c78b4$export$b54531e9f4f81a9 = {
8255
8256
  unspecifiedErrorWhenUploadingFileText: 'Unspecified error when uploading file',
8256
8257
  totalUploadExceedsMaximumSizeText: 'Total upload exceeds maximum size of',
8257
8258
  thumbnailMaxSize: 150,
8258
- thumbnailQuality: 75
8259
+ thumbnailQuality: 75,
8260
+ loadFilesOnMount: true
8259
8261
  };
8260
8262
  function $ad822dbf504c78b4$export$5c1c888d0d490e03(props) {
8261
- const { client: client, maxIndividualFileSize: maxIndividualFileSize, maxTotalFilesSize: maxTotalFilesSize, maxFilesCount: maxFilesCount, youCanUploadAMaximumOfText: youCanUploadAMaximumOfText, filesText: filesText, exceedMaximumIndividualSizeText: exceedMaximumIndividualSizeText, unspecifiedErrorWhenUploadingFileText: unspecifiedErrorWhenUploadingFileText, totalUploadExceedsMaximumSizeText: totalUploadExceedsMaximumSizeText, fileProcessColumn: fileProcessColumn, onCancel: onCancel, editor: editor, onValidateFile: onValidateFile, thumbnailMaxSize: thumbnailMaxSize, thumbnailQuality: thumbnailQuality } = (0, $b4te3$mantinecore.useComponentDefaultProps)('useFileUpload', $ad822dbf504c78b4$export$b54531e9f4f81a9, props);
8263
+ const { client: client, maxIndividualFileSize: maxIndividualFileSize, maxTotalFilesSize: maxTotalFilesSize, maxFilesCount: maxFilesCount, youCanUploadAMaximumOfText: youCanUploadAMaximumOfText, filesText: filesText, exceedMaximumIndividualSizeText: exceedMaximumIndividualSizeText, unspecifiedErrorWhenUploadingFileText: unspecifiedErrorWhenUploadingFileText, totalUploadExceedsMaximumSizeText: totalUploadExceedsMaximumSizeText, fileProcessColumn: fileProcessColumn, onCancel: onCancel, editor: editor, onValidateFile: onValidateFile, thumbnailMaxSize: thumbnailMaxSize, thumbnailQuality: thumbnailQuality, loadFilesOnMount: loadFilesOnMount } = (0, $b4te3$mantinecore.useComponentDefaultProps)('useFileUpload', $ad822dbf504c78b4$export$b54531e9f4f81a9, props);
8262
8264
  const [uploadProgress, setUploadProgress] = (0, $b4te3$react.useState)({});
8263
8265
  const [fileProcessID, setFileProcessID] = (0, $b4te3$react.useState)(fileProcessColumn.value);
8264
8266
  const uploadedSize = (0, $b4te3$react.useRef)(0);
@@ -8278,26 +8280,31 @@ function $ad822dbf504c78b4$export$5c1c888d0d490e03(props) {
8278
8280
  fileStore.def.columns.c_fileprocess_id.value = fileProcessColumn.value;
8279
8281
  const data = await fileStore.API.executeView(fileStore.def.views.fst_brwFiles);
8280
8282
  setLoadingNotification(false);
8281
- if (data && data.length > 0) setUploadProgress((prev)=>{
8282
- const updatedState = {
8283
- ...prev
8284
- };
8285
- const file_records = (0, $7T941.mapDataResultToType)(data[0], "enforceObject", null, null);
8286
- file_records.forEach((file)=>{
8287
- updatedState[file.c_file_id] = {
8288
- file_id: file.c_file_id,
8289
- status_id: file.c_file_id,
8290
- file_name: file.vc_filename,
8291
- file_size: file.bi_filesize,
8292
- progress: 100,
8293
- done: true,
8294
- documentURL: client.getDocumentURL(file.vc_fileguid),
8295
- thumbnailURL: client.getThumbnailURL(file.vc_fileguid, thumbnailMaxSize, thumbnailQuality),
8296
- vc_fileguid: file.vc_fileguid
8283
+ if (data && data.length > 0) {
8284
+ let totalSize = 0;
8285
+ setUploadProgress((prev)=>{
8286
+ const updatedState = {
8287
+ ...prev
8297
8288
  };
8289
+ const file_records = (0, $7T941.mapDataResultToType)(data[0], "enforceObject", null, null);
8290
+ file_records.forEach((file)=>{
8291
+ updatedState[file.c_file_id] = {
8292
+ file_id: file.c_file_id,
8293
+ status_id: file.c_file_id,
8294
+ file_name: file.vc_filename,
8295
+ file_size: file.bi_filesize,
8296
+ progress: 100,
8297
+ done: true,
8298
+ documentURL: client.getDocumentURL(file.vc_fileguid),
8299
+ thumbnailURL: client.getThumbnailURL(file.vc_fileguid, thumbnailMaxSize, thumbnailQuality),
8300
+ vc_fileguid: file.vc_fileguid
8301
+ };
8302
+ totalSize += file.bi_filesize;
8303
+ });
8304
+ return updatedState;
8298
8305
  });
8299
- return updatedState;
8300
- });
8306
+ uploadedSize.current = totalSize;
8307
+ }
8301
8308
  } catch (e) {
8302
8309
  setLoadingNotification(false);
8303
8310
  if (e instanceof Error) {
@@ -8305,10 +8312,11 @@ function $ad822dbf504c78b4$export$5c1c888d0d490e03(props) {
8305
8312
  } else setErrorNotification(String(e));
8306
8313
  }
8307
8314
  };
8308
- if (fileProcessColumn.value) refreshFiles();
8315
+ if (loadFilesOnMount && fileProcessColumn.value) refreshFiles();
8309
8316
  }, [
8310
8317
  client,
8311
- fileProcessColumn.value
8318
+ fileProcessColumn.value,
8319
+ loadFilesOnMount
8312
8320
  ]);
8313
8321
  const uploadFiles = async (selectedFiles)=>{
8314
8322
  // Check against maxFilesCount.
@@ -8387,8 +8395,6 @@ function $ad822dbf504c78b4$export$5c1c888d0d490e03(props) {
8387
8395
  setCancelledNotification(true);
8388
8396
  break;
8389
8397
  }
8390
- // MMC: update total uploaded size
8391
- uploadedSize.current += file.size;
8392
8398
  }
8393
8399
  setUploadingNotification(false);
8394
8400
  };
@@ -8488,13 +8494,17 @@ function $ad822dbf504c78b4$export$5c1c888d0d490e03(props) {
8488
8494
  fileStore.def.columns.vc_fileguid.value = fileGUID;
8489
8495
  const result = await fileStore.API.deleteData(undefined, abort_signal);
8490
8496
  setLoadingNotification(false);
8491
- if (!result.Failed) setUploadProgress((prev)=>{
8492
- const updatedState = {
8493
- ...prev
8494
- };
8495
- delete updatedState[file_id];
8496
- return updatedState;
8497
- });
8497
+ if (!result.Failed) {
8498
+ const deletedFileSize = uploadProgress[file_id]?.file_size || 0;
8499
+ setUploadProgress((prev)=>{
8500
+ const updatedState = {
8501
+ ...prev
8502
+ };
8503
+ delete updatedState[file_id];
8504
+ return updatedState;
8505
+ });
8506
+ uploadedSize.current = Math.max(0, uploadedSize.current - deletedFileSize);
8507
+ }
8498
8508
  return result;
8499
8509
  } catch (e) {
8500
8510
  setLoadingNotification(false);
@@ -37991,13 +38001,13 @@ $parcel$export(module.exports, "AvatarUploader", function () { return $bf851542c
37991
38001
 
37992
38002
  function $bf851542c46e0f0d$export$d90a5eec5b09d8ed(props) {
37993
38003
  const theme = (0, $b4te3$mantinecore.useMantineTheme)();
37994
- const { API: API, PlaceHolderIcon: PlaceHolderIcon, readOnlyMode: readOnlyMode, ...others } = props;
37995
- const { imageURL: imageURL, fileID: fileID, fileGUID: fileGUID, handleOpenFileUpload: handleOpenFileUpload, handleDeleteFile: handleDeleteFile, parentFormAPI: parentFormAPI } = API;
38004
+ const { API: API, PlaceHolderIcon: PlaceHolderIcon, readOnlyMode: readOnlyMode, showFullImage: showFullImage, ...others } = props;
38005
+ const { imageURL: imageURL, thumbnailURL: thumbnailURL, fileID: fileID, fileGUID: fileGUID, handleOpenFileUpload: handleOpenFileUpload, handleDeleteFile: handleDeleteFile, parentFormAPI: parentFormAPI } = API;
37996
38006
  return /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsxs)((0, $b4te3$mantinecore.Stack), {
37997
38007
  children: [
37998
38008
  /*#__PURE__*/ (0, $b4te3$reactjsxruntime.jsx)((0, $b4te3$mantinecore.Avatar), {
37999
38009
  ...others,
38000
- src: imageURL ?? undefined,
38010
+ src: showFullImage ? imageURL ?? undefined : thumbnailURL ?? undefined,
38001
38011
  onClick: async ()=>{
38002
38012
  if (!readOnlyMode && parentFormAPI?.formMode !== 'view') await handleOpenFileUpload();
38003
38013
  },
@@ -38055,9 +38065,11 @@ function $8cba51256aebea2d$export$a2bc9feb52ac7227(props) {
38055
38065
  client: client,
38056
38066
  maxFilesCount: 1,
38057
38067
  ...fileSizeProps,
38058
- fileProcessColumn: fileProcessColumn
38068
+ fileProcessColumn: fileProcessColumn,
38069
+ loadFilesOnMount: false
38059
38070
  });
38060
38071
  const [imageURL, setImageURL] = (0, $b4te3$react.useState)(initialImageURL);
38072
+ const [thumbnailURL, setThumbnailURL] = (0, $b4te3$react.useState)(undefined);
38061
38073
  const [fileID, setFileID] = (0, $b4te3$react.useState)(undefined);
38062
38074
  const [fileProcessID, setFileProcessID] = (0, $b4te3$react.useState)(undefined);
38063
38075
  const [fileGUID, setFileGUID] = (0, $b4te3$react.useState)(undefined);
@@ -38073,12 +38085,14 @@ function $8cba51256aebea2d$export$a2bc9feb52ac7227(props) {
38073
38085
  fileGUIDColumn.value = uploadProgress[keys[0]].vc_fileguid;
38074
38086
  setFileGUID(fileGUIDColumn.value);
38075
38087
  setImageURL(client.getDocumentURL(fileGUIDColumn.value));
38088
+ setThumbnailURL(client.getThumbnailURL(fileGUIDColumn.value));
38076
38089
  setFileID(uploadProgress[keys[0]].file_id);
38077
38090
  setFileProcessID(fileprocess_id);
38078
38091
  } else {
38079
38092
  // MMC: if no file was uploaded, clear the file column
38080
38093
  fileGUIDColumn.value = '';
38081
38094
  setFileGUID(undefined);
38095
+ setThumbnailURL(undefined);
38082
38096
  setImageURL(undefined);
38083
38097
  setFileID(undefined);
38084
38098
  }
@@ -38113,6 +38127,7 @@ function $8cba51256aebea2d$export$a2bc9feb52ac7227(props) {
38113
38127
  fileProcessColumn.value = '';
38114
38128
  setFileID(undefined);
38115
38129
  setImageURL(undefined);
38130
+ setThumbnailURL(undefined);
38116
38131
  setFileGUID(undefined);
38117
38132
  };
38118
38133
  // MMC: set the loaded URL when finishing the entity get
@@ -38122,6 +38137,7 @@ function $8cba51256aebea2d$export$a2bc9feb52ac7227(props) {
38122
38137
  if (fileProcessColumn.value) {
38123
38138
  setFileProcessID(fileProcessColumn.value);
38124
38139
  setImageURL(client.getDocumentURL(fileGUIDColumn.value));
38140
+ setThumbnailURL(client.getThumbnailURL(fileGUIDColumn.value));
38125
38141
  setFileGUID(fileGUIDColumn.value);
38126
38142
  }
38127
38143
  }
@@ -38132,6 +38148,7 @@ function $8cba51256aebea2d$export$a2bc9feb52ac7227(props) {
38132
38148
  ]);
38133
38149
  return {
38134
38150
  imageURL: imageURL,
38151
+ thumbnailURL: thumbnailURL,
38135
38152
  fileID: fileID,
38136
38153
  fileProcessID: fileProcessID,
38137
38154
  fileGUID: fileGUID,