@ni/nimble-components 35.13.2 → 35.14.0

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.
@@ -392,6 +392,89 @@
392
392
  }
393
393
  ]
394
394
  },
395
+ {
396
+ "kind": "javascript-module",
397
+ "path": "src/anchor-tab/index.ts",
398
+ "declarations": [
399
+ {
400
+ "kind": "class",
401
+ "description": "A nimble-styled link tab",
402
+ "name": "AnchorTab",
403
+ "members": [
404
+ {
405
+ "kind": "field",
406
+ "name": "disabled",
407
+ "type": {
408
+ "text": "boolean"
409
+ },
410
+ "privacy": "public",
411
+ "default": "false",
412
+ "description": "When true, the control will be immutable by user interaction. See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled | disabled HTML attribute for more information."
413
+ },
414
+ {
415
+ "kind": "field",
416
+ "name": "ariaSelected",
417
+ "type": {
418
+ "text": "string"
419
+ },
420
+ "privacy": "public",
421
+ "default": "'false'",
422
+ "description": "Indicates the current \"selected\" state of various widgets.\nhttps://www.w3.org/TR/wai-aria-1.1/#aria-selected"
423
+ }
424
+ ],
425
+ "attributes": [
426
+ {
427
+ "name": "disabled",
428
+ "type": {
429
+ "text": "boolean"
430
+ },
431
+ "default": "false",
432
+ "description": "When true, the control will be immutable by user interaction. See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled | disabled HTML attribute for more information.",
433
+ "fieldName": "disabled"
434
+ },
435
+ {
436
+ "name": "aria-selected",
437
+ "type": {
438
+ "text": "string"
439
+ },
440
+ "default": "'false'",
441
+ "description": "Indicates the current \"selected\" state of various widgets.\nhttps://www.w3.org/TR/wai-aria-1.1/#aria-selected",
442
+ "fieldName": "ariaSelected"
443
+ }
444
+ ],
445
+ "superclass": {
446
+ "name": "AnchorBase",
447
+ "module": "/src/anchor-base"
448
+ }
449
+ },
450
+ {
451
+ "kind": "variable",
452
+ "name": "anchorTabTag",
453
+ "type": {
454
+ "text": "string"
455
+ },
456
+ "default": "'nimble-anchor-tab'"
457
+ }
458
+ ],
459
+ "exports": [
460
+ {
461
+ "kind": "js",
462
+ "name": "AnchorTab",
463
+ "declaration": {
464
+ "name": "AnchorTab",
465
+ "module": "src/anchor-tab/index.ts"
466
+ }
467
+ },
468
+ {
469
+ "kind": "js",
470
+ "name": "anchorTabTag",
471
+ "declaration": {
472
+ "name": "anchorTabTag",
473
+ "module": "src/anchor-tab/index.ts"
474
+ }
475
+ }
476
+ ]
477
+ },
395
478
  {
396
479
  "kind": "javascript-module",
397
480
  "path": "src/anchor-step/index.ts",
@@ -576,89 +659,6 @@
576
659
  }
577
660
  ]
578
661
  },
579
- {
580
- "kind": "javascript-module",
581
- "path": "src/anchor-tab/index.ts",
582
- "declarations": [
583
- {
584
- "kind": "class",
585
- "description": "A nimble-styled link tab",
586
- "name": "AnchorTab",
587
- "members": [
588
- {
589
- "kind": "field",
590
- "name": "disabled",
591
- "type": {
592
- "text": "boolean"
593
- },
594
- "privacy": "public",
595
- "default": "false",
596
- "description": "When true, the control will be immutable by user interaction. See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled | disabled HTML attribute for more information."
597
- },
598
- {
599
- "kind": "field",
600
- "name": "ariaSelected",
601
- "type": {
602
- "text": "string"
603
- },
604
- "privacy": "public",
605
- "default": "'false'",
606
- "description": "Indicates the current \"selected\" state of various widgets.\nhttps://www.w3.org/TR/wai-aria-1.1/#aria-selected"
607
- }
608
- ],
609
- "attributes": [
610
- {
611
- "name": "disabled",
612
- "type": {
613
- "text": "boolean"
614
- },
615
- "default": "false",
616
- "description": "When true, the control will be immutable by user interaction. See https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled | disabled HTML attribute for more information.",
617
- "fieldName": "disabled"
618
- },
619
- {
620
- "name": "aria-selected",
621
- "type": {
622
- "text": "string"
623
- },
624
- "default": "'false'",
625
- "description": "Indicates the current \"selected\" state of various widgets.\nhttps://www.w3.org/TR/wai-aria-1.1/#aria-selected",
626
- "fieldName": "ariaSelected"
627
- }
628
- ],
629
- "superclass": {
630
- "name": "AnchorBase",
631
- "module": "/src/anchor-base"
632
- }
633
- },
634
- {
635
- "kind": "variable",
636
- "name": "anchorTabTag",
637
- "type": {
638
- "text": "string"
639
- },
640
- "default": "'nimble-anchor-tab'"
641
- }
642
- ],
643
- "exports": [
644
- {
645
- "kind": "js",
646
- "name": "AnchorTab",
647
- "declaration": {
648
- "name": "AnchorTab",
649
- "module": "src/anchor-tab/index.ts"
650
- }
651
- },
652
- {
653
- "kind": "js",
654
- "name": "anchorTabTag",
655
- "declaration": {
656
- "name": "anchorTabTag",
657
- "module": "src/anchor-tab/index.ts"
658
- }
659
- }
660
- ]
661
- },
662
662
  {
663
663
  "kind": "javascript-module",
664
664
  "path": "src/anchor-tabs/index.ts",
@@ -13867,7 +13867,7 @@
13867
13867
  "privacy": "private",
13868
13868
  "return": {
13869
13869
  "type": {
13870
- "text": "Intl.DateTimeFormat | undefined"
13870
+ "text": "DateTextFormatter | undefined"
13871
13871
  }
13872
13872
  }
13873
13873
  },
@@ -13877,7 +13877,7 @@
13877
13877
  "privacy": "private",
