@wavemaker/app-ng-runtime 11.8.0-next.24904 → 11.8.0-next.27301

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 (346) hide show
  1. app-ng-runtime/build-task/bundles/index.umd.js +5 -5
  2. app-ng-runtime/build-task/esm2022/basic/progress/progress-bar/progress-bar.build.mjs +1 -1
  3. app-ng-runtime/build-task/esm2022/page/page.build.mjs +3 -2
  4. app-ng-runtime/build-task/fesm2022/index.mjs +2 -1
  5. app-ng-runtime/build-task/fesm2022/index.mjs.map +1 -1
  6. app-ng-runtime/components/advanced/carousel/bundles/index.umd.js +5 -5
  7. app-ng-runtime/components/advanced/carousel/esm2022/carousel.animator.mjs +3 -2
  8. app-ng-runtime/components/advanced/carousel/esm2022/carousel.directive.mjs +1 -1
  9. app-ng-runtime/components/advanced/carousel/fesm2022/index.mjs +2 -1
  10. app-ng-runtime/components/advanced/carousel/fesm2022/index.mjs.map +1 -1
  11. app-ng-runtime/components/advanced/login/bundles/index.umd.js +6 -6
  12. app-ng-runtime/components/advanced/login/esm2022/login.component.mjs +4 -3
  13. app-ng-runtime/components/advanced/login/fesm2022/index.mjs +3 -2
  14. app-ng-runtime/components/advanced/login/fesm2022/index.mjs.map +1 -1
  15. app-ng-runtime/components/base/bundles/index.umd.js +203 -171
  16. app-ng-runtime/components/base/esm2022/directives/show-in-device.directive.mjs +1 -1
  17. app-ng-runtime/components/base/esm2022/pipes/custom-pipes.mjs +12 -11
  18. app-ng-runtime/components/base/esm2022/pipes/wm-pipe.mjs +3 -2
  19. app-ng-runtime/components/base/esm2022/utils/data-utils.mjs +30 -29
  20. app-ng-runtime/components/base/esm2022/utils/form-utils.mjs +47 -41
  21. app-ng-runtime/components/base/esm2022/utils/live-utils.mjs +8 -7
  22. app-ng-runtime/components/base/esm2022/utils/widget-utils.mjs +28 -27
  23. app-ng-runtime/components/base/esm2022/widgets/common/base/base-container.component.mjs +4 -3
  24. app-ng-runtime/components/base/esm2022/widgets/common/base/base-field-validations.mjs +24 -21
  25. app-ng-runtime/components/base/esm2022/widgets/common/base/base.component.mjs +12 -11
  26. app-ng-runtime/components/base/esm2022/widgets/common/base/dataset-aware-nav.component.mjs +40 -14
  27. app-ng-runtime/components/base/esm2022/widgets/common/base/partial-container.directive.mjs +3 -2
  28. app-ng-runtime/components/base/esm2022/widgets/common/dialog/dialog.service.mjs +3 -2
  29. app-ng-runtime/components/base/esm2022/widgets/common/lazy-load/lazy-load.directive.mjs +1 -1
  30. app-ng-runtime/components/base/esm2022/widgets/common/partial/partial.directive.mjs +3 -2
  31. app-ng-runtime/components/base/esm2022/widgets/common/partial-param/partial-param.directive.mjs +3 -2
  32. app-ng-runtime/components/base/esm2022/widgets/common/smooth-scroll/smooth-scroll.directive.mjs +6 -5
  33. app-ng-runtime/components/base/esm2022/widgets/framework/deviceview.mjs +1 -1
  34. app-ng-runtime/components/base/esm2022/widgets/framework/property-change-handler.mjs +3 -2
  35. app-ng-runtime/components/base/esm2022/widgets/framework/widget-proxy-provider.mjs +4 -3
  36. app-ng-runtime/components/base/fesm2022/index.mjs +206 -173
  37. app-ng-runtime/components/base/fesm2022/index.mjs.map +1 -1
  38. app-ng-runtime/components/base/pipes/custom-pipes.d.ts +1 -1
  39. app-ng-runtime/components/base/utils/data-utils.d.ts +0 -1
  40. app-ng-runtime/components/base/utils/widget-utils.d.ts +2 -2
  41. app-ng-runtime/components/base/widgets/common/base/base-field-validations.d.ts +1 -1
  42. app-ng-runtime/components/base/widgets/common/base/partial-container.directive.d.ts +1 -1
  43. app-ng-runtime/components/basic/default/bundles/index.umd.js +10 -10
  44. app-ng-runtime/components/basic/default/esm2022/label/label.directive.mjs +4 -3
  45. app-ng-runtime/components/basic/default/esm2022/spinner/spinner.component.mjs +6 -5
  46. app-ng-runtime/components/basic/default/fesm2022/index.mjs +7 -6
  47. app-ng-runtime/components/basic/default/fesm2022/index.mjs.map +1 -1
  48. app-ng-runtime/components/basic/progress/bundles/index.umd.js +13 -13
  49. app-ng-runtime/components/basic/progress/esm2022/progress-bar/progress-bar.component.mjs +5 -4
  50. app-ng-runtime/components/basic/progress/esm2022/progress-circle/progress-circle.component.mjs +6 -5
  51. app-ng-runtime/components/basic/progress/esm2022/utils.mjs +3 -3
  52. app-ng-runtime/components/basic/progress/fesm2022/index.mjs +10 -9
  53. app-ng-runtime/components/basic/progress/fesm2022/index.mjs.map +1 -1
  54. app-ng-runtime/components/basic/rich-text-editor/bundles/index.umd.js +15 -10
  55. app-ng-runtime/components/basic/rich-text-editor/esm2022/rich-text-editor.component.mjs +14 -8
  56. app-ng-runtime/components/basic/rich-text-editor/fesm2022/index.mjs +13 -7
  57. app-ng-runtime/components/basic/rich-text-editor/fesm2022/index.mjs.map +1 -1
  58. app-ng-runtime/components/basic/rich-text-editor/rich-text-editor.component.d.ts +2 -2
  59. app-ng-runtime/components/basic/search/bundles/index.umd.js +67 -65
  60. app-ng-runtime/components/basic/search/esm2022/data-provider/data-provider.mjs +1 -1
  61. app-ng-runtime/components/basic/search/esm2022/data-provider/local-data-provider.mjs +26 -23
  62. app-ng-runtime/components/basic/search/esm2022/data-provider/remote-data-provider.mjs +12 -11
  63. app-ng-runtime/components/basic/search/esm2022/search.component.mjs +31 -30
  64. app-ng-runtime/components/basic/search/fesm2022/index.mjs +66 -63
  65. app-ng-runtime/components/basic/search/fesm2022/index.mjs.map +1 -1
  66. app-ng-runtime/components/basic/tree/bundles/index.umd.js +9 -9
  67. app-ng-runtime/components/basic/tree/esm2022/tree.component.mjs +7 -6
  68. app-ng-runtime/components/basic/tree/fesm2022/index.mjs +6 -5
  69. app-ng-runtime/components/basic/tree/fesm2022/index.mjs.map +1 -1
  70. app-ng-runtime/components/chart/bundles/index.umd.js +72 -63
  71. app-ng-runtime/components/chart/chart.component.d.ts +1 -1
  72. app-ng-runtime/components/chart/chart.utils.d.ts +3 -3
  73. app-ng-runtime/components/chart/esm2022/chart.component.mjs +58 -48
  74. app-ng-runtime/components/chart/esm2022/chart.utils.mjs +14 -13
  75. app-ng-runtime/components/chart/fesm2022/index.mjs +69 -59
  76. app-ng-runtime/components/chart/fesm2022/index.mjs.map +1 -1
  77. app-ng-runtime/components/containers/accordion/bundles/index.umd.js +16 -16
  78. app-ng-runtime/components/containers/accordion/esm2022/accordion.directive.mjs +14 -13
  79. app-ng-runtime/components/containers/accordion/fesm2022/index.mjs +13 -12
  80. app-ng-runtime/components/containers/accordion/fesm2022/index.mjs.map +1 -1
  81. app-ng-runtime/components/containers/panel/bundles/index.umd.js +5 -5
  82. app-ng-runtime/components/containers/panel/esm2022/panel.component.mjs +3 -2
  83. app-ng-runtime/components/containers/panel/fesm2022/index.mjs +2 -1
  84. app-ng-runtime/components/containers/panel/fesm2022/index.mjs.map +1 -1
  85. app-ng-runtime/components/containers/panel/panel.component.d.ts +1 -1
  86. app-ng-runtime/components/containers/tabs/bundles/index.umd.js +17 -17
  87. app-ng-runtime/components/containers/tabs/esm2022/tabs.component.mjs +15 -14
  88. app-ng-runtime/components/containers/tabs/fesm2022/index.mjs +14 -13
  89. app-ng-runtime/components/containers/tabs/fesm2022/index.mjs.map +1 -1
  90. app-ng-runtime/components/data/form/bundles/index.umd.js +75 -75
  91. app-ng-runtime/components/data/form/esm2022/form-action/form-action.directive.mjs +3 -2
  92. app-ng-runtime/components/data/form/esm2022/form-field/form-field.directive.mjs +10 -9
  93. app-ng-runtime/components/data/form/esm2022/form.component.mjs +54 -53
  94. app-ng-runtime/components/data/form/esm2022/live-filter/live-filter.directive.mjs +3 -2
  95. app-ng-runtime/components/data/form/esm2022/live-form/live-form.directive.mjs +11 -10
  96. app-ng-runtime/components/data/form/fesm2022/index.mjs +77 -76
  97. app-ng-runtime/components/data/form/fesm2022/index.mjs.map +1 -1
  98. app-ng-runtime/components/data/form/form.component.d.ts +2 -2
  99. app-ng-runtime/components/data/form/live-form/live-form.directive.d.ts +1 -1
  100. app-ng-runtime/components/data/list/bundles/index.umd.js +692 -687
  101. app-ng-runtime/components/data/list/esm2022/list-item.directive.mjs +1 -1
  102. app-ng-runtime/components/data/list/esm2022/list.animator.mjs +5 -3
  103. app-ng-runtime/components/data/list/esm2022/list.component.mjs +687 -682
  104. app-ng-runtime/components/data/list/fesm2022/index.mjs +690 -684
  105. app-ng-runtime/components/data/list/fesm2022/index.mjs.map +1 -1
  106. app-ng-runtime/components/data/list/list.component.d.ts +53 -53
  107. app-ng-runtime/components/data/live-table/bundles/index.umd.js +1 -1
  108. app-ng-runtime/components/data/live-table/esm2022/live-table.component.mjs +2 -2
  109. app-ng-runtime/components/data/live-table/fesm2022/index.mjs +1 -1
  110. app-ng-runtime/components/data/live-table/fesm2022/index.mjs.map +1 -1
  111. app-ng-runtime/components/data/pagination/bundles/index.umd.js +14 -14
  112. app-ng-runtime/components/data/pagination/esm2022/pagination.component.mjs +12 -11
  113. app-ng-runtime/components/data/pagination/fesm2022/index.mjs +11 -10
  114. app-ng-runtime/components/data/pagination/fesm2022/index.mjs.map +1 -1
  115. app-ng-runtime/components/data/table/bundles/index.umd.js +175 -172
  116. app-ng-runtime/components/data/table/esm2022/table-action/table-action.directive.mjs +3 -2
  117. app-ng-runtime/components/data/table/esm2022/table-column/table-column.directive.mjs +19 -18
  118. app-ng-runtime/components/data/table/esm2022/table-cud.directive.mjs +7 -6
  119. app-ng-runtime/components/data/table/esm2022/table-filter.directive.mjs +53 -55
  120. app-ng-runtime/components/data/table/esm2022/table-row-action/table-row-action.directive.mjs +3 -2
  121. app-ng-runtime/components/data/table/esm2022/table.component.mjs +98 -91
  122. app-ng-runtime/components/data/table/fesm2022/index.mjs +172 -168
  123. app-ng-runtime/components/data/table/fesm2022/index.mjs.map +1 -1
  124. app-ng-runtime/components/data/table/table-column/table-column.directive.d.ts +6 -6
  125. app-ng-runtime/components/data/table/table.component.d.ts +2 -2
  126. app-ng-runtime/components/dialogs/default/bundles/index.umd.js +2 -2
  127. app-ng-runtime/components/dialogs/default/esm2022/base-dialog.mjs +3 -3
  128. app-ng-runtime/components/dialogs/default/esm2022/dialog-body/dialog-body.directive.mjs +1 -1
  129. app-ng-runtime/components/dialogs/default/fesm2022/index.mjs +1 -1
  130. app-ng-runtime/components/dialogs/default/fesm2022/index.mjs.map +1 -1
  131. app-ng-runtime/components/input/calendar/bundles/index.umd.js +33 -31
  132. app-ng-runtime/components/input/calendar/esm2022/calendar.component.mjs +31 -28
  133. app-ng-runtime/components/input/calendar/fesm2022/index.mjs +30 -27
  134. app-ng-runtime/components/input/calendar/fesm2022/index.mjs.map +1 -1
  135. app-ng-runtime/components/input/chips/bundles/index.umd.js +29 -28
  136. app-ng-runtime/components/input/chips/chips.component.d.ts +1 -1
  137. app-ng-runtime/components/input/chips/esm2022/chips.component.mjs +27 -25
  138. app-ng-runtime/components/input/chips/fesm2022/index.mjs +26 -24
  139. app-ng-runtime/components/input/chips/fesm2022/index.mjs.map +1 -1
  140. app-ng-runtime/components/input/default/base-form.component.d.ts +3 -3
  141. app-ng-runtime/components/input/default/bundles/index.umd.js +75 -62
  142. app-ng-runtime/components/input/default/checkbox/checkbox.component.d.ts +1 -0
  143. app-ng-runtime/components/input/default/dataset-aware-form.component.d.ts +4 -4
  144. app-ng-runtime/components/input/default/esm2022/base-form.component.mjs +14 -8
  145. app-ng-runtime/components/input/default/esm2022/caption-position.directive.mjs +3 -2
  146. app-ng-runtime/components/input/default/esm2022/checkbox/checkbox.component.mjs +2 -2
  147. app-ng-runtime/components/input/default/esm2022/checkboxset/checkboxset.component.mjs +6 -4
  148. app-ng-runtime/components/input/default/esm2022/dataset-aware-form.component.mjs +29 -23
  149. app-ng-runtime/components/input/default/esm2022/radioset/radioset.component.mjs +4 -3
  150. app-ng-runtime/components/input/default/esm2022/select/select.component.mjs +4 -3
  151. app-ng-runtime/components/input/default/esm2022/switch/switch.component.mjs +6 -5
  152. app-ng-runtime/components/input/default/esm2022/text/base/base-input.mjs +4 -3
  153. app-ng-runtime/components/input/default/esm2022/text/locale/number-locale.mjs +20 -18
  154. app-ng-runtime/components/input/default/esm2022/text/text/input-text.component.mjs +2 -2
  155. app-ng-runtime/components/input/default/fesm2022/index.mjs +75 -62
  156. app-ng-runtime/components/input/default/fesm2022/index.mjs.map +1 -1
  157. app-ng-runtime/components/input/epoch/base-date-time.component.d.ts +1 -1
  158. app-ng-runtime/components/input/epoch/bundles/index.umd.js +53 -51
  159. app-ng-runtime/components/input/epoch/esm2022/base-date-time.component.mjs +34 -31
  160. app-ng-runtime/components/input/epoch/esm2022/date/date.component.mjs +5 -4
  161. app-ng-runtime/components/input/epoch/esm2022/date-time/date-time-picker.component.mjs +5 -4
  162. app-ng-runtime/components/input/epoch/esm2022/date-time/date-time.component.mjs +7 -6
  163. app-ng-runtime/components/input/epoch/esm2022/picker/picker.component.mjs +1 -1
  164. app-ng-runtime/components/input/epoch/esm2022/time/time.component.mjs +6 -5
  165. app-ng-runtime/components/input/epoch/fesm2022/index.mjs +48 -45
  166. app-ng-runtime/components/input/epoch/fesm2022/index.mjs.map +1 -1
  167. app-ng-runtime/components/input/file-upload/bundles/index.umd.js +15 -15
  168. app-ng-runtime/components/input/file-upload/esm2022/file-upload.component.mjs +13 -12
  169. app-ng-runtime/components/input/file-upload/fesm2022/index.mjs +12 -11
  170. app-ng-runtime/components/input/file-upload/fesm2022/index.mjs.map +1 -1
  171. app-ng-runtime/components/input/rating/bundles/index.umd.js +12 -12
  172. app-ng-runtime/components/input/rating/esm2022/rating.component.mjs +10 -9
  173. app-ng-runtime/components/input/rating/fesm2022/index.mjs +9 -8
  174. app-ng-runtime/components/input/rating/fesm2022/index.mjs.map +1 -1
  175. app-ng-runtime/components/navigation/breadcrumb/bundles/index.umd.js +1 -1
  176. app-ng-runtime/components/navigation/breadcrumb/esm2022/breadcrumb.component.mjs +2 -2
  177. app-ng-runtime/components/navigation/breadcrumb/fesm2022/index.mjs +1 -1
  178. app-ng-runtime/components/navigation/breadcrumb/fesm2022/index.mjs.map +1 -1
  179. app-ng-runtime/components/navigation/menu/bundles/index.umd.js +23 -22
  180. app-ng-runtime/components/navigation/menu/esm2022/menu-adapator.component.mjs +3 -2
  181. app-ng-runtime/components/navigation/menu/esm2022/menu-dropdown-item/menu-dropdown-item.component.mjs +6 -5
  182. app-ng-runtime/components/navigation/menu/esm2022/menu.component.mjs +8 -7
  183. app-ng-runtime/components/navigation/menu/esm2022/nav/nav.component.mjs +10 -8
  184. app-ng-runtime/components/navigation/menu/fesm2022/index.mjs +20 -18
  185. app-ng-runtime/components/navigation/menu/fesm2022/index.mjs.map +1 -1
  186. app-ng-runtime/components/navigation/menu/menu-dropdown-item/menu-dropdown-item.component.d.ts +12 -1
  187. app-ng-runtime/components/navigation/popover/esm2022/popover.component.mjs +1 -1
  188. app-ng-runtime/components/navigation/popover/fesm2022/index.mjs.map +1 -1
  189. app-ng-runtime/components/prefab/bundles/index.umd.js +6 -6
  190. app-ng-runtime/components/prefab/esm2022/prefab-container/prefab-container.directive.mjs +3 -2
  191. app-ng-runtime/components/prefab/esm2022/prefab.directive.mjs +3 -2
  192. app-ng-runtime/components/prefab/fesm2022/index.mjs +3 -2
  193. app-ng-runtime/components/prefab/fesm2022/index.mjs.map +1 -1
  194. app-ng-runtime/core/bundles/index.umd.js +119 -130
  195. app-ng-runtime/core/esm2022/public_api.mjs +2 -2
  196. app-ng-runtime/core/esm2022/services/field-type.service.mjs +3 -2
  197. app-ng-runtime/core/esm2022/services/field-widget.service.mjs +3 -2
  198. app-ng-runtime/core/esm2022/services/pagination.service.mjs +7 -6
  199. app-ng-runtime/core/esm2022/services/state-persistence.service.mjs +17 -16
  200. app-ng-runtime/core/esm2022/services/utils.service.mjs +3 -2
  201. app-ng-runtime/core/esm2022/services/viewport.service.mjs +3 -2
  202. app-ng-runtime/core/esm2022/utils/build-utils.mjs +5 -4
  203. app-ng-runtime/core/esm2022/utils/expression-parser.mjs +5 -4
  204. app-ng-runtime/core/esm2022/utils/lru-cache.mjs +3 -2
  205. app-ng-runtime/core/esm2022/utils/utils.mjs +79 -82
  206. app-ng-runtime/core/esm2022/utils/watcher.mjs +9 -7
  207. app-ng-runtime/core/fesm2022/index.mjs +117 -123
  208. app-ng-runtime/core/fesm2022/index.mjs.map +1 -1
  209. app-ng-runtime/core/public_api.d.ts +1 -1
  210. app-ng-runtime/core/services/pagination.service.d.ts +1 -1
  211. app-ng-runtime/core/utils/utils.d.ts +5 -9
  212. app-ng-runtime/http/bundles/index.umd.js +7 -7
  213. app-ng-runtime/http/esm2022/http.service.mjs +5 -4
  214. app-ng-runtime/http/esm2022/wm-http-request.mjs +1 -1
  215. app-ng-runtime/http/esm2022/wm-http-response.mjs +1 -1
  216. app-ng-runtime/http/fesm2022/index.mjs +4 -3
  217. app-ng-runtime/http/fesm2022/index.mjs.map +1 -1
  218. app-ng-runtime/mobile/components/basic/default/bundles/index.umd.js +24 -20
  219. app-ng-runtime/mobile/components/basic/default/esm2022/anchor/anchor.directive.mjs +5 -4
  220. app-ng-runtime/mobile/components/basic/default/esm2022/file-browser/file-browser.component.mjs +12 -8
  221. app-ng-runtime/mobile/components/basic/default/esm2022/file-browser/file-selector.service.mjs +5 -3
  222. app-ng-runtime/mobile/components/basic/default/esm2022/image-cache/image-cache.directive.mjs +3 -2
  223. app-ng-runtime/mobile/components/basic/default/esm2022/process-manager/process-manager.component.mjs +5 -4
  224. app-ng-runtime/mobile/components/basic/default/fesm2022/index.mjs +21 -16
  225. app-ng-runtime/mobile/components/basic/default/fesm2022/index.mjs.map +1 -1
  226. app-ng-runtime/mobile/components/containers/segmented-control/bundles/index.umd.js +7 -7
  227. app-ng-runtime/mobile/components/containers/segmented-control/esm2022/segment-content/segment-content.component.mjs +2 -2
  228. app-ng-runtime/mobile/components/containers/segmented-control/esm2022/segmented-control.component.mjs +4 -3
  229. app-ng-runtime/mobile/components/containers/segmented-control/fesm2022/index.mjs +4 -3
  230. app-ng-runtime/mobile/components/containers/segmented-control/fesm2022/index.mjs.map +1 -1
  231. app-ng-runtime/mobile/components/data/media-list/bundles/index.umd.js +8 -8
  232. app-ng-runtime/mobile/components/data/media-list/esm2022/media-list.component.mjs +4 -3
  233. app-ng-runtime/mobile/components/data/media-list/fesm2022/index.mjs +3 -2
  234. app-ng-runtime/mobile/components/data/media-list/fesm2022/index.mjs.map +1 -1
  235. app-ng-runtime/mobile/components/page/default/bundles/index.umd.js +5 -5
  236. app-ng-runtime/mobile/components/page/default/esm2022/page.directive.mjs +3 -2
  237. app-ng-runtime/mobile/components/page/default/fesm2022/index.mjs +2 -1
  238. app-ng-runtime/mobile/components/page/default/fesm2022/index.mjs.map +1 -1
  239. app-ng-runtime/mobile/components/page/tab-bar/bundles/index.umd.js +9 -9
  240. app-ng-runtime/mobile/components/page/tab-bar/esm2022/tabbar.component.mjs +7 -6
  241. app-ng-runtime/mobile/components/page/tab-bar/fesm2022/index.mjs +6 -5
  242. app-ng-runtime/mobile/components/page/tab-bar/fesm2022/index.mjs.map +1 -1
  243. app-ng-runtime/mobile/core/bundles/index.umd.js +25 -25
  244. app-ng-runtime/mobile/core/esm2022/services/device-file-download.service.mjs +5 -4
  245. app-ng-runtime/mobile/core/esm2022/services/device-file-opener.service.mjs +3 -2
  246. app-ng-runtime/mobile/core/esm2022/services/device-file-upload.service.mjs +4 -3
  247. app-ng-runtime/mobile/core/esm2022/services/device-file.service.mjs +6 -5
  248. app-ng-runtime/mobile/core/esm2022/services/device.service.mjs +3 -2
  249. app-ng-runtime/mobile/core/esm2022/services/ext-app-message.service.mjs +5 -4
  250. app-ng-runtime/mobile/core/esm2022/services/network.service.mjs +9 -8
  251. app-ng-runtime/mobile/core/fesm2022/index.mjs +22 -21
  252. app-ng-runtime/mobile/core/fesm2022/index.mjs.map +1 -1
  253. app-ng-runtime/mobile/core/services/ext-app-message.service.d.ts +1 -1
  254. app-ng-runtime/mobile/core/services/network.service.d.ts +7 -1
  255. app-ng-runtime/mobile/offline/bundles/index.umd.js +161 -144
  256. app-ng-runtime/mobile/offline/esm2022/models/local-db-store.mjs +23 -21
  257. app-ng-runtime/mobile/offline/esm2022/services/change-log.service.mjs +7 -6
  258. app-ng-runtime/mobile/offline/esm2022/services/local-db-data-pull.service.mjs +37 -35
  259. app-ng-runtime/mobile/offline/esm2022/services/local-db-management.service.mjs +54 -45
  260. app-ng-runtime/mobile/offline/esm2022/services/local-db.service.mjs +5 -4
  261. app-ng-runtime/mobile/offline/esm2022/services/workers/error-blocker.mjs +4 -3
  262. app-ng-runtime/mobile/offline/esm2022/services/workers/file-handler.mjs +18 -13
  263. app-ng-runtime/mobile/offline/esm2022/services/workers/multi-part-param-transformer.mjs +9 -5
  264. app-ng-runtime/mobile/offline/esm2022/utils/live-variable.utils.mjs +12 -11
  265. app-ng-runtime/mobile/offline/esm2022/utils/query-executor.utils.mjs +5 -4
  266. app-ng-runtime/mobile/offline/esm2022/utils/security.utils.mjs +3 -2
  267. app-ng-runtime/mobile/offline/fesm2022/index.mjs +156 -138
  268. app-ng-runtime/mobile/offline/fesm2022/index.mjs.map +1 -1
  269. app-ng-runtime/mobile/runtime/bundles/index.umd.js +11 -8
  270. app-ng-runtime/mobile/runtime/esm2022/mobile-runtime.module.mjs +3 -2
  271. app-ng-runtime/mobile/runtime/esm2022/services/cookie.service.mjs +6 -2
  272. app-ng-runtime/mobile/runtime/esm2022/services/http-interceptor.service.mjs +4 -3
  273. app-ng-runtime/mobile/runtime/fesm2022/index.mjs +8 -4
  274. app-ng-runtime/mobile/runtime/fesm2022/index.mjs.map +1 -1
  275. app-ng-runtime/mobile/runtime-dynamic/bundles/index.umd.js +2 -2
  276. app-ng-runtime/mobile/runtime-dynamic/esm2022/services/live-sync.service.mjs +3 -3
  277. app-ng-runtime/mobile/runtime-dynamic/fesm2022/index.mjs +2 -2
  278. app-ng-runtime/mobile/runtime-dynamic/fesm2022/index.mjs.map +1 -1
  279. app-ng-runtime/mobile/variables/bundles/index.umd.js +23 -16
  280. app-ng-runtime/mobile/variables/esm2022/services/camera-service.mjs +2 -2
  281. app-ng-runtime/mobile/variables/esm2022/services/datasync-service.mjs +10 -9
  282. app-ng-runtime/mobile/variables/esm2022/services/file-service.mjs +11 -3
  283. app-ng-runtime/mobile/variables/fesm2022/index.mjs +19 -11
  284. app-ng-runtime/mobile/variables/fesm2022/index.mjs.map +1 -1
  285. app-ng-runtime/oAuth/bundles/index.umd.js +12 -12
  286. app-ng-runtime/oAuth/esm2022/oAuth.service.mjs +4 -3
  287. app-ng-runtime/oAuth/esm2022/oAuth.utils.mjs +8 -7
  288. app-ng-runtime/oAuth/fesm2022/index.mjs +9 -8
  289. app-ng-runtime/oAuth/fesm2022/index.mjs.map +1 -1
  290. app-ng-runtime/package.json +1 -1
  291. app-ng-runtime/runtime/base/bundles/index.umd.js +121 -120
  292. app-ng-runtime/runtime/base/esm2022/components/base-layout.component.mjs +4 -3
  293. app-ng-runtime/runtime/base/esm2022/components/base-page.component.mjs +14 -13
  294. app-ng-runtime/runtime/base/esm2022/components/base-partial.component.mjs +13 -12
  295. app-ng-runtime/runtime/base/esm2022/components/base-prefab.component.mjs +15 -14
  296. app-ng-runtime/runtime/base/esm2022/components/base-spa-page.component.mjs +14 -13
  297. app-ng-runtime/runtime/base/esm2022/components/custom-toaster.component.mjs +6 -5
  298. app-ng-runtime/runtime/base/esm2022/directives/accessroles.directive.mjs +11 -10
  299. app-ng-runtime/runtime/base/esm2022/guards/page-not-found.guard.mjs +1 -1
  300. app-ng-runtime/runtime/base/esm2022/guards/role.guard.mjs +3 -2
  301. app-ng-runtime/runtime/base/esm2022/services/app-defaults.service.mjs +1 -1
  302. app-ng-runtime/runtime/base/esm2022/services/app.manager.service.mjs +17 -14
  303. app-ng-runtime/runtime/base/esm2022/services/app.service.mjs +7 -6
  304. app-ng-runtime/runtime/base/esm2022/services/dynamic-component-ref-provider.service.mjs +3 -2
  305. app-ng-runtime/runtime/base/esm2022/services/http-interceptor.services.mjs +4 -3
  306. app-ng-runtime/runtime/base/esm2022/services/i18n.service.mjs +12 -10
  307. app-ng-runtime/runtime/base/esm2022/services/navigation.service.mjs +8 -7
  308. app-ng-runtime/runtime/base/esm2022/services/prefab-manager.service.mjs +3 -2
  309. app-ng-runtime/runtime/base/esm2022/services/spinner.service.mjs +7 -6
  310. app-ng-runtime/runtime/base/esm2022/services/toaster.service.mjs +6 -5
  311. app-ng-runtime/runtime/base/esm2022/util/wm-route-reuse-strategy.mjs +6 -7
  312. app-ng-runtime/runtime/base/fesm2022/index.mjs +119 -117
  313. app-ng-runtime/runtime/base/fesm2022/index.mjs.map +1 -1
  314. app-ng-runtime/runtime/base/services/i18n.service.d.ts +1 -1
  315. app-ng-runtime/runtime/dynamic/bundles/index.umd.js +7 -7
  316. app-ng-runtime/runtime/dynamic/esm2022/app/services/component-ref-provider.service.mjs +4 -3
  317. app-ng-runtime/runtime/dynamic/esm2022/main.mjs +3 -2
  318. app-ng-runtime/runtime/dynamic/fesm2022/index.mjs +4 -3
  319. app-ng-runtime/runtime/dynamic/fesm2022/index.mjs.map +1 -1
  320. app-ng-runtime/scripts/jquery-ui/ui/widgets/droppable.js +7 -7
  321. app-ng-runtime/scripts/jquery-ui/ui/widgets/resizable.js +13 -10
  322. app-ng-runtime/scripts/jquery-ui/ui/widgets/sortable.js +7 -7
  323. app-ng-runtime/security/bundles/index.umd.js +14 -14
  324. app-ng-runtime/security/esm2022/security.service.mjs +12 -11
  325. app-ng-runtime/security/fesm2022/index.mjs +11 -10
  326. app-ng-runtime/security/fesm2022/index.mjs.map +1 -1
  327. app-ng-runtime/security/security.service.d.ts +1 -1
  328. app-ng-runtime/swipey/esm2022/swipe.animation.mjs +1 -1
  329. app-ng-runtime/swipey/fesm2022/index.mjs.map +1 -1
  330. app-ng-runtime/transpiler/bundles/index.umd.js +10 -9
  331. app-ng-runtime/transpiler/esm2022/build.mjs +8 -6
  332. app-ng-runtime/transpiler/fesm2022/index.mjs +7 -5
  333. app-ng-runtime/transpiler/fesm2022/index.mjs.map +1 -1
  334. app-ng-runtime/variables/bundles/index.umd.js +155 -145
  335. app-ng-runtime/variables/esm2022/manager/action/login-action.manager.mjs +15 -14
  336. app-ng-runtime/variables/esm2022/manager/action/notification-action.manager.mjs +9 -8
  337. app-ng-runtime/variables/esm2022/manager/variable/base-variable.manager.mjs +3 -2
  338. app-ng-runtime/variables/esm2022/manager/variable/web-socket-variable.manager.mjs +11 -10
  339. app-ng-runtime/variables/esm2022/service/variables.service.mjs +7 -6
  340. app-ng-runtime/variables/esm2022/util/action/navigation-action.utils.mjs +4 -4
  341. app-ng-runtime/variables/esm2022/util/variable/pagination.utils.mjs +30 -23
  342. app-ng-runtime/variables/esm2022/util/variable/service-variable.utils.mjs +29 -28
  343. app-ng-runtime/variables/esm2022/util/variable/variables.utils.mjs +75 -70
  344. app-ng-runtime/variables/fesm2022/index.mjs +169 -158
  345. app-ng-runtime/variables/fesm2022/index.mjs.map +1 -1
  346. app-ng-runtime/variables/util/variable/service-variable.utils.d.ts +1 -1
