2021-12-06 10:07:08 +00:00
|
|
|
//
|
2021-09-27 08:06:05 +00:00
|
|
|
// Copyright © 2020, 2021 Anticrm Platform Contributors.
|
|
|
|
// Copyright © 2021 Hardcore Engineering Inc.
|
2021-12-06 10:07:08 +00:00
|
|
|
//
|
2021-09-27 08:06:05 +00:00
|
|
|
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License. You may
|
|
|
|
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
|
2021-12-06 10:07:08 +00:00
|
|
|
//
|
2021-09-27 08:06:05 +00:00
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
2021-12-06 10:07:08 +00:00
|
|
|
//
|
2021-09-27 08:06:05 +00:00
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
2021-12-06 10:07:08 +00:00
|
|
|
//
|
2021-09-27 08:06:05 +00:00
|
|
|
|
2022-03-01 03:32:18 +00:00
|
|
|
import type { AttachedDoc, Class, Doc, Ref, Space } from '@anticrm/core'
|
2021-12-06 10:07:08 +00:00
|
|
|
import type { Asset, Plugin } from '@anticrm/platform'
|
2022-03-01 03:32:18 +00:00
|
|
|
import { IntlString, plugin, Resource } from '@anticrm/platform'
|
2022-04-25 13:44:43 +00:00
|
|
|
import type { Preference } from '@anticrm/preference'
|
2021-12-06 10:07:08 +00:00
|
|
|
import { AnyComponent } from '@anticrm/ui'
|
2021-10-23 16:48:22 +00:00
|
|
|
|
2021-12-06 10:07:08 +00:00
|
|
|
/**
|
|
|
|
* @public
|
|
|
|
*/
|
|
|
|
export interface Attachment extends AttachedDoc {
|
|
|
|
name: string
|
|
|
|
file: string
|
|
|
|
size: number
|
|
|
|
type: string
|
|
|
|
lastModified: number
|
|
|
|
}
|
2021-09-27 08:06:05 +00:00
|
|
|
|
2022-01-14 09:20:31 +00:00
|
|
|
/**
|
|
|
|
* @public
|
|
|
|
*/
|
|
|
|
export interface Photo extends Attachment {}
|
|
|
|
|
2022-04-25 13:44:43 +00:00
|
|
|
/**
|
|
|
|
* @public
|
|
|
|
*/
|
|
|
|
export interface SavedAttachments extends Preference {
|
|
|
|
attachedTo: Ref<Attachment>
|
|
|
|
}
|
|
|
|
|
2021-12-06 10:07:08 +00:00
|
|
|
/**
|
|
|
|
* @public
|
|
|
|
*/
|
|
|
|
export const attachmentId = 'attachment' as Plugin
|
2021-09-27 08:06:05 +00:00
|
|
|
|
2021-12-06 10:07:08 +00:00
|
|
|
export default plugin(attachmentId, {
|
|
|
|
component: {
|
2022-01-14 09:20:31 +00:00
|
|
|
Attachments: '' as AnyComponent,
|
2022-03-01 03:32:18 +00:00
|
|
|
Photos: '' as AnyComponent,
|
|
|
|
AttachmentsPresenter: '' as AnyComponent
|
2021-12-06 10:07:08 +00:00
|
|
|
},
|
|
|
|
icon: {
|
2022-04-23 02:40:38 +00:00
|
|
|
Attachment: '' as Asset,
|
|
|
|
FileBrowser: '' as Asset
|
2021-12-06 10:07:08 +00:00
|
|
|
},
|
|
|
|
class: {
|
2022-01-14 09:20:31 +00:00
|
|
|
Attachment: '' as Ref<Class<Attachment>>,
|
2022-04-25 13:44:43 +00:00
|
|
|
Photo: '' as Ref<Class<Photo>>,
|
|
|
|
SavedAttachments: '' as Ref<Class<SavedAttachments>>
|
2022-01-12 09:52:22 +00:00
|
|
|
},
|
|
|
|
helper: {
|
2022-01-20 09:27:41 +00:00
|
|
|
UploadFile: '' as Resource<(file: File, opts?: { space: Ref<Space>, attachedTo: Ref<Doc> }) => Promise<string>>,
|
2022-01-14 09:09:01 +00:00
|
|
|
DeleteFile: '' as Resource<(id: string) => Promise<void>>
|
2022-03-01 03:32:18 +00:00
|
|
|
},
|
|
|
|
string: {
|
2022-04-14 12:42:25 +00:00
|
|
|
Files: '' as IntlString,
|
|
|
|
NoFiles: '' as IntlString,
|
2022-04-23 02:40:38 +00:00
|
|
|
NoParticipants: '' as IntlString,
|
2022-04-27 08:47:29 +00:00
|
|
|
ShowMoreAttachments: '' as IntlString,
|
|
|
|
FileBrowserDateFilterAny: '' as IntlString,
|
|
|
|
FileBrowserDateFilterToday: '' as IntlString,
|
|
|
|
FileBrowserDateFilterYesterday: '' as IntlString,
|
|
|
|
FileBrowserDateFilter7Days: '' as IntlString,
|
|
|
|
FileBrowserDateFilter30Days: '' as IntlString,
|
|
|
|
FileBrowserDateFilter3Months: '' as IntlString,
|
|
|
|
FileBrowserDateFilter12Months: '' as IntlString,
|
|
|
|
FileBrowserTypeFilterAny: '' as IntlString,
|
|
|
|
FileBrowserTypeFilterImages: '' as IntlString,
|
|
|
|
FileBrowserTypeFilterAudio: '' as IntlString,
|
|
|
|
FileBrowserTypeFilterVideos: '' as IntlString,
|
2022-04-28 18:15:24 +00:00
|
|
|
FileBrowserTypeFilterPDFs: '' as IntlString,
|
|
|
|
DeleteFile: '' as IntlString
|
2021-12-06 10:07:08 +00:00
|
|
|
}
|
|
|
|
})
|