clickgo 3.15.6 → 3.15.8
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/panel/test1.js +3 -0
- package/dist/app/demo/form/control/panel/test1.xml +1 -0
- package/dist/app/demo/form/control/text/text.js +3 -0
- package/dist/app/demo/form/control/text/text.xml +1 -1
- package/dist/app/demo/form/method/zip/zip.js +1 -1
- package/dist/app/demo/form/solution/backpanel/backpanel.js +1 -1
- package/dist/clickgo.js +1 -1
- package/dist/clickgo.ts +1 -1
- package/dist/control/common.cgc +0 -0
- package/dist/lib/fs.js +2 -2
- package/dist/lib/fs.ts +3 -3
- package/dist/lib/task.js +3 -0
- package/dist/lib/task.ts +3 -0
- package/dist/lib/tool.js +10 -1
- package/dist/lib/tool.ts +14 -0
- package/dist/lib/zip.js +9 -0
- package/dist/lib/zip.ts +8 -0
- package/package.json +1 -1
- package/types/index.d.ts +11 -0
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.8'}"></script>
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
**index.js**
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
<button @click="click">Hi</button>
|
|
9
9
|
<button @click="sendToRootPanel({'a':1})" style="height: 30px;">sendToRootPanel({'a':1})</button>
|
|
10
10
|
<button @click="clearQss">clearQs()</button>
|
|
11
|
+
<button @click="jump">Jump</button>
|
|
11
12
|
<layout>
|
|
12
13
|
<button size="xl" area="split">
|
|
13
14
|
Size xl
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<layout direction="v" gutter="10" style="padding: 10px; flex: 1; width: 0;">
|
|
3
3
|
<label>Text Length: {{value.length}}, Selection Start: {{selectionStart}}, Selection End: {{selectionEnd}}, Focus: {{isFocus}}</label>
|
|
4
4
|
<label>Scroll Left: {{scrollLeft}}, Scroll Top: {{scrollTop}}, Scroll Height: {{scrollHeight}}, Scroll Width: {{scrollWidth}}, Client Height: {{clientHeight}}, Client Width: {{clientWidth}}</label>
|
|
5
|
-
<text v-model="value" placeholder="placeholder" :type="type[0]" :gesture="gesture ? ['top', 'bottom'] : []" @gesture="onGesture" :disabled="disabled" :readonly="readonly" :scroll="scroll" :maxlength="maxlength" :wrap="wrap" :max="max" :min="min" :plain="plain" v-model:scroll-left="scrollLeft" v-model:scroll-top="scrollTop" v-model:selection-start="selectionStart" v-model:selection-end="selectionEnd" @clientheight="clientHeight = $event" @clientwidth="clientWidth = $event" @scrollheight="scrollHeight = $event" @scrollwidth="scrollWidth = $event" @focus="isFocus = true" @blur="isFocus = false" @beforechange="onBeforechange" :style="{'flex': (type[0] === 'multi') && (scroll || !wrap) ? '1' : undefined, 'line-height': lineHeight, 'font-size': fontSize + 'px', 'background': background, 'color': background ? '#FFF' : undefined, 'height': (type[0] === 'multi') && (scroll || !wrap) ? '0' : undefined, 'border-width': textBorder}" :class="[phcolor && ('ph-' + phcolor)]">
|
|
5
|
+
<text v-model="value" placeholder="placeholder" :type="type[0]" :gesture="gesture ? ['top', 'bottom'] : []" @gesture="onGesture" :disabled="disabled" :readonly="readonly" :scroll="scroll" :maxlength="maxlength" :wrap="wrap" :max="max" :min="min" :plain="plain" v-model:scroll-left="scrollLeft" v-model:scroll-top="scrollTop" v-model:selection-start="selectionStart" v-model:selection-end="selectionEnd" @clientheight="clientHeight = $event" @clientwidth="clientWidth = $event" @scrollheight="scrollHeight = $event" @scrollwidth="scrollWidth = $event" @focus="isFocus = true" @blur="isFocus = false" @beforechange="onBeforechange" @minmaxchange="onMinMaxChange" :style="{'flex': (type[0] === 'multi') && (scroll || !wrap) ? '1' : undefined, 'line-height': lineHeight, 'font-size': fontSize + 'px', 'background': background, 'color': background ? '#FFF' : undefined, 'height': (type[0] === 'multi') && (scroll || !wrap) ? '0' : undefined, 'border-width': textBorder}" :class="[phcolor && ('ph-' + phcolor)]">
|
|
6
6
|
<menulist v-if="menu">
|
|
7
7
|
<menulist-item>Custom</menulist-item>
|
|
8
8
|
</menulist>
|
|
@@ -75,7 +75,7 @@ class default_1 extends clickgo.form.AbstractForm {
|
|
|
75
75
|
const ls = this.access.zip.readDir(path);
|
|
76
76
|
for (const item of ls) {
|
|
77
77
|
this.list.push({
|
|
78
|
-
'label': (item.isDirectory ? '[FOLD]' : '[FILE]') + ' ' + item.name,
|
|
78
|
+
'label': (item.isDirectory ? '[FOLD]' : '[FILE]') + ' ' + item.name + ' (' + clickgo.tool.sizeFormat(item.uncompressedSize) + ')',
|
|
79
79
|
'value': path + item.name
|
|
80
80
|
});
|
|
81
81
|
}
|
package/dist/clickgo.js
CHANGED
|
@@ -24,7 +24,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.zip = exports.tool = exports.theme = exports.task = exports.storage = exports.native = exports.fs = exports.form = exports.dom = exports.core = exports.control = exports.vue = exports.hasFrame = exports.isImmersion = exports.getPlatform = exports.isNative = exports.getVersion = void 0;
|
|
27
|
-
const version = '3.15.
|
|
27
|
+
const version = '3.15.8';
|
|
28
28
|
function getVersion() {
|
|
29
29
|
return version;
|
|
30
30
|
}
|
package/dist/clickgo.ts
CHANGED
package/dist/control/common.cgc
CHANGED
|
Binary file
|
package/dist/lib/fs.js
CHANGED
|
@@ -149,8 +149,8 @@ function getContent(path, options, taskId) {
|
|
|
149
149
|
const rand = '?' + ((_a = options.cache) !== null && _a !== void 0 ? _a : Math.random().toString());
|
|
150
150
|
let blob = null;
|
|
151
151
|
const headers = {};
|
|
152
|
-
if (start
|
|
153
|
-
headers['range'] = `bytes=${start
|
|
152
|
+
if (start !== null && start !== void 0 ? start : end) {
|
|
153
|
+
headers['range'] = `bytes=${start !== null && start !== void 0 ? start : '0'}-${end !== null && end !== void 0 ? end : ''}`;
|
|
154
154
|
}
|
|
155
155
|
if (options.progress) {
|
|
156
156
|
blob = yield tool.request(ourl + (!ourl.startsWith(loader.cdn) ? rand : ''), {
|
package/dist/lib/fs.ts
CHANGED
|
@@ -164,8 +164,8 @@ export async function getContent(path: string, options?: BufferEncoding | {
|
|
|
164
164
|
const rand = '?' + (options.cache ?? Math.random().toString());
|
|
165
165
|
let blob: Blob | null = null;
|
|
166
166
|
const headers: Record<string, string> = {};
|
|
167
|
-
if (start
|
|
168
|
-
headers['range'] = `bytes=${start
|
|
167
|
+
if (start ?? end) {
|
|
168
|
+
headers['range'] = `bytes=${start ?? '0'}-${end ?? ''}`;
|
|
169
169
|
}
|
|
170
170
|
if (options.progress) {
|
|
171
171
|
blob = await tool.request(ourl + (!ourl.startsWith(loader.cdn) ? rand : ''), {
|
|
@@ -190,7 +190,7 @@ export async function getContent(path: string, options?: BufferEncoding | {
|
|
|
190
190
|
fr.addEventListener('load', function() {
|
|
191
191
|
resolve(fr.result as string | null);
|
|
192
192
|
});
|
|
193
|
-
fr.readAsText(blob
|
|
193
|
+
fr.readAsText(blob, encoding);
|
|
194
194
|
});
|
|
195
195
|
}
|
|
196
196
|
catch {
|
package/dist/lib/task.js
CHANGED
|
@@ -992,6 +992,9 @@ function run(url_1) {
|
|
|
992
992
|
blob2ArrayBuffer: function (blob) {
|
|
993
993
|
return tool.blob2ArrayBuffer(blob);
|
|
994
994
|
},
|
|
995
|
+
sizeFormat: function (size, spliter = ' ') {
|
|
996
|
+
return tool.sizeFormat(size, spliter);
|
|
997
|
+
},
|
|
995
998
|
clone: function (obj) {
|
|
996
999
|
return tool.clone(obj);
|
|
997
1000
|
},
|
package/dist/lib/task.ts
CHANGED
|
@@ -1123,6 +1123,9 @@ export async function run(url: string | types.IApp, opt: types.ITaskRunOptions =
|
|
|
1123
1123
|
blob2ArrayBuffer: function(blob: Blob): Promise<ArrayBuffer> {
|
|
1124
1124
|
return tool.blob2ArrayBuffer(blob);
|
|
1125
1125
|
},
|
|
1126
|
+
sizeFormat: function(size: number, spliter: string = ' '): string {
|
|
1127
|
+
return tool.sizeFormat(size, spliter);
|
|
1128
|
+
},
|
|
1126
1129
|
clone: function(obj: Record<string, any> | any[]): any[] | any {
|
|
1127
1130
|
return tool.clone(obj);
|
|
1128
1131
|
},
|
package/dist/lib/tool.js
CHANGED
|
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.queryParse = exports.queryStringify = exports.formatTime = exports.formatSecond = exports.compar = exports.execCommand = exports.blob2DataUrl = exports.blob2Text = exports.urlAtom = exports.urlResolve = exports.parseUrl = exports.postResponseJson = exports.getResponseJson = exports.post = exports.get = exports.fetch = exports.request = exports.rgb2hsl = exports.escapeHTML = exports.getArray = exports.getNumber = exports.getBoolean = exports.random = 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 = exports.rand = exports.getMimeByPath = exports.stylePrepend = exports.teleportGlue = exports.eventsAttrWrap = exports.layoutClassPrepend = exports.layoutInsertAttr = exports.layoutAddTagClassAndReTagName = exports.styleUrl2DataUrl = exports.match = exports.purify = exports.sleepFrame = exports.nextFrame = exports.sleep = exports.clone = exports.blob2ArrayBuffer = exports.getClassPrototype = void 0;
|
|
12
|
+
exports.queryParse = exports.queryStringify = exports.formatTime = exports.formatSecond = exports.compar = exports.execCommand = exports.blob2DataUrl = exports.blob2Text = exports.urlAtom = exports.urlResolve = exports.parseUrl = exports.postResponseJson = exports.getResponseJson = exports.post = exports.get = exports.fetch = exports.request = exports.rgb2hsl = exports.escapeHTML = exports.getArray = exports.getNumber = exports.getBoolean = exports.random = 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 = exports.rand = exports.getMimeByPath = exports.stylePrepend = exports.teleportGlue = exports.eventsAttrWrap = exports.layoutClassPrepend = exports.layoutInsertAttr = exports.layoutAddTagClassAndReTagName = exports.styleUrl2DataUrl = exports.match = exports.purify = exports.sleepFrame = exports.nextFrame = exports.sleep = exports.clone = exports.sizeFormat = exports.blob2ArrayBuffer = exports.getClassPrototype = void 0;
|
|
13
13
|
function getClassPrototype(obj, over = [], level = 0) {
|
|
14
14
|
var _a;
|
|
15
15
|
if (level === 0) {
|
|
@@ -66,6 +66,15 @@ function blob2ArrayBuffer(blob) {
|
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
exports.blob2ArrayBuffer = blob2ArrayBuffer;
|
|
69
|
+
function sizeFormat(size, spliter = ' ') {
|
|
70
|
+
const units = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
|
|
71
|
+
let i = 0;
|
|
72
|
+
for (; i < 6 && size >= 1024.0; ++i) {
|
|
73
|
+
size /= 1024.0;
|
|
74
|
+
}
|
|
75
|
+
return (Math.round(size * 100) / 100).toString() + spliter + units[i];
|
|
76
|
+
}
|
|
77
|
+
exports.sizeFormat = sizeFormat;
|
|
69
78
|
function clone(obj) {
|
|
70
79
|
let newObj = {};
|
|
71
80
|
if (obj instanceof Array) {
|
package/dist/lib/tool.ts
CHANGED
|
@@ -90,6 +90,20 @@ export function blob2ArrayBuffer(blob: Blob): Promise<ArrayBuffer> {
|
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
/**
|
|
94
|
+
* --- 将文件大小格式化为带单位的字符串 ---
|
|
95
|
+
* @param size 文件大小
|
|
96
|
+
* @param spliter 分隔符
|
|
97
|
+
*/
|
|
98
|
+
export function sizeFormat(size: number, spliter: string = ' '): string {
|
|
99
|
+
const units = ['Bytes', 'KB', 'MB', 'GB', 'TB', 'PB'];
|
|
100
|
+
let i = 0;
|
|
101
|
+
for (; i < 6 && size >= 1024.0; ++i) {
|
|
102
|
+
size /= 1024.0;
|
|
103
|
+
}
|
|
104
|
+
return (Math.round(size * 100) / 100).toString() + spliter + units[i];
|
|
105
|
+
}
|
|
106
|
+
|
|
93
107
|
/**
|
|
94
108
|
* --- 完整的克隆一份数组/对象 ---
|
|
95
109
|
* @param obj 要克隆的对象
|
package/dist/lib/zip.js
CHANGED
|
@@ -92,6 +92,8 @@ class Zip {
|
|
|
92
92
|
return null;
|
|
93
93
|
}
|
|
94
94
|
return {
|
|
95
|
+
'compressedSize': file.compressedSize,
|
|
96
|
+
'uncompressedSize': file.uncompressedSize,
|
|
95
97
|
'date': file.date,
|
|
96
98
|
'isFile': true,
|
|
97
99
|
'isDirectory': false
|
|
@@ -100,6 +102,8 @@ class Zip {
|
|
|
100
102
|
else {
|
|
101
103
|
if (dirpath === '/') {
|
|
102
104
|
return {
|
|
105
|
+
'compressedSize': 0,
|
|
106
|
+
'uncompressedSize': 0,
|
|
103
107
|
'date': new Date(),
|
|
104
108
|
'isFile': false,
|
|
105
109
|
'isDirectory': true
|
|
@@ -112,6 +116,8 @@ class Zip {
|
|
|
112
116
|
const pfolder = this._list[dpath];
|
|
113
117
|
const folder = pfolder[fname];
|
|
114
118
|
return {
|
|
119
|
+
'compressedSize': 0,
|
|
120
|
+
'uncompressedSize': 0,
|
|
115
121
|
'date': folder.date,
|
|
116
122
|
'isFile': false,
|
|
117
123
|
'isDirectory': true
|
|
@@ -244,6 +250,7 @@ class Zip {
|
|
|
244
250
|
_refreshList() {
|
|
245
251
|
const list = {};
|
|
246
252
|
this._zip.forEach(function (relativePath, item) {
|
|
253
|
+
var _a, _b;
|
|
247
254
|
if (relativePath.startsWith('/')) {
|
|
248
255
|
relativePath = relativePath.slice(1);
|
|
249
256
|
}
|
|
@@ -271,6 +278,8 @@ class Zip {
|
|
|
271
278
|
}
|
|
272
279
|
list[parentPath][name] = {
|
|
273
280
|
'name': name,
|
|
281
|
+
'compressedSize': (_a = item._data.compressedSize) !== null && _a !== void 0 ? _a : 0,
|
|
282
|
+
'uncompressedSize': (_b = item._data.uncompressedSize) !== null && _b !== void 0 ? _b : 0,
|
|
274
283
|
'date': item.date,
|
|
275
284
|
'isFile': !item.dir,
|
|
276
285
|
'isDirectory': item.dir,
|
package/dist/lib/zip.ts
CHANGED
|
@@ -90,6 +90,8 @@ export class Zip {
|
|
|
90
90
|
return null;
|
|
91
91
|
}
|
|
92
92
|
return {
|
|
93
|
+
'compressedSize': file.compressedSize,
|
|
94
|
+
'uncompressedSize': file.uncompressedSize,
|
|
93
95
|
'date': file.date,
|
|
94
96
|
'isFile': true,
|
|
95
97
|
'isDirectory': false
|
|
@@ -99,6 +101,8 @@ export class Zip {
|
|
|
99
101
|
// --- 文件夹 ---
|
|
100
102
|
if (dirpath === '/') {
|
|
101
103
|
return {
|
|
104
|
+
'compressedSize': 0,
|
|
105
|
+
'uncompressedSize': 0,
|
|
102
106
|
'date': new Date(),
|
|
103
107
|
'isFile': false,
|
|
104
108
|
'isDirectory': true
|
|
@@ -111,6 +115,8 @@ export class Zip {
|
|
|
111
115
|
const pfolder = this._list[dpath];
|
|
112
116
|
const folder = pfolder[fname];
|
|
113
117
|
return {
|
|
118
|
+
'compressedSize': 0,
|
|
119
|
+
'uncompressedSize': 0,
|
|
114
120
|
'date': folder.date,
|
|
115
121
|
'isFile': false,
|
|
116
122
|
'isDirectory': true
|
|
@@ -308,6 +314,8 @@ export class Zip {
|
|
|
308
314
|
}
|
|
309
315
|
list[parentPath][name] = {
|
|
310
316
|
'name': name,
|
|
317
|
+
'compressedSize': (item as any)._data.compressedSize ?? 0,
|
|
318
|
+
'uncompressedSize': (item as any)._data.uncompressedSize ?? 0,
|
|
311
319
|
'date': item.date,
|
|
312
320
|
'isFile': !item.dir,
|
|
313
321
|
'isDirectory': item.dir,
|
package/package.json
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -539,6 +539,8 @@ export type TZip = import('../dist/lib/zip').Zip;
|
|
|
539
539
|
|
|
540
540
|
export interface IZipItem {
|
|
541
541
|
'name': string;
|
|
542
|
+
'compressedSize': number;
|
|
543
|
+
'uncompressedSize': number;
|
|
542
544
|
'date': Date;
|
|
543
545
|
'isFile': boolean;
|
|
544
546
|
'isDirectory': boolean;
|
|
@@ -546,6 +548,8 @@ export interface IZipItem {
|
|
|
546
548
|
}
|
|
547
549
|
|
|
548
550
|
export interface IZipStats {
|
|
551
|
+
'compressedSize': number;
|
|
552
|
+
'uncompressedSize': number;
|
|
549
553
|
'date': Date;
|
|
550
554
|
'isFile': boolean;
|
|
551
555
|
'isDirectory': boolean;
|
|
@@ -714,6 +718,13 @@ export interface ITextBeforechangeEvent extends ICustomEvent {
|
|
|
714
718
|
};
|
|
715
719
|
}
|
|
716
720
|
|
|
721
|
+
export interface ITextMinMaxChangeEvent extends ICustomEvent {
|
|
722
|
+
'detail': {
|
|
723
|
+
'before': string;
|
|
724
|
+
'value': string;
|
|
725
|
+
};
|
|
726
|
+
}
|
|
727
|
+
|
|
717
728
|
// --- Date Control ---
|
|
718
729
|
|
|
719
730
|
export interface IDateChangedEvent {
|