vxe-pc-ui 4.5.22 → 4.5.24

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 (42) hide show
  1. package/es/icon/style.css +1 -1
  2. package/es/select/src/select.js +5 -3
  3. package/es/style.css +1 -1
  4. package/es/style.min.css +1 -1
  5. package/es/tree-select/src/tree-select.js +1 -0
  6. package/es/ui/index.js +5 -3
  7. package/es/ui/src/log.js +1 -1
  8. package/es/upload/src/upload.js +45 -19
  9. package/lib/icon/style/style.css +1 -1
  10. package/lib/icon/style/style.min.css +1 -1
  11. package/lib/index.umd.js +66 -26
  12. package/lib/index.umd.min.js +1 -1
  13. package/lib/select/src/select.js +5 -3
  14. package/lib/select/src/select.min.js +1 -1
  15. package/lib/style.css +1 -1
  16. package/lib/style.min.css +1 -1
  17. package/lib/tree-select/src/tree-select.js +1 -0
  18. package/lib/tree-select/src/tree-select.min.js +1 -1
  19. package/lib/ui/index.js +5 -3
  20. package/lib/ui/index.min.js +1 -1
  21. package/lib/ui/src/log.js +1 -1
  22. package/lib/ui/src/log.min.js +1 -1
  23. package/lib/upload/src/upload.js +54 -19
  24. package/lib/upload/src/upload.min.js +1 -1
  25. package/package.json +1 -1
  26. package/packages/select/src/select.ts +5 -3
  27. package/packages/tree-select/src/tree-select.ts +1 -0
  28. package/packages/ui/index.ts +4 -2
  29. package/packages/upload/src/upload.ts +44 -19
  30. package/types/components/upload.d.ts +16 -4
  31. /package/es/icon/{iconfont.1744427590259.ttf → iconfont.1744797753491.ttf} +0 -0
  32. /package/es/icon/{iconfont.1744427590259.woff → iconfont.1744797753491.woff} +0 -0
  33. /package/es/icon/{iconfont.1744427590259.woff2 → iconfont.1744797753491.woff2} +0 -0
  34. /package/es/{iconfont.1744427590259.ttf → iconfont.1744797753491.ttf} +0 -0
  35. /package/es/{iconfont.1744427590259.woff → iconfont.1744797753491.woff} +0 -0
  36. /package/es/{iconfont.1744427590259.woff2 → iconfont.1744797753491.woff2} +0 -0
  37. /package/lib/icon/style/{iconfont.1744427590259.ttf → iconfont.1744797753491.ttf} +0 -0
  38. /package/lib/icon/style/{iconfont.1744427590259.woff → iconfont.1744797753491.woff} +0 -0
  39. /package/lib/icon/style/{iconfont.1744427590259.woff2 → iconfont.1744797753491.woff2} +0 -0
  40. /package/lib/{iconfont.1744427590259.ttf → iconfont.1744797753491.ttf} +0 -0
  41. /package/lib/{iconfont.1744427590259.woff → iconfont.1744797753491.woff} +0 -0
  42. /package/lib/{iconfont.1744427590259.woff2 → iconfont.1744797753491.woff2} +0 -0
