zartui 1.0.2 → 1.0.4

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.
@@ -51,7 +51,7 @@ export default createComponent({
51
51
  value: function value(val) {
52
52
  val = this.formatValue(val);
53
53
 
54
- if (val && val.valueOf() !== this.innerValue.valueOf()) {
54
+ if (val && this.innerValue && val.valueOf() !== this.innerValue.valueOf() || val && !this.innerValue) {
55
55
  this.innerValue = val;
56
56
  }
57
57
  }
@@ -123,6 +123,15 @@ export default createComponent({
123
123
  formatValue: function formatValue(value) {
124
124
  var _this2 = this;
125
125
 
126
+ if (typeof value === "string") {
127
+ try {
128
+ value = new Date(value);
129
+ } catch (err) {
130
+ console.error("formatValue fail", value);
131
+ return null;
132
+ }
133
+ }
134
+
126
135
  if (!isDate(value)) {
127
136
  return null;
128
137
  }
@@ -283,7 +292,13 @@ export default createComponent({
283
292
  updateColumnValue: function updateColumnValue() {
284
293
  var _this5 = this;
285
294
 
286
- var value = this.innerValue ? this.innerValue : this.minDate;
295
+ var defaultValue = new Date();
296
+
297
+ if (defaultValue.getTime() < this.minDate.getTime() || defaultValue.getTime() > this.maxDate.getTime()) {
298
+ defaultValue = this.minDate;
299
+ }
300
+
301
+ var value = this.innerValue ? this.innerValue : defaultValue;
287
302
  var formatter = this.formatter;
288
303
  var values = this.originColumns.map(function (column) {
289
304
  switch (column.type) {
@@ -144,12 +144,13 @@ export var TimePickerMixin = {
144
144
  props[key] = _this5[key];
145
145
  });
146
146
  return h(Picker, {
147
- "ref": "picker",
148
147
  "attrs": {
148
+ "show-picker": this.showPicker,
149
149
  "headers": this.headers,
150
150
  "columns": this.columns,
151
151
  "readonly": this.readonly
152
152
  },
153
+ "ref": "picker",
153
154
  "scopedSlots": this.$scopedSlots,
154
155
  "on": {
155
156
  "change": this.onChange,
@@ -8,15 +8,8 @@ var _createNamespace = createNamespace('divider'),
8
8
  bem = _createNamespace[1];
9
9
 
10
10
  function Divider(h, props, slots, ctx) {
11
- var _bem, _console$log, _bem2;
11
+ var _bem;
12
12
 
13
- console.log(bem((_bem = {
14
- dashed: props.dashed,
15
- hairline: props.hairline
16
- }, _bem["content-" + props.contentPosition] = slots.default, _bem)), (_console$log = {
17
- dashed: props.dashed,
18
- hairline: props.hairline
19
- }, _console$log["content-" + props.contentPosition] = slots.default, _console$log));
20
13
  return h("div", _mergeJSXProps([{
21
14
  "attrs": {
22
15
  "role": "separator"
@@ -24,10 +17,10 @@ function Divider(h, props, slots, ctx) {
24
17
  "style": {
25
18
  borderColor: props.borderColor
26
19
  },
27
- "class": bem((_bem2 = {
20
+ "class": bem((_bem = {
28
21
  dashed: props.dashed,
29
22
  hairline: props.hairline
30
- }, _bem2["content-" + props.contentPosition] = slots.default, _bem2))
23
+ }, _bem["content-" + props.contentPosition] = slots.default, _bem))
31
24
  }, inherit(ctx, true)]), [slots.default && slots.default()]);
32
25
  }
33
26
 
@@ -29,6 +29,10 @@ export default createComponent({
29
29
  },
30
30
  methods: {
31
31
  chooseSenior: function chooseSenior(index) {
32
+ if (this.data.length === index + 1) {
33
+ return;
34
+ }
35
+
32
36
  this.$emit("chooseSenior", index);
33
37
  }
34
38
  },
@@ -155,7 +155,8 @@ export default createComponent({
155
155
  "disableParent": this.disableParent,
156
156
  "valueKey": this.valueKey,
157
157
  "textKey": this.textKey,
158
- "confirmedList": this.confirmedList
158
+ "confirmedList": this.confirmedList,
159
+ "asyncGetter": this.asyncGetter
159
160
  },
160
161
  "on": {
161
162
  "clickNext": this.clickNext,
@@ -42,6 +42,10 @@ export default createComponent({
42
42
  default: function _default() {
43
43
  return [];
44
44
  }
45
+ },
46
+ asyncGetter: {
47
+ type: Function,
48
+ default: null
45
49
  }
46
50
  },
47
51
  data: function data() {
@@ -62,8 +66,17 @@ export default createComponent({
62
66
  index: index
63
67
  });
64
68
  },
69
+ isDisabled: function isDisabled(item) {
70
+ if (this.asyncGetter && this.disableParent && item.children) {
71
+ return true;
72
+ }
73
+
74
+ if (!this.asyncGetter && this.disableParent && item.children && item.children.length) {
75
+ return true;
76
+ }
77
+ },
65
78
  selected: function selected(item) {
66
- if (this.disableParent && item.children) {
79
+ if (this.isDisabled(item)) {
67
80
  return;
68
81
  }
69
82
 
@@ -103,6 +116,10 @@ export default createComponent({
103
116
  multipleClicked: function multipleClicked(item) {
104
117
  var _this2 = this;
105
118
 
119
+ if (this.isDisabled(item)) {
120
+ return;
121
+ }
122
+
106
123
  item = deepClone(item);
107
124
 
108
125
  if (this.checkedList && this.checkedList.length) {
@@ -174,6 +191,10 @@ export default createComponent({
174
191
  render: function render(h) {
175
192
  var _this4 = this;
176
193
 
194
+ var showSub = function showSub(item) {
195
+ return _this4.asyncGetter && item && item.children || !_this4.asyncGetter && item && item.children && item.children.length;
196
+ };
197
+
177
198
  return h("div", {
178
199
  "class": bem()
179
200
  }, [this.dataList.map(function (item, index) {
@@ -201,7 +222,7 @@ export default createComponent({
201
222
  _this4.toNextLevel(item, index);
202
223
  }
203
224
  }
204
- }, [item && item.children ? h("div", {
225
+ }, [showSub(item) ? h("div", {
205
226
  "class": bem("sub-level", _this4.getChecked(item) ? 'disable' : '')
206
227
  }, [h(SubIcon, {
207
228
  "class": bem("sub-icon")
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.2';
79
+ var version = '1.0.4';
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];
@@ -91,10 +91,6 @@ export default createComponent({
91
91
  type: Number,
92
92
  default: Number.MAX_VALUE
93
93
  },
94
- maxFileCount: {
95
- type: Number,
96
- default: Number.MAX_VALUE
97
- },
98
94
  allowTakePhoto: {
99
95
  type: Boolean,
100
96
  default: true
@@ -1 +1 @@
1
- .zt-pdf-viewer-v2{width:100%;height:100%;position:relative}.zt-pdf-viewer-v2::-webkit-scrollbar{width:0;height:0}.zt-pdf-viewer-v2__page-box{width:100%;height:44px;background-color:#fff;position:fixed;bottom:0;left:0;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}
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{height:calc(100% - 44px);overflow:scroll}.zt-pdf-viewer-v2__container{height:100%}.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}
@@ -138,8 +138,7 @@ export default createComponent({
138
138
  var _this2 = this;
139
139
 
140
140
  if (!this.PDFJS) {
141
- this.PDFJS = window['pdfjs-dist/build/pdf'];
142
- console.log("window['pdfjs-dist/build/pdf']", window['pdfjs-dist/build/pdf']);
141
+ this.PDFJS = window['pdfjs-dist/build/pdf'] || window.pdfjsLib;
143
142
 
144
143
  if (this.PDFJS && this.PDFJS.GlobalWorkerOptions) {
145
144
  this.PDFJS.GlobalWorkerOptions.workerSrc = require("pdfjs-dist/build/pdf.worker.entry");
@@ -199,6 +198,8 @@ export default createComponent({
199
198
  return h("div", {
200
199
  "class": bem(),
201
200
  "ref": "pdfContainer"
201
+ }, [h("div", {
202
+ "class": bem("inner-container")
202
203
  }, [h(Loading, {
203
204
  "directives": [{
204
205
  name: "show",
@@ -212,7 +213,7 @@ export default createComponent({
212
213
  }],
213
214
  "ref": "pdfViewerContainer",
214
215
  "class": bem("container")
215
- }), this.totalPage ? h("div", {
216
+ })]), this.totalPage ? h("div", {
216
217
  "class": bem("page-box")
217
218
  }, [h("span", {
218
219
  "class": bem("pre"),
@@ -3,6 +3,17 @@
3
3
  width: 100%;
4
4
  height: 100%;
5
5
  position: relative;
6
+ display: flex;
7
+ flex-direction: column;
8
+
9
+ &__inner-container {
10
+ height: calc(100% - 44px);
11
+ overflow: scroll;
12
+ }
13
+
14
+ &__container {
15
+ height: 100%;
16
+ }
6
17
 
7
18
  &::-webkit-scrollbar {
8
19
  width: 0;
@@ -13,9 +24,6 @@
13
24
  width: 100%;
14
25
  height: 44px;
15
26
  background-color: #fff;
16
- position: fixed;
17
- bottom: 0;
18
- left: 0;
19
27
  text-align: center;
20
28
  font-size: 16px;
21
29
  line-height: 44px;
@@ -282,7 +282,11 @@ export default createComponent({
282
282
  this.confirmIndex = this.currentIndex;
283
283
  },
284
284
  setConfirmIndex: function setConfirmIndex() {
285
- this.setIndex(this.confirmIndex, true);
285
+ if (this.confirmIndex || this.confirmIndex === 0) {
286
+ this.setIndex(this.confirmIndex, true);
287
+ } else {
288
+ this.setIndex(this.defaultIndex, true);
289
+ }
286
290
  }
287
291
  },
288
292
  render: function render() {
@@ -83,9 +83,7 @@ export default createComponent({
83
83
  if (val) {
84
84
  this.$nextTick(function () {
85
85
  _this.children.forEach(function (child) {
86
- if (child.confirmIndex !== "") {
87
- child.setConfirmIndex();
88
- }
86
+ child.setConfirmIndex();
89
87
  });
90
88
  });
91
89
  }
@@ -65,7 +65,7 @@ var _default2 = createComponent({
65
65
  value: function value(val) {
66
66
  val = this.formatValue(val);
67
67
 
68
- if (val && val.valueOf() !== this.innerValue.valueOf()) {
68
+ if (val && this.innerValue && val.valueOf() !== this.innerValue.valueOf() || val && !this.innerValue) {
69
69
  this.innerValue = val;
70
70
  }
71
71
  }
@@ -137,6 +137,15 @@ var _default2 = createComponent({
137
137
  formatValue: function formatValue(value) {
138
138
  var _this2 = this;
139
139
 
140
+ if (typeof value === "string") {
141
+ try {
142
+ value = new Date(value);
143
+ } catch (err) {
144
+ console.error("formatValue fail", value);
145
+ return null;
146
+ }
147
+ }
148
+
140
149
  if (!(0, _date.isDate)(value)) {
141
150
  return null;
142
151
  }
@@ -297,7 +306,13 @@ var _default2 = createComponent({
297
306
  updateColumnValue: function updateColumnValue() {
298
307
  var _this5 = this;
299
308
 
300
- var value = this.innerValue ? this.innerValue : this.minDate;
309
+ var defaultValue = new Date();
310
+
311
+ if (defaultValue.getTime() < this.minDate.getTime() || defaultValue.getTime() > this.maxDate.getTime()) {
312
+ defaultValue = this.minDate;
313
+ }
314
+
315
+ var value = this.innerValue ? this.innerValue : defaultValue;
301
316
  var formatter = this.formatter;
302
317
  var values = this.originColumns.map(function (column) {
303
318
  switch (column.type) {
@@ -158,12 +158,13 @@ var TimePickerMixin = {
158
158
  props[key] = _this5[key];
159
159
  });
160
160
  return h(_picker.default, {
161
- "ref": "picker",
162
161
  "attrs": {
162
+ "show-picker": this.showPicker,
163
163
  "headers": this.headers,
164
164
  "columns": this.columns,
165
165
  "readonly": this.readonly
166
166
  },
167
+ "ref": "picker",
167
168
  "scopedSlots": this.$scopedSlots,
168
169
  "on": {
169
170
  "change": this.onChange,
@@ -17,15 +17,8 @@ var _createNamespace = (0, _utils.createNamespace)('divider'),
17
17
  bem = _createNamespace[1];
18
18
 
19
19
  function Divider(h, props, slots, ctx) {
20
- var _bem, _console$log, _bem2;
21
-
22
- console.log(bem((_bem = {
23
- dashed: props.dashed,
24
- hairline: props.hairline
25
- }, _bem["content-" + props.contentPosition] = slots.default, _bem)), (_console$log = {
26
- dashed: props.dashed,
27
- hairline: props.hairline
28
- }, _console$log["content-" + props.contentPosition] = slots.default, _console$log));
20
+ var _bem;
21
+
29
22
  return h("div", (0, _babelHelperVueJsxMergeProps.default)([{
30
23
  "attrs": {
31
24
  "role": "separator"
@@ -33,10 +26,10 @@ function Divider(h, props, slots, ctx) {
33
26
  "style": {
34
27
  borderColor: props.borderColor
35
28
  },
36
- "class": bem((_bem2 = {
29
+ "class": bem((_bem = {
37
30
  dashed: props.dashed,
38
31
  hairline: props.hairline
39
- }, _bem2["content-" + props.contentPosition] = slots.default, _bem2))
32
+ }, _bem["content-" + props.contentPosition] = slots.default, _bem))
40
33
  }, (0, _functional.inherit)(ctx, true)]), [slots.default && slots.default()]);
41
34
  }
42
35
 
@@ -37,6 +37,10 @@ var _default2 = createComponent({
37
37
  },
38
38
  methods: {
39
39
  chooseSenior: function chooseSenior(index) {
40
+ if (this.data.length === index + 1) {
41
+ return;
42
+ }
43
+
40
44
  this.$emit("chooseSenior", index);
41
45
  }
42
46
  },
@@ -168,7 +168,8 @@ var _default2 = createComponent({
168
168
  "disableParent": this.disableParent,
169
169
  "valueKey": this.valueKey,
170
170
  "textKey": this.textKey,
171
- "confirmedList": this.confirmedList
171
+ "confirmedList": this.confirmedList,
172
+ "asyncGetter": this.asyncGetter
172
173
  },
173
174
  "on": {
174
175
  "clickNext": this.clickNext,
@@ -52,6 +52,10 @@ var _default2 = createComponent({
52
52
  default: function _default() {
53
53
  return [];
54
54
  }
55
+ },
56
+ asyncGetter: {
57
+ type: Function,
58
+ default: null
55
59
  }
56
60
  },
57
61
  data: function data() {
@@ -72,8 +76,17 @@ var _default2 = createComponent({
72
76
  index: index
73
77
  });
74
78
  },
79
+ isDisabled: function isDisabled(item) {
80
+ if (this.asyncGetter && this.disableParent && item.children) {
81
+ return true;
82
+ }
83
+
84
+ if (!this.asyncGetter && this.disableParent && item.children && item.children.length) {
85
+ return true;
86
+ }
87
+ },
75
88
  selected: function selected(item) {
76
- if (this.disableParent && item.children) {
89
+ if (this.isDisabled(item)) {
77
90
  return;
78
91
  }
79
92
 
@@ -113,6 +126,10 @@ var _default2 = createComponent({
113
126
  multipleClicked: function multipleClicked(item) {
114
127
  var _this2 = this;
115
128
 
129
+ if (this.isDisabled(item)) {
130
+ return;
131
+ }
132
+
116
133
  item = (0, _deepClone.deepClone)(item);
117
134
 
118
135
  if (this.checkedList && this.checkedList.length) {
@@ -184,6 +201,10 @@ var _default2 = createComponent({
184
201
  render: function render(h) {
185
202
  var _this4 = this;
186
203
 
204
+ var showSub = function showSub(item) {
205
+ return _this4.asyncGetter && item && item.children || !_this4.asyncGetter && item && item.children && item.children.length;
206
+ };
207
+
187
208
  return h("div", {
188
209
  "class": bem()
189
210
  }, [this.dataList.map(function (item, index) {
@@ -211,7 +232,7 @@ var _default2 = createComponent({
211
232
  _this4.toNextLevel(item, index);
212
233
  }
213
234
  }
214
- }, [item && item.children ? h("div", {
235
+ }, [showSub(item) ? h("div", {
215
236
  "class": bem("sub-level", _this4.getChecked(item) ? 'disable' : '')
216
237
  }, [h(_SubIcon.default, {
217
238
  "class": bem("sub-icon")