zartui 2.1.28 → 2.1.30

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.
@@ -0,0 +1,17 @@
1
+ export default {
2
+ render: function render() {
3
+ var h = arguments[0];
4
+ return h("svg", {
5
+ "attrs": {
6
+ "xmlns": "http://www.w3.org/2000/svg",
7
+ "viewBox": "0 0 20 20"
8
+ }
9
+ }, [h("path", {
10
+ "attrs": {
11
+ "d": "M3.75,17.5 C3.28976271,17.5 2.91666667,17.126904 2.91666667,16.6666667 L2.91666667,12.5 C2.91666667,12.0397627 3.28976271,11.6666667 3.75,11.6666667 C4.21023729,11.6666667 4.58333333,12.0397627 4.58333333,12.5 L4.58266667,15.833 L15.4166667,15.833 L15.4166667,12.5 C15.4166667,12.0397627 15.7897627,11.6666667 16.25,11.6666667 C16.7102373,11.6666667 17.0833333,12.0397627 17.0833333,12.5 L17.0833333,16.6666667 C17.0833333,17.0915011 16.765429,17.442085 16.3545316,17.4935072 L16.25,17.5 L3.75,17.5 Z M10,2.5 C10.4602373,2.5 10.8333333,2.87309604 10.8333333,3.33333333 L10.834,10.904 L12.327411,9.41074435 L12.3804172,9.36206404 C12.7078286,9.08620893 13.1976137,9.1024357 13.5059223,9.41074435 C13.8313592,9.73618126 13.8313592,10.2638187 13.5059223,10.5892557 L10.5892557,13.5059223 L10.5659501,13.5283458 C10.5602582,13.5336148 10.5544926,13.5388053 10.548655,13.5439156 L10.5362495,13.5546026 L10.5121742,13.5740743 C10.4949132,13.5875412 10.4771081,13.6003432 10.4586783,13.6126074 C10.4455853,13.6212563 10.4323019,13.6294968 10.4192578,13.6370097 C10.4029078,13.6465464 10.3862038,13.6555423 10.3690405,13.664083 C10.3522054,13.6723976 10.3351478,13.6801087 10.3177097,13.6872958 C10.3045293,13.6927357 10.2911788,13.6978473 10.2777746,13.7025471 C10.2584813,13.7093513 10.2389875,13.7154237 10.2194971,13.7207897 C10.2011918,13.7257748 10.1826357,13.7301514 10.1634324,13.7339067 L10.1207556,13.7413147 C10.0813306,13.7470375 10.0410112,13.75 10,13.75 L10.0566667,13.747 L10.0399512,13.7490477 L9.96132783,13.7491078 C9.94161389,13.7481976 9.92192612,13.746591 9.89546844,13.7435072 C9.79274407,13.7306516 9.69583178,13.6990985 9.6082458,13.6523619 L9.59484365,13.6451239 C9.58442452,13.639322 9.57410342,13.6332795 9.56375825,13.6268308 C9.54437371,13.6148978 9.52551484,13.6021934 9.50686916,13.5885746 L9.48480346,13.5717051 L9.41074435,13.5059223 L6.49407768,10.5892557 L6.44539737,10.5362495 C6.16954226,10.2088381 6.18576903,9.719053 6.49407768,9.41074435 L6.54708384,9.36206404 C6.87449527,9.08620893 7.36428033,9.1024357 7.67258898,9.41074435 L9.167,10.905 L9.16666667,3.33333333 C9.16666667,2.87309604 9.53976271,2.5 10,2.5 Z",
12
+ "fill": "#FFF",
13
+ "fill-rule": "nonzero"
14
+ }
15
+ })]);
16
+ }
17
+ };
@@ -1,3 +1,5 @@
1
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
+ import _regeneratorRuntime from "@babel/runtime/regenerator";
1
3
  // Utils
2
4
  import { bem, createComponent } from './shared';
3
5
 
@@ -10,6 +12,8 @@ import { BindEventMixin } from '../mixins/bind-event';
10
12
  import Icon from '../icon';
11
13
  import Swipe from '../swipe';
12
14
  import ImagePreviewItem from './ImagePreviewItem';
