ai.touchui-vue 1.39.0 → 1.40.1
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/lib/ai.touchui-vue.common.js +237 -176
- package/lib/date-picker.js +7 -7
- package/lib/filter.js +6 -4
- package/lib/index.js +1 -1
- package/lib/input.js +3 -3
- package/lib/slide.js +62 -33
- package/lib/table.js +112 -96
- package/lib/utils/print.js +21 -7
- package/package.json +1 -1
- package/packages/date-picker/src/date-picker.vue +1 -1
- package/packages/filter/src/filter.vue +4 -2
- package/packages/input/src/input.vue +1 -1
- package/packages/slide/src/slide.vue +31 -10
- package/packages/table/src/table.vue +17 -5
- package/src/index.js +1 -1
- package/src/utils/print.js +21 -7
package/lib/utils/print.js
CHANGED
|
@@ -8,10 +8,26 @@ exports.default = function (areaId, title) {
|
|
|
8
8
|
pwin.document.write(replaceBodyContent(getBody(areaId).join('')));
|
|
9
9
|
pwin.document.close();
|
|
10
10
|
pwin.document.documentElement.classList.add('s_print');
|
|
11
|
+
|
|
12
|
+
// 绑定事件(事件委托)
|
|
13
|
+
pwin.document.addEventListener('click', function (e) {
|
|
14
|
+
var target = e.target.closest('[data-action]'); // 找到带 data-action 的按钮
|
|
15
|
+
if (!target) return;
|
|
16
|
+
|
|
17
|
+
var action = target.dataset.action;
|
|
18
|
+
switch (action) {
|
|
19
|
+
case 'close':
|
|
20
|
+
pwin.window.close(); // 关闭打印窗口
|
|
21
|
+
break;
|
|
22
|
+
case 'print':
|
|
23
|
+
pwin.window.print(); // 执行 print 逻辑
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
11
28
|
if (title && typeof title === 'string') {
|
|
12
29
|
pwin.document.title = title;
|
|
13
30
|
}
|
|
14
|
-
pwin = null;
|
|
15
31
|
};
|
|
16
32
|
|
|
17
33
|
var _uuid = require('./uuid');
|
|
@@ -32,8 +48,8 @@ function getBody(areaId) {
|
|
|
32
48
|
html.push(document.getElementById(areaId).outerHTML);
|
|
33
49
|
html.push('</div></div>');
|
|
34
50
|
html.push('<div id="printFn" class="fn">\r\n');
|
|
35
|
-
html.push('<button type="button"
|
|
36
|
-
html.push('<button type="button" class="to-button to-box-link to-form-readonly to-box-color-primary to-box-mode-fill to-input-fillet-normal"
|
|
51
|
+
html.push('<button type="button" data-action="close" class="to-button to-box-link to-form-readonly to-box-color-default to-box-mode-fill to-input-fillet-normal"><span class="to-icon-close to-box-color-default"><span style="font-size: 100%;"></span></span><span class="to-buttonText to-hide-keep">关闭</span></button>');
|
|
52
|
+
html.push('<button type="button" data-action="print" class="to-button to-box-link to-form-readonly to-box-color-primary to-box-mode-fill to-input-fillet-normal"><span class="to-icon-print to-box-color-default"><span style="font-size: 100%;"></span></span><span class="to-buttonText to-hide-keep">打印2</span></button>');
|
|
37
53
|
html.push('\r\n</div>');
|
|
38
54
|
html.push('\r\n</div>');
|
|
39
55
|
return html;
|
|
@@ -44,9 +60,7 @@ function replaceBodyContent(newContent) {
|
|
|
44
60
|
var parser = new DOMParser();
|
|
45
61
|
var doc = parser.parseFromString(htmlString, 'text/html');
|
|
46
62
|
|
|
47
|
-
// 使用 DOMPurify 清理 HTML
|
|
63
|
+
// 使用 DOMPurify 清理 HTML(保留必要的安全规则)
|
|
48
64
|
doc.body.innerHTML = _dompurify2.default.sanitize(newContent);
|
|
49
|
-
|
|
50
|
-
var newHtmlString = doc.documentElement.outerHTML;
|
|
51
|
-
return newHtmlString;
|
|
65
|
+
return doc.documentElement.outerHTML;
|
|
52
66
|
}
|
package/package.json
CHANGED
|
@@ -238,7 +238,7 @@ export default {
|
|
|
238
238
|
},
|
|
239
239
|
handleDisplayBlur() {
|
|
240
240
|
setTimeout(() => {
|
|
241
|
-
if (isNaN(new Date(this.datedisplay))) {
|
|
241
|
+
if (isNaN(new Date(this.datedisplay)) || this.datedisplay.length < 8) {
|
|
242
242
|
if (this.datedisplay) {
|
|
243
243
|
this.$emit('errTime')
|
|
244
244
|
}
|
|
@@ -107,9 +107,11 @@ export default {
|
|
|
107
107
|
type.children.find(item=>{
|
|
108
108
|
return item.on
|
|
109
109
|
}).on = false
|
|
110
|
-
|
|
110
|
+
|
|
111
|
+
const el = type.children.find(item=>{
|
|
111
112
|
return item.value === val[key]
|
|
112
|
-
})
|
|
113
|
+
})
|
|
114
|
+
this.$set(el, 'on', true)
|
|
113
115
|
}
|
|
114
116
|
})
|
|
115
117
|
}
|
|
@@ -7,16 +7,33 @@
|
|
|
7
7
|
<li ref="lastFake"></li>
|
|
8
8
|
</ul>
|
|
9
9
|
</div>
|
|
10
|
-
<div v-if="length>1" class="fn">
|
|
10
|
+
<div v-if="length > 1" class="fn">
|
|
11
11
|
<span class="prev" @click="prev()"></span>
|
|
12
12
|
<span class="next" @click="next()"></span>
|
|
13
13
|
</div>
|
|
14
|
-
<div v-if="length>1" class="page">
|
|
15
|
-
<span v-for="index of length" :key="index" :class="{ 'on': index === current + 1 }" @click="jumpTo(index-1)"></span>
|
|
14
|
+
<div v-if="length > 1" class="page">
|
|
15
|
+
<span v-for="index of length" :key="index" :class="{ 'on': index === current + 1 }" @click="jumpTo(index - 1)"></span>
|
|
16
16
|
</div>
|
|
17
17
|
</div>
|
|
18
18
|
</template>
|
|
19
19
|
<script>
|
|
20
|
+
function db(fn, wait = 50) {
|
|
21
|
+
// 通过闭包缓存一个定时器 id
|
|
22
|
+
let timer = null
|
|
23
|
+
// 将 debounce 处理结果当作函数返回
|
|
24
|
+
// 触发事件回调时执行这个返回函数
|
|
25
|
+
return function(...args) {
|
|
26
|
+
// 如果已经设定过定时器就清空上一次的定时器
|
|
27
|
+
if (timer) clearTimeout(timer)
|
|
28
|
+
// 开始设定一个新的定时器,定时器结束后执行传入的函数 fn
|
|
29
|
+
timer = setTimeout(() => {
|
|
30
|
+
fn.apply(this, args)
|
|
31
|
+
|
|
32
|
+
clearTimeout(timer)
|
|
33
|
+
timer = null
|
|
34
|
+
}, wait)
|
|
35
|
+
}
|
|
36
|
+
}
|
|
20
37
|
export default {
|
|
21
38
|
name: 'ToSlide',
|
|
22
39
|
componentName: 'ToSlide',
|
|
@@ -41,6 +58,8 @@ export default {
|
|
|
41
58
|
},
|
|
42
59
|
computed: {
|
|
43
60
|
ulPosition() {
|
|
61
|
+
console.log('★')
|
|
62
|
+
console.log()
|
|
44
63
|
return (this.current + 1) * this.width * -1
|
|
45
64
|
},
|
|
46
65
|
setUlStyle() {
|
|
@@ -60,9 +79,8 @@ export default {
|
|
|
60
79
|
this.$refs.lastFake.innerHTML = this.$refs.ul.querySelector(':nth-child(2)').innerHTML
|
|
61
80
|
this.$refs.firstFake.innerHTML = this.$refs.ul.querySelector(`:nth-child(${this.length + 1})`).innerHTML
|
|
62
81
|
this.play()
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
})
|
|
82
|
+
|
|
83
|
+
window.addEventListener('resize', this.setWidth)
|
|
66
84
|
|
|
67
85
|
// 初始化 MutationObserver
|
|
68
86
|
const observer = new MutationObserver((mutations) => {
|
|
@@ -74,18 +92,21 @@ export default {
|
|
|
74
92
|
});
|
|
75
93
|
this.observer = observer;
|
|
76
94
|
|
|
77
|
-
},
|
|
95
|
+
}, 200)
|
|
78
96
|
},
|
|
79
97
|
beforeDestroy() {
|
|
80
98
|
if (this.observer) {
|
|
81
99
|
this.observer.disconnect(); // 断开监听
|
|
82
100
|
}
|
|
83
101
|
clearInterval(this.playTimer); // 清理定时器
|
|
84
|
-
window.removeEventListener('resize',
|
|
85
|
-
this.width = this.$el.offsetWidth;
|
|
86
|
-
});
|
|
102
|
+
window.removeEventListener('resize', this.setWidth);
|
|
87
103
|
},
|
|
88
104
|
methods: {
|
|
105
|
+
setWidth() {
|
|
106
|
+
db(()=>{
|
|
107
|
+
this.width = this.$el.offsetWidth
|
|
108
|
+
}, 200)()
|
|
109
|
+
},
|
|
89
110
|
play() {
|
|
90
111
|
if (!this.autoplay || this.length < 2) {
|
|
91
112
|
return
|
|
@@ -727,6 +727,12 @@ export default {
|
|
|
727
727
|
},
|
|
728
728
|
methods: {
|
|
729
729
|
init() {
|
|
730
|
+
if (Number(this.fixTop) > 0 && this.$refs.leftTable) {
|
|
731
|
+
this.$refs.leftTable.style.top = 0;
|
|
732
|
+
}
|
|
733
|
+
if (Number(this.fixTop) > 0 && this.$refs.rightTable) {
|
|
734
|
+
this.$refs.rightTable.style.top = 0;
|
|
735
|
+
}
|
|
730
736
|
if (this.$refs && this.$refs.tbody) {
|
|
731
737
|
// 监听 slot 中的 DOM 变化
|
|
732
738
|
let tbody = this.$refs.tbody.$el || this.$refs.tbody
|
|
@@ -899,8 +905,12 @@ export default {
|
|
|
899
905
|
if (this.hasVScroll()) {
|
|
900
906
|
this.$refs.top.style.width = this.$refs.body.offsetWidth - this.getBarWidth() + 'px'
|
|
901
907
|
}
|
|
902
|
-
this.$refs.topTable.style.width =
|
|
903
|
-
this.$refs.table.style.width =
|
|
908
|
+
this.$refs.topTable.style.width = ''
|
|
909
|
+
this.$refs.table.style.width = ''
|
|
910
|
+
this.$nextTick(()=>{
|
|
911
|
+
this.$refs.topTable.style.width = this.$refs.table.offsetWidth + 'px'
|
|
912
|
+
this.$refs.table.style.width = this.$refs.table.offsetWidth + 'px'
|
|
913
|
+
})
|
|
904
914
|
}
|
|
905
915
|
if (Number(this.fixRight) > 0 && this.$refs.right && this.$el) {
|
|
906
916
|
if (this.hasHScroll()) {
|
|
@@ -1022,9 +1032,11 @@ export default {
|
|
|
1022
1032
|
this.removeFromCache(this.iData[dataIndex])
|
|
1023
1033
|
}
|
|
1024
1034
|
this.setSelectAll()
|
|
1025
|
-
this.$
|
|
1026
|
-
|
|
1027
|
-
|
|
1035
|
+
this.$nextTick(()=>{
|
|
1036
|
+
this.$emit('change', this.checked, checked, current)
|
|
1037
|
+
this.$emit('selectionChange', this.selectionValueType === 'tree' ? this.buildHierarchyTree(this.checked) : this.checked, current)
|
|
1038
|
+
this.$emit('selection-change', this.selectionValueType === 'tree' ? this.buildHierarchyTree(this.checked) : this.checked, current)
|
|
1039
|
+
})
|
|
1028
1040
|
},
|
|
1029
1041
|
// 从记录中移除
|
|
1030
1042
|
removeFromCache(rowData) {
|
package/src/index.js
CHANGED
package/src/utils/print.js
CHANGED
|
@@ -7,8 +7,8 @@ function getBody(areaId) {
|
|
|
7
7
|
html.push(document.getElementById(areaId).outerHTML);
|
|
8
8
|
html.push('</div></div>');
|
|
9
9
|
html.push('<div id="printFn" class="fn">\r\n');
|
|
10
|
-
html.push('<button type="button"
|
|
11
|
-
html.push('<button type="button" class="to-button to-box-link to-form-readonly to-box-color-primary to-box-mode-fill to-input-fillet-normal"
|
|
10
|
+
html.push('<button type="button" data-action="close" class="to-button to-box-link to-form-readonly to-box-color-default to-box-mode-fill to-input-fillet-normal"><span class="to-icon-close to-box-color-default"><span style="font-size: 100%;"></span></span><span class="to-buttonText to-hide-keep">关闭</span></button>')
|
|
11
|
+
html.push('<button type="button" data-action="print" class="to-button to-box-link to-form-readonly to-box-color-primary to-box-mode-fill to-input-fillet-normal"><span class="to-icon-print to-box-color-default"><span style="font-size: 100%;"></span></span><span class="to-buttonText to-hide-keep">打印2</span></button>');
|
|
12
12
|
html.push('\r\n</div>');
|
|
13
13
|
html.push('\r\n</div>');
|
|
14
14
|
return html;
|
|
@@ -19,11 +19,9 @@ function replaceBodyContent(newContent) {
|
|
|
19
19
|
const parser = new DOMParser();
|
|
20
20
|
const doc = parser.parseFromString(htmlString, 'text/html');
|
|
21
21
|
|
|
22
|
-
// 使用 DOMPurify 清理 HTML
|
|
22
|
+
// 使用 DOMPurify 清理 HTML(保留必要的安全规则)
|
|
23
23
|
doc.body.innerHTML = DOMPurify.sanitize(newContent);
|
|
24
|
-
|
|
25
|
-
const newHtmlString = doc.documentElement.outerHTML;
|
|
26
|
-
return newHtmlString;
|
|
24
|
+
return doc.documentElement.outerHTML;
|
|
27
25
|
}
|
|
28
26
|
|
|
29
27
|
export default function(areaId, title) {
|
|
@@ -32,8 +30,24 @@ export default function(areaId, title) {
|
|
|
32
30
|
pwin.document.write(replaceBodyContent(getBody(areaId).join('')));
|
|
33
31
|
pwin.document.close();
|
|
34
32
|
pwin.document.documentElement.classList.add('s_print');
|
|
33
|
+
|
|
34
|
+
// 绑定事件(事件委托)
|
|
35
|
+
pwin.document.addEventListener('click', function(e) {
|
|
36
|
+
const target = e.target.closest('[data-action]'); // 找到带 data-action 的按钮
|
|
37
|
+
if (!target) return;
|
|
38
|
+
|
|
39
|
+
const action = target.dataset.action;
|
|
40
|
+
switch (action) {
|
|
41
|
+
case 'close':
|
|
42
|
+
pwin.window.close(); // 关闭打印窗口
|
|
43
|
+
break;
|
|
44
|
+
case 'print':
|
|
45
|
+
pwin.window.print(); // 执行 print 逻辑
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
|
|
35
50
|
if (title && typeof title === 'string') {
|
|
36
51
|
pwin.document.title = title;
|
|
37
52
|
}
|
|
38
|
-
pwin = null;
|
|
39
53
|
}
|