@vonage/vivid 5.16.0 → 5.17.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/accordion/index.cjs +1 -1
- package/accordion/index.js +1 -1
- package/accordion-item/index.cjs +1 -1
- package/accordion-item/index.js +1 -1
- package/action-group/index.cjs +3 -3
- package/action-group/index.js +5 -5
- package/alert/index.cjs +3 -3
- package/alert/index.js +17 -17
- package/audio-player/index.cjs +16 -16
- package/audio-player/index.js +27 -27
- package/avatar/index.cjs +2 -2
- package/avatar/index.js +6 -6
- package/badge/index.cjs +2 -2
- package/badge/index.js +6 -6
- package/banner/index.cjs +3 -3
- package/banner/index.js +15 -15
- package/bundled/base-color-picker.cjs +2 -2
- package/bundled/base-color-picker.js +5 -5
- package/bundled/button.cjs +1 -1
- package/bundled/button.js +2 -2
- package/bundled/calendar-picker.template.cjs +2 -2
- package/bundled/calendar-picker.template.js +498 -498
- package/bundled/definition10.cjs +18 -30
- package/bundled/definition10.js +53 -155
- package/bundled/definition11.cjs +10 -19
- package/bundled/definition11.js +25 -74
- package/bundled/definition12.cjs +72 -18
- package/bundled/definition12.js +171 -107
- package/bundled/definition13.cjs +18 -17
- package/bundled/definition13.js +45 -65
- package/bundled/definition14.cjs +5 -10
- package/bundled/definition14.js +9 -27
- package/bundled/definition15.cjs +17 -71
- package/bundled/definition15.js +64 -181
- package/bundled/definition16.cjs +12 -4
- package/bundled/definition16.js +79 -14
- package/bundled/definition17.cjs +19 -13
- package/bundled/definition17.js +119 -70
- package/bundled/definition18.cjs +87 -12
- package/bundled/definition18.js +409 -52
- package/bundled/definition19.cjs +5 -87
- package/bundled/definition19.js +14 -422
- package/bundled/definition2.cjs +3 -3
- package/bundled/definition2.js +27 -27
- package/bundled/definition20.cjs +30 -5
- package/bundled/definition20.js +159 -9
- package/bundled/definition21.cjs +28 -19
- package/bundled/definition21.js +164 -47
- package/bundled/definition22.cjs +38 -23
- package/bundled/definition22.js +64 -82
- package/bundled/definition3.cjs +1 -1
- package/bundled/definition3.js +15 -15
- package/bundled/definition4.cjs +23 -38
- package/bundled/definition4.js +82 -64
- package/bundled/definition5.cjs +2 -2
- package/bundled/definition5.js +5 -5
- package/bundled/definition6.cjs +2 -2
- package/bundled/definition6.js +24 -24
- package/bundled/definition9.cjs +12 -30
- package/bundled/definition9.js +55 -148
- package/bundled/divider.cjs +1 -1
- package/bundled/divider.js +5 -5
- package/bundled/listbox.cjs +1 -1
- package/bundled/listbox.js +1 -1
- package/bundled/mixins.cjs +4 -4
- package/bundled/mixins.js +43 -43
- package/bundled/picker-field.template.cjs +7 -7
- package/bundled/picker-field.template.js +14 -14
- package/bundled/slider.template.cjs +7 -7
- package/bundled/slider.template.js +12 -12
- package/bundled/slottable-request.cjs +1 -1
- package/bundled/slottable-request.js +8 -38
- package/bundled/time-selection-picker.template.cjs +4 -4
- package/bundled/time-selection-picker.template.js +35 -35
- package/bundled/vivid-element.cjs +1 -1
- package/bundled/vivid-element.js +1 -1
- package/calendar/index.cjs +11 -11
- package/calendar/index.js +30 -237
- package/calendar-event/index.cjs +3 -3
- package/calendar-event/index.js +4 -4
- package/card/index.cjs +14 -11
- package/card/index.js +16 -13
- package/checkbox/index.cjs +1 -1
- package/checkbox/index.js +1 -1
- package/color-picker/definition.cjs +1 -1
- package/color-picker/definition.js +1 -1
- package/color-picker/index.cjs +6 -6
- package/color-picker/index.js +24 -24
- package/combobox/definition.cjs +1 -1
- package/combobox/definition.js +1 -1
- package/combobox/index.cjs +9 -8
- package/combobox/index.js +32 -28
- package/contextual-help/definition.cjs +1 -1
- package/contextual-help/definition.js +1 -1
- package/contextual-help/index.cjs +1 -1
- package/contextual-help/index.js +1 -1
- package/custom-elements.json +1027 -615
- package/data-grid/definition.js +1 -1
- package/data-grid/index.cjs +17 -17
- package/data-grid/index.js +261 -264
- package/date-picker/index.cjs +1 -1
- package/date-picker/index.js +12 -12
- package/date-range-picker/index.cjs +1 -1
- package/date-range-picker/index.js +7 -7
- package/date-time-picker/index.cjs +4 -4
- package/date-time-picker/index.js +24 -24
- package/dial-pad/index.cjs +3 -2
- package/dial-pad/index.js +6 -5
- package/dialog/index.cjs +4 -4
- package/dialog/index.js +5 -5
- package/divider/index.cjs +1 -1
- package/divider/index.js +1 -1
- package/fab/index.cjs +3 -3
- package/fab/index.js +8 -8
- package/file-picker/index.cjs +16 -13
- package/file-picker/index.js +31 -28
- package/header/index.cjs +4 -4
- package/header/index.js +5 -5
- package/index.cjs +24 -21
- package/index.js +11 -11
- package/lib/combobox/combobox.d.ts +0 -3
- package/lib/date-time-picker/date-time-picker.d.ts +0 -4
- package/lib/dial-pad/dial-pad.d.ts +6 -2
- package/lib/dialog/dialog.d.ts +0 -1
- package/lib/menu/menu.d.ts +0 -1
- package/lib/option/option.d.ts +0 -1
- package/lib/rich-text-editor/rte/exports.d.ts +1 -0
- package/lib/rich-text-editor/rte/features/alignment.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/character-count.d.ts +21 -0
- package/lib/rich-text-editor/rte/features/font-size-picker.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/internal/basic-text-blocks.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/keyboard-shortcuts.d.ts +1 -1
- package/lib/rich-text-editor/rte/features/text-color-picker.d.ts +1 -1
- package/lib/rich-text-editor/rte/public-interface.d.ts +6 -0
- package/lib/searchable-select/option-tag.d.ts +0 -1
- package/lib/table/definition.d.ts +2 -1
- package/lib/table/table-header-cell.d.ts +3 -0
- package/lib/table/table-sorting-button.d.ts +415 -0
- package/lib/table/table-sorting-button.template.d.ts +3 -0
- package/locales/de-DE.cjs +4 -178
- package/locales/de-DE.js +2 -179
- package/locales/en-GB.cjs +4 -9
- package/locales/en-GB.js +2 -10
- package/locales/en-US.cjs +268 -2
- package/locales/en-US.js +265 -1
- package/locales/ja-JP.cjs +4 -171
- package/locales/ja-JP.js +2 -172
- package/locales/zh-CN.cjs +4 -172
- package/locales/zh-CN.js +2 -173
- package/menu/index.cjs +1 -1
- package/menu/index.js +1 -1
- package/menu-item/index.cjs +1 -1
- package/menu-item/index.js +1 -1
- package/nav-disclosure/index.cjs +3 -3
- package/nav-disclosure/index.js +8 -8
- package/nav-item/index.cjs +1 -1
- package/nav-item/index.js +7 -7
- package/note/index.cjs +2 -2
- package/note/index.js +6 -6
- package/number-field/index.cjs +4 -4
- package/number-field/index.js +31 -31
- package/option/definition.cjs +1 -1
- package/option/definition.js +1 -1
- package/option/index.cjs +1 -1
- package/option/index.js +1 -1
- package/package.json +7 -8
- package/pagination/index.cjs +3 -3
- package/pagination/index.js +15 -15
- package/popover/index.cjs +4 -4
- package/popover/index.js +5 -5
- package/progress/index.cjs +2 -2
- package/progress/index.js +5 -5
- package/radio/index.cjs +1 -1
- package/radio/index.js +1 -1
- package/radio-group/index.cjs +4 -4
- package/radio-group/index.js +10 -10
- package/range-slider/index.cjs +4 -4
- package/range-slider/index.js +17 -17
- package/rich-text-editor/definition.cjs +1 -0
- package/rich-text-editor/definition.js +2 -2
- package/rich-text-editor/index.cjs +13 -13
- package/rich-text-editor/index.js +1886 -1829
- package/rich-text-view/index.cjs +1 -1
- package/rich-text-view/index.js +8 -8
- package/searchable-select/index.cjs +12 -12
- package/searchable-select/index.js +25 -25
- package/select/index.cjs +1 -1
- package/select/index.js +1 -1
- package/selectable-box/index.cjs +7 -7
- package/selectable-box/index.js +11 -11
- package/shared/foundation/test-utilities/fixture.d.ts +1 -1
- package/shared/patterns/linkable.d.ts +1 -1
- package/simple-color-picker/index.cjs +3 -3
- package/simple-color-picker/index.js +10 -10
- package/split-button/index.cjs +5 -5
- package/split-button/index.js +10 -10
- package/status/index.cjs +2 -2
- package/status/index.js +12 -12
- package/switch/index.cjs +3 -3
- package/switch/index.js +5 -5
- package/tab/index.cjs +1 -1
- package/tab/index.js +1 -1
- package/tab-panel/index.cjs +1 -1
- package/tab-panel/index.js +1 -1
- package/table/definition.cjs +17 -14
- package/table/definition.js +3 -2
- package/table/index.cjs +19 -10
- package/table/index.js +69 -21
- package/tabs/index.cjs +2 -2
- package/tabs/index.js +4 -4
- package/tag/index.cjs +7 -7
- package/tag/index.js +9 -9
- package/tag-group/index.cjs +3 -3
- package/tag-group/index.js +5 -5
- package/text-area/index.cjs +2 -2
- package/text-area/index.js +12 -12
- package/text-field/definition.cjs +1 -1
- package/text-field/definition.js +1 -1
- package/text-field/index.cjs +1 -1
- package/text-field/index.js +1 -1
- package/time-picker/index.cjs +1 -1
- package/time-picker/index.js +1 -1
- package/toggletip/definition.cjs +1 -1
- package/toggletip/definition.js +1 -1
- package/toggletip/index.cjs +1 -1
- package/toggletip/index.js +1 -1
- package/tooltip/definition.cjs +1 -1
- package/tooltip/definition.js +1 -1
- package/tooltip/index.cjs +1 -1
- package/tooltip/index.js +1 -1
- package/tree-item/index.cjs +1 -1
- package/tree-item/index.js +1 -1
- package/tree-view/index.cjs +3 -3
- package/tree-view/index.js +17 -17
- package/unbundled/button.cjs +2 -2
- package/unbundled/button.js +2 -2
- package/unbundled/calendar-picker.template.cjs +4347 -9
- package/unbundled/calendar-picker.template.js +4345 -7
- package/unbundled/chunk.cjs +0 -22
- package/unbundled/definition13.cjs +1 -8
- package/unbundled/definition13.js +1 -8
- package/unbundled/definition14.cjs +2 -2
- package/unbundled/definition14.js +2 -2
- package/unbundled/definition2.cjs +1 -1
- package/unbundled/definition2.js +1 -1
- package/unbundled/definition21.cjs +1 -2
- package/unbundled/definition21.js +1 -2
- package/unbundled/definition22.cjs +7 -2
- package/unbundled/definition22.js +7 -2
- package/unbundled/definition24.cjs +98 -979
- package/unbundled/definition24.js +93 -974
- package/unbundled/definition25.cjs +37 -322
- package/unbundled/definition25.js +33 -318
- package/unbundled/definition26.cjs +317 -91
- package/unbundled/definition26.js +313 -87
- package/unbundled/definition27.cjs +94 -192
- package/unbundled/definition27.js +91 -183
- package/unbundled/definition28.cjs +387 -395
- package/unbundled/definition28.js +387 -395
- package/unbundled/definition29.cjs +189 -110
- package/unbundled/definition29.js +180 -107
- package/unbundled/definition30.cjs +520 -36
- package/unbundled/definition30.js +519 -35
- package/unbundled/definition32.cjs +477 -477
- package/unbundled/definition32.js +475 -475
- package/unbundled/definition33.cjs +87 -2
- package/unbundled/definition33.js +77 -4
- package/unbundled/definition35.cjs +2 -2
- package/unbundled/definition35.js +2 -2
- package/unbundled/definition36.cjs +1 -1
- package/unbundled/definition36.js +1 -1
- package/unbundled/definition37.cjs +6 -2
- package/unbundled/definition37.js +6 -2
- package/unbundled/definition38.cjs +7 -5
- package/unbundled/definition38.js +7 -5
- package/unbundled/definition39.cjs +1 -0
- package/unbundled/definition39.js +1 -0
- package/unbundled/definition42.cjs +22 -11
- package/unbundled/definition42.js +22 -11
- package/unbundled/definition49.cjs +3 -3
- package/unbundled/definition49.js +3 -3
- package/unbundled/definition56.cjs +437 -9506
- package/unbundled/definition56.js +340 -9415
- package/unbundled/definition57.cjs +5 -5
- package/unbundled/definition57.js +5 -5
- package/unbundled/definition58.cjs +4 -3
- package/unbundled/definition58.js +2 -1
- package/unbundled/definition59.cjs +4 -3
- package/unbundled/definition59.js +4 -3
- package/unbundled/definition62.cjs +2 -2
- package/unbundled/definition62.js +2 -2
- package/unbundled/definition64.cjs +1 -1
- package/unbundled/definition64.js +1 -1
- package/unbundled/definition71.cjs +2 -2
- package/unbundled/definition71.js +2 -2
- package/unbundled/definition72.cjs +1 -2
- package/unbundled/definition72.js +1 -2
- package/unbundled/definition75.cjs +3 -51711
- package/unbundled/definition75.js +1 -51711
- package/unbundled/listbox.cjs +1 -1
- package/unbundled/listbox.js +1 -1
- package/unbundled/localized.cjs +2 -2
- package/unbundled/localized.js +1 -1
- package/unbundled/picker-field.template.cjs +1 -1
- package/unbundled/picker-field.template.js +1 -1
- package/unbundled/slottable-request.cjs +2 -3168
- package/unbundled/slottable-request.js +3 -3097
- package/unbundled/time-selection-picker.template.cjs +1 -1
- package/unbundled/time-selection-picker.template.js +1 -1
- package/unbundled/vivid-element.cjs +1 -1
- package/unbundled/vivid-element.js +1 -1
- package/video-player/index.cjs +3 -3
- package/video-player/index.js +9 -9
- package/vivid.api.json +220 -282
- package/unbundled/chunk.js +0 -33
- package/unbundled/en-US.cjs +0 -447
- package/unbundled/en-US.js +0 -443
|
@@ -592,12 +592,12 @@ var contextEvent = FAST.getById(KernelServiceId.contextEvent, () => {
|
|
|
592
592
|
* Provides additional contextual information available to behaviors and expressions.
|
|
593
593
|
* @public
|
|
594
594
|
*/
|
|
595
|
-
var ExecutionContext
|
|
595
|
+
var ExecutionContext = Object.freeze({
|
|
596
596
|
default: {
|
|
597
597
|
index: 0,
|
|
598
598
|
length: 0,
|
|
599
599
|
get event() {
|
|
600
|
-
return ExecutionContext
|
|
600
|
+
return ExecutionContext.getEvent();
|
|
601
601
|
},
|
|
602
602
|
eventDetail() {
|
|
603
603
|
return this.event.detail;
|
|
@@ -659,7 +659,7 @@ var ViewBehaviorOrchestrator = Object.freeze({ create(source) {
|
|
|
659
659
|
let isConnected = false;
|
|
660
660
|
return {
|
|
661
661
|
source,
|
|
662
|
-
context: ExecutionContext
|
|
662
|
+
context: ExecutionContext.default,
|
|
663
663
|
targets,
|
|
664
664
|
get isBound() {
|
|
665
665
|
return isConnected;
|
|
@@ -700,534 +700,148 @@ var ViewBehaviorOrchestrator = Object.freeze({ create(source) {
|
|
|
700
700
|
};
|
|
701
701
|
} });
|
|
702
702
|
//#endregion
|
|
703
|
-
//#region src/lib/data-grid/data-grid
|
|
704
|
-
var
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
${(x) => x.columnDefinition.title === void 0 ? x.columnDefinition.columnDataKey : x.columnDefinition.title}
|
|
712
|
-
</template>
|
|
713
|
-
`;
|
|
703
|
+
//#region src/lib/data-grid/data-grid.ts
|
|
704
|
+
var DataGridSelectionMode = {
|
|
705
|
+
none: "none",
|
|
706
|
+
singleRow: "single-row",
|
|
707
|
+
multiRow: "multi-row",
|
|
708
|
+
singleCell: "single-cell",
|
|
709
|
+
multiCell: "multi-cell"
|
|
710
|
+
};
|
|
714
711
|
/**
|
|
715
712
|
* @public
|
|
716
|
-
* @component data-grid
|
|
713
|
+
* @component data-grid
|
|
717
714
|
* @slot - Default slot.
|
|
718
|
-
* @slot action-items - Add action items to the cell using this slot.
|
|
719
|
-
* @event {CustomEvent<{columnDataKey: string, ariaSort: string | null, sortDirection: string | null}>} sort - Event that fires when a sortable column header is clicked
|
|
720
715
|
* @event {CustomEvent<{cell: HTMLElement, row: HTMLElement, isHeaderCell: boolean, columnDataKey: string}>} cell-click - Event that fires when a cell is clicked
|
|
721
|
-
* @event {CustomEvent<HTMLElement>} cell-focused - Fires a custom 'cell-focused' event when focus is on the cell or its contents
|
|
722
716
|
*/
|
|
723
|
-
var
|
|
724
|
-
constructor(..._args) {
|
|
725
|
-
super(..._args);
|
|
726
|
-
this.cellType = require_data_grid_options.DataGridCellTypes.default;
|
|
727
|
-
this.rowData = null;
|
|
728
|
-
this.columnDefinition = null;
|
|
729
|
-
this.isActiveCell = false;
|
|
730
|
-
this.customCellView = null;
|
|
731
|
-
this.updateCellStyle = () => {
|
|
732
|
-
if (this.gridColumn && !this.gridColumn.includes("undefined")) this.style.gridColumn = this.gridColumn;
|
|
733
|
-
else this.style.removeProperty("grid-column");
|
|
734
|
-
};
|
|
735
|
-
this._selectable = false;
|
|
736
|
-
this.selected = false;
|
|
737
|
-
this.ariaSelected = null;
|
|
738
|
-
this.ariaSort = null;
|
|
739
|
-
}
|
|
717
|
+
var DataGrid = class DataGrid extends require_vivid_element.VividElement {
|
|
740
718
|
/**
|
|
741
|
-
*
|
|
719
|
+
* generates a gridTemplateColumns based on columndata array
|
|
742
720
|
*/
|
|
743
|
-
|
|
744
|
-
|
|
721
|
+
static generateTemplateColumns(columnDefinitions) {
|
|
722
|
+
let templateColumns = "";
|
|
723
|
+
columnDefinitions.forEach((_) => {
|
|
724
|
+
templateColumns = `${templateColumns}${templateColumns === "" ? "" : " "}1fr`;
|
|
725
|
+
});
|
|
726
|
+
return templateColumns;
|
|
745
727
|
}
|
|
746
728
|
/**
|
|
747
729
|
* @internal
|
|
748
730
|
*/
|
|
749
|
-
|
|
750
|
-
if (this.$fastController.isConnected) this
|
|
731
|
+
noTabbingChanged() {
|
|
732
|
+
if (this.$fastController.isConnected) this.#setTabIndex();
|
|
733
|
+
}
|
|
734
|
+
#setTabIndex() {
|
|
735
|
+
this.setAttribute("tabIndex", this.noTabbing || this.contains(document.activeElement) ? "-1" : "0");
|
|
751
736
|
}
|
|
752
737
|
/**
|
|
753
738
|
* @internal
|
|
754
739
|
*/
|
|
755
|
-
|
|
756
|
-
if (this.$fastController.isConnected) this.
|
|
740
|
+
generateHeaderChanged() {
|
|
741
|
+
if (this.$fastController.isConnected) this.toggleGeneratedHeader();
|
|
757
742
|
}
|
|
758
743
|
/**
|
|
759
|
-
* Updates the fixed column style
|
|
760
744
|
* @internal
|
|
761
745
|
*/
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
this.
|
|
766
|
-
|
|
767
|
-
this.removeAttribute("data-fixed");
|
|
768
|
-
this.style.removeProperty("left");
|
|
746
|
+
gridTemplateColumnsChanged() {
|
|
747
|
+
/* v8 ignore if -- @preserve */
|
|
748
|
+
if (this.$fastController.isConnected) {
|
|
749
|
+
this.updateRowIndexes();
|
|
750
|
+
if (this.fixedColumns && this.fixedColumns > 0) this.applyFixedColumns();
|
|
769
751
|
}
|
|
770
752
|
}
|
|
771
753
|
/**
|
|
772
|
-
* Sets the fixed state and position for this cell
|
|
773
754
|
* @internal
|
|
774
755
|
*/
|
|
775
|
-
|
|
776
|
-
this.
|
|
777
|
-
this.
|
|
756
|
+
rowsDataChanged() {
|
|
757
|
+
if (this.columnDefinitions === null && this.rowsData.length > 0) this.columnDefinitions = DataGrid.generateColumns(this.rowsData[0]);
|
|
758
|
+
if (this.$fastController.isConnected) this.toggleGeneratedHeader();
|
|
778
759
|
}
|
|
779
760
|
/**
|
|
780
761
|
* @internal
|
|
781
762
|
*/
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
this.
|
|
788
|
-
|
|
789
|
-
this.
|
|
790
|
-
|
|
763
|
+
columnDefinitionsChanged() {
|
|
764
|
+
if (this.columnDefinitions === null) {
|
|
765
|
+
this.generatedGridTemplateColumns = "";
|
|
766
|
+
return;
|
|
767
|
+
}
|
|
768
|
+
this.generatedGridTemplateColumns = DataGrid.generateTemplateColumns(this.columnDefinitions);
|
|
769
|
+
/* v8 ignore if -- @preserve */
|
|
770
|
+
if (this.$fastController.isConnected) {
|
|
771
|
+
this.columnDefinitionsStale = true;
|
|
772
|
+
this.queueRowIndexUpdate();
|
|
773
|
+
}
|
|
791
774
|
}
|
|
792
775
|
/**
|
|
793
776
|
* @internal
|
|
794
777
|
*/
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
this.disconnectCellView();
|
|
778
|
+
headerCellItemTemplateChanged() {
|
|
779
|
+
/* v8 ignore if -- @preserve */
|
|
780
|
+
if (this.$fastController.isConnected) {
|
|
781
|
+
if (this.generatedHeader !== null) this.generatedHeader.headerCellItemTemplate = this.headerCellItemTemplate;
|
|
782
|
+
}
|
|
801
783
|
}
|
|
802
784
|
/**
|
|
803
785
|
* @internal
|
|
804
786
|
*/
|
|
805
|
-
|
|
806
|
-
this.
|
|
807
|
-
if (this.isActiveCell) return;
|
|
808
|
-
this.isActiveCell = true;
|
|
809
|
-
switch (this.cellType) {
|
|
810
|
-
case require_data_grid_options.DataGridCellTypes.columnHeader:
|
|
811
|
-
if (this.columnDefinition !== null && this.columnDefinition.headerCellInternalFocusQueue !== true && typeof this.columnDefinition.headerCellFocusTargetCallback === "function") {
|
|
812
|
-
const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
|
|
813
|
-
/* v8 ignore else -- @preserve */
|
|
814
|
-
if (focusTarget !== null) focusTarget.focus();
|
|
815
|
-
}
|
|
816
|
-
break;
|
|
817
|
-
default:
|
|
818
|
-
if (this.columnDefinition !== null && this.columnDefinition.cellInternalFocusQueue !== true && typeof this.columnDefinition.cellFocusTargetCallback === "function") {
|
|
819
|
-
const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
|
|
820
|
-
/* v8 ignore else -- @preserve */
|
|
821
|
-
if (focusTarget !== null) focusTarget.focus();
|
|
822
|
-
}
|
|
823
|
-
break;
|
|
824
|
-
}
|
|
825
|
-
this.$emit("cell-focused", this);
|
|
787
|
+
focusRowIndexChanged() {
|
|
788
|
+
if (this.$fastController.isConnected) this.queueFocusUpdate();
|
|
826
789
|
}
|
|
827
790
|
/**
|
|
828
791
|
* @internal
|
|
829
792
|
*/
|
|
830
|
-
|
|
831
|
-
this.
|
|
832
|
-
/* v8 ignore else -- @preserve */
|
|
833
|
-
if (this !== document.activeElement && !this.contains(document.activeElement)) this.isActiveCell = false;
|
|
793
|
+
focusColumnIndexChanged() {
|
|
794
|
+
if (this.$fastController.isConnected) this.queueFocusUpdate();
|
|
834
795
|
}
|
|
835
796
|
/**
|
|
836
797
|
* @internal
|
|
837
798
|
*/
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
if (this.contains(document.activeElement) && document.activeElement !== this) return;
|
|
844
|
-
switch (this.cellType) {
|
|
845
|
-
case require_data_grid_options.DataGridCellTypes.columnHeader:
|
|
846
|
-
if (this.columnDefinition.headerCellFocusTargetCallback !== void 0) {
|
|
847
|
-
const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
|
|
848
|
-
/* v8 ignore else -- @preserve */
|
|
849
|
-
if (focusTarget !== null) focusTarget.focus();
|
|
850
|
-
e.preventDefault();
|
|
851
|
-
}
|
|
852
|
-
break;
|
|
853
|
-
default:
|
|
854
|
-
if (this.columnDefinition.cellFocusTargetCallback !== void 0) {
|
|
855
|
-
const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
|
|
856
|
-
/* v8 ignore else -- @preserve */
|
|
857
|
-
if (focusTarget !== null) focusTarget.focus();
|
|
858
|
-
e.preventDefault();
|
|
859
|
-
}
|
|
860
|
-
break;
|
|
861
|
-
}
|
|
862
|
-
break;
|
|
863
|
-
case _microsoft_fast_web_utilities.keyEscape:
|
|
864
|
-
/* v8 ignore else -- @preserve */
|
|
865
|
-
if (this.contains(document.activeElement) && document.activeElement !== this) {
|
|
866
|
-
this.focus();
|
|
867
|
-
e.preventDefault();
|
|
868
|
-
}
|
|
869
|
-
break;
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
updateCellView() {
|
|
873
|
-
this.disconnectCellView();
|
|
874
|
-
if (this.columnDefinition === null) return;
|
|
875
|
-
switch (this.cellType) {
|
|
876
|
-
case require_data_grid_options.DataGridCellTypes.columnHeader:
|
|
877
|
-
if (this.columnDefinition.headerCellTemplate !== void 0) this.customCellView = this.columnDefinition.headerCellTemplate.render(this, this);
|
|
878
|
-
else this.customCellView = defaultHeaderCellContentsTemplate.render(this, this);
|
|
879
|
-
break;
|
|
880
|
-
case require_data_grid_options.DataGridCellTypes.rowHeader:
|
|
881
|
-
case require_data_grid_options.DataGridCellTypes.default:
|
|
882
|
-
if (this.columnDefinition.cellTemplate !== void 0) this.customCellView = this.columnDefinition.cellTemplate.render(this, this);
|
|
883
|
-
else this.customCellView = defaultCellContentsTemplate.render(this, this);
|
|
884
|
-
break;
|
|
885
|
-
}
|
|
886
|
-
if (!this.columnDefinition?.sortable) this.sortDirection = void 0;
|
|
887
|
-
else if (this.columnDefinition.sortDirection) this.sortDirection = this.columnDefinition.sortDirection;
|
|
888
|
-
else this.sortDirection = require_data_grid_options.DataGridCellSortStates.none;
|
|
889
|
-
}
|
|
890
|
-
disconnectCellView() {
|
|
891
|
-
if (this.customCellView !== null) {
|
|
892
|
-
this.customCellView.dispose();
|
|
893
|
-
this.customCellView = null;
|
|
799
|
+
fixedColumnsChanged() {
|
|
800
|
+
/* v8 ignore if -- @preserve */
|
|
801
|
+
if (this.$fastController.isConnected) {
|
|
802
|
+
this.applyFixedColumns();
|
|
803
|
+
this.setupResizeObserver();
|
|
894
804
|
}
|
|
895
805
|
}
|
|
896
806
|
/**
|
|
897
807
|
* @internal
|
|
898
808
|
*/
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
809
|
+
setupResizeObserver() {
|
|
810
|
+
if (this.resizeObserver) {
|
|
811
|
+
this.resizeObserver.disconnect();
|
|
812
|
+
this.resizeObserver = void 0;
|
|
813
|
+
}
|
|
814
|
+
if (typeof ResizeObserver !== "undefined" && this.fixedColumns && this.fixedColumns > 0) {
|
|
815
|
+
this.resizeObserver = new ResizeObserver(() => {
|
|
816
|
+
this.applyFixedColumns();
|
|
817
|
+
});
|
|
818
|
+
this.resizeObserver.observe(this);
|
|
819
|
+
}
|
|
903
820
|
}
|
|
904
821
|
/**
|
|
905
822
|
* @internal
|
|
906
823
|
*/
|
|
907
|
-
|
|
908
|
-
super.
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
824
|
+
connectedCallback() {
|
|
825
|
+
super.connectedCallback();
|
|
826
|
+
/* v8 ignore else -- @preserve */
|
|
827
|
+
if (this.rowItemTemplate === void 0) this.rowItemTemplate = this.defaultRowItemTemplate;
|
|
828
|
+
/* v8 ignore else -- @preserve */
|
|
829
|
+
if (this.behaviorOrchestrator === null) {
|
|
830
|
+
this.behaviorOrchestrator = ViewBehaviorOrchestrator.create(this);
|
|
831
|
+
this.$fastController.addBehavior(this.behaviorOrchestrator);
|
|
832
|
+
this.behaviorOrchestrator.addBehaviorFactory(new _microsoft_fast_element.RepeatDirective((0, _microsoft_fast_element.normalizeBinding)((x) => x.rowsData), (0, _microsoft_fast_element.normalizeBinding)((x) => x.rowItemTemplate), { positioning: true }), this.appendChild(document.createComment("")));
|
|
912
833
|
}
|
|
913
|
-
this.
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
columnDataKey: this.#getColumnDataKey(),
|
|
925
|
-
sortDirection: this.sortDirection
|
|
926
|
-
});
|
|
927
|
-
if (!(isHeaderCell ? this.columnDefinition?.headerCellInternalFocusQueue : this.columnDefinition?.cellInternalFocusQueue)) this.$emit("cell-click", {
|
|
928
|
-
cell: this,
|
|
929
|
-
row: this.parentElement,
|
|
930
|
-
isHeaderCell,
|
|
931
|
-
columnDataKey: this.#getColumnDataKey()
|
|
932
|
-
});
|
|
933
|
-
return true;
|
|
934
|
-
}
|
|
935
|
-
};
|
|
936
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "cell-type" })], DataGridCell.prototype, "cellType", void 0);
|
|
937
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "grid-column" })], DataGridCell.prototype, "gridColumn", void 0);
|
|
938
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridCell.prototype, "rowData", void 0);
|
|
939
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridCell.prototype, "columnDefinition", void 0);
|
|
940
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridCell.prototype, "_selectable", void 0);
|
|
941
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], DataGridCell.prototype, "selected", void 0);
|
|
942
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "sort-direction" })], DataGridCell.prototype, "sortDirection", void 0);
|
|
943
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridCell.prototype, "_actionItemsSlottedContent", void 0);
|
|
944
|
-
//#endregion
|
|
945
|
-
//#region src/lib/data-grid/data-grid-row.ts
|
|
946
|
-
/**
|
|
947
|
-
* @public
|
|
948
|
-
* @component data-grid-row
|
|
949
|
-
* @slot - Default slot.
|
|
950
|
-
* @event {CustomEvent<{cell: HTMLElement, row: HTMLElement, isHeaderCell: boolean, columnDataKey: string}>} cell-click - Event that fires when a cell is clicked
|
|
951
|
-
* @event {CustomEvent<HTMLElement>} row-focused - Fires a custom 'row-focused' event when focus is on an element (usually a cell or its contents) in the row
|
|
952
|
-
*/
|
|
953
|
-
var DataGridRow = class extends require_host_semantics.HostSemantics(require_vivid_element.VividElement) {
|
|
954
|
-
constructor(..._args) {
|
|
955
|
-
super(..._args);
|
|
956
|
-
this.rowType = require_data_grid_options.DataGridRowTypes.default;
|
|
957
|
-
this.rowData = null;
|
|
958
|
-
this.columnDefinitions = null;
|
|
959
|
-
this.behaviorOrchestrator = null;
|
|
960
|
-
this.focusColumnIndex = 0;
|
|
961
|
-
this.updateRowStyle = () => {
|
|
962
|
-
this.style.gridTemplateColumns = this.gridTemplateColumns;
|
|
963
|
-
};
|
|
964
|
-
this.ariaSelected = null;
|
|
965
|
-
this._selectable = false;
|
|
966
|
-
this.selected = false;
|
|
967
|
-
}
|
|
968
|
-
/**
|
|
969
|
-
* @internal
|
|
970
|
-
*/
|
|
971
|
-
gridTemplateColumnsChanged() {
|
|
972
|
-
if (this.$fastController.isConnected) this.updateRowStyle();
|
|
973
|
-
}
|
|
974
|
-
/**
|
|
975
|
-
* @internal
|
|
976
|
-
*/
|
|
977
|
-
rowTypeChanged() {
|
|
978
|
-
if (this.$fastController.isConnected) this.updateItemTemplate();
|
|
979
|
-
}
|
|
980
|
-
/**
|
|
981
|
-
* @internal
|
|
982
|
-
*/
|
|
983
|
-
cellItemTemplateChanged() {
|
|
984
|
-
this.updateItemTemplate();
|
|
985
|
-
}
|
|
986
|
-
/**
|
|
987
|
-
* @internal
|
|
988
|
-
*/
|
|
989
|
-
headerCellItemTemplateChanged() {
|
|
990
|
-
this.updateItemTemplate();
|
|
991
|
-
}
|
|
992
|
-
/**
|
|
993
|
-
* @internal
|
|
994
|
-
*/
|
|
995
|
-
connectedCallback() {
|
|
996
|
-
super.connectedCallback();
|
|
997
|
-
/* v8 ignore else -- @preserve */
|
|
998
|
-
if (this.behaviorOrchestrator === null) {
|
|
999
|
-
this.updateItemTemplate();
|
|
1000
|
-
this.behaviorOrchestrator = ViewBehaviorOrchestrator.create(this);
|
|
1001
|
-
this.$fastController.addBehavior(this.behaviorOrchestrator);
|
|
1002
|
-
this.behaviorOrchestrator.addBehaviorFactory(new _microsoft_fast_element.RepeatDirective((0, _microsoft_fast_element.normalizeBinding)((x) => x.columnDefinitions), (0, _microsoft_fast_element.normalizeBinding)((x) => x.activeCellItemTemplate), { positioning: true }), this.appendChild(document.createComment("")));
|
|
1003
|
-
}
|
|
1004
|
-
this.addEventListener("cell-focused", this.handleCellFocus);
|
|
1005
|
-
this.addEventListener(_microsoft_fast_web_utilities.eventFocusOut, this.handleFocusout);
|
|
1006
|
-
this.addEventListener(_microsoft_fast_web_utilities.eventKeyDown, this.handleKeydown);
|
|
1007
|
-
this.updateRowStyle();
|
|
1008
|
-
}
|
|
1009
|
-
/**
|
|
1010
|
-
* @internal
|
|
1011
|
-
*/
|
|
1012
|
-
disconnectedCallback() {
|
|
1013
|
-
super.disconnectedCallback();
|
|
1014
|
-
this.removeEventListener("cell-focused", this.handleCellFocus);
|
|
1015
|
-
this.removeEventListener(_microsoft_fast_web_utilities.eventFocusOut, this.handleFocusout);
|
|
1016
|
-
this.removeEventListener(_microsoft_fast_web_utilities.eventKeyDown, this.handleKeydown);
|
|
1017
|
-
}
|
|
1018
|
-
/**
|
|
1019
|
-
* @internal
|
|
1020
|
-
*/
|
|
1021
|
-
handleFocusout(_) {
|
|
1022
|
-
/* v8 ignore else -- @preserve */
|
|
1023
|
-
if (!this.contains(document.activeElement)) this.focusColumnIndex = 0;
|
|
1024
|
-
}
|
|
1025
|
-
/**
|
|
1026
|
-
* @internal
|
|
1027
|
-
*/
|
|
1028
|
-
handleCellFocus(e) {
|
|
1029
|
-
this.focusColumnIndex = this.cellElements.indexOf(e.target);
|
|
1030
|
-
this.$emit("row-focused", this);
|
|
1031
|
-
}
|
|
1032
|
-
/**
|
|
1033
|
-
* @internal
|
|
1034
|
-
*/
|
|
1035
|
-
handleKeydown(e) {
|
|
1036
|
-
if (e.defaultPrevented) return;
|
|
1037
|
-
let newFocusColumnIndex = 0;
|
|
1038
|
-
switch (e.key) {
|
|
1039
|
-
case require_key_codes.keyArrowLeft:
|
|
1040
|
-
newFocusColumnIndex = Math.max(0, this.focusColumnIndex - 1);
|
|
1041
|
-
this.cellElements[newFocusColumnIndex].focus();
|
|
1042
|
-
e.preventDefault();
|
|
1043
|
-
break;
|
|
1044
|
-
case require_key_codes.keyArrowRight:
|
|
1045
|
-
newFocusColumnIndex = Math.min(this.cellElements.length - 1, this.focusColumnIndex + 1);
|
|
1046
|
-
this.cellElements[newFocusColumnIndex].focus();
|
|
1047
|
-
e.preventDefault();
|
|
1048
|
-
break;
|
|
1049
|
-
case _microsoft_fast_web_utilities.keyHome:
|
|
1050
|
-
if (!e.ctrlKey) {
|
|
1051
|
-
this.cellElements[0].focus();
|
|
1052
|
-
e.preventDefault();
|
|
1053
|
-
}
|
|
1054
|
-
break;
|
|
1055
|
-
case _microsoft_fast_web_utilities.keyEnd:
|
|
1056
|
-
if (!e.ctrlKey) {
|
|
1057
|
-
this.cellElements[this.cellElements.length - 1].focus();
|
|
1058
|
-
e.preventDefault();
|
|
1059
|
-
}
|
|
1060
|
-
break;
|
|
1061
|
-
}
|
|
1062
|
-
}
|
|
1063
|
-
updateItemTemplate() {
|
|
1064
|
-
this.activeCellItemTemplate = this.rowType === require_data_grid_options.DataGridRowTypes.default && this.cellItemTemplate !== void 0 ? this.cellItemTemplate : this.rowType === require_data_grid_options.DataGridRowTypes.default && this.cellItemTemplate === void 0 ? this.defaultCellItemTemplate : this.headerCellItemTemplate !== void 0 ? this.headerCellItemTemplate : this.defaultHeaderCellItemTemplate;
|
|
1065
|
-
}
|
|
1066
|
-
/**
|
|
1067
|
-
* @internal
|
|
1068
|
-
*/
|
|
1069
|
-
ariaSelectedChanged(oldValue, newValue) {
|
|
1070
|
-
super.ariaSelectedChanged(oldValue, newValue);
|
|
1071
|
-
this._selectable = newValue !== null;
|
|
1072
|
-
this.selected = newValue === "true";
|
|
1073
|
-
}
|
|
1074
|
-
};
|
|
1075
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "grid-template-columns" })], DataGridRow.prototype, "gridTemplateColumns", void 0);
|
|
1076
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "row-type" })], DataGridRow.prototype, "rowType", void 0);
|
|
1077
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "rowData", void 0);
|
|
1078
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "columnDefinitions", void 0);
|
|
1079
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "cellItemTemplate", void 0);
|
|
1080
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "headerCellItemTemplate", void 0);
|
|
1081
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "rowIndex", void 0);
|
|
1082
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "activeCellItemTemplate", void 0);
|
|
1083
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "defaultCellItemTemplate", void 0);
|
|
1084
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "defaultHeaderCellItemTemplate", void 0);
|
|
1085
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "cellElements", void 0);
|
|
1086
|
-
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "_selectable", void 0);
|
|
1087
|
-
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], DataGridRow.prototype, "selected", void 0);
|
|
1088
|
-
//#endregion
|
|
1089
|
-
//#region src/lib/data-grid/data-grid.ts
|
|
1090
|
-
var DataGridSelectionMode = {
|
|
1091
|
-
none: "none",
|
|
1092
|
-
singleRow: "single-row",
|
|
1093
|
-
multiRow: "multi-row",
|
|
1094
|
-
singleCell: "single-cell",
|
|
1095
|
-
multiCell: "multi-cell"
|
|
1096
|
-
};
|
|
1097
|
-
/**
|
|
1098
|
-
* @public
|
|
1099
|
-
* @component data-grid
|
|
1100
|
-
* @slot - Default slot.
|
|
1101
|
-
* @event {CustomEvent<{cell: HTMLElement, row: HTMLElement, isHeaderCell: boolean, columnDataKey: string}>} cell-click - Event that fires when a cell is clicked
|
|
1102
|
-
*/
|
|
1103
|
-
var DataGrid = class DataGrid extends require_vivid_element.VividElement {
|
|
1104
|
-
/**
|
|
1105
|
-
* generates a gridTemplateColumns based on columndata array
|
|
1106
|
-
*/
|
|
1107
|
-
static generateTemplateColumns(columnDefinitions) {
|
|
1108
|
-
let templateColumns = "";
|
|
1109
|
-
columnDefinitions.forEach((_) => {
|
|
1110
|
-
templateColumns = `${templateColumns}${templateColumns === "" ? "" : " "}1fr`;
|
|
1111
|
-
});
|
|
1112
|
-
return templateColumns;
|
|
1113
|
-
}
|
|
1114
|
-
/**
|
|
1115
|
-
* @internal
|
|
1116
|
-
*/
|
|
1117
|
-
noTabbingChanged() {
|
|
1118
|
-
if (this.$fastController.isConnected) this.#setTabIndex();
|
|
1119
|
-
}
|
|
1120
|
-
#setTabIndex() {
|
|
1121
|
-
this.setAttribute("tabIndex", this.noTabbing || this.contains(document.activeElement) ? "-1" : "0");
|
|
1122
|
-
}
|
|
1123
|
-
/**
|
|
1124
|
-
* @internal
|
|
1125
|
-
*/
|
|
1126
|
-
generateHeaderChanged() {
|
|
1127
|
-
if (this.$fastController.isConnected) this.toggleGeneratedHeader();
|
|
1128
|
-
}
|
|
1129
|
-
/**
|
|
1130
|
-
* @internal
|
|
1131
|
-
*/
|
|
1132
|
-
gridTemplateColumnsChanged() {
|
|
1133
|
-
/* v8 ignore if -- @preserve */
|
|
1134
|
-
if (this.$fastController.isConnected) {
|
|
1135
|
-
this.updateRowIndexes();
|
|
1136
|
-
if (this.fixedColumns && this.fixedColumns > 0) this.applyFixedColumns();
|
|
1137
|
-
}
|
|
1138
|
-
}
|
|
1139
|
-
/**
|
|
1140
|
-
* @internal
|
|
1141
|
-
*/
|
|
1142
|
-
rowsDataChanged() {
|
|
1143
|
-
if (this.columnDefinitions === null && this.rowsData.length > 0) this.columnDefinitions = DataGrid.generateColumns(this.rowsData[0]);
|
|
1144
|
-
if (this.$fastController.isConnected) this.toggleGeneratedHeader();
|
|
1145
|
-
}
|
|
1146
|
-
/**
|
|
1147
|
-
* @internal
|
|
1148
|
-
*/
|
|
1149
|
-
columnDefinitionsChanged() {
|
|
1150
|
-
if (this.columnDefinitions === null) {
|
|
1151
|
-
this.generatedGridTemplateColumns = "";
|
|
1152
|
-
return;
|
|
1153
|
-
}
|
|
1154
|
-
this.generatedGridTemplateColumns = DataGrid.generateTemplateColumns(this.columnDefinitions);
|
|
1155
|
-
/* v8 ignore if -- @preserve */
|
|
1156
|
-
if (this.$fastController.isConnected) {
|
|
1157
|
-
this.columnDefinitionsStale = true;
|
|
1158
|
-
this.queueRowIndexUpdate();
|
|
1159
|
-
}
|
|
1160
|
-
}
|
|
1161
|
-
/**
|
|
1162
|
-
* @internal
|
|
1163
|
-
*/
|
|
1164
|
-
headerCellItemTemplateChanged() {
|
|
1165
|
-
/* v8 ignore if -- @preserve */
|
|
1166
|
-
if (this.$fastController.isConnected) {
|
|
1167
|
-
if (this.generatedHeader !== null) this.generatedHeader.headerCellItemTemplate = this.headerCellItemTemplate;
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
/**
|
|
1171
|
-
* @internal
|
|
1172
|
-
*/
|
|
1173
|
-
focusRowIndexChanged() {
|
|
1174
|
-
if (this.$fastController.isConnected) this.queueFocusUpdate();
|
|
1175
|
-
}
|
|
1176
|
-
/**
|
|
1177
|
-
* @internal
|
|
1178
|
-
*/
|
|
1179
|
-
focusColumnIndexChanged() {
|
|
1180
|
-
if (this.$fastController.isConnected) this.queueFocusUpdate();
|
|
1181
|
-
}
|
|
1182
|
-
/**
|
|
1183
|
-
* @internal
|
|
1184
|
-
*/
|
|
1185
|
-
fixedColumnsChanged() {
|
|
1186
|
-
/* v8 ignore if -- @preserve */
|
|
1187
|
-
if (this.$fastController.isConnected) {
|
|
1188
|
-
this.applyFixedColumns();
|
|
1189
|
-
this.setupResizeObserver();
|
|
1190
|
-
}
|
|
1191
|
-
}
|
|
1192
|
-
/**
|
|
1193
|
-
* @internal
|
|
1194
|
-
*/
|
|
1195
|
-
setupResizeObserver() {
|
|
1196
|
-
if (this.resizeObserver) {
|
|
1197
|
-
this.resizeObserver.disconnect();
|
|
1198
|
-
this.resizeObserver = void 0;
|
|
1199
|
-
}
|
|
1200
|
-
if (typeof ResizeObserver !== "undefined" && this.fixedColumns && this.fixedColumns > 0) {
|
|
1201
|
-
this.resizeObserver = new ResizeObserver(() => {
|
|
1202
|
-
this.applyFixedColumns();
|
|
1203
|
-
});
|
|
1204
|
-
this.resizeObserver.observe(this);
|
|
1205
|
-
}
|
|
1206
|
-
}
|
|
1207
|
-
/**
|
|
1208
|
-
* @internal
|
|
1209
|
-
*/
|
|
1210
|
-
connectedCallback() {
|
|
1211
|
-
super.connectedCallback();
|
|
1212
|
-
/* v8 ignore else -- @preserve */
|
|
1213
|
-
if (this.rowItemTemplate === void 0) this.rowItemTemplate = this.defaultRowItemTemplate;
|
|
1214
|
-
/* v8 ignore else -- @preserve */
|
|
1215
|
-
if (this.behaviorOrchestrator === null) {
|
|
1216
|
-
this.behaviorOrchestrator = ViewBehaviorOrchestrator.create(this);
|
|
1217
|
-
this.$fastController.addBehavior(this.behaviorOrchestrator);
|
|
1218
|
-
this.behaviorOrchestrator.addBehaviorFactory(new _microsoft_fast_element.RepeatDirective((0, _microsoft_fast_element.normalizeBinding)((x) => x.rowsData), (0, _microsoft_fast_element.normalizeBinding)((x) => x.rowItemTemplate), { positioning: true }), this.appendChild(document.createComment("")));
|
|
1219
|
-
}
|
|
1220
|
-
this.toggleGeneratedHeader();
|
|
1221
|
-
this.addEventListener("row-focused", this.handleRowFocus);
|
|
1222
|
-
this.addEventListener(_microsoft_fast_web_utilities.eventFocus, this.handleFocus);
|
|
1223
|
-
this.addEventListener(_microsoft_fast_web_utilities.eventKeyDown, this.handleKeydown);
|
|
1224
|
-
this.addEventListener(_microsoft_fast_web_utilities.eventFocusOut, this.handleFocusOut);
|
|
1225
|
-
this.observer = new MutationObserver(this.onChildListChange);
|
|
1226
|
-
this.observer.observe(this, { childList: true });
|
|
1227
|
-
this.setupResizeObserver();
|
|
1228
|
-
_microsoft_fast_element.Updates.enqueue(this.queueRowIndexUpdate);
|
|
1229
|
-
this.#setTabIndex();
|
|
1230
|
-
_microsoft_fast_element.Observable.getNotifier(this).subscribe(this.#changeHandler, "columnDefinitions");
|
|
834
|
+
this.toggleGeneratedHeader();
|
|
835
|
+
this.addEventListener("row-focused", this.handleRowFocus);
|
|
836
|
+
this.addEventListener(_microsoft_fast_web_utilities.eventFocus, this.handleFocus);
|
|
837
|
+
this.addEventListener(_microsoft_fast_web_utilities.eventKeyDown, this.handleKeydown);
|
|
838
|
+
this.addEventListener(_microsoft_fast_web_utilities.eventFocusOut, this.handleFocusOut);
|
|
839
|
+
this.observer = new MutationObserver(this.onChildListChange);
|
|
840
|
+
this.observer.observe(this, { childList: true });
|
|
841
|
+
this.setupResizeObserver();
|
|
842
|
+
_microsoft_fast_element.Updates.enqueue(this.queueRowIndexUpdate);
|
|
843
|
+
this.#setTabIndex();
|
|
844
|
+
_microsoft_fast_element.Observable.getNotifier(this).subscribe(this.#changeHandler, "columnDefinitions");
|
|
1231
845
|
}
|
|
1232
846
|
/**
|
|
1233
847
|
* @internal
|
|
@@ -1638,6 +1252,150 @@ require_decorate.__decorate([_microsoft_fast_element.observable], DataGrid.proto
|
|
|
1638
1252
|
require_decorate.__decorate([_microsoft_fast_element.observable], DataGrid.prototype, "slottedRowElements", void 0);
|
|
1639
1253
|
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "selection-mode" })], DataGrid.prototype, "selectionMode", void 0);
|
|
1640
1254
|
//#endregion
|
|
1255
|
+
//#region src/lib/data-grid/data-grid-row.ts
|
|
1256
|
+
/**
|
|
1257
|
+
* @public
|
|
1258
|
+
* @component data-grid-row
|
|
1259
|
+
* @slot - Default slot.
|
|
1260
|
+
* @event {CustomEvent<{cell: HTMLElement, row: HTMLElement, isHeaderCell: boolean, columnDataKey: string}>} cell-click - Event that fires when a cell is clicked
|
|
1261
|
+
* @event {CustomEvent<HTMLElement>} row-focused - Fires a custom 'row-focused' event when focus is on an element (usually a cell or its contents) in the row
|
|
1262
|
+
*/
|
|
1263
|
+
var DataGridRow = class extends require_host_semantics.HostSemantics(require_vivid_element.VividElement) {
|
|
1264
|
+
constructor(..._args) {
|
|
1265
|
+
super(..._args);
|
|
1266
|
+
this.rowType = require_data_grid_options.DataGridRowTypes.default;
|
|
1267
|
+
this.rowData = null;
|
|
1268
|
+
this.columnDefinitions = null;
|
|
1269
|
+
this.behaviorOrchestrator = null;
|
|
1270
|
+
this.focusColumnIndex = 0;
|
|
1271
|
+
this.updateRowStyle = () => {
|
|
1272
|
+
this.style.gridTemplateColumns = this.gridTemplateColumns;
|
|
1273
|
+
};
|
|
1274
|
+
this.ariaSelected = null;
|
|
1275
|
+
this._selectable = false;
|
|
1276
|
+
this.selected = false;
|
|
1277
|
+
}
|
|
1278
|
+
/**
|
|
1279
|
+
* @internal
|
|
1280
|
+
*/
|
|
1281
|
+
gridTemplateColumnsChanged() {
|
|
1282
|
+
if (this.$fastController.isConnected) this.updateRowStyle();
|
|
1283
|
+
}
|
|
1284
|
+
/**
|
|
1285
|
+
* @internal
|
|
1286
|
+
*/
|
|
1287
|
+
rowTypeChanged() {
|
|
1288
|
+
if (this.$fastController.isConnected) this.updateItemTemplate();
|
|
1289
|
+
}
|
|
1290
|
+
/**
|
|
1291
|
+
* @internal
|
|
1292
|
+
*/
|
|
1293
|
+
cellItemTemplateChanged() {
|
|
1294
|
+
this.updateItemTemplate();
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* @internal
|
|
1298
|
+
*/
|
|
1299
|
+
headerCellItemTemplateChanged() {
|
|
1300
|
+
this.updateItemTemplate();
|
|
1301
|
+
}
|
|
1302
|
+
/**
|
|
1303
|
+
* @internal
|
|
1304
|
+
*/
|
|
1305
|
+
connectedCallback() {
|
|
1306
|
+
super.connectedCallback();
|
|
1307
|
+
/* v8 ignore else -- @preserve */
|
|
1308
|
+
if (this.behaviorOrchestrator === null) {
|
|
1309
|
+
this.updateItemTemplate();
|
|
1310
|
+
this.behaviorOrchestrator = ViewBehaviorOrchestrator.create(this);
|
|
1311
|
+
this.$fastController.addBehavior(this.behaviorOrchestrator);
|
|
1312
|
+
this.behaviorOrchestrator.addBehaviorFactory(new _microsoft_fast_element.RepeatDirective((0, _microsoft_fast_element.normalizeBinding)((x) => x.columnDefinitions), (0, _microsoft_fast_element.normalizeBinding)((x) => x.activeCellItemTemplate), { positioning: true }), this.appendChild(document.createComment("")));
|
|
1313
|
+
}
|
|
1314
|
+
this.addEventListener("cell-focused", this.handleCellFocus);
|
|
1315
|
+
this.addEventListener(_microsoft_fast_web_utilities.eventFocusOut, this.handleFocusout);
|
|
1316
|
+
this.addEventListener(_microsoft_fast_web_utilities.eventKeyDown, this.handleKeydown);
|
|
1317
|
+
this.updateRowStyle();
|
|
1318
|
+
}
|
|
1319
|
+
/**
|
|
1320
|
+
* @internal
|
|
1321
|
+
*/
|
|
1322
|
+
disconnectedCallback() {
|
|
1323
|
+
super.disconnectedCallback();
|
|
1324
|
+
this.removeEventListener("cell-focused", this.handleCellFocus);
|
|
1325
|
+
this.removeEventListener(_microsoft_fast_web_utilities.eventFocusOut, this.handleFocusout);
|
|
1326
|
+
this.removeEventListener(_microsoft_fast_web_utilities.eventKeyDown, this.handleKeydown);
|
|
1327
|
+
}
|
|
1328
|
+
/**
|
|
1329
|
+
* @internal
|
|
1330
|
+
*/
|
|
1331
|
+
handleFocusout(_) {
|
|
1332
|
+
/* v8 ignore else -- @preserve */
|
|
1333
|
+
if (!this.contains(document.activeElement)) this.focusColumnIndex = 0;
|
|
1334
|
+
}
|
|
1335
|
+
/**
|
|
1336
|
+
* @internal
|
|
1337
|
+
*/
|
|
1338
|
+
handleCellFocus(e) {
|
|
1339
|
+
this.focusColumnIndex = this.cellElements.indexOf(e.target);
|
|
1340
|
+
this.$emit("row-focused", this);
|
|
1341
|
+
}
|
|
1342
|
+
/**
|
|
1343
|
+
* @internal
|
|
1344
|
+
*/
|
|
1345
|
+
handleKeydown(e) {
|
|
1346
|
+
if (e.defaultPrevented) return;
|
|
1347
|
+
let newFocusColumnIndex = 0;
|
|
1348
|
+
switch (e.key) {
|
|
1349
|
+
case require_key_codes.keyArrowLeft:
|
|
1350
|
+
newFocusColumnIndex = Math.max(0, this.focusColumnIndex - 1);
|
|
1351
|
+
this.cellElements[newFocusColumnIndex].focus();
|
|
1352
|
+
e.preventDefault();
|
|
1353
|
+
break;
|
|
1354
|
+
case require_key_codes.keyArrowRight:
|
|
1355
|
+
newFocusColumnIndex = Math.min(this.cellElements.length - 1, this.focusColumnIndex + 1);
|
|
1356
|
+
this.cellElements[newFocusColumnIndex].focus();
|
|
1357
|
+
e.preventDefault();
|
|
1358
|
+
break;
|
|
1359
|
+
case _microsoft_fast_web_utilities.keyHome:
|
|
1360
|
+
if (!e.ctrlKey) {
|
|
1361
|
+
this.cellElements[0].focus();
|
|
1362
|
+
e.preventDefault();
|
|
1363
|
+
}
|
|
1364
|
+
break;
|
|
1365
|
+
case _microsoft_fast_web_utilities.keyEnd:
|
|
1366
|
+
if (!e.ctrlKey) {
|
|
1367
|
+
this.cellElements[this.cellElements.length - 1].focus();
|
|
1368
|
+
e.preventDefault();
|
|
1369
|
+
}
|
|
1370
|
+
break;
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
updateItemTemplate() {
|
|
1374
|
+
this.activeCellItemTemplate = this.rowType === require_data_grid_options.DataGridRowTypes.default && this.cellItemTemplate !== void 0 ? this.cellItemTemplate : this.rowType === require_data_grid_options.DataGridRowTypes.default && this.cellItemTemplate === void 0 ? this.defaultCellItemTemplate : this.headerCellItemTemplate !== void 0 ? this.headerCellItemTemplate : this.defaultHeaderCellItemTemplate;
|
|
1375
|
+
}
|
|
1376
|
+
/**
|
|
1377
|
+
* @internal
|
|
1378
|
+
*/
|
|
1379
|
+
ariaSelectedChanged(oldValue, newValue) {
|
|
1380
|
+
super.ariaSelectedChanged(oldValue, newValue);
|
|
1381
|
+
this._selectable = newValue !== null;
|
|
1382
|
+
this.selected = newValue === "true";
|
|
1383
|
+
}
|
|
1384
|
+
};
|
|
1385
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "grid-template-columns" })], DataGridRow.prototype, "gridTemplateColumns", void 0);
|
|
1386
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "row-type" })], DataGridRow.prototype, "rowType", void 0);
|
|
1387
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "rowData", void 0);
|
|
1388
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "columnDefinitions", void 0);
|
|
1389
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "cellItemTemplate", void 0);
|
|
1390
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "headerCellItemTemplate", void 0);
|
|
1391
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "rowIndex", void 0);
|
|
1392
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "activeCellItemTemplate", void 0);
|
|
1393
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "defaultCellItemTemplate", void 0);
|
|
1394
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "defaultHeaderCellItemTemplate", void 0);
|
|
1395
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "cellElements", void 0);
|
|
1396
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridRow.prototype, "_selectable", void 0);
|
|
1397
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], DataGridRow.prototype, "selected", void 0);
|
|
1398
|
+
//#endregion
|
|
1641
1399
|
//#region src/lib/data-grid/data-grid.template.ts
|
|
1642
1400
|
function createRowItemTemplate(context) {
|
|
1643
1401
|
const rowTag = context.tagFor(DataGridRow);
|
|
@@ -1689,6 +1447,248 @@ var DataGridTemplate = (context) => {
|
|
|
1689
1447
|
`;
|
|
1690
1448
|
};
|
|
1691
1449
|
//#endregion
|
|
1450
|
+
//#region src/lib/data-grid/data-grid-cell.ts
|
|
1451
|
+
var defaultCellContentsTemplate = _microsoft_fast_element.html`
|
|
1452
|
+
<template>
|
|
1453
|
+
${(x) => x.rowData === null || x.columnDefinition === null || x.columnDefinition.columnDataKey === null ? null : x.rowData[x.columnDefinition.columnDataKey]}
|
|
1454
|
+
</template>
|
|
1455
|
+
`;
|
|
1456
|
+
var defaultHeaderCellContentsTemplate = _microsoft_fast_element.html`
|
|
1457
|
+
<template>
|
|
1458
|
+
${(x) => x.columnDefinition.title === void 0 ? x.columnDefinition.columnDataKey : x.columnDefinition.title}
|
|
1459
|
+
</template>
|
|
1460
|
+
`;
|
|
1461
|
+
/**
|
|
1462
|
+
* @public
|
|
1463
|
+
* @component data-grid-cell
|
|
1464
|
+
* @slot - Default slot.
|
|
1465
|
+
* @slot action-items - Add action items to the cell using this slot.
|
|
1466
|
+
* @event {CustomEvent<{columnDataKey: string, ariaSort: string | null, sortDirection: string | null}>} sort - Event that fires when a sortable column header is clicked
|
|
1467
|
+
* @event {CustomEvent<{cell: HTMLElement, row: HTMLElement, isHeaderCell: boolean, columnDataKey: string}>} cell-click - Event that fires when a cell is clicked
|
|
1468
|
+
* @event {CustomEvent<HTMLElement>} cell-focused - Fires a custom 'cell-focused' event when focus is on the cell or its contents
|
|
1469
|
+
*/
|
|
1470
|
+
var DataGridCell = class extends require_localized.Localized(require_host_semantics.HostSemantics(require_vivid_element.VividElement)) {
|
|
1471
|
+
constructor(..._args) {
|
|
1472
|
+
super(..._args);
|
|
1473
|
+
this.cellType = require_data_grid_options.DataGridCellTypes.default;
|
|
1474
|
+
this.rowData = null;
|
|
1475
|
+
this.columnDefinition = null;
|
|
1476
|
+
this.isActiveCell = false;
|
|
1477
|
+
this.customCellView = null;
|
|
1478
|
+
this.updateCellStyle = () => {
|
|
1479
|
+
if (this.gridColumn && !this.gridColumn.includes("undefined")) this.style.gridColumn = this.gridColumn;
|
|
1480
|
+
else this.style.removeProperty("grid-column");
|
|
1481
|
+
};
|
|
1482
|
+
this._selectable = false;
|
|
1483
|
+
this.selected = false;
|
|
1484
|
+
this.ariaSelected = null;
|
|
1485
|
+
this.ariaSort = null;
|
|
1486
|
+
}
|
|
1487
|
+
/**
|
|
1488
|
+
* @internal
|
|
1489
|
+
*/
|
|
1490
|
+
cellTypeChanged() {
|
|
1491
|
+
if (this.$fastController.isConnected) this.updateCellView();
|
|
1492
|
+
}
|
|
1493
|
+
/**
|
|
1494
|
+
* @internal
|
|
1495
|
+
*/
|
|
1496
|
+
gridColumnChanged() {
|
|
1497
|
+
if (this.$fastController.isConnected) this.updateCellStyle();
|
|
1498
|
+
}
|
|
1499
|
+
/**
|
|
1500
|
+
* @internal
|
|
1501
|
+
*/
|
|
1502
|
+
columnDefinitionChanged(_oldValue, _newValue) {
|
|
1503
|
+
if (this.$fastController.isConnected) this.updateCellView();
|
|
1504
|
+
}
|
|
1505
|
+
/**
|
|
1506
|
+
* Updates the fixed column style
|
|
1507
|
+
* @internal
|
|
1508
|
+
*/
|
|
1509
|
+
updateFixedStyle() {
|
|
1510
|
+
if (this.fixedPosition !== void 0) {
|
|
1511
|
+
this.setAttribute("data-fixed", "");
|
|
1512
|
+
this.style.left = this.fixedPosition;
|
|
1513
|
+
} else {
|
|
1514
|
+
this.removeAttribute("data-fixed");
|
|
1515
|
+
this.style.removeProperty("left");
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
/**
|
|
1519
|
+
* Sets the fixed state and position for this cell
|
|
1520
|
+
* @internal
|
|
1521
|
+
*/
|
|
1522
|
+
setFixedPosition(position) {
|
|
1523
|
+
this.fixedPosition = position;
|
|
1524
|
+
this.updateFixedStyle();
|
|
1525
|
+
}
|
|
1526
|
+
/**
|
|
1527
|
+
* @internal
|
|
1528
|
+
*/
|
|
1529
|
+
connectedCallback() {
|
|
1530
|
+
super.connectedCallback();
|
|
1531
|
+
this.addEventListener(_microsoft_fast_web_utilities.eventFocusIn, this.handleFocusin);
|
|
1532
|
+
this.addEventListener(_microsoft_fast_web_utilities.eventFocusOut, this.handleFocusout);
|
|
1533
|
+
this.addEventListener(_microsoft_fast_web_utilities.eventKeyDown, this.handleKeydown);
|
|
1534
|
+
this.style.gridColumn = `${this.columnDefinition?.gridColumn === void 0 ? 0 : this.columnDefinition.gridColumn}`;
|
|
1535
|
+
this.updateCellView();
|
|
1536
|
+
this.updateCellStyle();
|
|
1537
|
+
this.updateFixedStyle();
|
|
1538
|
+
}
|
|
1539
|
+
/**
|
|
1540
|
+
* @internal
|
|
1541
|
+
*/
|
|
1542
|
+
disconnectedCallback() {
|
|
1543
|
+
super.disconnectedCallback();
|
|
1544
|
+
this.removeEventListener(_microsoft_fast_web_utilities.eventFocusIn, this.handleFocusin);
|
|
1545
|
+
this.removeEventListener(_microsoft_fast_web_utilities.eventFocusOut, this.handleFocusout);
|
|
1546
|
+
this.removeEventListener(_microsoft_fast_web_utilities.eventKeyDown, this.handleKeydown);
|
|
1547
|
+
this.disconnectCellView();
|
|
1548
|
+
}
|
|
1549
|
+
/**
|
|
1550
|
+
* @internal
|
|
1551
|
+
*/
|
|
1552
|
+
handleFocusin(_) {
|
|
1553
|
+
this.shadowRoot.querySelector(".base").classList.add("active");
|
|
1554
|
+
if (this.isActiveCell) return;
|
|
1555
|
+
this.isActiveCell = true;
|
|
1556
|
+
switch (this.cellType) {
|
|
1557
|
+
case require_data_grid_options.DataGridCellTypes.columnHeader:
|
|
1558
|
+
if (this.columnDefinition !== null && this.columnDefinition.headerCellInternalFocusQueue !== true && typeof this.columnDefinition.headerCellFocusTargetCallback === "function") {
|
|
1559
|
+
const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
|
|
1560
|
+
/* v8 ignore else -- @preserve */
|
|
1561
|
+
if (focusTarget !== null) focusTarget.focus();
|
|
1562
|
+
}
|
|
1563
|
+
break;
|
|
1564
|
+
default:
|
|
1565
|
+
if (this.columnDefinition !== null && this.columnDefinition.cellInternalFocusQueue !== true && typeof this.columnDefinition.cellFocusTargetCallback === "function") {
|
|
1566
|
+
const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
|
|
1567
|
+
/* v8 ignore else -- @preserve */
|
|
1568
|
+
if (focusTarget !== null) focusTarget.focus();
|
|
1569
|
+
}
|
|
1570
|
+
break;
|
|
1571
|
+
}
|
|
1572
|
+
this.$emit("cell-focused", this);
|
|
1573
|
+
}
|
|
1574
|
+
/**
|
|
1575
|
+
* @internal
|
|
1576
|
+
*/
|
|
1577
|
+
handleFocusout(_) {
|
|
1578
|
+
this.shadowRoot.querySelector(".base").classList.remove("active");
|
|
1579
|
+
/* v8 ignore else -- @preserve */
|
|
1580
|
+
if (this !== document.activeElement && !this.contains(document.activeElement)) this.isActiveCell = false;
|
|
1581
|
+
}
|
|
1582
|
+
/**
|
|
1583
|
+
* @internal
|
|
1584
|
+
*/
|
|
1585
|
+
handleKeydown(e) {
|
|
1586
|
+
if (e.defaultPrevented || this.columnDefinition === null || this.cellType === require_data_grid_options.DataGridCellTypes.default && this.columnDefinition.cellInternalFocusQueue !== true || this.cellType === require_data_grid_options.DataGridCellTypes.columnHeader && this.columnDefinition.headerCellInternalFocusQueue !== true) return;
|
|
1587
|
+
switch (e.key) {
|
|
1588
|
+
case _microsoft_fast_web_utilities.keyEnter:
|
|
1589
|
+
case _microsoft_fast_web_utilities.keyFunction2:
|
|
1590
|
+
if (this.contains(document.activeElement) && document.activeElement !== this) return;
|
|
1591
|
+
switch (this.cellType) {
|
|
1592
|
+
case require_data_grid_options.DataGridCellTypes.columnHeader:
|
|
1593
|
+
if (this.columnDefinition.headerCellFocusTargetCallback !== void 0) {
|
|
1594
|
+
const focusTarget = this.columnDefinition.headerCellFocusTargetCallback(this);
|
|
1595
|
+
/* v8 ignore else -- @preserve */
|
|
1596
|
+
if (focusTarget !== null) focusTarget.focus();
|
|
1597
|
+
e.preventDefault();
|
|
1598
|
+
}
|
|
1599
|
+
break;
|
|
1600
|
+
default:
|
|
1601
|
+
if (this.columnDefinition.cellFocusTargetCallback !== void 0) {
|
|
1602
|
+
const focusTarget = this.columnDefinition.cellFocusTargetCallback(this);
|
|
1603
|
+
/* v8 ignore else -- @preserve */
|
|
1604
|
+
if (focusTarget !== null) focusTarget.focus();
|
|
1605
|
+
e.preventDefault();
|
|
1606
|
+
}
|
|
1607
|
+
break;
|
|
1608
|
+
}
|
|
1609
|
+
break;
|
|
1610
|
+
case _microsoft_fast_web_utilities.keyEscape:
|
|
1611
|
+
/* v8 ignore else -- @preserve */
|
|
1612
|
+
if (this.contains(document.activeElement) && document.activeElement !== this) {
|
|
1613
|
+
this.focus();
|
|
1614
|
+
e.preventDefault();
|
|
1615
|
+
}
|
|
1616
|
+
break;
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
updateCellView() {
|
|
1620
|
+
this.disconnectCellView();
|
|
1621
|
+
if (this.columnDefinition === null) return;
|
|
1622
|
+
switch (this.cellType) {
|
|
1623
|
+
case require_data_grid_options.DataGridCellTypes.columnHeader:
|
|
1624
|
+
if (this.columnDefinition.headerCellTemplate !== void 0) this.customCellView = this.columnDefinition.headerCellTemplate.render(this, this);
|
|
1625
|
+
else this.customCellView = defaultHeaderCellContentsTemplate.render(this, this);
|
|
1626
|
+
break;
|
|
1627
|
+
case require_data_grid_options.DataGridCellTypes.rowHeader:
|
|
1628
|
+
case require_data_grid_options.DataGridCellTypes.default:
|
|
1629
|
+
if (this.columnDefinition.cellTemplate !== void 0) this.customCellView = this.columnDefinition.cellTemplate.render(this, this);
|
|
1630
|
+
else this.customCellView = defaultCellContentsTemplate.render(this, this);
|
|
1631
|
+
break;
|
|
1632
|
+
}
|
|
1633
|
+
if (!this.columnDefinition?.sortable) this.sortDirection = void 0;
|
|
1634
|
+
else if (this.columnDefinition.sortDirection) this.sortDirection = this.columnDefinition.sortDirection;
|
|
1635
|
+
else this.sortDirection = require_data_grid_options.DataGridCellSortStates.none;
|
|
1636
|
+
}
|
|
1637
|
+
disconnectCellView() {
|
|
1638
|
+
if (this.customCellView !== null) {
|
|
1639
|
+
this.customCellView.dispose();
|
|
1640
|
+
this.customCellView = null;
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
/**
|
|
1644
|
+
* @internal
|
|
1645
|
+
*/
|
|
1646
|
+
ariaSelectedChanged(prevValue, newValue) {
|
|
1647
|
+
super.ariaSelectedChanged(prevValue, newValue);
|
|
1648
|
+
this._selectable = newValue !== null;
|
|
1649
|
+
this.selected = newValue === "true";
|
|
1650
|
+
}
|
|
1651
|
+
/**
|
|
1652
|
+
* @internal
|
|
1653
|
+
*/
|
|
1654
|
+
ariaSortChanged(oldValue, newValue) {
|
|
1655
|
+
super.ariaSortChanged(oldValue, newValue);
|
|
1656
|
+
if (newValue === null) {
|
|
1657
|
+
this.sortDirection = void 0;
|
|
1658
|
+
return;
|
|
1659
|
+
}
|
|
1660
|
+
this.sortDirection = newValue;
|
|
1661
|
+
}
|
|
1662
|
+
#getColumnDataKey() {
|
|
1663
|
+
return this.columnDefinition && this.columnDefinition.columnDataKey ? this.columnDefinition.columnDataKey : this.textContent.trim();
|
|
1664
|
+
}
|
|
1665
|
+
/**
|
|
1666
|
+
* @internal
|
|
1667
|
+
*/
|
|
1668
|
+
_handleInteraction() {
|
|
1669
|
+
const isHeaderCell = this.cellType === "columnheader";
|
|
1670
|
+
if (isHeaderCell && this.sortDirection !== void 0) this.$emit("sort", {
|
|
1671
|
+
columnDataKey: this.#getColumnDataKey(),
|
|
1672
|
+
sortDirection: this.sortDirection
|
|
1673
|
+
});
|
|
1674
|
+
if (!(isHeaderCell ? this.columnDefinition?.headerCellInternalFocusQueue : this.columnDefinition?.cellInternalFocusQueue)) this.$emit("cell-click", {
|
|
1675
|
+
cell: this,
|
|
1676
|
+
row: this.parentElement,
|
|
1677
|
+
isHeaderCell,
|
|
1678
|
+
columnDataKey: this.#getColumnDataKey()
|
|
1679
|
+
});
|
|
1680
|
+
return true;
|
|
1681
|
+
}
|
|
1682
|
+
};
|
|
1683
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "cell-type" })], DataGridCell.prototype, "cellType", void 0);
|
|
1684
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "grid-column" })], DataGridCell.prototype, "gridColumn", void 0);
|
|
1685
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridCell.prototype, "rowData", void 0);
|
|
1686
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridCell.prototype, "columnDefinition", void 0);
|
|
1687
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridCell.prototype, "_selectable", void 0);
|
|
1688
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ mode: "boolean" })], DataGridCell.prototype, "selected", void 0);
|
|
1689
|
+
require_decorate.__decorate([(0, _microsoft_fast_element.attr)({ attribute: "sort-direction" })], DataGridCell.prototype, "sortDirection", void 0);
|
|
1690
|
+
require_decorate.__decorate([_microsoft_fast_element.observable], DataGridCell.prototype, "_actionItemsSlottedContent", void 0);
|
|
1691
|
+
//#endregion
|
|
1692
1692
|
//#region src/lib/data-grid/data-grid-row.template.ts
|
|
1693
1693
|
function calculateAriaSelectedValue$1(x) {
|
|
1694
1694
|
if (x._selectable && x.selected) return "true";
|