15
+ import Download from './Download';
16
+ import Toast from '../toast';
13
17
  export default createComponent({
14
18
  mixins: [TouchMixin, PopupMixin({
15
19
  skipToggleEvent: true
@@ -75,6 +79,14 @@ export default createComponent({
75
79
  closeIconPosition: {
76
80
  type: String,
77
81
  default: 'top-right'
82
+ },
83
+ showDownload: {
84
+ type: Boolean,
85
+ default: false
86
+ },
87
+ downloadAction: {
88
+ type: Function,
89
+ default: function _default() {}
78
90
  }
79
91
  },
80
92
  data: function data() {
@@ -127,15 +139,31 @@ export default createComponent({
127
139
  this.$emit('change', active);
128
140
  }
129
141
  },
130
- genIndex: function genIndex() {
142
+ genFooter: function genFooter() {
143
+ var _this$images$this$act, _this$images$this$act2;
131
144
  var h = this.$createElement;
132
- if (this.showIndex) {
145
+ var indexSlot = this.slots('index', {
146
+ index: this.active
147
+ });
148
+ if (indexSlot) {
133
149
  return h("div", {
134
- "class": bem('index')
135
- }, [this.slots('index', {
136
- index: this.active
137
- }) || this.active + 1 + "/" + this.images.length]);
150
+ "class": bem('footer')
151
+ }, [indexSlot]);
138
152
  }
153
+ return h("div", {
154
+ "class": bem('footer')
155
+ }, [h("div", {
156
+ "class": bem('footer-left')
157
+ }, [this.showIndex && h("span", {
158
+ "class": bem('index')
159
+ }, [this.active + 1, "/", this.images.length]), h("span", {
160
+ "class": bem('title')
161
+ }, [((_this$images$this$act = this.images[this.active]) == null ? void 0 : _this$images$this$act.title) || ''])]), this.showDownload && !((_this$images$this$act2 = this.images[this.active]) != null && _this$images$this$act2.url.startsWith('data:')) && h("span", {
162
+ "class": bem('download'),
163
+ "on": {
164
+ "click": this.onDownload
165
+ }
166
+ }, [h(Download)])]);
139
167
  },
140
168
  genCover: function genCover() {
141
169
  var h = this.$createElement;
@@ -205,12 +233,68 @@ export default createComponent({
205
233
  this.$refs.swipe.swipeTo(index, options);
206
234
  }
207
235
  },
208
- //底部标题
209
- genTitle: function genTitle() {
210
- var h = this.$createElement;
211
- return h("div", {
212
- "class": bem('title')
213
- }, [this.images[this.active] ? this.images[this.active].title : '']);
236
+ onDownload: function onDownload() {
237
+ var _this3 = this;
238
+ return _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
239
+ var _this3$images$_this3$, _this3$images$_this3$2;
240
+ var downloadParams, result, universalJsSdk, _universalJsSdk$getJS, fileJsi;
241
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
242
+ while (1) switch (_context.prev = _context.next) {
243
+ case 0:
244
+ downloadParams = {
245
+ index: _this3.active,
246
+ url: (_this3$images$_this3$ = _this3.images[_this3.active]) == null ? void 0 : _this3$images$_this3$.url,
247
+ title: (_this3$images$_this3$2 = _this3.images[_this3.active]) == null ? void 0 : _this3$images$_this3$2.title
248
+ }; // 如果提供了 downloadAction 并且返回 true,则阻止默认逻辑
249
+ if (!_this3.downloadAction) {
250
+ _context.next = 5;
251
+ break;
252
+ }
253
+ result = _this3.downloadAction(downloadParams);
254
+ if (!result) {
255
+ _context.next = 5;
256
+ break;
257
+ }
258
+ return _context.abrupt("return");
259
+ case 5:
260
+ _context.prev = 5;
261
+ _context.next = 8;
262
+ return import("@egova/universal-js-sdk");
263
+ case 8:
264
+ universalJsSdk = _context.sent;
265
+ if (universalJsSdk && universalJsSdk.getJSI && downloadParams.url) {
266
+ fileJsi = (_universalJsSdk$getJS = universalJsSdk.getJSI()) == null ? void 0 : _universalJsSdk$getJS.file;
267
+ if (fileJsi && fileJsi.download) {
268
+ Toast.loading({
269
+ message: '加载中...',
270
+ forbidClick: true,
271
+ duration: 0
272
+ });
273
+ fileJsi.download({
274
+ url: downloadParams.url
275
+ }).then(function () {
276
+ Toast.clear();
277
+ Toast.success('下载成功');
278
+ }).catch(function () {
279
+ Toast.clear();
280
+ Toast.fail("下载失败");
281
+ });
282
+ } else {
283
+ Toast.fail("当前环境暂不支持下载");
284
+ }
285
+ }
286
+ _context.next = 15;
287
+ break;
288
+ case 12:
289
+ _context.prev = 12;
290
+ _context.t0 = _context["catch"](5);
291
+ console.log(_context.t0.message);
292
+ case 15:
293
+ case "end":
294
+ return _context.stop();
295
+ }
296
+ }, _callee, null, [[5, 12]]);
297
+ }))();
214
298
  }
215
299
  },
216
300
  render: function render() {
@@ -228,6 +312,6 @@ export default createComponent({
228
312
  value: this.value
229
313
  }],
230
314
  "class": [bem(), this.className]
231
- }, [this.genClose(), this.genImages(), this.genIndex(), this.genCover(), this.genTitle()]) : null]);
315
+ }, [this.genClose(), this.genImages(), this.genFooter(), this.genCover()]) : null]);
232
316
  }
233
317
  });
@@ -1 +1 @@
1
- .zt2-image-preview{position:fixed;top:0;left:0;width:100%;height:100%}.zt2-image-preview__swipe{height:100%}.zt2-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}.zt2-image-preview__cover{position:absolute;top:0;left:0}.zt2-image-preview__image{width:100%;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform}.zt2-image-preview__image--vertical{width:auto;height:100%}.zt2-image-preview__image img{-webkit-user-drag:none}.zt2-image-preview__image .zt2-image__error{top:30%;height:40%}.zt2-image-preview__image .zt2-image__error-icon{font-size:36px}.zt2-image-preview__image .zt2-image__loading{background-color:transparent}.zt2-image-preview__index{position:absolute;bottom:12px;left:34px;height:24px;width:37px;line-height:24px;border-radius:2px;background:rgba(45,75,115,.8);color:#fff;font-size:12px;text-shadow:0 1px 1px #323233;-webkit-transform:translate(-50%,0);transform:translate(-50%,0);text-align:center;z-index:10}.zt2-image-preview__overlay.zt2-overlay{background-color:#000}.zt2-image-preview__close-icon{position:absolute;z-index:1;color:#c8c9cc;font-size:22px;cursor:pointer}.zt2-image-preview__close-icon:active{color:#969799}.zt2-image-preview__close-icon--top-left{top:16px;left:16px}.zt2-image-preview__close-icon--top-right{top:16px;right:16px}.zt2-image-preview__close-icon--bottom-left{bottom:16px;left:16px}.zt2-image-preview__close-icon--bottom-right{right:16px;bottom:16px}.zt2-image-preview__title{position:absolute;bottom:0;height:48px;width:100%;padding-left:60px;left:0;line-height:48px;font-size:14px;color:#fff;background:rgba(45,75,115,.5);z-index:9}
1
+ .zt2-image-preview{position:fixed;top:0;left:0;width:100%;height:100%}.zt2-image-preview__swipe{height:100%}.zt2-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}.zt2-image-preview__cover{position:absolute;top:0;left:0}.zt2-image-preview__image{width:100%;-webkit-transition-property:-webkit-transform;transition-property:-webkit-transform;transition-property:transform;transition-property:transform,-webkit-transform}.zt2-image-preview__image--vertical{width:auto;height:100%}.zt2-image-preview__image img{-webkit-user-drag:none}.zt2-image-preview__image .zt2-image__error{top:30%;height:40%}.zt2-image-preview__image .zt2-image__error-icon{font-size:36px}.zt2-image-preview__image .zt2-image__loading{background-color:transparent}.zt2-image-preview__footer{position:absolute;bottom:0;left:0;right:0;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;-webkit-box-align:center;-webkit-align-items:center;align-items:center;padding:0 16px;height:48px;line-height:24px;background:rgba(45,75,115,.5);color:#fff;font-size:12px;z-index:10}.zt2-image-preview__footer-left{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.zt2-image-preview__index{color:#fff;padding:0 9px;height:24px;background:rgba(45,75,115,.8);border-radius:2px}.zt2-image-preview__title{margin-left:8px;font-size:14px;color:#fff;line-height:24px}.zt2-image-preview__download{width:20px;height:20px;cursor:pointer}.zt2-image-preview__overlay.zt2-overlay{background-color:#000}.zt2-image-preview__close-icon{position:absolute;z-index:1;color:#c8c9cc;font-size:22px;cursor:pointer}.zt2-image-preview__close-icon:active{color:#969799}.zt2-image-preview__close-icon--top-left{top:16px;left:16px}.zt2-image-preview__close-icon--top-right{top:16px;right:16px}.zt2-image-preview__close-icon--bottom-left{bottom:16px;left:16px}.zt2-image-preview__close-icon--bottom-right{right:16px;bottom:16px}
@@ -13,6 +13,7 @@ var defaultConfig = {
13
13
  onChange: null,
14
14
  className: '',
15
15
  showIndex: true,
16
+ showDownload: false,
16
17
  closeable: false,
17
18
  closeIcon: 'clear',
18
19
  asyncClose: false,
@@ -54,22 +54,47 @@
54
54
  }
55
55
  }
56
56
 
57
- &__index {
57
+ &__footer {
58
58
  position: absolute;
59
- bottom: @image-preview-index-bottom;
60
- left: @image-preview-index-left;
61
- height: @image-preview-index-height;
62
- width: @image-preview-index-width;
63
- line-height:@image-preview-index-line-height;
64
- //padding: @image-preview-index-padding;
65
- border-radius: @border-radius-sm;
66
- background: @image-preview-index-background;
59
+ bottom: 0;
60
+ left: 0;
61
+ right: 0;
62
+ display: flex;
63
+ justify-content: space-between;
64
+ align-items: center;
65
+ padding: 0 16px;
66
+ height: 48px;
67
+ line-height: @image-preview-index-line-height;
68
+ background: @image-preview-title-background;
67
69
  color: @image-preview-index-text-color;
68
70
  font-size: @font-size-sm;
69
- text-shadow: @image-preview-index-text-shadow;
70
- transform: translate(-50%, 0);
71
- text-align: center;
72
71
  z-index: @image-preview-index-z-index;
72
+
73
+ &-left {
74
+ display: flex;
75
+ align-items: center;
76
+ }
77
+ }
78
+
79
+ &__index {
80
+ color: @image-preview-index-text-color;
81
+ padding: 0 9px;
82
+ height: 24px;
83
+ background: @image-preview-index-background;
84
+ border-radius: 2px;
85
+ }
86
+
87
+ &__title {
88
+ margin-left: 8px;
89
+ font-size: 14px;
90
+ color: #FFFFFF;
91
+ line-height: 24px;
92
+ }
93
+
94
+ &__download {
95
+ width: 20px;
96
+ height: 20px;
97
+ cursor: pointer;
73
98
  }
74
99
 
75
100
  &__overlay.@{base-prefix}-overlay {
@@ -107,17 +132,4 @@
107
132
  bottom: @image-preview-close-icon-margin;
108
133
  }
109
134
  }
110
- &__title{
111
- position:absolute;
112
- bottom:@image-preview-title-bottom;
113
- height: @image-preview-title-height;
114
- width: @image-preview-title-width;
115
- padding-left: @image-preview-title-padding-left;
116
- left:@image-preview-title-left;
117
- line-height: @image-preview-title-line-height;
118
- font-size: @image-preview-title-font-size;
119
- color: @white;
120
- background:@image-preview-title-background;
121
- z-index:@image-preview-title-z-index
122
- }
123
135
  }
@@ -5,6 +5,7 @@ import '../../icon/index.css';
5
5
  import '../../image/index.css';
6
6
  import '../../popup/index.css';
7
7
  import '../../loading/index.css';
8
+ import '../../toast/index.css';
8
9
  import '../../swipe/index.css';
9
10
  import '../../swipe-item/index.css';
10
11
  import '../index.css';
@@ -5,6 +5,7 @@ import '../../icon/index.less';
5
5
  import '../../image/index.less';
6
6
  import '../../popup/index.less';
7
7
  import '../../loading/index.less';
8
+ import '../../toast/index.less';
8
9
  import '../../swipe/index.less';
9
10
  import '../../swipe-item/index.less';
10
11
  import '../index.less';
package/es/index.js CHANGED
@@ -76,7 +76,7 @@ import TextEllipsis from './text-ellipsis';
76
76
  import Timeline from './timeline';
77
77
  import Toast from './toast';
78
78
  import Uploader from './uploader';
79
- var version = '2.1.28';
79
+ var version = '2.1.30';
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, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, SpeechRecognizer, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, TextEllipsis, Timeline, Toast, Uploader];
82
82
  components.forEach(function (item) {
@@ -187,6 +187,14 @@ export default createComponent({
187
187
  sortable: {
188
188
  type: Boolean,
189
189
  default: false
190
+ },
191
+ showDownload: {
192
+ type: Boolean,
193
+ default: false
194
+ },
195
+ downloadAction: {
196
+ type: Function,
197
+ default: function _default() {}
190
198
  }
191
199
  },
192
200
  model: {
@@ -726,7 +734,9 @@ export default createComponent({
726
734
  };
727
735
  }),
728
736
  startPosition: imageIndex,
729
- closeable: true
737
+ closeable: true,
738
+ showDownload: _this7.showDownload,
739
+ downloadAction: _this7.downloadAction
730
740
  });
731
741
  } else if (media.type === MediaType.AUDIO || media.type === MediaType.VIDEO) {
732
742
  if (!media.file && !media.url) {
@@ -1,4 +1,3 @@
1
- import _mergeJSXProps, { default as _mergeJSXProps2 } from "@vue/babel-helper-vue-jsx-merge-props";
2
1
  import _extends from "@babel/runtime/helpers/esm/extends";
3
2
  // Utils
4
3
  import { createNamespace } from '../utils';
@@ -375,14 +374,12 @@ export default createComponent({
375
374
  },
376
375
  genCancel: function genCancel() {
377
376
  var h = this.$createElement;
378
- return h(Button, _mergeJSXProps([{
377
+ return h(Button, {
379
378
  "class": [this.showSelectAll ? bem('in-select-all') : ''],
380
379
  "attrs": {
381
- "size": this.showSelectAll ? "medium" : "normal"
382
- }
383
- }, this.showSelectAll ? {
384
- block: true
385
- } : {}, {
380
+ "size": this.showSelectAll ? "medium" : "normal",
381
+ "block": !this.showSelectAll
382
+ },
386
383
  "style": {
387
384
  marginRigth: "4px",
388
385
  backgroundColor: "white"
@@ -390,26 +387,24 @@ export default createComponent({
390
387
  "on": {
391
388
  "click": this.cancel
392
389
  }
393
- }]), [this.slots('cancel') || this.cancelButtonText || t('cancel')]);
390
+ }, [this.slots('cancel') || this.cancelButtonText || t('cancel')]);
394
391
  },
395
392
  genConfirm: function genConfirm() {
396
393
  var h = this.$createElement;
397
- return h(Button, _mergeJSXProps2([{
394
+ return h(Button, {
398
395
  "attrs": {
399
396
  "type": "primary",
400
- "size": this.showSelectAll ? "medium" : "normal"
397
+ "size": this.showSelectAll ? "medium" : "normal",
398
+ "block": !this.showSelectAll
401
399
  },
402
- "class": [this.showSelectAll ? bem('in-select-all') : '']
403
- }, this.showSelectAll ? {
404
- block: true
405
- } : {}, {
400
+ "class": [this.showSelectAll ? bem('in-select-all') : ''],
406
401
  "style": {
407
402
  marginLeft: "8px"
408
403
  },
409
404
  "on": {
410
405
  "click": this.confirm
411
406
  }
412
- }]), [this.slots('confirm') || this.confirmButtonText || t('confirm')]);
407
+ }, [this.slots('confirm') || this.confirmButtonText || t('confirm')]);
413
408
  },
414
409
  genSelectAll: function genSelectAll() {
415
410
  var h = this.$createElement;
@@ -5,6 +5,7 @@ import '../../icon/index.css';
5
5
  import '../../image/index.css';
6
6
  import '../../popup/index.css';
7
7
  import '../../loading/index.css';
8
+ import '../../toast/index.css';
8
9
  import '../../swipe/index.css';
9
10
  import '../../swipe-item/index.css';
10
11
  import '../../image-preview/index.css';
@@ -5,6 +5,7 @@ import '../../icon/index.less';
5
5
  import '../../image/index.less';
6
6
  import '../../popup/index.less';
7
7
  import '../../loading/index.less';
8
+ import '../../toast/index.less';
8
9
  import '../../swipe/index.less';
9
10
  import '../../swipe-item/index.less';
10
11
  import '../../image-preview/index.less';