@fibery/views 20.0.1 → 20.0.2

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 (43) hide show
  1. package/lib/field-utils/text.d.ts +2 -7
  2. package/lib/field-utils/text.js +4 -1
  3. package/lib/private/units.js +11 -11
  4. package/lib/unit-definitions/back-references-list.js +1 -1
  5. package/lib/unit-definitions/bool-checkbox.js +1 -1
  6. package/lib/unit-definitions/bool.js +1 -1
  7. package/lib/unit-definitions/color-input.js +1 -1
  8. package/lib/unit-definitions/comments-list.js +1 -1
  9. package/lib/unit-definitions/date-range-combobox.js +1 -1
  10. package/lib/unit-definitions/date-range.js +1 -1
  11. package/lib/unit-definitions/date-time-combobox.js +1 -1
  12. package/lib/unit-definitions/date.js +1 -1
  13. package/lib/unit-definitions/file-collection-count.js +1 -1
  14. package/lib/unit-definitions/file-compact-collection.js +1 -1
  15. package/lib/unit-definitions/file-reference.js +1 -1
  16. package/lib/unit-definitions/files-gallery.js +1 -1
  17. package/lib/unit-definitions/files-l-list-item.js +1 -1
  18. package/lib/unit-definitions/files-l-list.js +1 -1
  19. package/lib/unit-definitions/files-list-item.js +1 -1
  20. package/lib/unit-definitions/files-list.js +1 -1
  21. package/lib/unit-definitions/icon-button.js +1 -1
  22. package/lib/unit-definitions/index.js +2 -2
  23. package/lib/unit-definitions/json-input.js +1 -1
  24. package/lib/unit-definitions/number-input.js +1 -1
  25. package/lib/unit-definitions/reference-collection-combobox.js +1 -1
  26. package/lib/unit-definitions/reference-collection-list.js +1 -1
  27. package/lib/unit-definitions/reference-collection-view.js +1 -1
  28. package/lib/unit-definitions/reference-collection.js +1 -1
  29. package/lib/unit-definitions/reference-combobox.js +1 -1
  30. package/lib/unit-definitions/rich-text-document.js +1 -1
  31. package/lib/unit-definitions/text-input.js +1 -1
  32. package/lib/unit-definitions/text.js +1 -1
  33. package/lib/unit-definitions/user-role.js +1 -1
  34. package/lib/unit-utils/common.d.ts +24 -4
  35. package/lib/unit-utils/common.js +4 -2
  36. package/lib/units/canvas/all-units-data-definitions.js +1 -1
  37. package/lib/units/canvas/type-badge-abbr.d.ts +1 -2
  38. package/lib/units/canvas/type-badge.d.ts +1 -2
  39. package/lib/units/grid.js +3 -3
  40. package/lib/units/types.d.ts +2 -3
  41. package/package.json +4 -4
  42. package/lib/tsfixme.d.ts +0 -4
  43. package/lib/tsfixme.js +0 -0
@@ -1,4 +1,3 @@
1
- import { $TSFixMe } from "../tsfixme.js";
2
1
  //#region src/field-utils/text.d.ts
3
2
  declare const TextUIMetaKey = "ui/type";
4
3
  declare const TextUIMeta: {
@@ -27,12 +26,8 @@ declare const TextTypeToUiMeta: {
27
26
  "ui/type": string;
28
27
  };
29
28
  };
30
- declare const TextUiMetaToTextType: {
31
- [TextUIMeta.Phone]: string;
32
- [TextUIMeta.Email]: string;
33
- [TextUIMeta.URL]: string;
34
- };
35
- declare const getTextType: (fieldMeta: $TSFixMe) => string;
29
+ declare const TextUiMetaToTextType: Record<string, string>;
30
+ declare const getTextType: (fieldMeta: Record<string, unknown>) => string;
36
31
  declare const getTextTypeLabel: (textType: string) => string;
37
32
  //#endregion
38
33
  export { TextTypeToFiberyType, TextTypeToUiMeta, TextTypes, TextUIMeta, TextUIMetaKey, TextUiMetaToTextType, getTextType, getTextTypeLabel };
