@ni/nimble-components 18.5.2 → 18.5.4

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 (36) hide show
  1. package/dist/all-components-bundle.js +211 -51
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +597 -552
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/table/components/row/styles.js +0 -1
  6. package/dist/esm/table/components/row/styles.js.map +1 -1
  7. package/dist/esm/table/components/row/template.js +19 -17
  8. package/dist/esm/table/components/row/template.js.map +1 -1
  9. package/dist/esm/table/template.js +5 -3
  10. package/dist/esm/table/template.js.map +1 -1
  11. package/dist/esm/table-column/base/index.d.ts +1 -0
  12. package/dist/esm/table-column/base/index.js +4 -0
  13. package/dist/esm/table-column/base/index.js.map +1 -1
  14. package/dist/esm/wafer-map/index.d.ts +25 -4
  15. package/dist/esm/wafer-map/index.js +45 -4
  16. package/dist/esm/wafer-map/index.js.map +1 -1
  17. package/dist/esm/wafer-map/modules/data-manager.d.ts +3 -1
  18. package/dist/esm/wafer-map/modules/data-manager.js +4 -0
  19. package/dist/esm/wafer-map/modules/data-manager.js.map +1 -1
  20. package/dist/esm/wafer-map/modules/event-coordinator.d.ts +1 -1
  21. package/dist/esm/wafer-map/modules/event-coordinator.js +6 -12
  22. package/dist/esm/wafer-map/modules/event-coordinator.js.map +1 -1
  23. package/dist/esm/wafer-map/modules/hover-handler.d.ts +12 -0
  24. package/dist/esm/wafer-map/modules/hover-handler.js +56 -0
  25. package/dist/esm/wafer-map/modules/hover-handler.js.map +1 -0
  26. package/dist/esm/wafer-map/modules/rendering.d.ts +2 -1
  27. package/dist/esm/wafer-map/modules/rendering.js +38 -15
  28. package/dist/esm/wafer-map/modules/rendering.js.map +1 -1
  29. package/dist/esm/wafer-map/styles.js +27 -0
  30. package/dist/esm/wafer-map/styles.js.map +1 -1
  31. package/dist/esm/wafer-map/template.js +8 -0
  32. package/dist/esm/wafer-map/template.js.map +1 -1
  33. package/dist/esm/wafer-map/types.d.ts +9 -0
  34. package/dist/esm/wafer-map/types.js +4 -0
  35. package/dist/esm/wafer-map/types.js.map +1 -1
  36. package/package.json +10 -6
