zartui 3.0.3 → 3.0.5
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 +25 -0
- package/es/action-sheet/index.css +1 -1
- package/es/avatar/Avatar.d.ts +5 -1
- package/es/avatar/Avatar.mjs +9 -4
- package/es/avatar/index.css +1 -1
- package/es/avatar/index.d.ts +4 -1
- package/es/badge/Badge.d.ts +1 -1
- package/es/badge/index.d.ts +1 -1
- package/es/button/index.css +1 -1
- package/es/calendar/Calendar.mjs +2 -2
- package/es/calendar/index.css +1 -1
- package/es/cascader/index.css +1 -1
- package/es/cell/index.css +1 -1
- package/es/cell-group/CellGroup.d.ts +1 -1
- package/es/cell-group/index.d.ts +1 -1
- package/es/checkbox/index.css +1 -1
- package/es/col/Col.d.ts +1 -1
- package/es/col/index.d.ts +1 -1
- package/es/collapse-item/CollapseItem.d.ts +1 -1
- package/es/collapse-item/index.d.ts +1 -1
- package/es/config-provider/ConfigProvider.d.ts +1 -1
- package/es/config-provider/index.d.ts +2 -2
- package/es/dialog/index.css +1 -1
- package/es/divider/Divider.d.ts +1 -1
- package/es/divider/index.d.ts +1 -1
- package/es/dropdown-menu/DropdownMenu.d.ts +1 -1
- package/es/dropdown-menu/index.d.ts +1 -1
- package/es/empty/Empty.d.ts +1 -1
- package/es/empty/index.d.ts +1 -1
- package/es/field/index.css +1 -1
- package/es/grid/Grid.d.ts +1 -1
- package/es/grid/index.d.ts +1 -1
- package/es/grid-item/GridItem.d.ts +1 -1
- package/es/grid-item/index.css +1 -1
- package/es/grid-item/index.d.ts +1 -1
- package/es/icon/Icon.d.ts +1 -1
- package/es/icon/config.mjs +3 -2
- package/es/icon/index.css +1 -1
- package/es/icon/index.d.ts +1 -1
- package/es/image-preview/ImagePreview.d.ts +2 -1
- package/es/image-preview/ImagePreview.mjs +9 -4
- package/es/image-preview/ImagePreviewItem.d.ts +2 -1
- package/es/image-preview/ImagePreviewItem.mjs +22 -13
- package/es/image-preview/index.css +1 -1
- package/es/image-preview/index.d.ts +2 -1
- package/es/index.d.ts +1 -1
- package/es/index.mjs +1 -1
- package/es/lazyload/vue-lazyload/lazy-image.mjs +5 -5
- package/es/loading/Loading.d.ts +1 -1
- package/es/loading/index.d.ts +1 -1
- package/es/media-picker/MediaPicker.mjs +1 -1
- package/es/media-picker/image/DefaultAudioIcon.d.ts +1 -1
- package/es/media-picker/image/DefaultFileIcon.d.ts +1 -1
- package/es/media-picker/image/DefaultVideoIcon.d.ts +1 -1
- package/es/media-picker/image/DeleteIcon.d.ts +1 -1
- package/es/media-picker/image/PickFileIcon.d.ts +1 -1
- package/es/media-picker/image/PickPhotoIcon.d.ts +1 -1
- package/es/media-picker/image/TakeAudioIcon.d.ts +1 -1
- package/es/media-picker/image/TakePhotoIcon.d.ts +1 -1
- package/es/media-picker/image/TakeVideoIcon.d.ts +1 -1
- package/es/media-picker/util/media-util.d.ts +17 -2
- package/es/media-picker/util/media-util.mjs +137 -10
- package/es/media-picker/watermark/image-processor.mjs +28 -3
- package/es/media-picker/watermark/watermark.mjs +3 -3
- package/es/multiple-picker/MultiplePicker.mjs +1 -2
- package/es/multiple-picker/index.css +1 -1
- package/es/multiple-picker/types.d.ts +2 -1
- package/es/nav-bar/index.css +1 -1
- package/es/overlay/Overlay.d.ts +1 -1
- package/es/overlay/index.d.ts +1 -1
- package/es/picker/PickerColumn.mjs +5 -4
- package/es/picker/index.css +1 -1
- package/es/popup/Popup.d.ts +26 -0
- package/es/popup/Popup.mjs +12 -10
- package/es/popup/index.css +1 -1
- package/es/popup/index.d.ts +18 -0
- package/es/radio/index.css +1 -1
- package/es/row/Row.d.ts +1 -1
- package/es/row/index.d.ts +1 -1
- package/es/search/index.css +1 -1
- package/es/skeleton/Skeleton.d.ts +1 -1
- package/es/skeleton/index.d.ts +1 -1
- package/es/step/Step.d.ts +1 -1
- package/es/step/index.d.ts +1 -1
- package/es/stepper/Stepper.d.ts +1 -1
- package/es/stepper/Stepper.mjs +1 -2
- package/es/stepper/index.d.ts +1 -1
- package/es/style/base.css +1 -1
- package/es/style/css-variables.css +1 -1
- package/es/swipe/Swipe.mjs +1 -3
- package/es/swipe-item/SwipeItem.d.ts +1 -1
- package/es/swipe-item/index.d.ts +1 -1
- package/es/tab/Tab.d.ts +1 -1
- package/es/tab/index.d.ts +1 -1
- package/es/tabbar-item/index.css +1 -1
- package/es/tabs/TabsTitle.d.ts +1 -1
- package/es/tabs/index.css +1 -1
- package/es/time-picker/index.css +1 -1
- package/es/toast/index.css +1 -1
- package/es/utils/constant.d.ts +1 -0
- package/es/utils/constant.mjs +3 -1
- package/es/utils/mount-component.d.ts +1 -1
- package/lib/action-sheet/index.css +1 -1
- package/lib/avatar/Avatar.d.ts +5 -1
- package/lib/avatar/Avatar.js +9 -4
- package/lib/avatar/index.css +1 -1
- package/lib/avatar/index.d.ts +4 -1
- package/lib/badge/Badge.d.ts +1 -1
- package/lib/badge/index.d.ts +1 -1
- package/lib/button/index.css +1 -1
- package/lib/calendar/Calendar.js +2 -2
- package/lib/calendar/index.css +1 -1
- package/lib/cascader/index.css +1 -1
- package/lib/cell/index.css +1 -1
- package/lib/cell-group/CellGroup.d.ts +1 -1
- package/lib/cell-group/index.d.ts +1 -1
- package/lib/checkbox/index.css +1 -1
- package/lib/col/Col.d.ts +1 -1
- package/lib/col/index.d.ts +1 -1
- package/lib/collapse-item/CollapseItem.d.ts +1 -1
- package/lib/collapse-item/index.d.ts +1 -1
- package/lib/config-provider/ConfigProvider.d.ts +1 -1
- package/lib/config-provider/index.d.ts +2 -2
- package/lib/dialog/index.css +1 -1
- package/lib/divider/Divider.d.ts +1 -1
- package/lib/divider/index.d.ts +1 -1
- package/lib/dropdown-menu/DropdownMenu.d.ts +1 -1
- package/lib/dropdown-menu/index.d.ts +1 -1
- package/lib/empty/Empty.d.ts +1 -1
- package/lib/empty/index.d.ts +1 -1
- package/lib/field/index.css +1 -1
- package/lib/grid/Grid.d.ts +1 -1
- package/lib/grid/index.d.ts +1 -1
- package/lib/grid-item/GridItem.d.ts +1 -1
- package/lib/grid-item/index.css +1 -1
- package/lib/grid-item/index.d.ts +1 -1
- package/lib/icon/Icon.d.ts +1 -1
- package/lib/icon/config.js +3 -2
- package/lib/icon/index.css +1 -1
- package/lib/icon/index.d.ts +1 -1
- package/lib/image-preview/ImagePreview.d.ts +2 -1
- package/lib/image-preview/ImagePreview.js +9 -4
- package/lib/image-preview/ImagePreviewItem.d.ts +2 -1
- package/lib/image-preview/ImagePreviewItem.js +21 -12
- package/lib/image-preview/index.css +1 -1
- package/lib/image-preview/index.d.ts +2 -1
- package/lib/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/lazyload/vue-lazyload/lazy-image.js +6 -6
- package/lib/loading/Loading.d.ts +1 -1
- package/lib/loading/index.d.ts +1 -1
- package/lib/media-picker/MediaPicker.js +1 -1
- package/lib/media-picker/image/DefaultAudioIcon.d.ts +1 -1
- package/lib/media-picker/image/DefaultFileIcon.d.ts +1 -1
- package/lib/media-picker/image/DefaultVideoIcon.d.ts +1 -1
- package/lib/media-picker/image/DeleteIcon.d.ts +1 -1
- package/lib/media-picker/image/PickFileIcon.d.ts +1 -1
- package/lib/media-picker/image/PickPhotoIcon.d.ts +1 -1
- package/lib/media-picker/image/TakeAudioIcon.d.ts +1 -1
- package/lib/media-picker/image/TakePhotoIcon.d.ts +1 -1
- package/lib/media-picker/image/TakeVideoIcon.d.ts +1 -1
- package/lib/media-picker/util/media-util.d.ts +17 -2
- package/lib/media-picker/util/media-util.js +137 -10
- package/lib/media-picker/watermark/image-processor.js +22 -2
- package/lib/media-picker/watermark/watermark.js +5 -5
- package/lib/multiple-picker/MultiplePicker.js +1 -2
- package/lib/multiple-picker/index.css +1 -1
- package/lib/multiple-picker/types.d.ts +2 -1
- package/lib/nav-bar/index.css +1 -1
- package/lib/overlay/Overlay.d.ts +1 -1
- package/lib/overlay/index.d.ts +1 -1
- package/lib/picker/PickerColumn.js +5 -4
- package/lib/picker/index.css +1 -1
- package/lib/popup/Popup.d.ts +26 -0
- package/lib/popup/Popup.js +11 -9
- package/lib/popup/index.css +1 -1
- package/lib/popup/index.d.ts +18 -0
- package/lib/radio/index.css +1 -1
- package/lib/row/Row.d.ts +1 -1
- package/lib/row/index.d.ts +1 -1
- package/lib/search/index.css +1 -1
- package/lib/skeleton/Skeleton.d.ts +1 -1
- package/lib/skeleton/index.d.ts +1 -1
- package/lib/step/Step.d.ts +1 -1
- package/lib/step/index.d.ts +1 -1
- package/lib/stepper/Stepper.d.ts +1 -1
- package/lib/stepper/Stepper.js +1 -2
- package/lib/stepper/index.d.ts +1 -1
- package/lib/style/base.css +1 -1
- package/lib/style/css-variables.css +1 -1
- package/lib/swipe/Swipe.js +1 -3
- package/lib/swipe-item/SwipeItem.d.ts +1 -1
- package/lib/swipe-item/index.d.ts +1 -1
- package/lib/tab/Tab.d.ts +1 -1
- package/lib/tab/index.d.ts +1 -1
- package/lib/tabbar-item/index.css +1 -1
- package/lib/tabs/TabsTitle.d.ts +1 -1
- package/lib/tabs/index.css +1 -1
- package/lib/time-picker/index.css +1 -1
- package/lib/toast/index.css +1 -1
- package/lib/utils/constant.d.ts +1 -0
- package/lib/utils/constant.js +3 -1
- package/lib/utils/mount-component.d.ts +1 -1
- package/lib/web-types.json +1 -1
- package/lib/zartui.cjs.js +217 -144
- package/lib/zartui.es.js +215 -142
- package/lib/zartui.js +251 -112
- package/lib/zartui.min.js +1 -1
- package/package.json +4 -3
- package/es/media-picker/util/orientation-util.d.ts +0 -37
- package/es/media-picker/util/orientation-util.mjs +0 -118
- package/es/tabbar/image/common-normal.png +0 -0
- package/es/utils/date.d.ts +0 -29
- package/es/utils/date.mjs +0 -96
- package/lib/media-picker/util/orientation-util.d.ts +0 -37
- package/lib/media-picker/util/orientation-util.js +0 -137
- package/lib/tabbar/image/common-normal.png +0 -0
- package/lib/utils/date.d.ts +0 -29
- package/lib/utils/date.js +0 -115
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -154,7 +154,7 @@ __reExport(stdin_exports, require("./tag"), module.exports);
|
|
|
154
154
|
__reExport(stdin_exports, require("./time-picker"), module.exports);
|
|
155
155
|
__reExport(stdin_exports, require("./toast"), module.exports);
|
|
156
156
|
__reExport(stdin_exports, require("./uploader"), module.exports);
|
|
157
|
-
const version = "3.0.
|
|
157
|
+
const version = "3.0.5";
|
|
158
158
|
function install(app) {
|
|
159
159
|
const components = [
|
|
160
160
|
import_action_sheet.ActionSheet,
|
|
@@ -23,6 +23,7 @@ module.exports = __toCommonJS(stdin_exports);
|
|
|
23
23
|
var import_use = require("@zartui/use");
|
|
24
24
|
var import_util = require("./util");
|
|
25
25
|
var import_utils = require("../../utils");
|
|
26
|
+
var import_vue = require("vue");
|
|
26
27
|
var stdin_default = (lazyManager) => ({
|
|
27
28
|
props: {
|
|
28
29
|
src: [String, Object],
|
|
@@ -31,15 +32,14 @@ var stdin_default = (lazyManager) => ({
|
|
|
31
32
|
default: "img"
|
|
32
33
|
}
|
|
33
34
|
},
|
|
34
|
-
render(
|
|
35
|
-
|
|
35
|
+
render() {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
return (0, import_vue.h)(
|
|
36
38
|
this.tag,
|
|
37
39
|
{
|
|
38
|
-
|
|
39
|
-
src: this.renderSrc
|
|
40
|
-
}
|
|
40
|
+
src: this.renderSrc
|
|
41
41
|
},
|
|
42
|
-
this.$slots.default
|
|
42
|
+
(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)
|
|
43
43
|
);
|
|
44
44
|
},
|
|
45
45
|
data() {
|
package/lib/loading/Loading.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
22
22
|
vertical: BooleanConstructor;
|
|
23
23
|
textSize: (NumberConstructor | StringConstructor)[];
|
|
24
24
|
textColor: StringConstructor;
|
|
25
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
25
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
|
26
26
|
size: (NumberConstructor | StringConstructor)[];
|
|
27
27
|
type: {
|
|
28
28
|
type: import("vue").PropType<LoadingType>;
|
package/lib/loading/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const Loading: import("../utils").WithInstall<import("vue").Defin
|
|
|
8
8
|
vertical: BooleanConstructor;
|
|
9
9
|
textSize: (NumberConstructor | StringConstructor)[];
|
|
10
10
|
textColor: StringConstructor;
|
|
11
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
11
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
12
12
|
size: (NumberConstructor | StringConstructor)[];
|
|
13
13
|
type: {
|
|
14
14
|
type: import("vue").PropType<import("./Loading").LoadingType>;
|
|
@@ -562,7 +562,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
562
562
|
if (media.showSrc) {
|
|
563
563
|
return (0, import_vue.createVNode)(import_image.default, {
|
|
564
564
|
"src": media.showSrc,
|
|
565
|
-
"fit": "
|
|
565
|
+
"fit": "cover",
|
|
566
566
|
"radius": "4"
|
|
567
567
|
}, null);
|
|
568
568
|
} else if (media.type === "video") {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
2
|
export default _default;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
1
|
+
declare const _default: import("vue").DefineComponent<{}, () => JSX.Element, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
2
2
|
export default _default;
|
|
@@ -27,10 +27,12 @@ export declare function file2Image(file: File): Promise<HTMLImageElement>;
|
|
|
27
27
|
/**
|
|
28
28
|
* Draw image on canvas
|
|
29
29
|
* @param img
|
|
30
|
+
* @param type
|
|
31
|
+
* @param orientation
|
|
30
32
|
* @param width
|
|
31
33
|
* @param height
|
|
32
34
|
*/
|
|
33
|
-
export declare function image2Canvas(img: HTMLImageElement, width?: number, height?: number): Promise<HTMLCanvasElement>;
|
|
35
|
+
export declare function image2Canvas(img: HTMLImageElement, type: string, orientation?: number, width?: number, height?: number): Promise<HTMLCanvasElement>;
|
|
34
36
|
/**
|
|
35
37
|
* Export File from canvas
|
|
36
38
|
* @param canvas
|
|
@@ -51,9 +53,19 @@ export declare function image2file(img: HTMLImageElement, fileName: string, last
|
|
|
51
53
|
*/
|
|
52
54
|
export declare function canvas2Image(canvas: HTMLCanvasElement, type?: string, quality?: number): Promise<HTMLImageElement>;
|
|
53
55
|
export declare type ResizeResultType = 'image' | 'canvas';
|
|
56
|
+
/**
|
|
57
|
+
* Get orientation value from given array buffer.
|
|
58
|
+
* @param {ArrayBuffer} arrayBuffer - The array buffer to read.
|
|
59
|
+
* @returns {number} The read orientation value.
|
|
60
|
+
* Source:https://github.com/fengyuanchen/compressorjs/blob/main/src/utilities.js
|
|
61
|
+
* 99行,resetAndGetOrientation方法
|
|
62
|
+
*/
|
|
63
|
+
export declare function getOrientation(arrayBuffer: ArrayBuffer): number | undefined;
|
|
54
64
|
/**
|
|
55
65
|
* 缩放图片
|
|
56
66
|
* @param img:HTMLImageElement 图片对象
|
|
67
|
+
* @param inputType 图片类型
|
|
68
|
+
* @param orientation
|
|
57
69
|
* @param imageWidth 图片宽度
|
|
58
70
|
* @param imageHeight 图片高度
|
|
59
71
|
// * @param equalProportion 是否等比例拉伸,默认是,目前只支持等比例拉伸
|
|
@@ -61,8 +73,11 @@ export declare type ResizeResultType = 'image' | 'canvas';
|
|
|
61
73
|
* @param baseOnShortSide 是否以短边为限制
|
|
62
74
|
* @param resultType: ResizeResultType, "image" | "canvas"
|
|
63
75
|
*/
|
|
64
|
-
export declare function resize(img: HTMLImageElement, {
|
|
76
|
+
export declare function resize(img: HTMLImageElement, { inputType, orientation, // 图片的方向
|
|
77
|
+
imageWidth, imageHeight, sideLengthLimit, baseOnShortSide, // 是否以短边为基准缩放
|
|
65
78
|
resultType, }: {
|
|
79
|
+
inputType?: string | undefined;
|
|
80
|
+
orientation?: number | undefined;
|
|
66
81
|
imageWidth?: number | undefined;
|
|
67
82
|
imageHeight?: number | undefined;
|
|
68
83
|
sideLengthLimit?: number | undefined;
|
|
@@ -25,6 +25,7 @@ __export(stdin_exports, {
|
|
|
25
25
|
file2DataURL: () => file2DataURL,
|
|
26
26
|
file2Image: () => file2Image,
|
|
27
27
|
getFileUniqueCode: () => getFileUniqueCode,
|
|
28
|
+
getOrientation: () => getOrientation,
|
|
28
29
|
getUniqueFileName: () => getUniqueFileName,
|
|
29
30
|
image2Canvas: () => image2Canvas,
|
|
30
31
|
image2file: () => image2file,
|
|
@@ -37,6 +38,17 @@ module.exports = __toCommonJS(stdin_exports);
|
|
|
37
38
|
const MAX_SIDE_LENGTH = 1920;
|
|
38
39
|
const MIN_SIDE_LENGTH = 480;
|
|
39
40
|
const PHOTO_FILE_SIZE_LIMIT = 1e3;
|
|
41
|
+
var Orientation = /* @__PURE__ */ ((Orientation2) => {
|
|
42
|
+
Orientation2[Orientation2["TOP_AND_LEFT"] = 1] = "TOP_AND_LEFT";
|
|
43
|
+
Orientation2[Orientation2["TOP_AND_RIGHT"] = 2] = "TOP_AND_RIGHT";
|
|
44
|
+
Orientation2[Orientation2["BOTTOM_AND_RIGHT"] = 3] = "BOTTOM_AND_RIGHT";
|
|
45
|
+
Orientation2[Orientation2["BOTTOM_AND_LEFT"] = 4] = "BOTTOM_AND_LEFT";
|
|
46
|
+
Orientation2[Orientation2["LEFT_AND_TOP"] = 5] = "LEFT_AND_TOP";
|
|
47
|
+
Orientation2[Orientation2["RIGHT_AND_TOP"] = 6] = "RIGHT_AND_TOP";
|
|
48
|
+
Orientation2[Orientation2["RIGHT_AND_BOTTOM"] = 7] = "RIGHT_AND_BOTTOM";
|
|
49
|
+
Orientation2[Orientation2["LEFT_AND_BOTTOM"] = 8] = "LEFT_AND_BOTTOM";
|
|
50
|
+
return Orientation2;
|
|
51
|
+
})(Orientation || {});
|
|
40
52
|
function isImageType(file) {
|
|
41
53
|
return file.type.indexOf("image/") >= 0;
|
|
42
54
|
}
|
|
@@ -60,6 +72,47 @@ function getUniqueFileName(file, suffix = "") {
|
|
|
60
72
|
)}`;
|
|
61
73
|
return suffix ? name + "." + suffix : name;
|
|
62
74
|
}
|
|
75
|
+
function adjustImgOrientation(ctx, img, orientation, width, height) {
|
|
76
|
+
switch (orientation) {
|
|
77
|
+
case 3 /* BOTTOM_AND_RIGHT */:
|
|
78
|
+
ctx.rotate(180 * Math.PI / 180);
|
|
79
|
+
ctx.drawImage(img, -width, -height, width, height);
|
|
80
|
+
break;
|
|
81
|
+
case 6 /* RIGHT_AND_TOP */:
|
|
82
|
+
ctx.rotate(90 * Math.PI / 180);
|
|
83
|
+
ctx.drawImage(img, 0, -width, height, width);
|
|
84
|
+
break;
|
|
85
|
+
case 8 /* LEFT_AND_BOTTOM */:
|
|
86
|
+
ctx.rotate(270 * Math.PI / 180);
|
|
87
|
+
ctx.drawImage(img, -height, 0, height, width);
|
|
88
|
+
break;
|
|
89
|
+
case 2 /* TOP_AND_RIGHT */:
|
|
90
|
+
ctx.translate(width, 0);
|
|
91
|
+
ctx.scale(-1, 1);
|
|
92
|
+
ctx.drawImage(img, 0, 0, width, height);
|
|
93
|
+
break;
|
|
94
|
+
case 4 /* BOTTOM_AND_LEFT */:
|
|
95
|
+
ctx.translate(width, 0);
|
|
96
|
+
ctx.scale(-1, 1);
|
|
97
|
+
ctx.rotate(180 * Math.PI / 180);
|
|
98
|
+
ctx.drawImage(img, -width, -height, width, height);
|
|
99
|
+
break;
|
|
100
|
+
case 5 /* LEFT_AND_TOP */:
|
|
101
|
+
ctx.translate(width, 0);
|
|
102
|
+
ctx.scale(-1, 1);
|
|
103
|
+
ctx.rotate(90 * Math.PI / 180);
|
|
104
|
+
ctx.drawImage(img, 0, -width, height, width);
|
|
105
|
+
break;
|
|
106
|
+
case 7 /* RIGHT_AND_BOTTOM */:
|
|
107
|
+
ctx.translate(width, 0);
|
|
108
|
+
ctx.scale(-1, 1);
|
|
109
|
+
ctx.rotate(270 * Math.PI / 180);
|
|
110
|
+
ctx.drawImage(img, -height, 0, height, width);
|
|
111
|
+
break;
|
|
112
|
+
default:
|
|
113
|
+
ctx.drawImage(img, 0, 0, width, height);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
63
116
|
function file2DataURL(file) {
|
|
64
117
|
return new Promise((resolve, reject) => {
|
|
65
118
|
const a = new FileReader();
|
|
@@ -88,7 +141,7 @@ function file2Image(file) {
|
|
|
88
141
|
}).catch(reject);
|
|
89
142
|
});
|
|
90
143
|
}
|
|
91
|
-
function image2Canvas(img, width, height) {
|
|
144
|
+
function image2Canvas(img, type, orientation, width, height) {
|
|
92
145
|
const canvas = document.createElement("canvas");
|
|
93
146
|
const _width = width || img.width;
|
|
94
147
|
const _height = height || img.height;
|
|
@@ -96,9 +149,12 @@ function image2Canvas(img, width, height) {
|
|
|
96
149
|
canvas.height = _height;
|
|
97
150
|
const ctx = canvas.getContext("2d");
|
|
98
151
|
if (ctx) {
|
|
99
|
-
ctx.fillStyle = "
|
|
152
|
+
ctx.fillStyle = "transparent";
|
|
153
|
+
if (type === "image/jpeg") {
|
|
154
|
+
ctx.fillStyle = "#fff";
|
|
155
|
+
}
|
|
100
156
|
ctx.fillRect(0, 0, _width, _height);
|
|
101
|
-
ctx
|
|
157
|
+
adjustImgOrientation(ctx, img, orientation, _width, _height);
|
|
102
158
|
return Promise.resolve(canvas);
|
|
103
159
|
}
|
|
104
160
|
return Promise.reject(new Error("canvas getContext return null"));
|
|
@@ -120,7 +176,7 @@ function canvas2File(canvas, fileName, lastModified, type = "image/jpeg", qualit
|
|
|
120
176
|
});
|
|
121
177
|
}
|
|
122
178
|
function image2file(img, fileName, lastModified, type = "image/jpeg", quality = 0.8) {
|
|
123
|
-
return image2Canvas(img).then(
|
|
179
|
+
return image2Canvas(img, type).then(
|
|
124
180
|
(canvas) => canvas2File(canvas, fileName, lastModified, type, quality)
|
|
125
181
|
);
|
|
126
182
|
}
|
|
@@ -129,7 +185,74 @@ function canvas2Image(canvas, type = "image/jpeg", quality = 0.8) {
|
|
|
129
185
|
image.src = canvas.toDataURL(type, quality);
|
|
130
186
|
return Promise.resolve(image);
|
|
131
187
|
}
|
|
188
|
+
function getStringFromCharCode(dataView, start, length) {
|
|
189
|
+
let str = "";
|
|
190
|
+
let i;
|
|
191
|
+
length += start;
|
|
192
|
+
for (i = start; i < length; i += 1) {
|
|
193
|
+
str += String.fromCharCode(dataView.getUint8(i));
|
|
194
|
+
}
|
|
195
|
+
return str;
|
|
196
|
+
}
|
|
197
|
+
function getOrientation(arrayBuffer) {
|
|
198
|
+
const dataView = new DataView(arrayBuffer);
|
|
199
|
+
let orientation;
|
|
200
|
+
try {
|
|
201
|
+
let littleEndian;
|
|
202
|
+
let app1Start;
|
|
203
|
+
let ifdStart;
|
|
204
|
+
if (dataView.getUint8(0) === 255 && dataView.getUint8(1) === 216) {
|
|
205
|
+
const length = dataView.byteLength;
|
|
206
|
+
let offset = 2;
|
|
207
|
+
while (offset + 1 < length) {
|
|
208
|
+
if (dataView.getUint8(offset) === 255 && dataView.getUint8(offset + 1) === 225) {
|
|
209
|
+
app1Start = offset;
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
offset += 1;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (app1Start) {
|
|
216
|
+
const exifIDCode = app1Start + 4;
|
|
217
|
+
const tiffOffset = app1Start + 10;
|
|
218
|
+
if (getStringFromCharCode(dataView, exifIDCode, 4) === "Exif") {
|
|
219
|
+
const endianness = dataView.getUint16(tiffOffset);
|
|
220
|
+
littleEndian = endianness === 18761;
|
|
221
|
+
if (littleEndian || endianness === 19789) {
|
|
222
|
+
if (dataView.getUint16(tiffOffset + 2, littleEndian) === 42) {
|
|
223
|
+
const firstIFDOffset = dataView.getUint32(
|
|
224
|
+
tiffOffset + 4,
|
|
225
|
+
littleEndian
|
|
226
|
+
);
|
|
227
|
+
if (firstIFDOffset >= 8) {
|
|
228
|
+
ifdStart = tiffOffset + firstIFDOffset;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
if (ifdStart) {
|
|
235
|
+
const _length = dataView.getUint16(ifdStart, littleEndian);
|
|
236
|
+
let _offset;
|
|
237
|
+
let i;
|
|
238
|
+
for (i = 0; i < _length; i += 1) {
|
|
239
|
+
_offset = ifdStart + i * 12 + 2;
|
|
240
|
+
if (dataView.getUint16(_offset, littleEndian) === 274) {
|
|
241
|
+
_offset += 8;
|
|
242
|
+
orientation = dataView.getUint16(_offset, littleEndian);
|
|
243
|
+
dataView.setUint16(_offset, 1, littleEndian);
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
} catch (e) {
|
|
249
|
+
orientation = 1;
|
|
250
|
+
}
|
|
251
|
+
return orientation;
|
|
252
|
+
}
|
|
132
253
|
function resize(img, {
|
|
254
|
+
inputType = "image/jpeg",
|
|
255
|
+
orientation = 1,
|
|
133
256
|
imageWidth = -1,
|
|
134
257
|
imageHeight = -1,
|
|
135
258
|
sideLengthLimit = 640,
|
|
@@ -147,12 +270,16 @@ function resize(img, {
|
|
|
147
270
|
} else {
|
|
148
271
|
return Promise.reject(new Error("image width/height \u65E0\u6548"));
|
|
149
272
|
}
|
|
150
|
-
const targetWidth = imageWidth * scale;
|
|
151
|
-
const targetHeight = imageHeight * scale;
|
|
273
|
+
const targetWidth = scale > 1 ? imageWidth : imageWidth * scale;
|
|
274
|
+
const targetHeight = scale > 1 ? imageHeight : imageHeight * scale;
|
|
152
275
|
if (resultType === "image") {
|
|
153
|
-
return image2Canvas(
|
|
154
|
-
|
|
155
|
-
|
|
276
|
+
return image2Canvas(
|
|
277
|
+
img,
|
|
278
|
+
inputType,
|
|
279
|
+
orientation,
|
|
280
|
+
targetWidth,
|
|
281
|
+
targetHeight
|
|
282
|
+
).then((canvas) => canvas2Image(canvas));
|
|
156
283
|
}
|
|
157
|
-
return image2Canvas(img, targetWidth, targetHeight);
|
|
284
|
+
return image2Canvas(img, inputType, orientation, targetWidth, targetHeight);
|
|
158
285
|
}
|
|
@@ -21,8 +21,8 @@ __export(stdin_exports, {
|
|
|
21
21
|
});
|
|
22
22
|
module.exports = __toCommonJS(stdin_exports);
|
|
23
23
|
var import_watermark = require("./watermark");
|
|
24
|
+
var import_utils = require("../../utils");
|
|
24
25
|
var import_media_util = require("../util/media-util");
|
|
25
|
-
const DEFAULT_IMAGE_TYPE = "image/jpeg";
|
|
26
26
|
const DEFAULT_JPEG_QUALITY = 0.8;
|
|
27
27
|
const MIN_JPEG_QUALITY = 0.1;
|
|
28
28
|
const JPEG_QUALITY_STEP = 0.05;
|
|
@@ -35,9 +35,29 @@ class ImageProcessor {
|
|
|
35
35
|
}
|
|
36
36
|
process() {
|
|
37
37
|
const filename = this.file.name;
|
|
38
|
+
let fileType = this.file.type;
|
|
38
39
|
const { lastModified } = this.file;
|
|
40
|
+
let orientation = 1;
|
|
41
|
+
if (this.file.size > this.compressOptions.photoFileSizeLimit * 1024) {
|
|
42
|
+
fileType = "image/jpeg";
|
|
43
|
+
}
|
|
44
|
+
if ((0, import_utils.isIOS)() && fileType === "image/jpeg") {
|
|
45
|
+
const reader = new FileReader();
|
|
46
|
+
reader.readAsArrayBuffer(this.file);
|
|
47
|
+
reader.onload = function(_ref) {
|
|
48
|
+
const { target } = _ref;
|
|
49
|
+
if (target == null ? void 0 : target.result) {
|
|
50
|
+
orientation = (0, import_media_util.getOrientation)(target == null ? void 0 : target.result);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
if (fileType === "image/gif") {
|
|
55
|
+
fileType = "image/png";
|
|
56
|
+
}
|
|
39
57
|
return (0, import_media_util.file2Image)(this.file).then(
|
|
40
58
|
(img) => (0, import_media_util.resize)(img, {
|
|
59
|
+
inputType: fileType,
|
|
60
|
+
orientation,
|
|
41
61
|
sideLengthLimit: this.resizeOptions.maxSideLength,
|
|
42
62
|
resultType: "canvas"
|
|
43
63
|
})
|
|
@@ -50,7 +70,7 @@ class ImageProcessor {
|
|
|
50
70
|
canvas,
|
|
51
71
|
exportFilename,
|
|
52
72
|
lastModified,
|
|
53
|
-
|
|
73
|
+
fileType,
|
|
54
74
|
DEFAULT_JPEG_QUALITY
|
|
55
75
|
);
|
|
56
76
|
});
|
|
@@ -24,7 +24,7 @@ __export(stdin_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(stdin_exports);
|
|
25
25
|
var import_utils = require("../../utils");
|
|
26
26
|
var import_parse = require("../../utils/parse");
|
|
27
|
-
var
|
|
27
|
+
var import_date_utils = require("@zartui/date-utils");
|
|
28
28
|
const clamp = (value, min, max) => Math.min(Math.max(value, min), max);
|
|
29
29
|
const subString = (str, startIndex, length) => {
|
|
30
30
|
if (!(0, import_utils.isDef)(length)) {
|
|
@@ -276,22 +276,22 @@ function buildContent(contentConfigString, watermarkContext) {
|
|
|
276
276
|
const regexResult = scanner.next(dateRegex);
|
|
277
277
|
if (regexResult) {
|
|
278
278
|
const matchResults = regexResult;
|
|
279
|
-
let format =
|
|
279
|
+
let format = import_date_utils.DATE_FORMAT.FORMAT_YMD;
|
|
280
280
|
if (matchResults && matchResults.length >= 2) {
|
|
281
281
|
if ((0, import_utils.isValidString)(matchResults[1])) {
|
|
282
282
|
format = matchResults[1];
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
285
|
if (watermarkContext) {
|
|
286
|
-
content += (0,
|
|
286
|
+
content += (0, import_date_utils.formatDate)(watermarkContext.watermarkTime, format);
|
|
287
287
|
}
|
|
288
288
|
scanner.skip(matchResults.input);
|
|
289
289
|
}
|
|
290
290
|
} else if (scanner.hasNext("time" /* Time */)) {
|
|
291
291
|
if (watermarkContext) {
|
|
292
|
-
const value = (0,
|
|
292
|
+
const value = (0, import_date_utils.formatDate)(
|
|
293
293
|
watermarkContext.watermarkTime,
|
|
294
|
-
|
|
294
|
+
import_date_utils.DATE_FORMAT.FORMAT_HM
|
|
295
295
|
);
|
|
296
296
|
content += value;
|
|
297
297
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--zt-multiple-picker-warpper-padding: 12px 16px 4px 16px;--zt-multiple-picker-option-text-color: var(--zt-gray-default);--zt-multiple-picker-background-color: var(--zt-white);--zt-multiple-picker-toolbar-height: 44px;--zt-multiple-picker-action-padding: 0 var(--zt-padding-md);--zt-multiple-picker-title-font-size: var(--zt-font-size-md);--zt-multiple-picker-title-opacity: var(--zt-disabled-opacity);--zt-multiple-picker-title-padding: 12px 0;--zt-multiple-picker-title-line-height: var(--zt-line-height-md);--zt-multiple-picker-item-padding: 0 4px 8px 0;--zt-multiple-picker-action-font-size: var(--zt-font-size-md);--zt-multiple-picker-confirm-action-font-weight: var(--zt-font-bold);--zt-multiple-picker-confirm-action-color: var(--zt-blue);--zt-multiple-picker-cancel-action-font-weight: normal;--zt-multiple-picker-cancel-action-color: var(--zt-black);--zt-multiple-picker-option-font-size: var(--zt-font-size-md);--zt-multiple-picker-option-disabled-opacity: .3;--zt-multiple-picker-option-active-opacity: .7;--zt-multiple-picker-max-height:
|
|
1
|
+
:root{--zt-multiple-picker-warpper-padding: 12px 16px 4px 16px;--zt-multiple-picker-option-text-color: var(--zt-gray-default);--zt-multiple-picker-background-color: var(--zt-white);--zt-multiple-picker-toolbar-height: 44px;--zt-multiple-picker-action-padding: 0 var(--zt-padding-md);--zt-multiple-picker-title-font-size: var(--zt-font-size-md);--zt-multiple-picker-title-opacity: var(--zt-disabled-opacity);--zt-multiple-picker-title-padding: 12px 0;--zt-multiple-picker-title-line-height: var(--zt-line-height-md);--zt-multiple-picker-item-padding: 0 4px 8px 0;--zt-multiple-picker-action-font-size: var(--zt-font-size-md);--zt-multiple-picker-confirm-action-font-weight: var(--zt-font-bold);--zt-multiple-picker-confirm-action-color: var(--zt-blue);--zt-multiple-picker-cancel-action-font-weight: normal;--zt-multiple-picker-cancel-action-color: var(--zt-black);--zt-multiple-picker-option-font-size: var(--zt-font-size-md);--zt-multiple-picker-option-disabled-opacity: .3;--zt-multiple-picker-option-active-opacity: .7;--zt-multiple-picker-max-height: 84vh;--zt-multiple-picker-loading-icon-color: var(--zt-blue);--zt-multiple-picker-loading-index: 3;--zt-multiple-picker-loading-mask-color: rgba(255, 255, 255, .9);--zt-multiple-picker-toolbar-padding: 8px 16px;--zt-multiple-picker-ellipsis-border-radius: 18px;--zt-multiple-picker-ellipsis-border: 1px solid var(--zt-gray-a2);--zt-multiple-picker-ellipsis-line-height: 20px;--zt-multiple-picker-title-background: var(--zt-white)}.zt-multiple-picker{display:flex;flex-direction:column;justify-content:space-between;position:relative;background-color:var(--zt-multiple-picker-background-color);-webkit-user-select:none;user-select:none;max-height:var(--zt-multiple-picker-max-height)}.zt-multiple-picker__toolbar{display:flex;align-items:center;justify-content:space-between;box-sizing:content-box;flex-shrink:0;background:var(--zt-multiple-picker-title-background);height:var(--zt-multiple-picker-toolbar-height);padding:var(--zt-multiple-picker-toolbar-padding)}.zt-multiple-picker__cancel,.zt-multiple-picker__confirm{height:100%;padding:var(--zt-multiple-picker-action-padding);font-size:var(--zt-multiple-picker-action-font-size);background-color:transparent;border:none;cursor:pointer}.zt-multiple-picker__cancel:active,.zt-multiple-picker__confirm:active{opacity:var(--zt-multiple-picker-option-active-opacity)}.zt-multiple-picker__confirm{color:var(--zt-multiple-picker-confirm-action-color);font-weight:var(--zt-multiple-picker-confirm-action-font-weight)}.zt-multiple-picker__cancel{color:var(--zt-multiple-picker-cancel-action-color);font-weight:var(--zt-multiple-picker-cancel-action-font-weight)}.zt-multiple-picker__title{flex-shrink:0;font-weight:var(--zt-multiple-picker-cancel-action-font-weight);font-size:var(--zt-multiple-picker-title-font-size);line-height:var(--zt-multiple-picker-title-line-height);text-align:center;background:var(--zt-multiple-picker-title-background);color:var(--zt-gray-default);opacity:var(--zt-multiple-picker-title-opacity);padding:var(--zt-multiple-picker-title-padding)}.zt-multiple-picker__options{position:relative;display:flex;cursor:-webkit-grab;cursor:grab;overflow-y:scroll}.zt-multiple-picker__options:after{position:absolute;box-sizing:border-box;content:" ";pointer-events:none;right:0;bottom:0;left:0;border-bottom:1px solid var(--zt-border-color);transform:scaleY(.5)}.zt-multiple-picker__options:before{position:absolute;box-sizing:border-box;content:" ";pointer-events:none;top:0;right:0;left:0;border-top:1px solid var(--zt-border-color);transform:scaleY(.5)}.zt-multiple-picker__loading{position:absolute;top:0;right:0;bottom:0;left:0;z-index:3;display:flex;align-items:center;justify-content:center;color:var(--zt-multiple-picker-loading-icon-color);background-color:var(--zt-multiple-picker-loading-mask-color)}.zt-multiple-picker-options{flex:1;overflow-y:scroll;font-size:var(--zt-multiple-picker-option-font-size);margin:0;outline:0 none;padding:0}.zt-multiple-picker-options__wrapper{display:flex;flex-wrap:wrap;background-color:var(--zt-multiple-picker-background-color);padding:var(--zt-multiple-picker-warpper-padding)}.zt-multiple-picker-options__item{color:var(--zt-multiple-picker-option-text-color);padding:var(--zt-multiple-picker-item-padding);box-sizing:border-box;text-align:center;font-size:var(--zt-font-size-md)}.zt-multiple-picker-options__item .zt-ellipsis{line-height:var(--zt-multiple-picker-ellipsis-line-height);border-radius:var(--zt-multiple-picker-ellipsis-border-radius);border:var(--zt-multiple-picker-ellipsis-border);padding:var(--zt-multiple-picker-toolbar-padding);opacity:var(--zt-active-opacity)}.zt-multiple-picker-options__item--disabled{cursor:not-allowed;opacity:var(--zt-multiple-picker-option-disabled-opacity)}.zt-multiple-picker-options__item--last{padding-right:0}.zt-multiple-picker-options__item--selected .zt-ellipsis{background:rgba(0,145,250,.1);border:1px solid rgba(0,145,250,.6);border-radius:var(--zt-multiple-picker-ellipsis-border-radius);color:var(--zt-blue);opacity:1}.zt-theme-dark{--zt-multiple-picker-title-background: var(--zt-background-2);--zt-multiple-picker-title-opacity: 1;--zt-multiple-picker-background-color: var(--zt-background-2);--zt-multiple-picker-option-text-color: var(--zt-white);--zt-multiple-picker-cancel-action-color: rgba(255, 255, 255, .04);--zt-multiple-picker-ellipsis-border: .5px solid rgba(255, 255, 255, .2)}
|
|
@@ -6,9 +6,10 @@ export declare type PickerOption = {
|
|
|
6
6
|
value?: Numeric;
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
className?: unknown;
|
|
9
|
+
initialIndex?: number;
|
|
9
10
|
[key: PropertyKey]: any;
|
|
10
11
|
};
|
|
11
12
|
export declare type MultiplePickerOptionsExpose = {
|
|
12
|
-
setConfirmIndex: (indexes:
|
|
13
|
+
setConfirmIndex: (indexes: PickerOption) => void;
|
|
13
14
|
};
|
|
14
15
|
export declare type MultiplePickerInstance = ComponentPublicInstance<MultiplePickerOptionsProps, MultiplePickerOptionsExpose>;
|
package/lib/nav-bar/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--zt-nav-bar-height: 44px;--zt-nav-bar-padding-bottom: 12px;--zt-nav-bar-background: var(--zt-background);--zt-nav-bar-icon-font-size: 24px;--zt-nav-bar-icon-color: var(--zt-text-color);--zt-nav-bar-icon-size: 36px;--zt-nav-bar-button-height: 36px;--zt-nav-bar-border-height: 18px;--zt-nav-bar-text-color: var(--zt-primary-color);--zt-nav-bar-title-font-size: var(--zt-font-size-gt);--zt-nav-bar-title-text-color: var(--zt-text-color);--zt-nav-bar-title-height: 28px;--zt-nav-bar-z-index: 1;--zt-nav-bar-btn-border-radius: 18px;--zt-nav-bar-padding-left: 16px;--zt-nav-bar-padding-right: 16px}.zt-nav-bar{position:relative;padding-bottom:var(--zt-nav-bar-padding-bottom);z-index:var(--zt-nav-bar-z-index);text-align:center;-webkit-user-select:none;user-select:none;color:var(--zt-nav-bar-icon-color)}.zt-nav-bar--fixed{position:fixed;top:0;left:0;width:100%}.zt-nav-bar--safe-area-inset-top{padding-top:constant(safe-area-inset-top);padding-top:env(safe-area-inset-top)}.zt-nav-bar__content{position:relative;display:flex;align-items:center;height:var(--zt-nav-bar-height)}.zt-nav-bar__icon{width:var(--zt-nav-bar-icon-size);height:var(--zt-nav-bar-icon-size);line-height:var(--zt-nav-bar-icon-size);font-size:var(--zt-nav-bar-icon-font-size)}.zt-nav-bar__text{display:inline-block;font-size:var(--zt-font-size-lg);padding-right:var(--zt-nav-bar-padding-left);padding-left:var(--zt-nav-bar-padding-right)}.zt-nav-bar__text--left-text{padding-left:0}.zt-nav-bar__bar-btn{display:flex;align-items:center;box-sizing:border-box;height:var(--zt-nav-bar-button-height);line-height:var(--zt-nav-bar-button-height);background:
|
|
1
|
+
:root{--zt-nav-bar-height: 44px;--zt-nav-bar-padding-bottom: 12px;--zt-nav-bar-background: var(--zt-background);--zt-nav-bar-icon-font-size: 24px;--zt-nav-bar-icon-color: var(--zt-text-color);--zt-nav-bar-icon-size: 36px;--zt-nav-bar-button-height: 36px;--zt-nav-bar-border-height: 18px;--zt-nav-bar-text-color: var(--zt-primary-color);--zt-nav-bar-title-font-size: var(--zt-font-size-gt);--zt-nav-bar-title-text-color: var(--zt-text-color);--zt-nav-bar-title-height: 28px;--zt-nav-bar-z-index: 1;--zt-nav-bar-btn-border-radius: 18px;--zt-nav-bar-padding-left: 16px;--zt-nav-bar-padding-right: 16px;--zt-nav-bar-btn-background: linear-gradient(135deg, #e6ebf0 0%, #ffffff 100%, #ffffff 100%);--zt-nav-bar-btn-box-shadow: -4px -4px 8px 0 #ffffff, 4px 4px 8px 0 rgba(45, 75, 115, .1);--zt-nav-bar-btn-border: 1px solid rgba(255, 255, 255, .75)}.zt-nav-bar{position:relative;padding-bottom:var(--zt-nav-bar-padding-bottom);z-index:var(--zt-nav-bar-z-index);text-align:center;-webkit-user-select:none;user-select:none;color:var(--zt-nav-bar-icon-color)}.zt-nav-bar--fixed{position:fixed;top:0;left:0;width:100%}.zt-nav-bar--safe-area-inset-top{padding-top:constant(safe-area-inset-top);padding-top:env(safe-area-inset-top)}.zt-nav-bar__content{position:relative;display:flex;align-items:center;height:var(--zt-nav-bar-height)}.zt-nav-bar__icon{width:var(--zt-nav-bar-icon-size);height:var(--zt-nav-bar-icon-size);line-height:var(--zt-nav-bar-icon-size);font-size:var(--zt-nav-bar-icon-font-size)}.zt-nav-bar__text{display:inline-block;font-size:var(--zt-font-size-lg);padding-right:var(--zt-nav-bar-padding-left);padding-left:var(--zt-nav-bar-padding-right)}.zt-nav-bar__text--left-text{padding-left:0}.zt-nav-bar__bar-btn{display:flex;align-items:center;box-sizing:border-box;height:var(--zt-nav-bar-button-height);line-height:var(--zt-nav-bar-button-height);background:var(--zt-nav-bar-btn-background);box-shadow:var(--zt-nav-bar-btn-box-shadow);border-radius:var(--zt-nav-bar-btn-border-radius);border:var(--zt-nav-bar-btn-border)}.zt-nav-bar__bar-btn:active{border:1px solid rgba(255,255,255,.75);box-shadow:inset 4px 4px 8px rgba(45,75,115,.24);background:rgba(45,75,115,.04)}.zt-nav-bar__title{height:var(--zt-nav-bar-title-height);text-align:center;line-height:var(--zt-nav-bar-title-height);max-width:50%;margin:0 auto;font-weight:var(--zt-font-bold);font-size:var(--zt-nav-bar-title-font-size)}.zt-nav-bar__left,.zt-nav-bar__right{position:absolute;top:0;bottom:0;display:flex;align-items:center;padding:0 var(--zt-padding-md);font-size:var(--zt-font-size-md);max-width:30%}.zt-nav-bar__left{left:0}.zt-nav-bar__right{right:0}.zt-theme-dark{--zt-nav-bar-btn-background: linear-gradient(135deg, #0e1824 0%, #203043 100%, #ffffff 100%, #1d2c3d 100%);--zt-nav-bar-btn-box-shadow: -4px -4px 8px 0 rgba(255, 255, 255, .12), 4px 4px 8px 0 rgba(0, 12, 24, .8);--zt-nav-bar-btn-border: 1px solid #394555}
|
package/lib/overlay/Overlay.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
29
29
|
default: true;
|
|
30
30
|
};
|
|
31
31
|
customStyle: PropType<CSSProperties>;
|
|
32
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
32
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<ExtractPropTypes<{
|
|
33
33
|
show: BooleanConstructor;
|
|
34
34
|
zIndex: (NumberConstructor | StringConstructor)[];
|
|
35
35
|
duration: (NumberConstructor | StringConstructor)[];
|
package/lib/overlay/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export declare const Overlay: import("../utils").WithInstall<import("vue").Defin
|
|
|
12
12
|
default: true;
|
|
13
13
|
};
|
|
14
14
|
customStyle: import("vue").PropType<import("vue").CSSProperties>;
|
|
15
|
-
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin,
|
|
15
|
+
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
16
16
|
show: BooleanConstructor;
|
|
17
17
|
zIndex: (NumberConstructor | StringConstructor)[];
|
|
18
18
|
duration: (NumberConstructor | StringConstructor)[];
|
|
@@ -79,8 +79,9 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
79
79
|
}
|
|
80
80
|
currentOffset.value = offset;
|
|
81
81
|
};
|
|
82
|
+
const isReadonly = () => props.readonly || !props.options.length;
|
|
82
83
|
const onClickOption = (index) => {
|
|
83
|
-
if (moving ||
|
|
84
|
+
if (moving || isReadonly()) {
|
|
84
85
|
return;
|
|
85
86
|
}
|
|
86
87
|
transitionEndTrigger = null;
|
|
@@ -105,7 +106,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
105
106
|
}
|
|
106
107
|
};
|
|
107
108
|
const onTouchStart = (event) => {
|
|
108
|
-
if (
|
|
109
|
+
if (isReadonly()) {
|
|
109
110
|
return;
|
|
110
111
|
}
|
|
111
112
|
touch.start(event);
|
|
@@ -120,7 +121,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
120
121
|
transitionEndTrigger = null;
|
|
121
122
|
};
|
|
122
123
|
const onTouchMove = (event) => {
|
|
123
|
-
if (
|
|
124
|
+
if (isReadonly()) {
|
|
124
125
|
return;
|
|
125
126
|
}
|
|
126
127
|
touch.move(event);
|
|
@@ -136,7 +137,7 @@ var stdin_default = (0, import_vue2.defineComponent)({
|
|
|
136
137
|
}
|
|
137
138
|
};
|
|
138
139
|
const onTouchEnd = () => {
|
|
139
|
-
if (
|
|
140
|
+
if (isReadonly()) {
|
|
140
141
|
return;
|
|
141
142
|
}
|
|
142
143
|
const distance = currentOffset.value - momentumOffset;
|
package/lib/picker/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--zt-picker-cancel-margin: 8px 4px 8px 16px;--zt-picker-confirm-margin: 8px 16px 8px 4px;--zt-picker-title-height: 44px;--zt-picker-title-border-radius: 16px 16px 0 0;--zt-picker-frame-background-color: var(--zt-gray-a04);--zt-picker-cancel-background-color: var(--zt-white);--zt-picker-title-text-color: var(--zt-gray-a4);--zt-picker-background: var(--zt-background-2);--zt-picker-toolbar-height: 60px;--zt-picker-title-font-size: var(--zt-font-size-md);--zt-picker-title-line-height: var(--zt-line-height-md);--zt-picker-action-padding: 0 var(--zt-padding-md);--zt-picker-action-font-size: var(--zt-font-size-lg);--zt-picker-confirm-action-color: var(--zt-white);--zt-picker-cancel-action-color: var(--zt-text-color);--zt-picker-option-font-size: var(--zt-font-size-lg);--zt-picker-option-padding: 0 var(--zt-padding-base);--zt-picker-option-text-color: var(--zt-text-color);--zt-picker-option-disabled-opacity: .3;--zt-picker-loading-icon-color: var(--zt-primary-color);--zt-picker-loading-mask-color: rgba(255, 255, 255, .9);--zt-picker-mask-color: linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .4)), linear-gradient(0deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .4));--zt-picker-unit-font-size: var(--zt-font-size-md)}.zt-theme-dark{--zt-picker-mask-color: linear-gradient(180deg, rgba(0, 0, 0, .6), rgba(0, 0, 0, .1)), linear-gradient(0deg, rgba(0, 0, 0, .6), rgba(0, 0, 0, .1))}.zt-picker{position:relative;background:var(--zt-picker-background);-webkit-user-select:none;user-select:none}.zt-picker__toolbar{display:flex;align-items:center;justify-content:space-between;height:var(--zt-picker-toolbar-height)}.zt-picker__cancel,.zt-picker__confirm{width:50%}.zt-picker__cancel{background
|
|
1
|
+
:root{--zt-picker-cancel-margin: 8px 4px 8px 16px;--zt-picker-confirm-margin: 8px 16px 8px 4px;--zt-picker-title-height: 44px;--zt-picker-title-border-radius: 16px 16px 0 0;--zt-picker-frame-background-color: var(--zt-gray-a04);--zt-picker-cancel-background-color: var(--zt-white);--zt-picker-title-text-color: var(--zt-gray-a4);--zt-picker-background: var(--zt-background-2);--zt-picker-toolbar-height: 60px;--zt-picker-title-font-size: var(--zt-font-size-md);--zt-picker-title-background: var(--zt-white);--zt-picker-title-line-height: var(--zt-line-height-md);--zt-picker-action-padding: 0 var(--zt-padding-md);--zt-picker-action-font-size: var(--zt-font-size-lg);--zt-picker-confirm-action-color: var(--zt-white);--zt-picker-cancel-action-color: var(--zt-text-color);--zt-picker-option-font-size: var(--zt-font-size-lg);--zt-picker-option-padding: 0 var(--zt-padding-base);--zt-picker-option-text-color: var(--zt-text-color);--zt-picker-option-disabled-opacity: .3;--zt-picker-loading-icon-color: var(--zt-primary-color);--zt-picker-loading-mask-color: rgba(255, 255, 255, .9);--zt-picker-mask-color: linear-gradient(180deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .4)), linear-gradient(0deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .4));--zt-picker-unit-font-size: var(--zt-font-size-md)}.zt-theme-dark{--zt-picker-selected-background: rgba(255, 255, 255, .08);--zt-picker-title-background: var(--zt-background-2);--zt-picker-title-text-color: var(--zt-gray-default);--zt-picker-mask-color: linear-gradient(180deg, rgba(0, 0, 0, .6), rgba(0, 0, 0, .1)), linear-gradient(0deg, rgba(0, 0, 0, .6), rgba(0, 0, 0, .1))}.zt-picker{position:relative;background:var(--zt-picker-background);-webkit-user-select:none;user-select:none}.zt-picker__toolbar{display:flex;align-items:center;justify-content:space-between;height:var(--zt-picker-toolbar-height)}.zt-picker__cancel,.zt-picker__confirm{width:50%}.zt-picker__cancel{background:var(--zt-button-default-background);margin:var(--zt-picker-cancel-margin)}.zt-picker__confirm{margin:var(--zt-picker-confirm-margin)}.zt-picker__title{display:flex;justify-content:center;align-items:center;width:100%;height:var(--zt-picker-title-height);border-radius:var(--zt-picker-title-border-radius);font-size:var(--zt-picker-title-font-size);background:var(--zt-picker-title-background);color:var(--zt-picker-title-text-color)}.zt-picker__columns{position:relative;display:flex;cursor:-webkit-grab;cursor:grab}.zt-picker__loading{position:absolute;top:0;right:0;bottom:0;left:0;z-index:3;display:flex;align-items:center;justify-content:center;color:var(--zt-picker-loading-icon-color);background:var(--zt-picker-loading-mask-color)}.zt-picker__frame{position:absolute;top:50%;z-index:2;transform:translateY(-50%);pointer-events:none;width:100%;background:var(--zt-picker-frame-background-color)}.zt-picker__mask{position:absolute;top:0;left:0;z-index:1;width:100%;height:100%;background-image:var(--zt-picker-mask-color);background-repeat:no-repeat;background-position:top,bottom;transform:translateZ(0);pointer-events:none}.zt-picker-column{position:relative;flex:1;overflow:hidden;font-size:var(--zt-picker-option-font-size);background:var(--zt-picker-background)}.zt-picker-column__wrapper{transition-timing-function:cubic-bezier(.23,1,.68,1)}.zt-picker-column__item{display:flex;align-items:center;justify-content:center;padding:var(--zt-picker-option-padding);color:var(--zt-picker-option-text-color)}.zt-picker-column__item--disabled{cursor:not-allowed;opacity:var(--zt-picker-option-disabled-opacity)}.zt-picker-column__item--selected{font-weight:700;background:var(--zt-picker-selected-background)}.zt-picker-column__unit{background:var(--zt-picker-title-background);position:absolute;display:flex;align-items:center;justify-content:center;font-weight:700;color:var(--zt-picker-option-text-color);font-size:var(--zt-picker-option-font-size);width:100%;height:100%}.zt-picker-column__unit-text{margin:0 4px;font-size:var(--zt-picker-unit-font-size)}
|