clickgo 3.0.0-dev

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 (145) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +75 -0
  3. package/dist/app/demo/config.json +106 -0
  4. package/dist/app/demo/form/control/block/block.css +1 -0
  5. package/dist/app/demo/form/control/block/block.scss +17 -0
  6. package/dist/app/demo/form/control/block/block.xml +7 -0
  7. package/dist/app/demo/form/control/button/button.css +1 -0
  8. package/dist/app/demo/form/control/button/button.js +27 -0
  9. package/dist/app/demo/form/control/button/button.scss +18 -0
  10. package/dist/app/demo/form/control/button/button.xml +126 -0
  11. package/dist/app/demo/form/control/check/check.js +12 -0
  12. package/dist/app/demo/form/control/check/check.xml +13 -0
  13. package/dist/app/demo/form/control/dialog/dialog.js +8 -0
  14. package/dist/app/demo/form/control/dialog/dialog.xml +26 -0
  15. package/dist/app/demo/form/control/file/file.js +23 -0
  16. package/dist/app/demo/form/control/file/file.xml +25 -0
  17. package/dist/app/demo/form/control/form/form.css +1 -0
  18. package/dist/app/demo/form/control/form/form.js +38 -0
  19. package/dist/app/demo/form/control/form/form.scss +9 -0
  20. package/dist/app/demo/form/control/form/form.xml +28 -0
  21. package/dist/app/demo/form/control/greatview/greatview.css +1 -0
  22. package/dist/app/demo/form/control/greatview/greatview.js +92 -0
  23. package/dist/app/demo/form/control/greatview/greatview.scss +22 -0
  24. package/dist/app/demo/form/control/greatview/greatview.xml +89 -0
  25. package/dist/app/demo/form/control/img/img.xml +16 -0
  26. package/dist/app/demo/form/control/label/label.xml +11 -0
  27. package/dist/app/demo/form/control/list/list.css +1 -0
  28. package/dist/app/demo/form/control/list/list.js +194 -0
  29. package/dist/app/demo/form/control/list/list.scss +7 -0
  30. package/dist/app/demo/form/control/list/list.xml +91 -0
  31. package/dist/app/demo/form/control/loading/loading.xml +8 -0
  32. package/dist/app/demo/form/control/marquee/marquee.js +30 -0
  33. package/dist/app/demo/form/control/marquee/marquee.xml +36 -0
  34. package/dist/app/demo/form/control/menu/menu.js +8 -0
  35. package/dist/app/demo/form/control/menu/menu.xml +122 -0
  36. package/dist/app/demo/form/control/monaco/monaco.js +113 -0
  37. package/dist/app/demo/form/control/monaco/monaco.xml +27 -0
  38. package/dist/app/demo/form/control/overflow/overflow.css +1 -0
  39. package/dist/app/demo/form/control/overflow/overflow.js +70 -0
  40. package/dist/app/demo/form/control/overflow/overflow.scss +18 -0
  41. package/dist/app/demo/form/control/overflow/overflow.xml +98 -0
  42. package/dist/app/demo/form/control/property/property.js +129 -0
  43. package/dist/app/demo/form/control/property/property.xml +6 -0
  44. package/dist/app/demo/form/control/radio/radio.js +7 -0
  45. package/dist/app/demo/form/control/radio/radio.xml +12 -0
  46. package/dist/app/demo/form/control/scroll/scroll.js +14 -0
  47. package/dist/app/demo/form/control/scroll/scroll.xml +35 -0
  48. package/dist/app/demo/form/control/select/select.js +91 -0
  49. package/dist/app/demo/form/control/select/select.xml +74 -0
  50. package/dist/app/demo/form/control/tab/tab.js +75 -0
  51. package/dist/app/demo/form/control/tab/tab.xml +22 -0
  52. package/dist/app/demo/form/control/text/text.js +53 -0
  53. package/dist/app/demo/form/control/text/text.xml +37 -0
  54. package/dist/app/demo/form/control/view/view.css +1 -0
  55. package/dist/app/demo/form/control/view/view.js +73 -0
  56. package/dist/app/demo/form/control/view/view.scss +18 -0
  57. package/dist/app/demo/form/control/view/view.xml +94 -0
  58. package/dist/app/demo/form/event/form/form.css +1 -0
  59. package/dist/app/demo/form/event/form/form.js +129 -0
  60. package/dist/app/demo/form/event/form/form.scss +24 -0
  61. package/dist/app/demo/form/event/form/form.xml +16 -0
  62. package/dist/app/demo/form/event/screen/screen.js +51 -0
  63. package/dist/app/demo/form/event/screen/screen.xml +9 -0
  64. package/dist/app/demo/form/event/task/task.js +78 -0
  65. package/dist/app/demo/form/event/task/task.xml +20 -0
  66. package/dist/app/demo/form/main.css +1 -0
  67. package/dist/app/demo/form/main.js +25 -0
  68. package/dist/app/demo/form/main.scss +9 -0
  69. package/dist/app/demo/form/main.xml +49 -0
  70. package/dist/app/demo/form/method/core/core.js +25 -0
  71. package/dist/app/demo/form/method/core/core.xml +7 -0
  72. package/dist/app/demo/form/method/dom/dom.css +1 -0
  73. package/dist/app/demo/form/method/dom/dom.js +163 -0
  74. package/dist/app/demo/form/method/dom/dom.scss +10 -0
  75. package/dist/app/demo/form/method/dom/dom.xml +55 -0
  76. package/dist/app/demo/form/method/form/form.css +1 -0
  77. package/dist/app/demo/form/method/form/form.js +217 -0
  78. package/dist/app/demo/form/method/form/form.scss +3 -0
  79. package/dist/app/demo/form/method/form/form.xml +56 -0
  80. package/dist/app/demo/form/method/form/test.xml +5 -0
  81. package/dist/app/demo/form/method/fs/fs.js +88 -0
  82. package/dist/app/demo/form/method/fs/fs.xml +8 -0
  83. package/dist/app/demo/form/method/fs/text.js +15 -0
  84. package/dist/app/demo/form/method/fs/text.xml +3 -0
  85. package/dist/app/demo/form/method/task/locale1.json +3 -0
  86. package/dist/app/demo/form/method/task/locale2.json +3 -0
  87. package/dist/app/demo/form/method/task/task.js +153 -0
  88. package/dist/app/demo/form/method/task/task.xml +57 -0
  89. package/dist/app/demo/form/method/theme/theme.js +74 -0
  90. package/dist/app/demo/form/method/theme/theme.xml +9 -0
  91. package/dist/app/demo/form/method/tool/tool.js +64 -0
  92. package/dist/app/demo/form/method/tool/tool.xml +26 -0
  93. package/dist/app/demo/form/method/zip/zip.js +99 -0
  94. package/dist/app/demo/form/method/zip/zip.xml +12 -0
  95. package/dist/app/demo/global.css +3 -0
  96. package/dist/app/demo/res/icon.svg +1 -0
  97. package/dist/app/demo/res/img.jpg +0 -0
  98. package/dist/app/demo/res/r-1.svg +1 -0
  99. package/dist/app/demo/res/r-2.svg +1 -0
  100. package/dist/app/demo/res/sql.svg +1 -0
  101. package/dist/app/demo/res/txt.svg +1 -0
  102. package/dist/app/demo/res/zip.svg +1 -0
  103. package/dist/app/task/config.json +29 -0
  104. package/dist/app/task/form/bar/bar.js +299 -0
  105. package/dist/app/task/form/bar/bar.xml +47 -0
  106. package/dist/app/task/form/desktop/desktop.xml +1 -0
  107. package/dist/app/task/locale/en.json +11 -0
  108. package/dist/app/task/locale/ja.json +11 -0
  109. package/dist/app/task/locale/sc.json +11 -0
  110. package/dist/app/task/locale/tc.json +11 -0
  111. package/dist/clickgo.js +41 -0
  112. package/dist/clickgo.ts +51 -0
  113. package/dist/control/common.cgc +0 -0
  114. package/dist/control/form.cgc +0 -0
  115. package/dist/control/monaco.cgc +0 -0
  116. package/dist/control/property.cgc +0 -0
  117. package/dist/control/task.cgc +0 -0
  118. package/dist/global.css +1 -0
  119. package/dist/icon.png +0 -0
  120. package/dist/index.js +88 -0
  121. package/dist/index.ts +92 -0
  122. package/dist/lib/control.js +365 -0
  123. package/dist/lib/control.ts +428 -0
  124. package/dist/lib/core.js +668 -0
  125. package/dist/lib/core.ts +732 -0
  126. package/dist/lib/dom.js +1471 -0
  127. package/dist/lib/dom.ts +1785 -0
  128. package/dist/lib/form.js +2101 -0
  129. package/dist/lib/form.ts +2496 -0
  130. package/dist/lib/fs.js +849 -0
  131. package/dist/lib/fs.ts +995 -0
  132. package/dist/lib/native.js +138 -0
  133. package/dist/lib/native.ts +219 -0
  134. package/dist/lib/task.js +686 -0
  135. package/dist/lib/task.ts +842 -0
  136. package/dist/lib/theme.js +159 -0
  137. package/dist/lib/theme.ts +196 -0
  138. package/dist/lib/tool.js +501 -0
  139. package/dist/lib/tool.ts +620 -0
  140. package/dist/lib/zip.js +352 -0
  141. package/dist/lib/zip.ts +434 -0
  142. package/dist/theme/familiar.cgt +0 -0
  143. package/package.json +27 -0
  144. package/types/dev.d.ts +30 -0
  145. package/types/index.d.ts +673 -0
