baja-lite 1.0.5 → 1.0.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.
- package/cjs/boot-remote.d.ts +2 -2
- package/cjs/code.js +19 -5
- package/cjs/convert-xml.js +3 -2
- package/cjs/fn.js +3 -3
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +1 -0
- package/cjs/list.d.ts +10 -0
- package/cjs/list.js +36 -0
- package/cjs/object.js +4 -4
- package/cjs/set-ex.d.ts +41 -15
- package/cjs/set-ex.js +68 -52
- package/cjs/sql.d.ts +391 -193
- package/cjs/sql.js +580 -287
- package/cjs/test-mysql.d.ts +1 -0
- package/cjs/test-mysql.js +15 -2
- package/es/boot-remote.d.ts +2 -2
- package/es/code.js +19 -5
- package/es/convert-xml.js +3 -2
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/list.d.ts +10 -0
- package/es/list.js +32 -0
- package/es/object.js +1 -1
- package/es/set-ex.d.ts +41 -15
- package/es/set-ex.js +68 -52
- package/es/sql.d.ts +391 -193
- package/es/sql.js +569 -277
- package/es/test-mysql.d.ts +1 -0
- package/es/test-mysql.js +15 -3
- package/package.json +8 -6
- package/src/boot-remote.ts +2 -2
- package/src/code.ts +24 -8
- package/src/convert-xml.ts +3 -2
- package/src/index.ts +2 -1
- package/src/list.ts +31 -0
- package/src/object.ts +3 -2
- package/src/set-ex.ts +91 -70
- package/src/sql.ts +647 -318
- package/src/test-mysql.ts +28 -9
package/cjs/test-mysql.d.ts
CHANGED
package/cjs/test-mysql.js
CHANGED
|
@@ -9,6 +9,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.go2 = go2;
|
|
12
13
|
require("reflect-metadata");
|
|
13
14
|
const boot_1 = require("./boot");
|
|
14
15
|
const sql_1 = require("./sql");
|
|
@@ -44,7 +45,7 @@ async function go2() {
|
|
|
44
45
|
database: 'dmce',
|
|
45
46
|
debug: false
|
|
46
47
|
},
|
|
47
|
-
log: '
|
|
48
|
+
log: 'info',
|
|
48
49
|
columnMode: sql_1.ColumnMode.HUMP,
|
|
49
50
|
sqlDir: 'E:/pro/baja-lite/xml'
|
|
50
51
|
});
|
|
@@ -112,6 +113,18 @@ async function go2() {
|
|
|
112
113
|
return 1;
|
|
113
114
|
}
|
|
114
115
|
});
|
|
115
|
-
await service.select({
|
|
116
|
+
const data = await service.select({
|
|
117
|
+
sql: 'SELECT resourceid, resourcepid,resourcename FROM cp_resource ',
|
|
118
|
+
params: {
|
|
119
|
+
site: '1234',
|
|
120
|
+
matchInfo: { reportType: 'yyyy', id: '11' }
|
|
121
|
+
},
|
|
122
|
+
// mapper: [
|
|
123
|
+
// ['site', ['info', 'bSist'], 989],
|
|
124
|
+
// ['site', ['info2', 'bSist'], 33],
|
|
125
|
+
// ['site', ['Bsite'], 0]
|
|
126
|
+
// ]
|
|
127
|
+
});
|
|
128
|
+
console.log(data);
|
|
116
129
|
}
|
|
117
130
|
go2();
|
package/es/boot-remote.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const BootRomote: (options:
|
|
1
|
+
import { GlobalSqlOptionForWeb } from './sql';
|
|
2
|
+
export declare const BootRomote: (options: GlobalSqlOptionForWeb) => Promise<void>;
|
package/es/code.js
CHANGED
|
@@ -74,6 +74,7 @@ console.log(`
|
|
|
74
74
|
"s": ["entity", "controller", "service", "sql", "module"]
|
|
75
75
|
},
|
|
76
76
|
"output": "{ClassName}Module",
|
|
77
|
+
"id"? : "uuidShort: true, notNull: true, uuid: true"
|
|
77
78
|
}
|
|
78
79
|
command是生成命令,这里声明命令同时定义文件生成路径:可用下面的变量替换.同时必须有同名模板.
|
|
79
80
|
路径是相对于项目根目录的
|
|
@@ -87,16 +88,18 @@ console.log(`
|
|
|
87
88
|
请在项目根目录的code-template添加模板文件, 按照mustache(标签定义成了[ '<%', '%>' ])进行格式化,变量:
|
|
88
89
|
title,
|
|
89
90
|
|
|
90
|
-
tableName,
|
|
91
|
-
className,
|
|
92
|
-
ClassName,
|
|
93
|
-
vueName,
|
|
94
|
-
splitName,
|
|
91
|
+
tableName, event_main_info
|
|
92
|
+
className, eventMainInfo
|
|
93
|
+
ClassName, EventMainInfo
|
|
94
|
+
vueName, event-main-info
|
|
95
|
+
splitName, event/main/info
|
|
96
|
+
SplitName, event/mainInfo
|
|
95
97
|
|
|
96
98
|
columns: [
|
|
97
99
|
comment:
|
|
98
100
|
name: sku_id
|
|
99
101
|
Name: skuId
|
|
102
|
+
NAME: SkuId
|
|
100
103
|
Field
|
|
101
104
|
Type
|
|
102
105
|
], Field(类型string),表示字段的注解, Type 表示JS类型
|
|
@@ -193,9 +196,13 @@ try {
|
|
|
193
196
|
if (r.notNull === true) {
|
|
194
197
|
fields.push(`notNull:true`);
|
|
195
198
|
}
|
|
199
|
+
if (r.id === true && configData.id) {
|
|
200
|
+
fields.push(configData.id);
|
|
201
|
+
}
|
|
196
202
|
r.Type = lxMap[r.type];
|
|
197
203
|
r.Field = `@Field({${fields.join(',')}})`;
|
|
198
204
|
r.Name = r.name.replace(/_(\w)/g, (a, b) => b.toUpperCase());
|
|
205
|
+
r.NAME = r.Name.replace(/\w/, (v) => v.toUpperCase());
|
|
199
206
|
return r;
|
|
200
207
|
});
|
|
201
208
|
conn.release();
|
|
@@ -218,6 +225,7 @@ try {
|
|
|
218
225
|
const ClassName = className.replace(/\w/, (v) => v.toUpperCase());
|
|
219
226
|
const vueName = tableName.replace(/_/g, '-');
|
|
220
227
|
const splitName = tableName.replace(/_/g, '/');
|
|
228
|
+
const SplitName = tableName.replace(/_/, '/').replace(/_(\w)/g, (a, b) => b.toUpperCase());
|
|
221
229
|
const data = {
|
|
222
230
|
title,
|
|
223
231
|
tableName,
|
|
@@ -225,16 +233,22 @@ try {
|
|
|
225
233
|
ClassName,
|
|
226
234
|
vueName,
|
|
227
235
|
splitName,
|
|
236
|
+
SplitName,
|
|
228
237
|
columns,
|
|
229
238
|
columnNames: columns?.map(i => i.name),
|
|
239
|
+
ColumnNames: columns?.map(i => i.Name),
|
|
230
240
|
columnNames_join: columns?.map(i => i.name).join(','),
|
|
231
241
|
ColumnNames_join: columns?.map(i => `${i.name} ${i.Name}`).join(','),
|
|
232
242
|
columns_no_id: columns?.filter(i => !i.id),
|
|
233
243
|
columnNames_no_id: columns?.filter(i => !i.id).map(i => i.name),
|
|
244
|
+
ColumnNames_no_id: columns?.filter(i => !i.id).map(i => i.Name),
|
|
234
245
|
columnNames_no_id_join: columns?.filter(i => !i.id).map(i => i.name).join(','),
|
|
246
|
+
ColumnNames_no_id_join: columns?.filter(i => !i.id).map(i => i.Name).join(','),
|
|
235
247
|
ids: columns?.filter(i => i.id),
|
|
236
248
|
idNames: columns?.filter(i => i.id).map(i => i.name),
|
|
249
|
+
IdNames: columns?.filter(i => i.id).map(i => i.Name),
|
|
237
250
|
idNames_join: columns?.filter(i => i.id).map(i => i.name).join(','),
|
|
251
|
+
IdNames_join: columns?.filter(i => i.id).map(i => i.Name).join(','),
|
|
238
252
|
modelName,
|
|
239
253
|
modelPath
|
|
240
254
|
};
|
package/es/convert-xml.js
CHANGED
|
@@ -124,8 +124,9 @@ const convertIf = function (children, param, parentIds, myBatisMapper) {
|
|
|
124
124
|
evalString = evalString.replace(/ and /gi, ' && ');
|
|
125
125
|
evalString = evalString.replace(/ or /gi, ' || ');
|
|
126
126
|
// replace == to === for strict evaluate
|
|
127
|
-
|
|
128
|
-
evalString = evalString.replace(
|
|
127
|
+
// TODO: fix != null & != ''
|
|
128
|
+
// evalString = evalString.replace(/==/g, '===');
|
|
129
|
+
// evalString = evalString.replace(/!=/g, '!==');
|
|
129
130
|
evalString = evalString.replace(/^'(.*?)'\.equalsIgnoreCase\( ([a-zA-Z]+\.[a-zA-Z]+) \)/i, `($2 && $2.toUpperCase() === '$1'.toUpperCase())`);
|
|
130
131
|
evalString = evalString.replace(/\('(.*?)'\.equalsIgnoreCase\( ([a-zA-Z]+\.[a-zA-Z]+) \)/i, `(($2 && $2.toUpperCase() === '$1'.toUpperCase())`);
|
|
131
132
|
}
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
package/es/list.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class ArrayList<T> extends Array<T> {
|
|
2
|
+
constructor(array?: Array<T> | T | undefined);
|
|
3
|
+
add(...items: T[]): void;
|
|
4
|
+
size(): number;
|
|
5
|
+
isEmpty(): boolean;
|
|
6
|
+
get(index: number): T | undefined;
|
|
7
|
+
clear(): void;
|
|
8
|
+
set(index: number, item: T): void;
|
|
9
|
+
remove(index: number): void;
|
|
10
|
+
}
|
package/es/list.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export class ArrayList extends Array {
|
|
2
|
+
constructor(array) {
|
|
3
|
+
super();
|
|
4
|
+
if (array instanceof Array) {
|
|
5
|
+
super.push(...array);
|
|
6
|
+
}
|
|
7
|
+
else if (typeof array !== 'undefined') {
|
|
8
|
+
super.push(array);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
add(...items) {
|
|
12
|
+
this.push(...items);
|
|
13
|
+
}
|
|
14
|
+
size() {
|
|
15
|
+
return this.length;
|
|
16
|
+
}
|
|
17
|
+
isEmpty() {
|
|
18
|
+
return this.length === 0;
|
|
19
|
+
}
|
|
20
|
+
get(index) {
|
|
21
|
+
return this[index];
|
|
22
|
+
}
|
|
23
|
+
clear() {
|
|
24
|
+
this.length = 0;
|
|
25
|
+
}
|
|
26
|
+
set(index, item) {
|
|
27
|
+
this[index] = item;
|
|
28
|
+
}
|
|
29
|
+
remove(index) {
|
|
30
|
+
this.splice(index, 1);
|
|
31
|
+
}
|
|
32
|
+
}
|
package/es/object.js
CHANGED
|
@@ -197,7 +197,7 @@ export const arraySplit = (datas, { everyLength = 0, groupCount = 0 } = {}) => {
|
|
|
197
197
|
const P2CEX = /[A-Z]/g;
|
|
198
198
|
export const P2C = (pro, IF = true) => IF ? pro.replace(P2CEX, (a) => `_${a.toLowerCase()}`) : pro;
|
|
199
199
|
const C2PEX = /_([a-z])/g;
|
|
200
|
-
export const C2P = (pro, IF = true) => IF ? pro.replace(C2PEX, (a, b) =>
|
|
200
|
+
export const C2P = (pro, IF = true) => IF ? pro.replace(C2PEX, (a, b) => `${b.toUpperCase()}`) : pro;
|
|
201
201
|
export function C2P2(datas) {
|
|
202
202
|
if (datas instanceof Array) {
|
|
203
203
|
return iterate(datas).map((data) => Object.fromEntries(Object.entries(data).map(([K, V]) => [C2P(K), V]))).toArray();
|
package/es/set-ex.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
export declare class SetEx<T> extends Set {
|
|
2
|
-
private
|
|
3
|
-
private
|
|
4
|
-
private
|
|
5
|
-
private
|
|
2
|
+
private _key;
|
|
3
|
+
private _onExist1?;
|
|
4
|
+
private _onNotExist1?;
|
|
5
|
+
private _replaceIfExits1;
|
|
6
|
+
private _onExist2?;
|
|
7
|
+
private _onNotExist2?;
|
|
8
|
+
private _replaceIfExits2;
|
|
6
9
|
/**
|
|
7
10
|
* @param key 识别是否存在的对象的属性名
|
|
8
11
|
* @param onExist 当存在时作何操作? oldData/newData 哪个将添加到set,由replaceItemWhenExits决定,默认是oldData生效
|
|
@@ -10,13 +13,22 @@ export declare class SetEx<T> extends Set {
|
|
|
10
13
|
* @param replaceWhenExits 当存在时是否覆盖?
|
|
11
14
|
* @param values 初始数组
|
|
12
15
|
*/
|
|
13
|
-
constructor(
|
|
16
|
+
constructor(option: {
|
|
14
17
|
key: keyof T;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
/** add&addAll触发 */
|
|
19
|
+
onExist1?: (oldData: T, newData: T) => void;
|
|
20
|
+
/** add&addAll触发 */
|
|
21
|
+
onNotExist1?: (newData: T) => void;
|
|
22
|
+
/** add&addAll触发 */
|
|
23
|
+
replaceIfExits1?: boolean;
|
|
24
|
+
/** add2&addAll2触发 */
|
|
25
|
+
onExist2?: (oldData: T, newData: T) => void;
|
|
26
|
+
/** add2&addAll2触发 */
|
|
27
|
+
onNotExist2?: (newData: T) => void;
|
|
28
|
+
/** add2&addAll2触发 */
|
|
29
|
+
replaceIfExits2?: boolean;
|
|
18
30
|
values?: ReadonlyArray<T> | null;
|
|
19
|
-
}
|
|
31
|
+
});
|
|
20
32
|
/**
|
|
21
33
|
*
|
|
22
34
|
* 添加返回
|
|
@@ -117,11 +129,21 @@ export declare class SetEx<T> extends Set {
|
|
|
117
129
|
* @param {(oldData: T, newData: T) => void} [onExist]
|
|
118
130
|
* @param {boolean} [replaceWhenExits=false]
|
|
119
131
|
*/
|
|
120
|
-
reset(
|
|
132
|
+
reset(option: {
|
|
121
133
|
key?: keyof T;
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
134
|
+
/** add&addAll触发 */
|
|
135
|
+
onExist1?: (oldData: T, newData: T) => void;
|
|
136
|
+
/** add&addAll触发 */
|
|
137
|
+
onNotExist1?: (newData: T) => void;
|
|
138
|
+
/** add&addAll触发 */
|
|
139
|
+
replaceIfExits1?: boolean;
|
|
140
|
+
/** add2&addAll2触发 */
|
|
141
|
+
onExist2?: (oldData: T, newData: T) => void;
|
|
142
|
+
/** add2&addAll2触发 */
|
|
143
|
+
onNotExist2?: (newData: T) => void;
|
|
144
|
+
/** add2&addAll2触发 */
|
|
145
|
+
replaceIfExits2?: boolean;
|
|
146
|
+
values?: ReadonlyArray<T> | null;
|
|
125
147
|
}): this;
|
|
126
148
|
/**
|
|
127
149
|
*
|
|
@@ -165,7 +187,11 @@ export declare class SetEx<T> extends Set {
|
|
|
165
187
|
name: T[keyof T];
|
|
166
188
|
}[];
|
|
167
189
|
};
|
|
168
|
-
set
|
|
190
|
+
set onExist1(onExist1: ((oldData: T, newData: T) => void) | undefined);
|
|
191
|
+
set onExist2(onExist2: ((oldData: T, newData: T) => void) | undefined);
|
|
192
|
+
set onNotExist1(onNotExist1: ((newData: T) => void) | undefined);
|
|
193
|
+
set onNotExist2(onNotExist2: ((newData: T) => void) | undefined);
|
|
194
|
+
set replaceIfExits1(replaceIfExits1: boolean);
|
|
195
|
+
set replaceIfExits2(replaceIfExits2: boolean);
|
|
169
196
|
set key(key: keyof T);
|
|
170
|
-
set replaceWhenExits(replaceWhenExits: boolean);
|
|
171
197
|
}
|
package/es/set-ex.js
CHANGED
|
@@ -6,25 +6,17 @@ export class SetEx extends Set {
|
|
|
6
6
|
* @param replaceWhenExits 当存在时是否覆盖?
|
|
7
7
|
* @param values 初始数组
|
|
8
8
|
*/
|
|
9
|
-
constructor(
|
|
9
|
+
constructor(option) {
|
|
10
10
|
super();
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
else {
|
|
21
|
-
this.whenOnExist = onExist;
|
|
22
|
-
this.uniqueKey = key;
|
|
23
|
-
this.replaceItemWhenExits = replaceWhenExits;
|
|
24
|
-
this.whenOnNotExist = onNotExist;
|
|
25
|
-
if (values) {
|
|
26
|
-
this.addAll(...values);
|
|
27
|
-
}
|
|
11
|
+
this._key = option.key;
|
|
12
|
+
this._onExist1 = option.onExist1;
|
|
13
|
+
this._onNotExist1 = option.onNotExist1;
|
|
14
|
+
this._replaceIfExits1 = option.replaceIfExits1 === true;
|
|
15
|
+
this._onExist2 = option.onExist2;
|
|
16
|
+
this._onNotExist2 = option.onNotExist2;
|
|
17
|
+
this._replaceIfExits2 = option.replaceIfExits2 === true;
|
|
18
|
+
if (option.values) {
|
|
19
|
+
this.addAll(...option.values);
|
|
28
20
|
}
|
|
29
21
|
}
|
|
30
22
|
/**
|
|
@@ -36,12 +28,12 @@ export class SetEx extends Set {
|
|
|
36
28
|
add(value) {
|
|
37
29
|
let flag = false;
|
|
38
30
|
this.forEach((item) => {
|
|
39
|
-
if (item[this.
|
|
31
|
+
if (item[this._key] === value[this._key]) {
|
|
40
32
|
flag = true;
|
|
41
|
-
if (this.
|
|
42
|
-
this.
|
|
33
|
+
if (this._onExist1) {
|
|
34
|
+
this._onExist1(item, value);
|
|
43
35
|
}
|
|
44
|
-
if (this.
|
|
36
|
+
if (this._replaceIfExits1 === true) {
|
|
45
37
|
super.delete(item);
|
|
46
38
|
flag = false;
|
|
47
39
|
}
|
|
@@ -50,8 +42,8 @@ export class SetEx extends Set {
|
|
|
50
42
|
});
|
|
51
43
|
if (flag === false) {
|
|
52
44
|
super.add(value);
|
|
53
|
-
if (this.
|
|
54
|
-
this.
|
|
45
|
+
if (this._onNotExist1) {
|
|
46
|
+
this._onNotExist1(value);
|
|
55
47
|
}
|
|
56
48
|
}
|
|
57
49
|
return this;
|
|
@@ -77,13 +69,13 @@ export class SetEx extends Set {
|
|
|
77
69
|
let flag = false;
|
|
78
70
|
let tmp = value;
|
|
79
71
|
this.forEach((item) => {
|
|
80
|
-
if (item[this.
|
|
72
|
+
if (item[this._key] === value[this._key]) {
|
|
81
73
|
flag = true;
|
|
82
|
-
if (this.
|
|
83
|
-
this.
|
|
74
|
+
if (this._onExist2) {
|
|
75
|
+
this._onExist2(item, value);
|
|
84
76
|
}
|
|
85
|
-
if (this.
|
|
86
|
-
super.delete(
|
|
77
|
+
if (this._replaceIfExits2 === true) {
|
|
78
|
+
super.delete(value);
|
|
87
79
|
flag = false;
|
|
88
80
|
}
|
|
89
81
|
else {
|
|
@@ -94,8 +86,8 @@ export class SetEx extends Set {
|
|
|
94
86
|
});
|
|
95
87
|
if (flag === false) {
|
|
96
88
|
super.add(value);
|
|
97
|
-
if (this.
|
|
98
|
-
this.
|
|
89
|
+
if (this._onNotExist2) {
|
|
90
|
+
this._onNotExist2(value);
|
|
99
91
|
}
|
|
100
92
|
}
|
|
101
93
|
return tmp;
|
|
@@ -120,7 +112,7 @@ export class SetEx extends Set {
|
|
|
120
112
|
*/
|
|
121
113
|
find(value) {
|
|
122
114
|
for (const item of this) {
|
|
123
|
-
if (item[this.
|
|
115
|
+
if (item[this._key] === value) {
|
|
124
116
|
return item;
|
|
125
117
|
}
|
|
126
118
|
}
|
|
@@ -134,7 +126,7 @@ export class SetEx extends Set {
|
|
|
134
126
|
findAll(value) {
|
|
135
127
|
const res = new Array();
|
|
136
128
|
this.forEach((item) => {
|
|
137
|
-
if (item[this.
|
|
129
|
+
if (item[this._key] === value) {
|
|
138
130
|
res.push(item);
|
|
139
131
|
}
|
|
140
132
|
});
|
|
@@ -177,7 +169,7 @@ export class SetEx extends Set {
|
|
|
177
169
|
*/
|
|
178
170
|
has(value) {
|
|
179
171
|
for (const item of this) {
|
|
180
|
-
if (item[this.
|
|
172
|
+
if (item[this._key] === value) {
|
|
181
173
|
return true;
|
|
182
174
|
}
|
|
183
175
|
}
|
|
@@ -222,7 +214,7 @@ export class SetEx extends Set {
|
|
|
222
214
|
*/
|
|
223
215
|
delete(value) {
|
|
224
216
|
for (const item of this) {
|
|
225
|
-
if (item[this.
|
|
217
|
+
if (item[this._key] === value) {
|
|
226
218
|
super.delete(item);
|
|
227
219
|
return true;
|
|
228
220
|
}
|
|
@@ -236,20 +228,32 @@ export class SetEx extends Set {
|
|
|
236
228
|
* @param {(oldData: T, newData: T) => void} [onExist]
|
|
237
229
|
* @param {boolean} [replaceWhenExits=false]
|
|
238
230
|
*/
|
|
239
|
-
reset(
|
|
240
|
-
|
|
241
|
-
|
|
231
|
+
reset(option) {
|
|
232
|
+
this.clear();
|
|
233
|
+
if (option.key) {
|
|
234
|
+
this._key = option.key;
|
|
242
235
|
}
|
|
243
|
-
if (
|
|
244
|
-
this.
|
|
236
|
+
if (option.onExist1) {
|
|
237
|
+
this._onExist1 = option.onExist1;
|
|
245
238
|
}
|
|
246
|
-
if (
|
|
247
|
-
this.
|
|
239
|
+
if (option.onNotExist1) {
|
|
240
|
+
this._onNotExist1 = option.onNotExist1;
|
|
248
241
|
}
|
|
249
|
-
if (
|
|
250
|
-
this.
|
|
242
|
+
if (option.replaceIfExits1) {
|
|
243
|
+
this._replaceIfExits1 = option.replaceIfExits1;
|
|
244
|
+
}
|
|
245
|
+
if (option.onExist2) {
|
|
246
|
+
this._onExist2 = option.onExist2;
|
|
247
|
+
}
|
|
248
|
+
if (option.onNotExist2) {
|
|
249
|
+
this._onNotExist2 = option.onNotExist2;
|
|
250
|
+
}
|
|
251
|
+
if (option.replaceIfExits2) {
|
|
252
|
+
this._replaceIfExits2 = option.replaceIfExits2;
|
|
253
|
+
}
|
|
254
|
+
if (option.values) {
|
|
255
|
+
this.addAll(...option.values);
|
|
251
256
|
}
|
|
252
|
-
this.clear();
|
|
253
257
|
return this;
|
|
254
258
|
}
|
|
255
259
|
/**
|
|
@@ -310,7 +314,7 @@ export class SetEx extends Set {
|
|
|
310
314
|
const result = {};
|
|
311
315
|
const list = this.toArray({ sort, each, filter, map });
|
|
312
316
|
for (const item of list) {
|
|
313
|
-
const name = item[this.
|
|
317
|
+
const name = item[this._key];
|
|
314
318
|
for (const key in item) {
|
|
315
319
|
if (!result[key]) {
|
|
316
320
|
result[key] = [];
|
|
@@ -320,13 +324,25 @@ export class SetEx extends Set {
|
|
|
320
324
|
}
|
|
321
325
|
return result;
|
|
322
326
|
}
|
|
323
|
-
set
|
|
324
|
-
this.
|
|
327
|
+
set onExist1(onExist1) {
|
|
328
|
+
this._onExist1 = onExist1;
|
|
325
329
|
}
|
|
326
|
-
set
|
|
327
|
-
this.
|
|
330
|
+
set onExist2(onExist2) {
|
|
331
|
+
this._onExist2 = onExist2;
|
|
332
|
+
}
|
|
333
|
+
set onNotExist1(onNotExist1) {
|
|
334
|
+
this._onNotExist1 = onNotExist1;
|
|
328
335
|
}
|
|
329
|
-
set
|
|
330
|
-
this.
|
|
336
|
+
set onNotExist2(onNotExist2) {
|
|
337
|
+
this._onNotExist2 = onNotExist2;
|
|
338
|
+
}
|
|
339
|
+
set replaceIfExits1(replaceIfExits1) {
|
|
340
|
+
this._replaceIfExits1 = replaceIfExits1;
|
|
341
|
+
}
|
|
342
|
+
set replaceIfExits2(replaceIfExits2) {
|
|
343
|
+
this._replaceIfExits2 = replaceIfExits2;
|
|
344
|
+
}
|
|
345
|
+
set key(key) {
|
|
346
|
+
this._key = key;
|
|
331
347
|
}
|
|
332
348
|
}
|