zartui 2.1.27 → 2.1.29
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 +1 -1
- package/es/multiple-picker/index.js +46 -32
- package/lib/index.js +1 -1
- package/lib/multiple-picker/index.js +46 -32
- package/lib/zart.js +47 -33
- package/lib/zart.min.js +1 -1
- package/package.json +1 -1
package/es/index.js
CHANGED
|
@@ -76,7 +76,7 @@ import TextEllipsis from './text-ellipsis';
|
|
|
76
76
|
import Timeline from './timeline';
|
|
77
77
|
import Toast from './toast';
|
|
78
78
|
import Uploader from './uploader';
|
|
79
|
-
var version = '2.1.
|
|
79
|
+
var version = '2.1.29';
|
|
80
80
|
function install(Vue) {
|
|
81
81
|
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, Picker, Popover, Popup, PullRefresh, Radio, RadioGroup, Rate, Row, Search, Signature, Skeleton, Slider, SpeechRecognizer, Step, Stepper, Steps, Sticky, Swipe, SwipeCell, SwipeItem, Switch, SwitchCell, Tab, Tabbar, TabbarItem, Table, Tabs, Tag, TextEllipsis, Timeline, Toast, Uploader];
|
|
82
82
|
components.forEach(function (item) {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _mergeJSXProps, { default as _mergeJSXProps2 } from "@vue/babel-helper-vue-jsx-merge-props";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
2
|
// Utils
|
|
4
3
|
import { createNamespace } from '../utils';
|
|
@@ -63,6 +62,8 @@ export default createComponent({
|
|
|
63
62
|
return {
|
|
64
63
|
selectedValues: [],
|
|
65
64
|
// 基于值的选中状态,用于支持 options 动态变化
|
|
65
|
+
confirmedSelectedValues: [],
|
|
66
|
+
// 上次确认时的 selectedValues,用于取消时恢复
|
|
66
67
|
currentIndexs: [],
|
|
67
68
|
confirmIndexs: null
|
|
68
69
|
};
|
|
@@ -125,7 +126,11 @@ export default createComponent({
|
|
|
125
126
|
}
|
|
126
127
|
});
|
|
127
128
|
}
|
|
128
|
-
|
|
129
|
+
|
|
130
|
+
// 弹出时直接设置 currentIndexs,不调用 setConfirmIndex,保持未确认状态
|
|
131
|
+
_this3.$refs.pickerOptions.confirmed = false;
|
|
132
|
+
_this3.$refs.pickerOptions.currentIndexs = displayIndexs;
|
|
133
|
+
|
|
129
134
|
// 同步 currentIndexs(基于原始 options)
|
|
130
135
|
_this3.currentIndexs = _this3.confirmIndexs || [];
|
|
131
136
|
}
|
|
@@ -230,20 +235,31 @@ export default createComponent({
|
|
|
230
235
|
this.$emit('change', this.getOptions());
|
|
231
236
|
},
|
|
232
237
|
cancel: function cancel() {
|
|
238
|
+
var _this8 = this;
|
|
239
|
+
// 取消时恢复到上次确认的状态
|
|
240
|
+
this.selectedValues = [].concat(this.confirmedSelectedValues);
|
|
241
|
+
|
|
242
|
+
// 重新计算 currentIndexs
|
|
243
|
+
this.currentIndexs = [];
|
|
244
|
+
this.options.forEach(function (option, index) {
|
|
245
|
+
if (_this8.selectedValues.includes(_this8.getOptionValue(option))) {
|
|
246
|
+
_this8.currentIndexs.push(index);
|
|
247
|
+
}
|
|
248
|
+
});
|
|
233
249
|
this.$emit('update:showPicker', false);
|
|
234
250
|
this.emit('cancel');
|
|
235
251
|
},
|
|
236
252
|
confirm: function confirm() {
|
|
237
|
-
var
|
|
253
|
+
var _this9 = this;
|
|
238
254
|
// 返回所有已选的数据,而不仅仅是当前显示的
|
|
239
255
|
var allSelectedOptions = [];
|
|
240
256
|
this.selectedValues.forEach(function (value) {
|
|
241
|
-
var option =
|
|
242
|
-
return
|
|
257
|
+
var option = _this9.options.find(function (opt) {
|
|
258
|
+
return _this9.getOptionValue(opt) === value;
|
|
243
259
|
});
|
|
244
260
|
if (option) {
|
|
245
|
-
var originalIndex =
|
|
246
|
-
return
|
|
261
|
+
var originalIndex = _this9.options.findIndex(function (opt) {
|
|
262
|
+
return _this9.getOptionValue(opt) === value;
|
|
247
263
|
});
|
|
248
264
|
allSelectedOptions.push(_extends({}, option, {
|
|
249
265
|
initialIndex: originalIndex
|
|
@@ -253,13 +269,15 @@ export default createComponent({
|
|
|
253
269
|
this.confirmIndexs = allSelectedOptions.map(function (v) {
|
|
254
270
|
return v.initialIndex;
|
|
255
271
|
});
|
|
272
|
+
// 确认时保存当前的 selectedValues
|
|
273
|
+
this.confirmedSelectedValues = [].concat(this.selectedValues);
|
|
256
274
|
this.$emit('confirm', allSelectedOptions);
|
|
257
275
|
},
|
|
258
276
|
handleSelectAll: function handleSelectAll() {
|
|
259
|
-
var
|
|
277
|
+
var _this10 = this;
|
|
260
278
|
// 全选应该基于当前显示的 displayOptions,只选中当前搜索结果
|
|
261
279
|
var displayValues = this.displayOptions.map(function (opt) {
|
|
262
|
-
return
|
|
280
|
+
return _this10.getOptionValue(opt);
|
|
263
281
|
});
|
|
264
282
|
if (!this.isAllSelected) {
|
|
265
283
|
// 全选:只选中当前显示的值,清除其他值
|
|
@@ -268,8 +286,8 @@ export default createComponent({
|
|
|
268
286
|
// 更新 currentIndexs(基于原始 options)
|
|
269
287
|
this.currentIndexs = [];
|
|
270
288
|
this.options.forEach(function (option, index) {
|
|
271
|
-
if (displayValues.includes(
|
|
272
|
-
|
|
289
|
+
if (displayValues.includes(_this10.getOptionValue(option))) {
|
|
290
|
+
_this10.currentIndexs.push(index);
|
|
273
291
|
}
|
|
274
292
|
});
|
|
275
293
|
|
|
@@ -290,10 +308,10 @@ export default createComponent({
|
|
|
290
308
|
}
|
|
291
309
|
},
|
|
292
310
|
onSelectOther: function onSelectOther() {
|
|
293
|
-
var
|
|
311
|
+
var _this11 = this;
|
|
294
312
|
// 反选应该基于当前显示的 displayOptions,只操作当前搜索结果
|
|
295
313
|
var displayValues = this.displayOptions.map(function (opt) {
|
|
296
|
-
return
|
|
314
|
+
return _this11.getOptionValue(opt);
|
|
297
315
|
});
|
|
298
316
|
|
|
299
317
|
// 计算当前显示项中未选中的值
|
|
@@ -310,15 +328,15 @@ export default createComponent({
|
|
|
310
328
|
// 更新 currentIndexs(基于原始 options)
|
|
311
329
|
this.currentIndexs = [];
|
|
312
330
|
this.options.forEach(function (option, index) {
|
|
313
|
-
if (displayUnselectedValues.includes(
|
|
314
|
-
|
|
331
|
+
if (displayUnselectedValues.includes(_this11.getOptionValue(option))) {
|
|
332
|
+
_this11.currentIndexs.push(index);
|
|
315
333
|
}
|
|
316
334
|
});
|
|
317
335
|
|
|
318
336
|
// 映射到 displayOptions 的索引(反选后的状态)
|
|
319
337
|
var displayIndexs = [];
|
|
320
338
|
this.displayOptions.forEach(function (option, index) {
|
|
321
|
-
if (displayUnselectedValues.includes(
|
|
339
|
+
if (displayUnselectedValues.includes(_this11.getOptionValue(option))) {
|
|
322
340
|
displayIndexs.push(index);
|
|
323
341
|
}
|
|
324
342
|
});
|
|
@@ -356,14 +374,12 @@ export default createComponent({
|
|
|
356
374
|
},
|
|
357
375
|
genCancel: function genCancel() {
|
|
358
376
|
var h = this.$createElement;
|
|
359
|
-
return h(Button,
|
|
377
|
+
return h(Button, {
|
|
360
378
|
"class": [this.showSelectAll ? bem('in-select-all') : ''],
|
|
361
379
|
"attrs": {
|
|
362
|
-
"size": this.showSelectAll ? "medium" : "normal"
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
block: true
|
|
366
|
-
} : {}, {
|
|
380
|
+
"size": this.showSelectAll ? "medium" : "normal",
|
|
381
|
+
"block": !this.showSelectAll
|
|
382
|
+
},
|
|
367
383
|
"style": {
|
|
368
384
|
marginRigth: "4px",
|
|
369
385
|
backgroundColor: "white"
|
|
@@ -371,26 +387,24 @@ export default createComponent({
|
|
|
371
387
|
"on": {
|
|
372
388
|
"click": this.cancel
|
|
373
389
|
}
|
|
374
|
-
}
|
|
390
|
+
}, [this.slots('cancel') || this.cancelButtonText || t('cancel')]);
|
|
375
391
|
},
|
|
376
392
|
genConfirm: function genConfirm() {
|
|
377
393
|
var h = this.$createElement;
|
|
378
|
-
return h(Button,
|
|
394
|
+
return h(Button, {
|
|
379
395
|
"attrs": {
|
|
380
396
|
"type": "primary",
|
|
381
|
-
"size": this.showSelectAll ? "medium" : "normal"
|
|
397
|
+
"size": this.showSelectAll ? "medium" : "normal",
|
|
398
|
+
"block": !this.showSelectAll
|
|
382
399
|
},
|
|
383
|
-
"class": [this.showSelectAll ? bem('in-select-all') : '']
|
|
384
|
-
}, this.showSelectAll ? {
|
|
385
|
-
block: true
|
|
386
|
-
} : {}, {
|
|
400
|
+
"class": [this.showSelectAll ? bem('in-select-all') : ''],
|
|
387
401
|
"style": {
|
|
388
402
|
marginLeft: "8px"
|
|
389
403
|
},
|
|
390
404
|
"on": {
|
|
391
405
|
"click": this.confirm
|
|
392
406
|
}
|
|
393
|
-
}
|
|
407
|
+
}, [this.slots('confirm') || this.confirmButtonText || t('confirm')]);
|
|
394
408
|
},
|
|
395
409
|
genSelectAll: function genSelectAll() {
|
|
396
410
|
var h = this.$createElement;
|
|
@@ -437,7 +451,7 @@ export default createComponent({
|
|
|
437
451
|
}, [this.genOptionItems()]);
|
|
438
452
|
},
|
|
439
453
|
genOptionItems: function genOptionItems() {
|
|
440
|
-
var
|
|
454
|
+
var _this12 = this;
|
|
441
455
|
var h = this.$createElement;
|
|
442
456
|
var formatOptions = [];
|
|
443
457
|
var sourceOptions = this.displayOptions;
|
|
@@ -467,7 +481,7 @@ export default createComponent({
|
|
|
467
481
|
},
|
|
468
482
|
"on": {
|
|
469
483
|
"change": function change() {
|
|
470
|
-
|
|
484
|
+
_this12.onChange();
|
|
471
485
|
}
|
|
472
486
|
}
|
|
473
487
|
});
|
package/lib/index.js
CHANGED
|
@@ -161,7 +161,7 @@ var _toast = _interopRequireDefault(require("./toast"));
|
|
|
161
161
|
exports.Toast = _toast.default;
|
|
162
162
|
var _uploader = _interopRequireDefault(require("./uploader"));
|
|
163
163
|
exports.Uploader = _uploader.default;
|
|
164
|
-
var version = exports.version = '2.1.
|
|
164
|
+
var version = exports.version = '2.1.29';
|
|
165
165
|
function install(Vue) {
|
|
166
166
|
var components = [_actionSheet.default, _area.default, _avatar.default, _backTop.default, _badge.default, _button.default, _calendar.default, _cascader.default, _cell.default, _cellGroup.default, _checkbox.default, _checkboxGroup.default, _col.default, _collapse.default, _collapseItem.default, _countDown.default, _datetimePicker.default, _dialog.default, _divider.default, _dropdownItem.default, _dropdownMenu.default, _empty.default, _field.default, _foldDialog.default, _form.default, _grid.default, _gridItem.default, _hierarchySelect.default, _icon.default, _image.default, _imagePreview.default, _indexAnchor.default, _indexBar.default, _info.default, _lazyload.default, _list.default, _loading.default, _locale.default, _mediaPicker.default, _mediaPlayer.default, _multiplePicker.default, _navBar.default, _noticeBar.default, _numberKeyboard.default, _overlay.default, _passwordInput.default, _picker.default, _popover.default, _popup.default, _pullRefresh.default, _radio.default, _radioGroup.default, _rate.default, _row.default, _search.default, _signature.default, _skeleton.default, _slider.default, _speechRecognizer.default, _step.default, _stepper.default, _steps.default, _sticky.default, _swipe.default, _swipeCell.default, _swipeItem.default, _switch.default, _switchCell.default, _tab.default, _tabbar.default, _tabbarItem.default, _table.default, _tabs.default, _tag.default, _textEllipsis.default, _timeline.default, _toast.default, _uploader.default];
|
|
167
167
|
components.forEach(function (item) {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
exports.__esModule = true;
|
|
5
5
|
exports.default = void 0;
|
|
6
|
-
var _babelHelperVueJsxMergeProps = _interopRequireDefault(require("@vue/babel-helper-vue-jsx-merge-props"));
|
|
7
6
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
8
7
|
var _utils = require("../utils");
|
|
9
8
|
var _shared = require("./shared");
|
|
@@ -70,6 +69,8 @@ var _default2 = exports.default = createComponent({
|
|
|
70
69
|
return {
|
|
71
70
|
selectedValues: [],
|
|
72
71
|
// 基于值的选中状态,用于支持 options 动态变化
|
|
72
|
+
confirmedSelectedValues: [],
|
|
73
|
+
// 上次确认时的 selectedValues,用于取消时恢复
|
|
73
74
|
currentIndexs: [],
|
|
74
75
|
confirmIndexs: null
|
|
75
76
|
};
|
|
@@ -132,7 +133,11 @@ var _default2 = exports.default = createComponent({
|
|
|
132
133
|
}
|
|
133
134
|
});
|
|
134
135
|
}
|
|
135
|
-
|
|
136
|
+
|
|
137
|
+
// 弹出时直接设置 currentIndexs,不调用 setConfirmIndex,保持未确认状态
|
|
138
|
+
_this3.$refs.pickerOptions.confirmed = false;
|
|
139
|
+
_this3.$refs.pickerOptions.currentIndexs = displayIndexs;
|
|
140
|
+
|
|
136
141
|
// 同步 currentIndexs(基于原始 options)
|
|
137
142
|
_this3.currentIndexs = _this3.confirmIndexs || [];
|
|
138
143
|
}
|
|
@@ -237,20 +242,31 @@ var _default2 = exports.default = createComponent({
|
|
|
237
242
|
this.$emit('change', this.getOptions());
|
|
238
243
|
},
|
|
239
244
|
cancel: function cancel() {
|
|
245
|
+
var _this8 = this;
|
|
246
|
+
// 取消时恢复到上次确认的状态
|
|
247
|
+
this.selectedValues = [].concat(this.confirmedSelectedValues);
|
|
248
|
+
|
|
249
|
+
// 重新计算 currentIndexs
|
|
250
|
+
this.currentIndexs = [];
|
|
251
|
+
this.options.forEach(function (option, index) {
|
|
252
|
+
if (_this8.selectedValues.includes(_this8.getOptionValue(option))) {
|
|
253
|
+
_this8.currentIndexs.push(index);
|
|
254
|
+
}
|
|
255
|
+
});
|
|
240
256
|
this.$emit('update:showPicker', false);
|
|
241
257
|
this.emit('cancel');
|
|
242
258
|
},
|
|
243
259
|
confirm: function confirm() {
|
|
244
|
-
var
|
|
260
|
+
var _this9 = this;
|
|
245
261
|
// 返回所有已选的数据,而不仅仅是当前显示的
|
|
246
262
|
var allSelectedOptions = [];
|
|
247
263
|
this.selectedValues.forEach(function (value) {
|
|
248
|
-
var option =
|
|
249
|
-
return
|
|
264
|
+
var option = _this9.options.find(function (opt) {
|
|
265
|
+
return _this9.getOptionValue(opt) === value;
|
|
250
266
|
});
|
|
251
267
|
if (option) {
|
|
252
|
-
var originalIndex =
|
|
253
|
-
return
|
|
268
|
+
var originalIndex = _this9.options.findIndex(function (opt) {
|
|
269
|
+
return _this9.getOptionValue(opt) === value;
|
|
254
270
|
});
|
|
255
271
|
allSelectedOptions.push((0, _extends2.default)({}, option, {
|
|
256
272
|
initialIndex: originalIndex
|
|
@@ -260,13 +276,15 @@ var _default2 = exports.default = createComponent({
|
|
|
260
276
|
this.confirmIndexs = allSelectedOptions.map(function (v) {
|
|
261
277
|
return v.initialIndex;
|
|
262
278
|
});
|
|
279
|
+
// 确认时保存当前的 selectedValues
|
|
280
|
+
this.confirmedSelectedValues = [].concat(this.selectedValues);
|
|
263
281
|
this.$emit('confirm', allSelectedOptions);
|
|
264
282
|
},
|
|
265
283
|
handleSelectAll: function handleSelectAll() {
|
|
266
|
-
var
|
|
284
|
+
var _this10 = this;
|
|
267
285
|
// 全选应该基于当前显示的 displayOptions,只选中当前搜索结果
|
|
268
286
|
var displayValues = this.displayOptions.map(function (opt) {
|
|
269
|
-
return
|
|
287
|
+
return _this10.getOptionValue(opt);
|
|
270
288
|
});
|
|
271
289
|
if (!this.isAllSelected) {
|
|
272
290
|
// 全选:只选中当前显示的值,清除其他值
|
|
@@ -275,8 +293,8 @@ var _default2 = exports.default = createComponent({
|
|
|
275
293
|
// 更新 currentIndexs(基于原始 options)
|
|
276
294
|
this.currentIndexs = [];
|
|
277
295
|
this.options.forEach(function (option, index) {
|
|
278
|
-
if (displayValues.includes(
|
|
279
|
-
|
|
296
|
+
if (displayValues.includes(_this10.getOptionValue(option))) {
|
|
297
|
+
_this10.currentIndexs.push(index);
|
|
280
298
|
}
|
|
281
299
|
});
|
|
282
300
|
|
|
@@ -297,10 +315,10 @@ var _default2 = exports.default = createComponent({
|
|
|
297
315
|
}
|
|
298
316
|
},
|
|
299
317
|
onSelectOther: function onSelectOther() {
|
|
300
|
-
var
|
|
318
|
+
var _this11 = this;
|
|
301
319
|
// 反选应该基于当前显示的 displayOptions,只操作当前搜索结果
|
|
302
320
|
var displayValues = this.displayOptions.map(function (opt) {
|
|
303
|
-
return
|
|
321
|
+
return _this11.getOptionValue(opt);
|
|
304
322
|
});
|
|
305
323
|
|
|
306
324
|
// 计算当前显示项中未选中的值
|
|
@@ -317,15 +335,15 @@ var _default2 = exports.default = createComponent({
|
|
|
317
335
|
// 更新 currentIndexs(基于原始 options)
|
|
318
336
|
this.currentIndexs = [];
|
|
319
337
|
this.options.forEach(function (option, index) {
|
|
320
|
-
if (displayUnselectedValues.includes(
|
|
321
|
-
|
|
338
|
+
if (displayUnselectedValues.includes(_this11.getOptionValue(option))) {
|
|
339
|
+
_this11.currentIndexs.push(index);
|
|
322
340
|
}
|
|
323
341
|
});
|
|
324
342
|
|
|
325
343
|
// 映射到 displayOptions 的索引(反选后的状态)
|
|
326
344
|
var displayIndexs = [];
|
|
327
345
|
this.displayOptions.forEach(function (option, index) {
|
|
328
|
-
if (displayUnselectedValues.includes(
|
|
346
|
+
if (displayUnselectedValues.includes(_this11.getOptionValue(option))) {
|
|
329
347
|
displayIndexs.push(index);
|
|
330
348
|
}
|
|
331
349
|
});
|
|
@@ -363,14 +381,12 @@ var _default2 = exports.default = createComponent({
|
|
|
363
381
|
},
|
|
364
382
|
genCancel: function genCancel() {
|
|
365
383
|
var h = this.$createElement;
|
|
366
|
-
return h(_button.default,
|
|
384
|
+
return h(_button.default, {
|
|
367
385
|
"class": [this.showSelectAll ? bem('in-select-all') : ''],
|
|
368
386
|
"attrs": {
|
|
369
|
-
"size": this.showSelectAll ? "medium" : "normal"
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
block: true
|
|
373
|
-
} : {}, {
|
|
387
|
+
"size": this.showSelectAll ? "medium" : "normal",
|
|
388
|
+
"block": !this.showSelectAll
|
|
389
|
+
},
|
|
374
390
|
"style": {
|
|
375
391
|
marginRigth: "4px",
|
|
376
392
|
backgroundColor: "white"
|
|
@@ -378,26 +394,24 @@ var _default2 = exports.default = createComponent({
|
|
|
378
394
|
"on": {
|
|
379
395
|
"click": this.cancel
|
|
380
396
|
}
|
|
381
|
-
}
|
|
397
|
+
}, [this.slots('cancel') || this.cancelButtonText || t('cancel')]);
|
|
382
398
|
},
|
|
383
399
|
genConfirm: function genConfirm() {
|
|
384
400
|
var h = this.$createElement;
|
|
385
|
-
return h(_button.default,
|
|
401
|
+
return h(_button.default, {
|
|
386
402
|
"attrs": {
|
|
387
403
|
"type": "primary",
|
|
388
|
-
"size": this.showSelectAll ? "medium" : "normal"
|
|
404
|
+
"size": this.showSelectAll ? "medium" : "normal",
|
|
405
|
+
"block": !this.showSelectAll
|
|
389
406
|
},
|
|
390
|
-
"class": [this.showSelectAll ? bem('in-select-all') : '']
|
|
391
|
-
}, this.showSelectAll ? {
|
|
392
|
-
block: true
|
|
393
|
-
} : {}, {
|
|
407
|
+
"class": [this.showSelectAll ? bem('in-select-all') : ''],
|
|
394
408
|
"style": {
|
|
395
409
|
marginLeft: "8px"
|
|
396
410
|
},
|
|
397
411
|
"on": {
|
|
398
412
|
"click": this.confirm
|
|
399
413
|
}
|
|
400
|
-
}
|
|
414
|
+
}, [this.slots('confirm') || this.confirmButtonText || t('confirm')]);
|
|
401
415
|
},
|
|
402
416
|
genSelectAll: function genSelectAll() {
|
|
403
417
|
var h = this.$createElement;
|
|
@@ -444,7 +458,7 @@ var _default2 = exports.default = createComponent({
|
|
|
444
458
|
}, [this.genOptionItems()]);
|
|
445
459
|
},
|
|
446
460
|
genOptionItems: function genOptionItems() {
|
|
447
|
-
var
|
|
461
|
+
var _this12 = this;
|
|
448
462
|
var h = this.$createElement;
|
|
449
463
|
var formatOptions = [];
|
|
450
464
|
var sourceOptions = this.displayOptions;
|
|
@@ -474,7 +488,7 @@ var _default2 = exports.default = createComponent({
|
|
|
474
488
|
},
|
|
475
489
|
"on": {
|
|
476
490
|
"change": function change() {
|
|
477
|
-
|
|
491
|
+
_this12.onChange();
|
|
478
492
|
}
|
|
479
493
|
}
|
|
480
494
|
});
|
package/lib/zart.js
CHANGED
|
@@ -25978,7 +25978,6 @@ function MultiplePickerOptions_isOptionDisabled(option) {
|
|
|
25978
25978
|
}));
|
|
25979
25979
|
// CONCATENATED MODULE: ./es/multiple-picker/index.js
|
|
25980
25980
|
|
|
25981
|
-
|
|
25982
25981
|
// Utils
|
|
25983
25982
|
|
|
25984
25983
|
|
|
@@ -26042,6 +26041,8 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
|
|
|
26042
26041
|
return {
|
|
26043
26042
|
selectedValues: [],
|
|
26044
26043
|
// 基于值的选中状态,用于支持 options 动态变化
|
|
26044
|
+
confirmedSelectedValues: [],
|
|
26045
|
+
// 上次确认时的 selectedValues,用于取消时恢复
|
|
26045
26046
|
currentIndexs: [],
|
|
26046
26047
|
confirmIndexs: null
|
|
26047
26048
|
};
|
|
@@ -26104,7 +26105,11 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
|
|
|
26104
26105
|
}
|
|
26105
26106
|
});
|
|
26106
26107
|
}
|
|
26107
|
-
|
|
26108
|
+
|
|
26109
|
+
// 弹出时直接设置 currentIndexs,不调用 setConfirmIndex,保持未确认状态
|
|
26110
|
+
_this3.$refs.pickerOptions.confirmed = false;
|
|
26111
|
+
_this3.$refs.pickerOptions.currentIndexs = displayIndexs;
|
|
26112
|
+
|
|
26108
26113
|
// 同步 currentIndexs(基于原始 options)
|
|
26109
26114
|
_this3.currentIndexs = _this3.confirmIndexs || [];
|
|
26110
26115
|
}
|
|
@@ -26209,20 +26214,31 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
|
|
|
26209
26214
|
this.$emit('change', this.getOptions());
|
|
26210
26215
|
},
|
|
26211
26216
|
cancel: function cancel() {
|
|
26217
|
+
var _this8 = this;
|
|
26218
|
+
// 取消时恢复到上次确认的状态
|
|
26219
|
+
this.selectedValues = [].concat(this.confirmedSelectedValues);
|
|
26220
|
+
|
|
26221
|
+
// 重新计算 currentIndexs
|
|
26222
|
+
this.currentIndexs = [];
|
|
26223
|
+
this.options.forEach(function (option, index) {
|
|
26224
|
+
if (_this8.selectedValues.includes(_this8.getOptionValue(option))) {
|
|
26225
|
+
_this8.currentIndexs.push(index);
|
|
26226
|
+
}
|
|
26227
|
+
});
|
|
26212
26228
|
this.$emit('update:showPicker', false);
|
|
26213
26229
|
this.emit('cancel');
|
|
26214
26230
|
},
|
|
26215
26231
|
confirm: function confirm() {
|
|
26216
|
-
var
|
|
26232
|
+
var _this9 = this;
|
|
26217
26233
|
// 返回所有已选的数据,而不仅仅是当前显示的
|
|
26218
26234
|
var allSelectedOptions = [];
|
|
26219
26235
|
this.selectedValues.forEach(function (value) {
|
|
26220
|
-
var option =
|
|
26221
|
-
return
|
|
26236
|
+
var option = _this9.options.find(function (opt) {
|
|
26237
|
+
return _this9.getOptionValue(opt) === value;
|
|
26222
26238
|
});
|
|
26223
26239
|
if (option) {
|
|
26224
|
-
var originalIndex =
|
|
26225
|
-
return
|
|
26240
|
+
var originalIndex = _this9.options.findIndex(function (opt) {
|
|
26241
|
+
return _this9.getOptionValue(opt) === value;
|
|
26226
26242
|
});
|
|
26227
26243
|
allSelectedOptions.push(_extends({}, option, {
|
|
26228
26244
|
initialIndex: originalIndex
|
|
@@ -26232,13 +26248,15 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
|
|
|
26232
26248
|
this.confirmIndexs = allSelectedOptions.map(function (v) {
|
|
26233
26249
|
return v.initialIndex;
|
|
26234
26250
|
});
|
|
26251
|
+
// 确认时保存当前的 selectedValues
|
|
26252
|
+
this.confirmedSelectedValues = [].concat(this.selectedValues);
|
|
26235
26253
|
this.$emit('confirm', allSelectedOptions);
|
|
26236
26254
|
},
|
|
26237
26255
|
handleSelectAll: function handleSelectAll() {
|
|
26238
|
-
var
|
|
26256
|
+
var _this10 = this;
|
|
26239
26257
|
// 全选应该基于当前显示的 displayOptions,只选中当前搜索结果
|
|
26240
26258
|
var displayValues = this.displayOptions.map(function (opt) {
|
|
26241
|
-
return
|
|
26259
|
+
return _this10.getOptionValue(opt);
|
|
26242
26260
|
});
|
|
26243
26261
|
if (!this.isAllSelected) {
|
|
26244
26262
|
// 全选:只选中当前显示的值,清除其他值
|
|
@@ -26247,8 +26265,8 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
|
|
|
26247
26265
|
// 更新 currentIndexs(基于原始 options)
|
|
26248
26266
|
this.currentIndexs = [];
|
|
26249
26267
|
this.options.forEach(function (option, index) {
|
|
26250
|
-
if (displayValues.includes(
|
|
26251
|
-
|
|
26268
|
+
if (displayValues.includes(_this10.getOptionValue(option))) {
|
|
26269
|
+
_this10.currentIndexs.push(index);
|
|
26252
26270
|
}
|
|
26253
26271
|
});
|
|
26254
26272
|
|
|
@@ -26269,10 +26287,10 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
|
|
|
26269
26287
|
}
|
|
26270
26288
|
},
|
|
26271
26289
|
onSelectOther: function onSelectOther() {
|
|
26272
|
-
var
|
|
26290
|
+
var _this11 = this;
|
|
26273
26291
|
// 反选应该基于当前显示的 displayOptions,只操作当前搜索结果
|
|
26274
26292
|
var displayValues = this.displayOptions.map(function (opt) {
|
|
26275
|
-
return
|
|
26293
|
+
return _this11.getOptionValue(opt);
|
|
26276
26294
|
});
|
|
26277
26295
|
|
|
26278
26296
|
// 计算当前显示项中未选中的值
|
|
@@ -26289,15 +26307,15 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
|
|
|
26289
26307
|
// 更新 currentIndexs(基于原始 options)
|
|
26290
26308
|
this.currentIndexs = [];
|
|
26291
26309
|
this.options.forEach(function (option, index) {
|
|
26292
|
-
if (displayUnselectedValues.includes(
|
|
26293
|
-
|
|
26310
|
+
if (displayUnselectedValues.includes(_this11.getOptionValue(option))) {
|
|
26311
|
+
_this11.currentIndexs.push(index);
|
|
26294
26312
|
}
|
|
26295
26313
|
});
|
|
26296
26314
|
|
|
26297
26315
|
// 映射到 displayOptions 的索引(反选后的状态)
|
|
26298
26316
|
var displayIndexs = [];
|
|
26299
26317
|
this.displayOptions.forEach(function (option, index) {
|
|
26300
|
-
if (displayUnselectedValues.includes(
|
|
26318
|
+
if (displayUnselectedValues.includes(_this11.getOptionValue(option))) {
|
|
26301
26319
|
displayIndexs.push(index);
|
|
26302
26320
|
}
|
|
26303
26321
|
});
|
|
@@ -26335,14 +26353,12 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
|
|
|
26335
26353
|
},
|
|
26336
26354
|
genCancel: function genCancel() {
|
|
26337
26355
|
var h = this.$createElement;
|
|
26338
|
-
return h(es_button,
|
|
26356
|
+
return h(es_button, {
|
|
26339
26357
|
"class": [this.showSelectAll ? multiple_picker_bem('in-select-all') : ''],
|
|
26340
26358
|
"attrs": {
|
|
26341
|
-
"size": this.showSelectAll ? "medium" : "normal"
|
|
26342
|
-
|
|
26343
|
-
|
|
26344
|
-
block: true
|
|
26345
|
-
} : {}, {
|
|
26359
|
+
"size": this.showSelectAll ? "medium" : "normal",
|
|
26360
|
+
"block": !this.showSelectAll
|
|
26361
|
+
},
|
|
26346
26362
|
"style": {
|
|
26347
26363
|
marginRigth: "4px",
|
|
26348
26364
|
backgroundColor: "white"
|
|
@@ -26350,26 +26366,24 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
|
|
|
26350
26366
|
"on": {
|
|
26351
26367
|
"click": this.cancel
|
|
26352
26368
|
}
|
|
26353
|
-
}
|
|
26369
|
+
}, [this.slots('cancel') || this.cancelButtonText || multiple_picker_t('cancel')]);
|
|
26354
26370
|
},
|
|
26355
26371
|
genConfirm: function genConfirm() {
|
|
26356
26372
|
var h = this.$createElement;
|
|
26357
|
-
return h(es_button,
|
|
26373
|
+
return h(es_button, {
|
|
26358
26374
|
"attrs": {
|
|
26359
26375
|
"type": "primary",
|
|
26360
|
-
"size": this.showSelectAll ? "medium" : "normal"
|
|
26376
|
+
"size": this.showSelectAll ? "medium" : "normal",
|
|
26377
|
+
"block": !this.showSelectAll
|
|
26361
26378
|
},
|
|
26362
|
-
"class": [this.showSelectAll ? multiple_picker_bem('in-select-all') : '']
|
|
26363
|
-
}, this.showSelectAll ? {
|
|
26364
|
-
block: true
|
|
26365
|
-
} : {}, {
|
|
26379
|
+
"class": [this.showSelectAll ? multiple_picker_bem('in-select-all') : ''],
|
|
26366
26380
|
"style": {
|
|
26367
26381
|
marginLeft: "8px"
|
|
26368
26382
|
},
|
|
26369
26383
|
"on": {
|
|
26370
26384
|
"click": this.confirm
|
|
26371
26385
|
}
|
|
26372
|
-
}
|
|
26386
|
+
}, [this.slots('confirm') || this.confirmButtonText || multiple_picker_t('confirm')]);
|
|
26373
26387
|
},
|
|
26374
26388
|
genSelectAll: function genSelectAll() {
|
|
26375
26389
|
var h = this.$createElement;
|
|
@@ -26416,7 +26430,7 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
|
|
|
26416
26430
|
}, [this.genOptionItems()]);
|
|
26417
26431
|
},
|
|
26418
26432
|
genOptionItems: function genOptionItems() {
|
|
26419
|
-
var
|
|
26433
|
+
var _this12 = this;
|
|
26420
26434
|
var h = this.$createElement;
|
|
26421
26435
|
var formatOptions = [];
|
|
26422
26436
|
var sourceOptions = this.displayOptions;
|
|
@@ -26446,7 +26460,7 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
|
|
|
26446
26460
|
},
|
|
26447
26461
|
"on": {
|
|
26448
26462
|
"change": function change() {
|
|
26449
|
-
|
|
26463
|
+
_this12.onChange();
|
|
26450
26464
|
}
|
|
26451
26465
|
}
|
|
26452
26466
|
});
|
|
@@ -35383,7 +35397,7 @@ var uploader_createNamespace = Object(utils["b" /* createNamespace */])('uploade
|
|
|
35383
35397
|
|
|
35384
35398
|
|
|
35385
35399
|
|
|
35386
|
-
var es_version = '2.1.
|
|
35400
|
+
var es_version = '2.1.29';
|
|
35387
35401
|
function install(Vue) {
|
|
35388
35402
|
var components = [action_sheet, es_area, avatar, back_top, badge, es_button, calendar, cascader, cell, cell_group, es_checkbox, checkbox_group, col, collapse, collapse_item, count_down, datetime_picker, dialog, divider, dropdown_item, dropdown_menu, empty, es_field, fold_dialog, es_form, grid, grid_item, hierarchy_select, es_icon, es_image, image_preview, index_anchor, index_bar, es_info, lazyload, es_list, es_loading, locale["a" /* default */], media_picker, media_player, multiple_picker, nav_bar, notice_bar, number_keyboard, es_overlay, password_input, es_picker, popover, popup, pull_refresh, es_radio, radio_group, rate, row, search, signature, skeleton, slider, speech_recognizer, es_step, stepper, steps, es_sticky, swipe, swipe_cell, swipe_item, es_switch, switch_cell, tab, tabbar, tabbar_item, table, tabs, es_tag, text_ellipsis, timeline, es_toast, uploader];
|
|
35389
35403
|
components.forEach(function (item) {
|