sard-uniapp 1.0.5 → 1.1.0-alpha.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 ADDED
@@ -0,0 +1,32 @@
1
+ ## 1.1.0-alpha.2 (2024-04-03)
2
+
3
+ * docs: update quickstart.md ([fa280f6](https://github.com/sutras/sard-uniapp/commit/fa280f6))
4
+ * build: 新增changelog构建流程 ([e1e862d](https://github.com/sutras/sard-uniapp/commit/e1e862d))
5
+
6
+
7
+
8
+ ## <small>1.0.5 (2024-03-30)</small>
9
+
10
+ * fix: 修复打包组件缺少文件的问题 ([21c032f](https://github.com/sutras/sard-uniapp/commit/21c032f))
11
+ * test(test): 完善测试用例 ([49f9967](https://github.com/sutras/sard-uniapp/commit/49f9967))
12
+
13
+
14
+
15
+ ## <small>1.0.4 (2024-01-12)</small>
16
+
17
+ * fix(sard-uniapp): 修复打包缺少tag组件的bug ([c78f26c](https://github.com/sutras/sard-uniapp/commit/c78f26c))
18
+ * docs(doc): global component type prompt ([fb7d84e](https://github.com/sutras/sard-uniapp/commit/fb7d84e))
19
+ * build(sard-uniapp): update npm files field ([004ce1e](https://github.com/sutras/sard-uniapp/commit/004ce1e))
20
+ * add LICENSE. ([8082335](https://github.com/sutras/sard-uniapp/commit/8082335))
21
+
22
+
23
+
24
+ ## <small>1.0.2 (2023-12-23)</small>
25
+
26
+ * fix(global): fixed bugs ([eee4541](https://github.com/sutras/sard-uniapp/commit/eee4541))
27
+ * feat: 新增基础组件 ([8e6385e](https://github.com/sutras/sard-uniapp/commit/8e6385e))
28
+ * feat(global): 新增组件 ([5c65aab](https://github.com/sutras/sard-uniapp/commit/5c65aab))
29
+ * chore: 基础框架搭建 ([212fc3a](https://github.com/sutras/sard-uniapp/commit/212fc3a))
30
+
31
+
32
+
@@ -69,4 +69,7 @@ export interface SliderSlots {
69
69
  }
70
70
  export interface SliderEmits {
71
71
  (e: 'update:model-value', value: number | [number, number]): void;
72
+ (e: 'change', value: number | [number, number]): void;
73
+ (e: 'drag-start', event: TouchEvent): void;
74
+ (e: 'drag-end', event: TouchEvent): void;
72
75
  }
@@ -31,6 +31,8 @@
31
31
  "
32
32
  @touchstart="onTouchStart($event, 0)"
33
33
  @touchmove.stop.prevent="onTouchMove($event, 0)"
34
+ @touchend="onTouchEnd($event)"
35
+ @touchcancel="onTouchEnd($event)"
34
36
  @mousedown="onMouseDown($event, 0)"
35
37
  >
36
38
  <slot name="start-thumb" :value="rangeValue[0]">
@@ -49,6 +51,8 @@
49
51
  "
50
52
  @touchstart="onTouchStart($event, 1)"
51
53
  @touchmove.stop.prevent="onTouchMove($event, 1)"
54
+ @touchend="onTouchEnd($event)"
55
+ @touchcancel="onTouchEnd($event)"
52
56
  @mousedown="onMouseDown($event, 1)"
53
57
  >
54
58
  <slot name="end-thumb" :value="rangeValue[1]">
@@ -102,7 +106,12 @@ export default /* @__PURE__ */ _defineComponent({
102
106
  ...__default__,
103
107
  __name: "slider",
104
108
  props: sliderProps,
105
- emits: ["update:model-value"],
109
+ emits: [
110
+ "update:model-value",
111
+ "change",
112
+ "drag-start",
113
+ "drag-end"
114
+ ],
106
115
  setup(__props, { expose: __expose, emit: __emit }) {
107
116
  __expose();
108
117
  const props = __props;
@@ -134,6 +143,7 @@ export default /* @__PURE__ */ _defineComponent({
134
143
  let downValue;
135
144
  let moveValue;
136
145
  let downRatio = 0;
146
+ let triggerMove = false;
137
147
  const onSliderClick = async (event) => {
138
148
  if (isDisabled.value || isReadonly.value) {
139
149
  return;
@@ -171,6 +181,7 @@ export default /* @__PURE__ */ _defineComponent({
171
181
  if (nextValue !== void 0) {
172
182
  innerValue.value = nextValue;
173
183
  emit("update:model-value", nextValue);
184
+ emit("change", nextValue);
174
185
  }
175
186
  };
176
187
  let downCoord = {
@@ -195,6 +206,10 @@ export default /* @__PURE__ */ _defineComponent({
195
206
  if (isDisabled.value || isReadonly.value) {
196
207
  return;
197
208
  }
209
+ if (!triggerMove) {
210
+ triggerMove = true;
211
+ emit("drag-start", event);
212
+ }
198
213
  if (!trackRect) {
199
214
  return;
200
215
  }
@@ -226,6 +241,16 @@ export default /* @__PURE__ */ _defineComponent({
226
241
  emit("update:model-value", nextValue);
227
242
  }
228
243
  };
244
+ const onTouchEnd = (event) => {
245
+ triggerMove = false;
246
+ if (isDisabled.value || isReadonly.value) {
247
+ return;
248
+ }
249
+ if (!arrayEqual(toArray(downValue), toArray(innerValue.value))) {
250
+ emit("change", innerValue.value);
251
+ }
252
+ emit("drag-end", event);
253
+ };
229
254
  const onMouseDown = (event, index) => {
230
255
  const info = uni.getSystemInfoSync();
231
256
  onTouchStart(
@@ -240,6 +265,7 @@ export default /* @__PURE__ */ _defineComponent({
240
265
  );
241
266
  };
242
267
  const upHandler = () => {
268
+ onTouchEnd(event);
243
269
  document.removeEventListener("mouseup", upHandler);
244
270
  document.removeEventListener("mousemove", moveHandler);
245
271
  };
@@ -348,11 +374,15 @@ export default /* @__PURE__ */ _defineComponent({
348
374
  return downRatio;
349
375
  }, set downRatio(v) {
350
376
  downRatio = v;
377
+ }, get triggerMove() {
378
+ return triggerMove;
379
+ }, set triggerMove(v) {
380
+ triggerMove = v;
351
381
  }, onSliderClick, get downCoord() {
352
382
  return downCoord;
353
383
  }, set downCoord(v) {
354
384
  downCoord = v;
355
- }, onTouchStart, onTouchMove, onMouseDown, rangeValue, rangePercent, scales, sliderClass, sliderStyle, thumbStyle, valueClass, valueStyle, get classNames() {
385
+ }, onTouchStart, onTouchMove, onTouchEnd, onMouseDown, rangeValue, rangePercent, scales, sliderClass, sliderStyle, thumbStyle, valueClass, valueStyle, get classNames() {
356
386
  return classNames;
357
387
  }, get stringifyStyle() {
358
388
  return stringifyStyle;
@@ -3,7 +3,7 @@ export interface ToastProps {
3
3
  rootStyle?: StyleValue;
4
4
  rootClass?: string;
5
5
  type?: 'text' | 'loading' | 'success' | 'fail';
6
- title?: string;
6
+ title?: string | number;
7
7
  visible?: boolean;
8
8
  position?: 'top' | 'center' | 'bottom';
9
9
  overlay?: boolean;
@@ -18,7 +18,7 @@ export declare const toastProps: {
18
18
  type: PropType<NonNullable<"text" | "loading" | "success" | "fail" | undefined>>;
19
19
  default: string;
20
20
  };
21
- title: StringConstructor;
21
+ title: (StringConstructor | NumberConstructor)[];
22
22
  visible: BooleanConstructor;
23
23
  position: {
24
24
  type: PropType<NonNullable<"center" | "top" | "bottom" | undefined>>;
@@ -12,7 +12,7 @@ export const toastProps = {
12
12
  type: String,
13
13
  default: defaultConfig.toast.type,
14
14
  },
15
- title: String,
15
+ title: [String, Number],
16
16
  visible: Boolean,
17
17
  position: {
18
18
  type: String,
@@ -13,7 +13,7 @@ export declare const toastAgentProps: {
13
13
  type: import("vue").PropType<NonNullable<"text" | "loading" | "success" | "fail" | undefined>>;
14
14
  default: string;
15
15
  };
16
- title: StringConstructor;
16
+ title: (StringConstructor | NumberConstructor)[];
17
17
  visible: BooleanConstructor;
18
18
  position: {
19
19
  type: import("vue").PropType<NonNullable<"center" | "top" | "bottom" | undefined>>;
@@ -40,10 +40,10 @@ export declare const mapIdImperative: Record<string, {
40
40
  export type ToastOptions = ToastAgentProps;
41
41
  export interface ToastSimpleShowFunction {
42
42
  (options: ToastOptions): void;
43
- (title: string, options?: ToastOptions): void;
43
+ (title?: string | number, options?: ToastOptions): void;
44
44
  }
45
45
  export interface ToastShowFunction {
46
- (optionsOrTitle: string | ToastOptions, options?: ToastOptions, internalType?: ToastOptions['type']): void;
46
+ (optionsOrTitle?: string | number | ToastOptions, options?: ToastOptions, internalType?: ToastOptions['type']): void;
47
47
  }
48
48
  export type ToastFunction = ToastSimpleShowFunction & {
49
49
  success: ToastSimpleShowFunction;
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.0.5",
5
+ "version": "1.1.0-alpha.2",
6
6
  "description": "sard-uniapp 是一套基于 Uniapp + Vue3 框架开发的兼容多端的 UI 组件库",
7
7
  "keywords": [
8
8
  "uniapp",