@syncfusion/ej2-grids
Advanced tools
Comparing version 1.0.18 to 1.0.19
import { extend, addClass } from '@syncfusion/ej2-base'; | ||
import { remove, classList, createElement } from '@syncfusion/ej2-base'; | ||
import { FormValidator } from '@syncfusion/ej2-base'; | ||
import { isNullOrUndefined } from '@syncfusion/ej2-base'; | ||
@@ -47,4 +46,3 @@ import { parentsUntil, inArray } from '../base/util'; | ||
this.saveCell(); | ||
var rowCell = parentsUntil(e.target, 'e-rowcell'); | ||
if (rowCell && !this.parent.isEdit) { | ||
if (parentsUntil(e.target, 'e-rowcell') && !this.parent.isEdit) { | ||
this.setCellIdx(e.target); | ||
@@ -56,5 +54,2 @@ } | ||
var target = e.target; | ||
if (parentsUntil(target, 'e-grid').id !== this.parent.element.id) { | ||
return; | ||
} | ||
var tr = parentsUntil(e.target, 'e-row'); | ||
@@ -97,5 +92,5 @@ if ((parentsUntil(target, 'e-rowcell')) && tr) { | ||
} | ||
this.reFocusIfError(e); | ||
this.reFocusOnError(e); | ||
}; | ||
BatchEdit.prototype.reFocusIfError = function (e) { | ||
BatchEdit.prototype.reFocusOnError = function (e) { | ||
if (this.validateFormObj() && (e.action === 'tab' || e.action === 'shiftTab')) { | ||
@@ -107,4 +102,3 @@ e.target.focus(); | ||
BatchEdit.prototype.isAddRow = function (index) { | ||
var tr = this.parent.getDataRows()[index]; | ||
return tr.classList.contains('e-insertedrow'); | ||
return this.parent.getDataRows()[index].classList.contains('e-insertedrow'); | ||
}; | ||
@@ -190,3 +184,3 @@ BatchEdit.prototype.editNextCell = function () { | ||
BatchEdit.prototype.validateFormObj = function () { | ||
return this.formObj && !this.formObj.validate(); | ||
return this.parent.editModule.formObj && !this.parent.editModule.formObj.validate(); | ||
}; | ||
@@ -196,2 +190,5 @@ BatchEdit.prototype.batchSave = function () { | ||
this.saveCell(); | ||
if (gObj.isEdit) { | ||
return; | ||
} | ||
var changes = this.getBatchChanges(); | ||
@@ -204,3 +201,2 @@ var args = { batchChanges: changes, cancel: false }; | ||
gObj.notify(events.bulkSave, { changes: changes }); | ||
this.parent.notify(events.tooltipDestroy, {}); | ||
}; | ||
@@ -277,2 +273,3 @@ BatchEdit.prototype.getBatchChanges = function () { | ||
gObj.notify(events.toolbarRefresh, {}); | ||
gObj.element.focus(); | ||
}; | ||
@@ -354,3 +351,3 @@ BatchEdit.prototype.refreshRowIdx = function () { | ||
} | ||
else if (isAdd && !cols[i].template && cols[i].visible) { | ||
else if (isAdd && !cols[i].template && cols[i].visible && cols[i].allowEditing) { | ||
return i; | ||
@@ -367,3 +364,3 @@ } | ||
} | ||
else if (isAdd && !cols[i].template && cols[i].visible) { | ||
else if (isAdd && !cols[i].template && cols[i].visible && cols[i].allowEditing) { | ||
return i; | ||
@@ -375,3 +372,3 @@ } | ||
BatchEdit.prototype.checkNPCell = function (col) { | ||
return !col.template && col.visible && !col.isPrimaryKey && !col.isIdentity; | ||
return !col.template && col.visible && !col.isPrimaryKey && !col.isIdentity && col.allowEditing; | ||
}; | ||
@@ -433,7 +430,6 @@ BatchEdit.prototype.getDefaultData = function () { | ||
gObj.selectRow(this.cellDetails.rowIndex); | ||
gObj.isEdit = true; | ||
this.renderer.update(args); | ||
this.form = gObj.element.querySelector('#' + gObj.element.id + 'EditForm'); | ||
this.applyFormValidation(col); | ||
gObj.isEdit = true; | ||
gObj.notify(events.toolbarRefresh, {}); | ||
gObj.editModule.applyFormValidation([col]); | ||
this.parent.element.querySelector('.e-gridpopup').style.display = 'none'; | ||
@@ -505,6 +501,4 @@ } | ||
} | ||
gObj.editModule.destroyForm(); | ||
gObj.editModule.destroyWidgets([column]); | ||
if (this.formObj) { | ||
this.formObj.destroy(); | ||
} | ||
this.parent.notify(events.tooltipDestroy, {}); | ||
@@ -526,13 +520,2 @@ this.refreshTD(args.cell, column, gObj.getRowObjectFromUID(tr.getAttribute('data-uid')), args.value); | ||
}; | ||
BatchEdit.prototype.applyFormValidation = function (col) { | ||
var rules = {}; | ||
if (col.validationRules && this.form.querySelectorAll('#' + this.parent.element.id + col.field).length) { | ||
rules[col.field] = col.validationRules; | ||
this.formObj = new FormValidator(this.form, { | ||
rules: rules, | ||
validationComplete: this.valComplete.bind(this), | ||
customPlacement: this.customPlacement.bind(this) | ||
}); | ||
} | ||
}; | ||
BatchEdit.prototype.valComplete = function (args) { | ||
@@ -539,0 +522,0 @@ var edit = this.parent.editModule; |
import { createElement, isNullOrUndefined } from '@syncfusion/ej2-base'; | ||
import { Query, DataManager } from '@syncfusion/ej2-data'; | ||
import { EventHandler } from '@syncfusion/ej2-base'; | ||
import { EventHandler, closest } from '@syncfusion/ej2-base'; | ||
import { CheckBox } from '@syncfusion/ej2-buttons'; | ||
import * as events from '../base/constant'; | ||
@@ -45,12 +46,20 @@ import { Dialog, calculateRelativeBasedPosition } from '@syncfusion/ej2-popups'; | ||
var targetElement = e.target; | ||
if (targetElement.classList.contains('e-cctbn-icon') || targetElement.classList.contains('e-cc-toolbar')) { | ||
if ((this.initialOpenDlg && this.dlgObj.visible) || !this.isDlgOpen) { | ||
this.isDlgOpen = true; | ||
return; | ||
if (!isNullOrUndefined(closest(targetElement, '.e-cc')) || !isNullOrUndefined(closest(targetElement, '.e-cc-toolbar'))) { | ||
if (targetElement.classList.contains('e-columnchooser-btn') || targetElement.classList.contains('e-cc-toolbar')) { | ||
if ((this.initialOpenDlg && this.dlgObj.visible) || !this.isDlgOpen) { | ||
this.isDlgOpen = true; | ||
return; | ||
} | ||
} | ||
else if (targetElement.classList.contains('e-cc-cancel')) { | ||
targetElement.parentElement.querySelector('.e-ccsearch').value = ''; | ||
this.columnChooserSearch(''); | ||
this.removeCancelIcon(); | ||
} | ||
} | ||
else if (targetElement.classList.contains('e-cc-cancel')) { | ||
targetElement.parentElement.querySelector('.e-ccsearch').value = ''; | ||
this.columnChooserSearch(''); | ||
this.removeCancelIcon(); | ||
else { | ||
if (!isNullOrUndefined(this.dlgObj) && this.dlgObj.visible) { | ||
this.dlgObj.hide(); | ||
this.isDlgOpen = false; | ||
} | ||
} | ||
@@ -74,3 +83,3 @@ }; | ||
this.dlgObj.dataBind(); | ||
this.dlgObj.element.style.maxHeight = '390px'; | ||
this.dlgObj.element.style.maxHeight = '430px'; | ||
var elementVisible = this.dlgObj.element.style.display; | ||
@@ -82,3 +91,7 @@ this.dlgObj.element.style.display = 'block'; | ||
var dlgWidth = 250; | ||
if (!isNullOrUndefined(closest(target, '.e-bigger'))) { | ||
this.dlgObj.width = 253; | ||
} | ||
if (this.parent.element.classList.contains('e-device')) { | ||
this.dlgObj.target = document.body; | ||
this.dlgObj.position = { X: 'center', Y: 'center' }; | ||
@@ -93,3 +106,3 @@ this.dlgObj.refreshPosition(); | ||
else { | ||
this.dlgObj.element.style.left = (newpos.left - dlgWidth) + 42 + 'px'; | ||
this.dlgObj.element.style.left = ((newpos.left - dlgWidth) + target.closest('.e-cc-toolbar').clientWidth) + 2 + 'px'; | ||
} | ||
@@ -156,4 +169,4 @@ } | ||
buttonModel: { | ||
content: this.l10n.getConstant('OKButton'), | ||
cssClass: 'e-flat e-cc e-cc_okbtn', isPrimary: true | ||
content: this.l10n.getConstant('OKButton'), isPrimary: true, | ||
cssClass: 'e-cc e-cc_okbtn', | ||
} | ||
@@ -167,2 +180,3 @@ }, | ||
width: 250, | ||
cssClass: 'e-cc', | ||
animationSettings: { effect: 'None' }, | ||
@@ -231,5 +245,5 @@ }); | ||
ColumnChooser.prototype.checkstatecolumn = function (e) { | ||
var targetEle = e.target; | ||
var targetEle = e.event.target; | ||
var uncheckColumn = targetEle.id; | ||
if (targetEle.checked) { | ||
if (e.checked) { | ||
if (this.hideColumn.indexOf(uncheckColumn) !== -1) { | ||
@@ -315,22 +329,21 @@ this.hideColumn.splice(this.hideColumn.indexOf(uncheckColumn), 1); | ||
var showColState; | ||
var checkBoxObj; | ||
if (column.showInColumnChooser) { | ||
cclist = createElement('li', { className: 'e-cclist e-cc', styles: 'list-style:None', id: 'e-ccli_' + column.uid }); | ||
var cclabe = createElement('label', { className: 'e-cc' }); | ||
var cccheckboxlist = document.createElement('input'); | ||
cccheckboxlist.type = 'CheckBox'; | ||
cccheckboxlist.className = 'e-cc e-cc-chbox '; | ||
cccheckboxlist.id = 'e-cc' + column.uid; | ||
cccheckboxlist.onchange = this.checkstatecolumn.bind(this); | ||
var labElement = createElement('label', { className: 'e-cc e-cc-lab-name', attrs: { for: 'e-cc' + column.uid } }); | ||
labElement.textContent = column.headerText; | ||
var cccheckboxlist = createElement('input', { | ||
className: 'e-cc e-cc-chbox ', | ||
id: 'e-cc' + column.uid, attrs: { type: 'checkbox' } | ||
}); | ||
cclabe.appendChild(cccheckboxlist); | ||
cclabe.appendChild(labElement); | ||
hideColState = this.hideColumn.indexOf('e-cc' + column.uid) === -1 ? false : true; | ||
showColState = this.showColumn.indexOf('e-cc' + column.uid) === -1 ? false : true; | ||
checkBoxObj = new CheckBox({ label: column.headerText, checked: true, change: this.checkstatecolumn.bind(this) }); | ||
if ((column.visible && !hideColState) || showColState) { | ||
cccheckboxlist.checked = true; | ||
checkBoxObj.checked = true; | ||
} | ||
else { | ||
cccheckboxlist.checked = false; | ||
checkBoxObj.checked = false; | ||
} | ||
checkBoxObj.appendTo(cccheckboxlist); | ||
cclist.appendChild(cclabe); | ||
@@ -337,0 +350,0 @@ this.ulElement.appendChild(cclist); |
@@ -80,3 +80,5 @@ import { isNullOrUndefined, extend } from '@syncfusion/ej2-base'; | ||
if (args === void 0) { args = { requestType: '' }; } | ||
var key = this.getKey(args.foreignKeyData ? args.foreignKeyData : this.parent.getPrimaryKeyFieldNames()); | ||
var key = this.getKey(args.foreignKeyData && | ||
Object.keys(args.foreignKeyData).length ? | ||
args.foreignKeyData : this.parent.getPrimaryKeyFieldNames()); | ||
switch (args.requestType) { | ||
@@ -87,3 +89,3 @@ case 'delete': | ||
break; | ||
case 'add': | ||
case 'save': | ||
query = query ? query : this.generateQuery(); | ||
@@ -99,3 +101,5 @@ this.dataManager.insert(args.data, null, query, 0); | ||
var pr = 'promise'; | ||
var key = this.getKey(args.foreignKeyData ? args.foreignKeyData : this.parent.getPrimaryKeyFieldNames()); | ||
var key = this.getKey(args.foreignKeyData && | ||
Object.keys(args.foreignKeyData).length ? args.foreignKeyData : | ||
this.parent.getPrimaryKeyFieldNames()); | ||
switch (args.requestType) { | ||
@@ -102,0 +106,0 @@ case 'save': |
@@ -17,2 +17,3 @@ import { EventHandler } from '@syncfusion/ej2-base'; | ||
import { Tooltip } from '@syncfusion/ej2-popups'; | ||
import { FormValidator } from '@syncfusion/ej2-inputs'; | ||
var Edit = (function () { | ||
@@ -131,2 +132,3 @@ function Edit(parent, serviceLocator) { | ||
this.editModule.closeEdit(); | ||
this.refreshToolbar(); | ||
}; | ||
@@ -186,4 +188,4 @@ Edit.prototype.refreshToolbar = function () { | ||
Edit.prototype.editFormValidate = function () { | ||
if (this.editModule.formObj) { | ||
return this.editModule.formObj.validate(); | ||
if (this.formObj) { | ||
return this.formObj.validate(); | ||
} | ||
@@ -196,3 +198,3 @@ return false; | ||
Edit.prototype.getCurrentEditCellData = function () { | ||
var obj = this.getCurrentEditedData(this.editModule.formObj.element, {}); | ||
var obj = this.getCurrentEditedData(this.formObj.element, {}); | ||
return obj[Object.keys(obj)[0]]; | ||
@@ -306,2 +308,4 @@ }; | ||
this.parent.on(events.preventBatch, this.preventBatch, this); | ||
this.parent.on(events.destroyForm, this.destroyForm, this); | ||
this.parent.addEventListener(events.actionBegin, this.onActionBegin.bind(this)); | ||
this.parent.addEventListener(events.actionComplete, this.actionComplete.bind(this)); | ||
@@ -320,7 +324,11 @@ this.parent.on(events.initialEnd, this.wireEvents, this); | ||
this.parent.off(events.preventBatch, this.preventBatch); | ||
this.parent.off(events.destroyForm, this.destroyForm); | ||
this.parent.removeEventListener(events.actionComplete, this.actionComplete); | ||
this.parent.removeEventListener(events.actionBegin, this.onActionBegin); | ||
this.parent.off(events.initialEnd, this.unwireEvents); | ||
}; | ||
Edit.prototype.actionComplete = function () { | ||
this.parent.isEdit = false; | ||
Edit.prototype.actionComplete = function (e) { | ||
if (e.requestType !== 'add' && e.requestType !== 'beginEdit' && e.requestType !== 'delete') { | ||
this.parent.isEdit = false; | ||
} | ||
this.refreshToolbar(); | ||
@@ -345,2 +353,8 @@ }; | ||
}; | ||
Edit.prototype.onActionBegin = function (e) { | ||
if (this.parent.editSettings.mode !== 'batch' && this.formObj && !this.formObj.isDestroyed && !e.cancel) { | ||
this.destroyForm(); | ||
this.destroyWidgets(); | ||
} | ||
}; | ||
Edit.prototype.destroyWidgets = function (cols) { | ||
@@ -355,2 +369,9 @@ cols = cols ? cols : this.parent.columns; | ||
}; | ||
Edit.prototype.destroyForm = function () { | ||
this.parent.notify(events.tooltipDestroy, {}); | ||
if (this.formObj && !this.formObj.isDestroyed) { | ||
this.formObj.destroy(); | ||
} | ||
this.parent.notify(events.tooltipDestroy, {}); | ||
}; | ||
Edit.prototype.destroy = function () { | ||
@@ -392,6 +413,28 @@ this.removeEventListener(); | ||
}; | ||
Edit.prototype.applyFormValidation = function (cols) { | ||
var _this = this; | ||
var gObj = this.parent; | ||
var form = gObj.element.querySelector('.e-gridform'); | ||
var rules = {}; | ||
cols = cols ? cols : gObj.columns; | ||
for (var _i = 0, cols_2 = cols; _i < cols_2.length; _i++) { | ||
var col = cols_2[_i]; | ||
if (col.validationRules && form.querySelectorAll('#' + gObj.element.id + col.field).length) { | ||
rules[col.field] = col.validationRules; | ||
} | ||
} | ||
this.parent.editModule.formObj = new FormValidator(form, { | ||
rules: rules, | ||
validationComplete: function (args) { | ||
_this.validationComplete(args); | ||
}, | ||
customPlacement: function (inputElement, error) { | ||
_this.valErrorPlacement(inputElement, error); | ||
} | ||
}); | ||
}; | ||
Edit.prototype.valErrorPlacement = function (inputElement, error) { | ||
if (this.parent.isEdit) { | ||
var td = parentsUntil(inputElement, 'e-rowcell'); | ||
if (!td.ej2_instances) { | ||
if (!td.ej2_instances || !td.ej2_instances.length) { | ||
var tooltip = new Tooltip({ | ||
@@ -398,0 +441,0 @@ opensOn: 'custom', content: error, position: 'bottom center', cssClass: 'e-griderror', |
import { extend } from '@syncfusion/ej2-base'; | ||
import { remove } from '@syncfusion/ej2-base'; | ||
import { FormValidator } from '@syncfusion/ej2-base'; | ||
import { parentsUntil } from '../base/util'; | ||
@@ -15,5 +14,7 @@ import * as events from '../base/constant'; | ||
NormalEdit.prototype.clickHandler = function (e) { | ||
var target = e.target; | ||
var gObj = this.parent; | ||
if (parentsUntil(e.target, 'e-gridcontent')) { | ||
if (this.parent.isEdit) { | ||
if (parentsUntil(target, 'e-gridcontent')) { | ||
this.rowIndex = parentsUntil(target, 'e-rowcell') ? parseInt(target.parentElement.getAttribute('aria-rowindex'), 10) : -1; | ||
if (gObj.isEdit) { | ||
gObj.editModule.endEdit(); | ||
@@ -24,16 +25,12 @@ } | ||
NormalEdit.prototype.dblClickHandler = function (e) { | ||
var target = e.target; | ||
if (parentsUntil(target, 'e-grid').id !== this.parent.element.id || !this.parent.editSettings.allowEditOnDblClick) { | ||
return; | ||
if (parentsUntil(e.target, 'e-rowcell') && this.parent.editSettings.allowEditOnDblClick) { | ||
this.parent.editModule.startEdit(parentsUntil(e.target, 'e-row')); | ||
} | ||
if (parentsUntil(target, 'e-rowcell')) { | ||
this.parent.editModule.startEdit(parentsUntil(target, 'e-row')); | ||
} | ||
}; | ||
NormalEdit.prototype.editComplete = function (e) { | ||
switch (e.requestType) { | ||
case 'add': | ||
case 'save': | ||
this.parent.selectRow(0); | ||
this.parent.trigger(events.actionComplete, extend(e, { | ||
requestType: 'add', | ||
requestType: 'save', | ||
type: events.actionComplete | ||
@@ -43,3 +40,3 @@ })); | ||
case 'delete': | ||
this.parent.selectRow(this.lastSelIndex); | ||
this.parent.selectRow(this.editRowIndex); | ||
this.parent.trigger(events.actionComplete, extend(e, { | ||
@@ -53,6 +50,2 @@ requestType: 'delete', | ||
}; | ||
NormalEdit.prototype.onActionComplete = function () { | ||
this.parent.isEdit = false; | ||
this.destroyForm(); | ||
}; | ||
NormalEdit.prototype.startEdit = function (tr) { | ||
@@ -62,7 +55,4 @@ var gObj = this.parent; | ||
var primaryKeyValues = []; | ||
var rowIndex = parseInt(tr.getAttribute('aria-rowindex'), 10); | ||
this.previousData = gObj.getCurrentViewRecords()[rowIndex]; | ||
gObj.clearSelection(); | ||
gObj.selectRow(rowIndex); | ||
gObj.isEdit = true; | ||
this.rowIndex = this.editRowIndex = parseInt(tr.getAttribute('aria-rowindex'), 10); | ||
this.previousData = gObj.getCurrentViewRecords()[this.rowIndex]; | ||
for (var i = 0; i < primaryKeys.length; i++) { | ||
@@ -72,39 +62,46 @@ primaryKeyValues.push(this.previousData[primaryKeys[i]]); | ||
var args = { | ||
row: tr, primaryKey: primaryKeys, primaryKeyValue: primaryKeyValues, | ||
rowData: this.previousData, rowIndex: rowIndex, type: 'edit', cancel: false | ||
row: tr, primaryKey: primaryKeys, primaryKeyValue: primaryKeyValues, requestType: 'beginEdit', | ||
rowData: this.previousData, rowIndex: this.rowIndex, type: 'edit', cancel: false | ||
}; | ||
gObj.trigger(events.beginEdit, args); | ||
args.type = 'actionBegin'; | ||
gObj.trigger(events.actionBegin, args); | ||
if (args.cancel) { | ||
return; | ||
} | ||
this.lastSelIndex = this.parent.selectedRowIndex; | ||
gObj.clearSelection(); | ||
gObj.isEdit = true; | ||
this.renderer.update(args); | ||
this.uid = tr.getAttribute('data-uid'); | ||
this.applyFormValidation(); | ||
gObj.editModule.applyFormValidation(); | ||
args.type = 'actionComplete'; | ||
gObj.trigger(events.actionComplete, args); | ||
}; | ||
NormalEdit.prototype.endEdit = function () { | ||
var gObj = this.parent; | ||
if (!this.parent.isEdit || !this.formObj.validate()) { | ||
if (!this.parent.isEdit || !gObj.editModule.formObj.validate()) { | ||
return; | ||
} | ||
var formElement = gObj.element.querySelector('.e-gridform'); | ||
var editedData = extend({}, this.previousData); | ||
editedData = gObj.editModule.getCurrentEditedData(formElement, editedData); | ||
gObj.editModule.destroyWidgets(); | ||
var args = { | ||
requestType: 'save', type: events.actionBegin, data: editedData, cancel: false, | ||
previousData: this.previousData, selectedRow: gObj.selectedRowIndex, foreignKeyData: {} | ||
}; | ||
editedData = gObj.editModule.getCurrentEditedData(gObj.element.querySelector('.e-gridform'), editedData); | ||
if (gObj.element.querySelectorAll('.e-editedrow').length) { | ||
var args = { | ||
requestType: 'save', type: events.actionBegin, data: editedData, | ||
previousData: this.previousData, selectedRow: gObj.selectedRowIndex | ||
}; | ||
args.action = 'edit'; | ||
gObj.trigger(events.actionBegin, args); | ||
gObj.notify(events.updateData, { requestType: 'save', data: editedData }); | ||
if (args.cancel) { | ||
return; | ||
} | ||
gObj.notify(events.updateData, args); | ||
} | ||
else { | ||
gObj.notify(events.modelChanged, { | ||
requestType: 'add', type: events.actionComplete, data: editedData, | ||
previousData: this.previousData, selectedRow: gObj.selectedRowIndex | ||
}); | ||
args.action = 'add'; | ||
args.selectedRow = 0; | ||
gObj.notify(events.modelChanged, args); | ||
if (args.cancel) { | ||
return; | ||
} | ||
} | ||
this.parent.notify(events.tooltipDestroy, {}); | ||
this.parent.notify(events.dialogDestroy, {}); | ||
@@ -139,3 +136,3 @@ this.stopEditStatus(); | ||
this.parent.trigger(events.actionComplete, args); | ||
this.parent.selectRow(this.parent.selectedRowIndex > -1 ? this.parent.selectedRowIndex : this.lastSelIndex); | ||
this.parent.selectRow(this.rowIndex > -1 ? this.rowIndex : this.editRowIndex); | ||
this.parent.element.focus(); | ||
@@ -155,18 +152,15 @@ }; | ||
NormalEdit.prototype.closeEdit = function () { | ||
if (this.parent.isEdit) { | ||
var gObj = this.parent; | ||
this.parent.editModule.destroyWidgets(); | ||
this.parent.notify(events.tooltipDestroy, {}); | ||
this.stopEditStatus(); | ||
var args = { | ||
requestType: 'cancel', type: events.actionBegin, data: this.previousData, selectedRow: gObj.selectedRowIndex | ||
}; | ||
gObj.trigger(events.actionBegin, args); | ||
args.type = events.actionComplete; | ||
var gObj = this.parent; | ||
var args = { | ||
requestType: 'cancel', type: events.actionBegin, data: this.previousData, selectedRow: gObj.selectedRowIndex | ||
}; | ||
gObj.trigger(events.actionBegin, args); | ||
this.stopEditStatus(); | ||
args.type = events.actionComplete; | ||
if (gObj.editSettings.mode !== 'dialog') { | ||
this.refreshRow(args.data); | ||
gObj.selectRow(this.lastSelIndex); | ||
gObj.element.focus(); | ||
gObj.trigger(events.actionComplete, args); | ||
this.parent.notify(events.toolbarRefresh, {}); | ||
} | ||
gObj.selectRow(this.rowIndex); | ||
gObj.element.focus(); | ||
gObj.trigger(events.actionComplete, args); | ||
}; | ||
@@ -186,11 +180,9 @@ NormalEdit.prototype.addRecord = function (data) { | ||
this.uid = ''; | ||
gObj.clearSelection(); | ||
var addData = {}; | ||
for (var _i = 0, _a = gObj.columns; _i < _a.length; _i++) { | ||
var col = _a[_i]; | ||
addData[col.field] = data && data[col.field] ? data[col.field] : col.defaultValue; | ||
this.previousData[col.field] = data && data[col.field] ? data[col.field] : col.defaultValue; | ||
} | ||
var args = { | ||
cancel: false, | ||
requestType: 'add', rowData: addData, type: events.actionComplete | ||
cancel: false, foreignKeyData: {}, | ||
requestType: 'add', data: this.previousData, type: events.actionBegin | ||
}; | ||
@@ -201,12 +193,15 @@ gObj.trigger(events.actionBegin, args); | ||
} | ||
this.renderer.addNew({ rowData: args.rowData, type: 'add' }); | ||
this.applyFormValidation(); | ||
gObj.clearSelection(); | ||
gObj.isEdit = true; | ||
this.renderer.addNew({ rowData: args.data, requestType: 'add' }); | ||
gObj.editModule.applyFormValidation(); | ||
args.type = events.actionComplete; | ||
args.row = gObj.element.querySelector('.e-addedrow'); | ||
gObj.trigger(events.actionComplete, args); | ||
}; | ||
NormalEdit.prototype.deleteRecord = function (fieldname, data) { | ||
this.lastSelIndex = this.parent.selectedRowIndex; | ||
this.editRowIndex = this.parent.selectedRowIndex; | ||
this.parent.notify(events.modelChanged, { | ||
requestType: 'delete', type: events.actionBegin, foreignKeyData: fieldname ? | ||
[fieldname] : this.parent.getPrimaryKeyFieldNames(), | ||
data: data ? [data] : this.parent.getSelectedRecords(), tr: this.parent.getSelectedRows() | ||
requestType: 'delete', type: events.actionBegin, foreignKeyData: {}, | ||
data: data ? [data] : this.parent.getSelectedRecords(), tr: this.parent.getSelectedRows(), cancel: false | ||
}); | ||
@@ -225,34 +220,3 @@ }; | ||
} | ||
this.formObj.destroy(); | ||
}; | ||
NormalEdit.prototype.destroyForm = function () { | ||
this.parent.notify(events.tooltipDestroy, {}); | ||
if (this.formObj && !this.formObj.isDestroyed) { | ||
this.formObj.destroy(); | ||
} | ||
this.parent.notify(events.tooltipDestroy, {}); | ||
}; | ||
NormalEdit.prototype.applyFormValidation = function () { | ||
var _this = this; | ||
var gObj = this.parent; | ||
var form = gObj.element.querySelector('.e-gridform'); | ||
var rules = {}; | ||
for (var _i = 0, _a = gObj.columns; _i < _a.length; _i++) { | ||
var col = _a[_i]; | ||
if (col.validationRules && form.querySelectorAll('#' + gObj.element.id + col.field).length) { | ||
rules[col.field] = col.validationRules; | ||
} | ||
} | ||
this.formObj = new FormValidator(form, { | ||
rules: rules, | ||
validationComplete: function (args) { | ||
var edit = _this.parent.editModule; | ||
edit.validationComplete(args); | ||
}, | ||
customPlacement: function (inputElement, error) { | ||
var edit = _this.parent.editModule; | ||
edit.valErrorPlacement(inputElement, error); | ||
} | ||
}); | ||
}; | ||
NormalEdit.prototype.addEventListener = function () { | ||
@@ -263,3 +227,2 @@ if (this.parent.isDestroyed) { | ||
this.parent.on(events.crudAction, this.editHandler, this); | ||
this.parent.on(events.destroyForm, this.destroyForm, this); | ||
this.parent.on(events.doubleTap, this.dblClickHandler, this); | ||
@@ -269,4 +232,3 @@ this.parent.on(events.click, this.clickHandler, this); | ||
this.parent.on(events.deleteComplete, this.editComplete, this); | ||
this.parent.on(events.addComplete, this.editComplete, this); | ||
this.parent.addEventListener(events.actionComplete, this.onActionComplete.bind(this)); | ||
this.parent.on(events.saveComplete, this.editComplete, this); | ||
}; | ||
@@ -278,3 +240,2 @@ NormalEdit.prototype.removeEventListener = function () { | ||
this.parent.off(events.crudAction, this.editHandler); | ||
this.parent.off(events.destroyForm, this.destroyForm); | ||
this.parent.off(events.doubleTap, this.dblClickHandler); | ||
@@ -284,4 +245,3 @@ this.parent.off(events.click, this.clickHandler); | ||
this.parent.off(events.deleteComplete, this.editComplete); | ||
this.parent.off(events.addComplete, this.editComplete); | ||
this.parent.removeEventListener(events.actionComplete, this.onActionComplete); | ||
this.parent.off(events.saveComplete, this.editComplete); | ||
}; | ||
@@ -288,0 +248,0 @@ NormalEdit.prototype.destroy = function () { |
import { extend } from '@syncfusion/ej2-base'; | ||
import { closest as closestElement, removeClass, classList, createElement, remove } from '@syncfusion/ej2-base'; | ||
import { getElementIndex, inArray, iterateArrayOrObject, parentsUntil, getPosition, isActionPrevent } from '../base/util'; | ||
import { getElementIndex, inArray, parentsUntil, getPosition, isActionPrevent } from '../base/util'; | ||
import * as events from '../base/constant'; | ||
@@ -117,3 +117,3 @@ var Reorder = (function () { | ||
Reorder.prototype.reorderColumns = function (fromFName, toFName) { | ||
var column = this.getColumnByField(toFName); | ||
var column = this.parent.getColumnByField(toFName); | ||
var parent = this.getColParent(column, this.parent.columns); | ||
@@ -123,3 +123,3 @@ var columns = parent ? parent.columns : this.parent.columns; | ||
if (destIndex > -1) { | ||
this.moveColumns(destIndex, this.getColumnByField(fromFName)); | ||
this.moveColumns(destIndex, this.parent.getColumnByField(fromFName)); | ||
} | ||
@@ -161,4 +161,3 @@ }; | ||
removeClass(gObj.getHeaderTable().querySelectorAll('.e-reorderindicate'), ['e-reorderindicate']); | ||
this.upArrow.style.display = 'none'; | ||
this.downArrow.style.display = 'none'; | ||
this.setDisplay('none'); | ||
this.stopTimer(); | ||
@@ -195,4 +194,3 @@ classList(cloneElement, ['e-defaultcur'], ['e-notallowedcur']); | ||
if (scrollLeft !== scrollElem.scrollLeft) { | ||
this.upArrow.style.display = 'none'; | ||
this.downArrow.style.display = 'none'; | ||
this.setDisplay('none'); | ||
} | ||
@@ -212,4 +210,3 @@ }; | ||
this.upArrow.style.left = this.downArrow.style.left = (isLeft ? cliRect.left : cliRect.right) - cliRectBase.left - 4 + 'px'; | ||
this.upArrow.style.display = ''; | ||
this.downArrow.style.display = ''; | ||
this.setDisplay(''); | ||
}; | ||
@@ -228,4 +225,3 @@ Reorder.prototype.dragStart = function (e) { | ||
var gObj = this.parent; | ||
this.upArrow.style.display = 'none'; | ||
this.downArrow.style.display = 'none'; | ||
this.setDisplay('none'); | ||
this.stopTimer(); | ||
@@ -237,15 +233,11 @@ if (!e.cancel) { | ||
}; | ||
Reorder.prototype.setDisplay = function (display) { | ||
this.upArrow.style.display = display; | ||
this.downArrow.style.display = display; | ||
}; | ||
Reorder.prototype.getModuleName = function () { | ||
return 'reorder'; | ||
}; | ||
Reorder.prototype.getColumnByField = function (field) { | ||
return iterateArrayOrObject(this.getColumnsModel(this.parent.columns), function (item, index) { | ||
if (item.field === field) { | ||
return item; | ||
} | ||
return undefined; | ||
})[0]; | ||
}; | ||
return Reorder; | ||
}()); | ||
export { Reorder }; |
@@ -16,2 +16,4 @@ import { EventHandler, createElement, detach, formatUnit, Browser, closest } from '@syncfusion/ej2-base'; | ||
function Resize(parent) { | ||
this.tapped = false; | ||
this.isDblClk = true; | ||
this.parent = parent; | ||
@@ -58,14 +60,19 @@ if (this.parent.isDestroyed) { | ||
this.widthService.setColumnWidth(gObj.getColumns()[index]); | ||
result = gObj.getColumns().some(function (x) { return x.width === null || x.width === undefined || x.width.length <= 0; }); | ||
if (result === false) { | ||
gObj.getColumns().forEach(function (element) { | ||
tWidth = tWidth + parseInt(element.width, 10); | ||
}); | ||
if (!this.parent.allowResizing) { | ||
result = gObj.getColumns().some(function (x) { return x.width === null || x.width === undefined || x.width.length <= 0; }); | ||
if (result === false) { | ||
gObj.getColumns().forEach(function (element) { | ||
if (element.visible) { | ||
tWidth = tWidth + parseInt(element.width, 10); | ||
} | ||
}); | ||
} | ||
var tableWidth_1 = tWidth + indentWidth; | ||
if (tWidth > 0) { | ||
headerTable.style.width = formatUnit(tableWidth_1); | ||
contentTable.style.width = formatUnit(tableWidth_1); | ||
} | ||
} | ||
var tableWidth = headerTable.offsetWidth; | ||
var contentwidth = (gObj.getContent().scrollWidth); | ||
var tableWidth = tWidth + indentWidth; | ||
if (tWidth > 0) { | ||
headerTable.style.width = formatUnit(tableWidth); | ||
contentTable.style.width = formatUnit(tableWidth); | ||
} | ||
if (contentwidth > tableWidth) { | ||
@@ -138,2 +145,3 @@ headerTable.classList.add('e-tableborder'); | ||
} | ||
this.setHandlerHeight(); | ||
}; | ||
@@ -158,2 +166,7 @@ Resize.prototype.wireEvents = function () { | ||
}; | ||
Resize.prototype.setHandlerHeight = function () { | ||
[].slice.call(this.parent.getHeaderTable().querySelectorAll('.' + resizeClassList.suppress)).forEach(function (ele) { | ||
ele.style.height = ele.parentElement.offsetHeight + 'px'; | ||
}); | ||
}; | ||
Resize.prototype.callAutoFit = function (e) { | ||
@@ -169,2 +182,11 @@ var col = this.getTargetColumn(e); | ||
this.pageX = this.getPointX(e); | ||
if (this.parent.enableRtl) { | ||
this.minMove = parseInt(this.column.width.toString(), 10) | ||
- (this.column.minWidth ? parseInt(this.column.minWidth.toString(), 10) : 0); | ||
} | ||
else { | ||
this.minMove = (this.column.minWidth ? parseInt(this.column.minWidth.toString(), 10) : 0) | ||
- parseInt(this.column.width.toString(), 10); | ||
} | ||
this.minMove += this.pageX; | ||
} | ||
@@ -204,19 +226,43 @@ if (Browser.isDevice && !this.helper.classList.contains(resizeClassList.icon)) { | ||
}; | ||
Resize.prototype.getWidth = function (width, minWidth, maxWidth) { | ||
if (minWidth && width < minWidth) { | ||
return minWidth; | ||
} | ||
else if ((maxWidth && width > maxWidth)) { | ||
return maxWidth; | ||
} | ||
else { | ||
return width; | ||
} | ||
}; | ||
Resize.prototype.resizing = function (e) { | ||
var pageX = this.getPointX(e); | ||
var mousemove = this.parent.enableRtl ? -(pageX - this.pageX) : (pageX - this.pageX); | ||
this.column.width = formatUnit(parseInt(this.widthService.getWidth(this.column).toString(), 10) + mousemove); | ||
this.pageX = pageX; | ||
var args = { | ||
e: e, | ||
column: this.column | ||
var colData = { | ||
width: parseInt(this.widthService.getWidth(this.column).toString(), 10) + mousemove, | ||
minWidth: this.column.minWidth ? parseInt(this.column.minWidth.toString(), 10) : null, | ||
maxWidth: this.column.maxWidth ? parseInt(this.column.maxWidth.toString(), 10) : null | ||
}; | ||
this.parent.trigger(events.onResize, args); | ||
if (args.cancel) { | ||
this.cancelResizeAction(true); | ||
return; | ||
var width = this.getWidth(colData.width, colData.minWidth, colData.maxWidth); | ||
if ((!this.parent.enableRtl && this.minMove >= pageX) || (this.parent.enableRtl && this.minMove <= pageX)) { | ||
width = this.column.minWidth ? parseInt(this.column.minWidth.toString(), 10) : 0; | ||
this.pageX = pageX = this.minMove; | ||
} | ||
this.updateColGroup(this.column); | ||
this.widthService.setColumnWidth(this.column, null, 'resize'); | ||
this.updateHelper(); | ||
if (width !== parseInt(this.column.width.toString(), 10)) { | ||
this.pageX = pageX; | ||
this.column.width = formatUnit(width); | ||
var args = { | ||
e: e, | ||
column: this.column | ||
}; | ||
this.parent.trigger(events.onResize, args); | ||
if (args.cancel) { | ||
this.cancelResizeAction(true); | ||
return; | ||
} | ||
this.updateColGroup(this.column); | ||
this.widthService.setColumnWidth(this.column, null, 'resize'); | ||
this.updateHelper(); | ||
} | ||
this.isDblClk = false; | ||
}; | ||
@@ -237,2 +283,4 @@ Resize.prototype.resizeEnd = function (e) { | ||
this.refresh(); | ||
this.doubleTapEvent(e); | ||
this.isDblClk = true; | ||
}; | ||
@@ -317,3 +365,3 @@ Resize.prototype.getPointX = function (e) { | ||
(offsetParent === doc.body || offsetParent === doc.documentElement) && | ||
offsetParent.style.position === 'static' || '') { | ||
offsetParent.style.position === 'static') { | ||
offsetParent = offsetParent.parentNode; | ||
@@ -329,4 +377,23 @@ } | ||
}; | ||
Resize.prototype.doubleTapEvent = function (e) { | ||
if (this.getUserAgent() && this.isDblClk) { | ||
if (!this.tapped) { | ||
this.tapped = setTimeout(this.timeoutHandler(), 300); | ||
} | ||
else { | ||
clearTimeout(this.tapped); | ||
this.callAutoFit(e); | ||
this.tapped = null; | ||
} | ||
} | ||
}; | ||
Resize.prototype.getUserAgent = function () { | ||
var userAgent = Browser.userAgent.toLowerCase(); | ||
return /iphone|ipod|ipad/.test(userAgent); | ||
}; | ||
Resize.prototype.timeoutHandler = function () { | ||
this.tapped = null; | ||
}; | ||
return Resize; | ||
}()); | ||
export { Resize }; |
@@ -21,3 +21,3 @@ import { Browser, EventHandler } from '@syncfusion/ej2-base'; | ||
this.parent.element.style.width = formatUnit(this.parent.width); | ||
if (this.parent.toolbarModule) { | ||
if (this.parent.toolbarModule && this.parent.toolbarModule.toolbar.element) { | ||
this.parent.toolbarModule.toolbar.refreshOverflow(); | ||
@@ -24,0 +24,0 @@ } |
@@ -39,3 +39,3 @@ import { Browser, EventHandler } from '@syncfusion/ej2-base'; | ||
Selection.prototype.isEditing = function () { | ||
return (this.parent.editSettings.mode !== 'batch' && this.parent.isEdit); | ||
return this.parent.editSettings.mode !== 'batch' && this.parent.isEdit; | ||
}; | ||
@@ -47,5 +47,2 @@ Selection.prototype.selectRow = function (index) { | ||
if (!this.isRowType() || !selectedRow || this.isEditing()) { | ||
if (this.isEditing()) { | ||
gObj.selectedRowIndex = index; | ||
} | ||
return; | ||
@@ -400,5 +397,2 @@ } | ||
}; | ||
Selection.prototype.isEdit = function () { | ||
return this.parent.isEdit; | ||
}; | ||
Selection.prototype.clearCell = function () { | ||
@@ -405,0 +399,0 @@ this.clearCellSelection(); |
@@ -216,2 +216,3 @@ import { Browser } from '@syncfusion/ej2-base'; | ||
!e.target.classList.contains('e-stackedheadercell') && | ||
!e.target.classList.contains('e-stackedheadercelldiv') && | ||
!e.target.classList.contains('e-rhandler')) { | ||
@@ -218,0 +219,0 @@ var gObj = this.parent; |
@@ -1,5 +0,6 @@ | ||
import { EventHandler } from '@syncfusion/ej2-base'; | ||
import { EventHandler, extend } from '@syncfusion/ej2-base'; | ||
import { createElement, remove } from '@syncfusion/ej2-base'; | ||
import { Toolbar as tool } from '@syncfusion/ej2-navigations'; | ||
import * as events from '../base/constant'; | ||
import { templateCompiler } from '../base/util'; | ||
var Toolbar = (function () { | ||
@@ -15,3 +16,4 @@ function Toolbar(parent, serviceLocator) { | ||
this.l10n = this.serviceLocator.getService('localization'); | ||
var preItems = ['add', 'edit', 'update', 'delete', 'cancel', 'print', 'pdfexport', 'excelexport', 'wordexport']; | ||
var preItems = ['add', 'edit', 'update', 'delete', 'cancel', 'print', | ||
'pdfexport', 'excelexport', 'wordexport', 'csvexport']; | ||
for (var _i = 0, preItems_1 = preItems; _i < preItems_1.length; _i++) { | ||
@@ -34,5 +36,4 @@ var item = preItems_1[_i]; | ||
this.predefinedItems.columnchooser = { | ||
id: this.gridID + '_columnchooser', template: '<div class="e-ccdiv e-cc-toolbar" >\ | ||
<span id="' + this.gridID + '_e-ccbutton" class="e-columnchooser e-cctbn-icon e-icons"></span>\ | ||
</div>', align: 'right' | ||
id: this.gridID + '_' + 'columnchooser', cssClass: 'e-cc e-ccdiv e-cc-toolbar', suffixIcon: 'e-' + 'columnchooser-btn', | ||
text: 'Columns', tooltipText: 'columns', align: 'right', | ||
}; | ||
@@ -61,7 +62,15 @@ this.createToolbar(); | ||
this.element = createElement('div', { id: this.gridID + '_toolbarItems' }); | ||
if (this.parent.toolbarTemplate) { | ||
if (typeof (this.parent.toolbarTemplate) === 'string') { | ||
this.toolbar.appendTo(this.parent.toolbarTemplate); | ||
this.element = this.toolbar.element; | ||
} | ||
else { | ||
this.element = templateCompiler(this.parent.toolbarTemplate)()[1]; | ||
} | ||
} | ||
else { | ||
this.toolbar.appendTo(this.element); | ||
} | ||
this.parent.element.insertBefore(this.element, this.parent.getHeaderContent()); | ||
if (!Array.isArray(this.parent.toolbar)) { | ||
this.element.appendChild(document.querySelector(this.parent.toolbar)); | ||
} | ||
this.toolbar.appendTo(this.element); | ||
this.searchElement = this.element.querySelector('#' + this.gridID + '_searchbar'); | ||
@@ -107,11 +116,22 @@ this.wireEvent(); | ||
var items = []; | ||
var toolbarItems = this.parent.toolbar || []; | ||
if (typeof (this.parent.toolbar) === 'string') { | ||
return []; | ||
} | ||
for (var _i = 0, _a = this.parent.toolbar; _i < _a.length; _i++) { | ||
var item = _a[_i]; | ||
typeof (item) === 'string' ? items.push(this.getItemObject(item)) : items.push(item); | ||
for (var _i = 0, toolbarItems_1 = toolbarItems; _i < toolbarItems_1.length; _i++) { | ||
var item = toolbarItems_1[_i]; | ||
typeof (item) === 'string' ? items.push(this.getItemObject(item)) : items.push(this.getItem(item)); | ||
} | ||
return items; | ||
}; | ||
Toolbar.prototype.getItem = function (itemObject) { | ||
var item = this.predefinedItems[itemObject.text]; | ||
if (item) { | ||
extend(item, item, itemObject); | ||
} | ||
else { | ||
item = itemObject; | ||
} | ||
return item; | ||
}; | ||
Toolbar.prototype.getItemObject = function (itemName) { | ||
@@ -118,0 +138,0 @@ return this.predefinedItems[itemName] || { text: itemName, id: this.gridID + '_' + itemName }; |
@@ -102,2 +102,3 @@ export var created = 'create'; | ||
export var addComplete = 'add-complete'; | ||
export var saveComplete = 'save-complete'; | ||
export var deleteBegin = 'delete-begin'; | ||
@@ -104,0 +105,0 @@ export var deleteComplete = 'delete-complete'; |
@@ -17,3 +17,3 @@ var __extends = (this && this.__extends) || (function () { | ||
}; | ||
import { Component, ChildProperty, compile as templateComplier, Browser } from '@syncfusion/ej2-base'; | ||
import { Component, ChildProperty, Browser } from '@syncfusion/ej2-base'; | ||
import { isNullOrUndefined } from '@syncfusion/ej2-base'; | ||
@@ -23,3 +23,3 @@ import { createElement, addClass, removeClass, append, classList } from '@syncfusion/ej2-base'; | ||
import { EventHandler, KeyboardEvents } from '@syncfusion/ej2-base'; | ||
import { iterateArrayOrObject, prepareColumns, parentsUntil } from './util'; | ||
import { iterateArrayOrObject, prepareColumns, parentsUntil, wrap, templateCompiler } from './util'; | ||
import * as events from '../base/constant'; | ||
@@ -167,2 +167,13 @@ import { Render } from '../renderer/render'; | ||
], RowDropSettings.prototype, "targetID", void 0); | ||
var TextWrapSettings = (function (_super) { | ||
__extends(TextWrapSettings, _super); | ||
function TextWrapSettings() { | ||
return _super !== null && _super.apply(this, arguments) || this; | ||
} | ||
return TextWrapSettings; | ||
}(ChildProperty)); | ||
export { TextWrapSettings }; | ||
__decorate([ | ||
Property('both') | ||
], TextWrapSettings.prototype, "wrapMode", void 0); | ||
var GroupSettings = (function (_super) { | ||
@@ -232,2 +243,3 @@ __extends(GroupSettings, _super); | ||
_this.isMediaQuery = false; | ||
_this.isInitialLoad = false; | ||
_this.filterOperators = { | ||
@@ -256,2 +268,3 @@ contains: 'contains', endsWith: 'endswith', equal: 'equal', greaterThan: 'greaterthan', greaterThanOrEqual: 'greaterthanorequal', | ||
Wordexport: 'Word Export', | ||
Csvexport: 'CSV Export', | ||
Search: 'Search', | ||
@@ -315,3 +328,3 @@ Item: 'item', | ||
'columnSelecting', 'columnSelected', 'cellSelecting', 'cellSelected', 'dataBound', 'groupSettings', 'columns', 'allowKeyboard', | ||
'enableAltRow', 'enableHover', 'allowTextWrap', 'searchSettings', 'selectedRowIndex', 'allowReordering', | ||
'enableAltRow', 'enableHover', 'allowTextWrap', 'textWrapSettings', 'searchSettings', 'selectedRowIndex', 'allowReordering', | ||
'allowRowDragAndDrop', 'rowDropSettings', 'allowGrouping', 'height', 'width', 'rowTemplate', 'printMode', | ||
@@ -383,3 +396,3 @@ 'rowDataBound', 'queryCellInfo', 'rowDeselecting', 'rowDeselected', 'cellDeselecting', 'cellDeselected', | ||
} | ||
if (this.toolbar) { | ||
if (this.toolbar || this.toolbarTemplate) { | ||
modules.push({ | ||
@@ -402,8 +415,2 @@ member: 'toolbar', | ||
} | ||
if (this.showColumnChooser) { | ||
modules.push({ | ||
member: 'columnChooser', | ||
args: [this, this.serviceLocator] | ||
}); | ||
} | ||
return modules; | ||
@@ -418,2 +425,3 @@ }; | ||
this.renderModule = new Render(this, this.serviceLocator); | ||
this.getMediaColumns(); | ||
this.searchModule = new Search(this); | ||
@@ -434,12 +442,16 @@ this.scrollModule = new Scroll(this); | ||
this.notify(events.initialEnd, {}); | ||
this.getMediaColumns(); | ||
}; | ||
Grid.prototype.getMediaColumns = function () { | ||
var gcol = this.getColumns(); | ||
this.getShowHideService = this.serviceLocator.getService('showHideService'); | ||
for (var index = 0; index < gcol.length; index++) { | ||
if (!isNullOrUndefined(gcol[index].hideAtMedia)) { | ||
this.mediaCol.push(gcol[index]); | ||
var media = window.matchMedia(gcol[index].hideAtMedia); | ||
media.addListener(this.mediaQueryUpdate.bind(this, index)); | ||
if (!this.enableColumnVirtualization) { | ||
var gcol = this.getColumns(); | ||
this.getShowHideService = this.serviceLocator.getService('showHideService'); | ||
if (!isNullOrUndefined(gcol)) { | ||
for (var index = 0; index < gcol.length; index++) { | ||
if (!isNullOrUndefined(gcol[index].hideAtMedia)) { | ||
this.mediaCol.push(gcol[index]); | ||
var media = window.matchMedia(gcol[index].hideAtMedia); | ||
this.mediaQueryUpdate(index, media); | ||
media.addListener(this.mediaQueryUpdate.bind(this, index)); | ||
} | ||
} | ||
} | ||
@@ -449,10 +461,13 @@ } | ||
Grid.prototype.mediaQueryUpdate = function (columnIndex, e) { | ||
this.isMediaQuery = true; | ||
var col = this.getColumns()[columnIndex]; | ||
var columWidth; | ||
var browserWidth = e.media; | ||
var stateChangeColumns = []; | ||
col.visible = e.matches; | ||
stateChangeColumns.push(col); | ||
this.isMediaQuery = true; | ||
this.getShowHideService.setVisible(stateChangeColumns); | ||
if (this.isInitialLoad) { | ||
if (col.visible) { | ||
this.showHider.show(col.headerText, 'headerText'); | ||
} | ||
else { | ||
this.showHider.hide(col.headerText, 'headerText'); | ||
} | ||
} | ||
}; | ||
@@ -464,2 +479,3 @@ Grid.prototype.refreshMediaCol = function () { | ||
} | ||
this.isInitialLoad = true; | ||
}; | ||
@@ -486,2 +502,3 @@ Grid.prototype.eventInitializer = function () { | ||
var requireRefresh = false; | ||
var requireGridRefresh = false; | ||
var checkCursor; | ||
@@ -495,10 +512,2 @@ var args = { requestType: 'refresh' }; | ||
switch (prop) { | ||
case 'enableHover': | ||
var action = newProp.enableHover ? addClass : removeClass; | ||
action([this.element], 'e-gridhover'); | ||
break; | ||
case 'dataSource': | ||
this.notify(events.dataSourceModified, {}); | ||
this.renderModule.refresh(); | ||
break; | ||
case 'allowPaging': | ||
@@ -546,7 +555,7 @@ this.notify(events.uiUpdate, { module: 'pager', enable: this.allowPaging }); | ||
case 'rowTemplate': | ||
this.rowTemplateFn = this.templateComplier(this.rowTemplate); | ||
this.rowTemplateFn = templateCompiler(this.rowTemplate); | ||
requireRefresh = true; | ||
break; | ||
case 'detailTemplate': | ||
this.detailTemplateFn = this.templateComplier(this.detailTemplate); | ||
this.detailTemplateFn = templateCompiler(this.detailTemplate); | ||
requireRefresh = true; | ||
@@ -577,2 +586,6 @@ break; | ||
break; | ||
case 'columns': | ||
this.updateColumnObject(); | ||
requireGridRefresh = true; | ||
break; | ||
default: | ||
@@ -585,3 +598,6 @@ this.extendedPropertyChange(prop, newProp); | ||
} | ||
if (requireRefresh) { | ||
if (requireGridRefresh) { | ||
this.refresh(); | ||
} | ||
else if (requireRefresh) { | ||
this.notify(events.modelChanged, args); | ||
@@ -633,2 +649,3 @@ requireRefresh = false; | ||
case 'allowTextWrap': | ||
case 'textWrapSettings': | ||
if (this.allowTextWrap) { | ||
@@ -641,2 +658,10 @@ this.applyTextWrap(); | ||
break; | ||
case 'dataSource': | ||
this.notify(events.dataSourceModified, {}); | ||
this.renderModule.refresh(); | ||
break; | ||
case 'enableHover': | ||
var action = newProp.enableHover ? addClass : removeClass; | ||
action([this.element], 'e-gridhover'); | ||
break; | ||
} | ||
@@ -871,2 +896,5 @@ }; | ||
}; | ||
Grid.prototype.getDataModule = function () { | ||
return this.renderModule.data; | ||
}; | ||
Grid.prototype.showColumns = function (keys, showBy) { | ||
@@ -1027,4 +1055,4 @@ showBy = showBy ? showBy : 'headerText'; | ||
} | ||
this.rowTemplateFn = this.templateComplier(this.rowTemplate); | ||
this.detailTemplateFn = this.templateComplier(this.detailTemplate); | ||
this.rowTemplateFn = templateCompiler(this.rowTemplate); | ||
this.detailTemplateFn = templateCompiler(this.detailTemplate); | ||
if (!isNullOrUndefined(this.parentDetails)) { | ||
@@ -1036,16 +1064,2 @@ var value = isNullOrUndefined(this.parentDetails.parentKeyFieldValue) ? 'undefined' : | ||
}; | ||
Grid.prototype.templateComplier = function (template) { | ||
if (template) { | ||
var e = void 0; | ||
try { | ||
if (document.querySelectorAll(template).length) { | ||
return templateComplier(document.querySelector(template).innerHTML.trim()); | ||
} | ||
} | ||
catch (e) { | ||
return templateComplier(template); | ||
} | ||
} | ||
return undefined; | ||
}; | ||
Grid.prototype.gridRender = function () { | ||
@@ -1113,7 +1127,26 @@ this.updateRTL(); | ||
if (this.allowTextWrap) { | ||
this.element.classList.add('e-wrap'); | ||
var headerRows = [].slice.call(this.element.querySelectorAll('.e-columnheader')); | ||
switch (this.textWrapSettings.wrapMode) { | ||
case 'header': | ||
wrap(this.element, false); | ||
wrap(this.getContent(), false); | ||
wrap(headerRows, true); | ||
break; | ||
case 'content': | ||
wrap(this.getContent(), true); | ||
wrap(this.element, false); | ||
wrap(headerRows, false); | ||
break; | ||
default: | ||
wrap(this.element, true); | ||
wrap(this.getContent(), false); | ||
wrap(headerRows, false); | ||
} | ||
} | ||
}; | ||
Grid.prototype.removeTextWrap = function () { | ||
this.element.classList.remove('e-wrap'); | ||
wrap(this.element, false); | ||
var headerRows = [].slice.call(this.element.querySelectorAll('.e-columnheader')); | ||
wrap(headerRows, false); | ||
wrap(this.getContent(), false); | ||
}; | ||
@@ -1183,2 +1216,5 @@ Grid.prototype.wireEvents = function () { | ||
Grid.prototype.dblClickHandler = function (e) { | ||
if (parentsUntil(e.target, 'e-grid').id !== this.element.id) { | ||
return; | ||
} | ||
this.notify(events.dblclick, e); | ||
@@ -1224,2 +1260,12 @@ }; | ||
}; | ||
Grid.prototype.updateColumnObject = function () { | ||
prepareColumns(this.columns, this.enableColumnVirtualization); | ||
if (this.editSettings.allowEditing || this.editSettings.allowAdding || this.editSettings.allowDeleting) { | ||
this.notify(events.autoCol, {}); | ||
} | ||
}; | ||
Grid.prototype.refreshColumns = function () { | ||
this.updateColumnObject(); | ||
this.refresh(); | ||
}; | ||
return Grid; | ||
@@ -1243,2 +1289,5 @@ }(Component)); | ||
__decorate([ | ||
Complex({}, TextWrapSettings) | ||
], Grid.prototype, "textWrapSettings", void 0); | ||
__decorate([ | ||
Property(false) | ||
@@ -1340,2 +1389,5 @@ ], Grid.prototype, "allowPaging", void 0); | ||
__decorate([ | ||
Property() | ||
], Grid.prototype, "toolbarTemplate", void 0); | ||
__decorate([ | ||
Event() | ||
@@ -1342,0 +1394,0 @@ ], Grid.prototype, "created", void 0); |
@@ -1,2 +0,2 @@ | ||
import { ChildProperty } from '@syncfusion/ej2-base'; | ||
import { ChildProperty, compile as baseTemplateComplier } from '@syncfusion/ej2-base'; | ||
import { extend as baseExtend, isNullOrUndefined, getValue } from '@syncfusion/ej2-base'; | ||
@@ -33,2 +33,16 @@ import { setStyleAttribute, addClass, attributes, createElement, remove } from '@syncfusion/ej2-base'; | ||
} | ||
export function templateCompiler(template) { | ||
if (template) { | ||
var e = void 0; | ||
try { | ||
if (document.querySelectorAll(template).length) { | ||
return baseTemplateComplier(document.querySelector(template).innerHTML.trim()); | ||
} | ||
} | ||
catch (e) { | ||
return baseTemplateComplier(template); | ||
} | ||
} | ||
return undefined; | ||
} | ||
export function setStyleAndAttributes(node, customAttributes) { | ||
@@ -242,3 +256,3 @@ var copyAttr = {}; | ||
var isOldRow = !row ? true : row && !row.classList.contains('e-insertedrow'); | ||
if (type === 'edit' && isOldRow) { | ||
if (type === 'beginEdit' && isOldRow) { | ||
if (col.isIdentity || col.isPrimaryKey || !col.allowEditing) { | ||
@@ -262,1 +276,8 @@ return false; | ||
} | ||
export function wrap(elem, action) { | ||
var clName = 'e-wrap'; | ||
elem = elem instanceof Array ? elem : [elem]; | ||
for (var i = 0; i < elem.length; i++) { | ||
action ? elem[i].classList.add(clName) : elem[i].classList.remove(clName); | ||
} | ||
} |
import { merge } from '@syncfusion/ej2-base'; | ||
import { compile as templateCompiler } from '@syncfusion/ej2-base'; | ||
import { ValueFormatter } from '../services/value-formatter'; | ||
import { getUid } from '../base/util'; | ||
import { getUid, templateCompiler } from '../base/util'; | ||
var Column = (function () { | ||
@@ -26,11 +25,3 @@ function Column(options) { | ||
if (this.template) { | ||
var e = void 0; | ||
try { | ||
if (document.querySelectorAll(this.template).length) { | ||
this.templateFn = templateCompiler(document.querySelector(this.template).innerHTML.trim()); | ||
} | ||
} | ||
catch (e) { | ||
this.templateFn = templateCompiler(this.template); | ||
} | ||
this.templateFn = templateCompiler(this.template); | ||
} | ||
@@ -37,0 +28,0 @@ } |
@@ -15,3 +15,3 @@ import { createElement } from '@syncfusion/ej2-base'; | ||
}); | ||
if (!isEditable(args.column, args.type, args.element)) { | ||
if (!isEditable(args.column, args.requestType, args.element)) { | ||
input.setAttribute('disabled', 'true'); | ||
@@ -18,0 +18,0 @@ } |
@@ -52,3 +52,8 @@ import { isNullOrUndefined, extend } from '@syncfusion/ej2-base'; | ||
var node = this.refreshCell(cell, data, attributes); | ||
td.innerHTML = node.innerHTML; | ||
td.innerHTML = ''; | ||
var elements = [].slice.call(node.childNodes); | ||
for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { | ||
var elem = elements_1[_i]; | ||
td.appendChild(elem); | ||
} | ||
}; | ||
@@ -55,0 +60,0 @@ CellRenderer.prototype.refreshCell = function (cell, data, attributes) { |
@@ -27,3 +27,3 @@ import { createElement, isNullOrUndefined } from '@syncfusion/ej2-base'; | ||
properties: { | ||
enableRtl: this.parent.enableRtl, enabled: isEditable(args.column, args.type, args.element), | ||
enableRtl: this.parent.enableRtl, enabled: isEditable(args.column, args.requestType, args.element), | ||
placeholder: isInline ? '' : args.column.headerText | ||
@@ -30,0 +30,0 @@ } |
@@ -50,4 +50,4 @@ import { Dialog } from '@syncfusion/ej2-popups'; | ||
DialogEditRender.prototype.destroy = function (args) { | ||
this.parent.notify(events.destroyForm, {}); | ||
this.parent.isEdit = false; | ||
this.parent.notify(events.destroyForm, {}); | ||
this.parent.notify(events.toolbarRefresh, {}); | ||
@@ -54,0 +54,0 @@ if (this.dialog && !this.dialogObj.isDestroyed) { |
@@ -23,3 +23,3 @@ import { extend } from '@syncfusion/ej2-base'; | ||
this.parent.dataSource : new DataManager(this.parent.dataSource), | ||
query: new Query().select(args.column.field), enabled: isEditable(args.column, args.type, args.element), | ||
query: new Query().select(args.column.field), enabled: isEditable(args.column, args.requestType, args.element), | ||
fields: { value: args.column.field }, value: args.rowData[args.column.field], | ||
@@ -26,0 +26,0 @@ enableRtl: this.parent.enableRtl, actionComplete: this.ddActionComplete, |
@@ -42,3 +42,3 @@ import { getValue } from '@syncfusion/ej2-base'; | ||
} | ||
col.edit.write({ rowData: args.rowData, element: cell, column: col, type: args.type }); | ||
col.edit.write({ rowData: args.rowData, element: cell, column: col, requestType: args.requestType }); | ||
if (!isFocused && !cell.getAttribute('disabled')) { | ||
@@ -66,3 +66,3 @@ this.focusElement(cell); | ||
var value = col.valueAccessor(col.field, args.rowData, col); | ||
var tArgs = { column: col, value: value, type: args.type }; | ||
var tArgs = { column: col, value: value, type: args.requestType }; | ||
var temp = col.edit.create; | ||
@@ -82,3 +82,3 @@ var input = void 0; | ||
classList(input, ['e-input', 'e-field'], []); | ||
if ((col.isPrimaryKey || col.isIdentity) && args.type === 'edit') { | ||
if ((col.isPrimaryKey || col.isIdentity) && args.requestType === 'beginEdit') { | ||
input.setAttribute('disabled', 'true'); | ||
@@ -85,0 +85,0 @@ } |
@@ -10,3 +10,3 @@ import { isNullOrUndefined } from '@syncfusion/ej2-base'; | ||
import { Draggable, Droppable } from '@syncfusion/ej2-base'; | ||
import { parentsUntil } from '../base/util'; | ||
import { parentsUntil, wrap } from '../base/util'; | ||
var HeaderRender = (function () { | ||
@@ -318,2 +318,6 @@ function HeaderRender(parent, serviceLocator) { | ||
this.parent.notify(events.headerRefreshed, {}); | ||
var rows = [].slice.call(headerDiv.querySelectorAll('tr.e-columnheader')); | ||
if (this.parent.allowTextWrap && this.parent.textWrapSettings.wrapMode === 'header') { | ||
wrap(rows, true); | ||
} | ||
}; | ||
@@ -320,0 +324,0 @@ HeaderRender.prototype.appendContent = function (table) { |
@@ -25,3 +25,3 @@ import { extend } from '@syncfusion/ej2-base'; | ||
placeholder: isInline ? '' : args.column.headerText, | ||
enabled: isEditable(args.column, args.type, args.element), | ||
enabled: isEditable(args.column, args.requestType, args.element), | ||
floatLabelType: this.parent.editSettings.mode !== 'dialog' ? 'Never' : 'Always', | ||
@@ -28,0 +28,0 @@ }, col.edit.params)); |
@@ -46,2 +46,5 @@ import { createElement, remove } from '@syncfusion/ej2-base'; | ||
this.parent.trigger(events.actionBegin, e); | ||
if (e.cancel) { | ||
return; | ||
} | ||
this.refreshDataManager(e); | ||
@@ -48,0 +51,0 @@ }; |
@@ -22,3 +22,8 @@ import { isNullOrUndefined, extend } from '@syncfusion/ej2-base'; | ||
var tr = this.refreshRow(row, columns, attributes, rowTemplate); | ||
node.innerHTML = tr.innerHTML; | ||
var cells = [].slice.call(tr.cells); | ||
node.innerHTML = ''; | ||
for (var _i = 0, cells_1 = cells; _i < cells_1.length; _i++) { | ||
var cell = cells_1[_i]; | ||
node.appendChild(cell); | ||
} | ||
}; | ||
@@ -25,0 +30,0 @@ RowRenderer.prototype.refreshRow = function (row, columns, attributes, rowTemplate) { |
@@ -28,3 +28,5 @@ var __extends = (this && this.__extends) || (function () { | ||
var node = this.element.cloneNode(); | ||
node.innerHTML = cell.column.headerText; | ||
var div = createElement('div', { className: 'e-stackedheadercelldiv' }); | ||
node.appendChild(div); | ||
div.innerHTML = cell.column.headerText; | ||
if (cell.column.toolTip) { | ||
@@ -34,3 +36,3 @@ node.setAttribute('title', cell.column.toolTip); | ||
if (isNullOrUndefined(cell.column.textAlign)) { | ||
node.style.textAlign = cell.column.textAlign; | ||
div.style.textAlign = cell.column.textAlign; | ||
} | ||
@@ -37,0 +39,0 @@ node.setAttribute('colspan', cell.colSpan.toString()); |
{ | ||
"name": "@syncfusion/ej2-grids", | ||
"version": "1.0.18", | ||
"version": "1.0.19", | ||
"description": "Essential JS 2 Grid Component", | ||
@@ -9,11 +9,11 @@ "author": "Syncfusion Inc.", | ||
"dependencies": { | ||
"@syncfusion/ej2-base": "^1.0.18", | ||
"@syncfusion/ej2-data": "^1.0.14", | ||
"@syncfusion/ej2-navigations": "^1.0.18", | ||
"@syncfusion/ej2-inputs": "^1.0.18", | ||
"@syncfusion/ej2-calendars": "^1.0.18", | ||
"@syncfusion/ej2-dropdowns": "^1.0.18", | ||
"@syncfusion/ej2-base": "^1.0.19", | ||
"@syncfusion/ej2-data": "^1.0.19", | ||
"@syncfusion/ej2-navigations": "^1.0.19", | ||
"@syncfusion/ej2-inputs": "^1.0.19", | ||
"@syncfusion/ej2-calendars": "^1.0.19", | ||
"@syncfusion/ej2-dropdowns": "^1.0.19", | ||
"@syncfusion/ej2-popups": "^1.0.17", | ||
"@syncfusion/ej2-buttons": "^1.0.18", | ||
"@syncfusion/ej2-lists": "^1.0.18" | ||
"@syncfusion/ej2-buttons": "^1.0.19", | ||
"@syncfusion/ej2-lists": "^1.0.19" | ||
}, | ||
@@ -20,0 +20,0 @@ "devDependencies": { |
@@ -1,2 +0,2 @@ | ||
import { FormValidator } from '@syncfusion/ej2-base'; | ||
import { FormValidator } from '@syncfusion/ej2-inputs'; | ||
import { IGrid } from '../base/interface'; | ||
@@ -36,3 +36,3 @@ import { EditRender } from '../renderer/edit-renderer'; | ||
private keyPressHandler(e); | ||
private reFocusIfError(e); | ||
private reFocusOnError(e); | ||
private isAddRow(index); | ||
@@ -74,5 +74,4 @@ private editNextCell(); | ||
protected getDataByIndex(index: number): Object; | ||
private applyFormValidation(col); | ||
private valComplete(args); | ||
private customPlacement(inputElement, error); | ||
} |
@@ -1,2 +0,2 @@ | ||
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "../base/util", "../base/constant", "../renderer/row-renderer", "../renderer/cell-renderer", "../services/row-model-generator"], function (require, exports, ej2_base_1, ej2_base_2, ej2_base_3, ej2_base_4, util_1, events, row_renderer_1, cell_renderer_1, row_model_generator_1) { | ||
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "../base/util", "../base/constant", "../renderer/row-renderer", "../renderer/cell-renderer", "../services/row-model-generator"], function (require, exports, ej2_base_1, ej2_base_2, ej2_base_3, util_1, events, row_renderer_1, cell_renderer_1, row_model_generator_1) { | ||
"use strict"; | ||
@@ -41,4 +41,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
this.saveCell(); | ||
var rowCell = util_1.parentsUntil(e.target, 'e-rowcell'); | ||
if (rowCell && !this.parent.isEdit) { | ||
if (util_1.parentsUntil(e.target, 'e-rowcell') && !this.parent.isEdit) { | ||
this.setCellIdx(e.target); | ||
@@ -50,5 +49,2 @@ } | ||
var target = e.target; | ||
if (util_1.parentsUntil(target, 'e-grid').id !== this.parent.element.id) { | ||
return; | ||
} | ||
var tr = util_1.parentsUntil(e.target, 'e-row'); | ||
@@ -91,5 +87,5 @@ if ((util_1.parentsUntil(target, 'e-rowcell')) && tr) { | ||
} | ||
this.reFocusIfError(e); | ||
this.reFocusOnError(e); | ||
}; | ||
BatchEdit.prototype.reFocusIfError = function (e) { | ||
BatchEdit.prototype.reFocusOnError = function (e) { | ||
if (this.validateFormObj() && (e.action === 'tab' || e.action === 'shiftTab')) { | ||
@@ -101,4 +97,3 @@ e.target.focus(); | ||
BatchEdit.prototype.isAddRow = function (index) { | ||
var tr = this.parent.getDataRows()[index]; | ||
return tr.classList.contains('e-insertedrow'); | ||
return this.parent.getDataRows()[index].classList.contains('e-insertedrow'); | ||
}; | ||
@@ -184,3 +179,3 @@ BatchEdit.prototype.editNextCell = function () { | ||
BatchEdit.prototype.validateFormObj = function () { | ||
return this.formObj && !this.formObj.validate(); | ||
return this.parent.editModule.formObj && !this.parent.editModule.formObj.validate(); | ||
}; | ||
@@ -190,2 +185,5 @@ BatchEdit.prototype.batchSave = function () { | ||
this.saveCell(); | ||
if (gObj.isEdit) { | ||
return; | ||
} | ||
var changes = this.getBatchChanges(); | ||
@@ -198,3 +196,2 @@ var args = { batchChanges: changes, cancel: false }; | ||
gObj.notify(events.bulkSave, { changes: changes }); | ||
this.parent.notify(events.tooltipDestroy, {}); | ||
}; | ||
@@ -271,2 +268,3 @@ BatchEdit.prototype.getBatchChanges = function () { | ||
gObj.notify(events.toolbarRefresh, {}); | ||
gObj.element.focus(); | ||
}; | ||
@@ -348,3 +346,3 @@ BatchEdit.prototype.refreshRowIdx = function () { | ||
} | ||
else if (isAdd && !cols[i].template && cols[i].visible) { | ||
else if (isAdd && !cols[i].template && cols[i].visible && cols[i].allowEditing) { | ||
return i; | ||
@@ -361,3 +359,3 @@ } | ||
} | ||
else if (isAdd && !cols[i].template && cols[i].visible) { | ||
else if (isAdd && !cols[i].template && cols[i].visible && cols[i].allowEditing) { | ||
return i; | ||
@@ -369,3 +367,3 @@ } | ||
BatchEdit.prototype.checkNPCell = function (col) { | ||
return !col.template && col.visible && !col.isPrimaryKey && !col.isIdentity; | ||
return !col.template && col.visible && !col.isPrimaryKey && !col.isIdentity && col.allowEditing; | ||
}; | ||
@@ -408,3 +406,3 @@ BatchEdit.prototype.getDefaultData = function () { | ||
cell: row.cells[this.getCellIdx(col.uid)], row: row, | ||
columnName: col.field, columnObject: col, isForeignKey: !ej2_base_4.isNullOrUndefined(col.foreignKeyValue), | ||
columnName: col.field, columnObject: col, isForeignKey: !ej2_base_3.isNullOrUndefined(col.foreignKeyValue), | ||
primaryKey: keys, rowData: rowData, | ||
@@ -428,7 +426,6 @@ validationRules: ej2_base_1.extend({}, col.validationRules ? col.validationRules : {}), | ||
gObj.selectRow(this.cellDetails.rowIndex); | ||
gObj.isEdit = true; | ||
this.renderer.update(args); | ||
this.form = gObj.element.querySelector('#' + gObj.element.id + 'EditForm'); | ||
this.applyFormValidation(col); | ||
gObj.isEdit = true; | ||
gObj.notify(events.toolbarRefresh, {}); | ||
gObj.editModule.applyFormValidation([col]); | ||
this.parent.element.querySelector('.e-gridpopup').style.display = 'none'; | ||
@@ -464,3 +461,3 @@ } | ||
var cIdx = this.parent.getColumnIndexByUid(uid) + this.parent.groupSettings.columns.length; | ||
if (!ej2_base_4.isNullOrUndefined(this.parent.detailTemplate) || !ej2_base_4.isNullOrUndefined(this.parent.childGrid)) { | ||
if (!ej2_base_3.isNullOrUndefined(this.parent.detailTemplate) || !ej2_base_3.isNullOrUndefined(this.parent.childGrid)) { | ||
cIdx++; | ||
@@ -501,6 +498,4 @@ } | ||
} | ||
gObj.editModule.destroyForm(); | ||
gObj.editModule.destroyWidgets([column]); | ||
if (this.formObj) { | ||
this.formObj.destroy(); | ||
} | ||
this.parent.notify(events.tooltipDestroy, {}); | ||
@@ -511,4 +506,4 @@ this.refreshTD(args.cell, column, gObj.getRowObjectFromUID(tr.getAttribute('data-uid')), args.value); | ||
gObj.isEdit = false; | ||
if (!ej2_base_4.isNullOrUndefined(args.value) && args.value.toString() === | ||
(!ej2_base_4.isNullOrUndefined(this.cellDetails.value) ? this.cellDetails.value : '').toString() && !this.isColored) { | ||
if (!ej2_base_3.isNullOrUndefined(args.value) && args.value.toString() === | ||
(!ej2_base_3.isNullOrUndefined(this.cellDetails.value) ? this.cellDetails.value : '').toString() && !this.isColored) { | ||
args.cell.classList.remove('e-updatedtd'); | ||
@@ -523,13 +518,2 @@ } | ||
}; | ||
BatchEdit.prototype.applyFormValidation = function (col) { | ||
var rules = {}; | ||
if (col.validationRules && this.form.querySelectorAll('#' + this.parent.element.id + col.field).length) { | ||
rules[col.field] = col.validationRules; | ||
this.formObj = new ej2_base_3.FormValidator(this.form, { | ||
rules: rules, | ||
validationComplete: this.valComplete.bind(this), | ||
customPlacement: this.customPlacement.bind(this) | ||
}); | ||
} | ||
}; | ||
BatchEdit.prototype.valComplete = function (args) { | ||
@@ -536,0 +520,0 @@ var edit = this.parent.editModule; |
@@ -1,2 +0,2 @@ | ||
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-data", "@syncfusion/ej2-base", "../base/constant", "@syncfusion/ej2-popups"], function (require, exports, ej2_base_1, ej2_data_1, ej2_base_2, events, ej2_popups_1) { | ||
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-data", "@syncfusion/ej2-base", "@syncfusion/ej2-buttons", "../base/constant", "@syncfusion/ej2-popups"], function (require, exports, ej2_base_1, ej2_data_1, ej2_base_2, ej2_buttons_1, events, ej2_popups_1) { | ||
"use strict"; | ||
@@ -43,12 +43,20 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
var targetElement = e.target; | ||
if (targetElement.classList.contains('e-cctbn-icon') || targetElement.classList.contains('e-cc-toolbar')) { | ||
if ((this.initialOpenDlg && this.dlgObj.visible) || !this.isDlgOpen) { | ||
this.isDlgOpen = true; | ||
return; | ||
if (!ej2_base_1.isNullOrUndefined(ej2_base_2.closest(targetElement, '.e-cc')) || !ej2_base_1.isNullOrUndefined(ej2_base_2.closest(targetElement, '.e-cc-toolbar'))) { | ||
if (targetElement.classList.contains('e-columnchooser-btn') || targetElement.classList.contains('e-cc-toolbar')) { | ||
if ((this.initialOpenDlg && this.dlgObj.visible) || !this.isDlgOpen) { | ||
this.isDlgOpen = true; | ||
return; | ||
} | ||
} | ||
else if (targetElement.classList.contains('e-cc-cancel')) { | ||
targetElement.parentElement.querySelector('.e-ccsearch').value = ''; | ||
this.columnChooserSearch(''); | ||
this.removeCancelIcon(); | ||
} | ||
} | ||
else if (targetElement.classList.contains('e-cc-cancel')) { | ||
targetElement.parentElement.querySelector('.e-ccsearch').value = ''; | ||
this.columnChooserSearch(''); | ||
this.removeCancelIcon(); | ||
else { | ||
if (!ej2_base_1.isNullOrUndefined(this.dlgObj) && this.dlgObj.visible) { | ||
this.dlgObj.hide(); | ||
this.isDlgOpen = false; | ||
} | ||
} | ||
@@ -72,3 +80,3 @@ }; | ||
this.dlgObj.dataBind(); | ||
this.dlgObj.element.style.maxHeight = '390px'; | ||
this.dlgObj.element.style.maxHeight = '430px'; | ||
var elementVisible = this.dlgObj.element.style.display; | ||
@@ -80,3 +88,7 @@ this.dlgObj.element.style.display = 'block'; | ||
var dlgWidth = 250; | ||
if (!ej2_base_1.isNullOrUndefined(ej2_base_2.closest(target, '.e-bigger'))) { | ||
this.dlgObj.width = 253; | ||
} | ||
if (this.parent.element.classList.contains('e-device')) { | ||
this.dlgObj.target = document.body; | ||
this.dlgObj.position = { X: 'center', Y: 'center' }; | ||
@@ -91,3 +103,3 @@ this.dlgObj.refreshPosition(); | ||
else { | ||
this.dlgObj.element.style.left = (newpos.left - dlgWidth) + 42 + 'px'; | ||
this.dlgObj.element.style.left = ((newpos.left - dlgWidth) + target.closest('.e-cc-toolbar').clientWidth) + 2 + 'px'; | ||
} | ||
@@ -154,4 +166,4 @@ } | ||
buttonModel: { | ||
content: this.l10n.getConstant('OKButton'), | ||
cssClass: 'e-flat e-cc e-cc_okbtn', isPrimary: true | ||
content: this.l10n.getConstant('OKButton'), isPrimary: true, | ||
cssClass: 'e-cc e-cc_okbtn', | ||
} | ||
@@ -165,2 +177,3 @@ }, | ||
width: 250, | ||
cssClass: 'e-cc', | ||
animationSettings: { effect: 'None' }, | ||
@@ -229,5 +242,5 @@ }); | ||
ColumnChooser.prototype.checkstatecolumn = function (e) { | ||
var targetEle = e.target; | ||
var targetEle = e.event.target; | ||
var uncheckColumn = targetEle.id; | ||
if (targetEle.checked) { | ||
if (e.checked) { | ||
if (this.hideColumn.indexOf(uncheckColumn) !== -1) { | ||
@@ -313,22 +326,21 @@ this.hideColumn.splice(this.hideColumn.indexOf(uncheckColumn), 1); | ||
var showColState; | ||
var checkBoxObj; | ||
if (column.showInColumnChooser) { | ||
cclist = ej2_base_1.createElement('li', { className: 'e-cclist e-cc', styles: 'list-style:None', id: 'e-ccli_' + column.uid }); | ||
var cclabe = ej2_base_1.createElement('label', { className: 'e-cc' }); | ||
var cccheckboxlist = document.createElement('input'); | ||
cccheckboxlist.type = 'CheckBox'; | ||
cccheckboxlist.className = 'e-cc e-cc-chbox '; | ||
cccheckboxlist.id = 'e-cc' + column.uid; | ||
cccheckboxlist.onchange = this.checkstatecolumn.bind(this); | ||
var labElement = ej2_base_1.createElement('label', { className: 'e-cc e-cc-lab-name', attrs: { for: 'e-cc' + column.uid } }); | ||
labElement.textContent = column.headerText; | ||
var cccheckboxlist = ej2_base_1.createElement('input', { | ||
className: 'e-cc e-cc-chbox ', | ||
id: 'e-cc' + column.uid, attrs: { type: 'checkbox' } | ||
}); | ||
cclabe.appendChild(cccheckboxlist); | ||
cclabe.appendChild(labElement); | ||
hideColState = this.hideColumn.indexOf('e-cc' + column.uid) === -1 ? false : true; | ||
showColState = this.showColumn.indexOf('e-cc' + column.uid) === -1 ? false : true; | ||
checkBoxObj = new ej2_buttons_1.CheckBox({ label: column.headerText, checked: true, change: this.checkstatecolumn.bind(this) }); | ||
if ((column.visible && !hideColState) || showColState) { | ||
cccheckboxlist.checked = true; | ||
checkBoxObj.checked = true; | ||
} | ||
else { | ||
cccheckboxlist.checked = false; | ||
checkBoxObj.checked = false; | ||
} | ||
checkBoxObj.appendTo(cccheckboxlist); | ||
cclist.appendChild(cclabe); | ||
@@ -335,0 +347,0 @@ this.ulElement.appendChild(cclist); |
@@ -79,3 +79,5 @@ define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-data", "../base/util", "../base/constant"], function (require, exports, ej2_base_1, ej2_data_1, util_1, events) { | ||
if (args === void 0) { args = { requestType: '' }; } | ||
var key = this.getKey(args.foreignKeyData ? args.foreignKeyData : this.parent.getPrimaryKeyFieldNames()); | ||
var key = this.getKey(args.foreignKeyData && | ||
Object.keys(args.foreignKeyData).length ? | ||
args.foreignKeyData : this.parent.getPrimaryKeyFieldNames()); | ||
switch (args.requestType) { | ||
@@ -86,3 +88,3 @@ case 'delete': | ||
break; | ||
case 'add': | ||
case 'save': | ||
query = query ? query : this.generateQuery(); | ||
@@ -98,3 +100,5 @@ this.dataManager.insert(args.data, null, query, 0); | ||
var pr = 'promise'; | ||
var key = this.getKey(args.foreignKeyData ? args.foreignKeyData : this.parent.getPrimaryKeyFieldNames()); | ||
var key = this.getKey(args.foreignKeyData && | ||
Object.keys(args.foreignKeyData).length ? args.foreignKeyData : | ||
this.parent.getPrimaryKeyFieldNames()); | ||
switch (args.requestType) { | ||
@@ -101,0 +105,0 @@ case 'save': |
@@ -6,2 +6,3 @@ import { L10n } from '@syncfusion/ej2-base'; | ||
import { Column } from '../models/column'; | ||
import { FormValidator } from '@syncfusion/ej2-inputs'; | ||
/** | ||
@@ -11,4 +12,7 @@ * `Edit` module is used to handle editing actions. | ||
export declare class Edit implements IAction { | ||
private edit; | ||
protected renderer: EditRender; | ||
private editModule; | ||
/** @hidden */ | ||
formObj: FormValidator; | ||
private editCellType; | ||
@@ -140,3 +144,3 @@ private editType; | ||
removeEventListener(): void; | ||
private actionComplete(); | ||
private actionComplete(e); | ||
/** | ||
@@ -149,4 +153,12 @@ * @hidden | ||
*/ | ||
onActionBegin(e: NotifyArgs): void; | ||
/** | ||
* @hidden | ||
*/ | ||
destroyWidgets(cols?: Column[]): void; | ||
/** | ||
* @hidden | ||
*/ | ||
destroyForm(): void; | ||
/** | ||
* To destroy the editing. | ||
@@ -160,4 +172,8 @@ * @return {void} | ||
private executeAction(); | ||
/** | ||
* @hidden | ||
*/ | ||
applyFormValidation(cols?: Column[]): void; | ||
private valErrorPlacement(inputElement, error); | ||
private validationComplete(args); | ||
} |
@@ -1,2 +0,2 @@ | ||
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "../base/constant", "../renderer/edit-renderer", "../renderer/boolean-edit-cell", "../renderer/dropdown-edit-cell", "../renderer/numeric-edit-cell", "../renderer/default-edit-cell", "./inline-edit", "./batch-edit", "./dialog-edit", "@syncfusion/ej2-popups", "../base/util", "@syncfusion/ej2-popups"], function (require, exports, ej2_base_1, ej2_base_2, ej2_base_3, ej2_base_4, events, edit_renderer_1, boolean_edit_cell_1, dropdown_edit_cell_1, numeric_edit_cell_1, default_edit_cell_1, inline_edit_1, batch_edit_1, dialog_edit_1, ej2_popups_1, util_1, ej2_popups_2) { | ||
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "../base/constant", "../renderer/edit-renderer", "../renderer/boolean-edit-cell", "../renderer/dropdown-edit-cell", "../renderer/numeric-edit-cell", "../renderer/default-edit-cell", "./inline-edit", "./batch-edit", "./dialog-edit", "@syncfusion/ej2-popups", "../base/util", "@syncfusion/ej2-popups", "@syncfusion/ej2-inputs"], function (require, exports, ej2_base_1, ej2_base_2, ej2_base_3, ej2_base_4, events, edit_renderer_1, boolean_edit_cell_1, dropdown_edit_cell_1, numeric_edit_cell_1, default_edit_cell_1, inline_edit_1, batch_edit_1, dialog_edit_1, ej2_popups_1, util_1, ej2_popups_2, ej2_inputs_1) { | ||
"use strict"; | ||
@@ -117,2 +117,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
this.editModule.closeEdit(); | ||
this.refreshToolbar(); | ||
}; | ||
@@ -172,4 +173,4 @@ Edit.prototype.refreshToolbar = function () { | ||
Edit.prototype.editFormValidate = function () { | ||
if (this.editModule.formObj) { | ||
return this.editModule.formObj.validate(); | ||
if (this.formObj) { | ||
return this.formObj.validate(); | ||
} | ||
@@ -182,3 +183,3 @@ return false; | ||
Edit.prototype.getCurrentEditCellData = function () { | ||
var obj = this.getCurrentEditedData(this.editModule.formObj.element, {}); | ||
var obj = this.getCurrentEditedData(this.formObj.element, {}); | ||
return obj[Object.keys(obj)[0]]; | ||
@@ -292,2 +293,4 @@ }; | ||
this.parent.on(events.preventBatch, this.preventBatch, this); | ||
this.parent.on(events.destroyForm, this.destroyForm, this); | ||
this.parent.addEventListener(events.actionBegin, this.onActionBegin.bind(this)); | ||
this.parent.addEventListener(events.actionComplete, this.actionComplete.bind(this)); | ||
@@ -306,7 +309,11 @@ this.parent.on(events.initialEnd, this.wireEvents, this); | ||
this.parent.off(events.preventBatch, this.preventBatch); | ||
this.parent.off(events.destroyForm, this.destroyForm); | ||
this.parent.removeEventListener(events.actionComplete, this.actionComplete); | ||
this.parent.removeEventListener(events.actionBegin, this.onActionBegin); | ||
this.parent.off(events.initialEnd, this.unwireEvents); | ||
}; | ||
Edit.prototype.actionComplete = function () { | ||
this.parent.isEdit = false; | ||
Edit.prototype.actionComplete = function (e) { | ||
if (e.requestType !== 'add' && e.requestType !== 'beginEdit' && e.requestType !== 'delete') { | ||
this.parent.isEdit = false; | ||
} | ||
this.refreshToolbar(); | ||
@@ -331,2 +338,8 @@ }; | ||
}; | ||
Edit.prototype.onActionBegin = function (e) { | ||
if (this.parent.editSettings.mode !== 'batch' && this.formObj && !this.formObj.isDestroyed && !e.cancel) { | ||
this.destroyForm(); | ||
this.destroyWidgets(); | ||
} | ||
}; | ||
Edit.prototype.destroyWidgets = function (cols) { | ||
@@ -341,2 +354,9 @@ cols = cols ? cols : this.parent.columns; | ||
}; | ||
Edit.prototype.destroyForm = function () { | ||
this.parent.notify(events.tooltipDestroy, {}); | ||
if (this.formObj && !this.formObj.isDestroyed) { | ||
this.formObj.destroy(); | ||
} | ||
this.parent.notify(events.tooltipDestroy, {}); | ||
}; | ||
Edit.prototype.destroy = function () { | ||
@@ -378,6 +398,28 @@ this.removeEventListener(); | ||
}; | ||
Edit.prototype.applyFormValidation = function (cols) { | ||
var _this = this; | ||
var gObj = this.parent; | ||
var form = gObj.element.querySelector('.e-gridform'); | ||
var rules = {}; | ||
cols = cols ? cols : gObj.columns; | ||
for (var _i = 0, cols_2 = cols; _i < cols_2.length; _i++) { | ||
var col = cols_2[_i]; | ||
if (col.validationRules && form.querySelectorAll('#' + gObj.element.id + col.field).length) { | ||
rules[col.field] = col.validationRules; | ||
} | ||
} | ||
this.parent.editModule.formObj = new ej2_inputs_1.FormValidator(form, { | ||
rules: rules, | ||
validationComplete: function (args) { | ||
_this.validationComplete(args); | ||
}, | ||
customPlacement: function (inputElement, error) { | ||
_this.valErrorPlacement(inputElement, error); | ||
} | ||
}); | ||
}; | ||
Edit.prototype.valErrorPlacement = function (inputElement, error) { | ||
if (this.parent.isEdit) { | ||
var td = util_1.parentsUntil(inputElement, 'e-rowcell'); | ||
if (!td.ej2_instances) { | ||
if (!td.ej2_instances || !td.ej2_instances.length) { | ||
var tooltip = new ej2_popups_2.Tooltip({ | ||
@@ -384,0 +426,0 @@ opensOn: 'custom', content: error, position: 'bottom center', cssClass: 'e-griderror', |
@@ -1,6 +0,5 @@ | ||
import { FormValidator } from '@syncfusion/ej2-base'; | ||
import { IGrid, NotifyArgs } from '../base/interface'; | ||
import { EditRender } from '../renderer/edit-renderer'; | ||
import { ServiceLocator } from '../services/service-locator'; | ||
import { InlineEdit } from './inline-edit'; | ||
import { FormValidator } from '@syncfusion/ej2-inputs'; | ||
/** | ||
@@ -11,3 +10,2 @@ * `NormalEdit` module is used to handle normal('inline, dialog, external') editing actions. | ||
export declare class NormalEdit { | ||
protected edit: InlineEdit; | ||
protected parent: IGrid; | ||
@@ -18,3 +16,4 @@ protected serviceLocator: ServiceLocator; | ||
protected previousData: Object; | ||
private lastSelIndex; | ||
private editRowIndex; | ||
private rowIndex; | ||
private uid; | ||
@@ -31,3 +30,2 @@ private args; | ||
editComplete(e: NotifyArgs): void; | ||
private onActionComplete(); | ||
protected startEdit(tr: Element): void; | ||
@@ -45,4 +43,2 @@ protected endEdit(): void; | ||
private stopEditStatus(); | ||
private destroyForm(); | ||
protected applyFormValidation(): void; | ||
/** | ||
@@ -49,0 +45,0 @@ * @hidden |
@@ -1,2 +0,2 @@ | ||
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "../base/util", "../base/constant", "../renderer/row-renderer"], function (require, exports, ej2_base_1, ej2_base_2, ej2_base_3, util_1, events, row_renderer_1) { | ||
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "../base/util", "../base/constant", "../renderer/row-renderer"], function (require, exports, ej2_base_1, ej2_base_2, util_1, events, row_renderer_1) { | ||
"use strict"; | ||
@@ -12,5 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
NormalEdit.prototype.clickHandler = function (e) { | ||
var target = e.target; | ||
var gObj = this.parent; | ||
if (util_1.parentsUntil(e.target, 'e-gridcontent')) { | ||
if (this.parent.isEdit) { | ||
if (util_1.parentsUntil(target, 'e-gridcontent')) { | ||
this.rowIndex = util_1.parentsUntil(target, 'e-rowcell') ? parseInt(target.parentElement.getAttribute('aria-rowindex'), 10) : -1; | ||
if (gObj.isEdit) { | ||
gObj.editModule.endEdit(); | ||
@@ -21,16 +23,12 @@ } | ||
NormalEdit.prototype.dblClickHandler = function (e) { | ||
var target = e.target; | ||
if (util_1.parentsUntil(target, 'e-grid').id !== this.parent.element.id || !this.parent.editSettings.allowEditOnDblClick) { | ||
return; | ||
if (util_1.parentsUntil(e.target, 'e-rowcell') && this.parent.editSettings.allowEditOnDblClick) { | ||
this.parent.editModule.startEdit(util_1.parentsUntil(e.target, 'e-row')); | ||
} | ||
if (util_1.parentsUntil(target, 'e-rowcell')) { | ||
this.parent.editModule.startEdit(util_1.parentsUntil(target, 'e-row')); | ||
} | ||
}; | ||
NormalEdit.prototype.editComplete = function (e) { | ||
switch (e.requestType) { | ||
case 'add': | ||
case 'save': | ||
this.parent.selectRow(0); | ||
this.parent.trigger(events.actionComplete, ej2_base_1.extend(e, { | ||
requestType: 'add', | ||
requestType: 'save', | ||
type: events.actionComplete | ||
@@ -40,3 +38,3 @@ })); | ||
case 'delete': | ||
this.parent.selectRow(this.lastSelIndex); | ||
this.parent.selectRow(this.editRowIndex); | ||
this.parent.trigger(events.actionComplete, ej2_base_1.extend(e, { | ||
@@ -50,6 +48,2 @@ requestType: 'delete', | ||
}; | ||
NormalEdit.prototype.onActionComplete = function () { | ||
this.parent.isEdit = false; | ||
this.destroyForm(); | ||
}; | ||
NormalEdit.prototype.startEdit = function (tr) { | ||
@@ -59,7 +53,4 @@ var gObj = this.parent; | ||
var primaryKeyValues = []; | ||
var rowIndex = parseInt(tr.getAttribute('aria-rowindex'), 10); | ||
this.previousData = gObj.getCurrentViewRecords()[rowIndex]; | ||
gObj.clearSelection(); | ||
gObj.selectRow(rowIndex); | ||
gObj.isEdit = true; | ||
this.rowIndex = this.editRowIndex = parseInt(tr.getAttribute('aria-rowindex'), 10); | ||
this.previousData = gObj.getCurrentViewRecords()[this.rowIndex]; | ||
for (var i = 0; i < primaryKeys.length; i++) { | ||
@@ -69,39 +60,46 @@ primaryKeyValues.push(this.previousData[primaryKeys[i]]); | ||
var args = { | ||
row: tr, primaryKey: primaryKeys, primaryKeyValue: primaryKeyValues, | ||
rowData: this.previousData, rowIndex: rowIndex, type: 'edit', cancel: false | ||
row: tr, primaryKey: primaryKeys, primaryKeyValue: primaryKeyValues, requestType: 'beginEdit', | ||
rowData: this.previousData, rowIndex: this.rowIndex, type: 'edit', cancel: false | ||
}; | ||
gObj.trigger(events.beginEdit, args); | ||
args.type = 'actionBegin'; | ||
gObj.trigger(events.actionBegin, args); | ||
if (args.cancel) { | ||
return; | ||
} | ||
this.lastSelIndex = this.parent.selectedRowIndex; | ||
gObj.clearSelection(); | ||
gObj.isEdit = true; | ||
this.renderer.update(args); | ||
this.uid = tr.getAttribute('data-uid'); | ||
this.applyFormValidation(); | ||
gObj.editModule.applyFormValidation(); | ||
args.type = 'actionComplete'; | ||
gObj.trigger(events.actionComplete, args); | ||
}; | ||
NormalEdit.prototype.endEdit = function () { | ||
var gObj = this.parent; | ||
if (!this.parent.isEdit || !this.formObj.validate()) { | ||
if (!this.parent.isEdit || !gObj.editModule.formObj.validate()) { | ||
return; | ||
} | ||
var formElement = gObj.element.querySelector('.e-gridform'); | ||
var editedData = ej2_base_1.extend({}, this.previousData); | ||
editedData = gObj.editModule.getCurrentEditedData(formElement, editedData); | ||
gObj.editModule.destroyWidgets(); | ||
var args = { | ||
requestType: 'save', type: events.actionBegin, data: editedData, cancel: false, | ||
previousData: this.previousData, selectedRow: gObj.selectedRowIndex, foreignKeyData: {} | ||
}; | ||
editedData = gObj.editModule.getCurrentEditedData(gObj.element.querySelector('.e-gridform'), editedData); | ||
if (gObj.element.querySelectorAll('.e-editedrow').length) { | ||
var args = { | ||
requestType: 'save', type: events.actionBegin, data: editedData, | ||
previousData: this.previousData, selectedRow: gObj.selectedRowIndex | ||
}; | ||
args.action = 'edit'; | ||
gObj.trigger(events.actionBegin, args); | ||
gObj.notify(events.updateData, { requestType: 'save', data: editedData }); | ||
if (args.cancel) { | ||
return; | ||
} | ||
gObj.notify(events.updateData, args); | ||
} | ||
else { | ||
gObj.notify(events.modelChanged, { | ||
requestType: 'add', type: events.actionComplete, data: editedData, | ||
previousData: this.previousData, selectedRow: gObj.selectedRowIndex | ||
}); | ||
args.action = 'add'; | ||
args.selectedRow = 0; | ||
gObj.notify(events.modelChanged, args); | ||
if (args.cancel) { | ||
return; | ||
} | ||
} | ||
this.parent.notify(events.tooltipDestroy, {}); | ||
this.parent.notify(events.dialogDestroy, {}); | ||
@@ -136,3 +134,3 @@ this.stopEditStatus(); | ||
this.parent.trigger(events.actionComplete, args); | ||
this.parent.selectRow(this.parent.selectedRowIndex > -1 ? this.parent.selectedRowIndex : this.lastSelIndex); | ||
this.parent.selectRow(this.rowIndex > -1 ? this.rowIndex : this.editRowIndex); | ||
this.parent.element.focus(); | ||
@@ -152,18 +150,15 @@ }; | ||
NormalEdit.prototype.closeEdit = function () { | ||
if (this.parent.isEdit) { | ||
var gObj = this.parent; | ||
this.parent.editModule.destroyWidgets(); | ||
this.parent.notify(events.tooltipDestroy, {}); | ||
this.stopEditStatus(); | ||
var args = { | ||
requestType: 'cancel', type: events.actionBegin, data: this.previousData, selectedRow: gObj.selectedRowIndex | ||
}; | ||
gObj.trigger(events.actionBegin, args); | ||
args.type = events.actionComplete; | ||
var gObj = this.parent; | ||
var args = { | ||
requestType: 'cancel', type: events.actionBegin, data: this.previousData, selectedRow: gObj.selectedRowIndex | ||
}; | ||
gObj.trigger(events.actionBegin, args); | ||
this.stopEditStatus(); | ||
args.type = events.actionComplete; | ||
if (gObj.editSettings.mode !== 'dialog') { | ||
this.refreshRow(args.data); | ||
gObj.selectRow(this.lastSelIndex); | ||
gObj.element.focus(); | ||
gObj.trigger(events.actionComplete, args); | ||
this.parent.notify(events.toolbarRefresh, {}); | ||
} | ||
gObj.selectRow(this.rowIndex); | ||
gObj.element.focus(); | ||
gObj.trigger(events.actionComplete, args); | ||
}; | ||
@@ -183,11 +178,9 @@ NormalEdit.prototype.addRecord = function (data) { | ||
this.uid = ''; | ||
gObj.clearSelection(); | ||
var addData = {}; | ||
for (var _i = 0, _a = gObj.columns; _i < _a.length; _i++) { | ||
var col = _a[_i]; | ||
addData[col.field] = data && data[col.field] ? data[col.field] : col.defaultValue; | ||
this.previousData[col.field] = data && data[col.field] ? data[col.field] : col.defaultValue; | ||
} | ||
var args = { | ||
cancel: false, | ||
requestType: 'add', rowData: addData, type: events.actionComplete | ||
cancel: false, foreignKeyData: {}, | ||
requestType: 'add', data: this.previousData, type: events.actionBegin | ||
}; | ||
@@ -198,12 +191,15 @@ gObj.trigger(events.actionBegin, args); | ||
} | ||
this.renderer.addNew({ rowData: args.rowData, type: 'add' }); | ||
this.applyFormValidation(); | ||
gObj.clearSelection(); | ||
gObj.isEdit = true; | ||
this.renderer.addNew({ rowData: args.data, requestType: 'add' }); | ||
gObj.editModule.applyFormValidation(); | ||
args.type = events.actionComplete; | ||
args.row = gObj.element.querySelector('.e-addedrow'); | ||
gObj.trigger(events.actionComplete, args); | ||
}; | ||
NormalEdit.prototype.deleteRecord = function (fieldname, data) { | ||
this.lastSelIndex = this.parent.selectedRowIndex; | ||
this.editRowIndex = this.parent.selectedRowIndex; | ||
this.parent.notify(events.modelChanged, { | ||
requestType: 'delete', type: events.actionBegin, foreignKeyData: fieldname ? | ||
[fieldname] : this.parent.getPrimaryKeyFieldNames(), | ||
data: data ? [data] : this.parent.getSelectedRecords(), tr: this.parent.getSelectedRows() | ||
requestType: 'delete', type: events.actionBegin, foreignKeyData: {}, | ||
data: data ? [data] : this.parent.getSelectedRecords(), tr: this.parent.getSelectedRows(), cancel: false | ||
}); | ||
@@ -222,34 +218,3 @@ }; | ||
} | ||
this.formObj.destroy(); | ||
}; | ||
NormalEdit.prototype.destroyForm = function () { | ||
this.parent.notify(events.tooltipDestroy, {}); | ||
if (this.formObj && !this.formObj.isDestroyed) { | ||
this.formObj.destroy(); | ||
} | ||
this.parent.notify(events.tooltipDestroy, {}); | ||
}; | ||
NormalEdit.prototype.applyFormValidation = function () { | ||
var _this = this; | ||
var gObj = this.parent; | ||
var form = gObj.element.querySelector('.e-gridform'); | ||
var rules = {}; | ||
for (var _i = 0, _a = gObj.columns; _i < _a.length; _i++) { | ||
var col = _a[_i]; | ||
if (col.validationRules && form.querySelectorAll('#' + gObj.element.id + col.field).length) { | ||
rules[col.field] = col.validationRules; | ||
} | ||
} | ||
this.formObj = new ej2_base_3.FormValidator(form, { | ||
rules: rules, | ||
validationComplete: function (args) { | ||
var edit = _this.parent.editModule; | ||
edit.validationComplete(args); | ||
}, | ||
customPlacement: function (inputElement, error) { | ||
var edit = _this.parent.editModule; | ||
edit.valErrorPlacement(inputElement, error); | ||
} | ||
}); | ||
}; | ||
NormalEdit.prototype.addEventListener = function () { | ||
@@ -260,3 +225,2 @@ if (this.parent.isDestroyed) { | ||
this.parent.on(events.crudAction, this.editHandler, this); | ||
this.parent.on(events.destroyForm, this.destroyForm, this); | ||
this.parent.on(events.doubleTap, this.dblClickHandler, this); | ||
@@ -266,4 +230,3 @@ this.parent.on(events.click, this.clickHandler, this); | ||
this.parent.on(events.deleteComplete, this.editComplete, this); | ||
this.parent.on(events.addComplete, this.editComplete, this); | ||
this.parent.addEventListener(events.actionComplete, this.onActionComplete.bind(this)); | ||
this.parent.on(events.saveComplete, this.editComplete, this); | ||
}; | ||
@@ -275,3 +238,2 @@ NormalEdit.prototype.removeEventListener = function () { | ||
this.parent.off(events.crudAction, this.editHandler); | ||
this.parent.off(events.destroyForm, this.destroyForm); | ||
this.parent.off(events.doubleTap, this.dblClickHandler); | ||
@@ -281,4 +243,3 @@ this.parent.off(events.click, this.clickHandler); | ||
this.parent.off(events.deleteComplete, this.editComplete); | ||
this.parent.off(events.addComplete, this.editComplete); | ||
this.parent.removeEventListener(events.actionComplete, this.onActionComplete); | ||
this.parent.off(events.saveComplete, this.editComplete); | ||
}; | ||
@@ -285,0 +246,0 @@ NormalEdit.prototype.destroy = function () { |
@@ -55,2 +55,3 @@ import { IGrid, IAction, NotifyArgs } from '../base/interface'; | ||
private dragStop(e); | ||
private setDisplay(display); | ||
/** | ||
@@ -61,3 +62,2 @@ * For internal use only - Get the module name. | ||
protected getModuleName(): string; | ||
private getColumnByField(field); | ||
} |
@@ -116,3 +116,3 @@ define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "../base/util", "../base/constant"], function (require, exports, ej2_base_1, ej2_base_2, util_1, events) { | ||
Reorder.prototype.reorderColumns = function (fromFName, toFName) { | ||
var column = this.getColumnByField(toFName); | ||
var column = this.parent.getColumnByField(toFName); | ||
var parent = this.getColParent(column, this.parent.columns); | ||
@@ -122,3 +122,3 @@ var columns = parent ? parent.columns : this.parent.columns; | ||
if (destIndex > -1) { | ||
this.moveColumns(destIndex, this.getColumnByField(fromFName)); | ||
this.moveColumns(destIndex, this.parent.getColumnByField(fromFName)); | ||
} | ||
@@ -160,4 +160,3 @@ }; | ||
ej2_base_2.removeClass(gObj.getHeaderTable().querySelectorAll('.e-reorderindicate'), ['e-reorderindicate']); | ||
this.upArrow.style.display = 'none'; | ||
this.downArrow.style.display = 'none'; | ||
this.setDisplay('none'); | ||
this.stopTimer(); | ||
@@ -194,4 +193,3 @@ ej2_base_2.classList(cloneElement, ['e-defaultcur'], ['e-notallowedcur']); | ||
if (scrollLeft !== scrollElem.scrollLeft) { | ||
this.upArrow.style.display = 'none'; | ||
this.downArrow.style.display = 'none'; | ||
this.setDisplay('none'); | ||
} | ||
@@ -211,4 +209,3 @@ }; | ||
this.upArrow.style.left = this.downArrow.style.left = (isLeft ? cliRect.left : cliRect.right) - cliRectBase.left - 4 + 'px'; | ||
this.upArrow.style.display = ''; | ||
this.downArrow.style.display = ''; | ||
this.setDisplay(''); | ||
}; | ||
@@ -227,4 +224,3 @@ Reorder.prototype.dragStart = function (e) { | ||
var gObj = this.parent; | ||
this.upArrow.style.display = 'none'; | ||
this.downArrow.style.display = 'none'; | ||
this.setDisplay('none'); | ||
this.stopTimer(); | ||
@@ -236,13 +232,9 @@ if (!e.cancel) { | ||
}; | ||
Reorder.prototype.setDisplay = function (display) { | ||
this.upArrow.style.display = display; | ||
this.downArrow.style.display = display; | ||
}; | ||
Reorder.prototype.getModuleName = function () { | ||
return 'reorder'; | ||
}; | ||
Reorder.prototype.getColumnByField = function (field) { | ||
return util_1.iterateArrayOrObject(this.getColumnsModel(this.parent.columns), function (item, index) { | ||
if (item.field === field) { | ||
return item; | ||
} | ||
return undefined; | ||
})[0]; | ||
}; | ||
return Reorder; | ||
@@ -249,0 +241,0 @@ }()); |
@@ -24,2 +24,5 @@ import { IGrid, IAction } from '../base/interface'; | ||
private helper; | ||
private tapped; | ||
private isDblClk; | ||
private minMove; | ||
private parent; | ||
@@ -71,5 +74,7 @@ private widthService; | ||
private getResizeHandlers(); | ||
private setHandlerHeight(); | ||
private callAutoFit(e); | ||
private resizeStart(e); | ||
private cancelResizeAction(removeEvents?); | ||
private getWidth(width, minWidth, maxWidth); | ||
private resizing(e); | ||
@@ -87,2 +92,5 @@ private resizeEnd(e); | ||
private calcPos(elem); | ||
private doubleTapEvent(e); | ||
private getUserAgent(); | ||
private timeoutHandler(); | ||
} |
@@ -15,2 +15,4 @@ define(["require", "exports", "@syncfusion/ej2-base", "../services/width-controller", "../base/constant", "../base/util"], function (require, exports, ej2_base_1, width_controller_1, events, util_1) { | ||
function Resize(parent) { | ||
this.tapped = false; | ||
this.isDblClk = true; | ||
this.parent = parent; | ||
@@ -57,14 +59,19 @@ if (this.parent.isDestroyed) { | ||
this.widthService.setColumnWidth(gObj.getColumns()[index]); | ||
result = gObj.getColumns().some(function (x) { return x.width === null || x.width === undefined || x.width.length <= 0; }); | ||
if (result === false) { | ||
gObj.getColumns().forEach(function (element) { | ||
tWidth = tWidth + parseInt(element.width, 10); | ||
}); | ||
if (!this.parent.allowResizing) { | ||
result = gObj.getColumns().some(function (x) { return x.width === null || x.width === undefined || x.width.length <= 0; }); | ||
if (result === false) { | ||
gObj.getColumns().forEach(function (element) { | ||
if (element.visible) { | ||
tWidth = tWidth + parseInt(element.width, 10); | ||
} | ||
}); | ||
} | ||
var tableWidth_1 = tWidth + indentWidth; | ||
if (tWidth > 0) { | ||
headerTable.style.width = ej2_base_1.formatUnit(tableWidth_1); | ||
contentTable.style.width = ej2_base_1.formatUnit(tableWidth_1); | ||
} | ||
} | ||
var tableWidth = headerTable.offsetWidth; | ||
var contentwidth = (gObj.getContent().scrollWidth); | ||
var tableWidth = tWidth + indentWidth; | ||
if (tWidth > 0) { | ||
headerTable.style.width = ej2_base_1.formatUnit(tableWidth); | ||
contentTable.style.width = ej2_base_1.formatUnit(tableWidth); | ||
} | ||
if (contentwidth > tableWidth) { | ||
@@ -137,2 +144,3 @@ headerTable.classList.add('e-tableborder'); | ||
} | ||
this.setHandlerHeight(); | ||
}; | ||
@@ -157,2 +165,7 @@ Resize.prototype.wireEvents = function () { | ||
}; | ||
Resize.prototype.setHandlerHeight = function () { | ||
[].slice.call(this.parent.getHeaderTable().querySelectorAll('.' + exports.resizeClassList.suppress)).forEach(function (ele) { | ||
ele.style.height = ele.parentElement.offsetHeight + 'px'; | ||
}); | ||
}; | ||
Resize.prototype.callAutoFit = function (e) { | ||
@@ -168,2 +181,11 @@ var col = this.getTargetColumn(e); | ||
this.pageX = this.getPointX(e); | ||
if (this.parent.enableRtl) { | ||
this.minMove = parseInt(this.column.width.toString(), 10) | ||
- (this.column.minWidth ? parseInt(this.column.minWidth.toString(), 10) : 0); | ||
} | ||
else { | ||
this.minMove = (this.column.minWidth ? parseInt(this.column.minWidth.toString(), 10) : 0) | ||
- parseInt(this.column.width.toString(), 10); | ||
} | ||
this.minMove += this.pageX; | ||
} | ||
@@ -203,19 +225,43 @@ if (ej2_base_1.Browser.isDevice && !this.helper.classList.contains(exports.resizeClassList.icon)) { | ||
}; | ||
Resize.prototype.getWidth = function (width, minWidth, maxWidth) { | ||
if (minWidth && width < minWidth) { | ||
return minWidth; | ||
} | ||
else if ((maxWidth && width > maxWidth)) { | ||
return maxWidth; | ||
} | ||
else { | ||
return width; | ||
} | ||
}; | ||
Resize.prototype.resizing = function (e) { | ||
var pageX = this.getPointX(e); | ||
var mousemove = this.parent.enableRtl ? -(pageX - this.pageX) : (pageX - this.pageX); | ||
this.column.width = ej2_base_1.formatUnit(parseInt(this.widthService.getWidth(this.column).toString(), 10) + mousemove); | ||
this.pageX = pageX; | ||
var args = { | ||
e: e, | ||
column: this.column | ||
var colData = { | ||
width: parseInt(this.widthService.getWidth(this.column).toString(), 10) + mousemove, | ||
minWidth: this.column.minWidth ? parseInt(this.column.minWidth.toString(), 10) : null, | ||
maxWidth: this.column.maxWidth ? parseInt(this.column.maxWidth.toString(), 10) : null | ||
}; | ||
this.parent.trigger(events.onResize, args); | ||
if (args.cancel) { | ||
this.cancelResizeAction(true); | ||
return; | ||
var width = this.getWidth(colData.width, colData.minWidth, colData.maxWidth); | ||
if ((!this.parent.enableRtl && this.minMove >= pageX) || (this.parent.enableRtl && this.minMove <= pageX)) { | ||
width = this.column.minWidth ? parseInt(this.column.minWidth.toString(), 10) : 0; | ||
this.pageX = pageX = this.minMove; | ||
} | ||
this.updateColGroup(this.column); | ||
this.widthService.setColumnWidth(this.column, null, 'resize'); | ||
this.updateHelper(); | ||
if (width !== parseInt(this.column.width.toString(), 10)) { | ||
this.pageX = pageX; | ||
this.column.width = ej2_base_1.formatUnit(width); | ||
var args = { | ||
e: e, | ||
column: this.column | ||
}; | ||
this.parent.trigger(events.onResize, args); | ||
if (args.cancel) { | ||
this.cancelResizeAction(true); | ||
return; | ||
} | ||
this.updateColGroup(this.column); | ||
this.widthService.setColumnWidth(this.column, null, 'resize'); | ||
this.updateHelper(); | ||
} | ||
this.isDblClk = false; | ||
}; | ||
@@ -236,2 +282,4 @@ Resize.prototype.resizeEnd = function (e) { | ||
this.refresh(); | ||
this.doubleTapEvent(e); | ||
this.isDblClk = true; | ||
}; | ||
@@ -316,3 +364,3 @@ Resize.prototype.getPointX = function (e) { | ||
(offsetParent === doc.body || offsetParent === doc.documentElement) && | ||
offsetParent.style.position === 'static' || '') { | ||
offsetParent.style.position === 'static') { | ||
offsetParent = offsetParent.parentNode; | ||
@@ -328,2 +376,21 @@ } | ||
}; | ||
Resize.prototype.doubleTapEvent = function (e) { | ||
if (this.getUserAgent() && this.isDblClk) { | ||
if (!this.tapped) { | ||
this.tapped = setTimeout(this.timeoutHandler(), 300); | ||
} | ||
else { | ||
clearTimeout(this.tapped); | ||
this.callAutoFit(e); | ||
this.tapped = null; | ||
} | ||
} | ||
}; | ||
Resize.prototype.getUserAgent = function () { | ||
var userAgent = ej2_base_1.Browser.userAgent.toLowerCase(); | ||
return /iphone|ipod|ipad/.test(userAgent); | ||
}; | ||
Resize.prototype.timeoutHandler = function () { | ||
this.tapped = null; | ||
}; | ||
return Resize; | ||
@@ -330,0 +397,0 @@ }()); |
@@ -18,3 +18,3 @@ define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "../base/util", "../base/constant", "../services/width-controller"], function (require, exports, ej2_base_1, ej2_base_2, ej2_base_3, util_1, constant_1, width_controller_1) { | ||
this.parent.element.style.width = ej2_base_3.formatUnit(this.parent.width); | ||
if (this.parent.toolbarModule) { | ||
if (this.parent.toolbarModule && this.parent.toolbarModule.toolbar.element) { | ||
this.parent.toolbarModule.toolbar.refreshOverflow(); | ||
@@ -21,0 +21,0 @@ } |
@@ -144,3 +144,2 @@ import { IGrid, IAction, IIndex, ISelectedCell } from '../base/interface'; | ||
addCellsToSelection(cellIndexes: IIndex[]): void; | ||
private isEdit(); | ||
private clearCell(); | ||
@@ -147,0 +146,0 @@ private cellDeselect(type, cellIndexes, data, cells); |
@@ -36,3 +36,3 @@ define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "../base/util", "../base/constant", "../base/enum"], function (require, exports, ej2_base_1, ej2_base_2, ej2_base_3, util_1, events, enum_1) { | ||
Selection.prototype.isEditing = function () { | ||
return (this.parent.editSettings.mode !== 'batch' && this.parent.isEdit); | ||
return this.parent.editSettings.mode !== 'batch' && this.parent.isEdit; | ||
}; | ||
@@ -44,5 +44,2 @@ Selection.prototype.selectRow = function (index) { | ||
if (!this.isRowType() || !selectedRow || this.isEditing()) { | ||
if (this.isEditing()) { | ||
gObj.selectedRowIndex = index; | ||
} | ||
return; | ||
@@ -397,5 +394,2 @@ } | ||
}; | ||
Selection.prototype.isEdit = function () { | ||
return this.parent.isEdit; | ||
}; | ||
Selection.prototype.clearCell = function () { | ||
@@ -402,0 +396,0 @@ this.clearCellSelection(); |
@@ -213,2 +213,3 @@ define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "../base/util", "../base/constant", "../services/aria-service"], function (require, exports, ej2_base_1, ej2_base_2, ej2_base_3, util_1, events, aria_service_1) { | ||
!e.target.classList.contains('e-stackedheadercell') && | ||
!e.target.classList.contains('e-stackedheadercelldiv') && | ||
!e.target.classList.contains('e-rhandler')) { | ||
@@ -215,0 +216,0 @@ var gObj = this.parent; |
@@ -34,2 +34,3 @@ import { Toolbar as tool } from '@syncfusion/ej2-navigations'; | ||
private getItems(); | ||
private getItem(itemObject); | ||
private getItemObject(itemName); | ||
@@ -36,0 +37,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-navigations", "../base/constant"], function (require, exports, ej2_base_1, ej2_base_2, ej2_navigations_1, events) { | ||
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-navigations", "../base/constant", "../base/util"], function (require, exports, ej2_base_1, ej2_base_2, ej2_navigations_1, events, util_1) { | ||
"use strict"; | ||
@@ -14,3 +14,4 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
this.l10n = this.serviceLocator.getService('localization'); | ||
var preItems = ['add', 'edit', 'update', 'delete', 'cancel', 'print', 'pdfexport', 'excelexport', 'wordexport']; | ||
var preItems = ['add', 'edit', 'update', 'delete', 'cancel', 'print', | ||
'pdfexport', 'excelexport', 'wordexport', 'csvexport']; | ||
for (var _i = 0, preItems_1 = preItems; _i < preItems_1.length; _i++) { | ||
@@ -33,5 +34,4 @@ var item = preItems_1[_i]; | ||
this.predefinedItems.columnchooser = { | ||
id: this.gridID + '_columnchooser', template: '<div class="e-ccdiv e-cc-toolbar" >\ | ||
<span id="' + this.gridID + '_e-ccbutton" class="e-columnchooser e-cctbn-icon e-icons"></span>\ | ||
</div>', align: 'right' | ||
id: this.gridID + '_' + 'columnchooser', cssClass: 'e-cc e-ccdiv e-cc-toolbar', suffixIcon: 'e-' + 'columnchooser-btn', | ||
text: 'Columns', tooltipText: 'columns', align: 'right', | ||
}; | ||
@@ -60,7 +60,15 @@ this.createToolbar(); | ||
this.element = ej2_base_2.createElement('div', { id: this.gridID + '_toolbarItems' }); | ||
if (this.parent.toolbarTemplate) { | ||
if (typeof (this.parent.toolbarTemplate) === 'string') { | ||
this.toolbar.appendTo(this.parent.toolbarTemplate); | ||
this.element = this.toolbar.element; | ||
} | ||
else { | ||
this.element = util_1.templateCompiler(this.parent.toolbarTemplate)()[1]; | ||
} | ||
} | ||
else { | ||
this.toolbar.appendTo(this.element); | ||
} | ||
this.parent.element.insertBefore(this.element, this.parent.getHeaderContent()); | ||
if (!Array.isArray(this.parent.toolbar)) { | ||
this.element.appendChild(document.querySelector(this.parent.toolbar)); | ||
} | ||
this.toolbar.appendTo(this.element); | ||
this.searchElement = this.element.querySelector('#' + this.gridID + '_searchbar'); | ||
@@ -106,11 +114,22 @@ this.wireEvent(); | ||
var items = []; | ||
var toolbarItems = this.parent.toolbar || []; | ||
if (typeof (this.parent.toolbar) === 'string') { | ||
return []; | ||
} | ||
for (var _i = 0, _a = this.parent.toolbar; _i < _a.length; _i++) { | ||
var item = _a[_i]; | ||
typeof (item) === 'string' ? items.push(this.getItemObject(item)) : items.push(item); | ||
for (var _i = 0, toolbarItems_1 = toolbarItems; _i < toolbarItems_1.length; _i++) { | ||
var item = toolbarItems_1[_i]; | ||
typeof (item) === 'string' ? items.push(this.getItemObject(item)) : items.push(this.getItem(item)); | ||
} | ||
return items; | ||
}; | ||
Toolbar.prototype.getItem = function (itemObject) { | ||
var item = this.predefinedItems[itemObject.text]; | ||
if (item) { | ||
ej2_base_1.extend(item, item, itemObject); | ||
} | ||
else { | ||
item = itemObject; | ||
} | ||
return item; | ||
}; | ||
Toolbar.prototype.getItemObject = function (itemName) { | ||
@@ -117,0 +136,0 @@ return this.predefinedItems[itemName] || { text: itemName, id: this.gridID + '_' + itemName }; |
@@ -207,2 +207,4 @@ /** @hidden */ | ||
/** @hidden */ | ||
export declare const saveComplete: string; | ||
/** @hidden */ | ||
export declare const deleteBegin: string; | ||
@@ -209,0 +211,0 @@ /** @hidden */ |
@@ -105,2 +105,3 @@ define(["require", "exports"], function (require, exports) { | ||
exports.addComplete = 'add-complete'; | ||
exports.saveComplete = 'save-complete'; | ||
exports.deleteBegin = 'delete-begin'; | ||
@@ -107,0 +108,0 @@ exports.deleteComplete = 'delete-complete'; |
@@ -119,1 +119,8 @@ /** | ||
export declare type AggregateType = 'sum' | 'average' | 'max' | 'min' | 'count' | 'truecount' | 'falsecount' | 'custom'; | ||
/** | ||
* Defines the wrap mode. | ||
* * both - Wraps both header and content. | ||
* * header - Wraps header alone. | ||
* * content - Wraps content alone. | ||
*/ | ||
export declare type WrapMode = 'both' | 'header' | 'content'; |
@@ -1,2 +0,2 @@ | ||
import { Component, ModuleDeclaration, ChildProperty, compile as templateComplier, Browser } from '@syncfusion/ej2-base';import { isNullOrUndefined } from '@syncfusion/ej2-base';import { createElement, addClass, removeClass, append, remove, classList } from '@syncfusion/ej2-base';import { Property, Collection, Complex, Event, NotifyPropertyChanges, INotifyPropertyChanged, L10n } from '@syncfusion/ej2-base';import { EventHandler, KeyboardEvents, KeyboardEventArgs, EmitType } from '@syncfusion/ej2-base';import { Query, DataManager } from '@syncfusion/ej2-data';import { ItemModel, ClickEventArgs } from '@syncfusion/ej2-navigations';import { iterateArrayOrObject, prepareColumns, parentsUntil } from './util';import * as events from '../base/constant';import { IRenderer, IValueFormatter, IFilterOperator, IIndex, RowDataBoundEventArgs, QueryCellInfoEventArgs } from './interface';import { CellDeselectEventArgs, CellSelectEventArgs, CellSelectingEventArgs, ParentDetails } from './interface';import { FailureEventArgs, FilterEventArgs, ColumnDragEventArgs, GroupEventArgs, PrintEventArgs } from './interface';import { RowDeselectEventArgs, RowSelectEventArgs, RowSelectingEventArgs, PageEventArgs, RowDragEventArgs } from './interface';import { BeforeBatchAddArgs, BeforeBatchDeleteArgs, BeforeBatchSaveArgs, ResizeArgs } from './interface';import { BatchAddArgs, BatchDeleteArgs, BeginEditArgs, CellEditArgs, CellSaveArgs, BeforeDataBoundArgs } from './interface';import { DetailDataBoundEventArgs, ColumnChooserEventArgs } from './interface';import { SearchEventArgs, SortEventArgs, ISelectedCell, EJ2Intance } from './interface';import { Render } from '../renderer/render';import { Column, ColumnModel } from '../models/column';import { Action, SelectionType, GridLine, RenderType, SortDirection, SelectionMode, PrintMode, FilterType, FilterBarMode } from './enum';import { Data } from '../actions/data';import { CellRendererFactory } from '../services/cell-render-factory';import { ServiceLocator } from '../services/service-locator';import { ValueFormatter } from '../services/value-formatter';import { RendererFactory } from '../services/renderer-factory';import { ColumnWidthService } from '../services/width-controller';import { AriaService } from '../services/aria-service';import { PageSettingsModel, AggregateRowModel } from '../models/models';import { PageSettings } from '../models/page-settings';import { Sort } from '../actions/sort';import { Page } from '../actions/page';import { Selection } from '../actions/selection';import { Filter } from '../actions/filter';import { Search } from '../actions/search';import { Resize } from '../actions/resize';import { Reorder } from '../actions/reorder';import { RowDD } from '../actions/row-reorder';import { ShowHide } from '../actions/show-hide';import { Scroll } from '../actions/scroll';import { Group } from '../actions/group';import { Print } from '../actions/print';import { DetailRow } from '../actions/detail-row';import { Toolbar } from '../actions/toolbar';import { AggregateRow } from '../models/aggregate';import { Edit } from '../actions/edit';import { Row } from '../models/row';import { ColumnChooser } from '../actions/column-chooser'; | ||
import { Component, ModuleDeclaration, ChildProperty, Browser } from '@syncfusion/ej2-base';import { isNullOrUndefined } from '@syncfusion/ej2-base';import { createElement, addClass, removeClass, append, remove, classList } from '@syncfusion/ej2-base';import { Property, Collection, Complex, Event, NotifyPropertyChanges, INotifyPropertyChanged, L10n } from '@syncfusion/ej2-base';import { EventHandler, KeyboardEvents, KeyboardEventArgs, EmitType } from '@syncfusion/ej2-base';import { Query, DataManager } from '@syncfusion/ej2-data';import { ItemModel, ClickEventArgs } from '@syncfusion/ej2-navigations';import { iterateArrayOrObject, prepareColumns, parentsUntil, wrap, templateCompiler } from './util';import * as events from '../base/constant';import { IRenderer, IValueFormatter, IFilterOperator, IIndex, RowDataBoundEventArgs, QueryCellInfoEventArgs } from './interface';import { CellDeselectEventArgs, CellSelectEventArgs, CellSelectingEventArgs, ParentDetails } from './interface';import { FailureEventArgs, FilterEventArgs, ColumnDragEventArgs, GroupEventArgs, PrintEventArgs } from './interface';import { RowDeselectEventArgs, RowSelectEventArgs, RowSelectingEventArgs, PageEventArgs, RowDragEventArgs } from './interface';import { BeforeBatchAddArgs, BeforeBatchDeleteArgs, BeforeBatchSaveArgs, ResizeArgs } from './interface';import { BatchAddArgs, BatchDeleteArgs, BeginEditArgs, CellEditArgs, CellSaveArgs, BeforeDataBoundArgs } from './interface';import { DetailDataBoundEventArgs, ColumnChooserEventArgs, AddEventArgs, SaveEventArgs, EditEventArgs, DeleteEventArgs } from './interface';import { SearchEventArgs, SortEventArgs, ISelectedCell, EJ2Intance } from './interface';import { Render } from '../renderer/render';import { Column, ColumnModel } from '../models/column';import { Action, SelectionType, GridLine, RenderType, SortDirection, SelectionMode, PrintMode, FilterType, FilterBarMode } from './enum';import { WrapMode } from './enum';import { Data } from '../actions/data';import { CellRendererFactory } from '../services/cell-render-factory';import { ServiceLocator } from '../services/service-locator';import { ValueFormatter } from '../services/value-formatter';import { RendererFactory } from '../services/renderer-factory';import { ColumnWidthService } from '../services/width-controller';import { AriaService } from '../services/aria-service';import { PageSettingsModel, AggregateRowModel } from '../models/models';import { PageSettings } from '../models/page-settings';import { Sort } from '../actions/sort';import { Page } from '../actions/page';import { Selection } from '../actions/selection';import { Filter } from '../actions/filter';import { Search } from '../actions/search';import { Resize } from '../actions/resize';import { Reorder } from '../actions/reorder';import { RowDD } from '../actions/row-reorder';import { ShowHide } from '../actions/show-hide';import { Scroll } from '../actions/scroll';import { Group } from '../actions/group';import { Print } from '../actions/print';import { DetailRow } from '../actions/detail-row';import { Toolbar } from '../actions/toolbar';import { AggregateRow } from '../models/aggregate';import { Edit } from '../actions/edit';import { Row } from '../models/row';import { ColumnChooser } from '../actions/column-chooser'; | ||
import {ComponentModel} from '@syncfusion/ej2-base'; | ||
@@ -274,2 +274,18 @@ | ||
/** | ||
* Interface for a class TextWrapSettings | ||
*/ | ||
export interface TextWrapSettingsModel { | ||
/** | ||
* Defines the `wrapMode` of grid. The available modes are | ||
* * `both` - Wraps both header and content. | ||
* * `content` -Wraps header alone. | ||
* * `header` - Wraps content alone. | ||
* @default both | ||
*/ | ||
wrapMode?: WrapMode; | ||
} | ||
/** | ||
* Interface for a class GroupSettings | ||
@@ -412,2 +428,8 @@ */ | ||
/** | ||
* Configures the text wrap in the Grid. | ||
* @default textWrapSettings{wrapMode:"both"} | ||
*/ | ||
textWrapSettings?: TextWrapSettingsModel; | ||
/** | ||
* If `allowPaging` set to true, then the pager renders at the footer of Grid. It is used to handle page navigation in Grid. | ||
@@ -677,3 +699,6 @@ * @default false | ||
* * search - Searches records by given key. | ||
* * print - Print the Grid.<br><br> | ||
* * print - Print the Grid. | ||
* * excelexport - Export the Grid to Excel. | ||
* * pdfexport - Export the Grid to PDF. | ||
* * csvexport - Export the Grid to CSV.<br><br> | ||
* The following code example implements the custom toolbar items. | ||
@@ -702,2 +727,9 @@ * ```html | ||
/** | ||
* @hidden | ||
* It used to render toolbar template | ||
* @default null | ||
*/ | ||
toolbarTemplate?: string; | ||
/** | ||
* Triggers when the component is created. | ||
@@ -738,3 +770,3 @@ * @event | ||
*/ | ||
actionBegin?: EmitType<PageEventArgs | GroupEventArgs | FilterEventArgs | SearchEventArgs | SortEventArgs>; | ||
actionBegin?: EmitType<PageEventArgs | GroupEventArgs | FilterEventArgs | SearchEventArgs | SortEventArgs | AddEventArgs | SaveEventArgs | EditEventArgs | DeleteEventArgs>; | ||
@@ -745,3 +777,3 @@ /** | ||
*/ | ||
actionComplete?: EmitType<PageEventArgs | GroupEventArgs | FilterEventArgs | SearchEventArgs | SortEventArgs>; | ||
actionComplete?: EmitType<PageEventArgs | GroupEventArgs | FilterEventArgs | SearchEventArgs | SortEventArgs | AddEventArgs | SaveEventArgs | EditEventArgs | DeleteEventArgs>; | ||
@@ -748,0 +780,0 @@ /** |
@@ -13,3 +13,3 @@ import { Component, ModuleDeclaration, ChildProperty } from '@syncfusion/ej2-base'; | ||
import { BatchAddArgs, BatchDeleteArgs, BeginEditArgs, CellEditArgs, CellSaveArgs, BeforeDataBoundArgs } from './interface'; | ||
import { DetailDataBoundEventArgs, ColumnChooserEventArgs } from './interface'; | ||
import { DetailDataBoundEventArgs, ColumnChooserEventArgs, AddEventArgs, SaveEventArgs, EditEventArgs, DeleteEventArgs } from './interface'; | ||
import { SearchEventArgs, SortEventArgs, ISelectedCell } from './interface'; | ||
@@ -19,2 +19,4 @@ import { Render } from '../renderer/render'; | ||
import { Action, SelectionType, GridLine, SortDirection, SelectionMode, PrintMode, FilterType, FilterBarMode } from './enum'; | ||
import { WrapMode } from './enum'; | ||
import { Data } from '../actions/data'; | ||
import { ServiceLocator } from '../services/service-locator'; | ||
@@ -24,3 +26,3 @@ import { ColumnWidthService } from '../services/width-controller'; | ||
import { SortSettingsModel, SelectionSettingsModel, FilterSettingsModel, SearchSettingsModel, EditSettingsModel } from './grid-model'; | ||
import { SortDescriptorModel, PredicateModel, RowDropSettingsModel, GroupSettingsModel } from './grid-model'; | ||
import { SortDescriptorModel, PredicateModel, RowDropSettingsModel, GroupSettingsModel, TextWrapSettingsModel } from './grid-model'; | ||
import { PageSettingsModel, AggregateRowModel } from '../models/models'; | ||
@@ -277,2 +279,15 @@ import { Sort } from '../actions/sort'; | ||
/** | ||
* Configures the text wrap settings of the Grid. | ||
*/ | ||
export declare class TextWrapSettings extends ChildProperty<TextWrapSettings> { | ||
/** | ||
* Defines the `wrapMode` of grid. The available modes are | ||
* * `both` - Wraps both header and content. | ||
* * `content` -Wraps header alone. | ||
* * `header` - Wraps content alone. | ||
* @default both | ||
*/ | ||
wrapMode: WrapMode; | ||
} | ||
/** | ||
* Configures the group behavior of the Grid. | ||
@@ -382,2 +397,3 @@ */ | ||
private isMediaQuery; | ||
private isInitialLoad; | ||
/** @hidden */ | ||
@@ -529,2 +545,7 @@ recordsCount: number; | ||
/** | ||
* Configures the text wrap in the Grid. | ||
* @default textWrapSettings{wrapMode:"both"} | ||
*/ | ||
textWrapSettings: TextWrapSettingsModel; | ||
/** | ||
* If `allowPaging` set to true, then the pager renders at the footer of Grid. It is used to handle page navigation in Grid. | ||
@@ -763,3 +784,6 @@ * @default false | ||
* * search - Searches records by given key. | ||
* * print - Print the Grid.<br><br> | ||
* * print - Print the Grid. | ||
* * excelexport - Export the Grid to Excel. | ||
* * pdfexport - Export the Grid to PDF. | ||
* * csvexport - Export the Grid to CSV.<br><br> | ||
* The following code example implements the custom toolbar items. | ||
@@ -787,2 +811,8 @@ * ```html | ||
/** | ||
* @hidden | ||
* It used to render toolbar template | ||
* @default null | ||
*/ | ||
toolbarTemplate: string; | ||
/** | ||
* Triggers when the component is created. | ||
@@ -818,3 +848,3 @@ * @event | ||
*/ | ||
actionBegin: EmitType<PageEventArgs | GroupEventArgs | FilterEventArgs | SearchEventArgs | SortEventArgs>; | ||
actionBegin: EmitType<PageEventArgs | GroupEventArgs | FilterEventArgs | SearchEventArgs | SortEventArgs | AddEventArgs | SaveEventArgs | EditEventArgs | DeleteEventArgs>; | ||
/** | ||
@@ -824,3 +854,3 @@ * Triggers when Grid actions such as Sorting, Filtering, Paging and Grouping etc., completed. | ||
*/ | ||
actionComplete: EmitType<PageEventArgs | GroupEventArgs | FilterEventArgs | SearchEventArgs | SortEventArgs>; | ||
actionComplete: EmitType<PageEventArgs | GroupEventArgs | FilterEventArgs | SearchEventArgs | SortEventArgs | AddEventArgs | SaveEventArgs | EditEventArgs | DeleteEventArgs>; | ||
/** | ||
@@ -1266,2 +1296,7 @@ * Triggers when any Grid actions failed to achieve desired results. | ||
/** | ||
* Gets the Grid's data. | ||
* @return {Data} | ||
*/ | ||
getDataModule(): Data; | ||
/** | ||
* Shows a column by column name. | ||
@@ -1446,3 +1481,2 @@ * @param {string|string[]} keys - Defines a single or collection of column names. | ||
private processModel(); | ||
private templateComplier(template); | ||
private gridRender(); | ||
@@ -1500,2 +1534,7 @@ private dataReady(); | ||
setInjectedModules(modules: Function[]): void; | ||
private updateColumnObject(); | ||
/** | ||
* Refreshes the Grid column changes | ||
*/ | ||
refreshColumns(): void; | ||
} |
@@ -5,3 +5,3 @@ import { Component, NumberFormatOptions, DateFormatOptions } from '@syncfusion/ej2-base'; | ||
import { Column, ColumnModel } from '../models/column'; | ||
import { SortSettingsModel, SelectionSettingsModel, FilterSettingsModel, SearchSettingsModel } from './grid-model'; | ||
import { SortSettingsModel, TextWrapSettingsModel, SelectionSettingsModel, FilterSettingsModel, SearchSettingsModel } from './grid-model'; | ||
import { PageSettingsModel, AggregateRowModel } from '../models/models'; | ||
@@ -17,3 +17,3 @@ import { RowDropSettingsModel, GroupSettingsModel, GridModel, EditSettingsModel } from './grid-model'; | ||
import { NumericTextBoxModel } from '@syncfusion/ej2-inputs'; | ||
import { FormValidator } from '@syncfusion/ej2-base'; | ||
import { FormValidator } from '@syncfusion/ej2-inputs'; | ||
/** | ||
@@ -51,2 +51,7 @@ * Specifies grid interfaces. | ||
/** | ||
* Specifies the 'textWrapSettings' for Grid. | ||
* @default [] | ||
*/ | ||
textWrapSettings?: TextWrapSettingsModel; | ||
/** | ||
* Specifies whether the paging is enable or not. | ||
@@ -199,2 +204,8 @@ * @default null | ||
toolbar?: string | string[] | ItemModel[]; | ||
/** | ||
* @hidden | ||
* It used to render toolbar template | ||
* @default null | ||
*/ | ||
toolbarTemplate?: string; | ||
isEdit?: boolean; | ||
@@ -400,2 +411,3 @@ editModule?: Edit; | ||
virtualInfo?: VirtualInfo; | ||
cancel?: boolean; | ||
} | ||
@@ -583,3 +595,3 @@ /** | ||
export interface EJ2Intance extends HTMLElement { | ||
ej2_instances: Object; | ||
ej2_instances: Object | Object[]; | ||
} | ||
@@ -716,2 +728,44 @@ /** | ||
} | ||
export interface DeleteEventArgs { | ||
/** Defines the cancel option value. */ | ||
cancel?: boolean; | ||
/** Defines the request type. */ | ||
requestType?: string; | ||
/** Defines the foreign key record object (JSON). @hidden */ | ||
foreignKeyData?: Object; | ||
/** Defines the record objects. */ | ||
data?: Object[]; | ||
/** Defines the selected rows for delete. */ | ||
tr?: Element[]; | ||
/** Defines the name of the event. */ | ||
type?: string; | ||
} | ||
export interface AddEventArgs { | ||
/** Defines the cancel option value. */ | ||
cancel?: boolean; | ||
/** Defines the request type. */ | ||
requestType?: string; | ||
/** Defines the foreign key record object (JSON). @hidden */ | ||
foreignKeyData?: Object; | ||
/** Defines the record objects. */ | ||
data?: Object; | ||
/** Defines the name of the event. */ | ||
type?: string; | ||
/** Defines the previous data. */ | ||
previousData?: Object; | ||
/** Defines the added row. */ | ||
row?: Object; | ||
} | ||
export interface SaveEventArgs extends AddEventArgs { | ||
/** Defines the previous data. */ | ||
previousData?: Object; | ||
/** Defines the selected row index. */ | ||
selectedRow?: number; | ||
/** Defines the current action. */ | ||
action?: string; | ||
} | ||
export interface EditEventArgs extends BeginEditArgs { | ||
/** Defines the request type. */ | ||
requestType?: string; | ||
} | ||
/** | ||
@@ -718,0 +772,0 @@ * @hidden |
@@ -33,2 +33,4 @@ import { IPosition, IGrid } from './interface'; | ||
/** @hidden */ | ||
export declare function templateCompiler(template: string): Function; | ||
/** @hidden */ | ||
export declare function setStyleAndAttributes(node: Element, customAttributes: { | ||
@@ -73,1 +75,3 @@ [x: string]: Object; | ||
export declare function isActionPrevent(inst: IGrid): boolean; | ||
/** @hidden */ | ||
export declare function wrap(elem: any, action: boolean): void; |
@@ -35,2 +35,17 @@ define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-data", "../models/column"], function (require, exports, ej2_base_1, ej2_base_2, ej2_base_3, ej2_data_1, column_1) { | ||
exports.iterateArrayOrObject = iterateArrayOrObject; | ||
function templateCompiler(template) { | ||
if (template) { | ||
var e = void 0; | ||
try { | ||
if (document.querySelectorAll(template).length) { | ||
return ej2_base_1.compile(document.querySelector(template).innerHTML.trim()); | ||
} | ||
} | ||
catch (e) { | ||
return ej2_base_1.compile(template); | ||
} | ||
} | ||
return undefined; | ||
} | ||
exports.templateCompiler = templateCompiler; | ||
function setStyleAndAttributes(node, customAttributes) { | ||
@@ -261,3 +276,3 @@ var copyAttr = {}; | ||
var isOldRow = !row ? true : row && !row.classList.contains('e-insertedrow'); | ||
if (type === 'edit' && isOldRow) { | ||
if (type === 'beginEdit' && isOldRow) { | ||
if (col.isIdentity || col.isPrimaryKey || !col.allowEditing) { | ||
@@ -283,2 +298,10 @@ return false; | ||
exports.isActionPrevent = isActionPrevent; | ||
function wrap(elem, action) { | ||
var clName = 'e-wrap'; | ||
elem = elem instanceof Array ? elem : [elem]; | ||
for (var i = 0; i < elem.length; i++) { | ||
action ? elem[i].classList.add(clName) : elem[i].classList.remove(clName); | ||
} | ||
} | ||
exports.wrap = wrap; | ||
}); |
@@ -1,2 +0,2 @@ | ||
define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "../services/value-formatter", "../base/util"], function (require, exports, ej2_base_1, ej2_base_2, value_formatter_1, util_1) { | ||
define(["require", "exports", "@syncfusion/ej2-base", "../services/value-formatter", "../base/util"], function (require, exports, ej2_base_1, value_formatter_1, util_1) { | ||
"use strict"; | ||
@@ -25,11 +25,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
if (this.template) { | ||
var e = void 0; | ||
try { | ||
if (document.querySelectorAll(this.template).length) { | ||
this.templateFn = ej2_base_2.compile(document.querySelector(this.template).innerHTML.trim()); | ||
} | ||
} | ||
catch (e) { | ||
this.templateFn = ej2_base_2.compile(this.template); | ||
} | ||
this.templateFn = util_1.templateCompiler(this.template); | ||
} | ||
@@ -36,0 +28,0 @@ } |
@@ -13,3 +13,3 @@ import { IEditCell, IGrid } from '../base/interface'; | ||
value: string; | ||
type: string; | ||
requestType: string; | ||
element: Element; | ||
@@ -22,5 +22,5 @@ }): Element; | ||
column: Column; | ||
type: string; | ||
requestType: string; | ||
}): void; | ||
destroy(): void; | ||
} |
@@ -16,3 +16,3 @@ define(["require", "exports", "@syncfusion/ej2-base", "../base/util"], function (require, exports, ej2_base_1, util_1) { | ||
}); | ||
if (!util_1.isEditable(args.column, args.type, args.element)) { | ||
if (!util_1.isEditable(args.column, args.requestType, args.element)) { | ||
input.setAttribute('disabled', 'true'); | ||
@@ -19,0 +19,0 @@ } |
@@ -52,3 +52,8 @@ define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "../base/util"], function (require, exports, ej2_base_1, ej2_base_2, util_1) { | ||
var node = this.refreshCell(cell, data, attributes); | ||
td.innerHTML = node.innerHTML; | ||
td.innerHTML = ''; | ||
var elements = [].slice.call(node.childNodes); | ||
for (var _i = 0, elements_1 = elements; _i < elements_1.length; _i++) { | ||
var elem = elements_1[_i]; | ||
td.appendChild(elem); | ||
} | ||
}; | ||
@@ -55,0 +60,0 @@ CellRenderer.prototype.refreshCell = function (cell, data, attributes) { |
@@ -13,3 +13,3 @@ import { IGrid, IEditCell } from '../base/interface'; | ||
value: string; | ||
type: string; | ||
requestType: string; | ||
}): Element; | ||
@@ -21,4 +21,4 @@ read(element: Element): string; | ||
column: Column; | ||
type: string; | ||
requestType: string; | ||
}): void; | ||
} |
@@ -27,3 +27,3 @@ define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-inputs", "../base/util"], function (require, exports, ej2_base_1, ej2_inputs_1, util_1) { | ||
properties: { | ||
enableRtl: this.parent.enableRtl, enabled: util_1.isEditable(args.column, args.type, args.element), | ||
enableRtl: this.parent.enableRtl, enabled: util_1.isEditable(args.column, args.requestType, args.element), | ||
placeholder: isInline ? '' : args.column.headerText | ||
@@ -30,0 +30,0 @@ } |
@@ -50,4 +50,4 @@ define(["require", "exports", "@syncfusion/ej2-popups", "@syncfusion/ej2-base", "../base/constant"], function (require, exports, ej2_popups_1, ej2_base_1, events) { | ||
DialogEditRender.prototype.destroy = function (args) { | ||
this.parent.notify(events.destroyForm, {}); | ||
this.parent.isEdit = false; | ||
this.parent.notify(events.destroyForm, {}); | ||
this.parent.notify(events.toolbarRefresh, {}); | ||
@@ -54,0 +54,0 @@ if (this.dialog && !this.dialogObj.isDestroyed) { |
@@ -19,3 +19,3 @@ import { IGrid, IEditCell } from '../base/interface'; | ||
column: Column; | ||
type: string; | ||
requestType: string; | ||
}): void; | ||
@@ -22,0 +22,0 @@ read(element: Element): string; |
@@ -21,3 +21,3 @@ define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-dropdowns", "@syncfusion/ej2-data", "../base/util"], function (require, exports, ej2_base_1, ej2_base_2, ej2_dropdowns_1, ej2_data_1, util_1) { | ||
this.parent.dataSource : new ej2_data_1.DataManager(this.parent.dataSource), | ||
query: new ej2_data_1.Query().select(args.column.field), enabled: util_1.isEditable(args.column, args.type, args.element), | ||
query: new ej2_data_1.Query().select(args.column.field), enabled: util_1.isEditable(args.column, args.requestType, args.element), | ||
fields: { value: args.column.field }, value: args.rowData[args.column.field], | ||
@@ -24,0 +24,0 @@ enableRtl: this.parent.enableRtl, actionComplete: this.ddActionComplete, |
@@ -21,3 +21,3 @@ import { IGrid } from '../base/interface'; | ||
columnObject?: Column; | ||
type?: string; | ||
requestType?: string; | ||
cell?: Element; | ||
@@ -31,3 +31,3 @@ row?: Element; | ||
columnObject?: Column; | ||
type?: string; | ||
requestType?: string; | ||
cell?: Element; | ||
@@ -34,0 +34,0 @@ row?: Element; |
@@ -40,3 +40,3 @@ define(["require", "exports", "@syncfusion/ej2-base", "./inline-edit-renderer", "./batch-edit-renderer", "./dialog-edit-renderer", "@syncfusion/ej2-base"], function (require, exports, ej2_base_1, inline_edit_renderer_1, batch_edit_renderer_1, dialog_edit_renderer_1, ej2_base_2) { | ||
} | ||
col.edit.write({ rowData: args.rowData, element: cell, column: col, type: args.type }); | ||
col.edit.write({ rowData: args.rowData, element: cell, column: col, requestType: args.requestType }); | ||
if (!isFocused && !cell.getAttribute('disabled')) { | ||
@@ -64,3 +64,3 @@ this.focusElement(cell); | ||
var value = col.valueAccessor(col.field, args.rowData, col); | ||
var tArgs = { column: col, value: value, type: args.type }; | ||
var tArgs = { column: col, value: value, type: args.requestType }; | ||
var temp = col.edit.create; | ||
@@ -80,3 +80,3 @@ var input = void 0; | ||
ej2_base_2.classList(input, ['e-input', 'e-field'], []); | ||
if ((col.isPrimaryKey || col.isIdentity) && args.type === 'edit') { | ||
if ((col.isPrimaryKey || col.isIdentity) && args.requestType === 'beginEdit') { | ||
input.setAttribute('disabled', 'true'); | ||
@@ -83,0 +83,0 @@ } |
@@ -310,2 +310,6 @@ define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "../base/enum", "./row-renderer", "../models/cell", "../models/row", "../base/constant", "@syncfusion/ej2-base", "../base/util"], function (require, exports, ej2_base_1, ej2_base_2, ej2_base_3, enum_1, row_renderer_1, cell_1, row_1, events, ej2_base_4, util_1) { | ||
this.parent.notify(events.headerRefreshed, {}); | ||
var rows = [].slice.call(headerDiv.querySelectorAll('tr.e-columnheader')); | ||
if (this.parent.allowTextWrap && this.parent.textWrapSettings.wrapMode === 'header') { | ||
util_1.wrap(rows, true); | ||
} | ||
}; | ||
@@ -312,0 +316,0 @@ HeaderRender.prototype.appendContent = function (table) { |
@@ -20,5 +20,5 @@ import { IGrid, IEditCell } from '../base/interface'; | ||
column: Column; | ||
type: string; | ||
requestType: string; | ||
}): void; | ||
destroy(): void; | ||
} |
@@ -24,3 +24,3 @@ define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-inputs", "../base/util"], function (require, exports, ej2_base_1, ej2_base_2, ej2_inputs_1, util_1) { | ||
placeholder: isInline ? '' : args.column.headerText, | ||
enabled: util_1.isEditable(args.column, args.type, args.element), | ||
enabled: util_1.isEditable(args.column, args.requestType, args.element), | ||
floatLabelType: this.parent.editSettings.mode !== 'dialog' ? 'Never' : 'Always', | ||
@@ -27,0 +27,0 @@ }, col.edit.params)); |
import { IGrid, NotifyArgs } from '../base/interface'; | ||
import { ReturnType } from '../base/type'; | ||
import { Data } from '../actions/data'; | ||
import { ServiceLocator } from '../services/service-locator'; | ||
@@ -15,3 +16,3 @@ /** | ||
private l10n; | ||
private data; | ||
data: Data; | ||
private ariaService; | ||
@@ -18,0 +19,0 @@ private renderer; |
@@ -31,2 +31,5 @@ define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "@syncfusion/ej2-data", "../base/enum", "../actions/data", "../base/constant", "../base/util", "../renderer/content-renderer", "../renderer/header-renderer", "../renderer/cell-renderer", "../renderer/header-cell-renderer", "../renderer/stacked-cell-renderer", "../renderer/indent-cell-renderer", "../renderer/caption-cell-renderer", "../renderer/expand-cell-renderer", "../renderer/header-indent-renderer", "../renderer/detail-header-indent-renderer", "../renderer/detail-expand-cell-renderer"], function (require, exports, ej2_base_1, ej2_base_2, ej2_data_1, enum_1, data_1, events, util_1, content_renderer_1, header_renderer_1, cell_renderer_1, header_cell_renderer_1, stacked_cell_renderer_1, indent_cell_renderer_1, caption_cell_renderer_1, expand_cell_renderer_1, header_indent_renderer_1, detail_header_indent_renderer_1, detail_expand_cell_renderer_1) { | ||
this.parent.trigger(events.actionBegin, e); | ||
if (e.cancel) { | ||
return; | ||
} | ||
this.refreshDataManager(e); | ||
@@ -33,0 +36,0 @@ }; |
@@ -20,3 +20,8 @@ define(["require", "exports", "@syncfusion/ej2-base", "@syncfusion/ej2-base", "../base/constant", "../base/util", "../base/enum"], function (require, exports, ej2_base_1, ej2_base_2, constant_1, util_1, enum_1) { | ||
var tr = this.refreshRow(row, columns, attributes, rowTemplate); | ||
node.innerHTML = tr.innerHTML; | ||
var cells = [].slice.call(tr.cells); | ||
node.innerHTML = ''; | ||
for (var _i = 0, cells_1 = cells; _i < cells_1.length; _i++) { | ||
var cell = cells_1[_i]; | ||
node.appendChild(cell); | ||
} | ||
}; | ||
@@ -23,0 +28,0 @@ RowRenderer.prototype.refreshRow = function (row, columns, attributes, rowTemplate) { |
@@ -28,3 +28,5 @@ var __extends = (this && this.__extends) || (function () { | ||
var node = this.element.cloneNode(); | ||
node.innerHTML = cell.column.headerText; | ||
var div = ej2_base_1.createElement('div', { className: 'e-stackedheadercelldiv' }); | ||
node.appendChild(div); | ||
div.innerHTML = cell.column.headerText; | ||
if (cell.column.toolTip) { | ||
@@ -34,3 +36,3 @@ node.setAttribute('title', cell.column.toolTip); | ||
if (ej2_base_2.isNullOrUndefined(cell.column.textAlign)) { | ||
node.style.textAlign = cell.column.textAlign; | ||
div.style.textAlign = cell.column.textAlign; | ||
} | ||
@@ -37,0 +39,0 @@ node.setAttribute('colspan', cell.colSpan.toString()); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
12830889
303
139266
Updated@syncfusion/ej2-base@^1.0.19
Updated@syncfusion/ej2-data@^1.0.19