sard-uniapp 1.21.2 → 1.22.1

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 (143) hide show
  1. package/CHANGELOG.md +26 -1
  2. package/README.md +1 -1
  3. package/components/accordion/README.md +13 -6
  4. package/components/accordion/accordion.vue +10 -3
  5. package/components/accordion/common.d.ts +2 -0
  6. package/components/accordion/index.scss +6 -0
  7. package/components/accordion-item/accordion-item.vue +6 -1
  8. package/components/accordion-item/index.scss +12 -0
  9. package/components/action-sheet/README.md +15 -6
  10. package/components/action-sheet/action-sheet.d.ts +6 -10
  11. package/components/action-sheet/action-sheet.vue +16 -2
  12. package/components/action-sheet/common.d.ts +2 -1
  13. package/components/calendar-input/README.md +9 -0
  14. package/components/calendar-input/calendar-input.d.ts +13 -8
  15. package/components/calendar-input/calendar-input.vue +39 -4
  16. package/components/calendar-input/common.d.ts +3 -1
  17. package/components/calendar-popout/README.md +15 -5
  18. package/components/calendar-popout/calendar-popout.d.ts +5 -7
  19. package/components/calendar-popout/calendar-popout.vue +19 -12
  20. package/components/calendar-popout/common.d.ts +3 -1
  21. package/components/cascader-input/README.md +8 -1
  22. package/components/cascader-input/cascader-input.d.ts +5 -10
  23. package/components/cascader-input/cascader-input.vue +39 -4
  24. package/components/cascader-input/common.d.ts +2 -2
  25. package/components/cascader-popout/README.md +16 -6
  26. package/components/cascader-popout/cascader-popout.d.ts +5 -9
  27. package/components/cascader-popout/cascader-popout.vue +19 -12
  28. package/components/cascader-popout/common.d.ts +3 -1
  29. package/components/checkbox-input/README.md +9 -0
  30. package/components/checkbox-input/checkbox-input.d.ts +13 -8
  31. package/components/checkbox-input/checkbox-input.vue +39 -4
  32. package/components/checkbox-input/common.d.ts +3 -1
  33. package/components/checkbox-popout/README.md +15 -5
  34. package/components/checkbox-popout/checkbox-popout.d.ts +5 -7
  35. package/components/checkbox-popout/checkbox-popout.vue +14 -6
  36. package/components/checkbox-popout/common.d.ts +3 -1
  37. package/components/config/index.d.ts +5 -0
  38. package/components/config/index.js +5 -0
  39. package/components/crop-image/README.md +12 -3
  40. package/components/crop-image/common.d.ts +2 -1
  41. package/components/crop-image/crop-image.d.ts +5 -3
  42. package/components/crop-image/crop-image.vue +16 -2
  43. package/components/datetime-picker-input/README.md +9 -0
  44. package/components/datetime-picker-input/common.d.ts +2 -2
  45. package/components/datetime-picker-input/datetime-picker-input.d.ts +5 -7
  46. package/components/datetime-picker-input/datetime-picker-input.vue +39 -4
  47. package/components/datetime-picker-popout/README.md +15 -5
  48. package/components/datetime-picker-popout/common.d.ts +3 -1
  49. package/components/datetime-picker-popout/datetime-picker-popout.d.ts +5 -7
  50. package/components/datetime-picker-popout/datetime-picker-popout.vue +21 -3
  51. package/components/datetime-range-picker-input/README.md +9 -0
  52. package/components/datetime-range-picker-input/common.d.ts +2 -2
  53. package/components/datetime-range-picker-input/datetime-range-picker-input.d.ts +5 -7
  54. package/components/datetime-range-picker-input/datetime-range-picker-input.vue +39 -4
  55. package/components/datetime-range-picker-popout/README.md +15 -5
  56. package/components/datetime-range-picker-popout/common.d.ts +3 -1
  57. package/components/datetime-range-picker-popout/datetime-range-picker-popout.d.ts +5 -7
  58. package/components/datetime-range-picker-popout/datetime-range-picker-popout.vue +21 -3
  59. package/components/dialog/dialog.d.ts +1 -1
  60. package/components/dialog-agent/dialog-agent.d.ts +1 -1
  61. package/components/dnd/README.md +120 -0
  62. package/components/dnd/common.d.ts +49 -0
  63. package/components/dnd/common.js +1 -0
  64. package/components/dnd/dnd.d.ts +37 -0
  65. package/components/dnd/dnd.vue +136 -0
  66. package/components/dnd/index.d.ts +1 -0
  67. package/components/dnd/index.js +1 -0
  68. package/components/dnd/index.scss +11 -0
  69. package/components/dnd/variables.scss +7 -0
  70. package/components/dnd-handle/common.d.ts +12 -0
  71. package/components/dnd-handle/common.js +1 -0
  72. package/components/dnd-handle/dnd-handle.d.ts +10 -0
  73. package/components/dnd-handle/dnd-handle.vue +89 -0
  74. package/components/dnd-handle/index.d.ts +1 -0
  75. package/components/dnd-handle/index.js +1 -0
  76. package/components/dnd-handle/index.scss +13 -0
  77. package/components/dnd-item/common.d.ts +21 -0
  78. package/components/dnd-item/common.js +1 -0
  79. package/components/dnd-item/dnd-item.d.ts +10 -0
  80. package/components/dnd-item/dnd-item.vue +193 -0
  81. package/components/dnd-item/index.d.ts +1 -0
  82. package/components/dnd-item/index.js +1 -0
  83. package/components/dnd-item/index.scss +28 -0
  84. package/components/floating-bubble/index.scss +1 -0
  85. package/components/form/README.md +6 -5
  86. package/components/form/common.d.ts +4 -0
  87. package/components/form-item/form-item.vue +10 -4
  88. package/components/picker-input/README.md +9 -0
  89. package/components/picker-input/common.d.ts +2 -2
  90. package/components/picker-input/picker-input.d.ts +6 -8
  91. package/components/picker-input/picker-input.vue +41 -4
  92. package/components/picker-popout/README.md +15 -5
  93. package/components/picker-popout/common.d.ts +3 -1
  94. package/components/picker-popout/picker-popout.d.ts +6 -8
  95. package/components/picker-popout/picker-popout.vue +21 -3
  96. package/components/popout/popout.d.ts +1 -1
  97. package/components/popout-input/README.md +20 -11
  98. package/components/popout-input/common.d.ts +10 -0
  99. package/components/popout-input/common.js +2 -1
  100. package/components/popout-input/index.scss +1 -0
  101. package/components/popout-input/popout-input.d.ts +5 -1
  102. package/components/popout-input/popout-input.vue +22 -7
  103. package/components/popup/README.md +24 -22
  104. package/components/popup/common.d.ts +3 -0
  105. package/components/popup/popup.d.ts +8 -5
  106. package/components/popup/popup.vue +25 -2
  107. package/components/radio-input/README.md +9 -0
  108. package/components/radio-input/common.d.ts +3 -1
  109. package/components/radio-input/radio-input.d.ts +13 -8
  110. package/components/radio-input/radio-input.vue +39 -4
  111. package/components/radio-popout/README.md +15 -5
  112. package/components/radio-popout/common.d.ts +3 -1
  113. package/components/radio-popout/radio-popout.d.ts +5 -7
  114. package/components/radio-popout/radio-popout.vue +14 -6
  115. package/components/rate/rate.d.ts +1 -1
  116. package/components/share-sheet/README.md +15 -6
  117. package/components/share-sheet/common.d.ts +2 -1
  118. package/components/share-sheet/share-sheet.d.ts +6 -10
  119. package/components/share-sheet/share-sheet.vue +17 -3
  120. package/components/stepper/common.d.ts +1 -1
  121. package/components/stepper/stepper.vue +1 -1
  122. package/components/style/mixins/disable-scroll.scss +14 -0
  123. package/components/style/mixins.scss +1 -0
  124. package/components/style/variables.scss +4 -0
  125. package/components/tree/common.d.ts +1 -0
  126. package/components/tree/index.scss +4 -0
  127. package/components/tree/tree.vue +33 -21
  128. package/components/tree/variables.scss +1 -2
  129. package/components/tree-node/tree-node.vue +2 -0
  130. package/global.d.ts +3 -0
  131. package/index.d.ts +3 -0
  132. package/index.js +3 -0
  133. package/index.scss +1 -0
  134. package/package.json +2 -2
  135. package/use/index.d.ts +1 -0
  136. package/use/index.js +1 -0
  137. package/use/useFormPopout.d.ts +6 -2
  138. package/use/useFormPopout.js +9 -1
  139. package/use/useKeyList.d.ts +5 -0
  140. package/use/useKeyList.js +15 -0
  141. package/use/usePopoutInput.d.ts +4 -1
  142. package/use/usePopoutInput.js +5 -0
  143. package/utils/array.js +6 -6
