@vc-shell/framework 1.0.168 → 1.0.169
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/CHANGELOG.md +9 -0
- package/dist/framework.js +2629 -2600
- package/dist/shared/modules/dynamic/composables/useFilterBuilder/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/shared/modules/dynamic/composables/useFilterBuilder/index.ts +0 -1
- package/shared/modules/dynamic/helpers/override.ts +61 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../shared/modules/dynamic/composables/useFilterBuilder/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,QAAQ,EAIR,eAAe,EACf,YAAY,EACZ,KAAK,EACL,WAAW,EAIZ,MAAM,KAAK,CAAC;AAGb,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,OAAO,EAAE,UAAU,EAAmC,MAAM,aAAa,CAAC;AAS1E,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,CAAC,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,KAChD,KAAK,CACH,YAAY,EACZ,eAAe,EACf;QAEE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CACF,GACD,SAAS,CAAC;IACd,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,eAAe,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IACtC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACtC;;UAGO,UAAU,GAAG,SAAS;;;WAGrB,YAAY,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,SAAS;MACjD,gBAAgB;AALpB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../shared/modules/dynamic/composables/useFilterBuilder/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,QAAQ,EAIR,eAAe,EACf,YAAY,EACZ,KAAK,EACL,WAAW,EAIZ,MAAM,KAAK,CAAC;AAGb,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAG9D,OAAO,EAAE,UAAU,EAAmC,MAAM,aAAa,CAAC;AAS1E,MAAM,WAAW,gBAAgB;IAC/B,eAAe,EAAE,CAAC,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,IAAI,CAAA;KAAE,KAChD,KAAK,CACH,YAAY,EACZ,eAAe,EACf;QAEE,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CACF,GACD,SAAS,CAAC;IACd,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACvC,eAAe,EAAE,WAAW,CAAC,OAAO,CAAC,CAAC;IACtC,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAE3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACtC;;UAGO,UAAU,GAAG,SAAS;;;WAGrB,YAAY,OAAO,MAAM,EAAE,GAAG,CAAC,CAAC,GAAG,SAAS;MACjD,gBAAgB;AALpB,wBA8ME"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vc-shell/framework",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.169",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/framework.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"whatwg-fetch": "^3.6.19"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@vc-shell/api-client-generator": "^1.0.
|
|
57
|
-
"@vc-shell/config-generator": "^1.0.
|
|
58
|
-
"@vc-shell/ts-config": "^1.0.
|
|
56
|
+
"@vc-shell/api-client-generator": "^1.0.169",
|
|
57
|
+
"@vc-shell/config-generator": "^1.0.169",
|
|
58
|
+
"@vc-shell/ts-config": "^1.0.169",
|
|
59
59
|
"@vitejs/plugin-vue": "^5.0.3",
|
|
60
60
|
"sass": "^1.69.6",
|
|
61
61
|
"typescript": "^5.3.3",
|
|
@@ -127,7 +127,6 @@ export default <Query>(args: {
|
|
|
127
127
|
});
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
// TODO add to documentation support of dynamic data for filter
|
|
131
130
|
function createCheckboxFromData(data: MaybeRef<Record<string, string>[]>, control: FilterCheckbox) {
|
|
132
131
|
if (!(toValue(data) && toValue(data).length)) return;
|
|
133
132
|
return toValue(data).reduce(
|
|
@@ -25,17 +25,45 @@ const upsertHelper = (overrides: OverridesSchema, schemaCopy: { [key: string]: D
|
|
|
25
25
|
overrides.upsert
|
|
26
26
|
?.filter((x) => clonedSchema.settings.id === x.id)
|
|
27
27
|
.forEach((args) => {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
let valueByPath = _.get(clonedSchema, args.path);
|
|
29
|
+
let currentPath: string | (string | number)[] = args.path;
|
|
30
|
+
|
|
31
|
+
// if we can't get value with lodash - try to parse path, cause it could be path with elements id's
|
|
32
|
+
if (!valueByPath) {
|
|
33
|
+
const pathParts = args.path.split(".");
|
|
34
|
+
|
|
35
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
36
|
+
let current: any = clonedSchema;
|
|
37
|
+
const generatedPath = [];
|
|
38
|
+
for (const part of pathParts) {
|
|
39
|
+
if (Array.isArray(current)) {
|
|
40
|
+
const currentCopy = [...current];
|
|
41
|
+
current = current.find((x) => Object.entries(x).some(([key, value]) => key === part || value === part));
|
|
42
|
+
|
|
43
|
+
const fountElIndex = currentCopy.findIndex((x) => x === current);
|
|
44
|
+
|
|
45
|
+
generatedPath.push(fountElIndex);
|
|
46
|
+
} else {
|
|
47
|
+
current = current[part];
|
|
48
|
+
generatedPath.push(part);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
currentPath = generatedPath;
|
|
53
|
+
|
|
54
|
+
valueByPath = current;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (Array.isArray(valueByPath) && valueByPath.length && typeof args.value === "object") {
|
|
30
58
|
const findIndex = _.findIndex(valueByPath, { id: args.value.id });
|
|
31
59
|
|
|
32
60
|
const spliced = valueByPath /* @ts-expect-error - toSpliced is not parsed correctly by ts */
|
|
33
|
-
.toSpliced(findIndex >= 0 ? findIndex : args.index, findIndex >= 0 ? 1 : 0, args.value);
|
|
34
|
-
_.set(clonedSchema,
|
|
61
|
+
.toSpliced(findIndex >= 0 ? findIndex : args.index ?? 0, findIndex >= 0 ? 1 : 0, args.value);
|
|
62
|
+
_.set(clonedSchema, currentPath, spliced);
|
|
35
63
|
} else {
|
|
36
|
-
_.set(clonedSchema,
|
|
64
|
+
_.set(clonedSchema, currentPath, args.value);
|
|
37
65
|
}
|
|
38
|
-
}
|
|
66
|
+
});
|
|
39
67
|
obj[name] = clonedSchema;
|
|
40
68
|
return obj;
|
|
41
69
|
},
|
|
@@ -60,9 +88,33 @@ const removeHelper = (overrides: OverridesSchema, schemaCopy: Record<string, Dyn
|
|
|
60
88
|
};
|
|
61
89
|
|
|
62
90
|
function removePath(obj: DynamicSchema, path: string) {
|
|
63
|
-
const
|
|
64
|
-
|
|
65
|
-
|
|
91
|
+
const removeItem = _.get(obj, path);
|
|
92
|
+
|
|
93
|
+
if (removeItem) {
|
|
94
|
+
const parentPath = path.slice(0, path.lastIndexOf("["));
|
|
95
|
+
_.unset(obj, path);
|
|
96
|
+
_.update(obj, parentPath, _.compact);
|
|
97
|
+
} else {
|
|
98
|
+
const pathParts = path.split(".");
|
|
99
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
100
|
+
let current: any = obj;
|
|
101
|
+
const generatedPath = [];
|
|
102
|
+
for (const part of pathParts) {
|
|
103
|
+
if (Array.isArray(current)) {
|
|
104
|
+
const currentCopy = [...current];
|
|
105
|
+
current = current.find((x) => Object.entries(x).some(([key, value]) => key === part || value === part));
|
|
106
|
+
|
|
107
|
+
const foundElIndex = currentCopy.findIndex((x) => x === current);
|
|
108
|
+
|
|
109
|
+
generatedPath.push(foundElIndex);
|
|
110
|
+
} else {
|
|
111
|
+
current = current[part];
|
|
112
|
+
generatedPath.push(part);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
_.unset(obj, generatedPath);
|
|
116
|
+
_.update(obj, generatedPath, _.compact);
|
|
117
|
+
}
|
|
66
118
|
}
|
|
67
119
|
|
|
68
120
|
// this part sorts paths with indexes in descending order to avoid deleting items with already changed indexes
|