zartui 0.1.103 → 0.1.106

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.
@@ -6,6 +6,7 @@ var _createNamespace = createNamespace('calendar-header'),
6
6
 
7
7
  export default createComponent({
8
8
  props: {
9
+ color: String,
9
10
  title: String,
10
11
  subtitle: String,
11
12
  showTitle: Boolean,
@@ -20,7 +21,12 @@ export default createComponent({
20
21
  var title = this.slots('title') || this.title || t('title');
21
22
  return h("div", {
22
23
  "class": bem('header-title')
23
- }, [title]);
24
+ }, [h("span", {
25
+ "class": "hint-block",
26
+ "style": {
27
+ "background": this.color
28
+ }
29
+ }), title]);
24
30
  }
25
31
  },
26
32
  genSubtitle: function genSubtitle() {
@@ -30,7 +30,7 @@ export default createComponent({
30
30
  },
31
31
  computed: {
32
32
  title: function title() {
33
- return formatMonthTitle(this.date);
33
+ return this.getMonthTitle();
34
34
  },
35
35
  rowHeightWithUnit: function rowHeightWithUnit() {
36
36
  return addUnit(this.rowHeight);
@@ -96,6 +96,9 @@ export default createComponent({
96
96
 
97
97
  return this.height;
98
98
  },
99
+ getMonthTitle: function getMonthTitle() {
100
+ return formatMonthTitle(this.date);
101
+ },
99
102
  scrollIntoView: function scrollIntoView(body) {
100
103
  var _this$$refs = this.$refs,
101
104
  days = _this$$refs.days,
@@ -232,9 +235,10 @@ export default createComponent({
232
235
  var h = this.$createElement;
233
236
 
234
237
  if (this.showMonthTitle) {
238
+ var currentTitle = this.getMonthTitle();
235
239
  return h("div", {
236
240
  "class": bem('month-title')
237
- }, [this.title]);
241
+ }, [currentTitle]);
238
242
  }
239
243
  },
240
244
  genMark: function genMark() {
@@ -1 +1 @@
1
- .zt-calendar{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;height:100%;background-color:#fff}.zt-calendar__popup.zt-popup--bottom,.zt-calendar__popup.zt-popup--top{height:80%}.zt-calendar__popup.zt-popup--left,.zt-calendar__popup.zt-popup--right{height:100%}.zt-calendar__popup .zt-popup__close-icon{top:11px}.zt-calendar__header{-webkit-flex-shrink:0;flex-shrink:0;box-shadow:0 4px 8px 0 rgba(0,0,0,.1);margin-bottom:8px}.zt-calendar__header-title{height:44px;font-weight:700;line-height:44px;text-align:left;padding-left:16px;position:relative}.zt-calendar__header-title::before{position:absolute;content:'';top:14px;left:0;width:4px;height:16px;background:#0091fa}.zt-calendar__header-title::after{top:44px;left:0;content:'';position:absolute;box-sizing:border-box;content:' ';pointer-events:none;right:0;bottom:0;left:0;border-bottom:1px solid rgba(0,0,0,.1);-webkit-transform:scaleY(.5);transform:scaleY(.5)}.zt-calendar__header-subtitle{height:44px;font-weight:400;line-height:44px;text-align:center}.zt-calendar__month-title{height:44px;font-weight:400;line-height:44px;text-align:center}.zt-calendar__header-title{font-size:16px}.zt-calendar__header-subtitle{font-size:14px}.zt-calendar__month-title{font-size:14px}.zt-calendar__weekdays{display:-webkit-box;display:-webkit-flex;display:flex;background-color:rgba(0,0,0,.02)}.zt-calendar__weekday{-webkit-box-flex:1;-webkit-flex:1;flex:1;font-size:12px;line-height:30px;font-weight:700;text-align:center}.zt-calendar__body{-webkit-box-flex:1;-webkit-flex:1;flex:1;overflow:auto;-webkit-overflow-scrolling:touch;background-color:#fff}.zt-calendar__days{position:relative;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;-webkit-user-select:none;user-select:none}.zt-calendar__month-mark{position:absolute;top:50%;left:50%;z-index:0;color:rgba(242,243,245,.8);font-size:160px;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);pointer-events:none}.zt-calendar__day,.zt-calendar__selected-day{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;text-align:center}.zt-calendar__day{position:relative;width:14.285%;height:14.285vw;font-size:16px;font-weight:400;cursor:pointer;outline:0}.zt-calendar__day--end,.zt-calendar__day--multiple-middle,.zt-calendar__day--multiple-selected,.zt-calendar__day--start,.zt-calendar__day--start-end{font-weight:700;color:#fff;background-color:#0091fa;box-shadow:0 0 0 3px rgba(0,145,250,.1)}@media (pointer:coarse){.zt-calendar__day--end,.zt-calendar__day--multiple-middle{margin-left:-1px}}.zt-calendar__day--start{font-weight:700;border-radius:7.143vw 0 0 7.143vw;border-right:none;box-shadow:0 0 0 3px rgba(0,145,250,.1)}.zt-calendar__day--end{font-weight:700;border-radius:0 7.143vw 7.143vw 0;border-left:none;box-shadow:0 0 0 3px rgba(0,145,250,.1)}.zt-calendar__day--multiple-selected,.zt-calendar__day--start-end{font-weight:700;border-radius:7.143vw;box-shadow:0 0 0 3px rgba(0,145,250,.1)}.zt-calendar__day--middle{color:#000}.zt-calendar__day--middle::after{position:absolute;top:0;right:0;bottom:0;left:0;color:#0091fa;background-color:currentColor;opacity:.11;content:''}.zt-calendar__day--disabled{color:#c8c9cc;cursor:default}.zt-calendar__bottom-info,.zt-calendar__top-info{position:absolute;right:0;left:0;font-size:10px;line-height:14px}@media (max-width:350px){.zt-calendar__bottom-info,.zt-calendar__top-info{font-size:9px}}.zt-calendar__top-info{top:6px}.zt-calendar__bottom-info{display:none;bottom:6px}.zt-calendar__selected-day{font-weight:700;width:14.285vw;height:14.285vw;color:#fff;background-color:#0091fa;border-radius:calc(14.285vw / 2);box-shadow:0 0 0 3px rgba(0,145,250,.1)}.zt-calendar__footer{-webkit-flex-shrink:0;flex-shrink:0;padding-bottom:constant(safe-area-inset-bottom);padding-bottom:env(safe-area-inset-bottom)}.zt-calendar__footer--unfit{padding-bottom:0}.zt-calendar__confirm{border-radius:0}
1
+ .zt-calendar{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;height:100%;background-color:#fff}.zt-calendar__popup.zt-popup--bottom,.zt-calendar__popup.zt-popup--top{height:80%}.zt-calendar__popup.zt-popup--left,.zt-calendar__popup.zt-popup--right{height:100%}.zt-calendar__popup .zt-popup__close-icon{top:11px}.zt-calendar__header{-webkit-flex-shrink:0;flex-shrink:0;box-shadow:0 4px 8px 0 rgba(0,0,0,.1);margin-bottom:8px}.zt-calendar__header-title{height:44px;font-weight:700;line-height:44px;text-align:left;padding-left:16px;position:relative}.zt-calendar__header-title .hint-block{position:absolute;content:'';top:14px;left:0;width:4px;height:16px;background:#0091fa}.zt-calendar__header-title::after{top:44px;left:0;content:'';position:absolute;box-sizing:border-box;content:' ';pointer-events:none;right:0;bottom:0;left:0;border-bottom:1px solid rgba(0,0,0,.1);-webkit-transform:scaleY(.5);transform:scaleY(.5)}.zt-calendar__header-subtitle{height:44px;font-weight:400;line-height:44px;text-align:center}.zt-calendar__month-title{height:44px;font-weight:400;line-height:44px;text-align:center}.zt-calendar__header-title{font-size:16px}.zt-calendar__header-subtitle{font-size:14px}.zt-calendar__month-title{font-size:14px}.zt-calendar__weekdays{display:-webkit-box;display:-webkit-flex;display:flex;background-color:rgba(0,0,0,.02)}.zt-calendar__weekday{-webkit-box-flex:1;-webkit-flex:1;flex:1;font-size:12px;line-height:30px;font-weight:700;text-align:center}.zt-calendar__body{-webkit-box-flex:1;-webkit-flex:1;flex:1;overflow:auto;-webkit-overflow-scrolling:touch;background-color:#fff}.zt-calendar__days{position:relative;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-flex-wrap:wrap;flex-wrap:wrap;-webkit-user-select:none;user-select:none}.zt-calendar__month-mark{position:absolute;top:50%;left:50%;z-index:0;color:rgba(242,243,245,.8);font-size:160px;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);pointer-events:none}.zt-calendar__day,.zt-calendar__selected-day{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;text-align:center}.zt-calendar__day{position:relative;width:14.285%;height:14.285vw;font-size:16px;font-weight:400;cursor:pointer;outline:0}.zt-calendar__day--end,.zt-calendar__day--multiple-middle,.zt-calendar__day--multiple-selected,.zt-calendar__day--start,.zt-calendar__day--start-end{font-weight:700;color:#fff;background-color:#0091fa;box-shadow:0 0 0 3px rgba(0,145,250,.1)}@media (pointer:coarse){.zt-calendar__day--end,.zt-calendar__day--multiple-middle{margin-left:-1px}}.zt-calendar__day--start{font-weight:700;border-radius:7.143vw 0 0 7.143vw;border-right:none;box-shadow:0 0 0 3px rgba(0,145,250,.1)}.zt-calendar__day--end{font-weight:700;border-radius:0 7.143vw 7.143vw 0;border-left:none;box-shadow:0 0 0 3px rgba(0,145,250,.1)}.zt-calendar__day--multiple-selected,.zt-calendar__day--start-end{font-weight:700;border-radius:7.143vw;box-shadow:0 0 0 3px rgba(0,145,250,.1)}.zt-calendar__day--middle{color:#000}.zt-calendar__day--middle::after{position:absolute;top:0;right:0;bottom:0;left:0;color:#0091fa;background-color:currentColor;opacity:.11;content:''}.zt-calendar__day--disabled{color:#c8c9cc;cursor:default}.zt-calendar__bottom-info,.zt-calendar__top-info{position:absolute;right:0;left:0;font-size:10px;line-height:14px}@media (max-width:350px){.zt-calendar__bottom-info,.zt-calendar__top-info{font-size:9px}}.zt-calendar__top-info{top:6px}.zt-calendar__bottom-info{display:none;bottom:6px}.zt-calendar__selected-day{font-weight:700;width:14.285vw;height:14.285vw;color:#fff;background-color:#0091fa;border-radius:calc(14.285vw / 2);box-shadow:0 0 0 3px rgba(0,145,250,.1)}.zt-calendar__footer{-webkit-flex-shrink:0;flex-shrink:0;padding-bottom:constant(safe-area-inset-bottom);padding-bottom:env(safe-area-inset-bottom)}.zt-calendar__footer--unfit{padding-bottom:0}.zt-calendar__confirm{border-radius:0}
@@ -302,7 +302,7 @@ export default createComponent({
302
302
  /* istanbul ignore else */
303
303
 
304
304
  if (currentMonth) {
305
- this.subtitle = currentMonth.title;
305
+ this.subtitle = currentMonth.getMonthTitle();
306
306
  }
307
307
  },
308
308
  onClickDay: function onClickDay(item) {
@@ -486,6 +486,7 @@ export default createComponent({
486
486
  "class": bem()
487
487
  }, [h(Header, {
488
488
  "attrs": {
489
+ "color": this.color,
489
490
  "title": this.title,
490
491
  "showTitle": this.showTitle,
491
492
  "subtitle": this.subtitle,
@@ -39,7 +39,7 @@
39
39
 
40
40
  }
41
41
 
42
- &__header-title::before {
42
+ &__header-title .hint-block {
43
43
  position: absolute;
44
44
  content: '';
45
45
  top: 14px;
@@ -1,4 +1,10 @@
1
1
  export default {
2
+ props: {
3
+ color: {
4
+ type: String,
5
+ default: 'rgba(0,0,0,0.4)'
6
+ }
7
+ },
2
8
  render: function render() {
3
9
  var h = arguments[0];
4
10
  return h("svg", {
@@ -9,8 +15,7 @@ export default {
9
15
  }, [h("path", {
10
16
  "attrs": {
11
17
  "d": "M10,2 C14.418278,2 18,5.581722 18,10 C18,14.418278 14.418278,18 10,18 C5.581722,18 2,14.418278 2,10 C2,5.581722 5.581722,2 10,2 Z M6.46446609,6.46446609 C6.0739418,6.85499039 6.0739418,7.48815536 6.46446609,7.87867966 L8.586,10 L6.46446609,12.1213203 C6.10398213,12.4818043 6.0762526,13.0490354 6.38127749,13.4413266 L6.46446609,13.5355339 C6.85499039,13.9260582 7.48815536,13.9260582 7.87867966,13.5355339 L7.87867966,13.5355339 L10,11.414 L12.1213203,13.5355339 C12.5118446,13.9260582 13.1450096,13.9260582 13.5355339,13.5355339 C13.9260582,13.1450096 13.9260582,12.5118446 13.5355339,12.1213203 L11.414,10 L13.5355339,7.87867966 C13.8960179,7.51819569 13.9237474,6.95096464 13.6187225,6.55867343 L13.5355339,6.46446609 C13.1450096,6.0739418 12.5118446,6.0739418 12.1213203,6.46446609 L12.1213203,6.46446609 L10,8.586 L7.87867966,6.46446609 C7.48815536,6.0739418 6.85499039,6.0739418 6.46446609,6.46446609 Z",
12
- "fill": "#000",
13
- "opacity": ".4",
18
+ "fill": this.color,
14
19
  "fill-rule": "evenodd"
15
20
  }
16
21
  })]);
package/es/field/index.js CHANGED
@@ -56,6 +56,8 @@ export default createComponent({
56
56
  errorMessage: String,
57
57
  errorMessageAlign: String,
58
58
  showWordLimit: Boolean,
59
+ inputColor: String,
60
+ iconColor: String,
59
61
  value: {
60
62
  type: [Number, String],
61
63
  default: ''
@@ -430,6 +432,7 @@ export default createComponent({
430
432
  var readonly = this.getProp('readonly');
431
433
  var inputSlot = this.slots('input');
432
434
  var inputAlign = this.getProp('inputAlign');
435
+ var inputColor = this.getProp('inputColor');
433
436
 
434
437
  if (inputSlot) {
435
438
  return h("div", {
@@ -457,7 +460,10 @@ export default createComponent({
457
460
  directives: [{
458
461
  name: 'model',
459
462
  value: this.value
460
- }]
463
+ }],
464
+ style: {
465
+ color: inputColor
466
+ }
461
467
  };
462
468
 
463
469
  if (type === 'textarea') {
@@ -662,7 +668,10 @@ export default createComponent({
662
668
  "click": this.onClear
663
669
  }
664
670
  }, [h(ClearIcon, {
665
- "class": bem('zt-clear-size')
671
+ "class": bem('zt-clear-size'),
672
+ "attrs": {
673
+ "color": this.iconColor
674
+ }
666
675
  })]), this.type === 'password' && h("div", {
667
676
  "on": {
668
677
  "click": this.togglePwdVisible
@@ -670,11 +679,13 @@ export default createComponent({
670
679
  "style": "width:20px;height:20px;margin-left:12px;display:flex;justify-content:center;align-items:center;color:rgba(0,0,0,.4);"
671
680
  }, [this.showPassword ? h(Icon, {
672
681
  "attrs": {
673
- "name": "eye-open"
682
+ "name": "eye-open",
683
+ "color": this.iconColor
674
684
  }
675
685
  }) : h(Icon, {
676
686
  "attrs": {
677
- "name": "eye-closed"
687
+ "name": "eye-closed",
688
+ "color": this.iconColor
678
689
  }
679
690
  })]), this.genRightIcon(), slots('button') && h("div", {
680
691
  "class": bem('button')
@@ -1 +1 @@
1
- .zt-image-preview{position:fixed;top:0;left:0;width:100%;height:100%}.zt-image-preview__swipe{height:100%}.zt-image-preview__swipe-item{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;overflow:hidden}.zt-image-preview__cover{position:absolute;top:0;left:0}.zt-image-preview__image{width:100%;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform}.zt-image-preview__image--vertical{width:auto;height:100%}.zt-image-preview__image img{-webkit-user-drag:none}.zt-image-preview__image .zt-image__error{top:30%;height:40%}.zt-image-preview__image .zt-image__error-icon{font-size:36px}.zt-image-preview__image .zt-image__loading{background-color:transparent}.zt-image-preview__index{position:absolute;bottom:8px;left:40px;height:24px;line-height:24px;padding:4px 8px;border-radius:2px;background:rgba(0,0,0,.6);color:#fff;font-size:16px;text-shadow:0 1px 1px #323233;-webkit-transform:translate(-50%,0);transform:translate(-50%,0);z-index:10}.zt-image-preview__overlay{background-color:#000}.zt-image-preview__close-icon{position:absolute;z-index:1;color:#c8c9cc;font-size:22px;cursor:pointer}.zt-image-preview__close-icon:active{color:#969799}.zt-image-preview__close-icon--top-left{top:16px;left:16px}.zt-image-preview__close-icon--top-right{top:16px;right:16px}.zt-image-preview__close-icon--bottom-left{bottom:16px;left:16px}.zt-image-preview__close-icon--bottom-right{right:16px;bottom:16px}.zt-image-preview__title{position:absolute;bottom:0;height:48px;width:100%;padding-left:70px;left:0;line-height:48px;font-size:18px;color:#fff;background:rgba(0,0,0,.4);z-index:9}
1
+ .zt-image-preview{position:fixed;top:0;left:0;width:100%;height:100%}.zt-image-preview__swipe{height:100%}.zt-image-preview__swipe-item{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;overflow:hidden}.zt-image-preview__cover{position:absolute;top:0;left:0}.zt-image-preview__image{width:100%;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform}.zt-image-preview__image--vertical{width:auto;height:100%}.zt-image-preview__image img{-webkit-user-drag:none}.zt-image-preview__image .zt-image__error{top:30%;height:40%}.zt-image-preview__image .zt-image__error-icon{font-size:36px}.zt-image-preview__image .zt-image__loading{background-color:transparent}.zt-image-preview__index{position:absolute;bottom:8px;left:40px;height:24px;line-height:24px;padding:4px 8px;border-radius:2px;background:rgba(0,0,0,.6);color:#fff;font-size:16px;text-shadow:0 1px 1px #323233;-webkit-transform:translate(-50%,0);transform:translate(-50%,0);z-index:10}.zt-image-preview__overlay.zt-overlay{background-color:#000}.zt-image-preview__close-icon{position:absolute;z-index:1;color:#c8c9cc;font-size:22px;cursor:pointer}.zt-image-preview__close-icon:active{color:#969799}.zt-image-preview__close-icon--top-left{top:16px;left:16px}.zt-image-preview__close-icon--top-right{top:16px;right:16px}.zt-image-preview__close-icon--bottom-left{bottom:16px;left:16px}.zt-image-preview__close-icon--bottom-right{right:16px;bottom:16px}.zt-image-preview__title{position:absolute;bottom:0;height:48px;width:100%;padding-left:70px;left:0;line-height:48px;font-size:18px;color:#fff;background:rgba(0,0,0,.4);z-index:9}
@@ -70,7 +70,7 @@
70
70
  z-index: @image-preview-index-z-index;
71
71
  }
72
72
 
73
- &__overlay {
73
+ &__overlay.zt-overlay {
74
74
  background-color: @black;
75
75
  }
76
76
 
package/es/index.js CHANGED
@@ -75,7 +75,7 @@ import Tag from './tag';
75
75
  import Timeline from './timeline';
76
76
  import Toast from './toast';
77
77
  import Uploader from './uploader';
78
- var version = '0.1.103';
78
+ var version = '0.1.106';
79
79
 
80
80
  function install(Vue) {
81
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];
@@ -17,6 +17,7 @@ export var CheckboxMixin = function CheckboxMixin(_ref) {
17
17
  disabled: Boolean,
18
18
  iconSize: [Number, String],
19
19
  checkedColor: String,
20
+ iconColor: String,
20
21
  labelPosition: String,
21
22
  labelDisabled: Boolean,
22
23
  shape: {
@@ -40,9 +41,11 @@ export var CheckboxMixin = function CheckboxMixin(_ref) {
40
41
  },
41
42
  iconStyle: function iconStyle() {
42
43
  var checkedColor = this.checkedColor || this.parent && this.parent.checkedColor;
44
+ var iconColor = this.iconColor || this.parent && this.parent.iconColor;
43
45
 
44
46
  if (checkedColor && this.checked && !this.isDisabled) {
45
47
  return {
48
+ color: iconColor,
46
49
  borderColor: checkedColor,
47
50
  backgroundColor: checkedColor
48
51
  };
@@ -46,31 +46,16 @@ export default createComponent({
46
46
  return defaultData();
47
47
  },
48
48
  mounted: function mounted() {
49
- this.reset();
50
- this.getPdfNumPages();
49
+ this.init();
51
50
  },
52
51
  activated: function activated() {
53
- this.privateUrl = this.url;
54
- this.recordMeta();
55
- this.recordHeight();
56
- this.recordScrollEvent();
57
- this.setHeight();
58
- this.setMeta();
59
- this.setScrollEvent();
52
+ this.init();
60
53
  },
61
54
  deactivated: function deactivated() {
62
- this.setHeight(true);
63
- this.setMeta(true);
64
- this.setScrollEvent(true);
65
- this.reset();
66
- this.privateUrl = "";
55
+ this.resetAll();
67
56
  },
68
57
  destroyed: function destroyed() {
69
- this.setHeight(true);
70
- this.setMeta(true);
71
- this.setScrollEvent(true);
72
- this.reset();
73
- this.privateUrl = "";
58
+ this.resetAll();
74
59
  },
75
60
  computed: {
76
61
  // 只显示当前页前后几页的pdf
@@ -95,24 +80,22 @@ export default createComponent({
95
80
  url: function url(nv) {
96
81
  this.privateUrl = nv;
97
82
  },
98
- privateUrl: function privateUrl() {
99
- this.getPdfNumPages();
83
+ privateUrl: function privateUrl(nv) {
84
+ if (nv) {
85
+ this.getPdfNumPages();
86
+ }
100
87
  },
101
88
  pageNum: function pageNum(nv) {
102
- var _this = this;
103
-
104
89
  if (this.pageChangeByButton && document.getElementById("pdfContent" + nv)) {
105
- this.loading = true;
106
- setTimeout(function () {
107
- _this.loading = false;
90
+ this.$nextTick(function () {
108
91
  document.getElementById("pdfContent" + nv).scrollIntoView(false);
109
- }, 1000);
92
+ });
110
93
  }
111
94
  },
112
95
  currentShowArr: {
113
96
  deep: true,
114
97
  handler: function handler(value, oldValue) {
115
- var _this2 = this;
98
+ var _this = this;
116
99
 
117
100
  // 因为浏览器对canvas总面积有限制,且销毁vue-pdf组件会同时销毁loadingTask,
118
101
  // 所以要销毁的canvas转为图片进行展示
@@ -123,24 +106,39 @@ export default createComponent({
123
106
  }
124
107
  });
125
108
  toDelete.forEach(function (v) {
126
- _this2.transformCanvasIntoImg(v);
109
+ _this.transformCanvasIntoImg(v);
127
110
  });
128
111
  }
129
112
  }
130
113
  },
131
114
  methods: {
115
+ init: function init() {
116
+ this.privateUrl = this.url;
117
+ this.recordMeta();
118
+ this.recordHeight();
119
+ this.recordScrollEvent();
120
+ this.setHeight();
121
+ this.setMeta();
122
+ this.setScrollEvent();
123
+ },
124
+ resetAll: function resetAll() {
125
+ this.setHeight(true);
126
+ this.setMeta(true);
127
+ this.setScrollEvent(true);
128
+ this.reset();
129
+ },
132
130
  recordScrollEvent: function recordScrollEvent() {
133
131
  this.scrollEvent = window.onscroll;
134
132
  },
135
133
  setScrollEvent: function setScrollEvent(restore) {
136
- var _this3 = this;
134
+ var _this2 = this;
137
135
 
138
136
  if (restore) {
139
137
  window.onscroll = this.scrollEvent;
140
138
  } else {
141
139
  if (this.pdfScrollEvent) {
142
140
  window.onscroll = function () {
143
- _this3.pdfScrollEvent();
141
+ _this2.pdfScrollEvent();
144
142
  };
145
143
  }
146
144
  }
@@ -151,7 +149,7 @@ export default createComponent({
151
149
  this.metaContent = (_document$getElements = document.getElementsByTagName('meta')['viewport']) == null ? void 0 : _document$getElements.getAttribute("content");
152
150
  },
153
151
  transformCanvasIntoImg: function transformCanvasIntoImg(i) {
154
- var _this4 = this;
152
+ var _this3 = this;
155
153
 
156
154
  var pdfContainer = document.getElementById("pdfContent" + i);
157
155
 
@@ -169,7 +167,7 @@ export default createComponent({
169
167
  return v === 255;
170
168
  })) {
171
169
  setTimeout(function () {
172
- _this4.transformCanvasIntoImg(i);
170
+ _this3.transformCanvasIntoImg(i);
173
171
  }, 1000);
174
172
  return;
175
173
  }
@@ -207,7 +205,7 @@ export default createComponent({
207
205
  resetObject(this, defaultData());
208
206
  },
209
207
  getPdfNumPages: function getPdfNumPages() {
210
- var _this5 = this;
208
+ var _this4 = this;
211
209
 
212
210
  if (!this.privateUrl) {
213
211
  return;
@@ -216,33 +214,33 @@ export default createComponent({
216
214
  this.loading = true;
217
215
  this.loadingTask = pdf.createLoadingTask(this.privateUrl);
218
216
  this.loadingTask.promise.then(function (v) {
219
- _this5.pdfPageCount = v.numPages;
217
+ _this4.pdfPageCount = v.numPages;
220
218
  var pdfArr = [];
221
219
 
222
- for (var i = 0; i < _this5.pdfPageCount; i++) {
220
+ for (var i = 0; i < _this4.pdfPageCount; i++) {
223
221
  pdfArr.push({
224
222
  loaded: false
225
223
  });
226
224
  }
227
225
 
228
- _this5.pageNum = 1;
229
- _this5.pdfArr = pdfArr;
226
+ _this4.pageNum = 1;
227
+ _this4.pdfArr = pdfArr;
230
228
 
231
- _this5.buildPdfScrollEvent();
229
+ _this4.buildPdfScrollEvent();
232
230
  }).catch(function (err) {
233
231
  console.error("pdf 加载失败", err);
234
232
  }).finally(function () {
235
- _this5.loading = false;
233
+ _this4.loading = false;
236
234
  });
237
235
  },
238
236
  buildPdfScrollEvent: function buildPdfScrollEvent() {
239
- var _this6 = this;
237
+ var _this5 = this;
240
238
 
241
239
  this.pdfScrollEvent = window.onscroll = _.throttle(function () {
242
- if (_this6.pageChangeByButton) {
243
- _this6.pageChangeByButton = false;
240
+ if (_this5.pageChangeByButton) {
241
+ _this5.pageChangeByButton = false;
244
242
  } else {
245
- _this6.changePage();
243
+ _this5.changePage();
246
244
  }
247
245
  }, 1000);
248
246
  },
@@ -356,7 +354,7 @@ export default createComponent({
356
354
  }
357
355
  },
358
356
  render: function render(h) {
359
- var _this7 = this;
357
+ var _this6 = this;
360
358
 
361
359
  return h("div", {
362
360
  "class": bem()
@@ -429,7 +427,7 @@ export default createComponent({
429
427
  "id": "pdfContainer"
430
428
  }
431
429
  }, [this.pdfArr.map(function (x, i) {
432
- return _this7.genPdf(i + 1);
430
+ return _this6.genPdf(i + 1);
433
431
  })]) : h(), h(Picker, {
434
432
  "attrs": {
435
433
  "show-picker": this.showPicker,
@@ -29,8 +29,7 @@ export var Telemetry = /*#__PURE__*/function () {
29
29
 
30
30
  if (this.send) {
31
31
  this.send(event);
32
- } else {
33
- console.debug(JSON.stringify(event));
32
+ } else {// console.debug(JSON.stringify(event))
34
33
  }
35
34
  };
36
35
 
@@ -1,3 +1,4 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import { createNamespace } from '../utils';
2
3
 
3
4
  var _createNamespace = createNamespace('timeline'),
@@ -8,7 +9,8 @@ import Switch from "../switch";
8
9
 
9
10
  var defaultData = function defaultData() {
10
11
  return {
11
- isFold: false
12
+ isFold: false,
13
+ computedProcesses: []
12
14
  };
13
15
  };
14
16
 
@@ -37,6 +39,10 @@ export default createComponent({
37
39
  opinionKey: {
38
40
  type: String,
39
41
  default: "处理意见"
42
+ },
43
+ enableSingleFold: {
44
+ type: Boolean,
45
+ default: true
40
46
  }
41
47
  },
42
48
  data: function data() {
@@ -46,20 +52,24 @@ export default createComponent({
46
52
  watch: {},
47
53
  mounted: function mounted() {
48
54
  this.isFold = this.defaultFold;
49
- console.log("this.$slots", this.$slots);
55
+ this.computedProcesses = this.processes.map(function (v) {
56
+ return _extends({}, v, {
57
+ folded: false
58
+ });
59
+ });
50
60
  },
51
61
  methods: {
52
62
  genProcesses: function genProcesses() {
53
63
  var _this = this;
54
64
 
55
65
  if (this.isFold) {
56
- var showProcesses = this.processes.slice(0, this.collapseCount);
66
+ var showProcesses = this.computedProcesses.slice(0, this.collapseCount);
57
67
  return showProcesses.map(function (item, index) {
58
68
  return _this.genProcessItem(item, index === showProcesses.length - 1);
59
69
  });
60
70
  } else {
61
- return this.processes.map(function (item, index) {
62
- return _this.genProcessItem(item, index === _this.processes.length - 1);
71
+ return this.computedProcesses.map(function (item, index) {
72
+ return _this.genProcessItem(item, index === _this.computedProcesses.length - 1);
63
73
  });
64
74
  }
65
75
  },
@@ -141,15 +151,28 @@ export default createComponent({
141
151
  var titleSlot = this.slots("title", item);
142
152
  var contentSlot = this.slots("content", item);
143
153
  var opinionSlot = this.slots("opinion", item);
154
+ var that = this;
155
+
156
+ function itemClicked() {
157
+ if (!that.enableSingleFold) {
158
+ return;
159
+ }
160
+
161
+ item.folded = !item.folded;
162
+ }
163
+
144
164
  return h("div", {
145
- "class": bem("item") + (" " + (isLast ? "last-item" : ""))
165
+ "class": bem("item") + (" " + (isLast ? "last-item" : "")),
166
+ "on": {
167
+ "click": itemClicked
168
+ }
146
169
  }, [h("div", {
147
170
  "class": bem("left-container")
148
171
  }, [this.genAvatar(item, avatarSlot), h("div", {
149
172
  "class": bem("line")
150
173
  })]), h("div", {
151
174
  "class": bem("right-container")
152
- }, [this.genTitle(item, titleSlot), h("div", {
175
+ }, [this.genTitle(item, titleSlot), item.folded ? h() : h("div", {
153
176
  "class": bem("main-container") + " half-border"
154
177
  }, [this.genContent(item, contentSlot), this.genOpinion(item, opinionSlot)])])]);
155
178
  }
@@ -178,7 +201,7 @@ export default createComponent({
178
201
  _this2.isFold = $$v;
179
202
  }
180
203
  }
181
- })])]), this.processes.length ? h("div", {
204
+ })])]), this.computedProcesses.length ? h("div", {
182
205
  "class": bem("container")
183
206
  }, [this.genProcesses()]) : h()]);
184
207
  }