Skip to content

Commit

Permalink
refactor!: use theme prop instead of theme:d22 ui, and add back prefi…
Browse files Browse the repository at this point in the history
…x mixin
  • Loading branch information
Justineo committed Dec 13, 2023
1 parent 5788c0b commit 53c7de7
Show file tree
Hide file tree
Showing 110 changed files with 393 additions and 254 deletions.
7 changes: 2 additions & 5 deletions packages/veui/demo/cases/ConfigProvider.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@
</veui-config-provider>
</section>
<section class="case">
<veui-collapse
expanded
label="UI theme"
:ui="contextValue.theme ? `theme:${contextValue.theme}` : 'theme:d20'"
>
<veui-collapse expanded label="UI theme" :theme="contextValue.theme">
<veui-stack gap="xs">
<veui-input clearable/>
<veui-button ui="primary">OK</veui-button>
Expand Down Expand Up @@ -172,6 +168,7 @@ export default {
{ label: '全中有高亮', value: 'all_h' }
],
themes: [
{ label: '不设置', value: undefined },
{ label: 'D20', value: '' },
{ label: 'D22', value: 'd22' },
{ label: 'AI', value: 'ai' }
Expand Down
3 changes: 2 additions & 1 deletion packages/veui/src/components/Accordion.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<script>
import ui from '../mixins/ui'
import { useParent } from '../mixins/coupled'
import prefix from '../mixins/prefix'
import useControllable from '../mixins/controllable'
import { clone } from 'lodash'
import { togglePositionProp } from './Collapse'
Expand All @@ -19,7 +20,7 @@ let accordion = useParent('accordion', 'accordion-item', {
export default {
name: 'veui-accordion',
uiTypes: ['accordion'],
mixins: [ui, accordion, useControllable(['expanded'])],
mixins: [prefix, ui, accordion, useControllable(['expanded'])],
props: {
multiple: Boolean,
disabled: Boolean,
Expand Down
2 changes: 2 additions & 0 deletions packages/veui/src/components/Alert.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ import Icon from './Icon'
import Button from './Button'
import ui from '../mixins/ui'
import i18n from '../mixins/i18n'
import prefix from '../mixins/prefix'
import useControllable from '../mixins/controllable'
import { useRename } from '../mixins/deprecate'
import '../common/global'
Expand All @@ -106,6 +107,7 @@ export default {
'veui-button': Button
},
mixins: [
prefix,
ui,
i18n,
useControllable(['open', 'index']),
Expand Down
2 changes: 2 additions & 0 deletions packages/veui/src/components/AlertBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import useConfig from '../mixins/config'
import config from '../managers/config'
import ui from '../mixins/ui'
import i18n from '../mixins/i18n'
import prefix from '../mixins/prefix'
import overlay from '../mixins/overlay'
import useControllable from '../mixins/controllable'
import { useRename } from '../mixins/deprecate'
Expand All @@ -73,6 +74,7 @@ export default {
'veui-icon': Icon
},
mixins: [
prefix,
ui,
overlay,
i18n,
Expand Down
3 changes: 2 additions & 1 deletion packages/veui/src/components/Anchor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import Tree from './Tree'
import Link from './Link'
import ui from '../mixins/ui'
import prefix from '../mixins/prefix'
import { debounce, reduce, startsWith, includes, get } from 'lodash'
import {
scrollToAlign,
Expand Down Expand Up @@ -96,7 +97,7 @@ export default {
'veui-tree': Tree,
'veui-link': Link
},
mixins: [ui],
mixins: [prefix, ui],
props: {
items: Tree.props.datasource,
sticky: Boolean,
Expand Down
5 changes: 3 additions & 2 deletions packages/veui/src/components/Autocomplete/Autocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
:separator-class="
$c('autocomplete-search-result-item-separator')
"
:theme-variant="uiThemeVariant"
:theme-variant="themeVariant"
/>
<span v-else>{{ props.label }}</span>
</slot>
Expand All @@ -78,6 +78,7 @@
</template>

<script>
import prefix from '../../mixins/prefix'
import ui from '../../mixins/ui'
import input from '../../mixins/input'
import { useStrict } from '../../mixins/strict'
Expand Down Expand Up @@ -114,7 +115,7 @@ export default {
'veui-option-group': OptionGroup
},
directives: { outside },
mixins: [ui, input, overlay, useStrict(['maxlength', 'select'])],
mixins: [prefix, ui, input, overlay, useStrict(['maxlength', 'select'])],
inheritAttrs: false,
props: {
suggestTrigger: {
Expand Down
2 changes: 2 additions & 0 deletions packages/veui/src/components/Badge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
</template>

<script>
import prefix from '../mixins/prefix'
import ui from '../mixins/ui'
import { isNumber } from 'lodash'
import config from '../managers/config'
Expand All @@ -45,6 +46,7 @@ config.defaults(
export default {
name: 'veui-badge',
mixins: [
prefix,
ui,
useConfig('config', 'badge'),
useRename(
Expand Down
3 changes: 2 additions & 1 deletion packages/veui/src/components/Breadcrumb.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<script>
import BreadcrumbItem from './BreadcrumbItem'
import prefix from '../mixins/prefix'
import ui from '../mixins/ui'
import '../common/global'
export default {
name: 'veui-breadcrumb',
mixins: [ui],
mixins: [prefix, ui],
props: {
routes: {
type: Array,
Expand Down
3 changes: 2 additions & 1 deletion packages/veui/src/components/BreadcrumbItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

<script>
import { includes } from 'lodash'
import prefix from '../mixins/prefix'
import ui from '../mixins/ui'
import Link from './Link'
import Icon from './Icon'
Expand All @@ -37,7 +38,7 @@ export default {
'veui-link': Link,
'veui-icon': Icon
},
mixins: [ui],
mixins: [prefix, ui],
props: {
to: [String, Object],
// TODO: 提供replace这个属性缺少实际use case?
Expand Down
3 changes: 2 additions & 1 deletion packages/veui/src/components/Button.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script>
import Icon from './Icon'
import Loading from './Loading'
import prefix from '../mixins/prefix'
import ui from '../mixins/ui'
import focusable from '../mixins/focusable'
import '../common/global'
Expand All @@ -21,7 +22,7 @@ export default {
components: {
'veui-icon': Icon
},
mixins: [ui, focusable],
mixins: [prefix, ui, focusable],
inheritAttrs: false,
props: {
disabled: Boolean,
Expand Down
3 changes: 2 additions & 1 deletion packages/veui/src/components/ButtonGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

<script>
import Button from './Button'
import prefix from '../mixins/prefix'
import ui from '../mixins/ui'
import focusable from '../mixins/focusable'
import { focusIn } from '../utils/dom'
Expand All @@ -37,7 +38,7 @@ export default {
components: {
'veui-button': Button
},
mixins: [ui, focusable],
mixins: [prefix, ui, focusable],
props: {
items: {
type: Array,
Expand Down
2 changes: 2 additions & 0 deletions packages/veui/src/components/Calendar/Calendar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ import {
isEqual,
isNumber
} from 'lodash'
import prefix from '../../mixins/prefix'
import ui from '../../mixins/ui'
import input from '../../mixins/input'
import useControllable from '../../mixins/controllable'
Expand Down Expand Up @@ -360,6 +361,7 @@ export default {
InfiniteScroll
},
mixins: [
prefix,
ui,
input,
i18n,
Expand Down
3 changes: 2 additions & 1 deletion packages/veui/src/components/Carousel/Carousel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ import Icon from '../Icon'
import Indicator from './_Indicator'
import Slide, { props as slideProps } from './_Slide'
import Fade from './_Fade'
import prefix from '../../mixins/prefix'
import ui from '../../mixins/ui'
import i18n from '../../mixins/i18n'
import carousel from '../../mixins/carousel'
Expand All @@ -120,7 +121,7 @@ export default {
'veui-carousel-fade': Fade,
'veui-carousel-slide': Slide
},
mixins: [ui, i18n, carousel],
mixins: [prefix, ui, i18n, carousel],
props: {
indicator: {
type: String,
Expand Down
5 changes: 2 additions & 3 deletions packages/veui/src/components/Carousel/_Indicator.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@
</template>

<script>
import ui from '../../mixins/ui'
import prefix from '../../mixins/prefix'
export default {
name: 'veui-carousel-indicator',
uiTypes: ['transparent'],
mixins: [ui],
mixins: [prefix],
props: {
type: String,
labels: Array,
Expand Down
1 change: 0 additions & 1 deletion packages/veui/src/components/Carousel/_Slide.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ export const props = {
export default {
name: 'veui-carousel-slide',
uiTypes: ['transparent'],
mixins: [carousel],
props,
data () {
Expand Down
4 changes: 2 additions & 2 deletions packages/veui/src/components/Carousel/_mixin.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import ui from '../../mixins/ui'
import prefix from '../../mixins/prefix'
import { get, noop } from 'lodash'

export const CUSTOM_GUTTER = '--dls-carousel-slide-gutter'
export const FALLBACK_GUTTER = '24px'

export default {
mixins: [ui],
mixins: [prefix],
props: {
slideAspectRatio: [String, Number],
options: Object,
Expand Down
4 changes: 3 additions & 1 deletion packages/veui/src/components/Cascader/Cascader.vue
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
:matches="option.matches"
:separator="icons.separator"
:separator-class="$c('cascader-search-result-item-separator')"
:theme-variant="uiThemeVariant"
:theme-variant="themeVariant"
/>
</template>
<template
Expand Down Expand Up @@ -144,6 +144,7 @@ import useConfig from '../../mixins/config'
import dropdown from '../../mixins/dropdown'
import useControllable from '../../mixins/controllable'
import useSearchable, { getDefaultFilter } from '../../mixins/searchable'
import prefix from '../../mixins/prefix'
import i18n from '../../mixins/i18n'
import useTree from '../../mixins/tree'
import input from '../../mixins/input'
Expand Down Expand Up @@ -180,6 +181,7 @@ export default {
'veui-select-trigger': SelectTrigger
},
mixins: [
prefix,
ui,
i18n,
dropdown(),
Expand Down
2 changes: 2 additions & 0 deletions packages/veui/src/components/Cascader/CascaderPane.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ import Checkbox from '../Checkbox'
import Icon from '../Icon'
import Button from '../Button'
import Loading from '../Loading'
import prefix from '../../mixins/prefix'
import ui from '../../mixins/ui'
import keySelect from '../../mixins/key-select'
import useControllable from '../../mixins/controllable'
Expand Down Expand Up @@ -175,6 +176,7 @@ export default {
outside
},
mixins: [
prefix,
ui,
keySelect,
useControllable([
Expand Down
2 changes: 2 additions & 0 deletions packages/veui/src/components/CheckButtonGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
</template>

<script>
import prefix from '../mixins/prefix'
import ui from '../mixins/ui'
import input from '../mixins/input'
import { focusIn } from '../utils/dom'
Expand All @@ -69,6 +70,7 @@ export default {
'veui-popover': Popover
},
mixins: [
prefix,
ui,
input,
useControllable({
Expand Down
2 changes: 2 additions & 0 deletions packages/veui/src/components/Checkbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<script>
import { pick, includes, pull } from 'lodash'
import Icon from './Icon'
import prefix from '../mixins/prefix'
import ui from '../mixins/ui'
import input from '../mixins/input'
import useControllable from '../mixins/controllable'
Expand All @@ -58,6 +59,7 @@ export default {
'veui-icon': Icon
},
mixins: [
prefix,
ui,
input,
focusable,
Expand Down
2 changes: 2 additions & 0 deletions packages/veui/src/components/CheckboxGroup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
</template>

<script>
import prefix from '../mixins/prefix'
import ui from '../mixins/ui'
import input from '../mixins/input'
import { focusIn } from '../utils/dom'
Expand All @@ -59,6 +60,7 @@ export default {
'veui-popover': Popover
},
mixins: [
prefix,
ui,
input,
useControllable({
Expand Down
2 changes: 2 additions & 0 deletions packages/veui/src/components/Collapse.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import Icon from './Icon'
import ExpandTransition from './_ExpandTransition'
import ui from '../mixins/ui'
import { useChild } from '../mixins/coupled'
import prefix from '../mixins/prefix'
import useControllable from '../mixins/controllable'
import '../common/global'
Expand All @@ -63,6 +64,7 @@ export default {
'veui-expand-transition': ExpandTransition
},
mixins: [
prefix,
ui,
accordionItem,
useControllable({
Expand Down
2 changes: 2 additions & 0 deletions packages/veui/src/components/ConfirmBox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import { pick } from 'lodash'
import Dialog from './Dialog'
import config from '../managers/config'
import useConfig from '../mixins/config'
import prefix from '../mixins/prefix'
import ui from '../mixins/ui'
import overlay from '../mixins/overlay'
import useControllable from '../mixins/controllable'
Expand All @@ -51,6 +52,7 @@ export default {
'veui-dialog': Dialog
},
mixins: [
prefix,
ui,
overlay,
useControllable(['open']),
Expand Down
Loading

0 comments on commit 53c7de7

Please sign in to comment.