@ajaxjs/ui 1.3.0 → 1.3.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.
Files changed (134) hide show
  1. package/.browserslistrc +3 -0
  2. package/.eslintrc.js +26 -0
  3. package/babel.config.js +5 -0
  4. package/deprecated/api-helper.zip +0 -0
  5. package/deprecated/api-helper2.zip +0 -0
  6. package/deprecated/api-selector.zip +0 -0
  7. package/deprecated/common-ui.zip +0 -0
  8. package/deprecated/data-source.zip +0 -0
  9. package/deprecated/table-selector.zip +0 -0
  10. package/deprecated/utils.js +220 -0
  11. package/dist/@ajaxjs/widgets.common.js +4084 -0
  12. package/dist/@ajaxjs/widgets.common.js.map +1 -0
  13. package/dist/@ajaxjs/widgets.css +1 -0
  14. package/dist/@ajaxjs/widgets.umd.js +4095 -0
  15. package/dist/@ajaxjs/widgets.umd.js.map +1 -0
  16. package/dist/@ajaxjs/widgets.umd.min.js +2 -0
  17. package/dist/@ajaxjs/widgets.umd.min.js.map +1 -0
  18. package/dist/demo.html +1 -0
  19. package/examples/App.vue +137 -0
  20. package/package.json +50 -41
  21. package/public/favicon.ico +0 -0
  22. package/public/index.html +17 -0
  23. package/{dist → src}/data-source/data-source.ts +16 -14
  24. package/{dist → src}/iam/iam.ts +2 -4
  25. package/{dist → src}/iam/user.vue +19 -16
  26. package/src/index.js +48 -0
  27. package/src/iview-ext/fast-iview-table.ts +131 -0
  28. package/src/iview-ext/fast-iview-table.vue +67 -0
  29. package/{dist/iView-ext/fast-iview-table → src/iview-ext}/list.ts +11 -12
  30. package/{dist/table-selector → src/iview-ext}/table-selector.vue +17 -12
  31. package/{dist/iView-ext → src/iview-ext}/tips.vue +5 -2
  32. package/src/main.ts +7 -0
  33. package/src/shims-tsx.d.ts +11 -0
  34. package/{dist → src}/shims-vue.d.ts +4 -4
  35. package/src/style/common-functions.less +286 -0
  36. package/src/style/reset.less +19 -0
  37. package/src/style/reset2.less +49 -0
  38. package/tsconfig.json +40 -0
  39. package/vue.config.js +14 -0
  40. package/LICENSE +0 -201
  41. package/dist/api-helper/common/arg.vue +0 -46
  42. package/dist/api-helper/common/http-method.vue +0 -53
  43. package/dist/api-helper/common/input-table.vue +0 -128
  44. package/dist/api-helper/document/document-render.d.ts +0 -10
  45. package/dist/api-helper/document/document-render.js +0 -38
  46. package/dist/api-helper/document/document-render.js.map +0 -1
  47. package/dist/api-helper/document/document-render.ts +0 -35
  48. package/dist/api-helper/document/document-render.vue +0 -155
  49. package/dist/api-helper/document/document.d.ts +0 -31
  50. package/dist/api-helper/document/document.js +0 -55
  51. package/dist/api-helper/document/document.js.map +0 -1
  52. package/dist/api-helper/document/document.ts +0 -55
  53. package/dist/api-helper/document/document.vue +0 -78
  54. package/dist/api-helper/document/perview.vue +0 -0
  55. package/dist/api-helper/index.js +0 -142
  56. package/dist/api-helper/index.vue +0 -108
  57. package/dist/api-helper/request-body.vue +0 -66
  58. package/dist/api-helper/table.d.ts +0 -7
  59. package/dist/api-helper/table.js +0 -13
  60. package/dist/api-helper/table.js.map +0 -1
  61. package/dist/api-helper/table.ts +0 -10
  62. package/dist/api-helper/table.vue +0 -103
  63. package/dist/api-helper/xhr.js +0 -100
  64. package/dist/api-helper2/api-helper.d.ts +0 -194
  65. package/dist/api-helper2/api-helper.vue +0 -144
  66. package/dist/api-helper2/bookmark.vue +0 -168
  67. package/dist/api-helper2/common/arg.vue +0 -46
  68. package/dist/api-helper2/common/http-method.vue +0 -53
  69. package/dist/api-helper2/document/document-render.vue +0 -189
  70. package/dist/api-helper2/document/document.vue +0 -130
  71. package/dist/api-helper2/document/perview.vue +0 -0
  72. package/dist/api-helper2/env.vue +0 -140
  73. package/dist/api-helper2/history.vue +0 -116
  74. package/dist/api-helper2/main.vue +0 -70
  75. package/dist/api-helper2/request-body.vue +0 -68
  76. package/dist/api-helper2/table.vue +0 -116
  77. package/dist/api-selector/api-list-dataservice.d.ts +0 -18
  78. package/dist/api-selector/api-list-dataservice.js +0 -209
  79. package/dist/api-selector/api-list-dataservice.js.map +0 -1
  80. package/dist/api-selector/api-list-dataservice.ts +0 -232
  81. package/dist/api-selector/api-list-swagger.d.ts +0 -28
  82. package/dist/api-selector/api-list-swagger.js +0 -179
  83. package/dist/api-selector/api-list-swagger.js.map +0 -1
  84. package/dist/api-selector/api-list-swagger.ts +0 -206
  85. package/dist/api-selector/api-list.d.ts +0 -80
  86. package/dist/api-selector/api-list.js +0 -129
  87. package/dist/api-selector/api-list.js.map +0 -1
  88. package/dist/api-selector/api-list.ts +0 -135
  89. package/dist/api-selector/index.vue +0 -125
  90. package/dist/api-selector/test-dataservice.d.ts +0 -23
  91. package/dist/api-selector/test-dataservice.js +0 -74
  92. package/dist/api-selector/test-dataservice.js.map +0 -1
  93. package/dist/api-selector/test-swagger.d.ts +0 -901
  94. package/dist/api-selector/test-swagger.js +0 -656
  95. package/dist/api-selector/test-swagger.js.map +0 -1
  96. package/dist/data-source/data-source.css +0 -44
  97. package/dist/data-source/data-source.d.ts +0 -14
  98. package/dist/data-source/data-source.html +0 -59
  99. package/dist/data-source/data-source.js +0 -97
  100. package/dist/data-source/data-source.js.map +0 -1
  101. package/dist/iView-ext/fast-iview-table/fast-iview-table.d.ts +0 -37
  102. package/dist/iView-ext/fast-iview-table/fast-iview-table.js +0 -72
  103. package/dist/iView-ext/fast-iview-table/fast-iview-table.js.map +0 -1
  104. package/dist/iView-ext/fast-iview-table/fast-iview-table.ts +0 -75
  105. package/dist/iView-ext/fast-iview-table/fast-iview-table.vue +0 -52
  106. package/dist/iView-ext/fast-iview-table/list.d.ts +0 -44
  107. package/dist/iView-ext/fast-iview-table/list.js +0 -97
  108. package/dist/iView-ext/fast-iview-table/list.js.map +0 -1
  109. package/dist/iam/iam.d.ts +0 -16
  110. package/dist/iam/iam.js +0 -54
  111. package/dist/iam/iam.js.map +0 -1
  112. package/dist/index.d.ts +0 -57
  113. package/dist/index.js +0 -22
  114. package/dist/index.js.map +0 -1
  115. package/dist/index.ts +0 -18
  116. package/dist/libs/entity.d.ts +0 -26
  117. package/dist/libs/entity.js +0 -1
  118. package/dist/libs/entity.js.map +0 -1
  119. package/dist/libs/iview-widgets.d.ts +0 -59
  120. package/dist/libs/iview-widgets.js +0 -2
  121. package/dist/libs/iview-widgets.js.map +0 -1
  122. package/dist/main.d.ts +0 -1
  123. package/dist/main.js +0 -24
  124. package/dist/main.js.map +0 -1
  125. package/dist/main.ts +0 -22
  126. package/dist/table-selector/table-selector.htm +0 -28
  127. package/dist/table-selector/table-selector.js +0 -149
  128. /package/{dist → src}/data-source/data-source.less +0 -0
  129. /package/{dist → src}/data-source/data-source.vue +0 -0
  130. /package/{dist → src}/libs/api-helper.d.ts +0 -0
  131. /package/{dist → src}/libs/api-list.d.ts +0 -0
  132. /package/{dist → src}/libs/common.d.ts +0 -0
  133. /package/{dist → src}/libs/entity.ts +0 -0
  134. /package/{dist → src}/libs/iview-widgets.ts +0 -0
