zartui 2.0.90 → 2.0.91
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/calendar/style/index.js +1 -0
- package/es/calendar/style/less.js +1 -0
- package/es/datetime-picker/index.css +1 -0
- package/es/datetime-picker/index.js +302 -1
- package/es/datetime-picker/index.less +81 -0
- package/es/datetime-picker/shared.js +18 -5
- package/es/datetime-picker/style/index.js +3 -1
- package/es/datetime-picker/style/less.js +3 -1
- package/es/picker/index.js +43 -20
- package/lib/calendar/style/index.js +1 -0
- package/lib/calendar/style/less.js +1 -0
- package/lib/datetime-picker/index.css +1 -0
- package/lib/datetime-picker/index.js +308 -4
- package/lib/datetime-picker/index.less +81 -0
- package/lib/datetime-picker/shared.js +17 -4
- package/lib/datetime-picker/style/index.js +3 -1
- package/lib/datetime-picker/style/less.js +3 -1
- package/lib/index.css +1 -1
- package/lib/index.less +2 -1
- package/lib/picker/index.js +43 -20
- package/lib/zart.js +569 -232
- package/lib/zart.min.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[class*=zt2-hairline]::after{position:absolute;box-sizing:border-box;content:' ';pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid rgba(0,0,0,.1);-webkit-transform:scale(.5);transform:scale(.5)}.zt2-hairline,.zt2-hairline--bottom,.zt2-hairline--left,.zt2-hairline--right,.zt2-hairline--surround,.zt2-hairline--top,.zt2-hairline--top-bottom{position:relative}.zt2-hairline--top::after{border-top-width:1px}.zt2-hairline--left::after{border-left-width:1px}.zt2-hairline--right::after{border-right-width:1px}.zt2-hairline--bottom::after{border-bottom-width:1px}.zt2-hairline--top-bottom::after,.zt2-hairline-unset--top-bottom::after{border-width:1px 0}.zt2-hairline--surround::after{border-width:1px}.zt2-datetime-picker__title-tab-bar{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.zt2-datetime-picker__title-bar{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-align:center;-webkit-align-items:center;align-items:center;padding:12px;-webkit-box-flex:1;-webkit-flex:1;flex:1;color:#2d4b73}.zt2-datetime-picker__title-bar--unselected{color:rgba(45,75,115,.4)}.zt2-datetime-picker__title{font-weight:700;font-size:14px;line-height:20px;height:20px}.zt2-datetime-picker__title--selected{color:#0091fa}.zt2-datetime-picker__title--unselected{font-weight:400}.zt2-datetime-picker__value{font-size:14px;line-height:20px;height:20px;margin-top:4px}.zt2-datetime-picker__toolbar{box-sizing:content-box;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;height:44px;padding:8px 16px 8px 16px;border-top:1px solid rgba(45,75,115,.1);position:relative}.zt2-datetime-picker__cancel,.zt2-datetime-picker__confirm{height:100%;padding:0 16px;font-size:14px;background-color:transparent;border:none;cursor:pointer}.zt2-datetime-picker__cancel:active,.zt2-datetime-picker__confirm:active{opacity:.7}.zt2-datetime-picker__confirm{color:#0091fa;font-weight:700}.zt2-datetime-picker__cancel{color:#000;font-weight:400}
|
|
@@ -2,22 +2,323 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import { createNamespace } from '../utils';
|
|
3
3
|
import TimePicker from './TimePicker';
|
|
4
4
|
import DatePicker from './DatePicker';
|
|
5
|
+
import { isDate } from '../utils/validate/date';
|
|
6
|
+
import Popup from '../popup';
|
|
7
|
+
import Button from '../button';
|
|
8
|
+
import Toast from '../toast';
|
|
9
|
+
import dayjs from 'dayjs';
|
|
5
10
|
|
|
6
11
|
var _createNamespace = createNamespace('datetime-picker'),
|
|
7
12
|
createComponent = _createNamespace[0],
|
|
8
13
|
bem = _createNamespace[1];
|
|
9
14
|
|
|
15
|
+
export var RANGE_START_PICKER = 0;
|
|
16
|
+
export var RANGE_END_PICKER = 1;
|
|
10
17
|
export default createComponent({
|
|
11
|
-
props: _extends({}, TimePicker.props, DatePicker.props
|
|
18
|
+
props: _extends({}, TimePicker.props, DatePicker.props, {
|
|
19
|
+
// 是否开启时间范围选择
|
|
20
|
+
range: {
|
|
21
|
+
type: Boolean,
|
|
22
|
+
default: false
|
|
23
|
+
},
|
|
24
|
+
startValue: {
|
|
25
|
+
type: Date,
|
|
26
|
+
default: function _default() {
|
|
27
|
+
return new Date();
|
|
28
|
+
},
|
|
29
|
+
validator: isDate
|
|
30
|
+
},
|
|
31
|
+
endValue: {
|
|
32
|
+
type: Date,
|
|
33
|
+
default: function _default() {
|
|
34
|
+
return new Date();
|
|
35
|
+
},
|
|
36
|
+
validator: isDate
|
|
37
|
+
},
|
|
38
|
+
rangeHeaderStartText: {
|
|
39
|
+
type: String,
|
|
40
|
+
default: '开始时间'
|
|
41
|
+
},
|
|
42
|
+
rangeHeaderEndText: {
|
|
43
|
+
type: String,
|
|
44
|
+
default: '结束时间'
|
|
45
|
+
}
|
|
46
|
+
}),
|
|
47
|
+
data: function data() {
|
|
48
|
+
return {
|
|
49
|
+
rangeSelectedIndex: RANGE_START_PICKER,
|
|
50
|
+
refreshComputedKey: new Date().getTime(),
|
|
51
|
+
innerStartValue: this.startValue,
|
|
52
|
+
innerEndValue: this.endValue,
|
|
53
|
+
confirmedPopupPickerIndex: false
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
computed: {
|
|
57
|
+
currentStartText: function currentStartText() {
|
|
58
|
+
return this.genOriginValueText(this.innerStartValue);
|
|
59
|
+
},
|
|
60
|
+
currentEndText: function currentEndText() {
|
|
61
|
+
return this.genOriginValueText(this.innerEndValue);
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
watch: {
|
|
65
|
+
showPicker: function showPicker(val) {
|
|
66
|
+
var _this = this;
|
|
67
|
+
|
|
68
|
+
// 在第一次打开popup时,需要初始化内部picker存储的时间列index,避免初次打开直接关闭,导致picker内部index丢失
|
|
69
|
+
if (val && !this.confirmedPopupPickerIndex) {
|
|
70
|
+
// 注意这里实际上是双层nextTick,为了解决picker组件setConfirmIndex也在nextTick中执行,导致无法正确设置index的问题
|
|
71
|
+
this.$nextTick(function () {
|
|
72
|
+
_this.updatePickerConfirm();
|
|
73
|
+
|
|
74
|
+
_this.confirmedPopupPickerIndex = true;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
},
|
|
12
79
|
methods: {
|
|
13
80
|
// @exposed-api
|
|
14
81
|
getPicker: function getPicker() {
|
|
82
|
+
if (this.range) {
|
|
83
|
+
return [this.$refs.rangeStart.getProxiedPicker(), this.$refs.rangeEnd.getProxiedPicker()];
|
|
84
|
+
}
|
|
85
|
+
|
|
15
86
|
return this.$refs.root.getProxiedPicker();
|
|
87
|
+
},
|
|
88
|
+
genValueText: function genValueText(dateValue, timeValue) {
|
|
89
|
+
var text = '';
|
|
90
|
+
|
|
91
|
+
if (dateValue.length > 0) {
|
|
92
|
+
text += dateValue.join('/');
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (timeValue.length > 0) {
|
|
96
|
+
text = text + ' ' + timeValue.join(':');
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return text;
|
|
100
|
+
},
|
|
101
|
+
genOriginValueText: function genOriginValueText(values) {
|
|
102
|
+
if (!values) return '-';
|
|
103
|
+
var dateTime = dayjs(values).format('YYYY-MM-DDTHH:mm:ss');
|
|
104
|
+
var dateTimeArr = dateTime.split(/[-T:]/);
|
|
105
|
+
var dateValues = [];
|
|
106
|
+
var timeValues = [];
|
|
107
|
+
|
|
108
|
+
if (this.$refs.rangeStart && this.$refs.rangeStart.originColumns) {
|
|
109
|
+
this.$refs.rangeStart.originColumns.forEach(function (_ref, index) {
|
|
110
|
+
var type = _ref.type;
|
|
111
|
+
|
|
112
|
+
if (index < dateTimeArr.length) {
|
|
113
|
+
if (['year', 'month', 'day'].includes(type)) {
|
|
114
|
+
dateValues.push(dateTimeArr[index]);
|
|
115
|
+
} else if (['hour', 'minute', 'second'].includes(type)) {
|
|
116
|
+
timeValues.push(dateTimeArr[index]);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
return this.genValueText(dateValues, timeValues);
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
genRangeHeader: function genRangeHeader() {
|
|
124
|
+
var _this2 = this;
|
|
125
|
+
|
|
126
|
+
var h = this.$createElement;
|
|
127
|
+
return h("div", {
|
|
128
|
+
"class": bem('title-tab-bar')
|
|
129
|
+
}, [h("div", {
|
|
130
|
+
"class": [bem('title-bar', {
|
|
131
|
+
selected: this.rangeSelectedIndex === RANGE_START_PICKER,
|
|
132
|
+
unselected: this.rangeSelectedIndex === RANGE_END_PICKER
|
|
133
|
+
})],
|
|
134
|
+
"on": {
|
|
135
|
+
"click": function click() {
|
|
136
|
+
_this2.rangeSelectedIndex = RANGE_START_PICKER;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}, [h("div", {
|
|
140
|
+
"class": ['zt2-ellipsis', bem('title', {
|
|
141
|
+
selected: this.rangeSelectedIndex === RANGE_START_PICKER,
|
|
142
|
+
unselected: this.rangeSelectedIndex === RANGE_END_PICKER
|
|
143
|
+
})]
|
|
144
|
+
}, [this.rangeHeaderStartText]), h("div", {
|
|
145
|
+
"class": ['zt2-ellipsis', bem('value')]
|
|
146
|
+
}, [this.currentStartText])]), h("span", {
|
|
147
|
+
"class": bem('title-separator')
|
|
148
|
+
}), h("div", {
|
|
149
|
+
"class": [bem('title-bar', {
|
|
150
|
+
selected: this.rangeSelectedIndex === RANGE_END_PICKER,
|
|
151
|
+
unselected: this.rangeSelectedIndex === RANGE_START_PICKER
|
|
152
|
+
})],
|
|
153
|
+
"on": {
|
|
154
|
+
"click": function click() {
|
|
155
|
+
_this2.rangeSelectedIndex = RANGE_END_PICKER;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}, [h("div", {
|
|
159
|
+
"class": ['zt2-ellipsis', bem('title', {
|
|
160
|
+
selected: this.rangeSelectedIndex === RANGE_END_PICKER,
|
|
161
|
+
unselected: this.rangeSelectedIndex === RANGE_START_PICKER
|
|
162
|
+
})]
|
|
163
|
+
}, [this.rangeHeaderEndText]), h("div", {
|
|
164
|
+
"class": ['zt2-ellipsis', bem('value')]
|
|
165
|
+
}, [this.currentEndText])])]);
|
|
166
|
+
},
|
|
167
|
+
genCancel: function genCancel() {
|
|
168
|
+
var h = this.$createElement;
|
|
169
|
+
return h(Button, {
|
|
170
|
+
"attrs": {
|
|
171
|
+
"size": "normal",
|
|
172
|
+
"block": true
|
|
173
|
+
},
|
|
174
|
+
"style": {
|
|
175
|
+
marginRigth: '4px',
|
|
176
|
+
backgroundColor: 'white'
|
|
177
|
+
},
|
|
178
|
+
"on": {
|
|
179
|
+
"click": this.onCancel
|
|
180
|
+
}
|
|
181
|
+
}, [this.cancelButtonText || '取消']);
|
|
182
|
+
},
|
|
183
|
+
genConfirm: function genConfirm() {
|
|
184
|
+
var h = this.$createElement;
|
|
185
|
+
return h(Button, {
|
|
186
|
+
"attrs": {
|
|
187
|
+
"type": "primary",
|
|
188
|
+
"size": "normal",
|
|
189
|
+
"block": true
|
|
190
|
+
},
|
|
191
|
+
"style": {
|
|
192
|
+
marginLeft: '8px'
|
|
193
|
+
},
|
|
194
|
+
"on": {
|
|
195
|
+
"click": this.onConfirm
|
|
196
|
+
}
|
|
197
|
+
}, [this.confirmButtonText || '确认']);
|
|
198
|
+
},
|
|
199
|
+
genToolbar: function genToolbar() {
|
|
200
|
+
var h = this.$createElement;
|
|
201
|
+
|
|
202
|
+
if (this.showToolbar) {
|
|
203
|
+
return h("div", {
|
|
204
|
+
"class": bem('toolbar')
|
|
205
|
+
}, [[this.genCancel(), this.genConfirm()]]);
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* 这里必须手动调用一次picker组件内部pureRecordConfirmIndex,保证picker组件内部confirmIndex是当前选中的时间项index
|
|
211
|
+
*/
|
|
212
|
+
updatePickerConfirm: function updatePickerConfirm() {
|
|
213
|
+
var _this3 = this;
|
|
214
|
+
|
|
215
|
+
this.$nextTick(function () {
|
|
216
|
+
var pickers = _this3.getPicker();
|
|
217
|
+
|
|
218
|
+
if (Array.isArray(pickers)) {
|
|
219
|
+
pickers.forEach(function (p) {
|
|
220
|
+
return p.pureRecordConfirmIndex();
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
},
|
|
225
|
+
checkRangeValid: function checkRangeValid() {
|
|
226
|
+
return dayjs(this.innerEndValue).isAfter(this.innerStartValue);
|
|
227
|
+
},
|
|
228
|
+
onConfirm: function onConfirm() {
|
|
229
|
+
if (!this.checkRangeValid()) {
|
|
230
|
+
Toast('结束日期不能早于开始日期');
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
this.updatePickerConfirm();
|
|
235
|
+
this.$emit('update:startValue', this.innerStartValue);
|
|
236
|
+
this.$emit('update:endValue', this.innerEndValue);
|
|
237
|
+
this.$emit('confirm', [this.innerStartValue, this.innerEndValue]);
|
|
238
|
+
},
|
|
239
|
+
onCancel: function onCancel() {
|
|
240
|
+
this.$emit('update:showPicker', false);
|
|
241
|
+
this.$emit('cancel');
|
|
16
242
|
}
|
|
17
243
|
},
|
|
18
244
|
render: function render() {
|
|
245
|
+
var _this4 = this;
|
|
246
|
+
|
|
19
247
|
var h = arguments[0];
|
|
20
248
|
var Component = this.type === 'time' ? TimePicker : DatePicker;
|
|
249
|
+
|
|
250
|
+
if (this.range) {
|
|
251
|
+
var props = _extends({}, this.$props, {
|
|
252
|
+
bem: bem,
|
|
253
|
+
showRange: true
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
var startRangeProps = _extends({}, props, {
|
|
257
|
+
value: this.startValue
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
var startListener = _extends({}, this.$listeners, {
|
|
261
|
+
input: function input(val) {
|
|
262
|
+
_this4.innerStartValue = val;
|
|
263
|
+
},
|
|
264
|
+
change: function change(pickerRef) {
|
|
265
|
+
_this4.$emit('startChange', pickerRef);
|
|
266
|
+
}
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
var endRangeProps = _extends({}, props, {
|
|
270
|
+
value: this.endValue
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
var endListener = _extends({}, this.$listeners, {
|
|
274
|
+
input: function input(val) {
|
|
275
|
+
_this4.innerEndValue = val;
|
|
276
|
+
},
|
|
277
|
+
change: function change(pickerRef) {
|
|
278
|
+
_this4.$emit('endChange', pickerRef);
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
return h(Popup, {
|
|
283
|
+
"attrs": {
|
|
284
|
+
"value": this.showPicker,
|
|
285
|
+
"round": true,
|
|
286
|
+
"position": "bottom"
|
|
287
|
+
},
|
|
288
|
+
"on": {
|
|
289
|
+
"input": function input(val) {
|
|
290
|
+
if (val) {
|
|
291
|
+
_this4.$emit('update:showPicker', true);
|
|
292
|
+
} else {
|
|
293
|
+
_this4.$emit('update:showPicker', false);
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}, [this.genRangeHeader(), h("div", {
|
|
298
|
+
"class": bem('range')
|
|
299
|
+
}, [h(Component, {
|
|
300
|
+
"ref": "rangeStart",
|
|
301
|
+
"directives": [{
|
|
302
|
+
name: "show",
|
|
303
|
+
value: this.rangeSelectedIndex === RANGE_START_PICKER
|
|
304
|
+
}],
|
|
305
|
+
"class": bem(),
|
|
306
|
+
"scopedSlots": this.$scopedSlots,
|
|
307
|
+
"props": _extends({}, startRangeProps),
|
|
308
|
+
"on": _extends({}, startListener)
|
|
309
|
+
}), h(Component, {
|
|
310
|
+
"ref": "rangeEnd",
|
|
311
|
+
"directives": [{
|
|
312
|
+
name: "show",
|
|
313
|
+
value: this.rangeSelectedIndex === RANGE_END_PICKER
|
|
314
|
+
}],
|
|
315
|
+
"class": bem(),
|
|
316
|
+
"scopedSlots": this.$scopedSlots,
|
|
317
|
+
"props": _extends({}, endRangeProps),
|
|
318
|
+
"on": _extends({}, endListener)
|
|
319
|
+
})]), this.genToolbar()]);
|
|
320
|
+
}
|
|
321
|
+
|
|
21
322
|
return h(Component, {
|
|
22
323
|
"ref": "root",
|
|
23
324
|
"class": bem(),
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
@import '../style/var';
|
|
2
|
+
@import '../style/hairline';
|
|
3
|
+
|
|
4
|
+
.@{base-prefix}-datetime-picker {
|
|
5
|
+
@date-time-picker-title-bar-selected-color: @blue;
|
|
6
|
+
|
|
7
|
+
&__title-tab-bar {
|
|
8
|
+
display: flex;
|
|
9
|
+
align-items: center;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&__title-bar {
|
|
13
|
+
display: flex;
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
align-items: center;
|
|
16
|
+
padding: 12px;
|
|
17
|
+
flex: 1;
|
|
18
|
+
color: @text-color-default;
|
|
19
|
+
|
|
20
|
+
&--unselected {
|
|
21
|
+
color: @text-color-4;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&__title {
|
|
26
|
+
font-weight: bold;
|
|
27
|
+
font-size: @font-size-md;
|
|
28
|
+
line-height: @line-height-md;
|
|
29
|
+
height: @line-height-md;
|
|
30
|
+
|
|
31
|
+
&--selected {
|
|
32
|
+
color: @date-time-picker-title-bar-selected-color;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&--unselected {
|
|
36
|
+
font-weight: normal;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&__value {
|
|
41
|
+
font-size: @font-size-md;
|
|
42
|
+
line-height: @line-height-md;
|
|
43
|
+
height: @line-height-md;
|
|
44
|
+
margin-top: 4px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&__toolbar {
|
|
48
|
+
box-sizing: content-box;
|
|
49
|
+
display: flex;
|
|
50
|
+
align-items: center;
|
|
51
|
+
justify-content: space-between;
|
|
52
|
+
height: @picker-toolbar-height;
|
|
53
|
+
padding: 8px 16px 8px 16px;
|
|
54
|
+
border-top: 1px solid rgba(45, 75, 115, 0.1);
|
|
55
|
+
position: relative;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
&__cancel,
|
|
59
|
+
&__confirm {
|
|
60
|
+
height: 100%;
|
|
61
|
+
padding: @picker-action-padding;
|
|
62
|
+
font-size: @picker-action-font-size;
|
|
63
|
+
background-color: transparent;
|
|
64
|
+
border: none;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
|
|
67
|
+
&:active {
|
|
68
|
+
opacity: @active-opacity;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&__confirm {
|
|
73
|
+
color: @picker-confirm-action-color;
|
|
74
|
+
font-weight: @picker-confirm-action-font-weight;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&__cancel {
|
|
78
|
+
color: @picker-cancel-action-color;
|
|
79
|
+
font-weight: @picker-cancel-action-font-weight;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -3,7 +3,7 @@ import { times } from './utils';
|
|
|
3
3
|
import { padZero } from '../utils/format/string';
|
|
4
4
|
import { pickerProps } from '../picker/shared';
|
|
5
5
|
import Picker from '../picker';
|
|
6
|
-
import { createNamespace } from
|
|
6
|
+
import { createNamespace } from '../utils';
|
|
7
7
|
var componentFunctions = createNamespace('dateTimePicker');
|
|
8
8
|
var t = componentFunctions[2];
|
|
9
9
|
export var sharedProps = _extends({}, pickerProps, {
|
|
@@ -19,6 +19,10 @@ export var sharedProps = _extends({}, pickerProps, {
|
|
|
19
19
|
default: function _default(type, value) {
|
|
20
20
|
return value;
|
|
21
21
|
}
|
|
22
|
+
},
|
|
23
|
+
showRange: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: false
|
|
22
26
|
}
|
|
23
27
|
});
|
|
24
28
|
export var TimePickerMixin = {
|
|
@@ -73,12 +77,12 @@ export var TimePickerMixin = {
|
|
|
73
77
|
var hour = t('hour');
|
|
74
78
|
var minute = t('minute');
|
|
75
79
|
var presetHeaders = {
|
|
76
|
-
|
|
80
|
+
date: [year, month, day],
|
|
77
81
|
'year-month': [year, month],
|
|
78
82
|
'month-day': [month, day],
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
time: [hour, minute],
|
|
84
|
+
datetime: [year, month, day, hour, minute],
|
|
85
|
+
datehour: [year, month, day, hour]
|
|
82
86
|
}; // console.log('type ' + this.type + ' ' + JSON.stringify(presetHeaders[this.type]))
|
|
83
87
|
|
|
84
88
|
return presetHeaders[this.type] || [];
|
|
@@ -166,6 +170,15 @@ export var TimePickerMixin = {
|
|
|
166
170
|
Object.keys(pickerProps).forEach(function (key) {
|
|
167
171
|
props[key] = _this6[key];
|
|
168
172
|
});
|
|
173
|
+
|
|
174
|
+
if (this.showRange) {
|
|
175
|
+
_extends(props, {
|
|
176
|
+
popup: false,
|
|
177
|
+
showToolbar: false,
|
|
178
|
+
title: ''
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
169
182
|
return h(Picker, {
|
|
170
183
|
"attrs": {
|
|
171
184
|
"show-picker": this.showPicker,
|
|
@@ -4,5 +4,7 @@ import '../../info/index.css';
|
|
|
4
4
|
import '../../icon/index.css';
|
|
5
5
|
import '../../popup/index.css';
|
|
6
6
|
import '../../loading/index.css';
|
|
7
|
+
import '../../toast/index.css';
|
|
7
8
|
import '../../button/index.css';
|
|
8
|
-
import '../../picker/index.css';
|
|
9
|
+
import '../../picker/index.css';
|
|
10
|
+
import '../index.css';
|
|
@@ -4,5 +4,7 @@ import '../../info/index.less';
|
|
|
4
4
|
import '../../icon/index.less';
|
|
5
5
|
import '../../popup/index.less';
|
|
6
6
|
import '../../loading/index.less';
|
|
7
|
+
import '../../toast/index.less';
|
|
7
8
|
import '../../button/index.less';
|
|
8
|
-
import '../../picker/index.less';
|
|
9
|
+
import '../../picker/index.less';
|
|
10
|
+
import '../index.less';
|
package/es/picker/index.js
CHANGED
|
@@ -48,6 +48,10 @@ export default createComponent({
|
|
|
48
48
|
valueKey: {
|
|
49
49
|
type: String,
|
|
50
50
|
default: 'text'
|
|
51
|
+
},
|
|
52
|
+
popup: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
default: true
|
|
51
55
|
}
|
|
52
56
|
}),
|
|
53
57
|
data: function data() {
|
|
@@ -310,6 +314,15 @@ export default createComponent({
|
|
|
310
314
|
});
|
|
311
315
|
this.emit('confirm');
|
|
312
316
|
},
|
|
317
|
+
// @exposed-api
|
|
318
|
+
pureRecordConfirmIndex: function pureRecordConfirmIndex() {
|
|
319
|
+
this.children.forEach(function (child) {
|
|
320
|
+
return child.stopMomentum();
|
|
321
|
+
});
|
|
322
|
+
this.children.forEach(function (child) {
|
|
323
|
+
return child.recordConfirmIndex();
|
|
324
|
+
});
|
|
325
|
+
},
|
|
313
326
|
cancel: function cancel() {
|
|
314
327
|
this.$emit('update:showPicker', false);
|
|
315
328
|
this.emit('cancel');
|
|
@@ -443,25 +456,35 @@ export default createComponent({
|
|
|
443
456
|
}
|
|
444
457
|
},
|
|
445
458
|
render: function render(h) {
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
"
|
|
451
|
-
"
|
|
452
|
-
|
|
453
|
-
"
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
459
|
+
var _this7 = this;
|
|
460
|
+
|
|
461
|
+
var renderPicker = function renderPicker() {
|
|
462
|
+
return h("div", {
|
|
463
|
+
"class": bem(),
|
|
464
|
+
"ref": "columnParent"
|
|
465
|
+
}, [_this7.toolbarPosition === 'top' ? _this7.genToolbar() : h(), _this7.toolbarPosition === 'top' ? h() : _this7.genTitle(), _this7.toolbarPosition === 'top' ? h("div", {
|
|
466
|
+
"class": bem('border')
|
|
467
|
+
}) : h(), _this7.loading ? h(Loading, {
|
|
468
|
+
"class": bem('loading')
|
|
469
|
+
}) : h(), _this7.slots('columns-top'), _this7.headers && _this7.headers.length > 0 ? _this7.genHeaders() : h(), _this7.headers && _this7.headers.length > 0 ? h("div", {
|
|
470
|
+
"class": bem('border')
|
|
471
|
+
}) : h(), _this7.genColumns(), _this7.slots('columns-bottom'), _this7.toolbarPosition === 'bottom' ? _this7.genToolbar() : h()]);
|
|
472
|
+
};
|
|
473
|
+
|
|
474
|
+
if (this.popup) {
|
|
475
|
+
return h(Popup, {
|
|
476
|
+
"attrs": {
|
|
477
|
+
"value": this.showPicker,
|
|
478
|
+
"round": true,
|
|
479
|
+
"position": "bottom",
|
|
480
|
+
"closeOnPopstate": this.closeOnPopstate,
|
|
481
|
+
"closeOnClickOverlay": this.closeOnClickOverlay,
|
|
482
|
+
"customOnClickOverlay": this.onClickOverlay,
|
|
483
|
+
"getContainer": this.getContainer
|
|
484
|
+
}
|
|
485
|
+
}, [renderPicker()]);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
return renderPicker();
|
|
466
489
|
}
|
|
467
490
|
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[class*=zt2-hairline]::after{position:absolute;box-sizing:border-box;content:' ';pointer-events:none;top:-50%;right:-50%;bottom:-50%;left:-50%;border:0 solid rgba(0,0,0,.1);-webkit-transform:scale(.5);transform:scale(.5)}.zt2-hairline,.zt2-hairline--bottom,.zt2-hairline--left,.zt2-hairline--right,.zt2-hairline--surround,.zt2-hairline--top,.zt2-hairline--top-bottom{position:relative}.zt2-hairline--top::after{border-top-width:1px}.zt2-hairline--left::after{border-left-width:1px}.zt2-hairline--right::after{border-right-width:1px}.zt2-hairline--bottom::after{border-bottom-width:1px}.zt2-hairline--top-bottom::after,.zt2-hairline-unset--top-bottom::after{border-width:1px 0}.zt2-hairline--surround::after{border-width:1px}.zt2-datetime-picker__title-tab-bar{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center}.zt2-datetime-picker__title-bar{display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;flex-direction:column;-webkit-box-align:center;-webkit-align-items:center;align-items:center;padding:12px;-webkit-box-flex:1;-webkit-flex:1;flex:1;color:#2d4b73}.zt2-datetime-picker__title-bar--unselected{color:rgba(45,75,115,.4)}.zt2-datetime-picker__title{font-weight:700;font-size:14px;line-height:20px;height:20px}.zt2-datetime-picker__title--selected{color:#0091fa}.zt2-datetime-picker__title--unselected{font-weight:400}.zt2-datetime-picker__value{font-size:14px;line-height:20px;height:20px;margin-top:4px}.zt2-datetime-picker__toolbar{box-sizing:content-box;display:-webkit-box;display:-webkit-flex;display:flex;-webkit-box-align:center;-webkit-align-items:center;align-items:center;-webkit-box-pack:justify;-webkit-justify-content:space-between;justify-content:space-between;height:44px;padding:8px 16px 8px 16px;border-top:1px solid rgba(45,75,115,.1);position:relative}.zt2-datetime-picker__cancel,.zt2-datetime-picker__confirm{height:100%;padding:0 16px;font-size:14px;background-color:transparent;border:none;cursor:pointer}.zt2-datetime-picker__cancel:active,.zt2-datetime-picker__confirm:active{opacity:.7}.zt2-datetime-picker__confirm{color:#0091fa;font-weight:700}.zt2-datetime-picker__cancel{color:#000;font-weight:400}
|