sard-uniapp 1.24.0 → 1.24.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.
Files changed (69) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/components/checkbox-input/checkbox-input.d.ts +1 -0
  3. package/components/checkbox-input/checkbox-input.vue +3 -0
  4. package/components/checkbox-input/common.d.ts +1 -0
  5. package/components/checkbox-popout/README.md +11 -10
  6. package/components/checkbox-popout/checkbox-popout.d.ts +1 -0
  7. package/components/checkbox-popout/checkbox-popout.vue +11 -1
  8. package/components/checkbox-popout/common.d.ts +2 -0
  9. package/components/config/index.d.ts +10 -0
  10. package/components/config/index.js +8 -0
  11. package/components/count-down/README.md +8 -6
  12. package/components/count-down/common.d.ts +3 -0
  13. package/components/count-down/count-down.vue +20 -4
  14. package/components/count-down/index.scss +10 -0
  15. package/components/fab/README.md +27 -20
  16. package/components/fab/common.d.ts +17 -0
  17. package/components/fab/fab.d.ts +12 -0
  18. package/components/fab/fab.vue +80 -26
  19. package/components/fab/index.scss +35 -5
  20. package/components/floating-bubble/README.md +10 -9
  21. package/components/floating-bubble/common.d.ts +2 -0
  22. package/components/floating-bubble/floating-bubble.d.ts +1 -0
  23. package/components/floating-bubble/floating-bubble.vue +18 -127
  24. package/components/floating-bubble/useFloatingBubble.d.ts +43 -0
  25. package/components/floating-bubble/useFloatingBubble.js +137 -0
  26. package/components/form/README.md +38 -36
  27. package/components/form/common.d.ts +3 -0
  28. package/components/form/form.d.ts +1 -0
  29. package/components/form/form.vue +2 -0
  30. package/components/form/useForm.js +1 -0
  31. package/components/form-item/form-item.vue +12 -3
  32. package/components/form-item/index.scss +4 -2
  33. package/components/form-item/useFormItem.d.ts +1 -0
  34. package/components/form-item/useFormItem.js +2 -0
  35. package/components/form-item-plain/form-item-plain.vue +2 -0
  36. package/components/form-plain/form-plain.d.ts +1 -0
  37. package/components/form-plain/form-plain.vue +2 -0
  38. package/components/input/README.md +48 -47
  39. package/components/input/input.vue +1 -0
  40. package/components/keyboard/README.md +12 -11
  41. package/components/keyboard/common.d.ts +1 -0
  42. package/components/keyboard/index.d.ts +1 -1
  43. package/components/keyboard/keyboard.d.ts +2 -0
  44. package/components/keyboard/keyboard.vue +20 -12
  45. package/components/locale/lang/ar-SA.d.ts +124 -0
  46. package/components/locale/lang/ar-SA.js +124 -0
  47. package/components/popout/README.md +8 -8
  48. package/components/popout/common.d.ts +13 -2
  49. package/components/popout/popout.vue +75 -45
  50. package/components/popout-input/index.scss +5 -0
  51. package/components/popout-input/popout-input.vue +11 -2
  52. package/components/popout-input/variables.scss +1 -0
  53. package/components/radio-input/common.d.ts +1 -0
  54. package/components/radio-input/radio-input.d.ts +1 -0
  55. package/components/radio-input/radio-input.vue +3 -0
  56. package/components/radio-popout/README.md +10 -9
  57. package/components/radio-popout/common.d.ts +2 -0
  58. package/components/radio-popout/radio-popout.d.ts +1 -0
  59. package/components/radio-popout/radio-popout.vue +10 -1
  60. package/components/rate/index.scss +2 -3
  61. package/components/stepper/index.scss +2 -3
  62. package/components/switch/index.scss +8 -4
  63. package/components/tag/tag.vue +5 -1
  64. package/components/tree/README.md +1 -0
  65. package/components/tree/common.d.ts +5 -0
  66. package/components/tree/tree.d.ts +8 -0
  67. package/components/tree/tree.vue +11 -3
  68. package/components/tree-node/tree-node.vue +2 -1
  69. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ ## [1.24.2](https://github.com/sutras/sard-uniapp/compare/v1.24.1...v1.24.2) (2025-09-06)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **count-down:** 修复行内嵌套块的问题 ([fd8112c](https://github.com/sutras/sard-uniapp/commit/fd8112c3885c0069b34f6709c7190a298d680726))
