@fibery/views 17.0.4 → 18.0.2
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/index.js +17 -0
- package/lib/jest.config.d.ts +2 -0
- package/lib/jest.config.js +33 -0
- package/lib/src/field-utils/avatar.d.ts +20 -0
- package/lib/src/field-utils/avatar.js +42 -0
- package/lib/src/field-utils/back-references.d.ts +15 -0
- package/lib/src/field-utils/back-references.js +21 -0
- package/lib/src/field-utils/comments.d.ts +60 -0
- package/lib/src/field-utils/comments.js +46 -0
- package/lib/src/field-utils/date-time.d.ts +14 -0
- package/lib/src/field-utils/date-time.js +56 -0
- package/lib/src/field-utils/enum-value.d.ts +13 -0
- package/lib/src/field-utils/enum-value.js +29 -0
- package/lib/src/field-utils/file.d.ts +4 -0
- package/lib/src/field-utils/file.js +18 -0
- package/lib/src/field-utils/icon.d.ts +10 -0
- package/lib/src/field-utils/icon.js +26 -0
- package/lib/src/field-utils/number.d.ts +31 -0
- package/lib/src/field-utils/number.js +91 -0
- package/lib/src/field-utils/reference-collection.d.ts +18 -0
- package/lib/src/field-utils/reference-collection.js +45 -0
- package/lib/src/field-utils/reference.d.ts +7 -0
- package/lib/src/field-utils/reference.js +57 -0
- package/lib/src/field-utils/relation-view.d.ts +2 -0
- package/lib/src/field-utils/relation-view.js +12 -0
- package/lib/src/field-utils/rich-text.d.ts +12 -0
- package/lib/src/field-utils/rich-text.js +27 -0
- package/lib/src/field-utils/text.d.ts +35 -0
- package/lib/src/field-utils/text.js +40 -0
- package/lib/src/field-utils/user-active.d.ts +8 -0
- package/lib/src/field-utils/user-active.js +28 -0
- package/lib/src/field-utils/user-role.d.ts +6 -0
- package/lib/src/field-utils/user-role.js +25 -0
- package/lib/src/field-utils/workflow.d.ts +15 -0
- package/lib/src/field-utils/workflow.js +56 -0
- package/lib/src/index.d.ts +16 -0
- package/lib/src/index.js +258 -0
- package/lib/src/private/board.d.ts +11 -0
- package/lib/src/private/board.js +326 -0
- package/lib/src/private/calendar.d.ts +10 -0
- package/lib/src/private/calendar.js +122 -0
- package/lib/src/private/feed.d.ts +10 -0
- package/lib/src/private/feed.js +119 -0
- package/lib/src/private/form.d.ts +3 -0
- package/lib/src/private/form.js +61 -0
- package/lib/src/private/map.d.ts +10 -0
- package/lib/src/private/map.js +119 -0
- package/lib/src/private/smart-folder.d.ts +23 -0
- package/lib/src/private/smart-folder.js +274 -0
- package/lib/src/private/test-data/garbage-test.d.ts +649 -0
- package/lib/src/private/test-data/garbage-test.js +520 -0
- package/lib/src/private/test-data/kanban.d.ts +1123 -0
- package/lib/src/private/test-data/kanban.js +1203 -0
- package/lib/src/private/test-data/tasks.d.ts +3216 -0
- package/lib/src/private/test-data/tasks.js +2731 -0
- package/lib/src/private/timeline.d.ts +10 -0
- package/lib/src/private/timeline.js +323 -0
- package/lib/src/private/units.d.ts +6 -0
- package/lib/src/private/units.js +144 -0
- package/lib/src/private/utils.d.ts +17 -0
- package/lib/src/private/utils.js +267 -0
- package/lib/src/tsfixme.d.ts +1 -0
- package/lib/src/tsfixme.js +2 -0
- package/lib/src/unit-definitions/avatar-collection.d.ts +2 -0
- package/lib/src/unit-definitions/avatar-collection.js +53 -0
- package/lib/src/unit-definitions/avatar-input.d.ts +2 -0
- package/lib/src/unit-definitions/avatar-input.js +12 -0
- package/lib/src/unit-definitions/avatar.d.ts +2 -0
- package/lib/src/unit-definitions/avatar.js +80 -0
- package/lib/src/unit-definitions/back-references-list.d.ts +2 -0
- package/lib/src/unit-definitions/back-references-list.js +38 -0
- package/lib/src/unit-definitions/bool-checkbox.d.ts +2 -0
- package/lib/src/unit-definitions/bool-checkbox.js +25 -0
- package/lib/src/unit-definitions/bool.d.ts +2 -0
- package/lib/src/unit-definitions/bool.js +22 -0
- package/lib/src/unit-definitions/collection-count.d.ts +2 -0
- package/lib/src/unit-definitions/collection-count.js +32 -0
- package/lib/src/unit-definitions/color-input.d.ts +2 -0
- package/lib/src/unit-definitions/color-input.js +21 -0
- package/lib/src/unit-definitions/comments-list.d.ts +2 -0
- package/lib/src/unit-definitions/comments-list.js +25 -0
- package/lib/src/unit-definitions/date-range-combobox.d.ts +2 -0
- package/lib/src/unit-definitions/date-range-combobox.js +22 -0
- package/lib/src/unit-definitions/date-range.d.ts +2 -0
- package/lib/src/unit-definitions/date-range.js +22 -0
- package/lib/src/unit-definitions/date-time-combobox.d.ts +2 -0
- package/lib/src/unit-definitions/date-time-combobox.js +22 -0
- package/lib/src/unit-definitions/date.d.ts +2 -0
- package/lib/src/unit-definitions/date.js +22 -0
- package/lib/src/unit-definitions/email-input.d.ts +2 -0
- package/lib/src/unit-definitions/email-input.js +12 -0
- package/lib/src/unit-definitions/email.d.ts +2 -0
- package/lib/src/unit-definitions/email.js +17 -0
- package/lib/src/unit-definitions/emoji.d.ts +2 -0
- package/lib/src/unit-definitions/emoji.js +17 -0
- package/lib/src/unit-definitions/file-collection-count.d.ts +2 -0
- package/lib/src/unit-definitions/file-collection-count.js +30 -0
- package/lib/src/unit-definitions/file-compact-collection.d.ts +2 -0
- package/lib/src/unit-definitions/file-compact-collection.js +30 -0
- package/lib/src/unit-definitions/file-compact-reference.d.ts +2 -0
- package/lib/src/unit-definitions/file-compact-reference.js +36 -0
- package/lib/src/unit-definitions/file-reference.d.ts +2 -0
- package/lib/src/unit-definitions/file-reference.js +26 -0
- package/lib/src/unit-definitions/files-gallery.d.ts +2 -0
- package/lib/src/unit-definitions/files-gallery.js +30 -0
- package/lib/src/unit-definitions/files-l-list-item.d.ts +2 -0
- package/lib/src/unit-definitions/files-l-list-item.js +26 -0
- package/lib/src/unit-definitions/files-l-list.d.ts +2 -0
- package/lib/src/unit-definitions/files-l-list.js +30 -0
- package/lib/src/unit-definitions/files-list-item.d.ts +2 -0
- package/lib/src/unit-definitions/files-list-item.js +26 -0
- package/lib/src/unit-definitions/files-list.d.ts +2 -0
- package/lib/src/unit-definitions/files-list.js +30 -0
- package/lib/src/unit-definitions/geometry-preview.d.ts +2 -0
- package/lib/src/unit-definitions/geometry-preview.js +17 -0
- package/lib/src/unit-definitions/icon-button.d.ts +2 -0
- package/lib/src/unit-definitions/icon-button.js +29 -0
- package/lib/src/unit-definitions/icon-input.d.ts +2 -0
- package/lib/src/unit-definitions/icon-input.js +12 -0
- package/lib/src/unit-definitions/id.d.ts +2 -0
- package/lib/src/unit-definitions/id.js +29 -0
- package/lib/src/unit-definitions/index.d.ts +27 -0
- package/lib/src/unit-definitions/index.js +57 -0
- package/lib/src/unit-definitions/json-input.d.ts +2 -0
- package/lib/src/unit-definitions/json-input.js +21 -0
- package/lib/src/unit-definitions/location-input.d.ts +2 -0
- package/lib/src/unit-definitions/location-input.js +18 -0
- package/lib/src/unit-definitions/location.d.ts +2 -0
- package/lib/src/unit-definitions/location.js +17 -0
- package/lib/src/unit-definitions/not-found.d.ts +2 -0
- package/lib/src/unit-definitions/not-found.js +24 -0
- package/lib/src/unit-definitions/number-input.d.ts +2 -0
- package/lib/src/unit-definitions/number-input.js +22 -0
- package/lib/src/unit-definitions/number.d.ts +2 -0
- package/lib/src/unit-definitions/number.js +27 -0
- package/lib/src/unit-definitions/phone-input.d.ts +2 -0
- package/lib/src/unit-definitions/phone-input.js +12 -0
- package/lib/src/unit-definitions/phone.d.ts +2 -0
- package/lib/src/unit-definitions/phone.js +12 -0
- package/lib/src/unit-definitions/progress-bar.d.ts +2 -0
- package/lib/src/unit-definitions/progress-bar.js +32 -0
- package/lib/src/unit-definitions/reference-collection-combobox.d.ts +2 -0
- package/lib/src/unit-definitions/reference-collection-combobox.js +21 -0
- package/lib/src/unit-definitions/reference-collection-list.d.ts +2 -0
- package/lib/src/unit-definitions/reference-collection-list.js +22 -0
- package/lib/src/unit-definitions/reference-collection-view.d.ts +2 -0
- package/lib/src/unit-definitions/reference-collection-view.js +19 -0
- package/lib/src/unit-definitions/reference-collection.d.ts +2 -0
- package/lib/src/unit-definitions/reference-collection.js +27 -0
- package/lib/src/unit-definitions/reference-combobox.d.ts +2 -0
- package/lib/src/unit-definitions/reference-combobox.js +21 -0
- package/lib/src/unit-definitions/reference-icon.d.ts +2 -0
- package/lib/src/unit-definitions/reference-icon.js +12 -0
- package/lib/src/unit-definitions/reference.d.ts +2 -0
- package/lib/src/unit-definitions/reference.js +49 -0
- package/lib/src/unit-definitions/rich-text-document.d.ts +2 -0
- package/lib/src/unit-definitions/rich-text-document.js +22 -0
- package/lib/src/unit-definitions/rich-text-snippet.d.ts +2 -0
- package/lib/src/unit-definitions/rich-text-snippet.js +39 -0
- package/lib/src/unit-definitions/single-location-preview.d.ts +2 -0
- package/lib/src/unit-definitions/single-location-preview.js +17 -0
- package/lib/src/unit-definitions/text-input.d.ts +2 -0
- package/lib/src/unit-definitions/text-input.js +22 -0
- package/lib/src/unit-definitions/text.d.ts +2 -0
- package/lib/src/unit-definitions/text.js +22 -0
- package/lib/src/unit-definitions/title-input.d.ts +2 -0
- package/lib/src/unit-definitions/title-input.js +16 -0
- package/lib/src/unit-definitions/title.d.ts +2 -0
- package/lib/src/unit-definitions/title.js +34 -0
- package/lib/src/unit-definitions/type-badge-abbr.d.ts +2 -0
- package/lib/src/unit-definitions/type-badge-abbr.js +25 -0
- package/lib/src/unit-definitions/type-badge.d.ts +2 -0
- package/lib/src/unit-definitions/type-badge.js +25 -0
- package/lib/src/unit-definitions/type-icon.d.ts +2 -0
- package/lib/src/unit-definitions/type-icon.js +25 -0
- package/lib/src/unit-definitions/url-input.d.ts +2 -0
- package/lib/src/unit-definitions/url-input.js +12 -0
- package/lib/src/unit-definitions/url.d.ts +2 -0
- package/lib/src/unit-definitions/url.js +17 -0
- package/lib/src/unit-definitions/user-button.d.ts +2 -0
- package/lib/src/unit-definitions/user-button.js +23 -0
- package/lib/src/unit-definitions/user-role-input.d.ts +2 -0
- package/lib/src/unit-definitions/user-role-input.js +12 -0
- package/lib/src/unit-definitions/user-role.d.ts +2 -0
- package/lib/src/unit-definitions/user-role.js +29 -0
- package/lib/src/unit-utils/access.d.ts +9 -0
- package/lib/src/unit-utils/access.js +14 -0
- package/lib/src/unit-utils/can-edit-field.d.ts +6 -0
- package/lib/src/unit-utils/can-edit-field.js +8 -0
- package/lib/src/unit-utils/common.d.ts +14 -0
- package/lib/src/unit-utils/common.js +43 -0
- package/lib/src/unit-utils/decimal.d.ts +42 -0
- package/lib/src/unit-utils/decimal.js +414 -0
- package/lib/src/unit-utils/dynamic-keys.d.ts +7 -0
- package/lib/src/unit-utils/dynamic-keys.js +13 -0
- package/lib/src/unit-utils/enums.d.ts +27 -0
- package/lib/src/unit-utils/enums.js +69 -0
- package/lib/src/unit-utils/formatters.d.ts +50 -0
- package/lib/src/unit-utils/formatters.js +163 -0
- package/lib/src/unit-utils/get-export-value.d.ts +45 -0
- package/lib/src/unit-utils/get-export-value.js +83 -0
- package/lib/src/unit-utils/get-field-label.d.ts +6 -0
- package/lib/src/unit-utils/get-field-label.js +10 -0
- package/lib/src/unit-utils/get-unmatched-unit-label.d.ts +2 -0
- package/lib/src/unit-utils/get-unmatched-unit-label.js +9 -0
- package/lib/src/unit-utils/schema.d.ts +4 -0
- package/lib/src/unit-utils/schema.js +12 -0
- package/lib/src/units/board.d.ts +43 -0
- package/lib/src/units/board.js +51 -0
- package/lib/src/units/canvas/all-units-data-definitions.d.ts +18 -0
- package/lib/src/units/canvas/all-units-data-definitions.js +40 -0
- package/lib/src/units/canvas/index.d.ts +42 -0
- package/lib/src/units/canvas/index.js +48 -0
- package/lib/src/units/canvas/type-badge-abbr.d.ts +36 -0
- package/lib/src/units/canvas/type-badge-abbr.js +11 -0
- package/lib/src/units/canvas/type-badge.d.ts +36 -0
- package/lib/src/units/canvas/type-badge.js +11 -0
- package/lib/src/units/default.d.ts +43 -0
- package/lib/src/units/default.js +51 -0
- package/lib/src/units/gallery.d.ts +3 -0
- package/lib/src/units/gallery.js +18 -0
- package/lib/src/units/gantt.d.ts +44 -0
- package/lib/src/units/gantt.js +59 -0
- package/lib/src/units/get-unit-definitions-for-view-type.d.ts +2 -0
- package/lib/src/units/get-unit-definitions-for-view-type.js +64 -0
- package/lib/src/units/grid.d.ts +42 -0
- package/lib/src/units/grid.js +67 -0
- package/lib/src/units/list.d.ts +43 -0
- package/lib/src/units/list.js +49 -0
- package/lib/src/units/make-factory.d.ts +50 -0
- package/lib/src/units/make-factory.js +245 -0
- package/lib/src/units/types.d.ts +73 -0
- package/lib/src/units/types.js +2 -0
- package/package.json +42 -52
- package/lib/views.js +0 -1813
- /package/{index.js → lib/index.d.ts} +0 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.replaceNamesWithIdsInUnitGroupKey = exports.replaceIdsWithNamesInUnitGroupKey = exports.getFieldObjectsById = exports.isUnitExpressionValid = exports.resetContextExpressionIfBroken = exports.deleteExpressionWithNotFoundFieldsOrTypesInExpression = exports.replaceNamesWithIdsInQueryExpression = exports.replaceNamesWithIdsInFilter = exports.replaceIdsWithNamesInFilter = exports.replaceIdsWithNamesInQueryExpression = exports.visitContextExpression = exports.visitViewUnit = exports.replaceIdsWithNamesInExpression = exports.replaceNamesWithIdsInExpression = exports.deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression = exports.deleteExpressionWithNotFoundFieldsOrTypesInFilter = exports.REMOVE = void 0;
|
|
7
|
+
const visitors_1 = require("@fibery/expression-utils/src/visitors");
|
|
8
|
+
const pickBy_1 = __importDefault(require("lodash/pickBy"));
|
|
9
|
+
// Return this symbol from a visitor callback to remove the node from the
|
|
10
|
+
// output. Not supported in all places, add support as needed.
|
|
11
|
+
exports.REMOVE = Symbol("remove");
|
|
12
|
+
function visitDeleteExpressionInFilterGroup(filter, visitExpression) {
|
|
13
|
+
if (filter.kind !== "group") {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const value = filter.value
|
|
17
|
+
.map((nestedFilter) => {
|
|
18
|
+
if (nestedFilter.kind === "group") {
|
|
19
|
+
return visitFilterGroup(nestedFilter, visitExpression);
|
|
20
|
+
}
|
|
21
|
+
const expression = nestedFilter.value.expression ? visitExpression(nestedFilter.value.expression) : null;
|
|
22
|
+
if (!expression) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
...nestedFilter,
|
|
27
|
+
value: {
|
|
28
|
+
...nestedFilter.value,
|
|
29
|
+
expression: expression,
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
})
|
|
33
|
+
.filter(Boolean);
|
|
34
|
+
if (value.length === 0) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
...filter,
|
|
39
|
+
value: value,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInFilter = (schema, fromType, filter) => {
|
|
43
|
+
return visitDeleteExpressionInFilterGroup(filter, (expression) => (0, exports.deleteExpressionWithNotFoundFieldsOrTypesInExpression)(schema, fromType, expression));
|
|
44
|
+
};
|
|
45
|
+
exports.deleteExpressionWithNotFoundFieldsOrTypesInFilter = deleteExpressionWithNotFoundFieldsOrTypesInFilter;
|
|
46
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression = (schema, queryExpression) => {
|
|
47
|
+
const { "q/from": fromExpression, "q/where": whereExpression, "q/order-by": orderByExpression } = queryExpression;
|
|
48
|
+
if (Object.hasOwn(schema.typeObjectsByName, fromExpression)) {
|
|
49
|
+
const typeObject = schema.typeObjectsByName[fromExpression];
|
|
50
|
+
return (0, pickBy_1.default)({
|
|
51
|
+
...queryExpression,
|
|
52
|
+
...(whereExpression
|
|
53
|
+
? {
|
|
54
|
+
"q/where": (0, visitors_1.deleteExpressionsWithNotFoundFieldsVisitor)(typeObject).visitExpression(whereExpression),
|
|
55
|
+
}
|
|
56
|
+
: null),
|
|
57
|
+
...(orderByExpression
|
|
58
|
+
? {
|
|
59
|
+
"q/order-by": (0, visitors_1.deleteExpressionsWithNotFoundFieldsVisitor)(typeObject).visitOrderByExpression(orderByExpression),
|
|
60
|
+
}
|
|
61
|
+
: null),
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
};
|
|
66
|
+
exports.deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression = deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression;
|
|
67
|
+
const replaceNamesWithIdsInExpression = (schema, fromType, expression) => {
|
|
68
|
+
if (Object.hasOwn(schema.typeObjectsByName, fromType)) {
|
|
69
|
+
const typeObject = schema.typeObjectsByName[fromType];
|
|
70
|
+
return (0, visitors_1.replaceNamesWithIdsVisitor)(typeObject).visitExpression(expression);
|
|
71
|
+
}
|
|
72
|
+
return expression;
|
|
73
|
+
};
|
|
74
|
+
exports.replaceNamesWithIdsInExpression = replaceNamesWithIdsInExpression;
|
|
75
|
+
const replaceIdsWithNamesInExpression = (schema, fromTypeId, expression) => {
|
|
76
|
+
if (Object.hasOwn(schema.typeObjectsById, fromTypeId)) {
|
|
77
|
+
const typeObject = schema.typeObjectsById[fromTypeId];
|
|
78
|
+
return (0, visitors_1.replaceIdsWithNamesVisitor)(typeObject).visitExpression(expression);
|
|
79
|
+
}
|
|
80
|
+
return expression;
|
|
81
|
+
};
|
|
82
|
+
exports.replaceIdsWithNamesInExpression = replaceIdsWithNamesInExpression;
|
|
83
|
+
const visitViewUnit = (fromType, unit, visitor) => {
|
|
84
|
+
const { expression } = unit;
|
|
85
|
+
if (expression) {
|
|
86
|
+
return {
|
|
87
|
+
...unit,
|
|
88
|
+
...{
|
|
89
|
+
expression: visitor.visitExpression(fromType, expression),
|
|
90
|
+
},
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
return unit;
|
|
94
|
+
};
|
|
95
|
+
exports.visitViewUnit = visitViewUnit;
|
|
96
|
+
const visitContextExpression = (fromType, contextExpression, visitor) => {
|
|
97
|
+
const visitContextExpression = visitor.visitContextExpression
|
|
98
|
+
? visitor.visitContextExpression
|
|
99
|
+
: visitor.visitExpression;
|
|
100
|
+
return contextExpression ? visitContextExpression(fromType, contextExpression) : contextExpression;
|
|
101
|
+
};
|
|
102
|
+
exports.visitContextExpression = visitContextExpression;
|
|
103
|
+
const replaceIdsWithNamesInQueryExpression = (schema, queryExpression) => {
|
|
104
|
+
const { "q/from": fromExpression, "q/where": whereExpression, "q/order-by": orderByExpression } = queryExpression;
|
|
105
|
+
if (Object.hasOwn(schema.typeObjectsById, fromExpression)) {
|
|
106
|
+
const typeObject = schema.typeObjectsById[fromExpression];
|
|
107
|
+
return {
|
|
108
|
+
...queryExpression,
|
|
109
|
+
...{ "q/from": typeObject.name },
|
|
110
|
+
...(whereExpression
|
|
111
|
+
? {
|
|
112
|
+
"q/where": (0, visitors_1.replaceIdsWithNamesVisitor)(typeObject).visitExpression(whereExpression),
|
|
113
|
+
}
|
|
114
|
+
: null),
|
|
115
|
+
...(orderByExpression
|
|
116
|
+
? {
|
|
117
|
+
"q/order-by": (0, visitors_1.replaceIdsWithNamesVisitor)(typeObject).visitOrderByExpression(orderByExpression),
|
|
118
|
+
}
|
|
119
|
+
: null),
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
return queryExpression;
|
|
123
|
+
};
|
|
124
|
+
exports.replaceIdsWithNamesInQueryExpression = replaceIdsWithNamesInQueryExpression;
|
|
125
|
+
function visitFilterGroup(filter, visitExpression, type) {
|
|
126
|
+
if (filter.kind !== "group") {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
...filter,
|
|
131
|
+
value: filter.value.map((nestedFilter) => {
|
|
132
|
+
if (nestedFilter.kind === "group") {
|
|
133
|
+
return visitFilterGroup(nestedFilter, visitExpression);
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
...nestedFilter,
|
|
137
|
+
value: {
|
|
138
|
+
...nestedFilter.value,
|
|
139
|
+
expression: nestedFilter.value.expression ? visitExpression(nestedFilter.value.expression) : null,
|
|
140
|
+
},
|
|
141
|
+
};
|
|
142
|
+
}),
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
const replaceIdsWithNamesInFilter = (schema, fromType, filter) => {
|
|
146
|
+
if (Object.hasOwn(schema.typeObjectsById, fromType)) {
|
|
147
|
+
const typeObject = schema.typeObjectsById[fromType];
|
|
148
|
+
return filter
|
|
149
|
+
? visitFilterGroup(filter, (expression) => (0, visitors_1.replaceIdsWithNamesVisitor)(typeObject).visitExpression(expression), "ids")
|
|
150
|
+
: null;
|
|
151
|
+
}
|
|
152
|
+
return filter;
|
|
153
|
+
};
|
|
154
|
+
exports.replaceIdsWithNamesInFilter = replaceIdsWithNamesInFilter;
|
|
155
|
+
const replaceNamesWithIdsInFilter = (schema, fromType, filter) => {
|
|
156
|
+
if (Object.hasOwn(schema.typeObjectsByName, fromType)) {
|
|
157
|
+
const typeObject = schema.typeObjectsByName[fromType];
|
|
158
|
+
return filter
|
|
159
|
+
? visitFilterGroup(filter, (expression) => (0, visitors_1.replaceNamesWithIdsVisitor)(typeObject).visitExpression(expression), "names")
|
|
160
|
+
: null;
|
|
161
|
+
}
|
|
162
|
+
return filter;
|
|
163
|
+
};
|
|
164
|
+
exports.replaceNamesWithIdsInFilter = replaceNamesWithIdsInFilter;
|
|
165
|
+
const replaceNamesWithIdsInQueryExpression = (schema, queryExpression) => {
|
|
166
|
+
const { "q/from": fromExpression, "q/where": whereExpression, "q/order-by": orderByExpression } = queryExpression;
|
|
167
|
+
if (Object.hasOwn(schema.typeObjectsByName, fromExpression)) {
|
|
168
|
+
const typeObject = schema.typeObjectsByName[fromExpression];
|
|
169
|
+
return {
|
|
170
|
+
...queryExpression,
|
|
171
|
+
...{ "q/from": typeObject.id },
|
|
172
|
+
...(whereExpression
|
|
173
|
+
? {
|
|
174
|
+
"q/where": (0, visitors_1.replaceNamesWithIdsVisitor)(typeObject).visitExpression(whereExpression),
|
|
175
|
+
}
|
|
176
|
+
: null),
|
|
177
|
+
...(orderByExpression
|
|
178
|
+
? {
|
|
179
|
+
"q/order-by": (0, visitors_1.replaceNamesWithIdsVisitor)(typeObject).visitOrderByExpression(orderByExpression),
|
|
180
|
+
}
|
|
181
|
+
: null),
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
return queryExpression;
|
|
185
|
+
};
|
|
186
|
+
exports.replaceNamesWithIdsInQueryExpression = replaceNamesWithIdsInQueryExpression;
|
|
187
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInExpression = (schema, fromType, expression) => {
|
|
188
|
+
if (Object.hasOwn(schema.typeObjectsByName, fromType)) {
|
|
189
|
+
const typeObject = schema.typeObjectsByName[fromType];
|
|
190
|
+
return (0, visitors_1.deleteExpressionsWithNotFoundFieldsVisitor)(typeObject).visitExpression(expression);
|
|
191
|
+
}
|
|
192
|
+
return null;
|
|
193
|
+
};
|
|
194
|
+
exports.deleteExpressionWithNotFoundFieldsOrTypesInExpression = deleteExpressionWithNotFoundFieldsOrTypesInExpression;
|
|
195
|
+
const resetContextExpressionIfBroken = (schema, fromType, expression, defaultExpression) => (0, exports.deleteExpressionWithNotFoundFieldsOrTypesInExpression)(schema, fromType, expression) || defaultExpression;
|
|
196
|
+
exports.resetContextExpressionIfBroken = resetContextExpressionIfBroken;
|
|
197
|
+
const isUnitExpressionValid = (unit) => {
|
|
198
|
+
if (Object.hasOwn(unit, "expression")) {
|
|
199
|
+
const { expression } = unit;
|
|
200
|
+
return expression !== null;
|
|
201
|
+
}
|
|
202
|
+
return true;
|
|
203
|
+
};
|
|
204
|
+
exports.isUnitExpressionValid = isUnitExpressionValid;
|
|
205
|
+
const getFieldObjectsById = (smartFolder, schema) => {
|
|
206
|
+
const types = smartFolder["fibery/meta"].items.map((item) => item.query["q/from"]);
|
|
207
|
+
return types.reduce((acc, type) => {
|
|
208
|
+
if (!Object.hasOwn(schema.typeObjectsById, type)) {
|
|
209
|
+
return acc;
|
|
210
|
+
}
|
|
211
|
+
const fieldObjects = schema.typeObjectsById[type].fieldObjectsById;
|
|
212
|
+
return { ...acc, ...fieldObjects };
|
|
213
|
+
}, {});
|
|
214
|
+
};
|
|
215
|
+
exports.getFieldObjectsById = getFieldObjectsById;
|
|
216
|
+
const replaceIdsWithNamesInUnitGroupKey = (unitGroupKey, fieldObjectsById) => {
|
|
217
|
+
const keyParts = unitGroupKey.split("|");
|
|
218
|
+
return keyParts
|
|
219
|
+
.map((keyPart) => {
|
|
220
|
+
const [unitType, ...rest] = keyPart.split("_");
|
|
221
|
+
if (unitType === "user-button") {
|
|
222
|
+
return keyPart;
|
|
223
|
+
}
|
|
224
|
+
const fieldId = rest.join("_");
|
|
225
|
+
if (!fieldId) {
|
|
226
|
+
return keyPart;
|
|
227
|
+
}
|
|
228
|
+
const fieldObject = fieldObjectsById[fieldId];
|
|
229
|
+
if (!fieldObject) {
|
|
230
|
+
return keyPart;
|
|
231
|
+
}
|
|
232
|
+
return `${unitType}_${fieldObject.holderType}:${fieldObject.name}`;
|
|
233
|
+
})
|
|
234
|
+
.filter(Boolean)
|
|
235
|
+
.join("|");
|
|
236
|
+
};
|
|
237
|
+
exports.replaceIdsWithNamesInUnitGroupKey = replaceIdsWithNamesInUnitGroupKey;
|
|
238
|
+
const replaceNamesWithIdsInUnitGroupKey = (unitGroupKey, schema) => {
|
|
239
|
+
const keyParts = unitGroupKey.split("|");
|
|
240
|
+
return keyParts
|
|
241
|
+
.map((keyPart) => {
|
|
242
|
+
const [unitType, ...rest] = keyPart.split("_");
|
|
243
|
+
if (unitType === "user-button") {
|
|
244
|
+
return keyPart;
|
|
245
|
+
}
|
|
246
|
+
const name = rest.join("_");
|
|
247
|
+
if (!name) {
|
|
248
|
+
return keyPart;
|
|
249
|
+
}
|
|
250
|
+
const [type, field] = name.split(":");
|
|
251
|
+
if (!field) {
|
|
252
|
+
return keyPart;
|
|
253
|
+
}
|
|
254
|
+
if (!Object.hasOwn(schema.typeObjectsByName, type)) {
|
|
255
|
+
return keyPart;
|
|
256
|
+
}
|
|
257
|
+
const typeObject = schema.typeObjectsByName[type];
|
|
258
|
+
if (!Object.hasOwn(typeObject.fieldObjectsByName, field)) {
|
|
259
|
+
return keyPart;
|
|
260
|
+
}
|
|
261
|
+
const fieldObject = typeObject.fieldObjectsByName[field];
|
|
262
|
+
return `${unitType}_${fieldObject.id}`;
|
|
263
|
+
})
|
|
264
|
+
.filter(Boolean)
|
|
265
|
+
.join("|");
|
|
266
|
+
};
|
|
267
|
+
exports.replaceNamesWithIdsInUnitGroupKey = replaceNamesWithIdsInUnitGroupKey;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type $TSFixMe = any;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AvatarCollection = void 0;
|
|
7
|
+
const compact_1 = __importDefault(require("lodash/compact"));
|
|
8
|
+
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
9
|
+
const select_1 = require("@fibery/query-utils/src/select");
|
|
10
|
+
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
11
|
+
const avatar_1 = require("../field-utils/avatar");
|
|
12
|
+
const common_1 = require("../unit-utils/common");
|
|
13
|
+
const type = "avatar-collection";
|
|
14
|
+
exports.AvatarCollection = {
|
|
15
|
+
type,
|
|
16
|
+
name: "Avatar",
|
|
17
|
+
canEdit({ typeObject, unit: { expression } }) {
|
|
18
|
+
return (0, common_1.canEditFieldExpression)(typeObject, expression);
|
|
19
|
+
},
|
|
20
|
+
getLabel({ typeObject, unit }) {
|
|
21
|
+
const { expression } = unit;
|
|
22
|
+
const fieldObject = (0, utils_1.getFieldObjectByFieldExpression)({ typeObject, expression });
|
|
23
|
+
return `Avatar of ${fieldObject.title}`;
|
|
24
|
+
},
|
|
25
|
+
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
26
|
+
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
27
|
+
const [userCollectionField] = expression;
|
|
28
|
+
const userCollectionFieldObject = typeObject.fieldObjectsByName[userCollectionField];
|
|
29
|
+
return {
|
|
30
|
+
[userCollectionField]: {
|
|
31
|
+
"q/from": [userCollectionField],
|
|
32
|
+
"q/select": (0, select_1.mergeDenormalizedSelects)((0, compact_1.default)([
|
|
33
|
+
(0, select_1.toSelectMapClause)([
|
|
34
|
+
userCollectionFieldObject.typeObject.idField,
|
|
35
|
+
userCollectionFieldObject.typeObject.titleField,
|
|
36
|
+
]),
|
|
37
|
+
(0, avatar_1.getAvatarSelectQuery)({
|
|
38
|
+
typeObject: userCollectionFieldObject.typeObject,
|
|
39
|
+
}),
|
|
40
|
+
])),
|
|
41
|
+
"q/limit": "q/no-limit",
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
},
|
|
45
|
+
calculateErrors: common_1.calculateUnitExpressionErrors,
|
|
46
|
+
getExportValue: get_export_value_1.getReferenceCollectionExportValue,
|
|
47
|
+
canExport: () => true,
|
|
48
|
+
getExportLabel: ({ unit, typeObject }) => {
|
|
49
|
+
const { expression } = unit;
|
|
50
|
+
const fieldObject = (0, utils_1.getFieldObjectByFieldExpression)({ typeObject, expression });
|
|
51
|
+
return fieldObject.title;
|
|
52
|
+
},
|
|
53
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AvatarInput = void 0;
|
|
4
|
+
const avatar_1 = require("./avatar");
|
|
5
|
+
const common_1 = require("../unit-utils/common");
|
|
6
|
+
const type = "avatar-input";
|
|
7
|
+
exports.AvatarInput = {
|
|
8
|
+
...avatar_1.Avatar,
|
|
9
|
+
type,
|
|
10
|
+
name: "Avatar",
|
|
11
|
+
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
12
|
+
};
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Avatar = void 0;
|
|
7
|
+
const compact_1 = __importDefault(require("lodash/compact"));
|
|
8
|
+
const select_1 = require("@fibery/query-utils/src/select");
|
|
9
|
+
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
10
|
+
const array_1 = require("@fibery/helpers/utils/array");
|
|
11
|
+
const avatar_1 = require("../field-utils/avatar");
|
|
12
|
+
const common_1 = require("../unit-utils/common");
|
|
13
|
+
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
14
|
+
const type = "avatar";
|
|
15
|
+
const getSelfAvatarSelectQuery = (typeObject) => (0, avatar_1.getAvatarSelectQuery)({ typeObject }) || {};
|
|
16
|
+
exports.Avatar = {
|
|
17
|
+
type,
|
|
18
|
+
name: "Avatar",
|
|
19
|
+
canEdit({ typeObject, unit: { expression } }) {
|
|
20
|
+
if (!expression) {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
return (0, common_1.canEditFieldExpression)(typeObject, expression);
|
|
24
|
+
},
|
|
25
|
+
getLabel({ typeObject, unit }) {
|
|
26
|
+
const { expression } = unit;
|
|
27
|
+
if (expression) {
|
|
28
|
+
const fieldObject = (0, utils_1.getFieldObjectByFieldExpression)({
|
|
29
|
+
typeObject,
|
|
30
|
+
expression,
|
|
31
|
+
});
|
|
32
|
+
if ((0, avatar_1.isAvatarExtensionEnabledType)(fieldObject.typeObject)) {
|
|
33
|
+
return `Avatar of ${fieldObject.title}`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return "Avatar";
|
|
37
|
+
},
|
|
38
|
+
makeUnit(args) {
|
|
39
|
+
if (!args) {
|
|
40
|
+
// @ts-expect-error this is a unique polymorphic unit
|
|
41
|
+
return { type, kind: "db" };
|
|
42
|
+
}
|
|
43
|
+
(0, utils_1.assertIsValidExpression)(args.expression);
|
|
44
|
+
return { type, kind: "field", expression: args.expression };
|
|
45
|
+
},
|
|
46
|
+
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
47
|
+
if (!expression) {
|
|
48
|
+
return getSelfAvatarSelectQuery(typeObject);
|
|
49
|
+
}
|
|
50
|
+
const field = (0, array_1.single)(expression);
|
|
51
|
+
const fieldObject = typeObject.fieldObjectsByName[field];
|
|
52
|
+
if ((0, avatar_1.isAvatarExtensionField)(fieldObject)) {
|
|
53
|
+
return getSelfAvatarSelectQuery(typeObject);
|
|
54
|
+
}
|
|
55
|
+
return (0, select_1.denormalizeSelect)({
|
|
56
|
+
[field]: (0, select_1.normalizeSelect)((0, select_1.mergeDenormalizedSelects)((0, compact_1.default)([
|
|
57
|
+
(0, select_1.toSelectMapClause)([fieldObject.typeObject.idField, fieldObject.typeObject.titleField]),
|
|
58
|
+
(0, avatar_1.getAvatarSelectQuery)({ typeObject: fieldObject.typeObject }),
|
|
59
|
+
]))),
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
calculateErrors: common_1.calculateUnitExpressionErrors,
|
|
63
|
+
getExportValue: ({ typeObject, unit, object }) => {
|
|
64
|
+
if (unit.kind === "field") {
|
|
65
|
+
return (0, get_export_value_1.getReferenceExportValue)({ typeObject, unit, object });
|
|
66
|
+
}
|
|
67
|
+
return null;
|
|
68
|
+
},
|
|
69
|
+
canExport: ({ unit }) => {
|
|
70
|
+
return unit.kind === "field";
|
|
71
|
+
},
|
|
72
|
+
getExportLabel: ({ unit, typeObject }) => {
|
|
73
|
+
const { expression } = unit;
|
|
74
|
+
if (expression) {
|
|
75
|
+
const fieldObject = (0, utils_1.getFieldObjectByFieldExpression)({ typeObject, expression });
|
|
76
|
+
return fieldObject.title;
|
|
77
|
+
}
|
|
78
|
+
return "Avatar";
|
|
79
|
+
},
|
|
80
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BackReferencesList = void 0;
|
|
4
|
+
const query_1 = require("@fibery/query-utils/src/query");
|
|
5
|
+
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
6
|
+
const back_references_1 = require("../field-utils/back-references");
|
|
7
|
+
const common_1 = require("../unit-utils/common");
|
|
8
|
+
const can_edit_field_1 = require("../unit-utils/can-edit-field");
|
|
9
|
+
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
10
|
+
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
11
|
+
const type = "back-references-list";
|
|
12
|
+
const getQuerySelect = (fieldObject) => {
|
|
13
|
+
const { name, typeObject } = fieldObject;
|
|
14
|
+
const orderBy = (0, query_1.calculateDefaultOrderBy)({ typeObject });
|
|
15
|
+
return {
|
|
16
|
+
[name]: {
|
|
17
|
+
"q/from": [name],
|
|
18
|
+
"q/select": (0, back_references_1.getEntityLinksListSelect)(typeObject),
|
|
19
|
+
"q/order-by": orderBy,
|
|
20
|
+
"q/limit": "q/no-limit",
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
exports.BackReferencesList = {
|
|
25
|
+
type,
|
|
26
|
+
name: "Back references list",
|
|
27
|
+
canEdit: can_edit_field_1.canEditField,
|
|
28
|
+
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
29
|
+
getLabel: get_field_label_1.getFieldLabel,
|
|
30
|
+
getQuerySelect: ({ typeObject, unit }) => {
|
|
31
|
+
const { expression } = unit;
|
|
32
|
+
const fieldObject = (0, utils_1.getFieldObjectByFieldExpression)({ typeObject, expression });
|
|
33
|
+
return getQuerySelect(fieldObject);
|
|
34
|
+
},
|
|
35
|
+
calculateErrors: common_1.calculateUnitExpressionErrors,
|
|
36
|
+
getExportValue: get_export_value_1.getExportValue,
|
|
37
|
+
canExport: () => true,
|
|
38
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BoolCheckbox = void 0;
|
|
4
|
+
const query_1 = require("@fibery/query-utils/src/query");
|
|
5
|
+
const common_1 = require("../unit-utils/common");
|
|
6
|
+
const can_edit_field_1 = require("../unit-utils/can-edit-field");
|
|
7
|
+
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
8
|
+
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
9
|
+
const type = "bool-checkbox";
|
|
10
|
+
exports.BoolCheckbox = {
|
|
11
|
+
type,
|
|
12
|
+
name: "Bool checkbox",
|
|
13
|
+
canEdit: can_edit_field_1.canEditField,
|
|
14
|
+
getLabel: get_field_label_1.getFieldLabel,
|
|
15
|
+
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
16
|
+
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
17
|
+
return (0, query_1.getQuerySelectForExpression)({
|
|
18
|
+
typeObject,
|
|
19
|
+
expression,
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
calculateErrors: common_1.calculateUnitExpressionErrors,
|
|
23
|
+
getExportValue: get_export_value_1.getExportValue,
|
|
24
|
+
canExport: () => true,
|
|
25
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Bool = void 0;
|
|
4
|
+
const query_1 = require("@fibery/query-utils/src/query");
|
|
5
|
+
const can_edit_field_1 = require("../unit-utils/can-edit-field");
|
|
6
|
+
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
7
|
+
const common_1 = require("../unit-utils/common");
|
|
8
|
+
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
9
|
+
const type = "bool";
|
|
10
|
+
exports.Bool = {
|
|
11
|
+
type,
|
|
12
|
+
name: "Bool",
|
|
13
|
+
canEdit: can_edit_field_1.canEditField,
|
|
14
|
+
getLabel: get_field_label_1.getFieldLabel,
|
|
15
|
+
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
16
|
+
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
17
|
+
return (0, query_1.getQuerySelectForExpression)({ typeObject, expression });
|
|
18
|
+
},
|
|
19
|
+
calculateErrors: common_1.calculateUnitExpressionErrors,
|
|
20
|
+
getExportValue: get_export_value_1.getExportValue,
|
|
21
|
+
canExport: () => true,
|
|
22
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CollectionCount = void 0;
|
|
4
|
+
const array_1 = require("@fibery/helpers/utils/array");
|
|
5
|
+
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
6
|
+
const reference_collection_1 = require("../field-utils/reference-collection");
|
|
7
|
+
const common_1 = require("../unit-utils/common");
|
|
8
|
+
const type = "collection-count";
|
|
9
|
+
exports.CollectionCount = {
|
|
10
|
+
type,
|
|
11
|
+
name: "Count",
|
|
12
|
+
canEdit: () => false,
|
|
13
|
+
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
14
|
+
getLabel({ typeObject, unit }) {
|
|
15
|
+
const { expression } = unit;
|
|
16
|
+
const fieldObject = (0, utils_1.getFieldObjectByFieldExpression)({ typeObject, expression });
|
|
17
|
+
if (fieldObject.name === "comments/comments") {
|
|
18
|
+
return fieldObject.title;
|
|
19
|
+
}
|
|
20
|
+
return `${fieldObject.title} Count`;
|
|
21
|
+
},
|
|
22
|
+
getQuerySelect({ unit: { expression } }) {
|
|
23
|
+
const field = (0, array_1.single)(expression);
|
|
24
|
+
return (0, reference_collection_1.getCollectionCountSelect)(field);
|
|
25
|
+
},
|
|
26
|
+
calculateErrors: common_1.calculateUnitExpressionErrors,
|
|
27
|
+
getExportValue: ({ object, unit }) => {
|
|
28
|
+
const field = (0, array_1.single)(unit.expression);
|
|
29
|
+
return object[(0, reference_collection_1.getCountKey)(field)];
|
|
30
|
+
},
|
|
31
|
+
canExport: () => true,
|
|
32
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ColorInput = void 0;
|
|
4
|
+
const query_1 = require("@fibery/query-utils/src/query");
|
|
5
|
+
const common_1 = require("../unit-utils/common");
|
|
6
|
+
const can_edit_field_1 = require("../unit-utils/can-edit-field");
|
|
7
|
+
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
8
|
+
const type = "color-input";
|
|
9
|
+
exports.ColorInput = {
|
|
10
|
+
type,
|
|
11
|
+
name: "Color",
|
|
12
|
+
canEdit: can_edit_field_1.canEditField,
|
|
13
|
+
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
14
|
+
getLabel: get_field_label_1.getFieldLabel,
|
|
15
|
+
getQuerySelect({ typeObject, unit: { expression } }) {
|
|
16
|
+
return (0, query_1.getQuerySelectForExpression)({ typeObject, expression });
|
|
17
|
+
},
|
|
18
|
+
calculateErrors: common_1.calculateUnitExpressionErrors,
|
|
19
|
+
getExportValue: () => null,
|
|
20
|
+
canExport: () => false,
|
|
21
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommentsList = void 0;
|
|
4
|
+
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
5
|
+
const comments_1 = require("../field-utils/comments");
|
|
6
|
+
const common_1 = require("../unit-utils/common");
|
|
7
|
+
const get_export_value_1 = require("../unit-utils/get-export-value");
|
|
8
|
+
const can_edit_field_1 = require("../unit-utils/can-edit-field");
|
|
9
|
+
const get_field_label_1 = require("../unit-utils/get-field-label");
|
|
10
|
+
const type = "comments-list";
|
|
11
|
+
exports.CommentsList = {
|
|
12
|
+
type,
|
|
13
|
+
name: "Comments list",
|
|
14
|
+
canEdit: can_edit_field_1.canEditField,
|
|
15
|
+
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
16
|
+
getLabel: get_field_label_1.getFieldLabel,
|
|
17
|
+
getQuerySelect: ({ typeObject, unit }) => {
|
|
18
|
+
const { expression } = unit;
|
|
19
|
+
const fieldObject = (0, utils_1.getFieldObjectByFieldExpression)({ typeObject, expression });
|
|
20
|
+
return (0, comments_1.getQuerySelect)(fieldObject);
|
|
21
|
+
},
|
|
22
|
+
calculateErrors: common_1.calculateUnitExpressionErrors,
|
|
23
|
+
getExportValue: get_export_value_1.getExportValue,
|
|
24
|
+
canExport: () => true,
|
|
25
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DateRangeCombobox = void 0;
|
|
4
|
+
const query_1 = require("@fibery/query-utils/src/query");
|
|
5
|
+
const common_1 = require("../unit-utils/common");
|
|
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
|
+
const can_edit_field_1 = require("../unit-utils/can-edit-field");
|
|
9
|
+
const type = "date-range-combobox";
|
|
10
|
+
exports.DateRangeCombobox = {
|
|
11
|
+
type,
|
|
12
|
+
name: "Date range",
|
|
13
|
+
canEdit: can_edit_field_1.canEditField,
|
|
14
|
+
makeUnit: (0, common_1.makeUnitMethod)(type),
|
|
15
|
+
getLabel: get_field_label_1.getFieldLabel,
|
|
16
|
+
getQuerySelect: ({ typeObject, unit: { expression } }) => {
|
|
17
|
+
return (0, query_1.getQuerySelectForExpression)({ typeObject, expression });
|
|
18
|
+
},
|
|
19
|
+
calculateErrors: common_1.calculateUnitExpressionErrors,
|
|
20
|
+
getExportValue: get_export_value_1.getDateRangeExportValue,
|
|
21
|
+
canExport: () => true,
|
|
22
|
+
};
|