vxe-pc-ui 4.9.16 → 4.9.18

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 (56) hide show
  1. package/es/icon/style.css +1 -1
  2. package/es/image/src/preview.js +8 -2
  3. package/es/input/src/input.js +8 -1
  4. package/es/number-input/src/number-input.js +8 -1
  5. package/es/style.css +1 -1
  6. package/es/style.min.css +1 -1
  7. package/es/text/src/text.js +56 -36
  8. package/es/text/style.css +77 -4
  9. package/es/text/style.min.css +1 -1
  10. package/es/ui/index.js +6 -2
  11. package/es/ui/src/log.js +1 -1
  12. package/es/vxe-text/style.css +77 -4
  13. package/es/vxe-text/style.min.css +1 -1
  14. package/lib/icon/style/style.css +1 -1
  15. package/lib/icon/style/style.min.css +1 -1
  16. package/lib/image/src/preview.js +10 -2
  17. package/lib/image/src/preview.min.js +1 -1
  18. package/lib/index.umd.js +97 -45
  19. package/lib/index.umd.min.js +1 -1
  20. package/lib/input/src/input.js +10 -1
  21. package/lib/input/src/input.min.js +1 -1
  22. package/lib/number-input/src/number-input.js +10 -1
  23. package/lib/number-input/src/number-input.min.js +1 -1
  24. package/lib/style.css +1 -1
  25. package/lib/style.min.css +1 -1
  26. package/lib/text/src/text.js +60 -38
  27. package/lib/text/src/text.min.js +1 -1
  28. package/lib/text/style/style.css +77 -4
  29. package/lib/text/style/style.min.css +1 -1
  30. package/lib/ui/index.js +6 -2
  31. package/lib/ui/index.min.js +1 -1
  32. package/lib/ui/src/log.js +1 -1
  33. package/lib/ui/src/log.min.js +1 -1
  34. package/lib/vxe-text/style/style.css +77 -4
  35. package/lib/vxe-text/style/style.min.css +1 -1
  36. package/package.json +1 -1
  37. package/packages/image/src/preview.ts +8 -2
  38. package/packages/input/src/input.ts +10 -2
  39. package/packages/number-input/src/number-input.ts +10 -6
  40. package/packages/text/src/text.ts +59 -36
  41. package/packages/ui/index.ts +5 -1
  42. package/styles/components/text.scss +21 -6
  43. package/types/components/countdown.d.ts +8 -0
  44. package/types/components/text.d.ts +12 -5
  45. /package/es/icon/{iconfont.1757082114285.ttf → iconfont.1757160944209.ttf} +0 -0
  46. /package/es/icon/{iconfont.1757082114285.woff → iconfont.1757160944209.woff} +0 -0
  47. /package/es/icon/{iconfont.1757082114285.woff2 → iconfont.1757160944209.woff2} +0 -0
  48. /package/es/{iconfont.1757082114285.ttf → iconfont.1757160944209.ttf} +0 -0
  49. /package/es/{iconfont.1757082114285.woff → iconfont.1757160944209.woff} +0 -0
  50. /package/es/{iconfont.1757082114285.woff2 → iconfont.1757160944209.woff2} +0 -0
  51. /package/lib/icon/style/{iconfont.1757082114285.ttf → iconfont.1757160944209.ttf} +0 -0
  52. /package/lib/icon/style/{iconfont.1757082114285.woff → iconfont.1757160944209.woff} +0 -0
  53. /package/lib/icon/style/{iconfont.1757082114285.woff2 → iconfont.1757160944209.woff2} +0 -0
  54. /package/lib/{iconfont.1757082114285.ttf → iconfont.1757160944209.ttf} +0 -0
  55. /package/lib/{iconfont.1757082114285.woff → iconfont.1757160944209.woff} +0 -0
  56. /package/lib/{iconfont.1757082114285.woff2 → iconfont.1757160944209.woff2} +0 -0
@@ -1,4 +1,4 @@
1
- import { ref, h, reactive, PropType, VNode } from 'vue'
1
+ import { ref, h, reactive, PropType, VNode, computed } from 'vue'
2
2
  import { defineVxeComponent } from '../../ui/src/comp'
3
3
  import XEUtils from 'xe-utils'
4
4
  import { VxeUI, getConfig, getIcon, getI18n, useSize, createEvent } from '../../ui'
