@ajaxjs/ui 1.2.9 → 1.3.1

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 (139) 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 +3627 -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 +3638 -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.js +16 -16
  24. package/src/data-source/data-source.js.map +1 -0
  25. package/{dist → src}/data-source/data-source.ts +16 -14
  26. package/{dist → src}/iam/iam.js +10 -5
  27. package/src/iam/iam.js.map +1 -0
  28. package/{dist → src}/iam/iam.ts +9 -4
  29. package/src/iam/user.vue +53 -0
  30. package/src/index.js +48 -0
  31. package/{dist/iView-ext/fast-iview-table → src/iview-ext}/list.js +4 -7
  32. package/src/iview-ext/list.js.map +1 -0
  33. package/{dist/iView-ext/fast-iview-table → src/iview-ext}/list.ts +3 -4
  34. package/{dist/table-selector → src/iview-ext}/table-selector.vue +17 -12
  35. package/{dist/iView-ext → src/iview-ext}/tips.vue +5 -2
  36. package/src/libs/entity.js.map +1 -0
  37. package/src/libs/iview-widgets.js.map +1 -0
  38. package/src/main.js +6 -0
  39. package/src/main.js.map +1 -0
  40. package/src/main.ts +7 -0
  41. package/src/shims-tsx.d.ts +11 -0
  42. package/{dist → src}/shims-vue.d.ts +4 -4
  43. package/src/style/common-functions.less +286 -0
  44. package/src/style/reset.less +19 -0
  45. package/src/style/reset2.less +49 -0
  46. package/tsconfig.json +40 -0
  47. package/vue.config.js +14 -0
  48. package/LICENSE +0 -201
  49. package/dist/api-helper/common/arg.vue +0 -46
  50. package/dist/api-helper/common/http-method.vue +0 -53
  51. package/dist/api-helper/common/input-table.vue +0 -128
  52. package/dist/api-helper/document/document-render.d.ts +0 -10
  53. package/dist/api-helper/document/document-render.js +0 -38
  54. package/dist/api-helper/document/document-render.js.map +0 -1
  55. package/dist/api-helper/document/document-render.ts +0 -35
  56. package/dist/api-helper/document/document-render.vue +0 -155
  57. package/dist/api-helper/document/document.d.ts +0 -31
  58. package/dist/api-helper/document/document.js +0 -55
  59. package/dist/api-helper/document/document.js.map +0 -1
  60. package/dist/api-helper/document/document.ts +0 -55
  61. package/dist/api-helper/document/document.vue +0 -78
  62. package/dist/api-helper/document/perview.vue +0 -0
  63. package/dist/api-helper/index.js +0 -142
  64. package/dist/api-helper/index.vue +0 -108
  65. package/dist/api-helper/request-body.vue +0 -66
  66. package/dist/api-helper/table.d.ts +0 -7
  67. package/dist/api-helper/table.js +0 -13
  68. package/dist/api-helper/table.js.map +0 -1
  69. package/dist/api-helper/table.ts +0 -10
  70. package/dist/api-helper/table.vue +0 -103
  71. package/dist/api-helper/xhr.js +0 -100
  72. package/dist/api-helper2/api-helper.d.ts +0 -194
  73. package/dist/api-helper2/api-helper.vue +0 -144
  74. package/dist/api-helper2/bookmark.vue +0 -168
  75. package/dist/api-helper2/common/arg.vue +0 -46
  76. package/dist/api-helper2/common/http-method.vue +0 -53
  77. package/dist/api-helper2/document/document-render.vue +0 -189
  78. package/dist/api-helper2/document/document.vue +0 -130
  79. package/dist/api-helper2/document/perview.vue +0 -0
  80. package/dist/api-helper2/env.vue +0 -140
  81. package/dist/api-helper2/history.vue +0 -116
  82. package/dist/api-helper2/main.vue +0 -70
  83. package/dist/api-helper2/request-body.vue +0 -68
  84. package/dist/api-helper2/table.vue +0 -116
  85. package/dist/api-selector/api-list-dataservice.d.ts +0 -18
  86. package/dist/api-selector/api-list-dataservice.js +0 -209
  87. package/dist/api-selector/api-list-dataservice.js.map +0 -1
  88. package/dist/api-selector/api-list-dataservice.ts +0 -232
  89. package/dist/api-selector/api-list-swagger.d.ts +0 -28
  90. package/dist/api-selector/api-list-swagger.js +0 -179
  91. package/dist/api-selector/api-list-swagger.js.map +0 -1
  92. package/dist/api-selector/api-list-swagger.ts +0 -206
  93. package/dist/api-selector/api-list.d.ts +0 -80
  94. package/dist/api-selector/api-list.js +0 -129
  95. package/dist/api-selector/api-list.js.map +0 -1
  96. package/dist/api-selector/api-list.ts +0 -135
  97. package/dist/api-selector/index.vue +0 -125
  98. package/dist/api-selector/test-dataservice.d.ts +0 -23
  99. package/dist/api-selector/test-dataservice.js +0 -74
  100. package/dist/api-selector/test-dataservice.js.map +0 -1
  101. package/dist/api-selector/test-swagger.d.ts +0 -901
  102. package/dist/api-selector/test-swagger.js +0 -656
  103. package/dist/api-selector/test-swagger.js.map +0 -1
  104. package/dist/data-source/data-source.css +0 -44
  105. package/dist/data-source/data-source.d.ts +0 -14
  106. package/dist/data-source/data-source.html +0 -59
  107. package/dist/data-source/data-source.js.map +0 -1
  108. package/dist/iView-ext/fast-iview-table/fast-iview-table.d.ts +0 -37
  109. package/dist/iView-ext/fast-iview-table/fast-iview-table.js +0 -72
  110. package/dist/iView-ext/fast-iview-table/fast-iview-table.js.map +0 -1
  111. package/dist/iView-ext/fast-iview-table/fast-iview-table.ts +0 -75
  112. package/dist/iView-ext/fast-iview-table/fast-iview-table.vue +0 -52
  113. package/dist/iView-ext/fast-iview-table/list.d.ts +0 -44
  114. package/dist/iView-ext/fast-iview-table/list.js.map +0 -1
  115. package/dist/iam/iam.d.ts +0 -9
  116. package/dist/iam/iam.js.map +0 -1
  117. package/dist/index.d.ts +0 -57
  118. package/dist/index.js +0 -22
  119. package/dist/index.js.map +0 -1
  120. package/dist/index.ts +0 -18
  121. package/dist/libs/entity.d.ts +0 -26
  122. package/dist/libs/entity.js.map +0 -1
  123. package/dist/libs/iview-widgets.d.ts +0 -59
  124. package/dist/libs/iview-widgets.js.map +0 -1
  125. package/dist/main.d.ts +0 -1
  126. package/dist/main.js +0 -24
  127. package/dist/main.js.map +0 -1
  128. package/dist/main.ts +0 -22
  129. package/dist/table-selector/table-selector.htm +0 -28
  130. package/dist/table-selector/table-selector.js +0 -149
  131. /package/{dist → src}/data-source/data-source.less +0 -0
  132. /package/{dist → src}/data-source/data-source.vue +0 -0
  133. /package/{dist → src}/libs/api-helper.d.ts +0 -0
  134. /package/{dist → src}/libs/api-list.d.ts +0 -0
  135. /package/{dist → src}/libs/common.d.ts +0 -0
  136. /package/{dist → src}/libs/entity.js +0 -0
  137. /package/{dist → src}/libs/entity.ts +0 -0
  138. /package/{dist → src}/libs/iview-widgets.js +0 -0
  139. /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
+ }