13878
13878
  "return": {
13879
13879
  "type": {
13880
- "text": "Intl.DateTimeFormatOptions"
13880
+ "text": "SupportedIntlDateTimeFormatOptions"
13881
13881
  }
13882
13882
  }
13883
13883
  }
@@ -14078,6 +14078,15 @@
14078
14078
  },
14079
14079
  "default": "{ default: undefined, custom: 'custom' }",
14080
14080
  "description": "Formatting scheme for the date-text table column"
14081
+ },
14082
+ {
14083
+ "kind": "variable",
14084
+ "name": "supportedIntlDateTimeFormatOptionNames",
14085
+ "type": {
14086
+ "text": "[\n 'localeMatcher',\n 'weekday',\n 'era',\n 'year',\n 'month',\n 'day',\n 'hour',\n 'minute',\n 'second',\n 'dayPeriod',\n 'timeZoneName',\n 'formatMatcher',\n 'hour12',\n 'timeZone',\n 'calendar',\n 'numberingSystem',\n 'dateStyle',\n 'timeStyle',\n 'hourCycle'\n]"
14087
+ },
14088
+ "default": "[ 'localeMatcher', 'weekday', 'era', 'year', 'month', 'day', 'hour', 'minute', 'second', 'dayPeriod', 'timeZoneName', 'formatMatcher', 'hour12', 'timeZone', 'calendar', 'numberingSystem', 'dateStyle', 'timeStyle', 'hourCycle' ]",
14089
+ "description": "The `Intl.DateTimeFormatOptions` properties supported by the date-text column and `DateTextFormatter`."
14081
14090
  }
14082
14091
  ],
14083
14092
  "exports": [
@@ -14088,6 +14097,14 @@
14088
14097
  "name": "DateTextFormat",
14089
14098
  "module": "src/table-column/date-text/types.ts"
14090
14099
  }
14100
+ },
14101
+ {
14102
+ "kind": "js",
14103
+ "name": "supportedIntlDateTimeFormatOptionNames",
14104
+ "declaration": {
14105
+ "name": "supportedIntlDateTimeFormatOptionNames",
14106
+ "module": "src/table-column/date-text/types.ts"
14107
+ }
14091
14108
  }
14092
14109
  ]
14093
14110
  },
@@ -19354,12 +19371,12 @@
19354
19371
  },