@@ -19,14 +19,7 @@ export default defineVxeComponent({
19
19
  type: Boolean as PropType<VxeTextPropTypes.ClickToCopy>,
20
20
  default: () => getConfig().text.clickToCopy
21
21
  },
22
- copyIcon: {
23
- type: String as PropType<VxeTextPropTypes.CopyIcon>,
24
- default: () => getConfig().text.copyIcon
25
- },
26
- copyLayout: {
27
- type: String as PropType<VxeTextPropTypes.CopyLayout>,
28
- default: () => getConfig().text.copyLayout
29
- },
22
+ copyConfig: Object as PropType<VxeTextPropTypes.CopyConfig>,
30
23
  size: {
31
24
  type: String as PropType<VxeTextPropTypes.Size>,
32
25
  default: () => getConfig().text.size || getConfig().size
@@ -34,8 +27,11 @@ export default defineVxeComponent({
34
27
  },
35
28
  emits: [
36
29
  'click',
30
+ 'dblclick',
37
31
  'prefix-click',
38
- 'suffix-click'
32
+ 'suffix-click',
33
+ 'copy-success',
34
+ 'copy-error'
39
35
  ] as VxeTextEmits,
40
36
  setup (props, context) {
41
37
  const { emit, slots } = context
@@ -50,6 +46,10 @@ export default defineVxeComponent({
50
46
  const reactData = reactive<TextReactData>({
51
47
  })
52
48
 
49
+ const computeCopyOpts = computed(() => {
50
+ return Object.assign({}, getConfig().text.copyConfig, props.copyConfig)
51
+ })
52
+
53
53
  const refMaps: TextPrivateRef = {
54
54
  refElem
55
55
  }
@@ -57,31 +57,49 @@ export default defineVxeComponent({
57
57
  const computeMaps: VxeTextPrivateComputed = {
58
58
  }
59
59
 
60
- const clickIconEvent = () => {
61
- const { content, clickToCopy } = props
62
- if (clickToCopy) {
63
- const contentEl = refContentElem.value
64
- const copyVal = (contentEl ? contentEl.textContent : '') || content
65
- if (copyVal) {
66
- if (VxeUI.clipboard.copy(copyVal)) {
67
- if (VxeUI.modal) {
68
- VxeUI.modal.message({
69
- content: getI18n('vxe.text.copySuccess'),
70
- status: 'success'
71
- })
72
- }
73
- } else {
74
- if (VxeUI.modal) {
75
- VxeUI.modal.message({
76
- content: getI18n('vxe.text.copyError'),
77
- status: 'error'
78
- })
79
- }
60
+ const handleCopy = (evnt: MouseEvent) => {
61
+ const { content } = props
62
+ const copyOpts = computeCopyOpts.value
63
+ const { showMessage } = copyOpts
64
+ const contentEl = refContentElem.value
65
+ const copyVal = (contentEl ? contentEl.textContent : '') || content
66
+ if (copyVal) {
67
+ if (VxeUI.clipboard.copy(copyVal)) {
68
+ if (showMessage && VxeUI.modal) {
69
+ VxeUI.modal.message({
70
+ content: getI18n('vxe.text.copySuccess'),
71
+ status: 'success'
72
+ })
73
+ }
74
+ dispatchEvent('copy-success', {}, evnt)
75
+ } else {
76
+ if (showMessage && VxeUI.modal) {
77
+ VxeUI.modal.message({
78
+ content: getI18n('vxe.text.copyError'),
79
+ status: 'error'
80
+ })
80
81
  }
82
+ dispatchEvent('copy-error', {}, evnt)
81
83
  }
82
84
  }
83
85
  }
84
86
 
87
+ const clickIconEvent = (evnt: MouseEvent) => {
88
+ const { clickToCopy } = props
89
+ const copyOpts = computeCopyOpts.value
90
+ if (clickToCopy && copyOpts.trigger !== 'dblclick') {
91
+ handleCopy(evnt)
92
+ }
93
+ }
94
+
95
+ const dblclickIconEvent = (evnt: MouseEvent) => {
96
+ const { clickToCopy } = props
97
+ const copyOpts = computeCopyOpts.value
98
+ if (clickToCopy && copyOpts.trigger === 'dblclick') {
99
+ handleCopy(evnt)
100
+ }
101
+ }
102
+
85
103
  const $xeText = {
86
104
  xID,
87
105
  props,
@@ -127,24 +145,29 @@ export default defineVxeComponent({
127
145
  Object.assign($xeText, textMethods, textPrivateMethods)
128
146
 
129
147
  const renderCopyIcon = () => {
130
- const { copyIcon } = props
148
+ const copyOpts = computeCopyOpts.value
149
+ const { icon, status } = copyOpts
131
150
  return h('span', {
132
151
  key: 'ci',
133
- class: 'vxe-text--copy-icon',
134
- onClick: clickIconEvent
152
+ class: ['vxe-text--copy-icon', {
153
+ [`theme--${status}`]: status
154
+ }],
155
+ onClick: clickIconEvent,
156
+ onDblclick: dblclickIconEvent
135
157
  }, [
136
158
  h('i', {
137
- class: copyIcon || getIcon().TEXT_COPY
159
+ class: icon || getIcon().TEXT_COPY
138
160
  })
139
161
  ])
140
162
  }
141
163
 
142
164
  const renderContent = () => {
143
- const { loading, icon, prefixIcon, suffixIcon, clickToCopy, content, copyLayout } = props
165
+ const { loading, icon, prefixIcon, suffixIcon, clickToCopy, content } = props
166
+ const copyOpts = computeCopyOpts.value
144
167
  const defaultSlot = slots.default
145
168
  const prefixIconSlot = slots.prefixIcon || slots['prefix-icon'] || slots.icon
146
169
  const suffixIconSlot = slots.suffixIcon || slots['suffix-icon']
147
- const copyToRight = copyLayout === 'right'
170
+ const copyToRight = copyOpts.layout === 'right'
148
171
  const contVNs: VNode[] = []
149
172
  if (loading) {
150
173
  contVNs.push(
@@ -348,7 +348,11 @@ setConfig({
348
348
  textEllipsis: {
349
349
  underline: true
350
350
  },
351
- text: {},
351
+ text: {
352
+ copyConfig: {
353
+ showMessage: true
354
+ }
355
+ },
352
356
  textarea: {
353
357
  resize: 'none'
354
358
  },
@@ -61,21 +61,36 @@ $btnThemeList: (
61
61
  color: map.get($item, textColor);
62
62
  }
63
63
  }
64
- &.is--copy {
65
- & > .vxe-text--copy-icon {
66
- cursor: pointer;
64
+ }
65
+
66
+ .vxe-text--copy-icon {
67
+ cursor: pointer;
68
+ &:focus {
69
+ color: var(--vxe-ui-font-darken-color);
70
+ }
71
+ &:hover {
72
+ color: var(--vxe-ui-font-primary-lighten-color);
73
+ }
74
+ &:active {
75
+ color: var(--vxe-ui-font-primary-darken-color);
76
+ }
77
+ @for $index from 0 to list.length($btnThemeList) {
78
+ $item: list.nth($btnThemeList, $index + 1);
79
+ &.theme--#{map.get($item, name)} {
80
+ color: map.get($item, textColor);
67
81
  &:focus {
68
- color: var(--vxe-ui-font-darken-color);
82
+ color: map.get($item, btnDarkenColor);
69
83
  }
70
84
  &:hover {
71
- color: var(--vxe-ui-font-primary-lighten-color);
85
+ color: map.get($item, btnLightenColor);
72
86
  }
73
87
  &:active {
74
- color: var(--vxe-ui-font-primary-darken-color);
88
+ color: map.get($item, btnDarkenColor);
75
89
  }
76
90
  }
77
91
  }
78
92
  }
93
+
79
94
  .vxe-text--loading,
80
95
  .vxe-text--prefix-icon,
81
96
  .vxe-text--suffix-icon,
@@ -94,10 +94,18 @@ export namespace VxeCountdownSlotTypes {
94
94
  diffConf: DateDiffResult
95
95
  currentValue: number
96
96
  }
97
+
98
+ export interface PrefixSlotParams {
99
+ diffConf: DateDiffResult
100
+ currentValue: number
101
+ }
102
+ export interface SuffixSlotParams extends PrefixSlotParams {}
97
103
  }
98
104
 
99
105
  export interface VxeCountdownSlots {
100
106
  default?: (params: VxeCountdownSlotTypes.DefaultSlotParams) => any
107
+ prefix?: (params: VxeCountdownSlotTypes.PrefixSlotParams) => any
108
+ suffix?: (params: VxeCountdownSlotTypes.SuffixSlotParams) => any
101
109
  }
102
110
 
103
111
  export const Countdown: typeof VxeCountdown
@@ -30,10 +30,15 @@ export namespace VxeTextPropTypes {
30
30
  export type SuffixIcon = string
31
31
  export type Loading = boolean
32
32
  export type Content = string | number
33
- export type CopyIcon = string
34
33
  export type ClickToCopy = boolean
35
- export type CopyLayout = 'left' | 'right' | '' | null
36
34
  export type Size = VxeComponentSizeType
35
+ export interface CopyConfig {
36
+ layout?: 'left' | 'right' | '' | null
37
+ showMessage?: boolean
38
+ trigger?: 'click' | 'dblclick'
39
+ icon?: string
40
+ status?: VxeComponentStatusType
41
+ }
37
42
  }
38
43
 
39
44
  export type VxeTextProps = {
@@ -53,9 +58,8 @@ export type VxeTextProps = {
53
58
  suffixIcon?: VxeTextPropTypes.SuffixIcon
54
59
  loading?: VxeTextPropTypes.Loading
55
60
  content?: VxeTextPropTypes.Content
56
- copyIcon?: VxeTextPropTypes.CopyIcon
57
61
  clickToCopy?: VxeTextPropTypes.ClickToCopy
58
- copyLayout?: VxeTextPropTypes.CopyLayout
62
+ copyConfig?: VxeTextPropTypes.CopyConfig
59
63
  size?: VxeTextPropTypes.Size
60
64
  }
61
65
 
@@ -76,8 +80,11 @@ export interface VxeTextPrivateMethods extends TextPrivateMethods { }
76
80
 
77
81
  export type VxeTextEmits = [
78
82
  'click',
83
+ 'dblclick',
79
84
  'prefix-click',
80
- 'suffix-click'
85
+ 'suffix-click',
86
+ 'copy-success',
87
+ 'copy-error'
81
88
  ]
82
89
 
83
90
  export namespace VxeTextDefines {