sard-uniapp 1.15.2 → 1.15.3

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/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [1.15.3](https://github.com/sutras/sard-uniapp/compare/v1.15.2...v1.15.3) (2025-05-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * tabs组件允许name为boolean类型 ([6897055](https://github.com/sutras/sard-uniapp/commit/68970555842b6f51649e3c96c5e770390e6e7c40))
7
+
8
+
9
+
1
10
  ## [1.15.2](https://github.com/sutras/sard-uniapp/compare/v1.15.1...v1.15.2) (2025-05-24)
2
11
 
3
12
 
@@ -33,7 +33,7 @@ export default _defineComponent({
33
33
  rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
34
34
  rootClass: { type: String, required: false },
35
35
  title: { type: String, required: false },
36
- name: { type: [String, Number], required: true },
36
+ name: { type: [String, Number, Boolean], required: true },
37
37
  disabled: { type: Boolean, required: false }
38
38
  },
39
39
  emits: ["click"],
@@ -4,13 +4,13 @@ export interface TabOption {
4
4
  rootStyle?: StyleValue;
5
5
  rootClass?: string;
6
6
  title?: string;
7
- name?: string | number;
7
+ name?: string | number | boolean;
8
8
  disabled?: boolean;
9
9
  }
10
10
  export interface TabsProps {
11
11
  rootStyle?: StyleValue;
12
12
  rootClass?: string;
13
- current?: string | number;
13
+ current?: string | number | boolean;
14
14
  list?: TabOption[];
15
15
  type?: 'line' | 'pill' | 'card';
16
16
  scrollable?: boolean;
@@ -22,14 +22,14 @@ export interface TabsSlots {
22
22
  default?(props: Record<string, never>): any;
23
23
  }
24
24
  export interface TabsEmits {
25
- (e: 'update:current', name: string | number): void;
26
- (e: 'change', name: string | number): void;
25
+ (e: 'update:current', name: string | number | boolean): void;
26
+ (e: 'change', name: string | number | boolean): void;
27
27
  }
28
28
  export interface TabProps {
29
29
  rootStyle?: StyleValue;
30
30
  rootClass?: string;
31
31
  title?: string;
32
- name: string | number;
32
+ name: string | number | boolean;
33
33
  disabled?: boolean;
34
34
  }
35
35
  export interface TabSlots {
@@ -40,10 +40,10 @@ export interface TabEmits {
40
40
  }
41
41
  export interface TabContext {
42
42
  current: any;
43
- select: (name: string | number, initial?: boolean) => void;
44
- register: (name: string | number, expose: {
43
+ select: (name: string | number | boolean, initial?: boolean) => void;
44
+ register: (name: string | number | boolean, expose: {
45
45
  getRect: () => Promise<NodeRect>;
46
46
  }) => void;
47
- unregister: (name: string | number) => void;
47
+ unregister: (name: string | number | boolean) => void;
48
48
  }
49
49
  export declare const tabContextSymbol: unique symbol;
@@ -1,11 +1,11 @@
1
1
  import { type TabsProps, type TabsSlots } from './common';
2
2
  declare function __VLS_template(): Readonly<TabsSlots> & TabsSlots;
3
3
  declare const __VLS_component: import("vue").DefineComponent<TabsProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
4
- change: (name: string | number) => any;
5
- "update:current": (name: string | number) => any;
4
+ change: (name: string | number | boolean) => any;
5
+ "update:current": (name: string | number | boolean) => any;
6
6
  }, string, import("vue").PublicProps, Readonly<TabsProps> & Readonly<{
7
- onChange?: ((name: string | number) => any) | undefined;
8
- "onUpdate:current"?: ((name: string | number) => any) | undefined;
7
+ onChange?: ((name: string | number | boolean) => any) | undefined;
8
+ "onUpdate:current"?: ((name: string | number | boolean) => any) | undefined;
9
9
  }>, {
10
10
  type: "line" | "pill" | "card";
11
11
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -68,7 +68,7 @@ export default _defineComponent({
68
68
  props: _mergeDefaults({
69
69
  rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
70
70
  rootClass: { type: String, required: false },
71
- current: { type: [String, Number], required: false },
71
+ current: { type: [String, Number, Boolean], required: false },
72
72
  list: { type: Array, required: false },
73
73
  type: { type: String, required: false },
74
74
  scrollable: { type: Boolean, required: false }
@@ -80,13 +80,13 @@ export default _defineComponent({
80
80
  const emit = __emit;
81
81
  const bem = createBem("tabs");
82
82
  const scrollToTab = async (name) => {
83
- if (!needScrollToTab.value || !tabMap[name]) {
83
+ if (!needScrollToTab.value || !tabMap.has(name)) {
84
84
  return;
85
85
  }
86
86
  const [scrollRect, wrapperRect, tabRect] = await Promise.all([
87
87
  getBoundingClientRect(`#${scrollId}`, instance),
88
88
  getBoundingClientRect(`#${wrapperId}`, instance),
89
- tabMap[name].getRect()
89
+ tabMap.get(name).getRect()
90
90
  ]);
91
91
  scrollLeft.value = tabRect.left - wrapperRect.left - (scrollRect.width - tabRect.width) / 2;
92
92
  if (props.type === "line") {
@@ -114,7 +114,7 @@ export default _defineComponent({
114
114
  const lineLeft = ref(0);
115
115
  const scrollLeft = ref(0);
116
116
  const scrollInitialized = ref(false);
117
- const tabMap = {};
117
+ const tabMap = new Map();
118
118
  const needScrollToTab = computed(() => {
119
119
  return props.type === "line" || props.type === "pill" && props.scrollable;
120
120
  });
@@ -141,10 +141,10 @@ export default _defineComponent({
141
141
  reactive({
142
142
  current: innerCurrent,
143
143
  register(name, expose) {
144
- tabMap[name] = expose;
144
+ tabMap.set(name, expose);
145
145
  },
146
146
  unregister(name) {
147
- delete tabMap[name];
147
+ tabMap.delete(name);
148
148
  },
149
149
  select(name, initial) {
150
150
  innerCurrent.value = name;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "id": "sard-uniapp",
3
3
  "name": "sard-uniapp",
4
4
  "displayName": "sard-uniapp",
5
- "version": "1.15.2",
5
+ "version": "1.15.3",
6
6
  "description": "sard-uniapp 是一套基于 Uniapp + Vue3 框架开发的兼容多端的 UI 组件库",
7
7
  "main": "index.js",
8
8
  "scripts": {