@dignite-ng/expand.file-explorer 0.0.1

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.
Files changed (92) hide show
  1. package/README.md +24 -0
  2. package/config/enums/index.d.ts +1 -0
  3. package/config/enums/route-names.d.ts +3 -0
  4. package/config/file-config.module.d.ts +8 -0
  5. package/config/index.d.ts +5 -0
  6. package/config/providers/index.d.ts +1 -0
  7. package/config/providers/route.provider.d.ts +8 -0
  8. package/config/public-api.d.ts +3 -0
  9. package/esm2022/config/dignite-ng-expand.file-explorer-config.mjs +5 -0
  10. package/esm2022/config/enums/index.mjs +2 -0
  11. package/esm2022/config/enums/route-names.mjs +2 -0
  12. package/esm2022/config/file-config.module.mjs +19 -0
  13. package/esm2022/config/providers/index.mjs +2 -0
  14. package/esm2022/config/providers/route.provider.mjs +24 -0
  15. package/esm2022/config/public-api.mjs +4 -0
  16. package/esm2022/dignite-ng-expand.file-explorer.mjs +5 -0
  17. package/esm2022/lib/components/dome/file-dome.component.mjs +32 -0
  18. package/esm2022/lib/components/file-edit/file-edit.component.mjs +102 -0
  19. package/esm2022/lib/components/file-modal/file-modal.component.mjs +271 -0
  20. package/esm2022/lib/components/file-modal-tree/file-modal-tree.component.mjs +195 -0
  21. package/esm2022/lib/components/file-picker/file-picker.component.mjs +57 -0
  22. package/esm2022/lib/components/index.mjs +6 -0
  23. package/esm2022/lib/file-explorer-routing.module.mjs +25 -0
  24. package/esm2022/lib/file-explorer.module.mjs +83 -0
  25. package/esm2022/lib/proxy/dignite/file-explorer/directories/file-descriptor.service.mjs +48 -0
  26. package/esm2022/lib/proxy/dignite/file-explorer/directories/index.mjs +3 -0
  27. package/esm2022/lib/proxy/dignite/file-explorer/directories/models.mjs +2 -0
  28. package/esm2022/lib/proxy/dignite/file-explorer/files/file-descriptor.service.mjs +60 -0
  29. package/esm2022/lib/proxy/dignite/file-explorer/files/index.mjs +3 -0
  30. package/esm2022/lib/proxy/dignite/file-explorer/files/models.mjs +2 -0
  31. package/esm2022/lib/proxy/dignite/file-explorer/index.mjs +4 -0
  32. package/esm2022/lib/proxy/dignite/index.mjs +3 -0
  33. package/esm2022/lib/proxy/index.mjs +5 -0
  34. package/esm2022/lib/proxy/microsoft/asp-net-core/index.mjs +3 -0
  35. package/esm2022/lib/proxy/microsoft/asp-net-core/mvc/index.mjs +2 -0
  36. package/esm2022/lib/proxy/microsoft/asp-net-core/mvc/models.mjs +2 -0
  37. package/esm2022/lib/proxy/microsoft/extensions/index.mjs +3 -0
  38. package/esm2022/lib/proxy/microsoft/extensions/primitives/index.mjs +2 -0
  39. package/esm2022/lib/proxy/microsoft/extensions/primitives/models.mjs +2 -0
  40. package/esm2022/lib/proxy/microsoft/index.mjs +5 -0
  41. package/esm2022/lib/proxy/microsoft/net/http/headers/index.mjs +2 -0
  42. package/esm2022/lib/proxy/microsoft/net/http/headers/models.mjs +2 -0
  43. package/esm2022/lib/proxy/microsoft/net/http/index.mjs +3 -0
  44. package/esm2022/lib/proxy/microsoft/net/index.mjs +3 -0
  45. package/esm2022/lib/proxy/volo/abp/content/index.mjs +2 -0
  46. package/esm2022/lib/proxy/volo/abp/content/models.mjs +2 -0
  47. package/esm2022/lib/proxy/volo/abp/index.mjs +3 -0
  48. package/esm2022/lib/proxy/volo/index.mjs +3 -0
  49. package/esm2022/lib/services/file-api.service.mjs +66 -0
  50. package/esm2022/lib/services/index.mjs +2 -0
  51. package/esm2022/public-api.mjs +8 -0
  52. package/fesm2022/dignite-ng-expand.file-explorer-config.mjs +47 -0
  53. package/fesm2022/dignite-ng-expand.file-explorer-config.mjs.map +1 -0
  54. package/fesm2022/dignite-ng-expand.file-explorer.mjs +972 -0
  55. package/fesm2022/dignite-ng-expand.file-explorer.mjs.map +1 -0
  56. package/index.d.ts +5 -0
  57. package/lib/components/dome/file-dome.component.d.ts +19 -0
  58. package/lib/components/file-edit/file-edit.component.d.ts +38 -0
  59. package/lib/components/file-modal/file-modal.component.d.ts +93 -0
  60. package/lib/components/file-modal-tree/file-modal-tree.component.d.ts +66 -0
  61. package/lib/components/file-picker/file-picker.component.d.ts +23 -0
  62. package/lib/components/index.d.ts +5 -0
  63. package/lib/file-explorer-routing.module.d.ts +7 -0
  64. package/lib/file-explorer.module.d.ts +18 -0
  65. package/lib/proxy/dignite/file-explorer/directories/file-descriptor.service.d.ts +17 -0
  66. package/lib/proxy/dignite/file-explorer/directories/index.d.ts +2 -0
  67. package/lib/proxy/dignite/file-explorer/directories/models.d.ts +29 -0
  68. package/lib/proxy/dignite/file-explorer/files/file-descriptor.service.d.ts +20 -0
  69. package/lib/proxy/dignite/file-explorer/files/index.d.ts +2 -0
  70. package/lib/proxy/dignite/file-explorer/files/models.d.ts +50 -0
  71. package/lib/proxy/dignite/file-explorer/index.d.ts +3 -0
  72. package/lib/proxy/dignite/index.d.ts +2 -0
  73. package/lib/proxy/index.d.ts +4 -0
  74. package/lib/proxy/microsoft/asp-net-core/index.d.ts +2 -0
  75. package/lib/proxy/microsoft/asp-net-core/mvc/index.d.ts +1 -0
  76. package/lib/proxy/microsoft/asp-net-core/mvc/models.d.ts +10 -0
  77. package/lib/proxy/microsoft/extensions/index.d.ts +2 -0
  78. package/lib/proxy/microsoft/extensions/primitives/index.d.ts +1 -0
  79. package/lib/proxy/microsoft/extensions/primitives/models.d.ts +8 -0
  80. package/lib/proxy/microsoft/index.d.ts +4 -0
  81. package/lib/proxy/microsoft/net/http/headers/index.d.ts +1 -0
  82. package/lib/proxy/microsoft/net/http/headers/models.d.ts +6 -0
  83. package/lib/proxy/microsoft/net/http/index.d.ts +2 -0
  84. package/lib/proxy/microsoft/net/index.d.ts +2 -0
  85. package/lib/proxy/volo/abp/content/index.d.ts +1 -0
  86. package/lib/proxy/volo/abp/content/models.d.ts +5 -0
  87. package/lib/proxy/volo/abp/index.d.ts +2 -0
  88. package/lib/proxy/volo/index.d.ts +2 -0
  89. package/lib/services/file-api.service.d.ts +14 -0
  90. package/lib/services/index.d.ts +1 -0
  91. package/package.json +40 -0
  92. package/public-api.d.ts +4 -0
