vue2-client 1.11.4 → 1.11.6

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 (26) hide show
  1. package/package.json +1 -1
  2. package/src/base-client/components/common/CitySelect/CitySelect.vue +366 -342
  3. package/src/base-client/components/common/Upload/Upload.vue +322 -322
  4. package/src/base-client/components/common/XDescriptions/XDescriptionsGroup.vue +61 -51
  5. package/src/base-client/components/common/XDescriptions/demo.vue +10 -9
  6. package/src/base-client/components/common/XFormGroup/demo.vue +3 -10
  7. package/src/base-client/components/common/XFormTable/demo.vue +60 -60
  8. package/src/components/STable/index.js +426 -426
  9. package/src/expression/ExpressionRunner.ts +28 -0
  10. package/src/expression/TestExpression.ts +509 -0
  11. package/src/expression/core/Delegate.ts +114 -0
  12. package/src/expression/core/Expression.ts +1295 -0
  13. package/src/expression/core/Program.ts +950 -0
  14. package/src/expression/core/Token.ts +29 -0
  15. package/src/expression/enums/ExpressionType.ts +81 -0
  16. package/src/expression/enums/TokenType.ts +13 -0
  17. package/src/expression/exception/BreakWayException.ts +2 -0
  18. package/src/expression/exception/ContinueWayException.ts +2 -0
  19. package/src/expression/exception/ExpressionException.ts +28 -0
  20. package/src/expression/exception/ReturnWayException.ts +14 -0
  21. package/src/expression/exception/ServiceException.ts +22 -0
  22. package/src/expression/instances/JSONArray.ts +48 -0
  23. package/src/expression/instances/JSONObject.ts +109 -0
  24. package/src/expression/instances/LogicConsole.ts +32 -0
  25. package/src/router/async/router.map.js +3 -2
  26. package/src/utils/indexedDB.js +234 -234
