diff --git a/packages/common/src/styles/slickgrid-theme-salesforce.scss b/packages/common/src/styles/slickgrid-theme-salesforce.scss index c2f9360cd..c2a7bf16b 100644 --- a/packages/common/src/styles/slickgrid-theme-salesforce.scss +++ b/packages/common/src/styles/slickgrid-theme-salesforce.scss @@ -161,3 +161,17 @@ $pagination-icon-seek-end-width: $icon-width !default; $link-color: $primary-color !default; @import './extra-styling'; + +.editable-field { + background-color: #e3f0fb !important; + &:hover:after { + content: url('data:image/svg+xml,'); + position: absolute; + top: 5px; + right: 5px; + width: 18px; + } + &.active:hover:after { + content: none; + } +} diff --git a/packages/vanilla-bundle/dist-grid-bundle-zip/slickgrid-vanilla-bundle.zip b/packages/vanilla-bundle/dist-grid-bundle-zip/slickgrid-vanilla-bundle.zip index f7187bf3e..e169217f7 100644 Binary files a/packages/vanilla-bundle/dist-grid-bundle-zip/slickgrid-vanilla-bundle.zip and b/packages/vanilla-bundle/dist-grid-bundle-zip/slickgrid-vanilla-bundle.zip differ diff --git a/packages/web-demo-vanilla-bundle/src/examples/example03.ts b/packages/web-demo-vanilla-bundle/src/examples/example03.ts index 961126d47..0cf193156 100644 --- a/packages/web-demo-vanilla-bundle/src/examples/example03.ts +++ b/packages/web-demo-vanilla-bundle/src/examples/example03.ts @@ -16,6 +16,12 @@ const myCustomTitleValidator = (value, args) => { return { valid: true, msg: '' }; }; +const customEditableInputFormatter = (row, cell, value, columnDef, dataContext, grid) => { + const isEditableLine = grid && grid.getOptions && grid.getOptions() && columnDef.editor; + value = (value === null || value === undefined) ? '' : value; + return isEditableLine ? { text: value, addClasses: 'editable-field', toolTip: 'Click to Edit' } : value; +}; + export class Example3 { columnDefinitions: Column[]; gridOptions: GridOption; @@ -49,6 +55,7 @@ export class Example3 { this.columnDefinitions = [ { id: 'title', name: 'Title', field: 'title', sortable: true, type: FieldType.string, + formatter: customEditableInputFormatter, editor: { model: Editors.longText, required: true, @@ -66,6 +73,7 @@ export class Example3 { }, { id: 'duration', name: 'Duration', field: 'duration', sortable: true, filterable: true, + formatter: customEditableInputFormatter, editor: { model: Editors.float, // required: true, @@ -93,7 +101,8 @@ export class Example3 { sortable: true, filterable: true, // filter: { model: Filters.compoundInput }, - formatter: Formatters.dollar, + // formatter: Formatters.dollar, + formatter: Formatters.multiple, params: { formatters: [Formatters.dollar, customEditableInputFormatter,] }, groupTotalsFormatter: GroupTotalFormatters.sumTotalsDollar, type: FieldType.number, grouping: { @@ -108,6 +117,7 @@ export class Example3 { }, { id: 'percentComplete', name: '% Complete', field: 'percentComplete', type: FieldType.number, + formatter: customEditableInputFormatter, editor: { model: Editors.slider, minValue: 0, @@ -130,8 +140,10 @@ export class Example3 { }, { id: 'start', name: 'Start', field: 'start', sortable: true, - formatter: Formatters.dateIso, type: FieldType.date, outputType: FieldType.dateIso, + // formatter: Formatters.dateIso, + type: FieldType.date, outputType: FieldType.dateIso, filterable: true, filter: { model: Filters.compoundDate }, + formatter: Formatters.multiple, params: { formatters: [Formatters.dateIso, customEditableInputFormatter,] }, editor: { model: Editors.date }, grouping: { getter: 'start', @@ -146,7 +158,9 @@ export class Example3 { { id: 'finish', name: 'Finish', field: 'finish', sortable: true, editor: { model: Editors.date, editorOptions: { minDate: 'today' }, }, - formatter: Formatters.dateIso, type: FieldType.date, outputType: FieldType.dateIso, + // formatter: Formatters.dateIso, + type: FieldType.date, outputType: FieldType.dateIso, + formatter: Formatters.multiple, params: { formatters: [Formatters.dateIso, customEditableInputFormatter,] }, filterable: true, filter: { model: Filters.compoundDate }, grouping: { getter: 'finish',