@ajaxjs/ui 1.3.12 → 1.4.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 (52) hide show
  1. package/README.md +2 -29
  2. package/dist/ajaxjs-ui.cjs.js +1 -0
  3. package/dist/ajaxjs-ui.es.js +33 -0
  4. package/dist/ajaxjs-ui.umd.js +1 -0
  5. package/dist/types/index.d.ts +1 -0
  6. package/dist/utils.d.ts +36 -0
  7. package/package.json +55 -49
  8. package/.browserslistrc +0 -3
  9. package/.eslintrc.js +0 -26
  10. package/babel.config.js +0 -5
  11. package/deprecated/api-helper.zip +0 -0
  12. package/deprecated/api-helper2.zip +0 -0
  13. package/deprecated/api-selector.zip +0 -0
  14. package/deprecated/common-ui.zip +0 -0
  15. package/deprecated/data-source.zip +0 -0
  16. package/deprecated/table-selector.zip +0 -0
  17. package/deprecated/utils.js +0 -220
  18. package/dist/@ajaxjs/ui.common.js +0 -3818
  19. package/dist/@ajaxjs/ui.common.js.map +0 -1
  20. package/dist/@ajaxjs/ui.css +0 -1
  21. package/dist/@ajaxjs/ui.umd.js +0 -3829
  22. package/dist/@ajaxjs/ui.umd.js.map +0 -1
  23. package/dist/@ajaxjs/ui.umd.min.js +0 -2
  24. package/dist/@ajaxjs/ui.umd.min.js.map +0 -1
  25. package/dist/demo.html +0 -1
  26. package/examples/App.vue +0 -137
  27. package/public/favicon.ico +0 -0
  28. package/public/index.html +0 -17
  29. package/src/data-source/data-source.less +0 -46
  30. package/src/data-source/data-source.ts +0 -97
  31. package/src/data-source/data-source.vue +0 -59
  32. package/src/iam/iam.ts +0 -65
  33. package/src/iam/user.vue +0 -53
  34. package/src/index.js +0 -52
  35. package/src/iview-ext/fast-iview-table.ts +0 -133
  36. package/src/iview-ext/fast-iview-table.vue +0 -67
  37. package/src/iview-ext/list.ts +0 -108
  38. package/src/iview-ext/table-selector.vue +0 -185
  39. package/src/iview-ext/tips.vue +0 -17
  40. package/src/libs/api-helper.d.ts +0 -194
  41. package/src/libs/api-list.d.ts +0 -15
  42. package/src/libs/common.d.ts +0 -201
  43. package/src/libs/entity.ts +0 -31
  44. package/src/libs/iview-widgets.ts +0 -73
  45. package/src/main.ts +0 -7
  46. package/src/shims-tsx.d.ts +0 -11
  47. package/src/shims-vue.d.ts +0 -4
  48. package/src/style/common-functions.less +0 -286
  49. package/src/style/reset.less +0 -19
  50. package/src/style/reset2.less +0 -49
  51. package/tsconfig.json +0 -40
  52. package/vue.config.js +0 -19