@@ -26873,6 +26873,7 @@
26873
26873
  class TableColumn extends FoundationElement {
26874
26874
  constructor() {
26875
26875
  super(...arguments);
26876
+ this.columnHidden = false;
26876
26877
  /**
26877
26878
  * @internal
26878
26879
  *
@@ -26898,6 +26899,9 @@
26898
26899
  __decorate$1([
26899
26900
  attr({ attribute: 'action-menu-label' })
26900
26901
  ], TableColumn.prototype, "actionMenuLabel", void 0);
26902
+ __decorate$1([
26903
+ attr({ attribute: 'column-hidden', mode: 'boolean' })
26904
+ ], TableColumn.prototype, "columnHidden", void 0);
26901
26905
  __decorate$1([
26902
26906
  observable
26903
26907
  ], TableColumn.prototype, "dataRecordFieldNames", void 0);
@@ -27117,7 +27121,6 @@
27117
27121
  --ni-private-table-cell-action-menu-display: block;
27118
27122
  }
27119
27123
 
27120
- :host(.hover) nimble-table-cell,
27121
27124
  :host(:hover) nimble-table-cell {
27122
27125
  --ni-private-table-cell-action-menu-display: block;
27123
27126
  }
@@ -27242,24 +27245,26 @@
27242
27245
  const template$5 = html `
27243
27246
  <template role="row">
27244
27247
  ${repeat(x => x.columnStates, html `
27245
- <${DesignSystem.tagFor(TableCell)}
27246
- class="cell"
27247
- :cellTemplate="${x => x.column.cellTemplate}"
27248
- :cellStyles="${x => x.column.cellStyles}"
27249
- :cellState="${x => x.cellState}"
27250
- ?has-action-menu="${x => !!x.column.actionMenuSlot}"
27251
- action-menu-label="${x => x.column.actionMenuLabel}"
27252
- @cell-action-menu-beforetoggle="${(x, c) => c.parent.onCellActionMenuBeforeToggle(c.event, x.column)}"
27253
- @cell-action-menu-toggle="${(x, c) => c.parent.onCellActionMenuToggle(c.event, x.column)}"
27254
- >
27248
+ ${when(x => !x.column.columnHidden, html `
27249
+ <${DesignSystem.tagFor(TableCell)}
27250
+ class="cell"
27251
+ :cellTemplate="${x => x.column.cellTemplate}"
27252
+ :cellStyles="${x => x.column.cellStyles}"
27253
+ :cellState="${x => x.cellState}"
27254
+ ?has-action-menu="${x => !!x.column.actionMenuSlot}"
27255
+ action-menu-label="${x => x.column.actionMenuLabel}"
27256
+ @cell-action-menu-beforetoggle="${(x, c) => c.parent.onCellActionMenuBeforeToggle(c.event, x.column)}"
27257
+ @cell-action-menu-toggle="${(x, c) => c.parent.onCellActionMenuToggle(c.event, x.column)}"
27258
+ >
27255
27259
 
27256
- ${when((x, c) => (c.parent.currentActionMenuColumn === x.column) && x.column.actionMenuSlot, html `
27257
- <slot
27258
- name="${x => `row-action-menu-${x.column.actionMenuSlot}`}"
27259
- slot="cellActionMenu"
27260
- ></slot>
27261
- `)}
27262
- </${DesignSystem.tagFor(TableCell)}>
27260
+ ${when((x, c) => (c.parent.currentActionMenuColumn === x.column) && x.column.actionMenuSlot, html `
27261
+ <slot
27262
+ name="${x => `row-action-menu-${x.column.actionMenuSlot}`}"
27263
+ slot="cellActionMenu"
27264
+ ></slot>
27265
+ `)}
27266
+ </${DesignSystem.tagFor(TableCell)}>
27267
+ `)}
27263
27268
  `)}
27264
27269
  </template>
27265
27270
  `;
@@ -27349,9 +27354,11 @@
27349
27354
  <div role="rowgroup" class="header-container">
27350
27355
  <div class="header-row" role="row">
27351
27356
  ${repeat(x => x.columns, html `
27352
- <${DesignSystem.tagFor(TableHeader)} class="header">
27353
- <slot name="${x => x.slot}"></slot>
27354
- </${DesignSystem.tagFor(TableHeader)}>
27357
+ ${when(x => !x.columnHidden, html `
27358
+ <${DesignSystem.tagFor(TableHeader)} class="header">
27359
+ <slot name="${x => x.slot}"></slot>
27360
+ </${DesignSystem.tagFor(TableHeader)}>
27361
+ `)}
27355
27362
  `)}
27356
27363
  <div class="header-scrollbar-spacer" style="width: ${x => x.virtualizer.headerContainerMarginRight}px;"></div>
27357
27364
  </div>
@@ -32893,6 +32900,14 @@ Instead styling against the role which is more general and likely a better appro
32893
32900
  </g>
32894
32901
  </svg>
32895
32902
  <canvas class="wafer-map-canvas" ${ref('canvas')}></canvas>
32903
+ <svg class="hover-layer">
32904
+ <rect
32905
+ class="hover-rect ${x => x.hoverOpacity}"
32906
+ transform="${x => x.hoverTransform}"
32907
+ width="${x => x.hoverWidth}"
32908
+ height="${x => x.hoverHeight}"
32909
+ />
32910
+ </svg>
32896
32911
  </div>
32897
32912
  `;
32898
32913
 
@@ -32953,6 +32968,32 @@ Instead styling against the role which is more general and likely a better appro
32953
32968
  display: inline-block;
32954
32969
  position: absolute;
32955
32970
  }
32971
+
32972
+ .hover-layer {
32973
+ position: absolute;
32974
+ pointer-events: none;
32975
+ width: 100%;
32976
+ height: 100%;
32977
+ }
32978
+
32979
+ .hover-rect {
32980
+ fill: transparent;
32981
+ stroke: white;
32982
+ outline-style: solid;
32983
+ outline-color: ${DigitalGreenLight};
32984
+ }
32985
+
32986
+ .hover-rect.show {
32987
+ opacity: 1;
32988
+ stroke-width: 2px;
32989
+ outline-width: 2px;
32990
+ }
32991
+
32992
+ .hover-rect.hide {
32993
+ opacity: 0;
32994
+ stroke-width: 0px;
32995
+ outline-width: 0px;
32996
+ }
32956
32997
  `;
32957
32998
 
32958
32999
  function ascending(a, b) {
@@ -33841,6 +33882,10 @@ Instead styling against the role which is more general and likely a better appro
33841
33882
  left: 'left',
33842
33883
  right: 'right'
33843
33884
  };
33885
+ const HoverDieOpacity = {
33886
+ show: 'show',
33887
+ hide: 'hide'
33888
+ };
33844
33889
  const WaferMapColorScaleMode = {
33845
33890
  linear: 'linear',
33846
33891
  ordinal: 'ordinal'
@@ -34062,6 +34107,7 @@ Instead styling against the role which is more general and likely a better appro
34062
34107
  constructor(wafermap) {
34063
34108
  this.computations = new Computations(wafermap);
34064
34109
  this.prerendering = new Prerendering(wafermap, this.horizontalScale, this.verticalScale, this.dieDimensions, this.margin);
34110
+ this.dataMap = new Map(wafermap.dies.map(die => [`${die.x}_${die.y}`, die]));
34065
34111
  }
34066
34112
  get containerDimensions() {
34067
34113
  return this.computations.containerDimensions;
@@ -34087,6 +34133,9 @@ Instead styling against the role which is more general and likely a better appro
34087
34133
  get diesRenderInfo() {
34088
34134
  return this.prerendering.diesRenderInfo;
34089
34135
  }
34136
+ getWaferMapDie(point) {
34137
+ return this.dataMap.get(`${point.x}_${point.y}`);
34138
+ }
34090
34139
  }
34091
34140
 
34092
34141
  /**
@@ -34095,18 +34144,40 @@ Instead styling against the role which is more general and likely a better appro
34095
34144
  class RenderingModule {
34096
34145
  constructor(wafermap) {
34097
34146
  this.wafermap = wafermap;
34098
- this.context = wafermap.canvas.getContext('2d');
34099
34147
  this.dies = wafermap.dataManager.diesRenderInfo;
34100
34148
  this.dimensions = wafermap.dataManager.dieDimensions;
34101
34149
  this.labelFontSize = wafermap.dataManager.labelsFontSize;
34102
34150
  }
34103
34151
  drawWafer() {
34104
- this.context.save();
34152
+ this.wafermap.canvasContext.save();
34105
34153
  this.clearCanvas();
34106
34154
  this.scaleCanvas();
34107
34155
  this.renderDies();
34108
34156
  this.renderText();
34109
- this.context.restore();
34157
+ this.wafermap.canvasContext.restore();
34158
+ this.renderHover();
34159
+ }
34160
+ renderHover() {
34161
+ this.wafermap.hoverWidth = this.wafermap.dataManager.dieDimensions.width
34162
+ * this.wafermap.transform.k;
34163
+ this.wafermap.hoverHeight = this.wafermap.dataManager.dieDimensions.height
34164
+ * this.wafermap.transform.k;
34165
+ this.wafermap.hoverOpacity = this.wafermap.hoverDie === undefined
34166
+ ? HoverDieOpacity.hide
34167
+ : HoverDieOpacity.show;
34168
+ this.wafermap.hoverTransform = this.calculateHoverTransform();
34169
+ }
34170
+ calculateHoverTransform() {
34171
+ if (this.wafermap.hoverDie !== undefined) {
34172
+ const scaledX = this.wafermap.dataManager.horizontalScale(this.wafermap.hoverDie.x);
34173
+ const scaledY = this.wafermap.dataManager.verticalScale(this.wafermap.hoverDie.y);
34174
+ const transformedPoint = this.wafermap.transform.apply([
34175
+ scaledX + this.wafermap.dataManager.margin.left,
34176
+ scaledY + this.wafermap.dataManager.margin.top
34177
+ ]);
34178
+ return `translate(${transformedPoint[0]}, ${transformedPoint[1]})`;
34179
+ }
34180
+ return '';
34110
34181
  }
34111
34182
  renderDies() {
34112
34183
  this.dies.sort((a, b) => {
@@ -34121,12 +34192,12 @@ Instead styling against the role which is more general and likely a better appro
34121
34192
  let prev;
34122
34193
  for (const die of this.dies) {
34123
34194
  if (!prev) {
34124
- this.context.fillStyle = die.fillStyle;
34195
+ this.wafermap.canvasContext.fillStyle = die.fillStyle;
34125
34196
  }
34126
34197
  if (prev && die.fillStyle !== prev.fillStyle && die.fillStyle) {
34127
- this.context.fillStyle = die.fillStyle;
34198
+ this.wafermap.canvasContext.fillStyle = die.fillStyle;
34128
34199
  }
34129
- this.context.fillRect(die.x, die.y, this.dimensions.width, this.dimensions.height);
34200
+ this.wafermap.canvasContext.fillRect(die.x, die.y, this.dimensions.width, this.dimensions.height);
34130
34201
  prev = die;
34131
34202
  }
34132
34203
  }
@@ -34135,25 +34206,25 @@ Instead styling against the role which is more general and likely a better appro
34135
34206
  * this.dimensions.height
34136
34207
  * (this.wafermap.transform.k || 1);
34137
34208
  const fontsize = this.labelFontSize;
34138
- this.context.font = `${fontsize.toString()}px sans-serif`;
34139
- this.context.fillStyle = '#ffffff';
34140
- this.context.textAlign = 'center';
34141
- this.context.lineCap = 'butt';
34142
- const approxTextHeight = this.context.measureText('M');
34209
+ this.wafermap.canvasContext.font = `${fontsize.toString()}px sans-serif`;
34210
+ this.wafermap.canvasContext.fillStyle = '#ffffff';
34211
+ this.wafermap.canvasContext.textAlign = 'center';
34212
+ this.wafermap.canvasContext.lineCap = 'butt';
34213
+ const approxTextHeight = this.wafermap.canvasContext.measureText('M');
34143
34214
  if (dieSize >= 50) {
34144
34215
  for (const die of this.dies) {
34145
- this.context.fillText(die.text, die.x + this.dimensions.width / 2, die.y
34216
+ this.wafermap.canvasContext.fillText(die.text, die.x + this.dimensions.width / 2, die.y
34146
34217
  + this.dimensions.height / 2
34147
34218
  + approxTextHeight.width / 2, this.dimensions.width - (this.dimensions.width / 100) * 20);
34148
34219
  }
34149
34220
  }
34150
34221
  }
34151
34222
  clearCanvas() {
34152
- this.context.clearRect(0, 0, this.wafermap.canvasWidth * this.wafermap.transform.k, this.wafermap.canvasHeight * this.wafermap.transform.k);
34223
+ this.wafermap.canvasContext.clearRect(0, 0, this.wafermap.canvasWidth * this.wafermap.transform.k, this.wafermap.canvasHeight * this.wafermap.transform.k);
34153
34224
  }
34154
34225
  scaleCanvas() {
34155
- this.context.translate(this.wafermap.transform.x, this.wafermap.transform.y);
34156
- this.context.scale(this.wafermap.transform.k, this.wafermap.transform.k);
34226
+ this.wafermap.canvasContext.translate(this.wafermap.transform.x, this.wafermap.transform.y);
34227
+ this.wafermap.canvasContext.scale(this.wafermap.transform.k, this.wafermap.transform.k);
34157
34228
  }
34158
34229
  }
34159
34230
 
@@ -34212,6 +34283,61 @@ Instead styling against the role which is more general and likely a better appro
34212
34283
  }
34213
34284
  }
34214
34285
 
34286
+ /**
34287
+ * HoverHandler deals with user interactions and events like hovering
34288
+ */
34289
+ class HoverHandler {
34290
+ constructor(wafermap) {
34291
+ this.wafermap = wafermap;
34292
+ }
34293
+ mousemove(event) {
34294
+ const mousePosition = {
34295
+ x: event.offsetX,
34296
+ y: event.offsetY
34297
+ };
34298
+ if (!this.hoversOverDie(mousePosition)) {
34299
+ this.wafermap.hoverDie = undefined;
34300
+ return;
34301
+ }
34302
+ // get original mouse position in case we are in zoom.
34303
+ const invertedPoint = this.wafermap.transform.invert([
34304
+ mousePosition.x,
34305
+ mousePosition.y
34306
+ ]);
34307
+ const dieCoordinates = this.calculateDieCoordinates({
34308
+ x: invertedPoint[0],
34309
+ y: invertedPoint[1]
34310
+ });
34311
+ this.wafermap.hoverDie = this.wafermap.dataManager.getWaferMapDie(dieCoordinates);
34312
+ }
34313
+ mouseout(_event) {
34314
+ this.wafermap.hoverDie = undefined;
34315
+ }
34316
+ calculateDieCoordinates(mousePosition) {
34317
+ const axisLocation = this.wafermap.quadrant;
34318
+ const xRoundFunction = axisLocation === WaferMapQuadrant.bottomLeft
34319
+ || axisLocation === WaferMapQuadrant.topLeft
34320
+ ? Math.floor
34321
+ : Math.ceil;
34322
+ const yRoundFunction = axisLocation === WaferMapQuadrant.topLeft
34323
+ || axisLocation === WaferMapQuadrant.topRight
34324
+ ? Math.floor
34325
+ : Math.ceil;
34326
+ // go to x and y scale to get the x,y values of the die.
34327
+ const x = xRoundFunction(this.wafermap.dataManager.horizontalScale.invert(mousePosition.x - this.wafermap.dataManager.margin.left));
34328
+ const y = yRoundFunction(this.wafermap.dataManager.verticalScale.invert(mousePosition.y - this.wafermap.dataManager.margin.top));
34329
+ return { x, y };
34330
+ }
34331
+ hoversOverDie(mousePosition) {
34332
+ const rgba = this.wafermap.canvasContext.getImageData(mousePosition.x, mousePosition.y, 1, 1).data;
34333
+ let rgbaSum = 0;
34334
+ for (const color of rgba) {
34335
+ rgbaSum += color;
34336
+ }
34337
+ return rgbaSum > 0;
34338
+ }
34339
+ }
34340
+
34215
34341
  /**
34216
34342
  * EventCoordinator deals with user interactions and events
34217
34343
  */
@@ -34221,21 +34347,16 @@ Instead styling against the role which is more general and likely a better appro
34221
34347
  this.onWheelMove = (event) => {
34222
34348
  event.preventDefault();
34223
34349
  };
34224
- this.onMouseMove = () => {
34225
- // TODO HoverHandler - mousemove(e) callback
34350
+ this.onMouseMove = (event) => {
34351
+ this.hoverHandler.mousemove(event);
34226
34352
  };
34227
- this.onMouseOut = () => {
34228
- // TODO HoverHandler - mouseout() callback
34353
+ this.onMouseOut = (event) => {
34354
+ this.hoverHandler.mouseout(event);
34229
34355
  };
34230
34356
  this.zoomHandler = new ZoomHandler(wafermap);
34231
- // TODO HoverHandler - initialization
34232
- // TODO HoverHandler - create a hoverDie element
34357
+ this.hoverHandler = new HoverHandler(wafermap);
34233
34358
  this.attachEvents();
34234
34359
  }
34235
- get selectedDie() {
34236
- // TODO HoverHandler - return the last selected die when called
34237
- return undefined;
34238
- }
34239
34360
  detachEvents() {
34240
34361
  this.wafermap.removeEventListener('mousemove', this.onMouseMove);
34241
34362
  this.wafermap.removeEventListener('mouseout', this.onMouseOut);
@@ -34247,8 +34368,6 @@ Instead styling against the role which is more general and likely a better appro
34247
34368
  this.wafermap.canvas.addEventListener('wheel', this.onWheelMove, {
34248
34369
  passive: false
34249
34370
  });
34250
- // Wafermap callbacks
34251
- // TODO HoverHandler - configure the callback to be fired from HoverHandler when a new die is selected
34252
34371
  }
34253
34372
  }
34254
34373
 
@@ -34272,18 +34391,34 @@ Instead styling against the role which is more general and likely a better appro
34272
34391
  * @internal
34273
34392
  */
34274
34393
  this.transform = identity$2;
34394
+ /**
34395
+ * @internal
34396
+ */
34397
+ this.hoverTransform = '';
34398
+ /**
34399
+ * @internal
34400
+ */
34401
+ this.hoverOpacity = HoverDieOpacity.hide;
34402
+ /**
34403
+ * @internal
34404
+ */
34405
+ this.hoverWidth = 0;
34406
+ /**
34407
+ * @internal
34408
+ */
34409
+ this.hoverHeight = 0;
34275
34410
  this.highlightedValues = [];
34276
34411
  this.dies = [];
34277
34412
  this.colorScale = {
34278
34413
  colors: [],
34279
34414
  values: []
34280
34415
  };
34281
- this.emitDieSelected = (die) => {
34282
- this.$emit('die-selected', { detail: { die } });
34283
- };
34284
34416
  }
34285
34417
  connectedCallback() {
34286
34418
  super.connectedCallback();
34419
+ this.canvasContext = this.canvas.getContext('2d', {
34420
+ willReadFrequently: true
34421
+ });
34287
34422
  this.resizeObserver = this.createResizeObserver();
34288
34423
  }
34289
34424
  disconnectedCallback() {
@@ -34307,6 +34442,12 @@ Instead styling against the role which is more general and likely a better appro
34307
34442
  DOM.queueUpdate(() => this.render());
34308
34443
  }
34309
34444
  }
