br-dionysus 1.7.7 → 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.
- package/README.md +72 -13
- package/attributes.json +1 -1
- package/build/doc.config.ts +1 -1
- package/build/lib.config.ts +1 -1
- package/cypress/component/MInputNumber.cy.ts +38 -0
- package/cypress/component/MSelect.cy.ts +46 -0
- package/cypress/component/MSelectV2.cy.ts +46 -0
- package/cypress/e2e/1-getting-started/todo.cy.js +143 -0
- package/cypress/e2e/2-advanced-examples/actions.cy.js +321 -0
- package/cypress/e2e/2-advanced-examples/aliasing.cy.js +39 -0
- package/cypress/e2e/2-advanced-examples/assertions.cy.js +176 -0
- package/cypress/e2e/2-advanced-examples/connectors.cy.js +98 -0
- package/cypress/e2e/2-advanced-examples/cookies.cy.js +118 -0
- package/cypress/e2e/2-advanced-examples/cypress_api.cy.js +185 -0
- package/cypress/e2e/2-advanced-examples/files.cy.js +85 -0
- package/cypress/e2e/2-advanced-examples/location.cy.js +32 -0
- package/cypress/e2e/2-advanced-examples/misc.cy.js +90 -0
- package/cypress/e2e/2-advanced-examples/navigation.cy.js +55 -0
- package/cypress/e2e/2-advanced-examples/network_requests.cy.js +163 -0
- package/cypress/e2e/2-advanced-examples/querying.cy.js +114 -0
- package/cypress/e2e/2-advanced-examples/spies_stubs_clocks.cy.js +204 -0
- package/cypress/e2e/2-advanced-examples/storage.cy.js +117 -0
- package/cypress/e2e/2-advanced-examples/traversal.cy.js +121 -0
- package/cypress/e2e/2-advanced-examples/utilities.cy.js +107 -0
- package/cypress/e2e/2-advanced-examples/viewport.cy.js +58 -0
- package/cypress/e2e/2-advanced-examples/waiting.cy.js +30 -0
- package/cypress/e2e/2-advanced-examples/window.cy.js +22 -0
- package/cypress/e2e/spec.cy.ts +5 -0
- package/cypress/e2e/toolCheckType.cy.ts +37 -0
- package/cypress/e2e/toolCompareStructures.cy.ts +19 -0
- package/cypress/e2e/toolCreateHash.cy.ts +7 -0
- package/cypress/e2e/toolMoneyFormat.cy.ts +46 -0
- package/cypress/fixtures/example.json +5 -0
- package/cypress/support/commands.ts +37 -0
- package/cypress/support/component-index.html +12 -0
- package/cypress/support/component.ts +39 -0
- package/cypress/support/e2e.ts +20 -0
- package/cypress/types.d.ts +1 -0
- package/cypress.config.ts +16 -0
- package/dist/br-dionysus.es.js +2774 -2739
- package/dist/br-dionysus.umd.js +7 -7
- package/dist/cypress.config.d.ts +3 -0
- package/dist/index.css +1 -1
- package/dist/packages/MSelectV2/src/MSelectV2.vue.d.ts +8 -2
- package/dist/packages/SkinConfig/src/SkinConfig.vue.d.ts +1 -1
- package/dist/packages/Tool/checkType/checkType.d.ts +7 -0
- package/dist/packages/Tool/compareStructures/compareStructures.d.ts +10 -0
- package/dist/packages/Tool/createHash/createHash.d.ts +7 -0
- package/dist/packages/index.d.ts +6 -2
- package/dist/vite.config.d.ts +2 -0
- package/package.json +7 -3
- package/packages/Hook/useRemainingSpace/demo.vue +0 -1
- package/packages/Hook/useTableConfig/demo.vue +1 -1
- package/packages/MDialog/src/MDialog.vue +2 -8
- package/packages/MInline/src/MInline.vue +1 -11
- package/packages/MInputNumber/src/MInputNumber.vue +3 -5
- package/packages/MSelectV2/docs/demo.vue +1 -1
- package/packages/MSelectV2/src/MSelectV2.vue +10 -6
- package/packages/MTable/src/MTable.vue +2 -2
- package/packages/MTableColumn/src/MTableColumn.vue +51 -8
- package/packages/MTableColumnSet/src/MTableColumnSet.vue +1 -1
- package/packages/SkinConfig/src/SkinConfig.vue +2 -1
- package/packages/SkinConfig/src/useSkin.ts +5 -2
- package/packages/Tool/checkType/README.md +17 -0
- package/packages/Tool/checkType/checkType.ts +14 -0
- package/packages/Tool/compareStructures/README.md +16 -0
- package/packages/Tool/createHash/README.md +7 -0
- package/packages/Tool/moneyFormat/README.md +13 -12
- package/packages/Tool/moneyFormat/moneyFormat.ts +35 -2
- package/packages/index.ts +8 -2
- package/src/cypress-augmentation.d.ts +9 -0
- package/tags.json +1 -1
- package/{build/base.config.ts → vite.config.ts} +3 -3
- package/web-types.json +1 -1
- package/tool/checkType.ts +0 -15
- /package/{tool → packages/Tool/compareStructures}/compareStructures.ts +0 -0
- /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: '这是选项一',
|
|
@@ -2343,6 +2343,12 @@ const list = ref<{ name: string, className: string }[]>([
|
|
|
2343
2343
|
|
|
2344
2344
|
|
|
2345
2345
|
|
|
2346
|
+
+ checkType([|-isNumber-|-是否为数值-|-()](#|-isNumber-|-是否为数值-|-()))
|
|
2347
|
+
|
|
2348
|
+
+ compareStructures([](#))
|
|
2349
|
+
|
|
2350
|
+
+ createHash([](#))
|
|
2351
|
+
|
|
2346
2352
|
+ moneyFormat([](#))
|
|
2347
2353
|
|
|
2348
2354
|
|
|
@@ -3262,7 +3268,7 @@ const remoteMethod = async (query: string = '', page: Page) => {
|
|
|
3262
3268
|
<script setup lang="ts">
|
|
3263
3269
|
import { ref } from 'vue'
|
|
3264
3270
|
|
|
3265
|
-
const test = ref<string>(
|
|
3271
|
+
const test = ref<string[]>([])
|
|
3266
3272
|
|
|
3267
3273
|
const options: Option[] = [{
|
|
3268
3274
|
label: '这是选项一',
|
|
@@ -4516,20 +4522,73 @@ const list = ref<{ name: string, className: string }[]>([
|
|
|
4516
4522
|
## Tool列表
|
|
4517
4523
|
|
|
4518
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) 传参
|
|
4519
4549
|
|
|
4520
|
-
|
|
4550
|
+
| 参数 | 描述 | 类型 | 默认值 |
|
|
4551
|
+
|----|-------|-----|-----|
|
|
4552
|
+
| a | 被检测数据 | any | - |
|
|
4553
|
+
| b | 被检测数据 | any | - |
|
|
4521
4554
|
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
|
4525
|
-
|
|
4526
|
-
|
|
|
4527
|
-
|
|
4555
|
+
### 2) 返参
|
|
4556
|
+
|
|
4557
|
+
| 参数 | 描述 | 类型 | 默认值 |
|
|
4558
|
+
|----|------|---------|-----|
|
|
4559
|
+
| - | 返回参数 | boolean | - |
|
|
4560
|
+
|
|
4561
|
+
|
|
4562
|
+
|
|
4563
|
+
|
|
4564
|
+
|
|
4565
|
+
|
|
4566
|
+
## 创建随机哈希值 createHash
|
|
4567
|
+
|
|
4568
|
+
### 1) 参数
|
|
4569
|
+
|
|
4570
|
+
| 参数 | 描述 | 类型 | 默认值 |
|
|
4571
|
+
|------------|----|--------|-----|
|
|
4572
|
+
| hashLength | 长度 | number | 24 |
|
|
4573
|
+
|
|
4574
|
+
|
|
4575
|
+
|
|
4576
|
+
|
|
4577
|
+
## 处理金额格式 moneyFormat
|
|
4578
|
+
|
|
4579
|
+
### 1) 参数
|
|
4580
|
+
| 参数 | 描述 | 类型 | 默认值 |
|
|
4581
|
+
|-------------|---------|---------------|------|
|
|
4582
|
+
| val | 要转换的数字 | number,string | 0 |
|
|
4583
|
+
| isThousands | 是否需要千分位 | boolean | true |
|
|
4584
|
+
| roundDTo | 四舍五入位数 | number | 2 |
|
|
4585
|
+
| config | 配置项 | ConfigType | {} |
|
|
4528
4586
|
|
|
4529
4587
|
### 2) ConfigType
|
|
4530
|
-
|
|
4531
|
-
|
|
|
4532
|
-
|
|
4533
|
-
|
|
|
4588
|
+
|
|
4589
|
+
| 参数 | 描述 | 类型 | 默认值 |
|
|
4590
|
+
|-------------|---------|--------|-----|
|
|
4591
|
+
| moneySymbol | 补的金钱符号 | string | - |
|
|
4592
|
+
| repairZero | 末尾补到几位零 | number | - |
|
|
4534
4593
|
|
|
4535
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:
|
|
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":""}}
|
package/build/doc.config.ts
CHANGED
package/build/lib.config.ts
CHANGED
|
@@ -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
|
+
})
|