@dignite-ng/expand.file-explorer 0.0.3 → 0.0.4
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/config/{src/enums/index.ts → enums/index.d.ts} +1 -1
- package/config/enums/route-names.d.ts +3 -0
- package/config/file-config.module.d.ts +8 -0
- package/config/index.d.ts +5 -0
- package/config/{src/providers/index.ts → providers/index.d.ts} +1 -1
- package/config/providers/route.provider.d.ts +8 -0
- package/config/{src/public-api.ts → public-api.d.ts} +3 -3
- package/esm2022/config/dignite-ng-expand.file-explorer-config.mjs +5 -0
- package/esm2022/config/enums/index.mjs +2 -0
- package/esm2022/config/enums/route-names.mjs +2 -0
- package/esm2022/config/file-config.module.mjs +19 -0
- package/esm2022/config/providers/index.mjs +2 -0
- package/esm2022/config/providers/route.provider.mjs +24 -0
- package/esm2022/config/public-api.mjs +4 -0
- package/esm2022/dignite-ng-expand.file-explorer.mjs +5 -0
- package/esm2022/lib/components/dome/file-dome.component.mjs +32 -0
- package/esm2022/lib/components/file-edit/file-edit.component.mjs +102 -0
- package/esm2022/lib/components/file-modal/file-modal.component.mjs +271 -0
- package/esm2022/lib/components/file-modal-tree/file-modal-tree.component.mjs +195 -0
- package/esm2022/lib/components/file-picker/file-picker.component.mjs +57 -0
- package/esm2022/lib/components/index.mjs +6 -0
- package/esm2022/lib/file-explorer-routing.module.mjs +25 -0
- package/esm2022/lib/file-explorer.module.mjs +83 -0
- package/esm2022/lib/proxy/dignite/file-explorer/directories/file-descriptor.service.mjs +48 -0
- package/esm2022/lib/proxy/dignite/file-explorer/directories/index.mjs +3 -0
- package/esm2022/lib/proxy/dignite/file-explorer/directories/models.mjs +2 -0
- package/esm2022/lib/proxy/dignite/file-explorer/files/file-descriptor.service.mjs +60 -0
- package/esm2022/lib/proxy/dignite/file-explorer/files/index.mjs +3 -0
- package/esm2022/lib/proxy/dignite/file-explorer/files/models.mjs +2 -0
- package/esm2022/lib/proxy/dignite/file-explorer/index.mjs +4 -0
- package/esm2022/lib/proxy/dignite/index.mjs +3 -0
- package/esm2022/lib/proxy/index.mjs +5 -0
- package/esm2022/lib/proxy/microsoft/asp-net-core/index.mjs +3 -0
- package/esm2022/lib/proxy/microsoft/asp-net-core/mvc/index.mjs +2 -0
- package/esm2022/lib/proxy/microsoft/asp-net-core/mvc/models.mjs +2 -0
- package/esm2022/lib/proxy/microsoft/extensions/index.mjs +3 -0
- package/esm2022/lib/proxy/microsoft/extensions/primitives/index.mjs +2 -0
- package/esm2022/lib/proxy/microsoft/extensions/primitives/models.mjs +2 -0
- package/esm2022/lib/proxy/microsoft/index.mjs +5 -0
- package/esm2022/lib/proxy/microsoft/net/http/headers/index.mjs +2 -0
- package/esm2022/lib/proxy/microsoft/net/http/headers/models.mjs +2 -0
- package/esm2022/lib/proxy/microsoft/net/http/index.mjs +3 -0
- package/esm2022/lib/proxy/microsoft/net/index.mjs +3 -0
- package/esm2022/lib/proxy/volo/abp/content/index.mjs +2 -0
- package/esm2022/lib/proxy/volo/abp/content/models.mjs +2 -0
- package/esm2022/lib/proxy/volo/abp/index.mjs +3 -0
- package/esm2022/lib/proxy/volo/index.mjs +3 -0
- package/esm2022/lib/services/file-api.service.mjs +66 -0
- package/esm2022/lib/services/index.mjs +2 -0
- package/esm2022/public-api.mjs +8 -0
- package/fesm2022/dignite-ng-expand.file-explorer-config.mjs +47 -0
- package/fesm2022/dignite-ng-expand.file-explorer-config.mjs.map +1 -0
- package/fesm2022/dignite-ng-expand.file-explorer.mjs +972 -0
- package/fesm2022/dignite-ng-expand.file-explorer.mjs.map +1 -0
- package/index.d.ts +5 -0
- package/lib/components/dome/file-dome.component.d.ts +19 -0
- package/lib/components/file-edit/file-edit.component.d.ts +38 -0
- package/lib/components/file-modal/file-modal.component.d.ts +93 -0
- package/lib/components/file-modal-tree/file-modal-tree.component.d.ts +66 -0
- package/lib/components/file-picker/file-picker.component.d.ts +23 -0
- package/lib/components/index.d.ts +5 -0
- package/lib/file-explorer-routing.module.d.ts +7 -0
- package/lib/file-explorer.module.d.ts +18 -0
- package/lib/proxy/dignite/file-explorer/directories/file-descriptor.service.d.ts +17 -0
- package/{src/lib/proxy/dignite/file-explorer/directories/models.ts → lib/proxy/dignite/file-explorer/directories/models.d.ts} +29 -35
- package/lib/proxy/dignite/file-explorer/files/file-descriptor.service.d.ts +20 -0
- package/lib/proxy/dignite/file-explorer/files/models.d.ts +50 -0
- package/{src/lib/proxy/microsoft/asp-net-core/mvc/models.ts → lib/proxy/microsoft/asp-net-core/mvc/models.d.ts} +10 -12
- package/lib/proxy/microsoft/extensions/primitives/models.d.ts +8 -0
- package/{src/lib/proxy/microsoft/net/http/headers/models.ts → lib/proxy/microsoft/net/http/headers/models.d.ts} +6 -7
- package/lib/proxy/volo/abp/content/models.d.ts +5 -0
- package/lib/services/file-api.service.d.ts +14 -0
- package/lib/services/index.d.ts +1 -0
- package/package.json +21 -2
- package/{src/public-api.ts → public-api.d.ts} +0 -5
- package/config/ng-package.json +0 -7
- package/config/src/enums/route-names.ts +0 -15
- package/config/src/file-config.module.ts +0 -12
- package/config/src/providers/route.provider.ts +0 -26
- package/ng-package.json +0 -7
- package/src/lib/components/dome/file-dome.component.html +0 -18
- package/src/lib/components/dome/file-dome.component.scss +0 -0
- package/src/lib/components/dome/file-dome.component.spec.ts +0 -21
- package/src/lib/components/dome/file-dome.component.ts +0 -33
- package/src/lib/components/file-edit/file-edit.component.html +0 -29
- package/src/lib/components/file-edit/file-edit.component.scss +0 -0
- package/src/lib/components/file-edit/file-edit.component.spec.ts +0 -21
- package/src/lib/components/file-edit/file-edit.component.ts +0 -98
- package/src/lib/components/file-modal/file-modal.component.html +0 -112
- package/src/lib/components/file-modal/file-modal.component.scss +0 -56
- package/src/lib/components/file-modal/file-modal.component.spec.ts +0 -21
- package/src/lib/components/file-modal/file-modal.component.ts +0 -284
- package/src/lib/components/file-modal-tree/file-modal-tree.component.html +0 -63
- package/src/lib/components/file-modal-tree/file-modal-tree.component.scss +0 -0
- package/src/lib/components/file-modal-tree/file-modal-tree.component.spec.ts +0 -21
- package/src/lib/components/file-modal-tree/file-modal-tree.component.ts +0 -207
- package/src/lib/components/file-picker/file-picker.component.html +0 -28
- package/src/lib/components/file-picker/file-picker.component.scss +0 -0
- package/src/lib/components/file-picker/file-picker.component.spec.ts +0 -21
- package/src/lib/components/file-picker/file-picker.component.ts +0 -58
- package/src/lib/components/index.ts +0 -5
- package/src/lib/file-explorer-routing.module.ts +0 -18
- package/src/lib/file-explorer.module.ts +0 -46
- package/src/lib/proxy/README.md +0 -17
- package/src/lib/proxy/dignite/file-explorer/directories/file-descriptor.service.ts +0 -65
- package/src/lib/proxy/dignite/file-explorer/files/file-descriptor.service.ts +0 -86
- package/src/lib/proxy/dignite/file-explorer/files/models.ts +0 -58
- package/src/lib/proxy/generate-proxy.json +0 -11810
- package/src/lib/proxy/microsoft/extensions/primitives/models.ts +0 -9
- package/src/lib/proxy/volo/abp/content/models.ts +0 -6
- package/src/lib/services/file-api.service.ts +0 -59
- package/src/lib/services/index.ts +0 -1
- package/tsconfig.lib.json +0 -14
- package/tsconfig.lib.prod.json +0 -10
- package/tsconfig.spec.json +0 -14
- /package/{src/lib/proxy/dignite/file-explorer/directories/index.ts → lib/proxy/dignite/file-explorer/directories/index.d.ts} +0 -0
- /package/{src/lib/proxy/dignite/file-explorer/files/index.ts → lib/proxy/dignite/file-explorer/files/index.d.ts} +0 -0
- /package/{src/lib/proxy/dignite/file-explorer/index.ts → lib/proxy/dignite/file-explorer/index.d.ts} +0 -0
- /package/{src/lib/proxy/dignite/index.ts → lib/proxy/dignite/index.d.ts} +0 -0
- /package/{src/lib/proxy/index.ts → lib/proxy/index.d.ts} +0 -0
- /package/{src/lib/proxy/microsoft/asp-net-core/index.ts → lib/proxy/microsoft/asp-net-core/index.d.ts} +0 -0
- /package/{src/lib/proxy/microsoft/asp-net-core/mvc/index.ts → lib/proxy/microsoft/asp-net-core/mvc/index.d.ts} +0 -0
- /package/{src/lib/proxy/microsoft/extensions/index.ts → lib/proxy/microsoft/extensions/index.d.ts} +0 -0
- /package/{src/lib/proxy/microsoft/extensions/primitives/index.ts → lib/proxy/microsoft/extensions/primitives/index.d.ts} +0 -0
- /package/{src/lib/proxy/microsoft/index.ts → lib/proxy/microsoft/index.d.ts} +0 -0
- /package/{src/lib/proxy/microsoft/net/http/headers/index.ts → lib/proxy/microsoft/net/http/headers/index.d.ts} +0 -0
- /package/{src/lib/proxy/microsoft/net/http/index.ts → lib/proxy/microsoft/net/http/index.d.ts} +0 -0
- /package/{src/lib/proxy/microsoft/net/index.ts → lib/proxy/microsoft/net/index.d.ts} +0 -0
- /package/{src/lib/proxy/volo/abp/content/index.ts → lib/proxy/volo/abp/content/index.d.ts} +0 -0
- /package/{src/lib/proxy/volo/abp/index.ts → lib/proxy/volo/abp/index.d.ts} +0 -0
- /package/{src/lib/proxy/volo/index.ts → lib/proxy/volo/index.d.ts} +0 -0
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { FileModalComponent } from './file-modal.component';
|
|
4
|
-
|
|
5
|
-
describe('FileModalComponent', () => {
|
|
6
|
-
let component: FileModalComponent;
|
|
7
|
-
let fixture: ComponentFixture<FileModalComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
TestBed.configureTestingModule({
|
|
11
|
-
declarations: [FileModalComponent]
|
|
12
|
-
});
|
|
13
|
-
fixture = TestBed.createComponent(FileModalComponent);
|
|
14
|
-
component = fixture.componentInstance;
|
|
15
|
-
fixture.detectChanges();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should create', () => {
|
|
19
|
-
expect(component).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,284 +0,0 @@
|
|
|
1
|
-
import { Component, EventEmitter, Input, Output, SimpleChanges } from '@angular/core';
|
|
2
|
-
import * as FileService from '../../proxy/dignite/file-explorer/files';
|
|
3
|
-
import { Confirmation, ConfirmationService, ToasterService } from '@abp/ng.theme.shared';
|
|
4
|
-
import { PagedResultDto, ABP, ListService, Rest, RestService, LocalizationService, LIST_QUERY_DEBOUNCE_TIME } from '@abp/ng.core';
|
|
5
|
-
import { FileDescriptorDto, GetFilesInput } from '../../proxy/dignite/file-explorer/files';
|
|
6
|
-
import { FileApiService } from '../../services/file-api.service';
|
|
7
|
-
import { SelectionType } from '@swimlane/ngx-datatable';
|
|
8
|
-
var that
|
|
9
|
-
@Component({
|
|
10
|
-
selector: 'fe-file-modal',
|
|
11
|
-
templateUrl: './file-modal.component.html',
|
|
12
|
-
styleUrls: ['./file-modal.component.scss'],
|
|
13
|
-
providers: [
|
|
14
|
-
// [Required]
|
|
15
|
-
ListService,
|
|
16
|
-
// [Optional]
|
|
17
|
-
// Provide this token if you want a different debounce time.
|
|
18
|
-
// Default is 300. Cannot be 0. Any value below 100 is not recommended.
|
|
19
|
-
{ provide: LIST_QUERY_DEBOUNCE_TIME, useValue: 500 },
|
|
20
|
-
]
|
|
21
|
-
})
|
|
22
|
-
export class FileModalComponent {
|
|
23
|
-
|
|
24
|
-
constructor(
|
|
25
|
-
private _FileService: FileService.FileDescriptorService,
|
|
26
|
-
private toaster: ToasterService,
|
|
27
|
-
public readonly list: ListService,
|
|
28
|
-
public _FileApiService: FileApiService,
|
|
29
|
-
private restService: RestService,
|
|
30
|
-
private confirmation: ConfirmationService,
|
|
31
|
-
private _LocalizationService: LocalizationService,
|
|
32
|
-
) {
|
|
33
|
-
that = this
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**图片容器 */
|
|
37
|
-
_fileContainerName: string
|
|
38
|
-
@Input()
|
|
39
|
-
public set fileContainerName(v: string) {
|
|
40
|
-
if (v) {
|
|
41
|
-
this._fileContainerName = v;
|
|
42
|
-
this.loadData()
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
/**是否多选 */
|
|
47
|
-
_multiple: boolean = true
|
|
48
|
-
@Input()
|
|
49
|
-
public set multiple(v: boolean) {
|
|
50
|
-
this._multiple = v;
|
|
51
|
-
if (v) { }
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**文件大小限制
|
|
55
|
-
* @param 1mb
|
|
56
|
-
*/
|
|
57
|
-
sizeLimit: number = 1048576
|
|
58
|
-
@Input()
|
|
59
|
-
public set limit(v: number) {
|
|
60
|
-
this.sizeLimit = v;
|
|
61
|
-
}
|
|
62
|
-
/**父组件传递的模态框状态 */
|
|
63
|
-
@Input()
|
|
64
|
-
public set visible(v: boolean) {
|
|
65
|
-
this.ModalOpen = v;
|
|
66
|
-
if (v) {
|
|
67
|
-
this.loadData()
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**模态框状态回调 */
|
|
72
|
-
@Output() visibleChange = new EventEmitter()
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
/**模态框-状态-是否打开 */
|
|
77
|
-
ModalOpen: boolean = false
|
|
78
|
-
|
|
79
|
-
/**模态框-繁忙状态-用于确定模态的繁忙状态是否为真 */
|
|
80
|
-
ModalBusy: boolean = false
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
/**模态框-状态改变回调 */
|
|
85
|
-
ModalVisibleChange(event) {
|
|
86
|
-
if (!event) {
|
|
87
|
-
this.visibleChange.emit(event)
|
|
88
|
-
return
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
/**模态框保存 */
|
|
93
|
-
modalSave() {
|
|
94
|
-
let selectedTablearr = this._FileApiService.deepClone(this.selectedTable)
|
|
95
|
-
this.selectFilefn.emit(selectedTablearr)
|
|
96
|
-
|
|
97
|
-
this.ModalVisibleChange(false)
|
|
98
|
-
}
|
|
99
|
-
/**dignite-file-modal-tree */
|
|
100
|
-
/**选择的tree节点 */
|
|
101
|
-
_theSelectedTreeNode: any = ''
|
|
102
|
-
|
|
103
|
-
/**初始化数据 */
|
|
104
|
-
loadData() {
|
|
105
|
-
if (this.ModalOpen && this._fileContainerName) {
|
|
106
|
-
this.hookToQuery()
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**tree-节点选择 */
|
|
111
|
-
_nodeClick(event) {
|
|
112
|
-
this._theSelectedTreeNode = event
|
|
113
|
-
this.list.get()
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
/**图片上传-要上传图片的状态文件列表 */
|
|
117
|
-
uploadPictureStatusList: any[] = []
|
|
118
|
-
|
|
119
|
-
/**图片上传-获取文件信息改变 */
|
|
120
|
-
async getFileChange(event) {
|
|
121
|
-
let files = new Array(...event.target.files)
|
|
122
|
-
this.uploadPictureStatusList = files
|
|
123
|
-
for (const file of files) {
|
|
124
|
-
if (file.size > this.sizeLimit) {
|
|
125
|
-
this.setuploadPictureStatus(file, 2)
|
|
126
|
-
continue;
|
|
127
|
-
}
|
|
128
|
-
await this.uploadingFile(file).then(() => {
|
|
129
|
-
this.setuploadPictureStatus(file, 1)
|
|
130
|
-
this.list.get()
|
|
131
|
-
}).catch(() => {
|
|
132
|
-
this.setuploadPictureStatus(file, 2)
|
|
133
|
-
}); // 等待每个文件上传完成
|
|
134
|
-
}
|
|
135
|
-
this.list.get()
|
|
136
|
-
let isSubmit = !this.uploadPictureStatusList.some(el => el.status == 2);
|
|
137
|
-
if (isSubmit) {
|
|
138
|
-
// this.toaster.success("上传完成");
|
|
139
|
-
setTimeout(() => {
|
|
140
|
-
this.uploadPictureStatusList = []
|
|
141
|
-
}, 6000)
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
/**图片上传-设置uploadPictureStatusList的状态 */
|
|
146
|
-
setuploadPictureStatus(file, type) {
|
|
147
|
-
this.uploadPictureStatusList.map(el => {
|
|
148
|
-
if (el == file) el.status = type
|
|
149
|
-
})
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
/**图片上传-递归按顺序上传 */
|
|
154
|
-
uploadingFile(file) {
|
|
155
|
-
return new Promise((resolve, rejects) => {
|
|
156
|
-
let formData = new FormData();
|
|
157
|
-
formData.append('file', file, file.name);
|
|
158
|
-
this.createFile({
|
|
159
|
-
file: formData,
|
|
160
|
-
containerName: this._fileContainerName,
|
|
161
|
-
directoryId: this._theSelectedTreeNode?.key || '',
|
|
162
|
-
entityId: ''
|
|
163
|
-
}).subscribe(res => {
|
|
164
|
-
resolve(true)
|
|
165
|
-
}, (err) => {
|
|
166
|
-
rejects(false)
|
|
167
|
-
})
|
|
168
|
-
})
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
/**文件表格-数据*/
|
|
173
|
-
data: PagedResultDto<FileDescriptorDto> = {
|
|
174
|
-
items: [],
|
|
175
|
-
totalCount: 0,
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
/**文件表格-条件*/
|
|
179
|
-
filters = {} as GetFilesInput;
|
|
180
|
-
|
|
181
|
-
/**文件表格-表格自带选择类型 */
|
|
182
|
-
SelectionType = SelectionType;
|
|
183
|
-
|
|
184
|
-
/**文件表格-选择的表格数据项 */
|
|
185
|
-
selectedTable = []
|
|
186
|
-
|
|
187
|
-
/**已选定的文件 */
|
|
188
|
-
@Input() selectPickerFile: any[]
|
|
189
|
-
|
|
190
|
-
ngOnChanges(changes: SimpleChanges): void {
|
|
191
|
-
//Called before any other lifecycle hook. Use it to inject dependencies, but avoid any serious work here.
|
|
192
|
-
//Add '${implements OnChanges}' to the class.
|
|
193
|
-
this.selectedTable = this._FileApiService.deepClone(this.selectPickerFile)
|
|
194
|
-
}
|
|
195
|
-
/**当前选择的table项 id */
|
|
196
|
-
nowSelectId: any = ''
|
|
197
|
-
|
|
198
|
-
/**选择文件回调 */
|
|
199
|
-
// @Output() selectedFileChange = new EventEmitter<any[]>()
|
|
200
|
-
@Output() selectFilefn = new EventEmitter<any[]>()
|
|
201
|
-
|
|
202
|
-
/**文件表格-获取表格数据 */
|
|
203
|
-
hookToQuery() {
|
|
204
|
-
const getData = (query: ABP.PageQueryParams) => this._FileService.getList({
|
|
205
|
-
...query,
|
|
206
|
-
...this.filters,
|
|
207
|
-
containerName: this._fileContainerName,
|
|
208
|
-
directoryId: this._theSelectedTreeNode.key
|
|
209
|
-
});
|
|
210
|
-
const setData = (list: PagedResultDto<FileDescriptorDto>) => (this.data = list);
|
|
211
|
-
this.list.hookToQuery(getData).subscribe(setData);
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**文件表格-查看所有分组的文件数据 */
|
|
215
|
-
lookAllFile() {
|
|
216
|
-
this._theSelectedTreeNode = ''
|
|
217
|
-
this.list.get()
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
/**选择表格项 */
|
|
221
|
-
onSelectTableItem({ selected }) {
|
|
222
|
-
this.selectedTable = this._FileApiService.deepClone(selected)
|
|
223
|
-
let selectedTablearr = this.removeDuplicatesById(this.selectedTable)
|
|
224
|
-
if (selected.length > selectedTablearr.length) {
|
|
225
|
-
selectedTablearr = selectedTablearr.filter(el => el.id !== this.nowSelectId)
|
|
226
|
-
}
|
|
227
|
-
this.selectedTable = selectedTablearr
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
/**删除数组中重复的项 */
|
|
231
|
-
removeDuplicatesById(array) {
|
|
232
|
-
const seenIds = {};
|
|
233
|
-
return array.filter(item => {
|
|
234
|
-
if (!seenIds[item.id]) {
|
|
235
|
-
seenIds[item.id] = true;
|
|
236
|
-
return true;
|
|
237
|
-
}
|
|
238
|
-
return false;
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
/**一个布尔or函数,可用于检查是否要根据条件选择特定行。 */
|
|
243
|
-
selectCheck = (row, column, value) => {
|
|
244
|
-
this.nowSelectId = row.id
|
|
245
|
-
return true;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
/**判断row是否选中 */
|
|
249
|
-
selectedcheckbox = (id) => {
|
|
250
|
-
return this.selectedTable.some(el => el.id == id)
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
/**删除图片 */
|
|
256
|
-
deleteFile(file) {
|
|
257
|
-
|
|
258
|
-
this.confirmation
|
|
259
|
-
.warn('', { key: '', defaultValue: this._LocalizationService.instant(`AbpUi::ItemWillBeDeletedMessage`) })
|
|
260
|
-
.subscribe((status: Confirmation.Status) => {
|
|
261
|
-
if (status == 'confirm') {
|
|
262
|
-
this._FileService.delete(file.id).subscribe(res => {
|
|
263
|
-
this.toaster.success(this._LocalizationService.instant(`AbpUi::SuccessfullyDeleted`));
|
|
264
|
-
this.list.get()
|
|
265
|
-
})
|
|
266
|
-
}
|
|
267
|
-
});
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
/**关闭文件状态弹窗 */
|
|
271
|
-
closeFileStatusModal() {
|
|
272
|
-
this.uploadPictureStatusList = []
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/**创建图片的接口,代理中的file类型不匹配,切换为any类型 */
|
|
276
|
-
createFile = (input: any, config?: Partial<Rest.Config>) =>
|
|
277
|
-
this.restService.request<any, FileDescriptorDto>({
|
|
278
|
-
method: 'POST',
|
|
279
|
-
url: '/api/file-explorer/files',
|
|
280
|
-
params: { containerName: input.containerName, cellName: input.cellName, directoryId: input.directoryId, entityId: input.entityId },
|
|
281
|
-
body: input.file,
|
|
282
|
-
},
|
|
283
|
-
{ apiName: 'FileExplorer', ...config });
|
|
284
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
<div class="card-header p-0 mb-1 d-flex justify-content-between align-items-center">
|
|
2
|
-
<h6 class="h6 mb-0">{{'FileExplorer::MyDirectories' | abpLocalization}}</h6>
|
|
3
|
-
<button type="button" class="btn btn-light btn-sm ms-2" (click.stop)="addDescriptorBtn()"><i
|
|
4
|
-
class="fas fa-plus-circle" aria-hidden="true"></i></button>
|
|
5
|
-
</div>
|
|
6
|
-
<nz-tree [nzData]="fileGroupList" class="ng-zorro-antd-tree" nzDraggable nzBlockNode nzShowIcon
|
|
7
|
-
[nzExpandedIcon]="multiExpandedIconTpl" (nzOnDrop)="nzEvent($event)" [nzBeforeDrop]="beforeDrop"
|
|
8
|
-
(nzClick)="activeNode($event)" (nzExpandChange)="nzExpandChange($event)" [nzTreeTemplate]="nzTreeTemplate">
|
|
9
|
-
<ng-template #nzTreeTemplate let-node let-origin="origin">
|
|
10
|
-
<div class="custom-node d-inline-block ng-star-inserted dropdown" [title]="node.title">
|
|
11
|
-
<div #dropdown="ngbDropdown" class="d-inline-block" ngbDropdown placement="bottom" container="body">
|
|
12
|
-
<div class="btn-group" [class.selected]="isNodeSelected(node)">
|
|
13
|
-
<button class="btn btn-sm p-0 px-1">{{ node.title }}</button>
|
|
14
|
-
<button class="btn btn-sm p-0" (click)="handleClick($event)" ngbDropdownToggle
|
|
15
|
-
[class.dropdown-toggle]="false" aria-hidden="true">
|
|
16
|
-
<i class="fas fa-caret-down text-muted p-1"></i>
|
|
17
|
-
</button>
|
|
18
|
-
</div>
|
|
19
|
-
<div ngbDropdownMenu>
|
|
20
|
-
<button ngbDropdownItem
|
|
21
|
-
(click.stop)="addDescriptorBtn(node)">{{'FileExplorer::NewDirectory' | abpLocalization}}</button>
|
|
22
|
-
<button ngbDropdownItem
|
|
23
|
-
(click.stop)="addDescriptorBtn(node,true)">{{'AbpUi::Edit' | abpLocalization}}</button>
|
|
24
|
-
<button ngbDropdownItem
|
|
25
|
-
(click.stop)="deleteDescriptorBtn(node)">{{'AbpUi::Delete' | abpLocalization}}</button>
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
</div>
|
|
29
|
-
</ng-template>
|
|
30
|
-
<ng-template #multiExpandedIconTpl let-node let-origin="origin">
|
|
31
|
-
<ng-container *ngIf="node.children.length > 0">
|
|
32
|
-
<i [class]="node.isExpanded ? 'fas fa-caret-down' : 'fas fa-caret-right'"></i>
|
|
33
|
-
</ng-container>
|
|
34
|
-
</ng-template>
|
|
35
|
-
</nz-tree>
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
<abp-modal [(visible)]="ModalDescriptorOpen" [busy]="ModalDescriptorBusy"
|
|
39
|
-
(visibleChange)="ModalDescriptorVisibleChange($event)">
|
|
40
|
-
<ng-template #abpHeader>
|
|
41
|
-
<h3>{{theNodeBeingEdited?('AbpUi::Edit' | abpLocalization):('FileExplorer::NewDirectory' | abpLocalization)}}</h3>
|
|
42
|
-
</ng-template>
|
|
43
|
-
<ng-template #abpBody>
|
|
44
|
-
<ng-template #loaderRef>
|
|
45
|
-
<div class="text-center"><i class="fa fa-pulse fa-spinner" aria-hidden="true"></i></div>
|
|
46
|
-
</ng-template>
|
|
47
|
-
<ng-container *ngIf="ModalDescriptorForm; else loaderRef">
|
|
48
|
-
<form class="sites-modal-form" #myForm="ngForm" [formGroup]="ModalDescriptorForm"
|
|
49
|
-
(ngSubmit)="createOrEditSave()">
|
|
50
|
-
<button type="submit" #ModalFormDescriptorSubmit style="display: none"></button>
|
|
51
|
-
<div class="mb-3">
|
|
52
|
-
<label class="form-label">{{'FileExplorer::DirectoryName' | abpLocalization}}</label>
|
|
53
|
-
<input type="email" class="form-control" formControlName="name">
|
|
54
|
-
</div>
|
|
55
|
-
</form>
|
|
56
|
-
</ng-container>
|
|
57
|
-
</ng-template>
|
|
58
|
-
<ng-template #abpFooter>
|
|
59
|
-
<button type="button" class="btn btn-secondary" abpClose>{{'AbpUi::Close' | abpLocalization}}</button>
|
|
60
|
-
<abp-button iconClass="fa fa-check"
|
|
61
|
-
(click)="ModalFormDescriptorSubmit.nativeElement.click()">{{'AbpUi::Save' | abpLocalization}}</abp-button>
|
|
62
|
-
</ng-template>
|
|
63
|
-
</abp-modal>
|
|
File without changes
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { FileModalTreeComponent } from './file-modal-tree.component';
|
|
4
|
-
|
|
5
|
-
describe('FileModalTreeComponent', () => {
|
|
6
|
-
let component: FileModalTreeComponent;
|
|
7
|
-
let fixture: ComponentFixture<FileModalTreeComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
TestBed.configureTestingModule({
|
|
11
|
-
declarations: [FileModalTreeComponent]
|
|
12
|
-
});
|
|
13
|
-
fixture = TestBed.createComponent(FileModalTreeComponent);
|
|
14
|
-
component = fixture.componentInstance;
|
|
15
|
-
fixture.detectChanges();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should create', () => {
|
|
19
|
-
expect(component).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
});
|
|
@@ -1,207 +0,0 @@
|
|
|
1
|
-
import { Component, ElementRef, EventEmitter, Input, Output, ViewChild, ViewContainerRef } from '@angular/core';
|
|
2
|
-
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
|
3
|
-
import { NzFormatEmitEvent } from 'ng-zorro-antd/tree';
|
|
4
|
-
import * as DescriptorService from '../../proxy/dignite/file-explorer/directories';
|
|
5
|
-
import { ToasterService } from '@abp/ng.theme.shared';
|
|
6
|
-
import { NzFormatBeforeDropEvent } from 'ng-zorro-antd/tree';
|
|
7
|
-
import { of } from 'rxjs';
|
|
8
|
-
import { FileApiService } from '../../services/file-api.service';
|
|
9
|
-
import { LocalizationService } from '@abp/ng.core';
|
|
10
|
-
var that;
|
|
11
|
-
@Component({
|
|
12
|
-
selector: 'fe-file-modal-tree',
|
|
13
|
-
templateUrl: './file-modal-tree.component.html',
|
|
14
|
-
styleUrls: ['./file-modal-tree.component.scss']
|
|
15
|
-
})
|
|
16
|
-
export class FileModalTreeComponent {
|
|
17
|
-
constructor(
|
|
18
|
-
private _DescriptorService: DescriptorService.FileDescriptorService,
|
|
19
|
-
private fb: FormBuilder,
|
|
20
|
-
private toaster: ToasterService,
|
|
21
|
-
public _FileApiService: FileApiService,
|
|
22
|
-
public _LocalizationService: LocalizationService,
|
|
23
|
-
) {
|
|
24
|
-
that = this
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**文件分组列表 */
|
|
28
|
-
fileGroupList: any[] = [];
|
|
29
|
-
|
|
30
|
-
/**选择的tree节点 */
|
|
31
|
-
_theSelectedTreeNode: any = '';
|
|
32
|
-
@Input()
|
|
33
|
-
public set theSelectedTreeNode(v: any) {
|
|
34
|
-
this._theSelectedTreeNode = v;
|
|
35
|
-
if (v.length > 0) {
|
|
36
|
-
this.loadData()
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/**正在编辑的节点 */
|
|
41
|
-
theNodeBeingEdited: any = '';
|
|
42
|
-
|
|
43
|
-
/**已展开的节点 */
|
|
44
|
-
anExpandedNode: any[] = [];
|
|
45
|
-
|
|
46
|
-
/**图片容器 */
|
|
47
|
-
_fileContainerName: string;
|
|
48
|
-
|
|
49
|
-
/**tree节点选择回调 */
|
|
50
|
-
@Output() nodeClick = new EventEmitter();
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
@Input()
|
|
54
|
-
public set fileContainerName(v: string) {
|
|
55
|
-
if (v) {
|
|
56
|
-
this._fileContainerName = v;
|
|
57
|
-
this.loadData()
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
handleClick = (event) => event.stopPropagation();
|
|
62
|
-
|
|
63
|
-
loadData() {
|
|
64
|
-
if (this._fileContainerName) {
|
|
65
|
-
this.getFileGroupList()
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
/**获取文件分组 */
|
|
71
|
-
getFileGroupList() {
|
|
72
|
-
this._DescriptorService.getList({
|
|
73
|
-
containerName: this._fileContainerName,
|
|
74
|
-
}).subscribe(async (res) => {
|
|
75
|
-
this.fileGroupList = await this.setTheValueOfTheNodeRecursively(res.items)
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
/**递归设置节点的值 */
|
|
80
|
-
setTheValueOfTheNodeRecursively(array: any[]): any {
|
|
81
|
-
return new Promise((reslove, rejects) => {
|
|
82
|
-
array.forEach((el) => {
|
|
83
|
-
el.title = el.name
|
|
84
|
-
el.key = el.id
|
|
85
|
-
el.expanded = this.anExpandedNode.includes(el.key)
|
|
86
|
-
if (el.children.length > 0) {
|
|
87
|
-
this.setTheValueOfTheNodeRecursively(el.children)
|
|
88
|
-
}
|
|
89
|
-
})
|
|
90
|
-
reslove(array)
|
|
91
|
-
})
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**tree-拖拽 */
|
|
95
|
-
nzEvent(event: NzFormatEmitEvent): void {
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
/**tree-拖拽 -验证*/
|
|
99
|
-
beforeDrop(arg: NzFormatBeforeDropEvent) {
|
|
100
|
-
if (arg.pos === 0 || arg.pos === 1) {
|
|
101
|
-
that._DescriptorService.move(arg.dragNode.key, {
|
|
102
|
-
"parentId": arg.pos === 1 ? (arg.node.parentNode?.key||'') : arg.node.key,
|
|
103
|
-
"order": arg.pos === 1 ? arg.node.origin.order + 1 : arg.node.origin.children.length + 1
|
|
104
|
-
}).subscribe(res => {
|
|
105
|
-
// that.toaster.success("拖拽完成");
|
|
106
|
-
that.getFileGroupList()
|
|
107
|
-
})
|
|
108
|
-
return of(true)
|
|
109
|
-
} else {
|
|
110
|
-
return of(false);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
/**tree--选择节点 */
|
|
115
|
-
activeNode(event) {
|
|
116
|
-
this._theSelectedTreeNode = event.node
|
|
117
|
-
this.nodeClick.emit(event.node)
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
/**判断节点是否选中 */
|
|
121
|
-
isNodeSelected = (el) => el.key === this._theSelectedTreeNode?.key
|
|
122
|
-
|
|
123
|
-
/**点击展开树节点图标触发 */
|
|
124
|
-
nzExpandChange(event) {
|
|
125
|
-
let anExpandedNode = this.anExpandedNode
|
|
126
|
-
if (anExpandedNode.includes(event.node.key)) {
|
|
127
|
-
anExpandedNode = anExpandedNode.filter(key => key !== event.node.key)
|
|
128
|
-
} else {
|
|
129
|
-
anExpandedNode.push(event.node.key)
|
|
130
|
-
}
|
|
131
|
-
this.anExpandedNode = anExpandedNode
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
/**增加分组 */
|
|
136
|
-
addDescriptorBtn(items: any = '', edit = false) {
|
|
137
|
-
this.ModalDescriptorOpen = true
|
|
138
|
-
this.ModalDescriptorForm = this.fb.group({
|
|
139
|
-
containerName: [this._fileContainerName || '', Validators.required],
|
|
140
|
-
name: ['', Validators.required],
|
|
141
|
-
parentId: [items?.key || '', Validators.required],
|
|
142
|
-
})
|
|
143
|
-
/**编辑 */
|
|
144
|
-
if (edit) {
|
|
145
|
-
this.theNodeBeingEdited = items.origin
|
|
146
|
-
this.ModalDescriptorForm.patchValue({
|
|
147
|
-
name: items.origin.name
|
|
148
|
-
})
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**删除分组 */
|
|
153
|
-
deleteDescriptorBtn(node) {
|
|
154
|
-
this._DescriptorService.delete(node.key).subscribe(res => {
|
|
155
|
-
// this.toaster.success(this._LocalizationService.instant(`AbpUi::SuccessfullyDeleted`));
|
|
156
|
-
this.ModalDescriptorOpen = false
|
|
157
|
-
if (this.theNodeBeingEdited.key == node.key) this.theNodeBeingEdited = ''
|
|
158
|
-
this.getFileGroupList()
|
|
159
|
-
})
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
/**分组 */
|
|
165
|
-
/**模态框-状态-是否打开 */
|
|
166
|
-
ModalDescriptorOpen: boolean = false
|
|
167
|
-
|
|
168
|
-
/**模态框-descriptor-繁忙状态-用于确定模态的繁忙状态是否为真 */
|
|
169
|
-
ModalDescriptorBusy: boolean = false
|
|
170
|
-
|
|
171
|
-
/**模态框-descriptor-表单 */
|
|
172
|
-
ModalDescriptorForm: FormGroup | undefined;
|
|
173
|
-
|
|
174
|
-
/**模态框-descriptor-表单--控件模板-动态赋值表单控件 */
|
|
175
|
-
@ViewChild('ModalFormDescriptorSubmit', { static: false }) ModalFormDescriptorSubmit: ElementRef;
|
|
176
|
-
|
|
177
|
-
/**模态框-descriptor-状态改变回调 */
|
|
178
|
-
ModalDescriptorVisibleChange(event) {
|
|
179
|
-
if (!event) {
|
|
180
|
-
this.ModalDescriptorForm = undefined
|
|
181
|
-
this.theNodeBeingEdited = ''
|
|
182
|
-
return
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
/**f分组模态框保存 */
|
|
187
|
-
createOrEditSave() {
|
|
188
|
-
let input = this.ModalDescriptorForm.value
|
|
189
|
-
if (this.theNodeBeingEdited) {
|
|
190
|
-
this._DescriptorService.update(this.theNodeBeingEdited.key, input).subscribe(res => {
|
|
191
|
-
// this.toaster.success("保存成功");
|
|
192
|
-
this.ModalDescriptorOpen = false
|
|
193
|
-
this.getFileGroupList()
|
|
194
|
-
})
|
|
195
|
-
return
|
|
196
|
-
}
|
|
197
|
-
this._DescriptorService.create(input).subscribe(res => {
|
|
198
|
-
// this.toaster.success("保存成功");
|
|
199
|
-
this.ModalDescriptorOpen = false
|
|
200
|
-
this.getFileGroupList()
|
|
201
|
-
})
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
<button class="btn btn-sm btn-primary ms-2" type="button" (click.stop)="ModalOpen = true">{{'FileExplorer::SelectFile' | abpLocalization}}</button>
|
|
2
|
-
<fe-file-modal [(visible)]="ModalOpen" [selectPickerFile]="selectFormFile" (selectFilefn)="_selectFilefn($event)" [fileContainerName]="_fileContainerName"></fe-file-modal>
|
|
3
|
-
<table class="table" *ngIf="_fileShowTable.length>0">
|
|
4
|
-
<thead>
|
|
5
|
-
<tr>
|
|
6
|
-
<th scope="col">{{'FileExplorer::FileName' | abpLocalization}}</th>
|
|
7
|
-
<th scope="col">{{'FileExplorer::FileSize' | abpLocalization}}</th>
|
|
8
|
-
<th scope="col"></th>
|
|
9
|
-
</tr>
|
|
10
|
-
</thead>
|
|
11
|
-
<tbody>
|
|
12
|
-
<ng-container *ngFor="let item of _fileShowTable;let i =index">
|
|
13
|
-
<tr>
|
|
14
|
-
<th scope="row">
|
|
15
|
-
<div>{{item.name}}</div>
|
|
16
|
-
</th>
|
|
17
|
-
<td >{{_FileApiService.formatFileSize(item.size)}}</td>
|
|
18
|
-
<td>
|
|
19
|
-
<button class="btn btn-sm p-0 btn-light " (click.stop)="deleteFileTableItem(i,item)">
|
|
20
|
-
<i class="fas fa-trash p-2"></i>
|
|
21
|
-
</button>
|
|
22
|
-
</td>
|
|
23
|
-
</tr>
|
|
24
|
-
</ng-container>
|
|
25
|
-
</tbody>
|
|
26
|
-
</table>
|
|
27
|
-
|
|
28
|
-
|
|
File without changes
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
2
|
-
|
|
3
|
-
import { FilePickerComponent } from './file-picker.component';
|
|
4
|
-
|
|
5
|
-
describe('FilePickerComponent', () => {
|
|
6
|
-
let component: FilePickerComponent;
|
|
7
|
-
let fixture: ComponentFixture<FilePickerComponent>;
|
|
8
|
-
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
TestBed.configureTestingModule({
|
|
11
|
-
declarations: [FilePickerComponent]
|
|
12
|
-
});
|
|
13
|
-
fixture = TestBed.createComponent(FilePickerComponent);
|
|
14
|
-
component = fixture.componentInstance;
|
|
15
|
-
fixture.detectChanges();
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should create', () => {
|
|
19
|
-
expect(component).toBeTruthy();
|
|
20
|
-
});
|
|
21
|
-
});
|