diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 31b32699c5..5016204837 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -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 diff --git a/models/view/.eslintrc.js b/models/view/.eslintrc.js new file mode 100644 index 0000000000..1375671262 --- /dev/null +++ b/models/view/.eslintrc.js @@ -0,0 +1,6 @@ +module.exports = { + extends: ['./node_modules/@anticrm/model-rig/profiles/default/config/eslint.config.json'], + parserOptions: { + project: './tsconfig.json' + } +} \ No newline at end of file diff --git a/models/view/.npmignore b/models/view/.npmignore new file mode 100644 index 0000000000..e3ec093c38 --- /dev/null +++ b/models/view/.npmignore @@ -0,0 +1,4 @@ +* +!/lib/** +!CHANGELOG.md +/lib/**/__tests__/ diff --git a/models/view/config/rig.json b/models/view/config/rig.json new file mode 100644 index 0000000000..e9a9ee9add --- /dev/null +++ b/models/view/config/rig.json @@ -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" +} diff --git a/models/view/package.json b/models/view/package.json new file mode 100644 index 0000000000..952ee171ef --- /dev/null +++ b/models/view/package.json @@ -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" + } +} diff --git a/models/view/src/index.ts b/models/view/src/index.ts new file mode 100644 index 0000000000..50052ac831 --- /dev/null +++ b/models/view/src/index.ts @@ -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> + descriptor!: Ref + 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 diff --git a/models/view/src/plugin.ts b/models/view/src/plugin.ts new file mode 100644 index 0000000000..1e538734ab --- /dev/null +++ b/models/view/src/plugin.ts @@ -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 + } +}) diff --git a/models/view/tsconfig.json b/models/view/tsconfig.json new file mode 100644 index 0000000000..1d60db76b4 --- /dev/null +++ b/models/view/tsconfig.json @@ -0,0 +1,8 @@ +{ + "extends": "./node_modules/@anticrm/model-rig/profiles/default/tsconfig.json", + + "compilerOptions": { + "rootDir": "./src", + "outDir": "./lib", + } +} \ No newline at end of file diff --git a/rush.json b/rush.json index edea9a49ba..281876674f 100644 --- a/rush.json +++ b/rush.json @@ -571,5 +571,10 @@ "projectFolder": "models/all", "shouldPublish": true }, + { + "packageName": "@anticrm/model-view", + "projectFolder": "models/view", + "shouldPublish": true + }, ] }