@ni/nimble-components 20.9.0 → 20.10.1

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.
@@ -16288,7 +16288,7 @@
16288
16288
 
16289
16289
  /**
16290
16290
  * Do not edit directly
16291
- * Generated on Thu, 19 Oct 2023 23:31:18 GMT
16291
+ * Generated on Thu, 26 Oct 2023 00:07:00 GMT
16292
16292
  */
16293
16293
 
16294
16294
  const Information100DarkUi = "#a46eff";
@@ -19145,6 +19145,10 @@
19145
19145
  name: 'floppy_disk_checkmark_16_x_16',
19146
19146
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path class="cls-1" d="M12.455 5h-1.041l-1.005 1H12v3H4V6h3.782L6.79 5H3.583A.585.585 0 0 0 3 5.598V12.5l1.5 1.497 7.858.003a.602.602 0 0 0 .6-.6L13 5.545A.513.513 0 0 0 12.455 5ZM11 13H8v-2H6v2H5v-3h6Zm2-10.99L9.091 5.9 7 3.79l.919-.89 1.164 1.208L12.128 1.1l.872.91"/></svg>`
19147
19147
  };
19148
+ const floppyDiskPen16X16 = {
19149
+ name: 'floppy_disk_pen_16_x_16',
19150
+ data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path class="cls-2" d="M7.17 11.108 7.299 11H7V9H5v2H4V8h6v.696l1.626-1.386c.107-.09.228-.155.355-.206L12 3.546c0-.33-.215-.546-.545-.546H2.583A.585.585 0 0 0 2 3.598V10.5l1.5 1.497 3.136.001.535-.89ZM3 7V4h8v3H3Z"/><path class="cls-1" d="M12.275 8.07c.218-.185.693-.008 1.205.552.512.56.635 1.038.418 1.223l-.92.784-1.621-1.775.918-.783Zm-4.92 6.113 1.98-.899-.985.164.043-.94-.32.161.104-.652-1.17 1.786.348.38Zm2.212-.645L6 15l1.945-3.236 2.1-1.791 1.622 1.774-2.1 1.79Zm2.862-2.49-1.622-1.774c-.118-.13.148-.349.262-.224l1.623 1.775c.117.128-.15.348-.263.224Zm-.522.452-1.622-1.775c-.118-.129.148-.349.262-.223l1.623 1.774c.117.128-.15.348-.263.224Z"/></svg>`
19151
+ };
19148
19152
  const floppyDiskStarArrowRight16X16 = {
19149
19153
  name: 'floppy_disk_star_arrow_right_16_x_16',
19150
19154
  data: `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path class="cls-1" d="M5.5 2.5a1 1 0 1 0-1 1 1 1 0 0 0 1-1Zm7.5.002L9.638.819l.496 1.293H7v.828h3.134L9.638 4.18ZM12.455 5H3.583A.585.585 0 0 0 3 5.598V12.5l1.5 1.497 7.858.003a.602.602 0 0 0 .6-.6L13 5.545A.513.513 0 0 0 12.455 5ZM11 13H8v-2H6v2H5v-3h6Zm1-4H4V6h8Z"/></svg>`
@@ -22571,6 +22575,19 @@
22571
22575
  registerIcon('icon-floppy-disk-checkmark', IconFloppyDiskCheckmark);
22572
22576
  DesignSystem.tagFor(IconFloppyDiskCheckmark);
22573
22577
 
22578
+ // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
22579
+ // See generation source in nimble-components/build/generate-icons
22580
+ /**
22581
+ * The icon component for the 'floppyDiskPen' icon
22582
+ */
22583
+ class IconFloppyDiskPen extends Icon {
22584
+ constructor() {
22585
+ super(floppyDiskPen16X16);
22586
+ }
22587
+ }
22588
+ registerIcon('icon-floppy-disk-pen', IconFloppyDiskPen);
22589
+ DesignSystem.tagFor(IconFloppyDiskPen);
22590
+
22574
22591
  // AUTO-GENERATED FILE - DO NOT EDIT DIRECTLY
22575
22592
  // See generation source in nimble-components/build/generate-icons
22576
22593
  /**
@@ -68188,6 +68205,191 @@ img.ProseMirror-separator {
68188
68205
  .register(nimbleTableColumnDateText());
68189
68206
  DesignSystem.tagFor(TableColumnDateText);
68190
68207
 
68208
+ /**
68209
+ * A cell view for displaying duration fields as text
68210
+ */
68211
+ class TableColumnDurationTextCellView extends TableColumnTextCellViewBase {
68212
+ columnConfigChanged() {
68213
+ this.updateText();
68214
+ }
68215
+ cellRecordChanged() {
68216
+ this.updateText();
68217
+ }
68218
+ updateText() {
68219
+ this.text = this.columnConfig?.formatter.format(this.cellRecord?.value) ?? '';
68220
+ }
68221
+ }
68222
+ const durationTextCellView = TableColumnDurationTextCellView.compose({
68223
+ baseName: 'table-column-duration-text-cell-view',
68224
+ template: template$8,
68225
+ styles: styles$a
68226
+ });
68227
+ DesignSystem.getOrCreate()
68228
+ .withPrefix('nimble')
68229
+ .register(durationTextCellView());
68230
+ const tableColumnDurationTextCellViewTag = DesignSystem.tagFor(TableColumnDurationTextCellView);
68231
+
68232
+ /**
68233
+ * A class for formatting a numeric value in the unit of milliseconds into a display value representing its
68234
+ * days, hours, minutes, and seconds.
68235
+ */
68236
+ class DurationFormatter {
68237
+ constructor(lang) {
68238
+ this.lang = lang;
68239
+ this.daysFormatter = new Intl.NumberFormat(this.lang, {
68240
+ style: 'unit',
68241
+ unit: 'day'
68242
+ });
68243
+ this.hoursFormatter = new Intl.NumberFormat(this.lang, {
68244
+ style: 'unit',
68245
+ unit: 'hour'
68246
+ });
68247
+ this.minutesFormatter = new Intl.NumberFormat(this.lang, {
68248
+ style: 'unit',
68249
+ unit: 'minute'
68250
+ });
68251
+ this.secondsFormatter = new Intl.NumberFormat(this.lang, {
68252
+ style: 'unit',
68253
+ unit: 'second'
68254
+ });
68255
+ this.scientificSecondsFormatter = new Intl.NumberFormat(this.lang, {
68256
+ style: 'unit',
68257
+ unit: 'second',
68258
+ notation: 'scientific',
68259
+ maximumFractionDigits: 3
68260
+ });
68261
+ }
68262
+ format(milliseconds) {
68263
+ if (typeof milliseconds !== 'number'
68264
+ || milliseconds < 0
68265
+ || !Number.isFinite(milliseconds)) {
68266
+ return '';
68267
+ }
68268
+ const result = [];
68269
+ const millisecondsPerSecond = 1000;
68270
+ const millisecondsPerMinute = millisecondsPerSecond * 60;
68271
+ const millisecondsPerHour = millisecondsPerMinute * 60;
68272
+ const millisecondsPerDay = millisecondsPerHour * 24;
68273
+ const fractionalDays = milliseconds / millisecondsPerDay;
68274
+ const maximumDays = 999;
68275
+ let remainingTime = milliseconds;
68276
+ const days = Math.floor(fractionalDays);
68277
+ if (days <= maximumDays && days > 0) {
68278
+ const formattedDays = this.daysFormatter.format(days);
68279
+ result.push(formattedDays);
68280
+ remainingTime -= days * millisecondsPerDay;
68281
+ }
68282
+ else if (days > maximumDays) {
68283
+ return this.scientificSecondsFormatter.format(milliseconds / millisecondsPerSecond);
68284
+ }
68285
+ const hours = Math.floor((milliseconds / millisecondsPerHour) % 24);
68286
+ remainingTime -= hours * millisecondsPerHour;
68287
+ if (hours) {
68288
+ const formattedHours = this.hoursFormatter.format(hours);
68289
+ result.push(formattedHours);
68290
+ }
68291
+ const minutes = Math.floor((milliseconds / millisecondsPerMinute) % 60);
68292
+ remainingTime -= minutes * millisecondsPerMinute;
68293
+ if (minutes) {
68294
+ const formattedMinutes = this.minutesFormatter.format(minutes);
68295
+ result.push(formattedMinutes);
68296
+ }
68297
+ const valueInSeconds = remainingTime / millisecondsPerSecond;
68298
+ // if -0, coerce to 0
68299
+ const seconds = valueInSeconds === 0 ? 0 : valueInSeconds % 60;
68300
+ if (milliseconds < 1 && valueInSeconds !== 0) {
68301
+ return this.scientificSecondsFormatter.format(valueInSeconds);
68302
+ }
68303
+ if (seconds >= 0.0005 || (seconds === 0 && result.length === 0)) {
68304
+ const formattedSeconds = this.secondsFormatter.format(seconds);
68305
+ result.push(formattedSeconds);
68306
+ }
68307
+ return result.join(', ');
68308
+ }
68309
+ }
68310
+
68311
+ /**
68312
+ * The group header view for displaying duration fields as text.
68313
+ */
68314
+ class TableColumnDurationTextGroupHeaderView extends TableColumnTextGroupHeaderViewBase {
68315
+ columnConfigChanged() {
68316
+ this.updateText();
68317
+ }
68318
+ groupHeaderValueChanged() {
68319
+ this.updateText();
68320
+ }
68321
+ updateText() {
68322
+ if (this.columnConfig) {
68323
+ this.text = this.columnConfig.formatter.format(this.groupHeaderValue);
68324
+ }
68325
+ else {
68326
+ this.text = '';
68327
+ }
68328
+ }
68329
+ }
68330
+ const tableColumnDurationTextGroupHeaderView = TableColumnDurationTextGroupHeaderView.compose({
68331
+ baseName: 'table-column-duration-text-group-header-view',
68332
+ template: template$9,
68333
+ styles: styles$b
68334
+ });
68335
+ DesignSystem.getOrCreate()
68336
+ .withPrefix('nimble')
68337
+ .register(tableColumnDurationTextGroupHeaderView());
68338
+ const tableColumnDurationTextGroupHeaderViewTag = DesignSystem.tagFor(TableColumnDurationTextGroupHeaderView);
68339
+
68340
+ /**
68341
+ * The table column for displaying a duration value as text.
68342
+ */
68343
+ class TableColumnDurationText extends TableColumnTextBase {
68344
+ constructor() {
68345
+ super(...arguments);
68346
+ this.langSubscriber = {
68347
+ handleChange: () => {
68348
+ this.updateColumnConfig();
68349
+ }
68350
+ };
68351
+ }
68352
+ connectedCallback() {
68353
+ super.connectedCallback();
68354
+ lang$1.subscribe(this.langSubscriber, this);
68355
+ this.updateColumnConfig();
68356
+ }
68357
+ disconnectedCallback() {
68358
+ super.disconnectedCallback();
68359
+ lang$1.unsubscribe(this.langSubscriber, this);
68360
+ }
68361
+ getColumnInternalsOptions() {
68362
+ return {
68363
+ cellRecordFieldNames: ['value'],
68364
+ cellViewTag: tableColumnDurationTextCellViewTag,
68365
+ groupHeaderViewTag: tableColumnDurationTextGroupHeaderViewTag,
68366
+ delegatedEvents: [],
68367
+ sortOperation: TableColumnSortOperation.basic
68368
+ };
68369
+ }
68370
+ updateColumnConfig() {
68371
+ const formatter = new DurationFormatter(lang$1.getValueFor(this));
68372
+ if (formatter) {
68373
+ const columnConfig = {
68374
+ formatter
68375
+ };
68376
+ this.columnInternals.columnConfig = columnConfig;
68377
+ }
68378
+ else {
68379
+ this.columnInternals.columnConfig = undefined;
68380
+ }
68381
+ }
68382
+ }
68383
+ const nimbleTableColumnDurationText = TableColumnDurationText.compose({
68384
+ baseName: 'table-column-duration-text',
68385
+ template: template$b,
68386
+ styles: styles$d
68387
+ });
68388
+ DesignSystem.getOrCreate()
68389
+ .withPrefix('nimble')
68390
+ .register(nimbleTableColumnDurationText());
68391
+ DesignSystem.tagFor(TableColumnDurationText);
68392
+
68191
68393
  /**
68192
68394
  * Converts a Mapping key (which is a string when configured in HTML) to the
68193
68395
  * given keyType. The converted value can then be used to compare against