// // Copyright © 2020, 2021 Anticrm Platform Contributors. // Copyright © 2021 Hardcore Engineering Inc. // // 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 // // 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. // // See the License for the specific language governing permissions and // limitations under the License. // import type { Plugin, Asset, Resource, IntlString } from '@anticrm/platform' import { plugin } from '@anticrm/platform' import type { Ref, Mixin, UXObject, Space, FindOptions, Class, Doc, Arr, State, Client, Obj } from '@anticrm/core' import type { AnyComponent, AnySvelteComponent } from '@anticrm/ui' /** * @public */ export interface AttributeEditor extends Class { editor: AnyComponent } /** * @public */ export interface AttributePresenter extends Class { presenter: AnyComponent } /** * @public */ export interface KanbanCard extends Class { card: AnyComponent } /** * @public */ export interface ObjectEditor extends Class { editor: AnyComponent } /** * @public */ export interface ViewletDescriptor extends Doc, UXObject { component: AnyComponent } /** * @public */ export interface Viewlet extends Doc { attachTo: Ref> descriptor: Ref open: AnyComponent options?: FindOptions config: any } /** * @public */ export interface Action extends Doc, UXObject { action: Resource<(doc: Doc) => Promise> } /** * @public */ export interface ActionTarget extends Doc { target: Ref> action: Ref } /** * @public */ export interface Kanban extends Doc { attachedTo: Ref states: Arr> order: Arr> } /** * @public */ export interface Sequence extends Doc { attachedTo: Ref> sequence: number } /** * @public */ export const viewId = 'view' as Plugin /** * @public */ export type BuildModelKey = string | { presenter: AnyComponent label: string } /** * @public */ export interface AttributeModel { key: string label: IntlString _class: Ref> presenter: AnySvelteComponent // Extra properties for component props?: Record } /** * @public */ export interface BuildModelOptions { client: Client _class: Ref> keys: BuildModelKey[] options?: FindOptions ignoreMissing?: boolean } export default plugin(viewId, { mixin: { AttributeEditor: '' as Ref>, AttributePresenter: '' as Ref>, KanbanCard: '' as Ref>, ObjectEditor: '' as Ref> }, class: { ViewletDescriptor: '' as Ref>, Viewlet: '' as Ref>, Action: '' as Ref>, ActionTarget: '' as Ref>, Kanban: '' as Ref>, Sequence: '' as Ref> }, viewlet: { Table: '' as Ref, Kanban: '' as Ref }, space: { Sequence: '' as Ref }, icon: { Table: '' as Asset, Kanban: '' as Asset, Delete: '' as Asset, Move: '' as Asset } })