tablefilter 0.7.5 → 0.7.7

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 (325) hide show
  1. package/dist/starter.html +2 -2
  2. package/dist/tablefilter/tablefilter.js +1 -1
  3. package/dist/tablefilter/tf-1-2aa33b10e0e549020c12.js +1 -0
  4. package/dist/tablefilter/tf-1-7e29d0dbe6e0e0a4ff05.js +1 -0
  5. package/dist/tablefilter/{tf-2-3a936d22b849361acff5.js → tf-2-0ea691278d572212426a.js} +2 -2
  6. package/dist/tablefilter.cjs.js +17787 -4
  7. package/dist/tablefilter.esm.js +15910 -5398
  8. package/dist/tablefilter.umd.js +17793 -4
  9. package/index.js +16 -1
  10. package/package.json +10 -1
  11. package/src/components/attributes.js +59 -0
  12. package/src/components/table-filter.js +193 -45
  13. package/src/components/tf-pager.js +325 -0
  14. package/src/components/tf-results-per-page.js +181 -0
  15. package/src/components/tf-rows-counter.js +3 -6
  16. package/src/components/tf-status.js +6 -11
  17. package/src/extensions/sort/sort.js +8 -1
  18. package/src/modules/paging.js +270 -46
  19. package/src/tablefilter.js +39 -6
  20. package/.editorconfig +0 -15
  21. package/.esdoc.json +0 -14
  22. package/.eslintrc +0 -37
  23. package/.gitattributes +0 -16
  24. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
  25. package/.github/ISSUE_TEMPLATE/feature_request.md +0 -36
  26. package/.github/ISSUE_TEMPLATE/support.md +0 -17
  27. package/.github/dependabot.yml +0 -10
  28. package/.github/workflows/build-deploy.yml +0 -141
  29. package/.github/workflows/opencode-review.yml +0 -104
  30. package/.github/workflows/opencode.yml +0 -34
  31. package/AGENTS.md +0 -36
  32. package/CONTRIBUTING.md +0 -128
  33. package/Gruntfile.js +0 -252
  34. package/PULL_REQUEST_TEMPLATE.md +0 -24
  35. package/ROADMAP/README.md +0 -34
  36. package/ROADMAP/content-projection-parity.md +0 -162
  37. package/ROADMAP/hybrid-migration-strategy.md +0 -275
  38. package/ROADMAP/key-decisions-review.md +0 -215
  39. package/ROADMAP/preliminary-and-milestone-0.8.0-plan.md +0 -307
  40. package/ROADMAP/v1-webcomponents-investigation.md +0 -521
  41. package/dist/tablefilter/tablefilter.vite.js +0 -4
  42. package/dist/tablefilter/tf-1-a5c3a73bd559e47dd5a2.js +0 -1
  43. package/playwright.config.js +0 -25
  44. package/scripts/check-css-tokens.js +0 -65
  45. package/static/demos-assets/img_best-price.png +0 -0
  46. package/static/demos-assets/img_great-deal.png +0 -0
  47. package/static/demos-assets/img_maintenance.jpg +0 -0
  48. package/static/demos-assets/img_new-edition.png +0 -0
  49. package/static/demos-assets/img_sold-out.png +0 -0
  50. package/static/partials/books-table-with-images.html +0 -328
  51. package/static/partials/books.html +0 -273
  52. package/static/partials/countries-by-continent.html +0 -2592
  53. package/static/partials/countries-table-tiny.html +0 -436
  54. package/static/partials/countries-table.html +0 -12954
  55. package/static/partials/dummy-table-with-totals-footer.html +0 -353
  56. package/static/partials/dummy-table.html +0 -503
  57. package/static/partials/pre-inline-script.html +0 -17
  58. package/static/partials/pre.html +0 -1
  59. package/static/partials/style.html +0 -23
  60. package/static/partials/table-with-grouped-headers.html +0 -9258
  61. package/static/partials/tablefilter-script.html +0 -1
  62. package/static/style/active-header.styl +0 -10
  63. package/static/style/alternating-rows.styl +0 -8
  64. package/static/style/config.styl +0 -44
  65. package/static/style/custom-properties.styl +0 -43
  66. package/static/style/extensions/colsVisibility.styl +0 -71
  67. package/static/style/extensions/filtersVisibility.styl +0 -18
  68. package/static/style/ezedittable.styl +0 -93
  69. package/static/style/filter-checklist.styl +0 -52
  70. package/static/style/filters.styl +0 -111
  71. package/static/style/grid-layout.styl +0 -130
  72. package/static/style/help.styl +0 -57
  73. package/static/style/keyword.styl +0 -8
  74. package/static/style/loader.styl +0 -16
  75. package/static/style/mixins/arrow.styl +0 -63
  76. package/static/style/mixins/box-shadow.styl +0 -8
  77. package/static/style/mixins/empty-content.styl +0 -7
  78. package/static/style/noresults.styl +0 -14
  79. package/static/style/paging.styl +0 -73
  80. package/static/style/reset-button.styl +0 -21
  81. package/static/style/rows-counter.styl +0 -17
  82. package/static/style/sort.styl +0 -20
  83. package/static/style/status-bar.styl +0 -13
  84. package/static/style/table.styl +0 -44
  85. package/static/style/tablefilter.styl +0 -19
  86. package/static/style/themes/blank.png +0 -0
  87. package/static/style/themes/btn_clear_filters.png +0 -0
  88. package/static/style/themes/btn_filter.png +0 -0
  89. package/static/style/themes/btn_first_page.gif +0 -0
  90. package/static/style/themes/btn_last_page.gif +0 -0
  91. package/static/style/themes/btn_next_page.gif +0 -0
  92. package/static/style/themes/btn_previous_page.gif +0 -0
  93. package/static/style/themes/default/default.styl +0 -137
  94. package/static/style/themes/default/images/bg_infDiv.jpg +0 -0
  95. package/static/style/themes/default/images/bg_th.jpg +0 -0
  96. package/static/style/themes/default/images/btn_eraser.gif +0 -0
  97. package/static/style/themes/default/images/btn_first_page.gif +0 -0
  98. package/static/style/themes/default/images/btn_last_page.gif +0 -0
  99. package/static/style/themes/default/images/btn_next_page.gif +0 -0
  100. package/static/style/themes/default/images/btn_over_eraser.gif +0 -0
  101. package/static/style/themes/default/images/btn_over_first_page.gif +0 -0
  102. package/static/style/themes/default/images/btn_over_last_page.gif +0 -0
  103. package/static/style/themes/default/images/btn_over_next_page.gif +0 -0
  104. package/static/style/themes/default/images/btn_over_previous_page.gif +0 -0
  105. package/static/style/themes/default/images/btn_previous_page.gif +0 -0
  106. package/static/style/themes/default/images/img_loading.gif +0 -0
  107. package/static/style/themes/downsimple.png +0 -0
  108. package/static/style/themes/icn_clp.png +0 -0
  109. package/static/style/themes/icn_exp.png +0 -0
  110. package/static/style/themes/icn_filter.gif +0 -0
  111. package/static/style/themes/icn_filterActive.gif +0 -0
  112. package/static/style/themes/mytheme/images/bg_headers.jpg +0 -0
  113. package/static/style/themes/mytheme/images/bg_infDiv.jpg +0 -0
  114. package/static/style/themes/mytheme/images/btn_filter.png +0 -0
  115. package/static/style/themes/mytheme/images/btn_first_page.gif +0 -0
  116. package/static/style/themes/mytheme/images/btn_last_page.gif +0 -0
  117. package/static/style/themes/mytheme/images/btn_next_page.gif +0 -0
  118. package/static/style/themes/mytheme/images/btn_previous_page.gif +0 -0
  119. package/static/style/themes/mytheme/images/img_loading.gif +0 -0
  120. package/static/style/themes/mytheme/mytheme.styl +0 -152
  121. package/static/style/themes/skyblue/images/bg_skyblue.gif +0 -0
  122. package/static/style/themes/skyblue/images/btn_first_page.gif +0 -0
  123. package/static/style/themes/skyblue/images/btn_last_page.gif +0 -0
  124. package/static/style/themes/skyblue/images/btn_next_page.gif +0 -0
  125. package/static/style/themes/skyblue/images/btn_prev_page.gif +0 -0
  126. package/static/style/themes/skyblue/images/icn_clear_filters.png +0 -0
  127. package/static/style/themes/skyblue/images/img_loading.gif +0 -0
  128. package/static/style/themes/skyblue/skyblue.styl +0 -195
  129. package/static/style/themes/transparent/images/btn_first_page.gif +0 -0
  130. package/static/style/themes/transparent/images/btn_last_page.gif +0 -0
  131. package/static/style/themes/transparent/images/btn_next_page.gif +0 -0
  132. package/static/style/themes/transparent/images/btn_prev_page.gif +0 -0
  133. package/static/style/themes/transparent/images/icn_clear_filters.png +0 -0
  134. package/static/style/themes/transparent/images/img_loading.gif +0 -0
  135. package/static/style/themes/transparent/transparent.styl +0 -205
  136. package/static/style/themes/upsimple.png +0 -0
  137. package/static/style/toolbar.styl +0 -58
  138. package/static/templates/advanced-grid-editable.html +0 -140
  139. package/static/templates/advanced-grid-selection.html +0 -93
  140. package/static/templates/auto-filter.html +0 -46
  141. package/static/templates/columns-visibility.html +0 -67
  142. package/static/templates/data-types.html +0 -123
  143. package/static/templates/demo.html +0 -62
  144. package/static/templates/external-filters-visibility-commad.html +0 -49
  145. package/static/templates/external-filters.html +0 -125
  146. package/static/templates/filter-images.html +0 -91
  147. package/static/templates/filters-visibility.html +0 -45
  148. package/static/templates/grid-layout.html +0 -51
  149. package/static/templates/grouped-headers.html +0 -78
  150. package/static/templates/linked-filters-disabled.html +0 -56
  151. package/static/templates/linked-filters.html +0 -45
  152. package/static/templates/load-filters-on-demand.html +0 -42
  153. package/static/templates/pagination.html +0 -78
  154. package/static/templates/requirejs.html +0 -53
  155. package/static/templates/starter.html +0 -61
  156. package/static/templates/table-filter.html +0 -40
  157. package/static/templates/theme-roller.html +0 -106
  158. package/test/libs/polyfill.js +0 -359
  159. package/test/libs/qunit/qunit.css +0 -237
  160. package/test/libs/qunit/qunit.js +0 -2495
  161. package/test/playwright/axe.baseline.spec.js +0 -34
  162. package/test/playwright/axe.statusbar.spec.js +0 -35
  163. package/test/playwright/axeScan.js +0 -42
  164. package/test/playwright/ce-bridge.spec.js +0 -167
  165. package/test/playwright/qunit.all.spec.js +0 -10
  166. package/test/playwright/qunit.single.spec.js +0 -14
  167. package/test/playwright/qunitSuite.js +0 -56
  168. package/test/playwright/table-filter.config.spec.js +0 -265
  169. package/test/playwright/table-filter.demo.spec.js +0 -60
  170. package/test/playwright/table-filter.element.spec.js +0 -477
  171. package/test/playwright/tf-clear-button.spec.js +0 -135
  172. package/test/playwright/tf-rows-counter.spec.js +0 -172
  173. package/test/playwright/tf-status.spec.js +0 -258
  174. package/test/test-active-columns.html +0 -80
  175. package/test/test-active-columns.js +0 -318
  176. package/test/test-alternate-rows.html +0 -80
  177. package/test/test-alternate-rows.js +0 -335
  178. package/test/test-api.html +0 -141
  179. package/test/test-api.js +0 -795
  180. package/test/test-auto-filter.html +0 -80
  181. package/test/test-auto-filter.js +0 -43
  182. package/test/test-callbacks.html +0 -78
  183. package/test/test-callbacks.js +0 -58
  184. package/test/test-case-sensitive-query.html +0 -78
  185. package/test/test-case-sensitive-query.js +0 -39
  186. package/test/test-cell-parser.html +0 -109
  187. package/test/test-cell-parser.js +0 -80
  188. package/test/test-checklist.html +0 -78
  189. package/test/test-checklist.js +0 -267
  190. package/test/test-clear-button.html +0 -79
  191. package/test/test-clear-button.js +0 -183
  192. package/test/test-col-ops-grid-layout.html +0 -129
  193. package/test/test-col-ops-grid-layout.js +0 -134
  194. package/test/test-col-ops-paging.html +0 -129
  195. package/test/test-col-ops-paging.js +0 -154
  196. package/test/test-col-ops.html +0 -129
  197. package/test/test-col-ops.js +0 -337
  198. package/test/test-col-widths.html +0 -80
  199. package/test/test-col-widths.js +0 -40
  200. package/test/test-cols-visibility-grid-layout.html +0 -80
  201. package/test/test-cols-visibility-grid-layout.js +0 -165
  202. package/test/test-cols-visibility.html +0 -80
  203. package/test/test-cols-visibility.js +0 -121
  204. package/test/test-custom-options.html +0 -80
  205. package/test/test-custom-options.js +0 -139
  206. package/test/test-data-types.html +0 -377
  207. package/test/test-data-types.js +0 -392
  208. package/test/test-date-type.html +0 -356
  209. package/test/test-date-type.js +0 -159
  210. package/test/test-disable-enter-key.html +0 -78
  211. package/test/test-disable-enter-key.js +0 -29
  212. package/test/test-disable-filter-onchange.html +0 -78
  213. package/test/test-disable-filter-onchange.js +0 -40
  214. package/test/test-dom-changes.html +0 -78
  215. package/test/test-dom-changes.js +0 -166
  216. package/test/test-dropdown.html +0 -78
  217. package/test/test-dropdown.js +0 -246
  218. package/test/test-emitter.html +0 -78
  219. package/test/test-emitter.js +0 -57
  220. package/test/test-empty-cells-filtering.html +0 -8696
  221. package/test/test-empty-cells-filtering.js +0 -45
  222. package/test/test-exact-query-match.html +0 -78
  223. package/test/test-exact-query-match.js +0 -56
  224. package/test/test-excluded-rows.html +0 -92
  225. package/test/test-excluded-rows.js +0 -129
  226. package/test/test-external-filters.html +0 -100
  227. package/test/test-external-filters.js +0 -219
  228. package/test/test-filter-html-elements.html +0 -88
  229. package/test/test-filter-html-elements.js +0 -63
  230. package/test/test-filter-operators.html +0 -80
  231. package/test/test-filter-operators.js +0 -264
  232. package/test/test-filtering.html +0 -53
  233. package/test/test-filtering.js +0 -293
  234. package/test/test-filters-visibility-grid-layout.html +0 -80
  235. package/test/test-filters-visibility-grid-layout.js +0 -50
  236. package/test/test-filters-visibility-with-button.html +0 -80
  237. package/test/test-filters-visibility-with-button.js +0 -48
  238. package/test/test-filters-visibility.html +0 -80
  239. package/test/test-filters-visibility.js +0 -48
  240. package/test/test-grid-layout.html +0 -7736
  241. package/test/test-grid-layout.js +0 -39
  242. package/test/test-grouped-headers.html +0 -154
  243. package/test/test-grouped-headers.js +0 -107
  244. package/test/test-hash.html +0 -78
  245. package/test/test-hash.js +0 -88
  246. package/test/test-help-responsive.html +0 -79
  247. package/test/test-help-responsive.js +0 -70
  248. package/test/test-help.html +0 -78
  249. package/test/test-help.js +0 -217
  250. package/test/test-highlight-keywords.html +0 -78
  251. package/test/test-highlight-keywords.js +0 -94
  252. package/test/test-ignore-diacritics.html +0 -67
  253. package/test/test-ignore-diacritics.js +0 -117
  254. package/test/test-integration-paging-sort.html +0 -80
  255. package/test/test-integration-paging-sort.js +0 -60
  256. package/test/test-linked-filters-disabled-options-grid-layout.html +0 -80
  257. package/test/test-linked-filters-disabled-options-grid-layout.js +0 -73
  258. package/test/test-linked-filters-grid-layout.html +0 -80
  259. package/test/test-linked-filters-grid-layout.js +0 -72
  260. package/test/test-linked-filters-load-filters-on-demand.html +0 -80
  261. package/test/test-linked-filters-load-filters-on-demand.js +0 -99
  262. package/test/test-linked-filters-paging.html +0 -80
  263. package/test/test-linked-filters-paging.js +0 -99
  264. package/test/test-linked-filters.html +0 -80
  265. package/test/test-linked-filters.js +0 -138
  266. package/test/test-load-filters-on-demand.html +0 -78
  267. package/test/test-load-filters-on-demand.js +0 -124
  268. package/test/test-loader.html +0 -79
  269. package/test/test-loader.js +0 -159
  270. package/test/test-no-config.html +0 -80
  271. package/test/test-no-config.js +0 -63
  272. package/test/test-no-filters.html +0 -80
  273. package/test/test-no-filters.js +0 -172
  274. package/test/test-no-headers.html +0 -71
  275. package/test/test-no-headers.js +0 -99
  276. package/test/test-no-results-message.html +0 -262
  277. package/test/test-no-results-message.js +0 -222
  278. package/test/test-no-rows.html +0 -19
  279. package/test/test-no-rows.js +0 -10
  280. package/test/test-one-row.html +0 -29
  281. package/test/test-one-row.js +0 -18
  282. package/test/test-paging.html +0 -78
  283. package/test/test-paging.js +0 -273
  284. package/test/test-popup-filter-one-row.html +0 -38
  285. package/test/test-popup-filter-one-row.js +0 -138
  286. package/test/test-popup-filter.html +0 -78
  287. package/test/test-popup-filter.js +0 -384
  288. package/test/test-popup-filters-grouped-headers.html +0 -104
  289. package/test/test-popup-filters-grouped-headers.js +0 -206
  290. package/test/test-rows-counter.html +0 -78
  291. package/test/test-rows-counter.js +0 -114
  292. package/test/test-single-filter.html +0 -79
  293. package/test/test-single-filter.js +0 -138
  294. package/test/test-sort-custom-sorter.html +0 -244
  295. package/test/test-sort-custom-sorter.js +0 -74
  296. package/test/test-sort-grid-layout.html +0 -143
  297. package/test/test-sort-grid-layout.js +0 -86
  298. package/test/test-sort-key.html +0 -244
  299. package/test/test-sort-key.js +0 -67
  300. package/test/test-sort.html +0 -143
  301. package/test/test-sort.js +0 -126
  302. package/test/test-state.html +0 -78
  303. package/test/test-state.js +0 -369
  304. package/test/test-status-bar.html +0 -79
  305. package/test/test-status-bar.js +0 -149
  306. package/test/test-storage-cookie.html +0 -78
  307. package/test/test-storage-cookie.js +0 -82
  308. package/test/test-storage-local.html +0 -78
  309. package/test/test-storage-local.js +0 -82
  310. package/test/test-tfoot.html +0 -96
  311. package/test/test-tfoot.js +0 -123
  312. package/test/test-thead.html +0 -80
  313. package/test/test-thead.js +0 -69
  314. package/test/test-toolbar.html +0 -81
  315. package/test/test-toolbar.js +0 -218
  316. package/test/test-uneven-rows.html +0 -95
  317. package/test/test-uneven-rows.js +0 -61
  318. package/test/test-watermark.html +0 -80
  319. package/test/test-watermark.js +0 -103
  320. package/test/test.html +0 -141
  321. package/test/test.js +0 -162
  322. package/vite.config.js +0 -71
  323. package/webpack.config.js +0 -99
  324. package/webpack.dev.config.js +0 -25
  325. package/webpack.test.config.js +0 -44
