zartui 3.1.63 → 3.1.65

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/lib/zartui.cjs.js CHANGED
@@ -16941,6 +16941,7 @@ const multiplePickerProps = {
16941
16941
  showToolbar: truthProp,
16942
16942
  showTitle: truthProp,
16943
16943
  options: makeArrayProp(),
16944
+ filteredOptions: makeArrayProp(),
16944
16945
  toolbarPosition: makeStringProp("bottom"),
16945
16946
  textKey: makeStringProp("text"),
16946
16947
  columnCounts: makeNumberProp(3),
@@ -16960,13 +16961,33 @@ var stdin_default$A = vue.defineComponent({
16960
16961
  const currentOptions2 = vue.ref(props.options);
16961
16962
  const currentSelectedIndex = vue.computed(() => props.selectedIndex);
16962
16963
  const currentSelectedValue = vue.computed(() => props.selectedValue);
16964
+ const allSelectedOptions = vue.ref([]);
16963
16965
  const confirmIndexes = vue.ref(props.selectedIndex);
16964
16966
  const confirmValues = vue.ref(props.selectedValue);
16967
+ const displayOptions = vue.computed(() => {
16968
+ return props.filteredOptions && props.filteredOptions.length > 0 ? props.filteredOptions : currentOptions2.value;
16969
+ });
16970
+ const displaySelectedIndexes = vue.computed(() => {
16971
+ if (!props.filteredOptions || props.filteredOptions.length === 0) {
16972
+ return confirmIndexes.value;
16973
+ }
16974
+ const selectedValues = new Set(confirmIndexes.value.filter((idx) => idx >= 0 && idx < currentOptions2.value.length).map((idx) => {
16975
+ var _a;
16976
+ return (_a = currentOptions2.value[idx]) == null ? void 0 : _a.value;
16977
+ }));
16978
+ const result = [];
16979
+ displayOptions.value.forEach((option2, index2) => {
16980
+ if (selectedValues.has(option2.value)) {
16981
+ result.push(index2);
16982
+ }
16983
+ });
16984
+ return result;
16985
+ });
16965
16986
  const isIndeterminate = vue.computed(() => {
16966
- return confirmIndexes.value.length > 0 && confirmIndexes.value.length < currentOptions2.value.length;
16987
+ return displaySelectedIndexes.value.length > 0 && displaySelectedIndexes.value.length < displayOptions.value.length;
16967
16988
  });
16968
16989
  const isAllSelected = vue.computed(() => {
16969
- return confirmIndexes.value.length > 0 && confirmIndexes.value.length === currentOptions2.value.length;
16990
+ return displayOptions.value.length > 0 && displaySelectedIndexes.value.length > 0 && displaySelectedIndexes.value.length === displayOptions.value.length;
16970
16991
  });
16971
16992
  const resetOptions = (props2) => {
16972
16993
  currentOptions2.value = props2.options;
@@ -16979,14 +17000,39 @@ var stdin_default$A = vue.defineComponent({
16979
17000
  emit("update:selectedValue", confirmValues.value);
16980
17001
  };
16981
17002
  const onUpdateCurrentIndexes = (newVal) => {
16982
- confirmIndexes.value = newVal;
16983
- if (newVal.length > 0) {
17003
+ if (props.filteredOptions && props.filteredOptions.length > 0) {
17004
+ const selectedValues = newVal.filter((idx) => idx >= 0 && idx < displayOptions.value.length).map((idx) => {
17005
+ var _a;
17006
+ return (_a = displayOptions.value[idx]) == null ? void 0 : _a.value;
17007
+ });
17008
+ const newSelectedIndexes = /* @__PURE__ */ new Set();
17009
+ confirmIndexes.value.forEach((idx) => {
17010
+ var _a;
17011
+ if (idx >= 0 && idx < currentOptions2.value.length) {
17012
+ const value = (_a = currentOptions2.value[idx]) == null ? void 0 : _a.value;
17013
+ const isInFilteredList = displayOptions.value.some((opt) => opt.value === value);
17014
+ if (!isInFilteredList) {
17015
+ newSelectedIndexes.add(idx);
17016
+ }
17017
+ }
17018
+ });
17019
+ selectedValues.forEach((value) => {
17020
+ const originalIndex = currentOptions2.value.findIndex((opt) => opt.value === value);
17021
+ if (originalIndex >= 0) {
17022
+ newSelectedIndexes.add(originalIndex);
17023
+ }
17024
+ });
17025
+ confirmIndexes.value = Array.from(newSelectedIndexes);
17026
+ } else {
17027
+ confirmIndexes.value = newVal;
17028
+ }
17029
+ if (confirmIndexes.value.length > 0) {
16984
17030
  getValuesByIndexes();
16985
17031
  } else {
16986
17032
  confirmValues.value = [];
16987
17033
  }
16988
- getValuesByIndexes();
16989
17034
  emit("update:selectedValue", confirmValues.value);
17035
+ updateAllSelectedOptions();
16990
17036
  };
16991
17037
  const getIndexesByValues = () => {
16992
17038
  var _a;
@@ -17038,20 +17084,27 @@ var stdin_default$A = vue.defineComponent({
17038
17084
  };
17039
17085
  const updateShow = (value) => emit("update:showPicker", value);
17040
17086
  const getOptions = () => {
17041
- const indexes = confirmIndexes.value;
17087
+ return allSelectedOptions.value;
17088
+ };
17089
+ const onChange = () => {
17090
+ updateAllSelectedOptions();
17091
+ emit("change", getOptions());
17092
+ };
17093
+ const updateAllSelectedOptions = () => {
17042
17094
  const result = [];
17095
+ const indexes = confirmIndexes.value;
17043
17096
  indexes == null ? void 0 : indexes.forEach((index2) => {
17044
17097
  if (index2 > -1 && index2 < currentOptions2.value.length && currentOptions2.value[index2]) {
17098
+ const option2 = currentOptions2.value[index2];
17045
17099
  result.push({
17046
- [props.textKey]: currentOptions2.value[index2][props.textKey],
17047
- value: currentOptions2.value[index2].value,
17100
+ [props.textKey]: option2[props.textKey],
17101
+ value: option2.value,
17048
17102
  initialIndex: index2
17049
17103
  });
17050
17104
  }
17051
17105
  });
17052
- return result;
17106
+ allSelectedOptions.value = result;
17053
17107
  };
17054
- const onChange = () => emit("change", getOptions());
17055
17108
  const confirm = () => {
17056
17109
  const options = getOptions();
17057
17110
  emit("confirm", options);
@@ -17127,7 +17180,6 @@ var stdin_default$A = vue.defineComponent({
17127
17180
  "class": bem$s("toolbar-checkbox"),
17128
17181
  "shape": "square",
17129
17182
  "modelValue": isAllSelected.value,
17130
- "onUpdate:modelValue": ($event) => isAllSelected.value = $event,
17131
17183
  "indeterminate": isIndeterminate.value,
17132
17184
  "onClick": handleSelectAll
17133
17185
  }, {
@@ -17136,33 +17188,74 @@ var stdin_default$A = vue.defineComponent({
17136
17188
  "class": bem$s("toolbar-divider")
17137
17189
  }, null), vue.createVNode("span", {
17138
17190
  "class": bem$s("toolbar-checkbox-text")
17139
- }, [vue.createTextVNode("已选 "), confirmIndexes.value.length])]);
17191
+ }, [vue.createTextVNode("已选 "), allSelectedOptions.value.length])]);
17140
17192
  const handleSelectAll = () => {
17141
- confirmIndexes.value = !isAllSelected.value ? currentOptions2.value.map((_, index2) => index2) : [];
17193
+ if (!isAllSelected.value) {
17194
+ if (props.filteredOptions && props.filteredOptions.length > 0) {
17195
+ const selectedIndexes = [];
17196
+ displayOptions.value.forEach((option2) => {
17197
+ const originalIndex = currentOptions2.value.findIndex((opt) => opt.value === option2.value);
17198
+ if (originalIndex >= 0) {
17199
+ selectedIndexes.push(originalIndex);
17200
+ }
17201
+ });
17202
+ confirmIndexes.value = selectedIndexes;
17203
+ } else {
17204
+ confirmIndexes.value = currentOptions2.value.map((_, index2) => index2);
17205
+ }
17206
+ } else {
17207
+ confirmIndexes.value = [];
17208
+ }
17209
+ updateAllSelectedOptions();
17142
17210
  };
17143
17211
  const onSelectOther = () => {
17144
- const temp = Array();
17145
- currentOptions2.value.forEach((_, index2) => {
17146
- if (!confirmIndexes.value.includes(index2)) {
17147
- temp.push(index2);
17148
- }
17149
- });
17150
- confirmIndexes.value = temp;
17212
+ if (props.filteredOptions && props.filteredOptions.length > 0) {
17213
+ const filteredValues = new Set(displayOptions.value.map((opt) => opt.value));
17214
+ const currentSelectedInFiltered = /* @__PURE__ */ new Set();
17215
+ confirmIndexes.value.forEach((idx) => {
17216
+ var _a;
17217
+ if (idx >= 0 && idx < currentOptions2.value.length) {
17218
+ const value = (_a = currentOptions2.value[idx]) == null ? void 0 : _a.value;
17219
+ if (filteredValues.has(value)) {
17220
+ currentSelectedInFiltered.add(idx);
17221
+ }
17222
+ }
17223
+ });
17224
+ const newSelectedIndexes = [];
17225
+ displayOptions.value.forEach((option2) => {
17226
+ const originalIndex = currentOptions2.value.findIndex((opt) => opt.value === option2.value);
17227
+ if (originalIndex >= 0) {
17228
+ if (!currentSelectedInFiltered.has(originalIndex)) {
17229
+ newSelectedIndexes.push(originalIndex);
17230
+ }
17231
+ }
17232
+ });
17233
+ confirmIndexes.value = newSelectedIndexes;
17234
+ } else {
17235
+ const temp = new Array();
17236
+ currentOptions2.value.forEach((_, index2) => {
17237
+ if (!confirmIndexes.value.includes(index2)) {
17238
+ temp.push(index2);
17239
+ }
17240
+ });
17241
+ confirmIndexes.value = temp;
17242
+ }
17243
+ updateAllSelectedOptions();
17151
17244
  };
17152
- const genOptionItems = vue.computed(() => {
17245
+ const genOptionItems = () => {
17153
17246
  let formatOptions = [];
17154
- if (currentOptions2.value && currentOptions2.value[0] && typeof currentOptions2.value[0] !== "object") {
17155
- formatOptions = currentOptions2.value.map((v) => ({
17247
+ if (displayOptions.value && displayOptions.value[0] && typeof displayOptions.value[0] !== "object") {
17248
+ formatOptions = displayOptions.value.map((v) => ({
17156
17249
  value: v,
17157
17250
  text: v
17158
17251
  }));
17159
17252
  } else {
17160
- formatOptions = currentOptions2.value;
17253
+ formatOptions = displayOptions.value;
17161
17254
  }
17162
17255
  return vue.createVNode(stdin_default$B, {
17163
17256
  "ref": pickerOptions,
17164
- "currentIndexes": confirmIndexes.value,
17165
- "onUpdate:currentIndexes": [($event) => confirmIndexes.value = $event, onUpdateCurrentIndexes],
17257
+ "currentIndexes": displaySelectedIndexes.value,
17258
+ "onUpdate:currentIndexes": [($event) => displaySelectedIndexes.value = $event, onUpdateCurrentIndexes],
17166
17259
  "columnCounts": props.columnCounts,
17167
17260
  "initialOptions": formatOptions,
17168
17261
  "allowHtml": props.allowHtml,
@@ -17173,10 +17266,10 @@ var stdin_default$A = vue.defineComponent({
17173
17266
  }, {
17174
17267
  option: slots.option
17175
17268
  });
17176
- });
17269
+ };
17177
17270
  const genOptions2 = () => vue.createVNode("div", {
17178
17271
  "class": bem$s("options")
17179
- }, [genOptionItems.value]);
17272
+ }, [genOptionItems()]);
17180
17273
  const renderMultiplePicker = () => vue.createVNode("div", {
17181
17274
  "class": bem$s()
17182
17275
  }, [genTitle(), props.loading ? vue.createVNode(stdin_default$1T, {
@@ -23269,7 +23362,7 @@ const Lazyload = {
23269
23362
  });
23270
23363
  }
23271
23364
  };
23272
- const version = "3.1.63";
23365
+ const version = "3.1.65";
23273
23366
  function install(app) {
23274
23367
  const components = [
23275
23368
  ActionSheet,
package/lib/zartui.es.js CHANGED
@@ -16939,6 +16939,7 @@ const multiplePickerProps = {
16939
16939
  showToolbar: truthProp,
16940
16940
  showTitle: truthProp,
16941
16941
  options: makeArrayProp(),
16942
+ filteredOptions: makeArrayProp(),
16942
16943
  toolbarPosition: makeStringProp("bottom"),
16943
16944
  textKey: makeStringProp("text"),
16944
16945
  columnCounts: makeNumberProp(3),
@@ -16958,13 +16959,33 @@ var stdin_default$A = defineComponent({
16958
16959
  const currentOptions2 = ref(props.options);
16959
16960
  const currentSelectedIndex = computed(() => props.selectedIndex);
16960
16961
  const currentSelectedValue = computed(() => props.selectedValue);
16962
+ const allSelectedOptions = ref([]);
16961
16963
  const confirmIndexes = ref(props.selectedIndex);
16962
16964
  const confirmValues = ref(props.selectedValue);
16965
+ const displayOptions = computed(() => {
16966
+ return props.filteredOptions && props.filteredOptions.length > 0 ? props.filteredOptions : currentOptions2.value;
16967
+ });
16968
+ const displaySelectedIndexes = computed(() => {
16969
+ if (!props.filteredOptions || props.filteredOptions.length === 0) {
16970
+ return confirmIndexes.value;
16971
+ }
16972
+ const selectedValues = new Set(confirmIndexes.value.filter((idx) => idx >= 0 && idx < currentOptions2.value.length).map((idx) => {
16973
+ var _a;
16974
+ return (_a = currentOptions2.value[idx]) == null ? void 0 : _a.value;
16975
+ }));
16976
+ const result = [];
16977
+ displayOptions.value.forEach((option2, index2) => {
16978
+ if (selectedValues.has(option2.value)) {
16979
+ result.push(index2);
16980
+ }
16981
+ });
16982
+ return result;
16983
+ });
16963
16984
  const isIndeterminate = computed(() => {
16964
- return confirmIndexes.value.length > 0 && confirmIndexes.value.length < currentOptions2.value.length;
16985
+ return displaySelectedIndexes.value.length > 0 && displaySelectedIndexes.value.length < displayOptions.value.length;
16965
16986
  });
16966
16987
  const isAllSelected = computed(() => {
16967
- return confirmIndexes.value.length > 0 && confirmIndexes.value.length === currentOptions2.value.length;
16988
+ return displayOptions.value.length > 0 && displaySelectedIndexes.value.length > 0 && displaySelectedIndexes.value.length === displayOptions.value.length;
16968
16989
  });
16969
16990
  const resetOptions = (props2) => {
16970
16991
  currentOptions2.value = props2.options;
@@ -16977,14 +16998,39 @@ var stdin_default$A = defineComponent({
16977
16998
  emit("update:selectedValue", confirmValues.value);
16978
16999
  };
16979
17000
  const onUpdateCurrentIndexes = (newVal) => {
16980
- confirmIndexes.value = newVal;
16981
- if (newVal.length > 0) {
17001
+ if (props.filteredOptions && props.filteredOptions.length > 0) {
17002
+ const selectedValues = newVal.filter((idx) => idx >= 0 && idx < displayOptions.value.length).map((idx) => {
17003
+ var _a;
17004
+ return (_a = displayOptions.value[idx]) == null ? void 0 : _a.value;
17005
+ });
17006
+ const newSelectedIndexes = /* @__PURE__ */ new Set();
17007
+ confirmIndexes.value.forEach((idx) => {
17008
+ var _a;
17009
+ if (idx >= 0 && idx < currentOptions2.value.length) {
17010
+ const value = (_a = currentOptions2.value[idx]) == null ? void 0 : _a.value;
17011
+ const isInFilteredList = displayOptions.value.some((opt) => opt.value === value);
17012
+ if (!isInFilteredList) {
17013
+ newSelectedIndexes.add(idx);
17014
+ }
17015
+ }
17016
+ });
17017
+ selectedValues.forEach((value) => {
17018
+ const originalIndex = currentOptions2.value.findIndex((opt) => opt.value === value);
17019
+ if (originalIndex >= 0) {
17020
+ newSelectedIndexes.add(originalIndex);
17021
+ }
17022
+ });
17023
+ confirmIndexes.value = Array.from(newSelectedIndexes);
17024
+ } else {
17025
+ confirmIndexes.value = newVal;
17026
+ }
17027
+ if (confirmIndexes.value.length > 0) {
16982
17028
  getValuesByIndexes();
16983
17029
  } else {
16984
17030
  confirmValues.value = [];
16985
17031
  }
16986
- getValuesByIndexes();
16987
17032
  emit("update:selectedValue", confirmValues.value);
17033
+ updateAllSelectedOptions();
16988
17034
  };
16989
17035
  const getIndexesByValues = () => {
16990
17036
  var _a;
@@ -17036,20 +17082,27 @@ var stdin_default$A = defineComponent({
17036
17082
  };
17037
17083
  const updateShow = (value) => emit("update:showPicker", value);
17038
17084
  const getOptions = () => {
17039
- const indexes = confirmIndexes.value;
17085
+ return allSelectedOptions.value;
17086
+ };
17087
+ const onChange = () => {
17088
+ updateAllSelectedOptions();
17089
+ emit("change", getOptions());
17090
+ };
17091
+ const updateAllSelectedOptions = () => {
17040
17092
  const result = [];
17093
+ const indexes = confirmIndexes.value;
17041
17094
  indexes == null ? void 0 : indexes.forEach((index2) => {
17042
17095
  if (index2 > -1 && index2 < currentOptions2.value.length && currentOptions2.value[index2]) {
17096
+ const option2 = currentOptions2.value[index2];
17043
17097
  result.push({
17044
- [props.textKey]: currentOptions2.value[index2][props.textKey],
17045
- value: currentOptions2.value[index2].value,
17098
+ [props.textKey]: option2[props.textKey],
17099
+ value: option2.value,
17046
17100
  initialIndex: index2
17047
17101
  });
17048
17102
  }
17049
17103
  });
17050
- return result;
17104
+ allSelectedOptions.value = result;
17051
17105
  };
17052
- const onChange = () => emit("change", getOptions());
17053
17106
  const confirm = () => {
17054
17107
  const options = getOptions();
17055
17108
  emit("confirm", options);
@@ -17125,7 +17178,6 @@ var stdin_default$A = defineComponent({
17125
17178
  "class": bem$s("toolbar-checkbox"),
17126
17179
  "shape": "square",
17127
17180
  "modelValue": isAllSelected.value,
17128
- "onUpdate:modelValue": ($event) => isAllSelected.value = $event,
17129
17181
  "indeterminate": isIndeterminate.value,
17130
17182
  "onClick": handleSelectAll
17131
17183
  }, {
@@ -17134,33 +17186,74 @@ var stdin_default$A = defineComponent({
17134
17186
  "class": bem$s("toolbar-divider")
17135
17187
  }, null), createVNode("span", {
17136
17188
  "class": bem$s("toolbar-checkbox-text")
17137
- }, [createTextVNode("已选 "), confirmIndexes.value.length])]);
17189
+ }, [createTextVNode("已选 "), allSelectedOptions.value.length])]);
17138
17190
  const handleSelectAll = () => {
17139
- confirmIndexes.value = !isAllSelected.value ? currentOptions2.value.map((_, index2) => index2) : [];
17191
+ if (!isAllSelected.value) {
17192
+ if (props.filteredOptions && props.filteredOptions.length > 0) {
17193
+ const selectedIndexes = [];
17194
+ displayOptions.value.forEach((option2) => {
17195
+ const originalIndex = currentOptions2.value.findIndex((opt) => opt.value === option2.value);
17196
+ if (originalIndex >= 0) {
17197
+ selectedIndexes.push(originalIndex);
17198
+ }
17199
+ });
17200
+ confirmIndexes.value = selectedIndexes;
17201
+ } else {
17202
+ confirmIndexes.value = currentOptions2.value.map((_, index2) => index2);
17203
+ }
17204
+ } else {
17205
+ confirmIndexes.value = [];
17206
+ }
17207
+ updateAllSelectedOptions();
17140
17208
  };
17141
17209
  const onSelectOther = () => {
17142
- const temp = Array();
17143
- currentOptions2.value.forEach((_, index2) => {
17144
- if (!confirmIndexes.value.includes(index2)) {
17145
- temp.push(index2);
17146
- }
17147
- });
17148
- confirmIndexes.value = temp;
17210
+ if (props.filteredOptions && props.filteredOptions.length > 0) {
17211
+ const filteredValues = new Set(displayOptions.value.map((opt) => opt.value));
17212
+ const currentSelectedInFiltered = /* @__PURE__ */ new Set();
17213
+ confirmIndexes.value.forEach((idx) => {
17214
+ var _a;
17215
+ if (idx >= 0 && idx < currentOptions2.value.length) {
17216
+ const value = (_a = currentOptions2.value[idx]) == null ? void 0 : _a.value;
17217
+ if (filteredValues.has(value)) {
17218
+ currentSelectedInFiltered.add(idx);
17219
+ }
17220
+ }
17221
+ });
17222
+ const newSelectedIndexes = [];
17223
+ displayOptions.value.forEach((option2) => {
17224
+ const originalIndex = currentOptions2.value.findIndex((opt) => opt.value === option2.value);
17225
+ if (originalIndex >= 0) {
17226
+ if (!currentSelectedInFiltered.has(originalIndex)) {
17227
+ newSelectedIndexes.push(originalIndex);
17228
+ }
17229
+ }
17230
+ });
17231
+ confirmIndexes.value = newSelectedIndexes;
17232
+ } else {
17233
+ const temp = new Array();
17234
+ currentOptions2.value.forEach((_, index2) => {
17235
+ if (!confirmIndexes.value.includes(index2)) {
17236
+ temp.push(index2);
17237
+ }
17238
+ });
17239
+ confirmIndexes.value = temp;
17240
+ }
17241
+ updateAllSelectedOptions();
17149
17242
  };
17150
- const genOptionItems = computed(() => {
17243
+ const genOptionItems = () => {
17151
17244
  let formatOptions = [];
17152
- if (currentOptions2.value && currentOptions2.value[0] && typeof currentOptions2.value[0] !== "object") {
17153
- formatOptions = currentOptions2.value.map((v) => ({
17245
+ if (displayOptions.value && displayOptions.value[0] && typeof displayOptions.value[0] !== "object") {
17246
+ formatOptions = displayOptions.value.map((v) => ({
17154
17247
  value: v,
17155
17248
  text: v
17156
17249
  }));
17157
17250
  } else {
17158
- formatOptions = currentOptions2.value;
17251
+ formatOptions = displayOptions.value;
17159
17252
  }
17160
17253
  return createVNode(stdin_default$B, {
17161
17254
  "ref": pickerOptions,
17162
- "currentIndexes": confirmIndexes.value,
17163
- "onUpdate:currentIndexes": [($event) => confirmIndexes.value = $event, onUpdateCurrentIndexes],
17255
+ "currentIndexes": displaySelectedIndexes.value,
17256
+ "onUpdate:currentIndexes": [($event) => displaySelectedIndexes.value = $event, onUpdateCurrentIndexes],
17164
17257
  "columnCounts": props.columnCounts,
17165
17258
  "initialOptions": formatOptions,
17166
17259
  "allowHtml": props.allowHtml,
@@ -17171,10 +17264,10 @@ var stdin_default$A = defineComponent({
17171
17264
  }, {
17172
17265
  option: slots.option
17173
17266
  });
17174
- });
17267
+ };
17175
17268
  const genOptions2 = () => createVNode("div", {
17176
17269
  "class": bem$s("options")
17177
- }, [genOptionItems.value]);
17270
+ }, [genOptionItems()]);
17178
17271
  const renderMultiplePicker = () => createVNode("div", {
17179
17272
  "class": bem$s()
17180
17273
  }, [genTitle(), props.loading ? createVNode(stdin_default$1T, {
@@ -23267,7 +23360,7 @@ const Lazyload = {
23267
23360
  });
23268
23361
  }
23269
23362
  };
23270
- const version = "3.1.63";
23363
+ const version = "3.1.65";
23271
23364
  function install(app) {
23272
23365
  const components = [
23273
23366
  ActionSheet,