@fibery/views 25.1.4 → 26.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/lib/errors.d.ts +2 -3
  2. package/lib/field-utils/avatar.d.ts +8 -9
  3. package/lib/field-utils/back-references.d.ts +4 -5
  4. package/lib/field-utils/comments.d.ts +5 -6
  5. package/lib/field-utils/date-time.d.ts +7 -8
  6. package/lib/field-utils/enum-value.d.ts +6 -7
  7. package/lib/field-utils/file.d.ts +3 -4
  8. package/lib/field-utils/icon.d.ts +6 -7
  9. package/lib/field-utils/number.d.ts +11 -12
  10. package/lib/field-utils/reference-collection.d.ts +6 -7
  11. package/lib/field-utils/reference.d.ts +3 -4
  12. package/lib/field-utils/relation-view.d.ts +2 -3
  13. package/lib/field-utils/rich-text.d.ts +9 -10
  14. package/lib/field-utils/text.d.ts +9 -10
  15. package/lib/field-utils/user-active.d.ts +3 -4
  16. package/lib/field-utils/user-role.d.ts +3 -4
  17. package/lib/field-utils/workflow.d.ts +9 -10
  18. package/lib/filter.d.ts +29 -0
  19. package/lib/filter.js +0 -0
  20. package/lib/index.d.ts +57 -21
  21. package/lib/index.js +101 -94
  22. package/lib/meta-validation.d.ts +3 -4
  23. package/lib/private/board.d.ts +218 -14
  24. package/lib/private/board.js +138 -231
  25. package/lib/private/calendar.d.ts +213 -13
  26. package/lib/private/calendar.js +35 -81
  27. package/lib/private/feed.d.ts +211 -13
  28. package/lib/private/feed.js +34 -80
  29. package/lib/private/form.d.ts +52 -7
  30. package/lib/private/form.js +41 -48
  31. package/lib/private/map.d.ts +211 -13
  32. package/lib/private/map.js +34 -80
  33. package/lib/private/smart-folder.d.ts +118 -29
  34. package/lib/private/smart-folder.js +70 -148
  35. package/lib/private/timeline.d.ts +535 -31
  36. package/lib/private/timeline.js +158 -219
  37. package/lib/private/units.d.ts +3 -4
  38. package/lib/private/utils.d.ts +63 -57
  39. package/lib/private/utils.js +71 -49
  40. package/lib/refs.d.ts +19 -0
  41. package/lib/refs.js +0 -0
  42. package/lib/unit-definitions/avatar-collection.d.ts +29 -4
  43. package/lib/unit-definitions/avatar-collection.js +1 -1
  44. package/lib/unit-definitions/avatar-input.d.ts +49 -4
  45. package/lib/unit-definitions/avatar.d.ts +54 -4
  46. package/lib/unit-definitions/avatar.js +1 -1
  47. package/lib/unit-definitions/back-references-list.d.ts +31 -4
  48. package/lib/unit-definitions/back-references-list.js +1 -1
  49. package/lib/unit-definitions/bool-checkbox.d.ts +23 -4
  50. package/lib/unit-definitions/bool-checkbox.js +1 -1
  51. package/lib/unit-definitions/bool.d.ts +23 -4
  52. package/lib/unit-definitions/bool.js +1 -1
  53. package/lib/unit-definitions/collection-count.d.ts +31 -4
  54. package/lib/unit-definitions/color-input.d.ts +22 -4
  55. package/lib/unit-definitions/color-input.js +1 -1
  56. package/lib/unit-definitions/comments-list.d.ts +63 -4
  57. package/lib/unit-definitions/comments-list.js +1 -1
  58. package/lib/unit-definitions/date-range-combobox.d.ts +23 -4
  59. package/lib/unit-definitions/date-range-combobox.js +1 -1
  60. package/lib/unit-definitions/date-range.d.ts +23 -4
  61. package/lib/unit-definitions/date-range.js +1 -1
  62. package/lib/unit-definitions/date-time-combobox.d.ts +23 -4
  63. package/lib/unit-definitions/date-time-combobox.js +1 -1
  64. package/lib/unit-definitions/date.d.ts +23 -4
  65. package/lib/unit-definitions/date.js +1 -1
  66. package/lib/unit-definitions/email-input.d.ts +23 -4
  67. package/lib/unit-definitions/email.d.ts +23 -4
  68. package/lib/unit-definitions/emoji.d.ts +23 -4
  69. package/lib/unit-definitions/file-collection-count.d.ts +23 -4
  70. package/lib/unit-definitions/file-collection-count.js +1 -1
  71. package/lib/unit-definitions/file-compact-collection.d.ts +23 -4
  72. package/lib/unit-definitions/file-compact-collection.js +1 -1
  73. package/lib/unit-definitions/file-compact-reference.d.ts +27 -4
  74. package/lib/unit-definitions/file-reference.d.ts +23 -4
  75. package/lib/unit-definitions/file-reference.js +1 -1
  76. package/lib/unit-definitions/files-gallery.d.ts +23 -4
  77. package/lib/unit-definitions/files-gallery.js +1 -1
  78. package/lib/unit-definitions/files-l-list-item.d.ts +23 -4
  79. package/lib/unit-definitions/files-l-list-item.js +1 -1
  80. package/lib/unit-definitions/files-l-list.d.ts +23 -4
  81. package/lib/unit-definitions/files-l-list.js +1 -1
  82. package/lib/unit-definitions/files-list-item.d.ts +23 -4
  83. package/lib/unit-definitions/files-list-item.js +1 -1
  84. package/lib/unit-definitions/files-list.d.ts +23 -4
  85. package/lib/unit-definitions/files-list.js +1 -1
  86. package/lib/unit-definitions/geometry-preview.d.ts +23 -4
  87. package/lib/unit-definitions/icon-button.d.ts +28 -4
  88. package/lib/unit-definitions/icon-button.js +1 -1
  89. package/lib/unit-definitions/icon-input.d.ts +23 -4
  90. package/lib/unit-definitions/id.d.ts +32 -4
  91. package/lib/unit-definitions/index.js +2 -2
  92. package/lib/unit-definitions/json-input.d.ts +22 -4
  93. package/lib/unit-definitions/json-input.js +1 -1
  94. package/lib/unit-definitions/location-input.d.ts +23 -4
  95. package/lib/unit-definitions/location.d.ts +23 -4
  96. package/lib/unit-definitions/not-found.d.ts +6 -4
  97. package/lib/unit-definitions/number-input.d.ts +23 -4
  98. package/lib/unit-definitions/number-input.js +1 -1
  99. package/lib/unit-definitions/number.d.ts +27 -4
  100. package/lib/unit-definitions/phone-input.d.ts +23 -4
  101. package/lib/unit-definitions/phone.d.ts +23 -4
  102. package/lib/unit-definitions/progress-bar.d.ts +26 -4
  103. package/lib/unit-definitions/reference-collection-combobox.d.ts +19 -4
  104. package/lib/unit-definitions/reference-collection-combobox.js +1 -1
  105. package/lib/unit-definitions/reference-collection-list.d.ts +19 -4
  106. package/lib/unit-definitions/reference-collection-list.js +1 -1
  107. package/lib/unit-definitions/reference-collection-view.d.ts +19 -4
  108. package/lib/unit-definitions/reference-collection-view.js +1 -1
  109. package/lib/unit-definitions/reference-collection.d.ts +23 -4
  110. package/lib/unit-definitions/reference-collection.js +1 -1
  111. package/lib/unit-definitions/reference-combobox.d.ts +19 -4
  112. package/lib/unit-definitions/reference-combobox.js +1 -1
  113. package/lib/unit-definitions/reference-icon.d.ts +27 -4
  114. package/lib/unit-definitions/reference.d.ts +27 -4
  115. package/lib/unit-definitions/rich-text-document.d.ts +23 -4
  116. package/lib/unit-definitions/rich-text-document.js +1 -1
  117. package/lib/unit-definitions/rich-text-snippet.d.ts +25 -5
  118. package/lib/unit-definitions/single-location-preview.d.ts +23 -4
  119. package/lib/unit-definitions/text-input.d.ts +23 -4
  120. package/lib/unit-definitions/text-input.js +1 -1
  121. package/lib/unit-definitions/text.d.ts +23 -4
  122. package/lib/unit-definitions/text.js +1 -1
  123. package/lib/unit-definitions/title-input.d.ts +24 -4
  124. package/lib/unit-definitions/title.d.ts +27 -4
  125. package/lib/unit-definitions/type-badge-abbr.d.ts +15 -4
  126. package/lib/unit-definitions/type-badge.d.ts +15 -4
  127. package/lib/unit-definitions/type-icon.d.ts +15 -4
  128. package/lib/unit-definitions/url-input.d.ts +23 -4
  129. package/lib/unit-definitions/url.d.ts +23 -4
  130. package/lib/unit-definitions/user-button.d.ts +13 -4
  131. package/lib/unit-definitions/user-role-input.d.ts +26 -4
  132. package/lib/unit-definitions/user-role.d.ts +27 -4
  133. package/lib/unit-definitions/user-role.js +1 -1
  134. package/lib/unit-utils/access.d.ts +4 -5
  135. package/lib/unit-utils/can-edit-field.d.ts +4 -5
  136. package/lib/unit-utils/common.d.ts +16 -11
  137. package/lib/unit-utils/decimal.js +4 -4
  138. package/lib/unit-utils/dynamic-keys.d.ts +8 -9
  139. package/lib/unit-utils/enums.d.ts +4 -5
  140. package/lib/unit-utils/formatters.d.ts +15 -16
  141. package/lib/unit-utils/get-export-value.d.ts +18 -19
  142. package/lib/unit-utils/get-field-label.d.ts +4 -5
  143. package/lib/unit-utils/get-unmatched-unit-label.d.ts +2 -3
  144. package/lib/unit-utils/wrap-normalized-in-expression.d.ts +2 -3
  145. package/lib/units/board.d.ts +22 -25
  146. package/lib/units/board.js +2 -1
  147. package/lib/units/canvas/all-units-data-definitions.js +1 -1
  148. package/lib/units/canvas/index.d.ts +19 -24
  149. package/lib/units/canvas/type-badge-abbr.d.ts +13 -35
  150. package/lib/units/canvas/type-badge.d.ts +13 -35
  151. package/lib/units/default.d.ts +21 -22
  152. package/lib/units/default.js +2 -1
  153. package/lib/units/gallery.d.ts +5 -3
  154. package/lib/units/gantt.d.ts +23 -24
  155. package/lib/units/gantt.js +3 -2
  156. package/lib/units/get-unit-definitions-for-view-type.d.ts +4 -4
  157. package/lib/units/grid.d.ts +14 -25
  158. package/lib/units/grid.js +5 -4
  159. package/lib/units/list.d.ts +17 -26
  160. package/lib/units/list.js +2 -1
  161. package/lib/units/make-factory.d.ts +25 -27
  162. package/lib/units/types.d.ts +19 -13
  163. package/package.json +10 -10
