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CAAC,IAAI,EAAE;gBACd,UAAU;gBACV,KAAK;gBACL,GAAG,EAAE,MAAM,CAAC,EAAE;gBACd,OAAO;gBACP,OAAO,EAAE,CAAC,YAAoB,EAAE,EAAE;oBACjC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC;gBACtD,CAAC;gBACD,KAAK;gBACL,QAAQ,EAAE,MAAM,CAAC,QAAQ;gBACzB,QAAQ,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE;gBAC9B,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;aACzD,CAAC,CAAC;QACJ,CAAC,EACD,EAAa,CACb,CAAC;QAEF,OAAO,CAAC,CACP,KAAK,EACL;YACC,GAAG,EAAE,MAAM;YACX,OAAO,EAAE;gBACR,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC;gBACpB,QAAQ,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,CAAC;gBACpC,QAAQ,CAAC,SAAS;gBAClB,WAAW,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,UAAU,CAAC;aACzC;YACD,IAAI,EAAE,KAAK;YACX,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,SAAS;YACpD,eAAe,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;SAC5B,EACD,OAAO,CACP,CAAC;IACH,CAAC;CACD,CAAA;AA3DoB,GAAG;IADvB,KAAK,CAAC,GAAG,CAAC;GACU,GAAG,CA2DvB;eA3DoB,GAAG","sourcesContent":["import WidgetBase from '@dojo/framework/core/WidgetBase';\nimport { v, w } from '@dojo/framework/core/vdom';\nimport { DNode } from '@dojo/framework/core/interfaces';\nimport I18nMixin from '@dojo/framework/core/mixins/I18n';\nimport ThemedMixin, { theme } from '@dojo/framework/core/mixins/Themed';\n\nimport { ColumnConfig } from './interfaces';\nimport Cell from './Cell';\nimport * as fixedCss from './styles/row.m.css';\nimport * as css from '../theme/default/grid-row.m.css';\n\nexport interface RowProperties {\n\t/** identifier for the row */\n\tid: number;\n\t/** A list of values indexed on the column id */\n\titem: { [index: string]: any };\n\t/** Configuration for grid columns (id, title, properties, and custom renderer)  */\n\tcolumnConfig: ColumnConfig[];\n\t/** Handles updating the value of a cell */\n\tupdater: (rowNumber: number, columnId: string, value: any) => void;\n\t/** Calculated column widths */\n\tcolumnWidths?: { [index: string]: number };\n\t/** handler for row selection */\n\tonRowSelect?: (type: any) => void;\n\t/** array of selected rows */\n\tselected?: boolean;\n}\n\n@theme(css)\nexport default class Row extends I18nMixin(ThemedMixin(WidgetBase))<RowProperties> {\n\tprivate _onRowSelect(event: MouseEvent) {\n\t\tconst { onRowSelect } = this.properties;\n\t\tconst type = event.ctrlKey || event.metaKey ? 'multi' : 'single';\n\t\tonRowSelect && onRowSelect(type);\n\t}\n\n\tprotected render(): DNode {\n\t\tconst {\n\t\t\ti18nBundle,\n\t\t\titem,\n\t\t\tcolumnConfig,\n\t\t\tid,\n\t\t\ttheme,\n\t\t\tclasses,\n\t\t\tcolumnWidths,\n\t\t\tonRowSelect,\n\t\t\tselected\n\t\t} = this.properties;\n\t\tlet columns = columnConfig.map(\n\t\t\t(config) => {\n\t\t\t\tlet value: string | DNode = `${item[config.id]}`;\n\t\t\t\tif (config.renderer) {\n\t\t\t\t\tvalue = config.renderer({ value });\n\t\t\t\t}\n\t\t\t\treturn w(Cell, {\n\t\t\t\t\ti18nBundle,\n\t\t\t\t\ttheme,\n\t\t\t\t\tkey: config.id,\n\t\t\t\t\tclasses,\n\t\t\t\t\tupdater: (updatedValue: string) => {\n\t\t\t\t\t\tthis.properties.updater(id, config.id, updatedValue);\n\t\t\t\t\t},\n\t\t\t\t\tvalue,\n\t\t\t\t\teditable: config.editable,\n\t\t\t\t\trawValue: `${item[config.id]}`,\n\t\t\t\t\twidth: columnWidths ? columnWidths[config.id] : undefined\n\t\t\t\t});\n\t\t\t},\n\t\t\t[] as DNode[]\n\t\t);\n\n\t\treturn v(\n\t\t\t'div',\n\t\t\t{\n\t\t\t\tkey: 'root',\n\t\t\t\tclasses: [\n\t\t\t\t\tthis.theme(css.root),\n\t\t\t\t\tselected && this.theme(css.selected),\n\t\t\t\t\tfixedCss.rootFixed,\n\t\t\t\t\tonRowSelect && this.theme(css.selectable)\n\t\t\t\t],\n\t\t\t\trole: 'row',\n\t\t\t\tonclick: onRowSelect ? this._onRowSelect : undefined,\n\t\t\t\t'aria-rowindex': `${id + 1}`\n\t\t\t},\n\t\t\tcolumns\n\t\t);\n\t}\n}\n"]}