zartui 3.1.20 → 3.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/es/avatar/Avatar.mjs +1 -1
  2. package/es/icon/index.css +1 -1
  3. package/es/index.d.ts +1 -1
  4. package/es/index.mjs +1 -1
  5. package/es/media-picker/MediaPicker.mjs +1 -4
  6. package/es/media-picker/util/media-util.d.ts +0 -55
  7. package/es/media-picker/util/media-util.mjs +1 -203
  8. package/es/tabs/Tabs.mjs +1 -0
  9. package/es/tabs/TabsTitle.d.ts +2 -0
  10. package/es/tabs/TabsTitle.mjs +24 -2
  11. package/es/uploader/Uploader.d.ts +1 -1
  12. package/es/uploader/index.d.ts +1 -1
  13. package/lib/avatar/Avatar.js +1 -1
  14. package/lib/icon/index.css +1 -1
  15. package/lib/index.css +1 -1
  16. package/lib/index.d.ts +1 -1
  17. package/lib/index.js +1 -1
  18. package/lib/media-picker/MediaPicker.js +5 -8
  19. package/lib/media-picker/util/media-util.d.ts +0 -55
  20. package/lib/media-picker/util/media-util.js +1 -203
  21. package/lib/tabs/Tabs.js +1 -0
  22. package/lib/tabs/TabsTitle.d.ts +2 -0
  23. package/lib/tabs/TabsTitle.js +23 -1
  24. package/lib/uploader/Uploader.d.ts +1 -1
  25. package/lib/uploader/index.d.ts +1 -1
  26. package/lib/web-types.json +1 -1
  27. package/lib/zartui.cjs.js +57 -1017
  28. package/lib/zartui.es.js +53 -1013
  29. package/lib/zartui.js +1116 -648
  30. package/lib/zartui.min.js +1 -1
  31. package/package.json +7 -6
  32. package/es/media-picker/watermark/compress-options.d.ts +0 -5
  33. package/es/media-picker/watermark/compress-options.mjs +0 -23
  34. package/es/media-picker/watermark/image-processor.d.ts +0 -12
  35. package/es/media-picker/watermark/image-processor.mjs +0 -97
  36. package/es/media-picker/watermark/resize-options.d.ts +0 -4
  37. package/es/media-picker/watermark/resize-options.mjs +0 -27
  38. package/es/media-picker/watermark/watermark.d.ts +0 -42
  39. package/es/media-picker/watermark/watermark.mjs +0 -653
  40. package/lib/media-picker/watermark/compress-options.d.ts +0 -5
  41. package/lib/media-picker/watermark/compress-options.js +0 -41
  42. package/lib/media-picker/watermark/image-processor.d.ts +0 -12
  43. package/lib/media-picker/watermark/image-processor.js +0 -110
  44. package/lib/media-picker/watermark/resize-options.d.ts +0 -4
  45. package/lib/media-picker/watermark/resize-options.js +0 -45
  46. package/lib/media-picker/watermark/watermark.d.ts +0 -42
  47. package/lib/media-picker/watermark/watermark.js +0 -664
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zartui",
3
- "version": "3.1.20",
3
+ "version": "3.1.21",
4
4
  "description": "面向政务场景的移动端组件库",
5
5
  "main": "lib/zartui.cjs.js",
6
6
  "module": "es/index.mjs",
@@ -29,9 +29,10 @@
29
29
  ],
30
30
  "dependencies": {
31
31
  "@floating-ui/vue": "^0.2.1",
32
+ "@zartui/popperjs": "^1.3.1",
33
+ "@egova-mobile/app-media-utils": "^0.0.2",
32
34
  "@zartui/date-utils": "^0.0.5",
33
- "@zartui/use": "^1.4.8",
34
- "@zartui/popperjs": "^1.3.1"
35
+ "@zartui/use": "^1.4.8"
35
36
  },
