@fibery/views 18.0.1 → 18.0.3
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/jest.config.d.ts +2 -0
- package/lib/jest.config.js +32 -0
- package/lib/src/field-utils/reference.d.ts +3 -3
- package/lib/src/field-utils/reference.js +3 -1
- package/lib/src/field-utils/user-active.d.ts +2 -2
- package/lib/src/field-utils/workflow.d.ts +3 -3
- package/lib/src/private/units.d.ts +2 -1
- package/lib/src/private/units.js +8 -5
- package/lib/src/unit-utils/access.d.ts +3 -3
- package/lib/src/unit-utils/common.d.ts +3 -4
- package/lib/src/unit-utils/enums.d.ts +2 -32
- package/lib/src/units/board.d.ts +2 -2
- package/lib/src/units/canvas/index.d.ts +2 -2
- 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 +2 -2
- package/lib/src/units/gantt.d.ts +2 -2
- package/lib/src/units/grid.d.ts +2 -2
- package/lib/src/units/grid.js +2 -0
- package/lib/src/units/list.d.ts +2 -2
- package/lib/src/units/make-factory.d.ts +2 -2
- package/lib/src/units/types.d.ts +4 -4
- package/package.json +10 -50
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** @type {import('jest').Config} */
|
|
3
|
+
module.exports = {
|
|
4
|
+
testEnvironment: "node",
|
|
5
|
+
coveragePathIgnorePatterns: ["/node_modules/"],
|
|
6
|
+
collectCoverageFrom: ["src/**/*.{js,jsx,ts,tsx}", "!src/**/*.d.ts"],
|
|
7
|
+
coverageReporters: ["text", "cobertura"],
|
|
8
|
+
testPathIgnorePatterns: ["<rootDir>[/\\\\](build|docs|node_modules|scripts)[/\\\\]"],
|
|
9
|
+
transform: {
|
|
10
|
+
"^.+\\.(js|jsx|ts|tsx)$": [
|
|
11
|
+
"@swc/jest",
|
|
12
|
+
{
|
|
13
|
+
jsc: {
|
|
14
|
+
parser: {
|
|
15
|
+
syntax: "typescript",
|
|
16
|
+
tsx: true,
|
|
17
|
+
decorators: true,
|
|
18
|
+
dynamicImport: true,
|
|
19
|
+
},
|
|
20
|
+
transform: {
|
|
21
|
+
react: {
|
|
22
|
+
runtime: "automatic",
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
testEnvironmentOptions: {
|
|
30
|
+
url: "http://localhost",
|
|
31
|
+
},
|
|
32
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FieldObject, TypeObject } from "@fibery/schema";
|
|
2
|
-
import {
|
|
2
|
+
import { FieldExpression } from "@fibery/expression-utils";
|
|
3
3
|
import type { Select } from "@fibery/expression-utils/src/types";
|
|
4
4
|
export declare const getReferenceTypeSelectClause: ({ typeObject }: {
|
|
5
5
|
typeObject: TypeObject;
|
|
6
|
-
}, contextPath:
|
|
7
|
-
export declare const getReferenceFieldNormalizedSelectClause: (fieldObject: FieldObject, contextPath:
|
|
6
|
+
}, contextPath: FieldExpression) => Select;
|
|
7
|
+
export declare const getReferenceFieldNormalizedSelectClause: (fieldObject: FieldObject, contextPath: FieldExpression) => any;
|
|
@@ -42,7 +42,9 @@ const getReferenceFieldNormalizedSelectClause = (fieldObject, contextPath) => {
|
|
|
42
42
|
const { typeObject } = fieldObject;
|
|
43
43
|
if (typeObject.isEntityRef) {
|
|
44
44
|
const pairs = fieldObject.multiRelatedFieldObjects.map((f) => {
|
|
45
|
-
const select = (0, exports.getReferenceTypeSelectClause)({ typeObject: f.holderTypeObject }, [
|
|
45
|
+
const select = (0, exports.getReferenceTypeSelectClause)({ typeObject: f.holderTypeObject }, [
|
|
46
|
+
contextPath.concat(f.holderType),
|
|
47
|
+
]);
|
|
46
48
|
const normalizedSelect = (0, select_1.normalizeSelect)(select);
|
|
47
49
|
return [f.holderType, { ...normalizedSelect, [select_1.isSelectForMultiFieldKey]: true }];
|
|
48
50
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { TypeObject } from "@fibery/schema";
|
|
2
|
-
import {
|
|
2
|
+
import { FieldExpression } from "@fibery/expression-utils";
|
|
3
3
|
export declare const getIsUserActiveSelect: ({ typeObject, contextPath, }: {
|
|
4
4
|
typeObject: TypeObject;
|
|
5
|
-
contextPath?:
|
|
5
|
+
contextPath?: FieldExpression;
|
|
6
6
|
}) => {
|
|
7
7
|
[x: string]: (string | any[])[];
|
|
8
8
|
} | null;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { TypeObject } from "@fibery/schema";
|
|
2
|
-
import {
|
|
2
|
+
import { FieldExpression } from "@fibery/expression-utils";
|
|
3
3
|
export declare function isWorkflowType(typeObject: TypeObject): boolean;
|
|
4
4
|
export declare const getWorkflowFieldObject: (typeObject: TypeObject) => import("@fibery/schema").FieldObject | undefined;
|
|
5
5
|
export declare const getIsFinalStateSelect: ({ typeObject, contextPath, }: {
|
|
6
6
|
typeObject: TypeObject;
|
|
7
|
-
contextPath?:
|
|
7
|
+
contextPath?: FieldExpression;
|
|
8
8
|
}) => {
|
|
9
|
-
[x: string]: (string | (string | (
|
|
9
|
+
[x: string]: (string | (string | import("@fibery/expression-utils").MultiFieldAccess)[])[];
|
|
10
10
|
} | null;
|
|
11
11
|
export declare function getWorkflowTypeSelect(typeObject: TypeObject): {
|
|
12
12
|
"workflow/Type": string[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export function fixViewUnit(schema: any, fromType: any, unit: any, units: any, { unitDefinitions, getDefaultUnitTypeForField }: {
|
|
1
|
+
export function fixViewUnit(schema: any, fromType: any, unit: any, units: any, { unitDefinitions, getDefaultUnitTypeForField, migrateFileCollectionUnit }: {
|
|
2
2
|
unitDefinitions: any;
|
|
3
3
|
getDefaultUnitTypeForField: any;
|
|
4
|
+
migrateFileCollectionUnit?: boolean | undefined;
|
|
4
5
|
}): any;
|
|
5
6
|
export function enableHideWhenEmptyForCheckedEditableUnit(unit: any): any;
|
package/lib/src/private/units.js
CHANGED
|
@@ -29,7 +29,10 @@ const getUnitKind = (unit) => {
|
|
|
29
29
|
}
|
|
30
30
|
return "field";
|
|
31
31
|
};
|
|
32
|
-
const
|
|
32
|
+
const migrateUnitOptsDefault = {
|
|
33
|
+
migrateFileCollectionUnit: true,
|
|
34
|
+
};
|
|
35
|
+
const migrateUnit = (schema, fromType, unit, units, opts = migrateUnitOptsDefault) => {
|
|
33
36
|
const { type, expression } = unit;
|
|
34
37
|
const kind = unit.kind || getUnitKind(unit);
|
|
35
38
|
if (type === "date-time") {
|
|
@@ -73,7 +76,7 @@ const migrateUnit = (schema, fromType, unit, units) => {
|
|
|
73
76
|
return {
|
|
74
77
|
...unit,
|
|
75
78
|
kind,
|
|
76
|
-
type: "file-collection-count",
|
|
79
|
+
type: opts.migrateFileCollectionUnit ? "file-collection-count" : "collection-count",
|
|
77
80
|
};
|
|
78
81
|
}
|
|
79
82
|
}
|
|
@@ -88,7 +91,7 @@ const migrateUnit = (schema, fromType, unit, units) => {
|
|
|
88
91
|
};
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
|
-
if (type === "collection-count") {
|
|
94
|
+
if (opts.migrateFileCollectionUnit && type === "collection-count") {
|
|
92
95
|
const [field] = expression;
|
|
93
96
|
const fieldObject = getField(schema, fromType, field);
|
|
94
97
|
if (fieldObject?.type === "fibery/file" && fieldObject?.isCollection) {
|
|
@@ -101,8 +104,8 @@ const migrateUnit = (schema, fromType, unit, units) => {
|
|
|
101
104
|
}
|
|
102
105
|
return { ...unit, kind };
|
|
103
106
|
};
|
|
104
|
-
const fixViewUnit = (schema, fromType, unit, units, { unitDefinitions, getDefaultUnitTypeForField }) => {
|
|
105
|
-
const migrated = migrateUnit(schema, fromType, unit, units);
|
|
107
|
+
const fixViewUnit = (schema, fromType, unit, units, { unitDefinitions, getDefaultUnitTypeForField, migrateFileCollectionUnit = true }) => {
|
|
108
|
+
const migrated = migrateUnit(schema, fromType, unit, units, { migrateFileCollectionUnit });
|
|
106
109
|
const field = unit.expression?.[0];
|
|
107
110
|
const fieldObject = getField(schema, fromType, field);
|
|
108
111
|
if (fieldObject) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TypeObject } from "@fibery/schema";
|
|
2
|
-
import {
|
|
2
|
+
import { FieldExpression } from "@fibery/expression-utils";
|
|
3
3
|
export declare const accessCheckKey: string;
|
|
4
4
|
export declare const generateAccessCheckQueryExpression: ({ typeObject, contextPath, }: {
|
|
5
5
|
typeObject: TypeObject;
|
|
6
|
-
contextPath?:
|
|
6
|
+
contextPath?: FieldExpression;
|
|
7
7
|
}) => {
|
|
8
|
-
[accessCheckKey]: (string | (string | (
|
|
8
|
+
[accessCheckKey]: (string | (string | import("@fibery/expression-utils").MultiFieldAccess)[])[];
|
|
9
9
|
};
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { TypeObject } from "@fibery/schema";
|
|
2
|
-
import {
|
|
3
|
-
import { FieldUnit, PureUnit, Unit } from "../units/types";
|
|
2
|
+
import { FieldUnit, PureUnit, Unit, UnitExpression } from "../units/types";
|
|
4
3
|
import { $TSFixMe } from "../tsfixme";
|
|
5
4
|
export declare const makeUnitMethod: (type: FieldUnit["type"]) => ({ expression }?: {
|
|
6
|
-
expression?:
|
|
5
|
+
expression?: UnitExpression;
|
|
7
6
|
}) => FieldUnit;
|
|
8
7
|
export declare const calculateUnitExpressionErrors: ({ typeObject, unit }: {
|
|
9
8
|
typeObject: TypeObject;
|
|
@@ -12,4 +11,4 @@ export declare const calculateUnitExpressionErrors: ({ typeObject, unit }: {
|
|
|
12
11
|
export declare const isUnitEnabled: (unit: Unit) => boolean;
|
|
13
12
|
export declare const toPureUnit: (unit: Unit) => PureUnit;
|
|
14
13
|
export declare const asString: (something: $TSFixMe) => string;
|
|
15
|
-
export declare const canEditFieldExpression: (typeObject: TypeObject, expression:
|
|
14
|
+
export declare const canEditFieldExpression: (typeObject: TypeObject, expression: UnitExpression) => boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { TypeObject } from "@fibery/schema";
|
|
2
|
-
import {
|
|
2
|
+
import { FieldExpression } from "@fibery/expression-utils";
|
|
3
3
|
import type { Select } from "@fibery/expression-utils/src/types";
|
|
4
4
|
export declare const getEnumIconColorQuery: ({ typeObject, contextPath, }: {
|
|
5
5
|
typeObject: TypeObject;
|
|
6
|
-
contextPath?:
|
|
6
|
+
contextPath?: FieldExpression;
|
|
7
7
|
}) => Select;
|
|
8
8
|
export declare function getEnumIconSelect(typeObject: TypeObject): {
|
|
9
9
|
"enum/icon": string[];
|
|
@@ -19,36 +19,6 @@ export declare const getEnumsRequest: (enumTypeObject: TypeObject) => {
|
|
|
19
19
|
"fibery/id": string;
|
|
20
20
|
"enum/name": string;
|
|
21
21
|
"fibery/rank": string;
|
|
22
|
-
} | {
|
|
23
|
-
"workflow/Final"?: string | undefined;
|
|
24
|
-
"workflow/Type"?: string | undefined;
|
|
25
|
-
"fibery/id": string;
|
|
26
|
-
"enum/name": string;
|
|
27
|
-
"fibery/rank": string;
|
|
28
|
-
} | {
|
|
29
|
-
"workflow/Final"?: string | undefined;
|
|
30
|
-
"workflow/Type"?: string | undefined;
|
|
31
|
-
"fibery/id": string;
|
|
32
|
-
"enum/name": string;
|
|
33
|
-
"fibery/rank": string;
|
|
34
|
-
} | {
|
|
35
|
-
"workflow/Final"?: string | undefined;
|
|
36
|
-
"workflow/Type"?: string | undefined;
|
|
37
|
-
"fibery/id": string;
|
|
38
|
-
"enum/name": string;
|
|
39
|
-
"fibery/rank": string;
|
|
40
|
-
} | {
|
|
41
|
-
"workflow/Final"?: string | undefined;
|
|
42
|
-
"workflow/Type"?: string | undefined;
|
|
43
|
-
"fibery/id": string;
|
|
44
|
-
"enum/name": string;
|
|
45
|
-
"fibery/rank": string;
|
|
46
|
-
} | {
|
|
47
|
-
"workflow/Final"?: string | undefined;
|
|
48
|
-
"workflow/Type"?: string | undefined;
|
|
49
|
-
"fibery/id": string;
|
|
50
|
-
"enum/name": string;
|
|
51
|
-
"fibery/rank": string;
|
|
52
22
|
};
|
|
53
23
|
"q/limit": string;
|
|
54
24
|
"q/order-by": (string | string[])[][];
|
package/lib/src/units/board.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export declare const getTypeUnits: () => import("./types").PureUnit[], getUnitNa
|
|
|
15
15
|
fieldObject: import("@fibery/schema").FieldObject;
|
|
16
16
|
units: import("./types").Unit[];
|
|
17
17
|
}[], getUnitLabel: (fieldObject: import("@fibery/schema").FieldObject, unit: import("./types").Unit) => string, getHardcodedUnitsForView: (typeObject: TypeObject) => ({
|
|
18
|
-
expression: import("
|
|
18
|
+
expression: import("./types").UnitExpression;
|
|
19
19
|
type: "avatar" | "avatar-collection" | "avatar-input" | "back-references-list" | "bool" | "bool-checkbox" | "collection-count" | "color-input" | "comments-list" | "date" | "date-time" | "date-time-combobox" | "date-range" | "date-range-combobox" | "email" | "email-input" | "emoji" | "field" | "files-gallery" | "files-list" | "files-list-item" | "files-l-list" | "files-l-list-item" | "file-reference" | "file-compact-collection" | "file-compact-reference" | "file-collection-count" | "geometry-preview" | "icon-button" | "icon-input" | "id" | "json-input" | "location" | "location-input" | "number" | "number-input" | "phone" | "phone-input" | "progress-bar" | "reference" | "reference-icon" | "reference-combobox" | "reference-collection" | "reference-collection-list" | "reference-collection-view" | "reference-collection-combobox" | "rich-text-snippet" | "rich-text-document" | "single-location-preview" | "text" | "text-input" | "title" | "title-input" | "url" | "url-input" | "user-role" | "user-role-input";
|
|
20
20
|
kind: "field";
|
|
21
21
|
settings?: Record<string, unknown> | undefined;
|
|
@@ -31,7 +31,7 @@ export declare const getTypeUnits: () => import("./types").PureUnit[], getUnitNa
|
|
|
31
31
|
label: string;
|
|
32
32
|
icon?: string | undefined;
|
|
33
33
|
} | {
|
|
34
|
-
expression?: import("
|
|
34
|
+
expression?: import("./types").UnitExpression | undefined;
|
|
35
35
|
type: "type-icon" | "type-badge" | "type-badge-abbr";
|
|
36
36
|
kind: "db";
|
|
37
37
|
hideWhenEmpty?: boolean | undefined;
|
|
@@ -18,7 +18,7 @@ export declare const getTypeUnits: () => import("../types").PureUnit[], getUnitN
|
|
|
18
18
|
typeObject: import("@fibery/schema").TypeObject;
|
|
19
19
|
units: import("../types").Unit[];
|
|
20
20
|
}) => any, getHardcodedUnitsForView: (typeObject: import("@fibery/schema").TypeObject) => ({
|
|
21
|
-
expression: import("
|
|
21
|
+
expression: import("../types").UnitExpression;
|
|
22
22
|
type: "avatar" | "avatar-collection" | "avatar-input" | "back-references-list" | "bool" | "bool-checkbox" | "collection-count" | "color-input" | "comments-list" | "date" | "date-time" | "date-time-combobox" | "date-range" | "date-range-combobox" | "email" | "email-input" | "emoji" | "field" | "files-gallery" | "files-list" | "files-list-item" | "files-l-list" | "files-l-list-item" | "file-reference" | "file-compact-collection" | "file-compact-reference" | "file-collection-count" | "geometry-preview" | "icon-button" | "icon-input" | "id" | "json-input" | "location" | "location-input" | "number" | "number-input" | "phone" | "phone-input" | "progress-bar" | "reference" | "reference-icon" | "reference-combobox" | "reference-collection" | "reference-collection-list" | "reference-collection-view" | "reference-collection-combobox" | "rich-text-snippet" | "rich-text-document" | "single-location-preview" | "text" | "text-input" | "title" | "title-input" | "url" | "url-input" | "user-role" | "user-role-input";
|
|
23
23
|
kind: "field";
|
|
24
24
|
settings?: Record<string, unknown> | undefined;
|
|
@@ -34,7 +34,7 @@ export declare const getTypeUnits: () => import("../types").PureUnit[], getUnitN
|
|
|
34
34
|
label: string;
|
|
35
35
|
icon?: string | undefined;
|
|
36
36
|
} | {
|
|
37
|
-
expression?: import("
|
|
37
|
+
expression?: import("../types").UnitExpression | undefined;
|
|
38
38
|
type: "type-icon" | "type-badge" | "type-badge-abbr";
|
|
39
39
|
kind: "db";
|
|
40
40
|
hideWhenEmpty?: boolean | undefined;
|
|
@@ -10,7 +10,7 @@ export declare const TypeBadgeAbbr: {
|
|
|
10
10
|
unit: import("../types").DbUnit;
|
|
11
11
|
}) => boolean;
|
|
12
12
|
makeUnit: (params?: {
|
|
13
|
-
expression:
|
|
13
|
+
expression: import("../types").UnitExpression;
|
|
14
14
|
}) => import("../types").PureUnit;
|
|
15
15
|
getLabel: (params: {
|
|
16
16
|
typeObject: TypeObject;
|
|
@@ -10,7 +10,7 @@ export declare const TypeBadge: {
|
|
|
10
10
|
unit: import("../types").DbUnit;
|
|
11
11
|
}) => boolean;
|
|
12
12
|
makeUnit: (params?: {
|
|
13
|
-
expression:
|
|
13
|
+
expression: import("../types").UnitExpression;
|
|
14
14
|
}) => import("../types").PureUnit;
|
|
15
15
|
getLabel: (params: {
|
|
16
16
|
typeObject: TypeObject;
|
|
@@ -19,7 +19,7 @@ export declare const getTypeUnits: () => import("./types").PureUnit[], getUnitNa
|
|
|
19
19
|
typeObject: TypeObject;
|
|
20
20
|
units: import("./types").Unit[];
|
|
21
21
|
}) => any, getUnitLabel: (fieldObject: import("@fibery/schema").FieldObject, unit: import("./types").Unit) => string, getHardcodedUnitsForView: (typeObject: TypeObject) => ({
|
|
22
|
-
expression: import("
|
|
22
|
+
expression: import("./types").UnitExpression;
|
|
23
23
|
type: "avatar" | "avatar-collection" | "avatar-input" | "back-references-list" | "bool" | "bool-checkbox" | "collection-count" | "color-input" | "comments-list" | "date" | "date-time" | "date-time-combobox" | "date-range" | "date-range-combobox" | "email" | "email-input" | "emoji" | "field" | "files-gallery" | "files-list" | "files-list-item" | "files-l-list" | "files-l-list-item" | "file-reference" | "file-compact-collection" | "file-compact-reference" | "file-collection-count" | "geometry-preview" | "icon-button" | "icon-input" | "id" | "json-input" | "location" | "location-input" | "number" | "number-input" | "phone" | "phone-input" | "progress-bar" | "reference" | "reference-icon" | "reference-combobox" | "reference-collection" | "reference-collection-list" | "reference-collection-view" | "reference-collection-combobox" | "rich-text-snippet" | "rich-text-document" | "single-location-preview" | "text" | "text-input" | "title" | "title-input" | "url" | "url-input" | "user-role" | "user-role-input";
|
|
24
24
|
kind: "field";
|
|
25
25
|
settings?: Record<string, unknown> | undefined;
|
|
@@ -35,7 +35,7 @@ export declare const getTypeUnits: () => import("./types").PureUnit[], getUnitNa
|
|
|
35
35
|
label: string;
|
|
36
36
|
icon?: string | undefined;
|
|
37
37
|
} | {
|
|
38
|
-
expression?: import("
|
|
38
|
+
expression?: import("./types").UnitExpression | undefined;
|
|
39
39
|
type: "type-icon" | "type-badge" | "type-badge-abbr";
|
|
40
40
|
kind: "db";
|
|
41
41
|
hideWhenEmpty?: boolean | undefined;
|
package/lib/src/units/gantt.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare const getTypeUnits: () => import("./types").PureUnit[], getUnitNa
|
|
|
19
19
|
typeObject: TypeObject;
|
|
20
20
|
units: import("./types").Unit[];
|
|
21
21
|
}) => any, getUnitLabel: (fieldObject: import("@fibery/schema").FieldObject, unit: import("./types").Unit) => string, getHardcodedUnitsForView: (typeObject: TypeObject) => ({
|
|
22
|
-
expression: import("
|
|
22
|
+
expression: import("./types").UnitExpression;
|
|
23
23
|
type: "avatar" | "avatar-collection" | "avatar-input" | "back-references-list" | "bool" | "bool-checkbox" | "collection-count" | "color-input" | "comments-list" | "date" | "date-time" | "date-time-combobox" | "date-range" | "date-range-combobox" | "email" | "email-input" | "emoji" | "field" | "files-gallery" | "files-list" | "files-list-item" | "files-l-list" | "files-l-list-item" | "file-reference" | "file-compact-collection" | "file-compact-reference" | "file-collection-count" | "geometry-preview" | "icon-button" | "icon-input" | "id" | "json-input" | "location" | "location-input" | "number" | "number-input" | "phone" | "phone-input" | "progress-bar" | "reference" | "reference-icon" | "reference-combobox" | "reference-collection" | "reference-collection-list" | "reference-collection-view" | "reference-collection-combobox" | "rich-text-snippet" | "rich-text-document" | "single-location-preview" | "text" | "text-input" | "title" | "title-input" | "url" | "url-input" | "user-role" | "user-role-input";
|
|
24
24
|
kind: "field";
|
|
25
25
|
settings?: Record<string, unknown> | undefined;
|
|
@@ -35,7 +35,7 @@ export declare const getTypeUnits: () => import("./types").PureUnit[], getUnitNa
|
|
|
35
35
|
label: string;
|
|
36
36
|
icon?: string | undefined;
|
|
37
37
|
} | {
|
|
38
|
-
expression?: import("
|
|
38
|
+
expression?: import("./types").UnitExpression | undefined;
|
|
39
39
|
type: "type-icon" | "type-badge" | "type-badge-abbr";
|
|
40
40
|
kind: "db";
|
|
41
41
|
hideWhenEmpty?: boolean | undefined;
|
package/lib/src/units/grid.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare const getTypeUnits: () => import("./types").PureUnit[], getUnitNa
|
|
|
18
18
|
typeObject: import("@fibery/schema").TypeObject;
|
|
19
19
|
units: import("./types").Unit[];
|
|
20
20
|
}) => any, getHardcodedUnitsForView: (typeObject: import("@fibery/schema").TypeObject) => ({
|
|
21
|
-
expression: import("
|
|
21
|
+
expression: import("./types").UnitExpression;
|
|
22
22
|
type: "avatar" | "avatar-collection" | "avatar-input" | "back-references-list" | "bool" | "bool-checkbox" | "collection-count" | "color-input" | "comments-list" | "date" | "date-time" | "date-time-combobox" | "date-range" | "date-range-combobox" | "email" | "email-input" | "emoji" | "field" | "files-gallery" | "files-list" | "files-list-item" | "files-l-list" | "files-l-list-item" | "file-reference" | "file-compact-collection" | "file-compact-reference" | "file-collection-count" | "geometry-preview" | "icon-button" | "icon-input" | "id" | "json-input" | "location" | "location-input" | "number" | "number-input" | "phone" | "phone-input" | "progress-bar" | "reference" | "reference-icon" | "reference-combobox" | "reference-collection" | "reference-collection-list" | "reference-collection-view" | "reference-collection-combobox" | "rich-text-snippet" | "rich-text-document" | "single-location-preview" | "text" | "text-input" | "title" | "title-input" | "url" | "url-input" | "user-role" | "user-role-input";
|
|
23
23
|
kind: "field";
|
|
24
24
|
settings?: Record<string, unknown> | undefined;
|
|
@@ -34,7 +34,7 @@ export declare const getTypeUnits: () => import("./types").PureUnit[], getUnitNa
|
|
|
34
34
|
label: string;
|
|
35
35
|
icon?: string | undefined;
|
|
36
36
|
} | {
|
|
37
|
-
expression?: import("
|
|
37
|
+
expression?: import("./types").UnitExpression | undefined;
|
|
38
38
|
type: "type-icon" | "type-badge" | "type-badge-abbr";
|
|
39
39
|
kind: "db";
|
|
40
40
|
hideWhenEmpty?: boolean | undefined;
|
package/lib/src/units/grid.js
CHANGED
|
@@ -29,6 +29,7 @@ const type_icon_1 = require("../unit-definitions/type-icon");
|
|
|
29
29
|
const url_1 = require("../unit-definitions/url");
|
|
30
30
|
const user_button_1 = require("../unit-definitions/user-button");
|
|
31
31
|
const user_role_1 = require("../unit-definitions/user-role");
|
|
32
|
+
const file_collection_count_1 = require("../unit-definitions/file-collection-count");
|
|
32
33
|
const allUnitDefinitions = {
|
|
33
34
|
AvatarCollection: avatar_collection_1.AvatarCollection,
|
|
34
35
|
Bool: bool_1.Bool,
|
|
@@ -56,6 +57,7 @@ const allUnitDefinitions = {
|
|
|
56
57
|
RichTextSnippet: rich_text_snippet_1.RichTextSnippet,
|
|
57
58
|
IconButton: icon_button_1.IconButton,
|
|
58
59
|
UserRole: user_role_1.UserRole,
|
|
60
|
+
FileCollectionCount: file_collection_count_1.FileCollectionCount,
|
|
59
61
|
};
|
|
60
62
|
_a = (0, make_factory_1.makeUnitDefinitionsFactory)(allUnitDefinitions), exports.getTypeUnits = _a.getTypeUnits, exports.getUnitName = _a.getUnitName, exports.getUnitsForType = _a.getUnitsForType, exports.getUnitsForField = _a.getUnitsForField, exports.getUnitsForTypePerField = _a.getUnitsForTypePerField, exports.getUnitLabel = _a.getUnitLabel, exports.getCardUnitsSelect = _a.getCardUnitsSelect, exports.getHardcodedUnitsForView = _a.getHardcodedUnitsForView;
|
|
61
63
|
const getDefaultUnits = () => {
|
package/lib/src/units/list.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare const getTypeUnits: () => import("./types").PureUnit[], getUnitNa
|
|
|
19
19
|
typeObject: TypeObject;
|
|
20
20
|
units: import("./types").Unit[];
|
|
21
21
|
}) => any, getHardcodedUnitsForView: (typeObject: TypeObject) => ({
|
|
22
|
-
expression: import("
|
|
22
|
+
expression: import("./types").UnitExpression;
|
|
23
23
|
type: "avatar" | "avatar-collection" | "avatar-input" | "back-references-list" | "bool" | "bool-checkbox" | "collection-count" | "color-input" | "comments-list" | "date" | "date-time" | "date-time-combobox" | "date-range" | "date-range-combobox" | "email" | "email-input" | "emoji" | "field" | "files-gallery" | "files-list" | "files-list-item" | "files-l-list" | "files-l-list-item" | "file-reference" | "file-compact-collection" | "file-compact-reference" | "file-collection-count" | "geometry-preview" | "icon-button" | "icon-input" | "id" | "json-input" | "location" | "location-input" | "number" | "number-input" | "phone" | "phone-input" | "progress-bar" | "reference" | "reference-icon" | "reference-combobox" | "reference-collection" | "reference-collection-list" | "reference-collection-view" | "reference-collection-combobox" | "rich-text-snippet" | "rich-text-document" | "single-location-preview" | "text" | "text-input" | "title" | "title-input" | "url" | "url-input" | "user-role" | "user-role-input";
|
|
24
24
|
kind: "field";
|
|
25
25
|
settings?: Record<string, unknown> | undefined;
|
|
@@ -35,7 +35,7 @@ export declare const getTypeUnits: () => import("./types").PureUnit[], getUnitNa
|
|
|
35
35
|
label: string;
|
|
36
36
|
icon?: string | undefined;
|
|
37
37
|
} | {
|
|
38
|
-
expression?: import("
|
|
38
|
+
expression?: import("./types").UnitExpression | undefined;
|
|
39
39
|
type: "type-icon" | "type-badge" | "type-badge-abbr";
|
|
40
40
|
kind: "db";
|
|
41
41
|
hideWhenEmpty?: boolean | undefined;
|
|
@@ -17,7 +17,7 @@ export declare const makeUnitDefinitionsFactory: (allUnitDefinitions: Record<str
|
|
|
17
17
|
}[];
|
|
18
18
|
getUnitsForField: (fieldObject: FieldObject, options?: UnitFilterOptions) => Unit[];
|
|
19
19
|
getHardcodedUnitsForView: (typeObject: TypeObject) => ({
|
|
20
|
-
expression: import("
|
|
20
|
+
expression: import("./types").UnitExpression;
|
|
21
21
|
type: "avatar" | "avatar-collection" | "avatar-input" | "back-references-list" | "bool" | "bool-checkbox" | "collection-count" | "color-input" | "comments-list" | "date" | "date-time" | "date-time-combobox" | "date-range" | "date-range-combobox" | "email" | "email-input" | "emoji" | "field" | "files-gallery" | "files-list" | "files-list-item" | "files-l-list" | "files-l-list-item" | "file-reference" | "file-compact-collection" | "file-compact-reference" | "file-collection-count" | "geometry-preview" | "icon-button" | "icon-input" | "id" | "json-input" | "location" | "location-input" | "number" | "number-input" | "phone" | "phone-input" | "progress-bar" | "reference" | "reference-icon" | "reference-combobox" | "reference-collection" | "reference-collection-list" | "reference-collection-view" | "reference-collection-combobox" | "rich-text-snippet" | "rich-text-document" | "single-location-preview" | "text" | "text-input" | "title" | "title-input" | "url" | "url-input" | "user-role" | "user-role-input";
|
|
22
22
|
kind: "field";
|
|
23
23
|
settings?: Record<string, unknown> | undefined;
|
|
@@ -33,7 +33,7 @@ export declare const makeUnitDefinitionsFactory: (allUnitDefinitions: Record<str
|
|
|
33
33
|
label: string;
|
|
34
34
|
icon?: string | undefined;
|
|
35
35
|
} | {
|
|
36
|
-
expression?: import("
|
|
36
|
+
expression?: import("./types").UnitExpression | undefined;
|
|
37
37
|
type: "type-icon" | "type-badge" | "type-badge-abbr";
|
|
38
38
|
kind: "db";
|
|
39
39
|
hideWhenEmpty?: boolean | undefined;
|
package/lib/src/units/types.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Schema, TypeObject } from "@fibery/schema";
|
|
2
|
-
import { Expression } from "@fibery/expression-utils";
|
|
3
2
|
import { NumberDisplaySettings } from "../field-utils/number";
|
|
4
3
|
import { $TSFixMe } from "../tsfixme";
|
|
5
4
|
import { FiberyObject } from "@fibery/expression-utils/src/types";
|
|
@@ -15,17 +14,18 @@ export type ButtonUnit = {
|
|
|
15
14
|
hideWhenEmpty?: boolean;
|
|
16
15
|
icon?: string;
|
|
17
16
|
};
|
|
17
|
+
export type UnitExpression = string[];
|
|
18
18
|
export type DbUnit = {
|
|
19
19
|
kind: "db";
|
|
20
20
|
type: "type-icon" | "type-badge" | "type-badge-abbr";
|
|
21
|
-
expression?:
|
|
21
|
+
expression?: UnitExpression;
|
|
22
22
|
checked?: boolean;
|
|
23
23
|
hideWhenEmpty?: boolean;
|
|
24
24
|
};
|
|
25
25
|
export type FieldUnit = {
|
|
26
26
|
kind: "field";
|
|
27
27
|
type: "avatar" | "avatar-collection" | "avatar-input" | "back-references-list" | "bool" | "bool-checkbox" | "collection-count" | "color-input" | "comments-list" | "date" | "date-time" | "date-time-combobox" | "date-range" | "date-range-combobox" | "email" | "email-input" | "emoji" | "field" | "files-gallery" | "files-list" | "files-list-item" | "files-l-list" | "files-l-list-item" | "file-reference" | "file-compact-collection" | "file-compact-reference" | "file-collection-count" | "geometry-preview" | "icon-button" | "icon-input" | "id" | "json-input" | "location" | "location-input" | "number" | "number-input" | "phone" | "phone-input" | "progress-bar" | "reference" | "reference-icon" | "reference-combobox" | "reference-collection" | "reference-collection-list" | "reference-collection-view" | "reference-collection-combobox" | "rich-text-snippet" | "rich-text-document" | "single-location-preview" | "text" | "text-input" | "title" | "title-input" | "url" | "url-input" | "user-role" | "user-role-input";
|
|
28
|
-
expression:
|
|
28
|
+
expression: UnitExpression;
|
|
29
29
|
checked?: boolean;
|
|
30
30
|
settings?: Record<string, unknown>;
|
|
31
31
|
hideWhenEmpty?: boolean;
|
|
@@ -41,7 +41,7 @@ export type UnitDataDefinition<T extends Unit> = {
|
|
|
41
41
|
unit: T;
|
|
42
42
|
}) => boolean;
|
|
43
43
|
makeUnit: (params?: {
|
|
44
|
-
expression:
|
|
44
|
+
expression: UnitExpression;
|
|
45
45
|
}) => PureUnit;
|
|
46
46
|
getLabel: (params: {
|
|
47
47
|
typeObject: TypeObject;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibery/views",
|
|
3
|
-
"version": "18.0.
|
|
3
|
+
"version": "18.0.3",
|
|
4
4
|
"description": "Operations on view objects",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Fibery",
|
|
@@ -37,10 +37,10 @@
|
|
|
37
37
|
"lodash": "4.17.21",
|
|
38
38
|
"moment": "2.29.4",
|
|
39
39
|
"@fibery/context-filters": "1.1.3",
|
|
40
|
-
"@fibery/expression-utils": "9.6.
|
|
41
|
-
"@fibery/query-utils": "1.1.
|
|
42
|
-
"@fibery/helpers": "1.
|
|
43
|
-
"@fibery/schema": "10.2.
|
|
40
|
+
"@fibery/expression-utils": "9.6.3",
|
|
41
|
+
"@fibery/query-utils": "1.1.3",
|
|
42
|
+
"@fibery/helpers": "1.5.0",
|
|
43
|
+
"@fibery/schema": "10.2.14"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
46
|
"@babel/core": "7.28.5",
|
|
@@ -50,58 +50,18 @@
|
|
|
50
50
|
"jest": "30.2.0",
|
|
51
51
|
"jest-junit": "16.0.0",
|
|
52
52
|
"typescript": "5.9.3",
|
|
53
|
-
"@fibery/
|
|
54
|
-
"@fibery/
|
|
53
|
+
"@fibery/eslint-config": "9.0.0",
|
|
54
|
+
"@fibery/babel-preset": "7.4.1"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@fibery/expression-utils": "^9.6.
|
|
58
|
-
"@fibery/schema": "^10.2.
|
|
57
|
+
"@fibery/expression-utils": "^9.6.3",
|
|
58
|
+
"@fibery/schema": "^10.2.14",
|
|
59
59
|
"immutability-helper": "^2.4.0",
|
|
60
60
|
"lodash": "4.17.21"
|
|
61
61
|
},
|
|
62
|
-
"jest": {
|
|
63
|
-
"testEnvironment": "node",
|
|
64
|
-
"coveragePathIgnorePatterns": [
|
|
65
|
-
"/node_modules/"
|
|
66
|
-
],
|
|
67
|
-
"collectCoverageFrom": [
|
|
68
|
-
"src/**/*.{js,jsx,ts,tsx}",
|
|
69
|
-
"!src/**/*.d.ts"
|
|
70
|
-
],
|
|
71
|
-
"coverageReporters": [
|
|
72
|
-
"text",
|
|
73
|
-
"cobertura"
|
|
74
|
-
],
|
|
75
|
-
"testPathIgnorePatterns": [
|
|
76
|
-
"<rootDir>[/\\\\](build|docs|node_modules|scripts)[/\\\\]"
|
|
77
|
-
],
|
|
78
|
-
"transform": {
|
|
79
|
-
"^.+\\.(js|jsx|ts|tsx)$": [
|
|
80
|
-
"@swc/jest",
|
|
81
|
-
{
|
|
82
|
-
"jsc": {
|
|
83
|
-
"parser": {
|
|
84
|
-
"syntax": "typescript",
|
|
85
|
-
"tsx": true,
|
|
86
|
-
"decorators": true,
|
|
87
|
-
"dynamicImport": true
|
|
88
|
-
},
|
|
89
|
-
"transform": {
|
|
90
|
-
"react": {
|
|
91
|
-
"runtime": "automatic"
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
]
|
|
97
|
-
},
|
|
98
|
-
"testEnvironmentOptions": {
|
|
99
|
-
"url": "http://localhost"
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
62
|
"scripts": {
|
|
103
63
|
"build": "rm -rf lib && pnpm exec tsc --project tsconfig.build.json",
|
|
104
|
-
"test": "
|
|
64
|
+
"test": "jest",
|
|
105
65
|
"test:ci": "pnpm run test --reporters=default --reporters=jest-junit",
|
|
106
66
|
"test:coverage": "pnpm run test --coverage --coverageDirectory=${JEST_COVERAGE_RESULT_DIR:-$(pwd)}/coverage/view --reporters=default --reporters=jest-junit",
|
|
107
67
|
"lint": "eslint ."
|