@@ -278,6 +278,13 @@ export class Paging extends Feature {
278
278
  */
279
279
  this.pgAfter = null;
280
280
 
281
+ /**
282
+ * <tf-pager> custom element host, when the bridge is active
283
+ * @type {DOMElement}
284
+ * @private
285
+ */
286
+ this.pagerEl = null;
287
+
281
288
  let startRow = tf.refRow;
282
289
  let nrows = tf.getRowsNb(true);
283
290
  //calculates page nb
@@ -328,6 +335,7 @@ export class Paging extends Feature {
328
335
  }
329
336
  },
330
337
  slcPagesChange: null,
338
+ pagerPageChange: null,
331
339
  nextEvt: null,
332
340
  prevEvt: null,
333
341
  lastEvt: null,
@@ -339,9 +347,7 @@ export class Paging extends Feature {
339
347
  * Initialize DOM elements
340
348
  */
341
349
  init() {
342
- let slcPages;
343
350
  let tf = this.tf;
344
- let evt = this.evt;
345
351
 
346
352
  if (this.initialized) {
347
353
  return;
@@ -360,6 +366,104 @@ export class Paging extends Feature {
360
366
  }
361
367
  }
362
368
 
369
+ let targetEl = !this.tgtId ?
370
+ tf.feature('toolbar').container(this.toolbarPosition) :
371
+ elm(this.tgtId);
372
+
373
+ // Render the paging controls with <tf-pager> when the source
374
+ // registers it (Vite / module load) and no button HTML is
375
+ // configured, otherwise with the legacy spans and controls
376
+ // (#926). `enableIcons` and `btn_*_page_html` keep the legacy
377
+ // path: the icon is painted by the `.nextPage`/`.previousPage`/
378
+ // `.firstPage`/`.lastPage` classes (tablefilter.css), and
379
+ // `btn_*_page_html` is user markup. Both render on the legacy
380
+ // button span only (paging.js:399-444).
381
+ // TODO(#965): route enableIcons and btn_*_page_html through the
382
+ // element once theming moves to `::part()`.
383
+ if (typeof customElements !== 'undefined' &&
384
+ customElements.get('tf-pager') && !tf.enableIcons &&
385
+ !this.hasBtnHtml()) {
386
+ this.initCE(targetEl);
387
+ } else {
388
+ this.initLegacy(targetEl);
389
+ }
390
+
391
+ this.setPagingInfo();
392
+
393
+ if (!tf.fltGrid) {
394
+ tf.validateAllRows();
395
+ this.setPagingInfo(tf.validRowsIndex);
396
+ }
397
+
398
+ this.emitter.on(['after-filtering'], bound(this.resetPagingInfo, this));
399
+ this.emitter.on(['change-page'], bound(this.changePageHandler, this));
400
+ this.emitter.on(['change-page-results'],
401
+ bound(this.changePageResultsHandler, this));
402
+
403
+ /** @inherited */
404
+ this.initialized = true;
405
+
406
+ this.emitter.emit('feature-initialized', this);
407
+ }
408
+
409
+ /**
410
+ * Initialize using the <tf-pager> custom element
411
+ * @param {DOMElement} targetEl Target container element
412
+ * @private
413
+ */
414
+ initCE(targetEl) {
415
+ let evt = this.evt;
416
+ let tf = this.tf;
417
+
418
+ let pagerEl = document.createElement('tf-pager');
419
+ pagerEl.className = this.pgCssClass();
420
+ pagerEl.setAttribute('selector-type', this.pageSelectorType);
421
+ pagerEl.setAttribute('page-text', this.pageText);
422
+ pagerEl.setAttribute('of-text', this.ofText);
423
+
424
+ if (!this.hasBtns) {
425
+ pagerEl.setAttribute('buttons', 'false');
426
+ }
427
+
428
+ this.setPagerButtons(pagerEl);
429
+
430
+ if (!this.isEnabled()) {
431
+ pagerEl.setAttribute('disabled', '');
432
+ }
433
+
434
+ targetEl.appendChild(pagerEl);
435
+ this.pagerEl = pagerEl;
436
+ this.pageSlc = pagerEl.shadowRoot.querySelector(
437
+ this.pageSelectorType === INPUT ?
438
+ '[part="page-input"]' : '[part="page-select"]');
439
+
440
+ this.bindPagerButton('first', evt.first);
441
+ this.bindPagerButton('prev', evt.prev);
442
+ this.bindPagerButton('next', evt.next);
443
+ this.bindPagerButton('last', evt.last);
444
+
445
+ evt.pagerPageChange = (event) => {
446
+ let page = parseInt(event.detail.page, 10);
447
+ if (isNaN(page)) {
448
+ return;
449
+ }
450
+ if (this.pageSelectorType === INPUT && tf.sorted) {
451
+ tf.filter();
452
+ }
453
+ this.changePage(page - 1);
454
+ };
455
+ addEvt(pagerEl, 'page-change', evt.pagerPageChange);
456
+ }
457
+
458
+ /**
459
+ * Initialize using the legacy spans, controls and select
460
+ * @param {DOMElement} targetEl Target container element
461
+ * @private
462
+ */
463
+ initLegacy(targetEl) {
464
+ let slcPages;
465
+ let evt = this.evt;
466
+
363
467
  evt.slcPagesChange = (event) => {
364
468
  let slc = event.target;
365
469
  this.changePage(slc.selectedIndex);
@@ -445,9 +549,6 @@ export class Paging extends Feature {
445
549
  }
446
550
 
447
551
  // paging elements (buttons+drop-down list) are added to defined element
448
- let targetEl = !this.tgtId ?
449
- tf.feature('toolbar').container(this.toolbarPosition) :
450
- elm(this.tgtId);
451
552
  targetEl.appendChild(btnFirstSpan);
452
553
  targetEl.appendChild(btnPrevSpan);
453
554
 
@@ -475,23 +576,84 @@ export class Paging extends Feature {
475
576
  this.pgBefore = pgBeforeSpan;
476
577
  this.pgAfter = pgAfterSpan;
477
578
  this.pageSlc = slcPages;
579
+ }
478
580
 
479
- this.setPagingInfo();
581
+ /**
582
+ * The legacy paging classes, applied to the <tf-pager> host
583
+ * @return {String} Space-separated class list
584
+ * @private
585
+ */
586
+ pgCssClass() {
587
+ return [this.btnCssClass, this.pgSlcCssClass, this.pgInpCssClass,
588
+ this.nbPgSpanCssClass].join(' ');
589
+ }
480
590
 
481
- if (!tf.fltGrid) {
482
- tf.validateAllRows();
483
- this.setPagingInfo(tf.validRowsIndex);
484
- }
591
+ /**
592
+ * Whether a `btn_*_page_html` value is set
593
+ * @return {Boolean} True when any button HTML is configured
594
+ * @private
595
+ */
596
+ hasBtnHtml() {
597
+ return Boolean(this.btnFirstPageHtml || this.btnPrevPageHtml ||
598
+ this.btnNextPageHtml || this.btnLastPageHtml);
599
+ }
485
600
 
486
- this.emitter.on(['after-filtering'], bound(this.resetPagingInfo, this));
487
- this.emitter.on(['change-page'], bound(this.changePageHandler, this));
488
- this.emitter.on(['change-page-results'],
489
- bound(this.changePageResultsHandler, this));
601
+ /**
602
+ * Set the `btn_*_page_text` captions on the <tf-pager> buttons
603
+ * (paging.js:390-444).
604
+ * @param {DOMElement} pagerEl <tf-pager> host
605
+ * @private
606
+ */
607
+ setPagerButtons(pagerEl) {
608
+ let btns = [
609
+ { part: 'first', text: this.btnFirstPageText },
610
+ { part: 'prev', text: this.btnPrevPageText },
611
+ { part: 'next', text: this.btnNextPageText },
612
+ { part: 'last', text: this.btnLastPageText }
613
+ ];
614
+
615
+ btns.forEach((btn) => {
616
+ pagerEl.setAttribute(`${btn.part}-text`, btn.text);
617
+ });
618
+ }
490
619
 
491
- /** @inherited */
492
- this.initialized = true;
620
+ /**
621
+ * Bind a paging handler to a <tf-pager> button
622
+ * @param {String} part Button part name
623
+ * @param {Function} handler Paging handler
624
+ * @private
625
+ */
626
+ bindPagerButton(part, handler) {
627
+ addEvt(this.pagerEl.shadowRoot.querySelector(`[part="${part}"]`),
628
+ 'click', handler);
629
+ }
493
630
 
494
- this.emitter.emit('feature-initialized', this);
631
+ /**
632
+ * Remove a paging handler from a <tf-pager> button
633
+ * @param {String} part Button part name
634
+ * @param {Function} handler Paging handler
635
+ * @private
636
+ */
637
+ unbindPagerButton(part, handler) {
638
+ removeEvt(this.pagerEl.shadowRoot.querySelector(`[part="${part}"]`),
639
+ 'click', handler);
640
+ }
641
+
642
+ /**
643
+ * Paging entries shared by the legacy select and <tf-pager>: page
644
+ * number as visible text, start row as value
645
+ * @return {Array<Object>} Page entries
646
+ * @private
647
+ */
648
+ pageEntries() {
649
+ let entries = [];
650
+ for (let z = 0; z < this.nbPages; z++) {
651
+ entries.push({
652
+ text: String(z + 1),
653
+ value: String(z * this.pageLength)
654
+ });
655
+ }
656
+ return entries;
495
657
  }
496
658
 
497
659
  /**
@@ -532,23 +694,32 @@ export class Paging extends Feature {
532
694
 
533
695
  //calculate nb of pages
534
696
  this.nbPages = Math.ceil(tf.validRowsIndex.length / this.pageLength);
535
- //refresh page nb span
536
- this.pgCont.innerHTML = this.nbPages;
537
- //select clearing shortcut
538
- if (this.pageSelectorType === SELECT) {
539
- this.pageSlc.innerHTML = '';
697
+
698
+ if (this.pagerEl) {
699
+ this.pagerEl.setTotalPages(this.nbPages);
700
+ this.pagerEl.setPages(this.pageEntries());
701
+ this.pagerEl.setPage(this.currentPageNb);
702
+ } else {
703
+ //refresh page nb span
704
+ this.pgCont.innerHTML = this.nbPages;
705
+ //select clearing shortcut
706
+ if (this.pageSelectorType === SELECT) {
707
+ this.pageSlc.innerHTML = '';
708
+ }
540
709
  }
541
710
 
542
711
  if (this.nbPages > 0) {
543
712
  cont.style.visibility = 'visible';
544
- if (this.pageSelectorType === SELECT) {
545
- for (let z = 0; z < this.nbPages; z++) {
546
- let opt = createOpt(z + 1, z * this.pageLength, false);
547
- this.pageSlc.options[z] = opt;
713
+ if (!this.pagerEl) {
714
+ if (this.pageSelectorType === SELECT) {
715
+ this.pageEntries().forEach((entry, z) => {
716
+ this.pageSlc.options[z] =
717
+ createOpt(entry.text, entry.value, false);
718
+ });
719
+ } else {
720
+ //input type
721
+ this.pageSlc.value = this.currentPageNb;
548
722
  }
549
- } else {
550
- //input type
551
- this.pageSlc.value = this.currentPageNb;
552
723
  }
553
724
 
554
725
  } else {
@@ -726,7 +897,9 @@ export class Paging extends Feature {
726
897
  this.onBeforeChangePage(this, (index + 1));
727
898
 
728
899
  this.currentPageNb = parseInt(index, 10) + 1;
729
- if (this.pageSelectorType === SELECT) {
900
+ if (this.pagerEl) {
901
+ this.pagerEl.setPage(this.currentPageNb);
902
+ } else if (this.pageSelectorType === SELECT) {
730
903
  this.pageSlc.options[index].selected = true;
731
904
  } else {
732
905
  this.pageSlc.value = this.currentPageNb;
@@ -784,7 +957,10 @@ export class Paging extends Feature {
784
957
  }
785
958
  this.setPagingInfo();
786
959
 
787
- if (pageSelectorType === SELECT) {
960
+ if (this.pagerEl) {
961
+ this.pagerEl.setPage(Math.min(slcPagesSelIndex,
962
+ this.nbPages - 1) + 1);
963
+ } else if (pageSelectorType === SELECT) {
788
964
  let slcIdx = (pageSlc.options.length - 1 <= slcPagesSelIndex) ?
789
965
  (pageSlc.options.length - 1) :
790
966
  slcPagesSelIndex;
@@ -839,6 +1015,26 @@ export class Paging extends Feature {
839
1015
  this.changeResultsPerPage(pageLength);
840
1016
  }
841
1017
 
1018
+ /**
1019
+ * Disable paging and reflect the state on the pager element
1020
+ */
1021
+ disable() {
1022
+ super.disable();
1023
+ if (this.pagerEl) {
1024
+ this.pagerEl.setAttribute('disabled', '');
1025
+ }
1026
+ }
1027
+
1028
+ /**
1029
+ * Enable paging and reflect the state on the pager element
1030
+ */
1031
+ enable() {
1032
+ super.enable();
1033
+ if (this.pagerEl) {
1034
+ this.pagerEl.removeAttribute('disabled');
1035
+ }
1036
+ }
1037
+
842
1038
  /**
843
1039
  * Remove paging feature
844
1040
  */
@@ -847,6 +1043,49 @@ export class Paging extends Feature {
847
1043
  return;
848
1044
  }
849
1045
 
1046
+ if (this.pagerEl) {
1047
+ this.destroyCE();
1048
+ } else {
1049
+ this.destroyLegacy();
1050
+ }
1051
+
1052
+ if (this.hasResultsPerPage) {
1053
+ this.removeResultsPerPage();
1054
+ }
1055
+
1056
+ this.emitter.off(['after-filtering'],
1057
+ bound(this.resetPagingInfo, this));
1058
+ this.emitter.off(['change-page'], bound(this.changePageHandler, this));
1059
+ this.emitter.off(['change-page-results'],
1060
+ bound(this.changePageResultsHandler, this));
1061
+
1062
+ this.pageSlc = null;
1063
+ this.nbPages = 0;
1064
+
1065
+ this.initialized = false;
1066
+ }
1067
+
1068
+ /**
1069
+ * Remove the <tf-pager> element and the handlers bound to it
1070
+ * @private
1071
+ */
1072
+ destroyCE() {
1073
+ let evt = this.evt;
1074
+
1075
+ removeEvt(this.pagerEl, 'page-change', evt.pagerPageChange);
1076
+ this.unbindPagerButton('first', evt.first);
1077
+ this.unbindPagerButton('prev', evt.prev);
1078
+ this.unbindPagerButton('next', evt.next);
1079
+ this.unbindPagerButton('last', evt.last);
1080
+ removeElm(this.pagerEl);
1081
+ this.pagerEl = null;
1082
+ }
1083
+
1084
+ /**
1085
+ * Remove the legacy paging controls and the handlers bound to them
1086
+ * @private
1087
+ */
1088
+ destroyLegacy() {
850
1089
  let evt = this.evt;
851
1090
 
852
1091
  if (this.pageSlc) {
@@ -897,20 +1136,5 @@ export class Paging extends Feature {
897
1136
  removeElm(this.pgCont);
898
1137
  this.pgCont = null;
899
1138
  }
900
-
901
- if (this.hasResultsPerPage) {
902
- this.removeResultsPerPage();
903
- }
904
-
905
- this.emitter.off(['after-filtering'],
906
- bound(this.resetPagingInfo, this));
907
- this.emitter.off(['change-page'], bound(this.changePageHandler, this));
908
- this.emitter.off(['change-page-results'],
909
- bound(this.changePageResultsHandler, this));
910
-
911
- this.pageSlc = null;
912
- this.nbPages = 0;
913
-
914
- this.initialized = false;
915
1139
  }
916
1140
  }
@@ -1309,8 +1309,12 @@ export class TableFilter {
1309
1309
  return;
1310
1310
  }
1311
1311
 
1312
- // Set config's publicPath dynamically for Webpack...
1313
- __webpack_public_path__ = this.basePath;
1312
+ // `__webpack_public_path__` is a webpack-injected global. It is
1313
+ // undefined outside a webpack bundle (Vite/ESM/UMD), so guard the
1314
+ // assignment to avoid a ReferenceError in strict mode (#991).
1315
+ if (typeof __webpack_public_path__ !== 'undefined') {
1316
+ __webpack_public_path__ = this.basePath;
1317
+ }
1314
1318
 
1315
1319
  this.emitter.emit('before-loading-extensions', this);
1316
1320
 
@@ -1339,14 +1343,43 @@ export class TableFilter {
1339
1343
  modulePath = 'extensions/{}/{}'.replace(/{}/g, name);
1340
1344
  }
1341
1345
 
1342
- // Require pattern for Webpack
1343
- require(['./' + modulePath], (mod) => {
1346
+ // Webpack async require context. `require` is webpack-specific: it is
1347
+ // undefined in strict-mode ESM bundles, and present-but-incompatible
1348
+ // (Node-style CJS) in Vite CJS/UMD bundles, where `require([...], cb)`
1349
+ // is not valid. `typeof require !== 'undefined'` alone is not enough to
1350
+ // distinguish the two, so the call is wrapped in try/catch: extension
1351
+ // loading outside webpack degrades gracefully (extensions simply
1352
+ // unavailable) instead of throwing synchronously before `initialized =
1353
+ // true` and leaving the instance half-initialised (#991).
1354
+ if (typeof EXTENSIONS !== 'undefined' && EXTENSIONS[name]) {
1344
1355
  /* eslint-disable */
1345
- let inst = new mod.default(this, ext);
1356
+ let inst = new EXTENSIONS[name](this, ext);
1346
1357
  /* eslint-enable */
1347
1358
  inst.init();
1348
1359
  this.ExtRegistry[name] = inst;
1349
- });
1360
+ return;
1361
+ }
1362
+
1363
+ if (typeof require !== 'undefined') {
1364
+ try {
1365
+ require(['./' + modulePath], (mod) => {
1366
+ /* eslint-disable */
1367
+ let inst = new mod.default(this, ext);
1368
+ /* eslint-enable */
1369
+ inst.init();
1370
+ this.ExtRegistry[name] = inst;
1371
+ });
1372
+ } catch (e) {
1373
+ // Non-webpack require (e.g. Vite CJS/UMD) cannot load async
1374
+ // extensions via `require([...], cb)`. Swallow so init()
1375
+ // completes; extensions remain unavailable until the Vite
1376
+ // migration provides a bundler-agnostic loader (#991).
1377
+ console.warn(
1378
+ 'TableFilter: extension "' + name +
1379
+ '" could not be loaded outside a webpack bundle.'
1380
+ );
1381
+ }
1382
+ }
1350
1383
  }
1351
1384
 
1352
1385
  /**
package/.editorconfig DELETED
@@ -1,15 +0,0 @@
1
- # editorconfig.org
2
-
3
- root = true
4
-
5
- [*]
6
- indent_style = space
7
- indent_size = 4
8
- end_of_line = lf
9
- charset = utf-8
10
- trim_trailing_whitespace = true
11
- insert_final_newline = true
12
-
13
- # Trailing whitespace is significant in markdown files.
14
- [*.md]
15
- trim_trailing_whitespace = false
package/.esdoc.json DELETED
@@ -1,14 +0,0 @@
1
- {
2
- "source": "src",
3
- "destination": "docs/docs",
4
- "plugins": [{
5
- "name": "esdoc-standard-plugin",
6
- "option": {
7
- "lint": {"enable": false},
8
- "accessor": {
9
- "access": ["public", "protected"],
10
- "autoPrivate": true
11
- }
12
- }
13
- }]
14
- }
package/.eslintrc DELETED
@@ -1,37 +0,0 @@
1
- {
2
- "parser": "babel-eslint",
3
- "parserOptions": {
4
- "sourceType": "module",
5
- "ecmaFeatures": { "modules": true }
6
- },
7
- "rules": {
8
- "max-len": [2, 80, 2, {"ignoreUrls": true}],
9
- "indent": [2, 4, {"SwitchCase": 1}],
10
- "semi": ["error", "always"],
11
- "no-trailing-spaces": 2,
12
- "no-multi-spaces": 2,
13
- "array-bracket-spacing": 2,
14
- "keyword-spacing": ["error", { "after": true, "before": true }],
15
- "max-depth": [2, 7],
16
- "max-statements": [2, 133],
17
- "complexity": [2, 45],
18
- "no-unused-vars": 2,
19
- "no-eval": 2,
20
- "no-underscore-dangle": 0,
21
- "no-loop-func": 2,
22
- "no-floating-decimal": 2,
23
- "curly": 2,
24
- "eqeqeq": [2, "smart"],
25
- "quotes": [2, "single"],
26
- "new-cap": 2,
27
- "radix": [2, "always"]
28
- },
29
- "env": {
30
- "es6": true,
31
- "browser": true,
32
- "node": false
33
- },
34
- "globals": {
35
- "__webpack_public_path__": false
36
- }
37
- }
package/.gitattributes DELETED
@@ -1,16 +0,0 @@
1
- # Normalise line endings: LF in the repository and in working trees.
2
- # Working on Windows via /mnt/c let CRLF slip into tracked files, which
3
- # showed up as whole-file diffs with no content change.
4
- * text=auto eol=lf
5
-
6
- # Binary assets: never normalise, never diff as text.
7
- *.png binary
8
- *.jpg binary
9
- *.jpeg binary
10
- *.gif binary
11
- *.ico binary
12
- *.bmp binary
13
- *.woff binary
14
- *.woff2 binary
15
- *.ttf binary
16
- *.eot binary
@@ -1,38 +0,0 @@
1
- ---
2
- name: Bug report
3
- about: Create a report to help us improve
4
- title: ''
5
- labels: bug
6
- assignees: ''
7
-
8
- ---
9
-
10
- **Describe the bug**
11
- A clear and concise description of what the bug is.
12
-
13
- **Reproduction steps:**
14
- Steps to reproduce the behavior:
15
- 1. [First Step]
16
- 2. [Second Step]
17
- 3. [Other Steps...]
18
-
19
- **Expected behavior**
20
- A clear and concise description of what you expected to happen.
21
-
22
- **Observed behavior:**
23
- A clear and concise description of observed behavior.
24
-
25
- **Screenshots**
26
- If applicable, add screenshots to help explain your problem.
27
- ![Screenshots and GIFs which follow reproduction steps to demonstrate the problem](url)
28
-
29
- **TableFilter version:** [Enter TableFilter version here]
30
- **Browser and version:** [Enter Browser name and version here]
31
- **OS and version:** [Enter OS name and version here]
32
- **Device:** [e.g. iPhone6]
33
-
34
- **Additional information/context:**
35
- Add any other context about the problem here.
36
-
37
- * Problem started happening recently, didn't happen in an older version of TableFilter: [Yes/No] if yes [version here]
38
- * Problem can be reliably reproduced, doesn't happen randomly: [Yes/No]
@@ -1,36 +0,0 @@
1
- ---
2
- name: Feature request
3
- about: Suggest an idea for this project
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
-
8
- ---
9
-
10
- **Enhancement/feature description**
11
- [A clear and concise description of what the problem is. Ex. I'm always frustrated when ...]
12
-
13
- **Steps which explain the enhancement/feature**
14
- 1. [First Step]
15
- 2. [Second Step]
16
- 3. [Other Steps...]
17
-
18
- **Current and suggested behavior**
19
- [Describe current and suggested behavior here]
20
-
21
- **Why would the enhancement be useful to most users**
22
- [Explain why the enhancement would be useful to most users]
23
-
24
- **Screenshots and GIFs**
25
- ![Screenshots and GIFs which demonstrate the steps or part of TableFilter the enhancement suggestion is related to](url)
26
-
27
- **Additional context**
28
- [Add any other context or screenshots about the feature request here.]
29
-
30
- **Describe alternatives you've considered**
31
- A clear and concise description of any alternative solutions or features you've considered.
32
-
33
- **TableFilter Version:** [Enter TableFilter version here]
34
- **Browser and version:** [Enter Browser name and version here]
35
- **OS and version:** [Enter OS name and version here]
36
- **Device:** [e.g. iPhone6]
@@ -1,17 +0,0 @@
1
- ---
2
- name: Support
3
- about: I need support with TableFilter
4
- title: ''
5
- labels: ''
6
- assignees: ''
7
-
8
- ---
9
-
10
- For usage and support questions, please check out resources below, you might find an answer:
11
-
12
- - https://www.tablefilter.com/
13
- - https://www.tablefilter.com/docs/
14
- - https://www.tablefilter.com/examples.html
15
- - https://github.com/koalyptus/TableFilter/wiki/
16
- - https://github.com/koalyptus/TableFilter/issues?q=is%3Aissue+is%3Aclosed
17
- - https://codepen.io/koalyptus/pens/public/
@@ -1,10 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: npm
4
- directory: /
5
- schedule:
6
- interval: weekly
7
- ignore:
8
- - dependency-name: webpack-dev-server
9
- update-types:
10
- - version-update:semver-major