clickgo 3.16.26 → 3.16.28

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.
Files changed (102) hide show
  1. package/README.md +1 -1
  2. package/dist/app/demo/app.js +4 -16
  3. package/dist/app/demo/config.json +4 -1
  4. package/dist/app/demo/form/control/arteditor/arteditor.js +7 -18
  5. package/dist/app/demo/form/control/button/button.js +2 -13
  6. package/dist/app/demo/form/control/check/check.js +3 -14
  7. package/dist/app/demo/form/control/content/content.js +3 -14
  8. package/dist/app/demo/form/control/daterange/daterange.js +1 -1
  9. package/dist/app/demo/form/control/delete/delete.js +3 -14
  10. package/dist/app/demo/form/control/dialog/dialog.js +2 -0
  11. package/dist/app/demo/form/control/dialog/dialog.xml +26 -12
  12. package/dist/app/demo/form/control/flow/flow.js +2 -13
  13. package/dist/app/demo/form/control/form/form.js +4 -15
  14. package/dist/app/demo/form/control/iconview/iconview.js +12 -29
  15. package/dist/app/demo/form/control/jodit/jodit.js +7 -18
  16. package/dist/app/demo/form/control/link/link.js +2 -13
  17. package/dist/app/demo/form/control/list/list.js +40 -52
  18. package/dist/app/demo/form/control/list/list.xml +20 -10
  19. package/dist/app/demo/form/control/map/map.js +17 -28
  20. package/dist/app/demo/form/control/menu/menu.js +6 -17
  21. package/dist/app/demo/form/control/mpegts/mpegts.js +1 -1
  22. package/dist/app/demo/form/control/nav/nav.js +6 -17
  23. package/dist/app/demo/form/control/novnc/novnc.js +75 -0
  24. package/dist/app/demo/form/control/novnc/novnc.xml +13 -0
  25. package/dist/app/demo/form/control/panel/panel.js +9 -20
  26. package/dist/app/demo/form/control/panel/test1.js +20 -41
  27. package/dist/app/demo/form/control/pdf/pdf.js +7 -20
  28. package/dist/app/demo/form/control/progress/progress.js +3 -12
  29. package/dist/app/demo/form/control/radio/radio.js +6 -17
  30. package/dist/app/demo/form/control/select/select.js +28 -41
  31. package/dist/app/demo/form/control/switch/switch.js +3 -14
  32. package/dist/app/demo/form/control/tab/tab.js +7 -18
  33. package/dist/app/demo/form/control/table/table.js +8 -23
  34. package/dist/app/demo/form/control/text/text.js +2 -13
  35. package/dist/app/demo/form/control/tuieditor/tuieditor.js +7 -18
  36. package/dist/app/demo/form/control/uploader/uploader.js +20 -31
  37. package/dist/app/demo/form/control/vflow/vflow.js +2 -13
  38. package/dist/app/demo/form/event/form/form.js +11 -22
  39. package/dist/app/demo/form/event/task/task.js +14 -29
  40. package/dist/app/demo/form/main.js +381 -387
  41. package/dist/app/demo/form/main.xml +3 -0
  42. package/dist/app/demo/form/method/acontrol/acontrol.js +2 -13
  43. package/dist/app/demo/form/method/aform/aform.js +41 -60
  44. package/dist/app/demo/form/method/aform/sd.js +3 -14
  45. package/dist/app/demo/form/method/core/core.js +25 -50
  46. package/dist/app/demo/form/method/dom/dom.js +35 -58
  47. package/dist/app/demo/form/method/form/form.js +106 -149
  48. package/dist/app/demo/form/method/fs/fs.js +126 -147
  49. package/dist/app/demo/form/method/native/native.js +44 -72
  50. package/dist/app/demo/form/method/storage/storage.js +9 -27
  51. package/dist/app/demo/form/method/system/system.js +16 -41
  52. package/dist/app/demo/form/method/task/task.js +18 -37
  53. package/dist/app/demo/form/method/theme/theme.js +39 -54
  54. package/dist/app/demo/form/method/tool/tool.js +22 -43
  55. package/dist/app/demo/form/method/tool/tool.xml +1 -1
  56. package/dist/app/demo/form/method/zip/zip.js +18 -29
  57. package/dist/app/demo/form/solution/backpanel/backpanel.js +10 -23
  58. package/dist/app/task/app.js +2 -13
  59. package/dist/app/task/form/bar/bar.js +32 -45
  60. package/dist/clickgo.js +1 -1
  61. package/dist/control/arteditor.cgc +0 -0
  62. package/dist/control/box.cgc +0 -0
  63. package/dist/control/captcha.cgc +0 -0
  64. package/dist/control/common.cgc +0 -0
  65. package/dist/control/desc.cgc +0 -0
  66. package/dist/control/drawer.cgc +0 -0
  67. package/dist/control/echarts.cgc +0 -0
  68. package/dist/control/form.cgc +0 -0
  69. package/dist/control/iconview.cgc +0 -0
  70. package/dist/control/jodit.cgc +0 -0
  71. package/dist/control/map.cgc +0 -0
  72. package/dist/control/monaco.cgc +0 -0
  73. package/dist/control/mpegts.cgc +0 -0
  74. package/dist/control/nav.cgc +0 -0
  75. package/dist/control/novnc.cgc +0 -0
  76. package/dist/control/page.cgc +0 -0
  77. package/dist/control/pdf.cgc +0 -0
  78. package/dist/control/property.cgc +0 -0
  79. package/dist/control/qrcode.cgc +0 -0
  80. package/dist/control/table.cgc +0 -0
  81. package/dist/control/task.cgc +0 -0
  82. package/dist/control/tplink.cgc +0 -0
  83. package/dist/control/tuieditor.cgc +0 -0
  84. package/dist/control/tuiviewer.cgc +0 -0
  85. package/dist/control/xterm.cgc +0 -0
  86. package/dist/index.js +59 -71
  87. package/dist/lib/control.js +213 -235
  88. package/dist/lib/core.js +356 -379
  89. package/dist/lib/dom.js +62 -91
  90. package/dist/lib/form.js +834 -906
  91. package/dist/lib/fs.js +834 -892
  92. package/dist/lib/native.js +32 -63
  93. package/dist/lib/storage.js +21 -33
  94. package/dist/lib/task.js +1054 -1098
  95. package/dist/lib/theme.js +102 -121
  96. package/dist/lib/tool.js +65 -98
  97. package/dist/lib/zip.js +27 -42
  98. package/dist/theme/blue.cgt +0 -0
  99. package/dist/theme/byterun.cgt +0 -0
  100. package/dist/theme/dark.cgt +0 -0
  101. package/dist/theme/light.cgt +0 -0
  102. package/package.json +1 -1
