vant 4.0.0-rc.4 → 4.0.0-rc.5

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.
Files changed (42) hide show
  1. package/changelog.generated.md +39 -27
  2. package/es/date-picker/DatePicker.mjs +4 -1
  3. package/es/date-picker/utils.d.ts +1 -0
  4. package/es/date-picker/utils.mjs +11 -0
  5. package/es/field/Field.mjs +3 -3
  6. package/es/field/index.css +1 -1
  7. package/es/field/types.d.ts +1 -1
  8. package/es/index.d.ts +1 -1
  9. package/es/index.mjs +1 -1
  10. package/es/loading/Loading.mjs +8 -4
  11. package/es/nav-bar/NavBar.d.ts +13 -0
  12. package/es/nav-bar/NavBar.mjs +4 -3
  13. package/es/nav-bar/index.d.ts +9 -0
  14. package/es/stepper/Stepper.d.ts +13 -0
  15. package/es/stepper/Stepper.mjs +4 -3
  16. package/es/stepper/index.d.ts +9 -0
  17. package/es/tabs/Tabs.mjs +44 -41
  18. package/es/time-picker/TimePicker.mjs +4 -3
  19. package/lib/date-picker/DatePicker.js +3 -0
  20. package/lib/date-picker/utils.d.ts +1 -0
  21. package/lib/date-picker/utils.js +11 -0
  22. package/lib/field/Field.js +3 -3
  23. package/lib/field/index.css +1 -1
  24. package/lib/field/types.d.ts +1 -1
  25. package/lib/index.css +1 -1
  26. package/lib/index.d.ts +1 -1
  27. package/lib/index.js +1 -1
  28. package/lib/loading/Loading.js +8 -4
  29. package/lib/nav-bar/NavBar.d.ts +13 -0
  30. package/lib/nav-bar/NavBar.js +4 -3
  31. package/lib/nav-bar/index.d.ts +9 -0
  32. package/lib/stepper/Stepper.d.ts +13 -0
  33. package/lib/stepper/Stepper.js +4 -3
  34. package/lib/stepper/index.d.ts +9 -0
  35. package/lib/tabs/Tabs.js +44 -41
  36. package/lib/time-picker/TimePicker.js +3 -2
  37. package/lib/vant.cjs.js +80 -57
  38. package/lib/vant.es.js +80 -57
  39. package/lib/vant.js +80 -57
  40. package/lib/vant.min.js +1 -1
  41. package/lib/web-types.json +336 -312
  42. package/package.json +2 -2