@@ -1,7 +1,9 @@
1
- import { PureUnit } from "./types.js";
2
1
  import { getCardUnitsSelect, getHardcodedUnitsForView, getTypeUnits, getUnitDataDefinition, getUnitLabel, getUnitName, getUnitsForField, getUnitsForType, getUnitsForTypePerField } from "./board.js";
3
2
  import { TypeObject } from "@fibery/schema";
4
3
  //#region src/units/gallery.d.ts
5
- declare const getDefaultUnits: (_typeObject: TypeObject) => PureUnit[];
4
+ export declare const getDefaultUnits: (_typeObject: TypeObject) => {
5
+ type: "title";
6
+ kind: "field";
7
+ }[];
6
8
  //#endregion
7
- export { getCardUnitsSelect, getDefaultUnits, getHardcodedUnitsForView, getTypeUnits, getUnitDataDefinition, getUnitLabel, getUnitName, getUnitsForField, getUnitsForType, getUnitsForTypePerField };
9
+ export { getCardUnitsSelect, getHardcodedUnitsForView, getTypeUnits, getUnitDataDefinition, getUnitLabel, getUnitName, getUnitsForField, getUnitsForType, getUnitsForTypePerField };
@@ -1,7 +1,7 @@
1
- import { PureUnit, Unit, UnitExpression } from "./types.js";
1
+ import { ButtonUnit, DbUnit, ExpressionFieldUnit, PureUnit, Unit, UnitExpression } from "./types.js";
2
2
  import { TypeObject } from "@fibery/schema";
