zartui 2.0.7 → 2.0.9
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/es/dialog/Dialog.js +8 -2
- package/es/dialog/index.css +1 -1
- package/es/dialog/index.less +6 -0
- package/es/index.js +4 -3
- package/es/pdf-viewer-v2/index.css +1 -0
- package/es/pdf-viewer-v2/index.js +333 -0
- package/es/pdf-viewer-v2/index.less +44 -0
- package/es/pdf-viewer-v2/style/index.js +10 -0
- package/es/pdf-viewer-v2/style/less.js +10 -0
- package/es/rate/index.css +1 -1
- package/es/rate/index.js +4 -0
- package/es/rate/index.less +17 -17
- package/es/style/var.less +3 -3
- package/lib/dialog/Dialog.js +8 -2
- package/lib/dialog/index.css +1 -1
- package/lib/dialog/index.less +6 -0
- package/lib/index.css +1 -1
- package/lib/index.js +6 -2
- package/lib/index.less +1 -0
- package/lib/pdf-viewer-v2/index.css +1 -0
- package/lib/pdf-viewer-v2/index.js +345 -0
- package/lib/pdf-viewer-v2/index.less +44 -0
- package/lib/pdf-viewer-v2/style/index.js +10 -0
- package/lib/pdf-viewer-v2/style/less.js +10 -0
- package/lib/rate/index.css +1 -1
- package/lib/rate/index.js +4 -0
- package/lib/rate/index.less +17 -17
- package/lib/style/var.less +3 -3
- package/lib/zart.js +12730 -11481
- package/lib/zart.min.js +11 -11
- package/package.json +2 -1
package/es/dialog/Dialog.js
CHANGED
|
@@ -102,7 +102,11 @@ export default createComponent({
|
|
|
102
102
|
var _this2 = this;
|
|
103
103
|
|
|
104
104
|
var h = this.$createElement;
|
|
105
|
-
|
|
105
|
+
|
|
106
|
+
if (!this.showCancelButton && !this.showConfirmButton) {
|
|
107
|
+
return "";
|
|
108
|
+
}
|
|
109
|
+
|
|
106
110
|
return h("div", {
|
|
107
111
|
"class": bem('footer')
|
|
108
112
|
}, [this.showCancelButton && h(Button, {
|
|
@@ -206,7 +210,9 @@ export default createComponent({
|
|
|
206
210
|
"role": "dialog",
|
|
207
211
|
"aria-labelledby": this.title || message
|
|
208
212
|
},
|
|
209
|
-
"class": [bem([this.theme]), this.className
|
|
213
|
+
"class": [bem([this.theme]), this.className, {
|
|
214
|
+
"has-button": this.showCancelButton || this.showConfirmButton
|
|
215
|
+
}],
|
|
210
216
|
"style": {
|
|
211
217
|
width: addUnit(this.width)
|
|
212
218
|
}
|
package/es/dialog/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.zt-dialog{position:fixed;top:45%;left:50%;width:327px;overflow:hidden;font-size:16px;background-color:#fff;border-radius:12px;-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0);-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transition:.3s;transition:.3s;-webkit-transition-property:opacity,-webkit-transform;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform}@media (max-width:328px){.zt-dialog{width:90%}}.zt-dialog__header{padding-top:24px;font-weight:700;line-height:24px;text-align:center;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;word-break:break-all;padding-left:16px;padding-right:16px}.zt-dialog__header--isolated{padding:24px 0}.zt-dialog__header--custom-title{height:44px;padding-left:0;padding-right:0;padding-top:0}.zt-dialog__content{text-align:center;word-break:break-all}.zt-dialog__content--isolated{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;min-height:100px}.zt-dialog__message{max-height:60vh;padding:24px 16px;overflow-y:auto;font-size:16px;line-height:20px;color:rgba(0,0,0,.6);display:inline-block;text-align:left;white-space:pre-wrap;word-wrap:break-word;-webkit-overflow-scrolling:touch}.zt-dialog__message--has-title{padding-top:8px;font-size:14px}.zt-dialog__message--left{text-align:left}.zt-dialog__message--right{text-align:right}.zt-dialog__footer{overflow:hidden;-webkit-user-select:none;user-select:none;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;height:44px;padding:
|
|
1
|
+
.zt-dialog{position:fixed;top:45%;left:50%;width:327px;overflow:hidden;font-size:16px;background-color:#fff;border-radius:12px;-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0);-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transition:.3s;transition:.3s;-webkit-transition-property:opacity,-webkit-transform;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform}@media (max-width:328px){.zt-dialog{width:90%}}.zt-dialog__header{padding-top:24px;font-weight:700;line-height:24px;text-align:center;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;word-break:break-all;padding-left:16px;padding-right:16px}.zt-dialog__header--isolated{padding:24px 0}.zt-dialog__header--custom-title{height:44px;padding-left:0;padding-right:0;padding-top:0}.zt-dialog__content{text-align:center;word-break:break-all}.zt-dialog__content--isolated{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;min-height:100px}.zt-dialog.has-button .zt-dialog__message{padding-bottom:0}.zt-dialog__message{max-height:60vh;padding:24px 16px;overflow-y:auto;font-size:16px;line-height:20px;color:rgba(0,0,0,.6);display:inline-block;text-align:left;white-space:pre-wrap;word-wrap:break-word;-webkit-overflow-scrolling:touch}.zt-dialog__message--has-title{padding-top:8px;font-size:14px}.zt-dialog__message--left{text-align:left}.zt-dialog__message--right{text-align:right}.zt-dialog__footer{overflow:hidden;-webkit-user-select:none;user-select:none;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;height:44px;padding:24px 32px;position:relative;box-sizing:content-box}.zt-dialog-bounce-enter{-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7);opacity:0}.zt-dialog-bounce-leave-active{-webkit-transform:translate3d(-50%,-50%,0) scale(.9);transform:translate3d(-50%,-50%,0) scale(.9);opacity:0}
|
package/es/dialog/index.less
CHANGED
package/es/index.js
CHANGED
|
@@ -45,6 +45,7 @@ import NumberKeyboard from './number-keyboard';
|
|
|
45
45
|
import Overlay from './overlay';
|
|
46
46
|
import PasswordInput from './password-input';
|
|
47
47
|
import PdfViewer from './pdf-viewer';
|
|
48
|
+
import PdfViewerV2 from './pdf-viewer-v2';
|
|
48
49
|
import Picker from './picker';
|
|
49
50
|
import Popover from './popover';
|
|
50
51
|
import Popup from './popup';
|
|
@@ -75,10 +76,10 @@ import Tag from './tag';
|
|
|
75
76
|
import Timeline from './timeline';
|
|
76
77
|
import Toast from './toast';
|
|
77
78
|
import Uploader from './uploader';
|
|
78
|
-
var version = '2.0.
|
|
79
|
+
var version = '2.0.9';
|
|
79
80
|
|
|
80
81
|
function install(Vue) {
|
|
81
|
-
var components = [ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Grid, GridItem, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MediaPicker, MediaPlayer, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, PdfViewer, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, Timeline, Toast, Uploader];
|
|
82
|
+
var components = [ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Grid, GridItem, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MediaPicker, MediaPlayer, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, PdfViewer, PdfViewerV2, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, Timeline, Toast, Uploader];
|
|
82
83
|
components.forEach(function (item) {
|
|
83
84
|
if (item.install) {
|
|
84
85
|
Vue.use(item);
|
|
@@ -92,7 +93,7 @@ if (typeof window !== 'undefined' && window.Vue) {
|
|
|
92
93
|
install(window.Vue);
|
|
93
94
|
}
|
|
94
95
|
|
|
95
|
-
export { install, version, ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Grid, GridItem, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MediaPicker, MediaPlayer, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, PdfViewer, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, Timeline, Toast, Uploader };
|
|
96
|
+
export { install, version, ActionSheet, Area, Avatar, BackTop, Badge, Button, Calendar, Cascader, Cell, CellGroup, Checkbox, CheckboxGroup, Col, Collapse, CollapseItem, CountDown, DatetimePicker, Dialog, Divider, DropdownItem, DropdownMenu, Empty, Field, FoldDialog, Form, Grid, GridItem, HierarchySelect, Icon, Image, ImagePreview, IndexAnchor, IndexBar, Info, Lazyload, List, Loading, Locale, MediaPicker, MediaPlayer, MultiplePicker, NavBar, NoticeBar, NumberKeyboard, Overlay, PasswordInput, PdfViewer, PdfViewerV2, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, Timeline, Toast, Uploader };
|
|
96
97
|
export default {
|
|
97
98
|
install: install,
|
|
98
99
|
version: version
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.zt-pdf-viewer-v2{width:100%;height:100%;position:relative;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column}.zt-pdf-viewer-v2__inner-container{-webkit-box-flex:1;-webkit-flex:1;flex:1;overflow:scroll}.zt-pdf-viewer-v2::-webkit-scrollbar{width:0;height:0}.zt-pdf-viewer-v2__page-box{width:100%;height:44px;background-color:#fff;text-align:center;font-size:16px;line-height:44px}.zt-pdf-viewer-v2__page-box .zt-pdf-viewer-v2__next,.zt-pdf-viewer-v2__page-box .zt-pdf-viewer-v2__pre{cursor:pointer;color:#3a90f6}.zt-pdf-viewer-v2__page-box .zt-pdf-viewer-v2__page{margin:0 10px}.zt-pdf-viewer-v2 .zt-loading{position:absolute;top:50%;left:50%;margin-left:-18px;margin-top:-18px}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { createNamespace } from '../utils';
|
|
2
|
+
|
|
3
|
+
var _createNamespace = createNamespace('pdf-viewer-v2'),
|
|
4
|
+
createComponent = _createNamespace[0],
|
|
5
|
+
bem = _createNamespace[1];
|
|
6
|
+
|
|
7
|
+
import Toast from '../toast';
|
|
8
|
+
import Loading from '../loading';
|
|
9
|
+
import Picker from '../picker';
|
|
10
|
+
import { resetObject } from "../utils/index";
|
|
11
|
+
|
|
12
|
+
var _ = require('lodash');
|
|
13
|
+
|
|
14
|
+
var defaultData = function defaultData() {
|
|
15
|
+
return {
|
|
16
|
+
pdfDocRef: null,
|
|
17
|
+
totalPage: 0,
|
|
18
|
+
currentPage: 1,
|
|
19
|
+
loading: false,
|
|
20
|
+
PDFJS: null,
|
|
21
|
+
pageChangeByButton: false,
|
|
22
|
+
showPicker: false
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export default createComponent({
|
|
27
|
+
props: {
|
|
28
|
+
/**
|
|
29
|
+
* pdf地址
|
|
30
|
+
*/
|
|
31
|
+
pdfUrl: {
|
|
32
|
+
type: String,
|
|
33
|
+
default: ""
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* cMap的url地址(用于解决中文乱码或中文显示为空白的问题). 该资源的物理路径在: node_modules/pdfjs-dist/cmaps
|
|
38
|
+
*/
|
|
39
|
+
cMapUrl: {
|
|
40
|
+
type: String,
|
|
41
|
+
default: ""
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 携带的特定http请求头
|
|
46
|
+
*/
|
|
47
|
+
httpHeaders: {
|
|
48
|
+
type: Object,
|
|
49
|
+
default: function _default() {
|
|
50
|
+
return {};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
data: function data() {
|
|
55
|
+
return defaultData();
|
|
56
|
+
},
|
|
57
|
+
mounted: function mounted() {
|
|
58
|
+
this.reset();
|
|
59
|
+
this.renderPdf();
|
|
60
|
+
},
|
|
61
|
+
deactivated: function deactivated() {
|
|
62
|
+
this.pdfDocRef.destroy();
|
|
63
|
+
},
|
|
64
|
+
computed: {
|
|
65
|
+
urlObj: function urlObj() {
|
|
66
|
+
return {
|
|
67
|
+
pdfUrl: this.pdfUrl,
|
|
68
|
+
cMapUrl: this.cMapUrl
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
watch: {
|
|
73
|
+
urlObj: function urlObj() {
|
|
74
|
+
this.reset();
|
|
75
|
+
this.renderPdf();
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
methods: {
|
|
79
|
+
reset: function reset() {
|
|
80
|
+
resetObject(this, defaultData());
|
|
81
|
+
},
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* 渲染pdf文件的指定页到画板
|
|
85
|
+
* @param pdfViewerDom 承载pdf画板的dom容器
|
|
86
|
+
* @param pdfDoc pdf文件
|
|
87
|
+
* @param pageNum 需要渲染的页码
|
|
88
|
+
*/
|
|
89
|
+
renderPdfOnePage: function renderPdfOnePage(pdfViewerDom, pdfDoc, pageNum) {
|
|
90
|
+
var _this = this;
|
|
91
|
+
|
|
92
|
+
// 创建画布
|
|
93
|
+
var canvas = document.createElement("canvas");
|
|
94
|
+
canvas.id = "pdfCanvas" + pageNum;
|
|
95
|
+
pdfViewerDom.appendChild(canvas); // 获取2d上下文
|
|
96
|
+
|
|
97
|
+
var context = canvas.getContext("2d");
|
|
98
|
+
pdfDoc.getPage(pageNum).then(function (page) {
|
|
99
|
+
// 获取当前pdf页内容, 并设置缩放
|
|
100
|
+
var viewport = page.getViewport({
|
|
101
|
+
scale: 1
|
|
102
|
+
});
|
|
103
|
+
var width = viewport.width;
|
|
104
|
+
|
|
105
|
+
_this.$nextTick(function () {
|
|
106
|
+
var containerWidth = _this.$refs.pdfContainer.offsetWidth;
|
|
107
|
+
var ratio = containerWidth / width;
|
|
108
|
+
viewport = page.getViewport({
|
|
109
|
+
scale: ratio
|
|
110
|
+
}); // @ts-ignore
|
|
111
|
+
|
|
112
|
+
var realCanvas = context.canvas;
|
|
113
|
+
realCanvas.width = viewport.width;
|
|
114
|
+
realCanvas.height = viewport.height; // 将pdf当前页内容画到2d画板中
|
|
115
|
+
// @ts-ignore
|
|
116
|
+
|
|
117
|
+
page.render({
|
|
118
|
+
canvasContext: context,
|
|
119
|
+
viewport: viewport
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* 渲染pdf的画布
|
|
127
|
+
* @param pdfViewerDom 承载pdf画布的dom容器
|
|
128
|
+
* @param pdfDoc pdf文档
|
|
129
|
+
*/
|
|
130
|
+
renderPdfCanvas: function renderPdfCanvas(pdfViewerDom, pdfDoc) {
|
|
131
|
+
var _this2 = this;
|
|
132
|
+
|
|
133
|
+
// 清除原来的pdf画布
|
|
134
|
+
pdfViewerDom.innerHTML = ""; // 获取总页数
|
|
135
|
+
|
|
136
|
+
this.totalPage = pdfDoc.numPages;
|
|
137
|
+
this.loading = false; // 获取显示容器
|
|
138
|
+
|
|
139
|
+
for (var i = 1; i <= this.totalPage; i++) {
|
|
140
|
+
// 循环处理pdf的每页
|
|
141
|
+
this.renderPdfOnePage(pdfViewerDom, pdfDoc, i);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
this.$nextTick(function () {
|
|
145
|
+
_this2.bindScrollEvent();
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
bindScrollEvent: function bindScrollEvent() {
|
|
149
|
+
var _this3 = this;
|
|
150
|
+
|
|
151
|
+
var element = document.getElementById("pdfContainer");
|
|
152
|
+
|
|
153
|
+
var scrollEvent = _.throttle(function () {
|
|
154
|
+
if (_this3.pageChangeByButton) {
|
|
155
|
+
_this3.pageChangeByButton = false;
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (element.scrollTop === 0) {
|
|
160
|
+
_this3.currentPage = 1;
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
var i = 1,
|
|
165
|
+
count = _this3.totalPage;
|
|
166
|
+
var offsetHeight = element.offsetHeight;
|
|
167
|
+
|
|
168
|
+
do {
|
|
169
|
+
var start = _this3.findPos(document.getElementById("pdfCanvas" + i));
|
|
170
|
+
|
|
171
|
+
var end = start + document.getElementById("pdfCanvas" + i).offsetHeight;
|
|
172
|
+
|
|
173
|
+
if (element.scrollTop + offsetHeight >= start && element.scrollTop + offsetHeight <= end) {
|
|
174
|
+
_this3.currentPage = i;
|
|
175
|
+
break;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
if (i === count && element.scrollTop + offsetHeight > end) {
|
|
179
|
+
_this3.currentPage = i;
|
|
180
|
+
break;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
i++;
|
|
184
|
+
} while (i < count + 1);
|
|
185
|
+
}, 500);
|
|
186
|
+
|
|
187
|
+
element.addEventListener("scroll", function () {
|
|
188
|
+
scrollEvent();
|
|
189
|
+
});
|
|
190
|
+
},
|
|
191
|
+
findPos: function findPos(obj) {
|
|
192
|
+
if (obj) {
|
|
193
|
+
return obj.offsetTop;
|
|
194
|
+
} else {
|
|
195
|
+
return 0;
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
renderPdf: function renderPdf() {
|
|
199
|
+
var _this4 = this;
|
|
200
|
+
|
|
201
|
+
if (!this.PDFJS) {
|
|
202
|
+
this.PDFJS = window['pdfjs-dist/build/pdf'] || window.pdfjsLib;
|
|
203
|
+
|
|
204
|
+
if (this.PDFJS && this.PDFJS.GlobalWorkerOptions) {
|
|
205
|
+
this.PDFJS.GlobalWorkerOptions.workerSrc = require("pdfjs-dist/build/pdf.worker.entry");
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
this.loading = true;
|
|
210
|
+
var pdfViewerDom = this.$refs.pdfViewerContainer;
|
|
211
|
+
|
|
212
|
+
if (this.pdfUrl) {
|
|
213
|
+
// 获取pdf文件
|
|
214
|
+
var pdfLoadingTask = this.PDFJS.getDocument({
|
|
215
|
+
url: this.pdfUrl,
|
|
216
|
+
withCredentials: true,
|
|
217
|
+
// 携带凭证
|
|
218
|
+
httpHeaders: this.httpHeaders,
|
|
219
|
+
cMapUrl: this.cMapUrl,
|
|
220
|
+
cMapPacked: true
|
|
221
|
+
});
|
|
222
|
+
pdfLoadingTask.promise.then(function (pdfDoc) {
|
|
223
|
+
if (pdfDoc && pdfViewerDom) {
|
|
224
|
+
// 缓存pdf内容
|
|
225
|
+
_this4.pdfDocRef = pdfDoc;
|
|
226
|
+
|
|
227
|
+
_this4.renderPdfCanvas(pdfViewerDom, pdfDoc);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
changePage: function changePage(page) {
|
|
233
|
+
if (page < 1) {
|
|
234
|
+
Toast("已经是首页");
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
if (page > this.totalPage) {
|
|
239
|
+
Toast("已经是最后一页");
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
this.pageChangeByButton = true;
|
|
244
|
+
|
|
245
|
+
if (document.getElementById("pdfCanvas" + page)) {
|
|
246
|
+
document.getElementById("pdfCanvas" + page).scrollIntoView({
|
|
247
|
+
block: "end",
|
|
248
|
+
inline: "nearest"
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
this.currentPage = page;
|
|
253
|
+
},
|
|
254
|
+
clickPre: function clickPre() {
|
|
255
|
+
this.changePage(this.currentPage - 1);
|
|
256
|
+
},
|
|
257
|
+
clickNext: function clickNext() {
|
|
258
|
+
this.changePage(this.currentPage + 1);
|
|
259
|
+
},
|
|
260
|
+
showPagePicker: function showPagePicker() {
|
|
261
|
+
this.showPicker = true;
|
|
262
|
+
},
|
|
263
|
+
setPage: function setPage(i) {
|
|
264
|
+
this.changePage(i);
|
|
265
|
+
this.showPicker = false;
|
|
266
|
+
},
|
|
267
|
+
cancel: function cancel() {
|
|
268
|
+
this.showPicker = false;
|
|
269
|
+
},
|
|
270
|
+
getPageList: function getPageList() {
|
|
271
|
+
var total = this.totalPage;
|
|
272
|
+
var arr = [];
|
|
273
|
+
|
|
274
|
+
for (var i = 1; i <= total; i++) {
|
|
275
|
+
arr.push(i);
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return arr;
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
render: function render(h) {
|
|
282
|
+
return h("div", {
|
|
283
|
+
"class": bem(),
|
|
284
|
+
"ref": "pdfContainer"
|
|
285
|
+
}, [h("div", {
|
|
286
|
+
"class": bem("inner-container"),
|
|
287
|
+
"attrs": {
|
|
288
|
+
"id": "pdfContainer"
|
|
289
|
+
}
|
|
290
|
+
}, [h(Loading, {
|
|
291
|
+
"directives": [{
|
|
292
|
+
name: "show",
|
|
293
|
+
value: this.loading
|
|
294
|
+
}],
|
|
295
|
+
"class": bem('loading-icon')
|
|
296
|
+
}), h("div", {
|
|
297
|
+
"directives": [{
|
|
298
|
+
name: "show",
|
|
299
|
+
value: !this.loading
|
|
300
|
+
}],
|
|
301
|
+
"ref": "pdfViewerContainer",
|
|
302
|
+
"class": bem("container")
|
|
303
|
+
})]), this.totalPage ? h("div", {
|
|
304
|
+
"class": bem("page-box")
|
|
305
|
+
}, [h("span", {
|
|
306
|
+
"class": bem("pre"),
|
|
307
|
+
"on": {
|
|
308
|
+
"click": this.clickPre
|
|
309
|
+
}
|
|
310
|
+
}, ["<"]), h("span", {
|
|
311
|
+
"class": bem("page"),
|
|
312
|
+
"on": {
|
|
313
|
+
"click": this.showPagePicker
|
|
314
|
+
}
|
|
315
|
+
}, [this.currentPage, " / ", this.totalPage]), h("span", {
|
|
316
|
+
"class": bem("next"),
|
|
317
|
+
"on": {
|
|
318
|
+
"click": this.clickNext
|
|
319
|
+
}
|
|
320
|
+
}, [">"])]) : h(), h(Picker, {
|
|
321
|
+
"attrs": {
|
|
322
|
+
"show-picker": this.showPicker,
|
|
323
|
+
"default-index": this.currentPage - 1,
|
|
324
|
+
"title": "页码",
|
|
325
|
+
"columns": this.getPageList()
|
|
326
|
+
},
|
|
327
|
+
"on": {
|
|
328
|
+
"cancel": this.cancel,
|
|
329
|
+
"confirm": this.setPage
|
|
330
|
+
}
|
|
331
|
+
})]);
|
|
332
|
+
}
|
|
333
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
@import '../style/var';
|
|
2
|
+
.zt-pdf-viewer-v2 {
|
|
3
|
+
width: 100%;
|
|
4
|
+
height: 100%;
|
|
5
|
+
position: relative;
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
|
|
9
|
+
&__inner-container {
|
|
10
|
+
flex: 1;
|
|
11
|
+
overflow: scroll;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&::-webkit-scrollbar {
|
|
15
|
+
width: 0;
|
|
16
|
+
height: 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&__page-box {
|
|
20
|
+
width: 100%;
|
|
21
|
+
height: 44px;
|
|
22
|
+
background-color: #fff;
|
|
23
|
+
text-align: center;
|
|
24
|
+
font-size: 16px;
|
|
25
|
+
line-height: 44px;
|
|
26
|
+
|
|
27
|
+
.zt-pdf-viewer-v2__pre, .zt-pdf-viewer-v2__next {
|
|
28
|
+
cursor: pointer;
|
|
29
|
+
color: #3a90f6;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.zt-pdf-viewer-v2__page {
|
|
33
|
+
margin: 0 10px;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.zt-loading {
|
|
38
|
+
position: absolute;
|
|
39
|
+
top: 50%;
|
|
40
|
+
left: 50%;
|
|
41
|
+
margin-left: -18px;
|
|
42
|
+
margin-top: -18px;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import '../../style/base.css';
|
|
2
|
+
import '../../overlay/index.css';
|
|
3
|
+
import '../../info/index.css';
|
|
4
|
+
import '../../icon/index.css';
|
|
5
|
+
import '../../popup/index.css';
|
|
6
|
+
import '../../loading/index.css';
|
|
7
|
+
import '../../toast/index.css';
|
|
8
|
+
import '../../button/index.css';
|
|
9
|
+
import '../../picker/index.css';
|
|
10
|
+
import '../index.css';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import '../../style/base.less';
|
|
2
|
+
import '../../overlay/index.less';
|
|
3
|
+
import '../../info/index.less';
|
|
4
|
+
import '../../icon/index.less';
|
|
5
|
+
import '../../popup/index.less';
|
|
6
|
+
import '../../loading/index.less';
|
|
7
|
+
import '../../toast/index.less';
|
|
8
|
+
import '../../button/index.less';
|
|
9
|
+
import '../../picker/index.less';
|
|
10
|
+
import '../index.less';
|
package/es/rate/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.zt-rate{display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;cursor:pointer;-webkit-user-select:none;user-select:none}.zt-rate__item{position:relative}.zt-rate__item:not(:last-child){padding-right:4px}.zt-rate__icon{display:block;width:1em;color:rgba(
|
|
1
|
+
.zt-rate{display:-webkit-inline-box;display:-webkit-inline-flex;display:inline-flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;cursor:pointer;-webkit-user-select:none;user-select:none}.zt-rate .zt-rate__item{position:relative}.zt-rate .zt-rate__item .zt-rate__item:not(:last-child){padding-right:4px}.zt-rate .zt-rate__item .zt-rate__icon{display:block;width:1em;color:rgba(45,75,115,.2);font-size:24px}.zt-rate .zt-rate__item .zt-rate__icon--half{position:absolute;top:0;left:0;width:.5em;overflow:hidden}.zt-rate .zt-rate__item .zt-rate__icon--full{color:#ffcd23}.zt-rate .zt-rate__item .zt-rate__icon--disabled{color:#c8c9cc}.zt-rate .zt-rate--disabled{cursor:not-allowed}.zt-rate .zt-rate--readonly{cursor:default}
|
package/es/rate/index.js
CHANGED
package/es/rate/index.less
CHANGED
|
@@ -6,42 +6,42 @@
|
|
|
6
6
|
cursor: pointer;
|
|
7
7
|
user-select: none;
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
.zt-rate__item {
|
|
10
10
|
position: relative;
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
.zt-rate__item:not(:last-child) {
|
|
13
13
|
padding-right: @rate-icon-gutter;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
&--half {
|
|
15
|
+
.zt-rate__icon {
|
|
16
|
+
display: block;
|
|
17
|
+
width: 1em;
|
|
18
|
+
color: @rate-icon-void-color;
|
|
19
|
+
font-size: @rate-icon-size;
|
|
20
|
+
|
|
21
|
+
}
|
|
22
|
+
.zt-rate__icon--half {
|
|
24
23
|
position: absolute;
|
|
25
24
|
top: 0;
|
|
26
25
|
left: 0;
|
|
27
26
|
width: 0.5em;
|
|
28
27
|
overflow: hidden;
|
|
29
28
|
}
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
|
|
30
|
+
.zt-rate__icon--full {
|
|
32
31
|
color: @rate-icon-full-color;
|
|
33
32
|
}
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
|
|
34
|
+
.zt-rate__icon--disabled {
|
|
36
35
|
color: @rate-icon-disabled-color;
|
|
37
36
|
}
|
|
38
37
|
}
|
|
39
38
|
|
|
40
|
-
|
|
39
|
+
|
|
40
|
+
.zt-rate--disabled {
|
|
41
41
|
cursor: not-allowed;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
.zt-rate--readonly {
|
|
45
45
|
cursor: default;
|
|
46
46
|
}
|
|
47
47
|
}
|
package/es/style/var.less
CHANGED
|
@@ -408,7 +408,7 @@
|
|
|
408
408
|
@dialog-button-height: 44px;
|
|
409
409
|
@dialog-round-button-height: 36px;
|
|
410
410
|
@dialog-confirm-button-text-color: @blue;
|
|
411
|
-
@dialog-footer-padding:
|
|
411
|
+
@dialog-footer-padding: 24px 32px;
|
|
412
412
|
|
|
413
413
|
// Divider
|
|
414
414
|
@divider-margin: @padding-md 0;
|
|
@@ -744,9 +744,9 @@
|
|
|
744
744
|
@radio-disabled-background-color: @gradient-white;
|
|
745
745
|
|
|
746
746
|
// Rate
|
|
747
|
-
@rate-icon-size:
|
|
747
|
+
@rate-icon-size: 24px;
|
|
748
748
|
@rate-icon-gutter: @padding-base;
|
|
749
|
-
@rate-icon-void-color:
|
|
749
|
+
@rate-icon-void-color: rgba(45, 75, 115, .2);
|
|
750
750
|
@rate-icon-full-color: @yellow;
|
|
751
751
|
@rate-icon-disabled-color: @gray-5;
|
|
752
752
|
|
package/lib/dialog/Dialog.js
CHANGED
|
@@ -113,7 +113,11 @@ var _default = createComponent({
|
|
|
113
113
|
var _this2 = this;
|
|
114
114
|
|
|
115
115
|
var h = this.$createElement;
|
|
116
|
-
|
|
116
|
+
|
|
117
|
+
if (!this.showCancelButton && !this.showConfirmButton) {
|
|
118
|
+
return "";
|
|
119
|
+
}
|
|
120
|
+
|
|
117
121
|
return h("div", {
|
|
118
122
|
"class": bem('footer')
|
|
119
123
|
}, [this.showCancelButton && h(_button.default, {
|
|
@@ -217,7 +221,9 @@ var _default = createComponent({
|
|
|
217
221
|
"role": "dialog",
|
|
218
222
|
"aria-labelledby": this.title || message
|
|
219
223
|
},
|
|
220
|
-
"class": [bem([this.theme]), this.className
|
|
224
|
+
"class": [bem([this.theme]), this.className, {
|
|
225
|
+
"has-button": this.showCancelButton || this.showConfirmButton
|
|
226
|
+
}],
|
|
221
227
|
"style": {
|
|
222
228
|
width: (0, _utils.addUnit)(this.width)
|
|
223
229
|
}
|
package/lib/dialog/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.zt-dialog{position:fixed;top:45%;left:50%;width:327px;overflow:hidden;font-size:16px;background-color:#fff;border-radius:12px;-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0);-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transition:.3s;transition:.3s;-webkit-transition-property:opacity,-webkit-transform;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform}@media (max-width:328px){.zt-dialog{width:90%}}.zt-dialog__header{padding-top:24px;font-weight:700;line-height:24px;text-align:center;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;word-break:break-all;padding-left:16px;padding-right:16px}.zt-dialog__header--isolated{padding:24px 0}.zt-dialog__header--custom-title{height:44px;padding-left:0;padding-right:0;padding-top:0}.zt-dialog__content{text-align:center;word-break:break-all}.zt-dialog__content--isolated{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;min-height:100px}.zt-dialog__message{max-height:60vh;padding:24px 16px;overflow-y:auto;font-size:16px;line-height:20px;color:rgba(0,0,0,.6);display:inline-block;text-align:left;white-space:pre-wrap;word-wrap:break-word;-webkit-overflow-scrolling:touch}.zt-dialog__message--has-title{padding-top:8px;font-size:14px}.zt-dialog__message--left{text-align:left}.zt-dialog__message--right{text-align:right}.zt-dialog__footer{overflow:hidden;-webkit-user-select:none;user-select:none;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;height:44px;padding:
|
|
1
|
+
.zt-dialog{position:fixed;top:45%;left:50%;width:327px;overflow:hidden;font-size:16px;background-color:#fff;border-radius:12px;-webkit-transform:translate3d(-50%,-50%,0);transform:translate3d(-50%,-50%,0);-webkit-backface-visibility:hidden;backface-visibility:hidden;-webkit-transition:.3s;transition:.3s;-webkit-transition-property:opacity,-webkit-transform;transition-property:opacity,-webkit-transform;transition-property:transform,opacity;transition-property:transform,opacity,-webkit-transform}@media (max-width:328px){.zt-dialog{width:90%}}.zt-dialog__header{padding-top:24px;font-weight:700;line-height:24px;text-align:center;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;word-break:break-all;padding-left:16px;padding-right:16px}.zt-dialog__header--isolated{padding:24px 0}.zt-dialog__header--custom-title{height:44px;padding-left:0;padding-right:0;padding-top:0}.zt-dialog__content{text-align:center;word-break:break-all}.zt-dialog__content--isolated{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;justify-content:center;min-height:100px}.zt-dialog.has-button .zt-dialog__message{padding-bottom:0}.zt-dialog__message{max-height:60vh;padding:24px 16px;overflow-y:auto;font-size:16px;line-height:20px;color:rgba(0,0,0,.6);display:inline-block;text-align:left;white-space:pre-wrap;word-wrap:break-word;-webkit-overflow-scrolling:touch}.zt-dialog__message--has-title{padding-top:8px;font-size:14px}.zt-dialog__message--left{text-align:left}.zt-dialog__message--right{text-align:right}.zt-dialog__footer{overflow:hidden;-webkit-user-select:none;user-select:none;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;height:44px;padding:24px 32px;position:relative;box-sizing:content-box}.zt-dialog-bounce-enter{-webkit-transform:translate3d(-50%,-50%,0) scale(.7);transform:translate3d(-50%,-50%,0) scale(.7);opacity:0}.zt-dialog-bounce-leave-active{-webkit-transform:translate3d(-50%,-50%,0) scale(.9);transform:translate3d(-50%,-50%,0) scale(.9);opacity:0}
|