34445
+ queueRenderHover() {
34446
+ if (!this.$fastController.isConnected) {
34447
+ return;
34448
+ }
34449
+ DOM.queueUpdate(() => this.renderer?.renderHover());
34450
+ }
34310
34451
  initializeInternalModules() {
34311
34452
  this.eventCoordinator?.detachEvents();
34312
34453
  this.dataManager = new DataManager(this);
@@ -34366,6 +34507,10 @@ Instead styling against the role which is more general and likely a better appro
34366
34507
  canvasHeightChanged() {
34367
34508
  this.queueRender();
34368
34509
  }
34510
+ hoverDieChanged() {
34511
+ this.$emit('die-hover', { currentDie: this.hoverDie });
34512
+ this.queueRenderHover();
34513
+ }
34369
34514
  }
34370
34515
  __decorate$1([
34371
34516
  attr
@@ -34404,6 +34549,21 @@ Instead styling against the role which is more general and likely a better appro
34404
34549
  __decorate$1([
34405
34550
  observable
34406
34551
  ], WaferMap.prototype, "transform", void 0);
34552
+ __decorate$1([
34553
+ observable
34554
+ ], WaferMap.prototype, "hoverTransform", void 0);
34555
+ __decorate$1([
34556
+ observable
34557
+ ], WaferMap.prototype, "hoverOpacity", void 0);
34558
+ __decorate$1([
34559
+ observable
34560
+ ], WaferMap.prototype, "hoverWidth", void 0);
34561
+ __decorate$1([
34562
+ observable
34563
+ ], WaferMap.prototype, "hoverHeight", void 0);
34564
+ __decorate$1([
34565
+ observable
34566
+ ], WaferMap.prototype, "hoverDie", void 0);
34407
34567
  __decorate$1([
34408
34568
  observable
34409
34569
  ], WaferMap.prototype, "highlightedValues", void 0);