mali-applet-ui 1.1.99 → 1.1.101

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.
@@ -0,0 +1,35 @@
1
+ const MaliClipboard = {
2
+ copy (text) {
3
+ return new Promise(resolve => {
4
+ uni.setClipboardData({
5
+ data: text,
6
+ success () {
7
+ resolve(true)
8
+ },
9
+ fail () {
10
+ resolve(false)
11
+ }
12
+ })
13
+ })
14
+ },
15
+ read () {
16
+ return new Promise(resolve => {
17
+ uni.getClipboardData({
18
+ success (res) {
19
+ resolve({
20
+ status: true,
21
+ content: res.data
22
+ })
23
+ },
24
+ fail () {
25
+ resolve({
26
+ status: false,
27
+ content: ''
28
+ })
29
+ }
30
+ })
31
+ })
32
+ }
33
+ }
34
+
35
+ export default MaliClipboard
package/index.js CHANGED
@@ -7,6 +7,7 @@ import MaliWebview from './webview'
7
7
  import MaliI18n from './i18n/i18n'
8
8
  import MaliUtils from './utils'
9
9
  import MaliTongJi from './tongji'
10
+ import MaliClipboard from './clipboard'
10
11
 
11
12
  export function install (Vue) {
12
13
  Vue.prototype.$t = MaliI18n.t
@@ -22,7 +23,8 @@ const MaliUI = {
22
23
  MaliStorage,
23
24
  MaliWebview,
24
25
  MaliI18n,
25
- MaliTongJi
26
+ MaliTongJi,
27
+ MaliClipboard
26
28
  }
27
29
 
28
30
  export {
@@ -33,7 +35,8 @@ export {
33
35
  MaliStorage,
34
36
  MaliWebview,
35
37
  MaliI18n,
36
- MaliTongJi
38
+ MaliTongJi,
39
+ MaliClipboard
37
40
  }
38
41
 
39
42
  export default MaliUI
@@ -106,6 +106,10 @@ export default {
106
106
  headerData: Array,
107
107
  data: Array,
108
108
  columns: Array,
109
+ columnConfig: {
110
+ type: Object,
111
+ default: () => ({})
112
+ },
109
113
  showMore: Boolean,
110
114
  loadStatus: String,
111
115
  rowConfig: {
@@ -148,6 +152,9 @@ export default {
148
152
  rowOpts () {
149
153
  return { ...this.rowConfig }
150
154
  },
155
+ columnOpts () {
156
+ return { ...this.columnConfig }
157
+ },
151
158
  sortOpts () {
152
159
  return { ...this.sortConfig }
153
160
  },
@@ -258,11 +265,12 @@ export default {
258
265
  return this.showOverflow ? '84rpx' : ''
259
266
  },
260
267
  getColWidth (column) {
261
- if (column.width) {
262
- if (isNaN(column.width)) {
263
- return column.width
268
+ const colWidth = column.width || this.columnOpts.width
269
+ if (colWidth) {
270
+ if (isNaN(colWidth)) {
271
+ return colWidth
264
272
  }
265
- return `${column.width}rpx`
273
+ return `${colWidth}rpx`
266
274
  }
267
275
  return `${this.colMinWidth}%`
268
276
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mali-applet-ui",
3
- "version": "1.1.99",
3
+ "version": "1.1.101",
4
4
  "description": "码里UI-小程序组件库(vue2)",
5
5
  "files": [
6
6
  "lib",
@@ -15,6 +15,7 @@
15
15
  "storage",
16
16
  "webview",
17
17
  "tongji",
18
+ "clipboard",
18
19
  "index.js",
19
20
  "theme.scss"
20
21
  ],
@@ -0,0 +1,11 @@
1
+ export interface MlClipboardCore {
2
+ copy(text: strin): Promise<boolean>
3
+ read(language: string): Promise<{
4
+ status: boolean
5
+ content: string
6
+ }>
7
+
8
+ t(key: string, args: any): any
9
+ }
10
+
11
+ export const MaliClipboard: MlClipboardCore
package/types/index.d.ts CHANGED
@@ -7,6 +7,7 @@ import { MaliToast } from './toast'
7
7
  import { MaliLoading } from './loading'
8
8
  import { MaliWebview, MlWebviewCore } from './webview'
9
9
  import { MaliI18n, MlI18nCore } from './i18n'
10
+ import { MaliClipboard, MlClipboardCore } from './clipboard'
10
11
 
11
12
  export interface ConfigOptions {
12
13
  webview?: {
@@ -37,6 +38,7 @@ export const MaliUI: {
37
38
  MaliStorage: MlStorageCore
38
39
  MaliI18n: MlI18nCore
39
40
  MaliWebview: MlWebviewCore
41
+ MaliClipboard: MlClipboardCore
40
42
  }
41
43
 
42
44
  export {
@@ -46,7 +48,8 @@ export {
46
48
  MaliLoading,
47
49
  MaliI18n,
48
50
  MaliStorage,
49
- MaliWebview
51
+ MaliWebview,
52
+ MaliClipboard
50
53
  }
51
54
 
52
55
  export default MaliUI
@@ -25,9 +25,14 @@ export interface MlUtilsCore extends XEUtilsMethods {
25
25
 
26
26
  getFileSuffix(filename: string): string
27
27
  getFileName(filename: string): string
28
+ hasAllPreviewType(fileType: string): boolean
28
29
  getAllPreviewTypes(): string[]
30
+ hasFilePreviewType(fileType: string): boolean
29
31
  getFilePreviewTypes(): string[]
32
+ hasImagePreviewType(fileType: string): boolean
30
33
  getImagePreviewTypes(): string[]
34
+ hasVideoPreviewType(fileType: string): boolean
35
+ getVideoPreviewTypes(): string[]
31
36
  openFileByUrl(url: string, name?: string, options?: {
32
37
  showMsg?: boolean
33
38
  }): Promise<{ filePath: string }>
package/utils/file.js CHANGED
@@ -16,17 +16,37 @@ export function getFileName (url) {
16
16
  }
17
17
 
18
18
  export function getAllPreviewTypes () {
19
- return getFilePreviewTypes().concat(getImagePreviewTypes())
19
+ return [...getFilePreviewTypes(), ...getImagePreviewTypes(), ...getVideoPreviewTypes()]
20
+ }
21
+
22
+ export function hasAllPreviewType (fileType) {
23
+ return getAllPreviewTypes().includes(XEUtils.toValueString(fileType).toLowerCase())
20
24
  }
21
25
 
22
26
  export function getFilePreviewTypes () {
23
27
  return ['doc', 'xls', 'ppt', 'pdf', 'docx', 'xlsx', 'pptx']
24
28
  }
25
29
 
30
+ export function hasFilePreviewType (fileType) {
31
+ return getFilePreviewTypes().includes(XEUtils.toValueString(fileType).toLowerCase())
32
+ }
33
+
26
34
  export function getImagePreviewTypes () {
27
35
  return ['png', 'jpg', 'gif', 'jpeg']
28
36
  }
29
37
 
38
+ export function hasImagePreviewType (fileType) {
39
+ return getImagePreviewTypes().includes(XEUtils.toValueString(fileType).toLowerCase())
40
+ }
41
+
42
+ export function getVideoPreviewTypes () {
43
+ return ['mp4']
44
+ }
45
+
46
+ export function hasVideoPreviewType (fileType) {
47
+ return getVideoPreviewTypes().includes(XEUtils.toValueString(fileType).toLowerCase())
48
+ }
49
+
30
50
  /**
31
51
  * 附件预览
32
52
  * @param {*} fileUrl