clickgo 3.11.16 → 3.11.18

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.1/dist/loader.min.js?path=index&npm={'clickgo':'3.11.16'}"></script>
31
+ <script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.5.1/dist/loader.min.js?path=index&npm={'clickgo':'3.11.18'}"></script>
32
32
  ```
33
33
 
34
34
  **index.js**
@@ -3,7 +3,7 @@
3
3
  <label>File: {{npath[0]}}, Length: {{files[npath[0]] ? files[npath[0]].length : ''}}</label>
4
4
  <label>{{npath}}</label>
5
5
  <layout gutter="10" style="flex: 1; height: 0;">
6
- <text :modelValue="JSON.stringify(files, null, 4)" style="flex: 1; width: 0;" multi readonly wrap></text>
6
+ <text :modelValue="JSON.stringify(files, null, 4)" style="flex: 1; width: 0;" type="multi" readonly wrap></text>
7
7
  <monaco v-model="npath[0]" v-model:files="files" :readonly="readonly" :language="language" :disabled="disabled" :theme="theme[0]" @jump="jump" style="flex: 1; wdith: 0;" :style="{'font-size': size[0], 'font-family': family ? 'Consolas, \'Courier New\', monospace' : undefined}"></monaco>
8
8
  </layout>
9
9
  <layout gutter="10">
@@ -1,6 +1,6 @@
1
1
  <form title="Property" width="520" height="400" min-width="300" min-height="400" padding="10">
2
2
  <layout gutter="10" style="flex: 1; width: 0;">
3
- <text :modelValue="JSON.stringify(data, null, 4)" style="flex: 1; width: 0;" multi readonly wrap></text>
3
+ <text :modelValue="JSON.stringify(data, null, 4)" style="flex: 1; width: 0;" type="multi" readonly wrap></text>
4
4
  <property v-model="data" style="flex: 1; width: 0;"></property>
5
5
  </layout>
6
6
  </form>
@@ -1,9 +1,9 @@
1
1
  <form width="350" height="600" title="Library task" padding="10">
2
2
  <layout direction="v" gutter="10" style="flex: 1;">
3
3
  <label>config:</label>
4
- <text v-model="config" readonly multi style="flex: 1;"></text>
4
+ <text v-model="config" readonly type="multi" style="flex: 1;"></text>
5
5
  <label>global:</label>
6
- <text v-model="global" readonly multi style="flex: 1;"></text>
6
+ <text v-model="global" readonly type="multi" style="flex: 1;"></text>
7
7
  <button @click="getCdn">getCdn()</button>
8
8
  <button @click="getAvailArea">getAvailArea()</button>
9
9
  <layout gutter="10">
@@ -25,7 +25,7 @@
25
25
  <button @click="watchStyleChange = !watchStyleChange" ref="watchStyle" :style="{'font-size': watchStyleChange ? 'inherit' : '16px'}">watchStyle(this.refs.watchStyle.$el, 'font-size', (n, v) => { ... })</button>
26
26
  <button @click="isWatchStyle" >isWatchStyle(this.refs.watchStyle.$el)</button>
27
27
  <!-- getWatchInfo -->
28
- <text :model-value="getWatchInfoText" readonly multi style="height: 300px;"></text>
28
+ <text :model-value="getWatchInfoText" readonly type="multi" style="height: 300px;"></text>
29
29
  <button @click="getWatchInfo" :disabled="getWatchInfoDisabled">getWatchInfo 20s</button>
30
30
  <block @mousedown="bindGesture" @touchstart="bindGesture" style="height: 50px; display: flex; justify-content: center; align-items: center; font-size: 14px; background: var(--g-plain-background); border: solid 1px var(--g-plain-border-color);">{{bindGestureText ? bindGestureText : 'bindGesture(e: Touch | Mouse, { ... })'}}</block>
31
31
  <block @wheel="bindGestureWheel" style="height: 50px; display: flex; justify-content: center; align-items: center; font-size: 14px; background: var(--g-plain-background); border: solid 1px var(--g-plain-border-color);">{{bindGestureWheelText ? bindGestureWheelText : 'bindGesture(e: Wheel, { ... })'}}</block>
@@ -240,6 +240,11 @@ class default_1 extends clickgo.form.AbstractForm {
240
240
  }
241
241
  });
242
242
  }
243
+ prompt() {
244
+ return __awaiter(this, void 0, void 0, function* () {
245
+ this.dr = yield clickgo.form.prompt('test');
246
+ });
247
+ }
243
248
  flash() {
244
249
  clickgo.form.flash(this.formId);
245
250
  }
@@ -56,6 +56,7 @@
56
56
  <button @click="dialogData">Dialog data</button>
57
57
  <button @click="confirm(false)">confirm('confirm')</button>
58
58
  <button @click="confirm(true)">confirm({'content':'confirm','cancel':true})</button>
59
+ <button @click="prompt">prompt('test')</button>
59
60
  <button @click="flash">flash({{formId}})</button>
60
61
  <button @click="showLauncher">showLauncher()</button>
61
62
  </layout>
@@ -1,3 +1,3 @@
1
1
  <form width="350" height="400" :title="title" padding="10">
2
- <text v-model="content" style="flex: 1;" multi readonly></text>
2
+ <text v-model="content" style="flex: 1;" type="multi" readonly></text>
3
3
  </form>
@@ -2,7 +2,7 @@
2
2
  <flow direction="v" style="flex: 1; padding: 10px;">
3
3
  <layout direction="v" gutter="10">
4
4
  <button @click="sleep">{{sleeping ? 'Waiting...' : 'sleep(1000)'}}</button>
5
- <text v-model="purifyTxt" multi style="height: 100px;"></text>
5
+ <text v-model="purifyTxt" type="multi" style="height: 100px;"></text>
6
6
  <button @click="purify">purify('{{purifyTxt.slice(0, 5).replace("'", "\\'")}}...')</button>
7
7
  <layout gutter="10">
8
8
  <text v-model="min" style="flex: 1;"></text>
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.11.16';
27
+ const version = '3.11.18';
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.11.16';
16
+ const version = '3.11.18';
17
17
  export function getVersion(): string {
18
18
  return version;
19
19
  }
Binary file
package/dist/lib/form.js CHANGED
@@ -32,8 +32,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
32
32
  });
33
33
  };
34
34
  Object.defineProperty(exports, "__esModule", { value: true });
35
- exports.showLauncher = exports.flash = exports.confirm = exports.dialog = exports.create = exports.createPanel = exports.removePanel = exports.remove = exports.doFocusAndPopEvent = exports.hidePop = exports.showPop = exports.removeFromPop = exports.appendToPop = exports.hideNotify = exports.notifyProgress = exports.notify = exports.hideDrag = exports.moveDrag = exports.showDrag = exports.hideRectangle = exports.showRectangle = exports.moveRectangle = exports.showCircular = exports.getRectByBorder = exports.getMaxZIndexID = exports.changeFocus = exports.hashBack = exports.getHash = exports.hash = exports.setActivePanel = exports.removeActivePanel = exports.getActivePanel = exports.activePanels = exports.getFocus = exports.getList = exports.send = exports.get = exports.getTaskId = exports.refreshMaxPosition = exports.bindDrag = exports.bindResize = exports.close = exports.max = exports.min = exports.superConfirm = exports.elements = exports.launcherRoot = exports.simpleSystemTaskRoot = exports.AbstractForm = exports.AbstractPanel = void 0;
36
- exports.hideLauncher = void 0;
35
+ exports.flash = exports.prompt = exports.confirm = exports.dialog = exports.create = exports.createPanel = exports.removePanel = exports.remove = exports.doFocusAndPopEvent = exports.hidePop = exports.showPop = exports.removeFromPop = exports.appendToPop = exports.hideNotify = exports.notifyProgress = exports.notify = exports.hideDrag = exports.moveDrag = exports.showDrag = exports.hideRectangle = exports.showRectangle = exports.moveRectangle = exports.showCircular = exports.getRectByBorder = exports.getMaxZIndexID = exports.changeFocus = exports.hashBack = exports.getHash = exports.hash = exports.setActivePanel = exports.removeActivePanel = exports.getActivePanel = exports.activePanels = exports.getFocus = exports.getList = exports.send = exports.get = exports.getTaskId = exports.refreshMaxPosition = exports.bindDrag = exports.bindResize = exports.close = exports.max = exports.min = exports.superConfirm = exports.elements = exports.launcherRoot = exports.simpleSystemTaskRoot = exports.AbstractForm = exports.AbstractPanel = void 0;
36
+ exports.hideLauncher = exports.showLauncher = void 0;
37
37
  const clickgo = __importStar(require("../clickgo"));
38
38
  const core = __importStar(require("./core"));
39
39
  const task = __importStar(require("./task"));
@@ -2635,10 +2635,11 @@ function dialog(opt) {
2635
2635
  }
2636
2636
  const cls = class extends AbstractForm {
2637
2637
  constructor() {
2638
- var _a;
2638
+ var _a, _b;
2639
2639
  super(...arguments);
2640
2640
  this.buttons = nopt.buttons;
2641
2641
  this.data = (_a = nopt.data) !== null && _a !== void 0 ? _a : {};
2642
+ this.methods = (_b = nopt.methods) !== null && _b !== void 0 ? _b : {};
2642
2643
  }
2643
2644
  get filename() {
2644
2645
  return filename;
@@ -2647,16 +2648,19 @@ function dialog(opt) {
2647
2648
  return taskId;
2648
2649
  }
2649
2650
  select(button) {
2650
- var _a;
2651
2651
  const event = {
2652
2652
  'go': true,
2653
2653
  preventDefault: function () {
2654
2654
  this.go = false;
2655
2655
  }
2656
2656
  };
2657
- (_a = nopt.select) === null || _a === void 0 ? void 0 : _a.call(nopt, event, button);
2657
+ if (nopt.select) {
2658
+ nopt.select.call(this, event, button);
2659
+ }
2658
2660
  if (event.go) {
2659
- this.dialogResult = button;
2661
+ if (nopt.autoDialogResult !== false) {
2662
+ this.dialogResult = button;
2663
+ }
2660
2664
  close(this.formId);
2661
2665
  }
2662
2666
  }
@@ -2703,6 +2707,7 @@ function confirm(opt) {
2703
2707
  }
2704
2708
  const res = yield dialog({
2705
2709
  'taskId': taskId,
2710
+ 'title': opt.title,
2706
2711
  'content': opt.content,
2707
2712
  'buttons': buttons
2708
2713
  });
@@ -2716,6 +2721,42 @@ function confirm(opt) {
2716
2721
  });
2717
2722
  }
2718
2723
  exports.confirm = confirm;
2724
+ function prompt(opt) {
2725
+ return __awaiter(this, void 0, void 0, function* () {
2726
+ var _a, _b, _c;
2727
+ if (typeof opt === 'string') {
2728
+ opt = {
2729
+ 'content': opt
2730
+ };
2731
+ }
2732
+ const taskId = opt.taskId;
2733
+ if (!taskId) {
2734
+ return '';
2735
+ }
2736
+ const t = task.list[taskId];
2737
+ if (!t) {
2738
+ return '';
2739
+ }
2740
+ const locale = t.locale.lang || core.config.locale;
2741
+ const res = yield dialog({
2742
+ 'taskId': taskId,
2743
+ 'title': opt.title,
2744
+ 'direction': 'v',
2745
+ 'gutter': 10,
2746
+ 'content': '<block>' + opt.content + '</block><text v-model="data.text">',
2747
+ 'data': {
2748
+ 'text': (_a = opt.text) !== null && _a !== void 0 ? _a : ''
2749
+ },
2750
+ 'select': function () {
2751
+ this.dialogResult = this.data.text;
2752
+ },
2753
+ 'buttons': [(_c = (_b = info.locale[locale]) === null || _b === void 0 ? void 0 : _b.ok) !== null && _c !== void 0 ? _c : info.locale['en'].ok],
2754
+ 'autoDialogResult': false
2755
+ });
2756
+ return res;
2757
+ });
2758
+ }
2759
+ exports.prompt = prompt;
2719
2760
  function flash(formId, taskId) {
2720
2761
  if (!taskId) {
2721
2762
  return;
package/dist/lib/form.ts CHANGED
@@ -3350,6 +3350,8 @@ export function dialog(opt: string | types.IFormDialogOptions): Promise<string>
3350
3350
 
3351
3351
  public data = nopt.data ?? {};
3352
3352
 
3353
+ public methods = nopt.methods ?? {};
3354
+
3353
3355
  public get filename(): string {
3354
3356
  return filename;
3355
3357
  }
@@ -3365,9 +3367,13 @@ export function dialog(opt: string | types.IFormDialogOptions): Promise<string>
3365
3367
  this.go = false;
3366
3368
  }
3367
3369
  };
3368
- nopt.select?.(event as unknown as Event, button);
3370
+ if (nopt.select) {
3371
+ nopt.select.call(this, event as unknown as Event, button)
3372
+ }
3369
3373
  if (event.go) {
3370
- this.dialogResult = button;
3374
+ if (nopt.autoDialogResult !== false) {
3375
+ this.dialogResult = button;
3376
+ }
3371
3377
  close(this.formId);
3372
3378
  }
3373
3379
  }
@@ -3417,6 +3423,7 @@ export async function confirm(opt: string | types.IFormConfirmOptions): Promise<
3417
3423
  const res = await dialog({
3418
3424
  'taskId': taskId,
3419
3425
 
3426
+ 'title': opt.title,
3420
3427
  'content': opt.content,
3421
3428
  'buttons': buttons
3422
3429
  });
@@ -3429,6 +3436,44 @@ export async function confirm(opt: string | types.IFormConfirmOptions): Promise<
3429
3436
  return false;
3430
3437
  }
3431
3438
 
3439
+ /**
3440
+ * --- 显示一个输入框 dialog ---
3441
+ * @param opt 选项或者提示文字
3442
+ */
3443
+ export async function prompt(opt: string | types.IFormPromptOptions): Promise<string> {
3444
+ if (typeof opt === 'string') {
3445
+ opt = {
3446
+ 'content': opt
3447
+ };
3448
+ }
3449
+ const taskId = opt.taskId;
3450
+ if (!taskId) {
3451
+ return '';
3452
+ }
3453
+ const t = task.list[taskId];
3454
+ if (!t) {
3455
+ return '';
3456
+ }
3457
+ const locale = t.locale.lang || core.config.locale;
3458
+ const res = await dialog({
3459
+ 'taskId': taskId,
3460
+
3461
+ 'title': opt.title,
3462
+ 'direction': 'v',
3463
+ 'gutter': 10,
3464
+ 'content': '<block>' + opt.content + '</block><text v-model="data.text">',
3465
+ 'data': {
3466
+ 'text': opt.text ?? ''
3467
+ },
3468
+ 'select': function(this: any) {
3469
+ this.dialogResult = this.data.text;
3470
+ },
3471
+ 'buttons': [info.locale[locale]?.ok ?? info.locale['en'].ok],
3472
+ 'autoDialogResult': false
3473
+ });
3474
+ return res;
3475
+ }
3476
+
3432
3477
  /**
3433
3478
  * --- 让窗体闪烁 ---
3434
3479
  * @param formId 要闪烁的窗体 id,必填
package/dist/lib/task.js CHANGED
@@ -707,6 +707,15 @@ function run(url_1) {
707
707
  opt.taskId = taskId;
708
708
  return form.confirm(opt);
709
709
  },
710
+ prompt: function (opt) {
711
+ if (typeof opt === 'string') {
712
+ opt = {
713
+ 'content': opt
714
+ };
715
+ }
716
+ opt.taskId = taskId;
717
+ return form.prompt(opt);
718
+ },
710
719
  flash: function (fid) {
711
720
  form.flash(fid, taskId);
712
721
  },
package/dist/lib/task.ts CHANGED
@@ -822,6 +822,15 @@ export async function run(url: string | types.IApp, opt: types.ITaskRunOptions =
822
822
  opt.taskId = taskId;
823
823
  return form.confirm(opt);
824
824
  },
825
+ prompt: function(opt: string | types.IFormPromptOptions): Promise<string> {
826
+ if (typeof opt === 'string') {
827
+ opt = {
828
+ 'content': opt
829
+ };
830
+ }
831
+ opt.taskId = taskId;
832
+ return form.prompt(opt);
833
+ },
825
834
  flash: function(fid: number): void {
826
835
  form.flash(fid, taskId);
827
836
  },
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clickgo",
3
- "version": "3.11.16",
3
+ "version": "3.11.18",
4
4
  "description": "Background interface, software interface, mobile phone APP interface operation library.",
5
5
  "keywords": [
6
6
  "deskrt",
package/types/index.d.ts CHANGED
@@ -571,12 +571,15 @@ export interface IFormDialogOptions {
571
571
  'title'?: string;
572
572
  'content': string;
573
573
  'buttons'?: string[];
574
+ 'autoDialogResult'?: boolean;
574
575
 
575
576
  'direction'?: 'h' | 'v';
576
577
  'gutter'?: number | string;
577
578
 
578
579
  /** --- 传值,需要用 data.x 读取 --- */
579
580
  'data'?: Record<string, any>;
581
+ /** --- 传值,需要用 methods.x 读取 --- */
582
+ 'methods'?: Record<string, () => any>;
580
583
  /** --- 样式表 --- */
581
584
  'style'?: string;
582
585
  /** --- 路径基,以 / 结束或文件路径则以文件的基路径为准,可留空 --- */
@@ -593,10 +596,21 @@ export interface IFormConfirmOptions {
593
596
  /** --- 当前的 taskId,App 模式下无效 --- */
594
597
  'taskId'?: number;
595
598
 
599
+ 'title'?: string;
596
600
  'content': string;
597
601
  'cancel'?: boolean;
598
602
  }
599
603
 
604
+ /** --- Prompt 选项 --- */
605
+ export interface IFormPromptOptions {
606
+ /** --- 当前的 taskId,App 模式下无效 --- */
607
+ 'taskId'?: number;
608
+
609
+ 'title'?: string;
610
+ 'content': string;
611
+ 'text'?: string;
612
+ }
613
+
600
614
  export interface IFormSetTopMostOptions {
601
615
  /** --- 当前 taskId,App 模式下无效 --- */
602
616
  'taskId'?: number;