web-component-gallery 2.3.16 → 2.3.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.
- package/dist/index.umd.js +1 -1
- package/dist/js.umd.js +1 -1
- package/extensions/Rem.js +15 -17
- package/lib/transfer-table/index.vue +3 -3
- package/package.json +1 -1
- package/utils/Filter.js +7 -10
package/extensions/Rem.js
CHANGED
|
@@ -1,24 +1,22 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* 行内 px 转 rem 自定义指令
|
|
3
|
+
* 用途:在 JS 对象中定义样式时自动完成单位转换
|
|
4
|
+
*/
|
|
5
|
+
export const getRootValue = () => window.REM_BASE || 14
|
|
6
|
+
|
|
2
7
|
const handler = (el, binding) => {
|
|
3
|
-
|
|
4
|
-
const rootValue = 14
|
|
8
|
+
if (!binding.value) return
|
|
5
9
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
if (binding.value) {
|
|
14
|
-
Object.entries(binding.value).forEach(([key, val]) => {
|
|
15
|
-
el.style[key] = convert(val)
|
|
16
|
-
})
|
|
17
|
-
}
|
|
10
|
+
const base = getRootValue()
|
|
11
|
+
Object.entries(binding.value).forEach(([key, val]) => {
|
|
12
|
+
el.style[key] = typeof val === 'string' && val.includes('px')
|
|
13
|
+
? `${parseFloat(val) / base}rem`
|
|
14
|
+
: val
|
|
15
|
+
})
|
|
18
16
|
}
|
|
19
17
|
|
|
20
|
-
export default {
|
|
18
|
+
export default {
|
|
21
19
|
inserted: handler,
|
|
22
20
|
update: handler,
|
|
23
21
|
componentUpdated: handler
|
|
24
|
-
}
|
|
22
|
+
}
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
})
|
|
61
61
|
}
|
|
62
62
|
}"
|
|
63
|
-
@pageSizeChange="
|
|
63
|
+
@pageSizeChange="onListPageBHandler"
|
|
64
64
|
>
|
|
65
65
|
<span class="Table__Name" slot="ATableTitle">已选{{title}}列表</span>
|
|
66
66
|
<template #action="{customProps, index}">
|
|
@@ -216,12 +216,12 @@ export default {
|
|
|
216
216
|
},
|
|
217
217
|
|
|
218
218
|
// 获取右侧表格数据(从已选记录中分页)
|
|
219
|
-
onListPageBHandler() {
|
|
219
|
+
onListPageBHandler(paginationB) {
|
|
220
220
|
try {
|
|
221
221
|
const chunks = chunkArray(this.selectedRecordsB, this.listPaginationB.size)
|
|
222
222
|
this.listPaginationB = {
|
|
223
223
|
...this.listPaginationB,
|
|
224
|
-
current: chunks.length,
|
|
224
|
+
...(paginationB || { current: chunks.length }),
|
|
225
225
|
total: this.selectedRecordsB.length
|
|
226
226
|
}
|
|
227
227
|
this.listDatasB = chunks[this.listPaginationB.current - 1] || []
|
package/package.json
CHANGED
package/utils/Filter.js
CHANGED
|
@@ -589,21 +589,18 @@ function transferDataByMap(data, formatMap, options) {
|
|
|
589
589
|
* 查找字符串中第 n 次出现的位置
|
|
590
590
|
* @param {string} str - 源字符串
|
|
591
591
|
* @param {string} charToFind - 查找字符
|
|
592
|
-
* @param {number} n -
|
|
592
|
+
* @param {number} n - 第几次出现
|
|
593
593
|
* @returns {number} 位置索引,未找到返回 -1
|
|
594
594
|
*/
|
|
595
595
|
export function findNthOccurrence(str, charToFind, n) {
|
|
596
|
-
if (n < 1) return -1
|
|
597
|
-
|
|
598
|
-
let index = -1
|
|
599
596
|
let count = 0
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
597
|
+
let index = str.indexOf(charToFind)
|
|
598
|
+
|
|
599
|
+
while (count < n && index !== -1) {
|
|
600
|
+
index = str.indexOf(charToFind, index + 1)
|
|
601
|
+
count++
|
|
605
602
|
}
|
|
606
|
-
|
|
603
|
+
|
|
607
604
|
return index
|
|
608
605
|
}
|
|
609
606
|
|