@fibery/views 26.0.5 → 26.0.7

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 (231) hide show
  1. package/lib/_virtual/_rolldown/runtime.js +1 -2
  2. package/lib/errors.d.ts +1 -3
  3. package/lib/errors.js +1 -2
  4. package/lib/field-utils/avatar.d.ts +1 -3
  5. package/lib/field-utils/avatar.js +1 -2
  6. package/lib/field-utils/back-references.d.ts +1 -3
  7. package/lib/field-utils/back-references.js +1 -2
  8. package/lib/field-utils/comments.d.ts +1 -3
  9. package/lib/field-utils/comments.js +1 -2
  10. package/lib/field-utils/date-time.d.ts +1 -3
  11. package/lib/field-utils/date-time.js +1 -2
  12. package/lib/field-utils/enum-value.d.ts +1 -3
  13. package/lib/field-utils/enum-value.js +1 -2
  14. package/lib/field-utils/file.d.ts +1 -3
  15. package/lib/field-utils/file.js +1 -2
  16. package/lib/field-utils/icon.d.ts +1 -3
  17. package/lib/field-utils/icon.js +1 -2
  18. package/lib/field-utils/number.d.ts +1 -3
  19. package/lib/field-utils/number.js +5 -8
  20. package/lib/field-utils/reference-collection.d.ts +1 -3
  21. package/lib/field-utils/reference-collection.js +5 -7
  22. package/lib/field-utils/reference.d.ts +1 -3
  23. package/lib/field-utils/reference.js +3 -4
  24. package/lib/field-utils/relation-view.d.ts +1 -3
  25. package/lib/field-utils/relation-view.js +1 -2
  26. package/lib/field-utils/rich-text.d.ts +1 -3
  27. package/lib/field-utils/rich-text.js +1 -2
  28. package/lib/field-utils/text.d.ts +1 -3
  29. package/lib/field-utils/text.js +1 -2
  30. package/lib/field-utils/user-active.d.ts +1 -3
  31. package/lib/field-utils/user-active.js +1 -2
  32. package/lib/field-utils/user-role.d.ts +1 -3
  33. package/lib/field-utils/user-role.js +1 -2
  34. package/lib/field-utils/workflow.d.ts +1 -3
  35. package/lib/field-utils/workflow.js +1 -2
  36. package/lib/filter.d.ts +1 -3
  37. package/lib/index.d.ts +2 -4
  38. package/lib/index.js +2 -3
  39. package/lib/meta-validation.d.ts +1 -3
  40. package/lib/meta-validation.js +7 -12
  41. package/lib/private/board.d.ts +3 -4
  42. package/lib/private/board.js +6 -7
  43. package/lib/private/calendar.d.ts +1 -3
  44. package/lib/private/calendar.js +2 -3
  45. package/lib/private/feed.d.ts +1 -3
  46. package/lib/private/feed.js +2 -3
  47. package/lib/private/form.d.ts +1 -3
  48. package/lib/private/form.js +1 -2
  49. package/lib/private/map.d.ts +1 -3
  50. package/lib/private/map.js +2 -3
  51. package/lib/private/smart-folder.d.ts +1 -3
  52. package/lib/private/smart-folder.js +2 -3
  53. package/lib/private/timeline.d.ts +1 -3
  54. package/lib/private/timeline.js +7 -8
  55. package/lib/private/units.d.ts +1 -3
  56. package/lib/private/units.js +17 -2
  57. package/lib/private/utils.d.ts +1 -3
  58. package/lib/private/utils.js +3 -5
  59. package/lib/refs.d.ts +1 -3
  60. package/lib/unit-definitions/avatar-collection.d.ts +1 -3
  61. package/lib/unit-definitions/avatar-collection.js +1 -2
  62. package/lib/unit-definitions/avatar-input.d.ts +2 -4
  63. package/lib/unit-definitions/avatar-input.js +1 -2
  64. package/lib/unit-definitions/avatar.d.ts +2 -4
  65. package/lib/unit-definitions/avatar.js +1 -2
  66. package/lib/unit-definitions/back-references-list.d.ts +3 -5
  67. package/lib/unit-definitions/back-references-list.js +2 -3
  68. package/lib/unit-definitions/bool-checkbox.d.ts +2 -4
  69. package/lib/unit-definitions/bool-checkbox.js +2 -3
  70. package/lib/unit-definitions/bool.d.ts +2 -4
  71. package/lib/unit-definitions/bool.js +2 -3
  72. package/lib/unit-definitions/collection-count.d.ts +2 -4
  73. package/lib/unit-definitions/collection-count.js +1 -2
  74. package/lib/unit-definitions/color-input.d.ts +2 -4
  75. package/lib/unit-definitions/color-input.js +2 -3
  76. package/lib/unit-definitions/comments-list.d.ts +2 -4
  77. package/lib/unit-definitions/comments-list.js +2 -3
  78. package/lib/unit-definitions/date-range-combobox.d.ts +2 -4
  79. package/lib/unit-definitions/date-range-combobox.js +2 -3
  80. package/lib/unit-definitions/date-range.d.ts +2 -4
  81. package/lib/unit-definitions/date-range.js +2 -3
  82. package/lib/unit-definitions/date-time-combobox.d.ts +2 -4
  83. package/lib/unit-definitions/date-time-combobox.js +2 -3
  84. package/lib/unit-definitions/date.d.ts +2 -4
  85. package/lib/unit-definitions/date.js +2 -3
  86. package/lib/unit-definitions/email-input.d.ts +4 -6
  87. package/lib/unit-definitions/email-input.js +1 -2
  88. package/lib/unit-definitions/email.d.ts +3 -5
  89. package/lib/unit-definitions/email.js +1 -2
  90. package/lib/unit-definitions/emoji.d.ts +3 -5
  91. package/lib/unit-definitions/emoji.js +1 -2
  92. package/lib/unit-definitions/file-collection-count.d.ts +2 -4
  93. package/lib/unit-definitions/file-collection-count.js +2 -3
  94. package/lib/unit-definitions/file-compact-collection.d.ts +2 -4
  95. package/lib/unit-definitions/file-compact-collection.js +2 -3
  96. package/lib/unit-definitions/file-compact-reference.d.ts +1 -3
  97. package/lib/unit-definitions/file-compact-reference.js +1 -2
  98. package/lib/unit-definitions/file-reference.d.ts +2 -4
  99. package/lib/unit-definitions/file-reference.js +2 -3
  100. package/lib/unit-definitions/files-gallery.d.ts +2 -4
  101. package/lib/unit-definitions/files-gallery.js +2 -3
  102. package/lib/unit-definitions/files-l-list-item.d.ts +2 -4
  103. package/lib/unit-definitions/files-l-list-item.js +2 -3
  104. package/lib/unit-definitions/files-l-list.d.ts +2 -4
  105. package/lib/unit-definitions/files-l-list.js +2 -3
  106. package/lib/unit-definitions/files-list-item.d.ts +2 -4
  107. package/lib/unit-definitions/files-list-item.js +2 -3
  108. package/lib/unit-definitions/files-list.d.ts +2 -4
  109. package/lib/unit-definitions/files-list.js +2 -3
  110. package/lib/unit-definitions/geometry-preview.d.ts +3 -5
  111. package/lib/unit-definitions/geometry-preview.js +1 -2
  112. package/lib/unit-definitions/icon-button.d.ts +2 -4
  113. package/lib/unit-definitions/icon-button.js +2 -3
  114. package/lib/unit-definitions/icon-input.d.ts +4 -6
  115. package/lib/unit-definitions/icon-input.js +1 -2
  116. package/lib/unit-definitions/id.d.ts +1 -3
  117. package/lib/unit-definitions/id.js +1 -2
  118. package/lib/unit-definitions/index.d.ts +4 -3
  119. package/lib/unit-definitions/index.js +6 -5
  120. package/lib/unit-definitions/json-input.d.ts +2 -4
  121. package/lib/unit-definitions/json-input.js +2 -3
  122. package/lib/unit-definitions/json-preview.d.ts +26 -0
  123. package/lib/unit-definitions/json-preview.js +31 -0
  124. package/lib/unit-definitions/location-input.d.ts +3 -5
  125. package/lib/unit-definitions/location-input.js +1 -2
  126. package/lib/unit-definitions/location.d.ts +3 -5
  127. package/lib/unit-definitions/location.js +1 -2
  128. package/lib/unit-definitions/not-found.d.ts +1 -3
  129. package/lib/unit-definitions/not-found.js +0 -1
  130. package/lib/unit-definitions/number-input.d.ts +2 -4
  131. package/lib/unit-definitions/number-input.js +2 -3
  132. package/lib/unit-definitions/number.d.ts +1 -3
  133. package/lib/unit-definitions/number.js +1 -2
  134. package/lib/unit-definitions/phone-input.d.ts +4 -6
  135. package/lib/unit-definitions/phone-input.js +1 -2
  136. package/lib/unit-definitions/phone.d.ts +4 -6
  137. package/lib/unit-definitions/phone.js +1 -2
  138. package/lib/unit-definitions/progress-bar.d.ts +1 -3
  139. package/lib/unit-definitions/progress-bar.js +1 -2
  140. package/lib/unit-definitions/reference-collection-combobox.d.ts +2 -4
  141. package/lib/unit-definitions/reference-collection-combobox.js +2 -3
  142. package/lib/unit-definitions/reference-collection-list.d.ts +2 -4
  143. package/lib/unit-definitions/reference-collection-list.js +2 -3
  144. package/lib/unit-definitions/reference-collection-view.d.ts +2 -4
  145. package/lib/unit-definitions/reference-collection-view.js +2 -3
  146. package/lib/unit-definitions/reference-collection.d.ts +2 -4
  147. package/lib/unit-definitions/reference-collection.js +2 -3
  148. package/lib/unit-definitions/reference-combobox.d.ts +2 -4
  149. package/lib/unit-definitions/reference-combobox.js +2 -3
  150. package/lib/unit-definitions/reference-icon.d.ts +3 -5
  151. package/lib/unit-definitions/reference-icon.js +1 -2
  152. package/lib/unit-definitions/reference.d.ts +1 -3
  153. package/lib/unit-definitions/reference.js +1 -2
  154. package/lib/unit-definitions/rich-text-document.d.ts +2 -4
  155. package/lib/unit-definitions/rich-text-document.js +2 -3
  156. package/lib/unit-definitions/rich-text-snippet.d.ts +1 -3
  157. package/lib/unit-definitions/rich-text-snippet.js +1 -2
  158. package/lib/unit-definitions/single-location-preview.d.ts +3 -5
  159. package/lib/unit-definitions/single-location-preview.js +1 -2
  160. package/lib/unit-definitions/text-input.d.ts +2 -4
  161. package/lib/unit-definitions/text-input.js +2 -3
  162. package/lib/unit-definitions/text.d.ts +2 -4
  163. package/lib/unit-definitions/text.js +2 -3
  164. package/lib/unit-definitions/title-input.d.ts +1 -3
  165. package/lib/unit-definitions/title-input.js +1 -2
  166. package/lib/unit-definitions/title.d.ts +2 -4
  167. package/lib/unit-definitions/title.js +1 -2
  168. package/lib/unit-definitions/type-badge-abbr.d.ts +1 -3
  169. package/lib/unit-definitions/type-badge-abbr.js +1 -2
  170. package/lib/unit-definitions/type-badge.d.ts +1 -3
  171. package/lib/unit-definitions/type-badge.js +1 -2
  172. package/lib/unit-definitions/type-icon.d.ts +1 -3
  173. package/lib/unit-definitions/type-icon.js +1 -2
  174. package/lib/unit-definitions/url-input.d.ts +4 -6
  175. package/lib/unit-definitions/url-input.js +1 -2
  176. package/lib/unit-definitions/url.d.ts +3 -5
  177. package/lib/unit-definitions/url.js +1 -2
  178. package/lib/unit-definitions/user-button.d.ts +1 -3
  179. package/lib/unit-definitions/user-button.js +1 -2
  180. package/lib/unit-definitions/user-role-input.d.ts +3 -5
  181. package/lib/unit-definitions/user-role-input.js +1 -2
  182. package/lib/unit-definitions/user-role.d.ts +3 -5
  183. package/lib/unit-definitions/user-role.js +2 -3
  184. package/lib/unit-utils/access.d.ts +1 -3
  185. package/lib/unit-utils/access.js +1 -2
  186. package/lib/unit-utils/can-edit-field.d.ts +1 -3
  187. package/lib/unit-utils/can-edit-field.js +1 -2
  188. package/lib/unit-utils/common.d.ts +2 -4
  189. package/lib/unit-utils/common.js +1 -2
  190. package/lib/unit-utils/decimal.d.ts +0 -2
  191. package/lib/unit-utils/decimal.js +1 -2
  192. package/lib/unit-utils/dynamic-keys.d.ts +1 -3
  193. package/lib/unit-utils/dynamic-keys.js +1 -2
  194. package/lib/unit-utils/enums.d.ts +1 -3
  195. package/lib/unit-utils/enums.js +2 -3
  196. package/lib/unit-utils/formatters.d.ts +1 -3
  197. package/lib/unit-utils/formatters.js +2 -4
  198. package/lib/unit-utils/get-export-value.d.ts +1 -3
  199. package/lib/unit-utils/get-export-value.js +1 -2
  200. package/lib/unit-utils/get-field-label.d.ts +1 -3
  201. package/lib/unit-utils/get-field-label.js +1 -2
  202. package/lib/unit-utils/get-unmatched-unit-label.d.ts +1 -3
  203. package/lib/unit-utils/get-unmatched-unit-label.js +2 -4
  204. package/lib/unit-utils/wrap-normalized-in-expression.d.ts +1 -3
  205. package/lib/unit-utils/wrap-normalized-in-expression.js +1 -2
  206. package/lib/units/board.d.ts +1 -3
  207. package/lib/units/board.js +1 -2
  208. package/lib/units/canvas/all-units-data-definitions.d.ts +5 -5
  209. package/lib/units/canvas/all-units-data-definitions.js +6 -7
  210. package/lib/units/canvas/index.d.ts +0 -1
  211. package/lib/units/canvas/index.js +1 -2
  212. package/lib/units/canvas/type-badge-abbr.d.ts +1 -3
  213. package/lib/units/canvas/type-badge-abbr.js +1 -2
  214. package/lib/units/canvas/type-badge.d.ts +1 -3
  215. package/lib/units/canvas/type-badge.js +1 -2
  216. package/lib/units/default.d.ts +0 -1
  217. package/lib/units/default.js +1 -2
  218. package/lib/units/gallery.d.ts +0 -2
  219. package/lib/units/gallery.js +1 -2
  220. package/lib/units/gantt.d.ts +1 -3
  221. package/lib/units/gantt.js +1 -2
  222. package/lib/units/get-unit-definitions-for-view-type.d.ts +1 -3
  223. package/lib/units/get-unit-definitions-for-view-type.js +2 -3
  224. package/lib/units/grid.d.ts +1 -3
  225. package/lib/units/grid.js +8 -7
  226. package/lib/units/list.d.ts +1 -3
  227. package/lib/units/list.js +1 -2
  228. package/lib/units/make-factory.d.ts +1 -3
  229. package/lib/units/make-factory.js +21 -28
  230. package/lib/units/types.d.ts +2 -4
  231. package/package.json +7 -9