7
+ * **popout:** 修正按钮插槽内容 ([7f29d80](https://github.com/sutras/sard-uniapp/commit/7f29d8059ac1dd342f85a5de54f42e867879ecfc))
8
+ * **tag:** 阻止点击关闭时的事件冒泡 ([4220f31](https://github.com/sutras/sard-uniapp/commit/4220f311f0c5564ae095db6863f415f483f7f22e))
9
+
10
+
11
+ ### Features
12
+
13
+ * **fab:** 添加拖拽功能 ([4d24318](https://github.com/sutras/sard-uniapp/commit/4d243186b4ba22ebe50722c67466eb702c88cbf5))
14
+
15
+
16
+
17
+ ## [1.24.1](https://github.com/sutras/sard-uniapp/compare/v1.24.0...v1.24.1) (2025-08-31)
18
+
19
+
20
+ ### Features
21
+
22
+ * **form:** 新增content-position属性 ([b588249](https://github.com/sutras/sard-uniapp/commit/b5882493653491d6a03f0b04f898b6b9c31a06c5))
23
+ * **keyboard:** 为车牌键盘模式添加双向绑定支持 ([740f7bf](https://github.com/sutras/sard-uniapp/commit/740f7bf074658d845d49ad5582663af639757260))
24
+ * **tree:** 新增node-click事件 ([a70e5d7](https://github.com/sutras/sard-uniapp/commit/a70e5d786305e580cbac7eb8c897ed79cff54059))
25
+ * 新增checkbox-popout和radio-popout新增icon-position属性 ([32f458a](https://github.com/sutras/sard-uniapp/commit/32f458aa46ceebdb4ed46f51733f3749e60461a0))
26
+ * 新增阿拉伯语支持 ([b0b2c60](https://github.com/sutras/sard-uniapp/commit/b0b2c6050bad21f476e767659c8ac6802bfcadb6))
27
+
28
+
29
+
1
30
  # [1.24.0](https://github.com/sutras/sard-uniapp/compare/v1.23.5...v1.24.0) (2025-08-24)
2
31
 
3
32
 
@@ -9,6 +9,7 @@ declare const __VLS_component: import("vue").DefineComponent<CheckboxInputProps,
9
9
  }>, {
10
10
  options: import("../checkbox/common").CheckboxGroupOption[];
11
11
  valueOnClear: () => any;
12
+ iconPosition: "left" | "right";
12
13
  validateEvent: boolean;
13
14
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
15
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
@@ -34,6 +34,7 @@
34
34
  :searchable="searchable"
35
35
  :filter-placeholder="filterPlaceholder"
36
36
  :resettable="resettable"
37
+ :icon-position="iconPosition"
37
38
  @change="onChange"
38
39
  @visible-hook="onVisibleHook"
39
40
  @confirm="onConfirm"
@@ -74,6 +75,7 @@ import { usePopoutInput } from "../../use";
74
75
  * @property {boolean} searchable 是否可搜索,默认值:false。
75
76
  * @property {string} filterPlaceholder 搜索输入框占位符内容,默认值:-。
76
77
  * @property {boolean} resettable 关闭弹出框后,是否可复位弹出框值,默认值:false。
78
+ * @property {'left' | 'right'} iconPosition 可定义复选框的位置,默认值:'left'。
77
79
  * @property {boolean} clearable 是否显示清空按钮,默认值:false。
78
80
  * @property {string} placeholder 输入框占位符内容,默认值:-。
79
81
  * @property {() => any} valueOnClear 设置点击清除按钮后的值,默认值:() => undefined。
@@ -115,6 +117,7 @@ export default _defineComponent({
115
117
  searchable: { type: Boolean, required: false },
116
118
  filterPlaceholder: { type: String, required: false },
117
119
  resettable: { type: Boolean, required: false },
120
+ iconPosition: { type: String, required: false },
118
121
  rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
119
122
  rootClass: { type: String, required: false },
120
123
  modelValue: { type: Array, required: false },
@@ -9,6 +9,7 @@ export declare const defaultCheckboxInputProps: () => {
9
9
  valueOnClear: CheckboxInputProps["valueOnClear"];
10
10
  options: () => never[];
11
11
  validateEvent: boolean;
12
+ iconPosition: CheckboxPopoutProps["iconPosition"];
12
13
  };
13
14
  export interface CheckboxInputSlots extends PopoutInputSlots {
14
15
  }
@@ -48,16 +48,17 @@ import CheckboxPopout from 'sard-uniapp/components/checkbox-popout/checkbox-popo
48
48
 
49
49
  继承 [`CheckboxGroupProps`](./checkbox#CheckboxGroupProps) 并有以下额外属性:
50
50
 
51
- | 属性 | 描述 | 类型 | 默认值 |
52
- | ----------------------------------- | -------------------------------- | ---------- | ------ |
53
- | popout-class | 弹窗框根元素类名 | string | - |
54
- | popout-style | 弹窗框根元素样式 | StyleValue | - |
55
- | visible (v-model) | 是否显示弹出框 | boolean | - |
56
- | title | 弹出框标题 | string | - |
57
- | show-check-all <sup>1.20+</sup> | 是否显示全选 | boolean | false |
58
- | searchable <sup>1.20+</sup> | 是否可搜索 | boolean | false |
59
- | filter-placeholder <sup>1.20+</sup> | 搜索输入框占位符内容 | string | - |
60
- | resettable <sup>1.23.3+</sup> | 关闭弹出框后,是否可复位弹出框值 | boolean | false |
51
+ | 属性 | 描述 | 类型 | 默认值 |
52
+ | ----------------------------------- | -------------------------------- | ----------------- | ------ |
53
+ | popout-class | 弹窗框根元素类名 | string | - |
54
+ | popout-style | 弹窗框根元素样式 | StyleValue | - |
55
+ | visible (v-model) | 是否显示弹出框 | boolean | - |
56
+ | title | 弹出框标题 | string | - |
57
+ | show-check-all <sup>1.20+</sup> | 是否显示全选 | boolean | false |
58
+ | searchable <sup>1.20+</sup> | 是否可搜索 | boolean | false |
59
+ | filter-placeholder <sup>1.20+</sup> | 搜索输入框占位符内容 | string | - |
60
+ | resettable <sup>1.23.3+</sup> | 关闭弹出框后,是否可复位弹出框值 | boolean | false |
61
+ | icon-position <sup>1.24.1+</sup> | 可定义复选框的位置 | 'left' \| 'right' | 'left' |
61
62
 
62
63
  ### CheckboxPopoutEmits
63
64
 
@@ -8,6 +8,7 @@ declare const __VLS_component: import("vue").DefineComponent<CheckboxPopoutProps
8
8
  [x: `on${Capitalize<any>}`]: ((...args: any) => any) | undefined;
9
9
  }>, {
10
10
  options: import("../checkbox/common").CheckboxGroupOption[];
11
+ iconPosition: "left" | "right";
11
12
  validateEvent: boolean;
12
13
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
14
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
@@ -61,7 +61,15 @@
61
61
  :hover="!option.disabled"
62
62
  @click="select(option, toggle)"
63
63
  >
64
- <template #icon>
64
+ <template v-if="iconPosition === 'left'" #icon>
65
+ <sar-checkbox
66
+ readonly
67
+ :disabled="option.disabled"
68
+ :value="option.value"
69
+ :validate-event="false"
70
+ />
71
+ </template>
72
+ <template v-if="iconPosition === 'right'" #value>
65
73
  <sar-checkbox
66
74
  readonly
67
75
  :disabled="option.disabled"
@@ -116,6 +124,7 @@ import { defaultOptionKeys } from "../checkbox/common";
116
124
  * @property {boolean} searchable 是否可搜索,默认值:false。
117
125
  * @property {string} filterPlaceholder 搜索输入框占位符内容,默认值:-。
118
126
  * @property {boolean} resettable 关闭弹出框后,是否可复位弹出框值,默认值:false。
127
+ * @property {'left' | 'right'} iconPosition 可定义复选框的位置,默认值:'left'。
119
128
  * @event {(visible: boolean) => void} update 弹出框显隐时触发
120
129
  * @event {(value: any[] | undefined) => void} change 复选输入组件值改变时触发
121
130
  * @event {() => void} confirm 点击确定按钮时触发
@@ -155,6 +164,7 @@ export default _defineComponent({
155
164
  searchable: { type: Boolean, required: false },
156
165
  filterPlaceholder: { type: String, required: false },
157
166
  resettable: { type: Boolean, required: false },
167
+ iconPosition: { type: String, required: false },
158
168
  rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
159
169
  rootClass: { type: String, required: false },
160
170
  modelValue: { type: Array, required: false },
@@ -10,10 +10,12 @@ export interface CheckboxPopoutProps extends CheckboxGroupProps {
10
10
  searchable?: boolean;
11
11
  filterPlaceholder?: string;
12
12
  resettable?: boolean;
13
+ iconPosition?: 'left' | 'right';
13
14
  }
14
15
  export declare const defaultCheckboxPopoutProps: () => {
15
16
  options: () => never[];
16
17
  validateEvent: boolean;
18
+ iconPosition: CheckboxPopoutProps["iconPosition"];
17
19
  };
18
20
  export interface CheckboxPopoutSlots {
19
21
  default?(props: Record<string, never>): any;
@@ -5,6 +5,7 @@ import { type CalendarInputProps } from '../calendar-input';
5
5
  import { type CalendarProps } from '../calendar';
6
6
  import { type CascaderInputProps } from '../cascader-input';
7
7
  import { type CheckboxGroupProps } from '../checkbox';
8
+ import { type CheckboxPopoutProps } from '../checkbox-popout';
8
9
  import { type CheckboxInputProps } from '../checkbox-input';
9
10
  import { type CoolIconProps } from '../cool-icon';
10
11
  import { type DatetimePickerInputProps } from '../datetime-picker-input';
@@ -12,6 +13,7 @@ import { type DatetimeRangePickerInputProps } from '../datetime-range-picker-inp
12
13
  import { type DialogProps } from '../dialog';
13
14
  import { type DividerProps } from '../divider';
14
15
  import { type DropdownProps } from '../dropdown';
16
+ import { type FabProps } from '../fab';
15
17
  import { type FloatingBubbleProps } from '../floating-bubble';
16
18
  import { type FormProps } from '../form';
17
19
  import { type GridProps } from '../grid';
@@ -127,6 +129,7 @@ export declare const defaultConfig: {
127
129
  };
128
130
  checkboxPopout: {
129
131
  validateEvent: boolean;
132
+ iconPosition: CheckboxPopoutProps["iconPosition"];
130
133
  };
131
134
  coolIcon: {
132
135
  shape: CoolIconProps["shape"];
@@ -200,8 +203,13 @@ export declare const defaultConfig: {
200
203
  overlayClosable: boolean;
201
204
  hideName: boolean;
202
205
  duration: number;
206
+ draggable: boolean;
207
+ axis: FabProps["axis"];
208
+ gapX: number;
209
+ gapY: number;
203
210
  };
204
211
  floatingBubble: {
212
+ draggable: boolean;
205
213
  axis: FloatingBubbleProps["axis"];
206
214
  gapX: number;
207
215
  gapY: number;
@@ -218,6 +226,7 @@ export declare const defaultConfig: {
218
226
  labelAlign: FormProps["labelAlign"];
219
227
  labelValign: FormProps["labelValign"];
220
228
  starPosition: FormProps["starPosition"];
229
+ contentPosition: FormProps["contentPosition"];
221
230
  showError: boolean;
222
231
  scrollDuration: number;
223
232
  };
@@ -368,6 +377,7 @@ export declare const defaultConfig: {
368
377
  radioPopout: {
369
378
  validateEvent: boolean;
370
379
  type: RadioPopoutProps["type"];
380
+ iconPosition: RadioPopoutProps["iconPosition"];
371
381
  };
372
382
  rate: {
373
383
  count: number;
@@ -78,6 +78,7 @@ export const defaultConfig = {
78
78
  },
79
79
  checkboxPopout: {
80
80
  validateEvent: true,
81
+ iconPosition: 'left',
81
82
  },
82
83
  coolIcon: {
83
84
  shape: 'oval',
@@ -151,8 +152,13 @@ export const defaultConfig = {
151
152
  overlayClosable: false,
152
153
  hideName: false,
153
154
  duration: 150,
155
+ draggable: false,
156
+ axis: 'y',
157
+ gapX: 24,
158
+ gapY: 24,
154
159
  },
155
160
  floatingBubble: {
161
+ draggable: true,
156
162
  axis: 'y',
157
163
  gapX: 24,
158
164
  gapY: 24,
@@ -169,6 +175,7 @@ export const defaultConfig = {
169
175
  labelAlign: 'start',
170
176
  labelValign: 'center',
171
177
  starPosition: 'left',
178
+ contentPosition: 'left',
172
179
  showError: true,
173
180
  scrollDuration: 150,
174
181
  },
@@ -319,6 +326,7 @@ export const defaultConfig = {
319
326
  radioPopout: {
320
327
  validateEvent: true,
321
328
  type: 'circle',
329
+ iconPosition: 'left',
322
330
  },
323
331
  rate: {
324
332
  count: 5,
@@ -57,12 +57,14 @@ import CountDown from 'sard-uniapp/components/count-down/count-down.vue'
57
57
 
58
58
  ### CountDownProps
59
59
 
60
- | 属性 | 描述 | 类型 | 默认值 |
61
- | ----------- | ---------------------- | ------- | ---------- |
62
- | time | 倒计时总时长,单位毫秒 | number | 0 |
63
- | auto-start | 是否自动开始倒计时 | boolean | true |
64
- | format | 时间格式 | string | 'HH:mm:ss' |
65
- | millisecond | 是否开启毫秒级别渲染 | boolean | false |
60
+ | 属性 | 描述 | 类型 | 默认值 |
61
+ | ----------------------------- | ---------------------- | ---------- | ---------- |
62
+ | root-class <sup>1.24.2+</sup> | 组件根元素类名 | string | - |
63
+ | root-style <sup>1.24.2+</sup> | 组件根元素样式 | StyleValue | - |
64
+ | time | 倒计时总时长,单位毫秒 | number | 0 |
65
+ | auto-start | 是否自动开始倒计时 | boolean | true |
66
+ | format | 时间格式 | string | 'HH:mm:ss' |
67
+ | millisecond | 是否开启毫秒级别渲染 | boolean | false |
66
68
 
67
69
  ### CountDownSlots
68
70
 
@@ -1,4 +1,7 @@
1
+ import { type StyleValue } from 'vue';
1
2
  export interface CountDownProps {
3
+ rootStyle?: StyleValue;
4
+ rootClass?: string;
2
5
  time?: number;
3
6
  autoStart?: boolean;
4
7
  format?: string;
@@ -1,9 +1,9 @@
1
1
  <template>
2
- <text>
2
+ <view :class="countDownClass" :style="countDownStyle">
3
3
  <slot :time="currentTime">
4
4
  {{ formatTime(format, currentTime) }}
5
5
  </slot>
6
- </text>
6
+ </view>
7
7
  </template>
8
8
 
9
9
  <script>
@@ -14,7 +14,10 @@ import {
14
14
  formatTime,
15
15
  defaultCountDownProps
16
16
  } from "./common";
17
+ import { classNames, stringifyStyle, createBem } from "../../utils";
17
18
  /**
19
+ * @property {string} rootClass 组件根元素类名,默认值:-。
20
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
18
21
  * @property {number} time 倒计时总时长,单位毫秒,默认值:0。
19
22
  * @property {boolean} autoStart 是否自动开始倒计时,默认值:true。
20
23
  * @property {string} format 时间格式,默认值:'HH:mm:ss'。
@@ -31,6 +34,8 @@ export default _defineComponent({
31
34
  },
32
35
  __name: "count-down",
33
36
  props: _mergeDefaults({
37
+ rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
38
+ rootClass: { type: String, required: false },
34
39
  time: { type: Number, required: false },
35
40
  autoStart: { type: Boolean, required: false },
36
41
  format: { type: String, required: false },
@@ -40,6 +45,7 @@ export default _defineComponent({
40
45
  setup(__props, { expose: __expose, emit: __emit }) {
41
46
  const props = __props;
42
47
  const emit = __emit;
48
+ const bem = createBem("count-down");
43
49
  const remainTime = ref(props.time);
44
50
  let endTime = 0;
45
51
  let timer = null;
@@ -102,7 +108,13 @@ export default _defineComponent({
102
108
  onBeforeUnmount(() => {
103
109
  pause();
104
110
  });
105
- const __returned__ = { props, emit, remainTime, get endTime() {
111
+ const countDownClass = computed(() => {
112
+ return classNames(bem.b(), props.rootClass);
113
+ });
114
+ const countDownStyle = computed(() => {
115
+ return stringifyStyle(props.rootStyle);
116
+ });
117
+ const __returned__ = { props, emit, bem, remainTime, get endTime() {
106
118
  return endTime;
107
119
  }, set endTime(v) {
108
120
  endTime = v;
@@ -114,10 +126,14 @@ export default _defineComponent({
114
126
  return paused;
115
127
  }, set paused(v) {
116
128
  paused = v;
117
- }, tick, start, pause, reset, precisionTime, currentTime, get formatTime() {
129
+ }, tick, start, pause, reset, precisionTime, currentTime, countDownClass, countDownStyle, get formatTime() {
118
130
  return formatTime;
119
131
  } };
120
132
  return __returned__;
121
133
  }
122
134
  });
123
135
  </script>
136
+
137
+ <style lang="scss">
138
+ @import './index.scss';
139
+ </style>
@@ -0,0 +1,10 @@
1
+ @use '../style/base' as *;
2
+
3
+ @include bem(count-down) {
4
+ @include b() {
5
+ box-sizing: border-box;
6
+ display: inline-flex;
7
+ align-items: center;
8
+ vertical-align: middle;
9
+ }
10
+ }
@@ -70,22 +70,28 @@ import Fab from 'sard-uniapp/components/fab/fab.vue'
70
70
 
71
71
  ### FabProps
72
72
 
73
- | 属性 | 描述 | 类型 | 默认值 |
74
- | ---------------- | -------------------------------------------- | ---------- | ------ |
75
- | root-class | 组件根元素类名 | string | - |
76
- | root-style | 组件根元素样式 | StyleValue | - |
77
- | top | 设置距离窗口顶部的距离,优先级比 `bottom` 高 | string | - |
78
- | right | 设置距离窗口右边的距离 | string | - |
79
- | bottom | 设置距离窗口底部的距离 | string | - |
80
- | left | 设置距离窗口左边的距离,优先级比 `right` 高 | string | - |
81
- | color | 设置按钮图标的颜色 | string | - |
82
- | background | 设置按钮的背景色 | string | - |
83
- | icon | 设置入口按钮的图标 | string | - |
84
- | icon-family | 设置入口按钮的图标族 | string | - |
85
- | item-list | 设置扩展按钮 | FabItem[] | [] |
86
- | hide-name | 是否隐藏按钮名称 | boolean | false |
87
- | overlay-closable | 点击遮罩是否隐藏扩展按钮 | boolean | false |
88
- | duration | 扩展按钮显隐动画时长,单位 ms | number | 150 |
73
+ | 属性 | 描述 | 类型 | 默认值 |
74
+ | ----------------------------------- | -------------------------------------------- | ------------------------------ | ------ |
75
+ | root-class | 组件根元素类名 | string | - |
76
+ | root-style | 组件根元素样式 | StyleValue | - |
77
+ | top | 设置距离窗口顶部的距离,优先级比 `bottom` 高 | string | - |
78
+ | right | 设置距离窗口右边的距离 | string | - |
79
+ | bottom | 设置距离窗口底部的距离 | string | - |
80
+ | left | 设置距离窗口左边的距离,优先级比 `right` 高 | string | - |
81
+ | color | 设置按钮图标的颜色 | string | - |
82
+ | background | 设置按钮的背景色 | string | - |
83
+ | icon | 设置入口按钮的图标 | string | - |
84
+ | icon-family | 设置入口按钮的图标族 | string | - |
85
+ | item-list | 设置扩展按钮 | FabItem[] | [] |
86
+ | hide-name | 是否隐藏按钮名称 | boolean | false |
87
+ | overlay-closable | 点击遮罩是否隐藏扩展按钮 | boolean | false |
88
+ | duration | 扩展按钮显隐动画时长,单位 ms | number | 150 |
89
+ | draggable <sup>1.24.2+</sup> | 是否可拖拽 | boolean | false |
90
+ | axis <sup>1.24.2+</sup> | 允许拖拽的方向轴 | 'x' \| 'y' \| 'both' \| 'none' | 'y' |
91
+ | magnet <sup>1.24.2+</sup> | 吸附到指定轴最近的一边 | 'x' \| 'y' | - |
92
+ | gap-x <sup>1.24.2+</sup> | 悬浮按钮与窗口左右两边的最小间距,单位为 px | number | 24 |
93
+ | gap-y <sup>1.24.2+</sup> | 悬浮按钮与窗口上下两边的最小间距,单位为 px | number | 24 |
94
+ | offset (v-model) <sup>1.24.2+</sup> | 控制悬浮按钮的位置 | { x: number; y: number } | - |
89
95
 
90
96
  ### FabSlots
91
97
 
@@ -95,10 +101,11 @@ import Fab from 'sard-uniapp/components/fab/fab.vue'
95
101
 
96
102
  ### FabEmits
97
103
 
98
- | 事件 | 描述 | 类型 |
99
- | ------ | ------------------ | -------------------------------------- |
100
- | click | 点击入口按钮时触发 | (event: any) => void |
101
- | select | 点击扩展按钮时触发 | (item: FabItem, index: number) => void |
104
+ | 事件 | 描述 | 类型 |
105
+ | -------------------------------- | ---------------------------- | ------------------------------------------ |
106
+ | click | 点击入口按钮时触发 | (event: any) => void |
107
+ | select | 点击扩展按钮时触发 | (item: FabItem, index: number) => void |
108
+ | update:offset <sup>1.24.2+</sup> | 因用户拖拽导致位置改变时触发 | (offset: { x: number; y: number }) => void |
102
109
 
103
110
  ### FabItem
104
111
 
@@ -14,16 +14,33 @@ export interface FabProps {
14
14
  hideName?: boolean;
15
15
  overlayClosable?: boolean;
16
16
  duration?: number;
17
+ draggable?: boolean;
18
+ axis?: 'x' | 'y' | 'both' | 'none';
19
+ magnet?: 'x' | 'y';
20
+ gapX?: number;
21
+ gapY?: number;
22
+ offset?: {
23
+ x: number;
24
+ y: number;
25
+ };
17
26
  }
18
27
  export declare const defaultFabProps: () => {
19
28
  itemList: () => never[];
20
29
  overlayClosable: boolean;
21
30
  hideName: boolean;
22
31
  duration: number;
32
+ draggable: boolean;
33
+ axis: FabProps["axis"];
34
+ gapX: number;
35
+ gapY: number;
23
36
  };
24
37
  export interface FabEmits {
25
38
  (e: 'click', event: any): void;
26
39
  (e: 'select', item: FabItem, index: number): void;
40
+ (e: 'update:offset', offset: {
41
+ x: number;
42
+ y: number;
43
+ }): void;
27
44
  }
28
45
  export interface FabItem {
29
46
  name?: string;
@@ -2,13 +2,25 @@ import { type FabProps, FabItem } from './common';
2
2
  declare const _default: import("vue").DefineComponent<FabProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
3
3
  click: (event: any) => any;
4
4
  select: (item: FabItem, index: number) => any;
5
+ "update:offset": (offset: {
6
+ x: number;
7
+ y: number;
8
+ }) => any;
5
9
  }, string, import("vue").PublicProps, Readonly<FabProps> & Readonly<{
6
10
  onClick?: ((event: any) => any) | undefined;
7
11
  onSelect?: ((item: FabItem, index: number) => any) | undefined;
12
+ "onUpdate:offset"?: ((offset: {
13
+ x: number;
14
+ y: number;
15
+ }) => any) | undefined;
8
16
  }>, {
17
+ axis: "x" | "y" | "both" | "none";
9
18
  duration: number;
10
19
  overlayClosable: boolean;
20
+ draggable: boolean;
11
21
  itemList: FabItem[];
12
22
  hideName: boolean;
23
+ gapX: number;
24
+ gapY: number;
13
25
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
14
26
  export default _default;