@mescius/wijmo.undo 5.20242.23-nightly.d20241008.t020138 → 5.20242.23-nightly.d20241009.t020146

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * Wijmo Library 5.20242.23-nightly.d20241008.t020138
3
+ * Wijmo Library 5.20242.23-nightly.d20241009.t020146
4
4
  * https://developer.mescius.com/wijmo
5
5
  *
6
6
  * Copyright(c) MESCIUS inc. All rights reserved.
@@ -11,4 +11,4 @@
11
11
  *
12
12
  */
13
13
 
14
- "use strict";var __importStar=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var i in t)Object.hasOwnProperty.call(t,i)&&(e[i]=t[i]);e.default=t;return e};Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@mescius/wijmo"),wijmo_grid_1=require("@mescius/wijmo.grid"),selfModule=__importStar(require("@mescius/wijmo.undo"));class UndoableAction{constructor(t){this._target=t}undo(){if(this._actions)for(var t=this._actions.length-1;t>=0;t--)this._actions[t].undo();this.applyState(this._oldState)}redo(){this.applyState(this._newState);this._actions&&this._actions.forEach(t=>{t.redo()})}close(){return!0}applyState(t){}shouldAddAsChildAction(t){return!1}addChildAction(t){this._actions||(this._actions=[]);this._actions.push(t)}get target(){return this._target}_focusScroll(){const t=this._target;if(t instanceof wijmo_1.Control){t.hostElement&&t.hostElement.scrollIntoView();t.focus()}else if(t instanceof HTMLElement){t.focus();wijmo_1.isFunction(t.select)&&t.select()}}}exports.UndoableAction=UndoableAction;class _UndoStackHTML{static addTarget(t,e){const i=_UndoStackHTML;if(e instanceof HTMLInputElement)return i._addInputElement(t,e);if(e instanceof HTMLTextAreaElement)return i._addTextAreaElement(t,e);if(e instanceof HTMLSelectElement)return i._addSelectElement(t,e);{let i=!1;for(let n=0;n<e.children.length;n++){let o=e.children[n];o instanceof HTMLElement&&t.addTarget(o)&&(i=!0)}return i}}static _addInputElement(t,e){let i=null;if("checkbox"==e.type)e.addEventListener("click",e=>{t.pushAction(new CheckboxClickAction(e))});else{if("radio"==e.type){e.addEventListener("mousedown",t=>{i=new RadioClickAction(t)},!0);let n=_UndoStackHTML._getLabel(e);n&&n.addEventListener("mousedown",t=>{i=new RadioClickAction({target:e})},!0);e.addEventListener("focus",t=>{i instanceof RadioClickAction&&i.target==t.target||(i=new RadioClickAction(t))});e.addEventListener("click",e=>{if(i instanceof RadioClickAction){t.pushAction(i);i=null}});return!0}if("range"==e.type){e.addEventListener("mousedown",t=>{let n=wijmo_1.getActiveElement();n instanceof HTMLElement&&n!=e&&n.blur();i=new InputChangeAction(t)});e.addEventListener("mouseup",n=>{if(i instanceof InputChangeAction&&wijmo_1.getActiveElement()!=e){i._focus=!1;t.pushAction(i);i=null}})}e.addEventListener("focus",t=>{null==i&&(i=new InputChangeAction(t))});e.addEventListener("blur",e=>{if(i instanceof InputChangeAction){t.pushAction(i);i=null}})}return!0}static _addTextAreaElement(t,e){let i=null;e.addEventListener("focus",t=>{i=new InputChangeAction(t)});e.addEventListener("blur",e=>{if(i instanceof InputChangeAction){t.pushAction(i);i=null}});return!0}static _addSelectElement(t,e){let i=null;e.addEventListener("focus",t=>{i=new InputChangeAction(t)});e.addEventListener("blur",e=>{if(i instanceof InputChangeAction){t.pushAction(i);i=null}});return!0}static _getLabel(t){let e=t.parentElement;e instanceof HTMLLabelElement||(e=document.querySelector('label[for="'+t.id+'"'));return e}}exports._UndoStackHTML=_UndoStackHTML;class InputChangeAction extends UndoableAction{constructor(t){super(t.target);this._focus=!0;this._oldState=this._target.value}close(){this._newState=this._target.value;return this._newState!=this._oldState}applyState(t){let e=this._target;e.value=t;e.dispatchEvent(UndoStack._evtInput);this._focus&&this._focusScroll()}}exports.InputChangeAction=InputChangeAction;class CheckboxClickAction extends UndoableAction{constructor(t){super(t.target);wijmo_1.assert("checkbox"==this._target.type,"checkbox expected");this._newState=this._target.checked;this._oldState=!this._newState}applyState(t){this._target.checked=t;this._target.focus()}}exports.CheckboxClickAction=CheckboxClickAction;class RadioClickAction extends UndoableAction{constructor(t){super(t.target);let e=this._target.type;wijmo_1.assert("radio"==e,"radio button expected");this._oldState=this._getState()}close(){this._newState=this._getState();return this._newState!=this._oldState}applyState(t){if(t){t.checked=!0;t.focus()}}_getState(){let t='input[name="'+this._target.name+'"]',e=document.querySelectorAll(t);for(let t=0;t<e.length;t++)if(e[t].checked)return e[t];return null}}exports.RadioClickAction=RadioClickAction;class UndoStack{constructor(t,e){this._autoKbd=!0;this._stack=[];this._maxActions=1e3;this._ptr=0;this.addingTarget=new wijmo_1.Event;this.addedTarget=new wijmo_1.Event;this.addingAction=new wijmo_1.Event;this.addedAction=new wijmo_1.Event;this.undoingAction=new wijmo_1.Event;this.undoneAction=new wijmo_1.Event;this.redoingAction=new wijmo_1.Event;this.redoneAction=new wijmo_1.Event;this.stateChanged=new wijmo_1.Event;if(!UndoStack._evtInput){let t=document.createEvent("HTMLEvents");t.initEvent("input",!0,!1);UndoStack._evtInput=t}wijmo_1.copy(this,e);t=wijmo_1.getElement(t||document.body);this.addTarget(t);document.addEventListener("keydown",e=>{var i=navigator.platform.toUpperCase().indexOf("MAC")>=0?e.metaKey:e.ctrlKey;if(this._autoKbd&&i&&!e.defaultPrevented&&wijmo_1.contains(t,e.target))if(e.shiftKey&&90===e.keyCode){if(this.canRedo){wijmo_1.getActiveElement().blur();setTimeout(()=>this.redo(),100)}e.preventDefault()}else switch(e.keyCode){case 90:if(this.canUndo){wijmo_1.getActiveElement().blur();setTimeout(()=>this.undo(),100)}e.preventDefault();break;case 89:if(this.canRedo){wijmo_1.getActiveElement().blur();setTimeout(()=>this.redo(),100)}e.preventDefault()}},wijmo_1.getEventOptions(!0,!1))}addTarget(t){let e=!1;if(wijmo_1.isString(t)){let e=document.querySelectorAll(t),i=!1;for(let t=0;t<e.length;t++)this.addTarget(e[t])&&(i=!0);return i}wijmo_1.assert(t instanceof HTMLElement,"Undo target should be an HTML element");let i=new AddTargetEventArgs(t);i.cancel=wijmo_1.hasClass(t,"wj-no-undo");if(this.onAddingTarget(i)){let n=wijmo_1.Control.getControl(t);n&&(e=_UndoStackWijmo.addTarget(this,n));e||(e=_UndoStackHTML.addTarget(this,t));e&&this.onAddedTarget(i)}return e}get autoKeyboard(){return this._autoKbd}set autoKeyboard(t){this._autoKbd=wijmo_1.asBoolean(t)}get isDisabled(){return this._disabled}set isDisabled(t){this._disabled=wijmo_1.asBoolean(t)}get maxActions(){return this._maxActions}set maxActions(t){if(t!=this._maxActions){this._maxActions=wijmo_1.asNumber(t,!1,!0);this.clear()}}get actionCount(){return this._stack.length}get canUndo(){return this._stack.length>0&&this._ptr>0&&!this._disabled}get canRedo(){return this._stack.length>0&&this._ptr<this._stack.length&&!this._disabled}undo(){if(this.canUndo){let t=this._stack[this._ptr-1],e=new UndoActionEventArgs(t);if(this.onUndoingAction(e)){this._ptr--;this._undoing=!0;t.undo();this._undoing=!1;this._pendingAction=null;this.onUndoneAction(e);this.onStateChanged()}}}redo(){if(this.canRedo){let t=this._stack[this._ptr],e=new UndoActionEventArgs(t);if(this.onRedoingAction(e)){this._ptr++;this._undoing=!0;t.redo();this._undoing=!1;this._pendingAction=null;this.onRedoneAction(e);this.onStateChanged()}}}clear(){this._ptr=0;this._stack.splice(0,this._stack.length);this.onStateChanged()}pushAction(t){this._pendingAction=t;this.pushPendingAction()}onAddingTarget(t){this.addingTarget.raise(this,t);return!t.cancel}onAddedTarget(t){this.addedTarget.raise(this,t)}onAddingAction(t){this.addingAction.raise(this,t);return!t.cancel}onAddedAction(t){this.addedAction.raise(this,t)}onUndoingAction(t){this.undoingAction.raise(this,t);return!t.cancel}onUndoneAction(t){this.undoneAction.raise(this,t)}onRedoingAction(t){this.redoingAction.raise(this,t);return!t.cancel}onRedoneAction(t){this.redoneAction.raise(this,t)}onStateChanged(){this.stateChanged.raise(this,wijmo_1.EventArgs.empty)}pushPendingAction(){if(!this._disabled&&!this._undoing&&this._pendingAction&&this._pendingAction.close()){this._stack.splice(this._ptr,this._stack.length-this._ptr);wijmo_1.assert(this._stack.length==this._ptr,"should be at the end of the stack");if(this._stack.length){let t=this._stack[this._ptr-1];if(t.shouldAddAsChildAction(this._pendingAction)){t.addChildAction(this._pendingAction);this._pendingAction=null;this.onStateChanged();return}}let t=new UndoActionEventArgs(this._pendingAction);if(!this.onAddingAction(t))return;this._stack.push(this._pendingAction);this._ptr++;this._pendingAction=null;let e=this._stack.length-this._maxActions;if(e>0){this._stack.splice(0,e);this._ptr-=e;wijmo_1.assert(this._ptr>=0,"pointer should not be negative")}this.onStateChanged()}}}exports.UndoStack=UndoStack;class AddTargetEventArgs extends wijmo_1.CancelEventArgs{constructor(t){super();this._target=t}get target(){return this._target}}exports.AddTargetEventArgs=AddTargetEventArgs;class UndoActionEventArgs extends wijmo_1.CancelEventArgs{constructor(t){super();this._action=t}get action(){return this._action}}exports.UndoActionEventArgs=UndoActionEventArgs;function softInput(){return wijmo_1._getModule("wijmo.input")}exports.softInput=softInput;function softGrid(){return wijmo_1._getModule("wijmo.grid")}exports.softGrid=softGrid;function softGauge(){return wijmo_1._getModule("wijmo.gauge")}exports.softGauge=softGauge;function softNav(){return wijmo_1._getModule("wijmo.nav")}exports.softNav=softNav;class _UndoStackWijmo{static addTarget(t,e){const i=_UndoStackWijmo;return softGrid()&&e instanceof softGrid().FlexGrid?i._addFlexGrid(t,e):softGauge()&&e instanceof softGauge().Gauge?i._addGauge(t,e):softNav()&&e instanceof softNav().TreeView?i._addTreeView(t,e):!!i._isInputControl(e)&&i._addInputControl(t,e)}static _isInputControl(t){const e=softInput();return!!e&&(t instanceof e.DropDown||t instanceof e.InputMask||t instanceof e.InputNumber||t instanceof e.Calendar||t instanceof e.ColorPicker)}static _addInputControl(t,e){let i=null;e.gotFocus.addHandler(()=>{i=new InputControlChangeAction({target:e})});e.lostFocus.addHandler(()=>{if(i instanceof InputControlChangeAction){t.pushAction(i);i=null}});return!0}static _addGauge(t,e){if(!e.isReadOnly){let i=null;e.hostElement.addEventListener("focus",()=>{i||(i=new GaugeChangeAction(e))});e.lostFocus.addHandler(()=>{if(i instanceof GaugeChangeAction){t.pushAction(i);i=null}});return!0}return!1}static _addTreeView(t,e){let i=null;e.nodeEditStarted.addHandler((t,e)=>{i=new TreeViewEditAction(t,e)});e.nodeEditEnded.addHandler((e,n)=>{if(i instanceof TreeViewEditAction){t.pushAction(i);i=null}});e.isCheckedChanging.addHandler((t,e)=>{i=new TreeViewCheckAction(t,e)});e.isCheckedChanged.addHandler((e,n)=>{if(i instanceof TreeViewCheckAction){t.pushAction(i);i=null}});return!0}static _addFlexGrid(t,e){let i=null;e.beginningEdit.addHandler((t,e)=>{i=e.getRow()instanceof wijmo_grid_1._NewRowTemplate?null:new GridEditAction(t,e)});e.cellEditEnded.addHandler((e,n)=>{if(i instanceof GridEditAction){t.pushAction(i);i=null}});e.pastingCell.addHandler((t,e)=>{i=e.getRow()?new GridEditAction(t,e):null});e.pastedCell.addHandler((e,n)=>{if(i instanceof GridEditAction){t.pushAction(i);i=null}});e.sortingColumn.addHandler((t,e)=>{i=new GridSortAction(t,e)});e.sortedColumn.addHandler((e,n)=>{if(i instanceof GridSortAction){t.pushAction(i);i=null}});e.resizingColumn.addHandler((t,e)=>{i instanceof GridResizeAction||(i=new GridResizeAction(t,e))});e.resizedColumn.addHandler(()=>{if(i instanceof GridResizeAction){t.pushAction(i);i=null}});e.autoSizingColumn.addHandler((t,e)=>{i=new GridResizeAction(t,e)});e.autoSizedColumn.addHandler(()=>{if(i instanceof GridResizeAction){t.pushAction(i);i=null}});e.draggingColumn.addHandler((t,e)=>{i=new GridDragAction(t,e)});e.draggedColumn.addHandler((e,n)=>{if(i instanceof GridDragAction){t.pushAction(i);i=null}});e.rowAdded.addHandler((e,i)=>{i.cancel||t.pushAction(new GridAddRowAction(e,i))});e.deletingRow.addHandler((e,i)=>{i.cancel||t.pushAction(new GridRemoveRowAction(e,i))});e.columnGroupCollapsedChanging.addHandler((t,e)=>{i=new ExpandCollapseColumnGroupAction(t,e)});e.columnGroupCollapsedChanged.addHandler((e,n)=>{if(i instanceof ExpandCollapseColumnGroupAction){t.pushAction(i);i=null}});return!0}}exports._UndoStackWijmo=_UndoStackWijmo;class InputControlChangeAction extends InputChangeAction{constructor(t){super(t);this._ctl=t.target;this._oldState=this._getControlState()}get control(){return this._ctl}close(){this._timeStamp=Date.now();this._newState=this._getControlState();return!this._sameContent(this._oldState,this._newState)}shouldAddAsChildAction(t){if(t instanceof InputControlChangeAction&&t.target==this.target&&t._timeStamp-this._timeStamp<500){this._timeStamp=Date.now();return!0}return!1}applyState(t){let e=this._ctl,i=softInput();if(i){let n=e instanceof i.Calendar||e instanceof i.InputDate;n&&e.selectionMode!=i.DateSelectionMode.Range&&(n=!1);if(e instanceof i.MultiSelect)e.checkedItems=t;else if(e instanceof i.MultiAutoComplete)e.selectedItems=t;else if(n){e.value=t[0];e.rangeEnd=t[1]}else"value"in e?e.value=t:"text"in e?e.text=t:wijmo_1.assert(!1,"can't apply control state?");e.focus()}}_getControlState(){let t=this._ctl,e=softInput();if(e){let i=t instanceof e.Calendar||t instanceof e.InputDate;i&&t.selectionMode!=e.DateSelectionMode.Range&&(i=!1);if(t instanceof e.MultiSelect)return t.checkedItems.slice();if(t instanceof e.MultiAutoComplete)return t.selectedItems.slice();if(i)return[t.value,t.rangeEnd];if("value"in t)return t.value;if("text"in t)return t.text;wijmo_1.assert(!1,"can't get control state?")}}_sameContent(t,e){if(wijmo_1.isArray(t)&&wijmo_1.isArray(e)){if(t.length!=e.length)return!1;for(let i=0;i<t.length;i++)if(t[i]!=e[i])return!1;return!0}return wijmo_1.isDate(t)||wijmo_1.isDate(e)?wijmo_1.DateTime.sameDate(t,e):t==e}}class GaugeChangeAction extends UndoableAction{constructor(t){super(t);this._oldState=t.value}get control(){return this._target}close(){this._newState=this._target.value;return this._newState!=this._oldState}applyState(t){let e=this._target;e.value=t;e.focus()}}class GridEditAction extends UndoableAction{constructor(t,e){super(t);this._dataItems=[];let i=t.collectionView,n=this._rng=e.range;for(let e=n.topRow;e<=n.bottomRow;e++)this._dataItems.push(t.rows[e].dataItem);this._page=i instanceof wijmo_1.CollectionView?i.pageIndex:-1;this._oldState=t.getCellData(e.row,e.col,!1)}get control(){return this._target}get range(){return this._rng.clone()}get row(){return this._rng.topRow}get col(){return this._rng.leftCol}get dataItem(){return this._dataItems[0]}get dataItems(){return this._dataItems}close(){let t=this._target.collectionView;if(t&&t.currentAddItem)return!1;this._timeStamp=Date.now();this._newState=this._target.getCellData(this.row,this.col,!1);return this._newState!=this._oldState}applyState(t){let e=this._target,i=e.editableCollectionView;if(i){i instanceof wijmo_1.CollectionView&&this._page>-1&&i.moveToPage(this._page);e.deferUpdate(()=>{this._dataItems.forEach(n=>{i.editItem(n);for(let i=this._rng.leftCol;i<=this._rng.rightCol;i++){let o=e.columns[i],s=e._getBindingColumn(e.cells,this.row,o);s&&s._binding&&s._binding.setValue(n,t)}i.commitEdit()})})}e.select(this.row,this.col);this._focusScroll()}shouldAddAsChildAction(t){return t instanceof GridEditAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100}}class GridSortAction extends UndoableAction{constructor(t,e){super(t);let i=this._target.collectionView;i&&(this._oldState=i.sortDescriptions.slice())}get control(){return this._target}close(){let t=this._target.collectionView;if(t){this._newState=t.sortDescriptions.slice();return!0}return!1}applyState(t){let e=this._target.collectionView;e&&e.deferUpdate(()=>{let i=e.sortDescriptions;i.clear();t.forEach(t=>{i.push(t)})});this._focusScroll()}}class GridResizeAction extends UndoableAction{constructor(t,e){super(t);this._col=t.columns[e.col];this._oldState=this._col.renderWidth}get control(){return this._target}get col(){return this._col}close(){this._timeStamp=Date.now();this._newState=this._col.renderWidth;return this._newState!=this._oldState}applyState(t){this._col.width=t;this._focusScroll()}shouldAddAsChildAction(t){return t instanceof GridResizeAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100}}class GridDragAction extends UndoableAction{constructor(t,e){super(t);this._col=e.getColumn(!0);this._oldState=this._getState(this._col)}get control(){return this._target}get col(){return this._col}close(){this._newState=this._getState(this._col);return!this._areStatesEqual(this._newState,this._oldState)}applyState(t){const e=this._col;e.grid.deferUpdate(()=>{const i=this._getState(e);i.coll.splice(i.idx,1);t.coll.splice(t.idx,0,e)});this._focusScroll()}_getState(t){const e=t instanceof wijmo_grid_1.ColumnGroup?t.parentGroup?t.parentGroup.columns:this.target.getColumnGroups():t.grid.columns;return{coll:e,idx:e.indexOf(t)}}_areStatesEqual(t,e){return t.coll===e.coll&&t.idx===e.idx}}class GridAddRowAction extends UndoableAction{constructor(t,e){super(t);let i=this._target.collectionView;if(i&&i.currentAddItem){let t=i.currentAddItem,e=i.sourceCollection.indexOf(t),n=i.currentPosition;this._oldState={item:t,index:e,position:n};this._newState={index:e,position:n}}}get control(){return this._target}close(){return null!=this._oldState}applyState(t){let e=this._target.collectionView;if(e){let i=e.sourceCollection;if(t.item){i.splice(t.index,1);if(e instanceof wijmo_1.CollectionView&&e.trackChanges){let i=t.item;wijmo_1.assert(e.itemsAdded.indexOf(i)>-1,"item should be in the itemsAdded list");e.itemsAdded.remove(i)}}else{let n=this._oldState.item;i.splice(t.index,0,n);if(e instanceof wijmo_1.CollectionView&&e.trackChanges){wijmo_1.assert(e.itemsAdded.indexOf(n)<0,"item should not be in the itemsAdded list");e.itemsAdded.push(n)}}e.refresh();e.moveCurrentToPosition(t.position);this._focusScroll()}}}class GridRemoveRowAction extends UndoableAction{constructor(t,e){super(t);this._edtIndex=-1;let i=this._target.collectionView;if(i){let n=t.rows[e.row].dataItem,o=i.sourceCollection.indexOf(n),s=i.currentPosition;i instanceof wijmo_1.CollectionView&&i.trackChanges&&(this._edtIndex=i.itemsEdited.indexOf(n));this._oldState={item:n,index:o,position:s};this._newState={index:o,position:s}}}get control(){return this._target}get dataItem(){return this._oldState.item}close(){this._timeStamp=Date.now();return null!=this._oldState}applyState(t){let e=this._target,i=e.collectionView;if(i){let n=i.sourceCollection;if(t.item){n.splice(t.index,0,t.item);if(i instanceof wijmo_1.CollectionView&&i.trackChanges){let e=t.item;wijmo_1.assert(i.itemsRemoved.indexOf(e)>-1,"item should be in the itemsRemoved list");i.itemsRemoved.remove(e);this._edtIndex>-1&&i.itemsEdited.indexOf(e)<0&&i.itemsEdited.push(e)}}else{n.splice(t.index,1);if(i instanceof wijmo_1.CollectionView&&i.trackChanges){let t=this._oldState.item;wijmo_1.assert(i.itemsRemoved.indexOf(t)<0,"item should not be in the itemsRemoved list");i.itemsRemoved.push(t)}}i.refresh();i.moveCurrentToPosition(t.position);let o=new(softGrid().CellRange)(t.position,0,t.position,e.columns.length-1);e.select(o);this._focusScroll()}}shouldAddAsChildAction(t){return t instanceof GridRemoveRowAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100}}class ExpandCollapseColumnGroupAction extends UndoableAction{constructor(t,e){super(t);this._group=e.data;this._oldState=this._group.isCollapsed}get control(){return this._target}get group(){return this._group}close(){this._newState=this._group.isCollapsed;return this._newState!=this._oldState}applyState(t){this._group.isCollapsed=t;this._focusScroll()}}class TreeViewEditAction extends UndoableAction{constructor(t,e){super(t);this._nd=e.node;this._oldState=this._getNodeText()}get control(){return this._target}get node(){return this._nd}close(){this._newState=this._getNodeText();return this._newState!=this._oldState}applyState(t){this._nd.select();this._setNodeText(t);this._target.focus()}_getNodeText(){let t=this._nd.dataItem[this._getDisplayMemberPath()];return null!=t?t.toString():""}_setNodeText(t){let e=this._nd,i=e.dataItem,n=this._getDisplayMemberPath(),o=e.element.querySelector(".wj-node-text");i[n]=t;e.treeView.isContentHtml?o.innerHTML=t:o.textContent=t}_getDisplayMemberPath(){let t=this._nd,e=t.treeView.displayMemberPath;e instanceof Array&&(e=e[t.level]);return e}}class TreeViewCheckAction extends UndoableAction{constructor(t,e){super(t);this._nd=e.node;this._oldState=this._nd.isChecked}get control(){return this._target}get node(){return this._nd}close(){this._newState=this._nd.isChecked;return this._newState!=this._oldState}applyState(t){this._nd.select();this._nd.isChecked=t;this._target.focus()}}wijmo_1._registerModule("wijmo.undo",selfModule);
14
+ "use strict";var __importStar=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);e.default=t;return e};Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_1=require("@mescius/wijmo"),wijmo_grid_1=require("@mescius/wijmo.grid"),wijmo_nav_1=require("@mescius/wijmo.nav"),selfModule=__importStar(require("@mescius/wijmo.undo"));class UndoableAction{constructor(t){this._target=t}undo(){if(this._actions)for(var t=this._actions.length-1;t>=0;t--)this._actions[t].undo();this.applyState(this._oldState)}redo(){this.applyState(this._newState);this._actions&&this._actions.forEach(t=>{t.redo()})}close(){return!0}applyState(t){}shouldAddAsChildAction(t){return!1}addChildAction(t){this._actions||(this._actions=[]);this._actions.push(t)}get target(){return this._target}_focusScroll(){const t=this._target;if(t instanceof wijmo_1.Control){t.hostElement&&t.hostElement.scrollIntoView();t.focus()}else if(t instanceof HTMLElement){t.focus();wijmo_1.isFunction(t.select)&&t.select()}}}exports.UndoableAction=UndoableAction;class _UndoStackHTML{static addTarget(t,e){const n=_UndoStackHTML;if(e instanceof HTMLInputElement)return n._addInputElement(t,e);if(e instanceof HTMLTextAreaElement)return n._addTextAreaElement(t,e);if(e instanceof HTMLSelectElement)return n._addSelectElement(t,e);{let n=!1;for(let i=0;i<e.children.length;i++){let o=e.children[i];o instanceof HTMLElement&&t.addTarget(o)&&(n=!0)}return n}}static _addInputElement(t,e){let n=null;if("checkbox"==e.type)e.addEventListener("click",e=>{t.pushAction(new CheckboxClickAction(e))});else{if("radio"==e.type){e.addEventListener("mousedown",t=>{n=new RadioClickAction(t)},!0);let i=_UndoStackHTML._getLabel(e);i&&i.addEventListener("mousedown",t=>{n=new RadioClickAction({target:e})},!0);e.addEventListener("focus",t=>{n instanceof RadioClickAction&&n.target==t.target||(n=new RadioClickAction(t))});e.addEventListener("click",e=>{if(n instanceof RadioClickAction){t.pushAction(n);n=null}});return!0}if("range"==e.type){e.addEventListener("mousedown",t=>{let i=wijmo_1.getActiveElement();i instanceof HTMLElement&&i!=e&&i.blur();n=new InputChangeAction(t)});e.addEventListener("mouseup",i=>{if(n instanceof InputChangeAction&&wijmo_1.getActiveElement()!=e){n._focus=!1;t.pushAction(n);n=null}})}e.addEventListener("focus",t=>{null==n&&(n=new InputChangeAction(t))});e.addEventListener("blur",e=>{if(n instanceof InputChangeAction){t.pushAction(n);n=null}})}return!0}static _addTextAreaElement(t,e){let n=null;e.addEventListener("focus",t=>{n=new InputChangeAction(t)});e.addEventListener("blur",e=>{if(n instanceof InputChangeAction){t.pushAction(n);n=null}});return!0}static _addSelectElement(t,e){let n=null;e.addEventListener("focus",t=>{n=new InputChangeAction(t)});e.addEventListener("blur",e=>{if(n instanceof InputChangeAction){t.pushAction(n);n=null}});return!0}static _getLabel(t){let e=t.parentElement;e instanceof HTMLLabelElement||(e=document.querySelector('label[for="'+t.id+'"'));return e}}exports._UndoStackHTML=_UndoStackHTML;class InputChangeAction extends UndoableAction{constructor(t){super(t.target);this._focus=!0;this._oldState=this._target.value}close(){this._newState=this._target.value;return this._newState!=this._oldState}applyState(t){let e=this._target;e.value=t;e.dispatchEvent(UndoStack._evtInput);this._focus&&this._focusScroll()}}exports.InputChangeAction=InputChangeAction;class CheckboxClickAction extends UndoableAction{constructor(t){super(t.target);wijmo_1.assert("checkbox"==this._target.type,"checkbox expected");this._newState=this._target.checked;this._oldState=!this._newState}applyState(t){this._target.checked=t;this._target.focus()}}exports.CheckboxClickAction=CheckboxClickAction;class RadioClickAction extends UndoableAction{constructor(t){super(t.target);let e=this._target.type;wijmo_1.assert("radio"==e,"radio button expected");this._oldState=this._getState()}close(){this._newState=this._getState();return this._newState!=this._oldState}applyState(t){if(t){t.checked=!0;t.focus()}}_getState(){let t='input[name="'+this._target.name+'"]',e=document.querySelectorAll(t);for(let t=0;t<e.length;t++)if(e[t].checked)return e[t];return null}}exports.RadioClickAction=RadioClickAction;exports.UndoClsNames={noUndo:"wj-no-undo"};class UndoStack{constructor(t,e){this._autoKbd=!0;this._stack=[];this._maxActions=1e3;this._ptr=0;this.addingTarget=new wijmo_1.Event;this.addedTarget=new wijmo_1.Event;this.addingAction=new wijmo_1.Event;this.addedAction=new wijmo_1.Event;this.undoingAction=new wijmo_1.Event;this.undoneAction=new wijmo_1.Event;this.redoingAction=new wijmo_1.Event;this.redoneAction=new wijmo_1.Event;this.stateChanged=new wijmo_1.Event;if(!UndoStack._evtInput){let t=document.createEvent("HTMLEvents");t.initEvent("input",!0,!1);UndoStack._evtInput=t}wijmo_1.copy(this,e);t=wijmo_1.getElement(t||document.body);this.addTarget(t);document.addEventListener("keydown",e=>{var n=navigator.platform.toUpperCase().indexOf("MAC")>=0?e.metaKey:e.ctrlKey;if(this._autoKbd&&n&&!e.defaultPrevented&&wijmo_1.contains(t,e.target))if(e.shiftKey&&90===e.keyCode){if(this.canRedo){wijmo_1.getActiveElement().blur();setTimeout(()=>this.redo(),100)}e.preventDefault()}else switch(e.keyCode){case 90:if(this.canUndo){wijmo_1.getActiveElement().blur();setTimeout(()=>this.undo(),100)}e.preventDefault();break;case 89:if(this.canRedo){wijmo_1.getActiveElement().blur();setTimeout(()=>this.redo(),100)}e.preventDefault()}},wijmo_1.getEventOptions(!0,!1))}addTarget(t){let e=!1;if(wijmo_1.isString(t)){let e=document.querySelectorAll(t),n=!1;for(let t=0;t<e.length;t++)this.addTarget(e[t])&&(n=!0);return n}wijmo_1.assert(t instanceof HTMLElement,"Undo target should be an HTML element");let n=new AddTargetEventArgs(t);n.cancel=wijmo_1.hasClass(t,exports.UndoClsNames.noUndo);if(this.onAddingTarget(n)){let i=wijmo_1.Control.getControl(t);i&&(e=_UndoStackWijmo.addTarget(this,i));e||(e=_UndoStackHTML.addTarget(this,t));e&&this.onAddedTarget(n)}return e}get autoKeyboard(){return this._autoKbd}set autoKeyboard(t){this._autoKbd=wijmo_1.asBoolean(t)}get isDisabled(){return this._disabled}set isDisabled(t){this._disabled=wijmo_1.asBoolean(t)}get maxActions(){return this._maxActions}set maxActions(t){if(t!=this._maxActions){this._maxActions=wijmo_1.asNumber(t,!1,!0);this.clear()}}get actionCount(){return this._stack.length}get canUndo(){return this._stack.length>0&&this._ptr>0&&!this._disabled}get canRedo(){return this._stack.length>0&&this._ptr<this._stack.length&&!this._disabled}undo(){if(this.canUndo){let t=this._stack[this._ptr-1],e=new UndoActionEventArgs(t);if(this.onUndoingAction(e)){this._ptr--;this._undoing=!0;t.undo();this._undoing=!1;this._pendingAction=null;this.onUndoneAction(e);this.onStateChanged()}}}redo(){if(this.canRedo){let t=this._stack[this._ptr],e=new UndoActionEventArgs(t);if(this.onRedoingAction(e)){this._ptr++;this._undoing=!0;t.redo();this._undoing=!1;this._pendingAction=null;this.onRedoneAction(e);this.onStateChanged()}}}clear(){this._ptr=0;this._stack.splice(0,this._stack.length);this.onStateChanged()}pushAction(t){this._pendingAction=t;this.pushPendingAction()}onAddingTarget(t){this.addingTarget.raise(this,t);return!t.cancel}onAddedTarget(t){this.addedTarget.raise(this,t)}onAddingAction(t){this.addingAction.raise(this,t);return!t.cancel}onAddedAction(t){this.addedAction.raise(this,t)}onUndoingAction(t){this.undoingAction.raise(this,t);return!t.cancel}onUndoneAction(t){this.undoneAction.raise(this,t)}onRedoingAction(t){this.redoingAction.raise(this,t);return!t.cancel}onRedoneAction(t){this.redoneAction.raise(this,t)}onStateChanged(){this.stateChanged.raise(this,wijmo_1.EventArgs.empty)}pushPendingAction(){if(!this._disabled&&!this._undoing&&this._pendingAction&&this._pendingAction.close()){this._stack.splice(this._ptr,this._stack.length-this._ptr);wijmo_1.assert(this._stack.length==this._ptr,"should be at the end of the stack");if(this._stack.length){let t=this._stack[this._ptr-1];if(t.shouldAddAsChildAction(this._pendingAction)){t.addChildAction(this._pendingAction);this._pendingAction=null;this.onStateChanged();return}}let t=new UndoActionEventArgs(this._pendingAction);if(!this.onAddingAction(t))return;this._stack.push(this._pendingAction);this._ptr++;this._pendingAction=null;let e=this._stack.length-this._maxActions;if(e>0){this._stack.splice(0,e);this._ptr-=e;wijmo_1.assert(this._ptr>=0,"pointer should not be negative")}this.onStateChanged()}}}exports.UndoStack=UndoStack;class AddTargetEventArgs extends wijmo_1.CancelEventArgs{constructor(t){super();this._target=t}get target(){return this._target}}exports.AddTargetEventArgs=AddTargetEventArgs;class UndoActionEventArgs extends wijmo_1.CancelEventArgs{constructor(t){super();this._action=t}get action(){return this._action}}exports.UndoActionEventArgs=UndoActionEventArgs;function softInput(){return wijmo_1._getModule("wijmo.input")}exports.softInput=softInput;function softGrid(){return wijmo_1._getModule("wijmo.grid")}exports.softGrid=softGrid;function softGauge(){return wijmo_1._getModule("wijmo.gauge")}exports.softGauge=softGauge;function softNav(){return wijmo_1._getModule("wijmo.nav")}exports.softNav=softNav;class _UndoStackWijmo{static addTarget(t,e){const n=_UndoStackWijmo;return softGrid()&&e instanceof softGrid().FlexGrid?n._addFlexGrid(t,e):softGauge()&&e instanceof softGauge().Gauge?n._addGauge(t,e):softNav()&&e instanceof softNav().TreeView?n._addTreeView(t,e):!!n._isInputControl(e)&&n._addInputControl(t,e)}static _isInputControl(t){const e=softInput();return!!e&&(t instanceof e.DropDown||t instanceof e.InputMask||t instanceof e.InputNumber||t instanceof e.Calendar||t instanceof e.ColorPicker)}static _addInputControl(t,e){let n=null;e.gotFocus.addHandler(()=>{n=new InputControlChangeAction({target:e})});e.lostFocus.addHandler(()=>{if(n instanceof InputControlChangeAction){t.pushAction(n);n=null}});return!0}static _addGauge(t,e){if(!e.isReadOnly){let n=null;e.hostElement.addEventListener("focus",()=>{n||(n=new GaugeChangeAction(e))});e.lostFocus.addHandler(()=>{if(n instanceof GaugeChangeAction){t.pushAction(n);n=null}});return!0}return!1}static _addTreeView(t,e){let n=null;e.nodeEditStarted.addHandler((t,e)=>{n=new TreeViewEditAction(t,e)});e.nodeEditEnded.addHandler((e,i)=>{if(n instanceof TreeViewEditAction){t.pushAction(n);n=null}});e.isCheckedChanging.addHandler((t,e)=>{n=new TreeViewCheckAction(t,e)});e.isCheckedChanged.addHandler((e,i)=>{if(n instanceof TreeViewCheckAction){t.pushAction(n);n=null}});return!0}static _addFlexGrid(t,e){let n=null;e.beginningEdit.addHandler((t,e)=>{n=e.getRow()instanceof wijmo_grid_1._NewRowTemplate?null:new GridEditAction(t,e)});e.cellEditEnded.addHandler((e,i)=>{if(n instanceof GridEditAction){t.pushAction(n);n=null}});e.pastingCell.addHandler((t,e)=>{n=e.getRow()?new GridEditAction(t,e):null});e.pastedCell.addHandler((e,i)=>{if(n instanceof GridEditAction){t.pushAction(n);n=null}});e.sortingColumn.addHandler((t,e)=>{n=new GridSortAction(t,e)});e.sortedColumn.addHandler((e,i)=>{if(n instanceof GridSortAction){t.pushAction(n);n=null}});e.resizingColumn.addHandler((t,e)=>{n instanceof GridResizeAction||(n=new GridResizeAction(t,e))});e.resizedColumn.addHandler(()=>{if(n instanceof GridResizeAction){t.pushAction(n);n=null}});e.autoSizingColumn.addHandler((t,e)=>{n=new GridResizeAction(t,e)});e.autoSizedColumn.addHandler(()=>{if(n instanceof GridResizeAction){t.pushAction(n);n=null}});e.draggingColumn.addHandler((t,e)=>{n=new GridDragAction(t,e)});e.draggedColumn.addHandler((e,i)=>{if(n instanceof GridDragAction){t.pushAction(n);n=null}});e.rowAdded.addHandler((e,n)=>{n.cancel||t.pushAction(new GridAddRowAction(e,n))});e.deletingRow.addHandler((e,n)=>{n.cancel||t.pushAction(new GridRemoveRowAction(e,n))});e.columnGroupCollapsedChanging.addHandler((t,e)=>{n=new ExpandCollapseColumnGroupAction(t,e)});e.columnGroupCollapsedChanged.addHandler((e,i)=>{if(n instanceof ExpandCollapseColumnGroupAction){t.pushAction(n);n=null}});return!0}}exports._UndoStackWijmo=_UndoStackWijmo;class InputControlChangeAction extends InputChangeAction{constructor(t){super(t);this._ctl=t.target;this._oldState=this._getControlState()}get control(){return this._ctl}close(){this._timeStamp=Date.now();this._newState=this._getControlState();return!this._sameContent(this._oldState,this._newState)}shouldAddAsChildAction(t){if(t instanceof InputControlChangeAction&&t.target==this.target&&t._timeStamp-this._timeStamp<500){this._timeStamp=Date.now();return!0}return!1}applyState(t){let e=this._ctl,n=softInput();if(n){let i=e instanceof n.Calendar||e instanceof n.InputDate;i&&e.selectionMode!=n.DateSelectionMode.Range&&(i=!1);if(e instanceof n.MultiSelect)e.checkedItems=t;else if(e instanceof n.MultiAutoComplete)e.selectedItems=t;else if(i){e.value=t[0];e.rangeEnd=t[1]}else"value"in e?e.value=t:"text"in e?e.text=t:wijmo_1.assert(!1,"can't apply control state?");e.focus()}}_getControlState(){let t=this._ctl,e=softInput();if(e){let n=t instanceof e.Calendar||t instanceof e.InputDate;n&&t.selectionMode!=e.DateSelectionMode.Range&&(n=!1);if(t instanceof e.MultiSelect)return t.checkedItems.slice();if(t instanceof e.MultiAutoComplete)return t.selectedItems.slice();if(n)return[t.value,t.rangeEnd];if("value"in t)return t.value;if("text"in t)return t.text;wijmo_1.assert(!1,"can't get control state?")}}_sameContent(t,e){if(wijmo_1.isArray(t)&&wijmo_1.isArray(e)){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n])return!1;return!0}return wijmo_1.isDate(t)||wijmo_1.isDate(e)?wijmo_1.DateTime.sameDate(t,e):t==e}}class GaugeChangeAction extends UndoableAction{constructor(t){super(t);this._oldState=t.value}get control(){return this._target}close(){this._newState=this._target.value;return this._newState!=this._oldState}applyState(t){let e=this._target;e.value=t;e.focus()}}class GridEditAction extends UndoableAction{constructor(t,e){super(t);this._dataItems=[];let n=t.collectionView,i=this._rng=e.range;for(let e=i.topRow;e<=i.bottomRow;e++)this._dataItems.push(t.rows[e].dataItem);this._page=n instanceof wijmo_1.CollectionView?n.pageIndex:-1;this._oldState=t.getCellData(e.row,e.col,!1)}get control(){return this._target}get range(){return this._rng.clone()}get row(){return this._rng.topRow}get col(){return this._rng.leftCol}get dataItem(){return this._dataItems[0]}get dataItems(){return this._dataItems}close(){let t=this._target.collectionView;if(t&&t.currentAddItem)return!1;this._timeStamp=Date.now();this._newState=this._target.getCellData(this.row,this.col,!1);return this._newState!=this._oldState}applyState(t){let e=this._target,n=e.editableCollectionView;if(n){n instanceof wijmo_1.CollectionView&&this._page>-1&&n.moveToPage(this._page);e.deferUpdate(()=>{this._dataItems.forEach(i=>{n.editItem(i);for(let n=this._rng.leftCol;n<=this._rng.rightCol;n++){let o=e.columns[n],s=e._getBindingColumn(e.cells,this.row,o);s&&s._binding&&s._binding.setValue(i,t)}n.commitEdit()})})}e.select(this.row,this.col);this._focusScroll()}shouldAddAsChildAction(t){return t instanceof GridEditAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100}}class GridSortAction extends UndoableAction{constructor(t,e){super(t);let n=this._target.collectionView;n&&(this._oldState=n.sortDescriptions.slice())}get control(){return this._target}close(){let t=this._target.collectionView;if(t){this._newState=t.sortDescriptions.slice();return!0}return!1}applyState(t){let e=this._target.collectionView;e&&e.deferUpdate(()=>{let n=e.sortDescriptions;n.clear();t.forEach(t=>{n.push(t)})});this._focusScroll()}}class GridResizeAction extends UndoableAction{constructor(t,e){super(t);this._col=t.columns[e.col];this._oldState=this._col.renderWidth}get control(){return this._target}get col(){return this._col}close(){this._timeStamp=Date.now();this._newState=this._col.renderWidth;return this._newState!=this._oldState}applyState(t){this._col.width=t;this._focusScroll()}shouldAddAsChildAction(t){return t instanceof GridResizeAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100}}class GridDragAction extends UndoableAction{constructor(t,e){super(t);this._col=e.getColumn(!0);this._oldState=this._getState(this._col)}get control(){return this._target}get col(){return this._col}close(){this._newState=this._getState(this._col);return!this._areStatesEqual(this._newState,this._oldState)}applyState(t){const e=this._col;e.grid.deferUpdate(()=>{const n=this._getState(e);n.coll.splice(n.idx,1);t.coll.splice(t.idx,0,e)});this._focusScroll()}_getState(t){const e=t instanceof wijmo_grid_1.ColumnGroup?t.parentGroup?t.parentGroup.columns:this.target.getColumnGroups():t.grid.columns;return{coll:e,idx:e.indexOf(t)}}_areStatesEqual(t,e){return t.coll===e.coll&&t.idx===e.idx}}class GridAddRowAction extends UndoableAction{constructor(t,e){super(t);let n=this._target.collectionView;if(n&&n.currentAddItem){let t=n.currentAddItem,e=n.sourceCollection.indexOf(t),i=n.currentPosition;this._oldState={item:t,index:e,position:i};this._newState={index:e,position:i}}}get control(){return this._target}close(){return null!=this._oldState}applyState(t){let e=this._target.collectionView;if(e){let n=e.sourceCollection;if(t.item){n.splice(t.index,1);if(e instanceof wijmo_1.CollectionView&&e.trackChanges){let n=t.item;wijmo_1.assert(e.itemsAdded.indexOf(n)>-1,"item should be in the itemsAdded list");e.itemsAdded.remove(n)}}else{let i=this._oldState.item;n.splice(t.index,0,i);if(e instanceof wijmo_1.CollectionView&&e.trackChanges){wijmo_1.assert(e.itemsAdded.indexOf(i)<0,"item should not be in the itemsAdded list");e.itemsAdded.push(i)}}e.refresh();e.moveCurrentToPosition(t.position);this._focusScroll()}}}class GridRemoveRowAction extends UndoableAction{constructor(t,e){super(t);this._edtIndex=-1;let n=this._target.collectionView;if(n){let i=t.rows[e.row].dataItem,o=n.sourceCollection.indexOf(i),s=n.currentPosition;n instanceof wijmo_1.CollectionView&&n.trackChanges&&(this._edtIndex=n.itemsEdited.indexOf(i));this._oldState={item:i,index:o,position:s};this._newState={index:o,position:s}}}get control(){return this._target}get dataItem(){return this._oldState.item}close(){this._timeStamp=Date.now();return null!=this._oldState}applyState(t){let e=this._target,n=e.collectionView;if(n){let i=n.sourceCollection;if(t.item){i.splice(t.index,0,t.item);if(n instanceof wijmo_1.CollectionView&&n.trackChanges){let e=t.item;wijmo_1.assert(n.itemsRemoved.indexOf(e)>-1,"item should be in the itemsRemoved list");n.itemsRemoved.remove(e);this._edtIndex>-1&&n.itemsEdited.indexOf(e)<0&&n.itemsEdited.push(e)}}else{i.splice(t.index,1);if(n instanceof wijmo_1.CollectionView&&n.trackChanges){let t=this._oldState.item;wijmo_1.assert(n.itemsRemoved.indexOf(t)<0,"item should not be in the itemsRemoved list");n.itemsRemoved.push(t)}}n.refresh();n.moveCurrentToPosition(t.position);let o=new(softGrid().CellRange)(t.position,0,t.position,e.columns.length-1);e.select(o);this._focusScroll()}}shouldAddAsChildAction(t){return t instanceof GridRemoveRowAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100}}class ExpandCollapseColumnGroupAction extends UndoableAction{constructor(t,e){super(t);this._group=e.data;this._oldState=this._group.isCollapsed}get control(){return this._target}get group(){return this._group}close(){this._newState=this._group.isCollapsed;return this._newState!=this._oldState}applyState(t){this._group.isCollapsed=t;this._focusScroll()}}class TreeViewEditAction extends UndoableAction{constructor(t,e){super(t);this._nd=e.node;this._oldState=this._getNodeText()}get control(){return this._target}get node(){return this._nd}close(){this._newState=this._getNodeText();return this._newState!=this._oldState}applyState(t){this._nd.select();this._setNodeText(t);this._target.focus()}_getNodeText(){let t=this._nd.dataItem[this._getDisplayMemberPath()];return null!=t?t.toString():""}_setNodeText(t){let e=this._nd,n=e.dataItem,i=this._getDisplayMemberPath(),o=e.element.querySelector(`.${wijmo_nav_1.TreeViewClsNames.nodeText}`);n[i]=t;e.treeView.isContentHtml?o.innerHTML=t:o.textContent=t}_getDisplayMemberPath(){let t=this._nd,e=t.treeView.displayMemberPath;e instanceof Array&&(e=e[t.level]);return e}}class TreeViewCheckAction extends UndoableAction{constructor(t,e){super(t);this._nd=e.node;this._oldState=this._nd.isChecked}get control(){return this._target}get node(){return this._nd}close(){this._newState=this._nd.isChecked;return this._newState!=this._oldState}applyState(t){this._nd.select();this._nd.isChecked=t;this._target.focus()}}wijmo_1._registerModule("wijmo.undo",selfModule);
package/es2015-esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * Wijmo Library 5.20242.23-nightly.d20241008.t020138
3
+ * Wijmo Library 5.20242.23-nightly.d20241009.t020146
4
4
  * https://developer.mescius.com/wijmo
