@lemon-fe/kits 1.0.0-72 → 1.0.0-74
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/es/components/DataGrid/index.js +2 -1
- package/es/components/DataGrid/modules/master-detail/index.d.ts +1 -0
- package/es/components/DataGrid/modules/master-detail/index.js +1 -0
- package/es/components/DataGrid/modules/master-detail/masterDetail/detailCellRenderer.d.ts +14 -0
- package/es/components/DataGrid/modules/master-detail/masterDetail/detailCellRenderer.js +170 -0
- package/es/components/DataGrid/modules/master-detail/masterDetail/detailCellRendererCtrl.d.ts +20 -0
- package/es/components/DataGrid/modules/master-detail/masterDetail/detailCellRendererCtrl.js +253 -0
- package/es/components/DataGrid/modules/master-detail/masterDetailModule.d.ts +16 -0
- package/es/components/DataGrid/modules/master-detail/masterDetailModule.js +16 -0
- package/package.json +2 -2
|
@@ -77,6 +77,7 @@ import { ClipboardModule } from "./modules/clipboard";
|
|
|
77
77
|
import { MenuModule } from "./modules/menu";
|
|
78
78
|
import { ColumnsToolPanelModule } from "./modules/column-tool-panel";
|
|
79
79
|
import { SideBarModule } from "./modules/side-bar";
|
|
80
|
+
import { MasterDetailModule } from "./modules/master-detail";
|
|
80
81
|
import { Spin, Pagination, Empty } from 'antd';
|
|
81
82
|
import { prefix, getColField, isColumn, withSyncRender, Store, Selection, columnTypes } from "./utils";
|
|
82
83
|
import HeaderRenderer from "./renderer/HeaderRenderer";
|
|
@@ -90,7 +91,7 @@ import RowEditor, { RowEditorData } from "./cell-editors/Row";
|
|
|
90
91
|
import EditorWrapper from "./cell-editors/Wrapper";
|
|
91
92
|
import memoizeOne from 'memoize-one';
|
|
92
93
|
import Selected from "./components/Selected";
|
|
93
|
-
ModuleRegistry.registerModules([ClientSideRowModelModule, RowGroupingModule, InfiniteRowModelModule, ClipboardModule, MenuModule, SideBarModule, ColumnsToolPanelModule], false);
|
|
94
|
+
ModuleRegistry.registerModules([ClientSideRowModelModule, RowGroupingModule, InfiniteRowModelModule, ClipboardModule, MenuModule, SideBarModule, ColumnsToolPanelModule, MasterDetailModule], false);
|
|
94
95
|
var defaultColDef = {
|
|
95
96
|
resizable: true,
|
|
96
97
|
initialWidth: 140,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MasterDetailModule } from './masterDetailModule';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MasterDetailModule } from "./masterDetailModule";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Component, ICellRenderer, IDetailCellRendererParams } from "@ag-grid-community/core";
|
|
2
|
+
export declare class DetailCellRenderer extends Component implements ICellRenderer {
|
|
3
|
+
private static TEMPLATE;
|
|
4
|
+
private eDetailGrid;
|
|
5
|
+
private detailApi;
|
|
6
|
+
private params;
|
|
7
|
+
private ctrl;
|
|
8
|
+
init(params: IDetailCellRendererParams): void;
|
|
9
|
+
refresh(): boolean;
|
|
10
|
+
destroy(): void;
|
|
11
|
+
private selectAndSetTemplate;
|
|
12
|
+
private setDetailGrid;
|
|
13
|
+
private setRowData;
|
|
14
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2
|
+
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
4
|
+
|
|
5
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
6
|
+
|
|
7
|
+
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
|
8
|
+
|
|
9
|
+
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
|
10
|
+
|
|
11
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
12
|
+
|
|
13
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
14
|
+
|
|
15
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
16
|
+
|
|
17
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
18
|
+
|
|
19
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
20
|
+
|
|
21
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
22
|
+
|
|
23
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
24
|
+
|
|
25
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
26
|
+
|
|
27
|
+
var __decorate = this && this.__decorate || function (decorators, target, key, desc) {
|
|
28
|
+
var c = arguments.length,
|
|
29
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
30
|
+
d;
|
|
31
|
+
if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
|
|
32
|
+
if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
33
|
+
}
|
|
34
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
import { Component, Grid, RefSelector, _ } from "@ag-grid-community/core";
|
|
38
|
+
import { DetailCellRendererCtrl } from "./detailCellRendererCtrl";
|
|
39
|
+
export var DetailCellRenderer = /*#__PURE__*/function (_Component) {
|
|
40
|
+
_inherits(DetailCellRenderer, _Component);
|
|
41
|
+
|
|
42
|
+
var _super = _createSuper(DetailCellRenderer);
|
|
43
|
+
|
|
44
|
+
function DetailCellRenderer() {
|
|
45
|
+
_classCallCheck(this, DetailCellRenderer);
|
|
46
|
+
|
|
47
|
+
return _super.apply(this, arguments);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
_createClass(DetailCellRenderer, [{
|
|
51
|
+
key: "init",
|
|
52
|
+
value: function init(params) {
|
|
53
|
+
var _this = this;
|
|
54
|
+
|
|
55
|
+
this.params = params;
|
|
56
|
+
this.selectAndSetTemplate();
|
|
57
|
+
var compProxy = {
|
|
58
|
+
addOrRemoveCssClass: function addOrRemoveCssClass(cssClassName, on) {
|
|
59
|
+
return _this.addOrRemoveCssClass(cssClassName, on);
|
|
60
|
+
},
|
|
61
|
+
addOrRemoveDetailGridCssClass: function addOrRemoveDetailGridCssClass(cssClassName, on) {
|
|
62
|
+
return _this.eDetailGrid.classList.toggle(cssClassName, on);
|
|
63
|
+
},
|
|
64
|
+
setDetailGrid: function setDetailGrid(gridOptions) {
|
|
65
|
+
return _this.setDetailGrid(gridOptions);
|
|
66
|
+
},
|
|
67
|
+
setRowData: function setRowData(rowData) {
|
|
68
|
+
return _this.setRowData(rowData);
|
|
69
|
+
},
|
|
70
|
+
getGui: function getGui() {
|
|
71
|
+
return _this.eDetailGrid;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
this.ctrl = this.createManagedBean(new DetailCellRendererCtrl());
|
|
75
|
+
this.ctrl.init(compProxy, params);
|
|
76
|
+
}
|
|
77
|
+
}, {
|
|
78
|
+
key: "refresh",
|
|
79
|
+
value: function refresh() {
|
|
80
|
+
return this.ctrl && this.ctrl.refresh();
|
|
81
|
+
} // this is a user component, and IComponent has "public destroy()" as part of the interface.
|
|
82
|
+
// so we need to override destroy() just to make the method public.
|
|
83
|
+
|
|
84
|
+
}, {
|
|
85
|
+
key: "destroy",
|
|
86
|
+
value: function destroy() {
|
|
87
|
+
_get(_getPrototypeOf(DetailCellRenderer.prototype), "destroy", this).call(this);
|
|
88
|
+
}
|
|
89
|
+
}, {
|
|
90
|
+
key: "selectAndSetTemplate",
|
|
91
|
+
value: function selectAndSetTemplate() {
|
|
92
|
+
var _this2 = this;
|
|
93
|
+
|
|
94
|
+
if (this.params.pinned) {
|
|
95
|
+
this.setTemplate('<div class="ag-details-row"></div>');
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
var setDefaultTemplate = function setDefaultTemplate() {
|
|
100
|
+
_this2.setTemplate(DetailCellRenderer.TEMPLATE);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
if (_.missing(this.params.template)) {
|
|
104
|
+
// use default template
|
|
105
|
+
setDefaultTemplate();
|
|
106
|
+
} else {
|
|
107
|
+
// use user provided template
|
|
108
|
+
if (typeof this.params.template === 'string') {
|
|
109
|
+
this.setTemplate(this.params.template);
|
|
110
|
+
} else if (typeof this.params.template === 'function') {
|
|
111
|
+
var templateFunc = this.params.template;
|
|
112
|
+
var template = templateFunc(this.params);
|
|
113
|
+
this.setTemplate(template);
|
|
114
|
+
} else {
|
|
115
|
+
console.warn('AG Grid: detailCellRendererParams.template should be function or string');
|
|
116
|
+
setDefaultTemplate();
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (this.eDetailGrid == null) {
|
|
121
|
+
console.warn('AG Grid: reference to eDetailGrid was missing from the details template. ' + 'Please add ref="eDetailGrid" to the template.');
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}, {
|
|
125
|
+
key: "setDetailGrid",
|
|
126
|
+
value: function setDetailGrid(gridOptions) {
|
|
127
|
+
if (!this.eDetailGrid) {
|
|
128
|
+
return;
|
|
129
|
+
} // AG-1715
|
|
130
|
+
// this is only needed when reactUi=false, once we remove the old way
|
|
131
|
+
// of doing react, and Master / Details is all native React, then we
|
|
132
|
+
// can remove this code.
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
var agGridReact = this.context.getBean('agGridReact');
|
|
136
|
+
var agGridReactCloned = agGridReact ? _.cloneObject(agGridReact) : undefined; // when we create detail grid, the detail grid needs frameworkComponentWrapper so that
|
|
137
|
+
// it created child components correctly, ie Angular detail grid can have Angular cell renderer.
|
|
138
|
+
// this is only used by Angular and Vue, as React uses native React AG Grid detail grids
|
|
139
|
+
|
|
140
|
+
var frameworkComponentWrapper = this.context.getBean('frameworkComponentWrapper');
|
|
141
|
+
var frameworkOverrides = this.getFrameworkOverrides(); // tslint:disable-next-line
|
|
142
|
+
|
|
143
|
+
new Grid(this.eDetailGrid, gridOptions, {
|
|
144
|
+
frameworkOverrides: frameworkOverrides,
|
|
145
|
+
providedBeanInstances: {
|
|
146
|
+
agGridReact: agGridReactCloned,
|
|
147
|
+
frameworkComponentWrapper: frameworkComponentWrapper
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
this.detailApi = gridOptions.api;
|
|
151
|
+
this.ctrl.registerDetailWithMaster(gridOptions.api, gridOptions.columnApi);
|
|
152
|
+
this.addDestroyFunc(function () {
|
|
153
|
+
if (gridOptions.api) {
|
|
154
|
+
gridOptions.api.destroy();
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}, {
|
|
159
|
+
key: "setRowData",
|
|
160
|
+
value: function setRowData(rowData) {
|
|
161
|
+
// ensure detail grid api still exists (grid may be destroyed when async call tries to set data)
|
|
162
|
+
this.detailApi && this.detailApi.setRowData(rowData);
|
|
163
|
+
}
|
|
164
|
+
}]);
|
|
165
|
+
|
|
166
|
+
return DetailCellRenderer;
|
|
167
|
+
}(Component);
|
|
168
|
+
DetailCellRenderer.TEMPLATE = "<div class=\"ag-details-row\" role=\"gridcell\">\n <div ref=\"eDetailGrid\" class=\"ag-details-grid\" role=\"presentation\"></div>\n </div>";
|
|
169
|
+
|
|
170
|
+
__decorate([RefSelector('eDetailGrid')], DetailCellRenderer.prototype, "eDetailGrid", void 0);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BeanStub, ColumnApi, GridApi, IDetailCellRendererCtrl, IDetailCellRendererParams, IDetailCellRenderer } from "@ag-grid-community/core";
|
|
2
|
+
export declare class DetailCellRendererCtrl extends BeanStub implements IDetailCellRendererCtrl {
|
|
3
|
+
private environment;
|
|
4
|
+
private readonly rowPositionUtils;
|
|
5
|
+
private readonly focusService;
|
|
6
|
+
private params;
|
|
7
|
+
private comp;
|
|
8
|
+
private loadRowDataVersion;
|
|
9
|
+
private needRefresh;
|
|
10
|
+
private refreshStrategy;
|
|
11
|
+
init(comp: IDetailCellRenderer, params: IDetailCellRendererParams): void;
|
|
12
|
+
private onFullWidthRowFocused;
|
|
13
|
+
private setAutoHeightClasses;
|
|
14
|
+
private setupRefreshStrategy;
|
|
15
|
+
private addThemeToDetailGrid;
|
|
16
|
+
private createDetailGrid;
|
|
17
|
+
registerDetailWithMaster(api: GridApi, columnApi: ColumnApi): void;
|
|
18
|
+
private loadRowData;
|
|
19
|
+
refresh(): boolean;
|
|
20
|
+
}
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
2
|
+
|
|
3
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
4
|
+
|
|
5
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
6
|
+
|
|
7
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
8
|
+
|
|
9
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
10
|
+
|
|
11
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
+
|
|
13
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
14
|
+
|
|
15
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
16
|
+
|
|
17
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
18
|
+
|
|
19
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
20
|
+
|
|
21
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
22
|
+
|
|
23
|
+
var __decorate = this && this.__decorate || function (decorators, target, key, desc) {
|
|
24
|
+
var c = arguments.length,
|
|
25
|
+
r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc,
|
|
26
|
+
d;
|
|
27
|
+
if ((typeof Reflect === "undefined" ? "undefined" : _typeof(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);else for (var i = decorators.length - 1; i >= 0; i--) {
|
|
28
|
+
if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
29
|
+
}
|
|
30
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
import { Autowired, BeanStub, RowNode, Events, _ } from "@ag-grid-community/core";
|
|
34
|
+
export var DetailCellRendererCtrl = /*#__PURE__*/function (_BeanStub) {
|
|
35
|
+
_inherits(DetailCellRendererCtrl, _BeanStub);
|
|
36
|
+
|
|
37
|
+
var _super = _createSuper(DetailCellRendererCtrl);
|
|
38
|
+
|
|
39
|
+
function DetailCellRendererCtrl() {
|
|
40
|
+
var _this;
|
|
41
|
+
|
|
42
|
+
_classCallCheck(this, DetailCellRendererCtrl);
|
|
43
|
+
|
|
44
|
+
_this = _super.apply(this, arguments);
|
|
45
|
+
_this.loadRowDataVersion = 0;
|
|
46
|
+
_this.needRefresh = false;
|
|
47
|
+
return _this;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
_createClass(DetailCellRendererCtrl, [{
|
|
51
|
+
key: "init",
|
|
52
|
+
value: function init(comp, params) {
|
|
53
|
+
var _this2 = this;
|
|
54
|
+
|
|
55
|
+
this.params = params;
|
|
56
|
+
this.comp = comp;
|
|
57
|
+
var doNothingBecauseInsidePinnedSection = params.pinned != null;
|
|
58
|
+
|
|
59
|
+
if (doNothingBecauseInsidePinnedSection) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
this.setAutoHeightClasses();
|
|
64
|
+
this.setupRefreshStrategy();
|
|
65
|
+
this.addThemeToDetailGrid();
|
|
66
|
+
this.createDetailGrid();
|
|
67
|
+
this.loadRowData();
|
|
68
|
+
this.addManagedListener(params.node.parent, RowNode.EVENT_DATA_CHANGED, function () {
|
|
69
|
+
_this2.needRefresh = true;
|
|
70
|
+
});
|
|
71
|
+
this.addManagedListener(this.eventService, Events.EVENT_FULL_WIDTH_ROW_FOCUSED, this.onFullWidthRowFocused.bind(this));
|
|
72
|
+
}
|
|
73
|
+
}, {
|
|
74
|
+
key: "onFullWidthRowFocused",
|
|
75
|
+
value: function onFullWidthRowFocused(e) {
|
|
76
|
+
var params = this.params;
|
|
77
|
+
var row = {
|
|
78
|
+
rowIndex: params.node.rowIndex,
|
|
79
|
+
rowPinned: params.node.rowPinned
|
|
80
|
+
};
|
|
81
|
+
var eventRow = {
|
|
82
|
+
rowIndex: e.rowIndex,
|
|
83
|
+
rowPinned: e.rowPinned
|
|
84
|
+
};
|
|
85
|
+
var isSameRow = this.rowPositionUtils.sameRow(row, eventRow);
|
|
86
|
+
|
|
87
|
+
if (!isSameRow) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
this.focusService.focusInto(this.comp.getGui(), e.fromBelow);
|
|
92
|
+
}
|
|
93
|
+
}, {
|
|
94
|
+
key: "setAutoHeightClasses",
|
|
95
|
+
value: function setAutoHeightClasses() {
|
|
96
|
+
var autoHeight = this.gridOptionsWrapper.isDetailRowAutoHeight();
|
|
97
|
+
var parentClass = autoHeight ? 'ag-details-row-auto-height' : 'ag-details-row-fixed-height';
|
|
98
|
+
var detailClass = autoHeight ? 'ag-details-grid-auto-height' : 'ag-details-grid-fixed-height';
|
|
99
|
+
this.comp.addOrRemoveCssClass(parentClass, true);
|
|
100
|
+
this.comp.addOrRemoveDetailGridCssClass(detailClass, true);
|
|
101
|
+
}
|
|
102
|
+
}, {
|
|
103
|
+
key: "setupRefreshStrategy",
|
|
104
|
+
value: function setupRefreshStrategy() {
|
|
105
|
+
if (this.params.suppressRefresh) {
|
|
106
|
+
console.warn("AG Grid: as of v23.2.0, cellRendererParams.suppressRefresh for Detail Cell Renderer is no " + "longer used. Please set cellRendererParams.refreshStrategy = 'nothing' instead.");
|
|
107
|
+
this.refreshStrategy = 'nothing';
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
var providedStrategy = this.params.refreshStrategy;
|
|
112
|
+
var validSelection = providedStrategy == 'everything' || providedStrategy == 'nothing' || providedStrategy == 'rows';
|
|
113
|
+
|
|
114
|
+
if (validSelection) {
|
|
115
|
+
this.refreshStrategy = providedStrategy;
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (providedStrategy != null) {
|
|
120
|
+
console.warn("AG Grid: invalid cellRendererParams.refreshStrategy = '" + providedStrategy + "' supplied, defaulting to refreshStrategy = 'rows'.");
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
this.refreshStrategy = 'rows';
|
|
124
|
+
}
|
|
125
|
+
}, {
|
|
126
|
+
key: "addThemeToDetailGrid",
|
|
127
|
+
value: function addThemeToDetailGrid() {
|
|
128
|
+
// this is needed by environment service of the child grid, the class needs to be on
|
|
129
|
+
// the grid div itself - the browser's CSS on the other hand just inherits from the parent grid theme.
|
|
130
|
+
var _this$environment$get = this.environment.getTheme(),
|
|
131
|
+
theme = _this$environment$get.theme;
|
|
132
|
+
|
|
133
|
+
if (theme) {
|
|
134
|
+
this.comp.addOrRemoveDetailGridCssClass(theme, true);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}, {
|
|
138
|
+
key: "createDetailGrid",
|
|
139
|
+
value: function createDetailGrid() {
|
|
140
|
+
if (_.missing(this.params.detailGridOptions)) {
|
|
141
|
+
console.warn('AG Grid: could not find detail grid options for master detail, ' + 'please set gridOptions.detailCellRendererParams.detailGridOptions');
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
var autoHeight = this.gridOptionsWrapper.isDetailRowAutoHeight(); // we clone the detail grid options, as otherwise it would be shared
|
|
146
|
+
// across many instances, and that would be a problem because we set
|
|
147
|
+
// api and columnApi into gridOptions
|
|
148
|
+
|
|
149
|
+
var gridOptions = Object.assign({}, this.params.detailGridOptions);
|
|
150
|
+
|
|
151
|
+
if (autoHeight) {
|
|
152
|
+
gridOptions.domLayout = 'autoHeight';
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
this.comp.setDetailGrid(gridOptions);
|
|
156
|
+
}
|
|
157
|
+
}, {
|
|
158
|
+
key: "registerDetailWithMaster",
|
|
159
|
+
value: function registerDetailWithMaster(api, columnApi) {
|
|
160
|
+
var rowId = this.params.node.id;
|
|
161
|
+
var masterGridApi = this.params.api;
|
|
162
|
+
var gridInfo = {
|
|
163
|
+
id: rowId,
|
|
164
|
+
api: api,
|
|
165
|
+
columnApi: columnApi
|
|
166
|
+
};
|
|
167
|
+
var rowNode = this.params.node; // register with api
|
|
168
|
+
|
|
169
|
+
masterGridApi.addDetailGridInfo(rowId, gridInfo); // register with node
|
|
170
|
+
|
|
171
|
+
rowNode.detailGridInfo = gridInfo;
|
|
172
|
+
this.addDestroyFunc(function () {
|
|
173
|
+
// the gridInfo can be stale if a refresh happens and
|
|
174
|
+
// a new row is created before the old one is destroyed.
|
|
175
|
+
if (rowNode.detailGridInfo !== gridInfo) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
masterGridApi.removeDetailGridInfo(rowId); // unregister from api
|
|
180
|
+
|
|
181
|
+
rowNode.detailGridInfo = null; // unregister from node
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}, {
|
|
185
|
+
key: "loadRowData",
|
|
186
|
+
value: function loadRowData() {
|
|
187
|
+
var _this3 = this;
|
|
188
|
+
|
|
189
|
+
// in case a refresh happens before the last refresh completes (as we depend on async
|
|
190
|
+
// application logic) we keep track on what the latest call was.
|
|
191
|
+
this.loadRowDataVersion++;
|
|
192
|
+
var versionThisCall = this.loadRowDataVersion;
|
|
193
|
+
var userFunc = this.params.getDetailRowData;
|
|
194
|
+
|
|
195
|
+
if (!userFunc) {
|
|
196
|
+
console.warn('AG Grid: could not find getDetailRowData for master / detail, ' + 'please set gridOptions.detailCellRendererParams.getDetailRowData');
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
var successCallback = function successCallback(rowData) {
|
|
201
|
+
var mostRecentCall = _this3.loadRowDataVersion === versionThisCall;
|
|
202
|
+
|
|
203
|
+
if (mostRecentCall) {
|
|
204
|
+
_this3.comp.setRowData(rowData);
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
var funcParams = {
|
|
209
|
+
node: this.params.node,
|
|
210
|
+
// we take data from node, rather than params.data
|
|
211
|
+
// as the data could have been updated with new instance
|
|
212
|
+
data: this.params.node.data,
|
|
213
|
+
successCallback: successCallback,
|
|
214
|
+
context: this.gridOptionsWrapper.getContext()
|
|
215
|
+
};
|
|
216
|
+
userFunc(funcParams);
|
|
217
|
+
}
|
|
218
|
+
}, {
|
|
219
|
+
key: "refresh",
|
|
220
|
+
value: function refresh() {
|
|
221
|
+
var GET_GRID_TO_REFRESH = false;
|
|
222
|
+
var GET_GRID_TO_DO_NOTHING = true; // if we return true, it means we pretend to the grid
|
|
223
|
+
// that we have refreshed, so refresh will never happen.
|
|
224
|
+
|
|
225
|
+
var doNotRefresh = !this.needRefresh || this.refreshStrategy === 'nothing';
|
|
226
|
+
|
|
227
|
+
if (doNotRefresh) {
|
|
228
|
+
// we do nothing in this refresh method, and also tell the grid to do nothing
|
|
229
|
+
return GET_GRID_TO_DO_NOTHING;
|
|
230
|
+
} // reset flag, so don't refresh again until more data changes.
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
this.needRefresh = false;
|
|
234
|
+
|
|
235
|
+
if (this.refreshStrategy === 'everything') {
|
|
236
|
+
// we want full refresh, so tell the grid to destroy and recreate this cell
|
|
237
|
+
return GET_GRID_TO_REFRESH;
|
|
238
|
+
} else {
|
|
239
|
+
// do the refresh here, and tell the grid to do nothing
|
|
240
|
+
this.loadRowData();
|
|
241
|
+
return GET_GRID_TO_DO_NOTHING;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}]);
|
|
245
|
+
|
|
246
|
+
return DetailCellRendererCtrl;
|
|
247
|
+
}(BeanStub);
|
|
248
|
+
|
|
249
|
+
__decorate([Autowired('environment')], DetailCellRendererCtrl.prototype, "environment", void 0);
|
|
250
|
+
|
|
251
|
+
__decorate([Autowired('rowPositionUtils')], DetailCellRendererCtrl.prototype, "rowPositionUtils", void 0);
|
|
252
|
+
|
|
253
|
+
__decorate([Autowired('focusService')], DetailCellRendererCtrl.prototype, "focusService", void 0);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ModuleNames } from "@ag-grid-community/core";
|
|
2
|
+
import { DetailCellRenderer } from "./masterDetail/detailCellRenderer";
|
|
3
|
+
import { DetailCellRendererCtrl } from "./masterDetail/detailCellRendererCtrl";
|
|
4
|
+
export declare const MasterDetailModule: {
|
|
5
|
+
moduleName: ModuleNames;
|
|
6
|
+
beans: never[];
|
|
7
|
+
userComponents: {
|
|
8
|
+
componentName: string;
|
|
9
|
+
componentClass: typeof DetailCellRenderer;
|
|
10
|
+
}[];
|
|
11
|
+
controllers: {
|
|
12
|
+
controllerName: string;
|
|
13
|
+
controllerClass: typeof DetailCellRendererCtrl;
|
|
14
|
+
}[];
|
|
15
|
+
dependantModules: never[];
|
|
16
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ModuleNames } from "@ag-grid-community/core";
|
|
2
|
+
import { DetailCellRenderer } from "./masterDetail/detailCellRenderer";
|
|
3
|
+
import { DetailCellRendererCtrl } from "./masterDetail/detailCellRendererCtrl";
|
|
4
|
+
export var MasterDetailModule = {
|
|
5
|
+
moduleName: ModuleNames.MasterDetailModule,
|
|
6
|
+
beans: [],
|
|
7
|
+
userComponents: [{
|
|
8
|
+
componentName: 'agDetailCellRenderer',
|
|
9
|
+
componentClass: DetailCellRenderer
|
|
10
|
+
}],
|
|
11
|
+
controllers: [{
|
|
12
|
+
controllerName: 'detailCellRenderer',
|
|
13
|
+
controllerClass: DetailCellRendererCtrl
|
|
14
|
+
}],
|
|
15
|
+
dependantModules: []
|
|
16
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lemon-fe/kits",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-74",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@ag-grid-community/react": "^28.2.1",
|
|
39
39
|
"@ag-grid-community/styles": "^28.2.1",
|
|
40
40
|
"@ant-design/icons": "^4.7.0",
|
|
41
|
-
"@lemon-fe/hooks": "^0.1.
|
|
41
|
+
"@lemon-fe/hooks": "^0.1.140",
|
|
42
42
|
"@lemon-fe/utils": "^0.1.117",
|
|
43
43
|
"antd": "4.23.6",
|
|
44
44
|
"async-validator": "^4.2.5",
|