@@ -3,14 +3,15 @@ import { ViewContainerRef, Directive, Optional, HostBinding, HostListener, Input
3
3
  import * as i1$1 from '@angular/common';
4
4
  import { CommonModule } from '@angular/common';
5
5
  import * as i1 from '@wm/components/base';
6
- import { PROP_BOOLEAN, PROP_STRING, PROP_ANY, PROP_NUMBER, register, StylableComponent, APPLY_STYLES_TYPE, styler, extractDataSourceName, NAVIGATION_TYPE, getOrderedDataset, groupData, unsupportedStatePersistenceTypes, DEBOUNCE_TIMES, configureDnD, handleHeaderClick, toggleAllHeaders, provideAsWidgetRef, WmComponentsModule } from '@wm/components/base';
6
+ import { PROP_BOOLEAN, PROP_STRING, PROP_ANY, PROP_NUMBER, register, StylableComponent, APPLY_STYLES_TYPE, styler, extractDataSourceName, DEBOUNCE_TIMES, handleHeaderClick, toggleAllHeaders, NAVIGATION_TYPE, getOrderedDataset, groupData, unsupportedStatePersistenceTypes, configureDnD, provideAsWidgetRef, WmComponentsModule } from '@wm/components/base';
7
7
  import * as i2$1 from '@wm/components/data/pagination';
8
8
  import { PaginationComponent, PaginationModule } from '@wm/components/data/pagination';
9
9
  import * as i2 from '@wm/core';
10
- import { isMobileApp, $watch, getClonedObject, isDefined, $appDigest, noop, generateGUId, $invokeWatchers, DataSource, isDataSourceEqual, isObject, isMobile, switchClass, setListClass, isNumber } from '@wm/core';
10
+ import { isMobileApp, $watch, noop, generateGUId, getClonedObject, $appDigest, isDefined, DataSource, isDataSourceEqual, isObject, switchClass, setListClass, isMobile, $invokeWatchers } from '@wm/core';
11
11
  import { ButtonComponent } from '@wm/components/input';
12
12
  import { Subject } from 'rxjs';
13
13
  import { SwipeAnimation } from '@swipey';
14
+ import { reduce, map, get, isEmpty, isArray, forEach, isEqual, isUndefined, includes, last, cloneDeep, isString, has, clone, remove, some, pullAllWith, toNumber, min, max, pullAt, isNumber } from 'lodash-es';
14
15
 
15
16
  const registerProps = () => {
16
17
  register('wm-list', new Map([
@@ -218,7 +219,7 @@ class ListAnimator extends SwipeAnimation {
218
219
  }
219
220
  // Returns the total width occupied by all the children inside the element
220
221
  computeTotalChildrenWidth($ele) {
221
- return _.reduce($ele.children(), (totalWidth, el) => {
222
+ return reduce($ele.children(), (totalWidth, el) => {
222
223
  return totalWidth + $(el).outerWidth();
223
224
  }, 0);
224
225
  }
@@ -227,7 +228,8 @@ class ListAnimator extends SwipeAnimation {
227
228
  const totalWidth = this.computeTotalChildrenWidth($ele);
228
229
  const reverse = this.position === 'right';
229
230
  let d = 0;
230
- return _.map($ele.children(), e => {
231
+ // @ts-ignore
232
+ return map($ele.children(), e => {
231
233
  const f = (totalWidth - d) / totalWidth;
232
234
  d += $(e).outerWidth();
233
235
  return reverse ? f : (d / totalWidth);
@@ -640,70 +642,6 @@ const DEFAULT_CLS = 'app-livelist app-panel';
640
642
  const WIDGET_CONFIG = { widgetType: 'wm-list', hostClass: DEFAULT_CLS };
641
643
  class ListComponent extends StylableComponent {
642
644
  static { this.initializeProps = registerProps(); }
643
- get selecteditem() {
644
- if (this.multiselect) {
645
- return getClonedObject(this._items);
646
- }
647
- if (_.isEmpty(this._items)) {
648
- return {};
649
- }
650
- return getClonedObject(this._items[0]);
651
- }
652
- /**
653
- * Returns list of widgets present on list item by considering name and index of the widget.
654
- * If we did'nt pass index, it returns array of all the widgets which are matching to widget name
655
- * @param widgteName: Name of the widget
656
- * @param index: Index of the widget
657
- */
658
- getWidgets(widgteName, index) {
659
- let $target;
660
- const retVal = [];
661
- if (!widgteName) {
662
- return;
663
- }
664
- if (!isDefined(index)) {
665
- _.forEach(this.listItems.toArray(), (el) => {
666
- $target = _.get(el.currentItemWidgets, widgteName);
667
- if ($target) {
668
- retVal.push($target);
669
- }
670
- });
671
- return retVal;
672
- }
673
- index = +index || 0;
674
- $target = _.get(this.listItems.toArray(), index);
675
- if ($target) {
676
- return [_.get($target.currentItemWidgets, widgteName)];
677
- }
678
- }
679
- // returns listitem reference by index value. This refers to the same method getListItemByIndex.
680
- getItem(index) {
681
- return this.getListItemByIndex(index);
682
- }
683
- /**
684
- * Returns index of listItem(listItemDirective / listItemObject)
685
- * If item is a directive, index is fetched from listItems
686
- * If item is an object, index is fetched from fieldDefs
687
- */
688
- getIndex(item) {
689
- if (item instanceof ListItemDirective) {
690
- return this.getListItemIndex(item);
691
- }
692
- else if (item) {
693
- return this.fieldDefs.findIndex((obj) => _.isEqual(obj, item));
694
- }
695
- }
696
- set selecteditem(items) {
697
- this._items.length = 0;
698
- this.deselectListItems();
699
- if (_.isArray(items)) {
700
- items.forEach(item => this.selectItem(item));
701
- }
702
- else {
703
- this.selectItem(items);
704
- }
705
- $appDigest();
706
- }
707
645
  constructor(inj, cdRef, datePipe, app, appDefaults, ngZone, binditemclass, binddisableitem, binddataset, binddatasource, mouseEnterCB, mouseLeaveCB, statePersistence, paginationService, explicitContext) {
708
646
  let resolveFn = noop;
709
647
  const propsInitPromise = new Promise(res => resolveFn = res);
@@ -731,12 +669,12 @@ class ListComponent extends StylableComponent {
731
669
  // Updates pagination, filter, sort etc options for service and crud variables
732
670
  this._listenerDestroyers = [
733
671
  this.app.subscribe('check-state-persistence-options', options => {
734
- let dataSourceName = _.get(this.datasource, 'name');
672
+ let dataSourceName = get(this.datasource, 'name');
735
673
  // in Prefabs, this.datasource is not resolved at the time of variable invocation, so additional check is required.
736
674
  if (!dataSourceName) {
737
675
  dataSourceName = extractDataSourceName(this.binddatasource);
738
676
  }
739
- if (_.get(options, 'variable.name') !== dataSourceName) {
677
+ if (get(options, 'variable.name') !== dataSourceName) {
740
678
  return;
741
679
  }
742
680
  this.handleStateParams(options);
@@ -751,31 +689,69 @@ class ListComponent extends StylableComponent {
751
689
  })
752
690
  ];
753
691
  }
754
- getConfiguredState() {
755
- const mode = this.statePersistence.computeMode(this.statehandler);
756
- return mode && mode.toLowerCase();
692
+ get selecteditem() {
693
+ if (this.multiselect) {
694
+ return getClonedObject(this._items);
695
+ }
696
+ if (isEmpty(this._items)) {
697
+ return {};
698
+ }
699
+ return getClonedObject(this._items[0]);
757
700
  }
758
- handleStateParams(options) {
759
- if (this._pageLoad && this.getConfiguredState() !== 'none') {
760
- this._pageLoad = false;
761
- const widgetState = this.statePersistence.getWidgetState(this);
762
- if (_.get(widgetState, 'pagination')) {
763
- options.options = options.options || {};
764
- options.options.page = widgetState.pagination;
765
- }
766
- if (_.get(widgetState, 'selectedItem')) {
767
- this._selectedItemsExist = true;
768
- }
701
+ set selecteditem(items) {
702
+ this._items.length = 0;
703
+ this.deselectListItems();
704
+ if (isArray(items)) {
705
+ items.forEach(item => this.selectItem(item));
706
+ }
707
+ else {
708
+ this.selectItem(items);
769
709
  }
710
+ $appDigest();
770
711
  }
771
- triggerWMEvent(eventName, item) {
772
- $invokeWatchers(true);
773
- // If we have multiselect for the livelist(List with form template), in run mode deleting a record is getting failed. Becuase the selecteditem will be array of objects. So consider the last object.
774
- let row = this.multiselect ? _.last(this.selecteditem) : this.selecteditem;
775
- if (item) {
776
- row = item;
712
+ /**
713
+ * Returns list of widgets present on list item by considering name and index of the widget.
714
+ * If we did'nt pass index, it returns array of all the widgets which are matching to widget name
715
+ * @param widgteName: Name of the widget
716
+ * @param index: Index of the widget
717
+ */
718
+ getWidgets(widgteName, index) {
719
+ let $target;
720
+ const retVal = [];
721
+ if (!widgteName) {
722
+ return;
723
+ }
724
+ if (!isDefined(index)) {
725
+ forEach(this.listItems.toArray(), (el) => {
726
+ $target = get(el.currentItemWidgets, widgteName);
727
+ if ($target) {
728
+ retVal.push($target);
729
+ }
730
+ });
731
+ return retVal;
732
+ }
733
+ index = +index || 0;
734
+ $target = get(this.listItems.toArray(), index);
735
+ if ($target) {
736
+ return [get($target.currentItemWidgets, widgteName)];
737
+ }
738
+ }
739
+ // returns listitem reference by index value. This refers to the same method getListItemByIndex.
740
+ getItem(index) {
741
+ return this.getListItemByIndex(index);
742
+ }
743
+ /**
744
+ * Returns index of listItem(listItemDirective / listItemObject)
745
+ * If item is a directive, index is fetched from listItems
746
+ * If item is an object, index is fetched from fieldDefs
747
+ */
748
+ getIndex(item) {
749
+ if (item instanceof ListItemDirective) {
750
+ return this.getListItemIndex(item);
751
+ }
752
+ else if (item) {
753
+ return this.fieldDefs.findIndex((obj) => isEqual(obj, item));
777
754
  }
778
- this.app.notify('wm-event', { eventName, widgetName: this.name, row: row });
779
755
  }
780
756
  create() {
781
757
  if (this._isDependent) {
@@ -814,140 +790,532 @@ class ListComponent extends StylableComponent {
814
790
  this.variableInflight = data.active;
815
791
  // Fix for [WMS-23772] Update nodatafound flag once the response is recieved from the server
816
792
  const totalEle = data.data?.pagination?.totalElements;
817
- if (!_.isUndefined(totalEle)) {
793
+ if (!isUndefined(totalEle)) {
818
794
  this.noDataFound = totalEle === 0 ? true : false;
819
795
  }
820
796
  else { // totalelements is undefined
821
- this.noDataFound = _.isEmpty(data.data?.data);
797
+ this.noDataFound = isEmpty(data.data?.data);
822
798
  }
823
799
  });
824
800
  }
825
801
  }
826
- resetNavigation() {
827
- this.showNavigation = false;
828
- this.navControls = undefined;
829
- this.infScroll = false;
830
- this.onDemandLoad = false;
831
- }
832
- enableBasicNavigation() {
833
- this.navControls = NAVIGATION_TYPE.BASIC;
834
- this.showNavigation = true;
835
- }
836
- enableInlineNavigation() {
837
- this.navControls = NAVIGATION_TYPE.INLINE;
838
- }
839
- enableClassicNavigation() {
840
- this.navControls = NAVIGATION_TYPE.CLASSIC;
841
- this.showNavigation = true;
842
- }
843
- enablePagerNavigation() {
844
- this.navControls = NAVIGATION_TYPE.PAGER;
845
- this.showNavigation = true;
846
- }
847
- setNavigationTypeNone() {
848
- this.navControls = NAVIGATION_TYPE.NONE;
849
- this.showNavigation = false;
850
- }
851
- enableInfiniteScroll() {
852
- this.infScroll = true;
853
- }
854
- enableOnDemandLoad() {
855
- this.onDemandLoad = true;
856
- this.showNavigation = true;
857
- }
858
- /**
859
- * Sets Navigation type for the list.
860
- * @param type
861
- */
862
- onNavigationTypeChange(type) {
863
- this.resetNavigation();
864
- switch (type) {
865
- case NAVIGATION_TYPE.BASIC:
866
- this.enableBasicNavigation();
867
- break;
868
- case NAVIGATION_TYPE.INLINE:
869
- this.enableInlineNavigation();
870
- break;
871
- case NAVIGATION_TYPE.ADVANCED:
872
- case NAVIGATION_TYPE.CLASSIC:
873
- this.enableClassicNavigation();
874
- break;
875
- case NAVIGATION_TYPE.PAGER:
876
- this.enablePagerNavigation();
877
- break;
878
- case NAVIGATION_TYPE.NONE:
879
- this.setNavigationTypeNone();
880
- break;
881
- case NAVIGATION_TYPE.SCROLL:
882
- this.enableInfiniteScroll();
883
- break;
884
- case NAVIGATION_TYPE.ONDEMAND:
885
- this.enableOnDemandLoad();
886
- break;
802
+ triggerListItemSelection($el, $event) {
803
+ if ($el && $el[0]) {
804
+ const listItemContext = $el.data('listItemContext');
805
+ // Trigger click event only if the list item is from the corresponding list.
806
+ if (listItemContext.listComponent === this) {
807
+ this.onItemClick($event, listItemContext);
808
+ }
887
809
  }
888
810
  }
889
- /**
890
- * Update fieldDefs property, fieldDefs is the model of the List Component.
891
- * fieldDefs is an Array type.
892
- * @param newVal
893
- */
894
- updateFieldDefs(newVal) {
895
- if (this.infScroll || this.onDemandLoad) {
896
- [this.fieldDefs, this.currentPage] = this.paginationService.updateFieldsOnPagination(this, newVal);
897
- }
898
- else {
899
- this.fieldDefs = newVal;
900
- }
901
- if (this.orderby) {
902
- this.fieldDefs = getOrderedDataset(this.fieldDefs, this.orderby);
903
- }
904
- if (this.groupby) {
905
- this.groupedData = groupData(this, this.fieldDefs, this.groupby, this.match, this.orderby, this.dateformat, this.datePipe, undefined, this.appDefaults);
906
- }
907
- if (!this.fieldDefs.length) {
908
- this.noDataFound = true;
909
- this.selecteditem = undefined;
811
+ // this method is called form other data widgets like table.
812
+ execute(operation, options) {
813
+ if ([DataSource.Operation.IS_API_AWARE, DataSource.Operation.IS_PAGEABLE, DataSource.Operation.SUPPORTS_SERVER_FILTER].includes(operation)) {
814
+ return false;
910
815
  }
911
- $appDigest();
912
- this.listItems.setDirty();
816
+ return this.datasource.execute(operation, options);
913
817
  }
914
- onDataChange(newVal) {
915
- // Check for newVal is not empty
916
- if (!_.isEmpty(newVal)) {
917
- this.noDataFound = false;
918
- this.isDataChanged = true;
919
- if (this.datasource && this.datasource.execute(DataSource.Operation.IS_API_AWARE)) {
920
- // clone the the data in case of live and service variables to prevent the two-way binding for these variables.
921
- newVal = _.cloneDeep(newVal);
922
- }
923
- if (isObject(newVal) && !_.isArray(newVal)) {
924
- newVal = _.isEmpty(newVal) ? [] : [newVal];
925
- }
926
- if (_.isString(newVal)) {
927
- newVal = newVal.split(',');
928
- }
929
- // if the page number is greater than 1 on initial load then we render the first page.
930
- if (this.datasource && this.datasource.owner === 'App' && (this.infScroll || this.onDemandLoad) && !this.currentPage && this.datasource.execute(DataSource.Operation.GET_PAGING_OPTIONS).number > 0) {
931
- newVal = this.datasource.execute(DataSource.Operation.LIST_RECORDS, {
932
- 'page': 1
933
- });
934
- }
935
- if (_.isArray(newVal)) {
936
- if (newVal.length) {
937
- this.invokeEventCallback('beforedatarender', { $data: newVal });
938
- }
939
- this.updateFieldDefs(newVal);
940
- }
941
- }
942
- else {
943
- this.updateFieldDefs([]);
818
+ handleKeyDown($event, action) {
819
+ $event.stopPropagation();
820
+ if ($event.keyCode !== 13 && $event.keyCode !== 9 && !(($event.target.classList.contains('form-control') || $event.target.classList.contains('note-editable')) && $event.keyCode === 32)) {
821
+ $event.preventDefault();
944
822
  }
945
- }
946
- // Updates the dataSource when pagination is enabled for the Component.
947
- setupDataSource() {
948
- const dataNavigator = this.dataNavigator;
949
- dataNavigator.options = {
950
- maxResults: this.pagesize || 20
823
+ const listItems = this.listItems;
824
+ let presentIndex = this.getListItemIndex(this.lastSelectedItem);
825
+ if (this.multiselect) {
826
+ const firstIndex = this.getListItemIndex(this.firstSelectedItem);
827
+ const selectCount = isArray(this.selecteditem) ? this.selecteditem.length : (isObject(this.selecteditem) ? 1 : 0);
828
+ if (action === 'selectPrev') {
829
+ if (presentIndex > 0) {
830
+ if ((presentIndex <= firstIndex) && this.checkSelectionLimit(selectCount)) {
831
+ this.lastSelectedItem = this.getListItemByIndex(presentIndex - 1);
832
+ this.toggleListItemSelection(this.lastSelectedItem);
833
+ }
834
+ else if (presentIndex > firstIndex) {
835
+ this.toggleListItemSelection(this.getListItemByIndex(presentIndex));
836
+ this.lastSelectedItem = this.getListItemByIndex(presentIndex - 1);
837
+ }
838
+ else {
839
+ this.invokeEventCallback('selectionlimitexceed', { $event });
840
+ }
841
+ }
842
+ }
843
+ else if (action === 'selectNext') {
844
+ if (presentIndex < listItems.length - 1) {
845
+ if ((presentIndex >= firstIndex) && this.checkSelectionLimit(selectCount)) {
846
+ this.lastSelectedItem = this.getListItemByIndex(presentIndex + 1);
847
+ this.toggleListItemSelection(this.lastSelectedItem);
848
+ }
849
+ else if (presentIndex < firstIndex) {
850
+ this.toggleListItemSelection(this.getListItemByIndex(presentIndex));
851
+ this.lastSelectedItem = this.getListItemByIndex(presentIndex + 1);
852
+ }
853
+ else {
854
+ this.invokeEventCallback('selectionlimitexceed', { $event });
855
+ }
856
+ }
857
+ }
858
+ }
859
+ if (action === 'focusPrev') {
860
+ if (this.isListElementMovable) {
861
+ presentIndex = presentIndex <= 0 ? 0 : (presentIndex);
862
+ if (presentIndex === 0) {
863
+ return;
864
+ }
865
+ this.lastSelectedItem = this.getListItemByIndex(presentIndex);
866
+ const prevElt = this.getListItemByIndex(presentIndex - 1);
867
+ prevElt.nativeElement.before(this.lastSelectedItem.nativeElement);
868
+ this.lastSelectedItem.nativeElement.focus();
869
+ this.statePersistence.removeWidgetState(this, 'selectedItem');
870
+ const arr = this.listItems.toArray();
871
+ [arr[presentIndex - 1], arr[presentIndex]] = [arr[presentIndex], arr[presentIndex - 1]];
872
+ this.listItems.reset(arr);
873
+ this.currentIndex = presentIndex;
874
+ this.ariaText = "selected ";
875
+ }
876
+ else {
877
+ presentIndex = presentIndex <= 0 ? 0 : (presentIndex - 1);
878
+ this.lastSelectedItem = this.getListItemByIndex(presentIndex);
879
+ this.lastSelectedItem.nativeElement.focus();
880
+ this.currentIndex = presentIndex + 1;
881
+ this.ariaText = "selected ";
882
+ }
883
+ }
884
+ else if (action === 'focusNext') {
885
+ if (this.isListElementMovable) {
886
+ presentIndex = presentIndex < (listItems.length - 1) ? (presentIndex) : (listItems.length - 1);
887
+ if (presentIndex === this.listItems.length - 1) {
888
+ return;
889
+ }
890
+ this.lastSelectedItem = this.getListItemByIndex(presentIndex);
891
+ const nextElt = this.getListItemByIndex(presentIndex + 1);
892
+ nextElt.nativeElement.after(this.lastSelectedItem.nativeElement);
893
+ this.lastSelectedItem.nativeElement.focus();
894
+ this.statePersistence.removeWidgetState(this, 'selectedItem');
895
+ const arr = this.listItems.toArray();
896
+ [arr[presentIndex], arr[presentIndex + 1]] = [arr[presentIndex + 1], arr[presentIndex]];
897
+ this.listItems.reset(arr);
898
+ this.currentIndex = presentIndex + 2;
899
+ this.ariaText = "selected ";
900
+ }
901
+ else {
902
+ presentIndex = presentIndex < (listItems.length - 1) ? (presentIndex + 1) : (listItems.length - 1);
903
+ this.lastSelectedItem = this.getListItemByIndex(presentIndex);
904
+ this.lastSelectedItem.nativeElement.focus();
905
+ this.currentIndex = presentIndex + 1;
906
+ this.ariaText = "selected ";
907
+ }
908
+ }
909
+ else if (action === 'select') {
910
+ // if the enter click is pressed on the item which is not the last selected item, the find the item from which the event is originated.
911
+ if (presentIndex === -1 || !$($event.target).closest(this.lastSelectedItem.nativeElement)) {
912
+ const $li = $($event.target).closest('li.app-list-item');
913
+ const $ul = $li.closest('ul.app-livelist-container');
914
+ presentIndex = $ul.find('li.app-list-item').index($li);
915
+ }
916
+ this.onItemClick($event, this.getListItemByIndex(presentIndex));
917
+ }
918
+ else if (action === 'space') {
919
+ if (!this.enablereorder) {
920
+ return;
921
+ }
922
+ this.isListElementMovable = !this.isListElementMovable;
923
+ this.onItemClick($event, this.getListItemByIndex(presentIndex));
924
+ this.currentIndex = presentIndex + 1;
925
+ if (this.isListElementMovable) {
926
+ this.ariaText = `Item ${this.currentIndex} grabbed, current position `;
927
+ this.$ulEle.data('oldIndex', presentIndex);
928
+ }
929
+ else {
930
+ this.ariaText = `Item ${this.currentIndex} dropped, final position `;
931
+ this.onUpdate($event, undefined, presentIndex);
932
+ }
933
+ }
934
+ }
935
+ onPropertyChange(key, nv, ov) {
936
+ if (key === 'dataset') {
937
+ if (!nv && this.binddatasource && !this.datasource) {
938
+ return;
939
+ }
940
+ this.onDataSetChange(nv);
941
+ }
942
+ else if (key === 'datasource') {
943
+ if (this.dataset) {
944
+ this.onDataSetChange(this.dataset);
945
+ }
946
+ }
947
+ else if (key === 'navigation') {
948
+ // Support for older projects where navigation type was advanced instead of classic
949
+ if (nv === 'Advanced') {
950
+ this.navigation = 'Classic';
951
+ return;
952
+ }
953
+ switchClass(this.nativeElement, nv, ov);
954
+ this.onNavigationTypeChange(nv);
955
+ if (this.dataNavigator) {
956
+ this.dataNavigator.navigationClass = this.paginationclass;
957
+ }
958
+ }
959
+ else if (key === 'itemsperrow') {
960
+ setListClass(this);
961
+ }
962
+ else if (key === 'tabindex') {
963
+ return;
964
+ }
965
+ else if (key === 'pulltorefresh' && nv) {
966
+ this.app.notify('pullToRefresh:enable');
967
+ this.subscribeToPullToRefresh();
968
+ }
969
+ else if (key === 'paginationclass') {
970
+ if (this.dataNavigator) {
971
+ // Adding setTimeout because in pagination component updateNavSize method is overriding navigationclass
972
+ setTimeout(() => this.dataNavigator.navigationClass = nv);
973
+ }
974
+ }
975
+ else if (key === 'pagesize') {
976
+ this.dataNavigator.options = {
977
+ maxResults: nv
978
+ };
979
+ this.dataNavigator.widget.maxResults = nv;
980
+ this.dataNavigator.maxResults = nv;
981
+ }
982
+ else if (key === 'enablereorder') {
983
+ if (nv && this.$ulEle) {
984
+ this.$ulEle.attr('aria-describedby', this.titleId);
985
+ this.configureDnD();
986
+ this.$ulEle.sortable('enable');
987
+ }
988
+ else if (this.$ulEle && !nv) {
989
+ this.$ulEle.removeAttr('aria-describedby');
990
+ this.$ulEle.sortable('disable');
991
+ }
992
+ }
993
+ else {
994
+ super.onPropertyChange(key, nv, ov);
995
+ }
996
+ }
997
+ onItemClick(evt, $listItem) {
998
+ let selectCount;
999
+ if (!$listItem.disableItem) {
1000
+ this.firstSelectedItem = this.firstSelectedItem || $listItem;
1001
+ // Setting selectCount value based number of items selected.
1002
+ selectCount = isArray(this.selecteditem) ? this.selecteditem.length : (isObject(this.selecteditem) ? 1 : 0);
1003
+ // Handling multiselect for mobile device
1004
+ if (this.multiselect && isMobile()) {
1005
+ if (this.checkSelectionLimit(selectCount) || $listItem.isActive) {
1006
+ this.toggleListItemSelection($listItem);
1007
+ }
1008
+ else {
1009
+ this.invokeEventCallback('selectionlimitexceed', { $event: evt });
1010
+ }
1011
+ }
1012
+ else if ((evt.ctrlKey || evt.metaKey) && this.multiselect) {
1013
+ if (this.checkSelectionLimit(selectCount) || $listItem.isActive) {
1014
+ this.firstSelectedItem = this.lastSelectedItem = $listItem;
1015
+ this.toggleListItemSelection($listItem);
1016
+ }
1017
+ else {
1018
+ this.invokeEventCallback('selectionlimitexceed', { $event: evt });
1019
+ }
1020
+ }
1021
+ else if (evt.shiftKey && this.multiselect) {
1022
+ let first = $listItem.context.index;
1023
+ let last = this.firstSelectedItem.context.index;
1024
+ // if first is greater than last, then swap values
1025
+ if (first > last) {
1026
+ last = [first, first = last][0];
1027
+ }
1028
+ if (this.checkSelectionLimit(last - first)) {
1029
+ this.clearSelectedItems();
1030
+ this.listItems.forEach(($liItem) => {
1031
+ const index = $liItem.context.index;
1032
+ if (index >= first && index <= last) {
1033
+ this.toggleListItemSelection($liItem);
1034
+ }
1035
+ });
1036
+ this.lastSelectedItem = $listItem;
1037
+ }
1038
+ else {
1039
+ this.invokeEventCallback('selectionlimitexceed', { $event: evt });
1040
+ }
1041
+ }
1042
+ else {
1043
+ if (!$listItem.isActive || selectCount > 1) {
1044
+ this.clearSelectedItems();
1045
+ this.toggleListItemSelection($listItem);
1046
+ this.firstSelectedItem = this.lastSelectedItem = $listItem;
1047
+ }
1048
+ }
1049
+ $appDigest();
1050
+ }
1051
+ }
1052
+ // Empty the list content on clear
1053
+ clear() {
1054
+ this.updateFieldDefs([]);
1055
+ }
1056
+ /**
1057
+ * deselects item in the list.
1058
+ * @param val: index | model of the list item.
1059
+ */
1060
+ deselectItem(val) {
1061
+ const listItem = this.getItemRefByIndexOrModel(val);
1062
+ if (listItem && listItem.isActive) {
1063
+ this.toggleListItemSelection(listItem);
1064
+ }
1065
+ }
1066
+ /**
1067
+ * selects item in the list.
1068
+ * @param val: index | model of the list item.
1069
+ */
1070
+ selectItem(val, statePersistenceTriggered) {
1071
+ const listItem = this.getItemRefByIndexOrModel(val);
1072
+ if (!listItem) {
1073
+ return;
1074
+ }
1075
+ if (!listItem.isActive) {
1076
+ this.toggleListItemSelection(listItem, statePersistenceTriggered);
1077
+ }
1078
+ // focus the element.
1079
+ listItem.nativeElement.focus();
1080
+ }
1081
+ ngOnInit() {
1082
+ super.ngOnInit();
1083
+ this.handleHeaderClick = noop;
1084
+ setTimeout(() => {
1085
+ this.debouncedFetchNextDatasetOnScroll = this.paginationService.debouncedFetchNextDatasetOnScroll(this.dataNavigator, DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME, this);
1086
+ }, 0);
1087
+ this._items = [];
1088
+ this.fieldDefs = [];
1089
+ this.reorderProps = {
1090
+ minIndex: null,
1091
+ maxIndex: null
1092
+ };
1093
+ }
1094
+ ngAfterViewInit() {
1095
+ this.promiseResolverFn();
1096
+ this.propsInitPromise.then(() => {
1097
+ super.ngAfterViewInit();
1098
+ this.setUpCUDHandlers();
1099
+ this.selectedItemWidgets = this.multiselect ? [] : {};
1100
+ var ele = $(this.nativeElement).find('.app-livelist-container');
1101
+ if (this.enablereorder && !this.groupby) {
1102
+ if (ele) {
1103
+ ele.attr('aria-describedby', this.titleId);
1104
+ }
1105
+ this.configureDnD();
1106
+ }
1107
+ if (!this.enablereorder) {
1108
+ if (ele) {
1109
+ ele.removeAttr('aria-describedby');
1110
+ }
1111
+ }
1112
+ if (this.groupby && this.collapsible) {
1113
+ this.handleHeaderClick = handleHeaderClick;
1114
+ this.toggleAllHeaders = toggleAllHeaders.bind(undefined, this);
1115
+ }
1116
+ setListClass(this);
1117
+ });
1118
+ this.setupHandlers();
1119
+ const $ul = this.nativeElement.querySelector('ul.app-livelist-container');
1120
+ styler($ul, this, APPLY_STYLES_TYPE.SCROLLABLE_CONTAINER);
1121
+ if (this.enablereorder) {
1122
+ if ($ul) {
1123
+ $ul.setAttribute('aria-describedby', this.titleId);
1124
+ }
1125
+ }
1126
+ if (!this.enablereorder) {
1127
+ if ($ul) {
1128
+ $ul.removeAttribute('aria-describedby');
1129
+ }
1130
+ }
1131
+ if (isMobileApp() && $ul.querySelector('.app-list-item-action-panel')) {
1132
+ this._listAnimator = new ListAnimator(this);
1133
+ }
1134
+ }
1135
+ ngOnDestroy() {
1136
+ if (this._listAnimator && this._listAnimator.$btnSubscription) {
1137
+ this._listAnimator.$btnSubscription.unsubscribe();
1138
+ }
1139
+ this._listenerDestroyers.forEach(d => d && d());
1140
+ super.ngOnDestroy();
1141
+ }
1142
+ ngOnDetach() {
1143
+ super.ngOnDetach();
1144
+ this._pageLoad = true;
1145
+ }
1146
+ handleEvent(node, eventName, eventCallback, locals) {
1147
+ // tap and doubleTap events are not getting propagated.So, using mouse events instead.
1148
+ const touchToMouse = {
1149
+ tap: 'click',
1150
+ doubletap: 'dblclick'
1151
+ };
1152
+ if (includes(['click', 'tap', 'dblclick', 'doubletap'], eventName)) {
1153
+ this.eventManager.addEventListener(this.nativeElement, touchToMouse[eventName] || eventName, (evt) => {
1154
+ const target = $(evt.target).closest('.app-list-item');
1155
+ if (target.length) {
1156
+ const listItemContext = target.data('listItemContext');
1157
+ if (!listItemContext.disableItem) {
1158
+ this.invokeEventCallback(eventName, {
1159
+ widget: listItemContext,
1160
+ $event: evt,
1161
+ item: listItemContext.item
1162
+ });
1163
+ }
1164
+ }
1165
+ });
1166
+ }
1167
+ }
1168
+ getConfiguredState() {
1169
+ const mode = this.statePersistence.computeMode(this.statehandler);
1170
+ return mode && mode.toLowerCase();
1171
+ }
1172
+ handleStateParams(options) {
1173
+ if (this._pageLoad && this.getConfiguredState() !== 'none') {
1174
+ this._pageLoad = false;
1175
+ const widgetState = this.statePersistence.getWidgetState(this);
1176
+ if (get(widgetState, 'pagination')) {
1177
+ options.options = options.options || {};
1178
+ options.options.page = widgetState.pagination;
1179
+ }
1180
+ if (get(widgetState, 'selectedItem')) {
1181
+ this._selectedItemsExist = true;
1182
+ }
1183
+ }
1184
+ }
1185
+ triggerWMEvent(eventName, item) {
1186
+ $invokeWatchers(true);
1187
+ // If we have multiselect for the livelist(List with form template), in run mode deleting a record is getting failed. Becuase the selecteditem will be array of objects. So consider the last object.
1188
+ let row = this.multiselect ? last(this.selecteditem) : this.selecteditem;
1189
+ if (item) {
1190
+ row = item;
1191
+ }
1192
+ this.app.notify('wm-event', { eventName, widgetName: this.name, row: row });
1193
+ }
1194
+ resetNavigation() {
1195
+ this.showNavigation = false;
1196
+ this.navControls = undefined;
1197
+ this.infScroll = false;
1198
+ this.onDemandLoad = false;
1199
+ }
1200
+ enableBasicNavigation() {
1201
+ this.navControls = NAVIGATION_TYPE.BASIC;
1202
+ this.showNavigation = true;
1203
+ }
1204
+ enableInlineNavigation() {
1205
+ this.navControls = NAVIGATION_TYPE.INLINE;
1206
+ }
1207
+ enableClassicNavigation() {
1208
+ this.navControls = NAVIGATION_TYPE.CLASSIC;
1209
+ this.showNavigation = true;
1210
+ }
1211
+ enablePagerNavigation() {
1212
+ this.navControls = NAVIGATION_TYPE.PAGER;
1213
+ this.showNavigation = true;
1214
+ }
1215
+ setNavigationTypeNone() {
1216
+ this.navControls = NAVIGATION_TYPE.NONE;
1217
+ this.showNavigation = false;
1218
+ }
1219
+ enableInfiniteScroll() {
1220
+ this.infScroll = true;
1221
+ }
1222
+ enableOnDemandLoad() {
1223
+ this.onDemandLoad = true;
1224
+ this.showNavigation = true;
1225
+ }
1226
+ /**
1227
+ * Sets Navigation type for the list.
1228
+ * @param type
1229
+ */
1230
+ onNavigationTypeChange(type) {
1231
+ this.resetNavigation();
1232
+ switch (type) {
1233
+ case NAVIGATION_TYPE.BASIC:
1234
+ this.enableBasicNavigation();
1235
+ break;
1236
+ case NAVIGATION_TYPE.INLINE:
1237
+ this.enableInlineNavigation();
1238
+ break;
1239
+ case NAVIGATION_TYPE.ADVANCED:
1240
+ case NAVIGATION_TYPE.CLASSIC:
1241
+ this.enableClassicNavigation();
1242
+ break;
1243
+ case NAVIGATION_TYPE.PAGER:
1244
+ this.enablePagerNavigation();
1245
+ break;
1246
+ case NAVIGATION_TYPE.NONE:
1247
+ this.setNavigationTypeNone();
1248
+ break;
1249
+ case NAVIGATION_TYPE.SCROLL:
1250
+ this.enableInfiniteScroll();
1251
+ break;
1252
+ case NAVIGATION_TYPE.ONDEMAND:
1253
+ this.enableOnDemandLoad();
1254
+ break;
1255
+ }
1256
+ }
1257
+ /**
1258
+ * Update fieldDefs property, fieldDefs is the model of the List Component.
1259
+ * fieldDefs is an Array type.
1260
+ * @param newVal
1261
+ */
1262
+ updateFieldDefs(newVal) {
1263
+ if (this.infScroll || this.onDemandLoad) {
1264
+ [this.fieldDefs, this.currentPage] = this.paginationService.updateFieldsOnPagination(this, newVal);
1265
+ }
1266
+ else {
1267
+ this.fieldDefs = newVal;
1268
+ }
1269
+ if (this.orderby) {
1270
+ this.fieldDefs = getOrderedDataset(this.fieldDefs, this.orderby);
1271
+ }
1272
+ if (this.groupby) {
1273
+ this.groupedData = groupData(this, this.fieldDefs, this.groupby, this.match, this.orderby, this.dateformat, this.datePipe, undefined, this.appDefaults);
1274
+ }
1275
+ if (!this.fieldDefs.length) {
1276
+ this.noDataFound = true;
1277
+ this.selecteditem = undefined;
1278
+ }
1279
+ $appDigest();
1280
+ this.listItems.setDirty();
1281
+ }
1282
+ onDataChange(newVal) {
1283
+ // Check for newVal is not empty
1284
+ if (!isEmpty(newVal)) {
1285
+ this.noDataFound = false;
1286
+ this.isDataChanged = true;
1287
+ if (this.datasource && this.datasource.execute(DataSource.Operation.IS_API_AWARE)) {
1288
+ // clone the the data in case of live and service variables to prevent the two-way binding for these variables.
1289
+ newVal = cloneDeep(newVal);
1290
+ }
1291
+ if (isObject(newVal) && !isArray(newVal)) {
1292
+ newVal = isEmpty(newVal) ? [] : [newVal];
1293
+ }
1294
+ if (isString(newVal)) {
1295
+ newVal = newVal.split(',');
1296
+ }
1297
+ // if the page number is greater than 1 on initial load then we render the first page.
1298
+ if (this.datasource && this.datasource.owner === 'App' && (this.infScroll || this.onDemandLoad) && !this.currentPage && this.datasource.execute(DataSource.Operation.GET_PAGING_OPTIONS).number > 0) {
1299
+ newVal = this.datasource.execute(DataSource.Operation.LIST_RECORDS, {
1300
+ 'page': 1
1301
+ });
1302
+ }
1303
+ if (isArray(newVal)) {
1304
+ if (newVal.length) {
1305
+ this.invokeEventCallback('beforedatarender', { $data: newVal });
1306
+ }
1307
+ this.updateFieldDefs(newVal);
1308
+ }
1309
+ }
1310
+ else {
1311
+ this.updateFieldDefs([]);
1312
+ }
1313
+ }
1314
+ // Updates the dataSource when pagination is enabled for the Component.
1315
+ setupDataSource() {
1316
+ const dataNavigator = this.dataNavigator;
1317
+ dataNavigator.options = {
1318
+ maxResults: this.pagesize || 20
951
1319
  };
952
1320
  this.dataNavigatorWatched = true;
953
1321
  if (this.navigatorResultWatch) {
@@ -973,13 +1341,13 @@ class ListComponent extends StylableComponent {
973
1341
  this.dataNavigator.setBindDataSet(this.binddataset, this.viewParent, datasetBoundExpr ? this.context : this.datasource, this.dataset, this.binddatasource, datasetBoundExpr, this.statehandler);
974
1342
  }
975
1343
  onDataSetChange(newVal) {
976
- if (_.get(this.datasource, 'category') === 'wm.Variable' && this.getConfiguredState() !== 'none' && this._pageLoad) {
1344
+ if (get(this.datasource, 'category') === 'wm.Variable' && this.getConfiguredState() !== 'none' && this._pageLoad) {
977
1345
  const widgetState = this.statePersistence.getWidgetState(this);
978
1346
  this._pageLoad = false;
979
- if (_.get(widgetState, 'pagination')) {
1347
+ if (get(widgetState, 'pagination')) {
980
1348
  this.dataNavigator.pageChanged({ page: widgetState.pagination }, true);
981
1349
  }
982
- if (_.get(widgetState, 'selectedItem')) {
1350
+ if (get(widgetState, 'selectedItem')) {
983
1351
  this._selectedItemsExist = true;
984
1352
  }
985
1353
  }
@@ -1014,29 +1382,29 @@ class ListComponent extends StylableComponent {
1014
1382
  getListItemByModel(listModel) {
1015
1383
  return this.listItems.find((listItem) => {
1016
1384
  let itemObj = listItem.item;
1017
- if (this.groupby && !_.has(listModel, '_groupIndex')) {
1385
+ if (this.groupby && !has(listModel, '_groupIndex')) {
1018
1386
  // If groupby is enabled, item contains _groupIndex property which should be excluded while comparing model.
1019
- itemObj = _.clone(itemObj);
1387
+ itemObj = clone(itemObj);
1020
1388
  delete itemObj._groupIndex;
1021
1389
  }
1022
- if (_.isEqual(itemObj, listModel)) {
1390
+ if (isEqual(itemObj, listModel)) {
1023
1391
  return true;
1024
1392
  }
1025
1393
  }) || null;
1026
1394
  }
1027
1395
  updateSelectedItemsWidgets(statePersistenceTriggered) {
1028
1396
  let obj = {}, widgetState;
1029
- const pageNum = _.get(this.dataNavigator, 'dn.currentPage') || 1;
1397
+ const pageNum = get(this.dataNavigator, 'dn.currentPage') || 1;
1030
1398
  if (this.getConfiguredState() !== 'none') {
1031
1399
  // remove previously configured selected items for current page and construct new ones later below.
1032
1400
  widgetState = this.statePersistence.getWidgetState(this) || {};
1033
- if (_.get(widgetState, 'selectedItem')) {
1401
+ if (get(widgetState, 'selectedItem')) {
1034
1402
  // when multiselect is on and an item is selected without pressing CTRL, previously selected items in state should be empty.
1035
1403
  if (this.multiselect && this.selecteditem.length === 1) {
1036
1404
  widgetState.selectedItem = [];
1037
1405
  }
1038
1406
  else {
1039
- _.remove(widgetState.selectedItem, function (selectedItem) {
1407
+ remove(widgetState.selectedItem, function (selectedItem) {
1040
1408
  return selectedItem.page === pageNum;
1041
1409
  });
1042
1410
  }
@@ -1054,8 +1422,8 @@ class ListComponent extends StylableComponent {
1054
1422
  this.selectedItemWidgets = item.currentItemWidgets;
1055
1423
  }
1056
1424
  obj = { page: pageNum, index: index };
1057
- if (_.get(widgetState, 'selectedItem') && this.multiselect) {
1058
- if (!_.some(widgetState.selectedItem, obj)) {
1425
+ if (get(widgetState, 'selectedItem') && this.multiselect) {
1426
+ if (!some(widgetState.selectedItem, obj)) {
1059
1427
  widgetState.selectedItem.push(obj);
1060
1428
  }
1061
1429
  }
@@ -1083,13 +1451,13 @@ class ListComponent extends StylableComponent {
1083
1451
  // item is not allowed to get selected if it is disabled.
1084
1452
  if ($listItem && !$listItem.disableItem) {
1085
1453
  let item = $listItem.item;
1086
- if (this.groupby && _.has(item, '_groupIndex')) {
1454
+ if (this.groupby && has(item, '_groupIndex')) {
1087
1455
  // If groupby is enabled, item contains _groupIndex property which should be excluded from selecteditem.
1088
- item = _.clone(item);
1456
+ item = clone(item);
1089
1457
  delete item._groupIndex;
1090
1458
  }
1091
1459
  if ($listItem.isActive) {
1092
- this._items = _.pullAllWith(this._items, [item], _.isEqual);
1460
+ this._items = pullAllWith(this._items, [item], isEqual);
1093
1461
  $listItem.isActive = false;
1094
1462
  }
1095
1463
  else {
@@ -1117,10 +1485,10 @@ class ListComponent extends StylableComponent {
1117
1485
  }
1118
1486
  if (this.isDataChanged && this.getConfiguredState() !== 'none' && listItems.length && this._selectedItemsExist) {
1119
1487
  const widgetState = this.statePersistence.getWidgetState(this);
1120
- if (_.get(widgetState, 'selectedItem')) {
1488
+ if (get(widgetState, 'selectedItem')) {
1121
1489
  this._selectedItemsExist = false;
1122
- const selectedItemsLength = _.isArray(this.selecteditem) ? this.selecteditem.length : _.toNumber(!_.isEmpty(this.selecteditem));
1123
- const currentPage = _.get(this.dataNavigator, 'dn.currentPage') || 1;
1490
+ const selectedItemsLength = isArray(this.selecteditem) ? this.selecteditem.length : toNumber(!isEmpty(this.selecteditem));
1491
+ const currentPage = get(this.dataNavigator, 'dn.currentPage') || 1;
1124
1492
  widgetState.pagination = widgetState.pagination || 1;
1125
1493
  // to prevent item selection from being triggered more than once
1126
1494
  if (selectedItemsLength !== widgetState.selectedItem.length && widgetState.pagination === currentPage) {
@@ -1132,7 +1500,7 @@ class ListComponent extends StylableComponent {
1132
1500
  }
1133
1501
  }
1134
1502
  }
1135
- const selectedItems = _.isArray(this.selecteditem) ? this.selecteditem : [this.selecteditem];
1503
+ const selectedItems = isArray(this.selecteditem) ? this.selecteditem : [this.selecteditem];
1136
1504
  this.firstSelectedItem = this.lastSelectedItem = null;
1137
1505
  // don't select first item if multi-select is enabled and at least item is already selected in the list.
1138
1506
  // don't select first item if state information has selected items
@@ -1171,24 +1539,15 @@ class ListComponent extends StylableComponent {
1171
1539
  else {
1172
1540
  // In case of mobile app when modal exists, and list items height is greater than the modal content provide ccontainer a scrollable height
1173
1541
  const modalBody = this.$element.closest('.modal-body');
1174
- const listHt = this.$element.find('ul').height();
1175
- const modalHt = window.innerHeight - 140;
1176
- if (isMobile() && modalBody.length && listHt > modalHt) {
1177
- this.$element.css('height', modalHt + 'px');
1178
- }
1179
- this.paginationService.bindScrollEvt(this, '> ul', DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME);
1180
- }
1181
- }
1182
- this.isDataChanged = false;
1183
- }
1184
- triggerListItemSelection($el, $event) {
1185
- if ($el && $el[0]) {
1186
- const listItemContext = $el.data('listItemContext');
1187
- // Trigger click event only if the list item is from the corresponding list.
1188
- if (listItemContext.listComponent === this) {
1189
- this.onItemClick($event, listItemContext);
1542
+ const listHt = this.$element.find('ul').height();
1543
+ const modalHt = window.innerHeight - 140;
1544
+ if (isMobile() && modalBody.length && listHt > modalHt) {
1545
+ this.$element.css('height', modalHt + 'px');
1546
+ }
1547
+ this.paginationService.bindScrollEvt(this, '> ul', DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME);
1190
1548
  }
1191
1549
  }
1550
+ this.isDataChanged = false;
1192
1551
  }
1193
1552
  setupHandlers() {
1194
1553
  this.listItems.changes.subscribe(listItems => {
@@ -1228,344 +1587,99 @@ class ListComponent extends StylableComponent {
1228
1587
  // If ui is not present then it is called from drag and drop using keyboard
1229
1588
  const newIndex = ui === undefined ? presentIndex : ui.item.index();
1230
1589
  const oldIndex = this.$ulEle.data('oldIndex');
1231
- const minIndex = _.min([newIndex, oldIndex]);
1232
- const maxIndex = _.max([newIndex, oldIndex]);
1233
- const draggedItem = _.pullAt(data, oldIndex)[0];
1590
+ const minIndex = min([newIndex, oldIndex]);
1591
+ const maxIndex = max([newIndex, oldIndex]);
1592
+ const draggedItem = pullAt(data, oldIndex)[0];
1234
1593
  // Modify the data list only if we find a draggedItem
1235
- if (draggedItem) {
1236
- if (this.getConfiguredState() !== 'none') {
1237
- this.statePersistence.removeWidgetState(this, 'selectedItem');
1238
- }
1239
- this.reorderProps.minIndex = _.min([minIndex, this.reorderProps.minIndex]);
1240
- this.reorderProps.maxIndex = _.max([maxIndex, this.reorderProps.maxIndex]);
1241
- data.splice(newIndex, 0, draggedItem);
1242
- this.cdRef.markForCheck();
1243
- this.cdRef.detectChanges();
1244
- const $changedItem = {
1245
- oldIndex: oldIndex,
1246
- newIndex: newIndex,
1247
- item: data[newIndex]
1248
- };
1249
- this.invokeEventCallback('reorder', { $event: evt, $data: data, $changedItem });
1250
- this.$ulEle.removeData('oldIndex');
1251
- }
1252
- }
1253
- // configures reordering the list items.
1254
- configureDnD() {
1255
- let appendTo;
1256
- const modalEl = $(document).find('.modal');
1257
- if (this.getAttr('height')) { // when height is applied to the list, append should be the ul's parent as scroll is applied to the parent
1258
- appendTo = 'parent';
1259
- }
1260
- else if (modalEl.length) { // In case of dialog, appendTo should be the modal ele
1261
- appendTo = modalEl[modalEl.length - 1];
1262
- }
1263
- else { // As default append to should be body
1264
- appendTo = 'body';
1265
- }
1266
- const options = isMobileApp() ? {} : {
1267
- appendTo: appendTo,
1268
- };
1269
- const $el = $(this.nativeElement);
1270
- this.$ulEle = $el.find('.app-livelist-container');
1271
- configureDnD(this.$ulEle, options, this.onReorderStart.bind(this), this.onUpdate.bind(this), this.onSort.bind(this));
1272
- this.$ulEle.droppable({ 'accept': '.app-list-item' });
1273
- if (isMobileApp()) {
1274
- this.$ulEle.sortable('disable');
1275
- this.$ulEle.on('touchstart', function (event) {
1276
- let self = this;
1277
- if (!self.touching) {
1278
- if (self.touched) {
1279
- clearTimeout(self.touched);
1280
- }
1281
- setTimeout(() => {
1282
- //Prevent context menu on mobile (IOS/ANDROID)
1283
- if (event.cancelable) {
1284
- event.preventDefault();
1285
- }
1286
- }, 50);
1287
- self.touched = setTimeout(() => {
1288
- $(event.currentTarget).addClass('no-selection');
1289
- //Enable draggable
1290
- $(event.currentTarget).sortable('enable');
1291
- //Set internal flag
1292
- self.touching = true;
1293
- //trigger touchstart again to enable draggable through touch punch
1294
- $(self).trigger(event);
1295
- //Choose preferred duration for taphold
1296
- }, 350);
1297
- }
1298
- }).on('touchend', function (event) {
1299
- this.touching = false;
1300
- $(event.currentTarget).removeClass('no-selection');
1301
- //Disable draggable to enable default behaviour
1302
- $(event.currentTarget).sortable('disable');
1303
- clearTimeout(this.touched);
1304
- }).on('touchmove', function () {
1305
- clearTimeout(this.touched);
1306
- });
1307
- }
1308
- }
1309
- // returns true if the selection limit is reached.
1310
- checkSelectionLimit(count) {
1311
- return (!this.selectionlimit || count < this.selectionlimit);
1312
- }
1313
- // returns listitem reference by index value.
1314
- getListItemByIndex(index) {
1315
- return this.listItems.toArray()[index];
1316
- }
1317
- /**
1318
- * return index of an (listItemDirective) in the listItem
1319
- * @param {ListItemDirective} item
1320
- * @returns {number}
1321
- */
1322
- getListItemIndex(item) {
1323
- return this.listItems.toArray().indexOf(item);
1324
- }
1325
- // this method is called form other data widgets like table.
1326
- execute(operation, options) {
1327
- if ([DataSource.Operation.IS_API_AWARE, DataSource.Operation.IS_PAGEABLE, DataSource.Operation.SUPPORTS_SERVER_FILTER].includes(operation)) {
1328
- return false;
1329
- }
1330
- return this.datasource.execute(operation, options);
1331
- }
1332
- handleKeyDown($event, action) {
1333
- $event.stopPropagation();
1334
- if ($event.keyCode !== 13 && $event.keyCode !== 9 && !(($event.target.classList.contains('form-control') || $event.target.classList.contains('note-editable')) && $event.keyCode === 32)) {
1335
- $event.preventDefault();
1336
- }
1337
- const listItems = this.listItems;
1338
- let presentIndex = this.getListItemIndex(this.lastSelectedItem);
1339
- if (this.multiselect) {
1340
- const firstIndex = this.getListItemIndex(this.firstSelectedItem);
1341
- const selectCount = _.isArray(this.selecteditem) ? this.selecteditem.length : (_.isObject(this.selecteditem) ? 1 : 0);
1342
- if (action === 'selectPrev') {
1343
- if (presentIndex > 0) {
1344
- if ((presentIndex <= firstIndex) && this.checkSelectionLimit(selectCount)) {
1345
- this.lastSelectedItem = this.getListItemByIndex(presentIndex - 1);
1346
- this.toggleListItemSelection(this.lastSelectedItem);
1347
- }
1348
- else if (presentIndex > firstIndex) {
1349
- this.toggleListItemSelection(this.getListItemByIndex(presentIndex));
1350
- this.lastSelectedItem = this.getListItemByIndex(presentIndex - 1);
1351
- }
1352
- else {
1353
- this.invokeEventCallback('selectionlimitexceed', { $event });
1354
- }
1355
- }
1356
- }
1357
- else if (action === 'selectNext') {
1358
- if (presentIndex < listItems.length - 1) {
1359
- if ((presentIndex >= firstIndex) && this.checkSelectionLimit(selectCount)) {
1360
- this.lastSelectedItem = this.getListItemByIndex(presentIndex + 1);
1361
- this.toggleListItemSelection(this.lastSelectedItem);
1362
- }
1363
- else if (presentIndex < firstIndex) {
1364
- this.toggleListItemSelection(this.getListItemByIndex(presentIndex));
1365
- this.lastSelectedItem = this.getListItemByIndex(presentIndex + 1);
1366
- }
1367
- else {
1368
- this.invokeEventCallback('selectionlimitexceed', { $event });
1369
- }
1370
- }
1371
- }
1372
- }
1373
- if (action === 'focusPrev') {
1374
- if (this.isListElementMovable) {
1375
- presentIndex = presentIndex <= 0 ? 0 : (presentIndex);
1376
- if (presentIndex === 0) {
1377
- return;
1378
- }
1379
- this.lastSelectedItem = this.getListItemByIndex(presentIndex);
1380
- const prevElt = this.getListItemByIndex(presentIndex - 1);
1381
- prevElt.nativeElement.before(this.lastSelectedItem.nativeElement);
1382
- this.lastSelectedItem.nativeElement.focus();
1383
- this.statePersistence.removeWidgetState(this, 'selectedItem');
1384
- const arr = this.listItems.toArray();
1385
- [arr[presentIndex - 1], arr[presentIndex]] = [arr[presentIndex], arr[presentIndex - 1]];
1386
- this.listItems.reset(arr);
1387
- this.currentIndex = presentIndex;
1388
- this.ariaText = "selected ";
1389
- }
1390
- else {
1391
- presentIndex = presentIndex <= 0 ? 0 : (presentIndex - 1);
1392
- this.lastSelectedItem = this.getListItemByIndex(presentIndex);
1393
- this.lastSelectedItem.nativeElement.focus();
1394
- this.currentIndex = presentIndex + 1;
1395
- this.ariaText = "selected ";
1396
- }
1397
- }
1398
- else if (action === 'focusNext') {
1399
- if (this.isListElementMovable) {
1400
- presentIndex = presentIndex < (listItems.length - 1) ? (presentIndex) : (listItems.length - 1);
1401
- if (presentIndex === this.listItems.length - 1) {
1402
- return;
1403
- }
1404
- this.lastSelectedItem = this.getListItemByIndex(presentIndex);
1405
- const nextElt = this.getListItemByIndex(presentIndex + 1);
1406
- nextElt.nativeElement.after(this.lastSelectedItem.nativeElement);
1407
- this.lastSelectedItem.nativeElement.focus();
1408
- this.statePersistence.removeWidgetState(this, 'selectedItem');
1409
- const arr = this.listItems.toArray();
1410
- [arr[presentIndex], arr[presentIndex + 1]] = [arr[presentIndex + 1], arr[presentIndex]];
1411
- this.listItems.reset(arr);
1412
- this.currentIndex = presentIndex + 2;
1413
- this.ariaText = "selected ";
1414
- }
1415
- else {
1416
- presentIndex = presentIndex < (listItems.length - 1) ? (presentIndex + 1) : (listItems.length - 1);
1417
- this.lastSelectedItem = this.getListItemByIndex(presentIndex);
1418
- this.lastSelectedItem.nativeElement.focus();
1419
- this.currentIndex = presentIndex + 1;
1420
- this.ariaText = "selected ";
1421
- }
1422
- }
1423
- else if (action === 'select') {
1424
- // if the enter click is pressed on the item which is not the last selected item, the find the item from which the event is originated.
1425
- if (presentIndex === -1 || !$($event.target).closest(this.lastSelectedItem.nativeElement)) {
1426
- const $li = $($event.target).closest('li.app-list-item');
1427
- const $ul = $li.closest('ul.app-livelist-container');
1428
- presentIndex = $ul.find('li.app-list-item').index($li);
1429
- }
1430
- this.onItemClick($event, this.getListItemByIndex(presentIndex));
1431
- }
1432
- else if (action === 'space') {
1433
- if (!this.enablereorder) {
1434
- return;
1435
- }
1436
- this.isListElementMovable = !this.isListElementMovable;
1437
- this.onItemClick($event, this.getListItemByIndex(presentIndex));
1438
- this.currentIndex = presentIndex + 1;
1439
- if (this.isListElementMovable) {
1440
- this.ariaText = `Item ${this.currentIndex} grabbed, current position `;
1441
- this.$ulEle.data('oldIndex', presentIndex);
1442
- }
1443
- else {
1444
- this.ariaText = `Item ${this.currentIndex} dropped, final position `;
1445
- this.onUpdate($event, undefined, presentIndex);
1446
- }
1447
- }
1448
- }
1449
- onPropertyChange(key, nv, ov) {
1450
- if (key === 'dataset') {
1451
- if (!nv && this.binddatasource && !this.datasource) {
1452
- return;
1453
- }
1454
- this.onDataSetChange(nv);
1455
- }
1456
- else if (key === 'datasource') {
1457
- if (this.dataset) {
1458
- this.onDataSetChange(this.dataset);
1459
- }
1460
- }
1461
- else if (key === 'navigation') {
1462
- // Support for older projects where navigation type was advanced instead of classic
1463
- if (nv === 'Advanced') {
1464
- this.navigation = 'Classic';
1465
- return;
1466
- }
1467
- switchClass(this.nativeElement, nv, ov);
1468
- this.onNavigationTypeChange(nv);
1469
- if (this.dataNavigator) {
1470
- this.dataNavigator.navigationClass = this.paginationclass;
1471
- }
1472
- }
1473
- else if (key === 'itemsperrow') {
1474
- setListClass(this);
1475
- }
1476
- else if (key === 'tabindex') {
1477
- return;
1478
- }
1479
- else if (key === 'pulltorefresh' && nv) {
1480
- this.app.notify('pullToRefresh:enable');
1481
- this.subscribeToPullToRefresh();
1482
- }
1483
- else if (key === 'paginationclass') {
1484
- if (this.dataNavigator) {
1485
- // Adding setTimeout because in pagination component updateNavSize method is overriding navigationclass
1486
- setTimeout(() => this.dataNavigator.navigationClass = nv);
1594
+ if (draggedItem) {
1595
+ if (this.getConfiguredState() !== 'none') {
1596
+ this.statePersistence.removeWidgetState(this, 'selectedItem');
1487
1597
  }
1488
- }
1489
- else if (key === 'pagesize') {
1490
- this.dataNavigator.options = {
1491
- maxResults: nv
1598
+ this.reorderProps.minIndex = min([minIndex, this.reorderProps.minIndex]);
1599
+ this.reorderProps.maxIndex = max([maxIndex, this.reorderProps.maxIndex]);
1600
+ data.splice(newIndex, 0, draggedItem);
1601
+ this.cdRef.markForCheck();
1602
+ this.cdRef.detectChanges();
1603
+ const $changedItem = {
1604
+ oldIndex: oldIndex,
1605
+ newIndex: newIndex,
1606
+ item: data[newIndex]
1492
1607
  };
1493
- this.dataNavigator.widget.maxResults = nv;
1494
- this.dataNavigator.maxResults = nv;
1608
+ this.invokeEventCallback('reorder', { $event: evt, $data: data, $changedItem });
1609
+ this.$ulEle.removeData('oldIndex');
1495
1610
  }
1496
- else if (key === 'enablereorder') {
1497
- if (nv && this.$ulEle) {
1498
- this.$ulEle.attr('aria-describedby', this.titleId);
1499
- this.configureDnD();
1500
- this.$ulEle.sortable('enable');
1501
- }
1502
- else if (this.$ulEle && !nv) {
1503
- this.$ulEle.removeAttr('aria-describedby');
1504
- this.$ulEle.sortable('disable');
1505
- }
1611
+ }
1612
+ // configures reordering the list items.
1613
+ configureDnD() {
1614
+ let appendTo;
1615
+ const modalEl = $(document).find('.modal');
1616
+ if (this.getAttr('height')) { // when height is applied to the list, append should be the ul's parent as scroll is applied to the parent
1617
+ appendTo = 'parent';
1506
1618
  }
1507
- else {
1508
- super.onPropertyChange(key, nv, ov);
1619
+ else if (modalEl.length) { // In case of dialog, appendTo should be the modal ele
1620
+ appendTo = modalEl[modalEl.length - 1];
1509
1621
  }
1510
- }
1511
- onItemClick(evt, $listItem) {
1512
- let selectCount;
1513
- if (!$listItem.disableItem) {
1514
- this.firstSelectedItem = this.firstSelectedItem || $listItem;
1515
- // Setting selectCount value based number of items selected.
1516
- selectCount = _.isArray(this.selecteditem) ? this.selecteditem.length : (_.isObject(this.selecteditem) ? 1 : 0);
1517
- // Handling multiselect for mobile device
1518
- if (this.multiselect && isMobile()) {
1519
- if (this.checkSelectionLimit(selectCount) || $listItem.isActive) {
1520
- this.toggleListItemSelection($listItem);
1521
- }
1522
- else {
1523
- this.invokeEventCallback('selectionlimitexceed', { $event: evt });
1524
- }
1525
- }
1526
- else if ((evt.ctrlKey || evt.metaKey) && this.multiselect) {
1527
- if (this.checkSelectionLimit(selectCount) || $listItem.isActive) {
1528
- this.firstSelectedItem = this.lastSelectedItem = $listItem;
1529
- this.toggleListItemSelection($listItem);
1530
- }
1531
- else {
1532
- this.invokeEventCallback('selectionlimitexceed', { $event: evt });
1533
- }
1534
- }
1535
- else if (evt.shiftKey && this.multiselect) {
1536
- let first = $listItem.context.index;
1537
- let last = this.firstSelectedItem.context.index;
1538
- // if first is greater than last, then swap values
1539
- if (first > last) {
1540
- last = [first, first = last][0];
1541
- }
1542
- if (this.checkSelectionLimit(last - first)) {
1543
- this.clearSelectedItems();
1544
- this.listItems.forEach(($liItem) => {
1545
- const index = $liItem.context.index;
1546
- if (index >= first && index <= last) {
1547
- this.toggleListItemSelection($liItem);
1622
+ else { // As default append to should be body
1623
+ appendTo = 'body';
1624
+ }
1625
+ const options = isMobileApp() ? {} : {
1626
+ appendTo: appendTo,
1627
+ };
1628
+ const $el = $(this.nativeElement);
1629
+ this.$ulEle = $el.find('.app-livelist-container');
1630
+ configureDnD(this.$ulEle, options, this.onReorderStart.bind(this), this.onUpdate.bind(this), this.onSort.bind(this));
1631
+ this.$ulEle.droppable({ 'accept': '.app-list-item' });
1632
+ if (isMobileApp()) {
1633
+ this.$ulEle.sortable('disable');
1634
+ this.$ulEle.on('touchstart', function (event) {
1635
+ let self = this;
1636
+ if (!self.touching) {
1637
+ if (self.touched) {
1638
+ clearTimeout(self.touched);
1639
+ }
1640
+ setTimeout(() => {
1641
+ //Prevent context menu on mobile (IOS/ANDROID)
1642
+ if (event.cancelable) {
1643
+ event.preventDefault();
1548
1644
  }
1549
- });
1550
- this.lastSelectedItem = $listItem;
1551
- }
1552
- else {
1553
- this.invokeEventCallback('selectionlimitexceed', { $event: evt });
1554
- }
1555
- }
1556
- else {
1557
- if (!$listItem.isActive || selectCount > 1) {
1558
- this.clearSelectedItems();
1559
- this.toggleListItemSelection($listItem);
1560
- this.firstSelectedItem = this.lastSelectedItem = $listItem;
1645
+ }, 50);
1646
+ self.touched = setTimeout(() => {
1647
+ $(event.currentTarget).addClass('no-selection');
1648
+ //Enable draggable
1649
+ $(event.currentTarget).sortable('enable');
1650
+ //Set internal flag
1651
+ self.touching = true;
1652
+ //trigger touchstart again to enable draggable through touch punch
1653
+ $(self).trigger(event);
1654
+ //Choose preferred duration for taphold
1655
+ }, 350);
1561
1656
  }
1562
- }
1563
- $appDigest();
1657
+ }).on('touchend', function (event) {
1658
+ this.touching = false;
1659
+ $(event.currentTarget).removeClass('no-selection');
1660
+ //Disable draggable to enable default behaviour
1661
+ $(event.currentTarget).sortable('disable');
1662
+ clearTimeout(this.touched);
1663
+ }).on('touchmove', function () {
1664
+ clearTimeout(this.touched);
1665
+ });
1564
1666
  }
1565
1667
  }
1566
- // Empty the list content on clear
1567
- clear() {
1568
- this.updateFieldDefs([]);
1668
+ // returns true if the selection limit is reached.
1669
+ checkSelectionLimit(count) {
1670
+ return (!this.selectionlimit || count < this.selectionlimit);
1671
+ }
1672
+ // returns listitem reference by index value.
1673
+ getListItemByIndex(index) {
1674
+ return this.listItems.toArray()[index];
1675
+ }
1676
+ /**
1677
+ * return index of an (listItemDirective) in the listItem
1678
+ * @param {ListItemDirective} item
1679
+ * @returns {number}
1680
+ */
1681
+ getListItemIndex(item) {
1682
+ return this.listItems.toArray().indexOf(item);
1569
1683
  }
1570
1684
  /**
1571
1685
  * Returns ListItem Reference based on the input provided.
@@ -1582,52 +1696,9 @@ class ListComponent extends StylableComponent {
1582
1696
  }
1583
1697
  return listItem;
1584
1698
  }
1585
- /**
1586
- * deselects item in the list.
1587
- * @param val: index | model of the list item.
1588
- */
1589
- deselectItem(val) {
1590
- const listItem = this.getItemRefByIndexOrModel(val);
1591
- if (listItem && listItem.isActive) {
1592
- this.toggleListItemSelection(listItem);
1593
- }
1594
- }
1595
- /**
1596
- * selects item in the list.
1597
- * @param val: index | model of the list item.
1598
- */
1599
- selectItem(val, statePersistenceTriggered) {
1600
- const listItem = this.getItemRefByIndexOrModel(val);
1601
- if (!listItem) {
1602
- return;
1603
- }
1604
- if (!listItem.isActive) {
1605
- this.toggleListItemSelection(listItem, statePersistenceTriggered);
1606
- }
1607
- // focus the element.
1608
- listItem.nativeElement.focus();
1609
- }
1610
1699
  beforePaginationChange($event, $index) {
1611
1700
  this.invokeEventCallback('paginationchange', { $event, $index });
1612
1701
  }
1613
- handleEvent(node, eventName, eventCallback, locals) {
1614
- // tap and doubleTap events are not getting propagated.So, using mouse events instead.
1615
- const touchToMouse = {
1616
- tap: 'click',
1617
- doubletap: 'dblclick'
1618
- };
1619
- if (_.includes(['click', 'tap', 'dblclick', 'doubletap'], eventName)) {
1620
- this.eventManager.addEventListener(this.nativeElement, touchToMouse[eventName] || eventName, (evt) => {
1621
- const target = $(evt.target).closest('.app-list-item');
1622
- if (target.length) {
1623
- const listItemContext = target.data('listItemContext');
1624
- if (!listItemContext.disableItem) {
1625
- this.invokeEventCallback(eventName, { widget: listItemContext, $event: evt, item: listItemContext.item });
1626
- }
1627
- }
1628
- });
1629
- }
1630
- }
1631
1702
  // Invoke the datasource variable by default when pulltorefresh event is not specified.
1632
1703
  subscribeToPullToRefresh() {
1633
1704
  this._listenerDestroyers.push(this.app.subscribe('pulltorefresh', () => {
@@ -1636,19 +1707,6 @@ class ListComponent extends StylableComponent {
1636
1707
  }
1637
1708
  }));
1638
1709
  }
1639
- ngOnInit() {
1640
- super.ngOnInit();
1641
- this.handleHeaderClick = noop;
1642
- setTimeout(() => {
1643
- this.debouncedFetchNextDatasetOnScroll = this.paginationService.debouncedFetchNextDatasetOnScroll(this.dataNavigator, DEBOUNCE_TIMES.PAGINATION_DEBOUNCE_TIME, this);
1644
- }, 0);
1645
- this._items = [];
1646
- this.fieldDefs = [];
1647
- this.reorderProps = {
1648
- minIndex: null,
1649
- maxIndex: null
1650
- };
1651
- }
1652
1710
  setUpCUDHandlers() {
1653
1711
  const $addItem = document.getElementsByClassName("add-list-item")[0];
1654
1712
  if ($addItem) {
@@ -1658,58 +1716,6 @@ class ListComponent extends StylableComponent {
1658
1716
  });
1659
1717
  }
1660
1718
  }
1661
- ngAfterViewInit() {
1662
- this.promiseResolverFn();
1663
- this.propsInitPromise.then(() => {
1664
- super.ngAfterViewInit();
1665
- this.setUpCUDHandlers();
1666
- this.selectedItemWidgets = this.multiselect ? [] : {};
1667
- var ele = $(this.nativeElement).find('.app-livelist-container');
1668
- if (this.enablereorder && !this.groupby) {
1669
- if (ele) {
1670
- ele.attr('aria-describedby', this.titleId);
1671
- }
1672
- this.configureDnD();
1673
- }
1674
- if (!this.enablereorder) {
1675
- if (ele) {
1676
- ele.removeAttr('aria-describedby');
1677
- }
1678
- }
1679
- if (this.groupby && this.collapsible) {
1680
- this.handleHeaderClick = handleHeaderClick;
1681
- this.toggleAllHeaders = toggleAllHeaders.bind(undefined, this);
1682
- }
1683
- setListClass(this);
1684
- });
1685
- this.setupHandlers();
1686
- const $ul = this.nativeElement.querySelector('ul.app-livelist-container');
1687
- styler($ul, this, APPLY_STYLES_TYPE.SCROLLABLE_CONTAINER);
1688
- if (this.enablereorder) {
1689
- if ($ul) {
1690
- $ul.setAttribute('aria-describedby', this.titleId);
1691
- }
1692
- }
1693
- if (!this.enablereorder) {
1694
- if ($ul) {
1695
- $ul.removeAttribute('aria-describedby');
1696
- }
1697
- }
1698
- if (isMobileApp() && $ul.querySelector('.app-list-item-action-panel')) {
1699
- this._listAnimator = new ListAnimator(this);
1700
- }
1701
- }
1702
- ngOnDestroy() {
1703
- if (this._listAnimator && this._listAnimator.$btnSubscription) {
1704
- this._listAnimator.$btnSubscription.unsubscribe();
1705
- }
1706
- this._listenerDestroyers.forEach(d => d && d());
1707
- super.ngOnDestroy();
1708
- }
1709
- ngOnDetach() {
1710
- super.ngOnDetach();
1711
- this._pageLoad = true;
1712
- }
1713
1719
  static { this.ɵfac = function ListComponent_Factory(t) { return new (t || ListComponent)(i0.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject(i0.ChangeDetectorRef), i0.ɵɵdirectiveInject(i1.ToDatePipe), i0.ɵɵdirectiveInject(i2.App), i0.ɵɵdirectiveInject(i2.AppDefaults), i0.ɵɵdirectiveInject(i0.NgZone), i0.ɵɵinjectAttribute('itemclass.bind'), i0.ɵɵinjectAttribute('disableitem.bind'), i0.ɵɵinjectAttribute('dataset.bind'), i0.ɵɵinjectAttribute('datasource.bind'), i0.ɵɵinjectAttribute('mouseenter.event'), i0.ɵɵinjectAttribute('mouseleave.event'), i0.ɵɵdirectiveInject(i2.StatePersistence), i0.ɵɵdirectiveInject(i2.PaginationService), i0.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
1714
1720
  static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: ListComponent, selectors: [["div", "wmList", ""]], contentQueries: function ListComponent_ContentQueries(rf, ctx, dirIndex) { if (rf & 1) {
1715
1721
  i0.ɵɵcontentQuery(dirIndex, _c0, 5);
@@ -1821,7 +1827,7 @@ class ListComponent extends StylableComponent {
1821
1827
  type: ViewChildren,
1822
1828
  args: [ListItemDirective]
1823
1829
  }] }); })();
1824
- (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ListComponent, { className: "ListComponent", filePath: "list.component.ts", lineNumber: 63 }); })();
1830
+ (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassDebugInfo(ListComponent, { className: "ListComponent", filePath: "list.component.ts", lineNumber: 91 }); })();
1825
1831
 
1826
1832
  const components = [
1827
1833
  ListComponent,