zartui 1.0.6 → 1.0.7
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/datetime-picker/DatePicker.js +6 -3
- package/es/datetime-picker/TimePicker.js +3 -0
- package/es/datetime-picker/index.js +1 -1
- package/es/datetime-picker/shared.js +25 -3
- package/es/datetime-picker/utils.js +4 -0
- package/es/field/index.js +1 -3
- package/es/index.js +1 -1
- package/es/pdf-viewer/index.js +12 -0
- package/es/picker/PickerColumn.js +64 -17
- package/es/picker/index.js +6 -2
- package/lib/7893e51cf0a4877dac80.worker.js +10 -0
- package/lib/be09b519a460e229fd8d.worker.js +2527 -0
- package/lib/datetime-picker/DatePicker.js +6 -3
- package/lib/datetime-picker/TimePicker.js +3 -0
- package/lib/datetime-picker/index.js +1 -1
- package/lib/datetime-picker/shared.js +25 -3
- package/lib/datetime-picker/utils.js +4 -0
- package/lib/field/index.js +1 -3
- package/lib/index.js +1 -1
- package/lib/pdf-viewer/index.js +12 -0
- package/lib/picker/PickerColumn.js +64 -14
- package/lib/picker/index.js +6 -2
- package/lib/zart.js +17648 -49782
- package/lib/zart.min.js +4 -4
- package/package.json +1 -1
- package/lib/a037f57fc4d92a8a1f1e.worker.js +0 -60600
- package/lib/b7cf90b4775181215df7.worker.js +0 -10
|
@@ -125,10 +125,10 @@ export default createComponent({
|
|
|
125
125
|
|
|
126
126
|
if (typeof value === "string") {
|
|
127
127
|
try {
|
|
128
|
+
value = value.replace(/-/g, "/");
|
|
128
129
|
value = new Date(value);
|
|
129
|
-
} catch (
|
|
130
|
-
console.error("
|
|
131
|
-
return null;
|
|
130
|
+
} catch (error) {
|
|
131
|
+
console.error("datetime-picker strToDate error", error);
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
134
|
|
|
@@ -285,6 +285,9 @@ export default createComponent({
|
|
|
285
285
|
this.updateInnerValue();
|
|
286
286
|
this.$nextTick(function () {
|
|
287
287
|
_this4.$nextTick(function () {
|
|
288
|
+
// https://github.com/vant-ui/vant/issues/9775
|
|
289
|
+
_this4.updateInnerValue();
|
|
290
|
+
|
|
288
291
|
_this4.$emit('change', picker);
|
|
289
292
|
});
|
|
290
293
|
});
|
|
@@ -122,6 +122,9 @@ export default createComponent({
|
|
|
122
122
|
this.updateInnerValue();
|
|
123
123
|
this.$nextTick(function () {
|
|
124
124
|
_this2.$nextTick(function () {
|
|
125
|
+
// https://github.com/vant-ui/vant/issues/9775
|
|
126
|
+
_this2.updateInnerValue();
|
|
127
|
+
|
|
125
128
|
_this2.$emit('change', picker);
|
|
126
129
|
});
|
|
127
130
|
});
|
|
@@ -123,10 +123,32 @@ export var TimePickerMixin = {
|
|
|
123
123
|
}
|
|
124
124
|
},
|
|
125
125
|
methods: {
|
|
126
|
-
// @exposed-api
|
|
127
126
|
getPicker: function getPicker() {
|
|
128
127
|
return this.$refs.picker;
|
|
129
128
|
},
|
|
129
|
+
// https://github.com/vant-ui/vant/issues/10013
|
|
130
|
+
getProxiedPicker: function getProxiedPicker() {
|
|
131
|
+
var _this5 = this;
|
|
132
|
+
|
|
133
|
+
var picker = this.$refs.picker;
|
|
134
|
+
|
|
135
|
+
if (picker) {
|
|
136
|
+
var proxy = function proxy(fn) {
|
|
137
|
+
return function () {
|
|
138
|
+
picker[fn].apply(picker, arguments);
|
|
139
|
+
|
|
140
|
+
_this5.updateInnerValue();
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
return _extends({}, picker, {
|
|
145
|
+
setValues: proxy('setValues'),
|
|
146
|
+
setIndexes: proxy('setIndexes'),
|
|
147
|
+
setColumnIndex: proxy('setColumnIndex'),
|
|
148
|
+
setColumnValue: proxy('setColumnValue')
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
},
|
|
130
152
|
onConfirm: function onConfirm() {
|
|
131
153
|
this.$emit('input', this.innerValue);
|
|
132
154
|
this.$emit('confirm', this.innerValue);
|
|
@@ -137,12 +159,12 @@ export var TimePickerMixin = {
|
|
|
137
159
|
}
|
|
138
160
|
},
|
|
139
161
|
render: function render() {
|
|
140
|
-
var
|
|
162
|
+
var _this6 = this;
|
|
141
163
|
|
|
142
164
|
var h = arguments[0];
|
|
143
165
|
var props = {};
|
|
144
166
|
Object.keys(pickerProps).forEach(function (key) {
|
|
145
|
-
props[key] =
|
|
167
|
+
props[key] = _this6[key];
|
|
146
168
|
});
|
|
147
169
|
return h(Picker, {
|
|
148
170
|
"attrs": {
|
package/es/field/index.js
CHANGED
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.7';
|
|
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];
|
package/es/pdf-viewer/index.js
CHANGED
|
@@ -40,6 +40,10 @@ export default createComponent({
|
|
|
40
40
|
url: {
|
|
41
41
|
type: String,
|
|
42
42
|
default: ""
|
|
43
|
+
},
|
|
44
|
+
showPageMargin: {
|
|
45
|
+
type: Boolean,
|
|
46
|
+
default: true
|
|
43
47
|
}
|
|
44
48
|
},
|
|
45
49
|
data: function data() {
|
|
@@ -323,6 +327,10 @@ export default createComponent({
|
|
|
323
327
|
"error": this.onPdfError
|
|
324
328
|
}
|
|
325
329
|
}), h("div", {
|
|
330
|
+
"directives": [{
|
|
331
|
+
name: "show",
|
|
332
|
+
value: this.showPageMargin
|
|
333
|
+
}],
|
|
326
334
|
"class": bem("page-margin")
|
|
327
335
|
})]);
|
|
328
336
|
} else {
|
|
@@ -332,6 +340,10 @@ export default createComponent({
|
|
|
332
340
|
},
|
|
333
341
|
"style": "width:100vw;height:100vh;"
|
|
334
342
|
}), h("div", {
|
|
343
|
+
"directives": [{
|
|
344
|
+
name: "show",
|
|
345
|
+
value: this.showPageMargin
|
|
346
|
+
}],
|
|
335
347
|
"class": bem("page-margin")
|
|
336
348
|
})]);
|
|
337
349
|
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import _mergeJSXProps2 from "@vue/babel-helper-vue-jsx-merge-props";
|
|
2
2
|
import _mergeJSXProps from "@vue/babel-helper-vue-jsx-merge-props";
|
|
3
3
|
import { deepClone } from '../utils/deep-clone';
|
|
4
|
-
import { createNamespace, isObject } from '../utils';
|
|
4
|
+
import { createNamespace, inBrowser, isObject } from '../utils';
|
|
5
5
|
import { range } from '../utils/format/number';
|
|
6
|
-
import { preventDefault } from '../utils/dom/event';
|
|
6
|
+
import { preventDefault, on, off } from '../utils/dom/event';
|
|
7
7
|
import { TouchMixin } from '../mixins/touch';
|
|
8
8
|
var DEFAULT_DURATION = 200; // 惯性滑动思路:
|
|
9
9
|
// 在手指离开屏幕时,如果和上一次 move 时的间隔小于 `MOMENTUM_LIMIT_TIME` 且 move
|
|
10
10
|
// 距离大于 `MOMENTUM_LIMIT_DISTANCE` 时,执行惯性滑动
|
|
11
11
|
|
|
12
|
-
var MOMENTUM_LIMIT_TIME = 300;
|
|
13
|
-
var MOMENTUM_LIMIT_DISTANCE = 15;
|
|
12
|
+
export var MOMENTUM_LIMIT_TIME = 300;
|
|
13
|
+
export var MOMENTUM_LIMIT_DISTANCE = 15;
|
|
14
14
|
|
|
15
15
|
var _createNamespace = createNamespace('picker-column'),
|
|
16
16
|
createComponent = _createNamespace[0],
|
|
@@ -25,8 +25,12 @@ function getElementTranslateY(element) {
|
|
|
25
25
|
|
|
26
26
|
function isOptionDisabled(option) {
|
|
27
27
|
return isObject(option) && option.disabled;
|
|
28
|
-
}
|
|
28
|
+
} // use standard WheelEvent:
|
|
29
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/WheelEvent
|
|
30
|
+
|
|
29
31
|
|
|
32
|
+
var supportMousewheel = inBrowser && 'onwheel' in window;
|
|
33
|
+
var mousewheelTimer = null;
|
|
30
34
|
export default createComponent({
|
|
31
35
|
mixins: [TouchMixin],
|
|
32
36
|
props: {
|
|
@@ -64,11 +68,19 @@ export default createComponent({
|
|
|
64
68
|
},
|
|
65
69
|
mounted: function mounted() {
|
|
66
70
|
this.bindTouchEvent(this.$el);
|
|
71
|
+
|
|
72
|
+
if (supportMousewheel) {
|
|
73
|
+
on(this.$el, 'wheel', this.onMouseWheel, false);
|
|
74
|
+
}
|
|
67
75
|
},
|
|
68
76
|
destroyed: function destroyed() {
|
|
69
77
|
if (this.columnCollector) {
|
|
70
78
|
this.columnCollector.splice(this.columnCollector.indexOf(this), 1);
|
|
71
79
|
}
|
|
80
|
+
|
|
81
|
+
if (supportMousewheel) {
|
|
82
|
+
off(this.$el, 'wheel');
|
|
83
|
+
}
|
|
72
84
|
},
|
|
73
85
|
watch: {
|
|
74
86
|
initialOptions: 'setOptions',
|
|
@@ -156,6 +168,43 @@ export default createComponent({
|
|
|
156
168
|
_this.moving = false;
|
|
157
169
|
}, 0);
|
|
158
170
|
},
|
|
171
|
+
onMouseWheel: function onMouseWheel(event) {
|
|
172
|
+
var _this2 = this;
|
|
173
|
+
|
|
174
|
+
if (this.readonly) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
preventDefault(event, true); // simply combine touchstart and touchmove
|
|
179
|
+
|
|
180
|
+
var translateY = getElementTranslateY(this.$refs.wrapper);
|
|
181
|
+
this.startOffset = Math.min(0, translateY - this.baseOffset);
|
|
182
|
+
this.momentumOffset = this.startOffset;
|
|
183
|
+
this.transitionEndTrigger = null; // directly use deltaY, see https://caniuse.com/?search=deltaY
|
|
184
|
+
// use deltaY to detect direction for not special setting device
|
|
185
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/Element/wheel_event
|
|
186
|
+
|
|
187
|
+
var deltaY = event.deltaY;
|
|
188
|
+
|
|
189
|
+
if (this.startOffset === 0 && deltaY < 0) {
|
|
190
|
+
return;
|
|
191
|
+
} // get offset
|
|
192
|
+
// if necessary, can adjust distance value to make scrolling smoother
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
var distance = -deltaY;
|
|
196
|
+
this.offset = range(this.startOffset + distance, -(this.count * this.itemHeight), this.itemHeight);
|
|
197
|
+
|
|
198
|
+
if (mousewheelTimer) {
|
|
199
|
+
clearTimeout(mousewheelTimer);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
mousewheelTimer = setTimeout(function () {
|
|
203
|
+
_this2.onTouchEnd();
|
|
204
|
+
|
|
205
|
+
_this2.touchStartTime = 0;
|
|
206
|
+
}, MOMENTUM_LIMIT_TIME);
|
|
207
|
+
},
|
|
159
208
|
onTransitionEnd: function onTransitionEnd() {
|
|
160
209
|
this.stopMomentum();
|
|
161
210
|
},
|
|
@@ -187,17 +236,17 @@ export default createComponent({
|
|
|
187
236
|
return option;
|
|
188
237
|
},
|
|
189
238
|
setIndex: function setIndex(index, emitChange) {
|
|
190
|
-
var
|
|
239
|
+
var _this3 = this;
|
|
191
240
|
|
|
192
241
|
index = this.adjustIndex(index) || 0;
|
|
193
242
|
var offset = -index * this.itemHeight;
|
|
194
243
|
|
|
195
244
|
var trigger = function trigger() {
|
|
196
|
-
if (index !==
|
|
197
|
-
|
|
245
|
+
if (index !== _this3.currentIndex) {
|
|
246
|
+
_this3.currentIndex = index;
|
|
198
247
|
|
|
199
248
|
if (emitChange) {
|
|
200
|
-
|
|
249
|
+
_this3.$emit('change', index);
|
|
201
250
|
}
|
|
202
251
|
}
|
|
203
252
|
}; // trigger the change event after transitionend when moving
|
|
@@ -243,7 +292,7 @@ export default createComponent({
|
|
|
243
292
|
}
|
|
244
293
|
},
|
|
245
294
|
genOptions: function genOptions() {
|
|
246
|
-
var
|
|
295
|
+
var _this4 = this;
|
|
247
296
|
|
|
248
297
|
var h = this.$createElement;
|
|
249
298
|
var optionStyle = {
|
|
@@ -252,7 +301,7 @@ export default createComponent({
|
|
|
252
301
|
return this.options.map(function (option, index) {
|
|
253
302
|
var _domProps;
|
|
254
303
|
|
|
255
|
-
var text =
|
|
304
|
+
var text = _this4.getOptionText(option);
|
|
256
305
|
|
|
257
306
|
var disabled = isOptionDisabled(option);
|
|
258
307
|
var data = {
|
|
@@ -263,19 +312,19 @@ export default createComponent({
|
|
|
263
312
|
},
|
|
264
313
|
class: [bem('item', {
|
|
265
314
|
disabled: disabled,
|
|
266
|
-
selected: index ===
|
|
315
|
+
selected: index === _this4.currentIndex
|
|
267
316
|
})],
|
|
268
317
|
on: {
|
|
269
318
|
click: function click() {
|
|
270
|
-
|
|
319
|
+
_this4.onClickItem(index);
|
|
271
320
|
}
|
|
272
321
|
}
|
|
273
322
|
};
|
|
274
323
|
var childData = {
|
|
275
324
|
class: 'zt-ellipsis',
|
|
276
|
-
domProps: (_domProps = {}, _domProps[
|
|
325
|
+
domProps: (_domProps = {}, _domProps[_this4.allowHtml ? 'innerHTML' : 'textContent'] = text, _domProps)
|
|
277
326
|
};
|
|
278
|
-
return h("li", _mergeJSXProps2([{}, data]), [
|
|
327
|
+
return h("li", _mergeJSXProps2([{}, data]), [_this4.slots('option', option) || h("div", _mergeJSXProps([{}, childData]))]);
|
|
279
328
|
});
|
|
280
329
|
},
|
|
281
330
|
recordConfirmIndex: function recordConfirmIndex() {
|
|
@@ -284,8 +333,6 @@ export default createComponent({
|
|
|
284
333
|
setConfirmIndex: function setConfirmIndex() {
|
|
285
334
|
if (this.confirmIndex || this.confirmIndex === 0) {
|
|
286
335
|
this.setIndex(this.confirmIndex, true);
|
|
287
|
-
} else {
|
|
288
|
-
this.setIndex(this.defaultIndex, true);
|
|
289
336
|
}
|
|
290
337
|
}
|
|
291
338
|
},
|
package/es/picker/index.js
CHANGED
|
@@ -85,6 +85,10 @@ export default createComponent({
|
|
|
85
85
|
_this.children.forEach(function (child) {
|
|
86
86
|
child.setConfirmIndex();
|
|
87
87
|
});
|
|
88
|
+
|
|
89
|
+
_this.children.forEach(function (child) {
|
|
90
|
+
child.recordConfirmIndex();
|
|
91
|
+
});
|
|
88
92
|
});
|
|
89
93
|
}
|
|
90
94
|
},
|
|
@@ -151,7 +155,7 @@ export default createComponent({
|
|
|
151
155
|
} else {
|
|
152
156
|
var values = this.getValues(); // compatible with old version of wrong parameters
|
|
153
157
|
// should be removed in next major version
|
|
154
|
-
// see: https://github.com/
|
|
158
|
+
// see: https://github.com/vant-ui/vant/issues/5905
|
|
155
159
|
|
|
156
160
|
if (this.dataType === 'cascade') {
|
|
157
161
|
values = values.map(function (item) {
|
|
@@ -190,7 +194,7 @@ export default createComponent({
|
|
|
190
194
|
} else {
|
|
191
195
|
var values = this.getValues(); // compatible with old version of wrong parameters
|
|
192
196
|
// should be removed in next major version
|
|
193
|
-
// see: https://github.com/
|
|
197
|
+
// see: https://github.com/vant-ui/vant/issues/5905
|
|
194
198
|
|
|
195
199
|
if (this.dataType === 'cascade') {
|
|
196
200
|
values = values.map(function (item) {
|