@fibery/views 20.0.2 → 20.0.3
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/date-time.js +4 -2
- package/lib/field-utils/reference.js +2 -1
- package/lib/field-utils/rich-text.js +3 -2
- package/lib/field-utils/user-active.js +17 -17
- package/lib/field-utils/workflow.js +7 -10
- package/lib/private/timeline.d.ts +1 -0
- package/lib/private/timeline.js +3 -1
- package/lib/private/units.js +11 -8
- package/lib/unit-definitions/avatar.js +9 -6
- package/lib/unit-definitions/back-references-list.js +1 -1
- package/lib/unit-definitions/bool-checkbox.js +1 -1
- package/lib/unit-definitions/bool.js +1 -1
- package/lib/unit-definitions/color-input.js +1 -1
- package/lib/unit-definitions/comments-list.js +4 -3
- package/lib/unit-definitions/date-range-combobox.js +1 -1
- package/lib/unit-definitions/date-range.js +1 -1
- package/lib/unit-definitions/date-time-combobox.js +1 -1
- package/lib/unit-definitions/date.js +1 -1
- package/lib/unit-definitions/file-collection-count.js +4 -3
- package/lib/unit-definitions/file-compact-collection.js +4 -3
- package/lib/unit-definitions/file-compact-reference.js +2 -1
- package/lib/unit-definitions/file-reference.js +3 -2
- package/lib/unit-definitions/files-gallery.js +4 -3
- package/lib/unit-definitions/files-l-list-item.js +3 -2
- package/lib/unit-definitions/files-l-list.js +4 -3
- package/lib/unit-definitions/files-list-item.js +3 -2
- package/lib/unit-definitions/files-list.js +4 -3
- package/lib/unit-definitions/icon-button.js +1 -1
- package/lib/unit-definitions/index.js +2 -2
- package/lib/unit-definitions/json-input.js +1 -1
- package/lib/unit-definitions/number-input.js +1 -1
- package/lib/unit-definitions/reference-collection-combobox.js +1 -1
- package/lib/unit-definitions/reference-collection-list.js +1 -1
- package/lib/unit-definitions/reference-collection-view.js +1 -1
- package/lib/unit-definitions/reference-collection.js +6 -5
- package/lib/unit-definitions/reference-combobox.js +1 -1
- package/lib/unit-definitions/reference.js +3 -2
- package/lib/unit-definitions/rich-text-document.js +1 -1
- package/lib/unit-definitions/text-input.js +1 -1
- package/lib/unit-definitions/text.js +1 -1
- package/lib/unit-definitions/user-role.js +1 -1
- package/lib/units/canvas/all-units-data-definitions.js +1 -1
- package/lib/units/grid.js +3 -3
- package/lib/units/make-factory.js +6 -4
- package/package.json +7 -7
|
@@ -22,8 +22,10 @@ const parseStart = ({ value, type }) => {
|
|
|
22
22
|
throw new NotImplementedError(type);
|
|
23
23
|
};
|
|
24
24
|
const parseEnd = ({ value, type, minimumDelta = null }) => {
|
|
25
|
-
if (isDateType(type))
|
|
26
|
-
|
|
25
|
+
if (isDateType(type)) {
|
|
26
|
+
if (isRangeType(type)) return parseDate(value).subtract(...minimumDelta || defaultDateDelta).endOf("day");
|
|
27
|
+
else return parseDate(value).endOf("day");
|
|
28
|
+
}
|
|
27
29
|
if (isDateTimeType(type)) return parseDateTime(value).subtract(...minimumDelta || defaultDateTimeDelta).startOf("second");
|
|
28
30
|
throw new NotImplementedError(type);
|
|
29
31
|
};
|
|
@@ -42,7 +42,8 @@ const getReferenceFieldNormalizedSelectClause = (fieldObject, contextPath) => {
|
|
|
42
42
|
const { typeObject } = fieldObject;
|
|
43
43
|
if (typeObject.isEntityRef) {
|
|
44
44
|
const pairs = fieldObject.multiRelatedFieldObjects.map((f) => {
|
|
45
|
-
const
|
|
45
|
+
const select = getReferenceTypeSelectClause({ typeObject: f.holderTypeObject }, [contextPath.concat(f.holderType)]);
|
|
46
|
+
const normalizedSelect = normalizeSelect(select);
|
|
46
47
|
return [f.holderType, {
|
|
47
48
|
...normalizedSelect,
|
|
48
49
|
[isSelectForMultiFieldKey]: true
|
|
@@ -16,7 +16,7 @@ function getRichTextQuerySelect({ typeObject, unit: { expression }, includeSnipp
|
|
|
16
16
|
...toSelectMapClause([terminalTypeObject.idField, "Collaboration~Documents/secret"]),
|
|
17
17
|
...includeSnippet ? toSelectMapClause([terminalTypeObject.idField, "Collaboration~Documents/Snippet"]) : {}
|
|
18
18
|
});
|
|
19
|
-
|
|
19
|
+
const nested = [...expression].reverse().reduce((inner, field, reversedIndex) => {
|
|
20
20
|
const originalIndex = expression.length - 1 - reversedIndex;
|
|
21
21
|
if (!(originalIndex === expression.length - 1)) {
|
|
22
22
|
const { idField } = fieldObjects[originalIndex].typeObject;
|
|
@@ -27,7 +27,8 @@ function getRichTextQuerySelect({ typeObject, unit: { expression }, includeSnipp
|
|
|
27
27
|
return { [field]: innerWithId };
|
|
28
28
|
}
|
|
29
29
|
return { [field]: inner };
|
|
30
|
-
}, innerNormalized)
|
|
30
|
+
}, innerNormalized);
|
|
31
|
+
return denormalizeSelect(nested);
|
|
31
32
|
}
|
|
32
33
|
//#endregion
|
|
33
34
|
export { getHasAccessToSecret, getHasAccessToSecretExpr, getRichTextQuerySelect, hasAccessToSecretKey };
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { isUserActiveDynamicKeyPrefix, makeDynamicKey } from "../unit-utils/dynamic-keys.js";
|
|
2
|
-
import {
|
|
2
|
+
import { memoizeLeak, memoizeWeak } from "@fibery/helpers/src/_";
|
|
3
3
|
//#region src/field-utils/user-active.ts
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
[
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
const noUserActiveQueryPredicate = () => null;
|
|
5
|
+
const getIsUserActiveQueryPredicate = memoizeWeak((typeObject) => {
|
|
6
|
+
if (typeObject.name !== "fibery/user") return noUserActiveQueryPredicate;
|
|
7
|
+
return memoizeLeak((contextPath) => {
|
|
8
|
+
const expression = [
|
|
9
|
+
"=",
|
|
10
|
+
[...contextPath, "fibery/active?"],
|
|
11
|
+
"$true"
|
|
12
|
+
];
|
|
13
|
+
return {
|
|
14
|
+
key: makeDynamicKey(isUserActiveDynamicKeyPrefix),
|
|
15
|
+
expression
|
|
16
|
+
};
|
|
17
|
+
}, (contextPath) => contextPath.join(","));
|
|
18
|
+
});
|
|
16
19
|
const getIsUserActiveSelect = ({ typeObject, contextPath = [] }) => {
|
|
17
|
-
const isUserActiveQueryPredicate = getIsUserActiveQueryPredicate(
|
|
18
|
-
typeObject,
|
|
19
|
-
contextPath
|
|
20
|
-
});
|
|
20
|
+
const isUserActiveQueryPredicate = getIsUserActiveQueryPredicate(typeObject)(contextPath);
|
|
21
21
|
return isUserActiveQueryPredicate ? { [isUserActiveQueryPredicate.key]: isUserActiveQueryPredicate.expression } : null;
|
|
22
22
|
};
|
|
23
23
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { isFinalStateDynamicKeyPrefix, makeDynamicKey } from "../unit-utils/dynamic-keys.js";
|
|
2
|
-
import {
|
|
2
|
+
import { memoizeLeak, memoizeWeak } from "@fibery/helpers/src/_";
|
|
3
3
|
//#region src/field-utils/workflow.ts
|
|
4
4
|
function isWorkflowType(typeObject) {
|
|
5
5
|
return typeObject.isEnum && typeObject.nameParts.namespace === "workflow";
|
|
@@ -13,9 +13,11 @@ const getWorkflowFieldObject = (typeObject) => {
|
|
|
13
13
|
});
|
|
14
14
|
return workflowFieldObject;
|
|
15
15
|
};
|
|
16
|
-
const
|
|
16
|
+
const noFinalStateQueryPredicate = () => null;
|
|
17
|
+
const getIsFinalStateQueryPredicate = memoizeWeak((typeObject) => {
|
|
17
18
|
const workflowFieldObject = getWorkflowFieldObject(typeObject);
|
|
18
|
-
if (workflowFieldObject)
|
|
19
|
+
if (!workflowFieldObject) return noFinalStateQueryPredicate;
|
|
20
|
+
return memoizeLeak((contextPath) => {
|
|
19
21
|
const expression = [
|
|
20
22
|
"=",
|
|
21
23
|
[
|
|
@@ -29,15 +31,10 @@ const getIsFinalStateQueryPredicate = memoize(({ typeObject, contextPath }) => {
|
|
|
29
31
|
key: makeDynamicKey(isFinalStateDynamicKeyPrefix),
|
|
30
32
|
expression
|
|
31
33
|
};
|
|
32
|
-
}
|
|
33
|
-
}, ({ typeObject, contextPath }) => {
|
|
34
|
-
return `${typeObject.name}_${typeObject.version}_${contextPath.join(",")}`;
|
|
34
|
+
}, (contextPath) => contextPath.join(","));
|
|
35
35
|
});
|
|
36
36
|
const getIsFinalStateSelect = ({ typeObject, contextPath = [] }) => {
|
|
37
|
-
const isFinalStateQueryPredicate = getIsFinalStateQueryPredicate(
|
|
38
|
-
typeObject,
|
|
39
|
-
contextPath
|
|
40
|
-
});
|
|
37
|
+
const isFinalStateQueryPredicate = getIsFinalStateQueryPredicate(typeObject)(contextPath);
|
|
41
38
|
return isFinalStateQueryPredicate ? { [isFinalStateQueryPredicate.key]: isFinalStateQueryPredicate.expression } : null;
|
|
42
39
|
};
|
|
43
40
|
function getWorkflowTypeSelect(typeObject) {
|
package/lib/private/timeline.js
CHANGED
|
@@ -10,6 +10,7 @@ import set from "lodash/set.js";
|
|
|
10
10
|
import some from "lodash/some.js";
|
|
11
11
|
import has from "lodash/has.js";
|
|
12
12
|
//#region src/private/timeline.ts
|
|
13
|
+
const visitMetaItemUnits = (fromType, units, visitor) => units ? units.filter(truthy).map((unit) => visitViewUnit(fromType, unit, visitor)).filter(isUnitExpressionValid).map((unit, idx, nextUnits) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, nextUnits) : unit).filter((unit) => unit !== REMOVE) : void 0;
|
|
13
14
|
const visitAxisSingle = (axis, visitor) => {
|
|
14
15
|
const fromType = get(axis, ["query", "q/from"]);
|
|
15
16
|
const firstOrNull = (x) => Array.isArray(x) ? x[0] : null;
|
|
@@ -50,7 +51,8 @@ const visitView = (view, visitor) => immutableUpdate(view, { "fibery/meta": {
|
|
|
50
51
|
contextExpression: { $apply: (contextExpression) => visitContextExpression(fromType, contextExpression, visitor) },
|
|
51
52
|
filter: { $apply: (filter) => filter ? visitor.visitFilter(fromType, filter) : null },
|
|
52
53
|
query: { $apply: (query) => query ? visitor.visitQueryExpression(query) : null },
|
|
53
|
-
units: { $apply: (units) =>
|
|
54
|
+
units: { $apply: (units) => visitMetaItemUnits(fromType, units, visitor) },
|
|
55
|
+
laneUnits: { $apply: (laneUnits) => visitMetaItemUnits(fromType, laneUnits, visitor) },
|
|
54
56
|
colorCoding: { $apply: (colorCodings) => {
|
|
55
57
|
return colorCodings && colorCodings.map((colorCoding) => ({
|
|
56
58
|
...colorCoding,
|
package/lib/private/units.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AVATAR_EXTENSION_FIELD } from "../field-utils/avatar.js";
|
|
1
2
|
import { REMOVE } from "./utils.js";
|
|
2
3
|
import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
|
|
3
4
|
//#region src/private/units.ts
|
|
@@ -68,14 +69,16 @@ const migrateUnit = (schema, fromType, unit, units, opts = migrateUnitOptsDefaul
|
|
|
68
69
|
type: opts.migrateFileCollectionUnit ? "file-collection-count" : "collection-count"
|
|
69
70
|
};
|
|
70
71
|
}
|
|
71
|
-
if (unit.type === "avatar"
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
72
|
+
if (unit.type === "avatar") {
|
|
73
|
+
if (unit.kind === "db" || !unit.expression) {
|
|
74
|
+
const isAvatarExntensionEnabled = schema.typeObjectsByName[fromType]?.installedMixins.has("avatar/avatar-mixin");
|
|
75
|
+
const hasAvatarExntensionField = getFieldType(schema, fromType, AVATAR_EXTENSION_FIELD) === "fibery/file";
|
|
76
|
+
if (isAvatarExntensionEnabled && hasAvatarExntensionField) return {
|
|
77
|
+
...unit,
|
|
78
|
+
expression: unit.expression ?? ["avatar/avatars"],
|
|
79
|
+
kind: "field"
|
|
80
|
+
};
|
|
81
|
+
}
|
|
79
82
|
}
|
|
80
83
|
if (opts.migrateFileCollectionUnit && unit.type === "collection-count") {
|
|
81
84
|
const [field] = unit.expression;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAvatarSelectQuery, isAvatarExtensionEnabledType, isAvatarExtensionField } from "../field-utils/avatar.js";
|
|
1
|
+
import { AVATAR_EXTENSION_FIELD, getAvatarSelectQuery, isAvatarExtensionEnabledType, isAvatarExtensionField } from "../field-utils/avatar.js";
|
|
2
2
|
import { generateAccessCheckQueryExpression } from "../unit-utils/access.js";
|
|
3
3
|
import { calculateUnitExpressionErrors, canEditFieldExpression } from "../unit-utils/common.js";
|
|
4
4
|
import { getReferenceExportValue } from "../unit-utils/get-export-value.js";
|
|
@@ -19,10 +19,11 @@ const Avatar = {
|
|
|
19
19
|
getLabel({ typeObject, unit }) {
|
|
20
20
|
const { expression } = unit;
|
|
21
21
|
if (expression) {
|
|
22
|
-
|
|
22
|
+
const fieldObject = getFieldObjectByFieldExpression({
|
|
23
23
|
typeObject,
|
|
24
24
|
expression
|
|
25
|
-
})
|
|
25
|
+
});
|
|
26
|
+
if (isAvatarExtensionEnabledType(fieldObject.typeObject)) return `Avatar of ${getFieldLabel({
|
|
26
27
|
typeObject,
|
|
27
28
|
unit
|
|
28
29
|
})}`;
|
|
@@ -32,7 +33,8 @@ const Avatar = {
|
|
|
32
33
|
makeUnit(args) {
|
|
33
34
|
if (!args) return {
|
|
34
35
|
type,
|
|
35
|
-
kind: "
|
|
36
|
+
kind: "field",
|
|
37
|
+
expression: [AVATAR_EXTENSION_FIELD]
|
|
36
38
|
};
|
|
37
39
|
assertIsValidExpression(args.expression);
|
|
38
40
|
return {
|
|
@@ -57,7 +59,7 @@ const Avatar = {
|
|
|
57
59
|
}),
|
|
58
60
|
getAvatarSelectQuery({ typeObject: terminalFieldObject.typeObject })
|
|
59
61
|
].filter(truthy)));
|
|
60
|
-
|
|
62
|
+
const nested = [...expression].reverse().reduce((inner, field, reversedIndex) => {
|
|
61
63
|
const originalIndex = expression.length - 1 - reversedIndex;
|
|
62
64
|
if (!(originalIndex === expression.length - 1)) {
|
|
63
65
|
const { idField } = fieldObjects[originalIndex].typeObject;
|
|
@@ -68,7 +70,8 @@ const Avatar = {
|
|
|
68
70
|
return { [field]: innerWithId };
|
|
69
71
|
}
|
|
70
72
|
return { [field]: inner };
|
|
71
|
-
}, innerSelect)
|
|
73
|
+
}, innerSelect);
|
|
74
|
+
return denormalizeSelect(nested);
|
|
72
75
|
},
|
|
73
76
|
calculateErrors: calculateUnitExpressionErrors,
|
|
74
77
|
getExportValue: ({ typeObject, unit, object }) => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getEntityLinksListSelect } from "../field-utils/back-references.js";
|
|
2
2
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
3
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
4
3
|
import { getExportValue } from "../unit-utils/get-export-value.js";
|
|
5
4
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
5
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
6
6
|
import { getFieldObjectByFieldExpression } from "@fibery/expression-utils/src/utils";
|
|
7
7
|
import { calculateDefaultOrderBy } from "@fibery/query-utils/src/query";
|
|
8
8
|
//#region src/unit-definitions/back-references-list.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
2
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
3
2
|
import { getExportValue } from "../unit-utils/get-export-value.js";
|
|
4
3
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
4
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
5
5
|
import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
|
|
6
6
|
//#region src/unit-definitions/bool-checkbox.ts
|
|
7
7
|
const type = "bool-checkbox";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
2
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
3
2
|
import { getExportValue } from "../unit-utils/get-export-value.js";
|
|
4
3
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
4
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
5
5
|
import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
|
|
6
6
|
//#region src/unit-definitions/bool.ts
|
|
7
7
|
const type = "bool";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
2
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
3
2
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
3
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
4
4
|
import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
|
|
5
5
|
//#region src/unit-definitions/color-input.ts
|
|
6
6
|
const type = "color-input";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getQuerySelect } from "../field-utils/comments.js";
|
|
2
2
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
3
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
4
3
|
import { getExportValue } from "../unit-utils/get-export-value.js";
|
|
5
4
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
5
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
6
6
|
import { getFieldObjectByFieldExpression } from "@fibery/expression-utils/src/utils";
|
|
7
7
|
//#region src/unit-definitions/comments-list.ts
|
|
8
8
|
const type = "comments-list";
|
|
@@ -14,10 +14,11 @@ const CommentsList = {
|
|
|
14
14
|
getLabel: getFieldLabel,
|
|
15
15
|
getQuerySelect: ({ typeObject, unit }) => {
|
|
16
16
|
const { expression } = unit;
|
|
17
|
-
|
|
17
|
+
const fieldObject = getFieldObjectByFieldExpression({
|
|
18
18
|
typeObject,
|
|
19
19
|
expression
|
|
20
|
-
})
|
|
20
|
+
});
|
|
21
|
+
return getQuerySelect(fieldObject);
|
|
21
22
|
},
|
|
22
23
|
calculateErrors: calculateUnitExpressionErrors,
|
|
23
24
|
getExportValue,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
2
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
3
2
|
import { getDateRangeExportValue } from "../unit-utils/get-export-value.js";
|
|
4
3
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
4
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
5
5
|
import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
|
|
6
6
|
//#region src/unit-definitions/date-range-combobox.ts
|
|
7
7
|
const type = "date-range-combobox";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
2
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
3
2
|
import { getDateRangeExportValue } from "../unit-utils/get-export-value.js";
|
|
4
3
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
4
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
5
5
|
import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
|
|
6
6
|
//#region src/unit-definitions/date-range.ts
|
|
7
7
|
const type = "date-range";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
2
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
3
2
|
import { getExportValue } from "../unit-utils/get-export-value.js";
|
|
4
3
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
4
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
5
5
|
import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
|
|
6
6
|
//#region src/unit-definitions/date-time-combobox.ts
|
|
7
7
|
const type = "date-time-combobox";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
2
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
3
2
|
import { getExportValue } from "../unit-utils/get-export-value.js";
|
|
4
3
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
4
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
5
5
|
import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
|
|
6
6
|
//#region src/unit-definitions/date.ts
|
|
7
7
|
const type = "date";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getFilesSelect } from "../field-utils/file.js";
|
|
2
2
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
3
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
4
3
|
import { getExportValue } from "../unit-utils/get-export-value.js";
|
|
5
4
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
5
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
6
6
|
import { wrapNormalizedInExpression } from "../unit-utils/wrap-normalized-in-expression.js";
|
|
7
7
|
import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
|
|
8
8
|
import { denormalizeSelect, normalizeSelect } from "@fibery/query-utils/src/select";
|
|
@@ -21,11 +21,12 @@ const FileCollectionCount = {
|
|
|
21
21
|
expression
|
|
22
22
|
});
|
|
23
23
|
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
24
|
-
|
|
24
|
+
const collectionNormalized = {
|
|
25
25
|
"q/from": null,
|
|
26
26
|
"q/limit": "q/no-limit",
|
|
27
27
|
"q/select": normalizeSelect(getFilesSelect(terminalFieldObject))
|
|
28
|
-
}
|
|
28
|
+
};
|
|
29
|
+
return denormalizeSelect(wrapNormalizedInExpression(collectionNormalized, fieldObjects, expression));
|
|
29
30
|
},
|
|
30
31
|
getExportValue,
|
|
31
32
|
canExport: () => true
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getFilesSelect } from "../field-utils/file.js";
|
|
2
2
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
3
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
4
3
|
import { getExportValue } from "../unit-utils/get-export-value.js";
|
|
5
4
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
5
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
6
6
|
import { wrapNormalizedInExpression } from "../unit-utils/wrap-normalized-in-expression.js";
|
|
7
7
|
import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
|
|
8
8
|
import { denormalizeSelect, normalizeSelect } from "@fibery/query-utils/src/select";
|
|
@@ -21,11 +21,12 @@ const FileCompactCollection = {
|
|
|
21
21
|
expression
|
|
22
22
|
});
|
|
23
23
|
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
24
|
-
|
|
24
|
+
const collectionNormalized = {
|
|
25
25
|
"q/from": null,
|
|
26
26
|
"q/limit": "q/no-limit",
|
|
27
27
|
"q/select": normalizeSelect(getFilesSelect(terminalFieldObject))
|
|
28
|
-
}
|
|
28
|
+
};
|
|
29
|
+
return denormalizeSelect(wrapNormalizedInExpression(collectionNormalized, fieldObjects, expression));
|
|
29
30
|
},
|
|
30
31
|
getExportValue,
|
|
31
32
|
canExport: () => true
|
|
@@ -29,7 +29,8 @@ const FileCompactReference = {
|
|
|
29
29
|
expression
|
|
30
30
|
});
|
|
31
31
|
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
32
|
-
|
|
32
|
+
const innerNormalized = getReferenceFieldNormalizedSelectClause(terminalFieldObject, expression);
|
|
33
|
+
return denormalizeSelect(wrapNormalizedInExpression(innerNormalized, fieldObjects, expression));
|
|
33
34
|
},
|
|
34
35
|
calculateErrors({ typeObject, unit }) {
|
|
35
36
|
return calculateUnitExpressionErrors({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getFilesSelect } from "../field-utils/file.js";
|
|
2
2
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
3
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
4
3
|
import { getExportValue } from "../unit-utils/get-export-value.js";
|
|
5
4
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
5
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
6
6
|
import { wrapNormalizedInExpression } from "../unit-utils/wrap-normalized-in-expression.js";
|
|
7
7
|
import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
|
|
8
8
|
import { denormalizeSelect, normalizeSelect } from "@fibery/query-utils/src/select";
|
|
@@ -21,7 +21,8 @@ const FileReference = {
|
|
|
21
21
|
expression
|
|
22
22
|
});
|
|
23
23
|
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
24
|
-
|
|
24
|
+
const innerNormalized = normalizeSelect(getFilesSelect(terminalFieldObject));
|
|
25
|
+
return denormalizeSelect(wrapNormalizedInExpression(innerNormalized, fieldObjects, expression));
|
|
25
26
|
},
|
|
26
27
|
getExportValue,
|
|
27
28
|
canExport: () => true
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getFilesSelect } from "../field-utils/file.js";
|
|
2
2
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
3
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
4
3
|
import { getExportValue } from "../unit-utils/get-export-value.js";
|
|
5
4
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
5
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
6
6
|
import { wrapNormalizedInExpression } from "../unit-utils/wrap-normalized-in-expression.js";
|
|
7
7
|
import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
|
|
8
8
|
import { denormalizeSelect, normalizeSelect } from "@fibery/query-utils/src/select";
|
|
@@ -21,11 +21,12 @@ const FilesGallery = {
|
|
|
21
21
|
expression
|
|
22
22
|
});
|
|
23
23
|
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
24
|
-
|
|
24
|
+
const collectionNormalized = {
|
|
25
25
|
"q/from": null,
|
|
26
26
|
"q/limit": "q/no-limit",
|
|
27
27
|
"q/select": normalizeSelect(getFilesSelect(terminalFieldObject))
|
|
28
|
-
}
|
|
28
|
+
};
|
|
29
|
+
return denormalizeSelect(wrapNormalizedInExpression(collectionNormalized, fieldObjects, expression));
|
|
29
30
|
},
|
|
30
31
|
getExportValue,
|
|
31
32
|
canExport: () => true
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getFilesSelect } from "../field-utils/file.js";
|
|
2
2
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
3
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
4
3
|
import { getExportValue } from "../unit-utils/get-export-value.js";
|
|
5
4
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
5
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
6
6
|
import { wrapNormalizedInExpression } from "../unit-utils/wrap-normalized-in-expression.js";
|
|
7
7
|
import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
|
|
8
8
|
import { denormalizeSelect, normalizeSelect } from "@fibery/query-utils/src/select";
|
|
@@ -21,7 +21,8 @@ const FileLListItem = {
|
|
|
21
21
|
expression
|
|
22
22
|
});
|
|
23
23
|
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
24
|
-
|
|
24
|
+
const innerNormalized = normalizeSelect(getFilesSelect(terminalFieldObject));
|
|
25
|
+
return denormalizeSelect(wrapNormalizedInExpression(innerNormalized, fieldObjects, expression));
|
|
25
26
|
},
|
|
26
27
|
getExportValue,
|
|
27
28
|
canExport: () => true
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getFilesSelect } from "../field-utils/file.js";
|
|
2
2
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
3
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
4
3
|
import { getExportValue } from "../unit-utils/get-export-value.js";
|
|
5
4
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
5
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
6
6
|
import { wrapNormalizedInExpression } from "../unit-utils/wrap-normalized-in-expression.js";
|
|
7
7
|
import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
|
|
8
8
|
import { denormalizeSelect, normalizeSelect } from "@fibery/query-utils/src/select";
|
|
@@ -21,11 +21,12 @@ const FileLList = {
|
|
|
21
21
|
expression
|
|
22
22
|
});
|
|
23
23
|
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
24
|
-
|
|
24
|
+
const collectionNormalized = {
|
|
25
25
|
"q/from": null,
|
|
26
26
|
"q/limit": "q/no-limit",
|
|
27
27
|
"q/select": normalizeSelect(getFilesSelect(terminalFieldObject))
|
|
28
|
-
}
|
|
28
|
+
};
|
|
29
|
+
return denormalizeSelect(wrapNormalizedInExpression(collectionNormalized, fieldObjects, expression));
|
|
29
30
|
},
|
|
30
31
|
getExportValue,
|
|
31
32
|
canExport: () => true
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getFilesSelect } from "../field-utils/file.js";
|
|
2
2
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
3
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
4
3
|
import { getExportValue } from "../unit-utils/get-export-value.js";
|
|
5
4
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
5
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
6
6
|
import { wrapNormalizedInExpression } from "../unit-utils/wrap-normalized-in-expression.js";
|
|
7
7
|
import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
|
|
8
8
|
import { denormalizeSelect, normalizeSelect } from "@fibery/query-utils/src/select";
|
|
@@ -21,7 +21,8 @@ const FileListItem = {
|
|
|
21
21
|
expression
|
|
22
22
|
});
|
|
23
23
|
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
24
|
-
|
|
24
|
+
const innerNormalized = normalizeSelect(getFilesSelect(terminalFieldObject));
|
|
25
|
+
return denormalizeSelect(wrapNormalizedInExpression(innerNormalized, fieldObjects, expression));
|
|
25
26
|
},
|
|
26
27
|
getExportValue,
|
|
27
28
|
canExport: () => true
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getFilesSelect } from "../field-utils/file.js";
|
|
2
2
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
3
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
4
3
|
import { getExportValue } from "../unit-utils/get-export-value.js";
|
|
5
4
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
5
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
6
6
|
import { wrapNormalizedInExpression } from "../unit-utils/wrap-normalized-in-expression.js";
|
|
7
7
|
import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
|
|
8
8
|
import { denormalizeSelect, normalizeSelect } from "@fibery/query-utils/src/select";
|
|
@@ -21,11 +21,12 @@ const FileList = {
|
|
|
21
21
|
expression
|
|
22
22
|
});
|
|
23
23
|
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
24
|
-
|
|
24
|
+
const collectionNormalized = {
|
|
25
25
|
"q/from": null,
|
|
26
26
|
"q/limit": "q/no-limit",
|
|
27
27
|
"q/select": normalizeSelect(getFilesSelect(terminalFieldObject))
|
|
28
|
-
}
|
|
28
|
+
};
|
|
29
|
+
return denormalizeSelect(wrapNormalizedInExpression(collectionNormalized, fieldObjects, expression));
|
|
29
30
|
},
|
|
30
31
|
getExportValue,
|
|
31
32
|
canExport: () => true
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
2
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
3
2
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
3
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
4
4
|
import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
|
|
5
5
|
//#region src/unit-definitions/icon-button.ts
|
|
6
6
|
const type = "icon-button";
|
|
@@ -3,11 +3,12 @@ import { AvatarCollection } from "./avatar-collection.js";
|
|
|
3
3
|
import { Avatar } from "./avatar.js";
|
|
4
4
|
import { Bool } from "./bool.js";
|
|
5
5
|
import { CollectionCount } from "./collection-count.js";
|
|
6
|
-
import { Date } from "./date.js";
|
|
7
6
|
import { DateRange } from "./date-range.js";
|
|
7
|
+
import { Date } from "./date.js";
|
|
8
8
|
import { Text } from "./text.js";
|
|
9
9
|
import { Email } from "./email.js";
|
|
10
10
|
import { Emoji } from "./emoji.js";
|
|
11
|
+
import { FileCollectionCount } from "./file-collection-count.js";
|
|
11
12
|
import { IconButton } from "./icon-button.js";
|
|
12
13
|
import { Id } from "./id.js";
|
|
13
14
|
import { Location } from "./location.js";
|
|
@@ -25,7 +26,6 @@ import { TypeIcon } from "./type-icon.js";
|
|
|
25
26
|
import { Url } from "./url.js";
|
|
26
27
|
import { UserButton } from "./user-button.js";
|
|
27
28
|
import { UserRole } from "./user-role.js";
|
|
28
|
-
import { FileCollectionCount } from "./file-collection-count.js";
|
|
29
29
|
//#region src/unit-definitions/index.ts
|
|
30
30
|
var unit_definitions_exports = /* @__PURE__ */ __exportAll({
|
|
31
31
|
Avatar: () => Avatar,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
2
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
3
2
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
3
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
4
4
|
import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
|
|
5
5
|
//#region src/unit-definitions/json-input.ts
|
|
6
6
|
const type = "json-input";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
2
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
3
2
|
import { getNumberExportValue } from "../unit-utils/get-export-value.js";
|
|
4
3
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
4
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
5
5
|
import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
|
|
6
6
|
//#region src/unit-definitions/number-input.tsx
|
|
7
7
|
const type = "number-input";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
2
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
3
2
|
import { getExportValue } from "../unit-utils/get-export-value.js";
|
|
4
3
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
4
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
5
5
|
//#region src/unit-definitions/reference-collection-combobox.ts
|
|
6
6
|
const type = "reference-collection-combobox";
|
|
7
7
|
const ReferenceCollectionCombobox = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
2
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
3
2
|
import { getReferenceCollectionExportValue } from "../unit-utils/get-export-value.js";
|
|
4
3
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
4
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
5
5
|
//#region src/unit-definitions/reference-collection-list.tsx
|
|
6
6
|
const type = "reference-collection-list";
|
|
7
7
|
const ReferenceCollectionList = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
2
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
3
2
|
import { getReferenceCollectionExportValue } from "../unit-utils/get-export-value.js";
|
|
4
3
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
4
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
5
5
|
//#region src/unit-definitions/reference-collection-view.tsx
|
|
6
6
|
const type = "reference-collection-view";
|
|
7
7
|
const ReferenceCollectionView = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { REFERENCE_COLLECTION_LIMIT, calculateReferenceCollectionQuery } from "../field-utils/reference-collection.js";
|
|
2
2
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
3
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
4
3
|
import { getReferenceCollectionExportValue } from "../unit-utils/get-export-value.js";
|
|
5
4
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
5
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
6
6
|
import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
|
|
7
7
|
//#region src/unit-definitions/reference-collection.ts
|
|
8
8
|
const type = "reference-collection";
|
|
@@ -12,11 +12,12 @@ const ReferenceCollection = {
|
|
|
12
12
|
getLabel: getFieldLabel,
|
|
13
13
|
makeUnit: makeUnitMethod(type),
|
|
14
14
|
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
15
|
+
const fieldObjects = getFieldObjectsByFieldExpression({
|
|
16
|
+
typeObject,
|
|
17
|
+
expression
|
|
18
|
+
});
|
|
15
19
|
return calculateReferenceCollectionQuery({
|
|
16
|
-
fieldObjects
|
|
17
|
-
typeObject,
|
|
18
|
-
expression
|
|
19
|
-
}),
|
|
20
|
+
fieldObjects,
|
|
20
21
|
expression,
|
|
21
22
|
limit: REFERENCE_COLLECTION_LIMIT
|
|
22
23
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
2
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
3
2
|
import { getReferenceExportValue } from "../unit-utils/get-export-value.js";
|
|
4
3
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
4
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
5
5
|
//#region src/unit-definitions/reference-combobox.ts
|
|
6
6
|
const type = "reference-combobox";
|
|
7
7
|
const ReferenceCombobox = {
|
|
@@ -29,7 +29,7 @@ const Reference = {
|
|
|
29
29
|
});
|
|
30
30
|
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
31
31
|
const innerNormalized = getReferenceFieldNormalizedSelectClause(terminalFieldObject, expression);
|
|
32
|
-
|
|
32
|
+
const nested = [...expression].reverse().reduce((inner, field, reversedIndex) => {
|
|
33
33
|
const originalIndex = expression.length - 1 - reversedIndex;
|
|
34
34
|
if (!(originalIndex === expression.length - 1)) {
|
|
35
35
|
const { idField } = fieldObjects[originalIndex].typeObject;
|
|
@@ -40,7 +40,8 @@ const Reference = {
|
|
|
40
40
|
return { [field]: innerWithId };
|
|
41
41
|
}
|
|
42
42
|
return { [field]: inner };
|
|
43
|
-
}, innerNormalized)
|
|
43
|
+
}, innerNormalized);
|
|
44
|
+
return denormalizeSelect(nested);
|
|
44
45
|
},
|
|
45
46
|
calculateErrors({ typeObject, unit }) {
|
|
46
47
|
const errors = calculateUnitExpressionErrors({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getRichTextQuerySelect } from "../field-utils/rich-text.js";
|
|
2
2
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
3
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
4
3
|
import { getSnippetExportValue } from "../unit-utils/get-export-value.js";
|
|
5
4
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
5
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
6
6
|
//#region src/unit-definitions/rich-text-document.ts
|
|
7
7
|
const type = "rich-text-document";
|
|
8
8
|
const RichTextDocument = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
2
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
3
2
|
import { getExportValue } from "../unit-utils/get-export-value.js";
|
|
4
3
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
4
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
5
5
|
import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
|
|
6
6
|
//#region src/unit-definitions/text-input.tsx
|
|
7
7
|
const type = "text-input";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
2
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
3
2
|
import { getExportValue } from "../unit-utils/get-export-value.js";
|
|
4
3
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
4
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
5
5
|
import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
|
|
6
6
|
//#region src/unit-definitions/text.ts
|
|
7
7
|
const type = "text";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getUserRoleByKey } from "../field-utils/user-role.js";
|
|
2
2
|
import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
|
|
3
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
4
3
|
import { getExportValue } from "../unit-utils/get-export-value.js";
|
|
4
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
5
5
|
import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
|
|
6
6
|
//#region src/unit-definitions/user-role.ts
|
|
7
7
|
const type = "user-role";
|
|
@@ -2,8 +2,8 @@ import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import { Avatar } from "../../unit-definitions/avatar.js";
|
|
3
3
|
import { Bool } from "../../unit-definitions/bool.js";
|
|
4
4
|
import { CollectionCount } from "../../unit-definitions/collection-count.js";
|
|
5
|
-
import { Date } from "../../unit-definitions/date.js";
|
|
6
5
|
import { DateRange } from "../../unit-definitions/date-range.js";
|
|
6
|
+
import { Date } from "../../unit-definitions/date.js";
|
|
7
7
|
import { Text } from "../../unit-definitions/text.js";
|
|
8
8
|
import { Email } from "../../unit-definitions/email.js";
|
|
9
9
|
import { Emoji } from "../../unit-definitions/emoji.js";
|
package/lib/units/grid.js
CHANGED
|
@@ -3,11 +3,13 @@ import { AvatarCollection } from "../unit-definitions/avatar-collection.js";
|
|
|
3
3
|
import { Avatar } from "../unit-definitions/avatar.js";
|
|
4
4
|
import { Bool } from "../unit-definitions/bool.js";
|
|
5
5
|
import { CollectionCount } from "../unit-definitions/collection-count.js";
|
|
6
|
-
import { Date } from "../unit-definitions/date.js";
|
|
7
6
|
import { DateRange } from "../unit-definitions/date-range.js";
|
|
7
|
+
import { Date } from "../unit-definitions/date.js";
|
|
8
8
|
import { Text } from "../unit-definitions/text.js";
|
|
9
9
|
import { Email } from "../unit-definitions/email.js";
|
|
10
10
|
import { Emoji } from "../unit-definitions/emoji.js";
|
|
11
|
+
import { FileCollectionCount } from "../unit-definitions/file-collection-count.js";
|
|
12
|
+
import { FilesGallery } from "../unit-definitions/files-gallery.js";
|
|
11
13
|
import { IconButton } from "../unit-definitions/icon-button.js";
|
|
12
14
|
import { Id } from "../unit-definitions/id.js";
|
|
13
15
|
import { Location } from "../unit-definitions/location.js";
|
|
@@ -25,9 +27,7 @@ import { TypeIcon } from "../unit-definitions/type-icon.js";
|
|
|
25
27
|
import { Url } from "../unit-definitions/url.js";
|
|
26
28
|
import { UserButton } from "../unit-definitions/user-button.js";
|
|
27
29
|
import { UserRole } from "../unit-definitions/user-role.js";
|
|
28
|
-
import { FileCollectionCount } from "../unit-definitions/file-collection-count.js";
|
|
29
30
|
import { makeUnitDefinitionsFactory } from "./make-factory.js";
|
|
30
|
-
import { FilesGallery } from "../unit-definitions/files-gallery.js";
|
|
31
31
|
import { FileReference } from "@fibery/views/src/unit-definitions/file-reference";
|
|
32
32
|
//#region src/units/grid.ts
|
|
33
33
|
var grid_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -180,13 +180,14 @@ const makeUnitDefinitionsFactory = (allUnitDefinitions) => {
|
|
|
180
180
|
* @returns flat list of all units for given type
|
|
181
181
|
*/
|
|
182
182
|
function getUnitsForType(typeObject, options = {}) {
|
|
183
|
-
|
|
183
|
+
const collection = flatMap(typeObject.fieldObjects.filter((x) => !x.isHidden), (fieldObject) => getUnitsForField(fieldObject, options).map((unit) => ({
|
|
184
184
|
unit,
|
|
185
185
|
fieldObject
|
|
186
186
|
}))).concat(getTypeUnits().map((unit) => ({
|
|
187
187
|
unit,
|
|
188
188
|
fieldObject: typeObject.titleFieldObject
|
|
189
|
-
})))
|
|
189
|
+
})));
|
|
190
|
+
return sortBy(collection, ({ unit }) => {
|
|
190
191
|
const index = staticUnitsTypeOrder.indexOf(unit.type);
|
|
191
192
|
return index === -1 ? staticUnitsTypeOrder.length : index;
|
|
192
193
|
});
|
|
@@ -240,7 +241,7 @@ const makeUnitDefinitionsFactory = (allUnitDefinitions) => {
|
|
|
240
241
|
return NotFound;
|
|
241
242
|
};
|
|
242
243
|
const getCardUnitsSelect = ({ schema, typeObject, units }) => {
|
|
243
|
-
|
|
244
|
+
const selects = units.filter((unit) => {
|
|
244
245
|
return isUnitEnabled(unit) && unit.kind !== "user-button" && !unit.expression?.includes("documents/documents") && !unit.expression?.includes("whiteboards/whiteboards");
|
|
245
246
|
}).map((unit) => {
|
|
246
247
|
if (calculateUnitExpressionErrors({
|
|
@@ -254,7 +255,8 @@ const makeUnitDefinitionsFactory = (allUnitDefinitions) => {
|
|
|
254
255
|
});
|
|
255
256
|
assert(isPlainObject(select), "getQuerySelect must return object-shaped select");
|
|
256
257
|
return select;
|
|
257
|
-
})
|
|
258
|
+
});
|
|
259
|
+
return mergeDenormalizedSelects(selects);
|
|
258
260
|
};
|
|
259
261
|
return {
|
|
260
262
|
getTypeUnits,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/views",
|
|
3
|
-
"version": "20.0.
|
|
3
|
+
"version": "20.0.3",
|
|
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": "10.0.
|
|
37
|
-
"@fibery/
|
|
38
|
-
"@fibery/
|
|
39
|
-
"@fibery/schema": "10.3.
|
|
36
|
+
"@fibery/expression-utils": "10.0.3",
|
|
37
|
+
"@fibery/query-utils": "2.0.3",
|
|
38
|
+
"@fibery/helpers": "3.3.0",
|
|
39
|
+
"@fibery/schema": "10.3.2"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@fibery/expression-utils": "^10.0.
|
|
43
|
-
"@fibery/schema": "^10.3.
|
|
42
|
+
"@fibery/expression-utils": "^10.0.3",
|
|
43
|
+
"@fibery/schema": "^10.3.2",
|
|
44
44
|
"immutability-helper": "^2.4.0",
|
|
45
45
|
"lodash": "4.17.21"
|
|
46
46
|
}
|