not-bulma 1.0.46 → 1.0.47
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 +1 -1
- package/src/frame/common.js +617 -553
- package/src/frame/components/navigation/side/index.js +16 -3
- package/src/scss/_menu.scss +8 -0
package/package.json
CHANGED
package/src/frame/common.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import notPath from
|
|
1
|
+
import notPath from "not-path";
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
https://github.com/TehShrike/is-mergeable-object
|
|
@@ -9,27 +9,29 @@ start of my code marked.
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
let isMergeableObject = function isMergeableObject(value) {
|
|
12
|
-
|
|
12
|
+
return isNonNullObject(value) && !isSpecial(value);
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
function isNonNullObject(value) {
|
|
16
|
-
|
|
16
|
+
return !!value && typeof value === "object";
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
function isSpecial(value) {
|
|
20
|
-
|
|
20
|
+
var stringValue = Object.prototype.toString.call(value);
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
return (
|
|
23
|
+
stringValue === "[object RegExp]" ||
|
|
24
|
+
stringValue === "[object Date]" ||
|
|
25
|
+
isReactElement(value)
|
|
26
|
+
);
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
|
|
28
|
-
var canUseSymbol = typeof Symbol ===
|
|
29
|
-
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for(
|
|
30
|
+
var canUseSymbol = typeof Symbol === "function" && Symbol.for;
|
|
31
|
+
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 0xeac7;
|
|
30
32
|
|
|
31
33
|
function isReactElement(value) {
|
|
32
|
-
|
|
34
|
+
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
33
35
|
}
|
|
34
36
|
|
|
35
37
|
/*
|
|
@@ -58,618 +60,680 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
58
60
|
THE SOFTWARE.
|
|
59
61
|
*/
|
|
60
62
|
|
|
61
|
-
|
|
62
63
|
function emptyTarget(val) {
|
|
63
|
-
|
|
64
|
+
return Array.isArray(val) ? [] : {};
|
|
64
65
|
}
|
|
65
66
|
|
|
66
67
|
function cloneUnlessOtherwiseSpecified(value, optionsArgument) {
|
|
67
|
-
|
|
68
|
+
var clone = !optionsArgument || optionsArgument.clone !== false;
|
|
68
69
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
return clone && isMergeableObject(value)
|
|
71
|
+
? deepmerge(emptyTarget(value), value, optionsArgument)
|
|
72
|
+
: value;
|
|
72
73
|
}
|
|
73
74
|
|
|
74
75
|
function defaultArrayMerge(target, source, optionsArgument) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
return target.concat(source).map(function (element) {
|
|
77
|
+
return cloneUnlessOtherwiseSpecified(element, optionsArgument);
|
|
78
|
+
});
|
|
78
79
|
}
|
|
79
80
|
|
|
80
81
|
function mergeObject(target, source, optionsArgument) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
destination[key] = cloneUnlessOtherwiseSpecified(source[key], optionsArgument);
|
|
90
|
-
} else {
|
|
91
|
-
destination[key] = deepmerge(target[key], source[key], optionsArgument);
|
|
82
|
+
var destination = {};
|
|
83
|
+
if (isMergeableObject(target)) {
|
|
84
|
+
Object.keys(target).forEach(function (key) {
|
|
85
|
+
destination[key] = cloneUnlessOtherwiseSpecified(
|
|
86
|
+
target[key],
|
|
87
|
+
optionsArgument
|
|
88
|
+
);
|
|
89
|
+
});
|
|
92
90
|
}
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
Object.keys(source).forEach(function (key) {
|
|
92
|
+
if (!isMergeableObject(source[key]) || !target[key]) {
|
|
93
|
+
destination[key] = cloneUnlessOtherwiseSpecified(
|
|
94
|
+
source[key],
|
|
95
|
+
optionsArgument
|
|
96
|
+
);
|
|
97
|
+
} else {
|
|
98
|
+
destination[key] = deepmerge(
|
|
99
|
+
target[key],
|
|
100
|
+
source[key],
|
|
101
|
+
optionsArgument
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
return destination;
|
|
95
106
|
}
|
|
96
107
|
|
|
97
108
|
function deepmerge(target, source, optionsArgument) {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
109
|
+
var sourceIsArray = Array.isArray(source);
|
|
110
|
+
var targetIsArray = Array.isArray(target);
|
|
111
|
+
var options = optionsArgument || {
|
|
112
|
+
arrayMerge: defaultArrayMerge,
|
|
113
|
+
};
|
|
114
|
+
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
115
|
+
|
|
116
|
+
if (!sourceAndTargetTypesMatch) {
|
|
117
|
+
return cloneUnlessOtherwiseSpecified(source, optionsArgument);
|
|
118
|
+
} else if (sourceIsArray) {
|
|
119
|
+
var arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
120
|
+
return arrayMerge(target, source, optionsArgument);
|
|
121
|
+
} else {
|
|
122
|
+
return mergeObject(target, source, optionsArgument);
|
|
123
|
+
}
|
|
113
124
|
}
|
|
114
125
|
|
|
115
126
|
deepmerge.all = function deepmergeAll(array, optionsArgument) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
127
|
+
if (!Array.isArray(array)) {
|
|
128
|
+
throw new Error("first argument should be an array");
|
|
129
|
+
}
|
|
119
130
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
131
|
+
return array.reduce(function (prev, next) {
|
|
132
|
+
return deepmerge(prev, next, optionsArgument);
|
|
133
|
+
}, {});
|
|
123
134
|
};
|
|
124
135
|
|
|
125
|
-
|
|
126
136
|
class notCommon {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
137
|
+
static MANAGER = null;
|
|
138
|
+
static LOG = "console";
|
|
139
|
+
|
|
140
|
+
static deepMerge = deepmerge;
|
|
141
|
+
|
|
142
|
+
static isError(e) {
|
|
143
|
+
return (
|
|
144
|
+
e instanceof Error ||
|
|
145
|
+
(Object.prototype.hasOwnProperty.call(e, "status") &&
|
|
146
|
+
e.status === "error")
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
static TZ_OFFSET = (new Date().getTimezoneOffset() / 60) * -1;
|
|
151
|
+
static DEV_ENV = "production";
|
|
152
|
+
static ENV_TYPE = window.NOT_ENV_TYPE ? window.NOT_ENV_TYPE : this.DEV_ENV;
|
|
153
|
+
static NOOP = () => {};
|
|
154
|
+
|
|
155
|
+
static mute() {
|
|
156
|
+
this.ENV_TYPE = "production";
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
static pad(n) {
|
|
160
|
+
return n < 10 ? "0" + n : n;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Returns today Date object without hours, minutes, seconds
|
|
164
|
+
* @return {number} current date with 00:00:00 in ms of unix time
|
|
165
|
+
*/
|
|
166
|
+
static getTodayDate() {
|
|
167
|
+
let t = new Date();
|
|
168
|
+
return new Date(t.getFullYear(), t.getMonth(), t.getDate()).getTime();
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Returns true if object has field of name
|
|
173
|
+
* @param {object} obj some object
|
|
174
|
+
* @param {string} name field name
|
|
175
|
+
* @return {boolean} if object contains field with name
|
|
176
|
+
**/
|
|
177
|
+
static objHas(obj, name) {
|
|
178
|
+
return Object.prototype.hasOwnProperty.call(obj, name);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Copies object to secure it from changes
|
|
183
|
+
* @param {object} obj original object
|
|
184
|
+
* @return {object} copy of object
|
|
185
|
+
**/
|
|
186
|
+
static copyObj(obj) {
|
|
187
|
+
return JSON.parse(JSON.stringify(obj));
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Copies object to secure it from changes
|
|
192
|
+
* @param {object} obj original object
|
|
193
|
+
* @return {object} copy of object
|
|
194
|
+
**/
|
|
195
|
+
static partCopyObj(obj, list) {
|
|
196
|
+
let partObj = Object.keys(obj).reduce((prev, curr) => {
|
|
197
|
+
if (list.includes(curr)) {
|
|
198
|
+
prev[curr] = obj[curr];
|
|
199
|
+
}
|
|
200
|
+
return prev;
|
|
201
|
+
}, {});
|
|
202
|
+
return JSON.parse(JSON.stringify(partObj));
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Test argument type to be 'function'
|
|
207
|
+
* @param {any} func possible function
|
|
208
|
+
* @return {boolean} if this is a function
|
|
209
|
+
**/
|
|
210
|
+
static isFunc(func) {
|
|
211
|
+
return typeof func === "function";
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* Returns true if argument is Async function
|
|
216
|
+
* @param {function} func to test
|
|
217
|
+
* @return {boolean} if this function is constructed as AsyncFunction
|
|
218
|
+
**/
|
|
219
|
+
static isAsync(func) {
|
|
220
|
+
return func.constructor.name === "AsyncFunction";
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Executes method of object in appropriate way inside Promise
|
|
225
|
+
* @param {object} obj original object
|
|
226
|
+
* @param {string} name method name to execute
|
|
227
|
+
* @param {Array} params array of params
|
|
228
|
+
* @return {Promise} results of method execution
|
|
229
|
+
**/
|
|
230
|
+
static async executeObjectFunction(obj, name, params) {
|
|
231
|
+
if (obj) {
|
|
232
|
+
const proc = notPath.get(":" + name, obj);
|
|
233
|
+
if (notCommon.isFunc(proc)) {
|
|
234
|
+
if (notCommon.isAsync(proc)) {
|
|
235
|
+
return await proc(...params);
|
|
236
|
+
} else {
|
|
237
|
+
return proc(...params);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
226
240
|
}
|
|
227
|
-
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
/**
|
|
232
|
-
* Executes method of object in apropriate way inside Promise
|
|
233
|
-
* @param {Object} from original object
|
|
234
|
-
* @param {Object} name method name to execute
|
|
235
|
-
* @param {Array} list array of params
|
|
236
|
-
* @return {Promise} results of method execution
|
|
237
|
-
**/
|
|
238
|
-
static mapBind(from, to, list){
|
|
239
|
-
list.forEach((item)=>{
|
|
240
|
-
if (typeof from[item] === 'function') {
|
|
241
|
-
to[item] = from[item].bind(from);
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
}
|
|
241
|
+
}
|
|
245
242
|
|
|
243
|
+
/**
|
|
244
|
+
* Executes method of object in apropriate way inside Promise
|
|
245
|
+
* @param {Object} from original object
|
|
246
|
+
* @param {Object} name method name to execute
|
|
247
|
+
* @param {Array} list array of params
|
|
248
|
+
* @return {Promise} results of method execution
|
|
249
|
+
**/
|
|
250
|
+
static mapBind(from, to, list) {
|
|
251
|
+
list.forEach((item) => {
|
|
252
|
+
if (typeof from[item] === "function") {
|
|
253
|
+
to[item] = from[item].bind(from);
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
}
|
|
246
257
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
258
|
+
static isClass(fn) {
|
|
259
|
+
return /^\s*class/.test(fn.toString());
|
|
260
|
+
}
|
|
250
261
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
//Проверка является ли переменная массивом
|
|
264
|
-
static isArray(data) {
|
|
265
|
-
return (typeof data == "object") && (data instanceof Array);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
static localIsoDate(date) {
|
|
269
|
-
date = date || new Date;
|
|
270
|
-
let localIsoString = date.getFullYear() + '-' +
|
|
271
|
-
this.pad(date.getMonth() + 1) + '-' +
|
|
272
|
-
this.pad(date.getDate()) + 'T' +
|
|
273
|
-
this.pad(date.getHours()) + ':' +
|
|
274
|
-
this.pad(date.getMinutes()) + ':' +
|
|
275
|
-
this.pad(date.getSeconds());
|
|
276
|
-
return localIsoString;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
static getToday() {
|
|
280
|
-
let today = new Date;
|
|
281
|
-
let date = today.getFullYear() + '-' + this.pad(today.getMonth() + 1) + '-' + this.pad(today.getDate());
|
|
282
|
-
return date;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
static backlog = [];
|
|
286
|
-
|
|
287
|
-
static backlogAdd(msg, type = 'log'){
|
|
288
|
-
if(this.get('backlog') === true){
|
|
289
|
-
this.backlog.push({ msg, type});
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
static dumpBacklog(){
|
|
294
|
-
while(this.backlog.length){
|
|
295
|
-
let row = this.backlog.shift();
|
|
296
|
-
window[this.LOG][row.type](...row.msg);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
static logMsg() {
|
|
301
|
-
let now = this.localIsoDate();
|
|
302
|
-
// eslint-disable-next-line no-console
|
|
303
|
-
window[this.LOG].log(`[${now}]: `, ...arguments);
|
|
304
|
-
this.backlogAdd([`[${now}]: `, ...arguments], 'log');
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
static log(){
|
|
308
|
-
this.logMsg(...arguments);
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
static createLogger(prefix){
|
|
312
|
-
return {
|
|
313
|
-
log: this.genLogMsg(prefix),
|
|
314
|
-
error: this.genLogError(prefix),
|
|
315
|
-
debug: this.genLogDebug(prefix),
|
|
316
|
-
report: this.report
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
//Генерация метода вывода сообщений в консоль с указанием префикса.
|
|
321
|
-
static genLogMsg(prefix) {
|
|
322
|
-
return function(){ //not arrow bc of arguments special var is not available in arrow functions
|
|
323
|
-
let now = notCommon.localIsoDate();
|
|
324
|
-
// eslint-disable-next-line no-console
|
|
325
|
-
window[notCommon.LOG].log(`[${now}]: ${prefix}::`, ...arguments);
|
|
326
|
-
notCommon.backlogAdd([`[${now}]: ${prefix}::`, ...arguments], 'log');
|
|
327
|
-
};
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
/**
|
|
331
|
-
* Определяет является ли окружение окружением разработки
|
|
332
|
-
* @returns {boolean} true если это запущено в окружении разработки
|
|
333
|
-
**/
|
|
334
|
-
static isDev() {
|
|
335
|
-
return this.ENV_TYPE === this.DEV_ENV;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
static debug(){
|
|
339
|
-
if (this.isDev()) {
|
|
340
|
-
return this.logMsg(...arguments);
|
|
341
|
-
} else {
|
|
342
|
-
return this.NOOP;
|
|
262
|
+
static detectType(testie) {
|
|
263
|
+
if (typeof testie !== "function") {
|
|
264
|
+
return typeof testie;
|
|
265
|
+
} else {
|
|
266
|
+
if (this.isClass(testie)) {
|
|
267
|
+
return "class";
|
|
268
|
+
} else {
|
|
269
|
+
return "function";
|
|
270
|
+
}
|
|
271
|
+
}
|
|
343
272
|
}
|
|
344
|
-
}
|
|
345
273
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
static trace() {
|
|
389
|
-
if (!this.get('production')) {
|
|
390
|
-
this.trace(...arguments);
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
static trimBackslash(str){
|
|
395
|
-
if(str.indexOf('/') === 0){
|
|
396
|
-
str = str.substring(1);
|
|
397
|
-
}
|
|
398
|
-
if(str[str.length - 1] === '/'){
|
|
399
|
-
str = str.substring(0, str.length - 1);
|
|
400
|
-
}
|
|
401
|
-
return str;
|
|
402
|
-
}
|
|
403
|
-
|
|
404
|
-
/**
|
|
405
|
-
* Builds URL with structure like prefix/module/model/id/action
|
|
406
|
-
* If some part absent or set to false it will be excluded from result
|
|
407
|
-
*
|
|
408
|
-
* @return {string} url path
|
|
409
|
-
*/
|
|
410
|
-
static buildURL({ prefix, module, model, id, action }){
|
|
411
|
-
let url = ['/'];
|
|
412
|
-
if(prefix) { url.push(encodeURIComponent(this.trimBackslash(prefix)));}
|
|
413
|
-
if(module) { url.push(encodeURIComponent(this.trimBackslash(module)));}
|
|
414
|
-
if(model) { url.push(encodeURIComponent(this.trimBackslash(model)));}
|
|
415
|
-
if(id) { url.push(encodeURIComponent(this.trimBackslash(id))); }
|
|
416
|
-
if(action) { url.push(encodeURIComponent(this.trimBackslash(action))); }
|
|
417
|
-
url = url.filter(el => el !== '' );
|
|
418
|
-
return url.join('/').replace(/\/\//g, '/');
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
static capitalizeFirstLetter(name) {
|
|
423
|
-
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
static lowerFirstLetter(string) {
|
|
427
|
-
return string.charAt(0).toLowerCase() + string.slice(1);
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
static strLengthCap(str, MAX_TITLE_LENGTH = 50, POST_FIX = '...'){
|
|
431
|
-
if(str.length > MAX_TITLE_LENGTH){
|
|
432
|
-
return str.substr(0, MAX_TITLE_LENGTH) + POST_FIX;
|
|
433
|
-
}else{
|
|
434
|
-
return str;
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
static escapeHtml(unsafe) {
|
|
439
|
-
return unsafe
|
|
440
|
-
.replace(/&/g, '&')
|
|
441
|
-
.replace(/</g, '<')
|
|
442
|
-
.replace(/>/g, '>')
|
|
443
|
-
.replace(/"/g, '"')
|
|
444
|
-
.replace(/'/g, ''');
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
static startApp(starter) {
|
|
448
|
-
document.addEventListener('DOMContentLoaded', starter);
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
static getApp() {
|
|
452
|
-
return this.get('app');
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
static extendAppConfig(conf, conf2) {
|
|
456
|
-
return this.deepMerge(conf, conf2);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
static absorbModule() {
|
|
460
|
-
let defaultConf, //app options
|
|
461
|
-
mod, //module options
|
|
462
|
-
targets = {}; //various collections
|
|
463
|
-
if(arguments.length == 1){
|
|
464
|
-
targets = {...arguments[0]};
|
|
465
|
-
if(Object.hasOwnProperty.call(arguments[0], 'defaultConf')){
|
|
466
|
-
defaultConf = arguments[0].defaultConf;
|
|
467
|
-
delete targets.defaultConf;
|
|
468
|
-
}
|
|
469
|
-
if(Object.hasOwnProperty.call(arguments[0], 'mod')){
|
|
470
|
-
mod = arguments[0].mod;
|
|
471
|
-
delete targets.mod;
|
|
472
|
-
}
|
|
473
|
-
}else{
|
|
474
|
-
this.log('WARNING: absorbModule format obsoleted, use object {defaultConf, mod, services, uis, wsc, etc}');
|
|
475
|
-
defaultConf = arguments[0];
|
|
476
|
-
mod = arguments[1];
|
|
477
|
-
if(arguments.length > 2){targets.services = arguments[2];}
|
|
478
|
-
if(arguments.length > 3){targets.uis = arguments[3];}
|
|
479
|
-
if(arguments.length > 4){targets.wcs = arguments[4];}
|
|
480
|
-
}
|
|
481
|
-
for (let prop in mod) {
|
|
482
|
-
//add manifest to other
|
|
483
|
-
if(prop === 'manifest'){
|
|
484
|
-
defaultConf = this.extendAppConfig(defaultConf, mod.manifest);
|
|
485
|
-
continue;
|
|
486
|
-
}
|
|
487
|
-
if(typeof this.get(`absorb.${prop}`) === 'function'){
|
|
488
|
-
if(!Object.prototype.hasOwnProperty.call(targets, prop)){
|
|
489
|
-
targets[prop] = {};
|
|
490
|
-
this.log(`WARNING: no accamulator object provided for '${prop}' collection`);
|
|
274
|
+
//Проверка является ли переменная массивом
|
|
275
|
+
static isArray(data) {
|
|
276
|
+
return typeof data == "object" && data instanceof Array;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
static localIsoDate(date) {
|
|
280
|
+
date = date || new Date();
|
|
281
|
+
let localIsoString =
|
|
282
|
+
date.getFullYear() +
|
|
283
|
+
"-" +
|
|
284
|
+
this.pad(date.getMonth() + 1) +
|
|
285
|
+
"-" +
|
|
286
|
+
this.pad(date.getDate()) +
|
|
287
|
+
"T" +
|
|
288
|
+
this.pad(date.getHours()) +
|
|
289
|
+
":" +
|
|
290
|
+
this.pad(date.getMinutes()) +
|
|
291
|
+
":" +
|
|
292
|
+
this.pad(date.getSeconds());
|
|
293
|
+
return localIsoString;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
static getToday() {
|
|
297
|
+
let today = new Date();
|
|
298
|
+
let date =
|
|
299
|
+
today.getFullYear() +
|
|
300
|
+
"-" +
|
|
301
|
+
this.pad(today.getMonth() + 1) +
|
|
302
|
+
"-" +
|
|
303
|
+
this.pad(today.getDate());
|
|
304
|
+
return date;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
static backlog = [];
|
|
308
|
+
|
|
309
|
+
static backlogAdd(msg, type = "log") {
|
|
310
|
+
if (this.get("backlog") === true) {
|
|
311
|
+
this.backlog.push({ msg, type });
|
|
491
312
|
}
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
static dumpBacklog() {
|
|
316
|
+
while (this.backlog.length) {
|
|
317
|
+
let row = this.backlog.shift();
|
|
318
|
+
window[this.LOG][row.type](...row.msg);
|
|
496
319
|
}
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
static logMsg() {
|
|
323
|
+
let now = this.localIsoDate();
|
|
324
|
+
// eslint-disable-next-line no-console
|
|
325
|
+
window[this.LOG].log(`[${now}]: `, ...arguments);
|
|
326
|
+
this.backlogAdd([`[${now}]: `, ...arguments], "log");
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
static log() {
|
|
330
|
+
this.logMsg(...arguments);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
static createLogger(prefix) {
|
|
334
|
+
return {
|
|
335
|
+
log: this.genLogMsg(prefix),
|
|
336
|
+
error: this.genLogError(prefix),
|
|
337
|
+
debug: this.genLogDebug(prefix),
|
|
338
|
+
report: this.report,
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
//Генерация метода вывода сообщений в консоль с указанием префикса.
|
|
343
|
+
static genLogMsg(prefix) {
|
|
344
|
+
return function () {
|
|
345
|
+
//not arrow bc of arguments special var is not available in arrow functions
|
|
346
|
+
let now = notCommon.localIsoDate();
|
|
347
|
+
// eslint-disable-next-line no-console
|
|
348
|
+
window[notCommon.LOG].log(`[${now}]: ${prefix}::`, ...arguments);
|
|
349
|
+
notCommon.backlogAdd(
|
|
350
|
+
[`[${now}]: ${prefix}::`, ...arguments],
|
|
351
|
+
"log"
|
|
352
|
+
);
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* Определяет является ли окружение окружением разработки
|
|
358
|
+
* @returns {boolean} true если это запущено в окружении разработки
|
|
359
|
+
**/
|
|
360
|
+
static isDev() {
|
|
361
|
+
return this.ENV_TYPE === this.DEV_ENV;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
static debug() {
|
|
365
|
+
if (this.isDev()) {
|
|
366
|
+
return this.logMsg(...arguments);
|
|
367
|
+
} else {
|
|
368
|
+
return this.NOOP;
|
|
502
369
|
}
|
|
503
|
-
window.notEnv[prop] = mod[prop];
|
|
504
|
-
}
|
|
505
370
|
}
|
|
506
|
-
return defaultConf;
|
|
507
|
-
}
|
|
508
371
|
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
372
|
+
static genLogDebug(prefix) {
|
|
373
|
+
if (this.isDev()) {
|
|
374
|
+
return this.genLogMsg(prefix);
|
|
375
|
+
} else {
|
|
376
|
+
return this.NOOP;
|
|
377
|
+
}
|
|
512
378
|
}
|
|
513
|
-
}
|
|
514
379
|
|
|
515
|
-
|
|
380
|
+
static error() {
|
|
381
|
+
this.logError(...arguments);
|
|
382
|
+
}
|
|
516
383
|
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
384
|
+
//Функция вывода сообщения об ошибке
|
|
385
|
+
static logError() {
|
|
386
|
+
let now = this.localIsoDate();
|
|
387
|
+
// eslint-disable-next-line no-console
|
|
388
|
+
window[this.LOG].error(`[${now}]: `, ...arguments);
|
|
389
|
+
this.backlogAdd([`[${now}]: `, ...arguments], "error");
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
static genLogError(prefix) {
|
|
393
|
+
return function () {
|
|
394
|
+
//do not change to arrow function, bc of arguments
|
|
395
|
+
let now = notCommon.localIsoDate();
|
|
396
|
+
// eslint-disable-next-line no-console
|
|
397
|
+
window[notCommon.LOG].error(`[${now}]: ${prefix}::`, ...arguments);
|
|
398
|
+
notCommon.backlogAdd(
|
|
399
|
+
[`[${now}]: ${prefix}::`, ...arguments],
|
|
400
|
+
"error"
|
|
401
|
+
);
|
|
402
|
+
};
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
static report(e) {
|
|
406
|
+
if (this.getApp()) {
|
|
407
|
+
let reporter = this.getApp().getService("nsErrorReporter");
|
|
408
|
+
if (reporter) {
|
|
409
|
+
reporter.report(e).catch(this.error.bind(this));
|
|
410
|
+
}
|
|
411
|
+
} else {
|
|
412
|
+
if (!this.get("production")) {
|
|
413
|
+
this.error(...arguments);
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
static trace() {
|
|
419
|
+
if (!this.get("production")) {
|
|
420
|
+
this.trace(...arguments);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
static trimBackslash(str) {
|
|
425
|
+
if (str.indexOf("/") === 0) {
|
|
426
|
+
str = str.substring(1);
|
|
427
|
+
}
|
|
428
|
+
if (str[str.length - 1] === "/") {
|
|
429
|
+
str = str.substring(0, str.length - 1);
|
|
430
|
+
}
|
|
431
|
+
return str;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* Builds URL with structure like prefix/module/model/id/action
|
|
436
|
+
* If some part absent or set to false it will be excluded from result
|
|
437
|
+
*
|
|
438
|
+
* @return {string} url path
|
|
439
|
+
*/
|
|
440
|
+
static buildURL({ prefix, module, model, id, action }) {
|
|
441
|
+
let url = ["/"];
|
|
442
|
+
if (prefix) {
|
|
443
|
+
url.push(encodeURIComponent(this.trimBackslash(prefix)));
|
|
444
|
+
}
|
|
445
|
+
if (module) {
|
|
446
|
+
url.push(encodeURIComponent(this.trimBackslash(module)));
|
|
447
|
+
}
|
|
448
|
+
if (model) {
|
|
449
|
+
url.push(encodeURIComponent(this.trimBackslash(model)));
|
|
450
|
+
}
|
|
451
|
+
if (id) {
|
|
452
|
+
url.push(encodeURIComponent(this.trimBackslash(id)));
|
|
453
|
+
}
|
|
454
|
+
if (action) {
|
|
455
|
+
url.push(encodeURIComponent(this.trimBackslash(action)));
|
|
456
|
+
}
|
|
457
|
+
url = url.filter((el) => el !== "");
|
|
458
|
+
return url.join("/").replace(/\/\//g, "/");
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
static capitalizeFirstLetter(name) {
|
|
462
|
+
return name.charAt(0).toUpperCase() + name.slice(1);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
static lowerFirstLetter(string) {
|
|
466
|
+
return string.charAt(0).toLowerCase() + string.slice(1);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
static strLengthCap(str, MAX_TITLE_LENGTH = 50, POST_FIX = "...") {
|
|
470
|
+
if (str.length > MAX_TITLE_LENGTH) {
|
|
471
|
+
return str.substr(0, MAX_TITLE_LENGTH) + POST_FIX;
|
|
472
|
+
} else {
|
|
473
|
+
return str;
|
|
474
|
+
}
|
|
475
|
+
}
|
|
520
476
|
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
477
|
+
static escapeHtml(unsafe) {
|
|
478
|
+
return unsafe
|
|
479
|
+
.replace(/&/g, "&")
|
|
480
|
+
.replace(/</g, "<")
|
|
481
|
+
.replace(/>/g, ">")
|
|
482
|
+
.replace(/"/g, """)
|
|
483
|
+
.replace(/'/g, "'");
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
static startApp(starter) {
|
|
487
|
+
document.addEventListener("DOMContentLoaded", starter);
|
|
488
|
+
}
|
|
524
489
|
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
var k = new_index - array.length;
|
|
528
|
-
while ((k--) + 1) {
|
|
529
|
-
array.push(undefined);
|
|
530
|
-
}
|
|
490
|
+
static getApp() {
|
|
491
|
+
return this.get("app");
|
|
531
492
|
}
|
|
532
|
-
array.splice(new_index, 0, array.splice(old_index, 1)[0]);
|
|
533
|
-
}
|
|
534
493
|
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
494
|
+
static extendAppConfig(conf, conf2) {
|
|
495
|
+
return this.deepMerge(conf, conf2);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
static absorbModule() {
|
|
499
|
+
let defaultConf, //app options
|
|
500
|
+
mod, //module options
|
|
501
|
+
targets = {}; //various collections
|
|
502
|
+
if (arguments.length == 1) {
|
|
503
|
+
targets = { ...arguments[0] };
|
|
504
|
+
if (Object.hasOwnProperty.call(arguments[0], "defaultConf")) {
|
|
505
|
+
defaultConf = arguments[0].defaultConf;
|
|
506
|
+
delete targets.defaultConf;
|
|
507
|
+
}
|
|
508
|
+
if (Object.hasOwnProperty.call(arguments[0], "mod")) {
|
|
509
|
+
mod = arguments[0].mod;
|
|
510
|
+
delete targets.mod;
|
|
511
|
+
}
|
|
540
512
|
} else {
|
|
541
|
-
|
|
513
|
+
this.log(
|
|
514
|
+
"WARNING: absorbModule format obsoleted, use object {defaultConf, mod, services, uis, wsc, etc}"
|
|
515
|
+
);
|
|
516
|
+
defaultConf = arguments[0];
|
|
517
|
+
mod = arguments[1];
|
|
518
|
+
if (arguments.length > 2) {
|
|
519
|
+
targets.services = arguments[2];
|
|
520
|
+
}
|
|
521
|
+
if (arguments.length > 3) {
|
|
522
|
+
targets.uis = arguments[3];
|
|
523
|
+
}
|
|
524
|
+
if (arguments.length > 4) {
|
|
525
|
+
targets.wcs = arguments[4];
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
for (let prop in mod) {
|
|
529
|
+
//add manifest to other
|
|
530
|
+
if (prop === "manifest") {
|
|
531
|
+
defaultConf = this.extendAppConfig(defaultConf, mod.manifest);
|
|
532
|
+
continue;
|
|
533
|
+
}
|
|
534
|
+
if (typeof this.get(`absorb.${prop}`) === "function") {
|
|
535
|
+
if (!Object.prototype.hasOwnProperty.call(targets, prop)) {
|
|
536
|
+
targets[prop] = {};
|
|
537
|
+
this.log(
|
|
538
|
+
`WARNING: no accamulator object provided for '${prop}' collection`
|
|
539
|
+
);
|
|
540
|
+
}
|
|
541
|
+
this.get(`absorb.${prop}`)(targets[prop], mod[prop]);
|
|
542
|
+
} else if (prop.indexOf("nc") === 0) {
|
|
543
|
+
if (
|
|
544
|
+
!Object.prototype.hasOwnProperty.call(
|
|
545
|
+
defaultConf,
|
|
546
|
+
"controllers"
|
|
547
|
+
)
|
|
548
|
+
) {
|
|
549
|
+
defaultConf.controllers = {};
|
|
550
|
+
}
|
|
551
|
+
defaultConf.controllers[prop] = mod[prop];
|
|
552
|
+
} else {
|
|
553
|
+
//in case of some other stuff presented, isolating it in special var
|
|
554
|
+
if (!Object.prototype.hasOwnProperty.call(window, "notEnv")) {
|
|
555
|
+
window.notEnv = {};
|
|
556
|
+
}
|
|
557
|
+
window.notEnv[prop] = mod[prop];
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
return defaultConf;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
static defineIfNotExists(obj, key, defaultValue) {
|
|
564
|
+
if (!Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
565
|
+
obj[key] = defaultValue;
|
|
542
566
|
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
static registry = {};
|
|
570
|
+
|
|
571
|
+
static register(key, val) {
|
|
572
|
+
this.registry[key] = val;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
static get(key) {
|
|
576
|
+
return Object.prototype.hasOwnProperty.call(this.registry, key)
|
|
577
|
+
? this.registry[key]
|
|
578
|
+
: null;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
static moveItem(array, old_index, new_index) {
|
|
582
|
+
if (new_index >= array.length) {
|
|
583
|
+
var k = new_index - array.length;
|
|
584
|
+
while (k-- + 1) {
|
|
585
|
+
array.push(undefined);
|
|
586
|
+
}
|
|
547
587
|
}
|
|
548
|
-
|
|
588
|
+
array.splice(new_index, 0, array.splice(old_index, 1)[0]);
|
|
549
589
|
}
|
|
550
|
-
return obj;
|
|
551
|
-
}
|
|
552
590
|
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
591
|
+
static stripProxy(obj) {
|
|
592
|
+
if (typeof obj !== "undefined" && obj !== null) {
|
|
593
|
+
if (obj.isProxy) {
|
|
594
|
+
if (Array.isArray(obj)) {
|
|
595
|
+
obj = Array.from(obj);
|
|
596
|
+
} else {
|
|
597
|
+
obj = Object.assign({}, obj);
|
|
598
|
+
}
|
|
599
|
+
for (let t in obj) {
|
|
600
|
+
if (Object.prototype.hasOwnProperty.call(obj, t)) {
|
|
601
|
+
obj[t] = this.stripProxy(obj[t]);
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
return obj;
|
|
557
607
|
}
|
|
558
|
-
return result;
|
|
559
|
-
}
|
|
560
608
|
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
609
|
+
static pipe(data /* feed data */, funcs /* functions array */) {
|
|
610
|
+
let result;
|
|
611
|
+
for (let func of funcs) {
|
|
612
|
+
result = func(result || data);
|
|
613
|
+
}
|
|
614
|
+
return result;
|
|
615
|
+
}
|
|
564
616
|
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
617
|
+
static getAPI(type) {
|
|
618
|
+
return this.getManager() ? this.getManager().getAPI(type) : null;
|
|
619
|
+
}
|
|
568
620
|
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
621
|
+
static setManager(v) {
|
|
622
|
+
this.MANAGER = v;
|
|
623
|
+
}
|
|
572
624
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
625
|
+
static getManager() {
|
|
626
|
+
return this.MANAGER;
|
|
627
|
+
}
|
|
576
628
|
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
});
|
|
581
|
-
}
|
|
629
|
+
static getJSON(url) {
|
|
630
|
+
return fetch(url).then((response) => response.json());
|
|
631
|
+
}
|
|
582
632
|
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
});
|
|
633
|
+
static wait(sec) {
|
|
634
|
+
return new Promise((res) => {
|
|
635
|
+
setTimeout(res, sec * 1000);
|
|
636
|
+
});
|
|
588
637
|
}
|
|
589
|
-
}
|
|
590
|
-
}
|
|
591
638
|
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
639
|
+
static registerWidgetEvents(events) {
|
|
640
|
+
if (this.getApp()) {
|
|
641
|
+
Object.keys(events).forEach((eventName) => {
|
|
642
|
+
this.getApp().on(eventName, events[eventName]);
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
static navigate(url) {
|
|
648
|
+
this.getApp() && this.getApp().getWorking("router").navigate(url);
|
|
599
649
|
}
|
|
600
|
-
}
|
|
601
650
|
}
|
|
602
651
|
|
|
603
|
-
function
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
messenger: {}
|
|
611
|
-
};
|
|
612
|
-
}
|
|
613
|
-
let target = wcs[wscName];
|
|
614
|
-
if(Object.prototype.hasOwnProperty.call(wscOptions, 'router')){
|
|
615
|
-
if(Object.prototype.hasOwnProperty.call(wscOptions.router, 'routes')){
|
|
616
|
-
for(let routeType in wscOptions.router.routes){
|
|
617
|
-
if(!Object.prototype.hasOwnProperty.call(target.router.routes, routeType)){
|
|
618
|
-
target.router.routes[routeType] = {};
|
|
652
|
+
function absorbServices(target, src) {
|
|
653
|
+
if (target) {
|
|
654
|
+
for (let serv in src) {
|
|
655
|
+
if (Object.prototype.hasOwnProperty.call(target, serv)) {
|
|
656
|
+
notCommon.logError(`services property duplication ${serv}`);
|
|
657
|
+
}
|
|
658
|
+
target[serv] = src[serv];
|
|
619
659
|
}
|
|
620
|
-
|
|
621
|
-
}
|
|
622
|
-
}
|
|
623
|
-
}
|
|
624
|
-
if(Object.prototype.hasOwnProperty.call(wscOptions, 'messenger')){
|
|
625
|
-
Object.assign(target.messenger, {...wscOptions.messenger});
|
|
626
|
-
}
|
|
627
|
-
if(Object.prototype.hasOwnProperty.call(wscOptions, 'connection')){
|
|
628
|
-
Object.assign(target.connection, {...wscOptions.connection});
|
|
629
|
-
}
|
|
630
|
-
for(let t of ['name', 'getToken', 'logger', 'identity', 'credentials']){
|
|
631
|
-
if(Object.prototype.hasOwnProperty.call(wscOptions, t)){
|
|
632
|
-
target[t] = wscOptions[t];
|
|
633
|
-
}
|
|
634
|
-
}
|
|
660
|
+
}
|
|
635
661
|
}
|
|
636
662
|
|
|
637
|
-
function
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
663
|
+
function extendWSClient(wcs, wscName, wscOptions) {
|
|
664
|
+
if (!Object.prototype.hasOwnProperty.call(wcs, wscName)) {
|
|
665
|
+
wcs[wscName] = {
|
|
666
|
+
connection: {},
|
|
667
|
+
router: {
|
|
668
|
+
routes: {},
|
|
669
|
+
},
|
|
670
|
+
messenger: {},
|
|
671
|
+
};
|
|
672
|
+
}
|
|
673
|
+
let target = wcs[wscName];
|
|
674
|
+
if (Object.prototype.hasOwnProperty.call(wscOptions, "router")) {
|
|
675
|
+
if (Object.prototype.hasOwnProperty.call(wscOptions.router, "routes")) {
|
|
676
|
+
for (let routeType in wscOptions.router.routes) {
|
|
677
|
+
if (
|
|
678
|
+
!Object.prototype.hasOwnProperty.call(
|
|
679
|
+
target.router.routes,
|
|
680
|
+
routeType
|
|
681
|
+
)
|
|
682
|
+
) {
|
|
683
|
+
target.router.routes[routeType] = {};
|
|
684
|
+
}
|
|
685
|
+
Object.assign(target.router.routes[routeType], {
|
|
686
|
+
...wscOptions.router.routes[routeType],
|
|
687
|
+
});
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
if (Object.prototype.hasOwnProperty.call(wscOptions, "messenger")) {
|
|
692
|
+
Object.assign(target.messenger, { ...wscOptions.messenger });
|
|
693
|
+
}
|
|
694
|
+
if (Object.prototype.hasOwnProperty.call(wscOptions, "connection")) {
|
|
695
|
+
Object.assign(target.connection, { ...wscOptions.connection });
|
|
696
|
+
}
|
|
697
|
+
for (let t of ["name", "getToken", "logger", "identity", "credentials"]) {
|
|
698
|
+
if (Object.prototype.hasOwnProperty.call(wscOptions, t)) {
|
|
699
|
+
target[t] = wscOptions[t];
|
|
700
|
+
}
|
|
641
701
|
}
|
|
642
|
-
}
|
|
643
702
|
}
|
|
644
703
|
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
notCommon.logError(`uis property duplication ${ui}`);
|
|
651
|
-
}
|
|
652
|
-
target[ui] = src[ui];
|
|
704
|
+
function absorbWSC(target, src) {
|
|
705
|
+
if (target) {
|
|
706
|
+
for (let wsClientName in src) {
|
|
707
|
+
extendWSClient(target, wsClientName, src[wsClientName]);
|
|
708
|
+
}
|
|
653
709
|
}
|
|
654
|
-
}
|
|
655
710
|
}
|
|
656
711
|
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
712
|
+
function absorbUIs(target, src) {
|
|
713
|
+
if (target) {
|
|
714
|
+
for (let ui in src) {
|
|
715
|
+
if (Object.prototype.hasOwnProperty.call(target, ui)) {
|
|
716
|
+
notCommon.logError(`uis property duplication ${ui}`);
|
|
717
|
+
}
|
|
718
|
+
target[ui] = src[ui];
|
|
719
|
+
}
|
|
665
720
|
}
|
|
666
|
-
}
|
|
667
721
|
}
|
|
668
722
|
|
|
723
|
+
function absorbFields(target, src) {
|
|
724
|
+
if (target) {
|
|
725
|
+
for (let ui in src) {
|
|
726
|
+
if (Object.prototype.hasOwnProperty.call(target, ui)) {
|
|
727
|
+
notCommon.logError(`fields property duplication ${ui}`);
|
|
728
|
+
}
|
|
729
|
+
target[ui] = src[ui];
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
}
|
|
669
733
|
|
|
670
|
-
notCommon.register(
|
|
671
|
-
notCommon.register(
|
|
672
|
-
notCommon.register(
|
|
673
|
-
notCommon.register(
|
|
734
|
+
notCommon.register("absorb.wsc", absorbWSC);
|
|
735
|
+
notCommon.register("absorb.services", absorbServices);
|
|
736
|
+
notCommon.register("absorb.uis", absorbUIs);
|
|
737
|
+
notCommon.register("absorb.uis", absorbFields);
|
|
674
738
|
|
|
675
739
|
export default notCommon;
|
|
@@ -67,6 +67,7 @@ class notSideMenu extends Menu {
|
|
|
67
67
|
},
|
|
68
68
|
});
|
|
69
69
|
this.initSizeResponse();
|
|
70
|
+
|
|
70
71
|
this.interval = setInterval(this.updateMenuActiveItem.bind(this), 200);
|
|
71
72
|
this.bindToggle();
|
|
72
73
|
}
|
|
@@ -158,21 +159,33 @@ class notSideMenu extends Menu {
|
|
|
158
159
|
|
|
159
160
|
static toggle(e) {
|
|
160
161
|
e && e.preventDefault();
|
|
161
|
-
this.
|
|
162
|
+
if (this.isTouch()) {
|
|
163
|
+
this.aside.classList.toggle("is-active");
|
|
164
|
+
} else {
|
|
165
|
+
this.aside.classList.toggle("is-closed");
|
|
166
|
+
}
|
|
162
167
|
this.resizeMain();
|
|
163
168
|
return false;
|
|
164
169
|
}
|
|
165
170
|
|
|
166
171
|
static hide(e) {
|
|
167
172
|
e && e.preventDefault();
|
|
168
|
-
this.
|
|
173
|
+
if (this.isTouch()) {
|
|
174
|
+
this.aside.classList.remove("is-active");
|
|
175
|
+
} else {
|
|
176
|
+
this.aside.classList.add("is-closed");
|
|
177
|
+
}
|
|
169
178
|
this.resizeMain();
|
|
170
179
|
return false;
|
|
171
180
|
}
|
|
172
181
|
|
|
173
182
|
static show(e) {
|
|
174
183
|
e && e.preventDefault();
|
|
175
|
-
this.
|
|
184
|
+
if (this.isTouch()) {
|
|
185
|
+
this.classList.add("is-active");
|
|
186
|
+
} else {
|
|
187
|
+
this.aside.classList.remove("is-closed");
|
|
188
|
+
}
|
|
176
189
|
this.resizeMain();
|
|
177
190
|
return false;
|
|
178
191
|
}
|