2021-08-07 14:49:14 +00:00
|
|
|
//
|
|
|
|
// Copyright © 2020 Anticrm Platform Contributors.
|
2021-12-02 13:12:16 +00:00
|
|
|
//
|
2021-08-07 14:49:14 +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-02 13:12:16 +00:00
|
|
|
//
|
2021-08-07 14:49:14 +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-02 13:12:16 +00:00
|
|
|
//
|
2021-08-07 14:49:14 +00:00
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
//
|
|
|
|
|
2021-12-13 09:05:46 +00:00
|
|
|
import type { Doc } from '@anticrm/core'
|
2021-12-02 13:12:16 +00:00
|
|
|
import { Resources } from '@anticrm/platform'
|
|
|
|
import { getClient, MessageBox } from '@anticrm/presentation'
|
|
|
|
import { showPopup } from '@anticrm/ui'
|
2021-10-04 19:18:23 +00:00
|
|
|
import BooleanEditor from './components/BooleanEditor.svelte'
|
2021-11-22 10:55:52 +00:00
|
|
|
import BooleanPresenter from './components/BooleanPresenter.svelte'
|
2021-12-02 09:09:37 +00:00
|
|
|
import DateEditor from './components/DateEditor.svelte'
|
|
|
|
import DatePresenter from './components/DatePresenter.svelte'
|
2021-12-02 13:12:16 +00:00
|
|
|
import StringEditor from './components/StringEditor.svelte'
|
|
|
|
import StringPresenter from './components/StringPresenter.svelte'
|
2022-03-18 06:37:49 +00:00
|
|
|
import IntlStringPresenter from './components/IntlStringPresenter.svelte'
|
2022-02-16 09:02:31 +00:00
|
|
|
import NumberEditor from './components/NumberEditor.svelte'
|
|
|
|
import NumberPresenter from './components/NumberPresenter.svelte'
|
2021-12-02 13:12:16 +00:00
|
|
|
import Table from './components/Table.svelte'
|
|
|
|
import TableView from './components/TableView.svelte'
|
|
|
|
import TimestampPresenter from './components/TimestampPresenter.svelte'
|
2021-12-06 09:16:04 +00:00
|
|
|
import { deleteObject } from './utils'
|
2021-12-13 09:05:46 +00:00
|
|
|
import MoveView from './components/Move.svelte'
|
2022-01-18 10:21:32 +00:00
|
|
|
import EditDoc from './components/EditDoc.svelte'
|
|
|
|
import RolePresenter from './components/RolePresenter.svelte'
|
2022-01-19 09:04:30 +00:00
|
|
|
import ObjectPresenter from './components/ObjectPresenter.svelte'
|
2022-02-07 09:21:32 +00:00
|
|
|
import HTMLPresenter from './components/HTMLPresenter.svelte'
|
2022-02-16 09:02:31 +00:00
|
|
|
import ColorsPopup from './components/ColorsPopup.svelte'
|
2022-03-04 09:02:13 +00:00
|
|
|
import view from './plugin'
|
2021-08-07 14:49:14 +00:00
|
|
|
|
2021-12-02 13:12:16 +00:00
|
|
|
export { default as ContextMenu } from './components/Menu.svelte'
|
2022-02-16 09:02:31 +00:00
|
|
|
export { buildModel, getActions, getObjectPresenter, LoadingProps, getCollectionCounter } from './utils'
|
|
|
|
export { Table, TableView, EditDoc, ColorsPopup }
|
2021-10-13 08:38:35 +00:00
|
|
|
|
2021-12-02 13:12:16 +00:00
|
|
|
function Delete (object: Doc): void {
|
2021-12-13 09:05:46 +00:00
|
|
|
showPopup(
|
|
|
|
MessageBox,
|
|
|
|
{
|
2022-03-04 09:02:13 +00:00
|
|
|
label: view.string.DeleteObject,
|
|
|
|
message: view.string.DeleteObjectConfirm
|
2021-12-13 09:05:46 +00:00
|
|
|
},
|
|
|
|
undefined,
|
2022-01-19 09:04:30 +00:00
|
|
|
(result?: boolean) => {
|
|
|
|
if (result === true) {
|
|
|
|
deleteObject(getClient(), object).catch(err => console.error(err))
|
2021-12-13 09:05:46 +00:00
|
|
|
}
|
2021-10-13 09:06:35 +00:00
|
|
|
}
|
2021-12-13 09:05:46 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
async function Move (object: Doc): Promise<void> {
|
|
|
|
showPopup(MoveView, { object })
|
2021-09-25 16:48:22 +00:00
|
|
|
}
|
|
|
|
|
2021-12-02 13:12:16 +00:00
|
|
|
export default async (): Promise<Resources> => ({
|
2021-09-25 16:48:22 +00:00
|
|
|
actionImpl: {
|
2021-12-23 15:01:11 +00:00
|
|
|
Delete: Delete,
|
|
|
|
Move: Move
|
2021-09-25 16:48:22 +00:00
|
|
|
},
|
2021-08-07 14:49:14 +00:00
|
|
|
component: {
|
|
|
|
StringEditor,
|
|
|
|
StringPresenter,
|
2022-02-16 09:02:31 +00:00
|
|
|
NumberEditor,
|
|
|
|
NumberPresenter,
|
2021-11-22 10:55:52 +00:00
|
|
|
BooleanPresenter,
|
2021-10-04 19:18:23 +00:00
|
|
|
BooleanEditor,
|
2021-09-06 08:40:20 +00:00
|
|
|
TableView,
|
2021-12-02 09:09:37 +00:00
|
|
|
TimestampPresenter,
|
|
|
|
DateEditor,
|
2022-01-18 10:21:32 +00:00
|
|
|
DatePresenter,
|
2022-01-19 09:04:30 +00:00
|
|
|
RolePresenter,
|
2022-02-04 09:03:24 +00:00
|
|
|
ObjectPresenter,
|
2022-02-07 09:21:32 +00:00
|
|
|
EditDoc,
|
2022-03-18 06:37:49 +00:00
|
|
|
HTMLPresenter,
|
|
|
|
IntlStringPresenter
|
2021-11-18 12:48:05 +00:00
|
|
|
}
|
2021-08-07 14:49:14 +00:00
|
|
|
})
|