@fibery/views 19.1.1 → 20.0.1

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 (470) hide show
  1. package/lib/_virtual/_rolldown/runtime.js +13 -0
  2. package/lib/errors.d.ts +4 -0
  3. package/lib/errors.js +4 -0
  4. package/lib/field-utils/avatar.d.ts +23 -0
  5. package/lib/field-utils/avatar.js +35 -0
  6. package/lib/field-utils/back-references.d.ts +18 -0
  7. package/lib/field-utils/back-references.js +15 -0
  8. package/lib/field-utils/comments.d.ts +63 -0
  9. package/lib/field-utils/comments.js +41 -0
  10. package/lib/field-utils/date-time.d.ts +17 -0
  11. package/lib/field-utils/date-time.js +31 -0
  12. package/lib/field-utils/enum-value.d.ts +16 -0
  13. package/lib/field-utils/enum-value.js +26 -0
  14. package/lib/field-utils/file.d.ts +7 -0
  15. package/lib/field-utils/file.js +14 -0
  16. package/lib/field-utils/icon.d.ts +13 -0
  17. package/lib/field-utils/icon.js +17 -0
  18. package/lib/field-utils/number.d.ts +34 -0
  19. package/lib/field-utils/number.js +64 -0
  20. package/lib/field-utils/reference-collection.d.ts +16 -0
  21. package/lib/field-utils/reference-collection.js +49 -0
  22. package/lib/field-utils/reference.d.ts +10 -0
  23. package/lib/field-utils/reference.js +55 -0
  24. package/lib/field-utils/relation-view.d.ts +5 -0
  25. package/lib/field-utils/relation-view.js +7 -0
  26. package/lib/field-utils/rich-text.d.ts +16 -0
  27. package/lib/field-utils/rich-text.js +33 -0
  28. package/lib/field-utils/text.d.ts +38 -0
  29. package/lib/field-utils/text.js +37 -0
  30. package/lib/field-utils/user-active.d.ts +11 -0
  31. package/lib/field-utils/user-active.js +24 -0
  32. package/lib/field-utils/user-role.d.ts +9 -0
  33. package/lib/field-utils/user-role.js +23 -0
  34. package/lib/field-utils/workflow.d.ts +18 -0
  35. package/lib/field-utils/workflow.js +48 -0
  36. package/lib/index.d.ts +34 -1
  37. package/lib/index.js +169 -16
  38. package/lib/meta-validation.d.ts +13 -0
  39. package/lib/meta-validation.js +53 -0
  40. package/lib/private/board.d.ts +18 -0
  41. package/lib/private/board.js +234 -0
  42. package/lib/private/calendar.d.ts +17 -0
  43. package/lib/private/calendar.js +82 -0
  44. package/lib/private/feed.d.ts +17 -0
  45. package/lib/private/feed.js +81 -0
  46. package/lib/private/form.d.ts +27 -0
  47. package/lib/private/form.js +57 -0
  48. package/lib/private/map.d.ts +17 -0
  49. package/lib/private/map.js +81 -0
  50. package/lib/private/smart-folder.d.ts +33 -0
  51. package/lib/private/smart-folder.js +165 -0
  52. package/lib/private/timeline.d.ts +41 -0
  53. package/lib/private/timeline.js +223 -0
  54. package/lib/private/units.d.ts +12 -0
  55. package/lib/private/units.js +131 -0
  56. package/lib/private/utils.d.ts +66 -0
  57. package/lib/private/utils.js +179 -0
  58. package/lib/tsfixme.d.ts +4 -0
  59. package/lib/tsfixme.js +0 -0
  60. package/lib/unit-definitions/avatar-collection.d.ts +5 -0
  61. package/lib/unit-definitions/avatar-collection.js +59 -0
  62. package/lib/unit-definitions/avatar-input.d.ts +5 -0
  63. package/lib/unit-definitions/avatar-input.js +12 -0
  64. package/lib/unit-definitions/avatar.d.ts +5 -0
  65. package/lib/unit-definitions/avatar.js +95 -0
  66. package/lib/unit-definitions/back-references-list.d.ts +5 -0
  67. package/lib/unit-definitions/back-references-list.js +39 -0
  68. package/lib/unit-definitions/bool-checkbox.d.ts +5 -0
  69. package/lib/unit-definitions/bool-checkbox.js +25 -0
  70. package/lib/unit-definitions/bool.d.ts +5 -0
  71. package/lib/unit-definitions/bool.js +25 -0
  72. package/lib/unit-definitions/collection-count.d.ts +5 -0
  73. package/lib/unit-definitions/collection-count.js +35 -0
  74. package/lib/unit-definitions/color-input.d.ts +5 -0
  75. package/lib/unit-definitions/color-input.js +24 -0
  76. package/lib/unit-definitions/comments-list.d.ts +5 -0
  77. package/lib/unit-definitions/comments-list.js +27 -0
  78. package/lib/unit-definitions/date-range-combobox.d.ts +5 -0
  79. package/lib/unit-definitions/date-range-combobox.js +25 -0
  80. package/lib/unit-definitions/date-range.d.ts +5 -0
  81. package/lib/unit-definitions/date-range.js +25 -0
  82. package/lib/unit-definitions/date-time-combobox.d.ts +5 -0
  83. package/lib/unit-definitions/date-time-combobox.js +25 -0
  84. package/lib/unit-definitions/date.d.ts +5 -0
  85. package/lib/unit-definitions/date.js +25 -0
  86. package/lib/unit-definitions/email-input.d.ts +5 -0
  87. package/lib/unit-definitions/email-input.js +12 -0
  88. package/lib/unit-definitions/email.d.ts +5 -0
  89. package/lib/unit-definitions/email.js +17 -0
  90. package/lib/unit-definitions/emoji.d.ts +5 -0
  91. package/lib/unit-definitions/emoji.js +17 -0
  92. package/lib/unit-definitions/file-collection-count.d.ts +5 -0
  93. package/lib/unit-definitions/file-collection-count.js +34 -0
  94. package/lib/unit-definitions/file-compact-collection.d.ts +5 -0
  95. package/lib/unit-definitions/file-compact-collection.js +34 -0
  96. package/lib/unit-definitions/file-compact-reference.d.ts +5 -0
  97. package/lib/unit-definitions/file-compact-reference.js +47 -0
  98. package/lib/unit-definitions/file-reference.d.ts +5 -0
  99. package/lib/unit-definitions/file-reference.js +30 -0
  100. package/lib/unit-definitions/files-gallery.d.ts +5 -0
  101. package/lib/unit-definitions/files-gallery.js +34 -0
  102. package/lib/unit-definitions/files-l-list-item.d.ts +5 -0
  103. package/lib/unit-definitions/files-l-list-item.js +30 -0
  104. package/lib/unit-definitions/files-l-list.d.ts +5 -0
  105. package/lib/unit-definitions/files-l-list.js +34 -0
  106. package/lib/unit-definitions/files-list-item.d.ts +5 -0
  107. package/lib/unit-definitions/files-list-item.js +30 -0
  108. package/lib/unit-definitions/files-list.d.ts +5 -0
  109. package/lib/unit-definitions/files-list.js +34 -0
  110. package/lib/unit-definitions/geometry-preview.d.ts +5 -0
  111. package/lib/unit-definitions/geometry-preview.js +17 -0
  112. package/lib/unit-definitions/icon-button.d.ts +5 -0
  113. package/lib/unit-definitions/icon-button.js +41 -0
  114. package/lib/unit-definitions/icon-input.d.ts +5 -0
  115. package/lib/unit-definitions/icon-input.js +12 -0
  116. package/lib/unit-definitions/id.d.ts +5 -0
  117. package/lib/unit-definitions/id.js +30 -0
  118. package/lib/unit-definitions/index.d.ts +28 -0
  119. package/lib/unit-definitions/index.js +60 -0
  120. package/lib/unit-definitions/json-input.d.ts +5 -0
  121. package/lib/unit-definitions/json-input.js +24 -0
  122. package/lib/unit-definitions/location-input.d.ts +5 -0
  123. package/lib/unit-definitions/location-input.js +18 -0
  124. package/lib/unit-definitions/location.d.ts +5 -0
  125. package/lib/unit-definitions/location.js +17 -0
  126. package/lib/unit-definitions/not-found.d.ts +5 -0
  127. package/lib/unit-definitions/not-found.js +22 -0
  128. package/lib/unit-definitions/number-input.d.ts +5 -0
  129. package/lib/unit-definitions/number-input.js +25 -0
  130. package/lib/unit-definitions/number.d.ts +5 -0
  131. package/lib/unit-definitions/number.js +31 -0
  132. package/lib/unit-definitions/phone-input.d.ts +5 -0
  133. package/lib/unit-definitions/phone-input.js +12 -0
  134. package/lib/unit-definitions/phone.d.ts +5 -0
  135. package/lib/unit-definitions/phone.js +12 -0
  136. package/lib/unit-definitions/progress-bar.d.ts +5 -0
  137. package/lib/unit-definitions/progress-bar.js +32 -0
  138. package/lib/unit-definitions/reference-collection-combobox.d.ts +5 -0
  139. package/lib/unit-definitions/reference-collection-combobox.js +21 -0
  140. package/lib/unit-definitions/reference-collection-list.d.ts +5 -0
  141. package/lib/unit-definitions/reference-collection-list.js +21 -0
  142. package/lib/unit-definitions/reference-collection-view.d.ts +5 -0
  143. package/lib/unit-definitions/reference-collection-view.js +19 -0
  144. package/lib/unit-definitions/reference-collection.d.ts +5 -0
  145. package/lib/unit-definitions/reference-collection.js +30 -0
  146. package/lib/unit-definitions/reference-combobox.d.ts +5 -0
  147. package/lib/unit-definitions/reference-combobox.js +21 -0
  148. package/lib/unit-definitions/reference-icon.d.ts +5 -0
  149. package/lib/unit-definitions/reference-icon.js +12 -0
  150. package/lib/unit-definitions/reference.d.ts +5 -0
  151. package/lib/unit-definitions/reference.js +63 -0
  152. package/lib/unit-definitions/rich-text-document.d.ts +5 -0
  153. package/lib/unit-definitions/rich-text-document.js +26 -0
  154. package/lib/unit-definitions/rich-text-snippet.d.ts +6 -0
  155. package/lib/unit-definitions/rich-text-snippet.js +35 -0
  156. package/lib/unit-definitions/single-location-preview.d.ts +5 -0
  157. package/lib/unit-definitions/single-location-preview.js +17 -0
  158. package/lib/unit-definitions/text-input.d.ts +5 -0
  159. package/lib/unit-definitions/text-input.js +25 -0
  160. package/lib/unit-definitions/text.d.ts +5 -0
  161. package/lib/unit-definitions/text.js +25 -0
  162. package/lib/unit-definitions/title-input.d.ts +5 -0
  163. package/lib/unit-definitions/title-input.js +19 -0
  164. package/lib/unit-definitions/title.d.ts +5 -0
  165. package/lib/unit-definitions/title.js +33 -0
  166. package/lib/unit-definitions/type-badge-abbr.d.ts +5 -0
  167. package/lib/unit-definitions/type-badge-abbr.js +28 -0
  168. package/lib/unit-definitions/type-badge.d.ts +5 -0
  169. package/lib/unit-definitions/type-badge.js +28 -0
  170. package/lib/unit-definitions/type-icon.d.ts +5 -0
  171. package/lib/unit-definitions/type-icon.js +28 -0
  172. package/lib/unit-definitions/url-input.d.ts +5 -0
  173. package/lib/unit-definitions/url-input.js +12 -0
  174. package/lib/unit-definitions/url.d.ts +5 -0
  175. package/lib/unit-definitions/url.js +17 -0
  176. package/lib/unit-definitions/user-button.d.ts +5 -0
  177. package/lib/unit-definitions/user-button.js +26 -0
  178. package/lib/unit-definitions/user-role-input.d.ts +5 -0
  179. package/lib/unit-definitions/user-role-input.js +12 -0
  180. package/lib/unit-definitions/user-role.d.ts +5 -0
  181. package/lib/unit-definitions/user-role.js +35 -0
  182. package/lib/unit-utils/access.d.ts +12 -0
  183. package/lib/unit-utils/access.js +9 -0
  184. package/lib/unit-utils/can-edit-field.d.ts +9 -0
  185. package/lib/unit-utils/can-edit-field.js +7 -0
  186. package/lib/unit-utils/common.d.ts +17 -0
  187. package/lib/unit-utils/common.js +39 -0
  188. package/lib/unit-utils/decimal.d.ts +44 -0
  189. package/lib/unit-utils/decimal.js +248 -0
  190. package/lib/unit-utils/dynamic-keys.d.ts +10 -0
  191. package/lib/unit-utils/dynamic-keys.js +12 -0
  192. package/lib/unit-utils/enums.d.ts +30 -0
  193. package/lib/unit-utils/enums.js +48 -0
  194. package/lib/unit-utils/formatters.d.ts +53 -0
  195. package/lib/unit-utils/formatters.js +128 -0
  196. package/lib/unit-utils/get-export-value.d.ts +48 -0
  197. package/lib/unit-utils/get-export-value.js +83 -0
  198. package/lib/unit-utils/get-field-label.d.ts +9 -0
  199. package/lib/unit-utils/get-field-label.js +11 -0
  200. package/lib/unit-utils/get-unmatched-unit-label.d.ts +5 -0
  201. package/lib/unit-utils/get-unmatched-unit-label.js +5 -0
  202. package/lib/unit-utils/schema.d.ts +7 -0
  203. package/lib/unit-utils/schema.js +9 -0
  204. package/lib/unit-utils/wrap-normalized-in-expression.d.ts +6 -0
  205. package/lib/unit-utils/wrap-normalized-in-expression.js +15 -0
  206. package/lib/units/board.d.ts +50 -0
  207. package/lib/units/board.js +24 -0
  208. package/lib/units/canvas/all-units-data-definitions.d.ts +19 -0
  209. package/lib/units/canvas/all-units-data-definitions.js +42 -0
  210. package/lib/units/canvas/index.d.ts +49 -0
  211. package/lib/units/canvas/index.js +27 -0
  212. package/lib/units/canvas/type-badge-abbr.d.ts +42 -0
  213. package/lib/units/canvas/type-badge-abbr.js +11 -0
  214. package/lib/units/canvas/type-badge.d.ts +42 -0
  215. package/lib/units/canvas/type-badge.js +11 -0
  216. package/lib/units/default.d.ts +50 -0
  217. package/lib/units/default.js +23 -0
  218. package/lib/units/gallery.d.ts +7 -0
  219. package/lib/units/gallery.js +21 -0
  220. package/lib/units/gantt.d.ts +51 -0
  221. package/lib/units/gantt.js +28 -0
  222. package/lib/units/get-unit-definitions-for-view-type.d.ts +5 -0
  223. package/lib/units/get-unit-definitions-for-view-type.js +22 -0
  224. package/lib/units/grid.d.ts +49 -0
  225. package/lib/units/grid.js +81 -0
  226. package/lib/units/list.d.ts +52 -0
  227. package/lib/units/list.js +23 -0
  228. package/lib/units/make-factory.d.ts +53 -0
  229. package/lib/units/make-factory.js +272 -0
  230. package/lib/units/types.d.ts +75 -0
  231. package/lib/units/types.js +0 -0
  232. package/package.json +18 -40
  233. package/lib/src/errors.d.ts +0 -2
  234. package/lib/src/errors.js +0 -6
  235. package/lib/src/field-utils/avatar.d.ts +0 -20
  236. package/lib/src/field-utils/avatar.js +0 -42
  237. package/lib/src/field-utils/back-references.d.ts +0 -15
  238. package/lib/src/field-utils/back-references.js +0 -21
  239. package/lib/src/field-utils/comments.d.ts +0 -60
  240. package/lib/src/field-utils/comments.js +0 -46
  241. package/lib/src/field-utils/date-time.d.ts +0 -14
  242. package/lib/src/field-utils/date-time.js +0 -56
  243. package/lib/src/field-utils/enum-value.d.ts +0 -13
  244. package/lib/src/field-utils/enum-value.js +0 -29
  245. package/lib/src/field-utils/file.d.ts +0 -4
  246. package/lib/src/field-utils/file.js +0 -18
  247. package/lib/src/field-utils/icon.d.ts +0 -10
  248. package/lib/src/field-utils/icon.js +0 -26
  249. package/lib/src/field-utils/number.d.ts +0 -31
  250. package/lib/src/field-utils/number.js +0 -91
  251. package/lib/src/field-utils/reference-collection.d.ts +0 -13
  252. package/lib/src/field-utils/reference-collection.js +0 -67
  253. package/lib/src/field-utils/reference.d.ts +0 -7
  254. package/lib/src/field-utils/reference.js +0 -57
  255. package/lib/src/field-utils/relation-view.d.ts +0 -2
  256. package/lib/src/field-utils/relation-view.js +0 -12
  257. package/lib/src/field-utils/rich-text.d.ts +0 -13
  258. package/lib/src/field-utils/rich-text.js +0 -38
  259. package/lib/src/field-utils/text.d.ts +0 -35
  260. package/lib/src/field-utils/text.js +0 -40
  261. package/lib/src/field-utils/user-active.d.ts +0 -8
  262. package/lib/src/field-utils/user-active.js +0 -23
  263. package/lib/src/field-utils/user-role.d.ts +0 -6
  264. package/lib/src/field-utils/user-role.js +0 -25
  265. package/lib/src/field-utils/workflow.d.ts +0 -15
  266. package/lib/src/field-utils/workflow.js +0 -53
  267. package/lib/src/index.d.ts +0 -30
  268. package/lib/src/index.js +0 -263
  269. package/lib/src/meta-validation.d.ts +0 -10
  270. package/lib/src/meta-validation.js +0 -78
  271. package/lib/src/private/board.d.ts +0 -15
  272. package/lib/src/private/board.js +0 -327
  273. package/lib/src/private/calendar.d.ts +0 -14
  274. package/lib/src/private/calendar.js +0 -123
  275. package/lib/src/private/feed.d.ts +0 -14
  276. package/lib/src/private/feed.js +0 -120
  277. package/lib/src/private/form.d.ts +0 -25
  278. package/lib/src/private/form.js +0 -61
  279. package/lib/src/private/map.d.ts +0 -14
  280. package/lib/src/private/map.js +0 -120
  281. package/lib/src/private/smart-folder.d.ts +0 -31
  282. package/lib/src/private/smart-folder.js +0 -277
  283. package/lib/src/private/test-data/garbage-test.d.ts +0 -649
  284. package/lib/src/private/test-data/garbage-test.js +0 -520
  285. package/lib/src/private/test-data/kanban.d.ts +0 -1123
  286. package/lib/src/private/test-data/kanban.js +0 -1203
  287. package/lib/src/private/test-data/tasks.d.ts +0 -3216
  288. package/lib/src/private/test-data/tasks.js +0 -2731
  289. package/lib/src/private/timeline.d.ts +0 -39
  290. package/lib/src/private/timeline.js +0 -325
  291. package/lib/src/private/units.d.ts +0 -10
  292. package/lib/src/private/units.js +0 -165
  293. package/lib/src/private/utils.d.ts +0 -64
  294. package/lib/src/private/utils.js +0 -273
  295. package/lib/src/truthy.d.ts +0 -1
  296. package/lib/src/truthy.js +0 -7
  297. package/lib/src/tsfixme.d.ts +0 -1
  298. package/lib/src/tsfixme.js +0 -2
  299. package/lib/src/unit-definitions/avatar-collection.d.ts +0 -2
  300. package/lib/src/unit-definitions/avatar-collection.js +0 -54
  301. package/lib/src/unit-definitions/avatar-input.d.ts +0 -2
  302. package/lib/src/unit-definitions/avatar-input.js +0 -12
  303. package/lib/src/unit-definitions/avatar.d.ts +0 -2
  304. package/lib/src/unit-definitions/avatar.js +0 -88
  305. package/lib/src/unit-definitions/back-references-list.d.ts +0 -2
  306. package/lib/src/unit-definitions/back-references-list.js +0 -38
  307. package/lib/src/unit-definitions/bool-checkbox.d.ts +0 -2
  308. package/lib/src/unit-definitions/bool-checkbox.js +0 -25
  309. package/lib/src/unit-definitions/bool.d.ts +0 -2
  310. package/lib/src/unit-definitions/bool.js +0 -22
  311. package/lib/src/unit-definitions/collection-count.d.ts +0 -2
  312. package/lib/src/unit-definitions/collection-count.js +0 -32
  313. package/lib/src/unit-definitions/color-input.d.ts +0 -2
  314. package/lib/src/unit-definitions/color-input.js +0 -21
  315. package/lib/src/unit-definitions/comments-list.d.ts +0 -2
  316. package/lib/src/unit-definitions/comments-list.js +0 -25
  317. package/lib/src/unit-definitions/date-range-combobox.d.ts +0 -2
  318. package/lib/src/unit-definitions/date-range-combobox.js +0 -22
  319. package/lib/src/unit-definitions/date-range.d.ts +0 -2
  320. package/lib/src/unit-definitions/date-range.js +0 -22
  321. package/lib/src/unit-definitions/date-time-combobox.d.ts +0 -2
  322. package/lib/src/unit-definitions/date-time-combobox.js +0 -22
  323. package/lib/src/unit-definitions/date.d.ts +0 -2
  324. package/lib/src/unit-definitions/date.js +0 -22
  325. package/lib/src/unit-definitions/email-input.d.ts +0 -2
  326. package/lib/src/unit-definitions/email-input.js +0 -12
  327. package/lib/src/unit-definitions/email.d.ts +0 -2
  328. package/lib/src/unit-definitions/email.js +0 -17
  329. package/lib/src/unit-definitions/emoji.d.ts +0 -2
  330. package/lib/src/unit-definitions/emoji.js +0 -17
  331. package/lib/src/unit-definitions/file-collection-count.d.ts +0 -2
  332. package/lib/src/unit-definitions/file-collection-count.js +0 -32
  333. package/lib/src/unit-definitions/file-compact-collection.d.ts +0 -2
  334. package/lib/src/unit-definitions/file-compact-collection.js +0 -32
  335. package/lib/src/unit-definitions/file-compact-reference.d.ts +0 -2
  336. package/lib/src/unit-definitions/file-compact-reference.js +0 -37
  337. package/lib/src/unit-definitions/file-reference.d.ts +0 -2
  338. package/lib/src/unit-definitions/file-reference.js +0 -28
  339. package/lib/src/unit-definitions/files-gallery.d.ts +0 -2
  340. package/lib/src/unit-definitions/files-gallery.js +0 -32
  341. package/lib/src/unit-definitions/files-l-list-item.d.ts +0 -2
  342. package/lib/src/unit-definitions/files-l-list-item.js +0 -28
  343. package/lib/src/unit-definitions/files-l-list.d.ts +0 -2
  344. package/lib/src/unit-definitions/files-l-list.js +0 -32
  345. package/lib/src/unit-definitions/files-list-item.d.ts +0 -2
  346. package/lib/src/unit-definitions/files-list-item.js +0 -28
  347. package/lib/src/unit-definitions/files-list.d.ts +0 -2
  348. package/lib/src/unit-definitions/files-list.js +0 -32
  349. package/lib/src/unit-definitions/geometry-preview.d.ts +0 -2
  350. package/lib/src/unit-definitions/geometry-preview.js +0 -17
  351. package/lib/src/unit-definitions/icon-button.d.ts +0 -2
  352. package/lib/src/unit-definitions/icon-button.js +0 -29
  353. package/lib/src/unit-definitions/icon-input.d.ts +0 -2
  354. package/lib/src/unit-definitions/icon-input.js +0 -12
  355. package/lib/src/unit-definitions/id.d.ts +0 -2
  356. package/lib/src/unit-definitions/id.js +0 -29
  357. package/lib/src/unit-definitions/index.d.ts +0 -27
  358. package/lib/src/unit-definitions/index.js +0 -57
  359. package/lib/src/unit-definitions/json-input.d.ts +0 -2
  360. package/lib/src/unit-definitions/json-input.js +0 -21
  361. package/lib/src/unit-definitions/location-input.d.ts +0 -2
  362. package/lib/src/unit-definitions/location-input.js +0 -18
  363. package/lib/src/unit-definitions/location.d.ts +0 -2
  364. package/lib/src/unit-definitions/location.js +0 -17
  365. package/lib/src/unit-definitions/not-found.d.ts +0 -2
  366. package/lib/src/unit-definitions/not-found.js +0 -24
  367. package/lib/src/unit-definitions/number-input.d.ts +0 -2
  368. package/lib/src/unit-definitions/number-input.js +0 -22
  369. package/lib/src/unit-definitions/number.d.ts +0 -2
  370. package/lib/src/unit-definitions/number.js +0 -25
  371. package/lib/src/unit-definitions/phone-input.d.ts +0 -2
  372. package/lib/src/unit-definitions/phone-input.js +0 -12
  373. package/lib/src/unit-definitions/phone.d.ts +0 -2
  374. package/lib/src/unit-definitions/phone.js +0 -12
  375. package/lib/src/unit-definitions/progress-bar.d.ts +0 -2
  376. package/lib/src/unit-definitions/progress-bar.js +0 -29
  377. package/lib/src/unit-definitions/reference-collection-combobox.d.ts +0 -2
  378. package/lib/src/unit-definitions/reference-collection-combobox.js +0 -21
  379. package/lib/src/unit-definitions/reference-collection-list.d.ts +0 -2
  380. package/lib/src/unit-definitions/reference-collection-list.js +0 -22
  381. package/lib/src/unit-definitions/reference-collection-view.d.ts +0 -2
  382. package/lib/src/unit-definitions/reference-collection-view.js +0 -19
  383. package/lib/src/unit-definitions/reference-collection.d.ts +0 -2
  384. package/lib/src/unit-definitions/reference-collection.js +0 -28
  385. package/lib/src/unit-definitions/reference-combobox.d.ts +0 -2
  386. package/lib/src/unit-definitions/reference-combobox.js +0 -21
  387. package/lib/src/unit-definitions/reference-icon.d.ts +0 -2
  388. package/lib/src/unit-definitions/reference-icon.js +0 -12
  389. package/lib/src/unit-definitions/reference.d.ts +0 -2
  390. package/lib/src/unit-definitions/reference.js +0 -61
  391. package/lib/src/unit-definitions/rich-text-document.d.ts +0 -2
  392. package/lib/src/unit-definitions/rich-text-document.js +0 -22
  393. package/lib/src/unit-definitions/rich-text-snippet.d.ts +0 -3
  394. package/lib/src/unit-definitions/rich-text-snippet.js +0 -34
  395. package/lib/src/unit-definitions/single-location-preview.d.ts +0 -2
  396. package/lib/src/unit-definitions/single-location-preview.js +0 -17
  397. package/lib/src/unit-definitions/text-input.d.ts +0 -2
  398. package/lib/src/unit-definitions/text-input.js +0 -22
  399. package/lib/src/unit-definitions/text.d.ts +0 -2
  400. package/lib/src/unit-definitions/text.js +0 -22
  401. package/lib/src/unit-definitions/title-input.d.ts +0 -2
  402. package/lib/src/unit-definitions/title-input.js +0 -16
  403. package/lib/src/unit-definitions/title.d.ts +0 -2
  404. package/lib/src/unit-definitions/title.js +0 -34
  405. package/lib/src/unit-definitions/type-badge-abbr.d.ts +0 -2
  406. package/lib/src/unit-definitions/type-badge-abbr.js +0 -25
  407. package/lib/src/unit-definitions/type-badge.d.ts +0 -2
  408. package/lib/src/unit-definitions/type-badge.js +0 -25
  409. package/lib/src/unit-definitions/type-icon.d.ts +0 -2
  410. package/lib/src/unit-definitions/type-icon.js +0 -25
  411. package/lib/src/unit-definitions/url-input.d.ts +0 -2
  412. package/lib/src/unit-definitions/url-input.js +0 -12
  413. package/lib/src/unit-definitions/url.d.ts +0 -2
  414. package/lib/src/unit-definitions/url.js +0 -17
  415. package/lib/src/unit-definitions/user-button.d.ts +0 -2
  416. package/lib/src/unit-definitions/user-button.js +0 -23
  417. package/lib/src/unit-definitions/user-role-input.d.ts +0 -2
  418. package/lib/src/unit-definitions/user-role-input.js +0 -12
  419. package/lib/src/unit-definitions/user-role.d.ts +0 -2
  420. package/lib/src/unit-definitions/user-role.js +0 -29
  421. package/lib/src/unit-utils/access.d.ts +0 -9
  422. package/lib/src/unit-utils/access.js +0 -14
  423. package/lib/src/unit-utils/can-edit-field.d.ts +0 -6
  424. package/lib/src/unit-utils/can-edit-field.js +0 -8
  425. package/lib/src/unit-utils/common.d.ts +0 -14
  426. package/lib/src/unit-utils/common.js +0 -43
  427. package/lib/src/unit-utils/decimal.d.ts +0 -42
  428. package/lib/src/unit-utils/decimal.js +0 -418
  429. package/lib/src/unit-utils/dynamic-keys.d.ts +0 -7
  430. package/lib/src/unit-utils/dynamic-keys.js +0 -13
  431. package/lib/src/unit-utils/enums.d.ts +0 -27
  432. package/lib/src/unit-utils/enums.js +0 -69
  433. package/lib/src/unit-utils/formatters.d.ts +0 -50
  434. package/lib/src/unit-utils/formatters.js +0 -163
  435. package/lib/src/unit-utils/get-export-value.d.ts +0 -45
  436. package/lib/src/unit-utils/get-export-value.js +0 -83
  437. package/lib/src/unit-utils/get-field-label.d.ts +0 -6
  438. package/lib/src/unit-utils/get-field-label.js +0 -10
  439. package/lib/src/unit-utils/get-unmatched-unit-label.d.ts +0 -2
  440. package/lib/src/unit-utils/get-unmatched-unit-label.js +0 -9
  441. package/lib/src/unit-utils/schema.d.ts +0 -4
  442. package/lib/src/unit-utils/schema.js +0 -12
  443. package/lib/src/unit-utils/wrap-normalized-in-expression.d.ts +0 -3
  444. package/lib/src/unit-utils/wrap-normalized-in-expression.js +0 -14
  445. package/lib/src/units/board.d.ts +0 -46
  446. package/lib/src/units/board.js +0 -51
  447. package/lib/src/units/canvas/all-units-data-definitions.d.ts +0 -18
  448. package/lib/src/units/canvas/all-units-data-definitions.js +0 -40
  449. package/lib/src/units/canvas/index.d.ts +0 -45
  450. package/lib/src/units/canvas/index.js +0 -48
  451. package/lib/src/units/canvas/type-badge-abbr.d.ts +0 -36
  452. package/lib/src/units/canvas/type-badge-abbr.js +0 -11
  453. package/lib/src/units/canvas/type-badge.d.ts +0 -36
  454. package/lib/src/units/canvas/type-badge.js +0 -11
  455. package/lib/src/units/default.d.ts +0 -46
  456. package/lib/src/units/default.js +0 -51
  457. package/lib/src/units/gallery.d.ts +0 -3
  458. package/lib/src/units/gallery.js +0 -18
  459. package/lib/src/units/gantt.d.ts +0 -47
  460. package/lib/src/units/gantt.js +0 -59
  461. package/lib/src/units/get-unit-definitions-for-view-type.d.ts +0 -2
  462. package/lib/src/units/get-unit-definitions-for-view-type.js +0 -64
  463. package/lib/src/units/grid.d.ts +0 -45
  464. package/lib/src/units/grid.js +0 -71
  465. package/lib/src/units/list.d.ts +0 -46
  466. package/lib/src/units/list.js +0 -49
  467. package/lib/src/units/make-factory.d.ts +0 -51
  468. package/lib/src/units/make-factory.js +0 -261
  469. package/lib/src/units/types.d.ts +0 -73
  470. package/lib/src/units/types.js +0 -2
