@airtable/blocks 1.18.1 → 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 +6 -1
- 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,82 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
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.object.get-own-property-descriptors.js");
|
|
8
|
+
require("core-js/modules/es.regexp.exec.js");
|
|
9
|
+
require("core-js/modules/es.regexp.to-string.js");
|
|
10
|
+
require("core-js/modules/es.weak-map.js");
|
|
11
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
5
12
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.symbol");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.symbol.description");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.array.concat");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/es.array.filter");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/es.array.iterator");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/es.array.map");
|
|
18
|
-
|
|
19
|
-
require("core-js/modules/es.object.get-own-property-descriptors");
|
|
20
|
-
|
|
21
|
-
require("core-js/modules/es.object.to-string");
|
|
22
|
-
|
|
23
|
-
require("core-js/modules/es.promise");
|
|
24
|
-
|
|
25
|
-
require("core-js/modules/es.set");
|
|
26
|
-
|
|
27
|
-
require("core-js/modules/es.string.starts-with");
|
|
28
|
-
|
|
29
|
-
require("core-js/modules/web.dom-collections.for-each");
|
|
30
|
-
|
|
31
|
-
require("core-js/modules/web.dom-collections.iterator");
|
|
32
|
-
|
|
33
13
|
Object.defineProperty(exports, "__esModule", {
|
|
34
14
|
value: true
|
|
35
15
|
});
|
|
36
16
|
exports.default = void 0;
|
|
37
|
-
|
|
38
17
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
39
|
-
|
|
40
|
-
require("
|
|
41
|
-
|
|
18
|
+
require("core-js/modules/es.array.concat.js");
|
|
19
|
+
require("core-js/modules/es.array.filter.js");
|
|
20
|
+
require("core-js/modules/es.array.iterator.js");
|
|
21
|
+
require("core-js/modules/es.array.map.js");
|
|
22
|
+
require("core-js/modules/es.object.to-string.js");
|
|
23
|
+
require("core-js/modules/es.promise.js");
|
|
24
|
+
require("core-js/modules/es.set.js");
|
|
25
|
+
require("core-js/modules/es.string.starts-with.js");
|
|
26
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
27
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
42
28
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
43
|
-
|
|
44
29
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
45
|
-
|
|
46
30
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
47
|
-
|
|
48
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
49
|
-
|
|
50
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
51
|
-
|
|
52
31
|
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
53
|
-
|
|
32
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
54
33
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
55
|
-
|
|
56
34
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
57
|
-
|
|
58
35
|
var _private_utils = require("../private_utils");
|
|
59
|
-
|
|
60
36
|
var _error_utils = require("../error_utils");
|
|
61
|
-
|
|
62
37
|
var _table = _interopRequireWildcard(require("./table"));
|
|
63
|
-
|
|
64
38
|
var _record_query_result = _interopRequireDefault(require("./record_query_result"));
|
|
65
|
-
|
|
66
39
|
var _record_coloring = require("./record_coloring");
|
|
67
|
-
|
|
68
40
|
var _object_pool = _interopRequireDefault(require("./object_pool"));
|
|
69
|
-
|
|
70
41
|
var _record_store = require("./record_store");
|
|
71
|
-
|
|
72
42
|
var _view_data_store = _interopRequireWildcard(require("./view_data_store"));
|
|
73
|
-
|
|
74
43
|
var _grouped_record_query_result = _interopRequireDefault(require("./grouped_record_query_result"));
|
|
75
|
-
|
|
76
|
-
function
|
|
77
|
-
|
|
78
|
-
function _objectSpread(
|
|
79
|
-
|
|
44
|
+
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); }
|
|
45
|
+
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; }
|
|
46
|
+
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; }
|
|
47
|
+
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; }
|
|
48
|
+
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; } } }; }
|
|
49
|
+
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; } }
|
|
50
|
+
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; }
|
|
51
|
+
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); }
|
|
52
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /** @module @airtable/blocks/models: RecordQueryResult */ /** */
|
|
53
|
+
/** @hidden */
|
|
80
54
|
/**
|
|
81
55
|
* Represents a set of records directly from a view or table. See {@link RecordQueryResult} for main
|
|
82
56
|
* documentation.
|
|
@@ -86,84 +60,64 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
86
60
|
*
|
|
87
61
|
* @docsPath models/query results/TableOrViewQueryResult
|
|
88
62
|
*/
|
|
89
|
-
var TableOrViewQueryResult =
|
|
90
|
-
/*#__PURE__*/
|
|
91
|
-
function (_RecordQueryResult) {
|
|
92
|
-
(0, _inherits2.default)(TableOrViewQueryResult, _RecordQueryResult);
|
|
93
|
-
|
|
94
|
-
/** @internal */
|
|
95
|
-
|
|
96
|
-
/** @internal */
|
|
97
|
-
|
|
98
|
-
/** @internal */
|
|
99
|
-
|
|
100
|
-
/** @internal */
|
|
101
|
-
|
|
102
|
-
/** @internal */
|
|
103
|
-
// If custom sorts or groups are specified, we'll use a VisList to handle sorting.
|
|
104
|
-
// If no sorts are specified, we'll use the underlying row order of the source model.
|
|
105
|
-
// Note: we're currently handling visibility tracking for view query results within this class,
|
|
106
|
-
// not in the VisList. In other words, only visible records are added to the visList.
|
|
107
|
-
|
|
108
|
-
/** @internal */
|
|
109
|
-
|
|
110
|
-
/** @internal */
|
|
111
|
-
// These is the groupLevels provided to us by the user when executing a query
|
|
112
|
-
|
|
113
|
-
/** @internal */
|
|
114
|
-
// This is the ordered list of record ids.
|
|
115
|
-
|
|
116
|
-
/** @internal */
|
|
117
|
-
// This is the ordered list of groups.
|
|
118
|
-
|
|
119
|
-
/** @internal */
|
|
120
|
-
// An ordered list of group levels returned to us from hyperbase, this should not be
|
|
121
|
-
// read from directly, but instead via this.data.groupLevels (Writing to this on hyperbase updates).
|
|
122
|
-
// (which check's that this model has not been not deleted)
|
|
123
|
-
|
|
124
|
-
/** @internal */
|
|
125
|
-
// lazily generated set of record ids
|
|
126
|
-
|
|
127
|
-
/** @internal */
|
|
128
|
-
// NOTE: when a cellValue key (cellValues or cellValuesInField:) is watched, we want
|
|
129
|
-
// to make sure we watch the associated key on the table. However, we need to make
|
|
130
|
-
// sure that we only watch the table once for each key. Otherwise, the callbacks
|
|
131
|
-
// for each key will get called more than once for each change event. This is because
|
|
132
|
-
// Watchable stores references to callbacks for each key, and on each _onChange event
|
|
133
|
-
// calls each callback for that key. If we watch the table more than once, then we'll
|
|
134
|
-
// call _onChange more than once, and each callback will be called more than once, which
|
|
135
|
-
// is undesirable. Instead, we'll store watch counts for each key to make sure we only
|
|
136
|
-
// watch the table once.
|
|
137
|
-
|
|
138
|
-
/** @internal */
|
|
139
|
-
|
|
140
|
-
/** @internal */
|
|
141
|
-
|
|
63
|
+
var TableOrViewQueryResult = /*#__PURE__*/function (_RecordQueryResult) {
|
|
142
64
|
/** @internal */
|
|
143
65
|
function TableOrViewQueryResult(sdk, sourceModel, normalizedOpts) {
|
|
144
66
|
var _this;
|
|
145
|
-
|
|
146
67
|
(0, _classCallCheck2.default)(this, TableOrViewQueryResult);
|
|
147
|
-
_this = (
|
|
148
|
-
|
|
149
|
-
(0, _defineProperty2.default)(
|
|
150
|
-
|
|
151
|
-
(0, _defineProperty2.default)(
|
|
152
|
-
|
|
153
|
-
(0, _defineProperty2.default)(
|
|
154
|
-
|
|
155
|
-
(0, _defineProperty2.default)(
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
68
|
+
_this = _callSuper(this, TableOrViewQueryResult, [sdk, normalizedOpts]);
|
|
69
|
+
/** @internal */
|
|
70
|
+
(0, _defineProperty2.default)(_this, "_sourceModel", void 0);
|
|
71
|
+
/** @internal */
|
|
72
|
+
(0, _defineProperty2.default)(_this, "_mostRecentSourceModelLoadPromise", void 0);
|
|
73
|
+
/** @internal */
|
|
74
|
+
(0, _defineProperty2.default)(_this, "_table", void 0);
|
|
75
|
+
/** @internal */
|
|
76
|
+
(0, _defineProperty2.default)(_this, "_fieldIdsSetToLoadOrNullIfAllFields", void 0);
|
|
77
|
+
// If custom sorts or groups are specified, we'll use a VisList to handle sorting.
|
|
78
|
+
// If no sorts are specified, we'll use the underlying row order of the source model.
|
|
79
|
+
// Note: we're currently handling visibility tracking for view query results within this class,
|
|
80
|
+
// not in the VisList. In other words, only visible records are added to the visList.
|
|
81
|
+
/** @internal */
|
|
82
|
+
(0, _defineProperty2.default)(_this, "_visList", void 0);
|
|
83
|
+
/** @internal */
|
|
84
|
+
(0, _defineProperty2.default)(_this, "_sorts", void 0);
|
|
85
|
+
// These is the groupLevels provided to us by the user when executing a query
|
|
86
|
+
/** @internal */
|
|
87
|
+
(0, _defineProperty2.default)(_this, "_groupLevels", void 0);
|
|
88
|
+
// This is the ordered list of record ids.
|
|
89
|
+
/** @internal */
|
|
90
|
+
(0, _defineProperty2.default)(_this, "_orderedRecordIds", void 0);
|
|
91
|
+
// This is the ordered list of groups.
|
|
92
|
+
/** @internal */
|
|
93
|
+
(0, _defineProperty2.default)(_this, "_orderedGroups", void 0);
|
|
94
|
+
// An ordered list of group levels returned to us from hyperbase, this should not be
|
|
95
|
+
// read from directly, but instead via this.data.groupLevels (Writing to this on hyperbase updates).
|
|
96
|
+
// (which check's that this model has not been not deleted)
|
|
97
|
+
/** @internal */
|
|
98
|
+
(0, _defineProperty2.default)(_this, "_loadedGroupLevels", void 0);
|
|
99
|
+
// lazily generated set of record ids
|
|
100
|
+
/** @internal */
|
|
101
|
+
(0, _defineProperty2.default)(_this, "_recordIdsSet", null);
|
|
102
|
+
// NOTE: when a cellValue key (cellValues or cellValuesInField:) is watched, we want
|
|
103
|
+
// to make sure we watch the associated key on the table. However, we need to make
|
|
104
|
+
// sure that we only watch the table once for each key. Otherwise, the callbacks
|
|
105
|
+
// for each key will get called more than once for each change event. This is because
|
|
106
|
+
// Watchable stores references to callbacks for each key, and on each _onChange event
|
|
107
|
+
// calls each callback for that key. If we watch the table more than once, then we'll
|
|
108
|
+
// call _onChange more than once, and each callback will be called more than once, which
|
|
109
|
+
// is undesirable. Instead, we'll store watch counts for each key to make sure we only
|
|
110
|
+
// watch the table once.
|
|
111
|
+
/** @internal */
|
|
112
|
+
(0, _defineProperty2.default)(_this, "_cellValueKeyWatchCounts", void 0);
|
|
113
|
+
/** @internal */
|
|
114
|
+
(0, _defineProperty2.default)(_this, "__groupedRecordQueryResultPool", void 0);
|
|
161
115
|
_this._sourceModel = sourceModel;
|
|
162
116
|
_this._mostRecentSourceModelLoadPromise = null;
|
|
163
117
|
_this._table = normalizedOpts.table;
|
|
164
118
|
var sorts = _this._normalizedOpts.sorts;
|
|
165
|
-
_this._sorts = sorts !== null && sorts !== void 0 ? sorts : null;
|
|
166
|
-
|
|
119
|
+
_this._sorts = sorts !== null && sorts !== void 0 ? sorts : null;
|
|
120
|
+
// TODO (SeanKeenan): Placeholder until we support groups from normalizedOpts
|
|
167
121
|
_this._groupLevels = null;
|
|
168
122
|
_this._visList = null;
|
|
169
123
|
_this._orderedRecordIds = null;
|
|
@@ -171,60 +125,37 @@ function (_RecordQueryResult) {
|
|
|
171
125
|
_this._loadedGroupLevels = null;
|
|
172
126
|
_this._cellValueKeyWatchCounts = {};
|
|
173
127
|
var fieldIdsSetToLoadOrNullIfAllFields = null;
|
|
174
|
-
|
|
175
128
|
if (_this._normalizedOpts.fieldIdsOrNullIfAllFields) {
|
|
176
129
|
fieldIdsSetToLoadOrNullIfAllFields = {};
|
|
177
|
-
var
|
|
178
|
-
|
|
179
|
-
var _iteratorError = undefined;
|
|
180
|
-
|
|
130
|
+
var _iterator = _createForOfIteratorHelper(_this._normalizedOpts.fieldIdsOrNullIfAllFields),
|
|
131
|
+
_step;
|
|
181
132
|
try {
|
|
182
|
-
for (
|
|
133
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
183
134
|
var fieldId = _step.value;
|
|
184
135
|
fieldIdsSetToLoadOrNullIfAllFields[fieldId] = true;
|
|
185
|
-
}
|
|
136
|
+
}
|
|
137
|
+
// Need to load data for fields we're sorting by, even if
|
|
186
138
|
// they're not explicitly requested in the `fields` opt.
|
|
187
|
-
|
|
188
139
|
} catch (err) {
|
|
189
|
-
|
|
190
|
-
_iteratorError = err;
|
|
140
|
+
_iterator.e(err);
|
|
191
141
|
} finally {
|
|
192
|
-
|
|
193
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
194
|
-
_iterator.return();
|
|
195
|
-
}
|
|
196
|
-
} finally {
|
|
197
|
-
if (_didIteratorError) {
|
|
198
|
-
throw _iteratorError;
|
|
199
|
-
}
|
|
200
|
-
}
|
|
142
|
+
_iterator.f();
|
|
201
143
|
}
|
|
202
|
-
|
|
203
144
|
if (_this._sorts !== null) {
|
|
204
|
-
var
|
|
205
|
-
|
|
206
|
-
var _iteratorError2 = undefined;
|
|
207
|
-
|
|
145
|
+
var _iterator2 = _createForOfIteratorHelper(_this._sorts),
|
|
146
|
+
_step2;
|
|
208
147
|
try {
|
|
209
|
-
for (
|
|
148
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
210
149
|
var sort = _step2.value;
|
|
211
150
|
fieldIdsSetToLoadOrNullIfAllFields[sort.fieldId] = true;
|
|
212
151
|
}
|
|
213
152
|
} catch (err) {
|
|
214
|
-
|
|
215
|
-
_iteratorError2 = err;
|
|
153
|
+
_iterator2.e(err);
|
|
216
154
|
} finally {
|
|
217
|
-
|
|
218
|
-
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
219
|
-
_iterator2.return();
|
|
220
|
-
}
|
|
221
|
-
} finally {
|
|
222
|
-
if (_didIteratorError2) {
|
|
223
|
-
throw _iteratorError2;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
155
|
+
_iterator2.f();
|
|
226
156
|
}
|
|
227
|
-
}
|
|
157
|
+
}
|
|
158
|
+
// TODO (SeanKeenan): Comment back in when enabling groups
|
|
228
159
|
// Same for group configs
|
|
229
160
|
// if (this._groupLevels !== null) {
|
|
230
161
|
// for (const group of this._groupLevels) {
|
|
@@ -232,61 +163,137 @@ function (_RecordQueryResult) {
|
|
|
232
163
|
// }
|
|
233
164
|
// }
|
|
234
165
|
|
|
235
|
-
|
|
236
166
|
var recordColorMode = _this._normalizedOpts.recordColorMode;
|
|
237
|
-
|
|
238
167
|
if (recordColorMode && recordColorMode.type === _record_coloring.ModeTypes.BY_SELECT_FIELD) {
|
|
239
168
|
fieldIdsSetToLoadOrNullIfAllFields[recordColorMode.selectField.id] = true;
|
|
240
169
|
}
|
|
241
170
|
}
|
|
242
|
-
|
|
243
171
|
_this._fieldIdsSetToLoadOrNullIfAllFields = fieldIdsSetToLoadOrNullIfAllFields;
|
|
244
172
|
_this.__groupedRecordQueryResultPool = new _object_pool.default(_grouped_record_query_result.default);
|
|
245
|
-
Object.seal(
|
|
173
|
+
Object.seal(_this);
|
|
246
174
|
return _this;
|
|
247
175
|
}
|
|
248
176
|
/** @internal */
|
|
177
|
+
(0, _inherits2.default)(TableOrViewQueryResult, _RecordQueryResult);
|
|
178
|
+
return (0, _createClass2.default)(TableOrViewQueryResult, [{
|
|
179
|
+
key: "_dataOrNullIfDeleted",
|
|
180
|
+
get: function get() {
|
|
181
|
+
if (this._sourceModel.isDeleted || this._recordStore.isDeleted) {
|
|
182
|
+
return null;
|
|
183
|
+
}
|
|
184
|
+
return {
|
|
185
|
+
recordIds: this._orderedRecordIds,
|
|
186
|
+
groups: this._orderedGroups,
|
|
187
|
+
groupLevels: this._loadedGroupLevels
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
/** @internal */
|
|
191
|
+
// istanbul ignore next
|
|
192
|
+
}, {
|
|
193
|
+
key: "__sourceModelId",
|
|
194
|
+
get: function get() {
|
|
195
|
+
return this._sourceModel.id;
|
|
196
|
+
}
|
|
249
197
|
|
|
198
|
+
/** @internal */
|
|
199
|
+
}, {
|
|
200
|
+
key: "__poolKey",
|
|
201
|
+
get: function get() {
|
|
202
|
+
return "".concat(this._serializedOpts, "::").concat(this._sourceModel.id);
|
|
203
|
+
}
|
|
250
204
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
205
|
+
/**
|
|
206
|
+
* @internal (since we may not be able to return parent model instances in the immutable models world)
|
|
207
|
+
* The table that records in this RecordQueryResult are part of
|
|
208
|
+
*/
|
|
209
|
+
}, {
|
|
210
|
+
key: "parentTable",
|
|
211
|
+
get: function get() {
|
|
212
|
+
return this._table;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* @internal (since we may not be able to return parent model instances in the immutable models world)
|
|
216
|
+
* The view that was used to obtain this RecordQueryResult by calling
|
|
217
|
+
* `view.selectRecords`. Null if the RecordQueryResult was obtained by calling
|
|
218
|
+
* `table.selectRecords`.
|
|
219
|
+
*/
|
|
220
|
+
}, {
|
|
221
|
+
key: "parentView",
|
|
222
|
+
get: function get() {
|
|
223
|
+
return this._sourceModel instanceof _table.default ? null : this._sourceModel;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* The record IDs in this RecordQueryResult.
|
|
227
|
+
* Throws if data is not loaded yet.
|
|
228
|
+
* Can be watched.
|
|
229
|
+
*/
|
|
230
|
+
}, {
|
|
231
|
+
key: "recordIds",
|
|
232
|
+
get: function get() {
|
|
233
|
+
// The following statements have been carefully sequenced to ensure
|
|
234
|
+
// that when this method fails, it reports the most salient error.
|
|
235
|
+
var recordIds = this._data.recordIds; // Throws when the model has been deleted.
|
|
236
|
+
(0, _error_utils.invariant)(this.isDataLoaded, 'RecordQueryResult data is not loaded');
|
|
237
|
+
(0, _error_utils.invariant)(recordIds, 'No recordIds');
|
|
238
|
+
return recordIds;
|
|
239
|
+
}
|
|
240
|
+
/**
|
|
241
|
+
* The ordered GroupedRecordQueryResult's in this RecordQueryResult.
|
|
242
|
+
* Throws if data is not loaded yet.
|
|
243
|
+
* Can be watched.
|
|
244
|
+
*
|
|
245
|
+
* @hidden
|
|
246
|
+
*/
|
|
247
|
+
}, {
|
|
248
|
+
key: "groups",
|
|
249
|
+
get: function get() {
|
|
250
|
+
// The following statements have been carefully sequenced to ensure
|
|
251
|
+
// that when this method fails, it reports the most salient error.
|
|
252
|
+
var groups = this._data.groups; // Throws when the model has been deleted.
|
|
253
|
+
(0, _error_utils.invariant)(this.isDataLoaded, 'RecordQueryResult data is not loaded');
|
|
254
|
+
return groups !== null && groups !== void 0 ? groups : null;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* The GroupLevels in this RecordQueryResult.
|
|
258
|
+
* Throws if data is not loaded yet.
|
|
259
|
+
* Can be watched.
|
|
260
|
+
*
|
|
261
|
+
* @hidden
|
|
262
|
+
*/
|
|
263
|
+
}, {
|
|
264
|
+
key: "groupLevels",
|
|
265
|
+
get: function get() {
|
|
266
|
+
var groupLevels = this._data.groupLevels; // Throws when the model has been deleted.
|
|
267
|
+
(0, _error_utils.invariant)(this.isDataLoaded, 'RecordQueryResult data is not loaded');
|
|
268
|
+
return groupLevels ? groupLevels.map(singleLevel => _objectSpread(_objectSpread({}, singleLevel), {}, {
|
|
269
|
+
field: this.parentTable.getFieldById(singleLevel.fieldId)
|
|
270
|
+
})) : null;
|
|
271
|
+
}
|
|
254
272
|
/**
|
|
255
273
|
* The set of record IDs in this RecordQueryResult.
|
|
256
274
|
* Throws if data is not loaded yet.
|
|
257
275
|
*
|
|
258
276
|
* @internal
|
|
259
277
|
*/
|
|
278
|
+
}, {
|
|
279
|
+
key: "_getOrGenerateRecordIdsSet",
|
|
260
280
|
value: function _getOrGenerateRecordIdsSet() {
|
|
261
281
|
if (!this._recordIdsSet) {
|
|
262
282
|
var recordIdsSet = {};
|
|
263
|
-
var
|
|
264
|
-
|
|
265
|
-
var _iteratorError3 = undefined;
|
|
266
|
-
|
|
283
|
+
var _iterator3 = _createForOfIteratorHelper(this.recordIds),
|
|
284
|
+
_step3;
|
|
267
285
|
try {
|
|
268
|
-
for (
|
|
286
|
+
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
269
287
|
var recordId = _step3.value;
|
|
270
288
|
recordIdsSet[recordId] = true;
|
|
271
289
|
}
|
|
272
290
|
} catch (err) {
|
|
273
|
-
|
|
274
|
-
_iteratorError3 = err;
|
|
291
|
+
_iterator3.e(err);
|
|
275
292
|
} finally {
|
|
276
|
-
|
|
277
|
-
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
|
278
|
-
_iterator3.return();
|
|
279
|
-
}
|
|
280
|
-
} finally {
|
|
281
|
-
if (_didIteratorError3) {
|
|
282
|
-
throw _iteratorError3;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
293
|
+
_iterator3.f();
|
|
285
294
|
}
|
|
286
|
-
|
|
287
295
|
this._recordIdsSet = recordIdsSet;
|
|
288
296
|
}
|
|
289
|
-
|
|
290
297
|
return this._recordIdsSet;
|
|
291
298
|
}
|
|
292
299
|
/**
|
|
@@ -294,22 +301,85 @@ function (_RecordQueryResult) {
|
|
|
294
301
|
* Null if fields were not specified, which means the RecordQueryResult
|
|
295
302
|
* will load all fields in the table.
|
|
296
303
|
*/
|
|
297
|
-
|
|
298
304
|
}, {
|
|
299
|
-
key: "
|
|
300
|
-
|
|
305
|
+
key: "fields",
|
|
306
|
+
get: function get() {
|
|
307
|
+
var fieldIdsOrNullIfAllFields = this._normalizedOpts.fieldIdsOrNullIfAllFields;
|
|
308
|
+
if (fieldIdsOrNullIfAllFields) {
|
|
309
|
+
var fields = [];
|
|
310
|
+
// Filter out any deleted fields, since RecordQueryResult is "live".
|
|
311
|
+
// It would be too cumbersome (and defeat part of the purpose of
|
|
312
|
+
// using RecordQueryResult) if the user had to manually watch for deletion
|
|
313
|
+
// on all the fields and recreate the RecordQueryResult.
|
|
314
|
+
var _iterator4 = _createForOfIteratorHelper(fieldIdsOrNullIfAllFields),
|
|
315
|
+
_step4;
|
|
316
|
+
try {
|
|
317
|
+
for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
|
|
318
|
+
var fieldId = _step4.value;
|
|
319
|
+
var field = this._table.getFieldByIdIfExists(fieldId);
|
|
320
|
+
if (field !== null) {
|
|
321
|
+
fields.push(field);
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
} catch (err) {
|
|
325
|
+
_iterator4.e(err);
|
|
326
|
+
} finally {
|
|
327
|
+
_iterator4.f();
|
|
328
|
+
}
|
|
329
|
+
return fields;
|
|
330
|
+
} else {
|
|
331
|
+
return null;
|
|
332
|
+
}
|
|
333
|
+
}
|
|
301
334
|
/** @internal */
|
|
335
|
+
}, {
|
|
336
|
+
key: "_cellValuesForSortWatchKeys",
|
|
337
|
+
get: function get() {
|
|
338
|
+
return this._sorts ? this._sorts.map(sort => "cellValuesInField:".concat(sort.fieldId)) : [];
|
|
339
|
+
}
|
|
340
|
+
/** @internal */
|
|
341
|
+
}, {
|
|
342
|
+
key: "_cellValuesForGroupWatchKeys",
|
|
343
|
+
get: function get() {
|
|
344
|
+
// _groupLevels can not be specified by the user during the query yet
|
|
345
|
+
// istanbul ignore next
|
|
346
|
+
return this._groupLevels ? this._groupLevels.map(group => "cellValuesInField:".concat(group.fieldId)) : [];
|
|
347
|
+
}
|
|
348
|
+
/** @internal */
|
|
349
|
+
}, {
|
|
350
|
+
key: "_sourceModelRecordIds",
|
|
351
|
+
get: function get() {
|
|
352
|
+
return this._sourceModel instanceof _table.default ? this._recordStore.recordIds : this._recordStore.getViewDataStore(this._sourceModel.id).visibleRecordIds;
|
|
353
|
+
}
|
|
354
|
+
/** @internal */
|
|
355
|
+
}, {
|
|
356
|
+
key: "_sourceModelGroups",
|
|
357
|
+
get: function get() {
|
|
358
|
+
return this._sourceModel instanceof _table.default ? null : this._recordStore.getViewDataStore(this._sourceModel.id).groups;
|
|
359
|
+
}
|
|
360
|
+
/** @internal */
|
|
361
|
+
}, {
|
|
362
|
+
key: "_sourceModelGroupLevels",
|
|
363
|
+
get: function get() {
|
|
364
|
+
return this._sourceModel instanceof _table.default ? null : this._recordStore.getViewDataStore(this._sourceModel.id).groupLevels;
|
|
365
|
+
}
|
|
366
|
+
/** @internal */
|
|
367
|
+
}, {
|
|
368
|
+
key: "_sourceModelRecords",
|
|
369
|
+
get: function get() {
|
|
370
|
+
return this._sourceModel instanceof _table.default ? this._recordStore.records : this._recordStore.getViewDataStore(this._sourceModel.id).visibleRecords;
|
|
371
|
+
}
|
|
372
|
+
/** @internal */
|
|
373
|
+
}, {
|
|
374
|
+
key: "_incrementCellValueKeyWatchCountAndWatchIfNecessary",
|
|
302
375
|
value: function _incrementCellValueKeyWatchCountAndWatchIfNecessary(key, watchCallback) {
|
|
303
376
|
if (!this._cellValueKeyWatchCounts[key]) {
|
|
304
377
|
this._cellValueKeyWatchCounts[key] = 0;
|
|
305
|
-
|
|
306
378
|
this._recordStore.watch(key, watchCallback, this);
|
|
307
379
|
}
|
|
308
|
-
|
|
309
380
|
this._cellValueKeyWatchCounts[key]++;
|
|
310
381
|
}
|
|
311
382
|
/** @internal */
|
|
312
|
-
|
|
313
383
|
}, {
|
|
314
384
|
key: "_decrementCellValueKeyWatchCountAndUnwatchIfPossible",
|
|
315
385
|
value: function _decrementCellValueKeyWatchCountAndUnwatchIfPossible(key, watchCallback) {
|
|
@@ -318,133 +388,93 @@ function (_RecordQueryResult) {
|
|
|
318
388
|
// where calling unwatch on a key that isn't watched just no-ops.
|
|
319
389
|
return;
|
|
320
390
|
}
|
|
321
|
-
|
|
322
391
|
this._cellValueKeyWatchCounts[key]--;
|
|
323
|
-
|
|
324
392
|
if (this._cellValueKeyWatchCounts[key] === 0) {
|
|
325
393
|
// We're down to zero watches for this key, so we can actually unwatch it now.
|
|
326
394
|
this._recordStore.unwatch(key, watchCallback, this);
|
|
327
|
-
|
|
328
395
|
delete this._cellValueKeyWatchCounts[key];
|
|
329
396
|
}
|
|
330
397
|
}
|
|
331
398
|
/** @inheritdoc */
|
|
332
|
-
|
|
333
399
|
}, {
|
|
334
400
|
key: "watch",
|
|
335
401
|
value: function watch(keys, callback, context) {
|
|
336
402
|
var validKeys = (0, _get2.default)((0, _getPrototypeOf2.default)(TableOrViewQueryResult.prototype), "watch", this).call(this, keys, callback, context);
|
|
337
|
-
var
|
|
338
|
-
|
|
339
|
-
var _iteratorError4 = undefined;
|
|
340
|
-
|
|
403
|
+
var _iterator5 = _createForOfIteratorHelper(validKeys),
|
|
404
|
+
_step5;
|
|
341
405
|
try {
|
|
342
|
-
for (
|
|
343
|
-
var
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
var fieldId = _key2.substring(_record_query_result.default.WatchableCellValuesInFieldKeyPrefix.length);
|
|
347
|
-
|
|
406
|
+
for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
|
|
407
|
+
var key = _step5.value;
|
|
408
|
+
if (key.startsWith(_record_query_result.default.WatchableCellValuesInFieldKeyPrefix)) {
|
|
409
|
+
var fieldId = key.substring(_record_query_result.default.WatchableCellValuesInFieldKeyPrefix.length);
|
|
348
410
|
if (this._fieldIdsSetToLoadOrNullIfAllFields && !(0, _private_utils.has)(this._fieldIdsSetToLoadOrNullIfAllFields, fieldId)) {
|
|
349
411
|
throw (0, _error_utils.spawnError)("Can't watch field because it wasn't included in RecordQueryResult fields: %s", fieldId);
|
|
350
412
|
}
|
|
351
|
-
|
|
352
|
-
this._incrementCellValueKeyWatchCountAndWatchIfNecessary(_key2, this._onCellValuesInFieldChanged);
|
|
413
|
+
this._incrementCellValueKeyWatchCountAndWatchIfNecessary(key, this._onCellValuesInFieldChanged);
|
|
353
414
|
}
|
|
354
|
-
|
|
355
|
-
if (_key2 === _record_query_result.default.WatchableKeys.cellValues) {
|
|
415
|
+
if (key === _record_query_result.default.WatchableKeys.cellValues) {
|
|
356
416
|
if (this._fieldIdsSetToLoadOrNullIfAllFields) {
|
|
357
417
|
for (var _i = 0, _Object$keys = Object.keys(this._fieldIdsSetToLoadOrNullIfAllFields); _i < _Object$keys.length; _i++) {
|
|
358
418
|
var _fieldId = _Object$keys[_i];
|
|
359
|
-
|
|
360
419
|
this._incrementCellValueKeyWatchCountAndWatchIfNecessary(_record_query_result.default.WatchableCellValuesInFieldKeyPrefix + _fieldId, this._onCellValuesChanged);
|
|
361
420
|
}
|
|
362
421
|
} else {
|
|
363
|
-
this._incrementCellValueKeyWatchCountAndWatchIfNecessary(
|
|
422
|
+
this._incrementCellValueKeyWatchCountAndWatchIfNecessary(key, this._onCellValuesChanged);
|
|
364
423
|
}
|
|
365
424
|
}
|
|
366
425
|
}
|
|
367
426
|
} catch (err) {
|
|
368
|
-
|
|
369
|
-
_iteratorError4 = err;
|
|
427
|
+
_iterator5.e(err);
|
|
370
428
|
} finally {
|
|
371
|
-
|
|
372
|
-
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
|
|
373
|
-
_iterator4.return();
|
|
374
|
-
}
|
|
375
|
-
} finally {
|
|
376
|
-
if (_didIteratorError4) {
|
|
377
|
-
throw _iteratorError4;
|
|
378
|
-
}
|
|
379
|
-
}
|
|
429
|
+
_iterator5.f();
|
|
380
430
|
}
|
|
381
|
-
|
|
382
431
|
return validKeys;
|
|
383
432
|
}
|
|
384
433
|
/** @inheritdoc */
|
|
385
|
-
|
|
386
434
|
}, {
|
|
387
435
|
key: "unwatch",
|
|
388
436
|
value: function unwatch(keys, callback, context) {
|
|
389
437
|
var validKeys = (0, _get2.default)((0, _getPrototypeOf2.default)(TableOrViewQueryResult.prototype), "unwatch", this).call(this, keys, callback, context);
|
|
390
|
-
var
|
|
391
|
-
|
|
392
|
-
var _iteratorError5 = undefined;
|
|
393
|
-
|
|
438
|
+
var _iterator6 = _createForOfIteratorHelper(validKeys),
|
|
439
|
+
_step6;
|
|
394
440
|
try {
|
|
395
|
-
for (
|
|
396
|
-
var
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
this._decrementCellValueKeyWatchCountAndUnwatchIfPossible(_key3, this._onCellValuesInFieldChanged);
|
|
441
|
+
for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
|
|
442
|
+
var key = _step6.value;
|
|
443
|
+
if (key.startsWith(_record_query_result.default.WatchableCellValuesInFieldKeyPrefix)) {
|
|
444
|
+
this._decrementCellValueKeyWatchCountAndUnwatchIfPossible(key, this._onCellValuesInFieldChanged);
|
|
400
445
|
}
|
|
401
|
-
|
|
402
|
-
if (_key3 === _record_query_result.default.WatchableKeys.cellValues) {
|
|
446
|
+
if (key === _record_query_result.default.WatchableKeys.cellValues) {
|
|
403
447
|
if (this._fieldIdsSetToLoadOrNullIfAllFields) {
|
|
404
448
|
for (var _i2 = 0, _Object$keys2 = Object.keys(this._fieldIdsSetToLoadOrNullIfAllFields); _i2 < _Object$keys2.length; _i2++) {
|
|
405
449
|
var fieldId = _Object$keys2[_i2];
|
|
406
|
-
|
|
407
450
|
this._decrementCellValueKeyWatchCountAndUnwatchIfPossible(_record_query_result.default.WatchableCellValuesInFieldKeyPrefix + fieldId, this._onCellValuesChanged);
|
|
408
451
|
}
|
|
409
452
|
} else {
|
|
410
|
-
this._decrementCellValueKeyWatchCountAndUnwatchIfPossible(
|
|
453
|
+
this._decrementCellValueKeyWatchCountAndUnwatchIfPossible(key, this._onCellValuesChanged);
|
|
411
454
|
}
|
|
412
455
|
}
|
|
413
456
|
}
|
|
414
457
|
} catch (err) {
|
|
415
|
-
|
|
416
|
-
_iteratorError5 = err;
|
|
458
|
+
_iterator6.e(err);
|
|
417
459
|
} finally {
|
|
418
|
-
|
|
419
|
-
if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
|
|
420
|
-
_iterator5.return();
|
|
421
|
-
}
|
|
422
|
-
} finally {
|
|
423
|
-
if (_didIteratorError5) {
|
|
424
|
-
throw _iteratorError5;
|
|
425
|
-
}
|
|
426
|
-
}
|
|
460
|
+
_iterator6.f();
|
|
427
461
|
}
|
|
428
|
-
|
|
429
462
|
return validKeys;
|
|
430
463
|
}
|
|
431
464
|
/** @inheritdoc */
|
|
432
|
-
|
|
433
465
|
}, {
|
|
434
466
|
key: "loadDataAsync",
|
|
435
|
-
value: function
|
|
436
|
-
var
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
switch (_context.prev = _context.next) {
|
|
467
|
+
value: (function () {
|
|
468
|
+
var _loadDataAsync2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
469
|
+
var sourceModelLoadPromise, cellValuesInFieldsLoadPromise;
|
|
470
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
471
|
+
while (1) switch (_context.prev = _context.next) {
|
|
440
472
|
case 0:
|
|
441
473
|
if (!this._sourceModel.isDeleted) {
|
|
442
474
|
_context.next = 2;
|
|
443
475
|
break;
|
|
444
476
|
}
|
|
445
|
-
|
|
446
477
|
throw this._spawnErrorForDeletion();
|
|
447
|
-
|
|
448
478
|
case 2:
|
|
449
479
|
if (this._fieldIdsSetToLoadOrNullIfAllFields) {
|
|
450
480
|
cellValuesInFieldsLoadPromise = this._recordStore.loadCellValuesInFieldIdsAsync(Object.keys(this._fieldIdsSetToLoadOrNullIfAllFields));
|
|
@@ -452,7 +482,6 @@ function (_RecordQueryResult) {
|
|
|
452
482
|
// Load all fields.
|
|
453
483
|
cellValuesInFieldsLoadPromise = this._recordStore.loadDataAsync();
|
|
454
484
|
}
|
|
455
|
-
|
|
456
485
|
if (this._sourceModel instanceof _table.default) {
|
|
457
486
|
if (this._fieldIdsSetToLoadOrNullIfAllFields) {
|
|
458
487
|
sourceModelLoadPromise = this._recordStore.loadRecordMetadataAsync();
|
|
@@ -464,82 +493,65 @@ function (_RecordQueryResult) {
|
|
|
464
493
|
} else {
|
|
465
494
|
sourceModelLoadPromise = this._recordStore.getViewDataStore(this._sourceModel.id).loadDataAsync();
|
|
466
495
|
}
|
|
467
|
-
|
|
468
496
|
this._mostRecentSourceModelLoadPromise = Promise.all([sourceModelLoadPromise, cellValuesInFieldsLoadPromise, this._loadRecordColorsAsync()]);
|
|
469
497
|
_context.next = 7;
|
|
470
|
-
return
|
|
471
|
-
|
|
498
|
+
return (0, _get2.default)((0, _getPrototypeOf2.default)(TableOrViewQueryResult.prototype), "loadDataAsync", this).call(this);
|
|
472
499
|
case 7:
|
|
473
500
|
case "end":
|
|
474
501
|
return _context.stop();
|
|
475
502
|
}
|
|
476
|
-
}
|
|
477
|
-
}
|
|
478
|
-
|
|
503
|
+
}, _callee, this);
|
|
504
|
+
}));
|
|
505
|
+
function loadDataAsync() {
|
|
506
|
+
return _loadDataAsync2.apply(this, arguments);
|
|
507
|
+
}
|
|
508
|
+
return loadDataAsync;
|
|
509
|
+
}()
|
|
479
510
|
/**
|
|
480
511
|
* @internal
|
|
481
512
|
*/
|
|
482
|
-
|
|
513
|
+
)
|
|
483
514
|
}, {
|
|
484
515
|
key: "_getChangedKeysOnLoad",
|
|
485
516
|
value: function _getChangedKeysOnLoad() {
|
|
486
517
|
var changedKeys = [_record_query_result.default.WatchableKeys.records, _record_query_result.default.WatchableKeys.recordIds, _record_query_result.default.WatchableKeys.cellValues, _record_query_result.default.WatchableKeys.groups, _record_query_result.default.WatchableKeys.groupLevels];
|
|
487
|
-
|
|
488
518
|
var fieldIds = this._normalizedOpts.fieldIdsOrNullIfAllFields || this._table.fields.map(field => field.id);
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
var _didIteratorError6 = false;
|
|
492
|
-
var _iteratorError6 = undefined;
|
|
493
|
-
|
|
519
|
+
var _iterator7 = _createForOfIteratorHelper(fieldIds),
|
|
520
|
+
_step7;
|
|
494
521
|
try {
|
|
495
|
-
for (
|
|
496
|
-
var fieldId =
|
|
522
|
+
for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
|
|
523
|
+
var fieldId = _step7.value;
|
|
497
524
|
changedKeys.push(_record_query_result.default.WatchableCellValuesInFieldKeyPrefix + fieldId);
|
|
498
525
|
}
|
|
499
526
|
} catch (err) {
|
|
500
|
-
|
|
501
|
-
_iteratorError6 = err;
|
|
527
|
+
_iterator7.e(err);
|
|
502
528
|
} finally {
|
|
503
|
-
|
|
504
|
-
if (!_iteratorNormalCompletion6 && _iterator6.return != null) {
|
|
505
|
-
_iterator6.return();
|
|
506
|
-
}
|
|
507
|
-
} finally {
|
|
508
|
-
if (_didIteratorError6) {
|
|
509
|
-
throw _iteratorError6;
|
|
510
|
-
}
|
|
511
|
-
}
|
|
529
|
+
_iterator7.f();
|
|
512
530
|
}
|
|
513
|
-
|
|
514
531
|
return changedKeys;
|
|
515
532
|
}
|
|
516
|
-
/** @internal */
|
|
517
533
|
|
|
534
|
+
/** @internal */
|
|
518
535
|
}, {
|
|
519
536
|
key: "_loadDataAsync",
|
|
520
|
-
value: function
|
|
521
|
-
var
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
switch (_context2.prev = _context2.next) {
|
|
537
|
+
value: (function () {
|
|
538
|
+
var _loadDataAsync3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
539
|
+
var viewDataStore, _iterator8, _step8, sort, field;
|
|
540
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
541
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
526
542
|
case 0:
|
|
527
543
|
this._table.__tableOrViewQueryResultPool.registerObjectForReuseStrong(this);
|
|
528
|
-
|
|
529
544
|
(0, _error_utils.invariant)(this._mostRecentSourceModelLoadPromise, 'No source model load promises');
|
|
530
545
|
_context2.next = 4;
|
|
531
|
-
return
|
|
532
|
-
|
|
546
|
+
return this._mostRecentSourceModelLoadPromise;
|
|
533
547
|
case 4:
|
|
534
548
|
if (this._sorts) {
|
|
535
549
|
this._replaceVisList();
|
|
536
550
|
}
|
|
537
|
-
|
|
538
551
|
this._orderedRecordIds = this._generateOrderedRecordIds();
|
|
539
|
-
this._orderedGroups = this._generateAndLoadOrderedGroups();
|
|
540
|
-
|
|
552
|
+
this._orderedGroups = this._generateAndLoadOrderedGroups();
|
|
553
|
+
// The server provided value and developer supplied value are the same, no conversion needed
|
|
541
554
|
this._loadedGroupLevels = this._sourceModelGroupLevels;
|
|
542
|
-
|
|
543
555
|
if (this._sourceModel instanceof _table.default) {
|
|
544
556
|
this._recordStore.watch(_record_store.WatchableRecordStoreKeys.records, this._onRecordsChanged, this);
|
|
545
557
|
} else {
|
|
@@ -548,83 +560,42 @@ function (_RecordQueryResult) {
|
|
|
548
560
|
viewDataStore.watch(_view_data_store.WatchableViewDataStoreKeys.groups, this._onGroupsChanged, this);
|
|
549
561
|
viewDataStore.watch(_view_data_store.WatchableViewDataStoreKeys.groupLevels, this._onGroupLevelsChanged, this);
|
|
550
562
|
}
|
|
551
|
-
|
|
552
563
|
this._recordStore.watch(this._cellValuesForSortWatchKeys, this._onCellValuesForSortChanged, this);
|
|
553
|
-
|
|
554
564
|
this._recordStore.watch(this._cellValuesForGroupWatchKeys, this._onCellValuesForGroupChanged, this);
|
|
555
|
-
|
|
556
565
|
this._table.watch(_table.WatchableTableKeys.fields, this._onTableFieldsChanged, this);
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
if (field) {
|
|
573
|
-
field.watch('type', this._onFieldConfigChanged, this);
|
|
574
|
-
field.watch('options', this._onFieldConfigChanged, this);
|
|
566
|
+
if (this._sorts) {
|
|
567
|
+
_iterator8 = _createForOfIteratorHelper(this._sorts);
|
|
568
|
+
try {
|
|
569
|
+
for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
|
|
570
|
+
sort = _step8.value;
|
|
571
|
+
field = this._table.getFieldByIdIfExists(sort.fieldId);
|
|
572
|
+
if (field) {
|
|
573
|
+
field.watch('type', this._onFieldConfigChanged, this);
|
|
574
|
+
field.watch('options', this._onFieldConfigChanged, this);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
} catch (err) {
|
|
578
|
+
_iterator8.e(err);
|
|
579
|
+
} finally {
|
|
580
|
+
_iterator8.f();
|
|
575
581
|
}
|
|
576
582
|
}
|
|
577
|
-
|
|
578
|
-
_context2.next = 24;
|
|
579
|
-
break;
|
|
580
|
-
|
|
581
|
-
case 20:
|
|
582
|
-
_context2.prev = 20;
|
|
583
|
-
_context2.t0 = _context2["catch"](16);
|
|
584
|
-
_didIteratorError7 = true;
|
|
585
|
-
_iteratorError7 = _context2.t0;
|
|
586
|
-
|
|
587
|
-
case 24:
|
|
588
|
-
_context2.prev = 24;
|
|
589
|
-
_context2.prev = 25;
|
|
590
|
-
|
|
591
|
-
if (!_iteratorNormalCompletion7 && _iterator7.return != null) {
|
|
592
|
-
_iterator7.return();
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
case 27:
|
|
596
|
-
_context2.prev = 27;
|
|
597
|
-
|
|
598
|
-
if (!_didIteratorError7) {
|
|
599
|
-
_context2.next = 30;
|
|
600
|
-
break;
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
throw _iteratorError7;
|
|
604
|
-
|
|
605
|
-
case 30:
|
|
606
|
-
return _context2.finish(27);
|
|
607
|
-
|
|
608
|
-
case 31:
|
|
609
|
-
return _context2.finish(24);
|
|
610
|
-
|
|
611
|
-
case 32:
|
|
612
583
|
return _context2.abrupt("return", this._getChangedKeysOnLoad());
|
|
613
|
-
|
|
614
|
-
case 33:
|
|
584
|
+
case 14:
|
|
615
585
|
case "end":
|
|
616
586
|
return _context2.stop();
|
|
617
587
|
}
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
588
|
+
}, _callee2, this);
|
|
589
|
+
}));
|
|
590
|
+
function _loadDataAsync() {
|
|
591
|
+
return _loadDataAsync3.apply(this, arguments);
|
|
592
|
+
}
|
|
593
|
+
return _loadDataAsync;
|
|
594
|
+
}() /** @inheritdoc */)
|
|
623
595
|
}, {
|
|
624
596
|
key: "unloadData",
|
|
625
597
|
value: function unloadData() {
|
|
626
598
|
(0, _get2.default)((0, _getPrototypeOf2.default)(TableOrViewQueryResult.prototype), "unloadData", this).call(this);
|
|
627
|
-
|
|
628
599
|
if (this._sourceModel instanceof _table.default) {
|
|
629
600
|
if (this._fieldIdsSetToLoadOrNullIfAllFields) {
|
|
630
601
|
this._recordStore.unloadRecordMetadata();
|
|
@@ -637,134 +608,91 @@ function (_RecordQueryResult) {
|
|
|
637
608
|
this._recordStore.getViewDataStore(this._sourceModel.id).unloadData();
|
|
638
609
|
}
|
|
639
610
|
}
|
|
640
|
-
|
|
641
611
|
if (this._fieldIdsSetToLoadOrNullIfAllFields) {
|
|
642
612
|
this._recordStore.unloadCellValuesInFieldIds(Object.keys(this._fieldIdsSetToLoadOrNullIfAllFields));
|
|
643
613
|
}
|
|
644
|
-
|
|
645
614
|
this._unloadRecordColors();
|
|
646
615
|
}
|
|
647
616
|
/** @internal */
|
|
648
|
-
|
|
649
617
|
}, {
|
|
650
618
|
key: "_unloadData",
|
|
651
619
|
value: function _unloadData() {
|
|
652
620
|
this._mostRecentSourceModelLoadPromise = null;
|
|
653
|
-
|
|
654
621
|
if (this._sourceModel instanceof _table.default) {
|
|
655
622
|
this._recordStore.unwatch(_record_store.WatchableRecordStoreKeys.records, this._onRecordsChanged, this);
|
|
656
623
|
} else {
|
|
657
624
|
if (!this._sourceModel.isDeleted) {
|
|
658
625
|
var viewDataStore = this._recordStore.getViewDataStore(this._sourceModel.id);
|
|
659
|
-
|
|
660
626
|
viewDataStore.unwatch(_view_data_store.WatchableViewDataStoreKeys.visibleRecords, this._onRecordsChanged, this);
|
|
661
627
|
viewDataStore.unwatch(_view_data_store.WatchableViewDataStoreKeys.groups, this._onGroupsChanged, this);
|
|
662
628
|
viewDataStore.unwatch(_view_data_store.WatchableViewDataStoreKeys.groupLevels, this._onGroupLevelsChanged, this);
|
|
663
629
|
}
|
|
664
630
|
}
|
|
665
|
-
|
|
666
631
|
this._recordStore.unwatch(this._cellValuesForSortWatchKeys, this._onCellValuesForSortChanged, this);
|
|
667
|
-
|
|
668
632
|
this._recordStore.unwatch(this._cellValuesForGroupWatchKeys, this._onCellValuesForGroupChanged, this);
|
|
633
|
+
this._table.unwatch(_table.WatchableTableKeys.fields, this._onTableFieldsChanged, this);
|
|
669
634
|
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
635
|
+
// If the table is deleted, can't call getFieldById on it below.
|
|
673
636
|
if (!this._table.isDeleted && this._sorts) {
|
|
674
|
-
var
|
|
675
|
-
|
|
676
|
-
var _iteratorError8 = undefined;
|
|
677
|
-
|
|
637
|
+
var _iterator9 = _createForOfIteratorHelper(this._sorts),
|
|
638
|
+
_step9;
|
|
678
639
|
try {
|
|
679
|
-
for (
|
|
680
|
-
var sort =
|
|
681
|
-
|
|
640
|
+
for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
|
|
641
|
+
var sort = _step9.value;
|
|
682
642
|
var field = this._table.getFieldByIdIfExists(sort.fieldId);
|
|
683
|
-
|
|
684
643
|
if (field) {
|
|
685
644
|
field.unwatch('type', this._onFieldConfigChanged, this);
|
|
686
645
|
field.unwatch('options', this._onFieldConfigChanged, this);
|
|
687
646
|
}
|
|
688
647
|
}
|
|
689
648
|
} catch (err) {
|
|
690
|
-
|
|
691
|
-
_iteratorError8 = err;
|
|
649
|
+
_iterator9.e(err);
|
|
692
650
|
} finally {
|
|
693
|
-
|
|
694
|
-
if (!_iteratorNormalCompletion8 && _iterator8.return != null) {
|
|
695
|
-
_iterator8.return();
|
|
696
|
-
}
|
|
697
|
-
} finally {
|
|
698
|
-
if (_didIteratorError8) {
|
|
699
|
-
throw _iteratorError8;
|
|
700
|
-
}
|
|
701
|
-
}
|
|
651
|
+
_iterator9.f();
|
|
702
652
|
}
|
|
703
653
|
}
|
|
704
|
-
|
|
705
654
|
this._unloadOrderedGroupsIfNeeded();
|
|
706
|
-
|
|
707
655
|
this._visList = null;
|
|
708
656
|
this._orderedRecordIds = null;
|
|
709
657
|
this._recordIdsSet = null;
|
|
710
|
-
|
|
711
658
|
this._table.__tableOrViewQueryResultPool.unregisterObjectForReuseStrong(this);
|
|
712
659
|
}
|
|
713
660
|
/** @internal */
|
|
714
|
-
|
|
715
661
|
}, {
|
|
716
662
|
key: "_addRecordIdsToVisList",
|
|
717
663
|
value: function _addRecordIdsToVisList(recordIds) {
|
|
718
664
|
var visList = this._visList;
|
|
719
665
|
(0, _error_utils.invariant)(visList, 'No vis list');
|
|
720
|
-
var
|
|
721
|
-
|
|
722
|
-
var _iteratorError9 = undefined;
|
|
723
|
-
|
|
666
|
+
var _iterator10 = _createForOfIteratorHelper(recordIds),
|
|
667
|
+
_step10;
|
|
724
668
|
try {
|
|
725
|
-
for (
|
|
726
|
-
var recordId =
|
|
727
|
-
|
|
669
|
+
for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
|
|
670
|
+
var recordId = _step10.value;
|
|
728
671
|
var record = this._recordStore.getRecordByIdIfExists(recordId);
|
|
729
|
-
|
|
730
672
|
(0, _error_utils.invariant)(record, 'Record missing in table');
|
|
731
673
|
visList.addRecordData(record._data);
|
|
732
674
|
}
|
|
733
675
|
} catch (err) {
|
|
734
|
-
|
|
735
|
-
_iteratorError9 = err;
|
|
676
|
+
_iterator10.e(err);
|
|
736
677
|
} finally {
|
|
737
|
-
|
|
738
|
-
if (!_iteratorNormalCompletion9 && _iterator9.return != null) {
|
|
739
|
-
_iterator9.return();
|
|
740
|
-
}
|
|
741
|
-
} finally {
|
|
742
|
-
if (_didIteratorError9) {
|
|
743
|
-
throw _iteratorError9;
|
|
744
|
-
}
|
|
745
|
-
}
|
|
678
|
+
_iterator10.f();
|
|
746
679
|
}
|
|
747
680
|
}
|
|
748
681
|
/** @internal */
|
|
749
|
-
|
|
750
682
|
}, {
|
|
751
683
|
key: "_onGroupLevelsChanged",
|
|
752
684
|
value: function _onGroupLevelsChanged(model, key, updates) {
|
|
753
685
|
this._loadedGroupLevels = this._sourceModelGroupLevels;
|
|
754
|
-
|
|
755
686
|
this._unloadRemovedGroupsAndLoadNewGroupsAndTriggerWatches();
|
|
756
|
-
|
|
757
687
|
this._onChange(_record_query_result.default.WatchableKeys.groupLevels);
|
|
758
688
|
}
|
|
759
689
|
/** @internal */
|
|
760
|
-
|
|
761
690
|
}, {
|
|
762
691
|
key: "_onGroupsChanged",
|
|
763
692
|
value: function _onGroupsChanged(model, key, updates) {
|
|
764
693
|
this._unloadRemovedGroupsAndLoadNewGroupsAndTriggerWatches();
|
|
765
694
|
}
|
|
766
695
|
/** @internal */
|
|
767
|
-
|
|
768
696
|
}, {
|
|
769
697
|
key: "_onRecordsChanged",
|
|
770
698
|
value: function _onRecordsChanged(model, key, updates) {
|
|
@@ -773,113 +701,77 @@ function (_RecordQueryResult) {
|
|
|
773
701
|
// so we need to manually generate updates based on the old and new
|
|
774
702
|
// recordIds.
|
|
775
703
|
(0, _error_utils.invariant)(this._orderedRecordIds, '_orderedRecordIds unset');
|
|
776
|
-
|
|
777
704
|
var visibleRecordIds = this._recordStore.getViewDataStore(model.viewId).visibleRecordIds;
|
|
778
|
-
|
|
779
705
|
var _addedRecordIds = (0, _private_utils.arrayDifference)(visibleRecordIds, this._orderedRecordIds);
|
|
780
|
-
|
|
781
706
|
var _removedRecordIds = (0, _private_utils.arrayDifference)(this._orderedRecordIds, visibleRecordIds);
|
|
782
|
-
|
|
783
707
|
updates = {
|
|
784
708
|
addedRecordIds: _addedRecordIds,
|
|
785
709
|
removedRecordIds: _removedRecordIds
|
|
786
710
|
};
|
|
787
711
|
}
|
|
788
|
-
|
|
789
712
|
if (!updates) {
|
|
790
713
|
// If there are no updates, do nothing, since we'll handle the initial
|
|
791
714
|
// callback when the record set is loaded (and we don't want to fire
|
|
792
715
|
// a records change twice with no data).
|
|
793
716
|
return;
|
|
794
717
|
}
|
|
795
|
-
|
|
796
718
|
var _updates = updates,
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
719
|
+
addedRecordIds = _updates.addedRecordIds,
|
|
720
|
+
removedRecordIds = _updates.removedRecordIds;
|
|
800
721
|
if (this._sorts) {
|
|
801
722
|
var visList = this._visList;
|
|
802
723
|
(0, _error_utils.invariant)(visList, 'No vis list');
|
|
803
|
-
|
|
804
724
|
if (removedRecordIds.length > 0) {
|
|
805
725
|
visList.removeRecordIds(removedRecordIds);
|
|
806
726
|
}
|
|
807
|
-
|
|
808
727
|
if (addedRecordIds.length > 0) {
|
|
809
728
|
this._addRecordIdsToVisList(addedRecordIds);
|
|
810
729
|
}
|
|
811
730
|
}
|
|
812
|
-
|
|
813
731
|
if (this._recordIdsSet) {
|
|
814
|
-
var
|
|
815
|
-
|
|
816
|
-
var _iteratorError10 = undefined;
|
|
817
|
-
|
|
732
|
+
var _iterator11 = _createForOfIteratorHelper(addedRecordIds),
|
|
733
|
+
_step11;
|
|
818
734
|
try {
|
|
819
|
-
for (
|
|
820
|
-
var recordId =
|
|
735
|
+
for (_iterator11.s(); !(_step11 = _iterator11.n()).done;) {
|
|
736
|
+
var recordId = _step11.value;
|
|
821
737
|
this._recordIdsSet[recordId] = true;
|
|
822
738
|
}
|
|
823
739
|
} catch (err) {
|
|
824
|
-
|
|
825
|
-
_iteratorError10 = err;
|
|
740
|
+
_iterator11.e(err);
|
|
826
741
|
} finally {
|
|
827
|
-
|
|
828
|
-
if (!_iteratorNormalCompletion10 && _iterator10.return != null) {
|
|
829
|
-
_iterator10.return();
|
|
830
|
-
}
|
|
831
|
-
} finally {
|
|
832
|
-
if (_didIteratorError10) {
|
|
833
|
-
throw _iteratorError10;
|
|
834
|
-
}
|
|
835
|
-
}
|
|
742
|
+
_iterator11.f();
|
|
836
743
|
}
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
var _didIteratorError11 = false;
|
|
840
|
-
var _iteratorError11 = undefined;
|
|
841
|
-
|
|
744
|
+
var _iterator12 = _createForOfIteratorHelper(removedRecordIds),
|
|
745
|
+
_step12;
|
|
842
746
|
try {
|
|
843
|
-
for (
|
|
844
|
-
var _recordId =
|
|
747
|
+
for (_iterator12.s(); !(_step12 = _iterator12.n()).done;) {
|
|
748
|
+
var _recordId = _step12.value;
|
|
845
749
|
this._recordIdsSet[_recordId] = undefined;
|
|
846
750
|
}
|
|
847
751
|
} catch (err) {
|
|
848
|
-
|
|
849
|
-
_iteratorError11 = err;
|
|
752
|
+
_iterator12.e(err);
|
|
850
753
|
} finally {
|
|
851
|
-
|
|
852
|
-
if (!_iteratorNormalCompletion11 && _iterator11.return != null) {
|
|
853
|
-
_iterator11.return();
|
|
854
|
-
}
|
|
855
|
-
} finally {
|
|
856
|
-
if (_didIteratorError11) {
|
|
857
|
-
throw _iteratorError11;
|
|
858
|
-
}
|
|
859
|
-
}
|
|
754
|
+
_iterator12.f();
|
|
860
755
|
}
|
|
861
|
-
}
|
|
862
|
-
|
|
756
|
+
}
|
|
863
757
|
|
|
758
|
+
// Now that we've applied our changes (if applicable), let's regenerate our recordIds.
|
|
864
759
|
this._orderedRecordIds = this._generateOrderedRecordIds();
|
|
865
|
-
|
|
866
760
|
this._onChange(_record_query_result.default.WatchableKeys.records, updates);
|
|
867
|
-
|
|
868
761
|
this._onChange(_record_query_result.default.WatchableKeys.recordIds, updates);
|
|
869
762
|
}
|
|
870
763
|
/** @internal */
|
|
871
764
|
// istanbul ignore next
|
|
872
|
-
|
|
873
765
|
}, {
|
|
874
766
|
key: "_onCellValuesForGroupChanged",
|
|
875
|
-
value: function _onCellValuesForGroupChanged(recordStore, key, recordIds, fieldId) {
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
767
|
+
value: function _onCellValuesForGroupChanged(recordStore, key, recordIds, fieldId) {
|
|
768
|
+
// TODO(SeanKeenan): This isn't yet required as we don't yet support
|
|
769
|
+
// specifying groups for a custom query, and this will only be called
|
|
770
|
+
// if we specify groups (same as _onCellValuesForSortChanged)
|
|
771
|
+
// This functionality and _onCellValuesForSortChanged should be
|
|
772
|
+
// identical, but testing, validation, and careful thought is required.
|
|
773
|
+
}
|
|
881
774
|
/** @internal */
|
|
882
|
-
|
|
883
775
|
}, {
|
|
884
776
|
key: "_onCellValuesForSortChanged",
|
|
885
777
|
value: function _onCellValuesForSortChanged(recordStore, key, recordIds, fieldId) {
|
|
@@ -888,38 +780,34 @@ function (_RecordQueryResult) {
|
|
|
888
780
|
// callback when the record set is loaded (and we don't want to fire
|
|
889
781
|
// a records change twice with no data).
|
|
890
782
|
return;
|
|
891
|
-
}
|
|
892
|
-
// a vis list here.
|
|
893
|
-
|
|
783
|
+
}
|
|
894
784
|
|
|
785
|
+
// NOTE: this will only ever be called if we have sorts, so it's safe to assert that we have
|
|
786
|
+
// a vis list here.
|
|
895
787
|
var visList = this._visList;
|
|
896
788
|
(0, _error_utils.invariant)(visList, 'No vis list');
|
|
897
|
-
(0, _error_utils.invariant)(recordIds.length > 0, 'field ID set without a corresponding record ID');
|
|
789
|
+
(0, _error_utils.invariant)(recordIds.length > 0, 'field ID set without a corresponding record ID');
|
|
790
|
+
|
|
791
|
+
// Only move recordIds that are already in the visList.
|
|
898
792
|
// It's possible to have recordId that is not currently in the visList since
|
|
899
793
|
// this callback can run before onRecordsChanged. (eg. when a deleted record is
|
|
900
794
|
// restored, this is triggered for that record but the record is not yet in the visList:
|
|
901
795
|
// onRecordsChanged actually adds it)
|
|
902
796
|
// Note: cell value changes that result in the records being filtered out trigger
|
|
903
797
|
// onRecordsChanged on the View model, so we don't have to worry about that here.
|
|
904
|
-
|
|
905
798
|
var visListRecordIdsSet = new Set(visList.getOrderedRecordIds());
|
|
906
799
|
var recordIdsToMove = recordIds.filter(recordId => visListRecordIdsSet.has(recordId));
|
|
907
800
|
visList.removeRecordIds(recordIdsToMove);
|
|
908
|
-
|
|
909
801
|
this._addRecordIdsToVisList(recordIdsToMove);
|
|
910
|
-
|
|
911
802
|
this._orderedRecordIds = this._generateOrderedRecordIds();
|
|
912
803
|
var changeData = {
|
|
913
804
|
addedRecordIds: [],
|
|
914
805
|
removedRecordIds: []
|
|
915
806
|
};
|
|
916
|
-
|
|
917
807
|
this._onChange(_record_query_result.default.WatchableKeys.records, changeData);
|
|
918
|
-
|
|
919
808
|
this._onChange(_record_query_result.default.WatchableKeys.recordIds, changeData);
|
|
920
809
|
}
|
|
921
810
|
/** @internal */
|
|
922
|
-
|
|
923
811
|
}, {
|
|
924
812
|
key: "_onFieldConfigChanged",
|
|
925
813
|
value: function _onFieldConfigChanged(_field, _key) {
|
|
@@ -927,11 +815,9 @@ function (_RecordQueryResult) {
|
|
|
927
815
|
// NOTE: this will only ever be called if we have sorts, so it's safe to assume we
|
|
928
816
|
// are using a vis list here.
|
|
929
817
|
this._replaceVisList();
|
|
930
|
-
|
|
931
818
|
this._orderedRecordIds = this._generateOrderedRecordIds();
|
|
932
819
|
}
|
|
933
820
|
/** @internal */
|
|
934
|
-
|
|
935
821
|
}, {
|
|
936
822
|
key: "_onTableFieldsChanged",
|
|
937
823
|
value: function _onTableFieldsChanged(table, key, updates) {
|
|
@@ -939,77 +825,60 @@ function (_RecordQueryResult) {
|
|
|
939
825
|
// If we don't have any sorts, we don't have to do anything in response to field changes.
|
|
940
826
|
return;
|
|
941
827
|
}
|
|
942
|
-
|
|
943
828
|
var addedFieldIds = updates.addedFieldIds,
|
|
944
|
-
|
|
945
|
-
var fieldIdsSet = new Set(this._sorts.map(sort => sort.fieldId));
|
|
829
|
+
removedFieldIds = updates.removedFieldIds;
|
|
830
|
+
var fieldIdsSet = new Set(this._sorts.map(sort => sort.fieldId));
|
|
831
|
+
|
|
832
|
+
// Check if any fields that we rely on were created or deleted. If they were,
|
|
946
833
|
// replace our vis list.
|
|
947
834
|
// NOTE: we need to check for created, since a field that we rely on can be
|
|
948
835
|
// deleted and then undeleted.
|
|
949
|
-
|
|
950
836
|
var wereAnyFieldsCreatedOrDeleted = false;
|
|
951
|
-
var
|
|
952
|
-
|
|
953
|
-
var _iteratorError12 = undefined;
|
|
954
|
-
|
|
837
|
+
var _iterator13 = _createForOfIteratorHelper(addedFieldIds),
|
|
838
|
+
_step13;
|
|
955
839
|
try {
|
|
956
|
-
for (
|
|
957
|
-
var fieldId =
|
|
958
|
-
|
|
840
|
+
for (_iterator13.s(); !(_step13 = _iterator13.n()).done;) {
|
|
841
|
+
var fieldId = _step13.value;
|
|
959
842
|
// If a field that we rely on was created (i.e. it was undeleted), we need to
|
|
960
843
|
// make sure we're watching it's config.
|
|
961
844
|
if (fieldIdsSet.has(fieldId)) {
|
|
962
845
|
wereAnyFieldsCreatedOrDeleted = true;
|
|
963
|
-
|
|
964
846
|
var field = this._table.getFieldByIdIfExists(fieldId);
|
|
965
|
-
|
|
966
847
|
(0, _error_utils.invariant)(field, 'Created field does not exist');
|
|
967
848
|
field.watch('type', this._onFieldConfigChanged, this);
|
|
968
849
|
field.watch('options', this._onFieldConfigChanged, this);
|
|
969
850
|
}
|
|
970
|
-
}
|
|
971
|
-
// istanbul ignore else
|
|
851
|
+
}
|
|
972
852
|
|
|
853
|
+
// coverage analysis
|
|
854
|
+
// istanbul ignore else
|
|
973
855
|
} catch (err) {
|
|
974
|
-
|
|
975
|
-
_iteratorError12 = err;
|
|
856
|
+
_iterator13.e(err);
|
|
976
857
|
} finally {
|
|
977
|
-
|
|
978
|
-
if (!_iteratorNormalCompletion12 && _iterator12.return != null) {
|
|
979
|
-
_iterator12.return();
|
|
980
|
-
}
|
|
981
|
-
} finally {
|
|
982
|
-
if (_didIteratorError12) {
|
|
983
|
-
throw _iteratorError12;
|
|
984
|
-
}
|
|
985
|
-
}
|
|
858
|
+
_iterator13.f();
|
|
986
859
|
}
|
|
987
|
-
|
|
988
860
|
if (!wereAnyFieldsCreatedOrDeleted) {
|
|
989
861
|
wereAnyFieldsCreatedOrDeleted = removedFieldIds.some(fieldId => fieldIdsSet.has(fieldId));
|
|
990
862
|
}
|
|
991
|
-
|
|
992
863
|
if (wereAnyFieldsCreatedOrDeleted) {
|
|
993
864
|
// One of the fields we're relying on was deleted,
|
|
994
865
|
this._replaceVisList();
|
|
866
|
+
this._orderedRecordIds = this._generateOrderedRecordIds();
|
|
995
867
|
|
|
996
|
-
|
|
868
|
+
// Make sure we fire onChange events since the order may have changed
|
|
997
869
|
// as a result.
|
|
998
|
-
|
|
999
870
|
var changeData = {
|
|
1000
871
|
addedRecordIds: [],
|
|
1001
872
|
removedRecordIds: []
|
|
1002
873
|
};
|
|
1003
|
-
|
|
1004
874
|
this._onChange(_record_query_result.default.WatchableKeys.records, changeData);
|
|
875
|
+
this._onChange(_record_query_result.default.WatchableKeys.recordIds, changeData);
|
|
1005
876
|
|
|
1006
|
-
|
|
877
|
+
// We do not unload/reload groupQueryResults if it's field is deleted as
|
|
1007
878
|
// it is responsible for failing to load if the field doesn't exist
|
|
1008
|
-
|
|
1009
879
|
}
|
|
1010
880
|
}
|
|
1011
881
|
/** @internal */
|
|
1012
|
-
|
|
1013
882
|
}, {
|
|
1014
883
|
key: "_onCellValuesChanged",
|
|
1015
884
|
value: function _onCellValuesChanged(table, key, updates) {
|
|
@@ -1019,11 +888,9 @@ function (_RecordQueryResult) {
|
|
|
1019
888
|
// a cellValues change twice with no data).
|
|
1020
889
|
return;
|
|
1021
890
|
}
|
|
1022
|
-
|
|
1023
891
|
this._onChange(_record_query_result.default.WatchableKeys.cellValues, updates);
|
|
1024
892
|
}
|
|
1025
893
|
/** @internal */
|
|
1026
|
-
|
|
1027
894
|
}, {
|
|
1028
895
|
key: "_onCellValuesInFieldChanged",
|
|
1029
896
|
value: function _onCellValuesInFieldChanged(table, key, recordIds, fieldId) {
|
|
@@ -1033,11 +900,9 @@ function (_RecordQueryResult) {
|
|
|
1033
900
|
// a cellValuesInField change twice with no data).
|
|
1034
901
|
return;
|
|
1035
902
|
}
|
|
1036
|
-
|
|
1037
903
|
this._onChange(key, recordIds, fieldId);
|
|
1038
904
|
}
|
|
1039
905
|
/** @internal */
|
|
1040
|
-
|
|
1041
906
|
}, {
|
|
1042
907
|
key: "_generateOrderedRecordIds",
|
|
1043
908
|
value: function _generateOrderedRecordIds() {
|
|
@@ -1049,7 +914,6 @@ function (_RecordQueryResult) {
|
|
|
1049
914
|
}
|
|
1050
915
|
}
|
|
1051
916
|
/** @internal */
|
|
1052
|
-
|
|
1053
917
|
}, {
|
|
1054
918
|
key: "_generateAndLoadOrderedGroups",
|
|
1055
919
|
value: function _generateAndLoadOrderedGroups() {
|
|
@@ -1060,49 +924,34 @@ function (_RecordQueryResult) {
|
|
|
1060
924
|
} else {
|
|
1061
925
|
// Get the group from the view itself
|
|
1062
926
|
var groupLevels = this._sourceModelGroupLevels;
|
|
1063
|
-
|
|
1064
927
|
if (!this._sourceModelGroups || !groupLevels) {
|
|
1065
928
|
return null;
|
|
1066
929
|
}
|
|
1067
|
-
|
|
1068
930
|
return this._sourceModelGroups.map(groupData => {
|
|
1069
|
-
var group = this.__groupedRecordQueryResultPool.getObjectForReuse(this, groupData, groupLevels, this._normalizedOpts, this._sdk);
|
|
931
|
+
var group = this.__groupedRecordQueryResultPool.getObjectForReuse(this, groupData, groupLevels, this._normalizedOpts, this._sdk);
|
|
932
|
+
// Don't await the loading, let others check isDataLoaded.
|
|
1070
933
|
// (it doesn't take any time anyway). Loading also strong retains.
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
934
|
group.loadDataAsync();
|
|
1074
935
|
return group;
|
|
1075
936
|
});
|
|
1076
937
|
}
|
|
1077
938
|
}
|
|
1078
939
|
/** @internal */
|
|
1079
|
-
|
|
1080
940
|
}, {
|
|
1081
941
|
key: "_unloadOrderedGroupsIfNeeded",
|
|
1082
942
|
value: function _unloadOrderedGroupsIfNeeded() {
|
|
1083
943
|
if (this._orderedGroups) {
|
|
1084
|
-
var
|
|
1085
|
-
|
|
1086
|
-
var _iteratorError13 = undefined;
|
|
1087
|
-
|
|
944
|
+
var _iterator14 = _createForOfIteratorHelper(this._orderedGroups),
|
|
945
|
+
_step14;
|
|
1088
946
|
try {
|
|
1089
|
-
for (
|
|
1090
|
-
var group =
|
|
947
|
+
for (_iterator14.s(); !(_step14 = _iterator14.n()).done;) {
|
|
948
|
+
var group = _step14.value;
|
|
1091
949
|
group.unloadData();
|
|
1092
950
|
}
|
|
1093
951
|
} catch (err) {
|
|
1094
|
-
|
|
1095
|
-
_iteratorError13 = err;
|
|
952
|
+
_iterator14.e(err);
|
|
1096
953
|
} finally {
|
|
1097
|
-
|
|
1098
|
-
if (!_iteratorNormalCompletion13 && _iterator13.return != null) {
|
|
1099
|
-
_iterator13.return();
|
|
1100
|
-
}
|
|
1101
|
-
} finally {
|
|
1102
|
-
if (_didIteratorError13) {
|
|
1103
|
-
throw _iteratorError13;
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
954
|
+
_iterator14.f();
|
|
1106
955
|
}
|
|
1107
956
|
}
|
|
1108
957
|
}
|
|
@@ -1117,252 +966,48 @@ function (_RecordQueryResult) {
|
|
|
1117
966
|
// In the meantime it's not too expensive to just unload everything, and GroupedRecordQueryResults
|
|
1118
967
|
// don't yet properly watch changes relevant to updating, so this isn't too bad.
|
|
1119
968
|
// (They do invalidate their recordId caches, which is some very cheap work that we could remove)
|
|
1120
|
-
|
|
1121
969
|
}, {
|
|
1122
970
|
key: "_unloadRemovedGroupsAndLoadNewGroupsAndTriggerWatches",
|
|
1123
971
|
value: function _unloadRemovedGroupsAndLoadNewGroupsAndTriggerWatches() {
|
|
1124
972
|
this._unloadOrderedGroupsIfNeeded();
|
|
1125
|
-
|
|
1126
973
|
this._orderedGroups = this._generateAndLoadOrderedGroups();
|
|
1127
|
-
|
|
1128
974
|
this._onChange(_record_query_result.default.WatchableKeys.groups);
|
|
1129
975
|
}
|
|
1130
976
|
/** @internal */
|
|
1131
|
-
|
|
1132
977
|
}, {
|
|
1133
978
|
key: "_replaceVisList",
|
|
1134
979
|
value: function _replaceVisList() {
|
|
1135
980
|
var airtableInterface = this._sdk.__airtableInterface;
|
|
1136
981
|
var appInterface = this._sdk.__appInterface;
|
|
1137
|
-
|
|
1138
982
|
var recordDatas = this._sourceModelRecords.map(record => record._data);
|
|
1139
|
-
|
|
1140
983
|
var fieldDatas = this._table.fields.map(field => field._data);
|
|
1141
|
-
|
|
1142
984
|
var filteredSorts = this._getSortsWithDeletedFieldsFiltered();
|
|
1143
|
-
|
|
1144
985
|
this._visList = airtableInterface.createVisList(appInterface, recordDatas, fieldDatas, filteredSorts);
|
|
1145
986
|
}
|
|
1146
987
|
/** @internal */
|
|
1147
|
-
|
|
1148
988
|
}, {
|
|
1149
989
|
key: "_getSortsWithDeletedFieldsFiltered",
|
|
1150
990
|
value: function _getSortsWithDeletedFieldsFiltered() {
|
|
1151
|
-
(0, _error_utils.invariant)(this._sorts, 'No sorts');
|
|
991
|
+
(0, _error_utils.invariant)(this._sorts, 'No sorts');
|
|
992
|
+
|
|
993
|
+
// Filter out any sorts levels that rely on deleted fields.
|
|
1152
994
|
// NOTE: we keep deleted fields around (rather than filtering them out
|
|
1153
995
|
// in realtime) in case a field gets undeleted, in which case we want to
|
|
1154
996
|
// keep using it.
|
|
1155
|
-
|
|
1156
997
|
return this._sorts.filter(sort => {
|
|
1157
998
|
var field = this._table.getFieldByIdIfExists(sort.fieldId);
|
|
1158
|
-
|
|
1159
999
|
return !!field;
|
|
1160
1000
|
});
|
|
1161
1001
|
}
|
|
1162
1002
|
/** @internal */
|
|
1163
|
-
|
|
1164
1003
|
}, {
|
|
1165
1004
|
key: "_spawnErrorForDeletion",
|
|
1166
1005
|
value: function _spawnErrorForDeletion() {
|
|
1167
1006
|
var sourceModelName = this._sourceModel instanceof _table.default ? 'table' : 'view';
|
|
1168
1007
|
return (0, _error_utils.spawnError)("RecordQueryResult's underlying %s has been deleted", sourceModelName);
|
|
1169
1008
|
}
|
|
1170
|
-
}, {
|
|
1171
|
-
key: "_dataOrNullIfDeleted",
|
|
1172
|
-
get: function get() {
|
|
1173
|
-
if (this._sourceModel.isDeleted || this._recordStore.isDeleted) {
|
|
1174
|
-
return null;
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
return {
|
|
1178
|
-
recordIds: this._orderedRecordIds,
|
|
1179
|
-
groups: this._orderedGroups,
|
|
1180
|
-
groupLevels: this._loadedGroupLevels
|
|
1181
|
-
};
|
|
1182
|
-
}
|
|
1183
|
-
/** @internal */
|
|
1184
|
-
// istanbul ignore next
|
|
1185
|
-
|
|
1186
|
-
}, {
|
|
1187
|
-
key: "__sourceModelId",
|
|
1188
|
-
get: function get() {
|
|
1189
|
-
return this._sourceModel.id;
|
|
1190
|
-
}
|
|
1191
|
-
/** @internal */
|
|
1192
|
-
|
|
1193
|
-
}, {
|
|
1194
|
-
key: "__poolKey",
|
|
1195
|
-
get: function get() {
|
|
1196
|
-
return "".concat(this._serializedOpts, "::").concat(this._sourceModel.id);
|
|
1197
|
-
}
|
|
1198
|
-
/**
|
|
1199
|
-
* @internal (since we may not be able to return parent model instances in the immutable models world)
|
|
1200
|
-
* The table that records in this RecordQueryResult are part of
|
|
1201
|
-
*/
|
|
1202
|
-
|
|
1203
|
-
}, {
|
|
1204
|
-
key: "parentTable",
|
|
1205
|
-
get: function get() {
|
|
1206
|
-
return this._table;
|
|
1207
|
-
}
|
|
1208
|
-
/**
|
|
1209
|
-
* @internal (since we may not be able to return parent model instances in the immutable models world)
|
|
1210
|
-
* The view that was used to obtain this RecordQueryResult by calling
|
|
1211
|
-
* `view.selectRecords`. Null if the RecordQueryResult was obtained by calling
|
|
1212
|
-
* `table.selectRecords`.
|
|
1213
|
-
*/
|
|
1214
|
-
|
|
1215
|
-
}, {
|
|
1216
|
-
key: "parentView",
|
|
1217
|
-
get: function get() {
|
|
1218
|
-
return this._sourceModel instanceof _table.default ? null : this._sourceModel;
|
|
1219
|
-
}
|
|
1220
|
-
/**
|
|
1221
|
-
* The record IDs in this RecordQueryResult.
|
|
1222
|
-
* Throws if data is not loaded yet.
|
|
1223
|
-
* Can be watched.
|
|
1224
|
-
*/
|
|
1225
|
-
|
|
1226
|
-
}, {
|
|
1227
|
-
key: "recordIds",
|
|
1228
|
-
get: function get() {
|
|
1229
|
-
// The following statements have been carefully sequenced to ensure
|
|
1230
|
-
// that when this method fails, it reports the most salient error.
|
|
1231
|
-
var recordIds = this._data.recordIds; // Throws when the model has been deleted.
|
|
1232
|
-
|
|
1233
|
-
(0, _error_utils.invariant)(this.isDataLoaded, 'RecordQueryResult data is not loaded');
|
|
1234
|
-
(0, _error_utils.invariant)(recordIds, 'No recordIds');
|
|
1235
|
-
return recordIds;
|
|
1236
|
-
}
|
|
1237
|
-
/**
|
|
1238
|
-
* The ordered GroupedRecordQueryResult's in this RecordQueryResult.
|
|
1239
|
-
* Throws if data is not loaded yet.
|
|
1240
|
-
* Can be watched.
|
|
1241
|
-
*
|
|
1242
|
-
* @hidden
|
|
1243
|
-
*/
|
|
1244
|
-
|
|
1245
|
-
}, {
|
|
1246
|
-
key: "groups",
|
|
1247
|
-
get: function get() {
|
|
1248
|
-
// The following statements have been carefully sequenced to ensure
|
|
1249
|
-
// that when this method fails, it reports the most salient error.
|
|
1250
|
-
var groups = this._data.groups; // Throws when the model has been deleted.
|
|
1251
|
-
|
|
1252
|
-
(0, _error_utils.invariant)(this.isDataLoaded, 'RecordQueryResult data is not loaded');
|
|
1253
|
-
return groups !== null && groups !== void 0 ? groups : null;
|
|
1254
|
-
}
|
|
1255
|
-
/**
|
|
1256
|
-
* The GroupLevels in this RecordQueryResult.
|
|
1257
|
-
* Throws if data is not loaded yet.
|
|
1258
|
-
* Can be watched.
|
|
1259
|
-
*
|
|
1260
|
-
* @hidden
|
|
1261
|
-
*/
|
|
1262
|
-
|
|
1263
|
-
}, {
|
|
1264
|
-
key: "groupLevels",
|
|
1265
|
-
get: function get() {
|
|
1266
|
-
var groupLevels = this._data.groupLevels; // Throws when the model has been deleted.
|
|
1267
|
-
|
|
1268
|
-
(0, _error_utils.invariant)(this.isDataLoaded, 'RecordQueryResult data is not loaded');
|
|
1269
|
-
return groupLevels ? groupLevels.map(singleLevel => _objectSpread({}, singleLevel, {
|
|
1270
|
-
field: this.parentTable.getFieldById(singleLevel.fieldId)
|
|
1271
|
-
})) : null;
|
|
1272
|
-
}
|
|
1273
|
-
}, {
|
|
1274
|
-
key: "fields",
|
|
1275
|
-
get: function get() {
|
|
1276
|
-
var fieldIdsOrNullIfAllFields = this._normalizedOpts.fieldIdsOrNullIfAllFields;
|
|
1277
|
-
|
|
1278
|
-
if (fieldIdsOrNullIfAllFields) {
|
|
1279
|
-
var fields = []; // Filter out any deleted fields, since RecordQueryResult is "live".
|
|
1280
|
-
// It would be too cumbersome (and defeat part of the purpose of
|
|
1281
|
-
// using RecordQueryResult) if the user had to manually watch for deletion
|
|
1282
|
-
// on all the fields and recreate the RecordQueryResult.
|
|
1283
|
-
|
|
1284
|
-
var _iteratorNormalCompletion14 = true;
|
|
1285
|
-
var _didIteratorError14 = false;
|
|
1286
|
-
var _iteratorError14 = undefined;
|
|
1287
|
-
|
|
1288
|
-
try {
|
|
1289
|
-
for (var _iterator14 = fieldIdsOrNullIfAllFields[Symbol.iterator](), _step14; !(_iteratorNormalCompletion14 = (_step14 = _iterator14.next()).done); _iteratorNormalCompletion14 = true) {
|
|
1290
|
-
var fieldId = _step14.value;
|
|
1291
|
-
|
|
1292
|
-
var field = this._table.getFieldByIdIfExists(fieldId);
|
|
1293
|
-
|
|
1294
|
-
if (field !== null) {
|
|
1295
|
-
fields.push(field);
|
|
1296
|
-
}
|
|
1297
|
-
}
|
|
1298
|
-
} catch (err) {
|
|
1299
|
-
_didIteratorError14 = true;
|
|
1300
|
-
_iteratorError14 = err;
|
|
1301
|
-
} finally {
|
|
1302
|
-
try {
|
|
1303
|
-
if (!_iteratorNormalCompletion14 && _iterator14.return != null) {
|
|
1304
|
-
_iterator14.return();
|
|
1305
|
-
}
|
|
1306
|
-
} finally {
|
|
1307
|
-
if (_didIteratorError14) {
|
|
1308
|
-
throw _iteratorError14;
|
|
1309
|
-
}
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
|
|
1313
|
-
return fields;
|
|
1314
|
-
} else {
|
|
1315
|
-
return null;
|
|
1316
|
-
}
|
|
1317
|
-
}
|
|
1318
|
-
/** @internal */
|
|
1319
|
-
|
|
1320
|
-
}, {
|
|
1321
|
-
key: "_cellValuesForSortWatchKeys",
|
|
1322
|
-
get: function get() {
|
|
1323
|
-
return this._sorts ? this._sorts.map(sort => "cellValuesInField:".concat(sort.fieldId)) : [];
|
|
1324
|
-
}
|
|
1325
|
-
/** @internal */
|
|
1326
|
-
|
|
1327
|
-
}, {
|
|
1328
|
-
key: "_cellValuesForGroupWatchKeys",
|
|
1329
|
-
get: function get() {
|
|
1330
|
-
// _groupLevels can not be specified by the user during the query yet
|
|
1331
|
-
// istanbul ignore next
|
|
1332
|
-
return this._groupLevels ? this._groupLevels.map(group => "cellValuesInField:".concat(group.fieldId)) : [];
|
|
1333
|
-
}
|
|
1334
|
-
/** @internal */
|
|
1335
|
-
|
|
1336
|
-
}, {
|
|
1337
|
-
key: "_sourceModelRecordIds",
|
|
1338
|
-
get: function get() {
|
|
1339
|
-
return this._sourceModel instanceof _table.default ? this._recordStore.recordIds : this._recordStore.getViewDataStore(this._sourceModel.id).visibleRecordIds;
|
|
1340
|
-
}
|
|
1341
|
-
/** @internal */
|
|
1342
|
-
|
|
1343
|
-
}, {
|
|
1344
|
-
key: "_sourceModelGroups",
|
|
1345
|
-
get: function get() {
|
|
1346
|
-
return this._sourceModel instanceof _table.default ? null : this._recordStore.getViewDataStore(this._sourceModel.id).groups;
|
|
1347
|
-
}
|
|
1348
|
-
/** @internal */
|
|
1349
|
-
|
|
1350
|
-
}, {
|
|
1351
|
-
key: "_sourceModelGroupLevels",
|
|
1352
|
-
get: function get() {
|
|
1353
|
-
return this._sourceModel instanceof _table.default ? null : this._recordStore.getViewDataStore(this._sourceModel.id).groupLevels;
|
|
1354
|
-
}
|
|
1355
|
-
/** @internal */
|
|
1356
|
-
|
|
1357
|
-
}, {
|
|
1358
|
-
key: "_sourceModelRecords",
|
|
1359
|
-
get: function get() {
|
|
1360
|
-
return this._sourceModel instanceof _table.default ? this._recordStore.records : this._recordStore.getViewDataStore(this._sourceModel.id).visibleRecords;
|
|
1361
|
-
}
|
|
1362
1009
|
}]);
|
|
1363
|
-
return TableOrViewQueryResult;
|
|
1364
1010
|
}(_record_query_result.default);
|
|
1365
|
-
|
|
1011
|
+
/** @internal */
|
|
1366
1012
|
(0, _defineProperty2.default)(TableOrViewQueryResult, "_className", 'TableOrViewQueryResult');
|
|
1367
|
-
var _default = TableOrViewQueryResult;
|
|
1368
|
-
exports.default = _default;
|
|
1013
|
+
var _default = exports.default = TableOrViewQueryResult;
|