@theseam/ui-common 0.2.9 → 0.2.13
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/assets/vendor/intl-tel-input/js/utils.js +255 -254
- package/bundles/theseam-ui-common-asset-reader.umd.js +7 -9
- package/bundles/theseam-ui-common-asset-reader.umd.js.map +1 -1
- package/bundles/theseam-ui-common-breadcrumbs.umd.js +6 -8
- package/bundles/theseam-ui-common-breadcrumbs.umd.js.map +1 -1
- package/bundles/theseam-ui-common-buttons.umd.js +5 -5
- package/bundles/theseam-ui-common-buttons.umd.js.map +1 -1
- package/bundles/theseam-ui-common-card.umd.js +6 -6
- package/bundles/theseam-ui-common-card.umd.js.map +1 -1
- package/bundles/theseam-ui-common-checkbox.umd.js +4 -4
- package/bundles/theseam-ui-common-checkbox.umd.js.map +1 -1
- package/bundles/theseam-ui-common-confirm-dialog.umd.js +4 -4
- package/bundles/theseam-ui-common-confirm-dialog.umd.js.map +1 -1
- package/bundles/theseam-ui-common-core.umd.js +4 -4
- package/bundles/theseam-ui-common-core.umd.js.map +1 -1
- package/bundles/theseam-ui-common-data-exporter.umd.js +5 -5
- package/bundles/theseam-ui-common-data-filters.umd.js +9 -6
- package/bundles/theseam-ui-common-data-filters.umd.js.map +1 -1
- package/bundles/theseam-ui-common-datatable-dynamic.umd.js +7 -7
- package/bundles/theseam-ui-common-datatable-dynamic.umd.js.map +1 -1
- package/bundles/theseam-ui-common-datatable.umd.js +1353 -375
- package/bundles/theseam-ui-common-datatable.umd.js.map +1 -1
- package/bundles/theseam-ui-common-dynamic-component-loader.umd.js +5 -7
- package/bundles/theseam-ui-common-dynamic-component-loader.umd.js.map +1 -1
- package/bundles/theseam-ui-common-dynamic.umd.js +7 -9
- package/bundles/theseam-ui-common-dynamic.umd.js.map +1 -1
- package/bundles/theseam-ui-common-footer-bar.umd.js +3 -3
- package/bundles/theseam-ui-common-form-field-error.umd.js +5 -5
- package/bundles/theseam-ui-common-form-field-error.umd.js.map +1 -1
- package/bundles/theseam-ui-common-form-field.umd.js +5 -5
- package/bundles/theseam-ui-common-form-field.umd.js.map +1 -1
- package/bundles/theseam-ui-common-framework.umd.js +28 -30
- package/bundles/theseam-ui-common-framework.umd.js.map +1 -1
- package/bundles/theseam-ui-common-graphql.umd.js +958 -8
- package/bundles/theseam-ui-common-graphql.umd.js.map +1 -1
- package/bundles/theseam-ui-common-icon.umd.js +5 -5
- package/bundles/theseam-ui-common-icon.umd.js.map +1 -1
- package/bundles/theseam-ui-common-layout.umd.js +5 -7
- package/bundles/theseam-ui-common-layout.umd.js.map +1 -1
- package/bundles/theseam-ui-common-loading.umd.js +4 -4
- package/bundles/theseam-ui-common-menu.umd.js +5 -5
- package/bundles/theseam-ui-common-menu.umd.js.map +1 -1
- package/bundles/theseam-ui-common-modal.umd.js +6 -6
- package/bundles/theseam-ui-common-modal.umd.js.map +1 -1
- package/bundles/theseam-ui-common-models.umd.js +3 -3
- package/bundles/theseam-ui-common-popover.umd.js +4 -4
- package/bundles/theseam-ui-common-progress.umd.js +5 -5
- package/bundles/theseam-ui-common-progress.umd.js.map +1 -1
- package/bundles/theseam-ui-common-scrollbar.umd.js +7 -9
- package/bundles/theseam-ui-common-scrollbar.umd.js.map +1 -1
- package/bundles/theseam-ui-common-services.umd.js +6 -8
- package/bundles/theseam-ui-common-services.umd.js.map +1 -1
- package/bundles/theseam-ui-common-shared.umd.js +4 -4
- package/bundles/theseam-ui-common-shared.umd.js.map +1 -1
- package/bundles/theseam-ui-common-storage.umd.js +5 -7
- package/bundles/theseam-ui-common-storage.umd.js.map +1 -1
- package/bundles/theseam-ui-common-story-helpers.umd.js +4 -4
- package/bundles/theseam-ui-common-story-helpers.umd.js.map +1 -1
- package/bundles/theseam-ui-common-tabbed.umd.js +5 -5
- package/bundles/theseam-ui-common-tabbed.umd.js.map +1 -1
- package/bundles/theseam-ui-common-table-cell-type.umd.js +5 -7
- package/bundles/theseam-ui-common-table-cell-type.umd.js.map +1 -1
- package/bundles/theseam-ui-common-table-cell-types.umd.js +258 -32
- package/bundles/theseam-ui-common-table-cell-types.umd.js.map +1 -1
- package/bundles/theseam-ui-common-table.umd.js +5 -5
- package/bundles/theseam-ui-common-table.umd.js.map +1 -1
- package/bundles/theseam-ui-common-tel-input.umd.js +6 -6
- package/bundles/theseam-ui-common-tel-input.umd.js.map +1 -1
- package/bundles/theseam-ui-common-testing.umd.js +568 -0
- package/bundles/theseam-ui-common-testing.umd.js.map +1 -0
- package/bundles/theseam-ui-common-tiled-select.umd.js +56 -39
- package/bundles/theseam-ui-common-tiled-select.umd.js.map +1 -1
- package/bundles/theseam-ui-common-toggle-edit.umd.js +8 -10
- package/bundles/theseam-ui-common-toggle-edit.umd.js.map +1 -1
- package/bundles/theseam-ui-common-toggle-group.umd.js +4 -4
- package/bundles/theseam-ui-common-toggle-group.umd.js.map +1 -1
- package/bundles/theseam-ui-common-unsaved-changes-dialog.umd.js +5 -7
- package/bundles/theseam-ui-common-unsaved-changes-dialog.umd.js.map +1 -1
- package/bundles/theseam-ui-common-utils.umd.js +174 -81
- package/bundles/theseam-ui-common-utils.umd.js.map +1 -1
- package/bundles/theseam-ui-common-validators.umd.js +3 -3
- package/bundles/theseam-ui-common-viewers.umd.js +6 -8
- package/bundles/theseam-ui-common-viewers.umd.js.map +1 -1
- package/bundles/theseam-ui-common-widget.umd.js +18 -20
- package/bundles/theseam-ui-common-widget.umd.js.map +1 -1
- package/bundles/theseam-ui-common.umd.js +2 -2
- package/buttons/theseam-ui-common-buttons.metadata.json +1 -1
- package/card/theseam-ui-common-card.metadata.json +1 -1
- package/data-filters/data-filter.d.ts +10 -6
- package/data-filters/theseam-ui-common-data-filters.metadata.json +1 -1
- package/datatable/datatable/datatable.component.d.ts +48 -32
- package/datatable/datatable-column/datatable-column.component.d.ts +26 -25
- package/datatable/datatable-column-preferences/datatable-column-preferences.component.d.ts +7 -5
- package/datatable/datatable-column-preferences-button/datatable-column-preferences-button.component.d.ts +7 -1
- package/datatable/datatable-footer/datatable-footer-tpl.directive.d.ts +5 -0
- package/datatable/datatable-footer/datatable-footer.directive.d.ts +6 -0
- package/datatable/datatable-menu-bar/datatable-menu-bar.component.d.ts +1 -1
- package/datatable/directives/datatable-filter.directive.d.ts +1 -1
- package/datatable/models/columns-alteration.d.ts +61 -0
- package/datatable/models/columns-alterations/hide-column.columns-alteration.d.ts +15 -0
- package/datatable/models/columns-alterations/order.columns-alteration.d.ts +20 -0
- package/datatable/models/columns-alterations/sort.columns-alteration.d.ts +14 -0
- package/datatable/models/columns-alterations/width.columns-alteration.d.ts +16 -0
- package/datatable/models/datatable-accessor.d.ts +5 -3
- package/datatable/models/internal-column-props.d.ts +7 -0
- package/datatable/models/page-info.d.ts +12 -0
- package/datatable/models/preferences-accessor.d.ts +1 -1
- package/datatable/models/preferences.d.ts +11 -3
- package/datatable/models/sort-item.d.ts +2 -1
- package/datatable/public-api.d.ts +2 -0
- package/datatable/services/columns-alterations-manager.service.d.ts +39 -0
- package/datatable/services/columns-manager.service.d.ts +55 -0
- package/datatable/services/datatable-preferences.service.d.ts +10 -7
- package/datatable/theseam-ui-common-datatable.d.ts +2 -0
- package/datatable/theseam-ui-common-datatable.metadata.json +1 -1
- package/datatable/tokens/datatable-preferences-accessor.d.ts +2 -2
- package/datatable/utils/create-action-menu-column.d.ts +3 -0
- package/datatable/utils/create-checkbox-column.d.ts +3 -0
- package/datatable/utils/get-column-prop.d.ts +5 -0
- package/datatable/utils/map-columns-alterations-states.d.ts +2 -0
- package/datatable/utils/remove-unused-diffs.d.ts +7 -0
- package/datatable/utils/set-column-defaults.d.ts +2 -0
- package/datatable/utils/translate-templates.d.ts +2 -0
- package/datatable/utils/with-stored-column-info.d.ts +2 -2
- package/datatable-dynamic/theseam-ui-common-datatable-dynamic.metadata.json +1 -1
- package/esm2015/buttons/progress-circle-button/progress-circle-button.component.js +1 -1
- package/esm2015/card/card-action/card-action.component.js +1 -1
- package/esm2015/card/card-body/card-body.component.js +1 -1
- package/esm2015/data-filters/data-filter.js +5 -2
- package/esm2015/data-filters/filters/data-filter-search/data-filter-search.component.js +1 -1
- package/esm2015/data-filters/filters/data-filter-text/data-filter-text.component.js +1 -1
- package/esm2015/datatable/datatable/datatable.component.js +197 -211
- package/esm2015/datatable/datatable-action-menu/datatable-action-menu.component.js +1 -1
- package/esm2015/datatable/datatable-column/datatable-column.component.js +1 -1
- package/esm2015/datatable/datatable-column-preferences/datatable-column-preferences.component.js +42 -19
- package/esm2015/datatable/datatable-column-preferences-button/datatable-column-preferences-button.component.js +38 -4
- package/esm2015/datatable/datatable-export-button/datatable-export-button.component.js +1 -1
- package/esm2015/datatable/datatable-footer/datatable-footer-tpl.directive.js +15 -0
- package/esm2015/datatable/datatable-footer/datatable-footer.directive.js +18 -0
- package/esm2015/datatable/datatable-menu-bar/datatable-menu-bar.component.js +1 -1
- package/esm2015/datatable/datatable-menu-bar-column-center/datatable-menu-bar-column-center.component.js +1 -1
- package/esm2015/datatable/datatable-menu-bar-column-left/datatable-menu-bar-column-left.component.js +1 -1
- package/esm2015/datatable/datatable-menu-bar-column-right/datatable-menu-bar-column-right.component.js +1 -1
- package/esm2015/datatable/datatable-menu-bar-row/datatable-menu-bar-row.component.js +1 -1
- package/esm2015/datatable/datatable.module.js +7 -1
- package/esm2015/datatable/models/columns-alteration.js +38 -0
- package/esm2015/datatable/models/columns-alterations/hide-column.columns-alteration.js +38 -0
- package/esm2015/datatable/models/columns-alterations/order.columns-alteration.js +81 -0
- package/esm2015/datatable/models/columns-alterations/sort.columns-alteration.js +33 -0
- package/esm2015/datatable/models/columns-alterations/width.columns-alteration.js +41 -0
- package/esm2015/datatable/models/datatable-accessor.js +1 -1
- package/esm2015/datatable/models/internal-column-props.js +15 -0
- package/esm2015/datatable/models/page-info.js +1 -1
- package/esm2015/datatable/models/preferences-accessor.js +1 -1
- package/esm2015/datatable/models/preferences.js +6 -2
- package/esm2015/datatable/models/sort-item.js +1 -1
- package/esm2015/datatable/public-api.js +3 -1
- package/esm2015/datatable/services/columns-alterations-manager.service.js +134 -0
- package/esm2015/datatable/services/columns-manager.service.js +257 -0
- package/esm2015/datatable/services/datatable-preferences.service.js +78 -32
- package/esm2015/datatable/theseam-ui-common-datatable.js +3 -1
- package/esm2015/datatable/tokens/datatable-preferences-accessor.js +2 -2
- package/esm2015/datatable/utils/create-action-menu-column.js +18 -0
- package/esm2015/datatable/utils/create-checkbox-column.js +15 -0
- package/esm2015/datatable/utils/get-column-prop.js +9 -0
- package/esm2015/datatable/utils/map-columns-alterations-states.js +39 -0
- package/esm2015/datatable/utils/remove-unused-diffs.js +9 -0
- package/esm2015/datatable/utils/set-column-defaults.js +10 -0
- package/esm2015/datatable/utils/translate-templates.js +12 -0
- package/esm2015/datatable/utils/with-stored-column-info.js +1 -1
- package/esm2015/datatable-dynamic/datatable-dynamic-action-menu/datatable-dynamic-action-menu.component.js +1 -1
- package/esm2015/datatable-dynamic/datatable-dynamic-filter-container/datatable-dynamic-filter-container.component.js +1 -1
- package/esm2015/datatable-dynamic/datatable-dynamic.component.js +1 -1
- package/esm2015/form-field/form-field.component.js +1 -1
- package/esm2015/form-field-error/form-field-error/form-field-error.component.js +1 -1
- package/esm2015/framework/base-layout/base-layout.component.js +1 -1
- package/esm2015/framework/dashboard/dashboard-widgets/dashboard-widgets.component.js +1 -1
- package/esm2015/framework/dynamic-router/hierarchy-router-outlet/hierarchy-router-outlet.component.js +1 -1
- package/esm2015/framework/schema-form-controls/schema-form-input/schema-form-input.component.js +1 -1
- package/esm2015/framework/schema-form-controls/schema-form-number/schema-form-number.component.js +1 -1
- package/esm2015/framework/schema-form-controls/schema-form-select/schema-form-select.component.js +1 -1
- package/esm2015/framework/schema-form-controls/schema-form-submit-split/schema-form-submit-split.component.js +1 -1
- package/esm2015/framework/side-nav/side-nav-item/side-nav-item.component.js +3 -3
- package/esm2015/framework/side-nav/side-nav-toggle/side-nav-toggle.component.js +1 -1
- package/esm2015/framework/side-nav/side-nav.component.js +1 -1
- package/esm2015/framework/top-bar/top-bar-menu-button/top-bar-menu-button.component.js +1 -1
- package/esm2015/framework/top-bar/top-bar-title/top-bar-title.component.js +1 -1
- package/esm2015/framework/top-bar/top-bar.component.js +1 -1
- package/esm2015/graphql/datatable/create-page-info-observable.js +38 -0
- package/esm2015/graphql/datatable/datatable-graphql-query-ref.js +236 -0
- package/esm2015/graphql/datatable/datatable-graphql.service.js +35 -0
- package/esm2015/graphql/datatable/datatable-helpers.js +170 -0
- package/esm2015/graphql/datatable/get-page-info.js +11 -0
- package/esm2015/graphql/datatable/index.js +7 -0
- package/esm2015/graphql/datatable/map-filter-states.js +64 -0
- package/esm2015/graphql/datatable/map-page-info.js +14 -0
- package/esm2015/graphql/datatable/mapper-context.js +2 -0
- package/esm2015/graphql/models/gql-datatable-accessor.js +2 -0
- package/esm2015/graphql/models/index.js +2 -1
- package/esm2015/graphql/models/query-processing-config.js +1 -1
- package/esm2015/graphql/public-api.js +2 -1
- package/esm2015/graphql/utils/parse-hints.js +3 -3
- package/esm2015/icon/icon/icon.component.js +1 -1
- package/esm2015/loading/loading/loading.component.js +1 -1
- package/esm2015/menu/menu.component.js +1 -1
- package/esm2015/modal/modal-body/modal-body.component.js +1 -1
- package/esm2015/modal/modal-container/modal-container.component.js +1 -1
- package/esm2015/popover/popover/popover.component.js +1 -1
- package/esm2015/progress/progress-circle/progress-circle.component.js +1 -1
- package/esm2015/tabbed/tabbed.component.js +1 -1
- package/esm2015/table/table/table.component.js +1 -1
- package/esm2015/table-cell-types/public-api.js +8 -1
- package/esm2015/table-cell-types/table-cell-type-currency/table-cell-type-currency-config.js +2 -0
- package/esm2015/table-cell-types/table-cell-type-currency/table-cell-type-currency.component.js +74 -0
- package/esm2015/table-cell-types/table-cell-type-currency/table-cell-type-currency.js +2 -0
- package/esm2015/table-cell-types/table-cell-type-decimal/table-cell-type-decimal-config.js +1 -1
- package/esm2015/table-cell-types/table-cell-type-decimal/table-cell-type-decimal.component.js +73 -0
- package/esm2015/table-cell-types/table-cell-type-decimal/table-cell-type-decimal.js +2 -0
- package/esm2015/table-cell-types/table-cell-type-icon/table-cell-type-icon.component.js +1 -1
- package/esm2015/table-cell-types/table-cell-type-integer/table-cell-type-integer-config.js +1 -1
- package/esm2015/table-cell-types/table-cell-type-integer/table-cell-type-integer.component.js +71 -0
- package/esm2015/table-cell-types/table-cell-type-integer/table-cell-type-integer.js +2 -0
- package/esm2015/table-cell-types/table-cell-type-manifests.js +29 -17
- package/esm2015/table-cell-types/table-cell-type-progress-circle/table-cell-type-progress-circle.component.js +1 -1
- package/esm2015/table-cell-types/table-cell-types.module.js +9 -2
- package/esm2015/tel-input/tel-input/tel-input.component.js +1 -1
- package/esm2015/testing/current-tick-time.js +16 -0
- package/esm2015/testing/fake-toastr.js +29 -0
- package/esm2015/testing/get-harness.js +16 -0
- package/esm2015/testing/public-api.js +7 -0
- package/esm2015/testing/render-story.js +12 -0
- package/esm2015/testing/story-expect.js +39 -0
- package/esm2015/testing/theseam-ui-common-testing.js +5 -0
- package/esm2015/testing/tick-helper.js +74 -0
- package/esm2015/tiled-select/components/tiled-select/tiled-select.component.js +25 -17
- package/esm2015/tiled-select/components/tiled-select-tile/tiled-select-tile.component.js +5 -2
- package/esm2015/tiled-select/components/tiled-select-tile-icon/tiled-select-tile-icon.component.js +1 -1
- package/esm2015/tiled-select/public-api.js +2 -1
- package/esm2015/tiled-select/tiled-select.models.js +1 -1
- package/esm2015/tiled-select/tiled-select.module.js +4 -4
- package/esm2015/toggle-edit/toggle-edit-actions-container/toggle-edit-actions-container.component.js +1 -1
- package/esm2015/toggle-edit/toggle-edit.component.js +1 -1
- package/esm2015/utils/array-move.js +62 -0
- package/esm2015/utils/public-api.js +2 -1
- package/esm2015/utils/subscriber-count.js +31 -4
- package/esm2015/widget/widget/widget.component.js +1 -1
- package/esm2015/widget/widget-content-components/widget-button-group/widget-button-group.component.js +1 -1
- package/esm2015/widget/widget-content-components/widget-content-header/widget-content-header.component.js +1 -1
- package/esm2015/widget/widget-content-components/widget-empty-label/widget-empty-label.component.js +1 -1
- package/esm2015/widget/widget-content-components/widget-footer-link/widget-footer-link.component.js +1 -1
- package/esm2015/widget/widget-content-components/widget-footer-text/widget-footer-text.component.js +1 -1
- package/esm2015/widget/widget-content-components/widget-header-badge/widget-header-badge.component.js +1 -1
- package/esm2015/widget/widget-content-components/widget-tile/widget-tile-footer-item/widget-tile-footer-item.component.js +1 -1
- package/esm2015/widget/widget-content-components/widget-tile/widget-tile-group/widget-tile-group.component.js +1 -1
- package/esm2015/widget/widget-content-components/widget-tile/widget-tile.component.js +1 -1
- package/esm2015/widget/widget-content-components/widget-tile-list/widget-tile-list.component.js +1 -1
- package/esm2015/widget/widget-footer/widget-footer.component.js +1 -1
- package/fesm2015/theseam-ui-common-buttons.js +1 -1
- package/fesm2015/theseam-ui-common-card.js +2 -2
- package/fesm2015/theseam-ui-common-data-filters.js +6 -3
- package/fesm2015/theseam-ui-common-data-filters.js.map +1 -1
- package/fesm2015/theseam-ui-common-datatable-dynamic.js +3 -3
- package/fesm2015/theseam-ui-common-datatable.js +1136 -316
- package/fesm2015/theseam-ui-common-datatable.js.map +1 -1
- package/fesm2015/theseam-ui-common-form-field-error.js +1 -1
- package/fesm2015/theseam-ui-common-form-field.js +1 -1
- package/fesm2015/theseam-ui-common-framework.js +14 -14
- package/fesm2015/theseam-ui-common-framework.js.map +1 -1
- package/fesm2015/theseam-ui-common-graphql.js +555 -5
- package/fesm2015/theseam-ui-common-graphql.js.map +1 -1
- package/fesm2015/theseam-ui-common-icon.js +1 -1
- package/fesm2015/theseam-ui-common-loading.js +1 -1
- package/fesm2015/theseam-ui-common-menu.js +1 -1
- package/fesm2015/theseam-ui-common-modal.js +2 -2
- package/fesm2015/theseam-ui-common-popover.js +1 -1
- package/fesm2015/theseam-ui-common-progress.js +1 -1
- package/fesm2015/theseam-ui-common-tabbed.js +1 -1
- package/fesm2015/theseam-ui-common-table-cell-types.js +234 -22
- package/fesm2015/theseam-ui-common-table-cell-types.js.map +1 -1
- package/fesm2015/theseam-ui-common-table.js +1 -1
- package/fesm2015/theseam-ui-common-tel-input.js +1 -1
- package/fesm2015/theseam-ui-common-testing.js +191 -0
- package/fesm2015/theseam-ui-common-testing.js.map +1 -0
- package/fesm2015/theseam-ui-common-tiled-select.js +34 -21
- package/fesm2015/theseam-ui-common-tiled-select.js.map +1 -1
- package/fesm2015/theseam-ui-common-toggle-edit.js +2 -2
- package/fesm2015/theseam-ui-common-utils.js +92 -4
- package/fesm2015/theseam-ui-common-utils.js.map +1 -1
- package/fesm2015/theseam-ui-common-widget.js +12 -12
- package/form-field/theseam-ui-common-form-field.metadata.json +1 -1
- package/form-field-error/theseam-ui-common-form-field-error.metadata.json +1 -1
- package/framework/side-nav/side-nav-item/side-nav-item.component.scss +36 -9
- package/framework/theseam-ui-common-framework.metadata.json +1 -1
- package/graphql/datatable/create-page-info-observable.d.ts +4 -0
- package/graphql/datatable/datatable-graphql-query-ref.d.ts +65 -0
- package/graphql/datatable/datatable-graphql.service.d.ts +26 -0
- package/graphql/datatable/datatable-helpers.d.ts +12 -0
- package/graphql/datatable/get-page-info.d.ts +4 -0
- package/graphql/datatable/index.d.ts +6 -0
- package/graphql/datatable/map-filter-states.d.ts +18 -0
- package/graphql/datatable/map-page-info.d.ts +11 -0
- package/graphql/datatable/mapper-context.d.ts +6 -0
- package/graphql/models/gql-datatable-accessor.d.ts +9 -0
- package/graphql/models/index.d.ts +1 -0
- package/graphql/models/query-processing-config.d.ts +4 -0
- package/graphql/public-api.d.ts +1 -0
- package/graphql/theseam-ui-common-graphql.metadata.json +1 -1
- package/icon/theseam-ui-common-icon.metadata.json +1 -1
- package/loading/theseam-ui-common-loading.metadata.json +1 -1
- package/menu/theseam-ui-common-menu.metadata.json +1 -1
- package/modal/theseam-ui-common-modal.metadata.json +1 -1
- package/package.json +1 -1
- package/popover/theseam-ui-common-popover.metadata.json +1 -1
- package/progress/theseam-ui-common-progress.metadata.json +1 -1
- package/styles/common/_table.scss +0 -5
- package/styles/vendor/ngx-datatable/_ngx-datatable.scss +478 -87
- package/styles/vendor/ngx-datatable/_themes/bootstrap/_variables.scss +174 -0
- package/styles/vendor/ngx-datatable/_themes/dark/_variables.scss +166 -0
- package/styles/vendor/ngx-datatable/_themes/material/_variables.scss +165 -0
- package/styles/vendor/ngx-datatable/_variables.scss +3 -0
- package/tabbed/theseam-ui-common-tabbed.metadata.json +1 -1
- package/table/theseam-ui-common-table.metadata.json +1 -1
- package/table-cell-types/public-api.d.ts +7 -0
- package/table-cell-types/table-cell-type-currency/table-cell-type-currency-config.d.ts +39 -0
- package/table-cell-types/table-cell-type-currency/table-cell-type-currency.component.d.ts +19 -0
- package/table-cell-types/table-cell-type-currency/table-cell-type-currency.d.ts +3 -0
- package/table-cell-types/table-cell-type-decimal/table-cell-type-decimal-config.d.ts +31 -1
- package/table-cell-types/table-cell-type-decimal/table-cell-type-decimal.component.d.ts +19 -0
- package/table-cell-types/table-cell-type-decimal/table-cell-type-decimal.d.ts +3 -0
- package/table-cell-types/table-cell-type-integer/table-cell-type-integer-config.d.ts +23 -1
- package/table-cell-types/table-cell-type-integer/table-cell-type-integer.component.d.ts +19 -0
- package/table-cell-types/table-cell-type-integer/table-cell-type-integer.d.ts +3 -0
- package/table-cell-types/table-cell-type-manifests.d.ts +2 -1
- package/table-cell-types/theseam-ui-common-table-cell-types.metadata.json +1 -1
- package/tel-input/theseam-ui-common-tel-input.metadata.json +1 -1
- package/testing/current-tick-time.d.ts +13 -0
- package/testing/fake-toastr.d.ts +30 -0
- package/testing/get-harness.d.ts +7 -0
- package/testing/package.json +11 -0
- package/testing/public-api.d.ts +6 -0
- package/testing/render-story.d.ts +2 -0
- package/testing/story-expect.d.ts +5 -0
- package/{test-helpers/theseam-ui-common-test-helpers.d.ts → testing/theseam-ui-common-testing.d.ts} +0 -0
- package/testing/theseam-ui-common-testing.metadata.json +1 -0
- package/{test-helpers → testing}/tick-helper.d.ts +0 -0
- package/tiled-select/components/tiled-select/tiled-select.component.d.ts +7 -3
- package/tiled-select/components/tiled-select-tile/tiled-select-tile.component.d.ts +1 -0
- package/tiled-select/theseam-ui-common-tiled-select.metadata.json +1 -1
- package/tiled-select/tiled-select.models.d.ts +3 -1
- package/toggle-edit/theseam-ui-common-toggle-edit.metadata.json +1 -1
- package/utils/array-move.d.ts +49 -0
- package/utils/public-api.d.ts +1 -0
- package/utils/subscriber-count.d.ts +13 -1
- package/utils/theseam-ui-common-utils.metadata.json +1 -1
- package/widget/theseam-ui-common-widget.metadata.json +1 -1
- package/bundles/theseam-ui-common-test-helpers.umd.js +0 -94
- package/bundles/theseam-ui-common-test-helpers.umd.js.map +0 -1
- package/esm2015/test-helpers/public-api.js +0 -2
- package/esm2015/test-helpers/theseam-ui-common-test-helpers.js +0 -5
- package/esm2015/test-helpers/tick-helper.js +0 -74
- package/fesm2015/theseam-ui-common-test-helpers.js +0 -81
- package/fesm2015/theseam-ui-common-test-helpers.js.map +0 -1
- package/test-helpers/package.json +0 -11
- package/test-helpers/public-api.d.ts +0 -1
- package/test-helpers/theseam-ui-common-test-helpers.metadata.json +0 -1
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import { visit, BREAK } from 'graphql/language';
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { isDevMode, InjectionToken, Injectable, Optional, Inject } from '@angular/core';
|
|
4
|
+
import { hasProperty, notNullOrUndefined, isNullOrUndefined, wrapIntoObservable, subscriberCount } from '@theseam/ui-common/utils';
|
|
4
5
|
import { visit as visit$1, parse, BREAK as BREAK$1 } from 'graphql';
|
|
6
|
+
import { Observable, EMPTY, from, ReplaySubject, of, combineLatest, BehaviorSubject, defer, Subject, isObservable } from 'rxjs';
|
|
7
|
+
import { switchMap, tap, take, concatMap, filter, toArray, map, shareReplay, startWith, distinctUntilChanged, skip, auditTime, finalize } from 'rxjs/operators';
|
|
8
|
+
import { __awaiter } from 'tslib';
|
|
9
|
+
import * as i1 from 'apollo-angular';
|
|
10
|
+
import { Apollo } from 'apollo-angular';
|
|
11
|
+
import { NetworkStatus } from '@apollo/client/core';
|
|
5
12
|
|
|
6
13
|
function containsVariable(node, variableName) {
|
|
7
14
|
let found = false;
|
|
@@ -175,7 +182,7 @@ function createHintsToken(token, node, kind) {
|
|
|
175
182
|
};
|
|
176
183
|
}
|
|
177
184
|
function getHintsToken(token, ast) {
|
|
178
|
-
console.log('getHintsToken', token)
|
|
185
|
+
// console.log('getHintsToken', token)
|
|
179
186
|
const appliesTo = getTokenAppliesTo(token);
|
|
180
187
|
if (appliesTo === null) {
|
|
181
188
|
return null;
|
|
@@ -222,7 +229,7 @@ function getHintsToken(token, ast) {
|
|
|
222
229
|
}
|
|
223
230
|
function parseHints(ast) {
|
|
224
231
|
const _ast = parseAst(ast);
|
|
225
|
-
console.log('_ast', _ast)
|
|
232
|
+
// console.log('_ast', _ast)
|
|
226
233
|
return parseComments(_ast)
|
|
227
234
|
.filter(isHintToken)
|
|
228
235
|
.map(r => getHintsToken(r, _ast))
|
|
@@ -323,9 +330,552 @@ function hintsTokensContainingHint(hintsTokens, hint) {
|
|
|
323
330
|
return hintsTokens.filter(r => r.hints.indexOf(hint) !== -1);
|
|
324
331
|
}
|
|
325
332
|
|
|
333
|
+
const DEFAULT_PAGE_SIZE = 20;
|
|
334
|
+
function getPageInfo(datatable, defaultPageSize = DEFAULT_PAGE_SIZE) {
|
|
335
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
336
|
+
return {
|
|
337
|
+
offset: (_b = (_a = datatable === null || datatable === void 0 ? void 0 : datatable.ngxDatatable) === null || _a === void 0 ? void 0 : _a.offset) !== null && _b !== void 0 ? _b : 0,
|
|
338
|
+
pageSize: (_d = (_c = datatable === null || datatable === void 0 ? void 0 : datatable.ngxDatatable) === null || _c === void 0 ? void 0 : _c.pageSize) !== null && _d !== void 0 ? _d : defaultPageSize,
|
|
339
|
+
limit: (_e = datatable === null || datatable === void 0 ? void 0 : datatable.ngxDatatable) === null || _e === void 0 ? void 0 : _e.limit,
|
|
340
|
+
count: (_g = (_f = datatable === null || datatable === void 0 ? void 0 : datatable.ngxDatatable) === null || _f === void 0 ? void 0 : _f.count) !== null && _g !== void 0 ? _g : 0
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
function createPageInfoObservable(datatable$, defaultPageSize = 20) {
|
|
345
|
+
return new Observable((subscriber) => {
|
|
346
|
+
let prev = null;
|
|
347
|
+
const handlePageInfo = (pageInfo) => {
|
|
348
|
+
if (!_isPageInfoSame(prev, pageInfo)) {
|
|
349
|
+
if (pageInfo !== null) {
|
|
350
|
+
subscriber.next(pageInfo);
|
|
351
|
+
}
|
|
352
|
+
prev = pageInfo;
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
const dtSub = datatable$.pipe(switchMap(dt => {
|
|
356
|
+
if (!notNullOrUndefined(dt)) {
|
|
357
|
+
handlePageInfo(null);
|
|
358
|
+
return EMPTY;
|
|
359
|
+
}
|
|
360
|
+
handlePageInfo(getPageInfo(dt, defaultPageSize));
|
|
361
|
+
return dt.page.pipe(tap(p => handlePageInfo(p)));
|
|
362
|
+
})).subscribe();
|
|
363
|
+
return () => {
|
|
364
|
+
dtSub.unsubscribe();
|
|
365
|
+
};
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
function _isPageInfoSame(prev, curr) {
|
|
369
|
+
if ((prev === null || prev === void 0 ? void 0 : prev.offset) === (curr === null || curr === void 0 ? void 0 : curr.offset) &&
|
|
370
|
+
(prev === null || prev === void 0 ? void 0 : prev.pageSize) === (curr === null || curr === void 0 ? void 0 : curr.pageSize) &&
|
|
371
|
+
(prev === null || prev === void 0 ? void 0 : prev.limit) === (curr === null || curr === void 0 ? void 0 : curr.limit) &&
|
|
372
|
+
(prev === null || prev === void 0 ? void 0 : prev.count) === (curr === null || curr === void 0 ? void 0 : curr.count)) {
|
|
373
|
+
return true;
|
|
374
|
+
}
|
|
375
|
+
return false;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
function resolveMapper(filterState, filterStateMappers, context) {
|
|
379
|
+
const mapper = filterStateMappers[filterState.name];
|
|
380
|
+
if (!notNullOrUndefined(mapper)) {
|
|
381
|
+
throw Error(`Mapper for filter '${filterState.name}' not found.`);
|
|
382
|
+
}
|
|
383
|
+
return wrapIntoObservable(mapper(filterState, context)).pipe(
|
|
384
|
+
// Require each mapper to complete.
|
|
385
|
+
take(1));
|
|
386
|
+
}
|
|
387
|
+
function resolveMappers(filterStates, filterStateMappers, context) {
|
|
388
|
+
return from(filterStates).pipe(concatMap(filterState => resolveMapper(filterState, filterStateMappers, context)), filter(notNullOrUndefined), toArray());
|
|
389
|
+
}
|
|
390
|
+
function mergeFilters(filters) {
|
|
391
|
+
return { or: filters };
|
|
392
|
+
}
|
|
393
|
+
/**
|
|
394
|
+
* Merges variable objects.
|
|
395
|
+
*
|
|
396
|
+
* NOTE: This does not try to deep merge, so if two objects define the same
|
|
397
|
+
* variable then the last object's value will be in the merged object. *In
|
|
398
|
+
* devMode an error will be thrown.*
|
|
399
|
+
*/
|
|
400
|
+
function mergeVariables(variableObjects) {
|
|
401
|
+
const variables = {};
|
|
402
|
+
for (const v of variableObjects) {
|
|
403
|
+
const props = Object.keys(v);
|
|
404
|
+
if (isDevMode()) {
|
|
405
|
+
for (const p of props) {
|
|
406
|
+
if (notNullOrUndefined(variables[p]) && variables[p] !== v[p]) {
|
|
407
|
+
console.warn(`Multiple filters adding the same variable with a different result. This could cause unexpected results.`);
|
|
408
|
+
break;
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
for (const p of props) {
|
|
413
|
+
variables[p] = v[p];
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
return variables;
|
|
417
|
+
}
|
|
418
|
+
function mapFilterStates(filterStates, filterStateMappers, context) {
|
|
419
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
420
|
+
const results = yield resolveMappers(filterStates, filterStateMappers, context).toPromise();
|
|
421
|
+
if (results.length === 0) {
|
|
422
|
+
return null;
|
|
423
|
+
}
|
|
424
|
+
const filters = results
|
|
425
|
+
.map(r => r.filter)
|
|
426
|
+
.filter(notNullOrUndefined);
|
|
427
|
+
const variableObjs = results
|
|
428
|
+
.map(r => r.variables)
|
|
429
|
+
.filter(notNullOrUndefined);
|
|
430
|
+
return {
|
|
431
|
+
filter: mergeFilters(filters),
|
|
432
|
+
variables: mergeVariables(variableObjs)
|
|
433
|
+
};
|
|
434
|
+
});
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Maps to a range that fetches the page before the current page, the current
|
|
439
|
+
* page, and the page after the current page.
|
|
440
|
+
*/
|
|
441
|
+
function mapPageInfo(pageInfo) {
|
|
442
|
+
const _skip = pageInfo.offset * pageInfo.pageSize;
|
|
443
|
+
const skipWithWindowOffset = _skip - pageInfo.pageSize;
|
|
444
|
+
const takeOffset = skipWithWindowOffset < 0 ? skipWithWindowOffset : 0;
|
|
445
|
+
return {
|
|
446
|
+
skip: Math.max(skipWithWindowOffset, 0),
|
|
447
|
+
take: Math.max((pageInfo.pageSize * 3) + takeOffset, 0)
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
function observeRowsWithGqlInputsHandling(queryRef, rows, datatable, extraVariables, sortsMapper, filterStateMappers) {
|
|
452
|
+
return new Observable((subscriber) => {
|
|
453
|
+
const datatable$ = wrapIntoObservable(datatable);
|
|
454
|
+
const extraVariables$ = wrapIntoObservable(extraVariables);
|
|
455
|
+
const context$ = extraVariables$.pipe(map(_extraVariables => {
|
|
456
|
+
const context = {
|
|
457
|
+
extraVariables: _extraVariables
|
|
458
|
+
};
|
|
459
|
+
return context;
|
|
460
|
+
}), shareReplay({ bufferSize: 1, refCount: true }));
|
|
461
|
+
const datatableMappers = {
|
|
462
|
+
pageInfo: mapPageInfo,
|
|
463
|
+
sorts: sortsMapper,
|
|
464
|
+
filters: filterStateMappers,
|
|
465
|
+
};
|
|
466
|
+
const datatableResults$ = _createDatatableResultsObservable(datatable$, datatableMappers, context$);
|
|
467
|
+
const queryVariablesChanged$ = datatableResults$.pipe(tap(results => {
|
|
468
|
+
var _a, _b;
|
|
469
|
+
queryRef.setVariables(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, (results.context || {})), results.pageInfo), (results.sorts.length > 0 ? { order: results.sorts } : {})), (((_a = results.filter) === null || _a === void 0 ? void 0 : _a.variables) || {})), (((_b = results.filter) === null || _b === void 0 ? void 0 : _b.filter) ? { where: results.filter.filter } : {})));
|
|
470
|
+
}));
|
|
471
|
+
// const _emitSubject = new Subject<void>()
|
|
472
|
+
// const queryVarsChangedSub = queryVariablesChanged$.pipe(
|
|
473
|
+
// switchMap(() => subscriberCount(rows, 'rows'))
|
|
474
|
+
// ).subscribe(subscriber)
|
|
475
|
+
const queryVarsChangedSub = queryVariablesChanged$.subscribe();
|
|
476
|
+
const _sub = subscriberCount(rows, 'rows').subscribe(subscriber);
|
|
477
|
+
return () => {
|
|
478
|
+
queryVarsChangedSub.unsubscribe();
|
|
479
|
+
_sub.unsubscribe();
|
|
480
|
+
};
|
|
481
|
+
});
|
|
482
|
+
// const context$ = extraVariables$.pipe(
|
|
483
|
+
// map(_extraVariables => {
|
|
484
|
+
// const context: MapperContext = {
|
|
485
|
+
// extraVariables: _extraVariables
|
|
486
|
+
// }
|
|
487
|
+
// return context
|
|
488
|
+
// })
|
|
489
|
+
// )
|
|
490
|
+
// const datatableMappers: DatatableMappers = {
|
|
491
|
+
// pageInfo: mapPageInfo,
|
|
492
|
+
// sorts: sortsMapper,
|
|
493
|
+
// filters: filterStateMappers,
|
|
494
|
+
// }
|
|
495
|
+
// const datatableResults$ = _createDatatableResultsObservable(
|
|
496
|
+
// datatable$,
|
|
497
|
+
// datatableMappers,
|
|
498
|
+
// context$,
|
|
499
|
+
// )
|
|
500
|
+
// const queryVariablesChanged$ = datatableResults$.pipe(
|
|
501
|
+
// tap(results => {
|
|
502
|
+
// queryRef.setVariables({
|
|
503
|
+
// ...(results.extraVariables || {}),
|
|
504
|
+
// ...results.pageInfo,
|
|
505
|
+
// ...(results.sorts.length > 0 ? { order: results.sorts } : {}),
|
|
506
|
+
// ...(results.filterInfo?.variables || {}),
|
|
507
|
+
// ...(results.filterInfo?.filter ? { where: results.filterInfo.filter } : {})
|
|
508
|
+
// } as any)
|
|
509
|
+
// })
|
|
510
|
+
// )
|
|
511
|
+
// const handleQueryInputs = combineLatest([ extraVariables$, pageInfo$ ]).pipe(
|
|
512
|
+
// switchMap(([ _extraVariables, pageInfo ]) => {
|
|
513
|
+
// // console.log('_extraVariables, pageInfo', _extraVariables, pageInfo)
|
|
514
|
+
// const context: MapperContext = {
|
|
515
|
+
// extraVariables: _extraVariables
|
|
516
|
+
// }
|
|
517
|
+
// return combineLatest([ sorts$, filterInfo$ ]).pipe(
|
|
518
|
+
// // map(([ sorts, filterInfo ]) => ({ extraVariables: _extraVariables, pageInfo, sorts, filterInfo }))
|
|
519
|
+
// map(([ sorts, filterInfo ]) => {
|
|
520
|
+
// // console.log('sorts, filterInfo', sorts, filterInfo)
|
|
521
|
+
// return { extraVariables: _extraVariables, pageInfo, sorts, filterInfo }
|
|
522
|
+
// })
|
|
523
|
+
// )
|
|
524
|
+
// }),
|
|
525
|
+
// tap(v => {
|
|
526
|
+
// // console.log('~~~', v)
|
|
527
|
+
// queryRef.setVariables({
|
|
528
|
+
// ...(v.extraVariables || {}),
|
|
529
|
+
// ...v.pageInfo,
|
|
530
|
+
// ...(v.sorts.length > 0 ? { order: v.sorts } : {}),
|
|
531
|
+
// ...(v.filterInfo?.variables || {}),
|
|
532
|
+
// ...(v.filterInfo?.filter ? { where: v.filterInfo.filter } : {})
|
|
533
|
+
// } as any)
|
|
534
|
+
// })
|
|
535
|
+
// )
|
|
536
|
+
// return defer(() => {
|
|
537
|
+
// const _emitted = new Subject<void>()
|
|
538
|
+
// const handlerSub = handleQueryInputs.pipe(
|
|
539
|
+
// // skip(1)
|
|
540
|
+
// // ).subscribe(() => _emitted.next())
|
|
541
|
+
// ).subscribe(() => {
|
|
542
|
+
// _emitted.next()
|
|
543
|
+
// })
|
|
544
|
+
// return _emitted.pipe(
|
|
545
|
+
// // tap(v => {
|
|
546
|
+
// // console.log('emitted', v)
|
|
547
|
+
// // }),
|
|
548
|
+
// distinctUntilChanged(),
|
|
549
|
+
// switchMap(() => subscriberCount(rows, 'rows')),
|
|
550
|
+
// // tap(v => {
|
|
551
|
+
// // console.log('emitting rows', v)
|
|
552
|
+
// // }),
|
|
553
|
+
// finalize(() => handlerSub.unsubscribe())
|
|
554
|
+
// )
|
|
555
|
+
// }).pipe(
|
|
556
|
+
// // tap(v => {
|
|
557
|
+
// // console.log('rows', v)
|
|
558
|
+
// // }),
|
|
559
|
+
// catchError(err => {
|
|
560
|
+
// console.error(err)
|
|
561
|
+
// return of([] as TRow[])
|
|
562
|
+
// }),
|
|
563
|
+
// shareReplay({ bufferSize: 1, refCount: true })
|
|
564
|
+
// )
|
|
565
|
+
}
|
|
566
|
+
function _createSortsObservable(datatable$) {
|
|
567
|
+
return datatable$.pipe(
|
|
568
|
+
// tap(v => console.log('sorts got dt', v)),
|
|
569
|
+
switchMap(dt => dt
|
|
570
|
+
? dt.sort.pipe(map(v => v.sorts), startWith(dt.sorts)) // .pipe(tap(v => console.log('sorts 1', v)))
|
|
571
|
+
: of([]) // .pipe(tap(v => console.log('sorts 2', v)))
|
|
572
|
+
), shareReplay({ bufferSize: 1, refCount: true }));
|
|
573
|
+
}
|
|
574
|
+
function _createFilterStatesObservable(datatable$) {
|
|
575
|
+
return datatable$.pipe(
|
|
576
|
+
// tap(v => console.log('filters got dt', v)),
|
|
577
|
+
switchMap(dt => dt
|
|
578
|
+
? dt.filterStates // .pipe(tap(v => console.log('filterStates 1', v)))
|
|
579
|
+
: of([]) // .pipe(tap(v => console.log('filterStates 2', v)))
|
|
580
|
+
),
|
|
581
|
+
// TODO: Remove when the datatable fixes the bug causing it to emit more than it should.
|
|
582
|
+
distinctUntilChanged((x, y) => JSON.stringify(x) === JSON.stringify(y)));
|
|
583
|
+
}
|
|
584
|
+
function _createDatatableResultsObservable(datatable$, mappers, context$) {
|
|
585
|
+
return new Observable((subscriber) => {
|
|
586
|
+
const datatableSubject = new ReplaySubject();
|
|
587
|
+
const dtSub = datatable$.subscribe(dt => datatableSubject.next(dt), err => datatableSubject.error(err), () => datatableSubject.complete());
|
|
588
|
+
const ctxSub = context$.pipe(switchMap(context => {
|
|
589
|
+
// TODO: Decide if the disabled paging feature will be reimplemented in a way
|
|
590
|
+
// that it should be considered here. `_isPagingDisabled(queryRef)`
|
|
591
|
+
const pageInfo$ = createPageInfoObservable(datatable$).pipe(map(info => mappers.pageInfo(info)));
|
|
592
|
+
const sorts$ = _createSortsObservable(datatable$).pipe(switchMap(m => wrapIntoObservable(mappers.sorts(m, context))));
|
|
593
|
+
const filterInfo$ = _createFilterStatesObservable(datatable$).pipe(switchMap(x => mapFilterStates(x, mappers.filters, context)));
|
|
594
|
+
return combineLatest([
|
|
595
|
+
pageInfo$,
|
|
596
|
+
sorts$,
|
|
597
|
+
filterInfo$,
|
|
598
|
+
]).pipe(map(([pageInfo, sorts, filterInfo]) => ({
|
|
599
|
+
pageInfo,
|
|
600
|
+
sorts,
|
|
601
|
+
filter: filterInfo,
|
|
602
|
+
context: context
|
|
603
|
+
})));
|
|
604
|
+
})).subscribe(subscriber);
|
|
605
|
+
return () => {
|
|
606
|
+
dtSub.unsubscribe();
|
|
607
|
+
ctxSub.unsubscribe();
|
|
608
|
+
};
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
// function _isPagingDisabled<TData, TVariables, TRow>(queryRef: DatatableGraphQLQueryRef<TData, TVariables, TRow>): boolean {
|
|
612
|
+
// return queryRef.getQueryProcessingConfig()?.disablePaging ?? false
|
|
613
|
+
// }
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
|
+
* Partially wraps ApolloClient's QueryRef with some of our datatable boilerplate.
|
|
617
|
+
*
|
|
618
|
+
* TODO: Decide how to handle/display errors.
|
|
619
|
+
*/
|
|
620
|
+
class DatatableGraphQLQueryRef {
|
|
621
|
+
constructor(
|
|
622
|
+
/** Original ApolloClient's QueryRef. */
|
|
623
|
+
_queryRef,
|
|
624
|
+
/**
|
|
625
|
+
* How long to wait before refetching from an update to the query or variables.
|
|
626
|
+
*/
|
|
627
|
+
_updatesPollDelay = 500) {
|
|
628
|
+
this._queryRef = _queryRef;
|
|
629
|
+
this._updatesPollDelay = _updatesPollDelay;
|
|
630
|
+
this._variablesSubject = new BehaviorSubject({});
|
|
631
|
+
this._observingChangesSubject = new BehaviorSubject(false);
|
|
632
|
+
/**
|
|
633
|
+
* Temporary way of tracking total count when paging is disabled.
|
|
634
|
+
*/
|
|
635
|
+
this._totalCount = DEFAULT_PAGE_SIZE;
|
|
636
|
+
this._variablesUpdatePending = false;
|
|
637
|
+
this._variablesSubject.next(this._queryRef.obsQuery.options.variables || {});
|
|
638
|
+
// this._getValueChanges().subscribe(v => this._logNetworkStatus(v.networkStatus))
|
|
639
|
+
this._valueChanges = defer(() => {
|
|
640
|
+
// console.log('Observing value changes')
|
|
641
|
+
const varChangesSub = this._variablesSubject.pipe(skip(1), tap(() => {
|
|
642
|
+
this._variablesUpdatePending = true;
|
|
643
|
+
}), auditTime(this._updatesPollDelay), finalize(() => {
|
|
644
|
+
// If the query stopped being observed before setting the pending
|
|
645
|
+
// variables, set them now.
|
|
646
|
+
if (this._variablesUpdatePending) {
|
|
647
|
+
this.refetch();
|
|
648
|
+
this._variablesUpdatePending = false;
|
|
649
|
+
}
|
|
650
|
+
})).subscribe(variables => {
|
|
651
|
+
// console.log('set vars', variables)
|
|
652
|
+
this._setVariablesImmediate(variables);
|
|
653
|
+
// this.refetch()
|
|
654
|
+
this._variablesUpdatePending = false;
|
|
655
|
+
});
|
|
656
|
+
this._observingChanges = true;
|
|
657
|
+
return this._queryRef.valueChanges.pipe(
|
|
658
|
+
// tap(v => {
|
|
659
|
+
// console.log('v', v)
|
|
660
|
+
// }),
|
|
661
|
+
filter(v => v.networkStatus === NetworkStatus.ready), finalize(() => {
|
|
662
|
+
// console.log('Done observing value changes')
|
|
663
|
+
varChangesSub.unsubscribe();
|
|
664
|
+
this._observingChanges = false;
|
|
665
|
+
}));
|
|
666
|
+
}).pipe(
|
|
667
|
+
// share()
|
|
668
|
+
shareReplay({ bufferSize: 1, refCount: true }));
|
|
669
|
+
this.loading$ = this._observingChangesSubject.pipe(switchMap(observingChanges => {
|
|
670
|
+
if (!observingChanges) {
|
|
671
|
+
return of(false);
|
|
672
|
+
}
|
|
673
|
+
return this._valueChanges.pipe(map(result => result.loading), startWith(this._queryRef.getCurrentResult().loading), auditTime(0), shareReplay({ bufferSize: 1, refCount: true }));
|
|
674
|
+
}));
|
|
675
|
+
}
|
|
676
|
+
get _observingChanges() { return this._observingChangesSubject.value; }
|
|
677
|
+
set _observingChanges(value) { this._observingChangesSubject.next(value); }
|
|
678
|
+
get updatesPollDelay() { return this._updatesPollDelay; }
|
|
679
|
+
get variablesUpdatePending() { return this._variablesUpdatePending; }
|
|
680
|
+
_logNetworkStatus(status) {
|
|
681
|
+
switch (status) {
|
|
682
|
+
case NetworkStatus.loading:
|
|
683
|
+
console.log('%cNetworkStatus: ', 'color:limegreen', 'Loading');
|
|
684
|
+
break;
|
|
685
|
+
case NetworkStatus.setVariables:
|
|
686
|
+
console.log('%cNetworkStatus: ', 'color:limegreen', 'SetVariables');
|
|
687
|
+
break;
|
|
688
|
+
case NetworkStatus.fetchMore:
|
|
689
|
+
console.log('%cNetworkStatus: ', 'color:limegreen', 'FetchMore');
|
|
690
|
+
break;
|
|
691
|
+
case NetworkStatus.refetch:
|
|
692
|
+
console.log('%cNetworkStatus: ', 'color:limegreen', 'Refetch');
|
|
693
|
+
break;
|
|
694
|
+
case NetworkStatus.poll:
|
|
695
|
+
console.log('%cNetworkStatus: ', 'color:limegreen', 'Poll');
|
|
696
|
+
break;
|
|
697
|
+
case NetworkStatus.ready:
|
|
698
|
+
console.log('%cNetworkStatus: ', 'color:limegreen', 'Ready');
|
|
699
|
+
break;
|
|
700
|
+
case NetworkStatus.error:
|
|
701
|
+
console.log('%cNetworkStatus: ', 'color:limegreen', 'Error');
|
|
702
|
+
break;
|
|
703
|
+
default: console.log('%cNetworkStatus: ', 'color:red', 'Unknown');
|
|
704
|
+
}
|
|
705
|
+
}
|
|
706
|
+
rows(mapper) {
|
|
707
|
+
return this._rowsObservable(mapper);
|
|
708
|
+
}
|
|
709
|
+
_rowsObservable(mapper) {
|
|
710
|
+
return new Observable((subscriber) => {
|
|
711
|
+
// const rowsBufferSubject = new BehaviorSubject<TRow[]>([])
|
|
712
|
+
// console.log('obs _rowsObservable')
|
|
713
|
+
let rowsBuffer = [];
|
|
714
|
+
// const rowsBufferSubject = new ReplaySubject<TRow[]>()
|
|
715
|
+
const rowsBufferSubject = new Subject();
|
|
716
|
+
const querySub = this._valueChanges.pipe(switchMap(result => {
|
|
717
|
+
if (result.data === undefined) {
|
|
718
|
+
return of([]);
|
|
719
|
+
}
|
|
720
|
+
return this._resolveRowMapper(mapper(result.data)).pipe(tap(mapperResult => {
|
|
721
|
+
var _a, _b;
|
|
722
|
+
// console.log('mapperResult', mapperResult)
|
|
723
|
+
if (this._needsToRequeryWithAllRecords(mapperResult)) {
|
|
724
|
+
this.patchVariables({ take: mapperResult.totalCount });
|
|
725
|
+
}
|
|
726
|
+
if (hasProperty(mapperResult, 'totalCount')) {
|
|
727
|
+
this._totalCount = mapperResult.totalCount;
|
|
728
|
+
}
|
|
729
|
+
// let rows = rowsBufferSubject.value || []
|
|
730
|
+
let rows = rowsBuffer || [];
|
|
731
|
+
const hasTotalCount = mapperResult.totalCount !== undefined && mapperResult.totalCount !== null;
|
|
732
|
+
// If the rows buffer is not the same size as the totalCount, create a
|
|
733
|
+
// new buffer.
|
|
734
|
+
//
|
|
735
|
+
// TODO: Find out if this is resetting the buffer too eagerly.
|
|
736
|
+
// ApolloClient may have a better solution.
|
|
737
|
+
if (hasTotalCount) {
|
|
738
|
+
if (mapperResult.totalCount !== rows.length) {
|
|
739
|
+
rows = new Array(mapperResult.totalCount || 0);
|
|
740
|
+
}
|
|
741
|
+
let startIndex = (_a = this.getVariables().skip) !== null && _a !== void 0 ? _a : 0;
|
|
742
|
+
if ((_b = this.getQueryProcessingConfig()) === null || _b === void 0 ? void 0 : _b.disablePaging) {
|
|
743
|
+
startIndex = 0;
|
|
744
|
+
}
|
|
745
|
+
// Insert rows into buffer location.
|
|
746
|
+
rows.splice(startIndex, mapperResult.rows.length, ...mapperResult.rows);
|
|
747
|
+
rows = [...rows];
|
|
748
|
+
}
|
|
749
|
+
else {
|
|
750
|
+
rows = [...mapperResult.rows];
|
|
751
|
+
}
|
|
752
|
+
rowsBuffer = rows;
|
|
753
|
+
rowsBufferSubject.next(rows);
|
|
754
|
+
}));
|
|
755
|
+
})).subscribe();
|
|
756
|
+
const rowsSub = rowsBufferSubject.subscribe(subscriber);
|
|
757
|
+
return () => {
|
|
758
|
+
// console.log('unsub')
|
|
759
|
+
querySub.unsubscribe();
|
|
760
|
+
rowsSub.unsubscribe();
|
|
761
|
+
rowsBufferSubject.next([]);
|
|
762
|
+
rowsBufferSubject.complete();
|
|
763
|
+
};
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
_needsToRequeryWithAllRecords(data) {
|
|
767
|
+
var _a;
|
|
768
|
+
if (!((_a = this.getQueryProcessingConfig()) === null || _a === void 0 ? void 0 : _a.disablePaging)) {
|
|
769
|
+
return false;
|
|
770
|
+
}
|
|
771
|
+
return hasProperty(data, 'totalCount') &&
|
|
772
|
+
hasProperty(data, 'rows') &&
|
|
773
|
+
Array.isArray(data.rows) &&
|
|
774
|
+
data.totalCount > data.rows.length &&
|
|
775
|
+
this._totalCount !== data.totalCount;
|
|
776
|
+
}
|
|
777
|
+
_resolveRowMapper(mapperReturn) {
|
|
778
|
+
if (isObservable(mapperReturn)) {
|
|
779
|
+
return mapperReturn.pipe(take(1));
|
|
780
|
+
}
|
|
781
|
+
return from(Promise.resolve(mapperReturn));
|
|
782
|
+
}
|
|
783
|
+
getVariables() {
|
|
784
|
+
// The types aren't accurate or Apollo has a bug, so I had to use `any`.
|
|
785
|
+
// return (this._queryRef as any).obsQuery.options.variables || {}
|
|
786
|
+
// TODO: Look into debouncing our variable setting, while still depending on Apollo for managing them.
|
|
787
|
+
return this._variablesSubject.value;
|
|
788
|
+
}
|
|
789
|
+
_setVariablesImmediate(variables) {
|
|
790
|
+
const _vars = this._withVariableOverrides(variables);
|
|
791
|
+
return this._queryRef.setVariables(_vars || {});
|
|
792
|
+
}
|
|
793
|
+
_patchVariablesImmediate(variables) {
|
|
794
|
+
const _variables = Object.assign(Object.assign({}, this.getVariables()), variables);
|
|
795
|
+
const _vars = this._withVariableOverrides(_variables);
|
|
796
|
+
return this._queryRef.setVariables(_vars || {});
|
|
797
|
+
}
|
|
798
|
+
setVariables(variables) {
|
|
799
|
+
this._variablesSubject.next(variables);
|
|
800
|
+
if (!this._observingChanges) {
|
|
801
|
+
this._setVariablesImmediate(variables);
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
patchVariables(variables) {
|
|
805
|
+
const _variables = Object.assign(Object.assign({}, this.getVariables()), variables);
|
|
806
|
+
this._variablesSubject.next(_variables);
|
|
807
|
+
if (!this._observingChanges) {
|
|
808
|
+
this._setVariablesImmediate(_variables);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
refetch(variables) {
|
|
812
|
+
const _vars = this._withVariableOverrides(variables);
|
|
813
|
+
return this._queryRef.refetch(_vars);
|
|
814
|
+
}
|
|
815
|
+
setQuery(query, triggerRefetch = false) {
|
|
816
|
+
this._queryRef.setOptions({ query });
|
|
817
|
+
if (triggerRefetch) {
|
|
818
|
+
// TODO: Consider refactoring the refetch process. I can't call Apollo's
|
|
819
|
+
// refetch directly, because I want it to share the update triggered
|
|
820
|
+
// polling delay with the setting of variables.
|
|
821
|
+
// this._queryRef.refetch(this.getVariables())
|
|
822
|
+
// Fake variables update to trigger a refetch that shares it's refetch delay.
|
|
823
|
+
this.setVariables(this.getVariables());
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
getOptions() {
|
|
827
|
+
return this._queryRef.obsQuery.options;
|
|
828
|
+
}
|
|
829
|
+
getQueryProcessingConfig() {
|
|
830
|
+
var _a, _b;
|
|
831
|
+
return (_b = (_a = this.getOptions()) === null || _a === void 0 ? void 0 : _a.context) === null || _b === void 0 ? void 0 : _b.queryProcessingConfig;
|
|
832
|
+
}
|
|
833
|
+
_withVariableOverrides(variables) {
|
|
834
|
+
var _a, _b;
|
|
835
|
+
if (!notNullOrUndefined(variables) && !((_a = this.getQueryProcessingConfig()) === null || _a === void 0 ? void 0 : _a.disablePaging)) {
|
|
836
|
+
return undefined;
|
|
837
|
+
}
|
|
838
|
+
const _vars = Object.assign({}, (variables || {}));
|
|
839
|
+
if ((_b = this.getQueryProcessingConfig()) === null || _b === void 0 ? void 0 : _b.disablePaging) {
|
|
840
|
+
_vars.take = this._totalCount;
|
|
841
|
+
}
|
|
842
|
+
return _vars;
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
const DATATABLE_GRAPHQL_SERVICE_CONFIG = new InjectionToken('DATATABLE_GRAPHQL_SERVICE_CONFIG');
|
|
847
|
+
const _CONFIG_DEFAULTS = {
|
|
848
|
+
pollingIntervalTime: 1 * 60 * 1000
|
|
849
|
+
};
|
|
850
|
+
class DatatableGraphqlService {
|
|
851
|
+
constructor(_apollo, _config) {
|
|
852
|
+
this._apollo = _apollo;
|
|
853
|
+
this._config = Object.assign(Object.assign({}, _CONFIG_DEFAULTS), (_config || {}));
|
|
854
|
+
}
|
|
855
|
+
watchQuery(options, queryProcessingConfig) {
|
|
856
|
+
var _a;
|
|
857
|
+
const _options = Object.assign(Object.assign(Object.assign({ useInitialLoading: true }, _CONFIG_DEFAULTS), { pollInterval: this._config.pollingIntervalTime }), options);
|
|
858
|
+
if (queryProcessingConfig) {
|
|
859
|
+
_options.context = Object.assign(Object.assign({}, (_options.context || {})), { queryProcessingConfig: Object.assign(Object.assign({}, (((_a = _options.context) === null || _a === void 0 ? void 0 : _a.queryProcessingConfig) || {})), queryProcessingConfig) });
|
|
860
|
+
}
|
|
861
|
+
const queryRef = this._apollo.watchQuery(_options);
|
|
862
|
+
return new DatatableGraphQLQueryRef(queryRef);
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
DatatableGraphqlService.ɵprov = i0.ɵɵdefineInjectable({ factory: function DatatableGraphqlService_Factory() { return new DatatableGraphqlService(i0.ɵɵinject(i1.Apollo), i0.ɵɵinject(DATATABLE_GRAPHQL_SERVICE_CONFIG, 8)); }, token: DatatableGraphqlService, providedIn: "root" });
|
|
866
|
+
DatatableGraphqlService.decorators = [
|
|
867
|
+
{ type: Injectable, args: [{
|
|
868
|
+
providedIn: 'root'
|
|
869
|
+
},] }
|
|
870
|
+
];
|
|
871
|
+
DatatableGraphqlService.ctorParameters = () => [
|
|
872
|
+
{ type: Apollo },
|
|
873
|
+
{ type: undefined, decorators: [{ type: Optional }, { type: Inject, args: [DATATABLE_GRAPHQL_SERVICE_CONFIG,] }] }
|
|
874
|
+
];
|
|
875
|
+
|
|
326
876
|
/**
|
|
327
877
|
* Generated bundle index. Do not edit.
|
|
328
878
|
*/
|
|
329
879
|
|
|
330
|
-
export { HINT_NAMES_CAPTURE_REGEX, HINT_PREFIX_REGEX, containsVariable, createHintsToken, getHintsToken, getTokenAppliesTo, gqlVar, hintNamesFromHintToken, hintsTokensContainingHint, inlineVariable, isCommentToken, isHintToken, isInlineComment, parseAst, parseComments, parseHints, removeVariable, removeVariableDefinition, removeVariableDefinitionsNotDefined, toGQL };
|
|
880
|
+
export { DATATABLE_GRAPHQL_SERVICE_CONFIG, DEFAULT_PAGE_SIZE, DatatableGraphQLQueryRef, DatatableGraphqlService, HINT_NAMES_CAPTURE_REGEX, HINT_PREFIX_REGEX, containsVariable, createHintsToken, getHintsToken, getPageInfo, getTokenAppliesTo, gqlVar, hintNamesFromHintToken, hintsTokensContainingHint, inlineVariable, isCommentToken, isHintToken, isInlineComment, mapFilterStates, observeRowsWithGqlInputsHandling, parseAst, parseComments, parseHints, removeVariable, removeVariableDefinition, removeVariableDefinitionsNotDefined, toGQL };
|
|
331
881
|
//# sourceMappingURL=theseam-ui-common-graphql.js.map
|