@airtable/blocks 1.18.0 → 1.18.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/CHANGELOG.md +552 -0
- package/dist/cjs/color_utils.js +21 -23
- package/dist/cjs/colors.js +4 -60
- package/dist/cjs/error_utils.js +15 -25
- package/dist/cjs/event_tracker.js +5 -11
- package/dist/cjs/global_config.js +107 -188
- package/dist/cjs/index.js +16 -40
- package/dist/cjs/injected/airtable_interface.js +1 -6
- package/dist/cjs/models/abstract_model.js +50 -81
- package/dist/cjs/models/abstract_model_with_async_data.js +102 -177
- package/dist/cjs/models/base.js +211 -374
- package/dist/cjs/models/create_aggregators.js +53 -47
- package/dist/cjs/models/cursor.js +125 -201
- package/dist/cjs/models/field.js +256 -303
- package/dist/cjs/models/grouped_record_query_result.js +210 -286
- package/dist/cjs/models/linked_records_query_result.js +276 -454
- package/dist/cjs/models/models.js +36 -50
- package/dist/cjs/models/mutation_constants.js +5 -9
- package/dist/cjs/models/mutations.js +125 -338
- package/dist/cjs/models/object_pool.js +37 -94
- package/dist/cjs/models/record.js +132 -226
- package/dist/cjs/models/record_coloring.js +14 -19
- package/dist/cjs/models/record_query_result.js +323 -282
- package/dist/cjs/models/record_store.js +355 -688
- package/dist/cjs/models/session.js +99 -158
- package/dist/cjs/models/table.js +361 -549
- package/dist/cjs/models/table_or_view_query_result.js +410 -765
- package/dist/cjs/models/view.js +161 -204
- package/dist/cjs/models/view_data_store.js +177 -282
- package/dist/cjs/models/view_metadata_query_result.js +96 -127
- package/dist/cjs/perform_record_action.js +69 -103
- package/dist/cjs/private_utils.js +133 -223
- package/dist/cjs/sdk.js +97 -142
- package/dist/cjs/settings_button.js +30 -57
- package/dist/cjs/stats/block_stats.js +3 -15
- package/dist/cjs/testing/abstract_mock_airtable_interface.js +53 -97
- package/dist/cjs/types/airtable_interface.js +36 -8
- package/dist/cjs/types/field.js +66 -12
- package/dist/cjs/types/mutations.js +99 -6
- package/dist/cjs/types/permission_levels.js +2 -4
- package/dist/cjs/types/undo_redo.js +2 -3
- package/dist/cjs/types/view.js +16 -11
- package/dist/cjs/ui/base_provider.js +14 -9
- package/dist/cjs/ui/baymax_utils.js +107 -1102
- package/dist/cjs/ui/block_wrapper.js +30 -68
- package/dist/cjs/ui/box.js +52 -56
- package/dist/cjs/ui/button.js +60 -77
- package/dist/cjs/ui/cell_renderer.js +78 -139
- package/dist/cjs/ui/choice_token.js +45 -47
- package/dist/cjs/ui/collaborator_token.js +33 -54
- package/dist/cjs/ui/color_palette.js +58 -106
- package/dist/cjs/ui/color_palette_synced.js +41 -52
- package/dist/cjs/ui/confirmation_dialog.js +53 -69
- package/dist/cjs/ui/control_sizes.js +21 -46
- package/dist/cjs/ui/create_detect_element_resize.js +16 -50
- package/dist/cjs/ui/css_helpers.js +3 -10
- package/dist/cjs/ui/dialog.js +44 -71
- package/dist/cjs/ui/dialog_close_button.js +52 -72
- package/dist/cjs/ui/expand_record.js +4 -11
- package/dist/cjs/ui/expand_record_list.js +6 -11
- package/dist/cjs/ui/expand_record_picker_async.js +18 -35
- package/dist/cjs/ui/field_icon.js +25 -28
- package/dist/cjs/ui/field_picker.js +47 -81
- package/dist/cjs/ui/field_picker_synced.js +33 -44
- package/dist/cjs/ui/form_field.js +45 -64
- package/dist/cjs/ui/geometry/geometry.js +6 -10
- package/dist/cjs/ui/geometry/point.js +5 -13
- package/dist/cjs/ui/geometry/rect.js +7 -29
- package/dist/cjs/ui/geometry/size.js +5 -13
- package/dist/cjs/ui/global_alert.js +35 -61
- package/dist/cjs/ui/global_config_synced_component_helpers.js +4 -13
- package/dist/cjs/ui/heading.js +63 -92
- package/dist/cjs/ui/icon.js +44 -66
- package/dist/cjs/ui/icon_config.js +13 -24
- package/dist/cjs/ui/initialize_block.js +23 -36
- package/dist/cjs/ui/input.js +74 -87
- package/dist/cjs/ui/input_synced.js +34 -43
- package/dist/cjs/ui/key_codes.js +4 -9
- package/dist/cjs/ui/label.js +45 -50
- package/dist/cjs/ui/link.js +74 -89
- package/dist/cjs/ui/loader.js +26 -42
- package/dist/cjs/ui/modal.js +63 -89
- package/dist/cjs/ui/model_picker_select.js +29 -47
- package/dist/cjs/ui/popover.js +98 -180
- package/dist/cjs/ui/progress_bar.js +45 -51
- package/dist/cjs/ui/record_card.js +143 -278
- package/dist/cjs/ui/record_card_list.js +117 -165
- package/dist/cjs/ui/remote_utils.js +5 -13
- package/dist/cjs/ui/sdk_context.js +7 -9
- package/dist/cjs/ui/select.js +84 -118
- package/dist/cjs/ui/select_and_select_buttons_helpers.js +27 -45
- package/dist/cjs/ui/select_buttons.js +54 -90
- package/dist/cjs/ui/select_buttons_synced.js +32 -41
- package/dist/cjs/ui/select_synced.js +32 -42
- package/dist/cjs/ui/switch.js +66 -84
- package/dist/cjs/ui/switch_synced.js +32 -38
- package/dist/cjs/ui/synced.js +16 -43
- package/dist/cjs/ui/system/all_styles_set.js +89 -22
- package/dist/cjs/ui/system/appearance/appearance_set.js +15 -26
- package/dist/cjs/ui/system/appearance/background_color.js +6 -12
- package/dist/cjs/ui/system/appearance/border.js +6 -12
- package/dist/cjs/ui/system/appearance/border_radius.js +6 -12
- package/dist/cjs/ui/system/appearance/box_shadow.js +6 -12
- package/dist/cjs/ui/system/appearance/opacity.js +5 -11
- package/dist/cjs/ui/system/dimensions/dimensions_set.js +15 -27
- package/dist/cjs/ui/system/dimensions/height.js +5 -11
- package/dist/cjs/ui/system/dimensions/max_height.js +5 -11
- package/dist/cjs/ui/system/dimensions/max_width.js +5 -11
- package/dist/cjs/ui/system/dimensions/min_height.js +5 -11
- package/dist/cjs/ui/system/dimensions/min_width.js +5 -11
- package/dist/cjs/ui/system/dimensions/width.js +5 -11
- package/dist/cjs/ui/system/display.js +8 -9
- package/dist/cjs/ui/system/flex_container/align_content.js +6 -12
- package/dist/cjs/ui/system/flex_container/align_items.js +6 -12
- package/dist/cjs/ui/system/flex_container/flex_container_set.js +15 -27
- package/dist/cjs/ui/system/flex_container/flex_direction.js +5 -11
- package/dist/cjs/ui/system/flex_container/flex_wrap.js +5 -11
- package/dist/cjs/ui/system/flex_container/justify_content.js +5 -11
- package/dist/cjs/ui/system/flex_container/justify_items.js +5 -11
- package/dist/cjs/ui/system/flex_item/align_self.js +6 -12
- package/dist/cjs/ui/system/flex_item/flex.js +5 -11
- package/dist/cjs/ui/system/flex_item/flex_basis.js +5 -11
- package/dist/cjs/ui/system/flex_item/flex_grow.js +5 -11
- package/dist/cjs/ui/system/flex_item/flex_item_set.js +15 -28
- package/dist/cjs/ui/system/flex_item/flex_shrink.js +5 -11
- package/dist/cjs/ui/system/flex_item/justify_self.js +5 -11
- package/dist/cjs/ui/system/flex_item/order.js +5 -11
- package/dist/cjs/ui/system/index.js +310 -362
- package/dist/cjs/ui/system/overflow.js +8 -9
- package/dist/cjs/ui/system/position/bottom.js +6 -13
- package/dist/cjs/ui/system/position/left.js +5 -12
- package/dist/cjs/ui/system/position/position.js +5 -11
- package/dist/cjs/ui/system/position/position_set.js +15 -27
- package/dist/cjs/ui/system/position/right.js +5 -12
- package/dist/cjs/ui/system/position/top.js +5 -12
- package/dist/cjs/ui/system/position/z_index.js +5 -11
- package/dist/cjs/ui/system/spacing/margin.js +5 -12
- package/dist/cjs/ui/system/spacing/padding.js +5 -12
- package/dist/cjs/ui/system/spacing/spacing_set.js +15 -23
- package/dist/cjs/ui/system/typography/font_family.js +5 -11
- package/dist/cjs/ui/system/typography/font_size.js +5 -11
- package/dist/cjs/ui/system/typography/font_style.js +5 -11
- package/dist/cjs/ui/system/typography/font_weight.js +5 -11
- package/dist/cjs/ui/system/typography/letter_spacing.js +5 -11
- package/dist/cjs/ui/system/typography/line_height.js +5 -11
- package/dist/cjs/ui/system/typography/text_align.js +5 -11
- package/dist/cjs/ui/system/typography/text_color.js +5 -11
- package/dist/cjs/ui/system/typography/text_decoration.js +5 -11
- package/dist/cjs/ui/system/typography/text_transform.js +5 -11
- package/dist/cjs/ui/system/typography/typography_set.js +15 -31
- package/dist/cjs/ui/system/utils/create_responsive_prop_type.js +2 -4
- package/dist/cjs/ui/system/utils/create_style_prop_types.js +5 -13
- package/dist/cjs/ui/system/utils/ensure_numbers_are_within_scale.js +2 -14
- package/dist/cjs/ui/system/utils/get_style_props_for_responsive_prop.js +30 -70
- package/dist/cjs/ui/table_picker.js +26 -43
- package/dist/cjs/ui/table_picker_synced.js +33 -42
- package/dist/cjs/ui/text.js +59 -71
- package/dist/cjs/ui/text_button.js +80 -97
- package/dist/cjs/ui/theme/default_theme/button_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/control_sizes.js +29 -42
- package/dist/cjs/ui/theme/default_theme/heading_styles.js +4 -5
- package/dist/cjs/ui/theme/default_theme/index.js +15 -32
- package/dist/cjs/ui/theme/default_theme/input_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/link_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/select_buttons_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/select_variants.js +10 -21
- package/dist/cjs/ui/theme/default_theme/switch_variants.js +8 -20
- package/dist/cjs/ui/theme/default_theme/text_button_variants.js +1 -5
- package/dist/cjs/ui/theme/default_theme/text_styles.js +1 -2
- package/dist/cjs/ui/theme/default_theme/tokens.js +33 -35
- package/dist/cjs/ui/theme/theme_context.js +3 -6
- package/dist/cjs/ui/theme/use_theme.js +1 -7
- package/dist/cjs/ui/tooltip.js +38 -79
- package/dist/cjs/ui/types/aria_props.js +3 -7
- package/dist/cjs/ui/types/data_attributes_prop.js +8 -6
- package/dist/cjs/ui/types/tooltip_anchor_props.js +4 -5
- package/dist/cjs/ui/ui.js +89 -130
- package/dist/cjs/ui/unstable_standalone_ui.js +18 -42
- package/dist/cjs/ui/use_array_identity.js +0 -4
- package/dist/cjs/ui/use_base.js +4 -13
- package/dist/cjs/ui/use_cursor.js +3 -12
- package/dist/cjs/ui/use_form_field.js +4 -6
- package/dist/cjs/ui/use_global_config.js +3 -10
- package/dist/cjs/ui/use_loadable.js +59 -132
- package/dist/cjs/ui/use_record_action_data.js +6 -12
- package/dist/cjs/ui/use_records.js +23 -24
- package/dist/cjs/ui/use_session.js +6 -15
- package/dist/cjs/ui/use_settings_button.js +4 -11
- package/dist/cjs/ui/use_styled_system.js +12 -21
- package/dist/cjs/ui/use_synced.js +0 -7
- package/dist/cjs/ui/use_text_color_for_background_color.js +1 -5
- package/dist/cjs/ui/use_view_metadata.js +5 -8
- package/dist/cjs/ui/use_viewport.js +1 -7
- package/dist/cjs/ui/use_watchable.js +36 -74
- package/dist/cjs/ui/view_picker.js +44 -78
- package/dist/cjs/ui/view_picker_synced.js +33 -44
- package/dist/cjs/ui/viewport_constraint.js +37 -64
- package/dist/cjs/ui/with_hooks.js +17 -22
- package/dist/cjs/ui/with_styled_system.js +33 -60
- package/dist/cjs/undo_redo.js +12 -32
- package/dist/cjs/unstable_private_utils.js +6 -8
- package/dist/cjs/unstable_testing_utils.js +44 -57
- package/dist/cjs/viewport.js +127 -189
- package/dist/cjs/warning.js +5 -6
- package/dist/cjs/watchable.js +66 -148
- package/dist/types/src/colors.d.ts +1 -1
- package/dist/types/src/colors.d.ts.map +1 -1
- package/dist/types/src/global_config.d.ts +1 -1
- package/dist/types/src/global_config.d.ts.map +1 -1
- package/dist/types/src/models/base.d.ts +1 -1
- package/dist/types/src/models/base.d.ts.map +1 -1
- package/dist/types/src/models/cursor.d.ts +1 -1
- package/dist/types/src/models/cursor.d.ts.map +1 -1
- package/dist/types/src/models/field.d.ts +1 -1
- package/dist/types/src/models/field.d.ts.map +1 -1
- package/dist/types/src/models/linked_records_query_result.d.ts.map +1 -1
- package/dist/types/src/models/models.d.ts.map +1 -1
- package/dist/types/src/models/record.d.ts +1 -1
- package/dist/types/src/models/record.d.ts.map +1 -1
- package/dist/types/src/models/record_coloring.d.ts +2 -2
- package/dist/types/src/models/record_coloring.d.ts.map +1 -1
- package/dist/types/src/models/record_query_result.d.ts +3 -3
- package/dist/types/src/models/record_query_result.d.ts.map +1 -1
- package/dist/types/src/models/session.d.ts +1 -1
- package/dist/types/src/models/session.d.ts.map +1 -1
- package/dist/types/src/models/table.d.ts +1 -1
- package/dist/types/src/models/table.d.ts.map +1 -1
- package/dist/types/src/models/view.d.ts +1 -1
- package/dist/types/src/models/view.d.ts.map +1 -1
- package/dist/types/src/models/view_metadata_query_result.d.ts +2 -2
- package/dist/types/src/models/view_metadata_query_result.d.ts.map +1 -1
- package/dist/types/src/perform_record_action.d.ts +1 -1
- package/dist/types/src/perform_record_action.d.ts.map +1 -1
- package/dist/types/src/private_utils.d.ts +8 -8
- package/dist/types/src/private_utils.d.ts.map +1 -1
- package/dist/types/src/sdk.d.ts +1 -1
- package/dist/types/src/sdk.d.ts.map +1 -1
- package/dist/types/src/settings_button.d.ts +1 -1
- package/dist/types/src/settings_button.d.ts.map +1 -1
- package/dist/types/src/types/aggregators.d.ts +1 -1
- package/dist/types/src/types/aggregators.d.ts.map +1 -1
- package/dist/types/src/types/airtable_interface.d.ts +6 -6
- package/dist/types/src/types/airtable_interface.d.ts.map +1 -1
- package/dist/types/src/types/attachment.d.ts +1 -1
- package/dist/types/src/types/attachment.d.ts.map +1 -1
- package/dist/types/src/types/base.d.ts +1 -1
- package/dist/types/src/types/base.d.ts.map +1 -1
- package/dist/types/src/types/block.d.ts +1 -1
- package/dist/types/src/types/block.d.ts.map +1 -1
- package/dist/types/src/types/collaborator.d.ts +1 -1
- package/dist/types/src/types/collaborator.d.ts.map +1 -1
- package/dist/types/src/types/field.d.ts +5 -5
- package/dist/types/src/types/field.d.ts.map +1 -1
- package/dist/types/src/types/global_config.d.ts +6 -6
- package/dist/types/src/types/global_config.d.ts.map +1 -1
- package/dist/types/src/types/mutations.d.ts +4 -4
- package/dist/types/src/types/mutations.d.ts.map +1 -1
- package/dist/types/src/types/permission_levels.d.ts +1 -1
- package/dist/types/src/types/permission_levels.d.ts.map +1 -1
- package/dist/types/src/types/record.d.ts +2 -2
- package/dist/types/src/types/record.d.ts.map +1 -1
- package/dist/types/src/types/record_action_data.d.ts +1 -1
- package/dist/types/src/types/record_action_data.d.ts.map +1 -1
- package/dist/types/src/types/table.d.ts +3 -3
- package/dist/types/src/types/table.d.ts.map +1 -1
- package/dist/types/src/types/undo_redo.d.ts +1 -1
- package/dist/types/src/types/undo_redo.d.ts.map +1 -1
- package/dist/types/src/types/view.d.ts +4 -4
- package/dist/types/src/types/view.d.ts.map +1 -1
- package/dist/types/src/ui/base_provider.d.ts +1 -1
- package/dist/types/src/ui/base_provider.d.ts.map +1 -1
- package/dist/types/src/ui/block_wrapper.d.ts +2 -2
- package/dist/types/src/ui/button.d.ts +1 -1
- package/dist/types/src/ui/button.d.ts.map +1 -1
- package/dist/types/src/ui/cell_renderer.d.ts +2 -2
- package/dist/types/src/ui/choice_token.d.ts +3 -3
- package/dist/types/src/ui/choice_token.d.ts.map +1 -1
- package/dist/types/src/ui/collaborator_token.d.ts +5 -5
- package/dist/types/src/ui/collaborator_token.d.ts.map +1 -1
- package/dist/types/src/ui/color_palette.d.ts +2 -2
- package/dist/types/src/ui/color_palette_synced.d.ts +2 -2
- package/dist/types/src/ui/confirmation_dialog.d.ts +1 -1
- package/dist/types/src/ui/control_sizes.d.ts +2 -2
- package/dist/types/src/ui/control_sizes.d.ts.map +1 -1
- package/dist/types/src/ui/dialog.d.ts +2 -2
- package/dist/types/src/ui/dialog.d.ts.map +1 -1
- package/dist/types/src/ui/dialog_close_button.d.ts +1 -1
- package/dist/types/src/ui/field_icon.d.ts +3 -3
- package/dist/types/src/ui/field_icon.d.ts.map +1 -1
- package/dist/types/src/ui/field_picker.d.ts +1 -1
- package/dist/types/src/ui/global_alert.d.ts +1 -1
- package/dist/types/src/ui/global_alert.d.ts.map +1 -1
- package/dist/types/src/ui/global_config_synced_component_helpers.d.ts +1 -1
- package/dist/types/src/ui/global_config_synced_component_helpers.d.ts.map +1 -1
- package/dist/types/src/ui/heading.d.ts +3 -3
- package/dist/types/src/ui/heading.d.ts.map +1 -1
- package/dist/types/src/ui/icon.d.ts +1 -1
- package/dist/types/src/ui/icon_config.d.ts +39 -39
- package/dist/types/src/ui/icon_config.d.ts.map +1 -1
- package/dist/types/src/ui/initialize_block.d.ts +3 -3
- package/dist/types/src/ui/initialize_block.d.ts.map +1 -1
- package/dist/types/src/ui/input.d.ts +15 -15
- package/dist/types/src/ui/input.d.ts.map +1 -1
- package/dist/types/src/ui/link.d.ts +1 -1
- package/dist/types/src/ui/link.d.ts.map +1 -1
- package/dist/types/src/ui/loader.d.ts +1 -1
- package/dist/types/src/ui/loader.d.ts.map +1 -1
- package/dist/types/src/ui/model_picker_select.d.ts +1 -1
- package/dist/types/src/ui/model_picker_select.d.ts.map +1 -1
- package/dist/types/src/ui/popover.d.ts +5 -5
- package/dist/types/src/ui/popover.d.ts.map +1 -1
- package/dist/types/src/ui/progress_bar.d.ts +1 -1
- package/dist/types/src/ui/progress_bar.d.ts.map +1 -1
- package/dist/types/src/ui/record_card.d.ts +2 -2
- package/dist/types/src/ui/record_card.d.ts.map +1 -1
- package/dist/types/src/ui/record_card_list.d.ts +1 -1
- package/dist/types/src/ui/select.d.ts +4 -4
- package/dist/types/src/ui/select_and_select_buttons_helpers.d.ts +4 -4
- package/dist/types/src/ui/select_and_select_buttons_helpers.d.ts.map +1 -1
- package/dist/types/src/ui/select_buttons.d.ts +4 -4
- package/dist/types/src/ui/switch.d.ts +1 -1
- package/dist/types/src/ui/switch.d.ts.map +1 -1
- package/dist/types/src/ui/synced.d.ts +3 -3
- package/dist/types/src/ui/system/all_styles_set.d.ts +0 -1
- package/dist/types/src/ui/system/all_styles_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/appearance_set.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/appearance_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/background_color.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/background_color.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/border.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/border.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/border_radius.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/border_radius.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/box_shadow.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/box_shadow.d.ts.map +1 -1
- package/dist/types/src/ui/system/appearance/opacity.d.ts +0 -1
- package/dist/types/src/ui/system/appearance/opacity.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/dimensions_set.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/dimensions_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/height.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/height.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/max_height.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/max_height.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/max_width.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/max_width.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/min_height.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/min_height.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/min_width.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/min_width.d.ts.map +1 -1
- package/dist/types/src/ui/system/dimensions/width.d.ts +0 -1
- package/dist/types/src/ui/system/dimensions/width.d.ts.map +1 -1
- package/dist/types/src/ui/system/display.d.ts +0 -1
- package/dist/types/src/ui/system/display.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/align_content.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/align_content.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/align_items.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/align_items.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/flex_container_set.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/flex_container_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/flex_direction.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/flex_direction.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/flex_wrap.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/flex_wrap.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/justify_content.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/justify_content.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_container/justify_items.d.ts +0 -1
- package/dist/types/src/ui/system/flex_container/justify_items.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/align_self.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/align_self.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_basis.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_basis.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_grow.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_grow.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_item_set.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_item_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/flex_shrink.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/flex_shrink.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/justify_self.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/justify_self.d.ts.map +1 -1
- package/dist/types/src/ui/system/flex_item/order.d.ts +0 -1
- package/dist/types/src/ui/system/flex_item/order.d.ts.map +1 -1
- package/dist/types/src/ui/system/overflow.d.ts +0 -1
- package/dist/types/src/ui/system/overflow.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/bottom.d.ts +0 -1
- package/dist/types/src/ui/system/position/bottom.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/left.d.ts +0 -1
- package/dist/types/src/ui/system/position/left.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/position.d.ts +0 -1
- package/dist/types/src/ui/system/position/position.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/position_set.d.ts +0 -1
- package/dist/types/src/ui/system/position/position_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/right.d.ts +0 -1
- package/dist/types/src/ui/system/position/right.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/top.d.ts +0 -1
- package/dist/types/src/ui/system/position/top.d.ts.map +1 -1
- package/dist/types/src/ui/system/position/z_index.d.ts +0 -1
- package/dist/types/src/ui/system/position/z_index.d.ts.map +1 -1
- package/dist/types/src/ui/system/spacing/margin.d.ts +0 -1
- package/dist/types/src/ui/system/spacing/margin.d.ts.map +1 -1
- package/dist/types/src/ui/system/spacing/padding.d.ts +0 -1
- package/dist/types/src/ui/system/spacing/padding.d.ts.map +1 -1
- package/dist/types/src/ui/system/spacing/spacing_set.d.ts +0 -1
- package/dist/types/src/ui/system/spacing/spacing_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_family.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_family.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_size.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_size.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_style.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_style.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/font_weight.d.ts +0 -1
- package/dist/types/src/ui/system/typography/font_weight.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/letter_spacing.d.ts +0 -1
- package/dist/types/src/ui/system/typography/letter_spacing.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/line_height.d.ts +0 -1
- package/dist/types/src/ui/system/typography/line_height.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_align.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_align.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_color.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_color.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_decoration.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_decoration.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/text_transform.d.ts +0 -1
- package/dist/types/src/ui/system/typography/text_transform.d.ts.map +1 -1
- package/dist/types/src/ui/system/typography/typography_set.d.ts +0 -1
- package/dist/types/src/ui/system/typography/typography_set.d.ts.map +1 -1
- package/dist/types/src/ui/system/utils/create_style_prop_types.d.ts +1 -1
- package/dist/types/src/ui/system/utils/create_style_prop_types.d.ts.map +1 -1
- package/dist/types/src/ui/system/utils/csstype.d.ts +578 -578
- package/dist/types/src/ui/system/utils/csstype.d.ts.map +1 -1
- package/dist/types/src/ui/system/utils/types.d.ts +4 -4
- package/dist/types/src/ui/system/utils/types.d.ts.map +1 -1
- package/dist/types/src/ui/text.d.ts +3 -3
- package/dist/types/src/ui/text.d.ts.map +1 -1
- package/dist/types/src/ui/text_button.d.ts +1 -1
- package/dist/types/src/ui/text_button.d.ts.map +1 -1
- package/dist/types/src/ui/theme/default_theme/heading_styles.d.ts +2 -2
- package/dist/types/src/ui/theme/default_theme/heading_styles.d.ts.map +1 -1
- package/dist/types/src/ui/theme/default_theme/index.d.ts +1 -1
- package/dist/types/src/ui/theme/theme_context.d.ts +1 -3
- package/dist/types/src/ui/theme/theme_context.d.ts.map +1 -1
- package/dist/types/src/ui/theme/use_theme.d.ts +1 -1
- package/dist/types/src/ui/tooltip.d.ts +3 -3
- package/dist/types/src/ui/types/data_attributes_prop.d.ts.map +1 -1
- package/dist/types/src/ui/types/tooltip_anchor_props.d.ts +0 -1
- package/dist/types/src/ui/types/tooltip_anchor_props.d.ts.map +1 -1
- package/dist/types/src/ui/use_base.d.ts.map +1 -1
- package/dist/types/src/ui/use_cursor.d.ts.map +1 -1
- package/dist/types/src/ui/use_form_field.d.ts +0 -2
- package/dist/types/src/ui/use_form_field.d.ts.map +1 -1
- package/dist/types/src/ui/use_records.d.ts +2 -2
- package/dist/types/src/ui/use_records.d.ts.map +1 -1
- package/dist/types/src/ui/use_session.d.ts.map +1 -1
- package/dist/types/src/ui/view_picker.d.ts +2 -2
- package/dist/types/src/ui/view_picker.d.ts.map +1 -1
- package/dist/types/src/ui/viewport_constraint.d.ts +3 -3
- package/dist/types/src/ui/viewport_constraint.d.ts.map +1 -1
- package/dist/types/src/viewport.d.ts +2 -2
- package/dist/types/src/viewport.d.ts.map +1 -1
- package/dist/types/src/warning.d.ts +1 -1
- package/dist/types/src/warning.d.ts.map +1 -1
- package/dist/types/stories/helpers/code_block.d.ts +2 -2
- package/dist/types/stories/helpers/code_block.d.ts.map +1 -1
- package/dist/types/stories/helpers/example.d.ts +5 -5
- package/dist/types/stories/helpers/example.d.ts.map +1 -1
- package/dist/types/stories/helpers/example_code_panel.d.ts +2 -2
- package/dist/types/stories/helpers/example_code_panel.d.ts.map +1 -1
- package/dist/types/stories/helpers/fake_cell_renderer.d.ts +2 -2
- package/dist/types/stories/helpers/fake_cell_renderer.d.ts.map +1 -1
- package/dist/types/stories/helpers/fake_foreign_record.d.ts +1 -1
- package/dist/types/stories/helpers/fake_foreign_record.d.ts.map +1 -1
- package/dist/types/stories/helpers/fake_record_card.d.ts +2 -2
- package/dist/types/stories/helpers/fake_record_card.d.ts.map +1 -1
- package/dist/types/stories/helpers/style_prop_list.d.ts +2 -2
- package/dist/types/stories/helpers/style_prop_list.d.ts.map +1 -1
- package/dist/types/stories/icon_example.d.ts +2 -2
- package/dist/types/stories/icon_example.d.ts.map +1 -1
- package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts +0 -1
- package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts.map +1 -1
- package/package.json +26 -25
|
@@ -1,75 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol.js");
|
|
4
|
+
require("core-js/modules/es.symbol.description.js");
|
|
5
|
+
require("core-js/modules/es.array.from.js");
|
|
6
|
+
require("core-js/modules/es.array.iterator.js");
|
|
7
|
+
require("core-js/modules/es.array.slice.js");
|
|
8
|
+
require("core-js/modules/es.object.to-string.js");
|
|
9
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
10
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
11
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
3
12
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.symbol");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.symbol.description");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.array.iterator");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.object.to-string");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/es.promise");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/es.string.starts-with");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/web.dom-collections.iterator");
|
|
18
|
-
|
|
19
13
|
Object.defineProperty(exports, "__esModule", {
|
|
20
14
|
value: true
|
|
21
15
|
});
|
|
22
16
|
exports.default = void 0;
|
|
23
|
-
|
|
17
|
+
require("core-js/modules/es.string.starts-with.js");
|
|
24
18
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
25
|
-
|
|
26
|
-
require("regenerator-runtime/runtime");
|
|
27
|
-
|
|
19
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
28
20
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
29
|
-
|
|
21
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
30
22
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
31
|
-
|
|
32
23
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
33
|
-
|
|
34
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
35
|
-
|
|
36
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
37
|
-
|
|
38
24
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
39
|
-
|
|
40
25
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
41
|
-
|
|
42
26
|
var _field = require("../types/field");
|
|
43
|
-
|
|
44
27
|
var _private_utils = require("../private_utils");
|
|
45
|
-
|
|
46
28
|
var _error_utils = require("../error_utils");
|
|
47
|
-
|
|
48
29
|
var _color_utils = _interopRequireDefault(require("../color_utils"));
|
|
49
|
-
|
|
50
30
|
var _abstract_model = _interopRequireDefault(require("./abstract_model"));
|
|
51
|
-
|
|
52
31
|
var _object_pool = _interopRequireDefault(require("./object_pool"));
|
|
53
|
-
|
|
54
32
|
var _record_query_result = _interopRequireDefault(require("./record_query_result"));
|
|
55
|
-
|
|
56
33
|
var _linked_records_query_result = _interopRequireDefault(require("./linked_records_query_result"));
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
34
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
35
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
36
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
37
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
38
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @module @airtable/blocks/models: Record */ /** */
|
|
61
39
|
var WatchableRecordKeys = Object.freeze({
|
|
62
40
|
name: 'name',
|
|
63
41
|
commentCount: 'commentCount',
|
|
64
42
|
// TODO(kasra): these keys don't have matching getters (not that they should
|
|
65
43
|
// it's just inconsistent...)
|
|
66
44
|
cellValues: 'cellValues'
|
|
67
|
-
});
|
|
45
|
+
});
|
|
46
|
+
// TODO: load cell values in field when this is watched? This will
|
|
68
47
|
// cause the CellRenderer component to load cell values, which seems okay,
|
|
69
48
|
// but needs a little more thought.
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
49
|
+
var WatchableCellValueInFieldKeyPrefix = 'cellValueInField:';
|
|
50
|
+
// TODO: load view data when this is watched. see previous comment.
|
|
73
51
|
var WatchableColorInViewKeyPrefix = 'colorInView:';
|
|
74
52
|
/**
|
|
75
53
|
* Any key within record that can be watched:
|
|
@@ -79,7 +57,6 @@ var WatchableColorInViewKeyPrefix = 'colorInView:';
|
|
|
79
57
|
* - `'cellValueInField:' + someFieldId`
|
|
80
58
|
* - `'colorInView:' + someViewId`
|
|
81
59
|
*/
|
|
82
|
-
|
|
83
60
|
/**
|
|
84
61
|
* Model class representing a record in a table.
|
|
85
62
|
*
|
|
@@ -88,62 +65,76 @@ var WatchableColorInViewKeyPrefix = 'colorInView:';
|
|
|
88
65
|
*
|
|
89
66
|
* @docsPath models/Record
|
|
90
67
|
*/
|
|
91
|
-
var Record =
|
|
92
|
-
/*#__PURE__*/
|
|
93
|
-
function (_AbstractModel) {
|
|
94
|
-
(0, _inherits2.default)(Record, _AbstractModel);
|
|
95
|
-
(0, _createClass2.default)(Record, null, [{
|
|
96
|
-
key: "_isWatchableKey",
|
|
97
|
-
|
|
98
|
-
/** @internal */
|
|
99
|
-
|
|
100
|
-
/** @internal */
|
|
101
|
-
value: function _isWatchableKey(key) {
|
|
102
|
-
return (0, _private_utils.isEnumValue)(WatchableRecordKeys, key) || key.startsWith(WatchableCellValueInFieldKeyPrefix) || key.startsWith(WatchableColorInViewKeyPrefix);
|
|
103
|
-
}
|
|
104
|
-
/** @internal */
|
|
105
|
-
|
|
106
|
-
}]);
|
|
107
|
-
|
|
68
|
+
var Record = /*#__PURE__*/function (_AbstractModel) {
|
|
108
69
|
/**
|
|
109
70
|
* @internal
|
|
110
71
|
*/
|
|
111
72
|
function Record(sdk, parentRecordStore, parentTable, recordId) {
|
|
112
73
|
var _this;
|
|
113
|
-
|
|
114
74
|
(0, _classCallCheck2.default)(this, Record);
|
|
115
|
-
_this = (
|
|
116
|
-
|
|
117
|
-
(0, _defineProperty2.default)(
|
|
118
|
-
|
|
75
|
+
_this = _callSuper(this, Record, [sdk, recordId]);
|
|
76
|
+
/** @internal */
|
|
77
|
+
(0, _defineProperty2.default)(_this, "_parentRecordStore", void 0);
|
|
78
|
+
/** @internal */
|
|
79
|
+
(0, _defineProperty2.default)(_this, "_parentTable", void 0);
|
|
80
|
+
/** @internal */
|
|
81
|
+
(0, _defineProperty2.default)(_this, "__linkedRecordsQueryResultPool", void 0);
|
|
119
82
|
_this._parentRecordStore = parentRecordStore;
|
|
120
83
|
_this._parentTable = parentTable;
|
|
121
84
|
_this.__linkedRecordsQueryResultPool = new _object_pool.default(_linked_records_query_result.default);
|
|
122
85
|
return _this;
|
|
123
86
|
}
|
|
87
|
+
|
|
124
88
|
/**
|
|
125
89
|
* @internal
|
|
126
90
|
*/
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
91
|
+
(0, _inherits2.default)(Record, _AbstractModel);
|
|
92
|
+
return (0, _createClass2.default)(Record, [{
|
|
93
|
+
key: "_dataOrNullIfDeleted",
|
|
94
|
+
get: function get() {
|
|
95
|
+
var _recordsById$this$_id;
|
|
96
|
+
var tableData = this._baseData.tablesById[this.parentTable.id];
|
|
97
|
+
if (!tableData) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
var recordsById = tableData.recordsById;
|
|
101
|
+
(0, _error_utils.invariant)(recordsById, 'Record data is not loaded');
|
|
102
|
+
return (_recordsById$this$_id = recordsById[this._id]) !== null && _recordsById$this$_id !== void 0 ? _recordsById$this$_id : null;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* The table that this record belongs to. Should never change because records aren't moved between tables.
|
|
106
|
+
*
|
|
107
|
+
* @internal (since we may not be able to return parent model instances in the immutable models world)
|
|
108
|
+
* @example
|
|
109
|
+
* ```js
|
|
110
|
+
* import {useRecords} from '@airtable/blocks/ui';
|
|
111
|
+
* const records = useRecords(myTable);
|
|
112
|
+
* console.log(records[0].parentTable.id === myTable.id);
|
|
113
|
+
* // => true
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
}, {
|
|
117
|
+
key: "parentTable",
|
|
118
|
+
get: function get() {
|
|
119
|
+
return this._parentTable;
|
|
120
|
+
}
|
|
132
121
|
/**
|
|
133
122
|
* @internal
|
|
134
123
|
*/
|
|
124
|
+
}, {
|
|
125
|
+
key: "_getFieldMatching",
|
|
135
126
|
value: function _getFieldMatching(fieldOrFieldIdOrFieldName) {
|
|
136
127
|
return this.parentTable.__getFieldMatching(fieldOrFieldIdOrFieldName);
|
|
137
128
|
}
|
|
138
129
|
/**
|
|
139
130
|
* @internal
|
|
140
131
|
*/
|
|
141
|
-
|
|
142
132
|
}, {
|
|
143
133
|
key: "_getViewMatching",
|
|
144
134
|
value: function _getViewMatching(viewOrViewIdOrViewName) {
|
|
145
135
|
return this.parentTable.__getViewMatching(viewOrViewIdOrViewName);
|
|
146
136
|
}
|
|
137
|
+
|
|
147
138
|
/**
|
|
148
139
|
* @internal
|
|
149
140
|
*
|
|
@@ -152,19 +143,15 @@ function (_AbstractModel) {
|
|
|
152
143
|
* That format is incompatible with fieldTypeProvider methods, which expect the public API
|
|
153
144
|
* format - use _getRawCellValue instead.
|
|
154
145
|
*/
|
|
155
|
-
|
|
156
146
|
}, {
|
|
157
147
|
key: "_getRawCellValue",
|
|
158
148
|
value: function _getRawCellValue(field) {
|
|
159
149
|
(0, _error_utils.invariant)(this._parentRecordStore.areCellValuesLoadedForFieldId(field.id), 'Cell values for field %s are not loaded', field.id);
|
|
160
150
|
var cellValuesByFieldId = this._data.cellValuesByFieldId;
|
|
161
|
-
|
|
162
151
|
if (!cellValuesByFieldId) {
|
|
163
152
|
return null;
|
|
164
153
|
}
|
|
165
|
-
|
|
166
154
|
var cellValue = cellValuesByFieldId[field.id] !== undefined ? cellValuesByFieldId[field.id] : null;
|
|
167
|
-
|
|
168
155
|
if (typeof cellValue === 'object' && cellValue !== null) {
|
|
169
156
|
// Copy non-primitives.
|
|
170
157
|
// TODO(kasra): maybe freezeDeep instead?
|
|
@@ -184,38 +171,31 @@ function (_AbstractModel) {
|
|
|
184
171
|
* // => 'cell value'
|
|
185
172
|
* ```
|
|
186
173
|
*/
|
|
187
|
-
|
|
188
174
|
}, {
|
|
189
175
|
key: "getCellValue",
|
|
190
176
|
value: function getCellValue(fieldOrFieldIdOrFieldName) {
|
|
191
177
|
var field = this._getFieldMatching(fieldOrFieldIdOrFieldName);
|
|
178
|
+
var cellValue = this._getRawCellValue(field);
|
|
192
179
|
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
180
|
+
// HACK: migrate to new public lookup cell value format if needed
|
|
196
181
|
if (typeof cellValue === 'object' && cellValue !== null && field.type === _field.FieldType.MULTIPLE_LOOKUP_VALUES && !this._sdk.__airtableInterface.sdkInitData.isUsingNewLookupCellValueFormat) {
|
|
197
182
|
var cellValueForMigration = [];
|
|
198
183
|
(0, _error_utils.invariant)(Array.isArray(cellValue.linkedRecordIds), 'linkedRecordIds');
|
|
199
|
-
var
|
|
200
|
-
|
|
201
|
-
var _iteratorError = undefined;
|
|
202
|
-
|
|
184
|
+
var _iterator = _createForOfIteratorHelper(cellValue.linkedRecordIds),
|
|
185
|
+
_step;
|
|
203
186
|
try {
|
|
204
|
-
for (
|
|
187
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
205
188
|
var linkedRecordId = _step.value;
|
|
206
189
|
(0, _error_utils.invariant)(typeof linkedRecordId === 'string', 'linkedRecordId');
|
|
207
190
|
var _ref = cellValue,
|
|
208
|
-
|
|
191
|
+
valuesByLinkedRecordId = _ref.valuesByLinkedRecordId;
|
|
209
192
|
(0, _error_utils.invariant)(valuesByLinkedRecordId && typeof valuesByLinkedRecordId === 'object', 'valuesByLinkedRecordId');
|
|
210
193
|
var value = valuesByLinkedRecordId[linkedRecordId];
|
|
211
|
-
|
|
212
194
|
if (Array.isArray(value)) {
|
|
213
|
-
var
|
|
214
|
-
|
|
215
|
-
var _iteratorError2 = undefined;
|
|
216
|
-
|
|
195
|
+
var _iterator2 = _createForOfIteratorHelper(value),
|
|
196
|
+
_step2;
|
|
217
197
|
try {
|
|
218
|
-
for (
|
|
198
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
219
199
|
var v = _step2.value;
|
|
220
200
|
cellValueForMigration.push({
|
|
221
201
|
linkedRecordId,
|
|
@@ -223,18 +203,9 @@ function (_AbstractModel) {
|
|
|
223
203
|
});
|
|
224
204
|
}
|
|
225
205
|
} catch (err) {
|
|
226
|
-
|
|
227
|
-
_iteratorError2 = err;
|
|
206
|
+
_iterator2.e(err);
|
|
228
207
|
} finally {
|
|
229
|
-
|
|
230
|
-
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
231
|
-
_iterator2.return();
|
|
232
|
-
}
|
|
233
|
-
} finally {
|
|
234
|
-
if (_didIteratorError2) {
|
|
235
|
-
throw _iteratorError2;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
208
|
+
_iterator2.f();
|
|
238
209
|
}
|
|
239
210
|
} else {
|
|
240
211
|
cellValueForMigration.push({
|
|
@@ -244,23 +215,12 @@ function (_AbstractModel) {
|
|
|
244
215
|
}
|
|
245
216
|
}
|
|
246
217
|
} catch (err) {
|
|
247
|
-
|
|
248
|
-
_iteratorError = err;
|
|
218
|
+
_iterator.e(err);
|
|
249
219
|
} finally {
|
|
250
|
-
|
|
251
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
252
|
-
_iterator.return();
|
|
253
|
-
}
|
|
254
|
-
} finally {
|
|
255
|
-
if (_didIteratorError) {
|
|
256
|
-
throw _iteratorError;
|
|
257
|
-
}
|
|
258
|
-
}
|
|
220
|
+
_iterator.f();
|
|
259
221
|
}
|
|
260
|
-
|
|
261
222
|
return cellValueForMigration;
|
|
262
223
|
}
|
|
263
|
-
|
|
264
224
|
return cellValue;
|
|
265
225
|
}
|
|
266
226
|
/**
|
|
@@ -274,16 +234,12 @@ function (_AbstractModel) {
|
|
|
274
234
|
* // => '42'
|
|
275
235
|
* ```
|
|
276
236
|
*/
|
|
277
|
-
|
|
278
237
|
}, {
|
|
279
238
|
key: "getCellValueAsString",
|
|
280
239
|
value: function getCellValueAsString(fieldOrFieldIdOrFieldName) {
|
|
281
240
|
var field = this._getFieldMatching(fieldOrFieldIdOrFieldName);
|
|
282
|
-
|
|
283
241
|
(0, _error_utils.invariant)(this._parentRecordStore.areCellValuesLoadedForFieldId(field.id), 'Cell values for field %s are not loaded', field.id);
|
|
284
|
-
|
|
285
242
|
var cellValue = this._getRawCellValue(field);
|
|
286
|
-
|
|
287
243
|
if (cellValue === null || cellValue === undefined) {
|
|
288
244
|
return '';
|
|
289
245
|
} else {
|
|
@@ -325,7 +281,6 @@ function (_AbstractModel) {
|
|
|
325
281
|
* }
|
|
326
282
|
* ```
|
|
327
283
|
*/
|
|
328
|
-
|
|
329
284
|
}, {
|
|
330
285
|
key: "getAttachmentClientUrlFromCellValueUrl",
|
|
331
286
|
value: function getAttachmentClientUrlFromCellValueUrl(attachmentId, attachmentUrl) {
|
|
@@ -341,12 +296,10 @@ function (_AbstractModel) {
|
|
|
341
296
|
*
|
|
342
297
|
* @param viewOrViewIdOrViewName The view (or view ID or view name) to use for record coloring.
|
|
343
298
|
*/
|
|
344
|
-
|
|
345
299
|
}, {
|
|
346
300
|
key: "getColorInView",
|
|
347
301
|
value: function getColorInView(viewOrViewIdOrViewName) {
|
|
348
302
|
var view = this._getViewMatching(viewOrViewIdOrViewName);
|
|
349
|
-
|
|
350
303
|
return this._parentRecordStore.getViewDataStore(view.id).getRecordColor(this);
|
|
351
304
|
}
|
|
352
305
|
/**
|
|
@@ -357,16 +310,13 @@ function (_AbstractModel) {
|
|
|
357
310
|
*
|
|
358
311
|
* @param viewOrViewIdOrViewName The view (or view ID or view name) to use for record coloring.
|
|
359
312
|
*/
|
|
360
|
-
|
|
361
313
|
}, {
|
|
362
314
|
key: "getColorHexInView",
|
|
363
315
|
value: function getColorHexInView(viewOrViewIdOrViewName) {
|
|
364
316
|
var color = this.getColorInView(viewOrViewIdOrViewName);
|
|
365
|
-
|
|
366
317
|
if (!color) {
|
|
367
318
|
return null;
|
|
368
319
|
}
|
|
369
|
-
|
|
370
320
|
return _color_utils.default.getHexForColor(color);
|
|
371
321
|
}
|
|
372
322
|
/**
|
|
@@ -377,23 +327,16 @@ function (_AbstractModel) {
|
|
|
377
327
|
* @param fieldOrFieldIdOrFieldName The `multipleRecordLinks` field (or field ID or field name) to use.
|
|
378
328
|
* @param opts Options for the query, such as sorts and fields.
|
|
379
329
|
*/
|
|
380
|
-
|
|
381
330
|
}, {
|
|
382
331
|
key: "selectLinkedRecordsFromCell",
|
|
383
332
|
value: function selectLinkedRecordsFromCell(fieldOrFieldIdOrFieldName) {
|
|
384
333
|
var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
385
|
-
|
|
386
334
|
var field = this._getFieldMatching(fieldOrFieldIdOrFieldName);
|
|
387
|
-
|
|
388
335
|
var linkedTableId = field.options && field.options.linkedTableId;
|
|
389
336
|
(0, _error_utils.invariant)(typeof linkedTableId === 'string', 'linkedTableId must be set');
|
|
390
|
-
|
|
391
337
|
var linkedTable = this._sdk.base.getTableById(linkedTableId);
|
|
392
|
-
|
|
393
338
|
var linkedRecordStore = this._sdk.base.__getRecordStore(linkedTableId);
|
|
394
|
-
|
|
395
339
|
var normalizedOpts = _record_query_result.default._normalizeOpts(linkedTable, linkedRecordStore, opts);
|
|
396
|
-
|
|
397
340
|
return this.__linkedRecordsQueryResultPool.getObjectForReuse(this, field, normalizedOpts, this._sdk);
|
|
398
341
|
}
|
|
399
342
|
/**
|
|
@@ -406,32 +349,33 @@ function (_AbstractModel) {
|
|
|
406
349
|
* @param fieldOrFieldIdOrFieldName The `multipleRecordLinks` field (or field ID or field name) to use.
|
|
407
350
|
* @param opts Options for the query, such as sorts and fields.
|
|
408
351
|
*/
|
|
409
|
-
|
|
410
352
|
}, {
|
|
411
353
|
key: "selectLinkedRecordsFromCellAsync",
|
|
412
|
-
value: function
|
|
413
|
-
var
|
|
354
|
+
value: (function () {
|
|
355
|
+
var _selectLinkedRecordsFromCellAsync = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(fieldOrFieldIdOrFieldName) {
|
|
356
|
+
var opts,
|
|
414
357
|
queryResult,
|
|
415
358
|
_args = arguments;
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
switch (_context.prev = _context.next) {
|
|
359
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
360
|
+
while (1) switch (_context.prev = _context.next) {
|
|
419
361
|
case 0:
|
|
420
362
|
opts = _args.length > 1 && _args[1] !== undefined ? _args[1] : {};
|
|
421
363
|
queryResult = this.selectLinkedRecordsFromCell(fieldOrFieldIdOrFieldName, opts);
|
|
422
364
|
_context.next = 4;
|
|
423
|
-
return
|
|
424
|
-
|
|
365
|
+
return queryResult.loadDataAsync();
|
|
425
366
|
case 4:
|
|
426
367
|
return _context.abrupt("return", queryResult);
|
|
427
|
-
|
|
428
368
|
case 5:
|
|
429
369
|
case "end":
|
|
430
370
|
return _context.stop();
|
|
431
371
|
}
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
|
|
372
|
+
}, _callee, this);
|
|
373
|
+
}));
|
|
374
|
+
function selectLinkedRecordsFromCellAsync(_x) {
|
|
375
|
+
return _selectLinkedRecordsFromCellAsync.apply(this, arguments);
|
|
376
|
+
}
|
|
377
|
+
return selectLinkedRecordsFromCellAsync;
|
|
378
|
+
}()
|
|
435
379
|
/**
|
|
436
380
|
* The URL for the record. You can visit this URL in the browser to be taken to the record in the Airtable UI.
|
|
437
381
|
*
|
|
@@ -441,80 +385,7 @@ function (_AbstractModel) {
|
|
|
441
385
|
* // => 'https://airtable.com/appxxxxxxxxxxxxxx/tblxxxxxxxxxxxxxx/recxxxxxxxxxxxxxx'
|
|
442
386
|
* ```
|
|
443
387
|
*/
|
|
444
|
-
|
|
445
|
-
}, {
|
|
446
|
-
key: "__triggerOnChangeForDirtyPaths",
|
|
447
|
-
|
|
448
|
-
/**
|
|
449
|
-
* @internal
|
|
450
|
-
*/
|
|
451
|
-
value: function __triggerOnChangeForDirtyPaths(dirtyPaths) {
|
|
452
|
-
var cellValuesByFieldId = dirtyPaths.cellValuesByFieldId,
|
|
453
|
-
commentCount = dirtyPaths.commentCount;
|
|
454
|
-
|
|
455
|
-
if (cellValuesByFieldId && !(0, _private_utils.isObjectEmpty)(cellValuesByFieldId)) {
|
|
456
|
-
// TODO: don't trigger changes for fields that aren't supposed to be loaded
|
|
457
|
-
// (in some cases, e.g. record created, liveapp will send cell values
|
|
458
|
-
// that we're not subscribed to).
|
|
459
|
-
this._onChange(WatchableRecordKeys.cellValues, Object.keys(cellValuesByFieldId));
|
|
460
|
-
|
|
461
|
-
if (cellValuesByFieldId[this.parentTable.primaryField.id]) {
|
|
462
|
-
this._onChange(WatchableRecordKeys.name);
|
|
463
|
-
}
|
|
464
|
-
|
|
465
|
-
for (var _i = 0, _Object$keys = Object.keys(cellValuesByFieldId); _i < _Object$keys.length; _i++) {
|
|
466
|
-
var fieldId = _Object$keys[_i];
|
|
467
|
-
|
|
468
|
-
this._onChange(WatchableCellValueInFieldKeyPrefix + fieldId, fieldId);
|
|
469
|
-
}
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
if (commentCount) {
|
|
473
|
-
this._onChange(WatchableRecordKeys.commentCount);
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
/**
|
|
477
|
-
* @internal
|
|
478
|
-
*/
|
|
479
|
-
|
|
480
|
-
}, {
|
|
481
|
-
key: "__triggerOnChangeForRecordColorInViewId",
|
|
482
|
-
value: function __triggerOnChangeForRecordColorInViewId(viewId) {
|
|
483
|
-
this._onChange(WatchableColorInViewKeyPrefix + viewId);
|
|
484
|
-
}
|
|
485
|
-
}, {
|
|
486
|
-
key: "_dataOrNullIfDeleted",
|
|
487
|
-
get: function get() {
|
|
488
|
-
var _recordsById$this$_id;
|
|
489
|
-
|
|
490
|
-
var tableData = this._baseData.tablesById[this.parentTable.id];
|
|
491
|
-
|
|
492
|
-
if (!tableData) {
|
|
493
|
-
return null;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
var recordsById = tableData.recordsById;
|
|
497
|
-
(0, _error_utils.invariant)(recordsById, 'Record data is not loaded');
|
|
498
|
-
return (_recordsById$this$_id = recordsById[this._id]) !== null && _recordsById$this$_id !== void 0 ? _recordsById$this$_id : null;
|
|
499
|
-
}
|
|
500
|
-
/**
|
|
501
|
-
* The table that this record belongs to. Should never change because records aren't moved between tables.
|
|
502
|
-
*
|
|
503
|
-
* @internal (since we may not be able to return parent model instances in the immutable models world)
|
|
504
|
-
* @example
|
|
505
|
-
* ```js
|
|
506
|
-
* import {useRecords} from '@airtable/blocks/ui';
|
|
507
|
-
* const records = useRecords(myTable);
|
|
508
|
-
* console.log(records[0].parentTable.id === myTable.id);
|
|
509
|
-
* // => true
|
|
510
|
-
* ```
|
|
511
|
-
*/
|
|
512
|
-
|
|
513
|
-
}, {
|
|
514
|
-
key: "parentTable",
|
|
515
|
-
get: function get() {
|
|
516
|
-
return this._parentTable;
|
|
517
|
-
}
|
|
388
|
+
)
|
|
518
389
|
}, {
|
|
519
390
|
key: "url",
|
|
520
391
|
get: function get() {
|
|
@@ -529,7 +400,6 @@ function (_AbstractModel) {
|
|
|
529
400
|
* // => '42'
|
|
530
401
|
* ```
|
|
531
402
|
*/
|
|
532
|
-
|
|
533
403
|
}, {
|
|
534
404
|
key: "name",
|
|
535
405
|
get: function get() {
|
|
@@ -547,7 +417,6 @@ function (_AbstractModel) {
|
|
|
547
417
|
* );
|
|
548
418
|
* ```
|
|
549
419
|
*/
|
|
550
|
-
|
|
551
420
|
}, {
|
|
552
421
|
key: "commentCount",
|
|
553
422
|
get: function get() {
|
|
@@ -563,16 +432,53 @@ function (_AbstractModel) {
|
|
|
563
432
|
* `);
|
|
564
433
|
* ```
|
|
565
434
|
*/
|
|
566
|
-
|
|
567
435
|
}, {
|
|
568
436
|
key: "createdTime",
|
|
569
437
|
get: function get() {
|
|
570
438
|
return new Date(this._data.createdTime);
|
|
571
439
|
}
|
|
440
|
+
/**
|
|
441
|
+
* @internal
|
|
442
|
+
*/
|
|
443
|
+
}, {
|
|
444
|
+
key: "__triggerOnChangeForDirtyPaths",
|
|
445
|
+
value: function __triggerOnChangeForDirtyPaths(dirtyPaths) {
|
|
446
|
+
var cellValuesByFieldId = dirtyPaths.cellValuesByFieldId,
|
|
447
|
+
commentCount = dirtyPaths.commentCount;
|
|
448
|
+
if (cellValuesByFieldId && !(0, _private_utils.isObjectEmpty)(cellValuesByFieldId)) {
|
|
449
|
+
// TODO: don't trigger changes for fields that aren't supposed to be loaded
|
|
450
|
+
// (in some cases, e.g. record created, liveapp will send cell values
|
|
451
|
+
// that we're not subscribed to).
|
|
452
|
+
|
|
453
|
+
this._onChange(WatchableRecordKeys.cellValues, Object.keys(cellValuesByFieldId));
|
|
454
|
+
if (cellValuesByFieldId[this.parentTable.primaryField.id]) {
|
|
455
|
+
this._onChange(WatchableRecordKeys.name);
|
|
456
|
+
}
|
|
457
|
+
for (var _i = 0, _Object$keys = Object.keys(cellValuesByFieldId); _i < _Object$keys.length; _i++) {
|
|
458
|
+
var fieldId = _Object$keys[_i];
|
|
459
|
+
this._onChange(WatchableCellValueInFieldKeyPrefix + fieldId, fieldId);
|
|
460
|
+
}
|
|
461
|
+
}
|
|
462
|
+
if (commentCount) {
|
|
463
|
+
this._onChange(WatchableRecordKeys.commentCount);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* @internal
|
|
468
|
+
*/
|
|
469
|
+
}, {
|
|
470
|
+
key: "__triggerOnChangeForRecordColorInViewId",
|
|
471
|
+
value: function __triggerOnChangeForRecordColorInViewId(viewId) {
|
|
472
|
+
this._onChange(WatchableColorInViewKeyPrefix + viewId);
|
|
473
|
+
}
|
|
474
|
+
}], [{
|
|
475
|
+
key: "_isWatchableKey",
|
|
476
|
+
value: /** @internal */
|
|
477
|
+
function _isWatchableKey(key) {
|
|
478
|
+
return (0, _private_utils.isEnumValue)(WatchableRecordKeys, key) || key.startsWith(WatchableCellValueInFieldKeyPrefix) || key.startsWith(WatchableColorInViewKeyPrefix);
|
|
479
|
+
}
|
|
572
480
|
}]);
|
|
573
|
-
return Record;
|
|
574
481
|
}(_abstract_model.default);
|
|
575
|
-
|
|
482
|
+
/** @internal */
|
|
576
483
|
(0, _defineProperty2.default)(Record, "_className", 'Record');
|
|
577
|
-
var _default = Record;
|
|
578
|
-
exports.default = _default;
|
|
484
|
+
var _default = exports.default = Record;
|