@ag-grid-enterprise/status-bar
Advanced tools
Comparing version 31.3.2 to 32.0.0
@@ -5,6 +5,4 @@ # Contributing to AG Grid Enterprise | ||
Retention of Intellectual Property Rights for AG Grid Enterprise component | ||
============== | ||
# Retention of Intellectual Property Rights for AG Grid Enterprise component | ||
1.DEFINITIONS | ||
@@ -27,9 +25,9 @@ | ||
- [Question or Problem?](#question) | ||
- [Issues and Bugs](#issue) | ||
- [Feature Requests](#feature) | ||
- [Submission Guidelines](#submit) | ||
- [Coding Rules](#rules) | ||
- [Commit Message Guidelines](#commit) | ||
- [Signing the CLA](#cla) | ||
- [Question or Problem?](#question) | ||
- [Issues and Bugs](#issue) | ||
- [Feature Requests](#feature) | ||
- [Submission Guidelines](#submit) | ||
- [Coding Rules](#rules) | ||
- [Commit Message Guidelines](#commit) | ||
- [Signing the CLA](#cla) | ||
@@ -45,2 +43,3 @@ ## <a name="question"></a> Got a Question or Problem? | ||
## <a name="issue"></a> Found a Bug? | ||
If you find a bug in the source code, you can help us by | ||
@@ -50,3 +49,4 @@ [submitting an issue](#submit-issue) to our [GitHub Repository][github]. | ||
## <a name="feature"></a> Missing a Feature? | ||
You can *request* a new feature by [submitting an issue](#submit-issue) to our GitHub | ||
You can _request_ a new feature by [submitting an issue](#submit-issue) to our GitHub | ||
Repository. | ||
@@ -62,5 +62,5 @@ | ||
- version of AG Grid Enterprise used | ||
- 3rd-party libraries and their versions | ||
- and most importantly - a use-case that fails | ||
- version of AG Grid Enterprise used | ||
- 3rd-party libraries and their versions | ||
- and most importantly - a use-case that fails | ||
@@ -78,3 +78,1 @@ A minimal reproduce scenario using http://plnkr.co/ allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem. If plunker is not a suitable way to demonstrate the problem (for example for issues related to our npm packaging), please create a standalone git repository demonstrating the problem. | ||
[stackoverflow]: http://stackoverflow.com/questions/tagged/ag-grid | ||
@@ -18,11 +18,2 @@ var __defProp = Object.defineProperty; | ||
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); | ||
var __decorateClass = (decorators, target, key, kind) => { | ||
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target; | ||
for (var i = decorators.length - 1, decorator; i >= 0; i--) | ||
if (decorator = decorators[i]) | ||
result = (kind ? decorator(target, key, result) : decorator(result)) || result; | ||
if (kind && result) | ||
__defProp(target, key, result); | ||
return result; | ||
}; | ||
@@ -37,221 +28,228 @@ // enterprise-modules/status-bar/src/main.ts | ||
// enterprise-modules/status-bar/src/statusBarModule.ts | ||
var import_core9 = require("@ag-grid-community/core"); | ||
var import_core10 = require("@ag-grid-enterprise/core"); | ||
var import_core10 = require("@ag-grid-community/core"); | ||
var import_core11 = require("@ag-grid-enterprise/core"); | ||
// enterprise-modules/status-bar/src/statusBar/statusBarService.ts | ||
// enterprise-modules/status-bar/src/statusBar/providedPanels/aggregationComp.ts | ||
var import_core2 = require("@ag-grid-community/core"); | ||
// enterprise-modules/status-bar/src/statusBar/providedPanels/agNameValue.ts | ||
var import_core = require("@ag-grid-community/core"); | ||
var StatusBarService = class extends import_core.BeanStub { | ||
// tslint:disable-next-line | ||
var AgNameValue = class extends import_core.Component { | ||
constructor() { | ||
super(); | ||
this.allComponents = /* @__PURE__ */ new Map(); | ||
super( | ||
/* html */ | ||
`<div class="ag-status-name-value"> | ||
<span data-ref="eLabel"></span>: | ||
<span data-ref="eValue" class="ag-status-name-value-value"></span> | ||
</div>` | ||
); | ||
this.eLabel = import_core.RefPlaceholder; | ||
this.eValue = import_core.RefPlaceholder; | ||
} | ||
registerStatusPanel(key, component) { | ||
this.allComponents.set(key, component); | ||
setLabel(key, defaultValue) { | ||
this.setDisplayed(false); | ||
const localeTextFunc = this.localeService.getLocaleTextFunc(); | ||
this.eLabel.innerHTML = localeTextFunc(key, defaultValue); | ||
} | ||
unregisterStatusPanel(key) { | ||
this.allComponents.delete(key); | ||
setValue(value) { | ||
this.eValue.innerHTML = value; | ||
} | ||
unregisterAllComponents() { | ||
this.allComponents.clear(); | ||
}; | ||
var AgNameValueSelector = { | ||
selector: "AG-NAME-VALUE", | ||
component: AgNameValue | ||
}; | ||
// enterprise-modules/status-bar/src/statusBar/providedPanels/aggregationComp.ts | ||
var AggregationComp = class extends import_core2.Component { | ||
constructor() { | ||
super( | ||
/* html */ | ||
`<div class="ag-status-panel ag-status-panel-aggregations"> | ||
<ag-name-value data-ref="avgAggregationComp"></ag-name-value> | ||
<ag-name-value data-ref="countAggregationComp"></ag-name-value> | ||
<ag-name-value data-ref="minAggregationComp"></ag-name-value> | ||
<ag-name-value data-ref="maxAggregationComp"></ag-name-value> | ||
<ag-name-value data-ref="sumAggregationComp"></ag-name-value> | ||
</div>`, | ||
[AgNameValueSelector] | ||
); | ||
this.sumAggregationComp = import_core2.RefPlaceholder; | ||
this.countAggregationComp = import_core2.RefPlaceholder; | ||
this.minAggregationComp = import_core2.RefPlaceholder; | ||
this.maxAggregationComp = import_core2.RefPlaceholder; | ||
this.avgAggregationComp = import_core2.RefPlaceholder; | ||
} | ||
getStatusPanel(key) { | ||
return this.allComponents.get(key); | ||
wireBeans(beans) { | ||
this.valueService = beans.valueService; | ||
this.cellNavigationService = beans.cellNavigationService; | ||
this.rowModel = beans.rowModel; | ||
this.cellPositionUtils = beans.cellPositionUtils; | ||
this.rowPositionUtils = beans.rowPositionUtils; | ||
this.rangeService = beans.rangeService; | ||
} | ||
// this is a user component, and IComponent has "public destroy()" as part of the interface. | ||
// so we need to override destroy() just to make the method public. | ||
destroy() { | ||
this.unregisterAllComponents(); | ||
super.destroy(); | ||
} | ||
}; | ||
StatusBarService = __decorateClass([ | ||
(0, import_core.Bean)("statusBarService") | ||
], StatusBarService); | ||
// enterprise-modules/status-bar/src/statusBar/statusBar.ts | ||
var import_core2 = require("@ag-grid-community/core"); | ||
var _StatusBar = class _StatusBar extends import_core2.Component { | ||
constructor() { | ||
super(_StatusBar.TEMPLATE); | ||
this.compDestroyFunctions = {}; | ||
} | ||
postConstruct() { | ||
this.processStatusPanels(/* @__PURE__ */ new Map()); | ||
this.addManagedPropertyListeners(["statusBar"], this.handleStatusBarChanged.bind(this)); | ||
if (!this.isValidRowModel()) { | ||
(0, import_core2._warnOnce)(`agAggregationComponent should only be used with the client and server side row model.`); | ||
return; | ||
} | ||
this.avgAggregationComp.setLabel("avg", "Average"); | ||
this.countAggregationComp.setLabel("count", "Count"); | ||
this.minAggregationComp.setLabel("min", "Min"); | ||
this.maxAggregationComp.setLabel("max", "Max"); | ||
this.sumAggregationComp.setLabel("sum", "Sum"); | ||
this.addManagedEventListeners({ | ||
rangeSelectionChanged: this.onRangeSelectionChanged.bind(this), | ||
modelUpdated: this.onRangeSelectionChanged.bind(this) | ||
}); | ||
} | ||
processStatusPanels(existingStatusPanelsToReuse) { | ||
var _a; | ||
const statusPanels = (_a = this.gos.get("statusBar")) == null ? void 0 : _a.statusPanels; | ||
if (statusPanels) { | ||
const leftStatusPanelComponents = statusPanels.filter((componentConfig) => componentConfig.align === "left"); | ||
this.createAndRenderComponents(leftStatusPanelComponents, this.eStatusBarLeft, existingStatusPanelsToReuse); | ||
const centerStatusPanelComponents = statusPanels.filter((componentConfig) => componentConfig.align === "center"); | ||
this.createAndRenderComponents(centerStatusPanelComponents, this.eStatusBarCenter, existingStatusPanelsToReuse); | ||
const rightStatusPanelComponents = statusPanels.filter((componentConfig) => !componentConfig.align || componentConfig.align === "right"); | ||
this.createAndRenderComponents(rightStatusPanelComponents, this.eStatusBarRight, existingStatusPanelsToReuse); | ||
isValidRowModel() { | ||
const rowModelType = this.rowModel.getType(); | ||
return rowModelType === "clientSide" || rowModelType === "serverSide"; | ||
} | ||
init(params) { | ||
this.params = params; | ||
} | ||
refresh(params) { | ||
this.params = params; | ||
this.onRangeSelectionChanged(); | ||
return true; | ||
} | ||
setAggregationComponentValue(aggFuncName, value, visible) { | ||
const statusBarValueComponent = this.getAllowedAggregationValueComponent(aggFuncName); | ||
if ((0, import_core2._exists)(statusBarValueComponent) && statusBarValueComponent) { | ||
const localeTextFunc = this.localeService.getLocaleTextFunc(); | ||
const thousandSeparator = localeTextFunc("thousandSeparator", ","); | ||
const decimalSeparator = localeTextFunc("decimalSeparator", "."); | ||
statusBarValueComponent.setValue( | ||
(0, import_core2._formatNumberTwoDecimalPlacesAndCommas)(value, thousandSeparator, decimalSeparator) | ||
); | ||
statusBarValueComponent.setDisplayed(visible); | ||
} else { | ||
this.setDisplayed(false); | ||
this.getAggregationValueComponent(aggFuncName)?.setDisplayed(false); | ||
} | ||
} | ||
handleStatusBarChanged() { | ||
var _a; | ||
const statusPanels = (_a = this.gos.get("statusBar")) == null ? void 0 : _a.statusPanels; | ||
const validStatusBarPanelsProvided = Array.isArray(statusPanels) && statusPanels.length > 0; | ||
this.setDisplayed(validStatusBarPanelsProvided); | ||
const existingStatusPanelsToReuse = /* @__PURE__ */ new Map(); | ||
if (validStatusBarPanelsProvided) { | ||
statusPanels.forEach((statusPanelConfig) => { | ||
var _a2, _b; | ||
const key = (_a2 = statusPanelConfig.key) != null ? _a2 : statusPanelConfig.statusPanel; | ||
const existingStatusPanel = this.statusBarService.getStatusPanel(key); | ||
if (existingStatusPanel == null ? void 0 : existingStatusPanel.refresh) { | ||
const newParams = this.gos.addGridCommonParams((_b = statusPanelConfig.statusPanelParams) != null ? _b : {}); | ||
const hasRefreshed = existingStatusPanel.refresh(newParams); | ||
if (hasRefreshed) { | ||
existingStatusPanelsToReuse.set(key, existingStatusPanel); | ||
delete this.compDestroyFunctions[key]; | ||
import_core2._.removeFromParent(existingStatusPanel.getGui()); | ||
} | ||
} | ||
}); | ||
getAllowedAggregationValueComponent(aggFuncName) { | ||
const { aggFuncs } = this.params; | ||
if (!aggFuncs || aggFuncs.includes(aggFuncName)) { | ||
return this.getAggregationValueComponent(aggFuncName); | ||
} | ||
this.resetStatusBar(); | ||
if (validStatusBarPanelsProvided) { | ||
this.processStatusPanels(existingStatusPanelsToReuse); | ||
} | ||
return null; | ||
} | ||
resetStatusBar() { | ||
this.eStatusBarLeft.innerHTML = ""; | ||
this.eStatusBarCenter.innerHTML = ""; | ||
this.eStatusBarRight.innerHTML = ""; | ||
this.destroyComponents(); | ||
this.statusBarService.unregisterAllComponents(); | ||
getAggregationValueComponent(aggFuncName) { | ||
const refComponentName = `${aggFuncName}AggregationComp`; | ||
return this[refComponentName]; | ||
} | ||
destroyComponents() { | ||
Object.values(this.compDestroyFunctions).forEach((func) => func()); | ||
this.compDestroyFunctions = {}; | ||
} | ||
createAndRenderComponents(statusBarComponents, ePanelComponent, existingStatusPanelsToReuse) { | ||
const componentDetails = []; | ||
statusBarComponents.forEach((componentConfig) => { | ||
const key = componentConfig.key || componentConfig.statusPanel; | ||
const existingStatusPanel = existingStatusPanelsToReuse.get(key); | ||
let promise; | ||
if (existingStatusPanel) { | ||
promise = import_core2.AgPromise.resolve(existingStatusPanel); | ||
} else { | ||
const params = {}; | ||
const compDetails = this.userComponentFactory.getStatusPanelCompDetails(componentConfig, params); | ||
promise = compDetails.newAgStackInstance(); | ||
if (!promise) { | ||
return; | ||
onRangeSelectionChanged() { | ||
const cellRanges = this.rangeService?.getCellRanges(); | ||
let sum = 0; | ||
let count = 0; | ||
let numberCount = 0; | ||
let min = null; | ||
let max = null; | ||
const cellsSoFar = {}; | ||
if (cellRanges && !(0, import_core2._missingOrEmpty)(cellRanges) && this.rangeService) { | ||
for (let i = 0; i < cellRanges.length; i++) { | ||
const cellRange = cellRanges[i]; | ||
let currentRow = this.rangeService.getRangeStartRow(cellRange); | ||
const lastRow = this.rangeService.getRangeEndRow(cellRange); | ||
while (true) { | ||
const finishedAllRows = (0, import_core2._missing)(currentRow) || !currentRow || this.rowPositionUtils.before(lastRow, currentRow); | ||
if (finishedAllRows || !currentRow || !cellRange.columns) { | ||
break; | ||
} | ||
cellRange.columns.forEach((col) => { | ||
if (currentRow === null) { | ||
return; | ||
} | ||
const cellId = this.cellPositionUtils.createId({ | ||
rowPinned: currentRow.rowPinned, | ||
column: col, | ||
rowIndex: currentRow.rowIndex | ||
}); | ||
if (cellsSoFar[cellId]) { | ||
return; | ||
} | ||
cellsSoFar[cellId] = true; | ||
const rowNode = this.rowPositionUtils.getRowNode(currentRow); | ||
if ((0, import_core2._missing)(rowNode)) { | ||
return; | ||
} | ||
let value = this.valueService.getValue(col, rowNode); | ||
if ((0, import_core2._missing)(value) || value === "") { | ||
return; | ||
} | ||
count++; | ||
if (typeof value === "object" && "value" in value) { | ||
value = value.value; | ||
if (value === "") { | ||
return; | ||
} | ||
} | ||
if (typeof value === "string") { | ||
value = Number(value); | ||
} | ||
if (typeof value === "number" && !isNaN(value)) { | ||
sum += value; | ||
if (max === null || value > max) { | ||
max = value; | ||
} | ||
if (min === null || value < min) { | ||
min = value; | ||
} | ||
numberCount++; | ||
} | ||
}); | ||
currentRow = this.cellNavigationService.getRowBelow(currentRow); | ||
} | ||
} | ||
componentDetails.push({ | ||
key, | ||
promise | ||
}); | ||
}); | ||
import_core2.AgPromise.all(componentDetails.map((details) => details.promise)).then(() => { | ||
componentDetails.forEach((componentDetail) => { | ||
componentDetail.promise.then((component) => { | ||
const destroyFunc = () => { | ||
this.getContext().destroyBean(component); | ||
}; | ||
if (this.isAlive()) { | ||
this.statusBarService.registerStatusPanel(componentDetail.key, component); | ||
ePanelComponent.appendChild(component.getGui()); | ||
this.compDestroyFunctions[componentDetail.key] = destroyFunc; | ||
} else { | ||
destroyFunc(); | ||
} | ||
}); | ||
}); | ||
}); | ||
} | ||
const gotResult = count > 1; | ||
const gotNumberResult = numberCount > 1; | ||
this.setAggregationComponentValue("count", count, gotResult); | ||
this.setAggregationComponentValue("sum", sum, gotNumberResult); | ||
this.setAggregationComponentValue("min", min, gotNumberResult); | ||
this.setAggregationComponentValue("max", max, gotNumberResult); | ||
this.setAggregationComponentValue("avg", sum / numberCount, gotNumberResult); | ||
} | ||
}; | ||
_StatusBar.TEMPLATE = /* html */ | ||
`<div class="ag-status-bar"> | ||
<div ref="eStatusBarLeft" class="ag-status-bar-left" role="status"></div> | ||
<div ref="eStatusBarCenter" class="ag-status-bar-center" role="status"></div> | ||
<div ref="eStatusBarRight" class="ag-status-bar-right" role="status"></div> | ||
</div>`; | ||
__decorateClass([ | ||
(0, import_core2.Autowired)("userComponentFactory") | ||
], _StatusBar.prototype, "userComponentFactory", 2); | ||
__decorateClass([ | ||
(0, import_core2.Autowired)("statusBarService") | ||
], _StatusBar.prototype, "statusBarService", 2); | ||
__decorateClass([ | ||
(0, import_core2.RefSelector)("eStatusBarLeft") | ||
], _StatusBar.prototype, "eStatusBarLeft", 2); | ||
__decorateClass([ | ||
(0, import_core2.RefSelector)("eStatusBarCenter") | ||
], _StatusBar.prototype, "eStatusBarCenter", 2); | ||
__decorateClass([ | ||
(0, import_core2.RefSelector)("eStatusBarRight") | ||
], _StatusBar.prototype, "eStatusBarRight", 2); | ||
__decorateClass([ | ||
import_core2.PostConstruct | ||
], _StatusBar.prototype, "postConstruct", 1); | ||
__decorateClass([ | ||
import_core2.PreDestroy | ||
], _StatusBar.prototype, "destroyComponents", 1); | ||
var StatusBar = _StatusBar; | ||
// enterprise-modules/status-bar/src/statusBar/providedPanels/nameValueComp.ts | ||
// enterprise-modules/status-bar/src/statusBar/providedPanels/filteredRowsComp.ts | ||
var import_core3 = require("@ag-grid-community/core"); | ||
var _NameValueComp = class _NameValueComp extends import_core3.Component { | ||
constructor() { | ||
super(_NameValueComp.TEMPLATE); | ||
var FilteredRowsComp = class extends AgNameValue { | ||
wireBeans(beans) { | ||
this.rowModel = beans.rowModel; | ||
} | ||
setLabel(key, defaultValue) { | ||
this.setDisplayed(false); | ||
const localeTextFunc = this.localeService.getLocaleTextFunc(); | ||
this.eLabel.innerHTML = localeTextFunc(key, defaultValue); | ||
} | ||
setValue(value) { | ||
this.eValue.innerHTML = value; | ||
} | ||
}; | ||
_NameValueComp.TEMPLATE = /* html */ | ||
`<div class="ag-status-name-value"> | ||
<span ref="eLabel"></span>: | ||
<span ref="eValue" class="ag-status-name-value-value"></span> | ||
</div>`; | ||
__decorateClass([ | ||
(0, import_core3.RefSelector)("eLabel") | ||
], _NameValueComp.prototype, "eLabel", 2); | ||
__decorateClass([ | ||
(0, import_core3.RefSelector)("eValue") | ||
], _NameValueComp.prototype, "eValue", 2); | ||
var NameValueComp = _NameValueComp; | ||
// enterprise-modules/status-bar/src/statusBar/providedPanels/totalAndFilteredRowsComp.ts | ||
var import_core4 = require("@ag-grid-community/core"); | ||
var TotalAndFilteredRowsComp = class extends NameValueComp { | ||
postConstruct() { | ||
this.setLabel("filteredRows", "Filtered"); | ||
if (this.rowModel.getType() !== "clientSide") { | ||
import_core4._.warnOnce(`agTotalAndFilteredRowCountComponent should only be used with the client side row model.`); | ||
(0, import_core3._warnOnce)(`agFilteredRowCountComponent should only be used with the client side row model.`); | ||
return; | ||
} | ||
this.setLabel("totalAndFilteredRows", "Rows"); | ||
this.addCssClass("ag-status-panel"); | ||
this.addCssClass("ag-status-panel-total-and-filtered-row-count"); | ||
this.addCssClass("ag-status-panel-filtered-row-count"); | ||
this.setDisplayed(true); | ||
this.addManagedListener(this.eventService, import_core4.Events.EVENT_MODEL_UPDATED, this.onDataChanged.bind(this)); | ||
this.onDataChanged(); | ||
const listener = this.onDataChanged.bind(this); | ||
this.addManagedEventListeners({ modelUpdated: listener }); | ||
listener(); | ||
} | ||
onDataChanged() { | ||
const totalRowCountValue = this.getTotalRowCountValue(); | ||
const filteredRowCountValue = this.getFilteredRowCountValue(); | ||
const localeTextFunc = this.localeService.getLocaleTextFunc(); | ||
const thousandSeparator = localeTextFunc("thousandSeparator", ","); | ||
const decimalSeparator = localeTextFunc("decimalSeparator", "."); | ||
const rowCount = import_core4._.formatNumberCommas(this.getFilteredRowCountValue(), thousandSeparator, decimalSeparator); | ||
const totalRowCount = import_core4._.formatNumberCommas(this.getTotalRowCount(), thousandSeparator, decimalSeparator); | ||
if (rowCount === totalRowCount) { | ||
this.setValue(rowCount); | ||
} else { | ||
const localeTextFunc2 = this.localeService.getLocaleTextFunc(); | ||
this.setValue(`${rowCount} ${localeTextFunc2("of", "of")} ${totalRowCount}`); | ||
} | ||
this.setValue((0, import_core3._formatNumberCommas)(filteredRowCountValue, thousandSeparator, decimalSeparator)); | ||
this.setDisplayed(totalRowCountValue !== filteredRowCountValue); | ||
} | ||
getTotalRowCountValue() { | ||
let totalRowCount = 0; | ||
this.rowModel.forEachNode(() => totalRowCount += 1); | ||
return totalRowCount; | ||
} | ||
getFilteredRowCountValue() { | ||
@@ -261,3 +259,3 @@ let filteredRowCount = 0; | ||
if (!node.group) { | ||
filteredRowCount++; | ||
filteredRowCount += 1; | ||
} | ||
@@ -267,11 +265,50 @@ }); | ||
} | ||
getTotalRowCount() { | ||
let totalRowCount = 0; | ||
this.rowModel.forEachNode((node) => { | ||
if (!node.group) { | ||
totalRowCount++; | ||
} | ||
}); | ||
return totalRowCount; | ||
init() { | ||
} | ||
refresh() { | ||
return true; | ||
} | ||
// this is a user component, and IComponent has "public destroy()" as part of the interface. | ||
// so we need to override destroy() just to make the method public. | ||
destroy() { | ||
super.destroy(); | ||
} | ||
}; | ||
// enterprise-modules/status-bar/src/statusBar/providedPanels/selectedRowsComp.ts | ||
var import_core4 = require("@ag-grid-community/core"); | ||
var SelectedRowsComp = class extends AgNameValue { | ||
wireBeans(beans) { | ||
this.rowModel = beans.rowModel; | ||
this.selectionService = beans.selectionService; | ||
} | ||
postConstruct() { | ||
if (!this.isValidRowModel()) { | ||
(0, import_core4._warnOnce)(`agSelectedRowCountComponent should only be used with the client and server side row model.`); | ||
return; | ||
} | ||
this.setLabel("selectedRows", "Selected"); | ||
this.addCssClass("ag-status-panel"); | ||
this.addCssClass("ag-status-panel-selected-row-count"); | ||
this.onRowSelectionChanged(); | ||
const eventListener = this.onRowSelectionChanged.bind(this); | ||
this.addManagedEventListeners({ modelUpdated: eventListener, selectionChanged: eventListener }); | ||
} | ||
isValidRowModel() { | ||
const rowModelType = this.rowModel.getType(); | ||
return rowModelType === "clientSide" || rowModelType === "serverSide"; | ||
} | ||
onRowSelectionChanged() { | ||
const selectedRowCount = this.selectionService.getSelectionCount(); | ||
if (selectedRowCount < 0) { | ||
this.setValue("?"); | ||
this.setDisplayed(true); | ||
return; | ||
} | ||
const localeTextFunc = this.localeService.getLocaleTextFunc(); | ||
const thousandSeparator = localeTextFunc("thousandSeparator", ","); | ||
const decimalSeparator = localeTextFunc("decimalSeparator", "."); | ||
this.setValue((0, import_core4._formatNumberCommas)(selectedRowCount, thousandSeparator, decimalSeparator)); | ||
this.setDisplayed(selectedRowCount > 0); | ||
} | ||
init() { | ||
@@ -288,39 +325,34 @@ } | ||
}; | ||
__decorateClass([ | ||
(0, import_core4.Autowired)("rowModel") | ||
], TotalAndFilteredRowsComp.prototype, "rowModel", 2); | ||
__decorateClass([ | ||
import_core4.PostConstruct | ||
], TotalAndFilteredRowsComp.prototype, "postConstruct", 1); | ||
// enterprise-modules/status-bar/src/statusBar/providedPanels/filteredRowsComp.ts | ||
// enterprise-modules/status-bar/src/statusBar/providedPanels/totalAndFilteredRowsComp.ts | ||
var import_core5 = require("@ag-grid-community/core"); | ||
var FilteredRowsComp = class extends NameValueComp { | ||
var TotalAndFilteredRowsComp = class extends AgNameValue { | ||
wireBeans(beans) { | ||
this.rowModel = beans.rowModel; | ||
} | ||
postConstruct() { | ||
this.setLabel("filteredRows", "Filtered"); | ||
if (this.rowModel.getType() !== "clientSide") { | ||
import_core5._.warnOnce(`agFilteredRowCountComponent should only be used with the client side row model.`); | ||
(0, import_core5._warnOnce)(`agTotalAndFilteredRowCountComponent should only be used with the client side row model.`); | ||
return; | ||
} | ||
this.setLabel("totalAndFilteredRows", "Rows"); | ||
this.addCssClass("ag-status-panel"); | ||
this.addCssClass("ag-status-panel-filtered-row-count"); | ||
this.addCssClass("ag-status-panel-total-and-filtered-row-count"); | ||
this.setDisplayed(true); | ||
const listener = this.onDataChanged.bind(this); | ||
this.addManagedListener(this.eventService, import_core5.Events.EVENT_MODEL_UPDATED, listener); | ||
listener(); | ||
this.addManagedEventListeners({ modelUpdated: this.onDataChanged.bind(this) }); | ||
this.onDataChanged(); | ||
} | ||
onDataChanged() { | ||
const totalRowCountValue = this.getTotalRowCountValue(); | ||
const filteredRowCountValue = this.getFilteredRowCountValue(); | ||
const localeTextFunc = this.localeService.getLocaleTextFunc(); | ||
const thousandSeparator = localeTextFunc("thousandSeparator", ","); | ||
const decimalSeparator = localeTextFunc("decimalSeparator", "."); | ||
this.setValue(import_core5._.formatNumberCommas(filteredRowCountValue, thousandSeparator, decimalSeparator)); | ||
this.setDisplayed(totalRowCountValue !== filteredRowCountValue); | ||
const rowCount = (0, import_core5._formatNumberCommas)(this.getFilteredRowCountValue(), thousandSeparator, decimalSeparator); | ||
const totalRowCount = (0, import_core5._formatNumberCommas)(this.getTotalRowCount(), thousandSeparator, decimalSeparator); | ||
if (rowCount === totalRowCount) { | ||
this.setValue(rowCount); | ||
} else { | ||
const localeTextFunc2 = this.localeService.getLocaleTextFunc(); | ||
this.setValue(`${rowCount} ${localeTextFunc2("of", "of")} ${totalRowCount}`); | ||
} | ||
} | ||
getTotalRowCountValue() { | ||
let totalRowCount = 0; | ||
this.rowModel.forEachNode((node) => totalRowCount += 1); | ||
return totalRowCount; | ||
} | ||
getFilteredRowCountValue() { | ||
@@ -330,3 +362,3 @@ let filteredRowCount = 0; | ||
if (!node.group) { | ||
filteredRowCount += 1; | ||
filteredRowCount++; | ||
} | ||
@@ -336,2 +368,11 @@ }); | ||
} | ||
getTotalRowCount() { | ||
let totalRowCount = 0; | ||
this.rowModel.forEachNode((node) => { | ||
if (!node.group) { | ||
totalRowCount++; | ||
} | ||
}); | ||
return totalRowCount; | ||
} | ||
init() { | ||
@@ -348,16 +389,13 @@ } | ||
}; | ||
__decorateClass([ | ||
(0, import_core5.Autowired)("rowModel") | ||
], FilteredRowsComp.prototype, "rowModel", 2); | ||
__decorateClass([ | ||
import_core5.PostConstruct | ||
], FilteredRowsComp.prototype, "postConstruct", 1); | ||
// enterprise-modules/status-bar/src/statusBar/providedPanels/totalRowsComp.ts | ||
var import_core6 = require("@ag-grid-community/core"); | ||
var TotalRowsComp = class extends NameValueComp { | ||
var TotalRowsComp = class extends AgNameValue { | ||
wireBeans(beans) { | ||
this.rowModel = beans.rowModel; | ||
} | ||
postConstruct() { | ||
this.setLabel("totalRows", "Total Rows"); | ||
if (this.rowModel.getType() !== "clientSide") { | ||
import_core6._.warnOnce("agTotalRowCountComponent should only be used with the client side row model."); | ||
(0, import_core6._warnOnce)("agTotalRowCountComponent should only be used with the client side row model."); | ||
return; | ||
@@ -368,3 +406,3 @@ } | ||
this.setDisplayed(true); | ||
this.addManagedListener(this.eventService, import_core6.Events.EVENT_MODEL_UPDATED, this.onDataChanged.bind(this)); | ||
this.addManagedEventListeners({ modelUpdated: this.onDataChanged.bind(this) }); | ||
this.onDataChanged(); | ||
@@ -376,7 +414,7 @@ } | ||
const decimalSeparator = localeTextFunc("decimalSeparator", "."); | ||
this.setValue(import_core6._.formatNumberCommas(this.getRowCountValue(), thousandSeparator, decimalSeparator)); | ||
this.setValue((0, import_core6._formatNumberCommas)(this.getRowCountValue(), thousandSeparator, decimalSeparator)); | ||
} | ||
getRowCountValue() { | ||
let totalRowCount = 0; | ||
this.rowModel.forEachLeafNode((node) => totalRowCount += 1); | ||
this.rowModel.forEachLeafNode(() => totalRowCount += 1); | ||
return totalRowCount; | ||
@@ -395,266 +433,225 @@ } | ||
}; | ||
__decorateClass([ | ||
(0, import_core6.Autowired)("rowModel") | ||
], TotalRowsComp.prototype, "rowModel", 2); | ||
__decorateClass([ | ||
import_core6.PostConstruct | ||
], TotalRowsComp.prototype, "postConstruct", 1); | ||
// enterprise-modules/status-bar/src/statusBar/providedPanels/selectedRowsComp.ts | ||
// enterprise-modules/status-bar/src/statusBar/statusBarApi.ts | ||
var import_core7 = require("@ag-grid-community/core"); | ||
var SelectedRowsComp = class extends NameValueComp { | ||
function getStatusPanel(beans, key) { | ||
const comp = beans.statusBarService.getStatusPanel(key); | ||
return (0, import_core7._unwrapUserComp)(comp); | ||
} | ||
// enterprise-modules/status-bar/src/statusBar/statusBarService.ts | ||
var import_core9 = require("@ag-grid-community/core"); | ||
// enterprise-modules/status-bar/src/statusBar/agStatusBar.ts | ||
var import_core8 = require("@ag-grid-community/core"); | ||
var AgStatusBar = class extends import_core8.Component { | ||
constructor() { | ||
super( | ||
/* html */ | ||
`<div class="ag-status-bar"> | ||
<div data-ref="eStatusBarLeft" class="ag-status-bar-left" role="status"></div> | ||
<div data-ref="eStatusBarCenter" class="ag-status-bar-center" role="status"></div> | ||
<div data-ref="eStatusBarRight" class="ag-status-bar-right" role="status"></div> | ||
</div>` | ||
); | ||
this.updateQueued = false; | ||
this.panelsPromise = import_core8.AgPromise.resolve(); | ||
this.eStatusBarLeft = import_core8.RefPlaceholder; | ||
this.eStatusBarCenter = import_core8.RefPlaceholder; | ||
this.eStatusBarRight = import_core8.RefPlaceholder; | ||
this.compDestroyFunctions = {}; | ||
} | ||
wireBeans(beans) { | ||
this.userComponentFactory = beans.userComponentFactory; | ||
this.statusBarService = beans.statusBarService; | ||
} | ||
postConstruct() { | ||
if (!this.isValidRowModel()) { | ||
console.warn(`AG Grid: agSelectedRowCountComponent should only be used with the client and server side row model.`); | ||
return; | ||
this.processStatusPanels(/* @__PURE__ */ new Map()); | ||
this.addManagedPropertyListeners(["statusBar"], this.handleStatusBarChanged.bind(this)); | ||
} | ||
processStatusPanels(existingStatusPanelsToReuse) { | ||
const statusPanels = this.gos.get("statusBar")?.statusPanels; | ||
if (statusPanels) { | ||
const leftStatusPanelComponents = statusPanels.filter( | ||
(componentConfig) => componentConfig.align === "left" | ||
); | ||
const centerStatusPanelComponents = statusPanels.filter( | ||
(componentConfig) => componentConfig.align === "center" | ||
); | ||
const rightStatusPanelComponents = statusPanels.filter( | ||
(componentConfig) => !componentConfig.align || componentConfig.align === "right" | ||
); | ||
this.panelsPromise = import_core8.AgPromise.all([ | ||
this.createAndRenderComponents( | ||
leftStatusPanelComponents, | ||
this.eStatusBarLeft, | ||
existingStatusPanelsToReuse | ||
), | ||
this.createAndRenderComponents( | ||
centerStatusPanelComponents, | ||
this.eStatusBarCenter, | ||
existingStatusPanelsToReuse | ||
), | ||
this.createAndRenderComponents( | ||
rightStatusPanelComponents, | ||
this.eStatusBarRight, | ||
existingStatusPanelsToReuse | ||
) | ||
]); | ||
} else { | ||
this.setDisplayed(false); | ||
} | ||
this.setLabel("selectedRows", "Selected"); | ||
this.addCssClass("ag-status-panel"); | ||
this.addCssClass("ag-status-panel-selected-row-count"); | ||
this.onRowSelectionChanged(); | ||
const eventListener = this.onRowSelectionChanged.bind(this); | ||
this.addManagedListener(this.eventService, import_core7.Events.EVENT_MODEL_UPDATED, eventListener); | ||
this.addManagedListener(this.eventService, import_core7.Events.EVENT_SELECTION_CHANGED, eventListener); | ||
} | ||
isValidRowModel() { | ||
const rowModelType = this.rowModel.getType(); | ||
return rowModelType === "clientSide" || rowModelType === "serverSide"; | ||
} | ||
onRowSelectionChanged() { | ||
const selectedRowCount = this.selectionService.getSelectionCount(); | ||
if (selectedRowCount < 0) { | ||
this.setValue("?"); | ||
this.setDisplayed(true); | ||
handleStatusBarChanged() { | ||
if (this.updateQueued) { | ||
return; | ||
} | ||
const localeTextFunc = this.localeService.getLocaleTextFunc(); | ||
const thousandSeparator = localeTextFunc("thousandSeparator", ","); | ||
const decimalSeparator = localeTextFunc("decimalSeparator", "."); | ||
this.setValue(import_core7._.formatNumberCommas(selectedRowCount, thousandSeparator, decimalSeparator)); | ||
this.setDisplayed(selectedRowCount > 0); | ||
this.updateQueued = true; | ||
this.panelsPromise.then(() => { | ||
this.updateStatusBar(); | ||
this.updateQueued = false; | ||
}); | ||
} | ||
init() { | ||
updateStatusBar() { | ||
const statusPanels = this.gos.get("statusBar")?.statusPanels; | ||
const validStatusBarPanelsProvided = Array.isArray(statusPanels) && statusPanels.length > 0; | ||
this.setDisplayed(validStatusBarPanelsProvided); | ||
const existingStatusPanelsToReuse = /* @__PURE__ */ new Map(); | ||
if (validStatusBarPanelsProvided) { | ||
statusPanels.forEach((statusPanelConfig) => { | ||
const key = statusPanelConfig.key ?? statusPanelConfig.statusPanel; | ||
const existingStatusPanel = this.statusBarService.getStatusPanel(key); | ||
if (existingStatusPanel?.refresh) { | ||
const newParams = this.gos.addGridCommonParams(statusPanelConfig.statusPanelParams ?? {}); | ||
const hasRefreshed = existingStatusPanel.refresh(newParams); | ||
if (hasRefreshed) { | ||
existingStatusPanelsToReuse.set(key, existingStatusPanel); | ||
delete this.compDestroyFunctions[key]; | ||
(0, import_core8._removeFromParent)(existingStatusPanel.getGui()); | ||
} | ||
} | ||
}); | ||
} | ||
this.resetStatusBar(); | ||
if (validStatusBarPanelsProvided) { | ||
this.processStatusPanels(existingStatusPanelsToReuse); | ||
} | ||
} | ||
refresh() { | ||
return true; | ||
resetStatusBar() { | ||
this.eStatusBarLeft.innerHTML = ""; | ||
this.eStatusBarCenter.innerHTML = ""; | ||
this.eStatusBarRight.innerHTML = ""; | ||
this.destroyComponents(); | ||
this.statusBarService.unregisterAllComponents(); | ||
} | ||
// this is a user component, and IComponent has "public destroy()" as part of the interface. | ||
// so we need to override destroy() just to make the method public. | ||
destroy() { | ||
this.destroyComponents(); | ||
super.destroy(); | ||
} | ||
destroyComponents() { | ||
Object.values(this.compDestroyFunctions).forEach((func) => func()); | ||
this.compDestroyFunctions = {}; | ||
} | ||
createAndRenderComponents(statusBarComponents, ePanelComponent, existingStatusPanelsToReuse) { | ||
const componentDetails = []; | ||
statusBarComponents.forEach((componentConfig) => { | ||
const key = componentConfig.key || componentConfig.statusPanel; | ||
const existingStatusPanel = existingStatusPanelsToReuse.get(key); | ||
let promise; | ||
if (existingStatusPanel) { | ||
promise = import_core8.AgPromise.resolve(existingStatusPanel); | ||
} else { | ||
const params = {}; | ||
const compDetails = this.userComponentFactory.getStatusPanelCompDetails(componentConfig, params); | ||
promise = compDetails.newAgStackInstance(); | ||
if (promise == null) { | ||
return; | ||
} | ||
} | ||
componentDetails.push({ | ||
key, | ||
promise | ||
}); | ||
}); | ||
return import_core8.AgPromise.all(componentDetails.map((details) => details.promise)).then(() => { | ||
componentDetails.forEach((componentDetail) => { | ||
componentDetail.promise.then((component) => { | ||
const destroyFunc = () => { | ||
this.destroyBean(component); | ||
}; | ||
if (this.isAlive()) { | ||
this.statusBarService.registerStatusPanel(componentDetail.key, component); | ||
ePanelComponent.appendChild(component.getGui()); | ||
this.compDestroyFunctions[componentDetail.key] = destroyFunc; | ||
} else { | ||
destroyFunc(); | ||
} | ||
}); | ||
}); | ||
}); | ||
} | ||
}; | ||
__decorateClass([ | ||
(0, import_core7.Autowired)("rowModel") | ||
], SelectedRowsComp.prototype, "rowModel", 2); | ||
__decorateClass([ | ||
(0, import_core7.Autowired)("selectionService") | ||
], SelectedRowsComp.prototype, "selectionService", 2); | ||
__decorateClass([ | ||
import_core7.PostConstruct | ||
], SelectedRowsComp.prototype, "postConstruct", 1); | ||
var AgStatusBarSelector = { | ||
selector: "AG-STATUS-BAR", | ||
component: AgStatusBar | ||
}; | ||
// enterprise-modules/status-bar/src/statusBar/providedPanels/aggregationComp.ts | ||
var import_core8 = require("@ag-grid-community/core"); | ||
var _AggregationComp = class _AggregationComp extends import_core8.Component { | ||
// enterprise-modules/status-bar/src/statusBar/statusBarService.ts | ||
var StatusBarService = class extends import_core9.BeanStub { | ||
// tslint:disable-next-line | ||
constructor() { | ||
super(_AggregationComp.TEMPLATE); | ||
super(); | ||
this.beanName = "statusBarService"; | ||
this.allComponents = /* @__PURE__ */ new Map(); | ||
} | ||
// this is a user component, and IComponent has "public destroy()" as part of the interface. | ||
// so we need to override destroy() just to make the method public. | ||
destroy() { | ||
super.destroy(); | ||
registerStatusPanel(key, component) { | ||
this.allComponents.set(key, component); | ||
} | ||
postConstruct() { | ||
if (!this.isValidRowModel()) { | ||
console.warn(`AG Grid: agAggregationComponent should only be used with the client and server side row model.`); | ||
return; | ||
} | ||
this.avgAggregationComp.setLabel("avg", "Average"); | ||
this.countAggregationComp.setLabel("count", "Count"); | ||
this.minAggregationComp.setLabel("min", "Min"); | ||
this.maxAggregationComp.setLabel("max", "Max"); | ||
this.sumAggregationComp.setLabel("sum", "Sum"); | ||
this.addManagedListener(this.eventService, import_core8.Events.EVENT_RANGE_SELECTION_CHANGED, this.onRangeSelectionChanged.bind(this)); | ||
this.addManagedListener(this.eventService, import_core8.Events.EVENT_MODEL_UPDATED, this.onRangeSelectionChanged.bind(this)); | ||
unregisterStatusPanel(key) { | ||
this.allComponents.delete(key); | ||
} | ||
isValidRowModel() { | ||
const rowModelType = this.rowModel.getType(); | ||
return rowModelType === "clientSide" || rowModelType === "serverSide"; | ||
unregisterAllComponents() { | ||
this.allComponents.clear(); | ||
} | ||
init(params) { | ||
this.params = params; | ||
getStatusPanel(key) { | ||
return this.allComponents.get(key); | ||
} | ||
refresh(params) { | ||
this.params = params; | ||
this.onRangeSelectionChanged(); | ||
return true; | ||
getStatusPanelSelector() { | ||
return AgStatusBarSelector; | ||
} | ||
setAggregationComponentValue(aggFuncName, value, visible) { | ||
var _a; | ||
const statusBarValueComponent = this.getAllowedAggregationValueComponent(aggFuncName); | ||
if (import_core8._.exists(statusBarValueComponent) && statusBarValueComponent) { | ||
const localeTextFunc = this.localeService.getLocaleTextFunc(); | ||
const thousandSeparator = localeTextFunc("thousandSeparator", ","); | ||
const decimalSeparator = localeTextFunc("decimalSeparator", "."); | ||
statusBarValueComponent.setValue(import_core8._.formatNumberTwoDecimalPlacesAndCommas(value, thousandSeparator, decimalSeparator)); | ||
statusBarValueComponent.setDisplayed(visible); | ||
} else { | ||
(_a = this.getAggregationValueComponent(aggFuncName)) == null ? void 0 : _a.setDisplayed(false); | ||
} | ||
destroy() { | ||
this.unregisterAllComponents(); | ||
super.destroy(); | ||
} | ||
getAllowedAggregationValueComponent(aggFuncName) { | ||
const { aggFuncs } = this.params; | ||
if (!aggFuncs || aggFuncs.includes(aggFuncName)) { | ||
return this.getAggregationValueComponent(aggFuncName); | ||
} | ||
return null; | ||
} | ||
getAggregationValueComponent(aggFuncName) { | ||
const refComponentName = `${aggFuncName}AggregationComp`; | ||
return this[refComponentName]; | ||
} | ||
onRangeSelectionChanged() { | ||
var _a; | ||
const cellRanges = (_a = this.rangeService) == null ? void 0 : _a.getCellRanges(); | ||
let sum = 0; | ||
let count = 0; | ||
let numberCount = 0; | ||
let min = null; | ||
let max = null; | ||
const cellsSoFar = {}; | ||
if (cellRanges && !import_core8._.missingOrEmpty(cellRanges) && this.rangeService) { | ||
for (let i = 0; i < cellRanges.length; i++) { | ||
const cellRange = cellRanges[i]; | ||
let currentRow = this.rangeService.getRangeStartRow(cellRange); | ||
const lastRow = this.rangeService.getRangeEndRow(cellRange); | ||
while (true) { | ||
const finishedAllRows = import_core8._.missing(currentRow) || !currentRow || this.rowPositionUtils.before(lastRow, currentRow); | ||
if (finishedAllRows || !currentRow || !cellRange.columns) { | ||
break; | ||
} | ||
cellRange.columns.forEach((col) => { | ||
if (currentRow === null) { | ||
return; | ||
} | ||
const cellId = this.cellPositionUtils.createId({ | ||
rowPinned: currentRow.rowPinned, | ||
column: col, | ||
rowIndex: currentRow.rowIndex | ||
}); | ||
if (cellsSoFar[cellId]) { | ||
return; | ||
} | ||
cellsSoFar[cellId] = true; | ||
const rowNode = this.rowPositionUtils.getRowNode(currentRow); | ||
if (import_core8._.missing(rowNode)) { | ||
return; | ||
} | ||
let value = this.valueService.getValue(col, rowNode); | ||
if (import_core8._.missing(value) || value === "") { | ||
return; | ||
} | ||
count++; | ||
if (typeof value === "object" && "value" in value) { | ||
value = value.value; | ||
if (value === "") { | ||
return; | ||
} | ||
} | ||
if (typeof value === "string") { | ||
value = Number(value); | ||
} | ||
if (typeof value === "number" && !isNaN(value)) { | ||
sum += value; | ||
if (max === null || value > max) { | ||
max = value; | ||
} | ||
if (min === null || value < min) { | ||
min = value; | ||
} | ||
numberCount++; | ||
} | ||
}); | ||
currentRow = this.cellNavigationService.getRowBelow(currentRow); | ||
} | ||
} | ||
; | ||
} | ||
const gotResult = count > 1; | ||
const gotNumberResult = numberCount > 1; | ||
this.setAggregationComponentValue("count", count, gotResult); | ||
this.setAggregationComponentValue("sum", sum, gotNumberResult); | ||
this.setAggregationComponentValue("min", min, gotNumberResult); | ||
this.setAggregationComponentValue("max", max, gotNumberResult); | ||
this.setAggregationComponentValue("avg", sum / numberCount, gotNumberResult); | ||
} | ||
}; | ||
_AggregationComp.TEMPLATE = /* html */ | ||
`<div class="ag-status-panel ag-status-panel-aggregations"> | ||
<ag-name-value ref="avgAggregationComp"></ag-name-value> | ||
<ag-name-value ref="countAggregationComp"></ag-name-value> | ||
<ag-name-value ref="minAggregationComp"></ag-name-value> | ||
<ag-name-value ref="maxAggregationComp"></ag-name-value> | ||
<ag-name-value ref="sumAggregationComp"></ag-name-value> | ||
</div>`; | ||
__decorateClass([ | ||
(0, import_core8.Optional)("rangeService") | ||
], _AggregationComp.prototype, "rangeService", 2); | ||
__decorateClass([ | ||
(0, import_core8.Autowired)("valueService") | ||
], _AggregationComp.prototype, "valueService", 2); | ||
__decorateClass([ | ||
(0, import_core8.Autowired)("cellNavigationService") | ||
], _AggregationComp.prototype, "cellNavigationService", 2); | ||
__decorateClass([ | ||
(0, import_core8.Autowired)("rowModel") | ||
], _AggregationComp.prototype, "rowModel", 2); | ||
__decorateClass([ | ||
(0, import_core8.Autowired)("cellPositionUtils") | ||
], _AggregationComp.prototype, "cellPositionUtils", 2); | ||
__decorateClass([ | ||
(0, import_core8.Autowired)("rowPositionUtils") | ||
], _AggregationComp.prototype, "rowPositionUtils", 2); | ||
__decorateClass([ | ||
(0, import_core8.RefSelector)("sumAggregationComp") | ||
], _AggregationComp.prototype, "sumAggregationComp", 2); | ||
__decorateClass([ | ||
(0, import_core8.RefSelector)("countAggregationComp") | ||
], _AggregationComp.prototype, "countAggregationComp", 2); | ||
__decorateClass([ | ||
(0, import_core8.RefSelector)("minAggregationComp") | ||
], _AggregationComp.prototype, "minAggregationComp", 2); | ||
__decorateClass([ | ||
(0, import_core8.RefSelector)("maxAggregationComp") | ||
], _AggregationComp.prototype, "maxAggregationComp", 2); | ||
__decorateClass([ | ||
(0, import_core8.RefSelector)("avgAggregationComp") | ||
], _AggregationComp.prototype, "avgAggregationComp", 2); | ||
__decorateClass([ | ||
import_core8.PostConstruct | ||
], _AggregationComp.prototype, "postConstruct", 1); | ||
var AggregationComp = _AggregationComp; | ||
// enterprise-modules/status-bar/src/version.ts | ||
var VERSION = "31.3.2"; | ||
var VERSION = "32.0.0"; | ||
// enterprise-modules/status-bar/src/statusBarModule.ts | ||
var StatusBarModule = { | ||
var StatusBarCoreModule = { | ||
version: VERSION, | ||
moduleName: import_core9.ModuleNames.StatusBarModule, | ||
moduleName: `${import_core10.ModuleNames.StatusBarModule}-core`, | ||
beans: [StatusBarService], | ||
agStackComponents: [ | ||
{ componentName: "AgStatusBar", componentClass: StatusBar }, | ||
{ componentName: "AgNameValue", componentClass: NameValueComp } | ||
], | ||
userComponents: [ | ||
{ componentName: "agAggregationComponent", componentClass: AggregationComp }, | ||
{ componentName: "agSelectedRowCountComponent", componentClass: SelectedRowsComp }, | ||
{ componentName: "agTotalRowCountComponent", componentClass: TotalRowsComp }, | ||
{ componentName: "agFilteredRowCountComponent", componentClass: FilteredRowsComp }, | ||
{ componentName: "agTotalAndFilteredRowCountComponent", componentClass: TotalAndFilteredRowsComp } | ||
{ name: "agAggregationComponent", classImp: AggregationComp }, | ||
{ name: "agSelectedRowCountComponent", classImp: SelectedRowsComp }, | ||
{ name: "agTotalRowCountComponent", classImp: TotalRowsComp }, | ||
{ name: "agFilteredRowCountComponent", classImp: FilteredRowsComp }, | ||
{ name: "agTotalAndFilteredRowCountComponent", classImp: TotalAndFilteredRowsComp } | ||
], | ||
dependantModules: [ | ||
import_core10.EnterpriseCoreModule | ||
] | ||
dependantModules: [import_core11.EnterpriseCoreModule] | ||
}; | ||
var StatusBarApiModule = { | ||
version: VERSION, | ||
moduleName: `${import_core10.ModuleNames.StatusBarModule}-api`, | ||
apiFunctions: { | ||
getStatusPanel | ||
}, | ||
dependantModules: [StatusBarCoreModule] | ||
}; | ||
var StatusBarModule = { | ||
version: VERSION, | ||
moduleName: import_core10.ModuleNames.StatusBarModule, | ||
dependantModules: [StatusBarCoreModule, StatusBarApiModule] | ||
}; |
@@ -1,14 +0,14 @@ | ||
var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(t,e)=>{for(var o in e)__defProp(t,o,{get:e[o],enumerable:!0})},__copyProps=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of __getOwnPropNames(e))!__hasOwnProp.call(t,a)&&a!==o&&__defProp(t,a,{get:()=>e[a],enumerable:!(s=__getOwnPropDesc(e,a))||s.enumerable});return t},__toCommonJS=t=>__copyProps(__defProp({},"__esModule",{value:!0}),t),__decorateClass=(t,e,o,s)=>{for(var a=s>1?void 0:s?__getOwnPropDesc(e,o):e,r=t.length-1,n;r>=0;r--)(n=t[r])&&(a=(s?n(e,o,a):n(a))||a);return s&&a&&__defProp(e,o,a),a},main_exports={};__export(main_exports,{StatusBarModule:()=>StatusBarModule}),module.exports=__toCommonJS(main_exports);var import_core9=require("@ag-grid-community/core"),import_core10=require("@ag-grid-enterprise/core"),import_core=require("@ag-grid-community/core"),StatusBarService=class extends import_core.BeanStub{constructor(){super(),this.allComponents=new Map}registerStatusPanel(t,e){this.allComponents.set(t,e)}unregisterStatusPanel(t){this.allComponents.delete(t)}unregisterAllComponents(){this.allComponents.clear()}getStatusPanel(t){return this.allComponents.get(t)}destroy(){this.unregisterAllComponents(),super.destroy()}};StatusBarService=__decorateClass([(0,import_core.Bean)("statusBarService")],StatusBarService);var import_core2=require("@ag-grid-community/core"),_StatusBar=class S extends import_core2.Component{constructor(){super(S.TEMPLATE),this.compDestroyFunctions={}}postConstruct(){this.processStatusPanels(new Map),this.addManagedPropertyListeners(["statusBar"],this.handleStatusBarChanged.bind(this))}processStatusPanels(e){var o;const s=(o=this.gos.get("statusBar"))==null?void 0:o.statusPanels;if(s){const a=s.filter(i=>i.align==="left");this.createAndRenderComponents(a,this.eStatusBarLeft,e);const r=s.filter(i=>i.align==="center");this.createAndRenderComponents(r,this.eStatusBarCenter,e);const n=s.filter(i=>!i.align||i.align==="right");this.createAndRenderComponents(n,this.eStatusBarRight,e)}else this.setDisplayed(!1)}handleStatusBarChanged(){var e;const o=(e=this.gos.get("statusBar"))==null?void 0:e.statusPanels,s=Array.isArray(o)&&o.length>0;this.setDisplayed(s);const a=new Map;s&&o.forEach(r=>{var n,i;const u=(n=r.key)!=null?n:r.statusPanel,d=this.statusBarService.getStatusPanel(u);if(d?.refresh){const g=this.gos.addGridCommonParams((i=r.statusPanelParams)!=null?i:{});d.refresh(g)&&(a.set(u,d),delete this.compDestroyFunctions[u],import_core2._.removeFromParent(d.getGui()))}}),this.resetStatusBar(),s&&this.processStatusPanels(a)}resetStatusBar(){this.eStatusBarLeft.innerHTML="",this.eStatusBarCenter.innerHTML="",this.eStatusBarRight.innerHTML="",this.destroyComponents(),this.statusBarService.unregisterAllComponents()}destroyComponents(){Object.values(this.compDestroyFunctions).forEach(e=>e()),this.compDestroyFunctions={}}createAndRenderComponents(e,o,s){const a=[];e.forEach(r=>{const n=r.key||r.statusPanel,i=s.get(n);let u;if(i)u=import_core2.AgPromise.resolve(i);else{const d={};if(u=this.userComponentFactory.getStatusPanelCompDetails(r,d).newAgStackInstance(),!u)return}a.push({key:n,promise:u})}),import_core2.AgPromise.all(a.map(r=>r.promise)).then(()=>{a.forEach(r=>{r.promise.then(n=>{const i=()=>{this.getContext().destroyBean(n)};this.isAlive()?(this.statusBarService.registerStatusPanel(r.key,n),o.appendChild(n.getGui()),this.compDestroyFunctions[r.key]=i):i()})})})}};_StatusBar.TEMPLATE=`<div class="ag-status-bar"> | ||
<div ref="eStatusBarLeft" class="ag-status-bar-left" role="status"></div> | ||
<div ref="eStatusBarCenter" class="ag-status-bar-center" role="status"></div> | ||
<div ref="eStatusBarRight" class="ag-status-bar-right" role="status"></div> | ||
</div>`,__decorateClass([(0,import_core2.Autowired)("userComponentFactory")],_StatusBar.prototype,"userComponentFactory",2),__decorateClass([(0,import_core2.Autowired)("statusBarService")],_StatusBar.prototype,"statusBarService",2),__decorateClass([(0,import_core2.RefSelector)("eStatusBarLeft")],_StatusBar.prototype,"eStatusBarLeft",2),__decorateClass([(0,import_core2.RefSelector)("eStatusBarCenter")],_StatusBar.prototype,"eStatusBarCenter",2),__decorateClass([(0,import_core2.RefSelector)("eStatusBarRight")],_StatusBar.prototype,"eStatusBarRight",2),__decorateClass([import_core2.PostConstruct],_StatusBar.prototype,"postConstruct",1),__decorateClass([import_core2.PreDestroy],_StatusBar.prototype,"destroyComponents",1);var StatusBar=_StatusBar,import_core3=require("@ag-grid-community/core"),_NameValueComp=class w extends import_core3.Component{constructor(){super(w.TEMPLATE)}setLabel(e,o){this.setDisplayed(!1);const s=this.localeService.getLocaleTextFunc();this.eLabel.innerHTML=s(e,o)}setValue(e){this.eValue.innerHTML=e}};_NameValueComp.TEMPLATE=`<div class="ag-status-name-value"> | ||
<span ref="eLabel"></span>: | ||
<span ref="eValue" class="ag-status-name-value-value"></span> | ||
</div>`,__decorateClass([(0,import_core3.RefSelector)("eLabel")],_NameValueComp.prototype,"eLabel",2),__decorateClass([(0,import_core3.RefSelector)("eValue")],_NameValueComp.prototype,"eValue",2);var NameValueComp=_NameValueComp,import_core4=require("@ag-grid-community/core"),TotalAndFilteredRowsComp=class extends NameValueComp{postConstruct(){if(this.rowModel.getType()!=="clientSide"){import_core4._.warnOnce("agTotalAndFilteredRowCountComponent should only be used with the client side row model.");return}this.setLabel("totalAndFilteredRows","Rows"),this.addCssClass("ag-status-panel"),this.addCssClass("ag-status-panel-total-and-filtered-row-count"),this.setDisplayed(!0),this.addManagedListener(this.eventService,import_core4.Events.EVENT_MODEL_UPDATED,this.onDataChanged.bind(this)),this.onDataChanged()}onDataChanged(){const t=this.localeService.getLocaleTextFunc(),e=t("thousandSeparator",","),o=t("decimalSeparator","."),s=import_core4._.formatNumberCommas(this.getFilteredRowCountValue(),e,o),a=import_core4._.formatNumberCommas(this.getTotalRowCount(),e,o);if(s===a)this.setValue(s);else{const r=this.localeService.getLocaleTextFunc();this.setValue(`${s} ${r("of","of")} ${a}`)}}getFilteredRowCountValue(){let t=0;return this.rowModel.forEachNodeAfterFilter(e=>{e.group||t++}),t}getTotalRowCount(){let t=0;return this.rowModel.forEachNode(e=>{e.group||t++}),t}init(){}refresh(){return!0}destroy(){super.destroy()}};__decorateClass([(0,import_core4.Autowired)("rowModel")],TotalAndFilteredRowsComp.prototype,"rowModel",2),__decorateClass([import_core4.PostConstruct],TotalAndFilteredRowsComp.prototype,"postConstruct",1);var import_core5=require("@ag-grid-community/core"),FilteredRowsComp=class extends NameValueComp{postConstruct(){if(this.setLabel("filteredRows","Filtered"),this.rowModel.getType()!=="clientSide"){import_core5._.warnOnce("agFilteredRowCountComponent should only be used with the client side row model.");return}this.addCssClass("ag-status-panel"),this.addCssClass("ag-status-panel-filtered-row-count"),this.setDisplayed(!0);const t=this.onDataChanged.bind(this);this.addManagedListener(this.eventService,import_core5.Events.EVENT_MODEL_UPDATED,t),t()}onDataChanged(){const t=this.getTotalRowCountValue(),e=this.getFilteredRowCountValue(),o=this.localeService.getLocaleTextFunc(),s=o("thousandSeparator",","),a=o("decimalSeparator",".");this.setValue(import_core5._.formatNumberCommas(e,s,a)),this.setDisplayed(t!==e)}getTotalRowCountValue(){let t=0;return this.rowModel.forEachNode(e=>t+=1),t}getFilteredRowCountValue(){let t=0;return this.rowModel.forEachNodeAfterFilter(e=>{e.group||(t+=1)}),t}init(){}refresh(){return!0}destroy(){super.destroy()}};__decorateClass([(0,import_core5.Autowired)("rowModel")],FilteredRowsComp.prototype,"rowModel",2),__decorateClass([import_core5.PostConstruct],FilteredRowsComp.prototype,"postConstruct",1);var import_core6=require("@ag-grid-community/core"),TotalRowsComp=class extends NameValueComp{postConstruct(){if(this.setLabel("totalRows","Total Rows"),this.rowModel.getType()!=="clientSide"){import_core6._.warnOnce("agTotalRowCountComponent should only be used with the client side row model.");return}this.addCssClass("ag-status-panel"),this.addCssClass("ag-status-panel-total-row-count"),this.setDisplayed(!0),this.addManagedListener(this.eventService,import_core6.Events.EVENT_MODEL_UPDATED,this.onDataChanged.bind(this)),this.onDataChanged()}onDataChanged(){const t=this.localeService.getLocaleTextFunc(),e=t("thousandSeparator",","),o=t("decimalSeparator",".");this.setValue(import_core6._.formatNumberCommas(this.getRowCountValue(),e,o))}getRowCountValue(){let t=0;return this.rowModel.forEachLeafNode(e=>t+=1),t}init(){}refresh(){return!0}destroy(){super.destroy()}};__decorateClass([(0,import_core6.Autowired)("rowModel")],TotalRowsComp.prototype,"rowModel",2),__decorateClass([import_core6.PostConstruct],TotalRowsComp.prototype,"postConstruct",1);var import_core7=require("@ag-grid-community/core"),SelectedRowsComp=class extends NameValueComp{postConstruct(){if(!this.isValidRowModel()){console.warn("AG Grid: agSelectedRowCountComponent should only be used with the client and server side row model.");return}this.setLabel("selectedRows","Selected"),this.addCssClass("ag-status-panel"),this.addCssClass("ag-status-panel-selected-row-count"),this.onRowSelectionChanged();const t=this.onRowSelectionChanged.bind(this);this.addManagedListener(this.eventService,import_core7.Events.EVENT_MODEL_UPDATED,t),this.addManagedListener(this.eventService,import_core7.Events.EVENT_SELECTION_CHANGED,t)}isValidRowModel(){const t=this.rowModel.getType();return t==="clientSide"||t==="serverSide"}onRowSelectionChanged(){const t=this.selectionService.getSelectionCount();if(t<0){this.setValue("?"),this.setDisplayed(!0);return}const e=this.localeService.getLocaleTextFunc(),o=e("thousandSeparator",","),s=e("decimalSeparator",".");this.setValue(import_core7._.formatNumberCommas(t,o,s)),this.setDisplayed(t>0)}init(){}refresh(){return!0}destroy(){super.destroy()}};__decorateClass([(0,import_core7.Autowired)("rowModel")],SelectedRowsComp.prototype,"rowModel",2),__decorateClass([(0,import_core7.Autowired)("selectionService")],SelectedRowsComp.prototype,"selectionService",2),__decorateClass([import_core7.PostConstruct],SelectedRowsComp.prototype,"postConstruct",1);var import_core8=require("@ag-grid-community/core"),_AggregationComp=class f extends import_core8.Component{constructor(){super(f.TEMPLATE)}destroy(){super.destroy()}postConstruct(){if(!this.isValidRowModel()){console.warn("AG Grid: agAggregationComponent should only be used with the client and server side row model.");return}this.avgAggregationComp.setLabel("avg","Average"),this.countAggregationComp.setLabel("count","Count"),this.minAggregationComp.setLabel("min","Min"),this.maxAggregationComp.setLabel("max","Max"),this.sumAggregationComp.setLabel("sum","Sum"),this.addManagedListener(this.eventService,import_core8.Events.EVENT_RANGE_SELECTION_CHANGED,this.onRangeSelectionChanged.bind(this)),this.addManagedListener(this.eventService,import_core8.Events.EVENT_MODEL_UPDATED,this.onRangeSelectionChanged.bind(this))}isValidRowModel(){const e=this.rowModel.getType();return e==="clientSide"||e==="serverSide"}init(e){this.params=e}refresh(e){return this.params=e,this.onRangeSelectionChanged(),!0}setAggregationComponentValue(e,o,s){var a;const r=this.getAllowedAggregationValueComponent(e);if(import_core8._.exists(r)&&r){const n=this.localeService.getLocaleTextFunc(),i=n("thousandSeparator",","),u=n("decimalSeparator",".");r.setValue(import_core8._.formatNumberTwoDecimalPlacesAndCommas(o,i,u)),r.setDisplayed(s)}else(a=this.getAggregationValueComponent(e))==null||a.setDisplayed(!1)}getAllowedAggregationValueComponent(e){const{aggFuncs:o}=this.params;return!o||o.includes(e)?this.getAggregationValueComponent(e):null}getAggregationValueComponent(e){const o=`${e}AggregationComp`;return this[o]}onRangeSelectionChanged(){var e;const o=(e=this.rangeService)==null?void 0:e.getCellRanges();let s=0,a=0,r=0,n=null,i=null;const u={};if(o&&!import_core8._.missingOrEmpty(o)&&this.rangeService)for(let p=0;p<o.length;p++){const m=o[p];let c=this.rangeService.getRangeStartRow(m);const y=this.rangeService.getRangeEndRow(m);for(;!(import_core8._.missing(c)||!c||this.rowPositionUtils.before(y,c)||!c||!m.columns);)m.columns.forEach(h=>{if(c===null)return;const C=this.cellPositionUtils.createId({rowPinned:c.rowPinned,column:h,rowIndex:c.rowIndex});if(u[C])return;u[C]=!0;const v=this.rowPositionUtils.getRowNode(c);if(import_core8._.missing(v))return;let l=this.valueService.getValue(h,v);import_core8._.missing(l)||l===""||(a++,!(typeof l=="object"&&"value"in l&&(l=l.value,l===""))&&(typeof l=="string"&&(l=Number(l)),typeof l=="number"&&!isNaN(l)&&(s+=l,(i===null||l>i)&&(i=l),(n===null||l<n)&&(n=l),r++)))}),c=this.cellNavigationService.getRowBelow(c)}const d=a>1,g=r>1;this.setAggregationComponentValue("count",a,d),this.setAggregationComponentValue("sum",s,g),this.setAggregationComponentValue("min",n,g),this.setAggregationComponentValue("max",i,g),this.setAggregationComponentValue("avg",s/r,g)}};_AggregationComp.TEMPLATE=`<div class="ag-status-panel ag-status-panel-aggregations"> | ||
<ag-name-value ref="avgAggregationComp"></ag-name-value> | ||
<ag-name-value ref="countAggregationComp"></ag-name-value> | ||
<ag-name-value ref="minAggregationComp"></ag-name-value> | ||
<ag-name-value ref="maxAggregationComp"></ag-name-value> | ||
<ag-name-value ref="sumAggregationComp"></ag-name-value> | ||
</div>`,__decorateClass([(0,import_core8.Optional)("rangeService")],_AggregationComp.prototype,"rangeService",2),__decorateClass([(0,import_core8.Autowired)("valueService")],_AggregationComp.prototype,"valueService",2),__decorateClass([(0,import_core8.Autowired)("cellNavigationService")],_AggregationComp.prototype,"cellNavigationService",2),__decorateClass([(0,import_core8.Autowired)("rowModel")],_AggregationComp.prototype,"rowModel",2),__decorateClass([(0,import_core8.Autowired)("cellPositionUtils")],_AggregationComp.prototype,"cellPositionUtils",2),__decorateClass([(0,import_core8.Autowired)("rowPositionUtils")],_AggregationComp.prototype,"rowPositionUtils",2),__decorateClass([(0,import_core8.RefSelector)("sumAggregationComp")],_AggregationComp.prototype,"sumAggregationComp",2),__decorateClass([(0,import_core8.RefSelector)("countAggregationComp")],_AggregationComp.prototype,"countAggregationComp",2),__decorateClass([(0,import_core8.RefSelector)("minAggregationComp")],_AggregationComp.prototype,"minAggregationComp",2),__decorateClass([(0,import_core8.RefSelector)("maxAggregationComp")],_AggregationComp.prototype,"maxAggregationComp",2),__decorateClass([(0,import_core8.RefSelector)("avgAggregationComp")],_AggregationComp.prototype,"avgAggregationComp",2),__decorateClass([import_core8.PostConstruct],_AggregationComp.prototype,"postConstruct",1);var AggregationComp=_AggregationComp,VERSION="31.3.2",StatusBarModule={version:VERSION,moduleName:import_core9.ModuleNames.StatusBarModule,beans:[StatusBarService],agStackComponents:[{componentName:"AgStatusBar",componentClass:StatusBar},{componentName:"AgNameValue",componentClass:NameValueComp}],userComponents:[{componentName:"agAggregationComponent",componentClass:AggregationComp},{componentName:"agSelectedRowCountComponent",componentClass:SelectedRowsComp},{componentName:"agTotalRowCountComponent",componentClass:TotalRowsComp},{componentName:"agFilteredRowCountComponent",componentClass:FilteredRowsComp},{componentName:"agTotalAndFilteredRowCountComponent",componentClass:TotalAndFilteredRowsComp}],dependantModules:[import_core10.EnterpriseCoreModule]}; | ||
var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var a in t)__defProp(e,a,{get:t[a],enumerable:!0})},__copyProps=(e,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of __getOwnPropNames(t))!__hasOwnProp.call(e,s)&&s!==a&&__defProp(e,s,{get:()=>t[s],enumerable:!(o=__getOwnPropDesc(t,s))||o.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),main_exports={};__export(main_exports,{StatusBarModule:()=>StatusBarModule}),module.exports=__toCommonJS(main_exports);var import_core10=require("@ag-grid-community/core"),import_core11=require("@ag-grid-enterprise/core"),import_core2=require("@ag-grid-community/core"),import_core=require("@ag-grid-community/core"),AgNameValue=class extends import_core.Component{constructor(){super(`<div class="ag-status-name-value"> | ||
<span data-ref="eLabel"></span>: | ||
<span data-ref="eValue" class="ag-status-name-value-value"></span> | ||
</div>`),this.eLabel=import_core.RefPlaceholder,this.eValue=import_core.RefPlaceholder}setLabel(e,t){this.setDisplayed(!1);const a=this.localeService.getLocaleTextFunc();this.eLabel.innerHTML=a(e,t)}setValue(e){this.eValue.innerHTML=e}},AgNameValueSelector={selector:"AG-NAME-VALUE",component:AgNameValue},AggregationComp=class extends import_core2.Component{constructor(){super(`<div class="ag-status-panel ag-status-panel-aggregations"> | ||
<ag-name-value data-ref="avgAggregationComp"></ag-name-value> | ||
<ag-name-value data-ref="countAggregationComp"></ag-name-value> | ||
<ag-name-value data-ref="minAggregationComp"></ag-name-value> | ||
<ag-name-value data-ref="maxAggregationComp"></ag-name-value> | ||
<ag-name-value data-ref="sumAggregationComp"></ag-name-value> | ||
</div>`,[AgNameValueSelector]),this.sumAggregationComp=import_core2.RefPlaceholder,this.countAggregationComp=import_core2.RefPlaceholder,this.minAggregationComp=import_core2.RefPlaceholder,this.maxAggregationComp=import_core2.RefPlaceholder,this.avgAggregationComp=import_core2.RefPlaceholder}wireBeans(e){this.valueService=e.valueService,this.cellNavigationService=e.cellNavigationService,this.rowModel=e.rowModel,this.cellPositionUtils=e.cellPositionUtils,this.rowPositionUtils=e.rowPositionUtils,this.rangeService=e.rangeService}destroy(){super.destroy()}postConstruct(){if(!this.isValidRowModel()){(0,import_core2._warnOnce)("agAggregationComponent should only be used with the client and server side row model.");return}this.avgAggregationComp.setLabel("avg","Average"),this.countAggregationComp.setLabel("count","Count"),this.minAggregationComp.setLabel("min","Min"),this.maxAggregationComp.setLabel("max","Max"),this.sumAggregationComp.setLabel("sum","Sum"),this.addManagedEventListeners({rangeSelectionChanged:this.onRangeSelectionChanged.bind(this),modelUpdated:this.onRangeSelectionChanged.bind(this)})}isValidRowModel(){const e=this.rowModel.getType();return e==="clientSide"||e==="serverSide"}init(e){this.params=e}refresh(e){return this.params=e,this.onRangeSelectionChanged(),!0}setAggregationComponentValue(e,t,a){const o=this.getAllowedAggregationValueComponent(e);if((0,import_core2._exists)(o)&&o){const s=this.localeService.getLocaleTextFunc(),r=s("thousandSeparator",","),i=s("decimalSeparator",".");o.setValue((0,import_core2._formatNumberTwoDecimalPlacesAndCommas)(t,r,i)),o.setDisplayed(a)}else this.getAggregationValueComponent(e)?.setDisplayed(!1)}getAllowedAggregationValueComponent(e){const{aggFuncs:t}=this.params;return!t||t.includes(e)?this.getAggregationValueComponent(e):null}getAggregationValueComponent(e){const t=`${e}AggregationComp`;return this[t]}onRangeSelectionChanged(){const e=this.rangeService?.getCellRanges();let t=0,a=0,o=0,s=null,r=null;const i={};if(e&&!(0,import_core2._missingOrEmpty)(e)&&this.rangeService)for(let c=0;c<e.length;c++){const g=e[c];let l=this.rangeService.getRangeStartRow(g);const C=this.rangeService.getRangeEndRow(g);for(;!((0,import_core2._missing)(l)||!l||this.rowPositionUtils.before(C,l)||!l||!g.columns);)g.columns.forEach(h=>{if(l===null)return;const m=this.cellPositionUtils.createId({rowPinned:l.rowPinned,column:h,rowIndex:l.rowIndex});if(i[m])return;i[m]=!0;const p=this.rowPositionUtils.getRowNode(l);if((0,import_core2._missing)(p))return;let n=this.valueService.getValue(h,p);(0,import_core2._missing)(n)||n===""||(a++,!(typeof n=="object"&&"value"in n&&(n=n.value,n===""))&&(typeof n=="string"&&(n=Number(n)),typeof n=="number"&&!isNaN(n)&&(t+=n,(r===null||n>r)&&(r=n),(s===null||n<s)&&(s=n),o++)))}),l=this.cellNavigationService.getRowBelow(l)}const u=a>1,d=o>1;this.setAggregationComponentValue("count",a,u),this.setAggregationComponentValue("sum",t,d),this.setAggregationComponentValue("min",s,d),this.setAggregationComponentValue("max",r,d),this.setAggregationComponentValue("avg",t/o,d)}},import_core3=require("@ag-grid-community/core"),FilteredRowsComp=class extends AgNameValue{wireBeans(e){this.rowModel=e.rowModel}postConstruct(){if(this.setLabel("filteredRows","Filtered"),this.rowModel.getType()!=="clientSide"){(0,import_core3._warnOnce)("agFilteredRowCountComponent should only be used with the client side row model.");return}this.addCssClass("ag-status-panel"),this.addCssClass("ag-status-panel-filtered-row-count"),this.setDisplayed(!0);const e=this.onDataChanged.bind(this);this.addManagedEventListeners({modelUpdated:e}),e()}onDataChanged(){const e=this.getTotalRowCountValue(),t=this.getFilteredRowCountValue(),a=this.localeService.getLocaleTextFunc(),o=a("thousandSeparator",","),s=a("decimalSeparator",".");this.setValue((0,import_core3._formatNumberCommas)(t,o,s)),this.setDisplayed(e!==t)}getTotalRowCountValue(){let e=0;return this.rowModel.forEachNode(()=>e+=1),e}getFilteredRowCountValue(){let e=0;return this.rowModel.forEachNodeAfterFilter(t=>{t.group||(e+=1)}),e}init(){}refresh(){return!0}destroy(){super.destroy()}},import_core4=require("@ag-grid-community/core"),SelectedRowsComp=class extends AgNameValue{wireBeans(e){this.rowModel=e.rowModel,this.selectionService=e.selectionService}postConstruct(){if(!this.isValidRowModel()){(0,import_core4._warnOnce)("agSelectedRowCountComponent should only be used with the client and server side row model.");return}this.setLabel("selectedRows","Selected"),this.addCssClass("ag-status-panel"),this.addCssClass("ag-status-panel-selected-row-count"),this.onRowSelectionChanged();const e=this.onRowSelectionChanged.bind(this);this.addManagedEventListeners({modelUpdated:e,selectionChanged:e})}isValidRowModel(){const e=this.rowModel.getType();return e==="clientSide"||e==="serverSide"}onRowSelectionChanged(){const e=this.selectionService.getSelectionCount();if(e<0){this.setValue("?"),this.setDisplayed(!0);return}const t=this.localeService.getLocaleTextFunc(),a=t("thousandSeparator",","),o=t("decimalSeparator",".");this.setValue((0,import_core4._formatNumberCommas)(e,a,o)),this.setDisplayed(e>0)}init(){}refresh(){return!0}destroy(){super.destroy()}},import_core5=require("@ag-grid-community/core"),TotalAndFilteredRowsComp=class extends AgNameValue{wireBeans(e){this.rowModel=e.rowModel}postConstruct(){if(this.rowModel.getType()!=="clientSide"){(0,import_core5._warnOnce)("agTotalAndFilteredRowCountComponent should only be used with the client side row model.");return}this.setLabel("totalAndFilteredRows","Rows"),this.addCssClass("ag-status-panel"),this.addCssClass("ag-status-panel-total-and-filtered-row-count"),this.setDisplayed(!0),this.addManagedEventListeners({modelUpdated:this.onDataChanged.bind(this)}),this.onDataChanged()}onDataChanged(){const e=this.localeService.getLocaleTextFunc(),t=e("thousandSeparator",","),a=e("decimalSeparator","."),o=(0,import_core5._formatNumberCommas)(this.getFilteredRowCountValue(),t,a),s=(0,import_core5._formatNumberCommas)(this.getTotalRowCount(),t,a);if(o===s)this.setValue(o);else{const r=this.localeService.getLocaleTextFunc();this.setValue(`${o} ${r("of","of")} ${s}`)}}getFilteredRowCountValue(){let e=0;return this.rowModel.forEachNodeAfterFilter(t=>{t.group||e++}),e}getTotalRowCount(){let e=0;return this.rowModel.forEachNode(t=>{t.group||e++}),e}init(){}refresh(){return!0}destroy(){super.destroy()}},import_core6=require("@ag-grid-community/core"),TotalRowsComp=class extends AgNameValue{wireBeans(e){this.rowModel=e.rowModel}postConstruct(){if(this.setLabel("totalRows","Total Rows"),this.rowModel.getType()!=="clientSide"){(0,import_core6._warnOnce)("agTotalRowCountComponent should only be used with the client side row model.");return}this.addCssClass("ag-status-panel"),this.addCssClass("ag-status-panel-total-row-count"),this.setDisplayed(!0),this.addManagedEventListeners({modelUpdated:this.onDataChanged.bind(this)}),this.onDataChanged()}onDataChanged(){const e=this.localeService.getLocaleTextFunc(),t=e("thousandSeparator",","),a=e("decimalSeparator",".");this.setValue((0,import_core6._formatNumberCommas)(this.getRowCountValue(),t,a))}getRowCountValue(){let e=0;return this.rowModel.forEachLeafNode(()=>e+=1),e}init(){}refresh(){return!0}destroy(){super.destroy()}},import_core7=require("@ag-grid-community/core");function getStatusPanel(e,t){const a=e.statusBarService.getStatusPanel(t);return(0,import_core7._unwrapUserComp)(a)}var import_core9=require("@ag-grid-community/core"),import_core8=require("@ag-grid-community/core"),AgStatusBar=class extends import_core8.Component{constructor(){super(`<div class="ag-status-bar"> | ||
<div data-ref="eStatusBarLeft" class="ag-status-bar-left" role="status"></div> | ||
<div data-ref="eStatusBarCenter" class="ag-status-bar-center" role="status"></div> | ||
<div data-ref="eStatusBarRight" class="ag-status-bar-right" role="status"></div> | ||
</div>`),this.updateQueued=!1,this.panelsPromise=import_core8.AgPromise.resolve(),this.eStatusBarLeft=import_core8.RefPlaceholder,this.eStatusBarCenter=import_core8.RefPlaceholder,this.eStatusBarRight=import_core8.RefPlaceholder,this.compDestroyFunctions={}}wireBeans(e){this.userComponentFactory=e.userComponentFactory,this.statusBarService=e.statusBarService}postConstruct(){this.processStatusPanels(new Map),this.addManagedPropertyListeners(["statusBar"],this.handleStatusBarChanged.bind(this))}processStatusPanels(e){const t=this.gos.get("statusBar")?.statusPanels;if(t){const a=t.filter(r=>r.align==="left"),o=t.filter(r=>r.align==="center"),s=t.filter(r=>!r.align||r.align==="right");this.panelsPromise=import_core8.AgPromise.all([this.createAndRenderComponents(a,this.eStatusBarLeft,e),this.createAndRenderComponents(o,this.eStatusBarCenter,e),this.createAndRenderComponents(s,this.eStatusBarRight,e)])}else this.setDisplayed(!1)}handleStatusBarChanged(){this.updateQueued||(this.updateQueued=!0,this.panelsPromise.then(()=>{this.updateStatusBar(),this.updateQueued=!1}))}updateStatusBar(){const e=this.gos.get("statusBar")?.statusPanels,t=Array.isArray(e)&&e.length>0;this.setDisplayed(t);const a=new Map;t&&e.forEach(o=>{const s=o.key??o.statusPanel,r=this.statusBarService.getStatusPanel(s);if(r?.refresh){const i=this.gos.addGridCommonParams(o.statusPanelParams??{});r.refresh(i)&&(a.set(s,r),delete this.compDestroyFunctions[s],(0,import_core8._removeFromParent)(r.getGui()))}}),this.resetStatusBar(),t&&this.processStatusPanels(a)}resetStatusBar(){this.eStatusBarLeft.innerHTML="",this.eStatusBarCenter.innerHTML="",this.eStatusBarRight.innerHTML="",this.destroyComponents(),this.statusBarService.unregisterAllComponents()}destroy(){this.destroyComponents(),super.destroy()}destroyComponents(){Object.values(this.compDestroyFunctions).forEach(e=>e()),this.compDestroyFunctions={}}createAndRenderComponents(e,t,a){const o=[];return e.forEach(s=>{const r=s.key||s.statusPanel,i=a.get(r);let u;if(i)u=import_core8.AgPromise.resolve(i);else{const d={};if(u=this.userComponentFactory.getStatusPanelCompDetails(s,d).newAgStackInstance(),u==null)return}o.push({key:r,promise:u})}),import_core8.AgPromise.all(o.map(s=>s.promise)).then(()=>{o.forEach(s=>{s.promise.then(r=>{const i=()=>{this.destroyBean(r)};this.isAlive()?(this.statusBarService.registerStatusPanel(s.key,r),t.appendChild(r.getGui()),this.compDestroyFunctions[s.key]=i):i()})})})}},AgStatusBarSelector={selector:"AG-STATUS-BAR",component:AgStatusBar},StatusBarService=class extends import_core9.BeanStub{constructor(){super(),this.beanName="statusBarService",this.allComponents=new Map}registerStatusPanel(e,t){this.allComponents.set(e,t)}unregisterStatusPanel(e){this.allComponents.delete(e)}unregisterAllComponents(){this.allComponents.clear()}getStatusPanel(e){return this.allComponents.get(e)}getStatusPanelSelector(){return AgStatusBarSelector}destroy(){this.unregisterAllComponents(),super.destroy()}},VERSION="32.0.0",StatusBarCoreModule={version:VERSION,moduleName:`${import_core10.ModuleNames.StatusBarModule}-core`,beans:[StatusBarService],userComponents:[{name:"agAggregationComponent",classImp:AggregationComp},{name:"agSelectedRowCountComponent",classImp:SelectedRowsComp},{name:"agTotalRowCountComponent",classImp:TotalRowsComp},{name:"agFilteredRowCountComponent",classImp:FilteredRowsComp},{name:"agTotalAndFilteredRowCountComponent",classImp:TotalAndFilteredRowsComp}],dependantModules:[import_core11.EnterpriseCoreModule]},StatusBarApiModule={version:VERSION,moduleName:`${import_core10.ModuleNames.StatusBarModule}-api`,apiFunctions:{getStatusPanel},dependantModules:[StatusBarCoreModule]},StatusBarModule={version:VERSION,moduleName:import_core10.ModuleNames.StatusBarModule,dependantModules:[StatusBarCoreModule,StatusBarApiModule]}; |
{ | ||
"name": "@ag-grid-enterprise/status-bar", | ||
"version": "31.3.2", | ||
"version": "32.0.0", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
"dependencies": { | ||
"tslib": "^2.3.0", | ||
"@ag-grid-community/core": "31.3.2", | ||
"@ag-grid-enterprise/core": "31.3.2" | ||
"@ag-grid-community/core": "32.0.0", | ||
"@ag-grid-enterprise/core": "32.0.0" | ||
}, | ||
@@ -19,2 +19,3 @@ "main": "./dist/package/main.cjs.js", | ||
}, | ||
"sideEffects": false, | ||
"devDependencies": { | ||
@@ -21,0 +22,0 @@ "@types/jest": "^29.5.0", |
{ | ||
"name": "@ag-grid-enterprise/status-bar", | ||
"version": "31.3.2", | ||
"version": "32.0.0", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
"dependencies": { | ||
"tslib": "^2.3.0", | ||
"@ag-grid-community/core": "31.3.2", | ||
"@ag-grid-enterprise/core": "31.3.2" | ||
"@ag-grid-community/core": "32.0.0", | ||
"@ag-grid-enterprise/core": "32.0.0" | ||
}, | ||
@@ -19,2 +19,3 @@ "main": "./src/main.js", | ||
}, | ||
"sideEffects": false, | ||
"devDependencies": { | ||
@@ -21,0 +22,0 @@ "@types/jest": "^29.5.0", |
@@ -1,1 +0,1 @@ | ||
export { StatusBarModule } from "./statusBarModule"; | ||
export { StatusBarModule } from './statusBarModule'; |
@@ -1,19 +0,20 @@ | ||
import { Component, IStatusPanelComp, CellPositionUtils, RowPositionUtils, AggregationStatusPanelParams } from '@ag-grid-community/core'; | ||
import type { AggregationStatusPanelParams, BeanCollection, IStatusPanelComp } from '@ag-grid-community/core'; | ||
import { Component } from '@ag-grid-community/core'; | ||
export declare class AggregationComp extends Component implements IStatusPanelComp { | ||
private static TEMPLATE; | ||
private rangeService?; | ||
private valueService; | ||
private cellNavigationService; | ||
private rowModel; | ||
cellPositionUtils: CellPositionUtils; | ||
rowPositionUtils: RowPositionUtils; | ||
private sumAggregationComp; | ||
private countAggregationComp; | ||
private minAggregationComp; | ||
private maxAggregationComp; | ||
private avgAggregationComp; | ||
private cellPositionUtils; | ||
private rowPositionUtils; | ||
private rangeService?; | ||
wireBeans(beans: BeanCollection): void; | ||
private readonly sumAggregationComp; | ||
private readonly countAggregationComp; | ||
private readonly minAggregationComp; | ||
private readonly maxAggregationComp; | ||
private readonly avgAggregationComp; | ||
private params; | ||
constructor(); | ||
destroy(): void; | ||
private postConstruct; | ||
postConstruct(): void; | ||
private isValidRowModel; | ||
@@ -20,0 +21,0 @@ init(params: AggregationStatusPanelParams): void; |
@@ -1,6 +0,7 @@ | ||
import { IStatusPanelComp } from '@ag-grid-community/core'; | ||
import { NameValueComp } from "./nameValueComp"; | ||
export declare class FilteredRowsComp extends NameValueComp implements IStatusPanelComp { | ||
import type { BeanCollection, IStatusPanelComp } from '@ag-grid-community/core'; | ||
import { AgNameValue } from './agNameValue'; | ||
export declare class FilteredRowsComp extends AgNameValue implements IStatusPanelComp { | ||
private rowModel; | ||
protected postConstruct(): void; | ||
wireBeans(beans: BeanCollection): void; | ||
postConstruct(): void; | ||
private onDataChanged; | ||
@@ -7,0 +8,0 @@ private getTotalRowCountValue; |
@@ -1,7 +0,8 @@ | ||
import { IStatusPanelComp } from '@ag-grid-community/core'; | ||
import { NameValueComp } from "./nameValueComp"; | ||
export declare class SelectedRowsComp extends NameValueComp implements IStatusPanelComp { | ||
import type { BeanCollection, IStatusPanelComp } from '@ag-grid-community/core'; | ||
import { AgNameValue } from './agNameValue'; | ||
export declare class SelectedRowsComp extends AgNameValue implements IStatusPanelComp { | ||
private rowModel; | ||
private selectionService; | ||
protected postConstruct(): void; | ||
wireBeans(beans: BeanCollection): void; | ||
postConstruct(): void; | ||
private isValidRowModel; | ||
@@ -8,0 +9,0 @@ private onRowSelectionChanged; |
@@ -1,6 +0,7 @@ | ||
import { IStatusPanelComp } from '@ag-grid-community/core'; | ||
import { NameValueComp } from "./nameValueComp"; | ||
export declare class TotalAndFilteredRowsComp extends NameValueComp implements IStatusPanelComp { | ||
import type { BeanCollection, IStatusPanelComp } from '@ag-grid-community/core'; | ||
import { AgNameValue } from './agNameValue'; | ||
export declare class TotalAndFilteredRowsComp extends AgNameValue implements IStatusPanelComp { | ||
private rowModel; | ||
protected postConstruct(): void; | ||
wireBeans(beans: BeanCollection): void; | ||
postConstruct(): void; | ||
private onDataChanged; | ||
@@ -7,0 +8,0 @@ private getFilteredRowCountValue; |
@@ -1,6 +0,7 @@ | ||
import { IStatusPanelComp } from '@ag-grid-community/core'; | ||
import { NameValueComp } from "./nameValueComp"; | ||
export declare class TotalRowsComp extends NameValueComp implements IStatusPanelComp { | ||
import type { BeanCollection, IStatusPanelComp } from '@ag-grid-community/core'; | ||
import { AgNameValue } from './agNameValue'; | ||
export declare class TotalRowsComp extends AgNameValue implements IStatusPanelComp { | ||
private rowModel; | ||
protected postConstruct(): void; | ||
wireBeans(beans: BeanCollection): void; | ||
postConstruct(): void; | ||
private onDataChanged; | ||
@@ -7,0 +8,0 @@ private getRowCountValue; |
@@ -1,3 +0,5 @@ | ||
import { BeanStub, IStatusPanelComp, IStatusBarService } from '@ag-grid-community/core'; | ||
export declare class StatusBarService extends BeanStub implements IStatusBarService { | ||
import type { ComponentSelector, IStatusBarService, IStatusPanelComp, NamedBean } from '@ag-grid-community/core'; | ||
import { BeanStub } from '@ag-grid-community/core'; | ||
export declare class StatusBarService extends BeanStub implements NamedBean, IStatusBarService { | ||
beanName: "statusBarService"; | ||
private allComponents; | ||
@@ -9,3 +11,4 @@ constructor(); | ||
getStatusPanel(key: string): IStatusPanelComp; | ||
protected destroy(): void; | ||
getStatusPanelSelector(): ComponentSelector; | ||
destroy(): void; | ||
} |
@@ -1,2 +0,4 @@ | ||
import { Module } from "@ag-grid-community/core"; | ||
import type { Module } from '@ag-grid-community/core'; | ||
export declare const StatusBarCoreModule: Module; | ||
export declare const StatusBarApiModule: Module; | ||
export declare const StatusBarModule: Module; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "31.3.2"; | ||
export declare const VERSION = "32.0.0"; |
{ | ||
"name": "@ag-grid-enterprise/status-bar", | ||
"version": "31.3.2", | ||
"version": "32.0.0", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
"dependencies": { | ||
"tslib": "^2.3.0", | ||
"@ag-grid-community/core": "31.3.2", | ||
"@ag-grid-enterprise/core": "31.3.2" | ||
"@ag-grid-community/core": "32.0.0", | ||
"@ag-grid-enterprise/core": "32.0.0" | ||
}, | ||
@@ -19,2 +19,3 @@ "main": "./dist/package/main.cjs.js", | ||
}, | ||
"sideEffects": false, | ||
"devDependencies": { | ||
@@ -21,0 +22,0 @@ "@types/jest": "^29.5.0", |
@@ -1,3 +0,2 @@ | ||
AG Grid Enterprise | ||
============== | ||
# AG Grid Enterprise | ||
@@ -8,4 +7,4 @@ This project contains AG Grid Enterprise features. | ||
Frameworks Supported | ||
==================== | ||
# Frameworks Supported | ||
Framework specific Getting Started guides: | ||
@@ -21,4 +20,3 @@ | ||
Issue Reporting | ||
============== | ||
# Issue Reporting | ||
@@ -29,2 +27,1 @@ If you are an Enterprise customer (or are evaluating AG Grid Enterprise) and wish to report a Bug or raise a new Feature Request please do so on our [Support Portal](https://ag-grid.zendesk.com/). | ||
Send an email to accounts@ag-grid.com with your license key | ||
@@ -1,2 +0,1 @@ | ||
Support and Maintenance document is now merged into the licence document. Please see the licence. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
215923
24
1508
25
+ Added@ag-grid-community/core@32.0.0(transitive)
+ Added@ag-grid-enterprise/core@32.0.0(transitive)
+ Addedag-charts-types@10.0.0(transitive)
- Removed@ag-grid-community/core@31.3.2(transitive)
- Removed@ag-grid-enterprise/core@31.3.2(transitive)