datavis-glide 4.0.0 → 4.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datavis-glide",
3
- "version": "4.0.0",
3
+ "version": "4.0.2",
4
4
  "description": "DataVis GLIDE (Graphical Layer for Interactive Data Exploration)",
5
5
  "keywords": [
6
6
  "data",
@@ -5,7 +5,7 @@ import jQuery from 'jquery';
5
5
 
6
6
  import { trans } from './trans.js';
7
7
  import {
8
- icon,
8
+ makeOperationButton,
9
9
  makeSubclass,
10
10
  mixinLogging,
11
11
  } from './util/misc.js';
@@ -93,20 +93,8 @@ OperationsPalette.prototype.drawPalette = function () {
93
93
  var catLabel = jQuery('<span>').text(c).appendTo(catDiv);
94
94
  }
95
95
  _.each(ops, function (op) {
96
- var btn = jQuery('<button>', {
97
- 'type': 'button',
98
- 'class': 'wcdv_operation',
99
- 'data-operation-index': op.idx
100
- }).appendTo(catDiv);
101
- if (op.label == null) {
102
- btn.addClass('no_label');
103
- }
104
- if (op.icon) {
105
- btn.append(icon(op.icon));
106
- }
107
- if (op.label) {
108
- btn.append(op.label);
109
- }
96
+ var btn = makeOperationButton('all', op, op.idx);
97
+ catDiv.append(btn);
110
98
  });
111
99
  });
112
100
  };
@@ -900,6 +900,7 @@ GridTable.prototype._addSortingToHeader = function (data, orientation, spec, con
900
900
 
901
901
  // Create the sort icon container with an initial neutral "sortable" icon.
902
902
  var sortIcon_btn = document.createElement('button');
903
+ sortIcon_btn.setAttribute('type', 'button');
903
904
  sortIcon_btn.classList.add('wcdv_icon_button');
904
905
  sortIcon_btn.classList.add(sortIcon_class);
905
906
  sortIcon_btn.classList.add(sortIcon_orientationClass);
@@ -968,7 +969,10 @@ GridTable.prototype._addSortingToHeader = function (data, orientation, spec, con
968
969
  self.view.clearSort();
969
970
  });
970
971
 
971
- sortIcon_btn.addEventListener('click', function () {
972
+ // Bind with jQuery (not the native addEventListener) so that the handler survives when the
973
+ // TableTool floating-header feature clones the table header via jQuery's clone(true). Native
974
+ // listeners are not copied by clone(true), which would leave the cloned sort icon inert.
975
+ jQuery(sortIcon_btn).on('click', function () {
972
976
  sortIcon_menu.open(sortIcon_btn);
973
977
  });
974
978
 
@@ -1021,6 +1025,7 @@ GridTable.prototype._addFilterToHeader = function (container, field, displayText
1021
1025
  }
1022
1026
 
1023
1027
  jQuery('<button>', {
1028
+ 'type': 'button',
1024
1029
  'data-tooltip': trans('GRID.TABLE.ADD_FILTER_HELP', field)
1025
1030
  })
1026
1031
  .addClass('wcdv_icon_button')
package/src/ui/slider.js CHANGED
@@ -61,6 +61,7 @@ Slider.prototype.draw = function (root) {
61
61
  });
62
62
  self.ui.header = jQuery('<h1>');
63
63
  self.ui.closeBtn = jQuery('<button>', {
64
+ 'type': 'button',
64
65
  'class': 'wcdv-slider-close'
65
66
  }).text('×').on('click', function () {
66
67
  self.hide();
package/src/util/misc.js CHANGED
@@ -537,6 +537,7 @@ export function setTableCell(cell, value, opts) {
537
537
  }
538
538
 
539
539
  var showValueBtn = document.createElement('button');
540
+ showValueBtn.setAttribute('type', 'button');
540
541
  showValueBtn.setAttribute('title', 'Full value has been truncated; click to show it.');
541
542
  showValueBtn.classList.add('wcdv_icon_button');
542
543
  showValueBtn.classList.add('wcdv_icon_button_incell');
@@ -681,10 +682,16 @@ export function makeOperationButton(type, op, index, opts) {
681
682
  }
682
683
  else {
683
684
  if (op.icon) {
684
- btn.appendChild(makeOperationIcon(op));
685
+ var icon = makeOperationIcon(op);
686
+ if (op.label) {
687
+ icon.style.paddingRight = '0.25em';
688
+ }
689
+ btn.setAttribute('data-icon', op.icon);
690
+ btn.appendChild(icon);
685
691
  }
686
692
  if (op.label) {
687
693
  btn.classList.add('wcdv_nowrap');
694
+ btn.setAttribute('aria-label', op.label);
688
695
  btn.append(op.label);
689
696
  }
690
697
  else {
@@ -693,6 +700,7 @@ export function makeOperationButton(type, op, index, opts) {
693
700
  }
694
701
  if (op.tooltip) {
695
702
  btn.setAttribute('title', op.tooltip);
703
+ btn.setAttribute('aria-description', op.tooltip);
696
704
  }
697
705
  return btn;
698
706
  }