clickgo 3.6.0 → 3.6.2

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 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.0'}"></script>
31
+ <script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.5.0/dist/loader.min.js?path=index&npm={'clickgo':'3.6.2'}"></script>
32
32
  ```
33
33
 
34
34
  **index.js**
@@ -1,7 +1,8 @@
1
- <form width="300" height="300" title="Link">
1
+ <form width="300" height="350" title="Link">
2
2
  <layout direction="v" gutter="10" style="padding: 10px; flex: 1; width: 0;">
3
3
  <label>You can use CSS to customize the link:</label>
4
4
  <link>Normal</link>
5
+ <link plain>Plain</link>
5
6
  <link style="text-align: center;">Center</link>
6
7
  <link style="color: red;">Color</link>
7
8
  <link style="background: rgba(0, 0, 0, .1);">Background</link>
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.0';
27
+ const version = '3.6.2';
28
28
  function getVersion() {
29
29
  return version;
30
30
  }
package/dist/clickgo.ts CHANGED
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- const version = '3.6.0';
16
+ const version = '3.6.2';
17
17
  export function getVersion(): string {
18
18
  return version;
19
19
  }
Binary file
package/dist/lib/form.js CHANGED
@@ -824,6 +824,9 @@ function get(formId) {
824
824
  if (taskId === 0) {
825
825
  return null;
826
826
  }
827
+ if (!task.list[taskId].forms[formId]) {
828
+ return null;
829
+ }
827
830
  const item = task.list[taskId].forms[formId];
828
831
  return {
829
832
  'taskId': taskId,
@@ -1005,13 +1008,16 @@ function getMaxZIndexID(out = {}) {
1005
1008
  continue;
1006
1009
  }
1007
1010
  const z = parseInt(formInner.style.zIndex);
1008
- if (z > 9999999) {
1011
+ if (z < 1000000) {
1009
1012
  continue;
1010
1013
  }
1011
1014
  if (formInner.dataset.cgMin !== undefined) {
1012
1015
  continue;
1013
1016
  }
1014
1017
  const tid = parseInt(formWrap.getAttribute('data-task-id'));
1018
+ if (tid === task.systemTaskInfo.taskId) {
1019
+ continue;
1020
+ }
1015
1021
  if ((_a = out.taskIds) === null || _a === void 0 ? void 0 : _a.includes(tid)) {
1016
1022
  continue;
1017
1023
  }
@@ -1311,50 +1317,10 @@ function removeFromPop(el) {
1311
1317
  exports.elements.popList.removeChild(el);
1312
1318
  }
1313
1319
  exports.removeFromPop = removeFromPop;
1314
- let lastShowPopTime = 0;
1315
- function showPop(el, pop, direction, opt = {}) {
1320
+ function refreshPopPosition(el, pop, direction, size = {}) {
1316
1321
  var _a, _b;
1317
- if (opt.null === undefined) {
1318
- opt.null = false;
1319
- }
1320
- if (opt.size === undefined) {
1321
- opt.size = {};
1322
- }
1323
- if (!pop && !opt.null) {
1324
- return;
1325
- }
1326
- const now = Date.now();
1327
- if (now - lastShowPopTime < 5) {
1328
- lastShowPopTime = now;
1329
- return;
1330
- }
1331
- lastShowPopTime = now;
1332
- if (el.dataset.cgPopOpen !== undefined) {
1333
- return;
1334
- }
1335
- const parentPop = dom.findParentByData(el, 'cg-pop');
1336
- if (parentPop) {
1337
- for (let i = 0; i < popInfo.list.length; ++i) {
1338
- if (popInfo.list[i] !== parentPop) {
1339
- continue;
1340
- }
1341
- if (!popInfo.elList[i + 1]) {
1342
- continue;
1343
- }
1344
- hidePop(popInfo.elList[i + 1]);
1345
- }
1346
- }
1347
- else {
1348
- hidePop();
1349
- }
1350
- if (!pop) {
1351
- popInfo.elList.push(el);
1352
- el.dataset.cgPopOpen = '';
1353
- el.dataset.cgLevel = (popInfo.elList.length - 1).toString();
1354
- return;
1355
- }
1356
- const width = (_a = opt.size.width) !== null && _a !== void 0 ? _a : (pop ? pop.offsetWidth : 0);
1357
- 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;
1358
1324
  let left, top;
1359
1325
  if (typeof direction === 'string') {
1360
1326
  const bcr = el.getBoundingClientRect();
@@ -1416,11 +1382,59 @@ function showPop(el, pop, direction, opt = {}) {
1416
1382
  pop.style.left = left.toString() + 'px';
1417
1383
  pop.style.top = top.toString() + 'px';
1418
1384
  pop.style.zIndex = (++popInfo.lastZIndex).toString();
1419
- if (opt.size.width) {
1420
- pop.style.width = opt.size.width.toString() + 'px';
1385
+ if (size.width) {
1386
+ pop.style.width = size.width.toString() + 'px';
1387
+ }
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;
1421
1411
  }
1422
- if (opt.size.height) {
1423
- pop.style.height = opt.size.height.toString() + 'px';
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
+ });
1424
1438
  }
1425
1439
  popInfo.list.push(pop);
1426
1440
  popInfo.elList.push(el);
@@ -1457,6 +1471,7 @@ function hidePop(pop) {
1457
1471
  if (isPop) {
1458
1472
  pop.removeAttribute('data-cg-open');
1459
1473
  pop.removeAttribute('data-cg-level');
1474
+ clickgo.dom.unwatchSize(pop);
1460
1475
  popInfo.elList[level].removeAttribute('data-cg-pop-open');
1461
1476
  popInfo.elList[level].removeAttribute('data-cg-level');
1462
1477
  }
@@ -1464,6 +1479,7 @@ function hidePop(pop) {
1464
1479
  if (popInfo.list[level]) {
1465
1480
  popInfo.list[level].removeAttribute('data-cg-open');
1466
1481
  popInfo.list[level].removeAttribute('data-cg-level');
1482
+ clickgo.dom.unwatchSize(popInfo.list[level]);
1467
1483
  }
1468
1484
  pop.removeAttribute('data-cg-pop-open');
1469
1485
  pop.removeAttribute('data-cg-level');
package/dist/lib/form.ts CHANGED
@@ -1134,6 +1134,9 @@ export function get(formId: number): types.IFormInfo | null {
1134
1134
  if (taskId === 0) {
1135
1135
  return null;
1136
1136
  }
1137
+ if (!task.list[taskId].forms[formId]) {
1138
+ return null;
1139
+ }
1137
1140
  const item = task.list[taskId].forms[formId];
1138
1141
  return {
1139
1142
  'taskId': taskId,
@@ -1367,9 +1370,9 @@ export function getMaxZIndexID(out: {
1367
1370
  if (!formInner) {
1368
1371
  continue;
1369
1372
  }
1370
- // --- 排除 top most 窗体 ---
1373
+ // --- 排除 bottom most 窗体 ---
1371
1374
  const z = parseInt(formInner.style.zIndex);
1372
- if (z > 9999999) {
1375
+ if (z < 1000000) {
1373
1376
  continue;
1374
1377
  }
1375
1378
  // --- 排除最小化窗体 ---
@@ -1378,6 +1381,10 @@ export function getMaxZIndexID(out: {
1378
1381
  }
1379
1382
  // --- 排除用户定义的 task id 窗体 ---
1380
1383
  const tid = parseInt(formWrap.getAttribute('data-task-id')!);
1384
+ if (tid === task.systemTaskInfo.taskId) {
1385
+ // --- 系统任务排除掉 ---
1386
+ continue;
1387
+ }
1381
1388
  if (out.taskIds?.includes(tid)) {
1382
1389
  continue;
1383
1390
  }
@@ -1737,65 +1744,11 @@ export function removeFromPop(el: HTMLElement): void {
1737
1744
  elements.popList.removeChild(el);
1738
1745
  }
1739
1746
 
1740
- /** --- 最后一次 touchstart 的时间戳 */
1741
- let lastShowPopTime: number = 0;
1742
- /**
1743
- * --- 获取 pop 显示出来的坐标并报系统全局记录 ---
1744
- * @param el 响应的元素
1745
- * @param pop 要显示 pop 元素
1746
- * @param direction 要显示方向(以 $el 为准的 h 水平和 v 垂直)或坐标
1747
- * @param opt width / height 显示的 pop 定义自定义宽/高度,可省略;null,true 代表为空也会显示,默认为 false
1748
- */
1749
- 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 {
1750
- // --- opt.null 为 true 代表可为空,为空也会被显示,默认为 false ---
1751
- if (opt.null === undefined) {
1752
- opt.null = false;
1753
- }
1754
- if (opt.size === undefined) {
1755
- opt.size = {};
1756
- }
1757
- // --- 也可能不执行本次显示 ---
1758
- if (!pop && !opt.null) {
1759
- return;
1760
- }
1761
- // --- 如果短时间内已经有了 pop 被展示,则可能是冒泡序列,本次则不展示 ---
1762
- const now = Date.now();
1763
- if (now - lastShowPopTime < 5) {
1764
- lastShowPopTime = now;
1765
- return;
1766
- }
1767
- lastShowPopTime = now;
1768
- // --- 检测是不是已经显示了 ---
1769
- if (el.dataset.cgPopOpen !== undefined) {
1770
- return;
1771
- }
1772
- /** --- 要不要隐藏别的 pop --- */
1773
- const parentPop = dom.findParentByData(el, 'cg-pop');
1774
- if (parentPop) {
1775
- for (let i = 0; i < popInfo.list.length; ++i) {
1776
- if (popInfo.list[i] !== parentPop) {
1777
- continue;
1778
- }
1779
- if (!popInfo.elList[i + 1]) {
1780
- continue;
1781
- }
1782
- hidePop(popInfo.elList[i + 1]);
1783
- }
1784
- }
1785
- else {
1786
- // --- 本层不是 pop,因此要隐藏所有 pop ---
1787
- hidePop();
1788
- }
1789
- // --- 检测如果 pop 是 undefined 还显示吗 ---
1790
- if (!pop) {
1791
- popInfo.elList.push(el);
1792
- el.dataset.cgPopOpen = '';
1793
- el.dataset.cgLevel = (popInfo.elList.length - 1).toString();
1794
- return;
1795
- }
1747
+ /** --- 重新调整 pop 的位置 --- */
1748
+ function refreshPopPosition(el: HTMLElement, pop: HTMLElement, direction: 'h' | 'v' | MouseEvent | TouchEvent | { x: number; y: number; }, size: { width?: number; height?: number; } = {}): void {
1796
1749
  // --- 最终 pop 的大小 ---
1797
- const width = opt.size.width ?? (pop ? pop.offsetWidth : 0);
1798
- const height = opt.size.height ?? (pop ? pop.offsetHeight : 0);
1750
+ const width = size.width ?? pop.offsetWidth;
1751
+ const height = size.height ?? pop.offsetHeight;
1799
1752
  // --- 最终显示位置 ---
1800
1753
  let left: number, top: number;
1801
1754
  if (typeof direction === 'string') {
@@ -1866,11 +1819,77 @@ export function showPop(el: HTMLElement, pop: HTMLElement | undefined, direction
1866
1819
  pop.style.left = left.toString() + 'px';
1867
1820
  pop.style.top = top.toString() + 'px';
1868
1821
  pop.style.zIndex = (++popInfo.lastZIndex).toString();
1869
- if (opt.size.width) {
1870
- pop.style.width = opt.size.width.toString() + 'px';
1822
+ if (size.width) {
1823
+ pop.style.width = size.width.toString() + 'px';
1871
1824
  }
1872
- if (opt.size.height) {
1873
- pop.style.height = opt.size.height.toString() + 'px';
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;
1885
+ }
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
+ });
1874
1893
  }
1875
1894
  popInfo.list.push(pop);
1876
1895
  popInfo.elList.push(el);
@@ -1912,6 +1931,7 @@ export function hidePop(pop?: HTMLElement): void {
1912
1931
  if (isPop) {
1913
1932
  pop.removeAttribute('data-cg-open');
1914
1933
  pop.removeAttribute('data-cg-level');
1934
+ clickgo.dom.unwatchSize(pop);
1915
1935
  popInfo.elList[level].removeAttribute('data-cg-pop-open');
1916
1936
  popInfo.elList[level].removeAttribute('data-cg-level');
1917
1937
  }
@@ -1919,6 +1939,7 @@ export function hidePop(pop?: HTMLElement): void {
1919
1939
  if (popInfo.list[level]) {
1920
1940
  popInfo.list[level].removeAttribute('data-cg-open');
1921
1941
  popInfo.list[level].removeAttribute('data-cg-level');
1942
+ clickgo.dom.unwatchSize(popInfo.list[level]);
1922
1943
  }
1923
1944
  pop.removeAttribute('data-cg-pop-open');
1924
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/lib/tool.js CHANGED
@@ -429,12 +429,10 @@ function getBoolean(param) {
429
429
  if (t === 'boolean') {
430
430
  return param;
431
431
  }
432
- else if (t === 'string') {
432
+ if (t === 'string') {
433
433
  return param === 'false' ? false : true;
434
434
  }
435
- else {
436
- return param ? true : false;
437
- }
435
+ return param ? true : false;
438
436
  }
439
437
  exports.getBoolean = getBoolean;
440
438
  function getNumber(param) {
package/dist/lib/tool.ts CHANGED
@@ -565,12 +565,10 @@ export function getBoolean(param: boolean | string | number | undefined): boolea
565
565
  if (t === 'boolean') {
566
566
  return param as boolean;
567
567
  }
568
- else if (t === 'string') {
568
+ if (t === 'string') {
569
569
  return param === 'false' ? false : true;
570
570
  }
571
- else {
572
- return param ? true : false;
573
- }
571
+ return param ? true : false;
574
572
  }
575
573
 
576
574
  /**
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clickgo",
3
- "version": "3.6.0",
3
+ "version": "3.6.2",
4
4
  "description": "Background interface, software interface, mobile phone APP interface operation library.",
5
5
  "keywords": [
6
6
  "deskrt",