clickgo 3.1.10-beta → 3.1.12

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.4.9/dist/loader.min.js?path=index&npm={'clickgo':'3.1.10-beta'}"></script>
31
+ <script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.4.9/dist/loader.min.js?path=index&npm={'clickgo':'3.1.12'}"></script>
32
32
  ```
33
33
 
34
34
  **index.js**
@@ -37,12 +37,12 @@ class default_1 extends clickgo.form.AbstractForm {
37
37
  constructor() {
38
38
  super(...arguments);
39
39
  this.layer = false;
40
- this.label = '';
40
+ this.name = '';
41
41
  this.isShow = false;
42
42
  this.loading = false;
43
43
  }
44
44
  onMounted() {
45
- this.watch('label', () => __awaiter(this, void 0, void 0, function* () {
45
+ this.watch('name', () => __awaiter(this, void 0, void 0, function* () {
46
46
  this.loading = true;
47
47
  yield clickgo.tool.sleep(300);
48
48
  this.loading = false;
@@ -1,5 +1,5 @@
1
1
  <form width="600" height="500" title="Nav" :loading="loading">
2
- <nav v-model="label" v-model:show="isShow" @layer="layer = $event" style="flex: 1; width: 0;">
2
+ <nav v-model="name" v-model:show="isShow" @layer="layer = $event" style="flex: 1; width: 0;">
3
3
  <nav-item label="Title1">
4
4
  <nav-title>group1</nav-title>
5
5
  <nav-item label="Sub1">
@@ -29,14 +29,20 @@
29
29
  <nav-item label="Action11"></nav-item>
30
30
  <nav-item label="Action12"></nav-item>
31
31
  </nav-item>
32
+ <nav-item label="中文">
33
+ <nav-item label="中文1"></nav-item>
34
+ <nav-item label="中文2"></nav-item>
35
+ <nav-item label="有 name" name="hasname"></nav-item>
36
+ </nav-item>
32
37
  </nav-item>
33
38
  <template v-slot:content>
34
39
  <layout direction="v" gutter="10" style="padding: 10px; flex: 1;">
35
40
  <label>Change the size of the form to see the effect.</label>
36
- <label>Now select: {{label}}</label>
41
+ <label>Now select: {{name}}</label>
37
42
  <label>Layer show: {{isShow ? 'true' : 'false'}}</label>
38
43
  <button v-if="layer" @click="isShow = true" style="height: 30px;">Open</button>
39
- <button @click="label = 'Action11'" style="height: 30px;">Select "Action11"</button>
44
+ <button @click="name = 'Action11'" style="height: 30px;">Select "Action11"</button>
45
+ <button @click="name = 'hasname'" style="height: 30px;">Select "hasname"</button>
40
46
  </layout>
41
47
  </template>
42
48
  </nav>
@@ -32,6 +32,7 @@ class default_1 extends clickgo.form.AbstractForm {
32
32
  constructor() {
33
33
  super(...arguments);
34
34
  this.selected = ['none'];
35
+ this.parentData = 'yeah!';
35
36
  }
36
37
  go() {
37
38
  this.refs.panel.go(test1_1.default, {
@@ -1,7 +1,8 @@
1
1
  <panel direction="v" gutter="10" style="padding: 10px; border: solid 2px #000; border-color: #777 #DDD #DDD #777;">
2
2
  <label>Hello, this is test1.</label>
3
3
  <label>onShow count: {{scount}}</label>
4
- <label>data: {{data}}</label>
4
+ <label>Data: {{data}}</label>
5
+ <label>Parent data: {{rootForm.parentData}}</label>
5
6
  <button @click="click" style="height: 30px;">Hi</button>
6
7
  <layout>
7
8
  <button style="padding: 15px 30px;" area="split">
@@ -1,3 +1,4 @@
1
- <panel style="padding: 10px; border: solid 2px #000; border-color: #777 #DDD #DDD #777; background: #FFF;">
1
+ <panel direction="v" gutter="10" style="padding: 10px; border: solid 2px #000; border-color: #777 #DDD #DDD #777; background: #FFF;">
2
2
  <label>Hello, test2!</label>
3
+ <label>Panel ID: {{panelId}}</label>
3
4
  </panel>
@@ -59,5 +59,10 @@ class default_1 extends clickgo.form.AbstractForm {
59
59
  yield clickgo.form.dialog('No permission.');
60
60
  });
61
61
  }
62
+ getHash() {
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ yield clickgo.form.dialog('Hash is: ' + clickgo.core.getHash());
65
+ });
66
+ }
62
67
  }
63
68
  exports.default = default_1;
@@ -8,5 +8,6 @@
8
8
  <text v-model="hash" style="flex: 1;" />
9
9
  <button @click="hashe" style="height: 30px; padding: 0 10px;">hash('{{hash}}')</button>
10
10
  </layout>
11
+ <button @click="getHash" style="height: 30px;">getHash()</button>
11
12
  </layout>
12
13
  </form>
Binary file
package/dist/lib/core.js CHANGED
@@ -32,7 +32,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
32
  });
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.hash = exports.getAvailArea = exports.fetchApp = exports.readApp = exports.trigger = exports.getModule = exports.regModule = exports.boot = exports.getCdn = exports.AbstractApp = exports.config = void 0;
35
+ exports.getHash = exports.hash = exports.getAvailArea = exports.fetchApp = exports.readApp = exports.trigger = exports.getModule = exports.regModule = exports.boot = exports.getCdn = exports.AbstractApp = exports.config = void 0;
36
36
  const clickgo = __importStar(require("../clickgo"));
37
37
  const fs = __importStar(require("./fs"));
38
38
  const form = __importStar(require("./form"));
@@ -680,6 +680,10 @@ function hash(hash, taskId) {
680
680
  return true;
681
681
  }
682
682
  exports.hash = hash;
683
+ function getHash() {
684
+ return window.location.hash ? decodeURIComponent(window.location.hash.slice(1)) : '';
685
+ }
686
+ exports.getHash = getHash;
683
687
  window.addEventListener('hashchange', function () {
684
- trigger('hashChanged', window.location.hash ? window.location.hash.slice(1) : '');
688
+ trigger('hashChanged', window.location.hash ? decodeURIComponent(window.location.hash.slice(1)) : '');
685
689
  });
package/dist/lib/core.ts CHANGED
@@ -786,6 +786,13 @@ export function hash(hash: string, taskId?: number): boolean {
786
786
  return true;
787
787
  }
788
788
 
789
+ /**
790
+ * --- 获取当前浏览器的 hash ---
791
+ */
792
+ export function getHash(): string {
793
+ return window.location.hash ? decodeURIComponent(window.location.hash.slice(1)) : '';
794
+ }
795
+
789
796
  window.addEventListener('hashchange', function() {
790
- trigger('hashChanged', window.location.hash ? window.location.hash.slice(1) : '');
797
+ trigger('hashChanged', window.location.hash ? decodeURIComponent(window.location.hash.slice(1)) : '');
791
798
  });
package/dist/lib/form.js CHANGED
@@ -99,9 +99,6 @@ class AbstractCommon {
99
99
  get formId() {
100
100
  return 0;
101
101
  }
102
- get formFocus() {
103
- return this._formFocus;
104
- }
105
102
  set formFocus(b) {
106
103
  notify({
107
104
  'title': 'Error',
@@ -192,6 +189,13 @@ class AbstractPanel extends AbstractCommon {
192
189
  get panelId() {
193
190
  return 0;
194
191
  }
192
+ get rootForm() {
193
+ return {};
194
+ }
195
+ get formFocus() {
196
+ var _a;
197
+ return (_a = this.rootForm.formFocus) !== null && _a !== void 0 ? _a : false;
198
+ }
195
199
  onShow() {
196
200
  return;
197
201
  }
@@ -223,6 +227,9 @@ class AbstractForm extends AbstractCommon {
223
227
  task.list[this.taskId].runtime.dialogFormIds[task.list[this.taskId].runtime.dialogFormIds.length - 1]
224
228
  === this.formId ? false : true;
225
229
  }
230
+ get formFocus() {
231
+ return this._formFocus;
232
+ }
226
233
  show() {
227
234
  const v = this;
228
235
  if (this._firstShow) {
@@ -1611,7 +1618,6 @@ function createPanel(cls, el, formId, taskId) {
1611
1618
  }
1612
1619
  idata[item[0]] = item[1];
1613
1620
  }
1614
- idata._formFocus = false;
1615
1621
  const prot = tool.getClassPrototype(panel);
1616
1622
  const methods = prot.method;
1617
1623
  const computed = prot.access;
@@ -1661,7 +1667,20 @@ function createPanel(cls, el, formId, taskId) {
1661
1667
  set: function () {
1662
1668
  notify({
1663
1669
  'title': 'Error',
1664
- 'content': `The software tries to modify the system variable "cgPrep".\nPath: ${this.filename}`,
1670
+ 'content': `The software tries to modify the system variable "prep".\nPath: ${this.filename}`,
1671
+ 'type': 'danger'
1672
+ });
1673
+ return;
1674
+ }
1675
+ };
1676
+ computed.rootForm = {
1677
+ get: function () {
1678
+ return t.forms[formId].vroot;
1679
+ },
1680
+ set: function () {
1681
+ notify({
1682
+ 'title': 'Error',
1683
+ 'content': `The software tries to modify the system variable "rootForm".\nPath: ${this.filename}`,
1665
1684
  'type': 'danger'
1666
1685
  });
1667
1686
  return;
@@ -1920,7 +1939,7 @@ function create(cls, data, opt = {}, taskId) {
1920
1939
  set: function () {
1921
1940
  notify({
1922
1941
  'title': 'Error',
1923
- 'content': `The software tries to modify the system variable "cgPrep".\nPath: ${this.filename}`,
1942
+ 'content': `The software tries to modify the system variable "prep".\nPath: ${this.filename}`,
1924
1943
  'type': 'danger'
1925
1944
  });
1926
1945
  return;
package/dist/lib/form.ts CHANGED
@@ -116,12 +116,6 @@ abstract class AbstractCommon {
116
116
  return 0;
117
117
  }
118
118
 
119
- /** --- 当前窗体是否是焦点 --- */
120
- public get formFocus(): boolean {
121
- // --- _formFocus 在初始化时由系统设置 ---
122
- return (this as any)._formFocus;
123
- }
124
-
125
119
  public set formFocus(b: boolean) {
126
120
  notify({
127
121
  'title': 'Error',
@@ -282,6 +276,16 @@ export abstract class AbstractPanel extends AbstractCommon {
282
276
  return 0;
283
277
  }
284
278
 
279
+ /** --- 当前 panel 所在窗体的窗体对象,系统会在创建时重写本函数 --- */
280
+ public get rootForm(): AbstractForm & Record<string, any> {
281
+ return {} as any;
282
+ }
283
+
284
+ /** --- 当前窗体是否是焦点 --- */
285
+ public get formFocus(): boolean {
286
+ return this.rootForm.formFocus ?? false;
287
+ }
288
+
285
289
  public onShow(data: Record<string, any>): void | Promise<void>;
286
290
  public onShow(): void {
287
291
  return;
@@ -332,6 +336,12 @@ export abstract class AbstractForm extends AbstractCommon {
332
336
  === this.formId ? false : true;
333
337
  }
334
338
 
339
+ /** --- 当前窗体是否是焦点 --- */
340
+ public get formFocus(): boolean {
341
+ // --- _formFocus 在初始化时由系统设置 ---
342
+ return (this as any)._formFocus;
343
+ }
344
+
335
345
  /** --- 当前是不是初次显示 --- */
336
346
  private _firstShow: boolean = true;
337
347
 
@@ -2115,7 +2125,6 @@ export async function createPanel<T extends AbstractPanel>(
2115
2125
  }
2116
2126
  idata[item[0]] = item[1];
2117
2127
  }
2118
- idata._formFocus = false;
2119
2128
  /** --- class 对象的方法和 getter/setter 列表 --- */
2120
2129
  const prot = tool.getClassPrototype(panel);
2121
2130
  const methods = prot.method;
@@ -2166,7 +2175,20 @@ export async function createPanel<T extends AbstractPanel>(
2166
2175
  set: function(this: types.IVue): void {
2167
2176
  notify({
2168
2177
  'title': 'Error',
2169
- 'content': `The software tries to modify the system variable "cgPrep".\nPath: ${this.filename}`,
2178
+ 'content': `The software tries to modify the system variable "prep".\nPath: ${this.filename}`,
2179
+ 'type': 'danger'
2180
+ });
2181
+ return;
2182
+ }
2183
+ };
2184
+ computed.rootForm = {
2185
+ get: function(): AbstractForm & Record<string, any> {
2186
+ return t.forms[formId].vroot as any;
2187
+ },
2188
+ set: function(this: types.IVue): void {
2189
+ notify({
2190
+ 'title': 'Error',
2191
+ 'content': `The software tries to modify the system variable "rootForm".\nPath: ${this.filename}`,
2170
2192
  'type': 'danger'
2171
2193
  });
2172
2194
  return;
@@ -2478,7 +2500,7 @@ export async function create<T extends AbstractForm>(
2478
2500
  set: function(this: types.IVue): void {
2479
2501
  notify({
2480
2502
  'title': 'Error',
2481
- 'content': `The software tries to modify the system variable "cgPrep".\nPath: ${this.filename}`,
2503
+ 'content': `The software tries to modify the system variable "prep".\nPath: ${this.filename}`,
2482
2504
  'type': 'danger'
2483
2505
  });
2484
2506
  return;
package/dist/lib/task.js CHANGED
@@ -236,7 +236,7 @@ function run(url, opt = {}, ntid) {
236
236
  const unblock = opt.unblock ? tool.clone(opt.unblock) : [];
237
237
  const unblockSys = [
238
238
  'require',
239
- '__awaiter', 'eval', 'Math', 'Array', 'Blob', 'Error', 'Infinity', 'parseInt', 'parseFloat', 'Promise', 'Date', 'JSON', 'fetch', 'Number', 'Object'
239
+ '__awaiter', 'eval', 'Math', 'Array', 'Blob', 'Error', 'Infinity', 'parseInt', 'parseFloat', 'Promise', 'Date', 'JSON', 'fetch', 'Number', 'Object', 'encodeURIComponent', 'decodeURIComponent'
240
240
  ];
241
241
  for (const name of unblockSys) {
242
242
  if (unblock.includes(name)) {
@@ -412,6 +412,9 @@ function run(url, opt = {}, ntid) {
412
412
  },
413
413
  hash: function (hash) {
414
414
  return core.hash(hash, taskId);
415
+ },
416
+ getHash: function () {
417
+ return core.getHash();
415
418
  }
416
419
  },
417
420
  'dom': {
package/dist/lib/task.ts CHANGED
@@ -282,7 +282,7 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}, ntid?: n
282
282
  const unblock = opt.unblock ? tool.clone(opt.unblock) : [];
283
283
  const unblockSys = [
284
284
  'require',
285
- '__awaiter', 'eval', 'Math', 'Array', 'Blob', 'Error', 'Infinity', 'parseInt', 'parseFloat', 'Promise', 'Date', 'JSON', 'fetch', 'Number', 'Object'
285
+ '__awaiter', 'eval', 'Math', 'Array', 'Blob', 'Error', 'Infinity', 'parseInt', 'parseFloat', 'Promise', 'Date', 'JSON', 'fetch', 'Number', 'Object', 'encodeURIComponent', 'decodeURIComponent'
286
286
  ];
287
287
  for (const name of unblockSys) {
288
288
  if (unblock.includes(name)) {
@@ -470,6 +470,9 @@ export async function run(url: string, opt: types.ITaskRunOptions = {}, ntid?: n
470
470
  },
471
471
  hash: function(hash: string): boolean {
472
472
  return core.hash(hash, taskId);
473
+ },
474
+ getHash: function(): string {
475
+ return core.getHash();
473
476
  }
474
477
  },
475
478
  'dom': {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clickgo",
3
- "version": "3.1.10-beta",
3
+ "version": "3.1.12",
4
4
  "description": "Background interface, software interface, mobile phone APP interface operation library.",
5
5
  "keywords": [
6
6
  "deskrt",