@ni/nimble-components 29.7.8 → 29.8.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.
Files changed (57) hide show
  1. package/dist/all-components-bundle.js +506 -236
  2. package/dist/all-components-bundle.js.map +1 -1
  3. package/dist/all-components-bundle.min.js +1871 -1785
  4. package/dist/all-components-bundle.min.js.map +1 -1
  5. package/dist/esm/all-components.d.ts +1 -0
  6. package/dist/esm/all-components.js +1 -0
  7. package/dist/esm/all-components.js.map +1 -1
  8. package/dist/esm/menu-button/testing/menu-button.pageobject.d.ts +12 -0
  9. package/dist/esm/menu-button/testing/menu-button.pageobject.js +26 -0
  10. package/dist/esm/menu-button/testing/menu-button.pageobject.js.map +1 -1
  11. package/dist/esm/patterns/button/styles.js +8 -0
  12. package/dist/esm/patterns/button/styles.js.map +1 -1
  13. package/dist/esm/select/index.js +20 -9
  14. package/dist/esm/select/index.js.map +1 -1
  15. package/dist/esm/table/components/row/index.d.ts +2 -1
  16. package/dist/esm/table/components/row/index.js +14 -0
  17. package/dist/esm/table/components/row/index.js.map +1 -1
  18. package/dist/esm/table/components/row/template.js +9 -0
  19. package/dist/esm/table/components/row/template.js.map +1 -1
  20. package/dist/esm/table/index.d.ts +6 -1
  21. package/dist/esm/table/index.js +40 -1
  22. package/dist/esm/table/index.js.map +1 -1
  23. package/dist/esm/table/models/utilities.d.ts +3 -0
  24. package/dist/esm/table/models/utilities.js +7 -0
  25. package/dist/esm/table/models/utilities.js.map +1 -0
  26. package/dist/esm/table/template.js +7 -0
  27. package/dist/esm/table/template.js.map +1 -1
  28. package/dist/esm/table/types.d.ts +22 -2
  29. package/dist/esm/table/types.js +0 -1
  30. package/dist/esm/table/types.js.map +1 -1
  31. package/dist/esm/table-column/base/cell-view/template.js +9 -1
  32. package/dist/esm/table-column/base/cell-view/template.js.map +1 -1
  33. package/dist/esm/table-column/base/models/column-internals.d.ts +10 -2
  34. package/dist/esm/table-column/base/models/column-internals.js +6 -3
  35. package/dist/esm/table-column/base/models/column-internals.js.map +1 -1
  36. package/dist/esm/table-column/menu-button/cell-view/index.d.ts +32 -0
  37. package/dist/esm/table-column/menu-button/cell-view/index.js +70 -0
  38. package/dist/esm/table-column/menu-button/cell-view/index.js.map +1 -0
  39. package/dist/esm/table-column/menu-button/cell-view/styles.d.ts +1 -0
  40. package/dist/esm/table-column/menu-button/cell-view/styles.js +21 -0
  41. package/dist/esm/table-column/menu-button/cell-view/styles.js.map +1 -0
  42. package/dist/esm/table-column/menu-button/cell-view/templates.d.ts +2 -0
  43. package/dist/esm/table-column/menu-button/cell-view/templates.js +25 -0
  44. package/dist/esm/table-column/menu-button/cell-view/templates.js.map +1 -0
  45. package/dist/esm/table-column/menu-button/index.d.ts +42 -0
  46. package/dist/esm/table-column/menu-button/index.js +68 -0
  47. package/dist/esm/table-column/menu-button/index.js.map +1 -0
  48. package/dist/esm/table-column/menu-button/template.d.ts +2 -0
  49. package/dist/esm/table-column/menu-button/template.js +8 -0
  50. package/dist/esm/table-column/menu-button/template.js.map +1 -0
  51. package/dist/esm/table-column/menu-button/testing/table-column-menu-button.pageobject.d.ts +11 -0
  52. package/dist/esm/table-column/menu-button/testing/table-column-menu-button.pageobject.js +18 -0
  53. package/dist/esm/table-column/menu-button/testing/table-column-menu-button.pageobject.js.map +1 -0
  54. package/dist/esm/table-column/menu-button/types.d.ts +10 -0
  55. package/dist/esm/table-column/menu-button/types.js +3 -0
  56. package/dist/esm/table-column/menu-button/types.js.map +1 -0
  57. package/package.json +1 -1
@@ -186,10 +186,10 @@ export interface TableRowState<TData extends TableRecord = TableRecord> {
186
186
  groupColumn?: TableColumn;
187
187
  isParentRow: boolean;
188
188
  isLoadingChildren: boolean;
189
+ slots: SlotMetadata[];
189
190
  resolvedRowIndex?: number;
190
191
  }
191
192
  /**
192
- * @internal
193
193
  * Table keyboard focus types
194
194
  */
195
195
  export declare const TableFocusType: {
@@ -215,10 +215,30 @@ export interface TableRowFocusableElements {
215
215
  }[];
216
216
  }
217
217
  /**
218
- * @internal
219
218
  * Focusable elements of a table's header
220
219
  */
221
220
  export interface TableHeaderFocusableElements {
222
221
  headerActions: HTMLElement[];
223
222
  columnHeaders: HTMLElement[];
224
223
  }
224
+ /**
225
+ * @internal
226
+ */
227
+ export interface CellViewSlotRequestEventDetail {
228
+ slots: SlotMetadata[];
229
+ }
230
+ /**
231
+ * @internal
232
+ */
233
+ export interface RowSlotRequestEventDetail {
234
+ columnInternalId: string;
235
+ recordId: string;
236
+ slots: SlotMetadata[];
237
+ }
238
+ /**
239
+ * @internal
240
+ */
241
+ export interface SlotMetadata {
242
+ slot: string;
243
+ name: string;
244
+ }
@@ -30,7 +30,6 @@ export const TableRowSelectionState = {
30
30
  partiallySelected: 'partially-selected'
31
31
  };
32
32
  /**
33
- * @internal
34
33
  * Table keyboard focus types
35
34
  */
