dolphin-components
Version:
## License
1,205 lines • 1.8 MB
JavaScript
var cS = Object.defineProperty;
var uS = (s, e, t) => e in s ? cS(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t;
var T = (s, e, t) => uS(s, typeof e != "symbol" ? e + "" : e, t);
import { defineComponent as Ie, ref as P, watch as he, resolveComponent as qC, createElementBlock as S, openBlock as M, createElementVNode as L, normalizeClass as K, Fragment as pe, renderList as ye, createCommentVNode as O, createBlock as He, toDisplayString as Y, withCtx as lt, createTextVNode as it, renderSlot as re, onMounted as go, onUpdated as pS, onBeforeUnmount as eL, Teleport as FC, createVNode as C, Transition as Io, normalizeStyle as Ke, h as $o, computed as ae, resolveDynamicComponent as yS, withDirectives as at, vModelText as tL, vModelCheckbox as fS, vModelRadio as mS, onUnmounted as iL, inject as BC, watchEffect as qe, toRef as gS, shallowRef as kS, provide as OC, isVNode as vS, withKeys as Ne, withModifiers as ie, unref as st, vShow as Fo, createApp as bS, nextTick as wS } from "vue";
const MS = { class: "content-div" }, CS = { class: "content-title" }, xS = { key: 0 }, LS = {
key: 2,
width: "22px",
height: "22px",
class: "mt-[4px]",
viewBox: "0 0 24 24",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, ES = { class: "content-action" }, SS = ["onClick"], FV = /* @__PURE__ */ Ie({
__name: "ContentLayout",
props: {
title: { default: () => [] },
actions: {},
bodyClass: { default: "" },
titleClass: { default: "" },
disableMinHeight: { type: Boolean, default: !1 }
},
setup(s, { emit: e }) {
const t = e, i = s, a = P(i.actions ? i.actions : []);
return he(
() => i.actions,
(o) => {
o && (a.value = o);
},
{ deep: !0 }
), (o, r) => {
const l = qC("RouterLink");
return M(), S("div", MS, [
L("div", {
class: K(["content-title-div", o.titleClass])
}, [
L("div", CS, [
(M(!0), S(pe, null, ye(o.title, (h, d) => (M(), S("div", { key: d }, [
h.link ? O("", !0) : (M(), S("span", xS, Y(h.name), 1)),
h.link ? (M(), He(l, {
key: 1,
to: h.link,
class: "hover:underline cursor-pointer"
}, {
default: lt(() => [
it(Y(h.name), 1)
]),
_: 2
}, 1032, ["to"])) : O("", !0),
o.title.length !== 0 && d + 1 !== o.title.length ? (M(), S("svg", LS, r[0] || (r[0] = [
L("path", {
d: "M9 6L15 12L9 18",
stroke: "gray",
style: { "stroke-width": "2.5px" },
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null, -1)
]))) : O("", !0)
]))), 128))
]),
L("div", ES, [
re(o.$slots, "action-before"),
(M(!0), S(pe, null, ye(a.value, (h, d) => (M(), S("div", { key: d }, [
L("button", {
class: K(h.class || "btn"),
onClick: (c) => t(h.emit)
}, Y(h.title), 11, SS)
]))), 128)),
re(o.$slots, "action-after")
])
], 2),
L("div", {
class: K(["content-body", [o.bodyClass, o.disableMinHeight ? "" : "content-body-min-height"]])
}, [
re(o.$slots, "body")
], 2)
]);
};
}
}), IS = { class: "border-b py-3 px-4" }, TS = { class: "font-bold text-lg my-auto relative flex text-[19px]" }, DS = { key: 0 }, zS = {
key: 3,
width: "22px",
height: "22px",
class: "mt-[4px]",
viewBox: "0 0 24 24",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, RS = { class: "border-t py-2.5 px-4" }, HS = { class: "my-auto relative" }, AS = { class: "flex justify-end gap-1.5" }, PS = ["onClick"], VS = {
key: 0,
class: "h-screen bg-black/30 z-10 fixed top-0 right-0 left-0"
}, qS = /* @__PURE__ */ Ie({
__name: "Modal",
props: {
title: { default: () => [] },
actions: { default: () => [] },
show: { type: Boolean, default: !1 },
width: { default: "600px" }
},
setup(s, { emit: e }) {
const t = e, i = s, a = P(window.innerHeight), o = P(null), r = P(!1), l = (u) => {
u.emit === "onClose" ? t("onClose") : t(u.emit);
}, h = () => {
if (o.value) {
const u = a.value - 200;
r.value = o.value.scrollHeight > u;
}
}, d = () => {
a.value = window.innerHeight, h();
};
go(() => {
h(), window.addEventListener("resize", d);
}), pS(() => {
h();
}), eL(() => {
window.removeEventListener("resize", d);
}), he(a, h);
const c = P(i.actions);
return he(
() => i.actions,
(u) => {
c.value = u;
},
{ deep: !0 }
), (u, p) => {
const f = qC("RouterLink");
return M(), He(FC, { to: "body" }, [
L("div", null, [
C(Io, { name: "modal-load" }, {
default: lt(() => [
u.show ? (M(), S("div", {
key: 0,
class: K(["bg-white border border-border z-11 fixed top-[50px] right-0 left-0 mx-auto", { "overflow-y-auto": r.value }]),
style: Ke({ width: u.width })
}, [
L("div", IS, [
L("div", TS, [
(M(!0), S(pe, null, ye(u.title, (y, g) => (M(), S("span", {
key: g,
class: "flex"
}, [
y.link ? O("", !0) : (M(), S("span", DS, Y(y.name), 1)),
y.link && y.link !== "#" ? (M(), He(f, {
key: 1,
to: y.link,
class: "hover:underline"
}, {
default: lt(() => [
it(Y(y.name), 1)
]),
_: 2
}, 1032, ["to"])) : O("", !0),
y.link && y.link === "#" ? (M(), S("a", {
key: 2,
onClick: p[0] || (p[0] = (k) => t("onClose")),
class: "hover:underline cursor-pointer"
}, Y(y.name), 1)) : O("", !0),
u.title.length !== 0 && g + 1 !== u.title.length ? (M(), S("svg", zS, p[2] || (p[2] = [
L("path", {
d: "M9 6L15 12L9 18",
stroke: "gray",
style: { "stroke-width": "2.5px" },
"stroke-linecap": "round",
"stroke-linejoin": "round"
}, null, -1)
]))) : O("", !0)
]))), 128)),
L("div", {
class: "absolute hover:cursor-pointer top-[7px] right-0 text-xl group",
onClick: p[1] || (p[1] = (y) => t("onClose"))
}, p[3] || (p[3] = [
L("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"
}, [
L("g", { id: "SVGRepo_iconCarrier" }, [
L("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)
]))
])
]),
L("div", {
ref_key: "dynamicDiv",
ref: o,
class: K(["py-4 px-4", { "overflow-y-auto": r.value }]),
style: Ke({ maxHeight: `${a.value - 200}px` })
}, [
re(u.$slots, "default")
], 6),
L("div", RS, [
L("div", HS, [
L("div", AS, [
(M(!0), S(pe, null, ye(c.value, (y, g) => (M(), S("div", { key: g }, [
L("button", {
class: K(y.class || "btn"),
onClick: (k) => l(y)
}, Y(y.title), 11, PS)
]))), 128))
])
])
])
], 6)) : O("", !0)
]),
_: 3
}),
u.show ? (M(), S("div", VS)) : O("", !0)
])
]);
};
}
}), FS = ["aria-checked"], BV = /* @__PURE__ */ Ie({
__name: "Switch",
props: {
modelValue: { type: Boolean, default: !1 },
background: { default: "bg-[#1C64F2]" },
disable: { type: Boolean, default: !1 }
},
emits: ["update:modelValue"],
setup(s, { emit: e }) {
const t = s, i = e, a = P(t.modelValue);
he(
() => t.modelValue,
(r) => {
a.value = r;
}
);
const o = () => {
t.disable || (a.value = !a.value, i("update:modelValue", a.value));
};
return (r, l) => (M(), S("button", {
onClick: o,
class: K(["relative w-[40px] h-[25px] rounded-full p-1 transition-colors duration-200 my-[1px]", [a.value ? r.background : "bg-gray-200", r.disable ? "cursor-not-allowed" : "cursor-pointer"]]),
role: "switch",
"aria-checked": a.value
}, [
L("div", {
class: K(["flex items-center justify-center w-[15px] h-[15px] rounded-full bg-white shadow-md transform transition-transform duration-200", a.value ? "translate-x-[110%]" : "translate-x-0"])
}, null, 2)
], 10, FS));
}
});
class ke {
constructor(e) {
this.table = e;
}
//////////////////////////////////////////
/////////////// DataLoad /////////////////
//////////////////////////////////////////
reloadData(e, t, i) {
return this.table.dataLoader.load(e, void 0, void 0, void 0, t, i);
}
//////////////////////////////////////////
///////////// Localization ///////////////
//////////////////////////////////////////
langText() {
return this.table.modules.localize.getText(...arguments);
}
langBind() {
return this.table.modules.localize.bind(...arguments);
}
langLocale() {
return this.table.modules.localize.getLocale(...arguments);
}
//////////////////////////////////////////
////////// Inter Table Comms /////////////
//////////////////////////////////////////
commsConnections() {
return this.table.modules.comms.getConnections(...arguments);
}
commsSend() {
return this.table.modules.comms.send(...arguments);
}
//////////////////////////////////////////
//////////////// Layout /////////////////
//////////////////////////////////////////
layoutMode() {
return this.table.modules.layout.getMode();
}
layoutRefresh(e) {
return this.table.modules.layout.layout(e);
}
//////////////////////////////////////////
/////////////// Event Bus ////////////////
//////////////////////////////////////////
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 /////////////////
//////////////////////////////////////////
options(e) {
return this.table.options[e];
}
setOption(e, t) {
return typeof t < "u" && (this.table.options[e] = t), this.table.options[e];
}
//////////////////////////////////////////
/////////// Deprecation Checks ///////////
//////////////////////////////////////////
deprecationCheck(e, t, i) {
return this.table.deprecationAdvisor.check(e, t, i);
}
deprecationCheckMsg(e, t) {
return this.table.deprecationAdvisor.checkMsg(e, t);
}
deprecationMsg(e) {
return this.table.deprecationAdvisor.msg(e);
}
//////////////////////////////////////////
//////////////// Modules /////////////////
//////////////////////////////////////////
module(e) {
return this.table.module(e);
}
}
class ee {
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, i) {
var a = e ? t.split(e) : [t], o = a.length, r;
for (let l = 0; l < o && (i = i[a[l]], r = i, !!i); l++)
;
return r;
}
static deepClone(e, t, i = []) {
var a = {}.__proto__, o = [].__proto__;
t || (t = Object.assign(Array.isArray(e) ? [] : {}, e));
for (var r in e) {
let l = e[r], h, d;
l != null && typeof l == "object" && (l.__proto__ === a || l.__proto__ === o) && (h = i.findIndex((c) => c.subject === l), h > -1 ? t[r] = i[h].copy : (d = Object.assign(Array.isArray(l) ? [] : {}, l), i.unshift({ subject: l, copy: d }), t[r] = this.deepClone(l, d, i)));
}
return t;
}
}
let BS = class aL extends ke {
constructor(e, t, i) {
super(e), this.element = t, this.container = this._lookupContainer(), this.parent = i, 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 || (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), i = t ? e.touches[0].pageX : e.pageX, a = t ? e.touches[0].pageY : e.pageY;
if (this.container !== document.body) {
let o = ee.elOffset(this.container);
i -= o.left, a -= o.top;
}
return { x: i, y: a };
}
elementPositionCoords(e, t = "right") {
var i = ee.elOffset(e), a, o, r;
switch (this.container !== document.body && (a = ee.elOffset(this.container), i.left -= a.left, i.top -= a.top), t) {
case "right":
o = i.left + e.offsetWidth, r = i.top - 1;
break;
case "bottom":
o = i.left, r = i.top + e.offsetHeight;
break;
case "left":
o = i.left, r = i.top - 1;
break;
case "top":
o = i.left, r = i.top;
break;
case "center":
o = i.left + e.offsetWidth / 2, r = i.top + e.offsetHeight / 2;
break;
}
return { x: o, y: r, offset: i };
}
show(e, t) {
var i, a, o, r, l;
return this.destroyed || this.table.destroyed ? this : (e instanceof HTMLElement ? (o = e, l = this.elementPositionCoords(e, t), r = l.offset, i = l.x, a = l.y) : typeof e == "number" ? (r = { top: 0, left: 0 }, i = e, a = t) : (l = this.containerEventCoords(e), i = l.x, a = l.y, this.reversedX = !1), this.element.style.top = a + "px", this.element.style.left = i + "px", this.container.appendChild(this.element), typeof this.renderedCallback == "function" && this.renderedCallback(), this._fitToScreen(i, a, o, r, t), this.visible = !0, this.subscribe("table-destroy", this.destroyBinding), this.element.addEventListener("mousedown", (h) => {
h.stopPropagation();
}), this);
}
_fitToScreen(e, t, i, a, o) {
var r = this.container === document.body ? document.documentElement.scrollTop : this.container.scrollTop;
(e + this.element.offsetWidth >= this.container.offsetWidth || this.reversedX) && (this.element.style.left = "", i ? this.element.style.right = this.container.offsetWidth - a.left + "px" : this.element.style.right = this.container.offsetWidth - e + "px", this.reversedX = !0);
let l = Math.max(this.container.offsetHeight, r ? this.container.scrollHeight : 0);
if (t + this.element.offsetHeight > l)
if (i)
switch (o) {
case "bottom":
this.element.style.top = parseInt(this.element.style.top) - this.element.offsetHeight - i.offsetHeight - 1 + "px";
break;
default:
this.element.style.top = parseInt(this.element.style.top) - this.element.offsetHeight + i.offsetHeight + 1 + "px";
}
else
this.element.style.height = l + "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.keyCode == 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(e) {
return this.childPopup && this.childPopup.hide(), this.childPopup = new aL(this.table, e, this), this.childPopup;
}
};
class W extends ke {
constructor(e, t) {
super(e), this._handler = null;
}
initialize() {
}
///////////////////////////////////
////// Options Registration ///////
///////////////////////////////////
registerTableOption(e, t) {
this.table.optionsList.register(e, t);
}
registerColumnOption(e, t) {
this.table.columnManager.optionsList.register(e, t);
}
///////////////////////////////////
/// Public Function Registration ///
///////////////////////////////////
registerTableFunction(e, t) {
typeof this.table[e] > "u" ? this.table[e] = (...i) => (this.table.initGuard(e), t(...i)) : console.warn("Unable to bind table function, name already in use", e);
}
registerComponentFunction(e, t, i) {
return this.table.componentFunctionBinder.bind(e, t, i);
}
///////////////////////////////////
////////// Data Pipeline //////////
///////////////////////////////////
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, i;
if (this._handler && (i = this.table.rowManager.displayPipeline.findIndex((a) => a.handler === this._handler), i > -1 && (t = i)), e && (t = t + e), this._handler)
return t > -1 ? this.table.rowManager.getDisplayRows(t) : this.activeRows();
}
activeRows() {
return this.table.rowManager.activeRows;
}
refreshData(e, t) {
t || (t = this._handler), t && this.table.rowManager.refreshActiveData(t, !1, e);
}
///////////////////////////////////
//////// Footer Management ////////
///////////////////////////////////
footerAppend(e) {
return this.table.footerManager.append(e);
}
footerPrepend(e) {
return this.table.footerManager.prepend(e);
}
footerRemove(e) {
return this.table.footerManager.remove(e);
}
///////////////////////////////////
//////// Popups Management ////////
///////////////////////////////////
popup(e, t) {
return new BS(this.table, e, t);
}
///////////////////////////////////
//////// Alert Management ////////
///////////////////////////////////
alert(e, t) {
return this.table.alertManager.alert(e, t);
}
clearAlert() {
return this.table.alertManager.clear();
}
}
var OS = {
rownum: function(s, e, t, i, a, o) {
return o.getPosition();
}
};
const Co = class Co extends W {
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));
}
//initialize column accessor
initializeColumn(e) {
var t = !1, i = {};
this.allowedTypes.forEach((a) => {
var o = "accessor" + (a.charAt(0).toUpperCase() + a.slice(1)), r;
e.definition[o] && (r = this.lookupAccessor(e.definition[o]), r && (t = !0, i[o] = {
accessor: r,
params: e.definition[o + "Params"] || {}
}));
}), t && (e.modules.accessor = i);
}
lookupAccessor(e) {
var t = !1;
switch (typeof e) {
case "string":
Co.accessors[e] ? t = Co.accessors[e] : console.warn("Accessor Error - No such accessor found, ignoring: ", e);
break;
case "function":
t = e;
break;
}
return t;
}
//apply accessor to row
transformRow(e, t) {
var i = "accessor" + (t.charAt(0).toUpperCase() + t.slice(1)), a = e.getComponent(), o = ee.deepClone(e.data || {});
return this.table.columnManager.traverse(function(r) {
var l, h, d, c;
r.modules.accessor && (h = r.modules.accessor[i] || r.modules.accessor.accessor || !1, h && (l = r.getFieldValue(o), l != "undefined" && (c = r.getComponent(), d = typeof h.params == "function" ? h.params(l, o, t, c, a) : h.params, r.setFieldValue(o, h.accessor(l, o, t, d, c, a)))));
}), o;
}
};
T(Co, "moduleName", "accessor"), //load defaults
T(Co, "accessors", OS);
let nC = Co;
var jS = {
method: "GET"
};
function rC(s, e) {
var t = [];
if (e = e || "", Array.isArray(s))
s.forEach((a, o) => {
t = t.concat(rC(a, e ? e + "[" + o + "]" : o));
});
else if (typeof s == "object")
for (var i in s)
t = t.concat(rC(s[i], e ? e + "[" + i + "]" : i));
else
t.push({ key: e, value: s });
return t;
}
function NS(s) {
var e = rC(s), t = [];
return e.forEach(function(i) {
t.push(encodeURIComponent(i.key) + "=" + encodeURIComponent(i.value));
}), t.join("&");
}
function sL(s, e, t) {
return s && t && Object.keys(t).length && (!e.method || e.method.toLowerCase() == "get") && (e.method = "get", s += (s.includes("?") ? "&" : "?") + NS(t)), s;
}
function _S(s, e, t) {
var i;
return new Promise((a, o) => {
if (s = this.urlGenerator.call(this.table, s, e, t), e.method.toUpperCase() != "GET")
if (i = typeof this.table.options.ajaxContentType == "object" ? this.table.options.ajaxContentType : this.contentTypeFormatters[this.table.options.ajaxContentType], i) {
for (var r in i.headers)
e.headers || (e.headers = {}), typeof e.headers[r] > "u" && (e.headers[r] = i.headers[r]);
e.body = i.body.call(this, s, e, t);
} else
console.warn("Ajax Error - Invalid ajaxContentType value:", this.table.options.ajaxContentType);
s ? (typeof e.headers > "u" && (e.headers = {}), typeof e.headers.Accept > "u" && (e.headers.Accept = "application/json"), typeof e.headers["X-Requested-With"] > "u" && (e.headers["X-Requested-With"] = "XMLHttpRequest"), typeof e.mode > "u" && (e.mode = "cors"), e.mode == "cors" ? (typeof e.headers.Origin > "u" && (e.headers.Origin = window.location.origin), typeof e.credentials > "u" && (e.credentials = "same-origin")) : typeof e.credentials > "u" && (e.credentials = "include"), fetch(s, e).then((l) => {
l.ok ? l.json().then((h) => {
a(h);
}).catch((h) => {
o(h), console.warn("Ajax Load Error - Invalid JSON returned", h);
}) : (console.error("Ajax Load Error - Connection Error: " + l.status, l.statusText), o(l));
}).catch((l) => {
console.error("Ajax Load Error - Connection Error: ", l), o(l);
})) : (console.warn("Ajax Load Error - No URL Set"), a([]));
});
}
function lC(s, e) {
var t = [];
if (e = e || "", Array.isArray(s))
s.forEach((a, o) => {
t = t.concat(lC(a, e ? e + "[" + o + "]" : o));
});
else if (typeof s == "object")
for (var i in s)
t = t.concat(lC(s[i], e ? e + "[" + i + "]" : i));
else
t.push({ key: e, value: s });
return t;
}
var WS = {
json: {
headers: {
"Content-Type": "application/json"
},
body: function(s, e, t) {
return JSON.stringify(t);
}
},
form: {
headers: {},
body: function(s, e, t) {
var i = lC(t), a = new FormData();
return i.forEach(function(o) {
a.append(o.key, o.value);
}), a;
}
}
};
const _e = class _e extends W {
constructor(e) {
super(e), 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 setup options
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, i, a) {
var o = this.table.options.ajaxParams;
return o && (typeof o == "function" && (o = o.call(this.table)), a = Object.assign(Object.assign({}, o), a)), a;
}
requestDataCheck(e, t, i, a) {
return !!(!e && this.url || typeof e == "string");
}
requestData(e, t, i, a, o) {
var r;
return !o && this.requestDataCheck(e) ? (e && this.setUrl(e), r = this.generateConfig(i), this.sendRequest(this.url, t, r)) : o;
}
setDefaultConfig(e = {}) {
this.config = Object.assign({}, _e.defaultConfig), typeof e == "string" ? this.config.method = e : Object.assign(this.config, e);
}
//load config object
generateConfig(e = {}) {
var t = Object.assign({}, this.config);
return typeof e == "string" ? t.method = e : Object.assign(t, e), t;
}
//set request url
setUrl(e) {
this.url = e;
}
//get request url
getUrl() {
return this.url;
}
//send ajax request
sendRequest(e, t, i) {
return this.table.options.ajaxRequesting.call(this.table, e, t) !== !1 ? this.loaderPromise(e, i, t).then((a) => (this.table.options.ajaxResponse && (a = this.table.options.ajaxResponse.call(this.table, e, t, a)), a)) : Promise.reject();
}
};
T(_e, "moduleName", "ajax"), //load defaults
T(_e, "defaultConfig", jS), T(_e, "defaultURLGenerator", sL), T(_e, "defaultLoaderPromise", _S), T(_e, "contentTypeFormatters", WS);
let hC = _e;
var US = {
replace: function(s) {
return this.table.setData(s);
},
update: function(s) {
return this.table.updateOrAddData(s);
},
insert: function(s) {
return this.table.addData(s);
}
}, $S = {
table: function(s) {
var e = [], t = !0, i = this.table.columnManager.columns, a = [], o = [];
return s = s.split(`
`), s.forEach(function(r) {
e.push(r.split(" "));
}), e.length && !(e.length === 1 && e[0].length < 2) ? (e[0].forEach(function(r) {
var l = i.find(function(h) {
return r && h.definition.title && r.trim() && h.definition.title.trim() === r.trim();
});
l ? a.push(l) : t = !1;
}), t || (t = !0, a = [], e[0].forEach(function(r) {
var l = i.find(function(h) {
return r && h.field && r.trim() && h.field.trim() === r.trim();
});
l ? a.push(l) : t = !1;
}), t || (a = this.table.columnManager.columnsByIndex)), t && e.shift(), e.forEach(function(r) {
var l = {};
r.forEach(function(h, d) {
a[d] && (l[a[d].field] = h);
}), o.push(l);
}), o) : !1;
}
}, GS = {
copyToClipboard: ["ctrl + 67", "meta + 67"]
}, YS = {
copyToClipboard: function(s) {
this.table.modules.edit.currentCell || this.table.modExists("clipboard", !0) && this.table.modules.clipboard.copy(!1, !0);
}
}, ZS = {
keybindings: {
bindings: GS,
actions: YS
}
}, We;
let XS = (We = class extends W {
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, i, a;
this.blocked || (e.preventDefault(), this.customSelection ? (t = this.customSelection, this.table.options.clipboardCopyFormatter && (t = this.table.options.clipboardCopyFormatter("plain", t))) : (a = this.table.modules.export.generateExportList(this.table.options.clipboardCopyConfig, this.table.options.clipboardCopyStyled, this.rowRange, "clipboard"), i = this.table.modules.export.generateHTMLTable(a), t = i ? this.generatePlainContent(a) : "", this.table.options.clipboardCopyFormatter && (t = this.table.options.clipboardCopyFormatter("plain", t), i = this.table.options.clipboardCopyFormatter("html", i))), window.clipboardData && window.clipboardData.setData ? window.clipboardData.setData("Text", t) : e.clipboardData && e.clipboardData.setData ? (e.clipboardData.setData("text/plain", t), i && e.clipboardData.setData("text/html", i)) : e.originalEvent && e.originalEvent.clipboardData.setData && (e.originalEvent.clipboardData.setData("text/plain", t), i && e.originalEvent.clipboardData.setData("text/html", i)), this.dispatchExternal("clipboardCopied", t, i), 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((i) => {
var a = [];
i.columns.forEach((o) => {
var r = "";
if (o)
if (i.type === "group" && (o.value = o.component.getKey()), o.value === null)
r = "";
else
switch (typeof o.value) {
case "object":
r = JSON.stringify(o.value);
break;
case "undefined":
r = "";
break;
default:
r = o.value;
}
a.push(r);
}), t.push(a.join(" "));
}), t.join(`
`);
}
copy(e, t) {
var i, a;
this.blocked = !1, this.customSelection = !1, (this.mode === !0 || this.mode === "copy") && (this.rowRange = e || this.table.options.clipboardCopyRowRange, typeof window.getSelection < "u" && typeof document.createRange < "u" ? (e = document.createRange(), e.selectNodeContents(this.table.element), i = window.getSelection(), i.toString() && t && (this.customSelection = i.toString()), i.removeAllRanges(), i.addRange(e)) : typeof document.selection < "u" && typeof document.body.createTextRange < "u" && (a = document.body.createTextRange(), a.moveToElementText(this.table.element), a.select()), document.execCommand("copy"), i && i.removeAllRanges());
}
//PASTE EVENT HANDLING
setPasteAction(e) {
switch (typeof e) {
case "string":
this.pasteAction = We.pasteActions[e], this.pasteAction || console.warn("Clipboard Error - No such paste action found:", e);
break;
case "function":
this.pasteAction = e;
break;
}
}
setPasteParser(e) {
switch (typeof e) {
case "string":
this.pasteParser = We.pasteParsers[e], this.pasteParser || console.warn("Clipboard Error - No such paste parser found:", e);
break;
case "function":
this.pasteParser = e;
break;
}
}
paste(e) {
var t, i, a;
this.checkPasteOrigin(e) && (t = this.getPasteData(e), i = this.pasteParser.call(this, t), i ? (e.preventDefault(), this.table.modExists("mutator") && (i = this.mutateData(i)), a = this.pasteAction.call(this, i), this.dispatchExternal("clipboardPasted", t, i, a)) : this.dispatchExternal("clipboardPasteError", t));
}
mutateData(e) {
var t = [];
return Array.isArray(e) ? e.forEach((i) => {
t.push(this.table.modules.mutator.transformRow(i, "clipboard"));
}) : t = e, t;
}
checkPasteOrigin(e) {
var t = !0, i = this.confirm("clipboard-paste", [e]);
return (i || !["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;
}
}, T(We, "moduleName", "clipboard"), T(We, "moduleExtensions", ZS), //load defaults
T(We, "pasteActions", US), T(We, "pasteParsers", $S), We);
class KS {
constructor(e) {
return this._row = e, new Proxy(this, {
get: function(t, i, a) {
return typeof t[i] < "u" ? t[i] : t._row.table.componentFunctionBinder.handle("row", t._row, i);
}
});
}
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;
}
}
class oL {
constructor(e) {
return this._cell = e, new Proxy(this, {
get: function(t, i, a) {
return typeof t[i] < "u" ? t[i] : t._cell.table.componentFunctionBinder.handle("cell", t._cell, i);
}
});
}
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) {
typeof t > "u" && (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;
}
}
class Yo extends ke {
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();
}
//////////////// Setup Functions /////////////////
//generate element
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(), i = {
top: "flex-start",
bottom: "flex-end",
middle: "center"
}, a = {
left: "flex-start",
right: "flex-end",
center: "center"
};
if (e.style.textAlign = this.column.hozAlign, this.column.vertAlign && (e.style.display = "inline-flex", e.style.alignItems = i[this.column.vertAlign] || "", this.column.hozAlign && (e.style.justifyContent = a[this.column.hozAlign] || "")), t && e.setAttribute("tabulator-field", t), this.column.definition.cssClass) {
var o = this.column.definition.cssClass.split(" ");
o.forEach((r) => {
e.classList.add(r);
});
}
this.dispatch("cell-init", this), this.column.visible || this.hide();
}
//generate cell contents
_generateContents() {
var e;
switch (e = this.chain("cell-format", this, null, () => this.element.innerHTML = this.value), 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);
}
//////////////////// Getters ////////////////////
getElement(e) {
return this.loaded || (this.loaded = !0, e || this.layoutElement()), this.element;
}
getValue() {
return this.value;
}
getOldValue() {
return this.oldValue;
}
//////////////////// Actions ////////////////////
setValue(e, t, i) {
var a = this.setValueProcessData(e, t, i);
a && (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, i) {
var a = !1;
return (this.value !== e || i) && (a = !0, t && (e = this.chain("cell-value-changing", [this, e], null, e))), this.setValueActual(e), a && this.dispatch("cell-value-changed", this), a;
}
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);
}
//////////////// Object Generation /////////////////
getComponent() {
return this.component || (this.component = new oL(this)), this.component;
}
}
class nL {
constructor(e) {
return this._column = e, this.type = "ColumnComponent", new Proxy(this, {
get: function(t, i, a) {
return typeof t[i] < "u" ? t[i] : t._column.table.componentFunctionBinder.handle("column", t._column, i);
}
});
}
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 i = this._column.table.columnManager.findColumn(e);
i ? this._column.table.columnManager.moveColumn(this._column, i, t) : console.warn("Move Error - No matching column found:", i);
}
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;
return e === !0 ? t = this._column.reinitializeWidth(!0) : t = this._column.setWidth(e), this._column.table.columnManager.rerenderColumns(!0), t;
}
}
var rL = {
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
};
const lo = class lo extends ke {
constructor(e, t, i) {
super(t.table), this.definition = e, this.parent = t, this.type = "column", this.columns = [], this.cells = [], this.isGroup = !1, this.isRowHeader = i, 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((a, o) => {
var r = new lo(a, this);
this.attachColumn(r);
}), this.checkColumnVisibility()) : t.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 e = this.table.options.columnDefaults;
if (e)
for (let t in e)
typeof this.definition[t] > "u" && (this.definition[t] = e[t]);
this.definition = this.table.columnManager.optionsList.generate(lo.defaultOptionList, this.definition);
}
checkDefinition() {
Object.keys(this.definition).forEach((e) => {
lo.defaultOptionList.indexOf(e) === -1 && console.warn("Invalid column definition option in '" + (this.field || this.definition.title) + "' column:", e);
});
}
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;
}
//register column position with column manager
registerColumnPosition(e) {
this.parent.registerColumnPosition(e);
}
//register column position with column manager
registerColumnField(e) {
this.parent.registerColumnField(e);
}
//trigger position registration
reRegisterPosition() {
this.isGroup ? this.columns.forEach(function(e) {
e.reRegisterPosition();
}) : this.registerColumnPosition(this);
}
//build header element
_initialize() {
for (var e = this.definition; this.element.firstChild; ) this.element.removeChild(this.element.fir