sard-uniapp 1.17.1 → 1.19.0

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 (79) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +5 -0
  3. package/components/button/button.vue +3 -1
  4. package/components/button/common.d.ts +1 -0
  5. package/components/button/index.scss +9 -0
  6. package/components/calendar-month/calendar-month.vue +8 -8
  7. package/components/cascader/cascader.vue +7 -0
  8. package/components/cascader-input/cascader-input.vue +1 -1
  9. package/components/config/index.d.ts +1 -0
  10. package/components/config/index.js +1 -0
  11. package/components/crop-image/crop-image.vue +7 -7
  12. package/components/datetime-picker/common.d.ts +7 -3
  13. package/components/datetime-picker/common.js +181 -9
  14. package/components/datetime-picker/datetime-picker.d.ts +1 -0
  15. package/components/datetime-picker/datetime-picker.vue +116 -20
  16. package/components/datetime-picker-input/common.d.ts +1 -0
  17. package/components/datetime-picker-input/datetime-picker-input.d.ts +1 -0
  18. package/components/datetime-picker-input/datetime-picker-input.vue +2 -0
  19. package/components/datetime-picker-popout/common.d.ts +1 -0
  20. package/components/datetime-picker-popout/datetime-picker-popout.d.ts +1 -0
  21. package/components/datetime-picker-popout/datetime-picker-popout.vue +2 -0
  22. package/components/datetime-range-picker/datetime-range-picker.vue +1 -0
  23. package/components/datetime-range-picker-input/datetime-range-picker-input.vue +1 -0
  24. package/components/datetime-range-picker-popout/datetime-range-picker-popout.vue +1 -0
  25. package/components/dialog-agent/common.d.ts +3 -0
  26. package/components/dialog-agent/dialog-agent.vue +10 -1
  27. package/components/dropdown/common.d.ts +5 -1
  28. package/components/dropdown/index.d.ts +1 -1
  29. package/components/dropdown-item/dropdown-item.d.ts +5 -7
  30. package/components/dropdown-item/dropdown-item.vue +56 -22
  31. package/components/empty/empty.vue +1 -1
  32. package/components/fab/fab.vue +1 -1
  33. package/components/floating-bubble/floating-bubble.vue +4 -4
  34. package/components/form/form.vue +4 -1
  35. package/components/form-item/index.scss +10 -0
  36. package/components/grid-item/grid-item.vue +1 -1
  37. package/components/icon/icon.vue +9 -4
  38. package/components/list-item/list-item.vue +1 -1
  39. package/components/marquee/marquee.vue +8 -5
  40. package/components/menu-item/menu-item.vue +1 -1
  41. package/components/navbar-item/navbar-item.vue +1 -1
  42. package/components/notice-bar/notice-bar.vue +8 -5
  43. package/components/notify/notify.vue +10 -7
  44. package/components/picker-item/index.scss +0 -1
  45. package/components/pull-down-refresh/pull-down-refresh.vue +15 -9
  46. package/components/rate/rate.vue +2 -2
  47. package/components/result/result.vue +1 -1
  48. package/components/share-sheet/share-sheet.vue +1 -1
  49. package/components/step/step.vue +1 -1
  50. package/components/swipe-action/common.d.ts +23 -0
  51. package/components/swipe-action/common.js +1 -0
  52. package/components/swipe-action/index.d.ts +1 -0
  53. package/components/swipe-action/index.js +1 -0
  54. package/components/swipe-action/index.scss +53 -0
  55. package/components/swipe-action/swipe-action.d.ts +16 -0
  56. package/components/swipe-action/swipe-action.vue +275 -0
  57. package/components/swipe-action/variables.scss +3 -0
  58. package/components/tabbar-item/tabbar-item.vue +1 -5
  59. package/components/timeline-item/timeline-item.vue +1 -5
  60. package/components/toast/toast.vue +10 -7
  61. package/global.d.ts +1 -0
  62. package/index.d.ts +1 -0
  63. package/index.js +1 -0
  64. package/index.scss +1 -0
  65. package/package.json +2 -7
  66. package/use/index.d.ts +3 -1
  67. package/use/index.js +3 -1
  68. package/use/useScrollSpy.js +4 -4
  69. package/use/useSimulatedClick.js +4 -4
  70. package/use/useSimulatedPress.js +5 -5
  71. package/use/useStopMovedClick.d.ts +6 -0
  72. package/use/useStopMovedClick.js +26 -0
  73. package/use/useTimeout.d.ts +11 -0
  74. package/use/useTimeout.js +39 -0
  75. package/use/useTimeoutLoading.js +9 -7
  76. package/utils/date.d.ts +33 -3
  77. package/utils/date.js +209 -11
  78. package/use/useSetTimeout.d.ts +0 -1
  79. package/use/useSetTimeout.js +0 -24
@@ -11,7 +11,14 @@
11
11
  <script>
12
12
  import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
13
13
  import { computed, ref, watch } from "vue";
14
- import { classNames, formatDate, stringifyStyle, toDate } from "../../utils";
14
+ import {
15
+ classNames,
16
+ formatDate,
17
+ lunarToSolar,
18
+ solarToLunar,
19
+ stringifyStyle,
20
+ toDate
21
+ } from "../../utils";
15
22
  import SarPicker from "../picker/picker.vue";
16
23
  import {
17
24
  correctDate,
@@ -39,6 +46,7 @@ export default _defineComponent({
39
46
  rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
40
47
  rootClass: { type: String, required: false },
41
48
  type: { type: String, required: false },
49
+ calendar: { type: String, required: false },
42
50
  min: { type: [Date, String], required: false },
43
51
  max: { type: [Date, String], required: false },
44
52
  modelValue: { type: [Date, String], required: false },
@@ -53,14 +61,20 @@ export default _defineComponent({
53
61
  const emit = __emit;
54
62
  const { t } = useTranslate("datetimePicker");
55
63
  const createColumnData = (types, currentDate) => {
56
- minValues = getBoundaryValue(false, minDate.value, currentDate);
57
- maxValues = getBoundaryValue(true, maxDate.value, currentDate);
64
+ minValues = getBoundaryValue(
65
+ props.calendar,
66
+ false,
67
+ minDate.value,
68
+ currentDate
69
+ );
70
+ maxValues = getBoundaryValue(props.calendar, true, maxDate.value, currentDate);
58
71
  const getColumnDataByType = (letter) => {
59
72
  const strategy = strategies[letter];
60
73
  const index = strategy[0];
61
74
  return getColumnData(
62
- maxValues[index] - minValues[index] + 1,
75
+ props.calendar,
63
76
  minValues[index],
77
+ maxValues[index],
64
78
  strategy[1],
65
79
  letter,
66
80
  currentDate,
@@ -74,14 +88,24 @@ export default _defineComponent({
74
88
  );
75
89
  };
76
90
  const getChangedLetter = (currentDate) => {
77
- const min = getBoundaryValue(false, minDate.value, currentDate);
78
- const max = getBoundaryValue(true, maxDate.value, currentDate);
91
+ const min = getBoundaryValue(
92
+ props.calendar,
93
+ false,
94
+ minDate.value,
95
+ currentDate
96
+ );
97
+ const max = getBoundaryValue(props.calendar, true, maxDate.value, currentDate);
79
98
  return letterArray.filter(
80
99
  (_, i) => min[i] !== minValues[i] || max[i] !== maxValues[i]
81
100
  );
82
101
  };
102
+ let lunarYearChanged = false;
83
103
  const updateColumns = (currentDate) => {
84
104
  const changedLetter = getChangedLetter(currentDate);
105
+ if (props.calendar === "lunar" && !changedLetter.includes("M") && innerType.value.includes("M") && lunarYearChanged) {
106
+ changedLetter.push("M");
107
+ lunarYearChanged = false;
108
+ }
85
109
  if (changedLetter.length) {
86
110
  const changedColumns = createColumnData(changedLetter, currentDate);
87
111
  const nextColumns = innerType.value.map((letter) => {
@@ -96,18 +120,66 @@ export default _defineComponent({
96
120
  }
97
121
  };
98
122
  const getDateByPickerValue = (value) => {
99
- const currEvery = letterArray.map((letter) => {
100
- const stratery = strategies[letter];
101
- for (let i = 0, l = innerType.value.length; i < l; i++) {
102
- if (innerType.value[i] === letter) {
103
- return value[i];
123
+ let currEvery;
124
+ if (props.calendar === "solar") {
125
+ currEvery = letterArray.map((letter) => {
126
+ const stratery = strategies[letter];
127
+ for (let i = 0, l = innerType.value.length; i < l; i++) {
128
+ if (innerType.value[i] === letter) {
129
+ return value[i];
130
+ }
104
131
  }
132
+ return stratery[4](innerValue.value);
133
+ });
134
+ } else {
135
+ const lunarDate = solarToLunar(
136
+ innerValue.value.getFullYear(),
137
+ innerValue.value.getMonth() + 1,
138
+ innerValue.value.getDate()
139
+ );
140
+ const yearIndex = innerType.value.indexOf("y");
141
+ if (yearIndex !== -1) {
142
+ lunarYearChanged = lunarDate.year !== value[yearIndex];
105
143
  }
106
- return stratery[4](innerValue.value);
107
- });
108
- correctDate(currEvery, minDate.value, maxDate.value);
109
- currEvery[1]--;
110
- const date = new Date(...currEvery);
144
+ currEvery = letterArray.map((letter) => {
145
+ for (let i = 0, l = innerType.value.length; i < l; i++) {
146
+ if (innerType.value[i] === letter) {
147
+ return value[i];
148
+ }
149
+ }
150
+ switch (letter) {
151
+ case "y":
152
+ return lunarDate.year;
153
+ case "M":
154
+ return lunarDate.month;
155
+ case "d":
156
+ return lunarDate.day;
157
+ default:
158
+ return strategies[letter][4](innerValue.value);
159
+ }
160
+ });
161
+ }
162
+ correctDate(
163
+ props.calendar,
164
+ currEvery,
165
+ minDate.value,
166
+ maxDate.value
167
+ );
168
+ let date;
169
+ if (props.calendar === "solar") {
170
+ currEvery[1]--;
171
+ date = new Date(...currEvery);
172
+ } else {
173
+ const solarDate = lunarToSolar(currEvery[0], currEvery[1], currEvery[2]);
174
+ date = new Date(
175
+ solarDate.year,
176
+ solarDate.month - 1,
177
+ solarDate.day,
178
+ currEvery[3],
179
+ currEvery[4],
180
+ currEvery[5]
181
+ );
182
+ }
111
183
  return date;
112
184
  };
113
185
  const normalizeValue = (value) => {
@@ -153,9 +225,29 @@ export default _defineComponent({
153
225
  }
154
226
  });
155
227
  const pickerValue = computed(() => {
156
- return innerType.value.map((letter) => {
157
- return strategies[letter][4](innerValue.value);
158
- });
228
+ if (props.calendar === "solar") {
229
+ return innerType.value.map((letter) => {
230
+ return strategies[letter][4](innerValue.value);
231
+ });
232
+ } else {
233
+ const lunarDate = solarToLunar(
234
+ innerValue.value.getFullYear(),
235
+ innerValue.value.getMonth() + 1,
236
+ innerValue.value.getDate()
237
+ );
238
+ return innerType.value.map((letter) => {
239
+ switch (letter) {
240
+ case "y":
241
+ return lunarDate.year;
242
+ case "M":
243
+ return lunarDate.month;
244
+ case "d":
245
+ return lunarDate.day;
246
+ default:
247
+ return strategies[letter][4](innerValue.value);
248
+ }
249
+ });
250
+ }
159
251
  });
160
252
  const columnsMap = {};
161
253
  let minValues = [];
@@ -168,7 +260,11 @@ export default _defineComponent({
168
260
  updateColumns(nextValue);
169
261
  emitChange();
170
262
  };
171
- const __returned__ = { props, emit, t, createColumnData, getChangedLetter, updateColumns, getDateByPickerValue, normalizeValue, innerType, minDate, maxDate, innerValue, get currentEmitValue() {
263
+ const __returned__ = { props, emit, t, createColumnData, getChangedLetter, get lunarYearChanged() {
264
+ return lunarYearChanged;
265
+ }, set lunarYearChanged(v) {
266
+ lunarYearChanged = v;
267
+ }, updateColumns, getDateByPickerValue, normalizeValue, innerType, minDate, maxDate, innerValue, get currentEmitValue() {
172
268
  return currentEmitValue;
173
269
  }, set currentEmitValue(v) {
174
270
  currentEmitValue = v;
@@ -6,6 +6,7 @@ export interface DatetimePickerInputProps extends DatetimePickerPopoutProps, Omi
6
6
  export declare const defaultDatetimePickerInputProps: () => {
7
7
  validateEvent: boolean;
8
8
  type: string;
9
+ calendar: "solar";
9
10
  };
10
11
  export interface DatetimePickerInputSlots extends DatetimePickerPopoutSlots {
11
12
  }
@@ -11,6 +11,7 @@ declare const __VLS_component: import("vue").DefineComponent<DatetimePickerInput
11
11
  }>, {
12
12
  type: string;
13
13
  validateEvent: boolean;
14
+ calendar: "solar" | "lunar";
14
15
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
16
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
16
17
  export default _default;
@@ -24,6 +24,7 @@
24
24
  :formatter="formatter"
25
25
  :value-format="valueFormat"
26
26
  :validate-event="validateEvent"
27
+ :calendar="calendar"
27
28
  @change="onChange"
28
29
  />
29
30
  </sar-popout-input>
@@ -62,6 +63,7 @@ export default _defineComponent({
62
63
  rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
63
64
  rootClass: { type: String, required: false },
64
65
  type: { type: String, required: false },
66
+ calendar: { type: String, required: false },
65
67
  min: { type: [Date, String], required: false },
66
68
  max: { type: [Date, String], required: false },
67
69
  modelValue: { type: [Date, String], required: false },
@@ -10,6 +10,7 @@ export interface DatetimePickerPopoutProps extends DatetimePickerProps {
10
10
  export declare const defaultDatetimePickerPopoutProps: () => {
11
11
  validateEvent: boolean;
12
12
  type: string;
13
+ calendar: "solar";
13
14
  };
14
15
  export interface DatetimePickerPopoutSlots extends DatetimePickerSlots {
15
16
  }
@@ -11,6 +11,7 @@ declare const __VLS_component: import("vue").DefineComponent<DatetimePickerPopou
11
11
  }>, {
12
12
  type: string;
13
13
  validateEvent: boolean;
14
+ calendar: "solar" | "lunar";
14
15
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
15
16
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
16
17
  export default _default;
@@ -18,6 +18,7 @@
18
18
  :filter="filter"
19
19
  :formatter="formatter"
20
20
  :value-format="valueFormat"
21
+ :calendar="calendar"
21
22
  @change="onChange"
22
23
  />
23
24
  </template>
@@ -60,6 +61,7 @@ export default _defineComponent({
60
61
  rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
61
62
  rootClass: { type: String, required: false },
62
63
  type: { type: String, required: false },
64
+ calendar: { type: String, required: false },
63
65
  min: { type: [Date, String], required: false },
64
66
  max: { type: [Date, String], required: false },
65
67
  modelValue: { type: [Date, String], required: false },
@@ -69,6 +69,7 @@ export default _defineComponent({
69
69
  rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
70
70
  rootClass: { type: String, required: false },
71
71
  type: { type: String, required: false },
72
+ calendar: { type: String, required: false },
72
73
  min: { type: [Date, String], required: false },
73
74
  max: { type: [Date, String], required: false },
74
75
  filter: { type: Function, required: false },
@@ -66,6 +66,7 @@ export default _defineComponent({
66
66
  rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
67
67
  rootClass: { type: String, required: false },
68
68
  type: { type: String, required: false },
69
+ calendar: { type: String, required: false },
69
70
  min: { type: [Date, String], required: false },
70
71
  max: { type: [Date, String], required: false },
71
72
  filter: { type: Function, required: false },
@@ -63,6 +63,7 @@ export default _defineComponent({
63
63
  rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
64
64
  rootClass: { type: String, required: false },
65
65
  type: { type: String, required: false },
66
+ calendar: { type: String, required: false },
66
67
  min: { type: [Date, String], required: false },
67
68
  max: { type: [Date, String], required: false },
68
69
  filter: { type: Function, required: false },
@@ -1,6 +1,9 @@
1
1
  import { type DialogProps } from '../dialog/common';
2
2
  export interface DialogAgentProps extends DialogProps {
3
3
  id?: string;
4
+ onClose?: () => void;
5
+ onCancel?: () => void;
6
+ onConfirm?: () => void;
4
7
  }
5
8
  export declare const defaultDialogAgentProps: () => {
6
9
  id: string;
@@ -1,5 +1,11 @@
1
1
  <template>
2
- <sar-dialog v-bind="innerProps" v-model:visible="innerProps.visible" />
2
+ <sar-dialog
3
+ v-bind="innerProps"
4
+ v-model:visible="innerProps.visible"
5
+ @confirm="innerProps.onConfirm"
6
+ @close="innerProps.onClose"
7
+ @cancel="innerProps.onCancel"
8
+ />
3
9
  </template>
4
10
 
5
11
  <script>
@@ -24,6 +30,9 @@ export default _defineComponent({
24
30
  __name: "dialog-agent",
25
31
  props: _mergeDefaults({
26
32
  id: { type: String, required: false },
33
+ onClose: { type: Function, required: false },
34
+ onCancel: { type: Function, required: false },
35
+ onConfirm: { type: Function, required: false },
27
36
  rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
28
37
  rootClass: { type: String, required: false },
29
38
  popupStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
@@ -1,4 +1,5 @@
1
1
  import { type StyleValue, type Ref } from 'vue';
2
+ import { type TransitionHookEmits } from '../popup/common';
2
3
  export interface DropdownProps {
3
4
  rootStyle?: StyleValue;
4
5
  rootClass?: string;
@@ -22,6 +23,8 @@ export interface DropdownOption {
22
23
  label?: string;
23
24
  value?: any;
24
25
  }
26
+ export type DropdownCloseType = 'overlay' | 'away' | 'other-button' | 'option' | 'button';
27
+ export type DropdownBeforeClose = (type: DropdownCloseType) => any | Promise<any>;
25
28
  export interface DropdownItemProps {
26
29
  rootStyle?: StyleValue;
27
30
  rootClass?: string;
@@ -33,6 +36,7 @@ export interface DropdownItemProps {
33
36
  visible?: boolean;
34
37
  separator?: string;
35
38
  placeholder?: string;
39
+ beforeClose?: DropdownBeforeClose;
36
40
  }
37
41
  export declare const defaultDropdownItemProps: {
38
42
  options: () => never[];
@@ -40,7 +44,7 @@ export declare const defaultDropdownItemProps: {
40
44
  export interface DropdownItemSlots {
41
45
  default?(props: Record<string, never>): any;
42
46
  }
43
- export interface DropdownItemEmits {
47
+ export interface DropdownItemEmits extends TransitionHookEmits {
44
48
  (e: 'update:model-value', value: any): void;
45
49
  (e: 'change', value: any): void;
46
50
  (e: 'update:visible', visible: boolean): void;
@@ -1 +1 @@
1
- export type { DropdownProps, DropdownSlots, DropdownItemProps, DropdownItemSlots, DropdownItemEmits, } from './common';
1
+ export type { DropdownProps, DropdownSlots, DropdownItemProps, DropdownItemSlots, DropdownItemEmits, DropdownCloseType, DropdownBeforeClose, } from './common';
@@ -1,13 +1,11 @@
1
1
  import { type DropdownItemProps, type DropdownItemSlots, type DropdownOption } from '../dropdown/common';
2
2
  declare function __VLS_template(): Readonly<DropdownItemSlots> & DropdownItemSlots;
3
- declare const __VLS_component: import("vue").DefineComponent<DropdownItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
4
- "update:model-value": (value: any) => any;
5
- change: (value: any) => any;
6
- "update:visible": (visible: boolean) => any;
3
+ declare const __VLS_component: import("vue").DefineComponent<DropdownItemProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
4
+ [x: string]: any;
5
+ } & {
6
+ [x: string]: any;
7
7
  }, string, import("vue").PublicProps, Readonly<DropdownItemProps> & Readonly<{
8
- "onUpdate:model-value"?: ((value: any) => any) | undefined;
9
- onChange?: ((value: any) => any) | undefined;
10
- "onUpdate:visible"?: ((visible: boolean) => any) | undefined;
8
+ [x: `on${Capitalize<any>}`]: ((...args: any) => any) | undefined;
11
9
  }>, {
12
10
  options: DropdownOption[];
13
11
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
@@ -47,17 +47,17 @@
47
47
  <slot>
48
48
  <sar-list inlaid>
49
49
  <sar-list-item
50
- v-for="(item, i) in options"
50
+ v-for="(option, i) in options"
51
51
  :key="i"
52
- :title="item.label"
52
+ :title="option.label"
53
53
  hover
54
54
  :root-class="
55
55
  classNames(
56
56
  bem.e('option'),
57
- bem.em('option', 'active', item.value === innerValue),
57
+ bem.em('option', 'active', option.value === innerValue),
58
58
  )
59
59
  "
60
- @click="onOptionClick(item)"
60
+ @click="onOptionClick(option)"
61
61
  >
62
62
  <template #arrow>
63
63
  <view :class="bem.e('option-icon')">
@@ -91,7 +91,10 @@ import {
91
91
  uniqid,
92
92
  getBoundingClientRect,
93
93
  getWindowInfo,
94
- isNullish
94
+ isNullish,
95
+ isFunction,
96
+ isObject,
97
+ noop
95
98
  } from "../../utils";
96
99
  import SarList from "../list/list.vue";
97
100
  import SarListItem from "../list-item/list-item.vue";
@@ -126,9 +129,10 @@ export default _defineComponent({
126
129
  modelValue: { type: null, required: false },
127
130
  visible: { type: Boolean, required: false },
128
131
  separator: { type: String, required: false },
129
- placeholder: { type: String, required: false }
132
+ placeholder: { type: String, required: false },
133
+ beforeClose: { type: Function, required: false }
130
134
  }, defaultDropdownItemProps),
131
- emits: ["update:model-value", "change", "update:visible"],
135
+ emits: ["update:model-value", "change", "update:visible", "before-enter", "enter", "after-enter", "enter-cancelled", "before-leave", "leave", "after-leave", "leave-cancelled", "visible-hook"],
132
136
  setup(__props, { expose: __expose, emit: __emit }) {
133
137
  __expose();
134
138
  const props = __props;
@@ -206,34 +210,55 @@ export default _defineComponent({
206
210
  emit("update:visible", visible);
207
211
  }
208
212
  };
213
+ let isClosing = false;
214
+ const perhapsClose = (type) => {
215
+ if (isClosing) {
216
+ return;
217
+ }
218
+ if (isFunction(props.beforeClose)) {
219
+ const result = props.beforeClose(type);
220
+ if (isObject(result) && isFunction(result.then)) {
221
+ isClosing = true;
222
+ return result.then(() => {
223
+ setInnerVisible(false);
224
+ }).catch(noop);
225
+ } else if (result === false) {
226
+ return;
227
+ }
228
+ }
229
+ setInnerVisible(false);
230
+ };
209
231
  const onItemClick = () => {
210
232
  if (!context.disabled && !props.disabled) {
211
- setInnerVisible(!innerVisible.value);
233
+ if (innerVisible.value) {
234
+ perhapsClose("button");
235
+ } else {
236
+ setInnerVisible(true);
237
+ }
212
238
  }
213
239
  };
214
- const onOptionClick = (item) => {
215
- if (item.value !== innerValue.value) {
216
- innerValue.value = item.value;
217
- emit("update:model-value", item.value);
218
- emit("change", item.value);
240
+ const onOptionClick = (option) => {
241
+ if (option.value !== innerValue.value) {
242
+ innerValue.value = option.value;
243
+ emit("update:model-value", option.value);
244
+ emit("change", option.value);
219
245
  }
220
- setInnerVisible(false);
246
+ perhapsClose("option");
221
247
  };
222
248
  const onOverlayClick = () => {
223
249
  if (context.overlayClosable) {
224
- setInnerVisible(false);
250
+ perhapsClose("overlay");
225
251
  }
226
252
  };
227
253
  const onAwayClick = () => {
228
254
  if (context.awayClosable) {
229
- setInnerVisible(false);
255
+ perhapsClose("away");
230
256
  }
231
257
  };
232
- const onAfterLeave = () => {
233
- wholeVisible.value = false;
234
- };
235
258
  const hide = () => {
236
- setInnerVisible(false);
259
+ if (innerVisible.value) {
260
+ perhapsClose("other-button");
261
+ }
237
262
  };
238
263
  onMounted(() => {
239
264
  context.register(instance, {
@@ -252,8 +277,13 @@ export default _defineComponent({
252
277
  increaseZIndex();
253
278
  }
254
279
  if (name === "after-leave") {
255
- onAfterLeave();
280
+ wholeVisible.value = false;
281
+ }
282
+ if (name === "leave-cancelled" || name === "after-leave") {
283
+ isClosing = false;
256
284
  }
285
+ emit("visible-hook", name);
286
+ emit(name);
257
287
  }
258
288
  })
259
289
  );
@@ -296,7 +326,11 @@ export default _defineComponent({
296
326
  const dropdownItemStyle = computed(() => {
297
327
  return stringifyStyle(props.rootStyle);
298
328
  });
299
- const __returned__ = { props, emit, bem, context, itemId, instance, innerValue, innerVisible, wholeVisible, popupVisible, popupInset, awayInset, setPosition, setInnerVisible, onItemClick, onOptionClick, onOverlayClick, onAwayClick, onAfterLeave, hide, zIndex, increaseZIndex, realVisible, transitionClass, onTransitionEnd, popupClass, popupStyle, currentLabel, currentArrow, popupEffect, dropdownItemClass, dropdownItemStyle, get classNames() {
329
+ const __returned__ = { props, emit, bem, context, itemId, instance, innerValue, innerVisible, wholeVisible, popupVisible, popupInset, awayInset, setPosition, setInnerVisible, get isClosing() {
330
+ return isClosing;
331
+ }, set isClosing(v) {
332
+ isClosing = v;
333
+ }, perhapsClose, onItemClick, onOptionClick, onOverlayClick, onAwayClick, hide, zIndex, increaseZIndex, realVisible, transitionClass, onTransitionEnd, popupClass, popupStyle, currentLabel, currentArrow, popupEffect, dropdownItemClass, dropdownItemStyle, get classNames() {
300
334
  return classNames;
301
335
  }, get isNullish() {
302
336
  return isNullish;
@@ -2,7 +2,7 @@
2
2
  <view :class="emptyClass" :style="emptyStyle">
3
3
  <view :class="bem.e('icon')" :style="iconStyle">
4
4
  <slot name="icon">
5
- <sar-icon :family="iconFamily || 'sari'" :name="icon" />
5
+ <sar-icon :family="iconFamily" :name="icon" />
6
6
  </slot>
7
7
  </view>
8
8
  <slot name="description">
@@ -27,7 +27,7 @@
27
27
  stringifyStyle({ background: item.background, color: item.color })
28
28
  "
29
29
  >
30
- <sar-icon :family="item.iconFamily || 'sari'" :name="item.icon" />
30
+ <sar-icon :family="item.iconFamily" :name="item.icon" />
31
31
  </view>
32
32
  </view>
33
33
  </view>
@@ -28,7 +28,7 @@ import {
28
28
  import {
29
29
  defaultFloatingBubbleProps
30
30
  } from "./common";
31
- import { useMouseDown, useSetTimeout } from "../../use";
31
+ import { useMouseDown, useTimeout } from "../../use";
32
32
  export default _defineComponent({
33
33
  ...{
34
34
  options: {
@@ -74,9 +74,9 @@ export default _defineComponent({
74
74
  }
75
75
  );
76
76
  const animated = ref(false);
77
- const [nonAnimatedLater, cancelNonAnimated] = useSetTimeout(() => {
77
+ const { start: nonAnimatedLater, stop: cancelNonAnimated } = useTimeout(() => {
78
78
  animated.value = false;
79
- });
79
+ }, 500);
80
80
  function getMinX() {
81
81
  return props.gapX;
82
82
  }
@@ -154,7 +154,7 @@ export default _defineComponent({
154
154
  }
155
155
  }
156
156
  animated.value = true;
157
- nonAnimatedLater(500);
157
+ nonAnimatedLater();
158
158
  bubbleRect = void 0;
159
159
  };
160
160
  const onMouseDown = useMouseDown(onTouchStart, onTouchMove, onTouchEnd);
@@ -116,7 +116,10 @@ export default _defineComponent({
116
116
  fields.push(formItemContext);
117
117
  };
118
118
  const removeField = (formItemContext) => {
119
- fields.splice(fields.indexOf(formItemContext), 1);
119
+ const index = fields.indexOf(formItemContext);
120
+ if (index !== -1) {
121
+ fields.splice(index, 1);
122
+ }
120
123
  };
121
124
  const validator = markRaw(new Validator());
122
125
  const { select } = useTranslate("form.defaultValidateMessages");
@@ -6,6 +6,16 @@
6
6
  flex-direction: row;
7
7
  padding: var(--sar-form-item-padding-y) var(--sar-form-item-padding-x);
8
8
 
9
+ &:first-child {
10
+ border-top-left-radius: inherit;
11
+ border-top-right-radius: inherit;
12
+ }
13
+
14
+ &:last-child {
15
+ border-bottom-left-radius: inherit;
16
+ border-bottom-right-radius: inherit;
17
+ }
18
+
9
19
  &:not(:first-child) {
10
20
  &::before {
11
21
  @include border-top(var(--sar-form-item-border-color));
@@ -14,7 +14,7 @@
14
14
  :name="icon"
15
15
  :color="iconColor"
16
16
  :size="iconSize"
17
- :family="iconFamily || 'sari'"
17
+ :family="iconFamily"
18
18
  />
19
19
  </slot>
20
20
  </view>
@@ -33,12 +33,17 @@ export default _defineComponent({
33
33
  return isFileUrl(props.name);
34
34
  });
35
35
  const iconClass = computed(() => {
36
+ if (isImg.value) {
37
+ return classNames(bem.b(), props.rootClass);
38
+ }
39
+ if (props.name.includes(":")) {
40
+ const [family, name] = props.name.split(":");
41
+ return classNames(bem.b(), family, `${family}-${name}`, props.rootClass);
42
+ }
36
43
  return classNames(
37
44
  bem.b(),
38
- {
39
- [props.family]: !isImg.value,
40
- [`${props.family}-${props.name}`]: !isImg.value
41
- },
45
+ props.family,
46
+ `${props.family}-${props.name}`,
42
47
  props.rootClass
43
48
  );
44
49
  });
@@ -11,7 +11,7 @@
11
11
  :name="icon"
12
12
  :color="iconColor"
13
13
  :size="iconSize"
14
- :family="iconFamily || 'sari'"
14
+ :family="iconFamily"
15
15
  />
16
16
  </slot>
17
17
  </view>