Compare commits

..

376 Commits

Author SHA1 Message Date
vben
5d8d9786e3 chore: release 2.9.0 2023-03-24 18:02:27 +08:00
vben
2cca7e8bfb chore: update vscode setting 2023-03-24 18:00:53 +08:00
LooSheng
74ded8aed7 perf: respect the writing style of pinia getters (#2645) 2023-03-24 17:48:35 +08:00
wh
d620758c2f fix(ApiSelect): 支持x.x.x格式 (#2637)
Co-authored-by: whong <whif@foxmail.com>
2023-03-23 11:45:44 +08:00
luocong2016
f2ec2ca273 feat: 添加更多配置项 (#2607) 2023-03-17 12:35:38 +08:00
zty
b66a83c10f fix: upload component preview .webp image (#2631)
Co-authored-by: tianyuan233 <zty.dev@outlook.com>
2023-03-16 13:05:07 +08:00
zty
7bbb86249b fix: set type of FormActionType.setFieldsValue same as type of setFieldsValue in useFormEvents (#2630) 2023-03-16 13:04:49 +08:00
zty
b0a45d4739 fix: modalheader dblclick (#2628) 2023-03-15 13:22:57 +08:00
lzdjack
1095d44110 feat: 替换vextable中button组件 (#2625) 2023-03-14 17:06:57 +08:00
Wit〆苗大
e938e8e9a8 perf(BasicButton): 按钮颜色设置支持主题色primary (#2623)
Co-authored-by: 苗大 <caoshengmiao@hypergryph.com>
2023-03-14 17:06:41 +08:00
予ヾ
3b0077dc73 fix: 修复水印重复叠加问题 (#2622)
Co-authored-by: whong <whif@foxmail.com>
2023-03-14 17:06:25 +08:00
lzdjack
3de5b53bcd fix: 修复表单验证 (#2620)
1.优化验证
2.修复自定义组件验证出错的问题
2023-03-14 17:06:10 +08:00
qixianc94
d7f5dfeb9f fix: ApiTransfer的targetKeys属性无效 (#2615) 2023-03-10 11:32:49 +08:00
儿时的夏日
85bc1f2340 fix: vxe-table与vben ApiTreeSelect适配 (#2613) 2023-03-10 11:32:36 +08:00
Partoo
edede25c8f fix: 修复TypeError: item.indexOf is not a function报错 (#2611) 2023-03-10 11:31:51 +08:00
mfish
6da30edef5 fix(SettingFooter): 解决主题重置后Theme不实时更新问题 (#2608)
* feat(axiosSuccess): 操作成功后根据传入提示模式进行相应

* fix(axiosRetry): 解决get重试请求返回的headers造成无法成功请求的问题

* fix(axiosRetry): 参数首字母小写

* fix(useDataSource): 解决deleteTableRecord删除树形表格的行记录时,无法删除,无法找到子节点的问题

* feat(useDataSource): 删除之前提交代码遗留的console

* fix(permissionGuard): 当获取用户信息失败时,不允许正常登陆返回登陆界面

* fix(permissionGuard): 代码还原

* fix(menu): 解决隐藏菜单目录只能隐藏第一层目录的问题,递归隐藏所有子菜单

* feat(baseSetting): 个人设置图标修改时弹出窗显示原图片,由于跨域获取图片存在问题暂时将user.ts中的跨域图片链接去掉,直接采用本地图片

* fix(ApiSelect): 解决参数类型为string时的警告问题

* fix(SettingFooter): 解决主题重置后Theme不实时更新问题
2023-03-10 11:31:31 +08:00
superlollipop
d9286b5345 修复表格设置固定列,事件回调数据错误 (#2605)
* fix: 修复异步加载表格列时,表格设置显示列为空

* fix: 修复表格设置固定按钮回调事件,未过滤当前选择的列导致回调数据错误
2023-03-06 17:29:54 +08:00
JokeHe
8d218ec8d5 Update useTree.ts (#2602)
修复获取子节点出错
2023-03-06 11:24:24 +08:00
luocong2016
72dbe574d3 fix: 修复表单验证失败的多个错误提示,语法报错问题 (#2601) 2023-03-06 11:24:09 +08:00
superlollipop
4c91ac11e2 fix: 修复异步加载表格列时,表格设置显示列为空 (#2599) 2023-03-04 14:08:32 +08:00
前端爱码士
ce480c5d66 fix: 解决BasicModal弹窗动态:wrapClassName属性被useFullScreen hooks覆盖的问题 (#2598) 2023-03-04 14:08:23 +08:00
前端爱码士
7f5e415da9 fix: 修复deepMerge方法问题 (#2597) 2023-03-04 14:08:13 +08:00
yx lin
714a351036 Feat/cancel event (#2593)
* feat(excel): add cancel event for import excel

* feat(excel): add cancel emits
2023-03-03 13:14:01 +08:00
luocong2016
a78c3a305b Update CollapseHeader.vue (#2583)
#2582
2023-03-02 15:14:00 +08:00
前端爱码士
bb8c2dea40 fix: 解决IconPicker初始拷贝了value的值,导致剪切板内容被覆盖 (#2591) 2023-03-02 15:13:45 +08:00
luocong2016
dce3aba20d refactor: 重构案例代码 (#2589) 2023-03-02 15:13:30 +08:00
jsong
256e0275fe Feat/modify input excel (#2587)
* feat: optimize parameter

* Revert "feat: optimize parameter"

This reverts commit 957dfc95dd.

* feat: can input irregulate excel
2023-02-27 12:52:09 +08:00
tttleon
c70cf3cace fix 主动调用 axioscancelToken 的 cancel 取消请求时 无效的问题 (#2586)
cancelToken 如果被深拷贝,会导致最外层无法使用cancel方法来取消请求
2023-02-27 12:51:51 +08:00
前端爱码士
4f4bec0c22 fix: 修复消息hooks icon类型 (#2585) 2023-02-27 12:51:26 +08:00
luocong2016
491941e4c5 fix<CollapseContainer>: v-show 才不会丢失目标容器 (#2584) 2023-02-27 12:51:13 +08:00
珍藏的小板凳
f1678a7cc0 fix: 修复Container中头部组件插槽中的action不生效的问题 (#2582)
Co-authored-by: xuyang.geng <xuyang.geng@gaea.com>
2023-02-27 12:50:36 +08:00
luocong2016
ed8cffb2a1 fix: 组件属性优先默认 (#2581) 2023-02-27 12:50:11 +08:00
luocong2016
8284d106e2 refactor<useForm>: 重构案例 (#2577) 2023-02-23 22:57:38 +08:00
lzdjack
de305ecd47 fix: 修复页面缓存 (#2575)
1. 修复页面不能缓存的bug
2. 此更新为破坏性更新,页面不支持多标签使用
3. 将表单设计模块多标签改成单标签
2023-02-23 10:28:05 +08:00
luocong2016
a222404220 refactor<mock>: compatibility notes (#2555) 2023-02-22 18:32:53 +08:00
luojz
5335ae7578 fix(FormTable): fix table spread selection(#2565) (#2574)
Co-authored-by: luojingzhou <luojingzhou@kezaihui.com>
2023-02-22 18:32:32 +08:00
luocong2016
f32d2715ef fix: css !mt-5 (#2573) 2023-02-22 18:32:20 +08:00
luocong2016
fb73be0928 fix: table 高度消失 (#2572) 2023-02-22 18:32:07 +08:00
luocong2016
c2a159155c fix: 重复点击全屏会抖动 (#2571) 2023-02-22 18:31:44 +08:00
luocong2016
70ee1c8403 refactor: 插槽优先属性调整,prefixCls优先关系调整 (#2570) 2023-02-22 18:31:27 +08:00
luocong2016
7346988622 refactor: collapse/CollapseContainer (#2569) 2023-02-22 18:31:13 +08:00
luocong2016
d6fdfd9f93 fix<utils>: Color Regular Error (#2567) 2023-02-22 18:30:46 +08:00
Houtaroy
d88915bac3 🐞 fix(Tree): 调整checkedKeys属性的类型 (#2562) 2023-02-22 18:09:30 +08:00
ZhangZhiChao
a1b9bbc2ce fix: 重置表单时移除URL中的参数 (#2559) 2023-02-19 14:25:09 +08:00
luocong2016
64d6fece08 docs: optimization point notes (#2534) 2023-02-15 11:43:50 +08:00
luocong2016
be3d98fa3d chore<table>: fix type (#2529) 2023-02-15 11:43:35 +08:00
luocong2016
ce0f528ba8 chore<table>: fix type (#2528) 2023-02-15 11:43:23 +08:00
luocong2016
085929a9c0 fix<table>: 高度丢失 (#2527) 2023-02-15 11:43:09 +08:00
Vinton
de4eaddffd fix: 注释build/util文件中的代码,修复热更新无效的问题 (#2551)
Co-authored-by: huangwentao <huangwentao@dianchu.com>
2023-02-15 11:42:50 +08:00
wwsheng009
e1804bd866 form-design优化代码格式,清除无用的注释与引用 (#2547)
* fix: 修复form设计器在黑暗模式下的显示问题

* perf: [form-design]优化源代码,清除无用注释与注释
2023-02-15 11:42:35 +08:00
Wit〆苗大
334a0ea8e5 fix(TableAction): 修复outside模式引用时报错;VxeTable demo引用TableAction改为outside模式, 属性添加keepSource以解决警告 (#2544)
* fix(TableAction): 修复outside模式引用时报错: TypeError: Cannot read properties of undefined (reading 'value')

* perf(VxeTable): demo引用TableAction改为outside模式以解决警告; 属性添加keepSource以解决警告

---------

Co-authored-by: 苗大 <caoshengmiao@hypergryph.com>
2023-02-10 19:53:32 +08:00
wwsheng009
bce6cee53a fix: 修复form设计器在黑暗模式下的显示问题 (#2543) 2023-02-10 19:52:57 +08:00
ZhangZhiChao
32daad6198 fix: 修复esbuild的drop_console (#2542) 2023-02-10 19:52:42 +08:00
luocong2016
a4a5a44009 feat<useLogin>: original Form.validate (#2535) 2023-02-10 07:44:29 +08:00
wwsheng009
c5b39f2c16 feat: 增加表单设计器 (#2533) 2023-02-10 07:43:27 +08:00
Wit〆苗大
4c0f2038af perf(vxetable): 封装方法中加入可编辑表格和表单验证相关方法名,并在demo中增加新增和删除方法调用实现 (#2532)
* perf(vxetable): 封装方法中加入可编辑表格相关方法名,并在demo中增加新增和删除方法调用实现

* perf(vxetable): 封装方法中加入表单验证方法名

---------

Co-authored-by: 苗大 <caoshengmiao@hypergryph.com>
2023-02-10 07:42:59 +08:00
luocong2016
d25dfcc7c0 docs:optimization point notes (#2526) 2023-02-10 07:42:04 +08:00
ZhangZhiChao
8992ef472e build: 替换vite废弃的选项brotliSizereportCompressedSize,移除v-i18n-next的fix warning (#2522) 2023-02-10 07:41:36 +08:00
Carson
f7a1b02236 fix(useColumns): 多级表头下的列支持行内编辑 (#2521) 2023-02-05 16:33:12 +08:00
刘大卫
0dc2f1496b fix: 合并单元格页面 由于 ant-design-vue 升级 v3 版本,页面报 Warning: columns.customRender 即将废弃,columns.customRender 用 columns. customCell 替换 (#2520)
* fix(MergeHeader): 组件/Table/合并单元格页面 修改 Tabel.title 值为 合并单元格、修改 Table.bordered 值为 true 更好显示合并单元格效果

* fix(tableData): 由于 ant-design-vue 升级 v3 版本,页面报 Warning: columns.customRender 即将废弃
2023-02-05 16:33:03 +08:00
mfish
dab977ffbc fix(ApiSelect): 解决参数类型为string时的警告问题 (#2517)
* feat(axiosSuccess): 操作成功后根据传入提示模式进行相应

* fix(axiosRetry): 解决get重试请求返回的headers造成无法成功请求的问题

* fix(axiosRetry): 参数首字母小写

* fix(useDataSource): 解决deleteTableRecord删除树形表格的行记录时,无法删除,无法找到子节点的问题

* feat(useDataSource): 删除之前提交代码遗留的console

* fix(permissionGuard): 当获取用户信息失败时,不允许正常登陆返回登陆界面

* fix(permissionGuard): 代码还原

* fix(menu): 解决隐藏菜单目录只能隐藏第一层目录的问题,递归隐藏所有子菜单

* feat(baseSetting): 个人设置图标修改时弹出窗显示原图片,由于跨域获取图片存在问题暂时将user.ts中的跨域图片链接去掉,直接采用本地图片

* fix(ApiSelect): 解决参数类型为string时的警告问题
2023-02-05 16:32:53 +08:00
luocong2016
92cc603680 chore: fix type (#2516) 2023-02-05 16:32:44 +08:00
lzdjack
d3ec7a58ad fix: 修复RadioButtonGroup组件返回值不正确的bug (#2513) 2023-01-31 18:03:21 +08:00
lzdjack
83e529681a perf: 优化ApiRadioGroup回调函数change参数 (#2512) 2023-01-31 18:03:11 +08:00
lzdjack
4d6f24d053 perf: 优化ApiCascader回调函数change参数 (#2511) 2023-01-31 18:03:02 +08:00
lzdjack
45b0be7f7e fix: 修复表单自定义组件验证不通过的bug (#2510) 2023-01-31 18:02:53 +08:00
jinmao88
c999abb236 fix: ci error 2023-01-30 16:20:54 +08:00
jinmao88
816fffe960 fix: lodash 2023-01-30 16:13:07 +08:00
jinmao88
0ad30503a7 chore: update ci 2023-01-30 15:58:36 +08:00
jinmao88
d02ab2d220 chore: update ci 2023-01-30 15:44:56 +08:00
lzdjack
6753e24b3d feat: 接入vextable组件 (#2508) 2023-01-30 14:48:04 +08:00
Wit〆苗大
b90d3572a9 fix(AppendForm): 修复 批量添加表单配置 按钮点击事件未使用批量方法 问题; 表单排版改用baseColProps一次配置,减少重复代码 (#2504)
* fix(AppendForm): 修复 批量添加表单配置 按钮点击事件未使用批量方法 问题

* perf(AppendForm): 表单排版改用baseColProps一次配置,减少重复代码

Co-authored-by: 苗大 <caoshengmiao@hypergryph.com>
2023-01-18 22:43:45 +08:00
Cyrus Zhou
1657439569 修复 updateSchema 多个field 属性时,第二个无效问题。 (#2493)
* Table BasicColumn 添加 editDynamicDisabled
Co-authored-by: Cyrus Zhou <6802207@qq.com>
使用方式同 Form FormSchema dynamicDisabled
```
export const Columns: BasicColumn[] = [
  {
    title: 'Title',
    dataIndex: 'Title',
    editRow: true,
    editComponent: 'Select',
    editDynamicDisabled: ({ record }) => record.isDisabled,
  },

* editComponentProps onChange 功能恢复
Co-authored-by: Cyrus Zhou <6802207@qq.com>
说明:
...omit(compProps, 'onChange')
这会忽略 onChange ,导致 editComponentProps onChange 被取消

如下功能将不支持:
```
editComponentProps: ({ record }) => {
  return {
    options: effectTypeData,
    onChange: () => {
    },
  };
},
```

* tableData == null 报错

* ApiSelect 第一次选择触发required错误提示问题

* 恢复 虽然可以解决第一次选择提示报错问题,但是会导致 onChange: (e: any, options: any) => 无法获得 options 的值

* 修复标签页切换灰屏不显示内容问题
Co-authored-by: Cyrus Zhou <6802207@qq.com>
问题描述页面没有用 div 包括 会提示 Component inside <Transition> renders non-element root node that cannot be animated ,
导致页灰屏必须刷新页面才可以显示内容

* 添加 Form ApiTransfer
## 使用方式
api 方式:
```
    ......
    component: 'ApiTransfer',
    componentProps: {
       api: sysUserSelector,
       labelField: 'name',
       valueField: 'id',
    },
    .....
```
数据方式:
```
     ....
     componentProps: {
      dataSource: [
        { title: 'Test01', key: '0', disabled: false, description: 'description 01' },
        { title: 'Test02', key: '1', disabled: false, description: 'description 02' },
        { title: 'Test03', key: '2', disabled: false, description: 'description 03' },
        { title: 'Test04', key: '3', disabled: false, description: 'description 04' },
        { title: 'Test05', key: '4', disabled: false, description: 'description 05' },
      ],
    },
    ....
```

* style: eslint 书写规范

* fix: 频繁切换页面导致灰屏

* fix: 修复 updateSchema 多个field 属性时,第二个无效问题。

如:
```
updateSchema([
          {
            field: 'password',
            ifShow: !unref(isUpdate),
          },
          {
            field: 'confirm',
            ifShow: !unref(isUpdate),
          },
        ]);
        ```

Co-authored-by: CyrusZhou <6802207@qq.com>
2023-01-18 11:17:44 +08:00
mfish
8dd8a5ed01 个人设置图标修改时弹出窗显示原图片,由于跨域获取图片存在问题暂时将user.ts中的跨域图片链接去掉,直接采用本地图片 (#2487)
* feat(axiosSuccess): 操作成功后根据传入提示模式进行相应

* fix(axiosRetry): 解决get重试请求返回的headers造成无法成功请求的问题

* fix(axiosRetry): 参数首字母小写

* fix(useDataSource): 解决deleteTableRecord删除树形表格的行记录时,无法删除,无法找到子节点的问题

* feat(useDataSource): 删除之前提交代码遗留的console

* fix(permissionGuard): 当获取用户信息失败时,不允许正常登陆返回登陆界面

* fix(permissionGuard): 代码还原

* fix(menu): 解决隐藏菜单目录只能隐藏第一层目录的问题,递归隐藏所有子菜单

* feat(baseSetting): 个人设置图标修改时弹出窗显示原图片,由于跨域获取图片存在问题暂时将user.ts中的跨域图片链接去掉,直接采用本地图片
2023-01-18 11:17:18 +08:00
前端爱码士
f1717973c4 fix: 修复props中Array类型定义问题 (#2491) 2023-01-18 11:16:43 +08:00
Wit〆苗大
0cc53558fb fix(EditableCell): 修复可编辑表格 组件onChange重复问题 (#2495)
* fix: props 初始化拼写错误 defualt => default

* fix: props 定义默认值拼写错误 defualt => default

* fix(EditableCell): 修复可编辑表格select组件onChange重复问题

Co-authored-by: 苗大 <caoshengmiao@hypergryph.com>
2023-01-18 11:16:33 +08:00
nalomu
7e77177ed8 fix:修复header下拉菜单和外部页面菜单的文档链接 (#2500) 2023-01-18 11:16:15 +08:00
前端爱码士
bb1fee5885 fix: 修复table组件insertTableDataRecord方法的返回类型 (#2490) 2023-01-18 11:16:04 +08:00
1xuanyuan1
53b2b23620 fix: 修复权限切换不生效问题 (#2488)
Co-authored-by: 戴文俊 <daiwenjun@qutoutiao.net>
2023-01-18 11:15:46 +08:00
vivianma83
4c67d8c388 feat: 使用useForm时调用setFieldsValue后,组件的onChange未主动触发 (#2142) (#2503)
Co-authored-by: maxiaojing <maxiaojing@hashdata.cn>
2023-01-18 11:15:16 +08:00
Zuo Jiangtao
0ab2a541cb build: git config (#2474) 2023-01-18 11:14:58 +08:00
MAM
4dc5385104 upgrade (#2486)
* fix: upgrade vue from 3.2.37 to 3.2.45

Snyk has created this PR to upgrade vue from 3.2.37 to 3.2.45.

See this package in npm:


See this project in Snyk:
https://app.snyk.io/org/mam-06/project/2dc2fb63-61b9-4ffd-b74e-e101b53b7190?utm_source=github&utm_medium=referral&page=upgrade-pr

* fix: package.json & yarn.lock to reduce vulnerabilities (#6)

The following vulnerabilities are fixed with an upgrade:
- https://snyk.io/vuln/SNYK-JS-TINYMCE-3166281

Co-authored-by: snyk-bot <snyk-bot@snyk.io>
Co-authored-by: Snyk bot <github+bot@snyk.io>
2023-01-07 03:09:09 +08:00
mfish
26bd4aeba6 解决隐藏菜单目录只能隐藏第一层目录的问题,递归隐藏所有子菜单 (#2484)
* feat(axiosSuccess): 操作成功后根据传入提示模式进行相应

* fix(axiosRetry): 解决get重试请求返回的headers造成无法成功请求的问题

* fix(axiosRetry): 参数首字母小写

* fix(useDataSource): 解决deleteTableRecord删除树形表格的行记录时,无法删除,无法找到子节点的问题

* feat(useDataSource): 删除之前提交代码遗留的console

* fix(permissionGuard): 当获取用户信息失败时,不允许正常登陆返回登陆界面

* fix(permissionGuard): 代码还原

* fix(menu): 解决隐藏菜单目录只能隐藏第一层目录的问题,递归隐藏所有子菜单
2023-01-07 03:08:52 +08:00
yuh
61d6057fa4 fix: 裁剪上传接口与uploadModal统一:url (#2482) 2023-01-03 20:13:46 +08:00
李勇
9090cee184 fix: table-datasource,如果后端返回的page total是字符串,会导致页码乱掉 (#2483) 2023-01-03 20:13:26 +08:00
Vinton
31042de6bc perf(component): 优化table 组件的insertTableDataRecord的方法,增加批量插入的功能。 (#2481)
Co-authored-by: huangwentao <huangwentao@dianchu.com>
2023-01-01 17:25:10 +08:00
ruxue777
aabafe8610 fix(components): [Table,EditableCell] rename Function (#2466) 2022-12-27 12:11:59 +08:00
Vinton
098621892d perf(component): 1.优化appendSchemaByField只能单一添加一个表单项的问题,可以传入数组表单项,统一添加,减少重复方法调用 2. 增加批量添加表单项demo (#2472) 2022-12-22 21:36:36 +08:00
sevth
582d7e7351 fix: table cell edit bug. (#2465) 2022-12-18 19:54:39 +08:00
mfish
ca487426a1 删除之前遗留的console (#2463)
* feat(axiosSuccess): 操作成功后根据传入提示模式进行相应

* fix(axiosRetry): 解决get重试请求返回的headers造成无法成功请求的问题

* fix(axiosRetry): 参数首字母小写

* fix(useDataSource): 解决deleteTableRecord删除树形表格的行记录时,无法删除,无法找到子节点的问题

* feat(useDataSource): 删除之前提交代码遗留的console
2022-12-18 19:53:55 +08:00
Sunny-117
2387dcdc6d chore: change website link (#2462)
* chore: change website link

* chore: change website link en
2022-12-18 19:53:30 +08:00
mfish
9435b480ab 解决deleteTableRecord删除树形表格的行记录时,无法删除,无法找到子节点的问题 (#2461)
* feat(axiosSuccess): 操作成功后根据传入提示模式进行相应

* fix(axiosRetry): 解决get重试请求返回的headers造成无法成功请求的问题

* fix(axiosRetry): 参数首字母小写

* fix(useDataSource): 解决deleteTableRecord删除树形表格的行记录时,无法删除,无法找到子节点的问题
2022-12-15 18:30:44 +08:00
李勇
8c2ba755c1 fix:增加basictable组件name,防止注册组件的时候组件没有name (#2440) 2022-12-07 17:12:09 +08:00
Little-LittleProgrammer
c7639c4909 fix(basicForm): Fixed an issue where custom rules trigger would not take effect (#2439)
Co-authored-by: 吴安乐 <wuanle@qimao.com>
2022-12-07 17:11:42 +08:00
wangzhi
6af828260e Update index.vue (#2433)
下面这块代码 在我的项目打包后在比较宽的屏幕(2K 31 寸)有显示 bug 两边会出现大面积空白,   有偶发性 清缓存首次进入会出现 , 刷新就没了, 这里为什么要指定宽度 ?
2022-12-02 09:39:29 +08:00
前端爱码士
5a9a8644d6 fix: 修复Form组件emptySpan类型定义错误 (#2432) 2022-12-01 13:04:46 +08:00
Vinton
0bb3b7f90d fix: 修复频繁调用_setDefaultValue方法,设置初始值的时候,多次调用失效的问题 (#2431)
Co-authored-by: huangwentao <huangwentao@dianchu.com>
2022-12-01 13:04:31 +08:00
yaoyylm
87ee7cd27a 处理(Warning 'Use of eval is strongly discouraged')警告 (#2424) 2022-11-25 08:42:02 +08:00
mfish
ce030d2d1d axiosRetry参数首字母小写 (#2419)
* feat(axiosSuccess): 操作成功后根据传入提示模式进行相应

* fix(axiosRetry): 解决get重试请求返回的headers造成无法成功请求的问题

* fix(axiosRetry): 参数首字母小写
2022-11-24 18:16:34 +08:00
mfish
43c8bf0d0b 解决get重试请求返回的headers造成无法成功请求的问题 (#2416)
* feat(axiosSuccess): 操作成功后根据传入提示模式进行相应

* fix(axiosRetry): 解决get重试请求返回的headers造成无法成功请求的问题
2022-11-24 06:45:28 +08:00
coder_Q
bc099041ce style: optimize the way success hints are encoded in transformRespons… (#2411)
* style: optimize the way success hints are encoded in transformResponseHook #2410

* style: move to introduce location

Co-authored-by: 邱子建 <qiuzijian@qiuzijiandeMacBook-Air.local>
2022-11-24 06:44:53 +08:00
前端爱码士
0629cc7b14 fix: 修复表格图片插槽margin不生效问题 (#2400) 2022-11-22 10:56:24 +08:00
tnnevol
4e16438494 fix: #2390 [Preview]缩小后scale为负值 (#2391) 2022-11-17 23:51:34 +08:00
JinMao
c5713c75ec chore: update ci 2022-11-16 20:48:58 +08:00
JinMao
e7ac09cf39 chore: update ci 2022-11-16 20:31:00 +08:00
JinMao
be4c98b980 chore: update ci 2022-11-16 19:28:57 +08:00
JinMao
e013f04151 chore: update ci 2022-11-16 19:09:44 +08:00
JinMao
3948ba1b01 chore: update ci 2022-11-16 19:02:24 +08:00
JinMao
e74a9ed337 chore: update ci 2022-11-16 18:50:10 +08:00
JinMao
750a50ebfd chore: update ci 2022-11-16 18:46:42 +08:00
JinMao
6d1adce462 chore: update ci 2022-11-16 18:12:16 +08:00
JinMao
d01c1b4d05 chore: update ci 2022-11-16 18:02:57 +08:00
WYH
6844f69c20 fix: 修复demo中formTable几个空指针报错和selectedRowKeys丢失响应式的问题 (#2386)
Co-authored-by: 王一骅 <wangyihua@yazuishou.com>
2022-11-16 17:19:27 +08:00
JinMao
057b82632b chore: update ci 2022-11-15 20:21:43 +08:00
JinMao
908a2fbb3a chore: update ci 2022-11-15 19:43:20 +08:00
smilv
2d2a265418 fix: views中country目录不存在 (#2383) 2022-11-15 18:12:00 +08:00
johnshi
e05a009989 加载失败显示图像占位符。 (#2381)
* 加载失败显示图像占位符。

* fix: 更新package.json
2022-11-15 18:11:43 +08:00
zreren
7fad00cb77 The link of document had been expired (#2378)
* fix:doc link expired

* fix:doc link expired
2022-11-15 08:12:15 +08:00
vben
93d4655285 chore: update ci 2022-11-14 15:04:30 +08:00
vben
448d21287c chore: update ci 2022-11-14 14:56:59 +08:00
vben
31f489fa90 chore: update ci 2022-11-14 14:36:42 +08:00
vben
640ac6217f chore: update ci 2022-11-14 14:26:05 +08:00
vben
37c25a42f5 fix: ci 2022-11-14 14:05:09 +08:00
vben
cdb460897b chore: update ci 2022-11-14 13:59:10 +08:00
vben
84df7a4bb2 chore: update ci 2022-11-14 13:29:56 +08:00
vben
476b2b8acc chore: update CNAME 2022-11-14 13:26:14 +08:00
hunshcn
4041284345 fix(vite-plugin-styleImport): fix ATextarea 直接引用出现样式导入错误的问题 (#2365) 2022-11-14 11:54:59 +08:00
前端爱码士
a12c5706e8 fix: 修复props默认字段default返回空对象语法问题 (#2369) 2022-11-14 11:54:30 +08:00
Wit〆苗大
6fa35521b7 fix: props 定义默认值拼写错误 defualt => default (#2362)
* fix: props 初始化拼写错误 defualt => default

* fix: props 定义默认值拼写错误 defualt => default

Co-authored-by: 苗大 <caoshengmiao@hypergryph.com>
2022-11-12 00:19:58 +08:00
前端爱码士
00c446efff fix: 修复导入相同excel文件不发生change事件 (#2356) 2022-11-12 00:19:44 +08:00
hunshcn
5539190c39 fix(utils): fix dateUtil.formatToDate/formatToDateTime ts type (#2354) 2022-11-11 09:52:30 +08:00
hunshcn
384f929443 fix(utils): fix dateUtil.formatToDate ts type (#2345) 2022-11-10 11:58:33 +08:00
前端爱码士
9ba15705b5 fix: 统一errorMessageMode值为单引号 (#2343) 2022-11-10 11:58:14 +08:00
destiny
d16f6f8e44 fix(component): 解决导出excel数据某一项为null时计算宽度报错 (#2338) 2022-11-09 09:58:30 +08:00
Corn
fc2e2c8789 fix: fix typo (#2337) 2022-11-08 09:06:54 +08:00
ludens blunt
df0e0cbe69 Update index.ts (#2336)
fix(deepMerge): 原对象受浅拷贝影响的问题
2022-11-08 09:06:24 +08:00
Wit〆苗大
7dcb38cac6 fix(BasicTable): setSelectedRows 引入但未加入 tableAction (#2332)
Co-authored-by: 苗大 <caoshengmiao@hypergryph.com>
2022-11-08 09:06:08 +08:00
zxiaozhou
eda251a426 表格添加一个setRows方法以便数据回显后重新获取数据 (#2327) 2022-11-06 06:55:39 +08:00
mfish
17d16ae545 feat(axiosSuccess): 操作成功后根据传入提示模式进行相应 (#2326) 2022-11-06 06:55:07 +08:00
Wit〆苗大
9ae67bf9ca fix: inputNumberGroup(前置/后置标签) span 不起作用的问题,增加样式之后可以根据Span动态适应 (#2325) 2022-11-04 23:45:57 +08:00
前端爱码士
8ba4fb2449 fix: 修复RouteMeta接口定义缺少的RoleEnum引用 (#2323) 2022-11-04 23:45:37 +08:00
无木
1bafeb6638 fix(fullscreen): fix judging full screen status, fixed #2281 2022-10-31 13:12:23 +08:00
无木
fd57b83db6 fix(basicTree): checked with searching, fixed #2070 2022-10-29 10:47:12 +08:00
无木
513ccb9543 fix(route): url with hash not work. fixed #2301 #1311 #1253 2022-10-29 10:35:36 +08:00
无木
e962fa039a fix: auto resize echart on menu collapsed, fixed #2265 2022-10-29 10:05:44 +08:00
无木
58b30aae9a refactor: form advanced logic,fixed #2124, #2078,#2089 . follow #2125 2022-10-29 09:37:39 +08:00
无木
4f9cdc5634 fix(table): rollback value on cancel editing, fixed:#2309 2022-10-28 13:47:06 +08:00
无木
5292838fcd fix(apiSelect): remove attribute warning, fixed #2247 2022-10-28 13:31:43 +08:00
前端爱码士
fd9450304d fix: 关闭非当前的标签没有同步清理cacheTabList数据 (#2306) 2022-10-25 08:49:06 +08:00
sevth
bc499744c0 feat(Form): 支持filedMapToTime分别格式化时间,支持配置时间相关组件默认值处理开关,当组件配置valueFormat时,默认值绑定不再是moment对象,此时应关闭默认值的转换处理 (#2305)
* fix: 修复使用 extendSlots 时插槽参数未传递的问题。

* feat(Form): `fieldMapToTime`additional time formatting support separately.

* fix(Form): Add `isHandleDateDefaultValue` property.

Co-authored-by: sevth <pengqiang@vastweb>
2022-10-25 08:48:47 +08:00
Sizhu Wang
c8b169494f fix(form): 修复表单fieldMapToTime对应的值为空仍提交原来的字段值 (#2303) 2022-10-25 08:48:29 +08:00
sedice
c1d3a94371 refactor: 重构button代码props的引入方式,获取更优雅的类型提示 (#2302)
Co-authored-by: zengqinglong <1107238436@qq.com>
2022-10-23 03:17:50 +08:00
CherishTao
0eb1275c34 Update layout.ts (#2298) 2022-10-23 03:16:50 +08:00
Wit〆苗大
e08a155c40 feat(EditableCell): table 可编辑单元格和可编辑行 增加 单选框相关组件, 并增加示例 (#2294)
Co-authored-by: 苗大 <caoshengmiao@hypergryph.com>
2022-10-20 06:57:56 +08:00
前端爱码士
c37a15fefb fix: 修复getParentLayout方法接受了参数,但并没有用上 (#2290) 2022-10-19 13:34:58 +08:00
前端爱码士
7e4312ec1e fix: vscode安装本地缓存插件后,项目根目录下会生成.history文件夹,忽略提交 (#2287) 2022-10-19 13:34:31 +08:00
前端爱码士
839271d70a fix: 解决mac系统提交代码环境变量报错问题 (#2286) 2022-10-19 13:33:55 +08:00
JinMao
768fadbffb fix: Form method name field 2022-10-18 14:47:50 +08:00
前端爱码士
9aa2cf3ebf fix: 修复单词拼写错误,replace 'Filed' width 'Feild' (#2285) 2022-10-17 09:07:09 +08:00
Luke
b1f78c6696 fix: 取消重复请求,错误处理 (#2184) 2022-10-16 14:22:59 +08:00
zhangcheng1164
dda27477af fix: 修复ColumnSetting中列展示复选框在所有普通列都处于选中状态时没有处于选中状态的bug (#2278) (#2280) 2022-10-14 23:41:41 +08:00
JinMao
1a8cdeb374 fix: workflows 2022-10-13 08:53:00 +08:00
JinMao
5f0bf59a8b fix: workflows 2022-10-13 08:40:30 +08:00
JinMao
1b7896c435 fix: workflows 2022-10-13 08:29:12 +08:00
JinMao
d39e13270c fix: workflows 2022-10-13 08:20:32 +08:00
JinMao
5cabd4a6eb fix: workflows 2022-10-13 08:14:17 +08:00
JinMao
451371a812 fix: workflows 2022-10-13 07:59:31 +08:00
JinMao
6faacd2d85 fix: workflows 2022-10-13 07:51:18 +08:00
JinMao
61aefcaa65 fix: workflows 2022-10-12 20:12:43 +08:00
JinMao
acfba7cccc fix: workflows 2022-10-12 20:02:47 +08:00
JinMao
cb28986683 fix: workflows 2022-10-12 18:13:51 +08:00
姚文强
a89ba204eb fix typo (#2266) 2022-10-12 16:18:33 +08:00
Lovell Liu
a45208673a Fix/workbech page (#2264)
* fix: fix display issues when reloading page

* feat: change a fit color for js-logo icon

* fix: prevent layout chaos because of text wrap
2022-10-12 16:17:42 +08:00
wujieli
39188780ea feat(components): 更新 tinymce skins 目录文件版本 #2155 (#2192) 2022-10-09 16:26:32 +08:00
wangkang
99326342bc 表格查询条件下拉框文本超长显示错乱 (#2242)
* Update index.less

fix: 下拉框文本超长显示问题修改

* Update BasicTable.vue

fix: 表格查询条件下拉框文本超长显示错乱
2022-10-02 06:12:14 +08:00
acdxxx177
dfe560a542 perf: 头像上传组件返回值增加后端接口的返回值 (#2244) 2022-10-02 06:12:01 +08:00
wujieli
692df33fd8 types(components): ApiTransfer props 类型错误,删除多余属性 (#2197) 2022-09-29 13:49:44 +08:00
c37csq
9316d950b1 fix: excel export set width (#2206) 2022-09-29 13:49:32 +08:00
MrAlenZhong
5abb0f2b37 feat: 对BaseTree组件新增treeWrapperClassName属性 (#2217) 2022-09-29 13:49:17 +08:00
wangkang
e47c618b18 Update index.less (#2237)
fix: 下拉框文本超长显示问题修改
2022-09-29 13:49:01 +08:00
adeewu
2abc8275c6 修复调试位置与代码映射位置不一致问题 (#2228) 2022-09-29 13:48:50 +08:00
Aborn Jiang
f1d42769ea Update table.ts (#2223)
兼容row key有可能为number的情况
2022-09-29 13:48:35 +08:00
前端爱码士
dac9301af4 fix: 右键组件缺少PropType类型引用 (#2129)
右键组件缺少PropType类型引用
2022-08-05 11:12:26 +08:00
wjc112233
20c10df846 fix: 修改BasicForm表单的展开和收起按钮状态错误的bug (#2089) (#2109)
Co-authored-by: wjc <7098544231@qq.com>
2022-07-23 19:27:39 +08:00
wjc112233
b11df08aa4 fix: 修复SimpleSubMenu组件被意外地重新渲染的bug (#2106) (#2108)
Co-authored-by: wjc <7098544231@qq.com>
2022-07-23 19:26:33 +08:00
BlackTooth
6e391af3fe fix(keep-alive): disabler (#2101)
Co-authored-by: 隆杰 <longjie.li@taxsoyea.net>
2022-07-23 19:25:15 +08:00
Name6
7925c1ea28 fix(Login): fix display issues when AppLocalePicker's showText property is true (#2097) 2022-07-23 19:24:38 +08:00
newplum
442bd440ba fix(axios): 非GET请求时增加判断config.data是否为FormData (#2082) 2022-07-19 12:10:06 +08:00
wjc112233
4a4321a77d fix: 修改表格的resizeColumn事件的回调函数中,修改列宽度无效的bug (vbenjs#2073) (#2081)
Co-authored-by: wjc <7098544231@qq.com>
2022-07-19 12:09:45 +08:00
Arvin
aee08b14fa Revert "style: 优化滚动条显示,只有在内容超过显示高度时才会出现 (#1978)" (#2080)
This reverts commit deff31bc5d.
2022-07-19 12:09:12 +08:00
zuihou
b9dee8595f feat: 复现:表格中增加比较多的列,且加了rowSelection后,表格错位问题 2022-07-13 19:05:42 +08:00
zuihou
a753eb35cb feat: 表格中增加比较多的列,复现表格错位问题 2022-07-13 18:37:05 +08:00
GauharChan
c001535b56 fix(styleImport): fix ImagePreviewGroup build error (#2068)
Co-authored-by: gauhar chan <chenguohua@gzhtedu.cn>
2022-07-12 01:08:28 +08:00
vancenlee
9afb4318fd fix: inputnumber span 不起作用的问题,增加样式之后可以根据Span动态适应 (#2065)
Co-authored-by: van <vancnblog@126.com>
2022-07-10 18:29:37 +08:00
Henry
baa42a57fd fix: 使用枚举属性表示mock的响应状态 (#2062) 2022-07-10 18:29:21 +08:00
Arvin
6981b73ef6 fix: fix table header and table body cannot be aligned (#2058)
* fix: fix wrong naming

* perf: 表单设置初始值defaultValue时候使用深度拷贝

* perf: 表单设置初始值defaultValue时候使用深度拷贝

* Revert "perf: 表单设置初始值defaultValue时候使用深度拷贝"

This reverts commit a103cd11b4.

* perf: perf Tree Component

* fix: 解决tree树形异步懒加载,点击两次才能关闭

* fix: fix table header and table body cannot be aligned

Co-authored-by: yfh01 <unconfigured@null.spigotmc.org>
2022-07-10 18:28:52 +08:00
sevth
266c33819f fix: 修复使用 extendSlots 时插槽参数未传递的问题。 (#2056)
Co-authored-by: sevth <pengqiang@vastweb>
2022-07-10 18:27:56 +08:00
zhengqbbb
9c26ee1b9c chore: use cz-git commitizen adapter (#2054)
* chore: use `cz-git` commitizen adapter

* workflow: update `cz-git` types description
2022-07-10 18:27:38 +08:00
cn.shperry
f305637366 fix: 中文模式下日期选择框月份及星期异常显示英文 (#1406). (#2053)
Co-authored-by: 舒培培 <622292@ky-tech.com.cn>
2022-07-10 18:26:55 +08:00
Cyrus Zhou
40071529d2 添加 Form ApiTransfer , 修复标签页切换灰屏不显示内容问题 (#2052)
* Table BasicColumn 添加 editDynamicDisabled
Co-authored-by: Cyrus Zhou <6802207@qq.com>
使用方式同 Form FormSchema dynamicDisabled
```
export const Columns: BasicColumn[] = [
  {
    title: 'Title',
    dataIndex: 'Title',
    editRow: true,
    editComponent: 'Select',
    editDynamicDisabled: ({ record }) => record.isDisabled,
  },

* editComponentProps onChange 功能恢复
Co-authored-by: Cyrus Zhou <6802207@qq.com>
说明:
...omit(compProps, 'onChange')
这会忽略 onChange ,导致 editComponentProps onChange 被取消

如下功能将不支持:
```
editComponentProps: ({ record }) => {
  return {
    options: effectTypeData,
    onChange: () => {
    },
  };
},
```

* tableData == null 报错

* ApiSelect 第一次选择触发required错误提示问题

* 恢复 虽然可以解决第一次选择提示报错问题,但是会导致 onChange: (e: any, options: any) => 无法获得 options 的值

* 修复标签页切换灰屏不显示内容问题
Co-authored-by: Cyrus Zhou <6802207@qq.com>
问题描述页面没有用 div 包括 会提示 Component inside <Transition> renders non-element root node that cannot be animated ,
导致页灰屏必须刷新页面才可以显示内容

* 添加 Form ApiTransfer
## 使用方式
api 方式:
```
    ......
    component: 'ApiTransfer',
    componentProps: {
       api: sysUserSelector,
       labelField: 'name',
       valueField: 'id',
    },
    .....
```
数据方式:
```
     ....
     componentProps: {
      dataSource: [
        { title: 'Test01', key: '0', disabled: false, description: 'description 01' },
        { title: 'Test02', key: '1', disabled: false, description: 'description 02' },
        { title: 'Test03', key: '2', disabled: false, description: 'description 03' },
        { title: 'Test04', key: '3', disabled: false, description: 'description 04' },
        { title: 'Test05', key: '4', disabled: false, description: 'description 05' },
      ],
    },
    ....
```
2022-07-10 18:26:39 +08:00
Wit〆苗大
6f5711b088 fix(is.ts): 修复isUrl正则不能匹配到 hash模式的外链 的问题 (#2051)
Co-authored-by: 苗大 <v.caoshm@yoozoo.com>
2022-07-07 15:42:50 +08:00
quyanan
bc55b92c9b fix(expandtable): 恢复可展开表格Demo,修复开启可展开表格后横向滚动失效问题 (#2050)
Co-authored-by: jinmao88 <50581550+jinmao88@users.noreply.github.com>
2022-07-07 15:42:30 +08:00
fuling
f1e8e241b1 feat: ImportExcel组件增加直接获取文件功能,方便后端处理大Excel文件。 (#2045)
* style: 优化系统管理中账号、角色和部门表单样式

* feat: ImportExcel组件增加直接获取文件功能,方便后端处理大Excel文件。

Co-authored-by: 发光的卤蛋 <zdxndy@qq.com>
2022-07-07 15:41:25 +08:00
muamuamu
5833043d14 fix(useRedo): 重新加载页面useRedo方法会添加一条浏览记录 (#2043) 2022-07-07 15:41:08 +08:00
GauharChan
35f2d074ae fix: 修复#2030改动引起的可展开table失效 (#2042) 2022-07-07 15:40:33 +08:00
Tianyuan Zhang
c0e40fa01e refactor: update class AxiosTransform (#2041)
rename transformRequestHook to transformResponseHook
2022-07-07 15:39:48 +08:00
wjc112233
ddb678ddfa fix: fix#2031 修复表格可编辑行在编辑模式下,无法处理数组类型的值的问题 (#2035)
Co-authored-by: wjc <7098544231@qq.com>
2022-07-05 11:56:58 +08:00
Wit〆苗大
91e13c4287 fix(is.ts): fix#2028 修复isUrl正则可以匹配到/www问题 (#2033)
Co-authored-by: 苗大 <v.caoshm@yoozoo.com>
2022-07-05 11:56:45 +08:00
Wit〆苗大
de7279399d fix(table): 彻底修复column.slots已废弃的antd报错, 所有用到的demo页修改为antd 3.x v-slot:headerCell 和 v-slot:bodyCell 写法 (#2030)
Co-authored-by: 苗大 <v.caoshm@yoozoo.com>
2022-07-05 11:56:29 +08:00
Wit〆苗大
a89e497e82 fix: markdown深色模式内容区和代码块未适配bug; markdownViewer改为vidtor自带预览模式 (#2023)
* fix(Markdown): 修复深色模式 内容区和代码块 未改变主题bug

* perf(Markdown): MarkDown组件示例增加不同功能示例; 切换深色主题按钮 同时改变 内容区和代码块主题

* perf(MarkdownViewer): MarkdownViewer改为vditor自带的预览模式; 同时适配深色模式

Co-authored-by: 苗大 <v.caoshm@yoozoo.com>
2022-07-05 11:55:26 +08:00
BlackTooth
0f50e0458e fix(useTableFooter): not synchronization scroll bug (#2022)
Co-authored-by: 隆杰 <longjie.li@taxsoyea.net>
2022-07-05 11:43:53 +08:00
Cyrus Zhou
4730b3af31 Table BasicColumn 添加 editDynamicDisabled (#2018)
* Table BasicColumn 添加 editDynamicDisabled
Co-authored-by: Cyrus Zhou <6802207@qq.com>
使用方式同 Form FormSchema dynamicDisabled
```
export const Columns: BasicColumn[] = [
  {
    title: 'Title',
    dataIndex: 'Title',
    editRow: true,
    editComponent: 'Select',
    editDynamicDisabled: ({ record }) => record.isDisabled,
  },

* editComponentProps onChange 功能恢复
Co-authored-by: Cyrus Zhou <6802207@qq.com>
说明:
...omit(compProps, 'onChange')
这会忽略 onChange ,导致 editComponentProps onChange 被取消

如下功能将不支持:
```
editComponentProps: ({ record }) => {
  return {
    options: effectTypeData,
    onChange: () => {
    },
  };
},
```

* tableData == null 报错

* ApiSelect 第一次选择触发required错误提示问题

* 恢复 虽然可以解决第一次选择提示报错问题,但是会导致 onChange: (e: any, options: any) => 无法获得 options 的值
2022-07-05 11:43:34 +08:00
Charles
740d160198 fix: keep spaces of env config on prod build (#2015) 2022-07-05 11:42:49 +08:00
ParkerFiend
aefde45ad5 Update extensions.json (#1989) 2022-07-05 11:42:16 +08:00
Tanimodori
3cc72d6791 fix: 更新Schema时默认值不应覆盖已有值,fix #1997 (#2003) 2022-06-26 12:47:53 +08:00
Tanimodori
fbcba766ae fix: 修复DrawerFooter border-top导致滚动条出现的问题 (#2002) 2022-06-26 12:47:33 +08:00
Kuizuo
1455eb48db fix: rules validator tips (#2000) 2022-06-26 12:46:43 +08:00
Tanimodori
ba97f80d33 修复tinymce嵌入表单示例页面换行错误,清理!important,revert(vbenjs#1996) (#1999)
* revert: "修改tinymce富文本下拉菜单错位的bug (#1996)"

* style: 修复tinymce嵌入表单示例页面换行错误,清理!important
2022-06-26 12:46:27 +08:00
liuya6
0902de7504 修改tinymce富文本下拉菜单错位的bug (#1996) 2022-06-24 04:37:38 +08:00
cn.shperry
da8e0bdf91 fix: type warning. (#1994)
Co-authored-by: 舒培培 <622292@ky-tech.com.cn>
2022-06-24 04:37:21 +08:00
fuling
06236c9fe0 style: 优化系统管理中账号、角色和部门表单样式 (#1992)
Co-authored-by: 发光的卤蛋 <zdxndy@qq.com>
2022-06-24 04:36:38 +08:00
GauharChan
2c536976e8 feat(function): add table bodyCell slot for antdv3.x; and fix #1705 (#1991) 2022-06-24 04:36:20 +08:00
Tanimodori
c2e2ca9bed style: 修复antdv Modal header高度错误 (#1987) 2022-06-24 04:35:21 +08:00
Tanimodori
02c469b17a types: 再次修复RouteLocationRawEx类型错误 (vbenjs#1968) (#1975) 2022-06-19 17:51:28 +08:00
Micah
deff31bc5d style: 优化滚动条显示,只有在内容超过显示高度时才会出现 (#1978) 2022-06-19 17:50:33 +08:00
cn.shperry
e09a797d05 types: 缩减 setup script 警告 & 修复表格列设置组件中部分方法参数类型错误. (#1980)
Co-authored-by: 舒培培 <622292@ky-tech.com.cn>
2022-06-19 17:50:16 +08:00
cn.shperry
8a7d9bcd4d fix: 修复表格列设置下拉框中偶现列数据区域空白 (#1958) (#1981)
Co-authored-by: 舒培培 <622292@ky-tech.com.cn>
2022-06-19 17:49:47 +08:00
Micah
934ccd34ea fix: 修复 当窗口过窄时,表格中的删除确认框样式错乱 的问题 (#1972) 2022-06-16 19:05:10 +08:00
Tanimodori
85f1e58bcc types: 修复RouteLocationRawEx类型错误 (vbenjs#1968) (#1970) 2022-06-16 19:04:50 +08:00
ChenErik
e073b4c944 fix(echarts): add resize animation (#1950) 2022-06-16 19:04:30 +08:00
You
554f4615a1 fix: 菜单响应式隐藏时宽度计算错误 (#1945)
Co-authored-by: zeozhou <zeozhou@tencent.com>
2022-06-16 19:04:07 +08:00
Arvin
d21578ab33 表单设置初始值defaultValue时候使用深度拷贝 (#1935)
* fix: fix wrong naming

* perf: 表单设置初始值defaultValue时候使用深度拷贝

* perf: 表单设置初始值defaultValue时候使用深度拷贝

* Revert "perf: 表单设置初始值defaultValue时候使用深度拷贝"

This reverts commit a103cd11b4.

* perf: perf Tree Component

* fix: 解决tree树形异步懒加载,点击两次才能关闭

Co-authored-by: yfh01 <unconfigured@null.spigotmc.org>
2022-06-16 19:03:37 +08:00
山田
857af11ced feat(useContext): 删除多余重载 (#1932) 2022-06-16 19:02:51 +08:00
小顾
50468e9581 fix: 修复ColumnSetting中默认隐藏列拖拽排序错误的bug (#1931)
Co-authored-by: 顾佳磊 <jareygu@gmail.com>
2022-06-16 19:02:33 +08:00
Jim
19dc88b4e0 docs: 添加注释, 修复 (#1927)
* docs: 添加注释

* docs: 添加注释

* fix: 后台动态权限changePermissionCode加上await

* docs: 添加注释

* docs: 添加注释

* docs: 添加注释

* docs: 添加注释

* docs: 添加注释
2022-06-16 19:02:10 +08:00
Jim
cfbd52bbe7 docs: 添加注释 (#1924) 2022-05-28 05:49:18 +08:00
前端爱码士
c0edd7b70e fix: 个人中心(data.tsx)多余的html片段 (#1894)
删除个人中心(data.tsx)多余的html片段
2022-05-20 18:02:44 +08:00
chengj
fe5848cf21 feat: contextMenuItem add hidden property (#1890)
* fix: dropdown placement bottomCenter to bottom

* feat: contextMenuItem add hidden property
2022-05-20 18:02:23 +08:00
山田
c3b5abc392 fix(echarts): 修复无法使用散点图表 (#1880) 2022-05-20 18:01:14 +08:00
shellingfordly
a40332cbfe style: fix style error of login page (#1901)
Co-authored-by: liuyao <liuyao@liuyaodeiMac.local>
2022-05-20 18:00:31 +08:00
Joyboo
42908a4535 add TabsForm demo (#1914)
* chore: table size放到settings

* chore(TableAction): 操作确认框增加placement属性支持

* chore(Form): 表单field支持a.b.c嵌套写法

* feat(Form): add TabsForm demo

Co-authored-by: jinmao88 <50581550+jinmao88@users.noreply.github.com>
2022-05-20 18:00:08 +08:00
Felix Hoi
a0920d284d fix(useFormEvents): isNullOrUnDef is not defined (#1915)
* fix/invaild dateFormat

* fix(useFormEvents): isNullOrUnDef is not defined

Co-authored-by: Felix Hoi <felixhoi@ssm.gov.mo>
2022-05-20 17:59:45 +08:00
zuihou
419b7aea07 fix(axios): 请求异常时,无法正确执行 catch 2022-05-06 10:39:46 +08:00
仲灏
e807539b80 perf: Changing variable names (#1869) 2022-05-04 15:11:23 +08:00
Felix Hoi
0634f2ca9e fix/invaild dateFormat (#1871)
Co-authored-by: Felix Hoi <felixhoi@ssm.gov.mo>
2022-05-04 15:11:05 +08:00
Joyboo
d09e998ae7 表单field支持a.b.c的写法 (#1549)
* chore: table size放到settings

* chore(TableAction): 操作确认框增加placement属性支持

* chore(Form): 表单field支持a.b.c嵌套写法

Co-authored-by: jinmao88 <50581550+jinmao88@users.noreply.github.com>
2022-04-30 19:05:02 +08:00
Hongbusi
e097600003 Update README.md (#1861) 2022-04-29 18:39:41 +08:00
chengj
3ee7051950 fix: dropdown placement bottomCenter to bottom (#1865) 2022-04-29 18:39:16 +08:00
chengj
5ad93c6004 feat(function): get selected tree node (#1857) 2022-04-29 09:55:14 +08:00
爱吃薯片的内存条
ce7f382b9b fix: 修复tree组件初次渲染时无法应用已勾选的节点数组及一处字段名错误 (#1854) 2022-04-29 09:54:43 +08:00
Li Kui
1832d0c07a fix: custom validator check failed for prop "placement" (#1851)
[VueTypes warn]: oneOf - value should be one of "topLeft", "topCenter", "topRight", "bottomLeft", "bottomCenter", "bottomRight".
[Vue warn]: Invalid prop: custom validator check failed for prop "placement".
2022-04-29 09:54:18 +08:00
chengj
e05a40f680 feat: specify the position of Pagination in Table component (#1849)
* feat: table add pagination postion property

* feat: specify the postion of Pagination in Table
2022-04-26 13:36:18 +08:00
iconFehu
ee85839ba3 fix: fix wrong naming (#1845)
Co-authored-by: yfh01 <unconfigured@null.spigotmc.org>
2022-04-26 13:35:50 +08:00
Mr Tao
d6a3eecbc2 fix: update @vue/compiler-sfc version (#1836) 2022-04-22 06:32:58 +08:00
George Tan
8932bf9a2d fix(styleImport): fix RangePicker build error (#1820) 2022-04-21 10:48:22 +08:00
JinMao
9d4d78d2c9 chore: update deps 2022-04-21 10:30:04 +08:00
JinMao
2d553f204a chore: update deps 2022-04-18 08:25:20 +08:00
JinMao
3b86435766 feat: ApiTree add afterFetch props,add ApiTree demo 2022-04-18 08:21:04 +08:00
jenson
e3637e7af4 fix: 修复Tree组件如果重新定义fieldNames的title字段后设置actionList失效的问题 (#1778)
Co-authored-by: miaojingu <miaojingu@zclhgroup.com>
2022-04-13 19:46:08 +08:00
Henry Rao
b41e3939ac fix: 修复updateSchema之后会把已填值重置为defaultValue的问题 (#1792) 2022-04-13 19:45:55 +08:00
chengj
23e0932883 fix: 修复Description组件渲染function xxxx() { [native code] }的问题 (#1796)
* fix/description-render-prototype-methods

* fix/description-render-prototype-methods
2022-04-13 19:44:36 +08:00
jinmao88
8f2008ac74 Merge pull request #1799 from hsldymq/fix-fade-transition
fix(Transition): fade-transition淡出淡入无效
2022-04-13 19:41:09 +08:00
jinmao88
2bf48e0f23 合并拉取请求 #1801
feat: 实时监听form表单项值变化
2022-04-13 19:34:58 +08:00
chengj
c0441cf5c3 feat: listen form field value change 2022-04-13 10:49:53 +08:00
hsldymq
b3f6b04981 fix(Transition): fade-transition淡出淡入无效 2022-04-13 00:15:20 +08:00
zuihou
8d93e047d0 fix: 已经存在rules时,required不生效 2022-04-08 23:58:39 +08:00
zuihou
fb43e54847 feat(BasicTree): 支持设置加载中 2022-04-08 18:27:22 +08:00
zuihou
1e0ede09a2 fix: 已经存在rules时,required不生效 2022-04-08 16:39:32 +08:00
JinMao
823f7b3226 chore: update deps 2022-04-08 13:09:03 +08:00
zuihou
28d73f95bd fix: 无需导入 defineExpose 2022-03-30 09:38:48 +08:00
zuihou
418ca2405e Merge remote-tracking branch 'origin/main' 2022-03-28 09:23:52 +08:00
jinmao88
7c21eb9b3a Merge pull request #1752 from chenli1989/main
pref: Optimize tabs dropdown-menu style
2022-03-28 07:25:15 +08:00
zuihou
923ecdab3c fix: 修复表格编辑时 Checkbox 组件无法正常取消勾选 2022-03-28 00:43:07 +08:00
zuihou
eb231120e1 fix(table): 表格编辑支持AutoComplete 2022-03-28 00:41:59 +08:00
zuihou
a343b49014 feat: 表单新增name属性。 配置name后,可以解决同一个页面有多个表单且存在相同字段时, 生成的组件字段的id相同的问题 2022-03-28 00:41:09 +08:00
zuihou
28078d4263 refactor: 支持外部调用展开关闭接口 2022-03-28 00:39:46 +08:00
chenli1989
de266e538d perf: optimize tabs dropdown-menu style 2022-03-26 14:38:24 +08:00
chenli1989
b85a11d0f0 perf: optimize step-by-step form layout 2022-03-26 14:35:38 +08:00
Redon
770574c9b0 fix: 修复 Dropdown 组件 bottomCenter 参数变更的报错提示 (#1745) 2022-03-25 23:40:34 +08:00
chenls
0c633ff67d fix: Set cache overflow of the setTimeout Maximum delay value (#1742) 2022-03-25 23:40:15 +08:00
wangxiaoer5200
d31cb904db fix: 修复控制台一些常见报错和警告 (#1750)
Co-authored-by: wangbin <18695686631@163.com>
2022-03-25 23:39:49 +08:00
jianjianxu
a542317dc3 fix: wrong item.time without the "expires" (#1740) 2022-03-23 22:31:50 +08:00
chenls
e4305daf98 perf: remove ant-design-vue@3.0.0-beta.11 .ant-col fix (#1734) 2022-03-23 22:31:28 +08:00
Micah
10b59395b2 fix: 修复 运行npm run lint:stylelint命令时,无法识别less内置函数 (#1736)
删除 stylelint.config.js文件 rules中重复的selector-class-pattern

Co-authored-by: Micah <yumingsheng@hrbeu.edu.cn>
2022-03-23 22:31:01 +08:00
vben
1dca636521 fix: lint 2022-03-19 07:47:49 +08:00
vben
5db1250a8d fix: stylelint config, close #1658 2022-03-19 06:55:37 +08:00
Captain
136cbb1e3b feat: add request retry (#1553) 2022-03-19 00:07:34 +08:00
LuCat
78535bdd86 fix: 修复右键按钮在弹窗下层级问题 (#1552) 2022-03-19 00:06:37 +08:00
lzdjack
aaa30fbf10 feat(form): appendSchemaByField和updateSchema支持defaultValue (#1608)
1. 兼容appendSchemaByField和updateSchema支持设置默认值
2022-03-19 00:06:01 +08:00
Caisin
9092c34cd5 fix(table):basicColumn加泛型 (#1618)
新版本ant design vue的columnProps使用了泛型,导致xxx.data.ts里面定义的BasicColumn使用customRender地方全部报错
2022-03-19 00:05:49 +08:00
Leo Caan (陈栋)
3d55b0d45b fix: 修复Table当dataIndex为数组时,列设置中勾选列是否展示时使column结构异常的问题 (#1626) 2022-03-19 00:05:30 +08:00
Dack Wang
573a443007 fix(ApiCascader): 引入缺少useI18n库的t方法 (#1648)
* fix():  The Style of tableTitle slot

* fix(ApiCascader): 引入缺少useI18n库的t方法

Co-authored-by: 王英琦 <wangyingqi@91bihu.com>
Co-authored-by: wangyingqi <wangyingqi@chinapost.com.cn>
2022-03-19 00:05:14 +08:00
lee
79eb909c66 feat: make fields key of form deconstructable (#1663)
Co-authored-by: liheng.wu <liheng.wu@tcl.com>
2022-03-19 00:04:11 +08:00
vben
927220933e Merge branch 'main' of https://github.com/anncwb/vue-vben-admin 2022-03-18 21:36:55 +08:00
vben
5a3a7633ac chore: chalk is replaced by piccolors 2022-03-18 18:39:32 +08:00
vben
414101613e chore: lint fix 2022-03-18 20:34:44 +08:00
vben
21bae3ad49 chore: remove jest 2022-03-18 20:22:05 +08:00
vben
b303f1bea3 chore: update deps 2022-03-18 20:07:37 +08:00
JinMao
8f1bd4ae76 fix: Table Title Error 2 2022-03-18 13:50:03 +08:00
JinMao
5c24a1c4c4 fix: Table Title Error 2022-03-15 14:27:16 +08:00
JinMao
e91d757169 chore: update deps 2022-03-15 12:54:27 +08:00
jinmao88
4cda7c6fc1 Merge pull request #1705 from shellingfordly/main
fix(table): 修复antd报错,column.slots已废弃,修改为v-slot:headerCell
2022-03-14 11:38:58 +08:00
liuyao
a23020b76d fix(table): 修复antd报错,将column.slots修改为v-slot:headerCell 2022-03-11 16:17:36 +08:00
vben
af6ab98945 fix: build error 2022-02-28 00:21:26 +08:00
vben
ecc2135b5e chore: update deps 2022-01-24 23:30:26 +08:00
vben
4e4ce944bc feat: support dev https 2022-01-18 22:05:51 +08:00
lzdjack
b63f7d17de feat: 增强可编辑单元格功能 (#1576)
1. 增加可编辑单元格非编辑状态下可自定义样式
2. 扩展editComponentProps,可接受方法
2022-01-18 21:49:24 +08:00
ToQuery
67d514ad0e 新增 api tree 组件 (#1582)
* tsconfig 增加 types , 解决webstorm提示错误

* api-tree
2022-01-18 21:48:58 +08:00
lqxlearn
929141be96 fix:fetch-success total 0 (#1597)
Co-authored-by: qiuxiang <liumeiwang@localhost.com>
2022-01-18 21:48:05 +08:00
wentmac
e82bafa43e fix: 修复EditCellTable 可编辑单元格当columns.ellipsis=true时,回调中取不到key的值。 (#1598) 2022-01-18 21:47:47 +08:00
wangxiaoer5200
5fc28f92d5 fix: 修复CollapseContainer组件按钮插槽问题,close #1555 (#1557) 2021-12-31 09:26:58 +08:00
vben
5ac055be2f fix: build error 2021-12-28 21:48:12 +08:00
ToQuery
266b566850 tsconfig 增加 types , 解决webstorm提示错误 (#1527) 2021-12-28 18:47:57 +08:00
Captain
a281631ae3 fix: The value of ignoreCancelToken is not available in headers (#1506) 2021-12-28 18:47:44 +08:00
1sm
f964533701 feat(BasicForm): add submitOnChange option (#1521) 2021-12-28 18:47:21 +08:00
lzdjack
dd158a17fe feat: 添加table继承父元素高度的功能 (#1523)
在保证了原有的高度计算上,额外新增继承父级高度, 只需设置isCanResizeParent:true
2021-12-28 18:46:57 +08:00
CXM
c8d59a0bbc fix "fix: collapse canExpand (#1501)" (#1525)
* fix(type): fix ant-design-vue  ->

* fix: fix base64 blob

* fix: fix CollapseHeader canExpan bug
2021-12-28 18:46:38 +08:00
wangxiaoer5200
2423aeab64 fix: 修复表单重置某些input类型组件不生效问题,close #1519 (#1526)
Co-authored-by: bingguo <bingguo@gaoding.com>
2021-12-28 18:46:17 +08:00
George Tan
1a43142252 fix(form component): fix form 'vertical' layout row width (#1535) 2021-12-28 18:46:03 +08:00
Eikon
52e295f1d5 docs(enums): update description (#1532) 2021-12-28 18:45:48 +08:00
George Tan
de8ea59177 fix(table component): reduce 'insertTableDataRecord' code logic (#1536) 2021-12-28 18:45:32 +08:00
George Tan
1dc6faf3e6 feat(table component): add 'expandRows' table action (#1537)
* fix(table component): add 'expandRows'

* feat(table component): add 'expandRows' table action
2021-12-28 18:45:14 +08:00
George Tan
598ce5a1bf feat(table component): add 'scrollTo' table action (#1538) 2021-12-28 18:44:51 +08:00
Yinux
8c607b38f1 fix: Fix the date and week display issue on the lock screen(#1539) (#1542) 2021-12-28 18:42:51 +08:00
bingzhe
b84cc5eb06 fix(Modal): repair cancel event missing (#1545) 2021-12-28 18:42:03 +08:00
vben
f015a874e2 chore: update deps 2021-12-19 21:44:29 +08:00
sevth
4f35b95b6b fix: Multiple calls to createAxios function transform parameters are overwritten by other calls (#1474) 2021-12-18 22:28:20 +08:00
Henry Rao
46e28f0203 FixEditcell: 修复可编辑单元格不显示0的bug (#1486)
* fix: 修复可编辑表格不显示 0 的bug

* fix: 修复编辑单元格为空时不能触发编辑的bug
2021-12-18 22:27:44 +08:00
Henry Rao
aab6b4f393 fix: 修复多tab带参数匹配不正确的bug (#1482) 2021-12-18 22:27:28 +08:00
Mark
54ea44cdad fix(Modal): 修复弹窗在最新的360浏览器和搜狗失效的问题 (#1381) (#1488) 2021-12-18 22:26:27 +08:00
lzdjack
a462be0a5e fix: 修复上传附件之后回显了多余条目 (#1495) 2021-12-18 22:25:49 +08:00
lzdjack
b639650397 fix: 修复table自适应高度和title属性声明问题 (#1496)
1.修复table升级ant3.0导致无法自适应剩余高度
2.修复table升级ant3.0导致BasicColumn类型的title属性无法找到
2021-12-18 22:25:33 +08:00
lzdjack
9217a12bcc fix: 修复在windows下pnpm执行package.js里的脚本报错的问题 (#1497) 2021-12-18 22:25:19 +08:00
lzdjack
6b594aec53 fix: Fix the issue that clear verification does not take effect in the reset form (#1498) 2021-12-18 22:24:58 +08:00
CXM
fa33c6b0d7 fix: collapse canExpand (#1501)
* fix(type): fix ant-design-vue  ->

* fix: fix base64 blob

* fix: fix CollapseContainer canExpan
2021-12-18 22:24:28 +08:00
lzdjack
a2b594c962 fix: Fix the problem that the table setting menu cannot be dragged (#1503) 2021-12-18 22:23:42 +08:00
wujieli0207
0dafaa5972 fix(function): Add defineProps reference (#1505) 2021-12-18 22:23:11 +08:00
vben
b0a0cbcd6a fix: Fix context menu not working 2021-12-12 23:17:00 +08:00
Jiang
f6e27aee16 Update ColumnSetting.vue (#1451)
修复配置项中,拖拽后  点击   重置按钮   table 恢复还原,但 拖拽列表并未还原bug
2021-12-12 22:09:29 +08:00
Jiang
23b5538eae 修复 init 运行时机不正确 (#1452)
修复去掉checkList 后,移动配置中的table顺序后,调用tabel.setColum() 时触发 init() ,导致checkList 被重置bug
2021-12-12 22:09:14 +08:00
1sm
ab62739fd1 ApiSelect Add alwaysLoad option (#1461)
* fix(modal): 取消全屏功能后关闭图标颜色异常

* chore: move to pnpm

* fix: RangePicekr在表单项中占满分配的宽度

* chore: comment format

* Revert "fix: RangePicekr在表单项中占满分配的宽度"

This reverts commit cd70e41dac.

* feat(ApiSelect): 新增每次加载选项

Co-authored-by: liushiman <smliu@gk-estor.com>
2021-12-12 22:08:42 +08:00
XC
b70fade587 fix(treeHelper): 修复 listToTree 方法 parent 获取 children 问题 (#1464) 2021-12-12 22:08:23 +08:00
zuihou
05bad7b9dc fix(BasicTree): 加了top参数,操作按钮会错位 2021-12-11 12:18:05 +08:00
zuihou
13d660bede feat: 添加BasicTree使用 fieldNames 后,actionList 和 插槽 会失效的示例代码 2021-12-10 22:19:43 +08:00
zuihou
8523afd512 fix(BasicTree): 修复升级antdv3.x后产生的问题
1. BasicTree组件无法正确使用插槽的问题
2. 无法递归遍历的问题

Closes #1453
2021-12-10 22:17:47 +08:00
zuihou
8480454b73 fix(Form): 修复form宽度问题 2021-12-10 21:24:48 +08:00
vben
e024f6a6e7 fix: typo 2021-12-01 23:09:28 +08:00
vben
cb1759b257 perf(table): remove ExpandIcon 2021-12-01 22:40:29 +08:00
vben
81560fd3c6 fix(tree): fix display error 2021-12-01 22:29:54 +08:00
vben
170a4bceb1 fix(tree-select): replaceFields to fieldNames,close #1423 2021-12-01 22:20:58 +08:00
humanscrew
cfda62ef9c fix: Fix Layout Page Tabs dragable (#1433)
* fix: pnpm install

* fix: Fix Tabs dragable
2021-12-01 22:02:18 +08:00
arika163
16cd2438dd remove duplicate judgment (#1432)
Co-authored-by: zhangchao3 <zhangchao3@corp.netease.com>
2021-12-01 22:01:50 +08:00
JinMao
2a667c9e7f fix: Fix depends @vue/shared @vue/runtime-core 2021-12-01 13:33:59 +08:00
vben
52257f061d refactor(tree): Refactor tree to support antv3.0 2021-11-30 01:01:19 +08:00
vben
50cf2d0b8f chore: update deps 2021-11-28 16:27:56 +08:00
vben
2aabbc788a fix: Fix multi-language errors and installation errors 2021-11-26 00:09:08 +08:00
vben
bc18ecb277 fix: Fix github action running error 2021-11-25 00:23:30 +08:00
vben
413df9f5e1 Merge branch 'feat/antdv3.x' 2021-11-24 23:32:34 +08:00
vben
3fcfac1f37 wip: Upgrade ant-design-vue 3.0 2021-11-24 23:25:13 +08:00
1sm
5fca9ce2c5 chore: comment format (#1398)
* fix(modal): 取消全屏功能后关闭图标颜色异常

* chore: move to pnpm

* fix: RangePicekr在表单项中占满分配的宽度

* chore: comment format

* Revert "fix: RangePicekr在表单项中占满分配的宽度"

This reverts commit cd70e41dac.

Co-authored-by: liushiman <smliu@gk-estor.com>
2021-11-24 23:17:11 +08:00
Carson
dc4b05272f refactor(dashboard): adjust the spacing of Card under the small screen (#1399)
Co-authored-by: huguangju <huguangju@wowkai.cn>
2021-11-24 23:16:53 +08:00
handsomeFu
b8411c9311 chore: fix typo (#1384) 2021-11-22 09:15:59 +08:00
西安十大杰出青年
4806aced85 Update TableAction.vue (#1394)
fix: 解决TableAction组件Dropdown因为权限导致分割线显示错误的问题.
2021-11-22 09:15:50 +08:00
nsk
3b3f6c903a fix: some mistakes close #1349, close #1250 close#1245 (#1373)
* fix(Loading): add theme prop, The repair background prop does not take effect

* fix(AppLogo): fix title line height

* fix(Table,Upload): fix #1349 #1250 #1245
2021-11-15 18:59:28 +08:00
Coderclc
b3c4002b69 fix: Fix setting hideMenu, bread bar jump problem (#1358) 2021-11-15 09:32:14 +08:00
handsomeFu
7e00488635 chore: Update extensions.json (#1359)
Use volar instead of vetur
2021-11-15 09:32:01 +08:00
vben
090d844014 fix: type, #1347 2021-11-11 22:28:39 +08:00
CXM
013cb7f16b fix: fix base64 blob (#1356)
* fix(type): fix ant-design-vue  ->

* fix: fix base64 blob
2021-11-11 22:18:22 +08:00
vben
c2b207dd51 fix: Fix stylelint does not support html files 2021-11-10 23:24:39 +08:00
vben
83921284a6 chore: update deps 2021-11-10 21:49:41 +08:00
HUCHAOQI
59b309aa7e fix(table): 使用lodash 的merge来递归assign,优化在多对象嵌套情况下的结构 (#1350) 2021-11-10 21:45:33 +08:00
liweijie0812
49c890ebec fix: Form appendSchemaByField移除hasInList判断 (#1341) 2021-11-09 09:36:10 +08:00
Joyboo
c8dd3b6c14 TableAction确认框增加placement属性 (#1335)
* chore: table size放到settings

* chore(TableAction): 操作确认框增加placement属性支持
2021-11-08 09:24:53 +08:00
1sm
9999650a9a package.json yarn -> pnpm (#1336)
* fix(modal): 取消全屏功能后关闭图标颜色异常

* chore: move to pnpm

Co-authored-by: liushiman <smliu@gk-estor.com>
2021-11-08 09:24:22 +08:00
miofly
b5364fe546 chore:add rules (#1340) 2021-11-08 09:24:00 +08:00
vben
74b0dfd54f chore: update pkg 2021-11-03 00:38:24 +08:00
413 changed files with 28609 additions and 10577 deletions

View File

@@ -1,6 +1,4 @@
// @ts-check
const { defineConfig } = require('eslint-define-config');
module.exports = defineConfig({
module.exports = {
root: true,
env: {
browser: true,
@@ -20,9 +18,7 @@ module.exports = defineConfig({
extends: [
'plugin:vue/vue3-recommended',
'plugin:@typescript-eslint/recommended',
'prettier',
'plugin:prettier/recommended',
'plugin:jest/recommended',
],
rules: {
'vue/script-setup-uses-vars': 'error',
@@ -62,6 +58,7 @@ module.exports = defineConfig({
'vue/singleline-html-element-content-newline': 'off',
'vue/attribute-hyphenation': 'off',
'vue/require-default-prop': 'off',
'vue/require-explicit-emits': 'off',
'vue/html-self-closing': [
'error',
{
@@ -74,5 +71,6 @@ module.exports = defineConfig({
math: 'always',
},
],
'vue/multi-word-component-names': 'off',
},
});
};

11
.gitattributes vendored Normal file
View File

@@ -0,0 +1,11 @@
# https://docs.github.com/cn/get-started/getting-started-with-git/configuring-git-to-handle-line-endings
# Automatically normalize line endings (to LF) for all text-based files.
* text=auto eol=lf
# Declare files that will always have CRLF line endings on checkout.
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
# Denote all files that are truly binary and should not be modified.
*.{ico,png,jpg,jpeg,gif,webp,svg,woff,woff2} binary

View File

@@ -55,32 +55,31 @@ jobs:
# ARGS: --delete --verbose --parallel=80
push-to-gh-pages:
if: "contains(github.event.head_commit.message, '[release]')"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Sed Config Base
shell: bash
run: |
sed -i 's#VITE_PUBLIC_PATH\s*=.*#VITE_PUBLIC_PATH = /vue-vben-admin/#g' ./.env.production
sed -i "s#VITE_BUILD_COMPRESS\s*=.*#VITE_BUILD_COMPRESS = 'gzip'#g" ./.env.production
sed -i "s#VITE_DROP_CONSOLE\s*=.*#VITE_DROP_CONSOLE = true#g" ./.env.production
cat ./.env.production
- name: use Node.js 16
uses: actions/setup-node@v2.1.2
uses: actions/setup-node@v3
with:
node-version: '16.x'
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache.outputs.dir }}
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
@@ -94,25 +93,31 @@ jobs:
chmod 600 ~/.ssh/id_rsa
ssh-keyscan github.com > ~/.ssh/known_hosts
chmod 700 ~/.ssh && chmod 600 ~/.ssh/*
git config --local user.email "vbenadmin@163.com"
git config --local user.name "vbenAdmin"
- name: Delete gh-pages branch
run: |
git push origin --delete gh-pages
git config --global user.email "vbenadmin@163.com"
git config --global user.name "vbenAdmin"
- name: Build
env:
NODE_OPTIONS: "--max_old_space_size=4096"
run: |
yarn install
yarn run build
touch dist/.nojekyll
cp dist/index.html dist/404.html
- name: Delete gh-pages branch
run: |
git push origin --delete gh-pages
- name: Deploy
uses: peaceiris/actions-gh-pages@v2.5.0
env:
ACTIONS_DEPLOY_KEY: ${{secrets.ACTIONS_DEPLOY_KEY}}
uses: peaceiris/actions-gh-pages@v3.9.0
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
PUBLISH_BRANCH: gh-pages
PUBLISH_DIR: ./dist
with:
forceOrphan: true
CNAME: vben.vvbin.cn

View File

@@ -1,56 +0,0 @@
name: schedule-push-to-ftp
# Timed deployment project
on:
push:
schedule:
- cron: '0 20 * * *'
jobs:
schedule-push-to-ftp:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Sed Config Base
shell: bash
run: |
sed -i 's#VITE_PUBLIC_PATH\s*=.*#VITE_PUBLIC_PATH = /next/#g' ./.env.production
sed -i "s#VITE_BUILD_COMPRESS\s*=.*#VITE_BUILD_COMPRESS = 'gzip'#g" ./.env.production
sed -i "s#VITE_DROP_CONSOLE\s*=.*#VITE_DROP_CONSOLE = true#g" ./.env.production
cat ./.env.production
- name: use Node.js 16
uses: actions/setup-node@v2.1.2
with:
node-version: '16.x'
- name: Get yarn cache
id: yarn-cache
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Build
run: |
yarn install
yarn run build
- name: Deploy
uses: SamKirkland/FTP-Deploy-Action@2.0.0
env:
FTP_SERVER: ${{ secrets.FTP_SERVER }}
FTP_USERNAME: ${{ secrets.FTP_USERNAME }}
FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
METHOD: sftp
PORT: ${{ secrets.FTP_PORT }}
LOCAL_DIR: dist
REMOTE_DIR: /srv/www/vben-admin
ARGS: --delete --verbose --parallel=80

5
.gitignore vendored
View File

@@ -27,3 +27,8 @@ pnpm-debug.log*
*.njsproj
*.sln
*.sw?
package-lock.json
pnpm-lock.yaml
.history

View File

@@ -2,5 +2,5 @@ ports:
- port: 3344
onOpen: open-preview
tasks:
- init: yarn
command: yarn dev
- init: pnpm install
command: pnpm run dev

View File

@@ -3,4 +3,6 @@
# shellcheck source=./_/husky.sh
. "$(dirname "$0")/_/husky.sh"
PATH="/usr/local/bin:$PATH"
npx --no-install commitlint --edit "$1"

View File

@@ -1,8 +0,0 @@
module.exports = {
'*.{js,jsx,ts,tsx}': ['eslint --fix', 'prettier --write'],
'{!(package)*.json,*.code-snippets,.!(browserslist)*rc}': ['prettier --write--parser json'],
'package.json': ['prettier --write'],
'*.vue': ['eslint --fix', 'prettier --write', 'stylelint --fix'],
'*.{scss,less,styl,html}': ['stylelint --fix', 'prettier --write'],
'*.md': ['prettier --write'],
};

View File

@@ -4,5 +4,7 @@
[ -n "$CI" ] && exit 0
PATH="/usr/local/bin:$PATH"
# Format and submit code according to lintstagedrc.js configuration
npm run lint:lint-staged

View File

@@ -1,6 +1,6 @@
{
"recommendations": [
"octref.vetur",
"vue.volar",
"dbaeumer.vscode-eslint",
"stylelint.vscode-stylelint",
"esbenp.prettier-vscode",

50
.vscode/settings.json vendored
View File

@@ -1,16 +1,10 @@
{
"typescript.tsdk": "./node_modules/typescript/lib",
"typescript.enablePromptUseWorkspaceTsdk": true,
"volar.tsPlugin": true,
"volar.tsPluginStatus": false,
//===========================================
//============= Editor ======================
//===========================================
"npm.packageManager": "pnpm",
"editor.tabSize": 2,
"editor.defaultFormatter": "esbenp.prettier-vscode",
//===========================================
//============= files =======================
//===========================================
"files.eol": "\n",
"search.exclude": {
"**/node_modules": true,
@@ -61,7 +55,7 @@
"**/yarn.lock": true
},
"stylelint.enable": true,
"stylelint.packageManager": "yarn",
"stylelint.validate": ["css", "less", "postcss", "scss", "vue", "sass"],
"path-intellisense.mappings": {
"/@/": "${workspaceRoot}/src"
},
@@ -94,7 +88,8 @@
},
"[vue]": {
"editor.codeActionsOnSave": {
"source.fixAll.eslint": false
"source.fixAll.eslint": true,
"source.fixAll.stylelint": true
}
},
"i18n-ally.localesPaths": ["src/locales/lang"],
@@ -137,6 +132,39 @@
"lintstagedrc",
"brotli",
"tailwindcss",
"sider"
]
"sider",
"pnpm",
"antd"
],
"vetur.format.scriptInitialIndent": true,
"vetur.format.styleInitialIndent": true,
"vetur.validation.script": false,
"MicroPython.executeButton": [
{
"text": "▶",
"tooltip": "运行",
"alignment": "left",
"command": "extension.executeFile",
"priority": 3.5
}
],
"MicroPython.syncButton": [
{
"text": "$(sync)",
"tooltip": "同步",
"alignment": "left",
"command": "extension.execute",
"priority": 4
}
],
// 控制相关文件嵌套展示
"explorer.fileNesting.enabled": true,
"explorer.fileNesting.expand": false,
"explorer.fileNesting.patterns": {
"*.ts": "$(capture).test.ts, $(capture).test.tsx",
"*.tsx": "$(capture).test.ts, $(capture).test.tsx",
"*.env": "$(capture).env.*",
"package.json": "pnpm-lock.yaml,yarn.lock,LICENSE,README*,CHANGELOG*,CNAME,.gitattributes,.gitignore,prettier.config.js,stylelint.config.js,commitlint.config.js,.stylelintignore,.prettierignore,.gitpod.yml,.eslintrc.js,.eslintignore"
},
"terminal.integrated.scrollback": 10000
}

View File

@@ -1,48 +0,0 @@
# test directories
__tests__
test
tests
powered-test
# asset directories
docs
doc
website
images
assets
# examples
example
examples
# code coverage directories
coverage
.nyc_output
# build scripts
Makefile
Gulpfile.js
Gruntfile.js
# configs
appveyor.yml
circle.yml
codeship-services.yml
codeship-steps.yml
wercker.yml
.tern-project
.gitattributes
.editorconfig
.*ignore
.eslintrc
.jshintrc
.flowconfig
.documentup.json
.yarn-metadata.json
.travis.yml
# misc
*.md
!istanbul-reports/lib/html/assets
!istanbul-api/node_modules/istanbul-reports/lib/html/assets

View File

@@ -1,4 +1,4 @@
## [2.7.2](https://github.com/anncwb/vue-vben-admin/compare/v2.7.1...v2.7.2) (2021-09-13)
## [2.8.0](https://github.com/anncwb/vue-vben-admin/compare/v2.7.2...v2.8.0) (2021-11-03)
### Bug Fixes

1
CNAME Normal file
View File

@@ -0,0 +1 @@
vben.vvbin.cn

View File

@@ -21,11 +21,11 @@ Vue Vben Admin is a free and open source middle and back-end template. Using the
- **Authority** Built-in complete dynamic routing permission generation scheme.
- **Component** Multiple commonly used components are encapsulated twice
## 预览
## Preview
- [vue-vben-admin](https://vvbin.cn/next/) - Full version Chinese site
- [vue-vben-admin](https://vben.vvbin.cn/) - Full version Chinese site
- [vue-vben-admin-gh-pages](https://anncwb.github.io/vue-vben-admin/) - Full version of the github site
- [vben-admin-thin-next](https://vvbin.cn/thin/next/) - Simplified Chinese site
- [vben-admin-thin-next](https://vben.vvbin.cn/thin/next/) - Simplified Chinese site
- [vben-admin-thin-gh-pages](https://anncwb.github.io/vben-admin-thin-next/) -Simplified github site
Test account: vben/123456
@@ -44,7 +44,7 @@ Open the project in Gitpod (free online dev environment for GitHub) and start co
## Documentation
[Document](https://vvbin.cn/doc-next/)
[Document](https://doc.vvbin.cn/)
## Preparation
@@ -70,20 +70,20 @@ git clone https://github.com/anncwb/vue-vben-admin.git
```bash
cd vue-vben-admin
yarn install
pnpm install
```
- run
```bash
yarn serve
pnpm serve
```
- build
```bash
yarn build
pnpm build
```
## Change Log

View File

@@ -23,9 +23,9 @@ Vue Vben Admin 是一个免费开源的中后台模版。使用了最新的`vue3
## 预览
- [vue-vben-admin](https://vvbin.cn/next/) - 完整版中文站点
- [vue-vben-admin](https://vben.vvbin.cn/) - 完整版中文站点
- [vue-vben-admin-gh-pages](https://anncwb.github.io/vue-vben-admin/) - 完整版 github 站点
- [vben-admin-thin-next](https://vvbin.cn/thin/next/) - 简化版中文站点
- [vben-admin-thin-next](https://vben.vvbin.cn/thin/next/) - 简化版中文站点
- [vben-admin-thin-gh-pages](https://anncwb.github.io/vben-admin-thin-next/) - 简化版 github 站点
测试账号: vben/123456
@@ -44,7 +44,7 @@ Vue Vben Admin 是一个免费开源的中后台模版。使用了最新的`vue3
## 文档
[文档地址](https://vvbin.cn/doc-next/)
[文档地址](https://doc.vvbin.cn/)
## 准备
@@ -70,20 +70,20 @@ git clone https://github.com/anncwb/vue-vben-admin.git
```bash
cd vue-vben-admin
yarn install
pnpm install
```
- 运行
```bash
yarn serve
pnpm serve
```
- 打包
```bash
yarn build
pnpm build
```
## 更新日志

View File

@@ -1,7 +1,7 @@
import path from 'path';
import fs from 'fs-extra';
import inquirer from 'inquirer';
import chalk from 'chalk';
import colors from 'picocolors';
import pkg from '../../../package.json';
async function generateIcon() {
@@ -64,7 +64,7 @@ async function generateIcon() {
}
fs.emptyDir(path.join(process.cwd(), 'node_modules/.vite'));
console.log(
`${chalk.cyan(`[${pkg.name}]`)}` + ' - Icon generated successfully:' + `[${prefixSet}]`,
`${colors.cyan(`[${pkg.name}]`)}` + ' - Icon generated successfully:' + `[${prefixSet}]`,
);
});
}

View File

@@ -3,7 +3,7 @@
*/
import { GLOB_CONFIG_FILE_NAME, OUTPUT_DIR } from '../constant';
import fs, { writeFileSync } from 'fs-extra';
import chalk from 'chalk';
import colors from 'picocolors';
import { getEnvConfig, getRootPath } from '../utils';
import { getConfigFileName } from '../getConfigFileName';
@@ -21,20 +21,22 @@ function createConfig(params: CreateConfigParams) {
try {
const windowConf = `window.${configName}`;
// Ensure that the variable will not be modified
const configStr = `${windowConf}=${JSON.stringify(config)};
let configStr = `${windowConf}=${JSON.stringify(config)};`;
configStr += `
Object.freeze(${windowConf});
Object.defineProperty(window, "${configName}", {
configurable: false,
writable: false,
});
`.replace(/\s/g, '');
fs.mkdirp(getRootPath(OUTPUT_DIR));
writeFileSync(getRootPath(`${OUTPUT_DIR}/${configFileName}`), configStr);
console.log(chalk.cyan(`✨ [${pkg.name}]`) + ` - configuration file is build successfully:`);
console.log(chalk.gray(OUTPUT_DIR + '/' + chalk.green(configFileName)) + '\n');
console.log(colors.cyan(`✨ [${pkg.name}]`) + ` - configuration file is build successfully:`);
console.log(colors.gray(OUTPUT_DIR + '/' + colors.green(configFileName)) + '\n');
} catch (error) {
console.log(chalk.red('configuration file configuration file failed to package:\n' + error));
console.log(colors.red('configuration file configuration file failed to package:\n' + error));
}
}

View File

@@ -1,7 +1,7 @@
// #!/usr/bin/env node
import { runBuildConfig } from './buildConf';
import chalk from 'chalk';
import colors from 'picocolors';
import pkg from '../../package.json';
@@ -14,9 +14,9 @@ export const runBuild = async () => {
runBuildConfig();
}
console.log(`${chalk.cyan(`[${pkg.name}]`)}` + ' - build successfully!');
console.log(`${colors.cyan(`[${pkg.name}]`)}` + ' - build successfully!');
} catch (error) {
console.log(chalk.red('vite build error:\n' + error));
console.log(colors.red('vite build error:\n' + error));
process.exit(1);
}
};

View File

@@ -36,11 +36,11 @@ export function wrapperEnv(envConf: Recordable): ViteEnv {
}
}
ret[envName] = realName;
if (typeof realName === 'string') {
process.env[envName] = realName;
} else if (typeof realName === 'object') {
process.env[envName] = JSON.stringify(realName);
}
// if (typeof realName === 'string') {
// process.env[envName] = realName;
// } else if (typeof realName === 'object') {
// process.env[envName] = JSON.stringify(realName);
// }
}
return ret;
}

View File

@@ -1,21 +0,0 @@
// TODO
import type { GetManualChunk } from 'rollup';
//
const vendorLibs: { match: string[]; output: string }[] = [
// {
// match: ['xlsx'],
// output: 'xlsx',
// },
];
// @ts-ignore
export const configManualChunk: GetManualChunk = (id: string) => {
if (/[\\/]node_modules[\\/]/.test(id)) {
const matchItem = vendorLibs.find((item) => {
const reg = new RegExp(`[\\/]node_modules[\\/]_?(${item.match.join('|')})(.*)`, 'ig');
return reg.test(id);
});
return matchItem ? matchItem.output : null;
}
};

View File

@@ -2,16 +2,16 @@
* Used to package and output gzip. Note that this does not work properly in Vite, the specific reason is still being investigated
* https://github.com/anncwb/vite-plugin-compression
*/
import type { Plugin } from 'vite';
import type { PluginOption } from 'vite';
import compressPlugin from 'vite-plugin-compression';
export function configCompressPlugin(
compress: 'gzip' | 'brotli' | 'none',
deleteOriginFile = false,
): Plugin | Plugin[] {
): PluginOption | PluginOption[] {
const compressList = compress.split(',');
const plugins: Plugin[] = [];
const plugins: PluginOption[] = [];
if (compressList.includes('gzip')) {
plugins.push(

View File

@@ -1,25 +0,0 @@
import type { Plugin } from 'vite';
/**
* TODO
* Temporarily solve the Vite circular dependency problem, and wait for a better solution to fix it later. I don't know what problems this writing will bring.
* @returns
*/
export function configHmrPlugin(): Plugin {
return {
name: 'singleHMR',
handleHotUpdate({ modules, file }) {
if (file.match(/xml$/)) return [];
modules.forEach((m) => {
if (!m.url.match(/\.(css|less)/)) {
m.importedModules = new Set();
m.importers = new Set();
}
});
return modules;
},
};
}

View File

@@ -2,8 +2,8 @@
* Plugin to minimize and use ejs template syntax in index.html.
* https://github.com/anncwb/vite-plugin-html
*/
import type { Plugin } from 'vite';
import html from 'vite-plugin-html';
import type { PluginOption } from 'vite';
import { createHtmlPlugin } from 'vite-plugin-html';
import pkg from '../../../package.json';
import { GLOB_CONFIG_FILE_NAME } from '../../constant';
@@ -16,7 +16,7 @@ export function configHtmlPlugin(env: ViteEnv, isBuild: boolean) {
return `${path || '/'}${GLOB_CONFIG_FILE_NAME}?v=${pkg.version}-${new Date().getTime()}`;
};
const htmlPlugin: Plugin[] = html({
const htmlPlugin: PluginOption[] = createHtmlPlugin({
minify: isBuild,
inject: {
// Inject data into ejs template

View File

@@ -1,10 +1,11 @@
import type { Plugin } from 'vite';
import { PluginOption } from 'vite';
import vue from '@vitejs/plugin-vue';
import vueJsx from '@vitejs/plugin-vue-jsx';
import legacy from '@vitejs/plugin-legacy';
import purgeIcons from 'vite-plugin-purge-icons';
import windiCSS from 'vite-plugin-windicss';
import vueSetupExtend from 'vite-plugin-vue-setup-extend';
import VitePluginCertificate from 'vite-plugin-mkcert';
//import vueSetupExtend from 'vite-plugin-vue-setup-extend';
import { configHtmlPlugin } from './html';
import { configPwaConfig } from './pwa';
import { configMockPlugin } from './mock';
@@ -14,7 +15,6 @@ import { configVisualizerConfig } from './visualizer';
import { configThemePlugin } from './theme';
import { configImageminPlugin } from './imagemin';
import { configSvgIconsPlugin } from './svgSprite';
import { configHmrPlugin } from './hmr';
export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
const {
@@ -25,21 +25,21 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE,
} = viteEnv;
const vitePlugins: (Plugin | Plugin[])[] = [
const vitePlugins: (PluginOption | PluginOption[])[] = [
// have to
vue(),
// have to
vueJsx(),
// support name
vueSetupExtend(),
//vueSetupExtend(),
VitePluginCertificate({
source: 'coding',
}),
];
// vite-plugin-windicss
vitePlugins.push(windiCSS());
// TODO
!isBuild && vitePlugins.push(configHmrPlugin());
// @vitejs/plugin-legacy
VITE_LEGACY && isBuild && vitePlugins.push(legacy());
@@ -61,12 +61,12 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) {
// rollup-plugin-visualizer
vitePlugins.push(configVisualizerConfig());
//vite-plugin-theme
// vite-plugin-theme
vitePlugins.push(configThemePlugin(isBuild));
// The following plugins only work in the production environment
if (isBuild) {
//vite-plugin-imagemin
// vite-plugin-imagemin
VITE_USE_IMAGEMIN && vitePlugins.push(configImageminPlugin());
// rollup-plugin-gzip

View File

@@ -2,13 +2,13 @@
* Introduces component library styles on demand.
* https://github.com/anncwb/vite-plugin-style-import
*/
import styleImport from 'vite-plugin-style-import';
import { createStyleImportPlugin, VxeTableResolve } from 'vite-plugin-style-import';
export function configStyleImportPlugin(isBuild: boolean) {
if (!isBuild) {
export function configStyleImportPlugin(_isBuild: boolean) {
if (!_isBuild) {
return [];
}
const styleImportPlugin = styleImport({
const styleImportPlugin = createStyleImportPlugin({
libs: [
{
libraryName: 'ant-design-vue',
@@ -19,6 +19,7 @@ export function configStyleImportPlugin(isBuild: boolean) {
'anchor-link',
'sub-menu',
'menu-item',
'menu-divider',
'menu-item-group',
'breadcrumb-item',
'breadcrumb-separator',
@@ -48,6 +49,7 @@ export function configStyleImportPlugin(isBuild: boolean) {
// 这里是需要额外引入样式的子组件列表
// 单独引入子组件时需引入组件样式,否则会在打包后导致子组件样式丢失
const replaceList = {
textarea: 'input',
'typography-text': 'typography',
'typography-title': 'typography',
'typography-paragraph': 'typography',
@@ -63,6 +65,8 @@ export function configStyleImportPlugin(isBuild: boolean) {
'layout-footer': 'layout',
'layout-header': 'layout',
'month-picker': 'date-picker',
'range-picker': 'date-picker',
'image-preview-group': 'image',
};
return ignoreList.includes(name)
@@ -73,6 +77,7 @@ export function configStyleImportPlugin(isBuild: boolean) {
},
},
],
resolves: [VxeTableResolve()],
});
return styleImportPlugin;
}

View File

@@ -3,11 +3,11 @@
* https://github.com/anncwb/vite-plugin-svg-icons
*/
import SvgIconsPlugin from 'vite-plugin-svg-icons';
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
import path from 'path';
export function configSvgIconsPlugin(isBuild: boolean) {
const svgIconsPlugin = SvgIconsPlugin({
const svgIconsPlugin = createSvgIconsPlugin({
iconDirs: [path.resolve(process.cwd(), 'src/assets/icons')],
svgoOptions: isBuild,
// default

View File

@@ -2,7 +2,7 @@
* Vite plugin for website theme color switching
* https://github.com/anncwb/vite-plugin-theme
*/
import type { Plugin } from 'vite';
import type { PluginOption } from 'vite';
import path from 'path';
import {
viteThemePlugin,
@@ -14,7 +14,7 @@ import {
import { getThemeColors, generateColors } from '../../config/themeConfig';
import { generateModifyVars } from '../../generate/generateModifyVars';
export function configThemePlugin(isBuild: boolean): Plugin[] {
export function configThemePlugin(isBuild: boolean): PluginOption[] {
const colors = generateColors({
mixDarken,
mixLighten,
@@ -85,5 +85,5 @@ export function configThemePlugin(isBuild: boolean): Plugin[] {
}),
];
return plugin as unknown as Plugin[];
return plugin as unknown as PluginOption[];
}

View File

@@ -1,3 +1,23 @@
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
const scopes = fs
.readdirSync(path.resolve(__dirname, 'src'), { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name.replace(/s$/, ''));
// precomputed scope
const scopeComplete = execSync('git status --porcelain || true')
.toString()
.trim()
.split('\n')
.find((r) => ~r.indexOf('M src'))
?.replace(/(\/)/g, '%%')
?.match(/src%%((\w|-)*)/)?.[1]
?.replace(/s$/, '');
/** @type {import('cz-git').UserConfig} */
module.exports = {
ignores: [(commit) => commit.includes('init')],
extends: ['@commitlint/config-conventional'],
@@ -30,4 +50,58 @@ module.exports = {
],
],
},
prompt: {
/** @use `yarn commit :f` */
alias: {
f: 'docs: fix typos',
r: 'docs: update README',
s: 'style: update code format',
b: 'build: bump dependencies',
c: 'chore: update config',
},
customScopesAlign: !scopeComplete ? 'top' : 'bottom',
defaultScope: scopeComplete,
scopes: [...scopes, 'mock'],
allowEmptyIssuePrefixs: false,
allowCustomIssuePrefixs: false,
// English
typesAppend: [
{ value: 'wip', name: 'wip: work in process' },
{ value: 'workflow', name: 'workflow: workflow improvements' },
{ value: 'types', name: 'types: type definition file changes' },
],
// 中英文对照版
// messages: {
// type: '选择你要提交的类型 :',
// scope: '选择一个提交范围 (可选):',
// customScope: '请输入自定义的提交范围 :',
// subject: '填写简短精炼的变更描述 :\n',
// body: '填写更加详细的变更描述 (可选)。使用 "|" 换行 :\n',
// breaking: '列举非兼容性重大的变更 (可选)。使用 "|" 换行 :\n',
// footerPrefixsSelect: '选择关联issue前缀 (可选):',
// customFooterPrefixs: '输入自定义issue前缀 :',
// footer: '列举关联issue (可选) 例如: #31, #I3244 :\n',
// confirmCommit: '是否提交或修改commit ?',
// },
// types: [
// { value: 'feat', name: 'feat: 新增功能' },
// { value: 'fix', name: 'fix: 修复缺陷' },
// { value: 'docs', name: 'docs: 文档变更' },
// { value: 'style', name: 'style: 代码格式' },
// { value: 'refactor', name: 'refactor: 代码重构' },
// { value: 'perf', name: 'perf: 性能优化' },
// { value: 'test', name: 'test: 添加疏漏测试或已有测试改动' },
// { value: 'build', name: 'build: 构建流程、外部依赖变更 (如升级 npm 包、修改打包配置等)' },
// { value: 'ci', name: 'ci: 修改 CI 配置、脚本' },
// { value: 'revert', name: 'revert: 回滚 commit' },
// { value: 'chore', name: 'chore: 对构建过程或辅助工具和库的更改 (不影响源文件、测试用例)' },
// { value: 'wip', name: 'wip: 正在开发中' },
// { value: 'workflow', name: 'workflow: 工作流程改进' },
// { value: 'types', name: 'types: 类型定义文件修改' },
// ],
// emptyScopesAlias: 'empty: 不填写',
// customScopesAlias: 'custom: 自定义',
},
};

View File

@@ -8,7 +8,6 @@
name="viewport"
content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=0"
/>
<title><%= title %></title>
<link rel="icon" href="/favicon.ico" />
</head>
@@ -30,7 +29,7 @@
}
html[data-theme='dark'] .app-loading .app-loading-title {
color: rgba(255, 255, 255, 0.85);
color: rgb(255 255 255 / 85%);
}
.app-loading {
@@ -48,7 +47,6 @@
top: 50%;
left: 50%;
display: flex;
-webkit-transform: translate3d(-50%, -50%, 0);
transform: translate3d(-50%, -50%, 0);
justify-content: center;
align-items: center;
@@ -66,7 +64,7 @@
display: flex;
margin-top: 30px;
font-size: 30px;
color: rgba(0, 0, 0, 0.85);
color: rgb(0 0 0 / 85%);
justify-content: center;
align-items: center;
}
@@ -97,7 +95,7 @@
height: 20px;
background-color: #0065cc;
border-radius: 100%;
opacity: 0.3;
opacity: 30%;
transform: scale(0.75);
animation: antSpinMove 1s infinite linear alternate;
transform-origin: 50% 50%;
@@ -111,43 +109,38 @@
.dot i:nth-child(2) {
top: 0;
right: 0;
-webkit-animation-delay: 0.4s;
animation-delay: 0.4s;
}
.dot i:nth-child(3) {
right: 0;
bottom: 0;
-webkit-animation-delay: 0.8s;
animation-delay: 0.8s;
}
.dot i:nth-child(4) {
bottom: 0;
left: 0;
-webkit-animation-delay: 1.2s;
animation-delay: 1.2s;
}
@keyframes antRotate {
to {
-webkit-transform: rotate(405deg);
transform: rotate(405deg);
}
}
@-webkit-keyframes antRotate {
@keyframes antRotate {
to {
-webkit-transform: rotate(405deg);
transform: rotate(405deg);
}
}
@keyframes antSpinMove {
to {
opacity: 1;
opacity: 100%;
}
}
@-webkit-keyframes antSpinMove {
@keyframes antSpinMove {
to {
opacity: 1;
opacity: 100%;
}
}
</style>

View File

@@ -1,36 +0,0 @@
export default {
preset: 'ts-jest',
roots: ['<rootDir>/tests/'],
clearMocks: true,
moduleDirectories: ['node_modules', 'src'],
moduleFileExtensions: ['js', 'ts', 'vue', 'tsx', 'jsx', 'json', 'node'],
modulePaths: ['<rootDir>/src', '<rootDir>/node_modules'],
testMatch: [
'**/tests/**/*.[jt]s?(x)',
'**/?(*.)+(spec|test).[tj]s?(x)',
'(/__tests__/.*|(\\.|/)(test|spec))\\.(js|ts)$',
],
testPathIgnorePatterns: [
'<rootDir>/tests/server/',
'<rootDir>/tests/__mocks__/',
'/node_modules/',
],
transform: {
'^.+\\.tsx?$': 'ts-jest',
},
transformIgnorePatterns: ['<rootDir>/tests/__mocks__/', '/node_modules/'],
// A map from regular expressions to module names that allow to stub out resources with a single module
moduleNameMapper: {
'\\.(vs|fs|vert|frag|glsl|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$':
'<rootDir>/tests/__mocks__/fileMock.ts',
'\\.(sass|s?css|less)$': '<rootDir>/tests/__mocks__/styleMock.ts',
'\\?worker$': '<rootDir>/tests/__mocks__/workerMock.ts',
'^/@/(.*)$': '<rootDir>/src/$1',
},
testEnvironment: 'jsdom',
verbose: true,
collectCoverage: false,
coverageDirectory: 'coverage',
collectCoverageFrom: ['src/**/*.{js,ts,vue}'],
coveragePathIgnorePatterns: ['^.+\\.d\\.ts$'],
};

View File

@@ -1,5 +1,21 @@
import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer';
// 问题描述
// 1. `import.meta.globEager` 已被弃用, 需要升级vite版本,有兼容问题
// 2. `vite-plugin-mock` 插件问题 https://github.com/vbenjs/vite-plugin-mock/issues/56
// const modules: Record<string, any> = import.meta.glob("./**/*.ts", {
// import: "default",
// eager: true,
// });
// const mockModules = Object.keys(modules).reduce((pre, key) => {
// if (!key.includes("/_")) {
// pre.push(...modules[key]);
// }
// return pre;
// }, [] as any[]);
const modules = import.meta.globEager('./**/*.ts');
const mockModules: any[] = [];

View File

@@ -1,8 +1,9 @@
// Interface data format used to return a unified format
import { ResultEnum } from '/@/enums/httpEnum';
export function resultSuccess<T = Recordable>(result: T, { message = 'ok' } = {}) {
return {
code: 0,
code: ResultEnum.SUCCESS,
result,
message,
type: 'success',
@@ -26,7 +27,10 @@ export function resultPageSuccess<T = any>(
};
}
export function resultError(message = 'Request failed', { code = -1, result = null } = {}) {
export function resultError(
message = 'Request failed',
{ code = ResultEnum.ERROR, result = null } = {},
) {
return {
code,
result,
@@ -37,11 +41,9 @@ export function resultError(message = 'Request failed', { code = -1, result = nu
export function pagination<T = any>(pageNo: number, pageSize: number, array: T[]): T[] {
const offset = (pageNo - 1) * Number(pageSize);
const ret =
offset + Number(pageSize) >= array.length
? array.slice(offset, array.length)
: array.slice(offset, offset + Number(pageSize));
return ret;
return offset + Number(pageSize) >= array.length
? array.slice(offset, array.length)
: array.slice(offset, offset + Number(pageSize));
}
export interface requestParams {

View File

@@ -27,6 +27,9 @@ const demoList = (() => {
name6: '@cname()',
name7: '@cname()',
name8: '@cname()',
radio1: `选项${index + 1}`,
radio2: `选项${index + 1}`,
radio3: `选项${index + 1}`,
avatar: Random.image('400x400', Random.color(), Random.color(), Random.first()),
imgArr: getRandomPics(Math.ceil(Math.random() * 3) + 1),
imgs: getRandomPics(Math.ceil(Math.random() * 3) + 1),

View File

@@ -221,11 +221,11 @@ const linkRoute = {
name: 'Doc',
meta: {
title: 'routes.demo.iframe.doc',
frameSrc: 'https://vvbin.cn/doc-next/',
frameSrc: 'https://doc.vvbin.cn/',
},
},
{
path: 'https://vvbin.cn/doc-next/',
path: 'https://doc.vvbin.cn/',
name: 'DocExternal',
component: 'LAYOUT',
meta: {

View File

@@ -7,7 +7,7 @@ export function createFakeUserList() {
userId: '1',
username: 'vben',
realName: 'Vben Admin',
avatar: 'https://q1.qlogo.cn/g?b=qq&nk=190848757&s=640',
avatar: '',
desc: 'manager',
password: '123456',
token: 'fakeToken1',
@@ -24,7 +24,7 @@ export function createFakeUserList() {
username: 'test',
password: '123456',
realName: 'test user',
avatar: 'https://q1.qlogo.cn/g?b=qq&nk=339449197&s=640',
avatar: '',
desc: 'tester',
token: 'fakeToken2',
homePath: '/dashboard/workbench',
@@ -111,4 +111,12 @@ export default [
return resultSuccess(undefined, { message: 'Token has been destroyed' });
},
},
{
url: '/basic-api/testRetry',
statusCode: 405,
method: 'get',
response: () => {
return resultError('Error!');
},
},
] as MockMethod[];

View File

@@ -1,18 +1,19 @@
{
"name": "vben-admin",
"version": "2.7.2",
"version": "2.9.0",
"author": {
"name": "vben",
"email": "anncwb@126.com",
"url": "https://github.com/anncwb"
},
"scripts": {
"bootstrap": "yarn install",
"commit": "czg",
"bootstrap": "pnpm install",
"serve": "npm run dev",
"dev": "vite",
"build": "cross-env NODE_ENV=production vite build && esno ./build/script/postBuild.ts",
"build:test": "cross-env vite build --mode test && esno ./build/script/postBuild.ts",
"build:no-cache": "yarn clean:cache && npm run build",
"build:no-cache": "pnpm clean:cache && npm run build",
"report": "cross-env REPORT=true npm run build",
"type:check": "vue-tsc --noEmit --skipLibCheck",
"preview": "npm run build && vite preview",
@@ -23,130 +24,137 @@
"lint:eslint": "eslint --cache --max-warnings 0 \"{src,mock}/**/*.{vue,ts,tsx}\" --fix",
"lint:prettier": "prettier --write \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"",
"lint:stylelint": "stylelint --cache --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
"lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js",
"lint:lint-staged": "lint-staged",
"test:unit": "jest",
"test:unit-coverage": "jest --coverage",
"test:gzip": "npx http-server dist --cors --gzip -c-1",
"test:br": "npx http-server dist --cors --brotli -c-1",
"reinstall": "rimraf yarn.lock && rimraf package.lock.json && rimraf node_modules && npm run bootstrap",
"reinstall": "rimraf pnpm-lock.yaml && rimraf package.lock.json && rimraf node_modules && npm run bootstrap",
"prepare": "husky install",
"gen:icon": "esno ./build/generate/icon/index.ts"
},
"dependencies": {
"@ant-design/colors": "^6.0.0",
"@ant-design/icons-vue": "^6.0.1",
"@iconify/iconify": "^2.0.4",
"@logicflow/core": "^0.7.2",
"@logicflow/extension": "^0.7.2",
"@vueuse/core": "^6.7.4",
"@vueuse/shared": "^6.7.4",
"@zxcvbn-ts/core": "^1.0.0-beta.0",
"ant-design-vue": "2.2.8",
"axios": "^0.24.0",
"codemirror": "^5.63.3",
"@ant-design/icons-vue": "^6.1.0",
"@iconify/iconify": "^2.2.1",
"@logicflow/core": "^1.1.13",
"@logicflow/extension": "^1.1.13",
"@vue/runtime-core": "^3.2.33",
"@vue/shared": "^3.2.33",
"@vueuse/core": "^8.3.0",
"@vueuse/shared": "^8.3.0",
"@zxcvbn-ts/core": "^2.0.1",
"ant-design-vue": "^3.2.0",
"axios": "^0.26.1",
"codemirror": "^5.65.3",
"cropperjs": "^1.5.12",
"crypto-js": "^4.1.1",
"echarts": "^5.2.2",
"intro.js": "^4.2.2",
"dayjs": "^1.11.1",
"echarts": "^5.3.2",
"exceljs": "^4.3.0",
"intro.js": "^5.1.0",
"lodash-es": "^4.17.21",
"mockjs": "^1.1.0",
"moment": "^2.29.1",
"nprogress": "^0.2.0",
"path-to-regexp": "^6.2.0",
"pinia": "2.0.0",
"pinia": "2.0.12",
"print-js": "^1.6.0",
"qrcode": "^1.4.4",
"qs": "^6.10.1",
"qrcode": "^1.5.0",
"qs": "^6.10.3",
"resize-observer-polyfill": "^1.5.1",
"showdown": "^1.9.1",
"sortablejs": "^1.14.0",
"tinymce": "^5.10.0",
"vditor": "^3.8.7",
"vue": "^3.2.21",
"showdown": "^2.1.0",
"sortablejs": "^1.15.0",
"tinymce": "^5.10.7",
"vditor": "^3.8.13",
"vue": "^3.2.45",
"vue-i18n": "^9.1.9",
"vue-json-pretty": "^2.0.4",
"vue-router": "^4.0.12",
"vue-json-pretty": "^2.0.6",
"vue-router": "^4.0.14",
"vue-types": "^4.1.1",
"xlsx": "^0.17.3"
"vxe-table": "^4.3.9",
"vxe-table-plugin-export-xlsx": "^3.0.4",
"xe-utils": "^3.5.7",
"xlsx": "^0.18.5",
"vuedraggable": "^4.1.0"
},
"devDependencies": {
"@commitlint/cli": "^14.1.0",
"@commitlint/config-conventional": "^14.1.0",
"@iconify/json": "^1.1.422",
"@purge-icons/generated": "^0.7.0",
"@commitlint/cli": "^16.2.3",
"@commitlint/config-conventional": "^16.2.1",
"@iconify/json": "^2.1.30",
"@purge-icons/generated": "^0.8.1",
"@types/codemirror": "^5.60.5",
"@types/crypto-js": "^4.0.2",
"@types/crypto-js": "^4.1.1",
"@types/fs-extra": "^9.0.13",
"@types/inquirer": "^8.1.3",
"@types/inquirer": "^8.2.1",
"@types/intro.js": "^3.0.2",
"@types/jest": "^27.0.2",
"@types/lodash-es": "^4.17.5",
"@types/mockjs": "^1.0.4",
"@types/node": "^16.11.6",
"@types/lodash-es": "^4.17.6",
"@types/mockjs": "^1.0.6",
"@types/node": "^17.0.25",
"@types/nprogress": "^0.2.0",
"@types/qrcode": "^1.4.1",
"@types/qrcode": "^1.4.2",
"@types/qs": "^6.9.7",
"@types/showdown": "^1.9.4",
"@types/sortablejs": "^1.10.7",
"@typescript-eslint/eslint-plugin": "^5.3.0",
"@typescript-eslint/parser": "^5.3.0",
"@vitejs/plugin-legacy": "^1.6.2",
"@vitejs/plugin-vue": "^1.9.4",
"@vitejs/plugin-vue-jsx": "^1.2.0",
"@vue/compiler-sfc": "3.2.21",
"@vue/test-utils": "^2.0.0-rc.16",
"autoprefixer": "^10.4.0",
"commitizen": "^4.2.4",
"conventional-changelog-cli": "^2.1.1",
"@typescript-eslint/eslint-plugin": "^5.20.0",
"@typescript-eslint/parser": "^5.20.0",
"@vitejs/plugin-legacy": "^1.8.1",
"@vitejs/plugin-vue": "^2.3.1",
"@vitejs/plugin-vue-jsx": "^1.3.10",
"@vue/compiler-sfc": "^3.2.33",
"@vue/test-utils": "^2.0.0-rc.21",
"autoprefixer": "^10.4.4",
"conventional-changelog-cli": "^2.2.2",
"cross-env": "^7.0.3",
"dotenv": "^10.0.0",
"eslint": "^8.1.0",
"eslint-config-prettier": "^8.3.0",
"eslint-define-config": "^1.1.2",
"eslint-plugin-jest": "^25.2.2",
"cz-git": "^1.3.9",
"czg": "^1.3.9",
"dotenv": "^16.0.0",
"eslint": "^8.13.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-vue": "^8.0.3",
"esno": "^0.10.1",
"fs-extra": "^10.0.0",
"eslint-plugin-vue": "^8.6.0",
"esno": "^0.14.1",
"fs-extra": "^10.1.0",
"husky": "^7.0.4",
"inquirer": "^8.2.0",
"jest": "^27.3.1",
"inquirer": "^8.2.2",
"less": "^4.1.2",
"lint-staged": "11.2.6",
"lint-staged": "12.3.7",
"npm-run-all": "^4.1.5",
"postcss": "^8.3.11",
"postcss-html": "^1.2.0",
"postcss-less": "^5.0.0",
"prettier": "^2.4.1",
"picocolors": "^1.0.0",
"postcss": "^8.4.12",
"postcss-html": "^1.4.1",
"postcss-less": "^6.0.0",
"prettier": "^2.6.2",
"rimraf": "^3.0.2",
"rollup-plugin-visualizer": "^5.5.2",
"stylelint": "^14.0.1",
"stylelint-config-html": "^1.0.0",
"rollup": "^2.70.2",
"rollup-plugin-visualizer": "^5.6.0",
"sass": "^1.57.1",
"stylelint": "^14.7.1",
"stylelint-config-prettier": "^9.0.3",
"stylelint-config-standard": "^23.0.0",
"stylelint-config-recommended": "^7.0.0",
"stylelint-config-recommended-vue": "^1.4.0",
"stylelint-config-standard": "^25.0.0",
"stylelint-order": "^5.0.0",
"ts-jest": "^27.0.7",
"ts-node": "^10.4.0",
"typescript": "^4.4.4",
"vite": "^2.6.13",
"vite-plugin-compression": "^0.3.5",
"vite-plugin-html": "^2.1.1",
"vite-plugin-imagemin": "^0.4.6",
"ts-node": "^10.7.0",
"typescript": "^4.6.3",
"vite": "^2.9.5",
"vite-plugin-compression": "^0.5.1",
"vite-plugin-html": "^3.2.0",
"vite-plugin-imagemin": "^0.6.1",
"vite-plugin-mkcert": "^1.6.0",
"vite-plugin-mock": "^2.9.6",
"vite-plugin-purge-icons": "^0.7.0",
"vite-plugin-pwa": "^0.11.3",
"vite-plugin-style-import": "^1.3.0",
"vite-plugin-svg-icons": "^1.0.5",
"vite-plugin-theme": "^0.8.1",
"vite-plugin-vue-setup-extend": "^0.1.0",
"vite-plugin-windicss": "^1.4.12",
"vue-eslint-parser": "^8.0.1",
"vue-tsc": "^0.28.10"
"vite-plugin-purge-icons": "^0.8.1",
"vite-plugin-pwa": "^0.11.13",
"vite-plugin-style-import": "^2.0.0",
"vite-plugin-svg-icons": "^2.0.1",
"vite-plugin-theme": "^0.8.6",
"vite-plugin-vue-setup-extend": "^0.4.0",
"vite-plugin-windicss": "^1.8.4",
"vue-eslint-parser": "^8.3.0",
"vue-tsc": "^1.0.9"
},
"resolutions": {
"//": "Used to install imagemin dependencies, because imagemin may not be installed in China. If it is abroad, you can delete it",
"bin-wrapper": "npm:bin-wrapper-china",
"rollup": "^2.56.3"
"rollup": "^2.56.3",
"gifsicle": "5.2.0"
},
"repository": {
"type": "git",
@@ -159,5 +167,34 @@
"homepage": "https://github.com/anncwb/vue-vben-admin",
"engines": {
"node": "^12 || >=14"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": [
"eslint --fix",
"prettier --write"
],
"{!(package)*.json,*.code-snippets,.!(browserslist)*rc}": [
"prettier --write--parser json"
],
"package.json": [
"prettier --write"
],
"*.vue": [
"eslint --fix",
"prettier --write",
"stylelint --fix"
],
"*.{scss,less,styl,html}": [
"stylelint --fix",
"prettier --write"
],
"*.md": [
"prettier --write"
]
},
"config": {
"commitizen": {
"path": "node_modules/cz-git"
}
}
}

8812
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -4,14 +4,4 @@
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*/
.tinymce-mobile-unfocused-selections .tinymce-mobile-unfocused-selection{position: absolute;display: inline-block;background-color: green;opacity: .5;}
body{-webkit-text-size-adjust: none;}
body img{max-width: 96vw;}
body table img{max-width: 95%;}
body{font-family: sans-serif;}
table{border-collapse: collapse;}
.tinymce-mobile-unfocused-selections .tinymce-mobile-unfocused-selection{background-color:green;display:inline-block;opacity:.5;position:absolute}body{-webkit-text-size-adjust:none}body img{max-width:96vw}body table img{max-width:95%}body{font-family:sans-serif}table{border-collapse:collapse}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*/
body.tox-dialog__disable-scroll{overflow:hidden}.tox-fullscreen{border:0;height:100%;margin:0;overflow:hidden;-ms-scroll-chaining:none;overscroll-behavior:none;padding:0;touch-action:pinch-zoom;width:100%}.tox.tox-tinymce.tox-fullscreen .tox-statusbar__resize-handle{display:none}.tox-shadowhost.tox-fullscreen,.tox.tox-tinymce.tox-fullscreen{left:0;position:fixed;top:0;z-index:1200}.tox.tox-tinymce.tox-fullscreen{background-color:transparent}.tox-fullscreen .tox.tox-tinymce-aux,.tox-fullscreen~.tox.tox-tinymce-aux{z-index:1201}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -4,14 +4,4 @@
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*/
.tinymce-mobile-unfocused-selections .tinymce-mobile-unfocused-selection{position: absolute;display: inline-block;background-color: green;opacity: .5;}
body{-webkit-text-size-adjust: none;}
body img{max-width: 96vw;}
body table img{max-width: 95%;}
body{font-family: sans-serif;}
table{border-collapse: collapse;}
.tinymce-mobile-unfocused-selections .tinymce-mobile-unfocused-selection{background-color:green;display:inline-block;opacity:.5;position:absolute}body{-webkit-text-size-adjust:none}body img{max-width:96vw}body table img{max-width:95%}body{font-family:sans-serif}table{border-collapse:collapse}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,7 @@
/**
* Copyright (c) Tiny Technologies, Inc. All rights reserved.
* Licensed under the LGPL or a commercial license.
* For LGPL see License.txt in the project root for license information.
* For commercial licenses see https://www.tiny.cloud/
*/
body.tox-dialog__disable-scroll{overflow:hidden}.tox-fullscreen{border:0;height:100%;margin:0;overflow:hidden;-ms-scroll-chaining:none;overscroll-behavior:none;padding:0;touch-action:pinch-zoom;width:100%}.tox.tox-tinymce.tox-fullscreen .tox-statusbar__resize-handle{display:none}.tox-shadowhost.tox-fullscreen,.tox.tox-tinymce.tox-fullscreen{left:0;position:fixed;top:0;z-index:1200}.tox.tox-tinymce.tox-fullscreen{background-color:transparent}.tox-fullscreen .tox.tox-tinymce-aux,.tox-fullscreen~.tox.tox-tinymce-aux{z-index:1201}

View File

@@ -12,6 +12,7 @@
import { useTitle } from '/@/hooks/web/useTitle';
import { useLocale } from '/@/locales/useLocale';
import 'dayjs/locale/zh-cn';
// support Multi-language
const { getAntdLocale } = useLocale();

View File

@@ -14,6 +14,7 @@ export const demoListApi = (params: DemoParams) =>
url: Api.DEMO_LIST,
params,
headers: {
// @ts-ignore
ignoreCancelToken: true,
},
});

View File

@@ -8,6 +8,7 @@ enum Api {
Logout = '/logout',
GetUserInfo = '/getUserInfo',
GetPermCode = '/getPermCode',
TestRetry = '/testRetry',
}
/**
@@ -39,3 +40,16 @@ export function getPermCode() {
export function doLogout() {
return defHttp.get({ url: Api.Logout });
}
export function testRetry() {
return defHttp.get(
{ url: Api.TestRetry },
{
retryRequest: {
isOpenRetry: true,
count: 5,
waitTime: 1000,
},
},
);
}

View File

@@ -4,11 +4,11 @@
-->
<template>
<Dropdown
placement="bottomCenter"
placement="bottom"
:trigger="['click']"
:dropMenuList="localeList"
:selectedKeys="selectedKeys"
@menuEvent="handleMenuEvent"
@menu-event="handleMenuEvent"
overlayClassName="app-locale-picker-overlay"
>
<span class="cursor-pointer flex items-center">

View File

@@ -10,14 +10,15 @@
<script lang="ts">
import { defineComponent } from 'vue';
import { Button } from 'ant-design-vue';
export default defineComponent({
name: 'AButton',
extends: Button,
inheritAttrs: false,
});
</script>
<script lang="ts" setup>
import { computed, unref } from 'vue';
import { Button } from 'ant-design-vue';
import Icon from '/@/components/Icon/src/Icon.vue';
import { buttonProps } from './props';
import { useAttrs } from '/@/hooks/core/useAttrs';

View File

@@ -1,5 +1,12 @@
const validColors = ['primary', 'error', 'warning', 'success', ''] as const;
type ButtonColorType = typeof validColors[number];
export const buttonProps = {
color: { type: String, validator: (v) => ['error', 'warning', 'success', ''].includes(v) },
color: {
type: String as PropType<ButtonColorType>,
validator: (v) => validColors.includes(v),
default: '',
},
loading: { type: Boolean },
disabled: { type: Boolean },
/**

View File

@@ -3,7 +3,6 @@
<div class="p-4 mb-2 bg-white">
<BasicForm @register="registerForm" />
</div>
{{ sliderProp.width }}
<div class="p-2 bg-white">
<List
:grid="{ gutter: 5, xs: 1, sm: 2, md: 4, lg: 4, xl: 6, xxl: grid }"
@@ -39,7 +38,7 @@
<Image :src="item.imgs[0]" />
</div>
</template>
<template class="ant-card-actions" #actions>
<template #actions>
<!-- <SettingOutlined key="setting" />-->
<EditOutlined key="edit" />
<Dropdown

View File

@@ -1,5 +1,5 @@
import { ref } from 'vue';
//每行个数
// 每行个数
export const grid = ref(12);
// slider属性
export const useSlider = (min = 6, max = 12) => {

View File

@@ -53,7 +53,7 @@
color: var(--comment);
text-align: right;
white-space: nowrap;
opacity: 60%;
opacity: 0.6;
}
.CodeMirror-guttermarker {
@@ -90,7 +90,7 @@
display: inline-block;
font-size: 0.8em;
content: '>';
opacity: 80%;
opacity: 0.8;
transform: rotate(90deg);
transition: transform 0.2s;
}

View File

@@ -1,40 +1,14 @@
<template>
<div :class="prefixCls">
<CollapseHeader v-bind="$props" :prefixCls="prefixCls" :show="show" @expand="handleExpand">
<template #title>
<slot name="title"></slot>
</template>
<template #action>
<slot name="action"></slot>
</template>
</CollapseHeader>
<div class="p-2">
<CollapseTransition :enable="canExpan">
<Skeleton v-if="loading" :active="loading" />
<div :class="`${prefixCls}__body`" v-else v-show="show">
<slot></slot>
</div>
</CollapseTransition>
</div>
<div :class="`${prefixCls}__footer`" v-if="$slots.footer">
<slot name="footer"></slot>
</div>
</div>
</template>
<script lang="ts" setup>
import type { PropType } from 'vue';
import { ref } from 'vue';
// component
<script lang="tsx">
import { ref, unref, defineComponent, type PropType, type ExtractPropTypes } from 'vue';
import { isNil } from 'lodash-es';
import { Skeleton } from 'ant-design-vue';
import { CollapseTransition } from '/@/components/Transition';
import CollapseHeader from './CollapseHeader.vue';
import { triggerWindowResize } from '/@/utils/event';
// hook
import { useTimeoutFn } from '/@/hooks/core/useTimeout';
import { useDesign } from '/@/hooks/web/useDesign';
const props = defineProps({
const collapseContainerProps = {
title: { type: String, default: '' },
loading: { type: Boolean },
/**
@@ -57,23 +31,60 @@
* Delayed loading time
*/
lazyTime: { type: Number, default: 0 },
};
export type CollapseContainerProps = ExtractPropTypes<typeof collapseContainerProps>;
export default defineComponent({
name: 'CollapseContainer',
props: collapseContainerProps,
setup(props, { expose, slots }) {
const { prefixCls } = useDesign('collapse-container');
const show = ref(true);
const handleExpand = (val: boolean) => {
show.value = isNil(val) ? !show.value : val;
if (props.triggerWindowResize) {
// 200 milliseconds here is because the expansion has animation,
useTimeoutFn(triggerWindowResize, 200);
}
};
expose({ handleExpand });
return () => (
<div class={unref(prefixCls)}>
<CollapseHeader
{...props}
prefixCls={unref(prefixCls)}
onExpand={handleExpand}
show={show.value}
v-slots={{
title: slots.title,
action: slots.action,
}}
/>
<div class="p-2">
<CollapseTransition enable={props.canExpan}>
{props.loading ? (
<Skeleton active={props.loading} />
) : (
<div class={`${prefixCls}__body`} v-show={show.value}>{slots.default?.()}</div>
)}
</CollapseTransition>
</div>
{slots.footer && <div class={`${prefixCls}__footer`}>{slots.footer()}</div>}
</div>
);
},
});
const show = ref(true);
const { prefixCls } = useDesign('collapse-container');
/**
* @description: Handling development events
*/
function handleExpand() {
show.value = !show.value;
if (props.triggerWindowResize) {
// 200 milliseconds here is because the expansion has animation,
useTimeoutFn(triggerWindowResize, 200);
}
}
</script>
<style lang="less">
@prefix-cls: ~'@{namespace}-collapse-container';

View File

@@ -1,38 +1,44 @@
<template>
<div :class="[`${prefixCls}__header px-2 py-5`, $attrs.class]">
<BasicTitle :helpMessage="helpMessage" normal>
<template v-if="title">
{{ title }}
</template>
<template v-else>
<slot name="title"></slot>
</template>
</BasicTitle>
<div :class="`${prefixCls}__action`">
<slot name="action"></slot>
<BasicArrow v-if="canExpan" up :expand="show" @click="$emit('expand')" />
</div>
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
<script lang="tsx">
import { defineComponent, computed, unref, type ExtractPropTypes } from 'vue';
import { useDesign } from '/@/hooks/web/useDesign';
import { BasicArrow, BasicTitle } from '/@/components/Basic';
const props = {
prefixCls: { type: String },
const collapseHeaderProps = {
prefixCls: String,
title: String,
show: Boolean,
canExpan: Boolean,
helpMessage: {
type: [Array, String] as PropType<string[] | string>,
default: '',
},
title: { type: String },
show: { type: Boolean },
canExpan: { type: Boolean },
};
export type CollapseHeaderProps = ExtractPropTypes<typeof collapseHeaderProps>;
export default defineComponent({
components: { BasicArrow, BasicTitle },
name: 'CollapseHeader',
inheritAttrs: false,
props,
props: collapseHeaderProps,
emits: ['expand'],
setup(props, { slots, attrs, emit }) {
const { prefixCls } = useDesign('collapse-container');
const _prefixCls = computed(() => props.prefixCls || unref(prefixCls));
return () => (
<div class={[`${unref(_prefixCls)}__header px-2 py-5`, attrs.class]}>
<BasicTitle helpMessage={props.helpMessage} normal>
{slots.title?.() || props.title}
</BasicTitle>
<div class={`${unref(_prefixCls)}__action`}>
{slots.action
? slots.action({ expand: props.show, onClick: () => emit('expand') })
: props.canExpan && (
<BasicArrow up expand={props.show} onClick={() => emit('expand')} />
)}
</div>
</div>
);
},
});
</script>

View File

@@ -1,6 +1,6 @@
<script lang="tsx">
import type { ContextMenuItem, ItemContentProps, Axis } from './typing';
import type { FunctionalComponent, CSSProperties } from 'vue';
import type { FunctionalComponent, CSSProperties, PropType } from 'vue';
import { defineComponent, nextTick, onMounted, computed, ref, unref, onUnmounted } from 'vue';
import Icon from '/@/components/Icon';
import { Menu, Divider } from 'ant-design-vue';
@@ -60,9 +60,11 @@
const top = body.clientHeight < y + menuHeight ? y - menuHeight : y;
return {
...styles,
position: 'absolute',
width: `${width}px`,
left: `${left + 1}px`,
top: `${top + 1}px`,
zIndex: 9999,
};
});
@@ -87,7 +89,8 @@
}
function renderMenuItem(items: ContextMenuItem[]) {
return items.map((item) => {
const visibleItems = items.filter((item) => !item.hidden);
return visibleItems.map((item) => {
const { disabled, label, children, divider = false } = item;
const contentProps = {
@@ -124,15 +127,11 @@
}
const { items } = props;
return (
<Menu
inlineIndent={12}
mode="vertical"
class={prefixCls}
ref={wrapRef}
style={unref(getStyle)}
>
{renderMenuItem(items)}
</Menu>
<div class={prefixCls}>
<Menu inlineIndent={12} mode="vertical" ref={wrapRef} style={unref(getStyle)}>
{renderMenuItem(items)}
</Menu>
</div>
);
};
},
@@ -185,6 +184,9 @@
background-clip: padding-box;
user-select: none;
&__item {
margin: 0 !important;
}
.item-style();
.ant-divider {

View File

@@ -6,6 +6,7 @@ export interface Axis {
export interface ContextMenuItem {
label: string;
icon?: string;
hidden?: boolean;
disabled?: boolean;
handler?: Fn;
divider?: boolean;

View File

@@ -129,6 +129,7 @@
uploadApi: {
type: Function as PropType<(params: apiFunParams) => Promise<any>>,
},
src: { type: String },
};
export default defineComponent({
@@ -138,7 +139,7 @@
emits: ['uploadSuccess', 'register'],
setup(props, { emit }) {
let filename = '';
const src = ref('');
const src = ref(props.src || '');
const previewSource = ref('');
const cropper = ref<Cropper>();
let scaleX = 1;
@@ -186,7 +187,7 @@
try {
setModalProps({ confirmLoading: true });
const result = await uploadApi({ name: 'file', file: blob, filename });
emit('uploadSuccess', { source: previewSource.value, data: result.data });
emit('uploadSuccess', { source: previewSource.value, data: result.url });
closeModal();
} finally {
setModalProps({ confirmLoading: false });

View File

@@ -22,7 +22,7 @@
<CopperModal
@register="register"
@uploadSuccess="handleUploadSuccess"
@upload-success="handleUploadSuccess"
:uploadApi="uploadApi"
:src="sourceValue"
/>
@@ -91,9 +91,9 @@
},
);
function handleUploadSuccess({ source }) {
function handleUploadSuccess({ source, data }) {
sourceValue.value = source;
emit('change', source);
emit('change', { source, data });
createMessage.success(t('component.cropper.uploadSuccess'));
}

View File

@@ -3,7 +3,7 @@
import type { DescriptionsProps } from 'ant-design-vue/es/descriptions/index';
import type { CSSProperties } from 'vue';
import type { CollapseContainerOptions } from '/@/components/Container/index';
import { defineComponent, computed, ref, unref } from 'vue';
import { defineComponent, computed, ref, unref, toRefs } from 'vue';
import { get } from 'lodash-es';
import { Descriptions } from 'ant-design-vue';
import { CollapseContainer } from '/@/components/Container/index';
@@ -121,6 +121,9 @@
return null;
}
const getField = get(_data, field);
if (getField && !toRefs(_data).hasOwnProperty(field)) {
return isFunction(render) ? render('', _data) : '';
}
return isFunction(render) ? render(getField, _data) : getField ?? '';
};

View File

@@ -94,7 +94,7 @@
opt.width = '100%';
}
const detailCls = `${prefixCls}__detail`;
opt.wrapClassName = wrapClassName ? `${wrapClassName} ${detailCls}` : detailCls;
opt.class = wrapClassName ? `${wrapClassName} ${detailCls}` : detailCls;
if (!getContainer) {
// TODO type error?

View File

@@ -47,7 +47,7 @@
const heightStr = `${props.height}`;
return {
height: heightStr,
lineHeight: heightStr,
lineHeight: `calc(${heightStr} - 1px)`,
};
});

View File

@@ -128,13 +128,12 @@ export interface DrawerProps extends DrawerFooterProps {
* @type any (string | slot)
*/
title?: VNodeChild | JSX.Element;
/**
* The class name of the container of the Drawer dialog.
* @type string
*/
wrapClassName?: string;
class?: string;
/**
* Style of wrapper element which **contains mask** compare to `drawerStyle`
* @type object

View File

@@ -57,7 +57,7 @@
* @type string[]
*/
trigger: {
type: [Array] as PropType<('contextmenu' | 'click' | 'hover')[]>,
type: Array as PropType<('contextmenu' | 'click' | 'hover')[]>,
default: () => {
return ['contextmenu'];
},

View File

@@ -1,4 +1,4 @@
import xlsx from 'xlsx';
import * as xlsx from 'xlsx';
import type { WorkBook } from 'xlsx';
import type { JsonToSheet, AoAToSheet } from './typing';
@@ -6,6 +6,28 @@ const { utils, writeFile } = xlsx;
const DEF_FILE_NAME = 'excel-list.xlsx';
/**
* @param data source data
* @param worksheet worksheet object
* @param min min width
*/
function setColumnWidth(data, worksheet, min = 3) {
const obj = {};
worksheet['!cols'] = [];
data.forEach((item) => {
Object.keys(item).forEach((key) => {
const cur = item[key];
const length = cur?.length ?? min;
obj[key] = Math.max(length, obj[key] ?? min);
});
});
Object.keys(obj).forEach((key) => {
worksheet['!cols'].push({
wch: obj[key],
});
});
}
export function jsonToSheetXlsx<T = any>({
data,
header,
@@ -20,7 +42,7 @@ export function jsonToSheetXlsx<T = any>({
}
const worksheet = utils.json_to_sheet(arrData, json2sheetOpts);
setColumnWidth(arrData, worksheet);
/* add worksheet to workbook */
const workbook: WorkBook = {
SheetNames: [filename],

View File

@@ -14,7 +14,7 @@
</template>
<script lang="ts">
import { defineComponent, ref, unref } from 'vue';
import XLSX from 'xlsx';
import * as XLSX from 'xlsx';
import { dateUtil } from '/@/utils/dateUtil';
import type { ExcelData } from './typing';
@@ -31,11 +31,51 @@
type: Number,
default: 8,
},
// 是否直接返回选中文件
isReturnFile: {
type: Boolean,
default: false,
},
},
emits: ['success', 'error'],
emits: ['success', 'error', 'cancel'],
setup(props, { emit }) {
const inputRef = ref<HTMLInputElement | null>(null);
const loadingRef = ref<Boolean>(false);
const cancelRef = ref<Boolean>(true);
function shapeWorkSheel(sheet: XLSX.WorkSheet, range: XLSX.Range) {
let str = ' ',
char = 65,
customWorkSheet = {
t: 's',
v: str,
r: '<t> </t><phoneticPr fontId="1" type="noConversion"/>',
h: str,
w: str,
};
if (!sheet || !sheet['!ref']) return [];
let c = 0,
r = 1;
while (c < range.e.c + 1) {
while (r < range.e.r + 1) {
if (!sheet[String.fromCharCode(char) + r]) {
sheet[String.fromCharCode(char) + r] = customWorkSheet;
}
r++;
}
r = 1;
str += ' ';
customWorkSheet = {
t: 's',
v: str,
r: '<t> </t><phoneticPr fontId="1" type="noConversion"/>',
h: str,
w: str,
};
c++;
char++;
}
}
/**
* @description: 第一行作为头部
@@ -44,8 +84,8 @@
if (!sheet || !sheet['!ref']) return [];
const headers: string[] = [];
// A3:B7=>{s:{c:0, r:2}, e:{c:1, r:6}}
const range = XLSX.utils.decode_range(sheet['!ref']);
const range: XLSX.Range = XLSX.utils.decode_range(sheet['!ref']);
shapeWorkSheel(sheet, range);
const R = range.s.r;
/* start in the first row */
for (let C = range.s.c; C <= range.e.c; ++C) {
@@ -137,18 +177,45 @@
* @description: 触发选择文件管理器
*/
function handleInputClick(e: Event) {
const files = e && (e.target as HTMLInputElement).files;
const target = e && (e.target as HTMLInputElement);
const files = target?.files;
const rawFile = files && files[0]; // only setting files[0]
target.value = '';
if (!rawFile) return;
cancelRef.value = false;
if (props.isReturnFile) {
emit('success', rawFile);
return;
}
upload(rawFile);
}
/**
* @description 文件选择器关闭后,判断取消状态
*/
function handleFocusChange() {
const timeId = setInterval(() => {
if (cancelRef.value === true) {
emit('cancel');
}
clearInterval(timeId);
window.removeEventListener('focus', handleFocusChange);
}, 1000);
}
/**
* @description: 点击上传按钮
*/
function handleUpload() {
const inputRefDom = unref(inputRef);
inputRefDom && inputRefDom.click();
if (inputRefDom) {
cancelRef.value = true;
inputRefDom.click();
window.addEventListener('focus', handleFocusChange);
}
}
return { handleUpload, handleInputClick, inputRef };

View File

@@ -9,7 +9,9 @@ export { useForm } from './src/hooks/useForm';
export { default as ApiSelect } from './src/components/ApiSelect.vue';
export { default as RadioButtonGroup } from './src/components/RadioButtonGroup.vue';
export { default as ApiTreeSelect } from './src/components/ApiTreeSelect.vue';
export { default as ApiTree } from './src/components/ApiTree.vue';
export { default as ApiRadioGroup } from './src/components/ApiRadioGroup.vue';
export { default as ApiCascader } from './src/components/ApiCascader.vue';
export { default as ApiTransfer } from './src/components/ApiTransfer.vue';
export { BasicForm };

View File

@@ -10,6 +10,7 @@
<slot name="formHeader"></slot>
<template v-for="schema in getSchema" :key="schema.field">
<FormItem
:isAdvanced="fieldsIsAdvancedMap[schema.field]"
:tableAction="tableAction"
:formActionType="formActionType"
:schema="schema"
@@ -58,15 +59,17 @@
import { createFormContext } from './hooks/useFormContext';
import { useAutoFocus } from './hooks/useAutoFocus';
import { useModalContext } from '/@/components/Modal';
import { useDebounceFn } from '@vueuse/core';
import { basicProps } from './props';
import { useDesign } from '/@/hooks/web/useDesign';
import { cloneDeep } from 'lodash-es';
export default defineComponent({
name: 'BasicForm',
components: { FormItem, Form, Row, FormAction },
props: basicProps,
emits: ['advanced-change', 'reset', 'submit', 'register'],
emits: ['advanced-change', 'reset', 'submit', 'register', 'field-value-change'],
setup(props, { emit, attrs }) {
const formModel = reactive<Recordable>({});
const modalFn = useModalContext();
@@ -116,13 +119,13 @@
const getSchema = computed((): FormSchema[] => {
const schemas: FormSchema[] = unref(schemaRef) || (unref(getProps).schemas as any);
for (const schema of schemas) {
const { defaultValue, component } = schema;
const { defaultValue, component, isHandleDateDefaultValue = true } = schema;
// handle date type
if (defaultValue && dateItemType.includes(component)) {
if (isHandleDateDefaultValue && defaultValue && dateItemType.includes(component)) {
if (!Array.isArray(defaultValue)) {
schema.defaultValue = dateUtil(defaultValue);
} else {
const def: moment.Moment[] = [];
const def: any[] = [];
defaultValue.forEach((item) => {
def.push(dateUtil(item));
});
@@ -131,13 +134,15 @@
}
}
if (unref(getProps).showAdvancedButton) {
return schemas.filter((schema) => schema.component !== 'Divider') as FormSchema[];
return cloneDeep(
schemas.filter((schema) => schema.component !== 'Divider') as FormSchema[],
);
} else {
return schemas as FormSchema[];
return cloneDeep(schemas as FormSchema[]);
}
});
const { handleToggleAdvanced } = useAdvanced({
const { handleToggleAdvanced, fieldsIsAdvancedMap } = useAdvanced({
advanceState,
emit,
getProps,
@@ -170,7 +175,7 @@
updateSchema,
resetSchema,
appendSchemaByField,
removeSchemaByFiled,
removeSchemaByField,
resetFields,
scrollToField,
} = useFormEvents({
@@ -225,14 +230,23 @@
},
);
watch(
() => formModel,
useDebounceFn(() => {
unref(getProps).submitOnChange && handleSubmit();
}, 300),
{ deep: true },
);
async function setProps(formProps: Partial<FormProps>): Promise<void> {
propsRef.value = deepMerge(unref(propsRef) || {}, formProps);
}
function setFormModel(key: string, value: any) {
function setFormModel(key: string, value: any, schema: FormSchema) {
formModel[key] = value;
const { validateTrigger } = unref(getBindValue);
if (!validateTrigger || validateTrigger === 'change') {
emit('field-value-change', key, value);
// TODO 优化验证这里如果是autoLink=false手动关联的情况下才会再次触发此函数
if (schema && schema.itemProps && !schema.itemProps.autoLink) {
validateFields([key]).catch((_) => {});
}
}
@@ -255,7 +269,7 @@
updateSchema,
resetSchema,
setProps,
removeSchemaByFiled,
removeSchemaByField,
appendSchemaByField,
clearValidate,
validateFields,
@@ -286,6 +300,7 @@
getFormActionBindProps: computed(
(): Recordable => ({ ...getProps.value, ...advanceState }),
),
fieldsIsAdvancedMap,
...formActionType,
};
},

View File

@@ -24,8 +24,10 @@ import {
import ApiRadioGroup from './components/ApiRadioGroup.vue';
import RadioButtonGroup from './components/RadioButtonGroup.vue';
import ApiSelect from './components/ApiSelect.vue';
import ApiTree from './components/ApiTree.vue';
import ApiTreeSelect from './components/ApiTreeSelect.vue';
import ApiCascader from './components/ApiCascader.vue';
import ApiTransfer from './components/ApiTransfer.vue';
import { BasicUpload } from '/@/components/Upload';
import { StrengthMeter } from '/@/components/StrengthMeter';
import { IconPicker } from '/@/components/Icon';
@@ -43,6 +45,7 @@ componentMap.set('AutoComplete', AutoComplete);
componentMap.set('Select', Select);
componentMap.set('ApiSelect', ApiSelect);
componentMap.set('ApiTree', ApiTree);
componentMap.set('TreeSelect', TreeSelect);
componentMap.set('ApiTreeSelect', ApiTreeSelect);
componentMap.set('ApiRadioGroup', ApiRadioGroup);
@@ -55,6 +58,7 @@ componentMap.set('ApiCascader', ApiCascader);
componentMap.set('Cascader', Cascader);
componentMap.set('Slider', Slider);
componentMap.set('Rate', Rate);
componentMap.set('ApiTransfer', ApiTransfer);
componentMap.set('DatePicker', DatePicker);
componentMap.set('MonthPicker', DatePicker.MonthPicker);

View File

@@ -26,7 +26,7 @@
import { get, omit } from 'lodash-es';
import { useRuleFormItem } from '/@/hooks/component/useFormItem';
import { LoadingOutlined } from '@ant-design/icons-vue';
import { useI18n } from '/@/hooks/web/useI18n';
interface Option {
value: string;
label: string;
@@ -76,7 +76,7 @@
const loading = ref<boolean>(false);
const emitData = ref<any[]>([]);
const isFirstLoad = ref(true);
const { t } = useI18n();
// Embedded in the form, just use the hook binding to perform form verification
const [state] = useRuleFormItem(props, 'value', 'change', emitData);
@@ -170,7 +170,7 @@
);
function handleChange(keys, args) {
emitData.value = keys;
emitData.value = args;
emit('defaultChange', keys, args);
}
@@ -188,6 +188,7 @@
state,
options,
loading,
t,
handleChange,
loadData,
handleRenderDisplay,

View File

@@ -2,12 +2,17 @@
* @Description:It is troublesome to implement radio button group in the form. So it is extracted independently as a separate component
-->
<template>
<RadioGroup v-bind="attrs" v-model:value="state" button-style="solid" @change="handleChange">
<RadioGroup v-bind="attrs" v-model:value="state" button-style="solid">
<template v-for="item in getOptions" :key="`${item.value}`">
<RadioButton v-if="props.isBtn" :value="item.value" :disabled="item.disabled">
<RadioButton
v-if="props.isBtn"
:value="item.value"
:disabled="item.disabled"
@click="handleClick(item)"
>
{{ item.label }}
</RadioButton>
<Radio v-else :value="item.value" :disabled="item.disabled">
<Radio v-else :value="item.value" :disabled="item.disabled" @click="handleClick(item)">
{{ item.label }}
</Radio>
</template>
@@ -62,7 +67,7 @@
const attrs = useAttrs();
const { t } = useI18n();
// Embedded in the form, just use the hook binding to perform form verification
const [state] = useRuleFormItem(props);
const [state] = useRuleFormItem(props, 'value', 'change', emitData);
// Processing options value
const getOptions = computed(() => {
@@ -120,11 +125,11 @@
emit('options-change', unref(getOptions));
}
function handleChange(_, ...args) {
function handleClick(...args) {
emitData.value = args;
}
return { state, getOptions, attrs, loading, t, handleChange, props };
return { state, getOptions, attrs, loading, t, handleClick, props };
},
});
</script>

View File

@@ -1,6 +1,6 @@
<template>
<Select
@dropdownVisibleChange="handleFetch"
@dropdown-visible-change="handleFetch"
v-bind="$attrs"
@change="handleChange"
:options="getOptions"
@@ -48,17 +48,15 @@
default: null,
},
// api params
params: {
type: Object as PropType<Recordable>,
default: () => ({}),
},
params: propTypes.any.def({}),
// support xxx.xxx.xx
resultField: propTypes.string.def(''),
labelField: propTypes.string.def('label'),
valueField: propTypes.string.def('value'),
immediate: propTypes.bool.def(true),
alwaysLoad: propTypes.bool.def(false),
},
emits: ['options-change', 'change'],
emits: ['options-change', 'change', 'update:value'],
setup(props, { emit }) {
const options = ref<OptionsItem[]>([]);
const loading = ref(false);
@@ -75,10 +73,10 @@
return unref(options).reduce((prev, next: Recordable) => {
if (next) {
const value = next[valueField];
const value = get(next, valueField);
prev.push({
...omit(next, [labelField, valueField]),
label: next[labelField],
label: get(next, labelField),
value: numberToString ? `${value}` : value,
});
}
@@ -87,9 +85,16 @@
});
watchEffect(() => {
props.immediate && fetch();
props.immediate && !props.alwaysLoad && fetch();
});
watch(
() => state.value,
(v) => {
emit('update:value', v);
},
);
watch(
() => props.params,
() => {
@@ -121,10 +126,14 @@
}
}
async function handleFetch() {
if (!props.immediate && unref(isFirstLoad)) {
await fetch();
isFirstLoad.value = false;
async function handleFetch(visible) {
if (visible) {
if (props.alwaysLoad) {
await fetch();
} else if (!props.immediate && unref(isFirstLoad)) {
await fetch();
isFirstLoad.value = false;
}
}
}

View File

@@ -0,0 +1,137 @@
<template>
<Transfer
:data-source="getdataSource"
:filter-option="filterOption"
:render="(item) => item.title"
:showSelectAll="showSelectAll"
:selectedKeys="selectedKeys"
:targetKeys="getTargetKeys"
:showSearch="showSearch"
@change="handleChange"
/>
</template>
<script lang="ts">
import { computed, defineComponent, watch, ref, unref, watchEffect } from 'vue';
import { Transfer } from 'ant-design-vue';
import { isFunction } from '/@/utils/is';
import { get, omit } from 'lodash-es';
import { propTypes } from '/@/utils/propTypes';
import { useI18n } from '/@/hooks/web/useI18n';
import { TransferDirection, TransferItem } from 'ant-design-vue/lib/transfer';
export default defineComponent({
name: 'ApiTransfer',
components: { Transfer },
props: {
value: { type: Array as PropType<Array<string>> },
api: {
type: Function as PropType<(arg?: Recordable) => Promise<TransferItem[]>>,
default: null,
},
params: { type: Object },
dataSource: { type: Array as PropType<Array<TransferItem>> },
immediate: propTypes.bool.def(true),
alwaysLoad: propTypes.bool.def(false),
afterFetch: { type: Function as PropType<Fn> },
resultField: propTypes.string.def(''),
labelField: propTypes.string.def('title'),
valueField: propTypes.string.def('key'),
showSearch: { type: Boolean, default: false },
disabled: { type: Boolean, default: false },
filterOption: {
type: Function as PropType<(inputValue: string, item: TransferItem) => boolean>,
},
selectedKeys: { type: Array as PropType<Array<string>> },
showSelectAll: { type: Boolean, default: false },
targetKeys: { type: Array as PropType<Array<string>> },
},
emits: ['options-change', 'change'],
setup(props, { attrs, emit }) {
const _dataSource = ref<TransferItem[]>([]);
const _targetKeys = ref<string[]>([]);
const { t } = useI18n();
const getAttrs = computed(() => {
return {
...(!props.api ? { dataSource: unref(_dataSource) } : {}),
...attrs,
};
});
const getdataSource = computed(() => {
const { labelField, valueField } = props;
return unref(_dataSource).reduce((prev, next: Recordable) => {
if (next) {
prev.push({
...omit(next, [labelField, valueField]),
title: next[labelField],
key: next[valueField],
});
}
return prev;
}, [] as TransferItem[]);
});
const getTargetKeys = computed<string[]>(() => {
if (unref(_targetKeys).length > 0) {
return unref(_targetKeys);
}
if (Array.isArray(props.value)) {
return props.value;
}
if (Array.isArray(props.targetKeys)){
return props.targetKeys;
}
return [];
});
function handleChange(keys: string[], direction: TransferDirection, moveKeys: string[]) {
_targetKeys.value = keys;
console.log(direction);
console.log(moveKeys);
emit('change', keys);
}
watchEffect(() => {
props.immediate && !props.alwaysLoad && fetch();
});
watch(
() => props.params,
() => {
fetch();
},
{ deep: true },
);
async function fetch() {
const api = props.api;
if (!api || !isFunction(api)) {
if (Array.isArray(props.dataSource)) {
_dataSource.value = props.dataSource;
}
return;
}
_dataSource.value = [];
try {
const res = await api(props.params);
if (Array.isArray(res)) {
_dataSource.value = res;
emitChange();
return;
}
if (props.resultField) {
_dataSource.value = get(res, props.resultField) || [];
}
emitChange();
} catch (error) {
console.warn(error);
} finally {
}
}
function emitChange() {
emit('options-change', unref(getdataSource));
}
return { getTargetKeys, getdataSource, t, getAttrs, handleChange };
},
});
</script>

View File

@@ -0,0 +1,90 @@
<template>
<a-tree v-bind="getAttrs" @change="handleChange">
<template #[item]="data" v-for="item in Object.keys($slots)">
<slot :name="item" v-bind="data || {}"></slot>
</template>
<template #suffixIcon v-if="loading">
<LoadingOutlined spin />
</template>
</a-tree>
</template>
<script lang="ts">
import { computed, defineComponent, watch, ref, onMounted, unref } from 'vue';
import { Tree } from 'ant-design-vue';
import { isArray, isFunction } from '/@/utils/is';
import { get } from 'lodash-es';
import { propTypes } from '/@/utils/propTypes';
import { LoadingOutlined } from '@ant-design/icons-vue';
export default defineComponent({
name: 'ApiTree',
components: { ATree: Tree, LoadingOutlined },
props: {
api: { type: Function as PropType<(arg?: Recordable) => Promise<Recordable>> },
params: { type: Object },
immediate: { type: Boolean, default: true },
resultField: propTypes.string.def(''),
afterFetch: { type: Function as PropType<Fn> },
},
emits: ['options-change', 'change'],
setup(props, { attrs, emit }) {
const treeData = ref<Recordable[]>([]);
const isFirstLoaded = ref<Boolean>(false);
const loading = ref(false);
const getAttrs = computed(() => {
return {
...(props.api ? { treeData: unref(treeData) } : {}),
...attrs,
};
});
function handleChange(...args) {
emit('change', ...args);
}
watch(
() => props.params,
() => {
!unref(isFirstLoaded) && fetch();
},
{ deep: true },
);
watch(
() => props.immediate,
(v) => {
v && !isFirstLoaded.value && fetch();
},
);
onMounted(() => {
props.immediate && fetch();
});
async function fetch() {
const { api, afterFetch } = props;
if (!api || !isFunction(api)) return;
loading.value = true;
treeData.value = [];
let result;
try {
result = await api(props.params);
} catch (e) {
console.error(e);
}
if (afterFetch && isFunction(afterFetch)) {
result = afterFetch(result);
}
loading.value = false;
if (!result) return;
if (!isArray(result)) {
result = get(result, props.resultField);
}
treeData.value = (result as Recordable[]) || [];
isFirstLoaded.value = true;
emit('options-change', treeData.value);
}
return { getAttrs, loading, handleChange };
},
});
</script>

View File

@@ -1,17 +1,20 @@
<script lang="tsx">
import type { PropType, Ref } from 'vue';
import type { FormActionType, FormProps } from '../types/form';
import type { FormSchema } from '../types/form';
import { computed, defineComponent, toRefs, unref } from 'vue';
import type { FormActionType, FormProps, FormSchema } from '../types/form';
import type { ValidationRule } from 'ant-design-vue/lib/form/Form';
import type { TableActionType } from '/@/components/Table';
import { defineComponent, computed, unref, toRefs } from 'vue';
import { Form, Col, Divider } from 'ant-design-vue';
import { Col, Divider, Form } from 'ant-design-vue';
import { componentMap } from '../componentMap';
import { BasicHelp } from '/@/components/Basic';
import { isBoolean, isFunction, isNull } from '/@/utils/is';
import { getSlot } from '/@/utils/helper/tsxHelper';
import { createPlaceholderMessage, setComponentRuleType } from '../helper';
import { upperFirst, cloneDeep } from 'lodash-es';
import {
createPlaceholderMessage,
NO_AUTO_LINK_COMPONENTS,
setComponentRuleType,
} from '../helper';
import { cloneDeep, upperFirst } from 'lodash-es';
import { useItemLabelWidth } from '../hooks/useLabelWidth';
import { useI18n } from '/@/hooks/web/useI18n';
@@ -36,7 +39,7 @@
default: () => ({}),
},
setFormModel: {
type: Function as PropType<(key: string, value: any) => void>,
type: Function as PropType<(key: string, value: any, schema: FormSchema) => void>,
default: null,
},
tableAction: {
@@ -45,6 +48,9 @@
formActionType: {
type: Object as PropType<FormActionType>,
},
isAdvanced: {
type: Boolean,
},
},
setup(props, { slots }) {
const { t } = useI18n();
@@ -78,10 +84,14 @@
componentProps = componentProps({ schema, tableAction, formModel, formActionType }) ?? {};
}
if (schema.component === 'Divider') {
componentProps = Object.assign({ type: 'horizontal' }, componentProps, {
orientation: 'left',
plain: true,
});
componentProps = Object.assign(
{ type: 'horizontal' },
{
orientation: 'left',
plain: true,
},
componentProps,
);
}
return componentProps as Recordable;
});
@@ -104,8 +114,8 @@
const { show, ifShow } = props.schema;
const { showAdvancedButton } = props.formProps;
const itemIsAdvanced = showAdvancedButton
? isBoolean(props.schema.isAdvanced)
? props.schema.isAdvanced
? isBoolean(props.isAdvanced)
? props.isAdvanced
: true
: true;
@@ -178,8 +188,21 @@
const getRequired = isFunction(required) ? required(unref(getValues)) : required;
if ((!rules || rules.length === 0) && getRequired) {
rules = [{ required: getRequired, validator }];
/*
* 1、若设置了required属性又没有其他的rules就创建一个验证规则
* 2、若设置了required属性又存在其他的rules则只rules中不存在required属性时才添加验证required的规则
* 也就是说rules中的required优先级大于required
*/
if (getRequired) {
if (!rules || rules.length === 0) {
rules = [{ required: getRequired, validator }];
} else {
const requiredIndex: number = rules.findIndex((rule) => Reflect.has(rule, 'required'));
if (requiredIndex === -1) {
rules.push({ required: getRequired, validator });
}
}
}
const requiredRuleIndex: number = rules.findIndex(
@@ -238,7 +261,7 @@
}
const target = e ? e.target : null;
const value = target ? (isCheck ? target.checked : target.value) : e;
props.setFormModel(field, value);
props.setFormModel(field, value, props.schema);
},
};
const Comp = componentMap.get(component) as ReturnType<typeof defineComponent>;
@@ -328,6 +351,15 @@
const showSuffix = !!suffix;
const getSuffix = isFunction(suffix) ? suffix(unref(getValues)) : suffix;
// TODO 自定义组件验证会出现问题因此这里框架默认将自定义组件设置手动触发验证如果其他组件还有此问题请手动设置autoLink=false
if (NO_AUTO_LINK_COMPONENTS.includes(component)) {
props.schema &&
(props.schema.itemProps! = {
autoLink: false,
...props.schema.itemProps,
});
}
return (
<Form.Item
name={field}

View File

@@ -4,14 +4,14 @@
<template>
<RadioGroup v-bind="attrs" v-model:value="state" button-style="solid">
<template v-for="item in getOptions" :key="`${item.value}`">
<RadioButton :value="item.value" :disabled="item.disabled">
<RadioButton :value="item.value" :disabled="item.disabled" @click="handleClick(item)">
{{ item.label }}
</RadioButton>
</template>
</RadioGroup>
</template>
<script lang="ts">
import { defineComponent, PropType, computed } from 'vue';
import { defineComponent, PropType, computed, ref } from 'vue';
import { Radio } from 'ant-design-vue';
import { isString } from '/@/utils/is';
import { useRuleFormItem } from '/@/hooks/component/useFormItem';
@@ -35,10 +35,12 @@
default: () => [],
},
},
emits: ['change'],
setup(props) {
const attrs = useAttrs();
const emitData = ref<any[]>([]);
// Embedded in the form, just use the hook binding to perform form verification
const [state] = useRuleFormItem(props);
const [state] = useRuleFormItem(props, 'value', 'change', emitData);
// Processing options value
const getOptions = computed((): OptionsItem[] => {
@@ -51,7 +53,11 @@
return options.map((item) => ({ label: item, value: item })) as OptionsItem[];
});
return { state, getOptions, attrs };
function handleClick(...args) {
emitData.value = args;
}
return { state, getOptions, attrs, handleClick };
},
});
</script>

View File

@@ -70,3 +70,18 @@ export function handleInputNumberValue(component?: ComponentType, val?: any) {
* 时间字段
*/
export const dateItemType = genType();
export const defaultValueComponents = ['Input', 'InputPassword', 'InputSearch', 'InputTextArea'];
// TODO 自定义组件封装会出现验证问题,因此这里目前改成手动触发验证
export const NO_AUTO_LINK_COMPONENTS: ComponentType[] = [
'Upload',
'ApiTransfer',
'ApiTree',
'ApiSelect',
'ApiTreeSelect',
'ApiRadioGroup',
'ApiCascader',
'AutoComplete',
'RadioButtonGroup',
];

View File

@@ -1,6 +1,6 @@
import type { ColEx } from '../types';
import type { AdvanceState } from '../types/hooks';
import type { ComputedRef, Ref } from 'vue';
import { ComputedRef, getCurrentInstance, Ref, shallowReactive } from 'vue';
import type { FormProps, FormSchema } from '../types/form';
import { computed, unref, watch } from 'vue';
import { isBoolean, isFunction, isNumber, isObject } from '/@/utils/is';
@@ -26,6 +26,8 @@ export default function ({
formModel,
defaultValueRef,
}: UseAdvancedContext) {
const vm = getCurrentInstance();
const { realWidthRef, screenEnum, screenRef } = useBreakpoint();
const getEmptySpan = computed((): number => {
@@ -111,6 +113,8 @@ export default function ({
}
}
const fieldsIsAdvancedMap = shallowReactive({});
function updateAdvanced() {
let itemColSum = 0;
let realItemColSum = 0;
@@ -146,10 +150,13 @@ export default function ({
if (isAdvanced) {
realItemColSum = itemColSum;
}
schema.isAdvanced = isAdvanced;
fieldsIsAdvancedMap[schema.field] = isAdvanced;
}
}
// 确保页面发送更新
vm?.proxy?.$forceUpdate();
advanceState.actionSpan = (realItemColSum % BASIC_COL_LEN) + unref(getEmptySpan);
getAdvanced(unref(getProps).actionColOptions || { span: BASIC_COL_LEN }, itemColSum, true);
@@ -161,5 +168,5 @@ export default function ({
advanceState.isAdvanced = !advanceState.isAdvanced;
}
return { handleToggleAdvanced };
return { handleToggleAdvanced, fieldsIsAdvancedMap };
}

View File

@@ -79,8 +79,8 @@ export function useForm(props?: Props): UseFormReturnType {
});
},
removeSchemaByFiled: async (field: string | string[]) => {
unref(formRef)?.removeSchemaByFiled(field);
removeSchemaByField: async (field: string | string[]) => {
unref(formRef)?.removeSchemaByField(field);
},
// TODO promisify
@@ -94,7 +94,7 @@ export function useForm(props?: Props): UseFormReturnType {
},
appendSchemaByField: async (
schema: FormSchema,
schema: FormSchema | FormSchema[],
prefixField: string | undefined,
first: boolean,
) => {

View File

@@ -1,10 +1,18 @@
import type { ComputedRef, Ref } from 'vue';
import type { FormProps, FormSchema, FormActionType } from '../types/form';
import type { NamePath } from 'ant-design-vue/lib/form/interface';
import { unref, toRaw } from 'vue';
import { isArray, isFunction, isObject, isString } from '/@/utils/is';
import { unref, toRaw, nextTick } from 'vue';
import {
isArray,
isFunction,
isObject,
isString,
isDef,
isNullOrUnDef,
isEmpty,
} from '/@/utils/is';
import { deepMerge } from '/@/utils';
import { dateItemType, handleInputNumberValue } from '../helper';
import { dateItemType, handleInputNumberValue, defaultValueComponents } from '../helper';
import { dateUtil } from '/@/utils/dateUtil';
import { cloneDeep, uniqBy } from 'lodash-es';
import { error } from '/@/utils/log';
@@ -37,9 +45,13 @@ export function useFormEvents({
if (!formEl) return;
Object.keys(formModel).forEach((key) => {
formModel[key] = defaultValueRef.value[key];
const schema = unref(getSchema).find((item) => item.field === key);
const isInput = schema?.component && defaultValueComponents.includes(schema.component);
const defaultValue = cloneDeep(defaultValueRef.value[key]);
formModel[key] = isInput ? defaultValue || '' : defaultValue;
});
clearValidate();
nextTick(() => clearValidate());
emit('reset', toRaw(formModel));
submitOnReset && handleSubmit();
}
@@ -52,6 +64,10 @@ export function useFormEvents({
.map((item) => item.field)
.filter(Boolean);
// key 支持 a.b.c 的嵌套写法
const delimiter = '.';
const nestKeyArray = fields.filter((item) => String(item).indexOf(delimiter) >= 0);
const validKeys: string[] = [];
Object.keys(values).forEach((key) => {
const schema = unref(getSchema).find((item) => item.field === key);
@@ -60,6 +76,11 @@ export function useFormEvents({
const hasKey = Reflect.has(values, key);
value = handleInputNumberValue(schema?.component, value);
const { componentProps } = schema || {};
let _props = componentProps as any;
if (typeof componentProps === 'function') {
_props = _props({ formModel: unref(formModel) });
}
// 0| '' is allow
if (hasKey && fields.includes(key)) {
// time type
@@ -69,19 +90,32 @@ export function useFormEvents({
for (const ele of value) {
arr.push(ele ? dateUtil(ele) : null);
}
formModel[key] = arr;
unref(formModel)[key] = arr;
} else {
const { componentProps } = schema || {};
let _props = componentProps as any;
if (typeof componentProps === 'function') {
_props = _props({ formModel });
}
formModel[key] = value ? (_props?.valueFormat ? value : dateUtil(value)) : null;
unref(formModel)[key] = value ? (_props?.valueFormat ? value : dateUtil(value)) : null;
}
} else {
formModel[key] = value;
unref(formModel)[key] = value;
}
if (_props?.onChange) {
_props?.onChange(value);
}
validKeys.push(key);
} else {
nestKeyArray.forEach((nestKey: string) => {
try {
const value = nestKey.split('.').reduce((out, item) => out[item], values);
if (isDef(value)) {
unref(formModel)[nestKey] = unref(value);
validKeys.push(nestKey);
}
} catch (e) {
// key not exist
if (isDef(defaultValueRef.value[nestKey])) {
unref(formModel)[nestKey] = cloneDeep(unref(defaultValueRef.value[nestKey]));
}
}
});
}
});
validateFields(validKeys).catch((_) => {});
@@ -89,7 +123,7 @@ export function useFormEvents({
/**
* @description: Delete based on field name
*/
async function removeSchemaByFiled(fields: string | string[]): Promise<void> {
async function removeSchemaByField(fields: string | string[]): Promise<void> {
const schemaList: FormSchema[] = cloneDeep(unref(getSchema));
if (!fields) {
return;
@@ -100,7 +134,7 @@ export function useFormEvents({
fieldList = [fields];
}
for (const field of fieldList) {
_removeSchemaByFiled(field, schemaList);
_removeSchemaByFeild(field, schemaList);
}
schemaRef.value = schemaList;
}
@@ -108,7 +142,7 @@ export function useFormEvents({
/**
* @description: Delete based on field name
*/
function _removeSchemaByFiled(field: string, schemaList: FormSchema[]): void {
function _removeSchemaByFeild(field: string, schemaList: FormSchema[]): void {
if (isString(field)) {
const index = schemaList.findIndex((schema) => schema.field === field);
if (index !== -1) {
@@ -121,22 +155,26 @@ export function useFormEvents({
/**
* @description: Insert after a certain field, if not insert the last
*/
async function appendSchemaByField(schema: FormSchema, prefixField?: string, first = false) {
async function appendSchemaByField(
schema: FormSchema | FormSchema[],
prefixField?: string,
first = false,
) {
const schemaList: FormSchema[] = cloneDeep(unref(getSchema));
const index = schemaList.findIndex((schema) => schema.field === prefixField);
const hasInList = schemaList.some((item) => item.field === prefixField || schema.field);
if (!hasInList) return;
const _schemaList = isObject(schema) ? [schema as FormSchema] : (schema as FormSchema[]);
if (!prefixField || index === -1 || first) {
first ? schemaList.unshift(schema) : schemaList.push(schema);
first ? schemaList.unshift(..._schemaList) : schemaList.push(..._schemaList);
schemaRef.value = schemaList;
_setDefaultValue(schema);
return;
}
if (index !== -1) {
schemaList.splice(index + 1, 0, schema);
schemaList.splice(index + 1, 0, ..._schemaList);
}
_setDefaultValue(schema);
schemaRef.value = schemaList;
}
@@ -182,19 +220,52 @@ export function useFormEvents({
return;
}
const schema: FormSchema[] = [];
updateData.forEach((item) => {
unref(getSchema).forEach((val) => {
unref(getSchema).forEach((val) => {
let _val;
updateData.forEach((item) => {
if (val.field === item.field) {
const newSchema = deepMerge(val, item);
schema.push(newSchema as FormSchema);
} else {
schema.push(val);
_val = item;
}
});
if (_val !== undefined && val.field === _val.field) {
const newSchema = deepMerge(val, _val);
schema.push(newSchema as FormSchema);
} else {
schema.push(val);
}
});
_setDefaultValue(schema);
schemaRef.value = uniqBy(schema, 'field');
}
function _setDefaultValue(data: FormSchema | FormSchema[]) {
let schemas: FormSchema[] = [];
if (isObject(data)) {
schemas.push(data as FormSchema);
}
if (isArray(data)) {
schemas = [...data];
}
const obj: Recordable = {};
const currentFieldsValue = getFieldsValue();
schemas.forEach((item) => {
if (
item.component != 'Divider' &&
Reflect.has(item, 'field') &&
item.field &&
!isNullOrUnDef(item.defaultValue) &&
(!(item.field in currentFieldsValue) ||
isNullOrUnDef(currentFieldsValue[item.field]) ||
isEmpty(currentFieldsValue[item.field]))
) {
obj[item.field] = item.defaultValue;
}
});
setFieldsValue(obj);
}
function getFieldsValue(): Recordable {
const formEl = unref(formElRef);
if (!formEl) return {};
@@ -243,6 +314,9 @@ export function useFormEvents({
const res = handleFormValues(values);
emit('submit', res);
} catch (error: any) {
if (error?.outOfDate === false && error?.errorFields) {
return;
}
throw new Error(error);
}
}
@@ -256,7 +330,7 @@ export function useFormEvents({
updateSchema,
resetSchema,
appendSchemaByField,
removeSchemaByFiled,
removeSchemaByField,
resetFields,
setFieldsValue,
scrollToField,

View File

@@ -3,7 +3,7 @@ import { dateUtil } from '/@/utils/dateUtil';
import { unref } from 'vue';
import type { Ref, ComputedRef } from 'vue';
import type { FormProps, FormSchema } from '../types/form';
import { set } from 'lodash-es';
import { cloneDeep, set } from 'lodash-es';
interface UseFormValuesContext {
defaultValueRef: Ref<any>;
@@ -11,6 +11,43 @@ interface UseFormValuesContext {
getProps: ComputedRef<FormProps>;
formModel: Recordable;
}
/**
* @desription deconstruct array-link key. This method will mutate the target.
*/
function tryDeconstructArray(key: string, value: any, target: Recordable) {
const pattern = /^\[(.+)\]$/;
if (pattern.test(key)) {
const match = key.match(pattern);
if (match && match[1]) {
const keys = match[1].split(',');
value = Array.isArray(value) ? value : [value];
keys.forEach((k, index) => {
set(target, k.trim(), value[index]);
});
return true;
}
}
}
/**
* @desription deconstruct object-link key. This method will mutate the target.
*/
function tryDeconstructObject(key: string, value: any, target: Recordable) {
const pattern = /^\{(.+)\}$/;
if (pattern.test(key)) {
const match = key.match(pattern);
if (match && match[1]) {
const keys = match[1].split(',');
value = isObject(value) ? value : {};
keys.forEach((k) => {
set(target, k.trim(), value[k.trim()]);
});
return true;
}
}
}
export function useFormValues({
defaultValueRef,
getSchema,
@@ -33,14 +70,23 @@ export function useFormValues({
if (isObject(value)) {
value = transformDateFunc?.(value);
}
if (isArray(value) && value[0]?._isAMomentObject && value[1]?._isAMomentObject) {
if (isArray(value) && value[0]?.format && value[1]?.format) {
value = value.map((item) => transformDateFunc?.(item));
}
// Remove spaces
if (isString(value)) {
value = value.trim();
// remove params from URL
if(value === '') {
value = undefined;
}else {
value = value.trim();
}
}
if (!tryDeconstructArray(key, value, res) && !tryDeconstructObject(key, value, res)) {
// 没有解构成功的,按原样赋值
set(res, key, value);
}
set(res, key, value);
}
return handleRangeTimeValue(res);
}
@@ -56,14 +102,21 @@ export function useFormValues({
}
for (const [field, [startTimeKey, endTimeKey], format = 'YYYY-MM-DD'] of fieldMapToTime) {
if (!field || !startTimeKey || !endTimeKey || !values[field]) {
if (!field || !startTimeKey || !endTimeKey) {
continue;
}
// If the value to be converted is empty, remove the field
if (!values[field]) {
Reflect.deleteProperty(values, field);
continue;
}
const [startTime, endTime]: string[] = values[field];
values[startTimeKey] = dateUtil(startTime).format(format);
values[endTimeKey] = dateUtil(endTime).format(format);
const [startTimeFormat, endTimeFormat] = Array.isArray(format) ? format : [format, format];
values[startTimeKey] = dateUtil(startTime).format(startTimeFormat);
values[endTimeKey] = dateUtil(endTime).format(endTimeFormat);
Reflect.deleteProperty(values, field);
}
@@ -77,10 +130,13 @@ export function useFormValues({
const { defaultValue } = item;
if (!isNullOrUnDef(defaultValue)) {
obj[item.field] = defaultValue;
formModel[item.field] = defaultValue;
if (formModel[item.field] === undefined) {
formModel[item.field] = defaultValue;
}
}
});
defaultValueRef.value = obj;
defaultValueRef.value = cloneDeep(obj);
}
return { handleFormValues, initDefault };

View File

@@ -1,7 +1,6 @@
import type { Ref } from 'vue';
import type { FormProps, FormSchema } from '../types/form';
import { computed, unref } from 'vue';
import type { FormProps, FormSchema } from '../types/form';
import { isNumber } from '/@/utils/is';
export function useItemLabelWidth(schemaItemRef: Ref<FormSchema>, propsRef: Ref<FormProps>) {
@@ -14,6 +13,7 @@ export function useItemLabelWidth(schemaItemRef: Ref<FormSchema>, propsRef: Ref<
labelWidth: globalLabelWidth,
labelCol: globalLabelCol,
wrapperCol: globWrapperCol,
layout,
} = unref(propsRef);
// If labelWidth is set globally, all items setting
@@ -33,7 +33,10 @@ export function useItemLabelWidth(schemaItemRef: Ref<FormSchema>, propsRef: Ref<
return {
labelCol: { style: { width }, ...col },
wrapperCol: { style: { width: `calc(100% - ${width})` }, ...wrapCol },
wrapperCol: {
style: { width: layout === 'vertical' ? '100%' : `calc(100% - ${width})` },
...wrapCol,
},
};
});
}

View File

@@ -9,7 +9,7 @@ import { propTypes } from '/@/utils/propTypes';
export const basicProps = {
model: {
type: Object as PropType<Recordable>,
default: {},
default: () => ({}),
},
// 标签宽度 固定宽度
labelWidth: {
@@ -23,7 +23,7 @@ export const basicProps = {
compact: propTypes.bool,
// 表单配置规则
schemas: {
type: [Array] as PropType<FormSchema[]>,
type: Array as PropType<FormSchema[]>,
default: () => [],
},
mergeDynamicData: {
@@ -40,11 +40,12 @@ export const basicProps = {
// 在INPUT组件上单击回车时是否自动提交
autoSubmitOnEnter: propTypes.bool.def(false),
submitOnReset: propTypes.bool,
submitOnChange: propTypes.bool,
size: propTypes.oneOf(['default', 'small', 'large']).def('default'),
// 禁用表单
disabled: propTypes.bool,
emptySpan: {
type: [Number, Object] as PropType<number>,
type: [Number, Object] as PropType<number | Recordable>,
default: 0,
},
// 是否显示收起展开按钮
@@ -53,7 +54,7 @@ export const basicProps = {
transformDateFunc: {
type: Function as PropType<Fn>,
default: (date: any) => {
return date._isAMomentObject ? date?.format('YYYY-MM-DD HH:mm:ss') : date;
return date?.format?.('YYYY-MM-DD HH:mm:ss') ?? date;
},
},
rulesMessageJoinLabel: propTypes.bool.def(true),

View File

@@ -7,7 +7,7 @@ import type { TableActionType } from '/@/components/Table/src/types/table';
import type { CSSProperties } from 'vue';
import type { RowProps } from 'ant-design-vue/lib/grid/Row';
export type FieldMapToTime = [string, [string, string], string?][];
export type FieldMapToTime = [string, [string, string], (string | [string, string])?][];
export type Rule = RuleObject & {
trigger?: 'blur' | 'change' | ['change', 'blur'];
@@ -26,16 +26,16 @@ export interface ButtonProps extends AntdButtonProps {
export interface FormActionType {
submit: () => Promise<void>;
setFieldsValue: <T>(values: T) => Promise<void>;
setFieldsValue: (values: Recordable) => Promise<void>;
resetFields: () => Promise<void>;
getFieldsValue: () => Recordable;
clearValidate: (name?: string | string[]) => Promise<void>;
updateSchema: (data: Partial<FormSchema> | Partial<FormSchema>[]) => Promise<void>;
resetSchema: (data: Partial<FormSchema> | Partial<FormSchema>[]) => Promise<void>;
setProps: (formProps: Partial<FormProps>) => Promise<void>;
removeSchemaByFiled: (field: string | string[]) => Promise<void>;
removeSchemaByField: (field: string | string[]) => Promise<void>;
appendSchemaByField: (
schema: FormSchema,
schema: FormSchema | FormSchema[],
prefixField: string | undefined,
first?: boolean | undefined,
) => Promise<void>;
@@ -49,17 +49,20 @@ export type RegisterFn = (formInstance: FormActionType) => void;
export type UseFormReturnType = [RegisterFn, FormActionType];
export interface FormProps {
name?: string;
layout?: 'vertical' | 'inline' | 'horizontal';
// Form value
model?: Recordable;
// The width of all items in the entire form
labelWidth?: number | string;
//alignment
// alignment
labelAlign?: 'left' | 'right';
//Row configuration for the entire form
// Row configuration for the entire form
rowProps?: RowProps;
// Submit form on reset
submitOnReset?: boolean;
// Submit form on form changing
submitOnChange?: boolean;
// Col configuration for the entire form
labelCol?: Partial<ColEx>;
// Col configuration for the entire form
@@ -172,6 +175,10 @@ export interface FormSchema {
// 默认值
defaultValue?: any;
// 是否自动处理与时间相关组件的默认值
isHandleDateDefaultValue?: boolean;
isAdvanced?: boolean;
// Matching details components

View File

@@ -91,6 +91,7 @@ export type ComponentType =
| 'Select'
| 'ApiSelect'
| 'TreeSelect'
| 'ApiTree'
| 'ApiTreeSelect'
| 'ApiRadioGroup'
| 'RadioButtonGroup'
@@ -112,4 +113,5 @@ export type ComponentType =
| 'Render'
| 'Slider'
| 'Rate'
| 'Divider';
| 'Divider'
| 'ApiTransfer';

View File

@@ -31,18 +31,7 @@
v-for="icon in getPaginationList"
:key="icon"
:class="currentSelect === icon ? 'border border-primary' : ''"
class="
p-2
w-1/8
cursor-pointer
mr-1
mt-1
flex
justify-center
items-center
border border-solid
hover:border-primary
"
class="p-2 w-1/8 cursor-pointer mr-1 mt-1 flex justify-center items-center border border-solid hover:border-primary"
@click="handleClick(icon)"
:title="icon"
>
@@ -135,7 +124,16 @@
const { prefixCls } = useDesign('icon-picker');
const debounceHandleSearchChange = useDebounceFn(handleSearchChange, 100);
const { clipboardRef, isSuccessRef } = useCopyToClipboard(props.value);
let clipboardRef;
let isSuccessRef;
if (props.copy) {
const clipboard = useCopyToClipboard(props.value);
clipboardRef = clipboard?.clipboardRef;
isSuccessRef = clipboard?.isSuccessRef;
}
const { createMessage } = useMessage();
const { getPaginationList, getTotal, setCurrentPage } = usePagination(

View File

@@ -19,6 +19,7 @@
import { useModalContext } from '../../Modal';
import { useRootSetting } from '/@/hooks/setting/useRootSetting';
import { onMountedOrActivated } from '/@/hooks/core/onMountedOrActivated';
import { getTheme } from './getTheme';
type Lang = 'zh_CN' | 'en_US' | 'ja_JP' | 'ko_KR' | undefined;
@@ -46,8 +47,9 @@
if (!inited) {
return;
}
const theme = val === 'dark' ? 'dark' : 'classic';
instance.getVditor()?.setTheme(theme);
instance
.getVditor()
?.setTheme(getTheme(val) as any, getTheme(val, 'content'), getTheme(val, 'code'));
},
{
immediate: true,
@@ -87,13 +89,22 @@
if (!wrapEl) return;
const bindValue = { ...attrs, ...props };
const insEditor = new Vditor(wrapEl, {
theme: getDarkMode.value === 'dark' ? 'dark' : 'classic',
// 设置外观主题
theme: getTheme(getDarkMode.value) as any,
lang: unref(getCurrentLang),
mode: 'sv',
fullscreen: {
index: 520,
},
preview: {
theme: {
// 设置内容主题
current: getTheme(getDarkMode.value, 'content'),
},
hljs: {
// 设置代码块主题
style: getTheme(getDarkMode.value, 'code'),
},
actions: [],
},
input: (v) => {

View File

@@ -1,23 +1,62 @@
<template>
<!-- eslint-disable vue/no-v-html -->
<div v-html="getHtmlData" :class="$props.class" class="markdown-viewer"></div>
<div ref="viewerRef" id="markdownViewer" :class="$props.class"></div>
</template>
<script lang="ts" setup>
import { computed } from 'vue';
import showdown from 'showdown';
const converter = new showdown.Converter();
converter.setOption('tables', true);
import { defineProps, onBeforeUnmount, onDeactivated, Ref, ref, unref, watch } from 'vue';
import VditorPreview from 'vditor/dist/method.min';
import { onMountedOrActivated } from '/@/hooks/core/onMountedOrActivated';
import { useRootSetting } from '/@/hooks/setting/useRootSetting';
import { getTheme } from './getTheme';
const props = defineProps({
value: { type: String },
class: { type: String },
});
const getHtmlData = computed(() => converter.makeHtml(props.value || ''));
</script>
const viewerRef = ref<ElRef>(null);
const vditorPreviewRef = ref(null) as Ref<Nullable<VditorPreview>>;
const { getDarkMode } = useRootSetting();
<style scoped>
.markdown-viewer {
width: 100%;
function init() {
const viewerEl = unref(viewerRef) as HTMLElement;
vditorPreviewRef.value = VditorPreview.preview(viewerEl, props.value, {
mode: getTheme(getDarkMode.value, 'content'),
theme: {
// 设置内容主题
current: getTheme(getDarkMode.value, 'content'),
},
hljs: {
// 设置代码块主题
style: getTheme(getDarkMode.value, 'code'),
},
});
}
</style>
watch(
() => getDarkMode.value,
(val) => {
VditorPreview.setContentTheme(getTheme(val, 'content'));
VditorPreview.setCodeTheme(getTheme(val, 'code'));
init();
},
);
watch(
() => props.value,
(v, oldValue) => {
v !== oldValue && init();
},
);
function destroy() {
const vditorInstance = unref(vditorPreviewRef);
if (!vditorInstance) return;
try {
vditorInstance?.destroy?.();
} catch (error) {}
vditorPreviewRef.value = null;
}
onMountedOrActivated(init);
onBeforeUnmount(destroy);
onDeactivated(destroy);
</script>

View File

@@ -0,0 +1,19 @@
/**
* 获取主题类型 深色浅色模式 对应的值
* @param darkModeVal 深色模式值
* @param themeMode 主题类型——外观(默认), 内容, 代码块
*/
export const getTheme = (
darkModeVal: 'light' | 'dark' | string,
themeMode: 'default' | 'content' | 'code' = 'default',
) => {
const isDark = darkModeVal === 'dark';
switch (themeMode) {
case 'default':
return isDark ? 'dark' : 'classic';
case 'content':
return isDark ? 'dark' : 'light';
case 'code':
return isDark ? 'dracula' : 'github';
}
};

View File

@@ -6,7 +6,7 @@
:openKeys="getOpenKeys"
:inlineIndent="inlineIndent"
:theme="theme"
@openChange="handleOpenChange"
@open-change="handleOpenChange"
:class="getMenuClass"
@click="handleMenuClick"
:subMenuOpenDelay="0.2"

View File

@@ -41,7 +41,7 @@ export const basicProps = {
export const itemProps = {
item: {
type: Object as PropType<Menu>,
default: {},
default: () => ({}),
},
level: propTypes.number,
theme: propTypes.oneOf(['dark', 'light']),

View File

@@ -139,8 +139,9 @@
...attrs,
...unref(getMergeProps),
visible: unref(visibleRef),
wrapClassName: unref(getWrapClassName),
};
attr['wrapClassName'] = `${attr?.['wrapClassName'] || ''} ${unref(getWrapClassName)}`;
if (unref(fullScreenRef)) {
return omit(attr, ['height', 'title']);
}

View File

@@ -10,7 +10,7 @@ export default defineComponent({
inheritAttrs: false,
props: basicProps,
emits: ['cancel'],
setup(props, { slots }) {
setup(props, { slots, emit }) {
const { visible, draggable, destroyOnClose } = toRefs(props);
const attrs = useAttrs();
useModalDragMove({
@@ -19,8 +19,12 @@ export default defineComponent({
draggable,
});
const onCancel = (e: Event) => {
emit('cancel', e);
};
return () => {
const propsData = { ...unref(attrs), ...props } as Recordable;
const propsData = { ...unref(attrs), ...props, onCancel } as Recordable;
return <Modal {...propsData}>{extendSlots(slots)}</Modal>;
};
},

View File

@@ -17,6 +17,5 @@
},
title: { type: String },
},
emits: ['dblclick'],
});
</script>

Some files were not shown because too many files have changed in this diff Show More