@@ -25,7 +25,10 @@ const TextUiMetaToTextType = {
25
25
  [TextUIMeta.Email]: TextTypes.CustomEmail,
26
26
  [TextUIMeta.URL]: TextTypes.CustomURL
27
27
  };
28
- const getTextType = (fieldMeta) => TextUiMetaToTextType[fieldMeta["ui/type"]] || "fibery/text";
28
+ const getTextType = (fieldMeta) => {
29
+ const textUiMeta = fieldMeta[TextUIMetaKey];
30
+ return typeof textUiMeta === "string" ? TextUiMetaToTextType[textUiMeta] || "fibery/text" : "fibery/text";
31
+ };
29
32
  const getTextTypeLabel = (textType) => {
30
33
  return {
31
34
  [TextTypes.CustomPhone]: "Phone",
@@ -33,22 +33,22 @@ const getUnitKind = (unit) => {
33
33
  };
34
34
  const migrateUnitOptsDefault = { migrateFileCollectionUnit: true };
35
35
  const migrateUnit = (schema, fromType, unit, units, opts = migrateUnitOptsDefault) => {
36
- const kind = unit.kind || getUnitKind(unit);
36
+ const legacyUnit = unit;
37
37
  if (unit.type === "date-time") return {
38
38
  ...unit,
39
- kind,
39
+ kind: unit.kind || "field",
40
40
  type: "date"
41
41
  };
42
42
  if (unit.type === "date-time-range") return {
43
43
  ...unit,
44
- kind,
44
+ kind: unit.kind || "field",
45
45
  type: "date-range"
46
46
  };
47
47
  if (unit.type === "text") {
48
48
  const [field] = unit.expression;
49
49
  if (getFieldType(schema, fromType, field) === "fibery/email") return {
50
50
  ...unit,
51
- kind,
51
+ kind: unit.kind || "field",
52
52
  type: "email"
53
53
  };
54
54
  }
@@ -56,7 +56,7 @@ const migrateUnit = (schema, fromType, unit, units, opts = migrateUnitOptsDefaul
56
56
  const [field] = unit.expression;
57
57
  if (getFieldType(schema, fromType, field) === "fibery/text") return {
58
58
  ...unit,
59
- kind,
59
+ kind: unit.kind || "field",
60
60
  type: getUnitTypeForTextField(getFieldMeta(schema, fromType, field))
61
61
  };
62
62
  }
@@ -64,7 +64,7 @@ const migrateUnit = (schema, fromType, unit, units, opts = migrateUnitOptsDefaul
64
64
  const [field] = unit.expression;
65
65
  if (getFieldType(schema, fromType, field) === "fibery/file") return {
66
66
  ...unit,
67
- kind,
67
+ kind: unit.kind || "field",
68
68
  type: opts.migrateFileCollectionUnit ? "file-collection-count" : "collection-count"
69
69
  };
70
70
  }
@@ -74,7 +74,7 @@ const migrateUnit = (schema, fromType, unit, units, opts = migrateUnitOptsDefaul
74
74
  if (isAvatarExntensionEnabled && hasAvatarExntensionField) return {
75
75
  ...unit,
76
76
  expression: ["avatar/avatars"],
77
- kind
77
+ kind: unit.kind || "field"
78
78
  };
79
79
  }
80
80
  if (opts.migrateFileCollectionUnit && unit.type === "collection-count") {
@@ -82,13 +82,13 @@ const migrateUnit = (schema, fromType, unit, units, opts = migrateUnitOptsDefaul
82
82
  const fieldObject = getField(schema, fromType, field);
83
83
  if (fieldObject?.type === "fibery/file" && fieldObject?.isCollection) return {
84
84
  ...unit,
85
- kind,
85
+ kind: unit.kind || "field",
86
86
  type: "file-collection-count"
87
87
  };
88
88
  }
89
- return {
90
- ...unit,
91
- kind
89
+ return legacyUnit.kind ? unit : {
90
+ ...legacyUnit,
91
+ kind: getUnitKind(unit)
92
92
  };
93
93
  };
94
94
  const expressionFrom = (unit) => unit.expression;
@@ -1,8 +1,8 @@
1
1
  import { getEntityLinksListSelect } from "../field-utils/back-references.js";
2
2
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
3
+ import { canEditField } from "../unit-utils/can-edit-field.js";
3
4
  import { getExportValue } from "../unit-utils/get-export-value.js";
4
5
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
5
- import { canEditField } from "../unit-utils/can-edit-field.js";
6
6
  import { getFieldObjectByFieldExpression } from "@fibery/expression-utils/src/utils";
7
7
  import { calculateDefaultOrderBy } from "@fibery/query-utils/src/query";
8
8
  //#region src/unit-definitions/back-references-list.ts
@@ -1,7 +1,7 @@
1
1
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
2
+ import { canEditField } from "../unit-utils/can-edit-field.js";
2
3
  import { getExportValue } from "../unit-utils/get-export-value.js";
3
4
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
4
- import { canEditField } from "../unit-utils/can-edit-field.js";
5
5
  import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
6
6
  //#region src/unit-definitions/bool-checkbox.ts
7
7
  const type = "bool-checkbox";
@@ -1,7 +1,7 @@
1
1
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
2
+ import { canEditField } from "../unit-utils/can-edit-field.js";
2
3
  import { getExportValue } from "../unit-utils/get-export-value.js";
3
4
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
4
- import { canEditField } from "../unit-utils/can-edit-field.js";
5
5
  import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
6
6
  //#region src/unit-definitions/bool.ts
7
7
  const type = "bool";
@@ -1,6 +1,6 @@
1
1
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
2
- import { getFieldLabel } from "../unit-utils/get-field-label.js";
3
2
  import { canEditField } from "../unit-utils/can-edit-field.js";
3
+ import { getFieldLabel } from "../unit-utils/get-field-label.js";
4
4
  import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
5
5
  //#region src/unit-definitions/color-input.ts
6
6
  const type = "color-input";
@@ -1,8 +1,8 @@
1
1
  import { getQuerySelect } from "../field-utils/comments.js";
2
2
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
3
+ import { canEditField } from "../unit-utils/can-edit-field.js";
3
4
  import { getExportValue } from "../unit-utils/get-export-value.js";
4
5
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
5
- import { canEditField } from "../unit-utils/can-edit-field.js";
6
6
  import { getFieldObjectByFieldExpression } from "@fibery/expression-utils/src/utils";
7
7
  //#region src/unit-definitions/comments-list.ts
8
8
  const type = "comments-list";
@@ -1,7 +1,7 @@
1
1
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
2
+ import { canEditField } from "../unit-utils/can-edit-field.js";
2
3
  import { getDateRangeExportValue } from "../unit-utils/get-export-value.js";
3
4
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
4
- import { canEditField } from "../unit-utils/can-edit-field.js";
5
5
  import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
6
6
  //#region src/unit-definitions/date-range-combobox.ts
7
7
  const type = "date-range-combobox";
@@ -1,7 +1,7 @@
1
1
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
2
+ import { canEditField } from "../unit-utils/can-edit-field.js";
2
3
  import { getDateRangeExportValue } from "../unit-utils/get-export-value.js";
3
4
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
4
- import { canEditField } from "../unit-utils/can-edit-field.js";
5
5
  import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
6
6
  //#region src/unit-definitions/date-range.ts
7
7
  const type = "date-range";
@@ -1,7 +1,7 @@
1
1
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
2
+ import { canEditField } from "../unit-utils/can-edit-field.js";
2
3
  import { getExportValue } from "../unit-utils/get-export-value.js";
3
4
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
4
- import { canEditField } from "../unit-utils/can-edit-field.js";
5
5
  import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
6
6
  //#region src/unit-definitions/date-time-combobox.ts
7
7
  const type = "date-time-combobox";
@@ -1,7 +1,7 @@
1
1
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
2
+ import { canEditField } from "../unit-utils/can-edit-field.js";
2
3
  import { getExportValue } from "../unit-utils/get-export-value.js";
3
4
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
4
- import { canEditField } from "../unit-utils/can-edit-field.js";
5
5
  import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
6
6
  //#region src/unit-definitions/date.ts
7
7
  const type = "date";
@@ -1,8 +1,8 @@
1
1
  import { getFilesSelect } from "../field-utils/file.js";
2
2
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
3
+ import { canEditField } from "../unit-utils/can-edit-field.js";
3
4
  import { getExportValue } from "../unit-utils/get-export-value.js";
4
5
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
5
- import { canEditField } from "../unit-utils/can-edit-field.js";
6
6
  import { wrapNormalizedInExpression } from "../unit-utils/wrap-normalized-in-expression.js";
7
7
  import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
8
8
  import { denormalizeSelect, normalizeSelect } from "@fibery/query-utils/src/select";
@@ -1,8 +1,8 @@
1
1
  import { getFilesSelect } from "../field-utils/file.js";
2
2
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
3
+ import { canEditField } from "../unit-utils/can-edit-field.js";
3
4
  import { getExportValue } from "../unit-utils/get-export-value.js";
4
5
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
5
- import { canEditField } from "../unit-utils/can-edit-field.js";
6
6
  import { wrapNormalizedInExpression } from "../unit-utils/wrap-normalized-in-expression.js";
7
7
  import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
8
8
  import { denormalizeSelect, normalizeSelect } from "@fibery/query-utils/src/select";
@@ -1,8 +1,8 @@
1
1
  import { getFilesSelect } from "../field-utils/file.js";
2
2
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
3
+ import { canEditField } from "../unit-utils/can-edit-field.js";
3
4
  import { getExportValue } from "../unit-utils/get-export-value.js";
4
5
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
5
- import { canEditField } from "../unit-utils/can-edit-field.js";
6
6
  import { wrapNormalizedInExpression } from "../unit-utils/wrap-normalized-in-expression.js";
7
7
  import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
8
8
  import { denormalizeSelect, normalizeSelect } from "@fibery/query-utils/src/select";
@@ -1,8 +1,8 @@
1
1
  import { getFilesSelect } from "../field-utils/file.js";
2
2
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
3
+ import { canEditField } from "../unit-utils/can-edit-field.js";
3
4
  import { getExportValue } from "../unit-utils/get-export-value.js";
4
5
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
5
- import { canEditField } from "../unit-utils/can-edit-field.js";
6
6
  import { wrapNormalizedInExpression } from "../unit-utils/wrap-normalized-in-expression.js";
7
7
  import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
8
8
  import { denormalizeSelect, normalizeSelect } from "@fibery/query-utils/src/select";
@@ -1,8 +1,8 @@
1
1
  import { getFilesSelect } from "../field-utils/file.js";
2
2
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
3
+ import { canEditField } from "../unit-utils/can-edit-field.js";
3
4
  import { getExportValue } from "../unit-utils/get-export-value.js";
4
5
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
5
- import { canEditField } from "../unit-utils/can-edit-field.js";
6
6
  import { wrapNormalizedInExpression } from "../unit-utils/wrap-normalized-in-expression.js";
7
7
  import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
8
8
  import { denormalizeSelect, normalizeSelect } from "@fibery/query-utils/src/select";
@@ -1,8 +1,8 @@
1
1
  import { getFilesSelect } from "../field-utils/file.js";
2
2
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
3
+ import { canEditField } from "../unit-utils/can-edit-field.js";
3
4
  import { getExportValue } from "../unit-utils/get-export-value.js";
4
5
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
5
- import { canEditField } from "../unit-utils/can-edit-field.js";
6
6
  import { wrapNormalizedInExpression } from "../unit-utils/wrap-normalized-in-expression.js";
7
7
  import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
8
8
  import { denormalizeSelect, normalizeSelect } from "@fibery/query-utils/src/select";
@@ -1,8 +1,8 @@
1
1
  import { getFilesSelect } from "../field-utils/file.js";
2
2
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
3
+ import { canEditField } from "../unit-utils/can-edit-field.js";
3
4
  import { getExportValue } from "../unit-utils/get-export-value.js";
4
5
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
5
- import { canEditField } from "../unit-utils/can-edit-field.js";
6
6
  import { wrapNormalizedInExpression } from "../unit-utils/wrap-normalized-in-expression.js";
7
7
  import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
8
8
  import { denormalizeSelect, normalizeSelect } from "@fibery/query-utils/src/select";
@@ -1,8 +1,8 @@
1
1
  import { getFilesSelect } from "../field-utils/file.js";
2
2
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
3
+ import { canEditField } from "../unit-utils/can-edit-field.js";
3
4
  import { getExportValue } from "../unit-utils/get-export-value.js";
4
5
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
5
- import { canEditField } from "../unit-utils/can-edit-field.js";
6
6
  import { wrapNormalizedInExpression } from "../unit-utils/wrap-normalized-in-expression.js";
7
7
  import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
8
8
  import { denormalizeSelect, normalizeSelect } from "@fibery/query-utils/src/select";
@@ -1,6 +1,6 @@
1
1
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
2
- import { getFieldLabel } from "../unit-utils/get-field-label.js";
3
2
  import { canEditField } from "../unit-utils/can-edit-field.js";
3
+ import { getFieldLabel } from "../unit-utils/get-field-label.js";
4
4
  import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
5
5
  //#region src/unit-definitions/icon-button.ts
6
6
  const type = "icon-button";
@@ -3,12 +3,11 @@ import { AvatarCollection } from "./avatar-collection.js";
3
3
  import { Avatar } from "./avatar.js";
4
4
  import { Bool } from "./bool.js";
5
5
  import { CollectionCount } from "./collection-count.js";
6
- import { DateRange } from "./date-range.js";
7
6
  import { Date } from "./date.js";
7
+ import { DateRange } from "./date-range.js";
8
8
  import { Text } from "./text.js";
9
9
  import { Email } from "./email.js";
10
10
  import { Emoji } from "./emoji.js";
11
- import { FileCollectionCount } from "./file-collection-count.js";
12
11
  import { IconButton } from "./icon-button.js";
13
12
  import { Id } from "./id.js";
14
13
  import { Location } from "./location.js";
@@ -26,6 +25,7 @@ import { TypeIcon } from "./type-icon.js";
26
25
  import { Url } from "./url.js";
27
26
  import { UserButton } from "./user-button.js";
28
27
  import { UserRole } from "./user-role.js";
28
+ import { FileCollectionCount } from "./file-collection-count.js";
29
29
  //#region src/unit-definitions/index.ts
30
30
  var unit_definitions_exports = /* @__PURE__ */ __exportAll({
31
31
  Avatar: () => Avatar,
@@ -1,6 +1,6 @@
1
1
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
2
- import { getFieldLabel } from "../unit-utils/get-field-label.js";
3
2
  import { canEditField } from "../unit-utils/can-edit-field.js";
3
+ import { getFieldLabel } from "../unit-utils/get-field-label.js";
4
4
  import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
5
5
  //#region src/unit-definitions/json-input.ts
6
6
  const type = "json-input";
@@ -1,7 +1,7 @@
1
1
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
2
+ import { canEditField } from "../unit-utils/can-edit-field.js";
2
3
  import { getNumberExportValue } from "../unit-utils/get-export-value.js";
3
4
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
4
- import { canEditField } from "../unit-utils/can-edit-field.js";
5
5
  import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
6
6
  //#region src/unit-definitions/number-input.tsx
7
7
  const type = "number-input";
@@ -1,7 +1,7 @@
1
1
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
2
+ import { canEditField } from "../unit-utils/can-edit-field.js";
2
3
  import { getExportValue } from "../unit-utils/get-export-value.js";
3
4
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
4
- import { canEditField } from "../unit-utils/can-edit-field.js";
5
5
  //#region src/unit-definitions/reference-collection-combobox.ts
6
6
  const type = "reference-collection-combobox";
7
7
  const ReferenceCollectionCombobox = {
@@ -1,7 +1,7 @@
1
1
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
2
+ import { canEditField } from "../unit-utils/can-edit-field.js";
2
3
  import { getReferenceCollectionExportValue } from "../unit-utils/get-export-value.js";
3
4
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
4
- import { canEditField } from "../unit-utils/can-edit-field.js";
5
5
  //#region src/unit-definitions/reference-collection-list.tsx
6
6
  const type = "reference-collection-list";
7
7
  const ReferenceCollectionList = {
@@ -1,7 +1,7 @@
1
1
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
2
+ import { canEditField } from "../unit-utils/can-edit-field.js";
2
3
  import { getReferenceCollectionExportValue } from "../unit-utils/get-export-value.js";
3
4
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
4
- import { canEditField } from "../unit-utils/can-edit-field.js";
5
5
  //#region src/unit-definitions/reference-collection-view.tsx
6
6
  const type = "reference-collection-view";
7
7
  const ReferenceCollectionView = {
@@ -1,8 +1,8 @@
1
1
  import { REFERENCE_COLLECTION_LIMIT, calculateReferenceCollectionQuery } from "../field-utils/reference-collection.js";
2
2
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
3
+ import { canEditField } from "../unit-utils/can-edit-field.js";
3
4
  import { getReferenceCollectionExportValue } from "../unit-utils/get-export-value.js";
4
5
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
5
- import { canEditField } from "../unit-utils/can-edit-field.js";
6
6
  import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
7
7
  //#region src/unit-definitions/reference-collection.ts
8
8
  const type = "reference-collection";
@@ -1,7 +1,7 @@
1
1
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
2
+ import { canEditField } from "../unit-utils/can-edit-field.js";
2
3
  import { getReferenceExportValue } from "../unit-utils/get-export-value.js";
3
4
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
4
- import { canEditField } from "../unit-utils/can-edit-field.js";
5
5
  //#region src/unit-definitions/reference-combobox.ts
6
6
  const type = "reference-combobox";
7
7
  const ReferenceCombobox = {
@@ -1,8 +1,8 @@
1
1
  import { getRichTextQuerySelect } from "../field-utils/rich-text.js";
2
2
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
3
+ import { canEditField } from "../unit-utils/can-edit-field.js";
3
4
  import { getSnippetExportValue } from "../unit-utils/get-export-value.js";
4
5
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
5
- import { canEditField } from "../unit-utils/can-edit-field.js";
6
6
  //#region src/unit-definitions/rich-text-document.ts
7
7
  const type = "rich-text-document";
8
8
  const RichTextDocument = {
@@ -1,7 +1,7 @@
1
1
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
2
+ import { canEditField } from "../unit-utils/can-edit-field.js";
2
3
  import { getExportValue } from "../unit-utils/get-export-value.js";
3
4
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
4
- import { canEditField } from "../unit-utils/can-edit-field.js";
5
5
  import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
6
6
  //#region src/unit-definitions/text-input.tsx
7
7
  const type = "text-input";
@@ -1,7 +1,7 @@
1
1
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
2
+ import { canEditField } from "../unit-utils/can-edit-field.js";
2
3
  import { getExportValue } from "../unit-utils/get-export-value.js";
3
4
  import { getFieldLabel } from "../unit-utils/get-field-label.js";
4
- import { canEditField } from "../unit-utils/can-edit-field.js";
5
5
  import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
6
6
  //#region src/unit-definitions/text.ts
7
7
  const type = "text";
@@ -1,7 +1,7 @@
1
1
  import { getUserRoleByKey } from "../field-utils/user-role.js";
2
2
  import { calculateUnitExpressionErrors, makeUnitMethod } from "../unit-utils/common.js";
3
- import { getExportValue } from "../unit-utils/get-export-value.js";
4
3
  import { canEditField } from "../unit-utils/can-edit-field.js";
4
+ import { getExportValue } from "../unit-utils/get-export-value.js";
5
5
  import { getQuerySelectForExpression } from "@fibery/query-utils/src/query";
6
6
  //#region src/unit-definitions/user-role.ts
7
7
  const type = "user-role";
@@ -1,5 +1,4 @@
1
- import { $TSFixMe } from "../tsfixme.js";
2
- import { FieldUnit, PureUnit, Unit, UnitExpression } from "../units/types.js";
1
+ import { FieldUnit, Unit, UnitExpression } from "../units/types.js";
3
2
  import { TypeObject } from "@fibery/schema";
4
3
  //#region src/unit-utils/common.d.ts
5
4
  declare const makeUnitMethod: (type: FieldUnit["type"]) => ({ expression }?: {
@@ -10,8 +9,29 @@ declare const calculateUnitExpressionErrors: ({ typeObject, unit }: {
10
9
  unit: Unit;
11
10
  }) => string[];
12
11
  declare const isUnitEnabled: (unit: Unit) => boolean;
13
- declare const toPureUnit: (unit: Unit) => PureUnit;
14
- declare const asString: (something: $TSFixMe) => string;
12
+ declare const toPureUnit: (unit: Unit) => {
13
+ kind: "user-button";
14
+ type: "user-button" | "icon-button";
15
+ data: {
16
+ id: string;
17
+ typeId: string;
18
+ };
19
+ label: string;
20
+ hideWhenEmpty?: boolean;
21
+ icon?: string;
22
+ } | {
23
+ kind: "db";
24
+ type: "type-icon" | "type-badge" | "type-badge-abbr";
25
+ expression?: UnitExpression;
26
+ hideWhenEmpty?: boolean;
27
+ } | {
28
+ kind: "field";
29
+ 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";
30
+ expression: UnitExpression;
31
+ settings?: Record<string, unknown>;
32
+ hideWhenEmpty?: boolean;
33
+ };
34
+ declare const asString: (something: unknown) => string;
15
35
  declare const canEditFieldExpression: (typeObject: TypeObject, expression: UnitExpression) => boolean;
16
36
  //#endregion
17
37
  export { asString, calculateUnitExpressionErrors, canEditFieldExpression, isUnitEnabled, makeUnitMethod, toPureUnit };
@@ -1,5 +1,4 @@
1
1
  import { getUnmatchedUnitLabel } from "./get-unmatched-unit-label.js";
2
- import omit from "lodash/omit.js";
3
2
  import { assertIsValidExpression, getFieldObjectByFieldExpression, isFieldExpressionValid } from "@fibery/expression-utils/src/utils";
4
3
  //#region src/unit-utils/common.ts
5
4
  const makeUnitMethod = (type) => ({ expression } = {}) => {
@@ -21,7 +20,10 @@ const isUnitEnabled = (unit) => {
21
20
  const { checked } = unit;
22
21
  return checked === void 0 || checked === true;
23
22
  };
24
- const toPureUnit = (unit) => omit(unit, ["checked"]);
23
+ const toPureUnit = (unit) => {
24
+ const { checked: _checked, ...pureUnit } = unit;
25
+ return pureUnit;
26
+ };
25
27
  const asString = (something) => typeof something === "string" ? something : JSON.stringify(something);
26
28
  const canEditFieldExpression = (typeObject, expression) => {
27
29
  if (isFieldExpressionValid({
@@ -2,8 +2,8 @@ import { __exportAll } from "../../_virtual/_rolldown/runtime.js";
2
2
  import { Avatar } from "../../unit-definitions/avatar.js";
3
3
  import { Bool } from "../../unit-definitions/bool.js";
4
4
  import { CollectionCount } from "../../unit-definitions/collection-count.js";
5
- import { DateRange } from "../../unit-definitions/date-range.js";
6
5
  import { Date } from "../../unit-definitions/date.js";
6
+ import { DateRange } from "../../unit-definitions/date-range.js";
7
7
  import { Text } from "../../unit-definitions/text.js";
8
8
  import { Email } from "../../unit-definitions/email.js";
9
9
  import { Emoji } from "../../unit-definitions/emoji.js";
@@ -1,5 +1,4 @@
1
1
  import { NumberDisplaySettings } from "../../field-utils/number.js";
2
- import { $TSFixMe } from "../../tsfixme.js";
3
2
  import { DbUnit, PureUnit, UnitExpression } from "../types.js";
4
3
  import { TypeObject } from "@fibery/schema";
5
4
  //#region src/units/canvas/type-badge-abbr.d.ts
@@ -20,7 +19,7 @@ declare const TypeBadgeAbbr: {
20
19
  calculateErrors: (params: {
21
20
  typeObject: TypeObject;
22
21
  unit: DbUnit;
23
- }) => $TSFixMe[];
22
+ }) => string[];
24
23
  getExportValue: (params: {
25
24
  typeObject: TypeObject;
26
25
  unit: DbUnit;
@@ -1,5 +1,4 @@
1
1
  import { NumberDisplaySettings } from "../../field-utils/number.js";
2
- import { $TSFixMe } from "../../tsfixme.js";
3
2
  import { DbUnit, PureUnit, UnitExpression } from "../types.js";
4
3
  import { TypeObject } from "@fibery/schema";
5
4
  //#region src/units/canvas/type-badge.d.ts
@@ -20,7 +19,7 @@ declare const TypeBadge: {
20
19
  calculateErrors: (params: {
21
20
  typeObject: TypeObject;
22
21
  unit: DbUnit;
23
- }) => $TSFixMe[];
22
+ }) => string[];
24
23
  getExportValue: (params: {
25
24
  typeObject: TypeObject;
26
25
  unit: DbUnit;
package/lib/units/grid.js CHANGED
@@ -3,13 +3,11 @@ 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 { DateRange } from "../unit-definitions/date-range.js";
7
6
  import { Date } from "../unit-definitions/date.js";
7
+ import { DateRange } from "../unit-definitions/date-range.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";
13
11
  import { IconButton } from "../unit-definitions/icon-button.js";
14
12
  import { Id } from "../unit-definitions/id.js";
15
13
  import { Location } from "../unit-definitions/location.js";
@@ -27,7 +25,9 @@ import { TypeIcon } from "../unit-definitions/type-icon.js";
27
25
  import { Url } from "../unit-definitions/url.js";
28
26
  import { UserButton } from "../unit-definitions/user-button.js";
29
27
  import { UserRole } from "../unit-definitions/user-role.js";
28
+ import { FileCollectionCount } from "../unit-definitions/file-collection-count.js";
30
29
  import { makeUnitDefinitionsFactory } from "./make-factory.js";
30
+ import { FilesGallery } from "../unit-definitions/files-gallery.js";
31
31
  import { FileReference } from "@fibery/views/src/unit-definitions/file-reference";
32
32
  //#region src/units/grid.ts
33
33
  var grid_exports = /* @__PURE__ */ __exportAll({
@@ -1,5 +1,4 @@
1
1
  import { NumberDisplaySettings } from "../field-utils/number.js";
2
- import { $TSFixMe } from "../tsfixme.js";
3
2
  import { Schema, TypeObject } from "@fibery/schema";
4
3
  import { FiberyObject } from "@fibery/expression-utils/src/types";
5
4
  //#region src/units/types.d.ts
@@ -52,11 +51,11 @@ type UnitDataDefinition<T extends Unit> = {
52
51
  typeObject: TypeObject;
53
52
  unit: T;
54
53
  schema: Schema;
55
- }) => $TSFixMe;
54
+ }) => Record<string, unknown>;
56
55
  calculateErrors: (params: {
57
56
  typeObject: TypeObject;
58
57
  unit: T;
59
- }) => $TSFixMe[];
58
+ }) => string[];
60
59
  getExportValue: (params: {
61
60
  typeObject: TypeObject;
62
61
  unit: T;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fibery/views",
3
- "version": "20.0.1",
3
+ "version": "20.0.2",
4
4
  "description": "Operations on view objects",
5
5
  "license": "UNLICENSED",
6
6
  "author": "Fibery",
@@ -33,13 +33,13 @@
33
33
  "date-fns": "2.29.2",
34
34
  "lodash": "4.17.21",
35
35
  "moment": "2.29.4",
36
- "@fibery/expression-utils": "10.0.1",
36
+ "@fibery/expression-utils": "10.0.2",
37
37
  "@fibery/helpers": "3.2.1",
38
- "@fibery/query-utils": "2.0.1",
38
+ "@fibery/query-utils": "2.0.2",
39
39
  "@fibery/schema": "10.3.1"
40
40
  },
41
41
  "peerDependencies": {
42
- "@fibery/expression-utils": "^10.0.1",
42
+ "@fibery/expression-utils": "^10.0.2",
43
43
  "@fibery/schema": "^10.3.1",
44
44
  "immutability-helper": "^2.4.0",
45
45
  "lodash": "4.17.21"
package/lib/tsfixme.d.ts DELETED
@@ -1,4 +0,0 @@
1
- //#region src/tsfixme.d.ts
2
- type $TSFixMe = any;
3
- //#endregion
4
- export { $TSFixMe };
package/lib/tsfixme.js DELETED
File without changes