@ni/nimble-components 34.10.0 → 34.10.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.
Files changed (38) hide show
  1. package/dist/all-components-bundle.js +136 -47
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +6689 -6675
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/checkbox/index.d.ts +2 -2
  6. package/dist/esm/combobox/index.d.ts +3 -3
  7. package/dist/esm/label-provider/base/index.js.map +1 -1
  8. package/dist/esm/number-field/index.d.ts +3 -3
  9. package/dist/esm/patterns/error/types.d.ts +2 -2
  10. package/dist/esm/patterns/required-visible/types.d.ts +1 -1
  11. package/dist/esm/radio-group/index.d.ts +3 -3
  12. package/dist/esm/rich-text/editor/index.d.ts +2 -2
  13. package/dist/esm/select/index.d.ts +3 -3
  14. package/dist/esm/select/index.js.map +1 -1
  15. package/dist/esm/table-column/anchor/index.d.ts +9 -9
  16. package/dist/esm/table-column/date-text/index.d.ts +7 -7
  17. package/dist/esm/table-column/duration-text/index.d.ts +7 -7
  18. package/dist/esm/table-column/mapping/index.d.ts +6 -6
  19. package/dist/esm/table-column/menu-button/cell-view/index.js +1 -1
  20. package/dist/esm/table-column/menu-button/cell-view/index.js.map +1 -1
  21. package/dist/esm/table-column/menu-button/cell-view/{templates.js → template.js} +1 -1
  22. package/dist/esm/table-column/menu-button/cell-view/template.js.map +1 -0
  23. package/dist/esm/table-column/menu-button/index.d.ts +4 -4
  24. package/dist/esm/table-column/mixins/custom-sort-order.d.ts +2 -2
  25. package/dist/esm/table-column/mixins/fractional-width-column.d.ts +2 -2
  26. package/dist/esm/table-column/mixins/groupable-column.d.ts +1 -1
  27. package/dist/esm/table-column/mixins/placeholder.d.ts +1 -1
  28. package/dist/esm/table-column/mixins/sortable-column.d.ts +1 -1
  29. package/dist/esm/table-column/number-text/index.d.ts +7 -7
  30. package/dist/esm/table-column/text/index.d.ts +9 -9
  31. package/dist/esm/table-column/text-base/index.d.ts +5 -5
  32. package/dist/esm/text-area/index.d.ts +3 -3
  33. package/dist/esm/text-field/index.d.ts +3 -3
  34. package/dist/esm/wafer-map/workers/matrix-renderer.d.ts +5 -5
  35. package/dist/esm/wafer-map/workers/matrix-renderer.js.map +1 -1
  36. package/package.json +9 -28
  37. package/dist/esm/table-column/menu-button/cell-view/templates.js.map +0 -1
  38. /package/dist/esm/table-column/menu-button/cell-view/{templates.d.ts → template.d.ts} +0 -0
@@ -46335,9 +46335,15 @@ ${renderedContent}
46335
46335
  return attrs;
46336
46336
  }
46337
46337
  const filtered = {};