@@ -0,0 +1,29 @@
1
+ import TokenType from '../enums/TokenType'
2
+
3
+ export default class Token {
4
+ private type: TokenType;
5
+ private value: any;
6
+ private startPos: number;
7
+
8
+ constructor(type: TokenType, value: any, startPos: number) {
9
+ this.type = type;
10
+ this.value = value;
11
+ this.startPos = startPos;
12
+ }
13
+
14
+ public toString() : string {
15
+ return this.type.toString() + this.value;
16
+ }
17
+
18
+ public getType() : TokenType {
19
+ return this.type;
20
+ }
21
+
22
+ public getValue() : any {
23
+ return this.value;
24
+ }
25
+
26
+ public getStartPos() : number {
27
+ return this.startPos;
28
+ }
29
+ }
@@ -0,0 +1,81 @@
1
+ enum ExpressionType {
2
+ // >
3
+ GreaterThan,
4
+ // >=
5
+ GreaterThanOrEqual,
6
+ // <
7
+ LessThan,
8
+ // <=
9
+ LessThanOrEqual,
10
+ //= =
11
+ Equal,
12
+ //! =
13
+ NotEqual,
14
+ // +
15
+ Add,
16
+ // -
17
+ Subtract,
18
+ //*
19
+ Multiply,
20
+ // 除法
21
+ Divide,
22
+ // 求余
23
+ Modulo,
24
+
25
+ // 字符串连接
26
+ Concat,
27
+ // 逻辑非
28
+ Not,
29
+ // 逻辑与
30
+ And,
31
+ // 逻辑或
32
+ Or,
33
+
34
+ // 常数
35
+ Constant,
36
+ // 标识符
37
+ Identity,
38
+
39
+ // 获取对象属性
40
+ Property,
41
+
42
+ // 产生Json对象
43
+ Json,
44
+ // 产生Json数组
45
+ Array,
46
+ // Json对象属性值对
47
+ Attr,
48
+ // 数组下标,[0]
49
+ ArrayIndex,
50
+ // 函数调用
51
+ Call,
52
+ // for循环
53
+ For,
54
+ // 逗号表达式
55
+ Comma,
56
+ // 赋值语句
57
+ Assign,
58
+ // 条件语句
59
+ Condition,
60
+ // 参数
61
+ Param,
62
+ // Try
63
+ Try,
64
+ // Catch
65
+ Catch,
66
+ // 跳出
67
+ Return,
68
+ // 抛出异常
69
+ Throw,
70
+ // 校验
71
+ Validate,
72
+ // 断言
73
+ Assert,
74
+ // 循环终止
75
+ Break,
76
+ // 循环跳过
77
+ Continue,
78
+ // lambda
79
+ Lambda
80
+ }
81
+ export default ExpressionType
@@ -0,0 +1,13 @@
1
+ import ExpressionType from "@/expression/enums/ExpressionType";
2
+
3
+ enum TokenType {
4
+ Int = 'Int',
5
+ Double = 'Double',
6
+ Bool = 'Bool',
7
+ String = 'String',
8
+ Identy = 'Identity',
9
+ Oper = 'Oper',
10
+ End = 'End',
11
+ Null = 'Null'
12
+ }
13
+ export default TokenType
@@ -0,0 +1,2 @@
1
+ export default class BreakWayException extends Error {
2
+ }
@@ -0,0 +1,2 @@
1
+ export default class ContinueWayException extends Error {
2
+ }
@@ -0,0 +1,28 @@
1
+ /**
2
+ * 表达式执行异常,将显示执行异常的位置信息
3
+ */
4
+ export default class ExpressionException extends Error {
5
+ constructor(source: string, pos: number, cause: Error) {
6
+ let message: string;
7
+ let beforeErrorContent: string = source.substring(0, pos).trim();
8
+ const length: number = beforeErrorContent.length;
9
+ if (length > 1000) {
10
+ beforeErrorContent = "以上省略......\n" + beforeErrorContent.substring(length - 1000);
11
+ }
12
+ const afterErrorContent: string = source.substring(pos);
13
+ const afterErrorContentIndex: number = afterErrorContent.indexOf("\n");
14
+ if (afterErrorContentIndex == -1) {
15
+ message = beforeErrorContent.trim() + " <- " + afterErrorContent;
16
+ } else {
17
+ message = beforeErrorContent.trim() + " <- " + afterErrorContent.substring(0, afterErrorContentIndex) + "\n后续省略......";
18
+ }
19
+
20
+ // 通过原生 Error 的 cause 参数传递原因
21
+ super(message, { cause });
22
+ this.name = this.constructor.name;
23
+
24
+ if (Error.captureStackTrace) {
25
+ Error.captureStackTrace(this, this.constructor);
26
+ }
27
+ }
28
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Return 方法
3
+ */
4
+ export default class ReturnWayException extends Error {
5
+ private readonly returnObject : any
6
+ constructor(returnValue: any) {
7
+ super();
8
+ this.returnObject = returnValue;
9
+ }
10
+
11
+ public getReturnObject() : any {
12
+ return this.returnObject;
13
+ }
14
+ }
@@ -0,0 +1,22 @@
1
+ export default class ServiceException extends Error {
2
+ message: string;
3
+ code: number | undefined;
4
+ constructor (message: string, code?: number) {
5
+ super()
6
+ this.message = message;
7
+ this.code = code;
8
+ }
9
+
10
+ public getMessage() : string {
11
+ return this.message;
12
+ }
13
+
14
+ public setMessage(message: string) : ServiceException {
15
+ this.message = message;
16
+ return this
17
+ }
18
+
19
+ public getCode() : number | undefined {
20
+ return this.code;
21
+ }
22
+ }
@@ -0,0 +1,48 @@
1
+ import JSONObject from "../instances/JSONObject";
2
+
3
+ export default class JSONArray {
4
+ innerList: Array<any>;
5
+
6
+ constructor(value?: any) {
7
+ if (value && typeof value === "string") {
8
+ this.innerList = JSON.parse(value).map((item: any) => this.wrapValue(item));
9
+ } else if (value && Array.isArray(value)) {
10
+ this.innerList = value.map((item: any) => this.wrapValue(item));
11
+ } else {
12
+ this.innerList = new Array<any>();
13
+ }
14
+ }
15
+
16
+ private wrapValue(value: any): any {
17
+ if (Array.isArray(value)) {
18
+ return new JSONArray(value);
19
+ } else if (value && JSONObject.isPlainObject(value)) {
20
+ return new JSONObject(value);
21
+ }
22
+ return value;
23
+ }
24
+
25
+ public length(): number {
26
+ return this.innerList.length;
27
+ }
28
+
29
+ public put(item: any) {
30
+ this.innerList.push(this.wrapValue(item));
31
+ }
32
+
33
+ public get(index: number): any {
34
+ return this.innerList[index];
35
+ }
36
+
37
+ public toString(): string {
38
+ const replacer = (key: string, value: any): any => {
39
+ if (value instanceof JSONObject) {
40
+ return value.innerMap;
41
+ } else if (value instanceof JSONArray) {
42
+ return value.innerList;
43
+ }
44
+ return value;
45
+ };
46
+ return JSON.stringify(this.innerList, replacer);
47
+ }
48
+ }
@@ -0,0 +1,109 @@
1
+ import JSONArray from "../instances/JSONArray";
2
+
3
+ export default class JSONObject {
4
+ innerMap: { [key: string]: any };
5
+
6
+ constructor(value?: any) {
7
+ let map: { [key: string]: any };
8
+ if (value && typeof value === "string") {
9
+ map = JSON.parse(value);
10
+ } else if (value && typeof value === "object" && !Array.isArray(value)) {
11
+ map = {};
12
+ const keySet = value instanceof JSONObject ? value.keySet() : Object.keys(value);
13
+ for (const key of keySet) {
14
+ const item = value instanceof JSONObject ? value.get(key) : value[key];
15
+ if (Array.isArray(item)) {
16
+ map[key] = new JSONArray(item);
17
+ } else if (JSONObject.isPlainObject(item)) {
18
+ map[key] = new JSONObject(item);
19
+ } else {
20
+ map[key] = item;
21
+ }
22
+ }
23
+ } else {
24
+ map = {};
25
+ }
26
+ this.innerMap = map;
27
+ }
28
+
29
+ public static isPlainObject(value: any): boolean {
30
+ if (!value || typeof value !== "object") return false;
31
+ if (value instanceof JSONObject || value instanceof JSONArray) {
32
+ return false
33
+ }
34
+ const proto = Object.getPrototypeOf(value);
35
+ return proto === Object.prototype || proto === null;
36
+ }
37
+
38
+ public put(key: string, value: any) {
39
+ if (Array.isArray(value)) {
40
+ this.innerMap[key] = new JSONArray(value);
41
+ } else if (JSONObject.isPlainObject(value)) {
42
+ this.innerMap[key] = new JSONObject(value);
43
+ } else {
44
+ this.innerMap[key] = value;
45
+ }
46
+ }
47
+
48
+ public get(key: string): any {
49
+ return this.innerMap[key];
50
+ }
51
+
52
+ public opt(key: string): any {
53
+ return key == null ? null : this.innerMap[key];
54
+ }
55
+
56
+ public optString(key: string, defaultValue: string): string {
57
+ const result = this.opt(key);
58
+ return result ? result : defaultValue;
59
+ }
60
+
61
+ public getBoolean(key: string): boolean {
62
+ const object = this.get(key);
63
+ if (typeof object === "boolean") {
64
+ return object as boolean;
65
+ } else {
66
+ return Boolean(object);
67
+ }
68
+ }
69
+
70
+ public optBoolean(key: string, defaultValue: boolean): boolean {
71
+ const val = this.opt(key);
72
+ if (!val) {
73
+ return defaultValue;
74
+ }
75
+ return this.getBoolean(key);
76
+ }
77
+
78
+ public getInt(key: string): number {
79
+ return this.innerMap[key] as number;
80
+ }
81
+
82
+ public getJSONObject(key: string): JSONObject {
83
+ return this.innerMap[key] as JSONObject;
84
+ }
85
+
86
+ public getJSONArray(key: string): JSONArray {
87
+ return this.innerMap[key] as JSONArray;
88
+ }
89
+
90
+ public has(key: string): boolean {
91
+ return this.innerMap.hasOwnProperty(key);
92
+ }
93
+
94
+ public keySet(): string[] {
95
+ return Object.keys(this.innerMap);
96
+ }
97
+
98
+ public toString(): string {
99
+ const replacer = (key: string, value: any): any => {
100
+ if (value instanceof JSONObject) {
101
+ return value.innerMap;
102
+ } else if (value instanceof JSONArray) {
103
+ return value.innerList;
104
+ }
105
+ return value;
106
+ };
107
+ return JSON.stringify(this.innerMap, replacer);
108
+ }
109
+ }
@@ -0,0 +1,32 @@
1
+ // 自定义 Console 类
2
+ export default class LogicConsole {
3
+
4
+ public debug(...args: any[]): void {
5
+ const newArgs = this.convert(args);
6
+ console.debug(...newArgs);
7
+ }
8
+
9
+ public info(...args: any[]): void {
10
+ const newArgs = this.convert(args);
11
+ console.info(...newArgs);
12
+ }
13
+
14
+ public warn(...args: any[]): void {
15
+ const newArgs = this.convert(args);
16
+ console.warn(...newArgs);
17
+ }
18
+
19
+ public error(...args: any[]): void {
20
+ const newArgs = this.convert(args);
21
+ console.error(...newArgs);
22
+ }
23
+
24
+ private convert(args: any[]): any[] {
25
+ return args.map(arg => {
26
+ if (typeof arg === 'object' && arg !== null && typeof arg.toString === 'function') {
27
+ return arg.toString();
28
+ }
29
+ return arg;
30
+ })
31
+ }
32
+ }
@@ -52,10 +52,11 @@ routerResource.newDynamicStatistics = () => import('@vue2-client/pages/NewDynami
52
52
  routerResource.example = {
53
53
  path: 'example',
54
54
  name: '示例主页面',
55
+ // component: () => import('@vue2-client/base-client/components/common/XDescriptions/demo.vue'),
55
56
  // component: () => import('@vue2-client/base-client/components/common/XAddNativeForm/demo.vue'),
56
- // component: () => import('@vue2-client/base-client/components/common/XFormGroup/demo.vue'),
57
+ component: () => import('@vue2-client/base-client/components/common/XFormGroup/demo.vue'),
57
58
  // component: () => import('@vue2-client/base-client/components/common/XReport/XReportDemo.vue'),
58
- component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue'),
59
+ // component: () => import('@vue2-client/base-client/components/common/XFormTable/demo.vue'),
59
60
  // component: () => import('@vue2-client/base-client/components/common/XDatePicker/demo.vue'),
60
61
  // component: () => import('@vue2-client/base-client/components/common/XTab/XTabDemo.vue'),
61
62
  // component: () => import('@vue2-client/base-client/components/common/XReportGrid/XReportDemo.vue'),