sccoreui 6.2.70 → 6.2.72
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.
|
@@ -16,6 +16,7 @@ const set_filter_1 = require("@ag-grid-enterprise/set-filter");
|
|
|
16
16
|
const advanced_filter_1 = require("@ag-grid-enterprise/advanced-filter");
|
|
17
17
|
const LicenceKey_1 = require("./LicenceKey");
|
|
18
18
|
const menu_1 = require("@ag-grid-enterprise/menu");
|
|
19
|
+
const column_tool_panel_1 = require("@ag-grid-enterprise/column-tool-panel");
|
|
19
20
|
core_1.ModuleRegistry.registerModules([
|
|
20
21
|
client_side_row_model_1.ClientSideRowModelModule,
|
|
21
22
|
range_selection_1.RangeSelectionModule,
|
|
@@ -25,6 +26,7 @@ core_1.ModuleRegistry.registerModules([
|
|
|
25
26
|
set_filter_1.SetFilterModule,
|
|
26
27
|
advanced_filter_1.AdvancedFilterModule,
|
|
27
28
|
menu_1.MenuModule,
|
|
29
|
+
column_tool_panel_1.ColumnsToolPanelModule
|
|
28
30
|
]);
|
|
29
31
|
core_2.LicenseManager.setLicenseKey(LicenceKey_1.LICENSEKEY);
|
|
30
32
|
const AgGrid = ({ style, gridOptions, onGridReady, gridRef }) => {
|
|
@@ -15,6 +15,7 @@ const group_checkbox_1 = tslib_1.__importDefault(require("./group-checkbox"));
|
|
|
15
15
|
const utilComponents_1 = require("./utilComponents");
|
|
16
16
|
function ParentForGrid(props) {
|
|
17
17
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
18
|
+
const { gridProps = {} } = props;
|
|
18
19
|
const [gridData, setGridData] = (0, react_1.useState)({
|
|
19
20
|
rowData: [],
|
|
20
21
|
columnData: (0, helper_1.sortColumns)(props === null || props === void 0 ? void 0 : props.columnData),
|
|
@@ -117,11 +118,12 @@ function ParentForGrid(props) {
|
|
|
117
118
|
};
|
|
118
119
|
// Callback to products for getting data
|
|
119
120
|
const getData = (startRow, endRow, currentFeatures, params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
121
|
+
var _r, _s;
|
|
120
122
|
if (!(props === null || props === void 0 ? void 0 : props.getRowData)) {
|
|
121
123
|
return emptyResponse; // If callback function to get row data is not provided
|
|
122
124
|
}
|
|
123
125
|
if (props.rowModelType !== constants_1.ROWMODELTYPE.SERVER_SIDE) {
|
|
124
|
-
gridRef.current.api.showLoadingOverlay();
|
|
126
|
+
(_s = (_r = gridRef === null || gridRef === void 0 ? void 0 : gridRef.current) === null || _r === void 0 ? void 0 : _r.api) === null || _s === void 0 ? void 0 : _s.showLoadingOverlay();
|
|
125
127
|
}
|
|
126
128
|
const response = yield (props === null || props === void 0 ? void 0 : props.getRowData(startRow, endRow, currentFeatures, params));
|
|
127
129
|
setGridData(Object.assign(Object.assign({}, gridData), { rowData: [] }));
|
|
@@ -143,7 +145,8 @@ function ParentForGrid(props) {
|
|
|
143
145
|
});
|
|
144
146
|
// Gets call onLoad,scroll and whenever any featureDetails changed
|
|
145
147
|
const onGridReady = (params, updatedFeatures) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
146
|
-
var
|
|
148
|
+
var _t, _u;
|
|
149
|
+
params.api.setGridOption('rowSelection', 'multiple');
|
|
147
150
|
params && setApi(params === null || params === void 0 ? void 0 : params.api);
|
|
148
151
|
setGridReadyEvent(params);
|
|
149
152
|
let currentFeatures = updatedFeatures;
|
|
@@ -156,21 +159,21 @@ function ParentForGrid(props) {
|
|
|
156
159
|
if (result.rowData) {
|
|
157
160
|
setGridData(Object.assign(Object.assign({}, gridData), { rowData: result.rowData }));
|
|
158
161
|
gridRef.current.api.hideOverlay();
|
|
159
|
-
(
|
|
162
|
+
(_t = params === null || params === void 0 ? void 0 : params.api) === null || _t === void 0 ? void 0 : _t.applyTransaction({ add: result.rowData });
|
|
160
163
|
}
|
|
161
164
|
else {
|
|
162
|
-
(
|
|
165
|
+
(_u = params === null || params === void 0 ? void 0 : params.api) === null || _u === void 0 ? void 0 : _u.applyTransaction({ add: [] });
|
|
163
166
|
}
|
|
164
167
|
}
|
|
165
168
|
else if (props.rowModelType === constants_1.ROWMODELTYPE.SERVER_SIDE) {
|
|
166
169
|
const dataSource = {
|
|
167
170
|
getRows: (params) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
168
|
-
var
|
|
171
|
+
var _v, _w, _x;
|
|
169
172
|
const startRow = params.request.startRow;
|
|
170
173
|
const endRow = params.request.endRow;
|
|
171
174
|
// Scroll should not exit MAX_RECORDS_TO_LOAD
|
|
172
175
|
if (endRow > maxLength && maxLength > 0) {
|
|
173
|
-
(
|
|
176
|
+
(_v = gridRef === null || gridRef === void 0 ? void 0 : gridRef.current.api) === null || _v === void 0 ? void 0 : _v.hideOverlay();
|
|
174
177
|
// supply rows for requested block to grid
|
|
175
178
|
params.success({
|
|
176
179
|
rowData: gridData.rowData,
|
|
@@ -180,8 +183,9 @@ function ParentForGrid(props) {
|
|
|
180
183
|
}
|
|
181
184
|
// get data for request from our fake server
|
|
182
185
|
const response = yield getData(startRow, endRow, currentFeatures, params);
|
|
186
|
+
console.log(response, "response");
|
|
183
187
|
// simulating real server call with a 500ms delay
|
|
184
|
-
if (((
|
|
188
|
+
if (((_w = response.rowData) === null || _w === void 0 ? void 0 : _w.length) > 0) {
|
|
185
189
|
setGridData(Object.assign(Object.assign({}, gridData), { rowData: response.rowData }));
|
|
186
190
|
gridRef.current.api.hideOverlay();
|
|
187
191
|
// supply rows for requested block to grid
|
|
@@ -191,7 +195,7 @@ function ParentForGrid(props) {
|
|
|
191
195
|
else {
|
|
192
196
|
// params.fail();
|
|
193
197
|
const gridRows = startRow >= constants_1.BLOCK_SIZE ? gridData.rowData : [];
|
|
194
|
-
if (!((
|
|
198
|
+
if (!((_x = params === null || params === void 0 ? void 0 : params.parentNode) === null || _x === void 0 ? void 0 : _x.id))
|
|
195
199
|
gridRef.current.api.showNoRowsOverlay();
|
|
196
200
|
params.success({ rowData: gridRows });
|
|
197
201
|
return;
|
|
@@ -331,7 +335,7 @@ function ParentForGrid(props) {
|
|
|
331
335
|
return document.getElementById("wrapper");
|
|
332
336
|
}, []);
|
|
333
337
|
// Options that grid should have
|
|
334
|
-
const gridOptions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ columnDefs: (_f = gridData === null || gridData === void 0 ? void 0 : gridData.columnData) === null || _f === void 0 ? void 0 : _f.map((column) => {
|
|
338
|
+
const gridOptions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ columnDefs: (_f = gridData === null || gridData === void 0 ? void 0 : gridData.columnData) === null || _f === void 0 ? void 0 : _f.map((column) => {
|
|
335
339
|
var _a, _b;
|
|
336
340
|
if ((column === null || column === void 0 ? void 0 : column.enableChildCheckbox) && (column === null || column === void 0 ? void 0 : column.enableHeaderCheckbox)) {
|
|
337
341
|
return Object.assign(Object.assign({}, column), { headerComponent: (params) => headerCheckBoxRenderer(params === null || params === void 0 ? void 0 : params.displayName, (column === null || column === void 0 ? void 0 : column.headerComponent) && ""), cellRenderer: (params) => (0, utilComponents_1.dataCellRenderer)(params, column, props), cellRendererParams: {
|
|
@@ -344,13 +348,13 @@ function ParentForGrid(props) {
|
|
|
344
348
|
}
|
|
345
349
|
}), autoGroupColumnDef: (props === null || props === void 0 ? void 0 : props.autoGroupColumnDef)
|
|
346
350
|
? props === null || props === void 0 ? void 0 : props.autoGroupColumnDef
|
|
347
|
-
: manageColumnGrouping(), treeData: (props === null || props === void 0 ? void 0 : props.enableTree) ? props === null || props === void 0 ? void 0 : props.enableTree : false, getDataPath: (props === null || props === void 0 ? void 0 : props.enableTree) ? getDataPath : null, defaultColDef: defaultColDef, suppressMenuHide: false,
|
|
351
|
+
: manageColumnGrouping(), treeData: (props === null || props === void 0 ? void 0 : props.enableTree) ? props === null || props === void 0 ? void 0 : props.enableTree : false, getDataPath: (props === null || props === void 0 ? void 0 : props.enableTree) ? getDataPath : null, defaultColDef: defaultColDef, suppressMenuHide: false, suppressRowClickSelection: false, headerHeight: props === null || props === void 0 ? void 0 : props.columnHeaderHeight, rowHeight: constants_1.ROW_HEIGHT, rowModelType: props.rowModelType, pinnedTopRowData: props === null || props === void 0 ? void 0 : props.pinnedTopRowData, cacheBlockSize: constants_1.BLOCK_SIZE, maxBlocksInCache: constants_1.MAX_BLOCKS, blockLoadDebounceMillis: constants_1.DEBOUNCE_INTERVAL, noRowsOverlayComponent: props === null || props === void 0 ? void 0 : props.noRowsOverlayComponent, loadingOverlayComponent: loading_component_1.default, suppressCellFocus: true, suppressPropertyNamesCheck: true, suppressServerSideFullWidthLoadingRow: true, enableRangeSelection: (_g = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _g === void 0 ? void 0 : _g.enableFillHandle, enableFillHandle: (_h = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _h === void 0 ? void 0 : _h.enableFillHandle, onFillEnd: wrapperToFillOpertation, fillOperation: myOpertaion, serverSideInitialRowCount: (props === null || props === void 0 ? void 0 : props.serverSideInitialRowCount) || 10, getRowId: getRowId, enableAdvancedFilter: (props === null || props === void 0 ? void 0 : props.enableAdvancedFilter) || false, fillHandleDirection: "y" }, ((props === null || props === void 0 ? void 0 : props.rowData) && { rowData: props === null || props === void 0 ? void 0 : props.rowData })), (totalRecords <= 6 && ((_j = props === null || props === void 0 ? void 0 : props.conditionsToDisplay) === null || _j === void 0 ? void 0 : _j.isGridAutoHeight)
|
|
348
352
|
? { domLayout: "autoHeight" }
|
|
349
353
|
: { domLayout: undefined })), ((props === null || props === void 0 ? void 0 : props.dataTypeDefinitions) && {
|
|
350
354
|
dataTypeDefinitions: props === null || props === void 0 ? void 0 : props.dataTypeDefinitions,
|
|
351
355
|
})), { popupParent: popupParent }), ((props === null || props === void 0 ? void 0 : props.treeData) && { treeData: props === null || props === void 0 ? void 0 : props.treeData })), ((props === null || props === void 0 ? void 0 : props.groupDefaultExpanded) && {
|
|
352
356
|
groupDefaultExpanded: props === null || props === void 0 ? void 0 : props.groupDefaultExpanded, // to enable tree data
|
|
353
|
-
})), ((props === null || props === void 0 ? void 0 : props.onRowClicked) ? { onRowClicked: props === null || props === void 0 ? void 0 : props.onRowClicked } : {})), ((props === null || props === void 0 ? void 0 : props.quickSearch) ? { quickSearch: props.quickSearch } : {})), ((props === null || props === void 0 ? void 0 : props.rowDragManaged) ? { rowDragManaged: props === null || props === void 0 ? void 0 : props.rowDragManaged } : {}));
|
|
357
|
+
})), ((props === null || props === void 0 ? void 0 : props.onRowClicked) ? { onRowClicked: props === null || props === void 0 ? void 0 : props.onRowClicked } : {})), ((props === null || props === void 0 ? void 0 : props.quickSearch) ? { quickSearch: props.quickSearch } : {})), ((props === null || props === void 0 ? void 0 : props.rowDragManaged) ? { rowDragManaged: props === null || props === void 0 ? void 0 : props.rowDragManaged } : {})), gridProps);
|
|
354
358
|
// Fucntion to call the grid
|
|
355
359
|
const callGrid = (featureDetails) => {
|
|
356
360
|
onGridReady(gridReadyEvent, featureDetails);
|
|
@@ -113,7 +113,7 @@ onChange, footeTemplate, headerTemplate, labelIcon, labelIconPos, label, labelIc
|
|
|
113
113
|
},
|
|
114
114
|
] }), !showChips ? ((0, jsx_runtime_1.jsx)(button_1.Button, { type: "button", className: `list_box_button focus:shadow-none p-0 h-max h-auto p-0 mx-2 ${buttonClassName}`, link: link ? true : false, icon: labelIcon ? labelIcon : "", size: labelIconSize ? labelIconSize : "", iconPos: labelIconPos ? labelIconPos : "", label: label, onClick: (event) => optionsMenuRef.current.toggle(event) })) : ((0, jsx_runtime_1.jsxs)("ul", Object.assign({ className: `pl-0 grid row-gap-2 list_box_chips ${chipsParentClassName}` }, { children: [(0, jsx_runtime_1.jsx)("li", Object.assign({ className: `cursor-pointer min-w-max mx-2 max-w-max ${buttonClassName}` }, { children: (0, jsx_runtime_1.jsx)(button_1.Button, { type: "button",
|
|
115
115
|
// className={`list_box_button focus:shadow-none p-0 h-max h-auto mx-2`}
|
|
116
|
-
link: link ? true : false, icon: labelIcon ? labelIcon : "", size: labelIconSize ? labelIconSize : "", iconPos: labelIconPos ? labelIconPos : "", label: label, onClick: (event) => optionsMenuRef.current.toggle(event), "aria-controls": "popup_menu_right", "aria-haspopup": true, ref: buttonRef }) })), selectedItems &&
|
|
116
|
+
link: link ? true : false, icon: labelIcon ? labelIcon : "", size: labelIconSize ? labelIconSize : "", iconPos: labelIconPos ? labelIconPos : "", label: label, onClick: (event) => optionsMenuRef.current.toggle(event), "aria-controls": "popup_menu_right", "aria-haspopup": true, ref: buttonRef, className: "btn-text-primary" }) })), selectedItems &&
|
|
117
117
|
(selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.map((item, index) => {
|
|
118
118
|
var _a, _b;
|
|
119
119
|
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: isDraggable !== undefined ? ((0, jsx_runtime_1.jsx)("li", Object.assign({ draggable: isDraggable, onDragStart: (e) => handleDragStart(e, index), onDragOver: (e) => handleDragOver(e), onDrop: (e) => handleDrop(e, index), className: `${chipClassName ? chipClassName : ""} cursor-pointer min-w-max mx-2 max-w-max p-1 flex align-items-center bg-gray-50 text-gray-700 text-base border-1 border-gray-300 border-round-lg ${showRemoveIcon ? "pr-6 relative" : ""}` }, { children: chipTemplate ? (chipTemplate(item)) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { children: [" ", typeof item === "object"
|