zartui 1.0.12 → 1.0.14
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/cascader/index.js +4 -2
- package/es/index.js +1 -1
- package/es/pdf-viewer-v2/index.css +1 -1
- package/es/pdf-viewer-v2/index.js +115 -14
- package/es/pdf-viewer-v2/index.less +1 -5
- package/es/pdf-viewer-v2/style/index.js +1 -0
- package/es/pdf-viewer-v2/style/less.js +1 -0
- package/lib/cascader/index.js +4 -2
- package/lib/index.css +1 -1
- package/lib/index.js +1 -1
- package/lib/index.less +1 -1
- package/lib/pdf-viewer-v2/index.css +1 -1
- package/lib/pdf-viewer-v2/index.js +116 -14
- package/lib/pdf-viewer-v2/index.less +1 -5
- package/lib/pdf-viewer-v2/style/index.js +1 -0
- package/lib/pdf-viewer-v2/style/less.js +1 -0
- package/lib/zart.js +24835 -24732
- package/lib/zart.min.js +11 -11
- package/package.json +1 -1
package/es/cascader/index.js
CHANGED
|
@@ -146,7 +146,9 @@ export default createComponent({
|
|
|
146
146
|
this.tabs = this.tabs.slice(0, tabIndex + 1);
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
var hasChildren = option[this.childrenKey] && option[this.childrenKey].length > 0;
|
|
150
|
+
|
|
151
|
+
if (hasChildren) {
|
|
150
152
|
var nextTab = {
|
|
151
153
|
options: option[this.childrenKey],
|
|
152
154
|
selectedOption: null
|
|
@@ -176,7 +178,7 @@ export default createComponent({
|
|
|
176
178
|
this.$emit('input', option[this.valueKey]);
|
|
177
179
|
this.$emit('change', eventParams);
|
|
178
180
|
|
|
179
|
-
if (!
|
|
181
|
+
if (!hasChildren) {
|
|
180
182
|
this.$emit('finish', eventParams);
|
|
181
183
|
}
|
|
182
184
|
},
|
package/es/index.js
CHANGED
|
@@ -76,7 +76,7 @@ import Tag from './tag';
|
|
|
76
76
|
import Timeline from './timeline';
|
|
77
77
|
import Toast from './toast';
|
|
78
78
|
import Uploader from './uploader';
|
|
79
|
-
var version = '1.0.
|
|
79
|
+
var version = '1.0.14';
|
|
80
80
|
|
|
81
81
|
function install(Vue) {
|
|
82
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];
|
|
@@ -1 +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{
|
|
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}
|
|
@@ -6,15 +6,20 @@ var _createNamespace = createNamespace('pdf-viewer-v2'),
|
|
|
6
6
|
|
|
7
7
|
import Toast from '../toast';
|
|
8
8
|
import Loading from '../loading';
|
|
9
|
+
import Picker from '../picker';
|
|
9
10
|
import { resetObject } from "../utils/index";
|
|
10
11
|
|
|
12
|
+
var _ = require('lodash');
|
|
13
|
+
|
|
11
14
|
var defaultData = function defaultData() {
|
|
12
15
|
return {
|
|
13
16
|
pdfDocRef: null,
|
|
14
17
|
totalPage: 0,
|
|
15
18
|
currentPage: 1,
|
|
16
19
|
loading: false,
|
|
17
|
-
PDFJS: null
|
|
20
|
+
PDFJS: null,
|
|
21
|
+
pageChangeByButton: false,
|
|
22
|
+
showPicker: false
|
|
18
23
|
};
|
|
19
24
|
};
|
|
20
25
|
|
|
@@ -123,6 +128,8 @@ export default createComponent({
|
|
|
123
128
|
* @param pdfDoc pdf文档
|
|
124
129
|
*/
|
|
125
130
|
renderPdfCanvas: function renderPdfCanvas(pdfViewerDom, pdfDoc) {
|
|
131
|
+
var _this2 = this;
|
|
132
|
+
|
|
126
133
|
// 清除原来的pdf画布
|
|
127
134
|
pdfViewerDom.innerHTML = ""; // 获取总页数
|
|
128
135
|
|
|
@@ -133,9 +140,63 @@ export default createComponent({
|
|
|
133
140
|
// 循环处理pdf的每页
|
|
134
141
|
this.renderPdfOnePage(pdfViewerDom, pdfDoc, i);
|
|
135
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
|
+
}
|
|
136
197
|
},
|
|
137
198
|
renderPdf: function renderPdf() {
|
|
138
|
-
var
|
|
199
|
+
var _this4 = this;
|
|
139
200
|
|
|
140
201
|
if (!this.PDFJS) {
|
|
141
202
|
this.PDFJS = window['pdfjs-dist/build/pdf'] || window.pdfjsLib;
|
|
@@ -161,16 +222,14 @@ export default createComponent({
|
|
|
161
222
|
pdfLoadingTask.promise.then(function (pdfDoc) {
|
|
162
223
|
if (pdfDoc && pdfViewerDom) {
|
|
163
224
|
// 缓存pdf内容
|
|
164
|
-
|
|
225
|
+
_this4.pdfDocRef = pdfDoc;
|
|
165
226
|
|
|
166
|
-
|
|
227
|
+
_this4.renderPdfCanvas(pdfViewerDom, pdfDoc);
|
|
167
228
|
}
|
|
168
229
|
});
|
|
169
230
|
}
|
|
170
231
|
},
|
|
171
|
-
changePage: function changePage(
|
|
172
|
-
var page = this.currentPage + count;
|
|
173
|
-
|
|
232
|
+
changePage: function changePage(page) {
|
|
174
233
|
if (page < 1) {
|
|
175
234
|
Toast("已经是首页");
|
|
176
235
|
return;
|
|
@@ -181,17 +240,42 @@ export default createComponent({
|
|
|
181
240
|
return;
|
|
182
241
|
}
|
|
183
242
|
|
|
243
|
+
this.pageChangeByButton = true;
|
|
244
|
+
|
|
184
245
|
if (document.getElementById("pdfCanvas" + page)) {
|
|
185
|
-
document.getElementById("pdfCanvas" + page).scrollIntoView(
|
|
246
|
+
document.getElementById("pdfCanvas" + page).scrollIntoView({
|
|
247
|
+
block: "end",
|
|
248
|
+
inline: "nearest"
|
|
249
|
+
});
|
|
186
250
|
}
|
|
187
251
|
|
|
188
252
|
this.currentPage = page;
|
|
189
253
|
},
|
|
190
254
|
clickPre: function clickPre() {
|
|
191
|
-
this.changePage(-1);
|
|
255
|
+
this.changePage(this.currentPage - 1);
|
|
192
256
|
},
|
|
193
257
|
clickNext: function clickNext() {
|
|
194
|
-
this.changePage(1);
|
|
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;
|
|
195
279
|
}
|
|
196
280
|
},
|
|
197
281
|
render: function render(h) {
|
|
@@ -199,7 +283,10 @@ export default createComponent({
|
|
|
199
283
|
"class": bem(),
|
|
200
284
|
"ref": "pdfContainer"
|
|
201
285
|
}, [h("div", {
|
|
202
|
-
"class": bem("inner-container")
|
|
286
|
+
"class": bem("inner-container"),
|
|
287
|
+
"attrs": {
|
|
288
|
+
"id": "pdfContainer"
|
|
289
|
+
}
|
|
203
290
|
}, [h(Loading, {
|
|
204
291
|
"directives": [{
|
|
205
292
|
name: "show",
|
|
@@ -221,12 +308,26 @@ export default createComponent({
|
|
|
221
308
|
"click": this.clickPre
|
|
222
309
|
}
|
|
223
310
|
}, ["<"]), h("span", {
|
|
224
|
-
"class": bem("page")
|
|
225
|
-
|
|
311
|
+
"class": bem("page"),
|
|
312
|
+
"on": {
|
|
313
|
+
"click": this.showPagePicker
|
|
314
|
+
}
|
|
315
|
+
}, [this.currentPage, " / ", this.totalPage]), h("span", {
|
|
226
316
|
"class": bem("next"),
|
|
227
317
|
"on": {
|
|
228
318
|
"click": this.clickNext
|
|
229
319
|
}
|
|
230
|
-
}, [">"])]) : h()
|
|
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
|
+
})]);
|
|
231
332
|
}
|
|
232
333
|
});
|
package/lib/cascader/index.js
CHANGED
|
@@ -157,7 +157,9 @@ var _default2 = createComponent({
|
|
|
157
157
|
this.tabs = this.tabs.slice(0, tabIndex + 1);
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
|
|
160
|
+
var hasChildren = option[this.childrenKey] && option[this.childrenKey].length > 0;
|
|
161
|
+
|
|
162
|
+
if (hasChildren) {
|
|
161
163
|
var nextTab = {
|
|
162
164
|
options: option[this.childrenKey],
|
|
163
165
|
selectedOption: null
|
|
@@ -187,7 +189,7 @@ var _default2 = createComponent({
|
|
|
187
189
|
this.$emit('input', option[this.valueKey]);
|
|
188
190
|
this.$emit('change', eventParams);
|
|
189
191
|
|
|
190
|
-
if (!
|
|
192
|
+
if (!hasChildren) {
|
|
191
193
|
this.$emit('finish', eventParams);
|
|
192
194
|
}
|
|
193
195
|
},
|