clickgo 3.6.1 → 3.6.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 +1 -1
- package/dist/app/demo/form/control/select/select.js +5 -0
- package/dist/app/demo/form/control/select/select.xml +2 -1
- package/dist/clickgo.js +1 -1
- package/dist/clickgo.ts +1 -1
- package/dist/control/common.cgc +0 -0
- package/dist/lib/form.js +57 -47
- package/dist/lib/form.ts +76 -62
- package/dist/lib/task.ts +1 -1
- package/dist/theme/light.cgt +0 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -28,7 +28,7 @@ Load the module loader first, and then load it using the module loader.
|
|
|
28
28
|
**index.html**
|
|
29
29
|
|
|
30
30
|
```html
|
|
31
|
-
<script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.5.0/dist/loader.min.js?path=index&npm={'clickgo':'3.6.
|
|
31
|
+
<script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.5.0/dist/loader.min.js?path=index&npm={'clickgo':'3.6.3'}"></script>
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
**index.js**
|
|
@@ -141,6 +141,11 @@ class default_1 extends clickgo.form.AbstractForm {
|
|
|
141
141
|
resolve(['he', 'ha']);
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
|
+
onLoaded() {
|
|
145
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
146
|
+
yield clickgo.form.dialog('done');
|
|
147
|
+
});
|
|
148
|
+
}
|
|
144
149
|
onRemote(value, resolve) {
|
|
145
150
|
return __awaiter(this, void 0, void 0, function* () {
|
|
146
151
|
yield clickgo.tool.sleep(300);
|
|
@@ -66,9 +66,10 @@
|
|
|
66
66
|
<layout gutter="10" direction="v" style="padding: 10px;">
|
|
67
67
|
<label>Now select value is {{select3}}</label>
|
|
68
68
|
<label>Label: {{label3}}</label>
|
|
69
|
-
<levelselect v-model="select3" @label="label3 = $event" :data="s3other ? slist3r : slist2" :disabled="disabled" :editable="editable" :multi="multi" :async="async" placeholder="Please enter" @load="onLoad" :style="{'font-size': fontSize ? '16px' : undefined, 'padding': padding ? '15px' : undefined, 'background': background ? 'red' : undefined, 'color': background ? '#FFF' : undefined}"></levelselect>
|
|
69
|
+
<levelselect v-model="select3" @label="label3 = $event" :data="s3other ? slist3r : slist2" :disabled="disabled" :editable="editable" :multi="multi" :async="async" placeholder="Please enter" @load="onLoad" @loaded="onLoaded" :style="{'font-size': fontSize ? '16px' : undefined, 'padding': padding ? '15px' : undefined, 'background': background ? 'red' : undefined, 'color': background ? '#FFF' : undefined}"></levelselect>
|
|
70
70
|
<button @click="async = !async">{{async ? '' : '!'}}async</button>
|
|
71
71
|
<button @click="select3 = ['title', 'sub2']">Set: ['title', 'sub2']</button>
|
|
72
|
+
<button @click="select3 = ['haha2', '60']">Set: ['haha2', '60']</button>
|
|
72
73
|
<button @click="s3other = !s3other">Set {{s3other ? 'this' : 'other'}} data</button>
|
|
73
74
|
</layout>
|
|
74
75
|
</flow>
|
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.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.6.
|
|
27
|
+
const version = '3.6.3';
|
|
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/form.js
CHANGED
|
@@ -1317,50 +1317,10 @@ function removeFromPop(el) {
|
|
|
1317
1317
|
exports.elements.popList.removeChild(el);
|
|
1318
1318
|
}
|
|
1319
1319
|
exports.removeFromPop = removeFromPop;
|
|
1320
|
-
|
|
1321
|
-
function showPop(el, pop, direction, opt = {}) {
|
|
1320
|
+
function refreshPopPosition(el, pop, direction, size = {}) {
|
|
1322
1321
|
var _a, _b;
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
}
|
|
1326
|
-
if (opt.size === undefined) {
|
|
1327
|
-
opt.size = {};
|
|
1328
|
-
}
|
|
1329
|
-
if (!pop && !opt.null) {
|
|
1330
|
-
return;
|
|
1331
|
-
}
|
|
1332
|
-
const now = Date.now();
|
|
1333
|
-
if (now - lastShowPopTime < 5) {
|
|
1334
|
-
lastShowPopTime = now;
|
|
1335
|
-
return;
|
|
1336
|
-
}
|
|
1337
|
-
lastShowPopTime = now;
|
|
1338
|
-
if (el.dataset.cgPopOpen !== undefined) {
|
|
1339
|
-
return;
|
|
1340
|
-
}
|
|
1341
|
-
const parentPop = dom.findParentByData(el, 'cg-pop');
|
|
1342
|
-
if (parentPop) {
|
|
1343
|
-
for (let i = 0; i < popInfo.list.length; ++i) {
|
|
1344
|
-
if (popInfo.list[i] !== parentPop) {
|
|
1345
|
-
continue;
|
|
1346
|
-
}
|
|
1347
|
-
if (!popInfo.elList[i + 1]) {
|
|
1348
|
-
continue;
|
|
1349
|
-
}
|
|
1350
|
-
hidePop(popInfo.elList[i + 1]);
|
|
1351
|
-
}
|
|
1352
|
-
}
|
|
1353
|
-
else {
|
|
1354
|
-
hidePop();
|
|
1355
|
-
}
|
|
1356
|
-
if (!pop) {
|
|
1357
|
-
popInfo.elList.push(el);
|
|
1358
|
-
el.dataset.cgPopOpen = '';
|
|
1359
|
-
el.dataset.cgLevel = (popInfo.elList.length - 1).toString();
|
|
1360
|
-
return;
|
|
1361
|
-
}
|
|
1362
|
-
const width = (_a = opt.size.width) !== null && _a !== void 0 ? _a : (pop ? pop.offsetWidth : 0);
|
|
1363
|
-
const height = (_b = opt.size.height) !== null && _b !== void 0 ? _b : (pop ? pop.offsetHeight : 0);
|
|
1322
|
+
const width = (_a = size.width) !== null && _a !== void 0 ? _a : pop.offsetWidth;
|
|
1323
|
+
const height = (_b = size.height) !== null && _b !== void 0 ? _b : pop.offsetHeight;
|
|
1364
1324
|
let left, top;
|
|
1365
1325
|
if (typeof direction === 'string') {
|
|
1366
1326
|
const bcr = el.getBoundingClientRect();
|
|
@@ -1422,11 +1382,59 @@ function showPop(el, pop, direction, opt = {}) {
|
|
|
1422
1382
|
pop.style.left = left.toString() + 'px';
|
|
1423
1383
|
pop.style.top = top.toString() + 'px';
|
|
1424
1384
|
pop.style.zIndex = (++popInfo.lastZIndex).toString();
|
|
1425
|
-
if (
|
|
1426
|
-
pop.style.width =
|
|
1385
|
+
if (size.width) {
|
|
1386
|
+
pop.style.width = size.width.toString() + 'px';
|
|
1427
1387
|
}
|
|
1428
|
-
if (
|
|
1429
|
-
pop.style.height =
|
|
1388
|
+
if (size.height) {
|
|
1389
|
+
pop.style.height = size.height.toString() + 'px';
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
let lastShowPopTime = 0;
|
|
1393
|
+
function showPop(el, pop, direction, opt = {}) {
|
|
1394
|
+
if (opt.null === undefined) {
|
|
1395
|
+
opt.null = false;
|
|
1396
|
+
}
|
|
1397
|
+
if (opt.size === undefined) {
|
|
1398
|
+
opt.size = {};
|
|
1399
|
+
}
|
|
1400
|
+
if (!pop && !opt.null) {
|
|
1401
|
+
return;
|
|
1402
|
+
}
|
|
1403
|
+
const now = Date.now();
|
|
1404
|
+
if (now - lastShowPopTime < 5) {
|
|
1405
|
+
lastShowPopTime = now;
|
|
1406
|
+
return;
|
|
1407
|
+
}
|
|
1408
|
+
lastShowPopTime = now;
|
|
1409
|
+
if (el.dataset.cgPopOpen !== undefined) {
|
|
1410
|
+
return;
|
|
1411
|
+
}
|
|
1412
|
+
const parentPop = dom.findParentByData(el, 'cg-pop');
|
|
1413
|
+
if (parentPop) {
|
|
1414
|
+
for (let i = 0; i < popInfo.list.length; ++i) {
|
|
1415
|
+
if (popInfo.list[i] !== parentPop) {
|
|
1416
|
+
continue;
|
|
1417
|
+
}
|
|
1418
|
+
if (!popInfo.elList[i + 1]) {
|
|
1419
|
+
continue;
|
|
1420
|
+
}
|
|
1421
|
+
hidePop(popInfo.elList[i + 1]);
|
|
1422
|
+
}
|
|
1423
|
+
}
|
|
1424
|
+
else {
|
|
1425
|
+
hidePop();
|
|
1426
|
+
}
|
|
1427
|
+
if (!pop) {
|
|
1428
|
+
popInfo.elList.push(el);
|
|
1429
|
+
el.dataset.cgPopOpen = '';
|
|
1430
|
+
el.dataset.cgLevel = (popInfo.elList.length - 1).toString();
|
|
1431
|
+
return;
|
|
1432
|
+
}
|
|
1433
|
+
refreshPopPosition(el, pop, direction, opt.size);
|
|
1434
|
+
if (opt.autoPosition && typeof direction === 'string' && ['h', 'v'].includes(direction)) {
|
|
1435
|
+
clickgo.dom.watchSize(pop, () => {
|
|
1436
|
+
refreshPopPosition(el, pop, direction, opt.size);
|
|
1437
|
+
});
|
|
1430
1438
|
}
|
|
1431
1439
|
popInfo.list.push(pop);
|
|
1432
1440
|
popInfo.elList.push(el);
|
|
@@ -1463,6 +1471,7 @@ function hidePop(pop) {
|
|
|
1463
1471
|
if (isPop) {
|
|
1464
1472
|
pop.removeAttribute('data-cg-open');
|
|
1465
1473
|
pop.removeAttribute('data-cg-level');
|
|
1474
|
+
clickgo.dom.unwatchSize(pop);
|
|
1466
1475
|
popInfo.elList[level].removeAttribute('data-cg-pop-open');
|
|
1467
1476
|
popInfo.elList[level].removeAttribute('data-cg-level');
|
|
1468
1477
|
}
|
|
@@ -1470,6 +1479,7 @@ function hidePop(pop) {
|
|
|
1470
1479
|
if (popInfo.list[level]) {
|
|
1471
1480
|
popInfo.list[level].removeAttribute('data-cg-open');
|
|
1472
1481
|
popInfo.list[level].removeAttribute('data-cg-level');
|
|
1482
|
+
clickgo.dom.unwatchSize(popInfo.list[level]);
|
|
1473
1483
|
}
|
|
1474
1484
|
pop.removeAttribute('data-cg-pop-open');
|
|
1475
1485
|
pop.removeAttribute('data-cg-level');
|
package/dist/lib/form.ts
CHANGED
|
@@ -1744,65 +1744,11 @@ export function removeFromPop(el: HTMLElement): void {
|
|
|
1744
1744
|
elements.popList.removeChild(el);
|
|
1745
1745
|
}
|
|
1746
1746
|
|
|
1747
|
-
/** ---
|
|
1748
|
-
|
|
1749
|
-
/**
|
|
1750
|
-
* --- 获取 pop 显示出来的坐标并报系统全局记录 ---
|
|
1751
|
-
* @param el 响应的元素
|
|
1752
|
-
* @param pop 要显示 pop 元素
|
|
1753
|
-
* @param direction 要显示方向(以 $el 为准的 h 水平和 v 垂直)或坐标
|
|
1754
|
-
* @param opt width / height 显示的 pop 定义自定义宽/高度,可省略;null,true 代表为空也会显示,默认为 false
|
|
1755
|
-
*/
|
|
1756
|
-
export function showPop(el: HTMLElement, pop: HTMLElement | undefined, direction: 'h' | 'v' | MouseEvent | TouchEvent | { x: number; y: number; }, opt: { 'size'?: { width?: number; height?: number; }; 'null'?: boolean; } = {}): void {
|
|
1757
|
-
// --- opt.null 为 true 代表可为空,为空也会被显示,默认为 false ---
|
|
1758
|
-
if (opt.null === undefined) {
|
|
1759
|
-
opt.null = false;
|
|
1760
|
-
}
|
|
1761
|
-
if (opt.size === undefined) {
|
|
1762
|
-
opt.size = {};
|
|
1763
|
-
}
|
|
1764
|
-
// --- 也可能不执行本次显示 ---
|
|
1765
|
-
if (!pop && !opt.null) {
|
|
1766
|
-
return;
|
|
1767
|
-
}
|
|
1768
|
-
// --- 如果短时间内已经有了 pop 被展示,则可能是冒泡序列,本次则不展示 ---
|
|
1769
|
-
const now = Date.now();
|
|
1770
|
-
if (now - lastShowPopTime < 5) {
|
|
1771
|
-
lastShowPopTime = now;
|
|
1772
|
-
return;
|
|
1773
|
-
}
|
|
1774
|
-
lastShowPopTime = now;
|
|
1775
|
-
// --- 检测是不是已经显示了 ---
|
|
1776
|
-
if (el.dataset.cgPopOpen !== undefined) {
|
|
1777
|
-
return;
|
|
1778
|
-
}
|
|
1779
|
-
/** --- 要不要隐藏别的 pop --- */
|
|
1780
|
-
const parentPop = dom.findParentByData(el, 'cg-pop');
|
|
1781
|
-
if (parentPop) {
|
|
1782
|
-
for (let i = 0; i < popInfo.list.length; ++i) {
|
|
1783
|
-
if (popInfo.list[i] !== parentPop) {
|
|
1784
|
-
continue;
|
|
1785
|
-
}
|
|
1786
|
-
if (!popInfo.elList[i + 1]) {
|
|
1787
|
-
continue;
|
|
1788
|
-
}
|
|
1789
|
-
hidePop(popInfo.elList[i + 1]);
|
|
1790
|
-
}
|
|
1791
|
-
}
|
|
1792
|
-
else {
|
|
1793
|
-
// --- 本层不是 pop,因此要隐藏所有 pop ---
|
|
1794
|
-
hidePop();
|
|
1795
|
-
}
|
|
1796
|
-
// --- 检测如果 pop 是 undefined 还显示吗 ---
|
|
1797
|
-
if (!pop) {
|
|
1798
|
-
popInfo.elList.push(el);
|
|
1799
|
-
el.dataset.cgPopOpen = '';
|
|
1800
|
-
el.dataset.cgLevel = (popInfo.elList.length - 1).toString();
|
|
1801
|
-
return;
|
|
1802
|
-
}
|
|
1747
|
+
/** --- 重新调整 pop 的位置 --- */
|
|
1748
|
+
function refreshPopPosition(el: HTMLElement, pop: HTMLElement, direction: 'h' | 'v' | MouseEvent | TouchEvent | { x: number; y: number; }, size: { width?: number; height?: number; } = {}): void {
|
|
1803
1749
|
// --- 最终 pop 的大小 ---
|
|
1804
|
-
const width =
|
|
1805
|
-
const height =
|
|
1750
|
+
const width = size.width ?? pop.offsetWidth;
|
|
1751
|
+
const height = size.height ?? pop.offsetHeight;
|
|
1806
1752
|
// --- 最终显示位置 ---
|
|
1807
1753
|
let left: number, top: number;
|
|
1808
1754
|
if (typeof direction === 'string') {
|
|
@@ -1873,11 +1819,77 @@ export function showPop(el: HTMLElement, pop: HTMLElement | undefined, direction
|
|
|
1873
1819
|
pop.style.left = left.toString() + 'px';
|
|
1874
1820
|
pop.style.top = top.toString() + 'px';
|
|
1875
1821
|
pop.style.zIndex = (++popInfo.lastZIndex).toString();
|
|
1876
|
-
if (
|
|
1877
|
-
pop.style.width =
|
|
1822
|
+
if (size.width) {
|
|
1823
|
+
pop.style.width = size.width.toString() + 'px';
|
|
1824
|
+
}
|
|
1825
|
+
if (size.height) {
|
|
1826
|
+
pop.style.height = size.height.toString() + 'px';
|
|
1827
|
+
}
|
|
1828
|
+
}
|
|
1829
|
+
|
|
1830
|
+
/** --- 最后一次 touchstart 的时间戳 */
|
|
1831
|
+
let lastShowPopTime: number = 0;
|
|
1832
|
+
/**
|
|
1833
|
+
* --- 获取 pop 显示出来的坐标并报系统全局记录 ---
|
|
1834
|
+
* @param el 响应的元素
|
|
1835
|
+
* @param pop 要显示 pop 元素
|
|
1836
|
+
* @param direction 要显示方向(以 $el 为准的 h 水平和 v 垂直)或坐标
|
|
1837
|
+
* @param opt width / height 显示的 pop 定义自定义宽/高度,可省略;null,true 代表为空也会显示,默认为 false; autoPosition, 自动更新 pop 位置,默认 false,true 为原元素位置变更,pop 位置也会变更,pop 大小变更,位置也会变更
|
|
1838
|
+
*/
|
|
1839
|
+
export function showPop(el: HTMLElement, pop: HTMLElement | undefined, direction: 'h' | 'v' | MouseEvent | TouchEvent | { x: number; y: number; }, opt: { 'size'?: { width?: number; height?: number; }; 'null'?: boolean; 'autoPosition'?: boolean; } = {}): void {
|
|
1840
|
+
// --- opt.null 为 true 代表可为空,为空也会被显示,默认为 false ---
|
|
1841
|
+
if (opt.null === undefined) {
|
|
1842
|
+
opt.null = false;
|
|
1843
|
+
}
|
|
1844
|
+
if (opt.size === undefined) {
|
|
1845
|
+
opt.size = {};
|
|
1846
|
+
}
|
|
1847
|
+
// --- 也可能不执行本次显示 ---
|
|
1848
|
+
if (!pop && !opt.null) {
|
|
1849
|
+
return;
|
|
1850
|
+
}
|
|
1851
|
+
// --- 如果短时间内已经有了 pop 被展示,则可能是冒泡序列,本次则不展示 ---
|
|
1852
|
+
const now = Date.now();
|
|
1853
|
+
if (now - lastShowPopTime < 5) {
|
|
1854
|
+
lastShowPopTime = now;
|
|
1855
|
+
return;
|
|
1856
|
+
}
|
|
1857
|
+
lastShowPopTime = now;
|
|
1858
|
+
// --- 检测是不是已经显示了 ---
|
|
1859
|
+
if (el.dataset.cgPopOpen !== undefined) {
|
|
1860
|
+
return;
|
|
1861
|
+
}
|
|
1862
|
+
/** --- 要不要隐藏别的 pop --- */
|
|
1863
|
+
const parentPop = dom.findParentByData(el, 'cg-pop');
|
|
1864
|
+
if (parentPop) {
|
|
1865
|
+
for (let i = 0; i < popInfo.list.length; ++i) {
|
|
1866
|
+
if (popInfo.list[i] !== parentPop) {
|
|
1867
|
+
continue;
|
|
1868
|
+
}
|
|
1869
|
+
if (!popInfo.elList[i + 1]) {
|
|
1870
|
+
continue;
|
|
1871
|
+
}
|
|
1872
|
+
hidePop(popInfo.elList[i + 1]);
|
|
1873
|
+
}
|
|
1874
|
+
}
|
|
1875
|
+
else {
|
|
1876
|
+
// --- 本层不是 pop,因此要隐藏所有 pop ---
|
|
1877
|
+
hidePop();
|
|
1878
|
+
}
|
|
1879
|
+
// --- 检测如果 pop 是 undefined 还显示吗 ---
|
|
1880
|
+
if (!pop) {
|
|
1881
|
+
popInfo.elList.push(el);
|
|
1882
|
+
el.dataset.cgPopOpen = '';
|
|
1883
|
+
el.dataset.cgLevel = (popInfo.elList.length - 1).toString();
|
|
1884
|
+
return;
|
|
1878
1885
|
}
|
|
1879
|
-
|
|
1880
|
-
|
|
1886
|
+
// --- 设定 pop 位置 ---
|
|
1887
|
+
refreshPopPosition(el, pop, direction, opt.size);
|
|
1888
|
+
if (opt.autoPosition && typeof direction === 'string' && ['h', 'v'].includes(direction)) {
|
|
1889
|
+
// --- 可能要重置 pop 位置 ---
|
|
1890
|
+
clickgo.dom.watchSize(pop, () => {
|
|
1891
|
+
refreshPopPosition(el, pop, direction, opt.size);
|
|
1892
|
+
});
|
|
1881
1893
|
}
|
|
1882
1894
|
popInfo.list.push(pop);
|
|
1883
1895
|
popInfo.elList.push(el);
|
|
@@ -1919,6 +1931,7 @@ export function hidePop(pop?: HTMLElement): void {
|
|
|
1919
1931
|
if (isPop) {
|
|
1920
1932
|
pop.removeAttribute('data-cg-open');
|
|
1921
1933
|
pop.removeAttribute('data-cg-level');
|
|
1934
|
+
clickgo.dom.unwatchSize(pop);
|
|
1922
1935
|
popInfo.elList[level].removeAttribute('data-cg-pop-open');
|
|
1923
1936
|
popInfo.elList[level].removeAttribute('data-cg-level');
|
|
1924
1937
|
}
|
|
@@ -1926,6 +1939,7 @@ export function hidePop(pop?: HTMLElement): void {
|
|
|
1926
1939
|
if (popInfo.list[level]) {
|
|
1927
1940
|
popInfo.list[level].removeAttribute('data-cg-open');
|
|
1928
1941
|
popInfo.list[level].removeAttribute('data-cg-level');
|
|
1942
|
+
clickgo.dom.unwatchSize(popInfo.list[level]);
|
|
1929
1943
|
}
|
|
1930
1944
|
pop.removeAttribute('data-cg-pop-open');
|
|
1931
1945
|
pop.removeAttribute('data-cg-level');
|
package/dist/lib/task.ts
CHANGED
|
@@ -732,7 +732,7 @@ export async function run(url: string | types.IApp, opt: types.ITaskRunOptions =
|
|
|
732
732
|
hideNotify: function(notifyId: number): void {
|
|
733
733
|
form.hideNotify(notifyId);
|
|
734
734
|
},
|
|
735
|
-
showPop: function(el: HTMLElement, pop: HTMLElement | undefined, direction: 'h' | 'v' | MouseEvent | TouchEvent | { x: number; y: number; }, opt: { 'size'?: { width?: number; height?: number; }; 'null'?: boolean; } = {}): void {
|
|
735
|
+
showPop: function(el: HTMLElement, pop: HTMLElement | undefined, direction: 'h' | 'v' | MouseEvent | TouchEvent | { x: number; y: number; }, opt: { 'size'?: { width?: number; height?: number; }; 'null'?: boolean; 'autoPosition'?: boolean; } = {}): void {
|
|
736
736
|
form.showPop(el, pop, direction, opt);
|
|
737
737
|
},
|
|
738
738
|
hidePop: function(pop?: HTMLElement): void {
|
package/dist/theme/light.cgt
CHANGED
|
Binary file
|