package/README.md CHANGED
@@ -1,30 +1,3 @@
1
- [![NPM](https://img.shields.io/npm/v/@ajaxjs/ui.svg?sanitize=true)](https://www.npmjs.com/package/@ajaxjs/ui)
2
- [![Vue.js](https://img.shields.io/badge/Vue.js-2.6.14-brightgreen.svg?style=flat&logo=vuedotjs&logoColor=white)](https://vuejs.org)
3
- [![TypeScript](https://img.shields.io/badge/TypeScript-4.9.4-blue.svg?style=flat&logo=Typescript&logoColor=white)](https://www.typescriptlang.org/)
4
- [![License](https://img.shields.io/badge/license-Apache--2.0-green.svg?longCache=true&style=flat)](http://www.apache.org/licenses/LICENSE-2.0.txt)
5
- [![Email](https://img.shields.io/badge/Contact--me-Email-orange.svg)](mailto:frank@ajaxjs.com)
6
- [![QQ群](https://framework.ajaxjs.com/static/qq.svg)](https://shang.qq.com/wpa/qunwpa?idkey=3877893a4ed3a5f0be01e809e7ac120e346102bd550deb6692239bb42de38e22)
1
+ # Ajaxjs UI Library
7
2
 
8
- # Widgets based on iView.js
9
-
10
- for Vue2 & iView.js v2
11
-
12
- NPM: https://www.npmjs.com/package/@ajaxjs/ui.
13
-
14
- ```shell
15
- npm i @ajaxjs/ui # install
16
- npm run dev # do coding
17
- npm run build # output js
18
- npm run release # deploy to NPM
19
- ```
20
-
21
- ## API Selector API 选择器
22
-
23
- ## API Helper 可视化 HTTP 请求工具
24
-
25
- ![Api Helper](https://foruda.gitee.com/images/1678378502563913592/697d70c3_784269.png)
26
-
27
-
28
- 教程 https://blog.csdn.net/zhangxin09/article/details/129391388
29
-
30
- [在线演示](https://framework.ajaxjs.com/demo/api-helper/) | [源码](https://gitee.com/sp42_admin/ajaxjs/tree/master/aj-ui-widget/api-helper) | [NPM 发布页](https://www.npmjs.com/package/@ajaxjs/aj-api-helper)
3
+ [![npm version](https://img.shields.io/npm/v/your-package-name.svg)](https://www.npmjs.com/package/@ajaxjs/ui)
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("vue"),i={},l=(e,t)=>{const r=e.__vccOpts||e;for(const[n,o]of t)r[n]=o;return r};function s(e,t,r,n,o,c){return a.openBlock(),a.createElementBlock("button",null,"hihi")}const u=l(i,[["render",s]]);function p(e,t){const n=(t?parent.location:window.location).search.substring(1).split("&");for(let o=0;o<n.length;o++){const c=n[o].split("=");if(c[0]==e)return c[1]}return null}function d(e){if(navigator.clipboard)navigator.clipboard.writeText(e);else{const t=document.createElement("textarea");document.body.appendChild(t),t.style.position="fixed",t.style.clip="rect(0 0 0 0)",t.style.top="10px",t.value=e,t.select(),document.execCommand("copy",!0),document.body.removeChild(t)}}exports.MyButton=u;exports.copyToClipboard=d;exports.getQueryParam=p;
@@ -0,0 +1,33 @@
1
+ import { openBlock as a, createElementBlock as i } from "vue";
2
+ const l = {}, s = (e, t) => {
3
+ const r = e.__vccOpts || e;
4
+ for (const [n, o] of t)
5
+ r[n] = o;
6
+ return r;
7
+ };
8
+ function p(e, t, r, n, o, c) {
9
+ return a(), i("button", null, "hihi");
10
+ }
11
+ const d = /* @__PURE__ */ s(l, [["render", p]]);
12
+ function m(e, t) {
13
+ const n = (t ? parent.location : window.location).search.substring(1).split("&");
14
+ for (let o = 0; o < n.length; o++) {
15
+ const c = n[o].split("=");
16
+ if (c[0] == e)
17
+ return c[1];
18
+ }
19
+ return null;
20
+ }
21
+ function f(e) {
22
+ if (navigator.clipboard)
23
+ navigator.clipboard.writeText(e);
24
+ else {
25
+ const t = document.createElement("textarea");
26
+ document.body.appendChild(t), t.style.position = "fixed", t.style.clip = "rect(0 0 0 0)", t.style.top = "10px", t.value = e, t.select(), document.execCommand("copy", !0), document.body.removeChild(t);
27
+ }
28
+ }
29
+ export {
30
+ d as MyButton,
31
+ f as copyToClipboard,
32
+ m as getQueryParam
33
+ };
@@ -0,0 +1 @@
1
+ (function(t,n){typeof exports=="object"&&typeof module<"u"?n(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],n):(t=typeof globalThis<"u"?globalThis:t||self,n(t.ajaxjs_ui={},t.Vue))})(this,(function(t,n){"use strict";const a={},s=(o,e)=>{const c=o.__vccOpts||o;for(const[r,i]of e)c[r]=i;return c};function l(o,e,c,r,i,u){return n.openBlock(),n.createElementBlock("button",null,"hihi")}const d=s(a,[["render",l]]);function p(o,e){const r=(e?parent.location:window.location).search.substring(1).split("&");for(let i=0;i<r.length;i++){const u=r[i].split("=");if(u[0]==o)return u[1]}return null}function f(o){if(navigator.clipboard)navigator.clipboard.writeText(o);else{const e=document.createElement("textarea");document.body.appendChild(e),e.style.position="fixed",e.style.clip="rect(0 0 0 0)",e.style.top="10px",e.value=o,e.select(),document.execCommand("copy",!0),document.body.removeChild(e)}}t.MyButton=d,t.copyToClipboard=f,t.getQueryParam=p,Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})}));
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Gets a query parameter value from the URL search string.
3
+ *
4
+ * @param variable - The name of the query parameter to retrieve.
5
+ * @param isParent - Whether to get the parameter from the parent window's URL (true) or current window's URL (false).
6
+ * @returns The value of the query parameter if found, otherwise null.
7
+ */
8
+ export declare function getQueryParam(variable: string, isParent: boolean): string | null;
9
+ /**
10
+ * Copies text to the clipboard using the modern Clipboard API if available, or a fallback method.
11
+ *
12
+ * @param text - The text to copy to the clipboard.
13
+ * @returns void
14
+ * @description Uses navigator.clipboard.writeText() for modern browsers, and falls back to creating a temporary textarea element
15
+ * for older browsers that don't support the Clipboard API.
16
+ */
17
+ export declare function copyToClipboard(text: string): void;
18
+ /**
19
+ * 通用的打开下载对话框方法,没有测试过具体兼容性
20
+ * https://www.cnblogs.com/liuxianan/p/js-download.html
21
+ *
22
+ * ref 这应该是你见过的最全前端下载总结 https://juejin.cn/post/6844903763359039501
23
+ *
24
+ * @param url 下载地址,也可以是一个blob对象,必选
25
+ * @param saveName 保存文件名,可选
26
+ */
27
+ export declare function openDownloadDialog(url: string | Blob, saveName: string): void;
28
+ /**
29
+ * Processes elements with the "w3-include-html" attribute by fetching and including the specified HTML content.
30
+ * This function recursively processes elements to handle any newly added content that also has the attribute.
31
+ *
32
+ * @description Iterates through all elements in the document, finds those with the "w3-include-html" attribute,
33
+ * fetches the HTML content from the specified file using a synchronous XMLHttpRequest, replaces the element with
34
+ * the fetched content, and then calls itself recursively to process any new elements that might have been added.
35
+ */
36
+ export declare function myHTMLInclude(): void;
package/package.json CHANGED
@@ -1,49 +1,55 @@
1
- {
2
- "name": "@ajaxjs/ui",
3
- "version": "1.3.12",
4
- "private": false,
5
- "publishConfig": {
6
- "access": "public"
7
- },
8
- "keywords": [
9
- "ajaxjs"
10
- ],
11
- "author": "Frank Cheung <frank@ajaxjs.com>",
12
- "license": "Apache License 2.0",
13
- "description": "Widgets based on iView.js",
14
- "repository": {
15
- "type": "git",
16
- "url": "https://github.com/lightweight-component/js/tree/main/ui"
17
- },
18
- "bugs": {
19
- "url": "https://github.com/lightweight-component/js/issues"
20
- },
21
- "scripts": {
22
- "serve": "vue-cli-service serve",
23
- "build": "vue-cli-service build",
24
- "lint": "vue-cli-service lint",
25
- "lib": "vue-cli-service build --target lib --name @ajaxjs/ui --dest dist src/index.js",
26
- "deploy": "npm run lib && npm version patch && npm publish"
27
- },
28
- "main": "dist/@ajaxjs/ui.umd.js",
29
- "types": "dist/types.d.ts",
30
- "dependencies": {},
31
- "devDependencies": {
32
- "@ajaxjs/util": "1.1.3",
33
- "@typescript-eslint/eslint-plugin": "^5.4.0",
34
- "@typescript-eslint/parser": "^5.4.0",
35
- "@vue/cli-plugin-babel": "~5.0.0",
36
- "@vue/cli-plugin-eslint": "~5.0.0",
37
- "@vue/cli-plugin-typescript": "~5.0.0",
38
- "@vue/cli-service": "~5.0.0",
39
- "@vue/eslint-config-typescript": "^9.1.0",
40
- "eslint": "^7.32.0",
41
- "eslint-plugin-vue": "^8.0.3",
42
- "less": "^4.0.0",
43
- "less-loader": "^8.0.0",
44
- "typescript": "~4.5.5",
45
- "view-design": "^4.7.0",
46
- "vue": "^2.6.14",
47
- "vue-template-compiler": "^2.6.14"
48
- }
49
- }
1
+ {
2
+ "name": "@ajaxjs/ui",
3
+ "version": "1.4.1",
4
+ "private": false,
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "type": "module",
9
+ "keywords": [
10
+ "ajaxjs"
11
+ ],
12
+ "author": "Frank Cheung <frank@ajaxjs.com>",
13
+ "license": "Apache License 2.0",
14
+ "description": "Widgets based on iView.js",
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "https://github.com/lightweight-component/js/tree/main/aj-common-ui"
18
+ },
19
+ "bugs": {
20
+ "url": "https://github.com/lightweight-component/js/issues"
21
+ },
22
+ "main": "./dist/ajaxjs-ui.cjs.js",
23
+ "module": "./dist/ajaxjs-ui.es.js",
24
+ "exports": {
25
+ ".": {
26
+ "import": "./dist/ajaxjs-ui.es.js",
27
+ "require": "./dist/ajaxjs-ui.cjs.js"
28
+ }
29
+ },
30
+ "types": "./dist/types/index.d.ts",
31
+ "files": [
32
+ "dist/**/*"
33
+ ],
34
+ "scripts": {
35
+ "dev": "vite",
36
+ "build": "vite build",
37
+ "build:lib": "vite build --config vite.lib.config.js",
38
+ "build:demo": "vite build --config vite.app.config.js",
39
+ "preview": "vite preview"
40
+ },
41
+ "dependencies": {
42
+ "@ajaxjs/util": "^1.2.1",
43
+ "vue": "^3.5.18"
44
+ },
45
+ "devDependencies": {
46
+ "@types/node": "^20.19.15",
47
+ "@vitejs/plugin-vue": "^6.0.1",
48
+ "@vue/tsconfig": "^0.7.0",
49
+ "less": "^4.4.1",
50
+ "typescript": "~5.8.3",
51
+ "vite": "^7.1.2",
52
+ "vite-plugin-dts": "^4.5.4",
53
+ "vue-tsc": "^3.0.5"
54
+ }
55
+ }
package/.browserslistrc DELETED
@@ -1,3 +0,0 @@
1
- > 1%
2
- last 2 versions
3
- not dead
package/.eslintrc.js DELETED
@@ -1,26 +0,0 @@
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
- }
package/babel.config.js DELETED
@@ -1,5 +0,0 @@
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
@@ -1,220 +0,0 @@
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
- }