@fibery/views 24.0.0 → 25.0.1
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/lib/field-utils/rich-text.d.ts +1 -1
- package/lib/private/smart-folder.js +4 -14
- package/lib/unit-utils/get-export-value.d.ts +4 -4
- package/lib/units/board.d.ts +1 -1
- package/lib/units/canvas/index.d.ts +1 -1
- package/lib/units/default.d.ts +1 -1
- package/lib/units/gantt.d.ts +1 -1
- package/lib/units/grid.d.ts +1 -1
- package/lib/units/list.d.ts +1 -1
- package/lib/units/make-factory.d.ts +1 -1
- package/package.json +7 -7
|
@@ -11,6 +11,6 @@ declare function getRichTextQuerySelect({ typeObject, unit: { expression }, incl
|
|
|
11
11
|
typeObject: TypeObject;
|
|
12
12
|
unit: FieldUnit;
|
|
13
13
|
includeSnippet?: boolean;
|
|
14
|
-
}):
|
|
14
|
+
}): import("@fibery/expression-utils").Select;
|
|
15
15
|
//#endregion
|
|
16
16
|
export { getHasAccessToSecret, getHasAccessToSecretExpr, getRichTextQuerySelect, hasAccessToSecretKey };
|
|
@@ -8,10 +8,9 @@ import isEqual from "lodash/isEqual.js";
|
|
|
8
8
|
//#region src/private/smart-folder.ts
|
|
9
9
|
const visitSmartFolder = (smartFolder, visitor) => immutableUpdate(smartFolder, { "fibery/meta": {
|
|
10
10
|
items: { $apply: (items = []) => {
|
|
11
|
-
const isOldSmartFolder = !items.every((item) => Object.hasOwn(item, "groupBy"));
|
|
12
11
|
const removedItemsIndexes = items.map((item, index) => visitor.visitQueryExpression(item.query) ? null : index).filter((value) => value !== null);
|
|
13
12
|
return items.map((item) => {
|
|
14
|
-
if (
|
|
13
|
+
if (!Object.hasOwn(item, "groupBy")) return item;
|
|
15
14
|
const fromType = get(item, ["query", "q/from"]);
|
|
16
15
|
return fromType ? immutableUpdate(item, { groupBy: { $apply: (groupBy) => {
|
|
17
16
|
if (!groupBy) return null;
|
|
@@ -19,7 +18,7 @@ const visitSmartFolder = (smartFolder, visitor) => immutableUpdate(smartFolder,
|
|
|
19
18
|
return visitor.visitGroupByExpression(groupBy, fromType, removedItemsBeforeTargetLengths);
|
|
20
19
|
} } }) : item;
|
|
21
20
|
}).map((item) => {
|
|
22
|
-
if (
|
|
21
|
+
if (Array.isArray(item.groupingExpression) || !Object.hasOwn(item, "groupBy") && !item.groupingExpression) return item;
|
|
23
22
|
const fromType = get(item, ["query", "q/from"]);
|
|
24
23
|
return fromType ? immutableUpdate(item, { groupingExpression: { $apply: (groupingExpression) => {
|
|
25
24
|
if (!groupingExpression) return null;
|
|
@@ -88,32 +87,23 @@ const replaceNamesWithIdsInGroupByExpression = (schema, groupByExpression, fromT
|
|
|
88
87
|
const visitor = replaceNamesWithIdsVisitor(typeObject);
|
|
89
88
|
return Object.fromEntries(Object.entries(groupByExpression).map(([index, { expression }]) => [index, { expression: visitor.visitExpression(expression) }]));
|
|
90
89
|
};
|
|
91
|
-
const replaceHideHierarchiesWithoutType = (smartFolder, replaceType) => {
|
|
92
|
-
const targetType = get(smartFolder, ["fibery/meta", "hideHierarchiesWithoutType"]);
|
|
93
|
-
if (typeof targetType !== "string") return smartFolder;
|
|
94
|
-
const replacedType = replaceType(targetType);
|
|
95
|
-
if (!replacedType) return smartFolder;
|
|
96
|
-
return immutableUpdate(smartFolder, { "fibery/meta": { hideHierarchiesWithoutType: { $set: replacedType } } });
|
|
97
|
-
};
|
|
98
90
|
const replaceNamesWithIdsInSmartFolder = (schema, smartFolder) => {
|
|
99
|
-
|
|
91
|
+
return visitSmartFolder(smartFolder, {
|
|
100
92
|
visitQueryExpression: (query) => replaceNamesWithIdsInQueryExpression(schema, query),
|
|
101
93
|
visitFilter: (fromType, expression) => replaceNamesWithIdsInFilter(schema, fromType, expression),
|
|
102
94
|
visitGroupByExpression: (groupBy, fromType) => replaceNamesWithIdsInGroupByExpression(schema, groupBy, fromType),
|
|
103
95
|
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
|
|
104
96
|
visitUnitGroupKey: (unitGroupKey) => replaceNamesWithIdsInUnitGroupKey(unitGroupKey, schema)
|
|
105
97
|
});
|
|
106
|
-
return replaceHideHierarchiesWithoutType(replacedSmartFolder, (type) => schema.getTypeObjectByName(type)?.id);
|
|
107
98
|
};
|
|
108
99
|
const replaceIdsWithNamesInSmartFolder = (schema, smartFolder) => {
|
|
109
|
-
|
|
100
|
+
return visitSmartFolder(smartFolder, {
|
|
110
101
|
visitQueryExpression: (query) => replaceIdsWithNamesInQueryExpression(schema, query),
|
|
111
102
|
visitFilter: (fromType, expression) => replaceIdsWithNamesInFilter(schema, fromType, expression),
|
|
112
103
|
visitGroupByExpression: (groupBy, fromType) => replaceIdsWithNamesInGroupByExpression(schema, groupBy, fromType),
|
|
113
104
|
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
|
|
114
105
|
visitUnitGroupKey: (unitGroupKey) => replaceIdsWithNamesInUnitGroupKey(unitGroupKey, getFieldObjectsById(smartFolder, schema))
|
|
115
106
|
});
|
|
116
|
-
return replaceHideHierarchiesWithoutType(replacedSmartFolder, (type) => schema.getTypeObjectById(type)?.name);
|
|
117
107
|
};
|
|
118
108
|
const deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder = (schema, smartFolder) => visitSmartFolder(smartFolder, {
|
|
119
109
|
visitQueryExpression: (query) => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, query),
|
|
@@ -3,10 +3,10 @@ import { FieldUnit } from "../units/types.js";
|
|
|
3
3
|
import { FieldObject, TypeObject } from "@fibery/schema";
|
|
4
4
|
import { FiberyObject } from "@fibery/expression-utils/src/types";
|
|
5
5
|
//#region src/unit-utils/get-export-value.d.ts
|
|
6
|
-
declare const getExportValue: ({ object, unit }: {
|
|
6
|
+
declare const getExportValue: <Value = unknown>({ object, unit }: {
|
|
7
7
|
object: FiberyObject;
|
|
8
8
|
unit: FieldUnit;
|
|
9
|
-
}) =>
|
|
9
|
+
}) => Value;
|
|
10
10
|
declare const getReferenceCollectionExportValue: ({ unit, typeObject, object }: {
|
|
11
11
|
object: FiberyObject;
|
|
12
12
|
unit: FieldUnit;
|
|
@@ -20,7 +20,7 @@ declare const getReferenceExportValue: ({ unit, typeObject, object }: {
|
|
|
20
20
|
declare const getSnippetExportValue: ({ object, unit }: {
|
|
21
21
|
object: FiberyObject;
|
|
22
22
|
unit: FieldUnit;
|
|
23
|
-
}) =>
|
|
23
|
+
}) => unknown;
|
|
24
24
|
declare const formatDateRangeExportValue: (value: {
|
|
25
25
|
start: string;
|
|
26
26
|
end: string;
|
|
@@ -33,7 +33,7 @@ declare const getDateRangeExportValue: ({ object, unit, typeObject }: {
|
|
|
33
33
|
declare const getLocationExportValue: ({ object, unit }: {
|
|
34
34
|
object: FiberyObject;
|
|
35
35
|
unit: FieldUnit;
|
|
36
|
-
}) =>
|
|
36
|
+
}) => unknown;
|
|
37
37
|
declare const getTitleExportValue: ({ object, typeObject }: {
|
|
38
38
|
object: FiberyObject;
|
|
39
39
|
typeObject: TypeObject;
|
package/lib/units/board.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ declare const getTypeUnits: () => PureUnit[], getUnitName: (unit: Unit) => strin
|
|
|
44
44
|
schema: import("@fibery/schema").Schema;
|
|
45
45
|
typeObject: TypeObject;
|
|
46
46
|
units: Unit[];
|
|
47
|
-
}) =>
|
|
47
|
+
}) => import("@fibery/expression-utils").Select, getUnitDataDefinition: (unit: Unit) => UnitDataDefinition<ButtonUnit> | UnitDataDefinition<DbUnit> | UnitDataDefinition<FieldUnit>;
|
|
48
48
|
declare const getDefaultUnits: (typeObject: TypeObject) => PureUnit[];
|
|
49
49
|
//#endregion
|
|
50
50
|
export { getCardUnitsSelect, getDefaultUnits, getHardcodedUnitsForView, getTypeUnits, getUnitDataDefinition, getUnitLabel, getUnitName, getUnitsForField, getUnitsForType, getUnitsForTypePerField };
|
|
@@ -22,7 +22,7 @@ declare const getTypeUnits: () => PureUnit[], getUnitName: (unit: Unit) => strin
|
|
|
22
22
|
schema: import("@fibery/schema").Schema;
|
|
23
23
|
typeObject: import("@fibery/schema").TypeObject;
|
|
24
24
|
units: Unit[];
|
|
25
|
-
}) =>
|
|
25
|
+
}) => import("@fibery/expression-utils").Select, getHardcodedUnitsForView: (typeObject: import("@fibery/schema").TypeObject) => ({
|
|
26
26
|
kind: "user-button";
|
|
27
27
|
type: "user-button" | "icon-button";
|
|
28
28
|
data: {
|
package/lib/units/default.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ declare const getTypeUnits: () => PureUnit[], getUnitName: (unit: Unit) => strin
|
|
|
23
23
|
schema: import("@fibery/schema").Schema;
|
|
24
24
|
typeObject: TypeObject;
|
|
25
25
|
units: Unit[];
|
|
26
|
-
}) =>
|
|
26
|
+
}) => import("@fibery/expression-utils").Select, getUnitLabel: (typeObject: TypeObject, unit: Unit) => string, getHardcodedUnitsForView: (typeObject: TypeObject) => ({
|
|
27
27
|
kind: "user-button";
|
|
28
28
|
type: "user-button" | "icon-button";
|
|
29
29
|
data: {
|
package/lib/units/gantt.d.ts
CHANGED
|
@@ -23,7 +23,7 @@ declare const getTypeUnits: () => PureUnit[], getUnitName: (unit: Unit) => strin
|
|
|
23
23
|
schema: import("@fibery/schema").Schema;
|
|
24
24
|
typeObject: TypeObject;
|
|
25
25
|
units: Unit[];
|
|
26
|
-
}) =>
|
|
26
|
+
}) => import("@fibery/expression-utils").Select, getUnitLabel: (typeObject: TypeObject, unit: Unit) => string, getHardcodedUnitsForView: (typeObject: TypeObject) => ({
|
|
27
27
|
kind: "user-button";
|
|
28
28
|
type: "user-button" | "icon-button";
|
|
29
29
|
data: {
|
package/lib/units/grid.d.ts
CHANGED
|
@@ -22,7 +22,7 @@ declare const getTypeUnits: () => PureUnit[], getUnitName: (unit: Unit) => strin
|
|
|
22
22
|
schema: import("@fibery/schema").Schema;
|
|
23
23
|
typeObject: import("@fibery/schema").TypeObject;
|
|
24
24
|
units: Unit[];
|
|
25
|
-
}) =>
|
|
25
|
+
}) => import("@fibery/expression-utils").Select, getHardcodedUnitsForView: (typeObject: import("@fibery/schema").TypeObject) => ({
|
|
26
26
|
kind: "user-button";
|
|
27
27
|
type: "user-button" | "icon-button";
|
|
28
28
|
data: {
|
package/lib/units/list.d.ts
CHANGED
|
@@ -25,7 +25,7 @@ declare const getTypeUnits: () => PureUnit[], getUnitName: (unit: Unit) => strin
|
|
|
25
25
|
schema: import("@fibery/schema").Schema;
|
|
26
26
|
typeObject: TypeObject;
|
|
27
27
|
units: Unit[];
|
|
28
|
-
}) =>
|
|
28
|
+
}) => import("@fibery/expression-utils").Select, getHardcodedUnitsForView: (typeObject: TypeObject) => ({
|
|
29
29
|
kind: "user-button";
|
|
30
30
|
type: "user-button" | "icon-button";
|
|
31
31
|
data: {
|
|
@@ -46,7 +46,7 @@ declare const makeUnitDefinitionsFactory: (allUnitDefinitions: Record<string, An
|
|
|
46
46
|
schema: Schema;
|
|
47
47
|
typeObject: TypeObject;
|
|
48
48
|
units: Unit[];
|
|
49
|
-
}) =>
|
|
49
|
+
}) => import("@fibery/expression-utils").Select;
|
|
50
50
|
getUnitDataDefinition: (unit: Unit) => AnyUnitDataDefinition;
|
|
51
51
|
};
|
|
52
52
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/views",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "25.0.1",
|
|
4
4
|
"description": "Operations on view objects",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Fibery",
|
|
@@ -33,14 +33,14 @@
|
|
|
33
33
|
"date-fns": "2.29.2",
|
|
34
34
|
"lodash": "4.17.21",
|
|
35
35
|
"moment": "2.29.4",
|
|
36
|
-
"@fibery/expression-utils": "
|
|
37
|
-
"@fibery/helpers": "
|
|
38
|
-
"@fibery/schema": "
|
|
39
|
-
"@fibery/query-utils": "
|
|
36
|
+
"@fibery/expression-utils": "15.0.0",
|
|
37
|
+
"@fibery/helpers": "4.0.0",
|
|
38
|
+
"@fibery/schema": "12.0.0",
|
|
39
|
+
"@fibery/query-utils": "7.0.1"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@fibery/expression-utils": "^
|
|
43
|
-
"@fibery/schema": "^
|
|
42
|
+
"@fibery/expression-utils": "^15.0.0",
|
|
43
|
+
"@fibery/schema": "^12.0.0",
|
|
44
44
|
"immutability-helper": "^2.4.0",
|
|
45
45
|
"lodash": "4.17.21"
|
|
46
46
|
}
|