not-bulma 1.0.95 → 1.0.97
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/package.json
CHANGED
|
@@ -79,7 +79,7 @@ class CRUDGenericActionCreate extends CRUDGenericAction {
|
|
|
79
79
|
this.bindUIEvent(controller, "submit", async (ev) => {
|
|
80
80
|
const success = await controller.onActionSubmit(this.ACTION, {
|
|
81
81
|
...this.loadDataQuery(controller, params),
|
|
82
|
-
...ev,
|
|
82
|
+
...ev.detail,
|
|
83
83
|
});
|
|
84
84
|
if (success) {
|
|
85
85
|
if (notCommon.isFunc(controller.goBack)) {
|
|
@@ -89,7 +89,7 @@ class CRUDGenericActionUpdate extends CRUDGenericAction {
|
|
|
89
89
|
this.bindUIEvent(controller, "submit", async (ev) => {
|
|
90
90
|
const success = await controller.onActionSubmit(this.ACTION, {
|
|
91
91
|
...this.loadDataQuery(controller, params),
|
|
92
|
-
...ev,
|
|
92
|
+
...ev.detail,
|
|
93
93
|
});
|
|
94
94
|
if (success) {
|
|
95
95
|
if (notCommon.isFunc(controller.goBack)) {
|
package/src/frame/record.js
CHANGED
|
@@ -1,102 +1,117 @@
|
|
|
1
|
-
import notBase from
|
|
2
|
-
import notCommon from
|
|
1
|
+
import notBase from "./base.js";
|
|
2
|
+
import notCommon from "./common.js";
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from
|
|
5
|
+
META_INTERFACE,
|
|
6
|
+
META_MAP_TO_INTERFACE,
|
|
7
|
+
DEFAULT_ACTION_PREFIX,
|
|
8
|
+
} from "./options";
|
|
9
9
|
|
|
10
|
-
import notInterface from
|
|
10
|
+
import notInterface from "./interface";
|
|
11
11
|
|
|
12
12
|
class notRecord extends notBase {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
13
|
+
constructor(manifest, item) {
|
|
14
|
+
super();
|
|
15
|
+
if (
|
|
16
|
+
typeof item === "undefined" ||
|
|
17
|
+
item === null ||
|
|
18
|
+
typeof item !== "object"
|
|
19
|
+
) {
|
|
20
|
+
return item;
|
|
21
|
+
}
|
|
22
|
+
if (item && item.isProxy) {
|
|
23
|
+
notCommon.error("this is Proxy item");
|
|
24
|
+
return item;
|
|
25
|
+
}
|
|
26
|
+
if (item && (item.isRecord || item.isProperty)) {
|
|
27
|
+
return item;
|
|
28
|
+
} else {
|
|
29
|
+
if (Array.isArray(item)) {
|
|
30
|
+
return this.createCollection(manifest, item);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
this.setOptions({});
|
|
34
|
+
this[META_INTERFACE] = new notInterface(manifest, {});
|
|
35
|
+
this.setData(item);
|
|
36
|
+
this.interfaceUp();
|
|
37
|
+
this.mapToInterface();
|
|
38
|
+
this.mapToMethods();
|
|
39
|
+
return this;
|
|
28
40
|
}
|
|
29
|
-
this.setOptions({});
|
|
30
|
-
this[META_INTERFACE] = new notInterface(manifest, {});
|
|
31
|
-
this.setData(item);
|
|
32
|
-
this.interfaceUp();
|
|
33
|
-
this.mapToInterface();
|
|
34
|
-
this.mapToMethods();
|
|
35
|
-
return this;
|
|
36
|
-
}
|
|
37
41
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
mapToInterface() {
|
|
43
|
+
let rec = this;
|
|
44
|
+
for (let t of META_MAP_TO_INTERFACE) {
|
|
45
|
+
if (
|
|
46
|
+
this[META_INTERFACE][t] &&
|
|
47
|
+
typeof this[META_INTERFACE][t] === "function"
|
|
48
|
+
) {
|
|
49
|
+
this[t] = function () {
|
|
50
|
+
let res = rec[META_INTERFACE][t](...arguments);
|
|
51
|
+
return res == rec[META_INTERFACE] ? rec : res;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
47
55
|
}
|
|
48
|
-
}
|
|
49
56
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
57
|
+
mapToMethods() {
|
|
58
|
+
let manifest = this[META_INTERFACE].manifest,
|
|
59
|
+
app = notCommon.getApp(),
|
|
60
|
+
methods = {};
|
|
61
|
+
if (manifest.methods) {
|
|
62
|
+
methods = manifest.methods;
|
|
63
|
+
} else if (app) {
|
|
64
|
+
methods = app.getOptions(
|
|
65
|
+
["models", this[META_INTERFACE].manifest.model].join("."),
|
|
66
|
+
{}
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
if (methods) {
|
|
70
|
+
for (let t in methods) {
|
|
71
|
+
if (Object.prototype.hasOwnProperty.call(methods, t)) {
|
|
72
|
+
this[t] = methods[t];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
63
75
|
}
|
|
64
|
-
}
|
|
65
76
|
}
|
|
66
|
-
}
|
|
67
77
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
78
|
+
createCollection(manifest, items) {
|
|
79
|
+
var collection = [];
|
|
80
|
+
for (var i = 0; i < items.length; i++) {
|
|
81
|
+
collection.push(new notRecord(manifest, items[i]));
|
|
82
|
+
}
|
|
83
|
+
return collection;
|
|
72
84
|
}
|
|
73
|
-
return collection;
|
|
74
|
-
}
|
|
75
85
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
86
|
+
interfaceUp() {
|
|
87
|
+
if (this[META_INTERFACE].getActionsCount() > 0) {
|
|
88
|
+
let actions = this[META_INTERFACE].getActions();
|
|
89
|
+
for (let i in actions) {
|
|
90
|
+
this.actionUp(i, actions[i]);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
82
93
|
}
|
|
83
|
-
}
|
|
84
94
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
95
|
+
actionUp(index) {
|
|
96
|
+
if (
|
|
97
|
+
!Object.prototype.hasOwnProperty.call(this, [
|
|
98
|
+
DEFAULT_ACTION_PREFIX + index,
|
|
99
|
+
])
|
|
100
|
+
) {
|
|
101
|
+
this[DEFAULT_ACTION_PREFIX + index] = (...params) =>
|
|
102
|
+
this[META_INTERFACE].request(this, index, ...params);
|
|
103
|
+
}
|
|
88
104
|
}
|
|
89
|
-
|
|
90
|
-
/*
|
|
105
|
+
/*
|
|
91
106
|
-> 'path.to.key', valueOfKey
|
|
92
107
|
<- ok, with one onChange event triggered
|
|
93
108
|
*/
|
|
94
109
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
110
|
+
setAttr(key, value) {
|
|
111
|
+
return this.setData(key, value);
|
|
112
|
+
}
|
|
98
113
|
|
|
99
|
-
|
|
114
|
+
/*
|
|
100
115
|
->
|
|
101
116
|
{
|
|
102
117
|
'keyPath': value,
|
|
@@ -105,56 +120,59 @@ class notRecord extends notBase {
|
|
|
105
120
|
}
|
|
106
121
|
<- ok, with bunch of onChange events triggered
|
|
107
122
|
*/
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
123
|
+
setAttrs(objectPart) {
|
|
124
|
+
//notCommon.log('setAttrs', objectPart, Object.keys(objectPart));
|
|
125
|
+
if (
|
|
126
|
+
objectPart &&
|
|
127
|
+
typeof objectPart === "object" &&
|
|
128
|
+
Object.keys(objectPart).length > 0
|
|
129
|
+
) {
|
|
130
|
+
for (let path in objectPart) {
|
|
131
|
+
//notCommon.log('setAttrs one to go', path);
|
|
132
|
+
this.setAttr(path, objectPart[path]);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
115
135
|
}
|
|
116
|
-
}
|
|
117
136
|
|
|
118
|
-
|
|
137
|
+
/*
|
|
119
138
|
-> 'pathToKey'
|
|
120
139
|
<- value1
|
|
121
140
|
*/
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
141
|
+
getAttr(what, plain = false) {
|
|
142
|
+
let prx = this.getData(what, {});
|
|
143
|
+
if (plain) {
|
|
144
|
+
return notCommon.stripProxy(prx);
|
|
145
|
+
} else {
|
|
146
|
+
return prx;
|
|
147
|
+
}
|
|
128
148
|
}
|
|
129
|
-
}
|
|
130
149
|
|
|
131
|
-
|
|
150
|
+
/*
|
|
132
151
|
-> ['pathToKey', 'path.to.key', 'simpleKey',...]
|
|
133
152
|
<- [value1, value2, value3,...]
|
|
134
153
|
*/
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
154
|
+
getAttrs(what) {
|
|
155
|
+
let result = [];
|
|
156
|
+
if (what && what.length > 0) {
|
|
157
|
+
for (let path of what) {
|
|
158
|
+
result.push(this.getAttr(path));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return result;
|
|
141
162
|
}
|
|
142
|
-
return result;
|
|
143
|
-
}
|
|
144
163
|
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
164
|
+
getManifest() {
|
|
165
|
+
if (this[META_INTERFACE]) {
|
|
166
|
+
return this[META_INTERFACE].manifest;
|
|
167
|
+
} else {
|
|
168
|
+
return {};
|
|
169
|
+
}
|
|
150
170
|
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
setItem(item) {
|
|
154
|
-
this.setData(item);
|
|
155
|
-
return this;
|
|
156
|
-
}
|
|
157
171
|
|
|
172
|
+
setItem(item) {
|
|
173
|
+
this.setData(item);
|
|
174
|
+
return this;
|
|
175
|
+
}
|
|
158
176
|
}
|
|
159
177
|
|
|
160
178
|
export default notRecord;
|