19355
19372
  {
19356
19373
  "kind": "javascript-module",
19357
- "path": "src/table-column/duration-text/cell-view/index.ts",
19374
+ "path": "src/table-column/date-text/cell-view/index.ts",
19358
19375
  "declarations": [
19359
19376
  {
19360
19377
  "kind": "class",
19361
- "description": "A cell view for displaying duration fields as text",
19362
- "name": "TableColumnDurationTextCellView",
19378
+ "description": "A cell view for displaying date/time fields as text",
19379
+ "name": "TableColumnDateTextCellView",
19363
19380
  "members": [
19364
19381
  {
19365
19382
  "kind": "method",
@@ -19568,28 +19585,28 @@
19568
19585
  },
19569
19586
  {
19570
19587
  "kind": "variable",
19571
- "name": "tableColumnDurationTextCellViewTag",
19588
+ "name": "tableColumnDateTextCellViewTag",
19572
19589
  "type": {
19573
19590
  "text": "string"
19574
19591
  },
19575
- "default": "'nimble-table-column-duration-text-cell-view'"
19592
+ "default": "'nimble-table-column-date-text-cell-view'"
19576
19593
  }
19577
19594
  ],
19578
19595
  "exports": [
19579
19596
  {
19580
19597
  "kind": "js",
19581
- "name": "TableColumnDurationTextCellView",
19598
+ "name": "TableColumnDateTextCellView",
19582
19599
  "declaration": {
19583
- "name": "TableColumnDurationTextCellView",
19584
- "module": "src/table-column/duration-text/cell-view/index.ts"
19600
+ "name": "TableColumnDateTextCellView",
19601
+ "module": "src/table-column/date-text/cell-view/index.ts"
19585
19602
  }
19586
19603
  },
19587
19604
  {
19588
19605
  "kind": "js",
19589
- "name": "tableColumnDurationTextCellViewTag",
19606
+ "name": "tableColumnDateTextCellViewTag",
19590
19607
  "declaration": {
19591
- "name": "tableColumnDurationTextCellViewTag",
19592
- "module": "src/table-column/duration-text/cell-view/index.ts"
19608
+ "name": "tableColumnDateTextCellViewTag",
19609
+ "module": "src/table-column/date-text/cell-view/index.ts"
19593
19610
  }
19594
19611
  }
19595
19612
  ]
@@ -19758,12 +19775,12 @@
19758
19775
  },
19759
19776
  {
19760
19777
  "kind": "javascript-module",
19761
- "path": "src/table-column/date-text/cell-view/index.ts",
19778
+ "path": "src/table-column/duration-text/cell-view/index.ts",
19762
19779
  "declarations": [
19763
19780
  {
19764
19781
  "kind": "class",
19765
- "description": "A cell view for displaying date/time fields as text",
19766
- "name": "TableColumnDateTextCellView",
19782
+ "description": "A cell view for displaying duration fields as text",
19783
+ "name": "TableColumnDurationTextCellView",
19767
19784
  "members": [
19768
19785
  {
19769
19786
  "kind": "method",
@@ -19972,28 +19989,28 @@
19972
19989
  },
19973
19990
  {
19974
19991
  "kind": "variable",
19975
- "name": "tableColumnDateTextCellViewTag",
19992
+ "name": "tableColumnDurationTextCellViewTag",
19976
19993
  "type": {
19977
19994
  "text": "string"
19978
19995
  },
19979
- "default": "'nimble-table-column-date-text-cell-view'"
19996
+ "default": "'nimble-table-column-duration-text-cell-view'"
19980
19997
  }
19981
19998
  ],
19982
19999
  "exports": [
19983
20000
  {
19984
20001
  "kind": "js",
19985
- "name": "TableColumnDateTextCellView",
20002
+ "name": "TableColumnDurationTextCellView",
19986
20003
  "declaration": {
19987
- "name": "TableColumnDateTextCellView",
19988
- "module": "src/table-column/date-text/cell-view/index.ts"
20004
+ "name": "TableColumnDurationTextCellView",
20005
+ "module": "src/table-column/duration-text/cell-view/index.ts"
19989
20006
  }
19990
20007
  },
19991
20008
  {
19992
20009
  "kind": "js",
19993
- "name": "tableColumnDateTextCellViewTag",
20010
+ "name": "tableColumnDurationTextCellViewTag",
19994
20011
  "declaration": {
19995
- "name": "tableColumnDateTextCellViewTag",
19996
- "module": "src/table-column/date-text/cell-view/index.ts"
20012
+ "name": "tableColumnDurationTextCellViewTag",
20013
+ "module": "src/table-column/duration-text/cell-view/index.ts"
19997
20014
  }
19998
20015
  }
19999
20016
  ]
@@ -93,6 +93,30 @@
93
93
 
94
94
  <hr/>
95
95
 
96
+ ## class: `AnchorTab`
97
+
98
+ ### Superclass
99
+
100
+ | Name | Module | Package |
101
+ | ------------ | ---------------- | ------- |
102
+ | `AnchorBase` | /src/anchor-base | |
103
+
104
+ ### Fields
105
+
106
+ | Name | Privacy | Type | Default | Description | Inherited From |
107
+ | -------------- | ------- | --------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- |
108
+ | `disabled` | public | `boolean` | `false` | When true, the control will be immutable by user interaction. See https\://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled \| disabled HTML attribute for more information. | |
109
+ | `ariaSelected` | public | `string` | `'false'` | Indicates the current "selected" state of various widgets.&#xA;https\://www\.w3.org/TR/wai-aria-1.1/#aria-selected | |
110
+
111
+ ### Attributes
112
+
113
+ | Name | Field | Inherited From |
114
+ | --------------- | ------------ | -------------- |
115
+ | `disabled` | disabled | |
116
+ | `aria-selected` | ariaSelected | |
117
+
118
+ <hr/>
119
+
96
120
  ## class: `AnchorStep`
97
121
 
98
122
  ### Superclass
@@ -125,30 +149,6 @@
125
149
 
126
150
  <hr/>
127
151
 
128
- ## class: `AnchorTab`
129
-
130
- ### Superclass
131
-
132
- | Name | Module | Package |
133
- | ------------ | ---------------- | ------- |
134
- | `AnchorBase` | /src/anchor-base | |
135
-
136
- ### Fields
137
-
138
- | Name | Privacy | Type | Default | Description | Inherited From |
139
- | -------------- | ------- | --------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- |
140
- | `disabled` | public | `boolean` | `false` | When true, the control will be immutable by user interaction. See https\://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/disabled \| disabled HTML attribute for more information. | |
141
- | `ariaSelected` | public | `string` | `'false'` | Indicates the current "selected" state of various widgets.&#xA;https\://www\.w3.org/TR/wai-aria-1.1/#aria-selected | |
142
-
143
- ### Attributes
144
-
145
- | Name | Field | Inherited From |
146
- | --------------- | ------------ | -------------- |
147
- | `disabled` | disabled | |
148
- | `aria-selected` | ariaSelected | |
149
-
150
- <hr/>
151
-
152
152
  ## class: `AnchorTabs`
153
153
 
154
154
  ### Superclass
@@ -2616,7 +2616,7 @@
2616
2616
 
2617
2617
  <hr/>
2618
2618
 
2619
- ## class: `TableColumnDurationTextCellView`
2619
+ ## class: `TableColumnDateTextCellView`
2620
2620
 
2621
2621
  ### Superclass
2622
2622
 
@@ -2671,7 +2671,7 @@
2671
2671
 
2672
2672
  <hr/>
2673
2673
 
2674
- ## class: `TableColumnDateTextCellView`
2674
+ ## class: `TableColumnDurationTextCellView`
2675
2675
 
2676
2676
  ### Superclass
2677
2677
 
@@ -2,14 +2,13 @@ import { DesignSystem } from '@ni/fast-foundation';
2
2
  import { template } from '../../text-base/cell-view/template';
3
3
  import { styles } from '../../text-base/cell-view/styles';
4
4
  import { TableColumnTextCellViewBase } from '../../text-base/cell-view';
5
- import { formatNumericDate } from '../models/format-helper';
6
5
  /**
7
6
  * A cell view for displaying date/time fields as text
8
7
  */
9
8
  export class TableColumnDateTextCellView extends TableColumnTextCellViewBase {
10
9
  updateText() {
11
10
  if (this.columnConfig) {
12
- this.text = formatNumericDate(this.columnConfig.formatter, this.cellRecord?.value);
11
+ this.text = this.columnConfig.formatter.format(this.cellRecord?.value);
13
12
  }
14
13
  else {
15
14
  this.text = '';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/table-column/date-text/cell-view/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAK9D,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAQ5D;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,2BAGhD;IACa,UAAU;QAChB,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CACzB,IAAI,CAAC,YAAY,CAAC,SAAS,EAC3B,IAAI,CAAC,UAAU,EAAE,KAAK,CACzB,CAAC;QACN,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACnB,CAAC;IACL,CAAC;CACJ;AAED,MAAM,gBAAgB,GAAG,2BAA2B,CAAC,OAAO,CAAC;IACzD,QAAQ,EAAE,kCAAkC;IAC5C,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AACH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,8BAA8B,GAAG,yCAAyC,CAAC","sourcesContent":["import { DesignSystem } from '@ni/fast-foundation';\nimport { template } from '../../text-base/cell-view/template';\nimport type {\n TableColumnDateTextCellRecord,\n TableColumnDateTextColumnConfig\n} from '..';\nimport { styles } from '../../text-base/cell-view/styles';\nimport { TableColumnTextCellViewBase } from '../../text-base/cell-view';\nimport { formatNumericDate } from '../models/format-helper';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-table-column-date-text-cell-view': TableColumnDateTextCellView;\n }\n}\n\n/**\n * A cell view for displaying date/time fields as text\n */\nexport class TableColumnDateTextCellView extends TableColumnTextCellViewBase<\n TableColumnDateTextCellRecord,\n TableColumnDateTextColumnConfig\n> {\n protected updateText(): void {\n if (this.columnConfig) {\n this.text = formatNumericDate(\n this.columnConfig.formatter,\n this.cellRecord?.value\n );\n } else {\n this.text = '';\n }\n }\n}\n\nconst dateTextCellView = TableColumnDateTextCellView.compose({\n baseName: 'table-column-date-text-cell-view',\n template,\n styles\n});\nDesignSystem.getOrCreate().withPrefix('nimble').register(dateTextCellView());\nexport const tableColumnDateTextCellViewTag = 'nimble-table-column-date-text-cell-view';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/table-column/date-text/cell-view/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAK9D,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAQxE;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,2BAGhD;IACa,UAAU;QAChB,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;QAC3E,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACnB,CAAC;IACL,CAAC;CACJ;AAED,MAAM,gBAAgB,GAAG,2BAA2B,CAAC,OAAO,CAAC;IACzD,QAAQ,EAAE,kCAAkC;IAC5C,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AACH,YAAY,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,8BAA8B,GAAG,yCAAyC,CAAC","sourcesContent":["import { DesignSystem } from '@ni/fast-foundation';\nimport { template } from '../../text-base/cell-view/template';\nimport type {\n TableColumnDateTextCellRecord,\n TableColumnDateTextColumnConfig\n} from '..';\nimport { styles } from '../../text-base/cell-view/styles';\nimport { TableColumnTextCellViewBase } from '../../text-base/cell-view';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-table-column-date-text-cell-view': TableColumnDateTextCellView;\n }\n}\n\n/**\n * A cell view for displaying date/time fields as text\n */\nexport class TableColumnDateTextCellView extends TableColumnTextCellViewBase<\n TableColumnDateTextCellRecord,\n TableColumnDateTextColumnConfig\n> {\n protected updateText(): void {\n if (this.columnConfig) {\n this.text = this.columnConfig.formatter.format(this.cellRecord?.value);\n } else {\n this.text = '';\n }\n }\n}\n\nconst dateTextCellView = TableColumnDateTextCellView.compose({\n baseName: 'table-column-date-text-cell-view',\n template,\n styles\n});\nDesignSystem.getOrCreate().withPrefix('nimble').register(dateTextCellView());\nexport const tableColumnDateTextCellViewTag = 'nimble-table-column-date-text-cell-view';\n"]}
@@ -2,14 +2,13 @@ import { DesignSystem } from '@ni/fast-foundation';
2
2
  import { TableColumnTextGroupHeaderViewBase } from '../../text-base/group-header-view';
3
3
  import { template } from '../../text-base/group-header-view/template';
4
4
  import { styles } from '../../text-base/group-header-view/styles';
5
- import { formatNumericDate } from '../models/format-helper';
6
5
  /**
7
6
  * The group header view for displaying date/time fields as text.
8
7
  */
9
8
  export class TableColumnDateTextGroupHeaderView extends TableColumnTextGroupHeaderViewBase {
10
9
  updateText() {
11
10
  if (this.columnConfig) {
12
- this.text = formatNumericDate(this.columnConfig.formatter, this.groupHeaderValue);
11
+ this.text = this.columnConfig.formatter.format(this.groupHeaderValue);
13
12
  }
14
13
  else {
15
14
  this.text = '';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/table-column/date-text/group-header-view/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,kCAAkC,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,4CAA4C,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAO5D;;GAEG;AACH,MAAM,OAAO,kCAAmC,SAAQ,kCAGvD;IACa,UAAU;QAChB,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CACzB,IAAI,CAAC,YAAY,CAAC,SAAS,EAC3B,IAAI,CAAC,gBAAgB,CACxB,CAAC;QACN,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACnB,CAAC;IACL,CAAC;CACJ;AAED,MAAM,kCAAkC,GAAG,kCAAkC,CAAC,OAAO,CAAC;IAClF,QAAQ,EAAE,0CAA0C;IACpD,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AACH,YAAY,CAAC,WAAW,EAAE;KACrB,UAAU,CAAC,QAAQ,CAAC;KACpB,QAAQ,CAAC,kCAAkC,EAAE,CAAC,CAAC;AACpD,MAAM,CAAC,MAAM,qCAAqC,GAAG,iDAAiD,CAAC","sourcesContent":["import { DesignSystem } from '@ni/fast-foundation';\nimport type { TableNumberFieldValue } from '../../../table/types';\nimport { TableColumnTextGroupHeaderViewBase } from '../../text-base/group-header-view';\nimport { template } from '../../text-base/group-header-view/template';\nimport { styles } from '../../text-base/group-header-view/styles';\nimport type { TableColumnDateTextColumnConfig } from '..';\nimport { formatNumericDate } from '../models/format-helper';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-table-column-date-text-group-header': TableColumnDateTextGroupHeaderView;\n }\n}\n/**\n * The group header view for displaying date/time fields as text.\n */\nexport class TableColumnDateTextGroupHeaderView extends TableColumnTextGroupHeaderViewBase<\n TableNumberFieldValue,\n TableColumnDateTextColumnConfig\n> {\n protected updateText(): void {\n if (this.columnConfig) {\n this.text = formatNumericDate(\n this.columnConfig.formatter,\n this.groupHeaderValue\n );\n } else {\n this.text = '';\n }\n }\n}\n\nconst tableColumnDateTextGroupHeaderView = TableColumnDateTextGroupHeaderView.compose({\n baseName: 'table-column-date-text-group-header-view',\n template,\n styles\n});\nDesignSystem.getOrCreate()\n .withPrefix('nimble')\n .register(tableColumnDateTextGroupHeaderView());\nexport const tableColumnDateTextGroupHeaderViewTag = 'nimble-table-column-date-text-group-header-view';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/table-column/date-text/group-header-view/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,OAAO,EAAE,kCAAkC,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EAAE,QAAQ,EAAE,MAAM,4CAA4C,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,MAAM,0CAA0C,CAAC;AAQlE;;GAEG;AACH,MAAM,OAAO,kCAAmC,SAAQ,kCAGvD;IACa,UAAU;QAChB,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QAC1E,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;QACnB,CAAC;IACL,CAAC;CACJ;AAED,MAAM,kCAAkC,GAAG,kCAAkC,CAAC,OAAO,CAAC;IAClF,QAAQ,EAAE,0CAA0C;IACpD,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AACH,YAAY,CAAC,WAAW,EAAE;KACrB,UAAU,CAAC,QAAQ,CAAC;KACpB,QAAQ,CAAC,kCAAkC,EAAE,CAAC,CAAC;AACpD,MAAM,CAAC,MAAM,qCAAqC,GAAG,iDAAiD,CAAC","sourcesContent":["import { DesignSystem } from '@ni/fast-foundation';\nimport type { TableNumberFieldValue } from '../../../table/types';\nimport { TableColumnTextGroupHeaderViewBase } from '../../text-base/group-header-view';\nimport { template } from '../../text-base/group-header-view/template';\nimport { styles } from '../../text-base/group-header-view/styles';\nimport type { TableColumnDateTextColumnConfig } from '..';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-table-column-date-text-group-header': TableColumnDateTextGroupHeaderView;\n }\n}\n/**\n * The group header view for displaying date/time fields as text.\n */\nexport class TableColumnDateTextGroupHeaderView extends TableColumnTextGroupHeaderViewBase<\n TableNumberFieldValue,\n TableColumnDateTextColumnConfig\n> {\n protected updateText(): void {\n if (this.columnConfig) {\n this.text = this.columnConfig.formatter.format(this.groupHeaderValue);\n } else {\n this.text = '';\n }\n }\n}\n\nconst tableColumnDateTextGroupHeaderView = TableColumnDateTextGroupHeaderView.compose({\n baseName: 'table-column-date-text-group-header-view',\n template,\n styles\n});\nDesignSystem.getOrCreate()\n .withPrefix('nimble')\n .register(tableColumnDateTextGroupHeaderView());\nexport const tableColumnDateTextGroupHeaderViewTag = 'nimble-table-column-date-text-group-header-view';\n"]}
@@ -5,9 +5,10 @@ import { DateTextFormat } from './types';
5
5
  import type { LocaleMatcherAlgorithm, EraFormat, YearFormat, DayFormat, HourFormat, MinuteFormat, SecondFormat, TimeZoneNameFormat, FormatMatcherAlgorithm, DayPeriodFormat, DateStyle, TimeStyle, HourCycleFormat, MonthFormat, WeekdayFormat } from './types';
6
6
  import { TableColumnDateTextValidator } from './models/table-column-date-text-validator';
7
7
  import type { TableColumnTextBaseColumnConfig } from '../text-base/cell-view';
8
+ import { DateTextFormatter } from './models/date-text-formatter';
8
9
  export type TableColumnDateTextCellRecord = TableNumberField<'value'>;
9
10
  export interface TableColumnDateTextColumnConfig extends TableColumnTextBaseColumnConfig {
10
- formatter: Intl.DateTimeFormat;
11
+ formatter: DateTextFormatter;
11
12
  }
12
13
  declare global {
13
14
  interface HTMLElementTagNameMap {
@@ -11,6 +11,7 @@ import { DateTextFormat } from './types';
11
11
  import { TableColumnDateTextValidator } from './models/table-column-date-text-validator';
12
12
  import { lang } from '../../theme-provider';
13
13
  import { optionalBooleanConverter } from '../../utilities/models/converter';
14
+ import { DateTextFormatter } from './models/date-text-formatter';
14
15
  /**
15
16
  * The table column for displaying dates/times as text.
16
17
  */
@@ -121,18 +122,11 @@ export class TableColumnDateText extends mixinTextBase((TableColumnTextBase)) {
121
122
  }
122
123
  }
123
124
  createFormatter() {
124
- let options;
125
- if (this.format === DateTextFormat.default) {
126
- options = {
127
- dateStyle: 'medium',
128
- timeStyle: 'medium'
129
- };
130
- }
131
- else {
132
- options = this.getCustomFormattingOptions();
133
- }
125
+ const options = this.format === DateTextFormat.default
126
+ ? undefined
127
+ : this.getCustomFormattingOptions();
134
128
  try {
135
- return new Intl.DateTimeFormat(lang.getValueFor(this), options);
129
+ return new DateTextFormatter(lang.getValueFor(this), options);
136
130
  }
137
131
  catch (_e) {
138
132
  return undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/table-column/date-text/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAA8B,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAE7D,OAAO,EAAE,cAAc,EAAE,MA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C;yDACH;AAG3B;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;yDACH;AAG3B;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;+DACC;AAGvC;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;gEACM;AAM5C;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,wBAAwB,EAAE,CAAC;yDAC5C;AAGvB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;2DACT;AAGxB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;2DACR;AAGxB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;4DACD;AAGjC;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,yBAAyB,EAAE,CAAC;kEACT;AAG/B;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;4DACP;AAG3B;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;4DACP;AAG3B;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;4DACD;AAgL5C,MAAM,yBAAyB,GAAG,mBAAmB,CAAC,OAAO,CAAC;IAC1D,QAAQ,EAAE,wBAAwB;IAClC,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE;KACrB,UAAU,CAAC,QAAQ,CAAC;KACpB,QAAQ,CAAC,yBAAyB,EAAE,CAAC,CAAC;AAC3C,MAAM,CAAC,MAAM,sBAAsB,GAAG,+BAA+B,CAAC","sourcesContent":["import { DesignSystem, type DesignTokenSubscriber } from '@ni/fast-foundation';\nimport { attr } from '@ni/fast-element';\nimport { styles } from '../base/styles';\nimport { template } from '../base/template';\nimport type { TableNumberField } from '../../table/types';\nimport { TableColumnTextBase, mixinTextBase } from '../text-base';\nimport { TableColumnSortOperation } from '../base/types';\nimport { tableColumnDateTextGroupHeaderViewTag } from './group-header-view';\nimport { tableColumnDateTextCellViewTag } from './cell-view';\nimport type { ColumnInternalsOptions } from '../base/models/column-internals';\nimport { DateTextFormat } from './types';\nimport type {\n LocaleMatcherAlgorithm,\n EraFormat,\n YearFormat,\n DayFormat,\n HourFormat,\n MinuteFormat,\n SecondFormat,\n TimeZoneNameFormat,\n FormatMatcherAlgorithm,\n DayPeriodFormat,\n DateStyle,\n TimeStyle,\n HourCycleFormat,\n MonthFormat,\n WeekdayFormat\n} from './types';\nimport { TableColumnDateTextValidator } from './models/table-column-date-text-validator';\nimport { lang } from '../../theme-provider';\nimport { optionalBooleanConverter } from '../../utilities/models/converter';\nimport type { TableColumnTextBaseColumnConfig } from '../text-base/cell-view';\n\nexport type TableColumnDateTextCellRecord = TableNumberField<'value'>;\nexport interface TableColumnDateTextColumnConfig extends TableColumnTextBaseColumnConfig {\n formatter: Intl.DateTimeFormat;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-table-column-date-text': TableColumnDateText;\n }\n}\n\n/**\n * The table column for displaying dates/times as text.\n */\nexport class TableColumnDateText extends mixinTextBase(\n TableColumnTextBase<\n TableColumnDateTextColumnConfig,\n TableColumnDateTextValidator\n >\n) {\n @attr\n public format: DateTextFormat;\n\n @attr({ attribute: 'custom-locale-matcher' })\n public customLocaleMatcher: LocaleMatcherAlgorithm;\n\n @attr({ attribute: 'custom-weekday' })\n public customWeekday: WeekdayFormat;\n\n @attr({ attribute: 'custom-era' })\n public customEra: EraFormat;\n\n @attr({ attribute: 'custom-year' })\n public customYear: YearFormat;\n\n @attr({ attribute: 'custom-month' })\n public customMonth: MonthFormat;\n\n @attr({ attribute: 'custom-day' })\n public customDay: DayFormat;\n\n @attr({ attribute: 'custom-hour' })\n public customHour: HourFormat;\n\n @attr({ attribute: 'custom-minute' })\n public customMinute: MinuteFormat;\n\n @attr({ attribute: 'custom-second' })\n public customSecond: SecondFormat;\n\n @attr({ attribute: 'custom-time-zone-name' })\n public customTimeZoneName: TimeZoneNameFormat;\n\n @attr({ attribute: 'custom-format-matcher' })\n public customFormatMatcher: FormatMatcherAlgorithm;\n\n // Later versions of FAST (than the legacy branch we're on) have a nullableBooleanConverter.\n // We should replace our converter with that one when it is available to us.\n // See issue related to adopting FastElement 2.0: https://github.com/ni/nimble/issues/572\n @attr({ attribute: 'custom-hour12', converter: optionalBooleanConverter })\n public customHour12?: boolean;\n\n @attr({ attribute: 'custom-time-zone' })\n public customTimeZone?: string;\n\n @attr({ attribute: 'custom-calendar' })\n public customCalendar?: string;\n\n @attr({ attribute: 'custom-day-period' })\n public customDayPeriod: DayPeriodFormat;\n\n @attr({ attribute: 'custom-numbering-system' })\n public customNumberingSystem?: string;\n\n @attr({ attribute: 'custom-date-style' })\n public customDateStyle: DateStyle;\n\n @attr({ attribute: 'custom-time-style' })\n public customTimeStyle: TimeStyle;\n\n @attr({ attribute: 'custom-hour-cycle' })\n public customHourCycle: HourCycleFormat;\n\n private readonly langSubscriber: DesignTokenSubscriber<typeof lang> = {\n handleChange: () => {\n this.updateColumnConfig();\n }\n };\n\n public override connectedCallback(): void {\n super.connectedCallback();\n lang.subscribe(this.langSubscriber, this);\n this.updateColumnConfig();\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n lang.unsubscribe(this.langSubscriber, this);\n }\n\n public placeholderChanged(): void {\n this.updateColumnConfig();\n }\n\n protected override getColumnInternalsOptions(): ColumnInternalsOptions<TableColumnDateTextValidator> {\n return {\n cellRecordFieldNames: ['value'],\n cellViewTag: tableColumnDateTextCellViewTag,\n groupHeaderViewTag: tableColumnDateTextGroupHeaderViewTag,\n delegatedEvents: [],\n sortOperation: TableColumnSortOperation.basic,\n validator: new TableColumnDateTextValidator()\n };\n }\n\n protected formatChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customLocaleMatcherChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customWeekdayChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customEraChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customYearChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customMonthChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customDayChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customHourChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customMinuteChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customSecondChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customTimeZoneNameChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customFormatMatcherChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customHour12Changed(): void {\n this.updateColumnConfig();\n }\n\n protected customTimeZoneChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customCalendarChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customDayPeriodChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customNumberingSystemChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customDateStyleChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customTimeStyleChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customHourCycleChanged(): void {\n this.updateColumnConfig();\n }\n\n private updateColumnConfig(): void {\n const formatter = this.createFormatter();\n\n if (formatter) {\n const columnConfig: TableColumnDateTextColumnConfig = {\n formatter,\n placeholder: this.placeholder\n };\n this.columnInternals.columnConfig = columnConfig;\n this.columnInternals.validator.setCustomOptionsValidity(true);\n } else {\n this.columnInternals.columnConfig = undefined;\n this.columnInternals.validator.setCustomOptionsValidity(false);\n }\n }\n\n private createFormatter(): Intl.DateTimeFormat | undefined {\n let options: Intl.DateTimeFormatOptions;\n if (this.format === DateTextFormat.default) {\n options = {\n dateStyle: 'medium',\n timeStyle: 'medium'\n };\n } else {\n options = this.getCustomFormattingOptions();\n }\n try {\n return new Intl.DateTimeFormat(lang.getValueFor(this), options);\n } catch (_e) {\n return undefined;\n }\n }\n\n private getCustomFormattingOptions(): Intl.DateTimeFormatOptions {\n // There's a FAST bug (https://github.com/microsoft/fast/issues/6630) where removing\n // attributes sets their values to null instead of undefined. To work around this,\n // translate null values to undefined.\n const options: Intl.DateTimeFormatOptions = {\n localeMatcher: this.customLocaleMatcher ?? undefined,\n weekday: this.customWeekday ?? undefined,\n era: this.customEra ?? undefined,\n year: this.customYear ?? undefined,\n month: this.customMonth ?? undefined,\n day: this.customDay ?? undefined,\n hour: this.customHour ?? undefined,\n minute: this.customMinute ?? undefined,\n second: this.customSecond ?? undefined,\n timeZoneName: this.customTimeZoneName ?? undefined,\n formatMatcher: this.customFormatMatcher ?? undefined,\n hour12: this.customHour12 ?? undefined,\n timeZone: this.customTimeZone ?? undefined,\n calendar: this.customCalendar ?? undefined,\n dayPeriod: this.customDayPeriod ?? undefined,\n numberingSystem: this.customNumberingSystem ?? undefined,\n dateStyle: this.customDateStyle ?? undefined,\n timeStyle: this.customTimeStyle ?? undefined,\n hourCycle: this.customHourCycle ?? undefined\n };\n return options;\n }\n}\n\nconst nimbleTableColumnDateText = TableColumnDateText.compose({\n baseName: 'table-column-date-text',\n template,\n styles\n});\n\nDesignSystem.getOrCreate()\n .withPrefix('nimble')\n .register(nimbleTableColumnDateText());\nexport const tableColumnDateTextTag = 'nimble-table-column-date-text';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/table-column/date-text/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAA8B,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAC;AACzD,OAAO,EAAE,qCAAqC,EAAE,MAAM,qBAAqB,CAAC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AAe,EAAE,CAAC;yDACH;AAG3B;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;yDACH;AAG3B;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;+DACC;AAGvC;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,uBAAuB,EAAE,CAAC;gEACM;AAG5C;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,wBAAwB,EAAE,CAAC;yDAC5C;AAGvB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,kBAAkB,EAAE,CAAC;2DACT;AAGxB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;2DACR;AAGxB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;4DACD;AAGjC;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,yBAAyB,EAAE,CAAC;kEACT;AAG/B;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;4DACP;AAG3B;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;4DACP;AAG3B;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,mBAAmB,EAAE,CAAC;4DACD;AA0K5C,MAAM,yBAAyB,GAAG,mBAAmB,CAAC,OAAO,CAAC;IAC1D,QAAQ,EAAE,wBAAwB;IAClC,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE;KACrB,UAAU,CAAC,QAAQ,CAAC;KACpB,QAAQ,CAAC,yBAAyB,EAAE,CAAC,CAAC;AAC3C,MAAM,CAAC,MAAM,sBAAsB,GAAG,+BAA+B,CAAC","sourcesContent":["import { DesignSystem, type DesignTokenSubscriber } from '@ni/fast-foundation';\nimport { attr } from '@ni/fast-element';\nimport { styles } from '../base/styles';\nimport { template } from '../base/template';\nimport type { TableNumberField } from '../../table/types';\nimport { TableColumnTextBase, mixinTextBase } from '../text-base';\nimport { TableColumnSortOperation } from '../base/types';\nimport { tableColumnDateTextGroupHeaderViewTag } from './group-header-view';\nimport { tableColumnDateTextCellViewTag } from './cell-view';\nimport type { ColumnInternalsOptions } from '../base/models/column-internals';\nimport { DateTextFormat } from './types';\nimport type {\n LocaleMatcherAlgorithm,\n EraFormat,\n YearFormat,\n DayFormat,\n HourFormat,\n MinuteFormat,\n SecondFormat,\n TimeZoneNameFormat,\n FormatMatcherAlgorithm,\n DayPeriodFormat,\n DateStyle,\n TimeStyle,\n HourCycleFormat,\n MonthFormat,\n WeekdayFormat,\n SupportedIntlDateTimeFormatOptions,\n supportedIntlDateTimeFormatOptionNames\n} from './types';\nimport { TableColumnDateTextValidator } from './models/table-column-date-text-validator';\nimport { lang } from '../../theme-provider';\nimport { optionalBooleanConverter } from '../../utilities/models/converter';\nimport type { TableColumnTextBaseColumnConfig } from '../text-base/cell-view';\nimport { DateTextFormatter } from './models/date-text-formatter';\n\nexport type TableColumnDateTextCellRecord = TableNumberField<'value'>;\nexport interface TableColumnDateTextColumnConfig extends TableColumnTextBaseColumnConfig {\n formatter: DateTextFormatter;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-table-column-date-text': TableColumnDateText;\n }\n}\n\ntype AllSupportedIntlDateTimeFormatOptions = {\n [Key in (typeof supportedIntlDateTimeFormatOptionNames)[number]]: Intl.DateTimeFormatOptions[Key]\n};\n\n/**\n * The table column for displaying dates/times as text.\n */\nexport class TableColumnDateText extends mixinTextBase(\n TableColumnTextBase<\n TableColumnDateTextColumnConfig,\n TableColumnDateTextValidator\n >\n) {\n @attr\n public format: DateTextFormat;\n\n @attr({ attribute: 'custom-locale-matcher' })\n public customLocaleMatcher: LocaleMatcherAlgorithm;\n\n @attr({ attribute: 'custom-weekday' })\n public customWeekday: WeekdayFormat;\n\n @attr({ attribute: 'custom-era' })\n public customEra: EraFormat;\n\n @attr({ attribute: 'custom-year' })\n public customYear: YearFormat;\n\n @attr({ attribute: 'custom-month' })\n public customMonth: MonthFormat;\n\n @attr({ attribute: 'custom-day' })\n public customDay: DayFormat;\n\n @attr({ attribute: 'custom-hour' })\n public customHour: HourFormat;\n\n @attr({ attribute: 'custom-minute' })\n public customMinute: MinuteFormat;\n\n @attr({ attribute: 'custom-second' })\n public customSecond: SecondFormat;\n\n @attr({ attribute: 'custom-time-zone-name' })\n public customTimeZoneName: TimeZoneNameFormat;\n\n @attr({ attribute: 'custom-format-matcher' })\n public customFormatMatcher: FormatMatcherAlgorithm;\n\n @attr({ attribute: 'custom-hour12', converter: optionalBooleanConverter })\n public customHour12?: boolean;\n\n @attr({ attribute: 'custom-time-zone' })\n public customTimeZone?: string;\n\n @attr({ attribute: 'custom-calendar' })\n public customCalendar?: string;\n\n @attr({ attribute: 'custom-day-period' })\n public customDayPeriod: DayPeriodFormat;\n\n @attr({ attribute: 'custom-numbering-system' })\n public customNumberingSystem?: string;\n\n @attr({ attribute: 'custom-date-style' })\n public customDateStyle: DateStyle;\n\n @attr({ attribute: 'custom-time-style' })\n public customTimeStyle: TimeStyle;\n\n @attr({ attribute: 'custom-hour-cycle' })\n public customHourCycle: HourCycleFormat;\n\n private readonly langSubscriber: DesignTokenSubscriber<typeof lang> = {\n handleChange: () => {\n this.updateColumnConfig();\n }\n };\n\n public override connectedCallback(): void {\n super.connectedCallback();\n lang.subscribe(this.langSubscriber, this);\n this.updateColumnConfig();\n }\n\n public override disconnectedCallback(): void {\n super.disconnectedCallback();\n lang.unsubscribe(this.langSubscriber, this);\n }\n\n public placeholderChanged(): void {\n this.updateColumnConfig();\n }\n\n protected override getColumnInternalsOptions(): ColumnInternalsOptions<TableColumnDateTextValidator> {\n return {\n cellRecordFieldNames: ['value'],\n cellViewTag: tableColumnDateTextCellViewTag,\n groupHeaderViewTag: tableColumnDateTextGroupHeaderViewTag,\n delegatedEvents: [],\n sortOperation: TableColumnSortOperation.basic,\n validator: new TableColumnDateTextValidator()\n };\n }\n\n protected formatChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customLocaleMatcherChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customWeekdayChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customEraChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customYearChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customMonthChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customDayChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customHourChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customMinuteChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customSecondChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customTimeZoneNameChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customFormatMatcherChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customHour12Changed(): void {\n this.updateColumnConfig();\n }\n\n protected customTimeZoneChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customCalendarChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customDayPeriodChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customNumberingSystemChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customDateStyleChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customTimeStyleChanged(): void {\n this.updateColumnConfig();\n }\n\n protected customHourCycleChanged(): void {\n this.updateColumnConfig();\n }\n\n private updateColumnConfig(): void {\n const formatter = this.createFormatter();\n\n if (formatter) {\n const columnConfig: TableColumnDateTextColumnConfig = {\n formatter,\n placeholder: this.placeholder\n };\n this.columnInternals.columnConfig = columnConfig;\n this.columnInternals.validator.setCustomOptionsValidity(true);\n } else {\n this.columnInternals.columnConfig = undefined;\n this.columnInternals.validator.setCustomOptionsValidity(false);\n }\n }\n\n private createFormatter(): DateTextFormatter | undefined {\n const options = this.format === DateTextFormat.default\n ? undefined\n : this.getCustomFormattingOptions();\n try {\n return new DateTextFormatter(lang.getValueFor(this), options);\n } catch (_e) {\n return undefined;\n }\n }\n\n private getCustomFormattingOptions(): SupportedIntlDateTimeFormatOptions {\n // There's a FAST bug (https://github.com/microsoft/fast/issues/6630) where removing\n // attributes sets their values to null instead of undefined. To work around this,\n // translate null values to undefined.\n const options: AllSupportedIntlDateTimeFormatOptions = {\n localeMatcher: this.customLocaleMatcher ?? undefined,\n weekday: this.customWeekday ?? undefined,\n era: this.customEra ?? undefined,\n year: this.customYear ?? undefined,\n month: this.customMonth ?? undefined,\n day: this.customDay ?? undefined,\n hour: this.customHour ?? undefined,\n minute: this.customMinute ?? undefined,\n second: this.customSecond ?? undefined,\n timeZoneName: this.customTimeZoneName ?? undefined,\n formatMatcher: this.customFormatMatcher ?? undefined,\n hour12: this.customHour12 ?? undefined,\n timeZone: this.customTimeZone ?? undefined,\n calendar: this.customCalendar ?? undefined,\n dayPeriod: this.customDayPeriod ?? undefined,\n numberingSystem: this.customNumberingSystem ?? undefined,\n dateStyle: this.customDateStyle ?? undefined,\n timeStyle: this.customTimeStyle ?? undefined,\n hourCycle: this.customHourCycle ?? undefined\n };\n return options;\n }\n}\n\nconst nimbleTableColumnDateText = TableColumnDateText.compose({\n baseName: 'table-column-date-text',\n template,\n styles\n});\n\nDesignSystem.getOrCreate()\n .withPrefix('nimble')\n .register(nimbleTableColumnDateText());\nexport const tableColumnDateTextTag = 'nimble-table-column-date-text';\n"]}
@@ -0,0 +1,15 @@
1
+ import { type SupportedIntlDateTimeFormatOptions } from '../types';
2
+ /**
3
+ * A class for formatting date values using the provided locale and options.
4
+ */
5
+ export declare class DateTextFormatter {
6
+ private static readonly defaultOptions;
7
+ private readonly formatter;
8
+ private readonly options;
9
+ constructor(lang: string, options?: SupportedIntlDateTimeFormatOptions);
10
+ format(value: Date | number | null | undefined): string;
11
+ optionsMatch(targetOptions?: SupportedIntlDateTimeFormatOptions): boolean;
12
+ private parseValue;
13
+ private resolveOptions;
14
+ private resolveOption;
15
+ }