vxe-pc-ui 3.9.39 → 3.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 +95 -11
  5. package/es/tag/style.css +124 -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 +124 -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 +101 -11
  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 +96 -9
  18. package/lib/tag/src/tag.min.js +1 -1
  19. package/lib/tag/style/style.css +124 -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 +124 -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 +98 -10
  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 +25 -5
  35. package/types/ui/global-icon.d.ts +4 -0
  36. /package/es/icon/{iconfont.1759043301314.ttf → iconfont.1759106678167.ttf} +0 -0
  37. /package/es/icon/{iconfont.1759043301314.woff → iconfont.1759106678167.woff} +0 -0
  38. /package/es/icon/{iconfont.1759043301314.woff2 → iconfont.1759106678167.woff2} +0 -0
  39. /package/es/{iconfont.1759043301314.ttf → iconfont.1759106678167.ttf} +0 -0
  40. /package/es/{iconfont.1759043301314.woff → iconfont.1759106678167.woff} +0 -0
  41. /package/es/{iconfont.1759043301314.woff2 → iconfont.1759106678167.woff2} +0 -0
  42. /package/lib/icon/style/{iconfont.1759043301314.ttf → iconfont.1759106678167.ttf} +0 -0
  43. /package/lib/icon/style/{iconfont.1759043301314.woff → iconfont.1759106678167.woff} +0 -0
  44. /package/lib/icon/style/{iconfont.1759043301314.woff2 → iconfont.1759106678167.woff2} +0 -0
  45. /package/lib/{iconfont.1759043301314.ttf → iconfont.1759106678167.ttf} +0 -0
  46. /package/lib/{iconfont.1759043301314.woff → iconfont.1759106678167.woff} +0 -0
  47. /package/lib/{iconfont.1759043301314.woff2 → iconfont.1759106678167.woff2} +0 -0
@@ -1,8 +1,7 @@
1
1
  import { PropType, CreateElement, VNode } from 'vue'
2
2
  import { defineVxeComponent } from '../../ui/src/comp'
3
3
  import XEUtils from 'xe-utils'
4
- import { getConfig, createEvent, globalMixins, renderEmptyElement } from '../../ui'
5
- import { getSlotVNs } from '../../ui/src/vn'
4
+ import { getConfig, getIcon, createEvent, globalMixins, renderEmptyElement } from '../../ui'
6
5
 
7
6
  import type { VxeTagPropTypes, TagReactData, VxeTagEmits, VxeComponentPermissionInfo, VxeComponentSizeType, ValueOf } from '../../../types'
8
7
 
