From b18423a2b5ef5c3c7b71a9bce097fe22cbc5306b Mon Sep 17 00:00:00 2001 From: ielgnaw Date: Fri, 4 Jun 2021 15:19:47 +0800 Subject: [PATCH] lesscode-v0.2.1 (#360) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 先去掉 bk-PaaS 中的其他内容,只保留 paas-ce/lesscode 目录 * init lesscode * add .pre-commit-config.yaml * test * test * add pre-commit & update dev_install doc & add bk-PaaS doc * typo * up dev_install doc * up dev_install doc * up dev_install doc * up dev_install doc * up .pre-commit-config.yaml * up comment info * add .pre-commit-config.yaml to ignore * feature: 组件属性配置类型提示首字母大写 * 可视化布局 => 可视化开发 * 可视化布局 => 可视化开发 * 可视化布局 => 可视化开发 * Lesscode update doc (#199) * ignore .idea * update bk-magic-vue version (for bk-color-picker select '') * 组件属性提示增加 tips 配置字段 * button 按钮组件使用说明 * text 按钮组件使用说明 * image 图片组件使用说明 * input 输入框组件使用说明 * events 配置数据结构优化 ['change'] ==> [{ name: 'change', tips: ''}] * 组件使用帮助 tips * 帮助文档页面移除单个组件导航 * 帮助文档:栅格布局 * merge #201 * merge manually from #201 * merge manually from #201 (#202) * merge #201 * merge manually from #201 * 添加快捷操作功能 (#205) * 增加chart图表 (#206) * 增加chart图表 * fix冲突 * 删除consolelog * 更新图标库 * merge manually from #203 * merge manually from #203 (#212) * 拖拽快捷操作支持Mac Command键 (#213) * 添加快捷操作功能 * 拖拽快捷键支持Mac Command键 * 修改快捷操作说明 * fix some bug * 修复 charts-line options.tips 小问题 * 修复 charts-line options.tips 小问题 (#215) * 修复刷新页面时,没有选中组件但右侧面板会显示 grid 属性的问题 * 【lesscode】修复刷新页面时,没有选中组件但右侧面板会显示 grid 属性的问题 (#216) * merge #201 * merge manually from #201 * merge manually from #203 * fix some bug * 修复 charts-line options.tips 小问题 * 修复刷新页面时,没有选中组件但右侧面板会显示 grid 属性的问题 * 修复 chart 组件样式被覆盖的问题 * 【lesscode】修复 chart 组件样式被覆盖的问题 (#217) * merge #201 * merge manually from #201 * merge manually from #203 * fix some bug * 修复 charts-line options.tips 小问题 * 修复刷新页面时,没有选中组件但右侧面板会显示 grid 属性的问题 * 修复 chart 组件样式被覆盖的问题 * fix图表问题 (#218) * 增加chart图表 * fix冲突 * 删除consolelog * 更新图标库 * 同步新的lesscode-develop,fix图表bug * 修改快捷操作 (#219) * 添加快捷操作功能 * 拖拽快捷键支持Mac Command键 * 修改快捷操作说明 * 修复剪切快捷操作,修改快捷操作说明 * 修改快捷操作 (#220) * 添加快捷操作功能 * 拖拽快捷键支持Mac Command键 * 修改快捷操作说明 * 修复剪切快捷操作,修改快捷操作说明 * 兼容数据为空的情况 * 兼容数据为空的情况 Co-authored-by: ielgnaw * 体验 bug 修复 * 【lesscode】体验 bug 修复 (#221) * merge #201 * merge manually from #201 * merge manually from #203 * fix some bug * 修复 charts-line options.tips 小问题 * 修复刷新页面时,没有选中组件但右侧面板会显示 grid 属性的问题 * 修复 chart 组件样式被覆盖的问题 * 体验 bug 修复 * 修改快捷操作判断 (#222) * 添加快捷操作功能 * 拖拽快捷键支持Mac Command键 * 修改快捷操作说明 * 修复剪切快捷操作,修改快捷操作说明 * 兼容数据为空的情况 * 兼容数据为空的情况 * 仅在选中拖拽区域触发快捷操作 * 修改判断是否在拖拽区域 * 修复体验问题 * 修复体验问题 (#223) * 增加backspace快捷删除 (#224) * 添加快捷操作功能 * 拖拽快捷键支持Mac Command键 * 修改快捷操作说明 * 修复剪切快捷操作,修改快捷操作说明 * 兼容数据为空的情况 * 兼容数据为空的情况 * 仅在选中拖拽区域触发快捷操作 * 修改判断是否在拖拽区域 * 增加backspace快速删除 修改快捷面版样式 * 画布仅剩一个 grid 时,不允许删除;增加清空 grid 操作 * 画布仅剩一个 grid 时,不允许删除;增加清空 grid 操作 (#225) * 修复 clone grid 时,右侧面板没有默认选中的问题;更新日志 * 修复 clone grid 时,右侧面板没有默认选中的问题;更新日志 (#226) * 文案 * 文案 (#227) * 后端orm采用TypeORM (#229) * 后端采用typeorm * orm添加migration (#230) * 修改数据迁移表 * 添加初始化脚本 (#233) * 增加data-base.js.example * 添加初始化SQL * 修改初始化脚本 * 新增项目级别页面布局和项目列表页UI (#232) * 新增数据库部署文档 (#234) * 添加快捷操作功能 * 拖拽快捷键支持Mac Command键 * 修改快捷操作说明 * 修复剪切快捷操作,修改快捷操作说明 * 兼容数据为空的情况 * 兼容数据为空的情况 * 仅在选中拖拽区域触发快捷操作 * 修改判断是否在拖拽区域 * 增加backspace快速删除 修改快捷面版样式 * 后端采用typeorm * orm添加migration * 修改文件名 * 修改数据迁移表 * 1. 新增数据库部署文档 2. 去掉test相关接口 3. 修改initial.sql注释 * 去掉数据迁移部分,采用SQL自己控制 * 1. 修改数据库说明 2. 修改数据库配置注释 * feature: db 操作demo (#235) * 提交项目模块layout和router & fix高版本echart图表自适应不生效问题 (#236) * 增加chart图表 * fix冲突 * 删除consolelog * 更新图标库 * 同步新的lesscode-develop,fix图表bug * fix高版本echarts无法自适应大小的问题 * project模块layout和router * 添加函数相关entity (#237) * 添加快捷操作功能 * 拖拽快捷键支持Mac Command键 * 修改快捷操作说明 * 修复剪切快捷操作,修改快捷操作说明 * 兼容数据为空的情况 * 兼容数据为空的情况 * 仅在选中拖拽区域触发快捷操作 * 修改判断是否在拖拽区域 * 增加backspace快速删除 修改快捷面版样式 * 后端采用typeorm * orm添加migration * 修改文件名 * 修改数据迁移表 * 1. 新增数据库部署文档 2. 去掉test相关接口 3. 修改initial.sql注释 * 去掉数据迁移部分,采用SQL自己控制 * 1. 修改数据库说明 2. 修改数据库配置注释 * 1. entity的base 添加创建人和修改人字段 2. 添加函数相关的entities 3. 修改initial.sql * 修改字段类型 * 新增项目相关功能 (#238) * 新增项目级别页面布局和项目列表页UI * 新增创建项目和查询项目列表功能 * 新增项目收藏功能 * 新增项目重命名功能 * 新增项目列表分类和搜索查询 * 新增复制项目功能 * 修改项目收藏功能使用独立的数据接口和模型 * 优化项目列表查询 * 新增删除项目功能 Co-authored-by: ielgnaw * 添加权限相关方法 (#240) * 添加快捷操作功能 * 拖拽快捷键支持Mac Command键 * 修改快捷操作说明 * 修复剪切快捷操作,修改快捷操作说明 * 兼容数据为空的情况 * 兼容数据为空的情况 * 仅在选中拖拽区域触发快捷操作 * 修改判断是否在拖拽区域 * 增加backspace快速删除 修改快捷面版样式 * 后端采用typeorm * orm添加migration * 修改文件名 * 修改数据迁移表 * 1. 新增数据库部署文档 2. 去掉test相关接口 3. 修改initial.sql注释 * 去掉数据迁移部分,采用SQL自己控制 * 1. 修改数据库说明 2. 修改数据库配置注释 * 1. entity的base 添加创建人和修改人字段 2. 添加函数相关的entities 3. 修改initial.sql * 修改字段类型 * 1. 添加权限相关的实体和接口 2. 添加创建人和更新人字段 Co-authored-by: ielgnaw * 解决冲突 (#241) * 添加快捷操作功能 * 拖拽快捷键支持Mac Command键 * 修改快捷操作说明 * 修复剪切快捷操作,修改快捷操作说明 * 兼容数据为空的情况 * 兼容数据为空的情况 * 仅在选中拖拽区域触发快捷操作 * 修改判断是否在拖拽区域 * 增加backspace快速删除 修改快捷面版样式 * 后端采用typeorm * orm添加migration * 修改文件名 * 修改数据迁移表 * 1. 新增数据库部署文档 2. 去掉test相关接口 3. 修改initial.sql注释 * 去掉数据迁移部分,采用SQL自己控制 * 1. 修改数据库说明 2. 修改数据库配置注释 * 1. entity的base 添加创建人和修改人字段 2. 添加函数相关的entities 3. 修改initial.sql * 修改字段类型 * 解决冲突 * 统一实体导入导出与命名规则 (#242) * 新增项目级别页面布局和项目列表页UI * 新增创建项目和查询项目列表功能 * 新增项目收藏功能 * 新增项目重命名功能 * 新增项目列表分类和搜索查询 * 新增复制项目功能 * 修改项目收藏功能使用独立的数据接口和模型 * 优化项目列表查询 * 新增删除项目功能 Co-authored-by: ielgnaw * 自定义组件接口 (#243) * feature: db 操作demo * perf: 组件管理接口联调 * perf: 修改实体引入方式 * fix: 自定义组件上传 (#244) * feature: db 操作demo * perf: 组件管理接口联调 * perf: 修改实体引入方式 * fix: 自定义组件上传 Co-authored-by: ielgnaw * 函数页面及接口 (#245) * 添加快捷操作功能 * 拖拽快捷键支持Mac Command键 * 修改快捷操作说明 * 修复剪切快捷操作,修改快捷操作说明 * 兼容数据为空的情况 * 兼容数据为空的情况 * 仅在选中拖拽区域触发快捷操作 * 修改判断是否在拖拽区域 * 增加backspace快速删除 修改快捷面版样式 * 后端采用typeorm * orm添加migration * 修改文件名 * 修改数据迁移表 * 1. 新增数据库部署文档 2. 去掉test相关接口 3. 修改initial.sql注释 * 去掉数据迁移部分,采用SQL自己控制 * 1. 修改数据库说明 2. 修改数据库配置注释 * 1. entity的base 添加创建人和修改人字段 2. 添加函数相关的entities 3. 修改initial.sql * 修改字段类型 * 解决冲突 * 添加函数相关页面及接口 * up data-base conf example * up data-base conf example (#246) * 提交页面管理 (#247) * 提交页面管理 * merge Co-authored-by: ielgnaw * merge page && page 表,content 和 sourceCode 改为允许 null * merge page && page 表,content 和 sourceCode 改为允许 null (#248) * fix页面管理问题 (#249) * fix复制页面问题 * 删除preview页面的query参数 * update msg Co-authored-by: ielgnaw * format code style * format code style (#250) * page 模块小问题修复 * page 模块小问题修复 (#251) * 1. 函数体验优化 2. 函数对接项目 * 修改整体路由、生成页面缩略图 (#253) * 增加chart图表 * fix冲突 * 删除consolelog * 更新图标库 * 同步新的lesscode-develop,fix图表bug * fix高版本echarts无法自适应大小的问题 * project模块layout和router * 提交页面管理 * merge * fix复制页面问题 * 删除preview页面的query参数 * update msg * 修改整体路由、生成页面缩略图 Co-authored-by: ielgnaw * 1. 函数体验优化 (#252) 2. 函数对接项目 * 通过手动保存方式串联流程 (#254) * 修改整体路由、生成页面缩略图 * 增加手动保存串连流程 * 删除consolelog Co-authored-by: ielgnaw * merge * merge && cookie * merge && cookie (#255) * 修改删除和新增分类的项目 * 修改删除和新增分类的项目 (#256) * 1. 函数体验优化 2. 函数对接项目 * 修改删除和新增分类的项目 * 函数修改为可以选中所有模板生成的函数 * 登录权限控制 & 账号管理页面 & 用户信息 * 登录权限控制 & 账号管理页面 & 用户信息 (#259) * entities base 中尝试获取 curLoginUser (#260) * 登录权限控制 & 账号管理页面 & 用户信息 * entities base 中尝试获取 curLoginUser * fix页面管理体验问题 (#257) * fix页面管理体验问题 * 下拉项目列表增加搜索 Co-authored-by: ielgnaw * 使用函数的时候,可以选择所有模板生成的函数 (#258) * 1. 函数体验优化 2. 函数对接项目 * 修改删除和新增分类的项目 * 函数修改为可以选中所有模板生成的函数 * add http.js.example * add http.js.example (#261) * 项目管理对接登录用户和复制项目及样式与交互优化 (#262) * 新增项目级别页面布局和项目列表页UI * 新增创建项目和查询项目列表功能 * 新增项目收藏功能 * 新增项目重命名功能 * 新增项目列表分类和搜索查询 * 新增复制项目功能 * 修改项目收藏功能使用独立的数据接口和模型 * 优化项目列表查询 * 新增删除项目功能 * 项目管理样式和交互优化 * 项目对接登录用户和复制项目优化 Co-authored-by: ielgnaw * 处理projectId不存在情况,fix页面管理样式问题 (#263) * 增加chart图表 * fix冲突 * 删除consolelog * 更新图标库 * 同步新的lesscode-develop,fix图表bug * fix高版本echarts无法自适应大小的问题 * project模块layout和router * 提交页面管理 * merge * fix复制页面问题 * 删除preview页面的query参数 * update msg * 修改整体路由、生成页面缩略图 * 增加手动保存串连流程 * 删除consolelog * fix页面管理体验问题 * 下拉项目列表增加搜索 * 处理projectId不存在情况,fix页面管理样式问题 Co-authored-by: ielgnaw * 数据库默认值调整 (#264) * merge #201 * merge manually from #201 * merge manually from #203 * fix some bug * 修复 charts-line options.tips 小问题 * 修复刷新页面时,没有选中组件但右侧面板会显示 grid 属性的问题 * 修复 chart 组件样式被覆盖的问题 * 体验 bug 修复 * 修复体验问题 * 画布仅剩一个 grid 时,不允许删除;增加清空 grid 操作 * 修复 clone grid 时,右侧面板没有默认选中的问题;更新日志 * 文案 * up data-base conf example * merge page && page 表,content 和 sourceCode 改为允许 null * format code style * page 模块小问题修复 * merge * merge && cookie * 登录权限控制 & 账号管理页面 & 用户信息 * add http.js.example * 修复自定义组件 x-table 获取数据的问题 * 统一操作用户 * 修复自定义组件 x-table 获取数据的问题 (#265) * 统一操作用户 (#266) * 1. 函数体验优化 2. 函数对接项目 * 修改删除和新增分类的项目 * 函数修改为可以选中所有模板生成的函数 * 统一操作用户 * 获取正确的当前登录用户写入数据库 createUser 和 updateUser * 获取正确的当前登录用户写入数据库 createUser 和 updateUser (#267) * 修复 cookie 中 bktoken 失效的问题 * 项目复制完善和项目列表体验问题修复 (#268) * 项目列表体验优化 Co-authored-by: ielgnaw * 修复 cookie 中 bktoken 失效的问题 (#269) * 函数体验优化 * 去除重复js * fix页面管理相关体验问题 (#271) * 处理projectId不存在情况,fix页面管理样式问题 * 页面管理体验问题修复 * fix page style Co-authored-by: ielgnaw * 函数体验问题修复 (#270) * 1. 函数体验优化 2. 函数对接项目 * 修改删除和新增分类的项目 * 函数修改为可以选中所有模板生成的函数 * 统一操作用户 * 函数体验优化 * 去除重复js * 函数api url提示,默认函数填写绝对路径 * 去掉多余的空格 * 函数体验问题修复 (#272) * 1. 函数体验优化 2. 函数对接项目 * 修改删除和新增分类的项目 * 函数修改为可以选中所有模板生成的函数 * 统一操作用户 * 函数体验优化 * 去除重复js * 函数api url提示,默认函数填写绝对路径 * 去掉多余的空格 * 修改layout样式 * 导航与主站一致 * 导航与主站一致 (#274) * 导航与主站一致 * 导航与主站一致 * 隐藏项目删除操作和画布内容区加loading等体验问题修复 (#275) * 新增项目级别页面布局和项目列表页UI * 新增创建项目和查询项目列表功能 * 新增项目收藏功能 * 新增项目重命名功能 * 新增项目列表分类和搜索查询 * 新增复制项目功能 * 修改项目收藏功能使用独立的数据接口和模型 * 优化项目列表查询 * 新增删除项目功能 * 项目管理样式和交互优化 * 项目对接登录用户和复制项目优化 * 复制项目补充页面函数关联记录 * 项目列表体验优化 * 体验问题修复 Co-authored-by: ielgnaw * 修复属性面板中 switch 组件不会正确渲染的问题 * 修复属性面板中 switch 组件不会正确渲染的问题 (#276) * 函数提示优化,增加按钮获取数据 (#277) * 项目名称、ID 校验去重在当前用户维度下 * 项目名称、ID 校验去重在当前用户维度下 (#278) * 修复 compId 的问题 * 修复 compId 的问题 (#280) * initcode (#326) * initCode * update ignore文件 * feat:修改conf目录下npm、bkrepo、migrate配置文件引用方式和相应文档说明 (#329) * initCode * update ignore文件 * 修改conf目录下npm、bkrepo、migrate配置文件引用方式和相应文档说明 * 修改gitignore文件 * feature: 新增sideslider交互式组件;feature: 路由功能增强,支持删除路由、修改父路径、绑定跳转路由及自动识别项目默认首页 (#336) * bugfix: 增加路由跳转的sql变更 (#337) * bugfix: 增加路由跳转的sql变更 * bugfix: 增加路由跳转的sql变更 * bugfix: delete图标库相关code (#341) * bugfix: 增加路由跳转的sql变更 * bugfix: 增加路由跳转的sql变更 * fix: delete图标库相关code * fix: 页面预览图偶发失败 (#344) * fix: 修复侧栏sideSlider的配置问题 (#348) fix: 变量名优化 Co-authored-by: vincenttgao * fix: 页面绑定路由时未禁用已绑定跳转的路由问题 (#350) * fix(edit): 路由参数tips (#352) * fix: 修复交互式组件的若干问题 (#351) * fix: 修复侧栏sideSlider的配置问题 fix: 变量名优化 * fix: 修复交互式组件中,自由布局定位错误的问题 * fix: 修复diff组件缺少language报错的问题 * fix: 修复交互式组件处于激活态时,底层下仍然可交互的问题 * fix: 修复交互式组件拖拽的问题 Co-authored-by: vincenttgao * feat: new version (#354) * bugfix: fix自定义组件第一次拖入时不显示问题 (#357) * feat: add db index sql (#358) Co-authored-by: hLinx <327159425@qq.com> Co-authored-by: sundytt <30256396+sundytt@users.noreply.github.com> Co-authored-by: Arman19941113 <35905177+Arman19941113@users.noreply.github.com> Co-authored-by: xuzhan Co-authored-by: terlinhe <312592676@qq.com> Co-authored-by: yangyy Co-authored-by: Vincent Ko <512419912@qq.com> Co-authored-by: vincenttgao --- paas-ce/lesscode/.eslintrc.js | 16 + paas-ce/lesscode/.gitignore | 15 +- paas-ce/lesscode/README.md | 22 +- paas-ce/lesscode/docs/install/conf.md | 30 + paas-ce/lesscode/docs/install/database.md | 19 +- paas-ce/lesscode/forever.json | 2 +- .../lesscode/lib/client/build/build-dll.js | 9 +- paas-ce/lesscode/lib/client/build/conf.js | 15 +- .../lesscode/lib/client/build/md-highlight.js | 52 + paas-ce/lesscode/lib/client/build/md-hljs.js | 16 + .../lib/client/build/md-loader-option.js | 2 + .../lib/client/build/postcss-plugins.js | 1 - .../client/build/replace-static-url-plugin.js | 4 + paas-ce/lesscode/lib/client/build/util.js | 9 +- .../lib/client/build/webpack.base.conf.js | 57 +- .../lib/client/build/webpack.dev.conf.js | 107 +- .../lib/client/build/webpack.prod.conf.js | 117 +- paas-ce/lesscode/lib/client/index-dev.html | 8 + paas-ce/lesscode/lib/client/index.html | 7 + paas-ce/lesscode/lib/client/preview.html | 108 + paas-ce/lesscode/lib/client/src/App.vue | 22 +- paas-ce/lesscode/lib/client/src/api/index.js | 12 +- .../lesscode/lib/client/src/api/pureAxios.js | 2 +- .../lesscode/lib/client/src/common/bkmagic.js | 5 +- .../index.css => common/bkui-vue-complex.js} | 5 +- .../lib/client/src/common/demand-import.js | 5 +- .../lib/client/src/common/dom-to-image.js | 784 ++++++ .../x-form/components/utils => common}/dom.js | 33 +- .../lib/client/src/common/drag-line.js | 242 ++ .../lesscode/lib/client/src/common/drag.js | 175 ++ .../popover/index.js => common/element.js} | 8 +- .../lib/client/src/common/targetData.js | 67 +- .../client/src/common/tnpm-version-valid.js | 180 ++ .../lesscode/lib/client/src/common/util.js | 312 ++- .../src/components/code-viewer/index.vue | 195 ++ .../lib/client/src/components/header.vue | 6 - .../client/src/components/member-selector.vue | 63 + .../methods/{funcForm.vue => func-form.vue} | 113 +- .../src/components/methods/function-helper.js | 74 + .../client/src/components/methods/index.vue | 286 +- .../client/src/components/methods/monaco.vue | 83 +- .../components/methods/provide-completion.js | 127 + .../src/components/methods/select-func.vue | 189 ++ .../src/components/modifier/append-select.vue | 12 +- .../src/components/modifier/icon-select.vue | 84 + .../src/components/novice-guide/help.png | Bin 0 -> 46376 bytes .../src/components/novice-guide/index.vue | 428 +++ .../src/components/patch/chart/index.vue | 2 +- .../components/project/edit-route-dialog.vue | 138 + .../components/project/layout-thumb-list.vue | 171 ++ .../src/components/project/page-dialog.vue | 222 +- .../components/render/component-wrapper.js | 63 + .../src/components/render/component.css | 104 +- .../src/components/render/component.vue | 270 +- .../src/components/render/free-layout.css | 178 ++ .../src/components/render/free-layout.vue | 436 +++ .../lib/client/src/components/render/grid.css | 75 +- .../lib/client/src/components/render/grid.vue | 92 +- .../client/src/components/render/index.vue | 112 + .../src/components/render/offsetMixin.js | 9 + .../lib/client/src/components/render/slot.js | 11 +- .../client/src/components/ui/extra-links.vue | 85 +- .../lib/client/src/components/ui/layout.vue | 38 +- .../variable/variable-form/index.vue | 270 ++ .../variable/variable-form/variable-code.vue | 29 + .../variable/variable-form/variable-input.vue | 54 + .../variable/variable-form/variable-json.vue | 130 + .../variable-form/variable-switcher.vue | 29 + .../variable-form/variable-upload.vue | 51 + .../variable/variable-form/variable.mixin.js | 28 + .../components/variable/variable-select.vue | 439 +++ .../components/variable/variable-table.vue | 304 ++ .../src/components/vue-code/code-mixin.js | 415 --- .../client/src/components/vue-code/index.vue | 156 +- .../src/components/widget/context-menu.vue | 102 + .../lib/client/src/components/widget/form.vue | 2 +- .../widget/layout/components/complex.vue | 278 ++ .../widget/layout/components/empty.vue | 5 + .../widget/layout/components/left-right.vue | 189 ++ .../widget/layout/components/logo.png | Bin 0 -> 3296 bytes .../widget/layout/components/top-bottom.vue | 206 ++ .../src/components/widget/layout/index.vue | 196 ++ .../src/components/widget/tree/transition.js | 77 + .../src/components/widget/tree/tree-item.vue | 66 + .../src/components/widget/tree/tree-node.js | 307 +++ .../src/components/widget/tree/tree.vue | 811 ++++++ .../src/components/widget/tree/utils.js | 39 + .../lesscode/lib/client/src/css/bk-patch.css | 9 +- .../lesscode/lib/client/src/css/common.css | 23 + .../lib/client/src/css/mixins/transition.css | 3 + paas-ce/lesscode/lib/client/src/css/reset.css | 12 + .../lib/client/src/custom/components.json | 5 - .../lesscode/lib/client/src/custom/index.js | 36 - .../x-form/components/button/button.css | 890 ------ .../x-form/components/button/button.vue | 167 -- .../components/button/create-button-hover.css | 80 - .../components/button/create-button.css | 88 - .../custom/x-form/components/css/spinner.svg | 98 - .../custom/x-form/components/css/variable.css | 211 -- .../custom/x-form/components/input/input.css | 360 --- .../custom/x-form/components/input/input.vue | 590 ---- .../x-form/components/loading/directive.js | 93 - .../custom/x-form/components/loading/index.js | 21 - .../x-form/components/loading/loading.css | 508 ---- .../x-form/components/loading/loading.js | 54 - .../x-form/components/loading/loading.vue | 123 - .../x-form/components/mixins/emitter.js | 30 - .../x-form/components/popover/popover.css | 628 ----- .../x-form/components/popover/popover.vue | 186 -- .../x-form/components/select/option-all.vue | 67 - .../x-form/components/select/option-group.vue | 71 - .../x-form/components/select/option.vue | 95 - .../x-form/components/select/select.css | 314 --- .../x-form/components/select/select.vue | 484 ---- .../x-form/components/utils/pop-manager.js | 195 -- .../x-form/components/utils/tippy/index.js | 1936 ------------- .../x-form/components/utils/tippy/popper.js | 2449 ----------------- .../components/utils/z-index-manager.js | 40 - .../lib/client/src/custom/x-form/config.js | 102 - .../lib/client/src/custom/x-form/index.js | 18 - .../lib/client/src/custom/x-form/index.vue | 179 -- .../lib/client/src/custom/x-input/config.js | 78 - .../x-script/components/button/button.css | 890 ------ .../x-script/components/button/button.vue | 167 -- .../components/button/create-button-hover.css | 80 - .../components/button/create-button.css | 88 - .../x-script/components/css/spinner.svg | 98 - .../x-script/components/css/variable.css | 211 -- .../x-script/components/loading/directive.js | 93 - .../x-script/components/loading/index.js | 21 - .../x-script/components/loading/loading.css | 508 ---- .../x-script/components/loading/loading.js | 54 - .../x-script/components/loading/loading.vue | 123 - .../x-script/components/mixins/emitter.js | 30 - .../x-script/components/mixins/z-index.js | 26 - .../x-script/components/popover/popover.css | 628 ----- .../x-script/components/popover/popover.vue | 186 -- .../x-script/components/select/option-all.vue | 67 - .../components/select/option-group.vue | 71 - .../x-script/components/select/option.vue | 95 - .../x-script/components/select/select.css | 314 --- .../x-script/components/select/select.vue | 484 ---- .../custom/x-script/components/utils/dom.js | 298 -- .../x-script/components/utils/pop-manager.js | 195 -- .../x-script/components/utils/tippy/index.js | 1936 ------------- .../x-script/components/utils/tippy/popper.js | 2449 ----------------- .../components/utils/z-index-manager.js | 40 - .../lib/client/src/custom/x-script/config.js | 79 - .../lib/client/src/custom/x-script/index.js | 18 - .../lib/client/src/custom/x-script/index.vue | 540 ---- .../x-table/components/button/button.css | 890 ------ .../x-table/components/button/button.vue | 167 -- .../components/button/create-button-hover.css | 80 - .../components/button/create-button.css | 88 - .../custom/x-table/components/css/spinner.svg | 98 - .../x-table/components/css/variable.css | 211 -- .../custom/x-table/components/input/input.css | 360 --- .../custom/x-table/components/input/input.vue | 590 ---- .../x-table/components/loading/directive.js | 93 - .../x-table/components/loading/index.js | 21 - .../x-table/components/loading/loading.css | 508 ---- .../x-table/components/loading/loading.js | 54 - .../x-table/components/loading/loading.vue | 123 - .../x-table/components/mixins/emitter.js | 30 - .../x-table/components/popover/popover.css | 628 ----- .../x-table/components/popover/popover.vue | 186 -- .../x-table/components/select/option-all.vue | 67 - .../components/select/option-group.vue | 71 - .../x-table/components/select/option.vue | 95 - .../x-table/components/select/select.css | 314 --- .../x-table/components/select/select.vue | 484 ---- .../custom/x-table/components/utils/dom.js | 298 -- .../x-table/components/utils/pop-manager.js | 195 -- .../x-table/components/utils/tippy/index.js | 1936 ------------- .../x-table/components/utils/tippy/popper.js | 2449 ----------------- .../components/utils/z-index-manager.js | 40 - .../lib/client/src/custom/x-table/config.js | 34 - .../lib/client/src/custom/x-table/index.css | 61 - .../lib/client/src/custom/x-table/index.js | 18 - .../lib/client/src/custom/x-table/index.vue | 404 --- .../materials/bk/alert/index.js | 56 + .../{ => bk}/animate-number/index.js | 8 +- .../materials/{ => bk}/badge/index.js | 4 +- .../materials/bk/big-tree/index.js | 100 + .../materials/bk/bread-crumb/index.js | 46 + .../materials/{ => bk}/button/index.js | 8 +- .../materials/bk/card/index.js | 90 + .../materials/bk/cascade/index.js | 152 + .../materials/{ => bk}/charts-bar/index.js | 13 +- .../materials/{ => bk}/charts-line/index.js | 19 +- .../materials/{ => bk}/charts-pie/index.js | 13 +- .../{ => bk}/checkbox-group/index.js | 9 + .../materials/{ => bk}/collapse/index.js | 3 +- .../materials/bk/color-picker/index.js | 57 + .../materials/{ => bk}/date-picker/index.js | 18 +- .../materials/bk/dialog/index.js | 131 + .../materials/{ => bk}/diff/index.js | 27 +- .../materials/bk/divider/index.js} | 45 +- .../materials/{ => bk}/exception/index.js | 2 +- .../materials/{ => bk}/form/index.js | 0 .../materials/bk/free-layout/index.js} | 28 +- .../materials/{ => bk}/grid/base.js | 4 +- .../materials/{ => bk}/grid/column1.js | 0 .../materials/{ => bk}/grid/column2.js | 0 .../materials/{ => bk}/grid/column3.js | 0 .../materials/{ => bk}/grid/column4.js | 0 .../materials/{ => bk}/grid/extends.js | 4 +- .../materials/{ => bk}/image/index.js | 20 +- .../element-materials/materials/bk/index.js | 131 + .../materials/{ => bk}/input/index.js | 13 +- .../materials/bk/link/index.js | 63 + .../materials/{ => bk}/pagination/index.js | 6 +- .../materials/bk/paragraph/index.js | 52 + .../materials/bk/popconfirm/index.js | 82 + .../materials/bk/popover/index.js | 63 + .../materials/bk/process/index.js | 83 + .../materials/{ => bk}/progress/index.js | 6 +- .../materials/bk/radio-button-group/index.js | 61 + .../materials/{ => bk}/radio-group/index.js | 2 + .../materials/{ => bk}/rate/index.js | 0 .../{ => bk}/round-progress/index.js | 17 +- .../materials/{ => bk}/search-select/index.js | 18 +- .../materials/{ => bk}/select/index.js | 28 +- .../materials/bk/sideslider/index.js | 93 + .../materials/{ => bk}/slider/index.js | 9 + .../materials/{ => bk}/steps/index.js | 22 +- .../materials/{ => bk}/swiper/index.js | 21 +- .../materials/{ => bk}/switcher/index.js | 11 +- .../materials/{ => bk}/tab/index.js | 4 +- .../materials/{ => bk}/table/index.js | 43 +- .../materials/{ => bk}/tag-input/index.js | 9 + .../materials/{ => bk}/text/index.js | 25 +- .../materials/{ => bk}/time-picker/index.js | 11 +- .../materials/{ => bk}/timeline/index.js | 14 +- .../materials/{ => bk}/transfer/index.js | 9 + .../materials/{ => bk}/tree/index.js | 28 +- .../materials/{ => bk}/upload/index.js | 17 +- .../materials/{ => bk}/zoom-image/index.js | 2 +- .../materials/element/button/index.js | 88 + .../materials/element}/index.js | 23 +- .../materials/element/link/index.js | 61 + .../element-materials/materials/icon-list.js | 43 + .../src/element-materials/materials/index.js | 100 +- .../modifier/component/directives/index.vue | 192 ++ .../modifier/component/events/index.vue | 117 + .../modifier/component/index.vue | 312 +++ .../props/components/render-prop.vue | 423 +++ .../props/components/strategy/boolean.vue | 4 +- .../props/components/strategy/checkbox.vue | 21 +- .../props/components/strategy/collapse.vue | 4 +- .../props/components/strategy/color.vue} | 54 +- .../props/components/strategy/column.vue | 7 +- .../props/components/strategy/float.vue | 146 + .../components/strategy/free-layout-item.vue} | 29 +- .../props/components/strategy/function.vue | 79 + .../props/components/strategy/icon.vue | 67 + .../props/components/strategy/json-view.vue} | 7 +- .../props/components/strategy/number.vue | 1 + .../props/components/strategy/option.vue | 49 +- .../components/strategy/radio-button.vue | 160 ++ .../props/components/strategy/radio.vue | 21 +- .../props/components/strategy/remote.vue | 270 ++ .../props/components/strategy/select.vue | 146 + .../components/strategy/slot-wrapper.vue | 283 ++ .../props/components/strategy/slot.vue} | 3 +- .../props/components/strategy/string.vue | 7 +- .../props/components/strategy/tab-panel.vue | 27 +- .../components/strategy/table-column.vue | 260 ++ .../props/components/strategy/text.vue | 130 + .../props/components/strategy/textarea.vue | 68 + .../modifier/{ => component}/props/index.vue | 45 +- .../modifier/{ => component}/styles/index.vue | 16 +- .../{ => component}/styles/layout/index.vue | 1 + .../{ => component}/styles/layout/item.vue | 1 + .../styles/strategy/background-color.vue | 0 .../styles/strategy/border.vue | 18 +- .../{ => component}/styles/strategy/color.vue | 0 .../styles/strategy/custom-style.vue | 169 ++ .../styles/strategy/display.vue | 0 .../{ => component}/styles/strategy/font.vue | 0 .../styles/strategy/margin.vue | 21 +- .../component/styles/strategy/monaco.vue | 87 + .../styles/strategy/padding.vue | 0 .../{ => component}/styles/strategy/size.vue | 6 + .../styles/strategy/text-align.vue | 0 .../modifier/events/index.vue | 164 -- .../src/element-materials/modifier/index.vue | 263 +- .../modifier/props/components/render-prop.vue | 270 -- .../props/components/strategy/remote.vue | 156 -- .../props/components/strategy/select.vue | 20 - .../components/strategy/table-column.vue | 145 - .../props/components/strategy/textarea.vue | 19 - .../modifier/template/complex-side/index.vue | 173 ++ .../modifier/template/complex-top/index.vue | 90 + .../modifier/template/editor/menu/edit.vue | 268 ++ .../modifier/template/editor/menu/index.vue | 206 ++ .../modifier/template/editor/prop/index.vue | 109 + .../modifier/template/index.vue | 127 + .../modifier/template/info.vue | 29 + .../modifier/template/side-menu/index.vue | 90 + .../modifier/template/top-menu/index.vue | 89 + .../modifier/template/utils/index.js | 13 + .../client/src/images/help/case-table1.png | Bin 0 -> 201825 bytes .../client/src/images/help/case-table10.png | Bin 0 -> 286999 bytes .../client/src/images/help/case-table2.png | Bin 0 -> 232157 bytes .../client/src/images/help/case-table3.png | Bin 0 -> 249652 bytes .../client/src/images/help/case-table4.png | Bin 0 -> 257755 bytes .../client/src/images/help/case-table5.png | Bin 0 -> 268340 bytes .../client/src/images/help/case-table6.png | Bin 0 -> 293067 bytes .../client/src/images/help/case-table7.png | Bin 0 -> 249491 bytes .../client/src/images/help/case-table8.png | Bin 0 -> 264129 bytes .../client/src/images/help/case-table9.png | Bin 0 -> 77521 bytes .../src/images/help/component-create.png | Bin 0 -> 333477 bytes .../src/images/help/component-operation.png | Bin 0 -> 229963 bytes .../src/images/help/component-upload.png | Bin 0 -> 138635 bytes .../client/src/images/help/component-use.png | Bin 0 -> 107773 bytes .../client/src/images/help/create-page.png | Bin 0 -> 21531 bytes .../client/src/images/help/create-proj.png | Bin 0 -> 23270 bytes .../lib/client/src/images/help/develop1.png | Bin 0 -> 63756 bytes .../lib/client/src/images/help/develop2.png | Bin 0 -> 186074 bytes .../client/src/images/help/free-layout1.png | Bin 0 -> 73788 bytes .../client/src/images/help/free-layout2.png | Bin 0 -> 45693 bytes .../client/src/images/help/free-layout3.png | Bin 0 -> 49653 bytes .../client/src/images/help/free-layout4.png | Bin 0 -> 66544 bytes .../client/src/images/help/free-layout5.png | Bin 0 -> 93430 bytes .../lib/client/src/images/help/grid1.png | Bin 3454 -> 11146 bytes .../client/src/images/help/layout-guide-1.png | Bin 0 -> 27493 bytes .../client/src/images/help/layout-guide-2.png | Bin 0 -> 23139 bytes .../client/src/images/help/layout-guide-3.png | Bin 0 -> 24566 bytes .../client/src/images/help/layout-guide-4.png | Bin 0 -> 23525 bytes .../client/src/images/help/layout-guide-5.png | Bin 0 -> 34589 bytes .../client/src/images/help/layout-guide-6.png | Bin 0 -> 19638 bytes .../client/src/images/help/method-dir-use.png | Bin 0 -> 27248 bytes .../lib/client/src/images/help/method-dir.png | Bin 0 -> 35652 bytes .../client/src/images/help/method-event.png | Bin 0 -> 21888 bytes .../src/images/help/method-lifecycle.png | Bin 0 -> 37019 bytes .../client/src/images/help/method-method.png | Bin 0 -> 17142 bytes .../client/src/images/help/method-remote.png | Bin 0 -> 36513 bytes .../lib/client/src/images/help/page-list.png | Bin 0 -> 81932 bytes .../lib/client/src/images/help/page1.png | Bin 0 -> 81757 bytes .../lib/client/src/images/help/page11.png | Bin 0 -> 67785 bytes .../lib/client/src/images/help/page2.png | Bin 0 -> 64258 bytes .../lib/client/src/images/help/page3.png | Bin 0 -> 96972 bytes .../lib/client/src/images/help/page4.png | Bin 0 -> 261538 bytes .../lib/client/src/images/help/page5.png | Bin 0 -> 230630 bytes .../lib/client/src/images/help/page6.png | Bin 0 -> 239285 bytes .../lib/client/src/images/help/page7.png | Bin 0 -> 210912 bytes .../lib/client/src/images/help/page8.png | Bin 0 -> 207798 bytes .../client/src/images/help/project-list.png | Bin 0 -> 128262 bytes .../src/images/help/variable-directive.png | Bin 0 -> 107999 bytes .../src/images/help/variable-method.png | Bin 0 -> 86069 bytes .../client/src/images/help/variable-prop.png | Bin 0 -> 105763 bytes .../src/images/layout/preview-complex-s.png | Bin 0 -> 3610 bytes .../src/images/layout/preview-complex.png | Bin 0 -> 8173 bytes .../images/layout/preview-left-right-s.png | Bin 0 -> 3635 bytes .../src/images/layout/preview-left-right.png | Bin 0 -> 9338 bytes .../images/layout/preview-top-bottom-s.png | Bin 0 -> 2314 bytes .../src/images/layout/preview-top-bottom.png | Bin 0 -> 5985 bytes .../lib/client/src/images/preview-error.png | Bin 0 -> 6101 bytes paas-ce/lesscode/lib/client/src/images/qq.png | Bin 0 -> 1672 bytes .../lib/client/src/images/svg/add-line.svg | 3 + .../lib/client/src/images/svg/loading.svg | 60 + paas-ce/lesscode/lib/client/src/main.js | 15 +- .../lesscode/lib/client/src/preview/auth.js | 86 + .../lib/client/src/preview/children/404.vue | 34 + .../lib/client/src/preview/component.js | 38 + .../lesscode/lib/client/src/preview/index.js | 118 + .../lesscode/lib/client/src/preview/router.js | 190 ++ .../lesscode/lib/client/src/preview/store.js | 91 + .../lesscode/lib/client/src/router/index.js | 165 +- .../lesscode/lib/client/src/store/index.js | 32 +- .../client/src/store/modules/components.js | 92 +- .../lib/client/src/store/modules/drag.js | 52 +- .../lib/client/src/store/modules/functions.js | 47 +- .../lib/client/src/store/modules/layout.js | 86 + .../lib/client/src/store/modules/logs.js | 71 + .../lib/client/src/store/modules/member.js | 72 + .../lib/client/src/store/modules/page.js | 33 + .../modules/project-code.js} | 21 +- .../lib/client/src/store/modules/project.js | 18 +- .../lib/client/src/store/modules/release.js | 101 + .../lib/client/src/store/modules/route.js | 89 + .../lib/client/src/store/modules/variable.js | 90 + .../lib/client/src/store/modules/vue-code.js | 7 +- .../lib/client/src/views/changelog/index.md | 259 ++ .../src/views/help/docs/case-table-search.md | 65 + .../lib/client/src/views/help/docs/custom.md | 260 +- .../lib/client/src/views/help/docs/develop.md | 76 + .../client/src/views/help/docs/free-layout.md | 31 + .../lib/client/src/views/help/docs/grid.md | 12 +- .../lib/client/src/views/help/docs/intro.md | 2 + .../lib/client/src/views/help/docs/layout.md | 64 + .../lib/client/src/views/help/docs/method.md | 117 + .../lib/client/src/views/help/docs/start.md | 115 +- .../client/src/views/help/docs/variable.md | 59 + .../lib/client/src/views/help/index.css | 61 +- .../lib/client/src/views/help/index.vue | 19 +- .../index/children/component-panel-base.vue | 110 + .../index/children/component-panel-custom.vue | 328 +++ .../index/children/component-panel-mixin.js | 277 ++ .../index/{ => children}/component-search.vue | 44 +- .../views/index/children/component-tree.vue | 384 +++ .../lib/client/src/views/index/index.css | 458 ++- .../lib/client/src/views/index/index.vue | 1273 ++++++--- .../lib/client/src/views/preview/index.vue | 150 +- .../lib/client/src/views/project/basic.vue | 341 +++ .../all/components/operation.vue | 286 ++ .../all/components/render-category.vue | 211 +- .../all/components/render-list.vue | 298 ++ .../component-manage/all/index.vue | 19 +- .../component-manage/index.vue | 3 +- .../project/component-manage/public-scope.vue | 187 ++ .../project/component-manage/useing/index.vue | 234 ++ .../project/component-manage/version-log.vue | 52 + .../src/views/project/function-manage.vue | 108 +- .../lib/client/src/views/project/index.vue | 130 +- .../layout/components/layout-dialog.vue | 278 ++ .../client/src/views/project/layout/index.vue | 386 +++ .../lib/client/src/views/project/logs.vue | 331 +++ .../src/views/project/member-manage.vue | 348 +++ .../lib/client/src/views/project/member.vue | 2 +- .../client/src/views/project/page-json.vue | 42 + .../client/src/views/project/page-setting.vue | 618 +++++ .../src/views/project/page-variable.vue | 107 + .../lib/client/src/views/project/page.vue | 157 +- .../children/bind-route-form.vue | 151 + .../children/bind-route-selector.vue | 171 ++ .../src/views/project/router-manage/index.vue | 822 ++++++ .../src/views/project/variable-manage.vue | 83 + .../button.vue => views/status/404.vue} | 40 +- .../src/views/status/non-exist-project.vue | 75 + .../all/components/operation.vue | 127 - .../all/components/render-list.vue | 83 - .../system/component-manage/useing/index.vue | 54 - .../system/components/download-dialog.vue | 76 + .../views/system/components/project-intro.md | 45 + .../views/system/components/project-intro.vue | 59 + .../lib/client/src/views/system/index.vue | 40 +- .../lib/client/src/views/system/projects.vue | 278 +- paas-ce/lesscode/lib/client/static/demo.zip | Bin 0 -> 93835 bytes .../lib/client/static/images/icon/off.svg | 34 + .../min/vs/language/typescript/tsMode.js | 4 +- .../min/vs/language/typescript/tsWorker.js | 16 +- paas-ce/lesscode/lib/server/app.browser.js | 98 +- .../lib/server/conf/bk-repo.js.example | 29 + .../lib/server/conf/data-base.js.example | 32 +- .../lib/server/conf/db-migrate.json.example | 20 + .../lib/server/conf/demo-page-code.js | 920 +++++++ .../lesscode/lib/server/conf/eslint-config.js | 490 ++++ .../lesscode/lib/server/conf/http.js.example | 12 +- .../lesscode/lib/server/conf/jwt-open-api.pub | 9 + .../lesscode/lib/server/conf/npm.js.example | 33 + .../lesscode/lib/server/conf/operate-log.js | 217 ++ paas-ce/lesscode/lib/server/conf/perm.js | 48 + .../index.js => server/conf/system.js} | 14 +- .../server/controller/component-category.js | 182 +- .../server/controller/component-favourite.js | 83 + .../lib/server/controller/component.js | 926 ++++++- .../server/controller/db-upgrade-helper.js | 898 ++++++ .../lib/server/controller/function.js | 107 +- .../lesscode/lib/server/controller/layout.js | 238 ++ .../lesscode/lib/server/controller/logs.js | 95 + .../lib/server/controller/mock-data.js | 37 +- .../lib/server/controller/open-api.js | 135 + .../lesscode/lib/server/controller/page.js | 345 ++- .../lib/server/controller/project-code.js | 77 + .../lesscode/lib/server/controller/project.js | 111 +- .../lesscode/lib/server/controller/route.js | 330 +++ .../lesscode/lib/server/controller/user.js | 132 + .../lib/server/controller/variable.js | 128 + .../lib/server/controller/vue-code.js | 221 +- paas-ce/lesscode/lib/server/custom-global.js | 28 + .../lib/server/generator/build/common.css.js | 5 + .../server/generator/build/common.methods.js | 0 .../lib/server/generator/build/vue.html.js | 7 + .../lib/server/generator/build/vue.product.js | 25 + .../lib/server/generator/build/vue.script.js | 2 + .../lib/server/generator/director/index.js | 1 + .../server/generator/director/vue.director.js | 55 + .../lesscode/lib/server/generator/index.js | 31 + .../server/generator/process/target-data.js | 31 + paas-ce/lesscode/lib/server/generator/util.js | 9 + paas-ce/lesscode/lib/server/logger.js | 151 +- .../lesscode/lib/server/middleware/auth.js | 21 +- .../lesscode/lib/server/middleware/error.js | 8 + .../lesscode/lib/server/middleware/http.js | 8 +- .../lib/server/middleware/operation-logger.js | 41 + .../lesscode/lib/server/middleware/perm.js | 38 + .../lib/server/middleware/request-context.js | 4 +- .../lib/server/model/comp-favourite.js | 33 + .../lesscode/lib/server/model/comp-share.js | 44 + .../lib/server/model/component-category.js | 67 + .../lesscode/lib/server/model/component.js | 167 ++ .../lib/server/model/entities/base.js | 17 +- .../server/model/entities/comp-category.js | 8 +- .../model/entities/comp-favourite.js} | 21 +- .../model/entities/comp-share.js} | 30 +- .../lib/server/model/entities/comp.js | 33 +- .../lib/server/model/entities/func-func.js | 28 + .../server/model/entities/func-variable.js | 14 + .../lib/server/model/entities/func.js | 8 + .../lib/server/model/entities/layout-inst.js | 37 + .../lib/server/model/entities/layout.js | 31 + .../lib/server/model/entities/operate-log.js | 77 + .../lib/server/model/entities/page-comp.js | 28 + .../lib/server/model/entities/page-route.js | 31 + .../server/model/entities/page-variable.js | 17 + .../lib/server/model/entities/page.js | 14 +- .../lib/server/model/entities/project.js | 14 + .../server/model/entities/release-version.js | 61 + .../lib/server/model/entities/route.js | 25 + .../model/entities/token.js} | 37 +- .../server/model/entities/variable-func.js | 14 + .../model/entities/variable-variable.js | 14 + .../lib/server/model/entities/variable.js | 32 + .../lib/server/model/entities/version.js | 23 + paas-ce/lesscode/lib/server/model/function.js | 139 +- paas-ce/lesscode/lib/server/model/layout.js | 53 + .../migrations/20210329081322-init-sql.js | 53 + .../migrations/20210329113820-update-sql.js | 53 + .../migrations/20210426083005-update-sql.js | 53 + .../migrations/20210510035758-update-sql.js | 53 + .../migrations/20210524075300-update-sql.js | 53 + .../sqls/20210329081322-init-sql-down.sql | 0 .../sqls/20210329081322-init-sql-up.sql | 658 +++++ .../sqls/20210329113820-update-sql-down.sql | 1 + .../sqls/20210329113820-update-sql-up.sql | 118 + .../sqls/20210426083005-update-sql-down.sql | 1 + .../sqls/20210426083005-update-sql-up.sql | 3 + .../sqls/20210510035758-update-sql-down.sql | 1 + .../sqls/20210510035758-update-sql-up.sql | 104 + .../sqls/20210524075300-update-sql-down.sql | 1 + .../sqls/20210524075300-update-sql-up.sql | 5 + .../lesscode/lib/server/model/operate-log.js | 34 + .../lesscode/lib/server/model/page-code.js | 1530 ++++++++++ .../lesscode/lib/server/model/page-comp.js | 79 + paas-ce/lesscode/lib/server/model/page.js | 150 +- paas-ce/lesscode/lib/server/model/perm.js | 4 +- .../lesscode/lib/server/model/project-code.js | 454 +++ paas-ce/lesscode/lib/server/model/project.js | 257 +- .../lib/server/model/release-version.js | 115 + paas-ce/lesscode/lib/server/model/route.js | 127 + .../model/sql/20200903-v0.0.5/update.sql | 188 ++ .../lib/server/model/sql/20200909/update.sql | 5 + .../model/sql/20200909/updateFunctionCode.js | 69 + .../lib/server/model/sql/20200914/update.sql | 33 + .../lib/server/model/sql/20200922/update.sql | 49 + .../lib/server/model/sql/20200924/update.sql | 23 + .../lib/server/model/sql/20200927/update.sql | 5 + .../lib/server/model/sql/20201014/update.sql | 29 + .../lib/server/model/sql/20201015/update.sql | 5 + .../model/sql/20201016-v0.0.7/update.sql | 35 + .../lib/server/model/sql/20201019/update.sql | 37 + .../lib/server/model/sql/20201020/update.sql | 23 + .../lib/server/model/sql/20201026/update.sql | 25 + .../lib/server/model/sql/20201027/update.sql | 4 + .../lib/server/model/sql/20201109/update.sql | 20 + .../lib/server/model/sql/20201114/update.sql | 5 + .../lib/server/model/sql/20201126/update.sql | 9 + .../lib/server/model/sql/20201128/update.sql | 59 + .../lib/server/model/sql/20201202/update.sql | 5 + .../lib/server/model/sql/20201214/update.sql | 5 + .../lib/server/model/sql/20201215/update.sql | 50 + .../lib/server/model/sql/20201217/update.sql | 6 + .../lib/server/model/sql/20201221/update.sql | 19 + .../lib/server/model/sql/20210125/update.sql | 63 + .../lib/server/model/sql/20210413/update.sql | 104 + .../lib/server/model/sql/20210512/update.sql | 5 + .../lib/server/model/sql/20210604/update.sql | 43 + paas-ce/lesscode/lib/server/model/token.js | 44 + paas-ce/lesscode/lib/server/model/user.js | 87 +- .../lib/server/model/variable-relation.js | 67 + paas-ce/lesscode/lib/server/model/variable.js | 75 + paas-ce/lesscode/lib/server/model/version.js | 35 + paas-ce/lesscode/lib/server/model/vue-code.js | 207 ++ .../project-init-code/.babelrc | 43 + .../project-init-code/.browserslistrc | 2 + .../project-init-code}/.eslintignore | 0 .../project-init-code/.eslintrc.js | 492 ++++ .../project-init-code/.gitignore | 29 + .../project-init-code/.npmignore | 25 + .../project-template/project-init-code/.npmrc | 1 + .../project-init-code/Procfile | 1 + .../project-init-code/README.md | 98 + .../project-init-code/bin/post-compile | 3 + .../project-init-code/bin/pre-compile | 3 + .../project-init-code/bin/pre-heroku | 3 + .../lib/client/build/build-dll.js | 91 + .../lib/client/build/build.js | 33 + .../lib/client/build/conf.js | 30 + .../lib/client/build/dev.env.js | 26 + .../lib/client/build/postcss-plugins.js | 131 + .../lib/client/build/prod.env.js | 23 + .../client/build/replace-static-url-plugin.js | 79 + .../lib/client/build/stag.env.js | 23 + .../lib/client/build/util.js | 39 + .../lib/client/build/webpack.base.conf.js | 164 ++ .../lib/client/build/webpack.dev.conf.js | 118 + .../lib/client/build/webpack.prod.conf.js | 239 ++ .../lib/client/index-dev.html | 28 + .../project-init-code/lib/client/index.html | 27 + .../project-init-code/lib/client/src/App.vue | 55 + .../lib/client/src/api/cached-promise.js | 59 + .../lib/client/src/api/index.js | 226 ++ .../lib/client/src/api/pureAxios.js | 196 ++ .../lib/client/src/api/request-queue.js | 83 + .../lib/client/src/common/auth.js | 119 + .../lib/client/src/common/bkmagic.js | 54 + .../client/src/common/bkui-vue-complex.js} | 7 +- .../lib/client/src/common/bus.js | 5 + .../client/src/common/component-installer.js | 23 + .../lib/client/src/common/demand-import.js | 95 + .../lib/client/src/common/element.js} | 8 +- .../lib/client/src/common/fully-import.js | 4 + .../lib/client/src/common/preload.js | 21 + .../client/src/common/tnpm-version-valid.js | 180 ++ .../lib/client/src/common/util.js | 692 +++++ .../client/src/components/exception/index.vue | 85 + .../lib/client/src/css/app.css | 12 + .../lib/client/src/css/bk-patch.css | 20 + .../lib/client/src/css/mixins/clearfix.css | 10 + .../client/src/css/mixins/create-label.css | 18 + .../lib/client/src/css/mixins/ellipsis.css | 7 + .../lib/client/src/css/mixins/scroller.css | 11 + .../lib/client/src/css/reset.css | 43 + .../lib/client/src/css/variable.css | 37 + .../lib/client/src/images/403.png | Bin 0 -> 9728 bytes .../lib/client/src/images/404.png | Bin 0 -> 9961 bytes .../lib/client/src/images/500.png | Bin 0 -> 11143 bytes .../lib/client/src/images/building.png | Bin 0 -> 8029 bytes .../project-init-code/lib/client/src/main.js | 67 + .../lib/client/src/mixins/.gitkeep | 0 .../lib/client/src/router/index.js | 83 + .../lib/client/src/store/index.js | 114 + .../lib/client/src/store/modules/example.js | 31 + .../lib/client/src/store/modules/variable.js | 27 + .../lib/client/src/views/404.vue | 13 + .../lib/client/src/views/index.vue | 3 + .../lib/client/static/images/favicon.png | Bin 0 -> 1150 bytes .../lib/client/static/lib-manifest.json | 1 + .../lib/client/static/lib.bundle.js | 1 + .../lib/server/app.browser.js | 157 ++ .../lib/server/conf/token.js | 30 + .../lib/server/controller/mock-data.js | 50 + .../lib/server/controller/user.js | 44 + .../project-init-code/lib/server/logger.js | 95 + .../lib/server/middleware/error.js | 33 + .../lib/server/middleware/http.js | 25 + .../lib/server/middleware/json-send.js | 10 + .../lib/server/router/index.js | 30 + .../lib/server/router/mock-data.js | 10 + .../lib/server/router/user.js | 10 + .../project-init-code/lib/server/util.js | 187 ++ .../project-init-code/nodemon.json | 21 + .../project-init-code/package.json | 181 ++ .../project-template/router-template.js | 89 + .../lib/server/router/component-category.js | 4 +- .../lib/server/router/component-favourite.js | 26 + .../lesscode/lib/server/router/component.js | 17 +- .../lib/server/router/db-upgrade-helper.js | 46 + .../lesscode/lib/server/router/function.js | 4 +- paas-ce/lesscode/lib/server/router/index.js | 29 +- paas-ce/lesscode/lib/server/router/layout.js | 41 + .../ellipsis.css => server/router/logs.js} | 26 +- .../lesscode/lib/server/router/mock-data.js | 1 + .../router/open-api.config.js} | 30 +- .../lesscode/lib/server/router/open-api.js | 112 + paas-ce/lesscode/lib/server/router/page.js | 37 +- .../router/project-code.js} | 23 +- paas-ce/lesscode/lib/server/router/project.js | 19 +- paas-ce/lesscode/lib/server/router/route.js | 40 + paas-ce/lesscode/lib/server/router/user.js | 8 +- .../lesscode/lib/server/router/variable.js | 25 + .../lesscode/lib/server/router/vue-code.js | 4 +- .../lib/server/service/operation-logger.js | 182 ++ paas-ce/lesscode/lib/server/test.js | 9 + paas-ce/lesscode/lib/server/util.js | 278 ++ .../lib/server/utils/file-service/index.js | 157 ++ .../lesscode/lib/server/utils/npm/index.js | 91 + .../lib/server/utils/npm/templates/npm.md | 0 .../lib/server/utils/npm/templates/tnpm.md | 0 paas-ce/lesscode/nodemon.json | 8 +- paas-ce/lesscode/package.json | 93 +- 683 files changed, 45211 insertions(+), 34736 deletions(-) create mode 100644 paas-ce/lesscode/docs/install/conf.md create mode 100644 paas-ce/lesscode/lib/client/build/md-highlight.js create mode 100644 paas-ce/lesscode/lib/client/build/md-hljs.js create mode 100644 paas-ce/lesscode/lib/client/preview.html rename paas-ce/lesscode/lib/client/src/{views/preview/index.css => common/bkui-vue-complex.js} (88%) create mode 100644 paas-ce/lesscode/lib/client/src/common/dom-to-image.js rename paas-ce/lesscode/lib/client/src/{custom/x-form/components/utils => common}/dom.js (90%) create mode 100644 paas-ce/lesscode/lib/client/src/common/drag-line.js create mode 100644 paas-ce/lesscode/lib/client/src/common/drag.js rename paas-ce/lesscode/lib/client/src/{custom/x-form/components/popover/index.js => common/element.js} (78%) create mode 100644 paas-ce/lesscode/lib/client/src/common/tnpm-version-valid.js create mode 100644 paas-ce/lesscode/lib/client/src/components/code-viewer/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/member-selector.vue rename paas-ce/lesscode/lib/client/src/components/methods/{funcForm.vue => func-form.vue} (66%) create mode 100644 paas-ce/lesscode/lib/client/src/components/methods/function-helper.js create mode 100644 paas-ce/lesscode/lib/client/src/components/methods/provide-completion.js create mode 100644 paas-ce/lesscode/lib/client/src/components/methods/select-func.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/modifier/icon-select.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/novice-guide/help.png create mode 100644 paas-ce/lesscode/lib/client/src/components/novice-guide/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/project/edit-route-dialog.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/project/layout-thumb-list.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/render/component-wrapper.js create mode 100644 paas-ce/lesscode/lib/client/src/components/render/free-layout.css create mode 100644 paas-ce/lesscode/lib/client/src/components/render/free-layout.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/render/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/render/offsetMixin.js create mode 100644 paas-ce/lesscode/lib/client/src/components/variable/variable-form/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/variable/variable-form/variable-code.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/variable/variable-form/variable-input.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/variable/variable-form/variable-json.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/variable/variable-form/variable-switcher.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/variable/variable-form/variable-upload.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/variable/variable-form/variable.mixin.js create mode 100644 paas-ce/lesscode/lib/client/src/components/variable/variable-select.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/variable/variable-table.vue delete mode 100644 paas-ce/lesscode/lib/client/src/components/vue-code/code-mixin.js create mode 100644 paas-ce/lesscode/lib/client/src/components/widget/context-menu.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/widget/layout/components/complex.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/widget/layout/components/empty.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/widget/layout/components/left-right.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/widget/layout/components/logo.png create mode 100644 paas-ce/lesscode/lib/client/src/components/widget/layout/components/top-bottom.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/widget/layout/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/widget/tree/transition.js create mode 100644 paas-ce/lesscode/lib/client/src/components/widget/tree/tree-item.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/widget/tree/tree-node.js create mode 100644 paas-ce/lesscode/lib/client/src/components/widget/tree/tree.vue create mode 100644 paas-ce/lesscode/lib/client/src/components/widget/tree/utils.js create mode 100644 paas-ce/lesscode/lib/client/src/css/mixins/transition.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/components.json delete mode 100644 paas-ce/lesscode/lib/client/src/custom/index.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/button/button.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/button/button.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/button/create-button-hover.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/button/create-button.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/css/spinner.svg delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/css/variable.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/input/input.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/input/input.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/loading/directive.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/loading/index.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/loading/loading.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/loading/loading.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/loading/loading.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/mixins/emitter.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/popover/popover.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/popover/popover.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/select/option-all.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/select/option-group.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/select/option.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/select/select.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/select/select.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/utils/pop-manager.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/utils/tippy/index.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/utils/tippy/popper.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/components/utils/z-index-manager.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/config.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/index.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-form/index.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-input/config.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/button/button.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/button/button.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/button/create-button-hover.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/button/create-button.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/css/spinner.svg delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/css/variable.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/loading/directive.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/loading/index.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/loading/loading.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/loading/loading.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/loading/loading.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/mixins/emitter.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/mixins/z-index.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/popover/popover.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/popover/popover.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/select/option-all.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/select/option-group.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/select/option.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/select/select.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/select/select.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/utils/dom.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/utils/pop-manager.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/utils/tippy/index.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/utils/tippy/popper.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/components/utils/z-index-manager.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/config.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/index.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-script/index.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/button/button.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/button/button.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/button/create-button-hover.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/button/create-button.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/css/spinner.svg delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/css/variable.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/input/input.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/input/input.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/loading/directive.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/loading/index.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/loading/loading.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/loading/loading.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/loading/loading.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/mixins/emitter.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/popover/popover.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/popover/popover.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/select/option-all.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/select/option-group.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/select/option.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/select/select.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/select/select.vue delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/utils/dom.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/utils/pop-manager.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/utils/tippy/index.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/utils/tippy/popper.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/components/utils/z-index-manager.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/config.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/index.css delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/index.js delete mode 100644 paas-ce/lesscode/lib/client/src/custom/x-table/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/materials/bk/alert/index.js rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/animate-number/index.js (85%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/badge/index.js (98%) create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/materials/bk/big-tree/index.js create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/materials/bk/bread-crumb/index.js rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/button/index.js (91%) create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/materials/bk/card/index.js create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/materials/bk/cascade/index.js rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/charts-bar/index.js (75%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/charts-line/index.js (77%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/charts-pie/index.js (76%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/checkbox-group/index.js (81%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/collapse/index.js (95%) create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/materials/bk/color-picker/index.js rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/date-picker/index.js (90%) create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/materials/bk/dialog/index.js rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/diff/index.js (75%) rename paas-ce/lesscode/lib/client/src/{custom/x-button/config.js => element-materials/materials/bk/divider/index.js} (54%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/exception/index.js (98%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/form/index.js (100%) rename paas-ce/lesscode/lib/client/src/{custom/x-table/components/mixins/z-index.js => element-materials/materials/bk/free-layout/index.js} (63%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/grid/base.js (95%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/grid/column1.js (100%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/grid/column2.js (100%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/grid/column3.js (100%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/grid/column4.js (100%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/grid/extends.js (94%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/image/index.js (88%) create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/materials/bk/index.js rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/input/index.js (94%) create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/materials/bk/link/index.js rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/pagination/index.js (93%) create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/materials/bk/paragraph/index.js create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/materials/bk/popconfirm/index.js create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/materials/bk/popover/index.js create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/materials/bk/process/index.js rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/progress/index.js (93%) create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/materials/bk/radio-button-group/index.js rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/radio-group/index.js (86%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/rate/index.js (100%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/round-progress/index.js (87%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/search-select/index.js (94%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/select/index.js (83%) create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/materials/bk/sideslider/index.js rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/slider/index.js (89%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/steps/index.js (71%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/swiper/index.js (89%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/switcher/index.js (91%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/tab/index.js (97%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/table/index.js (88%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/tag-input/index.js (95%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/text/index.js (75%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/time-picker/index.js (92%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/timeline/index.js (85%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/transfer/index.js (94%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/tree/index.js (76%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/upload/index.js (83%) rename paas-ce/lesscode/lib/client/src/element-materials/materials/{ => bk}/zoom-image/index.js (98%) create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/materials/element/button/index.js rename paas-ce/lesscode/lib/client/src/{custom/x-input => element-materials/materials/element}/index.js (59%) create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/materials/element/link/index.js create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/materials/icon-list.js create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/component/directives/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/component/events/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/component/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/component/props/components/render-prop.vue rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/props/components/strategy/boolean.vue (93%) rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/props/components/strategy/checkbox.vue (91%) rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/props/components/strategy/collapse.vue (98%) rename paas-ce/lesscode/lib/client/src/{custom/x-input/input.vue => element-materials/modifier/component/props/components/strategy/color.vue} (57%) rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/props/components/strategy/column.vue (96%) create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/component/props/components/strategy/float.vue rename paas-ce/lesscode/lib/client/src/{views/404.vue => element-materials/modifier/component/props/components/strategy/free-layout-item.vue} (68%) create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/component/props/components/strategy/function.vue create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/component/props/components/strategy/icon.vue rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{props/components/strategy/jsonView.vue => component/props/components/strategy/json-view.vue} (95%) rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/props/components/strategy/number.vue (98%) rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/props/components/strategy/option.vue (67%) create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/component/props/components/strategy/radio-button.vue rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/props/components/strategy/radio.vue (92%) create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/component/props/components/strategy/remote.vue create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/component/props/components/strategy/select.vue create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/component/props/components/strategy/slot-wrapper.vue rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{props/components/strategy/text.vue => component/props/components/strategy/slot.vue} (86%) rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/props/components/strategy/string.vue (91%) rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/props/components/strategy/tab-panel.vue (80%) create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/component/props/components/strategy/table-column.vue create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/component/props/components/strategy/text.vue create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/component/props/components/strategy/textarea.vue rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/props/index.vue (52%) rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/styles/index.vue (83%) rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/styles/layout/index.vue (97%) rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/styles/layout/item.vue (97%) rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/styles/strategy/background-color.vue (100%) rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/styles/strategy/border.vue (94%) rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/styles/strategy/color.vue (100%) create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/component/styles/strategy/custom-style.vue rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/styles/strategy/display.vue (100%) rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/styles/strategy/font.vue (100%) rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/styles/strategy/margin.vue (85%) create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/component/styles/strategy/monaco.vue rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/styles/strategy/padding.vue (100%) rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/styles/strategy/size.vue (89%) rename paas-ce/lesscode/lib/client/src/element-materials/modifier/{ => component}/styles/strategy/text-align.vue (100%) delete mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/events/index.vue delete mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/props/components/render-prop.vue delete mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/props/components/strategy/remote.vue delete mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/props/components/strategy/select.vue delete mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/props/components/strategy/table-column.vue delete mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/props/components/strategy/textarea.vue create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/template/complex-side/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/template/complex-top/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/template/editor/menu/edit.vue create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/template/editor/menu/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/template/editor/prop/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/template/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/template/info.vue create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/template/side-menu/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/template/top-menu/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/element-materials/modifier/template/utils/index.js create mode 100644 paas-ce/lesscode/lib/client/src/images/help/case-table1.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/case-table10.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/case-table2.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/case-table3.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/case-table4.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/case-table5.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/case-table6.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/case-table7.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/case-table8.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/case-table9.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/component-create.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/component-operation.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/component-upload.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/component-use.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/create-page.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/create-proj.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/develop1.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/develop2.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/free-layout1.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/free-layout2.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/free-layout3.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/free-layout4.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/free-layout5.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/layout-guide-1.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/layout-guide-2.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/layout-guide-3.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/layout-guide-4.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/layout-guide-5.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/layout-guide-6.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/method-dir-use.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/method-dir.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/method-event.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/method-lifecycle.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/method-method.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/method-remote.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/page-list.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/page1.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/page11.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/page2.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/page3.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/page4.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/page5.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/page6.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/page7.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/page8.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/project-list.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/variable-directive.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/variable-method.png create mode 100644 paas-ce/lesscode/lib/client/src/images/help/variable-prop.png create mode 100644 paas-ce/lesscode/lib/client/src/images/layout/preview-complex-s.png create mode 100644 paas-ce/lesscode/lib/client/src/images/layout/preview-complex.png create mode 100644 paas-ce/lesscode/lib/client/src/images/layout/preview-left-right-s.png create mode 100644 paas-ce/lesscode/lib/client/src/images/layout/preview-left-right.png create mode 100644 paas-ce/lesscode/lib/client/src/images/layout/preview-top-bottom-s.png create mode 100644 paas-ce/lesscode/lib/client/src/images/layout/preview-top-bottom.png create mode 100644 paas-ce/lesscode/lib/client/src/images/preview-error.png create mode 100644 paas-ce/lesscode/lib/client/src/images/qq.png create mode 100644 paas-ce/lesscode/lib/client/src/images/svg/add-line.svg create mode 100644 paas-ce/lesscode/lib/client/src/images/svg/loading.svg create mode 100644 paas-ce/lesscode/lib/client/src/preview/auth.js create mode 100644 paas-ce/lesscode/lib/client/src/preview/children/404.vue create mode 100644 paas-ce/lesscode/lib/client/src/preview/component.js create mode 100644 paas-ce/lesscode/lib/client/src/preview/index.js create mode 100644 paas-ce/lesscode/lib/client/src/preview/router.js create mode 100644 paas-ce/lesscode/lib/client/src/preview/store.js create mode 100644 paas-ce/lesscode/lib/client/src/store/modules/layout.js create mode 100644 paas-ce/lesscode/lib/client/src/store/modules/logs.js create mode 100644 paas-ce/lesscode/lib/client/src/store/modules/member.js rename paas-ce/lesscode/lib/client/src/{custom/x-form/components/mixins/z-index.js => store/modules/project-code.js} (68%) create mode 100644 paas-ce/lesscode/lib/client/src/store/modules/release.js create mode 100644 paas-ce/lesscode/lib/client/src/store/modules/route.js create mode 100644 paas-ce/lesscode/lib/client/src/store/modules/variable.js create mode 100644 paas-ce/lesscode/lib/client/src/views/help/docs/case-table-search.md create mode 100644 paas-ce/lesscode/lib/client/src/views/help/docs/develop.md create mode 100644 paas-ce/lesscode/lib/client/src/views/help/docs/free-layout.md create mode 100644 paas-ce/lesscode/lib/client/src/views/help/docs/layout.md create mode 100644 paas-ce/lesscode/lib/client/src/views/help/docs/method.md create mode 100644 paas-ce/lesscode/lib/client/src/views/help/docs/variable.md create mode 100644 paas-ce/lesscode/lib/client/src/views/index/children/component-panel-base.vue create mode 100644 paas-ce/lesscode/lib/client/src/views/index/children/component-panel-custom.vue create mode 100644 paas-ce/lesscode/lib/client/src/views/index/children/component-panel-mixin.js rename paas-ce/lesscode/lib/client/src/views/index/{ => children}/component-search.vue (89%) create mode 100644 paas-ce/lesscode/lib/client/src/views/index/children/component-tree.vue create mode 100644 paas-ce/lesscode/lib/client/src/views/project/basic.vue create mode 100644 paas-ce/lesscode/lib/client/src/views/project/component-manage/all/components/operation.vue rename paas-ce/lesscode/lib/client/src/views/{system => project}/component-manage/all/components/render-category.vue (51%) create mode 100644 paas-ce/lesscode/lib/client/src/views/project/component-manage/all/components/render-list.vue rename paas-ce/lesscode/lib/client/src/views/{system => project}/component-manage/all/index.vue (55%) rename paas-ce/lesscode/lib/client/src/views/{system => project}/component-manage/index.vue (97%) create mode 100644 paas-ce/lesscode/lib/client/src/views/project/component-manage/public-scope.vue create mode 100644 paas-ce/lesscode/lib/client/src/views/project/component-manage/useing/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/views/project/component-manage/version-log.vue create mode 100644 paas-ce/lesscode/lib/client/src/views/project/layout/components/layout-dialog.vue create mode 100644 paas-ce/lesscode/lib/client/src/views/project/layout/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/views/project/logs.vue create mode 100644 paas-ce/lesscode/lib/client/src/views/project/member-manage.vue create mode 100644 paas-ce/lesscode/lib/client/src/views/project/page-json.vue create mode 100644 paas-ce/lesscode/lib/client/src/views/project/page-setting.vue create mode 100644 paas-ce/lesscode/lib/client/src/views/project/page-variable.vue create mode 100644 paas-ce/lesscode/lib/client/src/views/project/router-manage/children/bind-route-form.vue create mode 100644 paas-ce/lesscode/lib/client/src/views/project/router-manage/children/bind-route-selector.vue create mode 100644 paas-ce/lesscode/lib/client/src/views/project/router-manage/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/views/project/variable-manage.vue rename paas-ce/lesscode/lib/client/src/{custom/x-button/button.vue => views/status/404.vue} (58%) create mode 100644 paas-ce/lesscode/lib/client/src/views/status/non-exist-project.vue delete mode 100644 paas-ce/lesscode/lib/client/src/views/system/component-manage/all/components/operation.vue delete mode 100644 paas-ce/lesscode/lib/client/src/views/system/component-manage/all/components/render-list.vue delete mode 100644 paas-ce/lesscode/lib/client/src/views/system/component-manage/useing/index.vue create mode 100644 paas-ce/lesscode/lib/client/src/views/system/components/download-dialog.vue create mode 100644 paas-ce/lesscode/lib/client/src/views/system/components/project-intro.md create mode 100644 paas-ce/lesscode/lib/client/src/views/system/components/project-intro.vue create mode 100644 paas-ce/lesscode/lib/client/static/demo.zip create mode 100644 paas-ce/lesscode/lib/client/static/images/icon/off.svg create mode 100644 paas-ce/lesscode/lib/server/conf/bk-repo.js.example create mode 100644 paas-ce/lesscode/lib/server/conf/db-migrate.json.example create mode 100644 paas-ce/lesscode/lib/server/conf/demo-page-code.js create mode 100644 paas-ce/lesscode/lib/server/conf/eslint-config.js create mode 100644 paas-ce/lesscode/lib/server/conf/jwt-open-api.pub create mode 100644 paas-ce/lesscode/lib/server/conf/npm.js.example create mode 100644 paas-ce/lesscode/lib/server/conf/operate-log.js create mode 100644 paas-ce/lesscode/lib/server/conf/perm.js rename paas-ce/lesscode/lib/{client/src/custom/x-button/index.js => server/conf/system.js} (76%) create mode 100644 paas-ce/lesscode/lib/server/controller/component-favourite.js create mode 100644 paas-ce/lesscode/lib/server/controller/db-upgrade-helper.js create mode 100644 paas-ce/lesscode/lib/server/controller/layout.js create mode 100644 paas-ce/lesscode/lib/server/controller/logs.js create mode 100644 paas-ce/lesscode/lib/server/controller/open-api.js create mode 100644 paas-ce/lesscode/lib/server/controller/project-code.js create mode 100644 paas-ce/lesscode/lib/server/controller/route.js create mode 100644 paas-ce/lesscode/lib/server/controller/variable.js create mode 100644 paas-ce/lesscode/lib/server/custom-global.js create mode 100644 paas-ce/lesscode/lib/server/generator/build/common.css.js create mode 100644 paas-ce/lesscode/lib/server/generator/build/common.methods.js create mode 100644 paas-ce/lesscode/lib/server/generator/build/vue.html.js create mode 100644 paas-ce/lesscode/lib/server/generator/build/vue.product.js create mode 100644 paas-ce/lesscode/lib/server/generator/build/vue.script.js create mode 100644 paas-ce/lesscode/lib/server/generator/director/index.js create mode 100644 paas-ce/lesscode/lib/server/generator/director/vue.director.js create mode 100644 paas-ce/lesscode/lib/server/generator/index.js create mode 100644 paas-ce/lesscode/lib/server/generator/process/target-data.js create mode 100644 paas-ce/lesscode/lib/server/generator/util.js create mode 100644 paas-ce/lesscode/lib/server/middleware/operation-logger.js create mode 100644 paas-ce/lesscode/lib/server/middleware/perm.js create mode 100644 paas-ce/lesscode/lib/server/model/comp-favourite.js create mode 100644 paas-ce/lesscode/lib/server/model/comp-share.js create mode 100644 paas-ce/lesscode/lib/server/model/component-category.js create mode 100644 paas-ce/lesscode/lib/server/model/component.js rename paas-ce/lesscode/lib/{client/src/custom/x-table/components/css/ellipsis.css => server/model/entities/comp-favourite.js} (70%) rename paas-ce/lesscode/lib/{client/src/custom/x-form/components/css/scroller.css => server/model/entities/comp-share.js} (63%) create mode 100644 paas-ce/lesscode/lib/server/model/entities/func-func.js create mode 100644 paas-ce/lesscode/lib/server/model/entities/func-variable.js create mode 100644 paas-ce/lesscode/lib/server/model/entities/layout-inst.js create mode 100644 paas-ce/lesscode/lib/server/model/entities/layout.js create mode 100644 paas-ce/lesscode/lib/server/model/entities/operate-log.js create mode 100644 paas-ce/lesscode/lib/server/model/entities/page-comp.js create mode 100644 paas-ce/lesscode/lib/server/model/entities/page-route.js create mode 100644 paas-ce/lesscode/lib/server/model/entities/page-variable.js create mode 100644 paas-ce/lesscode/lib/server/model/entities/release-version.js create mode 100644 paas-ce/lesscode/lib/server/model/entities/route.js rename paas-ce/lesscode/lib/{client/src/custom/x-script/components/css/scroller.css => server/model/entities/token.js} (62%) create mode 100644 paas-ce/lesscode/lib/server/model/entities/variable-func.js create mode 100644 paas-ce/lesscode/lib/server/model/entities/variable-variable.js create mode 100644 paas-ce/lesscode/lib/server/model/entities/variable.js create mode 100644 paas-ce/lesscode/lib/server/model/entities/version.js create mode 100644 paas-ce/lesscode/lib/server/model/layout.js create mode 100644 paas-ce/lesscode/lib/server/model/migrations/20210329081322-init-sql.js create mode 100644 paas-ce/lesscode/lib/server/model/migrations/20210329113820-update-sql.js create mode 100644 paas-ce/lesscode/lib/server/model/migrations/20210426083005-update-sql.js create mode 100644 paas-ce/lesscode/lib/server/model/migrations/20210510035758-update-sql.js create mode 100644 paas-ce/lesscode/lib/server/model/migrations/20210524075300-update-sql.js create mode 100644 paas-ce/lesscode/lib/server/model/migrations/sqls/20210329081322-init-sql-down.sql create mode 100644 paas-ce/lesscode/lib/server/model/migrations/sqls/20210329081322-init-sql-up.sql create mode 100644 paas-ce/lesscode/lib/server/model/migrations/sqls/20210329113820-update-sql-down.sql create mode 100644 paas-ce/lesscode/lib/server/model/migrations/sqls/20210329113820-update-sql-up.sql create mode 100644 paas-ce/lesscode/lib/server/model/migrations/sqls/20210426083005-update-sql-down.sql create mode 100644 paas-ce/lesscode/lib/server/model/migrations/sqls/20210426083005-update-sql-up.sql create mode 100644 paas-ce/lesscode/lib/server/model/migrations/sqls/20210510035758-update-sql-down.sql create mode 100644 paas-ce/lesscode/lib/server/model/migrations/sqls/20210510035758-update-sql-up.sql create mode 100644 paas-ce/lesscode/lib/server/model/migrations/sqls/20210524075300-update-sql-down.sql create mode 100644 paas-ce/lesscode/lib/server/model/migrations/sqls/20210524075300-update-sql-up.sql create mode 100644 paas-ce/lesscode/lib/server/model/operate-log.js create mode 100644 paas-ce/lesscode/lib/server/model/page-code.js create mode 100644 paas-ce/lesscode/lib/server/model/page-comp.js create mode 100644 paas-ce/lesscode/lib/server/model/project-code.js create mode 100644 paas-ce/lesscode/lib/server/model/release-version.js create mode 100644 paas-ce/lesscode/lib/server/model/route.js create mode 100644 paas-ce/lesscode/lib/server/model/sql/20200903-v0.0.5/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20200909/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20200909/updateFunctionCode.js create mode 100644 paas-ce/lesscode/lib/server/model/sql/20200914/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20200922/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20200924/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20200927/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20201014/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20201015/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20201016-v0.0.7/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20201019/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20201020/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20201026/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20201027/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20201109/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20201114/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20201126/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20201128/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20201202/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20201214/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20201215/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20201217/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20201221/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20210125/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20210413/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20210512/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/sql/20210604/update.sql create mode 100644 paas-ce/lesscode/lib/server/model/token.js create mode 100644 paas-ce/lesscode/lib/server/model/variable-relation.js create mode 100644 paas-ce/lesscode/lib/server/model/variable.js create mode 100644 paas-ce/lesscode/lib/server/model/version.js create mode 100644 paas-ce/lesscode/lib/server/model/vue-code.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/.babelrc create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/.browserslistrc rename paas-ce/lesscode/{ => lib/server/project-template/project-init-code}/.eslintignore (100%) create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/.eslintrc.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/.gitignore create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/.npmignore create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/.npmrc create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/Procfile create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/README.md create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/bin/post-compile create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/bin/pre-compile create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/bin/pre-heroku create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/build/build-dll.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/build/build.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/build/conf.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/build/dev.env.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/build/postcss-plugins.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/build/prod.env.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/build/replace-static-url-plugin.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/build/stag.env.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/build/util.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/build/webpack.base.conf.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/build/webpack.dev.conf.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/build/webpack.prod.conf.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/index-dev.html create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/index.html create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/App.vue create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/api/cached-promise.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/api/index.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/api/pureAxios.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/api/request-queue.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/common/auth.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/common/bkmagic.js rename paas-ce/lesscode/lib/{client/src/custom/x-table/components/popover/index.js => server/project-template/project-init-code/lib/client/src/common/bkui-vue-complex.js} (80%) create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/common/bus.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/common/component-installer.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/common/demand-import.js rename paas-ce/lesscode/lib/{client/src/custom/x-script/components/popover/index.js => server/project-template/project-init-code/lib/client/src/common/element.js} (78%) create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/common/fully-import.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/common/preload.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/common/tnpm-version-valid.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/common/util.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/components/exception/index.vue create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/css/app.css create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/css/bk-patch.css create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/css/mixins/clearfix.css create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/css/mixins/create-label.css create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/css/mixins/ellipsis.css create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/css/mixins/scroller.css create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/css/reset.css create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/css/variable.css create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/images/403.png create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/images/404.png create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/images/500.png create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/images/building.png create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/main.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/mixins/.gitkeep create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/router/index.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/store/index.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/store/modules/example.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/store/modules/variable.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/views/404.vue create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/src/views/index.vue create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/static/images/favicon.png create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/static/lib-manifest.json create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/client/static/lib.bundle.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/server/app.browser.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/server/conf/token.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/server/controller/mock-data.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/server/controller/user.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/server/logger.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/server/middleware/error.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/server/middleware/http.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/server/middleware/json-send.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/server/router/index.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/server/router/mock-data.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/server/router/user.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/lib/server/util.js create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/nodemon.json create mode 100644 paas-ce/lesscode/lib/server/project-template/project-init-code/package.json create mode 100644 paas-ce/lesscode/lib/server/project-template/router-template.js create mode 100644 paas-ce/lesscode/lib/server/router/component-favourite.js create mode 100644 paas-ce/lesscode/lib/server/router/db-upgrade-helper.js create mode 100644 paas-ce/lesscode/lib/server/router/layout.js rename paas-ce/lesscode/lib/{client/src/custom/x-form/components/css/ellipsis.css => server/router/logs.js} (74%) rename paas-ce/lesscode/lib/{client/src/custom/x-table/components/css/scroller.css => server/router/open-api.config.js} (59%) create mode 100644 paas-ce/lesscode/lib/server/router/open-api.js rename paas-ce/lesscode/lib/{client/src/custom/x-script/components/css/ellipsis.css => server/router/project-code.js} (72%) create mode 100644 paas-ce/lesscode/lib/server/router/route.js create mode 100644 paas-ce/lesscode/lib/server/router/variable.js create mode 100644 paas-ce/lesscode/lib/server/service/operation-logger.js create mode 100644 paas-ce/lesscode/lib/server/test.js create mode 100644 paas-ce/lesscode/lib/server/utils/file-service/index.js create mode 100644 paas-ce/lesscode/lib/server/utils/npm/index.js create mode 100644 paas-ce/lesscode/lib/server/utils/npm/templates/npm.md create mode 100644 paas-ce/lesscode/lib/server/utils/npm/templates/tnpm.md diff --git a/paas-ce/lesscode/.eslintrc.js b/paas-ce/lesscode/.eslintrc.js index 171060591..dcc7d46e4 100644 --- a/paas-ce/lesscode/.eslintrc.js +++ b/paas-ce/lesscode/.eslintrc.js @@ -125,6 +125,22 @@ module.exports = { // 如果一个变量不会被重新赋值,必须使用 `const` 进行声明。 'prefer-const': 'error', + // eslint-plugin-vue@7 新增的规则,暂时先全部关闭 + 'vue/no-dupe-v-else-if': 'off', + 'vue/component-definition-name-casing': 'off', + 'vue/one-component-per-file': 'off', + 'vue/v-slot-style': 'off', + 'vue/no-arrow-functions-in-watch': 'off', + 'vue/no-custom-modifiers-on-v-model': 'off', + 'vue/no-multiple-template-root': 'off', + 'vue/no-mutating-props': 'off', + 'vue/no-v-for-template-key': 'off', + 'vue/no-v-model-argument': 'off', + 'vue/valid-v-bind-sync': 'off', + 'vue/valid-v-slot': 'off', + 'vue/experimental-script-setup-vars': 'off', + 'vue/no-lone-template': 'off', + // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/array-bracket-spacing.md 'vue/array-bracket-spacing': ['error', 'never'], diff --git a/paas-ce/lesscode/.gitignore b/paas-ce/lesscode/.gitignore index f3b76f6ce..fefb9ff79 100644 --- a/paas-ce/lesscode/.gitignore +++ b/paas-ce/lesscode/.gitignore @@ -3,6 +3,7 @@ node_modules npm-debug.log yarn-error.log +yarn.lock selenium-debug.log test/unit/coverage test/e2e/reports @@ -12,10 +13,12 @@ templates_c/ compile output logs +v3logs sock pids *bak* *.0 +*.local* .example-cache .idea lib/client/.webpack_cache @@ -25,6 +28,16 @@ lib/client/.webpack_cache lib/client/static/lib-manifest.json lib/client/static/lib.bundle.js lib/client/static/vue-layout-demo*.vue -!lib/client/static/ResizeSensor.js +upload +!lib/client/src/element-materials/**/upload +temp +npmTemp lib/server/conf/data-base.js lib/server/conf/http.js +lib/server/conf/db-migrate.json +lib/server/conf/npm.js +lib/server/conf/bk-repo.js + +!lib/server/project-template/project-init-code/bin +lib/server/project-template/project-target* +lib/server/project-template/bklesscode-proj* diff --git a/paas-ce/lesscode/README.md b/paas-ce/lesscode/README.md index 19d064238..1d4e29cbd 100644 --- a/paas-ce/lesscode/README.md +++ b/paas-ce/lesscode/README.md @@ -7,6 +7,7 @@ - 可视化拖拽布局:集成蓝鲸MagicBox Vue通用组件,支持在线画布拖拽组件进行页面布局编辑、在线预览、查看及下载源码 - 在线函数库管理:支持在线灵活编写管理事件函数及远程接口返回数据清洗函数 - 在线组件配置:支持组件样式、属性、事件在线配置 +- 布局模板:提供多种导航布局模板 - 支持自定义组件开发:提供自定义组件开发规范及示例,开放自定义组件开发能力,满足业务场景组件集成需求 - 二次开发能力:生成的Vue源码文件支持无缝集成到蓝鲸前端开发框架([BKUI-CLI](https://bk.tencent.com/docs/document/5.1/19/583))进行二次开发 @@ -24,6 +25,7 @@ │   │      ...... │   │   ├── index-dev.html # 本地开发使用的 html │   │   ├── index.html # 生产环境使用的 html +│   │   ├── preview.html # 预览模块使用的 html │   │   ├── require-monaco.html # 辅助引入 monaco 编辑器的 html │   │   ├── src/ # 前端源码目录 │   │   │   ├── App.vue # App 组件 @@ -36,14 +38,11 @@ │   │   │      ...... │   │   │   ├── css/ # 前端 css 目录 │   │   │       ...... -│   │   │   ├── custom/ # 自定义组件的存放目录 -│   │   │   │   ├── index.js # 自定义组件的入口文件,如增加自定义组件,需要在此文件中注册 -│   │   │   │   ...... │   │   │   ├── element-materials/ # 基础组件的配置以及修改配置和页面渲染的逻辑 │   │   │   │      ...... │   │   │   ├── images/ # 前端使用的图片存放目录 │   │   │      ..... -│   │   │   ├── mixins/ # 前端使用的 mixins +│   │   │   ├── preview/ # 前端预览模块 目录 │   │   │      ...... │   │   │   ├── router/ # 前端 router 目录 │   │   │      ...... @@ -65,12 +64,17 @@ │   │   ...... │   ├── model/ # 后端实体目录 │   │   ...... +│   ├── project-template/ # 后端生成项目源码模板 +│   │   ...... │   ├── router/ # 后端路由目录 │   │   ...... │   ├── service/ # 后端服务目录 │   │   ...... +│   ├── utils/ # 后端utils 目录 +│   │   ...... ├── nodemon.json # nodemon 配置文件 ├── package.json # 项目描述文件 +├── forever.json # forever 配置文件 ``` ## 技术栈 @@ -82,10 +86,16 @@ ## 依赖说明 +#### 环境依赖 项目主要的依赖是目前常用的比较新的模块,webpack@4,babel@7,vue@2,koa@2 等。**运行的 nodejs 要求为 >= 8.9.0**。 > 安装 Node.js 参见[官方文档](https://nodejs.org/)。安装完成后,注意设置 node 到 PATH 中 +#### 服务依赖 +- 蓝鲸社区版登录(必须):可视化平台的登录服务对接的是蓝鲸社区版登录,请事先搭建蓝鲸社区版环境 +- 蓝鲸制品库服务(非必须): 若需要使用到平台的自定义组件功能开发模块,请事先搭建 [蓝鲸制品库服务](https://github.com/Tencent/bk-ci/tree/master/src/backend/storage/core) +- npm镜像仓库(非必须):若需要使用到平台的自定义组件功能开发模块,请事先搭建npm镜像仓库 + ## 分支说明 可视化开发平台使用 lesscode-develop, lesscode-master 两个分支进行迭代。其中 lesscode-master 为稳定版分支,每次 release 都会基于这个分支;lesscode-develop 为日常开发的分支,给可视化开发平台贡献代码统一向主库 [bk-PaaS](https://github.com/Tencent/bk-PaaS) 的 [lesscode-develop](https://github.com/Tencent/bk-PaaS/tree/lesscode-develop) 分支提 pr。 @@ -93,7 +103,7 @@ - [本地开发部署](./docs/install/dev_install.md) - [生产环境部署](./docs/install/prod_install.md) - [数据库说明](./docs/install/database.md) +- [配置文件说明](./docs/install/conf.md) ## 开发文档 -- [自定义组件开发文档](./docs/develop/dev_com.md) -- [自定义组件管理文档](./docs/develop/release_com.md) +- [自定义组件开发和管理文档](./lib/client/src/views/help/docs/custom.md) diff --git a/paas-ce/lesscode/docs/install/conf.md b/paas-ce/lesscode/docs/install/conf.md new file mode 100644 index 000000000..86f096d5e --- /dev/null +++ b/paas-ce/lesscode/docs/install/conf.md @@ -0,0 +1,30 @@ +# 蓝鲸智云PaaS平台社区版之可视化开发平台 + +## 配置文件说明 + +在将代码拉取到本地准备开发之前,需先将配置信息填写好,相应的配置文件都位于`lesscode/lib/server/conf`目录下, + +- 其中必须配置的文件为data-base.js、db-migrate.json、http.js +- 可选的配置文件为npm.js和bk-repo.js + +### 各配置文件说明如下: + +#### data-base.js (用于数据库的连接) + +在 `lesscode/lib/server/conf` 中新建 `data-base.js` 文件(复制 `data-base.js.example`,并删除 `.example`即可)。然后依照 [data-base.js.example](../../lib/server/conf/data-base.js.example) 的注释填写本地开发和线上运行时的数据库的配置信息。 + +#### lesscode/lib/server/conf/db-migrate.json (用于自动执行db导入和变更) + +在 `lesscode/lib/server/conf` 中新建 `db-migrate.json` 文件(复制 `db-migrate.json.example`,并删除 `.example`即可)。然后依照 [db-migrate.json.example](../../lib/server/conf/db-migrate.json.example) 的注释填写本地开发和线上运行时的数据库的配置信息。 + +#### http.js (蓝鲸社区版相关配置) + +在 `lesscode/lib/server/conf` 中新建 `http.js` 文件(复制 `http.js.example`,并删除 `.example`即可)。然后依照 [http.js.example](../../lib/server/conf/http.js.example) 的注释填写本地开发和线上运行时蓝鲸社区版的配置信息。 + +#### bk-repo.js (蓝鲸制品库相关配置,用到自定义组件功能时需填写,未用到则可以忽略此文件) + +在 `lesscode/lib/server/conf` 中新建 `bk-repo.js` 文件(复制 `bk-repo.js.example`,并删除 `.example`即可)。然后依照 [bk-repo.js.example](../../lib/server/conf/bk-repo.js.example) 的注释填写本地开发和线上运行时蓝鲸制品库的配置信息。 + +#### npm.js (npm镜像仓库配置,用到自定义组件功能时需填写,未用到则可以忽略此文件) + +在 `lesscode/lib/server/conf` 中新建 `npm.js` 文件(复制 `npm.js.example`,并删除 `.example`即可)。然后依照 [npm.js.example](../../lib/server/conf/npm.js.example) 的注释填写本地开发和线上运行时的npm镜像仓库的配置信息。 diff --git a/paas-ce/lesscode/docs/install/database.md b/paas-ce/lesscode/docs/install/database.md index fe6d9496f..dbe4cf170 100644 --- a/paas-ce/lesscode/docs/install/database.md +++ b/paas-ce/lesscode/docs/install/database.md @@ -2,16 +2,23 @@ ## 数据库说明 -需要用户自己提供 MySQL 服务并做 db 授权。本地开发和生产环境的数据库初始化和变更流程是一样的,都需要自己执行SQL对数据库进行修改。执行 SQL 分两种,初始化时执行的 SQL 和升级时执行的 SQL。SQL 文件存放于 `lesscode/lib/server/model/sql` 文件夹下。 +需要用户自己提供 MySQL 服务并做 db 授权。 + +可视化平台内置数据库自动导入和更新功能(db-migrate),程序每次启动时会自动执行数据库表结构的导入和更新操作,在同一个数据库内,内置的db-migrate框架会先检测每次的db变更是否已执行过,未执行过的db变更才会执行 + +相应的db初始化和变更文件可在`lesscode/lib/server/model/migrations/sql` 文件夹下查看 + +因此用户搭建好可用的MySQL服务,创建好相应数据库,按以下数据库配置说明配置好相应数据库信息即可 ## 数据库配置说明 -在本地开发和生产环境中,需要依照 [数据库配置示例](../../lib/server/conf/data-base.js.example) 在 `lesscode/lib/server/conf` 中新建 `data-base.js` 文件(复制 `data-base.js.example`,并删除 `.example`即可)。然后依照 `data-base.js.example` 的注释填写数据库的配置信息。 +数据库相关配置文件共有两个,分别是 + +#### lesscode/lib/server/conf/data-base.js (用于数据库的连接) -## 数据库初始化说明 +在 `lesscode/lib/server/conf` 中新建 `data-base.js` 文件(复制 `data-base.js.example`,并删除 `.example`即可)。然后依照 [data-base.js.example](../../lib/server/conf/data-base.js.example) 的注释填写本地开发和线上运行时的数据库的配置信息。 -在 `lesscode/lib/server/model/sql` 文件夹下,每次发版都会新建一个文件夹,以发布日期命名,里面的 `initial.sql` 为安装该版本需要的所有 SQL,包含了建表语句和初始化数据。初次安装的时候,需要手动执行该SQL,即完成了数据库初始化。注意:如果不是数据库初始化,执行该 SQL 会导致数据丢失。如果是升级,请按照数据库表结构变更来操作。 +#### lesscode/lib/server/conf/db-migrate.json (用于自动执行db导入和变更) -## 数据库表结构变更说明 +在 `lesscode/lib/server/conf` 中新建 `db-migrate.json` 文件(复制 `db-migrate.json.example`,并删除 `.example`即可)。然后依照 [db-migrate.json.example](../../lib/server/conf/db-migrate.json.example) 的注释填写本地开发和线上运行时的数据库的配置信息。 -在 `lesscode/lib/server/model/sql` 文件夹下,每次发布还会生成 `update.sql`,`update.sql` 是从上一个版本升级到这个版本的 SQL 语句,包含了修改表结构语句和初始化数据。如果这次升级数据库,跨越了3个版本,那么这3个版本的 `update.sql` 需要按照版本顺序都执行一次,即完成了数据库表结构变更。 diff --git a/paas-ce/lesscode/forever.json b/paas-ce/lesscode/forever.json index 6d09c57e4..8a60574a1 100755 --- a/paas-ce/lesscode/forever.json +++ b/paas-ce/lesscode/forever.json @@ -8,4 +8,4 @@ "logFile": "./logs/forever.log", "outFile": "./logs/out.log", "errFile": "./logs/err.log" -} +} \ No newline at end of file diff --git a/paas-ce/lesscode/lib/client/build/build-dll.js b/paas-ce/lesscode/lib/client/build/build-dll.js index 3bcf72e8a..b7a6896cd 100644 --- a/paas-ce/lesscode/lib/client/build/build-dll.js +++ b/paas-ce/lesscode/lib/client/build/build-dll.js @@ -17,6 +17,7 @@ const ora = require('ora') const fse = require('fs-extra') const clientConf = require('./conf') +const { pathToNodeModules } = require('./util') const manifestExist = fse.pathExistsSync(resolve(__dirname, '..', 'static', 'lib-manifest.json')) const bundleExist = fse.pathExistsSync(resolve(__dirname, '..', 'static', 'lib.bundle.js')) @@ -26,10 +27,10 @@ const mode = process.env.NODE_ENV === 'production' ? 'production' : 'development if (!(manifestExist & bundleExist)) { // 需要打包到一起的 js 文件 const vendors = [ - resolve(__dirname, '../../../node_modules', 'vue'), - resolve(__dirname, '../../../node_modules', 'vuex'), - resolve(__dirname, '../../../node_modules', 'vue-router'), - resolve(__dirname, '../../../node_modules', 'axios') + resolve(__dirname, pathToNodeModules, 'vue'), + resolve(__dirname, pathToNodeModules, 'vuex'), + resolve(__dirname, pathToNodeModules, 'vue-router'), + resolve(__dirname, pathToNodeModules, 'axios') ] const clientDLLConf = { diff --git a/paas-ce/lesscode/lib/client/build/conf.js b/paas-ce/lesscode/lib/client/build/conf.js index 2ebf43b6b..f6eddfc8d 100644 --- a/paas-ce/lesscode/lib/client/build/conf.js +++ b/paas-ce/lesscode/lib/client/build/conf.js @@ -17,28 +17,33 @@ module.exports = { build: { env: { 'process.env': { - 'NODE_ENV': JSON.stringify(NODE_ENV) + 'NODE_ENV': JSON.stringify(NODE_ENV), + 'V3_ENV': JSON.stringify(process.env.BKPAAS_ENVIRONMENT || 'prod') }, NODE_ENV: JSON.stringify(NODE_ENV), APP_CODE: JSON.stringify(APP_CODE), - // AJAX_URL_PREFIX: NODE_ENV === 'local' ? JSON.stringify('/api') : JSON.stringify(`/${APP_CODE}/api`) AJAX_URL_PREFIX: JSON.stringify('/api'), ENV: JSON.stringify(ENV) + }, assetsPublicPath: '{{STATIC_URL}}', - staticUrl: '/static' + staticUrl: '/static', + BKPAAS_ENVIRONMENT: 'stag' }, dev: { env: { 'process.env': { - 'NODE_ENV': JSON.stringify(NODE_ENV) + 'NODE_ENV': JSON.stringify(NODE_ENV), + 'V3_ENV': JSON.stringify('dev') }, NODE_ENV: JSON.stringify(NODE_ENV), APP_CODE: JSON.stringify(APP_CODE), AJAX_URL_PREFIX: JSON.stringify('/api'), ENV: JSON.stringify(ENV) + }, assetsPublicPath: '/', - staticUrl: '/static' + staticUrl: '/static', + BKPAAS_ENVIRONMENT: 'stag' } } diff --git a/paas-ce/lesscode/lib/client/build/md-highlight.js b/paas-ce/lesscode/lib/client/build/md-highlight.js new file mode 100644 index 000000000..c53dfcf19 --- /dev/null +++ b/paas-ce/lesscode/lib/client/build/md-highlight.js @@ -0,0 +1,52 @@ +/** + * @file highlight.js markdown-it 插件 + * https://github.com/valeriangalliat/markdown-it-highlightjs/ + */ + +const hljs = require('./md-hljs') + +const maybe = f => { + try { + return f() + } catch (e) { + return false + } +} + +// Highlight with given language. +const highlight = (code, lang) => + maybe(() => hljs.highlight(lang, code, true).value) || '' + +// Highlight with given language or automatically. +const highlightAuto = (code, lang) => + lang + ? highlight(code, lang) + : maybe(() => hljs.highlightAuto(code).value) || '' + +// Wrap a render function to add `hljs` class to code blocks. +const wrap = render => + function (...args) { + return render.apply(this, args) + .replace('', '') + } + +const highlightjs = (md, opts) => { + opts = Object.assign({}, highlightjs.defaults, opts) + + md.renderer.rules.table_open = () => '' + + md.options.highlight = opts.auto ? highlightAuto : highlight + md.renderer.rules.fence = wrap(md.renderer.rules.fence) + + if (opts.code) { + md.renderer.rules.code_block = wrap(md.renderer.rules.code_block) + } +} + +highlightjs.defaults = { + auto: true, + code: true +} + +module.exports = highlightjs diff --git a/paas-ce/lesscode/lib/client/build/md-hljs.js b/paas-ce/lesscode/lib/client/build/md-hljs.js new file mode 100644 index 000000000..05f7af12d --- /dev/null +++ b/paas-ce/lesscode/lib/client/build/md-hljs.js @@ -0,0 +1,16 @@ +/** + * @file highlight.js 设置高亮语言,默认的加载的语言太多了 + * + * Copyright © 2012-2019 Tencent BlueKing. All Rights Reserved. 蓝鲸智云 版权所有 + */ + +const hljs = require('highlight.js/lib/highlight') +const bash = require('highlight.js/lib/languages/bash') +const css = require('highlight.js/lib/languages/css') +const javascript = require('highlight.js/lib/languages/javascript') + +hljs.registerLanguage('bash', bash) +hljs.registerLanguage('css', css) +hljs.registerLanguage('javascript', javascript) + +module.exports = hljs diff --git a/paas-ce/lesscode/lib/client/build/md-loader-option.js b/paas-ce/lesscode/lib/client/build/md-loader-option.js index b7cde4393..0f43ed265 100644 --- a/paas-ce/lesscode/lib/client/build/md-loader-option.js +++ b/paas-ce/lesscode/lib/client/build/md-loader-option.js @@ -19,6 +19,7 @@ const { slugify } = require('transliteration') const { strip } = require('./strip-tags') const markdownItReplace = require('./markdown-it-replace') +const markdownItHighlightjs = require('./md-highlight') const convert = str => { str = str.replace(/(&#x)(\w{4});/gi, () => String.fromCharCode( @@ -69,6 +70,7 @@ module.exports = { } }], // [markdownItReplaceLink], + [markdownItHighlightjs], [markdownItAttrs], [markdownItAnchor, { level: 3, diff --git a/paas-ce/lesscode/lib/client/build/postcss-plugins.js b/paas-ce/lesscode/lib/client/build/postcss-plugins.js index ce6edc695..433c80cee 100644 --- a/paas-ce/lesscode/lib/client/build/postcss-plugins.js +++ b/paas-ce/lesscode/lib/client/build/postcss-plugins.js @@ -54,7 +54,6 @@ module.exports = function (loader) { // see https://github.com/csstools/postcss-preset-env#options stage: 0, autoprefixer: { - grid: true } }), // 这个插件可以在写 nested 样式时省略开头的 & diff --git a/paas-ce/lesscode/lib/client/build/replace-static-url-plugin.js b/paas-ce/lesscode/lib/client/build/replace-static-url-plugin.js index 1498251aa..03c1b51ba 100644 --- a/paas-ce/lesscode/lib/client/build/replace-static-url-plugin.js +++ b/paas-ce/lesscode/lib/client/build/replace-static-url-plugin.js @@ -53,6 +53,10 @@ const dealCSS = compilation => { continue } + if (fileName.indexOf('static/init-code') > -1) { + continue + } + const asset = compilation.assets[fileName] const minifyCSSFileContent = asset.source().replace( /\{\{STATIC_URL\}\}/g, diff --git a/paas-ce/lesscode/lib/client/build/util.js b/paas-ce/lesscode/lib/client/build/util.js index 4f5e613c9..9426b385c 100644 --- a/paas-ce/lesscode/lib/client/build/util.js +++ b/paas-ce/lesscode/lib/client/build/util.js @@ -21,7 +21,7 @@ exports.getIP = () => { const defultAddress = '127.0.0.1' let ip = defultAddress - /* eslint-disable fecs-use-for-of, no-loop-func */ + /* eslint-disable no-loop-func */ for (const dev in ifaces) { if (ifaces.hasOwnProperty(dev)) { /* jshint loopfunc: true */ @@ -32,7 +32,7 @@ exports.getIP = () => { }) } } - /* eslint-enable fecs-use-for-of, no-loop-func */ + /* eslint-enable no-loop-func */ return ip } @@ -43,3 +43,8 @@ exports.convert = str => { ) return str } + +/** + * 相对于 node_modules 的路径。内外版本 node_modules 安装的路径是不一样的 + */ +exports.pathToNodeModules = '../../../node_modules' diff --git a/paas-ce/lesscode/lib/client/build/webpack.base.conf.js b/paas-ce/lesscode/lib/client/build/webpack.base.conf.js index cd91c0263..bf982dd0a 100644 --- a/paas-ce/lesscode/lib/client/build/webpack.base.conf.js +++ b/paas-ce/lesscode/lib/client/build/webpack.base.conf.js @@ -17,6 +17,7 @@ const friendlyFormatter = require('eslint-friendly-formatter') // const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin') const clientConf = require('./conf') const mdLoaderOption = require('./md-loader-option') +const { pathToNodeModules } = require('./util') const IS_DEV = process.env.NODE_ENV === 'development' @@ -36,10 +37,10 @@ module.exports = { resolve: { // 指定以下目录寻找第三方模块,避免 webpack 往父级目录递归搜索, // 默认值为 ['node_modules'],会依次查找./node_modules、../node_modules、../../node_modules - modules: [resolve(__dirname, '..', 'src'), resolve(__dirname, '../../../node_modules')], + modules: [resolve(__dirname, '..', 'src'), resolve(__dirname, pathToNodeModules)], extensions: ['.js', '.vue', '.json'], alias: { - vue$: resolve(__dirname, '../../../node_modules', 'vue/dist/vue.esm.js'), + vue$: resolve(__dirname, pathToNodeModules, 'vue/dist/vue.esm.js'), '@': resolve(__dirname, '..', 'src') } }, @@ -49,7 +50,7 @@ module.exports = { { test: /\.(js|vue)$/, // loader: 'eslint-loader', - loader: resolve(__dirname, '../../../node_modules', 'eslint-loader'), + loader: resolve(__dirname, pathToNodeModules, 'eslint-loader'), enforce: 'pre', include: [ resolve(__dirname, '..', 'src') @@ -62,7 +63,7 @@ module.exports = { { test: /\.vue$/, use: { - loader: resolve(__dirname, '../../../node_modules', 'vue-loader'), + loader: resolve(__dirname, pathToNodeModules, 'vue-loader'), options: { transformAssetUrls: { video: 'src', @@ -71,7 +72,7 @@ module.exports = { image: 'xlink:href' }, include: [ - resolve(__dirname, '../../../node_modules', 'vue-echarts') + resolve(__dirname, pathToNodeModules, 'vue-echarts') ] } } @@ -80,10 +81,10 @@ module.exports = { test: /\.md$/, use: [ { - loader: resolve(__dirname, '../../../node_modules', 'vue-loader') + loader: resolve(__dirname, pathToNodeModules, 'vue-loader') }, { - loader: resolve(__dirname, '../../../node_modules', 'vue-markdown-loader/lib/markdown-compiler'), + loader: resolve(__dirname, pathToNodeModules, 'vue-markdown-loader/lib/markdown-compiler'), options: mdLoaderOption } ] @@ -91,19 +92,19 @@ module.exports = { { test: /\.js$/, use: { - loader: resolve(__dirname, '../../../node_modules', 'babel-loader'), + loader: resolve(__dirname, pathToNodeModules, 'babel-loader'), options: { include: [ resolve(__dirname, '..', 'src'), - resolve(__dirname, '../../../node_modules', 'bk-magic-vue'), - resolve(__dirname, '../../../node_modules', 'monaco-editor'), - resolve(__dirname, '../../../node_modules', 'vue-echarts') - // resolve(__dirname, '../../../node_modules', 'resize-detector') + resolve(__dirname, pathToNodeModules, 'bk-magic-vue'), + resolve(__dirname, pathToNodeModules, 'monaco-editor'), + resolve(__dirname, pathToNodeModules, 'vue-echarts') + // resolve(__dirname, pathToNodeModules, 'resize-detector') ], cacheDirectory: resolve(__dirname, '..', '.webpack_cache'), presets: [ [ - resolve(__dirname, '../../../node_modules', '@babel/preset-env'), + resolve(__dirname, pathToNodeModules, '@babel/preset-env'), { modules: 'commonjs', targets: { @@ -116,22 +117,22 @@ module.exports = { ], // plugins: [require('@babel/plugin-transform-object-rest-spread')], plugins: [ - resolve(__dirname, '../../../node_modules', '@babel/plugin-syntax-dynamic-import'), - resolve(__dirname, '../../../node_modules', '@babel/plugin-transform-runtime'), - resolve(__dirname, '../../../node_modules', '@babel/plugin-transform-object-assign'), - resolve(__dirname, '../../../node_modules', '@babel/plugin-transform-async-to-generator'), - resolve(__dirname, '../../../node_modules', '@babel/plugin-transform-modules-commonjs'), + resolve(__dirname, pathToNodeModules, '@babel/plugin-syntax-dynamic-import'), + resolve(__dirname, pathToNodeModules, '@babel/plugin-transform-runtime'), + resolve(__dirname, pathToNodeModules, '@babel/plugin-transform-object-assign'), + resolve(__dirname, pathToNodeModules, '@babel/plugin-transform-async-to-generator'), + resolve(__dirname, pathToNodeModules, '@babel/plugin-transform-modules-commonjs'), [ - resolve(__dirname, '../../../node_modules', '@babel/plugin-proposal-decorators'), + resolve(__dirname, pathToNodeModules, '@babel/plugin-proposal-decorators'), { legacy: true } ], - resolve(__dirname, '../../../node_modules', '@babel/plugin-proposal-function-sent'), - resolve(__dirname, '../../../node_modules', '@babel/plugin-proposal-export-namespace-from'), - resolve(__dirname, '../../../node_modules', '@babel/plugin-proposal-numeric-separator'), - resolve(__dirname, '../../../node_modules', '@babel/plugin-proposal-throw-expressions'), - resolve(__dirname, '../../../node_modules', 'babel-plugin-add-module-exports'), + resolve(__dirname, pathToNodeModules, '@babel/plugin-proposal-function-sent'), + resolve(__dirname, pathToNodeModules, '@babel/plugin-proposal-export-namespace-from'), + resolve(__dirname, pathToNodeModules, '@babel/plugin-proposal-numeric-separator'), + resolve(__dirname, pathToNodeModules, '@babel/plugin-proposal-throw-expressions'), + resolve(__dirname, pathToNodeModules, 'babel-plugin-add-module-exports'), [ - resolve(__dirname, '../../../node_modules', 'babel-plugin-import-bk-magic-vue'), + resolve(__dirname, pathToNodeModules, 'babel-plugin-import-bk-magic-vue'), { baseLibName: 'bk-magic-vue' } ] ], @@ -144,7 +145,7 @@ module.exports = { }, { test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, - loader: resolve(__dirname, '../../../node_modules', 'url-loader'), + loader: resolve(__dirname, pathToNodeModules, 'url-loader'), options: { limit: true, name: posix.join('static', 'images/[name].[hash:7].[ext]') @@ -153,7 +154,7 @@ module.exports = { { test: /\.(mp4|webm|ogg|mp3|wav|flac|aac)(\?.*)?$/, use: { - loader: resolve(__dirname, '../../../node_modules', 'url-loader'), + loader: resolve(__dirname, pathToNodeModules, 'url-loader'), options: { limit: 10000, name: posix.join('static', 'media/[name].[hash:7].[ext]') @@ -163,7 +164,7 @@ module.exports = { { test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, use: { - loader: resolve(__dirname, '../../../node_modules', 'url-loader'), + loader: resolve(__dirname, pathToNodeModules, 'url-loader'), options: { limit: 10000, name: posix.join('static', 'fonts/[name].[hash:7].[ext]') diff --git a/paas-ce/lesscode/lib/client/build/webpack.dev.conf.js b/paas-ce/lesscode/lib/client/build/webpack.dev.conf.js index b8d1046a4..f61c9acd4 100644 --- a/paas-ce/lesscode/lib/client/build/webpack.dev.conf.js +++ b/paas-ce/lesscode/lib/client/build/webpack.dev.conf.js @@ -17,6 +17,7 @@ const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') const postcssPlugins = require('./postcss-plugins') const clientConf = require('./conf') +const { pathToNodeModules } = require('./util') const baseConf = require('./webpack.base.conf') const manifest = require('../static/lib-manifest.json') @@ -25,7 +26,8 @@ const webpackConfig = merge(baseConf, { entry: { // 必须是数组,适配 webpack-hot-client - main: [resolve(__dirname, '..', 'src/main.js')] + main: [resolve(__dirname, '..', 'src/main.js')], + preview: [resolve(__dirname, '..', 'src/preview/index.js')] }, // output: { @@ -40,20 +42,88 @@ const webpackConfig = merge(baseConf, { rules: [ { test: /\.(css|postcss)$/, - use: [ - resolve(__dirname, '../../../node_modules', 'vue-style-loader'), + // use: [ + // resolve(__dirname, pathToNodeModules, 'vue-style-loader'), + // { + // loader: resolve(__dirname, pathToNodeModules, 'css-loader'), + // options: { + // modules: true, + // importLoaders: 1 + // } + // }, + // { + // loader: resolve(__dirname, pathToNodeModules, 'postcss-loader'), + // options: { + // ident: 'postcss', + // plugins: loader => postcssPlugins(loader) + // } + // } + // ] + oneOf: [ + // 匹配 js 中 import xxx from 'xxx.css' { - loader: resolve(__dirname, '../../../node_modules', 'css-loader'), - options: { - importLoaders: 1 - } + resourceQuery: /import_css_specifier/, + use: [ + resolve(__dirname, pathToNodeModules, 'vue-style-loader'), + { + loader: resolve(__dirname, pathToNodeModules, 'css-loader'), + options: { + modules: { + localIdentName: '[name]_[local]_[hash:base64:5]' + }, + importLoaders: 1 + } + }, + { + loader: resolve(__dirname, pathToNodeModules, 'postcss-loader'), + options: { + ident: 'postcss', + plugins: loader => postcssPlugins(loader) + } + } + ] }, + // 这里匹配 ` + + +
+
+
+
+
+
+
+
+
+
+
+
+ + + + diff --git a/paas-ce/lesscode/lib/client/src/App.vue b/paas-ce/lesscode/lib/client/src/App.vue index 970d8f791..403caaf67 100644 --- a/paas-ce/lesscode/lib/client/src/App.vue +++ b/paas-ce/lesscode/lib/client/src/App.vue @@ -11,14 +11,12 @@ @@ -40,6 +38,13 @@ ...mapGetters(['mainContentLoading']), emptyPage () { return this.$route.name === 'preview' + }, + authed () { + return this.$route.meta.authed + }, + topView () { + const topRoute = this.$route.matched[0] + return (topRoute && topRoute.meta.view) || 'default' } }, @@ -73,11 +78,6 @@ color: #63656e; } - .preview-page { - height: 99vh; - overflow: auto; - } - .mac { /* font-family: PingFang SC, Microsoft Yahei, Helvetica, Aria; */ font-family: -apple-system, BlinkMacSystemFont, PingFang SC, Microsoft YaHei, Helvetica Neue, Arial; diff --git a/paas-ce/lesscode/lib/client/src/api/index.js b/paas-ce/lesscode/lib/client/src/api/index.js index f7ac8f7f7..a1265fc61 100644 --- a/paas-ce/lesscode/lib/client/src/api/index.js +++ b/paas-ce/lesscode/lib/client/src/api/index.js @@ -135,7 +135,7 @@ async function getPromise (method, url, data, userConfig = {}) { * @param {Function} promise 拒绝函数 */ function handleResponse ({ config, response, resolve, reject }) { - if (response.code !== 0 && config.globalError) { + if (response.code !== 0 && config.globalError && !response.businessError) { reject({ message: response.message }) } else { resolve(config.originalResponse ? response : response.data, config) @@ -157,7 +157,6 @@ function handleReject (error, config) { } http.queue.delete(config.requestId) - if (config.globalError && error.response) { const { status, data } = error.response const nextError = { message: error.message, response: error.response } @@ -173,9 +172,10 @@ function handleReject (error, config) { console.error(nextError.message) return Promise.reject(nextError) } - messageError(error.message) - console.error(error.message) - return Promise.reject(error) + const errMessage = (error.response && error.response.data && error.response.data.message) || error.message + messageError(errMessage) + console.error(errMessage) + return Promise.reject(new Error(errMessage)) } /** @@ -203,7 +203,7 @@ function initConfig (method, url, userConfig) { // 当路由变更时取消请求 cancelWhenRouteChange: true, // 取消上次请求 - cancelPrevious: true + cancelPrevious: false } return Object.assign(defaultConfig, userConfig) } diff --git a/paas-ce/lesscode/lib/client/src/api/pureAxios.js b/paas-ce/lesscode/lib/client/src/api/pureAxios.js index 3a29498b3..2282d24a0 100644 --- a/paas-ce/lesscode/lib/client/src/api/pureAxios.js +++ b/paas-ce/lesscode/lib/client/src/api/pureAxios.js @@ -183,7 +183,7 @@ function initConfig (method, url, userConfig) { // 当路由变更时取消请求 cancelWhenRouteChange: true, // 取消上次请求 - cancelPrevious: true + cancelPrevious: false } return Object.assign(defaultConfig, userConfig) } diff --git a/paas-ce/lesscode/lib/client/src/common/bkmagic.js b/paas-ce/lesscode/lib/client/src/common/bkmagic.js index 510bdab72..6534f70c5 100644 --- a/paas-ce/lesscode/lib/client/src/common/bkmagic.js +++ b/paas-ce/lesscode/lib/client/src/common/bkmagic.js @@ -21,12 +21,13 @@ const Message = Vue.prototype.$bkMessage let messageInstance = null -export const messageError = (message, delay = 3000) => { +export const messageError = (message, delay = 3000, ellipsisLine = 1) => { messageInstance && messageInstance.close() messageInstance = Message({ message, delay, - theme: 'error' + theme: 'error', + ellipsisLine }) } diff --git a/paas-ce/lesscode/lib/client/src/views/preview/index.css b/paas-ce/lesscode/lib/client/src/common/bkui-vue-complex.js similarity index 88% rename from paas-ce/lesscode/lib/client/src/views/preview/index.css rename to paas-ce/lesscode/lib/client/src/common/bkui-vue-complex.js index fd44a647a..ec2a86fb9 100644 --- a/paas-ce/lesscode/lib/client/src/views/preview/index.css +++ b/paas-ce/lesscode/lib/client/src/common/bkui-vue-complex.js @@ -9,6 +9,7 @@ * specific language governing permissions and limitations under the License. */ -article { +import Vue from 'vue' +import bkuiVueComplex from '@blueking/bkui-vue-complex' -} +Vue.use(bkuiVueComplex) diff --git a/paas-ce/lesscode/lib/client/src/common/demand-import.js b/paas-ce/lesscode/lib/client/src/common/demand-import.js index 8c2451605..e3deabbe7 100644 --- a/paas-ce/lesscode/lib/client/src/common/demand-import.js +++ b/paas-ce/lesscode/lib/client/src/common/demand-import.js @@ -20,7 +20,7 @@ import { bkPopover, bkProcess, bkProgress, bkRadio, bkRadioButton, bkRadioGroup, bkRoundProgress, bkRow, bkSearchSelect, bkSelect, bkColorPicker, bkSideslider, bkSlider, bkSteps, bkSwitcher, bkTab, bkTabPanel, bkTable, bkTableColumn, bkTagInput, bkTimePicker, bkTimeline, bkTransfer, bkTree, bkUpload, bkClickoutside, bkTooltips, bkSwiper, bkRate, bkAnimateNumber, - bkVirtualScroll, bkPopconfirm, bkZoomImage, bkLink + bkVirtualScroll, bkPopconfirm, bkZoomImage, bkLink, bkAlert, bkCard, bkIcon } from 'bk-magic-vue' // bkDiff 组件体积较大且不是很常用,因此注释掉。如果需要,打开注释即可 @@ -90,6 +90,9 @@ Vue.use(bkVirtualScroll) Vue.use(bkPopconfirm) Vue.use(bkZoomImage) Vue.use(bkLink) +Vue.use(bkAlert) +Vue.use(bkCard) +Vue.use(bkIcon) // bkDiff 组件体积较大且不是很常用,因此注释了。如果需要,打开注释即可 Vue.use(bkDiff) diff --git a/paas-ce/lesscode/lib/client/src/common/dom-to-image.js b/paas-ce/lesscode/lib/client/src/common/dom-to-image.js new file mode 100644 index 000000000..c0747fff2 --- /dev/null +++ b/paas-ce/lesscode/lib/client/src/common/dom-to-image.js @@ -0,0 +1,784 @@ +/** + * https://github.com/tsayen/dom-to-image + * + * add escapeXhtml + */ + +const util = newUtil() +const inliner = newInliner() +const fontFaces = newFontFaces() +const images = newImages() + +// Default impl options +const defaultOptions = { + // Default is to fail on error, no placeholder + imagePlaceholder: undefined, + // Default cache bust is false, it will use the cache + cacheBust: false +} + +const domtoimage = { + toSvg: toSvg, + toPng: toPng, + toJpeg: toJpeg, + toBlob: toBlob, + toPixelData: toPixelData, + impl: { + fontFaces: fontFaces, + images: images, + util: util, + inliner: inliner, + options: {} + } +} + +/** + * @param {Node} node - The DOM Node object to render + * @param {Object} options - Rendering options + * @param {Function} options.filter - Should return true if passed node should be included in the output + * (excluding node means excluding it's children as well). Not called on the root node. + * @param {String} options.bgcolor - color for the background, any valid CSS color value. + * @param {Number} options.width - width to be applied to node before rendering. + * @param {Number} options.height - height to be applied to node before rendering. + * @param {Object} options.style - an object whose properties to be copied to node's style before rendering. + * @param {Number} options.quality - a Number between 0 and 1 indicating image quality (applicable to JPEG only), + defaults to 1.0. + * @param {String} options.imagePlaceholder - dataURL to use as a placeholder for failed images, default behaviour is to fail fast on images we can't fetch + * @param {Boolean} options.cacheBust - set to true to cache bust by appending the time to the request url + * @return {Promise} - A promise that is fulfilled with a SVG image data URL + * + */ +function toSvg (node, options) { + options = options || {} + copyOptions(options) + return Promise.resolve(node) + .then(function (node) { + return cloneNode(node, options.filter, true) + }) + .then(embedFonts) + .then(inlineImages) + .then(applyOptions) + .then(function (clone) { + return makeSvgDataUri(clone, + options.width || util.width(node), + options.height || util.height(node) + ) + }) + + function applyOptions (clone) { + if (options.bgcolor) clone.style.backgroundColor = options.bgcolor + + if (options.width) clone.style.width = options.width + 'px' + if (options.height) clone.style.height = options.height + 'px' + + if (options.style) { + Object.keys(options.style).forEach(function (property) { + clone.style[property] = options.style[property] + }) + } + + return clone + } +} + +/** + * @param {Node} node - The DOM Node object to render + * @param {Object} options - Rendering options, @see {@link toSvg} + * @return {Promise} - A promise that is fulfilled with a Uint8Array containing RGBA pixel data. + * + */ +function toPixelData (node, options) { + return draw(node, options || {}) + .then(function (canvas) { + return canvas.getContext('2d').getImageData( + 0, + 0, + util.width(node), + util.height(node) + ).data + }) +} + +/** + * @param {Node} node - The DOM Node object to render + * @param {Object} options - Rendering options, @see {@link toSvg} + * @return {Promise} - A promise that is fulfilled with a PNG image data URL + * + */ +function toPng (node, options) { + return draw(node, options || {}) + .then(function (canvas) { + return canvas.toDataURL() + }) +} + +/** + * @param {Node} node - The DOM Node object to render + * @param {Object} options - Rendering options, @see {@link toSvg} + * @return {Promise} - A promise that is fulfilled with a JPEG image data URL + */ +function toJpeg (node, options) { + options = options || {} + return draw(node, options) + .then(function (canvas) { + return canvas.toDataURL('image/jpeg', options.quality || 1.0) + }) +} + +/** + * @param {Node} node - The DOM Node object to render + * @param {Object} options - Rendering options, @see {@link toSvg} + * @return {Promise} - A promise that is fulfilled with a PNG image blob + */ +function toBlob (node, options) { + return draw(node, options || {}).then(util.canvasToBlob) +} + +function copyOptions (options) { + // Copy options to impl options for use in impl + if (typeof (options.imagePlaceholder) === 'undefined') { + domtoimage.impl.options.imagePlaceholder = defaultOptions.imagePlaceholder + } else { + domtoimage.impl.options.imagePlaceholder = options.imagePlaceholder + } + + if (typeof (options.cacheBust) === 'undefined') { + domtoimage.impl.options.cacheBust = defaultOptions.cacheBust + } else { + domtoimage.impl.options.cacheBust = options.cacheBust + } +} + +function draw (domNode, options) { + return toSvg(domNode, options) + .then(util.makeImage) + .then(util.delay(100)) + .then(function (image) { + const canvas = newCanvas(domNode) + canvas.getContext('2d').drawImage(image, 0, 0) + return canvas + }) + + function newCanvas (domNode) { + const canvas = document.createElement('canvas') + canvas.width = options.width || util.width(domNode) + canvas.height = options.height || util.height(domNode) + + if (options.bgcolor) { + const ctx = canvas.getContext('2d') + ctx.fillStyle = options.bgcolor + ctx.fillRect(0, 0, canvas.width, canvas.height) + } + + return canvas + } +} + +function cloneNode (node, filter, root) { + if (!root && filter && !filter(node)) return Promise.resolve() + + return Promise.resolve(node) + .then(makeNodeCopy) + .then(function (clone) { + return cloneChildren(node, clone, filter) + }) + .then(function (clone) { + return processClone(node, clone) + }) + + function makeNodeCopy (node) { + if (node instanceof HTMLCanvasElement) return util.makeImage(node.toDataURL()) + return node.cloneNode(false) + } + + function cloneChildren (original, clone, filter) { + const children = original.childNodes + if (children.length === 0) return Promise.resolve(clone) + + return cloneChildrenInOrder(clone, util.asArray(children), filter) + .then(function () { + return clone + }) + + function cloneChildrenInOrder (parent, children, filter) { + let done = Promise.resolve() + children.forEach(function (child) { + done = done + .then(function () { + return cloneNode(child, filter) + }) + .then(function (childClone) { + if (childClone) parent.appendChild(childClone) + }) + }) + return done + } + } + + function processClone (original, clone) { + if (!(clone instanceof Element)) return clone + + return Promise.resolve() + .then(cloneStyle) + .then(clonePseudoElements) + .then(copyUserInput) + .then(fixSvg) + .then(function () { + return clone + }) + + function cloneStyle () { + copyStyle(window.getComputedStyle(original), clone.style) + + function copyStyle (source, target) { + if (source.cssText) target.cssText = source.cssText + else copyProperties(source, target) + + function copyProperties (source, target) { + util.asArray(source).forEach(function (name) { + target.setProperty( + name, + source.getPropertyValue(name), + source.getPropertyPriority(name) + ) + }) + } + } + } + + function clonePseudoElements () { + [':before', ':after'].forEach(function (element) { + clonePseudoElement(element) + }) + + function clonePseudoElement (element) { + const style = window.getComputedStyle(original, element) + const content = style.getPropertyValue('content') + + if (content === '' || content === 'none') return + + const className = util.uid() + clone.className = clone.className + ' ' + className + const styleElement = document.createElement('style') + styleElement.appendChild(formatPseudoElementStyle(className, element, style)) + clone.appendChild(styleElement) + + function formatPseudoElementStyle (className, element, style) { + const selector = '.' + className + ':' + element + const cssText = style.cssText ? formatCssText(style) : formatCssProperties(style) + return document.createTextNode(selector + '{' + cssText + '}') + + function formatCssText (style) { + const content = style.getPropertyValue('content') + return style.cssText + ' content: ' + content + ';' + } + + function formatCssProperties (style) { + return util.asArray(style) + .map(formatProperty) + .join('; ') + ';' + + function formatProperty (name) { + return name + ': ' + + style.getPropertyValue(name) + + (style.getPropertyPriority(name) ? ' !important' : '') + } + } + } + } + } + + function copyUserInput () { + if (original instanceof HTMLTextAreaElement) clone.innerHTML = original.value + if (original instanceof HTMLInputElement) clone.setAttribute('value', original.value) + } + + function fixSvg () { + if (!(clone instanceof SVGElement)) return + clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg') + + if (!(clone instanceof SVGRectElement)) return; + ['width', 'height'].forEach(function (attribute) { + const value = clone.getAttribute(attribute) + if (!value) return + + clone.style.setProperty(attribute, value) + }) + } + } +} + +function embedFonts (node) { + return fontFaces.resolveAll() + .then(function (cssText) { + const styleNode = document.createElement('style') + node.appendChild(styleNode) + styleNode.appendChild(document.createTextNode(cssText)) + return node + }) +} + +function inlineImages (node) { + return images.inlineAll(node) + .then(function () { + return node + }) +} + +function makeSvgDataUri (node, width, height) { + return Promise.resolve(node) + .then(function (node) { + node.setAttribute('xmlns', 'http://www.w3.org/1999/xhtml') + return new XMLSerializer().serializeToString(node) + }) + .then(util.escapeXhtml) + .then(function (xhtml) { + return '' + xhtml + '' + }) + .then(function (foreignObject) { + return '' + + foreignObject + '' + }) + .then(function (svg) { + return 'data:image/svg+xml;charset=utf-8,' + svg + }) +} + +function newUtil () { + return { + escape: escape, + parseExtension: parseExtension, + mimeType: mimeType, + dataAsUrl: dataAsUrl, + isDataUrl: isDataUrl, + canvasToBlob: canvasToBlob, + resolveUrl: resolveUrl, + getAndEncode: getAndEncode, + uid: uid(), + delay: delay, + asArray: asArray, + escapeXhtml: escapeXhtml, + makeImage: makeImage, + width: width, + height: height + } + + function mimes () { + /** + * Only WOFF and EOT mime types for fonts are 'real' + * see http://www.iana.org/assignments/media-types/media-types.xhtml + */ + const WOFF = 'application/font-woff' + const JPEG = 'image/jpeg' + + return { + 'woff': WOFF, + 'woff2': WOFF, + 'ttf': 'application/font-truetype', + 'eot': 'application/vnd.ms-fontobject', + 'png': 'image/png', + 'jpg': JPEG, + 'jpeg': JPEG, + 'gif': 'image/gif', + 'tiff': 'image/tiff', + 'svg': 'image/svg+xml' + } + } + + function parseExtension (url) { + const match = /\.([^\.\/]*?)$/g.exec(url) + if (match) return match[1] + else return '' + } + + function mimeType (url) { + const extension = parseExtension(url).toLowerCase() + return mimes()[extension] || '' + } + + function isDataUrl (url) { + return url.search(/^(data:)/) !== -1 + } + + function toBlob (canvas) { + return new Promise(function (resolve) { + const binaryString = window.atob(canvas.toDataURL().split(',')[1]) + const length = binaryString.length + const binaryArray = new Uint8Array(length) + + for (let i = 0; i < length; i++) { + binaryArray[i] = binaryString.charCodeAt(i) + } + + resolve(new Blob([binaryArray], { + type: 'image/png' + })) + }) + } + + function canvasToBlob (canvas) { + if (canvas.toBlob) { + return new Promise(function (resolve) { + canvas.toBlob(resolve) + }) + } + + return toBlob(canvas) + } + + function resolveUrl (url, baseUrl) { + const doc = document.implementation.createHTMLDocument() + const base = doc.createElement('base') + doc.head.appendChild(base) + const a = doc.createElement('a') + doc.body.appendChild(a) + base.href = baseUrl + a.href = url + return a.href + } + + function uid () { + let index = 0 + + return function () { + return 'u' + fourRandomChars() + index++ + + function fourRandomChars () { + /* see http://stackoverflow.com/a/6248722/2519373 */ + return ('0000' + (Math.random() * Math.pow(36, 4) << 0).toString(36)).slice(-4) + } + } + } + + function makeImage (uri) { + return new Promise(function (resolve, reject) { + const image = new Image() + image.onload = function () { + resolve(image) + } + image.onerror = reject + image.src = uri + }) + } + + function getAndEncode (url) { + const TIMEOUT = 30000 + if (domtoimage.impl.options.cacheBust) { + // Cache bypass so we dont have CORS issues with cached images + // Source: https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache + url += ((/\?/).test(url) ? '&' : '?') + (new Date()).getTime() + } + + return new Promise(function (resolve) { + const request = new XMLHttpRequest() + + request.onreadystatechange = done + request.ontimeout = timeout + request.responseType = 'blob' + request.timeout = TIMEOUT + request.open('GET', url, true) + request.send() + + let placeholder + if (domtoimage.impl.options.imagePlaceholder) { + const split = domtoimage.impl.options.imagePlaceholder.split(/,/) + if (split && split[1]) { + placeholder = split[1] + } + } + + function done () { + if (request.readyState !== 4) return + + if (request.status !== 200) { + if (placeholder) { + resolve(placeholder) + } else { + fail('cannot fetch resource: ' + url + ', status: ' + request.status) + } + + return + } + + const encoder = new FileReader() + encoder.onloadend = function () { + const content = encoder.result.split(/,/)[1] + resolve(content) + } + encoder.readAsDataURL(request.response) + } + + function timeout () { + if (placeholder) { + resolve(placeholder) + } else { + fail('timeout of ' + TIMEOUT + 'ms occured while fetching resource: ' + url) + } + } + + function fail (message) { + console.error(message) + resolve('') + } + }) + } + + function dataAsUrl (content, type) { + return 'data:' + type + ';base64,' + content + } + + function escape (string) { + return string.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1') + } + + function delay (ms) { + return function (arg) { + return new Promise(function (resolve) { + setTimeout(function () { + resolve(arg) + }, ms) + }) + } + } + + function asArray (arrayLike) { + const array = [] + const length = arrayLike.length + for (let i = 0; i < length; i++) array.push(arrayLike[i]) + return array + } + + function escapeXhtml (string) { + // encodeURIComponent + return string + // @click => click, @blur => blur ... + .replace(/@(\w+)/g, (match, p1) => p1) + // :checked => checked + .replace(/:(\w+)/g, (match, p1) => p1) + // .replace(/\:checked/g, 'checked') + .replace(/\n/g, '%0A') + .replace(/"/g, "'") + .replace(/%/g, '%25') + .replace(/#/g, '%23') + .replace(/{/g, '%7B') + .replace(/}/g, '%7D') + .replace(//g, '%3E') + } + + function width (node) { + const leftBorder = px(node, 'border-left-width') + const rightBorder = px(node, 'border-right-width') + return node.scrollWidth + leftBorder + rightBorder + } + + function height (node) { + const topBorder = px(node, 'border-top-width') + const bottomBorder = px(node, 'border-bottom-width') + return node.scrollHeight + topBorder + bottomBorder + } + + function px (node, styleProperty) { + const value = window.getComputedStyle(node).getPropertyValue(styleProperty) + return parseFloat(value.replace('px', '')) + } +} + +function newInliner () { + const URL_REGEX = /url\(['"]?([^'"]+?)['"]?\)/g + + return { + inlineAll: inlineAll, + shouldProcess: shouldProcess, + impl: { + readUrls: readUrls, + inline: inline + } + } + + function shouldProcess (string) { + return string.search(URL_REGEX) !== -1 + } + + function readUrls (string) { + const result = [] + let match + while ((match = URL_REGEX.exec(string)) !== null) { + result.push(match[1]) + } + return result.filter(function (url) { + return !util.isDataUrl(url) + }) + } + + function inline (string, url, baseUrl, get) { + return Promise.resolve(url) + .then(function (url) { + return baseUrl ? util.resolveUrl(url, baseUrl) : url + }) + .then(get || util.getAndEncode) + .then(function (data) { + return util.dataAsUrl(data, util.mimeType(url)) + }) + .then(function (dataUrl) { + return string.replace(urlAsRegex(url), '$1' + dataUrl + '$3') + }) + + function urlAsRegex (url) { + return new RegExp('(url\\([\'"]?)(' + util.escape(url) + ')([\'"]?\\))', 'g') + } + } + + function inlineAll (string, baseUrl, get) { + if (nothingToInline()) return Promise.resolve(string) + + return Promise.resolve(string) + .then(readUrls) + .then(function (urls) { + let done = Promise.resolve(string) + urls.forEach(function (url) { + done = done.then(function (string) { + return inline(string, url, baseUrl, get) + }) + }) + return done + }) + + function nothingToInline () { + return !shouldProcess(string) + } + } +} + +function newFontFaces () { + return { + resolveAll: resolveAll, + impl: { + readAll: readAll + } + } + + function resolveAll () { + return readAll(document) + .then(function (webFonts) { + return Promise.all( + webFonts.map(function (webFont) { + return webFont.resolve() + }) + ) + }) + .then(function (cssStrings) { + return cssStrings.join('\n') + }) + } + + function readAll () { + return Promise.resolve(util.asArray(document.styleSheets)) + .then(getCssRules) + .then(selectWebFontRules) + .then(function (rules) { + return rules.map(newWebFont) + }) + + function selectWebFontRules (cssRules) { + return cssRules + .filter(function (rule) { + return rule.type === CSSRule.FONT_FACE_RULE + }) + .filter(function (rule) { + return inliner.shouldProcess(rule.style.getPropertyValue('src')) + }) + } + + function getCssRules (styleSheets) { + const cssRules = [] + styleSheets.forEach(function (sheet) { + try { + util.asArray(sheet.cssRules || []).forEach(cssRules.push.bind(cssRules)) + } catch (e) { + console.log('Error while reading CSS rules from ' + sheet.href, e.toString()) + } + }) + return cssRules + } + + function newWebFont (webFontRule) { + return { + resolve: function resolve () { + const baseUrl = (webFontRule.parentStyleSheet || {}).href + return inliner.inlineAll(webFontRule.cssText, baseUrl) + }, + src: function () { + return webFontRule.style.getPropertyValue('src') + } + } + } + } +} + +function newImages () { + return { + inlineAll: inlineAll, + impl: { + newImage: newImage + } + } + + function newImage (element) { + return { + inline: inline + } + + function inline (get) { + if (util.isDataUrl(element.src)) return Promise.resolve() + + return Promise.resolve(element.src) + .then(get || util.getAndEncode) + .then(function (data) { + return util.dataAsUrl(data, util.mimeType(element.src)) + }) + .then(function (dataUrl) { + return new Promise(function (resolve, reject) { + element.onload = resolve + element.onerror = reject + element.src = dataUrl + }) + }) + } + } + + function inlineAll (node) { + if (!(node instanceof Element)) return Promise.resolve(node) + + return inlineBackground(node).then(function () { + if (node instanceof HTMLImageElement) { + return newImage(node).inline() + } + return Promise.all( + util.asArray(node.childNodes).map(function (child) { + return inlineAll(child) + }) + ) + }) + + function inlineBackground (node) { + const background = node.style.getPropertyValue('background') + + if (!background) return Promise.resolve(node) + + return inliner.inlineAll(background) + .then(function (inlined) { + node.style.setProperty( + 'background', + inlined, + node.style.getPropertyPriority('background') + ) + }) + .then(function () { + return node + }) + } + } +} + +export default domtoimage diff --git a/paas-ce/lesscode/lib/client/src/custom/x-form/components/utils/dom.js b/paas-ce/lesscode/lib/client/src/common/dom.js similarity index 90% rename from paas-ce/lesscode/lib/client/src/custom/x-form/components/utils/dom.js rename to paas-ce/lesscode/lib/client/src/common/dom.js index 6a23b2f59..d457710c7 100644 --- a/paas-ce/lesscode/lib/client/src/custom/x-form/components/utils/dom.js +++ b/paas-ce/lesscode/lib/client/src/common/dom.js @@ -1,12 +1,7 @@ /** - * Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. - * Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. All rights reserved. - * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * http://opensource.org/licenses/MIT - * 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. + * @file dom util + * + * Copyright © 2012-2019 Tencent BlueKing. All Rights Reserved. 蓝鲸智云 版权所有 */ /** @@ -296,3 +291,25 @@ export function scrollTop (el, from = 0, to, duration = 500, endCallback) { } scroll(from, to, step) } + +export const isInContainer = (el, container) => { + if (!el || !container) return false + const elRect = el.getBoundingClientRect() + let containerRect + + if ([window, document, document.documentElement, null, undefined].includes(container)) { + containerRect = { + top: 0, + right: window.innerWidth, + bottom: window.innerHeight, + left: 0 + } + } else { + containerRect = container.getBoundingClientRect() + } + + return elRect.top < containerRect.bottom + && elRect.bottom > containerRect.top + && elRect.right > containerRect.left + && elRect.left < containerRect.right +} diff --git a/paas-ce/lesscode/lib/client/src/common/drag-line.js b/paas-ce/lesscode/lib/client/src/common/drag-line.js new file mode 100644 index 000000000..a0186bb6f --- /dev/null +++ b/paas-ce/lesscode/lib/client/src/common/drag-line.js @@ -0,0 +1,242 @@ +import { getActualTop, getActualLeft } from '@/common/util' + +function setLines () { + const lines = { + // 横轴 上方的线 + xt: null, + // 横轴 中间的线 + xc: null, + // 横轴 下方的线 + xb: null, + // 纵轴 左边的线 + yl: null, + // 纵轴 中间的线 + yc: null, + // 纵轴 右边的线 + yr: null + } + + // 置入参考线 + for (const p in lines) { + const node = lines[p] = document.createElement('div') + + node.classList.add('drag-line', p) + node.style.cssText = ` + display: none; + opacity: 0.7; + position: absolute; + background-color: #ff9700; + z-index: 999999990; + left: 0; + top: 0; + ${p[0] === 'x' ? 'width: 100%; height: 1px;' : 'width: 1px; height: 100%;'} + ` + + node.show = function () { + this.style.display = 'block' + } + node.hide = function () { + this.style.display = 'none' + } + node.isShow = function () { + return this.style.display !== 'none' + } + node.setTranslateX = function (x) { + node.setAttribute('translate-x', x) + const translateY = node.getAttribute('translate-y') || 0 + node.style.transform = `translateX(${x}px) translateY(${translateY}px)` + } + node.setTranslateY = function (y) { + node.setAttribute('translate-y', y) + const translateX = node.getAttribute('translate-x') || 0 + node.style.transform = `translateX(${translateX}px) translateY(${y}px)` + } + document.body.appendChild(node) + } + + return lines +} + +const lines = setLines() + +export default class DragLine { + constructor (options = {}) { + this.options = Object.assign({ + gap: 3 + }, options) + this.setContainer(this.options.container || '') + + // 交互式组件使用了transform属性,对定位有影响。因此在定位时,需要加上偏移 + this.offset = this.options.offset || { top: 0, left: 0 } + + this.docBody = document.body + + this.hasNavLayout = !document.querySelector('.lesscode-layout-empty') + + this.mainContentNode = document.querySelector('.main-content') + + // 布局模板情况下,contentNode 是 .navigation-container .container-content + this.contentNode = this.hasNavLayout + ? document.querySelector('.navigation-container .container-content') + : this.mainContentNode + } + + setContainer (container) { + if (container) { + if (typeof container === 'string') { + this.options.container = document.querySelector(container) + } else { + this.options.container = container + } + } else { + this.options.container = document.body + } + + this.containerTop = getActualTop(this.options.container) + this.containerLeft = getActualLeft(this.options.container) + } + + /** + * 检测 + * + * @param dragNode {Element} 拖拽的那个元素 + * @param checkNodes {String|Element} 进行检测的所有元素集合 + */ + check (dragNode, checkNodes) { + checkNodes = typeof checkNodes === 'string' ? document.querySelectorAll(checkNodes) : checkNodes + const dragRect = dragNode.getBoundingClientRect() + + this.uncheck() + Array.from(checkNodes).forEach(item => { + item.classList.remove('drag-line-active') + + if (item === dragNode) { + return + } + + const { top, height, bottom, left, width, right } = item.getBoundingClientRect() + + const dragWidthHalf = dragRect.width / 2 + const itemWidthHalf = width / 2 + const dragHeightHalf = dragRect.height / 2 + const itemHeightHalf = height / 2 + + // const actualTop = top - this.containerTop + // const actualLeft = left - this.containerLeft + + const conditions = { + top: [ + // xt-top + { + isNearly: this._isNearly(dragRect.top, top), + lineNode: lines.xt, + lineValue: top, + dragValue: top + }, + // xt-bottom + { + isNearly: this._isNearly(dragRect.bottom, top), + lineNode: lines.xt, + lineValue: top, + dragValue: top - dragRect.height + }, + // xc + { + isNearly: this._isNearly(dragRect.top + dragHeightHalf, top + itemHeightHalf), + lineNode: lines.xc, + lineValue: top + itemHeightHalf, + dragValue: top + itemHeightHalf - dragHeightHalf + }, + // xb-top + { + isNearly: this._isNearly(dragRect.bottom, bottom), + lineNode: lines.xb, + lineValue: bottom, + dragValue: bottom - dragRect.height + }, + // xb-bottom + { + isNearly: this._isNearly(dragRect.top, bottom), + lineNode: lines.xb, + lineValue: bottom, + dragValue: bottom + } + ], + + left: [ + // yl-left + { + isNearly: this._isNearly(dragRect.left, left), + lineNode: lines.yl, + lineValue: left, + dragValue: left + }, + // yl-right + { + isNearly: this._isNearly(dragRect.right, left), + lineNode: lines.yl, + lineValue: left, + dragValue: left - dragRect.width + }, + // yc + { + isNearly: this._isNearly(dragRect.left + dragWidthHalf, left + itemWidthHalf), + lineNode: lines.yc, + lineValue: left + itemWidthHalf, + dragValue: left + itemWidthHalf - dragWidthHalf + }, + // yr-left + { + isNearly: this._isNearly(dragRect.right, right), + lineNode: lines.yr, + lineValue: right, + dragValue: right - dragRect.width + }, + // yr-right + { + isNearly: this._isNearly(dragRect.left, right), + lineNode: lines.yr, + lineValue: right, + dragValue: right + } + ] + } + + for (const key in conditions) { + conditions[key].forEach(condition => { + if (!condition.isNearly) { + return + } + + item.classList.add('drag-line-active') + + if (key === 'left') { + // dragNode.style[key] = `${condition.dragValue - this.containerLeft - 1}px` + + // 没有 layout 导航布局模板时,contentNode 和 mainContentNode 是一样的,为 .main-content + const offsetLeft = this.hasNavLayout + ? this.docBody.scrollLeft + this.contentNode.scrollLeft + this.mainContentNode.scrollLeft + : this.docBody.scrollLeft + this.mainContentNode.scrollLeft + + dragNode.style[key] = `${condition.dragValue - (this.containerLeft - offsetLeft + parseInt(this.offset.left)) - 1}px` + condition.lineNode.setTranslateX(condition.lineValue) + } else { + dragNode.style[key] = `${condition.dragValue - (this.containerTop - this.contentNode.scrollTop + parseInt(this.offset.top)) - 1}px` + condition.lineNode.setTranslateY(condition.lineValue) + } + // condition.lineNode.style[key] = `${condition.lineValue}px` + condition.lineNode.show() + }) + } + }) + } + + uncheck () { + Object.values(lines).forEach(item => item.hide()) + Array.from(document.querySelectorAll('.drag-line-active')).forEach(item => item.classList.remove('drag-line-active')) + } + + _isNearly (dragValue, targetValue) { + return Math.abs(dragValue - targetValue) <= this.options.gap + } +} diff --git a/paas-ce/lesscode/lib/client/src/common/drag.js b/paas-ce/lesscode/lib/client/src/common/drag.js new file mode 100644 index 000000000..9a326320e --- /dev/null +++ b/paas-ce/lesscode/lib/client/src/common/drag.js @@ -0,0 +1,175 @@ +import { getStyle } from '@/common/util' + +const Watcher = function () { + this.events = {} +} + +Watcher.prototype = { + construct: Watcher, + + on (type, callback) { + if (!this.events[type]) { + this.events[type] = [] + } + this.events[type].push(callback) + + return this + }, + + trigger (type) { + const eventList = this.events[type] || [] + const params = Array.prototype.slice.call(arguments, 1) + + eventList.forEach(event => { + event.apply(event, params) + }) + + return this + }, + + off (type, callback) { + const eventList = this.events[type] || [] + + if (!callback) { + this.events[type] = [] + // delete this.events[type] + } else { + eventList.splice(eventList.indexOf(callback), 1) + } + + return this + } +} + +export default function Drag (elem, option) { + this.$elem = elem + this.watcher = new Watcher() + this.option = option || {} + this.dragable = false + this.container = document.body + this.initOpts() + this.init() +} + +Drag.prototype = { + constructor: Drag, + initOpts () { + if (typeof this.$elem === 'string') { + this.$elem = document.querySelector(this.$elem) + } + if (this.option.container) { + if (typeof this.option.container === 'string') { + this.container = document.querySelector(this.option.container) + } else { + this.container = this.option.container + } + } + this.containerWidth = parseFloat(getStyle(this.container, 'width')) + this.containerHeight = parseFloat(getStyle(this.container, 'height')) + + // this.containerTop = getActualTop(this.container) + // this.containerLeft = getActualLeft(this.container) + }, + init () { + const me = this + const container = this.container + me.dragable = false + + let hasMove = false + + const mousedown = e => { + if (me.isChildren(e.target, container)) { + me.dragable = true + } else { + me.dragable = false + return + } + hasMove = false + + const $parent = me.$elem.offsetParent + const diffX = e.clientX - me.$elem.offsetLeft + const diffY = e.clientY - me.$elem.offsetTop + const pDiffX = $parent.offsetLeft || 0 + const pDiffY = $parent.offsetTop || 0 + + const elemWidth = me.$elem.offsetWidth + const elemHeight = me.$elem.offsetHeight + // const style = getComputedStyle(me.$elem) + // const transition = style['transition'] || style['-webkit-transition'] || style['-moz-transition'] + // const zIndex = getComputedStyle(me.$elem).zIndex + + me.watcher.trigger('start', e, me.$elem) + document.addEventListener('mousemove', move) + + me.containerWidth = parseFloat(getStyle(me.container, 'width')) + me.containerHeight = parseFloat(getStyle(me.container, 'height')) + + function move (e) { + if (!me.dragable) { + return + } + hasMove = true + + let left = e.clientX - diffX + let top = e.clientY - diffY + + if (left + pDiffX < 0) { + left = left - (left + pDiffX) + } + if (top + pDiffY < 0) { + top = top - (top + pDiffY) + } + if (left + pDiffX + elemWidth > me.containerWidth) { + left = me.containerWidth - (pDiffX + elemWidth) + } + if (top + pDiffY + elemHeight > me.containerHeight) { + top = me.containerHeight - (pDiffY + elemHeight) + } + + me.$elem.style.position = 'absolute' + // me.$elem.style['transition'] = me.$elem.style['-webkit-transition'] = me.$elem.style['-moz-transition'] = 'unset' + me.$elem.style.left = left + 'px' + me.$elem.style.top = top + 'px' + // me.$elem.style.zIndex = 99999999 + + me.watcher.trigger('move', e, me.$elem) + } + + document.addEventListener('mouseup', end) + function end (e) { + if (!me.dragable) { + return + } + me.$elem.removeEventListener('mousedown', mousedown) + document.removeEventListener('mousemove', move) + document.removeEventListener('mouseup', end) + // me.$elem.style['transition'] = me.$elem.style['-webkit-transition'] = me.$elem.style['-moz-transition'] = transition + // me.$elem.style.zIndex = zIndex + if (hasMove) { + me.watcher.trigger('end', e, me.$elem) + } + } + } + me.$elem.addEventListener('mousedown', mousedown) + }, + + isChildren (element, parent) { + let cur = element + for (;cur.parentNode; cur = cur.parentNode) { + if (cur === parent) { + return true + } + } + return false + }, + + on (type, callback) { + this.watcher.on(type, callback) + return this.watcher + }, + + off: function () { + this.watcher.off.apply(this.watcher, arguments) + return this.watcher + } +} diff --git a/paas-ce/lesscode/lib/client/src/custom/x-form/components/popover/index.js b/paas-ce/lesscode/lib/client/src/common/element.js similarity index 78% rename from paas-ce/lesscode/lib/client/src/custom/x-form/components/popover/index.js rename to paas-ce/lesscode/lib/client/src/common/element.js index 4db63298f..65420402a 100644 --- a/paas-ce/lesscode/lib/client/src/custom/x-form/components/popover/index.js +++ b/paas-ce/lesscode/lib/client/src/common/element.js @@ -1,6 +1,6 @@ /** * Tencent is pleased to support the open source community by making 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available. - * Copyright (C) 2017-2019 THL A29 Limited, a Tencent company. All rights reserved. + * Copyright (C) 2017-2018 THL A29 Limited, a Tencent company. All rights reserved. * Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://opensource.org/licenses/MIT @@ -9,6 +9,8 @@ * specific language governing permissions and limitations under the License. */ -import Popover from './popover.vue' +import Vue from 'vue' +import ElementUI from 'element-ui' +import 'element-ui/lib/theme-chalk/index.css' -export default Popover +Vue.use(ElementUI) diff --git a/paas-ce/lesscode/lib/client/src/common/targetData.js b/paas-ce/lesscode/lib/client/src/common/targetData.js index 74d6e4e7c..d78743acc 100644 --- a/paas-ce/lesscode/lib/client/src/common/targetData.js +++ b/paas-ce/lesscode/lib/client/src/common/targetData.js @@ -17,6 +17,29 @@ class TargetData { return this } + setCurInteractiveVisible (id, init = false) { + const targetData = store.getters['drag/targetData'] || [] + let targetNode + targetData.forEach(item => { + if (item.componentId === id) { + item.interactiveShow = init || !item.interactiveShow + targetNode = item + } else { + item.interactiveShow = false + } + this.update(item) + }) + return targetNode + } + + hideAllInteractiveComponents () { + const targetData = store.getters['drag/targetData'] || [] + targetData.forEach(item => { + item.interactiveShow = false + this.update(item) + }) + } + find (id) { if (typeof id !== 'undefined') { const targetData = store.getters['drag/targetData'] || [] @@ -26,6 +49,8 @@ class TargetData { } walkGrid(targetData, grid, callBack, callBack, index) }) + } else { + this.targetData = store.getters['drag/targetData'] || [] } return this } @@ -98,11 +123,26 @@ class TargetData { return this } + moveFreeLayoutComponent () { + const copyNode = store.getters['drag/copyData'] || {} + function minPx (px) { + return px.replace(/(.+)px/, (str, num) => { + num -= 10 + if (num < 0) num += 20 + return num + 'px' + }) + } + const renderStyles = copyNode.renderStyles + renderStyles.top = minPx(renderStyles.top || '10px') + renderStyles.left = minPx(renderStyles.left || '10px') + } + appendChild (node, shouldChangeId) { + if (this.isInFreeLayout(this.targetData)) this.moveFreeLayoutComponent() node = this.cloneNode(node, shouldChangeId) - if (Array.isArray(this.targetData) && node.type === 'render-grid') { + if (Array.isArray(this.targetData) && this.isLayout(node)) { this.targetData.push(node) - } else if (this.targetData.type === 'render-grid') { + } else if (this.isLayout(this.targetData) && !this.isLayout(node)) { this.targetData.renderKey = uuid() const renderProps = this.targetData.renderProps || {} const slots = renderProps.slots || {} @@ -119,8 +159,9 @@ class TargetData { targetData.forEach((grid, index) => { const callBack = (data, parent, index, parentGrid) => { if (data.componentId === this.targetData.componentId) { - parentGrid.renderKey = uuid() - parent.splice(index + 1, 0, node) + if (parentGrid) parentGrid.renderKey = uuid() + if (this.isInFreeLayout(this.targetData)) parent.push(node) + else parent.splice(index + 1, 0, node) } } walkGrid(targetData, grid, callBack, callBack, index) @@ -129,6 +170,19 @@ class TargetData { return this.find(node.componentId) } + isInFreeLayout (node) { + let isInFreeLayout = node.type === 'free-layout' + if (!isInFreeLayout) { + const parent = findComponentParentGrid(store.getters['drag/targetData'], node.componentId) || {} + isInFreeLayout = parent.type === 'free-layout' + } + return isInFreeLayout + } + + isLayout (node) { + return ['render-grid', 'free-layout'].includes(node.type) + } + appendChildByIndex (node, parentId, columnIndex, childrenIndex, shouldChangeId) { node = this.cloneNode(node, shouldChangeId) const parent = this.find(parentId).value() @@ -205,8 +259,11 @@ class TargetData { node.forEach((grid, index) => { walkGrid(node, grid, callBack, callBack, index) }) - } else if (node.type === 'render-grid') { + } else if (this.isLayout(node)) { walkGrid({}, node, callBack, callBack, 0) + } else if (node.renderProps && node.renderProps.slots && node.renderProps.slots.name === 'layout') { + callBack(node) + walkGrid({}, node.renderProps.slots.val, callBack, callBack, 0) } else { callBack(node) } diff --git a/paas-ce/lesscode/lib/client/src/common/tnpm-version-valid.js b/paas-ce/lesscode/lib/client/src/common/tnpm-version-valid.js new file mode 100644 index 000000000..f0b098456 --- /dev/null +++ b/paas-ce/lesscode/lib/client/src/common/tnpm-version-valid.js @@ -0,0 +1,180 @@ +const MAX_SAFE_COMPONENT_LENGTH = 16 +exports = module.exports = {} + +// The actual regexps go on exports.re +const re = exports.re = [] +const src = exports.src = [] +const t = exports.t = {} +let R = 0 + +const createToken = (name, value, isGlobal) => { + const index = R++ + t[name] = index + src[index] = value + re[index] = new RegExp(value, isGlobal ? 'g' : undefined) +} + +// The following Regular Expressions can be used for tokenizing, +// validating, and parsing SemVer version strings. + +// ## Numeric Identifier +// A single `0`, or a non-zero digit followed by zero or more digits. + +createToken('NUMERICIDENTIFIER', '0|[1-9]\\d*') +createToken('NUMERICIDENTIFIERLOOSE', '[0-9]+') + +// ## Non-numeric Identifier +// Zero or more digits, followed by a letter or hyphen, and then zero or +// more letters, digits, or hyphens. + +createToken('NONNUMERICIDENTIFIER', '\\d*[a-zA-Z-][a-zA-Z0-9-]*') + +// ## Main Version +// Three dot-separated numeric identifiers. + +createToken('MAINVERSION', `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})\\.` + + `(${src[t.NUMERICIDENTIFIER]})`) + +createToken('MAINVERSIONLOOSE', `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})\\.` + + `(${src[t.NUMERICIDENTIFIERLOOSE]})`) + +// ## Pre-release Version Identifier +// A numeric identifier, or a non-numeric identifier. + +createToken('PRERELEASEIDENTIFIER', `(?:${src[t.NUMERICIDENTIFIER] +}|${src[t.NONNUMERICIDENTIFIER]})`) + +createToken('PRERELEASEIDENTIFIERLOOSE', `(?:${src[t.NUMERICIDENTIFIERLOOSE] +}|${src[t.NONNUMERICIDENTIFIER]})`) + +// ## Pre-release Version +// Hyphen, followed by one or more dot-separated pre-release version +// identifiers. + +createToken('PRERELEASE', `(?:-(${src[t.PRERELEASEIDENTIFIER] +}(?:\\.${src[t.PRERELEASEIDENTIFIER]})*))`) + +createToken('PRERELEASELOOSE', `(?:-?(${src[t.PRERELEASEIDENTIFIERLOOSE] +}(?:\\.${src[t.PRERELEASEIDENTIFIERLOOSE]})*))`) + +// ## Build Metadata Identifier +// Any combination of digits, letters, or hyphens. + +createToken('BUILDIDENTIFIER', '[0-9A-Za-z-]+') + +// ## Build Metadata +// Plus sign, followed by one or more period-separated build metadata +// identifiers. + +createToken('BUILD', `(?:\\+(${src[t.BUILDIDENTIFIER] +}(?:\\.${src[t.BUILDIDENTIFIER]})*))`) + +// ## Full Version String +// A main version, followed optionally by a pre-release version and +// build metadata. + +// Note that the only major, minor, patch, and pre-release sections of +// the version string are capturing groups. The build metadata is not a +// capturing group, because it should not ever be used in version +// comparison. + +createToken('FULLPLAIN', `v?${src[t.MAINVERSION] +}${src[t.PRERELEASE]}?${ + src[t.BUILD]}?`) + +createToken('FULL', `^${src[t.FULLPLAIN]}$`) + +// like full, but allows v1.2.3 and =1.2.3, which people do sometimes. +// also, 1.0.0alpha1 (prerelease without the hyphen) which is pretty +// common in the npm registry. +createToken('LOOSEPLAIN', `[v=\\s]*${src[t.MAINVERSIONLOOSE] +}${src[t.PRERELEASELOOSE]}?${ + src[t.BUILD]}?`) + +createToken('LOOSE', `^${src[t.LOOSEPLAIN]}$`) + +createToken('GTLT', '((?:<|>)?=?)') + +// Something like "2.*" or "1.2.x". +// Note that "x.x" is a valid xRange identifer, meaning "any version" +// Only the first item is strictly required. +createToken('XRANGEIDENTIFIERLOOSE', `${src[t.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`) +createToken('XRANGEIDENTIFIER', `${src[t.NUMERICIDENTIFIER]}|x|X|\\*`) + +createToken('XRANGEPLAIN', `[v=\\s]*(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIER]})` + + `(?:${src[t.PRERELEASE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGEPLAINLOOSE', `[v=\\s]*(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:\\.(${src[t.XRANGEIDENTIFIERLOOSE]})` + + `(?:${src[t.PRERELEASELOOSE]})?${ + src[t.BUILD]}?` + + `)?)?`) + +createToken('XRANGE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAIN]}$`) +createToken('XRANGELOOSE', `^${src[t.GTLT]}\\s*${src[t.XRANGEPLAINLOOSE]}$`) + +// Coercion. +// Extract anything that could conceivably be a part of a valid semver +createToken('COERCE', `${'(^|[^\\d])' + + '(\\d{1,'}${MAX_SAFE_COMPONENT_LENGTH}})` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + + `(?:\\.(\\d{1,${MAX_SAFE_COMPONENT_LENGTH}}))?` + + `(?:$|[^\\d])`) +createToken('COERCERTL', src[t.COERCE], true) + +// Tilde ranges. +// Meaning is "reasonably at or greater than" +createToken('LONETILDE', '(?:~>?)') + +createToken('TILDETRIM', `(\\s*)${src[t.LONETILDE]}\\s+`, true) +exports.tildeTrimReplace = '$1~' + +createToken('TILDE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAIN]}$`) +createToken('TILDELOOSE', `^${src[t.LONETILDE]}${src[t.XRANGEPLAINLOOSE]}$`) + +// Caret ranges. +// Meaning is "at least and backwards compatible with" +createToken('LONECARET', '(?:\\^)') + +createToken('CARETTRIM', `(\\s*)${src[t.LONECARET]}\\s+`, true) +exports.caretTrimReplace = '$1^' + +createToken('CARET', `^${src[t.LONECARET]}${src[t.XRANGEPLAIN]}$`) +createToken('CARETLOOSE', `^${src[t.LONECARET]}${src[t.XRANGEPLAINLOOSE]}$`) + +// A simple gt/lt/eq thing, or just "" to indicate "any version" +createToken('COMPARATORLOOSE', `^${src[t.GTLT]}\\s*(${src[t.LOOSEPLAIN]})$|^$`) +createToken('COMPARATOR', `^${src[t.GTLT]}\\s*(${src[t.FULLPLAIN]})$|^$`) + +// An expression to strip any whitespace between the gtlt and the thing +// it modifies, so that `> 1.2.3` ==> `>1.2.3` +createToken('COMPARATORTRIM', `(\\s*)${src[t.GTLT] +}\\s*(${src[t.LOOSEPLAIN]}|${src[t.XRANGEPLAIN]})`, true) +exports.comparatorTrimReplace = '$1$2$3' + +// Something like `1.2.3 - 1.2.4` +// Note that these all use the loose form, because they'll be +// checked against either the strict or loose comparator form +// later. +createToken('HYPHENRANGE', `^\\s*(${src[t.XRANGEPLAIN]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAIN]})` + + `\\s*$`) + +createToken('HYPHENRANGELOOSE', `^\\s*(${src[t.XRANGEPLAINLOOSE]})` + + `\\s+-\\s+` + + `(${src[t.XRANGEPLAINLOOSE]})` + + `\\s*$`) + +// Star ranges basically just allow anything at all. +createToken('STAR', '(<|>)?=?\\s*\\*') +// >=0.0.0 is like a star +createToken('GTE0', '^\\s*>=\\s*0\.0\.0\\s*$') +createToken('GTE0PRE', '^\\s*>=\\s*0\.0\.0-0\\s*$') diff --git a/paas-ce/lesscode/lib/client/src/common/util.js b/paas-ce/lesscode/lib/client/src/common/util.js index 87954b53c..7f55af592 100644 --- a/paas-ce/lesscode/lib/client/src/common/util.js +++ b/paas-ce/lesscode/lib/client/src/common/util.js @@ -9,6 +9,10 @@ * specific language governing permissions and limitations under the License. */ +import { messageSuccess } from '@/common/bkmagic' +import domToImage from './dom-to-image' +import store from '@/store' + /*** * 遍历targetData * parentCallBack 是遍历到grid时候的回调 @@ -16,14 +20,25 @@ */ export function walkGrid (children, grid, childCallBack, parentCallBack, index, columnIndex, parentGrid) { if (parentCallBack) parentCallBack(grid, children, index, parentGrid, columnIndex) + const interactiveComponents = store.getters['components/interactiveComponents'] const renderProps = grid.renderProps || {} const slots = renderProps.slots || {} - const columns = slots.val || [] + let columns = slots.val && Array.isArray(slots.val) ? slots.val : [] + let isLayoutSupportDialog = false + if (interactiveComponents.includes(grid.type)) { // 交互式组件特殊处理 + const slot = grid.renderProps.slots.val + columns = typeof slot === 'string' ? [] : slot.renderProps.slots.val + isLayoutSupportDialog = typeof slot !== 'string' + } + columns.forEach((column, columnIndex) => { const children = column.children || [] children.forEach((component, index) => { - if (component.type === 'render-grid') { + if (component.type === 'render-grid' || component.type === 'free-layout' || (component.name === 'dialog' && isLayoutSupportDialog)) { // 如果是旧数据,dialog不做遍历,新dialog支持layout插槽,需要遍历 walkGrid(children, component, childCallBack, parentCallBack, index, columnIndex, grid) + } else if (component.renderProps.slots && component.renderProps.slots.name === 'layout') { + childCallBack(component, children, index, grid, columnIndex) + walkGrid([], component.renderProps.slots.val, childCallBack, parentCallBack, index, columnIndex) } else { if (childCallBack) childCallBack(component, children, index, grid, columnIndex) } @@ -189,15 +204,6 @@ export function getStringLen (str) { return len } -/** - * 转义特殊字符 - * - * @param {string} str 待转义字符串 - * - * @return {string} 结果 - */ -export const escape = str => String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1') - /** * 对象转为 url query 字符串 * @@ -440,14 +446,16 @@ export function splitValueAndUnit (type, string) { if (!string) { return '' } - const reg = /(\d*)(\D*)/ + + // 支持小数和负数 + const reg = /^(-?\d+(\.\d+)?)(\D*)$/ const match = string.match(reg) if (!match) { return '' } const resultMap = { 'value': Number(match[1]), - 'unit': match[2] + 'unit': match[3] } return resultMap[type] } @@ -472,7 +480,7 @@ export const findComponentParentRow = (target, componentId) => { if (!curNode.renderProps.slots) { continue } - if (curNode.renderProps.slots.type === 'column') { + if (curNode.renderProps.slots.type === 'column' || curNode.renderProps.slots.type === 'free-layout-item') { if (curNode.renderProps.slots.val.length > 0) { for (let j = 0; j < curNode.renderProps.slots.val.length; j++) { const curColumn = curNode.renderProps.slots.val[j] @@ -614,3 +622,279 @@ export const getOffset = target => { } return { left: totalLeft, top: totalTop } } + +/** + * 精确加法 + */ +export function accAdd (arg1, arg2) { + let r1 = 0 + let r2 = 0 + try { + r1 = arg1.toString().split('.')[1].length + } catch (e) { + r1 = 0 + } + try { + r2 = arg2.toString().split('.')[1].length + } catch (e) { + r2 = 0 + } + const c = Math.abs(r1 - r2) + const m = Math.pow(10, Math.max(r1, r2)) + if (c > 0) { + const cm = Math.pow(10, c) + if (r1 > r2) { + arg1 = Number(arg1.toString().replace('.', '')) + arg2 = Number(arg2.toString().replace('.', '')) * cm + } else { + arg1 = Number(arg1.toString().replace('.', '')) * cm + arg2 = Number(arg2.toString().replace('.', '')) + } + } else { + arg1 = Number(arg1.toString().replace('.', '')) + arg2 = Number(arg2.toString().replace('.', '')) + } + return (arg1 + arg2) / m +} + +/** + * 精确减法 + */ +export function accSub (arg1, arg2) { + let r1 = 0 + let r2 = 0 + try { + r1 = arg1.toString().split('.')[1].length + } catch (e) { + r1 = 0 + } + try { + r2 = arg2.toString().split('.')[1].length + } catch (e) { + r2 = 0 + } + const m = Math.pow(10, Math.max(r1, r2)) + const n = (r1 >= r2) ? r1 : r2 + return ((arg1 * m - arg2 * m) / m).toFixed(n) +} + +export const execCopy = (value, message = '复制成功') => { + const textarea = document.createElement('textarea') + document.body.appendChild(textarea) + textarea.value = value + textarea.select() + if (document.execCommand('copy')) { + document.execCommand('copy') + messageSuccess(message) + } + document.body.removeChild(textarea) +} + +/** + * 循环嵌套对象转Str + * @param {*} obj 需要转换的对象 + */ +export const circleJSON = obj => { + let cache = [] + const str = JSON.stringify(obj, (key, value) => { + if (typeof value === 'object' && value !== null) { + if (cache.indexOf(value) !== -1) { + return + } + cache.push(value) + } + return value + }, 4) + cache = null + return str +} + +/** 树结构深度优先遍历(非递归方法) */ +export const deepSearchStack = (tree, key) => { + let stack = [] + const result = [] + stack = stack.concat(tree) + while (stack.length > 0) { + const node = stack.pop() + result.push(node[key]) + if (node.children) { + stack = stack.concat(node.children.reverse()) + } + } + return result +} + +/** + * 反转义 html 特殊字符 + * + * @param {string} html 要反转义的字符串 + * + * @return {string} 结果 + */ +export const unescapeHtml = html => { + const el = document.createElement('div') + return html.replace(/\&[#0-9a-z]+;/gi, function (enc) { + el.innerHTML = enc + return el.innerText + }) +} + +/** + * 更新 canvas context + * + * @param {Object} ctx canvas context + * @param {number} width canvas width + * @param {number} height canvas height + */ +export const updateCanvasContext = function (ctx, width, height) { + const canvas = ctx.canvas + canvas.width = width + canvas.height = height + canvas.style.width = width + 'px' + canvas.style.height = height + 'px' + ctx.imageSmoothingEnabled = true + ctx.webkitImageSmoothingEnabled = true + ctx.setTransform(1, 0, 0, 1, 0, 0) +} + +/** + * html to xml + * + * @param {string} html html + * + * @return {string} xml + */ +export const html2Xml = html => { + const doc = document.implementation.createHTMLDocument('') + doc.write(html) + + // You must manually set the xmlns if you intend to immediately serialize + // the HTML document to a string as opposed to appending it to a + // in the DOM + doc.documentElement.setAttribute('xmlns', doc.documentElement.namespaceURI) + + // Get well-formed markup + html = (new XMLSerializer()).serializeToString(doc.body) + return html +} + +/** + * node 节点转为图片(截图) + * + * @param {Object} domNode 要截图的 node 节点 + * @param {Function} cb 生成截图后的回调,图片加载失败时,会设置一张默认的图片 + */ +export const dom2Img = (domNode, cb) => { + domToImage.toPng(domNode).then(dataUrl => { + cb(dataUrl) + }).catch(err => { + console.warn('dom to image error: ', err) + cb(null) + }) + + // const canvas = document.createElement('canvas') + // const ctx = canvas.getContext('2d') + // updateCanvasContext(ctx, domNode.offsetWidth, domNode.offsetHeight) + + // const PIXEL_RATIO = (() => { + // const ctx = document.createElement('canvas').getContext('2d') + // const dpr = window.devicePixelRatio || 1 + // const bsr = ( + // ctx.webkitBackingStorePixelRatio + // || ctx.mozBackingStorePixelRatio + // || ctx.msBackingStorePixelRatio + // || ctx.oBackingStorePixelRatio + // || ctx.backingStorePixelRatio + // || 1 + // ) + // const ratio = dpr / bsr + // return ratio + // })() + + // const PIXEL_RATIO = 1 + + // const width = ctx.canvas.width + // const height = ctx.canvas.height + + // xml 没有样式,这里把当前页面的样式全部拉过来 + // const pageCssList = [] + // const styleNodeList = document.getElementsByTagName('style') + // const styleMap = {} + // Array.from(styleNodeList).forEach(s => { + // if (!styleMap[s.innerText]) { + // styleMap[s.innerText] = 1 + // pageCssList.push(s.innerText) + // } + // }) + + // const data = 'data:image/svg+xml;charset=utf-8,' + // + '' + // + '' + // + '' + // + html2Xml(domNode.innerHTML) + // + '' + // + '' + + // const img = new Image() + // img.addEventListener('load', () => { + // cb(img) + // }) + // img.addEventListener('error', (err) => { + // console.warn('dom to image error: ', err) + // cb(null) + // }) + // // 有如下符号时,图片会加载失败 + // img.src = data.replace(/\:checked/g, 'checked') + // .replace(/"/g, "'") + // .replace(/%/g, '%25') + // .replace(/#/g, '%23') + // .replace(/{/g, '%7B') + // .replace(/}/g, '%7D') + // .replace(//g, '%3E') +} + +/** + * 根据父节点是否是交互式组件,计算context的偏移 + * @param {*} node HTMLNode + * @returns {x: 0, y:0} + */ +export const getContextOffset = node => { + let isInteractiveParent = false + let curNode = node + while (curNode.parentNode && curNode.parentNode.className !== 'target-drag-area') { + if (curNode.className === 'interactive-component') { + isInteractiveParent = true + break + } + curNode = curNode.parentNode + } + + return isInteractiveParent ? { + x: -parseInt(curNode.style.left), + y: -parseInt(curNode.style.top) + } + : { + x: 0, + y: 0 + } +} + +export const isJsKeyWord = (val) => { + const jsKeyWords = [ + 'await', 'break', 'case', 'catch', 'class', 'const', 'continue', 'debugger', 'default', 'delete', + 'do', 'else', 'enum', 'export', 'extends', 'false', 'finally', 'for', 'function', 'if', 'implements', + 'import', 'in', 'instanceof', 'interface', 'let', 'new', 'null', 'package', 'private', 'protected', + 'public', 'return', 'super', 'switch', 'static', 'this', 'throw', 'try', 'true', 'typeof', 'var', 'void', + 'while', 'with', 'yield', 'array', 'boolean', 'number', 'string', 'object', 'symbol', 'undefined' + ] + return jsKeyWords.includes((val || '').toLowerCase()) +} + +export const isInteractiveCompActive = () => { + const components = document.querySelectorAll('.interactive-component') + const target = Array.from(components).find(el => el.style.display !== 'none') + return target !== undefined +} diff --git a/paas-ce/lesscode/lib/client/src/components/code-viewer/index.vue b/paas-ce/lesscode/lib/client/src/components/code-viewer/index.vue new file mode 100644 index 000000000..7495efbe0 --- /dev/null +++ b/paas-ce/lesscode/lib/client/src/components/code-viewer/index.vue @@ -0,0 +1,195 @@ + + + + + + + diff --git a/paas-ce/lesscode/lib/client/src/components/header.vue b/paas-ce/lesscode/lib/client/src/components/header.vue index 02d86a3d8..6a26af36d 100644 --- a/paas-ce/lesscode/lib/client/src/components/header.vue +++ b/paas-ce/lesscode/lib/client/src/components/header.vue @@ -42,9 +42,6 @@
微信小程序官方组件
-
- 微信小程序官方组件 -
@@ -59,9 +56,6 @@
Vue组件
-
- Vue组件 -
    移动端
    diff --git a/paas-ce/lesscode/lib/client/src/components/member-selector.vue b/paas-ce/lesscode/lib/client/src/components/member-selector.vue new file mode 100644 index 000000000..21ba67755 --- /dev/null +++ b/paas-ce/lesscode/lib/client/src/components/member-selector.vue @@ -0,0 +1,63 @@ + + + + + diff --git a/paas-ce/lesscode/lib/client/src/components/methods/funcForm.vue b/paas-ce/lesscode/lib/client/src/components/methods/func-form.vue similarity index 66% rename from paas-ce/lesscode/lib/client/src/components/methods/funcForm.vue rename to paas-ce/lesscode/lib/client/src/components/methods/func-form.vue index 9c1358eb4..b302fe129 100644 --- a/paas-ce/lesscode/lib/client/src/components/methods/funcForm.vue +++ b/paas-ce/lesscode/lib/client/src/components/methods/func-form.vue @@ -4,6 +4,9 @@ + + + - + {{ temp.name }} + >{{ temp.name }} + + - + - - + + @@ -49,21 +54,23 @@ - - + + - + + + diff --git a/paas-ce/lesscode/lib/client/src/components/modifier/append-select.vue b/paas-ce/lesscode/lib/client/src/components/modifier/append-select.vue index 0ca67d3a8..6008366d6 100644 --- a/paas-ce/lesscode/lib/client/src/components/modifier/append-select.vue +++ b/paas-ce/lesscode/lib/client/src/components/modifier/append-select.vue @@ -10,7 +10,7 @@ -->