5
5
  *
6
6
  * Copyright(c) MESCIUS inc. All rights reserved.
@@ -11,4 +11,4 @@
11
11
  *
12
12
  */
13
13
 
14
- import{_getModule,CancelEventArgs,Control,isFunction,assert,getActiveElement,CollectionView,DateTime,isArray,isDate,isString,asNumber,asBoolean,hasClass,copy,getElement,getEventOptions,contains,Event,EventArgs,_registerModule}from"@mescius/wijmo";import{_NewRowTemplate,ColumnGroup}from"@mescius/wijmo.grid";import*as selfModule from"@mescius/wijmo.undo";export class UndoableAction{constructor(t){this._target=t}undo(){if(this._actions)for(var t=this._actions.length-1;t>=0;t--)this._actions[t].undo();this.applyState(this._oldState)}redo(){this.applyState(this._newState);this._actions&&this._actions.forEach(t=>{t.redo()})}close(){return!0}applyState(t){}shouldAddAsChildAction(t){return!1}addChildAction(t){this._actions||(this._actions=[]);this._actions.push(t)}get target(){return this._target}_focusScroll(){const t=this._target;if(t instanceof Control){t.hostElement&&t.hostElement.scrollIntoView();t.focus()}else if(t instanceof HTMLElement){t.focus();isFunction(t.select)&&t.select()}}}export class _UndoStackHTML{static addTarget(t,e){const n=_UndoStackHTML;if(e instanceof HTMLInputElement)return n._addInputElement(t,e);if(e instanceof HTMLTextAreaElement)return n._addTextAreaElement(t,e);if(e instanceof HTMLSelectElement)return n._addSelectElement(t,e);{let n=!1;for(let i=0;i<e.children.length;i++){let s=e.children[i];s instanceof HTMLElement&&t.addTarget(s)&&(n=!0)}return n}}static _addInputElement(t,e){let n=null;if("checkbox"==e.type)e.addEventListener("click",e=>{t.pushAction(new CheckboxClickAction(e))});else{if("radio"==e.type){e.addEventListener("mousedown",t=>{n=new RadioClickAction(t)},!0);let i=_UndoStackHTML._getLabel(e);i&&i.addEventListener("mousedown",t=>{n=new RadioClickAction({target:e})},!0);e.addEventListener("focus",t=>{n instanceof RadioClickAction&&n.target==t.target||(n=new RadioClickAction(t))});e.addEventListener("click",e=>{if(n instanceof RadioClickAction){t.pushAction(n);n=null}});return!0}if("range"==e.type){e.addEventListener("mousedown",t=>{let i=getActiveElement();i instanceof HTMLElement&&i!=e&&i.blur();n=new InputChangeAction(t)});e.addEventListener("mouseup",i=>{if(n instanceof InputChangeAction&&getActiveElement()!=e){n._focus=!1;t.pushAction(n);n=null}})}e.addEventListener("focus",t=>{null==n&&(n=new InputChangeAction(t))});e.addEventListener("blur",e=>{if(n instanceof InputChangeAction){t.pushAction(n);n=null}})}return!0}static _addTextAreaElement(t,e){let n=null;e.addEventListener("focus",t=>{n=new InputChangeAction(t)});e.addEventListener("blur",e=>{if(n instanceof InputChangeAction){t.pushAction(n);n=null}});return!0}static _addSelectElement(t,e){let n=null;e.addEventListener("focus",t=>{n=new InputChangeAction(t)});e.addEventListener("blur",e=>{if(n instanceof InputChangeAction){t.pushAction(n);n=null}});return!0}static _getLabel(t){let e=t.parentElement;e instanceof HTMLLabelElement||(e=document.querySelector('label[for="'+t.id+'"'));return e}}export class InputChangeAction extends UndoableAction{constructor(t){super(t.target);this._focus=!0;this._oldState=this._target.value}close(){this._newState=this._target.value;return this._newState!=this._oldState}applyState(t){let e=this._target;e.value=t;e.dispatchEvent(UndoStack._evtInput);this._focus&&this._focusScroll()}}export class CheckboxClickAction extends UndoableAction{constructor(t){super(t.target);assert("checkbox"==this._target.type,"checkbox expected");this._newState=this._target.checked;this._oldState=!this._newState}applyState(t){this._target.checked=t;this._target.focus()}}export class RadioClickAction extends UndoableAction{constructor(t){super(t.target);let e=this._target.type;assert("radio"==e,"radio button expected");this._oldState=this._getState()}close(){this._newState=this._getState();return this._newState!=this._oldState}applyState(t){if(t){t.checked=!0;t.focus()}}_getState(){let t='input[name="'+this._target.name+'"]',e=document.querySelectorAll(t);for(let t=0;t<e.length;t++)if(e[t].checked)return e[t];return null}}export class UndoStack{constructor(t,e){this._autoKbd=!0;this._stack=[];this._maxActions=1e3;this._ptr=0;this.addingTarget=new Event;this.addedTarget=new Event;this.addingAction=new Event;this.addedAction=new Event;this.undoingAction=new Event;this.undoneAction=new Event;this.redoingAction=new Event;this.redoneAction=new Event;this.stateChanged=new Event;if(!UndoStack._evtInput){let t=document.createEvent("HTMLEvents");t.initEvent("input",!0,!1);UndoStack._evtInput=t}copy(this,e);t=getElement(t||document.body);this.addTarget(t);document.addEventListener("keydown",e=>{var n=navigator.platform.toUpperCase().indexOf("MAC")>=0?e.metaKey:e.ctrlKey;if(this._autoKbd&&n&&!e.defaultPrevented&&contains(t,e.target))if(e.shiftKey&&90===e.keyCode){if(this.canRedo){getActiveElement().blur();setTimeout(()=>this.redo(),100)}e.preventDefault()}else switch(e.keyCode){case 90:if(this.canUndo){getActiveElement().blur();setTimeout(()=>this.undo(),100)}e.preventDefault();break;case 89:if(this.canRedo){getActiveElement().blur();setTimeout(()=>this.redo(),100)}e.preventDefault()}},getEventOptions(!0,!1))}addTarget(t){let e=!1;if(isString(t)){let e=document.querySelectorAll(t),n=!1;for(let t=0;t<e.length;t++)this.addTarget(e[t])&&(n=!0);return n}assert(t instanceof HTMLElement,"Undo target should be an HTML element");let n=new AddTargetEventArgs(t);n.cancel=hasClass(t,"wj-no-undo");if(this.onAddingTarget(n)){let i=Control.getControl(t);i&&(e=_UndoStackWijmo.addTarget(this,i));e||(e=_UndoStackHTML.addTarget(this,t));e&&this.onAddedTarget(n)}return e}get autoKeyboard(){return this._autoKbd}set autoKeyboard(t){this._autoKbd=asBoolean(t)}get isDisabled(){return this._disabled}set isDisabled(t){this._disabled=asBoolean(t)}get maxActions(){return this._maxActions}set maxActions(t){if(t!=this._maxActions){this._maxActions=asNumber(t,!1,!0);this.clear()}}get actionCount(){return this._stack.length}get canUndo(){return this._stack.length>0&&this._ptr>0&&!this._disabled}get canRedo(){return this._stack.length>0&&this._ptr<this._stack.length&&!this._disabled}undo(){if(this.canUndo){let t=this._stack[this._ptr-1],e=new UndoActionEventArgs(t);if(this.onUndoingAction(e)){this._ptr--;this._undoing=!0;t.undo();this._undoing=!1;this._pendingAction=null;this.onUndoneAction(e);this.onStateChanged()}}}redo(){if(this.canRedo){let t=this._stack[this._ptr],e=new UndoActionEventArgs(t);if(this.onRedoingAction(e)){this._ptr++;this._undoing=!0;t.redo();this._undoing=!1;this._pendingAction=null;this.onRedoneAction(e);this.onStateChanged()}}}clear(){this._ptr=0;this._stack.splice(0,this._stack.length);this.onStateChanged()}pushAction(t){this._pendingAction=t;this.pushPendingAction()}onAddingTarget(t){this.addingTarget.raise(this,t);return!t.cancel}onAddedTarget(t){this.addedTarget.raise(this,t)}onAddingAction(t){this.addingAction.raise(this,t);return!t.cancel}onAddedAction(t){this.addedAction.raise(this,t)}onUndoingAction(t){this.undoingAction.raise(this,t);return!t.cancel}onUndoneAction(t){this.undoneAction.raise(this,t)}onRedoingAction(t){this.redoingAction.raise(this,t);return!t.cancel}onRedoneAction(t){this.redoneAction.raise(this,t)}onStateChanged(){this.stateChanged.raise(this,EventArgs.empty)}pushPendingAction(){if(!this._disabled&&!this._undoing&&this._pendingAction&&this._pendingAction.close()){this._stack.splice(this._ptr,this._stack.length-this._ptr);assert(this._stack.length==this._ptr,"should be at the end of the stack");if(this._stack.length){let t=this._stack[this._ptr-1];if(t.shouldAddAsChildAction(this._pendingAction)){t.addChildAction(this._pendingAction);this._pendingAction=null;this.onStateChanged();return}}let t=new UndoActionEventArgs(this._pendingAction);if(!this.onAddingAction(t))return;this._stack.push(this._pendingAction);this._ptr++;this._pendingAction=null;let e=this._stack.length-this._maxActions;if(e>0){this._stack.splice(0,e);this._ptr-=e;assert(this._ptr>=0,"pointer should not be negative")}this.onStateChanged()}}}export class AddTargetEventArgs extends CancelEventArgs{constructor(t){super();this._target=t}get target(){return this._target}}export class UndoActionEventArgs extends CancelEventArgs{constructor(t){super();this._action=t}get action(){return this._action}}export function softInput(){return _getModule("wijmo.input")}export function softGrid(){return _getModule("wijmo.grid")}export function softGauge(){return _getModule("wijmo.gauge")}export function softNav(){return _getModule("wijmo.nav")}export class _UndoStackWijmo{static addTarget(t,e){const n=_UndoStackWijmo;return softGrid()&&e instanceof softGrid().FlexGrid?n._addFlexGrid(t,e):softGauge()&&e instanceof softGauge().Gauge?n._addGauge(t,e):softNav()&&e instanceof softNav().TreeView?n._addTreeView(t,e):!!n._isInputControl(e)&&n._addInputControl(t,e)}static _isInputControl(t){const e=softInput();return!!e&&(t instanceof e.DropDown||t instanceof e.InputMask||t instanceof e.InputNumber||t instanceof e.Calendar||t instanceof e.ColorPicker)}static _addInputControl(t,e){let n=null;e.gotFocus.addHandler(()=>{n=new InputControlChangeAction({target:e})});e.lostFocus.addHandler(()=>{if(n instanceof InputControlChangeAction){t.pushAction(n);n=null}});return!0}static _addGauge(t,e){if(!e.isReadOnly){let n=null;e.hostElement.addEventListener("focus",()=>{n||(n=new GaugeChangeAction(e))});e.lostFocus.addHandler(()=>{if(n instanceof GaugeChangeAction){t.pushAction(n);n=null}});return!0}return!1}static _addTreeView(t,e){let n=null;e.nodeEditStarted.addHandler((t,e)=>{n=new TreeViewEditAction(t,e)});e.nodeEditEnded.addHandler((e,i)=>{if(n instanceof TreeViewEditAction){t.pushAction(n);n=null}});e.isCheckedChanging.addHandler((t,e)=>{n=new TreeViewCheckAction(t,e)});e.isCheckedChanged.addHandler((e,i)=>{if(n instanceof TreeViewCheckAction){t.pushAction(n);n=null}});return!0}static _addFlexGrid(t,e){let n=null;e.beginningEdit.addHandler((t,e)=>{n=e.getRow()instanceof _NewRowTemplate?null:new GridEditAction(t,e)});e.cellEditEnded.addHandler((e,i)=>{if(n instanceof GridEditAction){t.pushAction(n);n=null}});e.pastingCell.addHandler((t,e)=>{n=e.getRow()?new GridEditAction(t,e):null});e.pastedCell.addHandler((e,i)=>{if(n instanceof GridEditAction){t.pushAction(n);n=null}});e.sortingColumn.addHandler((t,e)=>{n=new GridSortAction(t,e)});e.sortedColumn.addHandler((e,i)=>{if(n instanceof GridSortAction){t.pushAction(n);n=null}});e.resizingColumn.addHandler((t,e)=>{n instanceof GridResizeAction||(n=new GridResizeAction(t,e))});e.resizedColumn.addHandler(()=>{if(n instanceof GridResizeAction){t.pushAction(n);n=null}});e.autoSizingColumn.addHandler((t,e)=>{n=new GridResizeAction(t,e)});e.autoSizedColumn.addHandler(()=>{if(n instanceof GridResizeAction){t.pushAction(n);n=null}});e.draggingColumn.addHandler((t,e)=>{n=new GridDragAction(t,e)});e.draggedColumn.addHandler((e,i)=>{if(n instanceof GridDragAction){t.pushAction(n);n=null}});e.rowAdded.addHandler((e,n)=>{n.cancel||t.pushAction(new GridAddRowAction(e,n))});e.deletingRow.addHandler((e,n)=>{n.cancel||t.pushAction(new GridRemoveRowAction(e,n))});e.columnGroupCollapsedChanging.addHandler((t,e)=>{n=new ExpandCollapseColumnGroupAction(t,e)});e.columnGroupCollapsedChanged.addHandler((e,i)=>{if(n instanceof ExpandCollapseColumnGroupAction){t.pushAction(n);n=null}});return!0}}class InputControlChangeAction extends InputChangeAction{constructor(t){super(t);this._ctl=t.target;this._oldState=this._getControlState()}get control(){return this._ctl}close(){this._timeStamp=Date.now();this._newState=this._getControlState();return!this._sameContent(this._oldState,this._newState)}shouldAddAsChildAction(t){if(t instanceof InputControlChangeAction&&t.target==this.target&&t._timeStamp-this._timeStamp<500){this._timeStamp=Date.now();return!0}return!1}applyState(t){let e=this._ctl,n=softInput();if(n){let i=e instanceof n.Calendar||e instanceof n.InputDate;i&&e.selectionMode!=n.DateSelectionMode.Range&&(i=!1);if(e instanceof n.MultiSelect)e.checkedItems=t;else if(e instanceof n.MultiAutoComplete)e.selectedItems=t;else if(i){e.value=t[0];e.rangeEnd=t[1]}else"value"in e?e.value=t:"text"in e?e.text=t:assert(!1,"can't apply control state?");e.focus()}}_getControlState(){let t=this._ctl,e=softInput();if(e){let n=t instanceof e.Calendar||t instanceof e.InputDate;n&&t.selectionMode!=e.DateSelectionMode.Range&&(n=!1);if(t instanceof e.MultiSelect)return t.checkedItems.slice();if(t instanceof e.MultiAutoComplete)return t.selectedItems.slice();if(n)return[t.value,t.rangeEnd];if("value"in t)return t.value;if("text"in t)return t.text;assert(!1,"can't get control state?")}}_sameContent(t,e){if(isArray(t)&&isArray(e)){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n])return!1;return!0}return isDate(t)||isDate(e)?DateTime.sameDate(t,e):t==e}}class GaugeChangeAction extends UndoableAction{constructor(t){super(t);this._oldState=t.value}get control(){return this._target}close(){this._newState=this._target.value;return this._newState!=this._oldState}applyState(t){let e=this._target;e.value=t;e.focus()}}class GridEditAction extends UndoableAction{constructor(t,e){super(t);this._dataItems=[];let n=t.collectionView,i=this._rng=e.range;for(let e=i.topRow;e<=i.bottomRow;e++)this._dataItems.push(t.rows[e].dataItem);this._page=n instanceof CollectionView?n.pageIndex:-1;this._oldState=t.getCellData(e.row,e.col,!1)}get control(){return this._target}get range(){return this._rng.clone()}get row(){return this._rng.topRow}get col(){return this._rng.leftCol}get dataItem(){return this._dataItems[0]}get dataItems(){return this._dataItems}close(){let t=this._target.collectionView;if(t&&t.currentAddItem)return!1;this._timeStamp=Date.now();this._newState=this._target.getCellData(this.row,this.col,!1);return this._newState!=this._oldState}applyState(t){let e=this._target,n=e.editableCollectionView;if(n){n instanceof CollectionView&&this._page>-1&&n.moveToPage(this._page);e.deferUpdate(()=>{this._dataItems.forEach(i=>{n.editItem(i);for(let n=this._rng.leftCol;n<=this._rng.rightCol;n++){let s=e.columns[n],o=e._getBindingColumn(e.cells,this.row,s);o&&o._binding&&o._binding.setValue(i,t)}n.commitEdit()})})}e.select(this.row,this.col);this._focusScroll()}shouldAddAsChildAction(t){return t instanceof GridEditAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100}}class GridSortAction extends UndoableAction{constructor(t,e){super(t);let n=this._target.collectionView;n&&(this._oldState=n.sortDescriptions.slice())}get control(){return this._target}close(){let t=this._target.collectionView;if(t){this._newState=t.sortDescriptions.slice();return!0}return!1}applyState(t){let e=this._target.collectionView;e&&e.deferUpdate(()=>{let n=e.sortDescriptions;n.clear();t.forEach(t=>{n.push(t)})});this._focusScroll()}}class GridResizeAction extends UndoableAction{constructor(t,e){super(t);this._col=t.columns[e.col];this._oldState=this._col.renderWidth}get control(){return this._target}get col(){return this._col}close(){this._timeStamp=Date.now();this._newState=this._col.renderWidth;return this._newState!=this._oldState}applyState(t){this._col.width=t;this._focusScroll()}shouldAddAsChildAction(t){return t instanceof GridResizeAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100}}class GridDragAction extends UndoableAction{constructor(t,e){super(t);this._col=e.getColumn(!0);this._oldState=this._getState(this._col)}get control(){return this._target}get col(){return this._col}close(){this._newState=this._getState(this._col);return!this._areStatesEqual(this._newState,this._oldState)}applyState(t){const e=this._col;e.grid.deferUpdate(()=>{const n=this._getState(e);n.coll.splice(n.idx,1);t.coll.splice(t.idx,0,e)});this._focusScroll()}_getState(t){const e=t instanceof ColumnGroup?t.parentGroup?t.parentGroup.columns:this.target.getColumnGroups():t.grid.columns;return{coll:e,idx:e.indexOf(t)}}_areStatesEqual(t,e){return t.coll===e.coll&&t.idx===e.idx}}class GridAddRowAction extends UndoableAction{constructor(t,e){super(t);let n=this._target.collectionView;if(n&&n.currentAddItem){let t=n.currentAddItem,e=n.sourceCollection.indexOf(t),i=n.currentPosition;this._oldState={item:t,index:e,position:i};this._newState={index:e,position:i}}}get control(){return this._target}close(){return null!=this._oldState}applyState(t){let e=this._target.collectionView;if(e){let n=e.sourceCollection;if(t.item){n.splice(t.index,1);if(e instanceof CollectionView&&e.trackChanges){let n=t.item;assert(e.itemsAdded.indexOf(n)>-1,"item should be in the itemsAdded list");e.itemsAdded.remove(n)}}else{let i=this._oldState.item;n.splice(t.index,0,i);if(e instanceof CollectionView&&e.trackChanges){assert(e.itemsAdded.indexOf(i)<0,"item should not be in the itemsAdded list");e.itemsAdded.push(i)}}e.refresh();e.moveCurrentToPosition(t.position);this._focusScroll()}}}class GridRemoveRowAction extends UndoableAction{constructor(t,e){super(t);this._edtIndex=-1;let n=this._target.collectionView;if(n){let i=t.rows[e.row].dataItem,s=n.sourceCollection.indexOf(i),o=n.currentPosition;n instanceof CollectionView&&n.trackChanges&&(this._edtIndex=n.itemsEdited.indexOf(i));this._oldState={item:i,index:s,position:o};this._newState={index:s,position:o}}}get control(){return this._target}get dataItem(){return this._oldState.item}close(){this._timeStamp=Date.now();return null!=this._oldState}applyState(t){let e=this._target,n=e.collectionView;if(n){let i=n.sourceCollection;if(t.item){i.splice(t.index,0,t.item);if(n instanceof CollectionView&&n.trackChanges){let e=t.item;assert(n.itemsRemoved.indexOf(e)>-1,"item should be in the itemsRemoved list");n.itemsRemoved.remove(e);this._edtIndex>-1&&n.itemsEdited.indexOf(e)<0&&n.itemsEdited.push(e)}}else{i.splice(t.index,1);if(n instanceof CollectionView&&n.trackChanges){let t=this._oldState.item;assert(n.itemsRemoved.indexOf(t)<0,"item should not be in the itemsRemoved list");n.itemsRemoved.push(t)}}n.refresh();n.moveCurrentToPosition(t.position);let s=new(softGrid().CellRange)(t.position,0,t.position,e.columns.length-1);e.select(s);this._focusScroll()}}shouldAddAsChildAction(t){return t instanceof GridRemoveRowAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100}}class ExpandCollapseColumnGroupAction extends UndoableAction{constructor(t,e){super(t);this._group=e.data;this._oldState=this._group.isCollapsed}get control(){return this._target}get group(){return this._group}close(){this._newState=this._group.isCollapsed;return this._newState!=this._oldState}applyState(t){this._group.isCollapsed=t;this._focusScroll()}}class TreeViewEditAction extends UndoableAction{constructor(t,e){super(t);this._nd=e.node;this._oldState=this._getNodeText()}get control(){return this._target}get node(){return this._nd}close(){this._newState=this._getNodeText();return this._newState!=this._oldState}applyState(t){this._nd.select();this._setNodeText(t);this._target.focus()}_getNodeText(){let t=this._nd.dataItem[this._getDisplayMemberPath()];return null!=t?t.toString():""}_setNodeText(t){let e=this._nd,n=e.dataItem,i=this._getDisplayMemberPath(),s=e.element.querySelector(".wj-node-text");n[i]=t;e.treeView.isContentHtml?s.innerHTML=t:s.textContent=t}_getDisplayMemberPath(){let t=this._nd,e=t.treeView.displayMemberPath;e instanceof Array&&(e=e[t.level]);return e}}class TreeViewCheckAction extends UndoableAction{constructor(t,e){super(t);this._nd=e.node;this._oldState=this._nd.isChecked}get control(){return this._target}get node(){return this._nd}close(){this._newState=this._nd.isChecked;return this._newState!=this._oldState}applyState(t){this._nd.select();this._nd.isChecked=t;this._target.focus()}}_registerModule("wijmo.undo",selfModule);
14
+ import{_getModule,CancelEventArgs,Control,isFunction,assert,getActiveElement,CollectionView,DateTime,isArray,isDate,isString,asNumber,asBoolean,hasClass,copy,getElement,getEventOptions,contains,Event,EventArgs,_registerModule}from"@mescius/wijmo";import{_NewRowTemplate,ColumnGroup}from"@mescius/wijmo.grid";import{TreeViewClsNames}from"@mescius/wijmo.nav";import*as selfModule from"@mescius/wijmo.undo";export class UndoableAction{constructor(t){this._target=t}undo(){if(this._actions)for(var t=this._actions.length-1;t>=0;t--)this._actions[t].undo();this.applyState(this._oldState)}redo(){this.applyState(this._newState);this._actions&&this._actions.forEach(t=>{t.redo()})}close(){return!0}applyState(t){}shouldAddAsChildAction(t){return!1}addChildAction(t){this._actions||(this._actions=[]);this._actions.push(t)}get target(){return this._target}_focusScroll(){const t=this._target;if(t instanceof Control){t.hostElement&&t.hostElement.scrollIntoView();t.focus()}else if(t instanceof HTMLElement){t.focus();isFunction(t.select)&&t.select()}}}export class _UndoStackHTML{static addTarget(t,e){const n=_UndoStackHTML;if(e instanceof HTMLInputElement)return n._addInputElement(t,e);if(e instanceof HTMLTextAreaElement)return n._addTextAreaElement(t,e);if(e instanceof HTMLSelectElement)return n._addSelectElement(t,e);{let n=!1;for(let i=0;i<e.children.length;i++){let s=e.children[i];s instanceof HTMLElement&&t.addTarget(s)&&(n=!0)}return n}}static _addInputElement(t,e){let n=null;if("checkbox"==e.type)e.addEventListener("click",e=>{t.pushAction(new CheckboxClickAction(e))});else{if("radio"==e.type){e.addEventListener("mousedown",t=>{n=new RadioClickAction(t)},!0);let i=_UndoStackHTML._getLabel(e);i&&i.addEventListener("mousedown",t=>{n=new RadioClickAction({target:e})},!0);e.addEventListener("focus",t=>{n instanceof RadioClickAction&&n.target==t.target||(n=new RadioClickAction(t))});e.addEventListener("click",e=>{if(n instanceof RadioClickAction){t.pushAction(n);n=null}});return!0}if("range"==e.type){e.addEventListener("mousedown",t=>{let i=getActiveElement();i instanceof HTMLElement&&i!=e&&i.blur();n=new InputChangeAction(t)});e.addEventListener("mouseup",i=>{if(n instanceof InputChangeAction&&getActiveElement()!=e){n._focus=!1;t.pushAction(n);n=null}})}e.addEventListener("focus",t=>{null==n&&(n=new InputChangeAction(t))});e.addEventListener("blur",e=>{if(n instanceof InputChangeAction){t.pushAction(n);n=null}})}return!0}static _addTextAreaElement(t,e){let n=null;e.addEventListener("focus",t=>{n=new InputChangeAction(t)});e.addEventListener("blur",e=>{if(n instanceof InputChangeAction){t.pushAction(n);n=null}});return!0}static _addSelectElement(t,e){let n=null;e.addEventListener("focus",t=>{n=new InputChangeAction(t)});e.addEventListener("blur",e=>{if(n instanceof InputChangeAction){t.pushAction(n);n=null}});return!0}static _getLabel(t){let e=t.parentElement;e instanceof HTMLLabelElement||(e=document.querySelector('label[for="'+t.id+'"'));return e}}export class InputChangeAction extends UndoableAction{constructor(t){super(t.target);this._focus=!0;this._oldState=this._target.value}close(){this._newState=this._target.value;return this._newState!=this._oldState}applyState(t){let e=this._target;e.value=t;e.dispatchEvent(UndoStack._evtInput);this._focus&&this._focusScroll()}}export class CheckboxClickAction extends UndoableAction{constructor(t){super(t.target);assert("checkbox"==this._target.type,"checkbox expected");this._newState=this._target.checked;this._oldState=!this._newState}applyState(t){this._target.checked=t;this._target.focus()}}export class RadioClickAction extends UndoableAction{constructor(t){super(t.target);let e=this._target.type;assert("radio"==e,"radio button expected");this._oldState=this._getState()}close(){this._newState=this._getState();return this._newState!=this._oldState}applyState(t){if(t){t.checked=!0;t.focus()}}_getState(){let t='input[name="'+this._target.name+'"]',e=document.querySelectorAll(t);for(let t=0;t<e.length;t++)if(e[t].checked)return e[t];return null}}export const UndoClsNames={noUndo:"wj-no-undo"};export class UndoStack{constructor(t,e){this._autoKbd=!0;this._stack=[];this._maxActions=1e3;this._ptr=0;this.addingTarget=new Event;this.addedTarget=new Event;this.addingAction=new Event;this.addedAction=new Event;this.undoingAction=new Event;this.undoneAction=new Event;this.redoingAction=new Event;this.redoneAction=new Event;this.stateChanged=new Event;if(!UndoStack._evtInput){let t=document.createEvent("HTMLEvents");t.initEvent("input",!0,!1);UndoStack._evtInput=t}copy(this,e);t=getElement(t||document.body);this.addTarget(t);document.addEventListener("keydown",e=>{var n=navigator.platform.toUpperCase().indexOf("MAC")>=0?e.metaKey:e.ctrlKey;if(this._autoKbd&&n&&!e.defaultPrevented&&contains(t,e.target))if(e.shiftKey&&90===e.keyCode){if(this.canRedo){getActiveElement().blur();setTimeout(()=>this.redo(),100)}e.preventDefault()}else switch(e.keyCode){case 90:if(this.canUndo){getActiveElement().blur();setTimeout(()=>this.undo(),100)}e.preventDefault();break;case 89:if(this.canRedo){getActiveElement().blur();setTimeout(()=>this.redo(),100)}e.preventDefault()}},getEventOptions(!0,!1))}addTarget(t){let e=!1;if(isString(t)){let e=document.querySelectorAll(t),n=!1;for(let t=0;t<e.length;t++)this.addTarget(e[t])&&(n=!0);return n}assert(t instanceof HTMLElement,"Undo target should be an HTML element");let n=new AddTargetEventArgs(t);n.cancel=hasClass(t,UndoClsNames.noUndo);if(this.onAddingTarget(n)){let i=Control.getControl(t);i&&(e=_UndoStackWijmo.addTarget(this,i));e||(e=_UndoStackHTML.addTarget(this,t));e&&this.onAddedTarget(n)}return e}get autoKeyboard(){return this._autoKbd}set autoKeyboard(t){this._autoKbd=asBoolean(t)}get isDisabled(){return this._disabled}set isDisabled(t){this._disabled=asBoolean(t)}get maxActions(){return this._maxActions}set maxActions(t){if(t!=this._maxActions){this._maxActions=asNumber(t,!1,!0);this.clear()}}get actionCount(){return this._stack.length}get canUndo(){return this._stack.length>0&&this._ptr>0&&!this._disabled}get canRedo(){return this._stack.length>0&&this._ptr<this._stack.length&&!this._disabled}undo(){if(this.canUndo){let t=this._stack[this._ptr-1],e=new UndoActionEventArgs(t);if(this.onUndoingAction(e)){this._ptr--;this._undoing=!0;t.undo();this._undoing=!1;this._pendingAction=null;this.onUndoneAction(e);this.onStateChanged()}}}redo(){if(this.canRedo){let t=this._stack[this._ptr],e=new UndoActionEventArgs(t);if(this.onRedoingAction(e)){this._ptr++;this._undoing=!0;t.redo();this._undoing=!1;this._pendingAction=null;this.onRedoneAction(e);this.onStateChanged()}}}clear(){this._ptr=0;this._stack.splice(0,this._stack.length);this.onStateChanged()}pushAction(t){this._pendingAction=t;this.pushPendingAction()}onAddingTarget(t){this.addingTarget.raise(this,t);return!t.cancel}onAddedTarget(t){this.addedTarget.raise(this,t)}onAddingAction(t){this.addingAction.raise(this,t);return!t.cancel}onAddedAction(t){this.addedAction.raise(this,t)}onUndoingAction(t){this.undoingAction.raise(this,t);return!t.cancel}onUndoneAction(t){this.undoneAction.raise(this,t)}onRedoingAction(t){this.redoingAction.raise(this,t);return!t.cancel}onRedoneAction(t){this.redoneAction.raise(this,t)}onStateChanged(){this.stateChanged.raise(this,EventArgs.empty)}pushPendingAction(){if(!this._disabled&&!this._undoing&&this._pendingAction&&this._pendingAction.close()){this._stack.splice(this._ptr,this._stack.length-this._ptr);assert(this._stack.length==this._ptr,"should be at the end of the stack");if(this._stack.length){let t=this._stack[this._ptr-1];if(t.shouldAddAsChildAction(this._pendingAction)){t.addChildAction(this._pendingAction);this._pendingAction=null;this.onStateChanged();return}}let t=new UndoActionEventArgs(this._pendingAction);if(!this.onAddingAction(t))return;this._stack.push(this._pendingAction);this._ptr++;this._pendingAction=null;let e=this._stack.length-this._maxActions;if(e>0){this._stack.splice(0,e);this._ptr-=e;assert(this._ptr>=0,"pointer should not be negative")}this.onStateChanged()}}}export class AddTargetEventArgs extends CancelEventArgs{constructor(t){super();this._target=t}get target(){return this._target}}export class UndoActionEventArgs extends CancelEventArgs{constructor(t){super();this._action=t}get action(){return this._action}}export function softInput(){return _getModule("wijmo.input")}export function softGrid(){return _getModule("wijmo.grid")}export function softGauge(){return _getModule("wijmo.gauge")}export function softNav(){return _getModule("wijmo.nav")}export class _UndoStackWijmo{static addTarget(t,e){const n=_UndoStackWijmo;return softGrid()&&e instanceof softGrid().FlexGrid?n._addFlexGrid(t,e):softGauge()&&e instanceof softGauge().Gauge?n._addGauge(t,e):softNav()&&e instanceof softNav().TreeView?n._addTreeView(t,e):!!n._isInputControl(e)&&n._addInputControl(t,e)}static _isInputControl(t){const e=softInput();return!!e&&(t instanceof e.DropDown||t instanceof e.InputMask||t instanceof e.InputNumber||t instanceof e.Calendar||t instanceof e.ColorPicker)}static _addInputControl(t,e){let n=null;e.gotFocus.addHandler(()=>{n=new InputControlChangeAction({target:e})});e.lostFocus.addHandler(()=>{if(n instanceof InputControlChangeAction){t.pushAction(n);n=null}});return!0}static _addGauge(t,e){if(!e.isReadOnly){let n=null;e.hostElement.addEventListener("focus",()=>{n||(n=new GaugeChangeAction(e))});e.lostFocus.addHandler(()=>{if(n instanceof GaugeChangeAction){t.pushAction(n);n=null}});return!0}return!1}static _addTreeView(t,e){let n=null;e.nodeEditStarted.addHandler((t,e)=>{n=new TreeViewEditAction(t,e)});e.nodeEditEnded.addHandler((e,i)=>{if(n instanceof TreeViewEditAction){t.pushAction(n);n=null}});e.isCheckedChanging.addHandler((t,e)=>{n=new TreeViewCheckAction(t,e)});e.isCheckedChanged.addHandler((e,i)=>{if(n instanceof TreeViewCheckAction){t.pushAction(n);n=null}});return!0}static _addFlexGrid(t,e){let n=null;e.beginningEdit.addHandler((t,e)=>{n=e.getRow()instanceof _NewRowTemplate?null:new GridEditAction(t,e)});e.cellEditEnded.addHandler((e,i)=>{if(n instanceof GridEditAction){t.pushAction(n);n=null}});e.pastingCell.addHandler((t,e)=>{n=e.getRow()?new GridEditAction(t,e):null});e.pastedCell.addHandler((e,i)=>{if(n instanceof GridEditAction){t.pushAction(n);n=null}});e.sortingColumn.addHandler((t,e)=>{n=new GridSortAction(t,e)});e.sortedColumn.addHandler((e,i)=>{if(n instanceof GridSortAction){t.pushAction(n);n=null}});e.resizingColumn.addHandler((t,e)=>{n instanceof GridResizeAction||(n=new GridResizeAction(t,e))});e.resizedColumn.addHandler(()=>{if(n instanceof GridResizeAction){t.pushAction(n);n=null}});e.autoSizingColumn.addHandler((t,e)=>{n=new GridResizeAction(t,e)});e.autoSizedColumn.addHandler(()=>{if(n instanceof GridResizeAction){t.pushAction(n);n=null}});e.draggingColumn.addHandler((t,e)=>{n=new GridDragAction(t,e)});e.draggedColumn.addHandler((e,i)=>{if(n instanceof GridDragAction){t.pushAction(n);n=null}});e.rowAdded.addHandler((e,n)=>{n.cancel||t.pushAction(new GridAddRowAction(e,n))});e.deletingRow.addHandler((e,n)=>{n.cancel||t.pushAction(new GridRemoveRowAction(e,n))});e.columnGroupCollapsedChanging.addHandler((t,e)=>{n=new ExpandCollapseColumnGroupAction(t,e)});e.columnGroupCollapsedChanged.addHandler((e,i)=>{if(n instanceof ExpandCollapseColumnGroupAction){t.pushAction(n);n=null}});return!0}}class InputControlChangeAction extends InputChangeAction{constructor(t){super(t);this._ctl=t.target;this._oldState=this._getControlState()}get control(){return this._ctl}close(){this._timeStamp=Date.now();this._newState=this._getControlState();return!this._sameContent(this._oldState,this._newState)}shouldAddAsChildAction(t){if(t instanceof InputControlChangeAction&&t.target==this.target&&t._timeStamp-this._timeStamp<500){this._timeStamp=Date.now();return!0}return!1}applyState(t){let e=this._ctl,n=softInput();if(n){let i=e instanceof n.Calendar||e instanceof n.InputDate;i&&e.selectionMode!=n.DateSelectionMode.Range&&(i=!1);if(e instanceof n.MultiSelect)e.checkedItems=t;else if(e instanceof n.MultiAutoComplete)e.selectedItems=t;else if(i){e.value=t[0];e.rangeEnd=t[1]}else"value"in e?e.value=t:"text"in e?e.text=t:assert(!1,"can't apply control state?");e.focus()}}_getControlState(){let t=this._ctl,e=softInput();if(e){let n=t instanceof e.Calendar||t instanceof e.InputDate;n&&t.selectionMode!=e.DateSelectionMode.Range&&(n=!1);if(t instanceof e.MultiSelect)return t.checkedItems.slice();if(t instanceof e.MultiAutoComplete)return t.selectedItems.slice();if(n)return[t.value,t.rangeEnd];if("value"in t)return t.value;if("text"in t)return t.text;assert(!1,"can't get control state?")}}_sameContent(t,e){if(isArray(t)&&isArray(e)){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n])return!1;return!0}return isDate(t)||isDate(e)?DateTime.sameDate(t,e):t==e}}class GaugeChangeAction extends UndoableAction{constructor(t){super(t);this._oldState=t.value}get control(){return this._target}close(){this._newState=this._target.value;return this._newState!=this._oldState}applyState(t){let e=this._target;e.value=t;e.focus()}}class GridEditAction extends UndoableAction{constructor(t,e){super(t);this._dataItems=[];let n=t.collectionView,i=this._rng=e.range;for(let e=i.topRow;e<=i.bottomRow;e++)this._dataItems.push(t.rows[e].dataItem);this._page=n instanceof CollectionView?n.pageIndex:-1;this._oldState=t.getCellData(e.row,e.col,!1)}get control(){return this._target}get range(){return this._rng.clone()}get row(){return this._rng.topRow}get col(){return this._rng.leftCol}get dataItem(){return this._dataItems[0]}get dataItems(){return this._dataItems}close(){let t=this._target.collectionView;if(t&&t.currentAddItem)return!1;this._timeStamp=Date.now();this._newState=this._target.getCellData(this.row,this.col,!1);return this._newState!=this._oldState}applyState(t){let e=this._target,n=e.editableCollectionView;if(n){n instanceof CollectionView&&this._page>-1&&n.moveToPage(this._page);e.deferUpdate(()=>{this._dataItems.forEach(i=>{n.editItem(i);for(let n=this._rng.leftCol;n<=this._rng.rightCol;n++){let s=e.columns[n],o=e._getBindingColumn(e.cells,this.row,s);o&&o._binding&&o._binding.setValue(i,t)}n.commitEdit()})})}e.select(this.row,this.col);this._focusScroll()}shouldAddAsChildAction(t){return t instanceof GridEditAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100}}class GridSortAction extends UndoableAction{constructor(t,e){super(t);let n=this._target.collectionView;n&&(this._oldState=n.sortDescriptions.slice())}get control(){return this._target}close(){let t=this._target.collectionView;if(t){this._newState=t.sortDescriptions.slice();return!0}return!1}applyState(t){let e=this._target.collectionView;e&&e.deferUpdate(()=>{let n=e.sortDescriptions;n.clear();t.forEach(t=>{n.push(t)})});this._focusScroll()}}class GridResizeAction extends UndoableAction{constructor(t,e){super(t);this._col=t.columns[e.col];this._oldState=this._col.renderWidth}get control(){return this._target}get col(){return this._col}close(){this._timeStamp=Date.now();this._newState=this._col.renderWidth;return this._newState!=this._oldState}applyState(t){this._col.width=t;this._focusScroll()}shouldAddAsChildAction(t){return t instanceof GridResizeAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100}}class GridDragAction extends UndoableAction{constructor(t,e){super(t);this._col=e.getColumn(!0);this._oldState=this._getState(this._col)}get control(){return this._target}get col(){return this._col}close(){this._newState=this._getState(this._col);return!this._areStatesEqual(this._newState,this._oldState)}applyState(t){const e=this._col;e.grid.deferUpdate(()=>{const n=this._getState(e);n.coll.splice(n.idx,1);t.coll.splice(t.idx,0,e)});this._focusScroll()}_getState(t){const e=t instanceof ColumnGroup?t.parentGroup?t.parentGroup.columns:this.target.getColumnGroups():t.grid.columns;return{coll:e,idx:e.indexOf(t)}}_areStatesEqual(t,e){return t.coll===e.coll&&t.idx===e.idx}}class GridAddRowAction extends UndoableAction{constructor(t,e){super(t);let n=this._target.collectionView;if(n&&n.currentAddItem){let t=n.currentAddItem,e=n.sourceCollection.indexOf(t),i=n.currentPosition;this._oldState={item:t,index:e,position:i};this._newState={index:e,position:i}}}get control(){return this._target}close(){return null!=this._oldState}applyState(t){let e=this._target.collectionView;if(e){let n=e.sourceCollection;if(t.item){n.splice(t.index,1);if(e instanceof CollectionView&&e.trackChanges){let n=t.item;assert(e.itemsAdded.indexOf(n)>-1,"item should be in the itemsAdded list");e.itemsAdded.remove(n)}}else{let i=this._oldState.item;n.splice(t.index,0,i);if(e instanceof CollectionView&&e.trackChanges){assert(e.itemsAdded.indexOf(i)<0,"item should not be in the itemsAdded list");e.itemsAdded.push(i)}}e.refresh();e.moveCurrentToPosition(t.position);this._focusScroll()}}}class GridRemoveRowAction extends UndoableAction{constructor(t,e){super(t);this._edtIndex=-1;let n=this._target.collectionView;if(n){let i=t.rows[e.row].dataItem,s=n.sourceCollection.indexOf(i),o=n.currentPosition;n instanceof CollectionView&&n.trackChanges&&(this._edtIndex=n.itemsEdited.indexOf(i));this._oldState={item:i,index:s,position:o};this._newState={index:s,position:o}}}get control(){return this._target}get dataItem(){return this._oldState.item}close(){this._timeStamp=Date.now();return null!=this._oldState}applyState(t){let e=this._target,n=e.collectionView;if(n){let i=n.sourceCollection;if(t.item){i.splice(t.index,0,t.item);if(n instanceof CollectionView&&n.trackChanges){let e=t.item;assert(n.itemsRemoved.indexOf(e)>-1,"item should be in the itemsRemoved list");n.itemsRemoved.remove(e);this._edtIndex>-1&&n.itemsEdited.indexOf(e)<0&&n.itemsEdited.push(e)}}else{i.splice(t.index,1);if(n instanceof CollectionView&&n.trackChanges){let t=this._oldState.item;assert(n.itemsRemoved.indexOf(t)<0,"item should not be in the itemsRemoved list");n.itemsRemoved.push(t)}}n.refresh();n.moveCurrentToPosition(t.position);let s=new(softGrid().CellRange)(t.position,0,t.position,e.columns.length-1);e.select(s);this._focusScroll()}}shouldAddAsChildAction(t){return t instanceof GridRemoveRowAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100}}class ExpandCollapseColumnGroupAction extends UndoableAction{constructor(t,e){super(t);this._group=e.data;this._oldState=this._group.isCollapsed}get control(){return this._target}get group(){return this._group}close(){this._newState=this._group.isCollapsed;return this._newState!=this._oldState}applyState(t){this._group.isCollapsed=t;this._focusScroll()}}class TreeViewEditAction extends UndoableAction{constructor(t,e){super(t);this._nd=e.node;this._oldState=this._getNodeText()}get control(){return this._target}get node(){return this._nd}close(){this._newState=this._getNodeText();return this._newState!=this._oldState}applyState(t){this._nd.select();this._setNodeText(t);this._target.focus()}_getNodeText(){let t=this._nd.dataItem[this._getDisplayMemberPath()];return null!=t?t.toString():""}_setNodeText(t){let e=this._nd,n=e.dataItem,i=this._getDisplayMemberPath(),s=e.element.querySelector(`.${TreeViewClsNames.nodeText}`);n[i]=t;e.treeView.isContentHtml?s.innerHTML=t:s.textContent=t}_getDisplayMemberPath(){let t=this._nd,e=t.treeView.displayMemberPath;e instanceof Array&&(e=e[t.level]);return e}}class TreeViewCheckAction extends UndoableAction{constructor(t,e){super(t);this._nd=e.node;this._oldState=this._nd.isChecked}get control(){return this._target}get node(){return this._nd}close(){this._newState=this._nd.isChecked;return this._newState!=this._oldState}applyState(t){this._nd.select();this._nd.isChecked=t;this._target.focus()}}_registerModule("wijmo.undo",selfModule);
package/es5-esm.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * Wijmo Library 5.20242.23-nightly.d20241008.t020138
3
+ * Wijmo Library 5.20242.23-nightly.d20241009.t020146
4
4
  * https://developer.mescius.com/wijmo
