dolphin-components
Version:
This project is licensed under the Apache 2.0 License. See the [LICENSE](https://opensource.org/license/apache-2-0) file for more details.
1,191 lines • 4.16 MB
JavaScript
import { Fragment as e, Teleport as t, Transition as n, computed as r, createApp as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, h as f, inject as p, isVNode as m, nextTick as h, normalizeClass as g, normalizeStyle as _, onActivated as v, onBeforeUnmount as y, onDeactivated as b, onMounted as x, onUnmounted as S, openBlock as C, provide as w, ref as T, renderList as E, renderSlot as D, resolveComponent as O, resolveDynamicComponent as k, shallowRef as A, toDisplayString as j, toRef as M, toRefs as N, unref as P, vModelCheckbox as ee, vModelRadio as F, vModelText as te, vShow as ne, watch as I, watchEffect as L, withCtx as re, withDirectives as R, withKeys as z, withModifiers as B } from "vue";
//#region \0rolldown/runtime.js
var ie = Object.create, ae = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, se = Object.getOwnPropertyNames, V = Object.getPrototypeOf, ce = Object.prototype.hasOwnProperty, le = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), H = (e, t) => {
let n = {};
for (var r in e) ae(n, r, {
get: e[r],
enumerable: !0
});
return t || ae(n, Symbol.toStringTag, { value: "Module" }), n;
}, ue = (e, t, n, r) => {
if (t && typeof t == "object" || typeof t == "function") for (var i = se(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !ce.call(e, s) && s !== n && ae(e, s, {
get: ((e) => t[e]).bind(null, s),
enumerable: !(r = oe(t, s)) || r.enumerable
});
return e;
}, de = (e, t, n) => (n = e == null ? {} : ie(V(e)), ue(t || !e || !e.__esModule ? ae(n, "default", {
value: e,
enumerable: !0
}) : n, e)), fe = { class: "content-div" }, pe = { class: "content-title" }, me = { key: 0 }, he = {
key: 2,
class: "text-gray-500 ml-1"
}, ge = {
key: 3,
width: "22px",
height: "22px",
class: "mt-[4px]",
viewBox: "0 0 24 24",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, _e = { class: "content-action" }, ve = ["onClick"], ye = /* @__PURE__ */ d({
inheritAttrs: !1,
__name: "ContentLayout",
props: {
title: { default: () => [] },
actions: {},
bodyClass: { default: "" },
titleClass: { default: "" },
disableMinHeight: {
type: Boolean,
default: !1
}
},
setup(t, { emit: n }) {
let r = n, i = t, u = T(i.actions ? i.actions : []);
return I(() => i.actions, (e) => {
e && (u.value = e);
}, { deep: !0 }), (n, i) => {
let d = O("RouterLink");
return C(), s("div", fe, [c("div", { class: g(["content-title-div", t.titleClass]) }, [c("div", pe, [(C(!0), s(e, null, E(t.title, (e, n) => (C(), s("div", { key: n }, [
e.link ? o("", !0) : (C(), s("span", me, j(e.name), 1)),
e.link ? (C(), a(d, {
key: 1,
to: e.link,
class: "hover:underline cursor-pointer"
}, {
default: re(() => [l(j(e.name), 1)]),
_: 2
}, 1032, ["to"])) : o("", !0),
t.title.length !== 0 && n + 1 === t.title.length && (e.count != null || e.count != null || e.count == 0) ? (C(), s("span", he, " (" + j(e.count) + ") ", 1)) : o("", !0),
t.title.length !== 0 && n + 1 !== t.title.length ? (C(), s("svg", ge, [...i[0] ||= [c("path", {
d: "M9 6L15 12L9 18",
stroke: "gray",
style: { "stroke-width": "2.5px" },
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null, -1)]])) : o("", !0)
]))), 128))]), c("div", _e, [
D(n.$slots, "action-before"),
(C(!0), s(e, null, E(u.value, (e, t) => (C(), s("div", { key: t }, [c("button", {
class: g(e.class || "btn btn-primary"),
onClick: (t) => r(e.emit)
}, j(e.title), 11, ve)]))), 128)),
D(n.$slots, "action-after")
])], 2), c("div", { class: g(["content-body", [t.bodyClass, t.disableMinHeight ? "" : "content-body-min-height"]]) }, [D(n.$slots, "body")], 2)]);
};
}
}), be = { class: "border-b py-3 px-4" }, xe = { class: "font-bold text-lg my-auto relative flex text-[19px]" }, Se = { key: 0 }, Ce = {
key: 3,
width: "22px",
height: "22px",
class: "mt-[4px]",
viewBox: "0 0 24 24",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, we = {
key: 0,
class: "border-t py-2.5 px-4"
}, Te = { class: "my-auto relative" }, Ee = { class: "flex justify-end gap-1.5" }, De = ["onClick"], Oe = "app-modal-panel", ke = 11, Ae = 10, je = /* @__PURE__ */ d({
inheritAttrs: !1,
__name: "Modal",
props: {
title: { default: () => [] },
actions: { default: () => [] },
show: {
type: Boolean,
default: !1
},
width: { default: "600px" },
showClose: {
type: Boolean,
default: !0
}
},
setup(i, { emit: d }) {
let f = d, p = i, m = T(ke), v = r(() => m.value - 1), b = T(window.innerHeight), x = T(null), S = T(!1), w = T(null), k = T(null), A = (e) => {
e.emit === "onClose" ? f("onClose") : f(e.emit);
}, M = () => {
if (x.value) {
let e = b.value - 200, t = x.value.scrollHeight;
S.value = t > e;
}
}, N = () => {
let e = document.querySelectorAll(`.${Oe}`), t = Math.max(e.length - 1, 0);
m.value = ke + t * Ae;
}, P = () => {
x.value && (w.value?.disconnect(), k.value?.disconnect(), w.value = new MutationObserver(() => {
h(() => M());
}), w.value.observe(x.value, {
childList: !0,
subtree: !0,
attributes: !0
}), k.value = new ResizeObserver(() => {
M();
}), k.value.observe(x.value), M());
}, ee = () => {
w.value?.disconnect(), k.value?.disconnect();
}, F = () => {
b.value = window.innerHeight, M();
}, te = () => {
h(() => {
P();
});
};
I(() => p.show, async (e) => {
e ? (await h(), N(), P()) : ee();
}), I(b, () => {
M();
});
let ne = T(p.actions);
return I(() => p.actions, (e) => {
ne.value = e;
}, { deep: !0 }), typeof window < "u" && window.addEventListener("resize", F), y(() => {
ee(), typeof window < "u" && window.removeEventListener("resize", F);
}), (r, d) => {
let p = O("RouterLink");
return C(), a(t, { to: "body" }, [u(n, {
name: "modal-load",
onAfterEnter: te
}, {
default: re(() => [i.show ? (C(), s("div", {
key: 0,
class: g(["app-modal-panel bg-white border border-border absolute top-[50px] right-0 left-0 mx-auto", { "overflow-y-auto": S.value }]),
style: _({
width: i.width,
zIndex: m.value
})
}, [
c("div", be, [c("div", xe, [(C(!0), s(e, null, E(i.title, (e, t) => (C(), s("span", {
key: t,
class: "flex"
}, [
e.link ? o("", !0) : (C(), s("span", Se, j(e.name), 1)),
e.link && e.link !== "#" ? (C(), a(p, {
key: 1,
to: e.link,
class: "hover:underline"
}, {
default: re(() => [l(j(e.name), 1)]),
_: 2
}, 1032, ["to"])) : o("", !0),
e.link && e.link === "#" ? (C(), s("a", {
key: 2,
onClick: d[0] ||= (e) => f("onClose"),
class: "hover:underline cursor-pointer"
}, j(e.name), 1)) : o("", !0),
i.title.length !== 0 && t + 1 !== i.title.length ? (C(), s("svg", Ce, [...d[2] ||= [c("path", {
d: "M9 6L15 12L9 18",
stroke: "gray",
style: { "stroke-width": "2.5px" },
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null, -1)]])) : o("", !0)
]))), 128)), i.showClose ? (C(), s("div", {
key: 0,
class: "absolute hover:cursor-pointer top-[7px] right-0 text-xl group",
onClick: d[1] ||= (e) => f("onClose")
}, [...d[3] ||= [c("svg", {
width: "16px",
height: "16px",
viewBox: "0 0 16.00 16.00",
xmlns: "http://www.w3.org/2000/svg",
stroke: "currentColor",
class: "duration-200",
"stroke-width": "0.592"
}, [c("g", { id: "SVGRepo_iconCarrier" }, [c("path", {
d: "M0 14.545L1.455 16 8 9.455 14.545 16 16 14.545 9.455 8 16 1.455 14.545 0 8 6.545 1.455 0 0 1.455 6.545 8z",
"fill-rule": "evenodd"
})])], -1)]])) : o("", !0)])]),
c("div", {
ref_key: "dynamicDiv",
ref: x,
class: g(["py-4 px-4", { "overflow-y-auto": S.value }]),
style: _({ maxHeight: `${b.value - 200}px` })
}, [D(r.$slots, "default")], 6),
i.actions.length > 0 ? (C(), s("div", we, [c("div", Te, [c("div", Ee, [(C(!0), s(e, null, E(ne.value, (e, t) => (C(), s("div", { key: t }, [c("button", {
class: g(e.class || "btn btn-primary"),
onClick: (t) => A(e)
}, j(e.title), 11, De)]))), 128))])])])) : o("", !0)
], 6)) : o("", !0)]),
_: 3
}), i.show ? (C(), s("div", {
key: 0,
class: "app-modal-backdrop h-screen bg-black/30 fixed top-0 right-0 left-0",
style: _({ zIndex: v.value })
}, null, 4)) : o("", !0)]);
};
}
}), Me = ["aria-checked"], Ne = /* @__PURE__ */ d({
__name: "Switch",
props: {
modelValue: {
type: Boolean,
default: !1
},
background: { default: "bg-[#1C64F2]" },
disable: {
type: Boolean,
default: !1
}
},
emits: ["update:modelValue"],
setup(e, { emit: t }) {
let n = e, r = t, i = T(n.modelValue);
I(() => n.modelValue, (e) => {
i.value = e;
});
let a = () => {
n.disable || (i.value = !i.value, r("update:modelValue", i.value));
};
return (t, n) => (C(), s("div", {
onClick: a,
class: g(["relative min-w-[40px] max-w-[40px] min-h-[25px] max-h-[25px] rounded-full p-[5px] transition-colors duration-200 my-[1px]", [i.value ? e.background : "bg-gray-300", e.disable ? "cursor-not-allowed" : "cursor-pointer"]]),
"aria-checked": i.value
}, [c("div", { class: g(["flex items-center justify-center min-w-[15px] max-w-[15px] min-h-[15px] max-h-[15px] rounded-full bg-white shadow-md transform transition-transform duration-200", i.value ? "translate-x-[110%]" : "translate-x-0"]) }, null, 2)], 10, Me));
}
}), Pe = { class: "flex items-center border-b border-gray-300 mb-[15px]" }, Fe = {
key: 0,
class: "h-6 w-px bg-gray-300"
}, Ie = ["onClick"], Le = /* @__PURE__ */ d({
__name: "Tab",
props: {
modelValue: {},
tabs: { default: () => [] },
showSeparator: {
type: Boolean,
default: !0
}
},
emits: ["update:modelValue", "change"],
setup(t, { emit: n }) {
let r = n, i = (e) => {
r("update:modelValue", e), r("change", e);
};
return (n, r) => (C(), s("div", Pe, [(C(!0), s(e, null, E(t.tabs, (r, a) => (C(), s(e, { key: r.id }, [t.showSeparator && a > 0 ? (C(), s("span", Fe)) : o("", !0), c("button", {
type: "button",
class: g(["cursor-pointer font-bold px-4 pt-2 pb-3 border-b-2 -mb-px transition-colors duration-150", t.modelValue === r.id ? "text-blue-600 border-blue-600" : "text-gray-700 border-transparent hover:text-blue-500"]),
onClick: (e) => i(r.id)
}, [D(n.$slots, r.id, {
tab: r,
active: t.modelValue === r.id
}, () => [l(j(r.name), 1)])], 10, Ie)], 64))), 128))]));
}
}), Re = class {
constructor(e) {
this.table = e;
}
reloadData(e, t, n) {
return this.table.dataLoader.load(e, void 0, void 0, void 0, t, n);
}
langText() {
return this.table.modules.localize.getText(...arguments);
}
langBind() {
return this.table.modules.localize.bind(...arguments);
}
langLocale() {
return this.table.modules.localize.getLocale(...arguments);
}
commsConnections() {
return this.table.modules.comms.getConnections(...arguments);
}
commsSend() {
return this.table.modules.comms.send(...arguments);
}
layoutMode() {
return this.table.modules.layout.getMode();
}
layoutRefresh(e) {
return this.table.modules.layout.layout(e);
}
subscribe() {
return this.table.eventBus.subscribe(...arguments);
}
unsubscribe() {
return this.table.eventBus.unsubscribe(...arguments);
}
subscribed(e) {
return this.table.eventBus.subscribed(e);
}
subscriptionChange() {
return this.table.eventBus.subscriptionChange(...arguments);
}
dispatch() {
return this.table.eventBus.dispatch(...arguments);
}
chain() {
return this.table.eventBus.chain(...arguments);
}
confirm() {
return this.table.eventBus.confirm(...arguments);
}
dispatchExternal() {
return this.table.externalEvents.dispatch(...arguments);
}
subscribedExternal(e) {
return this.table.externalEvents.subscribed(e);
}
subscriptionChangeExternal() {
return this.table.externalEvents.subscriptionChange(...arguments);
}
options(e) {
return this.table.options[e];
}
setOption(e, t) {
return t !== void 0 && (this.table.options[e] = t), this.table.options[e];
}
deprecationCheck(e, t, n) {
return this.table.deprecationAdvisor.check(e, t, n);
}
deprecationCheckMsg(e, t) {
return this.table.deprecationAdvisor.checkMsg(e, t);
}
deprecationMsg(e) {
return this.table.deprecationAdvisor.msg(e);
}
module(e) {
return this.table.module(e);
}
}, ze = class {
static elVisible(e) {
return !(e.offsetWidth <= 0 && e.offsetHeight <= 0);
}
static elOffset(e) {
var t = e.getBoundingClientRect();
return {
top: t.top + window.pageYOffset - document.documentElement.clientTop,
left: t.left + window.pageXOffset - document.documentElement.clientLeft
};
}
static retrieveNestedData(e, t, n) {
var r = e ? t.split(e) : [t], i = r.length, a;
for (let e = 0; e < i && (n = n[r[e]], a = n, n); e++);
return a;
}
static deepClone(e, t, n = []) {
var r = {}.__proto__, i = [].__proto__;
for (var a in t ||= Object.assign(Array.isArray(e) ? [] : {}, e), e) {
let o = e[a], s, c;
typeof o == "object" && o && (o.__proto__ === r || o.__proto__ === i) && (s = n.findIndex((e) => e.subject === o), s > -1 ? t[a] = n[s].copy : (c = Object.assign(Array.isArray(o) ? [] : {}, o), n.unshift({
subject: o,
copy: c
}), t[a] = this.deepClone(o, c, n)));
}
return t;
}
}, Be = class e extends Re {
constructor(e, t, n) {
super(e), this.element = t, this.container = this._lookupContainer(), this.parent = n, this.reversedX = !1, this.childPopup = null, this.blurable = !1, this.blurCallback = null, this.blurEventsBound = !1, this.renderedCallback = null, this.visible = !1, this.hideable = !0, this.element.classList.add("tabulator-popup-container"), this.blurEvent = this.hide.bind(this, !1), this.escEvent = this._escapeCheck.bind(this), this.destroyBinding = this.tableDestroyed.bind(this), this.destroyed = !1;
}
tableDestroyed() {
this.destroyed = !0, this.hide(!0);
}
_lookupContainer() {
var e = this.table.options.popupContainer;
return typeof e == "string" ? (e = document.querySelector(e), e || console.warn("Menu Error - no container element found matching selector:", this.table.options.popupContainer, "(defaulting to document body)")) : e === !0 && (e = this.table.element), e && !this._checkContainerIsParent(e) && (e = !1, console.warn("Menu Error - container element does not contain this table:", this.table.options.popupContainer, "(defaulting to document body)")), e ||= document.body, e;
}
_checkContainerIsParent(e, t = this.table.element) {
return e === t ? !0 : t.parentNode ? this._checkContainerIsParent(e, t.parentNode) : !1;
}
renderCallback(e) {
this.renderedCallback = e;
}
containerEventCoords(e) {
var t = !(e instanceof MouseEvent), n = t ? e.touches[0].pageX : e.pageX, r = t ? e.touches[0].pageY : e.pageY;
if (this.container !== document.body) {
let e = ze.elOffset(this.container);
n -= e.left, r -= e.top;
}
return {
x: n,
y: r
};
}
elementPositionCoords(e, t = "right") {
var n = ze.elOffset(e), r, i, a;
switch (this.container !== document.body && (r = ze.elOffset(this.container), n.left -= r.left, n.top -= r.top), t) {
case "right":
i = n.left + e.offsetWidth, a = n.top - 1;
break;
case "bottom":
i = n.left, a = n.top + e.offsetHeight;
break;
case "left":
i = n.left, a = n.top - 1;
break;
case "top":
i = n.left, a = n.top;
break;
case "center":
i = n.left + e.offsetWidth / 2, a = n.top + e.offsetHeight / 2;
break;
}
return {
x: i,
y: a,
offset: n
};
}
show(e, t) {
var n, r, i, a, o;
return this.destroyed || this.table.destroyed ? this : (e instanceof HTMLElement ? (i = e, o = this.elementPositionCoords(e, t), a = o.offset, n = o.x, r = o.y) : typeof e == "number" ? (a = {
top: 0,
left: 0
}, n = e, r = t) : (o = this.containerEventCoords(e), n = o.x, r = o.y, this.reversedX = !1), this.element.style.top = r + "px", this.element.style.left = n + "px", this.container.appendChild(this.element), typeof this.renderedCallback == "function" && this.renderedCallback(), this._fitToScreen(n, r, i, a, t), this.visible = !0, this.subscribe("table-destroy", this.destroyBinding), this.element.addEventListener("mousedown", (e) => {
e.stopPropagation();
}), this);
}
_fitToScreen(e, t, n, r, i) {
var a = this.container === document.body ? document.documentElement.scrollTop : this.container.scrollTop;
(e + this.element.offsetWidth >= this.container.offsetWidth || this.reversedX) && (this.element.style.left = "", n ? this.element.style.right = this.container.offsetWidth - r.left + "px" : this.element.style.right = this.container.offsetWidth - e + "px", this.reversedX = !0);
let o = Math.max(this.container.offsetHeight, a ? this.container.scrollHeight : 0);
if (t + this.element.offsetHeight > o) if (n) switch (i) {
case "bottom":
this.element.style.top = parseInt(this.element.style.top) - this.element.offsetHeight - n.offsetHeight - 1 + "px";
break;
default: this.element.style.top = parseInt(this.element.style.top) - this.element.offsetHeight + n.offsetHeight + 1 + "px";
}
else {
let e = this.element.offsetHeight;
if (e > o) this.element.style.top = "0px", this.element.style.height = o + "px";
else {
let n = t - e;
n < 0 && (n = o - e), this.element.style.top = n + "px";
}
}
}
isVisible() {
return this.visible;
}
hideOnBlur(e) {
return this.blurable = !0, this.visible && (setTimeout(() => {
this.visible && (this.table.rowManager.element.addEventListener("scroll", this.blurEvent), this.subscribe("cell-editing", this.blurEvent), document.body.addEventListener("click", this.blurEvent), document.body.addEventListener("contextmenu", this.blurEvent), document.body.addEventListener("mousedown", this.blurEvent), window.addEventListener("resize", this.blurEvent), document.body.addEventListener("keydown", this.escEvent), this.blurEventsBound = !0);
}, 100), this.blurCallback = e), this;
}
_escapeCheck(e) {
e.key == 27 && this.hide();
}
blockHide() {
this.hideable = !1;
}
restoreHide() {
this.hideable = !0;
}
hide(e = !1) {
return this.visible && this.hideable && (this.blurable && this.blurEventsBound && (document.body.removeEventListener("keydown", this.escEvent), document.body.removeEventListener("click", this.blurEvent), document.body.removeEventListener("contextmenu", this.blurEvent), document.body.removeEventListener("mousedown", this.blurEvent), window.removeEventListener("resize", this.blurEvent), this.table.rowManager.element.removeEventListener("scroll", this.blurEvent), this.unsubscribe("cell-editing", this.blurEvent), this.blurEventsBound = !1), this.childPopup && this.childPopup.hide(), this.parent && (this.parent.childPopup = null), this.element.parentNode && this.element.parentNode.removeChild(this.element), this.visible = !1, this.blurCallback && !e && this.blurCallback(), this.unsubscribe("table-destroy", this.destroyBinding)), this;
}
child(t) {
return this.childPopup && this.childPopup.hide(), this.childPopup = new e(this.table, t, this), this.childPopup;
}
}, Ve = class extends Re {
constructor(e, t) {
super(e), this._handler = null;
}
initialize() {}
registerTableOption(e, t) {
this.table.optionsList.register(e, t);
}
registerColumnOption(e, t) {
this.table.columnManager.optionsList.register(e, t);
}
registerTableFunction(e, t) {
this.table[e] === void 0 ? this.table[e] = (...n) => (this.table.initGuard(e), t(...n)) : console.warn("Unable to bind table function, name already in use", e);
}
registerComponentFunction(e, t, n) {
return this.table.componentFunctionBinder.bind(e, t, n);
}
registerDataHandler(e, t) {
this.table.rowManager.registerDataPipelineHandler(e, t), this._handler = e;
}
registerDisplayHandler(e, t) {
this.table.rowManager.registerDisplayPipelineHandler(e, t), this._handler = e;
}
displayRows(e) {
var t = this.table.rowManager.displayRows.length - 1, n;
if (this._handler && (n = this.table.rowManager.displayPipeline.findIndex((e) => e.handler === this._handler), n > -1 && (t = n)), e && (t += e), this._handler) return t > -1 ? this.table.rowManager.getDisplayRows(t) : this.activeRows();
}
activeRows() {
return this.table.rowManager.activeRows;
}
refreshData(e, t) {
t ||= this._handler, t && this.table.rowManager.refreshActiveData(t, !1, e);
}
footerAppend(e) {
return this.table.footerManager.append(e);
}
footerPrepend(e) {
return this.table.footerManager.prepend(e);
}
footerRemove(e) {
return this.table.footerManager.remove(e);
}
popup(e, t) {
return new Be(this.table, e, t);
}
alert(e, t) {
return this.table.alertManager.alert(e, t);
}
clearAlert() {
return this.table.alertManager.clear();
}
}, He = { rownum: function(e, t, n, r, i, a) {
return a.getPosition();
} }, Ue = class e extends Ve {
static moduleName = "accessor";
static accessors = He;
constructor(e) {
super(e), this.allowedTypes = [
"",
"data",
"download",
"clipboard",
"print",
"htmlOutput"
], this.registerColumnOption("accessor"), this.registerColumnOption("accessorParams"), this.registerColumnOption("accessorData"), this.registerColumnOption("accessorDataParams"), this.registerColumnOption("accessorDownload"), this.registerColumnOption("accessorDownloadParams"), this.registerColumnOption("accessorClipboard"), this.registerColumnOption("accessorClipboardParams"), this.registerColumnOption("accessorPrint"), this.registerColumnOption("accessorPrintParams"), this.registerColumnOption("accessorHtmlOutput"), this.registerColumnOption("accessorHtmlOutputParams");
}
initialize() {
this.subscribe("column-layout", this.initializeColumn.bind(this)), this.subscribe("row-data-retrieve", this.transformRow.bind(this));
}
initializeColumn(e) {
var t = !1, n = {};
this.allowedTypes.forEach((r) => {
var i = "accessor" + (r.charAt(0).toUpperCase() + r.slice(1)), a;
e.definition[i] && (a = this.lookupAccessor(e.definition[i]), a && (t = !0, n[i] = {
accessor: a,
params: e.definition[i + "Params"] || {}
}));
}), t && (e.modules.accessor = n);
}
lookupAccessor(t) {
var n = !1;
switch (typeof t) {
case "string":
e.accessors[t] ? n = e.accessors[t] : console.warn("Accessor Error - No such accessor found, ignoring: ", t);
break;
case "function":
n = t;
break;
}
return n;
}
transformRow(e, t) {
var n = "accessor" + (t.charAt(0).toUpperCase() + t.slice(1)), r = e.getComponent(), i = ze.deepClone(e.data || {});
return this.table.columnManager.traverse(function(e) {
var a, o, s, c;
e.modules.accessor && (o = e.modules.accessor[n] || e.modules.accessor.accessor || !1, o && (a = e.getFieldValue(i), a != "undefined" && (c = e.getComponent(), s = typeof o.params == "function" ? o.params(a, i, t, c, r) : o.params, e.setFieldValue(i, o.accessor(a, i, t, s, c, r)))));
}), i;
}
}, We = { method: "GET" };
function Ge(e, t) {
var n = [];
if (t ||= "", Array.isArray(e)) e.forEach((e, r) => {
n = n.concat(Ge(e, t ? t + "[" + r + "]" : r));
});
else if (typeof e == "object") for (var r in e) n = n.concat(Ge(e[r], t ? t + "[" + r + "]" : r));
else n.push({
key: t,
value: e
});
return n;
}
function Ke(e) {
var t = Ge(e), n = [];
return t.forEach(function(e) {
n.push(encodeURIComponent(e.key) + "=" + encodeURIComponent(e.value));
}), n.join("&");
}
function qe(e, t, n) {
return e && n && Object.keys(n).length && (!t.method || t.method.toLowerCase() == "get") && (t.method = "get", e += (e.includes("?") ? "&" : "?") + Ke(n)), e;
}
function Je(e, t, n) {
var r;
return new Promise((i, a) => {
if (e = this.urlGenerator.call(this.table, e, t, n), t.method.toUpperCase() != "GET") if (r = typeof this.table.options.ajaxContentType == "object" ? this.table.options.ajaxContentType : this.contentTypeFormatters[this.table.options.ajaxContentType], r) {
for (var o in r.headers) t.headers ||= {}, t.headers[o] === void 0 && (t.headers[o] = r.headers[o]);
t.body = r.body.call(this, e, t, n);
} else console.warn("Ajax Error - Invalid ajaxContentType value:", this.table.options.ajaxContentType);
e ? (t.headers === void 0 && (t.headers = {}), t.headers.Accept === void 0 && (t.headers.Accept = "application/json"), t.headers["X-Requested-With"] === void 0 && (t.headers["X-Requested-With"] = "XMLHttpRequest"), t.mode === void 0 && (t.mode = "cors"), t.mode == "cors" ? (t.headers.Origin === void 0 && (t.headers.Origin = window.location.origin), t.credentials === void 0 && (t.credentials = "same-origin")) : t.credentials === void 0 && (t.credentials = "include"), fetch(e, t).then((e) => {
e.ok ? e.json().then((e) => {
i(e);
}).catch((e) => {
a(e), console.warn("Ajax Load Error - Invalid JSON returned", e);
}) : (console.error("Ajax Load Error - Connection Error: " + e.status, e.statusText), a(e));
}).catch((e) => {
console.error("Ajax Load Error - Connection Error: ", e), a(e);
})) : (console.warn("Ajax Load Error - No URL Set"), i([]));
});
}
function Ye(e, t) {
var n = [];
if (t ||= "", Array.isArray(e)) e.forEach((e, r) => {
n = n.concat(Ye(e, t ? t + "[" + r + "]" : r));
});
else if (typeof e == "object") for (var r in e) n = n.concat(Ye(e[r], t ? t + "[" + r + "]" : r));
else n.push({
key: t,
value: e
});
return n;
}
var Xe = {
json: {
headers: { "Content-Type": "application/json" },
body: function(e, t, n) {
return JSON.stringify(n);
}
},
form: {
headers: {},
body: function(e, t, n) {
var r = Ye(n), i = new FormData();
return r.forEach(function(e) {
i.append(e.key, e.value);
}), i;
}
}
}, Ze = class e extends Ve {
static moduleName = "ajax";
static defaultConfig = We;
static defaultURLGenerator = qe;
static defaultLoaderPromise = Je;
static contentTypeFormatters = Xe;
constructor(t) {
super(t), this.config = {}, this.url = "", this.urlGenerator = !1, this.params = !1, this.loaderPromise = !1, this.registerTableOption("ajaxURL", !1), this.registerTableOption("ajaxURLGenerator", !1), this.registerTableOption("ajaxParams", {}), this.registerTableOption("ajaxConfig", "get"), this.registerTableOption("ajaxContentType", "form"), this.registerTableOption("ajaxRequestFunc", !1), this.registerTableOption("ajaxRequesting", function() {}), this.registerTableOption("ajaxResponse", !1), this.contentTypeFormatters = e.contentTypeFormatters;
}
initialize() {
this.loaderPromise = this.table.options.ajaxRequestFunc || e.defaultLoaderPromise, this.urlGenerator = this.table.options.ajaxURLGenerator || e.defaultURLGenerator, this.table.options.ajaxURL && this.setUrl(this.table.options.ajaxURL), this.setDefaultConfig(this.table.options.ajaxConfig), this.registerTableFunction("getAjaxUrl", this.getUrl.bind(this)), this.subscribe("data-loading", this.requestDataCheck.bind(this)), this.subscribe("data-params", this.requestParams.bind(this)), this.subscribe("data-load", this.requestData.bind(this));
}
requestParams(e, t, n, r) {
var i = this.table.options.ajaxParams;
return i && (typeof i == "function" && (i = i.call(this.table)), r = Object.assign(Object.assign({}, i), r)), r;
}
requestDataCheck(e, t, n, r) {
return !!(!e && this.url || typeof e == "string");
}
requestData(e, t, n, r, i) {
var a;
return !i && this.requestDataCheck(e) ? (e && this.setUrl(e), a = this.generateConfig(n), this.sendRequest(this.url, t, a)) : i;
}
setDefaultConfig(t = {}) {
this.config = Object.assign({}, e.defaultConfig), typeof t == "string" ? this.config.method = t : Object.assign(this.config, t);
}
generateConfig(e = {}) {
var t = Object.assign({}, this.config);
return typeof e == "string" ? t.method = e : Object.assign(t, e), t;
}
setUrl(e) {
this.url = e;
}
getUrl() {
return this.url;
}
sendRequest(e, t, n) {
return this.table.options.ajaxRequesting.call(this.table, e, t) === !1 ? Promise.reject() : this.loaderPromise(e, n, t).then((n) => (this.table.options.ajaxResponse && (n = this.table.options.ajaxResponse.call(this.table, e, t, n)), n));
}
}, Qe = {
replace: function(e) {
return this.table.setData(e);
},
update: function(e) {
return this.table.updateOrAddData(e);
},
insert: function(e) {
return this.table.addData(e);
}
}, $e = { table: function(e) {
var t = [], n = !0, r = this.table.columnManager.columns, i = [], a = [];
return e = e.split("\n"), e.forEach(function(e) {
t.push(e.split(" "));
}), t.length && !(t.length === 1 && t[0].length < 2) ? (t[0].forEach(function(e) {
var t = r.find(function(t) {
return e && t.definition.title && e.trim() && t.definition.title.trim() === e.trim();
});
t ? i.push(t) : n = !1;
}), n || (n = !0, i = [], t[0].forEach(function(e) {
var t = r.find(function(t) {
return e && t.field && e.trim() && t.field.trim() === e.trim();
});
t ? i.push(t) : n = !1;
}), n || (i = this.table.columnManager.columnsByIndex)), n && t.shift(), t.forEach(function(e) {
var t = {};
e.forEach(function(e, n) {
i[n] && (t[i[n].field] = e);
}), a.push(t);
}), a) : !1;
} }, et = { keybindings: {
bindings: { copyToClipboard: ["ctrl + 67", "meta + 67"] },
actions: { copyToClipboard: function(e) {
this.table.modules.edit.currentCell || this.table.modExists("clipboard", !0) && this.table.modules.clipboard.copy(!1, !0);
} }
} }, tt = class e extends Ve {
static moduleName = "clipboard";
static moduleExtensions = et;
static pasteActions = Qe;
static pasteParsers = $e;
constructor(e) {
super(e), this.mode = !0, this.pasteParser = function() {}, this.pasteAction = function() {}, this.customSelection = !1, this.rowRange = !1, this.blocked = !0, this.registerTableOption("clipboard", !1), this.registerTableOption("clipboardCopyStyled", !0), this.registerTableOption("clipboardCopyConfig", !1), this.registerTableOption("clipboardCopyFormatter", !1), this.registerTableOption("clipboardCopyRowRange", "active"), this.registerTableOption("clipboardPasteParser", "table"), this.registerTableOption("clipboardPasteAction", "insert"), this.registerColumnOption("clipboard"), this.registerColumnOption("titleClipboard");
}
initialize() {
this.mode = this.table.options.clipboard, this.rowRange = this.table.options.clipboardCopyRowRange, (this.mode === !0 || this.mode === "copy") && this.table.element.addEventListener("copy", (e) => {
var t, n, r;
this.blocked || (e.preventDefault(), this.customSelection ? (t = this.customSelection, this.table.options.clipboardCopyFormatter && (t = this.table.options.clipboardCopyFormatter("plain", t))) : (r = this.table.modules.export.generateExportList(this.table.options.clipboardCopyConfig, this.table.options.clipboardCopyStyled, this.rowRange, "clipboard"), n = this.table.modules.export.generateHTMLTable(r), t = n ? this.generatePlainContent(r) : "", this.table.options.clipboardCopyFormatter && (t = this.table.options.clipboardCopyFormatter("plain", t), n = this.table.options.clipboardCopyFormatter("html", n))), window.clipboardData && window.clipboardData.setData ? window.clipboardData.setData("Text", t) : e.clipboardData && e.clipboardData.setData ? (e.clipboardData.setData("text/plain", t), n && e.clipboardData.setData("text/html", n)) : e.originalEvent && e.originalEvent.clipboardData.setData && (e.originalEvent.clipboardData.setData("text/plain", t), n && e.originalEvent.clipboardData.setData("text/html", n)), this.dispatchExternal("clipboardCopied", t, n), this.reset());
}), (this.mode === !0 || this.mode === "paste") && this.table.element.addEventListener("paste", (e) => {
this.paste(e);
}), this.setPasteParser(this.table.options.clipboardPasteParser), this.setPasteAction(this.table.options.clipboardPasteAction), this.registerTableFunction("copyToClipboard", this.copy.bind(this));
}
reset() {
this.blocked = !0, this.customSelection = !1;
}
generatePlainContent(e) {
var t = [];
return e.forEach((e) => {
var n = [];
e.columns.forEach((t) => {
var r = "";
if (t) if (e.type === "group" && (t.value = t.component.getKey()), t.value === null) r = "";
else switch (typeof t.value) {
case "object":
r = JSON.stringify(t.value);
break;
case "undefined":
r = "";
break;
default: r = t.value;
}
n.push(r);
}), t.push(n.join(" "));
}), t.join("\n");
}
copy(e, t) {
var n, r;
this.blocked = !1, this.customSelection = !1, (this.mode === !0 || this.mode === "copy") && (this.rowRange = e || this.table.options.clipboardCopyRowRange, window.getSelection !== void 0 && document.createRange !== void 0 ? (e = document.createRange(), e.selectNodeContents(this.table.element), n = window.getSelection(), n.toString() && t && (this.customSelection = n.toString()), n.removeAllRanges(), n.addRange(e)) : document.selection !== void 0 && document.body.createTextRange !== void 0 && (r = document.body.createTextRange(), r.moveToElementText(this.table.element), r.select()), document.execCommand("copy"), n && n.removeAllRanges());
}
setPasteAction(t) {
switch (typeof t) {
case "string":
this.pasteAction = e.pasteActions[t], this.pasteAction || console.warn("Clipboard Error - No such paste action found:", t);
break;
case "function":
this.pasteAction = t;
break;
}
}
setPasteParser(t) {
switch (typeof t) {
case "string":
this.pasteParser = e.pasteParsers[t], this.pasteParser || console.warn("Clipboard Error - No such paste parser found:", t);
break;
case "function":
this.pasteParser = t;
break;
}
}
paste(e) {
var t, n, r;
this.checkPasteOrigin(e) && (t = this.getPasteData(e), n = this.pasteParser.call(this, t), n ? (e.preventDefault(), this.table.modExists("mutator") && (n = this.mutateData(n)), r = this.pasteAction.call(this, n), this.dispatchExternal("clipboardPasted", t, n, r)) : this.dispatchExternal("clipboardPasteError", t));
}
mutateData(e) {
var t = [];
return Array.isArray(e) ? e.forEach((e) => {
t.push(this.table.modules.mutator.transformRow(e, "clipboard"));
}) : t = e, t;
}
checkPasteOrigin(e) {
var t = !0;
return (this.confirm("clipboard-paste", [e]) || !["DIV", "SPAN"].includes(e.target.tagName)) && (t = !1), t;
}
getPasteData(e) {
var t;
return window.clipboardData && window.clipboardData.getData ? t = window.clipboardData.getData("Text") : e.clipboardData && e.clipboardData.getData ? t = e.clipboardData.getData("text/plain") : e.originalEvent && e.originalEvent.clipboardData.getData && (t = e.originalEvent.clipboardData.getData("text/plain")), t;
}
}, nt = class {
constructor(e) {
return this._row = e, new Proxy(this, { get: function(e, t, n) {
return e[t] === void 0 ? e._row.table.componentFunctionBinder.handle("row", e._row, t) : e[t];
} });
}
getData(e) {
return this._row.getData(e);
}
getElement() {
return this._row.getElement();
}
getTable() {
return this._row.table;
}
getCells() {
var e = [];
return this._row.getCells().forEach(function(t) {
e.push(t.getComponent());
}), e;
}
getCell(e) {
var t = this._row.getCell(e);
return t ? t.getComponent() : !1;
}
_getSelf() {
return this._row;
}
}, rt = class {
constructor(e) {
return this._cell = e, new Proxy(this, { get: function(e, t, n) {
return e[t] === void 0 ? e._cell.table.componentFunctionBinder.handle("cell", e._cell, t) : e[t];
} });
}
getValue() {
return this._cell.getValue();
}
getOldValue() {
return this._cell.getOldValue();
}
getInitialValue() {
return this._cell.initialValue;
}
getElement() {
return this._cell.getElement();
}
getRow() {
return this._cell.row.getComponent();
}
getData(e) {
return this._cell.row.getData(e);
}
getType() {
return "cell";
}
getField() {
return this._cell.column.getField();
}
getColumn() {
return this._cell.column.getComponent();
}
setValue(e, t) {
t === void 0 && (t = !0), this._cell.setValue(e, t);
}
restoreOldValue() {
this._cell.setValueActual(this._cell.getOldValue());
}
restoreInitialValue() {
this._cell.setValueActual(this._cell.initialValue);
}
checkHeight() {
this._cell.checkHeight();
}
getTable() {
return this._cell.table;
}
_getSelf() {
return this._cell;
}
}, it = class extends Re {
constructor(e, t) {
super(e.table), this.table = e.table, this.column = e, this.row = t, this.element = null, this.value = null, this.initialValue, this.oldValue = null, this.modules = {}, this.height = null, this.width = null, this.minWidth = null, this.component = null, this.loaded = !1, this.build();
}
build() {
this.generateElement(), this.setWidth(), this._configureCell(), this.setValueActual(this.column.getFieldValue(this.row.data)), this.initialValue = this.value;
}
generateElement() {
this.element = document.createElement("div"), this.element.className = "tabulator-cell", this.element.setAttribute("role", "gridcell"), this.column.isRowHeader && this.element.classList.add("tabulator-row-header");
}
_configureCell() {
var e = this.element, t = this.column.getField(), n = {
top: "flex-start",
bottom: "flex-end",
middle: "center"
}, r = {
left: "flex-start",
right: "flex-end",
center: "center"
};
e.style.textAlign = this.column.hozAlign, this.column.vertAlign && (e.style.display = "inline-flex", e.style.alignItems = n[this.column.vertAlign] || "", this.column.hozAlign && (e.style.justifyContent = r[this.column.hozAlign] || "")), t && e.setAttribute("tabulator-field", t), this.column.definition.cssClass && this.column.definition.cssClass.split(" ").forEach((t) => {
e.classList.add(t);
}), this.dispatch("cell-init", this), this.column.visible || this.hide();
}
_generateContents() {
var e = this.chain("cell-format", this, null, () => this.element.innerHTML = this.value);
switch (typeof e) {
case "object":
if (e instanceof Node) {
for (; this.element.firstChild;) this.element.removeChild(this.element.firstChild);
this.element.appendChild(e);
} else this.element.innerHTML = "", e != null && console.warn("Format Error - Formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:", e);
break;
case "undefined":
this.element.innerHTML = "";
break;
default: this.element.innerHTML = e;
}
}
cellRendered() {
this.dispatch("cell-rendered", this);
}
getElement(e) {
return this.loaded || (this.loaded = !0, e || this.layoutElement()), this.element;
}
getValue() {
return this.value;
}
getOldValue() {
return this.oldValue;
}
setValue(e, t, n) {
this.setValueProcessData(e, t, n) && (this.dispatch("cell-value-updated", this), this.cellRendered(), this.column.definition.cellEdited && this.column.definition.cellEdited.call(this.table, this.getComponent()), this.dispatchExternal("cellEdited", this.getComponent()), this.subscribedExternal("dataChanged") && this.dispatchExternal("dataChanged", this.table.rowManager.getData()));
}
setValueProcessData(e, t, n) {
var r = !1;
return (this.value !== e || n) && (r = !0, t && (e = this.chain("cell-value-changing", [this, e], null, e))), this.setValueActual(e), r && this.dispatch("cell-value-changed", this), r;
}
setValueActual(e) {
this.oldValue = this.value, this.value = e, this.dispatch("cell-value-save-before", this), this.column.setFieldValue(this.row.data, e), this.dispatch("cell-value-save-after", this), this.loaded && this.layoutElement();
}
layoutElement() {
this._generateContents(), this.dispatch("cell-layout", this);
}
setWidth() {
this.width = this.column.width, this.element.style.width = this.column.widthStyled;
}
clearWidth() {
this.width = "", this.element.style.width = "";
}
getWidth() {
return this.width || this.element.offsetWidth;
}
setMinWidth() {
this.minWidth = this.column.minWidth, this.element.style.minWidth = this.column.minWidthStyled;
}
setMaxWidth() {
this.maxWidth = this.column.maxWidth, this.element.style.maxWidth = this.column.maxWidthStyled;
}
checkHeight() {
this.row.reinitializeHeight();
}
clearHeight() {
this.element.style.height = "", this.height = null, this.dispatch("cell-height", this, "");
}
setHeight() {
this.height = this.row.height, this.element.style.height = this.row.heightStyled, this.dispatch("cell-height", this, this.row.heightStyled);
}
getHeight() {
return this.height || this.element.offsetHeight;
}
show() {
this.element.style.display = this.column.vertAlign ? "inline-flex" : "";
}
hide() {
this.element.style.display = "none";
}
delete() {
this.dispatch("cell-delete", this), !this.table.rowManager.redrawBlock && this.element.parentNode && this.element.parentNode.removeChild(this.element), this.element = !1, this.column.deleteCell(this), this.row.deleteCell(this), this.calcs = {};
}
getIndex() {
return this.row.getCellIndex(this);
}
getComponent() {
return this.component ||= new rt(this), this.component;
}
}, at = class {
constructor(e) {
return this._column = e, this.type = "ColumnComponent", new Proxy(this, { get: function(e, t, n) {
return e[t] === void 0 ? e._column.table.componentFunctionBinder.handle("column", e._column, t) : e[t];
} });
}
getElement() {
return this._column.getElement();
}
getDefinition() {
return this._column.getDefinition();
}
getField() {
return this._column.getField();
}
getTitleDownload() {
return this._column.getTitleDownload();
}
getCells() {
var e = [];
return this._column.cells.forEach(function(t) {
e.push(t.getComponent());
}), e;
}
isVisible() {
return this._column.visible;
}
show() {
this._column.isGroup ? this._column.columns.forEach(function(e) {
e.show();
}) : this._column.show();
}
hide() {
this._column.isGroup ? this._column.columns.forEach(function(e) {
e.hide();
}) : this._column.hide();
}
toggle() {
this._column.visible ? this.hide() : this.show();
}
delete() {
return this._column.delete();
}
getSubColumns() {
var e = [];
return this._column.columns.length && this._column.columns.forEach(function(t) {
e.push(t.getComponent());
}), e;
}
getParentColumn() {
return this._column.getParentComponent();
}
_getSelf() {
return this._column;
}
scrollTo(e, t) {
return this._column.table.columnManager.scrollToColumn(this._column, e, t);
}
getTable() {
return this._column.table;
}
move(e, t) {
var n = this._column.table.columnManager.findColumn(e);
n ? this._column.table.columnManager.moveColumn(this._column, n, t) : console.warn("Move Error - No matching column found:", n);
}
getNextColumn() {
var e = this._column.nextColumn();
return e ? e.getComponent() : !1;
}
getPrevColumn() {
var e = this._column.prevColumn();
return e ? e.getComponent() : !1;
}
updateDefinition(e) {
return this._column.updateDefinition(e);
}
getWidth() {
return this._column.getWidth();
}
setWidth(e) {
var t = e === !0 ? this._column.reinitializeWidth(!0) : this._column.setWidth(e);
return this._column.table.columnManager.rerenderColumns(!0), t;
}
}, ot = {
title: void 0,
field: void 0,
columns: void 0,
visible: void 0,
hozAlign: void 0,
vertAlign: void 0,
width: void 0,
minWidth: 40,
maxWidth: void 0,
maxInitialWidth: void 0,
cssClass: void 0,
variableHeight: void 0,
headerVertical: void 0,
headerHozAlign: void 0,
headerWordWrap: !1,
editableTitle: void 0
}, st = class e extends Re {
static defaultOptionList = ot;
constructor(t, n, r) {
super(n.table), this.definition = t, this.parent = n, this.type = "column", this.columns = [], this.cells = [], this.isGroup = !1, this.isRowHeader = r, this.element = this.createElement(), this.contentElement = !1, this.titleHolderElement = !1, this.titleElement = !1, this.groupElement = this.createGroupElement(), this.hozAlign = "", this.vertAlign = "", this.field = "", this.fieldStructure = "", this.getFieldValue = "", this.setFieldValue = "", this.titleDownload = null, this.titleFormatterRendered = !1, this.mapDefinitions(), this.setField(this.definition.field), this.modules = {}, this.width = null, this.widthStyled = "", this.maxWidth = null, this.maxWidthStyled = "", this.maxInitialWidth = null, this.minWidth = null, this.minWidthStyled = "", this.widthFixed = !1, this.visible = !0, this.component = null, this.definition.columns ? (this.isGroup = !0, this.definition.columns.forEach((t, n) => {
var r = new e(t, this);
this.attachColumn(r);
}), this.checkColumnVisibility()) : n.registerColumnField(this), this._initialize();
}
createElement() {
var e = document.createElement("div");
switch (e.classList.add("tabulator-col"), e.setAttribute("role", "columnheader"), e.setAttribute("aria-sort", "none"), this.isRowHeader && e.classList.add("tabulator-row-header"), this.table.options.columnHeaderVertAlign) {
case "middle":
e.style.justifyContent = "center";
break;
case "bottom":
e.style.justifyContent = "flex-end";
break;
}
return e;
}
createGroupElement() {
var e = document.createElement("div");
return e.classList.add("tabulator-col-group-cols"), e;
}
mapDefinitions() {
var t = this.table.options.columnDefaults;
if (t) for (let e in t) this.definition[e] === void 0 && (this.definition[e] = t[e]);
this.definition = this.table.columnManager.optionsList.generate(e.defaultOptionList, this.definition);
}
checkDefinition() {
Object.keys(this.definition).forEach((t) => {
e.defaultOptionList.indexOf(t) === -1 && console.warn("Invalid column definition option in '" + (this.field || this.definition.title) + "' column:", t);
});
}
setField(e) {
this.field = e, this.fieldStructure = e ? this.table.options.nestedFieldSeparator ? e.split(this.table.options.nestedFieldSeparator) : [e] : [], this.getFieldValue = this.fieldStructure.length > 1 ? this._getNestedData : this._getFlatData, this.setFieldValue = this.fieldStructure.length > 1 ? this._setNestedData : this._setFlatData;
}
registerColumnPosition(e) {
this.parent.registerColumnPosition(e);
}
registerColumnField(e) {
this.parent.registerColumnField(e);
}
reRegisterPosition() {
this.isGroup ? this.columns.forEach(function(e) {
e.reRegisterPosition();
}) : this.registerColumnPosition(this);
}
_initialize() {
for (var e = this.definition; this.element.firstChild;) this.element.removeChild(this.element.firstChild);
e.headerVertical && (this.element.classList.add("tabulator-col-vertical"), e.headerVertical === "flip" && this.element.classList.add("tabulator-col-vertical-flip")), this.contentElement = this._buildColumnHeaderContent(), this.element.appendChild(this.contentElement), this.isGroup ? this._buildGroupHeader() : this._buildColumnHeader(), this.dispatch("column-init", this);
}
_buildColumnHeader() {
var e = this.definition;
this.dispatch("column-layout", this), e.visible !== void 0 && (e.visible ? this.show(!0) : this.hide(!0)), e.cssClass && e.cssClass.split(" ").forEach((e) => {
this.element.classList.add(e);
}), e.field && this.element.setAttribute("tabulator-field", e.field), this.setMinWidth(parseInt(e.minWidth)), e.maxInitialWidth && (this.maxInitialWidth = parseInt(e.maxInitialWidth)), e.maxWidth && this.setMaxWidth(parseInt(e.maxWidth)), this.reinitializeWidth(), this.hozAlign = this.definition.hozAlign, this.vertAlign = this.definition.vertAlign, this.titleElement.style.textAlign = this.definition.headerHozAlign;
}
_buildColumnHeaderContent() {
var e = document.createElement("div");
return e.classList.add("tabulator-col-content"), this.titleHolderElement = document.createElement("div"), this.titleHolderElement.classList.add("tabulator-col-title-holder"), e.appendChild(this.titleHolderElement), this.titleElement = this._buildColumnHeaderTitle(), this.titleHolderElement.appendChild(this.titleElement), e;
}
_buildColumnHeaderTitle() {
var e = this.definition, t = document.createElement("div");
if (t.classList.add("tabulator-col-title"), e.headerWordWrap && t.classList.add("tabulator-col-title-wrap"), e.editableTitle) {
var n = document.createElement("input");
n.classList.add("tabulator-title-editor"), n.addEventListener("click", (e) => {
e.stopPropagation(), n.focus();
}), n.addEventListener("mousedown", (e) => {
e.stopPropagation();
}), n.addEventListener("change", () => {
e.title = n.value, this.dispatchExternal("columnTitleChanged", this.getComponent());
}), t.appendChild(n), e.field ? this.langBind("columns|" + e.field, (t) => {
n.value = t || e.title || " ";
}) : n.value = e.title || " ";
} else e.field ? this.langBind("columns|" + e.field, (n) => {
this._formatColumnHeaderTitle(t, n || e.title || " ");
}) : this._formatColumnHeaderTitle(t, e.title || " ");
return t;
}
_formatColumnHeaderTitle(e, t) {
var n = this.chain("column-format", [
this,
t,
e
], null, () => t);
switch (typeof n) {
case "object":
n instanceof Node ? e.appendChild(n) : (e.innerHTML = "", console.warn("Format Error - Title formatter has returned a type of object, the only valid formatter object return is an instance of Node, the formatter returned:", n));
break;
case "undefined":
e.innerHTML = "";
break;
default: e.innerHTML = n;
}
}
_buildGroupHeader() {
this.element.classList.add("tabulator-col-group"), this.element.setAttribute("role", "columngroup"), this.element.setAttribute("aria-title", this.definition.title), this.definition.cssClass && this.definition.cssClass.split(" ").forEach((e) => {
this.element.classList.add(e);
}), this.titleElement.style.textAlign = this.definition.headerHozAlign, this.element.appendChild(this.groupElement);
}
_getFlatData(e) {
return e[this.field];
}
_getNestedData(e) {
var t = e, n = this.fi