@fibery/views 19.1.2 → 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.
- package/lib/_virtual/_rolldown/runtime.js +13 -0
- package/lib/errors.d.ts +4 -0
- package/lib/errors.js +4 -0
- package/lib/field-utils/avatar.d.ts +23 -0
- package/lib/field-utils/avatar.js +35 -0
- package/lib/field-utils/back-references.d.ts +18 -0
- package/lib/field-utils/back-references.js +15 -0
- package/lib/field-utils/comments.d.ts +63 -0
- package/lib/field-utils/comments.js +41 -0
- package/lib/field-utils/date-time.d.ts +17 -0
- package/lib/field-utils/date-time.js +31 -0
- package/lib/field-utils/enum-value.d.ts +16 -0
- package/lib/field-utils/enum-value.js +26 -0
- package/lib/field-utils/file.d.ts +7 -0
- package/lib/field-utils/file.js +14 -0
- package/lib/field-utils/icon.d.ts +13 -0
- package/lib/field-utils/icon.js +17 -0
- package/lib/field-utils/number.d.ts +34 -0
- package/lib/field-utils/number.js +64 -0
- package/lib/field-utils/reference-collection.d.ts +16 -0
- package/lib/field-utils/reference-collection.js +49 -0
- package/lib/field-utils/reference.d.ts +10 -0
- package/lib/field-utils/reference.js +55 -0
- package/lib/field-utils/relation-view.d.ts +5 -0
- package/lib/field-utils/relation-view.js +7 -0
- package/lib/field-utils/rich-text.d.ts +16 -0
- package/lib/field-utils/rich-text.js +33 -0
- package/lib/field-utils/text.d.ts +33 -0
- package/lib/field-utils/text.js +40 -0
- package/lib/field-utils/user-active.d.ts +11 -0
- package/lib/field-utils/user-active.js +24 -0
- package/lib/field-utils/user-role.d.ts +9 -0
- package/lib/field-utils/user-role.js +23 -0
- package/lib/field-utils/workflow.d.ts +18 -0
- package/lib/field-utils/workflow.js +48 -0
- package/lib/index.d.ts +34 -1
- package/lib/index.js +169 -16
- package/lib/meta-validation.d.ts +13 -0
- package/lib/meta-validation.js +53 -0
- package/lib/private/board.d.ts +18 -0
- package/lib/private/board.js +234 -0
- package/lib/private/calendar.d.ts +17 -0
- package/lib/private/calendar.js +82 -0
- package/lib/private/feed.d.ts +17 -0
- package/lib/private/feed.js +81 -0
- package/lib/private/form.d.ts +27 -0
- package/lib/private/form.js +57 -0
- package/lib/private/map.d.ts +17 -0
- package/lib/private/map.js +81 -0
- package/lib/private/smart-folder.d.ts +33 -0
- package/lib/private/smart-folder.js +165 -0
- package/lib/private/timeline.d.ts +41 -0
- package/lib/private/timeline.js +223 -0
- package/lib/private/units.d.ts +12 -0
- package/lib/private/units.js +131 -0
- package/lib/private/utils.d.ts +66 -0
- package/lib/private/utils.js +179 -0
- package/lib/unit-definitions/avatar-collection.d.ts +5 -0
- package/lib/unit-definitions/avatar-collection.js +59 -0
- package/lib/unit-definitions/avatar-input.d.ts +5 -0
- package/lib/unit-definitions/avatar-input.js +12 -0
- package/lib/unit-definitions/avatar.d.ts +5 -0
- package/lib/unit-definitions/avatar.js +95 -0
- package/lib/unit-definitions/back-references-list.d.ts +5 -0
- package/lib/unit-definitions/back-references-list.js +39 -0
- package/lib/unit-definitions/bool-checkbox.d.ts +5 -0
- package/lib/unit-definitions/bool-checkbox.js +25 -0
- package/lib/unit-definitions/bool.d.ts +5 -0
- package/lib/unit-definitions/bool.js +25 -0
- package/lib/unit-definitions/collection-count.d.ts +5 -0
- package/lib/unit-definitions/collection-count.js +35 -0
- package/lib/unit-definitions/color-input.d.ts +5 -0
- package/lib/unit-definitions/color-input.js +24 -0
- package/lib/unit-definitions/comments-list.d.ts +5 -0
- package/lib/unit-definitions/comments-list.js +27 -0
- package/lib/unit-definitions/date-range-combobox.d.ts +5 -0
- package/lib/unit-definitions/date-range-combobox.js +25 -0
- package/lib/unit-definitions/date-range.d.ts +5 -0
- package/lib/unit-definitions/date-range.js +25 -0
- package/lib/unit-definitions/date-time-combobox.d.ts +5 -0
- package/lib/unit-definitions/date-time-combobox.js +25 -0
- package/lib/unit-definitions/date.d.ts +5 -0
- package/lib/unit-definitions/date.js +25 -0
- package/lib/unit-definitions/email-input.d.ts +5 -0
- package/lib/unit-definitions/email-input.js +12 -0
- package/lib/unit-definitions/email.d.ts +5 -0
- package/lib/unit-definitions/email.js +17 -0
- package/lib/unit-definitions/emoji.d.ts +5 -0
- package/lib/unit-definitions/emoji.js +17 -0
- package/lib/unit-definitions/file-collection-count.d.ts +5 -0
- package/lib/unit-definitions/file-collection-count.js +34 -0
- package/lib/unit-definitions/file-compact-collection.d.ts +5 -0
- package/lib/unit-definitions/file-compact-collection.js +34 -0
- package/lib/unit-definitions/file-compact-reference.d.ts +5 -0
- package/lib/unit-definitions/file-compact-reference.js +47 -0
- package/lib/unit-definitions/file-reference.d.ts +5 -0
- package/lib/unit-definitions/file-reference.js +30 -0
- package/lib/unit-definitions/files-gallery.d.ts +5 -0
- package/lib/unit-definitions/files-gallery.js +34 -0
- package/lib/unit-definitions/files-l-list-item.d.ts +5 -0
- package/lib/unit-definitions/files-l-list-item.js +30 -0
- package/lib/unit-definitions/files-l-list.d.ts +5 -0
- package/lib/unit-definitions/files-l-list.js +34 -0
- package/lib/unit-definitions/files-list-item.d.ts +5 -0
- package/lib/unit-definitions/files-list-item.js +30 -0
- package/lib/unit-definitions/files-list.d.ts +5 -0
- package/lib/unit-definitions/files-list.js +34 -0
- package/lib/unit-definitions/geometry-preview.d.ts +5 -0
- package/lib/unit-definitions/geometry-preview.js +17 -0
- package/lib/unit-definitions/icon-button.d.ts +5 -0
- package/lib/unit-definitions/icon-button.js +41 -0
- package/lib/unit-definitions/icon-input.d.ts +5 -0
- package/lib/unit-definitions/icon-input.js +12 -0
- package/lib/unit-definitions/id.d.ts +5 -0
- package/lib/unit-definitions/id.js +30 -0
- package/lib/unit-definitions/index.d.ts +28 -0
- package/lib/unit-definitions/index.js +60 -0
- package/lib/unit-definitions/json-input.d.ts +5 -0
- package/lib/unit-definitions/json-input.js +24 -0
- package/lib/unit-definitions/location-input.d.ts +5 -0
- package/lib/unit-definitions/location-input.js +18 -0
- package/lib/unit-definitions/location.d.ts +5 -0
- package/lib/unit-definitions/location.js +17 -0
- package/lib/unit-definitions/not-found.d.ts +5 -0
- package/lib/unit-definitions/not-found.js +22 -0
- package/lib/unit-definitions/number-input.d.ts +5 -0
- package/lib/unit-definitions/number-input.js +25 -0
- package/lib/unit-definitions/number.d.ts +5 -0
- package/lib/unit-definitions/number.js +31 -0
- package/lib/unit-definitions/phone-input.d.ts +5 -0
- package/lib/unit-definitions/phone-input.js +12 -0
- package/lib/unit-definitions/phone.d.ts +5 -0
- package/lib/unit-definitions/phone.js +12 -0
- package/lib/unit-definitions/progress-bar.d.ts +5 -0
- package/lib/unit-definitions/progress-bar.js +32 -0
- package/lib/unit-definitions/reference-collection-combobox.d.ts +5 -0
- package/lib/unit-definitions/reference-collection-combobox.js +21 -0
- package/lib/unit-definitions/reference-collection-list.d.ts +5 -0
- package/lib/unit-definitions/reference-collection-list.js +21 -0
- package/lib/unit-definitions/reference-collection-view.d.ts +5 -0
- package/lib/unit-definitions/reference-collection-view.js +19 -0
- package/lib/unit-definitions/reference-collection.d.ts +5 -0
- package/lib/unit-definitions/reference-collection.js +30 -0
- package/lib/unit-definitions/reference-combobox.d.ts +5 -0
- package/lib/unit-definitions/reference-combobox.js +21 -0
- package/lib/unit-definitions/reference-icon.d.ts +5 -0
- package/lib/unit-definitions/reference-icon.js +12 -0
- package/lib/unit-definitions/reference.d.ts +5 -0
- package/lib/unit-definitions/reference.js +63 -0
- package/lib/unit-definitions/rich-text-document.d.ts +5 -0
- package/lib/unit-definitions/rich-text-document.js +26 -0
- package/lib/unit-definitions/rich-text-snippet.d.ts +6 -0
- package/lib/unit-definitions/rich-text-snippet.js +35 -0
- package/lib/unit-definitions/single-location-preview.d.ts +5 -0
- package/lib/unit-definitions/single-location-preview.js +17 -0
- package/lib/unit-definitions/text-input.d.ts +5 -0
- package/lib/unit-definitions/text-input.js +25 -0
- package/lib/unit-definitions/text.d.ts +5 -0
- package/lib/unit-definitions/text.js +25 -0
- package/lib/unit-definitions/title-input.d.ts +5 -0
- package/lib/unit-definitions/title-input.js +19 -0
- package/lib/unit-definitions/title.d.ts +5 -0
- package/lib/unit-definitions/title.js +33 -0
- package/lib/unit-definitions/type-badge-abbr.d.ts +5 -0
- package/lib/unit-definitions/type-badge-abbr.js +28 -0
- package/lib/unit-definitions/type-badge.d.ts +5 -0
- package/lib/unit-definitions/type-badge.js +28 -0
- package/lib/unit-definitions/type-icon.d.ts +5 -0
- package/lib/unit-definitions/type-icon.js +28 -0
- package/lib/unit-definitions/url-input.d.ts +5 -0
- package/lib/unit-definitions/url-input.js +12 -0
- package/lib/unit-definitions/url.d.ts +5 -0
- package/lib/unit-definitions/url.js +17 -0
- package/lib/unit-definitions/user-button.d.ts +5 -0
- package/lib/unit-definitions/user-button.js +26 -0
- package/lib/unit-definitions/user-role-input.d.ts +5 -0
- package/lib/unit-definitions/user-role-input.js +12 -0
- package/lib/unit-definitions/user-role.d.ts +5 -0
- package/lib/unit-definitions/user-role.js +35 -0
- package/lib/unit-utils/access.d.ts +12 -0
- package/lib/unit-utils/access.js +9 -0
- package/lib/unit-utils/can-edit-field.d.ts +9 -0
- package/lib/unit-utils/can-edit-field.js +7 -0
- package/lib/unit-utils/common.d.ts +37 -0
- package/lib/unit-utils/common.js +41 -0
- package/lib/unit-utils/decimal.d.ts +44 -0
- package/lib/unit-utils/decimal.js +248 -0
- package/lib/unit-utils/dynamic-keys.d.ts +10 -0
- package/lib/unit-utils/dynamic-keys.js +12 -0
- package/lib/unit-utils/enums.d.ts +30 -0
- package/lib/unit-utils/enums.js +48 -0
- package/lib/unit-utils/formatters.d.ts +53 -0
- package/lib/unit-utils/formatters.js +128 -0
- package/lib/unit-utils/get-export-value.d.ts +48 -0
- package/lib/unit-utils/get-export-value.js +83 -0
- package/lib/unit-utils/get-field-label.d.ts +9 -0
- package/lib/unit-utils/get-field-label.js +11 -0
- package/lib/unit-utils/get-unmatched-unit-label.d.ts +5 -0
- package/lib/unit-utils/get-unmatched-unit-label.js +5 -0
- package/lib/unit-utils/schema.d.ts +7 -0
- package/lib/unit-utils/schema.js +9 -0
- package/lib/unit-utils/wrap-normalized-in-expression.d.ts +6 -0
- package/lib/unit-utils/wrap-normalized-in-expression.js +15 -0
- package/lib/units/board.d.ts +50 -0
- package/lib/units/board.js +24 -0
- package/lib/units/canvas/all-units-data-definitions.d.ts +19 -0
- package/lib/units/canvas/all-units-data-definitions.js +42 -0
- package/lib/units/canvas/index.d.ts +49 -0
- package/lib/units/canvas/index.js +27 -0
- package/lib/units/canvas/type-badge-abbr.d.ts +41 -0
- package/lib/units/canvas/type-badge-abbr.js +11 -0
- package/lib/units/canvas/type-badge.d.ts +41 -0
- package/lib/units/canvas/type-badge.js +11 -0
- package/lib/units/default.d.ts +50 -0
- package/lib/units/default.js +23 -0
- package/lib/units/gallery.d.ts +7 -0
- package/lib/units/gallery.js +21 -0
- package/lib/units/gantt.d.ts +51 -0
- package/lib/units/gantt.js +28 -0
- package/lib/units/get-unit-definitions-for-view-type.d.ts +5 -0
- package/lib/units/get-unit-definitions-for-view-type.js +22 -0
- package/lib/units/grid.d.ts +49 -0
- package/lib/units/grid.js +81 -0
- package/lib/units/list.d.ts +52 -0
- package/lib/units/list.js +23 -0
- package/lib/units/make-factory.d.ts +53 -0
- package/lib/units/make-factory.js +272 -0
- package/lib/units/types.d.ts +74 -0
- package/lib/units/types.js +0 -0
- package/package.json +18 -40
- package/lib/src/errors.d.ts +0 -2
- package/lib/src/errors.js +0 -6
- package/lib/src/field-utils/avatar.d.ts +0 -20
- package/lib/src/field-utils/avatar.js +0 -39
- package/lib/src/field-utils/back-references.d.ts +0 -15
- package/lib/src/field-utils/back-references.js +0 -21
- package/lib/src/field-utils/comments.d.ts +0 -60
- package/lib/src/field-utils/comments.js +0 -46
- package/lib/src/field-utils/date-time.d.ts +0 -14
- package/lib/src/field-utils/date-time.js +0 -56
- package/lib/src/field-utils/enum-value.d.ts +0 -13
- package/lib/src/field-utils/enum-value.js +0 -29
- package/lib/src/field-utils/file.d.ts +0 -4
- package/lib/src/field-utils/file.js +0 -15
- package/lib/src/field-utils/icon.d.ts +0 -10
- package/lib/src/field-utils/icon.js +0 -26
- package/lib/src/field-utils/number.d.ts +0 -31
- package/lib/src/field-utils/number.js +0 -91
- package/lib/src/field-utils/reference-collection.d.ts +0 -13
- package/lib/src/field-utils/reference-collection.js +0 -67
- package/lib/src/field-utils/reference.d.ts +0 -7
- package/lib/src/field-utils/reference.js +0 -54
- package/lib/src/field-utils/relation-view.d.ts +0 -2
- package/lib/src/field-utils/relation-view.js +0 -12
- package/lib/src/field-utils/rich-text.d.ts +0 -13
- package/lib/src/field-utils/rich-text.js +0 -38
- package/lib/src/field-utils/text.d.ts +0 -35
- package/lib/src/field-utils/text.js +0 -40
- package/lib/src/field-utils/user-active.d.ts +0 -8
- package/lib/src/field-utils/user-active.js +0 -23
- package/lib/src/field-utils/user-role.d.ts +0 -6
- package/lib/src/field-utils/user-role.js +0 -25
- package/lib/src/field-utils/workflow.d.ts +0 -15
- package/lib/src/field-utils/workflow.js +0 -53
- package/lib/src/index.d.ts +0 -30
- package/lib/src/index.js +0 -263
- package/lib/src/meta-validation.d.ts +0 -10
- package/lib/src/meta-validation.js +0 -78
- package/lib/src/private/board.d.ts +0 -15
- package/lib/src/private/board.js +0 -327
- package/lib/src/private/calendar.d.ts +0 -14
- package/lib/src/private/calendar.js +0 -123
- package/lib/src/private/feed.d.ts +0 -14
- package/lib/src/private/feed.js +0 -120
- package/lib/src/private/form.d.ts +0 -25
- package/lib/src/private/form.js +0 -61
- package/lib/src/private/map.d.ts +0 -14
- package/lib/src/private/map.js +0 -120
- package/lib/src/private/smart-folder.d.ts +0 -31
- package/lib/src/private/smart-folder.js +0 -277
- package/lib/src/private/test-data/garbage-test.d.ts +0 -649
- package/lib/src/private/test-data/garbage-test.js +0 -520
- package/lib/src/private/test-data/kanban.d.ts +0 -1123
- package/lib/src/private/test-data/kanban.js +0 -1203
- package/lib/src/private/test-data/tasks.d.ts +0 -3216
- package/lib/src/private/test-data/tasks.js +0 -2731
- package/lib/src/private/timeline.d.ts +0 -39
- package/lib/src/private/timeline.js +0 -325
- package/lib/src/private/units.d.ts +0 -10
- package/lib/src/private/units.js +0 -165
- package/lib/src/private/utils.d.ts +0 -64
- package/lib/src/private/utils.js +0 -273
- package/lib/src/tsfixme.d.ts +0 -1
- package/lib/src/tsfixme.js +0 -2
- package/lib/src/unit-definitions/avatar-collection.d.ts +0 -2
- package/lib/src/unit-definitions/avatar-collection.js +0 -53
- package/lib/src/unit-definitions/avatar-input.d.ts +0 -2
- package/lib/src/unit-definitions/avatar-input.js +0 -12
- package/lib/src/unit-definitions/avatar.d.ts +0 -2
- package/lib/src/unit-definitions/avatar.js +0 -87
- package/lib/src/unit-definitions/back-references-list.d.ts +0 -2
- package/lib/src/unit-definitions/back-references-list.js +0 -38
- package/lib/src/unit-definitions/bool-checkbox.d.ts +0 -2
- package/lib/src/unit-definitions/bool-checkbox.js +0 -25
- package/lib/src/unit-definitions/bool.d.ts +0 -2
- package/lib/src/unit-definitions/bool.js +0 -22
- package/lib/src/unit-definitions/collection-count.d.ts +0 -2
- package/lib/src/unit-definitions/collection-count.js +0 -32
- package/lib/src/unit-definitions/color-input.d.ts +0 -2
- package/lib/src/unit-definitions/color-input.js +0 -21
- package/lib/src/unit-definitions/comments-list.d.ts +0 -2
- package/lib/src/unit-definitions/comments-list.js +0 -25
- package/lib/src/unit-definitions/date-range-combobox.d.ts +0 -2
- package/lib/src/unit-definitions/date-range-combobox.js +0 -22
- package/lib/src/unit-definitions/date-range.d.ts +0 -2
- package/lib/src/unit-definitions/date-range.js +0 -22
- package/lib/src/unit-definitions/date-time-combobox.d.ts +0 -2
- package/lib/src/unit-definitions/date-time-combobox.js +0 -22
- package/lib/src/unit-definitions/date.d.ts +0 -2
- package/lib/src/unit-definitions/date.js +0 -22
- package/lib/src/unit-definitions/email-input.d.ts +0 -2
- package/lib/src/unit-definitions/email-input.js +0 -12
- package/lib/src/unit-definitions/email.d.ts +0 -2
- package/lib/src/unit-definitions/email.js +0 -17
- package/lib/src/unit-definitions/emoji.d.ts +0 -2
- package/lib/src/unit-definitions/emoji.js +0 -17
- package/lib/src/unit-definitions/file-collection-count.d.ts +0 -2
- package/lib/src/unit-definitions/file-collection-count.js +0 -32
- package/lib/src/unit-definitions/file-compact-collection.d.ts +0 -2
- package/lib/src/unit-definitions/file-compact-collection.js +0 -32
- package/lib/src/unit-definitions/file-compact-reference.d.ts +0 -2
- package/lib/src/unit-definitions/file-compact-reference.js +0 -37
- package/lib/src/unit-definitions/file-reference.d.ts +0 -2
- package/lib/src/unit-definitions/file-reference.js +0 -28
- package/lib/src/unit-definitions/files-gallery.d.ts +0 -2
- package/lib/src/unit-definitions/files-gallery.js +0 -32
- package/lib/src/unit-definitions/files-l-list-item.d.ts +0 -2
- package/lib/src/unit-definitions/files-l-list-item.js +0 -28
- package/lib/src/unit-definitions/files-l-list.d.ts +0 -2
- package/lib/src/unit-definitions/files-l-list.js +0 -32
- package/lib/src/unit-definitions/files-list-item.d.ts +0 -2
- package/lib/src/unit-definitions/files-list-item.js +0 -28
- package/lib/src/unit-definitions/files-list.d.ts +0 -2
- package/lib/src/unit-definitions/files-list.js +0 -32
- package/lib/src/unit-definitions/geometry-preview.d.ts +0 -2
- package/lib/src/unit-definitions/geometry-preview.js +0 -17
- package/lib/src/unit-definitions/icon-button.d.ts +0 -2
- package/lib/src/unit-definitions/icon-button.js +0 -29
- package/lib/src/unit-definitions/icon-input.d.ts +0 -2
- package/lib/src/unit-definitions/icon-input.js +0 -12
- package/lib/src/unit-definitions/id.d.ts +0 -2
- package/lib/src/unit-definitions/id.js +0 -29
- package/lib/src/unit-definitions/index.d.ts +0 -27
- package/lib/src/unit-definitions/index.js +0 -57
- package/lib/src/unit-definitions/json-input.d.ts +0 -2
- package/lib/src/unit-definitions/json-input.js +0 -21
- package/lib/src/unit-definitions/location-input.d.ts +0 -2
- package/lib/src/unit-definitions/location-input.js +0 -18
- package/lib/src/unit-definitions/location.d.ts +0 -2
- package/lib/src/unit-definitions/location.js +0 -17
- package/lib/src/unit-definitions/not-found.d.ts +0 -2
- package/lib/src/unit-definitions/not-found.js +0 -24
- package/lib/src/unit-definitions/number-input.d.ts +0 -2
- package/lib/src/unit-definitions/number-input.js +0 -22
- package/lib/src/unit-definitions/number.d.ts +0 -2
- package/lib/src/unit-definitions/number.js +0 -25
- package/lib/src/unit-definitions/phone-input.d.ts +0 -2
- package/lib/src/unit-definitions/phone-input.js +0 -12
- package/lib/src/unit-definitions/phone.d.ts +0 -2
- package/lib/src/unit-definitions/phone.js +0 -12
- package/lib/src/unit-definitions/progress-bar.d.ts +0 -2
- package/lib/src/unit-definitions/progress-bar.js +0 -29
- package/lib/src/unit-definitions/reference-collection-combobox.d.ts +0 -2
- package/lib/src/unit-definitions/reference-collection-combobox.js +0 -21
- package/lib/src/unit-definitions/reference-collection-list.d.ts +0 -2
- package/lib/src/unit-definitions/reference-collection-list.js +0 -22
- package/lib/src/unit-definitions/reference-collection-view.d.ts +0 -2
- package/lib/src/unit-definitions/reference-collection-view.js +0 -19
- package/lib/src/unit-definitions/reference-collection.d.ts +0 -2
- package/lib/src/unit-definitions/reference-collection.js +0 -28
- package/lib/src/unit-definitions/reference-combobox.d.ts +0 -2
- package/lib/src/unit-definitions/reference-combobox.js +0 -21
- package/lib/src/unit-definitions/reference-icon.d.ts +0 -2
- package/lib/src/unit-definitions/reference-icon.js +0 -12
- package/lib/src/unit-definitions/reference.d.ts +0 -2
- package/lib/src/unit-definitions/reference.js +0 -61
- package/lib/src/unit-definitions/rich-text-document.d.ts +0 -2
- package/lib/src/unit-definitions/rich-text-document.js +0 -22
- package/lib/src/unit-definitions/rich-text-snippet.d.ts +0 -3
- package/lib/src/unit-definitions/rich-text-snippet.js +0 -34
- package/lib/src/unit-definitions/single-location-preview.d.ts +0 -2
- package/lib/src/unit-definitions/single-location-preview.js +0 -17
- package/lib/src/unit-definitions/text-input.d.ts +0 -2
- package/lib/src/unit-definitions/text-input.js +0 -22
- package/lib/src/unit-definitions/text.d.ts +0 -2
- package/lib/src/unit-definitions/text.js +0 -22
- package/lib/src/unit-definitions/title-input.d.ts +0 -2
- package/lib/src/unit-definitions/title-input.js +0 -16
- package/lib/src/unit-definitions/title.d.ts +0 -2
- package/lib/src/unit-definitions/title.js +0 -34
- package/lib/src/unit-definitions/type-badge-abbr.d.ts +0 -2
- package/lib/src/unit-definitions/type-badge-abbr.js +0 -25
- package/lib/src/unit-definitions/type-badge.d.ts +0 -2
- package/lib/src/unit-definitions/type-badge.js +0 -25
- package/lib/src/unit-definitions/type-icon.d.ts +0 -2
- package/lib/src/unit-definitions/type-icon.js +0 -25
- package/lib/src/unit-definitions/url-input.d.ts +0 -2
- package/lib/src/unit-definitions/url-input.js +0 -12
- package/lib/src/unit-definitions/url.d.ts +0 -2
- package/lib/src/unit-definitions/url.js +0 -17
- package/lib/src/unit-definitions/user-button.d.ts +0 -2
- package/lib/src/unit-definitions/user-button.js +0 -23
- package/lib/src/unit-definitions/user-role-input.d.ts +0 -2
- package/lib/src/unit-definitions/user-role-input.js +0 -12
- package/lib/src/unit-definitions/user-role.d.ts +0 -2
- package/lib/src/unit-definitions/user-role.js +0 -29
- package/lib/src/unit-utils/access.d.ts +0 -9
- package/lib/src/unit-utils/access.js +0 -14
- package/lib/src/unit-utils/can-edit-field.d.ts +0 -6
- package/lib/src/unit-utils/can-edit-field.js +0 -8
- package/lib/src/unit-utils/common.d.ts +0 -14
- package/lib/src/unit-utils/common.js +0 -43
- package/lib/src/unit-utils/decimal.d.ts +0 -42
- package/lib/src/unit-utils/decimal.js +0 -418
- package/lib/src/unit-utils/dynamic-keys.d.ts +0 -7
- package/lib/src/unit-utils/dynamic-keys.js +0 -13
- package/lib/src/unit-utils/enums.d.ts +0 -27
- package/lib/src/unit-utils/enums.js +0 -69
- package/lib/src/unit-utils/formatters.d.ts +0 -50
- package/lib/src/unit-utils/formatters.js +0 -163
- package/lib/src/unit-utils/get-export-value.d.ts +0 -45
- package/lib/src/unit-utils/get-export-value.js +0 -83
- package/lib/src/unit-utils/get-field-label.d.ts +0 -6
- package/lib/src/unit-utils/get-field-label.js +0 -10
- package/lib/src/unit-utils/get-unmatched-unit-label.d.ts +0 -2
- package/lib/src/unit-utils/get-unmatched-unit-label.js +0 -9
- package/lib/src/unit-utils/schema.d.ts +0 -4
- package/lib/src/unit-utils/schema.js +0 -12
- package/lib/src/unit-utils/wrap-normalized-in-expression.d.ts +0 -3
- package/lib/src/unit-utils/wrap-normalized-in-expression.js +0 -14
- package/lib/src/units/board.d.ts +0 -46
- package/lib/src/units/board.js +0 -51
- package/lib/src/units/canvas/all-units-data-definitions.d.ts +0 -18
- package/lib/src/units/canvas/all-units-data-definitions.js +0 -40
- package/lib/src/units/canvas/index.d.ts +0 -45
- package/lib/src/units/canvas/index.js +0 -48
- package/lib/src/units/canvas/type-badge-abbr.d.ts +0 -36
- package/lib/src/units/canvas/type-badge-abbr.js +0 -11
- package/lib/src/units/canvas/type-badge.d.ts +0 -36
- package/lib/src/units/canvas/type-badge.js +0 -11
- package/lib/src/units/default.d.ts +0 -46
- package/lib/src/units/default.js +0 -51
- package/lib/src/units/gallery.d.ts +0 -3
- package/lib/src/units/gallery.js +0 -18
- package/lib/src/units/gantt.d.ts +0 -47
- package/lib/src/units/gantt.js +0 -59
- package/lib/src/units/get-unit-definitions-for-view-type.d.ts +0 -2
- package/lib/src/units/get-unit-definitions-for-view-type.js +0 -64
- package/lib/src/units/grid.d.ts +0 -45
- package/lib/src/units/grid.js +0 -71
- package/lib/src/units/list.d.ts +0 -46
- package/lib/src/units/list.js +0 -49
- package/lib/src/units/make-factory.d.ts +0 -51
- package/lib/src/units/make-factory.js +0 -260
- package/lib/src/units/types.d.ts +0 -73
- package/lib/src/units/types.js +0 -2
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { FieldObject, Schema, TypeObject } from "@fibery/schema";
|
|
2
|
-
import type { ButtonUnit, DbUnit, FieldUnit, Unit, UnitDataDefinition, UnitExpression } from "./types";
|
|
3
|
-
type AnyUnitDataDefinition = UnitDataDefinition<FieldUnit> | UnitDataDefinition<DbUnit> | UnitDataDefinition<ButtonUnit>;
|
|
4
|
-
type UnitCreationOptions = {
|
|
5
|
-
parentFieldObjects?: FieldObject[];
|
|
6
|
-
showHiddenFields?: boolean;
|
|
7
|
-
isSharingMode?: boolean;
|
|
8
|
-
};
|
|
9
|
-
export declare const makeUnitDefinitionsFactory: (allUnitDefinitions: Record<string, AnyUnitDataDefinition>) => {
|
|
10
|
-
getTypeUnits: () => import("./types").PureUnit[];
|
|
11
|
-
getUnitsForType: (typeObject: TypeObject, options?: UnitCreationOptions) => {
|
|
12
|
-
unit: Unit;
|
|
13
|
-
fieldObject: FieldObject;
|
|
14
|
-
}[];
|
|
15
|
-
getUnitsForTypePerField: (typeObject: TypeObject, options?: UnitCreationOptions) => {
|
|
16
|
-
fieldObject: FieldObject;
|
|
17
|
-
units: Unit[];
|
|
18
|
-
}[];
|
|
19
|
-
getUnitsForField: (fieldObject: FieldObject, options?: UnitCreationOptions) => Unit[];
|
|
20
|
-
getHardcodedUnitsForView: (typeObject: TypeObject) => ({
|
|
21
|
-
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";
|
|
22
|
-
expression: UnitExpression;
|
|
23
|
-
kind: "field";
|
|
24
|
-
settings?: Record<string, unknown> | undefined;
|
|
25
|
-
hideWhenEmpty?: boolean | undefined;
|
|
26
|
-
} | {
|
|
27
|
-
type: "user-button" | "icon-button";
|
|
28
|
-
kind: "user-button";
|
|
29
|
-
hideWhenEmpty?: boolean | undefined;
|
|
30
|
-
data: {
|
|
31
|
-
id: string;
|
|
32
|
-
typeId: string;
|
|
33
|
-
};
|
|
34
|
-
label: string;
|
|
35
|
-
icon?: string | undefined;
|
|
36
|
-
} | {
|
|
37
|
-
type: "type-icon" | "type-badge" | "type-badge-abbr";
|
|
38
|
-
expression?: UnitExpression | undefined;
|
|
39
|
-
kind: "db";
|
|
40
|
-
hideWhenEmpty?: boolean | undefined;
|
|
41
|
-
})[];
|
|
42
|
-
getUnitLabel: (typeObject: TypeObject, unit: Unit) => string;
|
|
43
|
-
getUnitName: (unit: Unit) => string | null;
|
|
44
|
-
getCardUnitsSelect: ({ schema, typeObject, units }: {
|
|
45
|
-
schema: Schema;
|
|
46
|
-
typeObject: TypeObject;
|
|
47
|
-
units: Unit[];
|
|
48
|
-
}) => any;
|
|
49
|
-
getUnitDataDefinition: (unit: Unit) => AnyUnitDataDefinition;
|
|
50
|
-
};
|
|
51
|
-
export {};
|
|
@@ -1,260 +0,0 @@
|
|
|
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.makeUnitDefinitionsFactory = void 0;
|
|
7
|
-
const _1 = require("@fibery/helpers/src/_");
|
|
8
|
-
const array_1 = require("@fibery/helpers/utils/array");
|
|
9
|
-
const trace_1 = require("@fibery/helpers/utils/trace");
|
|
10
|
-
const select_1 = require("@fibery/query-utils/src/select");
|
|
11
|
-
const constant_1 = __importDefault(require("lodash/constant"));
|
|
12
|
-
const flatMap_1 = __importDefault(require("lodash/flatMap"));
|
|
13
|
-
const groupBy_1 = __importDefault(require("lodash/groupBy"));
|
|
14
|
-
const isPlainObject_1 = __importDefault(require("lodash/isPlainObject"));
|
|
15
|
-
const sortBy_1 = __importDefault(require("lodash/sortBy"));
|
|
16
|
-
const avatar_1 = require("../field-utils/avatar");
|
|
17
|
-
const back_references_1 = require("../field-utils/back-references");
|
|
18
|
-
const comments_1 = require("../field-utils/comments");
|
|
19
|
-
const number_1 = require("../field-utils/number");
|
|
20
|
-
const relation_view_1 = require("../field-utils/relation-view");
|
|
21
|
-
const text_1 = require("../field-utils/text");
|
|
22
|
-
const user_role_1 = require("../field-utils/user-role");
|
|
23
|
-
const not_found_1 = require("../unit-definitions/not-found");
|
|
24
|
-
const common_1 = require("../unit-utils/common");
|
|
25
|
-
const NoUnitsCreator = () => [];
|
|
26
|
-
const makeUnitDefinitionsFactory = (allUnitDefinitions) => {
|
|
27
|
-
const { BackReferencesList, Bool, BoolCheckbox, ColorInput, CommentsList, Text, TextInput, Email, EmailInput, Emoji, IconInput, JsonInput, Number, NumberInput, ProgressBar, ReferenceCombobox, ReferenceCollection, ReferenceCollectionList, ReferenceCollectionView, ReferenceCollectionCombobox, FileReference, FileCompactReference, FilesGallery, FileList, FileListItem, FileLList, FileLListItem, FileCollectionCount, FileCompactCollection, Date, DateTimeCombobox, DateRange, DateRangeCombobox, Avatar, AvatarCollection, AvatarInput, CollectionCount, Reference, ReferenceIcon, TypeIcon, TypeBadge, TypeBadgeAbbr, Title, TitleInput, Id, UserButton, Phone, PhoneInput, Location, LocationInput, SingleLocationPreview, GeometryPreview, RichText, RichTextSnippet, RichTextDocument, CommentsCollection, Url, UrlInput, UserRole, UserRoleInput, IconButton, } = allUnitDefinitions;
|
|
28
|
-
const unitsFactoryByBasicFieldType = {
|
|
29
|
-
"fibery/bool": () => [Bool, BoolCheckbox],
|
|
30
|
-
"fibery/date": () => [Date, DateTimeCombobox],
|
|
31
|
-
"fibery/date-range": () => [DateRange, DateRangeCombobox],
|
|
32
|
-
"fibery/date-time": () => [Date, DateTimeCombobox],
|
|
33
|
-
"fibery/date-time-range": () => [DateRange, DateRangeCombobox],
|
|
34
|
-
"fibery/text": (fieldObject) => {
|
|
35
|
-
const lookup = {
|
|
36
|
-
[text_1.TextUIMeta.Phone]: [Phone, PhoneInput, IconButton],
|
|
37
|
-
[text_1.TextUIMeta.Email]: [Email, EmailInput, IconButton],
|
|
38
|
-
[text_1.TextUIMeta.URL]: [Url, UrlInput, IconButton],
|
|
39
|
-
};
|
|
40
|
-
const key = fieldObject.rawMeta[text_1.TextUIMetaKey];
|
|
41
|
-
return lookup[key] || [Text, TextInput];
|
|
42
|
-
},
|
|
43
|
-
"fibery/url": () => [Url, UrlInput, IconButton],
|
|
44
|
-
"fibery/email": () => [Email, EmailInput, IconButton],
|
|
45
|
-
"fibery/emoji": () => [Emoji, IconInput],
|
|
46
|
-
"fibery/int": () => [Number, NumberInput],
|
|
47
|
-
"fibery/location": () => [SingleLocationPreview, Location, LocationInput],
|
|
48
|
-
"fibery/rich-text": NoUnitsCreator,
|
|
49
|
-
"fibery/rank": NoUnitsCreator,
|
|
50
|
-
"fibery/json-value": () => [GeometryPreview, JsonInput],
|
|
51
|
-
"fibery/uuid": NoUnitsCreator,
|
|
52
|
-
"fibery/decimal": (fieldObject) => [
|
|
53
|
-
Number,
|
|
54
|
-
NumberInput,
|
|
55
|
-
(0, number_1.parseNumberFieldMeta)(fieldObject).numberFormat === number_1.NumberFormat.PERCENT && ProgressBar,
|
|
56
|
-
],
|
|
57
|
-
"fibery/color": () => [ColorInput],
|
|
58
|
-
};
|
|
59
|
-
const fallbackFieldCreator = (fieldObject) => {
|
|
60
|
-
(0, trace_1.traceError)(`basicFieldCreators["${fieldObject.type}"] is not defined`);
|
|
61
|
-
return [];
|
|
62
|
-
};
|
|
63
|
-
const unitsFactoryByFieldKind = {
|
|
64
|
-
":field/basic": (fieldObject) => {
|
|
65
|
-
const creator = unitsFactoryByBasicFieldType[fieldObject.type] || fallbackFieldCreator;
|
|
66
|
-
return creator(fieldObject);
|
|
67
|
-
},
|
|
68
|
-
":field/reference": (fieldObject, options) => {
|
|
69
|
-
const parentFieldObjects = options.parentFieldObjects ?? [];
|
|
70
|
-
// Parent path goes through a collection — we can only render the collection as a result, and only via relation view
|
|
71
|
-
if (parentFieldObjects.some((f) => f.isCollection)) {
|
|
72
|
-
return options.isSharingMode ? [] : [ReferenceCollectionView];
|
|
73
|
-
}
|
|
74
|
-
if (FileReference && FileCompactReference && fieldObject.typeObject.name === "fibery/file") {
|
|
75
|
-
return [FileLListItem, FileCompactReference, FileListItem, FileReference].filter(Boolean);
|
|
76
|
-
}
|
|
77
|
-
if (FileReference && fieldObject.typeObject.name === "fibery/file") {
|
|
78
|
-
return [Reference, FileReference].filter(Boolean);
|
|
79
|
-
}
|
|
80
|
-
return [
|
|
81
|
-
(0, avatar_1.isAvatarExtensionEnabledType)(fieldObject.typeObject) && Avatar,
|
|
82
|
-
fieldObject.name === "workflow/state" && ReferenceIcon,
|
|
83
|
-
Reference,
|
|
84
|
-
ReferenceCombobox,
|
|
85
|
-
];
|
|
86
|
-
},
|
|
87
|
-
":field/reference-collection": (fieldObject, options) => {
|
|
88
|
-
const parentFieldObjects = options.parentFieldObjects ?? [];
|
|
89
|
-
const common = [CollectionCount, (0, avatar_1.isAvatarExtensionEnabledType)(fieldObject.typeObject) && AvatarCollection];
|
|
90
|
-
// Parent path goes through a collection — we can only render the collection as a result, and only via relation view
|
|
91
|
-
if (parentFieldObjects.some((f) => f.isCollection)) {
|
|
92
|
-
return options.isSharingMode ? [] : [ReferenceCollectionView];
|
|
93
|
-
}
|
|
94
|
-
if ((0, relation_view_1.isRelationViewField)(fieldObject) && !options.isSharingMode) {
|
|
95
|
-
return [...common, ReferenceCollection, ReferenceCollectionCombobox, ReferenceCollectionView];
|
|
96
|
-
}
|
|
97
|
-
if ((0, back_references_1.isReferenceExtensionField)(fieldObject)) {
|
|
98
|
-
return [...common, BackReferencesList];
|
|
99
|
-
}
|
|
100
|
-
if ((0, comments_1.isCommentExtensionField)(fieldObject)) {
|
|
101
|
-
return [...common, CommentsList];
|
|
102
|
-
}
|
|
103
|
-
if (fieldObject.typeObject.name === "fibery/view") {
|
|
104
|
-
return [...common, ReferenceCollection, ReferenceCollectionCombobox, ReferenceCollectionList];
|
|
105
|
-
}
|
|
106
|
-
if (fieldObject.typeObject.name === "fibery/file") {
|
|
107
|
-
return [
|
|
108
|
-
FileLList,
|
|
109
|
-
FileCompactCollection ? FileCompactCollection : ReferenceCollection,
|
|
110
|
-
FileCollectionCount ? FileCollectionCount : CollectionCount,
|
|
111
|
-
FilesGallery,
|
|
112
|
-
FileList,
|
|
113
|
-
].filter(Boolean);
|
|
114
|
-
}
|
|
115
|
-
if (fieldObject.typeObject.isEnum) {
|
|
116
|
-
return [...common, ReferenceCollection, ReferenceCollectionCombobox];
|
|
117
|
-
}
|
|
118
|
-
if (fieldObject.cardinality === ":cardinality/many-to-many" && fieldObject.type === "fibery/user") {
|
|
119
|
-
return [...common, ReferenceCollection, ReferenceCollectionCombobox];
|
|
120
|
-
}
|
|
121
|
-
return [...common, ReferenceCollection, ReferenceCollectionCombobox, ReferenceCollectionList];
|
|
122
|
-
},
|
|
123
|
-
};
|
|
124
|
-
const getUnitsForField = (fieldObject, options = {}) => {
|
|
125
|
-
const { showHiddenFields } = options;
|
|
126
|
-
const parentFieldObjects = options.parentFieldObjects ?? [];
|
|
127
|
-
const parentExpression = parentFieldObjects.map((f) => f.name);
|
|
128
|
-
const makeUnit = (Unit) => Unit.makeUnit({ expression: [...parentExpression, fieldObject.name] });
|
|
129
|
-
const isTopLevel = parentFieldObjects.length === 0;
|
|
130
|
-
if (fieldObject.isPublicId && isTopLevel) {
|
|
131
|
-
return [Id].filter(Boolean).map(makeUnit);
|
|
132
|
-
}
|
|
133
|
-
if (fieldObject.isTitle && isTopLevel) {
|
|
134
|
-
return [Title, TitleInput].filter(Boolean).map(makeUnit);
|
|
135
|
-
}
|
|
136
|
-
if ((0, avatar_1.isAvatarExtensionField)(fieldObject) && isTopLevel) {
|
|
137
|
-
return [Avatar, AvatarInput].filter(Boolean).map(makeUnit);
|
|
138
|
-
}
|
|
139
|
-
if (fieldObject.type === "Collaboration~Documents/Document") {
|
|
140
|
-
return [RichText, RichTextSnippet, RichTextDocument].filter(Boolean).map(makeUnit);
|
|
141
|
-
}
|
|
142
|
-
if (fieldObject.type === "comments/comment" && CommentsCollection) {
|
|
143
|
-
return [CommentsCollection].filter(Boolean).map(makeUnit);
|
|
144
|
-
}
|
|
145
|
-
if ((0, user_role_1.isUserRoleField)(fieldObject)) {
|
|
146
|
-
return [UserRole, UserRoleInput].filter(Boolean).map(makeUnit);
|
|
147
|
-
}
|
|
148
|
-
if (fieldObject.isHidden && !showHiddenFields) {
|
|
149
|
-
return [];
|
|
150
|
-
}
|
|
151
|
-
const unitsFactory = unitsFactoryByFieldKind[fieldObject.kind] || (0, constant_1.default)([]);
|
|
152
|
-
return unitsFactory(fieldObject, options).filter(_1.truthy).map(makeUnit);
|
|
153
|
-
};
|
|
154
|
-
const staticUnitsTypeOrder = [Id, AvatarCollection, TypeIcon, TypeBadge, TypeBadgeAbbr, Avatar, Title, UserButton]
|
|
155
|
-
.filter(Boolean)
|
|
156
|
-
.map(({ type }) => type);
|
|
157
|
-
function getTypeUnits() {
|
|
158
|
-
return [TypeIcon, TypeBadge, TypeBadgeAbbr].filter(Boolean).map((Unit) => Unit.makeUnit());
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* @returns flat list of all units for given type
|
|
162
|
-
*/
|
|
163
|
-
function getUnitsForType(typeObject, options = {}) {
|
|
164
|
-
const collection = (0, flatMap_1.default)(typeObject.fieldObjects.filter((x) => !x.isHidden), (fieldObject) => getUnitsForField(fieldObject, options).map((unit) => ({ unit, fieldObject }))).concat(getTypeUnits().map((unit) => ({ unit, fieldObject: typeObject.titleFieldObject })));
|
|
165
|
-
return (0, sortBy_1.default)(collection, ({ unit }) => {
|
|
166
|
-
const index = staticUnitsTypeOrder.indexOf(unit.type);
|
|
167
|
-
return index === -1 ? staticUnitsTypeOrder.length : index;
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
/**
|
|
171
|
-
* @returns list of units grouped by field
|
|
172
|
-
*/
|
|
173
|
-
function getUnitsForTypePerField(typeObject, options = {}) {
|
|
174
|
-
const collection = [];
|
|
175
|
-
for (const fieldObject of typeObject.fieldObjects) {
|
|
176
|
-
if (!fieldObject.isHidden) {
|
|
177
|
-
const units = getUnitsForField(fieldObject, options);
|
|
178
|
-
if (units.length > 0) {
|
|
179
|
-
collection.push({
|
|
180
|
-
fieldObject,
|
|
181
|
-
units,
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
return (0, sortBy_1.default)(collection, ({ units }) => {
|
|
187
|
-
return units
|
|
188
|
-
.map((unit) => {
|
|
189
|
-
const index = staticUnitsTypeOrder.indexOf(unit.type);
|
|
190
|
-
return index === -1 ? staticUnitsTypeOrder.length : index;
|
|
191
|
-
})
|
|
192
|
-
.sort((a, b) => a - b)[0];
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
const getHardcodedUnitsForView = (typeObject) => {
|
|
196
|
-
return [
|
|
197
|
-
TypeIcon && TypeIcon.makeUnit(),
|
|
198
|
-
Title && Title.makeUnit(),
|
|
199
|
-
...getUnitsForField(typeObject.fieldObjectsByName["fibery/creation-date"]),
|
|
200
|
-
...getUnitsForField(typeObject.fieldObjectsByName["fibery/container-app"]),
|
|
201
|
-
...getUnitsForField(typeObject.fieldObjectsByName["fibery/container-entity-id"]),
|
|
202
|
-
...getUnitsForField(typeObject.fieldObjectsByName["fibery/container-entity-type"]),
|
|
203
|
-
].filter(Boolean);
|
|
204
|
-
};
|
|
205
|
-
const unitDefinitionsByTypeLookup = (0, _1.mapValues)((0, groupBy_1.default)(allUnitDefinitions, (x) => x.type), (value) => (0, array_1.single)(value));
|
|
206
|
-
const getUnitLabel = (typeObject, unit) => {
|
|
207
|
-
const unitDefinition = unitDefinitionsByTypeLookup[unit.type];
|
|
208
|
-
if (!unitDefinition) {
|
|
209
|
-
return "";
|
|
210
|
-
}
|
|
211
|
-
return unitDefinition.getLabel({ typeObject, unit: unit });
|
|
212
|
-
};
|
|
213
|
-
const getUnitName = (unit) => {
|
|
214
|
-
const unitDefinition = unitDefinitionsByTypeLookup[unit.type];
|
|
215
|
-
if (!unitDefinition) {
|
|
216
|
-
return null;
|
|
217
|
-
}
|
|
218
|
-
return unitDefinition.name;
|
|
219
|
-
};
|
|
220
|
-
const getUnitDataDefinition = (unit) => {
|
|
221
|
-
if (unitDefinitionsByTypeLookup[unit.type]) {
|
|
222
|
-
return unitDefinitionsByTypeLookup[unit.type];
|
|
223
|
-
}
|
|
224
|
-
// eslint-disable-next-line no-console
|
|
225
|
-
console.warn(`Unit Definition of type "${unit.type}" does not exist.`);
|
|
226
|
-
return not_found_1.NotFound;
|
|
227
|
-
};
|
|
228
|
-
const getCardUnitsSelect = ({ schema, typeObject, units }) => {
|
|
229
|
-
const selects = units
|
|
230
|
-
.filter((unit) => {
|
|
231
|
-
return ((0, common_1.isUnitEnabled)(unit) &&
|
|
232
|
-
unit.kind !== "user-button" &&
|
|
233
|
-
!unit.expression?.includes("documents/documents") &&
|
|
234
|
-
!unit.expression?.includes("whiteboards/whiteboards"));
|
|
235
|
-
})
|
|
236
|
-
.map((unit) => {
|
|
237
|
-
const unitExpressionErrors = (0, common_1.calculateUnitExpressionErrors)({ typeObject, unit });
|
|
238
|
-
if (unitExpressionErrors.length > 0) {
|
|
239
|
-
return {};
|
|
240
|
-
}
|
|
241
|
-
const UnitDefinition = getUnitDataDefinition(unit);
|
|
242
|
-
const select = UnitDefinition.getQuerySelect({ schema, typeObject, unit });
|
|
243
|
-
(0, trace_1.assert)((0, isPlainObject_1.default)(select), "getQuerySelect must return object-shaped select");
|
|
244
|
-
return select;
|
|
245
|
-
});
|
|
246
|
-
return (0, select_1.mergeDenormalizedSelects)(selects);
|
|
247
|
-
};
|
|
248
|
-
return {
|
|
249
|
-
getTypeUnits,
|
|
250
|
-
getUnitsForType,
|
|
251
|
-
getUnitsForTypePerField,
|
|
252
|
-
getUnitsForField,
|
|
253
|
-
getHardcodedUnitsForView,
|
|
254
|
-
getUnitLabel,
|
|
255
|
-
getUnitName,
|
|
256
|
-
getCardUnitsSelect,
|
|
257
|
-
getUnitDataDefinition,
|
|
258
|
-
};
|
|
259
|
-
};
|
|
260
|
-
exports.makeUnitDefinitionsFactory = makeUnitDefinitionsFactory;
|
package/lib/src/units/types.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import type { FiberyObject } from "@fibery/expression-utils/src/types";
|
|
2
|
-
import type { Schema, TypeObject } from "@fibery/schema";
|
|
3
|
-
import type { NumberDisplaySettings } from "../field-utils/number";
|
|
4
|
-
import type { $TSFixMe } from "../tsfixme";
|
|
5
|
-
export type ButtonUnit = {
|
|
6
|
-
kind: "user-button";
|
|
7
|
-
type: "user-button" | "icon-button";
|
|
8
|
-
data: {
|
|
9
|
-
id: string;
|
|
10
|
-
typeId: string;
|
|
11
|
-
};
|
|
12
|
-
label: string;
|
|
13
|
-
checked?: boolean;
|
|
14
|
-
hideWhenEmpty?: boolean;
|
|
15
|
-
icon?: string;
|
|
16
|
-
};
|
|
17
|
-
export type UnitExpression = string[];
|
|
18
|
-
export type DbUnit = {
|
|
19
|
-
kind: "db";
|
|
20
|
-
type: "type-icon" | "type-badge" | "type-badge-abbr";
|
|
21
|
-
expression?: UnitExpression;
|
|
22
|
-
checked?: boolean;
|
|
23
|
-
hideWhenEmpty?: boolean;
|
|
24
|
-
};
|
|
25
|
-
export type FieldUnit = {
|
|
26
|
-
kind: "field";
|
|
27
|
-
type: "avatar" | "avatar-collection" | "avatar-input" | "back-references-list" | "bool" | "bool-checkbox" | "collection-count" | "color-input" | "comments-list" | "date" | "date-time" | "date-time-range" | "date-time-combobox" | "date-range" | "date-range-combobox" | "email" | "email-input" | "emoji" | "field" | "files-collection" | "files-gallery" | "files-list" | "files-list-item" | "files-l-list" | "files-l-list-item" | "file-reference" | "file-compact-collection" | "file-compact-reference" | "file-collection-count" | "geometry-preview" | "icon-button" | "icon-input" | "id" | "json-input" | "location" | "location-input" | "number" | "number-input" | "phone" | "phone-input" | "progress-bar" | "reference" | "reference-icon" | "reference-combobox" | "reference-collection" | "reference-collection-list" | "reference-collection-view" | "reference-collection-combobox" | "rich-text-snippet" | "rich-text-document" | "single-location-preview" | "text" | "text-input" | "title" | "title-input" | "url" | "url-input" | "user-role" | "user-role-input";
|
|
28
|
-
expression: UnitExpression;
|
|
29
|
-
checked?: boolean;
|
|
30
|
-
settings?: Record<string, unknown>;
|
|
31
|
-
hideWhenEmpty?: boolean;
|
|
32
|
-
};
|
|
33
|
-
export type Unit = FieldUnit | ButtonUnit | DbUnit;
|
|
34
|
-
type ToPure<T extends Unit> = Omit<T, "checked">;
|
|
35
|
-
export type PureUnit = ToPure<FieldUnit> | ToPure<ButtonUnit> | ToPure<DbUnit>;
|
|
36
|
-
export type UnitDataDefinition<T extends Unit> = {
|
|
37
|
-
type: string;
|
|
38
|
-
name: string;
|
|
39
|
-
canEdit: (params: {
|
|
40
|
-
typeObject: TypeObject;
|
|
41
|
-
unit: T;
|
|
42
|
-
}) => boolean;
|
|
43
|
-
makeUnit: (params?: {
|
|
44
|
-
expression: UnitExpression;
|
|
45
|
-
}) => PureUnit;
|
|
46
|
-
getLabel: (params: {
|
|
47
|
-
typeObject: TypeObject;
|
|
48
|
-
unit: T;
|
|
49
|
-
}) => string;
|
|
50
|
-
getQuerySelect: (params: {
|
|
51
|
-
typeObject: TypeObject;
|
|
52
|
-
unit: T;
|
|
53
|
-
schema: Schema;
|
|
54
|
-
}) => $TSFixMe;
|
|
55
|
-
calculateErrors: (params: {
|
|
56
|
-
typeObject: TypeObject;
|
|
57
|
-
unit: T;
|
|
58
|
-
}) => $TSFixMe[];
|
|
59
|
-
getExportValue: (params: {
|
|
60
|
-
typeObject: TypeObject;
|
|
61
|
-
unit: T;
|
|
62
|
-
object: FiberyObject;
|
|
63
|
-
displaySettings: NumberDisplaySettings;
|
|
64
|
-
}) => unknown;
|
|
65
|
-
canExport: (params: {
|
|
66
|
-
unit: T;
|
|
67
|
-
}) => boolean;
|
|
68
|
-
getExportLabel?: (params: {
|
|
69
|
-
typeObject: TypeObject;
|
|
70
|
-
unit: T;
|
|
71
|
-
}) => string;
|
|
72
|
-
};
|
|
73
|
-
export {};
|
package/lib/src/units/types.js
DELETED