@theseam/ui-common 0.2.11 → 0.2.15

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.
Files changed (352) hide show
  1. package/assets/vendor/intl-tel-input/js/utils.js +255 -254
  2. package/bundles/theseam-ui-common-asset-reader.umd.js +7 -9
  3. package/bundles/theseam-ui-common-asset-reader.umd.js.map +1 -1
  4. package/bundles/theseam-ui-common-breadcrumbs.umd.js +6 -8
  5. package/bundles/theseam-ui-common-breadcrumbs.umd.js.map +1 -1
  6. package/bundles/theseam-ui-common-buttons.umd.js +5 -5
  7. package/bundles/theseam-ui-common-buttons.umd.js.map +1 -1
  8. package/bundles/theseam-ui-common-card.umd.js +6 -6
  9. package/bundles/theseam-ui-common-card.umd.js.map +1 -1
  10. package/bundles/theseam-ui-common-checkbox.umd.js +4 -4
  11. package/bundles/theseam-ui-common-checkbox.umd.js.map +1 -1
  12. package/bundles/theseam-ui-common-confirm-dialog.umd.js +4 -4
  13. package/bundles/theseam-ui-common-confirm-dialog.umd.js.map +1 -1
  14. package/bundles/theseam-ui-common-core.umd.js +4 -4
  15. package/bundles/theseam-ui-common-core.umd.js.map +1 -1
  16. package/bundles/theseam-ui-common-data-exporter.umd.js +5 -5
  17. package/bundles/theseam-ui-common-data-filters.umd.js +9 -6
  18. package/bundles/theseam-ui-common-data-filters.umd.js.map +1 -1
  19. package/bundles/theseam-ui-common-datatable-dynamic.umd.js +7 -7
  20. package/bundles/theseam-ui-common-datatable-dynamic.umd.js.map +1 -1
  21. package/bundles/theseam-ui-common-datatable.umd.js +1314 -378
  22. package/bundles/theseam-ui-common-datatable.umd.js.map +1 -1
  23. package/bundles/theseam-ui-common-dynamic-component-loader.umd.js +5 -7
  24. package/bundles/theseam-ui-common-dynamic-component-loader.umd.js.map +1 -1
  25. package/bundles/theseam-ui-common-dynamic.umd.js +7 -9
  26. package/bundles/theseam-ui-common-dynamic.umd.js.map +1 -1
  27. package/bundles/theseam-ui-common-footer-bar.umd.js +3 -3
  28. package/bundles/theseam-ui-common-form-field-error.umd.js +5 -5
  29. package/bundles/theseam-ui-common-form-field-error.umd.js.map +1 -1
  30. package/bundles/theseam-ui-common-form-field.umd.js +5 -5
  31. package/bundles/theseam-ui-common-form-field.umd.js.map +1 -1
  32. package/bundles/theseam-ui-common-framework.umd.js +27 -29
  33. package/bundles/theseam-ui-common-framework.umd.js.map +1 -1
  34. package/bundles/theseam-ui-common-graphql.umd.js +958 -8
  35. package/bundles/theseam-ui-common-graphql.umd.js.map +1 -1
  36. package/bundles/theseam-ui-common-icon.umd.js +5 -5
  37. package/bundles/theseam-ui-common-icon.umd.js.map +1 -1
  38. package/bundles/theseam-ui-common-layout.umd.js +5 -7
  39. package/bundles/theseam-ui-common-layout.umd.js.map +1 -1
  40. package/bundles/theseam-ui-common-loading.umd.js +4 -4
  41. package/bundles/theseam-ui-common-menu.umd.js +5 -5
  42. package/bundles/theseam-ui-common-menu.umd.js.map +1 -1
  43. package/bundles/theseam-ui-common-modal.umd.js +6 -6
  44. package/bundles/theseam-ui-common-modal.umd.js.map +1 -1
  45. package/bundles/theseam-ui-common-models.umd.js +3 -3
  46. package/bundles/theseam-ui-common-popover.umd.js +4 -4
  47. package/bundles/theseam-ui-common-progress.umd.js +5 -5
  48. package/bundles/theseam-ui-common-progress.umd.js.map +1 -1
  49. package/bundles/theseam-ui-common-scrollbar.umd.js +7 -9
  50. package/bundles/theseam-ui-common-scrollbar.umd.js.map +1 -1
  51. package/bundles/theseam-ui-common-services.umd.js +6 -8
  52. package/bundles/theseam-ui-common-services.umd.js.map +1 -1
  53. package/bundles/theseam-ui-common-shared.umd.js +4 -4
  54. package/bundles/theseam-ui-common-shared.umd.js.map +1 -1
  55. package/bundles/theseam-ui-common-storage.umd.js +5 -7
  56. package/bundles/theseam-ui-common-storage.umd.js.map +1 -1
  57. package/bundles/theseam-ui-common-story-helpers.umd.js +4 -4
  58. package/bundles/theseam-ui-common-story-helpers.umd.js.map +1 -1
  59. package/bundles/theseam-ui-common-tabbed.umd.js +5 -5
  60. package/bundles/theseam-ui-common-tabbed.umd.js.map +1 -1
  61. package/bundles/theseam-ui-common-table-cell-type.umd.js +5 -7
  62. package/bundles/theseam-ui-common-table-cell-type.umd.js.map +1 -1
  63. package/bundles/theseam-ui-common-table-cell-types.umd.js +258 -32
  64. package/bundles/theseam-ui-common-table-cell-types.umd.js.map +1 -1
  65. package/bundles/theseam-ui-common-table.umd.js +5 -5
  66. package/bundles/theseam-ui-common-table.umd.js.map +1 -1
  67. package/bundles/theseam-ui-common-tel-input.umd.js +6 -6
  68. package/bundles/theseam-ui-common-tel-input.umd.js.map +1 -1
  69. package/bundles/theseam-ui-common-testing.umd.js +568 -0
  70. package/bundles/theseam-ui-common-testing.umd.js.map +1 -0
  71. package/bundles/theseam-ui-common-tiled-select.umd.js +56 -39
  72. package/bundles/theseam-ui-common-tiled-select.umd.js.map +1 -1
  73. package/bundles/theseam-ui-common-toggle-edit.umd.js +8 -10
  74. package/bundles/theseam-ui-common-toggle-edit.umd.js.map +1 -1
  75. package/bundles/theseam-ui-common-toggle-group.umd.js +4 -4
  76. package/bundles/theseam-ui-common-toggle-group.umd.js.map +1 -1
  77. package/bundles/theseam-ui-common-unsaved-changes-dialog.umd.js +5 -7
  78. package/bundles/theseam-ui-common-unsaved-changes-dialog.umd.js.map +1 -1
  79. package/bundles/theseam-ui-common-utils.umd.js +174 -81
  80. package/bundles/theseam-ui-common-utils.umd.js.map +1 -1
  81. package/bundles/theseam-ui-common-validators.umd.js +3 -3
  82. package/bundles/theseam-ui-common-viewers.umd.js +6 -8
  83. package/bundles/theseam-ui-common-viewers.umd.js.map +1 -1
  84. package/bundles/theseam-ui-common-widget.umd.js +18 -20
  85. package/bundles/theseam-ui-common-widget.umd.js.map +1 -1
  86. package/bundles/theseam-ui-common.umd.js +2 -2
  87. package/buttons/theseam-ui-common-buttons.metadata.json +1 -1
  88. package/card/theseam-ui-common-card.metadata.json +1 -1
  89. package/data-filters/data-filter.d.ts +10 -6
  90. package/data-filters/theseam-ui-common-data-filters.metadata.json +1 -1
  91. package/datatable/datatable/datatable.component.d.ts +46 -32
  92. package/datatable/datatable-column/datatable-column.component.d.ts +26 -25
  93. package/datatable/datatable-column-preferences/datatable-column-preferences.component.d.ts +7 -5
  94. package/datatable/datatable-column-preferences-button/datatable-column-preferences-button.component.d.ts +7 -1
  95. package/datatable/datatable-menu-bar/datatable-menu-bar.component.d.ts +1 -1
  96. package/datatable/directives/datatable-filter.directive.d.ts +1 -1
  97. package/datatable/models/columns-alteration.d.ts +61 -0
  98. package/datatable/models/columns-alterations/hide-column.columns-alteration.d.ts +15 -0
  99. package/datatable/models/columns-alterations/order.columns-alteration.d.ts +20 -0
  100. package/datatable/models/columns-alterations/sort.columns-alteration.d.ts +14 -0
  101. package/datatable/models/columns-alterations/width.columns-alteration.d.ts +16 -0
  102. package/datatable/models/datatable-accessor.d.ts +5 -3
  103. package/datatable/models/internal-column-props.d.ts +7 -0
  104. package/datatable/models/page-info.d.ts +12 -0
  105. package/datatable/models/preferences-accessor.d.ts +1 -1
  106. package/datatable/models/preferences.d.ts +11 -3
  107. package/datatable/models/sort-item.d.ts +2 -1
  108. package/datatable/services/columns-alterations-manager.service.d.ts +39 -0
  109. package/datatable/services/columns-manager.service.d.ts +55 -0
  110. package/datatable/services/datatable-preferences.service.d.ts +10 -7
  111. package/datatable/theseam-ui-common-datatable.d.ts +2 -0
  112. package/datatable/theseam-ui-common-datatable.metadata.json +1 -1
  113. package/datatable/tokens/datatable-preferences-accessor.d.ts +2 -2
  114. package/datatable/utils/create-action-menu-column.d.ts +3 -0
  115. package/datatable/utils/create-checkbox-column.d.ts +3 -0
  116. package/datatable/utils/get-column-prop.d.ts +5 -0
  117. package/datatable/utils/map-columns-alterations-states.d.ts +2 -0
  118. package/datatable/utils/remove-unused-diffs.d.ts +7 -0
  119. package/datatable/utils/set-column-defaults.d.ts +2 -0
  120. package/datatable/utils/translate-templates.d.ts +2 -0
  121. package/datatable/utils/with-stored-column-info.d.ts +2 -2
  122. package/datatable-dynamic/theseam-ui-common-datatable-dynamic.metadata.json +1 -1
  123. package/esm2015/buttons/progress-circle-button/progress-circle-button.component.js +1 -1
  124. package/esm2015/card/card-action/card-action.component.js +1 -1
  125. package/esm2015/card/card-body/card-body.component.js +1 -1
  126. package/esm2015/data-filters/data-filter.js +5 -2
  127. package/esm2015/data-filters/filters/data-filter-search/data-filter-search.component.js +1 -1
  128. package/esm2015/data-filters/filters/data-filter-text/data-filter-text.component.js +1 -1
  129. package/esm2015/datatable/datatable/datatable.component.js +195 -211
  130. package/esm2015/datatable/datatable-action-menu/datatable-action-menu.component.js +1 -1
  131. package/esm2015/datatable/datatable-column/datatable-column.component.js +1 -1
  132. package/esm2015/datatable/datatable-column-preferences/datatable-column-preferences.component.js +42 -19
  133. package/esm2015/datatable/datatable-column-preferences-button/datatable-column-preferences-button.component.js +38 -4
  134. package/esm2015/datatable/datatable-export-button/datatable-export-button.component.js +9 -6
  135. package/esm2015/datatable/datatable-menu-bar/datatable-menu-bar.component.js +1 -1
  136. package/esm2015/datatable/datatable-menu-bar-column-center/datatable-menu-bar-column-center.component.js +1 -1
  137. package/esm2015/datatable/datatable-menu-bar-column-left/datatable-menu-bar-column-left.component.js +1 -1
  138. package/esm2015/datatable/datatable-menu-bar-column-right/datatable-menu-bar-column-right.component.js +1 -1
  139. package/esm2015/datatable/datatable-menu-bar-row/datatable-menu-bar-row.component.js +1 -1
  140. package/esm2015/datatable/models/columns-alteration.js +38 -0
  141. package/esm2015/datatable/models/columns-alterations/hide-column.columns-alteration.js +38 -0
  142. package/esm2015/datatable/models/columns-alterations/order.columns-alteration.js +81 -0
  143. package/esm2015/datatable/models/columns-alterations/sort.columns-alteration.js +33 -0
  144. package/esm2015/datatable/models/columns-alterations/width.columns-alteration.js +41 -0
  145. package/esm2015/datatable/models/datatable-accessor.js +1 -1
  146. package/esm2015/datatable/models/internal-column-props.js +15 -0
  147. package/esm2015/datatable/models/page-info.js +1 -1
  148. package/esm2015/datatable/models/preferences-accessor.js +1 -1
  149. package/esm2015/datatable/models/preferences.js +6 -2
  150. package/esm2015/datatable/models/sort-item.js +1 -1
  151. package/esm2015/datatable/services/columns-alterations-manager.service.js +134 -0
  152. package/esm2015/datatable/services/columns-manager.service.js +257 -0
  153. package/esm2015/datatable/services/datatable-preferences.service.js +78 -32
  154. package/esm2015/datatable/theseam-ui-common-datatable.js +3 -1
  155. package/esm2015/datatable/tokens/datatable-preferences-accessor.js +2 -2
  156. package/esm2015/datatable/utils/create-action-menu-column.js +18 -0
  157. package/esm2015/datatable/utils/create-checkbox-column.js +15 -0
  158. package/esm2015/datatable/utils/get-column-prop.js +9 -0
  159. package/esm2015/datatable/utils/map-columns-alterations-states.js +39 -0
  160. package/esm2015/datatable/utils/remove-unused-diffs.js +9 -0
  161. package/esm2015/datatable/utils/set-column-defaults.js +10 -0
  162. package/esm2015/datatable/utils/translate-templates.js +12 -0
  163. package/esm2015/datatable/utils/with-stored-column-info.js +1 -1
  164. package/esm2015/datatable-dynamic/datatable-dynamic-action-menu/datatable-dynamic-action-menu.component.js +1 -1
  165. package/esm2015/datatable-dynamic/datatable-dynamic-filter-container/datatable-dynamic-filter-container.component.js +1 -1
  166. package/esm2015/datatable-dynamic/datatable-dynamic.component.js +1 -1
  167. package/esm2015/form-field/form-field.component.js +1 -1
  168. package/esm2015/form-field-error/form-field-error/form-field-error.component.js +1 -1
  169. package/esm2015/framework/base-layout/base-layout.component.js +1 -1
  170. package/esm2015/framework/dashboard/dashboard-widgets/dashboard-widgets.component.js +1 -1
  171. package/esm2015/framework/dynamic-router/hierarchy-router-outlet/hierarchy-router-outlet.component.js +1 -1
  172. package/esm2015/framework/schema-form-controls/schema-form-input/schema-form-input.component.js +1 -1
  173. package/esm2015/framework/schema-form-controls/schema-form-number/schema-form-number.component.js +1 -1
  174. package/esm2015/framework/schema-form-controls/schema-form-select/schema-form-select.component.js +1 -1
  175. package/esm2015/framework/schema-form-controls/schema-form-submit-split/schema-form-submit-split.component.js +1 -1
  176. package/esm2015/framework/side-nav/side-nav-item/side-nav-item.component.js +1 -1
  177. package/esm2015/framework/side-nav/side-nav-toggle/side-nav-toggle.component.js +1 -1
  178. package/esm2015/framework/side-nav/side-nav.component.js +1 -1
  179. package/esm2015/framework/top-bar/top-bar-menu-button/top-bar-menu-button.component.js +1 -1
  180. package/esm2015/framework/top-bar/top-bar-title/top-bar-title.component.js +1 -1
  181. package/esm2015/framework/top-bar/top-bar.component.js +1 -1
  182. package/esm2015/graphql/datatable/create-page-info-observable.js +38 -0
  183. package/esm2015/graphql/datatable/datatable-graphql-query-ref.js +236 -0
  184. package/esm2015/graphql/datatable/datatable-graphql.service.js +35 -0
  185. package/esm2015/graphql/datatable/datatable-helpers.js +170 -0
  186. package/esm2015/graphql/datatable/get-page-info.js +11 -0
  187. package/esm2015/graphql/datatable/index.js +7 -0
  188. package/esm2015/graphql/datatable/map-filter-states.js +64 -0
  189. package/esm2015/graphql/datatable/map-page-info.js +14 -0
  190. package/esm2015/graphql/datatable/mapper-context.js +2 -0
  191. package/esm2015/graphql/models/gql-datatable-accessor.js +2 -0
  192. package/esm2015/graphql/models/index.js +2 -1
  193. package/esm2015/graphql/models/query-processing-config.js +1 -1
  194. package/esm2015/graphql/public-api.js +2 -1
  195. package/esm2015/graphql/utils/parse-hints.js +3 -3
  196. package/esm2015/icon/icon/icon.component.js +1 -1
  197. package/esm2015/loading/loading/loading.component.js +1 -1
  198. package/esm2015/menu/menu.component.js +1 -1
  199. package/esm2015/modal/modal-body/modal-body.component.js +1 -1
  200. package/esm2015/modal/modal-container/modal-container.component.js +1 -1
  201. package/esm2015/popover/popover/popover.component.js +1 -1
  202. package/esm2015/progress/progress-circle/progress-circle.component.js +1 -1
  203. package/esm2015/tabbed/tabbed.component.js +1 -1
  204. package/esm2015/table/table/table.component.js +1 -1
  205. package/esm2015/table-cell-types/public-api.js +8 -1
  206. package/esm2015/table-cell-types/table-cell-type-currency/table-cell-type-currency-config.js +2 -0
  207. package/esm2015/table-cell-types/table-cell-type-currency/table-cell-type-currency.component.js +74 -0
  208. package/esm2015/table-cell-types/table-cell-type-currency/table-cell-type-currency.js +2 -0
  209. package/esm2015/table-cell-types/table-cell-type-decimal/table-cell-type-decimal-config.js +1 -1
  210. package/esm2015/table-cell-types/table-cell-type-decimal/table-cell-type-decimal.component.js +73 -0
  211. package/esm2015/table-cell-types/table-cell-type-decimal/table-cell-type-decimal.js +2 -0
  212. package/esm2015/table-cell-types/table-cell-type-icon/table-cell-type-icon.component.js +1 -1
  213. package/esm2015/table-cell-types/table-cell-type-integer/table-cell-type-integer-config.js +1 -1
  214. package/esm2015/table-cell-types/table-cell-type-integer/table-cell-type-integer.component.js +71 -0
  215. package/esm2015/table-cell-types/table-cell-type-integer/table-cell-type-integer.js +2 -0
  216. package/esm2015/table-cell-types/table-cell-type-manifests.js +29 -17
  217. package/esm2015/table-cell-types/table-cell-type-progress-circle/table-cell-type-progress-circle.component.js +1 -1
  218. package/esm2015/table-cell-types/table-cell-types.module.js +9 -2
  219. package/esm2015/tel-input/tel-input/tel-input.component.js +1 -1
  220. package/esm2015/testing/current-tick-time.js +16 -0
  221. package/esm2015/testing/fake-toastr.js +29 -0
  222. package/esm2015/testing/get-harness.js +16 -0
  223. package/esm2015/testing/public-api.js +7 -0
  224. package/esm2015/testing/render-story.js +12 -0
  225. package/esm2015/testing/story-expect.js +39 -0
  226. package/esm2015/testing/theseam-ui-common-testing.js +5 -0
  227. package/esm2015/testing/tick-helper.js +74 -0
  228. package/esm2015/tiled-select/components/tiled-select/tiled-select.component.js +25 -17
  229. package/esm2015/tiled-select/components/tiled-select-tile/tiled-select-tile.component.js +5 -2
  230. package/esm2015/tiled-select/components/tiled-select-tile-icon/tiled-select-tile-icon.component.js +1 -1
  231. package/esm2015/tiled-select/public-api.js +2 -1
  232. package/esm2015/tiled-select/tiled-select.models.js +1 -1
  233. package/esm2015/tiled-select/tiled-select.module.js +4 -4
  234. package/esm2015/toggle-edit/toggle-edit-actions-container/toggle-edit-actions-container.component.js +1 -1
  235. package/esm2015/toggle-edit/toggle-edit.component.js +1 -1
  236. package/esm2015/utils/array-move.js +62 -0
  237. package/esm2015/utils/public-api.js +2 -1
  238. package/esm2015/utils/router/is-empty-url-route.js +1 -1
  239. package/esm2015/utils/subscriber-count.js +31 -4
  240. package/esm2015/widget/widget/widget.component.js +1 -1
  241. package/esm2015/widget/widget-content-components/widget-button-group/widget-button-group.component.js +1 -1
  242. package/esm2015/widget/widget-content-components/widget-content-header/widget-content-header.component.js +1 -1
  243. package/esm2015/widget/widget-content-components/widget-empty-label/widget-empty-label.component.js +1 -1
  244. package/esm2015/widget/widget-content-components/widget-footer-link/widget-footer-link.component.js +1 -1
  245. package/esm2015/widget/widget-content-components/widget-footer-text/widget-footer-text.component.js +1 -1
  246. package/esm2015/widget/widget-content-components/widget-header-badge/widget-header-badge.component.js +1 -1
  247. package/esm2015/widget/widget-content-components/widget-tile/widget-tile-footer-item/widget-tile-footer-item.component.js +1 -1
  248. package/esm2015/widget/widget-content-components/widget-tile/widget-tile-group/widget-tile-group.component.js +1 -1
  249. package/esm2015/widget/widget-content-components/widget-tile/widget-tile.component.js +1 -1
  250. package/esm2015/widget/widget-content-components/widget-tile-list/widget-tile-list.component.js +1 -1
  251. package/esm2015/widget/widget-footer/widget-footer.component.js +1 -1
  252. package/fesm2015/theseam-ui-common-buttons.js +1 -1
  253. package/fesm2015/theseam-ui-common-card.js +2 -2
  254. package/fesm2015/theseam-ui-common-data-filters.js +6 -3
  255. package/fesm2015/theseam-ui-common-data-filters.js.map +1 -1
  256. package/fesm2015/theseam-ui-common-datatable-dynamic.js +3 -3
  257. package/fesm2015/theseam-ui-common-datatable.js +1106 -319
  258. package/fesm2015/theseam-ui-common-datatable.js.map +1 -1
  259. package/fesm2015/theseam-ui-common-form-field-error.js +1 -1
  260. package/fesm2015/theseam-ui-common-form-field.js +1 -1
  261. package/fesm2015/theseam-ui-common-framework.js +13 -13
  262. package/fesm2015/theseam-ui-common-graphql.js +555 -5
  263. package/fesm2015/theseam-ui-common-graphql.js.map +1 -1
  264. package/fesm2015/theseam-ui-common-icon.js +1 -1
  265. package/fesm2015/theseam-ui-common-loading.js +1 -1
  266. package/fesm2015/theseam-ui-common-menu.js +1 -1
  267. package/fesm2015/theseam-ui-common-modal.js +2 -2
  268. package/fesm2015/theseam-ui-common-popover.js +1 -1
  269. package/fesm2015/theseam-ui-common-progress.js +1 -1
  270. package/fesm2015/theseam-ui-common-tabbed.js +1 -1
  271. package/fesm2015/theseam-ui-common-table-cell-types.js +234 -22
  272. package/fesm2015/theseam-ui-common-table-cell-types.js.map +1 -1
  273. package/fesm2015/theseam-ui-common-table.js +1 -1
  274. package/fesm2015/theseam-ui-common-tel-input.js +1 -1
  275. package/fesm2015/theseam-ui-common-testing.js +191 -0
  276. package/fesm2015/theseam-ui-common-testing.js.map +1 -0
  277. package/fesm2015/theseam-ui-common-tiled-select.js +34 -21
  278. package/fesm2015/theseam-ui-common-tiled-select.js.map +1 -1
  279. package/fesm2015/theseam-ui-common-toggle-edit.js +2 -2
  280. package/fesm2015/theseam-ui-common-utils.js +92 -4
  281. package/fesm2015/theseam-ui-common-utils.js.map +1 -1
  282. package/fesm2015/theseam-ui-common-widget.js +12 -12
  283. package/form-field/theseam-ui-common-form-field.metadata.json +1 -1
  284. package/form-field-error/theseam-ui-common-form-field-error.metadata.json +1 -1
  285. package/framework/theseam-ui-common-framework.metadata.json +1 -1
  286. package/graphql/datatable/create-page-info-observable.d.ts +4 -0
  287. package/graphql/datatable/datatable-graphql-query-ref.d.ts +65 -0
  288. package/graphql/datatable/datatable-graphql.service.d.ts +26 -0
  289. package/graphql/datatable/datatable-helpers.d.ts +12 -0
  290. package/graphql/datatable/get-page-info.d.ts +4 -0
  291. package/graphql/datatable/index.d.ts +6 -0
  292. package/graphql/datatable/map-filter-states.d.ts +18 -0
  293. package/graphql/datatable/map-page-info.d.ts +11 -0
  294. package/graphql/datatable/mapper-context.d.ts +6 -0
  295. package/graphql/models/gql-datatable-accessor.d.ts +9 -0
  296. package/graphql/models/index.d.ts +1 -0
  297. package/graphql/models/query-processing-config.d.ts +4 -0
  298. package/graphql/public-api.d.ts +1 -0
  299. package/graphql/theseam-ui-common-graphql.metadata.json +1 -1
  300. package/icon/theseam-ui-common-icon.metadata.json +1 -1
  301. package/loading/theseam-ui-common-loading.metadata.json +1 -1
  302. package/menu/theseam-ui-common-menu.metadata.json +1 -1
  303. package/modal/theseam-ui-common-modal.metadata.json +1 -1
  304. package/package.json +1 -1
  305. package/popover/theseam-ui-common-popover.metadata.json +1 -1
  306. package/progress/theseam-ui-common-progress.metadata.json +1 -1
  307. package/styles/vendor/ngx-datatable/_ngx-datatable.scss +54 -52
  308. package/tabbed/theseam-ui-common-tabbed.metadata.json +1 -1
  309. package/table/theseam-ui-common-table.metadata.json +1 -1
  310. package/table-cell-types/public-api.d.ts +7 -0
  311. package/table-cell-types/table-cell-type-currency/table-cell-type-currency-config.d.ts +39 -0
  312. package/table-cell-types/table-cell-type-currency/table-cell-type-currency.component.d.ts +19 -0
  313. package/table-cell-types/table-cell-type-currency/table-cell-type-currency.d.ts +3 -0
  314. package/table-cell-types/table-cell-type-decimal/table-cell-type-decimal-config.d.ts +31 -1
  315. package/table-cell-types/table-cell-type-decimal/table-cell-type-decimal.component.d.ts +19 -0
  316. package/table-cell-types/table-cell-type-decimal/table-cell-type-decimal.d.ts +3 -0
  317. package/table-cell-types/table-cell-type-integer/table-cell-type-integer-config.d.ts +23 -1
  318. package/table-cell-types/table-cell-type-integer/table-cell-type-integer.component.d.ts +19 -0
  319. package/table-cell-types/table-cell-type-integer/table-cell-type-integer.d.ts +3 -0
  320. package/table-cell-types/table-cell-type-manifests.d.ts +2 -1
  321. package/table-cell-types/theseam-ui-common-table-cell-types.metadata.json +1 -1
  322. package/tel-input/theseam-ui-common-tel-input.metadata.json +1 -1
  323. package/testing/current-tick-time.d.ts +13 -0
  324. package/testing/fake-toastr.d.ts +30 -0
  325. package/testing/get-harness.d.ts +7 -0
  326. package/testing/package.json +11 -0
  327. package/testing/public-api.d.ts +6 -0
  328. package/testing/render-story.d.ts +2 -0
  329. package/testing/story-expect.d.ts +5 -0
  330. package/{test-helpers/theseam-ui-common-test-helpers.d.ts → testing/theseam-ui-common-testing.d.ts} +0 -0
  331. package/testing/theseam-ui-common-testing.metadata.json +1 -0
  332. package/{test-helpers → testing}/tick-helper.d.ts +0 -0
  333. package/tiled-select/components/tiled-select/tiled-select.component.d.ts +7 -3
  334. package/tiled-select/components/tiled-select-tile/tiled-select-tile.component.d.ts +1 -0
  335. package/tiled-select/theseam-ui-common-tiled-select.metadata.json +1 -1
  336. package/tiled-select/tiled-select.models.d.ts +3 -1
  337. package/toggle-edit/theseam-ui-common-toggle-edit.metadata.json +1 -1
  338. package/utils/array-move.d.ts +49 -0
  339. package/utils/public-api.d.ts +1 -0
  340. package/utils/subscriber-count.d.ts +13 -1
  341. package/utils/theseam-ui-common-utils.metadata.json +1 -1
  342. package/widget/theseam-ui-common-widget.metadata.json +1 -1
  343. package/bundles/theseam-ui-common-test-helpers.umd.js +0 -94
  344. package/bundles/theseam-ui-common-test-helpers.umd.js.map +0 -1
  345. package/esm2015/test-helpers/public-api.js +0 -2
  346. package/esm2015/test-helpers/theseam-ui-common-test-helpers.js +0 -5
  347. package/esm2015/test-helpers/tick-helper.js +0 -74
  348. package/fesm2015/theseam-ui-common-test-helpers.js +0 -81
  349. package/fesm2015/theseam-ui-common-test-helpers.js.map +0 -1
  350. package/test-helpers/package.json +0 -11
  351. package/test-helpers/public-api.d.ts +0 -1
  352. 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 { isDevMode } from '@angular/core';
3
- import { hasProperty, notNullOrUndefined, isNullOrUndefined } from '@theseam/ui-common/utils';
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