clickgo 3.15.36 → 3.15.37
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 +1 -1
- package/dist/app/demo/form/control/table/table.xml +1 -1
- package/dist/clickgo.js +1 -1
- package/dist/clickgo.ts +1 -1
- package/dist/control/table.cgc +0 -0
- package/dist/lib/core.js +16 -0
- package/dist/lib/core.ts +14 -0
- package/dist/lib/task.js +3 -0
- package/dist/lib/task.ts +10 -0
- package/dist/lib/tool.js +51 -0
- package/dist/lib/tool.ts +40 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ Load the module loader first, and then load it using the module loader.
|
|
|
25
25
|
**index.html**
|
|
26
26
|
|
|
27
27
|
```html
|
|
28
|
-
<script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.5.7/dist/loader.min.js?path=index&npm={'clickgo':'3.15.
|
|
28
|
+
<script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.5.7/dist/loader.min.js?path=index&npm={'clickgo':'3.15.37'}"></script>
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
**index.js**
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
<arrow v-if="bottom" v-model="d.row.bottom"></arrow>
|
|
8
8
|
<check v-model="d.row.check" @changed="refreshCheckinfo">{{d.index}}</check>
|
|
9
9
|
</table-item>
|
|
10
|
-
<table-item label="name">{{d.row.name ?? 'name'}}</table-item>
|
|
10
|
+
<table-item label="name" minWidth="200">{{d.row.name ?? 'name'}}</table-item>
|
|
11
11
|
<table-item label="size" width="80" align-v="center" align-h="center">{{d.row.type ?? '0'}}</table-item>
|
|
12
12
|
<table-item label="col" width="150" direction="v" gutter="5" sort="false">
|
|
13
13
|
<label>line1</label>
|
package/dist/clickgo.js
CHANGED
package/dist/clickgo.ts
CHANGED
package/dist/control/table.cgc
CHANGED
|
Binary file
|
package/dist/lib/core.js
CHANGED
|
@@ -307,6 +307,22 @@ const modules = {
|
|
|
307
307
|
'obj': null,
|
|
308
308
|
'loading': false,
|
|
309
309
|
'resolve': []
|
|
310
|
+
},
|
|
311
|
+
'compressorjs': {
|
|
312
|
+
func: function () {
|
|
313
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
314
|
+
yield loader.loadScripts([
|
|
315
|
+
loader.cdn + '/npm/compressorjs@1.2.1/dist/compressor.min.js'
|
|
316
|
+
]);
|
|
317
|
+
if (!window.Compressor) {
|
|
318
|
+
throw Error('Compressor load failed.');
|
|
319
|
+
}
|
|
320
|
+
return [window.Compressor];
|
|
321
|
+
});
|
|
322
|
+
},
|
|
323
|
+
'obj': null,
|
|
324
|
+
'loading': false,
|
|
325
|
+
'resolve': []
|
|
310
326
|
}
|
|
311
327
|
};
|
|
312
328
|
function regModule(name, func) {
|
package/dist/lib/core.ts
CHANGED
|
@@ -361,6 +361,20 @@ const modules: Record<string, {
|
|
|
361
361
|
'obj': null,
|
|
362
362
|
'loading': false,
|
|
363
363
|
'resolve': []
|
|
364
|
+
},
|
|
365
|
+
'compressorjs': {
|
|
366
|
+
func: async function() {
|
|
367
|
+
await loader.loadScripts([
|
|
368
|
+
loader.cdn + '/npm/compressorjs@1.2.1/dist/compressor.min.js'
|
|
369
|
+
]);
|
|
370
|
+
if (!(window as any).Compressor) {
|
|
371
|
+
throw Error('Compressor load failed.');
|
|
372
|
+
}
|
|
373
|
+
return [(window as any).Compressor];
|
|
374
|
+
},
|
|
375
|
+
'obj': null,
|
|
376
|
+
'loading': false,
|
|
377
|
+
'resolve': []
|
|
364
378
|
}
|
|
365
379
|
};
|
|
366
380
|
|
package/dist/lib/task.js
CHANGED
|
@@ -1010,6 +1010,9 @@ function run(url_1) {
|
|
|
1010
1010
|
}
|
|
1011
1011
|
},
|
|
1012
1012
|
'tool': {
|
|
1013
|
+
compressor: function (file, options = {}) {
|
|
1014
|
+
return tool.compressor(file, options);
|
|
1015
|
+
},
|
|
1013
1016
|
blob2ArrayBuffer: function (blob) {
|
|
1014
1017
|
return tool.blob2ArrayBuffer(blob);
|
|
1015
1018
|
},
|
package/dist/lib/task.ts
CHANGED
|
@@ -1126,6 +1126,16 @@ export async function run(url: string | types.IApp, opt: types.ITaskRunOptions =
|
|
|
1126
1126
|
}
|
|
1127
1127
|
},
|
|
1128
1128
|
'tool': {
|
|
1129
|
+
compressor: function<T extends File | Blob>(file: T, options: {
|
|
1130
|
+
/** --- 最大宽度,默认无限 --- */
|
|
1131
|
+
'maxWidth'?: number;
|
|
1132
|
+
/** --- 最高高度,默认无限 --- */
|
|
1133
|
+
'maxHeight'?: number;
|
|
1134
|
+
/** --- 压缩质量,默认 0.8 --- */
|
|
1135
|
+
'quality'?: number;
|
|
1136
|
+
} = {}): Promise<File | Blob | false> {
|
|
1137
|
+
return tool.compressor(file, options);
|
|
1138
|
+
},
|
|
1129
1139
|
blob2ArrayBuffer: function(blob: Blob): Promise<ArrayBuffer> {
|
|
1130
1140
|
return tool.blob2ArrayBuffer(blob);
|
|
1131
1141
|
},
|
package/dist/lib/tool.js
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -10,6 +33,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
33
|
};
|
|
11
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
35
|
exports.RANDOM_LUNS = exports.RANDOM_V = exports.RANDOM_LUN = exports.RANDOM_LU = exports.RANDOM_LN = exports.RANDOM_UN = exports.RANDOM_L = exports.RANDOM_U = exports.RANDOM_N = void 0;
|
|
36
|
+
exports.compressor = compressor;
|
|
13
37
|
exports.getClassPrototype = getClassPrototype;
|
|
14
38
|
exports.blob2ArrayBuffer = blob2ArrayBuffer;
|
|
15
39
|
exports.sizeFormat = sizeFormat;
|
|
@@ -56,6 +80,33 @@ exports.formatSecond = formatSecond;
|
|
|
56
80
|
exports.formatTime = formatTime;
|
|
57
81
|
exports.queryStringify = queryStringify;
|
|
58
82
|
exports.queryParse = queryParse;
|
|
83
|
+
const core = __importStar(require("./core"));
|
|
84
|
+
let compressorjs = null;
|
|
85
|
+
function compressor(file_1) {
|
|
86
|
+
return __awaiter(this, arguments, void 0, function* (file, options = {}) {
|
|
87
|
+
if (!compressorjs) {
|
|
88
|
+
try {
|
|
89
|
+
compressorjs = yield core.getModule('compressorjs');
|
|
90
|
+
}
|
|
91
|
+
catch (_a) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return new Promise((resolve) => {
|
|
96
|
+
new compressorjs(file, {
|
|
97
|
+
'quality': options.quality,
|
|
98
|
+
'maxWidth': options.maxWidth,
|
|
99
|
+
'maxHeight': options.maxHeight,
|
|
100
|
+
success: (result) => {
|
|
101
|
+
resolve(result);
|
|
102
|
+
},
|
|
103
|
+
error: () => {
|
|
104
|
+
resolve(false);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
}
|
|
59
110
|
function getClassPrototype(obj, over = [], level = 0) {
|
|
60
111
|
var _a;
|
|
61
112
|
if (level === 0) {
|
package/dist/lib/tool.ts
CHANGED
|
@@ -14,6 +14,46 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import * as types from '../../types';
|
|
17
|
+
import * as core from './core';
|
|
18
|
+
|
|
19
|
+
/** --- compressorjs, mit --- */
|
|
20
|
+
let compressorjs: any = null;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* --- 压缩一个图片 ---
|
|
24
|
+
* @param file 文件或 blob 类型 ---
|
|
25
|
+
* @param options 参数
|
|
26
|
+
*/
|
|
27
|
+
export async function compressor<T extends File | Blob>(file: T, options: {
|
|
28
|
+
/** --- 最大宽度,默认无限 --- */
|
|
29
|
+
'maxWidth'?: number;
|
|
30
|
+
/** --- 最高高度,默认无限 --- */
|
|
31
|
+
'maxHeight'?: number;
|
|
32
|
+
/** --- 压缩质量,默认 0.8 --- */
|
|
33
|
+
'quality'?: number;
|
|
34
|
+
} = {}): Promise<File | Blob | false> {
|
|
35
|
+
if (!compressorjs) {
|
|
36
|
+
try {
|
|
37
|
+
compressorjs = await core.getModule('compressorjs');
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return new Promise((resolve) => {
|
|
44
|
+
new compressorjs(file, {
|
|
45
|
+
'quality': options.quality,
|
|
46
|
+
'maxWidth': options.maxWidth,
|
|
47
|
+
'maxHeight': options.maxHeight,
|
|
48
|
+
success: (result: T) => {
|
|
49
|
+
resolve(result);
|
|
50
|
+
},
|
|
51
|
+
error: () => {
|
|
52
|
+
resolve(false);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
17
57
|
|
|
18
58
|
interface IClassPrototype {
|
|
19
59
|
'method': Record<string, any>;
|