36
37
  "peerDependencies": {
37
38
  "vue": "^3.0.0"
@@ -52,9 +53,9 @@
52
53
  "vue": "^3.3.4",
53
54
  "vue-router": "^4.2.4",
54
55
  "@zartui/mobile-cli": "^5.0.7",
55
- "@zartui/number-font": "^0.0.1",
56
- "@zartui/icons": "^0.0.6",
57
- "@zartui/eslint-config": "^4.0.2"
56
+ "@zartui/eslint-config": "^4.0.2",
57
+ "@zartui/icons": "^0.0.7",
58
+ "@zartui/number-font": "^0.0.1"
58
59
  },
59
60
  "sideEffects": [
60
61
  "es/**/style/*",
@@ -1,5 +0,0 @@
1
- export declare class CompressOptions {
2
- photoFileSizeLimit: number;
3
- checkOrientation: boolean;
4
- constructor(photoFileSizeLimit: number);
5
- }
@@ -1,23 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
7
- import { isDef } from "../../utils/index.mjs";
8
- import { PHOTO_FILE_SIZE_LIMIT } from "../util/media-util.mjs";
9
- class CompressOptions {
10
- constructor(photoFileSizeLimit) {
11
- // 图片大小限制,单位kb
12
- __publicField(this, "photoFileSizeLimit");
13
- __publicField(this, "checkOrientation", true);
14
- if (!isDef(photoFileSizeLimit)) {
15
- this.photoFileSizeLimit = PHOTO_FILE_SIZE_LIMIT;
16
- } else {
17
- this.photoFileSizeLimit = photoFileSizeLimit;
18
- }
19
- }
20
- }
21
- export {
22
- CompressOptions
23
- };
@@ -1,12 +0,0 @@
1
- import { ResizeOptions } from './resize-options';
2
- import { WatermarkOptions } from './watermark';
3
- import { CompressOptions } from './compress-options';
4
- export declare class ImageProcessor {
5
- private file;
6
- private resizeOptions;
7
- private watermarkOptions;
8
- private compressOptions;
9
- constructor(file: File, resizeOptions: ResizeOptions, watermarkOptions: WatermarkOptions, compressOptions: CompressOptions);
10
- process(): Promise<void | File>;
11
- compress(canvas: HTMLCanvasElement, filename: string, lastModified: number, type: string, quality: number): Promise<File>;
12
- }
@@ -1,97 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
7
- import { renderWatermark } from "./watermark.mjs";
8
- import { getIosVersion, isIOS } from "../../utils/index.mjs";
9
- import {
10
- canvas2File,
11
- file2Image,
12
- getOrientation,
13
- resize
14
- } from "../util/media-util.mjs";
15
- const DEFAULT_JPEG_QUALITY = 0.8;
16
- const MIN_JPEG_QUALITY = 0.1;
17
- const JPEG_QUALITY_STEP = 0.05;
18
- class ImageProcessor {
19
- // 压缩图片的配置
20
- constructor(file, resizeOptions, watermarkOptions, compressOptions) {
21
- __publicField(this, "file");
22
- // 图片文件
23
- __publicField(this, "resizeOptions");
24
- // 缩放图片的配置
25
- __publicField(this, "watermarkOptions");
26
- // 打水印配置项和相关环境信息
27
- __publicField(this, "compressOptions");
28
- this.file = file;
29
- this.resizeOptions = resizeOptions;
30
- this.watermarkOptions = watermarkOptions;
31
- this.compressOptions = compressOptions;
32
- }
33
- process() {
34
- const filename = this.file.name;
35
- let fileType = this.file.type;
36
- const { lastModified } = this.file;
37
- let orientation = 1;
38
- if (this.file.size > this.compressOptions.photoFileSizeLimit * 1024) {
39
- fileType = "image/jpeg";
40
- }
41
- if (isIOS() && fileType === "image/jpeg" && getIosVersion() < "13.4") {
42
- const reader = new FileReader();
43
- reader.readAsArrayBuffer(this.file);
44
- reader.onload = function(_ref) {
45
- const { target } = _ref;
46
- if (target == null ? void 0 : target.result) {
47
- orientation = getOrientation(target == null ? void 0 : target.result);
48
- }
49
- };
50
- }
51
- if (fileType === "image/gif") {
52
- fileType = "image/png";
53
- }
54
- return file2Image(this.file).then(
55
- (img) => (
56
- // 第一步 resize image
57
- resize(img, {
58
- inputType: fileType,
59
- orientation,
60
- sideLengthLimit: this.resizeOptions.maxSideLength,
61
- resultType: "canvas"
62
- })
63
- )
64
- ).then((result) => {
65
- const canvas = result;
66
- return renderWatermark(canvas, this.watermarkOptions);
67
- }).then((canvas) => {
68
- const exportFilename = filename.replace(/\./g, "-") + ".jpg";
69
- return this.compress(
70
- canvas,
71
- exportFilename,
72
- lastModified,
73
- fileType,
74
- DEFAULT_JPEG_QUALITY
75
- );
76
- });
77
- }
78
- compress(canvas, filename, lastModified, type, quality) {
79
- return canvas2File(canvas, filename, lastModified, type, quality).then(
80
- (file) => {
81
- if (file.size > this.compressOptions.photoFileSizeLimit * 1024 && quality - JPEG_QUALITY_STEP > MIN_JPEG_QUALITY) {
82
- return this.compress(
83
- canvas,
84
- filename,
85
- lastModified,
86
- type,
87
- quality - JPEG_QUALITY_STEP
88
- );
89
- }
90
- return Promise.resolve(file);
91
- }
92
- );
93
- }
94
- }
95
- export {
96
- ImageProcessor
97
- };
@@ -1,4 +0,0 @@
1
- export declare class ResizeOptions {
2
- maxSideLength: number;
3
- constructor(maxSideLength: number);
4
- }
@@ -1,27 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
7
- import { isDef } from "../../utils/index.mjs";
8
- import { MAX_SIDE_LENGTH, MIN_SIDE_LENGTH } from "../util/media-util.mjs";
9
- class ResizeOptions {
10
- // 最大边长
11
- constructor(maxSideLength) {
12
- __publicField(this, "maxSideLength");
13
- if (!isDef(maxSideLength)) {
14
- this.maxSideLength = MAX_SIDE_LENGTH;
15
- } else {
16
- this.maxSideLength = maxSideLength;
17
- if (this.maxSideLength > MAX_SIDE_LENGTH) {
18
- this.maxSideLength = MAX_SIDE_LENGTH;
19
- } else if (this.maxSideLength < MIN_SIDE_LENGTH) {
20
- this.maxSideLength = MIN_SIDE_LENGTH;
21
- }
22
- }
23
- }
24
- }
25
- export {
26
- ResizeOptions
27
- };
@@ -1,42 +0,0 @@
1
- export interface WatermarkContextParams {
2
- address: string;
3
- watermarkTime: Date;
4
- humanName: string;
5
- projectName: string;
6
- logo: File;
7
- }
8
- export type WatermarkContext = {
9
- address: string;
10
- watermarkTime: Date;
11
- humanName: string;
12
- projectName: string;
13
- logo?: File;
14
- };
15
- export interface WatermarkOptionsParams {
16
- enabled: boolean;
17
- watermarkConfigString: string;
18
- context: WatermarkContext;
19
- }
20
- export type WatermarkOptions = {
21
- enabled: boolean;
22
- watermarkConfigString?: string;
23
- context?: WatermarkContext;
24
- };
25
- /**
26
- * A JavaScript Scanner like Java's
27
- * @see java.util.Scanner
28
- */
29
- export declare class TextScanner {
30
- private text;
31
- private cursor;
32
- /**
33
- * The content to scan
34
- * @param text
35
- */
36
- constructor(text: string);
37
- hasNext(obj?: any): boolean;
38
- next(obj?: any): string | RegExpMatchArray | null;
39
- skip(obj?: string): TextScanner;
40
- }
41
- export declare function renderWatermark(canvas: HTMLCanvasElement, options: WatermarkOptions): Promise<HTMLCanvasElement>;
42
- export declare function checkWatermarkConfigSupported(watermarkConfigString: string): boolean;