46338
- allowedAttributes.forEach((key) => {
46339
- if (key in attrs) {
46340
- filtered[key] = attrs[key];
46338
+ allowedAttributes.forEach((attr) => {
46339
+ const attrName = typeof attr === "string" ? attr : attr.name;
46340
+ const skipIfDefault = typeof attr === "string" ? void 0 : attr.skipIfDefault;
46341
+ if (attrName in attrs) {
46342
+ const value = attrs[attrName];
46343
+ if (skipIfDefault !== void 0 && value === skipIfDefault) {
46344
+ return;
46345
+ }
46346
+ filtered[attrName] = value;
46341
46347
  }
46342
46348
  });
46343
46349
  return filtered;
@@ -59347,32 +59353,36 @@ ${renderedContent}
59347
59353
  if (!view.editable) {
59348
59354
  return false;
59349
59355
  }
59350
- let link = null;
59351
- if (event.target instanceof HTMLAnchorElement) {
59352
- link = event.target;
59353
- } else {
59354
- let a = event.target;
59355
- const els = [];
59356
- while (a.nodeName !== "DIV") {
59357
- els.push(a);
59358
- a = a.parentNode;
59359
- }
59360
- link = els.find((value) => value.nodeName === "A");
59361
- }
59362
- if (!link) {
59363
- return false;
59364
- }
59365
- const attrs = getAttributes(view.state, options.type.name);
59366
- const href = (_a = link == null ? void 0 : link.href) != null ? _a : attrs.href;
59367
- const target = (_b = link == null ? void 0 : link.target) != null ? _b : attrs.target;
59356
+ let handled = false;
59368
59357
  if (options.enableClickSelection) {
59369
- options.editor.commands.extendMarkRange(options.type.name);
59358
+ const commandResult = options.editor.commands.extendMarkRange(options.type.name);
59359
+ handled = commandResult;
59370
59360
  }
59371
- if (link && href) {
59372
- window.open(href, target);
59373
- return true;
59361
+ if (options.openOnClick) {
59362
+ let link = null;
59363
+ if (event.target instanceof HTMLAnchorElement) {
59364
+ link = event.target;
59365
+ } else {
59366
+ let a = event.target;
59367
+ const els = [];
59368
+ while (a.nodeName !== "DIV") {
59369
+ els.push(a);
59370
+ a = a.parentNode;
59371
+ }
59372
+ link = els.find((value) => value.nodeName === "A");
59373
+ }
59374
+ if (!link) {
59375
+ return handled;
59376
+ }
59377
+ const attrs = getAttributes(view.state, options.type.name);
59378
+ const href = (_a = link == null ? void 0 : link.href) != null ? _a : attrs.href;
59379
+ const target = (_b = link == null ? void 0 : link.target) != null ? _b : attrs.target;
59380
+ if (link && href) {
59381
+ window.open(href, target);
59382
+ handled = true;
59383
+ }
59374
59384
  }
59375
- return false;
59385
+ return handled;
59376
59386
  }
59377
59387
  }
59378
59388
  });
@@ -59613,15 +59623,14 @@ ${renderedContent}
59613
59623
  })
59614
59624
  );
59615
59625
  }
