@fibery/views 18.0.4 → 19.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/src/field-utils/reference-collection.d.ts +5 -10
- package/lib/src/field-utils/reference-collection.js +41 -19
- package/lib/src/field-utils/rich-text.d.ts +5 -4
- package/lib/src/field-utils/rich-text.js +22 -11
- package/lib/src/index.d.ts +28 -16
- package/lib/src/index.js +1 -1
- package/lib/src/private/board.d.ts +15 -11
- package/lib/src/private/board.js +8 -7
- package/lib/src/private/calendar.d.ts +14 -10
- package/lib/src/private/calendar.js +4 -3
- package/lib/src/private/feed.d.ts +14 -10
- package/lib/src/private/feed.js +4 -3
- package/lib/src/private/form.d.ts +25 -3
- package/lib/src/private/form.js +3 -3
- package/lib/src/private/map.d.ts +14 -10
- package/lib/src/private/map.js +4 -3
- package/lib/src/private/smart-folder.d.ts +23 -15
- package/lib/src/private/smart-folder.js +16 -13
- package/lib/src/private/timeline.d.ts +39 -10
- package/lib/src/private/timeline.js +8 -6
- package/lib/src/private/units.d.ts +10 -6
- package/lib/src/private/units.js +43 -22
- package/lib/src/private/utils.d.ts +64 -17
- package/lib/src/private/utils.js +26 -20
- package/lib/src/truthy.d.ts +1 -0
- package/lib/src/truthy.js +7 -0
- package/lib/src/unit-definitions/avatar-collection.js +24 -19
- package/lib/src/unit-definitions/avatar.js +23 -15
- package/lib/src/unit-definitions/collection-count.js +7 -7
- package/lib/src/unit-definitions/file-collection-count.js +9 -7
- package/lib/src/unit-definitions/file-compact-collection.js +9 -7
- package/lib/src/unit-definitions/file-compact-reference.js +5 -4
- package/lib/src/unit-definitions/file-reference.js +6 -4
- package/lib/src/unit-definitions/files-gallery.js +9 -7
- package/lib/src/unit-definitions/files-l-list-item.js +6 -4
- package/lib/src/unit-definitions/files-l-list.js +9 -7
- package/lib/src/unit-definitions/files-list-item.js +6 -4
- package/lib/src/unit-definitions/files-list.js +9 -7
- package/lib/src/unit-definitions/number.js +2 -4
- package/lib/src/unit-definitions/progress-bar.js +1 -4
- package/lib/src/unit-definitions/reference-collection.js +4 -3
- package/lib/src/unit-definitions/reference.js +17 -5
- package/lib/src/unit-definitions/rich-text-snippet.d.ts +1 -0
- package/lib/src/unit-definitions/rich-text-snippet.js +6 -11
- package/lib/src/unit-utils/decimal.js +10 -6
- package/lib/src/unit-utils/get-export-value.d.ts +1 -1
- package/lib/src/unit-utils/get-export-value.js +2 -1
- package/lib/src/unit-utils/get-field-label.js +2 -2
- package/lib/src/unit-utils/wrap-normalized-in-expression.d.ts +3 -0
- package/lib/src/unit-utils/wrap-normalized-in-expression.js +14 -0
- package/lib/src/units/board.d.ts +6 -3
- package/lib/src/units/canvas/index.d.ts +6 -3
- package/lib/src/units/default.d.ts +6 -3
- package/lib/src/units/gantt.d.ts +6 -3
- package/lib/src/units/grid.d.ts +6 -3
- package/lib/src/units/grid.js +4 -0
- package/lib/src/units/list.d.ts +6 -3
- package/lib/src/units/make-factory.d.ts +10 -9
- package/lib/src/units/make-factory.js +26 -10
- package/lib/src/units/types.d.ts +1 -1
- package/package.json +26 -26
- package/lib/jest.config.d.ts +0 -2
- package/lib/jest.config.js +0 -32
|
@@ -7,10 +7,10 @@ exports.Avatar = void 0;
|
|
|
7
7
|
const compact_1 = __importDefault(require("lodash/compact"));
|
|
8
8
|
const select_1 = require("@fibery/query-utils/src/select");
|
|
9
9
|
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
10
|
-
const array_1 = require("@fibery/helpers/utils/array");
|
|
11
10
|
const avatar_1 = require("../field-utils/avatar");
|
|
12
11
|
const common_1 = require("../unit-utils/common");
|
|
13
12
|
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
13
|
+
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
14
14
|
const type = "avatar";
|
|
15
15
|
const getSelfAvatarSelectQuery = (typeObject) => (0, avatar_1.getAvatarSelectQuery)({ typeObject }) || {};
|
|
16
16
|
exports.Avatar = {
|
|
@@ -25,12 +25,9 @@ exports.Avatar = {
|
|
|
25
25
|
getLabel({ typeObject, unit }) {
|
|
26
26
|
const { expression } = unit;
|
|
27
27
|
if (expression) {
|
|
28
|
-
const fieldObject = (0, utils_1.getFieldObjectByFieldExpression)({
|
|
29
|
-
typeObject,
|
|
30
|
-
expression,
|
|
31
|
-
});
|
|
28
|
+
const fieldObject = (0, utils_1.getFieldObjectByFieldExpression)({ typeObject, expression });
|
|
32
29
|
if ((0, avatar_1.isAvatarExtensionEnabledType)(fieldObject.typeObject)) {
|
|
33
|
-
return `Avatar of ${
|
|
30
|
+
return `Avatar of ${(0, get_field_label_1.getFieldLabel)({ typeObject, unit })}`;
|
|
34
31
|
}
|
|
35
32
|
}
|
|
36
33
|
return "Avatar";
|
|
@@ -47,17 +44,28 @@ exports.Avatar = {
|
|
|
47
44
|
if (!expression) {
|
|
48
45
|
return getSelfAvatarSelectQuery(typeObject);
|
|
49
46
|
}
|
|
50
|
-
const
|
|
51
|
-
const
|
|
52
|
-
if ((0, avatar_1.isAvatarExtensionField)(
|
|
47
|
+
const fieldObjects = (0, utils_1.getFieldObjectsByFieldExpression)({ typeObject, expression });
|
|
48
|
+
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
49
|
+
if ((0, avatar_1.isAvatarExtensionField)(terminalFieldObject)) {
|
|
53
50
|
return getSelfAvatarSelectQuery(typeObject);
|
|
54
51
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
const innerSelect = (0, select_1.normalizeSelect)((0, select_1.mergeDenormalizedSelects)((0, compact_1.default)([
|
|
53
|
+
(0, select_1.toSelectMapClause)([terminalFieldObject.typeObject.idField, terminalFieldObject.typeObject.titleField]),
|
|
54
|
+
(0, avatar_1.getAvatarSelectQuery)({ typeObject: terminalFieldObject.typeObject }),
|
|
55
|
+
])));
|
|
56
|
+
// Wrap in the full expression path (innermost to outermost).
|
|
57
|
+
// For intermediate reference fields, also include their entity's id so normalizr can normalize them.
|
|
58
|
+
const nested = [...expression].reverse().reduce((inner, field, reversedIndex) => {
|
|
59
|
+
const originalIndex = expression.length - 1 - reversedIndex;
|
|
60
|
+
const isTerminal = originalIndex === expression.length - 1;
|
|
61
|
+
if (!isTerminal) {
|
|
62
|
+
const { idField } = fieldObjects[originalIndex].typeObject;
|
|
63
|
+
const innerWithId = idField ? { [idField]: idField, ...inner } : inner;
|
|
64
|
+
return { [field]: innerWithId };
|
|
65
|
+
}
|
|
66
|
+
return { [field]: inner };
|
|
67
|
+
}, innerSelect);
|
|
68
|
+
return (0, select_1.denormalizeSelect)(nested);
|
|
61
69
|
},
|
|
62
70
|
calculateErrors: common_1.calculateUnitExpressionErrors,
|
|
63
71
|
getExportValue: ({ typeObject, unit, object }) => {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.CollectionCount = void 0;
|
|
4
|
-
const array_1 = require("@fibery/helpers/utils/array");
|
|
5
4
|
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
6
5
|
const reference_collection_1 = require("../field-utils/reference-collection");
|
|
7
6
|
const common_1 = require("../unit-utils/common");
|
|
7
|
+
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
8
8
|
const type = "collection-count";
|
|
9
9
|
exports.CollectionCount = {
|
|
10
10
|
type,
|
|
@@ -14,19 +14,19 @@ exports.CollectionCount = {
|
|
|
14
14
|
getLabel({ typeObject, unit }) {
|
|
15
15
|
const { expression } = unit;
|
|
16
16
|
const fieldObject = (0, utils_1.getFieldObjectByFieldExpression)({ typeObject, expression });
|
|
17
|
+
const label = (0, get_field_label_1.getFieldLabel)({ typeObject, unit });
|
|
17
18
|
if (fieldObject.name === "comments/comments") {
|
|
18
|
-
return
|
|
19
|
+
return label;
|
|
19
20
|
}
|
|
20
|
-
return `${
|
|
21
|
+
return `${label} Count`;
|
|
21
22
|
},
|
|
22
23
|
getQuerySelect({ unit: { expression } }) {
|
|
23
|
-
const
|
|
24
|
-
return (0, reference_collection_1.
|
|
24
|
+
const countKey = (0, reference_collection_1.getCountKey)(expression.join("/"));
|
|
25
|
+
return { [countKey]: (0, reference_collection_1.makeCollectionCountExpression)(expression) };
|
|
25
26
|
},
|
|
26
27
|
calculateErrors: common_1.calculateUnitExpressionErrors,
|
|
27
28
|
getExportValue: ({ object, unit }) => {
|
|
28
|
-
|
|
29
|
-
return object[(0, reference_collection_1.getCountKey)(field)];
|
|
29
|
+
return object[(0, reference_collection_1.getCountKey)(unit.expression.join("/"))];
|
|
30
30
|
},
|
|
31
31
|
canExport: () => true,
|
|
32
32
|
};
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FileCollectionCount = void 0;
|
|
4
4
|
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
5
|
+
const select_1 = require("@fibery/query-utils/src/select");
|
|
5
6
|
const file_1 = require("../field-utils/file");
|
|
6
7
|
const common_1 = require("../unit-utils/common");
|
|
7
8
|
const can_edit_field_1 = require("../unit-utils/can-edit-field");
|
|
8
9
|
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
9
10
|
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
11
|
+
const wrap_normalized_in_expression_1 = require("../unit-utils/wrap-normalized-in-expression");
|
|
10
12
|
const type = "file-collection-count";
|
|
11
13
|
exports.FileCollectionCount = {
|
|
12
14
|
type,
|
|
@@ -16,14 +18,14 @@ exports.FileCollectionCount = {
|
|
|
16
18
|
calculateErrors: common_1.calculateUnitExpressionErrors,
|
|
17
19
|
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
18
20
|
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
21
|
+
const fieldObjects = (0, utils_1.getFieldObjectsByFieldExpression)({ typeObject, expression });
|
|
22
|
+
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
23
|
+
const collectionNormalized = {
|
|
24
|
+
"q/from": null,
|
|
25
|
+
"q/limit": "q/no-limit",
|
|
26
|
+
"q/select": (0, select_1.normalizeSelect)((0, file_1.getFilesSelect)(terminalFieldObject)),
|
|
26
27
|
};
|
|
28
|
+
return (0, select_1.denormalizeSelect)((0, wrap_normalized_in_expression_1.wrapNormalizedInExpression)(collectionNormalized, fieldObjects, expression));
|
|
27
29
|
},
|
|
28
30
|
getExportValue: get_export_value_1.getExportValue,
|
|
29
31
|
canExport: () => true,
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FileCompactCollection = void 0;
|
|
4
4
|
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
5
|
+
const select_1 = require("@fibery/query-utils/src/select");
|
|
5
6
|
const file_1 = require("../field-utils/file");
|
|
6
7
|
const common_1 = require("../unit-utils/common");
|
|
7
8
|
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
8
9
|
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
9
10
|
const can_edit_field_1 = require("../unit-utils/can-edit-field");
|
|
11
|
+
const wrap_normalized_in_expression_1 = require("../unit-utils/wrap-normalized-in-expression");
|
|
10
12
|
const type = "file-compact-collection";
|
|
11
13
|
exports.FileCompactCollection = {
|
|
12
14
|
type,
|
|
@@ -16,14 +18,14 @@ exports.FileCompactCollection = {
|
|
|
16
18
|
calculateErrors: common_1.calculateUnitExpressionErrors,
|
|
17
19
|
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
18
20
|
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
21
|
+
const fieldObjects = (0, utils_1.getFieldObjectsByFieldExpression)({ typeObject, expression });
|
|
22
|
+
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
23
|
+
const collectionNormalized = {
|
|
24
|
+
"q/from": null,
|
|
25
|
+
"q/limit": "q/no-limit",
|
|
26
|
+
"q/select": (0, select_1.normalizeSelect)((0, file_1.getFilesSelect)(terminalFieldObject)),
|
|
26
27
|
};
|
|
28
|
+
return (0, select_1.denormalizeSelect)((0, wrap_normalized_in_expression_1.wrapNormalizedInExpression)(collectionNormalized, fieldObjects, expression));
|
|
27
29
|
},
|
|
28
30
|
getExportValue: get_export_value_1.getExportValue,
|
|
29
31
|
canExport: () => true,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FileCompactReference = void 0;
|
|
4
|
-
const array_1 = require("@fibery/helpers/utils/array");
|
|
5
4
|
const select_1 = require("@fibery/query-utils/src/select");
|
|
6
5
|
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
7
6
|
const reference_1 = require("../field-utils/reference");
|
|
8
7
|
const common_1 = require("../unit-utils/common");
|
|
9
8
|
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
10
9
|
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
10
|
+
const wrap_normalized_in_expression_1 = require("../unit-utils/wrap-normalized-in-expression");
|
|
11
11
|
const type = "file-compact-reference";
|
|
12
12
|
exports.FileCompactReference = {
|
|
13
13
|
type,
|
|
@@ -21,9 +21,10 @@ exports.FileCompactReference = {
|
|
|
21
21
|
return { type, kind: "field", expression: args.expression };
|
|
22
22
|
},
|
|
23
23
|
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
|
|
24
|
+
const fieldObjects = (0, utils_1.getFieldObjectsByFieldExpression)({ typeObject, expression });
|
|
25
|
+
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
26
|
+
const innerNormalized = (0, reference_1.getReferenceFieldNormalizedSelectClause)(terminalFieldObject, expression);
|
|
27
|
+
return (0, select_1.denormalizeSelect)((0, wrap_normalized_in_expression_1.wrapNormalizedInExpression)(innerNormalized, fieldObjects, expression));
|
|
27
28
|
},
|
|
28
29
|
calculateErrors({ typeObject, unit }) {
|
|
29
30
|
return (0, common_1.calculateUnitExpressionErrors)({ typeObject, unit });
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FileReference = void 0;
|
|
4
4
|
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
5
|
+
const select_1 = require("@fibery/query-utils/src/select");
|
|
5
6
|
const file_1 = require("../field-utils/file");
|
|
6
7
|
const common_1 = require("../unit-utils/common");
|
|
7
8
|
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
8
9
|
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
9
10
|
const can_edit_field_1 = require("../unit-utils/can-edit-field");
|
|
11
|
+
const wrap_normalized_in_expression_1 = require("../unit-utils/wrap-normalized-in-expression");
|
|
10
12
|
const type = "file-reference";
|
|
11
13
|
exports.FileReference = {
|
|
12
14
|
type,
|
|
@@ -16,10 +18,10 @@ exports.FileReference = {
|
|
|
16
18
|
calculateErrors: common_1.calculateUnitExpressionErrors,
|
|
17
19
|
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
18
20
|
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const fieldObjects = (0, utils_1.getFieldObjectsByFieldExpression)({ typeObject, expression });
|
|
22
|
+
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
23
|
+
const innerNormalized = (0, select_1.normalizeSelect)((0, file_1.getFilesSelect)(terminalFieldObject));
|
|
24
|
+
return (0, select_1.denormalizeSelect)((0, wrap_normalized_in_expression_1.wrapNormalizedInExpression)(innerNormalized, fieldObjects, expression));
|
|
23
25
|
},
|
|
24
26
|
getExportValue: get_export_value_1.getExportValue,
|
|
25
27
|
canExport: () => true,
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FilesGallery = void 0;
|
|
4
4
|
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
5
|
+
const select_1 = require("@fibery/query-utils/src/select");
|
|
5
6
|
const file_1 = require("../field-utils/file");
|
|
6
7
|
const common_1 = require("../unit-utils/common");
|
|
7
8
|
const can_edit_field_1 = require("../unit-utils/can-edit-field");
|
|
8
9
|
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
9
10
|
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
11
|
+
const wrap_normalized_in_expression_1 = require("../unit-utils/wrap-normalized-in-expression");
|
|
10
12
|
const type = "files-gallery";
|
|
11
13
|
exports.FilesGallery = {
|
|
12
14
|
type,
|
|
@@ -16,14 +18,14 @@ exports.FilesGallery = {
|
|
|
16
18
|
calculateErrors: common_1.calculateUnitExpressionErrors,
|
|
17
19
|
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
18
20
|
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
21
|
+
const fieldObjects = (0, utils_1.getFieldObjectsByFieldExpression)({ typeObject, expression });
|
|
22
|
+
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
23
|
+
const collectionNormalized = {
|
|
24
|
+
"q/from": null,
|
|
25
|
+
"q/limit": "q/no-limit",
|
|
26
|
+
"q/select": (0, select_1.normalizeSelect)((0, file_1.getFilesSelect)(terminalFieldObject)),
|
|
26
27
|
};
|
|
28
|
+
return (0, select_1.denormalizeSelect)((0, wrap_normalized_in_expression_1.wrapNormalizedInExpression)(collectionNormalized, fieldObjects, expression));
|
|
27
29
|
},
|
|
28
30
|
getExportValue: get_export_value_1.getExportValue,
|
|
29
31
|
canExport: () => true,
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FileLListItem = void 0;
|
|
4
4
|
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
5
|
+
const select_1 = require("@fibery/query-utils/src/select");
|
|
5
6
|
const file_1 = require("../field-utils/file");
|
|
6
7
|
const common_1 = require("../unit-utils/common");
|
|
7
8
|
const can_edit_field_1 = require("../unit-utils/can-edit-field");
|
|
8
9
|
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
9
10
|
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
11
|
+
const wrap_normalized_in_expression_1 = require("../unit-utils/wrap-normalized-in-expression");
|
|
10
12
|
const type = "files-l-list-item";
|
|
11
13
|
exports.FileLListItem = {
|
|
12
14
|
type,
|
|
@@ -16,10 +18,10 @@ exports.FileLListItem = {
|
|
|
16
18
|
calculateErrors: common_1.calculateUnitExpressionErrors,
|
|
17
19
|
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
18
20
|
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const fieldObjects = (0, utils_1.getFieldObjectsByFieldExpression)({ typeObject, expression });
|
|
22
|
+
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
23
|
+
const innerNormalized = (0, select_1.normalizeSelect)((0, file_1.getFilesSelect)(terminalFieldObject));
|
|
24
|
+
return (0, select_1.denormalizeSelect)((0, wrap_normalized_in_expression_1.wrapNormalizedInExpression)(innerNormalized, fieldObjects, expression));
|
|
23
25
|
},
|
|
24
26
|
getExportValue: get_export_value_1.getExportValue,
|
|
25
27
|
canExport: () => true,
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FileLList = void 0;
|
|
4
4
|
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
5
|
+
const select_1 = require("@fibery/query-utils/src/select");
|
|
5
6
|
const file_1 = require("../field-utils/file");
|
|
6
7
|
const common_1 = require("../unit-utils/common");
|
|
7
8
|
const can_edit_field_1 = require("../unit-utils/can-edit-field");
|
|
8
9
|
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
9
10
|
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
11
|
+
const wrap_normalized_in_expression_1 = require("../unit-utils/wrap-normalized-in-expression");
|
|
10
12
|
const type = "files-l-list";
|
|
11
13
|
exports.FileLList = {
|
|
12
14
|
type,
|
|
@@ -16,14 +18,14 @@ exports.FileLList = {
|
|
|
16
18
|
calculateErrors: common_1.calculateUnitExpressionErrors,
|
|
17
19
|
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
18
20
|
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
21
|
+
const fieldObjects = (0, utils_1.getFieldObjectsByFieldExpression)({ typeObject, expression });
|
|
22
|
+
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
23
|
+
const collectionNormalized = {
|
|
24
|
+
"q/from": null,
|
|
25
|
+
"q/limit": "q/no-limit",
|
|
26
|
+
"q/select": (0, select_1.normalizeSelect)((0, file_1.getFilesSelect)(terminalFieldObject)),
|
|
26
27
|
};
|
|
28
|
+
return (0, select_1.denormalizeSelect)((0, wrap_normalized_in_expression_1.wrapNormalizedInExpression)(collectionNormalized, fieldObjects, expression));
|
|
27
29
|
},
|
|
28
30
|
getExportValue: get_export_value_1.getExportValue,
|
|
29
31
|
canExport: () => true,
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FileListItem = void 0;
|
|
4
4
|
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
5
|
+
const select_1 = require("@fibery/query-utils/src/select");
|
|
5
6
|
const file_1 = require("../field-utils/file");
|
|
6
7
|
const common_1 = require("../unit-utils/common");
|
|
7
8
|
const can_edit_field_1 = require("../unit-utils/can-edit-field");
|
|
8
9
|
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
9
10
|
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
11
|
+
const wrap_normalized_in_expression_1 = require("../unit-utils/wrap-normalized-in-expression");
|
|
10
12
|
const type = "files-list-item";
|
|
11
13
|
exports.FileListItem = {
|
|
12
14
|
type,
|
|
@@ -16,10 +18,10 @@ exports.FileListItem = {
|
|
|
16
18
|
calculateErrors: common_1.calculateUnitExpressionErrors,
|
|
17
19
|
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
18
20
|
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const fieldObjects = (0, utils_1.getFieldObjectsByFieldExpression)({ typeObject, expression });
|
|
22
|
+
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
23
|
+
const innerNormalized = (0, select_1.normalizeSelect)((0, file_1.getFilesSelect)(terminalFieldObject));
|
|
24
|
+
return (0, select_1.denormalizeSelect)((0, wrap_normalized_in_expression_1.wrapNormalizedInExpression)(innerNormalized, fieldObjects, expression));
|
|
23
25
|
},
|
|
24
26
|
getExportValue: get_export_value_1.getExportValue,
|
|
25
27
|
canExport: () => true,
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.FileList = void 0;
|
|
4
4
|
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
5
|
+
const select_1 = require("@fibery/query-utils/src/select");
|
|
5
6
|
const file_1 = require("../field-utils/file");
|
|
6
7
|
const common_1 = require("../unit-utils/common");
|
|
7
8
|
const can_edit_field_1 = require("../unit-utils/can-edit-field");
|
|
8
9
|
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
9
10
|
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
11
|
+
const wrap_normalized_in_expression_1 = require("../unit-utils/wrap-normalized-in-expression");
|
|
10
12
|
const type = "files-list";
|
|
11
13
|
exports.FileList = {
|
|
12
14
|
type,
|
|
@@ -16,14 +18,14 @@ exports.FileList = {
|
|
|
16
18
|
calculateErrors: common_1.calculateUnitExpressionErrors,
|
|
17
19
|
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
18
20
|
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
},
|
|
21
|
+
const fieldObjects = (0, utils_1.getFieldObjectsByFieldExpression)({ typeObject, expression });
|
|
22
|
+
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
23
|
+
const collectionNormalized = {
|
|
24
|
+
"q/from": null,
|
|
25
|
+
"q/limit": "q/no-limit",
|
|
26
|
+
"q/select": (0, select_1.normalizeSelect)((0, file_1.getFilesSelect)(terminalFieldObject)),
|
|
26
27
|
};
|
|
28
|
+
return (0, select_1.denormalizeSelect)((0, wrap_normalized_in_expression_1.wrapNormalizedInExpression)(collectionNormalized, fieldObjects, expression));
|
|
27
29
|
},
|
|
28
30
|
getExportValue: get_export_value_1.getExportValue,
|
|
29
31
|
canExport: () => true,
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Number = void 0;
|
|
4
|
-
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
5
4
|
const query_1 = require("@fibery/query-utils/src/query");
|
|
6
5
|
const common_1 = require("../unit-utils/common");
|
|
7
6
|
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
7
|
+
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
8
8
|
const type = "number";
|
|
9
9
|
exports.Number = {
|
|
10
10
|
type,
|
|
11
11
|
name: "Input",
|
|
12
12
|
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
13
13
|
getLabel({ typeObject, unit }) {
|
|
14
|
-
|
|
15
|
-
const fieldObject = (0, utils_1.getFieldObjectByFieldExpression)({ typeObject, expression });
|
|
16
|
-
return fieldObject.title;
|
|
14
|
+
return (0, get_field_label_1.getFieldLabel)({ typeObject, unit });
|
|
17
15
|
},
|
|
18
16
|
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
19
17
|
return (0, query_1.getQuerySelectForExpression)({ typeObject, expression });
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ProgressBar = void 0;
|
|
4
4
|
const query_1 = require("@fibery/query-utils/src/query");
|
|
5
|
-
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
6
5
|
const common_1 = require("../unit-utils/common");
|
|
7
6
|
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
8
7
|
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
@@ -12,9 +11,7 @@ exports.ProgressBar = {
|
|
|
12
11
|
name: "Progress bar",
|
|
13
12
|
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
14
13
|
getLabel({ typeObject, unit }) {
|
|
15
|
-
|
|
16
|
-
const fieldObject = (0, utils_1.getFieldObjectByFieldExpression)({ typeObject, expression });
|
|
17
|
-
return `${fieldObject.title} (progress bar)`;
|
|
14
|
+
return `${(0, get_field_label_1.getFieldLabel)({ typeObject, unit })} (progress bar)`;
|
|
18
15
|
},
|
|
19
16
|
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
20
17
|
return (0, query_1.getQuerySelectForExpression)({
|
|
@@ -6,6 +6,7 @@ const reference_collection_1 = require("../field-utils/reference-collection");
|
|
|
6
6
|
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
7
7
|
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
8
8
|
const can_edit_field_1 = require("../unit-utils/can-edit-field");
|
|
9
|
+
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
9
10
|
const type = "reference-collection";
|
|
10
11
|
exports.ReferenceCollection = {
|
|
11
12
|
type,
|
|
@@ -13,10 +14,10 @@ exports.ReferenceCollection = {
|
|
|
13
14
|
getLabel: get_field_label_1.getFieldLabel,
|
|
14
15
|
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
15
16
|
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
16
|
-
const
|
|
17
|
-
const fieldObject = typeObject.fieldObjectsByName[field];
|
|
17
|
+
const fieldObjects = (0, utils_1.getFieldObjectsByFieldExpression)({ typeObject, expression });
|
|
18
18
|
return (0, reference_collection_1.calculateReferenceCollectionQuery)({
|
|
19
|
-
|
|
19
|
+
fieldObjects,
|
|
20
|
+
expression,
|
|
20
21
|
limit: reference_collection_1.REFERENCE_COLLECTION_LIMIT,
|
|
21
22
|
});
|
|
22
23
|
},
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Reference = void 0;
|
|
4
|
-
const array_1 = require("@fibery/helpers/utils/array");
|
|
5
4
|
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
6
5
|
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
7
6
|
const select_1 = require("@fibery/query-utils/src/select");
|
|
@@ -11,7 +10,7 @@ const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
|
11
10
|
const type = "reference";
|
|
12
11
|
exports.Reference = {
|
|
13
12
|
type,
|
|
14
|
-
name: "
|
|
13
|
+
name: "Name",
|
|
15
14
|
getLabel: get_field_label_1.getFieldLabel,
|
|
16
15
|
makeUnit: (args) => {
|
|
17
16
|
if (!args) {
|
|
@@ -21,9 +20,22 @@ exports.Reference = {
|
|
|
21
20
|
return { type, kind: "field", expression: args.expression };
|
|
22
21
|
},
|
|
23
22
|
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
24
|
-
const
|
|
25
|
-
const
|
|
26
|
-
|
|
23
|
+
const fieldObjects = (0, utils_1.getFieldObjectsByFieldExpression)({ typeObject, expression });
|
|
24
|
+
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
25
|
+
const innerNormalized = (0, reference_1.getReferenceFieldNormalizedSelectClause)(terminalFieldObject, expression);
|
|
26
|
+
// Wrap in the full expression path (innermost to outermost).
|
|
27
|
+
// For intermediate reference fields, also include their entity's id so normalizr can normalize them.
|
|
28
|
+
const nested = [...expression].reverse().reduce((inner, field, reversedIndex) => {
|
|
29
|
+
const originalIndex = expression.length - 1 - reversedIndex;
|
|
30
|
+
const isTerminal = originalIndex === expression.length - 1;
|
|
31
|
+
if (!isTerminal) {
|
|
32
|
+
const { idField } = fieldObjects[originalIndex].typeObject;
|
|
33
|
+
const innerWithId = idField ? { [idField]: idField, ...inner } : inner;
|
|
34
|
+
return { [field]: innerWithId };
|
|
35
|
+
}
|
|
36
|
+
return { [field]: inner };
|
|
37
|
+
}, innerNormalized);
|
|
38
|
+
return (0, select_1.denormalizeSelect)(nested);
|
|
27
39
|
},
|
|
28
40
|
calculateErrors({ typeObject, unit }) {
|
|
29
41
|
const errors = (0, common_1.calculateUnitExpressionErrors)({ typeObject, unit });
|
|
@@ -1,25 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RichTextSnippet = void 0;
|
|
3
|
+
exports.RichTextSnippet = exports.type = void 0;
|
|
4
4
|
const query_1 = require("@fibery/query-utils/src/query");
|
|
5
|
-
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
6
5
|
const common_1 = require("../unit-utils/common");
|
|
7
6
|
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
8
|
-
const
|
|
7
|
+
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
8
|
+
exports.type = "rich-text-snippet";
|
|
9
9
|
exports.RichTextSnippet = {
|
|
10
|
-
type,
|
|
10
|
+
type: exports.type,
|
|
11
11
|
name: "Snippet",
|
|
12
12
|
canEdit() {
|
|
13
13
|
return false;
|
|
14
14
|
},
|
|
15
|
-
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
15
|
+
makeUnit: (0, common_1.makeUnitMethod)(exports.type),
|
|
16
16
|
getLabel({ typeObject, unit }) {
|
|
17
|
-
|
|
18
|
-
const fieldObject = (0, utils_1.getFieldObjectByFieldExpression)({
|
|
19
|
-
typeObject,
|
|
20
|
-
expression,
|
|
21
|
-
});
|
|
22
|
-
return `${fieldObject.title} (Snippet)`;
|
|
17
|
+
return `${(0, get_field_label_1.getFieldLabel)({ typeObject, unit })} (Snippet)`;
|
|
23
18
|
},
|
|
24
19
|
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
25
20
|
return (0, query_1.getQuerySelectForExpression)({
|
|
@@ -145,7 +145,7 @@ function finalise(x, sd, rm) {
|
|
|
145
145
|
j = sd;
|
|
146
146
|
w = xd[(xdi = 0)];
|
|
147
147
|
// Get the rounding digit at index j of w.
|
|
148
|
-
rd = (w / mathpow(10, digits - j - 1)) % 10 | 0;
|
|
148
|
+
rd = ((w / mathpow(10, digits - j - 1)) % 10) | 0;
|
|
149
149
|
}
|
|
150
150
|
else {
|
|
151
151
|
xdi = Math.ceil((i + 1) / LOG_BASE);
|
|
@@ -165,7 +165,7 @@ function finalise(x, sd, rm) {
|
|
|
165
165
|
// The number of leading zeros of w is given by LOG_BASE - digits.
|
|
166
166
|
j = i - LOG_BASE + digits;
|
|
167
167
|
// Get the rounding digit at index j of w.
|
|
168
|
-
rd = j < 0 ? 0 : (w / mathpow(10, digits - j - 1)) % 10 | 0;
|
|
168
|
+
rd = j < 0 ? 0 : ((w / mathpow(10, digits - j - 1)) % 10) | 0;
|
|
169
169
|
}
|
|
170
170
|
}
|
|
171
171
|
// Are there any non-zero digits after the rounding digit?
|
|
@@ -182,7 +182,7 @@ function finalise(x, sd, rm) {
|
|
|
182
182
|
isTruncated ||
|
|
183
183
|
(rm == 6 &&
|
|
184
184
|
// Check whether the digit to the left of the rounding digit is odd.
|
|
185
|
-
(i > 0 ? (j > 0 ? w / mathpow(10, digits - j) : 0) : xd[xdi - 1]) % 10 & 1) ||
|
|
185
|
+
((i > 0 ? (j > 0 ? w / mathpow(10, digits - j) : 0) : xd[xdi - 1]) % 10) & 1) ||
|
|
186
186
|
rm == (x.s < 0 ? 8 : 7)));
|
|
187
187
|
if (sd < 1 || !xd[0]) {
|
|
188
188
|
xd.length = 0;
|
|
@@ -210,7 +210,7 @@ function finalise(x, sd, rm) {
|
|
|
210
210
|
k = mathpow(10, LOG_BASE - i);
|
|
211
211
|
// E.g. 56700 becomes 56000 if 7 is the rounding digit.
|
|
212
212
|
// j > 0 means i > number of leading zeros of w.
|
|
213
|
-
xd[xdi] = j > 0 ? ((w / mathpow(10, digits - j)) % mathpow(10, j) | 0) * k : 0;
|
|
213
|
+
xd[xdi] = j > 0 ? (((w / mathpow(10, digits - j)) % mathpow(10, j)) | 0) * k : 0;
|
|
214
214
|
}
|
|
215
215
|
if (roundUp) {
|
|
216
216
|
for (;;) {
|
|
@@ -277,10 +277,14 @@ function parseDecimal(x, str) {
|
|
|
277
277
|
}
|
|
278
278
|
let i;
|
|
279
279
|
// Determine leading zeros.
|
|
280
|
-
for (i = 0; str.charCodeAt(i) === 48; i++) {
|
|
280
|
+
for (i = 0; str.charCodeAt(i) === 48; i++) {
|
|
281
|
+
/* empty */
|
|
282
|
+
}
|
|
281
283
|
let len;
|
|
282
284
|
// Determine trailing zeros.
|
|
283
|
-
for (len = str.length; str.charCodeAt(len - 1) === 48; --len) {
|
|
285
|
+
for (len = str.length; str.charCodeAt(len - 1) === 48; --len) {
|
|
286
|
+
/* empty */
|
|
287
|
+
}
|
|
284
288
|
str = str.slice(i, len);
|
|
285
289
|
if (str) {
|
|
286
290
|
len -= i;
|
|
@@ -10,7 +10,7 @@ export declare const getReferenceCollectionExportValue: ({ unit, typeObject, obj
|
|
|
10
10
|
object: FiberyObject;
|
|
11
11
|
unit: FieldUnit;
|
|
12
12
|
typeObject: TypeObject;
|
|
13
|
-
}) =>
|
|
13
|
+
}) => (string | undefined)[] | FiberyObject[] | null;
|
|
14
14
|
export declare const getReferenceExportValue: ({ unit, typeObject, object, }: {
|
|
15
15
|
object: FiberyObject;
|
|
16
16
|
unit: FieldUnit;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getNumberExportValue = exports.getTitleExportValue = exports.getLocationExportValue = exports.getDateRangeExportValue = exports.formatDateRangeExportValue = exports.getSnippetExportValue = exports.getReferenceExportValue = exports.getReferenceCollectionExportValue = exports.getExportValue = void 0;
|
|
4
4
|
const query_1 = require("@fibery/query-utils/src/query");
|
|
5
|
+
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
5
6
|
const date_fns_1 = require("date-fns");
|
|
6
7
|
const number_1 = require("../field-utils/number");
|
|
7
8
|
const formatters_1 = require("./formatters");
|
|
@@ -51,7 +52,7 @@ const formatDateRangeExportValue = (value, fieldObject) => {
|
|
|
51
52
|
exports.formatDateRangeExportValue = formatDateRangeExportValue;
|
|
52
53
|
const getDateRangeExportValue = ({ object, unit, typeObject, }) => {
|
|
53
54
|
const value = (0, exports.getExportValue)({ object, unit });
|
|
54
|
-
const fieldObject = (0,
|
|
55
|
+
const fieldObject = (0, utils_1.getFieldObjectByFieldExpression)({ expression: unit.expression, typeObject });
|
|
55
56
|
return (0, exports.formatDateRangeExportValue)(value, fieldObject);
|
|
56
57
|
};
|
|
57
58
|
exports.getDateRangeExportValue = getDateRangeExportValue;
|