@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,19 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = useGlobalConfig;
|
|
9
|
-
|
|
10
8
|
var _use_watchable = _interopRequireDefault(require("./use_watchable"));
|
|
11
|
-
|
|
12
9
|
var _sdk_context = require("./sdk_context");
|
|
13
|
-
|
|
14
|
-
/** @module @airtable/blocks/ui: useGlobalConfig */
|
|
15
|
-
|
|
16
|
-
/** */
|
|
10
|
+
/** @module @airtable/blocks/ui: useGlobalConfig */ /** */
|
|
17
11
|
|
|
18
12
|
/**
|
|
19
13
|
* Returns the extension's {@link GlobalConfig} and updates whenever any key in {@link GlobalConfig}
|
|
@@ -45,9 +39,8 @@ var _sdk_context = require("./sdk_context");
|
|
|
45
39
|
*/
|
|
46
40
|
function useGlobalConfig() {
|
|
47
41
|
var _useSdk = (0, _sdk_context.useSdk)(),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
globalConfig = _useSdk.globalConfig,
|
|
43
|
+
session = _useSdk.session;
|
|
51
44
|
(0, _use_watchable.default)(session, ['permissionLevel']);
|
|
52
45
|
(0, _use_watchable.default)(globalConfig, ['*']);
|
|
53
46
|
return globalConfig;
|
|
@@ -1,42 +1,38 @@
|
|
|
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.slice.js");
|
|
7
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
3
8
|
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.array.map");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/es.object.to-string");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/es.promise");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/es.regexp.to-string");
|
|
18
|
-
|
|
19
|
-
require("core-js/modules/web.dom-collections.iterator");
|
|
20
|
-
|
|
21
9
|
Object.defineProperty(exports, "__esModule", {
|
|
22
10
|
value: true
|
|
23
11
|
});
|
|
24
12
|
exports.default = useLoadable;
|
|
25
|
-
|
|
13
|
+
require("core-js/modules/es.array.iterator.js");
|
|
14
|
+
require("core-js/modules/es.array.map.js");
|
|
15
|
+
require("core-js/modules/es.object.to-string.js");
|
|
16
|
+
require("core-js/modules/es.promise.js");
|
|
17
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
18
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
26
19
|
var _react = require("react");
|
|
27
|
-
|
|
28
20
|
var _useSubscription = require("use-subscription");
|
|
29
|
-
|
|
30
21
|
var _private_utils = require("../private_utils");
|
|
31
|
-
|
|
32
22
|
var _error_utils = require("../error_utils");
|
|
33
|
-
|
|
34
23
|
var _use_array_identity = _interopRequireDefault(require("./use_array_identity"));
|
|
24
|
+
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; } } }; }
|
|
25
|
+
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; } }
|
|
26
|
+
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; } /** @module @airtable/blocks/ui: useLoadable */ /** */
|
|
27
|
+
// rather than asking for an AbstractModelWithAsyncData, we define a much more specific interface
|
|
28
|
+
// that enforces 'isDataLoaded' as a watchable key.
|
|
29
|
+
/**
|
|
30
|
+
* A model that can be loaded.
|
|
31
|
+
* Usually a {@link Cursor}, {@link RecordQueryResult}, or a {@link ViewMetadataQueryResult}.
|
|
32
|
+
*/
|
|
35
33
|
|
|
36
|
-
/** @module @airtable/blocks/ui: useLoadable */
|
|
37
|
-
|
|
38
|
-
/** */
|
|
39
34
|
var SUSPENSE_CLEAN_UP_MS = 60000;
|
|
35
|
+
|
|
40
36
|
/**
|
|
41
37
|
* Options object for the {@link useLoadable} hook.
|
|
42
38
|
*/
|
|
@@ -124,38 +120,25 @@ function useLoadable(models) {
|
|
|
124
120
|
var constModels = (0, _use_array_identity.default)(Array.isArray(models) ? models : [models]);
|
|
125
121
|
var compactModels = (0, _react.useMemo)(() => {
|
|
126
122
|
var compacted = (0, _private_utils.compact)(constModels);
|
|
127
|
-
var
|
|
128
|
-
|
|
129
|
-
var _iteratorError = undefined;
|
|
130
|
-
|
|
123
|
+
var _iterator = _createForOfIteratorHelper(compacted),
|
|
124
|
+
_step;
|
|
131
125
|
try {
|
|
132
|
-
for (
|
|
126
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
133
127
|
var model = _step.value;
|
|
134
|
-
|
|
135
128
|
if (typeof model.loadDataAsync !== 'function') {
|
|
136
129
|
throw (0, _error_utils.spawnError)('useLoadable called with %s, which is not a loadable', typeof model === 'object' ? model.toString() : typeof model);
|
|
137
130
|
}
|
|
138
131
|
}
|
|
139
132
|
} catch (err) {
|
|
140
|
-
|
|
141
|
-
_iteratorError = err;
|
|
133
|
+
_iterator.e(err);
|
|
142
134
|
} finally {
|
|
143
|
-
|
|
144
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
145
|
-
_iterator.return();
|
|
146
|
-
}
|
|
147
|
-
} finally {
|
|
148
|
-
if (_didIteratorError) {
|
|
149
|
-
throw _iteratorError;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
135
|
+
_iterator.f();
|
|
152
136
|
}
|
|
153
|
-
|
|
154
137
|
return compacted;
|
|
155
|
-
}, [constModels]);
|
|
138
|
+
}, [constModels]);
|
|
156
139
|
|
|
140
|
+
// .every returns `true` in the case of an empty array
|
|
157
141
|
var areAllModelsLoaded = compactModels.every(model => model.isDataLoaded);
|
|
158
|
-
|
|
159
142
|
if (shouldSuspend && !areAllModelsLoaded) {
|
|
160
143
|
var suspensePromise = Promise.all(compactModels.map(model => model.loadDataAsync())).then(() => {
|
|
161
144
|
// if data isn't loaded and we're in suspense mode, we need to start the data loading and
|
|
@@ -166,28 +149,17 @@ function useLoadable(models) {
|
|
|
166
149
|
// passed, we unload it, allowing the data to be released as long as it's not used anywhere
|
|
167
150
|
// else in the extension.
|
|
168
151
|
setTimeout(() => {
|
|
169
|
-
var
|
|
170
|
-
|
|
171
|
-
var _iteratorError2 = undefined;
|
|
172
|
-
|
|
152
|
+
var _iterator2 = _createForOfIteratorHelper(compactModels),
|
|
153
|
+
_step2;
|
|
173
154
|
try {
|
|
174
|
-
for (
|
|
155
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
175
156
|
var model = _step2.value;
|
|
176
157
|
model.unloadData();
|
|
177
158
|
}
|
|
178
159
|
} catch (err) {
|
|
179
|
-
|
|
180
|
-
_iteratorError2 = err;
|
|
160
|
+
_iterator2.e(err);
|
|
181
161
|
} finally {
|
|
182
|
-
|
|
183
|
-
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
184
|
-
_iterator2.return();
|
|
185
|
-
}
|
|
186
|
-
} finally {
|
|
187
|
-
if (_didIteratorError2) {
|
|
188
|
-
throw _iteratorError2;
|
|
189
|
-
}
|
|
190
|
-
}
|
|
162
|
+
_iterator2.f();
|
|
191
163
|
}
|
|
192
164
|
}, SUSPENSE_CLEAN_UP_MS);
|
|
193
165
|
}).catch(error => {
|
|
@@ -196,117 +168,72 @@ function useLoadable(models) {
|
|
|
196
168
|
throw error;
|
|
197
169
|
});
|
|
198
170
|
throw suspensePromise;
|
|
199
|
-
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// re-render when loaded state changes. technically, we could use `useWatchable` here, but as
|
|
200
174
|
// our LoadableModel isn't a Watchable, we can't. There's no way to preserve flow errors when
|
|
201
175
|
// watching something that doesn't have a 'isDataLoaded' watch key and use `Watchable`.
|
|
202
|
-
|
|
203
|
-
|
|
204
176
|
var modelIsLoadedSubscription = (0, _react.useMemo)(() => ({
|
|
205
177
|
getCurrentValue: () => compactModels.map(model => model.isDataLoaded).join(','),
|
|
206
178
|
subscribe: onChange => {
|
|
207
|
-
var
|
|
208
|
-
|
|
209
|
-
var _iteratorError3 = undefined;
|
|
210
|
-
|
|
179
|
+
var _iterator3 = _createForOfIteratorHelper(compactModels),
|
|
180
|
+
_step3;
|
|
211
181
|
try {
|
|
212
|
-
for (
|
|
182
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
213
183
|
var model = _step3.value;
|
|
214
184
|
model.watch('isDataLoaded', onChange);
|
|
215
185
|
}
|
|
216
186
|
} catch (err) {
|
|
217
|
-
|
|
218
|
-
_iteratorError3 = err;
|
|
187
|
+
_iterator3.e(err);
|
|
219
188
|
} finally {
|
|
220
|
-
|
|
221
|
-
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
|
222
|
-
_iterator3.return();
|
|
223
|
-
}
|
|
224
|
-
} finally {
|
|
225
|
-
if (_didIteratorError3) {
|
|
226
|
-
throw _iteratorError3;
|
|
227
|
-
}
|
|
228
|
-
}
|
|
189
|
+
_iterator3.f();
|
|
229
190
|
}
|
|
230
|
-
|
|
231
191
|
return () => {
|
|
232
|
-
var
|
|
233
|
-
|
|
234
|
-
var _iteratorError4 = undefined;
|
|
235
|
-
|
|
192
|
+
var _iterator4 = _createForOfIteratorHelper(compactModels),
|
|
193
|
+
_step4;
|
|
236
194
|
try {
|
|
237
|
-
for (
|
|
195
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
238
196
|
var model = _step4.value;
|
|
239
197
|
model.unwatch('isDataLoaded', onChange);
|
|
240
198
|
}
|
|
241
199
|
} catch (err) {
|
|
242
|
-
|
|
243
|
-
_iteratorError4 = err;
|
|
200
|
+
_iterator4.e(err);
|
|
244
201
|
} finally {
|
|
245
|
-
|
|
246
|
-
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
|
|
247
|
-
_iterator4.return();
|
|
248
|
-
}
|
|
249
|
-
} finally {
|
|
250
|
-
if (_didIteratorError4) {
|
|
251
|
-
throw _iteratorError4;
|
|
252
|
-
}
|
|
253
|
-
}
|
|
202
|
+
_iterator4.f();
|
|
254
203
|
}
|
|
255
204
|
};
|
|
256
205
|
}
|
|
257
206
|
}), [compactModels]);
|
|
258
|
-
(0, _useSubscription.useSubscription)(modelIsLoadedSubscription);
|
|
207
|
+
(0, _useSubscription.useSubscription)(modelIsLoadedSubscription);
|
|
208
|
+
|
|
209
|
+
// the main part of this hook comes down to managing the query result data loading in sync with
|
|
259
210
|
// the component lifecycle. That means loading the data when the component mounts, and
|
|
260
211
|
// unloading it when the component unmounts.
|
|
261
|
-
|
|
262
212
|
(0, _react.useEffect)(() => {
|
|
263
|
-
var
|
|
264
|
-
|
|
265
|
-
var _iteratorError5 = undefined;
|
|
266
|
-
|
|
213
|
+
var _iterator5 = _createForOfIteratorHelper(compactModels),
|
|
214
|
+
_step5;
|
|
267
215
|
try {
|
|
268
|
-
for (
|
|
216
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
269
217
|
var model = _step5.value;
|
|
270
218
|
model.loadDataAsync();
|
|
271
219
|
}
|
|
272
220
|
} catch (err) {
|
|
273
|
-
|
|
274
|
-
_iteratorError5 = err;
|
|
221
|
+
_iterator5.e(err);
|
|
275
222
|
} finally {
|
|
276
|
-
|
|
277
|
-
if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
|
|
278
|
-
_iterator5.return();
|
|
279
|
-
}
|
|
280
|
-
} finally {
|
|
281
|
-
if (_didIteratorError5) {
|
|
282
|
-
throw _iteratorError5;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
223
|
+
_iterator5.f();
|
|
285
224
|
}
|
|
286
|
-
|
|
287
225
|
return () => {
|
|
288
|
-
var
|
|
289
|
-
|
|
290
|
-
var _iteratorError6 = undefined;
|
|
291
|
-
|
|
226
|
+
var _iterator6 = _createForOfIteratorHelper(compactModels),
|
|
227
|
+
_step6;
|
|
292
228
|
try {
|
|
293
|
-
for (
|
|
229
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
294
230
|
var model = _step6.value;
|
|
295
231
|
model.unloadData();
|
|
296
232
|
}
|
|
297
233
|
} catch (err) {
|
|
298
|
-
|
|
299
|
-
_iteratorError6 = err;
|
|
234
|
+
_iterator6.e(err);
|
|
300
235
|
} finally {
|
|
301
|
-
|
|
302
|
-
if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
|
|
303
|
-
_iterator6.return();
|
|
304
|
-
}
|
|
305
|
-
} finally {
|
|
306
|
-
if (_didIteratorError6) {
|
|
307
|
-
throw _iteratorError6;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
236
|
+
_iterator6.f();
|
|
310
237
|
}
|
|
311
238
|
};
|
|
312
239
|
}, [compactModels]);
|
|
@@ -1,23 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = useRecordActionData;
|
|
9
|
-
|
|
10
8
|
var _perform_record_action = require("../perform_record_action");
|
|
11
|
-
|
|
12
9
|
var _use_loadable = _interopRequireDefault(require("./use_loadable"));
|
|
13
|
-
|
|
14
10
|
var _use_watchable = _interopRequireDefault(require("./use_watchable"));
|
|
15
|
-
|
|
16
11
|
var _sdk_context = require("./sdk_context");
|
|
17
|
-
|
|
18
|
-
/** @module @airtable/blocks/ui: useRecordActionData */
|
|
19
|
-
|
|
20
|
-
/** */
|
|
12
|
+
/** @module @airtable/blocks/ui: useRecordActionData */ /** */
|
|
21
13
|
|
|
22
14
|
/**
|
|
23
15
|
* A hook to watch "open extension" / "perform record action" events (from button field). Returns
|
|
@@ -69,18 +61,20 @@ var _sdk_context = require("./sdk_context");
|
|
|
69
61
|
* @docsPath UI/hooks/useRecordActionData
|
|
70
62
|
* @hook
|
|
71
63
|
*/
|
|
64
|
+
|
|
72
65
|
function useRecordActionData() {
|
|
73
66
|
var _useSdk = (0, _sdk_context.useSdk)(),
|
|
74
|
-
|
|
67
|
+
performRecordAction = _useSdk.performRecordAction;
|
|
75
68
|
|
|
69
|
+
// Puts the block in suspense until the liveapp handler has been registered.
|
|
70
|
+
(0, _use_loadable.default)(performRecordAction);
|
|
76
71
|
|
|
77
|
-
|
|
72
|
+
// Note: if we were to pass a callback to useWatchable, it would drop the callback for the
|
|
78
73
|
// initial recordActionData (if it exists) when the component is mounted.
|
|
79
74
|
// We'd have to trigger it manually by comparing recordActionData to it's previous value in an
|
|
80
75
|
// effect, but would need to be careful to not erroneously trigger it when the component
|
|
81
76
|
// unmounts and remounts.
|
|
82
77
|
// So, using a callback with useRecordActionData isn't supported right now for simplicity.
|
|
83
|
-
|
|
84
78
|
(0, _use_watchable.default)(performRecordAction, _perform_record_action.WatchablePerformRecordActionKeys.recordActionData);
|
|
85
79
|
return performRecordAction.recordActionData;
|
|
86
80
|
}
|
|
@@ -1,32 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
require("core-js/modules/es.array.iterator.js");
|
|
4
|
+
require("core-js/modules/es.object.to-string.js");
|
|
5
|
+
require("core-js/modules/es.weak-map.js");
|
|
6
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
5
7
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
8
|
Object.defineProperty(exports, "__esModule", {
|
|
8
9
|
value: true
|
|
9
10
|
});
|
|
10
|
-
exports.useRecordIds = useRecordIds;
|
|
11
|
-
exports.useRecords = useRecords;
|
|
12
11
|
exports.useRecordById = useRecordById;
|
|
12
|
+
exports.useRecordIds = useRecordIds;
|
|
13
13
|
exports.useRecordQueryResult = useRecordQueryResult;
|
|
14
|
-
|
|
14
|
+
exports.useRecords = useRecords;
|
|
15
15
|
var _error_utils = require("../error_utils");
|
|
16
|
-
|
|
17
16
|
var _table = _interopRequireDefault(require("../models/table"));
|
|
18
|
-
|
|
19
17
|
var _record_query_result = _interopRequireDefault(require("../models/record_query_result"));
|
|
20
|
-
|
|
21
18
|
var RecordColoring = _interopRequireWildcard(require("../models/record_coloring"));
|
|
22
|
-
|
|
23
19
|
var _view = _interopRequireDefault(require("../models/view"));
|
|
24
|
-
|
|
25
20
|
var _use_loadable = _interopRequireDefault(require("./use_loadable"));
|
|
26
|
-
|
|
27
21
|
var _use_watchable = _interopRequireDefault(require("./use_watchable"));
|
|
22
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
23
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
24
|
+
/** @module @airtable/blocks/ui: useRecords */ /** */
|
|
28
25
|
|
|
29
|
-
/**
|
|
26
|
+
/** */
|
|
30
27
|
|
|
31
28
|
/** */
|
|
32
29
|
|
|
@@ -41,22 +38,23 @@ var _use_watchable = _interopRequireDefault(require("./use_watchable"));
|
|
|
41
38
|
*/
|
|
42
39
|
function _useUnwatchedRecordQueryResult(tableOrViewOrQueryResult, functionNameForErrors, opts) {
|
|
43
40
|
var queryResult;
|
|
44
|
-
|
|
45
41
|
if (tableOrViewOrQueryResult instanceof _table.default || tableOrViewOrQueryResult instanceof _view.default) {
|
|
46
42
|
queryResult = tableOrViewOrQueryResult.selectRecords(opts);
|
|
47
43
|
} else {
|
|
48
44
|
if (tableOrViewOrQueryResult instanceof _record_query_result.default && opts !== undefined) {
|
|
49
45
|
throw (0, _error_utils.spawnError)('%s does not support passing both a queryResult and opts.', functionNameForErrors);
|
|
50
46
|
}
|
|
51
|
-
|
|
52
47
|
queryResult = tableOrViewOrQueryResult;
|
|
53
48
|
}
|
|
54
|
-
|
|
55
49
|
(0, _use_loadable.default)(queryResult);
|
|
56
50
|
return queryResult;
|
|
57
51
|
}
|
|
52
|
+
|
|
58
53
|
/** */
|
|
59
54
|
|
|
55
|
+
/** */
|
|
56
|
+
|
|
57
|
+
/** */
|
|
60
58
|
|
|
61
59
|
/**
|
|
62
60
|
* A hook for working with a set of record IDs from a table, view or query result. Automatically
|
|
@@ -100,14 +98,16 @@ function useRecordIds(tableOrViewOrQueryResult, opts) {
|
|
|
100
98
|
recordColorMode: RecordColoring.modes.none(),
|
|
101
99
|
sorts: opts ? opts.sorts : undefined
|
|
102
100
|
} : opts;
|
|
103
|
-
|
|
104
101
|
var queryResult = _useUnwatchedRecordQueryResult(tableOrViewOrQueryResult, 'useRecordIds', generatedOpts);
|
|
105
|
-
|
|
106
102
|
(0, _use_watchable.default)(queryResult, ['recordIds']);
|
|
107
103
|
return queryResult ? queryResult.recordIds : null;
|
|
108
104
|
}
|
|
105
|
+
|
|
106
|
+
/** */
|
|
107
|
+
|
|
109
108
|
/** */
|
|
110
109
|
|
|
110
|
+
/** */
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
113
|
* A hook for working with all of the records (including their colors and cell values) in a
|
|
@@ -184,14 +184,16 @@ function useRecordIds(tableOrViewOrQueryResult, opts) {
|
|
|
184
184
|
* @hook
|
|
185
185
|
*/
|
|
186
186
|
function useRecords(tableOrViewOrQueryResult, opts) {
|
|
187
|
-
var queryResult = _useUnwatchedRecordQueryResult(tableOrViewOrQueryResult, 'useRecords', opts);
|
|
188
|
-
|
|
187
|
+
var queryResult = _useUnwatchedRecordQueryResult(tableOrViewOrQueryResult, 'useRecords', opts);
|
|
189
188
|
|
|
189
|
+
// Note this differs from useRecordQueryResult in that it does not watch groups
|
|
190
190
|
(0, _use_watchable.default)(queryResult, ['records', 'cellValues', 'recordColors']);
|
|
191
191
|
return queryResult ? queryResult.records : null;
|
|
192
192
|
}
|
|
193
|
+
|
|
193
194
|
/** */
|
|
194
195
|
|
|
196
|
+
/** */
|
|
195
197
|
|
|
196
198
|
/**
|
|
197
199
|
* A hook for working with a single record. Automatically handles loading data and updating your
|
|
@@ -243,12 +245,12 @@ function useRecords(tableOrViewOrQueryResult, opts) {
|
|
|
243
245
|
*/
|
|
244
246
|
function useRecordById(tableOrViewOrQueryResult, recordId, opts) {
|
|
245
247
|
var queryResult = _useUnwatchedRecordQueryResult(tableOrViewOrQueryResult, 'useRecordById', opts);
|
|
246
|
-
|
|
247
248
|
(0, _use_watchable.default)(queryResult, ['records', 'recordColors']);
|
|
248
249
|
var record = queryResult ? queryResult.getRecordByIdIfExists(recordId) : null;
|
|
249
250
|
(0, _use_watchable.default)(record, ['cellValues']);
|
|
250
251
|
return record;
|
|
251
252
|
}
|
|
253
|
+
|
|
252
254
|
/**
|
|
253
255
|
* Docs: TODO(SeanKeenan)
|
|
254
256
|
*
|
|
@@ -256,11 +258,8 @@ function useRecordById(tableOrViewOrQueryResult, recordId, opts) {
|
|
|
256
258
|
* @hidden
|
|
257
259
|
* @hook
|
|
258
260
|
*/
|
|
259
|
-
|
|
260
|
-
|
|
261
261
|
function useRecordQueryResult(tableOrViewOrQueryResult, opts) {
|
|
262
262
|
var queryResult = _useUnwatchedRecordQueryResult(tableOrViewOrQueryResult, 'useRecordQueryResult', opts);
|
|
263
|
-
|
|
264
263
|
(0, _use_watchable.default)(queryResult, ['records', 'cellValues', 'recordColors', 'groups']);
|
|
265
264
|
return queryResult;
|
|
266
265
|
}
|
|
@@ -1,19 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _use_watchable = _interopRequireDefault(require("./use_watchable"));
|
|
11
|
-
|
|
12
9
|
var _sdk_context = require("./sdk_context");
|
|
13
|
-
|
|
14
|
-
/** @module @airtable/blocks/ui: useSession */
|
|
15
|
-
|
|
16
|
-
/** */
|
|
10
|
+
/** @module @airtable/blocks/ui: useSession */ /** */
|
|
17
11
|
|
|
18
12
|
/**
|
|
19
13
|
* A hook for connecting a React component to the current session. This returns a {@link Session}
|
|
@@ -45,14 +39,11 @@ var _sdk_context = require("./sdk_context");
|
|
|
45
39
|
*/
|
|
46
40
|
var useSession = () => {
|
|
47
41
|
var _useSdk = (0, _sdk_context.useSdk)(),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
42
|
+
session = _useSdk.session,
|
|
43
|
+
base = _useSdk.base;
|
|
44
|
+
(0, _use_watchable.default)(session, ['permissionLevel', 'currentUser']);
|
|
45
|
+
// permission checks depend on the base schema, so we need to track that too:
|
|
53
46
|
(0, _use_watchable.default)(base, ['schema']);
|
|
54
47
|
return session;
|
|
55
48
|
};
|
|
56
|
-
|
|
57
|
-
var _default = useSession;
|
|
58
|
-
exports.default = _default;
|
|
49
|
+
var _default = exports.default = useSession;
|
|
@@ -1,21 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = useSettingsButton;
|
|
9
|
-
|
|
10
8
|
var _react = require("react");
|
|
11
|
-
|
|
12
9
|
var _use_watchable = _interopRequireDefault(require("./use_watchable"));
|
|
13
|
-
|
|
14
10
|
var _sdk_context = require("./sdk_context");
|
|
15
|
-
|
|
16
|
-
/** @module @airtable/blocks/ui: useSettingsButton */
|
|
17
|
-
|
|
18
|
-
/** */
|
|
11
|
+
/** @module @airtable/blocks/ui: useSettingsButton */ /** */
|
|
19
12
|
|
|
20
13
|
/**
|
|
21
14
|
* A hook for using the settings button that lives outside the extension's viewport. It will show
|
|
@@ -46,11 +39,11 @@ var _sdk_context = require("./sdk_context");
|
|
|
46
39
|
*/
|
|
47
40
|
function useSettingsButton(onClickCallback) {
|
|
48
41
|
var _useSdk = (0, _sdk_context.useSdk)(),
|
|
49
|
-
|
|
50
|
-
|
|
42
|
+
settingsButton = _useSdk.settingsButton;
|
|
51
43
|
(0, _react.useEffect)(() => {
|
|
52
|
-
settingsButton.show();
|
|
44
|
+
settingsButton.show();
|
|
53
45
|
|
|
46
|
+
// Hide the button when the component using this hook is unmounted.
|
|
54
47
|
return () => {
|
|
55
48
|
settingsButton.hide();
|
|
56
49
|
};
|
|
@@ -1,41 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.symbol.js");
|
|
4
|
+
require("core-js/modules/es.array.filter.js");
|
|
5
|
+
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
6
|
+
require("core-js/modules/es.object.to-string.js");
|
|
7
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
3
8
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.symbol");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.array.filter");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.object.get-own-property-descriptors");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/web.dom-collections.for-each");
|
|
12
|
-
|
|
13
9
|
Object.defineProperty(exports, "__esModule", {
|
|
14
10
|
value: true
|
|
15
11
|
});
|
|
16
12
|
exports.default = useStyledSystem;
|
|
17
|
-
|
|
18
13
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
19
|
-
|
|
20
14
|
var _emotion = require("emotion");
|
|
21
|
-
|
|
22
15
|
var _use_theme = _interopRequireDefault(require("./theme/use_theme"));
|
|
23
|
-
|
|
24
16
|
var _index = require("./system/index");
|
|
25
|
-
|
|
26
|
-
function
|
|
27
|
-
|
|
28
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
29
|
-
|
|
17
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
30
19
|
/** @internal */
|
|
31
20
|
function useStyledSystem(styleProps) {
|
|
32
21
|
var styleParser = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _index.allStylesParser;
|
|
33
|
-
var theme = (0, _use_theme.default)();
|
|
22
|
+
var theme = (0, _use_theme.default)();
|
|
34
23
|
|
|
35
|
-
|
|
24
|
+
// Add the theme to the style props because that's how the parser expects it.
|
|
25
|
+
var styles = styleParser(_objectSpread(_objectSpread({}, styleProps), {}, {
|
|
36
26
|
theme
|
|
37
|
-
}));
|
|
27
|
+
}));
|
|
38
28
|
|
|
29
|
+
// At this point `styles` is still an object, we need to turn it into a class name.
|
|
39
30
|
var classNameForStyleProps = (0, _emotion.css)(styles);
|
|
40
31
|
return classNameForStyleProps;
|
|
41
32
|
}
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = useSynced;
|
|
9
|
-
|
|
10
8
|
var _global_config_synced_component_helpers = _interopRequireDefault(require("./global_config_synced_component_helpers"));
|
|
11
|
-
|
|
12
9
|
var _sdk_context = require("./sdk_context");
|
|
13
|
-
|
|
14
10
|
/**
|
|
15
11
|
* A hook for syncing a component to {@link GlobalConfig}.
|
|
16
12
|
* Useful if you are dealing with a custom input component and can‘t use one of our `Synced` components.
|
|
@@ -38,15 +34,12 @@ var _sdk_context = require("./sdk_context");
|
|
|
38
34
|
*/
|
|
39
35
|
function useSynced(globalConfigKey) {
|
|
40
36
|
_global_config_synced_component_helpers.default.useDefaultWatchesForSyncedComponent(globalConfigKey);
|
|
41
|
-
|
|
42
37
|
var sdk = (0, _sdk_context.useSdk)();
|
|
43
38
|
var globalConfig = sdk.globalConfig;
|
|
44
39
|
var value = globalConfig.get(globalConfigKey);
|
|
45
40
|
var canSetValue = globalConfig.hasPermissionToSet(globalConfigKey);
|
|
46
|
-
|
|
47
41
|
function setValue(newValue) {
|
|
48
42
|
sdk.globalConfig.setAsync(globalConfigKey, newValue);
|
|
49
43
|
}
|
|
50
|
-
|
|
51
44
|
return [value, setValue, canSetValue];
|
|
52
45
|
}
|