@fibery/views 26.0.6 → 26.0.8
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/_virtual/_rolldown/runtime.js +1 -2
- package/lib/errors.d.ts +1 -3
- package/lib/errors.js +1 -2
- package/lib/field-utils/avatar.d.ts +1 -3
- package/lib/field-utils/avatar.js +1 -2
- package/lib/field-utils/back-references.d.ts +1 -3
- package/lib/field-utils/back-references.js +1 -2
- package/lib/field-utils/comments.d.ts +1 -3
- package/lib/field-utils/comments.js +1 -2
- package/lib/field-utils/date-time.d.ts +1 -3
- package/lib/field-utils/date-time.js +1 -2
- package/lib/field-utils/enum-value.d.ts +1 -3
- package/lib/field-utils/enum-value.js +1 -2
- package/lib/field-utils/file.d.ts +1 -3
- package/lib/field-utils/file.js +1 -2
- package/lib/field-utils/icon.d.ts +1 -3
- package/lib/field-utils/icon.js +1 -2
- package/lib/field-utils/number.d.ts +1 -3
- package/lib/field-utils/number.js +5 -8
- package/lib/field-utils/reference-collection.d.ts +1 -3
- package/lib/field-utils/reference-collection.js +7 -20
- package/lib/field-utils/reference.d.ts +1 -3
- package/lib/field-utils/reference.js +3 -4
- package/lib/field-utils/relation-view.d.ts +1 -3
- package/lib/field-utils/relation-view.js +1 -2
- package/lib/field-utils/rich-text.d.ts +1 -3
- package/lib/field-utils/rich-text.js +4 -15
- package/lib/field-utils/text.d.ts +1 -3
- package/lib/field-utils/text.js +1 -2
- package/lib/field-utils/user-active.d.ts +1 -3
- package/lib/field-utils/user-active.js +1 -2
- package/lib/field-utils/user-role.d.ts +1 -3
- package/lib/field-utils/user-role.js +1 -2
- package/lib/field-utils/workflow.d.ts +1 -3
- package/lib/field-utils/workflow.js +1 -2
- package/lib/filter.d.ts +1 -3
- package/lib/index.d.ts +2 -4
- package/lib/index.js +2 -3
- package/lib/meta-validation.d.ts +1 -3
- package/lib/meta-validation.js +5 -9
- package/lib/private/board.d.ts +1 -3
- package/lib/private/board.js +4 -5
- package/lib/private/calendar.d.ts +1 -3
- package/lib/private/calendar.js +2 -3
- package/lib/private/feed.d.ts +1 -3
- package/lib/private/feed.js +2 -3
- package/lib/private/form.d.ts +1 -3
- package/lib/private/form.js +1 -2
- package/lib/private/map.d.ts +1 -3
- package/lib/private/map.js +2 -3
- package/lib/private/smart-folder.d.ts +1 -3
- package/lib/private/smart-folder.js +5 -6
- package/lib/private/timeline.d.ts +1 -3
- package/lib/private/timeline.js +6 -7
- package/lib/private/units.d.ts +1 -3
- package/lib/private/units.js +17 -2
- package/lib/private/utils.d.ts +1 -3
- package/lib/private/utils.js +3 -5
- package/lib/refs.d.ts +1 -3
- package/lib/unit-definitions/avatar-collection.d.ts +1 -3
- package/lib/unit-definitions/avatar-collection.js +3 -15
- package/lib/unit-definitions/avatar-input.d.ts +2 -4
- package/lib/unit-definitions/avatar-input.js +1 -2
- package/lib/unit-definitions/avatar.d.ts +2 -4
- package/lib/unit-definitions/avatar.js +3 -14
- package/lib/unit-definitions/back-references-list.d.ts +3 -5
- package/lib/unit-definitions/back-references-list.js +2 -3
- package/lib/unit-definitions/bool-checkbox.d.ts +2 -4
- package/lib/unit-definitions/bool-checkbox.js +2 -3
- package/lib/unit-definitions/bool.d.ts +2 -4
- package/lib/unit-definitions/bool.js +2 -3
- package/lib/unit-definitions/collection-count.d.ts +2 -4
- package/lib/unit-definitions/collection-count.js +1 -2
- package/lib/unit-definitions/color-input.d.ts +2 -4
- package/lib/unit-definitions/color-input.js +2 -3
- package/lib/unit-definitions/comments-list.d.ts +2 -4
- package/lib/unit-definitions/comments-list.js +2 -3
- package/lib/unit-definitions/date-range-combobox.d.ts +2 -4
- package/lib/unit-definitions/date-range-combobox.js +2 -3
- package/lib/unit-definitions/date-range.d.ts +2 -4
- package/lib/unit-definitions/date-range.js +2 -3
- package/lib/unit-definitions/date-time-combobox.d.ts +2 -4
- package/lib/unit-definitions/date-time-combobox.js +2 -3
- package/lib/unit-definitions/date.d.ts +2 -4
- package/lib/unit-definitions/date.js +2 -3
- package/lib/unit-definitions/email-input.d.ts +4 -6
- package/lib/unit-definitions/email-input.js +1 -2
- package/lib/unit-definitions/email.d.ts +3 -5
- package/lib/unit-definitions/email.js +1 -2
- package/lib/unit-definitions/emoji.d.ts +3 -5
- package/lib/unit-definitions/emoji.js +1 -2
- package/lib/unit-definitions/file-collection-count.d.ts +2 -4
- package/lib/unit-definitions/file-collection-count.js +2 -3
- package/lib/unit-definitions/file-compact-collection.d.ts +2 -4
- package/lib/unit-definitions/file-compact-collection.js +2 -3
- package/lib/unit-definitions/file-compact-reference.d.ts +1 -3
- package/lib/unit-definitions/file-compact-reference.js +1 -2
- package/lib/unit-definitions/file-reference.d.ts +2 -4
- package/lib/unit-definitions/file-reference.js +2 -3
- package/lib/unit-definitions/files-gallery.d.ts +2 -4
- package/lib/unit-definitions/files-gallery.js +2 -3
- package/lib/unit-definitions/files-l-list-item.d.ts +2 -4
- package/lib/unit-definitions/files-l-list-item.js +2 -3
- package/lib/unit-definitions/files-l-list.d.ts +2 -4
- package/lib/unit-definitions/files-l-list.js +2 -3
- package/lib/unit-definitions/files-list-item.d.ts +2 -4
- package/lib/unit-definitions/files-list-item.js +2 -3
- package/lib/unit-definitions/files-list.d.ts +2 -4
- package/lib/unit-definitions/files-list.js +2 -3
- package/lib/unit-definitions/geometry-preview.d.ts +3 -5
- package/lib/unit-definitions/geometry-preview.js +1 -2
- package/lib/unit-definitions/icon-button.d.ts +2 -4
- package/lib/unit-definitions/icon-button.js +2 -3
- package/lib/unit-definitions/icon-input.d.ts +4 -6
- package/lib/unit-definitions/icon-input.js +1 -2
- package/lib/unit-definitions/id.d.ts +1 -3
- package/lib/unit-definitions/id.js +1 -2
- package/lib/unit-definitions/index.d.ts +4 -3
- package/lib/unit-definitions/index.js +6 -5
- package/lib/unit-definitions/json-input.d.ts +2 -4
- package/lib/unit-definitions/json-input.js +2 -3
- package/lib/unit-definitions/json-preview.d.ts +26 -0
- package/lib/unit-definitions/json-preview.js +31 -0
- package/lib/unit-definitions/location-input.d.ts +3 -5
- package/lib/unit-definitions/location-input.js +1 -2
- package/lib/unit-definitions/location.d.ts +3 -5
- package/lib/unit-definitions/location.js +1 -2
- package/lib/unit-definitions/not-found.d.ts +1 -3
- package/lib/unit-definitions/not-found.js +0 -1
- package/lib/unit-definitions/number-input.d.ts +2 -4
- package/lib/unit-definitions/number-input.js +2 -3
- package/lib/unit-definitions/number.d.ts +1 -3
- package/lib/unit-definitions/number.js +1 -2
- package/lib/unit-definitions/phone-input.d.ts +4 -6
- package/lib/unit-definitions/phone-input.js +1 -2
- package/lib/unit-definitions/phone.d.ts +4 -6
- package/lib/unit-definitions/phone.js +1 -2
- package/lib/unit-definitions/progress-bar.d.ts +1 -3
- package/lib/unit-definitions/progress-bar.js +1 -2
- package/lib/unit-definitions/reference-collection-combobox.d.ts +2 -4
- package/lib/unit-definitions/reference-collection-combobox.js +2 -3
- package/lib/unit-definitions/reference-collection-list.d.ts +2 -4
- package/lib/unit-definitions/reference-collection-list.js +2 -3
- package/lib/unit-definitions/reference-collection-view.d.ts +2 -4
- package/lib/unit-definitions/reference-collection-view.js +2 -3
- package/lib/unit-definitions/reference-collection.d.ts +2 -4
- package/lib/unit-definitions/reference-collection.js +2 -3
- package/lib/unit-definitions/reference-combobox.d.ts +2 -4
- package/lib/unit-definitions/reference-combobox.js +2 -3
- package/lib/unit-definitions/reference-icon.d.ts +3 -5
- package/lib/unit-definitions/reference-icon.js +1 -2
- package/lib/unit-definitions/reference.d.ts +1 -3
- package/lib/unit-definitions/reference.js +3 -14
- package/lib/unit-definitions/rich-text-document.d.ts +2 -4
- package/lib/unit-definitions/rich-text-document.js +2 -3
- package/lib/unit-definitions/rich-text-snippet.d.ts +1 -3
- package/lib/unit-definitions/rich-text-snippet.js +1 -2
- package/lib/unit-definitions/single-location-preview.d.ts +3 -5
- package/lib/unit-definitions/single-location-preview.js +1 -2
- package/lib/unit-definitions/text-input.d.ts +2 -4
- package/lib/unit-definitions/text-input.js +2 -3
- package/lib/unit-definitions/text.d.ts +2 -4
- package/lib/unit-definitions/text.js +2 -3
- package/lib/unit-definitions/title-input.d.ts +1 -3
- package/lib/unit-definitions/title-input.js +1 -2
- package/lib/unit-definitions/title.d.ts +2 -4
- package/lib/unit-definitions/title.js +1 -2
- package/lib/unit-definitions/type-badge-abbr.d.ts +1 -3
- package/lib/unit-definitions/type-badge-abbr.js +1 -2
- package/lib/unit-definitions/type-badge.d.ts +1 -3
- package/lib/unit-definitions/type-badge.js +1 -2
- package/lib/unit-definitions/type-icon.d.ts +1 -3
- package/lib/unit-definitions/type-icon.js +1 -2
- package/lib/unit-definitions/url-input.d.ts +4 -6
- package/lib/unit-definitions/url-input.js +1 -2
- package/lib/unit-definitions/url.d.ts +3 -5
- package/lib/unit-definitions/url.js +1 -2
- package/lib/unit-definitions/user-button.d.ts +1 -3
- package/lib/unit-definitions/user-button.js +1 -2
- package/lib/unit-definitions/user-role-input.d.ts +3 -5
- package/lib/unit-definitions/user-role-input.js +1 -2
- package/lib/unit-definitions/user-role.d.ts +3 -5
- package/lib/unit-definitions/user-role.js +2 -3
- package/lib/unit-utils/access.d.ts +1 -3
- package/lib/unit-utils/access.js +1 -2
- package/lib/unit-utils/can-edit-field.d.ts +1 -3
- package/lib/unit-utils/can-edit-field.js +1 -2
- package/lib/unit-utils/common.d.ts +2 -4
- package/lib/unit-utils/common.js +1 -2
- package/lib/unit-utils/decimal.d.ts +0 -2
- package/lib/unit-utils/decimal.js +1 -2
- package/lib/unit-utils/dynamic-keys.d.ts +1 -3
- package/lib/unit-utils/dynamic-keys.js +1 -2
- package/lib/unit-utils/enums.d.ts +1 -3
- package/lib/unit-utils/enums.js +2 -3
- package/lib/unit-utils/formatters.d.ts +1 -3
- package/lib/unit-utils/formatters.js +3 -5
- package/lib/unit-utils/get-export-value.d.ts +1 -3
- package/lib/unit-utils/get-export-value.js +1 -2
- package/lib/unit-utils/get-field-label.d.ts +1 -3
- package/lib/unit-utils/get-field-label.js +1 -2
- package/lib/unit-utils/get-unmatched-unit-label.d.ts +1 -3
- package/lib/unit-utils/get-unmatched-unit-label.js +2 -4
- package/lib/unit-utils/wrap-normalized-in-expression.d.ts +2 -3
- package/lib/unit-utils/wrap-normalized-in-expression.js +15 -14
- package/lib/units/board.d.ts +1 -3
- package/lib/units/board.js +1 -2
- package/lib/units/canvas/all-units-data-definitions.d.ts +5 -5
- package/lib/units/canvas/all-units-data-definitions.js +6 -7
- package/lib/units/canvas/index.d.ts +0 -1
- package/lib/units/canvas/index.js +1 -2
- package/lib/units/canvas/type-badge-abbr.d.ts +1 -3
- package/lib/units/canvas/type-badge-abbr.js +1 -2
- package/lib/units/canvas/type-badge.d.ts +1 -3
- package/lib/units/canvas/type-badge.js +1 -2
- package/lib/units/default.d.ts +0 -1
- package/lib/units/default.js +1 -2
- package/lib/units/gallery.d.ts +0 -2
- package/lib/units/gallery.js +1 -2
- package/lib/units/gantt.d.ts +1 -3
- package/lib/units/gantt.js +1 -2
- package/lib/units/get-unit-definitions-for-view-type.d.ts +1 -3
- package/lib/units/get-unit-definitions-for-view-type.js +2 -3
- package/lib/units/grid.d.ts +1 -3
- package/lib/units/grid.js +8 -7
- package/lib/units/list.d.ts +1 -3
- package/lib/units/list.js +1 -2
- package/lib/units/make-factory.d.ts +1 -3
- package/lib/units/make-factory.js +20 -28
- package/lib/units/types.d.ts +2 -4
- package/package.json +7 -9
package/lib/meta-validation.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { InvalidMetaError } from "./errors.js";
|
|
2
|
-
import { isEmptyObject, isObjectLike } from "@fibery/helpers/src/object";
|
|
3
|
-
|
|
4
|
-
//#region src/meta-validation.ts
|
|
2
|
+
import { isEmptyObject, isObjectLike, isPlainObject } from "@fibery/helpers/src/object";
|
|
3
|
+
// src/meta-validation.ts
|
|
5
4
|
/**
|
|
6
5
|
* Validates meta payload for the view of given type.
|
|
7
6
|
* Throws `InvalidMeta` if meta is not valid.
|
|
@@ -24,13 +23,13 @@ const isMetaValid = (type, meta) => {
|
|
|
24
23
|
};
|
|
25
24
|
const genericValidator = (m) => {
|
|
26
25
|
if (m === null) return;
|
|
27
|
-
const items =
|
|
26
|
+
const items = isPlainObject(m) ? m.items : void 0;
|
|
28
27
|
if (!Array.isArray(items)) throw new InvalidMetaError("expected fibery/meta.items to be an array");
|
|
29
28
|
};
|
|
30
29
|
const validators = /* @__PURE__ */ new Map([
|
|
31
30
|
["document", (m) => {
|
|
32
31
|
if (m === null || m === void 0 || isObjectLike(m) && isEmptyObject(m)) return;
|
|
33
|
-
if (typeof
|
|
32
|
+
if (!isPlainObject(m) || typeof m.documentSecret !== "string") throw new InvalidMetaError("expected fibery/meta.documentSecret to be a string");
|
|
34
33
|
}],
|
|
35
34
|
["vizydrop/chart", () => {}],
|
|
36
35
|
["form", () => {}],
|
|
@@ -39,14 +38,11 @@ const validators = /* @__PURE__ */ new Map([
|
|
|
39
38
|
["spreadsheet", () => {}],
|
|
40
39
|
["thread", (m) => {
|
|
41
40
|
if (isObjectLike(m) && isEmptyObject(m)) return;
|
|
42
|
-
|
|
43
|
-
const typeId = get(m, "typeId");
|
|
44
|
-
if (typeof id !== "string" || typeof typeId !== "string") throw new InvalidMetaError("expected fibery/meta.id and fibery/meta.typeId to be strings");
|
|
41
|
+
if (!isPlainObject(m) || typeof m.id !== "string" || typeof m.typeId !== "string") throw new InvalidMetaError("expected fibery/meta.id and fibery/meta.typeId to be strings");
|
|
45
42
|
}],
|
|
46
43
|
["dashboard", () => {}],
|
|
47
44
|
["embed", () => {}],
|
|
48
45
|
["page", () => {}],
|
|
49
46
|
["custom-app", () => {}]
|
|
50
47
|
]);
|
|
51
|
-
//#endregion
|
|
52
48
|
export { assertMetaValid, isMetaValid };
|
package/lib/private/board.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { ColorCoding, UnitDefinitions, ViewVisitor } from "./utils.js";
|
|
|
3
3
|
import { FieldObject, Schema, TypeId, TypeName } from "@fibery/schema";
|
|
4
4
|
import { FieldExpression, Query } from "@fibery/expression-utils/src/types";
|
|
5
5
|
import { Unit } from "@fibery/views/src/units/types";
|
|
6
|
-
//#region src/private/board.d.ts
|
|
7
6
|
export type BoardItemShape<From extends string> = {
|
|
8
7
|
query?: Query<From> | null;
|
|
9
8
|
filter?: FilterGroup | null;
|
|
@@ -219,5 +218,4 @@ export declare const collectGarbage: <From extends string, I extends BoardItemSh
|
|
|
219
218
|
y: EnumsAxis<From, E> | ObjectsAxis<AxisHolderShape<From>> | VisitedAxisHolder<ObjectsAxis<AxisHolderShape<From>>, From> | null | undefined;
|
|
220
219
|
items: VisitedBoardItem<I, From>[];
|
|
221
220
|
};
|
|
222
|
-
};
|
|
223
|
-
//#endregion
|
|
221
|
+
};
|
package/lib/private/board.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { REMOVE, deleteNotFoundViewVisitor, identityViewVisitor, replaceIdsWithNamesViewVisitor, replaceNamesWithIdsViewVisitor, resetContextExpressionIfBroken, reuseIfUnchanged, typeObjectById, typeObjectByName, visitColorCoding, visitContextExpression, visitUnits } from "./utils.js";
|
|
2
1
|
import { enableHideWhenEmptyForCheckedEditableUnit, fixViewUnit } from "./units.js";
|
|
2
|
+
import { REMOVE, deleteNotFoundViewVisitor, identityViewVisitor, replaceIdsWithNamesViewVisitor, replaceNamesWithIdsViewVisitor, resetContextExpressionIfBroken, reuseIfUnchanged, typeObjectById, typeObjectByName, visitColorCoding, visitContextExpression, visitUnits } from "./utils.js";
|
|
3
3
|
import { isFieldExpression } from "@fibery/expression-utils/src/utils";
|
|
4
4
|
import { truthy } from "@fibery/helpers/src/_";
|
|
5
|
-
|
|
5
|
+
// src/private/board.ts
|
|
6
6
|
function visitQueryHolder(holder, visitor, visitHolderUnits = true) {
|
|
7
7
|
if (!holder) return holder;
|
|
8
8
|
const { query, filter, contextExpression, units, ...rest } = holder;
|
|
@@ -18,8 +18,8 @@ function visitQueryHolder(holder, visitor, visitHolderUnits = true) {
|
|
|
18
18
|
contextExpression: visitContextExpression(fromType, contextExpression, visitor),
|
|
19
19
|
units: units ? visitUnits(fromType, units.filter(truthy), visitor) : void 0
|
|
20
20
|
} : {
|
|
21
|
-
...Object.hasOwn(holder, "contextExpression")
|
|
22
|
-
...Object.hasOwn(holder, "units")
|
|
21
|
+
...Object.hasOwn(holder, "contextExpression") && { contextExpression },
|
|
22
|
+
...Object.hasOwn(holder, "units") && { units }
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
25
|
}
|
|
@@ -162,5 +162,4 @@ const enableHideWhenEmptyForCovers = (view) => {
|
|
|
162
162
|
const enableHideWhenEmptyForCheckedEditableUnits = (view) => visitViewKeepingEnums(view, identityViewVisitor({ visitViewUnit: (_fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit) }));
|
|
163
163
|
/** @deprecated Drop unchecked units with `visitViewKeepingEnums(view, identityViewVisitor({visitViewUnit}))`. */
|
|
164
164
|
const collectGarbage = (view) => visitViewKeepingEnums(view, identityViewVisitor({ visitViewUnit: (_fromType, unit) => unit.checked ? unit : REMOVE }));
|
|
165
|
-
//#endregion
|
|
166
165
|
export { collectGarbage, deleteExpressionWithNotFoundOrInvalidFieldsOrTypesInBoardView, enableHideWhenEmptyForCheckedEditableUnits, enableHideWhenEmptyForCovers, fixContextExpressionWithBrokenPath, fixUserSelectedUnitsInBoardView, replaceIdsWithNamesInBoardView, replaceNamesWithIdsInBoardView, visitViewKeepingEnums };
|
|
@@ -3,7 +3,6 @@ import { ColorCoding, UnitDefinitions, ViewVisitor } from "./utils.js";
|
|
|
3
3
|
import { FieldObject, Schema, TypeId, TypeName } from "@fibery/schema";
|
|
4
4
|
import { Expression, FieldExpression, Query } from "@fibery/expression-utils/src/types";
|
|
5
5
|
import { Unit } from "@fibery/views/src/units/types";
|
|
6
|
-
//#region src/private/calendar.d.ts
|
|
7
6
|
export type CalendarItemShape<From extends string> = {
|
|
8
7
|
query?: Query<From> | null;
|
|
9
8
|
filter?: FilterGroup | null;
|
|
@@ -213,5 +212,4 @@ export declare const collectGarbage: <From extends string, I extends CalendarIte
|
|
|
213
212
|
}, "items"> & {
|
|
214
213
|
items: VisitedCalendarItem<I, From>[];
|
|
215
214
|
};
|
|
216
|
-
};
|
|
217
|
-
//#endregion
|
|
215
|
+
};
|
package/lib/private/calendar.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { REMOVE, deleteNotFoundViewVisitor, identityViewVisitor, replaceIdsWithNamesViewVisitor, replaceNamesWithIdsViewVisitor, resetContextExpressionIfBroken, reuseIfUnchanged, visitColorCoding, visitContextExpression, visitUnits } from "./utils.js";
|
|
2
1
|
import { enableHideWhenEmptyForCheckedEditableUnit, fixViewUnit } from "./units.js";
|
|
2
|
+
import { REMOVE, deleteNotFoundViewVisitor, identityViewVisitor, replaceIdsWithNamesViewVisitor, replaceNamesWithIdsViewVisitor, resetContextExpressionIfBroken, reuseIfUnchanged, visitColorCoding, visitContextExpression, visitUnits } from "./utils.js";
|
|
3
3
|
import { truthy } from "@fibery/helpers/src/_";
|
|
4
|
-
|
|
4
|
+
// src/private/calendar.ts
|
|
5
5
|
function visitItem(item, visitor) {
|
|
6
6
|
const { query, filter, startExpression, endExpression, contextExpression, units, colorCoding, ...rest } = item;
|
|
7
7
|
const fromType = query?.["q/from"];
|
|
@@ -41,5 +41,4 @@ const fixContextExpressionWithBrokenPath = (schema, view, defaultContextExpressi
|
|
|
41
41
|
const enableHideWhenEmptyForCheckedUnits = (view) => visitView(view, identityViewVisitor({ visitViewUnit: (_fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit) }));
|
|
42
42
|
/** @deprecated Drop unchecked units with `visitView(view, identityViewVisitor({visitViewUnit}))`. */
|
|
43
43
|
const collectGarbage = (view) => visitView(view, identityViewVisitor({ visitViewUnit: (_fromType, unit) => unit.checked ? unit : REMOVE }));
|
|
44
|
-
//#endregion
|
|
45
44
|
export { collectGarbage, deleteExpressionWithNotFoundFieldsOrTypesInCalendarView, enableHideWhenEmptyForCheckedUnits, fixContextExpressionWithBrokenPath, fixUserSelectedUnitsInCalendarView, replaceIdsWithNamesInCalendarView, replaceNamesWithIdsInCalendarView, visitView };
|
package/lib/private/feed.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { ColorCoding, UnitDefinitions, ViewVisitor } from "./utils.js";
|
|
|
3
3
|
import { FieldObject, Schema, TypeId, TypeName } from "@fibery/schema";
|
|
4
4
|
import { FieldExpression, Query } from "@fibery/expression-utils/src/types";
|
|
5
5
|
import { Unit } from "@fibery/views/src/units/types";
|
|
6
|
-
//#region src/private/feed.d.ts
|
|
7
6
|
export type FeedItemShape<From extends string> = {
|
|
8
7
|
query?: Query<From> | null;
|
|
9
8
|
filter?: FilterGroup | null;
|
|
@@ -211,5 +210,4 @@ export declare const collectGarbage: <From extends string, I extends FeedItemSha
|
|
|
211
210
|
}, "items"> & {
|
|
212
211
|
items: VisitedFeedItem<I, From>[];
|
|
213
212
|
};
|
|
214
|
-
};
|
|
215
|
-
//#endregion
|
|
213
|
+
};
|
package/lib/private/feed.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { REMOVE, deleteNotFoundViewVisitor, identityViewVisitor, replaceIdsWithNamesViewVisitor, replaceNamesWithIdsViewVisitor, resetContextExpressionIfBroken, reuseIfUnchanged, visitColorCoding, visitContextExpression, visitUnits } from "./utils.js";
|
|
2
1
|
import { enableHideWhenEmptyForCheckedEditableUnit, fixViewUnit } from "./units.js";
|
|
2
|
+
import { REMOVE, deleteNotFoundViewVisitor, identityViewVisitor, replaceIdsWithNamesViewVisitor, replaceNamesWithIdsViewVisitor, resetContextExpressionIfBroken, reuseIfUnchanged, visitColorCoding, visitContextExpression, visitUnits } from "./utils.js";
|
|
3
3
|
import { truthy } from "@fibery/helpers/src/_";
|
|
4
|
-
|
|
4
|
+
// src/private/feed.ts
|
|
5
5
|
function visitItem(item, visitor) {
|
|
6
6
|
const { query, filter, postExpression, contextExpression, units, colorCoding, ...rest } = item;
|
|
7
7
|
const fromType = query?.["q/from"];
|
|
@@ -40,5 +40,4 @@ const fixContextExpressionWithBrokenPath = (schema, view, defaultContextExpressi
|
|
|
40
40
|
const enableHideWhenEmptyForCheckedUnits = (view) => visitView(view, identityViewVisitor({ visitViewUnit: (_fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit) }));
|
|
41
41
|
/** @deprecated Drop unchecked units with `visitView(view, identityViewVisitor({visitViewUnit}))`. */
|
|
42
42
|
const collectGarbage = (view) => visitView(view, identityViewVisitor({ visitViewUnit: (_fromType, unit) => unit.checked ? unit : REMOVE }));
|
|
43
|
-
//#endregion
|
|
44
43
|
export { collectGarbage, deleteExpressionWithNotFoundFieldsOrTypesInFeedView, enableHideWhenEmptyForCheckedUnits, fixContextExpressionWithBrokenPath, fixUserSelectedUnitsInFeedView, replaceIdsWithNamesInFeedView, replaceNamesWithIdsInFeedView, visitView };
|
package/lib/private/form.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { FieldId, FieldName, Schema, TypeId, TypeName } from "@fibery/schema";
|
|
2
|
-
//#region src/private/form.d.ts
|
|
3
2
|
export type FormFieldShape<Field extends string> = {
|
|
4
3
|
id: Field;
|
|
5
4
|
};
|
|
@@ -49,5 +48,4 @@ export declare const deleteExpressionWithNotFoundFieldsOrTypesInFormView: <Type
|
|
|
49
48
|
id: FieldName;
|
|
50
49
|
})[] | null | undefined;
|
|
51
50
|
}>;
|
|
52
|
-
};
|
|
53
|
-
//#endregion
|
|
51
|
+
};
|
package/lib/private/form.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { typeObjectById, typeObjectByName } from "./utils.js";
|
|
2
|
-
|
|
2
|
+
// src/private/form.ts
|
|
3
3
|
const withMeta = (view, meta) => {
|
|
4
4
|
const { "fibery/meta": _previous, ...rest } = view;
|
|
5
5
|
return {
|
|
@@ -48,5 +48,4 @@ const deleteExpressionWithNotFoundFieldsOrTypesInFormView = (schema, view) => {
|
|
|
48
48
|
fields: fields && fields.filter((field) => Boolean(typeObject?.getFieldObjectByName(field.id)))
|
|
49
49
|
});
|
|
50
50
|
};
|
|
51
|
-
//#endregion
|
|
52
51
|
export { deleteExpressionWithNotFoundFieldsOrTypesInFormView, replaceIdsWithNamesInFormView, replaceNamesWithIdsInFormView };
|
package/lib/private/map.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { ColorCoding, UnitDefinitions, ViewVisitor } from "./utils.js";
|
|
|
3
3
|
import { FieldObject, Schema, TypeId, TypeName } from "@fibery/schema";
|
|
4
4
|
import { FieldExpression, Query } from "@fibery/expression-utils/src/types";
|
|
5
5
|
import { Unit } from "@fibery/views/src/units/types";
|
|
6
|
-
//#region src/private/map.d.ts
|
|
7
6
|
export type MapItemShape<From extends string> = {
|
|
8
7
|
query?: Query<From> | null;
|
|
9
8
|
filter?: FilterGroup | null;
|
|
@@ -211,5 +210,4 @@ export declare const collectGarbage: <From extends string, I extends MapItemShap
|
|
|
211
210
|
}, "items"> & {
|
|
212
211
|
items: VisitedMapItem<I, From>[];
|
|
213
212
|
};
|
|
214
|
-
};
|
|
215
|
-
//#endregion
|
|
213
|
+
};
|
package/lib/private/map.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { REMOVE, deleteNotFoundViewVisitor, identityViewVisitor, replaceIdsWithNamesViewVisitor, replaceNamesWithIdsViewVisitor, resetContextExpressionIfBroken, reuseIfUnchanged, visitColorCoding, visitContextExpression, visitUnits } from "./utils.js";
|
|
2
1
|
import { enableHideWhenEmptyForCheckedEditableUnit, fixViewUnit } from "./units.js";
|
|
2
|
+
import { REMOVE, deleteNotFoundViewVisitor, identityViewVisitor, replaceIdsWithNamesViewVisitor, replaceNamesWithIdsViewVisitor, resetContextExpressionIfBroken, reuseIfUnchanged, visitColorCoding, visitContextExpression, visitUnits } from "./utils.js";
|
|
3
3
|
import { truthy } from "@fibery/helpers/src/_";
|
|
4
|
-
|
|
4
|
+
// src/private/map.ts
|
|
5
5
|
function visitItem(item, visitor) {
|
|
6
6
|
const { query, filter, locationExpression, contextExpression, units, colorCoding, ...rest } = item;
|
|
7
7
|
const fromType = query?.["q/from"];
|
|
@@ -40,5 +40,4 @@ const fixContextExpressionWithBrokenPath = (schema, view, defaultContextExpressi
|
|
|
40
40
|
const enableHideWhenEmptyForCheckedUnits = (view) => visitView(view, identityViewVisitor({ visitViewUnit: (_fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit) }));
|
|
41
41
|
/** @deprecated Drop unchecked units with `visitView(view, identityViewVisitor({visitViewUnit}))`. */
|
|
42
42
|
const collectGarbage = (view) => visitView(view, identityViewVisitor({ visitViewUnit: (_fromType, unit) => unit.checked ? unit : REMOVE }));
|
|
43
|
-
//#endregion
|
|
44
43
|
export { collectGarbage, deleteExpressionWithNotFoundFieldsOrTypesInMapView, enableHideWhenEmptyForCheckedUnits, fixContextExpressionWithBrokenPath, fixUserSelectedUnitsInMapView, replaceIdsWithNamesInMapView, replaceNamesWithIdsInMapView, visitView };
|
|
@@ -3,7 +3,6 @@ import { ColorCoding, GroupByExpression, UnitDefinitions, ViewVisitor } from "./
|
|
|
3
3
|
import { FieldObject, Schema, TypeId, TypeName } from "@fibery/schema";
|
|
4
4
|
import { Expression, FieldExpression, Query } from "@fibery/expression-utils/src/types";
|
|
5
5
|
import { Unit } from "@fibery/views/src/units/types";
|
|
6
|
-
//#region src/private/smart-folder.d.ts
|
|
7
6
|
export type SmartFolderItemShape<From extends string> = {
|
|
8
7
|
query?: Query<From> | null;
|
|
9
8
|
filter?: FilterGroup | null;
|
|
@@ -118,5 +117,4 @@ export declare const collectGarbage: <From extends string, I extends SmartFolder
|
|
|
118
117
|
pinnedColumnsWithIds: string[] | undefined;
|
|
119
118
|
columnAggFunc: Record<string, C> | undefined;
|
|
120
119
|
};
|
|
121
|
-
};
|
|
122
|
-
//#endregion
|
|
120
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { REMOVE, deleteExpressionWithNotFoundFieldsOrTypesInExpression, deleteNotFoundViewVisitor, getFieldObjectsById, identityViewVisitor, replaceIdsWithNamesInUnitGroupKey, replaceIdsWithNamesViewVisitor, replaceNamesWithIdsInUnitGroupKey, replaceNamesWithIdsViewVisitor, resetContextExpressionIfBroken, reuseIfUnchanged, visitColorCoding, visitContextExpression, visitUnits } from "./utils.js";
|
|
2
1
|
import { enableHideWhenEmptyForCheckedEditableUnit, fixViewUnit } from "./units.js";
|
|
2
|
+
import { REMOVE, deleteExpressionWithNotFoundFieldsOrTypesInExpression, deleteNotFoundViewVisitor, getFieldObjectsById, identityViewVisitor, replaceIdsWithNamesInUnitGroupKey, replaceIdsWithNamesViewVisitor, replaceNamesWithIdsInUnitGroupKey, replaceNamesWithIdsViewVisitor, resetContextExpressionIfBroken, reuseIfUnchanged, visitColorCoding, visitContextExpression, visitUnits } from "./utils.js";
|
|
3
3
|
import { truthy } from "@fibery/helpers/src/_";
|
|
4
4
|
import { replaceIdsWithNamesVisitor, replaceNamesWithIdsVisitor } from "@fibery/expression-utils/src/visitors";
|
|
5
5
|
import { deepEqual } from "@fibery/helpers/src/equal";
|
|
6
|
-
|
|
6
|
+
// src/private/smart-folder.ts
|
|
7
7
|
function visitItems(items, visitor) {
|
|
8
8
|
const removedItemsIndexes = items.flatMap((item, index) => item.query && visitor.visitQueryExpression(item.query) ? [] : [index]);
|
|
9
|
-
const removedBefore = (groupBy) => Object.keys(groupBy).map((key) => removedItemsIndexes.filter((n) => n < parseInt(key)).length);
|
|
9
|
+
const removedBefore = (groupBy) => Object.keys(groupBy).map((key) => removedItemsIndexes.filter((n) => n < Number.parseInt(key)).length);
|
|
10
10
|
const visitGroupBy = (groupBy, fromType) => groupBy && visitor.visitGroupByExpression ? visitor.visitGroupByExpression(groupBy, fromType, removedBefore(groupBy)) : null;
|
|
11
11
|
return items.map((item) => {
|
|
12
12
|
const { query, filter, contextExpression, units, groupBy, groupingExpression, colorCoding, ...rest } = item;
|
|
@@ -18,7 +18,7 @@ function visitItems(items, visitor) {
|
|
|
18
18
|
const keepsGroupingExpression = Array.isArray(groupingExpression) || !hasGroupBy && !groupingExpression;
|
|
19
19
|
return reuseIfUnchanged(item, {
|
|
20
20
|
...rest,
|
|
21
|
-
...hasGroupBy
|
|
21
|
+
...hasGroupBy && { groupBy: visitGroupBy(groupBy, fromType) },
|
|
22
22
|
...keepsGroupingExpression ? Object.hasOwn(item, "groupingExpression") ? { groupingExpression } : {} : { groupingExpression: visitGroupBy(groupingExpression, fromType) },
|
|
23
23
|
filter: filter ? visitor.visitFilter(fromType, filter) : null,
|
|
24
24
|
query: visitedQuery,
|
|
@@ -47,7 +47,7 @@ const deleteExpressionWithNotFoundFieldsOrTypesInGroupByExpression = (schema, gr
|
|
|
47
47
|
if (!groupByExpression) return null;
|
|
48
48
|
const entries = Object.entries(groupByExpression).flatMap(([index, { expression }], groupByIndex) => {
|
|
49
49
|
const visitedExpression = deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression);
|
|
50
|
-
return visitedExpression ? [[`${parseInt(index) - removedItems[groupByIndex]}`, { expression: visitedExpression }]] : [];
|
|
50
|
+
return visitedExpression ? [[`${Number.parseInt(index) - removedItems[groupByIndex]}`, { expression: visitedExpression }]] : [];
|
|
51
51
|
});
|
|
52
52
|
return entries.length > 0 ? Object.fromEntries(entries) : null;
|
|
53
53
|
};
|
|
@@ -104,5 +104,4 @@ const fixUserSelectedUnitsInSmartFolder = (schema, view, { unitDefinitions, getD
|
|
|
104
104
|
} }));
|
|
105
105
|
const enableHideWhenEmptyForCheckedUnits = (view) => visitSmartFolder(view, identitySmartFolderVisitor({ visitViewUnit: (_fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit) }));
|
|
106
106
|
const collectGarbage = (view) => visitSmartFolder(view, identitySmartFolderVisitor({ visitViewUnit: (_fromType, unit) => unit.checked ? unit : REMOVE }));
|
|
107
|
-
//#endregion
|
|
108
107
|
export { collectGarbage, deleteExpressionWithNotFoundFieldsOrTypesInGroupByExpression, deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder, enableHideWhenEmptyForCheckedUnits, fixContextExpressionWithBrokenPath, fixUserSelectedUnitsInSmartFolder, replaceIdsWithNamesInGroupByExpression, replaceIdsWithNamesInSmartFolder, replaceNamesWithIdsInGroupByExpression, replaceNamesWithIdsInSmartFolder, visitSmartFolder };
|
|
@@ -3,7 +3,6 @@ import { ColorCoding, GroupByExpression, UnitDefinitions, ViewVisitor } from "./
|
|
|
3
3
|
import { FieldObject, Schema, TypeId, TypeName } from "@fibery/schema";
|
|
4
4
|
import { Expression, FieldExpression, Query } from "@fibery/expression-utils/src/types";
|
|
5
5
|
import { Unit } from "@fibery/views/src/units/types";
|
|
6
|
-
//#region src/private/timeline.d.ts
|
|
7
6
|
type TimelineVisitor<From extends string, To extends string> = ViewVisitor<From, To> & Required<Pick<ViewVisitor<From, To>, "visitGroupByExpression">>;
|
|
8
7
|
export type AxisSingleShape<From extends string> = {
|
|
9
8
|
query?: Query<From> | null;
|
|
@@ -542,5 +541,4 @@ export declare const collectGarbage: <From extends string, I extends TimelineIte
|
|
|
542
541
|
items: VisitedTimelineItem<I, From>[];
|
|
543
542
|
milestones: VisitedMilestone<T, From>[] | undefined;
|
|
544
543
|
};
|
|
545
|
-
};
|
|
546
|
-
//#endregion
|
|
544
|
+
};
|
package/lib/private/timeline.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { REMOVE, deleteNotFoundViewVisitor, identityViewVisitor, replaceIdsWithNamesViewVisitor, replaceNamesWithIdsViewVisitor, resetContextExpressionIfBroken, reuseIfUnchanged, typeObjectById, typeObjectByName, visitColorCoding, visitContextExpression, visitUnits } from "./utils.js";
|
|
2
|
-
import { enableHideWhenEmptyForCheckedEditableUnit, fixViewUnit } from "./units.js";
|
|
3
1
|
import { deleteExpressionWithNotFoundFieldsOrTypesInGroupByExpression, replaceIdsWithNamesInGroupByExpression, replaceNamesWithIdsInGroupByExpression } from "./smart-folder.js";
|
|
2
|
+
import { enableHideWhenEmptyForCheckedEditableUnit, fixViewUnit } from "./units.js";
|
|
3
|
+
import { REMOVE, deleteNotFoundViewVisitor, identityViewVisitor, replaceIdsWithNamesViewVisitor, replaceNamesWithIdsViewVisitor, resetContextExpressionIfBroken, reuseIfUnchanged, typeObjectById, typeObjectByName, visitColorCoding, visitContextExpression, visitUnits } from "./utils.js";
|
|
4
4
|
import { truthy } from "@fibery/helpers/src/_";
|
|
5
|
-
|
|
5
|
+
// src/private/timeline.ts
|
|
6
6
|
const firstOrNull = (expression) => expression ? expression[0] : null;
|
|
7
7
|
const visitAxisSingle = (axis, visitor) => {
|
|
8
8
|
const { query, filter, contextExpression, units, groupByExpression, ...rest } = axis;
|
|
@@ -14,7 +14,7 @@ const visitAxisSingle = (axis, visitor) => {
|
|
|
14
14
|
filter: filter ? visitor.visitFilter(fromType, filter) : null,
|
|
15
15
|
query: visitedQuery,
|
|
16
16
|
contextExpression: visitContextExpression(fromType, contextExpression, visitor),
|
|
17
|
-
...units
|
|
17
|
+
...units && { units: visitUnits(fromType, units, visitor) },
|
|
18
18
|
groupByExpression: groupByExpression && firstOrNull(visitor.visitExpression(fromType, [groupByExpression]))
|
|
19
19
|
};
|
|
20
20
|
};
|
|
@@ -70,7 +70,7 @@ function visitMilestone(milestone, visitor) {
|
|
|
70
70
|
}
|
|
71
71
|
function visitItems(items, visitor) {
|
|
72
72
|
const removedItemsIndexes = items.flatMap((item, index) => item.query && visitor.visitQueryExpression(item.query) ? [] : [index]);
|
|
73
|
-
const removedBefore = (groupBy) => Object.keys(groupBy).map((key) => removedItemsIndexes.filter((n) => n < parseInt(key)).length);
|
|
73
|
+
const removedBefore = (groupBy) => Object.keys(groupBy).map((key) => removedItemsIndexes.filter((n) => n < Number.parseInt(key)).length);
|
|
74
74
|
return items.map((item) => {
|
|
75
75
|
const { query, filter, yExpression, startExpression, endExpression, secondaryStartExpression, secondaryEndExpression, contextExpression, units, laneUnits, colorCoding, dependencyExpression, groupBy, groupingExpression, ...rest } = item;
|
|
76
76
|
const fromType = query?.["q/from"];
|
|
@@ -93,7 +93,7 @@ function visitItems(items, visitor) {
|
|
|
93
93
|
colorCoding: colorCoding ? visitColorCoding(fromType, colorCoding, visitor) : colorCoding,
|
|
94
94
|
dependencyExpression: dependencyExpression && visitor.visitExpression(fromType, dependencyExpression),
|
|
95
95
|
groupBy: groupBy ? visitor.visitGroupByExpression(groupBy, fromType, removedBefore(groupBy)) : groupBy,
|
|
96
|
-
...Object.hasOwn(item, "groupingExpression")
|
|
96
|
+
...Object.hasOwn(item, "groupingExpression") && { groupingExpression: groupingExpression ? visitor.visitGroupByExpression(groupingExpression, fromType, removedBefore(groupingExpression)) : null }
|
|
97
97
|
});
|
|
98
98
|
}).filter(truthy);
|
|
99
99
|
}
|
|
@@ -179,5 +179,4 @@ const fixUserSelectedUnitsInTimelineView = (schema, view, { unitDefinitions, get
|
|
|
179
179
|
const fixContextExpressionWithBrokenPath = (schema, view, defaultContextExpression) => visitViewKeepingEnums(view, identityTimelineVisitor({ visitContextExpression: (fromType, expression) => resetContextExpressionIfBroken(schema, fromType, expression, defaultContextExpression) }));
|
|
180
180
|
const enableHideWhenEmptyForCheckedEditableUnits = (view) => visitViewKeepingEnums(view, identityTimelineVisitor({ visitViewUnit: (_fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit) }));
|
|
181
181
|
const collectGarbage = (view) => visitViewKeepingEnums(view, identityTimelineVisitor({ visitViewUnit: (_fromType, unit) => unit.checked ? unit : REMOVE }));
|
|
182
|
-
//#endregion
|
|
183
182
|
export { collectGarbage, deleteExpressionWithNotFoundFieldsOrTypesInGanttView, deleteExpressionWithNotFoundFieldsOrTypesInTimelineView, enableHideWhenEmptyForCheckedEditableUnits, fixContextExpressionWithBrokenPath, fixUserSelectedUnitsInTimelineView, replaceIdsWithNamesInTimelineView, replaceNamesWithIdsInTimelineView, visitViewKeepingEnums };
|
package/lib/private/units.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { REMOVE, UnitDefinitions } from "./utils.js";
|
|
2
2
|
import { FieldObject, Schema } from "@fibery/schema";
|
|
3
3
|
import { Unit } from "@fibery/views/src/units/types";
|
|
4
|
-
//#region src/private/units.d.ts
|
|
5
4
|
export declare const fixViewUnit: (schema: Schema, fromType: string, unit: Unit, units: Unit[], { unitDefinitions, getDefaultUnitTypeForField, migrateFileCollectionUnit }: {
|
|
6
5
|
unitDefinitions: UnitDefinitions;
|
|
7
6
|
getDefaultUnitTypeForField: (fieldObject: FieldObject, allowedUnits: Unit[]) => string | undefined;
|
|
8
7
|
migrateFileCollectionUnit?: boolean;
|
|
9
8
|
}) => Unit | typeof REMOVE;
|
|
10
|
-
export declare const enableHideWhenEmptyForCheckedEditableUnit: (unit: Unit) => Unit;
|
|
11
|
-
//#endregion
|
|
9
|
+
export declare const enableHideWhenEmptyForCheckedEditableUnit: (unit: Unit) => Unit;
|
package/lib/private/units.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AVATAR_EXTENSION_FIELD } from "../field-utils/avatar.js";
|
|
2
2
|
import { REMOVE } from "./utils.js";
|
|
3
3
|
import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
|
|
4
|
-
|
|
4
|
+
// src/private/units.ts
|
|
5
5
|
const getField = (schema, fromType, field) => schema.getTypeObjectByName(fromType)?.getFieldObjectByName(field) ?? null;
|
|
6
6
|
const getFieldType = (schema, fromType, field) => getField(schema, fromType, field)?.type;
|
|
7
7
|
const getFieldMeta = (schema, fromType, field) => getField(schema, fromType, field)?.rawMeta;
|
|
@@ -105,7 +105,17 @@ const migrateUnit = (schema, fromType, unit, units, opts = migrateUnitOptsDefaul
|
|
|
105
105
|
};
|
|
106
106
|
};
|
|
107
107
|
const expressionFrom = (unit) => unit.expression;
|
|
108
|
+
const fieldUnitTypesWithoutExpression = /* @__PURE__ */ new Set([
|
|
109
|
+
...Object.keys({
|
|
110
|
+
id: true,
|
|
111
|
+
title: true
|
|
112
|
+
}),
|
|
113
|
+
"avatar",
|
|
114
|
+
"icon-button"
|
|
115
|
+
]);
|
|
116
|
+
const isFieldUnitWithoutExpression = (unit) => (unit.kind ?? getUnitKind(unit)) === "field" && !fieldUnitTypesWithoutExpression.has(unit.type) && !Array.isArray(expressionFrom(unit));
|
|
108
117
|
const fixViewUnit = (schema, fromType, unit, units, { unitDefinitions, getDefaultUnitTypeForField, migrateFileCollectionUnit = true }) => {
|
|
118
|
+
if (isFieldUnitWithoutExpression(unit)) return REMOVE;
|
|
109
119
|
const migrated = migrateUnit(schema, fromType, unit, units, { migrateFileCollectionUnit });
|
|
110
120
|
const expression = expressionFrom(unit) ?? [];
|
|
111
121
|
const fieldObject = getFieldByExpression(schema, fromType, expression);
|
|
@@ -129,6 +139,12 @@ const fixViewUnit = (schema, fromType, unit, units, { unitDefinitions, getDefaul
|
|
|
129
139
|
defaultUnit.checked = true;
|
|
130
140
|
return REMOVE;
|
|
131
141
|
}
|
|
142
|
+
const replacement = allowedUnits.find((u) => u.type === defaultUnitType) ?? allowedUnits[0];
|
|
143
|
+
if (replacement) return {
|
|
144
|
+
...replacement,
|
|
145
|
+
checked: true,
|
|
146
|
+
...!(unit.hideWhenEmpty === void 0) && { hideWhenEmpty: unit.hideWhenEmpty }
|
|
147
|
+
};
|
|
132
148
|
} else return REMOVE;
|
|
133
149
|
}
|
|
134
150
|
return migrated;
|
|
@@ -140,5 +156,4 @@ const enableHideWhenEmptyForCheckedEditableUnit = (unit) => {
|
|
|
140
156
|
};
|
|
141
157
|
return unit;
|
|
142
158
|
};
|
|
143
|
-
//#endregion
|
|
144
159
|
export { enableHideWhenEmptyForCheckedEditableUnit, fixViewUnit };
|
package/lib/private/utils.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { Filter, FilterGroup } from "../filter.js";
|
|
|
2
2
|
import { FieldObject, Schema, TypeId, TypeName } from "@fibery/schema";
|
|
3
3
|
import { Expression, FieldExpression, Query } from "@fibery/expression-utils/src/types";
|
|
4
4
|
import { Unit } from "@fibery/views/src/units/types";
|
|
5
|
-
//#region src/private/utils.d.ts
|
|
6
5
|
/** @deprecated Use `Filter | FilterGroup` from `../filter`. */
|
|
7
6
|
export type ViewFilter = Filter | FilterGroup;
|
|
8
7
|
export declare const REMOVE: unique symbol;
|
|
@@ -68,5 +67,4 @@ export declare const replaceNamesWithIdsInUnitGroupKey: (unitGroupKey: string, s
|
|
|
68
67
|
export declare const replaceIdsWithNamesViewVisitor: (schema: Schema) => ViewVisitor<TypeName | TypeId, TypeName | TypeId>;
|
|
69
68
|
export declare const replaceNamesWithIdsViewVisitor: (schema: Schema) => ViewVisitor<TypeName | TypeId, TypeId | TypeName>;
|
|
70
69
|
export declare const deleteNotFoundViewVisitor: (schema: Schema) => ViewVisitor<string, TypeName>;
|
|
71
|
-
export declare const identityViewVisitor: <From extends string>(overrides?: Partial<ViewVisitor<From>>) => ViewVisitor<From>;
|
|
72
|
-
//#endregion
|
|
70
|
+
export declare const identityViewVisitor: <From extends string>(overrides?: Partial<ViewVisitor<From>>) => ViewVisitor<From>;
|
package/lib/private/utils.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { truthy } from "@fibery/helpers/src/_";
|
|
2
2
|
import { deleteExpressionsWithNotFoundFieldsVisitor, replaceIdsWithNamesVisitor, replaceNamesWithIdsVisitor } from "@fibery/expression-utils/src/visitors";
|
|
3
|
-
|
|
4
|
-
//#region src/private/utils.ts
|
|
3
|
+
// src/private/utils.ts
|
|
5
4
|
const REMOVE = Symbol("remove");
|
|
6
5
|
const skipRemove = (unit) => unit !== REMOVE;
|
|
7
6
|
const typeObjectById = (schema, id) => schema.getTypeObjectById(id);
|
|
@@ -41,11 +40,11 @@ const deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression = (schema, quer
|
|
|
41
40
|
if (!typeObject) return null;
|
|
42
41
|
const visitor = deleteExpressionsWithNotFoundFieldsVisitor(typeObject);
|
|
43
42
|
return {
|
|
44
|
-
...
|
|
43
|
+
...Object.fromEntries(Object.entries({
|
|
45
44
|
...queryExpression,
|
|
46
45
|
...whereExpression ? { "q/where": visitor.visitExpression(whereExpression) } : null,
|
|
47
46
|
...orderByExpression ? { "q/order-by": visitor.visitOrderByExpression(orderByExpression) } : null
|
|
48
|
-
}),
|
|
47
|
+
}).filter(([, value]) => value)),
|
|
49
48
|
"q/from": typeObject.name
|
|
50
49
|
};
|
|
51
50
|
};
|
|
@@ -185,5 +184,4 @@ const identityViewVisitor = (overrides = {}) => ({
|
|
|
185
184
|
visitExpression: (_fromType, expression) => expression,
|
|
186
185
|
...overrides
|
|
187
186
|
});
|
|
188
|
-
//#endregion
|
|
189
187
|
export { REMOVE, deleteExpressionWithNotFoundFieldsOrTypesInExpression, deleteExpressionWithNotFoundFieldsOrTypesInFilter, deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression, deleteNotFoundViewVisitor, getFieldObjectsById, identityViewVisitor, isUnitExpressionValid, replaceIdsWithNamesInExpression, replaceIdsWithNamesInFilter, replaceIdsWithNamesInQueryExpression, replaceIdsWithNamesInUnitGroupKey, replaceIdsWithNamesViewVisitor, replaceNamesWithIdsInExpression, replaceNamesWithIdsInFilter, replaceNamesWithIdsInQueryExpression, replaceNamesWithIdsInUnitGroupKey, replaceNamesWithIdsViewVisitor, resetContextExpressionIfBroken, reuseIfUnchanged, skipRemove, typeObjectById, typeObjectByName, visitColorCoding, visitContextExpression, visitUnits, visitViewUnit };
|
package/lib/refs.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { FieldId, FieldName, TypeId, TypeName } from "@fibery/schema";
|
|
2
|
-
//#region src/refs.d.ts
|
|
3
2
|
export type Refs = {
|
|
4
3
|
type: string;
|
|
5
4
|
field: string;
|
|
@@ -15,5 +14,4 @@ export type NameRefs = {
|
|
|
15
14
|
export type MixedRefs = {
|
|
16
15
|
type: TypeName | TypeId;
|
|
17
16
|
field: FieldName | FieldId;
|
|
18
|
-
};
|
|
19
|
-
//#endregion
|
|
17
|
+
};
|
|
@@ -2,7 +2,6 @@ import { ExpressionFieldUnit, UnitExpression } from "../units/types.js";
|
|
|
2
2
|
import { calculateUnitExpressionErrors } from "../unit-utils/common.js";
|
|
3
3
|
import { getReferenceCollectionExportValue } from "../unit-utils/get-export-value.js";
|
|
4
4
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
5
|
-
//#region src/unit-definitions/avatar-collection.d.ts
|
|
6
5
|
export declare const AvatarCollection: {
|
|
7
6
|
type: "avatar-collection";
|
|
8
7
|
name: string;
|
|
@@ -26,5 +25,4 @@ export declare const AvatarCollection: {
|
|
|
26
25
|
getExportValue: typeof getReferenceCollectionExportValue;
|
|
27
26
|
canExport: () => true;
|
|
28
27
|
getExportLabel: typeof getFieldLabel;
|
|
29
|
-
};
|
|
30
|
-
//#endregion
|
|
28
|
+
};
|
|
@@ -3,10 +3,11 @@ import { generateAccessCheckQueryExpression } from "../unit-utils/access.js";
|
|
|
3
3
|
import { calculateUnitExpressionErrors, canEditFieldExpression, makeUnitMethod } from "../unit-utils/common.js";
|
|
4
4
|
import { getReferenceCollectionExportValue } from "../unit-utils/get-export-value.js";
|
|
5
5
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
6
|
+
import { wrapCollectionSelectInExpression } from "../unit-utils/wrap-normalized-in-expression.js";
|
|
6
7
|
import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
|
|
7
8
|
import { truthy } from "@fibery/helpers/src/_";
|
|
8
9
|
import { mergeDenormalizedSelects, toSelectMapClause } from "@fibery/query-utils/src/select";
|
|
9
|
-
|
|
10
|
+
// src/unit-definitions/avatar-collection.ts
|
|
10
11
|
const type = "avatar-collection";
|
|
11
12
|
const AvatarCollection = {
|
|
12
13
|
type,
|
|
@@ -36,24 +37,11 @@ const AvatarCollection = {
|
|
|
36
37
|
].filter(truthy)),
|
|
37
38
|
"q/limit": "q/no-limit"
|
|
38
39
|
};
|
|
39
|
-
return
|
|
40
|
-
const originalIndex = expression.length - 1 - reversedIndex;
|
|
41
|
-
if (!(originalIndex === expression.length - 1)) {
|
|
42
|
-
const pathToField = expression.slice(0, originalIndex + 1);
|
|
43
|
-
const { idField } = fieldObjects[originalIndex].typeObject;
|
|
44
|
-
const innerForField = idField ? {
|
|
45
|
-
[idField]: [...pathToField, idField],
|
|
46
|
-
...inner
|
|
47
|
-
} : { ...inner };
|
|
48
|
-
return { [field]: innerForField };
|
|
49
|
-
}
|
|
50
|
-
return { [field]: inner };
|
|
51
|
-
}, collectionSubQuery);
|
|
40
|
+
return wrapCollectionSelectInExpression(collectionSubQuery, fieldObjects, expression);
|
|
52
41
|
},
|
|
53
42
|
calculateErrors: calculateUnitExpressionErrors,
|
|
54
43
|
getExportValue: getReferenceCollectionExportValue,
|
|
55
44
|
canExport: () => true,
|
|
56
45
|
getExportLabel: getFieldLabel
|
|
57
46
|
};
|
|
58
|
-
//#endregion
|
|
59
47
|
export { AvatarCollection };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { calculateUnitExpressionErrors } from "../unit-utils/common.js";
|
|
1
2
|
import { NumberDisplaySettings } from "../field-utils/number.js";
|
|
2
3
|
import { ExpressionFieldUnit, UnitExpression } from "../units/types.js";
|
|
3
|
-
import { calculateUnitExpressionErrors } from "../unit-utils/common.js";
|
|
4
|
-
//#region src/unit-definitions/avatar-input.d.ts
|
|
5
4
|
export declare const AvatarInput: {
|
|
6
5
|
canEdit({ typeObject, unit: { expression } }: {
|
|
7
6
|
typeObject: import("@fibery/schema").TypeObject;
|
|
@@ -46,5 +45,4 @@ export declare const AvatarInput: {
|
|
|
46
45
|
makeUnit: ({ expression }?: {
|
|
47
46
|
expression?: UnitExpression;
|
|
48
47
|
}) => ExpressionFieldUnit;
|
|
49
|
-
};
|
|
50
|
-
//#endregion
|
|
48
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { makeUnitMethod } from "../unit-utils/common.js";
|
|
2
2
|
import { Avatar } from "./avatar.js";
|
|
3
|
-
|
|
3
|
+
// src/unit-definitions/avatar-input.ts
|
|
4
4
|
const type = "avatar-input";
|
|
5
5
|
const AvatarInput = {
|
|
6
6
|
...Avatar,
|
|
@@ -8,5 +8,4 @@ const AvatarInput = {
|
|
|
8
8
|
name: "Avatar",
|
|
9
9
|
makeUnit: makeUnitMethod(type)
|
|
10
10
|
};
|
|
11
|
-
//#endregion
|
|
12
11
|
export { AvatarInput };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { NumberDisplaySettings } from "../field-utils/number.js";
|
|
2
|
-
import { ExpressionFieldUnit, UnitExpression } from "../units/types.js";
|
|
3
2
|
import { calculateUnitExpressionErrors } from "../unit-utils/common.js";
|
|
3
|
+
import { ExpressionFieldUnit, UnitExpression } from "../units/types.js";
|
|
4
4
|
import { TypeObject } from "@fibery/schema";
|
|
5
|
-
//#region src/unit-definitions/avatar.d.ts
|
|
6
5
|
export declare const Avatar: {
|
|
7
6
|
type: "avatar";
|
|
8
7
|
name: string;
|
|
@@ -51,5 +50,4 @@ export declare const Avatar: {
|
|
|
51
50
|
typeObject: TypeObject;
|
|
52
51
|
unit: ExpressionFieldUnit;
|
|
53
52
|
}) => string;
|
|
54
|
-
};
|
|
55
|
-
//#endregion
|
|
53
|
+
};
|
|
@@ -3,10 +3,11 @@ import { generateAccessCheckQueryExpression } from "../unit-utils/access.js";
|
|
|
3
3
|
import { calculateUnitExpressionErrors, canEditFieldExpression } from "../unit-utils/common.js";
|
|
4
4
|
import { getReferenceExportValue } from "../unit-utils/get-export-value.js";
|
|
5
5
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
6
|
+
import { wrapNormalizedInExpression } from "../unit-utils/wrap-normalized-in-expression.js";
|
|
6
7
|
import { assertIsValidExpression, getFieldObjectByFieldExpression, getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
|
|
7
8
|
import { truthy } from "@fibery/helpers/src/_";
|
|
8
9
|
import { denormalizeSelect, mergeDenormalizedSelects, normalizeSelect, toSelectMapClause } from "@fibery/query-utils/src/select";
|
|
9
|
-
|
|
10
|
+
// src/unit-definitions/avatar.ts
|
|
10
11
|
const type = "avatar";
|
|
11
12
|
const getSelfAvatarSelectQuery = (typeObject) => getAvatarSelectQuery({ typeObject }) || {};
|
|
12
13
|
const Avatar = {
|
|
@@ -59,18 +60,7 @@ const Avatar = {
|
|
|
59
60
|
}),
|
|
60
61
|
getAvatarSelectQuery({ typeObject: terminalFieldObject.typeObject })
|
|
61
62
|
].filter(truthy)));
|
|
62
|
-
const nested =
|
|
63
|
-
const originalIndex = expression.length - 1 - reversedIndex;
|
|
64
|
-
if (!(originalIndex === expression.length - 1)) {
|
|
65
|
-
const { idField } = fieldObjects[originalIndex].typeObject;
|
|
66
|
-
const innerWithId = idField ? {
|
|
67
|
-
[idField]: idField,
|
|
68
|
-
...inner
|
|
69
|
-
} : inner;
|
|
70
|
-
return { [field]: innerWithId };
|
|
71
|
-
}
|
|
72
|
-
return { [field]: inner };
|
|
73
|
-
}, innerSelect);
|
|
63
|
+
const nested = wrapNormalizedInExpression(innerSelect, fieldObjects, expression);
|
|
74
64
|
return denormalizeSelect(nested);
|
|
75
65
|
},
|
|
76
66
|
calculateErrors: calculateUnitExpressionErrors,
|
|
@@ -94,5 +84,4 @@ const Avatar = {
|
|
|
94
84
|
return "Avatar";
|
|
95
85
|
}
|
|
96
86
|
};
|
|
97
|
-
//#endregion
|
|
98
87
|
export { Avatar };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { EntityLinkProjection } from "../field-utils/back-references.js";
|
|
2
1
|
import { ExpressionFieldUnit, UnitExpression } from "../units/types.js";
|
|
2
|
+
import { EntityLinkProjection } from "../field-utils/back-references.js";
|
|
3
|
+
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
3
4
|
import { calculateUnitExpressionErrors } from "../unit-utils/common.js";
|
|
4
5
|
import { getExportValue } from "../unit-utils/get-export-value.js";
|
|
5
6
|
import { getFieldLabel } from "../unit-utils/get-field-label.js";
|
|
6
|
-
import { canEditField } from "../unit-utils/can-edit-field.js";
|
|
7
|
-
//#region src/unit-definitions/back-references-list.d.ts
|
|
8
7
|
export declare const BackReferencesList: {
|
|
9
8
|
type: "back-references-list";
|
|
10
9
|
name: string;
|
|
@@ -28,5 +27,4 @@ export declare const BackReferencesList: {
|
|
|
28
27
|
calculateErrors: typeof calculateUnitExpressionErrors;
|
|
29
28
|
getExportValue: typeof getExportValue;
|
|
30
29
|
canExport: () => true;
|
|
31
|
-
};
|
|
32
|
-
//#endregion
|
|
30
|
+
};
|