浏览代码

表单引擎 - grid_dialog

luoyifan 2 年之前
父节点
当前提交
968d84c638
共有 2 个文件被更改,包括 101 次插入1 次删除
  1. 100 0
      dist/yvan-ext.js
  2. 1 1
      dist/yvan-ext.js.map

+ 100 - 0
dist/yvan-ext.js

@@ -63315,6 +63315,21 @@ define(['exports', 'node-sql-parser', 'sql-formatter'], function (exports, nodeS
         });
         grid1.appendEditRow(insertRow, focusColumnAfterInsert);
     }
+    function showGridRowDetail(grid1) {
+        if (!grid1.selection) {
+            msg$1('请选中要展示的数据行!');
+            return;
+        }
+        var record = grid1.selection;
+        if (lodash.isArray(record)) {
+            record = record[0];
+        }
+        if (!record) {
+            msg$1('请选中要展示的数据行!');
+            return;
+        }
+        window['showGridRowDetail'](grid1, record);
+    }
     function removeGridRow(grid1) {
         var _a;
         var config = grid1.config;
@@ -63403,6 +63418,12 @@ define(['exports', 'node-sql-parser', 'sql-formatter'], function (exports, nodeS
                 removeGridRow(grid1);
             };
         };
+        SystemEventFu.prototype.showGridRowDetail = function () {
+            return function (sender) {
+                var grid1 = sender.up('yvgrid');
+                showGridRowDetail(grid1);
+            };
+        };
         SystemEventFu.prototype.enterToClick = function (btnReferenceName) {
             return function (sender, config) {
                 if (!config.listeners) {
@@ -63741,6 +63762,19 @@ define(['exports', 'node-sql-parser', 'sql-formatter'], function (exports, nodeS
         ], SystemEventFu.prototype, "removeGridRow", null);
         __decorate([
             Lib({
+                title: '为某个表格所选数据行, 显示其对话框',
+                author: '罗一帆',
+                createAt: '2022-07-27',
+                updateAt: '2022-07-27',
+                type: 'system',
+                category: '表格',
+            }),
+            __metadata("design:type", Function),
+            __metadata("design:paramtypes", []),
+            __metadata("design:returntype", void 0)
+        ], SystemEventFu.prototype, "showGridRowDetail", null);
+        __decorate([
+            Lib({
                 title: '按下回车键之后默认是否按下某个按钮',
                 author: '罗一帆',
                 createAt: '2021-07-02',
@@ -64142,6 +64176,7 @@ define(['exports', 'node-sql-parser', 'sql-formatter'], function (exports, nodeS
         clearViewModelReloadGrid: clearViewModelReloadGrid,
         saveGridRow: saveGridRow,
         insertGridRow: insertGridRow,
+        showGridRowDetail: showGridRowDetail,
         removeGridRow: removeGridRow,
         moveUpGridRow: moveUpGridRow,
         moveDownGridRow: moveDownGridRow,
@@ -64472,6 +64507,7 @@ define(['exports', 'node-sql-parser', 'sql-formatter'], function (exports, nodeS
         }
         // throw new TypeError('无法识别的调用方法')
     }
+    //# sourceMappingURL=yvtree.js.map
 
     /**
      * Create a blob builder even when vendor prefixes exist
@@ -96059,6 +96095,68 @@ define(['exports', 'node-sql-parser', 'sql-formatter'], function (exports, nodeS
     }
     //# sourceMappingURL=grid_behavior.js.map
 
+    function initGridDialog(config) {
+        var detailMode = lodash.get(config, 'behavior.detailMode');
+        var detailButtonConfig = lodash.get(config, 'behavior.detailButtonConfig');
+        if (detailMode === true) {
+            var tbar = [
+                __assign({ xtype: 'button', text: '详情', iconCls: 'x-fa fa-save', listeners: {
+                        click: 'system.showGridRowDetail()',
+                    }, bind: {
+                        disabled: '{!' + config.reference + '.selection}'
+                    } }, detailButtonConfig)
+            ];
+            if (lodash.isArray(config.tbar)) {
+                config.tbar = __spread(config.tbar, [
+                    '-'
+                ], tbar);
+            }
+            else if (lodash.isPlainObject(config.tbar)) {
+                if (lodash.get(config.tbar, 'layout.type') === 'vbox' || lodash.get(config.tbar, 'layout') === 'vbox') {
+                    config.tbar.items = __spread(config.tbar.items);
+                    var toolbar = lodash.find(config.tbar.items, function (item) { return item.xtype === 'toolbar'; });
+                    if (!toolbar) {
+                        config.tbar.items = __spread(config.tbar.items, [
+                            {
+                                xtype: 'toolbar',
+                                border: false,
+                                items: tbar
+                            },
+                        ]);
+                    }
+                    else {
+                        toolbar.items = __spread(toolbar.items, [
+                            '-'
+                        ], tbar);
+                    }
+                }
+                else {
+                    config.tbar = {
+                        border: false,
+                        layout: {
+                            type: 'vbox',
+                            align: 'stretch'
+                        },
+                        items: [
+                            {
+                                xtype: 'toolbar',
+                                border: false,
+                                items: tbar
+                            },
+                            config.tbar,
+                        ]
+                    };
+                }
+            }
+            else if (lodash.isUndefined(config.tbar)) {
+                config.tbar = tbar;
+            }
+            else {
+                console.error("can't build tbar property!", config.tbar);
+            }
+        }
+    }
+
     window["EXPORT_DATA_HOST"] = "http://127.0.0.1:30000/exportData";
     var hexToString = function (hex) {
         var arr = hex.split("");
@@ -96357,6 +96455,7 @@ define(['exports', 'node-sql-parser', 'sql-formatter'], function (exports, nodeS
                     };
                 }
                 initBehaviorEdit(newConfig);
+                initGridDialog(newConfig);
                 this.superclass.constructor.call(this, newConfig);
                 this.store.pageSize = newConfig.pageSize;
             },
@@ -134836,6 +134935,7 @@ define(['exports', 'node-sql-parser', 'sql-formatter'], function (exports, nodeS
     exports.setComboStore = setComboStore;
     exports.setDesignMode = setDesignMode;
     exports.showErrorDialog = showErrorDialog$1;
+    exports.showGridRowDetail = showGridRowDetail;
     exports.showInfoDialog = showInfoDialog;
     exports.showWidget = showWidget;
     exports.sqlUrlTransform = sqlUrlTransform;

文件差异内容过多而无法显示
+ 1 - 1
dist/yvan-ext.js.map