Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ui-grid/edit

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ui-grid/edit - npm Package Compare versions

Comparing version 4.8.5 to 4.9.0

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [4.9.0](https://github.com/angular-ui/ui-grid/compare/v4.8.5...v4.9.0) (2020-09-27)
### Bug Fixes
* 🐛 fixing firefox number edit ([b58f78d](https://github.com/angular-ui/ui-grid/commit/b58f78d6e175dce283a5c709041acbfa41d68e5e)), closes [#6953](https://github.com/angular-ui/ui-grid/issues/6953)
## [4.8.5](https://github.com/angular-ui/ui-grid/compare/v4.8.3...v4.8.5) (2020-09-14)

@@ -8,0 +19,0 @@

5

js/ui-grid.edit.js
/*!
* ui-grid - v4.8.5 - 2020-09-14
* ui-grid - v4.9.0 - 2020-09-27
* Copyright (c) 2020 ; License: MIT

@@ -984,2 +984,5 @@ */

if ($elm[0]) {
$elm[0].focus();
}
$elm.on('blur', $scope.stopEdit);

@@ -986,0 +989,0 @@ });

4

js/ui-grid.edit.min.js
/*!
* ui-grid - v4.8.5 - 2020-09-14
* ui-grid - v4.9.0 - 2020-09-27
* Copyright (c) 2020 ; License: MIT

@@ -7,2 +7,2 @@ */

!function(){"use strict";var e=angular.module("ui.grid.edit",["ui.grid"]);e.constant("uiGridEditConstants",{EDITABLE_CELL_TEMPLATE:/EDITABLE_CELL_TEMPLATE/g,EDITABLE_CELL_DIRECTIVE:/editable_cell_directive/g,events:{BEGIN_CELL_EDIT:"uiGridEventBeginCellEdit",END_CELL_EDIT:"uiGridEventEndCellEdit",CANCEL_CELL_EDIT:"uiGridEventCancelCellEdit"}}),e.service("uiGridEditService",["$q","uiGridConstants","gridUtil",function(o,i,l){var t={initializeGrid:function(e){t.defaultGridOptions(e.options),e.registerColumnBuilder(t.editColumnBuilder),e.edit={};e.api.registerEventsFromObject({edit:{afterCellEdit:function(e,i,t,n){},beginCellEdit:function(e,i,t){},cancelCellEdit:function(e,i){}}})},defaultGridOptions:function(e){e.cellEditableCondition=void 0===e.cellEditableCondition||e.cellEditableCondition,e.enableCellEditOnFocus=void 0!==e.enableCellEditOnFocus&&e.enableCellEditOnFocus},editColumnBuilder:function(i,t,e){var n=[];return i.enableCellEdit=void 0===i.enableCellEdit?void 0===e.enableCellEdit?"object"!==i.type:e.enableCellEdit:i.enableCellEdit,i.cellEditableCondition=void 0===i.cellEditableCondition?e.cellEditableCondition:i.cellEditableCondition,i.enableCellEdit&&(i.editableCellTemplate=i.editableCellTemplate||e.editableCellTemplate||"ui-grid/cellEditor",n.push(l.getTemplate(i.editableCellTemplate).then(function(e){t.editableCellTemplate=e},function(e){throw new Error("Couldn't fetch/use colDef.editableCellTemplate '"+i.editableCellTemplate+"'")}))),i.enableCellEditOnFocus=void 0===i.enableCellEditOnFocus?e.enableCellEditOnFocus:i.enableCellEditOnFocus,o.all(n)},isStartEditKey:function(e){return!(e.metaKey||e.keyCode===i.keymap.ESC||e.keyCode===i.keymap.SHIFT||e.keyCode===i.keymap.CTRL||e.keyCode===i.keymap.ALT||e.keyCode===i.keymap.WIN||e.keyCode===i.keymap.CAPSLOCK||e.keyCode===i.keymap.LEFT||e.keyCode===i.keymap.TAB&&e.shiftKey||e.keyCode===i.keymap.RIGHT||e.keyCode===i.keymap.TAB||e.keyCode===i.keymap.UP||e.keyCode===i.keymap.ENTER&&e.shiftKey||e.keyCode===i.keymap.DOWN||e.keyCode===i.keymap.ENTER)}};return t}]),e.directive("uiGridEdit",["gridUtil","uiGridEditService",function(e,o){return{replace:!0,priority:0,require:"^uiGrid",scope:!1,compile:function(){return{pre:function(e,i,t,n){o.initializeGrid(n.grid)},post:function(e,i,t,n){}}}}}]),e.directive("uiGridViewport",["uiGridEditConstants",function(l){return{replace:!0,priority:-99998,require:["^uiGrid","^uiGridRenderContainer"],scope:!1,compile:function(){return{post:function(e,i,t,n){var o=n[0];o.grid.api.edit&&o.grid.api.cellNav&&("body"===n[1].containerId&&(e.$on(l.events.CANCEL_CELL_EDIT,function(){o.focus()}),e.$on(l.events.END_CELL_EDIT,function(){o.focus()})))}}}}}]),e.directive("uiGridCell",["$compile","$injector","$timeout","uiGridConstants","uiGridEditConstants","gridUtil","$parse","uiGridEditService","$rootScope","$q",function(b,e,h,T,k,w,_,f,I,G){if(e.has("uiGridCellNavService"))e.get("uiGridCellNavService");return{priority:-100,restrict:"A",scope:!1,require:"?^uiGrid",link:function(E,p,e,n){var C,v,g,i,y,m=!1;if(E.col.colDef.enableCellEdit){var t=function(){},o=function(){},l=function(){E.col.colDef.enableCellEdit&&!1!==E.row.enableCellEdit?E.beginEditEventsWired||d():E.beginEditEventsWired&&D()};l();var r=E.$watch("row",function(e,i){e!==i&&l()});E.$on("$destroy",function(){r(),p.off()})}function d(){p.on("dblclick",s),p.on("touchstart",c),n&&n.grid.api.cellNav&&(o=n.grid.api.cellNav.on.viewPortKeyDown(E,function(e,i){null!==i&&(i.row!==E.row||i.col!==E.col||E.col.colDef.enableCellEditOnFocus||u(e))}),t=n.grid.api.cellNav.on.navigate(E,function(e,i,t){E.col.colDef.enableCellEditOnFocus&&(e.row!==E.row||e.col!==E.col||null!==t&&(!t||"click"!==t.type&&"keydown"!==t.type)||h(function(){s(t)}))})),E.beginEditEventsWired=!0}function c(e){void 0!==e.originalEvent&&void 0!==e.originalEvent&&(e=e.originalEvent),p.on("touchend",a),(i=h(function(){},500)).then(function(){setTimeout(s,0),p.off("touchend",a)}).catch(angular.noop)}function a(){h.cancel(i),p.off("touchend",a)}function D(){p.off("dblclick",s),p.off("keydown",u),p.off("touchstart",c),t(),o(),E.beginEditEventsWired=!1}function u(e){f.isStartEditKey(e)&&s(e)}function s(e){E.grid.api.core.scrollToIfNecessary(E.row,E.col).then(function(){!function(e){if(m)return;if(i=E.col,t=E.row,n=e,t.isSaving||(angular.isFunction(i.colDef.cellEditableCondition)?!i.colDef.cellEditableCondition(E,n):!i.colDef.cellEditableCondition))return;var i,t,n;var o=E.row.getQualifiedColField(E.col);E.col.colDef.editModelField&&(o=w.preEval("row.entity."+E.col.colDef.editModelField));g=_(o),v=g(E),C=(C=(C=E.col.editableCellTemplate).replace(T.MODEL_COL_FIELD,o)).replace(T.COL_FIELD,"grid.getCellValue(row, col)");var l=E.col.colDef.editDropdownFilter?"|"+E.col.colDef.editDropdownFilter:"";C=C.replace(T.CUSTOM_FILTERS,l);var r="text";switch(E.col.colDef.type){case"boolean":r="checkbox";break;case"number":r="number";break;case"date":r="date"}C=C.replace("INPUT_TYPE",r);var d=E.col.colDef.editDropdownOptionsFunction;if(d)G.when(d(E.row.entity,E.col.colDef)).then(function(e){E.editDropdownOptionsArray=e});else{var c=E.col.colDef.editDropdownRowEntityOptionsArrayPath;E.editDropdownOptionsArray=c?function(e,i){var t=(i=(i=i.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"")).split(".");for(;t.length;){var n=t.shift();if(!(n in e))return;e=e[n]}return e}(E.row.entity,c):E.col.colDef.editDropdownOptionsArray}E.editDropdownIdLabel=E.col.colDef.editDropdownIdLabel?E.col.colDef.editDropdownIdLabel:"id",E.editDropdownValueLabel=E.col.colDef.editDropdownValueLabel?E.col.colDef.editDropdownValueLabel:"value";var a=function(){m=!0,D();var e=angular.element(C);p.append(e),y=E.$new(),b(e)(y);var i=angular.element(p.children()[0]);i.addClass("ui-grid-cell-contents-hidden")};I.$$phase?a():E.$apply(a);var u=E.col.grid.api.core.on.scrollBegin(E,function(){E.grid.disableScrolling||(L(),E.grid.api.edit.raise.afterCellEdit(E.row.entity,E.col.colDef,g(E),v),u(),s(),f())}),s=E.$on(k.events.END_CELL_EDIT,function(){L(),E.grid.api.edit.raise.afterCellEdit(E.row.entity,E.col.colDef,g(E),v),s(),u(),f()}),f=E.$on(k.events.CANCEL_CELL_EDIT,function(){!function(){if(E.grid.disableScrolling=!1,!m)return;g.assign(E,v),E.$apply(),E.grid.api.edit.raise.cancelCellEdit(E.row.entity,E.col.colDef),L()}(),f(),u(),s()});E.$broadcast(k.events.BEGIN_CELL_EDIT,e),h(function(){E.grid.api.edit.raise.beginCellEdit(E.row.entity,E.col.colDef,e)})}(e)})}function L(){if(E.grid.disableScrolling=!1,m){n&&n.grid.api.cellNav&&n.focus();var e=angular.element(p.children()[0]);y.$destroy();for(var i=p.children(),t=1;t<i.length;t++)angular.element(i[t]).remove();e.removeClass("ui-grid-cell-contents-hidden"),m=!1,d(),E.grid.api.core.notifyDataChange(T.dataChange.EDIT)}}}}}]),e.directive("uiGridEditor",["gridUtil","uiGridConstants","uiGridEditConstants","$timeout","uiGridEditService",function(e,d,c,a,u){return{scope:!0,require:["?^uiGrid","?^uiGridRenderContainer","ngModel"],compile:function(){return{pre:function(e,i,t){},post:function(i,t,e,n){var o,l,r;n[0]&&(o=n[0]),n[1]&&(l=n[1]),n[2]&&(r=n[2]),i.$on(c.events.BEGIN_CELL_EDIT,function(){if(a(function(){if(t[0].focus(),!t[0].select||!i.col.colDef.enableCellEditOnFocus&&o&&o.grid.api.cellNav)try{t[0].setSelectionRange(t[0].value.length,t[0].value.length)}catch(e){}else t[0].select()}),o&&o.grid.api.cellNav)var n=o.grid.api.cellNav.on.viewPortKeyPress(i,function(e,i){if(u.isStartEditKey(e)){var t="number"==typeof e.which?e.which:e.keyCode;0<t&&(r.$setViewValue(String.fromCharCode(t),e),r.$render())}n()});t.on("mousedown",function(e){"checkbox"===t[0].type&&(t.off("blur",i.stopEdit),a(function(){t[0].focus(),t.on("blur",i.stopEdit)}))}),t.on("blur",i.stopEdit)}),i.deepEdit=!1,i.stopEdit=function(e){i.inputForm&&!i.inputForm.$valid?(e.stopPropagation(),i.$emit(c.events.CANCEL_CELL_EDIT)):i.$emit(c.events.END_CELL_EDIT),i.deepEdit=!1},t.on("click",function(e){"checkbox"!==t[0].type&&(i.deepEdit=!0,i.$applyAsync(function(){i.grid.disableScrolling=!0}))}),t.on("keydown",function(e){switch(e.keyCode){case d.keymap.ESC:e.stopPropagation(),i.$emit(c.events.CANCEL_CELL_EDIT)}if(!i.deepEdit||e.keyCode!==d.keymap.LEFT&&e.keyCode!==d.keymap.RIGHT&&e.keyCode!==d.keymap.UP&&e.keyCode!==d.keymap.DOWN)if(o&&o.grid.api.cellNav)e.uiGridTargetRenderContainerId=l.containerId,null!==o.cellNav.handleKeyDown(e)&&i.stopEdit(e);else switch(e.keyCode){case d.keymap.ENTER:case d.keymap.TAB:e.stopPropagation(),e.preventDefault(),i.stopEdit(e)}else e.stopPropagation();return!0}),i.$on("$destroy",function(){t.off()})}}}}}]),e.directive("uiGridEditor",["$filter",function(o){return{priority:-100,require:"?ngModel",link:function(e,i,t,n){2===angular.version.minor&&t.type&&"date"===t.type&&n&&(n.$formatters.push(function(e){return n.$setValidity(null,!e||!isNaN(e.getTime())),o("date")(e,"yyyy-MM-dd")}),n.$parsers.push(function(e){if(e&&0<e.length){var i=function(e){if(void 0===e||""===e)return null;var i=e.split("-");if(3!==i.length)return null;var t=parseInt(i[0],10),n=parseInt(i[1],10),o=parseInt(i[2],10);return n<1||t<1||o<1?null:new Date(t,n-1,o)}(e);return n.$setValidity(null,i&&!isNaN(i.getTime())),i}return n.$setValidity(null,!0),null}))}}}]),e.directive("uiGridEditDropdown",["uiGridConstants","uiGridEditConstants","$timeout",function(r,d,c){return{require:["?^uiGrid","?^uiGridRenderContainer"],scope:!0,compile:function(){return{pre:function(e,i,t){},post:function(i,e,t,n){var o=n[0],l=n[1];i.$on(d.events.BEGIN_CELL_EDIT,function(){c(function(){e[0].focus()}),e[0].style.width=e[0].parentElement.offsetWidth-1+"px",e.on("blur",function(e){i.stopEdit(e)})}),i.stopEdit=function(e){i.$emit(d.events.END_CELL_EDIT)},e.on("keydown",function(e){switch(e.keyCode){case r.keymap.ESC:e.stopPropagation(),i.$emit(d.events.CANCEL_CELL_EDIT)}if(o&&o.grid.api.cellNav)e.uiGridTargetRenderContainerId=l.containerId,null!==o.cellNav.handleKeyDown(e)&&i.stopEdit(e);else switch(e.keyCode){case r.keymap.ENTER:case r.keymap.TAB:e.stopPropagation(),e.preventDefault(),i.stopEdit(e)}return!0}),i.$on("$destroy",function(){e.off()})}}}}}]),e.directive("uiGridEditFileChooser",["gridUtil","uiGridConstants","uiGridEditConstants",function(l,e,r){return{scope:!0,require:["?^uiGrid","?^uiGridRenderContainer"],compile:function(){return{pre:function(e,i,t){},post:function(n,o){o[0].addEventListener("change",function e(i){var t=i.srcElement||i.target;t&&t.files&&0<t.files.length?("function"==typeof n.col.colDef.editFileChooserCallback?n.col.colDef.editFileChooserCallback(n.row,n.col,t.files):l.logError("You need to set colDef.editFileChooserCallback to use the file chooser"),t.form.reset(),n.$emit(r.events.END_CELL_EDIT)):n.$emit(r.events.CANCEL_CELL_EDIT),o[0].removeEventListener("change",e,!1)},!1),n.$on(r.events.BEGIN_CELL_EDIT,function(){o[0].focus(),o[0].select(),o.on("blur",function(){n.$emit(r.events.END_CELL_EDIT),o.off()})})}}}}}])}(),angular.module("ui.grid.edit").run(["$templateCache",function(e){"use strict";e.put("ui-grid/cellEditor",'<div><form name="inputForm"><input type="INPUT_TYPE" ng-class="\'colt\' + col.uid" ui-grid-editor ng-model="MODEL_COL_FIELD"></form></div>'),e.put("ui-grid/dropdownEditor",'<div><form name="inputForm"><select ng-class="\'colt\' + col.uid" ui-grid-edit-dropdown ng-model="MODEL_COL_FIELD" ng-options="field[editDropdownIdLabel] as field[editDropdownValueLabel] CUSTOM_FILTERS for field in editDropdownOptionsArray"></select></form></div>'),e.put("ui-grid/fileChooserEditor",'<div><form name="inputForm"><input ng-class="\'colt\' + col.uid" ui-grid-edit-file-chooser type="file" id="files" name="files[]" ng-model="MODEL_COL_FIELD"></form></div>')}]);
!function(){"use strict";var e=angular.module("ui.grid.edit",["ui.grid"]);e.constant("uiGridEditConstants",{EDITABLE_CELL_TEMPLATE:/EDITABLE_CELL_TEMPLATE/g,EDITABLE_CELL_DIRECTIVE:/editable_cell_directive/g,events:{BEGIN_CELL_EDIT:"uiGridEventBeginCellEdit",END_CELL_EDIT:"uiGridEventEndCellEdit",CANCEL_CELL_EDIT:"uiGridEventCancelCellEdit"}}),e.service("uiGridEditService",["$q","uiGridConstants","gridUtil",function(o,i,l){var t={initializeGrid:function(e){t.defaultGridOptions(e.options),e.registerColumnBuilder(t.editColumnBuilder),e.edit={};e.api.registerEventsFromObject({edit:{afterCellEdit:function(e,i,t,n){},beginCellEdit:function(e,i,t){},cancelCellEdit:function(e,i){}}})},defaultGridOptions:function(e){e.cellEditableCondition=void 0===e.cellEditableCondition||e.cellEditableCondition,e.enableCellEditOnFocus=void 0!==e.enableCellEditOnFocus&&e.enableCellEditOnFocus},editColumnBuilder:function(i,t,e){var n=[];return i.enableCellEdit=void 0===i.enableCellEdit?void 0===e.enableCellEdit?"object"!==i.type:e.enableCellEdit:i.enableCellEdit,i.cellEditableCondition=void 0===i.cellEditableCondition?e.cellEditableCondition:i.cellEditableCondition,i.enableCellEdit&&(i.editableCellTemplate=i.editableCellTemplate||e.editableCellTemplate||"ui-grid/cellEditor",n.push(l.getTemplate(i.editableCellTemplate).then(function(e){t.editableCellTemplate=e},function(e){throw new Error("Couldn't fetch/use colDef.editableCellTemplate '"+i.editableCellTemplate+"'")}))),i.enableCellEditOnFocus=void 0===i.enableCellEditOnFocus?e.enableCellEditOnFocus:i.enableCellEditOnFocus,o.all(n)},isStartEditKey:function(e){return!(e.metaKey||e.keyCode===i.keymap.ESC||e.keyCode===i.keymap.SHIFT||e.keyCode===i.keymap.CTRL||e.keyCode===i.keymap.ALT||e.keyCode===i.keymap.WIN||e.keyCode===i.keymap.CAPSLOCK||e.keyCode===i.keymap.LEFT||e.keyCode===i.keymap.TAB&&e.shiftKey||e.keyCode===i.keymap.RIGHT||e.keyCode===i.keymap.TAB||e.keyCode===i.keymap.UP||e.keyCode===i.keymap.ENTER&&e.shiftKey||e.keyCode===i.keymap.DOWN||e.keyCode===i.keymap.ENTER)}};return t}]),e.directive("uiGridEdit",["gridUtil","uiGridEditService",function(e,o){return{replace:!0,priority:0,require:"^uiGrid",scope:!1,compile:function(){return{pre:function(e,i,t,n){o.initializeGrid(n.grid)},post:function(e,i,t,n){}}}}}]),e.directive("uiGridViewport",["uiGridEditConstants",function(l){return{replace:!0,priority:-99998,require:["^uiGrid","^uiGridRenderContainer"],scope:!1,compile:function(){return{post:function(e,i,t,n){var o=n[0];o.grid.api.edit&&o.grid.api.cellNav&&("body"===n[1].containerId&&(e.$on(l.events.CANCEL_CELL_EDIT,function(){o.focus()}),e.$on(l.events.END_CELL_EDIT,function(){o.focus()})))}}}}}]),e.directive("uiGridCell",["$compile","$injector","$timeout","uiGridConstants","uiGridEditConstants","gridUtil","$parse","uiGridEditService","$rootScope","$q",function(b,e,h,T,k,w,_,f,I,G){if(e.has("uiGridCellNavService"))e.get("uiGridCellNavService");return{priority:-100,restrict:"A",scope:!1,require:"?^uiGrid",link:function(E,p,e,n){var C,v,g,i,y,m=!1;if(E.col.colDef.enableCellEdit){var t=function(){},o=function(){},l=function(){E.col.colDef.enableCellEdit&&!1!==E.row.enableCellEdit?E.beginEditEventsWired||d():E.beginEditEventsWired&&D()};l();var r=E.$watch("row",function(e,i){e!==i&&l()});E.$on("$destroy",function(){r(),p.off()})}function d(){p.on("dblclick",s),p.on("touchstart",c),n&&n.grid.api.cellNav&&(o=n.grid.api.cellNav.on.viewPortKeyDown(E,function(e,i){null!==i&&(i.row!==E.row||i.col!==E.col||E.col.colDef.enableCellEditOnFocus||u(e))}),t=n.grid.api.cellNav.on.navigate(E,function(e,i,t){E.col.colDef.enableCellEditOnFocus&&(e.row!==E.row||e.col!==E.col||null!==t&&(!t||"click"!==t.type&&"keydown"!==t.type)||h(function(){s(t)}))})),E.beginEditEventsWired=!0}function c(e){void 0!==e.originalEvent&&void 0!==e.originalEvent&&(e=e.originalEvent),p.on("touchend",a),(i=h(function(){},500)).then(function(){setTimeout(s,0),p.off("touchend",a)}).catch(angular.noop)}function a(){h.cancel(i),p.off("touchend",a)}function D(){p.off("dblclick",s),p.off("keydown",u),p.off("touchstart",c),t(),o(),E.beginEditEventsWired=!1}function u(e){f.isStartEditKey(e)&&s(e)}function s(e){E.grid.api.core.scrollToIfNecessary(E.row,E.col).then(function(){!function(e){if(m)return;if(i=E.col,t=E.row,n=e,t.isSaving||(angular.isFunction(i.colDef.cellEditableCondition)?!i.colDef.cellEditableCondition(E,n):!i.colDef.cellEditableCondition))return;var i,t,n;var o=E.row.getQualifiedColField(E.col);E.col.colDef.editModelField&&(o=w.preEval("row.entity."+E.col.colDef.editModelField));g=_(o),v=g(E),C=(C=(C=E.col.editableCellTemplate).replace(T.MODEL_COL_FIELD,o)).replace(T.COL_FIELD,"grid.getCellValue(row, col)");var l=E.col.colDef.editDropdownFilter?"|"+E.col.colDef.editDropdownFilter:"";C=C.replace(T.CUSTOM_FILTERS,l);var r="text";switch(E.col.colDef.type){case"boolean":r="checkbox";break;case"number":r="number";break;case"date":r="date"}C=C.replace("INPUT_TYPE",r);var d=E.col.colDef.editDropdownOptionsFunction;if(d)G.when(d(E.row.entity,E.col.colDef)).then(function(e){E.editDropdownOptionsArray=e});else{var c=E.col.colDef.editDropdownRowEntityOptionsArrayPath;E.editDropdownOptionsArray=c?function(e,i){var t=(i=(i=i.replace(/\[(\w+)\]/g,".$1")).replace(/^\./,"")).split(".");for(;t.length;){var n=t.shift();if(!(n in e))return;e=e[n]}return e}(E.row.entity,c):E.col.colDef.editDropdownOptionsArray}E.editDropdownIdLabel=E.col.colDef.editDropdownIdLabel?E.col.colDef.editDropdownIdLabel:"id",E.editDropdownValueLabel=E.col.colDef.editDropdownValueLabel?E.col.colDef.editDropdownValueLabel:"value";var a=function(){m=!0,D();var e=angular.element(C);p.append(e),y=E.$new(),b(e)(y);var i=angular.element(p.children()[0]);i.addClass("ui-grid-cell-contents-hidden")};I.$$phase?a():E.$apply(a);var u=E.col.grid.api.core.on.scrollBegin(E,function(){E.grid.disableScrolling||(L(),E.grid.api.edit.raise.afterCellEdit(E.row.entity,E.col.colDef,g(E),v),u(),s(),f())}),s=E.$on(k.events.END_CELL_EDIT,function(){L(),E.grid.api.edit.raise.afterCellEdit(E.row.entity,E.col.colDef,g(E),v),s(),u(),f()}),f=E.$on(k.events.CANCEL_CELL_EDIT,function(){!function(){if(E.grid.disableScrolling=!1,!m)return;g.assign(E,v),E.$apply(),E.grid.api.edit.raise.cancelCellEdit(E.row.entity,E.col.colDef),L()}(),f(),u(),s()});E.$broadcast(k.events.BEGIN_CELL_EDIT,e),h(function(){E.grid.api.edit.raise.beginCellEdit(E.row.entity,E.col.colDef,e)})}(e)})}function L(){if(E.grid.disableScrolling=!1,m){n&&n.grid.api.cellNav&&n.focus();var e=angular.element(p.children()[0]);y.$destroy();for(var i=p.children(),t=1;t<i.length;t++)angular.element(i[t]).remove();e.removeClass("ui-grid-cell-contents-hidden"),m=!1,d(),E.grid.api.core.notifyDataChange(T.dataChange.EDIT)}}}}}]),e.directive("uiGridEditor",["gridUtil","uiGridConstants","uiGridEditConstants","$timeout","uiGridEditService",function(e,d,c,a,u){return{scope:!0,require:["?^uiGrid","?^uiGridRenderContainer","ngModel"],compile:function(){return{pre:function(e,i,t){},post:function(i,t,e,n){var o,l,r;n[0]&&(o=n[0]),n[1]&&(l=n[1]),n[2]&&(r=n[2]),i.$on(c.events.BEGIN_CELL_EDIT,function(){if(a(function(){if(t[0].focus(),!t[0].select||!i.col.colDef.enableCellEditOnFocus&&o&&o.grid.api.cellNav)try{t[0].setSelectionRange(t[0].value.length,t[0].value.length)}catch(e){}else t[0].select()}),o&&o.grid.api.cellNav)var n=o.grid.api.cellNav.on.viewPortKeyPress(i,function(e,i){if(u.isStartEditKey(e)){var t="number"==typeof e.which?e.which:e.keyCode;0<t&&(r.$setViewValue(String.fromCharCode(t),e),r.$render())}n()});t.on("mousedown",function(e){"checkbox"===t[0].type&&(t.off("blur",i.stopEdit),a(function(){t[0].focus(),t.on("blur",i.stopEdit)}))}),t[0]&&t[0].focus(),t.on("blur",i.stopEdit)}),i.deepEdit=!1,i.stopEdit=function(e){i.inputForm&&!i.inputForm.$valid?(e.stopPropagation(),i.$emit(c.events.CANCEL_CELL_EDIT)):i.$emit(c.events.END_CELL_EDIT),i.deepEdit=!1},t.on("click",function(e){"checkbox"!==t[0].type&&(i.deepEdit=!0,i.$applyAsync(function(){i.grid.disableScrolling=!0}))}),t.on("keydown",function(e){switch(e.keyCode){case d.keymap.ESC:e.stopPropagation(),i.$emit(c.events.CANCEL_CELL_EDIT)}if(!i.deepEdit||e.keyCode!==d.keymap.LEFT&&e.keyCode!==d.keymap.RIGHT&&e.keyCode!==d.keymap.UP&&e.keyCode!==d.keymap.DOWN)if(o&&o.grid.api.cellNav)e.uiGridTargetRenderContainerId=l.containerId,null!==o.cellNav.handleKeyDown(e)&&i.stopEdit(e);else switch(e.keyCode){case d.keymap.ENTER:case d.keymap.TAB:e.stopPropagation(),e.preventDefault(),i.stopEdit(e)}else e.stopPropagation();return!0}),i.$on("$destroy",function(){t.off()})}}}}}]),e.directive("uiGridEditor",["$filter",function(o){return{priority:-100,require:"?ngModel",link:function(e,i,t,n){2===angular.version.minor&&t.type&&"date"===t.type&&n&&(n.$formatters.push(function(e){return n.$setValidity(null,!e||!isNaN(e.getTime())),o("date")(e,"yyyy-MM-dd")}),n.$parsers.push(function(e){if(e&&0<e.length){var i=function(e){if(void 0===e||""===e)return null;var i=e.split("-");if(3!==i.length)return null;var t=parseInt(i[0],10),n=parseInt(i[1],10),o=parseInt(i[2],10);return n<1||t<1||o<1?null:new Date(t,n-1,o)}(e);return n.$setValidity(null,i&&!isNaN(i.getTime())),i}return n.$setValidity(null,!0),null}))}}}]),e.directive("uiGridEditDropdown",["uiGridConstants","uiGridEditConstants","$timeout",function(r,d,c){return{require:["?^uiGrid","?^uiGridRenderContainer"],scope:!0,compile:function(){return{pre:function(e,i,t){},post:function(i,e,t,n){var o=n[0],l=n[1];i.$on(d.events.BEGIN_CELL_EDIT,function(){c(function(){e[0].focus()}),e[0].style.width=e[0].parentElement.offsetWidth-1+"px",e.on("blur",function(e){i.stopEdit(e)})}),i.stopEdit=function(e){i.$emit(d.events.END_CELL_EDIT)},e.on("keydown",function(e){switch(e.keyCode){case r.keymap.ESC:e.stopPropagation(),i.$emit(d.events.CANCEL_CELL_EDIT)}if(o&&o.grid.api.cellNav)e.uiGridTargetRenderContainerId=l.containerId,null!==o.cellNav.handleKeyDown(e)&&i.stopEdit(e);else switch(e.keyCode){case r.keymap.ENTER:case r.keymap.TAB:e.stopPropagation(),e.preventDefault(),i.stopEdit(e)}return!0}),i.$on("$destroy",function(){e.off()})}}}}}]),e.directive("uiGridEditFileChooser",["gridUtil","uiGridConstants","uiGridEditConstants",function(l,e,r){return{scope:!0,require:["?^uiGrid","?^uiGridRenderContainer"],compile:function(){return{pre:function(e,i,t){},post:function(n,o){o[0].addEventListener("change",function e(i){var t=i.srcElement||i.target;t&&t.files&&0<t.files.length?("function"==typeof n.col.colDef.editFileChooserCallback?n.col.colDef.editFileChooserCallback(n.row,n.col,t.files):l.logError("You need to set colDef.editFileChooserCallback to use the file chooser"),t.form.reset(),n.$emit(r.events.END_CELL_EDIT)):n.$emit(r.events.CANCEL_CELL_EDIT),o[0].removeEventListener("change",e,!1)},!1),n.$on(r.events.BEGIN_CELL_EDIT,function(){o[0].focus(),o[0].select(),o.on("blur",function(){n.$emit(r.events.END_CELL_EDIT),o.off()})})}}}}}])}(),angular.module("ui.grid.edit").run(["$templateCache",function(e){"use strict";e.put("ui-grid/cellEditor",'<div><form name="inputForm"><input type="INPUT_TYPE" ng-class="\'colt\' + col.uid" ui-grid-editor ng-model="MODEL_COL_FIELD"></form></div>'),e.put("ui-grid/dropdownEditor",'<div><form name="inputForm"><select ng-class="\'colt\' + col.uid" ui-grid-edit-dropdown ng-model="MODEL_COL_FIELD" ng-options="field[editDropdownIdLabel] as field[editDropdownValueLabel] CUSTOM_FILTERS for field in editDropdownOptionsArray"></select></form></div>'),e.put("ui-grid/fileChooserEditor",'<div><form name="inputForm"><input ng-class="\'colt\' + col.uid" ui-grid-edit-file-chooser type="file" id="files" name="files[]" ng-model="MODEL_COL_FIELD"></form></div>')}]);
{
"name": "@ui-grid/edit",
"version": "4.8.5",
"version": "4.9.0",
"description": "This module provides cell editing capability to ui.grid",
"main": "index.js",
"dependencies": {
"@ui-grid/core": "^4.8.5",
"@ui-grid/core": "^4.9.0",
"angular": ">=1.4.0 1.8.x"

@@ -37,3 +37,3 @@ },

"license": "MIT",
"gitHead": "e4b26a0231bc66a35cf511f9721965ec13b0ac6e"
"gitHead": "e222d8f45f5c09fac13ef374d8c692f3b5163a40"
}

@@ -979,2 +979,5 @@ (function () {

if ($elm[0]) {
$elm[0].focus();
}
$elm.on('blur', $scope.stopEdit);

@@ -981,0 +984,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc