zartui 0.1.75 → 0.1.76

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/index.js CHANGED
@@ -74,7 +74,7 @@ import Tabs from './tabs';
74
74
  import Tag from './tag';
75
75
  import Toast from './toast';
76
76
  import Uploader from './uploader';
77
- var version = '0.1.75';
77
+ var version = '0.1.76';
78
78
 
79
79
  function install(Vue) {
80
80
  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, Toast, Uploader];
@@ -34,7 +34,8 @@ export default createComponent({
34
34
  data: function data() {
35
35
  return {
36
36
  options: deepClone(this.initialOptions),
37
- currentIndexs: []
37
+ currentIndexs: [],
38
+ confirmed: false
38
39
  };
39
40
  },
40
41
  watch: {
@@ -62,6 +63,10 @@ export default createComponent({
62
63
  }
63
64
  },
64
65
  setDefaultIndexs: function setDefaultIndexs() {
66
+ if (this.confirmed) {
67
+ return;
68
+ }
69
+
65
70
  this.currentIndexs = deepClone(this.defaultIndexs);
66
71
  },
67
72
  onClickItem: function onClickItem(index) {
@@ -144,6 +149,10 @@ export default createComponent({
144
149
  };
145
150
  return h("div", _mergeJSXProps2([{}, data]), [_this2.slots('option', option) || h("div", _mergeJSXProps([{}, childData]))]);
146
151
  });
152
+ },
153
+ setConfirmIndex: function setConfirmIndex(indexs) {
154
+ this.confirmed = true;
155
+ this.currentIndexs = deepClone(indexs);
147
156
  }
148
157
  },
149
158
  render: function render() {
@@ -48,7 +48,25 @@ export default createComponent({
48
48
  }
49
49
  }),
50
50
  data: function data() {
51
- return {};
51
+ return {
52
+ confirmIndexs: []
53
+ };
54
+ },
55
+ watch: {
56
+ showPicker: {
57
+ handler: function handler(val) {
58
+ var _this = this;
59
+
60
+ if (val) {
61
+ this.$nextTick(function () {
62
+ if (_this.$refs.pickerOptions && _this.confirmIndexs && _this.confirmIndexs.length) {
63
+ _this.$refs.pickerOptions.setConfirmIndex(_this.confirmIndexs);
64
+ }
65
+ });
66
+ }
67
+ },
68
+ immediate: true
69
+ }
52
70
  },
53
71
  computed: {
54
72
  itemPxHeight: function itemPxHeight() {
@@ -65,12 +83,14 @@ export default createComponent({
65
83
  this.$emit(event, this.getOptions());
66
84
  },
67
85
  getOptions: function getOptions() {
68
- var _this = this;
86
+ var _this2 = this;
69
87
 
70
88
  var indexs = this.$refs.pickerOptions.currentIndexs;
71
89
  var result = [];
72
90
  indexs.forEach(function (index) {
73
- result.push(_this.options[index]);
91
+ result.push(_extends({}, _this2.options[index], {
92
+ initialIndex: index
93
+ }));
74
94
  });
75
95
  return result;
76
96
  },
@@ -81,7 +101,11 @@ export default createComponent({
81
101
  this.emit('cancel');
82
102
  },
83
103
  confirm: function confirm() {
84
- this.emit('confirm', this.getOptions());
104
+ var options = this.getOptions();
105
+ this.confirmIndexs = options.map(function (v) {
106
+ return v.initialIndex;
107
+ });
108
+ this.emit('confirm', options);
85
109
  },
86
110
  genTitle: function genTitle() {
87
111
  var h = this.$createElement;
@@ -148,7 +172,7 @@ export default createComponent({
148
172
  }, [this.genOptionItems()]);
149
173
  },
150
174
  genOptionItems: function genOptionItems() {
151
- var _this2 = this;
175
+ var _this3 = this;
152
176
 
153
177
  var h = this.$createElement;
154
178
  var formatOptions = [];
@@ -180,7 +204,7 @@ export default createComponent({
180
204
  },
181
205
  "on": {
182
206
  "change": function change() {
183
- _this2.onChange();
207
+ _this3.onChange();
184
208
  }
185
209
  }
186
210
  });
@@ -51,7 +51,8 @@ export default createComponent({
51
51
  offset: 0,
52
52
  duration: 0,
53
53
  options: deepClone(this.initialOptions),
54
- currentIndex: this.defaultIndex
54
+ currentIndex: this.defaultIndex,
55
+ confirmIndex: ""
55
56
  };
56
57
  },
57
58
  created: function created() {
@@ -276,6 +277,12 @@ export default createComponent({
276
277
  };
277
278
  return h("li", _mergeJSXProps2([{}, data]), [_this3.slots('option', option) || h("div", _mergeJSXProps([{}, childData]))]);
278
279
  });
280
+ },
281
+ recordConfirmIndex: function recordConfirmIndex() {
282
+ this.confirmIndex = this.currentIndex;
283
+ },
284
+ setConfirmIndex: function setConfirmIndex() {
285
+ this.setIndex(this.confirmIndex, true);
279
286
  }
280
287
  },
281
288
  render: function render() {
@@ -48,7 +48,8 @@ export default createComponent({
48
48
  data: function data() {
49
49
  return {
50
50
  children: [],
51
- formattedColumns: []
51
+ formattedColumns: [],
52
+ confirmIndex: ""
52
53
  };
53
54
  },
54
55
  computed: {
@@ -74,6 +75,22 @@ export default createComponent({
74
75
  columns: {
75
76
  handler: 'format',
76
77
  immediate: true
78
+ },
79
+ showPicker: {
80
+ handler: function handler(val) {
81
+ var _this = this;
82
+
83
+ if (val) {
84
+ this.$nextTick(function () {
85
+ _this.children.forEach(function (child) {
86
+ if (child.confirmIndex !== "") {
87
+ child.setConfirmIndex();
88
+ }
89
+ });
90
+ });
91
+ }
92
+ },
93
+ immediate: true
77
94
  }
78
95
  },
79
96
  methods: {
@@ -129,7 +146,7 @@ export default createComponent({
129
146
  this.formattedColumns = formatted;
130
147
  },
131
148
  emit: function emit(event) {
132
- var _this = this;
149
+ var _this2 = this;
133
150
 
134
151
  if (this.dataType === 'text') {
135
152
  this.$emit(event, this.getColumnValue(0), this.getColumnIndex(0));
@@ -140,7 +157,7 @@ export default createComponent({
140
157
 
141
158
  if (this.dataType === 'cascade') {
142
159
  values = values.map(function (item) {
143
- return item[_this.valueKey];
160
+ return item[_this2.valueKey];
144
161
  });
145
162
  }
146
163
 
@@ -164,7 +181,7 @@ export default createComponent({
164
181
  }
165
182
  },
166
183
  onChange: function onChange(columnIndex) {
167
- var _this2 = this;
184
+ var _this3 = this;
168
185
 
169
186
  if (this.dataType === 'cascade') {
170
187
  this.onCascadeChange(columnIndex);
@@ -179,7 +196,7 @@ export default createComponent({
179
196
 
180
197
  if (this.dataType === 'cascade') {
181
198
  values = values.map(function (item) {
182
- return item[_this2.valueKey];
199
+ return item[_this3.valueKey];
183
200
  });
184
201
  }
185
202
 
@@ -254,10 +271,10 @@ export default createComponent({
254
271
  // @exposed-api
255
272
  // set values of all columns
256
273
  setValues: function setValues(values) {
257
- var _this3 = this;
274
+ var _this4 = this;
258
275
 
259
276
  values.forEach(function (value, index) {
260
- _this3.setColumnValue(index, value);
277
+ _this4.setColumnValue(index, value);
261
278
  });
262
279
  },
263
280
  // @exposed-api
@@ -270,10 +287,10 @@ export default createComponent({
270
287
  // @exposed-api
271
288
  // set indexes of all columns
272
289
  setIndexes: function setIndexes(indexes) {
273
- var _this4 = this;
290
+ var _this5 = this;
274
291
 
275
292
  indexes.forEach(function (optionIndex, columnIndex) {
276
- _this4.setColumnIndex(columnIndex, optionIndex);
293
+ _this5.setColumnIndex(columnIndex, optionIndex);
277
294
  });
278
295
  },
279
296
  // @exposed-api
@@ -281,6 +298,9 @@ export default createComponent({
281
298
  this.children.forEach(function (child) {
282
299
  return child.stopMomentum();
283
300
  });
301
+ this.children.forEach(function (child) {
302
+ return child.recordConfirmIndex();
303
+ });
284
304
  this.emit('confirm');
285
305
  },
286
306
  cancel: function cancel() {
@@ -375,7 +395,7 @@ export default createComponent({
375
395
  })]);
376
396
  },
377
397
  genColumnItems: function genColumnItems() {
378
- var _this5 = this;
398
+ var _this6 = this;
379
399
 
380
400
  var h = this.$createElement;
381
401
  return this.formattedColumns.map(function (item, columnIndex) {
@@ -383,23 +403,23 @@ export default createComponent({
383
403
 
384
404
  return h(PickerColumn, {
385
405
  "attrs": {
386
- "columnCollector": _this5.children,
387
- "readonly": _this5.readonly,
388
- "valueKey": _this5.valueKey,
389
- "allowHtml": _this5.allowHtml,
406
+ "columnCollector": _this6.children,
407
+ "readonly": _this6.readonly,
408
+ "valueKey": _this6.valueKey,
409
+ "allowHtml": _this6.allowHtml,
390
410
  "className": item.className,
391
- "itemHeight": _this5.itemPxHeight,
392
- "defaultIndex": (_item$defaultIndex = item.defaultIndex) != null ? _item$defaultIndex : +_this5.defaultIndex,
393
- "swipeDuration": _this5.swipeDuration,
394
- "visibleItemCount": _this5.visibleItemCount,
411
+ "itemHeight": _this6.itemPxHeight,
412
+ "defaultIndex": (_item$defaultIndex = item.defaultIndex) != null ? _item$defaultIndex : +_this6.defaultIndex,
413
+ "swipeDuration": _this6.swipeDuration,
414
+ "visibleItemCount": _this6.visibleItemCount,
395
415
  "initialOptions": item.values
396
416
  },
397
417
  "scopedSlots": {
398
- option: _this5.$scopedSlots.option
418
+ option: _this6.$scopedSlots.option
399
419
  },
400
420
  "on": {
401
421
  "change": function change() {
402
- _this5.onChange(columnIndex);
422
+ _this6.onChange(columnIndex);
403
423
  }
404
424
  }
405
425
  });