@@ -13,11 +12,29 @@ export default /* define-vxe-component start */ defineVxeComponent({
13
12
  globalMixins.permissionMixin
14
13
  ],
15
14
  props: {
15
+ border: {
16
+ type: Boolean as PropType<VxeTagPropTypes.Border>,
17
+ default: () => getConfig().tag.border
18
+ },
19
+ visible: {
20
+ type: Boolean as PropType<VxeTagPropTypes.Visible>,
21
+ default: null
22
+ },
16
23
  status: String as PropType<VxeTagPropTypes.Status>,
17
24
  title: [String, Number] as PropType<VxeTagPropTypes.Title>,
18
25
  icon: String as PropType<VxeTagPropTypes.Icon>,
26
+ closeIcon: {
27
+ type: String as PropType<VxeTagPropTypes.CloseIcon>,
28
+ default: () => getConfig().tag.closeIcon
29
+ },
19
30
  content: [String, Number] as PropType<VxeTagPropTypes.Content>,
20
31
  round: Boolean as PropType<VxeTagPropTypes.Round>,
32
+ closable: {
33
+ type: Boolean as PropType<VxeTagPropTypes.Closable>,
34
+ default: () => getConfig().tag.closable
35
+ },
36
+ color: String as PropType<VxeTagPropTypes.Color>,
37
+ loading: Boolean as PropType<VxeTagPropTypes.Loading>,
21
38
  size: {
22
39
  type: String as PropType<VxeTagPropTypes.Size>,
23
40
  default: () => getConfig().tag.size || getConfig().size
@@ -25,6 +42,7 @@ export default /* define-vxe-component start */ defineVxeComponent({
25
42
  },
26
43
  data () {
27
44
  const reactData: TagReactData = {
45
+ showTag: true
28
46
  }
29
47
  return {
30
48
  xID: XEUtils.uniqueId(),
@@ -37,6 +55,13 @@ export default /* define-vxe-component start */ defineVxeComponent({
37
55
  computeSize(): VxeComponentSizeType
38
56
  })
39
57
  },
58
+ watch: {
59
+ visible () {
60
+ const $xeTag = this
61
+
62
+ $xeTag.updateVisible()
63
+ }
64
+ },
40
65
  methods: {
41
66
  //
42
67
  // Method
@@ -45,10 +70,43 @@ export default /* define-vxe-component start */ defineVxeComponent({
45
70
  const $xeTag = this
46
71
  $xeTag.$emit(type, createEvent(evnt, { $tag: $xeTag }, params))
47
72
  },
73
+ updateVisible () {
74
+ const $xeTag = this
75
+ const props = $xeTag
76
+ const reactData = $xeTag.reactData
77
+
78
+ reactData.showTag = props.visible !== false
79
+ },
48
80
  clickEvent (evnt: MouseEvent) {
49
81
  const $xeTag = this
82
+ const props = $xeTag
83
+
84
+ const { loading } = props
85
+ if (!loading) {
86
+ $xeTag.dispatchEvent('click', {}, evnt)
87
+ }
88
+ },
89
+ dblclickEvent (evnt: MouseEvent) {
90
+ const $xeTag = this
91
+ const props = $xeTag
92
+
93
+ const { loading } = props
94
+ if (!loading) {
95
+ $xeTag.dispatchEvent('dblclick', {}, evnt)
96
+ }
97
+ },
98
+ closeEvent (evnt: MouseEvent) {
99
+ const $xeTag = this
100
+ const props = $xeTag
101
+ const reactData = $xeTag.reactData
50
102
 
51
- $xeTag.dispatchEvent('click', {}, evnt)
103
+ const { loading } = props
104
+ if (!loading) {
105
+ const visible = !reactData.showTag
106
+ reactData.showTag = visible
107
+ $xeTag.$emit('update:visible', visible)
108
+ $xeTag.dispatchEvent('close', { visible }, evnt)
109
+ }
52
110
  },
53
111
 
54
112
  //
@@ -59,15 +117,16 @@ export default /* define-vxe-component start */ defineVxeComponent({
59
117
  const props = $xeTag
60
118
  const slots = $xeTag.$scopedSlots
61
119
 
62
- const { icon, content } = props
120
+ const { icon, content, closable, closeIcon, loading } = props
63
121
  const defaultSlot = slots.default
64
122
  const iconSlot = slots.icon
123
+ const closeIconSlot = slots.closeIcon || slots['close-icon']
65
124
  return [
66
125
  iconSlot || icon
67
126
  ? h('span', {
68
127
  class: 'vxe-tag--icon'
69
128
  }, iconSlot
70
- ? getSlotVNs(iconSlot({}))
129
+ ? iconSlot({})
71
130
  : [
72
131
  h('i', {
73
132
  class: icon
@@ -76,31 +135,60 @@ export default /* define-vxe-component start */ defineVxeComponent({
76
135
  : renderEmptyElement($xeTag),
77
136
  h('span', {
78
137
  class: 'vxe-tag--content'
79
- }, defaultSlot ? defaultSlot({}) : XEUtils.toValueString(content))
138
+ }, defaultSlot ? defaultSlot({}) : XEUtils.toValueString(content)),
139
+ loading || closable
140
+ ? h('span', {
141
+ class: loading ? 'vxe-tag--loading' : 'vxe-tag--close',
142
+ on: {
143
+ click: $xeTag.closeEvent
144
+ }
145
+ }, !loading && closeIconSlot
146
+ ? closeIconSlot({})
147
+ : [
148
+ h('i', {
149
+ class: loading ? getIcon().TAG_LOADING : (closeIcon || getIcon().TAG_CLOSE)
150
+ })
151
+ ])
152
+ : renderEmptyElement($xeTag)
80
153
  ]
81
154
  },
82
155
  renderVN (h: CreateElement): VNode {
83
156
  const $xeTag = this
84
157
  const props = $xeTag
158
+ const reactData = $xeTag.reactData
85
159
 
86
- const { status, title, round } = props
160
+ const { status, color, title, round, border, loading } = props
161
+ const { showTag } = reactData
87
162
  const vSize = $xeTag.computeSize
163
+ if (!showTag) {
164
+ return renderEmptyElement($xeTag)
165
+ }
88
166
  return h('span', {
89
167
  ref: 'refElem',
90
168
  class: ['vxe-tag', {
91
169
  [`size--${vSize}`]: vSize,
92
- [`theme--${status}`]: status,
93
- 'is--round': round
170
+ [`theme--${status}`]: status && !color,
171
+ [`color--${color}`]: color && !status,
172
+ 'is--color': color,
173
+ 'is--round': round,
174
+ 'is--border': border,
175
+ 'is--loading': loading
94
176
  }],
95
177
  attrs: {
96
178
  title
97
179
  },
98
180
  on: {
99
- click: $xeTag.clickEvent
181
+ click: $xeTag.clickEvent,
182
+ dblclick: $xeTag.dblclickEvent
100
183
  }
101
184
  }, $xeTag.renderContent(h))
102
185
  }
103
186
  },
187
+ created () {
188
+ const $xeTag = this
189
+
190
+ $xeTag.updateVisible()
191
+ },
104
192
  render (this: any, h) {
105
193
  return this.renderVN(h)
106
194
  }
@@ -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 {
@@ -647,7 +647,7 @@ export namespace VxeColumnSlotTypes {
647
647
  columnIndex: number
648
648
  $columnIndex: number
649
649
  $rowIndex: number
650
- option: VxeColumnPropTypes.FilterItem | null
650
+ option: VxeColumnPropTypes.FilterItem
651
651
  }
652
652
  export interface FloatingFilterSlotParams<D = any> extends VxeTableDefines.CellFloatingFilterParams<D> { }
653
653
 
@@ -850,7 +850,7 @@ export namespace VxeGridSlotTypes {
850
850
  */
851
851
  _columnIndex: number
852
852
 
853
- option: VxeColumnPropTypes.FilterItem | null
853
+ option: VxeColumnPropTypes.FilterItem
854
854
 
855
855
  type: string
856
856
  fixed: VxeColumnPropTypes.Fixed
@@ -5730,7 +5730,7 @@ export namespace VxeTableDefines {
5730
5730
  type: string
5731
5731
  isHidden: boolean
5732
5732
  hasFilter: boolean
5733
- option: VxeColumnPropTypes.FilterItem | null
5733
+ option: VxeColumnPropTypes.FilterItem
5734
5734
  }
5735
5735
 
5736
5736
  export interface CellRenderHeaderParams<D = any> {
@@ -5746,7 +5746,7 @@ export namespace VxeTableDefines {
5746
5746
  type: string
5747
5747
  isHidden: boolean
5748
5748
  hasFilter: boolean
5749
- firstFilterOption: VxeColumnPropTypes.FilterItem | null
5749
+ firstFilterOption: VxeColumnPropTypes.FilterItem
5750
5750
 
5751
5751
  checked?: boolean
5752
5752
  indeterminate?: boolean
@@ -16,21 +16,33 @@ export interface TagPrivateRef {
16
16
  export interface VxeTagPrivateRef extends TagPrivateRef { }
17
17
 
18
18
  export namespace VxeTagPropTypes {
19
+ export type Border = boolean
19
20
  export type Status = VxeComponentStatusType
21
+ export type Visible = boolean
20
22
  export type Title = string | number
21
23
  export type Icon = string
24
+ export type CloseIcon = string
22
25
  export type Content = string | number
23
26
  export type Round = boolean
24
27
  export type Size = VxeComponentSizeType
28
+ export type Closable = boolean
29
+ export type Color = 'gray' | 'orangered' | 'orange' | 'green' | 'blue' | 'purple' | 'pinkpurple' | 'magenta' | 'chocolate' | 'cyan'
30
+ export type Loading = boolean
25
31
  }
26
32
 
27
- export interface VxeTagProps {
33
+ export type VxeTagProps = {
34
+ border?: VxeTagPropTypes.Border
28
35
  status?: VxeTagPropTypes.Status
36
+ visible?: VxeTagPropTypes.Visible
29
37
  title?: VxeTagPropTypes.Title
30
38
  icon?: VxeTagPropTypes.Icon
39
+ closeIcon?: VxeTagPropTypes.CloseIcon
31
40
  content?: VxeTagPropTypes.Content
32
41
  round?: VxeTagPropTypes.Round
33
42
  size?: VxeTagPropTypes.Size
43
+ closable?: VxeTagPropTypes.Closable
44
+ color?: VxeTagPropTypes.Color
45
+ loading?: VxeTagPropTypes.Loading
34
46
  }
35
47
 
36
48
  export interface TagPrivateComputed {
@@ -38,6 +50,7 @@ export interface TagPrivateComputed {
38
50
  export interface VxeTagPrivateComputed extends TagPrivateComputed { }
39
51
 
40
52
  export interface TagReactData {
53
+ showTag: boolean
41
54
  }
42
55
 
43
56
  export interface TagMethods {
@@ -49,7 +62,10 @@ export interface TagPrivateMethods { }
49
62
  export interface VxeTagPrivateMethods extends TagPrivateMethods { }
50
63
 
51
64
  export type VxeTagEmits = [
52
- 'click'
65
+ 'click',
66
+ 'dblclick',
67
+ 'close',
68
+ 'update:visible'
53
69
  ]
54
70
 
55
71
  export namespace VxeTagDefines {
@@ -57,21 +73,23 @@ export namespace VxeTagDefines {
57
73
  $tag: VxeTagConstructor
58
74
  }
59
75
 
60
- export interface ClickParams {
61
- }
62
- export interface ClickEventParams extends TagEventParams, ClickParams { }
76
+ export interface ClickEventParams extends TagEventParams { }
77
+ export interface CloseEventParams extends TagEventParams { }
63
78
  }
64
79
 
65
80
  export type VxeTagEventProps = {
66
81
  onClick?: VxeTagEvents.Click
82
+ onClose?: VxeTagEvents.Close
67
83
  }
68
84
 
69
85
  export interface VxeTagListeners {
70
86
  click?: VxeTagEvents.Click
87
+ close?: VxeTagEvents.Close
71
88
  }
72
89
 
73
90
  export namespace VxeTagEvents {
74
91
  export type Click = (params: VxeTagDefines.ClickEventParams) => void
92
+ export type Close = (params: VxeTagDefines.CloseEventParams) => void
75
93
  }
76
94
 
77
95
  export namespace VxeTagSlotTypes {
@@ -81,6 +99,8 @@ export namespace VxeTagSlotTypes {
81
99
  export interface VxeTagSlots {
82
100
  default?: (params: VxeTagSlotTypes.DefaultSlotParams) => any
83
101
  icon?: (params: VxeTagSlotTypes.DefaultSlotParams) => any
102
+ closeIcon?: (params: VxeTagSlotTypes.DefaultSlotParams) => any
103
+ 'close-icon'?: (params: VxeTagSlotTypes.DefaultSlotParams) => any
84
104
  }
85
105
 
86
106
  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