@@ -3,7 +3,7 @@ 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
5
  import { truthy } from "@fibery/helpers/src/_";
6
- //#region src/units/gantt.ts
6
+ // src/units/gantt.ts
7
7
  var gantt_exports = /* @__PURE__ */ __exportAll({
8
8
  getCardUnitsSelect: () => getCardUnitsSelect,
9
9
  getDefaultLaneUnits: () => getDefaultLaneUnits,
@@ -25,5 +25,4 @@ const getDefaultLaneUnits = (typeObject) => {
25
25
  const { Title, Avatar, Emoji, TypeBadgeAbbr } = unit_definitions_exports;
26
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);
27
27
  };
28
- //#endregion
29
28
  export { gantt_exports, getCardUnitsSelect, getDefaultLaneUnits, getDefaultUnits, getHardcodedUnitsForView, getTypeUnits, getUnitLabel, getUnitName, getUnitsForField, getUnitsForType, getUnitsForTypePerField };
@@ -1,5 +1,3 @@
1
1
  import { index_d_exports } from "./canvas/index.js";
2
2
  import { default_d_exports } from "./default.js";
3
- //#region src/units/get-unit-definitions-for-view-type.d.ts
4
- export declare const getUnitDefinitionsForViewType: (viewType: string) => typeof default_d_exports | typeof index_d_exports;
5
- //#endregion
3
+ export declare const getUnitDefinitionsForViewType: (viewType: string) => typeof default_d_exports | typeof index_d_exports;
@@ -1,11 +1,11 @@
1
1
  import { board_exports } from "./board.js";
2
+ import { canvas_exports } from "./canvas/index.js";
2
3
  import { default_exports } from "./default.js";
3
4
  import { gallery_exports } from "./gallery.js";
4
5
  import { gantt_exports } from "./gantt.js";
5
- import { canvas_exports } from "./canvas/index.js";
6
6
  import { grid_exports } from "./grid.js";
7
7
  import { list_exports } from "./list.js";
8
- //#region src/units/get-unit-definitions-for-view-type.ts
8
+ // src/units/get-unit-definitions-for-view-type.ts
9
9
  const getUnitDefinitionsForViewType = (viewType) => {
10
10
  switch (viewType) {
11
11
  case "board": return board_exports;
@@ -18,5 +18,4 @@ const getUnitDefinitionsForViewType = (viewType) => {
18
18
  default: return default_exports;
19
19
  }
20
20
  };
21
- //#endregion
22
21
  export { getUnitDefinitionsForViewType };
@@ -1,5 +1,4 @@
1
1
  import { ButtonUnit, DbUnit, ExpressionFieldUnit, PureUnit, Unit, UnitExpression } from "./types.js";
2
- //#region src/units/grid.d.ts
3
2
  export declare const getTypeUnits: () => PureUnit[], getUnitName: (unit: Unit) => string | null, getUnitsForType: (typeObject: import("@fibery/schema").TypeObject, options?: {
4
3
  parentFieldObjects?: import("@fibery/schema").FieldObject[];
5
4
  showHiddenFields?: boolean;
@@ -34,5 +33,4 @@ export declare const getTypeUnits: () => PureUnit[], getUnitName: (unit: Unit) =
34
33
  export declare const getDefaultUnits: () => {
35
34
  type: "title";
36
35
  kind: "field";
37
- }[];
38
- //#endregion
36
+ }[];
package/lib/units/grid.js CHANGED
@@ -3,21 +3,24 @@ 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";
8
- import { Text } from "../unit-definitions/text.js";
7
+ import { Date } from "../unit-definitions/date.js";
9
8
  import { Email } from "../unit-definitions/email.js";
10
9
  import { Emoji } from "../unit-definitions/emoji.js";
10
+ import { FileCollectionCount } from "../unit-definitions/file-collection-count.js";
11
+ import { FilesGallery } from "../unit-definitions/files-gallery.js";
11
12
  import { IconButton } from "../unit-definitions/icon-button.js";
12
13
  import { Id } from "../unit-definitions/id.js";
14
+ import { JsonPreview } from "../unit-definitions/json-preview.js";
13
15
  import { Location } from "../unit-definitions/location.js";
14
16
  import { Number } from "../unit-definitions/number.js";
15
17
  import { Phone } from "../unit-definitions/phone.js";
16
18
  import { ProgressBar } from "../unit-definitions/progress-bar.js";
17
19
  import { ReferenceCollection } from "../unit-definitions/reference-collection.js";
18
- import { Reference } from "../unit-definitions/reference.js";
19
20
  import { ReferenceIcon } from "../unit-definitions/reference-icon.js";
21
+ import { Reference } from "../unit-definitions/reference.js";
20
22
  import { RichTextSnippet } from "../unit-definitions/rich-text-snippet.js";
23
+ import { Text } from "../unit-definitions/text.js";
21
24
  import { Title } from "../unit-definitions/title.js";
22
25
  import { TypeBadgeAbbr } from "../unit-definitions/type-badge-abbr.js";
23
26
  import { TypeBadge } from "../unit-definitions/type-badge.js";
@@ -25,12 +28,10 @@ import { TypeIcon } from "../unit-definitions/type-icon.js";
25
28
  import { Url } from "../unit-definitions/url.js";
26
29
  import { UserButton } from "../unit-definitions/user-button.js";
27
30
  import { UserRole } from "../unit-definitions/user-role.js";
28
- import { FileCollectionCount } from "../unit-definitions/file-collection-count.js";
29
31
  import { makeUnitDefinitionsFactory } from "./make-factory.js";
30
- import { FilesGallery } from "../unit-definitions/files-gallery.js";
31
32
  import { truthy } from "@fibery/helpers/src/_";
32
33
  import { FileReference } from "@fibery/views/src/unit-definitions/file-reference";
33
- //#region src/units/grid.ts
34
+ // src/units/grid.ts
34
35
  var grid_exports = /* @__PURE__ */ __exportAll({
35
36
  getCardUnitsSelect: () => getCardUnitsSelect,
36
37
  getDefaultUnits: () => getDefaultUnits,
@@ -67,6 +68,7 @@ const allUnitDefinitions = {
67
68
  TypeBadgeAbbr,
68
69
  TypeIcon,
69
70
  RichTextSnippet,
71
+ JsonPreview,
70
72
  IconButton,
71
73
  UserRole,
72
74
  FileCollectionCount,
@@ -78,5 +80,4 @@ const getDefaultUnits = () => {
78
80
  const { Title } = allUnitDefinitions;
79
81
  return [Title && Title.makeUnit()].filter(truthy);
80
82
  };
81
- //#endregion
82
83
  export { getCardUnitsSelect, getDefaultUnits, getHardcodedUnitsForView, getTypeUnits, getUnitLabel, getUnitName, getUnitsForField, getUnitsForType, getUnitsForTypePerField, grid_exports };
@@ -1,6 +1,5 @@
1
1
  import { ButtonUnit, DbUnit, ExpressionFieldUnit, PureUnit, Unit, UnitExpression } from "./types.js";
2
2
  import { TypeObject } from "@fibery/schema";
3
- //#region src/units/list.d.ts
4
3
  export declare const getTypeUnits: () => PureUnit[], getUnitName: (unit: Unit) => string | null, getUnitsForType: (typeObject: TypeObject, options?: {
5
4
  parentFieldObjects?: import("@fibery/schema").FieldObject[];
6
5
  showHiddenFields?: boolean;
@@ -39,5 +38,4 @@ export declare const getDefaultUnits: (typeObject: TypeObject) => ({
39
38
  } | {
40
39
  type: "title";
41
40
  kind: "field";
42
- })[];
43
- //#endregion
41
+ })[];
package/lib/units/list.js CHANGED
@@ -3,7 +3,7 @@ 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
5
  import { truthy } from "@fibery/helpers/src/_";
6
- //#region src/units/list.ts
6
+ // src/units/list.ts
7
7
  var list_exports = /* @__PURE__ */ __exportAll({
8
8
  getCardUnitsSelect: () => getCardUnitsSelect,
9
9
  getDefaultUnits: () => getDefaultUnits,
@@ -20,5 +20,4 @@ const getDefaultUnits = (typeObject) => {
20
20
  const { Title, Avatar } = unit_definitions_exports;
21
21
  return [Title && Title.makeUnit(), typeObject && isAvatarExtensionEnabledType(typeObject) && Avatar && Avatar.makeUnit()].filter(truthy);
22
22
  };
23
- //#endregion
24
23
  export { getCardUnitsSelect, getDefaultUnits, getHardcodedUnitsForView, getTypeUnits, getUnitLabel, getUnitName, getUnitsForField, getUnitsForType, getUnitsForTypePerField, list_exports };
@@ -1,7 +1,6 @@
1
1
  import { ButtonUnit, DbUnit, ExpressionFieldUnit, FieldUnit, PureUnit, Unit, UnitDataDefinition, UnitExpression } from "./types.js";
2
2
  import { MissingUnitDefinition } from "../unit-definitions/not-found.js";
3
3
  import { FieldObject, Schema, TypeObject } from "@fibery/schema";
4
- //#region src/units/make-factory.d.ts
5
4
  type AnyUnitDataDefinition = (UnitDataDefinition<FieldUnit & {
6
5
  type: "id" | "title";
7
6
  }> & {
@@ -47,5 +46,4 @@ export declare const makeUnitDefinitionsFactory: (allUnitDefinitions: UnitDefini
47
46
  units: Unit[];
48
47
  }) => import("@fibery/schema").Select;
49
48
  getUnitDataDefinition: (unit: Unit) => UnitDataDefinition<Unit> | MissingUnitDefinition;
50
- };
51
- //#endregion
49
+ };
@@ -5,21 +5,17 @@ import { parseNumberFieldMeta } from "../field-utils/number.js";
5
5
  import { isRelationViewField } from "../field-utils/relation-view.js";
6
6
  import { TextUIMeta } from "../field-utils/text.js";
7
7
  import { isUserRoleField } from "../field-utils/user-role.js";
8
- import { calculateUnitExpressionErrors, isUnitEnabled } from "../unit-utils/common.js";
9
8
  import { NotFound } from "../unit-definitions/not-found.js";
10
- import { mapValues, truthy } from "@fibery/helpers/src/_";
9
+ import { calculateUnitExpressionErrors, isUnitEnabled } from "../unit-utils/common.js";
10
+ import { truthy } from "@fibery/helpers/src/_";
11
11
  import { mergeDenormalizedSelects } from "@fibery/query-utils/src/select";
12
- import { single } from "@fibery/helpers/utils/array";
12
+ import { isPlainObject } from "@fibery/helpers/src/object";
13
+ import { groupBy, single } from "@fibery/helpers/utils/array";
13
14
  import { assert, traceError } from "@fibery/helpers/utils/trace";
14
- import constant from "lodash/constant.js";
15
- import flatMap from "lodash/flatMap.js";
16
- import groupBy from "lodash/groupBy.js";
17
- import isPlainObject from "lodash/isPlainObject.js";
18
- import sortBy from "lodash/sortBy.js";
19
- //#region src/units/make-factory.ts
15
+ // src/units/make-factory.ts
20
16
  const NoUnitsCreator = () => [];
21
17
  const makeUnitDefinitionsFactory = (allUnitDefinitions) => {
22
- const { BackReferencesList, Bool, BoolCheckbox, ColorInput, CommentsList, Text, TextInput, Email, EmailInput, Emoji, IconInput, JsonInput, Number, NumberInput, ProgressBar, ReferenceCombobox, ReferenceCollection, ReferenceCollectionList, ReferenceCollectionView, ReferenceCollectionCombobox, FileReference, FileCompactReference, FilesGallery, FileList, FileListItem, FileLList, FileLListItem, FileCollectionCount, FileCompactCollection, Date, DateTimeCombobox, DateRange, DateRangeCombobox, Avatar, AvatarCollection, AvatarInput, CollectionCount, Reference, ReferenceIcon, TypeIcon, TypeBadge, TypeBadgeAbbr, Title, TitleInput, Id, UserButton, Phone, PhoneInput, Location, LocationInput, SingleLocationPreview, GeometryPreview, RichText, RichTextSnippet, RichTextDocument, CommentsCollection, Url, UrlInput, UserRole, UserRoleInput, IconButton } = allUnitDefinitions;
18
+ const { BackReferencesList, Bool, BoolCheckbox, ColorInput, CommentsList, Text, TextInput, Email, EmailInput, Emoji, IconInput, JsonInput, JsonPreview, Number, NumberInput, ProgressBar, ReferenceCombobox, ReferenceCollection, ReferenceCollectionList, ReferenceCollectionView, ReferenceCollectionCombobox, FileReference, FileCompactReference, FilesGallery, FileList, FileListItem, FileLList, FileLListItem, FileCollectionCount, FileCompactCollection, Date, DateTimeCombobox, DateRange, DateRangeCombobox, Avatar, AvatarCollection, AvatarInput, CollectionCount, Reference, ReferenceIcon, TypeIcon, TypeBadge, TypeBadgeAbbr, Title, TitleInput, Id, UserButton, Phone, PhoneInput, Location, LocationInput, SingleLocationPreview, GeometryPreview, RichText, RichTextSnippet, RichTextDocument, CommentsCollection, Url, UrlInput, UserRole, UserRoleInput, IconButton } = allUnitDefinitions;
23
19
  const unitsFactoryByBasicFieldType = {
24
20
  "fibery/bool": () => [Bool, BoolCheckbox],
25
21
  "fibery/date": () => [Date, DateTimeCombobox],
@@ -65,6 +61,7 @@ const makeUnitDefinitionsFactory = (allUnitDefinitions) => {
65
61
  "fibery/rich-text": NoUnitsCreator,
66
62
  "fibery/rank": NoUnitsCreator,
67
63
  "fibery/json-value": () => [GeometryPreview, JsonInput],
64
+ "fibery/json": () => [JsonPreview, JsonInput],
68
65
  "fibery/uuid": NoUnitsCreator,
69
66
  "fibery/decimal": (fieldObject) => [
70
67
  Number,
@@ -157,7 +154,7 @@ const makeUnitDefinitionsFactory = (allUnitDefinitions) => {
157
154
  if (fieldObject.type === "comments/comment" && CommentsCollection) return [CommentsCollection].filter(Boolean).map(makeUnit);
158
155
  if (isUserRoleField(fieldObject)) return [UserRole, UserRoleInput].filter(Boolean).map(makeUnit);
159
156
  if (fieldObject.isHidden && !showHiddenFields) return [];
160
- return (unitsFactoryByFieldKind[fieldObject.kind] || constant([]))(fieldObject, options).filter(truthy).map(makeUnit);
157
+ return (unitsFactoryByFieldKind[fieldObject.kind] || (() => []))(fieldObject, options).filter(truthy).map(makeUnit);
161
158
  };
162
159
  const staticUnitsTypeOrder = [
163
160
  Id,
@@ -169,6 +166,10 @@ const makeUnitDefinitionsFactory = (allUnitDefinitions) => {
169
166
  Title,
170
167
  UserButton
171
168
  ].filter(Boolean).map(({ type }) => type);
169
+ const getStaticTypeOrder = (unit) => {
170
+ const index = staticUnitsTypeOrder.indexOf(unit.type);
171
+ return index === -1 ? staticUnitsTypeOrder.length : index;
172
+ };
172
173
  function getTypeUnits() {
173
174
  return [
174
175
  TypeIcon,
@@ -180,17 +181,13 @@ const makeUnitDefinitionsFactory = (allUnitDefinitions) => {
180
181
  * @returns flat list of all units for given type
181
182
  */
182
183
  function getUnitsForType(typeObject, options = {}) {
183
- const collection = flatMap(typeObject.fieldObjects.filter((x) => !x.isHidden), (fieldObject) => getUnitsForField(fieldObject, options).map((unit) => ({
184
+ return typeObject.fieldObjects.filter((x) => !x.isHidden).flatMap((fieldObject) => getUnitsForField(fieldObject, options).map((unit) => ({
184
185
  unit,
185
186
  fieldObject
186
187
  }))).concat(getTypeUnits().map((unit) => ({
187
188
  unit,
188
189
  fieldObject: typeObject.titleFieldObject
189
- })));
190
- return sortBy(collection, ({ unit }) => {
191
- const index = staticUnitsTypeOrder.indexOf(unit.type);
192
- return index === -1 ? staticUnitsTypeOrder.length : index;
193
- });
190
+ }))).sort((a, b) => getStaticTypeOrder(a.unit) - getStaticTypeOrder(b.unit));
194
191
  }
195
192
  /**
196
193
  * @returns list of units grouped by field
@@ -204,12 +201,8 @@ const makeUnitDefinitionsFactory = (allUnitDefinitions) => {
204
201
  units
205
202
  });
206
203
  }
207
- return sortBy(collection, ({ units }) => {
208
- return units.map((unit) => {
209
- const index = staticUnitsTypeOrder.indexOf(unit.type);
210
- return index === -1 ? staticUnitsTypeOrder.length : index;
211
- }).sort((a, b) => a - b)[0];
212
- });
204
+ const getFieldOrder = ({ units }) => Math.min(...units.map(getStaticTypeOrder));
205
+ return collection.sort((a, b) => getFieldOrder(a) - getFieldOrder(b));
213
206
  }
214
207
  const hardcodedFieldNames = [
215
208
  "fibery/creation-date",
@@ -227,9 +220,9 @@ const makeUnitDefinitionsFactory = (allUnitDefinitions) => {
227
220
  })
228
221
  ].filter(Boolean);
229
222
  };
230
- const unitDefinitionsByTypeLookup = mapValues(groupBy(allUnitDefinitions, (x) => x.type), (value) => single(value));
223
+ const unitDefinitionsByTypeLookup = new Map(Array.from(groupBy(Object.values(allUnitDefinitions), (x) => x.type), ([type, definitions]) => [type, single(definitions)]));
231
224
  const getUnitLabel = (typeObject, unit) => {
232
- const unitDefinition = unitDefinitionsByTypeLookup[unit.type];
225
+ const unitDefinition = unitDefinitionsByTypeLookup.get(unit.type);
233
226
  if (!unitDefinition) return "";
234
227
  return unitDefinition.getLabel({
235
228
  typeObject,
@@ -237,12 +230,13 @@ const makeUnitDefinitionsFactory = (allUnitDefinitions) => {
237
230
  });
238
231
  };
239
232
  const getUnitName = (unit) => {
240
- const unitDefinition = unitDefinitionsByTypeLookup[unit.type];
233
+ const unitDefinition = unitDefinitionsByTypeLookup.get(unit.type);
241
234
  if (!unitDefinition) return null;
242
235
  return unitDefinition.name;
243
236
  };
244
237
  const getUnitDataDefinition = (unit) => {
245
- if (unitDefinitionsByTypeLookup[unit.type]) return unitDefinitionsByTypeLookup[unit.type];
238
+ const unitDefinition = unitDefinitionsByTypeLookup.get(unit.type);
239
+ if (unitDefinition) return unitDefinition;
246
240
  console.warn(`Unit Definition of type "${unit.type}" does not exist.`);
247
241
  return NotFound;
248
242
  };
@@ -276,5 +270,4 @@ const makeUnitDefinitionsFactory = (allUnitDefinitions) => {
276
270
  getUnitDataDefinition
277
271
  };
278
272
  };
279
- //#endregion
280
273
  export { makeUnitDefinitionsFactory };
@@ -1,7 +1,6 @@
1
1
  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
- //#region src/units/types.d.ts
5
4
  export type ButtonUnit = {
6
5
  kind: "user-button";
7
6
  type: "user-button" | "icon-button";
@@ -28,7 +27,7 @@ type FieldUnitMetadata = {
28
27
  settings?: Record<string, unknown>;
29
28
  hideWhenEmpty?: boolean;
30
29
  };
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";
30
+ 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" | "json-preview" | "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
31
  export type ExpressionFieldUnit = FieldUnitMetadata & {
33
32
  type: FieldUnitType;
34
33
  expression: UnitExpression;
@@ -76,5 +75,4 @@ export type UnitDataDefinition<T extends Unit> = {
76
75
  typeObject: TypeObject;
77
76
  unit: T;
78
77
  }) => string;
79
- };
80
- //#endregion
78
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/views",
3
- "version": "26.0.5",
3
+ "version": "26.0.7",
4
4
  "description": "Operations on view objects",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Fibery",
@@ -30,17 +30,15 @@
30
30
  }
31
31
  },
32
32
  "dependencies": {
33
- "@fibery/expression-utils": "17.0.3",
34
- "@fibery/helpers": "5.3.0",
35
- "@fibery/query-utils": "7.2.7",
36
- "@fibery/schema": "13.1.3",
33
+ "@fibery/expression-utils": "17.0.5",
34
+ "@fibery/helpers": "7.0.0",
35
+ "@fibery/query-utils": "7.2.9",
36
+ "@fibery/schema": "13.1.5",
37
37
  "date-fns": "3.6.0",
38
- "lodash": "4.18.1",
39
38
  "moment": "2.31.0"
40
39
  },
41
40
  "peerDependencies": {
42
- "@fibery/expression-utils": "^17.0.3",
43
- "@fibery/schema": "^13.1.3",
44
- "lodash": "4.18.1"
41
+ "@fibery/expression-utils": "^17.0.5",
42
+ "@fibery/schema": "^13.1.5"
45
43
  }
46
44
  }