@ni/nimble-components 35.13.3 → 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.
- package/dist/all-components-bundle.js +89 -27
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +1193 -1187
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/custom-elements.json +126 -109
- package/dist/custom-elements.md +32 -32
- package/dist/esm/table-column/date-text/cell-view/index.js +1 -2
- package/dist/esm/table-column/date-text/cell-view/index.js.map +1 -1
- package/dist/esm/table-column/date-text/group-header-view/index.js +1 -2
- package/dist/esm/table-column/date-text/group-header-view/index.js.map +1 -1
- package/dist/esm/table-column/date-text/index.d.ts +2 -1
- package/dist/esm/table-column/date-text/index.js +5 -11
- package/dist/esm/table-column/date-text/index.js.map +1 -1
- package/dist/esm/table-column/date-text/models/date-text-formatter.d.ts +15 -0
- package/dist/esm/table-column/date-text/models/date-text-formatter.js +60 -0
- package/dist/esm/table-column/date-text/models/date-text-formatter.js.map +1 -0
- package/dist/esm/table-column/date-text/types.d.ts +5 -0
- package/dist/esm/table-column/date-text/types.js +24 -0
- package/dist/esm/table-column/date-text/types.js.map +1 -1
- package/package.json +1 -1
- package/dist/esm/table-column/date-text/models/format-helper.d.ts +0 -2
- package/dist/esm/table-column/date-text/models/format-helper.js +0 -14
- package/dist/esm/table-column/date-text/models/format-helper.js.map +0 -1
|
@@ -81798,27 +81798,13 @@ focus outline in that case.
|
|
|
81798
81798
|
return mixinGroupableColumnAPI(mixinFractionalWidthColumnAPI(mixinColumnWithPlaceholderAPI(mixinSortableColumnAPI(base))));
|
|
81799
81799
|
}
|
|
81800
81800
|
|
|
81801
|
-
function formatNumericDate(formatter, date) {
|
|
81802
|
-
if (typeof date === 'number') {
|
|
81803
|
-
try {
|
|
81804
|
-
return formatter.format(date);
|
|
81805
|
-
}
|
|
81806
|
-
catch (_e) {
|
|
81807
|
-
return '';
|
|
81808
|
-
}
|
|
81809
|
-
}
|
|
81810
|
-
else {
|
|
81811
|
-
return '';
|
|
81812
|
-
}
|
|
81813
|
-
}
|
|
81814
|
-
|
|
81815
81801
|
/**
|
|
81816
81802
|
* The group header view for displaying date/time fields as text.
|
|
81817
81803
|
*/
|
|
81818
81804
|
class TableColumnDateTextGroupHeaderView extends TableColumnTextGroupHeaderViewBase {
|
|
81819
81805
|
updateText() {
|
|
81820
81806
|
if (this.columnConfig) {
|
|
81821
|
-
this.text =
|
|
81807
|
+
this.text = this.columnConfig.formatter.format(this.groupHeaderValue);
|
|
81822
81808
|
}
|
|
81823
81809
|
else {
|
|
81824
81810
|
this.text = '';
|
|
@@ -81944,7 +81930,7 @@ focus outline in that case.
|
|
|
81944
81930
|
class TableColumnDateTextCellView extends TableColumnTextCellViewBase {
|
|
81945
81931
|
updateText() {
|
|
81946
81932
|
if (this.columnConfig) {
|
|
81947
|
-
this.text =
|
|
81933
|
+
this.text = this.columnConfig.formatter.format(this.cellRecord?.value);
|
|
81948
81934
|
}
|
|
81949
81935
|
else {
|
|
81950
81936
|
this.text = '';
|
|
@@ -81964,6 +81950,30 @@ focus outline in that case.
|
|
|
81964
81950
|
*/
|
|
81965
81951
|
const DateTextFormat = {
|
|
81966
81952
|
default: undefined};
|
|
81953
|
+
/**
|
|
81954
|
+
* The `Intl.DateTimeFormatOptions` properties supported by the date-text column and `DateTextFormatter`.
|
|
81955
|
+
*/
|
|
81956
|
+
const supportedIntlDateTimeFormatOptionNames = [
|
|
81957
|
+
'localeMatcher',
|
|
81958
|
+
'weekday',
|
|
81959
|
+
'era',
|
|
81960
|
+
'year',
|
|
81961
|
+
'month',
|
|
81962
|
+
'day',
|
|
81963
|
+
'hour',
|
|
81964
|
+
'minute',
|
|
81965
|
+
'second',
|
|
81966
|
+
'dayPeriod',
|
|
81967
|
+
'timeZoneName',
|
|
81968
|
+
'formatMatcher',
|
|
81969
|
+
'hour12',
|
|
81970
|
+
'timeZone',
|
|
81971
|
+
'calendar',
|
|
81972
|
+
'numberingSystem',
|
|
81973
|
+
'dateStyle',
|
|
81974
|
+
'timeStyle',
|
|
81975
|
+
'hourCycle'
|
|
81976
|
+
];
|
|
81967
81977
|
|
|
81968
81978
|
const dateTextValidityFlagNames = ['invalidCustomOptionsCombination'];
|
|
81969
81979
|
/**
|
|
@@ -81995,6 +82005,65 @@ focus outline in that case.
|
|
|
81995
82005
|
}
|
|
81996
82006
|
};
|
|
81997
82007
|
|
|
82008
|
+
/**
|
|
82009
|
+
* A class for formatting date values using the provided locale and options.
|
|
82010
|
+
*/
|
|
82011
|
+
class DateTextFormatter {
|
|
82012
|
+
constructor(lang, options) {
|
|
82013
|
+
this.options = this.resolveOptions(options);
|
|
82014
|
+
this.formatter = new Intl.DateTimeFormat(lang, this.options);
|
|
82015
|
+
}
|
|
82016
|
+
format(value) {
|
|
82017
|
+
const milliseconds = this.parseValue(value);
|
|
82018
|
+
if (milliseconds === undefined || !Number.isFinite(milliseconds)) {
|
|
82019
|
+
return '';
|
|
82020
|
+
}
|
|
82021
|
+
try {
|
|
82022
|
+
return this.formatter.format(milliseconds);
|
|
82023
|
+
}
|
|
82024
|
+
catch (_e) {
|
|
82025
|
+
return '';
|
|
82026
|
+
}
|
|
82027
|
+
}
|
|
82028
|
+
optionsMatch(targetOptions) {
|
|
82029
|
+
const resolvedTargetOptions = targetOptions ?? DateTextFormatter.defaultOptions;
|
|
82030
|
+
for (const name of supportedIntlDateTimeFormatOptionNames) {
|
|
82031
|
+
if (this.options[name] !== resolvedTargetOptions[name]) {
|
|
82032
|
+
return false;
|
|
82033
|
+
}
|
|
82034
|
+
}
|
|
82035
|
+
return true;
|
|
82036
|
+
}
|
|
82037
|
+
parseValue(value) {
|
|
82038
|
+
if (value instanceof Date) {
|
|
82039
|
+
return value.getTime();
|
|
82040
|
+
}
|
|
82041
|
+
if (typeof value === 'number') {
|
|
82042
|
+
return value;
|
|
82043
|
+
}
|
|
82044
|
+
return undefined;
|
|
82045
|
+
}
|
|
82046
|
+
resolveOptions(options) {
|
|
82047
|
+
if (options === undefined) {
|
|
82048
|
+
return DateTextFormatter.defaultOptions;
|
|
82049
|
+
}
|
|
82050
|
+
const supportedOptions = {};
|
|
82051
|
+
for (const name of supportedIntlDateTimeFormatOptionNames) {
|
|
82052
|
+
this.resolveOption(supportedOptions, options, name);
|
|
82053
|
+
}
|
|
82054
|
+
return supportedOptions;
|
|
82055
|
+
}
|
|
82056
|
+
resolveOption(target, source, name) {
|
|
82057
|
+
if (source[name] !== undefined) {
|
|
82058
|
+
target[name] = source[name];
|
|
82059
|
+
}
|
|
82060
|
+
}
|
|
82061
|
+
}
|
|
82062
|
+
DateTextFormatter.defaultOptions = {
|
|
82063
|
+
dateStyle: 'medium',
|
|
82064
|
+
timeStyle: 'medium'
|
|
82065
|
+
};
|
|
82066
|
+
|
|
81998
82067
|
/**
|
|
81999
82068
|
* The table column for displaying dates/times as text.
|
|
82000
82069
|
*/
|
|
@@ -82105,18 +82174,11 @@ focus outline in that case.
|
|
|
82105
82174
|
}
|
|
82106
82175
|
}
|
|
82107
82176
|
createFormatter() {
|
|
82108
|
-
|
|
82109
|
-
|
|
82110
|
-
|
|
82111
|
-
dateStyle: 'medium',
|
|
82112
|
-
timeStyle: 'medium'
|
|
82113
|
-
};
|
|
82114
|
-
}
|
|
82115
|
-
else {
|
|
82116
|
-
options = this.getCustomFormattingOptions();
|
|
82117
|
-
}
|
|
82177
|
+
const options = this.format === DateTextFormat.default
|
|
82178
|
+
? undefined
|
|
82179
|
+
: this.getCustomFormattingOptions();
|
|
82118
82180
|
try {
|
|
82119
|
-
return new
|
|
82181
|
+
return new DateTextFormatter(lang.getValueFor(this), options);
|
|
82120
82182
|
}
|
|
82121
82183
|
catch (_e) {
|
|
82122
82184
|
return undefined;
|