@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
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
import { REMOVE, deleteExpressionWithNotFoundFieldsOrTypesInExpression, deleteExpressionWithNotFoundFieldsOrTypesInFilter, deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression, isUnitExpressionValid, replaceIdsWithNamesInExpression, replaceIdsWithNamesInFilter, replaceIdsWithNamesInQueryExpression, replaceNamesWithIdsInExpression, replaceNamesWithIdsInFilter, replaceNamesWithIdsInQueryExpression, resetContextExpressionIfBroken, skipRemove, visitContextExpression, visitViewUnit } from "./utils.js";
|
|
2
|
+
import { enableHideWhenEmptyForCheckedEditableUnit, fixViewUnit } from "./units.js";
|
|
3
|
+
import { truthy } from "@fibery/helpers/src/_";
|
|
4
|
+
import immutableUpdate from "immutability-helper";
|
|
5
|
+
import get from "lodash/get.js";
|
|
6
|
+
import { isFieldExpression } from "@fibery/expression-utils/src/utils";
|
|
7
|
+
import entries from "lodash/entries.js";
|
|
8
|
+
import isEmpty from "lodash/isEmpty.js";
|
|
9
|
+
import set from "lodash/set.js";
|
|
10
|
+
import some from "lodash/some.js";
|
|
11
|
+
//#region src/private/board.ts
|
|
12
|
+
const visitQueryExpressionHolder = (queryHolder, visitor) => {
|
|
13
|
+
if (queryHolder) {
|
|
14
|
+
const { query, filter } = queryHolder;
|
|
15
|
+
const newQueryHolder = { ...queryHolder };
|
|
16
|
+
if (query) {
|
|
17
|
+
const queryNew = visitor.visitQueryExpression(query);
|
|
18
|
+
if (queryNew) newQueryHolder.query = queryNew;
|
|
19
|
+
else return null;
|
|
20
|
+
const { "q/from": fromType } = query;
|
|
21
|
+
if (filter && fromType) {
|
|
22
|
+
const filterNew = visitor.visitFilter(fromType, filter);
|
|
23
|
+
if (filterNew) newQueryHolder.filter = filterNew;
|
|
24
|
+
else newQueryHolder.filter = null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return newQueryHolder;
|
|
28
|
+
}
|
|
29
|
+
return queryHolder;
|
|
30
|
+
};
|
|
31
|
+
const visitAxisUnits = (axis, fromType, visitor) => {
|
|
32
|
+
return fromType ? immutableUpdate(axis, {
|
|
33
|
+
contextExpression: { $apply: (contextExpression) => visitContextExpression(fromType, contextExpression, visitor) },
|
|
34
|
+
units: { $apply: (units) => units ? units.filter(truthy).map((unit) => visitViewUnit(fromType, unit, visitor)).filter(isUnitExpressionValid).map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit).filter(skipRemove) : void 0 }
|
|
35
|
+
}) : axis;
|
|
36
|
+
};
|
|
37
|
+
const visitAxis = (axis, visitor) => {
|
|
38
|
+
if (axis && Object.hasOwn(axis, "query")) {
|
|
39
|
+
const fromType = get(axis, ["query", "q/from"]);
|
|
40
|
+
const axisWithVisitedQuery = visitQueryExpressionHolder(axis, visitor);
|
|
41
|
+
if (axisWithVisitedQuery) return visitAxisUnits(axisWithVisitedQuery, fromType, visitor);
|
|
42
|
+
return axisWithVisitedQuery;
|
|
43
|
+
}
|
|
44
|
+
if (axis && Object.hasOwn(axis, "enums")) {
|
|
45
|
+
const axisNew = immutableUpdate(axis, { enums: { $apply: (enums) => visitor.visitEnums(enums) } });
|
|
46
|
+
const { enums } = axisNew;
|
|
47
|
+
return enums ? axisNew : null;
|
|
48
|
+
}
|
|
49
|
+
return axis;
|
|
50
|
+
};
|
|
51
|
+
const isAxisFieldExpression = (expression) => isFieldExpression(expression) && expression.length === 1;
|
|
52
|
+
const ensureAxisAndItemExpressionInvariant = (view) => {
|
|
53
|
+
const actions = [];
|
|
54
|
+
const x = get(view, ["fibery/meta", "x"]);
|
|
55
|
+
const y = get(view, ["fibery/meta", "y"]);
|
|
56
|
+
const items = get(view, ["fibery/meta", "items"]);
|
|
57
|
+
if (x === null) {
|
|
58
|
+
const resetActions = items.map((item) => () => item.xExpression = null);
|
|
59
|
+
actions.push(...resetActions);
|
|
60
|
+
}
|
|
61
|
+
if (x !== null && some(items, ({ xExpression }) => xExpression === null)) {
|
|
62
|
+
const resetActions = items.map((item) => () => item.xExpression = null);
|
|
63
|
+
actions.push(...resetActions);
|
|
64
|
+
actions.push(() => set(view, ["fibery/meta", "x"], null));
|
|
65
|
+
}
|
|
66
|
+
if (y === null) {
|
|
67
|
+
const resetActions = items.map((item) => () => item.yExpression = null);
|
|
68
|
+
actions.push(...resetActions);
|
|
69
|
+
}
|
|
70
|
+
if (y !== null && some(items, ({ yExpression }) => yExpression === null)) {
|
|
71
|
+
const resetActions = items.map((item) => () => item.yExpression = null);
|
|
72
|
+
actions.push(...resetActions);
|
|
73
|
+
actions.push(() => set(view, ["fibery/meta", "y"], null));
|
|
74
|
+
}
|
|
75
|
+
if (x !== null && isEmpty(items)) actions.push(() => set(view, ["fibery/meta", "x"], null));
|
|
76
|
+
if (y !== null && isEmpty(items)) actions.push(() => set(view, ["fibery/meta", "y"], null));
|
|
77
|
+
if (x !== null && some(items, ({ xExpression }) => !isAxisFieldExpression(xExpression))) {
|
|
78
|
+
const resetActions = items.map((item) => () => item.xExpression = null);
|
|
79
|
+
actions.push(...resetActions);
|
|
80
|
+
actions.push(() => set(view, ["fibery/meta", "x"], null));
|
|
81
|
+
}
|
|
82
|
+
if (y !== null && some(items, ({ yExpression }) => !isAxisFieldExpression(yExpression))) {
|
|
83
|
+
const resetActions = items.map((item) => () => item.yExpression = null);
|
|
84
|
+
actions.push(...resetActions);
|
|
85
|
+
actions.push(() => set(view, ["fibery/meta", "y"], null));
|
|
86
|
+
}
|
|
87
|
+
actions.forEach((action) => action());
|
|
88
|
+
return view;
|
|
89
|
+
};
|
|
90
|
+
const visitView = (view, visitor) => immutableUpdate(view, { "fibery/meta": {
|
|
91
|
+
x: { $apply: (x) => visitAxis(x, visitor) },
|
|
92
|
+
y: { $apply: (y) => visitAxis(y, visitor) },
|
|
93
|
+
items: { $apply: (items) => {
|
|
94
|
+
if (!items) return [];
|
|
95
|
+
return items.map((item) => {
|
|
96
|
+
const fromType = get(item, ["query", "q/from"]);
|
|
97
|
+
return fromType ? immutableUpdate(item, {
|
|
98
|
+
coverExpression: { $apply: (coverExpression) => coverExpression ? visitor.visitExpression(fromType, coverExpression) : coverExpression },
|
|
99
|
+
xExpression: { $apply: (xExpression) => xExpression ? visitor.visitExpression(fromType, xExpression) : xExpression },
|
|
100
|
+
yExpression: { $apply: (yExpression) => yExpression ? visitor.visitExpression(fromType, yExpression) : yExpression },
|
|
101
|
+
contextExpression: { $apply: (contextExpression) => visitContextExpression(fromType, contextExpression, visitor) },
|
|
102
|
+
query: { $apply: (query) => query ? visitor.visitQueryExpression(query) : null },
|
|
103
|
+
filter: { $apply: (filter) => filter ? visitor.visitFilter(fromType, filter) : null },
|
|
104
|
+
units: { $apply: (units) => units ? units.filter(truthy).map((unit) => visitViewUnit(fromType, unit, visitor)).filter(isUnitExpressionValid).map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit).filter((unit) => unit !== REMOVE) : void 0 },
|
|
105
|
+
colorCoding: { $apply: (colorCodings) => {
|
|
106
|
+
return colorCodings ? colorCodings.map((colorCoding) => ({
|
|
107
|
+
...colorCoding,
|
|
108
|
+
expression: visitor.visitExpression(fromType, colorCoding.expression)
|
|
109
|
+
})).filter((colorCoding) => colorCoding.expression !== null) : void 0;
|
|
110
|
+
} }
|
|
111
|
+
}) : item;
|
|
112
|
+
}).filter((item) => {
|
|
113
|
+
const { query } = item;
|
|
114
|
+
return query ? item : null;
|
|
115
|
+
});
|
|
116
|
+
} }
|
|
117
|
+
} });
|
|
118
|
+
const replaceNamesWithIdsViewVisitor = (schema) => {
|
|
119
|
+
const visitor = {
|
|
120
|
+
visitQueryExpression: (queryExpression) => replaceNamesWithIdsInQueryExpression(schema, queryExpression),
|
|
121
|
+
visitFilter: (fromType, filter) => replaceNamesWithIdsInFilter(schema, fromType, filter),
|
|
122
|
+
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
|
|
123
|
+
visitEnums: (enums) => entries(enums).reduce((result, [type, queryHolder]) => {
|
|
124
|
+
if (Object.hasOwn(schema.typeObjectsByName, type)) {
|
|
125
|
+
const typeObject = schema.typeObjectsByName[type];
|
|
126
|
+
const fromType = get(queryHolder, ["query", "q/from"]);
|
|
127
|
+
const axisWithVisitedQuery = visitQueryExpressionHolder(queryHolder, visitor);
|
|
128
|
+
result[typeObject.id] = visitAxisUnits(axisWithVisitedQuery, fromType, visitor);
|
|
129
|
+
} else result[type] = queryHolder;
|
|
130
|
+
return result;
|
|
131
|
+
}, {})
|
|
132
|
+
};
|
|
133
|
+
return visitor;
|
|
134
|
+
};
|
|
135
|
+
const replaceIdsWithNamesViewVisitor = (schema) => {
|
|
136
|
+
const visitor = {
|
|
137
|
+
visitQueryExpression: (queryExpression) => replaceIdsWithNamesInQueryExpression(schema, queryExpression),
|
|
138
|
+
visitFilter: (fromType, filter) => {
|
|
139
|
+
return replaceIdsWithNamesInFilter(schema, fromType, filter);
|
|
140
|
+
},
|
|
141
|
+
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
|
|
142
|
+
visitEnums: (enums) => entries(enums).reduce((result, [typeId, queryHolder]) => {
|
|
143
|
+
if (Object.hasOwn(schema.typeObjectsById, typeId)) {
|
|
144
|
+
const typeObject = schema.typeObjectsById[typeId];
|
|
145
|
+
const fromType = get(queryHolder, ["query", "q/from"]);
|
|
146
|
+
const axisWithVisitedQuery = visitQueryExpressionHolder(queryHolder, visitor);
|
|
147
|
+
result[typeObject.name] = visitAxisUnits(axisWithVisitedQuery, fromType, visitor);
|
|
148
|
+
} else result[typeId] = queryHolder;
|
|
149
|
+
return result;
|
|
150
|
+
}, {})
|
|
151
|
+
};
|
|
152
|
+
return visitor;
|
|
153
|
+
};
|
|
154
|
+
const deleteExpressionWithNotFoundFieldsOrTypesViewVisitor = (schema) => {
|
|
155
|
+
const visitor = {
|
|
156
|
+
visitQueryExpression: (queryExpression) => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
157
|
+
visitFilter: (fromType, filter) => deleteExpressionWithNotFoundFieldsOrTypesInFilter(schema, fromType, filter),
|
|
158
|
+
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression),
|
|
159
|
+
visitEnums: (enums) => {
|
|
160
|
+
const enumsNew = entries(enums).reduce((result, [type, queryHolder]) => {
|
|
161
|
+
if (Object.hasOwn(schema.typeObjectsByName, type)) {
|
|
162
|
+
const typeObject = schema.typeObjectsByName[type];
|
|
163
|
+
const queryHolderResult = visitQueryExpressionHolder(queryHolder, visitor);
|
|
164
|
+
if (queryHolderResult) result[typeObject.name] = queryHolderResult;
|
|
165
|
+
return result;
|
|
166
|
+
}
|
|
167
|
+
return result;
|
|
168
|
+
}, {});
|
|
169
|
+
return isEmpty(enumsNew) ? null : enumsNew;
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
return visitor;
|
|
173
|
+
};
|
|
174
|
+
const fixUserSelectedUnitsViewVisitor = (schema, { unitDefinitions, getDefaultUnitTypeForField }) => {
|
|
175
|
+
return {
|
|
176
|
+
visitQueryExpression: (queryExpression) => queryExpression,
|
|
177
|
+
visitFilter: (_fromType, filter) => filter,
|
|
178
|
+
visitExpression: (_fromType, expression) => expression,
|
|
179
|
+
visitEnums: (enums) => enums,
|
|
180
|
+
visitViewUnit: (fromType, unit, units) => fixViewUnit(schema, fromType, unit, units, {
|
|
181
|
+
unitDefinitions,
|
|
182
|
+
getDefaultUnitTypeForField
|
|
183
|
+
})
|
|
184
|
+
};
|
|
185
|
+
};
|
|
186
|
+
const replaceIdsWithNamesInBoardView = (schema, view) => visitView(view, replaceIdsWithNamesViewVisitor(schema));
|
|
187
|
+
const replaceNamesWithIdsInBoardView = (schema, view) => visitView(view, replaceNamesWithIdsViewVisitor(schema));
|
|
188
|
+
const deleteExpressionWithNotFoundOrInvalidFieldsOrTypesInBoardView = (schema, view, ensureAxisInvariant = true) => {
|
|
189
|
+
const viewNew = visitView(view, deleteExpressionWithNotFoundFieldsOrTypesViewVisitor(schema));
|
|
190
|
+
return ensureAxisInvariant ? ensureAxisAndItemExpressionInvariant(viewNew) : viewNew;
|
|
191
|
+
};
|
|
192
|
+
const fixUserSelectedUnitsInBoardView = (schema, view, { unitDefinitions, getDefaultUnitTypeForField }) => {
|
|
193
|
+
return visitView(view, fixUserSelectedUnitsViewVisitor(schema, {
|
|
194
|
+
unitDefinitions,
|
|
195
|
+
getDefaultUnitTypeForField
|
|
196
|
+
}));
|
|
197
|
+
};
|
|
198
|
+
const fixContextExpressionWithBrokenPath = (schema, view, defaultContextExpression) => visitView(view, {
|
|
199
|
+
visitQueryExpression: (query) => query,
|
|
200
|
+
visitFilter: (_fromType, filter) => filter,
|
|
201
|
+
visitExpression: (_fromType, expression) => expression,
|
|
202
|
+
visitEnums: (enums) => enums,
|
|
203
|
+
visitContextExpression: (fromType, expression) => resetContextExpressionIfBroken(schema, fromType, expression, defaultContextExpression)
|
|
204
|
+
});
|
|
205
|
+
const collectGarbage = (view) => {
|
|
206
|
+
return visitView(view, {
|
|
207
|
+
visitQueryExpression: (queryExpression) => queryExpression,
|
|
208
|
+
visitFilter: (_fromType, filter) => filter,
|
|
209
|
+
visitExpression: (fromType, expression) => expression,
|
|
210
|
+
visitEnums: (enums) => enums,
|
|
211
|
+
visitViewUnit: (fromType, unit) => unit.checked ? unit : REMOVE
|
|
212
|
+
});
|
|
213
|
+
};
|
|
214
|
+
const enableHideWhenEmptyForCovers = (view) => {
|
|
215
|
+
return immutableUpdate(view, { "fibery/meta": { items: { $apply: (items) => items.map((item) => {
|
|
216
|
+
if (!item.coverExpression) return item;
|
|
217
|
+
return {
|
|
218
|
+
...item,
|
|
219
|
+
coverHideWhenEmpty: true
|
|
220
|
+
};
|
|
221
|
+
}) } } });
|
|
222
|
+
};
|
|
223
|
+
const enableHideWhenEmptyForCheckedEditableUnits = (view) => {
|
|
224
|
+
return visitView(view, {
|
|
225
|
+
visitFilter: (_fromType, filter) => filter,
|
|
226
|
+
visitQueryExpression: (queryExpression) => queryExpression,
|
|
227
|
+
visitGroupByExpression: (groupBy) => groupBy,
|
|
228
|
+
visitExpression: (fromType, expression) => expression,
|
|
229
|
+
visitEnums: (enums) => enums,
|
|
230
|
+
visitViewUnit: (fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit)
|
|
231
|
+
});
|
|
232
|
+
};
|
|
233
|
+
//#endregion
|
|
234
|
+
export { collectGarbage, deleteExpressionWithNotFoundOrInvalidFieldsOrTypesInBoardView, enableHideWhenEmptyForCheckedEditableUnits, enableHideWhenEmptyForCovers, fixContextExpressionWithBrokenPath, fixUserSelectedUnitsInBoardView, replaceIdsWithNamesInBoardView, replaceNamesWithIdsInBoardView };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UnitDefinitions, ViewRecord } from "./utils.js";
|
|
2
|
+
import { FieldObject, Schema } from "@fibery/schema";
|
|
3
|
+
import { Expression } from "@fibery/expression-utils/src/types";
|
|
4
|
+
import { Unit } from "@fibery/views/src/units/types";
|
|
5
|
+
//#region src/private/calendar.d.ts
|
|
6
|
+
declare const replaceNamesWithIdsInCalendarView: (schema: Schema, view: ViewRecord) => any;
|
|
7
|
+
declare const replaceIdsWithNamesInCalendarView: (schema: Schema, view: ViewRecord) => any;
|
|
8
|
+
declare const deleteExpressionWithNotFoundFieldsOrTypesInCalendarView: (schema: Schema, view: ViewRecord) => any;
|
|
9
|
+
declare const fixUserSelectedUnitsInCalendarView: (schema: Schema, view: ViewRecord, { unitDefinitions, getDefaultUnitTypeForField }: {
|
|
10
|
+
unitDefinitions: UnitDefinitions;
|
|
11
|
+
getDefaultUnitTypeForField: (fieldObject: FieldObject, allowedUnits: Unit[]) => string | undefined;
|
|
12
|
+
}) => any;
|
|
13
|
+
declare const fixContextExpressionWithBrokenPath: (schema: Schema, view: ViewRecord, defaultContextExpression: Expression) => any;
|
|
14
|
+
declare const collectGarbage: (view: ViewRecord) => any;
|
|
15
|
+
declare const enableHideWhenEmptyForCheckedUnits: (view: ViewRecord) => any;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { collectGarbage, deleteExpressionWithNotFoundFieldsOrTypesInCalendarView, enableHideWhenEmptyForCheckedUnits, fixContextExpressionWithBrokenPath, fixUserSelectedUnitsInCalendarView, replaceIdsWithNamesInCalendarView, replaceNamesWithIdsInCalendarView };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { REMOVE, deleteExpressionWithNotFoundFieldsOrTypesInExpression, deleteExpressionWithNotFoundFieldsOrTypesInFilter, deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression, isUnitExpressionValid, replaceIdsWithNamesInExpression, replaceIdsWithNamesInFilter, replaceIdsWithNamesInQueryExpression, replaceNamesWithIdsInExpression, replaceNamesWithIdsInFilter, replaceNamesWithIdsInQueryExpression, resetContextExpressionIfBroken, visitContextExpression, visitViewUnit } from "./utils.js";
|
|
2
|
+
import { enableHideWhenEmptyForCheckedEditableUnit, fixViewUnit } from "./units.js";
|
|
3
|
+
import { truthy } from "@fibery/helpers/src/_";
|
|
4
|
+
import immutableUpdate from "immutability-helper";
|
|
5
|
+
import get from "lodash/get.js";
|
|
6
|
+
//#region src/private/calendar.ts
|
|
7
|
+
const visitView = (view, visitor) => immutableUpdate(view, { "fibery/meta": { items: { $apply: (items) => items.map((item) => {
|
|
8
|
+
const fromType = get(item, ["query", "q/from"]);
|
|
9
|
+
return fromType ? immutableUpdate(item, {
|
|
10
|
+
startExpression: { $apply: (startExpression) => startExpression ? visitor.visitExpression(fromType, startExpression) : startExpression },
|
|
11
|
+
endExpression: { $apply: (endExpression) => endExpression ? visitor.visitExpression(fromType, endExpression) : endExpression },
|
|
12
|
+
contextExpression: { $apply: (contextExpression) => visitContextExpression(fromType, contextExpression, visitor) },
|
|
13
|
+
query: { $apply: (query) => query ? visitor.visitQueryExpression(query) : null },
|
|
14
|
+
filter: { $apply: (filter) => filter ? visitor.visitFilter(fromType, filter) : null },
|
|
15
|
+
units: { $apply: (units) => units ? units.filter(truthy).map((unit) => visitViewUnit(fromType, unit, visitor)).filter(isUnitExpressionValid).map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit).filter((unit) => unit !== REMOVE) : void 0 },
|
|
16
|
+
colorCoding: { $apply: (colorCodings) => {
|
|
17
|
+
return colorCodings && colorCodings.map((colorCoding) => ({
|
|
18
|
+
...colorCoding,
|
|
19
|
+
expression: visitor.visitExpression(fromType, colorCoding.expression)
|
|
20
|
+
})).filter((colorCoding) => colorCoding.expression !== null);
|
|
21
|
+
} }
|
|
22
|
+
}) : item;
|
|
23
|
+
}).filter((item) => {
|
|
24
|
+
const { query } = item;
|
|
25
|
+
return query ? item : null;
|
|
26
|
+
}) } } });
|
|
27
|
+
const replaceNamesWithIdsInCalendarView = (schema, view) => {
|
|
28
|
+
return visitView(view, {
|
|
29
|
+
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
|
|
30
|
+
visitFilter: (fromType, expression) => replaceNamesWithIdsInFilter(schema, fromType, expression),
|
|
31
|
+
visitQueryExpression: (query) => replaceNamesWithIdsInQueryExpression(schema, query)
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const replaceIdsWithNamesInCalendarView = (schema, view) => {
|
|
35
|
+
return visitView(view, {
|
|
36
|
+
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
|
|
37
|
+
visitFilter: (fromType, expression) => replaceIdsWithNamesInFilter(schema, fromType, expression),
|
|
38
|
+
visitQueryExpression: (query) => replaceIdsWithNamesInQueryExpression(schema, query)
|
|
39
|
+
});
|
|
40
|
+
};
|
|
41
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInCalendarView = (schema, view) => visitView(view, {
|
|
42
|
+
visitQueryExpression: (queryExpression) => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
43
|
+
visitFilter: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInFilter(schema, fromType, expression),
|
|
44
|
+
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
45
|
+
});
|
|
46
|
+
const fixUserSelectedUnitsInCalendarView = (schema, view, { unitDefinitions, getDefaultUnitTypeForField }) => {
|
|
47
|
+
return visitView(view, {
|
|
48
|
+
visitExpression: (_fromType, expression) => expression,
|
|
49
|
+
visitFilter: (_fromType, filter) => filter,
|
|
50
|
+
visitQueryExpression: (query) => query,
|
|
51
|
+
visitViewUnit: (fromType, unit, units) => fixViewUnit(schema, fromType, unit, units, {
|
|
52
|
+
unitDefinitions,
|
|
53
|
+
getDefaultUnitTypeForField
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const fixContextExpressionWithBrokenPath = (schema, view, defaultContextExpression) => visitView(view, {
|
|
58
|
+
visitQueryExpression: (query) => query,
|
|
59
|
+
visitFilter: (_fromType, filter) => filter,
|
|
60
|
+
visitExpression: (fromType, expression) => expression,
|
|
61
|
+
visitContextExpression: (fromType, expression) => resetContextExpressionIfBroken(schema, fromType, expression, defaultContextExpression)
|
|
62
|
+
});
|
|
63
|
+
const collectGarbage = (view) => {
|
|
64
|
+
return visitView(view, {
|
|
65
|
+
visitExpression: (fromType, expression) => expression,
|
|
66
|
+
visitFilter: (_fromType, filter) => filter,
|
|
67
|
+
visitQueryExpression: (query) => query,
|
|
68
|
+
visitViewUnit: (fromType, unit) => unit.checked ? unit : REMOVE
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
const enableHideWhenEmptyForCheckedUnits = (view) => {
|
|
72
|
+
return visitView(view, {
|
|
73
|
+
visitQueryExpression: (queryExpression) => queryExpression,
|
|
74
|
+
visitFilter: (_fromType, filter) => filter,
|
|
75
|
+
visitGroupByExpression: (groupBy) => groupBy,
|
|
76
|
+
visitExpression: (fromType, expression) => expression,
|
|
77
|
+
visitEnums: (enums) => enums,
|
|
78
|
+
visitViewUnit: (fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit)
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
//#endregion
|
|
82
|
+
export { collectGarbage, deleteExpressionWithNotFoundFieldsOrTypesInCalendarView, enableHideWhenEmptyForCheckedUnits, fixContextExpressionWithBrokenPath, fixUserSelectedUnitsInCalendarView, replaceIdsWithNamesInCalendarView, replaceNamesWithIdsInCalendarView };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UnitDefinitions, ViewRecord } from "./utils.js";
|
|
2
|
+
import { FieldObject, Schema } from "@fibery/schema";
|
|
3
|
+
import { Expression } from "@fibery/expression-utils/src/types";
|
|
4
|
+
import { Unit } from "@fibery/views/src/units/types";
|
|
5
|
+
//#region src/private/feed.d.ts
|
|
6
|
+
declare const replaceNamesWithIdsInFeedView: (schema: Schema, view: ViewRecord) => any;
|
|
7
|
+
declare const replaceIdsWithNamesInFeedView: (schema: Schema, view: ViewRecord) => any;
|
|
8
|
+
declare const deleteExpressionWithNotFoundFieldsOrTypesInFeedView: (schema: Schema, view: ViewRecord) => any;
|
|
9
|
+
declare const fixUserSelectedUnitsInFeedView: (schema: Schema, view: ViewRecord, { unitDefinitions, getDefaultUnitTypeForField }: {
|
|
10
|
+
unitDefinitions: UnitDefinitions;
|
|
11
|
+
getDefaultUnitTypeForField: (fieldObject: FieldObject, allowedUnits: Unit[]) => string | undefined;
|
|
12
|
+
}) => any;
|
|
13
|
+
declare const fixContextExpressionWithBrokenPath: (schema: Schema, view: ViewRecord, defaultContextExpression: Expression) => any;
|
|
14
|
+
declare const collectGarbage: (view: ViewRecord) => any;
|
|
15
|
+
declare const enableHideWhenEmptyForCheckedUnits: (view: ViewRecord) => any;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { collectGarbage, deleteExpressionWithNotFoundFieldsOrTypesInFeedView, enableHideWhenEmptyForCheckedUnits, fixContextExpressionWithBrokenPath, fixUserSelectedUnitsInFeedView, replaceIdsWithNamesInFeedView, replaceNamesWithIdsInFeedView };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { REMOVE, deleteExpressionWithNotFoundFieldsOrTypesInExpression, deleteExpressionWithNotFoundFieldsOrTypesInFilter, deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression, isUnitExpressionValid, replaceIdsWithNamesInExpression, replaceIdsWithNamesInFilter, replaceIdsWithNamesInQueryExpression, replaceNamesWithIdsInExpression, replaceNamesWithIdsInFilter, replaceNamesWithIdsInQueryExpression, resetContextExpressionIfBroken, visitContextExpression, visitViewUnit } from "./utils.js";
|
|
2
|
+
import { enableHideWhenEmptyForCheckedEditableUnit, fixViewUnit } from "./units.js";
|
|
3
|
+
import { truthy } from "@fibery/helpers/src/_";
|
|
4
|
+
import immutableUpdate from "immutability-helper";
|
|
5
|
+
import get from "lodash/get.js";
|
|
6
|
+
//#region src/private/feed.ts
|
|
7
|
+
const visitView = (view, visitor) => immutableUpdate(view, { "fibery/meta": { items: { $apply: (items) => items.map((item) => {
|
|
8
|
+
const fromType = get(item, ["query", "q/from"]);
|
|
9
|
+
return fromType ? immutableUpdate(item, {
|
|
10
|
+
postExpression: { $apply: (postExpression) => postExpression ? visitor.visitExpression(fromType, postExpression) : postExpression },
|
|
11
|
+
contextExpression: { $apply: (contextExpression) => visitContextExpression(fromType, contextExpression, visitor) },
|
|
12
|
+
query: { $apply: (query) => query ? visitor.visitQueryExpression(query) : null },
|
|
13
|
+
filter: { $apply: (filter) => filter ? visitor.visitFilter(fromType, filter) : null },
|
|
14
|
+
units: { $apply: (units) => units ? units.filter(truthy).map((unit) => visitViewUnit(fromType, unit, visitor)).filter(isUnitExpressionValid).map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit).filter((unit) => unit !== REMOVE) : void 0 },
|
|
15
|
+
colorCoding: { $apply: (colorCodings) => {
|
|
16
|
+
return colorCodings && colorCodings.map((colorCoding) => ({
|
|
17
|
+
...colorCoding,
|
|
18
|
+
expression: visitor.visitExpression(fromType, colorCoding.expression)
|
|
19
|
+
})).filter((colorCoding) => colorCoding.expression !== null);
|
|
20
|
+
} }
|
|
21
|
+
}) : item;
|
|
22
|
+
}).filter((item) => {
|
|
23
|
+
const { query } = item;
|
|
24
|
+
return query ? item : null;
|
|
25
|
+
}) } } });
|
|
26
|
+
const replaceNamesWithIdsInFeedView = (schema, view) => {
|
|
27
|
+
return visitView(view, {
|
|
28
|
+
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression),
|
|
29
|
+
visitFilter: (fromType, expression) => replaceNamesWithIdsInFilter(schema, fromType, expression),
|
|
30
|
+
visitQueryExpression: (query) => replaceNamesWithIdsInQueryExpression(schema, query)
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
const replaceIdsWithNamesInFeedView = (schema, view) => {
|
|
34
|
+
return visitView(view, {
|
|
35
|
+
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression),
|
|
36
|
+
visitFilter: (fromType, expression) => replaceIdsWithNamesInFilter(schema, fromType, expression),
|
|
37
|
+
visitQueryExpression: (query) => replaceIdsWithNamesInQueryExpression(schema, query)
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInFeedView = (schema, view) => visitView(view, {
|
|
41
|
+
visitQueryExpression: (queryExpression) => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
42
|
+
visitFilter: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInFilter(schema, fromType, expression),
|
|
43
|
+
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
44
|
+
});
|
|
45
|
+
const fixUserSelectedUnitsInFeedView = (schema, view, { unitDefinitions, getDefaultUnitTypeForField }) => {
|
|
46
|
+
return visitView(view, {
|
|
47
|
+
visitExpression: (_fromType, expression) => expression,
|
|
48
|
+
visitFilter: (_fromType, filter) => filter,
|
|
49
|
+
visitQueryExpression: (query) => query,
|
|
50
|
+
visitViewUnit: (fromType, unit, units) => fixViewUnit(schema, fromType, unit, units, {
|
|
51
|
+
unitDefinitions,
|
|
52
|
+
getDefaultUnitTypeForField
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const fixContextExpressionWithBrokenPath = (schema, view, defaultContextExpression) => visitView(view, {
|
|
57
|
+
visitQueryExpression: (query) => query,
|
|
58
|
+
visitFilter: (_fromType, filter) => filter,
|
|
59
|
+
visitExpression: (_fromType, expression) => expression,
|
|
60
|
+
visitContextExpression: (fromType, expression) => resetContextExpressionIfBroken(schema, fromType, expression, defaultContextExpression)
|
|
61
|
+
});
|
|
62
|
+
const collectGarbage = (view) => {
|
|
63
|
+
return visitView(view, {
|
|
64
|
+
visitExpression: (_fromType, expression) => expression,
|
|
65
|
+
visitFilter: (_fromType, filter) => filter,
|
|
66
|
+
visitQueryExpression: (query) => query,
|
|
67
|
+
visitViewUnit: (fromType, unit) => unit.checked ? unit : REMOVE
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
const enableHideWhenEmptyForCheckedUnits = (view) => {
|
|
71
|
+
return visitView(view, {
|
|
72
|
+
visitQueryExpression: (queryExpression) => queryExpression,
|
|
73
|
+
visitGroupByExpression: (groupBy) => groupBy,
|
|
74
|
+
visitFilter: (_fromType, filter) => filter,
|
|
75
|
+
visitExpression: (_fromType, expression) => expression,
|
|
76
|
+
visitEnums: (enums) => enums,
|
|
77
|
+
visitViewUnit: (_fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit)
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
//#endregion
|
|
81
|
+
export { collectGarbage, deleteExpressionWithNotFoundFieldsOrTypesInFeedView, enableHideWhenEmptyForCheckedUnits, fixContextExpressionWithBrokenPath, fixUserSelectedUnitsInFeedView, replaceIdsWithNamesInFeedView, replaceNamesWithIdsInFeedView };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ViewRecord } from "./utils.js";
|
|
2
|
+
import { Schema } from "@fibery/schema";
|
|
3
|
+
//#region src/private/form.d.ts
|
|
4
|
+
type FormField = {
|
|
5
|
+
id: string;
|
|
6
|
+
[k: string]: unknown;
|
|
7
|
+
};
|
|
8
|
+
declare const replaceNamesWithIdsInFormView: (schema: Schema, view: ViewRecord) => {
|
|
9
|
+
"fibery/meta": {
|
|
10
|
+
typeId: string | undefined;
|
|
11
|
+
fields: FormField[] | undefined;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
declare const replaceIdsWithNamesInFormView: (schema: Schema, view: ViewRecord) => {
|
|
15
|
+
"fibery/meta": {
|
|
16
|
+
typeId: string | undefined;
|
|
17
|
+
fields: FormField[] | undefined;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
declare const deleteExpressionWithNotFoundFieldsOrTypesInFormView: (schema: Schema, view: ViewRecord) => {
|
|
21
|
+
"fibery/meta": {
|
|
22
|
+
typeId: string | undefined;
|
|
23
|
+
fields: FormField[] | undefined;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
export { deleteExpressionWithNotFoundFieldsOrTypesInFormView, replaceIdsWithNamesInFormView, replaceNamesWithIdsInFormView };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
//#region src/private/form.ts
|
|
2
|
+
const replaceNamesWithIdsInFormView = (schema, view) => {
|
|
3
|
+
const typeId = view["fibery/meta"]?.typeId;
|
|
4
|
+
const typeObject = typeId && Object.hasOwn(schema.typeObjectsByName, typeId) ? schema.typeObjectsByName[typeId] : null;
|
|
5
|
+
const fields = view["fibery/meta"]?.fields;
|
|
6
|
+
const fieldsInIdsTerms = fields && fields.map((field) => {
|
|
7
|
+
if (!typeObject || !Object.hasOwn(typeObject.fieldObjectsByName, field.id)) return field;
|
|
8
|
+
return {
|
|
9
|
+
...field,
|
|
10
|
+
id: typeObject.fieldObjectsByName[field.id].id
|
|
11
|
+
};
|
|
12
|
+
});
|
|
13
|
+
return {
|
|
14
|
+
...view,
|
|
15
|
+
"fibery/meta": {
|
|
16
|
+
...view["fibery/meta"],
|
|
17
|
+
typeId: typeObject ? typeObject.id : typeId,
|
|
18
|
+
fields: fieldsInIdsTerms || fields
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
const replaceIdsWithNamesInFormView = (schema, view) => {
|
|
23
|
+
const typeId = view["fibery/meta"]?.typeId;
|
|
24
|
+
const typeObject = typeId && Object.hasOwn(schema.typeObjectsById, typeId) ? schema.typeObjectsById[typeId] : null;
|
|
25
|
+
const fields = view["fibery/meta"]?.fields;
|
|
26
|
+
const fieldsInNameTerms = fields && fields.map((field) => {
|
|
27
|
+
if (!typeObject || !Object.hasOwn(typeObject.fieldObjectsById, field.id)) return field;
|
|
28
|
+
return {
|
|
29
|
+
...field,
|
|
30
|
+
id: typeObject.fieldObjectsById[field.id].name
|
|
31
|
+
};
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
...view,
|
|
35
|
+
"fibery/meta": {
|
|
36
|
+
...view["fibery/meta"],
|
|
37
|
+
typeId: typeObject ? typeObject.name : typeId,
|
|
38
|
+
fields: fieldsInNameTerms || fields
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInFormView = (schema, view) => {
|
|
43
|
+
const typeName = view["fibery/meta"]?.typeId;
|
|
44
|
+
const typeObject = typeName && Object.hasOwn(schema.typeObjectsByName, typeName) ? schema.typeObjectsByName[typeName] : null;
|
|
45
|
+
const fields = view["fibery/meta"]?.fields;
|
|
46
|
+
const existingFields = fields && fields.filter((field) => typeObject && Object.hasOwn(typeObject.fieldObjectsByName, field.id));
|
|
47
|
+
return {
|
|
48
|
+
...view,
|
|
49
|
+
"fibery/meta": {
|
|
50
|
+
...view["fibery/meta"],
|
|
51
|
+
typeId: typeObject ? typeObject.name : typeName,
|
|
52
|
+
fields: existingFields || fields
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
//#endregion
|
|
57
|
+
export { deleteExpressionWithNotFoundFieldsOrTypesInFormView, replaceIdsWithNamesInFormView, replaceNamesWithIdsInFormView };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UnitDefinitions, ViewRecord } from "./utils.js";
|
|
2
|
+
import { FieldObject, Schema } from "@fibery/schema";
|
|
3
|
+
import { Expression } from "@fibery/expression-utils/src/types";
|
|
4
|
+
import { Unit } from "@fibery/views/src/units/types";
|
|
5
|
+
//#region src/private/map.d.ts
|
|
6
|
+
declare const replaceNamesWithIdsInMapView: (schema: Schema, view: ViewRecord) => any;
|
|
7
|
+
declare const replaceIdsWithNamesInMapView: (schema: Schema, view: ViewRecord) => any;
|
|
8
|
+
declare const deleteExpressionWithNotFoundFieldsOrTypesInMapView: (schema: Schema, view: ViewRecord) => any;
|
|
9
|
+
declare const fixUserSelectedUnitsInMapView: (schema: Schema, view: ViewRecord, { unitDefinitions, getDefaultUnitTypeForField }: {
|
|
10
|
+
unitDefinitions: UnitDefinitions;
|
|
11
|
+
getDefaultUnitTypeForField: (fieldObject: FieldObject, allowedUnits: Unit[]) => string | undefined;
|
|
12
|
+
}) => any;
|
|
13
|
+
declare const fixContextExpressionWithBrokenPath: (schema: Schema, view: ViewRecord, defaultContextExpression: Expression) => any;
|
|
14
|
+
declare const collectGarbage: (view: ViewRecord) => any;
|
|
15
|
+
declare const enableHideWhenEmptyForCheckedUnits: (view: ViewRecord) => any;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { collectGarbage, deleteExpressionWithNotFoundFieldsOrTypesInMapView, enableHideWhenEmptyForCheckedUnits, fixContextExpressionWithBrokenPath, fixUserSelectedUnitsInMapView, replaceIdsWithNamesInMapView, replaceNamesWithIdsInMapView };
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { REMOVE, deleteExpressionWithNotFoundFieldsOrTypesInExpression, deleteExpressionWithNotFoundFieldsOrTypesInFilter, deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression, isUnitExpressionValid, replaceIdsWithNamesInExpression, replaceIdsWithNamesInFilter, replaceIdsWithNamesInQueryExpression, replaceNamesWithIdsInExpression, replaceNamesWithIdsInFilter, replaceNamesWithIdsInQueryExpression, resetContextExpressionIfBroken, visitContextExpression, visitViewUnit } from "./utils.js";
|
|
2
|
+
import { enableHideWhenEmptyForCheckedEditableUnit, fixViewUnit } from "./units.js";
|
|
3
|
+
import { truthy } from "@fibery/helpers/src/_";
|
|
4
|
+
import immutableUpdate from "immutability-helper";
|
|
5
|
+
import get from "lodash/get.js";
|
|
6
|
+
//#region src/private/map.ts
|
|
7
|
+
const visitView = (view, visitor) => immutableUpdate(view, { "fibery/meta": { items: { $apply: (items) => items.map((item) => {
|
|
8
|
+
const fromType = get(item, ["query", "q/from"]);
|
|
9
|
+
return fromType ? immutableUpdate(item, {
|
|
10
|
+
locationExpression: { $apply: (startExpression) => startExpression ? visitor.visitExpression(fromType, startExpression) : startExpression },
|
|
11
|
+
contextExpression: { $apply: (contextExpression) => visitContextExpression(fromType, contextExpression, visitor) },
|
|
12
|
+
query: { $apply: (query) => query ? visitor.visitQueryExpression(query) : null },
|
|
13
|
+
filter: { $apply: (filter) => filter ? visitor.visitFilter(fromType, filter) : null },
|
|
14
|
+
units: { $apply: (units) => units ? units.filter(truthy).map((unit) => visitViewUnit(fromType, unit, visitor)).filter(isUnitExpressionValid).map((unit, idx, units) => visitor.visitViewUnit ? visitor.visitViewUnit(fromType, unit, units) : unit).filter((unit) => unit !== REMOVE) : void 0 },
|
|
15
|
+
colorCoding: { $apply: (colorCodings) => {
|
|
16
|
+
return colorCodings && colorCodings.map((colorCoding) => ({
|
|
17
|
+
...colorCoding,
|
|
18
|
+
expression: visitor.visitExpression(fromType, colorCoding.expression)
|
|
19
|
+
})).filter((colorCoding) => colorCoding.expression !== null);
|
|
20
|
+
} }
|
|
21
|
+
}) : item;
|
|
22
|
+
}).filter((item) => {
|
|
23
|
+
const { query } = item;
|
|
24
|
+
return query ? item : null;
|
|
25
|
+
}) } } });
|
|
26
|
+
const replaceNamesWithIdsInMapView = (schema, view) => {
|
|
27
|
+
return visitView(view, {
|
|
28
|
+
visitQueryExpression: (query) => replaceNamesWithIdsInQueryExpression(schema, query),
|
|
29
|
+
visitFilter: (fromType, expression) => replaceNamesWithIdsInFilter(schema, fromType, expression),
|
|
30
|
+
visitExpression: (fromType, expression) => replaceNamesWithIdsInExpression(schema, fromType, expression)
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
const replaceIdsWithNamesInMapView = (schema, view) => {
|
|
34
|
+
return visitView(view, {
|
|
35
|
+
visitQueryExpression: (query) => replaceIdsWithNamesInQueryExpression(schema, query),
|
|
36
|
+
visitFilter: (fromType, expression) => replaceIdsWithNamesInFilter(schema, fromType, expression),
|
|
37
|
+
visitExpression: (fromType, expression) => replaceIdsWithNamesInExpression(schema, fromType, expression)
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
const deleteExpressionWithNotFoundFieldsOrTypesInMapView = (schema, view) => visitView(view, {
|
|
41
|
+
visitQueryExpression: (queryExpression) => deleteExpressionWithNotFoundFieldsOrTypesInQueryExpression(schema, queryExpression),
|
|
42
|
+
visitFilter: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInFilter(schema, fromType, expression),
|
|
43
|
+
visitExpression: (fromType, expression) => deleteExpressionWithNotFoundFieldsOrTypesInExpression(schema, fromType, expression)
|
|
44
|
+
});
|
|
45
|
+
const fixUserSelectedUnitsInMapView = (schema, view, { unitDefinitions, getDefaultUnitTypeForField }) => {
|
|
46
|
+
return visitView(view, {
|
|
47
|
+
visitQueryExpression: (query) => query,
|
|
48
|
+
visitFilter: (_fromType, filter) => filter,
|
|
49
|
+
visitExpression: (_fromType, expression) => expression,
|
|
50
|
+
visitViewUnit: (fromType, unit, units) => fixViewUnit(schema, fromType, unit, units, {
|
|
51
|
+
unitDefinitions,
|
|
52
|
+
getDefaultUnitTypeForField
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const fixContextExpressionWithBrokenPath = (schema, view, defaultContextExpression) => visitView(view, {
|
|
57
|
+
visitExpression: (_fromType, expression) => expression,
|
|
58
|
+
visitQueryExpression: (query) => query,
|
|
59
|
+
visitFilter: (_fromType, filter) => filter,
|
|
60
|
+
visitContextExpression: (fromType, expression) => resetContextExpressionIfBroken(schema, fromType, expression, defaultContextExpression)
|
|
61
|
+
});
|
|
62
|
+
const collectGarbage = (view) => {
|
|
63
|
+
return visitView(view, {
|
|
64
|
+
visitQueryExpression: (query) => query,
|
|
65
|
+
visitFilter: (_fromType, filter) => filter,
|
|
66
|
+
visitExpression: (_fromType, expression) => expression,
|
|
67
|
+
visitViewUnit: (_fromType, unit) => unit.checked ? unit : REMOVE
|
|
68
|
+
});
|
|
69
|
+
};
|
|
70
|
+
const enableHideWhenEmptyForCheckedUnits = (view) => {
|
|
71
|
+
return visitView(view, {
|
|
72
|
+
visitQueryExpression: (queryExpression) => queryExpression,
|
|
73
|
+
visitGroupByExpression: (groupBy) => groupBy,
|
|
74
|
+
visitFilter: (_fromType, filter) => filter,
|
|
75
|
+
visitExpression: (_fromType, expression) => expression,
|
|
76
|
+
visitEnums: (enums) => enums,
|
|
77
|
+
visitViewUnit: (_fromType, unit) => enableHideWhenEmptyForCheckedEditableUnit(unit)
|
|
78
|
+
});
|
|
79
|
+
};
|
|
80
|
+
//#endregion
|
|
81
|
+
export { collectGarbage, deleteExpressionWithNotFoundFieldsOrTypesInMapView, enableHideWhenEmptyForCheckedUnits, fixContextExpressionWithBrokenPath, fixUserSelectedUnitsInMapView, replaceIdsWithNamesInMapView, replaceNamesWithIdsInMapView };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { UnitDefinitions, ViewRecord } from "./utils.js";
|
|
2
|
+
import { FieldObject, Schema } from "@fibery/schema";
|
|
3
|
+
import { Expression } from "@fibery/expression-utils/src/types";
|
|
4
|
+
import { Unit } from "@fibery/views/src/units/types";
|
|
5
|
+
//#region src/private/smart-folder.d.ts
|
|
6
|
+
type GroupByEntry = {
|
|
7
|
+
expression: Expression;
|
|
8
|
+
[k: string]: unknown;
|
|
9
|
+
};
|
|
10
|
+
type GroupByExpression = Record<string, GroupByEntry>;
|
|
11
|
+
declare const deleteExpressionWithNotFoundFieldsOrTypesInGroupByExpression: (schema: Schema, groupByExpression: GroupByExpression | null, fromType: string, removedItems: number[]) => any;
|
|
12
|
+
declare const replaceIdsWithNamesInGroupByExpression: (schema: Schema, groupByExpression: GroupByExpression | null, fromType: string) => {
|
|
13
|
+
[k: string]: {
|
|
14
|
+
expression: any;
|
|
15
|
+
};
|
|
16
|
+
} | null;
|
|
17
|
+
declare const replaceNamesWithIdsInGroupByExpression: (schema: Schema, groupByExpression: GroupByExpression | null, fromType: string) => {
|
|
18
|
+
[k: string]: {
|
|
19
|
+
expression: any;
|
|
20
|
+
};
|
|
21
|
+
} | null;
|
|
22
|
+
declare const replaceNamesWithIdsInSmartFolder: (schema: Schema, smartFolder: ViewRecord) => any;
|
|
23
|
+
declare const replaceIdsWithNamesInSmartFolder: (schema: Schema, smartFolder: ViewRecord) => any;
|
|
24
|
+
declare const deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder: (schema: Schema, smartFolder: ViewRecord) => any;
|
|
25
|
+
declare const fixContextExpressionWithBrokenPath: (schema: Schema, view: ViewRecord, defaultContextExpression: Expression) => any;
|
|
26
|
+
declare const fixUserSelectedUnitsInSmartFolder: (schema: Schema, view: ViewRecord, { unitDefinitions, getDefaultUnitTypeForField }: {
|
|
27
|
+
unitDefinitions: UnitDefinitions;
|
|
28
|
+
getDefaultUnitTypeForField: (fieldObject: FieldObject, allowedUnits: Unit[]) => string | undefined;
|
|
29
|
+
}) => any;
|
|
30
|
+
declare const collectGarbage: (view: ViewRecord) => any;
|
|
31
|
+
declare const enableHideWhenEmptyForCheckedUnits: (view: ViewRecord) => any;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { collectGarbage, deleteExpressionWithNotFoundFieldsOrTypesInGroupByExpression, deleteExpressionWithNotFoundFieldsOrTypesInSmartFolder, enableHideWhenEmptyForCheckedUnits, fixContextExpressionWithBrokenPath, fixUserSelectedUnitsInSmartFolder, replaceIdsWithNamesInGroupByExpression, replaceIdsWithNamesInSmartFolder, replaceNamesWithIdsInGroupByExpression, replaceNamesWithIdsInSmartFolder };
|