vant 4.0.0 → 4.0.1

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/README.md CHANGED
@@ -11,7 +11,7 @@
11
11
  <img src="https://img.shields.io/github/workflow/status/vant-ui/vant/CI/dev?style=flat-square" alt="CI Status" />
12
12
  <img src="https://img.shields.io/codecov/c/github/vant-ui/vant/dev.svg?style=flat-square&color=#4fc08d" alt="Coverage Status" />
13
13
  <img src="https://img.shields.io/npm/dm/vant.svg?style=flat-square&color=#4fc08d" alt="downloads" />
14
- <img src="https://img.badgesize.io/https://unpkg.com/vant@3/lib/vant.min.js?compression=gzip&style=flat-square&label=gzip%20size&color=#4fc08d" alt="Gzip Size" />
14
+ <img src="https://img.badgesize.io/https://unpkg.com/vant/lib/vant.min.js?compression=gzip&style=flat-square&label=gzip%20size&color=#4fc08d" alt="Gzip Size" />
15
15
  </p>
16
16
 
17
17
  <p align="center">
@@ -38,6 +38,7 @@
38
38
  - 🍭 Support Custom Theme
39
39
  - 🍭 Support Accessibility (still improving)
40
40
  - 🍭 Support Dark Mode
41
+ - 🍭 Support Nuxt 3
41
42
  - 🍭 Support SSR
42
43
  - 🌍 Support i18n, built-in 20+ languages
43
44
 
@@ -206,7 +206,9 @@ var stdin_default = defineComponent({
206
206
  selectionEnd
207
207
  } = inputRef.value;
208
208
  inputRef.value.value = value;
209
- inputRef.value.setSelectionRange(selectionStart, selectionEnd);
209
+ if (state.focused) {
210
+ inputRef.value.setSelectionRange(selectionStart, selectionEnd);
211
+ }
210
212
  }
