@ag-grid-enterprise/side-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 | ||
var __defProp = Object.defineProperty; | ||
var __defProps = Object.defineProperties; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropDescs = Object.getOwnPropertyDescriptors; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getOwnPropSymbols = Object.getOwnPropertySymbols; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __propIsEnum = Object.prototype.propertyIsEnumerable; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __spreadValues = (a, b) => { | ||
for (var prop in b || (b = {})) | ||
if (__hasOwnProp.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
if (__getOwnPropSymbols) | ||
for (var prop of __getOwnPropSymbols(b)) { | ||
if (__propIsEnum.call(b, prop)) | ||
__defNormalProp(a, prop, b[prop]); | ||
} | ||
return a; | ||
}; | ||
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)); | ||
var __export = (target, all) => { | ||
@@ -35,11 +18,2 @@ for (var name in all) | ||
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; | ||
}; | ||
@@ -55,87 +29,206 @@ // enterprise-modules/side-bar/src/main.ts | ||
// enterprise-modules/side-bar/src/sideBarModule.ts | ||
var import_core8 = require("@ag-grid-community/core"); | ||
var import_core9 = require("@ag-grid-enterprise/core"); | ||
var import_core10 = require("@ag-grid-community/core"); | ||
var import_core11 = require("@ag-grid-enterprise/core"); | ||
// enterprise-modules/side-bar/src/sideBar/horizontalResizeComp.ts | ||
// enterprise-modules/side-bar/src/sideBar/common/toolPanelColDefService.ts | ||
var import_core = require("@ag-grid-community/core"); | ||
var HorizontalResizeComp = class extends import_core.Component { | ||
var ToolPanelColDefService = class extends import_core.BeanStub { | ||
constructor() { | ||
super( | ||
/* html */ | ||
`<div class="ag-tool-panel-horizontal-resize"></div>` | ||
); | ||
this.minWidth = 100; | ||
this.maxWidth = null; | ||
super(...arguments); | ||
this.beanName = "toolPanelColDefService"; | ||
this.isColGroupDef = (colDef) => colDef && typeof colDef.children !== "undefined"; | ||
this.getId = (colDef) => { | ||
return this.isColGroupDef(colDef) ? colDef.groupId : colDef.colId; | ||
}; | ||
} | ||
setElementToResize(elementToResize) { | ||
this.elementToResize = elementToResize; | ||
wireBeans(beans) { | ||
this.columnModel = beans.columnModel; | ||
} | ||
postConstruct() { | ||
const finishedWithResizeFunc = this.horizontalResizeService.addResizeBar({ | ||
eResizeBar: this.getGui(), | ||
dragStartPixels: 1, | ||
onResizeStart: this.onResizeStart.bind(this), | ||
onResizing: this.onResizing.bind(this), | ||
onResizeEnd: this.onResizeEnd.bind(this) | ||
createColumnTree(colDefs) { | ||
const invalidColIds = []; | ||
const createDummyColGroup = (abstractColDef, depth) => { | ||
if (this.isColGroupDef(abstractColDef)) { | ||
const groupDef = abstractColDef; | ||
const groupId = typeof groupDef.groupId !== "undefined" ? groupDef.groupId : groupDef.headerName; | ||
const group = new import_core.AgProvidedColumnGroup(groupDef, groupId, false, depth); | ||
const children = []; | ||
groupDef.children.forEach((def) => { | ||
const child = createDummyColGroup(def, depth + 1); | ||
if (child) { | ||
children.push(child); | ||
} | ||
}); | ||
group.setChildren(children); | ||
return group; | ||
} else { | ||
const colDef = abstractColDef; | ||
const key = colDef.colId ? colDef.colId : colDef.field; | ||
const column = this.columnModel.getColDefCol(key); | ||
if (!column) { | ||
invalidColIds.push(colDef); | ||
} | ||
return column; | ||
} | ||
}; | ||
const mappedResults = []; | ||
colDefs.forEach((colDef) => { | ||
const result = createDummyColGroup(colDef, 0); | ||
if (result) { | ||
mappedResults.push(result); | ||
} | ||
}); | ||
this.addDestroyFunc(finishedWithResizeFunc); | ||
this.setInverted(this.gos.get("enableRtl")); | ||
if (invalidColIds.length > 0) { | ||
(0, import_core._warnOnce)("unable to find grid columns for the supplied colDef(s):", invalidColIds); | ||
} | ||
return mappedResults; | ||
} | ||
dispatchResizeEvent(start, end, width) { | ||
const event = { | ||
type: import_core.Events.EVENT_TOOL_PANEL_SIZE_CHANGED, | ||
width, | ||
started: start, | ||
ended: end | ||
syncLayoutWithGrid(syncLayoutCallback) { | ||
const leafPathTrees = this.getLeafPathTrees(); | ||
const mergedColumnTrees = this.mergeLeafPathTrees(leafPathTrees); | ||
syncLayoutCallback(mergedColumnTrees); | ||
} | ||
getLeafPathTrees() { | ||
const getLeafPathTree = (node, childDef) => { | ||
let leafPathTree; | ||
if ((0, import_core.isProvidedColumnGroup)(node)) { | ||
if (node.isPadding()) { | ||
leafPathTree = childDef; | ||
} else { | ||
const groupDef = Object.assign({}, node.getColGroupDef()); | ||
groupDef.groupId = node.getGroupId(); | ||
groupDef.children = [childDef]; | ||
leafPathTree = groupDef; | ||
} | ||
} else { | ||
const colDef = Object.assign({}, node.getColDef()); | ||
colDef.colId = node.getColId(); | ||
leafPathTree = colDef; | ||
} | ||
const parent = node.getOriginalParent(); | ||
if (parent) { | ||
return getLeafPathTree(parent, leafPathTree); | ||
} else { | ||
return leafPathTree; | ||
} | ||
}; | ||
this.eventService.dispatchEvent(event); | ||
const allGridColumns = this.columnModel.getCols(); | ||
const allPrimaryGridColumns = allGridColumns.filter((column) => { | ||
const colDef = column.getColDef(); | ||
return column.isPrimary() && !colDef.showRowGroup; | ||
}); | ||
return allPrimaryGridColumns.map((col) => getLeafPathTree(col, col.getColDef())); | ||
} | ||
onResizeStart() { | ||
this.startingWidth = this.elementToResize.offsetWidth; | ||
this.dispatchResizeEvent(true, false, this.startingWidth); | ||
} | ||
onResizeEnd(delta) { | ||
return this.onResizing(delta, true); | ||
} | ||
onResizing(delta, isEnd = false) { | ||
const direction = this.inverted ? -1 : 1; | ||
let newWidth = Math.max(this.minWidth, Math.floor(this.startingWidth - delta * direction)); | ||
if (this.maxWidth != null) { | ||
newWidth = Math.min(this.maxWidth, newWidth); | ||
mergeLeafPathTrees(leafPathTrees) { | ||
const matchingRootGroupIds = (pathA, pathB) => { | ||
const bothPathsAreGroups = this.isColGroupDef(pathA) && this.isColGroupDef(pathB); | ||
return bothPathsAreGroups && this.getId(pathA) === this.getId(pathB); | ||
}; | ||
const mergeTrees = (treeA, treeB) => { | ||
if (!this.isColGroupDef(treeB)) { | ||
return treeA; | ||
} | ||
const mergeResult = treeA; | ||
const groupToMerge = treeB; | ||
if (groupToMerge.children && groupToMerge.groupId) { | ||
const added = this.addChildrenToGroup(mergeResult, groupToMerge.groupId, groupToMerge.children[0]); | ||
if (added) { | ||
return mergeResult; | ||
} | ||
} | ||
groupToMerge.children.forEach((child) => mergeTrees(mergeResult, child)); | ||
return mergeResult; | ||
}; | ||
const mergeColDefs = []; | ||
for (let i = 1; i <= leafPathTrees.length; i++) { | ||
const first = leafPathTrees[i - 1]; | ||
const second = leafPathTrees[i]; | ||
if (matchingRootGroupIds(first, second)) { | ||
leafPathTrees[i] = mergeTrees(first, second); | ||
} else { | ||
mergeColDefs.push(first); | ||
} | ||
} | ||
this.elementToResize.style.width = `${newWidth}px`; | ||
this.dispatchResizeEvent(false, isEnd, newWidth); | ||
return mergeColDefs; | ||
} | ||
setInverted(inverted) { | ||
this.inverted = inverted; | ||
} | ||
setMaxWidth(value) { | ||
this.maxWidth = value; | ||
} | ||
setMinWidth(value) { | ||
if (value != null) { | ||
this.minWidth = value; | ||
} else { | ||
this.minWidth = 100; | ||
addChildrenToGroup(tree, groupId, colDef) { | ||
const subGroupIsSplit = (currentSubGroup, currentSubGroupToAdd) => { | ||
const existingChildIds = currentSubGroup.children.map(this.getId); | ||
const childGroupAlreadyExists = (0, import_core._includes)(existingChildIds, this.getId(currentSubGroupToAdd)); | ||
const lastChild = (0, import_core._last)(currentSubGroup.children); | ||
const lastChildIsDifferent = lastChild && this.getId(lastChild) !== this.getId(currentSubGroupToAdd); | ||
return childGroupAlreadyExists && lastChildIsDifferent; | ||
}; | ||
if (!this.isColGroupDef(tree)) { | ||
return true; | ||
} | ||
const currentGroup = tree; | ||
const groupToAdd = colDef; | ||
if (subGroupIsSplit(currentGroup, groupToAdd)) { | ||
currentGroup.children.push(groupToAdd); | ||
return true; | ||
} | ||
if (currentGroup.groupId === groupId) { | ||
const existingChildIds = currentGroup.children.map(this.getId); | ||
const colDefAlreadyPresent = (0, import_core._includes)(existingChildIds, this.getId(groupToAdd)); | ||
if (!colDefAlreadyPresent) { | ||
currentGroup.children.push(groupToAdd); | ||
return true; | ||
} | ||
} | ||
currentGroup.children.forEach((subGroup) => this.addChildrenToGroup(subGroup, groupId, colDef)); | ||
return false; | ||
} | ||
}; | ||
__decorateClass([ | ||
(0, import_core.Autowired)("horizontalResizeService") | ||
], HorizontalResizeComp.prototype, "horizontalResizeService", 2); | ||
__decorateClass([ | ||
import_core.PostConstruct | ||
], HorizontalResizeComp.prototype, "postConstruct", 1); | ||
// enterprise-modules/side-bar/src/sideBar/sideBarComp.ts | ||
var import_core5 = require("@ag-grid-community/core"); | ||
// enterprise-modules/side-bar/src/sideBar/sideBarApi.ts | ||
var import_core2 = require("@ag-grid-community/core"); | ||
function isSideBarVisible(beans) { | ||
return beans.sideBarService?.getSideBarComp().isDisplayed() ?? false; | ||
} | ||
function setSideBarVisible(beans, show) { | ||
beans.sideBarService?.getSideBarComp().setDisplayed(show); | ||
} | ||
function setSideBarPosition(beans, position) { | ||
beans.sideBarService?.getSideBarComp().setSideBarPosition(position); | ||
} | ||
function openToolPanel(beans, key) { | ||
beans.sideBarService?.getSideBarComp().openToolPanel(key, "api"); | ||
} | ||
function closeToolPanel(beans) { | ||
beans.sideBarService?.getSideBarComp().close("api"); | ||
} | ||
function getOpenedToolPanel(beans) { | ||
return beans.sideBarService?.getSideBarComp().openedItem() ?? null; | ||
} | ||
function refreshToolPanel(beans) { | ||
beans.sideBarService?.getSideBarComp().refresh(); | ||
} | ||
function isToolPanelShowing(beans) { | ||
return beans.sideBarService?.getSideBarComp().isToolPanelShowing() ?? false; | ||
} | ||
function getToolPanelInstance(beans, id) { | ||
const comp = beans.sideBarService?.getSideBarComp().getToolPanelInstance(id); | ||
return (0, import_core2._unwrapUserComp)(comp); | ||
} | ||
function getSideBar(beans) { | ||
return beans.sideBarService?.getSideBarComp().getDef(); | ||
} | ||
// enterprise-modules/side-bar/src/sideBar/sideBarButtonsComp.ts | ||
var import_core3 = require("@ag-grid-community/core"); | ||
// enterprise-modules/side-bar/src/sideBar/sideBarService.ts | ||
var import_core9 = require("@ag-grid-community/core"); | ||
// enterprise-modules/side-bar/src/sideBar/agSideBar.ts | ||
var import_core8 = require("@ag-grid-community/core"); | ||
// enterprise-modules/side-bar/src/sideBar/agSideBarButtons.ts | ||
var import_core4 = require("@ag-grid-community/core"); | ||
// enterprise-modules/side-bar/src/sideBar/sideBarButtonComp.ts | ||
var import_core2 = require("@ag-grid-community/core"); | ||
var _SideBarButtonComp = class _SideBarButtonComp extends import_core2.Component { | ||
var import_core3 = require("@ag-grid-community/core"); | ||
var SideBarButtonComp = class extends import_core3.Component { | ||
constructor(toolPanelDef) { | ||
super(); | ||
this.eToggleButton = import_core3.RefPlaceholder; | ||
this.eIconWrapper = import_core3.RefPlaceholder; | ||
this.eLabel = import_core3.RefPlaceholder; | ||
this.toolPanelDef = toolPanelDef; | ||
@@ -148,6 +241,6 @@ } | ||
const template = this.createTemplate(); | ||
this.setTemplate(template); | ||
this.setTemplate(template, []); | ||
this.setLabel(); | ||
this.setIcon(); | ||
this.addManagedListener(this.eToggleButton, "click", this.onButtonPressed.bind(this)); | ||
this.addManagedElementListeners(this.eToggleButton, { click: this.onButtonPressed.bind(this) }); | ||
this.eToggleButton.setAttribute("id", `ag-${this.getCompId()}-button`); | ||
@@ -159,5 +252,5 @@ } | ||
`<div class="ag-side-button" role="presentation"> | ||
<button type="button" ref="eToggleButton" tabindex="-1" role="tab" aria-expanded="false" class="ag-button ag-side-button-button"> | ||
<div ref="eIconWrapper" class="ag-side-button-icon-wrapper" aria-hidden="true"></div> | ||
<span ref ="eLabel" class="ag-side-button-label"></span> | ||
<button type="button" data-ref="eToggleButton" tabindex="-1" role="tab" aria-expanded="false" class="ag-button ag-side-button-button"> | ||
<div data-ref="eIconWrapper" class="ag-side-button-icon-wrapper" aria-hidden="true"></div> | ||
<span data-ref="eLabel" class="ag-side-button-label"></span> | ||
</button> | ||
@@ -175,10 +268,10 @@ </div>` | ||
setIcon() { | ||
this.eIconWrapper.insertAdjacentElement("afterbegin", import_core2._.createIconNoSpan(this.toolPanelDef.iconKey, this.gos)); | ||
this.eIconWrapper.insertAdjacentElement("afterbegin", (0, import_core3._createIconNoSpan)(this.toolPanelDef.iconKey, this.gos)); | ||
} | ||
onButtonPressed() { | ||
this.dispatchEvent({ type: _SideBarButtonComp.EVENT_TOGGLE_BUTTON_CLICKED }); | ||
this.dispatchLocalEvent({ type: "toggleButtonClicked" }); | ||
} | ||
setSelected(selected) { | ||
this.addOrRemoveCssClass("ag-selected", selected); | ||
import_core2._.setAriaExpanded(this.eToggleButton, selected); | ||
(0, import_core3._setAriaExpanded)(this.eToggleButton, selected); | ||
} | ||
@@ -189,31 +282,24 @@ getButtonElement() { | ||
}; | ||
_SideBarButtonComp.EVENT_TOGGLE_BUTTON_CLICKED = "toggleButtonClicked"; | ||
__decorateClass([ | ||
(0, import_core2.RefSelector)("eToggleButton") | ||
], _SideBarButtonComp.prototype, "eToggleButton", 2); | ||
__decorateClass([ | ||
(0, import_core2.RefSelector)("eIconWrapper") | ||
], _SideBarButtonComp.prototype, "eIconWrapper", 2); | ||
__decorateClass([ | ||
(0, import_core2.RefSelector)("eLabel") | ||
], _SideBarButtonComp.prototype, "eLabel", 2); | ||
__decorateClass([ | ||
import_core2.PostConstruct | ||
], _SideBarButtonComp.prototype, "postConstruct", 1); | ||
var SideBarButtonComp = _SideBarButtonComp; | ||
// enterprise-modules/side-bar/src/sideBar/sideBarButtonsComp.ts | ||
var _SideBarButtonsComp = class _SideBarButtonsComp extends import_core3.Component { | ||
// enterprise-modules/side-bar/src/sideBar/agSideBarButtons.ts | ||
var AgSideBarButtons = class extends import_core4.Component { | ||
constructor() { | ||
super(_SideBarButtonsComp.TEMPLATE); | ||
super( | ||
/* html */ | ||
`<div class="ag-side-buttons" role="tablist"></div>` | ||
); | ||
this.buttonComps = []; | ||
} | ||
wireBeans(beans) { | ||
this.focusService = beans.focusService; | ||
this.visibleColsService = beans.visibleColsService; | ||
} | ||
postConstruct() { | ||
this.addManagedListener(this.getFocusableElement(), "keydown", this.handleKeyDown.bind(this)); | ||
this.addManagedElementListeners(this.getFocusableElement(), { keydown: this.handleKeyDown.bind(this) }); | ||
} | ||
handleKeyDown(e) { | ||
if (e.key !== import_core3.KeyCode.TAB || !e.shiftKey) { | ||
if (e.key !== import_core4.KeyCode.TAB || !e.shiftKey) { | ||
return; | ||
} | ||
const lastColumn = import_core3._.last(this.columnModel.getAllDisplayedColumns()); | ||
const lastColumn = (0, import_core4._last)(this.visibleColsService.getAllCols()); | ||
if (this.focusService.focusGridView(lastColumn, true)) { | ||
@@ -232,5 +318,5 @@ e.preventDefault(); | ||
this.appendChild(buttonComp); | ||
buttonComp.addEventListener(SideBarButtonComp.EVENT_TOGGLE_BUTTON_CLICKED, () => { | ||
this.dispatchEvent({ | ||
type: _SideBarButtonsComp.EVENT_SIDE_BAR_BUTTON_CLICKED, | ||
buttonComp.addEventListener("toggleButtonClicked", () => { | ||
this.dispatchLocalEvent({ | ||
type: "sideBarButtonClicked", | ||
toolPanelId: def.id | ||
@@ -243,89 +329,18 @@ }); | ||
this.buttonComps = this.destroyBeans(this.buttonComps); | ||
import_core3._.clearElement(this.getGui()); | ||
(0, import_core4._clearElement)(this.getGui()); | ||
super.destroy(); | ||
} | ||
destroy() { | ||
this.clearButtons(); | ||
super.destroy(); | ||
} | ||
}; | ||
_SideBarButtonsComp.EVENT_SIDE_BAR_BUTTON_CLICKED = "sideBarButtonClicked"; | ||
_SideBarButtonsComp.TEMPLATE = /* html */ | ||
`<div class="ag-side-buttons" role="tablist"></div>`; | ||
__decorateClass([ | ||
(0, import_core3.Autowired)("focusService") | ||
], _SideBarButtonsComp.prototype, "focusService", 2); | ||
__decorateClass([ | ||
(0, import_core3.Autowired)("columnModel") | ||
], _SideBarButtonsComp.prototype, "columnModel", 2); | ||
__decorateClass([ | ||
import_core3.PostConstruct | ||
], _SideBarButtonsComp.prototype, "postConstruct", 1); | ||
__decorateClass([ | ||
import_core3.PreDestroy | ||
], _SideBarButtonsComp.prototype, "clearButtons", 1); | ||
var SideBarButtonsComp = _SideBarButtonsComp; | ||
var AgSideBarButtonsSelector = { | ||
selector: "AG-SIDE-BAR-BUTTONS", | ||
component: AgSideBarButtons | ||
}; | ||
// enterprise-modules/side-bar/src/sideBar/sideBarDefParser.ts | ||
var _SideBarDefParser = class _SideBarDefParser { | ||
static parse(toParse) { | ||
if (!toParse) { | ||
return void 0; | ||
} | ||
if (toParse === true) { | ||
return { | ||
toolPanels: [ | ||
_SideBarDefParser.DEFAULT_COLUMN_COMP, | ||
_SideBarDefParser.DEFAULT_FILTER_COMP | ||
], | ||
defaultToolPanel: "columns" | ||
}; | ||
} | ||
if (typeof toParse === "string") { | ||
return _SideBarDefParser.parse([toParse]); | ||
} | ||
if (Array.isArray(toParse)) { | ||
const comps = []; | ||
toParse.forEach((key) => { | ||
const lookupResult = _SideBarDefParser.DEFAULT_BY_KEY[key]; | ||
if (!lookupResult) { | ||
console.warn(`AG Grid: the key ${key} is not a valid key for specifying a tool panel, valid keys are: ${Object.keys(_SideBarDefParser.DEFAULT_BY_KEY).join(",")}`); | ||
return; | ||
} | ||
comps.push(lookupResult); | ||
}); | ||
if (comps.length === 0) { | ||
return void 0; | ||
} | ||
return { | ||
toolPanels: comps, | ||
defaultToolPanel: comps[0].id | ||
}; | ||
} | ||
const result = { | ||
toolPanels: _SideBarDefParser.parseComponents(toParse.toolPanels), | ||
defaultToolPanel: toParse.defaultToolPanel, | ||
hiddenByDefault: toParse.hiddenByDefault, | ||
position: toParse.position | ||
}; | ||
return result; | ||
} | ||
static parseComponents(from) { | ||
const result = []; | ||
if (!from) { | ||
return result; | ||
} | ||
from.forEach((it) => { | ||
let toAdd = null; | ||
if (typeof it === "string") { | ||
const lookupResult = _SideBarDefParser.DEFAULT_BY_KEY[it]; | ||
if (!lookupResult) { | ||
console.warn(`AG Grid: the key ${it} is not a valid key for specifying a tool panel, valid keys are: ${Object.keys(_SideBarDefParser.DEFAULT_BY_KEY).join(",")}`); | ||
return; | ||
} | ||
toAdd = lookupResult; | ||
} else { | ||
toAdd = it; | ||
} | ||
result.push(toAdd); | ||
}); | ||
return result; | ||
} | ||
}; | ||
_SideBarDefParser.DEFAULT_COLUMN_COMP = { | ||
var import_core5 = require("@ag-grid-community/core"); | ||
var DEFAULT_COLUMN_COMP = { | ||
id: "columns", | ||
@@ -337,3 +352,3 @@ labelDefault: "Columns", | ||
}; | ||
_SideBarDefParser.DEFAULT_FILTER_COMP = { | ||
var DEFAULT_FILTER_COMP = { | ||
id: "filters", | ||
@@ -345,17 +360,157 @@ labelDefault: "Filters", | ||
}; | ||
_SideBarDefParser.DEFAULT_BY_KEY = { | ||
columns: _SideBarDefParser.DEFAULT_COLUMN_COMP, | ||
filters: _SideBarDefParser.DEFAULT_FILTER_COMP | ||
var DEFAULT_BY_KEY = { | ||
columns: DEFAULT_COLUMN_COMP, | ||
filters: DEFAULT_FILTER_COMP | ||
}; | ||
var SideBarDefParser = _SideBarDefParser; | ||
function parseSideBarDef(toParse) { | ||
if (!toParse) { | ||
return void 0; | ||
} | ||
if (toParse === true) { | ||
return { | ||
toolPanels: [DEFAULT_COLUMN_COMP, DEFAULT_FILTER_COMP], | ||
defaultToolPanel: "columns" | ||
}; | ||
} | ||
if (typeof toParse === "string") { | ||
return parseSideBarDef([toParse]); | ||
} | ||
if (Array.isArray(toParse)) { | ||
const comps = []; | ||
toParse.forEach((key) => { | ||
const lookupResult = DEFAULT_BY_KEY[key]; | ||
if (!lookupResult) { | ||
logMissingKey(key); | ||
return; | ||
} | ||
comps.push(lookupResult); | ||
}); | ||
if (comps.length === 0) { | ||
return void 0; | ||
} | ||
return { | ||
toolPanels: comps, | ||
defaultToolPanel: comps[0].id | ||
}; | ||
} | ||
const result = { | ||
toolPanels: parseComponents(toParse.toolPanels), | ||
defaultToolPanel: toParse.defaultToolPanel, | ||
hiddenByDefault: toParse.hiddenByDefault, | ||
position: toParse.position | ||
}; | ||
return result; | ||
} | ||
function logMissingKey(key) { | ||
(0, import_core5._warnOnce)( | ||
`the key ${key} is not a valid key for specifying a tool panel, valid keys are: ${Object.keys(DEFAULT_BY_KEY).join(",")}` | ||
); | ||
} | ||
function parseComponents(from) { | ||
const result = []; | ||
if (!from) { | ||
return result; | ||
} | ||
from.forEach((it) => { | ||
let toAdd = null; | ||
if (typeof it === "string") { | ||
const lookupResult = DEFAULT_BY_KEY[it]; | ||
if (!lookupResult) { | ||
logMissingKey(it); | ||
return; | ||
} | ||
toAdd = lookupResult; | ||
} else { | ||
toAdd = it; | ||
} | ||
result.push(toAdd); | ||
}); | ||
return result; | ||
} | ||
// enterprise-modules/side-bar/src/sideBar/toolPanelWrapper.ts | ||
var import_core4 = require("@ag-grid-community/core"); | ||
var _ToolPanelWrapper = class _ToolPanelWrapper extends import_core4.Component { | ||
var import_core7 = require("@ag-grid-community/core"); | ||
// enterprise-modules/side-bar/src/sideBar/agHorizontalResize.ts | ||
var import_core6 = require("@ag-grid-community/core"); | ||
var AgHorizontalResize = class extends import_core6.Component { | ||
constructor() { | ||
super(_ToolPanelWrapper.TEMPLATE); | ||
super( | ||
/* html */ | ||
`<div class="ag-tool-panel-horizontal-resize"></div>` | ||
); | ||
this.minWidth = 100; | ||
this.maxWidth = null; | ||
} | ||
setupResize() { | ||
wireBeans(beans) { | ||
this.horizontalResizeService = beans.horizontalResizeService; | ||
} | ||
setElementToResize(elementToResize) { | ||
this.elementToResize = elementToResize; | ||
} | ||
postConstruct() { | ||
const finishedWithResizeFunc = this.horizontalResizeService.addResizeBar({ | ||
eResizeBar: this.getGui(), | ||
dragStartPixels: 1, | ||
onResizeStart: this.onResizeStart.bind(this), | ||
onResizing: this.onResizing.bind(this), | ||
onResizeEnd: this.onResizeEnd.bind(this) | ||
}); | ||
this.addDestroyFunc(finishedWithResizeFunc); | ||
this.setInverted(this.gos.get("enableRtl")); | ||
} | ||
dispatchResizeEvent(start, end, width) { | ||
const event = { | ||
type: "toolPanelSizeChanged", | ||
width, | ||
started: start, | ||
ended: end | ||
}; | ||
this.eventService.dispatchEvent(event); | ||
} | ||
onResizeStart() { | ||
this.startingWidth = this.elementToResize.offsetWidth; | ||
this.dispatchResizeEvent(true, false, this.startingWidth); | ||
} | ||
onResizeEnd(delta) { | ||
return this.onResizing(delta, true); | ||
} | ||
onResizing(delta, isEnd = false) { | ||
const direction = this.inverted ? -1 : 1; | ||
let newWidth = Math.max(this.minWidth, Math.floor(this.startingWidth - delta * direction)); | ||
if (this.maxWidth != null) { | ||
newWidth = Math.min(this.maxWidth, newWidth); | ||
} | ||
this.elementToResize.style.width = `${newWidth}px`; | ||
this.dispatchResizeEvent(false, isEnd, newWidth); | ||
} | ||
setInverted(inverted) { | ||
this.inverted = inverted; | ||
} | ||
setMaxWidth(value) { | ||
this.maxWidth = value; | ||
} | ||
setMinWidth(value) { | ||
if (value != null) { | ||
this.minWidth = value; | ||
} else { | ||
this.minWidth = 100; | ||
} | ||
} | ||
}; | ||
// enterprise-modules/side-bar/src/sideBar/toolPanelWrapper.ts | ||
var ToolPanelWrapper = class extends import_core7.Component { | ||
wireBeans(beans) { | ||
this.userComponentFactory = beans.userComponentFactory; | ||
} | ||
constructor() { | ||
super( | ||
/* html */ | ||
`<div class="ag-tool-panel-wrapper" role="tabpanel"/>` | ||
); | ||
} | ||
postConstruct() { | ||
const eGui = this.getGui(); | ||
const resizeBar = this.resizeBar = this.createManagedBean(new HorizontalResizeComp()); | ||
const resizeBar = this.resizeBar = this.createManagedBean(new AgHorizontalResize()); | ||
eGui.setAttribute("id", `ag-${this.getCompId()}`); | ||
@@ -376,3 +531,3 @@ resizeBar.setElementToResize(eGui); | ||
if (componentPromise == null) { | ||
console.warn(`AG Grid: error processing tool panel component ${id}. You need to specify 'toolPanel'`); | ||
(0, import_core7._warnOnce)(`error processing tool panel component ${id}. You need to specify 'toolPanel'`); | ||
return; | ||
@@ -408,27 +563,29 @@ } | ||
refresh() { | ||
this.toolPanelCompInstance.refresh(this.params); | ||
this.toolPanelCompInstance?.refresh(this.params); | ||
} | ||
}; | ||
_ToolPanelWrapper.TEMPLATE = /* html */ | ||
`<div class="ag-tool-panel-wrapper" role="tabpanel"/>`; | ||
__decorateClass([ | ||
(0, import_core4.Autowired)("userComponentFactory") | ||
], _ToolPanelWrapper.prototype, "userComponentFactory", 2); | ||
__decorateClass([ | ||
import_core4.PostConstruct | ||
], _ToolPanelWrapper.prototype, "setupResize", 1); | ||
var ToolPanelWrapper = _ToolPanelWrapper; | ||
// enterprise-modules/side-bar/src/sideBar/sideBarComp.ts | ||
var _SideBarComp = class _SideBarComp extends import_core5.Component { | ||
// enterprise-modules/side-bar/src/sideBar/agSideBar.ts | ||
var AgSideBar = class extends import_core8.Component { | ||
constructor() { | ||
super(_SideBarComp.TEMPLATE); | ||
super( | ||
/* html */ | ||
`<div class="ag-side-bar ag-unselectable"> | ||
<ag-side-bar-buttons data-ref="sideBarButtons"></ag-side-bar-buttons> | ||
</div>`, | ||
[AgSideBarButtonsSelector] | ||
); | ||
this.sideBarButtons = import_core8.RefPlaceholder; | ||
this.toolPanelWrappers = []; | ||
} | ||
wireBeans(beans) { | ||
this.focusService = beans.focusService; | ||
this.filterManager = beans.filterManager; | ||
this.sideBarService = beans.sideBarService; | ||
} | ||
postConstruct() { | ||
var _a; | ||
this.sideBarButtonsComp.addEventListener(SideBarButtonsComp.EVENT_SIDE_BAR_BUTTON_CLICKED, this.onToolPanelButtonClicked.bind(this)); | ||
const { sideBar: sideBarState } = (_a = this.gos.get("initialState")) != null ? _a : {}; | ||
this.sideBarButtons.addEventListener("sideBarButtonClicked", this.onToolPanelButtonClicked.bind(this)); | ||
const { sideBar: sideBarState } = this.gos.get("initialState") ?? {}; | ||
this.setSideBarDef({ | ||
sideBarDef: SideBarDefParser.parse(this.gos.get("sideBar")), | ||
sideBarDef: parseSideBarDef(this.gos.get("sideBar")), | ||
sideBarState | ||
@@ -438,9 +595,10 @@ }); | ||
this.sideBarService.registerSideBarComp(this); | ||
this.createManagedBean(new import_core5.ManagedFocusFeature( | ||
this.getFocusableElement(), | ||
{ | ||
const eGui = this.getFocusableElement(); | ||
this.createManagedBean( | ||
new import_core8.ManagedFocusFeature(eGui, { | ||
onTabKeyDown: this.onTabKeyDown.bind(this), | ||
handleKeyDown: this.handleKeyDown.bind(this) | ||
} | ||
)); | ||
}) | ||
); | ||
(0, import_core8._addFocusableContainerListener)(this, eGui, this.focusService); | ||
} | ||
@@ -451,5 +609,5 @@ onTabKeyDown(e) { | ||
} | ||
const { focusService, sideBarButtonsComp } = this; | ||
const { focusService, sideBarButtons } = this; | ||
const eGui = this.getGui(); | ||
const sideBarGui = sideBarButtonsComp.getGui(); | ||
const sideBarGui = sideBarButtons.getGui(); | ||
const activeElement = this.gos.getActiveDomElement(); | ||
@@ -486,6 +644,6 @@ const openPanel = eGui.querySelector(".ag-tool-panel-wrapper:not(.ag-hidden)"); | ||
const currentButton = this.gos.getActiveDomElement(); | ||
if (!this.sideBarButtonsComp.getGui().contains(currentButton)) { | ||
if (!this.sideBarButtons.getGui().contains(currentButton)) { | ||
return; | ||
} | ||
const sideBarGui = this.sideBarButtonsComp.getGui(); | ||
const sideBarGui = this.sideBarButtons.getGui(); | ||
const buttons = Array.prototype.slice.call(sideBarGui.querySelectorAll(".ag-side-button")); | ||
@@ -495,8 +653,8 @@ const currentPos = buttons.findIndex((button) => button.contains(currentButton)); | ||
switch (e.key) { | ||
case import_core5.KeyCode.LEFT: | ||
case import_core5.KeyCode.UP: | ||
case import_core8.KeyCode.LEFT: | ||
case import_core8.KeyCode.UP: | ||
nextPos = Math.max(0, currentPos - 1); | ||
break; | ||
case import_core5.KeyCode.RIGHT: | ||
case import_core5.KeyCode.DOWN: | ||
case import_core8.KeyCode.RIGHT: | ||
case import_core8.KeyCode.DOWN: | ||
nextPos = Math.min(currentPos + 1, buttons.length - 1); | ||
@@ -524,3 +682,3 @@ break; | ||
clearDownUi() { | ||
this.sideBarButtonsComp.clearButtons(); | ||
this.sideBarButtons.clearButtons(); | ||
this.destroyToolPanelWrappers(); | ||
@@ -546,5 +704,5 @@ } | ||
if (sideBarState) { | ||
const { openToolPanel } = sideBarState; | ||
if (openToolPanel) { | ||
this.openToolPanel(openToolPanel, "sideBarInitializing"); | ||
const { openToolPanel: openToolPanel2 } = sideBarState; | ||
if (openToolPanel2) { | ||
this.openToolPanel(openToolPanel2, "sideBarInitializing"); | ||
} | ||
@@ -572,3 +730,3 @@ } else { | ||
}); | ||
this.eventService.dispatchEvent({ type: import_core5.Events.EVENT_SIDE_BAR_UPDATED }); | ||
this.eventService.dispatchEvent({ type: "sideBarUpdated" }); | ||
return this; | ||
@@ -578,3 +736,3 @@ } | ||
super.setDisplayed(displayed, options); | ||
this.eventService.dispatchEvent({ type: import_core5.Events.EVENT_SIDE_BAR_UPDATED }); | ||
this.eventService.dispatchEvent({ type: "sideBarUpdated" }); | ||
} | ||
@@ -584,4 +742,3 @@ getState() { | ||
this.toolPanelWrappers.forEach((wrapper) => { | ||
var _a, _b; | ||
toolPanels[wrapper.getToolPanelId()] = (_b = (_a = wrapper.getToolPanelInstance()) == null ? void 0 : _a.getState) == null ? void 0 : _b.call(_a); | ||
toolPanels[wrapper.getToolPanelId()] = wrapper.getToolPanelInstance()?.getState?.(); | ||
}); | ||
@@ -596,5 +753,8 @@ return { | ||
createToolPanelsAndSideButtons(defs, sideBarState, existingToolPanelWrappers) { | ||
var _a; | ||
for (const def of defs) { | ||
this.createToolPanelAndSideButton(def, (_a = sideBarState == null ? void 0 : sideBarState.toolPanels) == null ? void 0 : _a[def.id], existingToolPanelWrappers == null ? void 0 : existingToolPanelWrappers[def.id]); | ||
this.createToolPanelAndSideButton( | ||
def, | ||
sideBarState?.toolPanels?.[def.id], | ||
existingToolPanelWrappers?.[def.id] | ||
); | ||
} | ||
@@ -604,7 +764,13 @@ } | ||
if (def.id == null) { | ||
console.warn(`AG Grid: please review all your toolPanel components, it seems like at least one of them doesn't have an id`); | ||
(0, import_core8._warnOnce)( | ||
`please review all your toolPanel components, it seems like at least one of them doesn't have an id` | ||
); | ||
return false; | ||
} | ||
if (def.toolPanel === "agColumnsToolPanel") { | ||
const moduleMissing = !import_core5.ModuleRegistry.__assertRegistered(import_core5.ModuleNames.ColumnsToolPanelModule, "Column Tool Panel", this.context.getGridId()); | ||
const moduleMissing = !import_core8.ModuleRegistry.__assertRegistered( | ||
import_core8.ModuleNames.ColumnsToolPanelModule, | ||
"Column Tool Panel", | ||
this.gridId | ||
); | ||
if (moduleMissing) { | ||
@@ -615,8 +781,14 @@ return false; | ||
if (def.toolPanel === "agFiltersToolPanel") { | ||
const moduleMissing = !import_core5.ModuleRegistry.__assertRegistered(import_core5.ModuleNames.FiltersToolPanelModule, "Filters Tool Panel", this.context.getGridId()); | ||
const moduleMissing = !import_core8.ModuleRegistry.__assertRegistered( | ||
import_core8.ModuleNames.FiltersToolPanelModule, | ||
"Filters Tool Panel", | ||
this.gridId | ||
); | ||
if (moduleMissing) { | ||
return false; | ||
} | ||
if (this.filterManager.isAdvancedFilterEnabled()) { | ||
import_core5._.warnOnce("Advanced Filter does not work with Filters Tool Panel. Filters Tool Panel has been disabled."); | ||
if (this.filterManager?.isAdvancedFilterEnabled()) { | ||
(0, import_core8._warnOnce)( | ||
"Advanced Filter does not work with Filters Tool Panel. Filters Tool Panel has been disabled." | ||
); | ||
return false; | ||
@@ -631,3 +803,3 @@ } | ||
} | ||
const button = this.sideBarButtonsComp.addButtonComp(def); | ||
const button = this.sideBarButtons.addButtonComp(def); | ||
let wrapper; | ||
@@ -637,6 +809,6 @@ if (existingToolPanelWrapper) { | ||
} else { | ||
wrapper = this.getContext().createBean(new ToolPanelWrapper()); | ||
wrapper = this.createBean(new ToolPanelWrapper()); | ||
wrapper.setToolPanelDef(def, { | ||
initialState, | ||
onStateUpdated: () => this.eventService.dispatchEvent({ type: import_core5.Events.EVENT_SIDE_BAR_UPDATED }) | ||
onStateUpdated: () => this.eventService.dispatchEvent({ type: "sideBarUpdated" }) | ||
}); | ||
@@ -648,3 +820,3 @@ } | ||
this.toolPanelWrappers.push(wrapper); | ||
import_core5._.setAriaControls(button.getButtonElement(), wrapperGui); | ||
(0, import_core8._setAriaControls)(button.getButtonElement(), wrapperGui); | ||
} | ||
@@ -666,4 +838,4 @@ refresh() { | ||
if (openToolPanelChanged) { | ||
this.sideBarButtonsComp.setActiveButton(key); | ||
this.raiseToolPanelVisibleEvent(key, currentlyOpenedKey != null ? currentlyOpenedKey : void 0, source); | ||
this.sideBarButtons.setActiveButton(key); | ||
this.raiseToolPanelVisibleEvent(key, currentlyOpenedKey ?? void 0, source); | ||
} | ||
@@ -674,3 +846,3 @@ } | ||
if (!toolPanelWrapper) { | ||
console.warn(`AG Grid: unable to lookup Tool Panel as invalid key supplied: ${key}`); | ||
(0, import_core8._warnOnce)(`unable to lookup Tool Panel as invalid key supplied: ${key}`); | ||
return; | ||
@@ -684,3 +856,3 @@ } | ||
const event = { | ||
type: import_core5.Events.EVENT_TOOL_PANEL_VISIBLE_CHANGED, | ||
type: "toolPanelVisibleChanged", | ||
source, | ||
@@ -695,3 +867,3 @@ key: previousKey, | ||
const event = { | ||
type: import_core5.Events.EVENT_TOOL_PANEL_VISIBLE_CHANGED, | ||
type: "toolPanelVisibleChanged", | ||
source, | ||
@@ -721,8 +893,6 @@ key, | ||
onSideBarUpdated() { | ||
var _a; | ||
const sideBarDef = SideBarDefParser.parse(this.gos.get("sideBar")); | ||
let existingToolPanelWrappers = {}; | ||
const sideBarDef = parseSideBarDef(this.gos.get("sideBar")); | ||
const existingToolPanelWrappers = {}; | ||
if (sideBarDef && this.sideBar) { | ||
(_a = sideBarDef.toolPanels) == null ? void 0 : _a.forEach((toolPanelDef) => { | ||
var _a2, _b; | ||
sideBarDef.toolPanels?.forEach((toolPanelDef) => { | ||
const { id } = toolPanelDef; | ||
@@ -732,3 +902,3 @@ if (!id) { | ||
} | ||
const existingToolPanelDef = (_a2 = this.sideBar.toolPanels) == null ? void 0 : _a2.find( | ||
const existingToolPanelDef = this.sideBar.toolPanels?.find( | ||
(toolPanelDefToCheck) => toolPanelDefToCheck.id === id | ||
@@ -743,6 +913,7 @@ ); | ||
} | ||
const params = this.gos.addGridCommonParams(__spreadProps(__spreadValues({}, (_b = toolPanelDef.toolPanelParams) != null ? _b : {}), { | ||
onStateUpdated: () => this.eventService.dispatchEvent({ type: import_core5.Events.EVENT_SIDE_BAR_UPDATED }) | ||
})); | ||
const hasRefreshed = toolPanelWrapper.getToolPanelInstance().refresh(params); | ||
const params = this.gos.addGridCommonParams({ | ||
...toolPanelDef.toolPanelParams ?? {}, | ||
onStateUpdated: () => this.eventService.dispatchEvent({ type: "sideBarUpdated" }) | ||
}); | ||
const hasRefreshed = toolPanelWrapper.getToolPanelInstance()?.refresh(params); | ||
if (hasRefreshed !== true) { | ||
@@ -752,3 +923,3 @@ return; | ||
this.toolPanelWrappers = this.toolPanelWrappers.filter((toolPanel) => toolPanel !== toolPanelWrapper); | ||
import_core5._.removeFromParent(toolPanelWrapper.getGui()); | ||
(0, import_core8._removeFromParent)(toolPanelWrapper.getGui()); | ||
existingToolPanelWrappers[id] = toolPanelWrapper; | ||
@@ -762,3 +933,3 @@ }); | ||
this.toolPanelWrappers.forEach((wrapper) => { | ||
import_core5._.removeFromParent(wrapper.getGui()); | ||
(0, import_core8._removeFromParent)(wrapper.getGui()); | ||
this.destroyBean(wrapper); | ||
@@ -773,181 +944,13 @@ }); | ||
}; | ||
_SideBarComp.TEMPLATE = /* html */ | ||
`<div class="ag-side-bar ag-unselectable"> | ||
<ag-side-bar-buttons ref="sideBarButtons"></ag-side-bar-buttons> | ||
</div>`; | ||
__decorateClass([ | ||
(0, import_core5.Autowired)("focusService") | ||
], _SideBarComp.prototype, "focusService", 2); | ||
__decorateClass([ | ||
(0, import_core5.Autowired)("filterManager") | ||
], _SideBarComp.prototype, "filterManager", 2); | ||
__decorateClass([ | ||
(0, import_core5.Autowired)("sideBarService") | ||
], _SideBarComp.prototype, "sideBarService", 2); | ||
__decorateClass([ | ||
(0, import_core5.RefSelector)("sideBarButtons") | ||
], _SideBarComp.prototype, "sideBarButtonsComp", 2); | ||
__decorateClass([ | ||
import_core5.PostConstruct | ||
], _SideBarComp.prototype, "postConstruct", 1); | ||
var SideBarComp = _SideBarComp; | ||
var AgSideBarSelector = { | ||
selector: "AG-SIDE-BAR", | ||
component: AgSideBar | ||
}; | ||
// enterprise-modules/side-bar/src/sideBar/common/toolPanelColDefService.ts | ||
var import_core6 = require("@ag-grid-community/core"); | ||
var ToolPanelColDefService = class extends import_core6.BeanStub { | ||
// enterprise-modules/side-bar/src/sideBar/sideBarService.ts | ||
var SideBarService = class extends import_core9.BeanStub { | ||
constructor() { | ||
super(...arguments); | ||
this.isColGroupDef = (colDef) => colDef && typeof colDef.children !== "undefined"; | ||
this.getId = (colDef) => { | ||
return this.isColGroupDef(colDef) ? colDef.groupId : colDef.colId; | ||
}; | ||
this.beanName = "sideBarService"; | ||
} | ||
createColumnTree(colDefs) { | ||
const invalidColIds = []; | ||
const createDummyColGroup = (abstractColDef, depth) => { | ||
if (this.isColGroupDef(abstractColDef)) { | ||
const groupDef = abstractColDef; | ||
const groupId = typeof groupDef.groupId !== "undefined" ? groupDef.groupId : groupDef.headerName; | ||
const group = new import_core6.ProvidedColumnGroup(groupDef, groupId, false, depth); | ||
const children = []; | ||
groupDef.children.forEach((def) => { | ||
const child = createDummyColGroup(def, depth + 1); | ||
if (child) { | ||
children.push(child); | ||
} | ||
}); | ||
group.setChildren(children); | ||
return group; | ||
} else { | ||
const colDef = abstractColDef; | ||
const key = colDef.colId ? colDef.colId : colDef.field; | ||
const column = this.columnModel.getPrimaryColumn(key); | ||
if (!column) { | ||
invalidColIds.push(colDef); | ||
} | ||
return column; | ||
} | ||
}; | ||
const mappedResults = []; | ||
colDefs.forEach((colDef) => { | ||
const result = createDummyColGroup(colDef, 0); | ||
if (result) { | ||
mappedResults.push(result); | ||
} | ||
}); | ||
if (invalidColIds.length > 0) { | ||
console.warn("AG Grid: unable to find grid columns for the supplied colDef(s):", invalidColIds); | ||
} | ||
return mappedResults; | ||
} | ||
syncLayoutWithGrid(syncLayoutCallback) { | ||
const leafPathTrees = this.getLeafPathTrees(); | ||
const mergedColumnTrees = this.mergeLeafPathTrees(leafPathTrees); | ||
syncLayoutCallback(mergedColumnTrees); | ||
} | ||
getLeafPathTrees() { | ||
const getLeafPathTree = (node, childDef) => { | ||
let leafPathTree; | ||
if (node instanceof import_core6.ProvidedColumnGroup) { | ||
if (node.isPadding()) { | ||
leafPathTree = childDef; | ||
} else { | ||
const groupDef = Object.assign({}, node.getColGroupDef()); | ||
groupDef.groupId = node.getGroupId(); | ||
groupDef.children = [childDef]; | ||
leafPathTree = groupDef; | ||
} | ||
} else { | ||
const colDef = Object.assign({}, node.getColDef()); | ||
colDef.colId = node.getColId(); | ||
leafPathTree = colDef; | ||
} | ||
const parent = node.getOriginalParent(); | ||
if (parent) { | ||
return getLeafPathTree(parent, leafPathTree); | ||
} else { | ||
return leafPathTree; | ||
} | ||
}; | ||
const allGridColumns = this.columnModel.getAllGridColumns(); | ||
const allPrimaryGridColumns = allGridColumns.filter((column) => { | ||
const colDef = column.getColDef(); | ||
return column.isPrimary() && !colDef.showRowGroup; | ||
}); | ||
return allPrimaryGridColumns.map((col) => getLeafPathTree(col, col.getColDef())); | ||
} | ||
mergeLeafPathTrees(leafPathTrees) { | ||
const matchingRootGroupIds = (pathA, pathB) => { | ||
const bothPathsAreGroups = this.isColGroupDef(pathA) && this.isColGroupDef(pathB); | ||
return bothPathsAreGroups && this.getId(pathA) === this.getId(pathB); | ||
}; | ||
const mergeTrees = (treeA, treeB) => { | ||
if (!this.isColGroupDef(treeB)) { | ||
return treeA; | ||
} | ||
const mergeResult = treeA; | ||
const groupToMerge = treeB; | ||
if (groupToMerge.children && groupToMerge.groupId) { | ||
const added = this.addChildrenToGroup(mergeResult, groupToMerge.groupId, groupToMerge.children[0]); | ||
if (added) { | ||
return mergeResult; | ||
} | ||
} | ||
groupToMerge.children.forEach((child) => mergeTrees(mergeResult, child)); | ||
return mergeResult; | ||
}; | ||
const mergeColDefs = []; | ||
for (let i = 1; i <= leafPathTrees.length; i++) { | ||
const first = leafPathTrees[i - 1]; | ||
const second = leafPathTrees[i]; | ||
if (matchingRootGroupIds(first, second)) { | ||
leafPathTrees[i] = mergeTrees(first, second); | ||
} else { | ||
mergeColDefs.push(first); | ||
} | ||
} | ||
return mergeColDefs; | ||
} | ||
addChildrenToGroup(tree, groupId, colDef) { | ||
const subGroupIsSplit = (currentSubGroup, currentSubGroupToAdd) => { | ||
const existingChildIds = currentSubGroup.children.map(this.getId); | ||
const childGroupAlreadyExists = import_core6._.includes(existingChildIds, this.getId(currentSubGroupToAdd)); | ||
const lastChild = import_core6._.last(currentSubGroup.children); | ||
const lastChildIsDifferent = lastChild && this.getId(lastChild) !== this.getId(currentSubGroupToAdd); | ||
return childGroupAlreadyExists && lastChildIsDifferent; | ||
}; | ||
if (!this.isColGroupDef(tree)) { | ||
return true; | ||
} | ||
const currentGroup = tree; | ||
const groupToAdd = colDef; | ||
if (subGroupIsSplit(currentGroup, groupToAdd)) { | ||
currentGroup.children.push(groupToAdd); | ||
return true; | ||
} | ||
if (currentGroup.groupId === groupId) { | ||
const existingChildIds = currentGroup.children.map(this.getId); | ||
const colDefAlreadyPresent = import_core6._.includes(existingChildIds, this.getId(groupToAdd)); | ||
if (!colDefAlreadyPresent) { | ||
currentGroup.children.push(groupToAdd); | ||
return true; | ||
} | ||
} | ||
currentGroup.children.forEach((subGroup) => this.addChildrenToGroup(subGroup, groupId, colDef)); | ||
return false; | ||
} | ||
}; | ||
__decorateClass([ | ||
(0, import_core6.Autowired)("columnModel") | ||
], ToolPanelColDefService.prototype, "columnModel", 2); | ||
ToolPanelColDefService = __decorateClass([ | ||
(0, import_core6.Bean)("toolPanelColDefService") | ||
], ToolPanelColDefService); | ||
// enterprise-modules/side-bar/src/version.ts | ||
var VERSION = "31.3.2"; | ||
// enterprise-modules/side-bar/src/sideBar/sideBarService.ts | ||
var import_core7 = require("@ag-grid-community/core"); | ||
var SideBarService = class extends import_core7.BeanStub { | ||
registerSideBarComp(sideBarComp) { | ||
@@ -959,20 +962,38 @@ this.sideBarComp = sideBarComp; | ||
} | ||
getSideBarSelector() { | ||
return AgSideBarSelector; | ||
} | ||
}; | ||
SideBarService = __decorateClass([ | ||
(0, import_core7.Bean)("sideBarService") | ||
], SideBarService); | ||
// enterprise-modules/side-bar/src/version.ts | ||
var VERSION = "32.0.0"; | ||
// enterprise-modules/side-bar/src/sideBarModule.ts | ||
var SideBarModule = { | ||
var SideBarCoreModule = { | ||
version: VERSION, | ||
moduleName: import_core8.ModuleNames.SideBarModule, | ||
moduleName: `${import_core10.ModuleNames.SideBarModule}-core`, | ||
beans: [ToolPanelColDefService, SideBarService], | ||
agStackComponents: [ | ||
{ componentName: "AgHorizontalResize", componentClass: HorizontalResizeComp }, | ||
{ componentName: "AgSideBar", componentClass: SideBarComp }, | ||
{ componentName: "AgSideBarButtons", componentClass: SideBarButtonsComp } | ||
], | ||
dependantModules: [ | ||
import_core9.EnterpriseCoreModule | ||
] | ||
dependantModules: [import_core11.EnterpriseCoreModule] | ||
}; | ||
var SideBarApiModule = { | ||
version: VERSION, | ||
moduleName: `${import_core10.ModuleNames.SideBarModule}-api`, | ||
apiFunctions: { | ||
isSideBarVisible, | ||
setSideBarVisible, | ||
setSideBarPosition, | ||
openToolPanel, | ||
closeToolPanel, | ||
getOpenedToolPanel, | ||
refreshToolPanel, | ||
isToolPanelShowing, | ||
getToolPanelInstance, | ||
getSideBar | ||
}, | ||
dependantModules: [SideBarCoreModule] | ||
}; | ||
var SideBarModule = { | ||
version: VERSION, | ||
moduleName: import_core10.ModuleNames.SideBarModule, | ||
dependantModules: [SideBarCoreModule, SideBarApiModule] | ||
}; |
@@ -1,8 +0,8 @@ | ||
var __defProp=Object.defineProperty,__defProps=Object.defineProperties,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropDescs=Object.getOwnPropertyDescriptors,__getOwnPropNames=Object.getOwnPropertyNames,__getOwnPropSymbols=Object.getOwnPropertySymbols,__hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable,__defNormalProp=(i,e,t)=>e in i?__defProp(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,__spreadValues=(i,e)=>{for(var t in e||(e={}))__hasOwnProp.call(e,t)&&__defNormalProp(i,t,e[t]);if(__getOwnPropSymbols)for(var t of __getOwnPropSymbols(e))__propIsEnum.call(e,t)&&__defNormalProp(i,t,e[t]);return i},__spreadProps=(i,e)=>__defProps(i,__getOwnPropDescs(e)),__export=(i,e)=>{for(var t in e)__defProp(i,t,{get:e[t],enumerable:!0})},__copyProps=(i,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of __getOwnPropNames(e))!__hasOwnProp.call(i,s)&&s!==t&&__defProp(i,s,{get:()=>e[s],enumerable:!(o=__getOwnPropDesc(e,s))||o.enumerable});return i},__toCommonJS=i=>__copyProps(__defProp({},"__esModule",{value:!0}),i),__decorateClass=(i,e,t,o)=>{for(var s=o>1?void 0:o?__getOwnPropDesc(e,t):e,n=i.length-1,r;n>=0;n--)(r=i[n])&&(s=(o?r(e,t,s):r(s))||s);return o&&s&&__defProp(e,t,s),s},main_exports={};__export(main_exports,{SideBarModule:()=>SideBarModule,ToolPanelColDefService:()=>ToolPanelColDefService}),module.exports=__toCommonJS(main_exports);var import_core8=require("@ag-grid-community/core"),import_core9=require("@ag-grid-enterprise/core"),import_core=require("@ag-grid-community/core"),HorizontalResizeComp=class extends import_core.Component{constructor(){super('<div class="ag-tool-panel-horizontal-resize"></div>'),this.minWidth=100,this.maxWidth=null}setElementToResize(i){this.elementToResize=i}postConstruct(){const i=this.horizontalResizeService.addResizeBar({eResizeBar:this.getGui(),dragStartPixels:1,onResizeStart:this.onResizeStart.bind(this),onResizing:this.onResizing.bind(this),onResizeEnd:this.onResizeEnd.bind(this)});this.addDestroyFunc(i),this.setInverted(this.gos.get("enableRtl"))}dispatchResizeEvent(i,e,t){const o={type:import_core.Events.EVENT_TOOL_PANEL_SIZE_CHANGED,width:t,started:i,ended:e};this.eventService.dispatchEvent(o)}onResizeStart(){this.startingWidth=this.elementToResize.offsetWidth,this.dispatchResizeEvent(!0,!1,this.startingWidth)}onResizeEnd(i){return this.onResizing(i,!0)}onResizing(i,e=!1){const t=this.inverted?-1:1;let o=Math.max(this.minWidth,Math.floor(this.startingWidth-i*t));this.maxWidth!=null&&(o=Math.min(this.maxWidth,o)),this.elementToResize.style.width=`${o}px`,this.dispatchResizeEvent(!1,e,o)}setInverted(i){this.inverted=i}setMaxWidth(i){this.maxWidth=i}setMinWidth(i){i!=null?this.minWidth=i:this.minWidth=100}};__decorateClass([(0,import_core.Autowired)("horizontalResizeService")],HorizontalResizeComp.prototype,"horizontalResizeService",2),__decorateClass([import_core.PostConstruct],HorizontalResizeComp.prototype,"postConstruct",1);var import_core5=require("@ag-grid-community/core"),import_core3=require("@ag-grid-community/core"),import_core2=require("@ag-grid-community/core"),_SideBarButtonComp=class g extends import_core2.Component{constructor(e){super(),this.toolPanelDef=e}getToolPanelId(){return this.toolPanelDef.id}postConstruct(){const e=this.createTemplate();this.setTemplate(e),this.setLabel(),this.setIcon(),this.addManagedListener(this.eToggleButton,"click",this.onButtonPressed.bind(this)),this.eToggleButton.setAttribute("id",`ag-${this.getCompId()}-button`)}createTemplate(){return`<div class="ag-side-button" role="presentation"> | ||
<button type="button" ref="eToggleButton" tabindex="-1" role="tab" aria-expanded="false" class="ag-button ag-side-button-button"> | ||
<div ref="eIconWrapper" class="ag-side-button-icon-wrapper" aria-hidden="true"></div> | ||
<span ref ="eLabel" class="ag-side-button-label"></span> | ||
var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,t)=>{for(var o in t)__defProp(e,o,{get:t[o],enumerable:!0})},__copyProps=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of __getOwnPropNames(t))!__hasOwnProp.call(e,i)&&i!==o&&__defProp(e,i,{get:()=>t[i],enumerable:!(s=__getOwnPropDesc(t,i))||s.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),main_exports={};__export(main_exports,{SideBarModule:()=>SideBarModule,ToolPanelColDefService:()=>ToolPanelColDefService}),module.exports=__toCommonJS(main_exports);var import_core10=require("@ag-grid-community/core"),import_core11=require("@ag-grid-enterprise/core"),import_core=require("@ag-grid-community/core"),ToolPanelColDefService=class extends import_core.BeanStub{constructor(){super(...arguments),this.beanName="toolPanelColDefService",this.isColGroupDef=e=>e&&typeof e.children<"u",this.getId=e=>this.isColGroupDef(e)?e.groupId:e.colId}wireBeans(e){this.columnModel=e.columnModel}createColumnTree(e){const t=[],o=(i,n)=>{if(this.isColGroupDef(i)){const r=i,a=typeof r.groupId<"u"?r.groupId:r.headerName,l=new import_core.AgProvidedColumnGroup(r,a,!1,n),d=[];return r.children.forEach(c=>{const u=o(c,n+1);u&&d.push(u)}),l.setChildren(d),l}else{const r=i,a=r.colId?r.colId:r.field,l=this.columnModel.getColDefCol(a);return l||t.push(r),l}},s=[];return e.forEach(i=>{const n=o(i,0);n&&s.push(n)}),t.length>0&&(0,import_core._warnOnce)("unable to find grid columns for the supplied colDef(s):",t),s}syncLayoutWithGrid(e){const t=this.getLeafPathTrees(),o=this.mergeLeafPathTrees(t);e(o)}getLeafPathTrees(){const e=(s,i)=>{let n;if((0,import_core.isProvidedColumnGroup)(s))if(s.isPadding())n=i;else{const a=Object.assign({},s.getColGroupDef());a.groupId=s.getGroupId(),a.children=[i],n=a}else{const a=Object.assign({},s.getColDef());a.colId=s.getColId(),n=a}const r=s.getOriginalParent();return r?e(r,n):n};return this.columnModel.getCols().filter(s=>{const i=s.getColDef();return s.isPrimary()&&!i.showRowGroup}).map(s=>e(s,s.getColDef()))}mergeLeafPathTrees(e){const t=(i,n)=>this.isColGroupDef(i)&&this.isColGroupDef(n)&&this.getId(i)===this.getId(n),o=(i,n)=>{if(!this.isColGroupDef(n))return i;const r=i,a=n;return a.children&&a.groupId&&this.addChildrenToGroup(r,a.groupId,a.children[0])||a.children.forEach(l=>o(r,l)),r},s=[];for(let i=1;i<=e.length;i++){const n=e[i-1],r=e[i];t(n,r)?e[i]=o(n,r):s.push(n)}return s}addChildrenToGroup(e,t,o){const s=(r,a)=>{const l=r.children.map(this.getId),d=(0,import_core._includes)(l,this.getId(a)),c=(0,import_core._last)(r.children),u=c&&this.getId(c)!==this.getId(a);return d&&u};if(!this.isColGroupDef(e))return!0;const i=e,n=o;if(s(i,n))return i.children.push(n),!0;if(i.groupId===t){const r=i.children.map(this.getId);if(!(0,import_core._includes)(r,this.getId(n)))return i.children.push(n),!0}return i.children.forEach(r=>this.addChildrenToGroup(r,t,o)),!1}},import_core2=require("@ag-grid-community/core");function isSideBarVisible(e){return e.sideBarService?.getSideBarComp().isDisplayed()??!1}function setSideBarVisible(e,t){e.sideBarService?.getSideBarComp().setDisplayed(t)}function setSideBarPosition(e,t){e.sideBarService?.getSideBarComp().setSideBarPosition(t)}function openToolPanel(e,t){e.sideBarService?.getSideBarComp().openToolPanel(t,"api")}function closeToolPanel(e){e.sideBarService?.getSideBarComp().close("api")}function getOpenedToolPanel(e){return e.sideBarService?.getSideBarComp().openedItem()??null}function refreshToolPanel(e){e.sideBarService?.getSideBarComp().refresh()}function isToolPanelShowing(e){return e.sideBarService?.getSideBarComp().isToolPanelShowing()??!1}function getToolPanelInstance(e,t){const o=e.sideBarService?.getSideBarComp().getToolPanelInstance(t);return(0,import_core2._unwrapUserComp)(o)}function getSideBar(e){return e.sideBarService?.getSideBarComp().getDef()}var import_core9=require("@ag-grid-community/core"),import_core8=require("@ag-grid-community/core"),import_core4=require("@ag-grid-community/core"),import_core3=require("@ag-grid-community/core"),SideBarButtonComp=class extends import_core3.Component{constructor(e){super(),this.eToggleButton=import_core3.RefPlaceholder,this.eIconWrapper=import_core3.RefPlaceholder,this.eLabel=import_core3.RefPlaceholder,this.toolPanelDef=e}getToolPanelId(){return this.toolPanelDef.id}postConstruct(){const e=this.createTemplate();this.setTemplate(e,[]),this.setLabel(),this.setIcon(),this.addManagedElementListeners(this.eToggleButton,{click:this.onButtonPressed.bind(this)}),this.eToggleButton.setAttribute("id",`ag-${this.getCompId()}-button`)}createTemplate(){return`<div class="ag-side-button" role="presentation"> | ||
<button type="button" data-ref="eToggleButton" tabindex="-1" role="tab" aria-expanded="false" class="ag-button ag-side-button-button"> | ||
<div data-ref="eIconWrapper" class="ag-side-button-icon-wrapper" aria-hidden="true"></div> | ||
<span data-ref="eLabel" class="ag-side-button-label"></span> | ||
</button> | ||
</div>`}setLabel(){const e=this.localeService.getLocaleTextFunc(),t=this.toolPanelDef,o=e(t.labelKey,t.labelDefault);this.eLabel.innerText=o}setIcon(){this.eIconWrapper.insertAdjacentElement("afterbegin",import_core2._.createIconNoSpan(this.toolPanelDef.iconKey,this.gos))}onButtonPressed(){this.dispatchEvent({type:g.EVENT_TOGGLE_BUTTON_CLICKED})}setSelected(e){this.addOrRemoveCssClass("ag-selected",e),import_core2._.setAriaExpanded(this.eToggleButton,e)}getButtonElement(){return this.eToggleButton}};_SideBarButtonComp.EVENT_TOGGLE_BUTTON_CLICKED="toggleButtonClicked",__decorateClass([(0,import_core2.RefSelector)("eToggleButton")],_SideBarButtonComp.prototype,"eToggleButton",2),__decorateClass([(0,import_core2.RefSelector)("eIconWrapper")],_SideBarButtonComp.prototype,"eIconWrapper",2),__decorateClass([(0,import_core2.RefSelector)("eLabel")],_SideBarButtonComp.prototype,"eLabel",2),__decorateClass([import_core2.PostConstruct],_SideBarButtonComp.prototype,"postConstruct",1);var SideBarButtonComp=_SideBarButtonComp,_SideBarButtonsComp=class f extends import_core3.Component{constructor(){super(f.TEMPLATE),this.buttonComps=[]}postConstruct(){this.addManagedListener(this.getFocusableElement(),"keydown",this.handleKeyDown.bind(this))}handleKeyDown(e){if(e.key!==import_core3.KeyCode.TAB||!e.shiftKey)return;const t=import_core3._.last(this.columnModel.getAllDisplayedColumns());this.focusService.focusGridView(t,!0)&&e.preventDefault()}setActiveButton(e){this.buttonComps.forEach(t=>{t.setSelected(e===t.getToolPanelId())})}addButtonComp(e){const t=this.createBean(new SideBarButtonComp(e));return this.buttonComps.push(t),this.appendChild(t),t.addEventListener(SideBarButtonComp.EVENT_TOGGLE_BUTTON_CLICKED,()=>{this.dispatchEvent({type:f.EVENT_SIDE_BAR_BUTTON_CLICKED,toolPanelId:e.id})}),t}clearButtons(){this.buttonComps=this.destroyBeans(this.buttonComps),import_core3._.clearElement(this.getGui())}};_SideBarButtonsComp.EVENT_SIDE_BAR_BUTTON_CLICKED="sideBarButtonClicked",_SideBarButtonsComp.TEMPLATE='<div class="ag-side-buttons" role="tablist"></div>',__decorateClass([(0,import_core3.Autowired)("focusService")],_SideBarButtonsComp.prototype,"focusService",2),__decorateClass([(0,import_core3.Autowired)("columnModel")],_SideBarButtonsComp.prototype,"columnModel",2),__decorateClass([import_core3.PostConstruct],_SideBarButtonsComp.prototype,"postConstruct",1),__decorateClass([import_core3.PreDestroy],_SideBarButtonsComp.prototype,"clearButtons",1);var SideBarButtonsComp=_SideBarButtonsComp,_SideBarDefParser=class u{static parse(e){if(!e)return;if(e===!0)return{toolPanels:[u.DEFAULT_COLUMN_COMP,u.DEFAULT_FILTER_COMP],defaultToolPanel:"columns"};if(typeof e=="string")return u.parse([e]);if(Array.isArray(e)){const o=[];return e.forEach(s=>{const n=u.DEFAULT_BY_KEY[s];if(!n){console.warn(`AG Grid: the key ${s} is not a valid key for specifying a tool panel, valid keys are: ${Object.keys(u.DEFAULT_BY_KEY).join(",")}`);return}o.push(n)}),o.length===0?void 0:{toolPanels:o,defaultToolPanel:o[0].id}}return{toolPanels:u.parseComponents(e.toolPanels),defaultToolPanel:e.defaultToolPanel,hiddenByDefault:e.hiddenByDefault,position:e.position}}static parseComponents(e){const t=[];return e&&e.forEach(o=>{let s=null;if(typeof o=="string"){const n=u.DEFAULT_BY_KEY[o];if(!n){console.warn(`AG Grid: the key ${o} is not a valid key for specifying a tool panel, valid keys are: ${Object.keys(u.DEFAULT_BY_KEY).join(",")}`);return}s=n}else s=o;t.push(s)}),t}};_SideBarDefParser.DEFAULT_COLUMN_COMP={id:"columns",labelDefault:"Columns",labelKey:"columns",iconKey:"columns",toolPanel:"agColumnsToolPanel"},_SideBarDefParser.DEFAULT_FILTER_COMP={id:"filters",labelDefault:"Filters",labelKey:"filters",iconKey:"filter",toolPanel:"agFiltersToolPanel"},_SideBarDefParser.DEFAULT_BY_KEY={columns:_SideBarDefParser.DEFAULT_COLUMN_COMP,filters:_SideBarDefParser.DEFAULT_FILTER_COMP};var SideBarDefParser=_SideBarDefParser,import_core4=require("@ag-grid-community/core"),_ToolPanelWrapper=class m extends import_core4.Component{constructor(){super(m.TEMPLATE)}setupResize(){const e=this.getGui(),t=this.resizeBar=this.createManagedBean(new HorizontalResizeComp);e.setAttribute("id",`ag-${this.getCompId()}`),t.setElementToResize(e),this.appendChild(t)}getToolPanelId(){return this.toolPanelId}setToolPanelDef(e,t){const{id:o,minWidth:s,maxWidth:n,width:r}=e;this.toolPanelId=o,this.width=r;const a=this.userComponentFactory.getToolPanelCompDetails(e,t),l=a.newAgStackInstance();if(this.params=a.params,l==null){console.warn(`AG Grid: error processing tool panel component ${o}. You need to specify 'toolPanel'`);return}l.then(this.setToolPanelComponent.bind(this)),s!=null&&this.resizeBar.setMinWidth(s),n!=null&&this.resizeBar.setMaxWidth(n)}setToolPanelComponent(e){this.toolPanelCompInstance=e,this.appendChild(e.getGui()),this.addDestroyFunc(()=>{this.destroyBean(e)}),this.width&&(this.getGui().style.width=`${this.width}px`)}getToolPanelInstance(){return this.toolPanelCompInstance}setResizerSizerSide(e){const t=this.gos.get("enableRtl"),o=e==="left",s=t?o:!o;this.resizeBar.setInverted(s)}refresh(){this.toolPanelCompInstance.refresh(this.params)}};_ToolPanelWrapper.TEMPLATE='<div class="ag-tool-panel-wrapper" role="tabpanel"/>',__decorateClass([(0,import_core4.Autowired)("userComponentFactory")],_ToolPanelWrapper.prototype,"userComponentFactory",2),__decorateClass([import_core4.PostConstruct],_ToolPanelWrapper.prototype,"setupResize",1);var ToolPanelWrapper=_ToolPanelWrapper,_SideBarComp=class P extends import_core5.Component{constructor(){super(P.TEMPLATE),this.toolPanelWrappers=[]}postConstruct(){var e;this.sideBarButtonsComp.addEventListener(SideBarButtonsComp.EVENT_SIDE_BAR_BUTTON_CLICKED,this.onToolPanelButtonClicked.bind(this));const{sideBar:t}=(e=this.gos.get("initialState"))!=null?e:{};this.setSideBarDef({sideBarDef:SideBarDefParser.parse(this.gos.get("sideBar")),sideBarState:t}),this.addManagedPropertyListener("sideBar",this.onSideBarUpdated.bind(this)),this.sideBarService.registerSideBarComp(this),this.createManagedBean(new import_core5.ManagedFocusFeature(this.getFocusableElement(),{onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this)}))}onTabKeyDown(e){if(e.defaultPrevented)return;const{focusService:t,sideBarButtonsComp:o}=this,s=this.getGui(),n=o.getGui(),r=this.gos.getActiveDomElement(),a=s.querySelector(".ag-tool-panel-wrapper:not(.ag-hidden)"),l=e.target;if(!a)return;if(n.contains(r)){t.focusInto(a,e.shiftKey)&&e.preventDefault();return}if(!e.shiftKey)return;let d=null;a.contains(r)?d=this.focusService.findNextFocusableElement(a,void 0,!0):t.isTargetUnderManagedComponent(a,l)&&e.shiftKey&&(d=this.focusService.findFocusableElementBeforeTabGuard(a,l)),d||(d=n.querySelector(".ag-selected button")),d&&d!==e.target&&(e.preventDefault(),d.focus())}handleKeyDown(e){const t=this.gos.getActiveDomElement();if(!this.sideBarButtonsComp.getGui().contains(t))return;const o=this.sideBarButtonsComp.getGui(),s=Array.prototype.slice.call(o.querySelectorAll(".ag-side-button")),n=s.findIndex(l=>l.contains(t));let r=null;switch(e.key){case import_core5.KeyCode.LEFT:case import_core5.KeyCode.UP:r=Math.max(0,n-1);break;case import_core5.KeyCode.RIGHT:case import_core5.KeyCode.DOWN:r=Math.min(n+1,s.length-1);break}if(r===null)return;const a=s[r].querySelector("button");a&&(a.focus(),e.preventDefault())}onToolPanelButtonClicked(e){const t=e.toolPanelId;this.openedItem()===t?this.openToolPanel(void 0,"sideBarButtonClicked"):this.openToolPanel(t,"sideBarButtonClicked")}clearDownUi(){this.sideBarButtonsComp.clearButtons(),this.destroyToolPanelWrappers()}setSideBarDef({sideBarDef:e,sideBarState:t,existingToolPanelWrappers:o}){if(this.setDisplayed(!1),this.sideBar=e,this.sideBar&&this.sideBar.toolPanels){const s=this.sideBar.toolPanels;if(this.createToolPanelsAndSideButtons(s,t,o),!this.toolPanelWrappers.length)return;const n=t?t.visible:!this.sideBar.hiddenByDefault;if(this.setDisplayed(n),this.setSideBarPosition(t?t.position:this.sideBar.position),n)if(t){const{openToolPanel:r}=t;r&&this.openToolPanel(r,"sideBarInitializing")}else this.openToolPanel(this.sideBar.defaultToolPanel,"sideBarInitializing")}}getDef(){return this.sideBar}setSideBarPosition(e){e||(e="right"),this.position=e;const t=e==="left",o=t?"right":"left";return this.addOrRemoveCssClass("ag-side-bar-left",t),this.addOrRemoveCssClass("ag-side-bar-right",!t),this.toolPanelWrappers.forEach(s=>{s.setResizerSizerSide(o)}),this.eventService.dispatchEvent({type:import_core5.Events.EVENT_SIDE_BAR_UPDATED}),this}setDisplayed(e,t){super.setDisplayed(e,t),this.eventService.dispatchEvent({type:import_core5.Events.EVENT_SIDE_BAR_UPDATED})}getState(){const e={};return this.toolPanelWrappers.forEach(t=>{var o,s;e[t.getToolPanelId()]=(s=(o=t.getToolPanelInstance())==null?void 0:o.getState)==null?void 0:s.call(o)}),{visible:this.isDisplayed(),position:this.position,openToolPanel:this.openedItem(),toolPanels:e}}createToolPanelsAndSideButtons(e,t,o){var s;for(const n of e)this.createToolPanelAndSideButton(n,(s=t?.toolPanels)==null?void 0:s[n.id],o?.[n.id])}validateDef(e){if(e.id==null)return console.warn("AG Grid: please review all your toolPanel components, it seems like at least one of them doesn't have an id"),!1;if(e.toolPanel==="agColumnsToolPanel"&&!import_core5.ModuleRegistry.__assertRegistered(import_core5.ModuleNames.ColumnsToolPanelModule,"Column Tool Panel",this.context.getGridId()))return!1;if(e.toolPanel==="agFiltersToolPanel"){if(!import_core5.ModuleRegistry.__assertRegistered(import_core5.ModuleNames.FiltersToolPanelModule,"Filters Tool Panel",this.context.getGridId()))return!1;if(this.filterManager.isAdvancedFilterEnabled())return import_core5._.warnOnce("Advanced Filter does not work with Filters Tool Panel. Filters Tool Panel has been disabled."),!1}return!0}createToolPanelAndSideButton(e,t,o){if(!this.validateDef(e))return;const s=this.sideBarButtonsComp.addButtonComp(e);let n;o?n=o:(n=this.getContext().createBean(new ToolPanelWrapper),n.setToolPanelDef(e,{initialState:t,onStateUpdated:()=>this.eventService.dispatchEvent({type:import_core5.Events.EVENT_SIDE_BAR_UPDATED})})),n.setDisplayed(!1);const r=n.getGui();this.appendChild(r),this.toolPanelWrappers.push(n),import_core5._.setAriaControls(s.getButtonElement(),r)}refresh(){this.toolPanelWrappers.forEach(e=>e.refresh())}openToolPanel(e,t="api"){const o=this.openedItem();if(o===e)return;this.toolPanelWrappers.forEach(r=>{const a=e===r.getToolPanelId();r.setDisplayed(a)});const s=this.openedItem();o!==s&&(this.sideBarButtonsComp.setActiveButton(e),this.raiseToolPanelVisibleEvent(e,o??void 0,t))}getToolPanelInstance(e){const t=this.toolPanelWrappers.filter(o=>o.getToolPanelId()===e)[0];if(!t){console.warn(`AG Grid: unable to lookup Tool Panel as invalid key supplied: ${e}`);return}return t.getToolPanelInstance()}raiseToolPanelVisibleEvent(e,t,o){const s=!!e&&!!t;if(t){const n={type:import_core5.Events.EVENT_TOOL_PANEL_VISIBLE_CHANGED,source:o,key:t,visible:!1,switchingToolPanel:s};this.eventService.dispatchEvent(n)}if(e){const n={type:import_core5.Events.EVENT_TOOL_PANEL_VISIBLE_CHANGED,source:o,key:e,visible:!0,switchingToolPanel:s};this.eventService.dispatchEvent(n)}}close(e="api"){this.openToolPanel(void 0,e)}isToolPanelShowing(){return!!this.openedItem()}openedItem(){let e=null;return this.toolPanelWrappers.forEach(t=>{t.isDisplayed()&&(e=t.getToolPanelId())}),e}onSideBarUpdated(){var e;const t=SideBarDefParser.parse(this.gos.get("sideBar"));let o={};t&&this.sideBar&&((e=t.toolPanels)==null||e.forEach(s=>{var n,r;const{id:a}=s;if(!a)return;const l=(n=this.sideBar.toolPanels)==null?void 0:n.find(h=>h.id===a);if(!l||s.toolPanel!==l.toolPanel)return;const d=this.toolPanelWrappers.find(h=>h.getToolPanelId()===a);if(!d)return;const c=this.gos.addGridCommonParams(__spreadProps(__spreadValues({},(r=s.toolPanelParams)!=null?r:{}),{onStateUpdated:()=>this.eventService.dispatchEvent({type:import_core5.Events.EVENT_SIDE_BAR_UPDATED})}));d.getToolPanelInstance().refresh(c)===!0&&(this.toolPanelWrappers=this.toolPanelWrappers.filter(h=>h!==d),import_core5._.removeFromParent(d.getGui()),o[a]=d)})),this.clearDownUi(),this.setSideBarDef({sideBarDef:t,existingToolPanelWrappers:o})}destroyToolPanelWrappers(){this.toolPanelWrappers.forEach(e=>{import_core5._.removeFromParent(e.getGui()),this.destroyBean(e)}),this.toolPanelWrappers.length=0}destroy(){this.destroyToolPanelWrappers(),super.destroy()}};_SideBarComp.TEMPLATE=`<div class="ag-side-bar ag-unselectable"> | ||
<ag-side-bar-buttons ref="sideBarButtons"></ag-side-bar-buttons> | ||
</div>`,__decorateClass([(0,import_core5.Autowired)("focusService")],_SideBarComp.prototype,"focusService",2),__decorateClass([(0,import_core5.Autowired)("filterManager")],_SideBarComp.prototype,"filterManager",2),__decorateClass([(0,import_core5.Autowired)("sideBarService")],_SideBarComp.prototype,"sideBarService",2),__decorateClass([(0,import_core5.RefSelector)("sideBarButtons")],_SideBarComp.prototype,"sideBarButtonsComp",2),__decorateClass([import_core5.PostConstruct],_SideBarComp.prototype,"postConstruct",1);var SideBarComp=_SideBarComp,import_core6=require("@ag-grid-community/core"),ToolPanelColDefService=class extends import_core6.BeanStub{constructor(){super(...arguments),this.isColGroupDef=i=>i&&typeof i.children<"u",this.getId=i=>this.isColGroupDef(i)?i.groupId:i.colId}createColumnTree(i){const e=[],t=(s,n)=>{if(this.isColGroupDef(s)){const r=s,a=typeof r.groupId<"u"?r.groupId:r.headerName,l=new import_core6.ProvidedColumnGroup(r,a,!1,n),d=[];return r.children.forEach(c=>{const p=t(c,n+1);p&&d.push(p)}),l.setChildren(d),l}else{const r=s,a=r.colId?r.colId:r.field,l=this.columnModel.getPrimaryColumn(a);return l||e.push(r),l}},o=[];return i.forEach(s=>{const n=t(s,0);n&&o.push(n)}),e.length>0&&console.warn("AG Grid: unable to find grid columns for the supplied colDef(s):",e),o}syncLayoutWithGrid(i){const e=this.getLeafPathTrees(),t=this.mergeLeafPathTrees(e);i(t)}getLeafPathTrees(){const i=(o,s)=>{let n;if(o instanceof import_core6.ProvidedColumnGroup)if(o.isPadding())n=s;else{const a=Object.assign({},o.getColGroupDef());a.groupId=o.getGroupId(),a.children=[s],n=a}else{const a=Object.assign({},o.getColDef());a.colId=o.getColId(),n=a}const r=o.getOriginalParent();return r?i(r,n):n};return this.columnModel.getAllGridColumns().filter(o=>{const s=o.getColDef();return o.isPrimary()&&!s.showRowGroup}).map(o=>i(o,o.getColDef()))}mergeLeafPathTrees(i){const e=(s,n)=>this.isColGroupDef(s)&&this.isColGroupDef(n)&&this.getId(s)===this.getId(n),t=(s,n)=>{if(!this.isColGroupDef(n))return s;const r=s,a=n;return a.children&&a.groupId&&this.addChildrenToGroup(r,a.groupId,a.children[0])||a.children.forEach(l=>t(r,l)),r},o=[];for(let s=1;s<=i.length;s++){const n=i[s-1],r=i[s];e(n,r)?i[s]=t(n,r):o.push(n)}return o}addChildrenToGroup(i,e,t){const o=(r,a)=>{const l=r.children.map(this.getId),d=import_core6._.includes(l,this.getId(a)),c=import_core6._.last(r.children),p=c&&this.getId(c)!==this.getId(a);return d&&p};if(!this.isColGroupDef(i))return!0;const s=i,n=t;if(o(s,n))return s.children.push(n),!0;if(s.groupId===e){const r=s.children.map(this.getId);if(!import_core6._.includes(r,this.getId(n)))return s.children.push(n),!0}return s.children.forEach(r=>this.addChildrenToGroup(r,e,t)),!1}};__decorateClass([(0,import_core6.Autowired)("columnModel")],ToolPanelColDefService.prototype,"columnModel",2),ToolPanelColDefService=__decorateClass([(0,import_core6.Bean)("toolPanelColDefService")],ToolPanelColDefService);var VERSION="31.3.2",import_core7=require("@ag-grid-community/core"),SideBarService=class extends import_core7.BeanStub{registerSideBarComp(i){this.sideBarComp=i}getSideBarComp(){return this.sideBarComp}};SideBarService=__decorateClass([(0,import_core7.Bean)("sideBarService")],SideBarService);var SideBarModule={version:VERSION,moduleName:import_core8.ModuleNames.SideBarModule,beans:[ToolPanelColDefService,SideBarService],agStackComponents:[{componentName:"AgHorizontalResize",componentClass:HorizontalResizeComp},{componentName:"AgSideBar",componentClass:SideBarComp},{componentName:"AgSideBarButtons",componentClass:SideBarButtonsComp}],dependantModules:[import_core9.EnterpriseCoreModule]}; | ||
</div>`}setLabel(){const e=this.localeService.getLocaleTextFunc(),t=this.toolPanelDef,o=e(t.labelKey,t.labelDefault);this.eLabel.innerText=o}setIcon(){this.eIconWrapper.insertAdjacentElement("afterbegin",(0,import_core3._createIconNoSpan)(this.toolPanelDef.iconKey,this.gos))}onButtonPressed(){this.dispatchLocalEvent({type:"toggleButtonClicked"})}setSelected(e){this.addOrRemoveCssClass("ag-selected",e),(0,import_core3._setAriaExpanded)(this.eToggleButton,e)}getButtonElement(){return this.eToggleButton}},AgSideBarButtons=class extends import_core4.Component{constructor(){super('<div class="ag-side-buttons" role="tablist"></div>'),this.buttonComps=[]}wireBeans(e){this.focusService=e.focusService,this.visibleColsService=e.visibleColsService}postConstruct(){this.addManagedElementListeners(this.getFocusableElement(),{keydown:this.handleKeyDown.bind(this)})}handleKeyDown(e){if(e.key!==import_core4.KeyCode.TAB||!e.shiftKey)return;const t=(0,import_core4._last)(this.visibleColsService.getAllCols());this.focusService.focusGridView(t,!0)&&e.preventDefault()}setActiveButton(e){this.buttonComps.forEach(t=>{t.setSelected(e===t.getToolPanelId())})}addButtonComp(e){const t=this.createBean(new SideBarButtonComp(e));return this.buttonComps.push(t),this.appendChild(t),t.addEventListener("toggleButtonClicked",()=>{this.dispatchLocalEvent({type:"sideBarButtonClicked",toolPanelId:e.id})}),t}clearButtons(){this.buttonComps=this.destroyBeans(this.buttonComps),(0,import_core4._clearElement)(this.getGui()),super.destroy()}destroy(){this.clearButtons(),super.destroy()}},AgSideBarButtonsSelector={selector:"AG-SIDE-BAR-BUTTONS",component:AgSideBarButtons},import_core5=require("@ag-grid-community/core"),DEFAULT_COLUMN_COMP={id:"columns",labelDefault:"Columns",labelKey:"columns",iconKey:"columns",toolPanel:"agColumnsToolPanel"},DEFAULT_FILTER_COMP={id:"filters",labelDefault:"Filters",labelKey:"filters",iconKey:"filter",toolPanel:"agFiltersToolPanel"},DEFAULT_BY_KEY={columns:DEFAULT_COLUMN_COMP,filters:DEFAULT_FILTER_COMP};function parseSideBarDef(e){if(!e)return;if(e===!0)return{toolPanels:[DEFAULT_COLUMN_COMP,DEFAULT_FILTER_COMP],defaultToolPanel:"columns"};if(typeof e=="string")return parseSideBarDef([e]);if(Array.isArray(e)){const o=[];return e.forEach(s=>{const i=DEFAULT_BY_KEY[s];if(!i){logMissingKey(s);return}o.push(i)}),o.length===0?void 0:{toolPanels:o,defaultToolPanel:o[0].id}}return{toolPanels:parseComponents(e.toolPanels),defaultToolPanel:e.defaultToolPanel,hiddenByDefault:e.hiddenByDefault,position:e.position}}function logMissingKey(e){(0,import_core5._warnOnce)(`the key ${e} is not a valid key for specifying a tool panel, valid keys are: ${Object.keys(DEFAULT_BY_KEY).join(",")}`)}function parseComponents(e){const t=[];return e&&e.forEach(o=>{let s=null;if(typeof o=="string"){const i=DEFAULT_BY_KEY[o];if(!i){logMissingKey(o);return}s=i}else s=o;t.push(s)}),t}var import_core7=require("@ag-grid-community/core"),import_core6=require("@ag-grid-community/core"),AgHorizontalResize=class extends import_core6.Component{constructor(){super('<div class="ag-tool-panel-horizontal-resize"></div>'),this.minWidth=100,this.maxWidth=null}wireBeans(e){this.horizontalResizeService=e.horizontalResizeService}setElementToResize(e){this.elementToResize=e}postConstruct(){const e=this.horizontalResizeService.addResizeBar({eResizeBar:this.getGui(),dragStartPixels:1,onResizeStart:this.onResizeStart.bind(this),onResizing:this.onResizing.bind(this),onResizeEnd:this.onResizeEnd.bind(this)});this.addDestroyFunc(e),this.setInverted(this.gos.get("enableRtl"))}dispatchResizeEvent(e,t,o){const s={type:"toolPanelSizeChanged",width:o,started:e,ended:t};this.eventService.dispatchEvent(s)}onResizeStart(){this.startingWidth=this.elementToResize.offsetWidth,this.dispatchResizeEvent(!0,!1,this.startingWidth)}onResizeEnd(e){return this.onResizing(e,!0)}onResizing(e,t=!1){const o=this.inverted?-1:1;let s=Math.max(this.minWidth,Math.floor(this.startingWidth-e*o));this.maxWidth!=null&&(s=Math.min(this.maxWidth,s)),this.elementToResize.style.width=`${s}px`,this.dispatchResizeEvent(!1,t,s)}setInverted(e){this.inverted=e}setMaxWidth(e){this.maxWidth=e}setMinWidth(e){e!=null?this.minWidth=e:this.minWidth=100}},ToolPanelWrapper=class extends import_core7.Component{wireBeans(e){this.userComponentFactory=e.userComponentFactory}constructor(){super('<div class="ag-tool-panel-wrapper" role="tabpanel"/>')}postConstruct(){const e=this.getGui(),t=this.resizeBar=this.createManagedBean(new AgHorizontalResize);e.setAttribute("id",`ag-${this.getCompId()}`),t.setElementToResize(e),this.appendChild(t)}getToolPanelId(){return this.toolPanelId}setToolPanelDef(e,t){const{id:o,minWidth:s,maxWidth:i,width:n}=e;this.toolPanelId=o,this.width=n;const r=this.userComponentFactory.getToolPanelCompDetails(e,t),a=r.newAgStackInstance();if(this.params=r.params,a==null){(0,import_core7._warnOnce)(`error processing tool panel component ${o}. You need to specify 'toolPanel'`);return}a.then(this.setToolPanelComponent.bind(this)),s!=null&&this.resizeBar.setMinWidth(s),i!=null&&this.resizeBar.setMaxWidth(i)}setToolPanelComponent(e){this.toolPanelCompInstance=e,this.appendChild(e.getGui()),this.addDestroyFunc(()=>{this.destroyBean(e)}),this.width&&(this.getGui().style.width=`${this.width}px`)}getToolPanelInstance(){return this.toolPanelCompInstance}setResizerSizerSide(e){const t=this.gos.get("enableRtl"),o=e==="left",s=t?o:!o;this.resizeBar.setInverted(s)}refresh(){this.toolPanelCompInstance?.refresh(this.params)}},AgSideBar=class extends import_core8.Component{constructor(){super(`<div class="ag-side-bar ag-unselectable"> | ||
<ag-side-bar-buttons data-ref="sideBarButtons"></ag-side-bar-buttons> | ||
</div>`,[AgSideBarButtonsSelector]),this.sideBarButtons=import_core8.RefPlaceholder,this.toolPanelWrappers=[]}wireBeans(e){this.focusService=e.focusService,this.filterManager=e.filterManager,this.sideBarService=e.sideBarService}postConstruct(){this.sideBarButtons.addEventListener("sideBarButtonClicked",this.onToolPanelButtonClicked.bind(this));const{sideBar:e}=this.gos.get("initialState")??{};this.setSideBarDef({sideBarDef:parseSideBarDef(this.gos.get("sideBar")),sideBarState:e}),this.addManagedPropertyListener("sideBar",this.onSideBarUpdated.bind(this)),this.sideBarService.registerSideBarComp(this);const t=this.getFocusableElement();this.createManagedBean(new import_core8.ManagedFocusFeature(t,{onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this)})),(0,import_core8._addFocusableContainerListener)(this,t,this.focusService)}onTabKeyDown(e){if(e.defaultPrevented)return;const{focusService:t,sideBarButtons:o}=this,s=this.getGui(),i=o.getGui(),n=this.gos.getActiveDomElement(),r=s.querySelector(".ag-tool-panel-wrapper:not(.ag-hidden)"),a=e.target;if(!r)return;if(i.contains(n)){t.focusInto(r,e.shiftKey)&&e.preventDefault();return}if(!e.shiftKey)return;let l=null;r.contains(n)?l=this.focusService.findNextFocusableElement(r,void 0,!0):t.isTargetUnderManagedComponent(r,a)&&e.shiftKey&&(l=this.focusService.findFocusableElementBeforeTabGuard(r,a)),l||(l=i.querySelector(".ag-selected button")),l&&l!==e.target&&(e.preventDefault(),l.focus())}handleKeyDown(e){const t=this.gos.getActiveDomElement();if(!this.sideBarButtons.getGui().contains(t))return;const o=this.sideBarButtons.getGui(),s=Array.prototype.slice.call(o.querySelectorAll(".ag-side-button")),i=s.findIndex(a=>a.contains(t));let n=null;switch(e.key){case import_core8.KeyCode.LEFT:case import_core8.KeyCode.UP:n=Math.max(0,i-1);break;case import_core8.KeyCode.RIGHT:case import_core8.KeyCode.DOWN:n=Math.min(i+1,s.length-1);break}if(n===null)return;const r=s[n].querySelector("button");r&&(r.focus(),e.preventDefault())}onToolPanelButtonClicked(e){const t=e.toolPanelId;this.openedItem()===t?this.openToolPanel(void 0,"sideBarButtonClicked"):this.openToolPanel(t,"sideBarButtonClicked")}clearDownUi(){this.sideBarButtons.clearButtons(),this.destroyToolPanelWrappers()}setSideBarDef({sideBarDef:e,sideBarState:t,existingToolPanelWrappers:o}){if(this.setDisplayed(!1),this.sideBar=e,this.sideBar&&this.sideBar.toolPanels){const s=this.sideBar.toolPanels;if(this.createToolPanelsAndSideButtons(s,t,o),!this.toolPanelWrappers.length)return;const i=t?t.visible:!this.sideBar.hiddenByDefault;if(this.setDisplayed(i),this.setSideBarPosition(t?t.position:this.sideBar.position),i)if(t){const{openToolPanel:n}=t;n&&this.openToolPanel(n,"sideBarInitializing")}else this.openToolPanel(this.sideBar.defaultToolPanel,"sideBarInitializing")}}getDef(){return this.sideBar}setSideBarPosition(e){e||(e="right"),this.position=e;const t=e==="left",o=t?"right":"left";return this.addOrRemoveCssClass("ag-side-bar-left",t),this.addOrRemoveCssClass("ag-side-bar-right",!t),this.toolPanelWrappers.forEach(s=>{s.setResizerSizerSide(o)}),this.eventService.dispatchEvent({type:"sideBarUpdated"}),this}setDisplayed(e,t){super.setDisplayed(e,t),this.eventService.dispatchEvent({type:"sideBarUpdated"})}getState(){const e={};return this.toolPanelWrappers.forEach(t=>{e[t.getToolPanelId()]=t.getToolPanelInstance()?.getState?.()}),{visible:this.isDisplayed(),position:this.position,openToolPanel:this.openedItem(),toolPanels:e}}createToolPanelsAndSideButtons(e,t,o){for(const s of e)this.createToolPanelAndSideButton(s,t?.toolPanels?.[s.id],o?.[s.id])}validateDef(e){if(e.id==null)return(0,import_core8._warnOnce)("please review all your toolPanel components, it seems like at least one of them doesn't have an id"),!1;if(e.toolPanel==="agColumnsToolPanel"&&!import_core8.ModuleRegistry.__assertRegistered(import_core8.ModuleNames.ColumnsToolPanelModule,"Column Tool Panel",this.gridId))return!1;if(e.toolPanel==="agFiltersToolPanel"){if(!import_core8.ModuleRegistry.__assertRegistered(import_core8.ModuleNames.FiltersToolPanelModule,"Filters Tool Panel",this.gridId))return!1;if(this.filterManager?.isAdvancedFilterEnabled())return(0,import_core8._warnOnce)("Advanced Filter does not work with Filters Tool Panel. Filters Tool Panel has been disabled."),!1}return!0}createToolPanelAndSideButton(e,t,o){if(!this.validateDef(e))return;const s=this.sideBarButtons.addButtonComp(e);let i;o?i=o:(i=this.createBean(new ToolPanelWrapper),i.setToolPanelDef(e,{initialState:t,onStateUpdated:()=>this.eventService.dispatchEvent({type:"sideBarUpdated"})})),i.setDisplayed(!1);const n=i.getGui();this.appendChild(n),this.toolPanelWrappers.push(i),(0,import_core8._setAriaControls)(s.getButtonElement(),n)}refresh(){this.toolPanelWrappers.forEach(e=>e.refresh())}openToolPanel(e,t="api"){const o=this.openedItem();if(o===e)return;this.toolPanelWrappers.forEach(n=>{const r=e===n.getToolPanelId();n.setDisplayed(r)});const s=this.openedItem();o!==s&&(this.sideBarButtons.setActiveButton(e),this.raiseToolPanelVisibleEvent(e,o??void 0,t))}getToolPanelInstance(e){const t=this.toolPanelWrappers.filter(o=>o.getToolPanelId()===e)[0];if(!t){(0,import_core8._warnOnce)(`unable to lookup Tool Panel as invalid key supplied: ${e}`);return}return t.getToolPanelInstance()}raiseToolPanelVisibleEvent(e,t,o){const s=!!e&&!!t;if(t){const i={type:"toolPanelVisibleChanged",source:o,key:t,visible:!1,switchingToolPanel:s};this.eventService.dispatchEvent(i)}if(e){const i={type:"toolPanelVisibleChanged",source:o,key:e,visible:!0,switchingToolPanel:s};this.eventService.dispatchEvent(i)}}close(e="api"){this.openToolPanel(void 0,e)}isToolPanelShowing(){return!!this.openedItem()}openedItem(){let e=null;return this.toolPanelWrappers.forEach(t=>{t.isDisplayed()&&(e=t.getToolPanelId())}),e}onSideBarUpdated(){const e=parseSideBarDef(this.gos.get("sideBar")),t={};e&&this.sideBar&&e.toolPanels?.forEach(o=>{const{id:s}=o;if(!s)return;const i=this.sideBar.toolPanels?.find(l=>l.id===s);if(!i||o.toolPanel!==i.toolPanel)return;const n=this.toolPanelWrappers.find(l=>l.getToolPanelId()===s);if(!n)return;const r=this.gos.addGridCommonParams({...o.toolPanelParams??{},onStateUpdated:()=>this.eventService.dispatchEvent({type:"sideBarUpdated"})});n.getToolPanelInstance()?.refresh(r)===!0&&(this.toolPanelWrappers=this.toolPanelWrappers.filter(l=>l!==n),(0,import_core8._removeFromParent)(n.getGui()),t[s]=n)}),this.clearDownUi(),this.setSideBarDef({sideBarDef:e,existingToolPanelWrappers:t})}destroyToolPanelWrappers(){this.toolPanelWrappers.forEach(e=>{(0,import_core8._removeFromParent)(e.getGui()),this.destroyBean(e)}),this.toolPanelWrappers.length=0}destroy(){this.destroyToolPanelWrappers(),super.destroy()}},AgSideBarSelector={selector:"AG-SIDE-BAR",component:AgSideBar},SideBarService=class extends import_core9.BeanStub{constructor(){super(...arguments),this.beanName="sideBarService"}registerSideBarComp(e){this.sideBarComp=e}getSideBarComp(){return this.sideBarComp}getSideBarSelector(){return AgSideBarSelector}},VERSION="32.0.0",SideBarCoreModule={version:VERSION,moduleName:`${import_core10.ModuleNames.SideBarModule}-core`,beans:[ToolPanelColDefService,SideBarService],dependantModules:[import_core11.EnterpriseCoreModule]},SideBarApiModule={version:VERSION,moduleName:`${import_core10.ModuleNames.SideBarModule}-api`,apiFunctions:{isSideBarVisible,setSideBarVisible,setSideBarPosition,openToolPanel,closeToolPanel,getOpenedToolPanel,refreshToolPanel,isToolPanelShowing,getToolPanelInstance,getSideBar},dependantModules:[SideBarCoreModule]},SideBarModule={version:VERSION,moduleName:import_core10.ModuleNames.SideBarModule,dependantModules:[SideBarCoreModule,SideBarApiModule]}; |
{ | ||
"name": "@ag-grid-enterprise/side-bar", | ||
"version": "31.3.2", | ||
"version": "32.0.0", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
@@ -14,5 +14,6 @@ "main": "./dist/package/main.cjs.js", | ||
}, | ||
"sideEffects": false, | ||
"dependencies": { | ||
"@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,0 +20,0 @@ "devDependencies": { |
{ | ||
"name": "@ag-grid-enterprise/side-bar", | ||
"version": "31.3.2", | ||
"version": "32.0.0", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
@@ -14,5 +14,6 @@ "main": "./src/main.js", | ||
}, | ||
"sideEffects": false, | ||
"dependencies": { | ||
"@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,0 +20,0 @@ "devDependencies": { |
@@ -1,2 +0,2 @@ | ||
export { SideBarModule } from "./sideBarModule"; | ||
export { ToolPanelColDefService } from "./sideBar/common/toolPanelColDefService"; | ||
export { SideBarModule } from './sideBarModule'; | ||
export { ToolPanelColDefService } from './sideBar/common/toolPanelColDefService'; |
@@ -1,5 +0,8 @@ | ||
import { AbstractColDef, BeanStub, IProvidedColumn } from "@ag-grid-community/core"; | ||
export declare class ToolPanelColDefService extends BeanStub { | ||
import type { AbstractColDef, AgColumn, BeanCollection, NamedBean } from '@ag-grid-community/core'; | ||
import { AgProvidedColumnGroup, BeanStub } from '@ag-grid-community/core'; | ||
export declare class ToolPanelColDefService extends BeanStub implements NamedBean { | ||
beanName: "toolPanelColDefService"; | ||
private columnModel; | ||
createColumnTree(colDefs: AbstractColDef[]): IProvidedColumn[]; | ||
wireBeans(beans: BeanCollection): void; | ||
createColumnTree(colDefs: AbstractColDef[]): (AgColumn | AgProvidedColumnGroup)[]; | ||
syncLayoutWithGrid(syncLayoutCallback: (colDefs: AbstractColDef[]) => void): void; | ||
@@ -6,0 +9,0 @@ private getLeafPathTrees; |
@@ -1,4 +0,5 @@ | ||
import { Component, ToolPanelDef } from "@ag-grid-community/core"; | ||
export declare class SideBarButtonComp extends Component { | ||
static EVENT_TOGGLE_BUTTON_CLICKED: string; | ||
import type { ToolPanelDef } from '@ag-grid-community/core'; | ||
import { Component } from '@ag-grid-community/core'; | ||
export type SideBarButtonCompEvent = 'toggleButtonClicked'; | ||
export declare class SideBarButtonComp extends Component<SideBarButtonCompEvent> { | ||
private readonly eToggleButton; | ||
@@ -10,3 +11,3 @@ private readonly eIconWrapper; | ||
getToolPanelId(): string; | ||
private postConstruct; | ||
postConstruct(): void; | ||
private createTemplate; | ||
@@ -13,0 +14,0 @@ private setLabel; |
@@ -1,10 +0,2 @@ | ||
import { SideBarDef, ToolPanelDef } from "@ag-grid-community/core"; | ||
export declare class SideBarDefParser { | ||
static readonly DEFAULT_COLUMN_COMP: ToolPanelDef; | ||
static readonly DEFAULT_FILTER_COMP: ToolPanelDef; | ||
static readonly DEFAULT_BY_KEY: { | ||
[p: string]: ToolPanelDef; | ||
}; | ||
static parse(toParse: SideBarDef | string | string[] | boolean | null | undefined): SideBarDef | undefined; | ||
static parseComponents(from?: (ToolPanelDef | string)[]): ToolPanelDef[]; | ||
} | ||
import type { SideBarDef } from '@ag-grid-community/core'; | ||
export declare function parseSideBarDef(toParse: SideBarDef | string | string[] | boolean | null | undefined): SideBarDef | undefined; |
@@ -1,6 +0,9 @@ | ||
import { BeanStub, ISideBar, ISideBarService } from "@ag-grid-community/core"; | ||
export declare class SideBarService extends BeanStub implements ISideBarService { | ||
import type { ComponentSelector, ISideBar, ISideBarService, NamedBean } from '@ag-grid-community/core'; | ||
import { BeanStub } from '@ag-grid-community/core'; | ||
export declare class SideBarService extends BeanStub implements NamedBean, ISideBarService { | ||
beanName: "sideBarService"; | ||
private sideBarComp; | ||
registerSideBarComp(sideBarComp: ISideBar): void; | ||
getSideBarComp(): ISideBar; | ||
getSideBarSelector(): ComponentSelector; | ||
} |
@@ -1,5 +0,6 @@ | ||
import { Component, IToolPanelComp, IToolPanelParams, ToolPanelDef, WithoutGridCommon } from "@ag-grid-community/core"; | ||
import type { BeanCollection, IToolPanelComp, IToolPanelParams, ToolPanelDef, WithoutGridCommon } from '@ag-grid-community/core'; | ||
import { Component } from '@ag-grid-community/core'; | ||
export declare class ToolPanelWrapper extends Component { | ||
private userComponentFactory; | ||
private static TEMPLATE; | ||
wireBeans(beans: BeanCollection): void; | ||
private toolPanelCompInstance; | ||
@@ -11,9 +12,9 @@ private toolPanelId; | ||
constructor(); | ||
private setupResize; | ||
postConstruct(): void; | ||
getToolPanelId(): string; | ||
setToolPanelDef(toolPanelDef: ToolPanelDef, params: WithoutGridCommon<IToolPanelParams>): void; | ||
private setToolPanelComponent; | ||
getToolPanelInstance(): IToolPanelComp; | ||
getToolPanelInstance(): IToolPanelComp | undefined; | ||
setResizerSizerSide(side: 'right' | 'left'): void; | ||
refresh(): void; | ||
} |
@@ -1,2 +0,4 @@ | ||
import { Module } from "@ag-grid-community/core"; | ||
import type { Module } from '@ag-grid-community/core'; | ||
export declare const SideBarCoreModule: Module; | ||
export declare const SideBarApiModule: Module; | ||
export declare const SideBarModule: Module; |
@@ -1,1 +0,1 @@ | ||
export declare const VERSION = "31.3.2"; | ||
export declare const VERSION = "32.0.0"; |
const gulp = require('gulp'); | ||
const {series} = gulp; | ||
const { series } = gulp; | ||
const replace = require('gulp-replace'); | ||
const rename = require('gulp-rename'); | ||
const del = require("del"); | ||
const del = require('del'); | ||
@@ -12,10 +12,12 @@ const DIST_FOLDER = 'dist/esm/es6/'; | ||
.src(['dist/esm/es6/**/*.js', '!dist/esm/es6/**/*.map']) | ||
.pipe(replace(/(import|export)(.*['"]\..*)(['"].*)/gi, (line) => { | ||
const regexp = /(import|export)(.*['"]\..*)(['"].*)/gi; | ||
const matches = [...line.matchAll(regexp)][0]; | ||
return `${matches[1]}${matches[2]}.mjs${matches[3]}` | ||
})) | ||
.pipe( | ||
replace(/(import|export)(.*['"]\..*)(['"].*)/gi, (line) => { | ||
const regexp = /(import|export)(.*['"]\..*)(['"].*)/gi; | ||
const matches = [...line.matchAll(regexp)][0]; | ||
return `${matches[1]}${matches[2]}.mjs${matches[3]}`; | ||
}) | ||
) | ||
.pipe(rename({ extname: '.mjs' })) | ||
.pipe(gulp.dest(DIST_FOLDER)); | ||
} | ||
}; | ||
@@ -25,3 +27,1 @@ const cleanup = () => del([`${DIST_FOLDER}/**/*.js`]); | ||
gulp.task('mjs-processing', series(mjsProcessing, cleanup)); | ||
{ | ||
"name": "@ag-grid-enterprise/side-bar", | ||
"version": "31.3.2", | ||
"version": "32.0.0", | ||
"description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", | ||
@@ -14,5 +14,6 @@ "main": "./dist/package/main.cjs.js", | ||
}, | ||
"sideEffects": false, | ||
"dependencies": { | ||
"@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,0 +20,0 @@ "devDependencies": { |
@@ -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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
243342
25
2222
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)