br-dionysus 1.7.6 → 1.7.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/README.md +85 -20
  2. package/attributes.json +1 -1
  3. package/build/doc.config.ts +1 -1
  4. package/build/lib.config.ts +1 -1
  5. package/cypress/component/MInputNumber.cy.ts +38 -0
  6. package/cypress/component/MSelect.cy.ts +46 -0
  7. package/cypress/component/MSelectV2.cy.ts +46 -0
  8. package/cypress/e2e/1-getting-started/todo.cy.js +143 -0
  9. package/cypress/e2e/2-advanced-examples/actions.cy.js +321 -0
  10. package/cypress/e2e/2-advanced-examples/aliasing.cy.js +39 -0
  11. package/cypress/e2e/2-advanced-examples/assertions.cy.js +176 -0
  12. package/cypress/e2e/2-advanced-examples/connectors.cy.js +98 -0
  13. package/cypress/e2e/2-advanced-examples/cookies.cy.js +118 -0
  14. package/cypress/e2e/2-advanced-examples/cypress_api.cy.js +185 -0
  15. package/cypress/e2e/2-advanced-examples/files.cy.js +85 -0
  16. package/cypress/e2e/2-advanced-examples/location.cy.js +32 -0
  17. package/cypress/e2e/2-advanced-examples/misc.cy.js +90 -0
  18. package/cypress/e2e/2-advanced-examples/navigation.cy.js +55 -0
  19. package/cypress/e2e/2-advanced-examples/network_requests.cy.js +163 -0
  20. package/cypress/e2e/2-advanced-examples/querying.cy.js +114 -0
  21. package/cypress/e2e/2-advanced-examples/spies_stubs_clocks.cy.js +204 -0
  22. package/cypress/e2e/2-advanced-examples/storage.cy.js +117 -0
  23. package/cypress/e2e/2-advanced-examples/traversal.cy.js +121 -0
  24. package/cypress/e2e/2-advanced-examples/utilities.cy.js +107 -0
  25. package/cypress/e2e/2-advanced-examples/viewport.cy.js +58 -0
  26. package/cypress/e2e/2-advanced-examples/waiting.cy.js +30 -0
  27. package/cypress/e2e/2-advanced-examples/window.cy.js +22 -0
  28. package/cypress/e2e/spec.cy.ts +5 -0
  29. package/cypress/e2e/toolCheckType.cy.ts +37 -0
  30. package/cypress/e2e/toolCompareStructures.cy.ts +19 -0
  31. package/cypress/e2e/toolCreateHash.cy.ts +7 -0
  32. package/cypress/e2e/toolMoneyFormat.cy.ts +46 -0
  33. package/cypress/fixtures/example.json +5 -0
  34. package/cypress/support/commands.ts +37 -0
  35. package/cypress/support/component-index.html +12 -0
  36. package/cypress/support/component.ts +39 -0
  37. package/cypress/support/e2e.ts +20 -0
  38. package/cypress/types.d.ts +1 -0
  39. package/cypress.config.ts +16 -0
  40. package/dist/br-dionysus.es.js +2781 -2739
  41. package/dist/br-dionysus.umd.js +7 -7
  42. package/dist/cypress.config.d.ts +3 -0
  43. package/dist/index.css +1 -1
  44. package/dist/packages/MDialog/src/MDialog.vue.d.ts +1 -1
  45. package/dist/packages/MInputNumber/src/MInputNumber.vue.d.ts +1 -1
  46. package/dist/packages/MSelectTable/src/MSelectTable.vue.d.ts +3 -3
  47. package/dist/packages/MSelectTableV1/src/MSelectTableV1.vue.d.ts +2 -2
  48. package/dist/packages/MSelectV2/src/MSelectV2.vue.d.ts +8 -2
  49. package/dist/packages/SkinConfig/src/SkinConfig.vue.d.ts +1 -1
  50. package/dist/packages/Tool/checkType/checkType.d.ts +7 -0
  51. package/dist/packages/Tool/compareStructures/compareStructures.d.ts +10 -0
  52. package/dist/packages/Tool/createHash/createHash.d.ts +7 -0
  53. package/dist/packages/index.d.ts +6 -2
  54. package/dist/vite.config.d.ts +2 -0
  55. package/package.json +7 -3
  56. package/packages/Hook/useRemainingSpace/README.md +17 -7
  57. package/packages/Hook/useRemainingSpace/demo.vue +38 -0
  58. package/packages/Hook/useRemainingSpace/useRemainingSpace.ts +7 -2
  59. package/packages/Hook/useTableConfig/demo.vue +1 -1
  60. package/packages/MDialog/src/MDialog.vue +2 -8
  61. package/packages/MInline/src/MInline.vue +1 -11
  62. package/packages/MInputNumber/src/MInputNumber.vue +3 -5
  63. package/packages/MSelectTable/src/MSelectTable.vue +3 -0
  64. package/packages/MSelectV2/docs/demo.vue +1 -1
  65. package/packages/MSelectV2/src/MSelectV2.vue +10 -6
  66. package/packages/MTable/src/MTable.vue +2 -2
  67. package/packages/MTableColumn/src/MTableColumn.vue +51 -8
  68. package/packages/MTableColumnSet/src/MTableColumnSet.vue +1 -1
  69. package/packages/SkinConfig/src/SkinConfig.vue +2 -1
  70. package/packages/SkinConfig/src/useSkin.ts +5 -2
  71. package/packages/Tool/checkType/README.md +17 -0
  72. package/packages/Tool/checkType/checkType.ts +14 -0
  73. package/packages/Tool/compareStructures/README.md +16 -0
  74. package/packages/Tool/createHash/README.md +7 -0
  75. package/packages/Tool/moneyFormat/README.md +13 -12
  76. package/packages/Tool/moneyFormat/moneyFormat.ts +35 -2
  77. package/packages/index.ts +8 -2
  78. package/packages/list.json +10 -4
  79. package/src/cypress-augmentation.d.ts +9 -0
  80. package/src/router.ts +5 -0
  81. package/tags.json +1 -1
  82. package/{build/base.config.ts → vite.config.ts} +3 -3
  83. package/web-types.json +1 -1
  84. package/tool/checkType.ts +0 -15
  85. /package/{tool → packages/Tool/compareStructures}/compareStructures.ts +0 -0
  86. /package/{tool → packages/Tool/createHash}/createHash.ts +0 -0