211
213
  if (value !== props.modelValue) {
212
214
  emit("update:modelValue", value);
package/es/index.d.ts CHANGED
@@ -94,4 +94,4 @@ declare namespace _default {
94
94
  }
95
95
  export default _default;
96
96
  export function install(app: any): void;
97
- export const version: "4.0.0";
97
+ export const version: "4.0.1";
package/es/index.mjs CHANGED
@@ -87,7 +87,7 @@ import { TimePicker } from "./time-picker/index.mjs";
87
87
  import { Toast } from "./toast/index.mjs";
88
88
  import { TreeSelect } from "./tree-select/index.mjs";
89
89
  import { Uploader } from "./uploader/index.mjs";
90
- const version = "4.0.0";
90
+ const version = "4.0.1";
91
91
  function install(app) {
92
92
  const components = [
93
93
  ActionBar,
@@ -59,6 +59,7 @@ var stdin_default = defineComponent({
59
59
  });
60
60
  const hasOptions = computed(() => currentColumns.value.some((options) => options.length));
61
61
  const selectedOptions = computed(() => currentColumns.value.map((options, index) => findOptionByValue(options, selectedValues.value[index], fields.value)));
62
+ const selectedIndexes = computed(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
62
63
  const setValue = (index, value) => {
63
64
  if (selectedValues.value[index] !== value) {
64
65
  const newValues = selectedValues.value.slice(0);
@@ -68,7 +69,8 @@ var stdin_default = defineComponent({
68
69
  };
69
70
  const getEventParams = () => ({
70
71
  selectedValues: selectedValues.value.slice(0),
71
- selectedOptions: selectedOptions.value
72
+ selectedOptions: selectedOptions.value,
73
+ selectedIndexes: selectedIndexes.value
72
74
  });
73
75
  const onChange = (value, columnIndex) => {
74
76
  setValue(columnIndex, value);
@@ -37,6 +37,7 @@ export type PickerInstance = ComponentPublicInstance<PickerProps, PickerExpose>;
37
37
  export type PickerConfirmEventParams = {
38
38
  selectedValues: Numeric[];
39
39
  selectedOptions: Array<PickerOption | undefined>;
40
+ selectedIndexes: number[];
40
41
  };
41
42
  export type PickerCancelEventParams = PickerConfirmEventParams;
42
43
  export type PickerChangeEventParams = PickerConfirmEventParams & {
@@ -230,7 +230,9 @@ var stdin_default = (0, import_vue2.defineComponent)({
230
230
  selectionEnd
231
231
  } = inputRef.value;
232
232
  inputRef.value.value = value;
233
- inputRef.value.setSelectionRange(selectionStart, selectionEnd);
233
+ if (state.focused) {
234
+ inputRef.value.setSelectionRange(selectionStart, selectionEnd);
235
+ }
234
236
  }
235
237
  if (value !== props.modelValue) {
236
238
  emit("update:modelValue", value);
package/lib/index.d.ts CHANGED
@@ -94,4 +94,4 @@ declare namespace _default {
94
94
  }
95
95
  export default _default;
96
96
  export function install(app: any): void;
97
- export const version: "4.0.0";
97
+ export const version: "4.0.1";
package/lib/index.js CHANGED
@@ -202,7 +202,7 @@ __reExport(stdin_exports, require("./time-picker"), module.exports);
202
202
  __reExport(stdin_exports, require("./toast"), module.exports);
203
203
  __reExport(stdin_exports, require("./tree-select"), module.exports);
204
204
  __reExport(stdin_exports, require("./uploader"), module.exports);
205
- const version = "4.0.0";
205
+ const version = "4.0.1";
206
206
  function install(app) {
207
207
  const components = [
208
208
  import_action_bar.ActionBar,
@@ -89,6 +89,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
89
89
  });
90
90
  const hasOptions = (0, import_vue2.computed)(() => currentColumns.value.some((options) => options.length));
91
91
  const selectedOptions = (0, import_vue2.computed)(() => currentColumns.value.map((options, index) => (0, import_utils2.findOptionByValue)(options, selectedValues.value[index], fields.value)));
92
+ const selectedIndexes = (0, import_vue2.computed)(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
92
93
  const setValue = (index, value) => {
93
94
  if (selectedValues.value[index] !== value) {
94
95
  const newValues = selectedValues.value.slice(0);
@@ -98,7 +99,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
98
99
  };
99
100
  const getEventParams = () => ({
100
101
  selectedValues: selectedValues.value.slice(0),
101
- selectedOptions: selectedOptions.value
102
+ selectedOptions: selectedOptions.value,
103
+ selectedIndexes: selectedIndexes.value
102
104
  });
103
105
  const onChange = (value, columnIndex) => {
104
106
  setValue(columnIndex, value);
@@ -37,6 +37,7 @@ export type PickerInstance = ComponentPublicInstance<PickerProps, PickerExpose>;
37
37
  export type PickerConfirmEventParams = {
38
38
  selectedValues: Numeric[];
39
39
  selectedOptions: Array<PickerOption | undefined>;
40
+ selectedIndexes: number[];
40
41
  };
41
42
  export type PickerCancelEventParams = PickerConfirmEventParams;
42
43
  export type PickerChangeEventParams = PickerConfirmEventParams & {
package/lib/vant.cjs.js CHANGED
@@ -3151,6 +3151,7 @@ var stdin_default$1n = vue.defineComponent({
3151
3151
  });
3152
3152
  const hasOptions = vue.computed(() => currentColumns.value.some((options) => options.length));
3153
3153
  const selectedOptions = vue.computed(() => currentColumns.value.map((options, index) => findOptionByValue(options, selectedValues.value[index], fields.value)));
3154
+ const selectedIndexes = vue.computed(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
3154
3155
  const setValue = (index, value) => {
3155
3156
  if (selectedValues.value[index] !== value) {
3156
3157
  const newValues = selectedValues.value.slice(0);
@@ -3160,7 +3161,8 @@ var stdin_default$1n = vue.defineComponent({
3160
3161
  };
3161
3162
  const getEventParams = () => ({
3162
3163
  selectedValues: selectedValues.value.slice(0),
3163
- selectedOptions: selectedOptions.value
3164
+ selectedOptions: selectedOptions.value,
3165
+ selectedIndexes: selectedIndexes.value
3164
3166
  });
3165
3167
  const onChange = (value, columnIndex) => {
3166
3168
  setValue(columnIndex, value);
@@ -3988,7 +3990,9 @@ var stdin_default$1j = vue.defineComponent({
3988
3990
  selectionEnd
3989
3991
  } = inputRef.value;
3990
3992
  inputRef.value.value = value;
3991
- inputRef.value.setSelectionRange(selectionStart, selectionEnd);
3993
+ if (state.focused) {
3994
+ inputRef.value.setSelectionRange(selectionStart, selectionEnd);
3995
+ }
3992
3996
  }
3993
3997
  if (value !== props.modelValue) {
3994
3998
  emit("update:modelValue", value);
@@ -14817,7 +14821,7 @@ const Lazyload = {
14817
14821
  });
14818
14822
  }
14819
14823
  };
14820
- const version = "4.0.0";
14824
+ const version = "4.0.1";
14821
14825
  function install(app) {
14822
14826
  const components = [
14823
14827
  ActionBar,
package/lib/vant.es.js CHANGED
@@ -3149,6 +3149,7 @@ var stdin_default$1n = defineComponent({
3149
3149
  });
3150
3150
  const hasOptions = computed(() => currentColumns.value.some((options) => options.length));
3151
3151
  const selectedOptions = computed(() => currentColumns.value.map((options, index) => findOptionByValue(options, selectedValues.value[index], fields.value)));
3152
+ const selectedIndexes = computed(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
3152
3153
  const setValue = (index, value) => {
3153
3154
  if (selectedValues.value[index] !== value) {
3154
3155
  const newValues = selectedValues.value.slice(0);
@@ -3158,7 +3159,8 @@ var stdin_default$1n = defineComponent({
3158
3159
  };
3159
3160
  const getEventParams = () => ({
3160
3161
  selectedValues: selectedValues.value.slice(0),
3161
- selectedOptions: selectedOptions.value
3162
+ selectedOptions: selectedOptions.value,
3163
+ selectedIndexes: selectedIndexes.value
3162
3164
  });
3163
3165
  const onChange = (value, columnIndex) => {
3164
3166
  setValue(columnIndex, value);
@@ -3986,7 +3988,9 @@ var stdin_default$1j = defineComponent({
3986
3988
  selectionEnd
3987
3989
  } = inputRef.value;
3988
3990
  inputRef.value.value = value;
3989
- inputRef.value.setSelectionRange(selectionStart, selectionEnd);
3991
+ if (state.focused) {
3992
+ inputRef.value.setSelectionRange(selectionStart, selectionEnd);
3993
+ }
3990
3994
  }
3991
3995
  if (value !== props.modelValue) {
3992
3996
  emit("update:modelValue", value);
@@ -14815,7 +14819,7 @@ const Lazyload = {
14815
14819
  });
14816
14820
  }
14817
14821
  };
14818
- const version = "4.0.0";
14822
+ const version = "4.0.1";
14819
14823
  function install(app) {
14820
14824
  const components = [
14821
14825
  ActionBar,
package/lib/vant.js CHANGED
@@ -3509,6 +3509,7 @@
3509
3509
  });
3510
3510
  const hasOptions = vue.computed(() => currentColumns.value.some((options) => options.length));
3511
3511
  const selectedOptions = vue.computed(() => currentColumns.value.map((options, index) => findOptionByValue(options, selectedValues.value[index], fields.value)));
3512
+ const selectedIndexes = vue.computed(() => currentColumns.value.map((options, index) => options.findIndex((option) => option[fields.value.value] === selectedValues.value[index])));
3512
3513
  const setValue = (index, value) => {
3513
3514
  if (selectedValues.value[index] !== value) {
3514
3515
  const newValues = selectedValues.value.slice(0);
@@ -3518,7 +3519,8 @@
3518
3519
  };
3519
3520
  const getEventParams = () => ({
3520
3521
  selectedValues: selectedValues.value.slice(0),
3521
- selectedOptions: selectedOptions.value
3522
+ selectedOptions: selectedOptions.value,
3523
+ selectedIndexes: selectedIndexes.value
3522
3524
  });
3523
3525
  const onChange = (value, columnIndex) => {
3524
3526
  setValue(columnIndex, value);
@@ -4346,7 +4348,9 @@
4346
4348
  selectionEnd
4347
4349
  } = inputRef.value;
4348
4350
  inputRef.value.value = value;
4349
- inputRef.value.setSelectionRange(selectionStart, selectionEnd);
4351
+ if (state.focused) {
4352
+ inputRef.value.setSelectionRange(selectionStart, selectionEnd);
4353
+ }
4350
4354
  }
4351
4355
  if (value !== props.modelValue) {
4352
4356
  emit("update:modelValue", value);
@@ -16023,7 +16027,7 @@
16023
16027
  });
16024
16028
  }
16025
16029
  };
16026
- const version = "4.0.0";
16030
+ const version = "4.0.1";
16027
16031
  function install(app) {
16028
16032
  const components = [
16029
16033
  ActionBar,