diff --git a/packages/core/src/create-plugin/constant/plugin-list.ts b/packages/core/src/create-plugin/constant/plugin-list.ts index 909f5c5d27fb578fe08a24490db9354ba069fc52..6211b1d0998b7d23b9fdb91238fa322d5c794b80 100644 --- a/packages/core/src/create-plugin/constant/plugin-list.ts +++ b/packages/core/src/create-plugin/constant/plugin-list.ts @@ -3,9 +3,9 @@ import { IPluginType } from '../interface'; export const PluginList: IPluginType[] = [ { name: 'AC_ITEM', caption: '自填列表项绘制插件' }, { name: 'CHART_RENDER', caption: '图表绘制插件' }, - { name: 'CHART_AXISRENDER', caption: '图表坐标轴绘制插件' }, - { name: 'CHART_SERIESRENDER', caption: '图表序列绘制插件' }, - { name: 'CHART_CSRENDER', caption: '图表坐标系组件绘制插件' }, + // { name: 'CHART_AXISRENDER', caption: '图表坐标轴绘制插件' }, 未支持 + // { name: 'CHART_SERIESRENDER', caption: '图表序列绘制插件' }, 未支持 + // { name: 'CHART_CSRENDER', caption: '图表坐标系组件绘制插件' }, 未支持 { name: 'CUSTOM', caption: '自定义部件绘制插件' }, { name: 'DATAVIEW_ITEM', caption: '数据视图项绘制插件' }, { name: 'DATAVIEW_RENDER', caption: '数据视图绘制插件' }, diff --git a/packages/core/src/create-plugin/template/platform/ac_item/README.md b/packages/core/src/create-plugin/template/platform/ac_item/README.md index d13e9ff562504f097f42b668ad911e287620da6f..2aa47b1e97d6d34b72fc8b50359f898bee3779e2 100644 --- a/packages/core/src/create-plugin/template/platform/ac_item/README.md +++ b/packages/core/src/create-plugin/template/platform/ac_item/README.md @@ -1,93 +1,13 @@ # 自填列表项插件 -## 新建自填列表项绘制插件 - -新建自填列表项绘制插件,这儿唯一需要注意一点的是,运行时插件模式同时支持远程运行时插件,在实际运用的时候需根据当前项目所选择的插件模式来定义。详情参见 [运行时插件模式](./RUNTIME-PLUGIN-MODE.md) 篇。 - - - -## 在对应的实体自填模式上绑定插件 - - - -## 在对应的编辑器上绑定上一步配置的实体自填模式 - - - -## 插件机制 - -编辑器在绘制具体的项时,会先通过编辑器模型拿到对应的自填列表项适配器,若适配器存在,则绘制适配器component属性绑定的组件,否则根据编辑器内部逻辑进行绘制。详情如下: - -```tsx -// 绘制自填列表项 -const itemContent = (item: IData) => { - const panel = this.c.deACMode?.itemLayoutPanel; - const { context, params } = this.c; - let selected = item[this.c.textName] || item.srfmajortext === this.curValue; - if (this.c.valueItem) { - selected = - (item[this.c.keyName] || item.srfkey) === this.data[this.c.valueItem]; - } - const className = [ - this.ns.is('active', selected), - this.ns.e('transfer-item'), - ]; - if (this.c.acItemProvider) { - const component = resolveComponent(this.c.acItemProvider.component); - return h(component, { - item, - controller: this.c, - class: className, - onClick: () => { - this.onACSelect(item); - }, - }); - } - return panel ? ( - { - this.onACSelect(item); - }} - > - ) : ( -
{ - this.onACSelect(item); - }} - > - {item[this.c.textName]} -
- ); -}; -``` - -## 插件示例 - -### 插件效果 - -#### 使用插件前 - - - -#### 使用插件后 - - - -### 插件结构 +## 插件结构 ``` -|─ ─ ac-item 自填列表项插件顶层目录,可根据实际业务命名 +|─ ─ {{pluginName}} 自填列表项插件顶层目录 |─ ─ src 自填列表项插件源代码目录 -​ |─ ─ ac-item-plugin.provider.ts 自填列表项插件适配器 -​ |─ ─ ac-item-plugin.scss 自填列表项插件样式 -​ |─ ─ ac-item-plugin.tsx 自填列表项插件组件 +​ |─ ─ {{pluginName}}.provider.ts 自填列表项插件适配器 +​ |─ ─ {{pluginName}}.scss 自填列表项插件样式 +​ |─ ─ {{pluginName}}.tsx 自填列表项插件组件 ​ |─ ─ index.ts 自填列表项插件入口文件 ``` @@ -95,25 +15,6 @@ const itemContent = (item: IData) => { 自填列表项插件入口文件会全局注册自填列表项适配器和自填列表项插件组件,供外部使用。 -```typescript -import { App } from 'vue'; -import { registerAcItemProvider } from '@ibiz-template/runtime'; -import { AcItemPlugin } from './ac-item-plugin'; -import { AcItemPluginProvider } from './ac-item-plugin.provider'; - -export default { - install(app: App) { - // 全局注册自填列表项插件组件 - app.component(AcItemPlugin.name!, AcItemPlugin); - // 全局注册自填列表项适配器,AC_ITEM是插件类型,R9AcItemPluginId是插件标识 - registerAcItemProvider( - 'AC_ITEM_R9AcItemPluginId', - () => new AcItemPluginProvider(), - ); - }, -}; -``` - ### 自填列表项插件组件 自填列表项插件组件使用tsx的书写方式,承载自填列表项绘制的内容,可根据需求自定义内容呈现。 diff --git a/packages/core/src/create-plugin/template/platform/ac_item/RUNTIME-PLUGIN-MODE.md b/packages/core/src/create-plugin/template/platform/ac_item/RUNTIME-PLUGIN-MODE.md deleted file mode 100644 index dbe8a2b8aeeecb3d044d6a44a2ba70f24afe1ed1..0000000000000000000000000000000000000000 --- a/packages/core/src/create-plugin/template/platform/ac_item/RUNTIME-PLUGIN-MODE.md +++ /dev/null @@ -1,74 +0,0 @@ -# 运行时插件模式 - -| 插件模式 | 是否已支持 | -| :------------: | :--------: | -| 非运行时插件 | 是 | -| 本地运行时插件 | 否 | -| 远程运行时插件 | 是 | - -## 非运行时插件 - -非运行时插件与主项目一起编译打包,主项目中可以直接引用该插件,并且通过vue插件的形式挂载。 - -```typescript -import { App } from 'vue'; -import plugin from '@ibiz-template-plugin-example/example-one'; - -// 挂载插件 -export default { - install(app: App): void { - app.use(plugin); - }, -}; -``` - -## 远程运行时插件 - -远程运行时插件单独部署在cdn上。主项目中不能直接引用该插件,在使用到时才会去远程加载该插件。cdn请求基础路径pluginBaseUrl可在environment.js中配置。运行时插件仓库配置填写需参照[unpkg规范](https://unpkg.com); - -```typescript -// 加载远程插件 -async loadPluginRef( - rtObjectName: string, - rtObjectRepo: string, - ): Promise { - if (this.isIgnore(rtObjectRepo)) { - return true; - } - if (this.pluginCache.has(rtObjectName)) { - return true; - } - let configData: unknown = null; - { - const pluginPath: string = rtObjectRepo; - const configUrl = this.urlReg.test(pluginPath) - ? `${pluginPath}/package.json` - : `${ibiz.env.pluginBaseUrl}/${join(pluginPath, 'package.json')}`; - const res = await ibiz.net.axios({ - method: 'get', - headers: { 'Access-Control-Allow-Origin': '*' }, - url: configUrl, - }); - if (res.status !== 200) { - throw new Error(`配置加载失败`); - } - configData = res.data; - } - const remotePlugin = new RemotePluginItem( - rtObjectName, - rtObjectRepo, - configData as RemotePluginConfig, - ); - if (remotePlugin) { - await this.loadPluginExternal(remotePlugin.config); - try { - await this.loadScript(remotePlugin); - this.pluginCache.set(rtObjectName, remotePlugin); - return true; - } catch (error) { - ibiz.log.error(error); - } - } - return false; - } -``` diff --git a/packages/core/src/create-plugin/template/platform/ac_item/package.json b/packages/core/src/create-plugin/template/platform/ac_item/package.json index 09acb5215002c31c68eefbde3b3ea86c46a33049..b89f541dca6c061575c2f2e85648e53bb5e2e515 100644 --- a/packages/core/src/create-plugin/template/platform/ac_item/package.json +++ b/packages/core/src/create-plugin/template/platform/ac_item/package.json @@ -15,7 +15,6 @@ "files": [ "dist", "public", - "RUNTIME-PLUGIN-MODE.md", "CHANGELOG.md", "README.md" ], @@ -35,20 +34,52 @@ "@ibiz-template/theme": "^0.7.39", "@ibiz-template/vue3-util": "0.7.40-alpha.13", "@ibiz/model-core": "^0.1.71", + "@qx-chitanda/vite-plugin-lib-legacy": "^4.1.1", "@types/lodash-es": "^4.17.12", "@types/ramda": "^0.29.6", + "@typescript-eslint/eslint-plugin": "^6.11.0", + "@typescript-eslint/parser": "^6.11.0", + "@vitejs/plugin-vue": "^4.4.1", + "@vitejs/plugin-vue-jsx": "^3.0.2", "async-validator": "^4.2.5", "axios": "^1.6.2", "dayjs": "^1.11.10", "element-plus": "^2.4.2", + "eslint": "^8.53.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-import": "^2.29.0", + "eslint-plugin-prettier": "^5.0.1", + "eslint-plugin-unused-imports": "^3.0.0", + "eslint-plugin-vue": "^9.18.1", + "husky": "^8.0.3", + "lerna": "^8.0.0", + "lint-staged": "^15.1.0", "lodash-es": "^4.17.21", "pluralize": "^8.0.0", + "postcss": "^8.4.31", + "prettier": "^3.1.0", "qs": "^6.11.2", "qx-util": "^0.4.8", "ramda": "^0.29.1", + "rollup-plugin-visualizer": "^5.9.2", + "sass": "1.69.5", + "stylelint": "15.11.0", + "stylelint-config-prettier": "^9.0.5", + "stylelint-config-recess-order": "^4.3.0", + "stylelint-config-standard": "^34.0.0", + "stylelint-config-standard-scss": "^11.1.0", + "stylelint-scss": "5.3.1", + "terser": "^5.24.0", + "typescript": "5.2.2", + "vite": "^4.5.0", + "vite-plugin-dts": "^3.6.3", + "vite-plugin-eslint": "^1.8.1", "vite-plugin-libcss": "^1.1.1", "vue": "^3.3.8", + "vue-eslint-parser": "^9.3.2", "vue-router": "^4.2.5", + "vue-tsc": "1.8.22", "vuedraggable": "^4.1.0" }, "peerDependencies": { diff --git a/packages/core/src/create-plugin/template/platform/ac_item/public/docs/image.png b/packages/core/src/create-plugin/template/platform/ac_item/public/docs/image.png deleted file mode 100644 index 8341d3f73edbeffbb96ff3bb4e7a84cf949f5acf..0000000000000000000000000000000000000000 Binary files a/packages/core/src/create-plugin/template/platform/ac_item/public/docs/image.png and /dev/null differ diff --git a/packages/core/src/create-plugin/template/platform/ac_item/public/docs/image2.png b/packages/core/src/create-plugin/template/platform/ac_item/public/docs/image2.png deleted file mode 100644 index b7d3b6c9316c2dad14ddc2cb03a129b1941e1040..0000000000000000000000000000000000000000 Binary files a/packages/core/src/create-plugin/template/platform/ac_item/public/docs/image2.png and /dev/null differ diff --git a/packages/core/src/create-plugin/template/platform/ac_item/public/docs/image3.png b/packages/core/src/create-plugin/template/platform/ac_item/public/docs/image3.png deleted file mode 100644 index aab12d3f846a82bf071e517717708dba1a62020c..0000000000000000000000000000000000000000 Binary files a/packages/core/src/create-plugin/template/platform/ac_item/public/docs/image3.png and /dev/null differ diff --git a/packages/core/src/create-plugin/template/platform/ac_item/public/docs/image4.png b/packages/core/src/create-plugin/template/platform/ac_item/public/docs/image4.png deleted file mode 100644 index c21f56e54effcb2d7a8829e3b2d8d05ba99dd711..0000000000000000000000000000000000000000 Binary files a/packages/core/src/create-plugin/template/platform/ac_item/public/docs/image4.png and /dev/null differ diff --git a/packages/core/src/create-plugin/template/platform/ac_item/public/docs/image5.png b/packages/core/src/create-plugin/template/platform/ac_item/public/docs/image5.png deleted file mode 100644 index 82ce9451c383e3ab3924c1b8e08e057f7e92bcad..0000000000000000000000000000000000000000 Binary files a/packages/core/src/create-plugin/template/platform/ac_item/public/docs/image5.png and /dev/null differ diff --git a/packages/core/src/create-plugin/template/platform/chart_render/.eslintrc.cjs b/packages/core/src/create-plugin/template/platform/chart_render/.eslintrc.cjs new file mode 100644 index 0000000000000000000000000000000000000000..c6e5a1dd5b2fa946548b00254225469f2f15bee9 --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/chart_render/.eslintrc.cjs @@ -0,0 +1,52 @@ +module.exports = { + root: true, + env: { + browser: true, + es2021: true, + }, + extends: ['airbnb-base', 'prettier', 'plugin:@typescript-eslint/recommended'], + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + }, + plugins: ['prettier', '@typescript-eslint', 'unused-imports'], + rules: { + 'prettier/prettier': 'error', + 'arrow-body-style': 'off', + 'prefer-arrow-callback': 'off', + 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', + 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', + 'no-new': [0], + 'no-continue': [0], + '@typescript-eslint/no-empty-interface': 'off', + 'no-use-before-define': [0], + 'no-restricted-syntax': [0], + 'no-empty-function': [0], + 'no-useless-constructor': [0], // 禁止空的构造函数 + 'no-param-reassign': [0], // 禁止修改传入函数的参数 + 'no-underscore-dangle': [0], // 禁止使用下划线开头的变量名 + 'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], // 禁止使用 ++,-- + 'consistent-return': [0], // 函数可以有不同类型返回值 + 'class-methods-use-this': [0], // 方法内未使用此方法时,强制定义为静态方法 + 'import/prefer-default-export': [0], // 一个模块只能有默认导出,不可以有多个导出 + 'import/no-unresolved': [0], // 不允许未解决的模块 + 'import/extensions': [0], // 不允许导入文件时不带后缀 + 'unused-imports/no-unused-imports': 'error', + '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], + '@typescript-eslint/no-inferrable-types': [0], + '@typescript-eslint/no-non-null-assertion': [0], + '@typescript-eslint/no-explicit-any': ['error'], + '@typescript-eslint/explicit-function-return-type': 'error', // 要求函数和类方法的显式返回类型 + '@typescript-eslint/explicit-module-boundary-types': 'error', // 要求导出函数和类的公共类方法的显式返回和参数类型 + 'import/no-extraneous-dependencies': [ + 0, + { + devDependencies: true, + peerDependencies: true, + // optionalDependencies: true, + // bundledDependencies: true + }, + ], + }, +}; diff --git a/packages/core/src/create-plugin/template/platform/chart_render/CHANGELOG.md b/packages/core/src/create-plugin/template/platform/chart_render/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..8ac8e7f05d173977a1ad060d18e7f0b6a5f23cf5 --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/chart_render/CHANGELOG.md @@ -0,0 +1,3 @@ +# 版本变更日志 + +添加变更日志 \ No newline at end of file diff --git a/packages/core/src/create-plugin/template/platform/chart_render/README.md b/packages/core/src/create-plugin/template/platform/chart_render/README.md new file mode 100644 index 0000000000000000000000000000000000000000..91ca028d21309a921372bcea34ddc59bdfa15b21 --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/chart_render/README.md @@ -0,0 +1,67 @@ +# 部件插件 + +## 插件结构 + +``` +|─ ─ {{pluginName}} 部件插件顶层目录 + |─ ─ src 部件插件源代码目录 +​ |─ ─ {{pluginName}}.controller.ts 部件插件控制器 +​ |─ ─ {{pluginName}}.provider.ts 部件插件适配器 +​ |─ ─ {{pluginName}}.scss 部件插件样式 +​ |─ ─ {{pluginName}}.tsx 部件插件组件 +​ |─ ─ index.ts 部件插件入口文件 +``` + +### 部件插件入口文件 + +部件插件入口文件会全局注册部件适配器和部件插件组件,供外部使用。 + +### 部件插件组件 + +部件插件组件使用tsx的书写方式,承载部件绘制的内容,可拷贝基础UI绘制,然后根据需求进行调整。其中,基础UI绘制可参考附录中UI呈现部分。 + +### 部件插件适配器 + +部件插件适配器主要通过component属性指定部件实际要绘制的组件,并且通过createController方法返回传递给部件的控制器。 + +### 部件插件控制器 + +部件插件控制器可继承基础控制器,然后根据需求进行调整。其中,基础控制器可参考附录中控制器部分。 + +## 附录 + +| 部件类型 | UI呈现 | 控制器 | +| :----------------: | :--------------------: | :-----------------------: | +| 应用菜单 | AppMenuControl | AppMenuController | +| 应用菜单(图标视图) | AppMenuIconViewControl | AppMenuIconViewController | +| 日历 | CalendarControl | CalendarController | +| 标题栏 | CaptionBarControl | CaptionBarController | +| 图表 | ChartControl | ChartController | +| 上下文菜单 | ContextMenuControl | ContextMenuController | +| 数据看板 | DashboardControl | DashboardController | +| 卡片 | DataViewControl | DataViewControlController | +| 数据关系栏 | DRBarControl | DRBarController | +| 数据关系分页 | DRTabControl | DRTabController | +| 日历导航栏 | CalendarExpBarControl | CalendarExpBarController | +| 图表导航栏 | ChartExpBarControl | ChartExpBarController | +| 卡片导航栏 | DataViewExpBarControl | ExpBarControlController | +| 表格导航栏 | GridExpBarControl | ExpBarControlController | +| 列表导航栏 | ListExpBarControl | ExpBarControlController | +| 树导航栏 | TreeExpBarControl | TreeExpBarController | +| 编辑表单 | EditFormControl | EditFormController | +| 搜索表单 | SearchFormControl | SearchFormController | +| 甘特图 | GanttControl | GanttController | +| 表格 | GridControl | GridController | +| 看板 | KanbanControl | KanbanController | +| 列表 | ListControl | ListController | +| 地图 | MapControl | MapController | +| 多编辑视图面板 | MEditViewPanelControl | MEditViewPanelController | +| 选择视图面板 | PickupViewPanelControl | PickupViewPanelController | +| 报表面板 | ReportPanelControl | ReportPanelController | +| 搜索栏 | SearchBarControl | SearchBarController | +| 分页导航面板 | TabExpPanelControl | TabExpPanelController | +| 工具栏 | ToolbarControl | ToolbarController | +| 树 | TreeControl | TreeController | +| 树表格 | TreeGridControl | TreeGridController | +| 树表格(增强) | TreeGridExControl | TreeGridExController | +| 向导面板 | WizardPanelControl | WizardPanelController | diff --git a/packages/core/src/create-plugin/template/platform/chart_render/package.json b/packages/core/src/create-plugin/template/platform/chart_render/package.json new file mode 100644 index 0000000000000000000000000000000000000000..9d91bb1fd3085001f191e80f53cd6dbddc3ee9c9 --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/chart_render/package.json @@ -0,0 +1,106 @@ +{ + "name": "{{pluginGroup}}/{{pluginName}}", + "version": "0.0.1", + "description": "{{pluginDescription}}", + "author": "tony001", + "license": "MIT", + "type": "module", + "main": "dist/index.es.js", + "module": "dist/index.es.js", + "types": "dist/types/index.d.ts", + "system": "dist/index.legacy.js", + "styles": [ + "dist/style.css" + ], + "files": [ + "dist", + "public", + "CHANGELOG.md", + "README.md" + ], + "publishConfig": { + "registry": "https://registry.npmjs.org/" + }, + "scripts": { + "dev": "vite build --watch", + "build": "vue-tsc --noEmit && vite build", + "preview": "vite preview" + }, + "devDependencies": { + "@floating-ui/dom": "^1.5.3", + "@ibiz-template/core": "0.7.40-alpha.13", + "@ibiz-template/model-helper": "0.7.40-alpha.13", + "@ibiz-template/runtime": "0.7.40-alpha.13", + "@ibiz-template/theme": "^0.7.39", + "@ibiz-template/vue3-util": "0.7.40-alpha.13", + "@ibiz/model-core": "^0.1.71", + "@qx-chitanda/vite-plugin-lib-legacy": "^4.1.1", + "@types/lodash-es": "^4.17.12", + "@types/ramda": "^0.29.6", + "@typescript-eslint/eslint-plugin": "^6.11.0", + "@typescript-eslint/parser": "^6.11.0", + "@vitejs/plugin-vue": "^4.4.1", + "@vitejs/plugin-vue-jsx": "^3.0.2", + "async-validator": "^4.2.5", + "axios": "^1.6.2", + "dayjs": "^1.11.10", + "element-plus": "^2.4.2", + "eslint": "^8.53.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-import": "^2.29.0", + "eslint-plugin-prettier": "^5.0.1", + "eslint-plugin-unused-imports": "^3.0.0", + "eslint-plugin-vue": "^9.18.1", + "husky": "^8.0.3", + "lerna": "^8.0.0", + "lint-staged": "^15.1.0", + "lodash-es": "^4.17.21", + "pluralize": "^8.0.0", + "postcss": "^8.4.31", + "prettier": "^3.1.0", + "qs": "^6.11.2", + "qx-util": "^0.4.8", + "ramda": "^0.29.1", + "rollup-plugin-visualizer": "^5.9.2", + "sass": "1.69.5", + "stylelint": "15.11.0", + "stylelint-config-prettier": "^9.0.5", + "stylelint-config-recess-order": "^4.3.0", + "stylelint-config-standard": "^34.0.0", + "stylelint-config-standard-scss": "^11.1.0", + "stylelint-scss": "5.3.1", + "terser": "^5.24.0", + "typescript": "5.2.2", + "vite": "^4.5.0", + "vite-plugin-dts": "^3.6.3", + "vite-plugin-eslint": "^1.8.1", + "vite-plugin-libcss": "^1.1.1", + "vue": "^3.3.8", + "vue-eslint-parser": "^9.3.2", + "vue-router": "^4.2.5", + "vue-tsc": "1.8.22", + "vuedraggable": "^4.1.0" + }, + "peerDependencies": { + "@floating-ui/dom": "^1.5.1", + "@ibiz-template/core": "0.7.40-alpha.13", + "@ibiz-template/model-helper": "0.7.40-alpha.13", + "@ibiz-template/runtime": "0.7.40-alpha.13", + "@ibiz-template/theme": "^0.7.39", + "@ibiz-template/vue3-util": "0.7.40-alpha.13", + "@ibiz/model-core": "^0.1.71", + "async-validator": "^4.2.5", + "axios": "^1.6.2", + "dayjs": "^1.11.10", + "element-plus": "^2.4.2", + "lodash-es": "^4.17.21", + "pluralize": "^8.0.0", + "qs": "^6.11.2", + "qx-util": "^0.4.8", + "ramda": "^0.29.1", + "vue": "^3.3.8", + "vue-router": "^4.2.5", + "vuedraggable": "^4.1.0" + } +} diff --git a/packages/core/src/create-plugin/template/platform/chart_render/scripts/link.sh b/packages/core/src/create-plugin/template/platform/chart_render/scripts/link.sh new file mode 100755 index 0000000000000000000000000000000000000000..d4edc1556f72a02300c491cda3c13a7ff34795a7 --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/chart_render/scripts/link.sh @@ -0,0 +1,6 @@ +pnpm link --global "@ibiz-template/vue3-util" +pnpm link --global "@ibiz-template/model-helper" +pnpm link --global "@ibiz-template/runtime" +pnpm link --global "@ibiz-template/core" +pnpm link --global "@ibiz-template/theme" +pnpm link --global "@ibiz-template/vue3-components" diff --git a/packages/core/src/create-plugin/template/platform/chart_render/src/index.ts b/packages/core/src/create-plugin/template/platform/chart_render/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..ecc396f727261bdedfbed7c5c7e25565a34b8b83 --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/chart_render/src/index.ts @@ -0,0 +1,16 @@ +import { App } from 'vue'; +import { registerControlProvider } from '@ibiz-template/runtime'; +import { {{ pascalCasePluginName }} } from './{{pluginName}}'; +import { {{ pascalCasePluginName }}Provider } from './{{pluginName}}.provider'; + +export default { + install(app: App) { + // 全局注册部件插件组件 + app.component({{ pascalCasePluginName }}.name!, {{ pascalCasePluginName }}); + // 全局注册部件适配器,CUSTOM是插件类型,{{pluginId}}是插件标识 + registerControlProvider( + 'CUSTOM_{{pluginId}}', + () => new {{ pascalCasePluginName }}Provider(), + ); + }, +}; diff --git a/packages/core/src/create-plugin/template/platform/chart_render/src/{{pluginName}}.controller.ts b/packages/core/src/create-plugin/template/platform/chart_render/src/{{pluginName}}.controller.ts new file mode 100644 index 0000000000000000000000000000000000000000..2d6b3000c23b0e08c5fac4928ced7974559f882d --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/chart_render/src/{{pluginName}}.controller.ts @@ -0,0 +1,3 @@ +import { ChartController } from '@ibiz-template/runtime'; + +export class {{ pascalCasePluginName }}Controller extends ChartController {} diff --git a/packages/core/src/create-plugin/template/platform/chart_render/src/{{pluginName}}.provider.ts b/packages/core/src/create-plugin/template/platform/chart_render/src/{{pluginName}}.provider.ts new file mode 100644 index 0000000000000000000000000000000000000000..9a32e3ffd8cf352373e44506e938059b9c46041a --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/chart_render/src/{{pluginName}}.provider.ts @@ -0,0 +1,20 @@ +import { + CTX, + IControlController, + IControlProvider, +} from '@ibiz-template/runtime'; +import { IControl } from '@ibiz/model-core'; +import { {{ pascalCasePluginName }}Controller } from './{{pluginName}}.controller'; + +export class {{ pascalCasePluginName }}Provider implements IControlProvider { + component: string = 'IBiz{{ pascalCasePluginName }}'; + + createController( + model: IControl, + context: IContext, + params: IParams, + ctx: CTX, + ): IControlController { + return new {{ pascalCasePluginName }}Controller(model, context, params, ctx); + } +} diff --git a/packages/core/src/create-plugin/template/platform/chart_render/src/{{pluginName}}.scss b/packages/core/src/create-plugin/template/platform/chart_render/src/{{pluginName}}.scss new file mode 100644 index 0000000000000000000000000000000000000000..f494ab6cf7c220eae2d3b11bd32b7e3d96d2dc16 --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/chart_render/src/{{pluginName}}.scss @@ -0,0 +1,3 @@ +@include b({{pluginName}}){ + // 样式 +} \ No newline at end of file diff --git a/packages/core/src/create-plugin/template/platform/chart_render/src/{{pluginName}}.tsx b/packages/core/src/create-plugin/template/platform/chart_render/src/{{pluginName}}.tsx new file mode 100644 index 0000000000000000000000000000000000000000..d4c9c9bf593d56089e12dc02ae459f231c76b757 --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/chart_render/src/{{pluginName}}.tsx @@ -0,0 +1,60 @@ +import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; +import { defineComponent, PropType } from 'vue'; +import { IControlProvider } from '@ibiz-template/runtime'; +import { IDEChart } from '@ibiz/model-core'; +import { {{ pascalCasePluginName }}Controller } from './{{pluginName}}.controller'; +import './{{pluginName}}.scss'; + +export const {{ pascalCasePluginName }} = defineComponent({ + name: 'IBiz{{ pascalCasePluginName }}', + props: { + /** + * @description 图表模型数据 + */ + modelData: { type: Object as PropType, required: true }, + /** + * @description 应用上下文对象 + */ + context: { type: Object as PropType, required: true }, + /** + * @description 视图参数对象 + * @default {} + */ + params: { type: Object as PropType, default: () => ({}) }, + /** + * @description 部件适配器 + */ + provider: { type: Object as PropType }, + /** + * @description 部件激活模式,值为0:表示无激活,1:表示单击激活,2:表示双击激活 + */ + mdctrlActiveMode: { type: Number, default: undefined }, + /** + * @description 是否默认加载数据 + * @default true + */ + loadDefault: { type: Boolean, default: true }, + /** + * @description 是否是简单模式,即直接传入数据,不加载数据 + */ + isSimple: { type: Boolean, required: false }, + /** + * @description 简单模式下传入的数据 + */ + data: { type: Array, required: false }, + }, + setup() { + const c = useControlController( + (...args) => new {{ pascalCasePluginName }}Controller(...args), + ); + const ns = useNamespace('{{pluginName}}'); + + return { + c, + ns, + }; + }, + render() { + return
插件示例
; + }, +}); diff --git a/packages/core/src/create-plugin/template/platform/chart_render/tsconfig.json b/packages/core/src/create-plugin/template/platform/chart_render/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..ba8f48be2a612227b3b2cd44668c26316fa3dd4b --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/chart_render/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "target": "ESNext", + "useDefineForClassFields": true, + "module": "ESNext", + "moduleResolution": "Node", + "strict": true, + "jsx": "preserve", + "jsxImportSource": "vue", + "sourceMap": true, + "resolveJsonModule": true, + "isolatedModules": true, + "esModuleInterop": true, + "lib": ["ESNext", "DOM"], + "skipLibCheck": true + }, + "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"], + "references": [{ "path": "./tsconfig.node.json" }] +} diff --git a/packages/core/src/create-plugin/template/platform/chart_render/tsconfig.node.json b/packages/core/src/create-plugin/template/platform/chart_render/tsconfig.node.json new file mode 100644 index 0000000000000000000000000000000000000000..9d31e2aed93c876bc048cf2f863cb2a847c901e8 --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/chart_render/tsconfig.node.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "composite": true, + "module": "ESNext", + "moduleResolution": "Node", + "allowSyntheticDefaultImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/packages/core/src/create-plugin/template/platform/chart_render/vite.config.ts b/packages/core/src/create-plugin/template/platform/chart_render/vite.config.ts new file mode 100644 index 0000000000000000000000000000000000000000..fc3449a5a42babd06efbe73c42acd8989ffb91fc --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/chart_render/vite.config.ts @@ -0,0 +1,57 @@ +import { defineConfig } from 'vite'; +import vue from '@vitejs/plugin-vue'; +import vueJsx from '@vitejs/plugin-vue-jsx'; +import libLegacy from '@qx-chitanda/vite-plugin-lib-legacy'; +import dts from 'vite-plugin-dts'; +import libCss from 'vite-plugin-libcss'; +// https://vitejs.dev/config/ +export default defineConfig({ + build: { + lib: { + entry: './src/index.ts', + fileName: format => `index.${format}.js`, + }, + rollupOptions: { + external: [ + '@ibiz-template/core', + '@ibiz-template/model-helper', + '@ibiz-template/runtime', + '@ibiz-template/theme', + '@ibiz-template/vue3-util', + '@ibiz/dynamic-model-api', + '@floating-ui/dom', + 'async-validator', + 'axios', + 'dayjs', + 'element-plus', + 'lodash-es', + 'pluralize', + 'qs', + 'qx-util', + 'ramda', + 'vue', + 'vue-router', + 'vuedraggable', + ], + }, + }, + css: { + preprocessorOptions: { + scss: { + additionalData: '@import "@ibiz-template/theme/style/global.scss";', + }, + }, + }, + plugins: [ + // eslint({ + // include: 'src/**/*.{ts,tsx,js,jsx}', + // }), + vue(), + vueJsx(), + libLegacy(), + libCss(), + dts({ + outDir: 'dist/types', + }), + ], +}); diff --git a/packages/core/src/create-plugin/template/platform/custom/.eslintrc.cjs b/packages/core/src/create-plugin/template/platform/custom/.eslintrc.cjs new file mode 100644 index 0000000000000000000000000000000000000000..c6e5a1dd5b2fa946548b00254225469f2f15bee9 --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/custom/.eslintrc.cjs @@ -0,0 +1,52 @@ +module.exports = { + root: true, + env: { + browser: true, + es2021: true, + }, + extends: ['airbnb-base', 'prettier', 'plugin:@typescript-eslint/recommended'], + parser: '@typescript-eslint/parser', + parserOptions: { + ecmaVersion: 'latest', + sourceType: 'module', + }, + plugins: ['prettier', '@typescript-eslint', 'unused-imports'], + rules: { + 'prettier/prettier': 'error', + 'arrow-body-style': 'off', + 'prefer-arrow-callback': 'off', + 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', + 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off', + 'no-new': [0], + 'no-continue': [0], + '@typescript-eslint/no-empty-interface': 'off', + 'no-use-before-define': [0], + 'no-restricted-syntax': [0], + 'no-empty-function': [0], + 'no-useless-constructor': [0], // 禁止空的构造函数 + 'no-param-reassign': [0], // 禁止修改传入函数的参数 + 'no-underscore-dangle': [0], // 禁止使用下划线开头的变量名 + 'no-plusplus': ['error', { allowForLoopAfterthoughts: true }], // 禁止使用 ++,-- + 'consistent-return': [0], // 函数可以有不同类型返回值 + 'class-methods-use-this': [0], // 方法内未使用此方法时,强制定义为静态方法 + 'import/prefer-default-export': [0], // 一个模块只能有默认导出,不可以有多个导出 + 'import/no-unresolved': [0], // 不允许未解决的模块 + 'import/extensions': [0], // 不允许导入文件时不带后缀 + 'unused-imports/no-unused-imports': 'error', + '@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }], + '@typescript-eslint/no-inferrable-types': [0], + '@typescript-eslint/no-non-null-assertion': [0], + '@typescript-eslint/no-explicit-any': ['error'], + '@typescript-eslint/explicit-function-return-type': 'error', // 要求函数和类方法的显式返回类型 + '@typescript-eslint/explicit-module-boundary-types': 'error', // 要求导出函数和类的公共类方法的显式返回和参数类型 + 'import/no-extraneous-dependencies': [ + 0, + { + devDependencies: true, + peerDependencies: true, + // optionalDependencies: true, + // bundledDependencies: true + }, + ], + }, +}; diff --git a/packages/core/src/create-plugin/template/platform/custom/CHANGELOG.md b/packages/core/src/create-plugin/template/platform/custom/CHANGELOG.md new file mode 100644 index 0000000000000000000000000000000000000000..8ac8e7f05d173977a1ad060d18e7f0b6a5f23cf5 --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/custom/CHANGELOG.md @@ -0,0 +1,3 @@ +# 版本变更日志 + +添加变更日志 \ No newline at end of file diff --git a/packages/core/src/create-plugin/template/platform/custom/README.md b/packages/core/src/create-plugin/template/platform/custom/README.md new file mode 100644 index 0000000000000000000000000000000000000000..91ca028d21309a921372bcea34ddc59bdfa15b21 --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/custom/README.md @@ -0,0 +1,67 @@ +# 部件插件 + +## 插件结构 + +``` +|─ ─ {{pluginName}} 部件插件顶层目录 + |─ ─ src 部件插件源代码目录 +​ |─ ─ {{pluginName}}.controller.ts 部件插件控制器 +​ |─ ─ {{pluginName}}.provider.ts 部件插件适配器 +​ |─ ─ {{pluginName}}.scss 部件插件样式 +​ |─ ─ {{pluginName}}.tsx 部件插件组件 +​ |─ ─ index.ts 部件插件入口文件 +``` + +### 部件插件入口文件 + +部件插件入口文件会全局注册部件适配器和部件插件组件,供外部使用。 + +### 部件插件组件 + +部件插件组件使用tsx的书写方式,承载部件绘制的内容,可拷贝基础UI绘制,然后根据需求进行调整。其中,基础UI绘制可参考附录中UI呈现部分。 + +### 部件插件适配器 + +部件插件适配器主要通过component属性指定部件实际要绘制的组件,并且通过createController方法返回传递给部件的控制器。 + +### 部件插件控制器 + +部件插件控制器可继承基础控制器,然后根据需求进行调整。其中,基础控制器可参考附录中控制器部分。 + +## 附录 + +| 部件类型 | UI呈现 | 控制器 | +| :----------------: | :--------------------: | :-----------------------: | +| 应用菜单 | AppMenuControl | AppMenuController | +| 应用菜单(图标视图) | AppMenuIconViewControl | AppMenuIconViewController | +| 日历 | CalendarControl | CalendarController | +| 标题栏 | CaptionBarControl | CaptionBarController | +| 图表 | ChartControl | ChartController | +| 上下文菜单 | ContextMenuControl | ContextMenuController | +| 数据看板 | DashboardControl | DashboardController | +| 卡片 | DataViewControl | DataViewControlController | +| 数据关系栏 | DRBarControl | DRBarController | +| 数据关系分页 | DRTabControl | DRTabController | +| 日历导航栏 | CalendarExpBarControl | CalendarExpBarController | +| 图表导航栏 | ChartExpBarControl | ChartExpBarController | +| 卡片导航栏 | DataViewExpBarControl | ExpBarControlController | +| 表格导航栏 | GridExpBarControl | ExpBarControlController | +| 列表导航栏 | ListExpBarControl | ExpBarControlController | +| 树导航栏 | TreeExpBarControl | TreeExpBarController | +| 编辑表单 | EditFormControl | EditFormController | +| 搜索表单 | SearchFormControl | SearchFormController | +| 甘特图 | GanttControl | GanttController | +| 表格 | GridControl | GridController | +| 看板 | KanbanControl | KanbanController | +| 列表 | ListControl | ListController | +| 地图 | MapControl | MapController | +| 多编辑视图面板 | MEditViewPanelControl | MEditViewPanelController | +| 选择视图面板 | PickupViewPanelControl | PickupViewPanelController | +| 报表面板 | ReportPanelControl | ReportPanelController | +| 搜索栏 | SearchBarControl | SearchBarController | +| 分页导航面板 | TabExpPanelControl | TabExpPanelController | +| 工具栏 | ToolbarControl | ToolbarController | +| 树 | TreeControl | TreeController | +| 树表格 | TreeGridControl | TreeGridController | +| 树表格(增强) | TreeGridExControl | TreeGridExController | +| 向导面板 | WizardPanelControl | WizardPanelController | diff --git a/packages/core/src/create-plugin/template/platform/custom/package.json b/packages/core/src/create-plugin/template/platform/custom/package.json new file mode 100644 index 0000000000000000000000000000000000000000..9d91bb1fd3085001f191e80f53cd6dbddc3ee9c9 --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/custom/package.json @@ -0,0 +1,106 @@ +{ + "name": "{{pluginGroup}}/{{pluginName}}", + "version": "0.0.1", + "description": "{{pluginDescription}}", + "author": "tony001", + "license": "MIT", + "type": "module", + "main": "dist/index.es.js", + "module": "dist/index.es.js", + "types": "dist/types/index.d.ts", + "system": "dist/index.legacy.js", + "styles": [ + "dist/style.css" + ], + "files": [ + "dist", + "public", + "CHANGELOG.md", + "README.md" + ], + "publishConfig": { + "registry": "https://registry.npmjs.org/" + }, + "scripts": { + "dev": "vite build --watch", + "build": "vue-tsc --noEmit && vite build", + "preview": "vite preview" + }, + "devDependencies": { + "@floating-ui/dom": "^1.5.3", + "@ibiz-template/core": "0.7.40-alpha.13", + "@ibiz-template/model-helper": "0.7.40-alpha.13", + "@ibiz-template/runtime": "0.7.40-alpha.13", + "@ibiz-template/theme": "^0.7.39", + "@ibiz-template/vue3-util": "0.7.40-alpha.13", + "@ibiz/model-core": "^0.1.71", + "@qx-chitanda/vite-plugin-lib-legacy": "^4.1.1", + "@types/lodash-es": "^4.17.12", + "@types/ramda": "^0.29.6", + "@typescript-eslint/eslint-plugin": "^6.11.0", + "@typescript-eslint/parser": "^6.11.0", + "@vitejs/plugin-vue": "^4.4.1", + "@vitejs/plugin-vue-jsx": "^3.0.2", + "async-validator": "^4.2.5", + "axios": "^1.6.2", + "dayjs": "^1.11.10", + "element-plus": "^2.4.2", + "eslint": "^8.53.0", + "eslint-config-airbnb-base": "^15.0.0", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-import": "^2.29.0", + "eslint-plugin-prettier": "^5.0.1", + "eslint-plugin-unused-imports": "^3.0.0", + "eslint-plugin-vue": "^9.18.1", + "husky": "^8.0.3", + "lerna": "^8.0.0", + "lint-staged": "^15.1.0", + "lodash-es": "^4.17.21", + "pluralize": "^8.0.0", + "postcss": "^8.4.31", + "prettier": "^3.1.0", + "qs": "^6.11.2", + "qx-util": "^0.4.8", + "ramda": "^0.29.1", + "rollup-plugin-visualizer": "^5.9.2", + "sass": "1.69.5", + "stylelint": "15.11.0", + "stylelint-config-prettier": "^9.0.5", + "stylelint-config-recess-order": "^4.3.0", + "stylelint-config-standard": "^34.0.0", + "stylelint-config-standard-scss": "^11.1.0", + "stylelint-scss": "5.3.1", + "terser": "^5.24.0", + "typescript": "5.2.2", + "vite": "^4.5.0", + "vite-plugin-dts": "^3.6.3", + "vite-plugin-eslint": "^1.8.1", + "vite-plugin-libcss": "^1.1.1", + "vue": "^3.3.8", + "vue-eslint-parser": "^9.3.2", + "vue-router": "^4.2.5", + "vue-tsc": "1.8.22", + "vuedraggable": "^4.1.0" + }, + "peerDependencies": { + "@floating-ui/dom": "^1.5.1", + "@ibiz-template/core": "0.7.40-alpha.13", + "@ibiz-template/model-helper": "0.7.40-alpha.13", + "@ibiz-template/runtime": "0.7.40-alpha.13", + "@ibiz-template/theme": "^0.7.39", + "@ibiz-template/vue3-util": "0.7.40-alpha.13", + "@ibiz/model-core": "^0.1.71", + "async-validator": "^4.2.5", + "axios": "^1.6.2", + "dayjs": "^1.11.10", + "element-plus": "^2.4.2", + "lodash-es": "^4.17.21", + "pluralize": "^8.0.0", + "qs": "^6.11.2", + "qx-util": "^0.4.8", + "ramda": "^0.29.1", + "vue": "^3.3.8", + "vue-router": "^4.2.5", + "vuedraggable": "^4.1.0" + } +} diff --git a/packages/core/src/create-plugin/template/platform/custom/scripts/link.sh b/packages/core/src/create-plugin/template/platform/custom/scripts/link.sh new file mode 100755 index 0000000000000000000000000000000000000000..d4edc1556f72a02300c491cda3c13a7ff34795a7 --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/custom/scripts/link.sh @@ -0,0 +1,6 @@ +pnpm link --global "@ibiz-template/vue3-util" +pnpm link --global "@ibiz-template/model-helper" +pnpm link --global "@ibiz-template/runtime" +pnpm link --global "@ibiz-template/core" +pnpm link --global "@ibiz-template/theme" +pnpm link --global "@ibiz-template/vue3-components" diff --git a/packages/core/src/create-plugin/template/platform/custom/src/index.ts b/packages/core/src/create-plugin/template/platform/custom/src/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..ecc396f727261bdedfbed7c5c7e25565a34b8b83 --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/custom/src/index.ts @@ -0,0 +1,16 @@ +import { App } from 'vue'; +import { registerControlProvider } from '@ibiz-template/runtime'; +import { {{ pascalCasePluginName }} } from './{{pluginName}}'; +import { {{ pascalCasePluginName }}Provider } from './{{pluginName}}.provider'; + +export default { + install(app: App) { + // 全局注册部件插件组件 + app.component({{ pascalCasePluginName }}.name!, {{ pascalCasePluginName }}); + // 全局注册部件适配器,CUSTOM是插件类型,{{pluginId}}是插件标识 + registerControlProvider( + 'CUSTOM_{{pluginId}}', + () => new {{ pascalCasePluginName }}Provider(), + ); + }, +}; diff --git a/packages/core/src/create-plugin/template/platform/custom/src/{{pluginName}}.controller.ts b/packages/core/src/create-plugin/template/platform/custom/src/{{pluginName}}.controller.ts new file mode 100644 index 0000000000000000000000000000000000000000..2d6b3000c23b0e08c5fac4928ced7974559f882d --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/custom/src/{{pluginName}}.controller.ts @@ -0,0 +1,3 @@ +import { ChartController } from '@ibiz-template/runtime'; + +export class {{ pascalCasePluginName }}Controller extends ChartController {} diff --git a/packages/core/src/create-plugin/template/platform/custom/src/{{pluginName}}.provider.ts b/packages/core/src/create-plugin/template/platform/custom/src/{{pluginName}}.provider.ts new file mode 100644 index 0000000000000000000000000000000000000000..9a32e3ffd8cf352373e44506e938059b9c46041a --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/custom/src/{{pluginName}}.provider.ts @@ -0,0 +1,20 @@ +import { + CTX, + IControlController, + IControlProvider, +} from '@ibiz-template/runtime'; +import { IControl } from '@ibiz/model-core'; +import { {{ pascalCasePluginName }}Controller } from './{{pluginName}}.controller'; + +export class {{ pascalCasePluginName }}Provider implements IControlProvider { + component: string = 'IBiz{{ pascalCasePluginName }}'; + + createController( + model: IControl, + context: IContext, + params: IParams, + ctx: CTX, + ): IControlController { + return new {{ pascalCasePluginName }}Controller(model, context, params, ctx); + } +} diff --git a/packages/core/src/create-plugin/template/platform/custom/src/{{pluginName}}.scss b/packages/core/src/create-plugin/template/platform/custom/src/{{pluginName}}.scss new file mode 100644 index 0000000000000000000000000000000000000000..f494ab6cf7c220eae2d3b11bd32b7e3d96d2dc16 --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/custom/src/{{pluginName}}.scss @@ -0,0 +1,3 @@ +@include b({{pluginName}}){ + // 样式 +} \ No newline at end of file diff --git a/packages/core/src/create-plugin/template/platform/custom/src/{{pluginName}}.tsx b/packages/core/src/create-plugin/template/platform/custom/src/{{pluginName}}.tsx new file mode 100644 index 0000000000000000000000000000000000000000..d4c9c9bf593d56089e12dc02ae459f231c76b757 --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/custom/src/{{pluginName}}.tsx @@ -0,0 +1,60 @@ +import { useControlController, useNamespace } from '@ibiz-template/vue3-util'; +import { defineComponent, PropType } from 'vue'; +import { IControlProvider } from '@ibiz-template/runtime'; +import { IDEChart } from '@ibiz/model-core'; +import { {{ pascalCasePluginName }}Controller } from './{{pluginName}}.controller'; +import './{{pluginName}}.scss'; + +export const {{ pascalCasePluginName }} = defineComponent({ + name: 'IBiz{{ pascalCasePluginName }}', + props: { + /** + * @description 图表模型数据 + */ + modelData: { type: Object as PropType, required: true }, + /** + * @description 应用上下文对象 + */ + context: { type: Object as PropType, required: true }, + /** + * @description 视图参数对象 + * @default {} + */ + params: { type: Object as PropType, default: () => ({}) }, + /** + * @description 部件适配器 + */ + provider: { type: Object as PropType }, + /** + * @description 部件激活模式,值为0:表示无激活,1:表示单击激活,2:表示双击激活 + */ + mdctrlActiveMode: { type: Number, default: undefined }, + /** + * @description 是否默认加载数据 + * @default true + */ + loadDefault: { type: Boolean, default: true }, + /** + * @description 是否是简单模式,即直接传入数据,不加载数据 + */ + isSimple: { type: Boolean, required: false }, + /** + * @description 简单模式下传入的数据 + */ + data: { type: Array, required: false }, + }, + setup() { + const c = useControlController( + (...args) => new {{ pascalCasePluginName }}Controller(...args), + ); + const ns = useNamespace('{{pluginName}}'); + + return { + c, + ns, + }; + }, + render() { + return
插件示例
; + }, +}); diff --git a/packages/core/src/create-plugin/template/platform/custom/tsconfig.json b/packages/core/src/create-plugin/template/platform/custom/tsconfig.json new file mode 100644 index 0000000000000000000000000000000000000000..ba8f48be2a612227b3b2cd44668c26316fa3dd4b --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/custom/tsconfig.json @@ -0,0 +1,19 @@ +{ + "compilerOptions": { + "target": "ESNext", + "useDefineForClassFields": true, + "module": "ESNext", + "moduleResolution": "Node", + "strict": true, + "jsx": "preserve", + "jsxImportSource": "vue", + "sourceMap": true, + "resolveJsonModule": true, + "isolatedModules": true, + "esModuleInterop": true, + "lib": ["ESNext", "DOM"], + "skipLibCheck": true + }, + "include": ["src/**/*.ts", "src/**/*.d.ts", "src/**/*.tsx", "src/**/*.vue"], + "references": [{ "path": "./tsconfig.node.json" }] +} diff --git a/packages/core/src/create-plugin/template/platform/custom/tsconfig.node.json b/packages/core/src/create-plugin/template/platform/custom/tsconfig.node.json new file mode 100644 index 0000000000000000000000000000000000000000..9d31e2aed93c876bc048cf2f863cb2a847c901e8 --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/custom/tsconfig.node.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "composite": true, + "module": "ESNext", + "moduleResolution": "Node", + "allowSyntheticDefaultImports": true + }, + "include": ["vite.config.ts"] +} diff --git a/packages/core/src/create-plugin/template/platform/custom/vite.config.ts b/packages/core/src/create-plugin/template/platform/custom/vite.config.ts new file mode 100644 index 0000000000000000000000000000000000000000..fc3449a5a42babd06efbe73c42acd8989ffb91fc --- /dev/null +++ b/packages/core/src/create-plugin/template/platform/custom/vite.config.ts @@ -0,0 +1,57 @@ +import { defineConfig } from 'vite'; +import vue from '@vitejs/plugin-vue'; +import vueJsx from '@vitejs/plugin-vue-jsx'; +import libLegacy from '@qx-chitanda/vite-plugin-lib-legacy'; +import dts from 'vite-plugin-dts'; +import libCss from 'vite-plugin-libcss'; +// https://vitejs.dev/config/ +export default defineConfig({ + build: { + lib: { + entry: './src/index.ts', + fileName: format => `index.${format}.js`, + }, + rollupOptions: { + external: [ + '@ibiz-template/core', + '@ibiz-template/model-helper', + '@ibiz-template/runtime', + '@ibiz-template/theme', + '@ibiz-template/vue3-util', + '@ibiz/dynamic-model-api', + '@floating-ui/dom', + 'async-validator', + 'axios', + 'dayjs', + 'element-plus', + 'lodash-es', + 'pluralize', + 'qs', + 'qx-util', + 'ramda', + 'vue', + 'vue-router', + 'vuedraggable', + ], + }, + }, + css: { + preprocessorOptions: { + scss: { + additionalData: '@import "@ibiz-template/theme/style/global.scss";', + }, + }, + }, + plugins: [ + // eslint({ + // include: 'src/**/*.{ts,tsx,js,jsx}', + // }), + vue(), + vueJsx(), + libLegacy(), + libCss(), + dts({ + outDir: 'dist/types', + }), + ], +});