package/README.md CHANGED
@@ -951,7 +951,7 @@ const remoteMethod = async (query: string = '', page: Page) => {
951
951
  <script setup lang="ts">
952
952
  import { ref } from 'vue'
953
953
 
954
- const test = ref<string>('')
954
+ const test = ref<string[]>([])
955
955
 
956
956
  const options: Option[] = [{
957
957
  label: '这是选项一',
@@ -2248,10 +2248,16 @@ const list = ref<{ name: string, className: string }[]>([
2248
2248
 
2249
2249
 
2250
2250
 
2251
+
2252
+
2251
2253
  计算获取剩余空间 hook
2252
2254
  =================
2253
2255
 
2254
- ### 1) 所需参数
2256
+ ### 1) 基础用法
2257
+
2258
+
2259
+
2260
+ ### 2) 所需参数
2255
2261
 
2256
2262
  | 名称 | 描述 | 类型 | 可选值 | 默认值 |
2257
2263
  |--------------|------|--------|:---:|:---:|
@@ -2259,13 +2265,13 @@ const list = ref<{ name: string, className: string }[]>([
2259
2265
  | className | 排除空间 | string | - | - |
2260
2266
  | redundancy | 冗余值 | number | - | 0 |
2261
2267
 
2262
- ### 2) 返回值
2268
+ ### 3) 返回值
2263
2269
 
2264
- | 名称 | 描述 | 类型 |
2265
- |--------------|--------------------------------|-------------|
2266
- | height | 计算之后的高度 | ref<number> |
2267
- | tableCovered | 重新进行计算高度 (如弹窗表 抽屉表 等默认无DOM时使用) | function |
2268
- | init | 重新初始化 (如弹窗表 抽屉表 等默认无DOM时使用) | function |
2270
+ | 名称 | 描述 | 类型 |
2271
+ |:------------:|:------------------------------:|:-------------:|
2272
+ | height | 计算之后的高度 | ref\<number\> |
2273
+ | tableCovered | 重新进行计算高度 (如弹窗表 抽屉表 等默认无DOM时使用) | function |
2274
+ | init | 重新初始化 (如弹窗表 抽屉表 等默认无DOM时使用) | function |
2269
2275
 
2270
2276
 
2271
2277
 
@@ -2337,6 +2343,12 @@ const list = ref<{ name: string, className: string }[]>([
2337
2343
 
2338
2344
 
2339
2345
 
2346
+ + checkType([|-isNumber-|-是否为数值-|-()](#|-isNumber-|-是否为数值-|-()))
2347
+
2348
+ + compareStructures([](#))
2349
+
2350
+ + createHash([](#))
2351
+
2340
2352
  + moneyFormat([](#))
2341
2353
 
2342
2354
 
@@ -3256,7 +3268,7 @@ const remoteMethod = async (query: string = '', page: Page) => {
3256
3268
  <script setup lang="ts">
3257
3269
  import { ref } from 'vue'
3258
3270
 
3259
- const test = ref<string>('')
3271
+ const test = ref<string[]>([])
3260
3272
 
3261
3273
  const options: Option[] = [{
3262
3274
  label: '这是选项一',
@@ -4510,20 +4522,73 @@ const list = ref<{ name: string, className: string }[]>([
4510
4522
  ## Tool列表
4511
4523
 
4512
4524
 
4525
+ ## 检查变量类型 checkType
4526
+
4527
+ ### 1) 传参
4528
+
4529
+ | 参数 | 描述 | 类型 | 默认值 |
4530
+ |------|-------|-----|-----|
4531
+ | data | 被检测数据 | any | - |
4532
+
4533
+ ### 2) 返参
4534
+
4535
+ | 参数 | 描述 | 类型 | 默认值 |
4536
+ |----------|-------|---------------|-----|
4537
+ | isNumber | 是否为数值 | () => boolean | - |
4538
+ | isObject | 是否为对象 | () => boolean | - |
4539
+ | isArray | 是否为数组 | () => boolean | - |
4540
+
4541
+
4542
+
4543
+
4544
+
4545
+
4546
+ ## 比较两个变量的数据结构是否一致 compareStructures
4547
+
4548
+ ### 1) 传参
4549
+
4550
+ | 参数 | 描述 | 类型 | 默认值 |
4551
+ |----|-------|-----|-----|
4552
+ | a | 被检测数据 | any | - |
4553
+ | b | 被检测数据 | any | - |
4554
+
4555
+ ### 2) 返参
4556
+
4557
+ | 参数 | 描述 | 类型 | 默认值 |
4558
+ |----|------|---------|-----|
4559
+ | - | 返回参数 | boolean | - |
4560
+
4561
+
4562
+
4563
+
4564
+
4565
+
4566
+ ## 创建随机哈希值 createHash
4567
+
4568
+ ### 1) 参数
4513
4569
 
4514
- ### 1) moneyFormat
4570
+ | 参数 | 描述 | 类型 | 默认值 |
4571
+ |------------|----|--------|-----|
4572
+ | hashLength | 长度 | number | 24 |
4573
+
4574
+
4575
+
4576
+
4577
+ ## 处理金额格式 moneyFormat
4515
4578
 
4516
- | 参数 | 描述 | 类型 | 默认值 |
4517
- | ----------- | -------------- | ------------- | ------ |
4518
- | val | 要转换的数字 | number,string | 0 |
4519
- | isThousands | 是否需要千分位 | boolean | true |
4520
- | roundDTo | 四舍五入位数 | number | 2 |
4521
- | config | 配置项 | ConfigType | {} |
4579
+ ### 1) 参数
4580
+ | 参数 | 描述 | 类型 | 默认值 |
4581
+ |-------------|---------|---------------|------|
4582
+ | val | 要转换的数字 | number,string | 0 |
4583
+ | isThousands | 是否需要千分位 | boolean | true |
4584
+ | roundDTo | 四舍五入位数 | number | 2 |
4585
+ | config | 配置项 | ConfigType | {} |
4522
4586
 
4523
4587
  ### 2) ConfigType
4524
- | 参数 | 描述 | 类型 | 默认值 |
4525
- | ----------- | ------------ | ------ | ------ |
4526
- | moneySymbol | 补的金钱符号 | string | - |
4527
- | repairZero | 末尾补几位零 | number | - |
4588
+
4589
+ | 参数 | 描述 | 类型 | 默认值 |
4590
+ |-------------|---------|--------|-----|
4591
+ | moneySymbol | 补的金钱符号 | string | - |
4592
+ | repairZero | 末尾补到几位零 | number | - |
4528
4593
 
4529
4594
 
package/attributes.json CHANGED
@@ -1 +1 @@
1
- {"m-dialog/modelValue":{"type":"boolean","description":""},"m-dialog/width":{"type":"string | number","description":"对话框的宽度,默认值为 50%"},"m-dialog/insideHeight":{"type":"number | null","description":"对话框内部空间的高度,默认为null"},"m-dialog/minInsideHeight":{"type":"number","description":"对话框内部空间的最小高度,默认为0(当同时存在maxHeight和minInsideHeight时,以maxHeight为准)"},"m-dialog/maxInsideHeight":{"type":"number","description":"对话框内部空间的最大高度,默认为Infinity"},"m-dialog/resize":{"type":"boolean","description":"是否开启拖拽改变大小"},"m-dialog/draggable":{"type":"boolean","description":"是否可拖动"},"m-dialog/insideClassName":{"type":"string","description":"对话框内部空间的className"},"m-dialog/resized":{"type":"[contentsSize: { width: number, height: number }]","description":"窗口大小改变完成事件"},"m-dialog/update:insideHeight":{"type":"[number]","description":"更新内部容器高度"},"m-dialog/update:modelValue":{"type":"[boolean]","description":""},"m-inline/minWidth":{"type":"number","description":"列最小宽度"},"m-inline/maxWidth":{"type":"number","description":"列最大宽度"},"m-inline/size":{"type":"Size","description":"组件尺寸"},"m-inline/switch":{"type":"[status: boolean]","description":"切换折叠展开事件"},"m-input-number/modelValue":{"type":"string | number","description":""},"m-input-number/placeholder":{"type":"string","description":""},"m-input-number/disabled":{"type":"boolean","description":"是否禁用数值输入框"},"m-input-number/size":{"type":"string","description":"数值输入框尺寸"},"m-input-number/min":{"type":"number","description":"设置数值输入框允许的最小值"},"m-input-number/max":{"type":"number","description":"设置数值输入框允许的最大值"},"m-input-number/step":{"type":"number","description":"数值输入框步长"},"m-input-number/stepStrictly":{"type":"boolean","description":"是否只能输入 step 的倍数"},"m-input-number/thousandthPlace":{"type":"boolean","description":"输入框是否显示千分位"},"m-input-number/noBorder":{"type":"boolean","description":"是否不要边框"},"m-input-number/noSpacing":{"type":"boolean","description":"不要边距"},"m-input-number/update:modelValue":{"type":"any","description":""},"m-input-number/change":{"type":"any","description":""},"m-input-number/focus":{"type":"any","description":""},"m-input-number/blur":{"type":"any","description":""},"m-select/checkboxMode":{"type":"boolean","description":"是否为checkbox模式"},"m-select/multiple":{"type":"boolean","description":"多选"},"m-select-table/modelValue":{"type":"string | number | Array<number | string>","description":""},"m-select-table/name":{"type":"string | number | Array<number | string>","description":"显示值"},"m-select-table/placeholder":{"type":"string","description":""},"m-select-table/disabled":{"type":"boolean","description":""},"m-select-table/size":{"type":"'small' | 'large' | ''","description":""},"m-select-table/total":{"type":"number | null","description":"总数据量,当有值时,出现分页器"},"m-select-table/filterMethod":{"type":"Function | null","description":"自定义搜索"},"m-select-table/filterable":{"type":"boolean","description":"是否使用搜索"},"m-select-table/remote":{"type":"boolean","description":"是否使用 远程搜索"},"m-select-table/remoteMethod":{"type":"Function","description":"自定义远程搜索"},"m-select-table/options":{"type":"Option[]","description":""},"m-select-table/tableTitle":{"type":"TableTitle[]","description":""},"m-select-table/multiple":{"type":"boolean","description":"是否多选"},"m-select-table/keywords":{"type":"Option","description":"定义默认的 label 和value"},"m-select-table/reserveSelection":{"type":"boolean","description":"是否开启翻页多选"},"m-select-table/tableHeight":{"type":"string | number","description":""},"m-select-table/isAffirmBtn":{"type":"boolean","description":"是否有确认按钮"},"m-select-table/scrollbarAlwaysOn":{"type":"boolean","description":"是否常态显示滚动条"},"m-select-table/allowCreate":{"type":"boolean","description":"是否能够创建条目"},"m-select-table/border":{"type":"boolean","description":"表格边框"},"m-select-table/popupWidth":{"type":"number | string","description":"弹窗的宽度"},"m-select-table/selected":{"type":"[values: string | number | Array<string | number>, rows: Option[] | Option]","description":"单选或多选之后的回调"},"m-select-table/selectMultiple":{"type":"[values: Array<string | number>, rows: Option[]]","description":"多选确认按钮时的回调 配合isAffirmBtn使用"},"m-select-table/toPage":{"type":"[page: Page, query?: string]","description":"当没有使用filterMethod时候才会有回调否则没有"},"m-select-table/update:modelValue":{"type":"[value: string | number | Array<string | number>]","description":""},"m-select-table/clear":{"type":"[]","description":"用户点击清空按钮时触发"},"m-select-table/removeTag":{"type":"[tag: any]","description":"多选模式下移除tag时触发"},"m-select-table-v1/modelValue":{"type":"string | number","description":""},"m-select-table-v1/placeholder":{"type":"string","description":""},"m-select-table-v1/disabled":{"type":"boolean","description":""},"m-select-table-v1/options":{"type":"Option[]","description":""},"m-select-table-v1/tableTitle":{"type":"any[]","description":""},"m-select-table-v1/remoteMethod":{"type":"Function","description":""},"m-select-table-v1/allowCreate":{"type":"boolean","description":""},"m-select-table-v1/focusShow":{"type":"boolean","description":""},"m-select-table-v1/isSelect":{"type":"boolean","description":""},"m-select-table-v1/clearable":{"type":"boolean","description":""},"m-select-table-v1/size":{"type":"'small' | 'large' | ''","description":""},"m-select-table-v1/labelKey":{"type":"string","description":""},"m-select-table-v1/scrollbarAlwaysOn":{"type":"boolean","description":""},"m-select-table-v1/total":{"type":"number | null","description":""},"m-select-table-v1/update:modelValue":{"type":"any","description":""},"m-select-table-v1/selectMultiple":{"type":"any","description":""},"m-select-table-v1/change":{"type":"any","description":""},"m-select-table-v1/selected":{"type":"any","description":""},"m-select-table-v1/clear":{"type":"any","description":""},"m-select-v2/checkboxMode":{"type":"boolean","description":"是否为checkbox模式"},"m-select-v2/multiple":{"type":"boolean","description":"多选"},"m-select-v2/showAll":{"type":"boolean","description":"是否显示全选"},"m-select-v2/options":{"type":"Option[]","description":"选项"},"m-select-v2/update:modelValue":{"type":"[data: any]","description":""},"m-table/size":{"type":"'small' | 'large' | ''","description":""},"m-table/sole":{"type":"string","description":""},"m-table/data":{"type":"Array<{\n [key: string]: any\n }>","description":""},"m-table/filtersValue":{"type":"FilterValue","description":""},"m-table/tableConfig":{"type":"TableConfig | null","description":"表格配置"},"m-table/expandProp":{"type":"string","description":"展开图标列(如使用这个属性则必须存在rowKey属性) (标记,约束条件后面解决)"},"m-table/expandRowKeys":{"type":"any[]","description":"可以通过该属性设置 Table 目前的展开行,需要设置 row-key 属性才能使用,该属性为展开行的 keys 数组。"},"m-table/rowKey":{"type":"Function | string","description":"行数据的 Key,用来优化 Table 的渲染; 在使用reserve-selection功能与显示树形数据时,该属性是必填的。 类型为 String 时,支持多层访问:user.info.id,但不支持 user.info[0].id,此种情况请使用 Function。"},"m-table/tableConfigKey":{"type":"string","description":"表格配置key"},"m-table/pasteData":{"type":"[\n data: {\n /** 粘贴行的行数据 */\n editRow: { [key: string]: any },\n /** 粘贴列的列名 */\n editColumn: string,\n /** 粘贴的数据 */\n arr: Array<string | number>,\n /** 起始行 */\n rowIndex: number,\n },\n /** 粘贴完成后的表格数据 */\n tableData: Array<{ [key: string]: any }>\n ]","description":""},"m-table/update:tableConfig":{"type":"[tableConfig: TableConfig]","description":"表格配置更新"},"m-table/privateExpandChange":{"type":"[row: any, expandedRows: any[]]","description":"expandProp模式下 当用户对某一行展开或者关闭的时候会触发该事件"},"m-table-column/filtersValue":{"type":"FilterValue","description":"过滤值"},"m-table-column/filters":{"type":"Array<{ text: string | number, value: string | number }>","description":"过滤选项"},"m-table-column/filterMethod":{"type":"Function | null","description":"过滤方法"},"m-table-column/children":{"type":"Array<PropChildren>","description":""},"m-table-column/update:filtersValue":{"type":"any","description":""},"m-table-column-set/modelValue":{"type":"TableConfig","description":"配置"},"m-table-column-set/foldMode":{"type":"boolean","description":"是否为折叠模式"},"m-table-column-set/link":{"type":"boolean","description":"是否为链接按钮"},"m-table-column-set/tableConfigKey":{"type":"''","description":"表格配置key"},"m-table-column-set/update:modelValue":{"type":"any","description":""},"m-table-column-set/change":{"type":"any","description":""},"skin-config/change":{"type":"any","description":""},"tab-page/modelValue":{"type":"MenuItem[]","description":""},"tab-page/activeKey":{"type":"string","description":""},"tab-page/showRightClickMenu":{"type":"boolean","description":""},"tab-page/primaryColor":{"type":"string","description":""},"tab-page/primaryBackgroundColor":{"type":"string | null","description":""},"tab-page/close":{"type":"any","description":""},"tab-page/click":{"type":"any","description":""}}
1
+ {"m-dialog/modelValue":{"type":"boolean","description":""},"m-dialog/width":{"type":"string | number","description":"对话框的宽度,默认值为 50%"},"m-dialog/insideHeight":{"type":"number | null","description":"对话框内部空间的高度,默认为null"},"m-dialog/minInsideHeight":{"type":"number","description":"对话框内部空间的最小高度,默认为0(当同时存在maxHeight和minInsideHeight时,以maxHeight为准)"},"m-dialog/maxInsideHeight":{"type":"number","description":"对话框内部空间的最大高度,默认为Infinity"},"m-dialog/resize":{"type":"boolean","description":"是否开启拖拽改变大小"},"m-dialog/draggable":{"type":"boolean","description":"是否可拖动"},"m-dialog/insideClassName":{"type":"string","description":"对话框内部空间的className"},"m-dialog/resized":{"type":"[contentsSize: { width: number, height: number }]","description":"窗口大小改变完成事件"},"m-dialog/update:insideHeight":{"type":"[number]","description":"更新内部容器高度"},"m-dialog/update:modelValue":{"type":"[boolean]","description":""},"m-inline/minWidth":{"type":"number","description":"列最小宽度"},"m-inline/maxWidth":{"type":"number","description":"列最大宽度"},"m-inline/size":{"type":"Size","description":"组件尺寸"},"m-inline/switch":{"type":"[status: boolean]","description":"切换折叠展开事件"},"m-input-number/modelValue":{"type":"string | number","description":""},"m-input-number/placeholder":{"type":"string","description":""},"m-input-number/disabled":{"type":"boolean","description":"是否禁用数值输入框"},"m-input-number/size":{"type":"string","description":"数值输入框尺寸"},"m-input-number/min":{"type":"number","description":"设置数值输入框允许的最小值"},"m-input-number/max":{"type":"number","description":"设置数值输入框允许的最大值"},"m-input-number/step":{"type":"number","description":"数值输入框步长"},"m-input-number/stepStrictly":{"type":"boolean","description":"是否只能输入 step 的倍数"},"m-input-number/thousandthPlace":{"type":"boolean","description":"输入框是否显示千分位"},"m-input-number/noBorder":{"type":"boolean","description":"是否不要边框"},"m-input-number/noSpacing":{"type":"boolean","description":"不要边距"},"m-input-number/update:modelValue":{"type":"any","description":""},"m-input-number/change":{"type":"any","description":""},"m-input-number/focus":{"type":"any","description":""},"m-input-number/blur":{"type":"any","description":""},"m-select/checkboxMode":{"type":"boolean","description":"是否为checkbox模式"},"m-select/multiple":{"type":"boolean","description":"多选"},"m-select-table/modelValue":{"type":"string | number | Array<number | string>","description":""},"m-select-table/name":{"type":"string | number | Array<number | string>","description":"显示值"},"m-select-table/placeholder":{"type":"string","description":""},"m-select-table/disabled":{"type":"boolean","description":""},"m-select-table/size":{"type":"'small' | 'large' | ''","description":""},"m-select-table/total":{"type":"number | null","description":"总数据量,当有值时,出现分页器"},"m-select-table/filterMethod":{"type":"Function | null","description":"自定义搜索"},"m-select-table/filterable":{"type":"boolean","description":"是否使用搜索"},"m-select-table/remote":{"type":"boolean","description":"是否使用 远程搜索"},"m-select-table/remoteMethod":{"type":"Function","description":"自定义远程搜索"},"m-select-table/options":{"type":"Option[]","description":""},"m-select-table/tableTitle":{"type":"TableTitle[]","description":""},"m-select-table/multiple":{"type":"boolean","description":"是否多选"},"m-select-table/keywords":{"type":"Option","description":"定义默认的 label 和value"},"m-select-table/reserveSelection":{"type":"boolean","description":"是否开启翻页多选"},"m-select-table/tableHeight":{"type":"string | number","description":""},"m-select-table/isAffirmBtn":{"type":"boolean","description":"是否有确认按钮"},"m-select-table/scrollbarAlwaysOn":{"type":"boolean","description":"是否常态显示滚动条"},"m-select-table/allowCreate":{"type":"boolean","description":"是否能够创建条目"},"m-select-table/border":{"type":"boolean","description":"表格边框"},"m-select-table/popupWidth":{"type":"number | string","description":"弹窗的宽度"},"m-select-table/selected":{"type":"[values: string | number | Array<string | number>, rows: Option[] | Option]","description":"单选或多选之后的回调"},"m-select-table/selectMultiple":{"type":"[values: Array<string | number>, rows: Option[]]","description":"多选确认按钮时的回调 配合isAffirmBtn使用"},"m-select-table/toPage":{"type":"[page: Page, query?: string]","description":"当没有使用filterMethod时候才会有回调否则没有"},"m-select-table/update:modelValue":{"type":"[value: string | number | Array<string | number>]","description":""},"m-select-table/clear":{"type":"[]","description":"用户点击清空按钮时触发"},"m-select-table/removeTag":{"type":"[tag: any]","description":"多选模式下移除tag时触发"},"m-select-table-v1/modelValue":{"type":"string | number","description":""},"m-select-table-v1/placeholder":{"type":"string","description":""},"m-select-table-v1/disabled":{"type":"boolean","description":""},"m-select-table-v1/options":{"type":"Option[]","description":""},"m-select-table-v1/tableTitle":{"type":"any[]","description":""},"m-select-table-v1/remoteMethod":{"type":"Function","description":""},"m-select-table-v1/allowCreate":{"type":"boolean","description":""},"m-select-table-v1/focusShow":{"type":"boolean","description":""},"m-select-table-v1/isSelect":{"type":"boolean","description":""},"m-select-table-v1/clearable":{"type":"boolean","description":""},"m-select-table-v1/size":{"type":"'small' | 'large' | ''","description":""},"m-select-table-v1/labelKey":{"type":"string","description":""},"m-select-table-v1/scrollbarAlwaysOn":{"type":"boolean","description":""},"m-select-table-v1/total":{"type":"number | null","description":""},"m-select-table-v1/update:modelValue":{"type":"any","description":""},"m-select-table-v1/selectMultiple":{"type":"any","description":""},"m-select-table-v1/change":{"type":"any","description":""},"m-select-table-v1/selected":{"type":"any","description":""},"m-select-table-v1/clear":{"type":"any","description":""},"m-select-v2/modelValue":{"type":"ValueType","description":""},"m-select-v2/checkboxMode":{"type":"boolean","description":"是否为checkbox模式"},"m-select-v2/multiple":{"type":"boolean","description":"多选"},"m-select-v2/showAll":{"type":"boolean","description":"是否显示全选"},"m-select-v2/options":{"type":"Option[]","description":"选项"},"m-select-v2/update:modelValue":{"type":"[data: ValueType]","description":""},"m-table/size":{"type":"'small' | 'large' | ''","description":""},"m-table/sole":{"type":"string","description":""},"m-table/data":{"type":"Array<{\n [key: string]: any\n }>","description":""},"m-table/filtersValue":{"type":"FilterValue","description":""},"m-table/tableConfig":{"type":"TableConfig | null","description":"表格配置"},"m-table/expandProp":{"type":"string","description":"展开图标列(如使用这个属性则必须存在rowKey属性) (标记,约束条件后面解决)"},"m-table/expandRowKeys":{"type":"any[]","description":"可以通过该属性设置 Table 目前的展开行,需要设置 row-key 属性才能使用,该属性为展开行的 keys 数组。"},"m-table/rowKey":{"type":"Function | string","description":"行数据的 Key,用来优化 Table 的渲染; 在使用reserve-selection功能与显示树形数据时,该属性是必填的。 类型为 String 时,支持多层访问:user.info.id,但不支持 user.info[0].id,此种情况请使用 Function。"},"m-table/tableConfigKey":{"type":"string","description":"表格配置key"},"m-table/pasteData":{"type":"[\n data: {\n /** 粘贴行的行数据 */\n editRow: { [key: string]: any },\n /** 粘贴列的列名 */\n editColumn: string,\n /** 粘贴的数据 */\n arr: Array<string | number>,\n /** 起始行 */\n rowIndex: number,\n },\n /** 粘贴完成后的表格数据 */\n tableData: Array<{ [key: string]: any }>\n ]","description":""},"m-table/update:tableConfig":{"type":"[tableConfig: TableConfig]","description":"表格配置更新"},"m-table/privateExpandChange":{"type":"[row: any, expandedRows: any[]]","description":"expandProp模式下 当用户对某一行展开或者关闭的时候会触发该事件"},"m-table-column/filtersValue":{"type":"FilterValue","description":"过滤值"},"m-table-column/filters":{"type":"Array<{ text: string | number, value: string | number }>","description":"过滤选项"},"m-table-column/filterMethod":{"type":"Function | null","description":"过滤方法"},"m-table-column/children":{"type":"Array<PropChildren>","description":""},"m-table-column/update:filtersValue":{"type":"any","description":""},"m-table-column-set/modelValue":{"type":"TableConfig","description":"配置"},"m-table-column-set/foldMode":{"type":"boolean","description":"是否为折叠模式"},"m-table-column-set/link":{"type":"boolean","description":"是否为链接按钮"},"m-table-column-set/tableConfigKey":{"type":"''","description":"表格配置key"},"m-table-column-set/update:modelValue":{"type":"any","description":""},"m-table-column-set/change":{"type":"any","description":""},"skin-config/change":{"type":"any","description":""},"tab-page/modelValue":{"type":"MenuItem[]","description":""},"tab-page/activeKey":{"type":"string","description":""},"tab-page/showRightClickMenu":{"type":"boolean","description":""},"tab-page/primaryColor":{"type":"string","description":""},"tab-page/primaryBackgroundColor":{"type":"string | null","description":""},"tab-page/close":{"type":"any","description":""},"tab-page/click":{"type":"any","description":""}}
@@ -1,4 +1,4 @@
1
- import baseConfig from './base.config'
1
+ import baseConfig from '../vite.config'
2
2
  import { defineConfig } from 'vite'
3
3
 
4
4
  export default defineConfig({
@@ -1,4 +1,4 @@
1
- import baseConfig from './base.config'
1
+ import baseConfig from '../vite.config'
2
2
  import { defineConfig } from 'vite'
3
3
  import { resolve } from 'path'
4
4
  import dts from 'vite-plugin-dts'
@@ -0,0 +1,38 @@
1
+ import { mount } from 'cypress/vue'
2
+ import { ref } from 'vue'
3
+ import { MInputNumber } from '../../packages'
4
+ import { ElInputNumber } from 'element-plus'
5
+ import 'element-plus/dist/index.css'
6
+
7
+ Cypress.Commands.add('mount' as any, (component: any, options: any = {}) => {
8
+ options.global = options.global || {}
9
+ options.global.components = options.global.components || {}
10
+
11
+ options.global.components.ElInputNumber = ElInputNumber
12
+
13
+ return mount(component, options)
14
+ })
15
+
16
+ // v-model问题待解决,此用例无法使用
17
+ describe('数值输入框组件<MInputNumber />', () => {
18
+ it('测试外部传入null', () => {
19
+ const onUpdate = cy.spy().as('onUpdate')
20
+ const onChange = cy.spy().as('onChange')
21
+ const value = ref<any>(null)
22
+ ;(cy as any).mount(MInputNumber as any, {
23
+ props: {
24
+ modelValue: value,
25
+ 'onUpdate:modelValue': onUpdate,
26
+ onChange
27
+ }
28
+ }).then(() => {
29
+ cy.get('.el-input__inner').type('111')
30
+ // cy.get('.el-input__inner').type('{1}')
31
+ // cy.get('.el-input__inner').type('{1}')
32
+ })
33
+
34
+ cy.get('@onUpdate').should((spy) => {
35
+ expect(spy).to.be.calledWith(111)
36
+ })
37
+ })
38
+ })
@@ -0,0 +1,46 @@
1
+ import { mount } from 'cypress/vue'
2
+ import { MSelect, MOption } from '../../packages'
3
+ import { ElSelect, ElCheckbox, ElOption } from 'element-plus'
4
+ import 'element-plus/dist/index.css'
5
+
6
+ Cypress.Commands.add('mount' as any, (component: any, options: any = {}) => {
7
+ options.global = options.global || {}
8
+ options.global.components = options.global.components || {}
9
+
10
+ options.global.components.ElSelect = ElSelect
11
+ options.global.components.ElCheckbox = ElCheckbox
12
+ options.global.components.ElOption = ElOption
13
+ options.global.components.MOption = MOption
14
+
15
+ return mount(component, options)
16
+ })
17
+
18
+ describe('下拉选择器组件<MSelect />', () => {
19
+ const options = [{
20
+ label: '这是选项一',
21
+ value: 'a'
22
+ }, {
23
+ label: '这是选项二',
24
+ value: 'b'
25
+ }]
26
+ it('测试选择', () => {
27
+ const onChangeSpy = cy.spy().as('onChangeSpy')
28
+ ;(cy as any).mount(MSelect as any, {
29
+ props: {
30
+ checkboxMode: true,
31
+ multiple: true,
32
+ 'onUpdate:modelValue': onChangeSpy
33
+ },
34
+ slots: {
35
+ default: options.map(item =>
36
+ `<MOption label="${item.label}" value="${item.value}"></MOption>`
37
+ ).join('')
38
+ }
39
+ })
40
+ cy.get('.el-select__wrapper').click()
41
+ cy.get('.el-select-dropdown .el-select-dropdown__item:nth-of-type(1)').click()
42
+ cy.get('@onChangeSpy').should('have.been.calledWith', ['a'])
43
+ cy.get('.el-select-dropdown .el-select-dropdown__item:nth-of-type(2)').click()
44
+ cy.get('@onChangeSpy').should('have.been.calledWith', ['b'])
45
+ })
46
+ })
@@ -0,0 +1,46 @@
1
+ import { mount } from 'cypress/vue'
2
+ import { MSelectV2 } from '../../packages'
3
+ import { ElSelect, ElCheckbox, ElOption } from 'element-plus'
4
+ import 'element-plus/dist/index.css'
5
+
6
+ Cypress.Commands.add('mount' as any, (component: any, options: any = {}) => {
7
+ options.global = options.global || {}
8
+ options.global.components = options.global.components || {}
9
+
10
+ options.global.components.ElSelect = ElSelect
11
+ options.global.components.ElCheckbox = ElCheckbox
12
+ options.global.components.ElOption = ElOption
13
+
14
+ return mount(component, options)
15
+ })
16
+
17
+ describe('下拉选择器V2组件<MSelectV2 />', () => {
18
+ const options = [{
19
+ label: '这是选项一',
20
+ value: 'a'
21
+ }, {
22
+ label: '这是选项二',
23
+ value: 'b'
24
+ }, {
25
+ label: '这是选项三',
26
+ value: 'c',
27
+ disabled: true
28
+ }]
29
+ it('测试全选', () => {
30
+ const onChangeSpy = cy.spy().as('onChangeSpy')
31
+ ;(cy as any).mount(MSelectV2 as any, {
32
+ props: {
33
+ options,
34
+ checkboxMode: true,
35
+ multiple: true,
36
+ showAll: true,
37
+ 'onUpdate:modelValue': onChangeSpy
38
+ }
39
+ })
40
+ cy.get('.el-select .el-select__wrapper').click()
41
+ cy.get('.el-select-dropdown__header .el-checkbox').click()
42
+ cy.get('@onChangeSpy').should((spy) => {
43
+ expect(spy).to.be.calledWith(['a', 'b'])
44
+ })
45
+ })
46
+ })
@@ -0,0 +1,143 @@
1
+ /// <reference types="cypress" />
2
+
3
+ // Welcome to Cypress!
4
+ //
5
+ // This spec file contains a variety of sample tests
6
+ // for a todo list app that are designed to demonstrate
7
+ // the power of writing tests in Cypress.
8
+ //
9
+ // To learn more about how Cypress works and
10
+ // what makes it such an awesome testing tool,
11
+ // please read our getting started guide:
12
+ // https://on.cypress.io/introduction-to-cypress
13
+
14
+ describe('example to-do app', () => {
15
+ beforeEach(() => {
16
+ // Cypress starts out with a blank slate for each test
17
+ // so we must tell it to visit our website with the `cy.visit()` command.
18
+ // Since we want to visit the same URL at the start of all our tests,
19
+ // we include it in our beforeEach function so that it runs before each test
20
+ cy.visit('https://example.cypress.io/todo')
21
+ })
22
+
23
+ it('displays two todo items by default', () => {
24
+ // We use the `cy.get()` command to get all elements that match the selector.
25
+ // Then, we use `should` to assert that there are two matched items,
26
+ // which are the two default items.
27
+ cy.get('.todo-list li').should('have.length', 2)
28
+
29
+ // We can go even further and check that the default todos each contain
30
+ // the correct text. We use the `first` and `last` functions
31
+ // to get just the first and last matched elements individually,
32
+ // and then perform an assertion with `should`.
33
+ cy.get('.todo-list li').first().should('have.text', 'Pay electric bill')
34
+ cy.get('.todo-list li').last().should('have.text', 'Walk the dog')
35
+ })
36
+
37
+ it('can add new todo items', () => {
38
+ // We'll store our item text in a variable so we can reuse it
39
+ const newItem = 'Feed the cat'
40
+
41
+ // Let's get the input element and use the `type` command to
42
+ // input our new list item. After typing the content of our item,
43
+ // we need to type the enter key as well in order to submit the input.
44
+ // This input has a data-test attribute so we'll use that to select the
45
+ // element in accordance with best practices:
46
+ // https://on.cypress.io/selecting-elements
47
+ cy.get('[data-test=new-todo]').type(`${newItem}{enter}`)
48
+
49
+ // Now that we've typed our new item, let's check that it actually was added to the list.
50
+ // Since it's the newest item, it should exist as the last element in the list.
51
+ // In addition, with the two default items, we should have a total of 3 elements in the list.
52
+ // Since assertions yield the element that was asserted on,
53
+ // we can chain both of these assertions together into a single statement.
54
+ cy.get('.todo-list li')
55
+ .should('have.length', 3)
56
+ .last()
57
+ .should('have.text', newItem)
58
+ })
59
+
60
+ it('can check off an item as completed', () => {
61
+ // In addition to using the `get` command to get an element by selector,
62
+ // we can also use the `contains` command to get an element by its contents.
63
+ // However, this will yield the <label>, which is lowest-level element that contains the text.
64
+ // In order to check the item, we'll find the <input> element for this <label>
65
+ // by traversing up the dom to the parent element. From there, we can `find`
66
+ // the child checkbox <input> element and use the `check` command to check it.
67
+ cy.contains('Pay electric bill')
68
+ .parent()
69
+ .find('input[type=checkbox]')
70
+ .check()
71
+
72
+ // Now that we've checked the button, we can go ahead and make sure
73
+ // that the list element is now marked as completed.
74
+ // Again we'll use `contains` to find the <label> element and then use the `parents` command
75
+ // to traverse multiple levels up the dom until we find the corresponding <li> element.
76
+ // Once we get that element, we can assert that it has the completed class.
77
+ cy.contains('Pay electric bill')
78
+ .parents('li')
79
+ .should('have.class', 'completed')
80
+ })
81
+
82
+ context('with a checked task', () => {
83
+ beforeEach(() => {
84
+ // We'll take the command we used above to check off an element
85
+ // Since we want to perform multiple tests that start with checking
86
+ // one element, we put it in the beforeEach hook
87
+ // so that it runs at the start of every test.
88
+ cy.contains('Pay electric bill')
89
+ .parent()
90
+ .find('input[type=checkbox]')
91
+ .check()
92
+ })
93
+
94
+ it('can filter for uncompleted tasks', () => {
95
+ // We'll click on the "active" button in order to
96
+ // display only incomplete items
97
+ cy.contains('Active').click()
98
+
99
+ // After filtering, we can assert that there is only the one
100
+ // incomplete item in the list.
101
+ cy.get('.todo-list li')
102
+ .should('have.length', 1)
103
+ .first()
104
+ .should('have.text', 'Walk the dog')
105
+
106
+ // For good measure, let's also assert that the task we checked off
107
+ // does not exist on the page.
108
+ cy.contains('Pay electric bill').should('not.exist')
109
+ })
110
+
111
+ it('can filter for completed tasks', () => {
112
+ // We can perform similar steps as the test above to ensure
113
+ // that only completed tasks are shown
114
+ cy.contains('Completed').click()
115
+
116
+ cy.get('.todo-list li')
117
+ .should('have.length', 1)
118
+ .first()
119
+ .should('have.text', 'Pay electric bill')
120
+
121
+ cy.contains('Walk the dog').should('not.exist')
122
+ })
123
+
124
+ it('can delete all completed tasks', () => {
125
+ // First, let's click the "Clear completed" button
126
+ // `contains` is actually serving two purposes here.
127
+ // First, it's ensuring that the button exists within the dom.
128
+ // This button only appears when at least one task is checked
129
+ // so this command is implicitly verifying that it does exist.
130
+ // Second, it selects the button so we can click it.
131
+ cy.contains('Clear completed').click()
132
+
133
+ // Then we can make sure that there is only one element
134
+ // in the list and our element does not exist
135
+ cy.get('.todo-list li')
136
+ .should('have.length', 1)
137
+ .should('not.have.text', 'Pay electric bill')
138
+
139
+ // Finally, make sure that the clear button no longer exists.
140
+ cy.contains('Clear completed').should('not.exist')
141
+ })
142
+ })
143
+ })