@@ -1,3 +1,41 @@
1
+ ### [v4.0.0-rc.5](https://github.com/vant-ui/vant/compare/v4.0.0-rc.4...v4.0.0-rc.5)
2
+
3
+ `2022-10-07`
4
+
5
+ **Bug Fixes**
6
+
7
+ - cli: duplicate vue in first dev [#11120](https://github.com/vant-ui/vant/issues/11120)
8
+ - DatePicker: format value when exceed max date [#11122](https://github.com/vant-ui/vant/issues/11122)
9
+ - Field: icon position when label align is top [#11112](https://github.com/vant-ui/vant/issues/11112)
10
+ - Tabs: incorrect nav scroll animation in some cases [#11116](https://github.com/vant-ui/vant/issues/11116)
11
+ - Tabs: scroll position when using nav-bottom slot [#11115](https://github.com/vant-ui/vant/issues/11115)
12
+
13
+ **Document**
14
+
15
+ - add faq of uni-app [#11114](https://github.com/vant-ui/vant/issues/11114)
16
+ - changelog: @vant/cli 5.0.1 [#11118](https://github.com/vant-ui/vant/issues/11118)
17
+ - changelog: vant@4.0.0-rc.4 [#11088](https://github.com/vant-ui/vant/issues/11088)
18
+ - Field: add label-align demo [#11121](https://github.com/vant-ui/vant/issues/11121)
19
+ - fix website redirect [#11097](https://github.com/vant-ui/vant/issues/11097)
20
+ - Navbar: update clickable description [#11110](https://github.com/vant-ui/vant/issues/11110)
21
+
22
+ **Feature**
23
+
24
+ - add label-position:top for field and form [#11102](https://github.com/vant-ui/vant/issues/11102)
25
+ - cli: bump jest v29 [#11117](https://github.com/vant-ui/vant/issues/11117)
26
+ - cli: using @vant/cli v5 in template [#11119](https://github.com/vant-ui/vant/issues/11119)
27
+ - Loading: add icon slot [#11109](https://github.com/vant-ui/vant/issues/11109)
28
+ - nav-bar: add clickable prop to nav-bar component [#11048](https://github.com/vant-ui/vant/issues/11048)
29
+ - Stepper: add auto-fixed prop [#11071](https://github.com/vant-ui/vant/issues/11071)
30
+
31
+ **perf**
32
+
33
+ - cli: code split documents [#11111](https://github.com/vant-ui/vant/issues/11111)
34
+
35
+ **release**
36
+
37
+ - @vant/cli 5.0.1 [843c16](https://github.com/vant-ui/vant/commit/843c167376eee77c763b705a18052ac2ac28692a)
38
+ - @vant/cli 5.0.2 [d49c1f](https://github.com/vant-ui/vant/commit/d49c1fb94aeb0167cba56092d29c63ad3c1c9358)
1
39
  ### [v4.0.0-rc.4](https://github.com/vant-ui/vant/compare/v4.0.0-rc.3...v4.0.0-rc.4)
2
40
 
3
41
  `2022-09-25`
@@ -29,31 +67,5 @@
29
67
  **release**
30
68
 
31
69
  - @vant/cli 5.0.0-beta.0 [#11082](https://github.com/vant-ui/vant/issues/11082)
70
+ - 4.0.0-rc.4 [6d2705](https://github.com/vant-ui/vant/commit/6d2705f578190d2af76419e50bb8dd2f4f084ed9)
32
71
  - vant@1.4.3 [#11076](https://github.com/vant-ui/vant/issues/11076)
33
- ### [v4.0.0-rc.3](https://github.com/vant-ui/vant/compare/v4.0.0-rc.2...v4.0.0-rc.3)
34
-
35
- `2022-09-12`
36
-
37
- **Document**
38
-
39
- - changelog: vant@4.0.0-rc.2 [#11029](https://github.com/vant-ui/vant/issues/11029)
40
- - fix missing z-index prop in document [#11031](https://github.com/vant-ui/vant/issues/11031)
41
-
42
- **Feature**
43
-
44
- - add themeVars type of all components [#11034](https://github.com/vant-ui/vant/issues/11034)
45
- - Notify: add z-index prop [#11032](https://github.com/vant-ui/vant/issues/11032)
46
-
47
- **perf**
48
-
49
- - remove popperjs to reduce install size [#11030](https://github.com/vant-ui/vant/issues/11030)
50
-
51
- **release**
52
-
53
- - @vant/popperjs 1.3.0 [16c1f3](https://github.com/vant-ui/vant/commit/16c1f35135d93090ad7b129a73a0569203c3825d)
54
- - 4.0.0-rc.3 [5509ca](https://github.com/vant-ui/vant/commit/5509ca0d1dec6a819df69295dda2d7b59fbd3328)
55
-
56
- **Types**
57
-
58
- - some theme vars can be number type [#11037](https://github.com/vant-ui/vant/issues/11037)
59
- - Toast: fix missing global components type [#11033](https://github.com/vant-ui/vant/issues/11033)
@@ -1,7 +1,7 @@
1
1
  import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
2
2
  import { ref, watch, computed, defineComponent } from "vue";
3
3
  import { pick, extend, isDate, isSameValue, createNamespace } from "../utils/index.mjs";
4
- import { genOptions, sharedProps, getMonthEndDay, pickerInheritKeys } from "./utils.mjs";
4
+ import { genOptions, sharedProps, getMonthEndDay, pickerInheritKeys, formatValueRange } from "./utils.mjs";
5
5
  import { Picker } from "../picker/index.mjs";
6
6
  const currentYear = new Date().getFullYear();
7
7
  const [name] = createNamespace("date-picker");
@@ -89,9 +89,12 @@ var stdin_default = defineComponent({
89
89
  }
90
90
  });
91
91
  watch(() => props.modelValue, (newValues) => {
92
+ newValues = formatValueRange(newValues, columns.value);
92
93
  if (!isSameValue(newValues, currentValues.value)) {
93
94
  currentValues.value = newValues;
94
95
  }
96
+ }, {
97
+ immediate: true
95
98
  });
96
99
  const onChange = (...args) => emit("change", ...args);
97
100
  const onCancel = (...args) => emit("cancel", ...args);
@@ -41,4 +41,5 @@ export declare const pickerInheritKeys: ("title" | "readonly" | "loading" | "all
41
41
  export declare function times<T>(n: number, iteratee: (index: number) => T): T[];
42
42
  export declare const getMonthEndDay: (year: number, month: number) => number;
43
43
  export declare const genOptions: <T extends string>(min: number, max: number, type: T, formatter: Formatter, filter?: Filter) => PickerOption[];
44
+ export declare const formatValueRange: (values: string[], columns: PickerOption[]) => string[];
44
45
  export {};
@@ -31,7 +31,18 @@ const genOptions = (min, max, type, formatter, filter) => {
31
31
  });
32
32
  return filter ? filter(type, options) : options;
33
33
  };
34
+ const formatValueRange = (values, columns) => values.map((value, index) => {
35
+ const column = columns[index];
36
+ if (column.length) {
37
+ const maxValue = +column[column.length - 1].value;
38
+ if (+value > maxValue) {
39
+ return String(maxValue);
40
+ }
41
+ }
42
+ return value;
43
+ });
34
44
  export {
45
+ formatValueRange,
35
46
  genOptions,
36
47
  getMonthEndDay,
37
48
  pickerInheritKeys,
@@ -427,9 +427,9 @@ var stdin_default = defineComponent({
427
427
  const labelAlign = getProp("labelAlign");
428
428
  const Label = renderLabel();
429
429
  const LeftIcon = renderLeftIcon();
430
+ const renderTitle = () => labelAlign === "top" ? [LeftIcon, Label] : Label;
430
431
  return _createVNode(Cell, {
431
432
  "size": props.size,
432
- "icon": props.leftIcon,
433
433
  "class": bem({
434
434
  error: showError.value,
435
435
  disabled,
@@ -446,8 +446,8 @@ var stdin_default = defineComponent({
446
446
  }]), props.labelClass],
447
447
  "arrowDirection": props.arrowDirection
448
448
  }, {
449
- icon: LeftIcon ? () => LeftIcon : null,
450
- title: Label ? () => Label : null,
449
+ icon: LeftIcon && labelAlign !== "top" ? () => LeftIcon : null,
450
+ title: Label || labelAlign === "top" ? renderTitle : null,
451
451
  value: renderFieldBody,
452
452
  extra: slots.extra
453
453
  });
@@ -1 +1 @@
1
- :root{--van-field-label-width: 6.2em;--van-field-label-color: var(--van-text-color);--van-field-label-margin-right: var(--van-padding-sm);--van-field-input-text-color: var(--van-text-color);--van-field-input-error-text-color: var(--van-danger-color);--van-field-input-disabled-text-color: var(--van-text-color-3);--van-field-placeholder-text-color: var(--van-text-color-3);--van-field-icon-size: 16px;--van-field-clear-icon-size: 16px;--van-field-clear-icon-color: var(--van-gray-5);--van-field-right-icon-color: var(--van-gray-6);--van-field-error-message-color: var(--van-danger-color);--van-field-error-message-font-size: 12px;--van-field-text-area-min-height: 60px;--van-field-word-limit-color: var(--van-gray-7);--van-field-word-limit-font-size: var(--van-font-size-sm);--van-field-word-limit-line-height: 16px;--van-field-disabled-text-color: var(--van-text-color-3);--van-field-required-mark-color: var(--van-red)}.van-field__label{flex:none;box-sizing:border-box;width:var(--van-field-label-width);margin-right:var(--van-field-label-margin-right);color:var(--van-field-label-color);text-align:left;word-wrap:break-word}.van-field__label--center{text-align:center}.van-field__label--right{text-align:right}.van-field__label--required:before{margin-right:2px;color:var(--van-field-required-mark-color);content:"*"}.van-field--disabled .van-field__label{color:var(--van-field-disabled-text-color)}.van-field__value{overflow:visible}.van-field__body{display:flex;align-items:center}.van-field__control{display:block;box-sizing:border-box;width:100%;min-width:0;margin:0;padding:0;color:var(--van-field-input-text-color);line-height:inherit;text-align:left;background-color:transparent;border:0;resize:none;-webkit-user-select:auto;user-select:auto}.van-field__control::-webkit-input-placeholder{color:var(--van-field-placeholder-text-color)}.van-field__control::placeholder{color:var(--van-field-placeholder-text-color)}.van-field__control:disabled{color:var(--van-field-input-disabled-text-color);cursor:not-allowed;opacity:1;-webkit-text-fill-color:var(--van-field-input-disabled-text-color)}.van-field__control:read-only{cursor:default}.van-field__control--center{justify-content:center;text-align:center}.van-field__control--right{justify-content:flex-end;text-align:right}.van-field__control--custom{display:flex;align-items:center;min-height:var(--van-cell-line-height)}.van-field__control--error::-webkit-input-placeholder{color:var(--van-field-input-error-text-color);-webkit-text-fill-color:currentColor}.van-field__control--error,.van-field__control--error::placeholder{color:var(--van-field-input-error-text-color);-webkit-text-fill-color:currentColor}.van-field__control--min-height{min-height:var(--van-field-text-area-min-height)}.van-field__control[type=date],.van-field__control[type=time],.van-field__control[type=datetime-local]{min-height:var(--van-cell-line-height)}.van-field__control[type=search]{-webkit-appearance:none}.van-field__clear,.van-field__icon,.van-field__button,.van-field__right-icon{flex-shrink:0}.van-field__clear,.van-field__right-icon{margin-right:calc(var(--van-padding-xs) * -1);padding:0 var(--van-padding-xs);line-height:inherit}.van-field__clear{color:var(--van-field-clear-icon-color);font-size:var(--van-field-clear-icon-size);cursor:pointer}.van-field__left-icon .van-icon,.van-field__right-icon .van-icon{display:block;font-size:var(--van-field-icon-size);line-height:inherit}.van-field__left-icon{margin-right:var(--van-padding-base)}.van-field__right-icon{color:var(--van-field-right-icon-color)}.van-field__button{padding-left:var(--van-padding-xs)}.van-field__error-message{color:var(--van-field-error-message-color);font-size:var(--van-field-error-message-font-size);text-align:left}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}.van-field__word-limit{margin-top:var(--van-padding-base);color:var(--van-field-word-limit-color);font-size:var(--van-field-word-limit-font-size);line-height:var(--van-field-word-limit-line-height);text-align:right}
1
+ :root{--van-field-label-width: 6.2em;--van-field-label-color: var(--van-text-color);--van-field-label-margin-right: var(--van-padding-sm);--van-field-input-text-color: var(--van-text-color);--van-field-input-error-text-color: var(--van-danger-color);--van-field-input-disabled-text-color: var(--van-text-color-3);--van-field-placeholder-text-color: var(--van-text-color-3);--van-field-icon-size: 16px;--van-field-clear-icon-size: 16px;--van-field-clear-icon-color: var(--van-gray-5);--van-field-right-icon-color: var(--van-gray-6);--van-field-error-message-color: var(--van-danger-color);--van-field-error-message-font-size: 12px;--van-field-text-area-min-height: 60px;--van-field-word-limit-color: var(--van-gray-7);--van-field-word-limit-font-size: var(--van-font-size-sm);--van-field-word-limit-line-height: 16px;--van-field-disabled-text-color: var(--van-text-color-3);--van-field-required-mark-color: var(--van-red)}.van-field{flex-wrap:wrap}.van-field__label{flex:none;box-sizing:border-box;width:var(--van-field-label-width);margin-right:var(--van-field-label-margin-right);color:var(--van-field-label-color);text-align:left;word-wrap:break-word}.van-field__label--center{text-align:center}.van-field__label--right{text-align:right}.van-field__label--top{display:flex;width:100%;text-align:left;margin-bottom:var(--van-padding-base)}.van-field__label--required:before{margin-right:2px;color:var(--van-field-required-mark-color);content:"*"}.van-field--disabled .van-field__label{color:var(--van-field-disabled-text-color)}.van-field__value{overflow:visible}.van-field__body{display:flex;align-items:center}.van-field__control{display:block;box-sizing:border-box;width:100%;min-width:0;margin:0;padding:0;color:var(--van-field-input-text-color);line-height:inherit;text-align:left;background-color:transparent;border:0;resize:none;-webkit-user-select:auto;user-select:auto}.van-field__control::-webkit-input-placeholder{color:var(--van-field-placeholder-text-color)}.van-field__control::placeholder{color:var(--van-field-placeholder-text-color)}.van-field__control:disabled{color:var(--van-field-input-disabled-text-color);cursor:not-allowed;opacity:1;-webkit-text-fill-color:var(--van-field-input-disabled-text-color)}.van-field__control:read-only{cursor:default}.van-field__control--center{justify-content:center;text-align:center}.van-field__control--right{justify-content:flex-end;text-align:right}.van-field__control--custom{display:flex;align-items:center;min-height:var(--van-cell-line-height)}.van-field__control--error::-webkit-input-placeholder{color:var(--van-field-input-error-text-color);-webkit-text-fill-color:currentColor}.van-field__control--error,.van-field__control--error::placeholder{color:var(--van-field-input-error-text-color);-webkit-text-fill-color:currentColor}.van-field__control--min-height{min-height:var(--van-field-text-area-min-height)}.van-field__control[type=date],.van-field__control[type=time],.van-field__control[type=datetime-local]{min-height:var(--van-cell-line-height)}.van-field__control[type=search]{-webkit-appearance:none}.van-field__clear,.van-field__icon,.van-field__button,.van-field__right-icon{flex-shrink:0}.van-field__clear,.van-field__right-icon{margin-right:calc(var(--van-padding-xs) * -1);padding:0 var(--van-padding-xs);line-height:inherit}.van-field__clear{color:var(--van-field-clear-icon-color);font-size:var(--van-field-clear-icon-size);cursor:pointer}.van-field__left-icon .van-icon,.van-field__right-icon .van-icon{display:block;font-size:var(--van-field-icon-size);line-height:inherit}.van-field__left-icon{margin-right:var(--van-padding-base)}.van-field__right-icon{color:var(--van-field-right-icon-color)}.van-field__button{padding-left:var(--van-padding-xs)}.van-field__error-message{color:var(--van-field-error-message-color);font-size:var(--van-field-error-message-font-size);text-align:left}.van-field__error-message--center{text-align:center}.van-field__error-message--right{text-align:right}.van-field__word-limit{margin-top:var(--van-padding-base);color:var(--van-field-word-limit-color);font-size:var(--van-field-word-limit-font-size);line-height:var(--van-field-word-limit-line-height);text-align:right}
@@ -1,7 +1,7 @@
1
1
  import type { ComputedRef, ComponentPublicInstance } from 'vue';
2
2
  import type { FieldProps } from './Field';
3
3
  export declare type FieldType = 'tel' | 'url' | 'date' | 'file' | 'text' | 'time' | 'week' | 'color' | 'digit' | 'email' | 'image' | 'month' | 'radio' | 'range' | 'reset' | 'button' | 'hidden' | 'number' | 'search' | 'submit' | 'checkbox' | 'password' | 'textarea' | 'datetime-local';
4
- export declare type FieldTextAlign = 'left' | 'center' | 'right';
4
+ export declare type FieldTextAlign = 'left' | 'center' | 'right' | 'top';
5
5
  export declare type FieldClearTrigger = 'always' | 'focus';
6
6
  export declare type FieldFormatTrigger = 'onBlur' | 'onChange';
7
7
  export declare type FieldValidateTrigger = 'onBlur' | 'onChange' | 'onSubmit';
package/es/index.d.ts CHANGED
@@ -93,4 +93,4 @@ declare namespace _default {
93
93
  }
94
94
  export default _default;
95
95
  export function install(app: any): void;
96
- export const version: "4.0.0-rc.4";
96
+ export const version: "4.0.0-rc.5";
package/es/index.mjs CHANGED
@@ -86,7 +86,7 @@ import { TimePicker } from "./time-picker/index.mjs";
86
86
  import { Toast } from "./toast/index.mjs";
87
87
  import { TreeSelect } from "./tree-select/index.mjs";
88
88
  import { Uploader } from "./uploader/index.mjs";
89
- const version = "4.0.0-rc.4";
89
+ const version = "4.0.0-rc.5";
90
90
  function install(app) {
91
91
  const components = [
92
92
  ActionBar,
@@ -31,6 +31,13 @@ var stdin_default = defineComponent({
31
31
  const spinnerStyle = computed(() => extend({
32
32
  color: props.color
33
33
  }, getSizeStyle(props.size)));
34
+ const renderIcon = () => {
35
+ const DefaultIcon = props.type === "spinner" ? SpinIcon : CircularIcon;
36
+ return _createVNode("span", {
37
+ "class": bem("spinner", props.type),
38
+ "style": spinnerStyle.value
39
+ }, [slots.icon ? slots.icon() : DefaultIcon]);
40
+ };
34
41
  const renderText = () => {
35
42
  var _a;
36
43
  if (slots.default) {
@@ -54,10 +61,7 @@ var stdin_default = defineComponent({
54
61
  }]),
55
62
  "aria-live": "polite",
56
63
  "aria-busy": true
57
- }, [_createVNode("span", {
58
- "class": bem("spinner", type),
59
- "style": spinnerStyle.value
60
- }, [type === "spinner" ? SpinIcon : CircularIcon]), renderText()]);
64
+ }, [renderIcon(), renderText()]);
61
65
  };
62
66
  }
63
67
  });
@@ -12,6 +12,10 @@ export declare const navBarProps: {
12
12
  leftArrow: BooleanConstructor;
13
13
  placeholder: BooleanConstructor;
14
14
  safeAreaInsetTop: BooleanConstructor;
15
+ clickable: {
16
+ type: BooleanConstructor;
17
+ default: true;
18
+ };
15
19
  };
16
20
  export declare type NavBarProps = ExtractPropTypes<typeof navBarProps>;
17
21
  declare const _default: import("vue").DefineComponent<{
@@ -27,6 +31,10 @@ declare const _default: import("vue").DefineComponent<{
27
31
  leftArrow: BooleanConstructor;
28
32
  placeholder: BooleanConstructor;
29
33
  safeAreaInsetTop: BooleanConstructor;
34
+ clickable: {
35
+ type: BooleanConstructor;
36
+ default: true;
37
+ };
30
38
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("clickLeft" | "clickRight")[], "clickLeft" | "clickRight", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
31
39
  title: StringConstructor;
32
40
  fixed: BooleanConstructor;
@@ -40,12 +48,17 @@ declare const _default: import("vue").DefineComponent<{
40
48
  leftArrow: BooleanConstructor;
41
49
  placeholder: BooleanConstructor;
42
50
  safeAreaInsetTop: BooleanConstructor;
51
+ clickable: {
52
+ type: BooleanConstructor;
53
+ default: true;
54
+ };
43
55
  }>> & {
44
56
  onClickLeft?: ((...args: any[]) => any) | undefined;
45
57
  onClickRight?: ((...args: any[]) => any) | undefined;
46
58
  }, {
47
59
  fixed: boolean;
48
60
  border: boolean;
61
+ clickable: boolean;
49
62
  placeholder: boolean;
50
63
  safeAreaInsetTop: boolean;
51
64
  leftArrow: boolean;
@@ -13,7 +13,8 @@ const navBarProps = {
13
13
  rightText: String,
14
14
  leftArrow: Boolean,
15
15
  placeholder: Boolean,
16
- safeAreaInsetTop: Boolean
16
+ safeAreaInsetTop: Boolean,
17
+ clickable: truthProp
17
18
  };
18
19
  var stdin_default = defineComponent({
19
20
  name,
@@ -68,12 +69,12 @@ var stdin_default = defineComponent({
68
69
  }, [_createVNode("div", {
69
70
  "class": bem("content")
70
71
  }, [hasLeft && _createVNode("div", {
71
- "class": [bem("left"), HAPTICS_FEEDBACK],
72
+ "class": [bem("left"), props.clickable ? HAPTICS_FEEDBACK : ""],
72
73
  "onClick": onClickLeft
73
74
  }, [renderLeft()]), _createVNode("div", {
74
75
  "class": [bem("title"), "van-ellipsis"]
75
76
  }, [slots.title ? slots.title() : title]), hasRight && _createVNode("div", {
76
- "class": [bem("right"), HAPTICS_FEEDBACK],
77
+ "class": [bem("right"), props.clickable ? HAPTICS_FEEDBACK : ""],
77
78
  "onClick": onClickRight
78
79
  }, [renderRight()])])]);
79
80
  };
@@ -11,6 +11,10 @@ export declare const NavBar: import("../utils").WithInstall<import("vue").Define
11
11
  leftArrow: BooleanConstructor;
12
12
  placeholder: BooleanConstructor;
13
13
  safeAreaInsetTop: BooleanConstructor;
14
+ clickable: {
15
+ type: BooleanConstructor;
16
+ default: true;
17
+ };
14
18
  }, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("clickLeft" | "clickRight")[], "clickLeft" | "clickRight", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
15
19
  title: StringConstructor;
16
20
  fixed: BooleanConstructor;
@@ -24,12 +28,17 @@ export declare const NavBar: import("../utils").WithInstall<import("vue").Define
24
28
  leftArrow: BooleanConstructor;
25
29
  placeholder: BooleanConstructor;
26
30
  safeAreaInsetTop: BooleanConstructor;
31
+ clickable: {
32
+ type: BooleanConstructor;
33
+ default: true;
34
+ };
27
35
  }>> & {
28
36
  onClickLeft?: ((...args: any[]) => any) | undefined;
29
37
  onClickRight?: ((...args: any[]) => any) | undefined;
30
38
  }, {
31
39
  fixed: boolean;
32
40
  border: boolean;
41
+ clickable: boolean;
33
42
  placeholder: boolean;
34
43
  safeAreaInsetTop: boolean;
35
44
  leftArrow: boolean;
@@ -37,6 +37,10 @@ export declare const stepperProps: {
37
37
  type: BooleanConstructor;
38
38
  default: true;
39
39
  };
40
+ autoFixed: {
41
+ type: BooleanConstructor;
42
+ default: true;
43
+ };
40
44
  allowEmpty: BooleanConstructor;
41
45
  modelValue: (NumberConstructor | StringConstructor)[];
42
46
  inputWidth: (NumberConstructor | StringConstructor)[];
@@ -89,6 +93,10 @@ declare const _default: import("vue").DefineComponent<{
89
93
  type: BooleanConstructor;
90
94
  default: true;
91
95
  };
96
+ autoFixed: {
97
+ type: BooleanConstructor;
98
+ default: true;
99
+ };
92
100
  allowEmpty: BooleanConstructor;
93
101
  modelValue: (NumberConstructor | StringConstructor)[];
94
102
  inputWidth: (NumberConstructor | StringConstructor)[];
@@ -139,6 +147,10 @@ declare const _default: import("vue").DefineComponent<{
139
147
  type: BooleanConstructor;
140
148
  default: true;
141
149
  };
150
+ autoFixed: {
151
+ type: BooleanConstructor;
152
+ default: true;
153
+ };
142
154
  allowEmpty: BooleanConstructor;
143
155
  modelValue: (NumberConstructor | StringConstructor)[];
144
156
  inputWidth: (NumberConstructor | StringConstructor)[];
@@ -172,6 +184,7 @@ declare const _default: import("vue").DefineComponent<{
172
184
  showMinus: boolean;
173
185
  showInput: boolean;
174
186
  longPress: boolean;
187
+ autoFixed: boolean;
175
188
  allowEmpty: boolean;
176
189
  disablePlus: boolean;
177
190
  disableMinus: boolean;
@@ -18,6 +18,7 @@ const stepperProps = {
18
18
  showMinus: truthProp,
19
19
  showInput: truthProp,
20
20
  longPress: truthProp,
21
+ autoFixed: truthProp,
21
22
  allowEmpty: Boolean,
22
23
  modelValue: numericProp,
23
24
  inputWidth: numericProp,
@@ -37,7 +38,7 @@ var stdin_default = defineComponent({
37
38
  setup(props, {
38
39
  emit
39
40
  }) {
40
- const format = (value) => {
41
+ const format = (value, autoFixed = true) => {
41
42
  const {
42
43
  min,
43
44
  max,
@@ -50,7 +51,7 @@ var stdin_default = defineComponent({
50
51
  value = formatNumber(String(value), !props.integer);
51
52
  value = value === "" ? 0 : +value;
52
53
  value = Number.isNaN(value) ? +min : value;
53
- value = Math.max(Math.min(+max, value), +min);
54
+ value = autoFixed ? Math.max(Math.min(+max, value), +min) : value;
54
55
  if (isDef(decimalLength)) {
55
56
  value = value.toFixed(+decimalLength);
56
57
  }
@@ -134,7 +135,7 @@ var stdin_default = defineComponent({
134
135
  };
135
136
  const onBlur = (event) => {
136
137
  const input = event.target;
137
- const value = format(input.value);
138
+ const value = format(input.value, props.autoFixed);
138
139
  input.value = String(value);
139
140
  current.value = value;
140
141
  nextTick(() => {
@@ -34,6 +34,10 @@ export declare const Stepper: import("../utils").WithInstall<import("vue").Defin
34
34
  type: BooleanConstructor;
35
35
  default: true;
36
36
  };
37
+ autoFixed: {
38
+ type: BooleanConstructor;
39
+ default: true;
40
+ };
37
41
  allowEmpty: BooleanConstructor;
38
42
  modelValue: (NumberConstructor | StringConstructor)[];
39
43
  inputWidth: (NumberConstructor | StringConstructor)[];
@@ -84,6 +88,10 @@ export declare const Stepper: import("../utils").WithInstall<import("vue").Defin
84
88
  type: BooleanConstructor;
85
89
  default: true;
86
90
  };
91
+ autoFixed: {
92
+ type: BooleanConstructor;
93
+ default: true;
94
+ };
87
95
  allowEmpty: BooleanConstructor;
88
96
  modelValue: (NumberConstructor | StringConstructor)[];
89
97
  inputWidth: (NumberConstructor | StringConstructor)[];
@@ -117,6 +125,7 @@ export declare const Stepper: import("../utils").WithInstall<import("vue").Defin
117
125
  showMinus: boolean;
118
126
  showInput: boolean;
119
127
  longPress: boolean;
128
+ autoFixed: boolean;
120
129
  allowEmpty: boolean;
121
130
  disablePlus: boolean;
122
131
  disableMinus: boolean;
package/es/tabs/Tabs.mjs CHANGED
@@ -141,17 +141,19 @@ var stdin_default = defineComponent({
141
141
  const newTab = children[newIndex];
142
142
  const newName = getTabName(newTab, newIndex);
143
143
  const shouldEmitChange = state.currentIndex !== null;
144
- state.currentIndex = newIndex;
144
+ if (state.currentIndex !== newIndex) {
145
+ state.currentIndex = newIndex;
146
+ if (!skipScrollIntoView) {
147
+ scrollIntoView();
148
+ }
149
+ setLine();
150
+ }
145
151
  if (newName !== props.active) {
146
152
  emit("update:active", newName);
147
153
  if (shouldEmitChange) {
148
154
  emit("change", newName, newTab.title);
149
155
  }
150
156
  }
151
- if (!skipScrollIntoView) {
152
- scrollIntoView();
153
- }
154
- setLine();
155
157
  if (stickyFixed && !props.scrollspy) {
156
158
  setRootScrollTop(Math.ceil(getElementTop(root.value) - offsetTopPx.value));
157
159
  }
@@ -250,13 +252,14 @@ var stdin_default = defineComponent({
250
252
  }
251
253
  };
252
254
  const renderHeader = () => {
253
- var _a, _b;
255
+ var _a, _b, _c;
254
256
  const {
255
257
  type,
256
- border
258
+ border,
259
+ sticky
257
260
  } = props;
258
- return _createVNode("div", {
259
- "ref": wrapRef,
261
+ const Header = [_createVNode("div", {
262
+ "ref": sticky ? void 0 : wrapRef,
260
263
  "class": [bem("wrap"), {
261
264
  [BORDER_TOP_BOTTOM]: type === "line" && border
262
265
  }]
@@ -269,7 +272,13 @@ var stdin_default = defineComponent({
269
272
  }]),
270
273
  "style": navStyle.value,
271
274
  "aria-orientation": "horizontal"
272
- }, [(_a = slots["nav-left"]) == null ? void 0 : _a.call(slots), renderNav(), renderLine(), (_b = slots["nav-right"]) == null ? void 0 : _b.call(slots)])]);
275
+ }, [(_a = slots["nav-left"]) == null ? void 0 : _a.call(slots), renderNav(), renderLine(), (_b = slots["nav-right"]) == null ? void 0 : _b.call(slots)])]), (_c = slots["nav-bottom"]) == null ? void 0 : _c.call(slots)];
276
+ if (sticky) {
277
+ return _createVNode("div", {
278
+ "ref": wrapRef
279
+ }, [Header]);
280
+ }
281
+ return Header;
273
282
  };
274
283
  watch([() => props.color, windowWidth], setLine);
275
284
  watch(() => props.active, (value) => {
@@ -323,37 +332,31 @@ var stdin_default = defineComponent({
323
332
  currentName,
324
333
  scrollIntoView
325
334
  });
326
- return () => {
327
- var _a;
328
- return _createVNode("div", {
329
- "ref": root,
330
- "class": bem([props.type])
331
- }, [props.sticky ? _createVNode(Sticky, {
332
- "container": root.value,
333
- "offsetTop": offsetTopPx.value,
334
- "onScroll": onStickyScroll
335
- }, {
336
- default: () => {
337
- var _a2;
338
- return [renderHeader(), (_a2 = slots["nav-bottom"]) == null ? void 0 : _a2.call(slots)];
339
- }
340
- }) : [renderHeader(), (_a = slots["nav-bottom"]) == null ? void 0 : _a.call(slots)], _createVNode(TabsContent, {
341
- "ref": contentRef,
342
- "count": children.length,
343
- "inited": state.inited,
344
- "animated": props.animated,
345
- "duration": props.duration,
346
- "swipeable": props.swipeable,
347
- "lazyRender": props.lazyRender,
348
- "currentIndex": state.currentIndex,
349
- "onChange": setCurrentIndex
350
- }, {
351
- default: () => {
352
- var _a2;
353
- return [(_a2 = slots.default) == null ? void 0 : _a2.call(slots)];
354
- }
355
- })]);
356
- };
335
+ return () => _createVNode("div", {
336
+ "ref": root,
337
+ "class": bem([props.type])
338
+ }, [props.sticky ? _createVNode(Sticky, {
339
+ "container": root.value,
340
+ "offsetTop": offsetTopPx.value,
341
+ "onScroll": onStickyScroll
342
+ }, {
343
+ default: () => [renderHeader()]
344
+ }) : renderHeader(), _createVNode(TabsContent, {
345
+ "ref": contentRef,
346
+ "count": children.length,
347
+ "inited": state.inited,
348
+ "animated": props.animated,
349
+ "duration": props.duration,
350
+ "swipeable": props.swipeable,
351
+ "lazyRender": props.lazyRender,
352
+ "currentIndex": state.currentIndex,
353
+ "onChange": setCurrentIndex
354
+ }, {
355
+ default: () => {
356
+ var _a;
357
+ return [(_a = slots.default) == null ? void 0 : _a.call(slots)];
358
+ }
359
+ })]);
357
360
  }
358
361
  });
359
362
  export {
@@ -1,7 +1,7 @@
1
1
  import { createVNode as _createVNode, mergeProps as _mergeProps } from "vue";
2
2
  import { ref, watch, computed, defineComponent } from "vue";
3
3
  import { pick, extend, createNamespace, makeNumericProp, isSameValue } from "../utils/index.mjs";
4
- import { genOptions, sharedProps, pickerInheritKeys } from "../date-picker/utils.mjs";
4
+ import { genOptions, sharedProps, pickerInheritKeys, formatValueRange } from "../date-picker/utils.mjs";
5
5
  import { Picker } from "../picker/index.mjs";
6
6
  const [name] = createNamespace("time-picker");
7
7
  const timePickerProps = extend({}, sharedProps, {
@@ -45,13 +45,14 @@ var stdin_default = defineComponent({
45
45
  if (!isSameValue(newValues, props.modelValue)) {
46
46
  emit("update:modelValue", newValues);
47
47
  }
48
- }, {
49
- immediate: true
50
48
  });
51
49
  watch(() => props.modelValue, (newValues) => {
50
+ newValues = formatValueRange(newValues, columns.value);
52
51
  if (!isSameValue(newValues, currentValues.value)) {
53
52
  currentValues.value = newValues;
54
53
  }
54
+ }, {
55
+ immediate: true
55
56
  });
56
57
  const onChange = (...args) => emit("change", ...args);
57
58
  const onCancel = (...args) => emit("cancel", ...args);
@@ -112,9 +112,12 @@ var stdin_default = (0, import_vue2.defineComponent)({
112
112
  }
113
113
  });
114
114
  (0, import_vue2.watch)(() => props.modelValue, (newValues) => {
115
+ newValues = (0, import_utils2.formatValueRange)(newValues, columns.value);
115
116
  if (!(0, import_utils.isSameValue)(newValues, currentValues.value)) {
116
117
  currentValues.value = newValues;
117
118
  }
119
+ }, {
120
+ immediate: true
118
121
  });
119
122
  const onChange = (...args) => emit("change", ...args);
120
123
  const onCancel = (...args) => emit("cancel", ...args);
@@ -41,4 +41,5 @@ export declare const pickerInheritKeys: ("title" | "readonly" | "loading" | "all
41
41
  export declare function times<T>(n: number, iteratee: (index: number) => T): T[];
42
42
  export declare const getMonthEndDay: (year: number, month: number) => number;
43
43
  export declare const genOptions: <T extends string>(min: number, max: number, type: T, formatter: Formatter, filter?: Filter) => PickerOption[];
44
+ export declare const formatValueRange: (values: string[], columns: PickerOption[]) => string[];
44
45
  export {};
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
  var stdin_exports = {};
19
19
  __export(stdin_exports, {
20
+ formatValueRange: () => formatValueRange,
20
21
  genOptions: () => genOptions,
21
22
  getMonthEndDay: () => getMonthEndDay,
22
23
  pickerInheritKeys: () => pickerInheritKeys,
@@ -57,3 +58,13 @@ const genOptions = (min, max, type, formatter, filter) => {
57
58
  });
58
59
  return filter ? filter(type, options) : options;
59
60
  };
61
+ const formatValueRange = (values, columns) => values.map((value, index) => {
62
+ const column = columns[index];
63
+ if (column.length) {
64
+ const maxValue = +column[column.length - 1].value;
65
+ if (+value > maxValue) {
66
+ return String(maxValue);
67
+ }
68
+ }
69
+ return value;
70
+ });
@@ -451,9 +451,9 @@ var stdin_default = (0, import_vue2.defineComponent)({
451
451
  const labelAlign = getProp("labelAlign");
452
452
  const Label = renderLabel();
453
453
  const LeftIcon = renderLeftIcon();
454
+ const renderTitle = () => labelAlign === "top" ? [LeftIcon, Label] : Label;
454
455
  return (0, import_vue.createVNode)(import_cell.Cell, {
455
456
  "size": props.size,
456
- "icon": props.leftIcon,
457
457
  "class": bem({
458
458
  error: showError.value,
459
459
  disabled,
@@ -470,8 +470,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
470
470
  }]), props.labelClass],
471
471
  "arrowDirection": props.arrowDirection
472
472
  }, {
473
- icon: LeftIcon ? () => LeftIcon : null,
474
- title: Label ? () => Label : null,
473
+ icon: LeftIcon && labelAlign !== "top" ? () => LeftIcon : null,
474
+ title: Label || labelAlign === "top" ? renderTitle : null,
475
475
  value: renderFieldBody,
476
476
  extra: slots.extra
477
477
  });