@@ -68,10 +68,26 @@ export default defineComponent({
68
68
  type: [String, Number] as PropType<VxeUploadPropTypes.LimitSize>,
69
69
  default: () => getConfig().upload.limitSize
70
70
  },
71
+ showLimitSize: {
72
+ type: Boolean as PropType<VxeUploadPropTypes.ShowLimitSize>,
73
+ default: () => getConfig().upload.showLimitSize
74
+ },
75
+ limitSizeText: {
76
+ type: [String, Number, Function] as PropType<VxeUploadPropTypes.LimitSizeText>,
77
+ default: () => getConfig().upload.limitSizeText
78
+ },
71
79
  limitCount: {
72
80
  type: [String, Number] as PropType<VxeUploadPropTypes.LimitCount>,
73
81
  default: () => getConfig().upload.limitCount
74
82
  },
83
+ showLimitCount: {
84
+ type: Boolean as PropType<VxeUploadPropTypes.ShowLimitCount>,
85
+ default: () => getConfig().upload.showLimitCount
86
+ },
87
+ limitCountText: {
88
+ type: [String, Number, Function] as PropType<VxeUploadPropTypes.LimitCountText>,
89
+ default: () => getConfig().upload.limitCountText
90
+ },
75
91
  nameField: {
76
92
  type: String as PropType<VxeUploadPropTypes.NameField>,
77
93
  default: () => getConfig().upload.nameField
@@ -97,7 +113,7 @@ export default defineComponent({
97
113
  default: () => getConfig().upload.showProgress
98
114
  },
99
115
  progressText: {
100
- type: String as PropType<VxeUploadPropTypes.ProgressText>,
116
+ type: [String, Number, Function] as PropType<VxeUploadPropTypes.ProgressText>,
101
117
  default: () => getConfig().upload.progressText
102
118
  },
103
119
  autoHiddenButton: {
@@ -109,7 +125,7 @@ export default defineComponent({
109
125
  default: () => getConfig().upload.showUploadButton
110
126
  },
111
127
  buttonText: {
112
- type: String as PropType<VxeUploadPropTypes.ButtonText>,
128
+ type: [String, Number, Function] as PropType<VxeUploadPropTypes.ButtonText>,
113
129
  default: () => getConfig().upload.buttonText
114
130
  },
115
131
  buttonIcon: {
@@ -140,7 +156,7 @@ export default defineComponent({
140
156
  type: Boolean as PropType<VxeUploadPropTypes.ShowTip>,
141
157
  default: () => null
142
158
  },
143
- tipText: String as PropType<VxeUploadPropTypes.TipText>,
159
+ tipText: [String, Number, Function] as PropType<VxeUploadPropTypes.TipText>,
144
160
  hintText: String as PropType<VxeUploadPropTypes.HintText>,
145
161
  previewMethod: Function as PropType<VxeUploadPropTypes.PreviewMethod>,
146
162
  uploadMethod: Function as PropType<VxeUploadPropTypes.UploadMethod>,
@@ -249,7 +265,7 @@ export default defineComponent({
249
265
  return props.sizeField || 'size'
250
266
  })
251
267
 
252
- const computeLimitMaxSizeB = computed(() => {
268
+ const computeLimitMaxSize = computed(() => {
253
269
  return XEUtils.toNumber(props.limitSize) * 1024 * 1024
254
270
  })
255
271
 
@@ -307,6 +323,9 @@ export default defineComponent({
307
323
  if (XEUtils.isString(tipText)) {
308
324
  return tipText
309
325
  }
326
+ if (XEUtils.isFunction(tipText)) {
327
+ return `${tipText({})}`
328
+ }
310
329
  const defTips: string[] = []
311
330
  if (isImage) {
312
331
  if (multiple && limitCount) {
@@ -601,7 +620,7 @@ export default defineComponent({
601
620
  }
602
621
  }
603
622
  const uploadFile = (files: File[], evnt: Event | null) => {
604
- const { multiple, urlMode } = props
623
+ const { multiple, urlMode, showLimitSize, limitSizeText, showLimitCount, limitCountText } = props
605
624
  const { fileList } = reactData
606
625
  const uploadFn = props.uploadMethod || getConfig().upload.uploadMethod
607
626
  const keyField = computeKeyField.value
@@ -609,27 +628,33 @@ export default defineComponent({
609
628
  const typeProp = computeTypeProp.value
610
629
  const urlProp = computeUrlProp.value
611
630
  const sizeProp = computeSizeProp.value
612
- const limitMaxSizeB = computeLimitMaxSizeB.value
631
+ const limitMaxSize = computeLimitMaxSize.value
613
632
  const limitMaxCount = computeLimitMaxCount.value
614
633
  const limitSizeUnit = computeLimitSizeUnit.value
615
634
  let selectFiles = files
616
635
 
617
636
  if (multiple && limitMaxCount) {
618
637
  // 校验文件数量
619
- if (fileList.length >= limitMaxCount) {
638
+ if (showLimitCount && fileList.length >= limitMaxCount) {
620
639
  if (VxeUI.modal) {
621
640
  VxeUI.modal.notification({
622
641
  title: getI18n('vxe.modal.errTitle'),
623
642
  status: 'error',
624
- content: getI18n('vxe.upload.overCountErr', [limitMaxCount])
643
+ content: limitCountText ? `${XEUtils.isFunction(limitCountText) ? limitCountText({ maxCount: limitMaxCount }) : limitCountText}` : getI18n('vxe.upload.overCountErr', [limitMaxCount])
625
644
  })
626
645
  }
627
646
  return
628
647
  }
629
648
  const overNum = selectFiles.length - (limitMaxCount - fileList.length)
630
- if (overNum > 0) {
649
+ if (showLimitCount && overNum > 0) {
631
650
  const overExtraList = selectFiles.slice(limitMaxCount - fileList.length)
632
- if (VxeUI.modal) {
651
+ if (limitCountText) {
652
+ VxeUI.modal.notification({
653
+ title: getI18n('vxe.modal.errTitle'),
654
+ status: 'error',
655
+ content: `${XEUtils.isFunction(limitCountText) ? limitCountText({ maxCount: limitMaxCount }) : limitCountText}`
656
+ })
657
+ } else if (VxeUI.modal) {
633
658
  VxeUI.modal.notification({
634
659
  title: getI18n('vxe.modal.errTitle'),
635
660
  status: 'error',
@@ -658,15 +683,15 @@ export default defineComponent({
658
683
  }
659
684
 
660
685
  // 校验文件大小
661
- if (limitMaxSizeB) {
686
+ if (showLimitSize && limitMaxSize) {
662
687
  for (let i = 0; i < files.length; i++) {
663
688
  const file = files[0]
664
- if (file.size > limitMaxSizeB) {
689
+ if (file.size > limitMaxSize) {
665
690
  if (VxeUI.modal) {
666
691
  VxeUI.modal.notification({
667
692
  title: getI18n('vxe.modal.errTitle'),
668
693
  status: 'error',
669
- content: getI18n('vxe.upload.overSizeErr', [limitSizeUnit])
694
+ content: limitSizeText ? `${XEUtils.isFunction(limitSizeText) ? limitSizeText({ maxSize: limitMaxSize }) : limitSizeText}` : getI18n('vxe.upload.overSizeErr', [limitSizeUnit])
670
695
  })
671
696
  }
672
697
  return
@@ -1205,7 +1230,7 @@ export default defineComponent({
1205
1230
  showProgress && isLoading && cacheItem
1206
1231
  ? h('div', {
1207
1232
  class: 'vxe-upload--file-item-loading-text'
1208
- }, progressText ? XEUtils.toFormatString(progressText, { percent: cacheItem.percent }) : getI18n('vxe.upload.uploadProgress', [cacheItem.percent]))
1233
+ }, progressText ? XEUtils.toFormatString(`${XEUtils.isFunction(progressText) ? progressText({}) : progressText}`, { percent: cacheItem.percent }) : getI18n('vxe.upload.uploadProgress', [cacheItem.percent]))
1209
1234
  : createCommentVNode(),
1210
1235
  showErrorStatus && isError
1211
1236
  ? h('div', {
@@ -1285,7 +1310,7 @@ export default defineComponent({
1285
1310
  : [
1286
1311
  h(VxeButtonComponent, {
1287
1312
  class: 'vxe-upload--file-action-button',
1288
- content: (isMoreView || showButtonText) ? (buttonText ? `${buttonText}` : getI18n('vxe.upload.fileBtnText')) : '',
1313
+ content: (isMoreView || showButtonText) ? (buttonText ? `${XEUtils.isFunction(buttonText) ? buttonText({}) : buttonText}` : getI18n('vxe.upload.fileBtnText')) : '',
1289
1314
  icon: showButtonIcon ? (buttonIcon || getIcon().UPLOAD_FILE_ADD) : '',
1290
1315
  disabled: isDisabled
1291
1316
  })
@@ -1293,7 +1318,7 @@ export default defineComponent({
1293
1318
  showTipText && (defTipText || tipSlot)
1294
1319
  ? h('div', {
1295
1320
  class: 'vxe-upload--file-action-tip'
1296
- }, tipSlot ? getSlotVNs(tipSlot({ $upload: $xeUpload })) : defTipText)
1321
+ }, tipSlot ? getSlotVNs(tipSlot({ $upload: $xeUpload })) : `${defTipText}`)
1297
1322
  : createCommentVNode()
1298
1323
  ])
1299
1324
  }
@@ -1424,7 +1449,7 @@ export default defineComponent({
1424
1449
  showProgress
1425
1450
  ? h('div', {
1426
1451
  class: 'vxe-upload--image-item-loading-text'
1427
- }, progressText ? XEUtils.toFormatString(progressText, { percent: cacheItem.percent }) : getI18n('vxe.upload.uploadProgress', [cacheItem.percent]))
1452
+ }, progressText ? XEUtils.toFormatString(`${XEUtils.isFunction(progressText) ? progressText({}) : progressText}`, { percent: cacheItem.percent }) : getI18n('vxe.upload.uploadProgress', [cacheItem.percent]))
1428
1453
  : createCommentVNode()
1429
1454
  ])
1430
1455
  : createCommentVNode(),
@@ -1523,12 +1548,12 @@ export default defineComponent({
1523
1548
  isMoreView || showButtonText
1524
1549
  ? h('div', {
1525
1550
  class: 'vxe-upload--image-action-content'
1526
- }, buttonText ? `${buttonText}` : getI18n('vxe.upload.imgBtnText'))
1551
+ }, buttonText ? `${XEUtils.isFunction(buttonText) ? buttonText({}) : buttonText}` : getI18n('vxe.upload.imgBtnText'))
1527
1552
  : createCommentVNode(),
1528
1553
  showTipText && (defTipText || tipSlot)
1529
1554
  ? h('div', {
1530
1555
  class: 'vxe-upload--image-action-hint'
1531
- }, tipSlot ? getSlotVNs(tipSlot({ $upload: $xeUpload })) : defTipText)
1556
+ }, tipSlot ? getSlotVNs(tipSlot({ $upload: $xeUpload })) : `${defTipText}`)
1532
1557
  : createCommentVNode()
1533
1558
  ])
1534
1559
  ])
@@ -57,15 +57,23 @@ export namespace VxeUploadPropTypes {
57
57
  export type KeyField = string
58
58
  export type UrlMode = boolean
59
59
  export type Multiple = boolean
60
- export type LimitSize = number | string
60
+ export type LimitSize = number | String
61
+ export type ShowLimitSize = boolean
62
+ export type LimitSizeText = number | string | ((params: {
63
+ maxSize: number
64
+ }) => number | string)
61
65
  export type LimitCount = number | string
66
+ export type ShowLimitCount = boolean
67
+ export type LimitCountText = number | string | ((params: {
68
+ maxCount: number
69
+ }) => number | string)
62
70
  export type NameField = string
63
71
  export type TypeField = string
64
72
  export type UrlField = string
65
73
  export type SizeField = string
66
74
  export type ShowTip = boolean
67
- export type TipText = string
68
- export type ButtonText = string
75
+ export type TipText = number | string | ((params: {}) => number | string)
76
+ export type ButtonText = number | string | ((params: {}) => number | string)
69
77
  export type ButtonIcon = string
70
78
  export type ShowButtonText = boolean
71
79
  export type ShowButtonIcon = boolean
@@ -74,7 +82,7 @@ export namespace VxeUploadPropTypes {
74
82
  export type ShowPreview = boolean
75
83
  export type ShowErrorStatus = boolean
76
84
  export type ShowProgress = boolean
77
- export type ProgressText = string
85
+ export type ProgressText = number | string | ((params: {}) => number | string)
78
86
  export type AutoHiddenButton = boolean
79
87
  export type ShowUploadButton = boolean
80
88
  export type PreviewMethod = undefined | ((params: {
@@ -146,7 +154,11 @@ export interface VxeUploadProps {
146
154
  * 限制文件大小,单位M
147
155
  */
148
156
  limitSize?: VxeUploadPropTypes.LimitSize
157
+ showLimitSize?: VxeUploadPropTypes.ShowLimitSize
158
+ limitSizeText?: VxeUploadPropTypes.LimitSizeText
149
159
  limitCount?: VxeUploadPropTypes.LimitCount
160
+ showLimitCount?: VxeUploadPropTypes.ShowLimitCount
161
+ limitCountText?: VxeUploadPropTypes.LimitCountText
150
162
  nameField?: VxeUploadPropTypes.NameField
151
163
  typeField?: VxeUploadPropTypes.TypeField
152
164
  urlField?: VxeUploadPropTypes.UrlField