36
35
  export const TableFocusType = {
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/table/types.ts"],"names":[],"mappings":"AAkGA,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC5C,IAAI,EAAE,SAAS;IACf,eAAe,EAAE,mBAAmB;IACpC,eAAe,EAAE,kBAAkB;CAC7B,CAAC;AAWX;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACpC,IAAI,EAAE,SAAS;IACf,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;CAClB,CAAC;AAIX;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACjC,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;CACd,CAAC;AAIX;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IAClC,WAAW,EAAE,cAAc;IAC3B,QAAQ,EAAE,UAAU;IACpB,iBAAiB,EAAE,oBAAoB;CACjC,CAAC;AA2EX;;;GAGG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,IAAI,EAAE,MAAM;IACZ,YAAY,EAAE,cAAc;IAC5B,aAAa,EAAE,eAAe;IAC9B,GAAG,EAAE,KAAK;IACV,oBAAoB,EAAE,sBAAsB;IAC5C,IAAI,EAAE,MAAM;IACZ,cAAc,EAAE,gBAAgB;IAChC,WAAW,EAAE,aAAa;CACpB,CAAC","sourcesContent":["import type { Checkbox } from '../checkbox';\nimport type { MenuButton } from '../menu-button';\nimport type { TableColumn } from '../table-column/base';\nimport type { ValidityObject } from '../utilities/models/validator';\nimport type { TableCell } from './components/cell';\n\n/**\n * TableFieldName describes the type associated with keys within\n * a table's records.\n */\nexport type TableFieldName = string;\n\n/**\n * TableFieldValue describes the type associated with values within\n * a table's records.\n */\nexport type TableFieldValue = string | number | boolean | null | undefined;\n\n/**\n * TableStringFieldValue describes the type associated with values within\n * a table's string records.\n */\nexport type TableStringFieldValue = string | null | undefined;\n\n/**\n * TableBooleanFieldValue describes the type associated with values within\n * a table's boolean records.\n */\nexport type TableBooleanFieldValue = boolean | null | undefined;\n\n/**\n * TableNumberFieldValue describes the type associated with values within\n * a table's number records.\n */\nexport type TableNumberFieldValue = number | null | undefined;\n\n/**\n * TableRecord describes the data structure that backs a single row in a table.\n * It is made up of fields, which are key/value pairs that have a key of type\n * TableFieldName and a value of type TableFieldValue.\n */\nexport interface TableRecord {\n [key: TableFieldName]: TableFieldValue;\n}\n\n/**\n * @internal\n *\n * Describes a hierarchical data structure that is used for\n * the internal representation of the data, and allows us to represent data with\n * parent-child relationships within Tanstack.\n */\nexport interface TableNode<TRecord extends TableRecord = TableRecord> {\n subRows?: TableNode<TRecord>[];\n originalIndex: number;\n clientRecord: TRecord;\n}\n\nexport type TableStringField<FieldName extends TableFieldName> = {\n [name in FieldName]: TableStringFieldValue;\n};\n\nexport type TableBooleanField<FieldName extends TableFieldName> = {\n [name in FieldName]: TableBooleanFieldValue;\n};\n\nexport type TableNumberField<FieldName extends TableFieldName> = {\n [name in FieldName]: TableNumberFieldValue;\n};\n\nexport interface TableValidity extends ValidityObject {\n readonly duplicateRecordId: boolean;\n readonly missingRecordId: boolean;\n readonly invalidRecordId: boolean;\n readonly duplicateColumnId: boolean;\n readonly missingColumnId: boolean;\n readonly duplicateSortIndex: boolean;\n readonly duplicateGroupIndex: boolean;\n readonly idFieldNameNotConfigured: boolean;\n readonly invalidColumnConfiguration: boolean;\n readonly invalidParentIdConfiguration: boolean;\n}\n\n/**\n * The hierarachy options for a record in the table.\n */\nexport interface TableSetRecordHierarchyOptions {\n recordId: string;\n options: TableRecordHierarchyOptions;\n}\n\n/**\n * Describes the hierarchy options that can be configured for a record in the table.\n */\nexport interface TableRecordHierarchyOptions {\n delayedHierarchyState: TableRecordDelayedHierarchyState;\n}\n\nexport const TableRecordDelayedHierarchyState = {\n none: undefined,\n canLoadChildren: 'can-load-children',\n loadingChildren: 'loading-children'\n} as const;\nexport type TableRecordDelayedHierarchyState =\n (typeof TableRecordDelayedHierarchyState)[keyof typeof TableRecordDelayedHierarchyState];\n\nexport interface TableActionMenuToggleEventDetail {\n newState: boolean;\n oldState: boolean;\n recordIds: string[];\n columnId?: string;\n}\n\n/**\n * The possible directions a table column can be sorted in.\n */\nexport const TableColumnSortDirection = {\n none: undefined,\n ascending: 'ascending',\n descending: 'descending'\n} as const;\nexport type TableColumnSortDirection =\n (typeof TableColumnSortDirection)[keyof typeof TableColumnSortDirection];\n\n/**\n * The selection modes of rows in the table.\n */\nexport const TableRowSelectionMode = {\n none: undefined,\n single: 'single',\n multiple: 'multiple'\n} as const;\nexport type TableRowSelectionMode =\n (typeof TableRowSelectionMode)[keyof typeof TableRowSelectionMode];\n\n/**\n * @internal\n *\n * The possible selection states that the table or a table row can be in.\n */\nexport const TableRowSelectionState = {\n notSelected: 'not-selected',\n selected: 'selected',\n partiallySelected: 'partially-selected'\n} as const;\nexport type TableRowSelectionState =\n (typeof TableRowSelectionState)[keyof typeof TableRowSelectionState];\n\n/**\n * @internal\n *\n * Internal event detail type for a row's selection state changing\n */\nexport interface TableRowSelectionToggleEventDetail {\n oldState: boolean;\n newState: boolean;\n}\n\n/**\n * Event detail type for row selection events in the table.\n */\nexport interface TableRowSelectionEventDetail {\n selectedRecordIds: string[];\n}\n\n/**\n * Event detail type for row toggle events in the table.\n */\nexport interface TableRowExpansionToggleEventDetail {\n oldState: boolean;\n newState: boolean;\n recordId: string;\n}\n\n/**\n * Event detail type for interactive column configuration changes.\n *\n * The column-configuration-change event is emitted when a column's configuration\n * is modified programmatically, such as by clicking on the column's header to sort\n * the column. The items in the `columns` array are specified in the same order as\n * the columns are listed in the DOM.\n */\nexport interface TableColumnConfigurationChangeEventDetail {\n columns: TableColumnConfiguration[];\n}\n\n/**\n * A representation of the current configuration of a column within the table.\n */\nexport interface TableColumnConfiguration {\n columnId?: string;\n sortIndex?: number;\n sortDirection: TableColumnSortDirection;\n groupIndex?: number;\n hidden: boolean;\n fractionalWidth: number;\n pixelWidth?: number;\n}\n\n/**\n * @internal\n *\n * Internal representation of a row in the table\n */\nexport interface TableRowState<TData extends TableRecord = TableRecord> {\n record: TData;\n id: string;\n selectionState: TableRowSelectionState;\n isGroupRow: boolean;\n groupRowValue?: unknown;\n isExpanded: boolean;\n nestingLevel?: number;\n immediateChildCount?: number;\n groupColumn?: TableColumn;\n isParentRow: boolean;\n isLoadingChildren: boolean;\n resolvedRowIndex?: number;\n}\n\n/**\n * @internal\n * Table keyboard focus types\n */\nexport const TableFocusType = {\n none: 'none',\n columnHeader: 'columnHeader',\n headerActions: 'headerActions',\n row: 'row',\n rowSelectionCheckbox: 'rowSelectionCheckbox',\n cell: 'cell',\n cellActionMenu: 'cellActionMenu',\n cellContent: 'cellContent'\n} as const;\nexport type TableFocusType =\n (typeof TableFocusType)[keyof typeof TableFocusType];\n\n/**\n * @internal\n * Focusable elements of a table row\n */\nexport interface TableRowFocusableElements {\n selectionCheckbox?: Checkbox;\n cells: {\n cell: TableCell,\n actionMenuButton?: MenuButton\n }[];\n}\n\n/**\n * @internal\n * Focusable elements of a table's header\n */\nexport interface TableHeaderFocusableElements {\n headerActions: HTMLElement[];\n columnHeaders: HTMLElement[];\n}\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/table/types.ts"],"names":[],"mappings":"AAkGA,MAAM,CAAC,MAAM,gCAAgC,GAAG;IAC5C,IAAI,EAAE,SAAS;IACf,eAAe,EAAE,mBAAmB;IACpC,eAAe,EAAE,kBAAkB;CAC7B,CAAC;AAWX;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACpC,IAAI,EAAE,SAAS;IACf,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,YAAY;CAClB,CAAC;AAIX;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACjC,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,QAAQ;IAChB,QAAQ,EAAE,UAAU;CACd,CAAC;AAIX;;;;GAIG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG;IAClC,WAAW,EAAE,cAAc;IAC3B,QAAQ,EAAE,UAAU;IACpB,iBAAiB,EAAE,oBAAoB;CACjC,CAAC;AA2EX;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC1B,IAAI,EAAE,MAAM;IACZ,YAAY,EAAE,cAAc;IAC5B,aAAa,EAAE,eAAe;IAC9B,GAAG,EAAE,KAAK;IACV,oBAAoB,EAAE,sBAAsB;IAC5C,IAAI,EAAE,MAAM;IACZ,cAAc,EAAE,gBAAgB;IAChC,WAAW,EAAE,aAAa;CACpB,CAAC","sourcesContent":["import type { Checkbox } from '../checkbox';\nimport type { MenuButton } from '../menu-button';\nimport type { TableColumn } from '../table-column/base';\nimport type { ValidityObject } from '../utilities/models/validator';\nimport type { TableCell } from './components/cell';\n\n/**\n * TableFieldName describes the type associated with keys within\n * a table's records.\n */\nexport type TableFieldName = string;\n\n/**\n * TableFieldValue describes the type associated with values within\n * a table's records.\n */\nexport type TableFieldValue = string | number | boolean | null | undefined;\n\n/**\n * TableStringFieldValue describes the type associated with values within\n * a table's string records.\n */\nexport type TableStringFieldValue = string | null | undefined;\n\n/**\n * TableBooleanFieldValue describes the type associated with values within\n * a table's boolean records.\n */\nexport type TableBooleanFieldValue = boolean | null | undefined;\n\n/**\n * TableNumberFieldValue describes the type associated with values within\n * a table's number records.\n */\nexport type TableNumberFieldValue = number | null | undefined;\n\n/**\n * TableRecord describes the data structure that backs a single row in a table.\n * It is made up of fields, which are key/value pairs that have a key of type\n * TableFieldName and a value of type TableFieldValue.\n */\nexport interface TableRecord {\n [key: TableFieldName]: TableFieldValue;\n}\n\n/**\n * @internal\n *\n * Describes a hierarchical data structure that is used for\n * the internal representation of the data, and allows us to represent data with\n * parent-child relationships within Tanstack.\n */\nexport interface TableNode<TRecord extends TableRecord = TableRecord> {\n subRows?: TableNode<TRecord>[];\n originalIndex: number;\n clientRecord: TRecord;\n}\n\nexport type TableStringField<FieldName extends TableFieldName> = {\n [name in FieldName]: TableStringFieldValue;\n};\n\nexport type TableBooleanField<FieldName extends TableFieldName> = {\n [name in FieldName]: TableBooleanFieldValue;\n};\n\nexport type TableNumberField<FieldName extends TableFieldName> = {\n [name in FieldName]: TableNumberFieldValue;\n};\n\nexport interface TableValidity extends ValidityObject {\n readonly duplicateRecordId: boolean;\n readonly missingRecordId: boolean;\n readonly invalidRecordId: boolean;\n readonly duplicateColumnId: boolean;\n readonly missingColumnId: boolean;\n readonly duplicateSortIndex: boolean;\n readonly duplicateGroupIndex: boolean;\n readonly idFieldNameNotConfigured: boolean;\n readonly invalidColumnConfiguration: boolean;\n readonly invalidParentIdConfiguration: boolean;\n}\n\n/**\n * The hierarachy options for a record in the table.\n */\nexport interface TableSetRecordHierarchyOptions {\n recordId: string;\n options: TableRecordHierarchyOptions;\n}\n\n/**\n * Describes the hierarchy options that can be configured for a record in the table.\n */\nexport interface TableRecordHierarchyOptions {\n delayedHierarchyState: TableRecordDelayedHierarchyState;\n}\n\nexport const TableRecordDelayedHierarchyState = {\n none: undefined,\n canLoadChildren: 'can-load-children',\n loadingChildren: 'loading-children'\n} as const;\nexport type TableRecordDelayedHierarchyState =\n (typeof TableRecordDelayedHierarchyState)[keyof typeof TableRecordDelayedHierarchyState];\n\nexport interface TableActionMenuToggleEventDetail {\n newState: boolean;\n oldState: boolean;\n recordIds: string[];\n columnId?: string;\n}\n\n/**\n * The possible directions a table column can be sorted in.\n */\nexport const TableColumnSortDirection = {\n none: undefined,\n ascending: 'ascending',\n descending: 'descending'\n} as const;\nexport type TableColumnSortDirection =\n (typeof TableColumnSortDirection)[keyof typeof TableColumnSortDirection];\n\n/**\n * The selection modes of rows in the table.\n */\nexport const TableRowSelectionMode = {\n none: undefined,\n single: 'single',\n multiple: 'multiple'\n} as const;\nexport type TableRowSelectionMode =\n (typeof TableRowSelectionMode)[keyof typeof TableRowSelectionMode];\n\n/**\n * @internal\n *\n * The possible selection states that the table or a table row can be in.\n */\nexport const TableRowSelectionState = {\n notSelected: 'not-selected',\n selected: 'selected',\n partiallySelected: 'partially-selected'\n} as const;\nexport type TableRowSelectionState =\n (typeof TableRowSelectionState)[keyof typeof TableRowSelectionState];\n\n/**\n * @internal\n *\n * Internal event detail type for a row's selection state changing\n */\nexport interface TableRowSelectionToggleEventDetail {\n oldState: boolean;\n newState: boolean;\n}\n\n/**\n * Event detail type for row selection events in the table.\n */\nexport interface TableRowSelectionEventDetail {\n selectedRecordIds: string[];\n}\n\n/**\n * Event detail type for row toggle events in the table.\n */\nexport interface TableRowExpansionToggleEventDetail {\n oldState: boolean;\n newState: boolean;\n recordId: string;\n}\n\n/**\n * Event detail type for interactive column configuration changes.\n *\n * The column-configuration-change event is emitted when a column's configuration\n * is modified programmatically, such as by clicking on the column's header to sort\n * the column. The items in the `columns` array are specified in the same order as\n * the columns are listed in the DOM.\n */\nexport interface TableColumnConfigurationChangeEventDetail {\n columns: TableColumnConfiguration[];\n}\n\n/**\n * A representation of the current configuration of a column within the table.\n */\nexport interface TableColumnConfiguration {\n columnId?: string;\n sortIndex?: number;\n sortDirection: TableColumnSortDirection;\n groupIndex?: number;\n hidden: boolean;\n fractionalWidth: number;\n pixelWidth?: number;\n}\n\n/**\n * @internal\n *\n * Internal representation of a row in the table\n */\nexport interface TableRowState<TData extends TableRecord = TableRecord> {\n record: TData;\n id: string;\n selectionState: TableRowSelectionState;\n isGroupRow: boolean;\n groupRowValue?: unknown;\n isExpanded: boolean;\n nestingLevel?: number;\n immediateChildCount?: number;\n groupColumn?: TableColumn;\n isParentRow: boolean;\n isLoadingChildren: boolean;\n slots: SlotMetadata[];\n resolvedRowIndex?: number;\n}\n/**\n * Table keyboard focus types\n */\nexport const TableFocusType = {\n none: 'none',\n columnHeader: 'columnHeader',\n headerActions: 'headerActions',\n row: 'row',\n rowSelectionCheckbox: 'rowSelectionCheckbox',\n cell: 'cell',\n cellActionMenu: 'cellActionMenu',\n cellContent: 'cellContent'\n} as const;\nexport type TableFocusType =\n (typeof TableFocusType)[keyof typeof TableFocusType];\n\n/**\n * @internal\n * Focusable elements of a table row\n */\nexport interface TableRowFocusableElements {\n selectionCheckbox?: Checkbox;\n cells: {\n cell: TableCell,\n actionMenuButton?: MenuButton\n }[];\n}\n\n/**\n * Focusable elements of a table's header\n */\nexport interface TableHeaderFocusableElements {\n headerActions: HTMLElement[];\n columnHeaders: HTMLElement[];\n}\n\n/**\n * @internal\n */\nexport interface CellViewSlotRequestEventDetail {\n slots: SlotMetadata[];\n}\n\n/**\n * @internal\n */\nexport interface RowSlotRequestEventDetail {\n columnInternalId: string;\n recordId: string;\n slots: SlotMetadata[];\n}\n\n/**\n * @internal\n */\nexport interface SlotMetadata {\n slot: string;\n name: string;\n}\n"]}
@@ -1,5 +1,6 @@
1
- import { html } from '@microsoft/fast-element';
1
+ import { html, repeat } from '@microsoft/fast-element';
2
2
  import { TableCellView } from '.';
3
+ import { uniquifySlotNameForColumn } from '../../../table/models/utilities';
3
4
  const validateCellViewTemplate = (cellViewTag) => {
4
5
  let instance;
5
6
  try {
@@ -12,6 +13,7 @@ const validateCellViewTemplate = (cellViewTag) => {
12
13
  throw new Error(`Cell view tag name (${cellViewTag}) must evaluate to an element extending TableCellView`);
13
14
  }
14
15
  };
16
+ // prettier-ignore
15
17
  export const createCellViewTemplate = (cellViewTag) => {
16
18
  validateCellViewTemplate(cellViewTag);
17
19
  return html `
@@ -22,6 +24,12 @@ export const createCellViewTemplate = (cellViewTag) => {
22
24
  :recordId="${y => y.recordId}"
23
25
  class="cell-view"
24
26
  >
27
+ ${repeat(y => y.column?.columnInternals.slotNames || [], html `
28
+ <slot
29
+ name="${(x, c) => uniquifySlotNameForColumn(c.parent.column, x)}"
30
+ slot="${x => x}"
31
+ ></slot>
32
+ `)}
25
33
  </${cellViewTag}>
26
34
  `;
27
35
  };
@@ -1 +1 @@
1
- {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../../src/table-column/base/cell-view/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,GAAG,CAAC;AAElC,MAAM,wBAAwB,GAAG,CAAC,WAAmB,EAAQ,EAAE;IAC3D,IAAI,QAAQ,CAAC;IACb,IAAI;QACA,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;KAClD;IAAC,OAAO,EAAE,EAAE;QACT,oDAAoD;KACvD;IACD,IAAI,CAAC,CAAC,QAAQ,YAAY,aAAa,CAAC,EAAE;QACtC,MAAM,IAAI,KAAK,CACX,uBAAuB,WAAW,uDAAuD,CAC5F,CAAC;KACL;AACL,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAClC,WAAmB,EACI,EAAE;IACzB,wBAAwB,CAAC,WAAW,CAAC,CAAC;IACtC,OAAO,IAAI,CAAW;WACf,WAAW;2BACK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,UAAU;6BAC1B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,YAAY;uBACpC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM;yBACX,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;;;YAG5B,WAAW;KAClB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { type ViewTemplate, html } from '@microsoft/fast-element';\nimport type { TableCell } from '../../../table/components/cell';\nimport { TableCellView } from '.';\n\nconst validateCellViewTemplate = (cellViewTag: string): void => {\n let instance;\n try {\n instance = document.createElement(cellViewTag);\n } catch (ex) {\n // Swallow construction error to report a better one\n }\n if (!(instance instanceof TableCellView)) {\n throw new Error(\n `Cell view tag name (${cellViewTag}) must evaluate to an element extending TableCellView`\n );\n }\n};\n\nexport const createCellViewTemplate = (\n cellViewTag: string\n): ViewTemplate<TableCell> => {\n validateCellViewTemplate(cellViewTag);\n return html<TableCell>`\n <${cellViewTag}\n :cellRecord=\"${y => y.cellState?.cellRecord}\"\n :columnConfig=\"${y => y.cellState?.columnConfig}\"\n :column=\"${y => y.column}\"\n :recordId=\"${y => y.recordId}\"\n class=\"cell-view\"\n >\n </${cellViewTag}>\n `;\n};\n"]}
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../../src/table-column/base/cell-view/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,IAAI,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,EAAE,aAAa,EAAE,MAAM,GAAG,CAAC;AAClC,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAE5E,MAAM,wBAAwB,GAAG,CAAC,WAAmB,EAAQ,EAAE;IAC3D,IAAI,QAAQ,CAAC;IACb,IAAI;QACA,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;KAClD;IAAC,OAAO,EAAE,EAAE;QACT,oDAAoD;KACvD;IACD,IAAI,CAAC,CAAC,QAAQ,YAAY,aAAa,CAAC,EAAE;QACtC,MAAM,IAAI,KAAK,CACX,uBAAuB,WAAW,uDAAuD,CAC5F,CAAC;KACL;AACL,CAAC,CAAC;AAEF,kBAAkB;AAClB,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAClC,WAAmB,EACI,EAAE;IACzB,wBAAwB,CAAC,WAAW,CAAC,CAAC;IACtC,OAAO,IAAI,CAAW;WACf,WAAW;2BACK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,UAAU;6BAC1B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,EAAE,YAAY;uBACpC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM;yBACX,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ;;;cAG1B,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,EAAE,eAAe,CAAC,SAAS,IAAI,EAAE,EAAE,IAAI,CAAmB;;4BAEhE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,yBAAyB,CAAC,CAAC,CAAC,MAAM,CAAC,MAAO,EAAE,CAAC,CAAC;4BACxD,CAAC,CAAC,EAAE,CAAC,CAAC;;aAErB,CAAC;YACF,WAAW;KAClB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import { type ViewTemplate, html, repeat } from '@microsoft/fast-element';\nimport type { TableCell } from '../../../table/components/cell';\nimport { TableCellView } from '.';\nimport { uniquifySlotNameForColumn } from '../../../table/models/utilities';\n\nconst validateCellViewTemplate = (cellViewTag: string): void => {\n let instance;\n try {\n instance = document.createElement(cellViewTag);\n } catch (ex) {\n // Swallow construction error to report a better one\n }\n if (!(instance instanceof TableCellView)) {\n throw new Error(\n `Cell view tag name (${cellViewTag}) must evaluate to an element extending TableCellView`\n );\n }\n};\n\n// prettier-ignore\nexport const createCellViewTemplate = (\n cellViewTag: string\n): ViewTemplate<TableCell> => {\n validateCellViewTemplate(cellViewTag);\n return html<TableCell>`\n <${cellViewTag}\n :cellRecord=\"${y => y.cellState?.cellRecord}\"\n :columnConfig=\"${y => y.cellState?.columnConfig}\"\n :column=\"${y => y.column}\"\n :recordId=\"${y => y.recordId}\"\n class=\"cell-view\"\n >\n ${repeat(y => y.column?.columnInternals.slotNames || [], html<string, TableCell>`\n <slot\n name=\"${(x, c) => uniquifySlotNameForColumn(c.parent.column!, x)}\"\n slot=\"${x => x}\"\n ></slot>\n `)}\n </${cellViewTag}>\n `;\n};\n"]}
@@ -19,11 +19,15 @@ export interface ColumnInternalsOptions<TColumnValidator extends ColumnValidator
19
19
  * The tag to use to render the group header content for a column.
20
20
  * The element this tag refers to must derive from TableGroupHeaderView.
21
21
  */
22
- readonly groupHeaderViewTag: string;
22
+ readonly groupHeaderViewTag?: string;
23
23
  /**
24
24
  * The names of events that should be delegated from the cell view to the column.
25
25
  */
26
26
  readonly delegatedEvents: readonly string[];
27
+ /**
28
+ * The names of slots that need to be forwarded into a cell.
29
+ */
30
+ readonly slotNames?: readonly string[];
27
31
  /**
28
32
  * The sort operation to use for the column (defaults to TableColumnSortOperation.basic)
29
33
  */
@@ -54,6 +58,10 @@ export declare class ColumnInternals<TColumnConfig, TColumnValidator extends Col
54
58
  * The names of events that should be delegated from the cell view to the column.
55
59
  */
56
60
  readonly delegatedEvents: readonly string[];
61
+ /**
62
+ * The names of slots that need to be forwarded into a cell.
63
+ */
64
+ readonly slotNames: readonly string[];
57
65
  /**
58
66
  * The relevant, static configuration a column requires its cell view to have access to.
59
67
  */
@@ -74,7 +82,7 @@ export declare class ColumnInternals<TColumnConfig, TColumnValidator extends Col
74
82
  /**
75
83
  * Template for the group header view
76
84
  */
77
- readonly groupHeaderViewTemplate: ViewTemplate<TableGroupRow>;
85
+ readonly groupHeaderViewTemplate?: ViewTemplate<TableGroupRow>;
78
86
  /**
79
87
  * Whether or not this column can be used to group rows by
80
88
  */
@@ -27,7 +27,7 @@ export class ColumnInternals {
27
27
  /**
28
28
  * Whether or not this column can be used to group rows by
29
29
  */
30
- this.groupingDisabled = false;
30
+ this.groupingDisabled = true;
31
31
  /**
32
32
  * Used by column plugins to size a column proportionally to the available
33
33
  * width of a row. Sets currentFractionalWidth when changed.
@@ -54,7 +54,7 @@ export class ColumnInternals {
54
54
  /**
55
55
  * Whether or not this column can be sorted
56
56
  */
57
- this.sortingDisabled = false;
57
+ this.sortingDisabled = true;
58
58
  /**
59
59
  * @internal Do not write to this value directly. It is used by the Table in order to store
60
60
  * the resolved value of the sortDirection after programmatic or interactive updates.
@@ -62,8 +62,11 @@ export class ColumnInternals {
62
62
  this.currentSortDirection = TableColumnSortDirection.none;
63
63
  this.cellRecordFieldNames = options.cellRecordFieldNames;
64
64
  this.cellViewTemplate = createCellViewTemplate(options.cellViewTag);
65
- this.groupHeaderViewTemplate = createGroupHeaderViewTemplate(options.groupHeaderViewTag);
65
+ if (options.groupHeaderViewTag) {
66
+ this.groupHeaderViewTemplate = createGroupHeaderViewTemplate(options.groupHeaderViewTag);
67
+ }
66
68
  this.delegatedEvents = options.delegatedEvents;
69
+ this.slotNames = options.slotNames ?? [];
67
70
  this.sortOperation = options.sortOperation ?? TableColumnSortOperation.basic;
68
71
  this.validator = options.validator;
69
72
  }
@@ -1 +1 @@
1
- {"version":3,"file":"column-internals.js","sourceRoot":"","sources":["../../../../../src/table-column/base/models/column-internals.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAgB,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAkB,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EACH,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,EACvB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAwC/D;;;GAGG;AACH,MAAM,OAAO,eAAe;IAwIxB,YAAmB,OAAiD;QA/HpE;;WAEG;QACa,aAAQ,G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AU;6DAC+D;AAWnE;IADN,UAAU;yDACqB;AAQzB;IADN,UAAU;mDACgB;AAMpB;IADN,UAAU;mDACgB;AAOpB;IADN,UAAU;wDACqC;AAMzC;IADN,UAAU;sDACiC;AAMrC;IADN,UAAU;yDACqB;AAOzB;IADN,UAAU;6DACyB;AAO7B;IADN,UAAU;+DAC4C;AAOhD;IADN,UAAU;0DACuB;AAM3B;IADN,UAAU;wDACoB;AAOxB;IADN,UAAU;yDACsB;AAO1B;IADN,UAAU;6DAC2E;AAwB1F,MAAM,UAAU,yBAAyB,CACrC,eAAuB,EACvB,GAAG,IAA6D;IAEhE,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;QACpB,IAAI,eAAe,KAAK,GAAG,EAAE;YACzB,OAAO,IAAI,CAAC;SACf;KACJ;IACD,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["import { uniqueId } from '@microsoft/fast-web-utilities';\nimport { ViewTemplate, observable } from '@microsoft/fast-element';\nimport { TableColumnSortDirection, TableFieldName } from '../../../table/types';\nimport type { TableCell } from '../../../table/components/cell';\nimport {\n TableColumnSortOperation,\n defaultFractionalWidth,\n defaultMinPixelWidth\n} from '../types';\nimport type { TableGroupRow } from '../../../table/components/group-row';\nimport { createGroupHeaderViewTemplate } from '../group-header-view/template';\nimport { createCellViewTemplate } from '../cell-view/template';\nimport type { ColumnValidator } from './column-validator';\n\nexport interface ColumnInternalsOptions<\n TColumnValidator extends ColumnValidator<[]> = ColumnValidator<[]>\n> {\n /**\n * The tag (element name) of the custom element that renders the cell content for the column.\n * That element should derive from TableCellView<TCellRecord, TColumnConfig>.\n */\n readonly cellViewTag: string;\n\n /**\n * The names of the fields that should be present in TCellRecord.\n * This array is parallel with the field names specified by `dataRecordFieldNames`.\n */\n readonly cellRecordFieldNames: readonly TableFieldName[];\n\n /**\n * The tag to use to render the group header content for a column.\n * The element this tag refers to must derive from TableGroupHeaderView.\n */\n readonly groupHeaderViewTag: string;\n\n /**\n * The names of events that should be delegated from the cell view to the column.\n */\n readonly delegatedEvents: readonly string[];\n\n /**\n * The sort operation to use for the column (defaults to TableColumnSortOperation.basic)\n */\n readonly sortOperation?: TableColumnSortOperation;\n\n /**\n * The validator for the column\n */\n readonly validator: TColumnValidator;\n}\n\n/**\n * Internal column state configured by plugin authors\n * @internal\n */\nexport class ColumnInternals<\n TColumnConfig,\n TColumnValidator extends ColumnValidator<[]>\n> {\n /**\n * @see ColumnInternalsOptions.cellRecordFieldNames\n */\n public readonly cellRecordFieldNames: readonly TableFieldName[];\n\n /**\n * A unique id used internally in the table to identify specific column instances\n */\n public readonly uniqueId = uniqueId('table-column-slot');\n\n /**\n * Template for the cell view\n */\n public readonly cellViewTemplate: ViewTemplate<TableCell>;\n\n /**\n * The names of events that should be delegated from the cell view to the column.\n */\n public readonly delegatedEvents: readonly string[];\n\n /**\n * The relevant, static configuration a column requires its cell view to have access to.\n */\n @observable\n public columnConfig?: TColumnConfig;\n\n /**\n * The name of the data field that will be used for operations on the table, such as sorting and grouping.\n */\n @observable\n public operandDataRecordFieldName?: TableFieldName;\n\n /**\n * The operation to use when sorting the table by this column.\n */\n @observable\n public sortOperation: TableColumnSortOperation = TableColumnSortOperation.basic;\n\n /**\n * The names of the fields from the row's record that correlate to the data that will be in TCellRecord.\n * This array is parallel with the field names specified by `cellRecordFieldNames`.\n */\n @observable\n public dataRecordFieldNames: readonly (TableFieldName | undefined)[] = [];\n\n /**\n * Template for the group header view\n */\n public readonly groupHeaderViewTemplate: ViewTemplate<TableGroupRow>;\n\n /**\n * Whether or not this column can be used to group rows by\n */\n @observable\n public groupingDisabled = false;\n\n /**\n * Specifies the grouping precedence of the column within the set of all columns participating in grouping.\n * Columns are rendered in the grouping tree from lowest group-index as the tree root to highest\n * group-index as tree leaves.\n */\n @observable\n public groupIndex?: number;\n\n /**\n * Used by column plugins to set a specific pixel width. Sets currentPixelWidth when changed.\n */\n @observable\n public pixelWidth?: number;\n\n /**\n * Used by column plugins to size a column proportionally to the available\n * width of a row. Sets currentFractionalWidth when changed.\n */\n @observable\n public fractionalWidth = defaultFractionalWidth;\n\n /**\n * The minimum size in pixels according to the design doc\n */\n @observable\n public minPixelWidth = defaultMinPixelWidth;\n\n /**\n * Whether or not resizing the column has been disabled.\n */\n @observable\n public resizingDisabled = false;\n\n /**\n * Whether or not the grouping and sorting indicators should be hidden in the column header\n * when the column is grouped or sorted.\n */\n @observable\n public hideHeaderIndicators = false;\n\n /**\n * @internal Do not write to this value directly. It is used by the Table in order to store\n * the resolved value of the fractionalWidth after updates programmatic or interactive updates.\n */\n @observable\n public currentFractionalWidth = defaultFractionalWidth;\n\n /**\n * @internal Do not write to this value directly. It is used by the Table in order to store\n * the resolved value of the pixelWidth after programmatic or interactive updates.\n */\n @observable\n public currentPixelWidth?: number;\n\n /**\n * Whether or not this column can be sorted\n */\n @observable\n public sortingDisabled = false;\n\n /**\n * @internal Do not write to this value directly. It is used by the Table in order to store\n * the resolved value of the sortIndex after programmatic or interactive updates.\n */\n @observable\n public currentSortIndex?: number;\n\n /**\n * @internal Do not write to this value directly. It is used by the Table in order to store\n * the resolved value of the sortDirection after programmatic or interactive updates.\n */\n @observable\n public currentSortDirection: TableColumnSortDirection = TableColumnSortDirection.none;\n\n public readonly validator: TColumnValidator;\n\n public constructor(options: ColumnInternalsOptions<TColumnValidator>) {\n this.cellRecordFieldNames = options.cellRecordFieldNames;\n this.cellViewTemplate = createCellViewTemplate(options.cellViewTag);\n this.groupHeaderViewTemplate = createGroupHeaderViewTemplate(\n options.groupHeaderViewTag\n );\n this.delegatedEvents = options.delegatedEvents;\n this.sortOperation = options.sortOperation ?? TableColumnSortOperation.basic;\n this.validator = options.validator;\n }\n\n protected fractionalWidthChanged(): void {\n this.currentFractionalWidth = this.fractionalWidth;\n }\n\n protected pixelWidthChanged(): void {\n this.currentPixelWidth = this.pixelWidth;\n }\n}\n\nexport function isColumnInternalsProperty(\n changedProperty: string,\n ...args: (keyof ColumnInternals<unknown, ColumnValidator<[]>>)[]\n): boolean {\n for (const arg of args) {\n if (changedProperty === arg) {\n return true;\n }\n }\n return false;\n}\n"]}
1
+ {"version":3,"file":"column-internals.js","sourceRoot":"","sources":["../../../../../src/table-column/base/models/column-internals.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAgB,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAkB,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EACH,wBAAwB,EACxB,sBAAsB,EACtB,oBAAoB,EACvB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAC9E,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AA6C/D;;;GAGG;AACH,MAAM,OAAO,eAAe;IA6IxB,YAAmB,OAAiD;QApIpE;;WAEG;QACa,aAAQ,GAAG,QAAQ,CAAC,mBAAmB,CAAC,CAAC;QA6BzD;;WAEG;QAEI,kBAAa,GAA6B,wBAAwB,CAAC,KAAK,CAAC;QAEhF;;;WAGG;QAEI,yBAAoB,GAA4C,EAAE,CAAC;QAO1E;;WAEG;QAEI,qBAAgB,GAAG,IAAI,CAAC;QAgB/B;;;WAGG;QAEI,oBAAe,GAAG,sBAAsB,CAAC;QAEhD;;WAEG;QAEI,kBAAa,GAAG,oBAAoB,CAAC;QAE5C;;WAEG;QAEI,qBAAgB,GAAG,KAAK,CAAC;QAEhC;;;WAGG;QAEI,yBAAoB,GAAG,KAAK,CAAC;QAEpC;;;WAGG;QAEI,2BAAsB,GAAG,sBAAsB,CAAC;QASvD;;WAEG;QAEI,oBAAe,GAAG,IAAI,CAAC;QAS9B;;;WAGG;QAEI,yBAAoB,GAA6B,wBAAwB,CAAC,IAAI,CAAC;QAKlF,IAAI,CAAC,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,CAAC;QACzD,IAAI,CAAC,gBAAgB,GAAG,sBAAsB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{ uniqueId } from '@microsoft/fast-web-utilities';\nimport { ViewTemplate, observable } from '@microsoft/fast-element';\nimport { TableColumnSortDirection, TableFieldName } from '../../../table/types';\nimport type { TableCell } from '../../../table/components/cell';\nimport {\n TableColumnSortOperation,\n defaultFractionalWidth,\n defaultMinPixelWidth\n} from '../types';\nimport type { TableGroupRow } from '../../../table/components/group-row';\nimport { createGroupHeaderViewTemplate } from '../group-header-view/template';\nimport { createCellViewTemplate } from '../cell-view/template';\nimport type { ColumnValidator } from './column-validator';\n\nexport interface ColumnInternalsOptions<\n TColumnValidator extends ColumnValidator<[]> = ColumnValidator<[]>\n> {\n /**\n * The tag (element name) of the custom element that renders the cell content for the column.\n * That element should derive from TableCellView<TCellRecord, TColumnConfig>.\n */\n readonly cellViewTag: string;\n\n /**\n * The names of the fields that should be present in TCellRecord.\n * This array is parallel with the field names specified by `dataRecordFieldNames`.\n */\n readonly cellRecordFieldNames: readonly TableFieldName[];\n\n /**\n * The tag to use to render the group header content for a column.\n * The element this tag refers to must derive from TableGroupHeaderView.\n */\n readonly groupHeaderViewTag?: string;\n\n /**\n * The names of events that should be delegated from the cell view to the column.\n */\n readonly delegatedEvents: readonly string[];\n\n /**\n * The names of slots that need to be forwarded into a cell.\n */\n readonly slotNames?: readonly string[];\n\n /**\n * The sort operation to use for the column (defaults to TableColumnSortOperation.basic)\n */\n readonly sortOperation?: TableColumnSortOperation;\n\n /**\n * The validator for the column\n */\n readonly validator: TColumnValidator;\n}\n\n/**\n * Internal column state configured by plugin authors\n * @internal\n */\nexport class ColumnInternals<\n TColumnConfig,\n TColumnValidator extends ColumnValidator<[]>\n> {\n /**\n * @see ColumnInternalsOptions.cellRecordFieldNames\n */\n public readonly cellRecordFieldNames: readonly TableFieldName[];\n\n /**\n * A unique id used internally in the table to identify specific column instances\n */\n public readonly uniqueId = uniqueId('table-column-slot');\n\n /**\n * Template for the cell view\n */\n public readonly cellViewTemplate: ViewTemplate<TableCell>;\n\n /**\n * The names of events that should be delegated from the cell view to the column.\n */\n public readonly delegatedEvents: readonly string[];\n\n /**\n * The names of slots that need to be forwarded into a cell.\n */\n public readonly slotNames: readonly string[];\n\n /**\n * The relevant, static configuration a column requires its cell view to have access to.\n */\n @observable\n public columnConfig?: TColumnConfig;\n\n /**\n * The name of the data field that will be used for operations on the table, such as sorting and grouping.\n */\n @observable\n public operandDataRecordFieldName?: TableFieldName;\n\n /**\n * The operation to use when sorting the table by this column.\n */\n @observable\n public sortOperation: TableColumnSortOperation = TableColumnSortOperation.basic;\n\n /**\n * The names of the fields from the row's record that correlate to the data that will be in TCellRecord.\n * This array is parallel with the field names specified by `cellRecordFieldNames`.\n */\n @observable\n public dataRecordFieldNames: readonly (TableFieldName | undefined)[] = [];\n\n /**\n * Template for the group header view\n */\n public readonly groupHeaderViewTemplate?: ViewTemplate<TableGroupRow>;\n\n /**\n * Whether or not this column can be used to group rows by\n */\n @observable\n public groupingDisabled = true;\n\n /**\n * Specifies the grouping precedence of the column within the set of all columns participating in grouping.\n * Columns are rendered in the grouping tree from lowest group-index as the tree root to highest\n * group-index as tree leaves.\n */\n @observable\n public groupIndex?: number;\n\n /**\n * Used by column plugins to set a specific pixel width. Sets currentPixelWidth when changed.\n */\n @observable\n public pixelWidth?: number;\n\n /**\n * Used by column plugins to size a column proportionally to the available\n * width of a row. Sets currentFractionalWidth when changed.\n */\n @observable\n public fractionalWidth = defaultFractionalWidth;\n\n /**\n * The minimum size in pixels according to the design doc\n */\n @observable\n public minPixelWidth = defaultMinPixelWidth;\n\n /**\n * Whether or not resizing the column has been disabled.\n */\n @observable\n public resizingDisabled = false;\n\n /**\n * Whether or not the grouping and sorting indicators should be hidden in the column header\n * when the column is grouped or sorted.\n */\n @observable\n public hideHeaderIndicators = false;\n\n /**\n * @internal Do not write to this value directly. It is used by the Table in order to store\n * the resolved value of the fractionalWidth after updates programmatic or interactive updates.\n */\n @observable\n public currentFractionalWidth = defaultFractionalWidth;\n\n /**\n * @internal Do not write to this value directly. It is used by the Table in order to store\n * the resolved value of the pixelWidth after programmatic or interactive updates.\n */\n @observable\n public currentPixelWidth?: number;\n\n /**\n * Whether or not this column can be sorted\n */\n @observable\n public sortingDisabled = true;\n\n /**\n * @internal Do not write to this value directly. It is used by the Table in order to store\n * the resolved value of the sortIndex after programmatic or interactive updates.\n */\n @observable\n public currentSortIndex?: number;\n\n /**\n * @internal Do not write to this value directly. It is used by the Table in order to store\n * the resolved value of the sortDirection after programmatic or interactive updates.\n */\n @observable\n public currentSortDirection: TableColumnSortDirection = TableColumnSortDirection.none;\n\n public readonly validator: TColumnValidator;\n\n public constructor(options: ColumnInternalsOptions<TColumnValidator>) {\n this.cellRecordFieldNames = options.cellRecordFieldNames;\n this.cellViewTemplate = createCellViewTemplate(options.cellViewTag);\n if (options.groupHeaderViewTag) {\n this.groupHeaderViewTemplate = createGroupHeaderViewTemplate(\n options.groupHeaderViewTag\n );\n }\n this.delegatedEvents = options.delegatedEvents;\n this.slotNames = options.slotNames ?? [];\n this.sortOperation = options.sortOperation ?? TableColumnSortOperation.basic;\n this.validator = options.validator;\n }\n\n protected fractionalWidthChanged(): void {\n this.currentFractionalWidth = this.fractionalWidth;\n }\n\n protected pixelWidthChanged(): void {\n this.currentPixelWidth = this.pixelWidth;\n }\n}\n\nexport function isColumnInternalsProperty(\n changedProperty: string,\n ...args: (keyof ColumnInternals<unknown, ColumnValidator<[]>>)[]\n): boolean {\n for (const arg of args) {\n if (changedProperty === arg) {\n return true;\n }\n }\n return false;\n}\n"]}
@@ -0,0 +1,32 @@
1
+ import { TableCellView } from '../../base/cell-view';
2
+ import type { TableColumnMenuButtonCellRecord, TableColumnMenuButtonColumnConfig } from '..';
3
+ import type { MenuButton } from '../../../menu-button';
4
+ import type { MenuButtonToggleEventDetail } from '../../../menu-button/types';
5
+ declare global {
6
+ interface HTMLElementTagNameMap {
7
+ 'nimble-table-column-menu-button-cell-view': TableColumnMenuButtonCellView;
8
+ }
9
+ }
10
+ /**
11
+ * The cell view base class for displaying a string field as a menu button.
12
+ */
13
+ export declare class TableColumnMenuButtonCellView extends TableCellView<TableColumnMenuButtonCellRecord, TableColumnMenuButtonColumnConfig> {
14
+ /** @internal */
15
+ menuButton?: MenuButton;
16
+ /** @internal */
17
+ valueSpan?: HTMLSpanElement;
18
+ /** @internal */
19
+ hasOverflow: boolean;
20
+ /** @internal */
21
+ get showMenuButton(): boolean;
22
+ get tabbableChildren(): HTMLElement[];
23
+ /** @internal */
24
+ onMenuButtonBeforeToggle(event: CustomEvent<MenuButtonToggleEventDetail>): boolean;
25
+ /** @internal */
26
+ onMenuButtonMouseOver(): void;
27
+ /** @internal */
28
+ onMenuButtonMouseOut(): void;
29
+ /** @internal */
30
+ onMenuButtonClick(e: Event): void;
31
+ }
32
+ export declare const tableColumnMenuButtonCellViewTag = "nimble-table-column-menu-button-cell-view";
@@ -0,0 +1,70 @@
1
+ import { __decorate } from "tslib";
2
+ import { DesignSystem } from '@microsoft/fast-foundation';
3
+ import { observable, volatile } from '@microsoft/fast-element';
4
+ import { TableCellView } from '../../base/cell-view';
5
+ import { template } from './templates';
6
+ import { styles } from './styles';
7
+ import { cellViewMenuSlotName } from '../types';
8
+ /**
9
+ * The cell view base class for displaying a string field as a menu button.
10
+ */
11
+ export class TableColumnMenuButtonCellView extends TableCellView {
12
+ constructor() {
13
+ super(...arguments);
14
+ /** @internal */
15
+ this.hasOverflow = false;
16
+ }
17
+ /** @internal */
18
+ get showMenuButton() {
19
+ return !!this.cellRecord?.value;
20
+ }
21
+ get tabbableChildren() {
22
+ if (this.showMenuButton) {
23
+ return [this.menuButton];
24
+ }
25
+ return [];
26
+ }
27
+ /** @internal */
28
+ onMenuButtonBeforeToggle(event) {
29
+ const configuredSlotName = this.columnConfig?.menuSlot;
30
+ if (configuredSlotName && event.detail.newState) {
31
+ const eventDetail = {
32
+ slots: [
33
+ { name: configuredSlotName, slot: cellViewMenuSlotName }
34
+ ]
35
+ };
36
+ this.$emit('cell-view-slots-request', eventDetail);
37
+ }
38
+ return true;
39
+ }
40
+ /** @internal */
41
+ onMenuButtonMouseOver() {
42
+ if (this.valueSpan) {
43
+ this.hasOverflow = this.valueSpan.offsetWidth < this.valueSpan.scrollWidth;
44
+ }
45
+ }
46
+ /** @internal */
47
+ onMenuButtonMouseOut() {
48
+ this.hasOverflow = false;
49
+ }
50
+ /** @internal */
51
+ onMenuButtonClick(e) {
52
+ // Stop propagation of the click event to prevent clicking the menu button
53
+ // from affecting row selection.
54
+ e.stopPropagation();
55
+ }
56
+ }
57
+ __decorate([
58
+ observable
59
+ ], TableColumnMenuButtonCellView.prototype, "hasOverflow", void 0);
60
+ __decorate([
61
+ volatile
62
+ ], TableColumnMenuButtonCellView.prototype, "showMenuButton", null);
63
+ const menuButtonCellView = TableColumnMenuButtonCellView.compose({
64
+ baseName: 'table-column-menu-button-cell-view',
65
+ template,
66
+ styles
67
+ });
68
+ DesignSystem.getOrCreate().withPrefix('nimble').register(menuButtonCellView());
69
+ export const tableColumnMenuButtonCellViewTag = 'nimble-table-column-menu-button-cell-view';
70
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/table-column/menu-button/cell-view/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAKrD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAQhD;;GAEG;AACH,MAAM,OAAO,6BAA8B,SAAQ,aAGlD;IAHD;;QAUI,gBAAgB;QAET,gBAAW,GAAG,KAAK,CAAC;IAiD/B,CAAC;IA/CG,gBAAgB;IAEhB,IAAW,cAAc;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C,QAAQ,CAAC,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC,CAAC;AAC/E,MAAM,CAAC,MAAM,gCAAgC,GAAG,2CAA2C,CAAC","sourcesContent":["import { DesignSystem } from '@microsoft/fast-foundation';\nimport { observable, volatile } from '@microsoft/fast-element';\nimport { TableCellView } from '../../base/cell-view';\nimport type {\n TableColumnMenuButtonCellRecord,\n TableColumnMenuButtonColumnConfig\n} from '..';\nimport { template } from './templates';\nimport { styles } from './styles';\nimport type { MenuButton } from '../../../menu-button';\nimport type { MenuButtonToggleEventDetail } from '../../../menu-button/types';\nimport type { CellViewSlotRequestEventDetail } from '../../../table/types';\nimport { cellViewMenuSlotName } from '../types';\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-table-column-menu-button-cell-view': TableColumnMenuButtonCellView;\n }\n}\n\n/**\n * The cell view base class for displaying a string field as a menu button.\n */\nexport class TableColumnMenuButtonCellView extends TableCellView<\nTableColumnMenuButtonCellRecord,\nTableColumnMenuButtonColumnConfig\n> {\n /** @internal */\n public menuButton?: MenuButton;\n\n /** @internal */\n public valueSpan?: HTMLSpanElement;\n\n /** @internal */\n @observable\n public hasOverflow = false;\n\n /** @internal */\n @volatile\n public get showMenuButton(): boolean {\n return !!this.cellRecord?.value;\n }\n\n public override get tabbableChildren(): HTMLElement[] {\n if (this.showMenuButton) {\n return [this.menuButton!];\n }\n return [];\n }\n\n /** @internal */\n public onMenuButtonBeforeToggle(\n event: CustomEvent<MenuButtonToggleEventDetail>\n ): boolean {\n const configuredSlotName = this.columnConfig?.menuSlot;\n if (configuredSlotName && event.detail.newState) {\n const eventDetail: CellViewSlotRequestEventDetail = {\n slots: [\n { name: configuredSlotName, slot: cellViewMenuSlotName }\n ]\n };\n this.$emit('cell-view-slots-request', eventDetail);\n }\n return true;\n }\n\n /** @internal */\n public onMenuButtonMouseOver(): void {\n if (this.valueSpan) {\n this.hasOverflow = this.valueSpan.offsetWidth < this.valueSpan.scrollWidth;\n }\n }\n\n /** @internal */\n public onMenuButtonMouseOut(): void {\n this.hasOverflow = false;\n }\n\n /** @internal */\n public onMenuButtonClick(e: Event): void {\n // Stop propagation of the click event to prevent clicking the menu button\n // from affecting row selection.\n e.stopPropagation();\n }\n}\n\nconst menuButtonCellView = TableColumnMenuButtonCellView.compose({\n baseName: 'table-column-menu-button-cell-view',\n template,\n styles\n});\nDesignSystem.getOrCreate().withPrefix('nimble').register(menuButtonCellView());\nexport const tableColumnMenuButtonCellViewTag = 'nimble-table-column-menu-button-cell-view';\n"]}
@@ -0,0 +1 @@
1
+ export declare const styles: import("@microsoft/fast-element").ElementStyles;
@@ -0,0 +1,21 @@
1
+ import { css } from '@microsoft/fast-element';
2
+ import { controlSlimHeight } from '../../../theme-provider/design-tokens';
3
+ export const styles = css `
4
+ :host {
5
+ align-self: center;
6
+ width: 100%;
7
+ }
8
+
9
+ nimble-menu-button {
10
+ height: ${controlSlimHeight};
11
+ width: 100%;
12
+ }
13
+
14
+ .value-label {
15
+ margin-right: auto;
16
+ overflow: hidden;
17
+ text-overflow: ellipsis;
18
+ white-space: nowrap;
19
+ }
20
+ `;
21
+ //# sourceMappingURL=styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../../../src/table-column/menu-button/cell-view/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE1E,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;kBAOP,iBAAiB;;;;;;;;;;CAUlC,CAAC","sourcesContent":["import { css } from '@microsoft/fast-element';\nimport { controlSlimHeight } from '../../../theme-provider/design-tokens';\n\nexport const styles = css`\n :host {\n align-self: center;\n width: 100%;\n }\n\n nimble-menu-button {\n height: ${controlSlimHeight};\n width: 100%;\n }\n\n .value-label {\n margin-right: auto;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n }\n`;\n"]}
@@ -0,0 +1,2 @@
1
+ import type { TableColumnMenuButtonCellView } from '.';
2
+ export declare const template: import("@microsoft/fast-element").ViewTemplate<TableColumnMenuButtonCellView, any>;
@@ -0,0 +1,25 @@
1
+ import { html, ref, when } from '@microsoft/fast-element';
2
+ import { menuButtonTag } from '../../../menu-button';
3
+ import { ButtonAppearance } from '../../../menu-button/types';
4
+ import { iconArrowExpanderDownTag } from '../../../icons/arrow-expander-down';
5
+ import { cellViewMenuSlotName } from '../types';
6
+ // prettier-ignore
7
+ export const template = html `
8
+ ${when(x => x.showMenuButton, html `
9
+ <${menuButtonTag}
10
+ ${ref('menuButton')}
11
+ appearance="${ButtonAppearance.ghost}"
12
+ @beforetoggle="${(x, c) => x.onMenuButtonBeforeToggle(c.event)}"
13
+ @mouseover="${x => x.onMenuButtonMouseOver()}"
14
+ @mouseout="${x => x.onMenuButtonMouseOut()}"
15
+ @click="${(x, c) => x.onMenuButtonClick(c.event)}"
16
+ title=${x => (x.hasOverflow ? x.cellRecord.value : null)}
17
+ >
18
+ <span ${ref('valueSpan')} class="value-label">${x => x.cellRecord.value}</span>
19
+ <${iconArrowExpanderDownTag} slot="end"></${iconArrowExpanderDownTag}>
20
+
21
+ <slot name="${cellViewMenuSlotName}" slot="menu"></slot>
22
+ </${menuButtonTag}>
23
+ `)}
24
+ `;
25
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../../../src/table-column/menu-button/cell-view/templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EACH,gBAAgB,EAEnB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEhD,kBAAkB;AAClB,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAA+B;MACrD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,cAAc,EAAE,IAAI,CAA+B;WAC1D,aAAa;cACV,GAAG,CAAC,YAAY,CAAC;0BACL,gBAAgB,CAAC,KAAK;6BACnB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,KAAiD,CAAC;0BAC5F,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,qBAAqB,EAAE;yBAC/B,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,oBAAoB,EAAE;sBAChC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,KAAK,CAAC;oBACxC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,UAAW,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;;oBAEjD,GAAG,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,UAAW,CAAC,KAAK;eACrE,wBAAwB,iBAAiB,wBAAwB;;0BAEtD,oBAAoB;YAClC,aAAa;KACpB,CAAC;CACL,CAAC","sourcesContent":["import { html, ref, when } from '@microsoft/fast-element';\nimport type { TableColumnMenuButtonCellView } from '.';\nimport { menuButtonTag } from '../../../menu-button';\nimport {\n ButtonAppearance,\n type MenuButtonToggleEventDetail\n} from '../../../menu-button/types';\nimport { iconArrowExpanderDownTag } from '../../../icons/arrow-expander-down';\nimport { cellViewMenuSlotName } from '../types';\n\n// prettier-ignore\nexport const template = html<TableColumnMenuButtonCellView>`\n ${when(x => x.showMenuButton, html<TableColumnMenuButtonCellView>`\n <${menuButtonTag}\n ${ref('menuButton')}\n appearance=\"${ButtonAppearance.ghost}\"\n @beforetoggle=\"${(x, c) => x.onMenuButtonBeforeToggle(c.event as CustomEvent<MenuButtonToggleEventDetail>)}\"\n @mouseover=\"${x => x.onMenuButtonMouseOver()}\"\n @mouseout=\"${x => x.onMenuButtonMouseOut()}\"\n @click=\"${(x, c) => x.onMenuButtonClick(c.event)}\"\n title=${x => (x.hasOverflow ? x.cellRecord!.value : null)}\n >\n <span ${ref('valueSpan')} class=\"value-label\">${x => x.cellRecord!.value}</span>\n <${iconArrowExpanderDownTag} slot=\"end\"></${iconArrowExpanderDownTag}>\n\n <slot name=\"${cellViewMenuSlotName}\" slot=\"menu\"></slot>\n </${menuButtonTag}>\n `)}\n`;\n"]}
@@ -0,0 +1,42 @@
1
+ import type { TableStringField } from '../../table/types';
2
+ import type { ColumnInternalsOptions } from '../base/models/column-internals';
3
+ import { ColumnValidator } from '../base/models/column-validator';
4
+ import { TableColumn } from '../base';
5
+ export type TableColumnMenuButtonCellRecord = TableStringField<'value'>;
6
+ export interface TableColumnMenuButtonColumnConfig {
7
+ menuSlot?: string;
8
+ }
9
+ declare global {
10
+ interface HTMLElementTagNameMap {
11
+ 'nimble-table-column-menu-button': TableColumnMenuButton;
12
+ }
13
+ }
14
+ declare const TableColumnMenuButton_base: (abstract new (...args: any[]) => {
15
+ fractionalWidth?: number | null | undefined;
16
+ minPixelWidth?: number | null | undefined;
17
+ fractionalWidthChanged(): void;
18
+ minPixelWidthChanged(): void;
19
+ readonly columnInternals: import("../base/models/column-internals").ColumnInternals<unknown, ColumnValidator<[]>>;
20
+ }) & ((abstract new () => TableColumn<TableColumnMenuButtonColumnConfig, ColumnValidator<[]>>) & {
21
+ compose<T extends import("@microsoft/fast-foundation").FoundationElementDefinition = import("@microsoft/fast-foundation").FoundationElementDefinition, K extends import("@microsoft/fast-element").Constructable<import("@microsoft/fast-foundation").FoundationElement> = import("@microsoft/fast-element").Constructable<import("@microsoft/fast-foundation").FoundationElement>>(this: K, elementDefinition: T): (overrideDefinition?: import("@microsoft/fast-foundation").OverrideFoundationElementDefinition<T> | undefined) => import("@microsoft/fast-foundation").FoundationElementRegistry<T, K>;
22
+ from<TBase extends {
23
+ new (): HTMLElement;
24
+ prototype: HTMLElement;
25
+ }>(BaseType: TBase): new () => InstanceType<TBase> & import("@microsoft/fast-element").FASTElement;
26
+ define<TType extends Function>(type: TType, nameOrDef?: string | import("@microsoft/fast-element").PartialFASTElementDefinition | undefined): TType;
27
+ });
28
+ /**
29
+ * The table column for displaying string fields as the content within a menu button.
30
+ */
31
+ export declare class TableColumnMenuButton extends TableColumnMenuButton_base {
32
+ fieldName?: string;
33
+ menuSlot?: string;
34
+ /** @internal */
35
+ onDelegatedEvent(e: Event): void;
36
+ protected getColumnInternalsOptions(): ColumnInternalsOptions;
37
+ protected fieldNameChanged(): void;
38
+ protected menuSlotChanged(): void;
39
+ private updateColumnConfig;
40
+ }
41
+ export declare const tableColumnMenuButtonTag = "nimble-table-column-menu-button";
42
+ export {};
@@ -0,0 +1,68 @@
1
+ import { __decorate } from "tslib";
2
+ import { DesignSystem } from '@microsoft/fast-foundation';
3
+ import { attr } from '@microsoft/fast-element';
4
+ import { template } from './template';
5
+ import { styles } from '../base/styles';
6
+ import { tableColumnMenuButtonCellViewTag } from './cell-view';
7
+ import { ColumnValidator } from '../base/models/column-validator';
8
+ import { mixinFractionalWidthColumnAPI } from '../mixins/fractional-width-column';
9
+ import { TableColumn } from '../base';
10
+ import { cellViewMenuSlotName } from './types';
11
+ /**
12
+ * The table column for displaying string fields as the content within a menu button.
13
+ */
14
+ export class TableColumnMenuButton extends mixinFractionalWidthColumnAPI((TableColumn)) {
15
+ /** @internal */
16
+ onDelegatedEvent(e) {
17
+ e.stopImmediatePropagation();
18
+ const event = e;
19
+ const originalEvent = event.detail.originalEvent;
20
+ if (originalEvent.type === 'beforetoggle'
21
+ || originalEvent.type === 'toggle') {
22
+ const newEventName = `menu-button-column-${originalEvent.type}`;
23
+ const originalToggleEvent = originalEvent;
24
+ const detail = {
25
+ ...originalToggleEvent.detail,
26
+ recordId: event.detail.recordId
27
+ };
28
+ this.$emit(newEventName, detail);
29
+ }
30
+ }
31
+ getColumnInternalsOptions() {
32
+ return {
33
+ cellRecordFieldNames: ['value'],
34
+ cellViewTag: tableColumnMenuButtonCellViewTag,
35
+ delegatedEvents: ['beforetoggle', 'toggle'],
36
+ slotNames: [cellViewMenuSlotName],
37
+ validator: new ColumnValidator([])
38
+ };
39
+ }
40
+ fieldNameChanged() {
41
+ this.columnInternals.dataRecordFieldNames = [this.fieldName];
42
+ this.columnInternals.operandDataRecordFieldName = this.fieldName;
43
+ }
44
+ menuSlotChanged() {
45
+ this.updateColumnConfig();
46
+ }
47
+ updateColumnConfig() {
48
+ this.columnInternals.columnConfig = {
49
+ menuSlot: this.menuSlot
50
+ };
51
+ }
52
+ }
53
+ __decorate([
54
+ attr({ attribute: 'field-name' })
55
+ ], TableColumnMenuButton.prototype, "fieldName", void 0);
56
+ __decorate([
57
+ attr({ attribute: 'menu-slot' })
58
+ ], TableColumnMenuButton.prototype, "menuSlot", void 0);
59
+ const nimbleTableColumnMenuButton = TableColumnMenuButton.compose({
60
+ baseName: 'table-column-menu-button',
61
+ template,
62
+ styles
63
+ });
64
+ DesignSystem.getOrCreate()
65
+ .withPrefix('nimble')
66
+ .register(nimbleTableColumnMenuButton());
67
+ export const tableColumnMenuButtonTag = 'nimble-table-column-menu-button';
68
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/table-column/menu-button/index.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAE,gCAAgC,EAAE,MAAM,aAA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,eAAe,CAAC,0BAA0B,GAAG,IAAI,CAAC,SAAS,CAAC;IACrE,CAAC;IAES,eAAe;QACrB,IAAI,CAAC,kBAAkB,EAAE,CAAC;IAC9B,CAAC;IAEO,kBAAkB;QACtB,IAAI,CAAC,eAAe,CAAC,YAAY,GAAG;YAChC,QAAQ,EAAE,IAAI,CAAC,QAAQ;SAC1B,CAAC;IACN,CAAC;CACJ;AAjDU;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;wDACR;AAGnB;IADN,IAAI,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;uDACR;AAgD7B,MAAM,2BAA2B,GAAG,qBAAqB,CAAC,OAAO,CAAC;IAC9D,QAAQ,EAAE,0BAA0B;IACpC,QAAQ;IACR,MAAM;CACT,CAAC,CAAC;AAEH,YAAY,CAAC,WAAW,EAAE;KACrB,UAAU,CAAC,QAAQ,CAAC;KACpB,QAAQ,CAAC,2BAA2B,EAAE,CAAC,CAAC;AAC7C,MAAM,CAAC,MAAM,wBAAwB,GAAG,iCAAiC,CAAC","sourcesContent":["import { DesignSystem } from '@microsoft/fast-foundation';\nimport { attr } from '@microsoft/fast-element';\nimport { template } from './template';\nimport { styles } from '../base/styles';\nimport type { TableStringField } from '../../table/types';\nimport { tableColumnMenuButtonCellViewTag } from './cell-view';\nimport type { ColumnInternalsOptions } from '../base/models/column-internals';\nimport { ColumnValidator } from '../base/models/column-validator';\nimport { mixinFractionalWidthColumnAPI } from '../mixins/fractional-width-column';\nimport { TableColumn } from '../base';\nimport {\n MenuButtonColumnToggleEventDetail,\n cellViewMenuSlotName\n} from './types';\nimport type { DelegatedEventEventDetails } from '../base/types';\nimport type { MenuButtonToggleEventDetail } from '../../menu-button/types';\n\nexport type TableColumnMenuButtonCellRecord = TableStringField<'value'>;\n\nexport interface TableColumnMenuButtonColumnConfig {\n menuSlot?: string;\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nimble-table-column-menu-button': TableColumnMenuButton;\n }\n}\n\n/**\n * The table column for displaying string fields as the content within a menu button.\n */\nexport class TableColumnMenuButton extends mixinFractionalWidthColumnAPI(\n TableColumn<TableColumnMenuButtonColumnConfig>\n) {\n @attr({ attribute: 'field-name' })\n public fieldName?: string;\n\n @attr({ attribute: 'menu-slot' })\n public menuSlot?: string;\n\n /** @internal */\n public onDelegatedEvent(e: Event): void {\n e.stopImmediatePropagation();\n\n const event = e as CustomEvent<DelegatedEventEventDetails>;\n const originalEvent = event.detail.originalEvent;\n if (\n originalEvent.type === 'beforetoggle'\n || originalEvent.type === 'toggle'\n ) {\n const newEventName = `menu-button-column-${originalEvent.type}`;\n const originalToggleEvent = originalEvent as CustomEvent<MenuButtonToggleEventDetail>;\n const detail: MenuButtonColumnToggleEventDetail = {\n ...originalToggleEvent.detail,\n recordId: event.detail.recordId\n };\n this.$emit(newEventName, detail);\n }\n }\n\n protected override getColumnInternalsOptions(): ColumnInternalsOptions {\n return {\n cellRecordFieldNames: ['value'],\n cellViewTag: tableColumnMenuButtonCellViewTag,\n delegatedEvents: ['beforetoggle', 'toggle'],\n slotNames: [cellViewMenuSlotName],\n validator: new ColumnValidator<[]>([])\n };\n }\n\n protected fieldNameChanged(): void {\n this.columnInternals.dataRecordFieldNames = [this.fieldName];\n this.columnInternals.operandDataRecordFieldName = this.fieldName;\n }\n\n protected menuSlotChanged(): void {\n this.updateColumnConfig();\n }\n\n private updateColumnConfig(): void {\n this.columnInternals.columnConfig = {\n menuSlot: this.menuSlot\n };\n }\n}\n\nconst nimbleTableColumnMenuButton = TableColumnMenuButton.compose({\n baseName: 'table-column-menu-button',\n template,\n styles\n});\n\nDesignSystem.getOrCreate()\n .withPrefix('nimble')\n .register(nimbleTableColumnMenuButton());\nexport const tableColumnMenuButtonTag = 'nimble-table-column-menu-button';\n"]}
@@ -0,0 +1,2 @@
1
+ import type { TableColumnMenuButton } from '.';
2
+ export declare const template: import("@microsoft/fast-element").ViewTemplate<TableColumnMenuButton, any>;
@@ -0,0 +1,8 @@
1
+ import { html } from '@microsoft/fast-element';
2
+ import { template as baseTemplate } from '../base/template';
3
+ export const template = html `
4
+ <template @delegated-event="${(x, c) => x.onDelegatedEvent(c.event)}"
5
+ >${baseTemplate}</template
6
+ >
7
+ `;
8
+ //# sourceMappingURL=template.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../../src/table-column/menu-button/template.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,yBAAyB,CAAC;AAE/C,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAE5D,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAuB;kCACjB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,KAAK,CAAC;WAC5D,YAAY;;CAEtB,CAAC","sourcesContent":["import { html } from '@microsoft/fast-element';\nimport type { TableColumnMenuButton } from '.';\nimport { template as baseTemplate } from '../base/template';\n\nexport const template = html<TableColumnMenuButton>`\n <template @delegated-event=\"${(x, c) => x.onDelegatedEvent(c.event)}\"\n >${baseTemplate}</template\n >\n`;\n"]}
@@ -0,0 +1,11 @@
1
+ import { MenuButtonPageObject } from '../../../menu-button/testing/menu-button.pageobject';
2
+ import type { TablePageObject } from '../../../table/testing/table.pageobject';
3
+ import type { TableRecord } from '../../../table/types';
4
+ /**
5
+ * Page object for `nimble-table-column-menu-button`.
6
+ */
7
+ export declare class TableColumnMenuButtonPageObject<T extends TableRecord> {
8
+ private readonly tablePageObject;
9
+ constructor(tablePageObject: TablePageObject<T>);
10
+ getMenuButton(rowIndex: number, columnIndex: number): MenuButtonPageObject | null;
11
+ }
@@ -0,0 +1,18 @@
1
+ import { menuButtonTag } from '../../../menu-button';
2
+ import { MenuButtonPageObject } from '../../../menu-button/testing/menu-button.pageobject';
3
+ /**
4
+ * Page object for `nimble-table-column-menu-button`.
5
+ */
6
+ export class TableColumnMenuButtonPageObject {
7
+ constructor(tablePageObject) {
8
+ this.tablePageObject = tablePageObject;
9
+ }
10
+ getMenuButton(rowIndex, columnIndex) {
11
+ const cellView = this.tablePageObject.getRenderedCellView(rowIndex, columnIndex);
12
+ const menuButtonElement = cellView.shadowRoot.querySelector(menuButtonTag);
13
+ return menuButtonElement
14
+ ? new MenuButtonPageObject(menuButtonElement)
15
+ : null;
16
+ }
17
+ }
18
+ //# sourceMappingURL=table-column-menu-button.pageobject.js.map