|
@@ -62517,7 +62517,8 @@ define(['exports', 'sql-formatter'], function (exports, sqlFormatter) { 'use str
|
|
|
if (pos1 >= 0) {
|
|
|
return true;
|
|
|
}
|
|
|
- if (lodash.intersection(pyzh.split(''), keyword.split('')).length === keyword.length) {
|
|
|
+ var len = lodash.intersection(keyword.split('')).length;
|
|
|
+ if (lodash.intersection(pyzh.split(''), keyword.split('')).length === len) {
|
|
|
return true;
|
|
|
}
|
|
|
return false;
|
|
@@ -63187,16 +63188,19 @@ define(['exports', 'sql-formatter'], function (exports, sqlFormatter) { 'use str
|
|
|
}
|
|
|
}, 150);
|
|
|
function saveGridRow(grid1) {
|
|
|
+ var _a;
|
|
|
var config = grid1.config;
|
|
|
var scope = lookupScope(grid1);
|
|
|
+ var saveRowValues = (_a = lodash.get(config, 'behavior.saveRowValues')) !== null && _a !== void 0 ? _a : {};
|
|
|
+ saveRowValues = calcObjectFlat(scope.viewModel.data, saveRowValues);
|
|
|
// "表格保存"的相关配置
|
|
|
var dbSaveConfig = {
|
|
|
columns: [],
|
|
|
dbTableName: lodash.get(config, 'behavior.dbTableName'),
|
|
|
- saveRowValues: lodash.get(config, 'behavior.saveRowValues'),
|
|
|
+ saveRowValues: saveRowValues,
|
|
|
path: scope.originalVjson.__custom_path,
|
|
|
};
|
|
|
- var _a = getGridEditRows(grid1), newRows = _a.newRows, modifyRows = _a.modifyRows, removeRecords = _a.removeRecords, rows = _a.rows, err = _a.err;
|
|
|
+ var _b = getGridEditRows(grid1), newRows = _b.newRows, modifyRows = _b.modifyRows, removeRecords = _b.removeRecords, rows = _b.rows, err = _b.err;
|
|
|
if (err) {
|
|
|
// 如果有异常就不保存
|
|
|
return;
|
|
@@ -63233,6 +63237,14 @@ define(['exports', 'sql-formatter'], function (exports, sqlFormatter) { 'use str
|
|
|
hasError = true;
|
|
|
return false;
|
|
|
}
|
|
|
+ if (c.xtype === 'checkcolumn') {
|
|
|
+ if (value === false && typeof c.uncheckedValue !== 'undefined') {
|
|
|
+ row[c.dataIndex] = c.uncheckedValue;
|
|
|
+ }
|
|
|
+ if (value === true && typeof c.checkedValue !== 'undefined') {
|
|
|
+ row[c.dataIndex] = c.checkedValue;
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
});
|
|
|
if (hasError) {
|
|
@@ -64100,16 +64112,17 @@ define(['exports', 'sql-formatter'], function (exports, sqlFormatter) { 'use str
|
|
|
emptyText: '搜索过滤',
|
|
|
enableKeyEvents: true,
|
|
|
listeners: {
|
|
|
- change: {
|
|
|
- fn: function (sender, e) {
|
|
|
- var _this = this;
|
|
|
- lodash.defer(function () {
|
|
|
- var scope = sender.up("yvtree");
|
|
|
- scope.filterByText(_this.getRawValue());
|
|
|
- });
|
|
|
- },
|
|
|
- buffer: 500
|
|
|
+ change: function (sender) {
|
|
|
+ var tree = sender.up("treepanel");
|
|
|
+ tree.filterByText(this.getRawValue());
|
|
|
},
|
|
|
+ keyup: function (sender, e) {
|
|
|
+ var tree = sender.up("treepanel");
|
|
|
+ if (e.ESC === e.getKey()) {
|
|
|
+ sender.setValue('');
|
|
|
+ tree.filterByText('');
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
],
|
|
@@ -64322,37 +64335,50 @@ define(['exports', 'sql-formatter'], function (exports, sqlFormatter) { 'use str
|
|
|
}
|
|
|
},
|
|
|
filterByText: function (text) {
|
|
|
- this.filterBy(text, 'text');
|
|
|
+ this._filterText = text;
|
|
|
+ this._filterBy(this, text, 'text');
|
|
|
},
|
|
|
- filterBy: function (text, by) {
|
|
|
- this.clearFilter();
|
|
|
- var view = this.getView(), me = this, nodesAndParents = [];
|
|
|
- this.getRootNode().cascadeBy(function (tree, view) {
|
|
|
+ _filterBy: lodash.debounce(function (me, text, by) {
|
|
|
+ var view = me.getView();
|
|
|
+ me.store.clearFilter();
|
|
|
+ if (!me._filterText) {
|
|
|
+ // 没有筛选内容,还原状态
|
|
|
+ var selections = me.getSelection();
|
|
|
+ var selectionPaths_1 = [];
|
|
|
+ lodash.forEach(me.getSelection(), function (item) {
|
|
|
+ selectionPaths_1.push(item.getPath());
|
|
|
+ });
|
|
|
+ me.collapseAll();
|
|
|
+ lodash.forEach(selectionPaths_1, function (path) {
|
|
|
+ me.expandPath(path);
|
|
|
+ });
|
|
|
+ me.setSelection(selections);
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ // 递归查找所有需要可见的节点 id 数组
|
|
|
+ var nodesAndParents = [];
|
|
|
+ var expandPaths = [];
|
|
|
+ me.getRootNode().cascadeBy(function (tree, view) {
|
|
|
var currNode = this;
|
|
|
- if (currNode && currNode.data[by] && currNode.data[by].toString().toLowerCase().indexOf(text.toLowerCase()) > -1) {
|
|
|
- me.expandPath(currNode.getPath());
|
|
|
+ currNode.collapse();
|
|
|
+ if (currNode && currNode.data[by] && pinyinMatch(currNode.data[by].toString(), text)) {
|
|
|
+ // 展开到匹配的路径
|
|
|
+ // me.expandPath(currNode.getPath());
|
|
|
+ expandPaths.push(currNode.getPath());
|
|
|
+ // 沿途父节点全部设定为可见
|
|
|
while (currNode.parentNode) {
|
|
|
nodesAndParents.push(currNode.id);
|
|
|
currNode = currNode.parentNode;
|
|
|
}
|
|
|
}
|
|
|
}, null, [me, view]);
|
|
|
- this.getRootNode().cascadeBy(function (tree, view) {
|
|
|
- var uiNode = view.getNodeByRecord(this);
|
|
|
- if (uiNode && !Ext.Array.contains(nodesAndParents, this.id)) {
|
|
|
- Ext.get(uiNode).setDisplayed('none');
|
|
|
- }
|
|
|
- }, null, [me, view]);
|
|
|
- },
|
|
|
- clearFilter: function () {
|
|
|
- var view = this.getView();
|
|
|
- this.getRootNode().cascadeBy(function (tree, view) {
|
|
|
- var uiNode = view.getNodeByRecord(this);
|
|
|
- if (uiNode) {
|
|
|
- Ext.get(uiNode).setDisplayed('table-row');
|
|
|
- }
|
|
|
- }, null, [this, view]);
|
|
|
- },
|
|
|
+ me.store.filterBy(function (r) {
|
|
|
+ return Ext.Array.contains(nodesAndParents, r.get('id'));
|
|
|
+ });
|
|
|
+ lodash.forEach(expandPaths, function (path) {
|
|
|
+ me.expandPath(path);
|
|
|
+ });
|
|
|
+ }, 1000),
|
|
|
});
|
|
|
}
|
|
|
function convertDataSource(sender, scope, newConfig) {
|
|
@@ -95917,37 +95943,26 @@ define(['exports', 'sql-formatter'], function (exports, sqlFormatter) { 'use str
|
|
|
//# sourceMappingURL=stores.js.map
|
|
|
|
|
|
function initBehaviorEdit(config) {
|
|
|
+ var _a, _b, _c;
|
|
|
var dbTableName = lodash.get(config, 'behavior.dbTableName');
|
|
|
+ var addButtonConfig = (_a = lodash.get(config, 'behavior.addButtonConfig')) !== null && _a !== void 0 ? _a : {};
|
|
|
+ var deleteButtonConfig = (_b = lodash.get(config, 'behavior.deleteButtonConfig')) !== null && _b !== void 0 ? _b : {};
|
|
|
+ var saveButtonConfig = (_c = lodash.get(config, 'behavior.saveButtonConfig')) !== null && _c !== void 0 ? _c : {};
|
|
|
if (dbTableName) {
|
|
|
// 生成增删查改
|
|
|
var tbar = [
|
|
|
- {
|
|
|
- xtype: 'button',
|
|
|
- text: '保存',
|
|
|
- iconCls: 'x-fa fa-save',
|
|
|
- cls: 'ext-btn-primary',
|
|
|
- listeners: {
|
|
|
+ __assign({ xtype: 'button', text: '保存', iconCls: 'x-fa fa-save', cls: 'ext-btn-primary', listeners: {
|
|
|
click: 'system.saveGridRow()'
|
|
|
- }
|
|
|
- },
|
|
|
+ }, bind: {
|
|
|
+ disabled: '{!' + config.reference + '.ischanged}'
|
|
|
+ } }, saveButtonConfig),
|
|
|
'-',
|
|
|
- {
|
|
|
- xtype: 'button',
|
|
|
- text: '添加',
|
|
|
- iconCls: 'x-fa fa-plus-circle',
|
|
|
- listeners: {
|
|
|
+ __assign({ xtype: 'button', text: '添加', iconCls: 'x-fa fa-plus-circle', listeners: {
|
|
|
click: 'system.insertGridRow()'
|
|
|
- }
|
|
|
- },
|
|
|
- {
|
|
|
- xtype: 'button',
|
|
|
- text: '删除',
|
|
|
- iconCls: 'x-fa fa-minus-circle',
|
|
|
- cls: 'ext-btn-danger',
|
|
|
- listeners: {
|
|
|
+ } }, addButtonConfig),
|
|
|
+ __assign({ xtype: 'button', text: '删除', iconCls: 'x-fa fa-minus-circle', cls: 'ext-btn-danger', listeners: {
|
|
|
click: 'system.removeGridRow()'
|
|
|
- }
|
|
|
- },
|
|
|
+ } }, deleteButtonConfig),
|
|
|
];
|
|
|
if (lodash.isArray(config.tbar)) {
|
|
|
config.tbar = __spread(tbar, [
|
|
@@ -96794,8 +96809,14 @@ define(['exports', 'sql-formatter'], function (exports, sqlFormatter) { 'use str
|
|
|
// },
|
|
|
destory: function () {
|
|
|
},
|
|
|
- selectionchange: function (sender, _a) {
|
|
|
- var _b = __read(_a, 1), record = _b[0];
|
|
|
+ selectionchange: function (sender, param) {
|
|
|
+ var record = undefined;
|
|
|
+ if (lodash.isArray(param)) {
|
|
|
+ record = param[0];
|
|
|
+ }
|
|
|
+ else if (lodash.isObject(param)) {
|
|
|
+ record = lodash.get(param, 'endCell.record');
|
|
|
+ }
|
|
|
itemselectFun(this, sender, record);
|
|
|
},
|
|
|
itemclick: function (sender, record) {
|
|
@@ -96826,7 +96847,6 @@ define(['exports', 'sql-formatter'], function (exports, sqlFormatter) { 'use str
|
|
|
});
|
|
|
});
|
|
|
var itemselectFun = lodash.debounce(function (me, sender, record) {
|
|
|
- me.fireEvent('itemselect', sender, record);
|
|
|
var reference = me.reference;
|
|
|
var scope = lookupScope(me);
|
|
|
var theid = lodash.get(config, 'behavior.theid');
|
|
@@ -96838,6 +96858,7 @@ define(['exports', 'sql-formatter'], function (exports, sqlFormatter) { 'use str
|
|
|
scope.viewModel.set(reference + '.theid', record.get(theid));
|
|
|
}
|
|
|
}
|
|
|
+ me.fireEvent('itemselect', sender, record);
|
|
|
}, 50);
|
|
|
if ((_a = this.store) === null || _a === void 0 ? void 0 : _a.proxy) {
|
|
|
// 为 stores.proxy.buildRequest 做准备
|