@@ -0,0 +1,248 @@
1
+ //#region src/unit-utils/decimal.ts
2
+ const EXP_LIMIT = 9e15;
3
+ const MAX_DIGITS = 1e9;
4
+ const minE = -9e15;
5
+ const maxE = EXP_LIMIT;
6
+ const invalidArgument = "[DecimalError] Invalid argument: ";
7
+ const mathpow = Math.pow;
8
+ const isDecimalRegex = /^-?(\d+(\.\d*)?|\.\d+)$/i;
9
+ const BASE = 1e7;
10
+ const LOG_BASE = 7;
11
+ function checkInt32(i, min, max) {
12
+ if (i !== ~~i || i < min || i > max) throw Error(invalidArgument + i);
13
+ }
14
+ const isNeg = (decimal) => {
15
+ return decimal.s < 0;
16
+ };
17
+ const isZero = (decimal) => {
18
+ return Boolean(decimal.d) && decimal.d?.[0] === 0;
19
+ };
20
+ const isFinite = (decimal) => {
21
+ return Boolean(decimal.d);
22
+ };
23
+ function nonFiniteToString(x) {
24
+ return String(x.s * x.s / 0);
25
+ }
26
+ function getZeroString(k) {
27
+ let zs = "";
28
+ for (let i = k; i--;) zs += "0";
29
+ return zs;
30
+ }
31
+ function digitsToString(d) {
32
+ let str = "";
33
+ let w = d[0];
34
+ const indexOfLastWord = d.length - 1;
35
+ if (indexOfLastWord > 0) {
36
+ str += w;
37
+ let i;
38
+ for (i = 1; i < indexOfLastWord; i++) {
39
+ const ws = String(d[i]);
40
+ const k = LOG_BASE - ws.length;
41
+ if (k) str += getZeroString(k);
42
+ str += ws;
43
+ }
44
+ w = d[i];
45
+ const k = LOG_BASE - String(w).length;
46
+ if (k) str += getZeroString(k);
47
+ } else if (w === 0) return "0";
48
+ for (; w % 10 === 0;) w /= 10;
49
+ return str + w;
50
+ }
51
+ function finiteToString(x, sd) {
52
+ if (!isFinite(x)) return nonFiniteToString(x);
53
+ let k;
54
+ const e = x.e;
55
+ let str = digitsToString(x.d);
56
+ const len = str.length;
57
+ if (e < 0) {
58
+ str = "0." + getZeroString(-e - 1) + str;
59
+ if (sd && (k = sd - len) > 0) str += getZeroString(k);
60
+ } else if (e >= len) {
61
+ str += getZeroString(e + 1 - len);
62
+ if (sd && (k = sd - e - 1) > 0) str = str + "." + getZeroString(k);
63
+ } else {
64
+ if ((k = e + 1) < len) str = str.slice(0, k) + "." + str.slice(k);
65
+ if (sd && (k = sd - len) > 0) {
66
+ if (e + 1 === len) str += ".";
67
+ str += getZeroString(k);
68
+ }
69
+ }
70
+ return str;
71
+ }
72
+ function finalise(x, sd, rm) {
73
+ let digits;
74
+ let i;
75
+ let j;
76
+ let k;
77
+ let rd;
78
+ let roundUp;
79
+ let w;
80
+ let xd;
81
+ let xdi;
82
+ out: if (sd != null) {
83
+ xd = x.d;
84
+ if (!xd) return x;
85
+ for (digits = 1, k = xd[0]; k >= 10; k /= 10) digits++;
86
+ i = sd - digits;
87
+ if (i < 0) {
88
+ i += LOG_BASE;
89
+ j = sd;
90
+ w = xd[xdi = 0];
91
+ rd = w / mathpow(10, digits - j - 1) % 10 | 0;
92
+ } else {
93
+ xdi = Math.ceil((i + 1) / LOG_BASE);
94
+ k = xd.length;
95
+ if (xdi >= k) break out;
96
+ else {
97
+ w = k = xd[xdi];
98
+ for (digits = 1; k >= 10; k /= 10) digits++;
99
+ i %= LOG_BASE;
100
+ j = i - LOG_BASE + digits;
101
+ rd = j < 0 ? 0 : w / mathpow(10, digits - j - 1) % 10 | 0;
102
+ }
103
+ }
104
+ const isTruncated = sd < 0 || xd[xdi + 1] !== void 0 || (j < 0 ? w : w % mathpow(10, digits - j - 1));
105
+ roundUp = rm < 4 ? (rd || isTruncated) && (rm == 0 || rm == (x.s < 0 ? 3 : 2)) : rd > 5 || rd == 5 && (rm == 4 || isTruncated || rm == 6 && (i > 0 ? j > 0 ? w / mathpow(10, digits - j) : 0 : xd[xdi - 1]) % 10 & 1 || rm == (x.s < 0 ? 8 : 7));
106
+ if (sd < 1 || !xd[0]) {
107
+ xd.length = 0;
108
+ if (roundUp) {
109
+ sd -= x.e + 1;
110
+ xd[0] = mathpow(10, (LOG_BASE - sd % LOG_BASE) % LOG_BASE);
111
+ x.e = -sd || 0;
112
+ } else xd[0] = x.e = 0;
113
+ return x;
114
+ }
115
+ if (i == 0) {
116
+ xd.length = xdi;
117
+ k = 1;
118
+ xdi--;
119
+ } else {
120
+ xd.length = xdi + 1;
121
+ k = mathpow(10, LOG_BASE - i);
122
+ xd[xdi] = j > 0 ? (w / mathpow(10, digits - j) % mathpow(10, j) | 0) * k : 0;
123
+ }
124
+ if (roundUp) for (;;) if (xdi == 0) {
125
+ for (i = 1, j = xd[0]; j >= 10; j /= 10) i++;
126
+ j = xd[0] += k;
127
+ for (k = 1; j >= 10; j /= 10) k++;
128
+ if (i != k) {
129
+ x.e++;
130
+ if (xd[0] == BASE) xd[0] = 1;
131
+ }
132
+ break;
133
+ } else {
134
+ xd[xdi] += k;
135
+ if (xd[xdi] != BASE) break;
136
+ xd[xdi--] = 0;
137
+ k = 1;
138
+ }
139
+ for (i = xd.length; xd[--i] === 0;) xd.pop();
140
+ }
141
+ return x;
142
+ }
143
+ function toFixedHelper(decimal, decimalPlaces, roundingMode) {
144
+ if (decimalPlaces === void 0) throw new Error("number of decimal places must be specified");
145
+ checkInt32(decimalPlaces, 0, MAX_DIGITS);
146
+ if (roundingMode === void 0) throw new Error("rounding strategy must be specified");
147
+ else checkInt32(roundingMode, 0, 8);
148
+ const rounded = finalise(new Decimal(decimal), decimalPlaces + decimal.e + 1, roundingMode);
149
+ const str = finiteToString(rounded, decimalPlaces + rounded.e + 1);
150
+ return isNeg(decimal) && !isZero(decimal) ? "-" + str : str;
151
+ }
152
+ function parseDecimal(x, str) {
153
+ let e = str.indexOf(".");
154
+ if (e > -1) str = str.replace(".", "");
155
+ if (e < 0) e = str.length;
156
+ let i;
157
+ for (i = 0; str.charCodeAt(i) === 48; i++);
158
+ let len;
159
+ for (len = str.length; str.charCodeAt(len - 1) === 48; --len);
160
+ str = str.slice(i, len);
161
+ if (str) {
162
+ len -= i;
163
+ x.e = e = e - i - 1;
164
+ x.d = [];
165
+ i = (e + 1) % LOG_BASE;
166
+ if (e < 0) i += LOG_BASE;
167
+ if (i < len) {
168
+ if (i) x.d.push(Number(str.slice(0, i)));
169
+ for (len -= LOG_BASE; i < len;) x.d.push(Number(str.slice(i, i += LOG_BASE)));
170
+ str = str.slice(i);
171
+ i = LOG_BASE - str.length;
172
+ } else i -= len;
173
+ for (; i--;) str += "0";
174
+ x.d.push(Number(str));
175
+ if (x.e > maxE) {
176
+ x.e = NaN;
177
+ x.d = null;
178
+ } else if (x.e < minE) {
179
+ x.e = 0;
180
+ x.d = [0];
181
+ }
182
+ } else {
183
+ x.e = 0;
184
+ x.d = [0];
185
+ }
186
+ return x;
187
+ }
188
+ var Decimal = class Decimal {
189
+ static ROUND_UP = 0;
190
+ static ROUND_DOWN = 1;
191
+ static ROUND_CEIL = 2;
192
+ static ROUND_FLOOR = 3;
193
+ static ROUND_HALF_UP = 4;
194
+ static ROUND_HALF_DOWN = 5;
195
+ static ROUND_HALF_EVEN = 6;
196
+ static ROUND_HALF_CEIL = 7;
197
+ static ROUND_HALF_FLOOR = 8;
198
+ s = 0;
199
+ e = 0;
200
+ d = null;
201
+ /**
202
+ * Create a new Decimal instance.
203
+ * @param v A numeric string or Decimal instance
204
+ */
205
+ constructor(v) {
206
+ if (v instanceof Decimal) {
207
+ this.s = v.s;
208
+ this.e = v.e;
209
+ this.d = v.d ? v.d.slice() : v.d;
210
+ return;
211
+ }
212
+ if (typeof v !== "string") throw Error(invalidArgument + v);
213
+ if (v.charCodeAt(0) === 45) {
214
+ v = v.slice(1);
215
+ this.s = -1;
216
+ } else this.s = 1;
217
+ if (!isDecimalRegex.test(v)) throw new Error("String value is not Decimal");
218
+ parseDecimal(this, v);
219
+ }
220
+ /**
221
+ * Return a string representing the value of this Decimal in normal (fixed-point) notation to
222
+ * `dp` fixed decimal places and rounded using rounding mode `rm`.
223
+ *
224
+ * As with JavaScript numbers, (-0).toFixed(0) is '0', but e.g. (-0.00001).toFixed(0) is '-0'.
225
+ *
226
+ * @param dp Decimal places. Integer, 0 to MAX_DIGITS inclusive.
227
+ * @param rm Rounding mode. Integer, 0 to 8 inclusive.
228
+ *
229
+ * @example
230
+ * (-0).toFixed(0) is '0', but (-0.1).toFixed(0) is '-0'.
231
+ * (-0).toFixed(1) is '0.0', but (-0.01).toFixed(1) is '-0.0'.
232
+ * (-0).toFixed(3) is '0.000'.
233
+ * (-0.5).toFixed(0) is '-0'.
234
+ */
235
+ toFixed(dp, rm) {
236
+ return toFixedHelper(this, dp, rm);
237
+ }
238
+ /**
239
+ * Test whether a string value is a valid decimal.
240
+ * @param value The string to test
241
+ * @returns true if the value is a valid decimal string
242
+ */
243
+ static isDecimal(value) {
244
+ return isDecimalRegex.test(value);
245
+ }
246
+ };
247
+ //#endregion
248
+ export { Decimal as default };
@@ -0,0 +1,10 @@
1
+ //#region src/unit-utils/dynamic-keys.d.ts
2
+ declare const isUserActiveDynamicKeyPrefix = "is-user-active";
3
+ declare const isFinalStateDynamicKeyPrefix = "is-final-state";
4
+ declare const colorCodingKeyPrefix = "color-coding";
5
+ declare const hasAccessToSecretKeyPrefix = "has-access-to-secret";
6
+ declare const collectionCountKeyPrefix = "collection-count";
7
+ declare const accessCheckKeyKeyPrefix = "access/check";
8
+ declare const makeDynamicKey: (prefix: string, key?: string) => string;
9
+ //#endregion
10
+ export { accessCheckKeyKeyPrefix, collectionCountKeyPrefix, colorCodingKeyPrefix, hasAccessToSecretKeyPrefix, isFinalStateDynamicKeyPrefix, isUserActiveDynamicKeyPrefix, makeDynamicKey };
@@ -0,0 +1,12 @@
1
+ //#region src/unit-utils/dynamic-keys.ts
2
+ const isUserActiveDynamicKeyPrefix = "is-user-active";
3
+ const isFinalStateDynamicKeyPrefix = "is-final-state";
4
+ const colorCodingKeyPrefix = "color-coding";
5
+ const hasAccessToSecretKeyPrefix = "has-access-to-secret";
6
+ const collectionCountKeyPrefix = "collection-count";
7
+ const accessCheckKeyKeyPrefix = "access/check";
8
+ const makeDynamicKey = (prefix, key) => {
9
+ return `?${prefix}${key === void 0 ? "" : `_${key}`}`;
10
+ };
11
+ //#endregion
12
+ export { accessCheckKeyKeyPrefix, collectionCountKeyPrefix, colorCodingKeyPrefix, hasAccessToSecretKeyPrefix, isFinalStateDynamicKeyPrefix, isUserActiveDynamicKeyPrefix, makeDynamicKey };
@@ -0,0 +1,30 @@
1
+ import { TypeObject } from "@fibery/schema";
2
+ import { FieldExpression } from "@fibery/expression-utils";
3
+ import { Select } from "@fibery/expression-utils/src/types";
4
+ //#region src/unit-utils/enums.d.ts
5
+ declare const getEnumIconColorQuery: ({ typeObject, contextPath }: {
6
+ typeObject: TypeObject;
7
+ contextPath?: FieldExpression;
8
+ }) => Select;
9
+ declare function getEnumIconSelect(typeObject: TypeObject): {
10
+ "enum/icon": string[];
11
+ } | {
12
+ "enum/icon"?: undefined;
13
+ };
14
+ declare const getEnumsRequest: (enumTypeObject: TypeObject) => {
15
+ query: {
16
+ "q/from": string;
17
+ "q/select": {
18
+ "workflow/Final"?: string | undefined;
19
+ "workflow/Type"?: string | undefined;
20
+ "fibery/id": string;
21
+ "enum/name": string;
22
+ "fibery/rank": string;
23
+ };
24
+ "q/limit": string;
25
+ "q/order-by": (string | string[])[][];
26
+ };
27
+ params: {};
28
+ };
29
+ //#endregion
30
+ export { getEnumIconColorQuery, getEnumIconSelect, getEnumsRequest };
@@ -0,0 +1,48 @@
1
+ import { generateAccessCheckQueryExpression } from "./access.js";
2
+ import { getNumberFieldObject } from "../field-utils/enum-value.js";
3
+ import { toSelectMapClause } from "@fibery/query-utils/src/select";
4
+ //#region src/unit-utils/enums.ts
5
+ const getWorkflowQuery = ({ typeObject }) => {
6
+ if (!typeObject.isEnum) return null;
7
+ return typeObject.nameParts.namespace === "workflow" ? {
8
+ "workflow/Final": "workflow/Final",
9
+ "workflow/Type": "workflow/Type"
10
+ } : null;
11
+ };
12
+ const getEnumIconColorQuery = ({ typeObject, contextPath = [] }) => {
13
+ if (!typeObject.isEnum) return {};
14
+ const select = { "?accessToIcon": ["q/access?", [...contextPath, "enum/icon"]] };
15
+ if (Object.hasOwn(typeObject.fieldObjectsByName, "enum/color")) select["enum/color"] = "enum/color";
16
+ if (Object.hasOwn(typeObject.fieldObjectsByName, "enum/icon")) select["enum/icon"] = "enum/icon";
17
+ return select;
18
+ };
19
+ const getEnumNumberFieldQuery = (typeObject) => {
20
+ const fieldObject = getNumberFieldObject(typeObject);
21
+ if (!fieldObject) return null;
22
+ return toSelectMapClause([fieldObject.name]);
23
+ };
24
+ function getEnumIconSelect(typeObject) {
25
+ if (typeObject.isEnum) return { "enum/icon": ["enum/icon"] };
26
+ return {};
27
+ }
28
+ const getEnumsRequest = (enumTypeObject) => {
29
+ return {
30
+ query: {
31
+ "q/from": enumTypeObject.name,
32
+ "q/select": {
33
+ "fibery/id": "fibery/id",
34
+ "enum/name": "enum/name",
35
+ "fibery/rank": "fibery/rank",
36
+ ...generateAccessCheckQueryExpression({ typeObject: enumTypeObject }),
37
+ ...getEnumIconColorQuery({ typeObject: enumTypeObject }),
38
+ ...getWorkflowQuery({ typeObject: enumTypeObject }),
39
+ ...getEnumNumberFieldQuery(enumTypeObject)
40
+ },
41
+ "q/limit": "q/no-limit",
42
+ "q/order-by": [[["fibery/rank"], "q/asc"]]
43
+ },
44
+ params: {}
45
+ };
46
+ };
47
+ //#endregion
48
+ export { getEnumIconColorQuery, getEnumIconSelect, getEnumsRequest };
@@ -0,0 +1,53 @@
1
+ import { NumberDisplaySettings } from "../field-utils/number.js";
2
+ import { FieldObject } from "@fibery/schema";
3
+ //#region src/unit-utils/formatters.d.ts
4
+ declare const defaultLocale = "en-US";
5
+ declare const defaultDateFormat = "MMM D, YYYY";
6
+ declare const defaultDateTimeFormat = "MMM D, YYYY HH:mm";
7
+ declare const defaultTimeFormat = "HH:mm";
8
+ declare const formatArbitraryNumber: (value: number, displaySettings?: NumberDisplaySettings, options?: Intl.NumberFormatOptions) => string;
9
+ declare const formatNumber: (useGrouping: boolean, precision: number, value: number, displaySettings?: NumberDisplaySettings) => string;
10
+ declare const formatCurrency: (currency: string, useGrouping: boolean, precision: number, value: number | string, displaySettings?: NumberDisplaySettings) => string;
11
+ declare const formatPercent: (useGrouping: boolean, precision: number, value: number | string, displaySettings?: NumberDisplaySettings) => string;
12
+ declare const formatNumberWithoutUnit: ({ value, format, displaySettings, currencyCode, precision, useThousandSeparator }: {
13
+ value: string;
14
+ format?: string;
15
+ displaySettings?: NumberDisplaySettings;
16
+ currencyCode: string | null;
17
+ precision: number;
18
+ useThousandSeparator: boolean;
19
+ }) => string;
20
+ declare const formatNumberWithUnitAsString: ({ value, format, displaySettings, unit, currencyCode, precision, useThousandSeparator, withNumberUnit }: {
21
+ value: string;
22
+ format?: string;
23
+ displaySettings?: NumberDisplaySettings;
24
+ unit?: string | null;
25
+ currencyCode: string | null;
26
+ precision: number;
27
+ useThousandSeparator: boolean;
28
+ withNumberUnit: boolean;
29
+ }) => string;
30
+ declare const formatNumberWithUnitAsStringByFieldObject: (fieldObject: FieldObject, value: string, displaySettings?: NumberDisplaySettings) => string;
31
+ declare const formatDateRange: ({ value, type, format }: {
32
+ value: {
33
+ start: string;
34
+ end: string;
35
+ };
36
+ type: string;
37
+ format?: string;
38
+ }) => string;
39
+ declare const formatDateTimeRange: ({ value, type, dateFormat, timeFormat, dateTimeFormat }: {
40
+ value: {
41
+ start: string;
42
+ end: string;
43
+ };
44
+ type: string;
45
+ dateFormat?: string;
46
+ timeFormat?: string;
47
+ dateTimeFormat?: string;
48
+ }) => string;
49
+ declare function formatUnitUrl(url: string): {
50
+ host: string;
51
+ };
52
+ //#endregion
53
+ export { defaultDateFormat, defaultDateTimeFormat, defaultLocale, defaultTimeFormat, formatArbitraryNumber, formatCurrency, formatDateRange, formatDateTimeRange, formatNumber, formatNumberWithUnitAsString, formatNumberWithUnitAsStringByFieldObject, formatNumberWithoutUnit, formatPercent, formatUnitUrl };
@@ -0,0 +1,128 @@
1
+ import { parseEnd, parseStart } from "../field-utils/date-time.js";
2
+ import { parseNumberFieldMeta } from "../field-utils/number.js";
3
+ import Decimal from "./decimal.js";
4
+ import isNil from "lodash/isNil.js";
5
+ //#region src/unit-utils/formatters.ts
6
+ const defaultLocale = "en-US";
7
+ const defaultDateFormat = "MMM D, YYYY";
8
+ const defaultDateTimeFormat = "MMM D, YYYY HH:mm";
9
+ const defaultTimeFormat = "HH:mm";
10
+ const applyDisplaySettings = (parts, displaySettings) => {
11
+ if (!displaySettings) return parts.map((part) => part.value).join("");
12
+ return parts.map((part) => {
13
+ if (part.type === "group") return displaySettings.thousandSeparator;
14
+ if (part.type === "decimal") return displaySettings.decimalSeparator;
15
+ return part.value;
16
+ }).join("");
17
+ };
18
+ const formatArbitraryNumber = (value, displaySettings, options = {}) => {
19
+ const formatter = new Intl.NumberFormat(defaultLocale, {
20
+ style: "decimal",
21
+ ...options
22
+ });
23
+ return applyDisplaySettings(formatter.formatToParts(value), displaySettings);
24
+ };
25
+ const formatNumber = (useGrouping, precision, value, displaySettings) => {
26
+ const formatter = new Intl.NumberFormat(defaultLocale, {
27
+ style: "decimal",
28
+ useGrouping,
29
+ minimumFractionDigits: precision,
30
+ maximumFractionDigits: precision,
31
+ signDisplay: "negative"
32
+ });
33
+ return applyDisplaySettings(formatter.formatToParts(value), displaySettings);
34
+ };
35
+ const formatCurrency = (currency, useGrouping, precision, value, displaySettings) => {
36
+ const formatter = new Intl.NumberFormat(defaultLocale, {
37
+ style: "currency",
38
+ currency,
39
+ useGrouping,
40
+ minimumFractionDigits: precision,
41
+ maximumFractionDigits: precision,
42
+ signDisplay: "negative"
43
+ });
44
+ return applyDisplaySettings(formatter.formatToParts(Number(value)), displaySettings);
45
+ };
46
+ const formatPercent = (useGrouping, precision, value, displaySettings) => {
47
+ const formatter = new Intl.NumberFormat(defaultLocale, {
48
+ style: "percent",
49
+ useGrouping,
50
+ minimumFractionDigits: precision,
51
+ maximumFractionDigits: precision,
52
+ signDisplay: "negative"
53
+ });
54
+ return applyDisplaySettings(formatter.formatToParts(Number(value)), displaySettings);
55
+ };
56
+ const formatNumberWithoutUnit = ({ value, format = "Number", displaySettings, currencyCode, precision, useThousandSeparator }) => {
57
+ try {
58
+ switch (format) {
59
+ case "Number": {
60
+ const valueWithPrecision = new Decimal(value).toFixed(precision, Decimal.ROUND_HALF_CEIL);
61
+ return formatNumber(useThousandSeparator, precision, Number(valueWithPrecision), displaySettings);
62
+ }
63
+ case "Money": return formatCurrency(currencyCode, useThousandSeparator, precision, value, displaySettings);
64
+ case "Percent": return formatPercent(useThousandSeparator, precision, value, displaySettings);
65
+ default: return value;
66
+ }
67
+ } catch (error) {
68
+ return value;
69
+ }
70
+ };
71
+ const formatNumberWithUnitAsString = ({ value, format = "Number", displaySettings, unit, currencyCode, precision, useThousandSeparator, withNumberUnit = true }) => {
72
+ if (isNil(value)) return "";
73
+ return `${formatNumberWithoutUnit({
74
+ value,
75
+ format,
76
+ displaySettings,
77
+ currencyCode,
78
+ precision,
79
+ useThousandSeparator
80
+ })}${format === "Number" && unit && withNumberUnit ? ` ${unit}` : ""}`;
81
+ };
82
+ const formatNumberWithUnitAsStringByFieldObject = (fieldObject, value, displaySettings) => {
83
+ const { numberFormat, numberPrecision, numberUnit, numberCurrencyCode, numberUseThousandSeparator } = parseNumberFieldMeta(fieldObject);
84
+ return formatNumberWithUnitAsString({
85
+ value,
86
+ format: numberFormat,
87
+ displaySettings,
88
+ unit: numberUnit,
89
+ currencyCode: numberCurrencyCode,
90
+ precision: numberPrecision,
91
+ useThousandSeparator: numberUseThousandSeparator,
92
+ withNumberUnit: true
93
+ });
94
+ };
95
+ const formatDateRange = ({ value, type, format = defaultDateFormat }) => {
96
+ return `${value ? parseStart({
97
+ value: value.start,
98
+ type
99
+ }).format(format) : "No Start Date"} → ${value ? parseEnd({
100
+ value: value.end,
101
+ type
102
+ }).format(format) : "No End Date"}`;
103
+ };
104
+ const formatDateTimeRange = ({ value, type, dateFormat = defaultDateFormat, timeFormat = defaultTimeFormat, dateTimeFormat = defaultDateTimeFormat }) => {
105
+ if (!value) return `No Start Date → No End Date`;
106
+ const startDate = parseStart({
107
+ value: value.start,
108
+ type
109
+ });
110
+ const endDate = parseEnd({
111
+ value: value.end,
112
+ type
113
+ });
114
+ if (startDate && endDate && startDate.isSame(endDate, "day")) return `${startDate.format(dateFormat)} ${startDate.format(timeFormat)} → ${endDate.format(timeFormat)}`;
115
+ return `${startDate.format(dateTimeFormat)} → ${endDate.format(dateTimeFormat)}`;
116
+ };
117
+ function formatUnitUrl(url) {
118
+ try {
119
+ const trimmed = url.trim();
120
+ if (url === "" || url === " " || url === "/" || url === "https://" || url === "http://" || url === "www.") return { host: trimmed };
121
+ const cleaned = trimmed.replace(/^https?:\/\//, "").replace(/^www\./, "").replace(/\/+$/, "");
122
+ return { host: cleaned.length > 200 ? cleaned.slice(0, 197) + "…" : cleaned };
123
+ } catch {
124
+ return { host: url };
125
+ }
126
+ }
127
+ //#endregion
128
+ export { defaultDateFormat, defaultDateTimeFormat, defaultLocale, defaultTimeFormat, formatArbitraryNumber, formatCurrency, formatDateRange, formatDateTimeRange, formatNumber, formatNumberWithUnitAsString, formatNumberWithUnitAsStringByFieldObject, formatNumberWithoutUnit, formatPercent, formatUnitUrl };
@@ -0,0 +1,48 @@
1
+ import { NumberDisplaySettings } from "../field-utils/number.js";
2
+ import { FieldUnit } from "../units/types.js";
3
+ import { FieldObject, TypeObject } from "@fibery/schema";
4
+ import { FiberyObject } from "@fibery/expression-utils/src/types";
5
+ //#region src/unit-utils/get-export-value.d.ts
6
+ declare const getExportValue: ({ object, unit }: {
7
+ object: FiberyObject;
8
+ unit: FieldUnit;
9
+ }) => any;
10
+ declare const getReferenceCollectionExportValue: ({ unit, typeObject, object }: {
11
+ object: FiberyObject;
12
+ unit: FieldUnit;
13
+ typeObject: TypeObject;
14
+ }) => (string | undefined)[] | FiberyObject[] | null;
15
+ declare const getReferenceExportValue: ({ unit, typeObject, object }: {
16
+ object: FiberyObject;
17
+ unit: FieldUnit;
18
+ typeObject: TypeObject;
19
+ }) => string | null | undefined;
20
+ declare const getSnippetExportValue: ({ object, unit }: {
21
+ object: FiberyObject;
22
+ unit: FieldUnit;
23
+ }) => any;
24
+ declare const formatDateRangeExportValue: (value: {
25
+ start: string;
26
+ end: string;
27
+ } | null, fieldObject: FieldObject | null) => string | null;
28
+ declare const getDateRangeExportValue: ({ object, unit, typeObject }: {
29
+ object: FiberyObject;
30
+ unit: FieldUnit;
31
+ typeObject: TypeObject;
32
+ }) => string | null;
33
+ declare const getLocationExportValue: ({ object, unit }: {
34
+ object: FiberyObject;
35
+ unit: FieldUnit;
36
+ }) => any;
37
+ declare const getTitleExportValue: ({ object, typeObject }: {
38
+ object: FiberyObject;
39
+ typeObject: TypeObject;
40
+ }) => string | undefined;
41
+ declare const getNumberExportValue: ({ object, unit, typeObject, displaySettings }: {
42
+ object: FiberyObject;
43
+ typeObject: TypeObject;
44
+ unit: FieldUnit;
45
+ displaySettings: NumberDisplaySettings;
46
+ }) => string;
47
+ //#endregion
48
+ export { formatDateRangeExportValue, getDateRangeExportValue, getExportValue, getLocationExportValue, getNumberExportValue, getReferenceCollectionExportValue, getReferenceExportValue, getSnippetExportValue, getTitleExportValue };
@@ -0,0 +1,83 @@
1
+ import { parseNumberFieldMeta } from "../field-utils/number.js";
2
+ import { formatNumberWithUnitAsString } from "./formatters.js";
3
+ import { getFieldObjectByFieldExpression } from "@fibery/expression-utils/src/utils";
4
+ import { getValueByFieldExpression } from "@fibery/query-utils/src/query";
5
+ import { formatISO, parseISO, subDays, subSeconds } from "date-fns";
6
+ //#region src/unit-utils/get-export-value.ts
7
+ const getExportValue = ({ object, unit }) => {
8
+ return getValueByFieldExpression(object, unit.expression);
9
+ };
10
+ const getReferenceCollectionExportValue = ({ unit, typeObject, object }) => {
11
+ const value = getValueByFieldExpression(object, unit.expression);
12
+ if (!value || value.length === 0) return value;
13
+ const fieldObject = getFieldObjectByFieldExpression({
14
+ typeObject,
15
+ expression: unit.expression
16
+ });
17
+ return value.map((v) => v[fieldObject.typeObject.titleField]);
18
+ };
19
+ const getReferenceExportValue = ({ unit, typeObject, object }) => {
20
+ const value = getValueByFieldExpression(object, unit.expression);
21
+ if (!value) return value;
22
+ return value[getFieldObjectByFieldExpression({
23
+ typeObject,
24
+ expression: unit.expression
25
+ }).typeObject.titleField];
26
+ };
27
+ const getSnippetExportValue = ({ object, unit }) => {
28
+ return getExportValue({
29
+ object,
30
+ unit
31
+ })?.["Collaboration~Documents/Snippet"];
32
+ };
33
+ const formatDateRangeExportValue = (value, fieldObject) => {
34
+ if (value) {
35
+ const start = value.start;
36
+ let end = value.end;
37
+ if (fieldObject?.type === "fibery/date-range") end = formatISO(subDays(parseISO(end), 1), { representation: "date" });
38
+ else if (fieldObject?.type === "fibery/date-time-range") end = subSeconds(parseISO(end), 1).toISOString();
39
+ return `${start} - ${end}`;
40
+ }
41
+ return value;
42
+ };
43
+ const getDateRangeExportValue = ({ object, unit, typeObject }) => {
44
+ const value = getExportValue({
45
+ object,
46
+ unit
47
+ });
48
+ const fieldObject = getFieldObjectByFieldExpression({
49
+ expression: unit.expression,
50
+ typeObject
51
+ });
52
+ return formatDateRangeExportValue(value, fieldObject);
53
+ };
54
+ const getLocationExportValue = ({ object, unit }) => {
55
+ const value = getExportValue({
56
+ object,
57
+ unit
58
+ });
59
+ return value ? JSON.stringify(value) : value;
60
+ };
61
+ const getTitleExportValue = ({ object, typeObject }) => {
62
+ return object?.[typeObject.titleField];
63
+ };
64
+ const getNumberExportValue = ({ object, unit, typeObject, displaySettings }) => {
65
+ const fieldObject = getFieldObjectByFieldExpression({
66
+ typeObject,
67
+ expression: unit.expression
68
+ });
69
+ const value = getValueByFieldExpression(object, unit.expression);
70
+ const { numberFormat, numberPrecision, numberUnit, numberCurrencyCode, numberUseThousandSeparator } = parseNumberFieldMeta(fieldObject);
71
+ return formatNumberWithUnitAsString({
72
+ value,
73
+ format: numberFormat,
74
+ displaySettings,
75
+ unit: numberUnit,
76
+ currencyCode: numberCurrencyCode,
77
+ precision: numberPrecision,
78
+ useThousandSeparator: numberUseThousandSeparator,
79
+ withNumberUnit: true
80
+ });
81
+ };
82
+ //#endregion
83
+ export { formatDateRangeExportValue, getDateRangeExportValue, getExportValue, getLocationExportValue, getNumberExportValue, getReferenceCollectionExportValue, getReferenceExportValue, getSnippetExportValue, getTitleExportValue };
@@ -0,0 +1,9 @@
1
+ import { FieldUnit } from "../units/types.js";
2
+ import { TypeObject } from "@fibery/schema";
3
+ //#region src/unit-utils/get-field-label.d.ts
4
+ declare const getFieldLabel: ({ typeObject, unit }: {
5
+ typeObject: TypeObject;
6
+ unit: FieldUnit;
7
+ }) => string;
8
+ //#endregion
9
+ export { getFieldLabel };
@@ -0,0 +1,11 @@
1
+ import { getFieldObjectsByFieldExpression } from "@fibery/expression-utils/src/utils";
2
+ //#region src/unit-utils/get-field-label.ts
3
+ const getFieldLabel = ({ typeObject, unit }) => {
4
+ const { expression } = unit;
5
+ return getFieldObjectsByFieldExpression({
6
+ typeObject,
7
+ expression
8
+ }).map((fieldObject) => fieldObject.title).join(" -> ");
9
+ };
10
+ //#endregion
11
+ export { getFieldLabel };