@mediusinc/mng-commons 3.0.0-rc.9 → 3.1.0-rc.0
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/dev-scripts/version-info.js +13 -6
- package/esm2022/lib/components/form/formly/fields/formly-field-action/formly-field-action.component.mjs +22 -4
- package/esm2022/lib/components/form/formly/fields/formly-field-table-dialog-multiselect/formly-field-table-dialog-multiselect.component.mjs +4 -4
- package/esm2022/lib/components/form/models/field-action-context.model.mjs +1 -1
- package/esm2022/lib/components/form/models/index.mjs +2 -1
- package/esm2022/lib/components/tableview/table/table.component.mjs +47 -50
- package/esm2022/lib/descriptors/action/action.descriptor.mjs +1 -1
- package/esm2022/lib/descriptors/editor/field.descriptor.mjs +13 -4
- package/esm2022/lib/models/version.model.mjs +1 -1
- package/esm2022/lib/pipes/json-path.pipe.mjs +3 -62
- package/esm2022/lib/services/action-executor.service.mjs +26 -14
- package/esm2022/lib/services/configuration.service.mjs +1 -1
- package/esm2022/lib/services/logger.service.mjs +2 -2
- package/esm2022/lib/services/version.service.mjs +1 -1
- package/esm2022/lib/utils/editor-formly.util.mjs +2 -1
- package/esm2022/lib/utils/object.util.mjs +50 -1
- package/fesm2022/mediusinc-mng-commons.mjs +157 -132
- package/fesm2022/mediusinc-mng-commons.mjs.map +1 -1
- package/lib/components/form/formly/fields/formly-field-action/formly-field-action.component.d.ts +3 -0
- package/lib/components/form/models/field-action-context.model.d.ts +7 -0
- package/lib/components/form/models/index.d.ts +1 -0
- package/lib/components/tableview/table/table.component.d.ts +1 -0
- package/lib/descriptors/action/action.descriptor.d.ts +6 -6
- package/lib/descriptors/editor/field.descriptor.d.ts +7 -5
- package/lib/models/version.model.d.ts +1 -1
- package/lib/pipes/json-path.pipe.d.ts +0 -1
- package/lib/utils/object.util.d.ts +1 -0
- package/package.json +4 -1
- package/scss/common/theme/designer/_components.scss +1 -1
- package/scss/mng-overrides/_theme_dialog.scss +7 -0
- package/scss/mng-overrides/_theme_tableview.scss +3 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Pipe } from '@angular/core';
|
|
2
|
-
import {
|
|
2
|
+
import { ObjectUtil } from '../utils';
|
|
3
3
|
import * as i0 from "@angular/core";
|
|
4
4
|
/**
|
|
5
5
|
* Imitation of JSONPath Syntax. Supports:
|
|
@@ -8,67 +8,8 @@ import * as i0 from "@angular/core";
|
|
|
8
8
|
* - Array notation (e.g.: [0])
|
|
9
9
|
*/
|
|
10
10
|
export class JsonPathPipe {
|
|
11
|
-
constructor() {
|
|
12
|
-
this.logger = MngLoggerService.get().create('JsonPathPipe');
|
|
13
|
-
}
|
|
14
11
|
transform(value, path = '') {
|
|
15
|
-
|
|
16
|
-
// only return the root
|
|
17
|
-
return value;
|
|
18
|
-
}
|
|
19
|
-
// Check for leading root object notation
|
|
20
|
-
if (path.startsWith('$')) {
|
|
21
|
-
path = path.substring(1);
|
|
22
|
-
}
|
|
23
|
-
// Check for leading .
|
|
24
|
-
if (path.startsWith('.')) {
|
|
25
|
-
path = path.substring(1);
|
|
26
|
-
}
|
|
27
|
-
if (path.indexOf('.') >= 0) {
|
|
28
|
-
const pathSplit = path.split('.');
|
|
29
|
-
let currValue = value;
|
|
30
|
-
for (const p of pathSplit) {
|
|
31
|
-
if (typeof currValue === 'undefined' || currValue === null) {
|
|
32
|
-
return currValue;
|
|
33
|
-
}
|
|
34
|
-
if (!p.length) {
|
|
35
|
-
// empty path, return current value
|
|
36
|
-
return currValue;
|
|
37
|
-
}
|
|
38
|
-
const leftBracketIdx = p.indexOf('[');
|
|
39
|
-
if (leftBracketIdx >= 0 && p.endsWith(']')) {
|
|
40
|
-
// should be reference to array
|
|
41
|
-
const arrayPath = p.substring(0, leftBracketIdx);
|
|
42
|
-
const arrayIdx = +p.substring(leftBracketIdx + 1, p.length - 1);
|
|
43
|
-
const array = currValue[arrayPath];
|
|
44
|
-
if (Array.isArray(array)) {
|
|
45
|
-
if (arrayIdx >= 0 && arrayIdx < array.length) {
|
|
46
|
-
// valid index, continue on the path
|
|
47
|
-
currValue = array[arrayIdx];
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
this.logger?.warn(`Path ${path} array index at ${p} is not within valid array range`, value);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
this.logger?.warn(`Path ${path} array at ${p} is not a valid array`, value);
|
|
56
|
-
}
|
|
57
|
-
return undefined;
|
|
58
|
-
}
|
|
59
|
-
else if (typeof currValue === 'object') {
|
|
60
|
-
currValue = currValue[p];
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
this.logger?.warn(`Path ${path} is not valid for object`, value);
|
|
64
|
-
return currValue;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
return currValue;
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
return value[path];
|
|
71
|
-
}
|
|
12
|
+
return ObjectUtil.getPropertyByPath(value, path);
|
|
72
13
|
}
|
|
73
14
|
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "16.1.7", ngImport: i0, type: JsonPathPipe, deps: [], target: i0.ɵɵFactoryTarget.Pipe }); }
|
|
74
15
|
static { this.ɵpipe = i0.ɵɵngDeclarePipe({ minVersion: "14.0.0", version: "16.1.7", ngImport: i0, type: JsonPathPipe, isStandalone: true, name: "jsonPath" }); }
|
|
@@ -81,4 +22,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "16.1.7", ngImpor
|
|
|
81
22
|
pure: true
|
|
82
23
|
}]
|
|
83
24
|
}] });
|
|
84
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
25
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoianNvbi1wYXRoLnBpcGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvbGliL3BpcGVzL2pzb24tcG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