3
3
  //#region src/units/gantt.d.ts
4
- declare const getTypeUnits: () => PureUnit[], getUnitName: (unit: Unit) => string | null, getUnitsForType: (typeObject: TypeObject, options?: {
4
+ export declare const getTypeUnits: () => PureUnit[], getUnitName: (unit: Unit) => string | null, getUnitsForType: (typeObject: TypeObject, options?: {
5
5
  parentFieldObjects?: import("@fibery/schema").FieldObject[];
6
6
  showHiddenFields?: boolean;
7
7
  isSharingMode?: boolean;
@@ -23,29 +23,28 @@ declare const getTypeUnits: () => PureUnit[], getUnitName: (unit: Unit) => strin
23
23
  schema: import("@fibery/schema").Schema;
24
24
  typeObject: TypeObject;
25
25
  units: Unit[];
26
- }) => import("@fibery/expression-utils").Select, getUnitLabel: (typeObject: TypeObject, unit: Unit) => string, getHardcodedUnitsForView: (typeObject: TypeObject) => ({
27
- kind: "user-button";
28
- type: "user-button" | "icon-button";
29
- data: {
30
- id: string;
31
- typeId: import("@fibery/schema").TypeId;
32
- };
33
- label: string;
26
+ }) => import("@fibery/schema").Select, getUnitLabel: <U extends Unit>(typeObject: TypeObject, unit: U) => string, getHardcodedUnitsForView: (typeObject: TypeObject) => (Omit<ButtonUnit, "checked"> | Omit<DbUnit, "checked"> | Omit<ExpressionFieldUnit, "checked"> | Omit<{
27
+ kind: "field";
28
+ checked?: boolean;
29
+ settings?: Record<string, unknown>;
34
30
  hideWhenEmpty?: boolean;
35
- icon?: string;
36
- } | {
37
- kind: "db";
38
- type: "type-icon" | "type-badge" | "type-badge-abbr";
31
+ } & {
32
+ type: "id" | "title";
39
33
  expression?: UnitExpression;
40
- hideWhenEmpty?: boolean;
34
+ }, "checked">)[];
35
+ export declare const getDefaultUnits: () => {
36
+ type: "title";
37
+ kind: "field";
38
+ }[];
39
+ export declare const getDefaultLaneUnits: (typeObject: TypeObject) => ({
40
+ type: "avatar";
41
+ kind: "field";
42
+ expression: string[];
41
43
  } | {
44
+ type: "title";
42
45
  kind: "field";
43
- type: "avatar" | "avatar-collection" | "avatar-input" | "back-references-list" | "bool" | "bool-checkbox" | "collection-count" | "color-input" | "comments-list" | "date" | "date-time" | "date-time-range" | "date-time-combobox" | "date-range" | "date-range-combobox" | "email" | "email-input" | "emoji" | "field" | "files-collection" | "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";
44
- expression: UnitExpression;
45
- settings?: Record<string, unknown>;
46
- hideWhenEmpty?: boolean;
47
- })[];
48
- declare const getDefaultUnits: () => PureUnit[];
49
- declare const getDefaultLaneUnits: (typeObject: TypeObject) => PureUnit[];
50
- //#endregion
51
- export { getCardUnitsSelect, getDefaultLaneUnits, getDefaultUnits, getHardcodedUnitsForView, getTypeUnits, getUnitLabel, getUnitName, getUnitsForField, getUnitsForType, getUnitsForTypePerField };
46
+ } | {
47
+ type: "type-badge-abbr";
48
+ kind: "db";
49
+ } | ExpressionFieldUnit)[];
50
+ //#endregion
@@ -2,6 +2,7 @@ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
2
  import { isAvatarExtensionEnabledType } from "../field-utils/avatar.js";
