@fibery/views 19.0.0 → 19.1.0
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/errors.d.ts +2 -0
- package/lib/src/errors.js +6 -0
- package/lib/src/field-utils/avatar.d.ts +1 -1
- package/lib/src/field-utils/avatar.js +1 -1
- package/lib/src/field-utils/back-references.d.ts +1 -1
- package/lib/src/field-utils/comments.d.ts +1 -1
- package/lib/src/field-utils/date-time.d.ts +5 -5
- package/lib/src/field-utils/date-time.js +1 -1
- package/lib/src/field-utils/enum-value.d.ts +1 -1
- package/lib/src/field-utils/file.d.ts +1 -1
- package/lib/src/field-utils/file.js +1 -1
- package/lib/src/field-utils/icon.d.ts +1 -1
- package/lib/src/field-utils/number.d.ts +1 -1
- package/lib/src/field-utils/reference-collection.d.ts +2 -2
- package/lib/src/field-utils/reference-collection.js +4 -4
- package/lib/src/field-utils/reference.d.ts +2 -2
- package/lib/src/field-utils/reference.js +4 -4
- package/lib/src/field-utils/relation-view.d.ts +1 -1
- package/lib/src/field-utils/rich-text.d.ts +2 -2
- package/lib/src/field-utils/rich-text.js +1 -1
- package/lib/src/field-utils/text.d.ts +1 -1
- package/lib/src/field-utils/user-active.d.ts +2 -2
- package/lib/src/field-utils/user-role.d.ts +1 -1
- package/lib/src/field-utils/workflow.d.ts +2 -2
- package/lib/src/index.d.ts +30 -16
- package/lib/src/index.js +7 -2
- package/lib/src/meta-validation.d.ts +10 -0
- package/lib/src/meta-validation.js +78 -0
- 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 +32 -24
- 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.d.ts +1 -1
- package/lib/src/unit-definitions/avatar-collection.js +5 -10
- package/lib/src/unit-definitions/avatar-input.d.ts +1 -1
- package/lib/src/unit-definitions/avatar-input.js +1 -1
- package/lib/src/unit-definitions/avatar.d.ts +1 -1
- package/lib/src/unit-definitions/avatar.js +5 -7
- package/lib/src/unit-definitions/back-references-list.d.ts +1 -1
- package/lib/src/unit-definitions/back-references-list.js +3 -3
- package/lib/src/unit-definitions/bool-checkbox.d.ts +1 -1
- package/lib/src/unit-definitions/bool-checkbox.js +2 -2
- package/lib/src/unit-definitions/bool.d.ts +1 -1
- package/lib/src/unit-definitions/bool.js +1 -1
- package/lib/src/unit-definitions/collection-count.d.ts +1 -1
- package/lib/src/unit-definitions/collection-count.js +4 -2
- package/lib/src/unit-definitions/color-input.d.ts +1 -1
- package/lib/src/unit-definitions/color-input.js +1 -1
- package/lib/src/unit-definitions/comments-list.d.ts +1 -1
- package/lib/src/unit-definitions/comments-list.js +1 -1
- package/lib/src/unit-definitions/date-range-combobox.d.ts +1 -1
- package/lib/src/unit-definitions/date-range-combobox.js +1 -1
- package/lib/src/unit-definitions/date-range.d.ts +1 -1
- package/lib/src/unit-definitions/date-range.js +1 -1
- package/lib/src/unit-definitions/date-time-combobox.d.ts +1 -1
- package/lib/src/unit-definitions/date-time-combobox.js +2 -2
- package/lib/src/unit-definitions/date.d.ts +1 -1
- package/lib/src/unit-definitions/date.js +2 -2
- package/lib/src/unit-definitions/email-input.d.ts +1 -1
- package/lib/src/unit-definitions/email-input.js +1 -1
- package/lib/src/unit-definitions/email.d.ts +1 -1
- package/lib/src/unit-definitions/email.js +1 -1
- package/lib/src/unit-definitions/emoji.d.ts +1 -1
- package/lib/src/unit-definitions/emoji.js +1 -1
- package/lib/src/unit-definitions/file-collection-count.d.ts +1 -1
- package/lib/src/unit-definitions/file-collection-count.js +11 -9
- package/lib/src/unit-definitions/file-compact-collection.d.ts +1 -1
- package/lib/src/unit-definitions/file-compact-collection.js +11 -9
- package/lib/src/unit-definitions/file-compact-reference.d.ts +1 -1
- package/lib/src/unit-definitions/file-compact-reference.js +3 -12
- package/lib/src/unit-definitions/file-reference.d.ts +1 -1
- package/lib/src/unit-definitions/file-reference.js +8 -6
- package/lib/src/unit-definitions/files-gallery.d.ts +1 -1
- package/lib/src/unit-definitions/files-gallery.js +11 -9
- package/lib/src/unit-definitions/files-l-list-item.d.ts +1 -1
- package/lib/src/unit-definitions/files-l-list-item.js +8 -6
- package/lib/src/unit-definitions/files-l-list.d.ts +1 -1
- package/lib/src/unit-definitions/files-l-list.js +11 -9
- package/lib/src/unit-definitions/files-list-item.d.ts +1 -1
- package/lib/src/unit-definitions/files-list-item.js +8 -6
- package/lib/src/unit-definitions/files-list.d.ts +1 -1
- package/lib/src/unit-definitions/files-list.js +11 -9
- package/lib/src/unit-definitions/geometry-preview.d.ts +1 -1
- package/lib/src/unit-definitions/geometry-preview.js +1 -1
- package/lib/src/unit-definitions/icon-button.d.ts +1 -1
- package/lib/src/unit-definitions/icon-button.js +1 -1
- package/lib/src/unit-definitions/icon-input.d.ts +1 -1
- package/lib/src/unit-definitions/icon-input.js +1 -1
- package/lib/src/unit-definitions/id.d.ts +1 -1
- package/lib/src/unit-definitions/json-input.d.ts +1 -1
- package/lib/src/unit-definitions/json-input.js +1 -1
- package/lib/src/unit-definitions/location-input.d.ts +1 -1
- package/lib/src/unit-definitions/location-input.js +1 -1
- package/lib/src/unit-definitions/location.d.ts +1 -1
- package/lib/src/unit-definitions/location.js +1 -1
- package/lib/src/unit-definitions/not-found.d.ts +1 -1
- package/lib/src/unit-definitions/number-input.d.ts +1 -1
- package/lib/src/unit-definitions/number-input.js +2 -2
- package/lib/src/unit-definitions/number.d.ts +1 -1
- package/lib/src/unit-definitions/number.js +2 -4
- package/lib/src/unit-definitions/phone-input.d.ts +1 -1
- package/lib/src/unit-definitions/phone-input.js +1 -1
- package/lib/src/unit-definitions/phone.d.ts +1 -1
- package/lib/src/unit-definitions/phone.js +1 -1
- package/lib/src/unit-definitions/progress-bar.d.ts +1 -1
- package/lib/src/unit-definitions/progress-bar.js +1 -4
- package/lib/src/unit-definitions/reference-collection-combobox.d.ts +1 -1
- package/lib/src/unit-definitions/reference-collection-combobox.js +1 -1
- package/lib/src/unit-definitions/reference-collection-list.d.ts +1 -1
- package/lib/src/unit-definitions/reference-collection-list.js +1 -1
- package/lib/src/unit-definitions/reference-collection-view.d.ts +1 -1
- package/lib/src/unit-definitions/reference-collection-view.js +1 -1
- package/lib/src/unit-definitions/reference-collection.d.ts +1 -1
- package/lib/src/unit-definitions/reference-collection.js +3 -3
- package/lib/src/unit-definitions/reference-combobox.d.ts +1 -1
- package/lib/src/unit-definitions/reference-combobox.js +1 -1
- package/lib/src/unit-definitions/reference-icon.d.ts +1 -1
- package/lib/src/unit-definitions/reference-icon.js +1 -1
- package/lib/src/unit-definitions/reference.d.ts +1 -1
- package/lib/src/unit-definitions/reference.js +1 -1
- package/lib/src/unit-definitions/rich-text-document.d.ts +1 -1
- package/lib/src/unit-definitions/rich-text-document.js +2 -2
- package/lib/src/unit-definitions/rich-text-snippet.d.ts +2 -1
- package/lib/src/unit-definitions/rich-text-snippet.js +6 -11
- package/lib/src/unit-definitions/single-location-preview.d.ts +1 -1
- package/lib/src/unit-definitions/single-location-preview.js +1 -1
- package/lib/src/unit-definitions/text-input.d.ts +1 -1
- package/lib/src/unit-definitions/text-input.js +2 -2
- package/lib/src/unit-definitions/text.d.ts +1 -1
- package/lib/src/unit-definitions/text.js +2 -2
- package/lib/src/unit-definitions/title-input.d.ts +1 -1
- package/lib/src/unit-definitions/title.d.ts +1 -1
- package/lib/src/unit-definitions/type-badge-abbr.d.ts +1 -1
- package/lib/src/unit-definitions/type-badge.d.ts +1 -1
- package/lib/src/unit-definitions/type-icon.d.ts +1 -1
- package/lib/src/unit-definitions/url-input.d.ts +1 -1
- package/lib/src/unit-definitions/url-input.js +1 -1
- package/lib/src/unit-definitions/url.d.ts +1 -1
- package/lib/src/unit-definitions/url.js +1 -1
- package/lib/src/unit-definitions/user-button.d.ts +1 -1
- package/lib/src/unit-definitions/user-role-input.d.ts +1 -1
- package/lib/src/unit-definitions/user-role-input.js +1 -1
- package/lib/src/unit-definitions/user-role.d.ts +1 -1
- package/lib/src/unit-definitions/user-role.js +1 -1
- package/lib/src/unit-utils/access.d.ts +2 -2
- package/lib/src/unit-utils/can-edit-field.d.ts +2 -2
- package/lib/src/unit-utils/common.d.ts +3 -3
- package/lib/src/unit-utils/common.js +1 -1
- package/lib/src/unit-utils/enums.d.ts +2 -2
- package/lib/src/unit-utils/formatters.d.ts +2 -2
- package/lib/src/unit-utils/get-export-value.d.ts +4 -4
- package/lib/src/unit-utils/get-export-value.js +3 -3
- package/lib/src/unit-utils/get-field-label.d.ts +2 -2
- package/lib/src/unit-utils/get-unmatched-unit-label.d.ts +1 -1
- package/lib/src/unit-utils/schema.d.ts +1 -1
- 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 +5 -5
- package/lib/src/units/board.js +1 -1
- package/lib/src/units/canvas/index.d.ts +4 -4
- package/lib/src/units/canvas/index.js +1 -1
- package/lib/src/units/canvas/type-badge-abbr.d.ts +1 -1
- package/lib/src/units/canvas/type-badge.d.ts +1 -1
- package/lib/src/units/default.d.ts +5 -5
- package/lib/src/units/default.js +1 -1
- package/lib/src/units/gallery.d.ts +1 -1
- package/lib/src/units/gantt.d.ts +5 -5
- package/lib/src/units/gantt.js +1 -1
- package/lib/src/units/get-unit-definitions-for-view-type.js +4 -4
- package/lib/src/units/grid.d.ts +4 -4
- package/lib/src/units/grid.js +7 -7
- package/lib/src/units/list.d.ts +5 -5
- package/lib/src/units/list.js +1 -1
- package/lib/src/units/make-factory.d.ts +4 -5
- package/lib/src/units/make-factory.js +26 -15
- package/lib/src/units/types.d.ts +5 -5
- package/package.json +18 -18
- package/lib/jest.config.cjs +0 -34
- package/lib/jest.config.d.cts +0 -3
|
@@ -1,3 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { Schema } from "@fibery/schema";
|
|
2
|
+
import type { ViewRecord } from "./utils";
|
|
3
|
+
type FormField = {
|
|
4
|
+
id: string;
|
|
5
|
+
[k: string]: unknown;
|
|
6
|
+
};
|
|
7
|
+
export declare const replaceNamesWithIdsInFormView: (schema: Schema, view: ViewRecord) => {
|
|
8
|
+
"fibery/meta": {
|
|
9
|
+
typeId: string | undefined;
|
|
10
|
+
fields: FormField[] | undefined;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export declare const replaceIdsWithNamesInFormView: (schema: Schema, view: ViewRecord) => {
|
|
14
|
+
"fibery/meta": {
|
|
15
|
+
typeId: string | undefined;
|
|
16
|
+
fields: FormField[] | undefined;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare const deleteExpressionWithNotFoundFieldsOrTypesInFormView: (schema: Schema, view: ViewRecord) => {
|
|
20
|
+
"fibery/meta": {
|
|
21
|
+
typeId: string | undefined;
|
|
22
|
+
fields: FormField[] | undefined;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export {};
|
package/lib/src/private/form.js
CHANGED
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.deleteExpressionWithNotFoundFieldsOrTypesInFormView = exports.replaceIdsWithNamesInFormView = exports.replaceNamesWithIdsInFormView = void 0;
|
|
4
4
|
const replaceNamesWithIdsInFormView = (schema, view) => {
|
|
5
5
|
const typeId = view["fibery/meta"]?.typeId;
|
|
6
|
-
const typeObject = Object.hasOwn(schema.typeObjectsByName, typeId) ? schema.typeObjectsByName[typeId] : null;
|
|
6
|
+
const typeObject = typeId && Object.hasOwn(schema.typeObjectsByName, typeId) ? schema.typeObjectsByName[typeId] : null;
|
|
7
7
|
const fields = view["fibery/meta"]?.fields;
|
|
8
8
|
const fieldsInIdsTerms = fields &&
|
|
9
9
|
fields.map((field) => {
|
|
@@ -24,7 +24,7 @@ const replaceNamesWithIdsInFormView = (schema, view) => {
|
|
|
24
24
|
exports.replaceNamesWithIdsInFormView = replaceNamesWithIdsInFormView;
|
|
25
25
|
const replaceIdsWithNamesInFormView = (schema, view) => {
|
|
26
26
|
const typeId = view["fibery/meta"]?.typeId;
|
|
27
|
-
const typeObject = Object.hasOwn(schema.typeObjectsById, typeId) ? schema.typeObjectsById[typeId] : null;
|
|
27
|
+
const typeObject = typeId && Object.hasOwn(schema.typeObjectsById, typeId) ? schema.typeObjectsById[typeId] : null;
|
|
28
28
|
const fields = view["fibery/meta"]?.fields;
|
|
29
29
|
const fieldsInNameTerms = fields &&
|
|
30
30
|
fields.map((field) => {
|
|
@@ -46,7 +46,7 @@ exports.replaceIdsWithNamesInFormView = replaceIdsWithNamesInFormView;
|
|
|
46
46
|
const deleteExpressionWithNotFoundFieldsOrTypesInFormView = (schema, view) => {
|
|
47
47
|
// we expect view in names terms here.
|
|
48
48
|
const typeName = view["fibery/meta"]?.typeId;
|
|
49
|
-
const typeObject = Object.hasOwn(schema.typeObjectsByName, typeName) ? schema.typeObjectsByName[typeName] : null;
|
|
49
|
+
const typeObject = typeName && Object.hasOwn(schema.typeObjectsByName, typeName) ? schema.typeObjectsByName[typeName] : null;
|
|
50
50
|
const fields = view["fibery/meta"]?.fields;
|
|
51
51
|
const existingFields = fields && fields.filter((field) => typeObject && Object.hasOwn(typeObject.fieldObjectsByName, field.id));
|
|
52
52
|
return {
|
package/lib/src/private/map.d.ts
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import type { Expression } from "@fibery/expression-utils/src/types";
|
|
2
|
+
import type { FieldObject, Schema } from "@fibery/schema";
|
|
3
|
+
import type { Unit } from "@fibery/views/src/units/types";
|
|
4
|
+
import type { UnitDefinitions, ViewRecord } from "./utils";
|
|
5
|
+
export declare const replaceNamesWithIdsInMapView: (schema: Schema, view: ViewRecord) => any;
|
|
6
|
+
export declare const replaceIdsWithNamesInMapView: (schema: Schema, view: ViewRecord) => any;
|
|
7
|
+
export declare const deleteExpressionWithNotFoundFieldsOrTypesInMapView: (schema: Schema, view: ViewRecord) => any;
|
|
8
|
+
export declare const fixUserSelectedUnitsInMapView: (schema: Schema, view: ViewRecord, { unitDefinitions, getDefaultUnitTypeForField, }: {
|
|
9
|
+
unitDefinitions: UnitDefinitions;
|
|
10
|
+
getDefaultUnitTypeForField: (fieldObject: FieldObject, allowedUnits: Unit[]) => string | undefined;
|
|
11
|
+
}) => any;
|
|
12
|
+
export declare const fixContextExpressionWithBrokenPath: (schema: Schema, view: ViewRecord, defaultContextExpression: Expression) => any;
|
|
13
|
+
export declare const collectGarbage: (view: ViewRecord) => any;
|
|
14
|
+
export declare const enableHideWhenEmptyForCheckedUnits: (view: ViewRecord) => any;
|
package/lib/src/private/map.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.enableHideWhenEmptyForCheckedUnits = exports.collectGarbage = exports.fixContextExpressionWithBrokenPath = exports.fixUserSelectedUnitsInMapView = exports.deleteExpressionWithNotFoundFieldsOrTypesInMapView = exports.replaceIdsWithNamesInMapView = exports.replaceNamesWithIdsInMapView = void 0;
|
|
7
7
|
const immutability_helper_1 = __importDefault(require("immutability-helper"));
|
|
8
8
|
const get_1 = __importDefault(require("lodash/get"));
|
|
9
|
+
const truthy_1 = require("../truthy");
|
|
9
10
|
const units_1 = require("./units");
|
|
10
11
|
const utils_1 = require("./utils");
|
|
11
12
|
const visitView = (view, visitor) => (0, immutability_helper_1.default)(view, {
|
|
@@ -31,9 +32,9 @@ const visitView = (view, visitor) => (0, immutability_helper_1.default)(view, {
|
|
|
31
32
|
units: {
|
|
32
33
|
$apply: (units) => units
|
|
33
34
|
? units
|
|
34
|
-
.filter(
|
|
35
|
+
.filter(truthy_1.truthy)
|
|
35
36
|
.map((unit) => (0, utils_1.visitViewUnit)(fromType, unit, visitor))
|
|
36
|
-
.filter(
|
|
37
|
+
.filter(utils_1.isUnitExpressionValid)
|
|
37
38
|
.map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit)
|
|
38
39
|
.filter((unit) => unit !== utils_1.REMOVE)
|
|
39
40
|
: undefined,
|
|
@@ -81,7 +82,7 @@ const deleteExpressionWithNotFoundFieldsOrTypesInMapView = (schema, view) => vis
|
|
|
81
82
|
visitExpression: (fromType, expression) => (0, utils_1.deleteExpressionWithNotFoundFieldsOrTypesInExpression)(schema, fromType, expression),
|
|
82
83
|
});
|
|
83
84
|
exports.deleteExpressionWithNotFoundFieldsOrTypesInMapView = deleteExpressionWithNotFoundFieldsOrTypesInMapView;
|
|
84
|
-
const fixUserSelectedUnitsInMapView = (schema, view, { unitDefinitions, getDefaultUnitTypeForField }) => {
|
|
85
|
+
const fixUserSelectedUnitsInMapView = (schema, view, { unitDefinitions, getDefaultUnitTypeForField, }) => {
|
|
85
86
|
return visitView(view, {
|
|
86
87
|
visitQueryExpression: (query) => query,
|
|
87
88
|
visitFilter: (_fromType, filter) => filter,
|
|
@@ -1,23 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
}
|
|
4
|
-
|
|
1
|
+
import type { Expression } from "@fibery/expression-utils/src/types";
|
|
2
|
+
import type { FieldObject, Schema } from "@fibery/schema";
|
|
3
|
+
import type { Unit } from "@fibery/views/src/units/types";
|
|
4
|
+
import type { UnitDefinitions, ViewRecord } from "./utils";
|
|
5
|
+
type GroupByEntry = {
|
|
6
|
+
expression: Expression;
|
|
7
|
+
[k: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
type GroupByExpression = Record<string, GroupByEntry>;
|
|
10
|
+
export declare const deleteExpressionWithNotFoundFieldsOrTypesInGroupByExpression: (schema: Schema, groupByExpression: GroupByExpression | null, fromType: string, removedItems: number[]) => any;
|
|
11
|
+
export declare const replaceIdsWithNamesInGroupByExpression: (schema: Schema, groupByExpression: GroupByExpression | null, fromType: string) => {
|
|
5
12
|
[k: string]: {
|
|
6
13
|
expression: any;
|
|
7
14
|
};
|
|
8
15
|
} | null;
|
|
9
|
-
export
|
|
16
|
+
export declare const replaceNamesWithIdsInGroupByExpression: (schema: Schema, groupByExpression: GroupByExpression | null, fromType: string) => {
|
|
10
17
|
[k: string]: {
|
|
11
18
|
expression: any;
|
|
12
19
|
};
|
|
13
20
|
} | null;
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
19
|
-
unitDefinitions:
|
|
20
|
-
getDefaultUnitTypeForField:
|
|
21
|
-
})
|
|
22
|
-
export
|
|
23
|
-
export
|
|
21
|
+
export declare const replaceNamesWithIdsInSmartFolder: (schema: Schema, smartFolder: ViewRecord) => any;
|
|
22
|
+
export declare const replaceIdsWithNamesInSmartFolder: (schema: Schema, smartFolder: ViewRecord) => any;
|
|
23
|
+
export declare const deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder: (schema: Schema, smartFolder: ViewRecord) => any;
|
|
24
|
+
export declare const fixContextExpressionWithBrokenPath: (schema: Schema, view: ViewRecord, defaultContextExpression: Expression) => any;
|
|
25
|
+
export declare const fixUserSelectedUnitsInSmartFolder: (schema: Schema, view: ViewRecord, { unitDefinitions, getDefaultUnitTypeForField, }: {
|
|
26
|
+
unitDefinitions: UnitDefinitions;
|
|
27
|
+
getDefaultUnitTypeForField: (fieldObject: FieldObject, allowedUnits: Unit[]) => string | undefined;
|
|
28
|
+
}) => any;
|
|
29
|
+
export declare const collectGarbage: (view: ViewRecord) => any;
|
|
30
|
+
export declare const enableHideWhenEmptyForCheckedUnits: (view: ViewRecord) => any;
|
|
31
|
+
export {};
|
|
@@ -8,6 +8,7 @@ const visitors_1 = require("@fibery/expression-utils/src/visitors");
|
|
|
8
8
|
const immutability_helper_1 = __importDefault(require("immutability-helper"));
|
|
9
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
10
10
|
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
11
|
+
const truthy_1 = require("../truthy");
|
|
11
12
|
const units_1 = require("./units");
|
|
12
13
|
const utils_1 = require("./utils");
|
|
13
14
|
const visitSmartFolder = (smartFolder, visitor) => (0, immutability_helper_1.default)(smartFolder, {
|
|
@@ -16,7 +17,7 @@ const visitSmartFolder = (smartFolder, visitor) => (0, immutability_helper_1.def
|
|
|
16
17
|
$apply: (items = []) => {
|
|
17
18
|
const isOldSmartFolder = !items.every((item) => Object.hasOwn(item, "groupBy"));
|
|
18
19
|
const removedItemsIndexes = items
|
|
19
|
-
.map((item, index) =>
|
|
20
|
+
.map((item, index) => visitor.visitQueryExpression(item.query) ? null : index)
|
|
20
21
|
.filter((value) => value !== null);
|
|
21
22
|
return items
|
|
22
23
|
.map((item) => {
|
|
@@ -76,9 +77,9 @@ const visitSmartFolder = (smartFolder, visitor) => (0, immutability_helper_1.def
|
|
|
76
77
|
$apply: (units) => {
|
|
77
78
|
return units
|
|
78
79
|
? units
|
|
79
|
-
.filter(
|
|
80
|
+
.filter(truthy_1.truthy)
|
|
80
81
|
.map((unit) => (0, utils_1.visitViewUnit)(fromType, unit, visitor))
|
|
81
|
-
.filter(
|
|
82
|
+
.filter(utils_1.isUnitExpressionValid)
|
|
82
83
|
.map((unit, index, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit)
|
|
83
84
|
.filter((unit) => unit !== utils_1.REMOVE)
|
|
84
85
|
: undefined;
|
|
@@ -153,7 +154,7 @@ const deleteExpressionWithNotFoundFieldsOrTypesInGroupByExpression = (schema, gr
|
|
|
153
154
|
}
|
|
154
155
|
return null;
|
|
155
156
|
})
|
|
156
|
-
.filter(
|
|
157
|
+
.filter(truthy_1.truthy);
|
|
157
158
|
return entries.length > 0 ? Object.fromEntries(entries) : null;
|
|
158
159
|
};
|
|
159
160
|
exports.deleteExpressionWithNotFoundFieldsOrTypesInGroupByExpression = deleteExpressionWithNotFoundFieldsOrTypesInGroupByExpression;
|
|
@@ -228,23 +229,25 @@ const fixContextExpressionWithBrokenPath = (schema, view, defaultContextExpressi
|
|
|
228
229
|
visitContextExpression: (fromType, expression) => (0, utils_1.resetContextExpressionIfBroken)(schema, fromType, expression, defaultContextExpression),
|
|
229
230
|
});
|
|
230
231
|
exports.fixContextExpressionWithBrokenPath = fixContextExpressionWithBrokenPath;
|
|
231
|
-
const fixUserSelectedUnitsInSmartFolder = (schema, view, { unitDefinitions, getDefaultUnitTypeForField }) => {
|
|
232
|
+
const fixUserSelectedUnitsInSmartFolder = (schema, view, { unitDefinitions, getDefaultUnitTypeForField, }) => {
|
|
232
233
|
return visitSmartFolder(view, {
|
|
233
234
|
visitQueryExpression: (query) => query,
|
|
234
235
|
visitGroupByExpression: (groupBy) => groupBy,
|
|
235
236
|
visitFilter: (_fromType, filter) => filter,
|
|
236
237
|
visitExpression: (_fromType, expression) => expression,
|
|
237
238
|
visitViewUnit: (fromType, unit, units) => {
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
if (unit.
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
snippetUnitForField.checked
|
|
239
|
+
if (unit.kind !== "user-button") {
|
|
240
|
+
// Migration: "rich-text" is a legacy unit type not in the current type system
|
|
241
|
+
if (unit.type === "rich-text" && view?.["fibery/type"] === "grid") {
|
|
242
|
+
if (unit.checked) {
|
|
243
|
+
const snippetsUnits = units.filter((x) => x.kind === "field" && x.type === "rich-text-snippet");
|
|
244
|
+
const snippetUnitForField = snippetsUnits.find((x) => (0, isEqual_1.default)(x.expression, unit.expression));
|
|
245
|
+
if (snippetUnitForField && !snippetUnitForField.checked) {
|
|
246
|
+
snippetUnitForField.checked = true;
|
|
247
|
+
}
|
|
245
248
|
}
|
|
249
|
+
return utils_1.REMOVE;
|
|
246
250
|
}
|
|
247
|
-
return utils_1.REMOVE;
|
|
248
251
|
}
|
|
249
252
|
return (0, units_1.fixViewUnit)(schema, fromType, unit, units, { unitDefinitions, getDefaultUnitTypeForField });
|
|
250
253
|
},
|
|
@@ -1,10 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
import type { Expression, Query } from "@fibery/expression-utils/src/types";
|
|
2
|
+
import type { FieldObject, Schema } from "@fibery/schema";
|
|
3
|
+
import type { Unit } from "@fibery/views/src/units/types";
|
|
4
|
+
import type { UnitDefinitions, ViewFilter, ViewRecord } from "./utils";
|
|
5
|
+
type GroupByEntry = {
|
|
6
|
+
expression: Expression;
|
|
7
|
+
[k: string]: unknown;
|
|
8
|
+
};
|
|
9
|
+
type GroupByExpression = Record<string, GroupByEntry>;
|
|
10
|
+
type TimelineMetaItem = {
|
|
11
|
+
query?: Query | null;
|
|
12
|
+
filter?: ViewFilter | null;
|
|
13
|
+
yExpression?: Expression | null;
|
|
14
|
+
startExpression?: Expression | null;
|
|
15
|
+
endExpression?: Expression | null;
|
|
16
|
+
secondaryStartExpression?: Expression | null;
|
|
17
|
+
secondaryEndExpression?: Expression | null;
|
|
18
|
+
contextExpression?: Expression | null;
|
|
19
|
+
units?: Unit[] | null;
|
|
20
|
+
colorCoding?: {
|
|
21
|
+
expression: Expression;
|
|
22
|
+
[k: string]: unknown;
|
|
23
|
+
}[] | null;
|
|
24
|
+
dependencyExpression?: Expression | null;
|
|
25
|
+
groupBy?: GroupByExpression | null;
|
|
26
|
+
groupingExpression?: GroupByExpression | null;
|
|
27
|
+
[k: string]: unknown;
|
|
28
|
+
};
|
|
29
|
+
export declare const replaceNamesWithIdsInTimelineView: (schema: Schema, view: ViewRecord) => any;
|
|
30
|
+
export declare const replaceIdsWithNamesInTimelineView: (schema: Schema, view: ViewRecord) => any;
|
|
31
|
+
export declare const deleteExpressionWithNotFoundFieldsOrTypesInTimelineView: (schema: Schema, view: ViewRecord, ensureAxisInvariant: boolean, canGroupMetaItem?: (_metaItem: TimelineMetaItem) => boolean) => any;
|
|
32
|
+
export declare const fixUserSelectedUnitsInTimelineView: (schema: Schema, view: ViewRecord, { unitDefinitions, getDefaultUnitTypeForField, }: {
|
|
33
|
+
unitDefinitions: UnitDefinitions;
|
|
34
|
+
getDefaultUnitTypeForField: (fieldObject: FieldObject, allowedUnits: Unit[]) => string | undefined;
|
|
35
|
+
}) => any;
|
|
36
|
+
export declare const fixContextExpressionWithBrokenPath: (schema: Schema, view: ViewRecord, defaultContextExpression: Expression) => any;
|
|
37
|
+
export declare const collectGarbage: (view: ViewRecord) => any;
|
|
38
|
+
export declare const enableHideWhenEmptyForCheckedEditableUnits: (view: ViewRecord) => any;
|
|
39
|
+
export {};
|
|
@@ -12,6 +12,7 @@ const has_1 = __importDefault(require("lodash/has"));
|
|
|
12
12
|
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
13
13
|
const set_1 = __importDefault(require("lodash/set"));
|
|
14
14
|
const some_1 = __importDefault(require("lodash/some"));
|
|
15
|
+
const truthy_1 = require("../truthy");
|
|
15
16
|
const smart_folder_1 = require("./smart-folder");
|
|
16
17
|
const units_1 = require("./units");
|
|
17
18
|
const utils_1 = require("./utils");
|
|
@@ -26,10 +27,11 @@ const visitAxisSingle = (axis, visitor) => {
|
|
|
26
27
|
units: axis.units &&
|
|
27
28
|
axis.units
|
|
28
29
|
.map((unit) => (0, utils_1.visitViewUnit)(fromType, unit, visitor))
|
|
29
|
-
.filter(
|
|
30
|
+
.filter(utils_1.isUnitExpressionValid)
|
|
30
31
|
.map((unit, idx, units) => (visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit))
|
|
31
32
|
.filter((unit) => unit !== utils_1.REMOVE),
|
|
32
|
-
groupByExpression: axis.groupByExpression &&
|
|
33
|
+
groupByExpression: axis.groupByExpression &&
|
|
34
|
+
firstOrNull(visitor.visitExpression(fromType, [axis.groupByExpression])),
|
|
33
35
|
};
|
|
34
36
|
if (!axisResult.query) {
|
|
35
37
|
return null;
|
|
@@ -101,9 +103,9 @@ const visitView = (view, visitor) => (0, immutability_helper_1.default)(view, {
|
|
|
101
103
|
units: {
|
|
102
104
|
$apply: (units) => units
|
|
103
105
|
? units
|
|
104
|
-
.filter(
|
|
106
|
+
.filter(truthy_1.truthy)
|
|
105
107
|
.map((unit) => (0, utils_1.visitViewUnit)(fromType, unit, visitor))
|
|
106
|
-
.filter(
|
|
108
|
+
.filter(utils_1.isUnitExpressionValid)
|
|
107
109
|
.map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit)
|
|
108
110
|
.filter((unit) => unit !== utils_1.REMOVE)
|
|
109
111
|
: undefined,
|
|
@@ -255,7 +257,7 @@ const ensureAxisAndItemExpressionInvariant = (view, canGroupMetaItem) => {
|
|
|
255
257
|
actions.forEach((action) => action());
|
|
256
258
|
return view;
|
|
257
259
|
};
|
|
258
|
-
const deleteExpressionWithNotFoundFieldsOrTypesInTimelineView = (schema, view, ensureAxisInvariant, canGroupMetaItem = (
|
|
260
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInTimelineView = (schema, view, ensureAxisInvariant, canGroupMetaItem = (_metaItem) => true) => {
|
|
259
261
|
const visitor = {
|
|
260
262
|
visitQueryExpression: (queryExpression) => (0, utils_1.deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression)(schema, queryExpression),
|
|
261
263
|
visitFilter: (fromType, expression) => (0, utils_1.deleteExpressionWithNotFoundFieldsOrTypesInFilter)(schema, fromType, expression),
|
|
@@ -279,7 +281,7 @@ const deleteExpressionWithNotFoundFieldsOrTypesInTimelineView = (schema, view, e
|
|
|
279
281
|
return ensureAxisInvariant ? ensureAxisAndItemExpressionInvariant(viewNew, canGroupMetaItem) : viewNew;
|
|
280
282
|
};
|
|
281
283
|
exports.deleteExpressionWithNotFoundFieldsOrTypesInTimelineView = deleteExpressionWithNotFoundFieldsOrTypesInTimelineView;
|
|
282
|
-
const fixUserSelectedUnitsInTimelineView = (schema, view, { unitDefinitions, getDefaultUnitTypeForField }) => {
|
|
284
|
+
const fixUserSelectedUnitsInTimelineView = (schema, view, { unitDefinitions, getDefaultUnitTypeForField, }) => {
|
|
283
285
|
return visitView(view, {
|
|
284
286
|
visitQueryExpression: (query) => query,
|
|
285
287
|
visitExpression: (_fromType, expression) => expression,
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
1
|
+
import type { FieldObject, Schema } from "@fibery/schema";
|
|
2
|
+
import type { Unit } from "@fibery/views/src/units/types";
|
|
3
|
+
import type { UnitDefinitions } from "./utils";
|
|
4
|
+
import { REMOVE } from "./utils";
|
|
5
|
+
export declare const fixViewUnit: (schema: Schema, fromType: string, unit: Unit, units: Unit[], { unitDefinitions, getDefaultUnitTypeForField, migrateFileCollectionUnit, }: {
|
|
6
|
+
unitDefinitions: UnitDefinitions;
|
|
7
|
+
getDefaultUnitTypeForField: (fieldObject: FieldObject, allowedUnits: Unit[]) => string | undefined;
|
|
8
|
+
migrateFileCollectionUnit?: boolean;
|
|
9
|
+
}) => Unit | typeof REMOVE;
|
|
10
|
+
export declare const enableHideWhenEmptyForCheckedEditableUnit: (unit: Unit) => Unit;
|
package/lib/src/private/units.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.enableHideWhenEmptyForCheckedEditableUnit = exports.fixViewUnit = void 0;
|
|
4
|
-
const utils_1 = require("
|
|
4
|
+
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
5
|
+
const utils_2 = require("./utils");
|
|
5
6
|
const getField = (schema, fromType, field) => Object.hasOwn(schema.typeObjectsByName, fromType) &&
|
|
6
7
|
Object.hasOwn(schema.typeObjectsByName[fromType].fieldObjectsByName, field)
|
|
7
8
|
? schema.typeObjectsByName[fromType].fieldObjectsByName[field]
|
|
@@ -18,7 +19,7 @@ const getFieldByExpression = (schema, fromType, expression) => {
|
|
|
18
19
|
}
|
|
19
20
|
currentType = fieldObject.type;
|
|
20
21
|
}
|
|
21
|
-
return fieldObject;
|
|
22
|
+
return fieldObject ?? null;
|
|
22
23
|
};
|
|
23
24
|
const getUnitTypeForTextField = (fieldMeta) => {
|
|
24
25
|
switch (fieldMeta["ui/type"]) {
|
|
@@ -45,24 +46,23 @@ const migrateUnitOptsDefault = {
|
|
|
45
46
|
migrateFileCollectionUnit: true,
|
|
46
47
|
};
|
|
47
48
|
const migrateUnit = (schema, fromType, unit, units, opts = migrateUnitOptsDefault) => {
|
|
48
|
-
const { type, expression } = unit;
|
|
49
49
|
const kind = unit.kind || getUnitKind(unit);
|
|
50
|
-
if (type === "date-time") {
|
|
50
|
+
if (unit.type === "date-time") {
|
|
51
51
|
return {
|
|
52
52
|
...unit,
|
|
53
53
|
kind,
|
|
54
54
|
type: "date",
|
|
55
55
|
};
|
|
56
56
|
}
|
|
57
|
-
if (type === "date-time-range") {
|
|
57
|
+
if (unit.type === "date-time-range") {
|
|
58
58
|
return {
|
|
59
59
|
...unit,
|
|
60
60
|
kind,
|
|
61
61
|
type: "date-range",
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
-
if (type === "text") {
|
|
65
|
-
const [field] = expression;
|
|
64
|
+
if (unit.type === "text") {
|
|
65
|
+
const [field] = unit.expression;
|
|
66
66
|
const fieldType = getFieldType(schema, fromType, field);
|
|
67
67
|
if (fieldType === "fibery/email") {
|
|
68
68
|
return {
|
|
@@ -72,8 +72,8 @@ const migrateUnit = (schema, fromType, unit, units, opts = migrateUnitOptsDefaul
|
|
|
72
72
|
};
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
if (
|
|
76
|
-
const [field] = expression;
|
|
75
|
+
if (unit.type === "text" || unit.type === "email" || unit.type === "phone" || unit.type === "url") {
|
|
76
|
+
const [field] = unit.expression;
|
|
77
77
|
if (getFieldType(schema, fromType, field) === "fibery/text") {
|
|
78
78
|
return {
|
|
79
79
|
...unit,
|
|
@@ -82,8 +82,8 @@ const migrateUnit = (schema, fromType, unit, units, opts = migrateUnitOptsDefaul
|
|
|
82
82
|
};
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
|
-
if (type === "files-collection") {
|
|
86
|
-
const [field] = expression;
|
|
85
|
+
if (unit.type === "files-collection") {
|
|
86
|
+
const [field] = unit.expression;
|
|
87
87
|
if (getFieldType(schema, fromType, field) === "fibery/file") {
|
|
88
88
|
return {
|
|
89
89
|
...unit,
|
|
@@ -92,7 +92,7 @@ const migrateUnit = (schema, fromType, unit, units, opts = migrateUnitOptsDefaul
|
|
|
92
92
|
};
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
if (type === "avatar" && !expression) {
|
|
95
|
+
if (unit.type === "avatar" && !unit.expression) {
|
|
96
96
|
const isAvatarExntensionEnabled = schema.typeObjectsByName[fromType]?.installedMixins.has("avatar/avatar-mixin");
|
|
97
97
|
const hasAvatarExntensionField = getFieldType(schema, fromType, "avatar/avatars") === "fibery/file";
|
|
98
98
|
if (isAvatarExntensionEnabled && hasAvatarExntensionField) {
|
|
@@ -103,8 +103,8 @@ const migrateUnit = (schema, fromType, unit, units, opts = migrateUnitOptsDefaul
|
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
if (opts.migrateFileCollectionUnit && type === "collection-count") {
|
|
107
|
-
const [field] = expression;
|
|
106
|
+
if (opts.migrateFileCollectionUnit && unit.type === "collection-count") {
|
|
107
|
+
const [field] = unit.expression;
|
|
108
108
|
const fieldObject = getField(schema, fromType, field);
|
|
109
109
|
if (fieldObject?.type === "fibery/file" && fieldObject?.isCollection) {
|
|
110
110
|
return {
|
|
@@ -116,32 +116,40 @@ const migrateUnit = (schema, fromType, unit, units, opts = migrateUnitOptsDefaul
|
|
|
116
116
|
}
|
|
117
117
|
return { ...unit, kind };
|
|
118
118
|
};
|
|
119
|
-
const
|
|
119
|
+
const expressionFrom = (unit) => unit.expression;
|
|
120
|
+
const fixViewUnit = (schema, fromType, unit, units, { unitDefinitions, getDefaultUnitTypeForField, migrateFileCollectionUnit = true, }) => {
|
|
120
121
|
const migrated = migrateUnit(schema, fromType, unit, units, { migrateFileCollectionUnit });
|
|
121
|
-
const
|
|
122
|
+
const expression = expressionFrom(unit) ?? [];
|
|
123
|
+
const fieldObject = getFieldByExpression(schema, fromType, expression);
|
|
122
124
|
if (fieldObject) {
|
|
123
|
-
const
|
|
124
|
-
|
|
125
|
-
|
|
125
|
+
const typeObject = schema.typeObjectsByName[fromType];
|
|
126
|
+
const parentFieldObjects = typeObject && expression.length > 1
|
|
127
|
+
? (0, utils_1.getFieldObjectsByFieldExpression)({ typeObject, expression }).slice(0, -1)
|
|
128
|
+
: [];
|
|
129
|
+
const allowedUnits = unitDefinitions.getUnitsForField(fieldObject, { parentFieldObjects });
|
|
126
130
|
if (allowedUnits.some((u) => u.type === migrated.type)) {
|
|
127
131
|
return migrated;
|
|
128
132
|
}
|
|
129
133
|
else {
|
|
130
134
|
if (unit.checked) {
|
|
131
|
-
const otherUnitsForField = units.filter((u) =>
|
|
135
|
+
const otherUnitsForField = units.filter((u) => {
|
|
136
|
+
const uExpression = expressionFrom(u);
|
|
137
|
+
return u !== unit && uExpression && expressionFrom(unit) && uExpression.join("/") === expression.join("/");
|
|
138
|
+
});
|
|
132
139
|
const hasEnabledUnitForField = otherUnitsForField.some((u) => u.checked);
|
|
133
140
|
if (hasEnabledUnitForField) {
|
|
134
|
-
return
|
|
141
|
+
return utils_2.REMOVE;
|
|
135
142
|
}
|
|
136
143
|
const defaultUnitType = getDefaultUnitTypeForField(fieldObject, allowedUnits);
|
|
137
|
-
const defaultUnit = (defaultUnitType && otherUnitsForField.find((u) => u.type === defaultUnitType)) ||
|
|
144
|
+
const defaultUnit = (defaultUnitType && otherUnitsForField.find((u) => u.type === defaultUnitType)) ||
|
|
145
|
+
otherUnitsForField[0];
|
|
138
146
|
if (defaultUnit) {
|
|
139
147
|
defaultUnit.checked = true;
|
|
140
|
-
return
|
|
148
|
+
return utils_2.REMOVE;
|
|
141
149
|
}
|
|
142
150
|
}
|
|
143
151
|
else {
|
|
144
|
-
return
|
|
152
|
+
return utils_2.REMOVE;
|
|
145
153
|
}
|
|
146
154
|
}
|
|
147
155
|
}
|
|
@@ -1,17 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export
|
|
17
|
-
|
|
1
|
+
import type { Expression, Query } from "@fibery/expression-utils/src/types";
|
|
2
|
+
import type { FieldObject, Schema } from "@fibery/schema";
|
|
3
|
+
import type { Unit } from "@fibery/views/src/units/types";
|
|
4
|
+
export declare const REMOVE: unique symbol;
|
|
5
|
+
export declare const skipRemove: (unit: Unit | typeof REMOVE) => unit is Unit;
|
|
6
|
+
export type ViewVisitor = {
|
|
7
|
+
visitExpression: (fromType: string, expression: Expression) => Expression | null;
|
|
8
|
+
visitFilter: (fromType: string, filter: ViewFilter | null) => ViewFilter | null;
|
|
9
|
+
visitQueryExpression: (query: Query) => Query | null;
|
|
10
|
+
visitViewUnit?: (fromType: string, unit: Unit, units: Unit[]) => Unit | typeof REMOVE;
|
|
11
|
+
visitContextExpression?: (fromType: string, expression: Expression) => Expression;
|
|
12
|
+
visitGroupByExpression?: (groupBy: Record<string, unknown>, fromType: string, removedItems?: number[]) => Record<string, unknown> | null;
|
|
13
|
+
visitEnums?: (enums: Record<string, unknown>) => Record<string, unknown> | null;
|
|
14
|
+
visitUnitGroupKey?: (key: string) => string;
|
|
15
|
+
};
|
|
16
|
+
export type UnitDefinitions = {
|
|
17
|
+
getUnitsForField: (fieldObject: FieldObject, options?: {
|
|
18
|
+
parentFieldObjects?: FieldObject[];
|
|
19
|
+
}) => Unit[];
|
|
20
|
+
};
|
|
21
|
+
export type ViewRecord = Record<string, unknown>;
|
|
22
|
+
type ViewFilterLeaf = {
|
|
23
|
+
kind: string;
|
|
24
|
+
value: {
|
|
25
|
+
expression: Expression | null;
|
|
26
|
+
[k: string]: unknown;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
type ViewFilterGroup = {
|
|
30
|
+
kind: "group";
|
|
31
|
+
value: ViewFilter[];
|
|
32
|
+
};
|
|
33
|
+
export type ViewFilter = ViewFilterLeaf | ViewFilterGroup;
|
|
34
|
+
export declare const deleteExpressionWithNotFoundFieldsOrTypesInFilter: (schema: Schema, fromType: string, filter: ViewFilter) => ViewFilter | null;
|
|
35
|
+
export declare const deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression: (schema: Schema, queryExpression: Query) => Query | null;
|
|
36
|
+
export declare const replaceNamesWithIdsInExpression: (schema: Schema, fromType: string, expression: Expression) => any;
|
|
37
|
+
export declare const replaceIdsWithNamesInExpression: (schema: Schema, fromTypeId: string, expression: Expression) => any;
|
|
38
|
+
export declare const visitViewUnit: (fromType: string, unit: Unit, visitor: Pick<ViewVisitor, "visitExpression">) => Unit;
|
|
39
|
+
export declare const visitContextExpression: (fromType: string, contextExpression: Expression | null | undefined, visitor: Pick<ViewVisitor, "visitExpression" | "visitContextExpression">) => string | Expression[] | null | undefined;
|
|
40
|
+
export declare const replaceIdsWithNamesInQueryExpression: (schema: Schema, queryExpression: Query) => {
|
|
41
|
+
"q/order-by"?: any;
|
|
42
|
+
"q/where"?: any;
|
|
43
|
+
"q/from": string;
|
|
44
|
+
"q/select"?: Expression | import("@fibery/expression-utils/src/types").Select;
|
|
45
|
+
"q/offset"?: number;
|
|
46
|
+
"q/limit"?: import("@fibery/expression-utils/src/types").QueryLimit;
|
|
47
|
+
};
|
|
48
|
+
export declare const replaceIdsWithNamesInFilter: (schema: Schema, fromType: string, filter: ViewFilter | null) => ViewFilter | null;
|
|
49
|
+
export declare const replaceNamesWithIdsInFilter: (schema: Schema, fromType: string, filter: ViewFilter | null) => ViewFilter | null;
|
|
50
|
+
export declare const replaceNamesWithIdsInQueryExpression: (schema: Schema, queryExpression: Query) => {
|
|
51
|
+
"q/order-by"?: any;
|
|
52
|
+
"q/where"?: any;
|
|
53
|
+
"q/from": string;
|
|
54
|
+
"q/select"?: Expression | import("@fibery/expression-utils/src/types").Select;
|
|
55
|
+
"q/offset"?: number;
|
|
56
|
+
"q/limit"?: import("@fibery/expression-utils/src/types").QueryLimit;
|
|
57
|
+
};
|
|
58
|
+
export declare const deleteExpressionWithNotFoundFieldsOrTypesInExpression: (schema: Schema, fromType: string, expression: Expression) => any;
|
|
59
|
+
export declare const resetContextExpressionIfBroken: (schema: Schema, fromType: string, expression: Expression, defaultExpression: Expression) => any;
|
|
60
|
+
export declare const isUnitExpressionValid: (unit: Record<string, unknown>) => boolean;
|
|
61
|
+
export declare const getFieldObjectsById: (smartFolder: Record<string, unknown>, schema: Schema) => Record<string, FieldObject>;
|
|
62
|
+
export declare const replaceIdsWithNamesInUnitGroupKey: (unitGroupKey: string, fieldObjectsById: Record<string, FieldObject>) => string;
|
|
63
|
+
export declare const replaceNamesWithIdsInUnitGroupKey: (unitGroupKey: string, schema: Schema) => string;
|
|
64
|
+
export {};
|