@@ -0,0 +1,193 @@
1
+ <template>
2
+ <view :class="dndItemClass" :style="dndItemStyle">
3
+ <slot></slot>
4
+ </view>
5
+ </template>
6
+
7
+ <script>
8
+ import { defineComponent as _defineComponent } from "vue";
9
+ import {
10
+ computed,
11
+ getCurrentInstance,
12
+ inject,
13
+ onBeforeUnmount,
14
+ onMounted,
15
+ provide,
16
+ ref
17
+ } from "vue";
18
+ import {
19
+ classNames,
20
+ stringifyStyle,
21
+ createBem,
22
+ uniqid,
23
+ getBoundingClientRect
24
+ } from "../../utils";
25
+ import {
26
+ dndItemContextKey
27
+ } from "./common";
28
+ import { dndContextKey } from "../dnd/common";
29
+ /**
30
+ * @property {string} rootClass 组件根元素类名,默认值:-。
31
+ * @property {StyleValue} rootStyle 组件根元素样式,默认值:-。
32
+ * @property {DndItemInfo} itemInfo 组件根元素样式,默认值:-。
33
+ */
34
+ export default _defineComponent({
35
+ ...{
36
+ options: {
37
+ virtualHost: true,
38
+ styleIsolation: "shared"
39
+ }
40
+ },
41
+ __name: "dnd-item",
42
+ props: {
43
+ rootStyle: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true },
44
+ rootClass: { type: String, required: false },
45
+ itemInfo: { type: Object, required: true }
46
+ },
47
+ setup(__props, { expose: __expose }) {
48
+ const props = __props;
49
+ const bem = createBem("dnd-item");
50
+ const dndContext = inject(dndContextKey);
51
+ if (!dndContext) {
52
+ throw new Error("DndItem must be included in Dnd.");
53
+ }
54
+ const instance = getCurrentInstance();
55
+ const itemId = uniqid();
56
+ let dropItemInfo = null;
57
+ let currentIndex = -1;
58
+ let targetIndex = 0;
59
+ const translateY = ref(0);
60
+ const getNodeRect = () => {
61
+ return getBoundingClientRect(`.${itemId}`, instance);
62
+ };
63
+ onMounted(() => {
64
+ dndContext.addRectItem(getNodeRect);
65
+ });
66
+ onBeforeUnmount(() => {
67
+ dndContext.removeRectItem(getNodeRect);
68
+ });
69
+ let rectInfoList = null;
70
+ const immediateStart = async () => {
71
+ Promise.all(dndContext.rectItems.map((getRect) => getRect())).then(
72
+ (rects) => {
73
+ rectInfoList = rects.sort((a, b) => a.top - b.top).map((rect, i) => {
74
+ return {
75
+ rect,
76
+ itemInfo: dndContext.list[i].itemInfo
77
+ };
78
+ });
79
+ }
80
+ );
81
+ };
82
+ const start = async () => {
83
+ dndContext.dragging = true;
84
+ const itemInfo = props.itemInfo;
85
+ itemInfo.dragging = true;
86
+ };
87
+ const move = (delta) => {
88
+ if (!rectInfoList) return;
89
+ if (currentIndex === -1) {
90
+ currentIndex = rectInfoList.findIndex(
91
+ (item) => item.itemInfo === props.itemInfo
92
+ );
93
+ dndContext.currentHeight = rectInfoList[currentIndex].rect.height;
94
+ dndContext.dragStart(currentIndex);
95
+ }
96
+ translateY.value = delta;
97
+ const { rect } = rectInfoList[currentIndex];
98
+ targetIndex = (() => {
99
+ if (delta < 0) {
100
+ const top = rect.top + delta;
101
+ for (let i = 0; i < currentIndex; i++) {
102
+ const targetRect = rectInfoList[i].rect;
103
+ if (top < targetRect.top + targetRect.height / 2) {
104
+ return i;
105
+ }
106
+ }
107
+ } else if (delta > 0) {
108
+ const bottom = rect.bottom + delta;
109
+ for (let i = rectInfoList.length - 1; i > currentIndex; i--) {
110
+ const targetRect = rectInfoList[i].rect;
111
+ if (bottom > targetRect.bottom - targetRect.height / 2) {
112
+ return i;
113
+ }
114
+ }
115
+ }
116
+ return currentIndex;
117
+ })();
118
+ const targetItemInfo = rectInfoList[targetIndex].itemInfo;
119
+ if (dropItemInfo !== targetItemInfo) {
120
+ rectInfoList.forEach((item, index) => {
121
+ item.itemInfo.offset = index < currentIndex ? index >= targetIndex ? 1 : 0 : index > currentIndex ? index <= targetIndex ? -1 : 0 : 0;
122
+ });
123
+ if (dropItemInfo) {
124
+ dndContext.dragMove(currentIndex, targetIndex);
125
+ }
126
+ dropItemInfo = targetItemInfo;
127
+ }
128
+ };
129
+ const end = () => {
130
+ const _currentIndex = currentIndex;
131
+ const _targetIndex = dropItemInfo ? targetIndex : currentIndex;
132
+ rectInfoList = null;
133
+ dropItemInfo = null;
134
+ dndContext.dragging = false;
135
+ const itemInfo = props.itemInfo;
136
+ itemInfo.dragging = false;
137
+ translateY.value = 0;
138
+ currentIndex = -1;
139
+ dndContext.list.forEach(({ itemInfo: itemInfo2 }) => {
140
+ itemInfo2.offset = 0;
141
+ });
142
+ dndContext.drop(_currentIndex, _targetIndex);
143
+ };
144
+ provide(dndItemContextKey, {
145
+ immediateStart,
146
+ start,
147
+ move,
148
+ end
149
+ });
150
+ __expose({});
151
+ const dndItemClass = computed(() => {
152
+ return classNames(
153
+ bem.b(),
154
+ bem.m("active", props.itemInfo.dragging),
155
+ bem.m("passive", !props.itemInfo.dragging && dndContext.dragging),
156
+ itemId,
157
+ props.rootClass
158
+ );
159
+ });
160
+ const dndItemStyle = computed(() => {
161
+ const y = props.itemInfo.dragging ? translateY.value : dndContext.currentHeight * props.itemInfo.offset;
162
+ return stringifyStyle(
163
+ {
164
+ transform: `translate3d(0,${y}px,0)`
165
+ },
166
+ props.rootStyle
167
+ );
168
+ });
169
+ const __returned__ = { props, bem, dndContext, instance, itemId, get dropItemInfo() {
170
+ return dropItemInfo;
171
+ }, set dropItemInfo(v) {
172
+ dropItemInfo = v;
173
+ }, get currentIndex() {
174
+ return currentIndex;
175
+ }, set currentIndex(v) {
176
+ currentIndex = v;
177
+ }, get targetIndex() {
178
+ return targetIndex;
179
+ }, set targetIndex(v) {
180
+ targetIndex = v;
181
+ }, translateY, getNodeRect, get rectInfoList() {
182
+ return rectInfoList;
183
+ }, set rectInfoList(v) {
184
+ rectInfoList = v;
185
+ }, immediateStart, start, move, end, dndItemClass, dndItemStyle };
186
+ return __returned__;
187
+ }
188
+ });
189
+ </script>
190
+
191
+ <style lang="scss">
192
+ @import './index.scss';
193
+ </style>
@@ -0,0 +1 @@
1
+ export type { DndItemProps, DndItemSlots, DndItemEmits, DndItemExpose, } from './common';
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,28 @@
1
+ @use '../style/base' as *;
2
+
3
+ @include bem(dnd-item) {
4
+ @include b() {
5
+ @include universal;
6
+
7
+ &:first-child {
8
+ border-top-left-radius: inherit;
9
+ border-top-right-radius: inherit;
10
+ }
11
+
12
+ &:last-child {
13
+ border-bottom-left-radius: inherit;
14
+ border-bottom-right-radius: inherit;
15
+ }
16
+
17
+ @include m(active) {
18
+ z-index: 1;
19
+ box-shadow: var(--sar-dnd-dragging-shadow);
20
+ }
21
+
22
+ @include m(passive) {
23
+ transition:
24
+ transform var(--sar-dnd-duration),
25
+ opacity var(--sar-dnd-duration);
26
+ }
27
+ }
28
+ }
@@ -17,6 +17,7 @@
17
17
  box-shadow: var(--sar-floating-bubble-box-shadow);
