-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): add component radio radio-group form
- Loading branch information
Showing
30 changed files
with
2,004 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
142 changes: 76 additions & 66 deletions
142
packages/varlet-vue2-ui/src/cell/__test__/__snapshots__/index.spec.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,91 +1,101 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`test cell example 1`] = ` | ||
"<div> | ||
<div class=\\"app-type\\">基本使用</div> | ||
<div class=\\"var-cell\\"> | ||
<!--v-if--> | ||
<div class=\\"var-cell__content\\"> | ||
<div class=\\"var-cell__title\\">这是单元格</div> | ||
<!--v-if--> | ||
"<div class=\\"var-cell-outer\\"> | ||
<div> | ||
<div class=\\"app-type\\">基本使用</div> | ||
<div class=\\"var-cell\\"> | ||
<!----> | ||
<div class=\\"var-cell__content\\"> | ||
<div class=\\"var-cell__title\\"> 这是单元格 </div> | ||
<!----> | ||
</div> | ||
<!----> | ||
</div> | ||
<!--v-if--> | ||
</div> | ||
<div class=\\"var-cell\\"> | ||
<!--v-if--> | ||
<div class=\\"var-cell__content\\"> | ||
<div class=\\"var-cell__title\\">这是单元格</div> | ||
<!--v-if--> | ||
<div class=\\"var-cell\\"> | ||
<!----> | ||
<div class=\\"var-cell__content\\"> | ||
<div class=\\"var-cell__title\\"> 这是单元格 </div> | ||
<!----> | ||
</div> | ||
<!----> | ||
</div> | ||
<!--v-if--> | ||
</div> | ||
</div> | ||
<div> | ||
<div class=\\"app-type\\">显示图标</div> | ||
<div class=\\"var-cell\\"> | ||
<div class=\\"var-cell__icon\\"><i class=\\"var-icon var-icon--set var-icon-fire var--flex\\" style=\\"transition: transform 0ms;\\"></i></div> | ||
<div class=\\"var-cell__content\\"> | ||
<div class=\\"var-cell__title\\">这是单元格</div> | ||
<!--v-if--> | ||
<div> | ||
<div class=\\"app-type\\">显示图标</div> | ||
<div class=\\"var-cell\\"> | ||
<div class=\\"var-cell__icon\\"><i class=\\"var-icon var--flex var-icon--set var-icon-fire\\" style=\\"transition: transform 0ms;\\"></i></div> | ||
<div class=\\"var-cell__content\\"> | ||
<div class=\\"var-cell__title\\">这是单元格</div> | ||
<!----> | ||
</div> | ||
<div class=\\"var-cell__extra\\"><i class=\\"var-icon var-icon--set var-icon-information\\" style=\\"transition: transform 0ms;\\"></i></div> | ||
</div> | ||
<div class=\\"var-cell__extra\\"><i class=\\"var-icon var-icon--set var-icon-information\\" style=\\"transition: transform 0ms;\\"></i></div> | ||
</div> | ||
<div class=\\"var-cell\\"> | ||
<div class=\\"var-cell__icon\\"><i class=\\"var-icon var-icon--set var-icon-fire var--flex\\" style=\\"transition: transform 0ms;\\"></i></div> | ||
<div class=\\"var-cell__content\\"> | ||
<div class=\\"var-cell__title\\">这是单元格</div> | ||
<!--v-if--> | ||
<div class=\\"var-cell\\"> | ||
<div class=\\"var-cell__icon\\"><i class=\\"var-icon var--flex var-icon--set var-icon-fire\\" style=\\"transition: transform 0ms;\\"></i></div> | ||
<div class=\\"var-cell__content\\"> | ||
<div class=\\"var-cell__title\\">这是单元格</div> | ||
<!----> | ||
</div> | ||
<div class=\\"var-cell__extra\\"><i class=\\"var-icon var-icon--set var-icon-information\\" style=\\"transition: transform 0ms;\\"></i></div> | ||
</div> | ||
<div class=\\"var-cell__extra\\"><i class=\\"var-icon var-icon--set var-icon-information\\" style=\\"transition: transform 0ms;\\"></i></div> | ||
</div> | ||
</div> | ||
<div> | ||
<div class=\\"app-type\\">显示描述</div> | ||
<div class=\\"var-cell\\"> | ||
<div class=\\"var-cell__icon\\"><i class=\\"var-icon var-icon--set var-icon-fire var--flex\\" style=\\"transition: transform 0ms;\\"></i></div> | ||
<div class=\\"var-cell__content\\"> | ||
<div class=\\"var-cell__title\\">这是单元格</div> | ||
<div class=\\"var-cell__desc\\">描述</div> | ||
<div> | ||
<div class=\\"app-type\\">显示描述</div> | ||
<div class=\\"var-cell\\"> | ||
<div class=\\"var-cell__icon\\"><i class=\\"var-icon var--flex var-icon--set var-icon-fire\\" style=\\"transition: transform 0ms;\\"></i></div> | ||
<div class=\\"var-cell__content\\"> | ||
<div class=\\"var-cell__title\\">这是单元格</div> | ||
<div class=\\"var-cell__desc\\"> | ||
描述 | ||
</div> | ||
</div> | ||
<div class=\\"var-cell__extra\\"><i class=\\"var-icon var-icon--set var-icon-information\\" style=\\"transition: transform 0ms;\\"></i></div> | ||
</div> | ||
<div class=\\"var-cell__extra\\"><i class=\\"var-icon var-icon--set var-icon-information\\" style=\\"transition: transform 0ms;\\"></i></div> | ||
</div> | ||
<div class=\\"var-cell\\"> | ||
<!--v-if--> | ||
<div class=\\"var-cell__content\\"> | ||
<div class=\\"var-cell__title\\">这是单元格</div> | ||
<div class=\\"var-cell__desc\\">描述</div> | ||
<div class=\\"var-cell\\"> | ||
<!----> | ||
<div class=\\"var-cell__content\\"> | ||
<div class=\\"var-cell__title\\">这是单元格</div> | ||
<div class=\\"var-cell__desc\\"> | ||
描述 | ||
</div> | ||
</div> | ||
<!----> | ||
</div> | ||
<!--v-if--> | ||
</div> | ||
</div> | ||
<div> | ||
<div class=\\"app-type\\">显示边框</div> | ||
<div class=\\"var-cell var-cell--border\\"> | ||
<!--v-if--> | ||
<div class=\\"var-cell__content\\"> | ||
<div class=\\"var-cell__title\\">这是单元格</div> | ||
<!--v-if--> | ||
<div> | ||
<div class=\\"app-type\\">显示边框</div> | ||
<div class=\\"var-cell var-cell--border\\"> | ||
<!----> | ||
<div class=\\"var-cell__content\\"> | ||
<div class=\\"var-cell__title\\"> 这是单元格 </div> | ||
<!----> | ||
</div> | ||
<!----> | ||
</div> | ||
<!--v-if--> | ||
</div> | ||
<div class=\\"var-cell var-cell--border\\"> | ||
<!--v-if--> | ||
<div class=\\"var-cell__content\\"> | ||
<div class=\\"var-cell__title\\">这是单元格</div> | ||
<!--v-if--> | ||
<div class=\\"var-cell var-cell--border\\"> | ||
<!----> | ||
<div class=\\"var-cell__content\\"> | ||
<div class=\\"var-cell__title\\"> 这是单元格 </div> | ||
<!----> | ||
</div> | ||
<!----> | ||
</div> | ||
<!--v-if--> | ||
</div> | ||
</div>" | ||
`; | ||
exports[`test cell props 1`] = ` | ||
"<div class=\\"var-cell var-cell--border\\"> | ||
<div class=\\"var-cell__icon test-icon-class\\"><i class=\\"var-icon var-icon--set var-icon-fire var--flex\\" style=\\"transition: transform 0ms;\\"></i></div> | ||
<div class=\\"var-cell__icon test-icon-class\\"><i class=\\"var-icon var--flex var-icon--set var-icon-fire\\" style=\\"transition: transform 0ms;\\"></i></div> | ||
<div class=\\"var-cell__content\\"> | ||
<div class=\\"var-cell__title test-title-class\\">This is Cell</div> | ||
<div class=\\"var-cell__desc test-desc-class\\">This is desc</div> | ||
<div class=\\"var-cell__desc test-desc-class\\"> | ||
This is desc | ||
</div> | ||
</div> | ||
<div class=\\"var-cell__extra test-extra-class\\"> | ||
<div>text</div> | ||
</div> | ||
<div class=\\"var-cell__extra test-extra-class\\">text</div> | ||
</div>" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<template> | ||
<div class="var-form"> | ||
<slot /> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { props } from './props' | ||
import { defineComponent } from '../utils/create' | ||
import { ValidationMixin } from '../utils/mixins/validation' | ||
import { createParentMixin } from '../utils/mixins/relation' | ||
export default defineComponent({ | ||
name: 'VarForm', | ||
mixins: [ValidationMixin, createParentMixin('form', { childrenKey: 'formItems' })], | ||
props, | ||
methods: { | ||
// expose | ||
async validate() { | ||
const res = await Promise.all(this.formItems.map(({ validate }) => validate())) | ||
return res.every((r) => r === true) | ||
}, | ||
// expose | ||
reset() { | ||
this.formItems.forEach(({ reset }) => reset()) | ||
}, | ||
// expose | ||
resetValidation() { | ||
this.formItems.forEach(({ resetValidation }) => resetValidation()) | ||
}, | ||
}, | ||
}) | ||
</script> | ||
|
||
<style lang="less"> | ||
@import '../styles/common'; | ||
</style> |
Oops, something went wrong.