@fibery/views 17.0.4 → 18.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/index.js +17 -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 +55 -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 +5 -0
- package/lib/src/private/units.js +141 -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 +15 -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 +57 -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 +65 -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 +41 -11
- package/lib/views.js +0 -1813
- /package/{index.js → lib/index.d.ts} +0 -0
package/lib/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./src"), exports);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FieldObject, TypeObject } from "@fibery/schema";
|
|
2
|
+
export declare const AVATAR_MIXIN_NAME = "avatar/avatar-mixin";
|
|
3
|
+
export declare const AVATAR_EXTENSION_FIELD = "avatar/avatars";
|
|
4
|
+
export declare const isAvatarExtensionEnabledType: (typeObject: TypeObject) => boolean;
|
|
5
|
+
export declare const isAvatarExtensionField: (fieldObject: FieldObject) => boolean;
|
|
6
|
+
export declare const getAvatarSelect: (fieldObject: FieldObject) => import("@fibery/expression-utils").Select;
|
|
7
|
+
export declare const getAvatarSelectQuery: ({ typeObject }: {
|
|
8
|
+
typeObject: TypeObject;
|
|
9
|
+
}) => {
|
|
10
|
+
[x: string]: "fibery/id" | "__NOTHING_INTERESTING__TitleField__" | {
|
|
11
|
+
"q/from": string[];
|
|
12
|
+
"q/limit": string;
|
|
13
|
+
"q/select": import("@fibery/expression-utils").Select;
|
|
14
|
+
};
|
|
15
|
+
"fibery/id": "fibery/id";
|
|
16
|
+
__NOTHING_INTERESTING__TitleField__: "__NOTHING_INTERESTING__TitleField__";
|
|
17
|
+
} | {
|
|
18
|
+
"fibery/id"?: undefined;
|
|
19
|
+
__NOTHING_INTERESTING__TitleField__?: undefined;
|
|
20
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
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.getAvatarSelectQuery = exports.getAvatarSelect = exports.isAvatarExtensionField = exports.isAvatarExtensionEnabledType = exports.AVATAR_EXTENSION_FIELD = exports.AVATAR_MIXIN_NAME = void 0;
|
|
7
|
+
const compact_1 = __importDefault(require("lodash/compact"));
|
|
8
|
+
const select_1 = require("@fibery/query-utils/src/select");
|
|
9
|
+
exports.AVATAR_MIXIN_NAME = "avatar/avatar-mixin";
|
|
10
|
+
exports.AVATAR_EXTENSION_FIELD = "avatar/avatars";
|
|
11
|
+
const isAvatarExtensionEnabledType = (typeObject) => {
|
|
12
|
+
return (typeObject &&
|
|
13
|
+
typeObject.installedMixins.has(exports.AVATAR_MIXIN_NAME) &&
|
|
14
|
+
(0, exports.isAvatarExtensionField)(typeObject.fieldObjectsByName[exports.AVATAR_EXTENSION_FIELD]));
|
|
15
|
+
};
|
|
16
|
+
exports.isAvatarExtensionEnabledType = isAvatarExtensionEnabledType;
|
|
17
|
+
const isAvatarExtensionField = (fieldObject) => {
|
|
18
|
+
return fieldObject.name === exports.AVATAR_EXTENSION_FIELD && fieldObject.type === "fibery/file";
|
|
19
|
+
};
|
|
20
|
+
exports.isAvatarExtensionField = isAvatarExtensionField;
|
|
21
|
+
const getAvatarSelect = (fieldObject) => (0, select_1.toSelectMapClause)((0, compact_1.default)([fieldObject.typeObject.idField, fieldObject.typeObject.titleField, "fibery/content-type", "fibery/secret"]));
|
|
22
|
+
exports.getAvatarSelect = getAvatarSelect;
|
|
23
|
+
const getAvatarSelectQuery = ({ typeObject }) => {
|
|
24
|
+
if ((0, exports.isAvatarExtensionEnabledType)(typeObject)) {
|
|
25
|
+
const fieldObject = typeObject.fieldObjectsByName[exports.AVATAR_EXTENSION_FIELD];
|
|
26
|
+
const idField = fieldObject.typeObject.idField;
|
|
27
|
+
const typeTitleField = typeObject.titleField;
|
|
28
|
+
return {
|
|
29
|
+
[idField]: idField,
|
|
30
|
+
[typeTitleField]: typeTitleField,
|
|
31
|
+
[fieldObject.name]: {
|
|
32
|
+
"q/from": [fieldObject.name],
|
|
33
|
+
"q/limit": "q/no-limit",
|
|
34
|
+
"q/select": (0, exports.getAvatarSelect)(fieldObject),
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return {};
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
exports.getAvatarSelectQuery = getAvatarSelectQuery;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FieldObject, TypeObject } from "@fibery/schema";
|
|
2
|
+
export declare const isReferenceExtensionField: (fieldObject: FieldObject) => boolean;
|
|
3
|
+
export declare const getEntityLinksListSelect: (typeObject: TypeObject) => {
|
|
4
|
+
"fibery/id": "fibery/id";
|
|
5
|
+
"fibery/creation-date": string;
|
|
6
|
+
"Collaboration~Documents/ParagraphSecret": string;
|
|
7
|
+
"Collaboration~Documents/FromTypeId": string;
|
|
8
|
+
"Collaboration~Documents/FromEntityId": string;
|
|
9
|
+
"Collaboration~Documents/FromEntityField": {
|
|
10
|
+
"fibery/id": string[];
|
|
11
|
+
};
|
|
12
|
+
"fibery/created-by": {
|
|
13
|
+
"fibery/id": string[];
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEntityLinksListSelect = exports.isReferenceExtensionField = void 0;
|
|
4
|
+
const isReferenceExtensionField = (fieldObject) => fieldObject.type === "Collaboration~Documents/Reference";
|
|
5
|
+
exports.isReferenceExtensionField = isReferenceExtensionField;
|
|
6
|
+
const getEntityLinksListSelect = (typeObject) => {
|
|
7
|
+
return {
|
|
8
|
+
[typeObject.idField]: typeObject.idField,
|
|
9
|
+
"fibery/creation-date": "fibery/creation-date",
|
|
10
|
+
"Collaboration~Documents/ParagraphSecret": "Collaboration~Documents/ParagraphSecret",
|
|
11
|
+
"Collaboration~Documents/FromTypeId": "Collaboration~Documents/FromTypeId",
|
|
12
|
+
"Collaboration~Documents/FromEntityId": "Collaboration~Documents/FromEntityId",
|
|
13
|
+
"Collaboration~Documents/FromEntityField": {
|
|
14
|
+
"fibery/id": ["Collaboration~Documents/FromEntityField", "fibery/id"],
|
|
15
|
+
},
|
|
16
|
+
"fibery/created-by": {
|
|
17
|
+
"fibery/id": ["fibery/created-by", "fibery/id"],
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
exports.getEntityLinksListSelect = getEntityLinksListSelect;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { FieldObject, TypeObject } from "@fibery/schema";
|
|
2
|
+
import { accessCheckKey } from "../unit-utils/access";
|
|
3
|
+
export declare const isCommentExtensionField: (fieldObject: FieldObject) => boolean;
|
|
4
|
+
export declare const getCommentsListSelect: (typeObject: TypeObject) => {
|
|
5
|
+
"fibery/id": "fibery/id";
|
|
6
|
+
"fibery/public-id": "fibery/public-id";
|
|
7
|
+
"fibery/creation-date": string;
|
|
8
|
+
"comment/document-secret": string;
|
|
9
|
+
"comments/parent": {
|
|
10
|
+
"fibery/id": string[];
|
|
11
|
+
};
|
|
12
|
+
"fibery/created-by": {
|
|
13
|
+
[accessCheckKey]: (string | string[])[];
|
|
14
|
+
"fibery/id": string[];
|
|
15
|
+
"user/email": string[];
|
|
16
|
+
"user/name": string[];
|
|
17
|
+
"avatar/avatars": {
|
|
18
|
+
"q/from": string[];
|
|
19
|
+
"q/limit": string;
|
|
20
|
+
"q/select": {
|
|
21
|
+
"fibery/id": string[];
|
|
22
|
+
"fibery/name": string[];
|
|
23
|
+
"fibery/content-type": string[];
|
|
24
|
+
"fibery/secret": string[];
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export declare const getQuerySelect: (fieldObject: FieldObject) => {
|
|
30
|
+
[name]: {
|
|
31
|
+
"q/from": string[];
|
|
32
|
+
"q/select": {
|
|
33
|
+
"fibery/id": "fibery/id";
|
|
34
|
+
"fibery/public-id": "fibery/public-id";
|
|
35
|
+
"fibery/creation-date": string;
|
|
36
|
+
"comment/document-secret": string;
|
|
37
|
+
"comments/parent": {
|
|
38
|
+
"fibery/id": string[];
|
|
39
|
+
};
|
|
40
|
+
"fibery/created-by": {
|
|
41
|
+
[accessCheckKey]: (string | string[])[];
|
|
42
|
+
"fibery/id": string[];
|
|
43
|
+
"user/email": string[];
|
|
44
|
+
"user/name": string[];
|
|
45
|
+
"avatar/avatars": {
|
|
46
|
+
"q/from": string[];
|
|
47
|
+
"q/limit": string;
|
|
48
|
+
"q/select": {
|
|
49
|
+
"fibery/id": string[];
|
|
50
|
+
"fibery/name": string[];
|
|
51
|
+
"fibery/content-type": string[];
|
|
52
|
+
"fibery/secret": string[];
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
"q/order-by": import("@fibery/expression-utils").OrderBy | undefined;
|
|
58
|
+
"q/limit": string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getQuerySelect = exports.getCommentsListSelect = exports.isCommentExtensionField = void 0;
|
|
4
|
+
const query_1 = require("@fibery/query-utils/src/query");
|
|
5
|
+
const access_1 = require("../unit-utils/access");
|
|
6
|
+
const isCommentExtensionField = (fieldObject) => fieldObject.name === "comments/comments";
|
|
7
|
+
exports.isCommentExtensionField = isCommentExtensionField;
|
|
8
|
+
const getCommentsListSelect = (typeObject) => {
|
|
9
|
+
return {
|
|
10
|
+
[typeObject.idField]: typeObject.idField,
|
|
11
|
+
[typeObject.publicIdField]: typeObject.publicIdField,
|
|
12
|
+
"fibery/creation-date": "fibery/creation-date",
|
|
13
|
+
"comment/document-secret": "comment/document-secret",
|
|
14
|
+
"comments/parent": { "fibery/id": ["comments/parent", "fibery/id"] },
|
|
15
|
+
"fibery/created-by": {
|
|
16
|
+
[access_1.accessCheckKey]: ["q/access?", ["fibery/created-by", "user/name"]],
|
|
17
|
+
"fibery/id": ["fibery/created-by", "fibery/id"],
|
|
18
|
+
"user/email": ["fibery/created-by", "user/email"],
|
|
19
|
+
"user/name": ["fibery/created-by", "user/name"],
|
|
20
|
+
"avatar/avatars": {
|
|
21
|
+
"q/from": ["fibery/created-by", "avatar/avatars"],
|
|
22
|
+
"q/limit": "q/no-limit",
|
|
23
|
+
"q/select": {
|
|
24
|
+
"fibery/id": ["fibery/id"],
|
|
25
|
+
"fibery/name": ["fibery/name"],
|
|
26
|
+
"fibery/content-type": ["fibery/content-type"],
|
|
27
|
+
"fibery/secret": ["fibery/secret"],
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
exports.getCommentsListSelect = getCommentsListSelect;
|
|
34
|
+
const getQuerySelect = (fieldObject) => {
|
|
35
|
+
const { name, typeObject } = fieldObject;
|
|
36
|
+
const orderBy = (0, query_1.calculateDefaultOrderBy)({ typeObject });
|
|
37
|
+
return {
|
|
38
|
+
[name]: {
|
|
39
|
+
"q/from": [name],
|
|
40
|
+
"q/select": (0, exports.getCommentsListSelect)(typeObject),
|
|
41
|
+
"q/order-by": orderBy,
|
|
42
|
+
"q/limit": "q/no-limit",
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
exports.getQuerySelect = getQuerySelect;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import moment, { Moment, MomentInput, unitOfTime } from "moment/moment";
|
|
2
|
+
export declare const parseDate: (isoDate: MomentInput) => moment.Moment;
|
|
3
|
+
export declare const serializeDate: (momentDate: Moment) => string;
|
|
4
|
+
export declare const parseDateTime: (isoDateTime: MomentInput) => moment.Moment;
|
|
5
|
+
export declare const serializeDateTime: (momentDate: Moment) => string;
|
|
6
|
+
export declare const parseStart: ({ value, type }: {
|
|
7
|
+
value: MomentInput;
|
|
8
|
+
type: string;
|
|
9
|
+
}) => moment.Moment;
|
|
10
|
+
export declare const parseEnd: ({ value, type, minimumDelta, }: {
|
|
11
|
+
value: MomentInput;
|
|
12
|
+
type: string;
|
|
13
|
+
minimumDelta?: [number, unitOfTime.DurationConstructor] | null;
|
|
14
|
+
}) => moment.Moment;
|
|
@@ -0,0 +1,56 @@
|
|
|
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.parseEnd = exports.parseStart = exports.serializeDateTime = exports.parseDateTime = exports.serializeDate = exports.parseDate = void 0;
|
|
7
|
+
const moment_1 = __importDefault(require("moment/moment"));
|
|
8
|
+
const errors_1 = require("@fibery/expression-utils/src/errors");
|
|
9
|
+
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
10
|
+
const defaultDateDelta = [1, "day"];
|
|
11
|
+
const defaultDateTimeDelta = [1, "second"];
|
|
12
|
+
const parseDate = (isoDate) => {
|
|
13
|
+
return (0, moment_1.default)(isoDate).set({ hour: 12 });
|
|
14
|
+
};
|
|
15
|
+
exports.parseDate = parseDate;
|
|
16
|
+
const serializeDate = (momentDate) => {
|
|
17
|
+
return momentDate.format("YYYY-MM-DD");
|
|
18
|
+
};
|
|
19
|
+
exports.serializeDate = serializeDate;
|
|
20
|
+
const parseDateTime = (isoDateTime) => {
|
|
21
|
+
return moment_1.default.utc(isoDateTime).local();
|
|
22
|
+
};
|
|
23
|
+
exports.parseDateTime = parseDateTime;
|
|
24
|
+
const serializeDateTime = (momentDate) => {
|
|
25
|
+
return momentDate.toISOString();
|
|
26
|
+
};
|
|
27
|
+
exports.serializeDateTime = serializeDateTime;
|
|
28
|
+
const parseStart = ({ value, type }) => {
|
|
29
|
+
if ((0, utils_1.isDateType)(type)) {
|
|
30
|
+
return (0, exports.parseDate)(value).startOf("day");
|
|
31
|
+
}
|
|
32
|
+
if ((0, utils_1.isDateTimeType)(type)) {
|
|
33
|
+
return (0, exports.parseDateTime)(value).startOf("second");
|
|
34
|
+
}
|
|
35
|
+
throw new errors_1.NotImplementedError(type);
|
|
36
|
+
};
|
|
37
|
+
exports.parseStart = parseStart;
|
|
38
|
+
const parseEnd = ({ value, type, minimumDelta = null, }) => {
|
|
39
|
+
if ((0, utils_1.isDateType)(type)) {
|
|
40
|
+
if ((0, utils_1.isRangeType)(type)) {
|
|
41
|
+
return (0, exports.parseDate)(value)
|
|
42
|
+
.subtract(...(minimumDelta || defaultDateDelta))
|
|
43
|
+
.endOf("day");
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
return (0, exports.parseDate)(value).endOf("day");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if ((0, utils_1.isDateTimeType)(type)) {
|
|
50
|
+
return (0, exports.parseDateTime)(value)
|
|
51
|
+
.subtract(...(minimumDelta || defaultDateTimeDelta))
|
|
52
|
+
.startOf("second");
|
|
53
|
+
}
|
|
54
|
+
throw new errors_1.NotImplementedError(type);
|
|
55
|
+
};
|
|
56
|
+
exports.parseEnd = parseEnd;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FieldObject, TypeObject } from "@fibery/schema";
|
|
2
|
+
import { NumberFormat } from "./number";
|
|
3
|
+
export declare const enumNumberFieldName = "Value";
|
|
4
|
+
export declare const getEnumNumberFieldName: (namespace: string) => string;
|
|
5
|
+
export declare const defaultEnumNumberFieldMeta: {
|
|
6
|
+
numberFormat: NumberFormat;
|
|
7
|
+
numberPrecision: number;
|
|
8
|
+
numberUnit: null;
|
|
9
|
+
numberCurrencyCode: null;
|
|
10
|
+
numberUseThousandSeparator: boolean;
|
|
11
|
+
};
|
|
12
|
+
export declare const getIsNumberFieldObjectTaken: (typeObject: TypeObject) => boolean;
|
|
13
|
+
export declare const getNumberFieldObject: (typeObject: TypeObject) => FieldObject | undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getNumberFieldObject = exports.getIsNumberFieldObjectTaken = exports.defaultEnumNumberFieldMeta = exports.getEnumNumberFieldName = exports.enumNumberFieldName = void 0;
|
|
4
|
+
const number_1 = require("./number");
|
|
5
|
+
exports.enumNumberFieldName = "Value";
|
|
6
|
+
const getEnumNumberFieldName = (namespace) => `${namespace}/${exports.enumNumberFieldName}`;
|
|
7
|
+
exports.getEnumNumberFieldName = getEnumNumberFieldName;
|
|
8
|
+
exports.defaultEnumNumberFieldMeta = {
|
|
9
|
+
numberFormat: number_1.NumberFormat.NUMBER,
|
|
10
|
+
numberPrecision: 0,
|
|
11
|
+
numberUnit: null,
|
|
12
|
+
numberCurrencyCode: null,
|
|
13
|
+
numberUseThousandSeparator: true,
|
|
14
|
+
};
|
|
15
|
+
const isNumeric = (fieldObject) => {
|
|
16
|
+
return fieldObject.type === "fibery/int" || fieldObject.type === "fibery/decimal";
|
|
17
|
+
};
|
|
18
|
+
const getIsNumberFieldObjectTaken = (typeObject) => {
|
|
19
|
+
return Boolean(typeObject.fieldObjects.find((fieldObject) => {
|
|
20
|
+
return fieldObject.nameParts.name === exports.enumNumberFieldName && !isNumeric(fieldObject);
|
|
21
|
+
}));
|
|
22
|
+
};
|
|
23
|
+
exports.getIsNumberFieldObjectTaken = getIsNumberFieldObjectTaken;
|
|
24
|
+
const getNumberFieldObject = (typeObject) => {
|
|
25
|
+
return typeObject.fieldObjects.find((fieldObject) => {
|
|
26
|
+
return fieldObject.nameParts.name === exports.enumNumberFieldName && isNumeric(fieldObject);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
exports.getNumberFieldObject = getNumberFieldObject;
|
|
@@ -0,0 +1,18 @@
|
|
|
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.getFilesSelect = void 0;
|
|
7
|
+
const compact_1 = __importDefault(require("lodash/compact"));
|
|
8
|
+
const select_1 = require("@fibery/query-utils/src/select");
|
|
9
|
+
const getFilesSelect = ({ typeObject }) => (0, select_1.toSelectMapClause)((0, compact_1.default)([
|
|
10
|
+
typeObject.idField,
|
|
11
|
+
typeObject.titleField,
|
|
12
|
+
"fibery/creation-date",
|
|
13
|
+
"fibery/content-type",
|
|
14
|
+
"fibery/content-length",
|
|
15
|
+
"fibery/secret",
|
|
16
|
+
"fibery/rank",
|
|
17
|
+
]));
|
|
18
|
+
exports.getFilesSelect = getFilesSelect;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FieldObject, TypeObject } from "@fibery/schema";
|
|
2
|
+
export declare const ICON_MIXIN_NAME = "icon/icon-mixin";
|
|
3
|
+
export declare const ICON_EXTENSION_FIELD = "icon/icon";
|
|
4
|
+
export declare const isIconExtensionEnabledType: (typeObject: TypeObject) => boolean;
|
|
5
|
+
export declare const isIconExtensionField: (fieldObject: FieldObject) => boolean;
|
|
6
|
+
export declare const getEntityIconSelect: ({ typeObject }: {
|
|
7
|
+
typeObject: TypeObject;
|
|
8
|
+
}) => {
|
|
9
|
+
[x: string]: string;
|
|
10
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEntityIconSelect = exports.isIconExtensionField = exports.isIconExtensionEnabledType = exports.ICON_EXTENSION_FIELD = exports.ICON_MIXIN_NAME = void 0;
|
|
4
|
+
exports.ICON_MIXIN_NAME = "icon/icon-mixin";
|
|
5
|
+
exports.ICON_EXTENSION_FIELD = "icon/icon";
|
|
6
|
+
const isIconExtensionEnabledType = (typeObject) => {
|
|
7
|
+
return (typeObject.installedMixins.has(exports.ICON_MIXIN_NAME) &&
|
|
8
|
+
(0, exports.isIconExtensionField)(typeObject.fieldObjectsByName[exports.ICON_EXTENSION_FIELD]));
|
|
9
|
+
};
|
|
10
|
+
exports.isIconExtensionEnabledType = isIconExtensionEnabledType;
|
|
11
|
+
const isIconExtensionField = (fieldObject) => {
|
|
12
|
+
return fieldObject.name === exports.ICON_EXTENSION_FIELD && fieldObject.type === "fibery/emoji";
|
|
13
|
+
};
|
|
14
|
+
exports.isIconExtensionField = isIconExtensionField;
|
|
15
|
+
const getEntityIconSelect = ({ typeObject }) => {
|
|
16
|
+
if ((0, exports.isIconExtensionEnabledType)(typeObject)) {
|
|
17
|
+
const fieldObject = typeObject.fieldObjectsByName[exports.ICON_EXTENSION_FIELD];
|
|
18
|
+
return {
|
|
19
|
+
[fieldObject.name]: fieldObject.name,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
exports.getEntityIconSelect = getEntityIconSelect;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { FieldObject } from "@fibery/schema";
|
|
2
|
+
export declare enum NumberFormat {
|
|
3
|
+
NUMBER = "Number",
|
|
4
|
+
MONEY = "Money",
|
|
5
|
+
PERCENT = "Percent"
|
|
6
|
+
}
|
|
7
|
+
export type NumberDisplaySettings = {
|
|
8
|
+
thousandSeparator: string;
|
|
9
|
+
decimalSeparator: string;
|
|
10
|
+
};
|
|
11
|
+
export type NumberFieldMeta = {
|
|
12
|
+
numberFormat: NumberFormat;
|
|
13
|
+
numberPrecision: number;
|
|
14
|
+
numberUnit: string | null;
|
|
15
|
+
numberCurrencyCode: string | null;
|
|
16
|
+
numberUseThousandSeparator: boolean;
|
|
17
|
+
};
|
|
18
|
+
export declare const getDefaultCurrencyCode: (numberFormat: NumberFormat) => "USD" | null;
|
|
19
|
+
export declare const getDefaultPrecision: (numberFormat: NumberFormat) => 0 | 2;
|
|
20
|
+
export declare const getInitialNumberFieldMeta: () => NumberFieldMeta;
|
|
21
|
+
export declare const externalizePrecision: (numberFormat: NumberFormat, numberPrecision: number) => number;
|
|
22
|
+
export declare function getNumberFormatOrDefault(numberFormat: NumberFormat | undefined): NumberFormat;
|
|
23
|
+
export declare const parseNumberMeta: ({ rawNumberPrecision, rawNumberUnit, rawNumberCurrencyCode, rawNumberUseThousandSeparator, rawNumberFormat, fieldType, }: {
|
|
24
|
+
rawNumberPrecision: unknown;
|
|
25
|
+
rawNumberUnit: unknown;
|
|
26
|
+
rawNumberCurrencyCode: unknown;
|
|
27
|
+
rawNumberUseThousandSeparator: unknown;
|
|
28
|
+
rawNumberFormat: unknown;
|
|
29
|
+
fieldType: string;
|
|
30
|
+
}) => NumberFieldMeta;
|
|
31
|
+
export declare const parseNumberFieldMeta: (fieldObject: FieldObject) => NumberFieldMeta;
|
|
@@ -0,0 +1,91 @@
|
|
|
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.parseNumberFieldMeta = exports.parseNumberMeta = exports.externalizePrecision = exports.getInitialNumberFieldMeta = exports.getDefaultPrecision = exports.getDefaultCurrencyCode = exports.NumberFormat = void 0;
|
|
7
|
+
exports.getNumberFormatOrDefault = getNumberFormatOrDefault;
|
|
8
|
+
const curry_1 = __importDefault(require("lodash/curry"));
|
|
9
|
+
const flow_1 = __importDefault(require("lodash/flow"));
|
|
10
|
+
var NumberFormat;
|
|
11
|
+
(function (NumberFormat) {
|
|
12
|
+
NumberFormat["NUMBER"] = "Number";
|
|
13
|
+
NumberFormat["MONEY"] = "Money";
|
|
14
|
+
NumberFormat["PERCENT"] = "Percent";
|
|
15
|
+
})(NumberFormat || (exports.NumberFormat = NumberFormat = {}));
|
|
16
|
+
const DEFAULT_NUMBER_FORMAT = NumberFormat.NUMBER;
|
|
17
|
+
const getDefaultCurrencyCode = (numberFormat) => {
|
|
18
|
+
if (numberFormat === NumberFormat.MONEY) {
|
|
19
|
+
return "USD";
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
};
|
|
23
|
+
exports.getDefaultCurrencyCode = getDefaultCurrencyCode;
|
|
24
|
+
const getDefaultPrecision = (numberFormat) => {
|
|
25
|
+
if (numberFormat === NumberFormat.MONEY) {
|
|
26
|
+
return 2;
|
|
27
|
+
}
|
|
28
|
+
return 0;
|
|
29
|
+
};
|
|
30
|
+
exports.getDefaultPrecision = getDefaultPrecision;
|
|
31
|
+
const getInitialNumberFieldMeta = () => {
|
|
32
|
+
return {
|
|
33
|
+
numberFormat: DEFAULT_NUMBER_FORMAT,
|
|
34
|
+
numberPrecision: (0, exports.getDefaultPrecision)(DEFAULT_NUMBER_FORMAT),
|
|
35
|
+
numberUnit: null,
|
|
36
|
+
numberCurrencyCode: (0, exports.getDefaultCurrencyCode)(DEFAULT_NUMBER_FORMAT),
|
|
37
|
+
numberUseThousandSeparator: true,
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
exports.getInitialNumberFieldMeta = getInitialNumberFieldMeta;
|
|
41
|
+
const parsePrecisionWithBackwardCompatibility = (fieldType) => (rawNumberPrecision) => {
|
|
42
|
+
// For some reason there exist fields of type fibery/int with precision > 0
|
|
43
|
+
const isInteger = fieldType === "fibery/int";
|
|
44
|
+
return isInteger ? 0 : Number(rawNumberPrecision) || 1;
|
|
45
|
+
};
|
|
46
|
+
const internalizePrecision = (0, curry_1.default)((numberFormat, numberPrecision) => {
|
|
47
|
+
if (numberFormat === NumberFormat.PERCENT) {
|
|
48
|
+
return numberPrecision - 2;
|
|
49
|
+
}
|
|
50
|
+
return numberPrecision;
|
|
51
|
+
});
|
|
52
|
+
const externalizePrecision = (numberFormat, numberPrecision) => {
|
|
53
|
+
if (numberFormat === NumberFormat.PERCENT) {
|
|
54
|
+
return numberPrecision + 2;
|
|
55
|
+
}
|
|
56
|
+
return numberPrecision;
|
|
57
|
+
};
|
|
58
|
+
exports.externalizePrecision = externalizePrecision;
|
|
59
|
+
function getNumberFormatOrDefault(numberFormat) {
|
|
60
|
+
return numberFormat || DEFAULT_NUMBER_FORMAT;
|
|
61
|
+
}
|
|
62
|
+
const parseNumberMeta = ({ rawNumberPrecision, rawNumberUnit, rawNumberCurrencyCode, rawNumberUseThousandSeparator, rawNumberFormat, fieldType, }) => {
|
|
63
|
+
const numberFormat = getNumberFormatOrDefault(rawNumberFormat);
|
|
64
|
+
const numberPrecision = (0, flow_1.default)([
|
|
65
|
+
parsePrecisionWithBackwardCompatibility(fieldType),
|
|
66
|
+
internalizePrecision(numberFormat),
|
|
67
|
+
])(rawNumberPrecision);
|
|
68
|
+
const numberUnit = rawNumberUnit || null;
|
|
69
|
+
const numberCurrencyCode = numberFormat === NumberFormat.MONEY ? rawNumberCurrencyCode : null;
|
|
70
|
+
const numberUseThousandSeparator = Boolean(rawNumberUseThousandSeparator);
|
|
71
|
+
return {
|
|
72
|
+
numberFormat,
|
|
73
|
+
numberPrecision,
|
|
74
|
+
numberUnit,
|
|
75
|
+
numberCurrencyCode,
|
|
76
|
+
numberUseThousandSeparator,
|
|
77
|
+
};
|
|
78
|
+
};
|
|
79
|
+
exports.parseNumberMeta = parseNumberMeta;
|
|
80
|
+
const parseNumberFieldMeta = (fieldObject) => {
|
|
81
|
+
const { "ui/number-precision": rawNumberPrecision, "ui/number-unit": rawNumberUnit, "ui/number-currency-code": rawNumberCurrencyCode, "ui/number-thousand-separator?": rawNumberUseThousandSeparator, "ui/number-format": rawNumberFormat, } = fieldObject.rawMeta;
|
|
82
|
+
return (0, exports.parseNumberMeta)({
|
|
83
|
+
rawNumberPrecision,
|
|
84
|
+
rawNumberUnit,
|
|
85
|
+
rawNumberCurrencyCode,
|
|
86
|
+
rawNumberUseThousandSeparator,
|
|
87
|
+
rawNumberFormat,
|
|
88
|
+
fieldType: fieldObject.type,
|
|
89
|
+
});
|
|
90
|
+
};
|
|
91
|
+
exports.parseNumberFieldMeta = parseNumberFieldMeta;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FieldObject } from "@fibery/schema";
|
|
2
|
+
import { QueryLimit } from "@fibery/expression-utils/src/types";
|
|
3
|
+
export declare const REFERENCE_COLLECTION_LIMIT = 1000;
|
|
4
|
+
export declare const makeCollectionCountExpression: (field: string) => (string | string[])[];
|
|
5
|
+
export declare const getCountKey: (field: string) => string;
|
|
6
|
+
export declare const getCollectionCountSelect: (field: string) => {
|
|
7
|
+
[x: string]: (string | string[])[];
|
|
8
|
+
};
|
|
9
|
+
export declare const calculateReferenceCollectionQuery: ({ fieldObject, limit, }: {
|
|
10
|
+
fieldObject: FieldObject;
|
|
11
|
+
limit: QueryLimit;
|
|
12
|
+
}) => {
|
|
13
|
+
[x: string]: {
|
|
14
|
+
"q/from": string[];
|
|
15
|
+
"q/select": any;
|
|
16
|
+
"q/limit": QueryLimit;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
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.calculateReferenceCollectionQuery = exports.getCollectionCountSelect = exports.getCountKey = exports.makeCollectionCountExpression = exports.REFERENCE_COLLECTION_LIMIT = void 0;
|
|
7
|
+
const compact_1 = __importDefault(require("lodash/compact"));
|
|
8
|
+
const select_1 = require("@fibery/query-utils/src/select");
|
|
9
|
+
const dynamic_keys_1 = require("../unit-utils/dynamic-keys");
|
|
10
|
+
const access_1 = require("../unit-utils/access");
|
|
11
|
+
const enums_1 = require("../unit-utils/enums");
|
|
12
|
+
const avatar_1 = require("./avatar");
|
|
13
|
+
const icon_1 = require("./icon");
|
|
14
|
+
const file_1 = require("./file");
|
|
15
|
+
exports.REFERENCE_COLLECTION_LIMIT = 1000;
|
|
16
|
+
const makeCollectionCountExpression = (field) => ["q/count", [field, "fibery/id"]];
|
|
17
|
+
exports.makeCollectionCountExpression = makeCollectionCountExpression;
|
|
18
|
+
const getCountKey = (field) => (0, dynamic_keys_1.makeDynamicKey)(dynamic_keys_1.collectionCountKeyPrefix, field);
|
|
19
|
+
exports.getCountKey = getCountKey;
|
|
20
|
+
const getCollectionCountSelect = (field) => ({
|
|
21
|
+
[(0, exports.getCountKey)(field)]: (0, exports.makeCollectionCountExpression)(field),
|
|
22
|
+
});
|
|
23
|
+
exports.getCollectionCountSelect = getCollectionCountSelect;
|
|
24
|
+
const calculateReferenceCollectionQuery = ({ fieldObject, limit, }) => {
|
|
25
|
+
return {
|
|
26
|
+
[fieldObject.name]: {
|
|
27
|
+
"q/from": [fieldObject.name],
|
|
28
|
+
"q/select": (0, select_1.mergeDenormalizedSelects)((0, compact_1.default)([
|
|
29
|
+
(0, select_1.toSelectMapClause)((0, compact_1.default)([
|
|
30
|
+
fieldObject.typeObject.idField,
|
|
31
|
+
fieldObject.typeObject.titleField,
|
|
32
|
+
// keep public id - required to build Links
|
|
33
|
+
fieldObject.typeObject.publicIdField,
|
|
34
|
+
])),
|
|
35
|
+
(0, access_1.generateAccessCheckQueryExpression)({ typeObject: fieldObject.typeObject }),
|
|
36
|
+
(0, avatar_1.getAvatarSelectQuery)({ typeObject: fieldObject.typeObject }),
|
|
37
|
+
(0, icon_1.getEntityIconSelect)({ typeObject: fieldObject.typeObject }),
|
|
38
|
+
fieldObject.type === "fibery/file" && (0, file_1.getFilesSelect)(fieldObject),
|
|
39
|
+
(0, enums_1.getEnumIconColorQuery)({ typeObject: fieldObject.typeObject }),
|
|
40
|
+
])),
|
|
41
|
+
"q/limit": limit,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
exports.calculateReferenceCollectionQuery = calculateReferenceCollectionQuery;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FieldObject, TypeObject } from "@fibery/schema";
|
|
2
|
+
import { Expression } from "@fibery/expression-utils";
|
|
3
|
+
import type { Select } from "@fibery/expression-utils/src/types";
|
|
4
|
+
export declare const getReferenceTypeSelectClause: ({ typeObject }: {
|
|
5
|
+
typeObject: TypeObject;
|
|
6
|
+
}, contextPath: Expression) => Select;
|
|
7
|
+
export declare const getReferenceFieldNormalizedSelectClause: (fieldObject: FieldObject, contextPath: Expression) => any;
|