5
5
  *
6
6
  * Copyright(c) MESCIUS inc. All rights reserved.
@@ -11,4 +11,4 @@
11
11
  *
12
12
  */
13
13
 
14
- var __extends=this&&this.__extends||function(){var extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};return function(t,e){extendStatics(t,e);function __(){this.constructor=t}t.prototype=null===e?Object.create(e):(__.prototype=e.prototype,new __)}}();import{_getModule,CancelEventArgs,Control,isFunction,assert,getActiveElement,CollectionView,DateTime,isArray,isDate,isString,asNumber,asBoolean,hasClass,copy,getElement,getEventOptions,contains,Event,EventArgs,_registerModule}from"@mescius/wijmo";import{_NewRowTemplate,ColumnGroup}from"@mescius/wijmo.grid";import*as selfModule from"@mescius/wijmo.undo";var UndoableAction=function(){function UndoableAction(t){this._target=t}UndoableAction.prototype.undo=function(){if(this._actions)for(var t=this._actions.length-1;t>=0;t--)this._actions[t].undo();this.applyState(this._oldState)};UndoableAction.prototype.redo=function(){this.applyState(this._newState);this._actions&&this._actions.forEach((function(t){t.redo()}))};UndoableAction.prototype.close=function(){return!0};UndoableAction.prototype.applyState=function(t){};UndoableAction.prototype.shouldAddAsChildAction=function(t){return!1};UndoableAction.prototype.addChildAction=function(t){this._actions||(this._actions=[]);this._actions.push(t)};Object.defineProperty(UndoableAction.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0});UndoableAction.prototype._focusScroll=function(){var t=this._target;if(t instanceof Control){t.hostElement&&t.hostElement.scrollIntoView();t.focus()}else if(t instanceof HTMLElement){t.focus();isFunction(t.select)&&t.select()}};return UndoableAction}();export{UndoableAction};var _UndoStackHTML=function(){function _UndoStackHTML(){}_UndoStackHTML.addTarget=function(t,e){var n=_UndoStackHTML;if(e instanceof HTMLInputElement)return n._addInputElement(t,e);if(e instanceof HTMLTextAreaElement)return n._addTextAreaElement(t,e);if(e instanceof HTMLSelectElement)return n._addSelectElement(t,e);for(var o=!1,i=0;i<e.children.length;i++){var r=e.children[i];r instanceof HTMLElement&&t.addTarget(r)&&(o=!0)}return o};_UndoStackHTML._addInputElement=function(t,e){var n=null;if("checkbox"==e.type)e.addEventListener("click",(function(e){t.pushAction(new CheckboxClickAction(e))}));else{if("radio"==e.type){e.addEventListener("mousedown",(function(t){n=new RadioClickAction(t)}),!0);var o=_UndoStackHTML._getLabel(e);o&&o.addEventListener("mousedown",(function(t){n=new RadioClickAction({target:e})}),!0);e.addEventListener("focus",(function(t){n instanceof RadioClickAction&&n.target==t.target||(n=new RadioClickAction(t))}));e.addEventListener("click",(function(e){if(n instanceof RadioClickAction){t.pushAction(n);n=null}}));return!0}if("range"==e.type){e.addEventListener("mousedown",(function(t){var o=getActiveElement();o instanceof HTMLElement&&o!=e&&o.blur();n=new InputChangeAction(t)}));e.addEventListener("mouseup",(function(o){if(n instanceof InputChangeAction&&getActiveElement()!=e){n._focus=!1;t.pushAction(n);n=null}}))}e.addEventListener("focus",(function(t){null==n&&(n=new InputChangeAction(t))}));e.addEventListener("blur",(function(e){if(n instanceof InputChangeAction){t.pushAction(n);n=null}}))}return!0};_UndoStackHTML._addTextAreaElement=function(t,e){var n=null;e.addEventListener("focus",(function(t){n=new InputChangeAction(t)}));e.addEventListener("blur",(function(e){if(n instanceof InputChangeAction){t.pushAction(n);n=null}}));return!0};_UndoStackHTML._addSelectElement=function(t,e){var n=null;e.addEventListener("focus",(function(t){n=new InputChangeAction(t)}));e.addEventListener("blur",(function(e){if(n instanceof InputChangeAction){t.pushAction(n);n=null}}));return!0};_UndoStackHTML._getLabel=function(t){var e=t.parentElement;e instanceof HTMLLabelElement||(e=document.querySelector('label[for="'+t.id+'"'));return e};return _UndoStackHTML}();export{_UndoStackHTML};var InputChangeAction=function(t){__extends(InputChangeAction,t);function InputChangeAction(e){var n=t.call(this,e.target)||this;n._focus=!0;n._oldState=n._target.value;return n}InputChangeAction.prototype.close=function(){this._newState=this._target.value;return this._newState!=this._oldState};InputChangeAction.prototype.applyState=function(t){var e=this._target;e.value=t;e.dispatchEvent(UndoStack._evtInput);this._focus&&this._focusScroll()};return InputChangeAction}(UndoableAction);export{InputChangeAction};var CheckboxClickAction=function(t){__extends(CheckboxClickAction,t);function CheckboxClickAction(e){var n=t.call(this,e.target)||this;assert("checkbox"==n._target.type,"checkbox expected");n._newState=n._target.checked;n._oldState=!n._newState;return n}CheckboxClickAction.prototype.applyState=function(t){this._target.checked=t;this._target.focus()};return CheckboxClickAction}(UndoableAction);export{CheckboxClickAction};var RadioClickAction=function(t){__extends(RadioClickAction,t);function RadioClickAction(e){var n=t.call(this,e.target)||this,o=n._target.type;assert("radio"==o,"radio button expected");n._oldState=n._getState();return n}RadioClickAction.prototype.close=function(){this._newState=this._getState();return this._newState!=this._oldState};RadioClickAction.prototype.applyState=function(t){if(t){t.checked=!0;t.focus()}};RadioClickAction.prototype._getState=function(){for(var t='input[name="'+this._target.name+'"]',e=document.querySelectorAll(t),n=0;n<e.length;n++)if(e[n].checked)return e[n];return null};return RadioClickAction}(UndoableAction);export{RadioClickAction};var UndoStack=function(){function UndoStack(t,e){var n=this;this._autoKbd=!0;this._stack=[];this._maxActions=1e3;this._ptr=0;this.addingTarget=new Event;this.addedTarget=new Event;this.addingAction=new Event;this.addedAction=new Event;this.undoingAction=new Event;this.undoneAction=new Event;this.redoingAction=new Event;this.redoneAction=new Event;this.stateChanged=new Event;if(!UndoStack._evtInput){var o=document.createEvent("HTMLEvents");o.initEvent("input",!0,!1);UndoStack._evtInput=o}copy(this,e);t=getElement(t||document.body);this.addTarget(t);document.addEventListener("keydown",(function(e){var o=navigator.platform.toUpperCase().indexOf("MAC")>=0?e.metaKey:e.ctrlKey;if(n._autoKbd&&o&&!e.defaultPrevented&&contains(t,e.target))if(e.shiftKey&&90===e.keyCode){if(n.canRedo){getActiveElement().blur();setTimeout((function(){return n.redo()}),100)}e.preventDefault()}else switch(e.keyCode){case 90:if(n.canUndo){getActiveElement().blur();setTimeout((function(){return n.undo()}),100)}e.preventDefault();break;case 89:if(n.canRedo){getActiveElement().blur();setTimeout((function(){return n.redo()}),100)}e.preventDefault()}}),getEventOptions(!0,!1))}UndoStack.prototype.addTarget=function(t){var e=!1;if(isString(t)){for(var n=document.querySelectorAll(t),o=!1,i=0;i<n.length;i++)this.addTarget(n[i])&&(o=!0);return o}assert(t instanceof HTMLElement,"Undo target should be an HTML element");var r=new AddTargetEventArgs(t);r.cancel=hasClass(t,"wj-no-undo");if(this.onAddingTarget(r)){var c=Control.getControl(t);c&&(e=_UndoStackWijmo.addTarget(this,c));e||(e=_UndoStackHTML.addTarget(this,t));e&&this.onAddedTarget(r)}return e};Object.defineProperty(UndoStack.prototype,"autoKeyboard",{get:function(){return this._autoKbd},set:function(t){this._autoKbd=asBoolean(t)},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"isDisabled",{get:function(){return this._disabled},set:function(t){this._disabled=asBoolean(t)},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"maxActions",{get:function(){return this._maxActions},set:function(t){if(t!=this._maxActions){this._maxActions=asNumber(t,!1,!0);this.clear()}},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"actionCount",{get:function(){return this._stack.length},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"canUndo",{get:function(){return this._stack.length>0&&this._ptr>0&&!this._disabled},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"canRedo",{get:function(){return this._stack.length>0&&this._ptr<this._stack.length&&!this._disabled},enumerable:!0,configurable:!0});UndoStack.prototype.undo=function(){if(this.canUndo){var t=this._stack[this._ptr-1],e=new UndoActionEventArgs(t);if(this.onUndoingAction(e)){this._ptr--;this._undoing=!0;t.undo();this._undoing=!1;this._pendingAction=null;this.onUndoneAction(e);this.onStateChanged()}}};UndoStack.prototype.redo=function(){if(this.canRedo){var t=this._stack[this._ptr],e=new UndoActionEventArgs(t);if(this.onRedoingAction(e)){this._ptr++;this._undoing=!0;t.redo();this._undoing=!1;this._pendingAction=null;this.onRedoneAction(e);this.onStateChanged()}}};UndoStack.prototype.clear=function(){this._ptr=0;this._stack.splice(0,this._stack.length);this.onStateChanged()};UndoStack.prototype.pushAction=function(t){this._pendingAction=t;this.pushPendingAction()};UndoStack.prototype.onAddingTarget=function(t){this.addingTarget.raise(this,t);return!t.cancel};UndoStack.prototype.onAddedTarget=function(t){this.addedTarget.raise(this,t)};UndoStack.prototype.onAddingAction=function(t){this.addingAction.raise(this,t);return!t.cancel};UndoStack.prototype.onAddedAction=function(t){this.addedAction.raise(this,t)};UndoStack.prototype.onUndoingAction=function(t){this.undoingAction.raise(this,t);return!t.cancel};UndoStack.prototype.onUndoneAction=function(t){this.undoneAction.raise(this,t)};UndoStack.prototype.onRedoingAction=function(t){this.redoingAction.raise(this,t);return!t.cancel};UndoStack.prototype.onRedoneAction=function(t){this.redoneAction.raise(this,t)};UndoStack.prototype.onStateChanged=function(){this.stateChanged.raise(this,EventArgs.empty)};UndoStack.prototype.pushPendingAction=function(){if(!this._disabled&&!this._undoing&&this._pendingAction&&this._pendingAction.close()){this._stack.splice(this._ptr,this._stack.length-this._ptr);assert(this._stack.length==this._ptr,"should be at the end of the stack");if(this._stack.length){var t=this._stack[this._ptr-1];if(t.shouldAddAsChildAction(this._pendingAction)){t.addChildAction(this._pendingAction);this._pendingAction=null;this.onStateChanged();return}}var e=new UndoActionEventArgs(this._pendingAction);if(!this.onAddingAction(e))return;this._stack.push(this._pendingAction);this._ptr++;this._pendingAction=null;var n=this._stack.length-this._maxActions;if(n>0){this._stack.splice(0,n);this._ptr-=n;assert(this._ptr>=0,"pointer should not be negative")}this.onStateChanged()}};return UndoStack}();export{UndoStack};var AddTargetEventArgs=function(t){__extends(AddTargetEventArgs,t);function AddTargetEventArgs(e){var n=t.call(this)||this;n._target=e;return n}Object.defineProperty(AddTargetEventArgs.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0});return AddTargetEventArgs}(CancelEventArgs);export{AddTargetEventArgs};var UndoActionEventArgs=function(t){__extends(UndoActionEventArgs,t);function UndoActionEventArgs(e){var n=t.call(this)||this;n._action=e;return n}Object.defineProperty(UndoActionEventArgs.prototype,"action",{get:function(){return this._action},enumerable:!0,configurable:!0});return UndoActionEventArgs}(CancelEventArgs);export{UndoActionEventArgs};export function softInput(){return _getModule("wijmo.input")}export function softGrid(){return _getModule("wijmo.grid")}export function softGauge(){return _getModule("wijmo.gauge")}export function softNav(){return _getModule("wijmo.nav")}var _UndoStackWijmo=function(){function _UndoStackWijmo(){}_UndoStackWijmo.addTarget=function(t,e){var n=_UndoStackWijmo;return softGrid()&&e instanceof softGrid().FlexGrid?n._addFlexGrid(t,e):softGauge()&&e instanceof softGauge().Gauge?n._addGauge(t,e):softNav()&&e instanceof softNav().TreeView?n._addTreeView(t,e):!!n._isInputControl(e)&&n._addInputControl(t,e)};_UndoStackWijmo._isInputControl=function(t){var e=softInput();return!!e&&(t instanceof e.DropDown||t instanceof e.InputMask||t instanceof e.InputNumber||t instanceof e.Calendar||t instanceof e.ColorPicker)};_UndoStackWijmo._addInputControl=function(t,e){var n=null;e.gotFocus.addHandler((function(){n=new InputControlChangeAction({target:e})}));e.lostFocus.addHandler((function(){if(n instanceof InputControlChangeAction){t.pushAction(n);n=null}}));return!0};_UndoStackWijmo._addGauge=function(t,e){if(!e.isReadOnly){var n=null;e.hostElement.addEventListener("focus",(function(){n||(n=new GaugeChangeAction(e))}));e.lostFocus.addHandler((function(){if(n instanceof GaugeChangeAction){t.pushAction(n);n=null}}));return!0}return!1};_UndoStackWijmo._addTreeView=function(t,e){var n=null;e.nodeEditStarted.addHandler((function(t,e){n=new TreeViewEditAction(t,e)}));e.nodeEditEnded.addHandler((function(e,o){if(n instanceof TreeViewEditAction){t.pushAction(n);n=null}}));e.isCheckedChanging.addHandler((function(t,e){n=new TreeViewCheckAction(t,e)}));e.isCheckedChanged.addHandler((function(e,o){if(n instanceof TreeViewCheckAction){t.pushAction(n);n=null}}));return!0};_UndoStackWijmo._addFlexGrid=function(t,e){var n=null;e.beginningEdit.addHandler((function(t,e){n=e.getRow()instanceof _NewRowTemplate?null:new GridEditAction(t,e)}));e.cellEditEnded.addHandler((function(e,o){if(n instanceof GridEditAction){t.pushAction(n);n=null}}));e.pastingCell.addHandler((function(t,e){n=e.getRow()?new GridEditAction(t,e):null}));e.pastedCell.addHandler((function(e,o){if(n instanceof GridEditAction){t.pushAction(n);n=null}}));e.sortingColumn.addHandler((function(t,e){n=new GridSortAction(t,e)}));e.sortedColumn.addHandler((function(e,o){if(n instanceof GridSortAction){t.pushAction(n);n=null}}));e.resizingColumn.addHandler((function(t,e){n instanceof GridResizeAction||(n=new GridResizeAction(t,e))}));e.resizedColumn.addHandler((function(){if(n instanceof GridResizeAction){t.pushAction(n);n=null}}));e.autoSizingColumn.addHandler((function(t,e){n=new GridResizeAction(t,e)}));e.autoSizedColumn.addHandler((function(){if(n instanceof GridResizeAction){t.pushAction(n);n=null}}));e.draggingColumn.addHandler((function(t,e){n=new GridDragAction(t,e)}));e.draggedColumn.addHandler((function(e,o){if(n instanceof GridDragAction){t.pushAction(n);n=null}}));e.rowAdded.addHandler((function(e,n){n.cancel||t.pushAction(new GridAddRowAction(e,n))}));e.deletingRow.addHandler((function(e,n){n.cancel||t.pushAction(new GridRemoveRowAction(e,n))}));e.columnGroupCollapsedChanging.addHandler((function(t,e){n=new ExpandCollapseColumnGroupAction(t,e)}));e.columnGroupCollapsedChanged.addHandler((function(e,o){if(n instanceof ExpandCollapseColumnGroupAction){t.pushAction(n);n=null}}));return!0};return _UndoStackWijmo}();export{_UndoStackWijmo};var InputControlChangeAction=function(t){__extends(InputControlChangeAction,t);function InputControlChangeAction(e){var n=t.call(this,e)||this;n._ctl=e.target;n._oldState=n._getControlState();return n}Object.defineProperty(InputControlChangeAction.prototype,"control",{get:function(){return this._ctl},enumerable:!0,configurable:!0});InputControlChangeAction.prototype.close=function(){this._timeStamp=Date.now();this._newState=this._getControlState();return!this._sameContent(this._oldState,this._newState)};InputControlChangeAction.prototype.shouldAddAsChildAction=function(t){if(t instanceof InputControlChangeAction&&t.target==this.target&&t._timeStamp-this._timeStamp<500){this._timeStamp=Date.now();return!0}return!1};InputControlChangeAction.prototype.applyState=function(t){var e=this._ctl,n=softInput();if(n){var o=e instanceof n.Calendar||e instanceof n.InputDate;o&&e.selectionMode!=n.DateSelectionMode.Range&&(o=!1);if(e instanceof n.MultiSelect)e.checkedItems=t;else if(e instanceof n.MultiAutoComplete)e.selectedItems=t;else if(o){e.value=t[0];e.rangeEnd=t[1]}else"value"in e?e.value=t:"text"in e?e.text=t:assert(!1,"can't apply control state?");e.focus()}};InputControlChangeAction.prototype._getControlState=function(){var t=this._ctl,e=softInput();if(e){var n=t instanceof e.Calendar||t instanceof e.InputDate;n&&t.selectionMode!=e.DateSelectionMode.Range&&(n=!1);if(t instanceof e.MultiSelect)return t.checkedItems.slice();if(t instanceof e.MultiAutoComplete)return t.selectedItems.slice();if(n)return[t.value,t.rangeEnd];if("value"in t)return t.value;if("text"in t)return t.text;assert(!1,"can't get control state?")}};InputControlChangeAction.prototype._sameContent=function(t,e){if(isArray(t)&&isArray(e)){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!=e[n])return!1;return!0}return isDate(t)||isDate(e)?DateTime.sameDate(t,e):t==e};return InputControlChangeAction}(InputChangeAction),GaugeChangeAction=function(t){__extends(GaugeChangeAction,t);function GaugeChangeAction(e){var n=t.call(this,e)||this;n._oldState=e.value;return n}Object.defineProperty(GaugeChangeAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});GaugeChangeAction.prototype.close=function(){this._newState=this._target.value;return this._newState!=this._oldState};GaugeChangeAction.prototype.applyState=function(t){var e=this._target;e.value=t;e.focus()};return GaugeChangeAction}(UndoableAction),GridEditAction=function(t){__extends(GridEditAction,t);function GridEditAction(e,n){var o=t.call(this,e)||this;o._dataItems=[];for(var i=e.collectionView,r=o._rng=n.range,c=r.topRow;c<=r.bottomRow;c++)o._dataItems.push(e.rows[c].dataItem);o._page=i instanceof CollectionView?i.pageIndex:-1;o._oldState=e.getCellData(n.row,n.col,!1);return o}Object.defineProperty(GridEditAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"range",{get:function(){return this._rng.clone()},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"row",{get:function(){return this._rng.topRow},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"col",{get:function(){return this._rng.leftCol},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"dataItem",{get:function(){return this._dataItems[0]},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"dataItems",{get:function(){return this._dataItems},enumerable:!0,configurable:!0});GridEditAction.prototype.close=function(){var t=this._target.collectionView;if(t&&t.currentAddItem)return!1;this._timeStamp=Date.now();this._newState=this._target.getCellData(this.row,this.col,!1);return this._newState!=this._oldState};GridEditAction.prototype.applyState=function(t){var e=this,n=this._target,o=n.editableCollectionView;if(o){o instanceof CollectionView&&this._page>-1&&o.moveToPage(this._page);n.deferUpdate((function(){e._dataItems.forEach((function(i){o.editItem(i);for(var r=e._rng.leftCol;r<=e._rng.rightCol;r++){var c=n.columns[r],a=n._getBindingColumn(n.cells,e.row,c);a&&a._binding&&a._binding.setValue(i,t)}o.commitEdit()}))}))}n.select(this.row,this.col);this._focusScroll()};GridEditAction.prototype.shouldAddAsChildAction=function(t){return t instanceof GridEditAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100};return GridEditAction}(UndoableAction),GridSortAction=function(t){__extends(GridSortAction,t);function GridSortAction(e,n){var o=t.call(this,e)||this,i=o._target.collectionView;i&&(o._oldState=i.sortDescriptions.slice());return o}Object.defineProperty(GridSortAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});GridSortAction.prototype.close=function(){var t=this._target.collectionView;if(t){this._newState=t.sortDescriptions.slice();return!0}return!1};GridSortAction.prototype.applyState=function(t){var e=this._target.collectionView;e&&e.deferUpdate((function(){var n=e.sortDescriptions;n.clear();t.forEach((function(t){n.push(t)}))}));this._focusScroll()};return GridSortAction}(UndoableAction),GridResizeAction=function(t){__extends(GridResizeAction,t);function GridResizeAction(e,n){var o=t.call(this,e)||this;o._col=e.columns[n.col];o._oldState=o._col.renderWidth;return o}Object.defineProperty(GridResizeAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(GridResizeAction.prototype,"col",{get:function(){return this._col},enumerable:!0,configurable:!0});GridResizeAction.prototype.close=function(){this._timeStamp=Date.now();this._newState=this._col.renderWidth;return this._newState!=this._oldState};GridResizeAction.prototype.applyState=function(t){this._col.width=t;this._focusScroll()};GridResizeAction.prototype.shouldAddAsChildAction=function(t){return t instanceof GridResizeAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100};return GridResizeAction}(UndoableAction),GridDragAction=function(t){__extends(GridDragAction,t);function GridDragAction(e,n){var o=t.call(this,e)||this;o._col=n.getColumn(!0);o._oldState=o._getState(o._col);return o}Object.defineProperty(GridDragAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(GridDragAction.prototype,"col",{get:function(){return this._col},enumerable:!0,configurable:!0});GridDragAction.prototype.close=function(){this._newState=this._getState(this._col);return!this._areStatesEqual(this._newState,this._oldState)};GridDragAction.prototype.applyState=function(t){var e=this,n=this._col;n.grid.deferUpdate((function(){var o=e._getState(n);o.coll.splice(o.idx,1);t.coll.splice(t.idx,0,n)}));this._focusScroll()};GridDragAction.prototype._getState=function(t){var e=t instanceof ColumnGroup?t.parentGroup?t.parentGroup.columns:this.target.getColumnGroups():t.grid.columns;return{coll:e,idx:e.indexOf(t)}};GridDragAction.prototype._areStatesEqual=function(t,e){return t.coll===e.coll&&t.idx===e.idx};return GridDragAction}(UndoableAction),GridAddRowAction=function(t){__extends(GridAddRowAction,t);function GridAddRowAction(e,n){var o=t.call(this,e)||this,i=o._target.collectionView;if(i&&i.currentAddItem){var r=i.currentAddItem,c=i.sourceCollection.indexOf(r),a=i.currentPosition;o._oldState={item:r,index:c,position:a};o._newState={index:c,position:a}}return o}Object.defineProperty(GridAddRowAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});GridAddRowAction.prototype.close=function(){return null!=this._oldState};GridAddRowAction.prototype.applyState=function(t){var e=this._target.collectionView;if(e){var n=e.sourceCollection;if(t.item){n.splice(t.index,1);if(e instanceof CollectionView&&e.trackChanges){var o=t.item;assert(e.itemsAdded.indexOf(o)>-1,"item should be in the itemsAdded list");e.itemsAdded.remove(o)}}else{o=this._oldState.item;n.splice(t.index,0,o);if(e instanceof CollectionView&&e.trackChanges){assert(e.itemsAdded.indexOf(o)<0,"item should not be in the itemsAdded list");e.itemsAdded.push(o)}}e.refresh();e.moveCurrentToPosition(t.position);this._focusScroll()}};return GridAddRowAction}(UndoableAction),GridRemoveRowAction=function(t){__extends(GridRemoveRowAction,t);function GridRemoveRowAction(e,n){var o=t.call(this,e)||this;o._edtIndex=-1;var i=o._target.collectionView;if(i){var r=e.rows[n.row].dataItem,c=i.sourceCollection.indexOf(r),a=i.currentPosition;i instanceof CollectionView&&i.trackChanges&&(o._edtIndex=i.itemsEdited.indexOf(r));o._oldState={item:r,index:c,position:a};o._newState={index:c,position:a}}return o}Object.defineProperty(GridRemoveRowAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(GridRemoveRowAction.prototype,"dataItem",{get:function(){return this._oldState.item},enumerable:!0,configurable:!0});GridRemoveRowAction.prototype.close=function(){this._timeStamp=Date.now();return null!=this._oldState};GridRemoveRowAction.prototype.applyState=function(t){var e=this._target,n=e.collectionView;if(n){var o=n.sourceCollection;if(t.item){o.splice(t.index,0,t.item);if(n instanceof CollectionView&&n.trackChanges){var i=t.item;assert(n.itemsRemoved.indexOf(i)>-1,"item should be in the itemsRemoved list");n.itemsRemoved.remove(i);this._edtIndex>-1&&n.itemsEdited.indexOf(i)<0&&n.itemsEdited.push(i)}}else{o.splice(t.index,1);if(n instanceof CollectionView&&n.trackChanges){i=this._oldState.item;assert(n.itemsRemoved.indexOf(i)<0,"item should not be in the itemsRemoved list");n.itemsRemoved.push(i)}}n.refresh();n.moveCurrentToPosition(t.position);var r=new(softGrid().CellRange)(t.position,0,t.position,e.columns.length-1);e.select(r);this._focusScroll()}};GridRemoveRowAction.prototype.shouldAddAsChildAction=function(t){return t instanceof GridRemoveRowAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100};return GridRemoveRowAction}(UndoableAction),ExpandCollapseColumnGroupAction=function(t){__extends(ExpandCollapseColumnGroupAction,t);function ExpandCollapseColumnGroupAction(e,n){var o=t.call(this,e)||this;o._group=n.data;o._oldState=o._group.isCollapsed;return o}Object.defineProperty(ExpandCollapseColumnGroupAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(ExpandCollapseColumnGroupAction.prototype,"group",{get:function(){return this._group},enumerable:!0,configurable:!0});ExpandCollapseColumnGroupAction.prototype.close=function(){this._newState=this._group.isCollapsed;return this._newState!=this._oldState};ExpandCollapseColumnGroupAction.prototype.applyState=function(t){this._group.isCollapsed=t;this._focusScroll()};return ExpandCollapseColumnGroupAction}(UndoableAction),TreeViewEditAction=function(t){__extends(TreeViewEditAction,t);function TreeViewEditAction(e,n){var o=t.call(this,e)||this;o._nd=n.node;o._oldState=o._getNodeText();return o}Object.defineProperty(TreeViewEditAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(TreeViewEditAction.prototype,"node",{get:function(){return this._nd},enumerable:!0,configurable:!0});TreeViewEditAction.prototype.close=function(){this._newState=this._getNodeText();return this._newState!=this._oldState};TreeViewEditAction.prototype.applyState=function(t){this._nd.select();this._setNodeText(t);this._target.focus()};TreeViewEditAction.prototype._getNodeText=function(){var t=this._nd.dataItem[this._getDisplayMemberPath()];return null!=t?t.toString():""};TreeViewEditAction.prototype._setNodeText=function(t){var e=this._nd,n=e.dataItem,o=this._getDisplayMemberPath(),i=e.element.querySelector(".wj-node-text");n[o]=t;e.treeView.isContentHtml?i.innerHTML=t:i.textContent=t};TreeViewEditAction.prototype._getDisplayMemberPath=function(){var t=this._nd,e=t.treeView.displayMemberPath;e instanceof Array&&(e=e[t.level]);return e};return TreeViewEditAction}(UndoableAction),TreeViewCheckAction=function(t){__extends(TreeViewCheckAction,t);function TreeViewCheckAction(e,n){var o=t.call(this,e)||this;o._nd=n.node;o._oldState=o._nd.isChecked;return o}Object.defineProperty(TreeViewCheckAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(TreeViewCheckAction.prototype,"node",{get:function(){return this._nd},enumerable:!0,configurable:!0});TreeViewCheckAction.prototype.close=function(){this._newState=this._nd.isChecked;return this._newState!=this._oldState};TreeViewCheckAction.prototype.applyState=function(t){this._nd.select();this._nd.isChecked=t;this._target.focus()};return TreeViewCheckAction}(UndoableAction);_registerModule("wijmo.undo",selfModule);
14
+ var __extends=this&&this.__extends||function(){var extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};return function(t,e){extendStatics(t,e);function __(){this.constructor=t}t.prototype=null===e?Object.create(e):(__.prototype=e.prototype,new __)}}();import{_getModule,CancelEventArgs,Control,isFunction,assert,getActiveElement,CollectionView,DateTime,isArray,isDate,isString,asNumber,asBoolean,hasClass,copy,getElement,getEventOptions,contains,Event,EventArgs,_registerModule}from"@mescius/wijmo";import{_NewRowTemplate,ColumnGroup}from"@mescius/wijmo.grid";import{TreeViewClsNames}from"@mescius/wijmo.nav";import*as selfModule from"@mescius/wijmo.undo";var UndoableAction=function(){function UndoableAction(t){this._target=t}UndoableAction.prototype.undo=function(){if(this._actions)for(var t=this._actions.length-1;t>=0;t--)this._actions[t].undo();this.applyState(this._oldState)};UndoableAction.prototype.redo=function(){this.applyState(this._newState);this._actions&&this._actions.forEach((function(t){t.redo()}))};UndoableAction.prototype.close=function(){return!0};UndoableAction.prototype.applyState=function(t){};UndoableAction.prototype.shouldAddAsChildAction=function(t){return!1};UndoableAction.prototype.addChildAction=function(t){this._actions||(this._actions=[]);this._actions.push(t)};Object.defineProperty(UndoableAction.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0});UndoableAction.prototype._focusScroll=function(){var t=this._target;if(t instanceof Control){t.hostElement&&t.hostElement.scrollIntoView();t.focus()}else if(t instanceof HTMLElement){t.focus();isFunction(t.select)&&t.select()}};return UndoableAction}();export{UndoableAction};var _UndoStackHTML=function(){function _UndoStackHTML(){}_UndoStackHTML.addTarget=function(t,e){var n=_UndoStackHTML;if(e instanceof HTMLInputElement)return n._addInputElement(t,e);if(e instanceof HTMLTextAreaElement)return n._addTextAreaElement(t,e);if(e instanceof HTMLSelectElement)return n._addSelectElement(t,e);for(var o=!1,i=0;i<e.children.length;i++){var r=e.children[i];r instanceof HTMLElement&&t.addTarget(r)&&(o=!0)}return o};_UndoStackHTML._addInputElement=function(t,e){var n=null;if("checkbox"==e.type)e.addEventListener("click",(function(e){t.pushAction(new CheckboxClickAction(e))}));else{if("radio"==e.type){e.addEventListener("mousedown",(function(t){n=new RadioClickAction(t)}),!0);var o=_UndoStackHTML._getLabel(e);o&&o.addEventListener("mousedown",(function(t){n=new RadioClickAction({target:e})}),!0);e.addEventListener("focus",(function(t){n instanceof RadioClickAction&&n.target==t.target||(n=new RadioClickAction(t))}));e.addEventListener("click",(function(e){if(n instanceof RadioClickAction){t.pushAction(n);n=null}}));return!0}if("range"==e.type){e.addEventListener("mousedown",(function(t){var o=getActiveElement();o instanceof HTMLElement&&o!=e&&o.blur();n=new InputChangeAction(t)}));e.addEventListener("mouseup",(function(o){if(n instanceof InputChangeAction&&getActiveElement()!=e){n._focus=!1;t.pushAction(n);n=null}}))}e.addEventListener("focus",(function(t){null==n&&(n=new InputChangeAction(t))}));e.addEventListener("blur",(function(e){if(n instanceof InputChangeAction){t.pushAction(n);n=null}}))}return!0};_UndoStackHTML._addTextAreaElement=function(t,e){var n=null;e.addEventListener("focus",(function(t){n=new InputChangeAction(t)}));e.addEventListener("blur",(function(e){if(n instanceof InputChangeAction){t.pushAction(n);n=null}}));return!0};_UndoStackHTML._addSelectElement=function(t,e){var n=null;e.addEventListener("focus",(function(t){n=new InputChangeAction(t)}));e.addEventListener("blur",(function(e){if(n instanceof InputChangeAction){t.pushAction(n);n=null}}));return!0};_UndoStackHTML._getLabel=function(t){var e=t.parentElement;e instanceof HTMLLabelElement||(e=document.querySelector('label[for="'+t.id+'"'));return e};return _UndoStackHTML}();export{_UndoStackHTML};var InputChangeAction=function(t){__extends(InputChangeAction,t);function InputChangeAction(e){var n=t.call(this,e.target)||this;n._focus=!0;n._oldState=n._target.value;return n}InputChangeAction.prototype.close=function(){this._newState=this._target.value;return this._newState!=this._oldState};InputChangeAction.prototype.applyState=function(t){var e=this._target;e.value=t;e.dispatchEvent(UndoStack._evtInput);this._focus&&this._focusScroll()};return InputChangeAction}(UndoableAction);export{InputChangeAction};var CheckboxClickAction=function(t){__extends(CheckboxClickAction,t);function CheckboxClickAction(e){var n=t.call(this,e.target)||this;assert("checkbox"==n._target.type,"checkbox expected");n._newState=n._target.checked;n._oldState=!n._newState;return n}CheckboxClickAction.prototype.applyState=function(t){this._target.checked=t;this._target.focus()};return CheckboxClickAction}(UndoableAction);export{CheckboxClickAction};var RadioClickAction=function(t){__extends(RadioClickAction,t);function RadioClickAction(e){var n=t.call(this,e.target)||this,o=n._target.type;assert("radio"==o,"radio button expected");n._oldState=n._getState();return n}RadioClickAction.prototype.close=function(){this._newState=this._getState();return this._newState!=this._oldState};RadioClickAction.prototype.applyState=function(t){if(t){t.checked=!0;t.focus()}};RadioClickAction.prototype._getState=function(){for(var t='input[name="'+this._target.name+'"]',e=document.querySelectorAll(t),n=0;n<e.length;n++)if(e[n].checked)return e[n];return null};return RadioClickAction}(UndoableAction);export{RadioClickAction};export var UndoClsNames={noUndo:"wj-no-undo"};var UndoStack=function(){function UndoStack(t,e){var n=this;this._autoKbd=!0;this._stack=[];this._maxActions=1e3;this._ptr=0;this.addingTarget=new Event;this.addedTarget=new Event;this.addingAction=new Event;this.addedAction=new Event;this.undoingAction=new Event;this.undoneAction=new Event;this.redoingAction=new Event;this.redoneAction=new Event;this.stateChanged=new Event;if(!UndoStack._evtInput){var o=document.createEvent("HTMLEvents");o.initEvent("input",!0,!1);UndoStack._evtInput=o}copy(this,e);t=getElement(t||document.body);this.addTarget(t);document.addEventListener("keydown",(function(e){var o=navigator.platform.toUpperCase().indexOf("MAC")>=0?e.metaKey:e.ctrlKey;if(n._autoKbd&&o&&!e.defaultPrevented&&contains(t,e.target))if(e.shiftKey&&90===e.keyCode){if(n.canRedo){getActiveElement().blur();setTimeout((function(){return n.redo()}),100)}e.preventDefault()}else switch(e.keyCode){case 90:if(n.canUndo){getActiveElement().blur();setTimeout((function(){return n.undo()}),100)}e.preventDefault();break;case 89:if(n.canRedo){getActiveElement().blur();setTimeout((function(){return n.redo()}),100)}e.preventDefault()}}),getEventOptions(!0,!1))}UndoStack.prototype.addTarget=function(t){var e=!1;if(isString(t)){for(var n=document.querySelectorAll(t),o=!1,i=0;i<n.length;i++)this.addTarget(n[i])&&(o=!0);return o}assert(t instanceof HTMLElement,"Undo target should be an HTML element");var r=new AddTargetEventArgs(t);r.cancel=hasClass(t,UndoClsNames.noUndo);if(this.onAddingTarget(r)){var c=Control.getControl(t);c&&(e=_UndoStackWijmo.addTarget(this,c));e||(e=_UndoStackHTML.addTarget(this,t));e&&this.onAddedTarget(r)}return e};Object.defineProperty(UndoStack.prototype,"autoKeyboard",{get:function(){return this._autoKbd},set:function(t){this._autoKbd=asBoolean(t)},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"isDisabled",{get:function(){return this._disabled},set:function(t){this._disabled=asBoolean(t)},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"maxActions",{get:function(){return this._maxActions},set:function(t){if(t!=this._maxActions){this._maxActions=asNumber(t,!1,!0);this.clear()}},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"actionCount",{get:function(){return this._stack.length},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"canUndo",{get:function(){return this._stack.length>0&&this._ptr>0&&!this._disabled},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"canRedo",{get:function(){return this._stack.length>0&&this._ptr<this._stack.length&&!this._disabled},enumerable:!0,configurable:!0});UndoStack.prototype.undo=function(){if(this.canUndo){var t=this._stack[this._ptr-1],e=new UndoActionEventArgs(t);if(this.onUndoingAction(e)){this._ptr--;this._undoing=!0;t.undo();this._undoing=!1;this._pendingAction=null;this.onUndoneAction(e);this.onStateChanged()}}};UndoStack.prototype.redo=function(){if(this.canRedo){var t=this._stack[this._ptr],e=new UndoActionEventArgs(t);if(this.onRedoingAction(e)){this._ptr++;this._undoing=!0;t.redo();this._undoing=!1;this._pendingAction=null;this.onRedoneAction(e);this.onStateChanged()}}};UndoStack.prototype.clear=function(){this._ptr=0;this._stack.splice(0,this._stack.length);this.onStateChanged()};UndoStack.prototype.pushAction=function(t){this._pendingAction=t;this.pushPendingAction()};UndoStack.prototype.onAddingTarget=function(t){this.addingTarget.raise(this,t);return!t.cancel};UndoStack.prototype.onAddedTarget=function(t){this.addedTarget.raise(this,t)};UndoStack.prototype.onAddingAction=function(t){this.addingAction.raise(this,t);return!t.cancel};UndoStack.prototype.onAddedAction=function(t){this.addedAction.raise(this,t)};UndoStack.prototype.onUndoingAction=function(t){this.undoingAction.raise(this,t);return!t.cancel};UndoStack.prototype.onUndoneAction=function(t){this.undoneAction.raise(this,t)};UndoStack.prototype.onRedoingAction=function(t){this.redoingAction.raise(this,t);return!t.cancel};UndoStack.prototype.onRedoneAction=function(t){this.redoneAction.raise(this,t)};UndoStack.prototype.onStateChanged=function(){this.stateChanged.raise(this,EventArgs.empty)};UndoStack.prototype.pushPendingAction=function(){if(!this._disabled&&!this._undoing&&this._pendingAction&&this._pendingAction.close()){this._stack.splice(this._ptr,this._stack.length-this._ptr);assert(this._stack.length==this._ptr,"should be at the end of the stack");if(this._stack.length){var t=this._stack[this._ptr-1];if(t.shouldAddAsChildAction(this._pendingAction)){t.addChildAction(this._pendingAction);this._pendingAction=null;this.onStateChanged();return}}var e=new UndoActionEventArgs(this._pendingAction);if(!this.onAddingAction(e))return;this._stack.push(this._pendingAction);this._ptr++;this._pendingAction=null;var n=this._stack.length-this._maxActions;if(n>0){this._stack.splice(0,n);this._ptr-=n;assert(this._ptr>=0,"pointer should not be negative")}this.onStateChanged()}};return UndoStack}();export{UndoStack};var AddTargetEventArgs=function(t){__extends(AddTargetEventArgs,t);function AddTargetEventArgs(e){var n=t.call(this)||this;n._target=e;return n}Object.defineProperty(AddTargetEventArgs.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0});return AddTargetEventArgs}(CancelEventArgs);export{AddTargetEventArgs};var UndoActionEventArgs=function(t){__extends(UndoActionEventArgs,t);function UndoActionEventArgs(e){var n=t.call(this)||this;n._action=e;return n}Object.defineProperty(UndoActionEventArgs.prototype,"action",{get:function(){return this._action},enumerable:!0,configurable:!0});return UndoActionEventArgs}(CancelEventArgs);export{UndoActionEventArgs};export function softInput(){return _getModule("wijmo.input")}export function softGrid(){return _getModule("wijmo.grid")}export function softGauge(){return _getModule("wijmo.gauge")}export function softNav(){return _getModule("wijmo.nav")}var _UndoStackWijmo=function(){function _UndoStackWijmo(){}_UndoStackWijmo.addTarget=function(t,e){var n=_UndoStackWijmo;return softGrid()&&e instanceof softGrid().FlexGrid?n._addFlexGrid(t,e):softGauge()&&e instanceof softGauge().Gauge?n._addGauge(t,e):softNav()&&e instanceof softNav().TreeView?n._addTreeView(t,e):!!n._isInputControl(e)&&n._addInputControl(t,e)};_UndoStackWijmo._isInputControl=function(t){var e=softInput();return!!e&&(t instanceof e.DropDown||t instanceof e.InputMask||t instanceof e.InputNumber||t instanceof e.Calendar||t instanceof e.ColorPicker)};_UndoStackWijmo._addInputControl=function(t,e){var n=null;e.gotFocus.addHandler((function(){n=new InputControlChangeAction({target:e})}));e.lostFocus.addHandler((function(){if(n instanceof InputControlChangeAction){t.pushAction(n);n=null}}));return!0};_UndoStackWijmo._addGauge=function(t,e){if(!e.isReadOnly){var n=null;e.hostElement.addEventListener("focus",(function(){n||(n=new GaugeChangeAction(e))}));e.lostFocus.addHandler((function(){if(n instanceof GaugeChangeAction){t.pushAction(n);n=null}}));return!0}return!1};_UndoStackWijmo._addTreeView=function(t,e){var n=null;e.nodeEditStarted.addHandler((function(t,e){n=new TreeViewEditAction(t,e)}));e.nodeEditEnded.addHandler((function(e,o){if(n instanceof TreeViewEditAction){t.pushAction(n);n=null}}));e.isCheckedChanging.addHandler((function(t,e){n=new TreeViewCheckAction(t,e)}));e.isCheckedChanged.addHandler((function(e,o){if(n instanceof TreeViewCheckAction){t.pushAction(n);n=null}}));return!0};_UndoStackWijmo._addFlexGrid=function(t,e){var n=null;e.beginningEdit.addHandler((function(t,e){n=e.getRow()instanceof _NewRowTemplate?null:new GridEditAction(t,e)}));e.cellEditEnded.addHandler((function(e,o){if(n instanceof GridEditAction){t.pushAction(n);n=null}}));e.pastingCell.addHandler((function(t,e){n=e.getRow()?new GridEditAction(t,e):null}));e.pastedCell.addHandler((function(e,o){if(n instanceof GridEditAction){t.pushAction(n);n=null}}));e.sortingColumn.addHandler((function(t,e){n=new GridSortAction(t,e)}));e.sortedColumn.addHandler((function(e,o){if(n instanceof GridSortAction){t.pushAction(n);n=null}}));e.resizingColumn.addHandler((function(t,e){n instanceof GridResizeAction||(n=new GridResizeAction(t,e))}));e.resizedColumn.addHandler((function(){if(n instanceof GridResizeAction){t.pushAction(n);n=null}}));e.autoSizingColumn.addHandler((function(t,e){n=new GridResizeAction(t,e)}));e.autoSizedColumn.addHandler((function(){if(n instanceof GridResizeAction){t.pushAction(n);n=null}}));e.draggingColumn.addHandler((function(t,e){n=new GridDragAction(t,e)}));e.draggedColumn.addHandler((function(e,o){if(n instanceof GridDragAction){t.pushAction(n);n=null}}));e.rowAdded.addHandler((function(e,n){n.cancel||t.pushAction(new GridAddRowAction(e,n))}));e.deletingRow.addHandler((function(e,n){n.cancel||t.pushAction(new GridRemoveRowAction(e,n))}));e.columnGroupCollapsedChanging.addHandler((function(t,e){n=new ExpandCollapseColumnGroupAction(t,e)}));e.columnGroupCollapsedChanged.addHandler((function(e,o){if(n instanceof ExpandCollapseColumnGroupAction){t.pushAction(n);n=null}}));return!0};return _UndoStackWijmo}();export{_UndoStackWijmo};var InputControlChangeAction=function(t){__extends(InputControlChangeAction,t);function InputControlChangeAction(e){var n=t.call(this,e)||this;n._ctl=e.target;n._oldState=n._getControlState();return n}Object.defineProperty(InputControlChangeAction.prototype,"control",{get:function(){return this._ctl},enumerable:!0,configurable:!0});InputControlChangeAction.prototype.close=function(){this._timeStamp=Date.now();this._newState=this._getControlState();return!this._sameContent(this._oldState,this._newState)};InputControlChangeAction.prototype.shouldAddAsChildAction=function(t){if(t instanceof InputControlChangeAction&&t.target==this.target&&t._timeStamp-this._timeStamp<500){this._timeStamp=Date.now();return!0}return!1};InputControlChangeAction.prototype.applyState=function(t){var e=this._ctl,n=softInput();if(n){var o=e instanceof n.Calendar||e instanceof n.InputDate;o&&e.selectionMode!=n.DateSelectionMode.Range&&(o=!1);if(e instanceof n.MultiSelect)e.checkedItems=t;else if(e instanceof n.MultiAutoComplete)e.selectedItems=t;else if(o){e.value=t[0];e.rangeEnd=t[1]}else"value"in e?e.value=t:"text"in e?e.text=t:assert(!1,"can't apply control state?");e.focus()}};InputControlChangeAction.prototype._getControlState=function(){var t=this._ctl,e=softInput();if(e){var n=t instanceof e.Calendar||t instanceof e.InputDate;n&&t.selectionMode!=e.DateSelectionMode.Range&&(n=!1);if(t instanceof e.MultiSelect)return t.checkedItems.slice();if(t instanceof e.MultiAutoComplete)return t.selectedItems.slice();if(n)return[t.value,t.rangeEnd];if("value"in t)return t.value;if("text"in t)return t.text;assert(!1,"can't get control state?")}};InputControlChangeAction.prototype._sameContent=function(t,e){if(isArray(t)&&isArray(e)){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!=e[n])return!1;return!0}return isDate(t)||isDate(e)?DateTime.sameDate(t,e):t==e};return InputControlChangeAction}(InputChangeAction),GaugeChangeAction=function(t){__extends(GaugeChangeAction,t);function GaugeChangeAction(e){var n=t.call(this,e)||this;n._oldState=e.value;return n}Object.defineProperty(GaugeChangeAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});GaugeChangeAction.prototype.close=function(){this._newState=this._target.value;return this._newState!=this._oldState};GaugeChangeAction.prototype.applyState=function(t){var e=this._target;e.value=t;e.focus()};return GaugeChangeAction}(UndoableAction),GridEditAction=function(t){__extends(GridEditAction,t);function GridEditAction(e,n){var o=t.call(this,e)||this;o._dataItems=[];for(var i=e.collectionView,r=o._rng=n.range,c=r.topRow;c<=r.bottomRow;c++)o._dataItems.push(e.rows[c].dataItem);o._page=i instanceof CollectionView?i.pageIndex:-1;o._oldState=e.getCellData(n.row,n.col,!1);return o}Object.defineProperty(GridEditAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"range",{get:function(){return this._rng.clone()},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"row",{get:function(){return this._rng.topRow},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"col",{get:function(){return this._rng.leftCol},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"dataItem",{get:function(){return this._dataItems[0]},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"dataItems",{get:function(){return this._dataItems},enumerable:!0,configurable:!0});GridEditAction.prototype.close=function(){var t=this._target.collectionView;if(t&&t.currentAddItem)return!1;this._timeStamp=Date.now();this._newState=this._target.getCellData(this.row,this.col,!1);return this._newState!=this._oldState};GridEditAction.prototype.applyState=function(t){var e=this,n=this._target,o=n.editableCollectionView;if(o){o instanceof CollectionView&&this._page>-1&&o.moveToPage(this._page);n.deferUpdate((function(){e._dataItems.forEach((function(i){o.editItem(i);for(var r=e._rng.leftCol;r<=e._rng.rightCol;r++){var c=n.columns[r],a=n._getBindingColumn(n.cells,e.row,c);a&&a._binding&&a._binding.setValue(i,t)}o.commitEdit()}))}))}n.select(this.row,this.col);this._focusScroll()};GridEditAction.prototype.shouldAddAsChildAction=function(t){return t instanceof GridEditAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100};return GridEditAction}(UndoableAction),GridSortAction=function(t){__extends(GridSortAction,t);function GridSortAction(e,n){var o=t.call(this,e)||this,i=o._target.collectionView;i&&(o._oldState=i.sortDescriptions.slice());return o}Object.defineProperty(GridSortAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});GridSortAction.prototype.close=function(){var t=this._target.collectionView;if(t){this._newState=t.sortDescriptions.slice();return!0}return!1};GridSortAction.prototype.applyState=function(t){var e=this._target.collectionView;e&&e.deferUpdate((function(){var n=e.sortDescriptions;n.clear();t.forEach((function(t){n.push(t)}))}));this._focusScroll()};return GridSortAction}(UndoableAction),GridResizeAction=function(t){__extends(GridResizeAction,t);function GridResizeAction(e,n){var o=t.call(this,e)||this;o._col=e.columns[n.col];o._oldState=o._col.renderWidth;return o}Object.defineProperty(GridResizeAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(GridResizeAction.prototype,"col",{get:function(){return this._col},enumerable:!0,configurable:!0});GridResizeAction.prototype.close=function(){this._timeStamp=Date.now();this._newState=this._col.renderWidth;return this._newState!=this._oldState};GridResizeAction.prototype.applyState=function(t){this._col.width=t;this._focusScroll()};GridResizeAction.prototype.shouldAddAsChildAction=function(t){return t instanceof GridResizeAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100};return GridResizeAction}(UndoableAction),GridDragAction=function(t){__extends(GridDragAction,t);function GridDragAction(e,n){var o=t.call(this,e)||this;o._col=n.getColumn(!0);o._oldState=o._getState(o._col);return o}Object.defineProperty(GridDragAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(GridDragAction.prototype,"col",{get:function(){return this._col},enumerable:!0,configurable:!0});GridDragAction.prototype.close=function(){this._newState=this._getState(this._col);return!this._areStatesEqual(this._newState,this._oldState)};GridDragAction.prototype.applyState=function(t){var e=this,n=this._col;n.grid.deferUpdate((function(){var o=e._getState(n);o.coll.splice(o.idx,1);t.coll.splice(t.idx,0,n)}));this._focusScroll()};GridDragAction.prototype._getState=function(t){var e=t instanceof ColumnGroup?t.parentGroup?t.parentGroup.columns:this.target.getColumnGroups():t.grid.columns;return{coll:e,idx:e.indexOf(t)}};GridDragAction.prototype._areStatesEqual=function(t,e){return t.coll===e.coll&&t.idx===e.idx};return GridDragAction}(UndoableAction),GridAddRowAction=function(t){__extends(GridAddRowAction,t);function GridAddRowAction(e,n){var o=t.call(this,e)||this,i=o._target.collectionView;if(i&&i.currentAddItem){var r=i.currentAddItem,c=i.sourceCollection.indexOf(r),a=i.currentPosition;o._oldState={item:r,index:c,position:a};o._newState={index:c,position:a}}return o}Object.defineProperty(GridAddRowAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});GridAddRowAction.prototype.close=function(){return null!=this._oldState};GridAddRowAction.prototype.applyState=function(t){var e=this._target.collectionView;if(e){var n=e.sourceCollection;if(t.item){n.splice(t.index,1);if(e instanceof CollectionView&&e.trackChanges){var o=t.item;assert(e.itemsAdded.indexOf(o)>-1,"item should be in the itemsAdded list");e.itemsAdded.remove(o)}}else{o=this._oldState.item;n.splice(t.index,0,o);if(e instanceof CollectionView&&e.trackChanges){assert(e.itemsAdded.indexOf(o)<0,"item should not be in the itemsAdded list");e.itemsAdded.push(o)}}e.refresh();e.moveCurrentToPosition(t.position);this._focusScroll()}};return GridAddRowAction}(UndoableAction),GridRemoveRowAction=function(t){__extends(GridRemoveRowAction,t);function GridRemoveRowAction(e,n){var o=t.call(this,e)||this;o._edtIndex=-1;var i=o._target.collectionView;if(i){var r=e.rows[n.row].dataItem,c=i.sourceCollection.indexOf(r),a=i.currentPosition;i instanceof CollectionView&&i.trackChanges&&(o._edtIndex=i.itemsEdited.indexOf(r));o._oldState={item:r,index:c,position:a};o._newState={index:c,position:a}}return o}Object.defineProperty(GridRemoveRowAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(GridRemoveRowAction.prototype,"dataItem",{get:function(){return this._oldState.item},enumerable:!0,configurable:!0});GridRemoveRowAction.prototype.close=function(){this._timeStamp=Date.now();return null!=this._oldState};GridRemoveRowAction.prototype.applyState=function(t){var e=this._target,n=e.collectionView;if(n){var o=n.sourceCollection;if(t.item){o.splice(t.index,0,t.item);if(n instanceof CollectionView&&n.trackChanges){var i=t.item;assert(n.itemsRemoved.indexOf(i)>-1,"item should be in the itemsRemoved list");n.itemsRemoved.remove(i);this._edtIndex>-1&&n.itemsEdited.indexOf(i)<0&&n.itemsEdited.push(i)}}else{o.splice(t.index,1);if(n instanceof CollectionView&&n.trackChanges){i=this._oldState.item;assert(n.itemsRemoved.indexOf(i)<0,"item should not be in the itemsRemoved list");n.itemsRemoved.push(i)}}n.refresh();n.moveCurrentToPosition(t.position);var r=new(softGrid().CellRange)(t.position,0,t.position,e.columns.length-1);e.select(r);this._focusScroll()}};GridRemoveRowAction.prototype.shouldAddAsChildAction=function(t){return t instanceof GridRemoveRowAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100};return GridRemoveRowAction}(UndoableAction),ExpandCollapseColumnGroupAction=function(t){__extends(ExpandCollapseColumnGroupAction,t);function ExpandCollapseColumnGroupAction(e,n){var o=t.call(this,e)||this;o._group=n.data;o._oldState=o._group.isCollapsed;return o}Object.defineProperty(ExpandCollapseColumnGroupAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(ExpandCollapseColumnGroupAction.prototype,"group",{get:function(){return this._group},enumerable:!0,configurable:!0});ExpandCollapseColumnGroupAction.prototype.close=function(){this._newState=this._group.isCollapsed;return this._newState!=this._oldState};ExpandCollapseColumnGroupAction.prototype.applyState=function(t){this._group.isCollapsed=t;this._focusScroll()};return ExpandCollapseColumnGroupAction}(UndoableAction),TreeViewEditAction=function(t){__extends(TreeViewEditAction,t);function TreeViewEditAction(e,n){var o=t.call(this,e)||this;o._nd=n.node;o._oldState=o._getNodeText();return o}Object.defineProperty(TreeViewEditAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(TreeViewEditAction.prototype,"node",{get:function(){return this._nd},enumerable:!0,configurable:!0});TreeViewEditAction.prototype.close=function(){this._newState=this._getNodeText();return this._newState!=this._oldState};TreeViewEditAction.prototype.applyState=function(t){this._nd.select();this._setNodeText(t);this._target.focus()};TreeViewEditAction.prototype._getNodeText=function(){var t=this._nd.dataItem[this._getDisplayMemberPath()];return null!=t?t.toString():""};TreeViewEditAction.prototype._setNodeText=function(t){var e=this._nd,n=e.dataItem,o=this._getDisplayMemberPath(),i=e.element.querySelector("."+TreeViewClsNames.nodeText);n[o]=t;e.treeView.isContentHtml?i.innerHTML=t:i.textContent=t};TreeViewEditAction.prototype._getDisplayMemberPath=function(){var t=this._nd,e=t.treeView.displayMemberPath;e instanceof Array&&(e=e[t.level]);return e};return TreeViewEditAction}(UndoableAction),TreeViewCheckAction=function(t){__extends(TreeViewCheckAction,t);function TreeViewCheckAction(e,n){var o=t.call(this,e)||this;o._nd=n.node;o._oldState=o._nd.isChecked;return o}Object.defineProperty(TreeViewCheckAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(TreeViewCheckAction.prototype,"node",{get:function(){return this._nd},enumerable:!0,configurable:!0});TreeViewCheckAction.prototype.close=function(){this._newState=this._nd.isChecked;return this._newState!=this._oldState};TreeViewCheckAction.prototype.applyState=function(t){this._nd.select();this._nd.isChecked=t;this._target.focus()};return TreeViewCheckAction}(UndoableAction);_registerModule("wijmo.undo",selfModule);
package/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * Wijmo Library 5.20242.23-nightly.d20241008.t020138
3
+ * Wijmo Library 5.20242.23-nightly.d20241009.t020146
4
4
  * https://developer.mescius.com/wijmo
5
5
  *
6
6
  * Copyright(c) MESCIUS inc. All rights reserved.
@@ -112,6 +112,9 @@ export declare class RadioClickAction extends UndoableAction {
112
112
  applyState(state: any): void;
113
113
  _getState(): Element;
114
114
  }
115
+ export declare const UndoClsNames: {
116
+ noUndo: string;
117
+ };
115
118
  /**
116
119
  * Class that provides undo/redo functionality for
117
120
  * input elements and Wijmo controls.
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  /*!
2
2
  *
3
- * Wijmo Library 5.20242.23-nightly.d20241008.t020138
3
+ * Wijmo Library 5.20242.23-nightly.d20241009.t020146
4
4
  * https://developer.mescius.com/wijmo
5
5
  *
6
6
  * Copyright(c) MESCIUS inc. All rights reserved.
@@ -11,4 +11,4 @@
11
11
  *
12
12
  */
13
13
 
14
- "use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};return function(t,e){extendStatics(t,e);function __(){this.constructor=t}t.prototype=null===e?Object.create(e):(__.prototype=e.prototype,new __)}}(),__importStar=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);e.default=t;return e};Object.defineProperty(exports,"__esModule",{value:!0});var wijmo_1=require("@mescius/wijmo"),wijmo_grid_1=require("@mescius/wijmo.grid"),selfModule=__importStar(require("@mescius/wijmo.undo")),UndoableAction=function(){function UndoableAction(t){this._target=t}UndoableAction.prototype.undo=function(){if(this._actions)for(var t=this._actions.length-1;t>=0;t--)this._actions[t].undo();this.applyState(this._oldState)};UndoableAction.prototype.redo=function(){this.applyState(this._newState);this._actions&&this._actions.forEach((function(t){t.redo()}))};UndoableAction.prototype.close=function(){return!0};UndoableAction.prototype.applyState=function(t){};UndoableAction.prototype.shouldAddAsChildAction=function(t){return!1};UndoableAction.prototype.addChildAction=function(t){this._actions||(this._actions=[]);this._actions.push(t)};Object.defineProperty(UndoableAction.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0});UndoableAction.prototype._focusScroll=function(){var t=this._target;if(t instanceof wijmo_1.Control){t.hostElement&&t.hostElement.scrollIntoView();t.focus()}else if(t instanceof HTMLElement){t.focus();wijmo_1.isFunction(t.select)&&t.select()}};return UndoableAction}();exports.UndoableAction=UndoableAction;var _UndoStackHTML=function(){function _UndoStackHTML(){}_UndoStackHTML.addTarget=function(t,e){var n=_UndoStackHTML;if(e instanceof HTMLInputElement)return n._addInputElement(t,e);if(e instanceof HTMLTextAreaElement)return n._addTextAreaElement(t,e);if(e instanceof HTMLSelectElement)return n._addSelectElement(t,e);for(var o=!1,i=0;i<e.children.length;i++){var r=e.children[i];r instanceof HTMLElement&&t.addTarget(r)&&(o=!0)}return o};_UndoStackHTML._addInputElement=function(t,e){var n=null;if("checkbox"==e.type)e.addEventListener("click",(function(e){t.pushAction(new CheckboxClickAction(e))}));else{if("radio"==e.type){e.addEventListener("mousedown",(function(t){n=new RadioClickAction(t)}),!0);var o=_UndoStackHTML._getLabel(e);o&&o.addEventListener("mousedown",(function(t){n=new RadioClickAction({target:e})}),!0);e.addEventListener("focus",(function(t){n instanceof RadioClickAction&&n.target==t.target||(n=new RadioClickAction(t))}));e.addEventListener("click",(function(e){if(n instanceof RadioClickAction){t.pushAction(n);n=null}}));return!0}if("range"==e.type){e.addEventListener("mousedown",(function(t){var o=wijmo_1.getActiveElement();o instanceof HTMLElement&&o!=e&&o.blur();n=new InputChangeAction(t)}));e.addEventListener("mouseup",(function(o){if(n instanceof InputChangeAction&&wijmo_1.getActiveElement()!=e){n._focus=!1;t.pushAction(n);n=null}}))}e.addEventListener("focus",(function(t){null==n&&(n=new InputChangeAction(t))}));e.addEventListener("blur",(function(e){if(n instanceof InputChangeAction){t.pushAction(n);n=null}}))}return!0};_UndoStackHTML._addTextAreaElement=function(t,e){var n=null;e.addEventListener("focus",(function(t){n=new InputChangeAction(t)}));e.addEventListener("blur",(function(e){if(n instanceof InputChangeAction){t.pushAction(n);n=null}}));return!0};_UndoStackHTML._addSelectElement=function(t,e){var n=null;e.addEventListener("focus",(function(t){n=new InputChangeAction(t)}));e.addEventListener("blur",(function(e){if(n instanceof InputChangeAction){t.pushAction(n);n=null}}));return!0};_UndoStackHTML._getLabel=function(t){var e=t.parentElement;e instanceof HTMLLabelElement||(e=document.querySelector('label[for="'+t.id+'"'));return e};return _UndoStackHTML}();exports._UndoStackHTML=_UndoStackHTML;var InputChangeAction=function(t){__extends(InputChangeAction,t);function InputChangeAction(e){var n=t.call(this,e.target)||this;n._focus=!0;n._oldState=n._target.value;return n}InputChangeAction.prototype.close=function(){this._newState=this._target.value;return this._newState!=this._oldState};InputChangeAction.prototype.applyState=function(t){var e=this._target;e.value=t;e.dispatchEvent(UndoStack._evtInput);this._focus&&this._focusScroll()};return InputChangeAction}(UndoableAction);exports.InputChangeAction=InputChangeAction;var CheckboxClickAction=function(t){__extends(CheckboxClickAction,t);function CheckboxClickAction(e){var n=t.call(this,e.target)||this;wijmo_1.assert("checkbox"==n._target.type,"checkbox expected");n._newState=n._target.checked;n._oldState=!n._newState;return n}CheckboxClickAction.prototype.applyState=function(t){this._target.checked=t;this._target.focus()};return CheckboxClickAction}(UndoableAction);exports.CheckboxClickAction=CheckboxClickAction;var RadioClickAction=function(t){__extends(RadioClickAction,t);function RadioClickAction(e){var n=t.call(this,e.target)||this,o=n._target.type;wijmo_1.assert("radio"==o,"radio button expected");n._oldState=n._getState();return n}RadioClickAction.prototype.close=function(){this._newState=this._getState();return this._newState!=this._oldState};RadioClickAction.prototype.applyState=function(t){if(t){t.checked=!0;t.focus()}};RadioClickAction.prototype._getState=function(){for(var t='input[name="'+this._target.name+'"]',e=document.querySelectorAll(t),n=0;n<e.length;n++)if(e[n].checked)return e[n];return null};return RadioClickAction}(UndoableAction);exports.RadioClickAction=RadioClickAction;var UndoStack=function(){function UndoStack(t,e){var n=this;this._autoKbd=!0;this._stack=[];this._maxActions=1e3;this._ptr=0;this.addingTarget=new wijmo_1.Event;this.addedTarget=new wijmo_1.Event;this.addingAction=new wijmo_1.Event;this.addedAction=new wijmo_1.Event;this.undoingAction=new wijmo_1.Event;this.undoneAction=new wijmo_1.Event;this.redoingAction=new wijmo_1.Event;this.redoneAction=new wijmo_1.Event;this.stateChanged=new wijmo_1.Event;if(!UndoStack._evtInput){var o=document.createEvent("HTMLEvents");o.initEvent("input",!0,!1);UndoStack._evtInput=o}wijmo_1.copy(this,e);t=wijmo_1.getElement(t||document.body);this.addTarget(t);document.addEventListener("keydown",(function(e){var o=navigator.platform.toUpperCase().indexOf("MAC")>=0?e.metaKey:e.ctrlKey;if(n._autoKbd&&o&&!e.defaultPrevented&&wijmo_1.contains(t,e.target))if(e.shiftKey&&90===e.keyCode){if(n.canRedo){wijmo_1.getActiveElement().blur();setTimeout((function(){return n.redo()}),100)}e.preventDefault()}else switch(e.keyCode){case 90:if(n.canUndo){wijmo_1.getActiveElement().blur();setTimeout((function(){return n.undo()}),100)}e.preventDefault();break;case 89:if(n.canRedo){wijmo_1.getActiveElement().blur();setTimeout((function(){return n.redo()}),100)}e.preventDefault()}}),wijmo_1.getEventOptions(!0,!1))}UndoStack.prototype.addTarget=function(t){var e=!1;if(wijmo_1.isString(t)){for(var n=document.querySelectorAll(t),o=!1,i=0;i<n.length;i++)this.addTarget(n[i])&&(o=!0);return o}wijmo_1.assert(t instanceof HTMLElement,"Undo target should be an HTML element");var r=new AddTargetEventArgs(t);r.cancel=wijmo_1.hasClass(t,"wj-no-undo");if(this.onAddingTarget(r)){var c=wijmo_1.Control.getControl(t);c&&(e=_UndoStackWijmo.addTarget(this,c));e||(e=_UndoStackHTML.addTarget(this,t));e&&this.onAddedTarget(r)}return e};Object.defineProperty(UndoStack.prototype,"autoKeyboard",{get:function(){return this._autoKbd},set:function(t){this._autoKbd=wijmo_1.asBoolean(t)},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"isDisabled",{get:function(){return this._disabled},set:function(t){this._disabled=wijmo_1.asBoolean(t)},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"maxActions",{get:function(){return this._maxActions},set:function(t){if(t!=this._maxActions){this._maxActions=wijmo_1.asNumber(t,!1,!0);this.clear()}},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"actionCount",{get:function(){return this._stack.length},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"canUndo",{get:function(){return this._stack.length>0&&this._ptr>0&&!this._disabled},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"canRedo",{get:function(){return this._stack.length>0&&this._ptr<this._stack.length&&!this._disabled},enumerable:!0,configurable:!0});UndoStack.prototype.undo=function(){if(this.canUndo){var t=this._stack[this._ptr-1],e=new UndoActionEventArgs(t);if(this.onUndoingAction(e)){this._ptr--;this._undoing=!0;t.undo();this._undoing=!1;this._pendingAction=null;this.onUndoneAction(e);this.onStateChanged()}}};UndoStack.prototype.redo=function(){if(this.canRedo){var t=this._stack[this._ptr],e=new UndoActionEventArgs(t);if(this.onRedoingAction(e)){this._ptr++;this._undoing=!0;t.redo();this._undoing=!1;this._pendingAction=null;this.onRedoneAction(e);this.onStateChanged()}}};UndoStack.prototype.clear=function(){this._ptr=0;this._stack.splice(0,this._stack.length);this.onStateChanged()};UndoStack.prototype.pushAction=function(t){this._pendingAction=t;this.pushPendingAction()};UndoStack.prototype.onAddingTarget=function(t){this.addingTarget.raise(this,t);return!t.cancel};UndoStack.prototype.onAddedTarget=function(t){this.addedTarget.raise(this,t)};UndoStack.prototype.onAddingAction=function(t){this.addingAction.raise(this,t);return!t.cancel};UndoStack.prototype.onAddedAction=function(t){this.addedAction.raise(this,t)};UndoStack.prototype.onUndoingAction=function(t){this.undoingAction.raise(this,t);return!t.cancel};UndoStack.prototype.onUndoneAction=function(t){this.undoneAction.raise(this,t)};UndoStack.prototype.onRedoingAction=function(t){this.redoingAction.raise(this,t);return!t.cancel};UndoStack.prototype.onRedoneAction=function(t){this.redoneAction.raise(this,t)};UndoStack.prototype.onStateChanged=function(){this.stateChanged.raise(this,wijmo_1.EventArgs.empty)};UndoStack.prototype.pushPendingAction=function(){if(!this._disabled&&!this._undoing&&this._pendingAction&&this._pendingAction.close()){this._stack.splice(this._ptr,this._stack.length-this._ptr);wijmo_1.assert(this._stack.length==this._ptr,"should be at the end of the stack");if(this._stack.length){var t=this._stack[this._ptr-1];if(t.shouldAddAsChildAction(this._pendingAction)){t.addChildAction(this._pendingAction);this._pendingAction=null;this.onStateChanged();return}}var e=new UndoActionEventArgs(this._pendingAction);if(!this.onAddingAction(e))return;this._stack.push(this._pendingAction);this._ptr++;this._pendingAction=null;var n=this._stack.length-this._maxActions;if(n>0){this._stack.splice(0,n);this._ptr-=n;wijmo_1.assert(this._ptr>=0,"pointer should not be negative")}this.onStateChanged()}};return UndoStack}();exports.UndoStack=UndoStack;var AddTargetEventArgs=function(t){__extends(AddTargetEventArgs,t);function AddTargetEventArgs(e){var n=t.call(this)||this;n._target=e;return n}Object.defineProperty(AddTargetEventArgs.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0});return AddTargetEventArgs}(wijmo_1.CancelEventArgs);exports.AddTargetEventArgs=AddTargetEventArgs;var UndoActionEventArgs=function(t){__extends(UndoActionEventArgs,t);function UndoActionEventArgs(e){var n=t.call(this)||this;n._action=e;return n}Object.defineProperty(UndoActionEventArgs.prototype,"action",{get:function(){return this._action},enumerable:!0,configurable:!0});return UndoActionEventArgs}(wijmo_1.CancelEventArgs);exports.UndoActionEventArgs=UndoActionEventArgs;function softInput(){return wijmo_1._getModule("wijmo.input")}exports.softInput=softInput;function softGrid(){return wijmo_1._getModule("wijmo.grid")}exports.softGrid=softGrid;function softGauge(){return wijmo_1._getModule("wijmo.gauge")}exports.softGauge=softGauge;function softNav(){return wijmo_1._getModule("wijmo.nav")}exports.softNav=softNav;var _UndoStackWijmo=function(){function _UndoStackWijmo(){}_UndoStackWijmo.addTarget=function(t,e){var n=_UndoStackWijmo;return softGrid()&&e instanceof softGrid().FlexGrid?n._addFlexGrid(t,e):softGauge()&&e instanceof softGauge().Gauge?n._addGauge(t,e):softNav()&&e instanceof softNav().TreeView?n._addTreeView(t,e):!!n._isInputControl(e)&&n._addInputControl(t,e)};_UndoStackWijmo._isInputControl=function(t){var e=softInput();return!!e&&(t instanceof e.DropDown||t instanceof e.InputMask||t instanceof e.InputNumber||t instanceof e.Calendar||t instanceof e.ColorPicker)};_UndoStackWijmo._addInputControl=function(t,e){var n=null;e.gotFocus.addHandler((function(){n=new InputControlChangeAction({target:e})}));e.lostFocus.addHandler((function(){if(n instanceof InputControlChangeAction){t.pushAction(n);n=null}}));return!0};_UndoStackWijmo._addGauge=function(t,e){if(!e.isReadOnly){var n=null;e.hostElement.addEventListener("focus",(function(){n||(n=new GaugeChangeAction(e))}));e.lostFocus.addHandler((function(){if(n instanceof GaugeChangeAction){t.pushAction(n);n=null}}));return!0}return!1};_UndoStackWijmo._addTreeView=function(t,e){var n=null;e.nodeEditStarted.addHandler((function(t,e){n=new TreeViewEditAction(t,e)}));e.nodeEditEnded.addHandler((function(e,o){if(n instanceof TreeViewEditAction){t.pushAction(n);n=null}}));e.isCheckedChanging.addHandler((function(t,e){n=new TreeViewCheckAction(t,e)}));e.isCheckedChanged.addHandler((function(e,o){if(n instanceof TreeViewCheckAction){t.pushAction(n);n=null}}));return!0};_UndoStackWijmo._addFlexGrid=function(t,e){var n=null;e.beginningEdit.addHandler((function(t,e){n=e.getRow()instanceof wijmo_grid_1._NewRowTemplate?null:new GridEditAction(t,e)}));e.cellEditEnded.addHandler((function(e,o){if(n instanceof GridEditAction){t.pushAction(n);n=null}}));e.pastingCell.addHandler((function(t,e){n=e.getRow()?new GridEditAction(t,e):null}));e.pastedCell.addHandler((function(e,o){if(n instanceof GridEditAction){t.pushAction(n);n=null}}));e.sortingColumn.addHandler((function(t,e){n=new GridSortAction(t,e)}));e.sortedColumn.addHandler((function(e,o){if(n instanceof GridSortAction){t.pushAction(n);n=null}}));e.resizingColumn.addHandler((function(t,e){n instanceof GridResizeAction||(n=new GridResizeAction(t,e))}));e.resizedColumn.addHandler((function(){if(n instanceof GridResizeAction){t.pushAction(n);n=null}}));e.autoSizingColumn.addHandler((function(t,e){n=new GridResizeAction(t,e)}));e.autoSizedColumn.addHandler((function(){if(n instanceof GridResizeAction){t.pushAction(n);n=null}}));e.draggingColumn.addHandler((function(t,e){n=new GridDragAction(t,e)}));e.draggedColumn.addHandler((function(e,o){if(n instanceof GridDragAction){t.pushAction(n);n=null}}));e.rowAdded.addHandler((function(e,n){n.cancel||t.pushAction(new GridAddRowAction(e,n))}));e.deletingRow.addHandler((function(e,n){n.cancel||t.pushAction(new GridRemoveRowAction(e,n))}));e.columnGroupCollapsedChanging.addHandler((function(t,e){n=new ExpandCollapseColumnGroupAction(t,e)}));e.columnGroupCollapsedChanged.addHandler((function(e,o){if(n instanceof ExpandCollapseColumnGroupAction){t.pushAction(n);n=null}}));return!0};return _UndoStackWijmo}();exports._UndoStackWijmo=_UndoStackWijmo;var InputControlChangeAction=function(t){__extends(InputControlChangeAction,t);function InputControlChangeAction(e){var n=t.call(this,e)||this;n._ctl=e.target;n._oldState=n._getControlState();return n}Object.defineProperty(InputControlChangeAction.prototype,"control",{get:function(){return this._ctl},enumerable:!0,configurable:!0});InputControlChangeAction.prototype.close=function(){this._timeStamp=Date.now();this._newState=this._getControlState();return!this._sameContent(this._oldState,this._newState)};InputControlChangeAction.prototype.shouldAddAsChildAction=function(t){if(t instanceof InputControlChangeAction&&t.target==this.target&&t._timeStamp-this._timeStamp<500){this._timeStamp=Date.now();return!0}return!1};InputControlChangeAction.prototype.applyState=function(t){var e=this._ctl,n=softInput();if(n){var o=e instanceof n.Calendar||e instanceof n.InputDate;o&&e.selectionMode!=n.DateSelectionMode.Range&&(o=!1);if(e instanceof n.MultiSelect)e.checkedItems=t;else if(e instanceof n.MultiAutoComplete)e.selectedItems=t;else if(o){e.value=t[0];e.rangeEnd=t[1]}else"value"in e?e.value=t:"text"in e?e.text=t:wijmo_1.assert(!1,"can't apply control state?");e.focus()}};InputControlChangeAction.prototype._getControlState=function(){var t=this._ctl,e=softInput();if(e){var n=t instanceof e.Calendar||t instanceof e.InputDate;n&&t.selectionMode!=e.DateSelectionMode.Range&&(n=!1);if(t instanceof e.MultiSelect)return t.checkedItems.slice();if(t instanceof e.MultiAutoComplete)return t.selectedItems.slice();if(n)return[t.value,t.rangeEnd];if("value"in t)return t.value;if("text"in t)return t.text;wijmo_1.assert(!1,"can't get control state?")}};InputControlChangeAction.prototype._sameContent=function(t,e){if(wijmo_1.isArray(t)&&wijmo_1.isArray(e)){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!=e[n])return!1;return!0}return wijmo_1.isDate(t)||wijmo_1.isDate(e)?wijmo_1.DateTime.sameDate(t,e):t==e};return InputControlChangeAction}(InputChangeAction),GaugeChangeAction=function(t){__extends(GaugeChangeAction,t);function GaugeChangeAction(e){var n=t.call(this,e)||this;n._oldState=e.value;return n}Object.defineProperty(GaugeChangeAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});GaugeChangeAction.prototype.close=function(){this._newState=this._target.value;return this._newState!=this._oldState};GaugeChangeAction.prototype.applyState=function(t){var e=this._target;e.value=t;e.focus()};return GaugeChangeAction}(UndoableAction),GridEditAction=function(t){__extends(GridEditAction,t);function GridEditAction(e,n){var o=t.call(this,e)||this;o._dataItems=[];for(var i=e.collectionView,r=o._rng=n.range,c=r.topRow;c<=r.bottomRow;c++)o._dataItems.push(e.rows[c].dataItem);o._page=i instanceof wijmo_1.CollectionView?i.pageIndex:-1;o._oldState=e.getCellData(n.row,n.col,!1);return o}Object.defineProperty(GridEditAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"range",{get:function(){return this._rng.clone()},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"row",{get:function(){return this._rng.topRow},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"col",{get:function(){return this._rng.leftCol},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"dataItem",{get:function(){return this._dataItems[0]},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"dataItems",{get:function(){return this._dataItems},enumerable:!0,configurable:!0});GridEditAction.prototype.close=function(){var t=this._target.collectionView;if(t&&t.currentAddItem)return!1;this._timeStamp=Date.now();this._newState=this._target.getCellData(this.row,this.col,!1);return this._newState!=this._oldState};GridEditAction.prototype.applyState=function(t){var e=this,n=this._target,o=n.editableCollectionView;if(o){o instanceof wijmo_1.CollectionView&&this._page>-1&&o.moveToPage(this._page);n.deferUpdate((function(){e._dataItems.forEach((function(i){o.editItem(i);for(var r=e._rng.leftCol;r<=e._rng.rightCol;r++){var c=n.columns[r],a=n._getBindingColumn(n.cells,e.row,c);a&&a._binding&&a._binding.setValue(i,t)}o.commitEdit()}))}))}n.select(this.row,this.col);this._focusScroll()};GridEditAction.prototype.shouldAddAsChildAction=function(t){return t instanceof GridEditAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100};return GridEditAction}(UndoableAction),GridSortAction=function(t){__extends(GridSortAction,t);function GridSortAction(e,n){var o=t.call(this,e)||this,i=o._target.collectionView;i&&(o._oldState=i.sortDescriptions.slice());return o}Object.defineProperty(GridSortAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});GridSortAction.prototype.close=function(){var t=this._target.collectionView;if(t){this._newState=t.sortDescriptions.slice();return!0}return!1};GridSortAction.prototype.applyState=function(t){var e=this._target.collectionView;e&&e.deferUpdate((function(){var n=e.sortDescriptions;n.clear();t.forEach((function(t){n.push(t)}))}));this._focusScroll()};return GridSortAction}(UndoableAction),GridResizeAction=function(t){__extends(GridResizeAction,t);function GridResizeAction(e,n){var o=t.call(this,e)||this;o._col=e.columns[n.col];o._oldState=o._col.renderWidth;return o}Object.defineProperty(GridResizeAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(GridResizeAction.prototype,"col",{get:function(){return this._col},enumerable:!0,configurable:!0});GridResizeAction.prototype.close=function(){this._timeStamp=Date.now();this._newState=this._col.renderWidth;return this._newState!=this._oldState};GridResizeAction.prototype.applyState=function(t){this._col.width=t;this._focusScroll()};GridResizeAction.prototype.shouldAddAsChildAction=function(t){return t instanceof GridResizeAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100};return GridResizeAction}(UndoableAction),GridDragAction=function(t){__extends(GridDragAction,t);function GridDragAction(e,n){var o=t.call(this,e)||this;o._col=n.getColumn(!0);o._oldState=o._getState(o._col);return o}Object.defineProperty(GridDragAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(GridDragAction.prototype,"col",{get:function(){return this._col},enumerable:!0,configurable:!0});GridDragAction.prototype.close=function(){this._newState=this._getState(this._col);return!this._areStatesEqual(this._newState,this._oldState)};GridDragAction.prototype.applyState=function(t){var e=this,n=this._col;n.grid.deferUpdate((function(){var o=e._getState(n);o.coll.splice(o.idx,1);t.coll.splice(t.idx,0,n)}));this._focusScroll()};GridDragAction.prototype._getState=function(t){var e=t instanceof wijmo_grid_1.ColumnGroup?t.parentGroup?t.parentGroup.columns:this.target.getColumnGroups():t.grid.columns;return{coll:e,idx:e.indexOf(t)}};GridDragAction.prototype._areStatesEqual=function(t,e){return t.coll===e.coll&&t.idx===e.idx};return GridDragAction}(UndoableAction),GridAddRowAction=function(t){__extends(GridAddRowAction,t);function GridAddRowAction(e,n){var o=t.call(this,e)||this,i=o._target.collectionView;if(i&&i.currentAddItem){var r=i.currentAddItem,c=i.sourceCollection.indexOf(r),a=i.currentPosition;o._oldState={item:r,index:c,position:a};o._newState={index:c,position:a}}return o}Object.defineProperty(GridAddRowAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});GridAddRowAction.prototype.close=function(){return null!=this._oldState};GridAddRowAction.prototype.applyState=function(t){var e=this._target.collectionView;if(e){var n=e.sourceCollection;if(t.item){n.splice(t.index,1);if(e instanceof wijmo_1.CollectionView&&e.trackChanges){var o=t.item;wijmo_1.assert(e.itemsAdded.indexOf(o)>-1,"item should be in the itemsAdded list");e.itemsAdded.remove(o)}}else{o=this._oldState.item;n.splice(t.index,0,o);if(e instanceof wijmo_1.CollectionView&&e.trackChanges){wijmo_1.assert(e.itemsAdded.indexOf(o)<0,"item should not be in the itemsAdded list");e.itemsAdded.push(o)}}e.refresh();e.moveCurrentToPosition(t.position);this._focusScroll()}};return GridAddRowAction}(UndoableAction),GridRemoveRowAction=function(t){__extends(GridRemoveRowAction,t);function GridRemoveRowAction(e,n){var o=t.call(this,e)||this;o._edtIndex=-1;var i=o._target.collectionView;if(i){var r=e.rows[n.row].dataItem,c=i.sourceCollection.indexOf(r),a=i.currentPosition;i instanceof wijmo_1.CollectionView&&i.trackChanges&&(o._edtIndex=i.itemsEdited.indexOf(r));o._oldState={item:r,index:c,position:a};o._newState={index:c,position:a}}return o}Object.defineProperty(GridRemoveRowAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(GridRemoveRowAction.prototype,"dataItem",{get:function(){return this._oldState.item},enumerable:!0,configurable:!0});GridRemoveRowAction.prototype.close=function(){this._timeStamp=Date.now();return null!=this._oldState};GridRemoveRowAction.prototype.applyState=function(t){var e=this._target,n=e.collectionView;if(n){var o=n.sourceCollection;if(t.item){o.splice(t.index,0,t.item);if(n instanceof wijmo_1.CollectionView&&n.trackChanges){var i=t.item;wijmo_1.assert(n.itemsRemoved.indexOf(i)>-1,"item should be in the itemsRemoved list");n.itemsRemoved.remove(i);this._edtIndex>-1&&n.itemsEdited.indexOf(i)<0&&n.itemsEdited.push(i)}}else{o.splice(t.index,1);if(n instanceof wijmo_1.CollectionView&&n.trackChanges){i=this._oldState.item;wijmo_1.assert(n.itemsRemoved.indexOf(i)<0,"item should not be in the itemsRemoved list");n.itemsRemoved.push(i)}}n.refresh();n.moveCurrentToPosition(t.position);var r=new(softGrid().CellRange)(t.position,0,t.position,e.columns.length-1);e.select(r);this._focusScroll()}};GridRemoveRowAction.prototype.shouldAddAsChildAction=function(t){return t instanceof GridRemoveRowAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100};return GridRemoveRowAction}(UndoableAction),ExpandCollapseColumnGroupAction=function(t){__extends(ExpandCollapseColumnGroupAction,t);function ExpandCollapseColumnGroupAction(e,n){var o=t.call(this,e)||this;o._group=n.data;o._oldState=o._group.isCollapsed;return o}Object.defineProperty(ExpandCollapseColumnGroupAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(ExpandCollapseColumnGroupAction.prototype,"group",{get:function(){return this._group},enumerable:!0,configurable:!0});ExpandCollapseColumnGroupAction.prototype.close=function(){this._newState=this._group.isCollapsed;return this._newState!=this._oldState};ExpandCollapseColumnGroupAction.prototype.applyState=function(t){this._group.isCollapsed=t;this._focusScroll()};return ExpandCollapseColumnGroupAction}(UndoableAction),TreeViewEditAction=function(t){__extends(TreeViewEditAction,t);function TreeViewEditAction(e,n){var o=t.call(this,e)||this;o._nd=n.node;o._oldState=o._getNodeText();return o}Object.defineProperty(TreeViewEditAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(TreeViewEditAction.prototype,"node",{get:function(){return this._nd},enumerable:!0,configurable:!0});TreeViewEditAction.prototype.close=function(){this._newState=this._getNodeText();return this._newState!=this._oldState};TreeViewEditAction.prototype.applyState=function(t){this._nd.select();this._setNodeText(t);this._target.focus()};TreeViewEditAction.prototype._getNodeText=function(){var t=this._nd.dataItem[this._getDisplayMemberPath()];return null!=t?t.toString():""};TreeViewEditAction.prototype._setNodeText=function(t){var e=this._nd,n=e.dataItem,o=this._getDisplayMemberPath(),i=e.element.querySelector(".wj-node-text");n[o]=t;e.treeView.isContentHtml?i.innerHTML=t:i.textContent=t};TreeViewEditAction.prototype._getDisplayMemberPath=function(){var t=this._nd,e=t.treeView.displayMemberPath;e instanceof Array&&(e=e[t.level]);return e};return TreeViewEditAction}(UndoableAction),TreeViewCheckAction=function(t){__extends(TreeViewCheckAction,t);function TreeViewCheckAction(e,n){var o=t.call(this,e)||this;o._nd=n.node;o._oldState=o._nd.isChecked;return o}Object.defineProperty(TreeViewCheckAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(TreeViewCheckAction.prototype,"node",{get:function(){return this._nd},enumerable:!0,configurable:!0});TreeViewCheckAction.prototype.close=function(){this._newState=this._nd.isChecked;return this._newState!=this._oldState};TreeViewCheckAction.prototype.applyState=function(t){this._nd.select();this._nd.isChecked=t;this._target.focus()};return TreeViewCheckAction}(UndoableAction);wijmo_1._registerModule("wijmo.undo",selfModule);
14
+ "use strict";var __extends=this&&this.__extends||function(){var extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};return function(t,e){extendStatics(t,e);function __(){this.constructor=t}t.prototype=null===e?Object.create(e):(__.prototype=e.prototype,new __)}}(),__importStar=this&&this.__importStar||function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);e.default=t;return e};Object.defineProperty(exports,"__esModule",{value:!0});var wijmo_1=require("@mescius/wijmo"),wijmo_grid_1=require("@mescius/wijmo.grid"),wijmo_nav_1=require("@mescius/wijmo.nav"),selfModule=__importStar(require("@mescius/wijmo.undo")),UndoableAction=function(){function UndoableAction(t){this._target=t}UndoableAction.prototype.undo=function(){if(this._actions)for(var t=this._actions.length-1;t>=0;t--)this._actions[t].undo();this.applyState(this._oldState)};UndoableAction.prototype.redo=function(){this.applyState(this._newState);this._actions&&this._actions.forEach((function(t){t.redo()}))};UndoableAction.prototype.close=function(){return!0};UndoableAction.prototype.applyState=function(t){};UndoableAction.prototype.shouldAddAsChildAction=function(t){return!1};UndoableAction.prototype.addChildAction=function(t){this._actions||(this._actions=[]);this._actions.push(t)};Object.defineProperty(UndoableAction.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0});UndoableAction.prototype._focusScroll=function(){var t=this._target;if(t instanceof wijmo_1.Control){t.hostElement&&t.hostElement.scrollIntoView();t.focus()}else if(t instanceof HTMLElement){t.focus();wijmo_1.isFunction(t.select)&&t.select()}};return UndoableAction}();exports.UndoableAction=UndoableAction;var _UndoStackHTML=function(){function _UndoStackHTML(){}_UndoStackHTML.addTarget=function(t,e){var n=_UndoStackHTML;if(e instanceof HTMLInputElement)return n._addInputElement(t,e);if(e instanceof HTMLTextAreaElement)return n._addTextAreaElement(t,e);if(e instanceof HTMLSelectElement)return n._addSelectElement(t,e);for(var o=!1,i=0;i<e.children.length;i++){var r=e.children[i];r instanceof HTMLElement&&t.addTarget(r)&&(o=!0)}return o};_UndoStackHTML._addInputElement=function(t,e){var n=null;if("checkbox"==e.type)e.addEventListener("click",(function(e){t.pushAction(new CheckboxClickAction(e))}));else{if("radio"==e.type){e.addEventListener("mousedown",(function(t){n=new RadioClickAction(t)}),!0);var o=_UndoStackHTML._getLabel(e);o&&o.addEventListener("mousedown",(function(t){n=new RadioClickAction({target:e})}),!0);e.addEventListener("focus",(function(t){n instanceof RadioClickAction&&n.target==t.target||(n=new RadioClickAction(t))}));e.addEventListener("click",(function(e){if(n instanceof RadioClickAction){t.pushAction(n);n=null}}));return!0}if("range"==e.type){e.addEventListener("mousedown",(function(t){var o=wijmo_1.getActiveElement();o instanceof HTMLElement&&o!=e&&o.blur();n=new InputChangeAction(t)}));e.addEventListener("mouseup",(function(o){if(n instanceof InputChangeAction&&wijmo_1.getActiveElement()!=e){n._focus=!1;t.pushAction(n);n=null}}))}e.addEventListener("focus",(function(t){null==n&&(n=new InputChangeAction(t))}));e.addEventListener("blur",(function(e){if(n instanceof InputChangeAction){t.pushAction(n);n=null}}))}return!0};_UndoStackHTML._addTextAreaElement=function(t,e){var n=null;e.addEventListener("focus",(function(t){n=new InputChangeAction(t)}));e.addEventListener("blur",(function(e){if(n instanceof InputChangeAction){t.pushAction(n);n=null}}));return!0};_UndoStackHTML._addSelectElement=function(t,e){var n=null;e.addEventListener("focus",(function(t){n=new InputChangeAction(t)}));e.addEventListener("blur",(function(e){if(n instanceof InputChangeAction){t.pushAction(n);n=null}}));return!0};_UndoStackHTML._getLabel=function(t){var e=t.parentElement;e instanceof HTMLLabelElement||(e=document.querySelector('label[for="'+t.id+'"'));return e};return _UndoStackHTML}();exports._UndoStackHTML=_UndoStackHTML;var InputChangeAction=function(t){__extends(InputChangeAction,t);function InputChangeAction(e){var n=t.call(this,e.target)||this;n._focus=!0;n._oldState=n._target.value;return n}InputChangeAction.prototype.close=function(){this._newState=this._target.value;return this._newState!=this._oldState};InputChangeAction.prototype.applyState=function(t){var e=this._target;e.value=t;e.dispatchEvent(UndoStack._evtInput);this._focus&&this._focusScroll()};return InputChangeAction}(UndoableAction);exports.InputChangeAction=InputChangeAction;var CheckboxClickAction=function(t){__extends(CheckboxClickAction,t);function CheckboxClickAction(e){var n=t.call(this,e.target)||this;wijmo_1.assert("checkbox"==n._target.type,"checkbox expected");n._newState=n._target.checked;n._oldState=!n._newState;return n}CheckboxClickAction.prototype.applyState=function(t){this._target.checked=t;this._target.focus()};return CheckboxClickAction}(UndoableAction);exports.CheckboxClickAction=CheckboxClickAction;var RadioClickAction=function(t){__extends(RadioClickAction,t);function RadioClickAction(e){var n=t.call(this,e.target)||this,o=n._target.type;wijmo_1.assert("radio"==o,"radio button expected");n._oldState=n._getState();return n}RadioClickAction.prototype.close=function(){this._newState=this._getState();return this._newState!=this._oldState};RadioClickAction.prototype.applyState=function(t){if(t){t.checked=!0;t.focus()}};RadioClickAction.prototype._getState=function(){for(var t='input[name="'+this._target.name+'"]',e=document.querySelectorAll(t),n=0;n<e.length;n++)if(e[n].checked)return e[n];return null};return RadioClickAction}(UndoableAction);exports.RadioClickAction=RadioClickAction;exports.UndoClsNames={noUndo:"wj-no-undo"};var UndoStack=function(){function UndoStack(t,e){var n=this;this._autoKbd=!0;this._stack=[];this._maxActions=1e3;this._ptr=0;this.addingTarget=new wijmo_1.Event;this.addedTarget=new wijmo_1.Event;this.addingAction=new wijmo_1.Event;this.addedAction=new wijmo_1.Event;this.undoingAction=new wijmo_1.Event;this.undoneAction=new wijmo_1.Event;this.redoingAction=new wijmo_1.Event;this.redoneAction=new wijmo_1.Event;this.stateChanged=new wijmo_1.Event;if(!UndoStack._evtInput){var o=document.createEvent("HTMLEvents");o.initEvent("input",!0,!1);UndoStack._evtInput=o}wijmo_1.copy(this,e);t=wijmo_1.getElement(t||document.body);this.addTarget(t);document.addEventListener("keydown",(function(e){var o=navigator.platform.toUpperCase().indexOf("MAC")>=0?e.metaKey:e.ctrlKey;if(n._autoKbd&&o&&!e.defaultPrevented&&wijmo_1.contains(t,e.target))if(e.shiftKey&&90===e.keyCode){if(n.canRedo){wijmo_1.getActiveElement().blur();setTimeout((function(){return n.redo()}),100)}e.preventDefault()}else switch(e.keyCode){case 90:if(n.canUndo){wijmo_1.getActiveElement().blur();setTimeout((function(){return n.undo()}),100)}e.preventDefault();break;case 89:if(n.canRedo){wijmo_1.getActiveElement().blur();setTimeout((function(){return n.redo()}),100)}e.preventDefault()}}),wijmo_1.getEventOptions(!0,!1))}UndoStack.prototype.addTarget=function(t){var e=!1;if(wijmo_1.isString(t)){for(var n=document.querySelectorAll(t),o=!1,i=0;i<n.length;i++)this.addTarget(n[i])&&(o=!0);return o}wijmo_1.assert(t instanceof HTMLElement,"Undo target should be an HTML element");var r=new AddTargetEventArgs(t);r.cancel=wijmo_1.hasClass(t,exports.UndoClsNames.noUndo);if(this.onAddingTarget(r)){var c=wijmo_1.Control.getControl(t);c&&(e=_UndoStackWijmo.addTarget(this,c));e||(e=_UndoStackHTML.addTarget(this,t));e&&this.onAddedTarget(r)}return e};Object.defineProperty(UndoStack.prototype,"autoKeyboard",{get:function(){return this._autoKbd},set:function(t){this._autoKbd=wijmo_1.asBoolean(t)},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"isDisabled",{get:function(){return this._disabled},set:function(t){this._disabled=wijmo_1.asBoolean(t)},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"maxActions",{get:function(){return this._maxActions},set:function(t){if(t!=this._maxActions){this._maxActions=wijmo_1.asNumber(t,!1,!0);this.clear()}},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"actionCount",{get:function(){return this._stack.length},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"canUndo",{get:function(){return this._stack.length>0&&this._ptr>0&&!this._disabled},enumerable:!0,configurable:!0});Object.defineProperty(UndoStack.prototype,"canRedo",{get:function(){return this._stack.length>0&&this._ptr<this._stack.length&&!this._disabled},enumerable:!0,configurable:!0});UndoStack.prototype.undo=function(){if(this.canUndo){var t=this._stack[this._ptr-1],e=new UndoActionEventArgs(t);if(this.onUndoingAction(e)){this._ptr--;this._undoing=!0;t.undo();this._undoing=!1;this._pendingAction=null;this.onUndoneAction(e);this.onStateChanged()}}};UndoStack.prototype.redo=function(){if(this.canRedo){var t=this._stack[this._ptr],e=new UndoActionEventArgs(t);if(this.onRedoingAction(e)){this._ptr++;this._undoing=!0;t.redo();this._undoing=!1;this._pendingAction=null;this.onRedoneAction(e);this.onStateChanged()}}};UndoStack.prototype.clear=function(){this._ptr=0;this._stack.splice(0,this._stack.length);this.onStateChanged()};UndoStack.prototype.pushAction=function(t){this._pendingAction=t;this.pushPendingAction()};UndoStack.prototype.onAddingTarget=function(t){this.addingTarget.raise(this,t);return!t.cancel};UndoStack.prototype.onAddedTarget=function(t){this.addedTarget.raise(this,t)};UndoStack.prototype.onAddingAction=function(t){this.addingAction.raise(this,t);return!t.cancel};UndoStack.prototype.onAddedAction=function(t){this.addedAction.raise(this,t)};UndoStack.prototype.onUndoingAction=function(t){this.undoingAction.raise(this,t);return!t.cancel};UndoStack.prototype.onUndoneAction=function(t){this.undoneAction.raise(this,t)};UndoStack.prototype.onRedoingAction=function(t){this.redoingAction.raise(this,t);return!t.cancel};UndoStack.prototype.onRedoneAction=function(t){this.redoneAction.raise(this,t)};UndoStack.prototype.onStateChanged=function(){this.stateChanged.raise(this,wijmo_1.EventArgs.empty)};UndoStack.prototype.pushPendingAction=function(){if(!this._disabled&&!this._undoing&&this._pendingAction&&this._pendingAction.close()){this._stack.splice(this._ptr,this._stack.length-this._ptr);wijmo_1.assert(this._stack.length==this._ptr,"should be at the end of the stack");if(this._stack.length){var t=this._stack[this._ptr-1];if(t.shouldAddAsChildAction(this._pendingAction)){t.addChildAction(this._pendingAction);this._pendingAction=null;this.onStateChanged();return}}var e=new UndoActionEventArgs(this._pendingAction);if(!this.onAddingAction(e))return;this._stack.push(this._pendingAction);this._ptr++;this._pendingAction=null;var n=this._stack.length-this._maxActions;if(n>0){this._stack.splice(0,n);this._ptr-=n;wijmo_1.assert(this._ptr>=0,"pointer should not be negative")}this.onStateChanged()}};return UndoStack}();exports.UndoStack=UndoStack;var AddTargetEventArgs=function(t){__extends(AddTargetEventArgs,t);function AddTargetEventArgs(e){var n=t.call(this)||this;n._target=e;return n}Object.defineProperty(AddTargetEventArgs.prototype,"target",{get:function(){return this._target},enumerable:!0,configurable:!0});return AddTargetEventArgs}(wijmo_1.CancelEventArgs);exports.AddTargetEventArgs=AddTargetEventArgs;var UndoActionEventArgs=function(t){__extends(UndoActionEventArgs,t);function UndoActionEventArgs(e){var n=t.call(this)||this;n._action=e;return n}Object.defineProperty(UndoActionEventArgs.prototype,"action",{get:function(){return this._action},enumerable:!0,configurable:!0});return UndoActionEventArgs}(wijmo_1.CancelEventArgs);exports.UndoActionEventArgs=UndoActionEventArgs;function softInput(){return wijmo_1._getModule("wijmo.input")}exports.softInput=softInput;function softGrid(){return wijmo_1._getModule("wijmo.grid")}exports.softGrid=softGrid;function softGauge(){return wijmo_1._getModule("wijmo.gauge")}exports.softGauge=softGauge;function softNav(){return wijmo_1._getModule("wijmo.nav")}exports.softNav=softNav;var _UndoStackWijmo=function(){function _UndoStackWijmo(){}_UndoStackWijmo.addTarget=function(t,e){var n=_UndoStackWijmo;return softGrid()&&e instanceof softGrid().FlexGrid?n._addFlexGrid(t,e):softGauge()&&e instanceof softGauge().Gauge?n._addGauge(t,e):softNav()&&e instanceof softNav().TreeView?n._addTreeView(t,e):!!n._isInputControl(e)&&n._addInputControl(t,e)};_UndoStackWijmo._isInputControl=function(t){var e=softInput();return!!e&&(t instanceof e.DropDown||t instanceof e.InputMask||t instanceof e.InputNumber||t instanceof e.Calendar||t instanceof e.ColorPicker)};_UndoStackWijmo._addInputControl=function(t,e){var n=null;e.gotFocus.addHandler((function(){n=new InputControlChangeAction({target:e})}));e.lostFocus.addHandler((function(){if(n instanceof InputControlChangeAction){t.pushAction(n);n=null}}));return!0};_UndoStackWijmo._addGauge=function(t,e){if(!e.isReadOnly){var n=null;e.hostElement.addEventListener("focus",(function(){n||(n=new GaugeChangeAction(e))}));e.lostFocus.addHandler((function(){if(n instanceof GaugeChangeAction){t.pushAction(n);n=null}}));return!0}return!1};_UndoStackWijmo._addTreeView=function(t,e){var n=null;e.nodeEditStarted.addHandler((function(t,e){n=new TreeViewEditAction(t,e)}));e.nodeEditEnded.addHandler((function(e,o){if(n instanceof TreeViewEditAction){t.pushAction(n);n=null}}));e.isCheckedChanging.addHandler((function(t,e){n=new TreeViewCheckAction(t,e)}));e.isCheckedChanged.addHandler((function(e,o){if(n instanceof TreeViewCheckAction){t.pushAction(n);n=null}}));return!0};_UndoStackWijmo._addFlexGrid=function(t,e){var n=null;e.beginningEdit.addHandler((function(t,e){n=e.getRow()instanceof wijmo_grid_1._NewRowTemplate?null:new GridEditAction(t,e)}));e.cellEditEnded.addHandler((function(e,o){if(n instanceof GridEditAction){t.pushAction(n);n=null}}));e.pastingCell.addHandler((function(t,e){n=e.getRow()?new GridEditAction(t,e):null}));e.pastedCell.addHandler((function(e,o){if(n instanceof GridEditAction){t.pushAction(n);n=null}}));e.sortingColumn.addHandler((function(t,e){n=new GridSortAction(t,e)}));e.sortedColumn.addHandler((function(e,o){if(n instanceof GridSortAction){t.pushAction(n);n=null}}));e.resizingColumn.addHandler((function(t,e){n instanceof GridResizeAction||(n=new GridResizeAction(t,e))}));e.resizedColumn.addHandler((function(){if(n instanceof GridResizeAction){t.pushAction(n);n=null}}));e.autoSizingColumn.addHandler((function(t,e){n=new GridResizeAction(t,e)}));e.autoSizedColumn.addHandler((function(){if(n instanceof GridResizeAction){t.pushAction(n);n=null}}));e.draggingColumn.addHandler((function(t,e){n=new GridDragAction(t,e)}));e.draggedColumn.addHandler((function(e,o){if(n instanceof GridDragAction){t.pushAction(n);n=null}}));e.rowAdded.addHandler((function(e,n){n.cancel||t.pushAction(new GridAddRowAction(e,n))}));e.deletingRow.addHandler((function(e,n){n.cancel||t.pushAction(new GridRemoveRowAction(e,n))}));e.columnGroupCollapsedChanging.addHandler((function(t,e){n=new ExpandCollapseColumnGroupAction(t,e)}));e.columnGroupCollapsedChanged.addHandler((function(e,o){if(n instanceof ExpandCollapseColumnGroupAction){t.pushAction(n);n=null}}));return!0};return _UndoStackWijmo}();exports._UndoStackWijmo=_UndoStackWijmo;var InputControlChangeAction=function(t){__extends(InputControlChangeAction,t);function InputControlChangeAction(e){var n=t.call(this,e)||this;n._ctl=e.target;n._oldState=n._getControlState();return n}Object.defineProperty(InputControlChangeAction.prototype,"control",{get:function(){return this._ctl},enumerable:!0,configurable:!0});InputControlChangeAction.prototype.close=function(){this._timeStamp=Date.now();this._newState=this._getControlState();return!this._sameContent(this._oldState,this._newState)};InputControlChangeAction.prototype.shouldAddAsChildAction=function(t){if(t instanceof InputControlChangeAction&&t.target==this.target&&t._timeStamp-this._timeStamp<500){this._timeStamp=Date.now();return!0}return!1};InputControlChangeAction.prototype.applyState=function(t){var e=this._ctl,n=softInput();if(n){var o=e instanceof n.Calendar||e instanceof n.InputDate;o&&e.selectionMode!=n.DateSelectionMode.Range&&(o=!1);if(e instanceof n.MultiSelect)e.checkedItems=t;else if(e instanceof n.MultiAutoComplete)e.selectedItems=t;else if(o){e.value=t[0];e.rangeEnd=t[1]}else"value"in e?e.value=t:"text"in e?e.text=t:wijmo_1.assert(!1,"can't apply control state?");e.focus()}};InputControlChangeAction.prototype._getControlState=function(){var t=this._ctl,e=softInput();if(e){var n=t instanceof e.Calendar||t instanceof e.InputDate;n&&t.selectionMode!=e.DateSelectionMode.Range&&(n=!1);if(t instanceof e.MultiSelect)return t.checkedItems.slice();if(t instanceof e.MultiAutoComplete)return t.selectedItems.slice();if(n)return[t.value,t.rangeEnd];if("value"in t)return t.value;if("text"in t)return t.text;wijmo_1.assert(!1,"can't get control state?")}};InputControlChangeAction.prototype._sameContent=function(t,e){if(wijmo_1.isArray(t)&&wijmo_1.isArray(e)){if(t.length!=e.length)return!1;for(var n=0;n<t.length;n++)if(t[n]!=e[n])return!1;return!0}return wijmo_1.isDate(t)||wijmo_1.isDate(e)?wijmo_1.DateTime.sameDate(t,e):t==e};return InputControlChangeAction}(InputChangeAction),GaugeChangeAction=function(t){__extends(GaugeChangeAction,t);function GaugeChangeAction(e){var n=t.call(this,e)||this;n._oldState=e.value;return n}Object.defineProperty(GaugeChangeAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});GaugeChangeAction.prototype.close=function(){this._newState=this._target.value;return this._newState!=this._oldState};GaugeChangeAction.prototype.applyState=function(t){var e=this._target;e.value=t;e.focus()};return GaugeChangeAction}(UndoableAction),GridEditAction=function(t){__extends(GridEditAction,t);function GridEditAction(e,n){var o=t.call(this,e)||this;o._dataItems=[];for(var i=e.collectionView,r=o._rng=n.range,c=r.topRow;c<=r.bottomRow;c++)o._dataItems.push(e.rows[c].dataItem);o._page=i instanceof wijmo_1.CollectionView?i.pageIndex:-1;o._oldState=e.getCellData(n.row,n.col,!1);return o}Object.defineProperty(GridEditAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"range",{get:function(){return this._rng.clone()},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"row",{get:function(){return this._rng.topRow},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"col",{get:function(){return this._rng.leftCol},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"dataItem",{get:function(){return this._dataItems[0]},enumerable:!0,configurable:!0});Object.defineProperty(GridEditAction.prototype,"dataItems",{get:function(){return this._dataItems},enumerable:!0,configurable:!0});GridEditAction.prototype.close=function(){var t=this._target.collectionView;if(t&&t.currentAddItem)return!1;this._timeStamp=Date.now();this._newState=this._target.getCellData(this.row,this.col,!1);return this._newState!=this._oldState};GridEditAction.prototype.applyState=function(t){var e=this,n=this._target,o=n.editableCollectionView;if(o){o instanceof wijmo_1.CollectionView&&this._page>-1&&o.moveToPage(this._page);n.deferUpdate((function(){e._dataItems.forEach((function(i){o.editItem(i);for(var r=e._rng.leftCol;r<=e._rng.rightCol;r++){var c=n.columns[r],a=n._getBindingColumn(n.cells,e.row,c);a&&a._binding&&a._binding.setValue(i,t)}o.commitEdit()}))}))}n.select(this.row,this.col);this._focusScroll()};GridEditAction.prototype.shouldAddAsChildAction=function(t){return t instanceof GridEditAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100};return GridEditAction}(UndoableAction),GridSortAction=function(t){__extends(GridSortAction,t);function GridSortAction(e,n){var o=t.call(this,e)||this,i=o._target.collectionView;i&&(o._oldState=i.sortDescriptions.slice());return o}Object.defineProperty(GridSortAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});GridSortAction.prototype.close=function(){var t=this._target.collectionView;if(t){this._newState=t.sortDescriptions.slice();return!0}return!1};GridSortAction.prototype.applyState=function(t){var e=this._target.collectionView;e&&e.deferUpdate((function(){var n=e.sortDescriptions;n.clear();t.forEach((function(t){n.push(t)}))}));this._focusScroll()};return GridSortAction}(UndoableAction),GridResizeAction=function(t){__extends(GridResizeAction,t);function GridResizeAction(e,n){var o=t.call(this,e)||this;o._col=e.columns[n.col];o._oldState=o._col.renderWidth;return o}Object.defineProperty(GridResizeAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(GridResizeAction.prototype,"col",{get:function(){return this._col},enumerable:!0,configurable:!0});GridResizeAction.prototype.close=function(){this._timeStamp=Date.now();this._newState=this._col.renderWidth;return this._newState!=this._oldState};GridResizeAction.prototype.applyState=function(t){this._col.width=t;this._focusScroll()};GridResizeAction.prototype.shouldAddAsChildAction=function(t){return t instanceof GridResizeAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100};return GridResizeAction}(UndoableAction),GridDragAction=function(t){__extends(GridDragAction,t);function GridDragAction(e,n){var o=t.call(this,e)||this;o._col=n.getColumn(!0);o._oldState=o._getState(o._col);return o}Object.defineProperty(GridDragAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(GridDragAction.prototype,"col",{get:function(){return this._col},enumerable:!0,configurable:!0});GridDragAction.prototype.close=function(){this._newState=this._getState(this._col);return!this._areStatesEqual(this._newState,this._oldState)};GridDragAction.prototype.applyState=function(t){var e=this,n=this._col;n.grid.deferUpdate((function(){var o=e._getState(n);o.coll.splice(o.idx,1);t.coll.splice(t.idx,0,n)}));this._focusScroll()};GridDragAction.prototype._getState=function(t){var e=t instanceof wijmo_grid_1.ColumnGroup?t.parentGroup?t.parentGroup.columns:this.target.getColumnGroups():t.grid.columns;return{coll:e,idx:e.indexOf(t)}};GridDragAction.prototype._areStatesEqual=function(t,e){return t.coll===e.coll&&t.idx===e.idx};return GridDragAction}(UndoableAction),GridAddRowAction=function(t){__extends(GridAddRowAction,t);function GridAddRowAction(e,n){var o=t.call(this,e)||this,i=o._target.collectionView;if(i&&i.currentAddItem){var r=i.currentAddItem,c=i.sourceCollection.indexOf(r),a=i.currentPosition;o._oldState={item:r,index:c,position:a};o._newState={index:c,position:a}}return o}Object.defineProperty(GridAddRowAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});GridAddRowAction.prototype.close=function(){return null!=this._oldState};GridAddRowAction.prototype.applyState=function(t){var e=this._target.collectionView;if(e){var n=e.sourceCollection;if(t.item){n.splice(t.index,1);if(e instanceof wijmo_1.CollectionView&&e.trackChanges){var o=t.item;wijmo_1.assert(e.itemsAdded.indexOf(o)>-1,"item should be in the itemsAdded list");e.itemsAdded.remove(o)}}else{o=this._oldState.item;n.splice(t.index,0,o);if(e instanceof wijmo_1.CollectionView&&e.trackChanges){wijmo_1.assert(e.itemsAdded.indexOf(o)<0,"item should not be in the itemsAdded list");e.itemsAdded.push(o)}}e.refresh();e.moveCurrentToPosition(t.position);this._focusScroll()}};return GridAddRowAction}(UndoableAction),GridRemoveRowAction=function(t){__extends(GridRemoveRowAction,t);function GridRemoveRowAction(e,n){var o=t.call(this,e)||this;o._edtIndex=-1;var i=o._target.collectionView;if(i){var r=e.rows[n.row].dataItem,c=i.sourceCollection.indexOf(r),a=i.currentPosition;i instanceof wijmo_1.CollectionView&&i.trackChanges&&(o._edtIndex=i.itemsEdited.indexOf(r));o._oldState={item:r,index:c,position:a};o._newState={index:c,position:a}}return o}Object.defineProperty(GridRemoveRowAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(GridRemoveRowAction.prototype,"dataItem",{get:function(){return this._oldState.item},enumerable:!0,configurable:!0});GridRemoveRowAction.prototype.close=function(){this._timeStamp=Date.now();return null!=this._oldState};GridRemoveRowAction.prototype.applyState=function(t){var e=this._target,n=e.collectionView;if(n){var o=n.sourceCollection;if(t.item){o.splice(t.index,0,t.item);if(n instanceof wijmo_1.CollectionView&&n.trackChanges){var i=t.item;wijmo_1.assert(n.itemsRemoved.indexOf(i)>-1,"item should be in the itemsRemoved list");n.itemsRemoved.remove(i);this._edtIndex>-1&&n.itemsEdited.indexOf(i)<0&&n.itemsEdited.push(i)}}else{o.splice(t.index,1);if(n instanceof wijmo_1.CollectionView&&n.trackChanges){i=this._oldState.item;wijmo_1.assert(n.itemsRemoved.indexOf(i)<0,"item should not be in the itemsRemoved list");n.itemsRemoved.push(i)}}n.refresh();n.moveCurrentToPosition(t.position);var r=new(softGrid().CellRange)(t.position,0,t.position,e.columns.length-1);e.select(r);this._focusScroll()}};GridRemoveRowAction.prototype.shouldAddAsChildAction=function(t){return t instanceof GridRemoveRowAction&&t.target==this.target&&t._timeStamp-this._timeStamp<100};return GridRemoveRowAction}(UndoableAction),ExpandCollapseColumnGroupAction=function(t){__extends(ExpandCollapseColumnGroupAction,t);function ExpandCollapseColumnGroupAction(e,n){var o=t.call(this,e)||this;o._group=n.data;o._oldState=o._group.isCollapsed;return o}Object.defineProperty(ExpandCollapseColumnGroupAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(ExpandCollapseColumnGroupAction.prototype,"group",{get:function(){return this._group},enumerable:!0,configurable:!0});ExpandCollapseColumnGroupAction.prototype.close=function(){this._newState=this._group.isCollapsed;return this._newState!=this._oldState};ExpandCollapseColumnGroupAction.prototype.applyState=function(t){this._group.isCollapsed=t;this._focusScroll()};return ExpandCollapseColumnGroupAction}(UndoableAction),TreeViewEditAction=function(t){__extends(TreeViewEditAction,t);function TreeViewEditAction(e,n){var o=t.call(this,e)||this;o._nd=n.node;o._oldState=o._getNodeText();return o}Object.defineProperty(TreeViewEditAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(TreeViewEditAction.prototype,"node",{get:function(){return this._nd},enumerable:!0,configurable:!0});TreeViewEditAction.prototype.close=function(){this._newState=this._getNodeText();return this._newState!=this._oldState};TreeViewEditAction.prototype.applyState=function(t){this._nd.select();this._setNodeText(t);this._target.focus()};TreeViewEditAction.prototype._getNodeText=function(){var t=this._nd.dataItem[this._getDisplayMemberPath()];return null!=t?t.toString():""};TreeViewEditAction.prototype._setNodeText=function(t){var e=this._nd,n=e.dataItem,o=this._getDisplayMemberPath(),i=e.element.querySelector("."+wijmo_nav_1.TreeViewClsNames.nodeText);n[o]=t;e.treeView.isContentHtml?i.innerHTML=t:i.textContent=t};TreeViewEditAction.prototype._getDisplayMemberPath=function(){var t=this._nd,e=t.treeView.displayMemberPath;e instanceof Array&&(e=e[t.level]);return e};return TreeViewEditAction}(UndoableAction),TreeViewCheckAction=function(t){__extends(TreeViewCheckAction,t);function TreeViewCheckAction(e,n){var o=t.call(this,e)||this;o._nd=n.node;o._oldState=o._nd.isChecked;return o}Object.defineProperty(TreeViewCheckAction.prototype,"control",{get:function(){return this._target},enumerable:!0,configurable:!0});Object.defineProperty(TreeViewCheckAction.prototype,"node",{get:function(){return this._nd},enumerable:!0,configurable:!0});TreeViewCheckAction.prototype.close=function(){this._newState=this._nd.isChecked;return this._newState!=this._oldState};TreeViewCheckAction.prototype.applyState=function(t){this._nd.select();this._nd.isChecked=t;this._target.focus()};return TreeViewCheckAction}(UndoableAction);wijmo_1._registerModule("wijmo.undo",selfModule);
package/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@mescius/wijmo.undo",
3
- "version": "5.20242.23-nightly.d20241008.t020138",
3
+ "version": "5.20242.23-nightly.d20241009.t020146",
4
4
  "description": "UI library for pure JS, Angular, React, Vue and more...",
5
5
  "author": "MESCIUS inc",
6
6
  "license": "Commercial",
7
7
  "main": "./index.js",
8
8
  "types": "./index.d.ts",
9
9
  "dependencies": {
10
- "@mescius/wijmo": "5.20242.23-nightly.d20241008.t020138",
11
- "@mescius/wijmo.input": "5.20242.23-nightly.d20241008.t020138",
12
- "@mescius/wijmo.grid": "5.20242.23-nightly.d20241008.t020138",
13
- "@mescius/wijmo.gauge": "5.20242.23-nightly.d20241008.t020138",
14
- "@mescius/wijmo.nav": "5.20242.23-nightly.d20241008.t020138"
10
+ "@mescius/wijmo": "5.20242.23-nightly.d20241009.t020146",
11
+ "@mescius/wijmo.input": "5.20242.23-nightly.d20241009.t020146",
12
+ "@mescius/wijmo.grid": "5.20242.23-nightly.d20241009.t020146",
13
+ "@mescius/wijmo.gauge": "5.20242.23-nightly.d20241009.t020146",
14
+ "@mescius/wijmo.nav": "5.20242.23-nightly.d20241009.t020146"
15
15
  },
16
16
  "homepage": "https://developer.mescius.com/wijmo",
17
17
  "bugs": {