@gudhub/core 1.1.132 → 1.1.134
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/GUDHUB/GHConstructor/createAngularModuleInstance.js +9 -0
- package/GUDHUB/GHConstructor/createClassInstance.js +9 -0
- package/GUDHUB/Storage/ModulesList.js +3 -3
- package/GUDHUB/Utils/filter/filter.js +69 -65
- package/GUDHUB/Utils/json_constructor/json_constructor.js +15 -21
- package/package.json +1 -1
- package/umd/library.min.js +6 -6
- package/umd/library.min.js.map +1 -1
|
@@ -330,6 +330,15 @@ export default async function createAngularModuleInstance(gudhub, module_id, mod
|
|
|
330
330
|
resolve(null);
|
|
331
331
|
})
|
|
332
332
|
},
|
|
333
|
+
|
|
334
|
+
//*************** GET DICTIONARY ****************//
|
|
335
|
+
|
|
336
|
+
getDictionary: function () {
|
|
337
|
+
if (importedClass.getDictionary) {
|
|
338
|
+
return importedClass.getDictionary();
|
|
339
|
+
}
|
|
340
|
+
return [];
|
|
341
|
+
},
|
|
333
342
|
}
|
|
334
343
|
|
|
335
344
|
// We need these methods in browser environment only
|
|
@@ -222,6 +222,15 @@ export default async function createClassInstance(gudhub, module_id, js_url, css
|
|
|
222
222
|
getWindowHTML(scope) {
|
|
223
223
|
return importedClass.getWindowHTML(scope);
|
|
224
224
|
},
|
|
225
|
+
|
|
226
|
+
//*************** GET DICTIONARY ****************//
|
|
227
|
+
|
|
228
|
+
getDictionary() {
|
|
229
|
+
if (importedClass.getDictionary) {
|
|
230
|
+
return importedClass.getDictionary();
|
|
231
|
+
}
|
|
232
|
+
return [];
|
|
233
|
+
},
|
|
225
234
|
};
|
|
226
235
|
|
|
227
236
|
return result;
|
|
@@ -1536,10 +1536,10 @@ export default function generateModulesList(async_modules_path, file_server_url,
|
|
|
1536
1536
|
technology: 'angular'
|
|
1537
1537
|
},
|
|
1538
1538
|
{
|
|
1539
|
-
data_type: "
|
|
1540
|
-
name: '
|
|
1539
|
+
data_type: "popup_item_editor",
|
|
1540
|
+
name: 'Popup Item Editor',
|
|
1541
1541
|
icon: 'pencil',
|
|
1542
|
-
url: file_server_url + '/' + async_modules_path + "
|
|
1542
|
+
url: file_server_url + '/' + async_modules_path + "popup_item_editor.js",
|
|
1543
1543
|
type: 'gh_element',
|
|
1544
1544
|
technology: 'angular'
|
|
1545
1545
|
},
|
|
@@ -311,71 +311,75 @@ class ItemsFilter {
|
|
|
311
311
|
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
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
|
-
|
|
314
|
+
filter(filters, items) {
|
|
315
|
+
const allFiltersAndStrategy = this.checkIfAllFiltersHaveAndStrategy(filters);
|
|
316
|
+
|
|
317
|
+
const filteredItems = [];
|
|
318
|
+
const activeFilters = filters.filter(function (filter) {
|
|
319
|
+
return filter.valuesArray.length;
|
|
320
|
+
});
|
|
321
|
+
|
|
322
|
+
const shouldCheckTrash = items.some(item =>
|
|
323
|
+
Object.prototype.hasOwnProperty.call(item, 'trash')
|
|
324
|
+
);
|
|
325
|
+
|
|
326
|
+
for (let item of items) {
|
|
327
|
+
if (shouldCheckTrash && item.trash == true) {
|
|
328
|
+
continue;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
let result = true;
|
|
332
|
+
|
|
333
|
+
for (let i = 0; i < activeFilters.length; i++) {
|
|
334
|
+
const filter = activeFilters[i];
|
|
335
|
+
|
|
336
|
+
const currField = item.fields.find(function (itemField) {
|
|
337
|
+
return filter.field_id == itemField.field_id;
|
|
338
|
+
});
|
|
339
|
+
|
|
340
|
+
const filterAggregate = new Aggregate();
|
|
341
|
+
const filterChecker = new Checker();
|
|
342
|
+
|
|
343
|
+
filterAggregate
|
|
344
|
+
.setStrategy(filter.search_type)
|
|
345
|
+
.setEntity(
|
|
346
|
+
currField && currField.field_value != undefined
|
|
347
|
+
? currField.field_value
|
|
348
|
+
: null
|
|
349
|
+
)
|
|
350
|
+
.setFilterValues(filter.valuesArray);
|
|
351
|
+
|
|
352
|
+
switch(filter.boolean_strategy) {
|
|
353
|
+
case 'and':
|
|
354
|
+
result = result && filterChecker.check(filterAggregate);
|
|
355
|
+
break;
|
|
356
|
+
|
|
357
|
+
case 'or':
|
|
358
|
+
result = result || filterChecker.check(filterAggregate);
|
|
359
|
+
break;
|
|
360
|
+
|
|
361
|
+
default:
|
|
362
|
+
result = result && filterChecker.check(filterAggregate);
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
// Needed for performance optimization
|
|
366
|
+
// We don't need to check other filters if we already know that result is false in case of 'and' strategy
|
|
367
|
+
if(!result && allFiltersAndStrategy) {
|
|
368
|
+
break;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
if (result) {
|
|
373
|
+
filteredItems.push(item);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
if (filteredItems.length || filters.length && !filteredItems.length) {
|
|
378
|
+
return filteredItems;
|
|
379
|
+
} else {
|
|
380
|
+
return items;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
379
383
|
|
|
380
384
|
checkIfAllFiltersHaveAndStrategy(filters) {
|
|
381
385
|
return filters.every((filter) => {
|
|
@@ -186,27 +186,21 @@ export function compiler(scheme, item, util, variables, appId) {
|
|
|
186
186
|
return util.gudhub.filter(itemsList, [...modified_filters_list, ...filtersList]);
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
appId,
|
|
205
|
-
appId,
|
|
206
|
-
item.item_id,
|
|
207
|
-
filteredItems
|
|
208
|
-
) : [...filteredItems];
|
|
209
|
-
}
|
|
189
|
+
/* Filter items by scheme filter */
|
|
190
|
+
async function filterItems(
|
|
191
|
+
filtersList = [],
|
|
192
|
+
itemsList = [],
|
|
193
|
+
appId = '',
|
|
194
|
+
item = {}
|
|
195
|
+
) {
|
|
196
|
+
return filtersList.length ? getFilteredItems(
|
|
197
|
+
filtersList,
|
|
198
|
+
appId,
|
|
199
|
+
appId,
|
|
200
|
+
item.item_id,
|
|
201
|
+
itemsList
|
|
202
|
+
) : [...itemsList ];
|
|
203
|
+
}
|
|
210
204
|
|
|
211
205
|
return schemeCompiler(scheme, item, appId, variables);
|
|
212
206
|
}
|