@@ -32,15 +32,6 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
35
  Object.defineProperty(exports, "__esModule", { value: true });
45
36
  const clickgo = __importStar(require("clickgo"));
46
37
  class default_1 extends clickgo.form.AbstractForm {
@@ -75,31 +66,21 @@ class default_1 extends clickgo.form.AbstractForm {
75
66
  get() {
76
67
  clickgo.form.dialog(JSON.stringify(clickgo.form.get(parseInt(this.fid)))).catch((e) => { throw e; });
77
68
  }
78
- getHash() {
79
- return __awaiter(this, void 0, void 0, function* () {
80
- yield clickgo.form.dialog(JSON.stringify(clickgo.form.getHash(parseInt(this.fid))));
81
- });
69
+ async getHash() {
70
+ await clickgo.form.dialog(JSON.stringify(clickgo.form.getHash(parseInt(this.fid))));
82
71
  }
83
- hashBack() {
84
- return __awaiter(this, void 0, void 0, function* () {
85
- yield clickgo.form.dialog(JSON.stringify(yield clickgo.form.hashBack(parseInt(this.fid))));
86
- });
72
+ async hashBack() {
73
+ await clickgo.form.dialog(JSON.stringify(await clickgo.form.hashBack(parseInt(this.fid))));
87
74
  }
88
- tohash() {
89
- return __awaiter(this, void 0, void 0, function* () {
90
- yield clickgo.form.dialog(JSON.stringify(clickgo.form.hash(this.hash, parseInt(this.fid))));
91
- });
75
+ async tohash() {
76
+ await clickgo.form.dialog(JSON.stringify(clickgo.form.hash(this.hash, parseInt(this.fid))));
92
77
  }
93
- getActivePanel() {
94
- return __awaiter(this, void 0, void 0, function* () {
95
- yield clickgo.form.dialog(JSON.stringify(clickgo.form.getActivePanel(parseInt(this.fid))));
96
- });
78
+ async getActivePanel() {
79
+ await clickgo.form.dialog(JSON.stringify(clickgo.form.getActivePanel(parseInt(this.fid))));
97
80
  }
98
- getFocus() {
99
- return __awaiter(this, void 0, void 0, function* () {
100
- const f = clickgo.form.getFocus();
101
- yield clickgo.form.dialog(f ? f.toString() : 'null');
102
- });
81
+ async getFocus() {
82
+ const f = clickgo.form.getFocus();
83
+ await clickgo.form.dialog(f ? f.toString() : 'null');
103
84
  }
104
85
  changeFocus() {
105
86
  clickgo.form.changeFocus(parseInt(this.fid));
@@ -122,65 +103,59 @@ class default_1 extends clickgo.form.AbstractForm {
122
103
  showCircular(e) {
123
104
  clickgo.form.showCircular(e.clientX, e.clientY);
124
105
  }
125
- showRectangle(e) {
126
- return __awaiter(this, void 0, void 0, function* () {
127
- clickgo.form.showRectangle(e.clientX, e.clientY, 'rb');
128
- yield clickgo.tool.sleep(1000);
129
- clickgo.form.hideRectangle();
130
- });
131
- }
132
- showDrag() {
133
- return __awaiter(this, void 0, void 0, function* () {
134
- clickgo.form.showDrag();
135
- const rect = this.refs.showDrag.$el.getBoundingClientRect();
136
- clickgo.form.moveDrag({
137
- 'left': rect.left,
138
- 'top': rect.top,
139
- 'width': rect.width,
140
- 'height': rect.height
106
+ async showRectangle(e) {
107
+ clickgo.form.showRectangle(e.clientX, e.clientY, 'rb');
108
+ await clickgo.tool.sleep(1000);
109
+ clickgo.form.hideRectangle();
110
+ }
111
+ async showDrag() {
112
+ clickgo.form.showDrag();
113
+ const rect = this.refs.showDrag.$el.getBoundingClientRect();
114
+ clickgo.form.moveDrag({
115
+ 'left': rect.left,
116
+ 'top': rect.top,
117
+ 'width': rect.width,
118
+ 'height': rect.height
119
+ });
120
+ await clickgo.tool.sleep(1000);
121
+ clickgo.form.hideDrag();
122
+ }
123
+ async notify() {
124
+ let icon = null;
125
+ if (this.progress[0] === 'progress + icon') {
126
+ icon = await clickgo.fs.getContent('/package/res/icon.svg');
127
+ }
128
+ if (icon instanceof Blob) {
129
+ icon = await clickgo.tool.blob2DataUrl(icon);
130
+ }
131
+ const nid = clickgo.form.notify({
132
+ 'title': this.progress[0] === 'only content' ? undefined : 'Notify',
133
+ 'content': this.progress[0] === 'only title' ? undefined : 'Content',
134
+ 'type': this.type[0],
135
+ 'progress': (this.progress[0] === 'progress + icon') ? true : false,
136
+ 'icon': icon
137
+ });
138
+ if (this.progress[0] === 'progress + icon') {
139
+ clickgo.form.notifyProgress(nid, 12);
140
+ await clickgo.tool.sleep(1000);
141
+ clickgo.form.notifyProgress(nid, 30);
142
+ await clickgo.tool.sleep(300);
143
+ clickgo.form.notifyProgress(nid, 50);
144
+ clickgo.form.notifyContent(nid, {
145
+ 'content': 'loading... (3/4)'
141
146
  });
142
- yield clickgo.tool.sleep(1000);
143
- clickgo.form.hideDrag();
144
- });
145
- }
146
- notify() {
147
- return __awaiter(this, void 0, void 0, function* () {
148
- let icon = null;
149
- if (this.progress[0] === 'progress + icon') {
150
- icon = yield clickgo.fs.getContent('/package/res/icon.svg');
151
- }
152
- if (icon instanceof Blob) {
153
- icon = yield clickgo.tool.blob2DataUrl(icon);
154
- }
155
- const nid = clickgo.form.notify({
156
- 'title': this.progress[0] === 'only content' ? undefined : 'Notify',
157
- 'content': this.progress[0] === 'only title' ? undefined : 'Content',
158
- 'type': this.type[0],
159
- 'progress': (this.progress[0] === 'progress + icon') ? true : false,
160
- 'icon': icon
147
+ await clickgo.tool.sleep(700);
148
+ clickgo.form.notifyProgress(nid, 75);
149
+ clickgo.form.notifyContent(nid, {
150
+ 'content': 'loading... (4/4)'
161
151
  });
162
- if (this.progress[0] === 'progress + icon') {
163
- clickgo.form.notifyProgress(nid, 12);
164
- yield clickgo.tool.sleep(1000);
165
- clickgo.form.notifyProgress(nid, 30);
166
- yield clickgo.tool.sleep(300);
167
- clickgo.form.notifyProgress(nid, 50);
168
- clickgo.form.notifyContent(nid, {
169
- 'content': 'loading... (3/4)'
170
- });
171
- yield clickgo.tool.sleep(700);
172
- clickgo.form.notifyProgress(nid, 75);
173
- clickgo.form.notifyContent(nid, {
174
- 'content': 'loading... (4/4)'
175
- });
176
- yield clickgo.tool.sleep(1000);
177
- clickgo.form.notifyProgress(nid, 100);
178
- clickgo.form.notifyContent(nid, {
179
- 'title': 'Done',
180
- 'content': 'loaded'
181
- });
182
- }
183
- });
152
+ await clickgo.tool.sleep(1000);
153
+ clickgo.form.notifyProgress(nid, 100);
154
+ clickgo.form.notifyContent(nid, {
155
+ 'title': 'Done',
156
+ 'content': 'loaded'
157
+ });
158
+ }
184
159
  }
185
160
  alert() {
186
161
  const aid = clickgo.form.alert(this.atype[0], this.atype[0]);
@@ -192,83 +167,65 @@ class default_1 extends clickgo.form.AbstractForm {
192
167
  }
193
168
  clickgo.form.showPop(e.currentTarget, this.refs.pop, 'v');
194
169
  }
195
- create() {
196
- return __awaiter(this, void 0, void 0, function* () {
197
- const frm = yield clickgo.form.create('test', undefined, {
198
- 'path': this.filename
199
- });
200
- frm.show();
201
- });
202
- }
203
- dialog() {
204
- return __awaiter(this, void 0, void 0, function* () {
205
- this.dr = yield clickgo.form.dialog('Hello world!');
170
+ async create() {
171
+ const frm = await clickgo.form.create('test', undefined, {
172
+ 'path': this.filename
206
173
  });
174
+ frm.show();
207
175
  }
208
- dialogLong() {
209
- return __awaiter(this, void 0, void 0, function* () {
210
- this.dr = yield clickgo.form.dialog('longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong');
211
- });
176
+ async dialog() {
177
+ this.dr = await clickgo.form.dialog('Hello world!');
212
178
  }
213
- dialogTitle() {
214
- return __awaiter(this, void 0, void 0, function* () {
215
- this.dr = yield clickgo.form.dialog({
216
- 'title': 'Title',
217
- 'content': 'Hello world!'
218
- });
219
- });
179
+ async dialogLong() {
180
+ this.dr = await clickgo.form.dialog('longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong');
220
181
  }
221
- dialogButtons() {
222
- return __awaiter(this, void 0, void 0, function* () {
223
- this.dr = yield clickgo.form.dialog({
224
- 'content': 'Hello world!',
225
- 'buttons': ['A', 'B', 'C']
226
- });
182
+ async dialogTitle() {
183
+ this.dr = await clickgo.form.dialog({
184
+ 'title': 'Title',
185
+ 'content': 'Hello world!'
227
186
  });
228
187
  }
229
- dialogCannot() {
230
- return __awaiter(this, void 0, void 0, function* () {
231
- this.dr = yield clickgo.form.dialog({
232
- 'content': 'Hello world!',
233
- 'buttons': ['Do not close', 'Close'],
234
- 'select': (e, button) => {
235
- if (button === 'Do not close') {
236
- e.preventDefault();
237
- }
238
- }
239
- });
188
+ async dialogButtons() {
189
+ this.dr = await clickgo.form.dialog({
190
+ 'content': 'Hello world!',
191
+ 'buttons': ['A', 'B', 'C']
240
192
  });
241
193
  }
242
- dialogData() {
243
- return __awaiter(this, void 0, void 0, function* () {
244
- this.dr = yield clickgo.form.dialog({
245
- 'direction': 'v',
246
- 'gutter': 10,
247
- 'content': '<block>Hello text!</block><text :modelValue="data.txt" />',
248
- 'data': {
249
- 'txt': 'Text\nLine 2.'
194
+ async dialogCannot() {
195
+ this.dr = await clickgo.form.dialog({
196
+ 'content': 'Hello world!',
197
+ 'buttons': ['Do not close', 'Close'],
198
+ 'select': (e, button) => {
199
+ if (button === 'Do not close') {
200
+ e.preventDefault();
250
201
  }
251
- });
202
+ }
252
203
  });
253
204
  }
254
- confirm(cancel) {
255
- return __awaiter(this, void 0, void 0, function* () {
256
- this.dr = yield clickgo.form.confirm({
257
- 'content': 'Hello world?',
258
- 'cancel': cancel
259
- });
260
- if (typeof this.dr === 'boolean') {
261
- this.dr = this.dr ? 'true (boolean)' : 'false (boolean)';
262
- }
263
- else {
264
- this.dr = this.dr.toString() + ' (number)';
205
+ async dialogData() {
206
+ this.dr = await clickgo.form.dialog({
207
+ 'direction': 'v',
208
+ 'gutter': 10,
209
+ 'content': '<block>Hello text!</block><text :modelValue="data.txt" />',
210
+ 'data': {
211
+ 'txt': 'Text\nLine 2.'
265
212
  }
266
213
  });
267
214
  }
268
- prompt() {
269
- return __awaiter(this, void 0, void 0, function* () {
270
- this.dr = yield clickgo.form.prompt('test');
215
+ async confirm(cancel) {
216
+ this.dr = await clickgo.form.confirm({
217
+ 'content': 'Hello world?',
218
+ 'cancel': cancel
271
219
  });
220
+ if (typeof this.dr === 'boolean') {
221
+ this.dr = this.dr ? 'true (boolean)' : 'false (boolean)';
222
+ }
223
+ else {
224
+ this.dr = this.dr.toString() + ' (number)';
225
+ }
226
+ }
227
+ async prompt() {
228
+ this.dr = await clickgo.form.prompt('test');
272
229
  }
273
230
  flash() {
274
231
  clickgo.form.flash(this.formId);
@@ -32,15 +32,6 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
45
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
46
37
  };
@@ -55,176 +46,164 @@ class default_1 extends clickgo.form.AbstractForm {
55
46
  this.val = [];
56
47
  this.get = false;
57
48
  }
58
- open(path) {
59
- return __awaiter(this, void 0, void 0, function* () {
60
- if (!path.endsWith('/')) {
61
- path += '/';
62
- }
63
- this.list = [];
64
- const ls = yield clickgo.fs.readDir(path);
65
- for (const item of ls) {
66
- this.list.push({
67
- 'label': (item.isDirectory() ? '[FOLD]' : (item.isSymbolicLink() ? '[SYMB]' : '[FILE]')) + ' ' + item.name,
68
- 'value': path + item.name
69
- });
70
- }
71
- this.ppath = path;
72
- });
49
+ async open(path) {
50
+ if (!path.endsWith('/')) {
51
+ path += '/';
52
+ }
53
+ this.list = [];
54
+ const ls = await clickgo.fs.readDir(path);
55
+ for (const item of ls) {
56
+ this.list.push({
57
+ 'label': (item.isDirectory() ? '[FOLD]' : (item.isSymbolicLink() ? '[SYMB]' : '[FILE]')) + ' ' + item.name,
58
+ 'value': path + item.name
59
+ });
60
+ }
61
+ this.ppath = path;
73
62
  }
74
- stats() {
75
- return __awaiter(this, void 0, void 0, function* () {
76
- const stats = yield clickgo.fs.stats(this.val[0]);
77
- yield clickgo.form.dialog(stats ? JSON.stringify(stats) : 'null');
78
- });
63
+ async stats() {
64
+ const stats = await clickgo.fs.stats(this.val[0]);
65
+ await clickgo.form.dialog(stats ? JSON.stringify(stats) : 'null');
79
66
  }
80
67
  dblclick(e) {
81
- clickgo.dom.bindDblClick(e, () => __awaiter(this, void 0, void 0, function* () {
82
- const r = yield clickgo.fs.isFile(this.val[0]);
68
+ clickgo.dom.bindDblClick(e, async () => {
69
+ const r = await clickgo.fs.isFile(this.val[0]);
83
70
  if (r) {
84
71
  const extlio = this.val[0].lastIndexOf('.');
85
72
  if (extlio === -1) {
86
- yield clickgo.form.dialog('This extension is not supported.');
73
+ await clickgo.form.dialog('This extension is not supported.');
87
74
  return;
88
75
  }
89
76
  const ext = this.val[0].toLowerCase().slice(extlio + 1);
90
77
  if (['xml', 'js', 'ts', 'json', 'css', 'html', 'php', 'txt'].includes(ext)) {
91
- let content = yield clickgo.fs.getContent(this.val[0], this.get ? {
78
+ let content = await clickgo.fs.getContent(this.val[0], this.get ? {
92
79
  'start': 2,
93
80
  'end': 4
94
81
  } : undefined);
95
82
  if (!content) {
96
- yield clickgo.form.dialog('This file cannot be opened.');
83
+ await clickgo.form.dialog('This file cannot be opened.');
97
84
  return;
98
85
  }
99
86
  if (content instanceof Blob) {
100
- content = yield clickgo.tool.blob2Text(content);
87
+ content = await clickgo.tool.blob2Text(content);
101
88
  }
102
- const f = yield clickgo.form.create(text_1.default, {
89
+ const f = await clickgo.form.create(text_1.default, {
103
90
  'title': this.val[0].slice(this.val[0].lastIndexOf('/') + 1),
104
91
  'content': content
105
92
  });
106
93
  f.show();
107
94
  return;
108
95
  }
109
- yield clickgo.form.dialog('The extension "' + ext + '" is not supported.');
96
+ await clickgo.form.dialog('The extension "' + ext + '" is not supported.');
110
97
  return;
111
98
  }
112
- yield this.open(this.val[0]);
113
- }));
114
- }
115
- up() {
116
- return __awaiter(this, void 0, void 0, function* () {
117
- if (this.ppath === '/') {
118
- return;
119
- }
120
- const path = this.ppath.slice(0, -1);
121
- const lif = path.lastIndexOf('/');
122
- const npath = path.slice(0, lif + 1);
123
- yield this.open(npath);
99
+ await this.open(this.val[0]);
124
100
  });
125
101
  }
126
- mount() {
127
- return __awaiter(this, void 0, void 0, function* () {
128
- yield clickgo.form.dialog(clickgo.fs.mount('test', {
129
- readDir: (path) => {
130
- const list = [];
131
- switch (path) {
132
- case '/': {
133
- list.push({
134
- isFile: function () {
135
- return false;
136
- },
137
- isDirectory: function () {
138
- return true;
139
- },
140
- isSymbolicLink: function () {
141
- return false;
142
- },
143
- 'name': 'test1'
144
- });
145
- list.push({
146
- isFile: function () {
147
- return false;
148
- },
149
- isDirectory: function () {
150
- return true;
151
- },
152
- isSymbolicLink: function () {
153
- return false;
154
- },
155
- 'name': 'test2'
156
- });
157
- break;
158
- }
159
- case '/test2/': {
160
- list.push({
161
- isFile: function () {
162
- return true;
163
- },
164
- isDirectory: function () {
165
- return false;
166
- },
167
- isSymbolicLink: function () {
168
- return false;
169
- },
170
- 'name': 'test.txt'
171
- });
172
- break;
173
- }
174
- }
175
- return list;
176
- },
177
- stats: (path) => {
178
- if (path !== '/test2/test.txt') {
179
- return null;
180
- }
181
- const date = new Date();
182
- const ms = date.getTime();
183
- const size = 7;
184
- return {
185
- isFile: function () {
186
- return true;
187
- },
188
- isDirectory: function () {
189
- return false;
190
- },
191
- isSymbolicLink: function () {
192
- return false;
193
- },
194
- 'size': size,
195
- 'blksize': size,
196
- 'atimeMs': ms,
197
- 'mtimeMs': ms,
198
- 'ctimeMs': ms,
199
- 'birthtimeMs': ms,
200
- 'atime': date,
201
- 'mtime': date,
202
- 'ctime': date,
203
- 'birthtime': date
204
- };
205
- },
206
- getContent: (path, options) => {
207
- if (path !== '/test2/test.txt') {
208
- return null;
102
+ async up() {
103
+ if (this.ppath === '/') {
104
+ return;
105
+ }
106
+ const path = this.ppath.slice(0, -1);
107
+ const lif = path.lastIndexOf('/');
108
+ const npath = path.slice(0, lif + 1);
109
+ await this.open(npath);
110
+ }
111
+ async mount() {
112
+ await clickgo.form.dialog(clickgo.fs.mount('test', {
113
+ readDir: (path) => {
114
+ const list = [];
115
+ switch (path) {
116
+ case '/': {
117
+ list.push({
118
+ isFile: function () {
119
+ return false;
120
+ },
121
+ isDirectory: function () {
122
+ return true;
123
+ },
124
+ isSymbolicLink: function () {
125
+ return false;
126
+ },
127
+ 'name': 'test1'
128
+ });
129
+ list.push({
130
+ isFile: function () {
131
+ return false;
132
+ },
133
+ isDirectory: function () {
134
+ return true;
135
+ },
136
+ isSymbolicLink: function () {
137
+ return false;
138
+ },
139
+ 'name': 'test2'
140
+ });
141
+ break;
209
142
  }
210
- const content = 'testabc';
211
- if (!options || typeof options === 'string') {
212
- return content;
143
+ case '/test2/': {
144
+ list.push({
145
+ isFile: function () {
146
+ return true;
147
+ },
148
+ isDirectory: function () {
149
+ return false;
150
+ },
151
+ isSymbolicLink: function () {
152
+ return false;
153
+ },
154
+ 'name': 'test.txt'
155
+ });
156
+ break;
213
157
  }
214
- return content.slice(options.start, options.end);
215
- },
216
- }) ? 'true' : 'fasle');
217
- });
158
+ }
159
+ return list;
160
+ },
161
+ stats: (path) => {
162
+ if (path !== '/test2/test.txt') {
163
+ return null;
164
+ }
165
+ const date = new Date();
166
+ const ms = date.getTime();
167
+ const size = 7;
168
+ return {
169
+ isFile: function () {
170
+ return true;
171
+ },
172
+ isDirectory: function () {
173
+ return false;
174
+ },
175
+ isSymbolicLink: function () {
176
+ return false;
177
+ },
178
+ 'size': size,
179
+ 'blksize': size,
180
+ 'atimeMs': ms,
181
+ 'mtimeMs': ms,
182
+ 'ctimeMs': ms,
183
+ 'birthtimeMs': ms,
184
+ 'atime': date,
185
+ 'mtime': date,
186
+ 'ctime': date,
187
+ 'birthtime': date
188
+ };
189
+ },
190
+ getContent: (path, options) => {
191
+ if (path !== '/test2/test.txt') {
192
+ return null;
193
+ }
194
+ const content = 'testabc';
195
+ if (!options || typeof options === 'string') {
196
+ return content;
197
+ }
198
+ return content.slice(options.start, options.end);
199
+ },
200
+ }) ? 'true' : 'fasle');
218
201
  }
219
- unmount() {
220
- return __awaiter(this, void 0, void 0, function* () {
221
- yield clickgo.form.dialog((yield clickgo.fs.unmount('test')) ? 'true' : 'false');
222
- });
202
+ async unmount() {
203
+ await clickgo.form.dialog(await clickgo.fs.unmount('test') ? 'true' : 'false');
223
204
  }
224
- onMounted() {
225
- return __awaiter(this, void 0, void 0, function* () {
226
- yield this.open('/');
227
- });
205
+ async onMounted() {
206
+ await this.open('/');
228
207
  }
229
208
  }
230
209
  exports.default = default_1;