mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-23 01:25:38 -05:00
Add Null Shortcut and added NULL text for default NULL value. (#17085)
* added test key event * added null function to tryHandleKeyEvent * added null formatting * added working null insert. * added editDataGridPanel string null support
This commit is contained in:
@@ -188,9 +188,12 @@ export class EditDataGridPanel extends GridParentComponent {
|
||||
// render line breaks and strips them, updating the value.
|
||||
/* tslint:disable:no-null-keyword */
|
||||
let valueMissing = value === undefined || value === null || (Services.DBCellValue.isDBCellValue(value) && value.isNull);
|
||||
let isStringNull = (Services.DBCellValue.isDBCellValue(value) && !value.isNull && value.displayValue === 'NULL');
|
||||
if (valueMissing) {
|
||||
/* tslint:disable:no-null-keyword */
|
||||
returnVal = null;
|
||||
returnVal = 'NULL';
|
||||
}
|
||||
else if (isStringNull) {
|
||||
returnVal = '\'NULL\'';
|
||||
}
|
||||
else if (Services.DBCellValue.isDBCellValue(value)) {
|
||||
returnVal = this.replaceLinebreaks(value.displayValue);
|
||||
@@ -509,6 +512,14 @@ export class EditDataGridPanel extends GridParentComponent {
|
||||
this.revertCurrentRow().catch(onUnexpectedError);
|
||||
handled = true;
|
||||
}
|
||||
if (e.ctrlKey && e.keyCode === KeyCode.KEY_0) {
|
||||
//Replace contents with NULL in cell contents.
|
||||
document.execCommand('selectAll');
|
||||
document.execCommand('delete');
|
||||
document.execCommand('insertText', false, 'NULL');
|
||||
handled = true;
|
||||
}
|
||||
|
||||
return handled;
|
||||
}
|
||||
|
||||
@@ -1083,11 +1094,15 @@ export class EditDataGridPanel extends GridParentComponent {
|
||||
let valueToDisplay = '';
|
||||
let cellClasses = 'grid-cell-value-container';
|
||||
/* tslint:disable:no-null-keyword */
|
||||
let valueMissing = value === undefined || value === null || (Services.DBCellValue.isDBCellValue(value) && value.isNull);
|
||||
let valueMissing = value === undefined || value === null || (Services.DBCellValue.isDBCellValue(value) && value.isNull) || value === 'NULL';
|
||||
let isStringNull = (Services.DBCellValue.isDBCellValue(value) && !value.isNull && value.displayValue === 'NULL');
|
||||
if (valueMissing) {
|
||||
valueToDisplay = 'NULL';
|
||||
cellClasses += ' missing-value';
|
||||
}
|
||||
else if (isStringNull) {
|
||||
valueToDisplay = '\'NULL\'';
|
||||
}
|
||||
else if (Services.DBCellValue.isDBCellValue(value)) {
|
||||
valueToDisplay = (value.displayValue + '');
|
||||
valueToDisplay = escape(valueToDisplay.length > 250 ? valueToDisplay.slice(0, 250) + '...' : valueToDisplay);
|
||||
|
||||
Reference in New Issue
Block a user