vxe-pc-ui 4.9.39 → 4.9.41

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 (47) hide show
  1. package/es/icon/style.css +1 -1
  2. package/es/style.css +1 -1
  3. package/es/style.min.css +1 -1
  4. package/es/tag/src/tag.js +81 -13
  5. package/es/tag/style.css +123 -1
  6. package/es/tag/style.min.css +1 -1
  7. package/es/ui/index.js +4 -1
  8. package/es/ui/src/log.js +1 -1
  9. package/es/vxe-tag/style.css +123 -1
  10. package/es/vxe-tag/style.min.css +1 -1
  11. package/lib/icon/style/style.css +1 -1
  12. package/lib/icon/style/style.min.css +1 -1
  13. package/lib/index.umd.js +90 -13
  14. package/lib/index.umd.min.js +1 -1
  15. package/lib/style.css +1 -1
  16. package/lib/style.min.css +1 -1
  17. package/lib/tag/src/tag.js +85 -11
  18. package/lib/tag/src/tag.min.js +1 -1
  19. package/lib/tag/style/style.css +123 -1
  20. package/lib/tag/style/style.min.css +1 -1
  21. package/lib/ui/index.js +4 -1
  22. package/lib/ui/index.min.js +1 -1
  23. package/lib/ui/src/log.js +1 -1
  24. package/lib/ui/src/log.min.js +1 -1
  25. package/lib/vxe-tag/style/style.css +123 -1
  26. package/lib/vxe-tag/style/style.min.css +1 -1
  27. package/package.json +1 -1
  28. package/packages/tag/src/tag.ts +84 -12
  29. package/packages/ui/index.ts +4 -0
  30. package/styles/components/tag.scss +114 -10
  31. package/types/components/column.d.ts +1 -1
  32. package/types/components/grid.d.ts +1 -1
  33. package/types/components/table.d.ts +2 -2
  34. package/types/components/tag.d.ts +24 -4
  35. package/types/ui/global-icon.d.ts +4 -0
  36. /package/es/icon/{iconfont.1759043297531.ttf → iconfont.1759106680746.ttf} +0 -0
  37. /package/es/icon/{iconfont.1759043297531.woff → iconfont.1759106680746.woff} +0 -0
  38. /package/es/icon/{iconfont.1759043297531.woff2 → iconfont.1759106680746.woff2} +0 -0
  39. /package/es/{iconfont.1759043297531.ttf → iconfont.1759106680746.ttf} +0 -0
  40. /package/es/{iconfont.1759043297531.woff → iconfont.1759106680746.woff} +0 -0
  41. /package/es/{iconfont.1759043297531.woff2 → iconfont.1759106680746.woff2} +0 -0
  42. /package/lib/icon/style/{iconfont.1759043297531.ttf → iconfont.1759106680746.ttf} +0 -0
  43. /package/lib/icon/style/{iconfont.1759043297531.woff → iconfont.1759106680746.woff} +0 -0
  44. /package/lib/icon/style/{iconfont.1759043297531.woff2 → iconfont.1759106680746.woff2} +0 -0
  45. /package/lib/{iconfont.1759043297531.ttf → iconfont.1759106680746.ttf} +0 -0
  46. /package/lib/{iconfont.1759043297531.woff → iconfont.1759106680746.woff} +0 -0
  47. /package/lib/{iconfont.1759043297531.woff2 → iconfont.1759106680746.woff2} +0 -0
@@ -1,26 +1,46 @@
1
- import { ref, h, reactive, PropType } from 'vue'
1
+ import { ref, h, reactive, PropType, watch } from 'vue'
2
2
  import { defineVxeComponent } from '../../ui/src/comp'
3
3
  import XEUtils from 'xe-utils'
4
- import { getConfig, createEvent, useSize, renderEmptyElement } from '../../ui'
5
- import { getSlotVNs } from '../../ui/src/vn'
4
+ import { getConfig, getIcon, createEvent, useSize, renderEmptyElement } from '../../ui'
6
5
 