@@ -0,0 +1,163 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.mounted = exports.methods = exports.computed = exports.data = void 0;
13
+ const clickgo = require("clickgo");
14
+ exports.data = {
15
+ 'watchSizeText': false,
16
+ 'watchSizeHeight': true,
17
+ 'watchText': false,
18
+ 'watchInner': true,
19
+ 'watchStyleChange': true,
20
+ 'bindGestureText': '',
21
+ 'bindGestureWheelText': '',
22
+ 'bindLongText': false,
23
+ 'moveLeft': 0,
24
+ 'moveTop': 0,
25
+ 'moveWidth': 25,
26
+ 'moveHeight': 25,
27
+ };
28
+ exports.computed = {
29
+ 'isMove': function () {
30
+ return clickgo.dom.is.move;
31
+ },
32
+ 'isShift': function () {
33
+ return clickgo.dom.is.shift;
34
+ },
35
+ 'isCtrl': function () {
36
+ return clickgo.dom.is.ctrl;
37
+ }
38
+ };
39
+ exports.methods = {
40
+ setGlobalCursor: function (type) {
41
+ clickgo.dom.setGlobalCursor(type);
42
+ },
43
+ hasTouchButMouse: function (e) {
44
+ clickgo.form.dialog(clickgo.dom.hasTouchButMouse(e) ? 'true' : 'false').catch((e) => { throw e; });
45
+ },
46
+ getStyleCount: function () {
47
+ clickgo.form.dialog(clickgo.dom.getStyleCount(this.taskId, 'form').toString()).catch((e) => { throw e; });
48
+ },
49
+ getSize: function () {
50
+ clickgo.form.dialog(JSON.stringify(clickgo.dom.getSize(this.$refs.getSize.$el))).catch((e) => { throw e; });
51
+ },
52
+ watchSize: function () {
53
+ this.watchSizeText = !this.watchSizeText;
54
+ if (this.watchSizeText) {
55
+ clickgo.dom.watchSize(this.$refs.watchSize.$el, (size) => {
56
+ clickgo.form.dialog(JSON.stringify(size)).catch((e) => { throw e; });
57
+ });
58
+ }
59
+ else {
60
+ clickgo.dom.unwatchSize(this.$refs.watchSize.$el);
61
+ }
62
+ },
63
+ watch: function () {
64
+ this.watchText = !this.watchText;
65
+ if (this.watchText) {
66
+ clickgo.dom.watch(this.$refs.watch.$el, () => {
67
+ clickgo.form.dialog('Changed.').catch((e) => { throw e; });
68
+ });
69
+ }
70
+ else {
71
+ clickgo.dom.unwatch(this.$refs.watch.$el);
72
+ }
73
+ },
74
+ isWatchStyle: function () {
75
+ clickgo.form.dialog(clickgo.dom.isWatchStyle(this.$refs.watchStyle.$el) ? 'true' : 'false').catch((e) => { throw e; });
76
+ },
77
+ bindGesture: function (e) {
78
+ clickgo.dom.bindGesture(e, {
79
+ 'dirs': ['top', 'bottom'],
80
+ handler: (dir) => {
81
+ this.bindGestureText = dir.slice(0, 1).toUpperCase() + dir.slice(1);
82
+ const handler = () => __awaiter(this, void 0, void 0, function* () {
83
+ yield clickgo.tool.sleep(500);
84
+ this.bindGestureText = '';
85
+ });
86
+ handler().catch((e) => {
87
+ console.log(e);
88
+ });
89
+ }
90
+ });
91
+ },
92
+ bindGestureWheel: function (e) {
93
+ clickgo.dom.bindGesture(e, {
94
+ 'dirs': ['top', 'bottom', 'left', 'right'],
95
+ handler: (dir) => {
96
+ this.bindGestureWheelText = dir.slice(0, 1).toUpperCase() + dir.slice(1);
97
+ const handler = () => __awaiter(this, void 0, void 0, function* () {
98
+ yield clickgo.tool.sleep(500);
99
+ this.bindGestureWheelText = '';
100
+ });
101
+ handler().catch((e) => {
102
+ console.log(e);
103
+ });
104
+ }
105
+ });
106
+ },
107
+ bindLong: function () {
108
+ clickgo.form.dialog('Press and hold this button.').catch((e) => { throw e; });
109
+ },
110
+ bindLongDown: function (e) {
111
+ clickgo.dom.bindLong(e, () => __awaiter(this, void 0, void 0, function* () {
112
+ this.bindLongText = true;
113
+ yield clickgo.tool.sleep(500);
114
+ this.bindLongText = false;
115
+ }));
116
+ },
117
+ bindDragDown: function (e) {
118
+ clickgo.dom.bindDrag(e, {
119
+ 'el': this.$refs.bindDrag,
120
+ 'data': 'bindDragDownTest'
121
+ });
122
+ },
123
+ dragEnter: function (e) {
124
+ return __awaiter(this, void 0, void 0, function* () {
125
+ e.target.innerText = 'enter';
126
+ yield clickgo.tool.sleep(200);
127
+ e.target.innerText = '';
128
+ });
129
+ },
130
+ dragLeave: function (e) {
131
+ return __awaiter(this, void 0, void 0, function* () {
132
+ e.target.innerText = 'leave';
133
+ yield clickgo.tool.sleep(200);
134
+ e.target.innerText = '';
135
+ });
136
+ },
137
+ drop: function (e) {
138
+ return __awaiter(this, void 0, void 0, function* () {
139
+ e.target.innerText = 'drop';
140
+ yield clickgo.tool.sleep(500);
141
+ e.target.innerText = '';
142
+ });
143
+ },
144
+ bindMoveDown: function (e) {
145
+ clickgo.dom.bindMove(e, {
146
+ 'areaObject': e.currentTarget,
147
+ 'object': this.$refs.move,
148
+ move: (ox, oy) => {
149
+ this.moveLeft += ox;
150
+ this.moveTop += oy;
151
+ }
152
+ });
153
+ },
154
+ fullscreen: function () {
155
+ clickgo.dom.fullscreen();
156
+ }
157
+ };
158
+ const mounted = function () {
159
+ clickgo.dom.watchStyle(this.$refs.watchStyle.$el, 'font-size', (n, v) => {
160
+ clickgo.form.dialog('name: ' + n + ', value: ' + v).catch((e) => { throw e; });
161
+ });
162
+ };
163
+ exports.mounted = mounted;
@@ -0,0 +1,10 @@
1
+ .dropLine {
2
+ display: flex; flex: 1; margin-bottom: 5px;
3
+
4
+ > block {
5
+ border: 1px solid rgba(0, 0, 0, 0.3); background-color: #FFF; flex: 1; margin-right: 5px; display: flex; justify-content: center; align-items: center;
6
+ &[data-cg-hover] {
7
+ background-color: #333; color: #FFF;
8
+ }
9
+ }
10
+ }
@@ -0,0 +1,55 @@
1
+ <form width="400" height="450" title="Library dom" padding="10">
2
+ <overflow direction="v" style="flex: 1;">
3
+ <layout gutter="10" direction="v" style="flex: 1;">
4
+ <button @click="setGlobalCursor('wait')" style="height: 30px;">setGlobalCursor('wait')</button>
5
+ <button @click="setGlobalCursor" style="height: 30px;">setGlobalCursor()</button>
6
+ <button @click="hasTouchButMouse" style="height: 30px;">hasTouchButMouse()</button>
7
+ <button @click="getStyleCount" style="height: 30px;">getStyleCount({{taskId}}, 'form')</button>
8
+ <button @click="getSize" ref="getSize" style="height: 30px;">getSize(this.$refs.getSize)</button>
9
+ <layout gutter="10">
10
+ <button @click="watchSize" ref="watchSize" :style="{'height': (watchSizeHeight ? 30 : 50) + 'px'}" style="padding: 0 5px; flex: 1;">{{watchSizeText ? '' : '!'}}watchSize</button>
11
+ <button @click="watchSizeHeight = !watchSizeHeight" style="padding: 0 5px; flex: 1;">Change</button>
12
+ </layout>
13
+ <layout gutter="10">
14
+ <layout ref="watch" align-v="center" align-h="center" style="flex: 1; background: #FFF;">{{watchInner ? 'inner' : 'Inner'}}</layout>
15
+ <button @click="watch" style="height: 30px; padding: 0 5px;">{{watchText ? '' : '!'}}watch</button>
16
+ <button @click="watchInner = !watchInner" style="padding: 0 5px;">Change</button>
17
+ </layout>
18
+ <button @click="watchStyleChange = !watchStyleChange" ref="watchStyle" style="height: 30px;" :style="{'font-size': watchStyleChange ? 'inherit' : '16px'}">watchStyle(this.$refs.watchStyle.$el, 'font-size', (n, v) => { ... })</button>
19
+ <button @click="isWatchStyle" style="height: 30px;">isWatchStyle(this.$refs.watchStyle.$el)</button>
20
+ <block @mousedown="bindGesture" @touchstart="bindGesture" style="height: 50px; background: #FFF; display: flex; justify-content: center; align-items: center; color: rgba(0, 0, 0, .5); font-size: 14px;">{{bindGestureText ? bindGestureText : 'bindGesture(e: Touch | Mouse, { ... })'}}</block>
21
+ <block @wheel="bindGestureWheel" style="height: 50px; background: #FFF; display: flex; justify-content: center; align-items: center; color: rgba(0, 0, 0, .5); font-size: 14px;">{{bindGestureWheelText ? bindGestureWheelText : 'bindGesture(e: Wheel, { ... })'}}</block>
22
+ <button @click="bindLong" ref="bindLong" @mousedown="bindLongDown" @touchstart="bindLongDown" style="height: 30px;">{{bindLongText ? 'Yeah!' : 'bindLong(e, () => { ... })'}}</button>
23
+ <block style="height: 100px; display: flex; background: #FFF;">
24
+ <block style="flex: 1; display: flex; justify-content: center; align-items: center;">
25
+ <block @mousedown="bindDragDown" @touchstart="bindDragDown" ref="bindDrag" style="border: 1px solid rgba(0, 0, 0, 0.3); width: 50px; height: 50px; display: flex; justify-content: center; align-items: center;">Drag</block>
26
+ </block>
27
+ <block style="margin-left: 10px; flex: 1; display: flex; flex-direction: column; padding: 5px 0 0 5px;">
28
+ <block class="dropLine">
29
+ <block data-cg-drop @dragenter="dragEnter" @dragleave="dragLeave" @drop="drop"></block>
30
+ <block data-cg-drop @dragenter="dragEnter" @dragleave="dragLeave" @drop="drop"></block>
31
+ <block data-cg-drop @dragenter="dragEnter" @dragleave="dragLeave" @drop="drop"></block>
32
+ </block>
33
+ <block class="dropLine">
34
+ <block data-cg-drop @dragenter="dragEnter" @dragleave="dragLeave" @drop="drop"></block>
35
+ <block data-cg-drop @dragenter="dragEnter" @dragleave="dragLeave" @drop="drop"></block>
36
+ <block data-cg-drop @dragenter="dragEnter" @dragleave="dragLeave" @drop="drop"></block>
37
+ </block>
38
+ <block class="dropLine">
39
+ <block data-cg-drop @dragenter="dragEnter" @dragleave="dragLeave" @drop="drop"></block>
40
+ <block data-cg-drop @dragenter="dragEnter" @dragleave="dragLeave" @drop="drop"></block>
41
+ <block data-cg-drop @dragenter="dragEnter" @dragleave="dragLeave" @drop="drop"></block>
42
+ </block>
43
+ </block>
44
+ </block>
45
+ <block @mousedown="bindMoveDown" @touchstart="bindMoveDown" style="height: 50px; background: #FFF; display: flex; justify-content: center; align-items: center; color: rgba(0, 0, 0, .5); font-size: 14px; position: relative;">
46
+ <label>bindMove(e, { ... })</label>
47
+ <block ref="move" style="background: #07c160; position: absolute;" :style="{'left': moveLeft + 'px', 'top': moveTop + 'px', 'width': moveWidth + 'px', 'height': moveHeight + 'px'}" @dblclick="moveWidth = moveWidth === 25 ? 50 : 25;moveHeight = moveHeight === 25 ? 50 : 25"></block>
48
+ </block>
49
+ <button @click="fullscreen" style="height: 30px;">fullscreen()</button>
50
+ <label>clickgo.form.is.move: {{isMove ? 'true' : 'false'}}</label>
51
+ <label>clickgo.form.is.shift: {{isShift ? 'true' : 'false'}}</label>
52
+ <label>clickgo.form.is.ctrl: {{isCtrl ? 'true' : 'false'}}</label>
53
+ </layout>
54
+ </overflow>
55
+ </form>
@@ -0,0 +1 @@
1
+ button{height:30px}
@@ -0,0 +1,217 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.mounted = exports.receive = exports.methods = exports.data = void 0;
13
+ const clickgo = require("clickgo");
14
+ exports.data = {
15
+ 'fid': '0',
16
+ 'sendValue': 'sendValue',
17
+ 'tid': '0',
18
+ 'type': 'primary',
19
+ 'progress': 'noraml',
20
+ 'dialogResult': '',
21
+ 'setTopMostValue': false
22
+ };
23
+ exports.methods = {
24
+ min: function () {
25
+ clickgo.form.min();
26
+ },
27
+ max: function () {
28
+ clickgo.form.max();
29
+ },
30
+ close: function () {
31
+ clickgo.form.close();
32
+ },
33
+ bindResize: function (e) {
34
+ clickgo.form.bindResize(e, 'rb');
35
+ },
36
+ bindDrag: function (e) {
37
+ clickgo.form.bindDrag(e);
38
+ },
39
+ getTaskId: function () {
40
+ clickgo.form.dialog(clickgo.form.getTaskId(parseInt(this.fid)).toString()).catch((e) => { throw e; });
41
+ },
42
+ get: function () {
43
+ clickgo.form.dialog(JSON.stringify(clickgo.form.get(parseInt(this.fid)))).catch((e) => { throw e; });
44
+ },
45
+ send: function () {
46
+ clickgo.form.send(parseInt(this.fid), {
47
+ 'key': this.sendValue
48
+ });
49
+ },
50
+ changeFocus: function () {
51
+ clickgo.form.changeFocus(parseInt(this.fid));
52
+ },
53
+ getList: function () {
54
+ let str = JSON.stringify(clickgo.form.getList(this.taskId));
55
+ str = str.replace(/"icon":"(.*?)"/g, function (t, t1) {
56
+ return `"icon":"${t1 ? (t1.slice(0, 10) + '...') : t1}"`;
57
+ });
58
+ clickgo.form.dialog(`<overflow direction="v" style="width: 200px; height: 80px;">${str}</overflow>`).catch((e) => { throw e; });
59
+ },
60
+ getMaxZIndexID: function () {
61
+ const fid = clickgo.form.getMaxZIndexID();
62
+ clickgo.form.dialog(JSON.stringify(fid)).catch((e) => { throw e; });
63
+ },
64
+ getRectByBorder: function () {
65
+ const size = clickgo.form.getRectByBorder('rb');
66
+ clickgo.form.dialog(JSON.stringify(size)).catch((e) => { throw e; });
67
+ },
68
+ showCircular: function (e) {
69
+ clickgo.form.showCircular(e.clientX, e.clientY);
70
+ },
71
+ showRectangle: function (e) {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ clickgo.form.showRectangle(e.clientX, e.clientY, 'rb');
74
+ yield clickgo.tool.sleep(1000);
75
+ clickgo.form.hideRectangle();
76
+ });
77
+ },
78
+ showDrag: function () {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ clickgo.form.showDrag();
81
+ const rect = this.$refs.showDrag.$el.getBoundingClientRect();
82
+ clickgo.form.moveDrag({
83
+ 'left': rect.left,
84
+ 'top': rect.top,
85
+ 'width': rect.width,
86
+ 'height': rect.height
87
+ });
88
+ yield clickgo.tool.sleep(1000);
89
+ clickgo.form.hideDrag();
90
+ });
91
+ },
92
+ notify: function () {
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ let icon = null;
95
+ if (this.progress === 'progress + icon') {
96
+ icon = yield clickgo.fs.getContent('/package/res/icon.svg');
97
+ }
98
+ if (icon instanceof Blob) {
99
+ icon = yield clickgo.tool.blob2DataUrl(icon);
100
+ }
101
+ const nid = clickgo.form.notify({
102
+ 'title': 'Notify',
103
+ 'content': 'Content',
104
+ 'type': this.type,
105
+ 'progress': (this.progress === 'progress + icon') ? true : false,
106
+ 'icon': icon
107
+ });
108
+ if (this.progress === 'progress + icon') {
109
+ clickgo.form.notifyProgress(nid, 12);
110
+ yield clickgo.tool.sleep(1000);
111
+ clickgo.form.notifyProgress(nid, 30);
112
+ yield clickgo.tool.sleep(300);
113
+ clickgo.form.notifyProgress(nid, 50);
114
+ yield clickgo.tool.sleep(700);
115
+ clickgo.form.notifyProgress(nid, 75);
116
+ yield clickgo.tool.sleep(1000);
117
+ clickgo.form.notifyProgress(nid, 100);
118
+ }
119
+ });
120
+ },
121
+ showPop: function (e) {
122
+ if (!e.currentTarget) {
123
+ return;
124
+ }
125
+ clickgo.form.showPop(e.currentTarget, this.$refs.pop, 'v');
126
+ },
127
+ createParam: function () {
128
+ clickgo.form.create({
129
+ 'layout': '<form width=\'300\' height=\'300\' title=\'normal\'></form>'
130
+ }).catch((e) => { throw e; });
131
+ },
132
+ createPath: function () {
133
+ clickgo.form.create('test').then((e) => { console.log(e); }).catch((e) => { throw e; });
134
+ },
135
+ createTop: function () {
136
+ clickgo.form.create({
137
+ 'layout': '<form width=\'300\' height=\'300\' title=\'normal\'></form>',
138
+ 'topMost': true
139
+ }).catch((e) => { throw e; });
140
+ },
141
+ dialog: function () {
142
+ return __awaiter(this, void 0, void 0, function* () {
143
+ this.dialogResult = yield clickgo.form.dialog('Hello world!');
144
+ });
145
+ },
146
+ dialogLong: function () {
147
+ return __awaiter(this, void 0, void 0, function* () {
148
+ this.dialogResult = yield clickgo.form.dialog('longlonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglonglong');
149
+ });
150
+ },
151
+ dialogTitle: function () {
152
+ return __awaiter(this, void 0, void 0, function* () {
153
+ this.dialogResult = yield clickgo.form.dialog({
154
+ 'title': 'Title',
155
+ 'content': 'Hello world!'
156
+ });
157
+ });
158
+ },
159
+ dialogButtons: function () {
160
+ return __awaiter(this, void 0, void 0, function* () {
161
+ this.dialogResult = yield clickgo.form.dialog({
162
+ 'content': 'Hello world!',
163
+ 'buttons': ['A', 'B', 'C']
164
+ });
165
+ });
166
+ },
167
+ dialogCannot: function () {
168
+ return __awaiter(this, void 0, void 0, function* () {
169
+ this.dialogResult = yield clickgo.form.dialog({
170
+ 'content': 'Hello world!',
171
+ 'buttons': ['Do not close', 'Close'],
172
+ 'select': (e, button) => {
173
+ if (button === 'Do not close') {
174
+ e.preventDefault();
175
+ }
176
+ }
177
+ });
178
+ });
179
+ },
180
+ confirm: function (cancel) {
181
+ return __awaiter(this, void 0, void 0, function* () {
182
+ this.dialogResult = yield clickgo.form.confirm({
183
+ 'content': 'Hello world?',
184
+ 'cancel': cancel
185
+ });
186
+ if (typeof this.dialogResult === 'boolean') {
187
+ this.dialogResult = this.dialogResult ? 'true (boolean)' : 'false (boolean)';
188
+ }
189
+ else {
190
+ this.dialogResult = this.dialogResult.toString() + ' (number)';
191
+ }
192
+ });
193
+ },
194
+ setTopMost: function () {
195
+ this.setTopMostValue = !this.setTopMostValue;
196
+ clickgo.form.setTopMost(this.setTopMostValue);
197
+ },
198
+ flash: function () {
199
+ clickgo.form.flash();
200
+ },
201
+ hide: function () {
202
+ return __awaiter(this, void 0, void 0, function* () {
203
+ clickgo.form.hide();
204
+ yield clickgo.tool.sleep(1000);
205
+ clickgo.form.show();
206
+ });
207
+ }
208
+ };
209
+ const receive = function (obj) {
210
+ clickgo.form.dialog(JSON.stringify(obj)).catch((e) => { throw e; });
211
+ };
212
+ exports.receive = receive;
213
+ const mounted = function () {
214
+ this.fid = this.formId;
215
+ this.tid = this.taskId;
216
+ };
217
+ exports.mounted = mounted;
@@ -0,0 +1,3 @@
1
+ button {
2
+ height: 30px;
3
+ }
@@ -0,0 +1,56 @@
1
+ <form width="350" height="400" title="Library form" padding="10">
2
+ <overflow direction="v" style="flex: 1;">
3
+ <layout gutter="10" direction="v" style="flex: 1;">
4
+ <button @click="min" style="height: 30px;">min()</button>
5
+ <button @click="max" style="height: 30px;">max()</button>
6
+ <button @click="close" style="height: 30px;">close()</button>
7
+ <label @mousedown="bindResize" @touchstart="bindResize" style="padding: 20px; background: rgba(0, 0, 0, .1); cursor: se-resize;">bindResize(e, 'rb')</label>
8
+ <label @mousedown="bindDrag" @touchstart="bindDrag" style="padding: 20px; background: rgba(0, 0, 0, .1);">bindDrag(e)</label>
9
+ <layout gutter="10" align-v="center">
10
+ <label>Form ID:</label>
11
+ <text v-model="fid" style="flex: 1; width: 0; height: 30px;"></text>
12
+ </layout>
13
+ <button @click="getTaskId" style="height: 30px;">getTaskId({{fid}})</button>
14
+ <button @click="get" style="height: 30px;">get({{fid}})</button>
15
+ <layout gutter="10" align-v="center">
16
+ <label>Send: </label>
17
+ <text v-model="sendValue" style="flex: 1; width: 0; height: 30px;"></text>
18
+ <button @click="send" style="padding: 0 10px;">send({{fid}}, {'key': '{{sendValue}}'})</button>
19
+ </layout>
20
+ <button @click="changeFocus" style="height: 30px;">changeFocus({{fid}})</button>
21
+ <layout gutter="10" align-v="center">
22
+ <label>Task ID:</label>
23
+ <text v-model="tid" style="flex: 1; width: 0; height: 30px;"></text>
24
+ <button @click="getList" style="padding: 0 10px;">getList({{tid}})</button>
25
+ </layout>
26
+ <button @click="getMaxZIndexID" style="height: 30px;">getMaxZIndexID()</button>
27
+ <button @click="getRectByBorder" style="height: 30px;">getRectByBorder('rb')</button>
28
+ <button @click="showCircular" style="height: 30px;">showCircular(x, y)</button>
29
+ <button @click="showRectangle" style="height: 30px;">showRectangle(x, y, 'rb')</button>
30
+ <button @click="showDrag" ref="showDrag" style="height: 30px;">showDrag()</button>
31
+ <layout gutter="10">
32
+ <select v-model="type" :data="['primary', 'info', 'warning', 'danger']"></select>
33
+ <select v-model="progress" :data="['normal', 'progress + icon']" style="flex: 1; width: 0;"></select>
34
+ <button @click="notify" style="padding: 0 10px;">notify({ ... })</button>
35
+ </layout>
36
+ <button @click="showPop" style="height: 30px;">showPop(e.currentTarget, this.$refs.pop)</button>
37
+ <teleport to="#cg-pop-list">
38
+ <block ref="pop" data-cg-pop style="border: solid 1px #000; background: #FFF; width: 200px; height: 100px; display: flex; justify-content: center; align-items: center;">$refs.pop</block>
39
+ </teleport>
40
+ <button @click="createParam" style="height: 30px;">create({'layout':'xxx'})</button>
41
+ <button @click="createPath" style="height: 30px;">create('test')</button>
42
+ <button @click="createTop" style="height: 30px;">create({'layout':'xxx','topMost':true})</button>
43
+ <label>Dialog result: {{dialogResult}}.</label>
44
+ <button @click="dialog" style="height: 30px;">dialog('Hello world!')</button>
45
+ <button @click="dialogLong">dialog('long...')</button>
46
+ <button @click="dialogTitle" style="height: 30px;">dialog({'title':'Title','content':'Hello world!'})</button>
47
+ <button @click="dialogButtons" style="height: 30px;">dialog({'content':'Hello world!','buttons':['A','B','C']})</button>
48
+ <button @click="dialogCannot" style="height: 30px;">Dialog can not be close</button>
49
+ <button @click="confirm(false)" style="height: 30px;">confirm('confirm')</button>
50
+ <button @click="confirm(true)" style="height: 30px;">confirm({'content':'confirm','cancel':true})</button>
51
+ <button @click="setTopMost" style="height: 30px;">setTopMost({{setTopMostValue ? 'false' : 'true'}})</button>
52
+ <button @click="flash" style="height: 30px;">flash()</button>
53
+ <button @click="hide" style="height: 30px;">hide() and show()</button>
54
+ </layout>
55
+ </overflow>
56
+ </form>
@@ -0,0 +1,5 @@
1
+ <form width="200" height="200" title="From path">
2
+ <layout align-v="center" align-h="center" style="flex: 1; width: 0;">
3
+ <label>Haha!</label>
4
+ </layout>
5
+ </form>
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.mounted = exports.methods = exports.data = void 0;
13
+ const clickgo = require("clickgo");
14
+ exports.data = {
15
+ 'path': '/',
16
+ 'list': [],
17
+ 'val': ''
18
+ };
19
+ exports.methods = {
20
+ open: function (path) {
21
+ return __awaiter(this, void 0, void 0, function* () {
22
+ if (!path.endsWith('/')) {
23
+ path += '/';
24
+ }
25
+ this.list = [];
26
+ const ls = yield clickgo.fs.readDir(path);
27
+ for (const item of ls) {
28
+ this.list.push({
29
+ 'label': (item.isDirectory() ? '[FOLD]' : (item.isSymbolicLink() ? '[SYMB]' : '[FILE]')) + ' ' + item.name,
30
+ 'value': path + item.name
31
+ });
32
+ }
33
+ this.path = path;
34
+ });
35
+ },
36
+ dblclick: function () {
37
+ return __awaiter(this, void 0, void 0, function* () {
38
+ const r = yield clickgo.fs.isFile(this.val);
39
+ if (r) {
40
+ const extlio = this.val.lastIndexOf('.');
41
+ if (extlio === -1) {
42
+ yield clickgo.form.dialog('This extension is not supported.');
43
+ return;
44
+ }
45
+ const ext = this.val.toLowerCase().slice(extlio + 1);
46
+ if (['xml', 'js', 'ts', 'json', 'css', 'html', 'php'].includes(ext)) {
47
+ let content = yield clickgo.fs.getContent(this.val);
48
+ if (!content) {
49
+ yield clickgo.form.dialog('This file cannot be opened.');
50
+ return;
51
+ }
52
+ if (content instanceof Blob) {
53
+ content = yield clickgo.tool.blob2Text(content);
54
+ }
55
+ const f = yield clickgo.form.create('text');
56
+ if (typeof f === 'number') {
57
+ return;
58
+ }
59
+ clickgo.form.send(f.id, {
60
+ 'title': this.val.slice(this.val.lastIndexOf('/') + 1),
61
+ 'content': content
62
+ });
63
+ return;
64
+ }
65
+ yield clickgo.form.dialog('This extension is not supported.');
66
+ return;
67
+ }
68
+ yield this.open(this.val);
69
+ });
70
+ },
71
+ up: function () {
72
+ return __awaiter(this, void 0, void 0, function* () {
73
+ if (this.path === '/') {
74
+ return;
75
+ }
76
+ const path = this.path.slice(0, -1);
77
+ const lif = path.lastIndexOf('/');
78
+ const npath = path.slice(0, lif + 1);
79
+ yield this.open(npath);
80
+ });
81
+ }
82
+ };
83
+ const mounted = function () {
84
+ return __awaiter(this, void 0, void 0, function* () {
85
+ yield this.open('/');
86
+ });
87
+ };
88
+ exports.mounted = mounted;
@@ -0,0 +1,8 @@
1
+ <form width="350" height="400" title="Library fs" padding="10">
2
+ <layout gutter="10" direction="v" style="flex: 1;">
3
+ <label>Double click the item below:</label>
4
+ <block style="background: #000; color: #FFF; padding: 5px;">{{path}}</block>
5
+ <list v-model="val" :data="list" @dblclick="dblclick" style="flex: 1; height: 0;"></list>
6
+ <button style="height: 30px;" @click="up">Up</button>
7
+ </layout>
8
+ </form>
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.receive = exports.data = void 0;
4
+ exports.data = {
5
+ 'title': 'Text viewer',
6
+ 'content': ''
7
+ };
8
+ const receive = function (obj) {
9
+ if (obj.taskId !== this.taskId) {
10
+ return;
11
+ }
12
+ this.title = obj.title + ' - Text viewer';
13
+ this.content = obj.content;
14
+ };
15
+ exports.receive = receive;
@@ -0,0 +1,3 @@
1
+ <form width="350" height="400" :title="title" padding="10">
2
+ <text v-model="content" style="flex: 1;" multi readonly></text>
3
+ </form>
@@ -0,0 +1,3 @@
1
+ {
2
+ "File name": "File name"
3
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "File name": "文件名"
3
+ }