59616
- if (this.options.openOnClick === true) {
59617
- plugins.push(
59618
- clickHandler({
59619
- type: this.type,
59620
- editor: this.editor,
59621
- enableClickSelection: this.options.enableClickSelection
59622
- })
59623
- );
59624
- }
59626
+ plugins.push(
59627
+ clickHandler({
59628
+ type: this.type,
59629
+ editor: this.editor,
59630
+ openOnClick: this.options.openOnClick === "whenNotEditable" ? true : this.options.openOnClick,
59631
+ enableClickSelection: this.options.enableClickSelection
59632
+ })
59633
+ );
59625
59634
  if (this.options.linkOnPaste) {
59626
59635
  plugins.push(
59627
59636
  pasteHandler({
@@ -61142,7 +61151,25 @@ ${nextLine.slice(indentLevel + 2)}`;
61142
61151
  nodeName: "mention",
61143
61152
  name: "@",
61144
61153
  selfClosing: true,
61145
- allowedAttributes: ["id", "label"]
61154
+ allowedAttributes: ["id", "label", { name: "mentionSuggestionChar", skipIfDefault: "@" }],
61155
+ parseAttributes: (attrString) => {
61156
+ const attrs = {};
61157
+ const regex = /(\w+)=(?:"([^"]*)"|'([^']*)')/g;
61158
+ let match = regex.exec(attrString);
61159
+ while (match !== null) {
61160
+ const [, key, doubleQuoted, singleQuoted] = match;
61161
+ const value = doubleQuoted != null ? doubleQuoted : singleQuoted;
61162
+ attrs[key === "char" ? "mentionSuggestionChar" : key] = value;
61163
+ match = regex.exec(attrString);
61164
+ }
61165
+ return attrs;
61166
+ },
61167
+ serializeAttributes: (attrs) => {
61168
+ return Object.entries(attrs).filter(([, value]) => value !== void 0 && value !== null).map(([key, value]) => {
61169
+ const serializedKey = key === "mentionSuggestionChar" ? "char" : key;
61170
+ return `${serializedKey}="${value}"`;
61171
+ }).join(" ");
61172
+ }
61146
61173
  }),
61147
61174
  renderText({ node }) {
61148
61175
  const args = {
@@ -70800,8 +70827,9 @@ focus outline in that case.
70800
70827
  function memo(getDeps, fn, opts) {
70801
70828
  let deps = opts.initialDeps ?? [];
70802
70829
  let result;
70830
+ let isInitial = true;
70803
70831
  function memoizedFunction() {
70804
- var _a, _b, _c, _d;
70832
+ var _a, _b, _c;
70805
70833
  let depTime;
70806
70834
  if (opts.key && ((_a = opts.debug) == null ? void 0 : _a.call(opts))) depTime = Date.now();
70807
70835
  const newDeps = getDeps();
@@ -70836,7 +70864,10 @@ focus outline in that case.
70836
70864
  opts == null ? void 0 : opts.key
70837
70865
  );
70838
70866
  }
70839
- (_d = opts == null ? void 0 : opts.onChange) == null ? void 0 : _d.call(opts, result);
70867
+ if ((opts == null ? void 0 : opts.onChange) && !(isInitial && opts.skipInitialOnChange)) {
70868
+ opts.onChange(result);
70869
+ }
70870
+ isInitial = false;
70840
70871
  return result;
70841
70872
  }
70842
70873
  memoizedFunction.updateDeps = (newDeps) => {
@@ -70984,7 +71015,11 @@ focus outline in that case.
70984
71015
  this.isScrolling = false;
70985
71016
  this.measurementsCache = [];
70986
71017
  this.itemSizeCache = /* @__PURE__ */ new Map();
71018
+ this.laneAssignments = /* @__PURE__ */ new Map();
70987
71019
  this.pendingMeasuredCacheIndexes = [];
71020
+ this.prevLanes = void 0;
71021
+ this.lanesChangedFlag = false;
71022
+ this.lanesSettling = false;
70988
71023
  this.scrollRect = null;
70989
71024
  this.scrollOffset = null;
70990
71025
  this.scrollDirection = null;
@@ -71183,47 +71218,99 @@ focus outline in that case.
71183
71218
  this.options.paddingStart,
71184
71219
  this.options.scrollMargin,
71185
71220
  this.options.getItemKey,
71186
- this.options.enabled
71221
+ this.options.enabled,
71222
+ this.options.lanes
71187
71223
  ],
71188
- (count, paddingStart, scrollMargin, getItemKey, enabled) => {
71224
+ (count, paddingStart, scrollMargin, getItemKey, enabled, lanes) => {
71225
+ const lanesChanged = this.prevLanes !== void 0 && this.prevLanes !== lanes;
71226
+ if (lanesChanged) {
71227
+ this.lanesChangedFlag = true;
71228
+ }
71229
+ this.prevLanes = lanes;
71189
71230
  this.pendingMeasuredCacheIndexes = [];
71190
71231
  return {
71191
71232
  count,
71192
71233
  paddingStart,
71193
71234
  scrollMargin,
71194
71235
  getItemKey,
71195
- enabled
71236
+ enabled,
71237
+ lanes
71196
71238
  };
71197
71239
  },
71198
71240
  {
71199
- key: false
71241
+ key: false,
71242
+ skipInitialOnChange: true,
71243
+ onChange: () => {
71244
+ this.notify(this.isScrolling);
71245
+ }
71200
71246
  }
71201
71247
  );
71202
71248
  this.getMeasurements = memo(
71203
71249
  () => [this.getMeasurementOptions(), this.itemSizeCache],
71204
- ({ count, paddingStart, scrollMargin, getItemKey, enabled }, itemSizeCache) => {
71250
+ ({ count, paddingStart, scrollMargin, getItemKey, enabled, lanes }, itemSizeCache) => {
71205
71251
  if (!enabled) {
71206
71252
  this.measurementsCache = [];
71207
71253
  this.itemSizeCache.clear();
71254
+ this.laneAssignments.clear();
71208
71255
  return [];
71209
71256
  }
71257
+ if (this.laneAssignments.size > count) {
71258
+ for (const index of this.laneAssignments.keys()) {
71259
+ if (index >= count) {
71260
+ this.laneAssignments.delete(index);
71261
+ }
71262
+ }
71263
+ }
71264
+ if (this.lanesChangedFlag) {
71265
+ this.lanesChangedFlag = false;
71266
+ this.lanesSettling = true;
71267
+ this.measurementsCache = [];
71268
+ this.itemSizeCache.clear();
71269
+ this.laneAssignments.clear();
71270
+ this.pendingMeasuredCacheIndexes = [];
71271
+ }
71210
71272
  if (this.measurementsCache.length === 0) {
71211
71273
  this.measurementsCache = this.options.initialMeasurementsCache;
71212
71274
  this.measurementsCache.forEach((item) => {
71213
71275
  this.itemSizeCache.set(item.key, item.size);
71214
71276
  });
71215
71277
  }
71216
- const min = this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
71278
+ const min = this.lanesSettling ? 0 : this.pendingMeasuredCacheIndexes.length > 0 ? Math.min(...this.pendingMeasuredCacheIndexes) : 0;
71217
71279
  this.pendingMeasuredCacheIndexes = [];
71280
+ if (this.lanesSettling && this.measurementsCache.length === count) {
71281
+ this.lanesSettling = false;
71282
+ }
71218
71283
  const measurements = this.measurementsCache.slice(0, min);
71284
+ const laneLastIndex = new Array(lanes).fill(
71285
+ void 0
71286
+ );
71287
+ for (let m = 0; m < min; m++) {
71288
+ const item = measurements[m];
71289
+ if (item) {
71290
+ laneLastIndex[item.lane] = m;
71291
+ }
71292
+ }
71219
71293
  for (let i = min; i < count; i++) {
71220
71294
  const key = getItemKey(i);
71221
- const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
71222
- const start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
71295
+ const cachedLane = this.laneAssignments.get(i);
71296
+ let lane;
71297
+ let start;
71298
+ if (cachedLane !== void 0 && this.options.lanes > 1) {
71299
+ lane = cachedLane;
71300
+ const prevIndex = laneLastIndex[lane];
71301
+ const prevInLane = prevIndex !== void 0 ? measurements[prevIndex] : void 0;
71302
+ start = prevInLane ? prevInLane.end + this.options.gap : paddingStart + scrollMargin;
71303
+ } else {
71304
+ const furthestMeasurement = this.options.lanes === 1 ? measurements[i - 1] : this.getFurthestMeasurement(measurements, i);
71305
+ start = furthestMeasurement ? furthestMeasurement.end + this.options.gap : paddingStart + scrollMargin;
71306
+ lane = furthestMeasurement ? furthestMeasurement.lane : i % this.options.lanes;
71307
+ if (this.options.lanes > 1) {
71308
+ this.laneAssignments.set(i, lane);
71309
+ }
71310
+ }
71223
71311
  const measuredSize = itemSizeCache.get(key);
71224
71312
  const size = typeof measuredSize === "number" ? measuredSize : this.options.estimateSize(i);
71225
71313
  const end = start + size;
71226
- const lane = furthestMeasurement ? furthestMeasurement.lane : i % this.options.lanes;
71227
71314
  measurements[i] = {
71228
71315
  index: i,
71229
71316
  start,
@@ -71232,6 +71319,7 @@ focus outline in that case.
71232
71319
  key,
71233
71320
  lane
71234
71321
  };
71322
+ laneLastIndex[lane] = i;
71235
71323
  }
71236
71324
  this.measurementsCache = measurements;
71237
71325
  return measurements;
@@ -71525,6 +71613,7 @@ focus outline in that case.
71525
71613
  };
71526
71614
  this.measure = () => {
71527
71615
  this.itemSizeCache = /* @__PURE__ */ new Map();
71616
+ this.laneAssignments = /* @__PURE__ */ new Map();
71528
71617
  this.notify(false);
71529
71618
  };
71530
71619
  this.setOptions(opts);