@ni/nimble-components 25.1.0 → 26.0.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 +175 -289
- package/dist/all-components-bundle.js.map +1 -1
- package/dist/all-components-bundle.min.js +447 -460
- package/dist/all-components-bundle.min.js.map +1 -1
- package/dist/esm/all-components.d.ts +0 -1
- package/dist/esm/all-components.js +0 -1
- package/dist/esm/all-components.js.map +1 -1
- package/dist/esm/mapping/text/index.d.ts +1 -1
- package/dist/esm/mapping/text/index.js +1 -1
- package/dist/esm/mapping/text/index.js.map +1 -1
- package/dist/esm/rich-text/editor/template.js +1 -1
- package/dist/esm/rich-text/editor/template.js.map +1 -1
- package/dist/esm/src/all-components.d.ts +0 -1
- package/dist/esm/src/mapping/text/index.d.ts +1 -1
- package/dist/esm/src/table-column/enum-base/index.d.ts +1 -1
- package/dist/esm/src/table-column/enum-base/models/table-column-enum-base-validator.d.ts +1 -1
- package/dist/esm/table/components/cell/template.js +2 -2
- package/dist/esm/table/components/cell/template.js.map +1 -1
- package/dist/esm/table/template.js +2 -2
- package/dist/esm/table/template.js.map +1 -1
- package/dist/esm/table-column/enum-base/index.d.ts +1 -1
- package/dist/esm/table-column/enum-base/index.js +1 -1
- package/dist/esm/table-column/enum-base/index.js.map +1 -1
- package/dist/esm/table-column/enum-base/models/table-column-enum-base-validator.d.ts +1 -1
- package/dist/esm/table-column/enum-base/models/table-column-enum-base-validator.js +1 -1
- package/dist/esm/table-column/enum-base/models/table-column-enum-base-validator.js.map +1 -1
- package/package.json +1 -1
- package/dist/esm/src/table-column/enum-text/cell-view/index.d.ts +0 -14
- package/dist/esm/src/table-column/enum-text/group-header-view/index.d.ts +0 -15
- package/dist/esm/src/table-column/enum-text/index.d.ts +0 -40
- package/dist/esm/src/table-column/enum-text/models/table-column-enum-text-validator.d.ts +0 -15
- package/dist/esm/table-column/enum-text/cell-view/index.d.ts +0 -14
- package/dist/esm/table-column/enum-text/cell-view/index.js +0 -29
- package/dist/esm/table-column/enum-text/cell-view/index.js.map +0 -1
- package/dist/esm/table-column/enum-text/group-header-view/index.d.ts +0 -15
- package/dist/esm/table-column/enum-text/group-header-view/index.js +0 -26
- package/dist/esm/table-column/enum-text/group-header-view/index.js.map +0 -1
- package/dist/esm/table-column/enum-text/index.d.ts +0 -40
- package/dist/esm/table-column/enum-text/index.js +0 -50
- package/dist/esm/table-column/enum-text/index.js.map +0 -1
- package/dist/esm/table-column/enum-text/models/table-column-enum-text-validator.d.ts +0 -15
- package/dist/esm/table-column/enum-text/models/table-column-enum-text-validator.js +0 -34
- package/dist/esm/table-column/enum-text/models/table-column-enum-text-validator.js.map +0 -1
|
@@ -16333,7 +16333,7 @@
|
|
|
16333
16333
|
|
|
16334
16334
|
/**
|
|
16335
16335
|
* Do not edit directly
|
|
16336
|
-
* Generated on
|
|
16336
|
+
* Generated on Mon, 22 Apr 2024 14:57:19 GMT
|
|
16337
16337
|
*/
|
|
16338
16338
|
|
|
16339
16339
|
const Information100DarkUi = "#a46eff";
|
|
@@ -24956,7 +24956,7 @@
|
|
|
24956
24956
|
|
|
24957
24957
|
/**
|
|
24958
24958
|
* Defines a mapping from one data value ('key' property) to display text ('text' property).
|
|
24959
|
-
* One or more may be added as children of a nimble-table-column-
|
|
24959
|
+
* One or more may be added as children of a nimble-table-column-icon element to define
|
|
24960
24960
|
* how a specific data value should be displayed as text in that column's cells.
|
|
24961
24961
|
*/
|
|
24962
24962
|
class MappingText extends Mapping$1 {
|
|
@@ -43861,7 +43861,7 @@ img.ProseMirror-separator {
|
|
|
43861
43861
|
${ref('mentionListbox')}
|
|
43862
43862
|
@mention-selected=${(x, c) => x.onMentionSelect(c.event)}
|
|
43863
43863
|
>
|
|
43864
|
-
${repeat(x => Array.from(x.activeMappingConfigs
|
|
43864
|
+
${repeat(x => Array.from(x.activeMappingConfigs ? x.activeMappingConfigs.values() : []), html `
|
|
43865
43865
|
<${listOptionTag} value="${x => x.mentionHref}">${x => x.displayName}</${listOptionTag}>
|
|
43866
43866
|
`, { recycle: false })}
|
|
43867
43867
|
</${richTextMentionListboxTag}>
|
|
@@ -64368,10 +64368,10 @@ img.ProseMirror-separator {
|
|
|
64368
64368
|
@toggle="${(x, c) => x.onActionMenuToggle(c.event)}"
|
|
64369
64369
|
@click="${(_, c) => c.event.stopPropagation()}"
|
|
64370
64370
|
class="action-menu"
|
|
64371
|
-
title="${x => x.actionMenuLabel
|
|
64371
|
+
title="${x => (x.actionMenuLabel ? x.actionMenuLabel : tableCellActionMenuLabel.getValueFor(x))}"
|
|
64372
64372
|
>
|
|
64373
64373
|
<${iconThreeDotsLineTag} slot="start"></${iconThreeDotsLineTag}>
|
|
64374
|
-
${x => x.actionMenuLabel
|
|
64374
|
+
${x => (x.actionMenuLabel ? x.actionMenuLabel : tableCellActionMenuLabel.getValueFor(x))}
|
|
64375
64375
|
<slot name="cellActionMenu" slot="menu"></slot>
|
|
64376
64376
|
</${menuButtonTag}>
|
|
64377
64377
|
`)}
|
|
@@ -65020,7 +65020,7 @@ img.ProseMirror-separator {
|
|
|
65020
65020
|
--ni-private-table-header-container-margin-right: ${x => x.virtualizer.headerContainerMarginRight}px;
|
|
65021
65021
|
--ni-private-table-scroll-height: ${x => x.virtualizer.scrollHeight}px;
|
|
65022
65022
|
--ni-private-table-row-container-top: ${x => x.virtualizer.rowContainerYOffset}px;
|
|
65023
|
-
--ni-private-table-row-grid-columns: ${x => x.rowGridColumns
|
|
65023
|
+
--ni-private-table-row-grid-columns: ${x => (x.rowGridColumns ? x.rowGridColumns : '')};
|
|
65024
65024
|
--ni-private-table-cursor-override: ${x => (x.layoutManager.isColumnBeingSized ? 'col-resize' : 'default')};
|
|
65025
65025
|
--ni-private-table-scrollable-min-width: ${x => x.tableScrollableMinWidth}px;
|
|
65026
65026
|
--ni-private-glass-overlay-pointer-events: ${x => (x.layoutManager.isColumnBeingSized ? 'none' : 'default')};
|
|
@@ -65038,7 +65038,7 @@ img.ProseMirror-separator {
|
|
|
65038
65038
|
<span class="checkbox-container">
|
|
65039
65039
|
<${checkboxTag}
|
|
65040
65040
|
${ref('selectionCheckbox')}
|
|
65041
|
-
class="${x => `selection-checkbox ${x.selectionMode
|
|
65041
|
+
class="${x => `selection-checkbox ${x.selectionMode ? x.selectionMode : ''}`}"
|
|
65042
65042
|
@change="${(x, c) => x.onAllRowsSelectionChange(c.event)}"
|
|
65043
65043
|
title="${x => tableSelectAllLabel.getValueFor(x)}"
|
|
65044
65044
|
aria-label="${x => tableSelectAllLabel.getValueFor(x)}"
|
|
@@ -68790,289 +68790,10 @@ img.ProseMirror-separator {
|
|
|
68790
68790
|
.withPrefix('nimble')
|
|
68791
68791
|
.register(nimbleTableColumnDurationText());
|
|
68792
68792
|
|
|
68793
|
-
/**
|
|
68794
|
-
* Converts a Mapping key (which is a string when configured in HTML) to the
|
|
68795
|
-
* given keyType. The converted value can then be used to compare against
|
|
68796
|
-
* values in the table data.
|
|
68797
|
-
*/
|
|
68798
|
-
const resolveKeyWithType = (key, keyType) => {
|
|
68799
|
-
if (keyType === 'number') {
|
|
68800
|
-
const converted = nullableNumberConverter.fromView(key);
|
|
68801
|
-
return converted === null ? undefined : converted;
|
|
68802
|
-
}
|
|
68803
|
-
if (keyType === 'boolean') {
|
|
68804
|
-
if (key === false || key === 'false') {
|
|
68805
|
-
return false;
|
|
68806
|
-
}
|
|
68807
|
-
if (key === true || key === 'true') {
|
|
68808
|
-
return true;
|
|
68809
|
-
}
|
|
68810
|
-
return undefined;
|
|
68811
|
-
}
|
|
68812
|
-
return key?.toString() ?? undefined;
|
|
68813
|
-
};
|
|
68814
|
-
|
|
68815
|
-
/**
|
|
68816
|
-
* Base class for table columns that map values to content (e.g. nimble-table-column-enum-text and nimble-table-column-icon)
|
|
68817
|
-
*/
|
|
68818
|
-
class TableColumnEnumBase extends TableColumn {
|
|
68819
|
-
constructor() {
|
|
68820
|
-
super(...arguments);
|
|
68821
|
-
/** @internal */
|
|
68822
|
-
this.mappingNotifiers = [];
|
|
68823
|
-
/** @internal */
|
|
68824
|
-
this.mappings = [];
|
|
68825
|
-
this.keyType = 'string';
|
|
68826
|
-
}
|
|
68827
|
-
/**
|
|
68828
|
-
* @internal
|
|
68829
|
-
*
|
|
68830
|
-
* Triggers a request to update the columnConfig when any observable property on
|
|
68831
|
-
* a mapping is updated.
|
|
68832
|
-
*/
|
|
68833
|
-
handleChange(source, args) {
|
|
68834
|
-
if (source instanceof Mapping$1 && typeof args === 'string') {
|
|
68835
|
-
this.updateColumnConfig();
|
|
68836
|
-
}
|
|
68837
|
-
}
|
|
68838
|
-
/**
|
|
68839
|
-
* Called when any Mapping related state has changed.
|
|
68840
|
-
*/
|
|
68841
|
-
updateColumnConfig() {
|
|
68842
|
-
this.columnInternals.validator.validate(this.mappings, this.keyType);
|
|
68843
|
-
this.columnInternals.columnConfig = this.checkValidity()
|
|
68844
|
-
? this.createColumnConfig(this.getMappingConfigs())
|
|
68845
|
-
: undefined;
|
|
68846
|
-
}
|
|
68847
|
-
getMappingConfigs() {
|
|
68848
|
-
const mappingConfigs = new Map();
|
|
68849
|
-
this.mappings.forEach(mapping => {
|
|
68850
|
-
const key = resolveKeyWithType(mapping.key, this.keyType);
|
|
68851
|
-
if (key === undefined) {
|
|
68852
|
-
throw Error('Key was invalid for type. Validation should have prevented this.');
|
|
68853
|
-
}
|
|
68854
|
-
const mappingConfig = this.createMappingConfig(mapping);
|
|
68855
|
-
mappingConfigs.set(key, mappingConfig);
|
|
68856
|
-
});
|
|
68857
|
-
return mappingConfigs;
|
|
68858
|
-
}
|
|
68859
|
-
fieldNameChanged() {
|
|
68860
|
-
this.columnInternals.dataRecordFieldNames = [this.fieldName];
|
|
68861
|
-
this.columnInternals.operandDataRecordFieldName = this.fieldName;
|
|
68862
|
-
}
|
|
68863
|
-
mappingsChanged() {
|
|
68864
|
-
this.updateColumnConfig();
|
|
68865
|
-
this.observeMappings();
|
|
68866
|
-
}
|
|
68867
|
-
keyTypeChanged() {
|
|
68868
|
-
this.updateColumnConfig();
|
|
68869
|
-
}
|
|
68870
|
-
removeMappingObservers() {
|
|
68871
|
-
this.mappingNotifiers.forEach(notifier => {
|
|
68872
|
-
notifier.unsubscribe(this);
|
|
68873
|
-
});
|
|
68874
|
-
this.mappingNotifiers = [];
|
|
68875
|
-
}
|
|
68876
|
-
observeMappings() {
|
|
68877
|
-
this.removeMappingObservers();
|
|
68878
|
-
for (const mapping of this.mappings) {
|
|
68879
|
-
const notifier = Observable.getNotifier(mapping);
|
|
68880
|
-
notifier.subscribe(this);
|
|
68881
|
-
this.mappingNotifiers.push(notifier);
|
|
68882
|
-
}
|
|
68883
|
-
}
|
|
68884
|
-
}
|
|
68885
|
-
__decorate$1([
|
|
68886
|
-
observable
|
|
68887
|
-
], TableColumnEnumBase.prototype, "mappings", void 0);
|
|
68888
|
-
__decorate$1([
|
|
68889
|
-
attr({ attribute: 'field-name' })
|
|
68890
|
-
], TableColumnEnumBase.prototype, "fieldName", void 0);
|
|
68891
|
-
__decorate$1([
|
|
68892
|
-
attr({ attribute: 'key-type' })
|
|
68893
|
-
], TableColumnEnumBase.prototype, "keyType", void 0);
|
|
68894
|
-
|
|
68895
|
-
const styles$a = css `
|
|
68896
|
-
${styles$e}
|
|
68897
|
-
|
|
68898
|
-
slot[name='mapping'] {
|
|
68899
|
-
display: none;
|
|
68900
|
-
}
|
|
68901
|
-
`;
|
|
68902
|
-
|
|
68903
|
-
const template$9 = html `${template$d}<slot ${slotted('mappings')} name="mapping"></slot>`;
|
|
68904
|
-
|
|
68905
|
-
const enumBaseValidityFlagNames = [
|
|
68906
|
-
'invalidMappingKeyValueForType',
|
|
68907
|
-
'duplicateMappingKey',
|
|
68908
|
-
'missingKeyValue'
|
|
68909
|
-
];
|
|
68910
|
-
/**
|
|
68911
|
-
* Validator for TableColumnEnumText. Implementations MUST include enumBaseValidityFlagNames in validity flag names set.
|
|
68912
|
-
*/
|
|
68913
|
-
class TableColumnEnumBaseValidator extends ColumnValidator {
|
|
68914
|
-
constructor(configValidityKeys) {
|
|
68915
|
-
super(configValidityKeys);
|
|
68916
|
-
}
|
|
68917
|
-
validate(mappings, keyType) {
|
|
68918
|
-
this.untrackAll();
|
|
68919
|
-
const keys = mappings.map(mapping => mapping.key);
|
|
68920
|
-
this.validateKeyValuesForType(keys, keyType);
|
|
68921
|
-
this.validateUniqueKeys(keys, keyType);
|
|
68922
|
-
this.validateNoMissingKeys(mappings);
|
|
68923
|
-
}
|
|
68924
|
-
validateKeyValuesForType(keys, keyType) {
|
|
68925
|
-
// Ignore undefined keys, because validateNoMissingKeys covers that case.
|
|
68926
|
-
// We should only set 'invalidMappingKeyValueForType' when there is a key,
|
|
68927
|
-
// but it isn't appropriate for the type.
|
|
68928
|
-
const invalid = keys.some(key => key !== undefined
|
|
68929
|
-
&& resolveKeyWithType(key, keyType) === undefined);
|
|
68930
|
-
this.setConditionValue('invalidMappingKeyValueForType', invalid);
|
|
68931
|
-
}
|
|
68932
|
-
validateUniqueKeys(keys, keyType) {
|
|
68933
|
-
const typedKeys = keys.map(x => resolveKeyWithType(x, keyType));
|
|
68934
|
-
const invalid = new Set(typedKeys).size !== typedKeys.length;
|
|
68935
|
-
this.setConditionValue('duplicateMappingKey', invalid);
|
|
68936
|
-
}
|
|
68937
|
-
validateNoMissingKeys(mappings) {
|
|
68938
|
-
const invalid = mappings.some(mapping => mapping.key === undefined);
|
|
68939
|
-
this.setConditionValue('missingKeyValue', invalid);
|
|
68940
|
-
}
|
|
68941
|
-
}
|
|
68942
|
-
|
|
68943
|
-
const enumTextValidityFlagNames = [
|
|
68944
|
-
...enumBaseValidityFlagNames,
|
|
68945
|
-
'unsupportedMappingType',
|
|
68946
|
-
'missingTextValue'
|
|
68947
|
-
];
|
|
68948
|
-
/**
|
|
68949
|
-
* Validator for TableColumnEnumText
|
|
68950
|
-
*/
|
|
68951
|
-
class TableColumnEnumTextValidator extends TableColumnEnumBaseValidator {
|
|
68952
|
-
constructor() {
|
|
68953
|
-
super(enumTextValidityFlagNames);
|
|
68954
|
-
}
|
|
68955
|
-
static isSupportedMappingElement(mapping) {
|
|
68956
|
-
return mapping instanceof MappingText;
|
|
68957
|
-
}
|
|
68958
|
-
validate(mappings, keyType) {
|
|
68959
|
-
super.validate(mappings, keyType);
|
|
68960
|
-
this.validateMappingTypes(mappings);
|
|
68961
|
-
this.validateNoMissingText(mappings);
|
|
68962
|
-
}
|
|
68963
|
-
validateNoMissingText(mappings) {
|
|
68964
|
-
const invalid = mappings
|
|
68965
|
-
.filter(TableColumnEnumTextValidator.isSupportedMappingElement)
|
|
68966
|
-
.some(mapping => mapping.text === undefined);
|
|
68967
|
-
this.setConditionValue('missingTextValue', invalid);
|
|
68968
|
-
}
|
|
68969
|
-
validateMappingTypes(mappings) {
|
|
68970
|
-
const valid = mappings.every(TableColumnEnumTextValidator.isSupportedMappingElement);
|
|
68971
|
-
this.setConditionValue('unsupportedMappingType', !valid);
|
|
68972
|
-
}
|
|
68973
|
-
}
|
|
68974
|
-
|
|
68975
|
-
/**
|
|
68976
|
-
* Common state shared across Mapping Config
|
|
68977
|
-
*/
|
|
68978
|
-
class MappingConfig {
|
|
68979
|
-
constructor(text) {
|
|
68980
|
-
this.text = text;
|
|
68981
|
-
}
|
|
68982
|
-
}
|
|
68983
|
-
|
|
68984
|
-
/**
|
|
68985
|
-
* Mapping configuration corresponding to a text mapping
|
|
68986
|
-
*/
|
|
68987
|
-
class MappingTextConfig extends MappingConfig {
|
|
68988
|
-
}
|
|
68989
|
-
|
|
68990
|
-
/**
|
|
68991
|
-
* A cell view for displaying mapped text
|
|
68992
|
-
*/
|
|
68993
|
-
class TableColumnEnumTextCellView extends TableColumnTextCellViewBase {
|
|
68994
|
-
updateText() {
|
|
68995
|
-
const value = this.cellRecord?.value;
|
|
68996
|
-
if (value === undefined || value === null) {
|
|
68997
|
-
this.text = '';
|
|
68998
|
-
return;
|
|
68999
|
-
}
|
|
69000
|
-
const config = this.columnConfig?.mappingConfigs.get(value);
|
|
69001
|
-
this.text = config instanceof MappingTextConfig && config.text
|
|
69002
|
-
? config.text
|
|
69003
|
-
: '';
|
|
69004
|
-
}
|
|
69005
|
-
}
|
|
69006
|
-
const enumTextCellView = TableColumnEnumTextCellView.compose({
|
|
69007
|
-
baseName: 'table-column-enum-text-cell-view',
|
|
69008
|
-
template: template$a,
|
|
69009
|
-
styles: styles$b
|
|
69010
|
-
});
|
|
69011
|
-
DesignSystem.getOrCreate().withPrefix('nimble').register(enumTextCellView());
|
|
69012
|
-
const tableColumnEnumTextCellViewTag = 'nimble-table-column-enum-text-cell-view';
|
|
69013
|
-
|
|
69014
|
-
/**
|
|
69015
|
-
* A group header view for enum columns
|
|
69016
|
-
*/
|
|
69017
|
-
class TableColumnEnumTextGroupHeaderView extends TableColumnTextGroupHeaderViewBase {
|
|
69018
|
-
updateText() {
|
|
69019
|
-
const config = this.columnConfig?.mappingConfigs.get(this.groupHeaderValue);
|
|
69020
|
-
this.text = config instanceof MappingTextConfig && config.text
|
|
69021
|
-
? config.text
|
|
69022
|
-
: '';
|
|
69023
|
-
}
|
|
69024
|
-
}
|
|
69025
|
-
const enumTextGroupHeaderView = TableColumnEnumTextGroupHeaderView.compose({
|
|
69026
|
-
baseName: 'table-column-enum-text-group-header-view',
|
|
69027
|
-
template: template$b,
|
|
69028
|
-
styles: styles$c
|
|
69029
|
-
});
|
|
69030
|
-
DesignSystem.getOrCreate()
|
|
69031
|
-
.withPrefix('nimble')
|
|
69032
|
-
.register(enumTextGroupHeaderView());
|
|
69033
|
-
const tableColumnEnumTextGroupHeaderViewTag = 'nimble-table-column-enum-text-group-header-view';
|
|
69034
|
-
|
|
69035
|
-
/**
|
|
69036
|
-
* Table column that maps values to strings
|
|
69037
|
-
*/
|
|
69038
|
-
class TableColumnEnumText extends mixinGroupableColumnAPI(mixinFractionalWidthColumnAPI((TableColumnEnumBase))) {
|
|
69039
|
-
getColumnInternalsOptions() {
|
|
69040
|
-
return {
|
|
69041
|
-
cellRecordFieldNames: ['value'],
|
|
69042
|
-
cellViewTag: tableColumnEnumTextCellViewTag,
|
|
69043
|
-
groupHeaderViewTag: tableColumnEnumTextGroupHeaderViewTag,
|
|
69044
|
-
delegatedEvents: [],
|
|
69045
|
-
sortOperation: TableColumnSortOperation.basic,
|
|
69046
|
-
validator: new TableColumnEnumTextValidator()
|
|
69047
|
-
};
|
|
69048
|
-
}
|
|
69049
|
-
createColumnConfig(mappingConfigs) {
|
|
69050
|
-
return {
|
|
69051
|
-
mappingConfigs
|
|
69052
|
-
};
|
|
69053
|
-
}
|
|
69054
|
-
createMappingConfig(mapping) {
|
|
69055
|
-
if (mapping instanceof MappingText) {
|
|
69056
|
-
return new MappingTextConfig(mapping.text);
|
|
69057
|
-
}
|
|
69058
|
-
// Getting here would indicate a programming error, b/c validation will prevent
|
|
69059
|
-
// this function from running when there is an unsupported mapping.
|
|
69060
|
-
throw new Error('Unsupported mapping');
|
|
69061
|
-
}
|
|
69062
|
-
}
|
|
69063
|
-
const nimbleTableColumnEnumText = TableColumnEnumText.compose({
|
|
69064
|
-
baseName: 'table-column-enum-text',
|
|
69065
|
-
template: template$9,
|
|
69066
|
-
styles: styles$a
|
|
69067
|
-
});
|
|
69068
|
-
DesignSystem.getOrCreate()
|
|
69069
|
-
.withPrefix('nimble')
|
|
69070
|
-
.register(nimbleTableColumnEnumText());
|
|
69071
|
-
|
|
69072
68793
|
// Avoiding a wrapping <template> and be careful about starting and ending whitespace
|
|
69073
68794
|
// so the template can be composed into other column header templates
|
|
69074
68795
|
// prettier-ignore
|
|
69075
|
-
const template$
|
|
68796
|
+
const template$9 = html `<span
|
|
69076
68797
|
${overflow('hasOverflow')}
|
|
69077
68798
|
class="header-content"
|
|
69078
68799
|
title=${x => (x.hasOverflow && x.headerTextContent ? x.headerTextContent : null)}
|
|
@@ -69654,13 +69375,163 @@ img.ProseMirror-separator {
|
|
|
69654
69375
|
], TableColumnNumberText.prototype, "unit", void 0);
|
|
69655
69376
|
const nimbleTableColumnNumberText = TableColumnNumberText.compose({
|
|
69656
69377
|
baseName: 'table-column-number-text',
|
|
69657
|
-
template: template$
|
|
69378
|
+
template: template$9,
|
|
69658
69379
|
styles: styles$e
|
|
69659
69380
|
});
|
|
69660
69381
|
DesignSystem.getOrCreate()
|
|
69661
69382
|
.withPrefix('nimble')
|
|
69662
69383
|
.register(nimbleTableColumnNumberText());
|
|
69663
69384
|
|
|
69385
|
+
/**
|
|
69386
|
+
* Converts a Mapping key (which is a string when configured in HTML) to the
|
|
69387
|
+
* given keyType. The converted value can then be used to compare against
|
|
69388
|
+
* values in the table data.
|
|
69389
|
+
*/
|
|
69390
|
+
const resolveKeyWithType = (key, keyType) => {
|
|
69391
|
+
if (keyType === 'number') {
|
|
69392
|
+
const converted = nullableNumberConverter.fromView(key);
|
|
69393
|
+
return converted === null ? undefined : converted;
|
|
69394
|
+
}
|
|
69395
|
+
if (keyType === 'boolean') {
|
|
69396
|
+
if (key === false || key === 'false') {
|
|
69397
|
+
return false;
|
|
69398
|
+
}
|
|
69399
|
+
if (key === true || key === 'true') {
|
|
69400
|
+
return true;
|
|
69401
|
+
}
|
|
69402
|
+
return undefined;
|
|
69403
|
+
}
|
|
69404
|
+
return key?.toString() ?? undefined;
|
|
69405
|
+
};
|
|
69406
|
+
|
|
69407
|
+
/**
|
|
69408
|
+
* Base class for table columns that map values to content
|
|
69409
|
+
*/
|
|
69410
|
+
class TableColumnEnumBase extends TableColumn {
|
|
69411
|
+
constructor() {
|
|
69412
|
+
super(...arguments);
|
|
69413
|
+
/** @internal */
|
|
69414
|
+
this.mappingNotifiers = [];
|
|
69415
|
+
/** @internal */
|
|
69416
|
+
this.mappings = [];
|
|
69417
|
+
this.keyType = 'string';
|
|
69418
|
+
}
|
|
69419
|
+
/**
|
|
69420
|
+
* @internal
|
|
69421
|
+
*
|
|
69422
|
+
* Triggers a request to update the columnConfig when any observable property on
|
|
69423
|
+
* a mapping is updated.
|
|
69424
|
+
*/
|
|
69425
|
+
handleChange(source, args) {
|
|
69426
|
+
if (source instanceof Mapping$1 && typeof args === 'string') {
|
|
69427
|
+
this.updateColumnConfig();
|
|
69428
|
+
}
|
|
69429
|
+
}
|
|
69430
|
+
/**
|
|
69431
|
+
* Called when any Mapping related state has changed.
|
|
69432
|
+
*/
|
|
69433
|
+
updateColumnConfig() {
|
|
69434
|
+
this.columnInternals.validator.validate(this.mappings, this.keyType);
|
|
69435
|
+
this.columnInternals.columnConfig = this.checkValidity()
|
|
69436
|
+
? this.createColumnConfig(this.getMappingConfigs())
|
|
69437
|
+
: undefined;
|
|
69438
|
+
}
|
|
69439
|
+
getMappingConfigs() {
|
|
69440
|
+
const mappingConfigs = new Map();
|
|
69441
|
+
this.mappings.forEach(mapping => {
|
|
69442
|
+
const key = resolveKeyWithType(mapping.key, this.keyType);
|
|
69443
|
+
if (key === undefined) {
|
|
69444
|
+
throw Error('Key was invalid for type. Validation should have prevented this.');
|
|
69445
|
+
}
|
|
69446
|
+
const mappingConfig = this.createMappingConfig(mapping);
|
|
69447
|
+
mappingConfigs.set(key, mappingConfig);
|
|
69448
|
+
});
|
|
69449
|
+
return mappingConfigs;
|
|
69450
|
+
}
|
|
69451
|
+
fieldNameChanged() {
|
|
69452
|
+
this.columnInternals.dataRecordFieldNames = [this.fieldName];
|
|
69453
|
+
this.columnInternals.operandDataRecordFieldName = this.fieldName;
|
|
69454
|
+
}
|
|
69455
|
+
mappingsChanged() {
|
|
69456
|
+
this.updateColumnConfig();
|
|
69457
|
+
this.observeMappings();
|
|
69458
|
+
}
|
|
69459
|
+
keyTypeChanged() {
|
|
69460
|
+
this.updateColumnConfig();
|
|
69461
|
+
}
|
|
69462
|
+
removeMappingObservers() {
|
|
69463
|
+
this.mappingNotifiers.forEach(notifier => {
|
|
69464
|
+
notifier.unsubscribe(this);
|
|
69465
|
+
});
|
|
69466
|
+
this.mappingNotifiers = [];
|
|
69467
|
+
}
|
|
69468
|
+
observeMappings() {
|
|
69469
|
+
this.removeMappingObservers();
|
|
69470
|
+
for (const mapping of this.mappings) {
|
|
69471
|
+
const notifier = Observable.getNotifier(mapping);
|
|
69472
|
+
notifier.subscribe(this);
|
|
69473
|
+
this.mappingNotifiers.push(notifier);
|
|
69474
|
+
}
|
|
69475
|
+
}
|
|
69476
|
+
}
|
|
69477
|
+
__decorate$1([
|
|
69478
|
+
observable
|
|
69479
|
+
], TableColumnEnumBase.prototype, "mappings", void 0);
|
|
69480
|
+
__decorate$1([
|
|
69481
|
+
attr({ attribute: 'field-name' })
|
|
69482
|
+
], TableColumnEnumBase.prototype, "fieldName", void 0);
|
|
69483
|
+
__decorate$1([
|
|
69484
|
+
attr({ attribute: 'key-type' })
|
|
69485
|
+
], TableColumnEnumBase.prototype, "keyType", void 0);
|
|
69486
|
+
|
|
69487
|
+
const styles$a = css `
|
|
69488
|
+
${styles$e}
|
|
69489
|
+
|
|
69490
|
+
slot[name='mapping'] {
|
|
69491
|
+
display: none;
|
|
69492
|
+
}
|
|
69493
|
+
`;
|
|
69494
|
+
|
|
69495
|
+
const template$8 = html `${template$d}<slot ${slotted('mappings')} name="mapping"></slot>`;
|
|
69496
|
+
|
|
69497
|
+
const enumBaseValidityFlagNames = [
|
|
69498
|
+
'invalidMappingKeyValueForType',
|
|
69499
|
+
'duplicateMappingKey',
|
|
69500
|
+
'missingKeyValue'
|
|
69501
|
+
];
|
|
69502
|
+
/**
|
|
69503
|
+
* Validator base class for table columns containing mappings. Implementations MUST include enumBaseValidityFlagNames in validity flag names set.
|
|
69504
|
+
*/
|
|
69505
|
+
class TableColumnEnumBaseValidator extends ColumnValidator {
|
|
69506
|
+
constructor(configValidityKeys) {
|
|
69507
|
+
super(configValidityKeys);
|
|
69508
|
+
}
|
|
69509
|
+
validate(mappings, keyType) {
|
|
69510
|
+
this.untrackAll();
|
|
69511
|
+
const keys = mappings.map(mapping => mapping.key);
|
|
69512
|
+
this.validateKeyValuesForType(keys, keyType);
|
|
69513
|
+
this.validateUniqueKeys(keys, keyType);
|
|
69514
|
+
this.validateNoMissingKeys(mappings);
|
|
69515
|
+
}
|
|
69516
|
+
validateKeyValuesForType(keys, keyType) {
|
|
69517
|
+
// Ignore undefined keys, because validateNoMissingKeys covers that case.
|
|
69518
|
+
// We should only set 'invalidMappingKeyValueForType' when there is a key,
|
|
69519
|
+
// but it isn't appropriate for the type.
|
|
69520
|
+
const invalid = keys.some(key => key !== undefined
|
|
69521
|
+
&& resolveKeyWithType(key, keyType) === undefined);
|
|
69522
|
+
this.setConditionValue('invalidMappingKeyValueForType', invalid);
|
|
69523
|
+
}
|
|
69524
|
+
validateUniqueKeys(keys, keyType) {
|
|
69525
|
+
const typedKeys = keys.map(x => resolveKeyWithType(x, keyType));
|
|
69526
|
+
const invalid = new Set(typedKeys).size !== typedKeys.length;
|
|
69527
|
+
this.setConditionValue('duplicateMappingKey', invalid);
|
|
69528
|
+
}
|
|
69529
|
+
validateNoMissingKeys(mappings) {
|
|
69530
|
+
const invalid = mappings.some(mapping => mapping.key === undefined);
|
|
69531
|
+
this.setConditionValue('missingKeyValue', invalid);
|
|
69532
|
+
}
|
|
69533
|
+
}
|
|
69534
|
+
|
|
69664
69535
|
const iconValidityFlagNames = [
|
|
69665
69536
|
...enumBaseValidityFlagNames,
|
|
69666
69537
|
'unsupportedMappingType',
|
|
@@ -69760,6 +69631,15 @@ img.ProseMirror-separator {
|
|
|
69760
69631
|
information: 'information'
|
|
69761
69632
|
};
|
|
69762
69633
|
|
|
69634
|
+
/**
|
|
69635
|
+
* Common state shared across Mapping Config
|
|
69636
|
+
*/
|
|
69637
|
+
class MappingConfig {
|
|
69638
|
+
constructor(text) {
|
|
69639
|
+
this.text = text;
|
|
69640
|
+
}
|
|
69641
|
+
}
|
|
69642
|
+
|
|
69763
69643
|
// Create an empty template containing only a space because creating a ViewTemplate
|
|
69764
69644
|
// with an empty string throws an exception at runtime.
|
|
69765
69645
|
// prettier-ignore
|
|
@@ -69810,6 +69690,12 @@ img.ProseMirror-separator {
|
|
|
69810
69690
|
}
|
|
69811
69691
|
}
|
|
69812
69692
|
|
|
69693
|
+
/**
|
|
69694
|
+
* Mapping configuration corresponding to a text mapping
|
|
69695
|
+
*/
|
|
69696
|
+
class MappingTextConfig extends MappingConfig {
|
|
69697
|
+
}
|
|
69698
|
+
|
|
69813
69699
|
/**
|
|
69814
69700
|
* The group header view for the icon column
|
|
69815
69701
|
*/
|
|
@@ -70008,7 +69894,7 @@ img.ProseMirror-separator {
|
|
|
70008
69894
|
}
|
|
70009
69895
|
const nimbleTableColumnIcon = TableColumnIcon.compose({
|
|
70010
69896
|
baseName: 'table-column-icon',
|
|
70011
|
-
template: template$
|
|
69897
|
+
template: template$8,
|
|
70012
69898
|
styles: styles$a
|
|
70013
69899
|
});
|
|
70014
69900
|
DesignSystem.getOrCreate()
|