zartui 3.2.1 → 3.2.3
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/README.md +27 -27
- package/es/action-sheet/ActionSheet.d.ts +16 -3
- package/es/action-sheet/ActionSheet.mjs +29 -26
- package/es/action-sheet/index.css +1 -1
- package/es/action-sheet/index.d.ts +9 -2
- package/es/button/index.css +1 -1
- package/es/date-time-picker/DateTimePicker.d.ts +8 -0
- package/es/date-time-picker/DateTimePickerWrapper.d.ts +12 -0
- package/es/date-time-picker/index.d.ts +8 -0
- package/es/date-time-picker/utils.d.ts +4 -0
- package/es/dialog/Dialog.d.ts +6 -0
- package/es/dialog/Dialog.mjs +6 -2
- package/es/dialog/function-call.mjs +2 -0
- package/es/dialog/index.css +1 -1
- package/es/dialog/index.d.ts +4 -0
- package/es/dropdown-item/DropdownItem.mjs +1 -0
- package/es/index.d.ts +2 -1
- package/es/index.mjs +4 -1
- package/es/lazyload/vue-lazyload/index.d.ts +55 -55
- package/es/media-picker/MediaPicker.d.ts +7 -3
- package/es/media-picker/MediaPicker.mjs +73 -25
- package/es/media-picker/index.d.ts +3 -2
- package/es/media-picker/type.d.ts +2 -1
- package/es/picker/Picker.d.ts +16 -0
- package/es/picker/Picker.mjs +5 -15
- package/es/picker/PickerToolbar.d.ts +15 -1
- package/es/picker/PickerToolbar.mjs +17 -15
- package/es/picker/index.css +1 -1
- package/es/picker/index.d.ts +8 -0
- package/es/search/index.css +1 -1
- package/es/speech-recognizer/SpeechRecognizer.d.ts +51 -0
- package/es/speech-recognizer/SpeechRecognizer.mjs +209 -0
- package/es/speech-recognizer/index.css +1 -0
- package/es/speech-recognizer/index.d.ts +43 -0
- package/es/speech-recognizer/index.mjs +8 -0
- package/es/speech-recognizer/recorder.d.ts +53 -0
- package/es/speech-recognizer/recorder.mjs +75 -0
- package/es/speech-recognizer/style/index.d.ts +1 -0
- package/es/speech-recognizer/style/index.mjs +10 -0
- package/es/speech-recognizer/types.d.ts +0 -0
- package/es/speech-recognizer/types.mjs +0 -0
- package/es/tab/style/index.mjs +1 -0
- package/es/tabs/Tabs.mjs +51 -2
- package/es/tabs/index.css +1 -1
- package/es/tabs/style/index.mjs +1 -0
- package/es/time-picker/TimePicker.d.ts +12 -0
- package/es/time-picker/index.d.ts +8 -0
- package/es/vue-sfc-shim.d.ts +6 -6
- package/es/vue-tsx-shim.d.ts +23 -23
- package/lib/action-sheet/ActionSheet.d.ts +16 -3
- package/lib/action-sheet/ActionSheet.js +28 -25
- package/lib/action-sheet/index.css +1 -1
- package/lib/action-sheet/index.d.ts +9 -2
- package/lib/button/index.css +1 -1
- package/lib/date-time-picker/DateTimePicker.d.ts +8 -0
- package/lib/date-time-picker/DateTimePickerWrapper.d.ts +12 -0
- package/lib/date-time-picker/index.d.ts +8 -0
- package/lib/date-time-picker/utils.d.ts +4 -0
- package/lib/dialog/Dialog.d.ts +6 -0
- package/lib/dialog/Dialog.js +6 -2
- package/lib/dialog/function-call.js +2 -0
- package/lib/dialog/index.css +1 -1
- package/lib/dialog/index.d.ts +4 -0
- package/lib/dropdown-item/DropdownItem.js +1 -0
- package/lib/index.css +1 -1
- package/lib/index.d.ts +2 -1
- package/lib/index.js +4 -1
- package/lib/lazyload/vue-lazyload/index.d.ts +55 -55
- package/lib/media-picker/MediaPicker.d.ts +7 -3
- package/lib/media-picker/MediaPicker.js +72 -24
- package/lib/media-picker/index.d.ts +3 -2
- package/lib/media-picker/type.d.ts +2 -1
- package/lib/picker/Picker.d.ts +16 -0
- package/lib/picker/Picker.js +4 -14
- package/lib/picker/PickerToolbar.d.ts +15 -1
- package/lib/picker/PickerToolbar.js +16 -14
- package/lib/picker/index.css +1 -1
- package/lib/picker/index.d.ts +8 -0
- package/lib/search/index.css +1 -1
- package/lib/speech-recognizer/SpeechRecognizer.d.ts +51 -0
- package/lib/speech-recognizer/SpeechRecognizer.js +238 -0
- package/lib/speech-recognizer/index.css +1 -0
- package/lib/speech-recognizer/index.d.ts +43 -0
- package/lib/speech-recognizer/index.js +37 -0
- package/lib/speech-recognizer/recorder.d.ts +53 -0
- package/lib/speech-recognizer/recorder.js +94 -0
- package/lib/speech-recognizer/style/index.d.ts +1 -0
- package/lib/speech-recognizer/style/index.js +10 -0
- package/lib/speech-recognizer/types.d.ts +0 -0
- package/lib/speech-recognizer/types.js +0 -0
- package/lib/tab/style/index.js +1 -0
- package/lib/tabs/Tabs.js +51 -2
- package/lib/tabs/index.css +1 -1
- package/lib/tabs/style/index.js +1 -0
- package/lib/time-picker/TimePicker.d.ts +12 -0
- package/lib/time-picker/index.d.ts +8 -0
- package/lib/vue-sfc-shim.d.ts +6 -6
- package/lib/vue-tsx-shim.d.ts +23 -23
- package/lib/web-types.json +1 -0
- package/lib/zartui.cjs.js +1360 -992
- package/lib/zartui.es.js +1360 -992
- package/lib/zartui.js +1408 -1023
- package/lib/zartui.min.js +1 -0
- package/package.json +9 -9
package/lib/index.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ export * from "./search";
|
|
|
57
57
|
export * from "./signature";
|
|
58
58
|
export * from "./skeleton";
|
|
59
59
|
export * from "./slider";
|
|
60
|
+
export * from "./speech-recognizer";
|
|
60
61
|
export * from "./step";
|
|
61
62
|
export * from "./stepper";
|
|
62
63
|
export * from "./steps";
|
|
@@ -83,4 +84,4 @@ declare namespace _default {
|
|
|
83
84
|
}
|
|
84
85
|
export default _default;
|
|
85
86
|
export function install(app: any): void;
|
|
86
|
-
export const version: "3.2.
|
|
87
|
+
export const version: "3.2.3";
|
package/lib/index.js
CHANGED
|
@@ -81,6 +81,7 @@ var import_search = require("./search");
|
|
|
81
81
|
var import_signature = require("./signature");
|
|
82
82
|
var import_skeleton = require("./skeleton");
|
|
83
83
|
var import_slider = require("./slider");
|
|
84
|
+
var import_speech_recognizer = require("./speech-recognizer");
|
|
84
85
|
var import_step = require("./step");
|
|
85
86
|
var import_stepper = require("./stepper");
|
|
86
87
|
var import_steps = require("./steps");
|
|
@@ -160,6 +161,7 @@ __reExport(stdin_exports, require("./search"), module.exports);
|
|
|
160
161
|
__reExport(stdin_exports, require("./signature"), module.exports);
|
|
161
162
|
__reExport(stdin_exports, require("./skeleton"), module.exports);
|
|
162
163
|
__reExport(stdin_exports, require("./slider"), module.exports);
|
|
164
|
+
__reExport(stdin_exports, require("./speech-recognizer"), module.exports);
|
|
163
165
|
__reExport(stdin_exports, require("./step"), module.exports);
|
|
164
166
|
__reExport(stdin_exports, require("./stepper"), module.exports);
|
|
165
167
|
__reExport(stdin_exports, require("./steps"), module.exports);
|
|
@@ -180,7 +182,7 @@ __reExport(stdin_exports, require("./timeline"), module.exports);
|
|
|
180
182
|
__reExport(stdin_exports, require("./toast"), module.exports);
|
|
181
183
|
__reExport(stdin_exports, require("./uploader"), module.exports);
|
|
182
184
|
__reExport(stdin_exports, require("./video"), module.exports);
|
|
183
|
-
const version = "3.2.
|
|
185
|
+
const version = "3.2.3";
|
|
184
186
|
function install(app) {
|
|
185
187
|
const components = [
|
|
186
188
|
import_action_sheet.ActionSheet,
|
|
@@ -241,6 +243,7 @@ function install(app) {
|
|
|
241
243
|
import_signature.Signature,
|
|
242
244
|
import_skeleton.Skeleton,
|
|
243
245
|
import_slider.Slider,
|
|
246
|
+
import_speech_recognizer.SpeechRecognizer,
|
|
244
247
|
import_step.Step,
|
|
245
248
|
import_stepper.Stepper,
|
|
246
249
|
import_steps.Steps,
|
|
@@ -1,55 +1,55 @@
|
|
|
1
|
-
import type { App } from 'vue';
|
|
2
|
-
|
|
3
|
-
declare type ListenEvent =
|
|
4
|
-
| 'scroll'
|
|
5
|
-
| 'wheel'
|
|
6
|
-
| 'mousewheel'
|
|
7
|
-
| 'resize'
|
|
8
|
-
| 'animationend'
|
|
9
|
-
| 'transitionend'
|
|
10
|
-
| 'touchmove';
|
|
11
|
-
|
|
12
|
-
// eslint-disable-next-line
|
|
13
|
-
declare type Callback = (listener: any, options: LazyloadOptions) => void;
|
|
14
|
-
|
|
15
|
-
declare type Filter = {
|
|
16
|
-
webp?: Callback;
|
|
17
|
-
progressive?: Callback;
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
declare type Adapter = {
|
|
21
|
-
error?: Callback;
|
|
22
|
-
loaded?: Callback;
|
|
23
|
-
loading?: Callback;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export declare type LazyloadOptions = {
|
|
27
|
-
error?: string;
|
|
28
|
-
filter?: Filter;
|
|
29
|
-
silent?: boolean;
|
|
30
|
-
adapter?: Adapter;
|
|
31
|
-
loading?: string;
|
|
32
|
-
attempt?: number;
|
|
33
|
-
preLoad?: number;
|
|
34
|
-
observer?: boolean;
|
|
35
|
-
lazyImage?: boolean;
|
|
36
|
-
throttleWait?: number;
|
|
37
|
-
listenEvents?: ListenEvent[];
|
|
38
|
-
dispatchEvent?: boolean;
|
|
39
|
-
lazyComponent?: boolean;
|
|
40
|
-
observerOptions?: IntersectionObserverInit;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export declare const Lazyload: {
|
|
44
|
-
install(app: App, options?: LazyloadOptions): void;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
declare module '@vue/runtime-core' {
|
|
48
|
-
interface ComponentCustomProperties {
|
|
49
|
-
$Lazyload: {
|
|
50
|
-
$on: (event: string, handler: Callback) => void;
|
|
51
|
-
$off: (event: string, handler?: Callback) => void;
|
|
52
|
-
$once: (event: string, handler: Callback) => void;
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
}
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
|
|
3
|
+
declare type ListenEvent =
|
|
4
|
+
| 'scroll'
|
|
5
|
+
| 'wheel'
|
|
6
|
+
| 'mousewheel'
|
|
7
|
+
| 'resize'
|
|
8
|
+
| 'animationend'
|
|
9
|
+
| 'transitionend'
|
|
10
|
+
| 'touchmove';
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line
|
|
13
|
+
declare type Callback = (listener: any, options: LazyloadOptions) => void;
|
|
14
|
+
|
|
15
|
+
declare type Filter = {
|
|
16
|
+
webp?: Callback;
|
|
17
|
+
progressive?: Callback;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
declare type Adapter = {
|
|
21
|
+
error?: Callback;
|
|
22
|
+
loaded?: Callback;
|
|
23
|
+
loading?: Callback;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export declare type LazyloadOptions = {
|
|
27
|
+
error?: string;
|
|
28
|
+
filter?: Filter;
|
|
29
|
+
silent?: boolean;
|
|
30
|
+
adapter?: Adapter;
|
|
31
|
+
loading?: string;
|
|
32
|
+
attempt?: number;
|
|
33
|
+
preLoad?: number;
|
|
34
|
+
observer?: boolean;
|
|
35
|
+
lazyImage?: boolean;
|
|
36
|
+
throttleWait?: number;
|
|
37
|
+
listenEvents?: ListenEvent[];
|
|
38
|
+
dispatchEvent?: boolean;
|
|
39
|
+
lazyComponent?: boolean;
|
|
40
|
+
observerOptions?: IntersectionObserverInit;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export declare const Lazyload: {
|
|
44
|
+
install(app: App, options?: LazyloadOptions): void;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
declare module '@vue/runtime-core' {
|
|
48
|
+
interface ComponentCustomProperties {
|
|
49
|
+
$Lazyload: {
|
|
50
|
+
$on: (event: string, handler: Callback) => void;
|
|
51
|
+
$off: (event: string, handler?: Callback) => void;
|
|
52
|
+
$once: (event: string, handler: Callback) => void;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ExtractPropTypes, PropType } from 'vue';
|
|
2
|
-
import type { Media, MediaAfterRead, MediaBeforeDelete, MediaBeforeRead, MediaPick, MediaPreview, MediaSizeType } from './type';
|
|
1
|
+
import { ComponentPublicInstance, ExtractPropTypes, PropType } from 'vue';
|
|
2
|
+
import type { Media, MediaAddType, MediaAfterRead, MediaBeforeDelete, MediaBeforeRead, MediaPick, MediaPreview, MediaSizeType, MediaType } from './type';
|
|
3
3
|
import { MediaPlayerProps } from '../media-player';
|
|
4
4
|
declare const mediaPickerProps: {
|
|
5
5
|
disabled: BooleanConstructor;
|
|
@@ -81,6 +81,9 @@ declare const mediaPickerProps: {
|
|
|
81
81
|
mediaPlayerProps: PropType<Partial<MediaPlayerProps>>;
|
|
82
82
|
};
|
|
83
83
|
export type MediaPickerProps = ExtractPropTypes<typeof mediaPickerProps>;
|
|
84
|
+
export type MediaPickerInstance = ComponentPublicInstance<{
|
|
85
|
+
mediaPickAction: (mediaType: MediaType, mediaAddType: MediaAddType) => void;
|
|
86
|
+
}>;
|
|
84
87
|
declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
85
88
|
disabled: BooleanConstructor;
|
|
86
89
|
showTitle: BooleanConstructor;
|
|
@@ -159,7 +162,7 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
159
162
|
default: MediaSizeType;
|
|
160
163
|
};
|
|
161
164
|
mediaPlayerProps: PropType<Partial<MediaPlayerProps>>;
|
|
162
|
-
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("delete" | "update:mediaList")[], "delete" | "update:mediaList", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
|
165
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("delete" | "processing" | "update:mediaList")[], "delete" | "processing" | "update:mediaList", import("vue").PublicProps, Readonly<ExtractPropTypes<{
|
|
163
166
|
disabled: BooleanConstructor;
|
|
164
167
|
showTitle: BooleanConstructor;
|
|
165
168
|
useFileNameAsLabel: BooleanConstructor;
|
|
@@ -239,6 +242,7 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
239
242
|
mediaPlayerProps: PropType<Partial<MediaPlayerProps>>;
|
|
240
243
|
}>> & Readonly<{
|
|
241
244
|
onDelete?: ((...args: any[]) => any) | undefined;
|
|
245
|
+
onProcessing?: ((...args: any[]) => any) | undefined;
|
|
242
246
|
"onUpdate:mediaList"?: ((...args: any[]) => any) | undefined;
|
|
243
247
|
}>, {
|
|
244
248
|
title: string;
|
|
@@ -133,7 +133,7 @@ const mediaPickerProps = {
|
|
|
133
133
|
var stdin_default = (0, import_vue2.defineComponent)({
|
|
134
134
|
name,
|
|
135
135
|
props: mediaPickerProps,
|
|
136
|
-
emits: ["update:mediaList", "delete"],
|
|
136
|
+
emits: ["update:mediaList", "delete", "processing"],
|
|
137
137
|
setup(props, {
|
|
138
138
|
emit,
|
|
139
139
|
slots
|
|
@@ -151,6 +151,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
151
151
|
const audioRecorderInputRef = (0, import_vue2.ref)();
|
|
152
152
|
const audioFileInputRef = (0, import_vue2.ref)();
|
|
153
153
|
const fileInputRef = (0, import_vue2.ref)();
|
|
154
|
+
const mediaListPlaceholder = (0, import_vue2.ref)([]);
|
|
154
155
|
const checkFileCountBeforeAdd = (mediaType) => {
|
|
155
156
|
if (props.mediaList.length === props.maxMediaCount) {
|
|
156
157
|
(0, import_toast.showFailToast)("\u5DF2\u8FBE\u5230\u6587\u4EF6\u6700\u5927\u6570\u91CF\u9650\u5236");
|
|
@@ -173,7 +174,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
173
174
|
const triggerHiddenInput = (ref2) => {
|
|
174
175
|
ref2 && ref2.click();
|
|
175
176
|
};
|
|
176
|
-
const
|
|
177
|
+
const mediaPickAction = (mediaType, mediaAddType) => {
|
|
177
178
|
if (props.disabled) {
|
|
178
179
|
return;
|
|
179
180
|
}
|
|
@@ -249,24 +250,24 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
249
250
|
return [{
|
|
250
251
|
name: "\u62CD\u6444",
|
|
251
252
|
callback: () => {
|
|
252
|
-
|
|
253
|
+
mediaPickAction("video", "take");
|
|
253
254
|
}
|
|
254
255
|
}, {
|
|
255
256
|
name: "\u89C6\u9891\u6587\u4EF6",
|
|
256
257
|
callback: () => {
|
|
257
|
-
|
|
258
|
+
mediaPickAction("video", "pick");
|
|
258
259
|
}
|
|
259
260
|
}];
|
|
260
261
|
} else if (audioOptionsVisible.value) {
|
|
261
262
|
return [{
|
|
262
263
|
name: "\u5F55\u97F3",
|
|
263
264
|
callback: () => {
|
|
264
|
-
|
|
265
|
+
mediaPickAction("audio", "take");
|
|
265
266
|
}
|
|
266
267
|
}, {
|
|
267
268
|
name: "\u97F3\u9891\u6587\u4EF6",
|
|
268
269
|
callback: () => {
|
|
269
|
-
|
|
270
|
+
mediaPickAction("audio", "pick");
|
|
270
271
|
}
|
|
271
272
|
}];
|
|
272
273
|
}
|
|
@@ -332,6 +333,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
332
333
|
fileName: f.name,
|
|
333
334
|
originalName: f.name,
|
|
334
335
|
originalSize: f.size,
|
|
336
|
+
originalFile: f,
|
|
335
337
|
deletable: true,
|
|
336
338
|
message: ""
|
|
337
339
|
};
|
|
@@ -354,17 +356,13 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
354
356
|
message: "",
|
|
355
357
|
originalName: file.name,
|
|
356
358
|
// 原始名称
|
|
357
|
-
originalSize: file.size
|
|
359
|
+
originalSize: file.size,
|
|
358
360
|
// 原始大小
|
|
361
|
+
originalFile: file
|
|
359
362
|
};
|
|
360
363
|
return media;
|
|
361
364
|
});
|
|
362
365
|
});
|
|
363
|
-
(0, import_toast.showLoadingToast)({
|
|
364
|
-
message: "\u5904\u7406\u4E2D...",
|
|
365
|
-
forbidClick: true,
|
|
366
|
-
duration: 0
|
|
367
|
-
});
|
|
368
366
|
return Promise.all(mediaList).then((medias) => {
|
|
369
367
|
const _medias = [];
|
|
370
368
|
medias.forEach((media) => {
|
|
@@ -374,7 +372,6 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
374
372
|
});
|
|
375
373
|
return _medias;
|
|
376
374
|
}).finally(() => {
|
|
377
|
-
(0, import_toast.closeToast)();
|
|
378
375
|
});
|
|
379
376
|
};
|
|
380
377
|
const transformImageFiles = (files) => {
|
|
@@ -433,11 +430,6 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
433
430
|
});
|
|
434
431
|
promisesTodo.push(promise);
|
|
435
432
|
}
|
|
436
|
-
(0, import_toast.showLoadingToast)({
|
|
437
|
-
message: "\u5904\u7406\u4E2D...",
|
|
438
|
-
forbidClick: true,
|
|
439
|
-
duration: 0
|
|
440
|
-
});
|
|
441
433
|
return Promise.all(promisesTodo).then((medias) => {
|
|
442
434
|
const _medias = [];
|
|
443
435
|
medias.forEach((media) => {
|
|
@@ -447,10 +439,47 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
447
439
|
});
|
|
448
440
|
return _medias;
|
|
449
441
|
}).finally(() => {
|
|
450
|
-
(0, import_toast.closeToast)();
|
|
451
442
|
});
|
|
452
443
|
};
|
|
453
444
|
const readFiles = (files) => {
|
|
445
|
+
emit("processing", true);
|
|
446
|
+
mediaListPlaceholder.value = files.map((file) => {
|
|
447
|
+
let type;
|
|
448
|
+
if ((0, import_media_util.isAudioType)(file)) {
|
|
449
|
+
type = "audio";
|
|
450
|
+
} else if ((0, import_media_util.isVideoType)(file)) {
|
|
451
|
+
type = "video";
|
|
452
|
+
} else if ((0, import_media_util.isImageType)(file)) {
|
|
453
|
+
type = "photo";
|
|
454
|
+
} else {
|
|
455
|
+
type = "file";
|
|
456
|
+
}
|
|
457
|
+
return {
|
|
458
|
+
file,
|
|
459
|
+
message: "\u5904\u7406\u4E2D...",
|
|
460
|
+
status: "processing",
|
|
461
|
+
type
|
|
462
|
+
};
|
|
463
|
+
});
|
|
464
|
+
emit("processing", true);
|
|
465
|
+
mediaListPlaceholder.value = files.map((file) => {
|
|
466
|
+
let type;
|
|
467
|
+
if ((0, import_media_util.isAudioType)(file)) {
|
|
468
|
+
type = "audio";
|
|
469
|
+
} else if ((0, import_media_util.isVideoType)(file)) {
|
|
470
|
+
type = "video";
|
|
471
|
+
} else if ((0, import_media_util.isImageType)(file)) {
|
|
472
|
+
type = "photo";
|
|
473
|
+
} else {
|
|
474
|
+
type = "file";
|
|
475
|
+
}
|
|
476
|
+
return {
|
|
477
|
+
file,
|
|
478
|
+
message: "\u5904\u7406\u4E2D...",
|
|
479
|
+
status: "processing",
|
|
480
|
+
type
|
|
481
|
+
};
|
|
482
|
+
});
|
|
454
483
|
const notImages = files.filter((f) => !(0, import_media_util.isImageType)(f)).map((f) => transformNotImageFile(f));
|
|
455
484
|
let newMedias = [];
|
|
456
485
|
if (notImages.length > 0) {
|
|
@@ -473,6 +502,8 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
473
502
|
newMedia.label = newMedia.originalName;
|
|
474
503
|
});
|
|
475
504
|
}
|
|
505
|
+
mediaListPlaceholder.value = [];
|
|
506
|
+
emit("processing", false);
|
|
476
507
|
emit("update:mediaList", [...props.mediaList, ...newMedias]);
|
|
477
508
|
if (props.afterRead) {
|
|
478
509
|
props.afterRead(newMedias);
|
|
@@ -608,7 +639,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
608
639
|
"class": bem("box")
|
|
609
640
|
}, [(0, import_vue.createVNode)("div", {
|
|
610
641
|
"class": bem("button"),
|
|
611
|
-
"onClick": () =>
|
|
642
|
+
"onClick": () => mediaPickAction(mediaType, mediaAddType)
|
|
612
643
|
}, [renderIcon(mediaType, mediaAddType)]), (0, import_vue.createVNode)("div", {
|
|
613
644
|
"class": bem("label")
|
|
614
645
|
}, [label])]);
|
|
@@ -649,7 +680,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
649
680
|
status,
|
|
650
681
|
message
|
|
651
682
|
} = media;
|
|
652
|
-
if (status === "uploading" || status === "failed") {
|
|
683
|
+
if (status === "processing" || status === "uploading" || status === "failed") {
|
|
653
684
|
const MaskIcon = status === "failed" ? (0, import_vue.createVNode)(import_icon.default, {
|
|
654
685
|
"name": "close",
|
|
655
686
|
"class": bem("mask-icon")
|
|
@@ -704,7 +735,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
704
735
|
}
|
|
705
736
|
return (0, import_vue.createVNode)("div", {
|
|
706
737
|
"class": bem("thumbnail-label")
|
|
707
|
-
}, [media.label
|
|
738
|
+
}, [media.label]);
|
|
708
739
|
};
|
|
709
740
|
const onDelete = (media, index) => {
|
|
710
741
|
if (props.beforeDelete) {
|
|
@@ -782,6 +813,15 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
782
813
|
(0, import_toast.showFailToast)("\u6682\u4E0D\u652F\u6301\u6B64\u7C7B\u6587\u4EF6\u7684\u9884\u89C8");
|
|
783
814
|
}
|
|
784
815
|
});
|
|
816
|
+
const renderMediaListPlaceholder = () => {
|
|
817
|
+
return mediaListPlaceholder.value.map((media) => {
|
|
818
|
+
return (0, import_vue.createVNode)(import_grid_item.default, {
|
|
819
|
+
"key": media.uniqueCode
|
|
820
|
+
}, {
|
|
821
|
+
default: () => [renderMediaThumbnail(media), renderMediaLabel(media), genThumbnailMask(media)]
|
|
822
|
+
});
|
|
823
|
+
});
|
|
824
|
+
};
|
|
785
825
|
const renderMediaList = () => props.mediaList.map((media, index) => {
|
|
786
826
|
const showDelete = media.deletable && media.status !== "uploading";
|
|
787
827
|
const deleteIcon = showDelete && (0, import_vue.createVNode)(import_DeleteIcon.default, {
|
|
@@ -803,7 +843,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
803
843
|
action.func && action.func();
|
|
804
844
|
};
|
|
805
845
|
(0, import_use_expose.useExpose)({
|
|
806
|
-
|
|
846
|
+
mediaPickAction
|
|
807
847
|
});
|
|
808
848
|
return () => {
|
|
809
849
|
const title = props.showTitle && (0, import_vue.createVNode)("div", {
|
|
@@ -835,7 +875,15 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
835
875
|
"class": bem("grid")
|
|
836
876
|
}, {
|
|
837
877
|
default: () => [renderMediaList()]
|
|
838
|
-
}), [[import_vue.vShow, props.mediaList.length]])
|
|
878
|
+
}), [[import_vue.vShow, props.mediaList.length]]), (0, import_vue.withDirectives)((0, import_vue.createVNode)(import_grid.default, {
|
|
879
|
+
"column-num": "3",
|
|
880
|
+
"border": false,
|
|
881
|
+
"square": true,
|
|
882
|
+
"gutter": "4",
|
|
883
|
+
"class": bem("grid")
|
|
884
|
+
}, {
|
|
885
|
+
default: () => [renderMediaListPlaceholder()]
|
|
886
|
+
}), [[import_vue.vShow, mediaListPlaceholder.value.length]])]);
|
|
839
887
|
};
|
|
840
888
|
}
|
|
841
889
|
});
|
|
@@ -66,7 +66,7 @@ export declare const MediaPicker: import("../utils").WithInstall<import("vue").D
|
|
|
66
66
|
default: import("./type").MediaSizeType;
|
|
67
67
|
};
|
|
68
68
|
mediaPlayerProps: import("vue").PropType<Partial<import("..").MediaPlayerProps>>;
|
|
69
|
-
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("delete" | "update:mediaList")[], "delete" | "update:mediaList", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
69
|
+
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("delete" | "processing" | "update:mediaList")[], "delete" | "processing" | "update:mediaList", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
70
70
|
disabled: BooleanConstructor;
|
|
71
71
|
showTitle: BooleanConstructor;
|
|
72
72
|
useFileNameAsLabel: BooleanConstructor;
|
|
@@ -136,6 +136,7 @@ export declare const MediaPicker: import("../utils").WithInstall<import("vue").D
|
|
|
136
136
|
mediaPlayerProps: import("vue").PropType<Partial<import("..").MediaPlayerProps>>;
|
|
137
137
|
}>> & Readonly<{
|
|
138
138
|
onDelete?: ((...args: any[]) => any) | undefined;
|
|
139
|
+
onProcessing?: ((...args: any[]) => any) | undefined;
|
|
139
140
|
"onUpdate:mediaList"?: ((...args: any[]) => any) | undefined;
|
|
140
141
|
}>, {
|
|
141
142
|
title: string;
|
|
@@ -162,7 +163,7 @@ export declare const MediaPicker: import("../utils").WithInstall<import("vue").D
|
|
|
162
163
|
imageSizeType: import("./type").MediaSizeType;
|
|
163
164
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>>;
|
|
164
165
|
export default MediaPicker;
|
|
165
|
-
export type { MediaPickerProps } from './MediaPicker';
|
|
166
|
+
export type { MediaPickerProps, MediaPickerInstance } from './MediaPicker';
|
|
166
167
|
export type { Media, MediaType, MediaAddType, MediaUploadStatus, MediaPreview, MediaPick, MediaBeforeRead, MediaAfterRead, MediaBeforeDelete, MediaPickerThemeVars, MediaSizeType, } from './type';
|
|
167
168
|
export { defaultMedia } from './type';
|
|
168
169
|
declare module 'vue' {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export type MediaType = 'photo' | 'audio' | 'video' | 'file';
|
|
2
2
|
export type MediaAddType = 'take' | 'pick' | 'take_and_pick';
|
|
3
|
-
export type MediaUploadStatus = 'uploading' | 'done' | 'failed';
|
|
3
|
+
export type MediaUploadStatus = 'processing' | 'uploading' | 'done' | 'failed';
|
|
4
4
|
export type WxMediaType = 'camera' | 'album';
|
|
5
5
|
export type MediaSizeType = 'original' | 'compressed';
|
|
6
6
|
export type Media = {
|
|
@@ -13,6 +13,7 @@ export type Media = {
|
|
|
13
13
|
fileName: string;
|
|
14
14
|
originalName: string;
|
|
15
15
|
originalSize: number;
|
|
16
|
+
originalFile?: File;
|
|
16
17
|
lastModified: number;
|
|
17
18
|
deletable: boolean;
|
|
18
19
|
status?: MediaUploadStatus;
|
package/lib/picker/Picker.d.ts
CHANGED
|
@@ -30,6 +30,10 @@ export declare const pickerSharedProps: {
|
|
|
30
30
|
default: string;
|
|
31
31
|
};
|
|
32
32
|
} & {
|
|
33
|
+
title: {
|
|
34
|
+
type: PropType<string>;
|
|
35
|
+
default: string;
|
|
36
|
+
};
|
|
33
37
|
cancelButtonText: StringConstructor;
|
|
34
38
|
confirmButtonText: StringConstructor;
|
|
35
39
|
};
|
|
@@ -62,6 +66,10 @@ export declare const pickerProps: {
|
|
|
62
66
|
default: string;
|
|
63
67
|
};
|
|
64
68
|
} & {
|
|
69
|
+
title: {
|
|
70
|
+
type: PropType<string>;
|
|
71
|
+
default: string;
|
|
72
|
+
};
|
|
65
73
|
cancelButtonText: StringConstructor;
|
|
66
74
|
confirmButtonText: StringConstructor;
|
|
67
75
|
} & {
|
|
@@ -126,6 +134,10 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
126
134
|
default: string;
|
|
127
135
|
};
|
|
128
136
|
} & {
|
|
137
|
+
title: {
|
|
138
|
+
type: PropType<string>;
|
|
139
|
+
default: string;
|
|
140
|
+
};
|
|
129
141
|
cancelButtonText: StringConstructor;
|
|
130
142
|
confirmButtonText: StringConstructor;
|
|
131
143
|
} & {
|
|
@@ -188,6 +200,10 @@ declare const _default: import("vue").DefineComponent<ExtractPropTypes<{
|
|
|
188
200
|
default: string;
|
|
189
201
|
};
|
|
190
202
|
} & {
|
|
203
|
+
title: {
|
|
204
|
+
type: PropType<string>;
|
|
205
|
+
default: string;
|
|
206
|
+
};
|
|
191
207
|
cancelButtonText: StringConstructor;
|
|
192
208
|
confirmButtonText: StringConstructor;
|
|
193
209
|
} & {
|
package/lib/picker/Picker.js
CHANGED
|
@@ -209,16 +209,6 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
209
209
|
}), (0, import_utils.pick)(slots, import_PickerToolbar.pickerToolbarSlots));
|
|
210
210
|
}
|
|
211
211
|
};
|
|
212
|
-
const renderTitleBar = () => {
|
|
213
|
-
if (props.showTitle) {
|
|
214
|
-
if (slots["title-bar"]) {
|
|
215
|
-
return slots["title-bar"]();
|
|
216
|
-
}
|
|
217
|
-
return (0, import_vue.createVNode)("div", {
|
|
218
|
-
"class": [(0, import_utils2.bem)("title"), import_utils.HAPTICS_FEEDBACK]
|
|
219
|
-
}, [props.title]);
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
212
|
const buttomDivider = () => props.showToolbar ? (0, import_vue.createVNode)(import_divider.Divider, {
|
|
223
213
|
"style": "margin: 0"
|
|
224
214
|
}, null) : null;
|
|
@@ -261,9 +251,9 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
261
251
|
var _a, _b;
|
|
262
252
|
return (0, import_vue.createVNode)("div", {
|
|
263
253
|
"class": (0, import_utils2.bem)()
|
|
264
|
-
}, [
|
|
254
|
+
}, [renderToolbar(), props.loading ? (0, import_vue.createVNode)(import_loading.Loading, {
|
|
265
255
|
"class": (0, import_utils2.bem)("loading")
|
|
266
|
-
}, null) : null, (_a = slots["columns-top"]) == null ? void 0 : _a.call(slots), renderColumns(), (_b = slots["columns-bottom"]) == null ? void 0 : _b.call(slots)
|
|
256
|
+
}, null) : null, (_a = slots["columns-top"]) == null ? void 0 : _a.call(slots), renderColumns(), (_b = slots["columns-bottom"]) == null ? void 0 : _b.call(slots)]);
|
|
267
257
|
};
|
|
268
258
|
const renderOptionItems = () => {
|
|
269
259
|
return currentColumns.value.map((options, columnIndex) => {
|
|
@@ -290,9 +280,9 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
290
280
|
var _a, _b;
|
|
291
281
|
return (0, import_vue.createVNode)("div", {
|
|
292
282
|
"class": (0, import_utils2.bem)()
|
|
293
|
-
}, [
|
|
283
|
+
}, [renderToolbar(), props.loading ? (0, import_vue.createVNode)(import_loading.Loading, {
|
|
294
284
|
"class": (0, import_utils2.bem)("loading")
|
|
295
|
-
}, null) : null, (_a = slots["columns-top"]) == null ? void 0 : _a.call(slots), renderOptions(), (_b = slots["columns-bottom"]) == null ? void 0 : _b.call(slots)
|
|
285
|
+
}, null) : null, (_a = slots["columns-top"]) == null ? void 0 : _a.call(slots), renderOptions(), (_b = slots["columns-bottom"]) == null ? void 0 : _b.call(slots)]);
|
|
296
286
|
};
|
|
297
287
|
return () => {
|
|
298
288
|
if (isButtonPicker.value) {
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export declare const pickerToolbarProps: {
|
|
2
|
+
title: {
|
|
3
|
+
type: import("vue").PropType<string>;
|
|
4
|
+
default: string;
|
|
5
|
+
};
|
|
2
6
|
cancelButtonText: StringConstructor;
|
|
3
7
|
confirmButtonText: StringConstructor;
|
|
4
8
|
};
|
|
@@ -6,13 +10,23 @@ export declare const pickerToolbarSlots: string[];
|
|
|
6
10
|
export type PickerToolbarPropKeys = Array<keyof typeof pickerToolbarProps>;
|
|
7
11
|
export declare const pickerToolbarPropKeys: PickerToolbarPropKeys;
|
|
8
12
|
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
13
|
+
title: {
|
|
14
|
+
type: import("vue").PropType<string>;
|
|
15
|
+
default: string;
|
|
16
|
+
};
|
|
9
17
|
cancelButtonText: StringConstructor;
|
|
10
18
|
confirmButtonText: StringConstructor;
|
|
11
19
|
}>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, ("cancel" | "confirm")[], "cancel" | "confirm", import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
20
|
+
title: {
|
|
21
|
+
type: import("vue").PropType<string>;
|
|
22
|
+
default: string;
|
|
23
|
+
};
|
|
12
24
|
cancelButtonText: StringConstructor;
|
|
13
25
|
confirmButtonText: StringConstructor;
|
|
14
26
|
}>> & Readonly<{
|
|
15
27
|
onCancel?: ((...args: any[]) => any) | undefined;
|
|
16
28
|
onConfirm?: ((...args: any[]) => any) | undefined;
|
|
17
|
-
}>, {
|
|
29
|
+
}>, {
|
|
30
|
+
title: string;
|
|
31
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
18
32
|
export default _default;
|
|
@@ -26,10 +26,9 @@ module.exports = __toCommonJS(stdin_exports);
|
|
|
26
26
|
var import_vue = require("vue");
|
|
27
27
|
var import_utils = require("./utils");
|
|
28
28
|
var import_utils2 = require("../utils");
|
|
29
|
-
var import_button = require("../button");
|
|
30
29
|
const [name] = (0, import_utils2.createNamespace)("picker-toolbar");
|
|
31
30
|
const pickerToolbarProps = {
|
|
32
|
-
|
|
31
|
+
title: (0, import_utils2.makeStringProp)("\u8BF7\u9009\u62E9"),
|
|
33
32
|
cancelButtonText: String,
|
|
34
33
|
confirmButtonText: String
|
|
35
34
|
};
|
|
@@ -43,31 +42,34 @@ var stdin_default = (0, import_vue.defineComponent)({
|
|
|
43
42
|
emit,
|
|
44
43
|
slots
|
|
45
44
|
}) {
|
|
45
|
+
const renderTitle = () => {
|
|
46
|
+
if (slots.title) {
|
|
47
|
+
return slots.title();
|
|
48
|
+
}
|
|
49
|
+
if (props.title) {
|
|
50
|
+
return (0, import_vue.createVNode)("div", {
|
|
51
|
+
"class": [(0, import_utils.bem)("title"), "zt-ellipsis"]
|
|
52
|
+
}, [props.title]);
|
|
53
|
+
}
|
|
54
|
+
};
|
|
46
55
|
const onCancel = () => emit("cancel");
|
|
47
56
|
const onConfirm = () => emit("confirm");
|
|
48
57
|
const renderCancel = () => {
|
|
49
58
|
const text = props.cancelButtonText || (0, import_utils.t)("cancel");
|
|
50
|
-
return (0, import_vue.createVNode)(
|
|
51
|
-
"type": "default",
|
|
52
|
-
"hairline": true,
|
|
59
|
+
return (0, import_vue.createVNode)("div", {
|
|
53
60
|
"class": (0, import_utils.bem)("cancel"),
|
|
54
61
|
"onClick": onCancel
|
|
55
|
-
},
|
|
56
|
-
default: () => [slots.cancel ? slots.cancel() : text]
|
|
57
|
-
});
|
|
62
|
+
}, [slots.cancel ? slots.cancel() : text]);
|
|
58
63
|
};
|
|
59
64
|
const renderConfirm = () => {
|
|
60
65
|
const text = props.confirmButtonText || (0, import_utils.t)("confirm");
|
|
61
|
-
return (0, import_vue.createVNode)(
|
|
62
|
-
"type": "primary",
|
|
66
|
+
return (0, import_vue.createVNode)("div", {
|
|
63
67
|
"class": [(0, import_utils.bem)("confirm"), import_utils2.HAPTICS_FEEDBACK],
|
|
64
68
|
"onClick": onConfirm
|
|
65
|
-
},
|
|
66
|
-
default: () => [slots.confirm ? slots.confirm() : text]
|
|
67
|
-
});
|
|
69
|
+
}, [slots.confirm ? slots.confirm() : text]);
|
|
68
70
|
};
|
|
69
71
|
return () => (0, import_vue.createVNode)("div", {
|
|
70
72
|
"class": (0, import_utils.bem)("toolbar")
|
|
71
|
-
}, [slots.toolbar ? slots.toolbar() : [renderCancel(), renderConfirm()]]);
|
|
73
|
+
}, [slots.toolbar ? slots.toolbar() : [renderCancel(), renderTitle(), renderConfirm()]]);
|
|
72
74
|
}
|
|
73
75
|
});
|