mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 03:22:19 +03:00
add model-view
Signed-off-by: Andrey Platov <andrey@hardcoreeng.com>
This commit is contained in:
parent
2067013f01
commit
3b71c8720a
@ -14,6 +14,7 @@ specifiers:
|
||||
'@rush-temp/model-all': file:./projects/model-all.tgz
|
||||
'@rush-temp/model-core': file:./projects/model-core.tgz
|
||||
'@rush-temp/model-rig': file:./projects/model-rig.tgz
|
||||
'@rush-temp/model-view': file:./projects/model-view.tgz
|
||||
'@rush-temp/platform': file:./projects/platform.tgz
|
||||
'@rush-temp/platform-rig': file:./projects/platform-rig.tgz
|
||||
'@rush-temp/presentation': file:./projects/presentation.tgz
|
||||
@ -80,6 +81,7 @@ dependencies:
|
||||
'@rush-temp/model-all': file:projects/model-all.tgz_6c259fadfeb3a4b20890aefe87070b8b
|
||||
'@rush-temp/model-core': file:projects/model-core.tgz_6c259fadfeb3a4b20890aefe87070b8b
|
||||
'@rush-temp/model-rig': file:projects/model-rig.tgz_6ab28797e7a22071465f7d680ae81ae5
|
||||
'@rush-temp/model-view': file:projects/model-view.tgz_6c259fadfeb3a4b20890aefe87070b8b
|
||||
'@rush-temp/platform': file:projects/platform.tgz_6c259fadfeb3a4b20890aefe87070b8b
|
||||
'@rush-temp/platform-rig': file:projects/platform-rig.tgz_6ab28797e7a22071465f7d680ae81ae5
|
||||
'@rush-temp/presentation': file:projects/presentation.tgz_c38cf1a7a413db8918b0b4754c21e4c5
|
||||
@ -7954,7 +7956,7 @@ packages:
|
||||
dev: false
|
||||
|
||||
file:projects/model-all.tgz_6c259fadfeb3a4b20890aefe87070b8b:
|
||||
resolution: {integrity: sha512-LvpfR+r7PaQCz/9Hyd3fpNON/ngE+8A78/LML7s2Z56598J9kwI/hvsVEemfBcOrktgix2QTLOWTzNKb8mdb1g==, tarball: file:projects/model-all.tgz}
|
||||
resolution: {integrity: sha512-Ny03qMMno3IlAoJcogi3ExyU1xTKo3tlzjY4TY1Vnu3m+r4UzP93VgP/3TPN5qcSF/9gC6RFVYLeWyXiKXdjxw==, tarball: file:projects/model-all.tgz}
|
||||
id: file:projects/model-all.tgz
|
||||
name: '@rush-temp/model-all'
|
||||
version: 0.0.0
|
||||
@ -8012,6 +8014,23 @@ packages:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
file:projects/model-view.tgz_6c259fadfeb3a4b20890aefe87070b8b:
|
||||
resolution: {integrity: sha512-p41TPHPPPtNlJatDd5UuUunmRUewUcU+/15EUBds6teIXCq5t54VBhkio3qE4SIuIeu9x+vDoKbJg49g1H6xmw==, tarball: file:projects/model-view.tgz}
|
||||
id: file:projects/model-view.tgz
|
||||
name: '@rush-temp/model-view'
|
||||
version: 0.0.0
|
||||
dependencies:
|
||||
'@typescript-eslint/eslint-plugin': 4.28.5_a8e83fcad666e1ba86be4b2e27a20aea
|
||||
eslint: 7.32.0
|
||||
eslint-plugin-import: 2.23.4_eslint@7.32.0
|
||||
eslint-plugin-node: 11.1.0_eslint@7.32.0
|
||||
eslint-plugin-promise: 4.3.1
|
||||
transitivePeerDependencies:
|
||||
- '@typescript-eslint/parser'
|
||||
- supports-color
|
||||
- typescript
|
||||
dev: false
|
||||
|
||||
file:projects/model.tgz_6c259fadfeb3a4b20890aefe87070b8b:
|
||||
resolution: {integrity: sha512-+U81cS6gjuC42PMvI6lh/tICT4o4DpJQZDFCcfDsK0EZRHlhnndytVgRGCmD/KTDv1Nvs7FDSLzsAADGmeP0JA==, tarball: file:projects/model.tgz}
|
||||
id: file:projects/model.tgz
|
||||
|
6
models/view/.eslintrc.js
Normal file
6
models/view/.eslintrc.js
Normal file
@ -0,0 +1,6 @@
|
||||
module.exports = {
|
||||
extends: ['./node_modules/@anticrm/model-rig/profiles/default/config/eslint.config.json'],
|
||||
parserOptions: {
|
||||
project: './tsconfig.json'
|
||||
}
|
||||
}
|
4
models/view/.npmignore
Normal file
4
models/view/.npmignore
Normal file
@ -0,0 +1,4 @@
|
||||
*
|
||||
!/lib/**
|
||||
!CHANGELOG.md
|
||||
/lib/**/__tests__/
|
18
models/view/config/rig.json
Normal file
18
models/view/config/rig.json
Normal file
@ -0,0 +1,18 @@
|
||||
// The "rig.json" file directs tools to look for their config files in an external package.
|
||||
// Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package
|
||||
{
|
||||
"$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json",
|
||||
|
||||
/**
|
||||
* (Required) The name of the rig package to inherit from.
|
||||
* It should be an NPM package name with the "-rig" suffix.
|
||||
*/
|
||||
"rigPackageName": "@anticrm/model-rig"
|
||||
|
||||
/**
|
||||
* (Optional) Selects a config profile from the rig package. The name must consist of
|
||||
* lowercase alphanumeric words separated by hyphens, for example "sample-profile".
|
||||
* If omitted, then the "default" profile will be used."
|
||||
*/
|
||||
// "rigProfile": "your-profile-name"
|
||||
}
|
27
models/view/package.json
Normal file
27
models/view/package.json
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "@anticrm/model-view",
|
||||
"version": "0.6.0",
|
||||
"main": "lib/index.js",
|
||||
"author": "Anticrm Platform Contributors",
|
||||
"license": "EPL-2.0",
|
||||
"scripts": {
|
||||
"build": "heft build",
|
||||
"lint:fix": "eslint --fix src"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@anticrm/model-rig":"~0.6.0",
|
||||
"@typescript-eslint/eslint-plugin":"4",
|
||||
"eslint-plugin-import":"2",
|
||||
"eslint-plugin-promise":"4",
|
||||
"eslint-plugin-node":"11",
|
||||
"eslint":"^7.32.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@anticrm/core": "~0.6.7",
|
||||
"@anticrm/model": "~0.6.0",
|
||||
"@anticrm/platform": "~0.6.3",
|
||||
"@anticrm/ui": "~0.6.0",
|
||||
"@anticrm/view": "~0.6.0",
|
||||
"@anticrm/model-core": "~0.6.0"
|
||||
}
|
||||
}
|
68
models/view/src/index.ts
Normal file
68
models/view/src/index.ts
Normal file
@ -0,0 +1,68 @@
|
||||
//
|
||||
// Copyright © 2020 Anticrm Platform Contributors.
|
||||
//
|
||||
// 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 { IntlString } from '@anticrm/platform'
|
||||
import type { Ref, Class, Space } from '@anticrm/core'
|
||||
import { DOMAIN_MODEL } from '@anticrm/core'
|
||||
import { Model, Mixin, Builder } from '@anticrm/model'
|
||||
import type { AnyComponent } from '@anticrm/ui'
|
||||
import type { ViewletDescriptor, Viewlet, AttributeEditor, AttributePresenter } from '@anticrm/view'
|
||||
|
||||
import core, { TDoc, TClass } from '@anticrm/model-core'
|
||||
|
||||
import view from './plugin'
|
||||
|
||||
@Mixin(view.mixin.AttributeEditor, core.class.Class)
|
||||
export class TAttributeEditor extends TClass implements AttributeEditor {
|
||||
editor!: AnyComponent
|
||||
}
|
||||
|
||||
@Mixin(view.mixin.AttributePresenter, core.class.Class)
|
||||
export class TAttributePresenter extends TClass implements AttributePresenter {
|
||||
presenter!: AnyComponent
|
||||
}
|
||||
|
||||
@Model(view.class.ViewletDescriptor, core.class.Doc, DOMAIN_MODEL)
|
||||
export class TViewletDescriptor extends TDoc implements ViewletDescriptor {
|
||||
component!: AnyComponent
|
||||
}
|
||||
|
||||
@Model(view.class.Viewlet, core.class.Doc, DOMAIN_MODEL)
|
||||
export class TViewlet extends TDoc implements Viewlet {
|
||||
attachTo!: Ref<Class<Space>>
|
||||
descriptor!: Ref<ViewletDescriptor>
|
||||
open!: AnyComponent
|
||||
config: any
|
||||
}
|
||||
|
||||
export function createModel (builder: Builder): void {
|
||||
builder.createModel(TAttributeEditor, TAttributePresenter, TViewletDescriptor, TViewlet)
|
||||
|
||||
builder.mixin(core.class.TypeString, core.class.Class, view.mixin.AttributeEditor, {
|
||||
editor: view.component.StringEditor
|
||||
})
|
||||
|
||||
builder.mixin(core.class.TypeString, core.class.Class, view.mixin.AttributePresenter, {
|
||||
presenter: view.component.StringPresenter
|
||||
})
|
||||
|
||||
builder.createDoc(view.class.ViewletDescriptor, core.space.Model, {
|
||||
label: 'Table' as IntlString,
|
||||
icon: view.icon.Table,
|
||||
component: view.component.TableView
|
||||
}, view.viewlet.Table)
|
||||
}
|
||||
|
||||
export default view
|
27
models/view/src/plugin.ts
Normal file
27
models/view/src/plugin.ts
Normal file
@ -0,0 +1,27 @@
|
||||
//
|
||||
// Copyright © 2020 Anticrm Platform Contributors.
|
||||
//
|
||||
// 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 { mergeIds } from '@anticrm/platform'
|
||||
import type { AnyComponent } from '@anticrm/ui'
|
||||
import view, { viewId } from '@anticrm/view'
|
||||
|
||||
export default mergeIds(viewId, view, {
|
||||
component: {
|
||||
StringEditor: '' as AnyComponent,
|
||||
StringPresenter: '' as AnyComponent,
|
||||
|
||||
TableView: '' as AnyComponent
|
||||
}
|
||||
})
|
8
models/view/tsconfig.json
Normal file
8
models/view/tsconfig.json
Normal file
@ -0,0 +1,8 @@
|
||||
{
|
||||
"extends": "./node_modules/@anticrm/model-rig/profiles/default/tsconfig.json",
|
||||
|
||||
"compilerOptions": {
|
||||
"rootDir": "./src",
|
||||
"outDir": "./lib",
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user