zartui 2.1.27 → 2.1.28

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 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.27';
79
+ var version = '2.1.28';
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) {
@@ -63,6 +63,8 @@ export default createComponent({
63
63
  return {
64
64
  selectedValues: [],
65
65
  // 基于值的选中状态,用于支持 options 动态变化
66
+ confirmedSelectedValues: [],
67
+ // 上次确认时的 selectedValues,用于取消时恢复
66
68
  currentIndexs: [],
67
69
  confirmIndexs: null
68
70
  };
@@ -125,7 +127,11 @@ export default createComponent({
125
127
  }
126
128
  });
127
129
  }
128
- _this3.$refs.pickerOptions.setConfirmIndex(displayIndexs);
130
+
131
+ // 弹出时直接设置 currentIndexs,不调用 setConfirmIndex,保持未确认状态
132
+ _this3.$refs.pickerOptions.confirmed = false;
133
+ _this3.$refs.pickerOptions.currentIndexs = displayIndexs;
134
+
129
135
  // 同步 currentIndexs(基于原始 options)
130
136
  _this3.currentIndexs = _this3.confirmIndexs || [];
131
137
  }
@@ -230,20 +236,31 @@ export default createComponent({
230
236
  this.$emit('change', this.getOptions());
231
237
  },
232
238
  cancel: function cancel() {
239
+ var _this8 = this;
240
+ // 取消时恢复到上次确认的状态
241
+ this.selectedValues = [].concat(this.confirmedSelectedValues);
242
+
243
+ // 重新计算 currentIndexs
244
+ this.currentIndexs = [];
245
+ this.options.forEach(function (option, index) {
246
+ if (_this8.selectedValues.includes(_this8.getOptionValue(option))) {
247
+ _this8.currentIndexs.push(index);
248
+ }
249
+ });
233
250
  this.$emit('update:showPicker', false);
234
251
  this.emit('cancel');
235
252
  },
236
253
  confirm: function confirm() {
237
- var _this8 = this;
254
+ var _this9 = this;
238
255
  // 返回所有已选的数据,而不仅仅是当前显示的
239
256
  var allSelectedOptions = [];
240
257
  this.selectedValues.forEach(function (value) {
241
- var option = _this8.options.find(function (opt) {
242
- return _this8.getOptionValue(opt) === value;
258
+ var option = _this9.options.find(function (opt) {
259
+ return _this9.getOptionValue(opt) === value;
243
260
  });
244
261
  if (option) {
245
- var originalIndex = _this8.options.findIndex(function (opt) {
246
- return _this8.getOptionValue(opt) === value;
262
+ var originalIndex = _this9.options.findIndex(function (opt) {
263
+ return _this9.getOptionValue(opt) === value;
247
264
  });
248
265
  allSelectedOptions.push(_extends({}, option, {
249
266
  initialIndex: originalIndex
@@ -253,13 +270,15 @@ export default createComponent({
253
270
  this.confirmIndexs = allSelectedOptions.map(function (v) {
254
271
  return v.initialIndex;
255
272
  });
273
+ // 确认时保存当前的 selectedValues
274
+ this.confirmedSelectedValues = [].concat(this.selectedValues);
256
275
  this.$emit('confirm', allSelectedOptions);
257
276
  },
258
277
  handleSelectAll: function handleSelectAll() {
259
- var _this9 = this;
278
+ var _this10 = this;
260
279
  // 全选应该基于当前显示的 displayOptions,只选中当前搜索结果
261
280
  var displayValues = this.displayOptions.map(function (opt) {
262
- return _this9.getOptionValue(opt);
281
+ return _this10.getOptionValue(opt);
263
282
  });
264
283
  if (!this.isAllSelected) {
265
284
  // 全选:只选中当前显示的值,清除其他值
@@ -268,8 +287,8 @@ export default createComponent({
268
287
  // 更新 currentIndexs(基于原始 options)
269
288
  this.currentIndexs = [];
270
289
  this.options.forEach(function (option, index) {
271
- if (displayValues.includes(_this9.getOptionValue(option))) {
272
- _this9.currentIndexs.push(index);
290
+ if (displayValues.includes(_this10.getOptionValue(option))) {
291
+ _this10.currentIndexs.push(index);
273
292
  }
274
293
  });
275
294
 
@@ -290,10 +309,10 @@ export default createComponent({
290
309
  }
291
310
  },
292
311
  onSelectOther: function onSelectOther() {
293
- var _this10 = this;
312
+ var _this11 = this;
294
313
  // 反选应该基于当前显示的 displayOptions,只操作当前搜索结果
295
314
  var displayValues = this.displayOptions.map(function (opt) {
296
- return _this10.getOptionValue(opt);
315
+ return _this11.getOptionValue(opt);
297
316
  });
298
317
 
299
318
  // 计算当前显示项中未选中的值
@@ -310,15 +329,15 @@ export default createComponent({
310
329
  // 更新 currentIndexs(基于原始 options)
311
330
  this.currentIndexs = [];
312
331
  this.options.forEach(function (option, index) {
313
- if (displayUnselectedValues.includes(_this10.getOptionValue(option))) {
314
- _this10.currentIndexs.push(index);
332
+ if (displayUnselectedValues.includes(_this11.getOptionValue(option))) {
333
+ _this11.currentIndexs.push(index);
315
334
  }
316
335
  });
317
336
 
318
337
  // 映射到 displayOptions 的索引(反选后的状态)
319
338
  var displayIndexs = [];
320
339
  this.displayOptions.forEach(function (option, index) {
321
- if (displayUnselectedValues.includes(_this10.getOptionValue(option))) {
340
+ if (displayUnselectedValues.includes(_this11.getOptionValue(option))) {
322
341
  displayIndexs.push(index);
323
342
  }
324
343
  });
@@ -437,7 +456,7 @@ export default createComponent({
437
456
  }, [this.genOptionItems()]);
438
457
  },
439
458
  genOptionItems: function genOptionItems() {
440
- var _this11 = this;
459
+ var _this12 = this;
441
460
  var h = this.$createElement;
442
461
  var formatOptions = [];
443
462
  var sourceOptions = this.displayOptions;
@@ -467,7 +486,7 @@ export default createComponent({
467
486
  },
468
487
  "on": {
469
488
  "change": function change() {
470
- _this11.onChange();
489
+ _this12.onChange();
471
490
  }
472
491
  }
473
492
  });
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.27';
164
+ var version = exports.version = '2.1.28';
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) {
@@ -70,6 +70,8 @@ var _default2 = exports.default = createComponent({
70
70
  return {
71
71
  selectedValues: [],
72
72
  // 基于值的选中状态,用于支持 options 动态变化
73
+ confirmedSelectedValues: [],
74
+ // 上次确认时的 selectedValues,用于取消时恢复
73
75
  currentIndexs: [],
74
76
  confirmIndexs: null
75
77
  };
@@ -132,7 +134,11 @@ var _default2 = exports.default = createComponent({
132
134
  }
133
135
  });
134
136
  }
135
- _this3.$refs.pickerOptions.setConfirmIndex(displayIndexs);
137
+
138
+ // 弹出时直接设置 currentIndexs,不调用 setConfirmIndex,保持未确认状态
139
+ _this3.$refs.pickerOptions.confirmed = false;
140
+ _this3.$refs.pickerOptions.currentIndexs = displayIndexs;
141
+
136
142
  // 同步 currentIndexs(基于原始 options)
137
143
  _this3.currentIndexs = _this3.confirmIndexs || [];
138
144
  }
@@ -237,20 +243,31 @@ var _default2 = exports.default = createComponent({
237
243
  this.$emit('change', this.getOptions());
238
244
  },
239
245
  cancel: function cancel() {
246
+ var _this8 = this;
247
+ // 取消时恢复到上次确认的状态
248
+ this.selectedValues = [].concat(this.confirmedSelectedValues);
249
+
250
+ // 重新计算 currentIndexs
251
+ this.currentIndexs = [];
252
+ this.options.forEach(function (option, index) {
253
+ if (_this8.selectedValues.includes(_this8.getOptionValue(option))) {
254
+ _this8.currentIndexs.push(index);
255
+ }
256
+ });
240
257
  this.$emit('update:showPicker', false);
241
258
  this.emit('cancel');
242
259
  },
243
260
  confirm: function confirm() {
244
- var _this8 = this;
261
+ var _this9 = this;
245
262
  // 返回所有已选的数据,而不仅仅是当前显示的
246
263
  var allSelectedOptions = [];
247
264
  this.selectedValues.forEach(function (value) {
248
- var option = _this8.options.find(function (opt) {
249
- return _this8.getOptionValue(opt) === value;
265
+ var option = _this9.options.find(function (opt) {
266
+ return _this9.getOptionValue(opt) === value;
250
267
  });
251
268
  if (option) {
252
- var originalIndex = _this8.options.findIndex(function (opt) {
253
- return _this8.getOptionValue(opt) === value;
269
+ var originalIndex = _this9.options.findIndex(function (opt) {
270
+ return _this9.getOptionValue(opt) === value;
254
271
  });
255
272
  allSelectedOptions.push((0, _extends2.default)({}, option, {
256
273
  initialIndex: originalIndex
@@ -260,13 +277,15 @@ var _default2 = exports.default = createComponent({
260
277
  this.confirmIndexs = allSelectedOptions.map(function (v) {
261
278
  return v.initialIndex;
262
279
  });
280
+ // 确认时保存当前的 selectedValues
281
+ this.confirmedSelectedValues = [].concat(this.selectedValues);
263
282
  this.$emit('confirm', allSelectedOptions);
264
283
  },
265
284
  handleSelectAll: function handleSelectAll() {
266
- var _this9 = this;
285
+ var _this10 = this;
267
286
  // 全选应该基于当前显示的 displayOptions,只选中当前搜索结果
268
287
  var displayValues = this.displayOptions.map(function (opt) {
269
- return _this9.getOptionValue(opt);
288
+ return _this10.getOptionValue(opt);
270
289
  });
271
290
  if (!this.isAllSelected) {
272
291
  // 全选:只选中当前显示的值,清除其他值
@@ -275,8 +294,8 @@ var _default2 = exports.default = createComponent({
275
294
  // 更新 currentIndexs(基于原始 options)
276
295
  this.currentIndexs = [];
277
296
  this.options.forEach(function (option, index) {
278
- if (displayValues.includes(_this9.getOptionValue(option))) {
279
- _this9.currentIndexs.push(index);
297
+ if (displayValues.includes(_this10.getOptionValue(option))) {
298
+ _this10.currentIndexs.push(index);
280
299
  }
281
300
  });
282
301
 
@@ -297,10 +316,10 @@ var _default2 = exports.default = createComponent({
297
316
  }
298
317
  },
299
318
  onSelectOther: function onSelectOther() {
300
- var _this10 = this;
319
+ var _this11 = this;
301
320
  // 反选应该基于当前显示的 displayOptions,只操作当前搜索结果
302
321
  var displayValues = this.displayOptions.map(function (opt) {
303
- return _this10.getOptionValue(opt);
322
+ return _this11.getOptionValue(opt);
304
323
  });
305
324
 
306
325
  // 计算当前显示项中未选中的值
@@ -317,15 +336,15 @@ var _default2 = exports.default = createComponent({
317
336
  // 更新 currentIndexs(基于原始 options)
318
337
  this.currentIndexs = [];
319
338
  this.options.forEach(function (option, index) {
320
- if (displayUnselectedValues.includes(_this10.getOptionValue(option))) {
321
- _this10.currentIndexs.push(index);
339
+ if (displayUnselectedValues.includes(_this11.getOptionValue(option))) {
340
+ _this11.currentIndexs.push(index);
322
341
  }
323
342
  });
324
343
 
325
344
  // 映射到 displayOptions 的索引(反选后的状态)
326
345
  var displayIndexs = [];
327
346
  this.displayOptions.forEach(function (option, index) {
328
- if (displayUnselectedValues.includes(_this10.getOptionValue(option))) {
347
+ if (displayUnselectedValues.includes(_this11.getOptionValue(option))) {
329
348
  displayIndexs.push(index);
330
349
  }
331
350
  });
@@ -444,7 +463,7 @@ var _default2 = exports.default = createComponent({
444
463
  }, [this.genOptionItems()]);
445
464
  },
446
465
  genOptionItems: function genOptionItems() {
447
- var _this11 = this;
466
+ var _this12 = this;
448
467
  var h = this.$createElement;
449
468
  var formatOptions = [];
450
469
  var sourceOptions = this.displayOptions;
@@ -474,7 +493,7 @@ var _default2 = exports.default = createComponent({
474
493
  },
475
494
  "on": {
476
495
  "change": function change() {
477
- _this11.onChange();
496
+ _this12.onChange();
478
497
  }
479
498
  }
480
499
  });
package/lib/zart.js CHANGED
@@ -26042,6 +26042,8 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
26042
26042
  return {
26043
26043
  selectedValues: [],
26044
26044
  // 基于值的选中状态,用于支持 options 动态变化
26045
+ confirmedSelectedValues: [],
26046
+ // 上次确认时的 selectedValues,用于取消时恢复
26045
26047
  currentIndexs: [],
26046
26048
  confirmIndexs: null
26047
26049
  };
@@ -26104,7 +26106,11 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
26104
26106
  }
26105
26107
  });
26106
26108
  }
26107
- _this3.$refs.pickerOptions.setConfirmIndex(displayIndexs);
26109
+
26110
+ // 弹出时直接设置 currentIndexs,不调用 setConfirmIndex,保持未确认状态
26111
+ _this3.$refs.pickerOptions.confirmed = false;
26112
+ _this3.$refs.pickerOptions.currentIndexs = displayIndexs;
26113
+
26108
26114
  // 同步 currentIndexs(基于原始 options)
26109
26115
  _this3.currentIndexs = _this3.confirmIndexs || [];
26110
26116
  }
@@ -26209,20 +26215,31 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
26209
26215
  this.$emit('change', this.getOptions());
26210
26216
  },
26211
26217
  cancel: function cancel() {
26218
+ var _this8 = this;
26219
+ // 取消时恢复到上次确认的状态
26220
+ this.selectedValues = [].concat(this.confirmedSelectedValues);
26221
+
26222
+ // 重新计算 currentIndexs
26223
+ this.currentIndexs = [];
26224
+ this.options.forEach(function (option, index) {
26225
+ if (_this8.selectedValues.includes(_this8.getOptionValue(option))) {
26226
+ _this8.currentIndexs.push(index);
26227
+ }
26228
+ });
26212
26229
  this.$emit('update:showPicker', false);
26213
26230
  this.emit('cancel');
26214
26231
  },
26215
26232
  confirm: function confirm() {
26216
- var _this8 = this;
26233
+ var _this9 = this;
26217
26234
  // 返回所有已选的数据,而不仅仅是当前显示的
26218
26235
  var allSelectedOptions = [];
26219
26236
  this.selectedValues.forEach(function (value) {
26220
- var option = _this8.options.find(function (opt) {
26221
- return _this8.getOptionValue(opt) === value;
26237
+ var option = _this9.options.find(function (opt) {
26238
+ return _this9.getOptionValue(opt) === value;
26222
26239
  });
26223
26240
  if (option) {
26224
- var originalIndex = _this8.options.findIndex(function (opt) {
26225
- return _this8.getOptionValue(opt) === value;
26241
+ var originalIndex = _this9.options.findIndex(function (opt) {
26242
+ return _this9.getOptionValue(opt) === value;
26226
26243
  });
26227
26244
  allSelectedOptions.push(_extends({}, option, {
26228
26245
  initialIndex: originalIndex
@@ -26232,13 +26249,15 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
26232
26249
  this.confirmIndexs = allSelectedOptions.map(function (v) {
26233
26250
  return v.initialIndex;
26234
26251
  });
26252
+ // 确认时保存当前的 selectedValues
26253
+ this.confirmedSelectedValues = [].concat(this.selectedValues);
26235
26254
  this.$emit('confirm', allSelectedOptions);
26236
26255
  },
26237
26256
  handleSelectAll: function handleSelectAll() {
26238
- var _this9 = this;
26257
+ var _this10 = this;
26239
26258
  // 全选应该基于当前显示的 displayOptions,只选中当前搜索结果
26240
26259
  var displayValues = this.displayOptions.map(function (opt) {
26241
- return _this9.getOptionValue(opt);
26260
+ return _this10.getOptionValue(opt);
26242
26261
  });
26243
26262
  if (!this.isAllSelected) {
26244
26263
  // 全选:只选中当前显示的值,清除其他值
@@ -26247,8 +26266,8 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
26247
26266
  // 更新 currentIndexs(基于原始 options)
26248
26267
  this.currentIndexs = [];
26249
26268
  this.options.forEach(function (option, index) {
26250
- if (displayValues.includes(_this9.getOptionValue(option))) {
26251
- _this9.currentIndexs.push(index);
26269
+ if (displayValues.includes(_this10.getOptionValue(option))) {
26270
+ _this10.currentIndexs.push(index);
26252
26271
  }
26253
26272
  });
26254
26273
 
@@ -26269,10 +26288,10 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
26269
26288
  }
26270
26289
  },
26271
26290
  onSelectOther: function onSelectOther() {
26272
- var _this10 = this;
26291
+ var _this11 = this;
26273
26292
  // 反选应该基于当前显示的 displayOptions,只操作当前搜索结果
26274
26293
  var displayValues = this.displayOptions.map(function (opt) {
26275
- return _this10.getOptionValue(opt);
26294
+ return _this11.getOptionValue(opt);
26276
26295
  });
26277
26296
 
26278
26297
  // 计算当前显示项中未选中的值
@@ -26289,15 +26308,15 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
26289
26308
  // 更新 currentIndexs(基于原始 options)
26290
26309
  this.currentIndexs = [];
26291
26310
  this.options.forEach(function (option, index) {
26292
- if (displayUnselectedValues.includes(_this10.getOptionValue(option))) {
26293
- _this10.currentIndexs.push(index);
26311
+ if (displayUnselectedValues.includes(_this11.getOptionValue(option))) {
26312
+ _this11.currentIndexs.push(index);
26294
26313
  }
26295
26314
  });
26296
26315
 
26297
26316
  // 映射到 displayOptions 的索引(反选后的状态)
26298
26317
  var displayIndexs = [];
26299
26318
  this.displayOptions.forEach(function (option, index) {
26300
- if (displayUnselectedValues.includes(_this10.getOptionValue(option))) {
26319
+ if (displayUnselectedValues.includes(_this11.getOptionValue(option))) {
26301
26320
  displayIndexs.push(index);
26302
26321
  }
26303
26322
  });
@@ -26416,7 +26435,7 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
26416
26435
  }, [this.genOptionItems()]);
26417
26436
  },
26418
26437
  genOptionItems: function genOptionItems() {
26419
- var _this11 = this;
26438
+ var _this12 = this;
26420
26439
  var h = this.$createElement;
26421
26440
  var formatOptions = [];
26422
26441
  var sourceOptions = this.displayOptions;
@@ -26446,7 +26465,7 @@ var multiple_picker_createNamespace = Object(utils["b" /* createNamespace */])('
26446
26465
  },
26447
26466
  "on": {
26448
26467
  "change": function change() {
26449
- _this11.onChange();
26468
+ _this12.onChange();
26450
26469
  }
26451
26470
  }
26452
26471
  });
@@ -35383,7 +35402,7 @@ var uploader_createNamespace = Object(utils["b" /* createNamespace */])('uploade
35383
35402
 
35384
35403
 
35385
35404
 
35386
- var es_version = '2.1.27';
35405
+ var es_version = '2.1.28';
35387
35406
  function install(Vue) {
35388
35407
  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
35408
  components.forEach(function (item) {