7
6
  import type { VxeTagPropTypes, TagReactData, TagPrivateRef, VxeTagEmits, VxeTagPrivateComputed, TagMethods, TagPrivateMethods, VxeTagConstructor, VxeTagPrivateMethods, ValueOf } from '../../../types'
8
7
 
9
8
  export default defineVxeComponent({
10
9
  name: 'VxeTag',
11
10
  props: {
11
+ border: {
12
+ type: Boolean as PropType<VxeTagPropTypes.Border>,
13
+ default: () => getConfig().tag.border
14
+ },
15
+ visible: {
16
+ type: Boolean as PropType<VxeTagPropTypes.Visible>,
17
+ default: null
18
+ },
12
19
  status: String as PropType<VxeTagPropTypes.Status>,
13
20
  title: [String, Number] as PropType<VxeTagPropTypes.Title>,
14
21
  icon: String as PropType<VxeTagPropTypes.Icon>,
22
+ closeIcon: {
23
+ type: String as PropType<VxeTagPropTypes.CloseIcon>,
24
+ default: () => getConfig().tag.closeIcon
25
+ },
15
26
  content: [String, Number] as PropType<VxeTagPropTypes.Content>,
16
27
  round: Boolean as PropType<VxeTagPropTypes.Round>,
28
+ closable: {
29
+ type: Boolean as PropType<VxeTagPropTypes.Closable>,
30
+ default: () => getConfig().tag.closable
31
+ },
32
+ color: String as PropType<VxeTagPropTypes.Color>,
33
+ loading: Boolean as PropType<VxeTagPropTypes.Loading>,
17
34
  size: {
18
35
  type: String as PropType<VxeTagPropTypes.Size>,
19
36
  default: () => getConfig().tag.size || getConfig().size
20
37
  }
21
38
  },
22
39
  emits: [
23
- 'click'
40
+ 'click',
41
+ 'dblclick',
42
+ 'close',
43
+ 'update:visible'
24
44
  ] as VxeTagEmits,
25
45
  setup (props, context) {
26
46
  const { slots, emit } = context
@@ -32,6 +52,7 @@ export default defineVxeComponent({
32
52
  const refElem = ref<HTMLDivElement>()
33
53
 
34
54
  const reactData = reactive<TagReactData>({
55
+ showTag: props.visible !== false
35
56
  })
36
57
 
37
58
  const refMaps: TagPrivateRef = {
@@ -62,22 +83,47 @@ export default defineVxeComponent({
62
83
  const tagPrivateMethods: TagPrivateMethods = {
63
84
  }
64
85
 
86
+ const updateVisible = () => {
87
+ reactData.showTag = props.visible !== false
88
+ }
89
+
65
90
  const clickEvent = (evnt: MouseEvent) => {
66
- dispatchEvent('click', {}, evnt)
91
+ const { loading } = props
92
+ if (!loading) {
93
+ dispatchEvent('click', {}, evnt)
94
+ }
95
+ }
96
+
97
+ const dblclickEvent = (evnt: MouseEvent) => {
98
+ const { loading } = props
99
+ if (!loading) {
100
+ dispatchEvent('dblclick', {}, evnt)
101
+ }
102
+ }
103
+
104
+ const closeEvent = (evnt: MouseEvent) => {
105
+ const { loading } = props
106
+ if (!loading) {
107
+ const visible = !reactData.showTag
108
+ reactData.showTag = visible
109
+ emit('update:visible', visible)
110
+ dispatchEvent('close', { visible }, evnt)
111
+ }
67
112
  }
68
113
 
69
114
  Object.assign($xeTag, tagMethods, tagPrivateMethods)
70
115
 
71
116
  const renderContent = () => {
72
- const { icon, content } = props
117
+ const { icon, content, closable, closeIcon, loading } = props
73
118
  const defaultSlot = slots.default
74
119
  const iconSlot = slots.icon
120
+ const closeIconSlot = slots.closeIcon || slots['close-icon']
75
121
  return [
76
122
  iconSlot || icon
77
123
  ? h('span', {
78
124
  class: 'vxe-tag--icon'
79
125
  }, iconSlot
80
- ? getSlotVNs(iconSlot({}))
126
+ ? iconSlot({})
81
127
  : [
82
128
  h('i', {
83
129
  class: icon
@@ -86,25 +132,51 @@ export default defineVxeComponent({
86
132
  : renderEmptyElement($xeTag),
87
133
  h('span', {
88
134
  class: 'vxe-tag--content'
89
- }, defaultSlot ? defaultSlot({}) : XEUtils.toValueString(content))
135
+ }, defaultSlot ? defaultSlot({}) : XEUtils.toValueString(content)),
136
+ loading || closable
137
+ ? h('span', {
138
+ class: loading ? 'vxe-tag--loading' : 'vxe-tag--close',
139
+ onClick: closeEvent
140
+ }, !loading && closeIconSlot
141
+ ? closeIconSlot({})
142
+ : [
143
+ h('i', {
144
+ class: loading ? getIcon().TAG_LOADING : (closeIcon || getIcon().TAG_CLOSE)
145
+ })
146
+ ])
147
+ : renderEmptyElement($xeTag)
90
148
  ]
91
149
  }
92
150
 
93
151
  const renderVN = () => {
94
- const { status, title, round } = props
152
+ const { status, color, title, round, border, loading } = props
153
+ const { showTag } = reactData
95
154
  const vSize = computeSize.value
155
+ if (!showTag) {
156
+ return renderEmptyElement($xeTag)
157
+ }
96
158
  return h('span', {
97
159
  ref: refElem,
98
160
  class: ['vxe-tag', {
99
161
  [`size--${vSize}`]: vSize,
100
- [`theme--${status}`]: status,
101
- 'is--round': round
162
+ [`theme--${status}`]: status && !color,
163
+ [`color--${color}`]: color && !status,
164
+ 'is--round': round,
165
+ 'is--border': border,
166
+ 'is--loading': loading
102
167
  }],
103
168
  title,
104
- onClick: clickEvent
169
+ onClick: clickEvent,
170
+ onDblclick: dblclickEvent
105
171
  }, renderContent())
106
172
  }
107
173
 
174
+ watch(() => props.visible, () => {
175
+ updateVisible()
176
+ })
177
+
178
+ updateVisible()
179
+
108
180
  $xeTag.renderVN = renderVN
109
181
 
110
182
  return $xeTag
@@ -608,6 +608,10 @@ setIcon({
608
608
  TEXT_COPY: iconPrefix + 'copy',
609
609
  TEXT_LOADING: iconPrefix + 'spinner roll',
610
610
 
611
+ // tag
612
+ TAG_CLOSE: iconPrefix + 'close',
613
+ TAG_LOADING: iconPrefix + 'spinner roll',
614
+
611
615
  // carousel
612
616
  CAROUSEL_HORIZONTAL_PREVIOUS: iconPrefix + 'arrow-left',
613
617
  CAROUSEL_HORIZONTAL_NEXT: iconPrefix + 'arrow-right',
@@ -1,50 +1,119 @@
1
1
  @use "sass:map";
2
2
  @use "sass:list";
3
3
 
4
- $tagsThemeList: (
4
+ $tagThemeList: (
5
5
  (
6
6
  name: "primary",
7
7
  textColor: var(--vxe-ui-font-primary-color),
8
- bgColor: var(--vxe-ui-font-primary-tinge-color)
8
+ bgColor: var(--vxe-ui-font-primary-tinge-color),
9
+ brColor: var(--vxe-ui-font-primary-lighten-color),
10
+ btnBgColor: var(--vxe-ui-font-primary-darken-color)
9
11
  ),
10
12
  (
11
13
  name: "success",
12
14
  textColor: var(--vxe-ui-status-success-color),
13
- bgColor: var(--vxe-ui-status-success-tinge-color)
15
+ bgColor: var(--vxe-ui-status-success-tinge-color),
16
+ brColor: var(--vxe-ui-status-success-lighten-color),
17
+ btnBgColor: var(--vxe-ui-status-success-darken-color)
14
18
  ),
15
19
  (
16
20
  name: "info",
17
21
  textColor: var(--vxe-ui-status-info-color),
18
- bgColor: var(--vxe-ui-status-info-tinge-color)
22
+ bgColor: var(--vxe-ui-status-info-tinge-color),
23
+ brColor: var(--vxe-ui-status-info-lighten-color),
24
+ btnBgColor: var(--vxe-ui-status-info-darken-color)
19
25
  ),
20
26
  (
21
27
  name: "warning",
22
28
  textColor: var(--vxe-ui-status-warning-color),
23
- bgColor: var(--vxe-ui-status-warning-tinge-color)
29
+ bgColor: var(--vxe-ui-status-warning-tinge-color),
30
+ brColor: var(--vxe-ui-status-warning-lighten-color),
31
+ btnBgColor: var(--vxe-ui-status-warning-darken-color)
24
32
  ),
25
33
  (
26
34
  name: "danger",
27
35
  textColor: var(--vxe-ui-status-danger-color),
28
- bgColor: var(--vxe-ui-status-danger-tinge-color)
36
+ bgColor: var(--vxe-ui-status-danger-tinge-color),
37
+ brColor: var(--vxe-ui-status-danger-lighten-color),
38
+ btnBgColor: var(--vxe-ui-status-danger-darken-color)
29
39
  ),
30
40
  (
31
41
  name: "error",
32
42
  textColor: var(--vxe-ui-status-error-color),
33
- bgColor: var(--vxe-ui-status-error-tinge-color)
43
+ bgColor: var(--vxe-ui-status-error-tinge-color),
44
+ brColor: var(--vxe-ui-status-error-lighten-color),
45
+ btnBgColor: var(--vxe-ui-status-error-darken-color)
34
46
  )
35
47
  );
36
48
 
37
49
  .vxe-tag {
38
- padding: var(--vxe-ui-layout-padding-half) var(--vxe-ui-layout-padding-default);
50
+ &.color--gray {
51
+ color: #827d7d;
52
+ background-color: #f3f3f3;
53
+ }
54
+ &.color--orangered {
55
+ color: #877568;
56
+ background-color: #f4e9e1;
57
+ }
58
+ &.color--orange {
59
+ color: #9a9079;
60
+ background-color: #fff8e8;
61
+ }
62
+ &.color--green {
63
+ color: #627865;
64
+ background-color: #e7ffea;
65
+ }
66
+ &.color--blue {
67
+ color: #6b7b82;
68
+ background-color: #e8f8ff;
69
+ }
70
+ &.color--purple {
71
+ color: #8f7e97;
72
+ background-color: #f8e8ff;
73
+ }
74
+ &.color--pinkpurple {
75
+ color: #82687a;
76
+ background-color: #ffe8f8;
77
+ }
78
+ &.color--magenta {
79
+ color: #846084;
80
+ background-color: #f4c9f4;
81
+ }
82
+ &.color--chocolate {
83
+ color: #7f6e61;
84
+ background-color: #f7e2d2;
85
+ }
86
+ &.color--cyan {
87
+ color: #577474;
88
+ background-color: #d7f7f7;
89
+ }
90
+ }
91
+
92
+ .vxe-tag {
93
+ display: inline-flex;
94
+ flex-direction: row;
95
+ align-items: center;
96
+ padding: 0.25em 0.5em;
39
97
  color: var(--vxe-ui-font-color);
40
98
  border-radius: var(--vxe-ui-base-border-radius);
41
- @for $index from 0 to list.length($tagsThemeList) {
42
- $item: list.nth($tagsThemeList, $index + 1);
99
+ @for $index from 0 to list.length($tagThemeList) {
100
+ $item: list.nth($tagThemeList, $index + 1);
43
101
  &.theme--#{map.get($item, name)} {
44
102
  color: map.get($item, textColor);
45
103
  background-color: map.get($item, bgColor);
104
+ &.is--border {
105
+ border-color: map.get($item, brColor);
106
+ }
107
+ & > .vxe-tag--close {
108
+ &:hover {
109
+ background-color: map.get($item, btnBgColor);
110
+ }
111
+ }
46
112
  }
47
113
  }
114
+ &.is--border {
115
+ border: 1px solid var(--vxe-ui-font-lighten-color);
116
+ }
48
117
  &.is--round {
49
118
  border-radius: 1em;
50
119
  }
@@ -67,6 +136,41 @@ $tagsThemeList: (
67
136
  .vxe-tag--content {
68
137
  padding: 0 0.1em;
69
138
  }
139
+ .vxe-tag--icon,
140
+ .vxe-tag--loading {
141
+ & > i {
142
+ font-size: 1em;
143
+ line-height: 1em;
144
+ }
145
+ }
146
+ .vxe-tag--close,
147
+ .vxe-tag--loading {
148
+ display: inline-flex;
149
+ align-items: center;
150
+ justify-content: center;
151
+ padding: 0.1em 0;
152
+ border-radius: 50%;
153
+ width: 1.2em;
154
+ height: 1.2em;
155
+ line-height: 1em;
156
+ }
157
+ .vxe-tag--close {
158
+ transition: all 0.3s;
159
+ &:hover {
160
+ color: #fff;
161
+ background-color: var(--vxe-ui-font-darken-color);
162
+ }
163
+ & > i {
164
+ font-size: 0.7em;
165
+ line-height: 0.7em;
166
+ }
167
+ cursor: pointer;
168
+ }
169
+ .vxe-tag--icon,
170
+ .vxe-tag--close,
171
+ .vxe-tag--loading {
172
+ user-select: none;
173
+ }
70
174
 
71
175
  .vxe-tag {
72
176
  &.size--medium {
@@ -653,7 +653,7 @@ export namespace VxeColumnSlotTypes {
653
653
  columnIndex: number
654
654
  $columnIndex: number
655
655
  $rowIndex: number
656
- option: VxeColumnPropTypes.FilterItem | null
656
+ option: VxeColumnPropTypes.FilterItem
657
657
  }
658
658
  export interface FloatingFilterSlotParams<D = any> extends VxeTableDefines.CellFloatingFilterParams<D> { }
659
659
 
@@ -852,7 +852,7 @@ export namespace VxeGridSlotTypes {
852
852
  */
853
853
  _columnIndex: number
854
854
 
855
- option: VxeColumnPropTypes.FilterItem | null
855
+ option: VxeColumnPropTypes.FilterItem
856
856
 
857
857
  type: string
858
858
  fixed: VxeColumnPropTypes.Fixed
@@ -5708,7 +5708,7 @@ export namespace VxeTableDefines {
5708
5708
  type: string
5709
5709
  isHidden: boolean
5710
5710
  hasFilter: boolean
5711
- option: VxeColumnPropTypes.FilterItem | null
5711
+ option: VxeColumnPropTypes.FilterItem
5712
5712
  }
5713
5713
 
5714
5714
  export interface CellRenderHeaderParams<D = any> {
@@ -5724,7 +5724,7 @@ export namespace VxeTableDefines {
5724
5724
  type: string
5725
5725
  isHidden: boolean
5726
5726
  hasFilter: boolean
5727
- firstFilterOption: VxeColumnPropTypes.FilterItem | null
5727
+ firstFilterOption: VxeColumnPropTypes.FilterItem
5728
5728
 
5729
5729
  checked?: boolean
5730
5730
  indeterminate?: boolean
@@ -23,21 +23,33 @@ export interface TagPrivateRef {
23
23
  export interface VxeTagPrivateRef extends TagPrivateRef { }
24
24
 
25
25
  export namespace VxeTagPropTypes {
26
+ export type Border = boolean
26
27
  export type Status = VxeComponentStatusType
28
+ export type Visible = boolean
27
29
  export type Title = string | number
28
30
  export type Icon = string
31
+ export type CloseIcon = string
29
32
  export type Content = string | number
30
33
  export type Round = boolean
31
34
  export type Size = VxeComponentSizeType
35
+ export type Closable = boolean
36
+ export type Color = 'gray' | 'orangered' | 'orange' | 'green' | 'blue' | 'purple' | 'pinkpurple' | 'magenta' | 'chocolate' | 'cyan'
37
+ export type Loading = boolean
32
38
  }
33
39
 
34
40
  export type VxeTagProps = {
41
+ border?: VxeTagPropTypes.Border
35
42
  status?: VxeTagPropTypes.Status
43
+ visible?: VxeTagPropTypes.Visible
36
44
  title?: VxeTagPropTypes.Title
37
45
  icon?: VxeTagPropTypes.Icon
46
+ closeIcon?: VxeTagPropTypes.CloseIcon
38
47
  content?: VxeTagPropTypes.Content
39
48
  round?: VxeTagPropTypes.Round
40
49
  size?: VxeTagPropTypes.Size
50
+ closable?: VxeTagPropTypes.Closable
51
+ color?: VxeTagPropTypes.Color
52
+ loading?: VxeTagPropTypes.Loading
41
53
  }
42
54
 
43
55
  export interface TagPrivateComputed {
@@ -45,6 +57,7 @@ export interface TagPrivateComputed {
45
57
  export interface VxeTagPrivateComputed extends TagPrivateComputed { }
46
58
 
47
59
  export interface TagReactData {
60
+ showTag: boolean
48
61
  }
49
62
 
50
63
  export interface TagMethods {
@@ -56,7 +69,10 @@ export interface TagPrivateMethods { }
56
69
  export interface VxeTagPrivateMethods extends TagPrivateMethods { }
57
70
 
58
71
  export type VxeTagEmits = [
59
- 'click'
72
+ 'click',
73
+ 'dblclick',
74
+ 'close',
75
+ 'update:visible'
60
76
  ]
61
77
 
62
78
  export namespace VxeTagDefines {
@@ -64,21 +80,23 @@ export namespace VxeTagDefines {
64
80
  $tag: VxeTagConstructor
65
81
  }
66
82
 
67
- export interface ClickParams {
68
- }
69
- export interface ClickEventParams extends TagEventParams, ClickParams { }
83
+ export interface ClickEventParams extends TagEventParams { }
84
+ export interface CloseEventParams extends TagEventParams { }
70
85
  }
71
86
 
72
87
  export type VxeTagEventProps = {
73
88
  onClick?: VxeTagEvents.Click
89
+ onClose?: VxeTagEvents.Close
74
90
  }
75
91
 
76
92
  export interface VxeTagListeners {
77
93
  click?: VxeTagEvents.Click
94
+ close?: VxeTagEvents.Close
78
95
  }
79
96
 
80
97
  export namespace VxeTagEvents {
81
98
  export type Click = (params: VxeTagDefines.ClickEventParams) => void
99
+ export type Close = (params: VxeTagDefines.CloseEventParams) => void
82
100
  }
83
101
 
84
102
  export namespace VxeTagSlotTypes {
@@ -88,6 +106,8 @@ export namespace VxeTagSlotTypes {
88
106
  export interface VxeTagSlots {
89
107
  default?: (params: VxeTagSlotTypes.DefaultSlotParams) => any
90
108
  icon?: (params: VxeTagSlotTypes.DefaultSlotParams) => any
109
+ closeIcon?: (params: VxeTagSlotTypes.DefaultSlotParams) => any
110
+ 'close-icon'?: (params: VxeTagSlotTypes.DefaultSlotParams) => any
91
111
  }
92
112
 
93
113
  export const Tag: typeof VxeTag
@@ -229,6 +229,10 @@ declare module '@vxe-ui/core' {
229
229
  TEXT_COPY?: string
230
230
  TEXT_LOADING?: string
231
231
 
232
+ // tag
233
+ TAG_CLOSE?: string
234
+ TAG_LOADING?: string
235
+
232
236
  // carousel
233
237
  CAROUSEL_HORIZONTAL_PREVIOUS?: string
234
238
  CAROUSEL_HORIZONTAL_NEXT?: string