18
18
  opacity: 0;
19
19
  cursor: pointer;
20
+ touch-action: none;
20
21
 
21
22
  &:active {
22
23
  opacity: var(--sar-floating-bubble-active-opacity);
@@ -217,11 +217,12 @@ import FormItem from 'sard-uniapp/components/form-item/form-item.vue'
217
217
 
218
218
  ### FormItemSlots
219
219
 
220
- | 插槽 | 描述 | 属性 |
221
- | -------- | ------------------------------------ | ------------------------ |
222
- | default | 自定义默认内容 | - |
223
- | label | 自定义标签内容 | - |
224
- | validate | 同默认插槽,额外接受当前验证状态属性 | { state: ValidateState } |
220
+ | 插槽 | 描述 | 属性 |
221
+ | ---------------------- | ------------------------------------ | --------------------------------------- |
222
+ | default | 自定义默认内容 | - |
223
+ | label | 自定义标签内容 | - |
224
+ | validate | 同默认插槽,额外接受当前验证状态属性 | { state: ValidateState } |
225
+ | error <sup>1.22+</sup> | 自定义错误信息内容 | { message: string; showError: boolean } |
225
226
 
226
227
  ### FormItemExpose
227
228
 
@@ -72,6 +72,10 @@ export interface FormItemSlots {
72
72
  validate?(props: {
73
73
  state: ValidateState;
74
74
  }): any;
75
+ error?(props: {
76
+ message: string;
77
+ showError: boolean;
78
+ }): any;
75
79
  }
76
80
  export interface FormItemExpose {
77
81
  validate: (trigger?: string | string[]) => Promise<void>;
@@ -11,9 +11,15 @@
11
11
  <view :class="bem.e('content')">
12
12
  <slot></slot>
13
13
  <slot name="validate" :state="validateState"></slot>
14
- <view v-if="shouldShowError" :class="bem.e('error')">
15
- {{ validateMessage }}
16
- </view>
14
+ <slot
15
+ name="error"
16
+ :message="validateMessage"
17
+ :show-error="shouldShowError"
18
+ >
19
+ <view v-if="shouldShowError" :class="bem.e('error')">
20
+ {{ validateMessage }}
21
+ </view>
22
+ </slot>
17
23
  </view>
18
24
  </view>
19
25
  </template>
@@ -142,7 +148,7 @@ export default _defineComponent({
142
148
  }
143
149
  );
144
150
  const shouldShowError = computed(() => {
145
- return props.showError && formContext.showError && validateMessage.value;
151
+ return !!props.showError && !!formContext.showError && !!validateMessage.value;
146
152
  });
147
153
  const validateState = ref("");
148
154
  const mergedValidateTrigger = computed(() => {
@@ -41,6 +41,15 @@ import PickerInput from 'sard-uniapp/components/picker-input/picker-input.vue'
41
41
  | clearable | 是否显示清空按钮 | boolean | false |
42
42
  | placeholder | 输入框占位符内容 | string | - |
43
43
  | value-on-clear <sup>1.19.2+</sup> | 设置点击清除按钮后的值 | () => any | () => undefined |
44
+ | arrow <sup>1.22+</sup> | 自定义箭头图标名 | string | 'caret-right' |
45
+ | arrow-family <sup>1.22+</sup> | 自定义箭头图标字体 | string | 'sari' |
46
+ | input-props <sup>1.22+</sup> | 自定义输入框组件属性 | InputProps | - |
47
+
48
+ ### PickerInputSlots
49
+
50
+ | 插槽 | 描述 | 属性 |
51
+ | ---------------------- | ---------- | ---------- |
52
+ | arrow <sup>1.22+</sup> | 自定义箭头 | () => void |
44
53
 
45
54
  ### PickerSlots
46
55
 
@@ -1,4 +1,4 @@
1
- import { type PopoutInputProps } from '../popout-input/common';
1
+ import { type PopoutInputSlots, type PopoutInputProps } from '../popout-input/common';
2
2
  import { type PickerPopoutSlots, type PickerPopoutEmits, type PickerPopoutProps } from '../picker-popout/common';
3
3
  export interface PickerInputProps extends PickerPopoutProps, Omit<PopoutInputProps, 'modelValue'> {
4
4
  valueOnClear?: () => any;
@@ -9,7 +9,7 @@ export declare const defaultPickerInputProps: () => {
9
9
  columns: () => never[];
10
10
  immediateChange: boolean;
11
11
  };
12
- export interface PickerInputSlots extends PickerPopoutSlots {
12
+ export interface PickerInputSlots extends PickerPopoutSlots, PopoutInputSlots {
13
13
  }
14
14
  export interface PickerInputEmits extends PickerPopoutEmits {
15
15
  }
@@ -1,18 +1,16 @@
1
1
  import { type PickerOption } from '../picker/common';
2
2
  import { type PickerInputProps, type PickerInputSlots } from './common';
3
3
  declare function __VLS_template(): Readonly<PickerInputSlots> & PickerInputSlots;
4
- declare const __VLS_component: import("vue").DefineComponent<PickerInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
5
- "update:model-value": (value: any) => any;
6
- change: (value: any) => any;
7
- "update:visible": (visible: boolean) => any;
4
+ declare const __VLS_component: import("vue").DefineComponent<PickerInputProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
+ [x: string]: any;
6
+ } & {
7
+ [x: string]: any;
8
8
  }, string, import("vue").PublicProps, Readonly<PickerInputProps> & Readonly<{
9
- "onUpdate:model-value"?: ((value: any) => any) | undefined;
10
- onChange?: ((value: any) => any) | undefined;
11
- "onUpdate:visible"?: ((visible: boolean) => any) | undefined;
9
+ [x: `on${Capitalize<any>}`]: ((...args: any) => any) | undefined;
12
10
  }>, {
13
11
  valueOnClear: () => any;
14
- validateEvent: boolean;
15
12
  columns: PickerOption[] | PickerOption[][];
13
+ validateEvent: boolean;
16
14
  immediateChange: boolean;
17
15
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
18
16
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
@@ -7,9 +7,16 @@
7
7
  :clearable="clearable"
8
8
  :root-class="rootClass"
9
9
  :root-style="rootStyle"
10
+ :arrow="arrow"
11
+ :internal-arrow="$slots.arrow ? 1 : 0"
12
+ :input-props="inputProps"
10
13
  @clear="onClear"
11
14
  @click="show"
12
15
  >
16
+ <template v-if="$slots.arrow" #arrow>
17
+ <slot name="arrow"></slot>
18
+ </template>
19
+
13
20
  <sar-picker-popout
14
21
  v-model:visible="innerVisible"
15
22
  v-model="innerValue"
@@ -23,6 +30,8 @@
23
30
  :validate-event="validateEvent"
24
31
  :internal-custom="$slots.custom ? 1 : 0"
25
32
  @change="onChange"
33
+ @visible-hook="onVisibleHook"
34
+ @confirm="onConfirm"
26
35
  >
27
36
  <template
28
37
  v-if="$slots.custom"
@@ -83,8 +92,21 @@ import {
83
92
  * @property {boolean} clearable 是否显示清空按钮,默认值:false。
84
93
  * @property {string} placeholder 输入框占位符内容,默认值:-。
85
94
  * @property {() => any} valueOnClear 设置点击清除按钮后的值,默认值:() => undefined。
95
+ * @property {string} arrow 自定义箭头图标名,默认值:'caret-right'。
96
+ * @property {string} arrowFamily 自定义箭头图标字体,默认值:'sari'。
97
+ * @property {InputProps} inputProps 自定义输入框组件属性,默认值:-。
86
98
  * @event {(visible: boolean) => void} update 弹出框显隐时触发
87
99
  * @event {(value: any) => void} change 选择器输入组件值改变时触发
100
+ * @event {() => void} confirm 点击确定按钮时触发
101
+ * @event {(name: TransitionHookName) => void} visible-hook 入场/退场动画状态改变时触发
102
+ * @event {() => void} before-enter 入场动画开始前触发
103
+ * @event {() => void} enter 入场动画开始时触发
104
+ * @event {() => void} after-enter 入场动画结束时触发
105
+ * @event {() => void} enter-cancelled 入场动画取消时触发
106
+ * @event {() => void} before-leave 退场动画开始前触发
107
+ * @event {() => void} leave 退场动画开始时触发
108
+ * @event {() => void} after-leave 退场动画结束时触发
109
+ * @event {() => void} leave-cancelled 退场动画取消时触发
88
110
  */
89
111
  export default _defineComponent({
90
112
  components: {
@@ -117,14 +139,26 @@ export default _defineComponent({
117
139
  disabled: { type: Boolean, required: false },
118
140
  clearable: { type: Boolean, required: false },
119
141
  loading: { type: Boolean, required: false },
120
- multiline: { type: Boolean, required: false }
142
+ multiline: { type: Boolean, required: false },
143
+ arrow: { type: String, required: false },
144
+ arrowFamily: { type: String, required: false },
145
+ internalArrow: { type: Number, required: false },
146
+ inputProps: { type: Object, required: false }
121
147
  }, defaultPickerInputProps()),
122
- emits: ["update:visible", "update:model-value", "change"],
148
+ emits: ["update:visible", "update:model-value", "change", "confirm", "before-enter", "enter", "after-enter", "enter-cancelled", "before-leave", "leave", "after-leave", "leave-cancelled", "visible-hook"],
123
149
  setup(__props, { expose: __expose, emit: __emit }) {
124
150
  __expose();
125
151
  const props = __props;
126
152
  const emit = __emit;
127
- const { innerVisible, innerValue, inputValue, show, onChange, onClear } = usePopoutInput(props, emit);
153
+ const {
154
+ innerVisible,
155
+ innerValue,
156
+ inputValue,
157
+ show,
158
+ onChange,
159
+ onClear,
160
+ onVisibleHook
161
+ } = usePopoutInput(props, emit);
128
162
  const fieldKeys = computed(() => {
129
163
  return Object.assign({}, defaultOptionKeys, props.optionKeys);
130
164
  });
@@ -151,7 +185,10 @@ export default _defineComponent({
151
185
  immediate: true
152
186
  }
153
187
  );
154
- const __returned__ = { props, emit, innerVisible, innerValue, inputValue, show, onChange, onClear, fieldKeys, getOutletText, getInputValue, SarPopoutInput, SarPickerPopout };
188
+ const onConfirm = () => {
189
+ emit("confirm");
190
+ };
191
+ const __returned__ = { props, emit, innerVisible, innerValue, inputValue, show, onChange, onClear, onVisibleHook, fieldKeys, getOutletText, getInputValue, onConfirm, SarPopoutInput, SarPickerPopout };
155
192
  return __returned__;
156
193
  }
157
194
  });
@@ -44,8 +44,18 @@ import PickerPopout from 'sard-uniapp/components/picker-popout/picker-popout.vue
44
44
 
45
45
  ### PickerPopoutEmits
46
46
 
47
- | 事件 | 描述 | 类型 |
48
- | ------------------ | -------------------------- | -------------------------- |
49
- | update:model-value | 选择器输入组件值改变时触发 | (value: any) => void |
50
- | change | 选择器输入组件值改变时触发 | (value: any) => void |
51
- | update:visible | 弹出框显隐时触发 | (visible: boolean) => void |
47
+ | 事件 | 描述 | 类型 |
48
+ | ---------------------------------- | --------------------------- | ---------------------------------- |
49
+ | update:model-value | 选择器输入组件值改变时触发 | (value: any) => void |
50
+ | change | 选择器输入组件值改变时触发 | (value: any) => void |
51
+ | update:visible | 弹出框显隐时触发 | (visible: boolean) => void |
52
+ | confirm <sup>1.22.1+</sup> | 点击确定按钮时触发 | () => void |
53
+ | visible-hook <sup>1.22.1+</sup> | 入场/退场动画状态改变时触发 | (name: TransitionHookName) => void |
54
+ | before-enter <sup>1.22.1+</sup> | 入场动画开始前触发 | () => void |
55
+ | enter <sup>1.22.1+</sup> | 入场动画开始时触发 | () => void |
56
+ | after-enter <sup>1.22.1+</sup> | 入场动画结束时触发 | () => void |
57
+ | enter-cancelled <sup>1.22.1+</sup> | 入场动画取消时触发 | () => void |
58
+ | before-leave <sup>1.22.1+</sup> | 退场动画开始前触发 | () => void |
59
+ | leave <sup>1.22.1+</sup> | 退场动画开始时触发 | () => void |
60
+ | after-leave <sup>1.22.1+</sup> | 退场动画结束时触发 | () => void |
61
+ | leave-cancelled <sup>1.22.1+</sup> | 退场动画取消时触发 | () => void |
@@ -1,5 +1,6 @@
1
1
  import { type StyleValue } from 'vue';
2
2
  import { type PickerSlots, type PickerProps } from '../picker/common';
3
+ import { type TransitionHookEmits } from '../popup/common';
3
4
  export interface PickerPopoutProps extends PickerProps {
4
5
  visible?: boolean;
5
6
  title?: string;
@@ -14,10 +15,11 @@ export declare const defaultPickerPopoutProps: () => {
14
15
  };
15
16
  export interface PickerPopoutSlots extends PickerSlots {
16
17
  }
17
- export interface PickerPopoutEmits {
18
+ export interface PickerPopoutEmits extends TransitionHookEmits {
18
19
  (e: 'update:visible', visible: boolean): void;
19
20
  (e: 'update:model-value', value: any): void;
20
21
  (e: 'change', value: any): void;
22
+ (e: 'confirm'): void;
21
23
  }
22
24
  export interface PickerPopoutExpose {
23
25
  }
@@ -1,16 +1,14 @@
1
1
  import { type PickerPopoutProps, type PickerPopoutSlots } from './common';
2
2
  declare function __VLS_template(): Readonly<PickerPopoutSlots> & PickerPopoutSlots;
3
- declare const __VLS_component: import("vue").DefineComponent<PickerPopoutProps, {}, {}, {}, {}, 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<PickerPopoutProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
4
+ [x: string]: any;
5
+ } & {
6
+ [x: string]: any;
7
7
  }, string, import("vue").PublicProps, Readonly<PickerPopoutProps> & 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
- validateEvent: boolean;
13
10
  columns: import("../picker/common").PickerOption[] | import("../picker/common").PickerOption[][];
11
+ validateEvent: boolean;
14
12
  immediateChange: boolean;
15
13
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
16
14
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, ReturnType<typeof __VLS_template>>;
@@ -7,6 +7,7 @@
7
7
  :root-style="popoutStyle"
8
8
  @confirm="onConfirm"
9
9
  @enter="onEnter"
10
+ @visible-hook="onVisibleHook"
10
11
  >
11
12
  <template #visible="{ already }">
12
13
  <sar-picker
@@ -71,6 +72,16 @@ import { useFormPopout } from "../../use";
71
72
  * @property {boolean} validateEvent 是否触发表单验证,默认值:true。
72
73
  * @event {(visible: boolean) => void} update 弹出框显隐时触发
73
74
  * @event {(value: any) => void} change 选择器输入组件值改变时触发
75
+ * @event {() => void} confirm 点击确定按钮时触发
76
+ * @event {(name: TransitionHookName) => void} visible-hook 入场/退场动画状态改变时触发
77
+ * @event {() => void} before-enter 入场动画开始前触发
78
+ * @event {() => void} enter 入场动画开始时触发
79
+ * @event {() => void} after-enter 入场动画结束时触发
80
+ * @event {() => void} enter-cancelled 入场动画取消时触发
81
+ * @event {() => void} before-leave 退场动画开始前触发
82
+ * @event {() => void} leave 退场动画开始时触发
83
+ * @event {() => void} after-leave 退场动画结束时触发
84
+ * @event {() => void} leave-cancelled 退场动画取消时触发
74
85
  */
75
86
  export default _defineComponent({
76
87
  components: {
@@ -98,12 +109,19 @@ export default _defineComponent({
98
109
  immediateChange: { type: Boolean, required: false },
99
110
  internalCustom: { type: Number, required: false }
100
111
  }, defaultPickerPopoutProps()),
101
- emits: ["update:visible", "update:model-value", "change"],
112
+ emits: ["update:visible", "update:model-value", "change", "confirm", "before-enter", "enter", "after-enter", "enter-cancelled", "before-leave", "leave", "after-leave", "leave-cancelled", "visible-hook"],
102
113
  setup(__props, { expose: __expose, emit: __emit }) {
103
114
  __expose();
104
115
  const props = __props;
105
116
  const emit = __emit;
106
- const { innerVisible, innerValue, popoutValue, onChange, onConfirm } = useFormPopout(props, emit, {
117
+ const {
118
+ innerVisible,
119
+ innerValue,
120
+ popoutValue,
121
+ onChange,
122
+ onConfirm,
123
+ onVisibleHook
124
+ } = useFormPopout(props, emit, {
107
125
  onConfirmBefore() {
108
126
  if (isEmptyBinding(popoutValue.value)) {
109
127
  const [initialValue, selectedOptions] = getInitialValue(
@@ -123,7 +141,7 @@ export default _defineComponent({
123
141
  popoutValue.value = innerValue.value;
124
142
  }
125
143
  };
126
- const __returned__ = { props, emit, innerVisible, innerValue, popoutValue, onChange, onConfirm, fieldKeys, onEnter, SarPopout, SarPicker, get isNumber() {
144
+ const __returned__ = { props, emit, innerVisible, innerValue, popoutValue, onChange, onConfirm, onVisibleHook, fieldKeys, onEnter, SarPopout, SarPicker, get isNumber() {
127
145
  return isNumber;
128
146
  } };
129
147
  return __returned__;
@@ -8,8 +8,8 @@ declare const __VLS_component: import("vue").DefineComponent<PopoutProps, {}, {}
8
8
  [x: `on${Capitalize<any>}`]: ((...args: any) => any) | undefined;
9
9
  }>, {
10
10
  type: "compact" | "loose";
11
- showConfirm: boolean;
12
11
  duration: number;
12
+ showConfirm: boolean;
13
13
  overlayClosable: boolean;
14
14
  showClose: boolean;
15
15
  showFooter: boolean;
@@ -27,17 +27,26 @@ import PopoutInput from 'sard-uniapp/components/popout-input/popout-input.vue'
27
27
 
28
28
  ### PopoutInputProps
29
29
 
30
- | 属性 | 描述 | 类型 | 默认值 |
31
- | ----------- | ---------------- | ---------- | ------ |
32
- | root-class | 组件根元素类名 | string | - |
33
- | root-style | 组件根元素样式 | StyleValue | - |
34
- | model-value | 输入框值 | string | - |
35
- | placeholder | 输入框占位符内容 | string | - |
36
- | disabled | 禁用状态 | boolean | false |
37
- | readonly | 只读状态 | boolean | false |
38
- | loading | 加载状态 | boolean | false |
39
- | clearable | 是否显示清空按钮 | boolean | false |
40
- | multiline | 是否多行输入框 | boolean | false |
30
+ | 属性 | 描述 | 类型 | 默认值 |
31
+ | ----------------------------- | -------------------- | ---------- | ------------- |
32
+ | root-class | 组件根元素类名 | string | - |
33
+ | root-style | 组件根元素样式 | StyleValue | - |
34
+ | model-value | 输入框值 | string | - |
35
+ | placeholder | 输入框占位符内容 | string | - |
36
+ | disabled | 禁用状态 | boolean | false |
37
+ | readonly | 只读状态 | boolean | false |
38
+ | loading | 加载状态 | boolean | false |
39
+ | clearable | 是否显示清空按钮 | boolean | false |
40
+ | multiline | 是否多行输入框 | boolean | false |
41
+ | arrow <sup>1.22+</sup> | 自定义箭头图标名 | string | 'caret-right' |
42
+ | arrow-family <sup>1.22+</sup> | 自定义箭头图标字体 | string | 'sari' |
43
+ | input-props <sup>1.22+</sup> | 自定义输入框组件属性 | InputProps | - |
44
+
45
+ ### PopoutInputSlots
46
+
47
+ | 插槽 | 描述 | 属性 |
48
+ | ---------------------- | ---------- | ---------- |
49
+ | arrow <sup>1.22+</sup> | 自定义箭头 | () => void |
41
50
 
42
51
  ### PopoutInputEmits
43
52
 
@@ -1,4 +1,5 @@
1
1
  import { type StyleValue } from 'vue';
2
+ import { type InputProps } from '../input';
2
3
  export interface PopoutInputProps {
3
4
  rootStyle?: StyleValue;
4
5
  rootClass?: string;
@@ -9,7 +10,15 @@ export interface PopoutInputProps {
9
10
  clearable?: boolean;
10
11
  loading?: boolean;
11
12
  multiline?: boolean;
13
+ arrow?: string;
14
+ arrowFamily?: string;
15
+ internalArrow?: number;
16
+ inputProps?: InputProps;
12
17
  }
18
+ export declare const defaultPopoutInputProps: {
19
+ arrow: string;
20
+ arrowFamily: string;
21
+ };
13
22
  export interface PopoutInputEmits {
14
23
  (e: 'click', event: any): void;
15
24
  (e: 'update:model-value', value: string): void;
@@ -17,4 +26,5 @@ export interface PopoutInputEmits {
17
26
  (e: 'clear'): void;
18
27
  }
19
28
  export interface PopoutInputSlots {
29
+ 'arrow'(): any;
20
30
  }
@@ -1 +1,2 @@
1
- export {};
1
+ import { defaultConfig } from '../config';
2
+ export const defaultPopoutInputProps = defaultConfig.popoutInput;