@fibery/views 17.0.4 → 18.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 (236) hide show
  1. package/lib/index.js +17 -0
  2. package/lib/jest.config.d.ts +2 -0
  3. package/lib/jest.config.js +33 -0
  4. package/lib/src/field-utils/avatar.d.ts +20 -0
  5. package/lib/src/field-utils/avatar.js +42 -0
  6. package/lib/src/field-utils/back-references.d.ts +15 -0
  7. package/lib/src/field-utils/back-references.js +21 -0
  8. package/lib/src/field-utils/comments.d.ts +60 -0
  9. package/lib/src/field-utils/comments.js +46 -0
  10. package/lib/src/field-utils/date-time.d.ts +14 -0
  11. package/lib/src/field-utils/date-time.js +56 -0
  12. package/lib/src/field-utils/enum-value.d.ts +13 -0
  13. package/lib/src/field-utils/enum-value.js +29 -0
  14. package/lib/src/field-utils/file.d.ts +4 -0
  15. package/lib/src/field-utils/file.js +18 -0
  16. package/lib/src/field-utils/icon.d.ts +10 -0
  17. package/lib/src/field-utils/icon.js +26 -0
  18. package/lib/src/field-utils/number.d.ts +31 -0
  19. package/lib/src/field-utils/number.js +91 -0
  20. package/lib/src/field-utils/reference-collection.d.ts +18 -0
  21. package/lib/src/field-utils/reference-collection.js +45 -0
  22. package/lib/src/field-utils/reference.d.ts +7 -0
  23. package/lib/src/field-utils/reference.js +57 -0
  24. package/lib/src/field-utils/relation-view.d.ts +2 -0
  25. package/lib/src/field-utils/relation-view.js +12 -0
  26. package/lib/src/field-utils/rich-text.d.ts +12 -0
  27. package/lib/src/field-utils/rich-text.js +27 -0
  28. package/lib/src/field-utils/text.d.ts +35 -0
  29. package/lib/src/field-utils/text.js +40 -0
  30. package/lib/src/field-utils/user-active.d.ts +8 -0
  31. package/lib/src/field-utils/user-active.js +28 -0
  32. package/lib/src/field-utils/user-role.d.ts +6 -0
  33. package/lib/src/field-utils/user-role.js +25 -0
  34. package/lib/src/field-utils/workflow.d.ts +15 -0
  35. package/lib/src/field-utils/workflow.js +56 -0
  36. package/lib/src/index.d.ts +16 -0
  37. package/lib/src/index.js +258 -0
  38. package/lib/src/private/board.d.ts +11 -0
  39. package/lib/src/private/board.js +326 -0
  40. package/lib/src/private/calendar.d.ts +10 -0
  41. package/lib/src/private/calendar.js +122 -0
  42. package/lib/src/private/feed.d.ts +10 -0
  43. package/lib/src/private/feed.js +119 -0
  44. package/lib/src/private/form.d.ts +3 -0
  45. package/lib/src/private/form.js +61 -0
  46. package/lib/src/private/map.d.ts +10 -0
  47. package/lib/src/private/map.js +119 -0
  48. package/lib/src/private/smart-folder.d.ts +23 -0
  49. package/lib/src/private/smart-folder.js +274 -0
  50. package/lib/src/private/test-data/garbage-test.d.ts +649 -0
  51. package/lib/src/private/test-data/garbage-test.js +520 -0
  52. package/lib/src/private/test-data/kanban.d.ts +1123 -0
  53. package/lib/src/private/test-data/kanban.js +1203 -0
  54. package/lib/src/private/test-data/tasks.d.ts +3216 -0
  55. package/lib/src/private/test-data/tasks.js +2731 -0
  56. package/lib/src/private/timeline.d.ts +10 -0
  57. package/lib/src/private/timeline.js +323 -0
  58. package/lib/src/private/units.d.ts +6 -0
  59. package/lib/src/private/units.js +144 -0
  60. package/lib/src/private/utils.d.ts +17 -0
  61. package/lib/src/private/utils.js +267 -0
  62. package/lib/src/tsfixme.d.ts +1 -0
  63. package/lib/src/tsfixme.js +2 -0
  64. package/lib/src/unit-definitions/avatar-collection.d.ts +2 -0
  65. package/lib/src/unit-definitions/avatar-collection.js +53 -0
  66. package/lib/src/unit-definitions/avatar-input.d.ts +2 -0
  67. package/lib/src/unit-definitions/avatar-input.js +12 -0
  68. package/lib/src/unit-definitions/avatar.d.ts +2 -0
  69. package/lib/src/unit-definitions/avatar.js +80 -0
  70. package/lib/src/unit-definitions/back-references-list.d.ts +2 -0
  71. package/lib/src/unit-definitions/back-references-list.js +38 -0
  72. package/lib/src/unit-definitions/bool-checkbox.d.ts +2 -0
  73. package/lib/src/unit-definitions/bool-checkbox.js +25 -0
  74. package/lib/src/unit-definitions/bool.d.ts +2 -0
  75. package/lib/src/unit-definitions/bool.js +22 -0
  76. package/lib/src/unit-definitions/collection-count.d.ts +2 -0
  77. package/lib/src/unit-definitions/collection-count.js +32 -0
  78. package/lib/src/unit-definitions/color-input.d.ts +2 -0
  79. package/lib/src/unit-definitions/color-input.js +21 -0
  80. package/lib/src/unit-definitions/comments-list.d.ts +2 -0
  81. package/lib/src/unit-definitions/comments-list.js +25 -0
  82. package/lib/src/unit-definitions/date-range-combobox.d.ts +2 -0
  83. package/lib/src/unit-definitions/date-range-combobox.js +22 -0
  84. package/lib/src/unit-definitions/date-range.d.ts +2 -0
  85. package/lib/src/unit-definitions/date-range.js +22 -0
  86. package/lib/src/unit-definitions/date-time-combobox.d.ts +2 -0
  87. package/lib/src/unit-definitions/date-time-combobox.js +22 -0
  88. package/lib/src/unit-definitions/date.d.ts +2 -0
  89. package/lib/src/unit-definitions/date.js +22 -0
  90. package/lib/src/unit-definitions/email-input.d.ts +2 -0
  91. package/lib/src/unit-definitions/email-input.js +12 -0
  92. package/lib/src/unit-definitions/email.d.ts +2 -0
  93. package/lib/src/unit-definitions/email.js +17 -0
  94. package/lib/src/unit-definitions/emoji.d.ts +2 -0
  95. package/lib/src/unit-definitions/emoji.js +17 -0
  96. package/lib/src/unit-definitions/file-collection-count.d.ts +2 -0
  97. package/lib/src/unit-definitions/file-collection-count.js +30 -0
  98. package/lib/src/unit-definitions/file-compact-collection.d.ts +2 -0
  99. package/lib/src/unit-definitions/file-compact-collection.js +30 -0
  100. package/lib/src/unit-definitions/file-compact-reference.d.ts +2 -0
  101. package/lib/src/unit-definitions/file-compact-reference.js +36 -0
  102. package/lib/src/unit-definitions/file-reference.d.ts +2 -0
  103. package/lib/src/unit-definitions/file-reference.js +26 -0
  104. package/lib/src/unit-definitions/files-gallery.d.ts +2 -0
  105. package/lib/src/unit-definitions/files-gallery.js +30 -0
  106. package/lib/src/unit-definitions/files-l-list-item.d.ts +2 -0
  107. package/lib/src/unit-definitions/files-l-list-item.js +26 -0
  108. package/lib/src/unit-definitions/files-l-list.d.ts +2 -0
  109. package/lib/src/unit-definitions/files-l-list.js +30 -0
  110. package/lib/src/unit-definitions/files-list-item.d.ts +2 -0
  111. package/lib/src/unit-definitions/files-list-item.js +26 -0
  112. package/lib/src/unit-definitions/files-list.d.ts +2 -0
  113. package/lib/src/unit-definitions/files-list.js +30 -0
  114. package/lib/src/unit-definitions/geometry-preview.d.ts +2 -0
  115. package/lib/src/unit-definitions/geometry-preview.js +17 -0
  116. package/lib/src/unit-definitions/icon-button.d.ts +2 -0
  117. package/lib/src/unit-definitions/icon-button.js +29 -0
  118. package/lib/src/unit-definitions/icon-input.d.ts +2 -0
  119. package/lib/src/unit-definitions/icon-input.js +12 -0
  120. package/lib/src/unit-definitions/id.d.ts +2 -0
  121. package/lib/src/unit-definitions/id.js +29 -0
  122. package/lib/src/unit-definitions/index.d.ts +27 -0
  123. package/lib/src/unit-definitions/index.js +57 -0
  124. package/lib/src/unit-definitions/json-input.d.ts +2 -0
  125. package/lib/src/unit-definitions/json-input.js +21 -0
  126. package/lib/src/unit-definitions/location-input.d.ts +2 -0
  127. package/lib/src/unit-definitions/location-input.js +18 -0
  128. package/lib/src/unit-definitions/location.d.ts +2 -0
  129. package/lib/src/unit-definitions/location.js +17 -0
  130. package/lib/src/unit-definitions/not-found.d.ts +2 -0
  131. package/lib/src/unit-definitions/not-found.js +24 -0
  132. package/lib/src/unit-definitions/number-input.d.ts +2 -0
  133. package/lib/src/unit-definitions/number-input.js +22 -0
  134. package/lib/src/unit-definitions/number.d.ts +2 -0
  135. package/lib/src/unit-definitions/number.js +27 -0
  136. package/lib/src/unit-definitions/phone-input.d.ts +2 -0
  137. package/lib/src/unit-definitions/phone-input.js +12 -0
  138. package/lib/src/unit-definitions/phone.d.ts +2 -0
  139. package/lib/src/unit-definitions/phone.js +12 -0
  140. package/lib/src/unit-definitions/progress-bar.d.ts +2 -0
  141. package/lib/src/unit-definitions/progress-bar.js +32 -0
  142. package/lib/src/unit-definitions/reference-collection-combobox.d.ts +2 -0
  143. package/lib/src/unit-definitions/reference-collection-combobox.js +21 -0
  144. package/lib/src/unit-definitions/reference-collection-list.d.ts +2 -0
  145. package/lib/src/unit-definitions/reference-collection-list.js +22 -0
  146. package/lib/src/unit-definitions/reference-collection-view.d.ts +2 -0
  147. package/lib/src/unit-definitions/reference-collection-view.js +19 -0
  148. package/lib/src/unit-definitions/reference-collection.d.ts +2 -0
  149. package/lib/src/unit-definitions/reference-collection.js +27 -0
  150. package/lib/src/unit-definitions/reference-combobox.d.ts +2 -0
  151. package/lib/src/unit-definitions/reference-combobox.js +21 -0
  152. package/lib/src/unit-definitions/reference-icon.d.ts +2 -0
  153. package/lib/src/unit-definitions/reference-icon.js +12 -0
  154. package/lib/src/unit-definitions/reference.d.ts +2 -0
  155. package/lib/src/unit-definitions/reference.js +49 -0
  156. package/lib/src/unit-definitions/rich-text-document.d.ts +2 -0
  157. package/lib/src/unit-definitions/rich-text-document.js +22 -0
  158. package/lib/src/unit-definitions/rich-text-snippet.d.ts +2 -0
  159. package/lib/src/unit-definitions/rich-text-snippet.js +39 -0
  160. package/lib/src/unit-definitions/single-location-preview.d.ts +2 -0
  161. package/lib/src/unit-definitions/single-location-preview.js +17 -0
  162. package/lib/src/unit-definitions/text-input.d.ts +2 -0
  163. package/lib/src/unit-definitions/text-input.js +22 -0
  164. package/lib/src/unit-definitions/text.d.ts +2 -0
  165. package/lib/src/unit-definitions/text.js +22 -0
  166. package/lib/src/unit-definitions/title-input.d.ts +2 -0
  167. package/lib/src/unit-definitions/title-input.js +16 -0
  168. package/lib/src/unit-definitions/title.d.ts +2 -0
  169. package/lib/src/unit-definitions/title.js +34 -0
  170. package/lib/src/unit-definitions/type-badge-abbr.d.ts +2 -0
  171. package/lib/src/unit-definitions/type-badge-abbr.js +25 -0
  172. package/lib/src/unit-definitions/type-badge.d.ts +2 -0
  173. package/lib/src/unit-definitions/type-badge.js +25 -0
  174. package/lib/src/unit-definitions/type-icon.d.ts +2 -0
  175. package/lib/src/unit-definitions/type-icon.js +25 -0
  176. package/lib/src/unit-definitions/url-input.d.ts +2 -0
  177. package/lib/src/unit-definitions/url-input.js +12 -0
  178. package/lib/src/unit-definitions/url.d.ts +2 -0
  179. package/lib/src/unit-definitions/url.js +17 -0
  180. package/lib/src/unit-definitions/user-button.d.ts +2 -0
  181. package/lib/src/unit-definitions/user-button.js +23 -0
  182. package/lib/src/unit-definitions/user-role-input.d.ts +2 -0
  183. package/lib/src/unit-definitions/user-role-input.js +12 -0
  184. package/lib/src/unit-definitions/user-role.d.ts +2 -0
  185. package/lib/src/unit-definitions/user-role.js +29 -0
  186. package/lib/src/unit-utils/access.d.ts +9 -0
  187. package/lib/src/unit-utils/access.js +14 -0
  188. package/lib/src/unit-utils/can-edit-field.d.ts +6 -0
  189. package/lib/src/unit-utils/can-edit-field.js +8 -0
  190. package/lib/src/unit-utils/common.d.ts +14 -0
  191. package/lib/src/unit-utils/common.js +43 -0
  192. package/lib/src/unit-utils/decimal.d.ts +42 -0
  193. package/lib/src/unit-utils/decimal.js +414 -0
  194. package/lib/src/unit-utils/dynamic-keys.d.ts +7 -0
  195. package/lib/src/unit-utils/dynamic-keys.js +13 -0
  196. package/lib/src/unit-utils/enums.d.ts +27 -0
  197. package/lib/src/unit-utils/enums.js +69 -0
  198. package/lib/src/unit-utils/formatters.d.ts +50 -0
  199. package/lib/src/unit-utils/formatters.js +163 -0
  200. package/lib/src/unit-utils/get-export-value.d.ts +45 -0
  201. package/lib/src/unit-utils/get-export-value.js +83 -0
  202. package/lib/src/unit-utils/get-field-label.d.ts +6 -0
  203. package/lib/src/unit-utils/get-field-label.js +10 -0
  204. package/lib/src/unit-utils/get-unmatched-unit-label.d.ts +2 -0
  205. package/lib/src/unit-utils/get-unmatched-unit-label.js +9 -0
  206. package/lib/src/unit-utils/schema.d.ts +4 -0
  207. package/lib/src/unit-utils/schema.js +12 -0
  208. package/lib/src/units/board.d.ts +43 -0
  209. package/lib/src/units/board.js +51 -0
  210. package/lib/src/units/canvas/all-units-data-definitions.d.ts +18 -0
  211. package/lib/src/units/canvas/all-units-data-definitions.js +40 -0
  212. package/lib/src/units/canvas/index.d.ts +42 -0
  213. package/lib/src/units/canvas/index.js +48 -0
  214. package/lib/src/units/canvas/type-badge-abbr.d.ts +36 -0
  215. package/lib/src/units/canvas/type-badge-abbr.js +11 -0
  216. package/lib/src/units/canvas/type-badge.d.ts +36 -0
  217. package/lib/src/units/canvas/type-badge.js +11 -0
  218. package/lib/src/units/default.d.ts +43 -0
  219. package/lib/src/units/default.js +51 -0
  220. package/lib/src/units/gallery.d.ts +3 -0
  221. package/lib/src/units/gallery.js +18 -0
  222. package/lib/src/units/gantt.d.ts +44 -0
  223. package/lib/src/units/gantt.js +59 -0
  224. package/lib/src/units/get-unit-definitions-for-view-type.d.ts +2 -0
  225. package/lib/src/units/get-unit-definitions-for-view-type.js +64 -0
  226. package/lib/src/units/grid.d.ts +42 -0
  227. package/lib/src/units/grid.js +67 -0
  228. package/lib/src/units/list.d.ts +43 -0
  229. package/lib/src/units/list.js +49 -0
  230. package/lib/src/units/make-factory.d.ts +50 -0
  231. package/lib/src/units/make-factory.js +245 -0
  232. package/lib/src/units/types.d.ts +73 -0
  233. package/lib/src/units/types.js +2 -0
  234. package/package.json +42 -52
  235. package/lib/views.js +0 -1813
  236. /package/{index.js → lib/index.d.ts} +0 -0
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Text = void 0;
4
+ const query_1 = require("@fibery/query-utils/src/query");
5
+ const can_edit_field_1 = require("../unit-utils/can-edit-field");
6
+ const get_field_label_1 = require("../unit-utils/get-field-label");
7
+ const get_export_value_1 = require("../unit-utils/get-export-value");
8
+ const common_1 = require("../unit-utils/common");
9
+ const type = "text";
10
+ exports.Text = {
11
+ type,
12
+ name: "Input",
13
+ canEdit: can_edit_field_1.canEditField,
14
+ makeUnit: (0, common_1.makeUnitMethod)(type),
15
+ getLabel: get_field_label_1.getFieldLabel,
16
+ getQuerySelect({ typeObject, unit: { expression } }) {
17
+ return (0, query_1.getQuerySelectForExpression)({ typeObject, expression });
18
+ },
19
+ calculateErrors: common_1.calculateUnitExpressionErrors,
20
+ getExportValue: get_export_value_1.getExportValue,
21
+ canExport: () => true,
22
+ };
@@ -0,0 +1,2 @@
1
+ import { FieldUnit, UnitDataDefinition } from "../units/types";
2
+ export declare const TitleInput: UnitDataDefinition<FieldUnit>;
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TitleInput = void 0;
4
+ const title_1 = require("./title");
5
+ const type = "title-input";
6
+ exports.TitleInput = {
7
+ type,
8
+ name: "Input",
9
+ makeUnit: () => ({ type, kind: "field" }),
10
+ getLabel: title_1.Title.getLabel,
11
+ getQuerySelect: title_1.Title.getQuerySelect,
12
+ calculateErrors: title_1.Title.calculateErrors,
13
+ canEdit: title_1.Title.canEdit,
14
+ getExportValue: title_1.Title.getExportValue,
15
+ canExport: () => true,
16
+ };
@@ -0,0 +1,2 @@
1
+ import { FieldUnit, UnitDataDefinition } from "../units/types";
2
+ export declare const Title: UnitDataDefinition<FieldUnit>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Title = void 0;
4
+ const select_1 = require("@fibery/query-utils/src/select");
5
+ const get_export_value_1 = require("../unit-utils/get-export-value");
6
+ const type = "title";
7
+ exports.Title = {
8
+ type,
9
+ name: "Full",
10
+ makeUnit() {
11
+ return { type, kind: "field" };
12
+ },
13
+ getLabel({ typeObject }) {
14
+ return typeObject.titleFieldObject.title;
15
+ },
16
+ getQuerySelect({ typeObject }) {
17
+ return (0, select_1.toSelectMapClause)([typeObject.publicIdFieldObject, typeObject.titleFieldObject].filter(Boolean).map((x) => x.name));
18
+ },
19
+ calculateErrors({ typeObject, unit }) {
20
+ const errors = [];
21
+ if (typeObject.publicIdFieldObject === null) {
22
+ errors.push(`${typeObject.name} does not have public id field for ${unit.type} unit`);
23
+ }
24
+ if (typeObject.titleFieldObject === null) {
25
+ errors.push(`${typeObject.name} does not have title field for ${unit.type} unit`);
26
+ }
27
+ return errors;
28
+ },
29
+ canEdit() {
30
+ return false;
31
+ },
32
+ getExportValue: get_export_value_1.getTitleExportValue,
33
+ canExport: () => true,
34
+ };
@@ -0,0 +1,2 @@
1
+ import { DbUnit, UnitDataDefinition } from "../units/types";
2
+ export declare const TypeBadgeAbbr: UnitDataDefinition<DbUnit>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TypeBadgeAbbr = void 0;
4
+ const type = "type-badge-abbr";
5
+ exports.TypeBadgeAbbr = {
6
+ type,
7
+ name: "Abbreviation",
8
+ canEdit: () => false,
9
+ getLabel() {
10
+ return "Database Abbreviation Badge";
11
+ },
12
+ makeUnit() {
13
+ return { type, kind: "db" };
14
+ },
15
+ getQuerySelect() {
16
+ return {};
17
+ },
18
+ calculateErrors() {
19
+ return [];
20
+ },
21
+ getExportValue() {
22
+ return null;
23
+ },
24
+ canExport: () => false,
25
+ };
@@ -0,0 +1,2 @@
1
+ import { DbUnit, UnitDataDefinition } from "../units/types";
2
+ export declare const TypeBadge: UnitDataDefinition<DbUnit>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TypeBadge = void 0;
4
+ const type = "type-badge";
5
+ exports.TypeBadge = {
6
+ type,
7
+ name: "Name",
8
+ canEdit: () => false,
9
+ getLabel() {
10
+ return "Database Badge";
11
+ },
12
+ makeUnit() {
13
+ return { type, kind: "db" };
14
+ },
15
+ getQuerySelect() {
16
+ return {};
17
+ },
18
+ calculateErrors() {
19
+ return [];
20
+ },
21
+ getExportValue() {
22
+ return null;
23
+ },
24
+ canExport: () => false,
25
+ };
@@ -0,0 +1,2 @@
1
+ import { DbUnit, UnitDataDefinition } from "../units/types";
2
+ export declare const TypeIcon: UnitDataDefinition<DbUnit>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TypeIcon = void 0;
4
+ const type = "type-icon";
5
+ exports.TypeIcon = {
6
+ type,
7
+ name: "Icon",
8
+ canEdit: () => false,
9
+ getLabel() {
10
+ return "Database Icon";
11
+ },
12
+ makeUnit() {
13
+ return { type, kind: "db" };
14
+ },
15
+ getQuerySelect() {
16
+ return {};
17
+ },
18
+ calculateErrors() {
19
+ return [];
20
+ },
21
+ getExportValue() {
22
+ return null;
23
+ },
24
+ canExport: () => false,
25
+ };
@@ -0,0 +1,2 @@
1
+ import { FieldUnit, UnitDataDefinition } from "../units/types";
2
+ export declare const UrlInput: UnitDataDefinition<FieldUnit>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UrlInput = void 0;
4
+ const text_input_1 = require("./text-input");
5
+ const common_1 = require("../unit-utils/common");
6
+ const type = "url-input";
7
+ exports.UrlInput = {
8
+ ...text_input_1.TextInput,
9
+ type,
10
+ name: "Input",
11
+ makeUnit: (0, common_1.makeUnitMethod)(type),
12
+ };
@@ -0,0 +1,2 @@
1
+ import { FieldUnit, UnitDataDefinition } from "../units/types";
2
+ export declare const Url: UnitDataDefinition<FieldUnit>;
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Url = void 0;
4
+ const text_1 = require("./text");
5
+ const common_1 = require("../unit-utils/common");
6
+ const type = "url";
7
+ exports.Url = {
8
+ type,
9
+ name: "Input",
10
+ makeUnit: (0, common_1.makeUnitMethod)(type),
11
+ getLabel: text_1.Text.getLabel,
12
+ getQuerySelect: text_1.Text.getQuerySelect,
13
+ calculateErrors: text_1.Text.calculateErrors,
14
+ canEdit: text_1.Text.canEdit,
15
+ getExportValue: text_1.Text.getExportValue,
16
+ canExport: () => true,
17
+ };
@@ -0,0 +1,2 @@
1
+ import { ButtonUnit, UnitDataDefinition } from "../units/types";
2
+ export declare const UserButton: UnitDataDefinition<ButtonUnit>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserButton = void 0;
4
+ const type = "user-button";
5
+ exports.UserButton = {
6
+ type,
7
+ name: "Button",
8
+ canEdit() {
9
+ return true;
10
+ },
11
+ getLabel() {
12
+ return "";
13
+ },
14
+ makeUnit() {
15
+ return { type, kind: "user-button" };
16
+ },
17
+ getQuerySelect() {
18
+ return {};
19
+ },
20
+ calculateErrors: () => [],
21
+ getExportValue: () => null,
22
+ canExport: () => false,
23
+ };
@@ -0,0 +1,2 @@
1
+ import { FieldUnit, UnitDataDefinition } from "../units/types";
2
+ export declare const UserRoleInput: UnitDataDefinition<FieldUnit>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserRoleInput = void 0;
4
+ const user_role_1 = require("./user-role");
5
+ const common_1 = require("../unit-utils/common");
6
+ const type = "user-role-input";
7
+ exports.UserRoleInput = {
8
+ ...user_role_1.UserRole,
9
+ type,
10
+ name: "Compact List",
11
+ makeUnit: (0, common_1.makeUnitMethod)(type),
12
+ };
@@ -0,0 +1,2 @@
1
+ import { FieldUnit, UnitDataDefinition } from "../units/types";
2
+ export declare const UserRole: UnitDataDefinition<FieldUnit>;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UserRole = void 0;
4
+ const query_1 = require("@fibery/query-utils/src/query");
5
+ const common_1 = require("../unit-utils/common");
6
+ const user_role_1 = require("../field-utils/user-role");
7
+ const can_edit_field_1 = require("../unit-utils/can-edit-field");
8
+ const get_export_value_1 = require("../unit-utils/get-export-value");
9
+ const type = "user-role";
10
+ exports.UserRole = {
11
+ type,
12
+ name: "User Role",
13
+ canEdit: can_edit_field_1.canEditField,
14
+ getLabel: () => "User Role",
15
+ makeUnit: (0, common_1.makeUnitMethod)(type),
16
+ getQuerySelect({ typeObject, unit: { expression } }) {
17
+ return (0, query_1.getQuerySelectForExpression)({ typeObject, expression });
18
+ },
19
+ calculateErrors: common_1.calculateUnitExpressionErrors,
20
+ getExportValue: ({ object, unit }) => {
21
+ const value = (0, get_export_value_1.getExportValue)({ object, unit });
22
+ if (value) {
23
+ const roleDef = (0, user_role_1.getUserRoleByKey)(value);
24
+ return roleDef ? roleDef.label : value;
25
+ }
26
+ return value;
27
+ },
28
+ canExport: () => true,
29
+ };
@@ -0,0 +1,9 @@
1
+ import { TypeObject } from "@fibery/schema";
2
+ import { FieldExpression } from "@fibery/expression-utils";
3
+ export declare const accessCheckKey: string;
4
+ export declare const generateAccessCheckQueryExpression: ({ typeObject, contextPath, }: {
5
+ typeObject: TypeObject;
6
+ contextPath?: FieldExpression;
7
+ }) => {
8
+ [accessCheckKey]: (string | (string | import("@fibery/expression-utils").MultiFieldAccess)[])[];
9
+ };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateAccessCheckQueryExpression = exports.accessCheckKey = void 0;
4
+ const dynamic_keys_1 = require("./dynamic-keys");
5
+ exports.accessCheckKey = (0, dynamic_keys_1.makeDynamicKey)(dynamic_keys_1.accessCheckKeyKeyPrefix);
6
+ const generateAccessCheckQueryExpression = ({ typeObject, contextPath = [], }) => {
7
+ const titleFieldName = typeObject.titleField;
8
+ return titleFieldName
9
+ ? {
10
+ [exports.accessCheckKey]: ["q/access?", [...contextPath, titleFieldName]],
11
+ }
12
+ : {};
13
+ };
14
+ exports.generateAccessCheckQueryExpression = generateAccessCheckQueryExpression;
@@ -0,0 +1,6 @@
1
+ import { TypeObject } from "@fibery/schema";
2
+ import { FieldUnit } from "../units/types";
3
+ export declare const canEditField: ({ typeObject, unit: { expression } }: {
4
+ typeObject: TypeObject;
5
+ unit: FieldUnit;
6
+ }) => boolean;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.canEditField = void 0;
4
+ const common_1 = require("./common");
5
+ const canEditField = ({ typeObject, unit: { expression } }) => {
6
+ return (0, common_1.canEditFieldExpression)(typeObject, expression);
7
+ };
8
+ exports.canEditField = canEditField;
@@ -0,0 +1,14 @@
1
+ import { TypeObject } from "@fibery/schema";
2
+ import { FieldUnit, PureUnit, Unit, UnitExpression } from "../units/types";
3
+ import { $TSFixMe } from "../tsfixme";
4
+ export declare const makeUnitMethod: (type: FieldUnit["type"]) => ({ expression }?: {
5
+ expression?: UnitExpression;
6
+ }) => FieldUnit;
7
+ export declare const calculateUnitExpressionErrors: ({ typeObject, unit }: {
8
+ typeObject: TypeObject;
9
+ unit: Unit;
10
+ }) => string[];
11
+ export declare const isUnitEnabled: (unit: Unit) => boolean;
12
+ export declare const toPureUnit: (unit: Unit) => PureUnit;
13
+ export declare const asString: (something: $TSFixMe) => string;
14
+ export declare const canEditFieldExpression: (typeObject: TypeObject, expression: UnitExpression) => boolean;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.canEditFieldExpression = exports.asString = exports.toPureUnit = exports.isUnitEnabled = exports.calculateUnitExpressionErrors = exports.makeUnitMethod = void 0;
7
+ const omit_1 = __importDefault(require("lodash/omit"));
8
+ const get_unmatched_unit_label_1 = require("./get-unmatched-unit-label");
9
+ const utils_1 = require("@fibery/expression-utils/src/utils");
10
+ const makeUnitMethod = (type) => ({ expression } = {}) => {
11
+ (0, utils_1.assertIsValidExpression)(expression);
12
+ return { type, kind: "field", expression: expression };
13
+ };
14
+ exports.makeUnitMethod = makeUnitMethod;
15
+ const calculateUnitExpressionErrors = ({ typeObject, unit }) => {
16
+ if ("expression" in unit && !(0, utils_1.isFieldExpressionValid)({ typeObject, expression: unit.expression })) {
17
+ return [`Invalid unit ${(0, get_unmatched_unit_label_1.getUnmatchedUnitLabel)(unit)} selected`];
18
+ }
19
+ return [];
20
+ };
21
+ exports.calculateUnitExpressionErrors = calculateUnitExpressionErrors;
22
+ const isUnitEnabled = (unit) => {
23
+ const { checked } = unit;
24
+ return checked === undefined || checked === true;
25
+ };
26
+ exports.isUnitEnabled = isUnitEnabled;
27
+ const toPureUnit = (unit) => (0, omit_1.default)(unit, ["checked"]);
28
+ exports.toPureUnit = toPureUnit;
29
+ const asString = (something) => typeof something === "string" ? something : JSON.stringify(something);
30
+ exports.asString = asString;
31
+ const canEditFieldExpression = (typeObject, expression) => {
32
+ if ((0, utils_1.isFieldExpressionValid)({ typeObject, expression })) {
33
+ const fieldObject = (0, utils_1.getFieldObjectByFieldExpression)({
34
+ typeObject,
35
+ expression,
36
+ });
37
+ return fieldObject.type !== "fibery/file" && !fieldObject.isReadOnly;
38
+ }
39
+ else {
40
+ return false;
41
+ }
42
+ };
43
+ exports.canEditFieldExpression = canEditFieldExpression;
@@ -0,0 +1,42 @@
1
+ declare class Decimal {
2
+ static readonly ROUND_UP = 0;
3
+ static readonly ROUND_DOWN = 1;
4
+ static readonly ROUND_CEIL = 2;
5
+ static readonly ROUND_FLOOR = 3;
6
+ static readonly ROUND_HALF_UP = 4;
7
+ static readonly ROUND_HALF_DOWN = 5;
8
+ static readonly ROUND_HALF_EVEN = 6;
9
+ static readonly ROUND_HALF_CEIL = 7;
10
+ static readonly ROUND_HALF_FLOOR = 8;
11
+ s: number;
12
+ e: number;
13
+ d: number[] | null;
14
+ /**
15
+ * Create a new Decimal instance.
16
+ * @param v A numeric string or Decimal instance
17
+ */
18
+ constructor(v: string | Decimal);
19
+ /**
20
+ * Return a string representing the value of this Decimal in normal (fixed-point) notation to
21
+ * `dp` fixed decimal places and rounded using rounding mode `rm`.
22
+ *
23
+ * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
24
+ *
25
+ * @param dp Decimal places. Integer, 0 to MAX_DIGITS inclusive.
26
+ * @param rm Rounding mode. Integer, 0 to 8 inclusive.
27
+ *
28
+ * @example
29
+ * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
30
+ * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
31
+ * (-0).toFixed(3) is '0.000'.
32
+ * (-0.5).toFixed(0) is '-0'.
33
+ */
34
+ toFixed(dp: number, rm: number): string;
35
+ /**
36
+ * Test whether a string value is a valid decimal.
37
+ * @param value The string to test
38
+ * @returns true if the value is a valid decimal string
39
+ */
40
+ static isDecimal(value: string): boolean;
41
+ }
42
+ export default Decimal;