@emailmaker/filemanager 0.10.90 → 0.10.92

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/file-manager.css CHANGED
@@ -1,145 +1,3 @@
1
- @charset "UTF-8";
2
- .em-filemanager .root {
3
- padding: 16px 20px 24px;
4
- max-width: 520px;
5
- }
6
-
7
- .em-filemanager .controls {
8
- display: flex;
9
- flex-direction: column;
10
- gap: 20px;
11
- }
12
-
13
- .em-filemanager .segmentedControl {
14
- background-color: var(--ant-color-fill-secondary, rgba(0, 0, 0, 0.06));
15
- padding: 4px;
16
- }
17
-
18
- .em-filemanager .sizeRow {
19
- display: grid;
20
- grid-template-columns: 1fr 1fr;
21
- gap: 16px 24px;
22
- align-items: center;
23
- width: 100%;
24
- }
25
-
26
- .em-filemanager .sizeRowLabel {
27
- margin: 0;
28
- }
29
-
30
- /** InputNumber с prefix / suffix — ширина блока значения */
31
- .em-filemanager .sizeInputNumber {
32
- width: 100%;
33
- }
34
-
35
- .em-filemanager .sizeSuffix {
36
- color: var(--ant-color-text-tertiary, rgba(0, 0, 0, 0.45));
37
- font-size: 13px;
38
- line-height: 1;
39
- -webkit-user-select: none;
40
- user-select: none;
41
- }
42
-
43
- .em-filemanager .colorGrid {
44
- display: grid;
45
- grid-template-columns: 1fr 1fr;
46
- gap: 16px 24px;
47
- }
48
-
49
- .em-filemanager .colorCell {
50
- display: flex;
51
- flex-direction: column;
52
- align-items: stretch;
53
- gap: 8px;
54
- min-width: 0;
55
- }
56
-
57
- .em-filemanager .colorCellLabel {
58
- margin: 0 !important;
59
- white-space: nowrap;
60
- }
61
-
62
- .em-filemanager .colorPickerFull {
63
- width: 100%;
64
- justify-content: flex-start;
65
- }
66
-
67
- .em-filemanager .bgExtras {
68
- grid-column: 1/-1;
69
- margin-top: -8px;
70
- display: flex;
71
- flex-direction: column;
72
- gap: 12px;
73
- }
74
-
75
- .em-filemanager .bgWarning {
76
- margin: 0;
77
- }
78
-
79
- .em-filemanager .previewSection {
80
- display: flex;
81
- flex-direction: column;
82
- gap: 12px;
83
- }
84
-
85
- .em-filemanager .previewTitle {
86
- font-size: 14px;
87
- font-weight: 600;
88
- }
89
-
90
- .em-filemanager .previewWrap {
91
- display: flex;
92
- justify-content: center;
93
- align-items: center;
94
- min-height: 220px;
95
- padding: 16px;
96
- border: 1px solid var(--ant-color-border-secondary, #f0f0f0);
97
- border-radius: 8px;
98
- background-color: var(--ant-color-fill-quaternary, #fafafa);
99
- background-image: linear-gradient(45deg, #e8e8e8 25%, transparent 25%), linear-gradient(-45deg, #e8e8e8 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e8e8e8 75%), linear-gradient(-45deg, transparent 75%, #e8e8e8 75%);
100
- background-size: 16px 16px;
101
- background-position: 0 0, 0 8px, 8px -8px, -8px 0;
102
- position: relative;
103
- overflow: hidden;
104
- }
105
-
106
- .em-filemanager .scanLine {
107
- position: absolute;
108
- top: 50%;
109
- left: 20%;
110
- right: 20%;
111
- height: 2px;
112
- background-color: #ff4d4f;
113
- box-shadow: 0 0 6px #ff4d4f;
114
- z-index: 10;
115
- pointer-events: none;
116
- }
117
-
118
- .em-filemanager .scanLineBarcode {
119
- left: 10%;
120
- right: 10%;
121
- }
122
-
123
- .em-filemanager .previewWrapBarcode {
124
- min-height: 104px;
125
- padding: 12px 16px;
126
- }
127
-
128
- .em-filemanager .previewCanvas {
129
- display: block;
130
- max-width: 100%;
131
- height: auto;
132
- background: transparent;
133
- }
134
-
135
- .em-filemanager .previewCanvasBarcode {
136
- max-height: 120px;
137
- width: auto;
138
- }
139
-
140
- .em-filemanager .actions {
141
- margin-top: 8px;
142
- }
143
1
  .em-filemanager .iconsTab {
144
2
  display: flex;
145
3
  flex-direction: column;
@@ -576,6 +434,148 @@
576
434
  background: rgba(255, 255, 255, 0.6);
577
435
  pointer-events: all;
578
436
  }
437
+ @charset "UTF-8";
438
+ .em-filemanager .root {
439
+ padding: 16px 20px 24px;
440
+ max-width: 520px;
441
+ }
442
+
443
+ .em-filemanager .controls {
444
+ display: flex;
445
+ flex-direction: column;
446
+ gap: 20px;
447
+ }
448
+
449
+ .em-filemanager .segmentedControl {
450
+ background-color: var(--ant-color-fill-secondary, rgba(0, 0, 0, 0.06));
451
+ padding: 4px;
452
+ }
453
+
454
+ .em-filemanager .sizeRow {
455
+ display: grid;
456
+ grid-template-columns: 1fr 1fr;
457
+ gap: 16px 24px;
458
+ align-items: center;
459
+ width: 100%;
460
+ }
461
+
462
+ .em-filemanager .sizeRowLabel {
463
+ margin: 0;
464
+ }
465
+
466
+ /** InputNumber с prefix / suffix — ширина блока значения */
467
+ .em-filemanager .sizeInputNumber {
468
+ width: 100%;
469
+ }
470
+
471
+ .em-filemanager .sizeSuffix {
472
+ color: var(--ant-color-text-tertiary, rgba(0, 0, 0, 0.45));
473
+ font-size: 13px;
474
+ line-height: 1;
475
+ -webkit-user-select: none;
476
+ user-select: none;
477
+ }
478
+
479
+ .em-filemanager .colorGrid {
480
+ display: grid;
481
+ grid-template-columns: 1fr 1fr;
482
+ gap: 16px 24px;
483
+ }
484
+
485
+ .em-filemanager .colorCell {
486
+ display: flex;
487
+ flex-direction: column;
488
+ align-items: stretch;
489
+ gap: 8px;
490
+ min-width: 0;
491
+ }
492
+
493
+ .em-filemanager .colorCellLabel {
494
+ margin: 0 !important;
495
+ white-space: nowrap;
496
+ }
497
+
498
+ .em-filemanager .colorPickerFull {
499
+ width: 100%;
500
+ justify-content: flex-start;
501
+ }
502
+
503
+ .em-filemanager .bgExtras {
504
+ grid-column: 1/-1;
505
+ margin-top: -8px;
506
+ display: flex;
507
+ flex-direction: column;
508
+ gap: 12px;
509
+ }
510
+
511
+ .em-filemanager .bgWarning {
512
+ margin: 0;
513
+ }
514
+
515
+ .em-filemanager .previewSection {
516
+ display: flex;
517
+ flex-direction: column;
518
+ gap: 12px;
519
+ }
520
+
521
+ .em-filemanager .previewTitle {
522
+ font-size: 14px;
523
+ font-weight: 600;
524
+ }
525
+
526
+ .em-filemanager .previewWrap {
527
+ display: flex;
528
+ justify-content: center;
529
+ align-items: center;
530
+ min-height: 220px;
531
+ padding: 16px;
532
+ border: 1px solid var(--ant-color-border-secondary, #f0f0f0);
533
+ border-radius: 8px;
534
+ background-color: var(--ant-color-fill-quaternary, #fafafa);
535
+ background-image: linear-gradient(45deg, #e8e8e8 25%, transparent 25%), linear-gradient(-45deg, #e8e8e8 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e8e8e8 75%), linear-gradient(-45deg, transparent 75%, #e8e8e8 75%);
536
+ background-size: 16px 16px;
537
+ background-position: 0 0, 0 8px, 8px -8px, -8px 0;
538
+ position: relative;
539
+ overflow: hidden;
540
+ }
541
+
542
+ .em-filemanager .scanLine {
543
+ position: absolute;
544
+ top: 50%;
545
+ left: 20%;
546
+ right: 20%;
547
+ height: 2px;
548
+ background-color: #ff4d4f;
549
+ box-shadow: 0 0 6px #ff4d4f;
550
+ z-index: 10;
551
+ pointer-events: none;
552
+ }
553
+
554
+ .em-filemanager .scanLineBarcode {
555
+ left: 10%;
556
+ right: 10%;
557
+ }
558
+
559
+ .em-filemanager .previewWrapBarcode {
560
+ min-height: 104px;
561
+ padding: 12px 16px;
562
+ }
563
+
564
+ .em-filemanager .previewCanvas {
565
+ display: block;
566
+ max-width: 100%;
567
+ height: auto;
568
+ background: transparent;
569
+ }
570
+
571
+ .em-filemanager .previewCanvasBarcode {
572
+ max-height: 120px;
573
+ width: auto;
574
+ }
575
+
576
+ .em-filemanager .actions {
577
+ margin-top: 8px;
578
+ }
579
579
  .em-filemanager .noFilesContainer {
580
580
  text-align: center;
581
581
  }
@@ -1,2 +1,2 @@
1
- export{O as DEFAULT_FILE_MANAGER_CACHE_TTL_MS,R as DataSourceProxyBase,L as FailedRequestCache,A as FileContent,G as FileManagerApiError,z as FileManagerApp,t as FileManagerAppWithContext,B as FileModals,C as FolderSidebar,M as MutationRegistry,S as PathAwareStorageAdapter,P as PixieOnlyApp,T as TreeCache,V as ViewCacheManager,I as buildAssetsPath,y as default,Q as defaultIsFolderNotFoundError,U as fetchRemoteImageBlobByUrl,K as getAssetsBase,q as init,x as initFileManager,v as initPixieEditor,D as installResizeObserverErrorHandler,J as joinUrls,H as mapHttpStatusToErrorCode,E as uninstallResizeObserverErrorHandler,s as unmount,w as unmountPixieEditor}from"./file-manager-index-B3Ea-yTf.js";import"react/jsx-runtime";import"react";import"react-dom/client";import"antd";import"@ant-design/icons";import"@ant-design/cssinjs";import"react-dom";import"@untitledui/icons";import"browser-image-compression";import"pixie";
1
+ export{O as DEFAULT_FILE_MANAGER_CACHE_TTL_MS,R as DataSourceProxyBase,L as FailedRequestCache,A as FileContent,G as FileManagerApiError,z as FileManagerApp,t as FileManagerAppWithContext,B as FileModals,C as FolderSidebar,M as MutationRegistry,S as PathAwareStorageAdapter,P as PixieOnlyApp,T as TreeCache,V as ViewCacheManager,I as buildAssetsPath,y as default,Q as defaultIsFolderNotFoundError,U as fetchRemoteImageBlobByUrl,K as getAssetsBase,q as init,x as initFileManager,v as initPixieEditor,D as installResizeObserverErrorHandler,J as joinUrls,H as mapHttpStatusToErrorCode,E as uninstallResizeObserverErrorHandler,s as unmount,w as unmountPixieEditor}from"./file-manager-index-Z8TrA-pu.js";import"react/jsx-runtime";import"react";import"react-dom/client";import"antd";import"@ant-design/icons";import"@ant-design/cssinjs";import"react-dom";import"@untitledui/icons";import"browser-image-compression";import"pixie";
2
2
  //# sourceMappingURL=file-manager.esm.js.map
package/file-manager.js CHANGED
@@ -39572,6 +39572,19 @@ const PixieOnlyApp = props => {
39572
39572
  return null;
39573
39573
  }
39574
39574
  }, [dataProviders]);
39575
+ const resolveUploadedFileById = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useCallback(async (fileId) => {
39576
+ var _a;
39577
+ if (!fileId || typeof (dataProviders === null || dataProviders === void 0 ? void 0 : dataProviders.getFileById) !== 'function') {
39578
+ return null;
39579
+ }
39580
+ try {
39581
+ return (_a = (await dataProviders.getFileById(fileId))) !== null && _a !== void 0 ? _a : null;
39582
+ }
39583
+ catch (error) {
39584
+ console.warn('Standalone Pixie: failed to resolve uploaded file by id', error);
39585
+ return null;
39586
+ }
39587
+ }, [dataProviders]);
39575
39588
  const file = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useMemo(() => {
39576
39589
  if (props.file)
39577
39590
  return props.file;
@@ -39614,7 +39627,7 @@ const PixieOnlyApp = props => {
39614
39627
  return null;
39615
39628
  }, [dataProviders]);
39616
39629
  const saveFileCopyToServer = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useCallback(async (updatedFile, payload) => {
39617
- var _a, _b, _c, _d, _e, _f;
39630
+ var _a, _b, _c, _d, _e;
39618
39631
  if (!updatedFile.thumbnail) {
39619
39632
  return null;
39620
39633
  }
@@ -39670,23 +39683,15 @@ const PixieOnlyApp = props => {
39670
39683
  if (resolvedFile) {
39671
39684
  return resolvedFile;
39672
39685
  }
39673
- return {
39674
- id: firstResult.data.id || updatedFile.id || '',
39675
- name: firstResult.data.name || updatedFile.name,
39676
- folderId: (_f = firstResult.data.folderId) !== null && _f !== void 0 ? _f : targetFolderId,
39677
- type: uploadFile.type,
39678
- size: uploadFile.size,
39679
- extension: (0,mimeUtils/* getExtensionFromMime */.wh)(mimeType),
39680
- url: firstResult.data.url,
39681
- thumbnailUrl: firstResult.data.thumbnailUrl,
39682
- thumbnail: firstResult.data.thumbnail,
39683
- isFolder: false,
39684
- selected: false,
39685
- };
39686
+ const resolvedById = await resolveUploadedFileById(firstResult.data.id);
39687
+ if (resolvedById) {
39688
+ return resolvedById;
39689
+ }
39690
+ return null;
39686
39691
  }
39687
39692
  }
39688
39693
  if (dataProviders === null || dataProviders === void 0 ? void 0 : dataProviders.uploadFile) {
39689
- return await dataProviders.uploadFile({
39694
+ const uploaded = await dataProviders.uploadFile({
39690
39695
  name: uploadFile.name,
39691
39696
  size: uploadFile.size,
39692
39697
  type: uploadFile.type,
@@ -39695,6 +39700,17 @@ const PixieOnlyApp = props => {
39695
39700
  data: uploadFile,
39696
39701
  extension: (0,mimeUtils/* getExtensionFromMime */.wh)(mimeType),
39697
39702
  });
39703
+ if (!uploaded) {
39704
+ return null;
39705
+ }
39706
+ if (uploaded.url || uploaded.thumbnailUrl || uploaded.thumbnail) {
39707
+ return uploaded;
39708
+ }
39709
+ const resolvedById = await resolveUploadedFileById(uploaded.id);
39710
+ if (resolvedById) {
39711
+ return resolvedById;
39712
+ }
39713
+ return null;
39698
39714
  }
39699
39715
  return null;
39700
39716
  }
@@ -39702,7 +39718,7 @@ const PixieOnlyApp = props => {
39702
39718
  console.error('Error saving file copy:', error);
39703
39719
  return null;
39704
39720
  }
39705
- }, [dataProviders, resolveUploadedFileFromProvider, mergedPixieConfig]);
39721
+ }, [dataProviders, resolveUploadedFileFromProvider, resolveUploadedFileById, mergedPixieConfig]);
39706
39722
  // Обёртка над onSave если передан явный колбэк — используем его, иначе через дата провайдер
39707
39723
  const handleSave = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useCallback(async (updated, payload) => {
39708
39724
  if ((dataProviders === null || dataProviders === void 0 ? void 0 : dataProviders.updateFile) && updated.id && updated.thumbnail) {
@@ -39725,25 +39741,26 @@ const PixieOnlyApp = props => {
39725
39741
  return updated;
39726
39742
  }, [dataProviders, onSave, onClose, saveFileToServer]);
39727
39743
  const handleSaveCopy = external_root_React_commonjs2_react_commonjs_react_amd_react_default().useCallback(async (updated, payload) => {
39728
- let result = updated;
39729
- if (updated.thumbnail) {
39730
- try {
39731
- const savedCopy = await saveFileCopyToServer(updated, payload);
39732
- if (savedCopy) {
39733
- result = savedCopy;
39734
- }
39744
+ if (!updated.thumbnail) {
39745
+ return undefined;
39746
+ }
39747
+ try {
39748
+ const savedCopy = await saveFileCopyToServer(updated, payload);
39749
+ if (!savedCopy) {
39750
+ return undefined;
39735
39751
  }
39736
- catch (e) {
39737
- console.error('Standalone Pixie: saveFileCopyToServer error', e);
39752
+ if (onSave) {
39753
+ await onSave(savedCopy, payload);
39738
39754
  }
39755
+ if (onClose) {
39756
+ onClose();
39757
+ }
39758
+ return savedCopy;
39739
39759
  }
39740
- if (onSave) {
39741
- await onSave(result, payload);
39742
- }
39743
- if (onClose) {
39744
- onClose();
39760
+ catch (e) {
39761
+ console.error('Standalone Pixie: saveFileCopyToServer error', e);
39762
+ return undefined;
39745
39763
  }
39746
- return result;
39747
39764
  }, [onClose, onSave, saveFileCopyToServer]);
39748
39765
  const modalRootRef = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useRef)(null);
39749
39766
  const getModalContainer = (0,external_root_React_commonjs2_react_commonjs_react_amd_react_.useCallback)(() => { var _a; return (_a = modalRootRef.current) !== null && _a !== void 0 ? _a : document.body; }, []);
@@ -41684,8 +41701,27 @@ class DataSourceProxyBase {
41684
41701
  getTrashFolder() {
41685
41702
  return this._findOrCreateFolderByPath(this._pathOptions.trashPath || DEFAULT_TRASH_PATH);
41686
41703
  }
41687
- getTempFolder() {
41688
- return this._findOrCreateFolderByPath(this._pathOptions.tempPath || DEFAULT_TEMP_PATH);
41704
+ async getTempFolder() {
41705
+ var _a;
41706
+ // `??`, не `||`: пустой tempPath ('') — это осознанный выбор «грузить в корень»,
41707
+ // а не повод откатиться на дефолтную папку 'Edited'.
41708
+ const tempPath = (_a = this._pathOptions.tempPath) !== null && _a !== void 0 ? _a : DEFAULT_TEMP_PATH;
41709
+ // Пустой путь = корень: temp-папка не нужна, createFolder не вызывается.
41710
+ // Провайдеру с плоским каталогом (без папок) достаточно задать tempPath: ''.
41711
+ if (!tempPath) {
41712
+ return undefined;
41713
+ }
41714
+ try {
41715
+ return await this._findOrCreateFolderByPath(tempPath);
41716
+ }
41717
+ catch (error) {
41718
+ // Ошибки валидации пути — не маскируем; остальное (нет createFolder, throw провайдера) → корень.
41719
+ if (error instanceof FileManagerApiError && error.code === 'ValidationError') {
41720
+ throw error;
41721
+ }
41722
+ console.warn('getTempFolder: temp folder unavailable, falling back to root', error);
41723
+ return undefined;
41724
+ }
41689
41725
  }
41690
41726
  constructor(_dataProvider, _options = {}, _pathOptions, config = {}) {
41691
41727
  var _a, _b;
@@ -41739,7 +41775,7 @@ class DataSourceProxyBase {
41739
41775
  const descriptor = Object.getOwnPropertyDescriptor(proto, name);
41740
41776
  if (name !== 'constructor' && typeof (descriptor === null || descriptor === void 0 ? void 0 : descriptor.value) === 'function') {
41741
41777
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
41742
- this[name] = this[name].bind(this);
41778
+ this[name] = descriptor.value.bind(this);
41743
41779
  }
41744
41780
  }
41745
41781
  }
@@ -41855,31 +41891,37 @@ class DataSourceProxyBase {
41855
41891
  }
41856
41892
  async _getUrl(file) {
41857
41893
  var _a;
41894
+ if (!file) {
41895
+ return undefined;
41896
+ }
41858
41897
  if (file.url) {
41859
41898
  return file.url;
41860
41899
  }
41861
41900
  try {
41862
- return typeof ((_a = this._dataProvider) === null || _a === void 0 ? void 0 : _a.getUrl) === 'function' ? (this._dataProvider.getUrl(file) || '') : '';
41901
+ return typeof ((_a = this._dataProvider) === null || _a === void 0 ? void 0 : _a.getUrl) === 'function' ? this._dataProvider.getUrl(file) || undefined : undefined;
41863
41902
  }
41864
41903
  catch (e) {
41865
41904
  console.log(e);
41866
41905
  }
41867
- return '';
41906
+ return undefined;
41868
41907
  }
41869
41908
  async _getThumbnailUrl(file) {
41870
41909
  var _a;
41910
+ if (!file) {
41911
+ return undefined;
41912
+ }
41871
41913
  if (file.thumbnailUrl) {
41872
41914
  return file.thumbnailUrl;
41873
41915
  }
41874
41916
  try {
41875
41917
  return typeof ((_a = this._dataProvider) === null || _a === void 0 ? void 0 : _a.getThumbnailUrl) === 'function' ?
41876
- (this._dataProvider.getThumbnailUrl(file) || '')
41877
- : '';
41918
+ this._dataProvider.getThumbnailUrl(file) || undefined
41919
+ : undefined;
41878
41920
  }
41879
41921
  catch (e) {
41880
41922
  console.log(e);
41881
41923
  }
41882
- return '';
41924
+ return undefined;
41883
41925
  }
41884
41926
  /**
41885
41927
  * Проверяет, является ли targetFolderId дочерней папкой sourceFolderId (циклическая ссылка)
@@ -41948,7 +41990,10 @@ class DataSourceProxyBase {
41948
41990
  return this.getFile(folderId, name);
41949
41991
  }
41950
41992
  async getFileUrl(folderId, name) {
41951
- const file = await this.getFile(folderId, name);
41993
+ const file = await this.getFile(folderId !== null && folderId !== void 0 ? folderId : '', name);
41994
+ if (!file) {
41995
+ return undefined;
41996
+ }
41952
41997
  return (await this._getUrl(file)) || (await this._getThumbnailUrl(file)) || file.thumbnail;
41953
41998
  }
41954
41999
  /**
@@ -42247,7 +42292,7 @@ class DataSourceProxyBase {
42247
42292
  * Загружает файл на сервер
42248
42293
  */
42249
42294
  async _uploadFile(file) {
42250
- var _a;
42295
+ var _a, _b;
42251
42296
  const folderIdNormalized = this.normalizeId((_a = file.folderId) !== null && _a !== void 0 ? _a : this._rootId);
42252
42297
  if (typeof this._dataProvider.uploadFile !== 'function') {
42253
42298
  throw new FileManagerApiError('Upload file operation is not supported by data provider', 'UnsupportedOperation');
@@ -42263,7 +42308,9 @@ class DataSourceProxyBase {
42263
42308
  }
42264
42309
  }
42265
42310
  const uploaded = await this._dataProvider.uploadFile(Object.assign(Object.assign({}, file), { folderId: folderIdNormalized }));
42266
- const result = normalizeFileSystemItem(Object.assign(Object.assign({ name: file.name, size: file.size }, uploaded), { folderId: folderIdNormalized }));
42311
+ const result = normalizeFileSystemItem(Object.assign(Object.assign({ name: file.name, size: file.size }, uploaded), {
42312
+ // Сохраняем folderId провайдера (flat-каталог enKod → '1'), иначе затираем корнем запроса.
42313
+ folderId: (_b = uploaded.folderId) !== null && _b !== void 0 ? _b : folderIdNormalized }));
42267
42314
  this._cache.upsertEntity(result);
42268
42315
  return result;
42269
42316
  }
@@ -42308,7 +42355,14 @@ class DataSourceProxyBase {
42308
42355
  batchResult = mapBatchResult(providerResult, (data) => {
42309
42356
  if (!data)
42310
42357
  return undefined;
42311
- return { id: data.id, name: normalizeFileSystemItemName(data.name), folderId: data.folderId };
42358
+ return {
42359
+ id: data.id,
42360
+ name: normalizeFileSystemItemName(data.name),
42361
+ folderId: data.folderId,
42362
+ url: data.url,
42363
+ thumbnailUrl: data.thumbnailUrl,
42364
+ thumbnail: data.thumbnail,
42365
+ };
42312
42366
  });
42313
42367
  if (batchResult.detailed && batchResult.detailed.length) {
42314
42368
  for (let i = 0; i < batchResult.detailed.length; i++) {
@@ -42887,7 +42941,9 @@ class DataSourceProxyBase {
42887
42941
  var _a;
42888
42942
  if (data.noFolder) {
42889
42943
  const tempFolder = await this.getTempFolder();
42890
- data = Object.assign(Object.assign({}, data), { folderId: tempFolder.id });
42944
+ // tempFolder может быть undefined (tempPath: '' или недоступный createFolder) —
42945
+ // тогда folderId остаётся неопределённым и ниже нормализуется в корень (_rootId).
42946
+ data = Object.assign(Object.assign({}, data), { folderId: tempFolder === null || tempFolder === void 0 ? void 0 : tempFolder.id });
42891
42947
  }
42892
42948
  const folderIdNormalized = this.normalizeId((_a = data.folderId) !== null && _a !== void 0 ? _a : this._rootId);
42893
42949
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@emailmaker/filemanager",
3
- "version": "0.10.90",
3
+ "version": "0.10.92",
4
4
  "main": "./file-manager.js",
5
5
  "module": "./file-manager.esm.js",
6
6
  "types": "./index.d.ts",
package/types.d.ts CHANGED
@@ -214,6 +214,9 @@ export interface UploadFileResultData {
214
214
  id?: string;
215
215
  name?: string;
216
216
  folderId?: string | null;
217
+ url?: string;
218
+ thumbnailUrl?: string;
219
+ thumbnail?: string;
217
220
  }
218
221
  export interface UploadFilesRequest {
219
222
  /**
@@ -235,6 +238,8 @@ export interface FileManagerDataProviders {
235
238
  * Опционально; для уведомлений и подписей в UI.
236
239
  */
237
240
  getItem?: (id: string) => Promise<FileManagerItemMeta | null> | FileManagerItemMeta | null;
241
+ /** Метаданные файла по id (кэш хоста, затем pathMode). */
242
+ getFileById?: (fileId: string) => Promise<File | null>;
238
243
  getFileData: (fileId: string) => Promise<Blob>;
239
244
  findFileByUrl?: (url: string) => Promise<File | null>;
240
245
  getFolders?: (options?: {