@airtable/blocks 0.0.0-experimental-f52bc4e5e-20250709 → 0.0.0-experimental-75d011284-20250904
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/dist/cjs/base/assert_run_context.js +12 -0
- package/dist/cjs/base/index.js +30 -30
- package/dist/cjs/base/models/abstract_model_with_async_data.js +154 -237
- package/dist/cjs/base/models/base.js +188 -267
- package/dist/cjs/base/models/create_aggregators.js +29 -46
- package/dist/cjs/base/models/cursor.js +206 -294
- package/dist/cjs/base/models/field.js +307 -395
- package/dist/cjs/base/models/grouped_record_query_result.js +219 -338
- package/dist/cjs/base/models/linked_records_query_result.js +450 -625
- package/dist/cjs/base/models/models.js +19 -22
- package/dist/cjs/base/models/mutations.js +267 -293
- package/dist/cjs/base/models/object_pool.js +117 -156
- package/dist/cjs/base/models/record.js +191 -256
- package/dist/cjs/base/models/record_coloring.js +6 -6
- package/dist/cjs/base/models/record_query_result.js +351 -435
- package/dist/cjs/base/models/record_store.js +403 -753
- package/dist/cjs/base/models/session.js +125 -153
- package/dist/cjs/base/models/table.js +457 -605
- package/dist/cjs/base/models/table_or_view_query_result.js +656 -920
- package/dist/cjs/base/models/view.js +284 -389
- package/dist/cjs/base/models/view_data_store.js +218 -356
- package/dist/cjs/base/models/view_metadata_query_result.js +109 -157
- package/dist/cjs/base/perform_record_action.js +89 -131
- package/dist/cjs/base/sdk.js +129 -184
- package/dist/cjs/base/settings_button.js +54 -74
- package/dist/cjs/base/types/airtable_interface.js +1 -1
- package/dist/cjs/base/types/mutations.js +5 -11
- package/dist/cjs/base/types/undo_redo.js +1 -1
- package/dist/cjs/base/types/view.js +1 -1
- package/dist/cjs/base/ui/base_provider.js +6 -8
- package/dist/cjs/base/ui/baymax_utils.js +436 -108
- package/dist/cjs/base/ui/block_wrapper.js +81 -106
- package/dist/cjs/base/ui/box.js +34 -60
- package/dist/cjs/base/ui/button.js +44 -74
- package/dist/cjs/base/ui/cell_renderer.js +132 -189
- package/dist/cjs/base/ui/choice_token.js +25 -42
- package/dist/cjs/base/ui/collaborator_token.js +31 -53
- package/dist/cjs/base/ui/color_palette.js +130 -173
- package/dist/cjs/base/ui/color_palette_synced.js +41 -70
- package/dist/cjs/base/ui/confirmation_dialog.js +70 -120
- package/dist/cjs/base/ui/control_sizes.js +24 -22
- package/dist/cjs/base/ui/create_detect_element_resize.js +6 -10
- package/dist/cjs/base/ui/css_helpers.js +1 -1
- package/dist/cjs/base/ui/dialog.js +57 -98
- package/dist/cjs/base/ui/dialog_close_button.js +52 -98
- package/dist/cjs/base/ui/expand_record.js +1 -2
- package/dist/cjs/base/ui/expand_record_list.js +3 -4
- package/dist/cjs/base/ui/expand_record_picker_async.js +28 -57
- package/dist/cjs/base/ui/field_icon.js +15 -33
- package/dist/cjs/base/ui/field_picker.js +25 -70
- package/dist/cjs/base/ui/field_picker_synced.js +18 -40
- package/dist/cjs/base/ui/form_field.js +27 -55
- package/dist/cjs/base/ui/geometry/geometry.js +5 -5
- package/dist/cjs/base/ui/geometry/point.js +10 -12
- package/dist/cjs/base/ui/geometry/rect.js +36 -52
- package/dist/cjs/base/ui/geometry/size.js +10 -12
- package/dist/cjs/base/ui/global_alert.js +31 -52
- package/dist/cjs/base/ui/heading.js +45 -94
- package/dist/cjs/base/ui/icon.js +39 -59
- package/dist/cjs/base/ui/icon_config.js +6 -12
- package/dist/cjs/base/ui/initialize_block.js +16 -35
- package/dist/cjs/base/ui/input.js +62 -101
- package/dist/cjs/base/ui/input_synced.js +17 -40
- package/dist/cjs/base/ui/key_codes.js +2 -3
- package/dist/cjs/base/ui/label.js +30 -55
- package/dist/cjs/base/ui/link.js +54 -87
- package/dist/cjs/base/ui/loader.js +15 -36
- package/dist/cjs/base/ui/modal.js +88 -127
- package/dist/cjs/base/ui/model_picker_select.js +18 -44
- package/dist/cjs/base/ui/popover.js +236 -328
- package/dist/cjs/base/ui/progress_bar.js +34 -47
- package/dist/cjs/base/ui/record_card.js +389 -478
- package/dist/cjs/base/ui/record_card_list.js +150 -224
- package/dist/cjs/base/ui/select.js +60 -116
- package/dist/cjs/base/ui/select_and_select_buttons_helpers.js +15 -39
- package/dist/cjs/base/ui/select_buttons.js +50 -83
- package/dist/cjs/base/ui/select_buttons_synced.js +17 -39
- package/dist/cjs/base/ui/select_synced.js +17 -39
- package/dist/cjs/base/ui/switch.js +42 -71
- package/dist/cjs/base/ui/switch_synced.js +16 -38
- package/dist/cjs/base/ui/synced.js +27 -48
- package/dist/cjs/base/ui/system/all_styles_set.js +4 -12
- package/dist/cjs/base/ui/system/appearance/appearance_set.js +10 -13
- package/dist/cjs/base/ui/system/appearance/background_color.js +3 -6
- package/dist/cjs/base/ui/system/appearance/border.js +3 -6
- package/dist/cjs/base/ui/system/appearance/border_radius.js +3 -6
- package/dist/cjs/base/ui/system/appearance/box_shadow.js +3 -6
- package/dist/cjs/base/ui/system/appearance/opacity.js +3 -6
- package/dist/cjs/base/ui/system/dimensions/dimensions_set.js +11 -13
- package/dist/cjs/base/ui/system/dimensions/height.js +3 -6
- package/dist/cjs/base/ui/system/dimensions/max_height.js +3 -6
- package/dist/cjs/base/ui/system/dimensions/max_width.js +3 -6
- package/dist/cjs/base/ui/system/dimensions/min_height.js +3 -6
- package/dist/cjs/base/ui/system/dimensions/min_width.js +3 -6
- package/dist/cjs/base/ui/system/dimensions/width.js +3 -6
- package/dist/cjs/base/ui/system/display.js +3 -6
- package/dist/cjs/base/ui/system/flex_container/align_content.js +3 -6
- package/dist/cjs/base/ui/system/flex_container/align_items.js +3 -6
- package/dist/cjs/base/ui/system/flex_container/flex_container_set.js +11 -13
- package/dist/cjs/base/ui/system/flex_container/flex_direction.js +3 -6
- package/dist/cjs/base/ui/system/flex_container/flex_wrap.js +3 -6
- package/dist/cjs/base/ui/system/flex_container/justify_content.js +3 -6
- package/dist/cjs/base/ui/system/flex_container/justify_items.js +3 -6
- package/dist/cjs/base/ui/system/flex_item/align_self.js +3 -6
- package/dist/cjs/base/ui/system/flex_item/flex.js +3 -6
- package/dist/cjs/base/ui/system/flex_item/flex_basis.js +3 -6
- package/dist/cjs/base/ui/system/flex_item/flex_grow.js +3 -6
- package/dist/cjs/base/ui/system/flex_item/flex_item_set.js +12 -13
- package/dist/cjs/base/ui/system/flex_item/flex_shrink.js +3 -6
- package/dist/cjs/base/ui/system/flex_item/justify_self.js +3 -6
- package/dist/cjs/base/ui/system/flex_item/order.js +3 -6
- package/dist/cjs/base/ui/system/index.js +104 -416
- package/dist/cjs/base/ui/system/overflow.js +3 -6
- package/dist/cjs/base/ui/system/position/bottom.js +4 -6
- package/dist/cjs/base/ui/system/position/left.js +4 -6
- package/dist/cjs/base/ui/system/position/position.js +3 -6
- package/dist/cjs/base/ui/system/position/position_set.js +11 -13
- package/dist/cjs/base/ui/system/position/right.js +4 -6
- package/dist/cjs/base/ui/system/position/top.js +4 -6
- package/dist/cjs/base/ui/system/position/z_index.js +3 -6
- package/dist/cjs/base/ui/system/spacing/margin.js +4 -6
- package/dist/cjs/base/ui/system/spacing/padding.js +4 -6
- package/dist/cjs/base/ui/system/spacing/spacing_set.js +7 -13
- package/dist/cjs/base/ui/system/typography/font_family.js +3 -6
- package/dist/cjs/base/ui/system/typography/font_size.js +3 -6
- package/dist/cjs/base/ui/system/typography/font_style.js +3 -6
- package/dist/cjs/base/ui/system/typography/font_weight.js +3 -6
- package/dist/cjs/base/ui/system/typography/letter_spacing.js +3 -6
- package/dist/cjs/base/ui/system/typography/line_height.js +3 -6
- package/dist/cjs/base/ui/system/typography/text_align.js +3 -6
- package/dist/cjs/base/ui/system/typography/text_color.js +3 -6
- package/dist/cjs/base/ui/system/typography/text_decoration.js +3 -6
- package/dist/cjs/base/ui/system/typography/text_transform.js +3 -6
- package/dist/cjs/base/ui/system/typography/typography_set.js +15 -13
- package/dist/cjs/base/ui/system/utils/ensure_numbers_are_within_scale.js +3 -4
- package/dist/cjs/base/ui/system/utils/get_style_props_for_responsive_prop.js +47 -87
- package/dist/cjs/base/ui/table_picker.js +18 -42
- package/dist/cjs/base/ui/table_picker_synced.js +17 -39
- package/dist/cjs/base/ui/text.js +40 -73
- package/dist/cjs/base/ui/text_button.js +51 -83
- package/dist/cjs/base/ui/theme/default_theme/button_variants.js +3 -3
- package/dist/cjs/base/ui/theme/default_theme/control_sizes.js +51 -45
- package/dist/cjs/base/ui/theme/default_theme/heading_styles.js +1 -1
- package/dist/cjs/base/ui/theme/default_theme/index.js +9 -15
- package/dist/cjs/base/ui/theme/default_theme/input_variants.js +3 -3
- package/dist/cjs/base/ui/theme/default_theme/link_variants.js +3 -3
- package/dist/cjs/base/ui/theme/default_theme/select_buttons_variants.js +4 -4
- package/dist/cjs/base/ui/theme/default_theme/select_variants.js +8 -17
- package/dist/cjs/base/ui/theme/default_theme/switch_variants.js +23 -29
- package/dist/cjs/base/ui/theme/default_theme/text_button_variants.js +5 -5
- package/dist/cjs/base/ui/theme/default_theme/text_styles.js +1 -1
- package/dist/cjs/base/ui/theme/default_theme/tokens.js +14 -14
- package/dist/cjs/base/ui/theme/theme_context.js +2 -2
- package/dist/cjs/base/ui/theme/use_theme.js +2 -2
- package/dist/cjs/base/ui/tooltip.js +134 -174
- package/dist/cjs/base/ui/types/aria_props.js +1 -23
- package/dist/cjs/base/ui/types/data_attributes_prop.js +1 -18
- package/dist/cjs/base/ui/types/tooltip_anchor_props.js +1 -17
- package/dist/cjs/base/ui/ui.js +48 -49
- package/dist/cjs/base/ui/unstable_standalone_ui.js +27 -27
- package/dist/cjs/base/ui/use_base.js +1 -1
- package/dist/cjs/base/ui/use_cursor.js +5 -4
- package/dist/cjs/base/ui/use_form_field.js +1 -1
- package/dist/cjs/base/ui/use_loadable.js +25 -91
- package/dist/cjs/base/ui/use_record_action_data.js +4 -3
- package/dist/cjs/base/ui/use_records.js +9 -13
- package/dist/cjs/base/ui/use_session.js +1 -1
- package/dist/cjs/base/ui/use_settings_button.js +4 -3
- package/dist/cjs/base/ui/use_styled_system.js +7 -14
- package/dist/cjs/base/ui/use_text_color_for_background_color.js +4 -3
- package/dist/cjs/base/ui/use_view_metadata.js +4 -4
- package/dist/cjs/base/ui/use_viewport.js +2 -2
- package/dist/cjs/base/ui/view_picker.js +26 -70
- package/dist/cjs/base/ui/view_picker_synced.js +18 -40
- package/dist/cjs/base/ui/viewport_constraint.js +67 -114
- package/dist/cjs/base/ui/with_styled_system.js +25 -61
- package/dist/cjs/base/undo_redo.js +21 -32
- package/dist/cjs/base/unstable_testing_utils.js +27 -27
- package/dist/cjs/base/viewport.js +268 -312
- package/dist/cjs/injected/airtable_interface.js +4 -4
- package/dist/cjs/interface/assert_run_context.js +12 -0
- package/dist/cjs/interface/index.js +4 -18
- package/dist/cjs/interface/models/base.js +15 -34
- package/dist/cjs/interface/models/field.js +5 -19
- package/dist/cjs/interface/models/models.js +8 -7
- package/dist/cjs/interface/models/mutations.js +50 -66
- package/dist/cjs/interface/models/record.js +29 -49
- package/dist/cjs/interface/models/record_store.js +25 -57
- package/dist/cjs/interface/models/session.js +2 -16
- package/dist/cjs/interface/models/table.js +66 -95
- package/dist/cjs/interface/sdk.js +61 -87
- package/dist/cjs/interface/types/airtable_interface.js +2 -2
- package/dist/cjs/interface/types/mutations.js +3 -10
- package/dist/cjs/interface/ui/block_wrapper.js +56 -48
- package/dist/cjs/interface/ui/initialize_block.js +13 -28
- package/dist/cjs/interface/ui/ui.js +20 -19
- package/dist/cjs/interface/ui/use_base.js +1 -1
- package/dist/cjs/interface/ui/use_custom_properties.js +19 -35
- package/dist/cjs/interface/ui/use_records.js +6 -5
- package/dist/cjs/interface/ui/use_run_info.js +2 -2
- package/dist/cjs/interface/ui/use_session.js +1 -1
- package/dist/cjs/shared/color_utils.js +9 -16
- package/dist/cjs/shared/colors.js +2 -2
- package/dist/cjs/shared/error_utils.js +9 -11
- package/dist/cjs/shared/event_tracker.js +3 -3
- package/dist/cjs/shared/global_config.js +337 -449
- package/dist/cjs/shared/models/abstract_model.js +72 -97
- package/dist/cjs/shared/models/base_core.js +394 -514
- package/dist/cjs/shared/models/field_core.js +236 -279
- package/dist/cjs/shared/models/mutations_core.js +283 -379
- package/dist/cjs/shared/models/record_core.js +174 -231
- package/dist/cjs/shared/models/record_store_core.js +119 -172
- package/dist/cjs/shared/models/session_core.js +116 -170
- package/dist/cjs/shared/models/table_core.js +1258 -1501
- package/dist/cjs/shared/private_utils.js +54 -124
- package/dist/cjs/shared/sdk_core.js +68 -70
- package/dist/cjs/shared/types/field_core.js +1 -1
- package/dist/cjs/shared/types/mutation_constants.js +4 -4
- package/dist/cjs/shared/types/mutations_core.js +1 -1
- package/dist/cjs/shared/types/permission_levels.js +1 -1
- package/dist/cjs/shared/ui/global_config_synced_component_helpers.js +9 -9
- package/dist/cjs/shared/ui/loader.js +14 -35
- package/dist/cjs/shared/ui/remote_utils.js +5 -7
- package/dist/cjs/shared/ui/sdk_context.js +4 -8
- package/dist/cjs/shared/ui/use_array_identity.js +2 -2
- package/dist/cjs/shared/ui/use_base.js +6 -5
- package/dist/cjs/shared/ui/use_color_scheme.js +3 -8
- package/dist/cjs/shared/ui/use_global_config.js +5 -4
- package/dist/cjs/shared/ui/use_session.js +6 -5
- package/dist/cjs/shared/ui/use_synced.js +7 -5
- package/dist/cjs/shared/ui/use_watchable.js +13 -42
- package/dist/cjs/shared/ui/with_hooks.js +6 -13
- package/dist/cjs/shared/unstable_private_utils.js +4 -6
- package/dist/cjs/shared/warning.js +5 -5
- package/dist/cjs/shared/watchable.js +110 -176
- package/dist/cjs/stats/block_stats.js +62 -85
- package/dist/cjs/testing/base/abstract_mock_airtable_interface.js +208 -0
- package/dist/cjs/testing/interface/abstract_mock_airtable_interface.js +124 -0
- package/dist/types/src/base/assert_run_context.d.ts +2 -0
- package/dist/types/src/base/assert_run_context.d.ts.map +1 -0
- package/dist/types/src/base/index.d.ts +1 -0
- package/dist/types/src/base/index.d.ts.map +1 -1
- package/dist/types/src/base/models/models.d.ts +1 -0
- package/dist/types/src/base/models/models.d.ts.map +1 -1
- package/dist/types/src/base/models/mutations.d.ts.map +1 -1
- package/dist/types/src/base/sdk.d.ts.map +1 -1
- package/dist/types/src/base/ui/block_wrapper.d.ts +1 -1
- package/dist/types/src/base/ui/box.d.ts.map +1 -1
- package/dist/types/src/base/ui/button.d.ts +0 -5
- package/dist/types/src/base/ui/button.d.ts.map +1 -1
- package/dist/types/src/base/ui/cell_renderer.d.ts +1 -22
- package/dist/types/src/base/ui/cell_renderer.d.ts.map +1 -1
- package/dist/types/src/base/ui/choice_token.d.ts +1 -21
- package/dist/types/src/base/ui/choice_token.d.ts.map +1 -1
- package/dist/types/src/base/ui/collaborator_token.d.ts +0 -20
- package/dist/types/src/base/ui/collaborator_token.d.ts.map +1 -1
- package/dist/types/src/base/ui/color_palette.d.ts +1 -32
- package/dist/types/src/base/ui/color_palette.d.ts.map +1 -1
- package/dist/types/src/base/ui/color_palette_synced.d.ts +0 -14
- package/dist/types/src/base/ui/color_palette_synced.d.ts.map +1 -1
- package/dist/types/src/base/ui/confirmation_dialog.d.ts +0 -17
- package/dist/types/src/base/ui/confirmation_dialog.d.ts.map +1 -1
- package/dist/types/src/base/ui/control_sizes.d.ts +0 -1
- package/dist/types/src/base/ui/control_sizes.d.ts.map +1 -1
- package/dist/types/src/base/ui/dialog.d.ts +1 -23
- package/dist/types/src/base/ui/dialog.d.ts.map +1 -1
- package/dist/types/src/base/ui/dialog_close_button.d.ts +2 -24
- package/dist/types/src/base/ui/dialog_close_button.d.ts.map +1 -1
- package/dist/types/src/base/ui/field_icon.d.ts +1 -17
- package/dist/types/src/base/ui/field_icon.d.ts.map +1 -1
- package/dist/types/src/base/ui/field_picker.d.ts +0 -23
- package/dist/types/src/base/ui/field_picker.d.ts.map +1 -1
- package/dist/types/src/base/ui/field_picker_synced.d.ts.map +1 -1
- package/dist/types/src/base/ui/form_field.d.ts +0 -4
- package/dist/types/src/base/ui/form_field.d.ts.map +1 -1
- package/dist/types/src/base/ui/heading.d.ts +1 -1
- package/dist/types/src/base/ui/heading.d.ts.map +1 -1
- package/dist/types/src/base/ui/icon.d.ts +0 -16
- package/dist/types/src/base/ui/icon.d.ts.map +1 -1
- package/dist/types/src/base/ui/icon_config.d.ts +50 -51
- package/dist/types/src/base/ui/icon_config.d.ts.map +1 -1
- package/dist/types/src/base/ui/initialize_block.d.ts.map +1 -1
- package/dist/types/src/base/ui/input.d.ts +12 -46
- package/dist/types/src/base/ui/input.d.ts.map +1 -1
- package/dist/types/src/base/ui/input_synced.d.ts.map +1 -1
- package/dist/types/src/base/ui/label.d.ts.map +1 -1
- package/dist/types/src/base/ui/link.d.ts +1 -5
- package/dist/types/src/base/ui/link.d.ts.map +1 -1
- package/dist/types/src/base/ui/loader.d.ts +3 -20
- package/dist/types/src/base/ui/loader.d.ts.map +1 -1
- package/dist/types/src/base/ui/modal.d.ts +1 -14
- package/dist/types/src/base/ui/modal.d.ts.map +1 -1
- package/dist/types/src/base/ui/model_picker_select.d.ts.map +1 -1
- package/dist/types/src/base/ui/popover.d.ts +1 -17
- package/dist/types/src/base/ui/popover.d.ts.map +1 -1
- package/dist/types/src/base/ui/progress_bar.d.ts +1 -24
- package/dist/types/src/base/ui/progress_bar.d.ts.map +1 -1
- package/dist/types/src/base/ui/record_card.d.ts +1 -23
- package/dist/types/src/base/ui/record_card.d.ts.map +1 -1
- package/dist/types/src/base/ui/record_card_list.d.ts +1 -18
- package/dist/types/src/base/ui/record_card_list.d.ts.map +1 -1
- package/dist/types/src/base/ui/select.d.ts +0 -44
- package/dist/types/src/base/ui/select.d.ts.map +1 -1
- package/dist/types/src/base/ui/select_and_select_buttons_helpers.d.ts +0 -2
- package/dist/types/src/base/ui/select_and_select_buttons_helpers.d.ts.map +1 -1
- package/dist/types/src/base/ui/select_buttons.d.ts +0 -22
- package/dist/types/src/base/ui/select_buttons.d.ts.map +1 -1
- package/dist/types/src/base/ui/select_buttons_synced.d.ts.map +1 -1
- package/dist/types/src/base/ui/select_synced.d.ts.map +1 -1
- package/dist/types/src/base/ui/switch.d.ts +0 -22
- package/dist/types/src/base/ui/switch.d.ts.map +1 -1
- package/dist/types/src/base/ui/switch_synced.d.ts.map +1 -1
- package/dist/types/src/base/ui/synced.d.ts +2 -8
- package/dist/types/src/base/ui/synced.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/all_styles_set.d.ts +0 -3
- package/dist/types/src/base/ui/system/all_styles_set.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/appearance/appearance_set.d.ts +0 -1
- package/dist/types/src/base/ui/system/appearance/appearance_set.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/appearance/background_color.d.ts +0 -1
- package/dist/types/src/base/ui/system/appearance/background_color.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/appearance/border.d.ts +0 -1
- package/dist/types/src/base/ui/system/appearance/border.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/appearance/border_radius.d.ts +0 -1
- package/dist/types/src/base/ui/system/appearance/border_radius.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/appearance/box_shadow.d.ts +0 -1
- package/dist/types/src/base/ui/system/appearance/box_shadow.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/appearance/opacity.d.ts +0 -1
- package/dist/types/src/base/ui/system/appearance/opacity.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/dimensions/dimensions_set.d.ts +0 -1
- package/dist/types/src/base/ui/system/dimensions/dimensions_set.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/dimensions/height.d.ts +0 -1
- package/dist/types/src/base/ui/system/dimensions/height.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/dimensions/max_height.d.ts +0 -1
- package/dist/types/src/base/ui/system/dimensions/max_height.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/dimensions/max_width.d.ts +0 -1
- package/dist/types/src/base/ui/system/dimensions/max_width.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/dimensions/min_height.d.ts +0 -1
- package/dist/types/src/base/ui/system/dimensions/min_height.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/dimensions/min_width.d.ts +0 -1
- package/dist/types/src/base/ui/system/dimensions/min_width.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/dimensions/width.d.ts +0 -1
- package/dist/types/src/base/ui/system/dimensions/width.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/display.d.ts +0 -1
- package/dist/types/src/base/ui/system/display.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/flex_container/align_content.d.ts +0 -1
- package/dist/types/src/base/ui/system/flex_container/align_content.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/flex_container/align_items.d.ts +0 -1
- package/dist/types/src/base/ui/system/flex_container/align_items.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/flex_container/flex_container_set.d.ts +0 -1
- package/dist/types/src/base/ui/system/flex_container/flex_container_set.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/flex_container/flex_direction.d.ts +0 -1
- package/dist/types/src/base/ui/system/flex_container/flex_direction.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/flex_container/flex_wrap.d.ts +0 -1
- package/dist/types/src/base/ui/system/flex_container/flex_wrap.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/flex_container/justify_content.d.ts +0 -1
- package/dist/types/src/base/ui/system/flex_container/justify_content.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/flex_container/justify_items.d.ts +0 -1
- package/dist/types/src/base/ui/system/flex_container/justify_items.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/flex_item/align_self.d.ts +0 -1
- package/dist/types/src/base/ui/system/flex_item/align_self.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/flex_item/flex.d.ts +0 -1
- package/dist/types/src/base/ui/system/flex_item/flex.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/flex_item/flex_basis.d.ts +0 -1
- package/dist/types/src/base/ui/system/flex_item/flex_basis.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/flex_item/flex_grow.d.ts +0 -1
- package/dist/types/src/base/ui/system/flex_item/flex_grow.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/flex_item/flex_item_set.d.ts +0 -1
- package/dist/types/src/base/ui/system/flex_item/flex_item_set.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/flex_item/flex_shrink.d.ts +0 -1
- package/dist/types/src/base/ui/system/flex_item/flex_shrink.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/flex_item/justify_self.d.ts +0 -1
- package/dist/types/src/base/ui/system/flex_item/justify_self.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/flex_item/order.d.ts +0 -1
- package/dist/types/src/base/ui/system/flex_item/order.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/index.d.ts +52 -52
- package/dist/types/src/base/ui/system/index.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/overflow.d.ts +0 -1
- package/dist/types/src/base/ui/system/overflow.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/position/bottom.d.ts +0 -1
- package/dist/types/src/base/ui/system/position/bottom.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/position/left.d.ts +0 -1
- package/dist/types/src/base/ui/system/position/left.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/position/position.d.ts +0 -1
- package/dist/types/src/base/ui/system/position/position.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/position/position_set.d.ts +0 -1
- package/dist/types/src/base/ui/system/position/position_set.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/position/right.d.ts +0 -1
- package/dist/types/src/base/ui/system/position/right.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/position/top.d.ts +0 -1
- package/dist/types/src/base/ui/system/position/top.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/position/z_index.d.ts +0 -1
- package/dist/types/src/base/ui/system/position/z_index.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/spacing/margin.d.ts +0 -1
- package/dist/types/src/base/ui/system/spacing/margin.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/spacing/padding.d.ts +0 -1
- package/dist/types/src/base/ui/system/spacing/padding.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/spacing/spacing_set.d.ts +0 -1
- package/dist/types/src/base/ui/system/spacing/spacing_set.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/typography/font_family.d.ts +0 -1
- package/dist/types/src/base/ui/system/typography/font_family.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/typography/font_size.d.ts +0 -1
- package/dist/types/src/base/ui/system/typography/font_size.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/typography/font_style.d.ts +0 -1
- package/dist/types/src/base/ui/system/typography/font_style.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/typography/font_weight.d.ts +0 -1
- package/dist/types/src/base/ui/system/typography/font_weight.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/typography/letter_spacing.d.ts +0 -1
- package/dist/types/src/base/ui/system/typography/letter_spacing.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/typography/line_height.d.ts +0 -1
- package/dist/types/src/base/ui/system/typography/line_height.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/typography/text_align.d.ts +0 -1
- package/dist/types/src/base/ui/system/typography/text_align.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/typography/text_color.d.ts +0 -1
- package/dist/types/src/base/ui/system/typography/text_color.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/typography/text_decoration.d.ts +0 -1
- package/dist/types/src/base/ui/system/typography/text_decoration.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/typography/text_transform.d.ts +0 -1
- package/dist/types/src/base/ui/system/typography/text_transform.d.ts.map +1 -1
- package/dist/types/src/base/ui/system/typography/typography_set.d.ts +0 -1
- package/dist/types/src/base/ui/system/typography/typography_set.d.ts.map +1 -1
- package/dist/types/src/base/ui/table_picker.d.ts +0 -21
- package/dist/types/src/base/ui/table_picker.d.ts.map +1 -1
- package/dist/types/src/base/ui/table_picker_synced.d.ts.map +1 -1
- package/dist/types/src/base/ui/text.d.ts +0 -3
- package/dist/types/src/base/ui/text.d.ts.map +1 -1
- package/dist/types/src/base/ui/text_button.d.ts +1 -5
- package/dist/types/src/base/ui/text_button.d.ts.map +1 -1
- package/dist/types/src/base/ui/theme/default_theme/index.d.ts +1 -1
- package/dist/types/src/base/ui/theme/theme_context.d.ts +1 -1
- package/dist/types/src/base/ui/theme/use_theme.d.ts +1 -1
- package/dist/types/src/base/ui/tooltip.d.ts +0 -16
- package/dist/types/src/base/ui/tooltip.d.ts.map +1 -1
- package/dist/types/src/base/ui/types/aria_props.d.ts.map +1 -1
- package/dist/types/src/base/ui/types/data_attributes_prop.d.ts +0 -4
- package/dist/types/src/base/ui/types/data_attributes_prop.d.ts.map +1 -1
- package/dist/types/src/base/ui/types/tooltip_anchor_props.d.ts +0 -7
- package/dist/types/src/base/ui/types/tooltip_anchor_props.d.ts.map +1 -1
- package/dist/types/src/base/ui/ui.d.ts +1 -0
- package/dist/types/src/base/ui/ui.d.ts.map +1 -1
- package/dist/types/src/base/ui/view_picker.d.ts +0 -23
- package/dist/types/src/base/ui/view_picker.d.ts.map +1 -1
- package/dist/types/src/base/ui/view_picker_synced.d.ts.map +1 -1
- package/dist/types/src/base/ui/viewport_constraint.d.ts +1 -14
- package/dist/types/src/base/ui/viewport_constraint.d.ts.map +1 -1
- package/dist/types/src/base/unstable_testing_utils.d.ts +1 -1
- package/dist/types/src/base/unstable_testing_utils.d.ts.map +1 -1
- package/dist/types/src/interface/assert_run_context.d.ts +2 -0
- package/dist/types/src/interface/assert_run_context.d.ts.map +1 -0
- package/dist/types/src/interface/index.d.ts +1 -6
- package/dist/types/src/interface/index.d.ts.map +1 -1
- package/dist/types/src/interface/models/models.d.ts +1 -0
- package/dist/types/src/interface/models/models.d.ts.map +1 -1
- package/dist/types/src/interface/models/mutations.d.ts.map +1 -1
- package/dist/types/src/interface/ui/initialize_block.d.ts.map +1 -1
- package/dist/types/src/interface/ui/ui.d.ts +1 -0
- package/dist/types/src/interface/ui/ui.d.ts.map +1 -1
- package/dist/types/src/interface/ui/use_custom_properties.d.ts +1 -1
- package/dist/types/src/shared/models/mutations_core.d.ts.map +1 -1
- package/dist/types/src/shared/private_utils.d.ts +0 -9
- package/dist/types/src/shared/private_utils.d.ts.map +1 -1
- package/dist/types/src/shared/ui/global_config_synced_component_helpers.d.ts +0 -2
- package/dist/types/src/shared/ui/global_config_synced_component_helpers.d.ts.map +1 -1
- package/dist/types/src/shared/ui/loader.d.ts.map +1 -1
- package/dist/types/src/shared/ui/with_hooks.d.ts +2 -2
- package/dist/types/src/shared/ui/with_hooks.d.ts.map +1 -1
- package/dist/types/src/testing/{abstract_mock_airtable_interface.d.ts → base/abstract_mock_airtable_interface.d.ts} +13 -13
- package/dist/types/src/testing/base/abstract_mock_airtable_interface.d.ts.map +1 -0
- package/dist/types/src/testing/interface/abstract_mock_airtable_interface.d.ts +51 -0
- package/dist/types/src/testing/interface/abstract_mock_airtable_interface.d.ts.map +1 -0
- package/package.json +13 -13
- package/dist/cjs/base/ui/system/utils/create_responsive_prop_type.js +0 -19
- package/dist/cjs/base/ui/system/utils/create_style_prop_types.js +0 -24
- package/dist/cjs/base/ui/system/utils/enum_prop_type_utils.js +0 -35
- package/dist/cjs/testing/abstract_mock_airtable_interface.js +0 -277
- package/dist/types/src/base/ui/system/utils/create_responsive_prop_type.d.ts +0 -2
- package/dist/types/src/base/ui/system/utils/create_responsive_prop_type.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/utils/create_style_prop_types.d.ts +0 -4
- package/dist/types/src/base/ui/system/utils/create_style_prop_types.d.ts.map +0 -1
- package/dist/types/src/base/ui/system/utils/enum_prop_type_utils.d.ts +0 -21
- package/dist/types/src/base/ui/system/utils/enum_prop_type_utils.d.ts.map +0 -1
- package/dist/types/src/testing/abstract_mock_airtable_interface.d.ts.map +0 -1
|
@@ -1,54 +1,26 @@
|
|
|
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.filter.js");
|
|
6
|
-
require("core-js/modules/es.array.from.js");
|
|
7
|
-
require("core-js/modules/es.array.iterator.js");
|
|
8
|
-
require("core-js/modules/es.array.slice.js");
|
|
9
|
-
require("core-js/modules/es.object.get-own-property-descriptors.js");
|
|
10
|
-
require("core-js/modules/es.object.to-string.js");
|
|
11
|
-
require("core-js/modules/es.regexp.exec.js");
|
|
12
|
-
require("core-js/modules/es.regexp.to-string.js");
|
|
13
|
-
require("core-js/modules/es.weak-map.js");
|
|
14
|
-
require("core-js/modules/web.dom-collections.for-each.js");
|
|
15
|
-
require("core-js/modules/web.dom-collections.iterator.js");
|
|
16
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
17
3
|
Object.defineProperty(exports, "__esModule", {
|
|
18
4
|
value: true
|
|
19
5
|
});
|
|
20
|
-
exports.
|
|
21
|
-
require("core-js/modules/es.number.constructor.js");
|
|
22
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
23
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
24
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
25
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
26
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
27
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
28
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
6
|
+
exports.default = exports.RecordCardList = void 0;
|
|
29
7
|
var React = _interopRequireWildcard(require("react"));
|
|
30
8
|
var _reactWindow = require("react-window");
|
|
31
9
|
var _core = require("@styled-system/core");
|
|
32
10
|
var _error_utils = require("../../shared/error_utils");
|
|
33
11
|
var _record = _interopRequireDefault(require("../models/record"));
|
|
34
|
-
var _field = _interopRequireDefault(require("../models/field"));
|
|
35
|
-
var _view = _interopRequireDefault(require("../models/view"));
|
|
36
12
|
var _box = _interopRequireDefault(require("./box"));
|
|
37
13
|
var _create_detect_element_resize = _interopRequireDefault(require("./create_detect_element_resize"));
|
|
38
14
|
var _with_styled_system = _interopRequireDefault(require("./with_styled_system"));
|
|
39
15
|
var _system = require("./system");
|
|
40
16
|
var _record_card = _interopRequireDefault(require("./record_card"));
|
|
41
|
-
function
|
|
17
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
18
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
42
19
|
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; }
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
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; } } }; }
|
|
48
|
-
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; } }
|
|
49
|
-
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: RecordCardList */ /** */
|
|
50
|
-
var RECORD_CARD_ROW_HEIGHT = 80;
|
|
51
|
-
var RECORD_CARD_SPACING = 10;
|
|
20
|
+
/** @module @airtable/blocks/ui: RecordCardList */ /** */
|
|
21
|
+
|
|
22
|
+
const RECORD_CARD_ROW_HEIGHT = 80;
|
|
23
|
+
const RECORD_CARD_SPACING = 10;
|
|
52
24
|
|
|
53
25
|
/** @internal */
|
|
54
26
|
|
|
@@ -62,36 +34,30 @@ var RECORD_CARD_SPACING = 10;
|
|
|
62
34
|
* @internal
|
|
63
35
|
*/
|
|
64
36
|
function RecordCardItemRenderer(props) {
|
|
65
|
-
|
|
66
|
-
records
|
|
67
|
-
fields
|
|
68
|
-
view
|
|
69
|
-
width
|
|
70
|
-
attachmentCoverField
|
|
71
|
-
onClick
|
|
72
|
-
onMouseEnter
|
|
73
|
-
onMouseLeave
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
37
|
+
const {
|
|
38
|
+
records,
|
|
39
|
+
fields,
|
|
40
|
+
view,
|
|
41
|
+
width,
|
|
42
|
+
attachmentCoverField,
|
|
43
|
+
onClick,
|
|
44
|
+
onMouseEnter,
|
|
45
|
+
onMouseLeave
|
|
46
|
+
} = props.data;
|
|
47
|
+
const {
|
|
48
|
+
index: itemIndex,
|
|
49
|
+
style,
|
|
50
|
+
className
|
|
51
|
+
} = props;
|
|
52
|
+
const record = records[itemIndex];
|
|
78
53
|
// Ensure that expandRecordOptions.records only contains Records, not RecordDefs. RecordCardList
|
|
79
54
|
// can be given either Records or RecordDefs, but the `opts` argument in `expandRecord` only
|
|
80
55
|
// accepts an array of Records.
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
86
|
-
var currentRecord = _step.value;
|
|
87
|
-
if (currentRecord instanceof _record.default) {
|
|
88
|
-
filteredRecords.push(currentRecord);
|
|
89
|
-
}
|
|
56
|
+
const filteredRecords = [];
|
|
57
|
+
for (const currentRecord of records) {
|
|
58
|
+
if (currentRecord instanceof _record.default) {
|
|
59
|
+
filteredRecords.push(currentRecord);
|
|
90
60
|
}
|
|
91
|
-
} catch (err) {
|
|
92
|
-
_iterator.e(err);
|
|
93
|
-
} finally {
|
|
94
|
-
_iterator.f();
|
|
95
61
|
}
|
|
96
62
|
if (filteredRecords.length !== records.length && filteredRecords.length !== 0) {
|
|
97
63
|
throw (0, _error_utils.spawnError)("RecordCardList's props.records should not contain a mix of Record and RecordDef");
|
|
@@ -99,7 +65,7 @@ function RecordCardItemRenderer(props) {
|
|
|
99
65
|
|
|
100
66
|
// RecordCard handles null and undefined differently for `onClick`. Treat other
|
|
101
67
|
// falsey values (e.g. "", false) like null.
|
|
102
|
-
|
|
68
|
+
let _onClick;
|
|
103
69
|
if (onClick) {
|
|
104
70
|
_onClick = () => onClick(record, itemIndex);
|
|
105
71
|
} else if (onClick === undefined) {
|
|
@@ -124,29 +90,13 @@ function RecordCardItemRenderer(props) {
|
|
|
124
90
|
// Adjustments to top and left made to properly position the cards in the list. FixedSizeList doesn't
|
|
125
91
|
// differentiate between content & gutter for each "item" it renders. See https://github.com/bvaughn/react-window#can-i-add-gutter-or-padding-between-items
|
|
126
92
|
,
|
|
127
|
-
style:
|
|
93
|
+
style: {
|
|
94
|
+
...style,
|
|
128
95
|
left: Number(style.left) + RECORD_CARD_SPACING,
|
|
129
96
|
top: Number(style.top) + RECORD_CARD_SPACING
|
|
130
|
-
}
|
|
97
|
+
}
|
|
131
98
|
});
|
|
132
99
|
}
|
|
133
|
-
RecordCardItemRenderer.propTypes = {
|
|
134
|
-
data: _propTypes.default.shape({
|
|
135
|
-
records: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(_record.default), _propTypes.default.object])).isRequired,
|
|
136
|
-
fields: _propTypes.default.arrayOf(_propTypes.default.instanceOf(_field.default)),
|
|
137
|
-
view: _propTypes.default.instanceOf(_view.default),
|
|
138
|
-
attachmentCoverField: _propTypes.default.instanceOf(_field.default),
|
|
139
|
-
onClick: _propTypes.default.func,
|
|
140
|
-
onMouseEnter: _propTypes.default.func,
|
|
141
|
-
onMouseLeave: _propTypes.default.func,
|
|
142
|
-
width: _propTypes.default.number.isRequired,
|
|
143
|
-
className: _propTypes.default.string,
|
|
144
|
-
style: _propTypes.default.object
|
|
145
|
-
}),
|
|
146
|
-
index: _propTypes.default.number.isRequired,
|
|
147
|
-
style: _propTypes.default.object,
|
|
148
|
-
className: _propTypes.default.string
|
|
149
|
-
};
|
|
150
100
|
|
|
151
101
|
/**
|
|
152
102
|
* Utility function to measure scrollbar size.
|
|
@@ -155,16 +105,16 @@ RecordCardItemRenderer.propTypes = {
|
|
|
155
105
|
* @internal
|
|
156
106
|
*/
|
|
157
107
|
function getScrollbarWidth() {
|
|
158
|
-
|
|
108
|
+
const scrollDiv = document.createElement('div');
|
|
159
109
|
scrollDiv.style.position = 'absolute';
|
|
160
110
|
scrollDiv.style.top = '-9999px';
|
|
161
111
|
scrollDiv.style.width = '50px';
|
|
162
112
|
scrollDiv.style.height = '50px';
|
|
163
113
|
scrollDiv.style.overflow = 'scroll';
|
|
164
|
-
|
|
114
|
+
const body = document.body;
|
|
165
115
|
(0, _error_utils.invariant)(body, 'no document body to measure scrollbar');
|
|
166
116
|
body.appendChild(scrollDiv);
|
|
167
|
-
|
|
117
|
+
const scrollbarWidth = scrollDiv.offsetWidth - scrollDiv.clientWidth;
|
|
168
118
|
body.removeChild(scrollDiv);
|
|
169
119
|
return scrollbarWidth;
|
|
170
120
|
}
|
|
@@ -183,17 +133,20 @@ function getScrollbarWidth() {
|
|
|
183
133
|
*
|
|
184
134
|
* @internal
|
|
185
135
|
*/
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
136
|
+
const innerRecordCardListWindow = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
137
|
+
const {
|
|
138
|
+
style,
|
|
139
|
+
children
|
|
140
|
+
} = props;
|
|
189
141
|
return /*#__PURE__*/React.createElement("div", {
|
|
190
142
|
ref: ref
|
|
191
143
|
// Height adjustment required to account for the spacing between the last item and the bottom of the list container.
|
|
192
144
|
// See https://github.com/bvaughn/react-window#can-i-add-padding-to-the-top-and-bottom-of-a-list
|
|
193
145
|
,
|
|
194
|
-
style:
|
|
146
|
+
style: {
|
|
147
|
+
...style,
|
|
195
148
|
height: Number(style.height) + RECORD_CARD_SPACING
|
|
196
|
-
}
|
|
149
|
+
}
|
|
197
150
|
}, children);
|
|
198
151
|
});
|
|
199
152
|
|
|
@@ -220,10 +173,10 @@ var innerRecordCardListWindow = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
|
220
173
|
* @noInheritDoc
|
|
221
174
|
*/
|
|
222
175
|
|
|
223
|
-
|
|
224
|
-
var recordCardListStylePropTypes = exports.recordCardListStylePropTypes = _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, _system.dimensionsSetPropTypes), _system.flexItemSetPropTypes), _system.positionSetPropTypes), _system.marginPropTypes);
|
|
176
|
+
const styleParser = (0, _core.compose)(_system.dimensionsSet, _system.flexItemSet, _system.positionSet, _system.margin);
|
|
225
177
|
|
|
226
178
|
/** @hidden */
|
|
179
|
+
|
|
227
180
|
/**
|
|
228
181
|
* Scrollable list of record cards.
|
|
229
182
|
*
|
|
@@ -232,146 +185,119 @@ var recordCardListStylePropTypes = exports.recordCardListStylePropTypes = _objec
|
|
|
232
185
|
* @docsPath UI/components/RecordCardList
|
|
233
186
|
* @component
|
|
234
187
|
*/
|
|
235
|
-
|
|
188
|
+
class RecordCardList extends React.Component {
|
|
189
|
+
/** @internal */
|
|
190
|
+
|
|
191
|
+
/** @internal */
|
|
192
|
+
|
|
193
|
+
/** @internal */
|
|
194
|
+
|
|
195
|
+
/** @internal */
|
|
196
|
+
|
|
197
|
+
/** @internal */
|
|
198
|
+
|
|
236
199
|
/** @hidden */
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
(0,
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
/** @internal */
|
|
246
|
-
(0, _defineProperty2.default)(_this, "_cardListInnerWindow", void 0);
|
|
247
|
-
/** @internal */
|
|
248
|
-
(0, _defineProperty2.default)(_this, "_detectElementResize", void 0);
|
|
249
|
-
/** @internal */
|
|
250
|
-
(0, _defineProperty2.default)(_this, "_scrollbarWidth", void 0);
|
|
251
|
-
/** @internal */
|
|
252
|
-
(0, _defineProperty2.default)(_this, "_updateCardListSizeIfNeeded", () => {
|
|
253
|
-
(0, _error_utils.invariant)(_this._container.current, 'No container to update card list size');
|
|
254
|
-
var _this$_container$curr = _this._container.current.getBoundingClientRect(),
|
|
255
|
-
cardListWidth = _this$_container$curr.width,
|
|
256
|
-
cardListHeight = _this$_container$curr.height;
|
|
257
|
-
(0, _error_utils.invariant)(_this._cardListInnerWindow.current, 'No card list inner window to measure scroll height');
|
|
258
|
-
var isScrollbarVisible = _this._cardListInnerWindow.current.scrollHeight > cardListHeight;
|
|
259
|
-
if (_this.state.cardListWidth !== cardListWidth || _this.state.cardListHeight !== cardListHeight || _this.state.isScrollbarVisible !== isScrollbarVisible) {
|
|
260
|
-
_this.setState({
|
|
261
|
-
cardListWidth,
|
|
262
|
-
cardListHeight,
|
|
263
|
-
isScrollbarVisible
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
});
|
|
267
|
-
_this._container = /*#__PURE__*/React.createRef();
|
|
268
|
-
_this._cardList = /*#__PURE__*/React.createRef();
|
|
269
|
-
_this._cardListInnerWindow = /*#__PURE__*/React.createRef();
|
|
270
|
-
_this._detectElementResize = (0, _create_detect_element_resize.default)();
|
|
271
|
-
_this._scrollbarWidth = getScrollbarWidth();
|
|
272
|
-
_this.state = {
|
|
200
|
+
constructor(props) {
|
|
201
|
+
super(props);
|
|
202
|
+
this._container = /*#__PURE__*/React.createRef();
|
|
203
|
+
this._cardList = /*#__PURE__*/React.createRef();
|
|
204
|
+
this._cardListInnerWindow = /*#__PURE__*/React.createRef();
|
|
205
|
+
this._detectElementResize = (0, _create_detect_element_resize.default)();
|
|
206
|
+
this._scrollbarWidth = getScrollbarWidth();
|
|
207
|
+
this.state = {
|
|
273
208
|
cardListWidth: 0,
|
|
274
209
|
cardListHeight: 0,
|
|
275
210
|
isScrollbarVisible: false
|
|
276
211
|
};
|
|
277
|
-
return _this;
|
|
278
212
|
}
|
|
279
213
|
/** @hidden */
|
|
280
|
-
(
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
}, {
|
|
290
|
-
key: "componentWillUnmount",
|
|
291
|
-
value: function componentWillUnmount() {
|
|
292
|
-
if (this._container.current) {
|
|
293
|
-
this._detectElementResize.removeResizeListener(this._container.current, this._updateCardListSizeIfNeeded);
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
/** @hidden */
|
|
297
|
-
}, {
|
|
298
|
-
key: "componentDidUpdate",
|
|
299
|
-
value: function componentDidUpdate(prevProps) {
|
|
300
|
-
// If the number of records change, we may need to adjust card widths if a scrollbar
|
|
301
|
-
// now exists (or no longer exists)
|
|
302
|
-
if (this.props.records.length !== prevProps.records.length) {
|
|
303
|
-
this._updateCardListSizeIfNeeded();
|
|
304
|
-
}
|
|
214
|
+
componentDidMount() {
|
|
215
|
+
(0, _error_utils.invariant)(this._container.current, 'No container to detect resize on');
|
|
216
|
+
this._detectElementResize.addResizeListener(this._container.current, this._updateCardListSizeIfNeeded);
|
|
217
|
+
this._updateCardListSizeIfNeeded();
|
|
218
|
+
}
|
|
219
|
+
/** @hidden */
|
|
220
|
+
componentWillUnmount() {
|
|
221
|
+
if (this._container.current) {
|
|
222
|
+
this._detectElementResize.removeResizeListener(this._container.current, this._updateCardListSizeIfNeeded);
|
|
305
223
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
(0, _error_utils.invariant)(this._cardList.current, 'No card list to scroll');
|
|
314
|
-
this._cardList.current.scrollToItem(recordIndex);
|
|
224
|
+
}
|
|
225
|
+
/** @hidden */
|
|
226
|
+
componentDidUpdate(prevProps) {
|
|
227
|
+
// If the number of records change, we may need to adjust card widths if a scrollbar
|
|
228
|
+
// now exists (or no longer exists)
|
|
229
|
+
if (this.props.records.length !== prevProps.records.length) {
|
|
230
|
+
this._updateCardListSizeIfNeeded();
|
|
315
231
|
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
};
|
|
340
|
-
return /*#__PURE__*/React.createElement(_box.default, {
|
|
341
|
-
ref: this._container,
|
|
342
|
-
className: className,
|
|
343
|
-
overflow: "hidden",
|
|
344
|
-
height: "100%",
|
|
345
|
-
style: style
|
|
346
|
-
}, /*#__PURE__*/React.createElement(_reactWindow.FixedSizeList, {
|
|
347
|
-
outerRef: this._cardList,
|
|
348
|
-
width: this.state.cardListWidth,
|
|
349
|
-
height: this.state.cardListHeight,
|
|
350
|
-
innerElementType: innerRecordCardListWindow,
|
|
351
|
-
innerRef: this._cardListInnerWindow,
|
|
352
|
-
itemData: itemData,
|
|
353
|
-
itemCount: this.props.records.length,
|
|
354
|
-
itemKey: (index, data) => data.records[index].id,
|
|
355
|
-
itemSize: RECORD_CARD_ROW_HEIGHT + RECORD_CARD_SPACING,
|
|
356
|
-
onScroll: this.props.onScroll
|
|
357
|
-
},
|
|
358
|
-
// TODO(alex): figure out why this needs a cast to any - something to do with prop-types?
|
|
359
|
-
RecordCardItemRenderer));
|
|
232
|
+
}
|
|
233
|
+
// Functionality for `getScrollTopForRecordAtIndex` and `scrollTop` getter/setter was
|
|
234
|
+
// removed when migrating from DynamicDraw => react-window, which were not being used
|
|
235
|
+
// by any consuming component at the time of migration.
|
|
236
|
+
/** @hidden */
|
|
237
|
+
scrollToRecordAtIndex(recordIndex) {
|
|
238
|
+
(0, _error_utils.invariant)(this._cardList.current, 'No card list to scroll');
|
|
239
|
+
this._cardList.current.scrollToItem(recordIndex);
|
|
240
|
+
}
|
|
241
|
+
/** @internal */
|
|
242
|
+
_updateCardListSizeIfNeeded = () => {
|
|
243
|
+
(0, _error_utils.invariant)(this._container.current, 'No container to update card list size');
|
|
244
|
+
const {
|
|
245
|
+
width: cardListWidth,
|
|
246
|
+
height: cardListHeight
|
|
247
|
+
} = this._container.current.getBoundingClientRect();
|
|
248
|
+
(0, _error_utils.invariant)(this._cardListInnerWindow.current, 'No card list inner window to measure scroll height');
|
|
249
|
+
const isScrollbarVisible = this._cardListInnerWindow.current.scrollHeight > cardListHeight;
|
|
250
|
+
if (this.state.cardListWidth !== cardListWidth || this.state.cardListHeight !== cardListHeight || this.state.isScrollbarVisible !== isScrollbarVisible) {
|
|
251
|
+
this.setState({
|
|
252
|
+
cardListWidth,
|
|
253
|
+
cardListHeight,
|
|
254
|
+
isScrollbarVisible
|
|
255
|
+
});
|
|
360
256
|
}
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
257
|
+
};
|
|
258
|
+
/** @hidden */
|
|
259
|
+
render() {
|
|
260
|
+
const {
|
|
261
|
+
records,
|
|
262
|
+
fields,
|
|
263
|
+
view,
|
|
264
|
+
attachmentCoverField,
|
|
265
|
+
className,
|
|
266
|
+
style
|
|
267
|
+
} = this.props;
|
|
268
|
+
const itemData = {
|
|
269
|
+
records,
|
|
270
|
+
fields,
|
|
271
|
+
view,
|
|
272
|
+
width: this.state.cardListWidth - 2 * RECORD_CARD_SPACING - (this.state.isScrollbarVisible ? this._scrollbarWidth : 0),
|
|
273
|
+
attachmentCoverField,
|
|
274
|
+
onClick: this.props.onRecordClick,
|
|
275
|
+
onMouseEnter: this.props.onRecordMouseEnter ?? null,
|
|
276
|
+
onMouseLeave: this.props.onRecordMouseLeave ?? null,
|
|
277
|
+
style: {},
|
|
278
|
+
className: ''
|
|
279
|
+
};
|
|
280
|
+
return /*#__PURE__*/React.createElement(_box.default, {
|
|
281
|
+
ref: this._container,
|
|
282
|
+
className: className,
|
|
283
|
+
overflow: "hidden",
|
|
284
|
+
height: "100%",
|
|
285
|
+
style: style
|
|
286
|
+
}, /*#__PURE__*/React.createElement(_reactWindow.FixedSizeList, {
|
|
287
|
+
outerRef: this._cardList,
|
|
288
|
+
width: this.state.cardListWidth,
|
|
289
|
+
height: this.state.cardListHeight,
|
|
290
|
+
innerElementType: innerRecordCardListWindow,
|
|
291
|
+
innerRef: this._cardListInnerWindow,
|
|
292
|
+
itemData: itemData,
|
|
293
|
+
itemCount: this.props.records.length,
|
|
294
|
+
itemKey: (index, data) => data.records[index].id,
|
|
295
|
+
itemSize: RECORD_CARD_ROW_HEIGHT + RECORD_CARD_SPACING,
|
|
296
|
+
onScroll: this.props.onScroll
|
|
297
|
+
},
|
|
298
|
+
// TODO(alex): figure out why this needs a cast to any - something to do with prop-types?
|
|
299
|
+
RecordCardItemRenderer));
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
exports.RecordCardList = RecordCardList;
|
|
303
|
+
var _default = exports.default = (0, _with_styled_system.default)(RecordCardList, styleParser);
|