3
3
  import { unit_definitions_exports } from "../unit-definitions/index.js";
4
4
  import { makeUnitDefinitionsFactory } from "./make-factory.js";
5
+ import { truthy } from "@fibery/helpers/src/_";
5
6
  //#region src/units/gantt.ts
6
7
  var gantt_exports = /* @__PURE__ */ __exportAll({
7
8
  getCardUnitsSelect: () => getCardUnitsSelect,
@@ -18,11 +19,11 @@ var gantt_exports = /* @__PURE__ */ __exportAll({
18
19
  const { getTypeUnits, getUnitName, getUnitsForType, getUnitsForField, getUnitsForTypePerField, getCardUnitsSelect, getUnitLabel, getHardcodedUnitsForView } = makeUnitDefinitionsFactory(unit_definitions_exports);
19
20
  const getDefaultUnits = () => {
20
21
  const { Title } = unit_definitions_exports;
21
- return [Title && Title.makeUnit()].filter(Boolean);
22
+ return [Title && Title.makeUnit()].filter(truthy);
22
23
  };
23
24
  const getDefaultLaneUnits = (typeObject) => {
24
25
  const { Title, Avatar, Emoji, TypeBadgeAbbr } = unit_definitions_exports;
25
- return [Title && Title.makeUnit(), typeObject && isAvatarExtensionEnabledType(typeObject) && Avatar && Avatar.makeUnit() || typeObject.isEnum && Boolean(typeObject.getFieldObjectByName("enum/icon")) && Emoji && Emoji.makeUnit({ expression: ["enum/icon"] }) || TypeBadgeAbbr && TypeBadgeAbbr.makeUnit()].filter(Boolean);
26
+ return [Title && Title.makeUnit(), typeObject && isAvatarExtensionEnabledType(typeObject) && Avatar && Avatar.makeUnit() || typeObject.isEnum && Boolean(typeObject.getFieldObjectByName("enum/icon")) && Emoji && Emoji.makeUnit({ expression: ["enum/icon"] }) || TypeBadgeAbbr && TypeBadgeAbbr.makeUnit()].filter(truthy);
26
27
  };
27
28
  //#endregion
28
29
  export { gantt_exports, getCardUnitsSelect, getDefaultLaneUnits, getDefaultUnits, getHardcodedUnitsForView, getTypeUnits, getUnitLabel, getUnitName, getUnitsForField, getUnitsForType, getUnitsForTypePerField };
@@ -1,5 +1,5 @@
1
- import { list_d_exports } from "./list.js";
1
+ import { index_d_exports } from "./canvas/index.js";
2
+ import { default_d_exports } from "./default.js";
2
3
  //#region src/units/get-unit-definitions-for-view-type.d.ts
3
- declare const getUnitDefinitionsForViewType: (viewType: string) => typeof list_d_exports;
4
- //#endregion
5
- export { getUnitDefinitionsForViewType };
4
+ export declare const getUnitDefinitionsForViewType: (viewType: string) => typeof default_d_exports | typeof index_d_exports;
5
+ //#endregion
@@ -1,6 +1,6 @@
1
- import { PureUnit, Unit, UnitExpression } from "./types.js";
1
+ import { ButtonUnit, DbUnit, ExpressionFieldUnit, PureUnit, Unit, UnitExpression } from "./types.js";
2
2
  //#region src/units/grid.d.ts
3
- declare const getTypeUnits: () => PureUnit[], getUnitName: (unit: Unit) => string | null, getUnitsForType: (typeObject: import("@fibery/schema").TypeObject, options?: {
3
+ export declare const getTypeUnits: () => PureUnit[], getUnitName: (unit: Unit) => string | null, getUnitsForType: (typeObject: import("@fibery/schema").TypeObject, options?: {
4
4
  parentFieldObjects?: import("@fibery/schema").FieldObject[];
5
5
  showHiddenFields?: boolean;
6
6
  isSharingMode?: boolean;
@@ -18,32 +18,21 @@ declare const getTypeUnits: () => PureUnit[], getUnitName: (unit: Unit) => strin
18
18
  }) => {
19
19
  fieldObject: import("@fibery/schema").FieldObject;
20
20
  units: Unit[];
21
- }[], getUnitLabel: (typeObject: import("@fibery/schema").TypeObject, unit: Unit) => string, getCardUnitsSelect: ({ schema, typeObject, units }: {
21
+ }[], getUnitLabel: <U extends Unit>(typeObject: import("@fibery/schema").TypeObject, unit: U) => string, getCardUnitsSelect: ({ schema, typeObject, units }: {
22
22
  schema: import("@fibery/schema").Schema;
23
23
  typeObject: import("@fibery/schema").TypeObject;
24
24
  units: Unit[];
25
- }) => import("@fibery/expression-utils").Select, getHardcodedUnitsForView: (typeObject: import("@fibery/schema").TypeObject) => ({
26
- kind: "user-button";
27
- type: "user-button" | "icon-button";
28
- data: {
29
- id: string;
30
- typeId: import("@fibery/schema").TypeId;
31
- };
32
- label: string;
33
- hideWhenEmpty?: boolean;
34
- icon?: string;
35
- } | {
36
- kind: "db";
37
- type: "type-icon" | "type-badge" | "type-badge-abbr";
38
- expression?: UnitExpression;
39
- hideWhenEmpty?: boolean;
40
- } | {
25
+ }) => import("@fibery/schema").Select, getHardcodedUnitsForView: (typeObject: import("@fibery/schema").TypeObject) => (Omit<ButtonUnit, "checked"> | Omit<DbUnit, "checked"> | Omit<ExpressionFieldUnit, "checked"> | Omit<{
41
26
  kind: "field";
42
- type: "avatar" | "avatar-collection" | "avatar-input" | "back-references-list" | "bool" | "bool-checkbox" | "collection-count" | "color-input" | "comments-list" | "date" | "date-time" | "date-time-range" | "date-time-combobox" | "date-range" | "date-range-combobox" | "email" | "email-input" | "emoji" | "field" | "files-collection" | "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";
43
- expression: UnitExpression;
27
+ checked?: boolean;
44
28
  settings?: Record<string, unknown>;
45
29
  hideWhenEmpty?: boolean;
46
- })[];
47
- declare const getDefaultUnits: () => PureUnit[];
48
- //#endregion
49
- export { getCardUnitsSelect, getDefaultUnits, getHardcodedUnitsForView, getTypeUnits, getUnitLabel, getUnitName, getUnitsForField, getUnitsForType, getUnitsForTypePerField };
30
+ } & {
31
+ type: "id" | "title";
32
+ expression?: UnitExpression;
33
+ }, "checked">)[];
34
+ export declare const getDefaultUnits: () => {
35
+ type: "title";
36
+ kind: "field";
37
+ }[];
38
+ //#endregion
package/lib/units/grid.js CHANGED
@@ -3,11 +3,13 @@ import { AvatarCollection } from "../unit-definitions/avatar-collection.js";
3
3
  import { Avatar } from "../unit-definitions/avatar.js";
4
4
  import { Bool } from "../unit-definitions/bool.js";
5
5
  import { CollectionCount } from "../unit-definitions/collection-count.js";
6
- import { Date } from "../unit-definitions/date.js";
7
6
  import { DateRange } from "../unit-definitions/date-range.js";
7
+ import { Date } from "../unit-definitions/date.js";
8
8
  import { Text } from "../unit-definitions/text.js";
9
9
  import { Email } from "../unit-definitions/email.js";
10
10
  import { Emoji } from "../unit-definitions/emoji.js";
11
+ import { FileCollectionCount } from "../unit-definitions/file-collection-count.js";
12
+ import { FilesGallery } from "../unit-definitions/files-gallery.js";
11
13
  import { IconButton } from "../unit-definitions/icon-button.js";
12
14
  import { Id } from "../unit-definitions/id.js";
13
15
  import { Location } from "../unit-definitions/location.js";
@@ -25,9 +27,8 @@ import { TypeIcon } from "../unit-definitions/type-icon.js";
25
27
  import { Url } from "../unit-definitions/url.js";
26
28
  import { UserButton } from "../unit-definitions/user-button.js";
27
29
  import { UserRole } from "../unit-definitions/user-role.js";
28
- import { FileCollectionCount } from "../unit-definitions/file-collection-count.js";
29
30
  import { makeUnitDefinitionsFactory } from "./make-factory.js";
30
- import { FilesGallery } from "../unit-definitions/files-gallery.js";
31
+ import { truthy } from "@fibery/helpers/src/_";
31
32
  import { FileReference } from "@fibery/views/src/unit-definitions/file-reference";
32
33
  //#region src/units/grid.ts
33
34
  var grid_exports = /* @__PURE__ */ __exportAll({
@@ -75,7 +76,7 @@ const allUnitDefinitions = {
75
76
  const { getTypeUnits, getUnitName, getUnitsForType, getUnitsForField, getUnitsForTypePerField, getUnitLabel, getCardUnitsSelect, getHardcodedUnitsForView } = makeUnitDefinitionsFactory(allUnitDefinitions);
76
77
  const getDefaultUnits = () => {
77
78
  const { Title } = allUnitDefinitions;
78
- return [Title && Title.makeUnit()].filter(Boolean);
79
+ return [Title && Title.makeUnit()].filter(truthy);
79
80
  };
80
81
  //#endregion
81
82
  export { getCardUnitsSelect, getDefaultUnits, getHardcodedUnitsForView, getTypeUnits, getUnitLabel, getUnitName, getUnitsForField, getUnitsForType, getUnitsForTypePerField, grid_exports };
@@ -1,9 +1,7 @@
1
- import { PureUnit, Unit, UnitExpression } from "./types.js";
1
+ import { ButtonUnit, DbUnit, ExpressionFieldUnit, PureUnit, Unit, UnitExpression } from "./types.js";
2
2
  import { TypeObject } from "@fibery/schema";
3
- declare namespace list_d_exports {
4
- export { getCardUnitsSelect, getDefaultUnits, getHardcodedUnitsForView, getTypeUnits, getUnitLabel, getUnitName, getUnitsForField, getUnitsForType, getUnitsForTypePerField };
5
- }
6
- declare const getTypeUnits: () => PureUnit[], getUnitName: (unit: Unit) => string | null, getUnitsForType: (typeObject: TypeObject, options?: {
3
+ //#region src/units/list.d.ts
4
+ export declare const getTypeUnits: () => PureUnit[], getUnitName: (unit: Unit) => string | null, getUnitsForType: (typeObject: TypeObject, options?: {
7
5
  parentFieldObjects?: import("@fibery/schema").FieldObject[];
8
6
  showHiddenFields?: boolean;
9
7
  isSharingMode?: boolean;
@@ -21,32 +19,25 @@ declare const getTypeUnits: () => PureUnit[], getUnitName: (unit: Unit) => strin
21
19
  }) => {
22
20
  fieldObject: import("@fibery/schema").FieldObject;
23
21
  units: Unit[];
24
- }[], getUnitLabel: (typeObject: TypeObject, unit: Unit) => string, getCardUnitsSelect: ({ schema, typeObject, units }: {
22
+ }[], getUnitLabel: <U extends Unit>(typeObject: TypeObject, unit: U) => string, getCardUnitsSelect: ({ schema, typeObject, units }: {
25
23
  schema: import("@fibery/schema").Schema;
26
24
  typeObject: TypeObject;
27
25
  units: Unit[];
28
- }) => import("@fibery/expression-utils").Select, getHardcodedUnitsForView: (typeObject: TypeObject) => ({
29
- kind: "user-button";
30
- type: "user-button" | "icon-button";
31
- data: {
32
- id: string;
33
- typeId: import("@fibery/schema").TypeId;
34
- };
35
- label: string;
26
+ }) => import("@fibery/schema").Select, getHardcodedUnitsForView: (typeObject: TypeObject) => (Omit<ButtonUnit, "checked"> | Omit<DbUnit, "checked"> | Omit<ExpressionFieldUnit, "checked"> | Omit<{
27
+ kind: "field";
28
+ checked?: boolean;
29
+ settings?: Record<string, unknown>;
36
30
  hideWhenEmpty?: boolean;
37
- icon?: string;
38
- } | {
39
- kind: "db";
40
- type: "type-icon" | "type-badge" | "type-badge-abbr";
31
+ } & {
32
+ type: "id" | "title";
41
33
  expression?: UnitExpression;
42
- hideWhenEmpty?: boolean;
34
+ }, "checked">)[];
35
+ export declare const getDefaultUnits: (typeObject: TypeObject) => ({
36
+ type: "avatar";
37
+ kind: "field";
38
+ expression: string[];
43
39
  } | {
40
+ type: "title";
44
41
  kind: "field";
45
- type: "avatar" | "avatar-collection" | "avatar-input" | "back-references-list" | "bool" | "bool-checkbox" | "collection-count" | "color-input" | "comments-list" | "date" | "date-time" | "date-time-range" | "date-time-combobox" | "date-range" | "date-range-combobox" | "email" | "email-input" | "emoji" | "field" | "files-collection" | "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";
46
- expression: UnitExpression;
47
- settings?: Record<string, unknown>;
48
- hideWhenEmpty?: boolean;
49
42
  })[];
50
- declare const getDefaultUnits: (typeObject: TypeObject) => (false | PureUnit)[];
51
- //#endregion
52
- export { getCardUnitsSelect, getDefaultUnits, getHardcodedUnitsForView, getTypeUnits, getUnitLabel, getUnitName, getUnitsForField, getUnitsForType, getUnitsForTypePerField, list_d_exports };
43
+ //#endregion
package/lib/units/list.js CHANGED
@@ -2,6 +2,7 @@ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
2
2
  import { isAvatarExtensionEnabledType } from "../field-utils/avatar.js";
3
3
  import { unit_definitions_exports } from "../unit-definitions/index.js";
4
4
  import { makeUnitDefinitionsFactory } from "./make-factory.js";
5
+ import { truthy } from "@fibery/helpers/src/_";
5
6
  //#region src/units/list.ts
6
7
  var list_exports = /* @__PURE__ */ __exportAll({
7
8
  getCardUnitsSelect: () => getCardUnitsSelect,
@@ -17,7 +18,7 @@ var list_exports = /* @__PURE__ */ __exportAll({
17
18
  const { getTypeUnits, getUnitName, getUnitsForType, getUnitsForField, getUnitsForTypePerField, getUnitLabel, getCardUnitsSelect, getHardcodedUnitsForView } = makeUnitDefinitionsFactory(unit_definitions_exports);
18
19
  const getDefaultUnits = (typeObject) => {
19
20
  const { Title, Avatar } = unit_definitions_exports;
20
- return [Title && Title.makeUnit(), typeObject && isAvatarExtensionEnabledType(typeObject) && Avatar && Avatar.makeUnit()].filter(Boolean);
21
+ return [Title && Title.makeUnit(), typeObject && isAvatarExtensionEnabledType(typeObject) && Avatar && Avatar.makeUnit()].filter(truthy);
21
22
  };
22
23
  //#endregion
23
24
  export { getCardUnitsSelect, getDefaultUnits, getHardcodedUnitsForView, getTypeUnits, getUnitLabel, getUnitName, getUnitsForField, getUnitsForType, getUnitsForTypePerField, list_exports };
@@ -1,13 +1,25 @@
1
- import { ButtonUnit, DbUnit, FieldUnit, PureUnit, Unit, UnitDataDefinition, UnitExpression } from "./types.js";
1
+ import { ButtonUnit, DbUnit, ExpressionFieldUnit, FieldUnit, PureUnit, Unit, UnitDataDefinition, UnitExpression } from "./types.js";
2
+ import { MissingUnitDefinition } from "../unit-definitions/not-found.js";
2
3
  import { FieldObject, Schema, TypeObject } from "@fibery/schema";
3
4
  //#region src/units/make-factory.d.ts
4
- type AnyUnitDataDefinition = UnitDataDefinition<FieldUnit> | UnitDataDefinition<DbUnit> | UnitDataDefinition<ButtonUnit>;
5
+ type AnyUnitDataDefinition = (UnitDataDefinition<FieldUnit & {
6
+ type: "id" | "title";
7
+ }> & {
8
+ type: "id" | "title";
9
+ }) | (UnitDataDefinition<ExpressionFieldUnit> & {
10
+ type: Exclude<ExpressionFieldUnit["type"], "id" | "title" | "icon-button">;
11
+ }) | UnitDataDefinition<DbUnit> | (UnitDataDefinition<ButtonUnit> & {
12
+ type: "user-button";
13
+ }) | (UnitDataDefinition<ExpressionFieldUnit | ButtonUnit> & {
14
+ type: "icon-button";
15
+ });
16
+ export type UnitDefinitionRegistry = Record<string, AnyUnitDataDefinition>;
5
17
  type UnitCreationOptions = {
6
18
  parentFieldObjects?: FieldObject[];
7
19
  showHiddenFields?: boolean;
8
20
  isSharingMode?: boolean;
9
21
  };
10
- declare const makeUnitDefinitionsFactory: (allUnitDefinitions: Record<string, AnyUnitDataDefinition>) => {
22
+ export declare const makeUnitDefinitionsFactory: (allUnitDefinitions: UnitDefinitionRegistry) => {
11
23
  getTypeUnits: () => PureUnit[];
12
24
  getUnitsForType: (typeObject: TypeObject, options?: UnitCreationOptions) => {
13
25
  unit: Unit;
@@ -18,36 +30,22 @@ declare const makeUnitDefinitionsFactory: (allUnitDefinitions: Record<string, An
18
30
  units: Unit[];
19
31
  }[];
20
32
  getUnitsForField: (fieldObject: FieldObject, options?: UnitCreationOptions) => Unit[];
21
- getHardcodedUnitsForView: (typeObject: TypeObject) => ({
22
- kind: "user-button";
23
- type: "user-button" | "icon-button";
24
- data: {
25
- id: string;
26
- typeId: import("@fibery/schema").TypeId;
27
- };
28
- label: string;
29
- hideWhenEmpty?: boolean;
30
- icon?: string;
31
- } | {
32
- kind: "db";
33
- type: "type-icon" | "type-badge" | "type-badge-abbr";
34
- expression?: UnitExpression;
35
- hideWhenEmpty?: boolean;
36
- } | {
33
+ getHardcodedUnitsForView: (typeObject: TypeObject) => (Omit<ButtonUnit, "checked"> | Omit<DbUnit, "checked"> | Omit<ExpressionFieldUnit, "checked"> | Omit<{
37
34
  kind: "field";
38
- type: "avatar" | "avatar-collection" | "avatar-input" | "back-references-list" | "bool" | "bool-checkbox" | "collection-count" | "color-input" | "comments-list" | "date" | "date-time" | "date-time-range" | "date-time-combobox" | "date-range" | "date-range-combobox" | "email" | "email-input" | "emoji" | "field" | "files-collection" | "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";
39
- expression: UnitExpression;
35
+ checked?: boolean;
40
36
  settings?: Record<string, unknown>;
41
37
  hideWhenEmpty?: boolean;
42
- })[];
43
- getUnitLabel: (typeObject: TypeObject, unit: Unit) => string;
38
+ } & {
39
+ type: "id" | "title";
40
+ expression?: UnitExpression;
41
+ }, "checked">)[];
42
+ getUnitLabel: <U extends Unit>(typeObject: TypeObject, unit: U) => string;
44
43
  getUnitName: (unit: Unit) => string | null;
45
44
  getCardUnitsSelect: ({ schema, typeObject, units }: {
46
45
  schema: Schema;
47
46
  typeObject: TypeObject;
48
47
  units: Unit[];
49
- }) => import("@fibery/expression-utils").Select;
50
- getUnitDataDefinition: (unit: Unit) => AnyUnitDataDefinition;
48
+ }) => import("@fibery/schema").Select;
49
+ getUnitDataDefinition: (unit: Unit) => UnitDataDefinition<Unit> | MissingUnitDefinition;
51
50
  };
52
- //#endregion
53
- export { makeUnitDefinitionsFactory };
51
+ //#endregion
@@ -2,7 +2,7 @@ import { NumberDisplaySettings } from "../field-utils/number.js";
2
2
  import { Schema, TypeId, TypeObject } from "@fibery/schema";
3
3
  import { FiberyObject } from "@fibery/expression-utils/src/types";
4
4
  //#region src/units/types.d.ts
5
- type ButtonUnit = {
5
+ export type ButtonUnit = {
6
6
  kind: "user-button";
7
7
  type: "user-button" | "icon-button";
8
8
  data: {
@@ -14,27 +14,34 @@ type ButtonUnit = {
14
14
  hideWhenEmpty?: boolean;
15
15
  icon?: string;
16
16
  };
17
- type UnitExpression = string[];
18
- type DbUnit = {
17
+ export type UnitExpression = string[];
18
+ export type DbUnit = {
19
19
  kind: "db";
20
20
  type: "type-icon" | "type-badge" | "type-badge-abbr";
21
21
  expression?: UnitExpression;
22
22
  checked?: boolean;
23
23
  hideWhenEmpty?: boolean;
24
24
  };
25
- type FieldUnit = {
25
+ type FieldUnitMetadata = {
26
26
  kind: "field";
27
- type: "avatar" | "avatar-collection" | "avatar-input" | "back-references-list" | "bool" | "bool-checkbox" | "collection-count" | "color-input" | "comments-list" | "date" | "date-time" | "date-time-range" | "date-time-combobox" | "date-range" | "date-range-combobox" | "email" | "email-input" | "emoji" | "field" | "files-collection" | "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: UnitExpression;
29
27
  checked?: boolean;
30
28
  settings?: Record<string, unknown>;
31
29
  hideWhenEmpty?: boolean;
32
30
  };
33
- type Unit = FieldUnit | ButtonUnit | DbUnit;
34
- type ToPure<T extends Unit> = Omit<T, "checked">;
35
- type PureUnit = ToPure<FieldUnit> | ToPure<ButtonUnit> | ToPure<DbUnit>;
36
- type UnitDataDefinition<T extends Unit> = {
37
- type: string;
31
+ type FieldUnitType = "avatar" | "avatar-collection" | "avatar-input" | "back-references-list" | "bool" | "bool-checkbox" | "collection-count" | "color-input" | "comments-collection" | "comments-list" | "date" | "date-time" | "date-time-range" | "date-time-combobox" | "date-range" | "date-range-combobox" | "email" | "email-input" | "emoji" | "field" | "files-collection" | "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";
32
+ export type ExpressionFieldUnit = FieldUnitMetadata & {
33
+ type: FieldUnitType;
34
+ expression: UnitExpression;
35
+ };
36
+ export type FieldUnit = ExpressionFieldUnit | (FieldUnitMetadata & {
37
+ type: "id" | "title";
38
+ expression?: UnitExpression;
39
+ });
40
+ export type Unit = FieldUnit | ButtonUnit | DbUnit;
41
+ type ToPure<T extends Unit> = T extends Unit ? Omit<T, "checked"> : never;
42
+ export type PureUnit = ToPure<FieldUnit> | ToPure<ButtonUnit> | ToPure<DbUnit>;
43
+ export type UnitDataDefinition<T extends Unit> = {
44
+ type: T["type"];
38
45
  name: string;
39
46
  canEdit: (params: {
40
47
  typeObject: TypeObject;
@@ -70,5 +77,4 @@ type UnitDataDefinition<T extends Unit> = {
70
77
  unit: T;
71
78
  }) => string;
72
79
  };
73
- //#endregion
74
- export { ButtonUnit, DbUnit, FieldUnit, PureUnit, Unit, UnitDataDefinition, UnitExpression };
80
+ //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/views",
3
- "version": "25.1.4",
3
+ "version": "26.0.0",
4
4
  "description": "Operations on view objects",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Fibery",
@@ -30,17 +30,17 @@
30
30
  }
31
31
  },
32
32
  "dependencies": {
33
+ "@fibery/expression-utils": "17.0.0",
34
+ "@fibery/helpers": "5.0.0",
35
+ "@fibery/query-utils": "7.2.4",
36
+ "@fibery/schema": "13.1.0",
33
37
  "date-fns": "2.29.2",
34
- "lodash": "4.17.21",
35
- "moment": "2.31.0",
36
- "@fibery/expression-utils": "16.0.4",
37
- "@fibery/helpers": "4.2.1",
38
- "@fibery/query-utils": "7.2.3",
39
- "@fibery/schema": "13.0.2"
38
+ "lodash": "4.18.1",
39
+ "moment": "2.31.0"
40
40
  },
41
41
  "peerDependencies": {
42
- "@fibery/expression-utils": "^16.0.4",
43
- "@fibery/schema": "^13.0.2",
44
- "lodash": "4.17.21"
42
+ "@fibery/expression-utils": "^17.0.0",
43
+ "@fibery/schema": "^13.1.0",
44
+ "lodash": "4.18.1"
45
45
  }
46
46
  }