sard-uniapp 1.12.1 → 1.12.2

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.12.2](https://github.com/sutras/sard-uniapp/compare/v1.12.1...v1.12.2) (2025-04-02)
2
+
3
+
4
+ ### Features
5
+
6
+ * tabs 等组件新增 change 事件, card 新增 click 事件 ([6c90a9e](https://github.com/sutras/sard-uniapp/commit/6c90a9e3d97864e66b4d5005947301fdfa4b9784))
7
+
8
+
9
+
1
10
  ## [1.12.1](https://github.com/sutras/sard-uniapp/compare/v1.12.0...v1.12.1) (2025-03-29)
2
11
 
3
12
 
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view :class="cardClass" :style="cardStyle">
2
+ <view :class="cardClass" :style="cardStyle" @click="onClick">
3
3
  <view v-if="!headless" :class="bem.e('header')">
4
4
  <view :class="bem.e('title')">
5
5
  <slot name="title">{{ title }}</slot>
@@ -42,10 +42,11 @@ export default _defineComponent({
42
42
  footer: { type: String, required: false }
43
43
  },
44
44
  emits: ["click"],
45
- setup(__props, { expose: __expose }) {
45
+ setup(__props, { expose: __expose, emit: __emit }) {
46
46
  __expose();
47
47
  const props = __props;
48
48
  const slots = _useSlots();
49
+ const emit = __emit;
49
50
  const bem = createBem("card");
50
51
  const headless = computed(() => {
51
52
  return isVisibleEmpty(props.title) && !slots.title && isVisibleEmpty(props.extra) && !slots.extra;
@@ -53,6 +54,9 @@ export default _defineComponent({
53
54
  const footless = computed(() => {
54
55
  return isVisibleEmpty(props.footer) && !slots.footer;
55
56
  });
57
+ const onClick = (event) => {
58
+ emit("click", event);
59
+ };
56
60
  const cardClass = computed(() => {
57
61
  return classNames(
58
62
  bem.b(),
@@ -64,7 +68,7 @@ export default _defineComponent({
64
68
  const cardStyle = computed(() => {
65
69
  return stringifyStyle(props.rootStyle);
66
70
  });
67
- const __returned__ = { props, slots, bem, headless, footless, cardClass, cardStyle };
71
+ const __returned__ = { props, slots, emit, bem, headless, footless, onClick, cardClass, cardStyle };
68
72
  return __returned__;
69
73
  }
70
74
  });
@@ -42,6 +42,7 @@ export interface DropdownItemSlots {
42
42
  }
43
43
  export interface DropdownItemEmits {
44
44
  (e: 'update:model-value', value: any): void;
45
+ (e: 'change', value: any): void;
45
46
  (e: 'update:visible', visible: boolean): void;
46
47
  }
47
48
  export interface DropdownContext {
@@ -2,9 +2,11 @@ import { type DropdownItemProps, type DropdownItemSlots, type DropdownOption } f
2
2
  declare function __VLS_template(): Readonly<DropdownItemSlots> & DropdownItemSlots;
3
3
  declare const __VLS_component: import("vue").DefineComponent<DropdownItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
4
4
  "update:model-value": (value: any) => any;
5
+ change: (value: any) => any;
5
6
  "update:visible": (visible: boolean) => any;
6
7
  }, string, import("vue").PublicProps, Readonly<DropdownItemProps> & Readonly<{
7
8
  "onUpdate:model-value"?: ((value: any) => any) | undefined;
9
+ onChange?: ((value: any) => any) | undefined;
8
10
  "onUpdate:visible"?: ((visible: boolean) => any) | undefined;
9
11
  }>, {
10
12
  options: DropdownOption[];
@@ -128,7 +128,7 @@ export default _defineComponent({
128
128
  separator: { type: String, required: false },
129
129
  placeholder: { type: String, required: false }
130
130
  }, defaultDropdownItemProps),
131
- emits: ["update:model-value", "update:visible"],
131
+ emits: ["update:model-value", "change", "update:visible"],
132
132
  setup(__props, { expose: __expose, emit: __emit }) {
133
133
  __expose();
134
134
  const props = __props;
@@ -215,6 +215,7 @@ export default _defineComponent({
215
215
  if (item.value !== innerValue.value) {
216
216
  innerValue.value = item.value;
217
217
  emit("update:model-value", item.value);
218
+ emit("change", item.value);
218
219
  }
219
220
  setInnerVisible(false);
220
221
  };
@@ -26,6 +26,7 @@ export interface PaginationSlots {
26
26
  }
27
27
  export interface PaginationEmits {
28
28
  (e: 'update:current', page: number): void;
29
+ (e: 'change', page: number): void;
29
30
  }
30
31
  /**
31
32
  * @description: 获取页面范围
@@ -1,8 +1,10 @@
1
1
  import { type PaginationProps, type PaginationSlots } from './common';
2
2
  declare function __VLS_template(): Readonly<PaginationSlots> & PaginationSlots;
3
3
  declare const __VLS_component: import("vue").DefineComponent<PaginationProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
4
+ change: (page: number) => any;
4
5
  "update:current": (page: number) => any;
5
6
  }, string, import("vue").PublicProps, Readonly<PaginationProps> & Readonly<{
7
+ onChange?: ((page: number) => any) | undefined;
6
8
  "onUpdate:current"?: ((page: number) => any) | undefined;
7
9
  }>, {
8
10
  type: "simple" | "multi";
@@ -76,7 +76,7 @@ export default _defineComponent({
76
76
  ellipsis: { type: Boolean, required: false },
77
77
  multiCount: { type: Number, required: false }
78
78
  }, defaultPaginationProps),
79
- emits: ["update:current"],
79
+ emits: ["update:current", "change"],
80
80
  setup(__props, { expose: __expose, emit: __emit }) {
81
81
  __expose();
82
82
  const { t } = useTranslate("pagination");
@@ -117,6 +117,7 @@ export default _defineComponent({
117
117
  if (page !== innerCurrent.value) {
118
118
  innerCurrent.value = page;
119
119
  emit("update:current", page);
120
+ emit("change", page);
120
121
  }
121
122
  };
122
123
  const multiItems = computed(() => {
@@ -23,6 +23,7 @@ export interface TabsSlots {
23
23
  }
24
24
  export interface TabsEmits {
25
25
  (e: 'update:current', name: string | number): void;
26
+ (e: 'change', name: string | number): void;
26
27
  }
27
28
  export interface TabProps {
28
29
  rootStyle?: StyleValue;
@@ -1,8 +1,10 @@
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;
4
5
  "update:current": (name: string | number) => any;
5
6
  }, string, import("vue").PublicProps, Readonly<TabsProps> & Readonly<{
7
+ onChange?: ((name: string | number) => any) | undefined;
6
8
  "onUpdate:current"?: ((name: string | number) => any) | undefined;
7
9
  }>, {
8
10
  type: "line" | "pill" | "card";
@@ -73,7 +73,7 @@ export default _defineComponent({
73
73
  type: { type: String, required: false },
74
74
  scrollable: { type: Boolean, required: false }
75
75
  }, defaultTabsProps),
76
- emits: ["update:current"],
76
+ emits: ["update:current", "change"],
77
77
  setup(__props, { expose: __expose, emit: __emit }) {
78
78
  __expose();
79
79
  const props = __props;
@@ -149,6 +149,7 @@ export default _defineComponent({
149
149
  select(name) {
150
150
  innerCurrent.value = name;
151
151
  emit("update:current", name);
152
+ emit("change", name);
152
153
  scrollToTabQueue.value = name;
153
154
  }
154
155
  })
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.12.1",
5
+ "version": "1.12.2",
6
6
  "description": "sard-uniapp 是一套基于 Uniapp + Vue3 框架开发的兼容多端的 UI 组件库",
7
7
  "main": "index.js",
8
8
  "scripts": {
@@ -121,7 +121,7 @@
121
121
  "lodash-es": "^4.17.21",
122
122
  "prettier": "^2.8.8",
123
123
  "region-data": "^1.2.3",
124
- "sard-cli": "link:../sard-cli",
124
+ "sard-cli": "^1.1.4",
125
125
  "sass": "^1.69.7",
126
126
  "tel-area-code": "^1.1.0",
127
127
  "ts-custom-error": "^3.3.1",