@progress/kendo-ui
Version:
This package is part of the [Kendo UI for jQuery](http://www.telerik.com/kendo-ui) suite.
1,490 lines (1,484 loc) • 658 kB
JavaScript
import { t as useLoaderContainer } from "./loaderContainer-B6Y3qV5F.js";
//#region ../src/grid/contextmenu.js
(function($, undefined) {
var kendo = window.kendo, ui = kendo.ui, ContextMenu = ui.ContextMenu, extend = $.extend, encode = kendo.htmlEncode;
var ACTION = "action";
var GridContextMenu = ContextMenu.extend({
init: function(element, options) {
var that = this;
ContextMenu.fn.init.call(that, element, options);
that._overrideTemplates();
that._extendItems();
that.bind("select", that._onSelect.bind(that));
that.bind("open", that._onOpen.bind(that));
},
_overrideTemplates: function() {
this.templates.sprite = ({ icon, spriteCssClass }) => `${icon || spriteCssClass ? kendo.ui.icon({
icon: encode(icon || ""),
iconClass: encode(spriteCssClass || "")
}) : ""}`;
},
defaultItems: {
"separator": {
name: "separator",
separator: true
},
"create": {
name: "create",
text: "Add",
icon: "plus",
command: "AddCommand",
rules: "isEditable"
},
"edit": {
name: "edit",
text: "Edit",
icon: "pencil",
command: "EditCommand",
rules: "isEditable"
},
"destroy": {
name: "destroy",
text: "Delete",
icon: "trash",
command: "DeleteCommand",
rules: "isEditable"
},
"select": {
name: "select",
text: "Select",
icon: "table-body",
rules: "isSelectable",
items: [
{
name: "selectRow",
text: "Row",
icon: "table-row-groups",
command: "SelectRowCommand"
},
{
name: "selectAllRows",
text: "All rows",
icon: "grid",
command: "SelectAllRowsCommand"
},
{
name: "clearSelection",
text: "Clear selection",
icon: "table-unmerge",
softRules: "hasSelection",
command: "ClearSelectionCommand"
}
]
},
"copySelection": {
name: "copySelection",
text: "Copy selection",
icon: "page-header-section",
rules: "isSelectable",
softRules: "hasSelection",
command: "CopySelectionCommand",
options: "withHeaders"
},
"copySelectionNoHeaders": {
name: "copySelectionNoHeaders",
text: "Copy selection (No Headers)",
icon: "file-txt",
rules: "isSelectable",
softRules: "hasSelection",
command: "CopySelectionCommand"
},
"paste": {
name: "paste",
text: "Paste (use CTRL/⌘ + V)",
rules: "allowPaste",
softRules: "alwaysDisabled",
icon: "clipboard"
},
"reorderRow": {
name: "reorderRow",
text: "Reorder row",
icon: "caret-alt-expand",
rules: "isRowReorderable",
softRules: "isSorted",
items: [
{
name: "reorderRowUp",
text: "Up",
icon: "chevron-up",
command: "ReorderRowCommand",
options: "dir:up"
},
{
name: "reorderRowDown",
text: "Down",
icon: "chevron-down",
command: "ReorderRowCommand",
options: "dir:down"
},
{
name: "reorderRowTop",
text: "Top",
icon: "caret-alt-to-top",
command: "ReorderRowCommand",
options: "dir:top"
},
{
name: "reorderRowBottom",
text: "Bottom",
icon: "caret-alt-to-bottom",
command: "ReorderRowCommand",
options: "dir:bottom"
}
]
},
"exportPDF": {
name: "exportPDF",
text: "Export to PDF",
icon: "file-pdf",
command: "ExportPDFCommand"
},
"exportExcel": {
name: "exportExcel",
text: "Export to Excel",
icon: "file-excel",
items: [
{
name: "exportToExcelAll",
text: "All",
command: "ExportExcelCommand"
},
{
name: "exportToExcelSelection",
text: "Selection",
command: "ExportExcelCommand",
softRules: "hasSelection",
options: "selection,withHeaders"
},
{
name: "exportToExcelSelectionNoHeaders",
text: "Selection (No Headers)",
softRules: "hasSelection",
command: "ExportExcelCommand",
options: "selection"
}
]
},
"exportCSV": {
name: "exportCSV",
text: "Export to CSV",
icon: "file-csv",
items: [
{
name: "exportToCSVAll",
text: "All",
command: "ExportCSVCommand"
},
{
name: "exportToCSVSelection",
text: "Selection",
command: "ExportCSVCommand",
softRules: "hasSelection",
options: "selection,withHeaders"
},
{
name: "exportToCSVSelectionNoHeaders",
text: "Selection (No Headers)",
softRules: "hasSelection",
command: "ExportCSVCommand",
options: "selection"
}
]
},
"sortAsc": {
name: "sortAsc",
text: "Sort Ascending",
icon: "sort-asc-small",
rules: "isSortable",
command: "SortCommand",
options: "dir:asc"
},
"sortDesc": {
name: "sortDesc",
text: "Sort Descending",
icon: "sort-desc-small",
rules: "isSortable",
command: "SortCommand",
options: "dir:desc"
},
"moveGroupPrevious": {
name: "moveGroupPrevious",
text: "Move previous",
icon: "arrow-left",
rules: "isGroupable",
softRules: "canMoveGroupPrev",
command: "MoveGroupCommand",
options: "dir:prev"
},
"moveGroupNext": {
name: "moveGroupNext",
text: "Move next",
icon: "arrow-right",
rules: "isGroupable",
softRules: "canMoveGroupNext",
command: "MoveGroupCommand",
options: "dir:next"
},
"pinRow": {
name: "pinRow",
text: "Pin row",
icon: "pin",
rules: "isPinnable",
items: [
{
name: "pinTop",
text: "Pin row to top",
icon: "pin-top",
command: "PinTopCommand"
},
{
name: "pinBottom",
text: "Pin row to bottom",
icon: "pin-bottom",
command: "PinBottomCommand"
},
{
name: "unpin",
text: "Unpin row",
icon: "unpin",
command: "UnpinCommand"
}
]
}
},
events: ContextMenu.fn.events.concat([ACTION]),
_onSelect: function(ev) {
var command = $(ev.item).data("command");
var options = $(ev.item).data("options");
options = options ? options.split(",").map((val) => {
if (val.indexOf(":") > -1) {
var [key, val] = val.split(":");
return { [key || "_"]: val };
}
return { [val]: true };
}).reduce((acc, v) => Object.assign(acc, v), {}) : {};
var target = $(ev.target);
if (!command) {
return;
}
this.action({
command,
options: Object.assign(options, { target })
});
},
_onOpen: function(ev) {
var menu = ev.sender, items = menu.options.items, elTarget = $(ev.event ? ev.event.target : null);
if (!items && $.isEmptyObject(this.defaultItems) || elTarget.closest(".k-grid-column-menu").length) {
ev.preventDefault();
return;
}
this._toggleSeparatorVisibility();
menu.element.find(`[${kendo.attr("soft-rules")}]`).each((i, item) => {
var rules = $(item).attr(kendo.attr("soft-rules")).split(";");
menu.enable(item, this._validateSoftRules(rules, elTarget));
});
},
_toggleSeparatorVisibility: function() {
var that = this, items = that.element.find(".k-item.k-separator").filter((i, item) => {
var prev = $(item).prev(".k-item:not(.k-separator)");
var next = $(item).next(".k-item:not(.k-separator)");
return !(prev.length && next.length);
});
items.hide();
},
_extendItems: function() {
var that = this, items = that.options.items, item, isBuiltInTool;
if (items && items.length) {
for (var i = 0; i < items.length; i++) {
item = items[i];
isBuiltInTool = $.isPlainObject(item) && Object.keys(item).length === 1 && item.name;
if (isBuiltInTool) {
item = item.name;
}
if ($.isPlainObject(item)) {
that._append(item);
} else if (that.defaultItems[item]) {
item = that.defaultItems[item];
that._append(item);
} else if (typeof item === "string") {
item = {
name: item,
text: item,
spriteCssClass: item,
command: item + "Command"
};
that._append(item);
}
}
} else {
for (var key in that.defaultItems) {
item = that.defaultItems[key];
that._append(item);
}
}
},
_extendItem: function(item) {
var that = this, messages = that.options.messages, attr = item.attr || {};
if (item.command) {
attr[kendo.attr("command")] = item.command;
}
if (item.options) {
attr[kendo.attr("options")] = item.options;
}
if (item.softRules) {
attr[kendo.attr("soft-rules")] = item.softRules;
}
if (item.items) {
for (var j = 0; j < item.items.length; j++) {
item.items.forEach((subItem) => {
that._extendItem(subItem);
});
}
}
extend(item, {
text: messages.commands[item.name],
icon: item.icon || "",
spriteCssClass: item.spriteCssClass || "",
attr,
uid: kendo.guid()
});
},
_validateSoftRules: function(rules, target) {
var that = this;
if (!rules || !(rules && rules.length)) {
return true;
}
for (var i = 0; i < rules.length; i++) {
if (!this._readState(rules[i], target)) {
return false;
}
}
return true;
},
_validateRules: function(tool) {
var that = this, rules = tool.rules ? tool.rules.split(";") : [];
if (!rules.length) {
return true;
}
for (var i = 0; i < rules.length; i++) {
if (!this._readState(rules[i])) {
return false;
}
}
return true;
},
_readState: function(state, target) {
var that = this, states = that.options.states;
if (kendo.isFunction(states[state])) {
return states[state](target);
} else {
return states[state];
}
},
_append: function(item) {
var that = this;
that._extendItem(item);
if (that._validateRules(item)) {
that.append(item);
}
},
action: function(args) {
this.trigger(ACTION, args);
}
});
kendo.ui.grid = kendo.ui.grid || {};
extend(kendo.ui.grid, { ContextMenu: GridContextMenu });
})(window.kendo.jQuery);
//#endregion
//#region ../src/grid/commands.js
(function($, undefined) {
const kendo = window.kendo, extend = $.extend, Class = kendo.Class;
const Command = Class.extend({ init: function(options) {
this.options = options;
this.grid = options.grid;
} });
const MoveGroupCommand = Command.extend({ exec: function() {
const that = this, grid = that.grid, groupable = grid.groupable, options = that.options, target = options.target.closest(".k-chip"), method = options.dir === "next" ? "after" : "before", position = options.dir === "next" ? target.next() : target.prev();
position[method](target);
groupable._change();
} });
const SortCommand = Command.extend({ exec: function() {
const that = this, grid = that.grid, dataSource = grid.dataSource, options = that.options, dir = options.dir, field = grid._getCellField(options.target), multipleMode = grid.options.sortable.mode && grid.options.sortable.mode === "multiple", compare = grid.options.compare;
let length, idx, sort = dataSource.sort() || [];
if (multipleMode) {
for (idx = 0, length = sort.length; idx < length; idx++) {
if (sort[idx].field === field) {
sort.splice(idx, 1);
break;
}
}
sort.push({
field,
dir,
compare
});
} else {
sort = [{
field,
dir,
compare
}];
}
dataSource.sort(sort);
} });
const AddCommand = Command.extend({ exec: function() {
const that = this, grid = that.grid;
grid.addRow();
} });
const EditCommand = Command.extend({ exec: function() {
const that = this, grid = that.grid, inCellMode = grid._editMode() === "incell", target = inCellMode ? that.options.target : that.options.target.closest("tr");
if (inCellMode) {
grid.editCell(target);
} else {
grid.editRow(target);
}
} });
const DeleteCommand = Command.extend({ exec: function() {
const that = this, grid = that.grid, target = that.options.target.closest("tr");
grid.removeRow(target);
} });
const CopySelectionCommand = Command.extend({ exec: function() {
const that = this, grid = that.grid, withHeaders = that.options.withHeaders;
grid.copySelectionToClipboard(withHeaders);
} });
const SelectRowCommand = Command.extend({ exec: function() {
const that = this, grid = that.grid, selectMode = kendo.ui.Selectable.parseOptions(grid.options.selectable), target = that.options.target.closest("tr");
grid.select(selectMode.cell ? target.find("td") : target);
} });
const SelectAllRowsCommand = Command.extend({ exec: function() {
const that = this, grid = that.grid, selectMode = kendo.ui.Selectable.parseOptions(grid.options.selectable), rows = grid.items();
grid.select(selectMode.cell ? rows.find("td") : rows);
} });
const ClearSelectionCommand = Command.extend({ exec: function() {
const that = this, grid = that.grid;
grid.clearSelection();
} });
const ReorderRowCommand = Command.extend({ exec: function() {
const that = this, grid = that.grid, dir = that.options.dir, target = that.options.target.closest("tr"), index = target.index();
let newIndex;
switch (dir) {
case "up":
newIndex = index - 1;
break;
case "down":
newIndex = index + 2;
break;
case "top":
newIndex = 0;
break;
case "bottom":
newIndex = grid.items().length;
break;
}
grid.reorderRowTo(target, newIndex);
} });
const ExportPDFCommand = Command.extend({ exec: function() {
const that = this, grid = that.grid;
grid.saveAsPDF();
} });
const ExportExcelCommand = Command.extend({ exec: function() {
const that = this, selection = that.options.selection, withHeaders = that.options.withHeaders, grid = that.grid;
if (selection) {
grid.exportSelectedToExcel(withHeaders);
} else {
grid.saveAsExcel();
}
} });
const ExportCSVCommand = Command.extend({ exec: function() {
const selection = this.options.selection;
const withHeaders = this.options.withHeaders;
const grid = this.grid;
if (selection) {
grid.exportSelectedToCSV(withHeaders);
} else {
grid.saveAsCSV();
}
} });
const PinTopCommand = Command.extend({ exec: function() {
const grid = this.grid;
const target = this.options.target.closest("tr");
grid.pinRows(target, "top");
} });
const PinBottomCommand = Command.extend({ exec: function() {
const grid = this.grid;
const target = this.options.target.closest("tr");
grid.pinRows(target, "bottom");
} });
const UnpinCommand = Command.extend({ exec: function() {
const grid = this.grid;
const target = this.options.target.closest("tr");
grid.unpinRows(target);
} });
kendo.ui.grid = kendo.ui.grid || {};
extend(kendo.ui.grid, {
GridCommand: Command,
commands: {
SortCommand,
AddCommand,
EditCommand,
DeleteCommand,
CopySelectionCommand,
SelectRowCommand,
SelectAllRowsCommand,
ClearSelectionCommand,
ReorderRowCommand,
ExportPDFCommand,
ExportExcelCommand,
ExportCSVCommand,
MoveGroupCommand,
PinTopCommand,
PinBottomCommand,
UnpinCommand
}
});
})(window.kendo.jQuery);
//#endregion
//#region ../src/grid/sticky-groups.js
const GROUPING_ROW = "k-grouping-row", GROUPCELLCLASS = "k-group-cell";
function closeRange(entry, footerIndex, lastChildIndex) {
return {
headerIndex: entry.headerIndex,
footerIndex,
firstChildIndex: entry.headerIndex + 1,
lastChildIndex,
level: entry.level,
collapsed: entry.collapsed
};
}
function buildGroupRangeMap(tbody, skipOffset, lockedTbody) {
skipOffset = skipOffset || 0;
const ranges = [];
const stack = [];
const rows = tbody.children;
const lockedRows = lockedTbody ? lockedTbody.children : null;
const rowCount = rows.length;
for (let i = 0; i < rowCount; i++) {
const row = rows[i];
const isGroupHeader = row.classList.contains(GROUPING_ROW);
const isGroupFooter = row.classList.contains("k-group-footer");
const globalIndex = skipOffset + i;
if (isGroupHeader) {
const levelRow = lockedRows ? lockedRows[i] : row;
const level = levelRow.querySelectorAll("." + GROUPCELLCLASS).length;
const collapsed = !!levelRow.querySelector("td[aria-expanded='false']");
for (let s = stack.length - 1; s >= 0; s--) {
if (stack[s].level >= level) {
ranges.push(closeRange(stack[s], null, globalIndex - 1));
stack.splice(s, 1);
}
}
stack.push({
headerIndex: globalIndex,
level,
collapsed
});
} else if (isGroupFooter) {
if (stack.length > 0) {
const closedHeader = stack.pop();
ranges.push(closeRange(closedHeader, globalIndex, globalIndex - 1));
}
}
}
for (let r = 0; r < stack.length; r++) {
ranges.push(closeRange(stack[r], null, skipOffset + rowCount - 1));
}
const map = {};
for (let m = 0; m < ranges.length; m++) {
map[ranges[m].headerIndex] = ranges[m];
}
return map;
}
function computeStickyHeaderItems(groupRanges, firstVisibleIndex, rawFirstVisibleIndex, allHeaderIndices) {
const stickyHeaders = [];
const footerThreshold = rawFirstVisibleIndex !== undefined ? rawFirstVisibleIndex : firstVisibleIndex;
const bestHeaderPerLevel = new Map();
for (const range of Object.values(groupRanges)) {
if (range.collapsed) {
continue;
}
if (range.headerIndex < firstVisibleIndex) {
let groupEnd;
if (range.footerIndex !== null && allHeaderIndices) {
groupEnd = range.footerIndex;
for (let h = 0; h < allHeaderIndices.length; h++) {
if (allHeaderIndices[h] > range.footerIndex) {
groupEnd = allHeaderIndices[h] - 1;
break;
}
}
} else {
groupEnd = range.footerIndex !== null ? range.footerIndex : range.lastChildIndex;
}
if (groupEnd > range.headerIndex && groupEnd >= footerThreshold) {
const existing = bestHeaderPerLevel.get(range.level);
if (!existing || range.headerIndex > existing.headerIndex) {
bestHeaderPerLevel.set(range.level, range);
}
}
}
}
const levels = Array.from(bestHeaderPerLevel.keys()).sort((a, b) => a - b);
for (const lvl of levels) {
stickyHeaders.push(bestHeaderPerLevel.get(lvl));
}
return stickyHeaders;
}
function computeStickyFooterItems(groupRanges, lastVisibleIndex) {
const stickyFooters = [];
const bestFooterPerLevel = new Map();
for (const range of Object.values(groupRanges)) {
if (range.footerIndex === null || range.collapsed) {
continue;
}
if (range.footerIndex > lastVisibleIndex && range.headerIndex <= lastVisibleIndex) {
const existing = bestFooterPerLevel.get(range.level);
if (!existing || range.footerIndex < existing.footerIndex) {
bestFooterPerLevel.set(range.level, range);
}
}
}
const levels = Array.from(bestFooterPerLevel.keys()).sort((a, b) => b - a);
for (const lvl of levels) {
stickyFooters.push(bestFooterPerLevel.get(lvl));
}
return stickyFooters;
}
function getStickyRows(containerEl) {
const wrap = containerEl.querySelector(".k-grid-header-wrap, .k-grid-footer-wrap");
const tbody = wrap ? wrap.querySelector("table > tbody") : containerEl.querySelector(":scope > table > tbody");
return {
rows: tbody ? tbody.children : [],
heightTarget: containerEl
};
}
function clearRowTransforms(tr) {
tr.style.transform = "";
tr.style.clipPath = "";
tr.style.display = "";
}
function applyHeaderPushTransforms(containerEl, pushOffsets) {
const { rows: trs, heightTarget } = getStickyRows(containerEl);
let totalVisibleHeight = 0;
let hasPush = false;
for (let i = 0; i < trs.length && i < pushOffsets.length; i++) {
const tr = trs[i];
const rowH = tr.getBoundingClientRect().height || tr.offsetHeight;
const push = pushOffsets[i];
if (push < 0) {
hasPush = true;
const absPush = -push;
const visibleHeight = Math.max(rowH - absPush, 0);
totalVisibleHeight += visibleHeight;
if (visibleHeight <= 0) {
tr.style.display = "none";
tr.style.transform = "";
tr.style.clipPath = "";
} else {
tr.style.display = "";
tr.style.transform = `translateY(${push}px)`;
tr.style.clipPath = `inset(${absPush}px 0 0 0)`;
}
} else {
totalVisibleHeight += rowH;
clearRowTransforms(tr);
}
}
if (hasPush) {
const cs = getComputedStyle(heightTarget);
const border = (parseFloat(cs.borderTopWidth) || 0) + (parseFloat(cs.borderBottomWidth) || 0);
heightTarget.style.height = `${Math.max(totalVisibleHeight - border, 0)}px`;
} else {
heightTarget.style.height = "";
}
}
function applyFooterPushTransforms(containerEl, pushOffsets) {
const { rows: trs, heightTarget } = getStickyRows(containerEl);
let totalVisibleHeight = 0;
let hasPush = false;
let totalShrink = 0;
const rowHeights = [];
for (let i = 0; i < trs.length && i < pushOffsets.length; i++) {
const rowH = trs[i].getBoundingClientRect().height || trs[i].offsetHeight;
rowHeights.push(rowH);
const push = pushOffsets[i];
if (push > 0) {
hasPush = true;
const visibleH = Math.max(rowH - push, 0);
totalVisibleHeight += visibleH;
totalShrink += rowH - visibleH;
} else {
totalVisibleHeight += rowH;
}
}
for (let j = 0; j < trs.length && j < pushOffsets.length; j++) {
const tr = trs[j];
const pushVal = pushOffsets[j];
const rH = rowHeights[j];
if (pushVal > 0) {
const visible = Math.max(rH - pushVal, 0);
if (visible <= 0) {
tr.style.clipPath = "inset(0 0 100% 0)";
} else {
tr.style.clipPath = `inset(0 0 ${pushVal}px 0)`;
}
tr.style.transform = "";
} else if (hasPush) {
tr.style.transform = `translateY(${-totalShrink}px)`;
tr.style.clipPath = "";
} else {
clearRowTransforms(tr);
}
}
if (hasPush) {
const cs = getComputedStyle(heightTarget);
const border = (parseFloat(cs.borderTopWidth) || 0) + (parseFloat(cs.borderBottomWidth) || 0);
heightTarget.style.height = `${Math.max(totalVisibleHeight - border, 0)}px`;
} else {
heightTarget.style.height = "";
}
}
function resetStickyTransforms(containerEl) {
const { rows: trs, heightTarget } = getStickyRows(containerEl);
for (let i = 0; i < trs.length; i++) {
clearRowTransforms(trs[i]);
}
heightTarget.style.height = "";
}
function stickyItemsChanged(current, prev) {
if (current.length !== prev.length) {
return true;
}
for (let i = 0; i < current.length; i++) {
if (current[i].headerIndex !== prev[i].headerIndex) {
return true;
}
}
return false;
}
function findStickyChildRow(tbody, range, skipOffset, reverse) {
const start = reverse ? range.lastChildIndex : range.firstChildIndex;
const end = reverse ? range.firstChildIndex : range.lastChildIndex;
const step = reverse ? -1 : 1;
for (let i = start; reverse ? i >= end : i <= end; i += step) {
const row = tbody.children[i - skipOffset];
if (row) {
return row;
}
}
return null;
}
function stickyParentPadding(stickyRows, items, range) {
let padding = 0;
for (let i = 0; i < items.length; i++) {
if (items[i].level < range.level) {
padding += stickyRows[i] ? stickyRows[i].offsetHeight || 36 : 36;
}
}
return padding;
}
function buildStickyRowMetrics(tbody, skipOffset) {
const rows = tbody.children;
const rowCount = rows.length;
const rowTops = new Array(rowCount);
const rowHeightsArr = new Array(rowCount);
let lastVisibleBottom = 0;
for (let i = 0; i < rowCount; i++) {
const h = rows[i].offsetHeight;
if (h > 0) {
rowTops[i] = rows[i].offsetTop;
lastVisibleBottom = rowTops[i] + h;
} else {
rowTops[i] = lastVisibleBottom;
}
rowHeightsArr[i] = h;
}
const totalRowCount = skipOffset + rowCount;
const getRowHeight = (index) => {
const local = index - skipOffset;
return local >= 0 && local < rowCount ? rowHeightsArr[local] : 36;
};
const getRowOffset = (index) => {
const local = index - skipOffset;
if (local >= 0 && local < rowCount) {
return rowTops[local];
}
if (rowCount === 0) {
return undefined;
}
if (local < 0) {
return rowTops[0] + local * 36;
}
return rowTops[rowCount - 1] + rowHeightsArr[rowCount - 1] + (local - rowCount) * 36;
};
const findFirstVisible = (effectiveTop) => {
let lo = 0, hi = rowCount;
while (lo < hi) {
const mid = lo + hi >> 1;
if (rowTops[mid] + rowHeightsArr[mid] <= effectiveTop) {
lo = mid + 1;
} else {
hi = mid;
}
}
return lo < rowCount ? skipOffset + lo : skipOffset;
};
const findFirstAtTop = (effectiveTop) => {
let lo = 0, hi = rowCount;
while (lo < hi) {
const mid = lo + hi >> 1;
if (rowTops[mid] < effectiveTop) {
lo = mid + 1;
} else {
hi = mid;
}
}
return lo < rowCount ? skipOffset + lo : skipOffset;
};
const findLastVisible = (effectiveBottom) => {
let lo = 0, hi = rowCount - 1;
while (lo <= hi) {
const mid = lo + hi >> 1;
if (rowTops[mid] + rowHeightsArr[mid] <= effectiveBottom) {
lo = mid + 1;
} else {
hi = mid - 1;
}
}
return hi >= 0 ? skipOffset + hi : skipOffset + rowCount - 1;
};
return {
getRowHeight,
getRowOffset,
findFirstVisible,
findFirstAtTop,
findLastVisible,
totalRowCount
};
}
function convergeStickyHeaders(metrics, groupRanges, scrollTop) {
const { getRowHeight, getRowOffset, findFirstVisible, findFirstAtTop, totalRowCount } = metrics;
const rawFirstVisibleIndex = Math.min(findFirstVisible(scrollTop), totalRowCount - 1);
let stickyHeaderHeight = 0;
let headerPushOffsets = [];
let stickyHeaders = [];
const allHeaderIndices = Object.keys(groupRanges).map(Number).sort((a, b) => a - b);
const computeHeaderPush = (ranges) => {
const offsets = [];
let cumHeight = 0;
for (let ci = 0; ci < ranges.length; ci++) {
const range = ranges[ci];
const rowH = getRowHeight(range.headerIndex);
let push = 0;
let boundaryIndex;
if (range.footerIndex !== null) {
boundaryIndex = range.footerIndex + 1;
for (let h = 0; h < allHeaderIndices.length; h++) {
if (allHeaderIndices[h] > range.footerIndex) {
boundaryIndex = allHeaderIndices[h];
break;
}
}
} else {
boundaryIndex = range.lastChildIndex + 1;
}
const boundaryOffset = getRowOffset(boundaryIndex);
if (boundaryOffset !== undefined) {
const slotBottom = cumHeight + rowH;
const boundaryRelative = boundaryOffset - scrollTop;
if (boundaryRelative < slotBottom) {
push = boundaryRelative - slotBottom;
}
}
offsets.push(push);
cumHeight += Math.max(rowH + push, 0);
}
return {
totalHeight: cumHeight,
offsets
};
};
const seenFirstVisible = new Set();
while (true) {
const firstVisibleIndex = Math.min(findFirstAtTop(scrollTop + Math.max(stickyHeaderHeight, 0)), totalRowCount - 1);
const isHeaderCycle = seenFirstVisible.has(firstVisibleIndex);
seenFirstVisible.add(firstVisibleIndex);
const result = computeStickyHeaderItems(groupRanges, firstVisibleIndex, rawFirstVisibleIndex, allHeaderIndices);
const headerPush = computeHeaderPush(result);
const headerConverged = !stickyItemsChanged(result, stickyHeaders) && Math.abs(headerPush.totalHeight - stickyHeaderHeight) < 1;
stickyHeaders = result;
stickyHeaderHeight = headerPush.totalHeight;
headerPushOffsets = headerPush.offsets;
if (headerConverged || isHeaderCycle) {
break;
}
}
return {
items: stickyHeaders,
pushOffsets: headerPushOffsets
};
}
function convergeStickyFooters(metrics, groupRanges, scrollTop, viewportHeight) {
const { getRowHeight, getRowOffset, findLastVisible, totalRowCount } = metrics;
let stickyFooterHeight = 0;
let footerPushOffsets = [];
let stickyFooters = [];
const computeFooterPush = (ranges) => {
const offsets = [];
let cumHeight = 0;
for (let ci = ranges.length - 1; ci >= 0; ci--) {
const range = ranges[ci];
const rowH = getRowHeight(range.footerIndex);
let push = 0;
const boundaryOffset = getRowOffset(range.headerIndex);
if (boundaryOffset !== undefined) {
const boundaryBottom = boundaryOffset + getRowHeight(range.headerIndex);
const slotTop = scrollTop + viewportHeight - cumHeight - rowH;
if (boundaryBottom > slotTop) {
push = boundaryBottom - slotTop;
}
}
offsets[ci] = push;
cumHeight += Math.max(rowH - push, 0);
}
return {
totalHeight: cumHeight,
offsets
};
};
const seenLastVisible = new Set();
while (true) {
const effectiveLastVisible = Math.min(findLastVisible(scrollTop + viewportHeight - stickyFooterHeight), totalRowCount - 1);
const isFooterCycle = seenLastVisible.has(effectiveLastVisible);
seenLastVisible.add(effectiveLastVisible);
const footerResult = computeStickyFooterItems(groupRanges, effectiveLastVisible);
const footerPush = computeFooterPush(footerResult);
const footerConverged = !stickyItemsChanged(footerResult, stickyFooters) && Math.abs(footerPush.totalHeight - stickyFooterHeight) < 1;
stickyFooters = footerResult;
stickyFooterHeight = footerPush.totalHeight;
footerPushOffsets = footerPush.offsets;
if (footerConverged || isFooterCycle) {
break;
}
}
return {
items: stickyFooters,
pushOffsets: footerPushOffsets
};
}
function syncColgroup(targetTable, sourceTable) {
if (!targetTable) {
return;
}
const existing = targetTable.querySelector(":scope > colgroup");
const source = sourceTable.querySelector(":scope > colgroup");
if (source) {
const sourceCols = source.children;
if (existing && existing.children.length === sourceCols.length) {
const targetCols = existing.children;
for (let i = 0; i < sourceCols.length; i++) {
const w = sourceCols[i].style.width;
if (w) {
if (targetCols[i].style.width !== w) {
targetCols[i].style.width = w;
}
} else if (targetCols[i].style.width) {
targetCols[i].style.width = "";
}
}
} else {
if (existing) {
existing.remove();
}
targetTable.prepend(source.cloneNode(true));
}
} else if (existing) {
existing.remove();
}
targetTable.style.width = sourceTable.style.width || sourceTable.getBoundingClientRect().width + "px";
}
function renderStickyRowsHtml(sourceRows, items, indexProp, skipOffset) {
let html = "";
for (let i = 0; i < items.length; i++) {
const row = sourceRows[items[i][indexProp] - skipOffset];
if (row) {
html += `<tr class='${row.className}'>${row.innerHTML}</tr>`;
}
}
return html;
}
const STICKY_CONTAINER_CLASS = "k-grid-sticky-container";
function createStickyTable(tableClass, sizeClass) {
const table = document.createElement("table");
table.className = tableClass + " k-grid-table k-table" + (sizeClass ? " " + sizeClass : "");
const tbody = document.createElement("tbody");
tbody.className = "k-table-tbody";
table.appendChild(tbody);
return table;
}
function createStickyGroupContainer(tableClass, sizeClass, extraClasses) {
const div = document.createElement("div");
div.className = STICKY_CONTAINER_CLASS + (extraClasses ? " " + extraClasses : "");
div.setAttribute("aria-hidden", "true");
const table = createStickyTable(tableClass, sizeClass);
div.appendChild(table);
return {
container: div,
table
};
}
function createStickyGroupLockedContainer(tableClass, sizeClass) {
const div = document.createElement("div");
div.className = "k-grid-content-locked";
const table = createStickyTable(tableClass, sizeClass);
div.appendChild(table);
return {
container: div,
table
};
}
//#endregion
//#region ../src/grid/pinned-rows.js
const PINNED_CONTAINER_CLASS = "k-grid-pinned-container";
const PINNED_WRAP_CLASS = "k-grid-pinned-wrap";
const PINNED_SOURCE_CLASS = "k-pinned-source";
const kendo$1 = window.kendo;
const $ = kendo$1.jQuery;
function createPinnedContainer(position, sizeClass) {
const isBottom = position === "bottom";
const container = document.createElement("div");
container.className = PINNED_CONTAINER_CLASS + (isBottom ? " k-pos-bottom" : "");
const wrap = document.createElement("div");
wrap.className = PINNED_WRAP_CLASS;
const table = document.createElement("table");
table.className = "k-grid-table k-table" + (sizeClass ? " " + sizeClass : "");
table.setAttribute("aria-label", isBottom ? "Pinned bottom rows" : "Pinned top rows");
const tbody = document.createElement("tbody");
tbody.className = "k-table-tbody";
table.appendChild(tbody);
wrap.appendChild(table);
container.appendChild(wrap);
return {
container,
wrap,
table,
tbody
};
}
function syncPinnedColgroups(sourceTable, topTable, bottomTable) {
if (!sourceTable) {
return;
}
const syncColgroupOnly = (target, src) => {
const existing = target.querySelector(":scope > colgroup");
if (existing) {
existing.remove();
}
const srcColgroup = src.querySelector(":scope > colgroup");
if (srcColgroup) {
target.prepend(srcColgroup.cloneNode(true));
}
};
if (topTable) {
syncColgroupOnly(topTable, sourceTable);
}
if (bottomTable) {
syncColgroupOnly(bottomTable, sourceTable);
}
}
function syncPinnedScroll(source, content, topWrap, bottomWrap) {
const scrollLeft = source.scrollLeft;
if (content && content !== source && content.scrollLeft !== scrollLeft) {
content.scrollLeft = scrollLeft;
}
if (topWrap && topWrap !== source && topWrap.scrollLeft !== scrollLeft) {
topWrap.scrollLeft = scrollLeft;
}
if (bottomWrap && bottomWrap !== source && bottomWrap.scrollLeft !== scrollLeft) {
bottomWrap.scrollLeft = scrollLeft;
}
}
function getRowPinPosition(dataItem, topRows, bottomRows, idField) {
if (!idField || !dataItem) {
return "none";
}
const key = dataItem[idField];
if (topRows.some((r) => r[idField] === key)) {
return "top";
}
if (bottomRows.some((r) => r[idField] === key)) {
return "bottom";
}
return "none";
}
function resolveInitialPinnedRows(pinnable, idField, dataSourceGet) {
if (!pinnable || typeof pinnable !== "object" || !pinnable.top && !pinnable.bottom) {
return null;
}
if (!idField) {
return null;
}
const resolve = (ids) => {
if (!Array.isArray(ids)) {
return [];
}
return ids.map((id) => dataSourceGet(id)).filter((item) => !!item);
};
return {
top: resolve(pinnable.top),
bottom: resolve(pinnable.bottom)
};
}
function markPinnedSourceRows(tbody, topRows, bottomRows, idField) {
if (!tbody) {
return;
}
const $tbody = $(tbody);
$tbody.find("tr." + PINNED_SOURCE_CLASS).removeClass(PINNED_SOURCE_CLASS);
if (!idField) {
return;
}
const allPinned = [...topRows, ...bottomRows];
allPinned.forEach((pinnedItem) => {
const uid = pinnedItem.uid;
if (uid) {
$tbody.find(`tr[data-uid="${uid}"]`).addClass(PINNED_SOURCE_CLASS);
}
});
}
function togglePinMenuItems(menuElement, position, pinRowLocation, messages) {
const $menu = $(menuElement);
const pinTop = $menu.find("[data-command=PinTopCommand]").closest(".k-menu-item");
const pinBottom = $menu.find("[data-command=PinBottomCommand]").closest(".k-menu-item");
const unpin = $menu.find("[data-command=UnpinCommand]").closest(".k-menu-item");
if (pinRowLocation && pinRowLocation !== "both") {
const parentItem = pinTop.closest(".k-menu-group").closest(".k-menu-item");
pinTop.hide();
pinBottom.hide();
unpin.hide();
if (parentItem.length) {
parentItem.children(".k-menu-group, .k-animation-container").hide();
parentItem.find("> .k-link .k-menu-expand-arrow, > .k-link > .k-menu-expand-arrow-icon").hide();
const linkText = parentItem.find("> .k-link .k-menu-link-text");
if (position !== "none") {
parentItem.show();
parentItem.attr(kendo$1.attr("command"), "UnpinCommand");
parentItem.data("command", "UnpinCommand");
if (linkText.length && messages) {
linkText.text(messages.unpin);
}
} else {
parentItem.show();
const cmd = pinRowLocation === "top" ? "PinTopCommand" : "PinBottomCommand";
parentItem.attr(kendo$1.attr("command"), cmd);
parentItem.data("command", cmd);
if (linkText.length && messages) {
linkText.text(messages.pinRow);
}
}
}
} else {
pinTop.toggle(position !== "top");
pinBottom.toggle(position !== "bottom");
unpin.toggle(position !== "none");
}
}
function destroyPinnedContainer(wrapEl, containerEl) {
if (wrapEl) {
$(wrapEl).off("scroll");
}
if (containerEl) {
$(containerEl).remove();
}
}
function refreshPinnedReferences(topRows, bottomRows, dataSourceData, idField) {
if (!idField) {
return {
top: topRows,
bottom: bottomRows
};
}
const findById = (id) => {
for (let i = 0; i < dataSourceData.length; i++) {
if (dataSourceData[i][idField] == id) {
return dataSourceData[i];
}
}
return null;
};
const refresh = (items) => items.map((item) => {
const fresh = findById(item[idField]);
return fresh || null;
}).filter((item) => item !== null);
return {
top: refresh(topRows),
bottom: refresh(bottomRows)
};
}
function syncPinnedTableWidths(sourceTable, topTable, bottomTable) {
if (!sourceTable) {
return;
}
const width = sourceTable.style.width;
if (width) {
if (topTable) {
topTable.style.width = width;
}
if (bottomTable) {
bottomTable.style.width = width;
}
}
}
function syncPinnedLockedWidths(lockedWidth, contentWidth, topLocked, bottomLocked, topContent, bottomContent) {
if (topLocked) {
topLocked.style.width = lockedWidth;
}
if (bottomLocked) {
bottomLocked.style.width = lockedWidth;
}
if (topContent) {
topContent.style.width = contentWidth;
}
if (bottomContent) {
bottomContent.style.width = contentWidth;
}
}
function createPinnedLockedContent(sizeClass) {
const container = document.createElement("div");
container.className = "k-grid-content-locked";
const table = document.createElement("table");
table.className = "k-grid-table k-table" + (sizeClass ? " " + sizeClass : "");
const colgroup = document.createElement("colgroup");
const tbody = document.createElement("tbody");
tbody.className = "k-table-tbody";
table.appendChild(colgroup);
table.appendChild(tbody);
container.appendChild(table);
return {
container,
table,
tbody
};
}
function flattenRowSpans(html) {
if (html.indexOf("rowspan") === -1 && html.indexOf("rowSpan") === -1 && html.indexOf("hidden") === -1) {
return html;
}
const temp = document.createElement("table");
const tempBody = document.createElement("tbody");
temp.appendChild(tempBody);
tempBody.innerHTML = html;
const rows = tempBody.querySelectorAll("tr");
const rowCount = rows.length;
for (let r = 0; r < rowCount; r++) {
const cells = rows[r].querySelectorAll("td");
for (let c = 0; c < cells.length; c++) {
const cell = cells[c];
if (cell.hasAttribute("rowspan")) {
cell.removeAttribute("rowspan");
}
if (cell.hasAttribute("hidden")) {
cell.removeAttribute("hidden");
cell.style.display = "";
}
}
}
return tempBody.innerHTML;
}
function applyPinnedAria(containers, getByUid, idField) {
containers.forEach((p) => {
if (!p || !p.tbody) {
return;
}
p.tbody.attr("role", "rowgroup");
p.tbody.children("tr").each((_, el) => {
const row = $(el);
row.attr("role", "row");
const uid = row.data("uid");
if (uid) {
const model = getByUid(uid);
if (model && idField) {
row.attr("aria-label", "Pinned row");
}
}
row.children("td").attr("role", "gridcell");
});
if (p.lockedTbody) {
p.lockedTbody.attr("role", "rowgroup");
p.lockedTbody.children("tr").each((_, el) => {
const row = $(el);
row.attr("role", "row");
row.children("td").attr("role", "gridcell");
});
}
});
}
//#endregion
//#region ../src/kendo.grid.js
const __meta__ = {
id: "grid",
name: "Grid",
category: "web",
description: "The Grid widget displays tabular data and offers rich support for interacting with data,including paging, sorting, grouping, and selection.",
depends: [
"data",
"columnsorter",
"sortable",
"toolbar",
"html.button",
"icons",
"menu",
"loader",
"html.loadercontainer",
"badge",
"aiprompt",
"smartbox"
],
features: [
{
id: "grid-editing",
name: "Editing",
description: "Support for record editing",
depends: [
"editable",
"window",
"textbox",
"form"
]
},
{
id: "grid-filtering",
name: "Filtering",
description: "Support for record filtering",
depends: ["filtermenu"]
},
{
id: "grid-columnmenu",
name: "Column menu",
description: "Support for header column menu",
depends: ["columnmenu"]
},
{
id: "grid-grouping",
name: "Grouping",
description: "Support for grid grouping",
depends: ["groupable"]
},
{
id: "grid-filtercell",
name: "Row filter",
description: "Support for grid header filtering",
depends: ["filtercell"]
},
{
id: "grid-paging",
name: "Paging",
description: "Support for grid paging",
depends: ["pager"]
},
{
id: "grid-selection",
name: "Selection",
description: "Support for row selection",
depends: ["selectable"]
},
{
id: "grid-column-reorder",
name: "Column reordering",
description: "Support for column reordering",
depends: ["reorderable"]
},
{
id: "grid-column-resize",
name: "Column resizing",
description: "Support for column resizing",
depends: ["resizable"]
},
{
id: "grid-mobile",
name: "Grid adaptive rendering",
description: "Support for adaptive rendering",
depends: [
"dialog",
"pane",
"switch"
]
},
{
id: "grid-excel-export",
name: "Excel export",
description: "Export grid data as Excel spreadsheet",
depends: ["excel"]
},
{
id: "grid-pdf-export",
name: "PDF export",
description: "Export grid data as PDF",
depends: ["pdf", "drawing"]
},
{
id: "grid-csv-export",
name: "CSV export",
description: "Export grid data as CSV",
depends: ["csv"]
}
]
};
(function($, undefined) {
let kendo = window.kendo, ui = kendo.ui, DataSource = kendo.data.DataSource, ObservableObject = kendo.data.ObservableObject, tbodySupportsInnerHtml = kendo.support.tbodyInnerHtml, activeElement = kendo._activeElement, Widget = ui.Widget, outerWidth = kendo._outerWidth, outerHeight = kendo._outerHeight, keys = kendo.keys, getType = kendo.type, isPlainObject = $.isPlainObject, extend = $.extend, map = $.map, grep = $.grep, isArray = Array.isArray, inArray = $.inArray, push = Array.prototype.push, isFunction = kendo.isFunction, encode = kendo.htmlEncode, isEmptyObject = $.isEmptyObject, contains = $.contains, math = Math, DOT = ".", PROGRESS = "progress", ERROR = "error", HIERARCHY_CELL_CLASS = "k-hierarchy-cell", DATA_CELL = ":not(.k-group-cell):not([" + kendo.attr("virtual") + "]):not(.k-hierarchy-cell:not(:has(.k-icon.k-i-chevron-down,.k-icon.k-i-chevron-right,.k-svg-icon.k-svg-i-chevron-down,.k-svg-icon.k-svg-i-chevron-right,.k-svg-icon.k-svg-i-chevron-left,.k-icon.k-i-chevron-left))):visible", DATA_CELL_HIDDENINCLUDED = ":not([" + kendo.attr("virtual") + "]):not(.k-hierarchy-cell:not(:has(.k-icon.k-i-chevron-down,.k-icon.k-i-chevron-right,.k-svg-icon.k-svg-i-chevron-down,.k-svg-icon.k-svg-i-chevron-right,.k-svg-icon.k-svg-i-chevron-left,.k-icon.k-i-chevron-left)))", SELECTION_CELL_SELECTOR = "tbody>tr:not(.k-grouping-row):not(.k-detail-row):not(.k-group-footer):not([data-skeleton-row]) > td:not(.k-group-cell):not(.k-hierarchy-cell)", STACKED_CELL_SELECTOR = "tbody>tr:not(.k-grouping-row):not(.k-detail-row):not(.k-group-footer):not([data-skeleton-row]) > td:not(.k-group-cell):not(.k-hierarchy-cell) div.k-grid-stack-cell", NAVROW = "tr:not(.k-footer-template):visible", NAVCELL = ":not(.k-group-cell):not(.k-detail-cell):not(.k-hierarchy-cell):visible", ITEMROW = "tr:not(.k-grouping-row):not(.k-detail-row):not(.k-footer-template):not(.k-group-footer):visible", COLGROUP = "col:not(.k-group-col, .k-hierarchy-col)", HEADERCELLS = "th.k-header:not(.k-group-cell):not(.k-hierarchy-cell)", CARET_ALT_DOWN = "a[class*='-i-chevron-down']", CARET_ALT_RIGHT = "a[class*='-i-chevron-right']", CARET_ALT_RIGHT_CACHE = CARET_ALT_RIGHT, CARET_ALT_LEFT = "a[class*='-i-chevron-left']", WRAPPER = ".k-grid", STACKED = "k-grid-stack", NS = ".kendoGrid", CONTENTRLOCKEDCONTAINER = "k-grid-content-locked", GROUPCELLCLASS = "k-group-cell", INPUT_SELECTORS = ":button,a,:input,a>.k-icon,a>.k-svg-icon,textarea,span.k-select,span.k-icon,span.k-svg-icon,span.k-svg-icon>svg,span.k-svg-icon>svg>path,span.k-link,label.k-checkbox-label,.k-input,.k-multiselect-wrap,.k-picker-wrap,.k-picker-wrap>.k-selected-color,.k-tool-icon,.k-dropdownlist,.k-switch-thumb,.k-switch-track,.k-switch-label-off,.k-switch-label-on", EDIT = "edit", BEFOREEDIT = "beforeEdit", SAVE = "save", REMOVE = "remove", DETAILINIT = "detailInit", FILTERMENUINIT = "filterMenuInit", COLUMNMENUINIT = "columnMenuInit", FILTERMENUOPEN = "filterMenuOpen", COLUMNMENUOPEN = "columnMenuOpen", CELLCLOSE = "cellClose", CHANGING = "changing", CHANGE = "change", COLUMNHIDE = "columnHide", COLUMNSHOW = "columnShow", SAVECHANGES = "saveChanges", DATABOUND = "dataBound", DETAILEXPAND = "detailExpand", DETAILCOLLAPSE = "detailCollapse", ITEM_CHANGE = "itemchange", PAGE = "page", PAGING = "paging", PASTE = "paste", SCROLL = "scroll", SYNC = "sync", LOAD_START = "loadStart", LOAD_END = "loadEnd", REQUESTEND = "requestEnd", FOCUSED = "k-focus", HIGHLIGHTED = "k-highlighted", HOVER = "k-hover", ACTIVE = "k-active", FOCUSABLE = ":kendoFocusable", FOCUSABLE_GRID_ELEMENT_SELECTORS = ".k-command-cell,.k-select-checkbox,.k-grid-stack-cell[tabindex]", SELECTED = "k-selected", CHECKBOX = "k-checkbox", CHECKBOXINPUT = "input[data-role='checkbox'].k-select-checkbox." + CHECKBOX, NORECORDSCLASS = "k-grid-norecords", LINK_CLASS = "k-link", ICON_CLASS = "k-icon", SVG_ICON_CLASS = "k-svg-icon", ORDER_CLASS = "k-sort-order", SORTED_CLASS = "k-sorted", HEADER_CLASS = "k-header", HEADER_COLUMN_MENU_CLASS = "k-grid-column-menu", FILTER_MENU_CLASS = "k-grid-filter-menu", STICKY_CELL_CLASS = "k-grid-content-sticky", STICKY_HEADER_CLASS = "k-grid-header-sticky", STICKY_FOOTER_CLASS = "k-grid-footer-sticky", STICKY_HEADER_NO_BORDER_CLASS = "k-grid-no-left-border", STICKY_GROUP_HEADER_TABLE_CLASS = "k-grid-group-sticky-header-table", STICKY_GROUP_FOOTER_TABLE_CLASS = "k-grid-group-sticky-footer-table", STACKED_TEMPLATE_WRAPPER_CLASS = "k-grid-column-template", PINCELLCLASS = "k-pin-cell", ROW_RESIZER = "k-row-resizer", ROW_RESIZER_WRAP = "k-resizer-wrap", GROUPING_ROW = "k-grouping-row", RESIZE = "resize", ROWRESIZE = "rowResize", COLUMNRESIZE = "columnResize", COLUMNREORDER = "columnReorder", COLUMNLOCK = "columnLock", COLUMNUNLOCK = "columnUnlock", COLUMNSTICK = "columnStick", COLUMNUNSTICK = "columnUnstick", ROWREORDER = "rowReorder", ROWPIN = "rowPin", ROWUNPIN = "rowUnpin", NAVIGATE = "navigate", CLICK = "click", MOUSEDOWN = "mousedown", MOUSEUP = "mouseup", MOUSEENTER = "mouseenter", MOUSELEAVE = "mouseleave", MOUSEMOVE = "mousemove", DUBLECLICK = "dblclick", HEIGHT = "height", WIDTH = "width", AUTO = "auto", TABINDEX = "tabIndex", FUNCTION = "function", STRING = "string", NUMBER = "number", BOTTOM = "bottom", CONTAINER_FOR = "container-for", FIELD = "field", INPUT = "input", INCELL = "incell", INLINE = "inline", UNIQUE_ID = "uid", MINCOLSPANVALUE = 1, COLSPAN = "colSpan", OVERFLOW = "overflow", HIDDEN = "hidden", SORT = "sort", GROUP_SORT = "group-sort", DELETECONFIRM = "Are you sure you want to delete this record?", NORECORDS = "No records available.", CONFIRMDELETE = "Delete", CANCELDELETE = "Cancel", COLLAPSE = "Collapse", EXPAND = "Expand", ID = "id", PX = "px", TR = "tr", TH = "th", TD = "td", DIV = "div", ARIA_LABEL = "aria-label", ARIA_OWNS = "aria-owns", ARIA_ROWCOUNT = "aria-rowcount", ARIA_COLCOUNT = "aria-colcount", ARIA_CONTROLS = "aria-controls", ARIA_COLINDEX = "aria-colindex", ARIA_ROWINDEX = "aria-rowindex", ARIA_EXPANDED = "aria-expanded", ARIA_CHECKED = "aria-checked", ARIA_ACTIVEDESCENDANT = "aria-activedescendant", ROLE = "role", NONE = "none", ROW = "row", ROWGROUP = "rowgroup", COLUMNHEADER = "columnheader", GRIDCELL = "gridcell", formatRegExp = /(\}|\#)/gi, templateHashRegExp = /#/gi, whitespaceRegExp = "[\\x20\\t\\r\\n\\f]", leftRegExp = new RegExp("(\\s*left\\s*:\\s*\\d*px;?)*", "ig"), rightRegExp = new RegExp("(\\s*right\\s*:\\s*\\d*px;?)*", "ig"), nonDataCellsRegExp = new RegExp("(^|" + whitespaceRegExp + ")" + "(k-group-cell|k-hierarchy-cell)" + "(" + whitespaceRegExp + "|$)"), filterRowRegExp = new RegExp("(^|" + whitespaceRegExp + ")" + "(k-filter-row)" + "(" + whitespaceRegExp + "|$)"), COMMANDBUTTONTMPL = ({ className, attr, text }) => `<button type="button" class="${className}" ${attr}>${kendo.htmlEncode(text)}</button>`, DEFAULTSELECTCOLUMNTMPL = (size, ariaLabel, label) => `<span class="k-checkbox-wrap"><input tabindex="-1" class="k-select-checkbox ${CHECKBOX} ${size}" data-role="checkbox" aria-label="${ariaLabel}" aria-checked="false" type="checkbox"></span>${label ? `<label class="k-checkbox-label">${label}</label>` : ""}`, SELECTCOLUMNTMPL = ({ size }) => DEFAULTSELECTCOLUMNTMPL(size, "Select row"), SELECTCOLUMNHEADERTMPL = ({ size, label }) => DEFAULTSELECTCOLUMNTMPL(size, "Select all rows", label), DRAGHANDLECOLUMNTMPL = () => kendo.ui.icon("reorder"), PINNABLECOLUMNTMPL = () => `<span class="${PINCELLCLASS}">${kendo.ui.icon("pin")}</span>`, DEFAULTHEADERTEMPLATE = ({ text }) => `<span class="k-cell-inner"><span class="k-link"><span class="k-column-title">${text}</span></span></span>`, isRtl = false, browser = kendo.support.browser;
var isIE11 = browser.msie && browser.version === 11;
var isMac = /Mac OS/.test(navigator.userAgent);
var classNames = {
content: "k-content",
scrollContainer: "k-scroll-container",
headerCellInner: "k-cell-inner"
};
var GroupsPager;
const defaultBodyContextMenu = [
"copySelection",
"copySelectionNoHeaders",
"paste",
"separator",
"create",
"edit",
"destroy",
"select",
"separator",
"reorderRow",
"pinRow",
"exportPDF",
"exportExcel",
"exportCSV",
"separator"
];
const defaultHeadContextMenu = [
"sortAsc",
"sortDesc",
"separator"
];
const defaultGroupsContextMenu = [
"moveGroupPrevious",
"moveGroupNext",
"separator"
];
const editableToolbarItemsSelector = [
".k-grid-edit-command",
".k-grid-remove-command",
".k-grid-save-changes",
".k-grid-cancel-changes",
".k-grid-cancel-command",
".k-grid-save-command"
].join(", ");
const defaultActionSheetFooterButtons = function(messages) {
return {
sort: [{
command: "clear-sort",