mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -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.
|
// render line breaks and strips them, updating the value.
|
||||||
/* tslint:disable:no-null-keyword */
|
/* 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);
|
||||||
|
let isStringNull = (Services.DBCellValue.isDBCellValue(value) && !value.isNull && value.displayValue === 'NULL');
|
||||||
if (valueMissing) {
|
if (valueMissing) {
|
||||||
/* tslint:disable:no-null-keyword */
|
returnVal = 'NULL';
|
||||||
returnVal = null;
|
}
|
||||||
|
else if (isStringNull) {
|
||||||
|
returnVal = '\'NULL\'';
|
||||||
}
|
}
|
||||||
else if (Services.DBCellValue.isDBCellValue(value)) {
|
else if (Services.DBCellValue.isDBCellValue(value)) {
|
||||||
returnVal = this.replaceLinebreaks(value.displayValue);
|
returnVal = this.replaceLinebreaks(value.displayValue);
|
||||||
@@ -509,6 +512,14 @@ export class EditDataGridPanel extends GridParentComponent {
|
|||||||
this.revertCurrentRow().catch(onUnexpectedError);
|
this.revertCurrentRow().catch(onUnexpectedError);
|
||||||
handled = true;
|
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;
|
return handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1083,11 +1094,15 @@ export class EditDataGridPanel extends GridParentComponent {
|
|||||||
let valueToDisplay = '';
|
let valueToDisplay = '';
|
||||||
let cellClasses = 'grid-cell-value-container';
|
let cellClasses = 'grid-cell-value-container';
|
||||||
/* tslint:disable:no-null-keyword */
|
/* 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) {
|
if (valueMissing) {
|
||||||
valueToDisplay = 'NULL';
|
valueToDisplay = 'NULL';
|
||||||
cellClasses += ' missing-value';
|
cellClasses += ' missing-value';
|
||||||
}
|
}
|
||||||
|
else if (isStringNull) {
|
||||||
|
valueToDisplay = '\'NULL\'';
|
||||||
|
}
|
||||||
else if (Services.DBCellValue.isDBCellValue(value)) {
|
else if (Services.DBCellValue.isDBCellValue(value)) {
|
||||||
valueToDisplay = (value.displayValue + '');
|
valueToDisplay = (value.displayValue + '');
|
||||||
valueToDisplay = escape(valueToDisplay.length > 250 ? valueToDisplay.slice(0, 250) + '...' : valueToDisplay);
|
valueToDisplay = escape(valueToDisplay.length > 250 ? valueToDisplay.slice(0, 250) + '...' : valueToDisplay);
|
||||||
|
|||||||
Reference in New Issue
Block a user