|
@@ -38096,6 +38096,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
border: true,
|
|
|
columnLines: true,
|
|
|
rowLines: true,
|
|
|
+ scrollable: true,
|
|
|
plugins: {
|
|
|
cellediting: {
|
|
|
clicksToEdit: 1
|
|
@@ -38111,7 +38112,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
type: 'checkboxmodel',
|
|
|
checkOnly: false
|
|
|
},
|
|
|
- pagination: true,
|
|
|
+ pagination: false,
|
|
|
pageSize: 50,
|
|
|
pageSizeOption: ['20', '50', '100', '200', '300'],
|
|
|
hideFootbar: false,
|
|
@@ -40063,7 +40064,7 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
var storeOption = {};
|
|
|
if (dataSource.method === 'invoke') {
|
|
|
var fields_1 = [];
|
|
|
- lodash.forEach(grid.columns, function (col) {
|
|
|
+ lodash.forEach(config.columns, function (col) {
|
|
|
var c = {};
|
|
|
if (col.dataIndex) {
|
|
|
c.name = col.dataIndex;
|
|
@@ -40105,6 +40106,14 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
}
|
|
|
return grid.dataTransform.call(scope, grid, data);
|
|
|
}
|
|
|
+ var pagination = lodash.get(data, 'pagination');
|
|
|
+ if (pagination) {
|
|
|
+ var current = pagination.current, firstRowNum = pagination.firstRowNum, lastRowNum = pagination.lastRowNum, size = pagination.size, total = pagination.total;
|
|
|
+ grid.store.pageCount = Math.ceil(total / size);
|
|
|
+ grid.store.firstRowNum = firstRowNum;
|
|
|
+ grid.store.lastRowNum = lastRowNum;
|
|
|
+ grid.store.total = total;
|
|
|
+ }
|
|
|
return data;
|
|
|
}
|
|
|
}
|
|
@@ -40123,7 +40132,8 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
else {
|
|
|
throw new TypeError("不支持的 API 请求方式");
|
|
|
}
|
|
|
- me.setStore(new Ext.data.virtual.Store(storeOption));
|
|
|
+ // me.setStore(new Ext.data.virtual.Store(storeOption))
|
|
|
+ me.setStore(new Ext.data.Store(storeOption));
|
|
|
}
|
|
|
function initStores () {
|
|
|
Ext.define('Yvan.JsonAjaxProxy', {
|
|
@@ -40186,6 +40196,8 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
extend: 'Ext.grid.Grid',
|
|
|
xtype: 'yvgrid',
|
|
|
constructor: function (config) {
|
|
|
+ var _a;
|
|
|
+ var me = this;
|
|
|
var dataSource = config.dataSource;
|
|
|
if (!window["IS_DESIGN_MODE"]) {
|
|
|
this.columnConfigCacheKey = this.makeColumnConfigCacheKey(config);
|
|
@@ -40220,21 +40232,48 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
}, baseConfig(config, 'row-item'), config, grid);
|
|
|
// 在面板上的组件
|
|
|
var scope = newConfig.$initParent.yvanScope || newConfig.$initParent.lookupReferenceHolder().yvanScope;
|
|
|
- var buttons = [];
|
|
|
var getRowClass = newConfig.getRowClass;
|
|
|
if (typeof getRowClass === 'string' && (lodash.startsWith(getRowClass, "scope.") ||
|
|
|
lodash.startsWith(getRowClass, "system."))) {
|
|
|
var fn = lookupFn(scope, getRowClass);
|
|
|
lodash.set(newConfig, 'viewConfig.getRowClass', fn);
|
|
|
}
|
|
|
- if (!newConfig.hideAutoSize) {
|
|
|
- buttons.push({
|
|
|
- xtype: 'button',
|
|
|
- iconCls: 'x-fa fa-text-width',
|
|
|
- tooltip: '自适应宽度',
|
|
|
- listeners: {
|
|
|
- click: this.autoSizeColumns
|
|
|
- }
|
|
|
+ if (newConfig.pagination) {
|
|
|
+ newConfig.items = (_a = newConfig.items) !== null && _a !== void 0 ? _a : [];
|
|
|
+ newConfig.items.push({
|
|
|
+ docked: 'bottom',
|
|
|
+ cls: 'yvgrid-paging',
|
|
|
+ layout: {
|
|
|
+ type: 'hbox'
|
|
|
+ },
|
|
|
+ items: [
|
|
|
+ {
|
|
|
+ xtype: 'button',
|
|
|
+ text: '前一页',
|
|
|
+ key: 'btnPre',
|
|
|
+ iconCls: 'x-fa fa-angle-left',
|
|
|
+ handler: function () {
|
|
|
+ me.prePage();
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ html: '第 0-50 / 151 行',
|
|
|
+ cls: 'paging-text',
|
|
|
+ key: 'lblPage',
|
|
|
+ flex: 1,
|
|
|
+ },
|
|
|
+ {
|
|
|
+ xtype: 'button',
|
|
|
+ text: '后一页',
|
|
|
+ key: 'btnNext',
|
|
|
+ iconCls: 'x-fa fa-angle-right',
|
|
|
+ iconAlign: 'right',
|
|
|
+ textAlign: 'left',
|
|
|
+ handler: function () {
|
|
|
+ me.nextPage();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ]
|
|
|
});
|
|
|
}
|
|
|
lodash.each(newConfig.columns, function (c) {
|
|
@@ -40252,6 +40291,12 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
this.superclass.constructor.call(this, newConfig);
|
|
|
// this.store.pageSize = newConfig.pageSize
|
|
|
},
|
|
|
+ prePage: function () {
|
|
|
+ this.store.loadPage(this.store.currentPage - 1);
|
|
|
+ },
|
|
|
+ nextPage: function () {
|
|
|
+ this.store.loadPage(this.store.currentPage + 1);
|
|
|
+ },
|
|
|
setData: function (value) {
|
|
|
var me = this;
|
|
|
me._setDataReal(value);
|
|
@@ -40336,6 +40381,66 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
data: value
|
|
|
}));
|
|
|
},
|
|
|
+ setStore: function (store) {
|
|
|
+ var me = this;
|
|
|
+ if (lodash.isArray(store)) {
|
|
|
+ var value_1 = store;
|
|
|
+ this._transform(value_1);
|
|
|
+ var storeOpt = {
|
|
|
+ fields: getFileds(this),
|
|
|
+ data: value_1,
|
|
|
+ };
|
|
|
+ if (this.groupField) {
|
|
|
+ storeOpt.groupField = this.groupField;
|
|
|
+ }
|
|
|
+ store = new Ext.data.Store(storeOpt);
|
|
|
+ }
|
|
|
+ me.superclass.setStore.call(this, store);
|
|
|
+ if (store) {
|
|
|
+ store.on({
|
|
|
+ add: function (store, records, index, eOpts) {
|
|
|
+ me._raiseChange(store, 'add');
|
|
|
+ },
|
|
|
+ remove: function (store, records, index, isMove, eOpts) {
|
|
|
+ me._raiseChange(store, 'remove');
|
|
|
+ },
|
|
|
+ datachanged: function (sender, opt) {
|
|
|
+ me._raiseChange(store, 'datachanged');
|
|
|
+ },
|
|
|
+ refresh: function (sender, opt) {
|
|
|
+ me._raiseChange(store, 'refresh');
|
|
|
+ },
|
|
|
+ clear: function (sender, opt) {
|
|
|
+ me._raiseChange(store, 'clear');
|
|
|
+ },
|
|
|
+ });
|
|
|
+ }
|
|
|
+ },
|
|
|
+ _raiseChange: function (store, type) {
|
|
|
+ var btnPre = this.down('[key=btnPre]');
|
|
|
+ var lblPage = this.down('[key=lblPage]');
|
|
|
+ var btnNext = this.down('[key=btnNext]');
|
|
|
+ if (!this.store) {
|
|
|
+ btnPre.disable();
|
|
|
+ btnNext.disable();
|
|
|
+ lblPage.setHtml('无效数据源');
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (this.store.currentPage > 1) {
|
|
|
+ btnPre.enable();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ btnPre.disable();
|
|
|
+ }
|
|
|
+ if (this.store.currentPage < this.store.pageCount) {
|
|
|
+ btnNext.enable();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ btnNext.disable();
|
|
|
+ }
|
|
|
+ var _a = this.store, firstRowNum = _a.firstRowNum, lastRowNum = _a.lastRowNum, total = _a.total;
|
|
|
+ lblPage.setHtml("\u7B2C " + firstRowNum + "-" + lastRowNum + " / " + total + " \u884C");
|
|
|
+ },
|
|
|
/**
|
|
|
* 轻量级刷新
|
|
|
*/
|
|
@@ -40392,6 +40497,12 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
gridInvokeBuild(scope, me, config, dataSource, reloadParams);
|
|
|
}
|
|
|
},
|
|
|
+ itemclick: lodash.throttle(function (sender, location, eOpts) {
|
|
|
+ sender.fireEvent('itemclick', sender, location.record, location);
|
|
|
+ }, 1000, {
|
|
|
+ leading: true,
|
|
|
+ trailing: false,
|
|
|
+ }),
|
|
|
initialize: function () {
|
|
|
var _a;
|
|
|
var me = this;
|
|
@@ -40401,13 +40512,11 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
// 转换 dataSource 属性
|
|
|
convertDataSource(me, scope, config);
|
|
|
}
|
|
|
- // this.on({
|
|
|
- //
|
|
|
- //
|
|
|
- //
|
|
|
- // destory() {
|
|
|
- // },
|
|
|
- // })
|
|
|
+ this.on({
|
|
|
+ childtap: function (sender, location, eOpts) {
|
|
|
+ this.itemclick(me, location, eOpts);
|
|
|
+ },
|
|
|
+ });
|
|
|
if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.proxy) {
|
|
|
// 为 stores.proxy.buildRequest 做准备
|
|
|
this.store.proxy.$owner = this;
|
|
@@ -40560,7 +40669,6 @@ define(['exports'], function (exports) { 'use strict';
|
|
|
}
|
|
|
// throw new TypeError('无法识别的调用方法')
|
|
|
}
|
|
|
- //# sourceMappingURL=grid.js.map
|
|
|
|
|
|
function initGridColumn () {
|
|
|
var ct = Ext.grid.column.Column.prototype.constructor;
|