@fibery/views 18.0.4 → 19.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/src/field-utils/reference-collection.d.ts +5 -10
- package/lib/src/field-utils/reference-collection.js +41 -19
- package/lib/src/field-utils/rich-text.d.ts +5 -4
- package/lib/src/field-utils/rich-text.js +22 -11
- package/lib/src/index.d.ts +28 -16
- package/lib/src/index.js +1 -1
- package/lib/src/private/board.d.ts +15 -11
- package/lib/src/private/board.js +8 -7
- package/lib/src/private/calendar.d.ts +14 -10
- package/lib/src/private/calendar.js +4 -3
- package/lib/src/private/feed.d.ts +14 -10
- package/lib/src/private/feed.js +4 -3
- package/lib/src/private/form.d.ts +25 -3
- package/lib/src/private/form.js +3 -3
- package/lib/src/private/map.d.ts +14 -10
- package/lib/src/private/map.js +4 -3
- package/lib/src/private/smart-folder.d.ts +23 -15
- package/lib/src/private/smart-folder.js +16 -13
- package/lib/src/private/timeline.d.ts +39 -10
- package/lib/src/private/timeline.js +8 -6
- package/lib/src/private/units.d.ts +10 -6
- package/lib/src/private/units.js +43 -22
- package/lib/src/private/utils.d.ts +64 -17
- package/lib/src/private/utils.js +26 -20
- package/lib/src/truthy.d.ts +1 -0
- package/lib/src/truthy.js +7 -0
- package/lib/src/unit-definitions/avatar-collection.js +24 -19
- package/lib/src/unit-definitions/avatar.js +23 -15
- package/lib/src/unit-definitions/collection-count.js +7 -7
- package/lib/src/unit-definitions/file-collection-count.js +9 -7
- package/lib/src/unit-definitions/file-compact-collection.js +9 -7
- package/lib/src/unit-definitions/file-compact-reference.js +5 -4
- package/lib/src/unit-definitions/file-reference.js +6 -4
- package/lib/src/unit-definitions/files-gallery.js +9 -7
- package/lib/src/unit-definitions/files-l-list-item.js +6 -4
- package/lib/src/unit-definitions/files-l-list.js +9 -7
- package/lib/src/unit-definitions/files-list-item.js +6 -4
- package/lib/src/unit-definitions/files-list.js +9 -7
- package/lib/src/unit-definitions/number.js +2 -4
- package/lib/src/unit-definitions/progress-bar.js +1 -4
- package/lib/src/unit-definitions/reference-collection.js +4 -3
- package/lib/src/unit-definitions/reference.js +17 -5
- package/lib/src/unit-definitions/rich-text-snippet.d.ts +1 -0
- package/lib/src/unit-definitions/rich-text-snippet.js +6 -11
- package/lib/src/unit-utils/decimal.js +10 -6
- package/lib/src/unit-utils/get-export-value.d.ts +1 -1
- package/lib/src/unit-utils/get-export-value.js +2 -1
- package/lib/src/unit-utils/get-field-label.js +2 -2
- package/lib/src/unit-utils/wrap-normalized-in-expression.d.ts +3 -0
- package/lib/src/unit-utils/wrap-normalized-in-expression.js +14 -0
- package/lib/src/units/board.d.ts +6 -3
- package/lib/src/units/canvas/index.d.ts +6 -3
- package/lib/src/units/default.d.ts +6 -3
- package/lib/src/units/gantt.d.ts +6 -3
- package/lib/src/units/grid.d.ts +6 -3
- package/lib/src/units/grid.js +4 -0
- package/lib/src/units/list.d.ts +6 -3
- package/lib/src/units/make-factory.d.ts +10 -9
- package/lib/src/units/make-factory.js +26 -10
- package/lib/src/units/types.d.ts +1 -1
- package/package.json +26 -26
- package/lib/jest.config.d.ts +0 -2
- package/lib/jest.config.js +0 -32
|
@@ -1,18 +1,13 @@
|
|
|
1
1
|
import { FieldObject } from "@fibery/schema";
|
|
2
2
|
import { QueryLimit } from "@fibery/expression-utils/src/types";
|
|
3
3
|
export declare const REFERENCE_COLLECTION_LIMIT = 1000;
|
|
4
|
-
export declare const makeCollectionCountExpression: (field: string) => (string | string[])[];
|
|
4
|
+
export declare const makeCollectionCountExpression: (field: string | string[]) => (string | string[])[];
|
|
5
5
|
export declare const getCountKey: (field: string) => string;
|
|
6
6
|
export declare const getCollectionCountSelect: (field: string) => {
|
|
7
7
|
[x: string]: (string | string[])[];
|
|
8
8
|
};
|
|
9
|
-
export declare const calculateReferenceCollectionQuery: ({
|
|
10
|
-
|
|
9
|
+
export declare const calculateReferenceCollectionQuery: ({ fieldObjects, expression, limit, }: {
|
|
10
|
+
fieldObjects: FieldObject[];
|
|
11
|
+
expression: string[];
|
|
11
12
|
limit: QueryLimit;
|
|
12
|
-
}) =>
|
|
13
|
-
[x: string]: {
|
|
14
|
-
"q/from": string[];
|
|
15
|
-
"q/select": any;
|
|
16
|
-
"q/limit": QueryLimit;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
13
|
+
}) => Record<string, unknown>;
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.calculateReferenceCollectionQuery = exports.getCollectionCountSelect = exports.getCountKey = exports.makeCollectionCountExpression = exports.REFERENCE_COLLECTION_LIMIT = void 0;
|
|
7
|
+
const last_1 = __importDefault(require("lodash/last"));
|
|
7
8
|
const compact_1 = __importDefault(require("lodash/compact"));
|
|
8
9
|
const select_1 = require("@fibery/query-utils/src/select");
|
|
9
10
|
const dynamic_keys_1 = require("../unit-utils/dynamic-keys");
|
|
@@ -13,7 +14,10 @@ const avatar_1 = require("./avatar");
|
|
|
13
14
|
const icon_1 = require("./icon");
|
|
14
15
|
const file_1 = require("./file");
|
|
15
16
|
exports.REFERENCE_COLLECTION_LIMIT = 1000;
|
|
16
|
-
const makeCollectionCountExpression = (field) => [
|
|
17
|
+
const makeCollectionCountExpression = (field) => [
|
|
18
|
+
"q/count",
|
|
19
|
+
[...(Array.isArray(field) ? field : [field]), "fibery/id"],
|
|
20
|
+
];
|
|
17
21
|
exports.makeCollectionCountExpression = makeCollectionCountExpression;
|
|
18
22
|
const getCountKey = (field) => (0, dynamic_keys_1.makeDynamicKey)(dynamic_keys_1.collectionCountKeyPrefix, field);
|
|
19
23
|
exports.getCountKey = getCountKey;
|
|
@@ -21,25 +25,43 @@ const getCollectionCountSelect = (field) => ({
|
|
|
21
25
|
[(0, exports.getCountKey)(field)]: (0, exports.makeCollectionCountExpression)(field),
|
|
22
26
|
});
|
|
23
27
|
exports.getCollectionCountSelect = getCollectionCountSelect;
|
|
24
|
-
const calculateReferenceCollectionQuery = ({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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 }),
|
|
28
|
+
const calculateReferenceCollectionQuery = ({ fieldObjects, expression, limit, }) => {
|
|
29
|
+
const fieldObject = (0, last_1.default)(fieldObjects);
|
|
30
|
+
if (!fieldObject) {
|
|
31
|
+
return {};
|
|
32
|
+
}
|
|
33
|
+
const collectionSubQuery = {
|
|
34
|
+
"q/from": expression,
|
|
35
|
+
"q/select": (0, select_1.mergeDenormalizedSelects)((0, compact_1.default)([
|
|
36
|
+
(0, select_1.toSelectMapClause)((0, compact_1.default)([
|
|
37
|
+
fieldObject.typeObject.idField,
|
|
38
|
+
fieldObject.typeObject.titleField,
|
|
39
|
+
// keep public id - required to build Links
|
|
40
|
+
fieldObject.typeObject.publicIdField,
|
|
40
41
|
])),
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
(0, access_1.generateAccessCheckQueryExpression)({ typeObject: fieldObject.typeObject }),
|
|
43
|
+
(0, avatar_1.getAvatarSelectQuery)({ typeObject: fieldObject.typeObject }),
|
|
44
|
+
(0, icon_1.getEntityIconSelect)({ typeObject: fieldObject.typeObject }),
|
|
45
|
+
fieldObject.type === "fibery/file" && (0, file_1.getFilesSelect)(fieldObject),
|
|
46
|
+
(0, enums_1.getEnumIconColorQuery)({ typeObject: fieldObject.typeObject }),
|
|
47
|
+
])),
|
|
48
|
+
"q/limit": limit,
|
|
43
49
|
};
|
|
50
|
+
// Wrap the collection query in intermediate reference fields (innermost to outermost).
|
|
51
|
+
// For each intermediate field, include its entity's id so normalizr can normalize it.
|
|
52
|
+
return [...expression].reverse().reduce((inner, field, reversedIndex) => {
|
|
53
|
+
const originalIndex = expression.length - 1 - reversedIndex;
|
|
54
|
+
const isTerminal = originalIndex === expression.length - 1;
|
|
55
|
+
if (!isTerminal) {
|
|
56
|
+
const pathToField = expression.slice(0, originalIndex + 1);
|
|
57
|
+
const { idField } = fieldObjects[originalIndex].typeObject;
|
|
58
|
+
// `inner` already has the next field keyed, so spread it rather than re-keying it.
|
|
59
|
+
const innerForField = idField
|
|
60
|
+
? { [idField]: [...pathToField, idField], ...inner }
|
|
61
|
+
: { ...inner };
|
|
62
|
+
return { [field]: innerForField };
|
|
63
|
+
}
|
|
64
|
+
return { [field]: inner };
|
|
65
|
+
}, collectionSubQuery);
|
|
44
66
|
};
|
|
45
67
|
exports.calculateReferenceCollectionQuery = calculateReferenceCollectionQuery;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TypeObject } from "@fibery/schema";
|
|
2
|
+
import type { FieldExpression } from "@fibery/expression-utils/src/types";
|
|
2
3
|
import { FieldUnit } from "../units/types";
|
|
3
4
|
export declare const hasAccessToSecretKey: string;
|
|
4
|
-
export declare const getHasAccessToSecretExpr: (
|
|
5
|
-
export declare const getHasAccessToSecret: (
|
|
6
|
-
[hasAccessToSecretKey]: (string | string[])[];
|
|
5
|
+
export declare const getHasAccessToSecretExpr: (expression: FieldExpression) => (string | (string | import("@fibery/expression-utils/src/types").MultiFieldAccess)[])[];
|
|
6
|
+
export declare const getHasAccessToSecret: (expression: FieldExpression) => {
|
|
7
|
+
[hasAccessToSecretKey]: (string | (string | import("@fibery/expression-utils/src/types").MultiFieldAccess)[])[];
|
|
7
8
|
};
|
|
8
9
|
export declare function getRichTextQuerySelect({ typeObject, unit: { expression }, includeSnippet, }: {
|
|
9
10
|
typeObject: TypeObject;
|
|
@@ -6,22 +6,33 @@ const select_1 = require("@fibery/query-utils/src/select");
|
|
|
6
6
|
const utils_1 = require("@fibery/expression-utils/src/utils");
|
|
7
7
|
const dynamic_keys_1 = require("../unit-utils/dynamic-keys");
|
|
8
8
|
exports.hasAccessToSecretKey = (0, dynamic_keys_1.makeDynamicKey)(dynamic_keys_1.hasAccessToSecretKeyPrefix);
|
|
9
|
-
const getHasAccessToSecretExpr = (
|
|
9
|
+
const getHasAccessToSecretExpr = (expression) => [
|
|
10
10
|
"q/access?",
|
|
11
|
-
[
|
|
11
|
+
[...expression, "Collaboration~Documents/secret"],
|
|
12
12
|
];
|
|
13
13
|
exports.getHasAccessToSecretExpr = getHasAccessToSecretExpr;
|
|
14
|
-
const getHasAccessToSecret = (
|
|
15
|
-
[exports.hasAccessToSecretKey]: (0, exports.getHasAccessToSecretExpr)(
|
|
14
|
+
const getHasAccessToSecret = (expression) => ({
|
|
15
|
+
[exports.hasAccessToSecretKey]: (0, exports.getHasAccessToSecretExpr)(expression),
|
|
16
16
|
});
|
|
17
17
|
exports.getHasAccessToSecret = getHasAccessToSecret;
|
|
18
18
|
function getRichTextQuerySelect({ typeObject, unit: { expression }, includeSnippet, }) {
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}),
|
|
19
|
+
const fieldObjects = (0, utils_1.getFieldObjectsByFieldExpression)({ typeObject, expression });
|
|
20
|
+
const terminalFieldObject = fieldObjects[fieldObjects.length - 1];
|
|
21
|
+
const { typeObject: terminalTypeObject } = terminalFieldObject;
|
|
22
|
+
const innerNormalized = (0, select_1.normalizeSelect)({
|
|
23
|
+
...(0, exports.getHasAccessToSecret)(expression),
|
|
24
|
+
...(0, select_1.toSelectMapClause)([terminalTypeObject.idField, "Collaboration~Documents/secret"]),
|
|
25
|
+
...(includeSnippet ? (0, select_1.toSelectMapClause)([terminalTypeObject.idField, "Collaboration~Documents/Snippet"]) : {}),
|
|
26
26
|
});
|
|
27
|
+
const nested = [...expression].reverse().reduce((inner, field, reversedIndex) => {
|
|
28
|
+
const originalIndex = expression.length - 1 - reversedIndex;
|
|
29
|
+
const isTerminal = originalIndex === expression.length - 1;
|
|
30
|
+
if (!isTerminal) {
|
|
31
|
+
const { idField } = fieldObjects[originalIndex].typeObject;
|
|
32
|
+
const innerWithId = idField ? { [idField]: idField, ...inner } : inner;
|
|
33
|
+
return { [field]: innerWithId };
|
|
34
|
+
}
|
|
35
|
+
return { [field]: inner };
|
|
36
|
+
}, innerNormalized);
|
|
37
|
+
return (0, select_1.denormalizeSelect)(nested);
|
|
27
38
|
}
|
package/lib/src/index.d.ts
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export
|
|
16
|
-
export
|
|
1
|
+
import type { Expression } from "@fibery/expression-utils/src/types";
|
|
2
|
+
import type { FieldObject, Schema } from "@fibery/schema";
|
|
3
|
+
import type { UnitDefinitions, ViewRecord } from "./private/utils";
|
|
4
|
+
import type { Unit } from "./units/types";
|
|
5
|
+
export { deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder, replaceIdsWithNamesInSmartFolder, replaceNamesWithIdsInSmartFolder, } from "./private/smart-folder";
|
|
6
|
+
export declare const deleteExpressionWithNotFoundFieldsOrTypesInView: (schema: Schema, view: ViewRecord, ensureAxisInvariant?: boolean) => any;
|
|
7
|
+
export declare const fixUserSelectedUnits: (schema: Schema, view: ViewRecord, { unitDefinitions, getDefaultUnitTypeForField, }: {
|
|
8
|
+
unitDefinitions: UnitDefinitions;
|
|
9
|
+
getDefaultUnitTypeForField: (fieldObject: FieldObject, allowedUnits: Unit[]) => string | undefined;
|
|
10
|
+
}) => any;
|
|
11
|
+
export declare const fixContextExpressionWithBrokenPath: (schema: Schema, view: ViewRecord, defaultContextExpression: Expression) => any;
|
|
12
|
+
/**
|
|
13
|
+
* Removes garbage from view's meta to reduce the size.
|
|
14
|
+
*/
|
|
15
|
+
export declare const collectGarbage: (schema: Schema, view: ViewRecord) => unknown;
|
|
16
|
+
export declare const replaceNamesWithIdsInView: (schema: Schema, view: ViewRecord) => any;
|
|
17
|
+
export declare const replaceIdsWithNamesInView: (schema: Schema, view: ViewRecord) => any;
|
|
18
|
+
type ViewMeta = {
|
|
19
|
+
items: {
|
|
20
|
+
query: {
|
|
21
|
+
"q/from": string;
|
|
22
|
+
};
|
|
23
|
+
}[];
|
|
24
|
+
};
|
|
25
|
+
export declare const getViewCardTypes: ({ "fibery/meta": { items } }: {
|
|
26
|
+
"fibery/meta": ViewMeta;
|
|
27
|
+
}) => string[];
|
|
28
|
+
export declare const migrateHideWhenEmptyToUnitsLevel: (view: ViewRecord) => any;
|
package/lib/src/index.js
CHANGED
|
@@ -80,7 +80,7 @@ const deleteExpressionWithNotFoundFieldsOrTypesInView = (schema, view, ensureAxi
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
exports.deleteExpressionWithNotFoundFieldsOrTypesInView = deleteExpressionWithNotFoundFieldsOrTypesInView;
|
|
83
|
-
const fixUserSelectedUnits = (schema, view, { unitDefinitions, getDefaultUnitTypeForField }) => {
|
|
83
|
+
const fixUserSelectedUnits = (schema, view, { unitDefinitions, getDefaultUnitTypeForField, }) => {
|
|
84
84
|
switch (view["fibery/type"]) {
|
|
85
85
|
case "board":
|
|
86
86
|
case "gallery":
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import type { Expression } from "@fibery/expression-utils/src/types";
|
|
2
|
+
import type { FieldObject, Schema } from "@fibery/schema";
|
|
3
|
+
import type { UnitDefinitions, ViewRecord } from "./utils";
|
|
4
|
+
import { Unit } from "@fibery/views/src/units/types";
|
|
5
|
+
export declare const replaceIdsWithNamesInBoardView: (schema: Schema, view: ViewRecord) => any;
|
|
6
|
+
export declare const replaceNamesWithIdsInBoardView: (schema: Schema, view: ViewRecord) => any;
|
|
7
|
+
export declare const deleteExpressionWithNotFoundOrInvalidFieldsOrTypesInBoardView: (schema: Schema, view: ViewRecord, ensureAxisInvariant?: boolean) => any;
|
|
8
|
+
export declare const fixUserSelectedUnitsInBoardView: (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 enableHideWhenEmptyForCovers: (view: ViewRecord) => any;
|
|
15
|
+
export declare const enableHideWhenEmptyForCheckedEditableUnits: (view: ViewRecord) => any;
|
package/lib/src/private/board.js
CHANGED
|
@@ -11,6 +11,7 @@ const get_1 = __importDefault(require("lodash/get"));
|
|
|
11
11
|
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
12
12
|
const set_1 = __importDefault(require("lodash/set"));
|
|
13
13
|
const some_1 = __importDefault(require("lodash/some"));
|
|
14
|
+
const truthy_1 = require("../truthy");
|
|
14
15
|
const units_1 = require("./units");
|
|
15
16
|
const utils_2 = require("./utils");
|
|
16
17
|
const visitQueryExpressionHolder = (queryHolder, visitor) => {
|
|
@@ -49,11 +50,11 @@ const visitAxisUnits = (axis, fromType, visitor) => {
|
|
|
49
50
|
units: {
|
|
50
51
|
$apply: (units) => units
|
|
51
52
|
? units
|
|
52
|
-
.filter(
|
|
53
|
+
.filter(truthy_1.truthy)
|
|
53
54
|
.map((unit) => (0, utils_2.visitViewUnit)(fromType, unit, visitor))
|
|
54
|
-
.filter(
|
|
55
|
+
.filter(utils_2.isUnitExpressionValid)
|
|
55
56
|
.map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit)
|
|
56
|
-
.filter(
|
|
57
|
+
.filter(utils_2.skipRemove)
|
|
57
58
|
: undefined,
|
|
58
59
|
},
|
|
59
60
|
})
|
|
@@ -161,9 +162,9 @@ const visitView = (view, visitor) => (0, immutability_helper_1.default)(view, {
|
|
|
161
162
|
units: {
|
|
162
163
|
$apply: (units) => units
|
|
163
164
|
? units
|
|
164
|
-
.filter(
|
|
165
|
+
.filter(truthy_1.truthy)
|
|
165
166
|
.map((unit) => (0, utils_2.visitViewUnit)(fromType, unit, visitor))
|
|
166
|
-
.filter(
|
|
167
|
+
.filter(utils_2.isUnitExpressionValid)
|
|
167
168
|
.map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit)
|
|
168
169
|
.filter((unit) => unit !== utils_2.REMOVE)
|
|
169
170
|
: undefined,
|
|
@@ -255,7 +256,7 @@ const deleteExpressionWithNotFoundFieldsOrTypesViewVisitor = (schema) => {
|
|
|
255
256
|
};
|
|
256
257
|
return visitor;
|
|
257
258
|
};
|
|
258
|
-
const fixUserSelectedUnitsViewVisitor = (schema, { unitDefinitions, getDefaultUnitTypeForField }) => {
|
|
259
|
+
const fixUserSelectedUnitsViewVisitor = (schema, { unitDefinitions, getDefaultUnitTypeForField, }) => {
|
|
259
260
|
return {
|
|
260
261
|
visitQueryExpression: (queryExpression) => queryExpression,
|
|
261
262
|
visitFilter: (_fromType, filter) => filter,
|
|
@@ -273,7 +274,7 @@ const deleteExpressionWithNotFoundOrInvalidFieldsOrTypesInBoardView = (schema, v
|
|
|
273
274
|
return ensureAxisInvariant ? ensureAxisAndItemExpressionInvariant(viewNew) : viewNew;
|
|
274
275
|
};
|
|
275
276
|
exports.deleteExpressionWithNotFoundOrInvalidFieldsOrTypesInBoardView = deleteExpressionWithNotFoundOrInvalidFieldsOrTypesInBoardView;
|
|
276
|
-
const fixUserSelectedUnitsInBoardView = (schema, view, { unitDefinitions, getDefaultUnitTypeForField }) => {
|
|
277
|
+
const fixUserSelectedUnitsInBoardView = (schema, view, { unitDefinitions, getDefaultUnitTypeForField, }) => {
|
|
277
278
|
return visitView(view, fixUserSelectedUnitsViewVisitor(schema, { unitDefinitions, getDefaultUnitTypeForField }));
|
|
278
279
|
};
|
|
279
280
|
exports.fixUserSelectedUnitsInBoardView = fixUserSelectedUnitsInBoardView;
|
|
@@ -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 { UnitDefinitions, ViewRecord } from "./utils";
|
|
4
|
+
import { Unit } from "@fibery/views/src/units/types";
|
|
5
|
+
export declare const replaceNamesWithIdsInCalendarView: (schema: Schema, view: ViewRecord) => any;
|
|
6
|
+
export declare const replaceIdsWithNamesInCalendarView: (schema: Schema, view: ViewRecord) => any;
|
|
7
|
+
export declare const deleteExpressionWithNotFoundFieldsOrTypesInCalendarView: (schema: Schema, view: ViewRecord) => any;
|
|
8
|
+
export declare const fixUserSelectedUnitsInCalendarView: (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;
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.enableHideWhenEmptyForCheckedUnits = exports.collectGarbage = exports.fixContextExpressionWithBrokenPath = exports.fixUserSelectedUnitsInCalendarView = exports.deleteExpressionWithNotFoundFieldsOrTypesInCalendarView = exports.replaceIdsWithNamesInCalendarView = exports.replaceNamesWithIdsInCalendarView = 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, {
|
|
@@ -34,9 +35,9 @@ const visitView = (view, visitor) => (0, immutability_helper_1.default)(view, {
|
|
|
34
35
|
units: {
|
|
35
36
|
$apply: (units) => units
|
|
36
37
|
? units
|
|
37
|
-
.filter(
|
|
38
|
+
.filter(truthy_1.truthy)
|
|
38
39
|
.map((unit) => (0, utils_1.visitViewUnit)(fromType, unit, visitor))
|
|
39
|
-
.filter(
|
|
40
|
+
.filter(utils_1.isUnitExpressionValid)
|
|
40
41
|
.map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit)
|
|
41
42
|
.filter((unit) => unit !== utils_1.REMOVE)
|
|
42
43
|
: undefined,
|
|
@@ -84,7 +85,7 @@ const deleteExpressionWithNotFoundFieldsOrTypesInCalendarView = (schema, view) =
|
|
|
84
85
|
visitExpression: (fromType, expression) => (0, utils_1.deleteExpressionWithNotFoundFieldsOrTypesInExpression)(schema, fromType, expression),
|
|
85
86
|
});
|
|
86
87
|
exports.deleteExpressionWithNotFoundFieldsOrTypesInCalendarView = deleteExpressionWithNotFoundFieldsOrTypesInCalendarView;
|
|
87
|
-
const fixUserSelectedUnitsInCalendarView = (schema, view, { unitDefinitions, getDefaultUnitTypeForField }) => {
|
|
88
|
+
const fixUserSelectedUnitsInCalendarView = (schema, view, { unitDefinitions, getDefaultUnitTypeForField, }) => {
|
|
88
89
|
return visitView(view, {
|
|
89
90
|
visitExpression: (_fromType, expression) => expression,
|
|
90
91
|
visitFilter: (_fromType, filter) => filter,
|
|
@@ -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 { UnitDefinitions, ViewRecord } from "./utils";
|
|
4
|
+
import { Unit } from "@fibery/views/src/units/types";
|
|
5
|
+
export declare const replaceNamesWithIdsInFeedView: (schema: Schema, view: ViewRecord) => any;
|
|
6
|
+
export declare const replaceIdsWithNamesInFeedView: (schema: Schema, view: ViewRecord) => any;
|
|
7
|
+
export declare const deleteExpressionWithNotFoundFieldsOrTypesInFeedView: (schema: Schema, view: ViewRecord) => any;
|
|
8
|
+
export declare const fixUserSelectedUnitsInFeedView: (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/feed.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.enableHideWhenEmptyForCheckedUnits = exports.collectGarbage = exports.fixContextExpressionWithBrokenPath = exports.fixUserSelectedUnitsInFeedView = exports.deleteExpressionWithNotFoundFieldsOrTypesInFeedView = exports.replaceIdsWithNamesInFeedView = exports.replaceNamesWithIdsInFeedView = 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 deleteExpressionWithNotFoundFieldsOrTypesInFeedView = (schema, view) => vi
|
|
|
81
82
|
visitExpression: (fromType, expression) => (0, utils_1.deleteExpressionWithNotFoundFieldsOrTypesInExpression)(schema, fromType, expression),
|
|
82
83
|
});
|
|
83
84
|
exports.deleteExpressionWithNotFoundFieldsOrTypesInFeedView = deleteExpressionWithNotFoundFieldsOrTypesInFeedView;
|
|
84
|
-
const fixUserSelectedUnitsInFeedView = (schema, view, { unitDefinitions, getDefaultUnitTypeForField }) => {
|
|
85
|
+
const fixUserSelectedUnitsInFeedView = (schema, view, { unitDefinitions, getDefaultUnitTypeForField, }) => {
|
|
85
86
|
return visitView(view, {
|
|
86
87
|
visitExpression: (_fromType, expression) => expression,
|
|
87
88
|
visitFilter: (_fromType, filter) => filter,
|
|
@@ -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 { UnitDefinitions, ViewRecord } from "./utils";
|
|
4
|
+
import { Unit } from "@fibery/views/src/units/types";
|
|
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 { UnitDefinitions, ViewRecord } from "./utils";
|
|
4
|
+
import { Unit } from "@fibery/views/src/units/types";
|
|
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 {};
|