oak-domain 1.1.11 → 1.1.13
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/lib/store/CascadeStore.js +3 -3
- package/lib/store/modi.js +4 -33
- package/lib/triggers/modi.js +12 -22
- package/lib/utils/lodash.d.ts +1 -16
- package/lib/utils/lodash.js +31 -31
- package/package.json +1 -1
|
@@ -60,7 +60,7 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
60
60
|
};
|
|
61
61
|
CascadeStore.prototype.reduceDescendants = function (entity, rows) {
|
|
62
62
|
var _this = this;
|
|
63
|
-
return rows.map(function (row) {
|
|
63
|
+
return rows.filter(function (ele) { return !!ele; }).map(function (row) {
|
|
64
64
|
var _a;
|
|
65
65
|
var row2 = {};
|
|
66
66
|
for (var attr in row) {
|
|
@@ -128,7 +128,7 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
128
128
|
subCascadeSelectionFns.forEach(function (ele) { return cascadeSelectionFns.push(function (result) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
129
129
|
return tslib_1.__generator(this, function (_a) {
|
|
130
130
|
switch (_a.label) {
|
|
131
|
-
case 0: return [4 /*yield*/, ele(result.map(function (ele2) { return ele2[attr]; }))];
|
|
131
|
+
case 0: return [4 /*yield*/, ele(result.map(function (ele2) { return ele2[attr]; }).filter(function (ele2) { return !!ele2; }))];
|
|
132
132
|
case 1:
|
|
133
133
|
_a.sent();
|
|
134
134
|
return [2 /*return*/];
|
|
@@ -222,7 +222,7 @@ var CascadeStore = /** @class */ (function (_super) {
|
|
|
222
222
|
subCascadeSelectionFns.forEach(function (ele) { return cascadeSelectionFns.push(function (result) { return tslib_1.__awaiter(_this, void 0, void 0, function () {
|
|
223
223
|
return tslib_1.__generator(this, function (_a) {
|
|
224
224
|
switch (_a.label) {
|
|
225
|
-
case 0: return [4 /*yield*/, ele(result.map(function (ele2) { return ele2[attr]; }))];
|
|
225
|
+
case 0: return [4 /*yield*/, ele(result.map(function (ele2) { return ele2[attr]; }).filter(function (ele2) { return !!ele2; }))];
|
|
226
226
|
case 1:
|
|
227
227
|
_a.sent();
|
|
228
228
|
return [2 /*return*/];
|
package/lib/store/modi.js
CHANGED
|
@@ -21,48 +21,19 @@ function createOperationsFromModies(modies) {
|
|
|
21
21
|
exports.createOperationsFromModies = createOperationsFromModies;
|
|
22
22
|
function applyModis(filter, context, option) {
|
|
23
23
|
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
|
24
|
-
var
|
|
24
|
+
var _a, _b, _c;
|
|
25
25
|
var _d;
|
|
26
26
|
return tslib_1.__generator(this, function (_e) {
|
|
27
27
|
switch (_e.label) {
|
|
28
|
-
case 0:
|
|
29
|
-
data: {
|
|
30
|
-
id: 1,
|
|
31
|
-
},
|
|
32
|
-
filter: filter,
|
|
33
|
-
sorter: [
|
|
34
|
-
{
|
|
35
|
-
$attr: {
|
|
36
|
-
$$createAt$$: 1,
|
|
37
|
-
},
|
|
38
|
-
$direction: 'asc',
|
|
39
|
-
}
|
|
40
|
-
]
|
|
41
|
-
}, context, Object.assign({}, option, {
|
|
42
|
-
blockTrigger: false,
|
|
43
|
-
}))];
|
|
44
|
-
case 1:
|
|
45
|
-
modis = (_e.sent()).result;
|
|
28
|
+
case 0:
|
|
46
29
|
_b = (_a = context.rowStore).operate;
|
|
47
30
|
_c = ['modi'];
|
|
48
31
|
_d = {};
|
|
49
32
|
return [4 /*yield*/, generateNewId()];
|
|
50
|
-
case
|
|
33
|
+
case 1: return [2 /*return*/, _b.apply(_a, _c.concat([(_d.id = _e.sent(),
|
|
51
34
|
_d.action = 'apply',
|
|
52
35
|
_d.data = {},
|
|
53
|
-
_d.filter =
|
|
54
|
-
id: {
|
|
55
|
-
$in: modis.map(function (ele) { return ele.id; }),
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
_d.sorter = [
|
|
59
|
-
{
|
|
60
|
-
$attr: {
|
|
61
|
-
$$createAt$$: 1,
|
|
62
|
-
},
|
|
63
|
-
$direction: 'asc',
|
|
64
|
-
}
|
|
65
|
-
],
|
|
36
|
+
_d.filter = filter,
|
|
66
37
|
_d), context, Object.assign({}, option, {
|
|
67
38
|
blockTrigger: false,
|
|
68
39
|
})]))];
|
package/lib/triggers/modi.js
CHANGED
|
@@ -10,7 +10,7 @@ var triggers = [
|
|
|
10
10
|
fn: function (_a, context, option) {
|
|
11
11
|
var operation = _a.operation;
|
|
12
12
|
return tslib_1.__awaiter(void 0, void 0, void 0, function () {
|
|
13
|
-
var filter, modies, modies_1, modies_1_1, modi, targetEntity, id, action, data, filter_1,
|
|
13
|
+
var filter, modies, modies_1, modies_1_1, modi, targetEntity, id, action, data, filter_1, e_1_1;
|
|
14
14
|
var e_1, _b;
|
|
15
15
|
return tslib_1.__generator(this, function (_c) {
|
|
16
16
|
switch (_c.label) {
|
|
@@ -30,49 +30,39 @@ var triggers = [
|
|
|
30
30
|
modies = (_c.sent()).result;
|
|
31
31
|
_c.label = 2;
|
|
32
32
|
case 2:
|
|
33
|
-
_c.trys.push([2, 8, 9
|
|
33
|
+
_c.trys.push([2, 7, 8, 9]);
|
|
34
34
|
modies_1 = tslib_1.__values(modies), modies_1_1 = modies_1.next();
|
|
35
35
|
_c.label = 3;
|
|
36
36
|
case 3:
|
|
37
|
-
if (!!modies_1_1.done) return [3 /*break*/,
|
|
37
|
+
if (!!modies_1_1.done) return [3 /*break*/, 6];
|
|
38
38
|
modi = modies_1_1.value;
|
|
39
39
|
targetEntity = modi.targetEntity, id = modi.id, action = modi.action, data = modi.data, filter_1 = modi.filter;
|
|
40
|
-
return [4 /*yield*/, context.rowStore.select(targetEntity, {
|
|
41
|
-
data: {
|
|
42
|
-
id: 1,
|
|
43
|
-
},
|
|
44
|
-
filter: filter_1,
|
|
45
|
-
}, context, Object.assign({}, option, {
|
|
46
|
-
blockTrigger: true,
|
|
47
|
-
}))];
|
|
48
|
-
case 4:
|
|
49
|
-
targets = _c.sent();
|
|
50
40
|
return [4 /*yield*/, context.rowStore.operate(targetEntity, {
|
|
51
41
|
id: id,
|
|
52
42
|
action: action,
|
|
53
43
|
data: data,
|
|
54
|
-
filter:
|
|
44
|
+
filter: filter_1,
|
|
55
45
|
}, context, Object.assign({}, option, {
|
|
56
46
|
blockTrigger: true,
|
|
57
47
|
}))];
|
|
58
|
-
case
|
|
48
|
+
case 4:
|
|
59
49
|
_c.sent();
|
|
60
|
-
_c.label =
|
|
61
|
-
case
|
|
50
|
+
_c.label = 5;
|
|
51
|
+
case 5:
|
|
62
52
|
modies_1_1 = modies_1.next();
|
|
63
53
|
return [3 /*break*/, 3];
|
|
64
|
-
case
|
|
65
|
-
case
|
|
54
|
+
case 6: return [3 /*break*/, 9];
|
|
55
|
+
case 7:
|
|
66
56
|
e_1_1 = _c.sent();
|
|
67
57
|
e_1 = { error: e_1_1 };
|
|
68
|
-
return [3 /*break*/,
|
|
69
|
-
case
|
|
58
|
+
return [3 /*break*/, 9];
|
|
59
|
+
case 8:
|
|
70
60
|
try {
|
|
71
61
|
if (modies_1_1 && !modies_1_1.done && (_b = modies_1.return)) _b.call(modies_1);
|
|
72
62
|
}
|
|
73
63
|
finally { if (e_1) throw e_1.error; }
|
|
74
64
|
return [7 /*endfinally*/];
|
|
75
|
-
case
|
|
65
|
+
case 9: return [2 /*return*/, modies.length];
|
|
76
66
|
}
|
|
77
67
|
});
|
|
78
68
|
});
|
package/lib/utils/lodash.d.ts
CHANGED
|
@@ -2,19 +2,4 @@
|
|
|
2
2
|
* 避免lodash打包体积过大
|
|
3
3
|
* 像assign, keys尽量使用Object的函数
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
import uniqBy from 'lodash/uniqBy';
|
|
7
|
-
import pull from 'lodash/pull';
|
|
8
|
-
import uniq from 'lodash/uniq';
|
|
9
|
-
import get from 'lodash/get';
|
|
10
|
-
import set from 'lodash/set';
|
|
11
|
-
import intersection from 'lodash/intersection';
|
|
12
|
-
import omit from 'lodash/omit';
|
|
13
|
-
import merge from 'lodash/merge';
|
|
14
|
-
import cloneDeep from 'lodash/cloneDeep';
|
|
15
|
-
import pick from 'lodash/pick';
|
|
16
|
-
import isEqual from 'lodash/isEqual';
|
|
17
|
-
import union from 'lodash/union';
|
|
18
|
-
import difference from 'lodash/difference';
|
|
19
|
-
import groupBy from 'lodash/groupBy';
|
|
20
|
-
export { unset, pull, uniq, uniqBy, get, set, intersection, omit, merge, cloneDeep, pick, isEqual, union, difference, groupBy, };
|
|
5
|
+
export { unset, pull, uniq, uniqBy, get, set, intersection, omit, merge, cloneDeep, pick, isEqual, union, difference, groupBy, } from 'lodash';
|
package/lib/utils/lodash.js
CHANGED
|
@@ -1,38 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.groupBy = exports.difference = exports.union = exports.isEqual = exports.pick = exports.cloneDeep = exports.merge = exports.omit = exports.intersection = exports.set = exports.get = exports.uniqBy = exports.uniq = exports.pull = exports.unset = void 0;
|
|
4
|
-
var tslib_1 = require("tslib");
|
|
5
4
|
/**
|
|
6
5
|
* 避免lodash打包体积过大
|
|
7
6
|
* 像assign, keys尽量使用Object的函数
|
|
8
7
|
*/
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
exports
|
|
27
|
-
|
|
28
|
-
exports
|
|
29
|
-
|
|
30
|
-
exports
|
|
31
|
-
|
|
32
|
-
exports
|
|
33
|
-
|
|
34
|
-
exports
|
|
35
|
-
|
|
36
|
-
exports
|
|
37
|
-
|
|
38
|
-
exports
|
|
8
|
+
/* import unset from 'lodash/unset';
|
|
9
|
+
import uniqBy from 'lodash/uniqBy';
|
|
10
|
+
import pull from 'lodash/pull';
|
|
11
|
+
import uniq from 'lodash/uniq';
|
|
12
|
+
import get from 'lodash/get';
|
|
13
|
+
import set from 'lodash/set';
|
|
14
|
+
import intersection from 'lodash/intersection';
|
|
15
|
+
import omit from 'lodash/omit';
|
|
16
|
+
import merge from 'lodash/merge';
|
|
17
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
18
|
+
import pick from 'lodash/pick';
|
|
19
|
+
import isEqual from 'lodash/isEqual';
|
|
20
|
+
import union from 'lodash/union';
|
|
21
|
+
import difference from 'lodash/difference';
|
|
22
|
+
import groupBy from 'lodash/groupBy'; */
|
|
23
|
+
var lodash_1 = require("lodash");
|
|
24
|
+
Object.defineProperty(exports, "unset", { enumerable: true, get: function () { return lodash_1.unset; } });
|
|
25
|
+
Object.defineProperty(exports, "pull", { enumerable: true, get: function () { return lodash_1.pull; } });
|
|
26
|
+
Object.defineProperty(exports, "uniq", { enumerable: true, get: function () { return lodash_1.uniq; } });
|
|
27
|
+
Object.defineProperty(exports, "uniqBy", { enumerable: true, get: function () { return lodash_1.uniqBy; } });
|
|
28
|
+
Object.defineProperty(exports, "get", { enumerable: true, get: function () { return lodash_1.get; } });
|
|
29
|
+
Object.defineProperty(exports, "set", { enumerable: true, get: function () { return lodash_1.set; } });
|
|
30
|
+
Object.defineProperty(exports, "intersection", { enumerable: true, get: function () { return lodash_1.intersection; } });
|
|
31
|
+
Object.defineProperty(exports, "omit", { enumerable: true, get: function () { return lodash_1.omit; } });
|
|
32
|
+
Object.defineProperty(exports, "merge", { enumerable: true, get: function () { return lodash_1.merge; } });
|
|
33
|
+
Object.defineProperty(exports, "cloneDeep", { enumerable: true, get: function () { return lodash_1.cloneDeep; } });
|
|
34
|
+
Object.defineProperty(exports, "pick", { enumerable: true, get: function () { return lodash_1.pick; } });
|
|
35
|
+
Object.defineProperty(exports, "isEqual", { enumerable: true, get: function () { return lodash_1.isEqual; } });
|
|
36
|
+
Object.defineProperty(exports, "union", { enumerable: true, get: function () { return lodash_1.union; } });
|
|
37
|
+
Object.defineProperty(exports, "difference", { enumerable: true, get: function () { return lodash_1.difference; } });
|
|
38
|
+
Object.defineProperty(exports, "groupBy", { enumerable: true, get: function () { return lodash_1.groupBy; } });
|