@@ -0,0 +1,3 @@
1
+ > 1%
2
+ last 2 versions
3
+ not dead
package/.eslintrc.js ADDED
@@ -0,0 +1,26 @@
1
+ module.exports = {
2
+ root: true,
3
+ env: {
4
+ node: true
5
+ },
6
+ 'extends': [
7
+ 'plugin:vue/essential',
8
+ 'eslint:recommended',
9
+ '@vue/typescript/recommended'
10
+ ],
11
+ parserOptions: {
12
+ ecmaVersion: 2020
13
+ },
14
+ rules: {
15
+ 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
16
+ 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
17
+ 'vue/multi-word-component-names': 'off',
18
+ 'vue/no-unused-components': 'off',
19
+ '@typescript-eslint/no-this-alias': 'off',
20
+ "no-unused-vars": "off",
21
+ '@typescript-eslint/ban-ts-comment': [
22
+ 'error',
23
+ { 'ts-ignore': 'allow-with-description' },
24
+ ]
25
+ },
26
+ }
@@ -0,0 +1,5 @@
1
+ module.exports = {
2
+ presets: [
3
+ '@vue/cli-plugin-babel/preset'
4
+ ]
5
+ }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,220 @@
1
+ // 数据服务 UI 配置
2
+ window.DS_CONFIG = {
3
+ API_ROOT: 'http://localhost:8080/adp/data_service',
4
+ };
5
+
6
+ if (!window.aj)
7
+ aj = {};
8
+
9
+ /**
10
+ * 复制文字到剪切板
11
+ *
12
+ * @param {*} text
13
+ */
14
+ aj.copyToClipboard = function (text) {
15
+ if (navigator.clipboard) {
16
+ // clipboard api 复制
17
+ navigator.clipboard.writeText(text);
18
+ } else {
19
+ var textarea = document.createElement('textarea');
20
+ document.body.appendChild(textarea);
21
+ // 隐藏此输入框
22
+ textarea.style.position = 'fixed';
23
+ textarea.style.clip = 'rect(0 0 0 0)';
24
+ textarea.style.top = '10px';
25
+ // 赋值
26
+ textarea.value = text;
27
+ // 选中
28
+ textarea.select();
29
+ // 复制
30
+ document.execCommand('copy', true);
31
+ // 移除输入框
32
+ document.body.removeChild(textarea);
33
+ }
34
+ }
35
+
36
+ function myHTMLInclude() {
37
+ var z, i, a, file, xhttp;
38
+ z = document.getElementsByTagName("*");
39
+
40
+ for (i = 0; i < z.length; i++) {
41
+ if (z[i].getAttribute("w3-include-html")) {
42
+ a = z[i].cloneNode(false);
43
+ file = z[i].getAttribute("w3-include-html");
44
+ var xhttp = new XMLHttpRequest();
45
+ xhttp.onreadystatechange = function () {
46
+ if (xhttp.readyState == 4 && xhttp.status == 200) {
47
+ a.removeAttribute("w3-include-html");
48
+ a.innerHTML = xhttp.responseText;
49
+ z[i].parentNode.replaceChild(a, z[i]);
50
+ myHTMLInclude();
51
+ }
52
+ }
53
+ xhttp.open("GET", file, false);
54
+ xhttp.send();
55
+ return;
56
+ }
57
+ }
58
+ }
59
+ ; (() => {
60
+ function request(method, url, params, cb, cfg) {
61
+ var xhr = new XMLHttpRequest();
62
+ xhr.open(method, url);
63
+ xhr.onreadystatechange = function () {
64
+ if (this.readyState === 4) {
65
+ var responseText = this.responseText.trim();
66
+ if (!responseText) {
67
+ alert('服务端返回空的字符串!');
68
+ return;
69
+ }
70
+
71
+ var data = null;
72
+ try {
73
+ var parseContentType = cfg && cfg.parseContentType;
74
+ switch (parseContentType) {
75
+ case 'text':
76
+ data = responseText;
77
+ break;
78
+ case 'xml':
79
+ data = this.responseXML;
80
+ break;
81
+ case 'json':
82
+ default:
83
+ data = JSON.parse(responseText);
84
+ businessCheck(data);
85
+ }
86
+ } catch (e) {
87
+ alert('AJAX 错误:\n' + e + '\nThe url is:' + cb.url); // 提示用户 异常
88
+ }
89
+
90
+ cb && cb(data, this);
91
+ /* if (this.status === 200) {
92
+ } else if (this.status === 500) {
93
+ }*/
94
+ }
95
+ }
96
+
97
+ if (cfg && cfg.header) {
98
+ for (var i in cfg.header) {
99
+ xhr.setRequestHeader(i, cfg.header[i]);
100
+ }
101
+ }
102
+
103
+ xhr.send(params || null);
104
+ }
105
+
106
+ // 业务处理
107
+ function businessCheck(json) {
108
+ if (json && !json.status)
109
+ alert(json.message || '操作失败');
110
+ }
111
+
112
+ function json2fromParams(param) {
113
+ let result = "";
114
+
115
+ for (let name in param) {
116
+ if (typeof param[name] != "function")
117
+ result += "&" + name + "=" + encodeURIComponent(param[name]);
118
+ }
119
+
120
+ return result.substring(1);
121
+ }
122
+
123
+ function form(method, url, params, cb, cfg) {
124
+ if (typeof params != 'string' && !(params instanceof FormData))
125
+ params = json2fromParams(params);
126
+
127
+ if (!cfg)
128
+ cfg = {};
129
+
130
+ cfg.header = { "Content-Type": "application/x-www-form-urlencoded" };
131
+ request(method, url, params, cb, cfg);
132
+ }
133
+
134
+ function json(method, url, params, cb, cfg) {
135
+ if (typeof params != 'string' && !(params instanceof FormData))
136
+ params = JSON.stringify(params);
137
+
138
+ if (!cfg)
139
+ cfg = {};
140
+
141
+ cfg.header = { "Content-Type": "application/json" };
142
+ request(method, url, params, cb, cfg);
143
+ }
144
+
145
+ aj.xhr = {
146
+ get(url, cb, cfg) {
147
+ request('GET', url, null, cb, cfg);
148
+ },
149
+ postForm(url, params, cb, cfg) {
150
+ form("POST", url, params, cb, cfg);
151
+ },
152
+ postJson(url, params, cb, cfg) {
153
+ json("POST", url, params, cb, cfg);
154
+ },
155
+ putForm(url, params, cb, cfg) {
156
+ form("PUT", url, params, cb, cfg);
157
+ },
158
+ putJson(url, params, cb, cfg) {
159
+ json("PUT", url, params, cb, cfg);
160
+ },
161
+ del(url, cb, cfg) {
162
+ request('DELETE', url, null, cb, cfg);
163
+ },
164
+ formData(form) {
165
+ if (!window.FormData)
166
+ throw 'The version of your browser is too old, please upgrade it.';
167
+
168
+ if (typeof form == 'string')
169
+ form = document.querySelector(form);
170
+ var json = {};
171
+
172
+ var formData = new FormData(form);
173
+ formData.forEach(function (value, key) {
174
+ json[key] = value;
175
+ });
176
+
177
+ return json;
178
+ }
179
+ };
180
+
181
+ })();
182
+
183
+ /**
184
+ * 通用的打开下载对话框方法,没有测试过具体兼容性
185
+ * https://www.cnblogs.com/liuxianan/p/js-download.html
186
+ *
187
+ * ref 这应该是你见过的最全前端下载总结 https://juejin.cn/post/6844903763359039501
188
+ *
189
+ * @param url 下载地址,也可以是一个blob对象,必选
190
+ * @param saveName 保存文件名,可选
191
+ */
192
+ function openDownloadDialog(url, saveName) {
193
+ if (typeof url == 'object' && url instanceof Blob)
194
+ url = URL.createObjectURL(url); // 创建blob地址
195
+
196
+ var aLink = document.createElement('a');
197
+ aLink.href = url;
198
+ aLink.download = saveName || ''; // HTML5新增的属性,指定保存文件名,可以不要后缀,注意,file:///模式下不会生效
199
+
200
+ var event;
201
+ if (window.MouseEvent) event = new MouseEvent('click');
202
+ else {
203
+ event = document.createEvent('MouseEvents');
204
+ event.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
205
+ }
206
+
207
+ aLink.dispatchEvent(event);
208
+ }
209
+
210
+ function getQueryParam(variable, isParent) {
211
+ var query = (isParent ? parent.location : window.location).search.substring(1);
212
+ var vars = query.split("&");
213
+
214
+ for (var i = 0; i < vars.length; i++) {
215
+ var pair = vars[i].split("=");
216
+ if (pair[0] == variable) { return pair[1]; }
217
+ }
218
+
219
+ return (false);
220
+ }