zartui 1.0.21 → 1.0.23
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/components/Header.js +6 -0
- package/es/calendar/index.js +5 -0
- package/es/index.js +4 -3
- package/es/radio-picker/PickerColumn.js +421 -0
- package/es/radio-picker/index.css +1 -0
- package/es/radio-picker/index.js +477 -0
- package/es/radio-picker/index.less +152 -0
- package/es/radio-picker/shared.js +36 -0
- package/es/radio-picker/style/index.js +13 -0
- package/es/radio-picker/style/less.js +13 -0
- package/es/style/var.less +3 -0
- package/lib/calendar/components/Header.js +6 -0
- package/lib/calendar/index.js +5 -0
- package/lib/index.css +1 -1
- package/lib/index.js +6 -2
- package/lib/index.less +1 -0
- package/lib/radio-picker/PickerColumn.js +441 -0
- package/lib/radio-picker/index.css +1 -0
- package/lib/radio-picker/index.js +495 -0
- package/lib/radio-picker/index.less +152 -0
- package/lib/radio-picker/shared.js +42 -0
- package/lib/radio-picker/style/index.js +13 -0
- package/lib/radio-picker/style/less.js +13 -0
- package/lib/style/var.less +3 -0
- package/lib/zart.js +1356 -406
- package/lib/zart.min.js +4 -4
- package/package.json +1 -1
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
|
|
10
|
+
var _utils = require("../utils");
|
|
11
|
+
|
|
12
|
+
var _event = require("../utils/dom/event");
|
|
13
|
+
|
|
14
|
+
var _unit = require("../utils/format/unit");
|
|
15
|
+
|
|
16
|
+
var _shared = require("./shared");
|
|
17
|
+
|
|
18
|
+
var _loading = _interopRequireDefault(require("../loading"));
|
|
19
|
+
|
|
20
|
+
var _popup = require("../mixins/popup");
|
|
21
|
+
|
|
22
|
+
var _popup2 = _interopRequireDefault(require("../popup"));
|
|
23
|
+
|
|
24
|
+
var _search = _interopRequireDefault(require("../search"));
|
|
25
|
+
|
|
26
|
+
var _PickerColumn = _interopRequireDefault(require("./PickerColumn"));
|
|
27
|
+
|
|
28
|
+
// Utils
|
|
29
|
+
// Components
|
|
30
|
+
var _createNamespace = (0, _utils.createNamespace)('radio-picker'),
|
|
31
|
+
createComponent = _createNamespace[0],
|
|
32
|
+
bem = _createNamespace[1],
|
|
33
|
+
t = _createNamespace[2];
|
|
34
|
+
|
|
35
|
+
var _default2 = createComponent({
|
|
36
|
+
mixins: [(0, _popup.PopupMixin)()],
|
|
37
|
+
props: (0, _extends2.default)({}, _shared.radioPickerProps, {
|
|
38
|
+
defaultIndex: {
|
|
39
|
+
type: [Number, String],
|
|
40
|
+
default: 0
|
|
41
|
+
},
|
|
42
|
+
columns: {
|
|
43
|
+
type: Array,
|
|
44
|
+
default: function _default() {
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
headers: {
|
|
49
|
+
type: Array,
|
|
50
|
+
default: null
|
|
51
|
+
},
|
|
52
|
+
toolbarPosition: {
|
|
53
|
+
type: String,
|
|
54
|
+
default: 'top'
|
|
55
|
+
},
|
|
56
|
+
valueKey: {
|
|
57
|
+
type: String,
|
|
58
|
+
default: 'text'
|
|
59
|
+
},
|
|
60
|
+
searchable: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: false
|
|
63
|
+
},
|
|
64
|
+
searchPlaceholder: {
|
|
65
|
+
type: String,
|
|
66
|
+
default: '请输入'
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
69
|
+
data: function data() {
|
|
70
|
+
return {
|
|
71
|
+
children: [],
|
|
72
|
+
formattedColumns: [],
|
|
73
|
+
confirmIndex: '',
|
|
74
|
+
searchVal: '',
|
|
75
|
+
searchConfirmVal: ''
|
|
76
|
+
};
|
|
77
|
+
},
|
|
78
|
+
computed: {
|
|
79
|
+
wrapPxHeight: function wrapPxHeight() {
|
|
80
|
+
return this.wrapHeight ? (0, _unit.unitToPx)(this.wrapHeight) : _shared.DEFAULT_WRAP_HEIGHT;
|
|
81
|
+
},
|
|
82
|
+
dataType: function dataType() {
|
|
83
|
+
var columns = this.columns;
|
|
84
|
+
var firstColumn = columns[0] || {};
|
|
85
|
+
|
|
86
|
+
if (firstColumn.children) {
|
|
87
|
+
return 'cascade';
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (firstColumn.values) {
|
|
91
|
+
return 'object';
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return 'text';
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
watch: {
|
|
98
|
+
columns: {
|
|
99
|
+
handler: 'format',
|
|
100
|
+
immediate: true
|
|
101
|
+
},
|
|
102
|
+
showPicker: {
|
|
103
|
+
handler: function handler(val) {
|
|
104
|
+
var _this = this;
|
|
105
|
+
|
|
106
|
+
if (val) {
|
|
107
|
+
this.$nextTick(function () {
|
|
108
|
+
_this.children.forEach(function (child) {
|
|
109
|
+
child.setConfirmIndex();
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
_this.children.forEach(function (child) {
|
|
113
|
+
child.recordConfirmIndex();
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
immediate: true
|
|
119
|
+
}
|
|
120
|
+
},
|
|
121
|
+
methods: {
|
|
122
|
+
onClickOverlay: function onClickOverlay() {
|
|
123
|
+
if (this.closeOnClickOverlay) {
|
|
124
|
+
this.cancel();
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
format: function format() {
|
|
128
|
+
var columns = this.columns,
|
|
129
|
+
dataType = this.dataType;
|
|
130
|
+
|
|
131
|
+
if (dataType === 'text') {
|
|
132
|
+
this.formattedColumns = [{
|
|
133
|
+
values: columns
|
|
134
|
+
}];
|
|
135
|
+
} else if (dataType === 'cascade') {
|
|
136
|
+
this.formatCascade();
|
|
137
|
+
} else {
|
|
138
|
+
this.formattedColumns = columns;
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
formatCascade: function formatCascade() {
|
|
142
|
+
var formatted = [];
|
|
143
|
+
var cursor = {
|
|
144
|
+
children: this.columns
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
while (cursor && cursor.children) {
|
|
148
|
+
var _cursor$defaultIndex;
|
|
149
|
+
|
|
150
|
+
var _cursor = cursor,
|
|
151
|
+
children = _cursor.children;
|
|
152
|
+
var defaultIndex = (_cursor$defaultIndex = cursor.defaultIndex) != null ? _cursor$defaultIndex : +this.defaultIndex;
|
|
153
|
+
|
|
154
|
+
while (children[defaultIndex] && children[defaultIndex].disabled) {
|
|
155
|
+
if (defaultIndex < children.length - 1) {
|
|
156
|
+
defaultIndex++;
|
|
157
|
+
} else {
|
|
158
|
+
defaultIndex = 0;
|
|
159
|
+
break;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
formatted.push({
|
|
164
|
+
values: cursor.children,
|
|
165
|
+
className: cursor.className,
|
|
166
|
+
defaultIndex: defaultIndex
|
|
167
|
+
});
|
|
168
|
+
cursor = children[defaultIndex];
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
this.formattedColumns = formatted;
|
|
172
|
+
},
|
|
173
|
+
emit: function emit(event) {
|
|
174
|
+
var _this2 = this;
|
|
175
|
+
|
|
176
|
+
if (this.dataType === 'text') {
|
|
177
|
+
this.$emit(event, this.getColumnValue(0), this.getColumnIndex(0));
|
|
178
|
+
} else {
|
|
179
|
+
var values = this.getValues(); // compatible with old version of wrong parameters
|
|
180
|
+
// should be removed in next major version
|
|
181
|
+
// see: https://github.com/vant-ui/vant/issues/5905
|
|
182
|
+
|
|
183
|
+
if (this.dataType === 'cascade') {
|
|
184
|
+
values = values.map(function (item) {
|
|
185
|
+
return item[_this2.valueKey];
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
this.$emit(event, values, this.getIndexes());
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
onCascadeChange: function onCascadeChange(columnIndex) {
|
|
193
|
+
var cursor = {
|
|
194
|
+
children: this.columns
|
|
195
|
+
};
|
|
196
|
+
var indexes = this.getIndexes();
|
|
197
|
+
|
|
198
|
+
for (var i = 0; i <= columnIndex; i++) {
|
|
199
|
+
cursor = cursor.children[indexes[i]];
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
while (cursor && cursor.children) {
|
|
203
|
+
columnIndex++;
|
|
204
|
+
this.setColumnValues(columnIndex, cursor.children);
|
|
205
|
+
cursor = cursor.children[cursor.defaultIndex || 0];
|
|
206
|
+
}
|
|
207
|
+
},
|
|
208
|
+
onChange: function onChange(columnIndex) {
|
|
209
|
+
var _this3 = this;
|
|
210
|
+
|
|
211
|
+
if (this.dataType === 'cascade') {
|
|
212
|
+
this.onCascadeChange(columnIndex);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (this.dataType === 'text') {
|
|
216
|
+
this.$emit('change', this, this.getColumnValue(0), this.getColumnIndex(0));
|
|
217
|
+
} else {
|
|
218
|
+
var values = this.getValues(); // compatible with old version of wrong parameters
|
|
219
|
+
// should be removed in next major version
|
|
220
|
+
// see: https://github.com/vant-ui/vant/issues/5905
|
|
221
|
+
|
|
222
|
+
if (this.dataType === 'cascade') {
|
|
223
|
+
values = values.map(function (item) {
|
|
224
|
+
return item[_this3.valueKey];
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
this.$emit('change', this, values, columnIndex);
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
getColumnCount: function getColumnCount() {
|
|
232
|
+
return this.children ? this.children.length : 0;
|
|
233
|
+
},
|
|
234
|
+
// get column instance by index
|
|
235
|
+
getColumn: function getColumn(index) {
|
|
236
|
+
return this.children[index];
|
|
237
|
+
},
|
|
238
|
+
// @exposed-api
|
|
239
|
+
// get column value by index
|
|
240
|
+
getColumnValue: function getColumnValue(index) {
|
|
241
|
+
var column = this.getColumn(index);
|
|
242
|
+
return column && column.getValue();
|
|
243
|
+
},
|
|
244
|
+
// @exposed-api
|
|
245
|
+
// set column value by index
|
|
246
|
+
setColumnValue: function setColumnValue(index, value) {
|
|
247
|
+
var column = this.getColumn(index);
|
|
248
|
+
|
|
249
|
+
if (column) {
|
|
250
|
+
column.setValue(value);
|
|
251
|
+
|
|
252
|
+
if (this.dataType === 'cascade') {
|
|
253
|
+
this.onCascadeChange(index);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
// @exposed-api
|
|
258
|
+
// get column option index by column index
|
|
259
|
+
getColumnIndex: function getColumnIndex(columnIndex) {
|
|
260
|
+
return (this.getColumn(columnIndex) || {}).currentIndex;
|
|
261
|
+
},
|
|
262
|
+
// @exposed-api
|
|
263
|
+
// set column option index by column index
|
|
264
|
+
setColumnIndex: function setColumnIndex(columnIndex, optionIndex) {
|
|
265
|
+
var column = this.getColumn(columnIndex);
|
|
266
|
+
|
|
267
|
+
if (column) {
|
|
268
|
+
column.setIndex(optionIndex);
|
|
269
|
+
|
|
270
|
+
if (this.dataType === 'cascade') {
|
|
271
|
+
this.onCascadeChange(columnIndex);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
},
|
|
275
|
+
// @exposed-api
|
|
276
|
+
// get options of column by index
|
|
277
|
+
getColumnValues: function getColumnValues(index) {
|
|
278
|
+
return (this.children[index] || {}).options;
|
|
279
|
+
},
|
|
280
|
+
// @exposed-api
|
|
281
|
+
// set options of column by index
|
|
282
|
+
setColumnValues: function setColumnValues(index, options) {
|
|
283
|
+
var column = this.children[index];
|
|
284
|
+
|
|
285
|
+
if (column) {
|
|
286
|
+
column.setOptions(options);
|
|
287
|
+
}
|
|
288
|
+
},
|
|
289
|
+
// @exposed-api
|
|
290
|
+
// get values of all columns
|
|
291
|
+
getValues: function getValues() {
|
|
292
|
+
return this.children.map(function (child) {
|
|
293
|
+
return child.getValue();
|
|
294
|
+
});
|
|
295
|
+
},
|
|
296
|
+
// @exposed-api
|
|
297
|
+
// set values of all columns
|
|
298
|
+
setValues: function setValues(values) {
|
|
299
|
+
var _this4 = this;
|
|
300
|
+
|
|
301
|
+
values.forEach(function (value, index) {
|
|
302
|
+
_this4.setColumnValue(index, value);
|
|
303
|
+
});
|
|
304
|
+
},
|
|
305
|
+
// @exposed-api
|
|
306
|
+
// get indexes of all columns
|
|
307
|
+
getIndexes: function getIndexes() {
|
|
308
|
+
return this.children.map(function (child) {
|
|
309
|
+
return child.currentIndex;
|
|
310
|
+
});
|
|
311
|
+
},
|
|
312
|
+
// @exposed-api
|
|
313
|
+
// set indexes of all columns
|
|
314
|
+
setIndexes: function setIndexes(indexes) {
|
|
315
|
+
var _this5 = this;
|
|
316
|
+
|
|
317
|
+
indexes.forEach(function (optionIndex, columnIndex) {
|
|
318
|
+
_this5.setColumnIndex(columnIndex, optionIndex);
|
|
319
|
+
});
|
|
320
|
+
},
|
|
321
|
+
// @exposed-api
|
|
322
|
+
confirm: function confirm() {
|
|
323
|
+
this.children.forEach(function (child) {
|
|
324
|
+
return child.stopMomentum();
|
|
325
|
+
});
|
|
326
|
+
this.children.forEach(function (child) {
|
|
327
|
+
return child.recordConfirmIndex();
|
|
328
|
+
});
|
|
329
|
+
this.emit('confirm');
|
|
330
|
+
},
|
|
331
|
+
cancel: function cancel() {
|
|
332
|
+
this.$emit('update:showPicker', false);
|
|
333
|
+
this.emit('cancel');
|
|
334
|
+
},
|
|
335
|
+
genTitle: function genTitle() {
|
|
336
|
+
var h = this.$createElement;
|
|
337
|
+
var titleSlot = this.slots('title');
|
|
338
|
+
|
|
339
|
+
if (titleSlot) {
|
|
340
|
+
return titleSlot;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
if (this.title) {
|
|
344
|
+
return h("div", {
|
|
345
|
+
"class": ['zt-ellipsis', bem('title')]
|
|
346
|
+
}, [this.title]);
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
genCancel: function genCancel() {
|
|
350
|
+
var h = this.$createElement;
|
|
351
|
+
return h("button", {
|
|
352
|
+
"attrs": {
|
|
353
|
+
"type": "button"
|
|
354
|
+
},
|
|
355
|
+
"class": bem('cancel'),
|
|
356
|
+
"on": {
|
|
357
|
+
"click": this.cancel
|
|
358
|
+
}
|
|
359
|
+
}, [this.slots('cancel') || this.cancelButtonText || t('cancel')]);
|
|
360
|
+
},
|
|
361
|
+
genConfirm: function genConfirm() {
|
|
362
|
+
var h = this.$createElement;
|
|
363
|
+
return h("button", {
|
|
364
|
+
"attrs": {
|
|
365
|
+
"type": "button"
|
|
366
|
+
},
|
|
367
|
+
"class": bem('confirm'),
|
|
368
|
+
"on": {
|
|
369
|
+
"click": this.confirm
|
|
370
|
+
}
|
|
371
|
+
}, [this.slots('confirm') || this.confirmButtonText || t('confirm')]);
|
|
372
|
+
},
|
|
373
|
+
genToolbar: function genToolbar() {
|
|
374
|
+
var h = this.$createElement;
|
|
375
|
+
|
|
376
|
+
if (this.showToolbar) {
|
|
377
|
+
return h("div", {
|
|
378
|
+
"class": bem('toolbar')
|
|
379
|
+
}, [this.slots() || [this.genCancel(), this.genTitle(), this.genConfirm()]]);
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
genHeaders: function genHeaders() {
|
|
383
|
+
var h = this.$createElement;
|
|
384
|
+
return h("ul", {
|
|
385
|
+
"class": bem('header')
|
|
386
|
+
}, [this.genHeaderItems()]);
|
|
387
|
+
},
|
|
388
|
+
genHeaderItems: function genHeaderItems() {
|
|
389
|
+
var h = this.$createElement;
|
|
390
|
+
return this.headers.map(function (header) {
|
|
391
|
+
return h("li", [header]);
|
|
392
|
+
});
|
|
393
|
+
},
|
|
394
|
+
genSearch: function genSearch() {
|
|
395
|
+
var h = this.$createElement;
|
|
396
|
+
return h(_search.default, {
|
|
397
|
+
"attrs": {
|
|
398
|
+
"value": this.searchVal,
|
|
399
|
+
"placeholder": this.searchPlaceholder
|
|
400
|
+
},
|
|
401
|
+
"on": {
|
|
402
|
+
"input": this.handleSearchInput,
|
|
403
|
+
"search": this.handleSearch
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
},
|
|
407
|
+
handleSearchInput: function handleSearchInput(inputVal) {
|
|
408
|
+
this.searchVal = inputVal; // 直接清空输入框的情况,就不继续展示已经查询的内容了
|
|
409
|
+
|
|
410
|
+
if (!inputVal) {
|
|
411
|
+
this.handleSearch(inputVal);
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* @description: 这里才将输入值实际传递给子组件进行过滤
|
|
417
|
+
* @param {*} e 搜索框的输入值
|
|
418
|
+
*/
|
|
419
|
+
handleSearch: function handleSearch(e) {
|
|
420
|
+
this.searchConfirmVal = e;
|
|
421
|
+
},
|
|
422
|
+
genColumns: function genColumns() {
|
|
423
|
+
var h = this.$createElement;
|
|
424
|
+
var wrapHeight = this.wrapHeight;
|
|
425
|
+
var columnsStyle = {
|
|
426
|
+
height: wrapHeight + "px"
|
|
427
|
+
};
|
|
428
|
+
return h("div", {
|
|
429
|
+
"class": bem('columns'),
|
|
430
|
+
"style": columnsStyle,
|
|
431
|
+
"on": {
|
|
432
|
+
"touchmove": _event.preventDefault
|
|
433
|
+
}
|
|
434
|
+
}, [this.genColumnItems()]);
|
|
435
|
+
},
|
|
436
|
+
genColumnItems: function genColumnItems() {
|
|
437
|
+
var _this6 = this;
|
|
438
|
+
|
|
439
|
+
var h = this.$createElement;
|
|
440
|
+
return this.formattedColumns.map(function (item, columnIndex) {
|
|
441
|
+
var _item$defaultIndex;
|
|
442
|
+
|
|
443
|
+
return h(_PickerColumn.default, {
|
|
444
|
+
"attrs": {
|
|
445
|
+
"columnCollector": _this6.children,
|
|
446
|
+
"readonly": _this6.readonly,
|
|
447
|
+
"valueKey": _this6.valueKey,
|
|
448
|
+
"allowHtml": _this6.allowHtml,
|
|
449
|
+
"searchVal": _this6.searchConfirmVal,
|
|
450
|
+
"searchable": _this6.searchable,
|
|
451
|
+
"toolbarPosition": _this6.toolbarPosition,
|
|
452
|
+
"className": item.className,
|
|
453
|
+
"wrapHeight": _this6.wrapPxHeight,
|
|
454
|
+
"defaultIndex": (_item$defaultIndex = item.defaultIndex) != null ? _item$defaultIndex : +_this6.defaultIndex,
|
|
455
|
+
"swipeDuration": _this6.swipeDuration,
|
|
456
|
+
"initialOptions": item.values
|
|
457
|
+
},
|
|
458
|
+
"scopedSlots": {
|
|
459
|
+
option: _this6.$scopedSlots.option
|
|
460
|
+
},
|
|
461
|
+
"on": {
|
|
462
|
+
"change": function change() {
|
|
463
|
+
_this6.onChange(columnIndex);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
});
|
|
468
|
+
}
|
|
469
|
+
},
|
|
470
|
+
render: function render(h) {
|
|
471
|
+
return h(_popup2.default, {
|
|
472
|
+
"attrs": {
|
|
473
|
+
"value": this.showPicker,
|
|
474
|
+
"round": true,
|
|
475
|
+
"position": "bottom",
|
|
476
|
+
"closeOnPopstate": this.closeOnPopstate,
|
|
477
|
+
"closeOnClickOverlay": this.closeOnClickOverlay,
|
|
478
|
+
"customOnClickOverlay": this.onClickOverlay
|
|
479
|
+
}
|
|
480
|
+
}, [h("div", {
|
|
481
|
+
"class": bem(),
|
|
482
|
+
"ref": "columnParent"
|
|
483
|
+
}, [this.toolbarPosition === 'top' ? this.genToolbar() : h(), this.toolbarPosition === 'top' ? h("div", {
|
|
484
|
+
"class": bem('border')
|
|
485
|
+
}) : h(), this.loading ? h(_loading.default, {
|
|
486
|
+
"class": bem('loading')
|
|
487
|
+
}) : h(), this.slots('columns-top'), this.headers && this.headers.length > 0 ? this.genHeaders() : h(), this.headers && this.headers.length > 0 ? h("div", {
|
|
488
|
+
"class": bem('border')
|
|
489
|
+
}) : h(), this.searchable ? this.genSearch() : h(), this.searchable ? h("div", {
|
|
490
|
+
"class": bem('border')
|
|
491
|
+
}) : h(), this.genColumns(), this.slots('columns-bottom'), this.toolbarPosition === 'bottom' ? this.genToolbar() : h()])]);
|
|
492
|
+
}
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
exports.default = _default2;
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
@import '../style/var';
|
|
2
|
+
@import '../style/hairline';
|
|
3
|
+
|
|
4
|
+
.zt-radio-picker {
|
|
5
|
+
position: relative;
|
|
6
|
+
background-color: @picker-background-color;
|
|
7
|
+
user-select: none;
|
|
8
|
+
|
|
9
|
+
&__toolbar {
|
|
10
|
+
display: flex;
|
|
11
|
+
align-items: center;
|
|
12
|
+
justify-content: space-between;
|
|
13
|
+
height: @picker-toolbar-height;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&__border {
|
|
17
|
+
position: relative;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&__border::after {
|
|
21
|
+
.hairline-bottom();
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
&__cancel,
|
|
25
|
+
&__confirm {
|
|
26
|
+
height: 100%;
|
|
27
|
+
padding: @picker-action-padding;
|
|
28
|
+
font-size: @picker-action-font-size;
|
|
29
|
+
background-color: transparent;
|
|
30
|
+
border: none;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
|
|
33
|
+
&:active {
|
|
34
|
+
opacity: @active-opacity;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
&__confirm {
|
|
39
|
+
color: @picker-confirm-action-color;
|
|
40
|
+
font-weight: @picker-confirm-action-font-weight;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
&__cancel {
|
|
44
|
+
color: @picker-cancel-action-color;
|
|
45
|
+
font-weight: @picker-cancel-action-font-weight;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&__title {
|
|
49
|
+
max-width: 50%;
|
|
50
|
+
font-weight: @plain-font-weight;
|
|
51
|
+
font-size: @picker-title-font-size;
|
|
52
|
+
line-height: @picker-title-line-height;
|
|
53
|
+
text-align: center;
|
|
54
|
+
color: rgba(0, 0, 0, 0.4);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&__header {
|
|
58
|
+
width: 100%;
|
|
59
|
+
height: 40px;
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
font-size: @picker-title-font-size;
|
|
63
|
+
font-weight: @plain-font-weight;
|
|
64
|
+
|
|
65
|
+
> li {
|
|
66
|
+
flex: auto;
|
|
67
|
+
text-align: center;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
&__columns {
|
|
72
|
+
position: relative;
|
|
73
|
+
display: flex;
|
|
74
|
+
cursor: grab;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&__loading {
|
|
78
|
+
position: absolute;
|
|
79
|
+
top: 0;
|
|
80
|
+
right: 0;
|
|
81
|
+
bottom: 0;
|
|
82
|
+
left: 0;
|
|
83
|
+
z-index: 3;
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
color: @picker-loading-icon-color;
|
|
88
|
+
background-color: @picker-loading-mask-color;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
&__frame {
|
|
92
|
+
position: absolute;
|
|
93
|
+
top: 50%;
|
|
94
|
+
right: @padding-md;
|
|
95
|
+
left: @padding-md;
|
|
96
|
+
z-index: 2;
|
|
97
|
+
transform: translateY(-50%);
|
|
98
|
+
pointer-events: none;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
&__background {
|
|
102
|
+
position: absolute;
|
|
103
|
+
width: 100%;
|
|
104
|
+
height: 100%;
|
|
105
|
+
background-color: #fff;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
&-column {
|
|
109
|
+
flex: 1;
|
|
110
|
+
overflow: hidden;
|
|
111
|
+
font-size: @picker-option-font-size;
|
|
112
|
+
|
|
113
|
+
&__wrapper {
|
|
114
|
+
transition-timing-function: cubic-bezier(0.23, 1, 0.68, 1);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&__item {
|
|
118
|
+
position: relative;
|
|
119
|
+
display: flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
justify-content: flex-start;
|
|
122
|
+
padding: @radio-picker-warpper-item-padding;
|
|
123
|
+
color: @picker-option-text-color;
|
|
124
|
+
|
|
125
|
+
&::after {
|
|
126
|
+
// ui要求,border需居于文字底部,故去除了radio与一些padding、margin的距离
|
|
127
|
+
.hairline-bottom(@border-color, calc(16px + 24px + 8px));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
&--disabled {
|
|
131
|
+
cursor: not-allowed;
|
|
132
|
+
opacity: @picker-option-disabled-opacity;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
&--not-match {
|
|
136
|
+
display: none;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&--selected {
|
|
140
|
+
font-weight: @font-weight-bold;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// ui效果,需要修改label的行高
|
|
144
|
+
.zt-radio__label {
|
|
145
|
+
font-family: PingFangSC-Regular;
|
|
146
|
+
font-weight: 400;
|
|
147
|
+
font-size: @font-size-md;
|
|
148
|
+
line-height: @line-height-md;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.radioPickerProps = exports.DEFAULT_WRAP_HEIGHT = void 0;
|
|
5
|
+
var DEFAULT_WRAP_HEIGHT = 350;
|
|
6
|
+
exports.DEFAULT_WRAP_HEIGHT = DEFAULT_WRAP_HEIGHT;
|
|
7
|
+
var radioPickerProps = {
|
|
8
|
+
title: String,
|
|
9
|
+
loading: Boolean,
|
|
10
|
+
readonly: Boolean,
|
|
11
|
+
cancelButtonText: String,
|
|
12
|
+
confirmButtonText: String,
|
|
13
|
+
showToolbar: {
|
|
14
|
+
type: Boolean,
|
|
15
|
+
default: true
|
|
16
|
+
},
|
|
17
|
+
showPicker: {
|
|
18
|
+
type: Boolean,
|
|
19
|
+
default: false
|
|
20
|
+
},
|
|
21
|
+
wrapHeight: {
|
|
22
|
+
type: [Number, String],
|
|
23
|
+
default: DEFAULT_WRAP_HEIGHT
|
|
24
|
+
},
|
|
25
|
+
allowHtml: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
default: true
|
|
28
|
+
},
|
|
29
|
+
swipeDuration: {
|
|
30
|
+
type: [Number, String],
|
|
31
|
+
default: 1000
|
|
32
|
+
},
|
|
33
|
+
closeOnPopstate: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: true
|
|
36
|
+
},
|
|
37
|
+
closeOnClickOverlay: {
|
|
38
|
+
type: Boolean,
|
|
39
|
+
default: true
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
exports.radioPickerProps = radioPickerProps;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require('../../style/base.css');
|
|
2
|
+
require('../../overlay/index.css');
|
|
3
|
+
require('../../info/index.css');
|
|
4
|
+
require('../../icon/index.css');
|
|
5
|
+
require('../../radio/index.css');
|
|
6
|
+
require('../../cell/index.css');
|
|
7
|
+
require('../../field/index.css');
|
|
8
|
+
require('../../search/index.css');
|
|
9
|
+
require('../../popup/index.css');
|
|
10
|
+
require('../../loading/index.css');
|
|
11
|
+
require('../../empty/index.css');
|
|
12
|
+
require('../../radio-group/index.css');
|
|
13
|
+
require('../index.css');
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
require('../../style/base.less');
|
|
2
|
+
require('../../overlay/index.less');
|
|
3
|
+
require('../../info/index.less');
|
|
4
|
+
require('../../icon/index.less');
|
|
5
|
+
require('../../radio/index.less');
|
|
6
|
+
require('../../cell/index.less');
|
|
7
|
+
require('../../field/index.less');
|
|
8
|
+
require('../../search/index.less');
|
|
9
|
+
require('../../popup/index.less');
|
|
10
|
+
require('../../loading/index.less');
|
|
11
|
+
require('../../empty/index.less');
|
|
12
|
+
require('../../radio-group/index.less');
|
|
13
|
+
require('../index.less');
|