@mescius/wijmo.angular.grid 5.20232.939 → 5.20241.2-rc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -100
- package/es2015-commonjs.js +2 -2
- package/es2015-esm.js +2 -2
- package/es5-esm.js +1 -1
- package/index.d.ts +3 -3
- package/index.js +1 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
[English](#wijmo) | [日本語](#wijmo-jp) | [
|
|
1
|
+
[English](#wijmo) | [日本語](#wijmo-jp) | [한국어](#wijmo-kr)
|
|
2
2
|
|
|
3
3
|
# Wijmo
|
|
4
4
|
|
|
@@ -59,19 +59,19 @@ Sample source code available with our [Wijmo Developer Pack](https://developer.m
|
|
|
59
59
|
### To install latest release version:
|
|
60
60
|
|
|
61
61
|
```sh
|
|
62
|
-
npm install @
|
|
62
|
+
npm install @mescius/wijmo.all
|
|
63
63
|
```
|
|
64
64
|
|
|
65
65
|
### To install latest nightly build:
|
|
66
66
|
|
|
67
67
|
```sh
|
|
68
|
-
npm install @
|
|
68
|
+
npm install @mescius/wijmo.all@nightly
|
|
69
69
|
```
|
|
70
70
|
|
|
71
71
|
### To install latest RC build:
|
|
72
72
|
|
|
73
73
|
```sh
|
|
74
|
-
npm install @
|
|
74
|
+
npm install @mescius/wijmo.all@rc
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
## Documentation
|
|
@@ -159,99 +159,6 @@ Submit questions to our team of [Wijmo Experts](https://developer.mescius.com/fo
|
|
|
159
159
|
- [サポート&サービス](https://developer.mescius.jp/support)
|
|
160
160
|
- [サブスクリプションサービス利用規約](https://download.mescius.jp/license/other/componentone-subscriptionservice.pdf)
|
|
161
161
|
|
|
162
|
-
## Wijmo CN
|
|
163
|
-
|
|
164
|
-
Wijmo 是一套完整的企业级 JavaScript UI 开发组件。 它包括强大的表格、图表、数据透视、输入等组件,并且可以支持各类主流前端框架,包括 Angular、React 和 Vue。
|
|
165
|
-
|
|
166
|
-
Wijmo 的轻量级、高性能 JavaScript UI 组件可以将您的开发时间缩短一半。
|
|
167
|
-
|
|
168
|
-
查看我们 [FlexGrid 表格](https://demo.grapecity.com.cn/wijmo/demos/Grid/Overview/purejs) 组件.
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
---
|
|
172
|
-
|
|
173
|
-
## 从 NPM 获取您所缺少的开发包!
|
|
174
|
-
|
|
175
|
-
请务必下载 Wijmo 以获得完整的开发包。 NPM 仅包含我们的 JS 组件,但我们的开发包包含数百个示例,其中包含每个 JS 框架的源代码、实际参考应用程序等等!
|
|
176
|
-
|
|
177
|
-
**[下载 Wijmo 开发包](https://www.grapecity.com.cn/developer/wijmojs/download) 以启动您的项目。**
|
|
178
|
-
|
|
179
|
-
---
|
|
180
|
-
|
|
181
|
-
## 示例
|
|
182
|
-
|
|
183
|
-
每种 JavaScript 框架中都提供超过 450 个功能示例
|
|
184
|
-
|
|
185
|
-
- [JavaScript 示例](https://demo.grapecity.com.cn/wijmo/demos/Grid/Overview/purejs)
|
|
186
|
-
- [Vue 示例](https://demo.grapecity.com.cn/wijmo/demos/Grid/Overview/vue)
|
|
187
|
-
- [Angular 示例](https://demo.grapecity.com.cn/wijmo/demos/Grid/Overview/angular)
|
|
188
|
-
- [React 示例](https://demo.grapecity.com.cn/wijmo/demos/Grid/Overview/react)
|
|
189
|
-
|
|
190
|
-
我们还提供了 JavaScript 框架中可用的实际应用示例
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
- [Vue 参考应用](https://www.grapecity.com/wijmo/demos/reference-samples/#GeoDashboard)
|
|
194
|
-
- [Angular 参考应用](https://demos.wijmo.com/5/SampleExplorer/SampleExplorer/Sample/WealthHealth)
|
|
195
|
-
- [React 参考应用](https://www.grapecity.com/wijmo/demos/reference-samples/#GeoDashboard)
|
|
196
|
-
- [React Redux 参考应用](https://www.grapecity.com/wijmo/demos/reference-samples/#CryptoCurrencyTracking)
|
|
197
|
-
|
|
198
|
-
[Wijmo 开发包](https://www.grapecity.com.cn/developer/wijmojs/download) 中提供了示例源代码。
|
|
199
|
-
|
|
200
|
-
## 安装
|
|
201
|
-
|
|
202
|
-
### 安装最新版本:
|
|
203
|
-
|
|
204
|
-
```sh
|
|
205
|
-
npm install @grapecity/wijmo.all
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
### 安装最新的 nightly 版本:
|
|
209
|
-
```sh
|
|
210
|
-
npm install @grapecity/wijmo.all@nightly
|
|
211
|
-
```
|
|
212
|
-
|
|
213
|
-
### 安装最新的 RC 版本:
|
|
214
|
-
|
|
215
|
-
```sh
|
|
216
|
-
npm install @grapecity/wijmo.all@rc
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
## 文档
|
|
220
|
-
|
|
221
|
-
在线文档可在此处获取:
|
|
222
|
-
|
|
223
|
-
- [API Reference](https://demo.grapecity.com.cn/wijmo/api/)
|
|
224
|
-
- [Documentation Guides](https://demo.grapecity.com.cn/wijmo/docs/GettingStarted/Introduction)
|
|
225
|
-
|
|
226
|
-
## 许可
|
|
227
|
-
|
|
228
|
-
Wijmo授权由开发授权和部署授权组成
|
|
229
|
-
|
|
230
|
-
了解 [WijmoJS 价格与授权方式](https://www.grapecity.com.cn/developer/wijmojs#price).
|
|
231
|
-
|
|
232
|
-
## 资源
|
|
233
|
-
|
|
234
|
-
- [快速入门指南](https://demo.grapecity.com.cn/wijmo/docs/GettingStarted/QuickStart/QuickStart-PureJS)
|
|
235
|
-
- [Wijmo 产品介绍](https://www.grapecity.com.cn/developer/wijmojs)
|
|
236
|
-
- [博客](https://www.grapecity.com.cn/blogs/tags/wijmo)
|
|
237
|
-
- [论坛](https://gcdn.grapecity.com.cn/showforum-140-1.html)
|
|
238
|
-
|
|
239
|
-
Wijmo 开发包可以从 [这里](https://www.grapecity.com.cn/developer/wijmojs/download) 下载
|
|
240
|
-
|
|
241
|
-
## 支持
|
|
242
|
-
|
|
243
|
-
**Wijmo 随时为您提供支持**
|
|
244
|
-
|
|
245
|
-
提供多种售前支持方式。您可以通过电话热线、邮件、售前顾问、在线咨询、添加企业微信等方式获取获取售前咨询、产品解决方案、产品选型等1V1服务。帮您快速了解产品特性,助您POC验证成功,节省时间成本。
|
|
246
|
-
|
|
247
|
-
- [联系我们](https://www.grapecity.com.cn/support#goumaizixun)
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
## 问题反馈
|
|
251
|
-
|
|
252
|
-
我们重视您的反馈并利用建议来帮助创建产品路线图。 告诉我们你的想法。
|
|
253
|
-
|
|
254
|
-
[提交您的问题和反馈建议](https://gcdn.grapecity.com.cn/showforum-173-1.html)
|
|
255
162
|
|
|
256
163
|
# Wijmo KR
|
|
257
164
|
|
|
@@ -302,19 +209,19 @@ Wijmo는 또한 NPM을 지원합니다. 이를 통해 최신 버전의 Wijmo 라
|
|
|
302
209
|
**[최신 정식 버전]**
|
|
303
210
|
|
|
304
211
|
```sh
|
|
305
|
-
npm install @
|
|
212
|
+
npm install @mescius/wijmo.all
|
|
306
213
|
```
|
|
307
214
|
|
|
308
215
|
**[Nightly 버전]**
|
|
309
216
|
|
|
310
217
|
```sh
|
|
311
|
-
npm install @
|
|
218
|
+
npm install @mescius/wijmo.all@nightly
|
|
312
219
|
```
|
|
313
220
|
|
|
314
221
|
**[RC 버전]**
|
|
315
222
|
|
|
316
223
|
```sh
|
|
317
|
-
npm install @
|
|
224
|
+
npm install @mescius/wijmo.all@rc
|
|
318
225
|
```
|
|
319
226
|
|
|
320
227
|
## 빠른시작 가이드
|
package/es2015-commonjs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* Wijmo Library 5.
|
|
3
|
+
* Wijmo Library 5.20241.2
|
|
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(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var l in e)Object.hasOwnProperty.call(e,l)&&(t[l]=e[l]);t.default=e;return t};Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_angular_base_1=require("@mescius/wijmo.angular.base"),wijmo_1=require("@mescius/wijmo"),mNg=__importStar(require("angular")),wjcGrid=__importStar(require("@mescius/wijmo.grid"));var wjNg=mNg;const wijmoGridName="wj.grid";exports.ngModuleName="wj.grid";var wijmoGrid=wijmo_angular_base_1._registerNgModule("wj.grid");if(wijmo_angular_base_1.softRefGrid()&&wijmo_angular_base_1.softRefGrid().FlexGrid){wijmoGrid.directive("wjFlexGrid",["$compile","$interpolate",function(e,t){return new WjFlexGrid(e,t)}]);wijmoGrid.directive("wjFlexGridColumn",["$compile",function(e){return new WjFlexGridColumn(e)}]);wijmoGrid.directive("wjFlexGridCellTemplate",[function(){return new WjFlexGridCellTemplate}])}class WjFlexGrid extends wijmo_angular_base_1.WjDirective{constructor(e,t){super();this._$compile=e;this._$interpolate=t;this.transclude=!0;this.template="<div ng-transclude />"}get _controlConstructor(){return wjcGrid.FlexGrid}_createLink(){return new WjFlexGridLink}_initProps(){var e=wijmo_angular_base_1.MetaFactory.findProp("childItemsPath",this._props);e.scopeBindingMode="@";e.customHandler=function(e,t,l,i,r){if(l&&(l=l.trim())&&"["===l[0]){var o=e.$parent.$eval(l);t.childItemsPath=o;return!0}return!1}}}exports.WjFlexGrid=WjFlexGrid;class WjFlexGridLink extends wijmo_angular_base_1.WjLink{_initControl(){var e=super._initControl();new DirectiveCellFactory(e,this);return e}}var CellTemplateType,gridModule=wjcGrid&&wjcGrid.CellFactory;if(!gridModule){window.wijmo.grid={};window.wijmo.grid.CellFactory=function(){}}class DirectiveCellFactory extends wjcGrid.CellFactory{constructor(e,t){super();this._lastApplyTimeStamp=0;this._noApplyLag=!1;this._startingEditing=!1;this._cellStampCounter=0;this._composing=!1;this._grid=e;this._gridLink=t;this._rowHeightUpdates=new _RowHeightUpdateQueue(this);if(!DirectiveCellFactory._templateTypes){DirectiveCellFactory._templateTypes=[];for(var l in CellTemplateType)isNaN(l)&&DirectiveCellFactory._templateTypes.push(l)}var i=this;this._baseCf=e.cellFactory;e.cellFactory=this;this._evtInput=document.createEvent("HTMLEvents");this._evtInput.initEvent("input",!0,!1);this._evtChange=document.createEvent("HTMLEvents");this._evtChange.initEvent("change",!0,!1);this._evtBlur=document.createEvent("HTMLEvents");this._evtBlur.initEvent("blur",!1,!1);e.prepareCellForEdit.addHandler((function(e,t){i._noApplyLag=!0}));e.cellEditEnded.addHandler((function(t,l){(l.range.col<0||!e.columns[l.range.col][WjFlexGridCellTemplate._getTemplContextProp(CellTemplateType.CellEdit)])&&(i._editChar=null);setTimeout((function(){i._noApplyLag=!1}),300)}));e.beginningEdit.addHandler((function(e,t){!t.data||t.data instanceof KeyboardEvent&&!(t.data.charCode<=32)||(i._editChar=null);i._startingEditing=!0}));e.hostElement.addEventListener("keydown",(function(e){i._startingEditing=!1}),!0);e.hostElement.addEventListener("keypress",(function(t){var l=t.charCode>32?String.fromCharCode(t.charCode):null;l&&wijmo_1.closest(t.target,".wj-flexgrid")===e.hostElement&&(!e.activeEditor||i._startingEditing?i._editChar=l:i._editChar&&(i._editChar+=l))}),!0);e.hostElement.addEventListener("compositionstart",(function(e){i._composing=!0}),!0);e.hostElement.addEventListener("compositionend",(function(e){i._composing=!1}),!0)}updateCell(e,t,l,i,r){this._cellStampCounter=(this._cellStampCounter+1)%1e7;let o=i[DirectiveCellFactory._cellStampProp]=this._cellStampCounter;i.style.overflow&&(i.style.overflow="");let n=t,a=l;if(r&&!r.isSingleCell){t=r.row;l=r.col}let s,p=this,c=e.grid,d=c.editRange,u=e.rows[t],m=u.dataItem,_=!1,C=!1,h=!1,f=!1;switch(e.cellType){case wjcGrid.CellType.Cell:if(d&&d.row===t&&d.col===l){s=CellTemplateType.CellEdit;C=h=!0}else if(u instanceof wjcGrid.GroupRow){var g=!((f=m instanceof wijmo_1.CollectionViewGroup)||u.hasChildren);if(l==e.columns.firstVisibleIndex)s=g?CellTemplateType.Cell:CellTemplateType.GroupHeader;else{s=g?CellTemplateType.Cell:CellTemplateType.Group;C=!0}}else wijmo_angular_base_1.softRefGridDetail()&&wijmo_angular_base_1.softRefGridDetail().DetailRow&&u instanceof wijmo_angular_base_1.softRefGridDetail().DetailRow||(s=CellTemplateType.Cell);break;case wjcGrid.CellType.ColumnHeader:s=CellTemplateType.ColumnHeader;break;case wjcGrid.CellType.RowHeader:s=c.collectionView&&c.collectionView.currentEditItem===m?CellTemplateType.RowHeaderEdit:CellTemplateType.RowHeader;_=!0;break;case wjcGrid.CellType.TopLeft:s=CellTemplateType.TopLeft;_=!0;break;case wjcGrid.CellType.ColumnFooter:s=CellTemplateType.ColumnFooter;C=!0;break;case wjcGrid.CellType.BottomLeft:s=CellTemplateType.BottomLeft;_=!0}var w=!1;if(null!=s){var T=f&&s==CellTemplateType.GroupHeader?c.getColumn(m.groupDescription.propertyName):l>=0&&l<e.columns.length?e.columns[l]:null;if(T){var v=WjFlexGridCellTemplate._getTemplContextProp(s),j=(_?c:T)[v];if(!j)if(s===CellTemplateType.RowHeaderEdit){s=CellTemplateType.RowHeader;v=WjFlexGridCellTemplate._getTemplContextProp(s);j=c[v]}else if((s===CellTemplateType.Group||s===CellTemplateType.GroupHeader)&&!f){s=CellTemplateType.Cell;v=WjFlexGridCellTemplate._getTemplContextProp(s);j=T[v]}if(j){var y,E=p._getCellTemplate(j.cellTemplate),G=j.cellStyle,x=j.cellClass,F=!wijmo_1.isNullOrWhiteSpace(E),S=!wijmo_1.isNullOrWhiteSpace(G),L=!wijmo_1.isNullOrWhiteSpace(x);C&&(y=e.getCellData(t,l,!1));if(F){var W=i.getAttribute(wjcGrid.FlexGrid._WJS_MEASURE),H=W&&"true"===W.toLowerCase();w=!0;h&&this._baseCf.updateCell(e,n,a,i,r,!0);var b=i[v]||{},$=b.column!==T||!b.cellScope||!b.cellScope.$root,D=h&&this._composing&&c.imeEnabled,R=b.cellScope;if($){this._doDisposeCell(i);b.cellScope=R=j.templLink.scope.$parent.$new();b.column=T;i[v]=b}var k=R.$row!==u||R.$col!==T||R.$item!==m||R.$value!==y;k&&p._initCellScope(R,u,T,m,y);var I=j.cellLink;I||(I=j.cellLink=this._gridLink.directive._$compile('<div style="display:none"'+(S?' ng-style="'+G+'"':"")+(L?' ng-class="'+x+'"':"")+">"+E+"</div>"));var A=b.clonedElement;if($){var P=R.$watch((function(t){if(A){P();A[0].style.display="";if(e.cellType===wjcGrid.CellType.ColumnHeader||e.cellType===wjcGrid.CellType.TopLeft){var l=A[0].style,i=l.outlineColor,r=l.outlineWidth;l.outlineColor="white";l.outlineWidth="0px";setTimeout((function(){l.outlineColor=i;l.outlineWidth=r}),0)}}}));b.clonedElement=A=I(R,(function(e,t){}))}H&&(A[0].style.display="");var N=!1;if(h){var O=i.firstElementChild;if(O){D||i.focus();O.style.display="none"}}else(N=1==i.childNodes.length)||(i.textContent="");N?A[0]!==i.firstChild&&i.replaceChild(A[0],i.firstChild):i.appendChild(A[0]);j.cellOverflow&&(i.style.overflow=j.cellOverflow);this._closingApplyTimeOut&&clearTimeout(this._closingApplyTimeOut);p._rowHeightUpdates.add({panel:e,cell:i,rng:r,cellStamp:o,templateContext:j});if(H||d||this._noApplyLag||k&&Date.now()-this._lastApplyTimeStamp>40){clearTimeout(this._closingApplyTimeOut);R.$root&&!R.$root.$$phase&&R.$apply();d||H||p._rowHeightUpdates.execute();this._lastApplyTimeStamp=Date.now()}else{clearTimeout(this._closingApplyTimeOut);this._closingApplyTimeOut=setTimeout((function(){clearTimeout(this._closingApplyTimeOut);R.$root&&!R.$root.$$phase&&R.$apply();p._rowHeightUpdates.execute()}),10)}D?h&&setTimeout(()=>{D?this._initImeEditInput(b,j):this._initEditInput(b,j,null)},0):setTimeout((function(){if(p._updateRowHeight(e,i,r,o,j)){if(h){p._rowHeightUpdates.clear();let e=p._isFullEdit();c.refresh();c.startEditing(e);return}}else h&&p._initEditInput(b,j,null)}),0);if(h){p._cellEditorScope=R;var editEndingEH=function(r,o){c.cellEditEnding.removeHandler(editEndingEH);if(!o.stayInEditMode){var n=wijmo_1.getActiveElement();n&&n.dispatchEvent(p._evtBlur);wijmo_1.contains(i,wijmo_1.getActiveElement())&&i.focus()}if(!o.cancel&&!o.stayInEditMode){o.cancel=!0;e.grid.setCellData(t,l,R.$value)}var a=i.querySelectorAll(".wj-dropdown");[].forEach.call(a,(function(e){var t=wijmo_1.Control.getControl(e);t&&wijmo_angular_base_1.softRefInput()&&t instanceof wijmo_angular_base_1.softRefInput().DropDown&&(t.isDroppedDown=!1)}))};c.cellEditEnding.addHandler(editEndingEH);c.cellEditEnded.addHandler(()=>{p._cellEditorScope=null})}else this._baseCf.updateCell(e,n,a,i,r,!1)}}}}if(!w){this._doDisposeCell(i);this._baseCf.updateCell(e,n,a,i,r)}if(!F&&(S||L)){var M=p._initCellScope({},u,T,m,y),q=S?this._gridLink.scope.$parent.$eval(G,M):null,U=L?this._gridLink.scope.$parent.$eval(x,M):null;if(q||U){for(var B=document.createElement("div");i.firstChild;)B.appendChild(i.firstChild);i.appendChild(B);if(q)for(var V in q)B.style[V]=q[V];if(U){for(var z=wijmo_1.isArray(U)?U:[U],Q="",J=0;J<z.length;J++){var K=z[J];if(K)if(wijmo_1.isString(K))Q+=" "+K;else for(var X in K)K[X]&&(Q+=" "+X)}B.className=Q}}}}getEditorValue(e){return this._cellEditorScope?this._cellEditorScope.$value:super.getEditorValue(e)}disposeCell(e){this._doDisposeCell(e)}_doDisposeCell(e){for(var t=DirectiveCellFactory._templateTypes,l=0;l<t.length;l++){var i=WjFlexGridCellTemplate._getTemplContextProp(CellTemplateType[t[l]]),r=e[i];if(r&&r.cellScope&&r.cellScope.$root){r.cellScope.$destroy();if(r.clonedElement){r.clonedElement.remove();r.clonedElement=null}e[i]=null}}}_updateRowHeight(e,t,l,i,r){if(r.autoSizeRows){var o=t.scrollHeight,n=e.rows,a=l&&l.rowSpan||1;if(i===t[DirectiveCellFactory._cellStampProp]&&n.defaultSize*a<o){n.defaultSize=o/a;return!0}}return!1}_initCellScope(e,t,l,i,r){e.$row=t;e.$col=l;e.$item=i;e.$value=r;return e}_getCellTemplate(e){e&&(e=(e=(e=e.replace(/ class\=\"ng\-scope\"( \"ng\-binding\")?/g,"")).replace(/<span>\s*<\/span>/g,"")).trim());return e}_isFullEdit(){let e=this._grid;return!e.activeEditor||e._edtHdl._fullEdit}_setFullEdit(e){let t=this._grid;e.forceFullEdit&&t.activeEditor&&(t._edtHdl._fullEdit=!0)}_initEditInput(e,t,l){this._setFullEdit(t);var i=this._findInitialInput(e);if(i){let inpFocusEh=()=>{i.removeEventListener("focus",inpFocusEh);setTimeout(()=>{let e=null!=l?l:this._editChar;if(e){i.value=e;this._editChar=null;DirectiveCellFactory._setSelectionRange(i,e.length,e.length);!DirectiveCellFactory.isNgIE||wijmo_1.hasClass(i,"wj-form-control")||i.getAttribute("wj-part")?i.dispatchEvent(this._evtInput):i.dispatchEvent(this._evtChange)}},DirectiveCellFactory._FOCUS_INTERVAL)};i.addEventListener("focus",inpFocusEh);i.focus()}}_initImeEditInput(e,t){let l=wijmo_1.getActiveElement();if(l&&l instanceof HTMLInputElement&&wijmo_1.hasClass(l,"wj-grid-ime")){let compEndEh=i=>{l.removeEventListener("compositionend",compEndEh);wijmo_1.setCss(l,wjcGrid._ImeHandler._cssHidden);this._initEditInput(e,t,l.value)};l.addEventListener("compositionend",compEndEh);let i=this._findInitialInput(e);if(i){let e=i.getBoundingClientRect(),t=l.getBoundingClientRect(),r=window.getComputedStyle(l),o=parseFloat(r.left),n=parseFloat(r.top);wijmo_1.setCss(l,{left:o+e.left-t.left+"px",top:n+e.top-t.top+"px",width:e.width+"px",height:e.height+"px"})}}}_findInitialInput(e){let t=e.clonedElement[0].querySelectorAll("input,textarea");if(t)for(var l=0;l<t.length;l++){var i=t[l],r=window.getComputedStyle(i);if("none"!==r.display&&"visible"===r.visibility)return i}return null}static _setSelectionRange(e,t,l=t){if(wijmo_1.contains(document.body,e)&&!e.disabled&&"none"!=e.style.display)try{e.setSelectionRange(wijmo_1.asNumber(t),wijmo_1.asNumber(l),wijmo_1.isIE()?null:"backward");e.focus()}catch(e){}}}DirectiveCellFactory._cellStampProp="__wjCellStamp";DirectiveCellFactory._FOCUS_INTERVAL=wijmo_1.Control._FOCUS_INTERVAL+20;DirectiveCellFactory.isNgIE=!!document.documentMode;class _RowHeightUpdateQueue{constructor(e){this._requests=[];this._timeOuts=[];this._cellFactory=e}add(e){this._requests.push(e)}execute(){for(var e=this._requests;e.length>0;){var t=this._requests.shift(),l=this,i=function(e){return setTimeout((function(){if(l._cellFactory._updateRowHeight(e.panel,e.cell,e.rng,e.cellStamp,e.templateContext))l.clear();else{var t=l._timeOuts.indexOf(i);t>-1&&l._timeOuts.splice(t,1)}}),0)}(t);this._timeOuts.push(i)}}clear(){this._requests.splice(0,this._requests.length);this._clearTimeouts()}_clearTimeouts(){for(var e=this._timeOuts,t=0;t<e.length;t++)clearTimeout(e[t]);e.splice(0,e.length)}}gridModule||(window.wijmo.grid=null);class WjFlexGridColumn extends wijmo_angular_base_1.WjDirective{constructor(e){super();this._$compile=e;this.scope.dataMap+="map";this.scope.dataType+="type";this.require="^wjFlexGrid";this.terminal=!0;if(wijmo_angular_base_1.WjDirective._dynaTemplates){this.transclude=!1;this.priority=100;this.template=function(e,t){t[WjFlexGridColumn._colTemplateProp]=e[0].innerHTML;return'<div class="wjGridColumn"/>'}}else{this.transclude=!0;this.template='<div class="wjGridColumn" ng-transclude/>'}}get _controlConstructor(){return wjcGrid.Column}_initControl(e){return new wjcGrid.Column}_createLink(){return new WjFlexGridColumnLink}}WjFlexGridColumn._colTemplateProp="$__wjColTemplate";WjFlexGridColumn._colWjLinkProp="$__wjLink";WjFlexGridColumn._cellCtxProp="$_cellCtxProp";exports.WjFlexGridColumn=WjFlexGridColumn;class WjFlexGridColumnLink extends wijmo_angular_base_1.WjLink{_initParent(){var e=this.parent.control;if(e.autoGenerateColumns){e.autoGenerateColumns=!1;this._safeApply(this.scope,"autoGenerateColumns",!1);e.columns.clear()}super._initParent();var t=WjFlexGridCellTemplate._getTemplContextProp(CellTemplateType.Cell),l=this.control[t],i=this[WjFlexGridColumn._cellCtxProp];!l&&i&&(this.control[t]=i);this.control[WjFlexGridColumn._colWjLinkProp]=this}_link(){var e=this.tElement[0],t=this.tAttrs[WjFlexGridColumn._colTemplateProp],l=null!=t?t:wijmo_angular_base_1.WjDirective._removeTransclude(e.innerHTML),i={};if(!wijmo_1.isNullOrWhiteSpace(l)){var r=document.createElement("div");r.innerHTML=l;var o,n=[];[].forEach.call(r.children,(function(e){n.push(e)}));for(var a=0;a<n.length;a++){var s=n[a];if(s.tagName.toLocaleLowerCase()===WjFlexGridCellTemplate._tagName){o||(o=this.scope.$parent.$new());r.removeChild(s);e.appendChild(s);this.directive._$compile(s)(o)}}var p=r.innerHTML;wijmo_1.isNullOrWhiteSpace(p)||(i.cellTemplate=p)}var c=this.tAttrs.ngStyle,d=this.tAttrs.ngClass;c&&(i.cellStyle=c);d&&(i.cellClass=d);if(i.cellTemplate||i.cellStyle||i.cellClass){i.templLink=this;this[WjFlexGridColumn._cellCtxProp]=i}super._link()}}!function(e){e[e.Cell=0]="Cell";e[e.CellEdit=1]="CellEdit";e[e.ColumnHeader=2]="ColumnHeader";e[e.RowHeader=3]="RowHeader";e[e.RowHeaderEdit=4]="RowHeaderEdit";e[e.TopLeft=5]="TopLeft";e[e.GroupHeader=6]="GroupHeader";e[e.Group=7]="Group";e[e.ColumnFooter=8]="ColumnFooter";e[e.BottomLeft=9]="BottomLeft"}(CellTemplateType=exports.CellTemplateType||(exports.CellTemplateType={}));class WjFlexGridCellTemplate extends wijmo_angular_base_1.WjDirective{constructor(){super();this.require=["?^wjFlexGridColumn","?^wjFlexGrid"];this.terminal=!0;if(wijmo_angular_base_1.WjDirective._dynaTemplates){this.transclude=!1;this.priority=100;this.template=function(e,t){t[WjFlexGridColumn._colTemplateProp]=e[0].innerHTML;return"<div />"}}else{this.transclude=!0;this.template="<div ng-transclude/>"}}static _getTemplContextProp(e){return"$__cellTempl"+CellTemplateType[e]}_initControl(e){return{}}_createLink(){return new WjFlexGridCellTemplateLink}_getMetaDataId(){return"FlexGridCellTemplate"}}WjFlexGridCellTemplate._tagName="wj-flex-grid-cell-template";exports.WjFlexGridCellTemplate=WjFlexGridCellTemplate;class WjFlexGridCellTemplateLink extends wijmo_angular_base_1.WjLink{_initParent(){super._initParent();var e,t=this.scope.cellType;if(!t)return;e=CellTemplateType[t];var l=this.tAttrs[WjFlexGridColumn._colTemplateProp],i=null!=l?l:wijmo_angular_base_1.WjDirective._removeTransclude(this.tElement[0].innerHTML),r=this.control;wijmo_1.isNullOrWhiteSpace(i)||(r.cellTemplate=i);var o=this.tAttrs.ngStyle,n=this.tAttrs.ngClass;o&&(r.cellStyle=o);n&&(r.cellClass=n);this.tAttrs.forceFullEdit||(r.forceFullEdit=!0);let a=this.tAttrs.autoSizeRows;r.autoSizeRows=null==a||"true"===a;if(r.cellTemplate||r.cellStyle||r.cellClass){r.templLink=this;let t=this.parent.control;t[WjFlexGridCellTemplate._getTemplContextProp(e)]=r;t instanceof wjcGrid.Column&&t._setFlag(wjcGrid.RowColFlags.HasTemplate,!0)}WjFlexGridCellTemplateLink._invalidateGrid(this.parent.control)}_destroy(){var e=this.parent&&this.parent.control,t=this.scope.cellType;super._destroy();if(t){e[WjFlexGridCellTemplate._getTemplContextProp(CellTemplateType[t])]=void 0;WjFlexGridCellTemplateLink._invalidateGrid(e)}}static _invalidateGrid(e){var t=e;if(t){t instanceof wjcGrid.Column&&(t=t.grid);t&&t.invalidate()}}}
|
|
14
|
+
"use strict";var __importStar=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var l in e)Object.hasOwnProperty.call(e,l)&&(t[l]=e[l]);t.default=e;return t};Object.defineProperty(exports,"__esModule",{value:!0});const wijmo_angular_base_1=require("@mescius/wijmo.angular.base"),wijmo_1=require("@mescius/wijmo"),mNg=__importStar(require("angular")),wjcGrid=__importStar(require("@mescius/wijmo.grid"));var wjNg=mNg;const wijmoGridName="wj.grid";exports.ngModuleName="wj.grid";var wijmoGrid=wijmo_angular_base_1._registerNgModule("wj.grid");if(wijmo_angular_base_1.softRefGrid()&&wijmo_angular_base_1.softRefGrid().FlexGrid){wijmoGrid.directive("wjFlexGrid",["$compile","$interpolate",function(e,t){return new WjFlexGrid(e,t)}]);wijmoGrid.directive("wjFlexGridColumn",["$compile",function(e){return new WjFlexGridColumn(e)}]);wijmoGrid.directive("wjFlexGridCellTemplate",[function(){return new WjFlexGridCellTemplate}])}class WjFlexGrid extends wijmo_angular_base_1.WjDirective{constructor(e,t){super();this._$compile=e;this._$interpolate=t;this.transclude=!0;this.template="<div ng-transclude />"}get _controlConstructor(){return wjcGrid.FlexGrid}_createLink(){return new WjFlexGridLink}_initProps(){var e=wijmo_angular_base_1.MetaFactory.findProp("childItemsPath",this._props);e.scopeBindingMode="@";e.customHandler=function(e,t,l,i,r){if(l&&(l=l.trim())&&"["===l[0]){var o=e.$parent.$eval(l);t.childItemsPath=o;return!0}return!1}}}exports.WjFlexGrid=WjFlexGrid;class WjFlexGridLink extends wijmo_angular_base_1.WjLink{_initControl(){var e=super._initControl();new DirectiveCellFactory(e,this);return e}}var CellTemplateType,gridModule=wjcGrid&&wjcGrid.CellFactory;if(!gridModule){window.wijmo.grid={};window.wijmo.grid.CellFactory=function(){}}class DirectiveCellFactory extends wjcGrid.CellFactory{constructor(e,t){super();this._lastApplyTimeStamp=0;this._noApplyLag=!1;this._startingEditing=!1;this._cellStampCounter=0;this._composing=!1;this._grid=e;this._gridLink=t;this._rowHeightUpdates=new _RowHeightUpdateQueue(this);if(!DirectiveCellFactory._templateTypes){DirectiveCellFactory._templateTypes=[];for(var l in CellTemplateType)isNaN(l)&&DirectiveCellFactory._templateTypes.push(l)}var i=this;this._baseCf=e.cellFactory;e.cellFactory=this;this._evtInput=document.createEvent("HTMLEvents");this._evtInput.initEvent("input",!0,!1);this._evtChange=document.createEvent("HTMLEvents");this._evtChange.initEvent("change",!0,!1);this._evtBlur=document.createEvent("HTMLEvents");this._evtBlur.initEvent("blur",!1,!1);e.prepareCellForEdit.addHandler((function(e,t){i._noApplyLag=!0}));e.cellEditEnded.addHandler((function(t,l){(l.range.col<0||!e.columns[l.range.col][WjFlexGridCellTemplate._getTemplContextProp(CellTemplateType.CellEdit)])&&(i._editChar=null);setTimeout((function(){i._noApplyLag=!1}),300)}));e.beginningEdit.addHandler((function(e,t){!t.data||t.data instanceof KeyboardEvent&&!(t.data.charCode<=32)||(i._editChar=null);i._startingEditing=!0}));e.hostElement.addEventListener("keydown",(function(e){i._startingEditing=!1}),!0);e.hostElement.addEventListener("keypress",(function(t){var l=t.charCode>32?String.fromCharCode(t.charCode):null;l&&wijmo_1.closest(t.target,".wj-flexgrid")===e.hostElement&&(!e.activeEditor||i._startingEditing?i._editChar=l:i._editChar&&(i._editChar+=l))}),!0);e.hostElement.addEventListener("compositionstart",(function(e){i._composing=!0}),!0);e.hostElement.addEventListener("compositionend",(function(e){i._composing=!1}),!0)}updateCell(e,t,l,i,r){this._cellStampCounter=(this._cellStampCounter+1)%1e7;let o=i[DirectiveCellFactory._cellStampProp]=this._cellStampCounter;i.style.overflow&&(i.style.overflow="");let n=t,a=l;if(r&&!r.isSingleCell){t=r.row;l=r.col}let s,p=this,c=e.grid,d=c.editRange,u=e.rows[t],m=u.dataItem,_=!1,C=!1,h=!1,f=!1;switch(e.cellType){case wjcGrid.CellType.Cell:if(d&&d.row===t&&d.col===l){s=CellTemplateType.CellEdit;C=h=!0}else if(u instanceof wjcGrid.GroupRow){var w=!((f=m instanceof wijmo_1.CollectionViewGroup)||u.hasChildren);if(l==e.columns.firstVisibleIndex)s=w?CellTemplateType.Cell:CellTemplateType.GroupHeader;else{s=w?CellTemplateType.Cell:CellTemplateType.Group;C=!0}}else wijmo_angular_base_1.softRefGridDetail()&&wijmo_angular_base_1.softRefGridDetail().DetailRow&&u instanceof wijmo_angular_base_1.softRefGridDetail().DetailRow||(s=CellTemplateType.Cell);break;case wjcGrid.CellType.ColumnHeader:s=CellTemplateType.ColumnHeader;break;case wjcGrid.CellType.RowHeader:s=c.collectionView&&c.collectionView.currentEditItem===m?CellTemplateType.RowHeaderEdit:CellTemplateType.RowHeader;_=!0;break;case wjcGrid.CellType.TopLeft:s=CellTemplateType.TopLeft;_=!0;break;case wjcGrid.CellType.ColumnFooter:s=CellTemplateType.ColumnFooter;C=!0;break;case wjcGrid.CellType.BottomLeft:s=CellTemplateType.BottomLeft;_=!0}var g=!1;if(null!=s){var T=f&&s==CellTemplateType.GroupHeader?c.getColumn(m.groupDescription.propertyName):l>=0&&l<e.columns.length?e.columns[l]:null;if(T){var v=WjFlexGridCellTemplate._getTemplContextProp(s),j=(_?c:T)[v];if(!j)if(s===CellTemplateType.RowHeaderEdit){s=CellTemplateType.RowHeader;v=WjFlexGridCellTemplate._getTemplContextProp(s);j=c[v]}else if((s===CellTemplateType.Group||s===CellTemplateType.GroupHeader)&&!f){s=CellTemplateType.Cell;v=WjFlexGridCellTemplate._getTemplContextProp(s);j=T[v]}if(j){var y,E=p._getCellTemplate(j.cellTemplate),G=j.cellStyle,x=j.cellClass,F=!wijmo_1.isNullOrWhiteSpace(E),S=!wijmo_1.isNullOrWhiteSpace(G),L=!wijmo_1.isNullOrWhiteSpace(x);C&&(y=e.getCellData(t,l,!1));if(F){var W=i.getAttribute(wjcGrid.FlexGrid._WJS_MEASURE),H=W&&"true"===W.toLowerCase();g=!0;h&&this._baseCf.updateCell(e,n,a,i,r,!0);var b=i[v]||{},$=b.column!==T||!b.cellScope||!b.cellScope.$root,D=h&&this._composing&&c.imeEnabled,R=b.cellScope;if($){this._doDisposeCell(i);b.cellScope=R=j.templLink.scope.$parent.$new();b.column=T;i[v]=b}var k=R.$row!==u||R.$col!==T||R.$item!==m||R.$value!==y;k&&p._initCellScope(R,u,T,m,y);var I=j.cellLink;I||(I=j.cellLink=this._gridLink.directive._$compile('<div style="display:none"'+(S?' ng-style="'+G+'"':"")+(L?' ng-class="'+x+'"':"")+">"+E+"</div>"));var A=b.clonedElement;if($){var P=R.$watch((function(t){if(A){P();A[0].style.display="";if(e.cellType===wjcGrid.CellType.ColumnHeader||e.cellType===wjcGrid.CellType.TopLeft){var l=A[0].style,i=l.outlineColor,r=l.outlineWidth;l.outlineColor="white";l.outlineWidth="0px";setTimeout((function(){l.outlineColor=i;l.outlineWidth=r}),0)}}}));b.clonedElement=A=I(R,(function(e,t){}))}H&&(A[0].style.display="");var N=!1;if(h){var O=i.firstElementChild;if(O){D||i.focus();O.style.display="none"}}else(N=1==i.childNodes.length)||(i.textContent="");N?A[0]!==i.firstChild&&i.replaceChild(A[0],i.firstChild):i.appendChild(A[0]);j.cellOverflow&&(i.style.overflow=j.cellOverflow);this._closingApplyTimeOut&&clearTimeout(this._closingApplyTimeOut);p._rowHeightUpdates.add({panel:e,cell:i,rng:r,cellStamp:o,templateContext:j});if(H||d||this._noApplyLag||k&&Date.now()-this._lastApplyTimeStamp>40){clearTimeout(this._closingApplyTimeOut);R.$root&&!R.$root.$$phase&&R.$apply();d||H||p._rowHeightUpdates.execute();this._lastApplyTimeStamp=Date.now()}else{clearTimeout(this._closingApplyTimeOut);this._closingApplyTimeOut=setTimeout((function(){clearTimeout(this._closingApplyTimeOut);R.$root&&!R.$root.$$phase&&R.$apply();p._rowHeightUpdates.execute()}),10)}D?h&&setTimeout(()=>{D?this._initImeEditInput(b,j):this._initEditInput(b,j,null)},0):setTimeout((function(){if(p._updateRowHeight(e,i,r,o,j)){if(h){p._rowHeightUpdates.clear();let e=p._isFullEdit();c.refresh();c.startEditing(e);return}}else h&&p._initEditInput(b,j,null)}),0);if(h){p._cellEditorScope=R;var editEndingEH=function(r,o){c.cellEditEnding.removeHandler(editEndingEH);if(!o.stayInEditMode){var n=wijmo_1.getActiveElement();n&&n.dispatchEvent(p._evtBlur);wijmo_1.contains(i,wijmo_1.getActiveElement())&&i.focus()}if(!o.cancel&&!o.stayInEditMode){o.cancel=!0;e.grid.setCellData(t,l,R.$value)}var a=i.querySelectorAll(".wj-dropdown");[].forEach.call(a,(function(e){var t=wijmo_1.Control.getControl(e);t&&wijmo_angular_base_1.softRefInput()&&t instanceof wijmo_angular_base_1.softRefInput().DropDown&&(t.isDroppedDown=!1)}))};c.cellEditEnding.addHandler(editEndingEH);c.cellEditEnded.addHandler(()=>{p._cellEditorScope=null})}else this._baseCf.updateCell(e,n,a,i,r,!1)}}}}if(!g){this._doDisposeCell(i);this._baseCf.updateCell(e,n,a,i,r)}if(!F&&(S||L)){var M=p._initCellScope({},u,T,m,y),q=S?this._gridLink.scope.$parent.$eval(G,M):null,U=L?this._gridLink.scope.$parent.$eval(x,M):null;if(q||U){for(var B=document.createElement("div");i.firstChild;)B.appendChild(i.firstChild);i.appendChild(B);if(q)for(var V in q)B.style[V]=q[V];if(U){for(var z=wijmo_1.isArray(U)?U:[U],Q="",J=0;J<z.length;J++){var K=z[J];if(K)if(wijmo_1.isString(K))Q+=" "+K;else for(var X in K)K[X]&&(Q+=" "+X)}B.className=Q}}}}getEditorValue(e){return this._cellEditorScope?this._cellEditorScope.$value:super.getEditorValue(e)}disposeCell(e){this._doDisposeCell(e)}_doDisposeCell(e){for(var t=DirectiveCellFactory._templateTypes,l=0;l<t.length;l++){var i=WjFlexGridCellTemplate._getTemplContextProp(CellTemplateType[t[l]]),r=e[i];if(r&&r.cellScope&&r.cellScope.$root){r.cellScope.$destroy();if(r.clonedElement){r.clonedElement.remove();r.clonedElement=null}e[i]=null}}}_updateRowHeight(e,t,l,i,r){if(r.autoSizeRows){var o=t.scrollHeight,n=e.rows,a=l&&l.rowSpan||1;if(i===t[DirectiveCellFactory._cellStampProp]&&n.defaultSize*a<o){n.defaultSize=o/a;return!0}}return!1}_initCellScope(e,t,l,i,r){e.$row=t;e.$col=l;e.$item=i;e.$value=r;return e}_getCellTemplate(e){e&&(e=(e=(e=e.replace(/ class\=\"ng\-scope\"( \"ng\-binding\")?/g,"")).replace(/<span>\s*<\/span>/g,"")).trim());return e}_isFullEdit(){let e=this._grid;return!e.activeEditor||e._edtHdl._fullEdit}_setFullEdit(e){let t=this._grid;e.forceFullEdit&&t.activeEditor&&(t._edtHdl._fullEdit=!0)}_initEditInput(e,t,l){this._setFullEdit(t);var i=this._findInitialInput(e);if(i){let inpFocusEh=()=>{i.removeEventListener("focus",inpFocusEh);setTimeout(()=>{let e=null!=l?l:this._editChar;if(e){i.value=e;this._editChar=null;DirectiveCellFactory._setSelectionRange(i,e.length,e.length);!DirectiveCellFactory.isNgIE||wijmo_1.hasClass(i,"wj-form-control")||i.getAttribute("wj-part")?i.dispatchEvent(this._evtInput):i.dispatchEvent(this._evtChange)}},DirectiveCellFactory._FOCUS_INTERVAL)};i.addEventListener("focus",inpFocusEh);i.focus()}}_initImeEditInput(e,t){let l=wijmo_1.getActiveElement();if(l&&l instanceof HTMLInputElement&&wijmo_1.hasClass(l,"wj-grid-ime")){let compEndEh=i=>{l.removeEventListener("compositionend",compEndEh);wijmo_1.setCss(l,wjcGrid._ImeHandler._cssHidden);this._initEditInput(e,t,l.value)};l.addEventListener("compositionend",compEndEh);let i=this._findInitialInput(e);if(i){let e=i.getBoundingClientRect(),t=l.getBoundingClientRect(),r=window.getComputedStyle(l),o=parseFloat(r.left),n=parseFloat(r.top);wijmo_1.setCss(l,{left:o+e.left-t.left+"px",top:n+e.top-t.top+"px",width:e.width+"px",height:e.height+"px"})}}}_findInitialInput(e){let t=e.clonedElement[0].querySelectorAll("input,textarea");if(t)for(var l=0;l<t.length;l++){var i=t[l],r=window.getComputedStyle(i);if("none"!==r.display&&"visible"===r.visibility)return i}return null}static _setSelectionRange(e,t,l=t){if(wijmo_1.contains(document.body,e)&&!e.disabled&&"none"!=e.style.display)try{e.setSelectionRange(wijmo_1.asNumber(t),wijmo_1.asNumber(l),wijmo_1.isIE()?null:"backward");e.focus()}catch(e){}}}DirectiveCellFactory._cellStampProp="__wjCellStamp";DirectiveCellFactory._FOCUS_INTERVAL=wijmo_1.Control._FOCUS_INTERVAL+20;DirectiveCellFactory.isNgIE=!!document.documentMode;class _RowHeightUpdateQueue{constructor(e){this._requests=[];this._timeOuts=[];this._cellFactory=e}add(e){this._requests.push(e)}execute(){for(var e=this._requests;e.length>0;){var t=this._requests.shift(),l=this,i=function(e){return setTimeout((function(){if(l._cellFactory._updateRowHeight(e.panel,e.cell,e.rng,e.cellStamp,e.templateContext))l.clear();else{var t=l._timeOuts.indexOf(i);t>-1&&l._timeOuts.splice(t,1)}}),0)}(t);this._timeOuts.push(i)}}clear(){this._requests.splice(0,this._requests.length);this._clearTimeouts()}_clearTimeouts(){for(var e=this._timeOuts,t=0;t<e.length;t++)clearTimeout(e[t]);e.splice(0,e.length)}}gridModule||(window.wijmo.grid=null);class WjFlexGridColumn extends wijmo_angular_base_1.WjDirective{constructor(e){super();this._$compile=e;this.scope.dataMap+="map";this.scope.dataType+="type";this.require="^wjFlexGrid";this.terminal=!0;if(wijmo_angular_base_1.WjDirective._dynaTemplates){this.transclude=!1;this.priority=100;this.template=function(e,t){t[WjFlexGridColumn._colTemplateProp]=e[0].innerHTML;return'<div class="wjGridColumn"/>'}}else{this.transclude=!0;this.template='<div class="wjGridColumn" ng-transclude/>'}}get _controlConstructor(){return wjcGrid.Column}_initControl(e){return new wjcGrid.Column}_createLink(){return new WjFlexGridColumnLink}}WjFlexGridColumn._colTemplateProp="$__wjColTemplate";WjFlexGridColumn._colWjLinkProp="$__wjLink";WjFlexGridColumn._cellCtxProp="$_cellCtxProp";exports.WjFlexGridColumn=WjFlexGridColumn;class WjFlexGridColumnLink extends wijmo_angular_base_1.WjLink{_initParent(){var e=this.parent.control;if(e.autoGenerateColumns){e.autoGenerateColumns=!1;this._safeApply(this.scope,"autoGenerateColumns",!1);e.columns.clear()}super._initParent();var t=WjFlexGridCellTemplate._getTemplContextProp(CellTemplateType.Cell),l=this.control[t],i=this[WjFlexGridColumn._cellCtxProp];!l&&i&&(this.control[t]=i);this.control[WjFlexGridColumn._colWjLinkProp]=this}_link(){var e=this.tElement[0],t=this.tAttrs[WjFlexGridColumn._colTemplateProp],l=null!=t?t:wijmo_angular_base_1.WjDirective._removeTransclude(e.innerHTML),i={};if(!wijmo_1.isNullOrWhiteSpace(l)){var r=document.createElement("div");r.innerHTML=l;var o,n=[];[].forEach.call(r.children,(function(e){n.push(e)}));for(var a=0;a<n.length;a++){var s=n[a];if(s.tagName.toLocaleLowerCase()===WjFlexGridCellTemplate._tagName){o||(o=this.scope.$parent.$new());r.removeChild(s);e.appendChild(s);this.directive._$compile(s)(o)}}var p=r.innerHTML;wijmo_1.isNullOrWhiteSpace(p)||(i.cellTemplate=p)}var c=this.tAttrs.ngStyle,d=this.tAttrs.ngClass;c&&(i.cellStyle=c);d&&(i.cellClass=d);if(i.cellTemplate||i.cellStyle||i.cellClass){i.templLink=this;this[WjFlexGridColumn._cellCtxProp]=i}super._link()}}!function(e){e[e.Cell=0]="Cell";e[e.CellEdit=1]="CellEdit";e[e.ColumnHeader=2]="ColumnHeader";e[e.RowHeader=3]="RowHeader";e[e.RowHeaderEdit=4]="RowHeaderEdit";e[e.TopLeft=5]="TopLeft";e[e.GroupHeader=6]="GroupHeader";e[e.Group=7]="Group";e[e.ColumnFooter=8]="ColumnFooter";e[e.BottomLeft=9]="BottomLeft"}(CellTemplateType=exports.CellTemplateType||(exports.CellTemplateType={}));class WjFlexGridCellTemplate extends wijmo_angular_base_1.WjDirective{constructor(){super();this.require=["?^wjFlexGridColumn","?^wjFlexGrid"];this.terminal=!0;if(wijmo_angular_base_1.WjDirective._dynaTemplates){this.transclude=!1;this.priority=100;this.template=function(e,t){t[WjFlexGridColumn._colTemplateProp]=e[0].innerHTML;return"<div />"}}else{this.transclude=!0;this.template="<div ng-transclude/>"}}static _getTemplContextProp(e){return"$__cellTempl"+CellTemplateType[e]}_initControl(e){return{}}_createLink(){return new WjFlexGridCellTemplateLink}_getMetaDataId(){return"FlexGridCellTemplate"}}WjFlexGridCellTemplate._tagName="wj-flex-grid-cell-template";exports.WjFlexGridCellTemplate=WjFlexGridCellTemplate;class WjFlexGridCellTemplateLink extends wijmo_angular_base_1.WjLink{_initParent(){super._initParent();var e,t=this.scope.cellType;if(!t)return;e=CellTemplateType[t];var l=this.tAttrs[WjFlexGridColumn._colTemplateProp],i=null!=l?l:wijmo_angular_base_1.WjDirective._removeTransclude(this.tElement[0].innerHTML),r=this.control;wijmo_1.isNullOrWhiteSpace(i)||(r.cellTemplate=i);var o=this.tAttrs.ngStyle,n=this.tAttrs.ngClass;o&&(r.cellStyle=o);n&&(r.cellClass=n);this.tAttrs.forceFullEdit||(r.forceFullEdit=!0);let a=this.tAttrs.autoSizeRows;r.autoSizeRows=null==a||"true"===a;if(r.cellTemplate||r.cellStyle||r.cellClass){r.templLink=this;let t=this.parent.control;t[WjFlexGridCellTemplate._getTemplContextProp(e)]=r;t instanceof wjcGrid.Column&&t._setFlag(wjcGrid.RowColFlags.HasTemplate,!0)}WjFlexGridCellTemplateLink._invalidateGrid(this.parent.control)}_destroy(){var e=this.parent&&this.parent.control,t=this.scope.cellType;super._destroy();if(t){e[WjFlexGridCellTemplate._getTemplContextProp(CellTemplateType[t])]=void 0;WjFlexGridCellTemplateLink._invalidateGrid(e)}}static _invalidateGrid(e){var t=e;if(t){t instanceof wjcGrid.Column&&(t=t.grid);t&&t.invalidate()}}}
|
package/es2015-esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* Wijmo Library 5.
|
|
3
|
+
* Wijmo Library 5.20241.2
|
|
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{WjDirective,WjLink,MetaFactory,_registerNgModule,softRefGrid,softRefGridDetail,softRefInput}from"@mescius/wijmo.angular.base";import{Control,closest,CollectionViewGroup,isNullOrWhiteSpace,contains,getActiveElement,isArray,isString,hasClass,setCss,asNumber,isIE}from"@mescius/wijmo";import*as mNg from"angular";import*as wjcGrid from"@mescius/wijmo.grid";var wjNg=mNg;const wijmoGridName="wj.grid";export const ngModuleName="wj.grid";var wijmoGrid=_registerNgModule("wj.grid");if(softRefGrid()&&softRefGrid().FlexGrid){wijmoGrid.directive("wjFlexGrid",["$compile","$interpolate",function(e,t){return new WjFlexGrid(e,t)}]);wijmoGrid.directive("wjFlexGridColumn",["$compile",function(e){return new WjFlexGridColumn(e)}]);wijmoGrid.directive("wjFlexGridCellTemplate",[function(){return new WjFlexGridCellTemplate}])}export class WjFlexGrid extends WjDirective{constructor(e,t){super();this._$compile=e;this._$interpolate=t;this.transclude=!0;this.template="<div ng-transclude />"}get _controlConstructor(){return wjcGrid.FlexGrid}_createLink(){return new WjFlexGridLink}_initProps(){var e=MetaFactory.findProp("childItemsPath",this._props);e.scopeBindingMode="@";e.customHandler=function(e,t,l,i,r){if(l&&(l=l.trim())&&"["===l[0]){var o=e.$parent.$eval(l);t.childItemsPath=o;return!0}return!1}}}class WjFlexGridLink extends WjLink{_initControl(){var e=super._initControl();new DirectiveCellFactory(e,this);return e}}var gridModule=wjcGrid&&wjcGrid.CellFactory;if(!gridModule){window.wijmo.grid={};window.wijmo.grid.CellFactory=function(){}}class DirectiveCellFactory extends wjcGrid.CellFactory{constructor(e,t){super();this._lastApplyTimeStamp=0;this._noApplyLag=!1;this._startingEditing=!1;this._cellStampCounter=0;this._composing=!1;this._grid=e;this._gridLink=t;this._rowHeightUpdates=new _RowHeightUpdateQueue(this);if(!DirectiveCellFactory._templateTypes){DirectiveCellFactory._templateTypes=[];for(var l in CellTemplateType)isNaN(l)&&DirectiveCellFactory._templateTypes.push(l)}var i=this;this._baseCf=e.cellFactory;e.cellFactory=this;this._evtInput=document.createEvent("HTMLEvents");this._evtInput.initEvent("input",!0,!1);this._evtChange=document.createEvent("HTMLEvents");this._evtChange.initEvent("change",!0,!1);this._evtBlur=document.createEvent("HTMLEvents");this._evtBlur.initEvent("blur",!1,!1);e.prepareCellForEdit.addHandler((function(e,t){i._noApplyLag=!0}));e.cellEditEnded.addHandler((function(t,l){(l.range.col<0||!e.columns[l.range.col][WjFlexGridCellTemplate._getTemplContextProp(CellTemplateType.CellEdit)])&&(i._editChar=null);setTimeout((function(){i._noApplyLag=!1}),300)}));e.beginningEdit.addHandler((function(e,t){!t.data||t.data instanceof KeyboardEvent&&!(t.data.charCode<=32)||(i._editChar=null);i._startingEditing=!0}));e.hostElement.addEventListener("keydown",(function(e){i._startingEditing=!1}),!0);e.hostElement.addEventListener("keypress",(function(t){var l=t.charCode>32?String.fromCharCode(t.charCode):null;l&&closest(t.target,".wj-flexgrid")===e.hostElement&&(!e.activeEditor||i._startingEditing?i._editChar=l:i._editChar&&(i._editChar+=l))}),!0);e.hostElement.addEventListener("compositionstart",(function(e){i._composing=!0}),!0);e.hostElement.addEventListener("compositionend",(function(e){i._composing=!1}),!0)}updateCell(e,t,l,i,r){this._cellStampCounter=(this._cellStampCounter+1)%1e7;let o=i[DirectiveCellFactory._cellStampProp]=this._cellStampCounter;i.style.overflow&&(i.style.overflow="");let n=t,a=l;if(r&&!r.isSingleCell){t=r.row;l=r.col}let s,c=this,p=e.grid,d=p.editRange,u=e.rows[t],m=u.dataItem,C=!1,h=!1,_=!1,f=!1;switch(e.cellType){case wjcGrid.CellType.Cell:if(d&&d.row===t&&d.col===l){s=CellTemplateType.CellEdit;h=_=!0}else if(u instanceof wjcGrid.GroupRow){var T=!((f=m instanceof CollectionViewGroup)||u.hasChildren);if(l==e.columns.firstVisibleIndex)s=T?CellTemplateType.Cell:CellTemplateType.GroupHeader;else{s=T?CellTemplateType.Cell:CellTemplateType.Group;h=!0}}else softRefGridDetail()&&softRefGridDetail().DetailRow&&u instanceof softRefGridDetail().DetailRow||(s=CellTemplateType.Cell);break;case wjcGrid.CellType.ColumnHeader:s=CellTemplateType.ColumnHeader;break;case wjcGrid.CellType.RowHeader:s=p.collectionView&&p.collectionView.currentEditItem===m?CellTemplateType.RowHeaderEdit:CellTemplateType.RowHeader;C=!0;break;case wjcGrid.CellType.TopLeft:s=CellTemplateType.TopLeft;C=!0;break;case wjcGrid.CellType.ColumnFooter:s=CellTemplateType.ColumnFooter;h=!0;break;case wjcGrid.CellType.BottomLeft:s=CellTemplateType.BottomLeft;C=!0}var g=!1;if(null!=s){var v=f&&s==CellTemplateType.GroupHeader?p.getColumn(m.groupDescription.propertyName):l>=0&&l<e.columns.length?e.columns[l]:null;if(v){var y=WjFlexGridCellTemplate._getTemplContextProp(s),w=(C?p:v)[y];if(!w)if(s===CellTemplateType.RowHeaderEdit){s=CellTemplateType.RowHeader;y=WjFlexGridCellTemplate._getTemplContextProp(s);w=p[y]}else if((s===CellTemplateType.Group||s===CellTemplateType.GroupHeader)&&!f){s=CellTemplateType.Cell;y=WjFlexGridCellTemplate._getTemplContextProp(s);w=v[y]}if(w){var E,j=c._getCellTemplate(w.cellTemplate),G=w.cellStyle,F=w.cellClass,x=!isNullOrWhiteSpace(j),L=!isNullOrWhiteSpace(G),S=!isNullOrWhiteSpace(F);h&&(E=e.getCellData(t,l,!1));if(x){var W=i.getAttribute(wjcGrid.FlexGrid._WJS_MEASURE),H=W&&"true"===W.toLowerCase();g=!0;_&&this._baseCf.updateCell(e,n,a,i,r,!0);var $=i[y]||{},D=$.column!==v||!$.cellScope||!$.cellScope.$root,R=_&&this._composing&&p.imeEnabled,k=$.cellScope;if(D){this._doDisposeCell(i);$.cellScope=k=w.templLink.scope.$parent.$new();$.column=v;i[y]=$}var I=k.$row!==u||k.$col!==v||k.$item!==m||k.$value!==E;I&&c._initCellScope(k,u,v,m,E);var A=w.cellLink;A||(A=w.cellLink=this._gridLink.directive._$compile('<div style="display:none"'+(L?' ng-style="'+G+'"':"")+(S?' ng-class="'+F+'"':"")+">"+j+"</div>"));var P=$.clonedElement;if(D){var N=k.$watch((function(t){if(P){N();P[0].style.display="";if(e.cellType===wjcGrid.CellType.ColumnHeader||e.cellType===wjcGrid.CellType.TopLeft){var l=P[0].style,i=l.outlineColor,r=l.outlineWidth;l.outlineColor="white";l.outlineWidth="0px";setTimeout((function(){l.outlineColor=i;l.outlineWidth=r}),0)}}}));$.clonedElement=P=A(k,(function(e,t){}))}H&&(P[0].style.display="");var b=!1;if(_){var M=i.firstElementChild;if(M){R||i.focus();M.style.display="none"}}else(b=1==i.childNodes.length)||(i.textContent="");b?P[0]!==i.firstChild&&i.replaceChild(P[0],i.firstChild):i.appendChild(P[0]);w.cellOverflow&&(i.style.overflow=w.cellOverflow);this._closingApplyTimeOut&&clearTimeout(this._closingApplyTimeOut);c._rowHeightUpdates.add({panel:e,cell:i,rng:r,cellStamp:o,templateContext:w});if(H||d||this._noApplyLag||I&&Date.now()-this._lastApplyTimeStamp>40){clearTimeout(this._closingApplyTimeOut);k.$root&&!k.$root.$$phase&&k.$apply();d||H||c._rowHeightUpdates.execute();this._lastApplyTimeStamp=Date.now()}else{clearTimeout(this._closingApplyTimeOut);this._closingApplyTimeOut=setTimeout((function(){clearTimeout(this._closingApplyTimeOut);k.$root&&!k.$root.$$phase&&k.$apply();c._rowHeightUpdates.execute()}),10)}R?_&&setTimeout(()=>{R?this._initImeEditInput($,w):this._initEditInput($,w,null)},0):setTimeout((function(){if(c._updateRowHeight(e,i,r,o,w)){if(_){c._rowHeightUpdates.clear();let e=c._isFullEdit();p.refresh();p.startEditing(e);return}}else _&&c._initEditInput($,w,null)}),0);if(_){c._cellEditorScope=k;var editEndingEH=function(r,o){p.cellEditEnding.removeHandler(editEndingEH);if(!o.stayInEditMode){var n=getActiveElement();n&&n.dispatchEvent(c._evtBlur);contains(i,getActiveElement())&&i.focus()}if(!o.cancel&&!o.stayInEditMode){o.cancel=!0;e.grid.setCellData(t,l,k.$value)}var a=i.querySelectorAll(".wj-dropdown");[].forEach.call(a,(function(e){var t=Control.getControl(e);t&&softRefInput()&&t instanceof softRefInput().DropDown&&(t.isDroppedDown=!1)}))};p.cellEditEnding.addHandler(editEndingEH);p.cellEditEnded.addHandler(()=>{c._cellEditorScope=null})}else this._baseCf.updateCell(e,n,a,i,r,!1)}}}}if(!g){this._doDisposeCell(i);this._baseCf.updateCell(e,n,a,i,r)}if(!x&&(L||S)){var O=c._initCellScope({},u,v,m,E),U=L?this._gridLink.scope.$parent.$eval(G,O):null,q=S?this._gridLink.scope.$parent.$eval(F,O):null;if(U||q){for(var B=document.createElement("div");i.firstChild;)B.appendChild(i.firstChild);i.appendChild(B);if(U)for(var V in U)B.style[V]=U[V];if(q){for(var z=isArray(q)?q:[q],Q="",J=0;J<z.length;J++){var K=z[J];if(K)if(isString(K))Q+=" "+K;else for(var X in K)K[X]&&(Q+=" "+X)}B.className=Q}}}}getEditorValue(e){return this._cellEditorScope?this._cellEditorScope.$value:super.getEditorValue(e)}disposeCell(e){this._doDisposeCell(e)}_doDisposeCell(e){for(var t=DirectiveCellFactory._templateTypes,l=0;l<t.length;l++){var i=WjFlexGridCellTemplate._getTemplContextProp(CellTemplateType[t[l]]),r=e[i];if(r&&r.cellScope&&r.cellScope.$root){r.cellScope.$destroy();if(r.clonedElement){r.clonedElement.remove();r.clonedElement=null}e[i]=null}}}_updateRowHeight(e,t,l,i,r){if(r.autoSizeRows){var o=t.scrollHeight,n=e.rows,a=l&&l.rowSpan||1;if(i===t[DirectiveCellFactory._cellStampProp]&&n.defaultSize*a<o){n.defaultSize=o/a;return!0}}return!1}_initCellScope(e,t,l,i,r){e.$row=t;e.$col=l;e.$item=i;e.$value=r;return e}_getCellTemplate(e){e&&(e=(e=(e=e.replace(/ class\=\"ng\-scope\"( \"ng\-binding\")?/g,"")).replace(/<span>\s*<\/span>/g,"")).trim());return e}_isFullEdit(){let e=this._grid;return!e.activeEditor||e._edtHdl._fullEdit}_setFullEdit(e){let t=this._grid;e.forceFullEdit&&t.activeEditor&&(t._edtHdl._fullEdit=!0)}_initEditInput(e,t,l){this._setFullEdit(t);var i=this._findInitialInput(e);if(i){let inpFocusEh=()=>{i.removeEventListener("focus",inpFocusEh);setTimeout(()=>{let e=null!=l?l:this._editChar;if(e){i.value=e;this._editChar=null;DirectiveCellFactory._setSelectionRange(i,e.length,e.length);!DirectiveCellFactory.isNgIE||hasClass(i,"wj-form-control")||i.getAttribute("wj-part")?i.dispatchEvent(this._evtInput):i.dispatchEvent(this._evtChange)}},DirectiveCellFactory._FOCUS_INTERVAL)};i.addEventListener("focus",inpFocusEh);i.focus()}}_initImeEditInput(e,t){let l=getActiveElement();if(l&&l instanceof HTMLInputElement&&hasClass(l,"wj-grid-ime")){let compEndEh=i=>{l.removeEventListener("compositionend",compEndEh);setCss(l,wjcGrid._ImeHandler._cssHidden);this._initEditInput(e,t,l.value)};l.addEventListener("compositionend",compEndEh);let i=this._findInitialInput(e);if(i){let e=i.getBoundingClientRect(),t=l.getBoundingClientRect(),r=window.getComputedStyle(l),o=parseFloat(r.left),n=parseFloat(r.top);setCss(l,{left:o+e.left-t.left+"px",top:n+e.top-t.top+"px",width:e.width+"px",height:e.height+"px"})}}}_findInitialInput(e){let t=e.clonedElement[0].querySelectorAll("input,textarea");if(t)for(var l=0;l<t.length;l++){var i=t[l],r=window.getComputedStyle(i);if("none"!==r.display&&"visible"===r.visibility)return i}return null}static _setSelectionRange(e,t,l=t){if(contains(document.body,e)&&!e.disabled&&"none"!=e.style.display)try{e.setSelectionRange(asNumber(t),asNumber(l),isIE()?null:"backward");e.focus()}catch(e){}}}DirectiveCellFactory._cellStampProp="__wjCellStamp";DirectiveCellFactory._FOCUS_INTERVAL=Control._FOCUS_INTERVAL+20;DirectiveCellFactory.isNgIE=!!document.documentMode;class _RowHeightUpdateQueue{constructor(e){this._requests=[];this._timeOuts=[];this._cellFactory=e}add(e){this._requests.push(e)}execute(){for(var e=this._requests;e.length>0;){var t=this._requests.shift(),l=this,i=function(e){return setTimeout((function(){if(l._cellFactory._updateRowHeight(e.panel,e.cell,e.rng,e.cellStamp,e.templateContext))l.clear();else{var t=l._timeOuts.indexOf(i);t>-1&&l._timeOuts.splice(t,1)}}),0)}(t);this._timeOuts.push(i)}}clear(){this._requests.splice(0,this._requests.length);this._clearTimeouts()}_clearTimeouts(){for(var e=this._timeOuts,t=0;t<e.length;t++)clearTimeout(e[t]);e.splice(0,e.length)}}gridModule||(window.wijmo.grid=null);export class WjFlexGridColumn extends WjDirective{constructor(e){super();this._$compile=e;this.scope.dataMap+="map";this.scope.dataType+="type";this.require="^wjFlexGrid";this.terminal=!0;if(WjDirective._dynaTemplates){this.transclude=!1;this.priority=100;this.template=function(e,t){t[WjFlexGridColumn._colTemplateProp]=e[0].innerHTML;return'<div class="wjGridColumn"/>'}}else{this.transclude=!0;this.template='<div class="wjGridColumn" ng-transclude/>'}}get _controlConstructor(){return wjcGrid.Column}_initControl(e){return new wjcGrid.Column}_createLink(){return new WjFlexGridColumnLink}}WjFlexGridColumn._colTemplateProp="$__wjColTemplate";WjFlexGridColumn._colWjLinkProp="$__wjLink";WjFlexGridColumn._cellCtxProp="$_cellCtxProp";class WjFlexGridColumnLink extends WjLink{_initParent(){var e=this.parent.control;if(e.autoGenerateColumns){e.autoGenerateColumns=!1;this._safeApply(this.scope,"autoGenerateColumns",!1);e.columns.clear()}super._initParent();var t=WjFlexGridCellTemplate._getTemplContextProp(CellTemplateType.Cell),l=this.control[t],i=this[WjFlexGridColumn._cellCtxProp];!l&&i&&(this.control[t]=i);this.control[WjFlexGridColumn._colWjLinkProp]=this}_link(){var e=this.tElement[0],t=this.tAttrs[WjFlexGridColumn._colTemplateProp],l=null!=t?t:WjDirective._removeTransclude(e.innerHTML),i={};if(!isNullOrWhiteSpace(l)){var r=document.createElement("div");r.innerHTML=l;var o,n=[];[].forEach.call(r.children,(function(e){n.push(e)}));for(var a=0;a<n.length;a++){var s=n[a];if(s.tagName.toLocaleLowerCase()===WjFlexGridCellTemplate._tagName){o||(o=this.scope.$parent.$new());r.removeChild(s);e.appendChild(s);this.directive._$compile(s)(o)}}var c=r.innerHTML;isNullOrWhiteSpace(c)||(i.cellTemplate=c)}var p=this.tAttrs.ngStyle,d=this.tAttrs.ngClass;p&&(i.cellStyle=p);d&&(i.cellClass=d);if(i.cellTemplate||i.cellStyle||i.cellClass){i.templLink=this;this[WjFlexGridColumn._cellCtxProp]=i}super._link()}}export var CellTemplateType;!function(e){e[e.Cell=0]="Cell";e[e.CellEdit=1]="CellEdit";e[e.ColumnHeader=2]="ColumnHeader";e[e.RowHeader=3]="RowHeader";e[e.RowHeaderEdit=4]="RowHeaderEdit";e[e.TopLeft=5]="TopLeft";e[e.GroupHeader=6]="GroupHeader";e[e.Group=7]="Group";e[e.ColumnFooter=8]="ColumnFooter";e[e.BottomLeft=9]="BottomLeft"}(CellTemplateType||(CellTemplateType={}));export class WjFlexGridCellTemplate extends WjDirective{constructor(){super();this.require=["?^wjFlexGridColumn","?^wjFlexGrid"];this.terminal=!0;if(WjDirective._dynaTemplates){this.transclude=!1;this.priority=100;this.template=function(e,t){t[WjFlexGridColumn._colTemplateProp]=e[0].innerHTML;return"<div />"}}else{this.transclude=!0;this.template="<div ng-transclude/>"}}static _getTemplContextProp(e){return"$__cellTempl"+CellTemplateType[e]}_initControl(e){return{}}_createLink(){return new WjFlexGridCellTemplateLink}_getMetaDataId(){return"FlexGridCellTemplate"}}WjFlexGridCellTemplate._tagName="wj-flex-grid-cell-template";class WjFlexGridCellTemplateLink extends WjLink{_initParent(){super._initParent();var e,t=this.scope.cellType;if(!t)return;e=CellTemplateType[t];var l=this.tAttrs[WjFlexGridColumn._colTemplateProp],i=null!=l?l:WjDirective._removeTransclude(this.tElement[0].innerHTML),r=this.control;isNullOrWhiteSpace(i)||(r.cellTemplate=i);var o=this.tAttrs.ngStyle,n=this.tAttrs.ngClass;o&&(r.cellStyle=o);n&&(r.cellClass=n);this.tAttrs.forceFullEdit||(r.forceFullEdit=!0);let a=this.tAttrs.autoSizeRows;r.autoSizeRows=null==a||"true"===a;if(r.cellTemplate||r.cellStyle||r.cellClass){r.templLink=this;let t=this.parent.control;t[WjFlexGridCellTemplate._getTemplContextProp(e)]=r;t instanceof wjcGrid.Column&&t._setFlag(wjcGrid.RowColFlags.HasTemplate,!0)}WjFlexGridCellTemplateLink._invalidateGrid(this.parent.control)}_destroy(){var e=this.parent&&this.parent.control,t=this.scope.cellType;super._destroy();if(t){e[WjFlexGridCellTemplate._getTemplContextProp(CellTemplateType[t])]=void 0;WjFlexGridCellTemplateLink._invalidateGrid(e)}}static _invalidateGrid(e){var t=e;if(t){t instanceof wjcGrid.Column&&(t=t.grid);t&&t.invalidate()}}}
|
|
14
|
+
import{WjDirective,WjLink,MetaFactory,_registerNgModule,softRefGrid,softRefGridDetail,softRefInput}from"@mescius/wijmo.angular.base";import{Control,closest,CollectionViewGroup,isNullOrWhiteSpace,contains,getActiveElement,isArray,isString,hasClass,setCss,asNumber,isIE}from"@mescius/wijmo";import*as mNg from"angular";import*as wjcGrid from"@mescius/wijmo.grid";var wjNg=mNg;const wijmoGridName="wj.grid";export const ngModuleName="wj.grid";var wijmoGrid=_registerNgModule("wj.grid");if(softRefGrid()&&softRefGrid().FlexGrid){wijmoGrid.directive("wjFlexGrid",["$compile","$interpolate",function(e,t){return new WjFlexGrid(e,t)}]);wijmoGrid.directive("wjFlexGridColumn",["$compile",function(e){return new WjFlexGridColumn(e)}]);wijmoGrid.directive("wjFlexGridCellTemplate",[function(){return new WjFlexGridCellTemplate}])}export class WjFlexGrid extends WjDirective{constructor(e,t){super();this._$compile=e;this._$interpolate=t;this.transclude=!0;this.template="<div ng-transclude />"}get _controlConstructor(){return wjcGrid.FlexGrid}_createLink(){return new WjFlexGridLink}_initProps(){var e=MetaFactory.findProp("childItemsPath",this._props);e.scopeBindingMode="@";e.customHandler=function(e,t,l,i,r){if(l&&(l=l.trim())&&"["===l[0]){var o=e.$parent.$eval(l);t.childItemsPath=o;return!0}return!1}}}class WjFlexGridLink extends WjLink{_initControl(){var e=super._initControl();new DirectiveCellFactory(e,this);return e}}var gridModule=wjcGrid&&wjcGrid.CellFactory;if(!gridModule){window.wijmo.grid={};window.wijmo.grid.CellFactory=function(){}}class DirectiveCellFactory extends wjcGrid.CellFactory{constructor(e,t){super();this._lastApplyTimeStamp=0;this._noApplyLag=!1;this._startingEditing=!1;this._cellStampCounter=0;this._composing=!1;this._grid=e;this._gridLink=t;this._rowHeightUpdates=new _RowHeightUpdateQueue(this);if(!DirectiveCellFactory._templateTypes){DirectiveCellFactory._templateTypes=[];for(var l in CellTemplateType)isNaN(l)&&DirectiveCellFactory._templateTypes.push(l)}var i=this;this._baseCf=e.cellFactory;e.cellFactory=this;this._evtInput=document.createEvent("HTMLEvents");this._evtInput.initEvent("input",!0,!1);this._evtChange=document.createEvent("HTMLEvents");this._evtChange.initEvent("change",!0,!1);this._evtBlur=document.createEvent("HTMLEvents");this._evtBlur.initEvent("blur",!1,!1);e.prepareCellForEdit.addHandler((function(e,t){i._noApplyLag=!0}));e.cellEditEnded.addHandler((function(t,l){(l.range.col<0||!e.columns[l.range.col][WjFlexGridCellTemplate._getTemplContextProp(CellTemplateType.CellEdit)])&&(i._editChar=null);setTimeout((function(){i._noApplyLag=!1}),300)}));e.beginningEdit.addHandler((function(e,t){!t.data||t.data instanceof KeyboardEvent&&!(t.data.charCode<=32)||(i._editChar=null);i._startingEditing=!0}));e.hostElement.addEventListener("keydown",(function(e){i._startingEditing=!1}),!0);e.hostElement.addEventListener("keypress",(function(t){var l=t.charCode>32?String.fromCharCode(t.charCode):null;l&&closest(t.target,".wj-flexgrid")===e.hostElement&&(!e.activeEditor||i._startingEditing?i._editChar=l:i._editChar&&(i._editChar+=l))}),!0);e.hostElement.addEventListener("compositionstart",(function(e){i._composing=!0}),!0);e.hostElement.addEventListener("compositionend",(function(e){i._composing=!1}),!0)}updateCell(e,t,l,i,r){this._cellStampCounter=(this._cellStampCounter+1)%1e7;let o=i[DirectiveCellFactory._cellStampProp]=this._cellStampCounter;i.style.overflow&&(i.style.overflow="");let n=t,a=l;if(r&&!r.isSingleCell){t=r.row;l=r.col}let s,c=this,p=e.grid,d=p.editRange,u=e.rows[t],m=u.dataItem,C=!1,h=!1,_=!1,f=!1;switch(e.cellType){case wjcGrid.CellType.Cell:if(d&&d.row===t&&d.col===l){s=CellTemplateType.CellEdit;h=_=!0}else if(u instanceof wjcGrid.GroupRow){var T=!((f=m instanceof CollectionViewGroup)||u.hasChildren);if(l==e.columns.firstVisibleIndex)s=T?CellTemplateType.Cell:CellTemplateType.GroupHeader;else{s=T?CellTemplateType.Cell:CellTemplateType.Group;h=!0}}else softRefGridDetail()&&softRefGridDetail().DetailRow&&u instanceof softRefGridDetail().DetailRow||(s=CellTemplateType.Cell);break;case wjcGrid.CellType.ColumnHeader:s=CellTemplateType.ColumnHeader;break;case wjcGrid.CellType.RowHeader:s=p.collectionView&&p.collectionView.currentEditItem===m?CellTemplateType.RowHeaderEdit:CellTemplateType.RowHeader;C=!0;break;case wjcGrid.CellType.TopLeft:s=CellTemplateType.TopLeft;C=!0;break;case wjcGrid.CellType.ColumnFooter:s=CellTemplateType.ColumnFooter;h=!0;break;case wjcGrid.CellType.BottomLeft:s=CellTemplateType.BottomLeft;C=!0}var v=!1;if(null!=s){var g=f&&s==CellTemplateType.GroupHeader?p.getColumn(m.groupDescription.propertyName):l>=0&&l<e.columns.length?e.columns[l]:null;if(g){var y=WjFlexGridCellTemplate._getTemplContextProp(s),w=(C?p:g)[y];if(!w)if(s===CellTemplateType.RowHeaderEdit){s=CellTemplateType.RowHeader;y=WjFlexGridCellTemplate._getTemplContextProp(s);w=p[y]}else if((s===CellTemplateType.Group||s===CellTemplateType.GroupHeader)&&!f){s=CellTemplateType.Cell;y=WjFlexGridCellTemplate._getTemplContextProp(s);w=g[y]}if(w){var E,j=c._getCellTemplate(w.cellTemplate),G=w.cellStyle,F=w.cellClass,x=!isNullOrWhiteSpace(j),L=!isNullOrWhiteSpace(G),S=!isNullOrWhiteSpace(F);h&&(E=e.getCellData(t,l,!1));if(x){var W=i.getAttribute(wjcGrid.FlexGrid._WJS_MEASURE),H=W&&"true"===W.toLowerCase();v=!0;_&&this._baseCf.updateCell(e,n,a,i,r,!0);var $=i[y]||{},D=$.column!==g||!$.cellScope||!$.cellScope.$root,R=_&&this._composing&&p.imeEnabled,k=$.cellScope;if(D){this._doDisposeCell(i);$.cellScope=k=w.templLink.scope.$parent.$new();$.column=g;i[y]=$}var I=k.$row!==u||k.$col!==g||k.$item!==m||k.$value!==E;I&&c._initCellScope(k,u,g,m,E);var A=w.cellLink;A||(A=w.cellLink=this._gridLink.directive._$compile('<div style="display:none"'+(L?' ng-style="'+G+'"':"")+(S?' ng-class="'+F+'"':"")+">"+j+"</div>"));var P=$.clonedElement;if(D){var N=k.$watch((function(t){if(P){N();P[0].style.display="";if(e.cellType===wjcGrid.CellType.ColumnHeader||e.cellType===wjcGrid.CellType.TopLeft){var l=P[0].style,i=l.outlineColor,r=l.outlineWidth;l.outlineColor="white";l.outlineWidth="0px";setTimeout((function(){l.outlineColor=i;l.outlineWidth=r}),0)}}}));$.clonedElement=P=A(k,(function(e,t){}))}H&&(P[0].style.display="");var b=!1;if(_){var M=i.firstElementChild;if(M){R||i.focus();M.style.display="none"}}else(b=1==i.childNodes.length)||(i.textContent="");b?P[0]!==i.firstChild&&i.replaceChild(P[0],i.firstChild):i.appendChild(P[0]);w.cellOverflow&&(i.style.overflow=w.cellOverflow);this._closingApplyTimeOut&&clearTimeout(this._closingApplyTimeOut);c._rowHeightUpdates.add({panel:e,cell:i,rng:r,cellStamp:o,templateContext:w});if(H||d||this._noApplyLag||I&&Date.now()-this._lastApplyTimeStamp>40){clearTimeout(this._closingApplyTimeOut);k.$root&&!k.$root.$$phase&&k.$apply();d||H||c._rowHeightUpdates.execute();this._lastApplyTimeStamp=Date.now()}else{clearTimeout(this._closingApplyTimeOut);this._closingApplyTimeOut=setTimeout((function(){clearTimeout(this._closingApplyTimeOut);k.$root&&!k.$root.$$phase&&k.$apply();c._rowHeightUpdates.execute()}),10)}R?_&&setTimeout(()=>{R?this._initImeEditInput($,w):this._initEditInput($,w,null)},0):setTimeout((function(){if(c._updateRowHeight(e,i,r,o,w)){if(_){c._rowHeightUpdates.clear();let e=c._isFullEdit();p.refresh();p.startEditing(e);return}}else _&&c._initEditInput($,w,null)}),0);if(_){c._cellEditorScope=k;var editEndingEH=function(r,o){p.cellEditEnding.removeHandler(editEndingEH);if(!o.stayInEditMode){var n=getActiveElement();n&&n.dispatchEvent(c._evtBlur);contains(i,getActiveElement())&&i.focus()}if(!o.cancel&&!o.stayInEditMode){o.cancel=!0;e.grid.setCellData(t,l,k.$value)}var a=i.querySelectorAll(".wj-dropdown");[].forEach.call(a,(function(e){var t=Control.getControl(e);t&&softRefInput()&&t instanceof softRefInput().DropDown&&(t.isDroppedDown=!1)}))};p.cellEditEnding.addHandler(editEndingEH);p.cellEditEnded.addHandler(()=>{c._cellEditorScope=null})}else this._baseCf.updateCell(e,n,a,i,r,!1)}}}}if(!v){this._doDisposeCell(i);this._baseCf.updateCell(e,n,a,i,r)}if(!x&&(L||S)){var O=c._initCellScope({},u,g,m,E),U=L?this._gridLink.scope.$parent.$eval(G,O):null,q=S?this._gridLink.scope.$parent.$eval(F,O):null;if(U||q){for(var B=document.createElement("div");i.firstChild;)B.appendChild(i.firstChild);i.appendChild(B);if(U)for(var V in U)B.style[V]=U[V];if(q){for(var z=isArray(q)?q:[q],Q="",J=0;J<z.length;J++){var K=z[J];if(K)if(isString(K))Q+=" "+K;else for(var X in K)K[X]&&(Q+=" "+X)}B.className=Q}}}}getEditorValue(e){return this._cellEditorScope?this._cellEditorScope.$value:super.getEditorValue(e)}disposeCell(e){this._doDisposeCell(e)}_doDisposeCell(e){for(var t=DirectiveCellFactory._templateTypes,l=0;l<t.length;l++){var i=WjFlexGridCellTemplate._getTemplContextProp(CellTemplateType[t[l]]),r=e[i];if(r&&r.cellScope&&r.cellScope.$root){r.cellScope.$destroy();if(r.clonedElement){r.clonedElement.remove();r.clonedElement=null}e[i]=null}}}_updateRowHeight(e,t,l,i,r){if(r.autoSizeRows){var o=t.scrollHeight,n=e.rows,a=l&&l.rowSpan||1;if(i===t[DirectiveCellFactory._cellStampProp]&&n.defaultSize*a<o){n.defaultSize=o/a;return!0}}return!1}_initCellScope(e,t,l,i,r){e.$row=t;e.$col=l;e.$item=i;e.$value=r;return e}_getCellTemplate(e){e&&(e=(e=(e=e.replace(/ class\=\"ng\-scope\"( \"ng\-binding\")?/g,"")).replace(/<span>\s*<\/span>/g,"")).trim());return e}_isFullEdit(){let e=this._grid;return!e.activeEditor||e._edtHdl._fullEdit}_setFullEdit(e){let t=this._grid;e.forceFullEdit&&t.activeEditor&&(t._edtHdl._fullEdit=!0)}_initEditInput(e,t,l){this._setFullEdit(t);var i=this._findInitialInput(e);if(i){let inpFocusEh=()=>{i.removeEventListener("focus",inpFocusEh);setTimeout(()=>{let e=null!=l?l:this._editChar;if(e){i.value=e;this._editChar=null;DirectiveCellFactory._setSelectionRange(i,e.length,e.length);!DirectiveCellFactory.isNgIE||hasClass(i,"wj-form-control")||i.getAttribute("wj-part")?i.dispatchEvent(this._evtInput):i.dispatchEvent(this._evtChange)}},DirectiveCellFactory._FOCUS_INTERVAL)};i.addEventListener("focus",inpFocusEh);i.focus()}}_initImeEditInput(e,t){let l=getActiveElement();if(l&&l instanceof HTMLInputElement&&hasClass(l,"wj-grid-ime")){let compEndEh=i=>{l.removeEventListener("compositionend",compEndEh);setCss(l,wjcGrid._ImeHandler._cssHidden);this._initEditInput(e,t,l.value)};l.addEventListener("compositionend",compEndEh);let i=this._findInitialInput(e);if(i){let e=i.getBoundingClientRect(),t=l.getBoundingClientRect(),r=window.getComputedStyle(l),o=parseFloat(r.left),n=parseFloat(r.top);setCss(l,{left:o+e.left-t.left+"px",top:n+e.top-t.top+"px",width:e.width+"px",height:e.height+"px"})}}}_findInitialInput(e){let t=e.clonedElement[0].querySelectorAll("input,textarea");if(t)for(var l=0;l<t.length;l++){var i=t[l],r=window.getComputedStyle(i);if("none"!==r.display&&"visible"===r.visibility)return i}return null}static _setSelectionRange(e,t,l=t){if(contains(document.body,e)&&!e.disabled&&"none"!=e.style.display)try{e.setSelectionRange(asNumber(t),asNumber(l),isIE()?null:"backward");e.focus()}catch(e){}}}DirectiveCellFactory._cellStampProp="__wjCellStamp";DirectiveCellFactory._FOCUS_INTERVAL=Control._FOCUS_INTERVAL+20;DirectiveCellFactory.isNgIE=!!document.documentMode;class _RowHeightUpdateQueue{constructor(e){this._requests=[];this._timeOuts=[];this._cellFactory=e}add(e){this._requests.push(e)}execute(){for(var e=this._requests;e.length>0;){var t=this._requests.shift(),l=this,i=function(e){return setTimeout((function(){if(l._cellFactory._updateRowHeight(e.panel,e.cell,e.rng,e.cellStamp,e.templateContext))l.clear();else{var t=l._timeOuts.indexOf(i);t>-1&&l._timeOuts.splice(t,1)}}),0)}(t);this._timeOuts.push(i)}}clear(){this._requests.splice(0,this._requests.length);this._clearTimeouts()}_clearTimeouts(){for(var e=this._timeOuts,t=0;t<e.length;t++)clearTimeout(e[t]);e.splice(0,e.length)}}gridModule||(window.wijmo.grid=null);export class WjFlexGridColumn extends WjDirective{constructor(e){super();this._$compile=e;this.scope.dataMap+="map";this.scope.dataType+="type";this.require="^wjFlexGrid";this.terminal=!0;if(WjDirective._dynaTemplates){this.transclude=!1;this.priority=100;this.template=function(e,t){t[WjFlexGridColumn._colTemplateProp]=e[0].innerHTML;return'<div class="wjGridColumn"/>'}}else{this.transclude=!0;this.template='<div class="wjGridColumn" ng-transclude/>'}}get _controlConstructor(){return wjcGrid.Column}_initControl(e){return new wjcGrid.Column}_createLink(){return new WjFlexGridColumnLink}}WjFlexGridColumn._colTemplateProp="$__wjColTemplate";WjFlexGridColumn._colWjLinkProp="$__wjLink";WjFlexGridColumn._cellCtxProp="$_cellCtxProp";class WjFlexGridColumnLink extends WjLink{_initParent(){var e=this.parent.control;if(e.autoGenerateColumns){e.autoGenerateColumns=!1;this._safeApply(this.scope,"autoGenerateColumns",!1);e.columns.clear()}super._initParent();var t=WjFlexGridCellTemplate._getTemplContextProp(CellTemplateType.Cell),l=this.control[t],i=this[WjFlexGridColumn._cellCtxProp];!l&&i&&(this.control[t]=i);this.control[WjFlexGridColumn._colWjLinkProp]=this}_link(){var e=this.tElement[0],t=this.tAttrs[WjFlexGridColumn._colTemplateProp],l=null!=t?t:WjDirective._removeTransclude(e.innerHTML),i={};if(!isNullOrWhiteSpace(l)){var r=document.createElement("div");r.innerHTML=l;var o,n=[];[].forEach.call(r.children,(function(e){n.push(e)}));for(var a=0;a<n.length;a++){var s=n[a];if(s.tagName.toLocaleLowerCase()===WjFlexGridCellTemplate._tagName){o||(o=this.scope.$parent.$new());r.removeChild(s);e.appendChild(s);this.directive._$compile(s)(o)}}var c=r.innerHTML;isNullOrWhiteSpace(c)||(i.cellTemplate=c)}var p=this.tAttrs.ngStyle,d=this.tAttrs.ngClass;p&&(i.cellStyle=p);d&&(i.cellClass=d);if(i.cellTemplate||i.cellStyle||i.cellClass){i.templLink=this;this[WjFlexGridColumn._cellCtxProp]=i}super._link()}}export var CellTemplateType;!function(e){e[e.Cell=0]="Cell";e[e.CellEdit=1]="CellEdit";e[e.ColumnHeader=2]="ColumnHeader";e[e.RowHeader=3]="RowHeader";e[e.RowHeaderEdit=4]="RowHeaderEdit";e[e.TopLeft=5]="TopLeft";e[e.GroupHeader=6]="GroupHeader";e[e.Group=7]="Group";e[e.ColumnFooter=8]="ColumnFooter";e[e.BottomLeft=9]="BottomLeft"}(CellTemplateType||(CellTemplateType={}));export class WjFlexGridCellTemplate extends WjDirective{constructor(){super();this.require=["?^wjFlexGridColumn","?^wjFlexGrid"];this.terminal=!0;if(WjDirective._dynaTemplates){this.transclude=!1;this.priority=100;this.template=function(e,t){t[WjFlexGridColumn._colTemplateProp]=e[0].innerHTML;return"<div />"}}else{this.transclude=!0;this.template="<div ng-transclude/>"}}static _getTemplContextProp(e){return"$__cellTempl"+CellTemplateType[e]}_initControl(e){return{}}_createLink(){return new WjFlexGridCellTemplateLink}_getMetaDataId(){return"FlexGridCellTemplate"}}WjFlexGridCellTemplate._tagName="wj-flex-grid-cell-template";class WjFlexGridCellTemplateLink extends WjLink{_initParent(){super._initParent();var e,t=this.scope.cellType;if(!t)return;e=CellTemplateType[t];var l=this.tAttrs[WjFlexGridColumn._colTemplateProp],i=null!=l?l:WjDirective._removeTransclude(this.tElement[0].innerHTML),r=this.control;isNullOrWhiteSpace(i)||(r.cellTemplate=i);var o=this.tAttrs.ngStyle,n=this.tAttrs.ngClass;o&&(r.cellStyle=o);n&&(r.cellClass=n);this.tAttrs.forceFullEdit||(r.forceFullEdit=!0);let a=this.tAttrs.autoSizeRows;r.autoSizeRows=null==a||"true"===a;if(r.cellTemplate||r.cellStyle||r.cellClass){r.templLink=this;let t=this.parent.control;t[WjFlexGridCellTemplate._getTemplContextProp(e)]=r;t instanceof wjcGrid.Column&&t._setFlag(wjcGrid.RowColFlags.HasTemplate,!0)}WjFlexGridCellTemplateLink._invalidateGrid(this.parent.control)}_destroy(){var e=this.parent&&this.parent.control,t=this.scope.cellType;super._destroy();if(t){e[WjFlexGridCellTemplate._getTemplContextProp(CellTemplateType[t])]=void 0;WjFlexGridCellTemplateLink._invalidateGrid(e)}}static _invalidateGrid(e){var t=e;if(t){t instanceof wjcGrid.Column&&(t=t.grid);t&&t.invalidate()}}}
|
package/es5-esm.js
CHANGED
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
*
|
|
3
|
-
* Wijmo Library 5.
|
|
3
|
+
* Wijmo Library 5.20241.2
|
|
4
4
|
* https://developer.mescius.com/wijmo
|
|
5
5
|
*
|
|
6
6
|
* Copyright(c) MESCIUS inc. All rights reserved.
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
*
|
|
19
19
|
*/
|
|
20
20
|
export declare var ___keepComment: any;
|
|
21
|
-
import { WjDirective, WjLink } from '@
|
|
22
|
-
import * as wjcGrid from '@
|
|
21
|
+
import { WjDirective, WjLink } from '@mescius/wijmo.angular.base';
|
|
22
|
+
import * as wjcGrid from '@mescius/wijmo.grid';
|
|
23
23
|
/**
|
|
24
24
|
* Angular module name, which can be used in the <b>angular.module(moduleName)</b>
|
|
25
25
|
* function to obtain a reference to the module .
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mescius/wijmo.angular.grid",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.20241.2-rc",
|
|
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.
|
|
11
|
-
"@mescius/wijmo.grid": "5.
|
|
12
|
-
"@mescius/wijmo.input": "5.
|
|
13
|
-
"@mescius/wijmo.grid.detail": "5.
|
|
14
|
-
"@mescius/wijmo.angular.base": "5.
|
|
10
|
+
"@mescius/wijmo": "5.20241.2-rc",
|
|
11
|
+
"@mescius/wijmo.grid": "5.20241.2-rc",
|
|
12
|
+
"@mescius/wijmo.input": "5.20241.2-rc",
|
|
13
|
+
"@mescius/wijmo.grid.detail": "5.20241.2-rc",
|
|
14
|
+
"@mescius/wijmo.angular.base": "5.20241.2-rc"
|
|
15
15
|
},
|
|
16
16
|
"homepage": "https://developer.mescius.com/wijmo",
|
|
17
17
|
"bugs": {
|