sard-uniapp 1.14.3 → 1.15.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.
- package/CHANGELOG.md +11 -10
- package/components/action-sheet/action-sheet.vue +3 -2
- package/components/crop-image/crop-image.vue +10 -10
- package/components/dialog/common.d.ts +6 -1
- package/components/dialog/dialog.vue +35 -8
- package/components/popout/common.d.ts +6 -1
- package/components/popout/popout.vue +38 -10
- package/components/share-sheet/share-sheet.vue +3 -2
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [1.14.4](https://github.com/sutras/sard-uniapp/compare/v1.14.3...v1.14.4) (2025-05-16)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* 修复 crop-image 弹出问题 ([d7bec84](https://github.com/sutras/sard-uniapp/commit/d7bec84ab9746d3f535b1e85187108aeb3872079))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
1
10
|
## [1.14.3](https://github.com/sutras/sard-uniapp/compare/v1.14.2...v1.14.3) (2025-05-14)
|
|
2
11
|
|
|
3
12
|
|
|
@@ -293,21 +302,13 @@
|
|
|
293
302
|
|
|
294
303
|
|
|
295
304
|
|
|
296
|
-
# [1.6.0](https://github.com/sutras/sard-uniapp/compare/v1.
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
### Features
|
|
300
|
-
|
|
301
|
-
* 新增Tree, Timeline, BackTop 组件 close [#36](https://github.com/sutras/sard-uniapp/issues/36), close [#41](https://github.com/sutras/sard-uniapp/issues/41), close 43 ([f0a0504](https://github.com/sutras/sard-uniapp/commit/f0a0504f03a8eac84f926e2e01a61bc31de59057))
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
# [1.5.0](https://github.com/sutras/sard-uniapp/compare/v1.4.1...v1.5.0) (2024-08-08)
|
|
305
|
+
# [1.6.0](https://github.com/sutras/sard-uniapp/compare/v1.4.1...v1.6.0) (2024-08-19)
|
|
306
306
|
|
|
307
307
|
|
|
308
308
|
### Features
|
|
309
309
|
|
|
310
310
|
* 新增Fab, FloatingBubble 组件, 优化构建流程 close [#39](https://github.com/sutras/sard-uniapp/issues/39) ([fe28b0a](https://github.com/sutras/sard-uniapp/commit/fe28b0aeb3a60f8b4d3f74a7d16ceb0fb4ccf295))
|
|
311
|
+
* 新增Tree, Timeline, BackTop 组件 close [#36](https://github.com/sutras/sard-uniapp/issues/36), close [#41](https://github.com/sutras/sard-uniapp/issues/41), close 43 ([f0a0504](https://github.com/sutras/sard-uniapp/commit/f0a0504f03a8eac84f926e2e01a61bc31de59057))
|
|
311
312
|
|
|
312
313
|
|
|
313
314
|
|
|
@@ -54,7 +54,8 @@ import {
|
|
|
54
54
|
stringifyStyle,
|
|
55
55
|
createBem,
|
|
56
56
|
noop,
|
|
57
|
-
isFunction
|
|
57
|
+
isFunction,
|
|
58
|
+
isObject
|
|
58
59
|
} from "../../utils";
|
|
59
60
|
import SarPopup from "../popup/popup.vue";
|
|
60
61
|
import SarLoading from "../loading/loading.vue";
|
|
@@ -100,7 +101,7 @@ export default _defineComponent({
|
|
|
100
101
|
const perhapsClose = (type) => {
|
|
101
102
|
if (isFunction(props.beforeClose)) {
|
|
102
103
|
const result = props.beforeClose(type);
|
|
103
|
-
if (result
|
|
104
|
+
if (isObject(result) && isFunction(result.then)) {
|
|
104
105
|
return result.then(() => {
|
|
105
106
|
innerVisible.value = false;
|
|
106
107
|
emit("update:visible", false);
|
|
@@ -68,20 +68,20 @@
|
|
|
68
68
|
</view>
|
|
69
69
|
</view>
|
|
70
70
|
|
|
71
|
-
<view :class="bem.e('canvas-wrapper')">
|
|
72
|
-
<canvas
|
|
73
|
-
type="2d"
|
|
74
|
-
:hidpi="false"
|
|
75
|
-
:canvas-id="canvasId"
|
|
76
|
-
:id="canvasId"
|
|
77
|
-
:style="canvasStyle"
|
|
78
|
-
></canvas>
|
|
79
|
-
</view>
|
|
80
|
-
|
|
81
71
|
<view v-if="isCropping" :class="bem.e('loading')">
|
|
82
72
|
<sar-loading />
|
|
83
73
|
</view>
|
|
84
74
|
</sar-popup>
|
|
75
|
+
|
|
76
|
+
<view :class="bem.e('canvas-wrapper')">
|
|
77
|
+
<canvas
|
|
78
|
+
type="2d"
|
|
79
|
+
:hidpi="false"
|
|
80
|
+
:canvas-id="canvasId"
|
|
81
|
+
:id="canvasId"
|
|
82
|
+
:style="canvasStyle"
|
|
83
|
+
></canvas>
|
|
84
|
+
</view>
|
|
85
85
|
</template>
|
|
86
86
|
|
|
87
87
|
<script>
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { type StyleValue } from 'vue';
|
|
2
2
|
import { type ButtonProps } from '../button';
|
|
3
3
|
import { type TransitionHookEmits } from '../popup/common';
|
|
4
|
+
export type DialogBeforeClose = (type: 'close' | 'cancel' | 'confirm', loading: {
|
|
5
|
+
readonly cancel: boolean;
|
|
6
|
+
readonly confirm: boolean;
|
|
7
|
+
readonly close: boolean;
|
|
8
|
+
}) => any | Promise<any>;
|
|
4
9
|
export interface DialogProps {
|
|
5
10
|
rootStyle?: StyleValue;
|
|
6
11
|
rootClass?: string;
|
|
@@ -16,7 +21,7 @@ export interface DialogProps {
|
|
|
16
21
|
showConfirm?: boolean;
|
|
17
22
|
confirmText?: string;
|
|
18
23
|
overlayClosable?: boolean;
|
|
19
|
-
beforeClose?:
|
|
24
|
+
beforeClose?: DialogBeforeClose;
|
|
20
25
|
duration?: number;
|
|
21
26
|
cancelProps?: ButtonProps;
|
|
22
27
|
confirmProps?: ButtonProps;
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
|
|
77
77
|
<script>
|
|
78
78
|
import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
|
|
79
|
-
import { computed, ref, watch } from "vue";
|
|
79
|
+
import { computed, ref, watch, readonly, reactive } from "vue";
|
|
80
80
|
import {
|
|
81
81
|
classNames,
|
|
82
82
|
stringifyStyle,
|
|
@@ -140,22 +140,49 @@ export default _defineComponent({
|
|
|
140
140
|
innerVisible.value = props.visible;
|
|
141
141
|
}
|
|
142
142
|
);
|
|
143
|
-
const loading =
|
|
143
|
+
const loading = reactive({
|
|
144
144
|
cancel: false,
|
|
145
145
|
confirm: false,
|
|
146
146
|
close: false
|
|
147
147
|
});
|
|
148
|
+
const readonlyLoading = readonly(loading);
|
|
149
|
+
const asyncSet = new Set();
|
|
150
|
+
watch(
|
|
151
|
+
innerVisible,
|
|
152
|
+
() => {
|
|
153
|
+
if (innerVisible.value === false) {
|
|
154
|
+
asyncSet.forEach((obj) => {
|
|
155
|
+
obj.valid = false;
|
|
156
|
+
});
|
|
157
|
+
Object.assign(loading, {
|
|
158
|
+
cancel: false,
|
|
159
|
+
confirm: false,
|
|
160
|
+
close: false
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
flush: "sync"
|
|
166
|
+
}
|
|
167
|
+
);
|
|
148
168
|
const perhapsClose = (type) => {
|
|
149
169
|
emit(type);
|
|
150
170
|
if (isFunction(props.beforeClose)) {
|
|
151
|
-
const result = props.beforeClose(type);
|
|
171
|
+
const result = props.beforeClose(type, readonlyLoading);
|
|
152
172
|
if (isObject(result) && isFunction(result.then)) {
|
|
153
|
-
loading
|
|
173
|
+
loading[type] = true;
|
|
174
|
+
const obj = {
|
|
175
|
+
valid: true
|
|
176
|
+
};
|
|
177
|
+
asyncSet.add(obj);
|
|
154
178
|
return result.then(() => {
|
|
155
|
-
|
|
156
|
-
|
|
179
|
+
if (obj.valid) {
|
|
180
|
+
innerVisible.value = false;
|
|
181
|
+
emit("update:visible", false);
|
|
182
|
+
}
|
|
157
183
|
}).catch(noop).finally(() => {
|
|
158
|
-
loading
|
|
184
|
+
loading[type] = false;
|
|
185
|
+
asyncSet.delete(obj);
|
|
159
186
|
});
|
|
160
187
|
} else if (result === false) {
|
|
161
188
|
return;
|
|
@@ -228,7 +255,7 @@ export default _defineComponent({
|
|
|
228
255
|
props.popupStyle
|
|
229
256
|
);
|
|
230
257
|
});
|
|
231
|
-
const __returned__ = { props, emit, bem, t, innerVisible, loading, perhapsClose, onOverlayClick, onClose, onConfirm, onCancel, buttonProps, onVisibleHook, dialogClass, dialogStyle, mergedPopupStyle, SarPopup, SarButton, SarIcon };
|
|
258
|
+
const __returned__ = { props, emit, bem, t, innerVisible, loading, readonlyLoading, asyncSet, perhapsClose, onOverlayClick, onClose, onConfirm, onCancel, buttonProps, onVisibleHook, dialogClass, dialogStyle, mergedPopupStyle, SarPopup, SarButton, SarIcon };
|
|
232
259
|
return __returned__;
|
|
233
260
|
}
|
|
234
261
|
});
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { type StyleValue } from 'vue';
|
|
2
2
|
import { type TransitionHookEmits } from '../popup/common';
|
|
3
|
+
export type PopoutBeforeClose = (type: 'close' | 'cancel' | 'confirm', loading: {
|
|
4
|
+
readonly cancel: boolean;
|
|
5
|
+
readonly confirm: boolean;
|
|
6
|
+
readonly close: boolean;
|
|
7
|
+
}) => any | Promise<any>;
|
|
3
8
|
export interface PopoutProps {
|
|
4
9
|
rootStyle?: StyleValue;
|
|
5
10
|
rootClass?: string;
|
|
@@ -15,7 +20,7 @@ export interface PopoutProps {
|
|
|
15
20
|
showClose?: boolean;
|
|
16
21
|
showFooter?: boolean;
|
|
17
22
|
overlayClosable?: boolean;
|
|
18
|
-
beforeClose?:
|
|
23
|
+
beforeClose?: PopoutBeforeClose;
|
|
19
24
|
keepRender?: boolean;
|
|
20
25
|
}
|
|
21
26
|
export declare const defaultPopoutProps: {
|
|
@@ -93,13 +93,14 @@
|
|
|
93
93
|
|
|
94
94
|
<script>
|
|
95
95
|
import { mergeDefaults as _mergeDefaults, defineComponent as _defineComponent } from "vue";
|
|
96
|
-
import { computed, ref, watch } from "vue";
|
|
96
|
+
import { computed, reactive, readonly, ref, watch } from "vue";
|
|
97
97
|
import {
|
|
98
98
|
classNames,
|
|
99
99
|
stringifyStyle,
|
|
100
100
|
createBem,
|
|
101
101
|
noop,
|
|
102
|
-
isFunction
|
|
102
|
+
isFunction,
|
|
103
|
+
isObject
|
|
103
104
|
} from "../../utils";
|
|
104
105
|
import SarPopup from "../popup/popup.vue";
|
|
105
106
|
import SarButton from "../button/button.vue";
|
|
@@ -173,22 +174,49 @@ export default _defineComponent({
|
|
|
173
174
|
emit("visible-hook", name);
|
|
174
175
|
emit(name);
|
|
175
176
|
};
|
|
176
|
-
const loading =
|
|
177
|
+
const loading = reactive({
|
|
177
178
|
cancel: false,
|
|
178
179
|
confirm: false,
|
|
179
180
|
close: false
|
|
180
181
|
});
|
|
182
|
+
const readonlyLoading = readonly(loading);
|
|
183
|
+
const asyncSet = new Set();
|
|
184
|
+
watch(
|
|
185
|
+
innerVisible,
|
|
186
|
+
() => {
|
|
187
|
+
if (innerVisible.value === false) {
|
|
188
|
+
asyncSet.forEach((obj) => {
|
|
189
|
+
obj.valid = false;
|
|
190
|
+
});
|
|
191
|
+
Object.assign(loading, {
|
|
192
|
+
cancel: false,
|
|
193
|
+
confirm: false,
|
|
194
|
+
close: false
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
flush: "sync"
|
|
200
|
+
}
|
|
201
|
+
);
|
|
181
202
|
const perhapsClose = (type) => {
|
|
182
203
|
emit(type);
|
|
183
204
|
if (isFunction(props.beforeClose)) {
|
|
184
|
-
const result = props.beforeClose(type);
|
|
185
|
-
if (result
|
|
186
|
-
loading
|
|
205
|
+
const result = props.beforeClose(type, readonlyLoading);
|
|
206
|
+
if (isObject(result) && isFunction(result.then)) {
|
|
207
|
+
loading[type] = true;
|
|
208
|
+
const obj = {
|
|
209
|
+
valid: true
|
|
210
|
+
};
|
|
211
|
+
asyncSet.add(obj);
|
|
187
212
|
return result.then(() => {
|
|
188
|
-
|
|
189
|
-
|
|
213
|
+
if (obj.valid) {
|
|
214
|
+
innerVisible.value = false;
|
|
215
|
+
emit("update:visible", false);
|
|
216
|
+
}
|
|
190
217
|
}).catch(noop).finally(() => {
|
|
191
|
-
loading
|
|
218
|
+
loading[type] = false;
|
|
219
|
+
asyncSet.delete(obj);
|
|
192
220
|
});
|
|
193
221
|
} else if (result === false) {
|
|
194
222
|
return;
|
|
@@ -217,7 +245,7 @@ export default _defineComponent({
|
|
|
217
245
|
const popoutStyle = computed(() => {
|
|
218
246
|
return stringifyStyle(props.rootStyle);
|
|
219
247
|
});
|
|
220
|
-
const __returned__ = { props, emit, bem, t, innerVisible, already, wholeVisible, onBeforeEnter, onAfterLeave, callVisibleHook, onVisibleHook, loading, perhapsClose, onOverlayClick, onCloseClick, onConfirm, onCancel, popoutClass, popoutStyle, get classNames() {
|
|
248
|
+
const __returned__ = { props, emit, bem, t, innerVisible, already, wholeVisible, onBeforeEnter, onAfterLeave, callVisibleHook, onVisibleHook, loading, readonlyLoading, asyncSet, perhapsClose, onOverlayClick, onCloseClick, onConfirm, onCancel, popoutClass, popoutStyle, get classNames() {
|
|
221
249
|
return classNames;
|
|
222
250
|
}, SarPopup, SarButton, SarIcon };
|
|
223
251
|
return __returned__;
|
|
@@ -78,7 +78,8 @@ import {
|
|
|
78
78
|
createBem,
|
|
79
79
|
noop,
|
|
80
80
|
isFileUrl,
|
|
81
|
-
isFunction
|
|
81
|
+
isFunction,
|
|
82
|
+
isObject
|
|
82
83
|
} from "../../utils";
|
|
83
84
|
import SarPopup from "../popup/popup.vue";
|
|
84
85
|
import SarIcon from "../icon/icon.vue";
|
|
@@ -135,7 +136,7 @@ export default _defineComponent({
|
|
|
135
136
|
const perhapsClose = (type) => {
|
|
136
137
|
if (isFunction(props.beforeClose)) {
|
|
137
138
|
const result = props.beforeClose(type);
|
|
138
|
-
if (result
|
|
139
|
+
if (isObject(result) && isFunction(result.then)) {
|
|
139
140
|
return result.then(() => {
|
|
140
141
|
innerVisible.value = false;
|
|
141
142
|
emit("update:visible", false);
|
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.
|
|
5
|
+
"version": "1.15.0",
|
|
6
6
|
"description": "sard-uniapp 是一套基于 Uniapp + Vue3 框架开发的兼容多端的 UI 组件库",
|
|
7
7
|
"main": "index.js",
|
|
8
8
|
"scripts": {
|
|
@@ -122,7 +122,7 @@
|
|
|
122
122
|
"lodash-es": "^4.17.21",
|
|
123
123
|
"prettier": "^2.8.8",
|
|
124
124
|
"region-data": "^1.2.3",
|
|
125
|
-
"sard-cli": "^1.1.
|
|
125
|
+
"sard-cli": "^1.1.7",
|
|
126
126
|
"sass": "^1.69.7",
|
|
127
127
|
"tel-area-code": "^1.1.0",
|
|
128
128
|
"ts-custom-error": "^3.3.1",
|