@@ -0,0 +1,972 @@
1
+ import * as i0 from '@angular/core';
2
+ import { Injectable, EventEmitter, Component, Input, Output, ViewChild, NgModule } from '@angular/core';
3
+ import * as i3 from '@abp/ng.core';
4
+ import { ListService, LIST_QUERY_DEBOUNCE_TIME, CoreModule } from '@abp/ng.core';
5
+ import * as i2$2 from '@abp/ng.theme.shared';
6
+ import { ThemeSharedModule } from '@abp/ng.theme.shared';
7
+ import * as i2$1 from '@angular/forms';
8
+ import { Validators, FormsModule, ReactiveFormsModule } from '@angular/forms';
9
+ import * as i8 from '@ng-bootstrap/ng-bootstrap';
10
+ import { NgbDropdownModule } from '@ng-bootstrap/ng-bootstrap';
11
+ import * as i9 from 'ng-zorro-antd/tree';
12
+ import { NzTreeModule } from 'ng-zorro-antd/tree';
13
+ import * as i7 from '@ngx-validate/core';
14
+ import { NgxValidateCoreModule } from '@ngx-validate/core';
15
+ import * as i1 from '@angular/router';
16
+ import { RouterModule } from '@angular/router';
17
+ import * as i2 from '@angular/common';
18
+ import * as i6 from '@swimlane/ngx-datatable';
19
+ import { SelectionType } from '@swimlane/ngx-datatable';
20
+ import { of } from 'rxjs';
21
+
22
+ class FileApiService {
23
+ constructor() { }
24
+ /**转换文件大小单位 输入k */
25
+ formatFileSize(bytes) {
26
+ const units = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
27
+ let size = bytes;
28
+ let unitIndex = 0;
29
+ while (size >= 1024 && unitIndex < units.length - 1) {
30
+ size /= 1024;
31
+ unitIndex++;
32
+ }
33
+ // 保留两位小数,四舍五入
34
+ size = size.toFixed(1);
35
+ return `${size} ${units[unitIndex]}`;
36
+ }
37
+ /**获取图片的本地连接 */
38
+ getImageLacolBase64Url(file) {
39
+ return new Promise((resolve, rejects) => {
40
+ const reader = new FileReader();
41
+ reader.readAsDataURL(file);
42
+ reader.onload = (e) => {
43
+ resolve(e.target.result);
44
+ };
45
+ reader.onerror = error => rejects(error);
46
+ });
47
+ }
48
+ /**
49
+ * 深拷贝--方法
50
+ * $api.deepClone() */
51
+ deepClone(obj) {
52
+ if (typeof obj !== 'object' || obj === null)
53
+ return obj;
54
+ const result = Array.isArray(obj) ? [] : {};
55
+ for (let key in obj) {
56
+ if (obj.hasOwnProperty(key)) {
57
+ if (typeof obj[key] === 'object' && obj[key] !== null) {
58
+ if (obj[key] instanceof Date) {
59
+ result[key] = new Date(obj[key].getTime());
60
+ }
61
+ else if (obj[key] instanceof RegExp) {
62
+ result[key] = new RegExp(obj[key]);
63
+ }
64
+ else {
65
+ result[key] = this.deepClone(obj[key]);
66
+ }
67
+ }
68
+ else {
69
+ result[key] = obj[key];
70
+ }
71
+ }
72
+ }
73
+ return result;
74
+ }
75
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileApiService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
76
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileApiService, providedIn: 'root' });
77
+ }
78
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileApiService, decorators: [{
79
+ type: Injectable,
80
+ args: [{
81
+ providedIn: 'root'
82
+ }]
83
+ }], ctorParameters: function () { return []; } });
84
+
85
+ class FileEditComponent {
86
+ _FileApiService;
87
+ constructor(_FileApiService) {
88
+ this._FileApiService = _FileApiService;
89
+ }
90
+ /**是否多选 */
91
+ _multiple = true;
92
+ set multiple(v) {
93
+ this._multiple = v;
94
+ if (v) { }
95
+ }
96
+ /**文件数据--已上传的数据 */
97
+ _fileData = [];
98
+ set fileData(v) {
99
+ this._fileData = v;
100
+ if (v.length > 0) {
101
+ this.getFileChange({ target: { files: v } });
102
+ }
103
+ }
104
+ /** 跟随表单提交--已提交的数据,或选择的数据源--回调*/
105
+ fileDataChange = new EventEmitter();
106
+ /**文件大小限制
107
+ * @param 1mb
108
+ */
109
+ sizeLimit = 1048576;
110
+ set limit(v) {
111
+ this.sizeLimit = v;
112
+ }
113
+ /**文件表格数据 */
114
+ filesTableData = [];
115
+ /** 待删除已上传的文件们*/
116
+ deleteTheUploadedFiles = [];
117
+ /**获取文件选择框的元素 */
118
+ fileEdit;
119
+ /**获取文件信息改变 */
120
+ async getFileChange(event) {
121
+ let files = new Array(...event.target.files);
122
+ /**需要等待setfileSizeUnits执行完后在执行其他方法--需要完善 */
123
+ await this.waitFileToAddTable(files);
124
+ this.fileHandling();
125
+ }
126
+ /**等待将文件数据加入到文件表格数据中 */
127
+ waitFileToAddTable(files) {
128
+ return new Promise(async (resolve, rejects) => {
129
+ this.filesTableData.push(...await this.setfileSizeUnits(files));
130
+ resolve(true);
131
+ });
132
+ }
133
+ /**删除文件表格的项 */
134
+ deleteFileTableItem(index, item) {
135
+ this.filesTableData.splice(index, 1);
136
+ if (item.id) {
137
+ this.deleteTheUploadedFiles.push(item);
138
+ }
139
+ this.fileHandling();
140
+ }
141
+ /**文件处理-调用回调函数 */
142
+ fileHandling() {
143
+ let theFilesToBeUploaded = this.filesTableData.filter(el => !el.id);
144
+ //判断图片大小是否超过限制-用于判断表单是否允许提交
145
+ let isSubmit = !this.filesTableData.some(el => el.size > this.sizeLimit);
146
+ this.fileDataChange.emit({ theFilesToBeUploaded, deleteTheUploadedFiles: this.deleteTheUploadedFiles, isSubmit });
147
+ }
148
+ /**设置值文件大小单位/ */
149
+ async setfileSizeUnits(files) {
150
+ return new Promise((resolve, rejects) => {
151
+ let formattedFiles = [];
152
+ files.forEach(async (file) => {
153
+ file.fileSize = this._FileApiService.formatFileSize(file.size);
154
+ formattedFiles.push(file);
155
+ //设置选择图片的本地url
156
+ if (!file.src)
157
+ file.src = await this._FileApiService.getImageLacolBase64Url(file);
158
+ });
159
+ resolve(files);
160
+ });
161
+ }
162
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileEditComponent, deps: [{ token: FileApiService }], target: i0.ɵɵFactoryTarget.Component });
163
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FileEditComponent, selector: "fe-file-edit", inputs: { multiple: "multiple", fileData: "fileData", limit: "limit" }, outputs: { fileDataChange: "fileDataChange" }, viewQueries: [{ propertyName: "fileEdit", first: true, predicate: ["fileEdit"], descendants: true, static: true }], ngImport: i0, template: "<div class=\"input-group mb-2\">\n <input type=\"file\" class=\"form-control\" #fileEdit [multiple]=\"_multiple\" accept=\".jpg,.jpeg,.png,.gif,.webp\"(change)=\"getFileChange($event)\">\n</div>\n\n<table class=\"table\" *ngIf=\"filesTableData.length>0\">\n <thead>\n <tr>\n <th scope=\"col\">{{'FileExplorer::FileName' | abpLocalization}}</th>\n <th scope=\"col\">{{'FileExplorer::FileSize' | abpLocalization}}</th>\n <th scope=\"col\"></th>\n </tr>\n </thead>\n <tbody>\n <ng-container *ngFor=\"let item of filesTableData;let i =index\">\n <tr>\n <th scope=\"row\">\n <div>{{item.name}}</div>\n <div class=\"form-text text-danger\" *ngIf=\"item.size > sizeLimit\">{{'FileExplorer::ExceedsMaximumSize' | abpLocalization:_FileApiService.formatFileSize(sizeLimit)}}</div>\n </th>\n <td>{{item.fileSize}}</td>\n <td>\n <button class=\"btn btn-sm p-0 btn-light \" (click.stop)=\"deleteFileTableItem(i,item)\">\n <i class=\"fas fa-trash p-2\"></i>\n </button>\n </td>\n </tr>\n </ng-container>\n </tbody>\n</table>", styles: [""], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.StopPropagationDirective, selector: "[click.stop]", outputs: ["click.stop"] }, { kind: "pipe", type: i3.LocalizationPipe, name: "abpLocalization" }] });
164
+ }
165
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileEditComponent, decorators: [{
166
+ type: Component,
167
+ args: [{ selector: 'fe-file-edit', template: "<div class=\"input-group mb-2\">\n <input type=\"file\" class=\"form-control\" #fileEdit [multiple]=\"_multiple\" accept=\".jpg,.jpeg,.png,.gif,.webp\"(change)=\"getFileChange($event)\">\n</div>\n\n<table class=\"table\" *ngIf=\"filesTableData.length>0\">\n <thead>\n <tr>\n <th scope=\"col\">{{'FileExplorer::FileName' | abpLocalization}}</th>\n <th scope=\"col\">{{'FileExplorer::FileSize' | abpLocalization}}</th>\n <th scope=\"col\"></th>\n </tr>\n </thead>\n <tbody>\n <ng-container *ngFor=\"let item of filesTableData;let i =index\">\n <tr>\n <th scope=\"row\">\n <div>{{item.name}}</div>\n <div class=\"form-text text-danger\" *ngIf=\"item.size > sizeLimit\">{{'FileExplorer::ExceedsMaximumSize' | abpLocalization:_FileApiService.formatFileSize(sizeLimit)}}</div>\n </th>\n <td>{{item.fileSize}}</td>\n <td>\n <button class=\"btn btn-sm p-0 btn-light \" (click.stop)=\"deleteFileTableItem(i,item)\">\n <i class=\"fas fa-trash p-2\"></i>\n </button>\n </td>\n </tr>\n </ng-container>\n </tbody>\n</table>" }]
168
+ }], ctorParameters: function () { return [{ type: FileApiService }]; }, propDecorators: { multiple: [{
169
+ type: Input
170
+ }], fileData: [{
171
+ type: Input
172
+ }], fileDataChange: [{
173
+ type: Output
174
+ }], limit: [{
175
+ type: Input
176
+ }], fileEdit: [{
177
+ type: ViewChild,
178
+ args: ['fileEdit', { static: true }]
179
+ }] } });
180
+
181
+ let FileDescriptorService$1 = class FileDescriptorService {
182
+ restService;
183
+ apiName = 'FileExplorer';
184
+ create = (input, config) => this.restService.request({
185
+ method: 'POST',
186
+ url: '/api/file-explorer/files',
187
+ params: { containerName: input.containerName, cellName: input.cellName, directoryId: input.directoryId, entityId: input.entityId },
188
+ body: input.file,
189
+ }, { apiName: this.apiName, ...config });
190
+ delete = (id, config) => this.restService.request({
191
+ method: 'DELETE',
192
+ url: `/api/file-explorer/files/${id}`,
193
+ }, { apiName: this.apiName, ...config });
194
+ download = (containerName, blobName, fileName, config) => this.restService.request({
195
+ method: 'GET',
196
+ url: `/api/file-explorer/files/download/${containerName}/${blobName}`,
197
+ params: { fileName },
198
+ }, { apiName: this.apiName, ...config });
199
+ get = (id, config) => this.restService.request({
200
+ method: 'GET',
201
+ url: `/api/file-explorer/files/${id}`,
202
+ }, { apiName: this.apiName, ...config });
203
+ getFileContainerConfiguration = (containerName, config) => this.restService.request({
204
+ method: 'GET',
205
+ url: '/api/file-explorer/files/configuration',
206
+ params: { containerName },
207
+ }, { apiName: this.apiName, ...config });
208
+ getList = (input, config) => this.restService.request({
209
+ method: 'GET',
210
+ url: '/api/file-explorer/files',
211
+ params: { containerName: input.containerName, directoryId: input.directoryId, creatorId: input.creatorId, filter: input.filter, entityId: input.entityId, sorting: input.sorting, skipCount: input.skipCount, maxResultCount: input.maxResultCount },
212
+ }, { apiName: this.apiName, ...config });
213
+ getStream = (containerName, blobName, imageResize, config) => this.restService.request({
214
+ method: 'GET',
215
+ responseType: 'blob',
216
+ url: `/api/file-explorer/files/${containerName}/${blobName}`,
217
+ params: { width: imageResize.width, height: imageResize.height },
218
+ }, { apiName: this.apiName, ...config });
219
+ update = (id, input, config) => this.restService.request({
220
+ method: 'PUT',
221
+ url: `/api/file-explorer/files/${id}`,
222
+ body: input,
223
+ }, { apiName: this.apiName, ...config });
224
+ constructor(restService) {
225
+ this.restService = restService;
226
+ }
227
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileDescriptorService, deps: [{ token: i3.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
228
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileDescriptorService, providedIn: 'root' });
229
+ };
230
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileDescriptorService$1, decorators: [{
231
+ type: Injectable,
232
+ args: [{
233
+ providedIn: 'root',
234
+ }]
235
+ }], ctorParameters: function () { return [{ type: i3.RestService }]; } });
236
+
237
+ var index$e = /*#__PURE__*/Object.freeze({
238
+ __proto__: null,
239
+ FileDescriptorService: FileDescriptorService$1
240
+ });
241
+
242
+ class FileDescriptorService {
243
+ restService;
244
+ apiName = 'FileExplorer';
245
+ create = (input, config) => this.restService.request({
246
+ method: 'POST',
247
+ url: '/api/file-explorer/directories',
248
+ body: input,
249
+ }, { apiName: this.apiName, ...config });
250
+ delete = (id, config) => this.restService.request({
251
+ method: 'DELETE',
252
+ url: `/api/file-explorer/directories/${id}`,
253
+ }, { apiName: this.apiName, ...config });
254
+ get = (id, config) => this.restService.request({
255
+ method: 'GET',
256
+ url: `/api/file-explorer/directories/${id}`,
257
+ }, { apiName: this.apiName, ...config });
258
+ getList = (input, config) => this.restService.request({
259
+ method: 'GET',
260
+ url: '/api/file-explorer/directories',
261
+ params: { containerName: input.containerName },
262
+ }, { apiName: this.apiName, ...config });
263
+ move = (id, input, config) => this.restService.request({
264
+ method: 'PUT',
265
+ url: `/api/file-explorer/directories/${id}/move`,
266
+ body: input,
267
+ }, { apiName: this.apiName, ...config });
268
+ update = (id, input, config) => this.restService.request({
269
+ method: 'PUT',
270
+ url: `/api/file-explorer/directories/${id}`,
271
+ body: input,
272
+ }, { apiName: this.apiName, ...config });
273
+ constructor(restService) {
274
+ this.restService = restService;
275
+ }
276
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileDescriptorService, deps: [{ token: i3.RestService }], target: i0.ɵɵFactoryTarget.Injectable });
277
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileDescriptorService, providedIn: 'root' });
278
+ }
279
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileDescriptorService, decorators: [{
280
+ type: Injectable,
281
+ args: [{
282
+ providedIn: 'root',
283
+ }]
284
+ }], ctorParameters: function () { return [{ type: i3.RestService }]; } });
285
+
286
+ var index$d = /*#__PURE__*/Object.freeze({
287
+ __proto__: null,
288
+ FileDescriptorService: FileDescriptorService
289
+ });
290
+
291
+ var that$1;
292
+ class FileModalTreeComponent {
293
+ _DescriptorService;
294
+ fb;
295
+ toaster;
296
+ _FileApiService;
297
+ _LocalizationService;
298
+ constructor(_DescriptorService, fb, toaster, _FileApiService, _LocalizationService) {
299
+ this._DescriptorService = _DescriptorService;
300
+ this.fb = fb;
301
+ this.toaster = toaster;
302
+ this._FileApiService = _FileApiService;
303
+ this._LocalizationService = _LocalizationService;
304
+ that$1 = this;
305
+ }
306
+ /**文件分组列表 */
307
+ fileGroupList = [];
308
+ /**选择的tree节点 */
309
+ _theSelectedTreeNode = '';
310
+ set theSelectedTreeNode(v) {
311
+ this._theSelectedTreeNode = v;
312
+ if (v.length > 0) {
313
+ this.loadData();
314
+ }
315
+ }
316
+ /**正在编辑的节点 */
317
+ theNodeBeingEdited = '';
318
+ /**已展开的节点 */
319
+ anExpandedNode = [];
320
+ /**图片容器 */
321
+ _fileContainerName;
322
+ /**tree节点选择回调 */
323
+ nodeClick = new EventEmitter();
324
+ set fileContainerName(v) {
325
+ if (v) {
326
+ this._fileContainerName = v;
327
+ this.loadData();
328
+ }
329
+ }
330
+ handleClick = (event) => event.stopPropagation();
331
+ loadData() {
332
+ if (this._fileContainerName) {
333
+ this.getFileGroupList();
334
+ }
335
+ }
336
+ /**获取文件分组 */
337
+ getFileGroupList() {
338
+ this._DescriptorService.getList({
339
+ containerName: this._fileContainerName,
340
+ }).subscribe(async (res) => {
341
+ this.fileGroupList = await this.setTheValueOfTheNodeRecursively(res.items);
342
+ });
343
+ }
344
+ /**递归设置节点的值 */
345
+ setTheValueOfTheNodeRecursively(array) {
346
+ return new Promise((reslove, rejects) => {
347
+ array.forEach((el) => {
348
+ el.title = el.name;
349
+ el.key = el.id;
350
+ el.expanded = this.anExpandedNode.includes(el.key);
351
+ if (el.children.length > 0) {
352
+ this.setTheValueOfTheNodeRecursively(el.children);
353
+ }
354
+ });
355
+ reslove(array);
356
+ });
357
+ }
358
+ /**tree-拖拽 */
359
+ nzEvent(event) {
360
+ }
361
+ /**tree-拖拽 -验证*/
362
+ beforeDrop(arg) {
363
+ if (arg.pos === 0 || arg.pos === 1) {
364
+ that$1._DescriptorService.move(arg.dragNode.key, {
365
+ "parentId": arg.pos === 1 ? (arg.node.parentNode?.key || '') : arg.node.key,
366
+ "order": arg.pos === 1 ? arg.node.origin.order + 1 : arg.node.origin.children.length + 1
367
+ }).subscribe(res => {
368
+ // that.toaster.success("拖拽完成");
369
+ that$1.getFileGroupList();
370
+ });
371
+ return of(true);
372
+ }
373
+ else {
374
+ return of(false);
375
+ }
376
+ }
377
+ /**tree--选择节点 */
378
+ activeNode(event) {
379
+ this._theSelectedTreeNode = event.node;
380
+ this.nodeClick.emit(event.node);
381
+ }
382
+ /**判断节点是否选中 */
383
+ isNodeSelected = (el) => el.key === this._theSelectedTreeNode?.key;
384
+ /**点击展开树节点图标触发 */
385
+ nzExpandChange(event) {
386
+ let anExpandedNode = this.anExpandedNode;
387
+ if (anExpandedNode.includes(event.node.key)) {
388
+ anExpandedNode = anExpandedNode.filter(key => key !== event.node.key);
389
+ }
390
+ else {
391
+ anExpandedNode.push(event.node.key);
392
+ }
393
+ this.anExpandedNode = anExpandedNode;
394
+ }
395
+ /**增加分组 */
396
+ addDescriptorBtn(items = '', edit = false) {
397
+ this.ModalDescriptorOpen = true;
398
+ this.ModalDescriptorForm = this.fb.group({
399
+ containerName: [this._fileContainerName || '', Validators.required],
400
+ name: ['', Validators.required],
401
+ parentId: [items?.key || '', Validators.required],
402
+ });
403
+ /**编辑 */
404
+ if (edit) {
405
+ this.theNodeBeingEdited = items.origin;
406
+ this.ModalDescriptorForm.patchValue({
407
+ name: items.origin.name
408
+ });
409
+ }
410
+ }
411
+ /**删除分组 */
412
+ deleteDescriptorBtn(node) {
413
+ this._DescriptorService.delete(node.key).subscribe(res => {
414
+ // this.toaster.success(this._LocalizationService.instant(`AbpUi::SuccessfullyDeleted`));
415
+ this.ModalDescriptorOpen = false;
416
+ if (this.theNodeBeingEdited.key == node.key)
417
+ this.theNodeBeingEdited = '';
418
+ this.getFileGroupList();
419
+ });
420
+ }
421
+ /**分组 */
422
+ /**模态框-状态-是否打开 */
423
+ ModalDescriptorOpen = false;
424
+ /**模态框-descriptor-繁忙状态-用于确定模态的繁忙状态是否为真 */
425
+ ModalDescriptorBusy = false;
426
+ /**模态框-descriptor-表单 */
427
+ ModalDescriptorForm;
428
+ /**模态框-descriptor-表单--控件模板-动态赋值表单控件 */
429
+ ModalFormDescriptorSubmit;
430
+ /**模态框-descriptor-状态改变回调 */
431
+ ModalDescriptorVisibleChange(event) {
432
+ if (!event) {
433
+ this.ModalDescriptorForm = undefined;
434
+ this.theNodeBeingEdited = '';
435
+ return;
436
+ }
437
+ }
438
+ /**f分组模态框保存 */
439
+ createOrEditSave() {
440
+ let input = this.ModalDescriptorForm.value;
441
+ if (this.theNodeBeingEdited) {
442
+ this._DescriptorService.update(this.theNodeBeingEdited.key, input).subscribe(res => {
443
+ // this.toaster.success("保存成功");
444
+ this.ModalDescriptorOpen = false;
445
+ this.getFileGroupList();
446
+ });
447
+ return;
448
+ }
449
+ this._DescriptorService.create(input).subscribe(res => {
450
+ // this.toaster.success("保存成功");
451
+ this.ModalDescriptorOpen = false;
452
+ this.getFileGroupList();
453
+ });
454
+ }
455
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileModalTreeComponent, deps: [{ token: FileDescriptorService }, { token: i2$1.FormBuilder }, { token: i2$2.ToasterService }, { token: FileApiService }, { token: i3.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
456
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FileModalTreeComponent, selector: "fe-file-modal-tree", inputs: { theSelectedTreeNode: "theSelectedTreeNode", fileContainerName: "fileContainerName" }, outputs: { nodeClick: "nodeClick" }, viewQueries: [{ propertyName: "ModalFormDescriptorSubmit", first: true, predicate: ["ModalFormDescriptorSubmit"], descendants: true }], ngImport: i0, template: "<div class=\"card-header p-0 mb-1 d-flex justify-content-between align-items-center\">\n <h6 class=\"h6 mb-0\">{{'FileExplorer::MyDirectories' | abpLocalization}}</h6>\n <button type=\"button\" class=\"btn btn-light btn-sm ms-2\" (click.stop)=\"addDescriptorBtn()\"><i\n class=\"fas fa-plus-circle\" aria-hidden=\"true\"></i></button>\n</div>\n<nz-tree [nzData]=\"fileGroupList\" class=\"ng-zorro-antd-tree\" nzDraggable nzBlockNode nzShowIcon\n [nzExpandedIcon]=\"multiExpandedIconTpl\" (nzOnDrop)=\"nzEvent($event)\" [nzBeforeDrop]=\"beforeDrop\"\n (nzClick)=\"activeNode($event)\" (nzExpandChange)=\"nzExpandChange($event)\" [nzTreeTemplate]=\"nzTreeTemplate\">\n <ng-template #nzTreeTemplate let-node let-origin=\"origin\">\n <div class=\"custom-node d-inline-block ng-star-inserted dropdown\" [title]=\"node.title\">\n <div #dropdown=\"ngbDropdown\" class=\"d-inline-block\" ngbDropdown placement=\"bottom\" container=\"body\">\n <div class=\"btn-group\" [class.selected]=\"isNodeSelected(node)\">\n <button class=\"btn btn-sm p-0 px-1\">{{ node.title }}</button>\n <button class=\"btn btn-sm p-0\" (click)=\"handleClick($event)\" ngbDropdownToggle\n [class.dropdown-toggle]=\"false\" aria-hidden=\"true\">\n <i class=\"fas fa-caret-down text-muted p-1\"></i>\n </button>\n </div>\n <div ngbDropdownMenu>\n <button ngbDropdownItem\n (click.stop)=\"addDescriptorBtn(node)\">{{'FileExplorer::NewDirectory' | abpLocalization}}</button>\n <button ngbDropdownItem\n (click.stop)=\"addDescriptorBtn(node,true)\">{{'AbpUi::Edit' | abpLocalization}}</button>\n <button ngbDropdownItem\n (click.stop)=\"deleteDescriptorBtn(node)\">{{'AbpUi::Delete' | abpLocalization}}</button>\n </div>\n </div>\n </div>\n </ng-template>\n <ng-template #multiExpandedIconTpl let-node let-origin=\"origin\">\n <ng-container *ngIf=\"node.children.length > 0\">\n <i [class]=\"node.isExpanded ? 'fas fa-caret-down' : 'fas fa-caret-right'\"></i>\n </ng-container>\n </ng-template>\n</nz-tree>\n\n\n<abp-modal [(visible)]=\"ModalDescriptorOpen\" [busy]=\"ModalDescriptorBusy\"\n (visibleChange)=\"ModalDescriptorVisibleChange($event)\">\n <ng-template #abpHeader>\n <h3>{{theNodeBeingEdited?('AbpUi::Edit' | abpLocalization):('FileExplorer::NewDirectory' | abpLocalization)}}</h3>\n </ng-template>\n <ng-template #abpBody>\n <ng-template #loaderRef>\n <div class=\"text-center\"><i class=\"fa fa-pulse fa-spinner\" aria-hidden=\"true\"></i></div>\n </ng-template>\n <ng-container *ngIf=\"ModalDescriptorForm; else loaderRef\">\n <form class=\"sites-modal-form\" #myForm=\"ngForm\" [formGroup]=\"ModalDescriptorForm\"\n (ngSubmit)=\"createOrEditSave()\">\n <button type=\"submit\" #ModalFormDescriptorSubmit style=\"display: none\"></button>\n <div class=\"mb-3\">\n <label class=\"form-label\">{{'FileExplorer::DirectoryName' | abpLocalization}}</label>\n <input type=\"email\" class=\"form-control\" formControlName=\"name\">\n </div>\n </form>\n </ng-container>\n </ng-template>\n <ng-template #abpFooter>\n <button type=\"button\" class=\"btn btn-secondary\" abpClose>{{'AbpUi::Close' | abpLocalization}}</button>\n <abp-button iconClass=\"fa fa-check\"\n (click)=\"ModalFormDescriptorSubmit.nativeElement.click()\">{{'AbpUi::Save' | abpLocalization}}</abp-button>\n </ng-template>\n</abp-modal>", styles: [""], dependencies: [{ kind: "directive", type: i2$1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$1.DefaultValueAccessor, selector: "input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]" }, { kind: "directive", type: i2$1.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2$1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i2$1.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "directive", type: i2$1.FormControlName, selector: "[formControlName]", inputs: ["formControlName", "disabled", "ngModel"], outputs: ["ngModelChange"] }, { kind: "directive", type: i3.FormSubmitDirective, selector: "form[ngSubmit][formGroup]", inputs: ["debounce", "notValidateOnSubmit", "markAsDirtyWhenSubmit"], outputs: ["ngSubmit"] }, { kind: "directive", type: i3.StopPropagationDirective, selector: "[click.stop]", outputs: ["click.stop"] }, { kind: "directive", type: i7.ValidationGroupDirective, selector: "[formGroup],[formGroupName]", exportAs: ["validationGroup"] }, { kind: "directive", type: i7.ValidationDirective, selector: "[formControl],[formControlName]", exportAs: ["validationDirective"] }, { kind: "component", type: i2$2.ButtonComponent, selector: "abp-button", inputs: ["buttonId", "buttonClass", "buttonType", "formName", "iconClass", "loading", "disabled", "attributes"], outputs: ["click", "focus", "blur", "abpClick", "abpFocus", "abpBlur"] }, { kind: "component", type: i2$2.ModalComponent, selector: "abp-modal", inputs: ["visible", "busy", "options", "suppressUnsavedChangesWarning"], outputs: ["visibleChange", "init", "appear", "disappear"] }, { kind: "directive", type: i2$2.ModalCloseDirective, selector: "[abpClose]" }, { kind: "directive", type: i8.NgbDropdown, selector: "[ngbDropdown]", inputs: ["autoClose", "dropdownClass", "open", "placement", "popperOptions", "container", "display"], outputs: ["openChange"], exportAs: ["ngbDropdown"] }, { kind: "directive", type: i8.NgbDropdownToggle, selector: "[ngbDropdownToggle]" }, { kind: "directive", type: i8.NgbDropdownMenu, selector: "[ngbDropdownMenu]" }, { kind: "directive", type: i8.NgbDropdownItem, selector: "[ngbDropdownItem]", inputs: ["disabled"] }, { kind: "component", type: i9.NzTreeComponent, selector: "nz-tree", inputs: ["nzShowIcon", "nzHideUnMatched", "nzBlockNode", "nzExpandAll", "nzSelectMode", "nzCheckStrictly", "nzShowExpand", "nzShowLine", "nzCheckable", "nzAsyncData", "nzDraggable", "nzMultiple", "nzExpandedIcon", "nzVirtualItemSize", "nzVirtualMaxBufferPx", "nzVirtualMinBufferPx", "nzVirtualHeight", "nzTreeTemplate", "nzBeforeDrop", "nzData", "nzExpandedKeys", "nzSelectedKeys", "nzCheckedKeys", "nzSearchValue", "nzSearchFunc"], outputs: ["nzExpandedKeysChange", "nzSelectedKeysChange", "nzCheckedKeysChange", "nzSearchValueChange", "nzClick", "nzDblClick", "nzContextMenu", "nzCheckBoxChange", "nzExpandChange", "nzOnDragStart", "nzOnDragEnter", "nzOnDragOver", "nzOnDragLeave", "nzOnDrop", "nzOnDragEnd"], exportAs: ["nzTree"] }, { kind: "pipe", type: i3.LocalizationPipe, name: "abpLocalization" }] });
457
+ }
458
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileModalTreeComponent, decorators: [{
459
+ type: Component,
460
+ args: [{ selector: 'fe-file-modal-tree', template: "<div class=\"card-header p-0 mb-1 d-flex justify-content-between align-items-center\">\n <h6 class=\"h6 mb-0\">{{'FileExplorer::MyDirectories' | abpLocalization}}</h6>\n <button type=\"button\" class=\"btn btn-light btn-sm ms-2\" (click.stop)=\"addDescriptorBtn()\"><i\n class=\"fas fa-plus-circle\" aria-hidden=\"true\"></i></button>\n</div>\n<nz-tree [nzData]=\"fileGroupList\" class=\"ng-zorro-antd-tree\" nzDraggable nzBlockNode nzShowIcon\n [nzExpandedIcon]=\"multiExpandedIconTpl\" (nzOnDrop)=\"nzEvent($event)\" [nzBeforeDrop]=\"beforeDrop\"\n (nzClick)=\"activeNode($event)\" (nzExpandChange)=\"nzExpandChange($event)\" [nzTreeTemplate]=\"nzTreeTemplate\">\n <ng-template #nzTreeTemplate let-node let-origin=\"origin\">\n <div class=\"custom-node d-inline-block ng-star-inserted dropdown\" [title]=\"node.title\">\n <div #dropdown=\"ngbDropdown\" class=\"d-inline-block\" ngbDropdown placement=\"bottom\" container=\"body\">\n <div class=\"btn-group\" [class.selected]=\"isNodeSelected(node)\">\n <button class=\"btn btn-sm p-0 px-1\">{{ node.title }}</button>\n <button class=\"btn btn-sm p-0\" (click)=\"handleClick($event)\" ngbDropdownToggle\n [class.dropdown-toggle]=\"false\" aria-hidden=\"true\">\n <i class=\"fas fa-caret-down text-muted p-1\"></i>\n </button>\n </div>\n <div ngbDropdownMenu>\n <button ngbDropdownItem\n (click.stop)=\"addDescriptorBtn(node)\">{{'FileExplorer::NewDirectory' | abpLocalization}}</button>\n <button ngbDropdownItem\n (click.stop)=\"addDescriptorBtn(node,true)\">{{'AbpUi::Edit' | abpLocalization}}</button>\n <button ngbDropdownItem\n (click.stop)=\"deleteDescriptorBtn(node)\">{{'AbpUi::Delete' | abpLocalization}}</button>\n </div>\n </div>\n </div>\n </ng-template>\n <ng-template #multiExpandedIconTpl let-node let-origin=\"origin\">\n <ng-container *ngIf=\"node.children.length > 0\">\n <i [class]=\"node.isExpanded ? 'fas fa-caret-down' : 'fas fa-caret-right'\"></i>\n </ng-container>\n </ng-template>\n</nz-tree>\n\n\n<abp-modal [(visible)]=\"ModalDescriptorOpen\" [busy]=\"ModalDescriptorBusy\"\n (visibleChange)=\"ModalDescriptorVisibleChange($event)\">\n <ng-template #abpHeader>\n <h3>{{theNodeBeingEdited?('AbpUi::Edit' | abpLocalization):('FileExplorer::NewDirectory' | abpLocalization)}}</h3>\n </ng-template>\n <ng-template #abpBody>\n <ng-template #loaderRef>\n <div class=\"text-center\"><i class=\"fa fa-pulse fa-spinner\" aria-hidden=\"true\"></i></div>\n </ng-template>\n <ng-container *ngIf=\"ModalDescriptorForm; else loaderRef\">\n <form class=\"sites-modal-form\" #myForm=\"ngForm\" [formGroup]=\"ModalDescriptorForm\"\n (ngSubmit)=\"createOrEditSave()\">\n <button type=\"submit\" #ModalFormDescriptorSubmit style=\"display: none\"></button>\n <div class=\"mb-3\">\n <label class=\"form-label\">{{'FileExplorer::DirectoryName' | abpLocalization}}</label>\n <input type=\"email\" class=\"form-control\" formControlName=\"name\">\n </div>\n </form>\n </ng-container>\n </ng-template>\n <ng-template #abpFooter>\n <button type=\"button\" class=\"btn btn-secondary\" abpClose>{{'AbpUi::Close' | abpLocalization}}</button>\n <abp-button iconClass=\"fa fa-check\"\n (click)=\"ModalFormDescriptorSubmit.nativeElement.click()\">{{'AbpUi::Save' | abpLocalization}}</abp-button>\n </ng-template>\n</abp-modal>" }]
461
+ }], ctorParameters: function () { return [{ type: FileDescriptorService }, { type: i2$1.FormBuilder }, { type: i2$2.ToasterService }, { type: FileApiService }, { type: i3.LocalizationService }]; }, propDecorators: { theSelectedTreeNode: [{
462
+ type: Input
463
+ }], nodeClick: [{
464
+ type: Output
465
+ }], fileContainerName: [{
466
+ type: Input
467
+ }], ModalFormDescriptorSubmit: [{
468
+ type: ViewChild,
469
+ args: ['ModalFormDescriptorSubmit', { static: false }]
470
+ }] } });
471
+
472
+ var that;
473
+ class FileModalComponent {
474
+ _FileService;
475
+ toaster;
476
+ list;
477
+ _FileApiService;
478
+ restService;
479
+ confirmation;
480
+ _LocalizationService;
481
+ constructor(_FileService, toaster, list, _FileApiService, restService, confirmation, _LocalizationService) {
482
+ this._FileService = _FileService;
483
+ this.toaster = toaster;
484
+ this.list = list;
485
+ this._FileApiService = _FileApiService;
486
+ this.restService = restService;
487
+ this.confirmation = confirmation;
488
+ this._LocalizationService = _LocalizationService;
489
+ that = this;
490
+ }
491
+ /**图片容器 */
492
+ _fileContainerName;
493
+ set fileContainerName(v) {
494
+ if (v) {
495
+ this._fileContainerName = v;
496
+ this.loadData();
497
+ }
498
+ }
499
+ /**是否多选 */
500
+ _multiple = true;
501
+ set multiple(v) {
502
+ this._multiple = v;
503
+ if (v) { }
504
+ }
505
+ /**文件大小限制
506
+ * @param 1mb
507
+ */
508
+ sizeLimit = 1048576;
509
+ set limit(v) {
510
+ this.sizeLimit = v;
511
+ }
512
+ /**父组件传递的模态框状态 */
513
+ set visible(v) {
514
+ this.ModalOpen = v;
515
+ if (v) {
516
+ this.loadData();
517
+ }
518
+ }
519
+ /**模态框状态回调 */
520
+ visibleChange = new EventEmitter();
521
+ /**模态框-状态-是否打开 */
522
+ ModalOpen = false;
523
+ /**模态框-繁忙状态-用于确定模态的繁忙状态是否为真 */
524
+ ModalBusy = false;
525
+ /**模态框-状态改变回调 */
526
+ ModalVisibleChange(event) {
527
+ if (!event) {
528
+ this.visibleChange.emit(event);
529
+ return;
530
+ }
531
+ }
532
+ /**模态框保存 */
533
+ modalSave() {
534
+ let selectedTablearr = this._FileApiService.deepClone(this.selectedTable);
535
+ this.selectFilefn.emit(selectedTablearr);
536
+ this.ModalVisibleChange(false);
537
+ }
538
+ /**dignite-file-modal-tree */
539
+ /**选择的tree节点 */
540
+ _theSelectedTreeNode = '';
541
+ /**初始化数据 */
542
+ loadData() {
543
+ if (this.ModalOpen && this._fileContainerName) {
544
+ this.hookToQuery();
545
+ }
546
+ }
547
+ /**tree-节点选择 */
548
+ _nodeClick(event) {
549
+ this._theSelectedTreeNode = event;
550
+ this.list.get();
551
+ }
552
+ /**图片上传-要上传图片的状态文件列表 */
553
+ uploadPictureStatusList = [];
554
+ /**图片上传-获取文件信息改变 */
555
+ async getFileChange(event) {
556
+ let files = new Array(...event.target.files);
557
+ this.uploadPictureStatusList = files;
558
+ for (const file of files) {
559
+ if (file.size > this.sizeLimit) {
560
+ this.setuploadPictureStatus(file, 2);
561
+ continue;
562
+ }
563
+ await this.uploadingFile(file).then(() => {
564
+ this.setuploadPictureStatus(file, 1);
565
+ this.list.get();
566
+ }).catch(() => {
567
+ this.setuploadPictureStatus(file, 2);
568
+ }); // 等待每个文件上传完成
569
+ }
570
+ this.list.get();
571
+ let isSubmit = !this.uploadPictureStatusList.some(el => el.status == 2);
572
+ if (isSubmit) {
573
+ // this.toaster.success("上传完成");
574
+ setTimeout(() => {
575
+ this.uploadPictureStatusList = [];
576
+ }, 6000);
577
+ }
578
+ }
579
+ /**图片上传-设置uploadPictureStatusList的状态 */
580
+ setuploadPictureStatus(file, type) {
581
+ this.uploadPictureStatusList.map(el => {
582
+ if (el == file)
583
+ el.status = type;
584
+ });
585
+ }
586
+ /**图片上传-递归按顺序上传 */
587
+ uploadingFile(file) {
588
+ return new Promise((resolve, rejects) => {
589
+ let formData = new FormData();
590
+ formData.append('file', file, file.name);
591
+ this.createFile({
592
+ file: formData,
593
+ containerName: this._fileContainerName,
594
+ directoryId: this._theSelectedTreeNode?.key || '',
595
+ entityId: ''
596
+ }).subscribe(res => {
597
+ resolve(true);
598
+ }, (err) => {
599
+ rejects(false);
600
+ });
601
+ });
602
+ }
603
+ /**文件表格-数据*/
604
+ data = {
605
+ items: [],
606
+ totalCount: 0,
607
+ };
608
+ /**文件表格-条件*/
609
+ filters = {};
610
+ /**文件表格-表格自带选择类型 */
611
+ SelectionType = SelectionType;
612
+ /**文件表格-选择的表格数据项 */
613
+ selectedTable = [];
614
+ /**已选定的文件 */
615
+ selectPickerFile;
616
+ ngOnChanges(changes) {
617
+ //Called before any other lifecycle hook. Use it to inject dependencies, but avoid any serious work here.
618
+ //Add '${implements OnChanges}' to the class.
619
+ this.selectedTable = this._FileApiService.deepClone(this.selectPickerFile);
620
+ }
621
+ /**当前选择的table项 id */
622
+ nowSelectId = '';
623
+ /**选择文件回调 */
624
+ // @Output() selectedFileChange = new EventEmitter<any[]>()
625
+ selectFilefn = new EventEmitter();
626
+ /**文件表格-获取表格数据 */
627
+ hookToQuery() {
628
+ const getData = (query) => this._FileService.getList({
629
+ ...query,
630
+ ...this.filters,
631
+ containerName: this._fileContainerName,
632
+ directoryId: this._theSelectedTreeNode.key
633
+ });
634
+ const setData = (list) => (this.data = list);
635
+ this.list.hookToQuery(getData).subscribe(setData);
636
+ }
637
+ /**文件表格-查看所有分组的文件数据 */
638
+ lookAllFile() {
639
+ this._theSelectedTreeNode = '';
640
+ this.list.get();
641
+ }
642
+ /**选择表格项 */
643
+ onSelectTableItem({ selected }) {
644
+ this.selectedTable = this._FileApiService.deepClone(selected);
645
+ let selectedTablearr = this.removeDuplicatesById(this.selectedTable);
646
+ if (selected.length > selectedTablearr.length) {
647
+ selectedTablearr = selectedTablearr.filter(el => el.id !== this.nowSelectId);
648
+ }
649
+ this.selectedTable = selectedTablearr;
650
+ }
651
+ /**删除数组中重复的项 */
652
+ removeDuplicatesById(array) {
653
+ const seenIds = {};
654
+ return array.filter(item => {
655
+ if (!seenIds[item.id]) {
656
+ seenIds[item.id] = true;
657
+ return true;
658
+ }
659
+ return false;
660
+ });
661
+ }
662
+ /**一个布尔or函数,可用于检查是否要根据条件选择特定行。 */
663
+ selectCheck = (row, column, value) => {
664
+ this.nowSelectId = row.id;
665
+ return true;
666
+ };
667
+ /**判断row是否选中 */
668
+ selectedcheckbox = (id) => {
669
+ return this.selectedTable.some(el => el.id == id);
670
+ };
671
+ /**删除图片 */
672
+ deleteFile(file) {
673
+ this.confirmation
674
+ .warn('', { key: '', defaultValue: this._LocalizationService.instant(`AbpUi::ItemWillBeDeletedMessage`) })
675
+ .subscribe((status) => {
676
+ if (status == 'confirm') {
677
+ this._FileService.delete(file.id).subscribe(res => {
678
+ this.toaster.success(this._LocalizationService.instant(`AbpUi::SuccessfullyDeleted`));
679
+ this.list.get();
680
+ });
681
+ }
682
+ });
683
+ }
684
+ /**关闭文件状态弹窗 */
685
+ closeFileStatusModal() {
686
+ this.uploadPictureStatusList = [];
687
+ }
688
+ /**创建图片的接口,代理中的file类型不匹配,切换为any类型 */
689
+ createFile = (input, config) => this.restService.request({
690
+ method: 'POST',
691
+ url: '/api/file-explorer/files',
692
+ params: { containerName: input.containerName, cellName: input.cellName, directoryId: input.directoryId, entityId: input.entityId },
693
+ body: input.file,
694
+ }, { apiName: 'FileExplorer', ...config });
695
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileModalComponent, deps: [{ token: FileDescriptorService$1 }, { token: i2$2.ToasterService }, { token: i3.ListService }, { token: FileApiService }, { token: i3.RestService }, { token: i2$2.ConfirmationService }, { token: i3.LocalizationService }], target: i0.ɵɵFactoryTarget.Component });
696
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FileModalComponent, selector: "fe-file-modal", inputs: { fileContainerName: "fileContainerName", multiple: "multiple", limit: "limit", visible: "visible", selectPickerFile: "selectPickerFile" }, outputs: { visibleChange: "visibleChange", selectFilefn: "selectFilefn" }, providers: [
697
+ // [Required]
698
+ ListService,
699
+ // [Optional]
700
+ // Provide this token if you want a different debounce time.
701
+ // Default is 300. Cannot be 0. Any value below 100 is not recommended.
702
+ { provide: LIST_QUERY_DEBOUNCE_TIME, useValue: 500 },
703
+ ], usesOnChanges: true, ngImport: i0, template: "<abp-modal [(visible)]=\"ModalOpen\" (visibleChange)=\"ModalVisibleChange($event)\"\n [options]=\"{ size: 'xl', scrollable: false }\">\n <ng-template #abpHeader>\n <h3>{{'FileExplorer::FileExplorer' | abpLocalization}}</h3>\n </ng-template>\n <ng-template #abpBody>\n <div class=\"row file-explorer-modal-body file-modal\">\n <div class=\"col-3\" style=\"overflow: auto; height: calc(100vh - 240px)\">\n <fe-file-modal-tree [theSelectedTreeNode]=\"_theSelectedTreeNode\" (nodeClick)=\"_nodeClick($event)\"\n [fileContainerName]=\"_fileContainerName\"></fe-file-modal-tree>\n </div>\n <div class=\"col-9\" style=\"height: calc(100vh - 240px)\">\n <div class=\"mb-2 d-flex justify-content-between align-items-center\">\n <div class=\"btn-link\" role=button style=\"flex: 2\" (click)=\"lookAllFile()\">{{'FileExplorer::AllFiles' | abpLocalization}}</div>\n <div class=\"input-group form-file\" style=\"flex: 2\">\n <input type=\"file\" class=\"form-control\" #fileEdit [multiple]=\"_multiple\" accept=\".jpg,.jpeg,.png,.gif,.webp\"\n (change)=\"getFileChange($event)\" />\n </div>\n </div>\n <div>\n <ngx-datatable class=\"material container-height\" [rows]=\"data.items\" [list]=\"list\" columnMode=\"flex\"\n [columns]=\"columns\" [headerHeight]=\"50\" [footerHeight]=\"50\" rowHeight=\"auto\" [scrollbarV]=\"true\"\n [virtualization]=\"false\" [externalPaging]=\"true\" [count]=\"data.totalCount\" [selected]=\"selectedTable\"\n [selectCheck]=\"selectCheck\" [selectionType]=\"SelectionType.multiClick\" (select)=\"onSelectTableItem($event)\">\n <ngx-datatable-column [width]=\"50\" prop=\"id\" [sortable]=\"false\" [canAutoResize]=\"false\" [draggable]=\"false\"\n [resizeable]=\"false\">\n <ng-template ngx-datatable-header-template let-value=\"value\" let-allRowsSelected=\"allRowsSelected\"\n let-selectFn=\"selectFn\">\n <input type=\"checkbox\" class=\"form-check-input\" [checked]=\"allRowsSelected\"\n (change)=\"selectFn(!allRowsSelected)\" />\n </ng-template>\n <ng-template ngx-datatable-cell-template let-row=\"row\" let-value=\"value\" let-isSelected=\"isSelected\"\n let-onCheckboxChangeFn=\"onCheckboxChangeFn\">\n <input type=\"checkbox\" class=\"form-check-input\" [checked]=\"selectedcheckbox(value)\"\n (change)=\"onCheckboxChangeFn($event)\" />\n </ng-template>\n </ngx-datatable-column>\n <ngx-datatable-column [name]=\"'FileExplorer::FileName' | abpLocalization\" prop=\"name\" [flexGrow]=\"4\">\n <ng-template let-row=\"row\" let-value=\"value\" ngx-datatable-cell-template>\n {{ value }}\n </ng-template>\n </ngx-datatable-column>\n <ngx-datatable-column [name]=\"'FileExplorer::FileSize' | abpLocalization\" prop=\"size\" [flexGrow]=\"1.5\">\n <ng-template let-row=\"row\" let-value=\"value\" ngx-datatable-cell-template>\n {{ _FileApiService.formatFileSize(value) }}\n </ng-template>\n </ngx-datatable-column>\n <ngx-datatable-column [name]=\"'FileExplorer::Directory' | abpLocalization\" prop=\"cellName\" [flexGrow]=\"1\">\n <ng-template let-row=\"row\" let-value=\"value\" ngx-datatable-cell-template>\n {{ value }}\n </ng-template>\n </ngx-datatable-column>\n <ngx-datatable-column [name]=\"'FileExplorer::CreationTime' | abpLocalization\" prop=\"creationTime\" [flexGrow]=\"2\">\n <ng-template let-row=\"row\" let-value=\"value\" ngx-datatable-cell-template>\n {{ value | date : 'YYYY/MM/dd HH:m:s' }}\n </ng-template>\n </ngx-datatable-column>\n <ngx-datatable-column [flexGrow]=\"1\">\n <ng-template let-row=\"row\" let-value=\"value\" ngx-datatable-cell-template>\n <button class=\"btn btn-sm btn-light p-0\" (click.stop)=\"deleteFile(row)\">\n <i class=\"fas fa-trash text-primary p-2\"></i>\n </button>\n </ng-template>\n </ngx-datatable-column>\n </ngx-datatable>\n </div>\n <div *ngIf=\"uploadPictureStatusList.length > 0\"\n class=\"position-fixed bottom-0 end-0 shadow-lg file-status-modal border bg-white p-1 m-5\"\n style=\"border-radius: 10px\">\n <div class=\"card\">\n <div class=\"card-header d-flex align-items-center justify-content-between p-0 py-1 border-bottom\">\n <div>{{'FileExplorer::UploadFiles' | abpLocalization}}</div>\n <button type=\"button\" class=\"btn-close\" aria-label=\"Close\" (click.stop)=\"closeFileStatusModal()\"></button>\n </div>\n <div class=\"card-body\">\n <table class=\"table\">\n <thead>\n <tr>\n <th scope=\"col\">{{'FileExplorer::FileName' | abpLocalization}}</th>\n <th scope=\"col\">{{'FileExplorer::FileSize' | abpLocalization}}</th>\n <th scope=\"col\"></th>\n </tr>\n </thead>\n <tbody>\n <ng-container *ngFor=\"let item of uploadPictureStatusList; let i = index\">\n <tr>\n <th scope=\"row\">\n <div>{{ item.name }}</div>\n <div class=\"form-text text-danger\" *ngIf=\"item.size > sizeLimit\">\n {{'FileExplorer::ExceedsMaximumSize' | abpLocalization:_FileApiService.formatFileSize(sizeLimit)}}\n </div>\n </th>\n <td>{{ item.fileSize }}</td>\n <td>\n <i *ngIf=\"item.status == 1\" class=\"fas fa-check text-primary\"></i>\n <i *ngIf=\"item.status == 2\" class=\"fas fa-times-circle text-danger\"></i>\n </td>\n </tr>\n </ng-container>\n </tbody>\n </table>\n </div>\n </div>\n </div>\n </div>\n </div>\n </ng-template>\n <ng-template #abpFooter>\n <button type=\"button\" class=\"btn btn-secondary\" abpClose>{{'AbpUi::Close' | abpLocalization}}</button>\n <abp-button iconClass=\"fa fa-check\" (click)=\"modalSave()\">{{'AbpUi::Save' | abpLocalization}}</abp-button>\n </ng-template>\n</abp-modal>", styles: ["::ng-deep .file-modal .container-height{height:calc(100vh - 284px)}::ng-deep .file-modal .file-status-modal{background:#fff}::ng-deep .file-modal .file-status-modal .card-body{max-height:300px;overflow-y:auto}::ng-deep .file-modal .ngx-datatable.material.single-selection .datatable-body-row.active,::ng-deep .file-modal .ngx-datatable.material.single-selection .datatable-body-row.active .datatable-row-group,::ng-deep .file-modal .ngx-datatable.material.multi-selection .datatable-body-row.active,::ng-deep .file-modal .ngx-datatable.material.multi-selection .datatable-body-row.active .datatable-row-group,::ng-deep .file-modal .ngx-datatable.material.multi-click-selection .datatable-body-row.active,::ng-deep .file-modal .ngx-datatable.material.multi-click-selection .datatable-body-row.active .datatable-row-group{background-color:transparent!important}::ng-deep .file-modal .ant-tree .ant-tree-node-content-wrapper{padding:0}::ng-deep .file-modal .ant-tree .ant-tree-node-content-wrapper .custom-node{width:100%}::ng-deep .file-modal .ant-tree .ant-tree-node-content-wrapper .selected{background-color:var(--lpx-brand)!important}::ng-deep .file-modal .ant-tree .ant-tree-node-content-wrapper .selected .btn{color:var(--lpx-navbar-color)}::ng-deep .file-modal .ant-tree .ant-tree-node-content-wrapper.ant-tree-node-selected{background-color:transparent}::ng-deep .file-modal .ngx-datatable.fixed-header .datatable-header .datatable-header-inner .datatable-header-cell,::ng-deep .file-modal .ngx-datatable.material .datatable-body .datatable-body-row .datatable-body-cell{overflow:initial;line-break:anywhere}\n"], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.StopPropagationDirective, selector: "[click.stop]", outputs: ["click.stop"] }, { kind: "component", type: i6.DatatableComponent, selector: "ngx-datatable", inputs: ["targetMarkerTemplate", "rows", "groupRowsBy", "groupedRows", "columns", "selected", "scrollbarV", "scrollbarH", "rowHeight", "columnMode", "headerHeight", "footerHeight", "externalPaging", "externalSorting", "limit", "count", "offset", "loadingIndicator", "selectionType", "reorderable", "swapColumns", "sortType", "sorts", "cssClasses", "messages", "rowClass", "selectCheck", "displayCheck", "groupExpansionDefault", "trackByProp", "selectAllRowsOnPage", "virtualization", "treeFromRelation", "treeToRelation", "summaryRow", "summaryHeight", "summaryPosition", "rowIdentity"], outputs: ["scroll", "activate", "select", "sort", "page", "reorder", "resize", "tableContextmenu", "treeAction"] }, { kind: "directive", type: i6.DataTableColumnDirective, selector: "ngx-datatable-column", inputs: ["name", "prop", "frozenLeft", "frozenRight", "flexGrow", "resizeable", "comparator", "pipe", "sortable", "draggable", "canAutoResize", "minWidth", "width", "maxWidth", "checkboxable", "headerCheckboxable", "headerClass", "cellClass", "isTreeColumn", "treeLevelIndent", "summaryFunc", "summaryTemplate", "cellTemplate", "headerTemplate", "treeToggleTemplate"] }, { kind: "directive", type: i6.DataTableColumnHeaderDirective, selector: "[ngx-datatable-header-template]" }, { kind: "directive", type: i6.DataTableColumnCellDirective, selector: "[ngx-datatable-cell-template]" }, { kind: "component", type: i2$2.ButtonComponent, selector: "abp-button", inputs: ["buttonId", "buttonClass", "buttonType", "formName", "iconClass", "loading", "disabled", "attributes"], outputs: ["click", "focus", "blur", "abpClick", "abpFocus", "abpBlur"] }, { kind: "component", type: i2$2.ModalComponent, selector: "abp-modal", inputs: ["visible", "busy", "options", "suppressUnsavedChangesWarning"], outputs: ["visibleChange", "init", "appear", "disappear"] }, { kind: "directive", type: i2$2.NgxDatatableListDirective, selector: "ngx-datatable[list]", inputs: ["list"], exportAs: ["ngxDatatableList"] }, { kind: "directive", type: i2$2.ModalCloseDirective, selector: "[abpClose]" }, { kind: "component", type: FileModalTreeComponent, selector: "fe-file-modal-tree", inputs: ["theSelectedTreeNode", "fileContainerName"], outputs: ["nodeClick"] }, { kind: "pipe", type: i2.DatePipe, name: "date" }, { kind: "pipe", type: i3.LocalizationPipe, name: "abpLocalization" }] });
704
+ }
705
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileModalComponent, decorators: [{
706
+ type: Component,
707
+ args: [{ selector: 'fe-file-modal', providers: [
708
+ // [Required]
709
+ ListService,
710
+ // [Optional]
711
+ // Provide this token if you want a different debounce time.
712
+ // Default is 300. Cannot be 0. Any value below 100 is not recommended.
713
+ { provide: LIST_QUERY_DEBOUNCE_TIME, useValue: 500 },
714
+ ], template: "<abp-modal [(visible)]=\"ModalOpen\" (visibleChange)=\"ModalVisibleChange($event)\"\n [options]=\"{ size: 'xl', scrollable: false }\">\n <ng-template #abpHeader>\n <h3>{{'FileExplorer::FileExplorer' | abpLocalization}}</h3>\n </ng-template>\n <ng-template #abpBody>\n <div class=\"row file-explorer-modal-body file-modal\">\n <div class=\"col-3\" style=\"overflow: auto; height: calc(100vh - 240px)\">\n <fe-file-modal-tree [theSelectedTreeNode]=\"_theSelectedTreeNode\" (nodeClick)=\"_nodeClick($event)\"\n [fileContainerName]=\"_fileContainerName\"></fe-file-modal-tree>\n </div>\n <div class=\"col-9\" style=\"height: calc(100vh - 240px)\">\n <div class=\"mb-2 d-flex justify-content-between align-items-center\">\n <div class=\"btn-link\" role=button style=\"flex: 2\" (click)=\"lookAllFile()\">{{'FileExplorer::AllFiles' | abpLocalization}}</div>\n <div class=\"input-group form-file\" style=\"flex: 2\">\n <input type=\"file\" class=\"form-control\" #fileEdit [multiple]=\"_multiple\" accept=\".jpg,.jpeg,.png,.gif,.webp\"\n (change)=\"getFileChange($event)\" />\n </div>\n </div>\n <div>\n <ngx-datatable class=\"material container-height\" [rows]=\"data.items\" [list]=\"list\" columnMode=\"flex\"\n [columns]=\"columns\" [headerHeight]=\"50\" [footerHeight]=\"50\" rowHeight=\"auto\" [scrollbarV]=\"true\"\n [virtualization]=\"false\" [externalPaging]=\"true\" [count]=\"data.totalCount\" [selected]=\"selectedTable\"\n [selectCheck]=\"selectCheck\" [selectionType]=\"SelectionType.multiClick\" (select)=\"onSelectTableItem($event)\">\n <ngx-datatable-column [width]=\"50\" prop=\"id\" [sortable]=\"false\" [canAutoResize]=\"false\" [draggable]=\"false\"\n [resizeable]=\"false\">\n <ng-template ngx-datatable-header-template let-value=\"value\" let-allRowsSelected=\"allRowsSelected\"\n let-selectFn=\"selectFn\">\n <input type=\"checkbox\" class=\"form-check-input\" [checked]=\"allRowsSelected\"\n (change)=\"selectFn(!allRowsSelected)\" />\n </ng-template>\n <ng-template ngx-datatable-cell-template let-row=\"row\" let-value=\"value\" let-isSelected=\"isSelected\"\n let-onCheckboxChangeFn=\"onCheckboxChangeFn\">\n <input type=\"checkbox\" class=\"form-check-input\" [checked]=\"selectedcheckbox(value)\"\n (change)=\"onCheckboxChangeFn($event)\" />\n </ng-template>\n </ngx-datatable-column>\n <ngx-datatable-column [name]=\"'FileExplorer::FileName' | abpLocalization\" prop=\"name\" [flexGrow]=\"4\">\n <ng-template let-row=\"row\" let-value=\"value\" ngx-datatable-cell-template>\n {{ value }}\n </ng-template>\n </ngx-datatable-column>\n <ngx-datatable-column [name]=\"'FileExplorer::FileSize' | abpLocalization\" prop=\"size\" [flexGrow]=\"1.5\">\n <ng-template let-row=\"row\" let-value=\"value\" ngx-datatable-cell-template>\n {{ _FileApiService.formatFileSize(value) }}\n </ng-template>\n </ngx-datatable-column>\n <ngx-datatable-column [name]=\"'FileExplorer::Directory' | abpLocalization\" prop=\"cellName\" [flexGrow]=\"1\">\n <ng-template let-row=\"row\" let-value=\"value\" ngx-datatable-cell-template>\n {{ value }}\n </ng-template>\n </ngx-datatable-column>\n <ngx-datatable-column [name]=\"'FileExplorer::CreationTime' | abpLocalization\" prop=\"creationTime\" [flexGrow]=\"2\">\n <ng-template let-row=\"row\" let-value=\"value\" ngx-datatable-cell-template>\n {{ value | date : 'YYYY/MM/dd HH:m:s' }}\n </ng-template>\n </ngx-datatable-column>\n <ngx-datatable-column [flexGrow]=\"1\">\n <ng-template let-row=\"row\" let-value=\"value\" ngx-datatable-cell-template>\n <button class=\"btn btn-sm btn-light p-0\" (click.stop)=\"deleteFile(row)\">\n <i class=\"fas fa-trash text-primary p-2\"></i>\n </button>\n </ng-template>\n </ngx-datatable-column>\n </ngx-datatable>\n </div>\n <div *ngIf=\"uploadPictureStatusList.length > 0\"\n class=\"position-fixed bottom-0 end-0 shadow-lg file-status-modal border bg-white p-1 m-5\"\n style=\"border-radius: 10px\">\n <div class=\"card\">\n <div class=\"card-header d-flex align-items-center justify-content-between p-0 py-1 border-bottom\">\n <div>{{'FileExplorer::UploadFiles' | abpLocalization}}</div>\n <button type=\"button\" class=\"btn-close\" aria-label=\"Close\" (click.stop)=\"closeFileStatusModal()\"></button>\n </div>\n <div class=\"card-body\">\n <table class=\"table\">\n <thead>\n <tr>\n <th scope=\"col\">{{'FileExplorer::FileName' | abpLocalization}}</th>\n <th scope=\"col\">{{'FileExplorer::FileSize' | abpLocalization}}</th>\n <th scope=\"col\"></th>\n </tr>\n </thead>\n <tbody>\n <ng-container *ngFor=\"let item of uploadPictureStatusList; let i = index\">\n <tr>\n <th scope=\"row\">\n <div>{{ item.name }}</div>\n <div class=\"form-text text-danger\" *ngIf=\"item.size > sizeLimit\">\n {{'FileExplorer::ExceedsMaximumSize' | abpLocalization:_FileApiService.formatFileSize(sizeLimit)}}\n </div>\n </th>\n <td>{{ item.fileSize }}</td>\n <td>\n <i *ngIf=\"item.status == 1\" class=\"fas fa-check text-primary\"></i>\n <i *ngIf=\"item.status == 2\" class=\"fas fa-times-circle text-danger\"></i>\n </td>\n </tr>\n </ng-container>\n </tbody>\n </table>\n </div>\n </div>\n </div>\n </div>\n </div>\n </ng-template>\n <ng-template #abpFooter>\n <button type=\"button\" class=\"btn btn-secondary\" abpClose>{{'AbpUi::Close' | abpLocalization}}</button>\n <abp-button iconClass=\"fa fa-check\" (click)=\"modalSave()\">{{'AbpUi::Save' | abpLocalization}}</abp-button>\n </ng-template>\n</abp-modal>", styles: ["::ng-deep .file-modal .container-height{height:calc(100vh - 284px)}::ng-deep .file-modal .file-status-modal{background:#fff}::ng-deep .file-modal .file-status-modal .card-body{max-height:300px;overflow-y:auto}::ng-deep .file-modal .ngx-datatable.material.single-selection .datatable-body-row.active,::ng-deep .file-modal .ngx-datatable.material.single-selection .datatable-body-row.active .datatable-row-group,::ng-deep .file-modal .ngx-datatable.material.multi-selection .datatable-body-row.active,::ng-deep .file-modal .ngx-datatable.material.multi-selection .datatable-body-row.active .datatable-row-group,::ng-deep .file-modal .ngx-datatable.material.multi-click-selection .datatable-body-row.active,::ng-deep .file-modal .ngx-datatable.material.multi-click-selection .datatable-body-row.active .datatable-row-group{background-color:transparent!important}::ng-deep .file-modal .ant-tree .ant-tree-node-content-wrapper{padding:0}::ng-deep .file-modal .ant-tree .ant-tree-node-content-wrapper .custom-node{width:100%}::ng-deep .file-modal .ant-tree .ant-tree-node-content-wrapper .selected{background-color:var(--lpx-brand)!important}::ng-deep .file-modal .ant-tree .ant-tree-node-content-wrapper .selected .btn{color:var(--lpx-navbar-color)}::ng-deep .file-modal .ant-tree .ant-tree-node-content-wrapper.ant-tree-node-selected{background-color:transparent}::ng-deep .file-modal .ngx-datatable.fixed-header .datatable-header .datatable-header-inner .datatable-header-cell,::ng-deep .file-modal .ngx-datatable.material .datatable-body .datatable-body-row .datatable-body-cell{overflow:initial;line-break:anywhere}\n"] }]
715
+ }], ctorParameters: function () { return [{ type: FileDescriptorService$1 }, { type: i2$2.ToasterService }, { type: i3.ListService }, { type: FileApiService }, { type: i3.RestService }, { type: i2$2.ConfirmationService }, { type: i3.LocalizationService }]; }, propDecorators: { fileContainerName: [{
716
+ type: Input
717
+ }], multiple: [{
718
+ type: Input
719
+ }], limit: [{
720
+ type: Input
721
+ }], visible: [{
722
+ type: Input
723
+ }], visibleChange: [{
724
+ type: Output
725
+ }], selectPickerFile: [{
726
+ type: Input
727
+ }], selectFilefn: [{
728
+ type: Output
729
+ }] } });
730
+
731
+ class FilePickerComponent {
732
+ _FileApiService;
733
+ constructor(_FileApiService) {
734
+ this._FileApiService = _FileApiService;
735
+ }
736
+ /**图片容器 */
737
+ _fileContainerName = 'images';
738
+ set fileContainerName(v) {
739
+ this._fileContainerName = v;
740
+ }
741
+ /**已选定的文件 */
742
+ selectFormFile;
743
+ ngOnChanges(changes) {
744
+ let selectFormFilengOnChanges = changes.selectFormFile['currentValue'];
745
+ if (selectFormFilengOnChanges.length > 0) {
746
+ this._fileShowTable = selectFormFilengOnChanges;
747
+ }
748
+ }
749
+ selectedFileChange = new EventEmitter();
750
+ _fileShowTable = [];
751
+ /**表格选择的文件回调 */
752
+ _selectFilefn(event) {
753
+ let _fileShowTable = this._FileApiService.deepClone(event);
754
+ this._fileShowTable = _fileShowTable;
755
+ this.selectFormFile = _fileShowTable;
756
+ this.selectedFileChange.emit(_fileShowTable);
757
+ }
758
+ /**模态框-状态-是否打开 */
759
+ ModalOpen = false;
760
+ /**删除文件表格项 */
761
+ deleteFileTableItem(i, file) {
762
+ this._fileShowTable.splice(i, 1);
763
+ this.selectFormFile = this._fileShowTable;
764
+ this.selectedFileChange.emit([]);
765
+ this.selectedFileChange.emit(this.selectFormFile);
766
+ }
767
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FilePickerComponent, deps: [{ token: FileApiService }], target: i0.ɵɵFactoryTarget.Component });
768
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FilePickerComponent, selector: "fe-file-picker", inputs: { fileContainerName: "fileContainerName", selectFormFile: "selectFormFile" }, outputs: { selectedFileChange: "selectedFileChange" }, usesOnChanges: true, ngImport: i0, template: "<button class=\"btn btn-sm btn-primary ms-2\" type=\"button\" (click.stop)=\"ModalOpen = true\">{{'FileExplorer::SelectFile' | abpLocalization}}</button>\n<fe-file-modal [(visible)]=\"ModalOpen\" [selectPickerFile]=\"selectFormFile\" (selectFilefn)=\"_selectFilefn($event)\" [fileContainerName]=\"_fileContainerName\"></fe-file-modal>\n<table class=\"table\" *ngIf=\"_fileShowTable.length>0\">\n <thead>\n <tr>\n <th scope=\"col\">{{'FileExplorer::FileName' | abpLocalization}}</th>\n <th scope=\"col\">{{'FileExplorer::FileSize' | abpLocalization}}</th>\n <th scope=\"col\"></th>\n </tr>\n </thead>\n <tbody>\n <ng-container *ngFor=\"let item of _fileShowTable;let i =index\">\n <tr>\n <th scope=\"row\">\n <div>{{item.name}}</div>\n </th>\n <td >{{_FileApiService.formatFileSize(item.size)}}</td>\n <td>\n <button class=\"btn btn-sm p-0 btn-light \" (click.stop)=\"deleteFileTableItem(i,item)\">\n <i class=\"fas fa-trash p-2\"></i>\n </button>\n </td>\n </tr>\n </ng-container>\n </tbody>\n</table>\n\n\n", styles: [""], dependencies: [{ kind: "directive", type: i2.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i2.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i3.StopPropagationDirective, selector: "[click.stop]", outputs: ["click.stop"] }, { kind: "component", type: FileModalComponent, selector: "fe-file-modal", inputs: ["fileContainerName", "multiple", "limit", "visible", "selectPickerFile"], outputs: ["visibleChange", "selectFilefn"] }, { kind: "pipe", type: i3.LocalizationPipe, name: "abpLocalization" }] });
769
+ }
770
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FilePickerComponent, decorators: [{
771
+ type: Component,
772
+ args: [{ selector: 'fe-file-picker', template: "<button class=\"btn btn-sm btn-primary ms-2\" type=\"button\" (click.stop)=\"ModalOpen = true\">{{'FileExplorer::SelectFile' | abpLocalization}}</button>\n<fe-file-modal [(visible)]=\"ModalOpen\" [selectPickerFile]=\"selectFormFile\" (selectFilefn)=\"_selectFilefn($event)\" [fileContainerName]=\"_fileContainerName\"></fe-file-modal>\n<table class=\"table\" *ngIf=\"_fileShowTable.length>0\">\n <thead>\n <tr>\n <th scope=\"col\">{{'FileExplorer::FileName' | abpLocalization}}</th>\n <th scope=\"col\">{{'FileExplorer::FileSize' | abpLocalization}}</th>\n <th scope=\"col\"></th>\n </tr>\n </thead>\n <tbody>\n <ng-container *ngFor=\"let item of _fileShowTable;let i =index\">\n <tr>\n <th scope=\"row\">\n <div>{{item.name}}</div>\n </th>\n <td >{{_FileApiService.formatFileSize(item.size)}}</td>\n <td>\n <button class=\"btn btn-sm p-0 btn-light \" (click.stop)=\"deleteFileTableItem(i,item)\">\n <i class=\"fas fa-trash p-2\"></i>\n </button>\n </td>\n </tr>\n </ng-container>\n </tbody>\n</table>\n\n\n" }]
773
+ }], ctorParameters: function () { return [{ type: FileApiService }]; }, propDecorators: { fileContainerName: [{
774
+ type: Input
775
+ }], selectFormFile: [{
776
+ type: Input
777
+ }], selectedFileChange: [{
778
+ type: Output
779
+ }] } });
780
+
781
+ class FileDomeComponent {
782
+ /**跟随表单提交--已提交的数据,或选择的数据源 */
783
+ fileSubmittedData = [];
784
+ /**跟随表单提交--待提交的数据
785
+ *
786
+ * @param 待上传的文件们
787
+ * @param 待删除已上传的文件们
788
+ */
789
+ fileDataToBeSubmitted;
790
+ /**跟随表单提交--数据发生改变回调 */
791
+ fileDataChange(event) {
792
+ this.fileDataToBeSubmitted = event;
793
+ }
794
+ /**选择文件-弹窗的-已选定的文件 */
795
+ selectedFileGroup = [];
796
+ /**_selectedFile改变回调 */
797
+ _selectedFileChange(event) {
798
+ this.selectedFileGroup = event;
799
+ }
800
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileDomeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
801
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "16.2.12", type: FileDomeComponent, selector: "fe-file-dome", ngImport: i0, template: "<div class=\"row\">\r\n <div class=\"col\">\r\n <div class=\"card\">\r\n <div class=\"card-header py-2 border-bottom\">Send file stream with form</div>\r\n <div class=\"card-body\">\r\n <fe-file-edit [(fileData)]=\"fileSubmittedData\" (fileDataChange)=\"fileDataChange($event)\"></fe-file-edit>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"col\">\r\n <div class=\"card\">\r\n <div class=\"card-header py-2 border-bottom\">Send file stream with form</div>\r\n <div class=\"card-body\">\r\n <fe-file-picker [selectFormFile]=\"selectedFileGroup\" (selectedFileChange)=\"_selectedFileChange($event)\" ></fe-file-picker>\r\n </div>\r\n </div>\r\n </div>\r\n</div>", styles: [""], dependencies: [{ kind: "component", type: FileEditComponent, selector: "fe-file-edit", inputs: ["multiple", "fileData", "limit"], outputs: ["fileDataChange"] }, { kind: "component", type: FilePickerComponent, selector: "fe-file-picker", inputs: ["fileContainerName", "selectFormFile"], outputs: ["selectedFileChange"] }] });
802
+ }
803
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileDomeComponent, decorators: [{
804
+ type: Component,
805
+ args: [{ selector: 'fe-file-dome', template: "<div class=\"row\">\r\n <div class=\"col\">\r\n <div class=\"card\">\r\n <div class=\"card-header py-2 border-bottom\">Send file stream with form</div>\r\n <div class=\"card-body\">\r\n <fe-file-edit [(fileData)]=\"fileSubmittedData\" (fileDataChange)=\"fileDataChange($event)\"></fe-file-edit>\r\n </div>\r\n </div>\r\n </div>\r\n <div class=\"col\">\r\n <div class=\"card\">\r\n <div class=\"card-header py-2 border-bottom\">Send file stream with form</div>\r\n <div class=\"card-body\">\r\n <fe-file-picker [selectFormFile]=\"selectedFileGroup\" (selectedFileChange)=\"_selectedFileChange($event)\" ></fe-file-picker>\r\n </div>\r\n </div>\r\n </div>\r\n</div>" }]
806
+ }] });
807
+
808
+ const routes = [
809
+ {
810
+ path: 'file-dome',
811
+ component: FileDomeComponent
812
+ },
813
+ ];
814
+ class FileExplorerRoutingModule {
815
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileExplorerRoutingModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
816
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: FileExplorerRoutingModule, imports: [i1.RouterModule], exports: [RouterModule] });
817
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileExplorerRoutingModule, imports: [RouterModule.forChild(routes), RouterModule] });
818
+ }
819
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileExplorerRoutingModule, decorators: [{
820
+ type: NgModule,
821
+ args: [{
822
+ imports: [RouterModule.forChild(routes)],
823
+ exports: [RouterModule]
824
+ }]
825
+ }] });
826
+
827
+ class FileExplorerModule {
828
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileExplorerModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
829
+ static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "16.2.12", ngImport: i0, type: FileExplorerModule, declarations: [FileEditComponent,
830
+ FilePickerComponent,
831
+ FileModalComponent,
832
+ FileModalTreeComponent,
833
+ FileDomeComponent], imports: [FormsModule,
834
+ CoreModule,
835
+ ThemeSharedModule,
836
+ ReactiveFormsModule,
837
+ NgbDropdownModule,
838
+ NzTreeModule,
839
+ NgxValidateCoreModule,
840
+ FileExplorerRoutingModule], exports: [FileEditComponent,
841
+ FilePickerComponent,
842
+ FileModalComponent,
843
+ FileModalTreeComponent,
844
+ FileDomeComponent] });
845
+ static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileExplorerModule, providers: [
846
+ // [Required]
847
+ ListService,
848
+ // [Optional]
849
+ // Provide this token if you want a different debounce time.
850
+ // Default is 300. Cannot be 0. Any value below 100 is not recommended.
851
+ { provide: LIST_QUERY_DEBOUNCE_TIME, useValue: 500 },
852
+ ], imports: [FormsModule,
853
+ CoreModule,
854
+ ThemeSharedModule,
855
+ ReactiveFormsModule,
856
+ NgbDropdownModule,
857
+ NzTreeModule,
858
+ NgxValidateCoreModule,
859
+ FileExplorerRoutingModule] });
860
+ }
861
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.2.12", ngImport: i0, type: FileExplorerModule, decorators: [{
862
+ type: NgModule,
863
+ args: [{
864
+ declarations: [
865
+ FileEditComponent,
866
+ FilePickerComponent,
867
+ FileModalComponent,
868
+ FileModalTreeComponent,
869
+ FileDomeComponent,
870
+ ],
871
+ imports: [
872
+ FormsModule,
873
+ CoreModule,
874
+ ThemeSharedModule,
875
+ ReactiveFormsModule,
876
+ NgbDropdownModule,
877
+ NzTreeModule,
878
+ NgxValidateCoreModule,
879
+ FileExplorerRoutingModule,
880
+ ],
881
+ exports: [
882
+ FileEditComponent,
883
+ FilePickerComponent,
884
+ FileModalComponent,
885
+ FileModalTreeComponent,
886
+ FileDomeComponent
887
+ ],
888
+ providers: [
889
+ // [Required]
890
+ ListService,
891
+ // [Optional]
892
+ // Provide this token if you want a different debounce time.
893
+ // Default is 300. Cannot be 0. Any value below 100 is not recommended.
894
+ { provide: LIST_QUERY_DEBOUNCE_TIME, useValue: 500 },
895
+ ],
896
+ }]
897
+ }] });
898
+
899
+ var index$c = /*#__PURE__*/Object.freeze({
900
+ __proto__: null,
901
+ Directories: index$d,
902
+ Files: index$e
903
+ });
904
+
905
+ var index$b = /*#__PURE__*/Object.freeze({
906
+ __proto__: null,
907
+ FileExplorer: index$c
908
+ });
909
+
910
+ var index$a = /*#__PURE__*/Object.freeze({
911
+ __proto__: null
912
+ });
913
+
914
+ var index$9 = /*#__PURE__*/Object.freeze({
915
+ __proto__: null,
916
+ Mvc: index$a
917
+ });
918
+
919
+ var index$8 = /*#__PURE__*/Object.freeze({
920
+ __proto__: null
921
+ });
922
+
923
+ var index$7 = /*#__PURE__*/Object.freeze({
924
+ __proto__: null,
925
+ Primitives: index$8
926
+ });
927
+
928
+ var index$6 = /*#__PURE__*/Object.freeze({
929
+ __proto__: null
930
+ });
931
+
932
+ var index$5 = /*#__PURE__*/Object.freeze({
933
+ __proto__: null,
934
+ Headers: index$6
935
+ });
936
+
937
+ var index$4 = /*#__PURE__*/Object.freeze({
938
+ __proto__: null,
939
+ Http: index$5
940
+ });
941
+
942
+ var index$3 = /*#__PURE__*/Object.freeze({
943
+ __proto__: null,
944
+ AspNetCore: index$9,
945
+ Extensions: index$7,
946
+ Net: index$4
947
+ });
948
+
949
+ var index$2 = /*#__PURE__*/Object.freeze({
950
+ __proto__: null
951
+ });
952
+
953
+ var index$1 = /*#__PURE__*/Object.freeze({
954
+ __proto__: null,
955
+ Content: index$2
956
+ });
957
+
958
+ var index = /*#__PURE__*/Object.freeze({
959
+ __proto__: null,
960
+ Abp: index$1
961
+ });
962
+
963
+ /*
964
+ * Public API Surface of file-explorer
965
+ */
966
+
967
+ /**
968
+ * Generated bundle index. Do not edit.
969
+ */
970
+
971
+ export { index$b as Dignite, FileApiService, FileDomeComponent, FileEditComponent, FileExplorerModule, FileModalComponent, FileModalTreeComponent, FilePickerComponent, index$3 as Microsoft, index as Volo };
972
+ //# sourceMappingURL=dignite-ng-expand.file-explorer.mjs.map