@ed.yakovich/component-library 0.0.12 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/InfoBanner/index.js +4 -23
- package/dist/index-44540db3-BN5vFHKr.js +44 -0
- package/dist/index-4d46d9ca-BtyZMEt1.js +12 -0
- package/dist/index-D9BZSjMp.js +21158 -0
- package/dist/index-ba31999b-V1s4iffq.js +7451 -0
- package/dist/index.esm-a7c99373-DUoLYEEM.js +41 -0
- package/dist/main.js +1 -1
- package/dist/prism-accordion.entry-D4g7wdXB.js +51 -0
- package/dist/prism-avatar_3.entry-C1H9bg9y.js +335 -0
- package/dist/prism-badge.entry-CWLalQsR.js +56 -0
- package/dist/prism-banner.entry-D1sce4tY.js +105 -0
- package/dist/prism-breadcrumb.entry-C282yHQl.js +33 -0
- package/dist/prism-button_3.entry-DIg1AEXF.js +240 -0
- package/dist/prism-card.entry-DaxGD-uX.js +152 -0
- package/dist/prism-carousel.entry-BGmaoDVM.js +3346 -0
- package/dist/prism-checkbox-group.entry-Dwa_mvjd.js +62 -0
- package/dist/prism-checkbox.entry-CZvx2AHI.js +116 -0
- package/dist/prism-data-table.entry-DACAS8BE.js +3591 -0
- package/dist/prism-datepicker.entry-CHUyjilE.js +279 -0
- package/dist/prism-dialog.entry-DdO9Kt32.js +73 -0
- package/dist/prism-drawer.entry-Dn0rvW9U.js +43 -0
- package/dist/prism-form.entry-C8VzGp6c.js +42 -0
- package/dist/prism-header.entry-D0PypuC3.js +227 -0
- package/dist/prism-hero.entry-DQ8G7Jb_.js +23 -0
- package/dist/prism-image.entry-tx9Pc3k_.js +38 -0
- package/dist/prism-input-file.entry-CO-2LZxG.js +119 -0
- package/dist/prism-input-otp.entry-ZAxExI2D.js +79 -0
- package/dist/prism-input-text.entry-EXsN4rgi.js +278 -0
- package/dist/prism-input-textarea.entry-CRqY4mr9.js +145 -0
- package/dist/prism-input-time.entry-BJ9he6MX.js +85 -0
- package/dist/prism-layout.entry-ulDWjtj8.js +20 -0
- package/dist/prism-lineitem.entry-DJk6X6mR.js +47 -0
- package/dist/prism-modal.entry-C795YZic.js +95 -0
- package/dist/prism-pagination.entry-DYQieAu3.js +69 -0
- package/dist/prism-popover.entry-BgLcACZw.js +1114 -0
- package/dist/prism-progress.entry-Z21rpoTm.js +79 -0
- package/dist/prism-radio_2.entry-C0HPCb3G.js +159 -0
- package/dist/prism-select.entry-B_l-ab1d.js +286 -0
- package/dist/prism-switch.entry-OkC8X1bD.js +95 -0
- package/dist/prism-tab.entry-szftB_wL.js +20 -0
- package/dist/prism-tabs.entry-0UR3WF52.js +72 -0
- package/dist/prism-text.entry-BEAZ8xEV.js +28 -0
- package/dist/prism-treelist.entry-UX4FM4Bi.js +135 -0
- package/dist/prism-typeahead.entry-CwOiAFQE.js +1264 -0
- package/dist/purify-9647b094-0-ZyuBNz.js +572 -0
- package/package.json +3 -2
|
@@ -0,0 +1,3591 @@
|
|
|
1
|
+
var it = Object.defineProperty;
|
|
2
|
+
var rt = (d, t, e) => t in d ? it(d, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : d[t] = e;
|
|
3
|
+
var E = (d, t, e) => rt(d, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { r as ot, h as B, H as at } from "./index-D9BZSjMp.js";
|
|
5
|
+
import { g as st, m as lt } from "./index-44540db3-BN5vFHKr.js";
|
|
6
|
+
/*!
|
|
7
|
+
* Copyright (c) 2025 Comcast. Prism UI - v8.28.0 - made with ❤️ in Philadelphia
|
|
8
|
+
*/
|
|
9
|
+
class y {
|
|
10
|
+
constructor(t) {
|
|
11
|
+
this.table = t;
|
|
12
|
+
}
|
|
13
|
+
//////////////////////////////////////////
|
|
14
|
+
/////////////// DataLoad /////////////////
|
|
15
|
+
//////////////////////////////////////////
|
|
16
|
+
reloadData(t, e, i) {
|
|
17
|
+
return this.table.dataLoader.load(t, void 0, void 0, void 0, e, i);
|
|
18
|
+
}
|
|
19
|
+
//////////////////////////////////////////
|
|
20
|
+
///////////// Localization ///////////////
|
|
21
|
+
//////////////////////////////////////////
|
|
22
|
+
langText() {
|
|
23
|
+
return this.table.modules.localize.getText(...arguments);
|
|
24
|
+
}
|
|
25
|
+
langBind() {
|
|
26
|
+
return this.table.modules.localize.bind(...arguments);
|
|
27
|
+
}
|
|
28
|
+
langLocale() {
|
|
29
|
+
return this.table.modules.localize.getLocale(...arguments);
|
|
30
|
+
}
|
|
31
|
+
//////////////////////////////////////////
|
|
32
|
+
////////// Inter Table Comms /////////////
|
|
33
|
+
//////////////////////////////////////////
|
|
34
|
+
commsConnections() {
|
|
35
|
+
return this.table.modules.comms.getConnections(...arguments);
|
|
36
|
+
}
|
|
37
|
+
commsSend() {
|
|
38
|
+
return this.table.modules.comms.send(...arguments);
|
|
39
|
+
}
|
|
40
|
+
//////////////////////////////////////////
|
|
41
|
+
//////////////// Layout /////////////////
|
|
42
|
+
//////////////////////////////////////////
|
|
43
|
+
layoutMode() {
|
|
44
|
+
return this.table.modules.layout.getMode();
|
|
45
|
+
}
|
|
46
|
+
layoutRefresh(t) {
|
|
47
|
+
return this.table.modules.layout.layout(t);
|
|
48
|
+
}
|
|
49
|
+
//////////////////////////////////////////
|
|
50
|
+
/////////////// Event Bus ////////////////
|
|
51
|
+
//////////////////////////////////////////
|
|
52
|
+
subscribe() {
|
|
53
|
+
return this.table.eventBus.subscribe(...arguments);
|
|
54
|
+
}
|
|
55
|
+
unsubscribe() {
|
|
56
|
+
return this.table.eventBus.unsubscribe(...arguments);
|
|
57
|
+
}
|
|
58
|
+
subscribed(t) {
|
|
59
|
+
return this.table.eventBus.subscribed(t);
|
|
60
|
+
}
|
|
61
|
+
subscriptionChange() {
|
|
62
|
+
return this.table.eventBus.subscriptionChange(...arguments);
|
|
63
|
+
}
|
|
64
|
+
dispatch() {
|
|
65
|
+
return this.table.eventBus.dispatch(...arguments);
|
|
66
|
+
}
|
|
67
|
+
chain() {
|
|
68
|
+
return this.table.eventBus.chain(...arguments);
|
|
69
|
+
}
|
|
70
|
+
confirm() {
|
|
71
|
+
return this.table.eventBus.confirm(...arguments);
|
|
72
|
+
}
|
|
73
|
+
dispatchExternal() {
|
|
74
|
+
return this.table.externalEvents.dispatch(...arguments);
|
|
75
|
+
}
|
|
76
|
+
subscribedExternal(t) {
|
|
77
|
+
return this.table.externalEvents.subscribed(t);
|
|
78
|
+
}
|
|
79
|
+
subscriptionChangeExternal() {
|
|
80
|
+
return this.table.externalEvents.subscriptionChange(...arguments);
|
|
81
|
+
}
|
|
82
|
+
//////////////////////////////////////////
|
|
83
|
+
//////////////// Options /////////////////
|
|
84
|
+
//////////////////////////////////////////
|
|
85
|
+
options(t) {
|
|
86
|
+
return this.table.options[t];
|
|
87
|
+
}
|
|
88
|
+
setOption(t, e) {
|
|
89
|
+
return typeof e < "u" && (this.table.options[t] = e), this.table.options[t];
|
|
90
|
+
}
|
|
91
|
+
//////////////////////////////////////////
|
|
92
|
+
/////////// Deprecation Checks ///////////
|
|
93
|
+
//////////////////////////////////////////
|
|
94
|
+
deprecationCheck(t, e, i) {
|
|
95
|
+
return this.table.deprecationAdvisor.check(t, e, i);
|
|
96
|
+
}
|
|
97
|
+
deprecationCheckMsg(t, e) {
|
|
98
|
+
return this.table.deprecationAdvisor.checkMsg(t, e);
|
|
99
|
+
}
|
|
100
|
+
deprecationMsg(t) {
|
|
101
|
+
return this.table.deprecationAdvisor.msg(t);
|
|
102
|
+
}
|
|
103
|
+
//////////////////////////////////////////
|
|
104
|
+
//////////////// Modules /////////////////
|
|
105
|
+
//////////////////////////////////////////
|
|
106
|
+
module(t) {
|
|
107
|
+
return this.table.module(t);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
class v {
|
|
111
|
+
static elVisible(t) {
|
|
112
|
+
return !(t.offsetWidth <= 0 && t.offsetHeight <= 0);
|
|
113
|
+
}
|
|
114
|
+
static elOffset(t) {
|
|
115
|
+
var e = t.getBoundingClientRect();
|
|
116
|
+
return {
|
|
117
|
+
top: e.top + window.pageYOffset - document.documentElement.clientTop,
|
|
118
|
+
left: e.left + window.pageXOffset - document.documentElement.clientLeft
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
static retrieveNestedData(t, e, i) {
|
|
122
|
+
var r = t ? e.split(t) : [e], o = r.length, a;
|
|
123
|
+
for (let s = 0; s < o && (i = i[r[s]], a = i, !!i); s++)
|
|
124
|
+
;
|
|
125
|
+
return a;
|
|
126
|
+
}
|
|
127
|
+
static deepClone(t, e, i = []) {
|
|
128
|
+
var r = {}.__proto__, o = [].__proto__;
|
|
129
|
+
e || (e = Object.assign(Array.isArray(t) ? [] : {}, t));
|
|
130
|
+
for (var a in t) {
|
|
131
|
+
let s = t[a], l, n;
|
|
132
|
+
s != null && typeof s == "object" && (s.__proto__ === r || s.__proto__ === o) && (l = i.findIndex((h) => h.subject === s), l > -1 ? e[a] = i[l].copy : (n = Object.assign(Array.isArray(s) ? [] : {}, s), i.unshift({ subject: s, copy: n }), e[a] = this.deepClone(s, n, i)));
|
|
133
|
+
}
|
|
134
|
+
return e;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
let nt = class $ extends y {
|
|
138
|
+
constructor(t, e, i) {
|
|
139
|
+
super(t), this.element = e, 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;
|
|
140
|
+
}
|
|
141
|
+
tableDestroyed() {
|
|
142
|
+
this.destroyed = !0, this.hide(!0);
|
|
143
|
+
}
|
|
144
|
+
_lookupContainer() {
|
|
145
|
+
var t = this.table.options.popupContainer;
|
|
146
|
+
return typeof t == "string" ? (t = document.querySelector(t), t || console.warn("Menu Error - no container element found matching selector:", this.table.options.popupContainer, "(defaulting to document body)")) : t === !0 && (t = this.table.element), t && !this._checkContainerIsParent(t) && (t = !1, console.warn("Menu Error - container element does not contain this table:", this.table.options.popupContainer, "(defaulting to document body)")), t || (t = document.body), t;
|
|
147
|
+
}
|
|
148
|
+
_checkContainerIsParent(t, e = this.table.element) {
|
|
149
|
+
return t === e ? !0 : e.parentNode ? this._checkContainerIsParent(t, e.parentNode) : !1;
|
|
150
|
+
}
|
|
151
|
+
renderCallback(t) {
|
|
152
|
+
this.renderedCallback = t;
|
|
153
|
+
}
|
|
154
|
+
containerEventCoords(t) {
|
|
155
|
+
var e = !(t instanceof MouseEvent), i = e ? t.touches[0].pageX : t.pageX, r = e ? t.touches[0].pageY : t.pageY;
|
|
156
|
+
if (this.container !== document.body) {
|
|
157
|
+
let o = v.elOffset(this.container);
|
|
158
|
+
i -= o.left, r -= o.top;
|
|
159
|
+
}
|
|
160
|
+
return { x: i, y: r };
|
|
161
|
+
}
|
|
162
|
+
elementPositionCoords(t, e = "right") {
|
|
163
|
+
var i = v.elOffset(t), r, o, a;
|
|
164
|
+
switch (this.container !== document.body && (r = v.elOffset(this.container), i.left -= r.left, i.top -= r.top), e) {
|
|
165
|
+
case "right":
|
|
166
|
+
o = i.left + t.offsetWidth, a = i.top - 1;
|
|
167
|
+
break;
|
|
168
|
+
case "bottom":
|
|
169
|
+
o = i.left, a = i.top + t.offsetHeight;
|
|
170
|
+
break;
|
|
171
|
+
case "left":
|
|
172
|
+
o = i.left, a = i.top - 1;
|
|
173
|
+
break;
|
|
174
|
+
case "top":
|
|
175
|
+
o = i.left, a = i.top;
|
|
176
|
+
break;
|
|
177
|
+
case "center":
|
|
178
|
+
o = i.left + t.offsetWidth / 2, a = i.top + t.offsetHeight / 2;
|
|
179
|
+
break;
|
|
180
|
+
}
|
|
181
|
+
return { x: o, y: a, offset: i };
|
|
182
|
+
}
|
|
183
|
+
show(t, e) {
|
|
184
|
+
var i, r, o, a, s;
|
|
185
|
+
return this.destroyed || this.table.destroyed ? this : (t instanceof HTMLElement ? (o = t, s = this.elementPositionCoords(t, e), a = s.offset, i = s.x, r = s.y) : typeof t == "number" ? (a = { top: 0, left: 0 }, i = t, r = e) : (s = this.containerEventCoords(t), i = s.x, r = s.y, this.reversedX = !1), this.element.style.top = r + "px", this.element.style.left = i + "px", this.container.appendChild(this.element), typeof this.renderedCallback == "function" && this.renderedCallback(), this._fitToScreen(i, r, o, a, e), this.visible = !0, this.subscribe("table-destroy", this.destroyBinding), this.element.addEventListener("mousedown", (l) => {
|
|
186
|
+
l.stopPropagation();
|
|
187
|
+
}), this);
|
|
188
|
+
}
|
|
189
|
+
_fitToScreen(t, e, i, r, o) {
|
|
190
|
+
var a = this.container === document.body ? document.documentElement.scrollTop : this.container.scrollTop;
|
|
191
|
+
(t + this.element.offsetWidth >= this.container.offsetWidth || this.reversedX) && (this.element.style.left = "", i ? this.element.style.right = this.container.offsetWidth - r.left + "px" : this.element.style.right = this.container.offsetWidth - t + "px", this.reversedX = !0);
|
|
192
|
+
let s = Math.max(this.container.offsetHeight, a ? this.container.scrollHeight : 0);
|
|
193
|
+
if (e + this.element.offsetHeight > s)
|
|
194
|
+
if (i)
|
|
195
|
+
switch (o) {
|
|
196
|
+
case "bottom":
|
|
197
|
+
this.element.style.top = parseInt(this.element.style.top) - this.element.offsetHeight - i.offsetHeight - 1 + "px";
|
|
198
|
+
break;
|
|
199
|
+
default:
|
|
200
|
+
this.element.style.top = parseInt(this.element.style.top) - this.element.offsetHeight + i.offsetHeight + 1 + "px";
|
|
201
|
+
}
|
|
202
|
+
else
|
|
203
|
+
this.element.style.height = s + "px";
|
|
204
|
+
}
|
|
205
|
+
isVisible() {
|
|
206
|
+
return this.visible;
|
|
207
|
+
}
|
|
208
|
+
hideOnBlur(t) {
|
|
209
|
+
return this.blurable = !0, this.visible && (setTimeout(() => {
|
|
210
|
+
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);
|
|
211
|
+
}, 100), this.blurCallback = t), this;
|
|
212
|
+
}
|
|
213
|
+
_escapeCheck(t) {
|
|
214
|
+
t.keyCode == 27 && this.hide();
|
|
215
|
+
}
|
|
216
|
+
blockHide() {
|
|
217
|
+
this.hideable = !1;
|
|
218
|
+
}
|
|
219
|
+
restoreHide() {
|
|
220
|
+
this.hideable = !0;
|
|
221
|
+
}
|
|
222
|
+
hide(t = !1) {
|
|
223
|
+
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 && !t && this.blurCallback(), this.unsubscribe("table-destroy", this.destroyBinding)), this;
|
|
224
|
+
}
|
|
225
|
+
child(t) {
|
|
226
|
+
return this.childPopup && this.childPopup.hide(), this.childPopup = new $(this.table, t, this), this.childPopup;
|
|
227
|
+
}
|
|
228
|
+
};
|
|
229
|
+
class U extends y {
|
|
230
|
+
constructor(t, e) {
|
|
231
|
+
super(t), this._handler = null;
|
|
232
|
+
}
|
|
233
|
+
initialize() {
|
|
234
|
+
}
|
|
235
|
+
///////////////////////////////////
|
|
236
|
+
////// Options Registration ///////
|
|
237
|
+
///////////////////////////////////
|
|
238
|
+
registerTableOption(t, e) {
|
|
239
|
+
this.table.optionsList.register(t, e);
|
|
240
|
+
}
|
|
241
|
+
registerColumnOption(t, e) {
|
|
242
|
+
this.table.columnManager.optionsList.register(t, e);
|
|
243
|
+
}
|
|
244
|
+
///////////////////////////////////
|
|
245
|
+
/// Public Function Registration ///
|
|
246
|
+
///////////////////////////////////
|
|
247
|
+
registerTableFunction(t, e) {
|
|
248
|
+
typeof this.table[t] > "u" ? this.table[t] = (...i) => (this.table.initGuard(t), e(...i)) : console.warn("Unable to bind table function, name already in use", t);
|
|
249
|
+
}
|
|
250
|
+
registerComponentFunction(t, e, i) {
|
|
251
|
+
return this.table.componentFunctionBinder.bind(t, e, i);
|
|
252
|
+
}
|
|
253
|
+
///////////////////////////////////
|
|
254
|
+
////////// Data Pipeline //////////
|
|
255
|
+
///////////////////////////////////
|
|
256
|
+
registerDataHandler(t, e) {
|
|
257
|
+
this.table.rowManager.registerDataPipelineHandler(t, e), this._handler = t;
|
|
258
|
+
}
|
|
259
|
+
registerDisplayHandler(t, e) {
|
|
260
|
+
this.table.rowManager.registerDisplayPipelineHandler(t, e), this._handler = t;
|
|
261
|
+
}
|
|
262
|
+
displayRows(t) {
|
|
263
|
+
var e = this.table.rowManager.displayRows.length - 1, i;
|
|
264
|
+
if (this._handler && (i = this.table.rowManager.displayPipeline.findIndex((r) => r.handler === this._handler), i > -1 && (e = i)), t && (e = e + t), this._handler)
|
|
265
|
+
return e > -1 ? this.table.rowManager.getDisplayRows(e) : this.activeRows();
|
|
266
|
+
}
|
|
267
|
+
activeRows() {
|
|
268
|
+
return this.table.rowManager.activeRows;
|
|
269
|
+
}
|
|
270
|
+
refreshData(t, e) {
|
|
271
|
+
e || (e = this._handler), e && this.table.rowManager.refreshActiveData(e, !1, t);
|
|
272
|
+
}
|
|
273
|
+
///////////////////////////////////
|
|
274
|
+
//////// Footer Management ////////
|
|
275
|
+
///////////////////////////////////
|
|
276
|
+
footerAppend(t) {
|
|
277
|
+
return this.table.footerManager.append(t);
|
|
278
|
+
}
|
|
279
|
+
footerPrepend(t) {
|
|
280
|
+
return this.table.footerManager.prepend(t);
|
|
281
|
+
}
|
|
282
|
+
footerRemove(t) {
|
|
283
|
+
return this.table.footerManager.remove(t);
|
|
284
|
+
}
|
|
285
|
+
///////////////////////////////////
|
|
286
|
+
//////// Popups Management ////////
|
|
287
|
+
///////////////////////////////////
|
|
288
|
+
popup(t, e) {
|
|
289
|
+
return new nt(this.table, t, e);
|
|
290
|
+
}
|
|
291
|
+
///////////////////////////////////
|
|
292
|
+
//////// Alert Management ////////
|
|
293
|
+
///////////////////////////////////
|
|
294
|
+
alert(t, e) {
|
|
295
|
+
return this.table.alertManager.alert(t, e);
|
|
296
|
+
}
|
|
297
|
+
clearAlert() {
|
|
298
|
+
return this.table.alertManager.clear();
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
class ht {
|
|
302
|
+
constructor(t) {
|
|
303
|
+
return this._cell = t, new Proxy(this, {
|
|
304
|
+
get: function(e, i, r) {
|
|
305
|
+
return typeof e[i] < "u" ? e[i] : e._cell.table.componentFunctionBinder.handle("cell", e._cell, i);
|
|
306
|
+
}
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
getValue() {
|
|
310
|
+
return this._cell.getValue();
|
|
311
|
+
}
|
|
312
|
+
getOldValue() {
|
|
313
|
+
return this._cell.getOldValue();
|
|
314
|
+
}
|
|
315
|
+
getInitialValue() {
|
|
316
|
+
return this._cell.initialValue;
|
|
317
|
+
}
|
|
318
|
+
getElement() {
|
|
319
|
+
return this._cell.getElement();
|
|
320
|
+
}
|
|
321
|
+
getRow() {
|
|
322
|
+
return this._cell.row.getComponent();
|
|
323
|
+
}
|
|
324
|
+
getData(t) {
|
|
325
|
+
return this._cell.row.getData(t);
|
|
326
|
+
}
|
|
327
|
+
getType() {
|
|
328
|
+
return "cell";
|
|
329
|
+
}
|
|
330
|
+
getField() {
|
|
331
|
+
return this._cell.column.getField();
|
|
332
|
+
}
|
|
333
|
+
getColumn() {
|
|
334
|
+
return this._cell.column.getComponent();
|
|
335
|
+
}
|
|
336
|
+
setValue(t, e) {
|
|
337
|
+
typeof e > "u" && (e = !0), this._cell.setValue(t, e);
|
|
338
|
+
}
|
|
339
|
+
restoreOldValue() {
|
|
340
|
+
this._cell.setValueActual(this._cell.getOldValue());
|
|
341
|
+
}
|
|
342
|
+
restoreInitialValue() {
|
|
343
|
+
this._cell.setValueActual(this._cell.initialValue);
|
|
344
|
+
}
|
|
345
|
+
checkHeight() {
|
|
346
|
+
this._cell.checkHeight();
|
|
347
|
+
}
|
|
348
|
+
getTable() {
|
|
349
|
+
return this._cell.table;
|
|
350
|
+
}
|
|
351
|
+
_getSelf() {
|
|
352
|
+
return this._cell;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
class dt extends y {
|
|
356
|
+
constructor(t, e) {
|
|
357
|
+
super(t.table), this.table = t.table, this.column = t, this.row = e, this.element = null, this.value = null, this.oldValue = null, this.modules = {}, this.height = null, this.width = null, this.minWidth = null, this.component = null, this.loaded = !1, this.build();
|
|
358
|
+
}
|
|
359
|
+
//////////////// Setup Functions /////////////////
|
|
360
|
+
//generate element
|
|
361
|
+
build() {
|
|
362
|
+
this.generateElement(), this.setWidth(), this._configureCell(), this.setValueActual(this.column.getFieldValue(this.row.data)), this.initialValue = this.value;
|
|
363
|
+
}
|
|
364
|
+
generateElement() {
|
|
365
|
+
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");
|
|
366
|
+
}
|
|
367
|
+
_configureCell() {
|
|
368
|
+
var t = this.element, e = this.column.getField(), i = {
|
|
369
|
+
top: "flex-start",
|
|
370
|
+
bottom: "flex-end",
|
|
371
|
+
middle: "center"
|
|
372
|
+
}, r = {
|
|
373
|
+
left: "flex-start",
|
|
374
|
+
right: "flex-end",
|
|
375
|
+
center: "center"
|
|
376
|
+
};
|
|
377
|
+
if (t.style.textAlign = this.column.hozAlign, this.column.vertAlign && (t.style.display = "inline-flex", t.style.alignItems = i[this.column.vertAlign] || "", this.column.hozAlign && (t.style.justifyContent = r[this.column.hozAlign] || "")), e && t.setAttribute("tabulator-field", e), this.column.definition.cssClass) {
|
|
378
|
+
var o = this.column.definition.cssClass.split(" ");
|
|
379
|
+
o.forEach((a) => {
|
|
380
|
+
t.classList.add(a);
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
this.dispatch("cell-init", this), this.column.visible || this.hide();
|
|
384
|
+
}
|
|
385
|
+
//generate cell contents
|
|
386
|
+
_generateContents() {
|
|
387
|
+
var t;
|
|
388
|
+
switch (t = this.chain("cell-format", this, null, () => this.element.innerHTML = this.value), typeof t) {
|
|
389
|
+
case "object":
|
|
390
|
+
if (t instanceof Node) {
|
|
391
|
+
for (; this.element.firstChild; ) this.element.removeChild(this.element.firstChild);
|
|
392
|
+
this.element.appendChild(t);
|
|
393
|
+
} else
|
|
394
|
+
this.element.innerHTML = "", t != 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:", t);
|
|
395
|
+
break;
|
|
396
|
+
case "undefined":
|
|
397
|
+
this.element.innerHTML = "";
|
|
398
|
+
break;
|
|
399
|
+
default:
|
|
400
|
+
this.element.innerHTML = t;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
cellRendered() {
|
|
404
|
+
this.dispatch("cell-rendered", this);
|
|
405
|
+
}
|
|
406
|
+
//////////////////// Getters ////////////////////
|
|
407
|
+
getElement(t) {
|
|
408
|
+
return this.loaded || (this.loaded = !0, t || this.layoutElement()), this.element;
|
|
409
|
+
}
|
|
410
|
+
getValue() {
|
|
411
|
+
return this.value;
|
|
412
|
+
}
|
|
413
|
+
getOldValue() {
|
|
414
|
+
return this.oldValue;
|
|
415
|
+
}
|
|
416
|
+
//////////////////// Actions ////////////////////
|
|
417
|
+
setValue(t, e, i) {
|
|
418
|
+
var r = this.setValueProcessData(t, e, i);
|
|
419
|
+
r && (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()));
|
|
420
|
+
}
|
|
421
|
+
setValueProcessData(t, e, i) {
|
|
422
|
+
var r = !1;
|
|
423
|
+
return (this.value !== t || i) && (r = !0, e && (t = this.chain("cell-value-changing", [this, t], null, t))), this.setValueActual(t), r && this.dispatch("cell-value-changed", this), r;
|
|
424
|
+
}
|
|
425
|
+
setValueActual(t) {
|
|
426
|
+
this.oldValue = this.value, this.value = t, this.dispatch("cell-value-save-before", this), this.column.setFieldValue(this.row.data, t), this.dispatch("cell-value-save-after", this), this.loaded && this.layoutElement();
|
|
427
|
+
}
|
|
428
|
+
layoutElement() {
|
|
429
|
+
this._generateContents(), this.dispatch("cell-layout", this);
|
|
430
|
+
}
|
|
431
|
+
setWidth() {
|
|
432
|
+
this.width = this.column.width, this.element.style.width = this.column.widthStyled;
|
|
433
|
+
}
|
|
434
|
+
clearWidth() {
|
|
435
|
+
this.width = "", this.element.style.width = "";
|
|
436
|
+
}
|
|
437
|
+
getWidth() {
|
|
438
|
+
return this.width || this.element.offsetWidth;
|
|
439
|
+
}
|
|
440
|
+
setMinWidth() {
|
|
441
|
+
this.minWidth = this.column.minWidth, this.element.style.minWidth = this.column.minWidthStyled;
|
|
442
|
+
}
|
|
443
|
+
setMaxWidth() {
|
|
444
|
+
this.maxWidth = this.column.maxWidth, this.element.style.maxWidth = this.column.maxWidthStyled;
|
|
445
|
+
}
|
|
446
|
+
checkHeight() {
|
|
447
|
+
this.row.reinitializeHeight();
|
|
448
|
+
}
|
|
449
|
+
clearHeight() {
|
|
450
|
+
this.element.style.height = "", this.height = null, this.dispatch("cell-height", this, "");
|
|
451
|
+
}
|
|
452
|
+
setHeight() {
|
|
453
|
+
this.height = this.row.height, this.element.style.height = this.row.heightStyled, this.dispatch("cell-height", this, this.row.heightStyled);
|
|
454
|
+
}
|
|
455
|
+
getHeight() {
|
|
456
|
+
return this.height || this.element.offsetHeight;
|
|
457
|
+
}
|
|
458
|
+
show() {
|
|
459
|
+
this.element.style.display = this.column.vertAlign ? "inline-flex" : "";
|
|
460
|
+
}
|
|
461
|
+
hide() {
|
|
462
|
+
this.element.style.display = "none";
|
|
463
|
+
}
|
|
464
|
+
delete() {
|
|
465
|
+
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 = {};
|
|
466
|
+
}
|
|
467
|
+
getIndex() {
|
|
468
|
+
return this.row.getCellIndex(this);
|
|
469
|
+
}
|
|
470
|
+
//////////////// Object Generation /////////////////
|
|
471
|
+
getComponent() {
|
|
472
|
+
return this.component || (this.component = new ht(this)), this.component;
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
class Y {
|
|
476
|
+
constructor(t) {
|
|
477
|
+
return this._column = t, this.type = "ColumnComponent", new Proxy(this, {
|
|
478
|
+
get: function(e, i, r) {
|
|
479
|
+
return typeof e[i] < "u" ? e[i] : e._column.table.componentFunctionBinder.handle("column", e._column, i);
|
|
480
|
+
}
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
getElement() {
|
|
484
|
+
return this._column.getElement();
|
|
485
|
+
}
|
|
486
|
+
getDefinition() {
|
|
487
|
+
return this._column.getDefinition();
|
|
488
|
+
}
|
|
489
|
+
getField() {
|
|
490
|
+
return this._column.getField();
|
|
491
|
+
}
|
|
492
|
+
getTitleDownload() {
|
|
493
|
+
return this._column.getTitleDownload();
|
|
494
|
+
}
|
|
495
|
+
getCells() {
|
|
496
|
+
var t = [];
|
|
497
|
+
return this._column.cells.forEach(function(e) {
|
|
498
|
+
t.push(e.getComponent());
|
|
499
|
+
}), t;
|
|
500
|
+
}
|
|
501
|
+
isVisible() {
|
|
502
|
+
return this._column.visible;
|
|
503
|
+
}
|
|
504
|
+
show() {
|
|
505
|
+
this._column.isGroup ? this._column.columns.forEach(function(t) {
|
|
506
|
+
t.show();
|
|
507
|
+
}) : this._column.show();
|
|
508
|
+
}
|
|
509
|
+
hide() {
|
|
510
|
+
this._column.isGroup ? this._column.columns.forEach(function(t) {
|
|
511
|
+
t.hide();
|
|
512
|
+
}) : this._column.hide();
|
|
513
|
+
}
|
|
514
|
+
toggle() {
|
|
515
|
+
this._column.visible ? this.hide() : this.show();
|
|
516
|
+
}
|
|
517
|
+
delete() {
|
|
518
|
+
return this._column.delete();
|
|
519
|
+
}
|
|
520
|
+
getSubColumns() {
|
|
521
|
+
var t = [];
|
|
522
|
+
return this._column.columns.length && this._column.columns.forEach(function(e) {
|
|
523
|
+
t.push(e.getComponent());
|
|
524
|
+
}), t;
|
|
525
|
+
}
|
|
526
|
+
getParentColumn() {
|
|
527
|
+
return this._column.getParentComponent();
|
|
528
|
+
}
|
|
529
|
+
_getSelf() {
|
|
530
|
+
return this._column;
|
|
531
|
+
}
|
|
532
|
+
scrollTo(t, e) {
|
|
533
|
+
return this._column.table.columnManager.scrollToColumn(this._column, t, e);
|
|
534
|
+
}
|
|
535
|
+
getTable() {
|
|
536
|
+
return this._column.table;
|
|
537
|
+
}
|
|
538
|
+
move(t, e) {
|
|
539
|
+
var i = this._column.table.columnManager.findColumn(t);
|
|
540
|
+
i ? this._column.table.columnManager.moveColumn(this._column, i, e) : console.warn("Move Error - No matching column found:", i);
|
|
541
|
+
}
|
|
542
|
+
getNextColumn() {
|
|
543
|
+
var t = this._column.nextColumn();
|
|
544
|
+
return t ? t.getComponent() : !1;
|
|
545
|
+
}
|
|
546
|
+
getPrevColumn() {
|
|
547
|
+
var t = this._column.prevColumn();
|
|
548
|
+
return t ? t.getComponent() : !1;
|
|
549
|
+
}
|
|
550
|
+
updateDefinition(t) {
|
|
551
|
+
return this._column.updateDefinition(t);
|
|
552
|
+
}
|
|
553
|
+
getWidth() {
|
|
554
|
+
return this._column.getWidth();
|
|
555
|
+
}
|
|
556
|
+
setWidth(t) {
|
|
557
|
+
var e;
|
|
558
|
+
return t === !0 ? e = this._column.reinitializeWidth(!0) : e = this._column.setWidth(t), this._column.table.columnManager.rerenderColumns(!0), e;
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
var Q = {
|
|
562
|
+
title: void 0,
|
|
563
|
+
field: void 0,
|
|
564
|
+
columns: void 0,
|
|
565
|
+
visible: void 0,
|
|
566
|
+
hozAlign: void 0,
|
|
567
|
+
vertAlign: void 0,
|
|
568
|
+
width: void 0,
|
|
569
|
+
minWidth: 40,
|
|
570
|
+
maxWidth: void 0,
|
|
571
|
+
maxInitialWidth: void 0,
|
|
572
|
+
cssClass: void 0,
|
|
573
|
+
variableHeight: void 0,
|
|
574
|
+
headerVertical: void 0,
|
|
575
|
+
headerHozAlign: void 0,
|
|
576
|
+
headerWordWrap: !1,
|
|
577
|
+
editableTitle: void 0
|
|
578
|
+
};
|
|
579
|
+
const T = class T extends y {
|
|
580
|
+
constructor(t, e, i) {
|
|
581
|
+
super(e.table), this.definition = t, this.parent = e, 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((r, o) => {
|
|
582
|
+
var a = new T(r, this);
|
|
583
|
+
this.attachColumn(a);
|
|
584
|
+
}), this.checkColumnVisibility()) : e.registerColumnField(this), this._initialize();
|
|
585
|
+
}
|
|
586
|
+
createElement() {
|
|
587
|
+
var t = document.createElement("div");
|
|
588
|
+
switch (t.classList.add("tabulator-col"), t.setAttribute("role", "columnheader"), t.setAttribute("aria-sort", "none"), this.isRowHeader && t.classList.add("tabulator-row-header"), this.table.options.columnHeaderVertAlign) {
|
|
589
|
+
case "middle":
|
|
590
|
+
t.style.justifyContent = "center";
|
|
591
|
+
break;
|
|
592
|
+
case "bottom":
|
|
593
|
+
t.style.justifyContent = "flex-end";
|
|
594
|
+
break;
|
|
595
|
+
}
|
|
596
|
+
return t;
|
|
597
|
+
}
|
|
598
|
+
createGroupElement() {
|
|
599
|
+
var t = document.createElement("div");
|
|
600
|
+
return t.classList.add("tabulator-col-group-cols"), t;
|
|
601
|
+
}
|
|
602
|
+
mapDefinitions() {
|
|
603
|
+
var t = this.table.options.columnDefaults;
|
|
604
|
+
if (t)
|
|
605
|
+
for (let e in t)
|
|
606
|
+
typeof this.definition[e] > "u" && (this.definition[e] = t[e]);
|
|
607
|
+
this.definition = this.table.columnManager.optionsList.generate(T.defaultOptionList, this.definition);
|
|
608
|
+
}
|
|
609
|
+
checkDefinition() {
|
|
610
|
+
Object.keys(this.definition).forEach((t) => {
|
|
611
|
+
T.defaultOptionList.indexOf(t) === -1 && console.warn("Invalid column definition option in '" + (this.field || this.definition.title) + "' column:", t);
|
|
612
|
+
});
|
|
613
|
+
}
|
|
614
|
+
setField(t) {
|
|
615
|
+
this.field = t, this.fieldStructure = t ? this.table.options.nestedFieldSeparator ? t.split(this.table.options.nestedFieldSeparator) : [t] : [], this.getFieldValue = this.fieldStructure.length > 1 ? this._getNestedData : this._getFlatData, this.setFieldValue = this.fieldStructure.length > 1 ? this._setNestedData : this._setFlatData;
|
|
616
|
+
}
|
|
617
|
+
//register column position with column manager
|
|
618
|
+
registerColumnPosition(t) {
|
|
619
|
+
this.parent.registerColumnPosition(t);
|
|
620
|
+
}
|
|
621
|
+
//register column position with column manager
|
|
622
|
+
registerColumnField(t) {
|
|
623
|
+
this.parent.registerColumnField(t);
|
|
624
|
+
}
|
|
625
|
+
//trigger position registration
|
|
626
|
+
reRegisterPosition() {
|
|
627
|
+
this.isGroup ? this.columns.forEach(function(t) {
|
|
628
|
+
t.reRegisterPosition();
|
|
629
|
+
}) : this.registerColumnPosition(this);
|
|
630
|
+
}
|
|
631
|
+
//build header element
|
|
632
|
+
_initialize() {
|
|
633
|
+
for (var t = this.definition; this.element.firstChild; ) this.element.removeChild(this.element.firstChild);
|
|
634
|
+
t.headerVertical && (this.element.classList.add("tabulator-col-vertical"), t.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);
|
|
635
|
+
}
|
|
636
|
+
//build header element for header
|
|
637
|
+
_buildColumnHeader() {
|
|
638
|
+
var t = this.definition;
|
|
639
|
+
if (this.dispatch("column-layout", this), typeof t.visible < "u" && (t.visible ? this.show(!0) : this.hide(!0)), t.cssClass) {
|
|
640
|
+
var e = t.cssClass.split(" ");
|
|
641
|
+
e.forEach((i) => {
|
|
642
|
+
this.element.classList.add(i);
|
|
643
|
+
});
|
|
644
|
+
}
|
|
645
|
+
t.field && this.element.setAttribute("tabulator-field", t.field), this.setMinWidth(parseInt(t.minWidth)), t.maxInitialWidth && (this.maxInitialWidth = parseInt(t.maxInitialWidth)), t.maxWidth && this.setMaxWidth(parseInt(t.maxWidth)), this.reinitializeWidth(), this.hozAlign = this.definition.hozAlign, this.vertAlign = this.definition.vertAlign, this.titleElement.style.textAlign = this.definition.headerHozAlign;
|
|
646
|
+
}
|
|
647
|
+
_buildColumnHeaderContent() {
|
|
648
|
+
var t = document.createElement("div");
|
|
649
|
+
return t.classList.add("tabulator-col-content"), this.titleHolderElement = document.createElement("div"), this.titleHolderElement.classList.add("tabulator-col-title-holder"), t.appendChild(this.titleHolderElement), this.titleElement = this._buildColumnHeaderTitle(), this.titleHolderElement.appendChild(this.titleElement), t;
|
|
650
|
+
}
|
|
651
|
+
//build title element of column
|
|
652
|
+
_buildColumnHeaderTitle() {
|
|
653
|
+
var t = this.definition, e = document.createElement("div");
|
|
654
|
+
if (e.classList.add("tabulator-col-title"), t.headerWordWrap && e.classList.add("tabulator-col-title-wrap"), t.editableTitle) {
|
|
655
|
+
var i = document.createElement("input");
|
|
656
|
+
i.classList.add("tabulator-title-editor"), i.addEventListener("click", (r) => {
|
|
657
|
+
r.stopPropagation(), i.focus();
|
|
658
|
+
}), i.addEventListener("mousedown", (r) => {
|
|
659
|
+
r.stopPropagation();
|
|
660
|
+
}), i.addEventListener("change", () => {
|
|
661
|
+
t.title = i.value, this.dispatchExternal("columnTitleChanged", this.getComponent());
|
|
662
|
+
}), e.appendChild(i), t.field ? this.langBind("columns|" + t.field, (r) => {
|
|
663
|
+
i.value = r || t.title || " ";
|
|
664
|
+
}) : i.value = t.title || " ";
|
|
665
|
+
} else
|
|
666
|
+
t.field ? this.langBind("columns|" + t.field, (r) => {
|
|
667
|
+
this._formatColumnHeaderTitle(e, r || t.title || " ");
|
|
668
|
+
}) : this._formatColumnHeaderTitle(e, t.title || " ");
|
|
669
|
+
return e;
|
|
670
|
+
}
|
|
671
|
+
_formatColumnHeaderTitle(t, e) {
|
|
672
|
+
var i = this.chain("column-format", [this, e, t], null, () => e);
|
|
673
|
+
switch (typeof i) {
|
|
674
|
+
case "object":
|
|
675
|
+
i instanceof Node ? t.appendChild(i) : (t.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:", i));
|
|
676
|
+
break;
|
|
677
|
+
case "undefined":
|
|
678
|
+
t.innerHTML = "";
|
|
679
|
+
break;
|
|
680
|
+
default:
|
|
681
|
+
t.innerHTML = i;
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
//build header element for column group
|
|
685
|
+
_buildGroupHeader() {
|
|
686
|
+
if (this.element.classList.add("tabulator-col-group"), this.element.setAttribute("role", "columngroup"), this.element.setAttribute("aria-title", this.definition.title), this.definition.cssClass) {
|
|
687
|
+
var t = this.definition.cssClass.split(" ");
|
|
688
|
+
t.forEach((e) => {
|
|
689
|
+
this.element.classList.add(e);
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
this.titleElement.style.textAlign = this.definition.headerHozAlign, this.element.appendChild(this.groupElement);
|
|
693
|
+
}
|
|
694
|
+
//flat field lookup
|
|
695
|
+
_getFlatData(t) {
|
|
696
|
+
return t[this.field];
|
|
697
|
+
}
|
|
698
|
+
//nested field lookup
|
|
699
|
+
_getNestedData(t) {
|
|
700
|
+
var e = t, i = this.fieldStructure, r = i.length, o;
|
|
701
|
+
for (let a = 0; a < r && (e = e[i[a]], o = e, !!e); a++)
|
|
702
|
+
;
|
|
703
|
+
return o;
|
|
704
|
+
}
|
|
705
|
+
//flat field set
|
|
706
|
+
_setFlatData(t, e) {
|
|
707
|
+
this.field && (t[this.field] = e);
|
|
708
|
+
}
|
|
709
|
+
//nested field set
|
|
710
|
+
_setNestedData(t, e) {
|
|
711
|
+
var i = t, r = this.fieldStructure, o = r.length;
|
|
712
|
+
for (let a = 0; a < o; a++)
|
|
713
|
+
if (a == o - 1)
|
|
714
|
+
i[r[a]] = e;
|
|
715
|
+
else {
|
|
716
|
+
if (!i[r[a]])
|
|
717
|
+
if (typeof e < "u")
|
|
718
|
+
i[r[a]] = {};
|
|
719
|
+
else
|
|
720
|
+
break;
|
|
721
|
+
i = i[r[a]];
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
//attach column to this group
|
|
725
|
+
attachColumn(t) {
|
|
726
|
+
this.groupElement ? (this.columns.push(t), this.groupElement.appendChild(t.getElement()), t.columnRendered()) : console.warn("Column Warning - Column being attached to another column instead of column group");
|
|
727
|
+
}
|
|
728
|
+
//vertically align header in column
|
|
729
|
+
verticalAlign(t, e) {
|
|
730
|
+
var i = this.parent.isGroup ? this.parent.getGroupElement().clientHeight : e || this.parent.getHeadersElement().clientHeight;
|
|
731
|
+
this.element.style.height = i + "px", this.dispatch("column-height", this, this.element.style.height), this.isGroup && (this.groupElement.style.minHeight = i - this.contentElement.offsetHeight + "px"), this.columns.forEach(function(r) {
|
|
732
|
+
r.verticalAlign(t);
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
//clear vertical alignment
|
|
736
|
+
clearVerticalAlign() {
|
|
737
|
+
this.element.style.paddingTop = "", this.element.style.height = "", this.element.style.minHeight = "", this.groupElement.style.minHeight = "", this.columns.forEach(function(t) {
|
|
738
|
+
t.clearVerticalAlign();
|
|
739
|
+
}), this.dispatch("column-height", this, "");
|
|
740
|
+
}
|
|
741
|
+
//// Retrieve Column Information ////
|
|
742
|
+
//return column header element
|
|
743
|
+
getElement() {
|
|
744
|
+
return this.element;
|
|
745
|
+
}
|
|
746
|
+
//return column group element
|
|
747
|
+
getGroupElement() {
|
|
748
|
+
return this.groupElement;
|
|
749
|
+
}
|
|
750
|
+
//return field name
|
|
751
|
+
getField() {
|
|
752
|
+
return this.field;
|
|
753
|
+
}
|
|
754
|
+
getTitleDownload() {
|
|
755
|
+
return this.titleDownload;
|
|
756
|
+
}
|
|
757
|
+
//return the first column in a group
|
|
758
|
+
getFirstColumn() {
|
|
759
|
+
return this.isGroup ? this.columns.length ? this.columns[0].getFirstColumn() : !1 : this;
|
|
760
|
+
}
|
|
761
|
+
//return the last column in a group
|
|
762
|
+
getLastColumn() {
|
|
763
|
+
return this.isGroup ? this.columns.length ? this.columns[this.columns.length - 1].getLastColumn() : !1 : this;
|
|
764
|
+
}
|
|
765
|
+
//return all columns in a group
|
|
766
|
+
getColumns(t) {
|
|
767
|
+
var e = [];
|
|
768
|
+
return t ? this.columns.forEach((i) => {
|
|
769
|
+
e.push(i), e = e.concat(i.getColumns(!0));
|
|
770
|
+
}) : e = this.columns, e;
|
|
771
|
+
}
|
|
772
|
+
//return all columns in a group
|
|
773
|
+
getCells() {
|
|
774
|
+
return this.cells;
|
|
775
|
+
}
|
|
776
|
+
//retrieve the top column in a group of columns
|
|
777
|
+
getTopColumn() {
|
|
778
|
+
return this.parent.isGroup ? this.parent.getTopColumn() : this;
|
|
779
|
+
}
|
|
780
|
+
//return column definition object
|
|
781
|
+
getDefinition(t) {
|
|
782
|
+
var e = [];
|
|
783
|
+
return this.isGroup && t && (this.columns.forEach(function(i) {
|
|
784
|
+
e.push(i.getDefinition(!0));
|
|
785
|
+
}), this.definition.columns = e), this.definition;
|
|
786
|
+
}
|
|
787
|
+
//////////////////// Actions ////////////////////
|
|
788
|
+
checkColumnVisibility() {
|
|
789
|
+
var t = !1;
|
|
790
|
+
this.columns.forEach(function(e) {
|
|
791
|
+
e.visible && (t = !0);
|
|
792
|
+
}), t ? (this.show(), this.dispatchExternal("columnVisibilityChanged", this.getComponent(), !1)) : this.hide();
|
|
793
|
+
}
|
|
794
|
+
//show column
|
|
795
|
+
show(t, e) {
|
|
796
|
+
this.visible || (this.visible = !0, this.element.style.display = "", this.parent.isGroup && this.parent.checkColumnVisibility(), this.cells.forEach(function(i) {
|
|
797
|
+
i.show();
|
|
798
|
+
}), !this.isGroup && this.width === null && this.reinitializeWidth(), this.table.columnManager.verticalAlignHeaders(), this.dispatch("column-show", this, e), t || this.dispatchExternal("columnVisibilityChanged", this.getComponent(), !0), this.parent.isGroup && this.parent.matchChildWidths(), this.silent || this.table.columnManager.rerenderColumns());
|
|
799
|
+
}
|
|
800
|
+
//hide column
|
|
801
|
+
hide(t, e) {
|
|
802
|
+
this.visible && (this.visible = !1, this.element.style.display = "none", this.table.columnManager.verticalAlignHeaders(), this.parent.isGroup && this.parent.checkColumnVisibility(), this.cells.forEach(function(i) {
|
|
803
|
+
i.hide();
|
|
804
|
+
}), this.dispatch("column-hide", this, e), t || this.dispatchExternal("columnVisibilityChanged", this.getComponent(), !1), this.parent.isGroup && this.parent.matchChildWidths(), this.silent || this.table.columnManager.rerenderColumns());
|
|
805
|
+
}
|
|
806
|
+
matchChildWidths() {
|
|
807
|
+
var t = 0;
|
|
808
|
+
this.contentElement && this.columns.length && (this.columns.forEach(function(e) {
|
|
809
|
+
e.visible && (t += e.getWidth());
|
|
810
|
+
}), this.contentElement.style.maxWidth = t - 1 + "px", this.table.initialized && (this.element.style.width = t + "px"), this.parent.isGroup && this.parent.matchChildWidths());
|
|
811
|
+
}
|
|
812
|
+
removeChild(t) {
|
|
813
|
+
var e = this.columns.indexOf(t);
|
|
814
|
+
e > -1 && this.columns.splice(e, 1), this.columns.length || this.delete();
|
|
815
|
+
}
|
|
816
|
+
setWidth(t) {
|
|
817
|
+
this.widthFixed = !0, this.setWidthActual(t);
|
|
818
|
+
}
|
|
819
|
+
setWidthActual(t) {
|
|
820
|
+
isNaN(t) && (t = Math.floor(this.table.element.clientWidth / 100 * parseInt(t))), t = Math.max(this.minWidth, t), this.maxWidth && (t = Math.min(this.maxWidth, t)), this.width = t, this.widthStyled = t ? t + "px" : "", this.element.style.width = this.widthStyled, this.isGroup || this.cells.forEach(function(e) {
|
|
821
|
+
e.setWidth();
|
|
822
|
+
}), this.parent.isGroup && this.parent.matchChildWidths(), this.dispatch("column-width", this), this.subscribedExternal("columnWidth") && this.dispatchExternal("columnWidth", this.getComponent());
|
|
823
|
+
}
|
|
824
|
+
checkCellHeights() {
|
|
825
|
+
var t = [];
|
|
826
|
+
this.cells.forEach(function(e) {
|
|
827
|
+
e.row.heightInitialized && (e.row.getElement().offsetParent !== null ? (t.push(e.row), e.row.clearCellHeight()) : e.row.heightInitialized = !1);
|
|
828
|
+
}), t.forEach(function(e) {
|
|
829
|
+
e.calcHeight();
|
|
830
|
+
}), t.forEach(function(e) {
|
|
831
|
+
e.setCellHeight();
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
getWidth() {
|
|
835
|
+
var t = 0;
|
|
836
|
+
return this.isGroup ? this.columns.forEach(function(e) {
|
|
837
|
+
e.visible && (t += e.getWidth());
|
|
838
|
+
}) : t = this.width, t;
|
|
839
|
+
}
|
|
840
|
+
getLeftOffset() {
|
|
841
|
+
var t = this.element.offsetLeft;
|
|
842
|
+
return this.parent.isGroup && (t += this.parent.getLeftOffset()), t;
|
|
843
|
+
}
|
|
844
|
+
getHeight() {
|
|
845
|
+
return Math.ceil(this.element.getBoundingClientRect().height);
|
|
846
|
+
}
|
|
847
|
+
setMinWidth(t) {
|
|
848
|
+
this.maxWidth && t > this.maxWidth && (t = this.maxWidth, console.warn("the minWidth (" + t + "px) for column '" + this.field + "' cannot be bigger that its maxWidth (" + this.maxWidthStyled + ")")), this.minWidth = t, this.minWidthStyled = t ? t + "px" : "", this.element.style.minWidth = this.minWidthStyled, this.cells.forEach(function(e) {
|
|
849
|
+
e.setMinWidth();
|
|
850
|
+
});
|
|
851
|
+
}
|
|
852
|
+
setMaxWidth(t) {
|
|
853
|
+
this.minWidth && t < this.minWidth && (t = this.minWidth, console.warn("the maxWidth (" + t + "px) for column '" + this.field + "' cannot be smaller that its minWidth (" + this.minWidthStyled + ")")), this.maxWidth = t, this.maxWidthStyled = t ? t + "px" : "", this.element.style.maxWidth = this.maxWidthStyled, this.cells.forEach(function(e) {
|
|
854
|
+
e.setMaxWidth();
|
|
855
|
+
});
|
|
856
|
+
}
|
|
857
|
+
delete() {
|
|
858
|
+
return new Promise((t, e) => {
|
|
859
|
+
this.isGroup && this.columns.forEach(function(r) {
|
|
860
|
+
r.delete();
|
|
861
|
+
}), this.dispatch("column-delete", this);
|
|
862
|
+
var i = this.cells.length;
|
|
863
|
+
for (let r = 0; r < i; r++)
|
|
864
|
+
this.cells[0].delete();
|
|
865
|
+
this.element.parentNode && this.element.parentNode.removeChild(this.element), this.element = !1, this.contentElement = !1, this.titleElement = !1, this.groupElement = !1, this.parent.isGroup && this.parent.removeChild(this), this.table.columnManager.deregisterColumn(this), this.table.columnManager.rerenderColumns(!0), this.dispatch("column-deleted", this), t();
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
columnRendered() {
|
|
869
|
+
this.titleFormatterRendered && this.titleFormatterRendered(), this.dispatch("column-rendered", this);
|
|
870
|
+
}
|
|
871
|
+
//////////////// Cell Management /////////////////
|
|
872
|
+
//generate cell for this column
|
|
873
|
+
generateCell(t) {
|
|
874
|
+
var e = new dt(this, t);
|
|
875
|
+
return this.cells.push(e), e;
|
|
876
|
+
}
|
|
877
|
+
nextColumn() {
|
|
878
|
+
var t = this.table.columnManager.findColumnIndex(this);
|
|
879
|
+
return t > -1 ? this._nextVisibleColumn(t + 1) : !1;
|
|
880
|
+
}
|
|
881
|
+
_nextVisibleColumn(t) {
|
|
882
|
+
var e = this.table.columnManager.getColumnByIndex(t);
|
|
883
|
+
return !e || e.visible ? e : this._nextVisibleColumn(t + 1);
|
|
884
|
+
}
|
|
885
|
+
prevColumn() {
|
|
886
|
+
var t = this.table.columnManager.findColumnIndex(this);
|
|
887
|
+
return t > -1 ? this._prevVisibleColumn(t - 1) : !1;
|
|
888
|
+
}
|
|
889
|
+
_prevVisibleColumn(t) {
|
|
890
|
+
var e = this.table.columnManager.getColumnByIndex(t);
|
|
891
|
+
return !e || e.visible ? e : this._prevVisibleColumn(t - 1);
|
|
892
|
+
}
|
|
893
|
+
reinitializeWidth(t) {
|
|
894
|
+
this.widthFixed = !1, typeof this.definition.width < "u" && !t && this.setWidth(this.definition.width), this.dispatch("column-width-fit-before", this), this.fitToData(t), this.dispatch("column-width-fit-after", this);
|
|
895
|
+
}
|
|
896
|
+
//set column width to maximum cell width for non group columns
|
|
897
|
+
fitToData(t) {
|
|
898
|
+
if (!this.isGroup) {
|
|
899
|
+
this.widthFixed || (this.element.style.width = "", this.cells.forEach((r) => {
|
|
900
|
+
r.clearWidth();
|
|
901
|
+
}));
|
|
902
|
+
var e = this.element.offsetWidth;
|
|
903
|
+
if ((!this.width || !this.widthFixed) && (this.cells.forEach((r) => {
|
|
904
|
+
var o = r.getWidth();
|
|
905
|
+
o > e && (e = o);
|
|
906
|
+
}), e)) {
|
|
907
|
+
var i = e + 1;
|
|
908
|
+
t ? this.setWidth(i) : (this.maxInitialWidth && !t && (i = Math.min(i, this.maxInitialWidth)), this.setWidthActual(i));
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
updateDefinition(t) {
|
|
913
|
+
var e;
|
|
914
|
+
return this.isGroup || this.parent.isGroup ? (console.error("Column Update Error - The updateDefinition function is only available on ungrouped columns"), Promise.reject("Column Update Error - The updateDefinition function is only available on columns, not column groups")) : (e = Object.assign({}, this.getDefinition()), e = Object.assign(e, t), this.table.columnManager.addColumn(e, !1, this).then((i) => (e.field == this.field && (this.field = !1), this.delete().then(() => i.getComponent()))));
|
|
915
|
+
}
|
|
916
|
+
deleteCell(t) {
|
|
917
|
+
var e = this.cells.indexOf(t);
|
|
918
|
+
e > -1 && this.cells.splice(e, 1);
|
|
919
|
+
}
|
|
920
|
+
//////////////// Object Generation /////////////////
|
|
921
|
+
getComponent() {
|
|
922
|
+
return this.component || (this.component = new Y(this)), this.component;
|
|
923
|
+
}
|
|
924
|
+
getPosition() {
|
|
925
|
+
return this.table.columnManager.getVisibleColumnsByIndex().indexOf(this) + 1;
|
|
926
|
+
}
|
|
927
|
+
getParentComponent() {
|
|
928
|
+
return this.parent instanceof T ? this.parent.getComponent() : !1;
|
|
929
|
+
}
|
|
930
|
+
};
|
|
931
|
+
E(T, "defaultOptionList", Q);
|
|
932
|
+
let A = T;
|
|
933
|
+
class Z {
|
|
934
|
+
constructor(t) {
|
|
935
|
+
return this._row = t, new Proxy(this, {
|
|
936
|
+
get: function(e, i, r) {
|
|
937
|
+
return typeof e[i] < "u" ? e[i] : e._row.table.componentFunctionBinder.handle("row", e._row, i);
|
|
938
|
+
}
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
getData(t) {
|
|
942
|
+
return this._row.getData(t);
|
|
943
|
+
}
|
|
944
|
+
getElement() {
|
|
945
|
+
return this._row.getElement();
|
|
946
|
+
}
|
|
947
|
+
getCells() {
|
|
948
|
+
var t = [];
|
|
949
|
+
return this._row.getCells().forEach(function(e) {
|
|
950
|
+
t.push(e.getComponent());
|
|
951
|
+
}), t;
|
|
952
|
+
}
|
|
953
|
+
getCell(t) {
|
|
954
|
+
var e = this._row.getCell(t);
|
|
955
|
+
return e ? e.getComponent() : !1;
|
|
956
|
+
}
|
|
957
|
+
getIndex() {
|
|
958
|
+
return this._row.getData("data")[this._row.table.options.index];
|
|
959
|
+
}
|
|
960
|
+
getPosition() {
|
|
961
|
+
return this._row.getPosition();
|
|
962
|
+
}
|
|
963
|
+
watchPosition(t) {
|
|
964
|
+
return this._row.watchPosition(t);
|
|
965
|
+
}
|
|
966
|
+
delete() {
|
|
967
|
+
return this._row.delete();
|
|
968
|
+
}
|
|
969
|
+
scrollTo(t, e) {
|
|
970
|
+
return this._row.table.rowManager.scrollToRow(this._row, t, e);
|
|
971
|
+
}
|
|
972
|
+
move(t, e) {
|
|
973
|
+
this._row.moveToRow(t, e);
|
|
974
|
+
}
|
|
975
|
+
update(t) {
|
|
976
|
+
return this._row.updateData(t);
|
|
977
|
+
}
|
|
978
|
+
normalizeHeight() {
|
|
979
|
+
this._row.normalizeHeight(!0);
|
|
980
|
+
}
|
|
981
|
+
_getSelf() {
|
|
982
|
+
return this._row;
|
|
983
|
+
}
|
|
984
|
+
reformat() {
|
|
985
|
+
return this._row.reinitialize();
|
|
986
|
+
}
|
|
987
|
+
getTable() {
|
|
988
|
+
return this._row.table;
|
|
989
|
+
}
|
|
990
|
+
getNextRow() {
|
|
991
|
+
var t = this._row.nextRow();
|
|
992
|
+
return t && t.getComponent();
|
|
993
|
+
}
|
|
994
|
+
getPrevRow() {
|
|
995
|
+
var t = this._row.prevRow();
|
|
996
|
+
return t && t.getComponent();
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
class k extends y {
|
|
1000
|
+
constructor(t, e, i = "row") {
|
|
1001
|
+
super(e.table), this.parent = e, this.data = {}, this.type = i, this.element = !1, this.modules = {}, this.cells = [], this.height = 0, this.heightStyled = "", this.manualHeight = !1, this.outerHeight = 0, this.initialized = !1, this.heightInitialized = !1, this.position = 0, this.positionWatchers = [], this.component = null, this.created = !1, this.setData(t);
|
|
1002
|
+
}
|
|
1003
|
+
create() {
|
|
1004
|
+
this.created || (this.created = !0, this.generateElement());
|
|
1005
|
+
}
|
|
1006
|
+
createElement() {
|
|
1007
|
+
var t = document.createElement("div");
|
|
1008
|
+
t.classList.add("tabulator-row"), t.setAttribute("role", "row"), this.element = t;
|
|
1009
|
+
}
|
|
1010
|
+
getElement() {
|
|
1011
|
+
return this.create(), this.element;
|
|
1012
|
+
}
|
|
1013
|
+
detachElement() {
|
|
1014
|
+
this.element && this.element.parentNode && this.element.parentNode.removeChild(this.element);
|
|
1015
|
+
}
|
|
1016
|
+
generateElement() {
|
|
1017
|
+
this.createElement(), this.dispatch("row-init", this);
|
|
1018
|
+
}
|
|
1019
|
+
generateCells() {
|
|
1020
|
+
this.cells = this.table.columnManager.generateCells(this);
|
|
1021
|
+
}
|
|
1022
|
+
//functions to setup on first render
|
|
1023
|
+
initialize(t, e) {
|
|
1024
|
+
if (this.create(), !this.initialized || t) {
|
|
1025
|
+
for (this.deleteCells(); this.element.firstChild; ) this.element.removeChild(this.element.firstChild);
|
|
1026
|
+
this.dispatch("row-layout-before", this), this.generateCells(), this.initialized = !0, this.table.columnManager.renderer.renderRowCells(this, e), t && this.normalizeHeight(), this.dispatch("row-layout", this), this.table.options.rowFormatter && this.table.options.rowFormatter(this.getComponent()), this.dispatch("row-layout-after", this);
|
|
1027
|
+
} else
|
|
1028
|
+
this.table.columnManager.renderer.rerenderRowCells(this, e);
|
|
1029
|
+
}
|
|
1030
|
+
rendered() {
|
|
1031
|
+
this.cells.forEach((t) => {
|
|
1032
|
+
t.cellRendered();
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
reinitializeHeight() {
|
|
1036
|
+
this.heightInitialized = !1, this.element && this.element.offsetParent !== null && this.normalizeHeight(!0);
|
|
1037
|
+
}
|
|
1038
|
+
deinitialize() {
|
|
1039
|
+
this.initialized = !1;
|
|
1040
|
+
}
|
|
1041
|
+
deinitializeHeight() {
|
|
1042
|
+
this.heightInitialized = !1;
|
|
1043
|
+
}
|
|
1044
|
+
reinitialize(t) {
|
|
1045
|
+
this.initialized = !1, this.heightInitialized = !1, this.manualHeight || (this.height = 0, this.heightStyled = ""), this.element && this.element.offsetParent !== null && this.initialize(!0), this.dispatch("row-relayout", this);
|
|
1046
|
+
}
|
|
1047
|
+
//get heights when doing bulk row style calcs in virtual DOM
|
|
1048
|
+
calcHeight(t) {
|
|
1049
|
+
var e = 0, i = 0;
|
|
1050
|
+
this.table.options.rowHeight ? this.height = this.table.options.rowHeight : (i = this.calcMinHeight(), e = this.calcMaxHeight(), t ? this.height = Math.max(e, i) : this.height = this.manualHeight ? this.height : Math.max(e, i)), this.heightStyled = this.height ? this.height + "px" : "", this.outerHeight = this.element.offsetHeight;
|
|
1051
|
+
}
|
|
1052
|
+
calcMinHeight() {
|
|
1053
|
+
return this.table.options.resizableRows ? this.element.clientHeight : 0;
|
|
1054
|
+
}
|
|
1055
|
+
calcMaxHeight() {
|
|
1056
|
+
var t = 0;
|
|
1057
|
+
return this.cells.forEach(function(e) {
|
|
1058
|
+
var i = e.getHeight();
|
|
1059
|
+
i > t && (t = i);
|
|
1060
|
+
}), t;
|
|
1061
|
+
}
|
|
1062
|
+
//set of cells
|
|
1063
|
+
setCellHeight() {
|
|
1064
|
+
this.cells.forEach(function(t) {
|
|
1065
|
+
t.setHeight();
|
|
1066
|
+
}), this.heightInitialized = !0;
|
|
1067
|
+
}
|
|
1068
|
+
clearCellHeight() {
|
|
1069
|
+
this.cells.forEach(function(t) {
|
|
1070
|
+
t.clearHeight();
|
|
1071
|
+
});
|
|
1072
|
+
}
|
|
1073
|
+
//normalize the height of elements in the row
|
|
1074
|
+
normalizeHeight(t) {
|
|
1075
|
+
t && !this.table.options.rowHeight && this.clearCellHeight(), this.calcHeight(t), this.setCellHeight();
|
|
1076
|
+
}
|
|
1077
|
+
//set height of rows
|
|
1078
|
+
setHeight(t, e) {
|
|
1079
|
+
(this.height != t || e) && (this.manualHeight = !0, this.height = t, this.heightStyled = t ? t + "px" : "", this.setCellHeight(), this.outerHeight = this.element.offsetHeight, this.subscribedExternal("rowHeight") && this.dispatchExternal("rowHeight", this.getComponent()));
|
|
1080
|
+
}
|
|
1081
|
+
//return rows outer height
|
|
1082
|
+
getHeight() {
|
|
1083
|
+
return this.outerHeight;
|
|
1084
|
+
}
|
|
1085
|
+
//return rows outer Width
|
|
1086
|
+
getWidth() {
|
|
1087
|
+
return this.element.offsetWidth;
|
|
1088
|
+
}
|
|
1089
|
+
//////////////// Cell Management /////////////////
|
|
1090
|
+
deleteCell(t) {
|
|
1091
|
+
var e = this.cells.indexOf(t);
|
|
1092
|
+
e > -1 && this.cells.splice(e, 1);
|
|
1093
|
+
}
|
|
1094
|
+
//////////////// Data Management /////////////////
|
|
1095
|
+
setData(t) {
|
|
1096
|
+
this.data = this.chain("row-data-init-before", [this, t], void 0, t), this.dispatch("row-data-init-after", this);
|
|
1097
|
+
}
|
|
1098
|
+
//update the rows data
|
|
1099
|
+
updateData(t) {
|
|
1100
|
+
var e = this.element && v.elVisible(this.element), i = {}, r;
|
|
1101
|
+
return new Promise((o, a) => {
|
|
1102
|
+
typeof t == "string" && (t = JSON.parse(t)), this.dispatch("row-data-save-before", this), this.subscribed("row-data-changing") && (i = Object.assign(i, this.data), i = Object.assign(i, t)), r = this.chain("row-data-changing", [this, i, t], null, t);
|
|
1103
|
+
for (let s in r)
|
|
1104
|
+
this.data[s] = r[s];
|
|
1105
|
+
this.dispatch("row-data-save-after", this);
|
|
1106
|
+
for (let s in t)
|
|
1107
|
+
this.table.columnManager.getColumnsByFieldRoot(s).forEach((n) => {
|
|
1108
|
+
let h = this.getCell(n.getField());
|
|
1109
|
+
if (h) {
|
|
1110
|
+
let c = n.getFieldValue(r);
|
|
1111
|
+
h.getValue() !== c && (h.setValueProcessData(c), e && h.cellRendered());
|
|
1112
|
+
}
|
|
1113
|
+
});
|
|
1114
|
+
e ? (this.normalizeHeight(!0), this.table.options.rowFormatter && this.table.options.rowFormatter(this.getComponent())) : (this.initialized = !1, this.height = 0, this.heightStyled = ""), this.dispatch("row-data-changed", this, e, t), this.dispatchExternal("rowUpdated", this.getComponent()), this.subscribedExternal("dataChanged") && this.dispatchExternal("dataChanged", this.table.rowManager.getData()), o();
|
|
1115
|
+
});
|
|
1116
|
+
}
|
|
1117
|
+
getData(t) {
|
|
1118
|
+
return t ? this.chain("row-data-retrieve", [this, t], null, this.data) : this.data;
|
|
1119
|
+
}
|
|
1120
|
+
getCell(t) {
|
|
1121
|
+
var e = !1;
|
|
1122
|
+
return t = this.table.columnManager.findColumn(t), !this.initialized && this.cells.length === 0 && this.generateCells(), e = this.cells.find(function(i) {
|
|
1123
|
+
return i.column === t;
|
|
1124
|
+
}), e;
|
|
1125
|
+
}
|
|
1126
|
+
getCellIndex(t) {
|
|
1127
|
+
return this.cells.findIndex(function(e) {
|
|
1128
|
+
return e === t;
|
|
1129
|
+
});
|
|
1130
|
+
}
|
|
1131
|
+
findCell(t) {
|
|
1132
|
+
return this.cells.find((e) => e.element === t);
|
|
1133
|
+
}
|
|
1134
|
+
getCells() {
|
|
1135
|
+
return !this.initialized && this.cells.length === 0 && this.generateCells(), this.cells;
|
|
1136
|
+
}
|
|
1137
|
+
nextRow() {
|
|
1138
|
+
var t = this.table.rowManager.nextDisplayRow(this, !0);
|
|
1139
|
+
return t || !1;
|
|
1140
|
+
}
|
|
1141
|
+
prevRow() {
|
|
1142
|
+
var t = this.table.rowManager.prevDisplayRow(this, !0);
|
|
1143
|
+
return t || !1;
|
|
1144
|
+
}
|
|
1145
|
+
moveToRow(t, e) {
|
|
1146
|
+
var i = this.table.rowManager.findRow(t);
|
|
1147
|
+
i ? (this.table.rowManager.moveRowActual(this, i, !e), this.table.rowManager.refreshActiveData("display", !1, !0)) : console.warn("Move Error - No matching row found:", t);
|
|
1148
|
+
}
|
|
1149
|
+
///////////////////// Actions /////////////////////
|
|
1150
|
+
delete() {
|
|
1151
|
+
return this.dispatch("row-delete", this), this.deleteActual(), Promise.resolve();
|
|
1152
|
+
}
|
|
1153
|
+
deleteActual(t) {
|
|
1154
|
+
this.detachModules(), this.table.rowManager.deleteRow(this, t), this.deleteCells(), this.initialized = !1, this.heightInitialized = !1, this.element = !1, this.dispatch("row-deleted", this);
|
|
1155
|
+
}
|
|
1156
|
+
detachModules() {
|
|
1157
|
+
this.dispatch("row-deleting", this);
|
|
1158
|
+
}
|
|
1159
|
+
deleteCells() {
|
|
1160
|
+
var t = this.cells.length;
|
|
1161
|
+
for (let e = 0; e < t; e++)
|
|
1162
|
+
this.cells[0].delete();
|
|
1163
|
+
}
|
|
1164
|
+
wipe() {
|
|
1165
|
+
if (this.detachModules(), this.deleteCells(), this.element) {
|
|
1166
|
+
for (; this.element.firstChild; ) this.element.removeChild(this.element.firstChild);
|
|
1167
|
+
this.element.parentNode && this.element.parentNode.removeChild(this.element);
|
|
1168
|
+
}
|
|
1169
|
+
this.element = !1, this.modules = {};
|
|
1170
|
+
}
|
|
1171
|
+
isDisplayed() {
|
|
1172
|
+
return this.table.rowManager.getDisplayRows().includes(this);
|
|
1173
|
+
}
|
|
1174
|
+
getPosition() {
|
|
1175
|
+
return this.isDisplayed() ? this.position : !1;
|
|
1176
|
+
}
|
|
1177
|
+
setPosition(t) {
|
|
1178
|
+
t != this.position && (this.position = t, this.positionWatchers.forEach((e) => {
|
|
1179
|
+
e(this.position);
|
|
1180
|
+
}));
|
|
1181
|
+
}
|
|
1182
|
+
watchPosition(t) {
|
|
1183
|
+
this.positionWatchers.push(t), t(this.position);
|
|
1184
|
+
}
|
|
1185
|
+
getGroup() {
|
|
1186
|
+
return this.modules.group || !1;
|
|
1187
|
+
}
|
|
1188
|
+
//////////////// Object Generation /////////////////
|
|
1189
|
+
getComponent() {
|
|
1190
|
+
return this.component || (this.component = new Z(this)), this.component;
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
var ut = {
|
|
1194
|
+
debugEventsExternal: !1,
|
|
1195
|
+
//flag to console log events
|
|
1196
|
+
debugEventsInternal: !1,
|
|
1197
|
+
//flag to console log events
|
|
1198
|
+
debugInvalidOptions: !0,
|
|
1199
|
+
//allow toggling of invalid option warnings
|
|
1200
|
+
debugInvalidComponentFuncs: !0,
|
|
1201
|
+
//allow toggling of invalid component warnings
|
|
1202
|
+
debugInitialization: !0,
|
|
1203
|
+
//allow toggling of pre initialization function call warnings
|
|
1204
|
+
debugDeprecation: !0,
|
|
1205
|
+
//allow toggling of deprecation warnings
|
|
1206
|
+
height: !1,
|
|
1207
|
+
//height of tabulator
|
|
1208
|
+
minHeight: !1,
|
|
1209
|
+
//minimum height of tabulator
|
|
1210
|
+
maxHeight: !1,
|
|
1211
|
+
//maximum height of tabulator
|
|
1212
|
+
columnHeaderVertAlign: "top",
|
|
1213
|
+
//vertical alignment of column headers
|
|
1214
|
+
popupContainer: !1,
|
|
1215
|
+
columns: [],
|
|
1216
|
+
//store for colum header info
|
|
1217
|
+
columnDefaults: {},
|
|
1218
|
+
//store column default props
|
|
1219
|
+
rowHeader: !1,
|
|
1220
|
+
data: !1,
|
|
1221
|
+
//default starting data
|
|
1222
|
+
autoColumns: !1,
|
|
1223
|
+
//build columns from data row structure
|
|
1224
|
+
autoColumnsDefinitions: !1,
|
|
1225
|
+
nestedFieldSeparator: ".",
|
|
1226
|
+
//separator for nested data
|
|
1227
|
+
footerElement: !1,
|
|
1228
|
+
//hold footer element
|
|
1229
|
+
index: "id",
|
|
1230
|
+
//filed for row index
|
|
1231
|
+
textDirection: "auto",
|
|
1232
|
+
addRowPos: "bottom",
|
|
1233
|
+
//position to insert blank rows, top|bottom
|
|
1234
|
+
headerVisible: !0,
|
|
1235
|
+
//hide header
|
|
1236
|
+
renderVertical: "virtual",
|
|
1237
|
+
renderHorizontal: "basic",
|
|
1238
|
+
renderVerticalBuffer: 0,
|
|
1239
|
+
// set virtual DOM buffer size
|
|
1240
|
+
scrollToRowPosition: "top",
|
|
1241
|
+
scrollToRowIfVisible: !0,
|
|
1242
|
+
scrollToColumnPosition: "left",
|
|
1243
|
+
scrollToColumnIfVisible: !0,
|
|
1244
|
+
rowFormatter: !1,
|
|
1245
|
+
rowFormatterPrint: null,
|
|
1246
|
+
rowFormatterClipboard: null,
|
|
1247
|
+
rowFormatterHtmlOutput: null,
|
|
1248
|
+
rowHeight: null,
|
|
1249
|
+
placeholder: !1,
|
|
1250
|
+
dataLoader: !0,
|
|
1251
|
+
dataLoaderLoading: !1,
|
|
1252
|
+
dataLoaderError: !1,
|
|
1253
|
+
dataLoaderErrorTimeout: 3e3,
|
|
1254
|
+
dataSendParams: {},
|
|
1255
|
+
dataReceiveParams: {},
|
|
1256
|
+
dependencies: {}
|
|
1257
|
+
};
|
|
1258
|
+
class tt {
|
|
1259
|
+
constructor(t, e, i = {}) {
|
|
1260
|
+
this.table = t, this.msgType = e, this.registeredDefaults = Object.assign({}, i);
|
|
1261
|
+
}
|
|
1262
|
+
register(t, e) {
|
|
1263
|
+
this.registeredDefaults[t] = e;
|
|
1264
|
+
}
|
|
1265
|
+
generate(t, e = {}) {
|
|
1266
|
+
var i = Object.assign({}, this.registeredDefaults), r = this.table.options.debugInvalidOptions || e.debugInvalidOptions === !0;
|
|
1267
|
+
Object.assign(i, t);
|
|
1268
|
+
for (let o in e)
|
|
1269
|
+
i.hasOwnProperty(o) || (r && console.warn("Invalid " + this.msgType + " option:", o), i[o] = e.key);
|
|
1270
|
+
for (let o in i)
|
|
1271
|
+
o in e ? i[o] = e[o] : Array.isArray(i[o]) ? i[o] = Object.assign([], i[o]) : typeof i[o] == "object" && i[o] !== null ? i[o] = Object.assign({}, i[o]) : typeof i[o] > "u" && delete i[o];
|
|
1272
|
+
return i;
|
|
1273
|
+
}
|
|
1274
|
+
}
|
|
1275
|
+
class S extends y {
|
|
1276
|
+
constructor(t) {
|
|
1277
|
+
super(t), this.elementVertical = t.rowManager.element, this.elementHorizontal = t.columnManager.element, this.tableElement = t.rowManager.tableElement, this.verticalFillMode = "fit";
|
|
1278
|
+
}
|
|
1279
|
+
///////////////////////////////////
|
|
1280
|
+
/////// Internal Bindings /////////
|
|
1281
|
+
///////////////////////////////////
|
|
1282
|
+
initialize() {
|
|
1283
|
+
}
|
|
1284
|
+
clearRows() {
|
|
1285
|
+
}
|
|
1286
|
+
clearColumns() {
|
|
1287
|
+
}
|
|
1288
|
+
reinitializeColumnWidths(t) {
|
|
1289
|
+
}
|
|
1290
|
+
renderRows() {
|
|
1291
|
+
}
|
|
1292
|
+
renderColumns() {
|
|
1293
|
+
}
|
|
1294
|
+
rerenderRows(t) {
|
|
1295
|
+
t && t();
|
|
1296
|
+
}
|
|
1297
|
+
rerenderColumns(t, e) {
|
|
1298
|
+
}
|
|
1299
|
+
renderRowCells(t) {
|
|
1300
|
+
}
|
|
1301
|
+
rerenderRowCells(t, e) {
|
|
1302
|
+
}
|
|
1303
|
+
scrollColumns(t, e) {
|
|
1304
|
+
}
|
|
1305
|
+
scrollRows(t, e) {
|
|
1306
|
+
}
|
|
1307
|
+
resize() {
|
|
1308
|
+
}
|
|
1309
|
+
scrollToRow(t) {
|
|
1310
|
+
}
|
|
1311
|
+
scrollToRowNearestTop(t) {
|
|
1312
|
+
}
|
|
1313
|
+
visibleRows(t) {
|
|
1314
|
+
return [];
|
|
1315
|
+
}
|
|
1316
|
+
///////////////////////////////////
|
|
1317
|
+
//////// Helper Functions /////////
|
|
1318
|
+
///////////////////////////////////
|
|
1319
|
+
rows() {
|
|
1320
|
+
return this.table.rowManager.getDisplayRows();
|
|
1321
|
+
}
|
|
1322
|
+
styleRow(t, e) {
|
|
1323
|
+
var i = t.getElement();
|
|
1324
|
+
e % 2 ? (i.classList.add("tabulator-row-even"), i.classList.remove("tabulator-row-odd")) : (i.classList.add("tabulator-row-odd"), i.classList.remove("tabulator-row-even"));
|
|
1325
|
+
}
|
|
1326
|
+
///////////////////////////////////
|
|
1327
|
+
/////// External Triggers /////////
|
|
1328
|
+
/////// (DO NOT OVERRIDE) /////////
|
|
1329
|
+
///////////////////////////////////
|
|
1330
|
+
clear() {
|
|
1331
|
+
this.clearRows(), this.clearColumns();
|
|
1332
|
+
}
|
|
1333
|
+
render() {
|
|
1334
|
+
this.renderRows(), this.renderColumns();
|
|
1335
|
+
}
|
|
1336
|
+
rerender(t) {
|
|
1337
|
+
this.rerenderRows(), this.rerenderColumns();
|
|
1338
|
+
}
|
|
1339
|
+
scrollToRowPosition(t, e, i) {
|
|
1340
|
+
var r = this.rows().indexOf(t), o = t.getElement(), a = 0;
|
|
1341
|
+
return new Promise((s, l) => {
|
|
1342
|
+
if (r > -1) {
|
|
1343
|
+
if (typeof i > "u" && (i = this.table.options.scrollToRowIfVisible), !i && v.elVisible(o) && (a = v.elOffset(o).top - v.elOffset(this.elementVertical).top, a > 0 && a < this.elementVertical.clientHeight - o.offsetHeight))
|
|
1344
|
+
return s(), !1;
|
|
1345
|
+
switch (typeof e > "u" && (e = this.table.options.scrollToRowPosition), e === "nearest" && (e = this.scrollToRowNearestTop(t) ? "top" : "bottom"), this.scrollToRow(t), e) {
|
|
1346
|
+
case "middle":
|
|
1347
|
+
case "center":
|
|
1348
|
+
this.elementVertical.scrollHeight - this.elementVertical.scrollTop == this.elementVertical.clientHeight ? this.elementVertical.scrollTop = this.elementVertical.scrollTop + (o.offsetTop - this.elementVertical.scrollTop) - (this.elementVertical.scrollHeight - o.offsetTop) / 2 : this.elementVertical.scrollTop = this.elementVertical.scrollTop - this.elementVertical.clientHeight / 2;
|
|
1349
|
+
break;
|
|
1350
|
+
case "bottom":
|
|
1351
|
+
this.elementVertical.scrollHeight - this.elementVertical.scrollTop == this.elementVertical.clientHeight ? this.elementVertical.scrollTop = this.elementVertical.scrollTop - (this.elementVertical.scrollHeight - o.offsetTop) + o.offsetHeight : this.elementVertical.scrollTop = this.elementVertical.scrollTop - this.elementVertical.clientHeight + o.offsetHeight;
|
|
1352
|
+
break;
|
|
1353
|
+
case "top":
|
|
1354
|
+
this.elementVertical.scrollTop = o.offsetTop;
|
|
1355
|
+
break;
|
|
1356
|
+
}
|
|
1357
|
+
s();
|
|
1358
|
+
} else
|
|
1359
|
+
console.warn("Scroll Error - Row not visible"), l("Scroll Error - Row not visible");
|
|
1360
|
+
});
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
class ct extends S {
|
|
1364
|
+
constructor(t) {
|
|
1365
|
+
super(t);
|
|
1366
|
+
}
|
|
1367
|
+
renderRowCells(t, e) {
|
|
1368
|
+
const i = document.createDocumentFragment();
|
|
1369
|
+
t.cells.forEach((r) => {
|
|
1370
|
+
i.appendChild(r.getElement());
|
|
1371
|
+
}), t.element.appendChild(i), e || t.cells.forEach((r) => {
|
|
1372
|
+
r.cellRendered();
|
|
1373
|
+
});
|
|
1374
|
+
}
|
|
1375
|
+
reinitializeColumnWidths(t) {
|
|
1376
|
+
t.forEach(function(e) {
|
|
1377
|
+
e.reinitializeWidth();
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
1380
|
+
}
|
|
1381
|
+
class pt extends S {
|
|
1382
|
+
constructor(t) {
|
|
1383
|
+
super(t), this.leftCol = 0, this.rightCol = 0, this.scrollLeft = 0, this.vDomScrollPosLeft = 0, this.vDomScrollPosRight = 0, this.vDomPadLeft = 0, this.vDomPadRight = 0, this.fitDataColAvg = 0, this.windowBuffer = 200, this.visibleRows = null, this.initialized = !1, this.isFitData = !1, this.columns = [];
|
|
1384
|
+
}
|
|
1385
|
+
initialize() {
|
|
1386
|
+
this.compatibilityCheck(), this.layoutCheck(), this.vertScrollListen();
|
|
1387
|
+
}
|
|
1388
|
+
compatibilityCheck() {
|
|
1389
|
+
this.options("layout") == "fitDataTable" && console.warn("Horizontal Virtual DOM is not compatible with fitDataTable layout mode"), this.options("responsiveLayout") && console.warn("Horizontal Virtual DOM is not compatible with responsive columns"), this.options("rtl") && console.warn("Horizontal Virtual DOM is not currently compatible with RTL text direction");
|
|
1390
|
+
}
|
|
1391
|
+
layoutCheck() {
|
|
1392
|
+
this.isFitData = this.options("layout").startsWith("fitData");
|
|
1393
|
+
}
|
|
1394
|
+
vertScrollListen() {
|
|
1395
|
+
this.subscribe("scroll-vertical", this.clearVisRowCache.bind(this)), this.subscribe("data-refreshed", this.clearVisRowCache.bind(this));
|
|
1396
|
+
}
|
|
1397
|
+
clearVisRowCache() {
|
|
1398
|
+
this.visibleRows = null;
|
|
1399
|
+
}
|
|
1400
|
+
//////////////////////////////////////
|
|
1401
|
+
///////// Public Functions ///////////
|
|
1402
|
+
//////////////////////////////////////
|
|
1403
|
+
renderColumns(t, e) {
|
|
1404
|
+
this.dataChange();
|
|
1405
|
+
}
|
|
1406
|
+
scrollColumns(t, e) {
|
|
1407
|
+
this.scrollLeft != t && (this.scrollLeft = t, this.scroll(t - (this.vDomScrollPosLeft + this.windowBuffer)));
|
|
1408
|
+
}
|
|
1409
|
+
calcWindowBuffer() {
|
|
1410
|
+
var t = this.elementVertical.clientWidth;
|
|
1411
|
+
this.table.columnManager.columnsByIndex.forEach((e) => {
|
|
1412
|
+
if (e.visible) {
|
|
1413
|
+
var i = e.getWidth();
|
|
1414
|
+
i > t && (t = i);
|
|
1415
|
+
}
|
|
1416
|
+
}), this.windowBuffer = t * 2;
|
|
1417
|
+
}
|
|
1418
|
+
rerenderColumns(t, e) {
|
|
1419
|
+
var i = {
|
|
1420
|
+
cols: this.columns,
|
|
1421
|
+
leftCol: this.leftCol,
|
|
1422
|
+
rightCol: this.rightCol
|
|
1423
|
+
}, r = 0;
|
|
1424
|
+
t && !this.initialized || (this.clear(), this.calcWindowBuffer(), this.scrollLeft = this.elementVertical.scrollLeft, this.vDomScrollPosLeft = this.scrollLeft - this.windowBuffer, this.vDomScrollPosRight = this.scrollLeft + this.elementVertical.clientWidth + this.windowBuffer, this.table.columnManager.columnsByIndex.forEach((o) => {
|
|
1425
|
+
var a = {}, s;
|
|
1426
|
+
o.visible && (o.modules.frozen || (s = o.getWidth(), a.leftPos = r, a.rightPos = r + s, a.width = s, this.isFitData && (a.fitDataCheck = o.modules.vdomHoz ? o.modules.vdomHoz.fitDataCheck : !0), r + s > this.vDomScrollPosLeft && r < this.vDomScrollPosRight ? (this.leftCol == -1 && (this.leftCol = this.columns.length, this.vDomPadLeft = r), this.rightCol = this.columns.length) : this.leftCol !== -1 && (this.vDomPadRight += s), this.columns.push(o), o.modules.vdomHoz = a, r += s));
|
|
1427
|
+
}), this.tableElement.style.paddingLeft = this.vDomPadLeft + "px", this.tableElement.style.paddingRight = this.vDomPadRight + "px", this.initialized = !0, e || (!t || this.reinitChanged(i)) && this.reinitializeRows(), this.elementVertical.scrollLeft = this.scrollLeft);
|
|
1428
|
+
}
|
|
1429
|
+
renderRowCells(t) {
|
|
1430
|
+
if (this.initialized)
|
|
1431
|
+
this.initializeRow(t);
|
|
1432
|
+
else {
|
|
1433
|
+
const e = document.createDocumentFragment();
|
|
1434
|
+
t.cells.forEach((i) => {
|
|
1435
|
+
e.appendChild(i.getElement());
|
|
1436
|
+
}), t.element.appendChild(e), t.cells.forEach((i) => {
|
|
1437
|
+
i.cellRendered();
|
|
1438
|
+
});
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
rerenderRowCells(t, e) {
|
|
1442
|
+
this.reinitializeRow(t, e);
|
|
1443
|
+
}
|
|
1444
|
+
reinitializeColumnWidths(t) {
|
|
1445
|
+
for (let e = this.leftCol; e <= this.rightCol; e++) {
|
|
1446
|
+
let i = this.columns[e];
|
|
1447
|
+
i && i.reinitializeWidth();
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
//////////////////////////////////////
|
|
1451
|
+
//////// Internal Rendering //////////
|
|
1452
|
+
//////////////////////////////////////
|
|
1453
|
+
deinitialize() {
|
|
1454
|
+
this.initialized = !1;
|
|
1455
|
+
}
|
|
1456
|
+
clear() {
|
|
1457
|
+
this.columns = [], this.leftCol = -1, this.rightCol = 0, this.vDomScrollPosLeft = 0, this.vDomScrollPosRight = 0, this.vDomPadLeft = 0, this.vDomPadRight = 0;
|
|
1458
|
+
}
|
|
1459
|
+
dataChange() {
|
|
1460
|
+
var t = !1, e, i;
|
|
1461
|
+
if (this.isFitData) {
|
|
1462
|
+
if (this.table.columnManager.columnsByIndex.forEach((r) => {
|
|
1463
|
+
!r.definition.width && r.visible && (t = !0);
|
|
1464
|
+
}), t && this.table.rowManager.getDisplayRows().length && (this.vDomScrollPosRight = this.scrollLeft + this.elementVertical.clientWidth + this.windowBuffer, e = this.chain("rows-sample", [1], [], () => this.table.rowManager.getDisplayRows())[0], e)) {
|
|
1465
|
+
i = e.getElement(), e.generateCells(), this.tableElement.appendChild(i);
|
|
1466
|
+
for (let r = 0; r < e.cells.length; r++) {
|
|
1467
|
+
let o = e.cells[r];
|
|
1468
|
+
i.appendChild(o.getElement()), o.column.reinitializeWidth();
|
|
1469
|
+
}
|
|
1470
|
+
i.parentNode.removeChild(i), this.rerenderColumns(!1, !0);
|
|
1471
|
+
}
|
|
1472
|
+
} else
|
|
1473
|
+
this.options("layout") === "fitColumns" && (this.layoutRefresh(), this.rerenderColumns(!1, !0));
|
|
1474
|
+
}
|
|
1475
|
+
reinitChanged(t) {
|
|
1476
|
+
var e = !0;
|
|
1477
|
+
return t.cols.length !== this.columns.length || t.leftCol !== this.leftCol || t.rightCol !== this.rightCol ? !0 : (t.cols.forEach((i, r) => {
|
|
1478
|
+
i !== this.columns[r] && (e = !1);
|
|
1479
|
+
}), !e);
|
|
1480
|
+
}
|
|
1481
|
+
reinitializeRows() {
|
|
1482
|
+
var t = this.getVisibleRows(), e = this.table.rowManager.getRows().filter((i) => !t.includes(i));
|
|
1483
|
+
t.forEach((i) => {
|
|
1484
|
+
this.reinitializeRow(i, !0);
|
|
1485
|
+
}), e.forEach((i) => {
|
|
1486
|
+
i.deinitialize();
|
|
1487
|
+
});
|
|
1488
|
+
}
|
|
1489
|
+
getVisibleRows() {
|
|
1490
|
+
return this.visibleRows || (this.visibleRows = this.table.rowManager.getVisibleRows()), this.visibleRows;
|
|
1491
|
+
}
|
|
1492
|
+
scroll(t) {
|
|
1493
|
+
this.vDomScrollPosLeft += t, this.vDomScrollPosRight += t, Math.abs(t) > this.windowBuffer / 2 ? this.rerenderColumns() : t > 0 ? (this.addColRight(), this.removeColLeft()) : (this.addColLeft(), this.removeColRight());
|
|
1494
|
+
}
|
|
1495
|
+
colPositionAdjust(t, e, i) {
|
|
1496
|
+
for (let r = t; r < e; r++) {
|
|
1497
|
+
let o = this.columns[r];
|
|
1498
|
+
o.modules.vdomHoz.leftPos += i, o.modules.vdomHoz.rightPos += i;
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
addColRight() {
|
|
1502
|
+
for (var t = !1, e = !0; e; ) {
|
|
1503
|
+
let i = this.columns[this.rightCol + 1];
|
|
1504
|
+
i && i.modules.vdomHoz.leftPos <= this.vDomScrollPosRight ? (t = !0, this.getVisibleRows().forEach((r) => {
|
|
1505
|
+
if (r.type !== "group") {
|
|
1506
|
+
var o = r.getCell(i);
|
|
1507
|
+
r.getElement().insertBefore(o.getElement(), r.getCell(this.columns[this.rightCol]).getElement().nextSibling), o.cellRendered();
|
|
1508
|
+
}
|
|
1509
|
+
}), this.fitDataColActualWidthCheck(i), this.rightCol++, this.getVisibleRows().forEach((r) => {
|
|
1510
|
+
r.type !== "group" && (r.modules.vdomHoz.rightCol = this.rightCol);
|
|
1511
|
+
}), this.rightCol >= this.columns.length - 1 ? this.vDomPadRight = 0 : this.vDomPadRight -= i.getWidth()) : e = !1;
|
|
1512
|
+
}
|
|
1513
|
+
t && (this.tableElement.style.paddingRight = this.vDomPadRight + "px");
|
|
1514
|
+
}
|
|
1515
|
+
addColLeft() {
|
|
1516
|
+
for (var t = !1, e = !0; e; ) {
|
|
1517
|
+
let i = this.columns[this.leftCol - 1];
|
|
1518
|
+
if (i)
|
|
1519
|
+
if (i.modules.vdomHoz.rightPos >= this.vDomScrollPosLeft) {
|
|
1520
|
+
t = !0, this.getVisibleRows().forEach((o) => {
|
|
1521
|
+
if (o.type !== "group") {
|
|
1522
|
+
var a = o.getCell(i);
|
|
1523
|
+
o.getElement().insertBefore(a.getElement(), o.getCell(this.columns[this.leftCol]).getElement()), a.cellRendered();
|
|
1524
|
+
}
|
|
1525
|
+
}), this.leftCol--, this.getVisibleRows().forEach((o) => {
|
|
1526
|
+
o.type !== "group" && (o.modules.vdomHoz.leftCol = this.leftCol);
|
|
1527
|
+
}), this.leftCol <= 0 ? this.vDomPadLeft = 0 : this.vDomPadLeft -= i.getWidth();
|
|
1528
|
+
let r = this.fitDataColActualWidthCheck(i);
|
|
1529
|
+
r && (this.scrollLeft = this.elementVertical.scrollLeft = this.elementVertical.scrollLeft + r, this.vDomPadRight -= r);
|
|
1530
|
+
} else
|
|
1531
|
+
e = !1;
|
|
1532
|
+
else
|
|
1533
|
+
e = !1;
|
|
1534
|
+
}
|
|
1535
|
+
t && (this.tableElement.style.paddingLeft = this.vDomPadLeft + "px");
|
|
1536
|
+
}
|
|
1537
|
+
removeColRight() {
|
|
1538
|
+
for (var t = !1, e = !0; e; ) {
|
|
1539
|
+
let i = this.columns[this.rightCol];
|
|
1540
|
+
i && i.modules.vdomHoz.leftPos > this.vDomScrollPosRight ? (t = !0, this.getVisibleRows().forEach((r) => {
|
|
1541
|
+
if (r.type !== "group") {
|
|
1542
|
+
var o = r.getCell(i);
|
|
1543
|
+
try {
|
|
1544
|
+
r.getElement().removeChild(o.getElement());
|
|
1545
|
+
} catch (a) {
|
|
1546
|
+
console.warn("Could not removeColRight", a.message);
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
}), this.vDomPadRight += i.getWidth(), this.rightCol--, this.getVisibleRows().forEach((r) => {
|
|
1550
|
+
r.type !== "group" && (r.modules.vdomHoz.rightCol = this.rightCol);
|
|
1551
|
+
})) : e = !1;
|
|
1552
|
+
}
|
|
1553
|
+
t && (this.tableElement.style.paddingRight = this.vDomPadRight + "px");
|
|
1554
|
+
}
|
|
1555
|
+
removeColLeft() {
|
|
1556
|
+
for (var t = !1, e = !0; e; ) {
|
|
1557
|
+
let i = this.columns[this.leftCol];
|
|
1558
|
+
i && i.modules.vdomHoz.rightPos < this.vDomScrollPosLeft ? (t = !0, this.getVisibleRows().forEach((r) => {
|
|
1559
|
+
if (r.type !== "group") {
|
|
1560
|
+
var o = r.getCell(i);
|
|
1561
|
+
try {
|
|
1562
|
+
r.getElement().removeChild(o.getElement());
|
|
1563
|
+
} catch (a) {
|
|
1564
|
+
console.warn("Could not removeColLeft", a.message);
|
|
1565
|
+
}
|
|
1566
|
+
}
|
|
1567
|
+
}), this.vDomPadLeft += i.getWidth(), this.leftCol++, this.getVisibleRows().forEach((r) => {
|
|
1568
|
+
r.type !== "group" && (r.modules.vdomHoz.leftCol = this.leftCol);
|
|
1569
|
+
})) : e = !1;
|
|
1570
|
+
}
|
|
1571
|
+
t && (this.tableElement.style.paddingLeft = this.vDomPadLeft + "px");
|
|
1572
|
+
}
|
|
1573
|
+
fitDataColActualWidthCheck(t) {
|
|
1574
|
+
var e, i;
|
|
1575
|
+
return t.modules.vdomHoz.fitDataCheck && (t.reinitializeWidth(), e = t.getWidth(), i = e - t.modules.vdomHoz.width, i && (t.modules.vdomHoz.rightPos += i, t.modules.vdomHoz.width = e, this.colPositionAdjust(this.columns.indexOf(t) + 1, this.columns.length, i)), t.modules.vdomHoz.fitDataCheck = !1), i;
|
|
1576
|
+
}
|
|
1577
|
+
initializeRow(t) {
|
|
1578
|
+
if (t.type !== "group") {
|
|
1579
|
+
t.modules.vdomHoz = {
|
|
1580
|
+
leftCol: this.leftCol,
|
|
1581
|
+
rightCol: this.rightCol
|
|
1582
|
+
}, this.table.modules.frozenColumns && this.table.modules.frozenColumns.leftColumns.forEach((e) => {
|
|
1583
|
+
this.appendCell(t, e);
|
|
1584
|
+
});
|
|
1585
|
+
for (let e = this.leftCol; e <= this.rightCol; e++)
|
|
1586
|
+
this.appendCell(t, this.columns[e]);
|
|
1587
|
+
this.table.modules.frozenColumns && this.table.modules.frozenColumns.rightColumns.forEach((e) => {
|
|
1588
|
+
this.appendCell(t, e);
|
|
1589
|
+
});
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
appendCell(t, e) {
|
|
1593
|
+
if (e && e.visible) {
|
|
1594
|
+
let i = t.getCell(e);
|
|
1595
|
+
t.getElement().appendChild(i.getElement()), i.cellRendered();
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
reinitializeRow(t, e) {
|
|
1599
|
+
if (t.type !== "group" && (e || !t.modules.vdomHoz || t.modules.vdomHoz.leftCol !== this.leftCol || t.modules.vdomHoz.rightCol !== this.rightCol)) {
|
|
1600
|
+
for (var i = t.getElement(); i.firstChild; ) i.removeChild(i.firstChild);
|
|
1601
|
+
this.initializeRow(t);
|
|
1602
|
+
}
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
class mt extends y {
|
|
1606
|
+
constructor(t) {
|
|
1607
|
+
super(t), this.blockHozScrollEvent = !1, this.headersElement = null, this.contentsElement = null, this.rowHeader = null, this.element = null, this.columns = [], this.columnsByIndex = [], this.columnsByField = {}, this.scrollLeft = 0, this.optionsList = new tt(this.table, "column definition", Q), this.redrawBlock = !1, this.redrawBlockUpdate = null, this.renderer = null;
|
|
1608
|
+
}
|
|
1609
|
+
////////////// Setup Functions /////////////////
|
|
1610
|
+
initialize() {
|
|
1611
|
+
this.initializeRenderer(), this.headersElement = this.createHeadersElement(), this.contentsElement = this.createHeaderContentsElement(), this.element = this.createHeaderElement(), this.contentsElement.insertBefore(this.headersElement, this.contentsElement.firstChild), this.element.insertBefore(this.contentsElement, this.element.firstChild), this.initializeScrollWheelWatcher(), this.subscribe("scroll-horizontal", this.scrollHorizontal.bind(this)), this.subscribe("scrollbar-vertical", this.padVerticalScrollbar.bind(this));
|
|
1612
|
+
}
|
|
1613
|
+
padVerticalScrollbar(t) {
|
|
1614
|
+
this.table.rtl ? this.headersElement.style.marginLeft = t + "px" : this.headersElement.style.marginRight = t + "px";
|
|
1615
|
+
}
|
|
1616
|
+
initializeRenderer() {
|
|
1617
|
+
var t, e = {
|
|
1618
|
+
virtual: pt,
|
|
1619
|
+
basic: ct
|
|
1620
|
+
};
|
|
1621
|
+
typeof this.table.options.renderHorizontal == "string" ? t = e[this.table.options.renderHorizontal] : t = this.table.options.renderHorizontal, t ? (this.renderer = new t(this.table, this.element, this.tableElement), this.renderer.initialize()) : console.error("Unable to find matching renderer:", this.table.options.renderHorizontal);
|
|
1622
|
+
}
|
|
1623
|
+
createHeadersElement() {
|
|
1624
|
+
var t = document.createElement("div");
|
|
1625
|
+
return t.classList.add("tabulator-headers"), t.setAttribute("role", "row"), t;
|
|
1626
|
+
}
|
|
1627
|
+
createHeaderContentsElement() {
|
|
1628
|
+
var t = document.createElement("div");
|
|
1629
|
+
return t.classList.add("tabulator-header-contents"), t.setAttribute("role", "rowgroup"), t;
|
|
1630
|
+
}
|
|
1631
|
+
createHeaderElement() {
|
|
1632
|
+
var t = document.createElement("div");
|
|
1633
|
+
return t.classList.add("tabulator-header"), t.setAttribute("role", "rowgroup"), this.table.options.headerVisible || t.classList.add("tabulator-header-hidden"), t;
|
|
1634
|
+
}
|
|
1635
|
+
//return containing element
|
|
1636
|
+
getElement() {
|
|
1637
|
+
return this.element;
|
|
1638
|
+
}
|
|
1639
|
+
//return containing contents element
|
|
1640
|
+
getContentsElement() {
|
|
1641
|
+
return this.contentsElement;
|
|
1642
|
+
}
|
|
1643
|
+
//return header containing element
|
|
1644
|
+
getHeadersElement() {
|
|
1645
|
+
return this.headersElement;
|
|
1646
|
+
}
|
|
1647
|
+
//scroll horizontally to match table body
|
|
1648
|
+
scrollHorizontal(t) {
|
|
1649
|
+
this.contentsElement.scrollLeft = t, this.scrollLeft = t, this.renderer.scrollColumns(t);
|
|
1650
|
+
}
|
|
1651
|
+
initializeScrollWheelWatcher() {
|
|
1652
|
+
this.contentsElement.addEventListener("wheel", (t) => {
|
|
1653
|
+
var e;
|
|
1654
|
+
t.deltaX && (e = this.contentsElement.scrollLeft + t.deltaX, this.table.rowManager.scrollHorizontal(e), this.table.columnManager.scrollHorizontal(e));
|
|
1655
|
+
});
|
|
1656
|
+
}
|
|
1657
|
+
///////////// Column Setup Functions /////////////
|
|
1658
|
+
generateColumnsFromRowData(t) {
|
|
1659
|
+
var e = [], i = {}, r = this.table.options.autoColumns === "full" ? t : [t[0]], o = this.table.options.autoColumnsDefinitions;
|
|
1660
|
+
if (t && t.length) {
|
|
1661
|
+
if (r.forEach((a) => {
|
|
1662
|
+
Object.keys(a).forEach((s, l) => {
|
|
1663
|
+
let n = a[s], h;
|
|
1664
|
+
i[s] ? i[s] !== !0 && typeof n < "u" && (i[s].sorter = this.calculateSorterFromValue(n), i[s] = !0) : (h = {
|
|
1665
|
+
field: s,
|
|
1666
|
+
title: s,
|
|
1667
|
+
sorter: this.calculateSorterFromValue(n)
|
|
1668
|
+
}, e.splice(l, 0, h), i[s] = typeof n > "u" ? h : !0);
|
|
1669
|
+
});
|
|
1670
|
+
}), o)
|
|
1671
|
+
switch (typeof o) {
|
|
1672
|
+
case "function":
|
|
1673
|
+
this.table.options.columns = o.call(this.table, e);
|
|
1674
|
+
break;
|
|
1675
|
+
case "object":
|
|
1676
|
+
Array.isArray(o) ? e.forEach((a) => {
|
|
1677
|
+
var s = o.find((l) => l.field === a.field);
|
|
1678
|
+
s && Object.assign(a, s);
|
|
1679
|
+
}) : e.forEach((a) => {
|
|
1680
|
+
o[a.field] && Object.assign(a, o[a.field]);
|
|
1681
|
+
}), this.table.options.columns = e;
|
|
1682
|
+
break;
|
|
1683
|
+
}
|
|
1684
|
+
else
|
|
1685
|
+
this.table.options.columns = e;
|
|
1686
|
+
this.setColumns(this.table.options.columns);
|
|
1687
|
+
}
|
|
1688
|
+
}
|
|
1689
|
+
calculateSorterFromValue(t) {
|
|
1690
|
+
var e;
|
|
1691
|
+
switch (typeof t) {
|
|
1692
|
+
case "undefined":
|
|
1693
|
+
e = "string";
|
|
1694
|
+
break;
|
|
1695
|
+
case "boolean":
|
|
1696
|
+
e = "boolean";
|
|
1697
|
+
break;
|
|
1698
|
+
case "number":
|
|
1699
|
+
e = "number";
|
|
1700
|
+
break;
|
|
1701
|
+
case "object":
|
|
1702
|
+
Array.isArray(t) ? e = "array" : e = "string";
|
|
1703
|
+
break;
|
|
1704
|
+
default:
|
|
1705
|
+
!isNaN(t) && t !== "" ? e = "number" : t.match(/((^[0-9]+[a-z]+)|(^[a-z]+[0-9]+))+$/i) ? e = "alphanum" : e = "string";
|
|
1706
|
+
break;
|
|
1707
|
+
}
|
|
1708
|
+
return e;
|
|
1709
|
+
}
|
|
1710
|
+
setColumns(t, e) {
|
|
1711
|
+
for (; this.headersElement.firstChild; ) this.headersElement.removeChild(this.headersElement.firstChild);
|
|
1712
|
+
this.columns = [], this.columnsByIndex = [], this.columnsByField = {}, this.dispatch("columns-loading"), this.dispatchExternal("columnsLoading"), this.table.options.rowHeader && (this.rowHeader = new A(this.table.options.rowHeader === !0 ? {} : this.table.options.rowHeader, this, !0), this.columns.push(this.rowHeader), this.headersElement.appendChild(this.rowHeader.getElement()), this.rowHeader.columnRendered()), t.forEach((i, r) => {
|
|
1713
|
+
this._addColumn(i);
|
|
1714
|
+
}), this._reIndexColumns(), this.dispatch("columns-loaded"), this.subscribedExternal("columnsLoaded") && this.dispatchExternal("columnsLoaded", this.getComponents()), this.rerenderColumns(!1, !0), this.redraw(!0);
|
|
1715
|
+
}
|
|
1716
|
+
_addColumn(t, e, i) {
|
|
1717
|
+
var r = new A(t, this), o = r.getElement(), a = i && this.findColumnIndex(i);
|
|
1718
|
+
if (e && this.rowHeader && (!i || i === this.rowHeader) && (e = !1, i = this.rowHeader, a = 0), i && a > -1) {
|
|
1719
|
+
var s = i.getTopColumn(), l = this.columns.indexOf(s), n = s.getElement();
|
|
1720
|
+
e ? (this.columns.splice(l, 0, r), n.parentNode.insertBefore(o, n)) : (this.columns.splice(l + 1, 0, r), n.parentNode.insertBefore(o, n.nextSibling));
|
|
1721
|
+
} else
|
|
1722
|
+
e ? (this.columns.unshift(r), this.headersElement.insertBefore(r.getElement(), this.headersElement.firstChild)) : (this.columns.push(r), this.headersElement.appendChild(r.getElement()));
|
|
1723
|
+
return r.columnRendered(), r;
|
|
1724
|
+
}
|
|
1725
|
+
registerColumnField(t) {
|
|
1726
|
+
t.definition.field && (this.columnsByField[t.definition.field] = t);
|
|
1727
|
+
}
|
|
1728
|
+
registerColumnPosition(t) {
|
|
1729
|
+
this.columnsByIndex.push(t);
|
|
1730
|
+
}
|
|
1731
|
+
_reIndexColumns() {
|
|
1732
|
+
this.columnsByIndex = [], this.columns.forEach(function(t) {
|
|
1733
|
+
t.reRegisterPosition();
|
|
1734
|
+
});
|
|
1735
|
+
}
|
|
1736
|
+
//ensure column headers take up the correct amount of space in column groups
|
|
1737
|
+
verticalAlignHeaders() {
|
|
1738
|
+
var t = 0;
|
|
1739
|
+
this.redrawBlock || (this.headersElement.style.height = "", this.columns.forEach((e) => {
|
|
1740
|
+
e.clearVerticalAlign();
|
|
1741
|
+
}), this.columns.forEach((e) => {
|
|
1742
|
+
var i = e.getHeight();
|
|
1743
|
+
i > t && (t = i);
|
|
1744
|
+
}), this.headersElement.style.height = t + "px", this.columns.forEach((e) => {
|
|
1745
|
+
e.verticalAlign(this.table.options.columnHeaderVertAlign, t);
|
|
1746
|
+
}), this.table.rowManager.adjustTableSize());
|
|
1747
|
+
}
|
|
1748
|
+
//////////////// Column Details /////////////////
|
|
1749
|
+
findColumn(t) {
|
|
1750
|
+
var e;
|
|
1751
|
+
if (typeof t == "object") {
|
|
1752
|
+
if (t instanceof A)
|
|
1753
|
+
return t;
|
|
1754
|
+
if (t instanceof Y)
|
|
1755
|
+
return t._getSelf() || !1;
|
|
1756
|
+
if (typeof HTMLElement < "u" && t instanceof HTMLElement)
|
|
1757
|
+
return e = [], this.columns.forEach((r) => {
|
|
1758
|
+
e.push(r), e = e.concat(r.getColumns(!0));
|
|
1759
|
+
}), e.find((r) => r.element === t) || !1;
|
|
1760
|
+
} else
|
|
1761
|
+
return this.columnsByField[t] || !1;
|
|
1762
|
+
return !1;
|
|
1763
|
+
}
|
|
1764
|
+
getColumnByField(t) {
|
|
1765
|
+
return this.columnsByField[t];
|
|
1766
|
+
}
|
|
1767
|
+
getColumnsByFieldRoot(t) {
|
|
1768
|
+
var e = [];
|
|
1769
|
+
return Object.keys(this.columnsByField).forEach((i) => {
|
|
1770
|
+
var r = this.table.options.nestedFieldSeparator ? i.split(this.table.options.nestedFieldSeparator)[0] : i;
|
|
1771
|
+
r === t && e.push(this.columnsByField[i]);
|
|
1772
|
+
}), e;
|
|
1773
|
+
}
|
|
1774
|
+
getColumnByIndex(t) {
|
|
1775
|
+
return this.columnsByIndex[t];
|
|
1776
|
+
}
|
|
1777
|
+
getFirstVisibleColumn() {
|
|
1778
|
+
var t = this.columnsByIndex.findIndex((e) => e.visible);
|
|
1779
|
+
return t > -1 ? this.columnsByIndex[t] : !1;
|
|
1780
|
+
}
|
|
1781
|
+
getVisibleColumnsByIndex() {
|
|
1782
|
+
return this.columnsByIndex.filter((t) => t.visible);
|
|
1783
|
+
}
|
|
1784
|
+
getColumns() {
|
|
1785
|
+
return this.columns;
|
|
1786
|
+
}
|
|
1787
|
+
findColumnIndex(t) {
|
|
1788
|
+
return this.columnsByIndex.findIndex((e) => t === e);
|
|
1789
|
+
}
|
|
1790
|
+
//return all columns that are not groups
|
|
1791
|
+
getRealColumns() {
|
|
1792
|
+
return this.columnsByIndex;
|
|
1793
|
+
}
|
|
1794
|
+
//traverse across columns and call action
|
|
1795
|
+
traverse(t) {
|
|
1796
|
+
this.columnsByIndex.forEach((e, i) => {
|
|
1797
|
+
t(e, i);
|
|
1798
|
+
});
|
|
1799
|
+
}
|
|
1800
|
+
//get definitions of actual columns
|
|
1801
|
+
getDefinitions(t) {
|
|
1802
|
+
var e = [];
|
|
1803
|
+
return this.columnsByIndex.forEach((i) => {
|
|
1804
|
+
(!t || t && i.visible) && e.push(i.getDefinition());
|
|
1805
|
+
}), e;
|
|
1806
|
+
}
|
|
1807
|
+
//get full nested definition tree
|
|
1808
|
+
getDefinitionTree() {
|
|
1809
|
+
var t = [];
|
|
1810
|
+
return this.columns.forEach((e) => {
|
|
1811
|
+
t.push(e.getDefinition(!0));
|
|
1812
|
+
}), t;
|
|
1813
|
+
}
|
|
1814
|
+
getComponents(t) {
|
|
1815
|
+
var e = [], i = t ? this.columns : this.columnsByIndex;
|
|
1816
|
+
return i.forEach((r) => {
|
|
1817
|
+
e.push(r.getComponent());
|
|
1818
|
+
}), e;
|
|
1819
|
+
}
|
|
1820
|
+
getWidth() {
|
|
1821
|
+
var t = 0;
|
|
1822
|
+
return this.columnsByIndex.forEach((e) => {
|
|
1823
|
+
e.visible && (t += e.getWidth());
|
|
1824
|
+
}), t;
|
|
1825
|
+
}
|
|
1826
|
+
moveColumn(t, e, i) {
|
|
1827
|
+
e.element.parentNode.insertBefore(t.element, e.element), i && e.element.parentNode.insertBefore(e.element, t.element), this.moveColumnActual(t, e, i), this.verticalAlignHeaders(), this.table.rowManager.reinitialize();
|
|
1828
|
+
}
|
|
1829
|
+
moveColumnActual(t, e, i) {
|
|
1830
|
+
t.parent.isGroup ? this._moveColumnInArray(t.parent.columns, t, e, i) : this._moveColumnInArray(this.columns, t, e, i), this._moveColumnInArray(this.columnsByIndex, t, e, i, !0), this.rerenderColumns(!0), this.dispatch("column-moved", t, e, i), this.subscribedExternal("columnMoved") && this.dispatchExternal("columnMoved", t.getComponent(), this.table.columnManager.getComponents());
|
|
1831
|
+
}
|
|
1832
|
+
_moveColumnInArray(t, e, i, r, o) {
|
|
1833
|
+
var a = t.indexOf(e), s, l = [];
|
|
1834
|
+
a > -1 && (t.splice(a, 1), s = t.indexOf(i), s > -1 ? r && (s = s + 1) : s = a, t.splice(s, 0, e), o && (l = this.chain("column-moving-rows", [e, i, r], null, []) || [], l = l.concat(this.table.rowManager.rows), l.forEach(function(n) {
|
|
1835
|
+
if (n.cells.length) {
|
|
1836
|
+
var h = n.cells.splice(a, 1)[0];
|
|
1837
|
+
n.cells.splice(s, 0, h);
|
|
1838
|
+
}
|
|
1839
|
+
})));
|
|
1840
|
+
}
|
|
1841
|
+
scrollToColumn(t, e, i) {
|
|
1842
|
+
var r = 0, o = t.getLeftOffset(), a = 0, s = t.getElement();
|
|
1843
|
+
return new Promise((l, n) => {
|
|
1844
|
+
if (typeof e > "u" && (e = this.table.options.scrollToColumnPosition), typeof i > "u" && (i = this.table.options.scrollToColumnIfVisible), t.visible) {
|
|
1845
|
+
switch (e) {
|
|
1846
|
+
case "middle":
|
|
1847
|
+
case "center":
|
|
1848
|
+
a = -this.element.clientWidth / 2;
|
|
1849
|
+
break;
|
|
1850
|
+
case "right":
|
|
1851
|
+
a = s.clientWidth - this.headersElement.clientWidth;
|
|
1852
|
+
break;
|
|
1853
|
+
}
|
|
1854
|
+
if (!i && o > 0 && o + s.offsetWidth < this.element.clientWidth)
|
|
1855
|
+
return !1;
|
|
1856
|
+
r = o + a, r = Math.max(Math.min(r, this.table.rowManager.element.scrollWidth - this.table.rowManager.element.clientWidth), 0), this.table.rowManager.scrollHorizontal(r), this.scrollHorizontal(r), l();
|
|
1857
|
+
} else
|
|
1858
|
+
console.warn("Scroll Error - Column not visible"), n("Scroll Error - Column not visible");
|
|
1859
|
+
});
|
|
1860
|
+
}
|
|
1861
|
+
//////////////// Cell Management /////////////////
|
|
1862
|
+
generateCells(t) {
|
|
1863
|
+
var e = [];
|
|
1864
|
+
return this.columnsByIndex.forEach((i) => {
|
|
1865
|
+
e.push(i.generateCell(t));
|
|
1866
|
+
}), e;
|
|
1867
|
+
}
|
|
1868
|
+
//////////////// Column Management /////////////////
|
|
1869
|
+
getFlexBaseWidth() {
|
|
1870
|
+
var t = this.table.element.clientWidth, e = 0;
|
|
1871
|
+
return this.table.rowManager.element.scrollHeight > this.table.rowManager.element.clientHeight && (t -= this.table.rowManager.element.offsetWidth - this.table.rowManager.element.clientWidth), this.columnsByIndex.forEach(function(i) {
|
|
1872
|
+
var r, o, a;
|
|
1873
|
+
i.visible && (r = i.definition.width || 0, o = parseInt(i.minWidth), typeof r == "string" ? r.indexOf("%") > -1 ? a = t / 100 * parseInt(r) : a = parseInt(r) : a = r, e += a > o ? a : o);
|
|
1874
|
+
}), e;
|
|
1875
|
+
}
|
|
1876
|
+
addColumn(t, e, i) {
|
|
1877
|
+
return new Promise((r, o) => {
|
|
1878
|
+
var a = this._addColumn(t, e, i);
|
|
1879
|
+
this._reIndexColumns(), this.dispatch("column-add", t, e, i), this.layoutMode() != "fitColumns" && a.reinitializeWidth(), this.redraw(!0), this.table.rowManager.reinitialize(), this.rerenderColumns(), r(a);
|
|
1880
|
+
});
|
|
1881
|
+
}
|
|
1882
|
+
//remove column from system
|
|
1883
|
+
deregisterColumn(t) {
|
|
1884
|
+
var e = t.getField(), i;
|
|
1885
|
+
e && delete this.columnsByField[e], i = this.columnsByIndex.indexOf(t), i > -1 && this.columnsByIndex.splice(i, 1), i = this.columns.indexOf(t), i > -1 && this.columns.splice(i, 1), this.verticalAlignHeaders(), this.redraw();
|
|
1886
|
+
}
|
|
1887
|
+
rerenderColumns(t, e) {
|
|
1888
|
+
this.redrawBlock ? (t === !1 || t === !0 && this.redrawBlockUpdate === null) && (this.redrawBlockUpdate = t) : this.renderer.rerenderColumns(t, e);
|
|
1889
|
+
}
|
|
1890
|
+
blockRedraw() {
|
|
1891
|
+
this.redrawBlock = !0, this.redrawBlockUpdate = null;
|
|
1892
|
+
}
|
|
1893
|
+
restoreRedraw() {
|
|
1894
|
+
this.redrawBlock = !1, this.verticalAlignHeaders(), this.renderer.rerenderColumns(this.redrawBlockUpdate);
|
|
1895
|
+
}
|
|
1896
|
+
//redraw columns
|
|
1897
|
+
redraw(t) {
|
|
1898
|
+
v.elVisible(this.element) && this.verticalAlignHeaders(), t && (this.table.rowManager.resetScroll(), this.table.rowManager.reinitialize()), this.confirm("table-redrawing", t) || this.layoutRefresh(t), this.dispatch("table-redraw", t), this.table.footerManager.redraw();
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
class bt extends S {
|
|
1902
|
+
constructor(t) {
|
|
1903
|
+
super(t), this.verticalFillMode = "fill", this.scrollTop = 0, this.scrollLeft = 0, this.scrollTop = 0, this.scrollLeft = 0;
|
|
1904
|
+
}
|
|
1905
|
+
clearRows() {
|
|
1906
|
+
for (var t = this.tableElement; t.firstChild; ) t.removeChild(t.firstChild);
|
|
1907
|
+
t.scrollTop = 0, t.scrollLeft = 0, t.style.minWidth = "", t.style.minHeight = "", t.style.display = "", t.style.visibility = "";
|
|
1908
|
+
}
|
|
1909
|
+
renderRows() {
|
|
1910
|
+
var t = this.tableElement, e = !0, i = document.createDocumentFragment(), r = this.rows();
|
|
1911
|
+
r.forEach((o, a) => {
|
|
1912
|
+
this.styleRow(o, a), o.initialize(!1, !0), o.type !== "group" && (e = !1), i.appendChild(o.getElement());
|
|
1913
|
+
}), t.appendChild(i), r.forEach((o) => {
|
|
1914
|
+
o.rendered(), o.heightInitialized || o.calcHeight(!0);
|
|
1915
|
+
}), r.forEach((o) => {
|
|
1916
|
+
o.heightInitialized || o.setCellHeight();
|
|
1917
|
+
}), e ? t.style.minWidth = this.table.columnManager.getWidth() + "px" : t.style.minWidth = "";
|
|
1918
|
+
}
|
|
1919
|
+
rerenderRows(t) {
|
|
1920
|
+
this.clearRows(), t && t(), this.renderRows(), this.rows().length || this.table.rowManager.tableEmpty();
|
|
1921
|
+
}
|
|
1922
|
+
scrollToRowNearestTop(t) {
|
|
1923
|
+
var e = v.elOffset(t.getElement()).top;
|
|
1924
|
+
return !(Math.abs(this.elementVertical.scrollTop - e) > Math.abs(this.elementVertical.scrollTop + this.elementVertical.clientHeight - e));
|
|
1925
|
+
}
|
|
1926
|
+
scrollToRow(t) {
|
|
1927
|
+
var e = t.getElement();
|
|
1928
|
+
this.elementVertical.scrollTop = v.elOffset(e).top - v.elOffset(this.elementVertical).top + this.elementVertical.scrollTop;
|
|
1929
|
+
}
|
|
1930
|
+
visibleRows(t) {
|
|
1931
|
+
return this.rows();
|
|
1932
|
+
}
|
|
1933
|
+
}
|
|
1934
|
+
class ft extends S {
|
|
1935
|
+
constructor(t) {
|
|
1936
|
+
super(t), this.verticalFillMode = "fill", this.scrollTop = 0, this.scrollLeft = 0, this.vDomRowHeight = 20, this.vDomTop = 0, this.vDomBottom = 0, this.vDomScrollPosTop = 0, this.vDomScrollPosBottom = 0, this.vDomTopPad = 0, this.vDomBottomPad = 0, this.vDomMaxRenderChain = 90, this.vDomWindowBuffer = 0, this.vDomWindowMinTotalRows = 20, this.vDomWindowMinMarginRows = 5, this.vDomTopNewRows = [], this.vDomBottomNewRows = [];
|
|
1937
|
+
}
|
|
1938
|
+
//////////////////////////////////////
|
|
1939
|
+
///////// Public Functions ///////////
|
|
1940
|
+
//////////////////////////////////////
|
|
1941
|
+
clearRows() {
|
|
1942
|
+
for (var t = this.tableElement; t.firstChild; ) t.removeChild(t.firstChild);
|
|
1943
|
+
t.style.paddingTop = "", t.style.paddingBottom = "", t.style.minHeight = "", t.style.display = "", t.style.visibility = "", this.elementVertical.scrollTop = 0, this.elementVertical.scrollLeft = 0, this.scrollTop = 0, this.scrollLeft = 0, this.vDomTop = 0, this.vDomBottom = 0, this.vDomTopPad = 0, this.vDomBottomPad = 0, this.vDomScrollPosTop = 0, this.vDomScrollPosBottom = 0;
|
|
1944
|
+
}
|
|
1945
|
+
renderRows() {
|
|
1946
|
+
this._virtualRenderFill();
|
|
1947
|
+
}
|
|
1948
|
+
rerenderRows(t) {
|
|
1949
|
+
for (var e = this.elementVertical.scrollTop, i = !1, r = !1, o = this.table.rowManager.scrollLeft, a = this.rows(), s = this.vDomTop; s <= this.vDomBottom; s++)
|
|
1950
|
+
if (a[s]) {
|
|
1951
|
+
var l = e - a[s].getElement().offsetTop;
|
|
1952
|
+
if (r === !1 || Math.abs(l) < r)
|
|
1953
|
+
r = l, i = s;
|
|
1954
|
+
else
|
|
1955
|
+
break;
|
|
1956
|
+
}
|
|
1957
|
+
a.forEach((n) => {
|
|
1958
|
+
n.deinitializeHeight();
|
|
1959
|
+
}), t && t(), this.rows().length ? this._virtualRenderFill(i === !1 ? this.rows.length - 1 : i, !0, r || 0) : (this.clear(), this.table.rowManager.tableEmpty()), this.scrollColumns(o);
|
|
1960
|
+
}
|
|
1961
|
+
scrollColumns(t) {
|
|
1962
|
+
this.table.rowManager.scrollHorizontal(t);
|
|
1963
|
+
}
|
|
1964
|
+
scrollRows(t, e) {
|
|
1965
|
+
var i = t - this.vDomScrollPosTop, r = t - this.vDomScrollPosBottom, o = this.vDomWindowBuffer * 2, a = this.rows();
|
|
1966
|
+
if (this.scrollTop = t, -i > o || r > o) {
|
|
1967
|
+
var s = this.table.rowManager.scrollLeft;
|
|
1968
|
+
this._virtualRenderFill(Math.floor(this.elementVertical.scrollTop / this.elementVertical.scrollHeight * a.length)), this.scrollColumns(s);
|
|
1969
|
+
} else
|
|
1970
|
+
e ? (i < 0 && this._addTopRow(a, -i), r < 0 && (this.vDomScrollHeight - this.scrollTop > this.vDomWindowBuffer ? this._removeBottomRow(a, -r) : this.vDomScrollPosBottom = this.scrollTop)) : (r >= 0 && this._addBottomRow(a, r), i >= 0 && (this.scrollTop > this.vDomWindowBuffer ? this._removeTopRow(a, i) : this.vDomScrollPosTop = this.scrollTop));
|
|
1971
|
+
}
|
|
1972
|
+
resize() {
|
|
1973
|
+
this.vDomWindowBuffer = this.table.options.renderVerticalBuffer || this.elementVertical.clientHeight;
|
|
1974
|
+
}
|
|
1975
|
+
scrollToRowNearestTop(t) {
|
|
1976
|
+
var e = this.rows().indexOf(t);
|
|
1977
|
+
return !(Math.abs(this.vDomTop - e) > Math.abs(this.vDomBottom - e));
|
|
1978
|
+
}
|
|
1979
|
+
scrollToRow(t) {
|
|
1980
|
+
var e = this.rows().indexOf(t);
|
|
1981
|
+
e > -1 && this._virtualRenderFill(e, !0);
|
|
1982
|
+
}
|
|
1983
|
+
visibleRows(t) {
|
|
1984
|
+
var e = this.elementVertical.scrollTop, i = this.elementVertical.clientHeight + e, r = !1, o = 0, a = 0, s = this.rows();
|
|
1985
|
+
if (t)
|
|
1986
|
+
o = this.vDomTop, a = this.vDomBottom;
|
|
1987
|
+
else
|
|
1988
|
+
for (var l = this.vDomTop; l <= this.vDomBottom; l++)
|
|
1989
|
+
if (s[l])
|
|
1990
|
+
if (r)
|
|
1991
|
+
if (i - s[l].getElement().offsetTop >= 0)
|
|
1992
|
+
a = l;
|
|
1993
|
+
else
|
|
1994
|
+
break;
|
|
1995
|
+
else if (e - s[l].getElement().offsetTop >= 0)
|
|
1996
|
+
o = l;
|
|
1997
|
+
else if (r = !0, i - s[l].getElement().offsetTop >= 0)
|
|
1998
|
+
a = l;
|
|
1999
|
+
else
|
|
2000
|
+
break;
|
|
2001
|
+
return s.slice(o, a + 1);
|
|
2002
|
+
}
|
|
2003
|
+
//////////////////////////////////////
|
|
2004
|
+
//////// Internal Rendering //////////
|
|
2005
|
+
//////////////////////////////////////
|
|
2006
|
+
//full virtual render
|
|
2007
|
+
_virtualRenderFill(t, e, i) {
|
|
2008
|
+
var r = this.tableElement, o = this.elementVertical, a = 0, s = 0, l = 0, n = 0, h = 0, c = 0, L = this.rows(), w = L.length, p = 0, b, x, f = [], H = 0, D = 0, P = this.table.rowManager.fixedHeight, C = this.elementVertical.clientHeight, M = this.table.options.rowHeight, _ = !0;
|
|
2009
|
+
if (t = t || 0, i = i || 0, !t)
|
|
2010
|
+
this.clear();
|
|
2011
|
+
else {
|
|
2012
|
+
for (; r.firstChild; ) r.removeChild(r.firstChild);
|
|
2013
|
+
n = (w - t + 1) * this.vDomRowHeight, n < C && (t -= Math.ceil((C - n) / this.vDomRowHeight), t < 0 && (t = 0)), a = Math.min(Math.max(Math.floor(this.vDomWindowBuffer / this.vDomRowHeight), this.vDomWindowMinMarginRows), t), t -= a;
|
|
2014
|
+
}
|
|
2015
|
+
if (w && v.elVisible(this.elementVertical)) {
|
|
2016
|
+
for (this.vDomTop = t, this.vDomBottom = t - 1, P || this.table.options.maxHeight ? (M && (D = C / M + this.vDomWindowBuffer / M), D = Math.max(this.vDomWindowMinTotalRows, Math.ceil(D))) : D = w; (D == w || s <= C + this.vDomWindowBuffer || H < this.vDomWindowMinTotalRows) && this.vDomBottom < w - 1; ) {
|
|
2017
|
+
for (f = [], x = document.createDocumentFragment(), c = 0; c < D && this.vDomBottom < w - 1; )
|
|
2018
|
+
p = this.vDomBottom + 1, b = L[p], this.styleRow(b, p), b.initialize(!1, !0), !b.heightInitialized && !this.table.options.rowHeight && b.clearCellHeight(), x.appendChild(b.getElement()), f.push(b), this.vDomBottom++, c++;
|
|
2019
|
+
if (!f.length)
|
|
2020
|
+
break;
|
|
2021
|
+
r.appendChild(x), f.forEach((g) => {
|
|
2022
|
+
g.rendered(), g.heightInitialized || g.calcHeight(!0);
|
|
2023
|
+
}), f.forEach((g) => {
|
|
2024
|
+
g.heightInitialized || g.setCellHeight();
|
|
2025
|
+
}), f.forEach((g) => {
|
|
2026
|
+
l = g.getHeight(), H < a ? h += l : s += l, l > this.vDomWindowBuffer && (this.vDomWindowBuffer = l * 2), H++;
|
|
2027
|
+
}), _ = this.table.rowManager.adjustTableSize(), C = this.elementVertical.clientHeight, _ && (P || this.table.options.maxHeight) && (M = s / H, D = Math.max(this.vDomWindowMinTotalRows, Math.ceil(C / M + this.vDomWindowBuffer / M)));
|
|
2028
|
+
}
|
|
2029
|
+
t ? (this.vDomTopPad = e ? this.vDomRowHeight * this.vDomTop + i : this.scrollTop - h, this.vDomBottomPad = this.vDomBottom == w - 1 ? 0 : Math.max(this.vDomScrollHeight - this.vDomTopPad - s - h, 0)) : (this.vDomTopPad = 0, this.vDomRowHeight = Math.floor((s + h) / H), this.vDomBottomPad = this.vDomRowHeight * (w - this.vDomBottom - 1), this.vDomScrollHeight = h + s + this.vDomBottomPad - C), r.style.paddingTop = this.vDomTopPad + "px", r.style.paddingBottom = this.vDomBottomPad + "px", e && (this.scrollTop = this.vDomTopPad + h + i - (this.elementVertical.scrollWidth > this.elementVertical.clientWidth ? this.elementVertical.offsetHeight - C : 0)), this.scrollTop = Math.min(this.scrollTop, this.elementVertical.scrollHeight - C), this.elementVertical.scrollWidth > this.elementVertical.clientWidth && e && (this.scrollTop += this.elementVertical.offsetHeight - C), this.vDomScrollPosTop = this.scrollTop, this.vDomScrollPosBottom = this.scrollTop, o.scrollTop = this.scrollTop, this.dispatch("render-virtual-fill");
|
|
2030
|
+
}
|
|
2031
|
+
}
|
|
2032
|
+
_addTopRow(t, e) {
|
|
2033
|
+
for (var i = this.tableElement, r = [], o = 0, a = this.vDomTop - 1, s = 0, l = !0; l; )
|
|
2034
|
+
if (this.vDomTop) {
|
|
2035
|
+
let n = t[a], h, c;
|
|
2036
|
+
n && s < this.vDomMaxRenderChain ? (h = n.getHeight() || this.vDomRowHeight, c = n.initialized, e >= h ? (this.styleRow(n, a), i.insertBefore(n.getElement(), i.firstChild), (!n.initialized || !n.heightInitialized) && r.push(n), n.initialize(), c || (h = n.getElement().offsetHeight, h > this.vDomWindowBuffer && (this.vDomWindowBuffer = h * 2)), e -= h, o += h, this.vDomTop--, a--, s++) : l = !1) : l = !1;
|
|
2037
|
+
} else
|
|
2038
|
+
l = !1;
|
|
2039
|
+
for (let n of r)
|
|
2040
|
+
n.clearCellHeight();
|
|
2041
|
+
this._quickNormalizeRowHeight(r), o && (this.vDomTopPad -= o, this.vDomTopPad < 0 && (this.vDomTopPad = a * this.vDomRowHeight), a < 1 && (this.vDomTopPad = 0), i.style.paddingTop = this.vDomTopPad + "px", this.vDomScrollPosTop -= o);
|
|
2042
|
+
}
|
|
2043
|
+
_removeTopRow(t, e) {
|
|
2044
|
+
for (var i = [], r = 0, o = 0, a = !0; a; ) {
|
|
2045
|
+
let s = t[this.vDomTop], l;
|
|
2046
|
+
s && o < this.vDomMaxRenderChain ? (l = s.getHeight() || this.vDomRowHeight, e >= l ? (this.vDomTop++, e -= l, r += l, i.push(s), o++) : a = !1) : a = !1;
|
|
2047
|
+
}
|
|
2048
|
+
for (let s of i) {
|
|
2049
|
+
let l = s.getElement();
|
|
2050
|
+
l.parentNode && l.parentNode.removeChild(l);
|
|
2051
|
+
}
|
|
2052
|
+
r && (this.vDomTopPad += r, this.tableElement.style.paddingTop = this.vDomTopPad + "px", this.vDomScrollPosTop += this.vDomTop ? r : r + this.vDomWindowBuffer);
|
|
2053
|
+
}
|
|
2054
|
+
_addBottomRow(t, e) {
|
|
2055
|
+
for (var i = this.tableElement, r = [], o = 0, a = this.vDomBottom + 1, s = 0, l = !0; l; ) {
|
|
2056
|
+
let n = t[a], h, c;
|
|
2057
|
+
n && s < this.vDomMaxRenderChain ? (h = n.getHeight() || this.vDomRowHeight, c = n.initialized, e >= h ? (this.styleRow(n, a), i.appendChild(n.getElement()), (!n.initialized || !n.heightInitialized) && r.push(n), n.initialize(), c || (h = n.getElement().offsetHeight, h > this.vDomWindowBuffer && (this.vDomWindowBuffer = h * 2)), e -= h, o += h, this.vDomBottom++, a++, s++) : l = !1) : l = !1;
|
|
2058
|
+
}
|
|
2059
|
+
for (let n of r)
|
|
2060
|
+
n.clearCellHeight();
|
|
2061
|
+
this._quickNormalizeRowHeight(r), o && (this.vDomBottomPad -= o, (this.vDomBottomPad < 0 || a == t.length - 1) && (this.vDomBottomPad = 0), i.style.paddingBottom = this.vDomBottomPad + "px", this.vDomScrollPosBottom += o);
|
|
2062
|
+
}
|
|
2063
|
+
_removeBottomRow(t, e) {
|
|
2064
|
+
for (var i = [], r = 0, o = 0, a = !0; a; ) {
|
|
2065
|
+
let s = t[this.vDomBottom], l;
|
|
2066
|
+
s && o < this.vDomMaxRenderChain ? (l = s.getHeight() || this.vDomRowHeight, e >= l ? (this.vDomBottom--, e -= l, r += l, i.push(s), o++) : a = !1) : a = !1;
|
|
2067
|
+
}
|
|
2068
|
+
for (let s of i) {
|
|
2069
|
+
let l = s.getElement();
|
|
2070
|
+
l.parentNode && l.parentNode.removeChild(l);
|
|
2071
|
+
}
|
|
2072
|
+
r && (this.vDomBottomPad += r, this.vDomBottomPad < 0 && (this.vDomBottomPad = 0), this.tableElement.style.paddingBottom = this.vDomBottomPad + "px", this.vDomScrollPosBottom -= r);
|
|
2073
|
+
}
|
|
2074
|
+
_quickNormalizeRowHeight(t) {
|
|
2075
|
+
for (let e of t)
|
|
2076
|
+
e.calcHeight();
|
|
2077
|
+
for (let e of t)
|
|
2078
|
+
e.setCellHeight();
|
|
2079
|
+
}
|
|
2080
|
+
}
|
|
2081
|
+
class gt extends y {
|
|
2082
|
+
constructor(t) {
|
|
2083
|
+
super(t), this.element = this.createHolderElement(), this.tableElement = this.createTableElement(), this.heightFixer = this.createTableElement(), this.placeholder = null, this.placeholderContents = null, this.firstRender = !1, this.renderMode = "virtual", this.fixedHeight = !1, this.rows = [], this.activeRowsPipeline = [], this.activeRows = [], this.activeRowsCount = 0, this.displayRows = [], this.displayRowsCount = 0, this.scrollTop = 0, this.scrollLeft = 0, this.redrawBlock = !1, this.redrawBlockRestoreConfig = !1, this.redrawBlockRenderInPosition = !1, this.dataPipeline = [], this.displayPipeline = [], this.scrollbarWidth = 0, this.renderer = null;
|
|
2084
|
+
}
|
|
2085
|
+
//////////////// Setup Functions /////////////////
|
|
2086
|
+
createHolderElement() {
|
|
2087
|
+
var t = document.createElement("div");
|
|
2088
|
+
return t.classList.add("tabulator-tableholder"), t.setAttribute("tabindex", 0), t;
|
|
2089
|
+
}
|
|
2090
|
+
createTableElement() {
|
|
2091
|
+
var t = document.createElement("div");
|
|
2092
|
+
return t.classList.add("tabulator-table"), t.setAttribute("role", "rowgroup"), t;
|
|
2093
|
+
}
|
|
2094
|
+
initializePlaceholder() {
|
|
2095
|
+
var t = this.table.options.placeholder;
|
|
2096
|
+
if (typeof t == "function" && (t = t.call(this.table)), t = this.chain("placeholder", [t], t, t) || t, t) {
|
|
2097
|
+
let e = document.createElement("div");
|
|
2098
|
+
if (e.classList.add("tabulator-placeholder"), typeof t == "string") {
|
|
2099
|
+
let i = document.createElement("div");
|
|
2100
|
+
i.classList.add("tabulator-placeholder-contents"), i.innerHTML = t, e.appendChild(i), this.placeholderContents = i;
|
|
2101
|
+
} else typeof HTMLElement < "u" && t instanceof HTMLElement ? (e.appendChild(t), this.placeholderContents = t) : (console.warn("Invalid placeholder provided, must be string or HTML Element", t), this.el = null);
|
|
2102
|
+
this.placeholder = e;
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
//return containing element
|
|
2106
|
+
getElement() {
|
|
2107
|
+
return this.element;
|
|
2108
|
+
}
|
|
2109
|
+
//return table element
|
|
2110
|
+
getTableElement() {
|
|
2111
|
+
return this.tableElement;
|
|
2112
|
+
}
|
|
2113
|
+
initialize() {
|
|
2114
|
+
this.initializePlaceholder(), this.initializeRenderer(), this.element.appendChild(this.tableElement), this.firstRender = !0, this.element.addEventListener("scroll", () => {
|
|
2115
|
+
var t = this.element.scrollLeft, e = this.scrollLeft > t, i = this.element.scrollTop, r = this.scrollTop > i;
|
|
2116
|
+
this.scrollLeft != t && (this.scrollLeft = t, this.dispatch("scroll-horizontal", t, e), this.dispatchExternal("scrollHorizontal", t, e), this._positionPlaceholder()), this.scrollTop != i && (this.scrollTop = i, this.renderer.scrollRows(i, r), this.dispatch("scroll-vertical", i, r), this.dispatchExternal("scrollVertical", i, r));
|
|
2117
|
+
});
|
|
2118
|
+
}
|
|
2119
|
+
////////////////// Row Manipulation //////////////////
|
|
2120
|
+
findRow(t) {
|
|
2121
|
+
if (typeof t == "object") {
|
|
2122
|
+
if (t instanceof k)
|
|
2123
|
+
return t;
|
|
2124
|
+
if (t instanceof Z)
|
|
2125
|
+
return t._getSelf() || !1;
|
|
2126
|
+
if (typeof HTMLElement < "u" && t instanceof HTMLElement)
|
|
2127
|
+
return this.rows.find((i) => i.getElement() === t) || !1;
|
|
2128
|
+
if (t === null)
|
|
2129
|
+
return !1;
|
|
2130
|
+
} else return typeof t > "u" ? !1 : this.rows.find((i) => i.data[this.table.options.index] == t) || !1;
|
|
2131
|
+
return !1;
|
|
2132
|
+
}
|
|
2133
|
+
getRowFromDataObject(t) {
|
|
2134
|
+
var e = this.rows.find((i) => i.data === t);
|
|
2135
|
+
return e || !1;
|
|
2136
|
+
}
|
|
2137
|
+
getRowFromPosition(t) {
|
|
2138
|
+
return this.getDisplayRows().find((e) => e.type === "row" && e.getPosition() === t && e.isDisplayed());
|
|
2139
|
+
}
|
|
2140
|
+
scrollToRow(t, e, i) {
|
|
2141
|
+
return this.renderer.scrollToRowPosition(t, e, i);
|
|
2142
|
+
}
|
|
2143
|
+
////////////////// Data Handling //////////////////
|
|
2144
|
+
setData(t, e, i) {
|
|
2145
|
+
return new Promise((r, o) => {
|
|
2146
|
+
e && this.getDisplayRows().length ? this.table.options.pagination ? this._setDataActual(t, !0) : this.reRenderInPosition(() => {
|
|
2147
|
+
this._setDataActual(t);
|
|
2148
|
+
}) : (this.table.options.autoColumns && i && this.table.initialized && this.table.columnManager.generateColumnsFromRowData(t), this.resetScroll(), this._setDataActual(t)), r();
|
|
2149
|
+
});
|
|
2150
|
+
}
|
|
2151
|
+
_setDataActual(t, e) {
|
|
2152
|
+
this.dispatchExternal("dataProcessing", t), this._wipeElements(), Array.isArray(t) ? (this.dispatch("data-processing", t), t.forEach((i, r) => {
|
|
2153
|
+
if (i && typeof i == "object") {
|
|
2154
|
+
var o = new k(i, this);
|
|
2155
|
+
this.rows.push(o);
|
|
2156
|
+
} else
|
|
2157
|
+
console.warn("Data Loading Warning - Invalid row data detected and ignored, expecting object but received:", i);
|
|
2158
|
+
}), this.refreshActiveData(!1, !1, e), this.dispatch("data-processed", t), this.dispatchExternal("dataProcessed", t)) : console.error(`Data Loading Error - Unable to process data due to invalid data type
|
|
2159
|
+
Expecting: array
|
|
2160
|
+
Received: `, typeof t, `
|
|
2161
|
+
Data: `, t);
|
|
2162
|
+
}
|
|
2163
|
+
_wipeElements() {
|
|
2164
|
+
this.dispatch("rows-wipe"), this.destroy(), this.adjustTableSize(), this.dispatch("rows-wiped");
|
|
2165
|
+
}
|
|
2166
|
+
destroy() {
|
|
2167
|
+
this.rows.forEach((t) => {
|
|
2168
|
+
t.wipe();
|
|
2169
|
+
}), this.rows = [], this.activeRows = [], this.activeRowsPipeline = [], this.activeRowsCount = 0, this.displayRows = [], this.displayRowsCount = 0;
|
|
2170
|
+
}
|
|
2171
|
+
deleteRow(t, e) {
|
|
2172
|
+
var i = this.rows.indexOf(t), r = this.activeRows.indexOf(t);
|
|
2173
|
+
r > -1 && this.activeRows.splice(r, 1), i > -1 && this.rows.splice(i, 1), this.setActiveRows(this.activeRows), this.displayRowIterator((o) => {
|
|
2174
|
+
var a = o.indexOf(t);
|
|
2175
|
+
a > -1 && o.splice(a, 1);
|
|
2176
|
+
}), e || this.reRenderInPosition(), this.regenerateRowPositions(), this.dispatchExternal("rowDeleted", t.getComponent()), this.displayRowsCount || this.tableEmpty(), this.subscribedExternal("dataChanged") && this.dispatchExternal("dataChanged", this.getData());
|
|
2177
|
+
}
|
|
2178
|
+
addRow(t, e, i, r) {
|
|
2179
|
+
var o = this.addRowActual(t, e, i, r);
|
|
2180
|
+
return o;
|
|
2181
|
+
}
|
|
2182
|
+
//add multiple rows
|
|
2183
|
+
addRows(t, e, i, r) {
|
|
2184
|
+
var o = [];
|
|
2185
|
+
return new Promise((a, s) => {
|
|
2186
|
+
e = this.findAddRowPos(e), Array.isArray(t) || (t = [t]), (typeof i > "u" && e || typeof i < "u" && !e) && t.reverse(), t.forEach((l, n) => {
|
|
2187
|
+
var h = this.addRow(l, e, i, !0);
|
|
2188
|
+
o.push(h), this.dispatch("row-added", h, l, e, i);
|
|
2189
|
+
}), this.refreshActiveData(r ? "displayPipeline" : !1, !1, !0), this.regenerateRowPositions(), this.displayRowsCount && this._clearPlaceholder(), a(o);
|
|
2190
|
+
});
|
|
2191
|
+
}
|
|
2192
|
+
findAddRowPos(t) {
|
|
2193
|
+
return typeof t > "u" && (t = this.table.options.addRowPos), t === "pos" && (t = !0), t === "bottom" && (t = !1), t;
|
|
2194
|
+
}
|
|
2195
|
+
addRowActual(t, e, i, r) {
|
|
2196
|
+
var o = t instanceof k ? t : new k(t || {}, this), a = this.findAddRowPos(e), s = -1, l, n;
|
|
2197
|
+
return i || (n = this.chain("row-adding-position", [o, a], null, { index: i, top: a }), i = n.index, a = n.top), typeof i < "u" && (i = this.findRow(i)), i = this.chain("row-adding-index", [o, i, a], null, i), i && (s = this.rows.indexOf(i)), i && s > -1 ? (l = this.activeRows.indexOf(i), this.displayRowIterator(function(h) {
|
|
2198
|
+
var c = h.indexOf(i);
|
|
2199
|
+
c > -1 && h.splice(a ? c : c + 1, 0, o);
|
|
2200
|
+
}), l > -1 && this.activeRows.splice(a ? l : l + 1, 0, o), this.rows.splice(a ? s : s + 1, 0, o)) : a ? (this.displayRowIterator(function(h) {
|
|
2201
|
+
h.unshift(o);
|
|
2202
|
+
}), this.activeRows.unshift(o), this.rows.unshift(o)) : (this.displayRowIterator(function(h) {
|
|
2203
|
+
h.push(o);
|
|
2204
|
+
}), this.activeRows.push(o), this.rows.push(o)), this.setActiveRows(this.activeRows), this.dispatchExternal("rowAdded", o.getComponent()), this.subscribedExternal("dataChanged") && this.dispatchExternal("dataChanged", this.table.rowManager.getData()), r || this.reRenderInPosition(), o;
|
|
2205
|
+
}
|
|
2206
|
+
moveRow(t, e, i) {
|
|
2207
|
+
this.dispatch("row-move", t, e, i), this.moveRowActual(t, e, i), this.regenerateRowPositions(), this.dispatch("row-moved", t, e, i), this.dispatchExternal("rowMoved", t.getComponent());
|
|
2208
|
+
}
|
|
2209
|
+
moveRowActual(t, e, i) {
|
|
2210
|
+
this.moveRowInArray(this.rows, t, e, i), this.moveRowInArray(this.activeRows, t, e, i), this.displayRowIterator((r) => {
|
|
2211
|
+
this.moveRowInArray(r, t, e, i);
|
|
2212
|
+
}), this.dispatch("row-moving", t, e, i);
|
|
2213
|
+
}
|
|
2214
|
+
moveRowInArray(t, e, i, r) {
|
|
2215
|
+
var o, a, s, l;
|
|
2216
|
+
if (e !== i && (o = t.indexOf(e), o > -1 && (t.splice(o, 1), a = t.indexOf(i), a > -1 ? r ? t.splice(a + 1, 0, e) : t.splice(a, 0, e) : t.splice(o, 0, e)), t === this.getDisplayRows())) {
|
|
2217
|
+
s = o < a ? o : a, l = a > o ? a : o + 1;
|
|
2218
|
+
for (let n = s; n <= l; n++)
|
|
2219
|
+
t[n] && this.styleRow(t[n], n);
|
|
2220
|
+
}
|
|
2221
|
+
}
|
|
2222
|
+
clearData() {
|
|
2223
|
+
this.setData([]);
|
|
2224
|
+
}
|
|
2225
|
+
getRowIndex(t) {
|
|
2226
|
+
return this.findRowIndex(t, this.rows);
|
|
2227
|
+
}
|
|
2228
|
+
getDisplayRowIndex(t) {
|
|
2229
|
+
var e = this.getDisplayRows().indexOf(t);
|
|
2230
|
+
return e > -1 ? e : !1;
|
|
2231
|
+
}
|
|
2232
|
+
nextDisplayRow(t, e) {
|
|
2233
|
+
var i = this.getDisplayRowIndex(t), r = !1;
|
|
2234
|
+
return i !== !1 && i < this.displayRowsCount - 1 && (r = this.getDisplayRows()[i + 1]), r && (!(r instanceof k) || r.type != "row") ? this.nextDisplayRow(r, e) : r;
|
|
2235
|
+
}
|
|
2236
|
+
prevDisplayRow(t, e) {
|
|
2237
|
+
var i = this.getDisplayRowIndex(t), r = !1;
|
|
2238
|
+
return i && (r = this.getDisplayRows()[i - 1]), e && r && (!(r instanceof k) || r.type != "row") ? this.prevDisplayRow(r, e) : r;
|
|
2239
|
+
}
|
|
2240
|
+
findRowIndex(t, e) {
|
|
2241
|
+
var i;
|
|
2242
|
+
return t = this.findRow(t), t && (i = e.indexOf(t), i > -1) ? i : !1;
|
|
2243
|
+
}
|
|
2244
|
+
getData(t, e) {
|
|
2245
|
+
var i = [], r = this.getRows(t);
|
|
2246
|
+
return r.forEach(function(o) {
|
|
2247
|
+
o.type == "row" && i.push(o.getData(e || "data"));
|
|
2248
|
+
}), i;
|
|
2249
|
+
}
|
|
2250
|
+
getComponents(t) {
|
|
2251
|
+
var e = [], i = this.getRows(t);
|
|
2252
|
+
return i.forEach(function(r) {
|
|
2253
|
+
e.push(r.getComponent());
|
|
2254
|
+
}), e;
|
|
2255
|
+
}
|
|
2256
|
+
getDataCount(t) {
|
|
2257
|
+
var e = this.getRows(t);
|
|
2258
|
+
return e.length;
|
|
2259
|
+
}
|
|
2260
|
+
scrollHorizontal(t) {
|
|
2261
|
+
this.scrollLeft = t, this.element.scrollLeft = t, this.dispatch("scroll-horizontal", t);
|
|
2262
|
+
}
|
|
2263
|
+
registerDataPipelineHandler(t, e) {
|
|
2264
|
+
typeof e < "u" ? (this.dataPipeline.push({ handler: t, priority: e }), this.dataPipeline.sort((i, r) => i.priority - r.priority)) : console.error("Data pipeline handlers must have a priority in order to be registered");
|
|
2265
|
+
}
|
|
2266
|
+
registerDisplayPipelineHandler(t, e) {
|
|
2267
|
+
typeof e < "u" ? (this.displayPipeline.push({ handler: t, priority: e }), this.displayPipeline.sort((i, r) => i.priority - r.priority)) : console.error("Display pipeline handlers must have a priority in order to be registered");
|
|
2268
|
+
}
|
|
2269
|
+
//set active data set
|
|
2270
|
+
refreshActiveData(t, e, i) {
|
|
2271
|
+
var r = this.table, o = "", a = 0, s = ["all", "dataPipeline", "display", "displayPipeline", "end"];
|
|
2272
|
+
if (!this.table.destroyed) {
|
|
2273
|
+
if (typeof t == "function")
|
|
2274
|
+
if (a = this.dataPipeline.findIndex((l) => l.handler === t), a > -1)
|
|
2275
|
+
o = "dataPipeline", e && (a == this.dataPipeline.length - 1 ? o = "display" : a++);
|
|
2276
|
+
else if (a = this.displayPipeline.findIndex((l) => l.handler === t), a > -1)
|
|
2277
|
+
o = "displayPipeline", e && (a == this.displayPipeline.length - 1 ? o = "end" : a++);
|
|
2278
|
+
else {
|
|
2279
|
+
console.error("Unable to refresh data, invalid handler provided", t);
|
|
2280
|
+
return;
|
|
2281
|
+
}
|
|
2282
|
+
else
|
|
2283
|
+
o = t || "all", a = 0;
|
|
2284
|
+
if (this.redrawBlock) {
|
|
2285
|
+
(!this.redrawBlockRestoreConfig || this.redrawBlockRestoreConfig && (this.redrawBlockRestoreConfig.stage === o && a < this.redrawBlockRestoreConfig.index || s.indexOf(o) < s.indexOf(this.redrawBlockRestoreConfig.stage))) && (this.redrawBlockRestoreConfig = {
|
|
2286
|
+
handler: t,
|
|
2287
|
+
skipStage: e,
|
|
2288
|
+
renderInPosition: i,
|
|
2289
|
+
stage: o,
|
|
2290
|
+
index: a
|
|
2291
|
+
});
|
|
2292
|
+
return;
|
|
2293
|
+
} else
|
|
2294
|
+
v.elVisible(this.element) ? i ? this.reRenderInPosition(this.refreshPipelines.bind(this, t, o, a, i)) : (this.refreshPipelines(t, o, a, i), t || this.table.columnManager.renderer.renderColumns(), this.renderTable(), r.options.layoutColumnsOnNewData && this.table.columnManager.redraw(!0)) : this.refreshPipelines(t, o, a, i), this.dispatch("data-refreshed");
|
|
2295
|
+
}
|
|
2296
|
+
}
|
|
2297
|
+
refreshPipelines(t, e, i, r) {
|
|
2298
|
+
switch (this.dispatch("data-refreshing"), (!t || !this.activeRowsPipeline[0]) && (this.activeRowsPipeline[0] = this.rows.slice(0)), e) {
|
|
2299
|
+
case "all":
|
|
2300
|
+
case "dataPipeline":
|
|
2301
|
+
for (let o = i; o < this.dataPipeline.length; o++) {
|
|
2302
|
+
let a = this.dataPipeline[o].handler(this.activeRowsPipeline[o].slice(0));
|
|
2303
|
+
this.activeRowsPipeline[o + 1] = a || this.activeRowsPipeline[o].slice(0);
|
|
2304
|
+
}
|
|
2305
|
+
this.setActiveRows(this.activeRowsPipeline[this.dataPipeline.length]);
|
|
2306
|
+
case "display":
|
|
2307
|
+
i = 0, this.resetDisplayRows();
|
|
2308
|
+
case "displayPipeline":
|
|
2309
|
+
for (let o = i; o < this.displayPipeline.length; o++) {
|
|
2310
|
+
let a = this.displayPipeline[o].handler((o ? this.getDisplayRows(o - 1) : this.activeRows).slice(0), r);
|
|
2311
|
+
this.setDisplayRows(a || this.getDisplayRows(o - 1).slice(0), o);
|
|
2312
|
+
}
|
|
2313
|
+
case "end":
|
|
2314
|
+
this.regenerateRowPositions();
|
|
2315
|
+
}
|
|
2316
|
+
this.getDisplayRows().length && this._clearPlaceholder();
|
|
2317
|
+
}
|
|
2318
|
+
//regenerate row positions
|
|
2319
|
+
regenerateRowPositions() {
|
|
2320
|
+
var t = this.getDisplayRows(), e = 1;
|
|
2321
|
+
t.forEach((i) => {
|
|
2322
|
+
i.type === "row" && (i.setPosition(e), e++);
|
|
2323
|
+
});
|
|
2324
|
+
}
|
|
2325
|
+
setActiveRows(t) {
|
|
2326
|
+
this.activeRows = this.activeRows = Object.assign([], t), this.activeRowsCount = this.activeRows.length;
|
|
2327
|
+
}
|
|
2328
|
+
//reset display rows array
|
|
2329
|
+
resetDisplayRows() {
|
|
2330
|
+
this.displayRows = [], this.displayRows.push(this.activeRows.slice(0)), this.displayRowsCount = this.displayRows[0].length;
|
|
2331
|
+
}
|
|
2332
|
+
//set display row pipeline data
|
|
2333
|
+
setDisplayRows(t, e) {
|
|
2334
|
+
this.displayRows[e] = t, e == this.displayRows.length - 1 && (this.displayRowsCount = this.displayRows[this.displayRows.length - 1].length);
|
|
2335
|
+
}
|
|
2336
|
+
getDisplayRows(t) {
|
|
2337
|
+
return typeof t > "u" ? this.displayRows.length ? this.displayRows[this.displayRows.length - 1] : [] : this.displayRows[t] || [];
|
|
2338
|
+
}
|
|
2339
|
+
getVisibleRows(t, e) {
|
|
2340
|
+
var i = Object.assign([], this.renderer.visibleRows(!e));
|
|
2341
|
+
return t && (i = this.chain("rows-visible", [e], i, i)), i;
|
|
2342
|
+
}
|
|
2343
|
+
//repeat action across display rows
|
|
2344
|
+
displayRowIterator(t) {
|
|
2345
|
+
this.activeRowsPipeline.forEach(t), this.displayRows.forEach(t), this.displayRowsCount = this.displayRows[this.displayRows.length - 1].length;
|
|
2346
|
+
}
|
|
2347
|
+
//return only actual rows (not group headers etc)
|
|
2348
|
+
getRows(t) {
|
|
2349
|
+
var e = [];
|
|
2350
|
+
switch (t) {
|
|
2351
|
+
case "active":
|
|
2352
|
+
e = this.activeRows;
|
|
2353
|
+
break;
|
|
2354
|
+
case "display":
|
|
2355
|
+
e = this.table.rowManager.getDisplayRows();
|
|
2356
|
+
break;
|
|
2357
|
+
case "visible":
|
|
2358
|
+
e = this.getVisibleRows(!1, !0);
|
|
2359
|
+
break;
|
|
2360
|
+
default:
|
|
2361
|
+
e = this.chain("rows-retrieve", t, null, this.rows) || this.rows;
|
|
2362
|
+
}
|
|
2363
|
+
return e;
|
|
2364
|
+
}
|
|
2365
|
+
///////////////// Table Rendering /////////////////
|
|
2366
|
+
//trigger rerender of table in current position
|
|
2367
|
+
reRenderInPosition(t) {
|
|
2368
|
+
this.redrawBlock ? t ? t() : this.redrawBlockRenderInPosition = !0 : (this.dispatchExternal("renderStarted"), this.renderer.rerenderRows(t), this.fixedHeight || this.adjustTableSize(), this.scrollBarCheck(), this.dispatchExternal("renderComplete"));
|
|
2369
|
+
}
|
|
2370
|
+
scrollBarCheck() {
|
|
2371
|
+
var t = 0;
|
|
2372
|
+
this.element.scrollHeight > this.element.clientHeight && (t = this.element.offsetWidth - this.element.clientWidth), t !== this.scrollbarWidth && (this.scrollbarWidth = t, this.dispatch("scrollbar-vertical", t));
|
|
2373
|
+
}
|
|
2374
|
+
initializeRenderer() {
|
|
2375
|
+
var t, e = {
|
|
2376
|
+
virtual: ft,
|
|
2377
|
+
basic: bt
|
|
2378
|
+
};
|
|
2379
|
+
typeof this.table.options.renderVertical == "string" ? t = e[this.table.options.renderVertical] : t = this.table.options.renderVertical, t ? (this.renderMode = this.table.options.renderVertical, this.renderer = new t(this.table, this.element, this.tableElement), this.renderer.initialize(), (this.table.element.clientHeight || this.table.options.height) && !(this.table.options.minHeight && this.table.options.maxHeight) ? this.fixedHeight = !0 : this.fixedHeight = !1) : console.error("Unable to find matching renderer:", this.table.options.renderVertical);
|
|
2380
|
+
}
|
|
2381
|
+
getRenderMode() {
|
|
2382
|
+
return this.renderMode;
|
|
2383
|
+
}
|
|
2384
|
+
renderTable() {
|
|
2385
|
+
this.dispatchExternal("renderStarted"), this.element.scrollTop = 0, this._clearTable(), this.displayRowsCount ? (this.renderer.renderRows(), this.firstRender && (this.firstRender = !1, this.fixedHeight || this.adjustTableSize(), this.layoutRefresh(!0))) : this.renderEmptyScroll(), this.fixedHeight || this.adjustTableSize(), this.dispatch("table-layout"), this.displayRowsCount || this._showPlaceholder(), this.scrollBarCheck(), this.dispatchExternal("renderComplete");
|
|
2386
|
+
}
|
|
2387
|
+
//show scrollbars on empty table div
|
|
2388
|
+
renderEmptyScroll() {
|
|
2389
|
+
this.placeholder ? this.tableElement.style.display = "none" : this.tableElement.style.minWidth = this.table.columnManager.getWidth() + "px";
|
|
2390
|
+
}
|
|
2391
|
+
_clearTable() {
|
|
2392
|
+
this._clearPlaceholder(), this.scrollTop = 0, this.scrollLeft = 0, this.renderer.clearRows();
|
|
2393
|
+
}
|
|
2394
|
+
tableEmpty() {
|
|
2395
|
+
this.renderEmptyScroll(), this._showPlaceholder();
|
|
2396
|
+
}
|
|
2397
|
+
checkPlaceholder() {
|
|
2398
|
+
this.displayRowsCount ? this._clearPlaceholder() : this.tableEmpty();
|
|
2399
|
+
}
|
|
2400
|
+
_showPlaceholder() {
|
|
2401
|
+
this.placeholder && (this.placeholder && this.placeholder.parentNode && this.placeholder.parentNode.removeChild(this.placeholder), this.initializePlaceholder(), this.placeholder.setAttribute("tabulator-render-mode", this.renderMode), this.getElement().appendChild(this.placeholder), this._positionPlaceholder(), this.adjustTableSize());
|
|
2402
|
+
}
|
|
2403
|
+
_clearPlaceholder() {
|
|
2404
|
+
this.placeholder && this.placeholder.parentNode && this.placeholder.parentNode.removeChild(this.placeholder), this.tableElement.style.minWidth = "", this.tableElement.style.display = "";
|
|
2405
|
+
}
|
|
2406
|
+
_positionPlaceholder() {
|
|
2407
|
+
this.placeholder && this.placeholder.parentNode && (this.placeholder.style.width = this.table.columnManager.getWidth() + "px", this.placeholderContents.style.width = this.table.rowManager.element.clientWidth + "px", this.placeholderContents.style.marginLeft = this.scrollLeft + "px");
|
|
2408
|
+
}
|
|
2409
|
+
styleRow(t, e) {
|
|
2410
|
+
var i = t.getElement();
|
|
2411
|
+
e % 2 ? (i.classList.add("tabulator-row-even"), i.classList.remove("tabulator-row-odd")) : (i.classList.add("tabulator-row-odd"), i.classList.remove("tabulator-row-even"));
|
|
2412
|
+
}
|
|
2413
|
+
//normalize height of active rows
|
|
2414
|
+
normalizeHeight(t) {
|
|
2415
|
+
this.activeRows.forEach(function(e) {
|
|
2416
|
+
e.normalizeHeight(t);
|
|
2417
|
+
});
|
|
2418
|
+
}
|
|
2419
|
+
//adjust the height of the table holder to fit in the Tabulator element
|
|
2420
|
+
adjustTableSize() {
|
|
2421
|
+
let t = this.element.clientHeight, e, i = !1;
|
|
2422
|
+
if (this.renderer.verticalFillMode === "fill") {
|
|
2423
|
+
let r = Math.floor(this.table.columnManager.getElement().getBoundingClientRect().height + (this.table.footerManager && this.table.footerManager.active && !this.table.footerManager.external ? this.table.footerManager.getElement().getBoundingClientRect().height : 0));
|
|
2424
|
+
if (this.fixedHeight) {
|
|
2425
|
+
e = isNaN(this.table.options.minHeight) ? this.table.options.minHeight : this.table.options.minHeight + "px";
|
|
2426
|
+
const o = "calc(100% - " + r + "px)";
|
|
2427
|
+
this.element.style.minHeight = e || "calc(100% - " + r + "px)", this.element.style.height = o, this.element.style.maxHeight = o;
|
|
2428
|
+
} else
|
|
2429
|
+
this.element.style.height = "", this.element.style.height = this.table.element.clientHeight - r + "px", this.element.scrollTop = this.scrollTop;
|
|
2430
|
+
this.renderer.resize(), !this.fixedHeight && t != this.element.clientHeight && (i = !0, this.subscribed("table-resize") ? this.dispatch("table-resize") : this.redraw()), this.scrollBarCheck();
|
|
2431
|
+
}
|
|
2432
|
+
return this._positionPlaceholder(), i;
|
|
2433
|
+
}
|
|
2434
|
+
//reinitialize all rows
|
|
2435
|
+
reinitialize() {
|
|
2436
|
+
this.rows.forEach(function(t) {
|
|
2437
|
+
t.reinitialize(!0);
|
|
2438
|
+
});
|
|
2439
|
+
}
|
|
2440
|
+
//prevent table from being redrawn
|
|
2441
|
+
blockRedraw() {
|
|
2442
|
+
this.redrawBlock = !0, this.redrawBlockRestoreConfig = !1;
|
|
2443
|
+
}
|
|
2444
|
+
//restore table redrawing
|
|
2445
|
+
restoreRedraw() {
|
|
2446
|
+
this.redrawBlock = !1, this.redrawBlockRestoreConfig ? (this.refreshActiveData(this.redrawBlockRestoreConfig.handler, this.redrawBlockRestoreConfig.skipStage, this.redrawBlockRestoreConfig.renderInPosition), this.redrawBlockRestoreConfig = !1) : this.redrawBlockRenderInPosition && this.reRenderInPosition(), this.redrawBlockRenderInPosition = !1;
|
|
2447
|
+
}
|
|
2448
|
+
//redraw table
|
|
2449
|
+
redraw(t) {
|
|
2450
|
+
this.adjustTableSize(), this.table.tableWidth = this.table.element.clientWidth, t ? this.renderTable() : (this.reRenderInPosition(), this.scrollHorizontal(this.scrollLeft));
|
|
2451
|
+
}
|
|
2452
|
+
resetScroll() {
|
|
2453
|
+
if (this.element.scrollLeft = 0, this.element.scrollTop = 0, this.table.browser === "ie") {
|
|
2454
|
+
var t = document.createEvent("Event");
|
|
2455
|
+
t.initEvent("scroll", !1, !0), this.element.dispatchEvent(t);
|
|
2456
|
+
} else
|
|
2457
|
+
this.element.dispatchEvent(new Event("scroll"));
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
class vt extends y {
|
|
2461
|
+
constructor(t) {
|
|
2462
|
+
super(t), this.active = !1, this.element = this.createElement(), this.containerElement = this.createContainerElement(), this.external = !1;
|
|
2463
|
+
}
|
|
2464
|
+
initialize() {
|
|
2465
|
+
this.initializeElement();
|
|
2466
|
+
}
|
|
2467
|
+
createElement() {
|
|
2468
|
+
var t = document.createElement("div");
|
|
2469
|
+
return t.classList.add("tabulator-footer"), t;
|
|
2470
|
+
}
|
|
2471
|
+
createContainerElement() {
|
|
2472
|
+
var t = document.createElement("div");
|
|
2473
|
+
return t.classList.add("tabulator-footer-contents"), this.element.appendChild(t), t;
|
|
2474
|
+
}
|
|
2475
|
+
initializeElement() {
|
|
2476
|
+
if (this.table.options.footerElement)
|
|
2477
|
+
switch (typeof this.table.options.footerElement) {
|
|
2478
|
+
case "string":
|
|
2479
|
+
this.table.options.footerElement[0] === "<" ? this.containerElement.innerHTML = this.table.options.footerElement : (this.external = !0, this.containerElement = document.querySelector(this.table.options.footerElement));
|
|
2480
|
+
break;
|
|
2481
|
+
default:
|
|
2482
|
+
this.element = this.table.options.footerElement;
|
|
2483
|
+
break;
|
|
2484
|
+
}
|
|
2485
|
+
}
|
|
2486
|
+
getElement() {
|
|
2487
|
+
return this.element;
|
|
2488
|
+
}
|
|
2489
|
+
append(t) {
|
|
2490
|
+
this.activate(), this.containerElement.appendChild(t), this.table.rowManager.adjustTableSize();
|
|
2491
|
+
}
|
|
2492
|
+
prepend(t) {
|
|
2493
|
+
this.activate(), this.element.insertBefore(t, this.element.firstChild), this.table.rowManager.adjustTableSize();
|
|
2494
|
+
}
|
|
2495
|
+
remove(t) {
|
|
2496
|
+
t.parentNode.removeChild(t), this.deactivate();
|
|
2497
|
+
}
|
|
2498
|
+
deactivate(t) {
|
|
2499
|
+
(!this.element.firstChild || t) && (this.external || this.element.parentNode.removeChild(this.element), this.active = !1);
|
|
2500
|
+
}
|
|
2501
|
+
activate() {
|
|
2502
|
+
this.active || (this.active = !0, this.external || (this.table.element.appendChild(this.getElement()), this.table.element.style.display = ""));
|
|
2503
|
+
}
|
|
2504
|
+
redraw() {
|
|
2505
|
+
this.dispatch("footer-redraw");
|
|
2506
|
+
}
|
|
2507
|
+
}
|
|
2508
|
+
class wt extends y {
|
|
2509
|
+
constructor(t) {
|
|
2510
|
+
super(t), this.el = null, this.abortClasses = ["tabulator-headers", "tabulator-table"], this.previousTargets = {}, this.listeners = [
|
|
2511
|
+
"click",
|
|
2512
|
+
"dblclick",
|
|
2513
|
+
"contextmenu",
|
|
2514
|
+
"mouseenter",
|
|
2515
|
+
"mouseleave",
|
|
2516
|
+
"mouseover",
|
|
2517
|
+
"mouseout",
|
|
2518
|
+
"mousemove",
|
|
2519
|
+
"mouseup",
|
|
2520
|
+
"mousedown",
|
|
2521
|
+
"touchstart",
|
|
2522
|
+
"touchend"
|
|
2523
|
+
], this.componentMap = {
|
|
2524
|
+
"tabulator-cell": "cell",
|
|
2525
|
+
"tabulator-row": "row",
|
|
2526
|
+
"tabulator-group": "group",
|
|
2527
|
+
"tabulator-col": "column"
|
|
2528
|
+
}, this.pseudoTrackers = {
|
|
2529
|
+
row: {
|
|
2530
|
+
subscriber: null,
|
|
2531
|
+
target: null
|
|
2532
|
+
},
|
|
2533
|
+
cell: {
|
|
2534
|
+
subscriber: null,
|
|
2535
|
+
target: null
|
|
2536
|
+
},
|
|
2537
|
+
group: {
|
|
2538
|
+
subscriber: null,
|
|
2539
|
+
target: null
|
|
2540
|
+
},
|
|
2541
|
+
column: {
|
|
2542
|
+
subscriber: null,
|
|
2543
|
+
target: null
|
|
2544
|
+
}
|
|
2545
|
+
}, this.pseudoTracking = !1;
|
|
2546
|
+
}
|
|
2547
|
+
initialize() {
|
|
2548
|
+
this.el = this.table.element, this.buildListenerMap(), this.bindSubscriptionWatchers();
|
|
2549
|
+
}
|
|
2550
|
+
buildListenerMap() {
|
|
2551
|
+
var t = {};
|
|
2552
|
+
this.listeners.forEach((e) => {
|
|
2553
|
+
t[e] = {
|
|
2554
|
+
handler: null,
|
|
2555
|
+
components: []
|
|
2556
|
+
};
|
|
2557
|
+
}), this.listeners = t;
|
|
2558
|
+
}
|
|
2559
|
+
bindPseudoEvents() {
|
|
2560
|
+
Object.keys(this.pseudoTrackers).forEach((t) => {
|
|
2561
|
+
this.pseudoTrackers[t].subscriber = this.pseudoMouseEnter.bind(this, t), this.subscribe(t + "-mouseover", this.pseudoTrackers[t].subscriber);
|
|
2562
|
+
}), this.pseudoTracking = !0;
|
|
2563
|
+
}
|
|
2564
|
+
pseudoMouseEnter(t, e, i) {
|
|
2565
|
+
this.pseudoTrackers[t].target !== i && (this.pseudoTrackers[t].target && this.dispatch(t + "-mouseleave", e, this.pseudoTrackers[t].target), this.pseudoMouseLeave(t, e), this.pseudoTrackers[t].target = i, this.dispatch(t + "-mouseenter", e, i));
|
|
2566
|
+
}
|
|
2567
|
+
pseudoMouseLeave(t, e) {
|
|
2568
|
+
var i = Object.keys(this.pseudoTrackers), r = {
|
|
2569
|
+
row: ["cell"],
|
|
2570
|
+
cell: ["row"]
|
|
2571
|
+
};
|
|
2572
|
+
i = i.filter((o) => {
|
|
2573
|
+
var a = r[t];
|
|
2574
|
+
return o !== t && (!a || a && !a.includes(o));
|
|
2575
|
+
}), i.forEach((o) => {
|
|
2576
|
+
var a = this.pseudoTrackers[o].target;
|
|
2577
|
+
this.pseudoTrackers[o].target && (this.dispatch(o + "-mouseleave", e, a), this.pseudoTrackers[o].target = null);
|
|
2578
|
+
});
|
|
2579
|
+
}
|
|
2580
|
+
bindSubscriptionWatchers() {
|
|
2581
|
+
var t = Object.keys(this.listeners), e = Object.values(this.componentMap);
|
|
2582
|
+
for (let i of e)
|
|
2583
|
+
for (let r of t) {
|
|
2584
|
+
let o = i + "-" + r;
|
|
2585
|
+
this.subscriptionChange(o, this.subscriptionChanged.bind(this, i, r));
|
|
2586
|
+
}
|
|
2587
|
+
this.subscribe("table-destroy", this.clearWatchers.bind(this));
|
|
2588
|
+
}
|
|
2589
|
+
subscriptionChanged(t, e, i) {
|
|
2590
|
+
var r = this.listeners[e].components, o = r.indexOf(t), a = !1;
|
|
2591
|
+
i ? o === -1 && (r.push(t), a = !0) : this.subscribed(t + "-" + e) || o > -1 && (r.splice(o, 1), a = !0), (e === "mouseenter" || e === "mouseleave") && !this.pseudoTracking && this.bindPseudoEvents(), a && this.updateEventListeners();
|
|
2592
|
+
}
|
|
2593
|
+
updateEventListeners() {
|
|
2594
|
+
for (let t in this.listeners) {
|
|
2595
|
+
let e = this.listeners[t];
|
|
2596
|
+
e.components.length ? e.handler || (e.handler = this.track.bind(this, t), this.el.addEventListener(t, e.handler)) : e.handler && (this.el.removeEventListener(t, e.handler), e.handler = null);
|
|
2597
|
+
}
|
|
2598
|
+
}
|
|
2599
|
+
track(t, e) {
|
|
2600
|
+
var i = e.composedPath && e.composedPath() || e.path, r = this.findTargets(i);
|
|
2601
|
+
r = this.bindComponents(t, r), this.triggerEvents(t, e, r), this.pseudoTracking && (t == "mouseover" || t == "mouseleave") && !Object.keys(r).length && this.pseudoMouseLeave("none", e);
|
|
2602
|
+
}
|
|
2603
|
+
findTargets(t) {
|
|
2604
|
+
var e = {};
|
|
2605
|
+
let i = Object.keys(this.componentMap);
|
|
2606
|
+
for (let r of t) {
|
|
2607
|
+
let o = r.classList ? [...r.classList] : [];
|
|
2608
|
+
if (o.filter((l) => this.abortClasses.includes(l)).length)
|
|
2609
|
+
break;
|
|
2610
|
+
let s = o.filter((l) => i.includes(l));
|
|
2611
|
+
for (let l of s)
|
|
2612
|
+
e[this.componentMap[l]] || (e[this.componentMap[l]] = r);
|
|
2613
|
+
}
|
|
2614
|
+
return e.group && e.group === e.row && delete e.row, e;
|
|
2615
|
+
}
|
|
2616
|
+
bindComponents(t, e) {
|
|
2617
|
+
var i = Object.keys(e).reverse(), r = this.listeners[t], o = {}, a = {}, s = {};
|
|
2618
|
+
for (let l of i) {
|
|
2619
|
+
let n, h = e[l], c = this.previousTargets[l];
|
|
2620
|
+
if (c && c.target === h)
|
|
2621
|
+
n = c.component;
|
|
2622
|
+
else
|
|
2623
|
+
switch (l) {
|
|
2624
|
+
case "row":
|
|
2625
|
+
case "group":
|
|
2626
|
+
(r.components.includes("row") || r.components.includes("cell") || r.components.includes("group")) && (n = this.table.rowManager.getVisibleRows(!0).find((w) => w.getElement() === h), e.row && e.row.parentNode && e.row.parentNode.closest(".tabulator-row") && (e[l] = !1));
|
|
2627
|
+
break;
|
|
2628
|
+
case "column":
|
|
2629
|
+
r.components.includes("column") && (n = this.table.columnManager.findColumn(h));
|
|
2630
|
+
break;
|
|
2631
|
+
case "cell":
|
|
2632
|
+
r.components.includes("cell") && (o.row instanceof k ? n = o.row.findCell(h) : e.row && console.warn("Event Target Lookup Error - The row this cell is attached to cannot be found, has the table been reinitialized without being destroyed first?"));
|
|
2633
|
+
break;
|
|
2634
|
+
}
|
|
2635
|
+
n && (o[l] = n, s[l] = {
|
|
2636
|
+
target: h,
|
|
2637
|
+
component: n
|
|
2638
|
+
});
|
|
2639
|
+
}
|
|
2640
|
+
return this.previousTargets = s, Object.keys(e).forEach((l) => {
|
|
2641
|
+
let n = o[l];
|
|
2642
|
+
a[l] = n;
|
|
2643
|
+
}), a;
|
|
2644
|
+
}
|
|
2645
|
+
triggerEvents(t, e, i) {
|
|
2646
|
+
var r = this.listeners[t];
|
|
2647
|
+
for (let o in i)
|
|
2648
|
+
i[o] && r.components.includes(o) && this.dispatch(o + "-" + t, e, i[o]);
|
|
2649
|
+
}
|
|
2650
|
+
clearWatchers() {
|
|
2651
|
+
for (let t in this.listeners) {
|
|
2652
|
+
let e = this.listeners[t];
|
|
2653
|
+
e.handler && (this.el.removeEventListener(t, e.handler), e.handler = null);
|
|
2654
|
+
}
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
class yt {
|
|
2658
|
+
constructor(t) {
|
|
2659
|
+
this.table = t, this.bindings = {};
|
|
2660
|
+
}
|
|
2661
|
+
bind(t, e, i) {
|
|
2662
|
+
this.bindings[t] || (this.bindings[t] = {}), this.bindings[t][e] ? console.warn("Unable to bind component handler, a matching function name is already bound", t, e, i) : this.bindings[t][e] = i;
|
|
2663
|
+
}
|
|
2664
|
+
handle(t, e, i) {
|
|
2665
|
+
if (this.bindings[t] && this.bindings[t][i] && typeof this.bindings[t][i].bind == "function")
|
|
2666
|
+
return this.bindings[t][i].bind(null, e);
|
|
2667
|
+
i !== "then" && typeof i == "string" && !i.startsWith("_") && this.table.options.debugInvalidComponentFuncs && console.error("The " + t + " component does not have a " + i + " function, have you checked that you have the correct Tabulator module installed?");
|
|
2668
|
+
}
|
|
2669
|
+
}
|
|
2670
|
+
class xt extends y {
|
|
2671
|
+
constructor(t) {
|
|
2672
|
+
super(t), this.requestOrder = 0, this.loading = !1;
|
|
2673
|
+
}
|
|
2674
|
+
initialize() {
|
|
2675
|
+
}
|
|
2676
|
+
load(t, e, i, r, o, a) {
|
|
2677
|
+
var s = ++this.requestOrder;
|
|
2678
|
+
if (this.table.destroyed)
|
|
2679
|
+
return Promise.resolve();
|
|
2680
|
+
if (this.dispatchExternal("dataLoading", t), t && (t.indexOf("{") == 0 || t.indexOf("[") == 0) && (t = JSON.parse(t)), this.confirm("data-loading", [t, e, i, o])) {
|
|
2681
|
+
this.loading = !0, o || this.alertLoader(), e = this.chain("data-params", [t, i, o], e || {}, e || {}), e = this.mapParams(e, this.table.options.dataSendParams);
|
|
2682
|
+
var l = this.chain("data-load", [t, e, i, o], !1, Promise.resolve([]));
|
|
2683
|
+
return l.then((n) => {
|
|
2684
|
+
if (this.table.destroyed)
|
|
2685
|
+
console.warn("Data Load Response Blocked - Table has been destroyed");
|
|
2686
|
+
else {
|
|
2687
|
+
!Array.isArray(n) && typeof n == "object" && (n = this.mapParams(n, this.objectInvert(this.table.options.dataReceiveParams)));
|
|
2688
|
+
var h = this.chain("data-loaded", [n], null, n);
|
|
2689
|
+
s == this.requestOrder ? (this.clearAlert(), h !== !1 && (this.dispatchExternal("dataLoaded", h), this.table.rowManager.setData(h, r, typeof a > "u" ? !r : a))) : console.warn("Data Load Response Blocked - An active data load request was blocked by an attempt to change table data while the request was being made");
|
|
2690
|
+
}
|
|
2691
|
+
}).catch((n) => {
|
|
2692
|
+
console.error("Data Load Error: ", n), this.dispatchExternal("dataLoadError", n), o || this.alertError(), setTimeout(() => {
|
|
2693
|
+
this.clearAlert();
|
|
2694
|
+
}, this.table.options.dataLoaderErrorTimeout);
|
|
2695
|
+
}).finally(() => {
|
|
2696
|
+
this.loading = !1;
|
|
2697
|
+
});
|
|
2698
|
+
} else
|
|
2699
|
+
return this.dispatchExternal("dataLoaded", t), t || (t = []), this.table.rowManager.setData(t, r, typeof a > "u" ? !r : a), Promise.resolve();
|
|
2700
|
+
}
|
|
2701
|
+
mapParams(t, e) {
|
|
2702
|
+
var i = {};
|
|
2703
|
+
for (let r in t)
|
|
2704
|
+
i[e.hasOwnProperty(r) ? e[r] : r] = t[r];
|
|
2705
|
+
return i;
|
|
2706
|
+
}
|
|
2707
|
+
objectInvert(t) {
|
|
2708
|
+
var e = {};
|
|
2709
|
+
for (let i in t)
|
|
2710
|
+
e[t[i]] = i;
|
|
2711
|
+
return e;
|
|
2712
|
+
}
|
|
2713
|
+
blockActiveLoad() {
|
|
2714
|
+
this.requestOrder++;
|
|
2715
|
+
}
|
|
2716
|
+
alertLoader() {
|
|
2717
|
+
var t = typeof this.table.options.dataLoader == "function" ? this.table.options.dataLoader() : this.table.options.dataLoader;
|
|
2718
|
+
t && this.table.alertManager.alert(this.table.options.dataLoaderLoading || this.langText("data|loading"));
|
|
2719
|
+
}
|
|
2720
|
+
alertError() {
|
|
2721
|
+
this.table.alertManager.alert(this.table.options.dataLoaderError || this.langText("data|error"), "error");
|
|
2722
|
+
}
|
|
2723
|
+
clearAlert() {
|
|
2724
|
+
this.table.alertManager.clear();
|
|
2725
|
+
}
|
|
2726
|
+
}
|
|
2727
|
+
class Ct {
|
|
2728
|
+
constructor(t, e, i) {
|
|
2729
|
+
this.table = t, this.events = {}, this.optionsList = e || {}, this.subscriptionNotifiers = {}, this.dispatch = i ? this._debugDispatch.bind(this) : this._dispatch.bind(this), this.debug = i;
|
|
2730
|
+
}
|
|
2731
|
+
subscriptionChange(t, e) {
|
|
2732
|
+
this.subscriptionNotifiers[t] || (this.subscriptionNotifiers[t] = []), this.subscriptionNotifiers[t].push(e), this.subscribed(t) && this._notifySubscriptionChange(t, !0);
|
|
2733
|
+
}
|
|
2734
|
+
subscribe(t, e) {
|
|
2735
|
+
this.events[t] || (this.events[t] = []), this.events[t].push(e), this._notifySubscriptionChange(t, !0);
|
|
2736
|
+
}
|
|
2737
|
+
unsubscribe(t, e) {
|
|
2738
|
+
var i;
|
|
2739
|
+
if (this.events[t])
|
|
2740
|
+
if (e)
|
|
2741
|
+
if (i = this.events[t].findIndex((r) => r === e), i > -1)
|
|
2742
|
+
this.events[t].splice(i, 1);
|
|
2743
|
+
else {
|
|
2744
|
+
console.warn("Cannot remove event, no matching event found:", t, e);
|
|
2745
|
+
return;
|
|
2746
|
+
}
|
|
2747
|
+
else
|
|
2748
|
+
delete this.events[t];
|
|
2749
|
+
else {
|
|
2750
|
+
console.warn("Cannot remove event, no events set on:", t);
|
|
2751
|
+
return;
|
|
2752
|
+
}
|
|
2753
|
+
this._notifySubscriptionChange(t, !1);
|
|
2754
|
+
}
|
|
2755
|
+
subscribed(t) {
|
|
2756
|
+
return this.events[t] && this.events[t].length;
|
|
2757
|
+
}
|
|
2758
|
+
_notifySubscriptionChange(t, e) {
|
|
2759
|
+
var i = this.subscriptionNotifiers[t];
|
|
2760
|
+
i && i.forEach((r) => {
|
|
2761
|
+
r(e);
|
|
2762
|
+
});
|
|
2763
|
+
}
|
|
2764
|
+
_dispatch() {
|
|
2765
|
+
var t = Array.from(arguments), e = t.shift(), i;
|
|
2766
|
+
return this.events[e] && this.events[e].forEach((r, o) => {
|
|
2767
|
+
let a = r.apply(this.table, t);
|
|
2768
|
+
o || (i = a);
|
|
2769
|
+
}), i;
|
|
2770
|
+
}
|
|
2771
|
+
_debugDispatch() {
|
|
2772
|
+
var t = Array.from(arguments), e = t[0];
|
|
2773
|
+
return t[0] = "ExternalEvent:" + t[0], (this.debug === !0 || this.debug.includes(e)) && console.log(...t), this._dispatch(...arguments);
|
|
2774
|
+
}
|
|
2775
|
+
}
|
|
2776
|
+
class Et {
|
|
2777
|
+
constructor(t) {
|
|
2778
|
+
this.events = {}, this.subscriptionNotifiers = {}, this.dispatch = t ? this._debugDispatch.bind(this) : this._dispatch.bind(this), this.chain = t ? this._debugChain.bind(this) : this._chain.bind(this), this.confirm = t ? this._debugConfirm.bind(this) : this._confirm.bind(this), this.debug = t;
|
|
2779
|
+
}
|
|
2780
|
+
subscriptionChange(t, e) {
|
|
2781
|
+
this.subscriptionNotifiers[t] || (this.subscriptionNotifiers[t] = []), this.subscriptionNotifiers[t].push(e), this.subscribed(t) && this._notifySubscriptionChange(t, !0);
|
|
2782
|
+
}
|
|
2783
|
+
subscribe(t, e, i = 1e4) {
|
|
2784
|
+
this.events[t] || (this.events[t] = []), this.events[t].push({ callback: e, priority: i }), this.events[t].sort((r, o) => r.priority - o.priority), this._notifySubscriptionChange(t, !0);
|
|
2785
|
+
}
|
|
2786
|
+
unsubscribe(t, e) {
|
|
2787
|
+
var i;
|
|
2788
|
+
if (this.events[t]) {
|
|
2789
|
+
if (e)
|
|
2790
|
+
if (i = this.events[t].findIndex((r) => r.callback === e), i > -1)
|
|
2791
|
+
this.events[t].splice(i, 1);
|
|
2792
|
+
else {
|
|
2793
|
+
console.warn("Cannot remove event, no matching event found:", t, e);
|
|
2794
|
+
return;
|
|
2795
|
+
}
|
|
2796
|
+
} else {
|
|
2797
|
+
console.warn("Cannot remove event, no events set on:", t);
|
|
2798
|
+
return;
|
|
2799
|
+
}
|
|
2800
|
+
this._notifySubscriptionChange(t, !1);
|
|
2801
|
+
}
|
|
2802
|
+
subscribed(t) {
|
|
2803
|
+
return this.events[t] && this.events[t].length;
|
|
2804
|
+
}
|
|
2805
|
+
_chain(t, e, i, r) {
|
|
2806
|
+
var o = i;
|
|
2807
|
+
return Array.isArray(e) || (e = [e]), this.subscribed(t) ? (this.events[t].forEach((a, s) => {
|
|
2808
|
+
o = a.callback.apply(this, e.concat([o]));
|
|
2809
|
+
}), o) : typeof r == "function" ? r() : r;
|
|
2810
|
+
}
|
|
2811
|
+
_confirm(t, e) {
|
|
2812
|
+
var i = !1;
|
|
2813
|
+
return Array.isArray(e) || (e = [e]), this.subscribed(t) && this.events[t].forEach((r, o) => {
|
|
2814
|
+
r.callback.apply(this, e) && (i = !0);
|
|
2815
|
+
}), i;
|
|
2816
|
+
}
|
|
2817
|
+
_notifySubscriptionChange(t, e) {
|
|
2818
|
+
var i = this.subscriptionNotifiers[t];
|
|
2819
|
+
i && i.forEach((r) => {
|
|
2820
|
+
r(e);
|
|
2821
|
+
});
|
|
2822
|
+
}
|
|
2823
|
+
_dispatch() {
|
|
2824
|
+
var t = Array.from(arguments), e = t.shift();
|
|
2825
|
+
this.events[e] && this.events[e].forEach((i) => {
|
|
2826
|
+
i.callback.apply(this, t);
|
|
2827
|
+
});
|
|
2828
|
+
}
|
|
2829
|
+
_debugDispatch() {
|
|
2830
|
+
var t = Array.from(arguments), e = t[0];
|
|
2831
|
+
return t[0] = "InternalEvent:" + e, (this.debug === !0 || this.debug.includes(e)) && console.log(...t), this._dispatch(...arguments);
|
|
2832
|
+
}
|
|
2833
|
+
_debugChain() {
|
|
2834
|
+
var t = Array.from(arguments), e = t[0];
|
|
2835
|
+
return t[0] = "InternalEvent:" + e, (this.debug === !0 || this.debug.includes(e)) && console.log(...t), this._chain(...arguments);
|
|
2836
|
+
}
|
|
2837
|
+
_debugConfirm() {
|
|
2838
|
+
var t = Array.from(arguments), e = t[0];
|
|
2839
|
+
return t[0] = "InternalEvent:" + e, (this.debug === !0 || this.debug.includes(e)) && console.log(...t), this._confirm(...arguments);
|
|
2840
|
+
}
|
|
2841
|
+
}
|
|
2842
|
+
class Rt extends y {
|
|
2843
|
+
constructor(t) {
|
|
2844
|
+
super(t);
|
|
2845
|
+
}
|
|
2846
|
+
_warnUser() {
|
|
2847
|
+
this.options("debugDeprecation") && console.warn(...arguments);
|
|
2848
|
+
}
|
|
2849
|
+
check(t, e, i) {
|
|
2850
|
+
var r = "";
|
|
2851
|
+
return typeof this.options(t) < "u" ? (r = "Deprecated Setup Option - Use of the %c" + t + "%c option is now deprecated", e ? (r = r + ", Please use the %c" + e + "%c option instead", this._warnUser(r, "font-weight: bold;", "font-weight: normal;", "font-weight: bold;", "font-weight: normal;"), i && (this.table.options[e] = this.table.options[t])) : this._warnUser(r, "font-weight: bold;", "font-weight: normal;"), !1) : !0;
|
|
2852
|
+
}
|
|
2853
|
+
checkMsg(t, e) {
|
|
2854
|
+
return typeof this.options(t) < "u" ? (this._warnUser("%cDeprecated Setup Option - Use of the %c" + t + " %c option is now deprecated, " + e, "font-weight: normal;", "font-weight: bold;", "font-weight: normal;"), !1) : !0;
|
|
2855
|
+
}
|
|
2856
|
+
msg(t) {
|
|
2857
|
+
this._warnUser(t);
|
|
2858
|
+
}
|
|
2859
|
+
}
|
|
2860
|
+
class Dt extends y {
|
|
2861
|
+
constructor(t) {
|
|
2862
|
+
super(t), this.deps = {}, this.props = {};
|
|
2863
|
+
}
|
|
2864
|
+
initialize() {
|
|
2865
|
+
this.deps = Object.assign({}, this.options("dependencies"));
|
|
2866
|
+
}
|
|
2867
|
+
lookup(t, e, i) {
|
|
2868
|
+
if (Array.isArray(t)) {
|
|
2869
|
+
for (const o of t) {
|
|
2870
|
+
var r = this.lookup(o, e, !0);
|
|
2871
|
+
if (r)
|
|
2872
|
+
break;
|
|
2873
|
+
}
|
|
2874
|
+
if (r)
|
|
2875
|
+
return r;
|
|
2876
|
+
this.error(t);
|
|
2877
|
+
} else
|
|
2878
|
+
return e ? this.lookupProp(t, e, i) : this.lookupKey(t, i);
|
|
2879
|
+
}
|
|
2880
|
+
lookupProp(t, e, i) {
|
|
2881
|
+
var r;
|
|
2882
|
+
if (this.props[t] && this.props[t][e])
|
|
2883
|
+
return this.props[t][e];
|
|
2884
|
+
if (r = this.lookupKey(t, i), r)
|
|
2885
|
+
return this.props[t] || (this.props[t] = {}), this.props[t][e] = r[e] || r, this.props[t][e];
|
|
2886
|
+
}
|
|
2887
|
+
lookupKey(t, e) {
|
|
2888
|
+
var i;
|
|
2889
|
+
return this.deps[t] ? i = this.deps[t] : window[t] ? (this.deps[t] = window[t], i = this.deps[t]) : e || this.error(t), i;
|
|
2890
|
+
}
|
|
2891
|
+
error(t) {
|
|
2892
|
+
console.error("Unable to find dependency", t, "Please check documentation and ensure you have imported the required library into your project");
|
|
2893
|
+
}
|
|
2894
|
+
}
|
|
2895
|
+
function Mt(d, t) {
|
|
2896
|
+
t && this.table.columnManager.renderer.reinitializeColumnWidths(d), this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", !0) && this.table.modules.responsiveLayout.update();
|
|
2897
|
+
}
|
|
2898
|
+
function K(d, t) {
|
|
2899
|
+
d.forEach(function(e) {
|
|
2900
|
+
e.reinitializeWidth();
|
|
2901
|
+
}), this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", !0) && this.table.modules.responsiveLayout.update();
|
|
2902
|
+
}
|
|
2903
|
+
function Ht(d, t) {
|
|
2904
|
+
var e = 0, i = this.table.rowManager.element.clientWidth, r = 0, o = !1;
|
|
2905
|
+
d.forEach((a, s) => {
|
|
2906
|
+
a.widthFixed || a.reinitializeWidth(), (this.table.options.responsiveLayout ? a.modules.responsive.visible : a.visible) && (o = a), a.visible && (e += a.getWidth());
|
|
2907
|
+
}), o ? (r = i - e + o.getWidth(), this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", !0) && (o.setWidth(0), this.table.modules.responsiveLayout.update()), r > 0 ? o.setWidth(r) : o.reinitializeWidth()) : this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", !0) && this.table.modules.responsiveLayout.update();
|
|
2908
|
+
}
|
|
2909
|
+
function zt(d, t) {
|
|
2910
|
+
var e = this.table.rowManager.element.getBoundingClientRect().width, i = 0, r = 0, o = 0, a = 0, s = [], l = [], n = 0, h = 0, c = 0;
|
|
2911
|
+
function L(p) {
|
|
2912
|
+
var b;
|
|
2913
|
+
return typeof p == "string" ? p.indexOf("%") > -1 ? b = e / 100 * parseInt(p) : b = parseInt(p) : b = p, b;
|
|
2914
|
+
}
|
|
2915
|
+
function w(p, b, x, f) {
|
|
2916
|
+
var H = [], D = 0, P = 0, C = 0, M = o, _ = 0, g = 0, V = [];
|
|
2917
|
+
function q(u) {
|
|
2918
|
+
return x * (u.column.definition.widthGrow || 1);
|
|
2919
|
+
}
|
|
2920
|
+
function X(u) {
|
|
2921
|
+
return L(u.width) - x * (u.column.definition.widthShrink || 0);
|
|
2922
|
+
}
|
|
2923
|
+
return p.forEach(function(u, It) {
|
|
2924
|
+
var J = f ? X(u) : q(u);
|
|
2925
|
+
u.column.minWidth >= J ? H.push(u) : u.column.maxWidth && u.column.maxWidth < J ? (u.width = u.column.maxWidth, b -= u.column.maxWidth, M -= f ? u.column.definition.widthShrink || 1 : u.column.definition.widthGrow || 1, M && (x = Math.floor(b / M))) : (V.push(u), g += f ? u.column.definition.widthShrink || 1 : u.column.definition.widthGrow || 1);
|
|
2926
|
+
}), H.length ? (H.forEach(function(u) {
|
|
2927
|
+
D += f ? u.width - u.column.minWidth : u.column.minWidth, u.width = u.column.minWidth;
|
|
2928
|
+
}), P = b - D, C = g ? Math.floor(P / g) : P, _ = w(V, P, C, f)) : (_ = g ? b - Math.floor(b / g) * g : b, V.forEach(function(u) {
|
|
2929
|
+
u.width = f ? X(u) : q(u);
|
|
2930
|
+
})), _;
|
|
2931
|
+
}
|
|
2932
|
+
this.table.options.responsiveLayout && this.table.modExists("responsiveLayout", !0) && this.table.modules.responsiveLayout.update(), this.table.rowManager.element.scrollHeight > this.table.rowManager.element.clientHeight && (e -= this.table.rowManager.element.offsetWidth - this.table.rowManager.element.clientWidth), d.forEach(function(p) {
|
|
2933
|
+
var b, x, f;
|
|
2934
|
+
p.visible && (b = p.definition.width, x = parseInt(p.minWidth), b ? (f = L(b), i += f > x ? f : x, p.definition.widthShrink && (l.push({
|
|
2935
|
+
column: p,
|
|
2936
|
+
width: f > x ? f : x
|
|
2937
|
+
}), n += p.definition.widthShrink)) : (s.push({
|
|
2938
|
+
column: p,
|
|
2939
|
+
width: 0
|
|
2940
|
+
}), o += p.definition.widthGrow || 1));
|
|
2941
|
+
}), r = e - i, a = Math.floor(r / o), c = w(s, r, a, !1), s.length && c > 0 && (s[s.length - 1].width += c), s.forEach(function(p) {
|
|
2942
|
+
r -= p.width;
|
|
2943
|
+
}), h = Math.abs(c) + r, h > 0 && n && (c = w(l, h, Math.floor(h / n), !0)), c && l.length && (l[l.length - 1].width -= c), s.forEach(function(p) {
|
|
2944
|
+
p.column.setWidth(p.width);
|
|
2945
|
+
}), l.forEach(function(p) {
|
|
2946
|
+
p.column.setWidth(p.width);
|
|
2947
|
+
});
|
|
2948
|
+
}
|
|
2949
|
+
var Pt = {
|
|
2950
|
+
fitData: Mt,
|
|
2951
|
+
fitDataFill: K,
|
|
2952
|
+
fitDataTable: K,
|
|
2953
|
+
fitDataStretch: Ht,
|
|
2954
|
+
fitColumns: zt
|
|
2955
|
+
};
|
|
2956
|
+
const W = class W extends U {
|
|
2957
|
+
constructor(t) {
|
|
2958
|
+
super(t, "layout"), this.mode = null, this.registerTableOption("layout", "fitData"), this.registerTableOption("layoutColumnsOnNewData", !1), this.registerColumnOption("widthGrow"), this.registerColumnOption("widthShrink");
|
|
2959
|
+
}
|
|
2960
|
+
//initialize layout system
|
|
2961
|
+
initialize() {
|
|
2962
|
+
var t = this.table.options.layout;
|
|
2963
|
+
W.modes[t] ? this.mode = t : (console.warn("Layout Error - invalid mode set, defaulting to 'fitData' : " + t), this.mode = "fitData"), this.table.element.setAttribute("tabulator-layout", this.mode), this.subscribe("column-init", this.initializeColumn.bind(this));
|
|
2964
|
+
}
|
|
2965
|
+
initializeColumn(t) {
|
|
2966
|
+
t.definition.widthGrow && (t.definition.widthGrow = Number(t.definition.widthGrow)), t.definition.widthShrink && (t.definition.widthShrink = Number(t.definition.widthShrink));
|
|
2967
|
+
}
|
|
2968
|
+
getMode() {
|
|
2969
|
+
return this.mode;
|
|
2970
|
+
}
|
|
2971
|
+
//trigger table layout
|
|
2972
|
+
layout(t) {
|
|
2973
|
+
var e = this.table.columnManager.columnsByIndex.find((i) => i.definition.variableHeight || i.definition.formatter === "textarea");
|
|
2974
|
+
this.dispatch("layout-refreshing"), W.modes[this.mode].call(this, this.table.columnManager.columnsByIndex, t), e && this.table.rowManager.normalizeHeight(!0), this.dispatch("layout-refreshed");
|
|
2975
|
+
}
|
|
2976
|
+
};
|
|
2977
|
+
E(W, "moduleName", "layout"), //load defaults
|
|
2978
|
+
E(W, "modes", Pt);
|
|
2979
|
+
let O = W;
|
|
2980
|
+
var kt = {
|
|
2981
|
+
default: {
|
|
2982
|
+
//hold default locale text
|
|
2983
|
+
groups: {
|
|
2984
|
+
item: "item",
|
|
2985
|
+
items: "items"
|
|
2986
|
+
},
|
|
2987
|
+
columns: {},
|
|
2988
|
+
data: {
|
|
2989
|
+
loading: "Loading",
|
|
2990
|
+
error: "Error"
|
|
2991
|
+
},
|
|
2992
|
+
pagination: {
|
|
2993
|
+
page_size: "Page Size",
|
|
2994
|
+
page_title: "Show Page",
|
|
2995
|
+
first: "First",
|
|
2996
|
+
first_title: "First Page",
|
|
2997
|
+
last: "Last",
|
|
2998
|
+
last_title: "Last Page",
|
|
2999
|
+
prev: "Prev",
|
|
3000
|
+
prev_title: "Prev Page",
|
|
3001
|
+
next: "Next",
|
|
3002
|
+
next_title: "Next Page",
|
|
3003
|
+
all: "All",
|
|
3004
|
+
counter: {
|
|
3005
|
+
showing: "Showing",
|
|
3006
|
+
of: "of",
|
|
3007
|
+
rows: "rows",
|
|
3008
|
+
pages: "pages"
|
|
3009
|
+
}
|
|
3010
|
+
},
|
|
3011
|
+
headerFilters: {
|
|
3012
|
+
default: "filter column...",
|
|
3013
|
+
columns: {}
|
|
3014
|
+
}
|
|
3015
|
+
}
|
|
3016
|
+
};
|
|
3017
|
+
const I = class I extends U {
|
|
3018
|
+
constructor(t) {
|
|
3019
|
+
super(t), this.locale = "default", this.lang = !1, this.bindings = {}, this.langList = {}, this.registerTableOption("locale", !1), this.registerTableOption("langs", {});
|
|
3020
|
+
}
|
|
3021
|
+
initialize() {
|
|
3022
|
+
this.langList = v.deepClone(I.langs), this.table.options.columnDefaults.headerFilterPlaceholder !== !1 && this.setHeaderFilterPlaceholder(this.table.options.columnDefaults.headerFilterPlaceholder);
|
|
3023
|
+
for (let t in this.table.options.langs)
|
|
3024
|
+
this.installLang(t, this.table.options.langs[t]);
|
|
3025
|
+
this.setLocale(this.table.options.locale), this.registerTableFunction("setLocale", this.setLocale.bind(this)), this.registerTableFunction("getLocale", this.getLocale.bind(this)), this.registerTableFunction("getLang", this.getLang.bind(this));
|
|
3026
|
+
}
|
|
3027
|
+
//set header placeholder
|
|
3028
|
+
setHeaderFilterPlaceholder(t) {
|
|
3029
|
+
this.langList.default.headerFilters.default = t;
|
|
3030
|
+
}
|
|
3031
|
+
//setup a lang description object
|
|
3032
|
+
installLang(t, e) {
|
|
3033
|
+
this.langList[t] ? this._setLangProp(this.langList[t], e) : this.langList[t] = e;
|
|
3034
|
+
}
|
|
3035
|
+
_setLangProp(t, e) {
|
|
3036
|
+
for (let i in e)
|
|
3037
|
+
t[i] && typeof t[i] == "object" ? this._setLangProp(t[i], e[i]) : t[i] = e[i];
|
|
3038
|
+
}
|
|
3039
|
+
//set current locale
|
|
3040
|
+
setLocale(t) {
|
|
3041
|
+
t = t || "default";
|
|
3042
|
+
function e(i, r) {
|
|
3043
|
+
for (var o in i)
|
|
3044
|
+
typeof i[o] == "object" ? (r[o] || (r[o] = {}), e(i[o], r[o])) : r[o] = i[o];
|
|
3045
|
+
}
|
|
3046
|
+
if (t === !0 && navigator.language && (t = navigator.language.toLowerCase()), t && !this.langList[t]) {
|
|
3047
|
+
let i = t.split("-")[0];
|
|
3048
|
+
this.langList[i] ? (console.warn("Localization Error - Exact matching locale not found, using closest match: ", t, i), t = i) : (console.warn("Localization Error - Matching locale not found, using default: ", t), t = "default");
|
|
3049
|
+
}
|
|
3050
|
+
this.locale = t, this.lang = v.deepClone(this.langList.default || {}), t != "default" && e(this.langList[t], this.lang), this.dispatchExternal("localized", this.locale, this.lang), this._executeBindings();
|
|
3051
|
+
}
|
|
3052
|
+
//get current locale
|
|
3053
|
+
getLocale(t) {
|
|
3054
|
+
return this.locale;
|
|
3055
|
+
}
|
|
3056
|
+
//get lang object for given local or current if none provided
|
|
3057
|
+
getLang(t) {
|
|
3058
|
+
return t ? this.langList[t] : this.lang;
|
|
3059
|
+
}
|
|
3060
|
+
//get text for current locale
|
|
3061
|
+
getText(t, e) {
|
|
3062
|
+
var i = e ? t + "|" + e : t, r = i.split("|"), o = this._getLangElement(r, this.locale);
|
|
3063
|
+
return o || "";
|
|
3064
|
+
}
|
|
3065
|
+
//traverse langs object and find localized copy
|
|
3066
|
+
_getLangElement(t, e) {
|
|
3067
|
+
var i = this.lang;
|
|
3068
|
+
return t.forEach(function(r) {
|
|
3069
|
+
var o;
|
|
3070
|
+
i && (o = i[r], typeof o < "u" ? i = o : i = !1);
|
|
3071
|
+
}), i;
|
|
3072
|
+
}
|
|
3073
|
+
//set update binding
|
|
3074
|
+
bind(t, e) {
|
|
3075
|
+
this.bindings[t] || (this.bindings[t] = []), this.bindings[t].push(e), e(this.getText(t), this.lang);
|
|
3076
|
+
}
|
|
3077
|
+
//iterate through bindings and trigger updates
|
|
3078
|
+
_executeBindings() {
|
|
3079
|
+
for (let t in this.bindings)
|
|
3080
|
+
this.bindings[t].forEach((e) => {
|
|
3081
|
+
e(this.getText(t), this.lang);
|
|
3082
|
+
});
|
|
3083
|
+
}
|
|
3084
|
+
};
|
|
3085
|
+
E(I, "moduleName", "localize"), //load defaults
|
|
3086
|
+
E(I, "langs", kt);
|
|
3087
|
+
let F = I;
|
|
3088
|
+
class et extends U {
|
|
3089
|
+
constructor(t) {
|
|
3090
|
+
super(t);
|
|
3091
|
+
}
|
|
3092
|
+
initialize() {
|
|
3093
|
+
this.registerTableFunction("tableComms", this.receive.bind(this));
|
|
3094
|
+
}
|
|
3095
|
+
getConnections(t) {
|
|
3096
|
+
var e = [], i;
|
|
3097
|
+
return i = this.table.constructor.registry.lookupTable(t), i.forEach((r) => {
|
|
3098
|
+
this.table !== r && e.push(r);
|
|
3099
|
+
}), e;
|
|
3100
|
+
}
|
|
3101
|
+
send(t, e, i, r) {
|
|
3102
|
+
var o = this.getConnections(t);
|
|
3103
|
+
o.forEach((a) => {
|
|
3104
|
+
a.tableComms(this.table.element, e, i, r);
|
|
3105
|
+
}), !o.length && t && console.warn("Table Connection Error - No tables matching selector found", t);
|
|
3106
|
+
}
|
|
3107
|
+
receive(t, e, i, r) {
|
|
3108
|
+
if (this.table.modExists(e))
|
|
3109
|
+
return this.table.modules[e].commsReceived(t, i, r);
|
|
3110
|
+
console.warn("Inter-table Comms Error - no such module:", e);
|
|
3111
|
+
}
|
|
3112
|
+
}
|
|
3113
|
+
E(et, "moduleName", "comms");
|
|
3114
|
+
var Tt = /* @__PURE__ */ Object.freeze({
|
|
3115
|
+
__proto__: null,
|
|
3116
|
+
CommsModule: et,
|
|
3117
|
+
LayoutModule: O,
|
|
3118
|
+
LocalizeModule: F
|
|
3119
|
+
});
|
|
3120
|
+
const R = class R {
|
|
3121
|
+
static findTable(t) {
|
|
3122
|
+
var e = R.registry.lookupTable(t, !0);
|
|
3123
|
+
return Array.isArray(e) && !e.length ? !1 : e;
|
|
3124
|
+
}
|
|
3125
|
+
};
|
|
3126
|
+
E(R, "registry", {
|
|
3127
|
+
tables: [],
|
|
3128
|
+
register(t) {
|
|
3129
|
+
R.registry.tables.push(t);
|
|
3130
|
+
},
|
|
3131
|
+
deregister(t) {
|
|
3132
|
+
var e = R.registry.tables.indexOf(t);
|
|
3133
|
+
e > -1 && R.registry.tables.splice(e, 1);
|
|
3134
|
+
},
|
|
3135
|
+
lookupTable(t, e) {
|
|
3136
|
+
var i = [], r, o;
|
|
3137
|
+
if (typeof t == "string") {
|
|
3138
|
+
if (r = document.querySelectorAll(t), r.length)
|
|
3139
|
+
for (var a = 0; a < r.length; a++)
|
|
3140
|
+
o = R.registry.matchElement(r[a]), o && i.push(o);
|
|
3141
|
+
} else typeof HTMLElement < "u" && t instanceof HTMLElement || t instanceof R ? (o = R.registry.matchElement(t), o && i.push(o)) : Array.isArray(t) ? t.forEach(function(s) {
|
|
3142
|
+
i = i.concat(R.registry.lookupTable(s));
|
|
3143
|
+
}) : e || console.warn("Table Connection Error - Invalid Selector", t);
|
|
3144
|
+
return i;
|
|
3145
|
+
},
|
|
3146
|
+
matchElement(t) {
|
|
3147
|
+
return R.registry.tables.find(function(e) {
|
|
3148
|
+
return t instanceof R ? e === t : e.element === t;
|
|
3149
|
+
});
|
|
3150
|
+
}
|
|
3151
|
+
});
|
|
3152
|
+
let N = R;
|
|
3153
|
+
const m = class m extends N {
|
|
3154
|
+
constructor() {
|
|
3155
|
+
super();
|
|
3156
|
+
}
|
|
3157
|
+
static initializeModuleBinder(t) {
|
|
3158
|
+
m.modulesRegistered || (m.modulesRegistered = !0, m._registerModules(Tt, !0), t && m._registerModules(t));
|
|
3159
|
+
}
|
|
3160
|
+
static _extendModule(t, e, i) {
|
|
3161
|
+
if (m.moduleBindings[t]) {
|
|
3162
|
+
var r = m.moduleBindings[t][e];
|
|
3163
|
+
if (r)
|
|
3164
|
+
if (typeof i == "object")
|
|
3165
|
+
for (let o in i)
|
|
3166
|
+
r[o] = i[o];
|
|
3167
|
+
else
|
|
3168
|
+
console.warn("Module Error - Invalid value type, it must be an object");
|
|
3169
|
+
else
|
|
3170
|
+
console.warn("Module Error - property does not exist:", e);
|
|
3171
|
+
} else
|
|
3172
|
+
console.warn("Module Error - module does not exist:", t);
|
|
3173
|
+
}
|
|
3174
|
+
static _registerModules(t, e) {
|
|
3175
|
+
var i = Object.values(t);
|
|
3176
|
+
e && i.forEach((r) => {
|
|
3177
|
+
r.prototype.moduleCore = !0;
|
|
3178
|
+
}), m._registerModule(i);
|
|
3179
|
+
}
|
|
3180
|
+
static _registerModule(t) {
|
|
3181
|
+
Array.isArray(t) || (t = [t]), t.forEach((e) => {
|
|
3182
|
+
m._registerModuleBinding(e), m._registerModuleExtensions(e);
|
|
3183
|
+
});
|
|
3184
|
+
}
|
|
3185
|
+
static _registerModuleBinding(t) {
|
|
3186
|
+
t.moduleName ? m.moduleBindings[t.moduleName] = t : console.error("Unable to bind module, no moduleName defined", t.moduleName);
|
|
3187
|
+
}
|
|
3188
|
+
static _registerModuleExtensions(t) {
|
|
3189
|
+
var e = t.moduleExtensions;
|
|
3190
|
+
if (t.moduleExtensions)
|
|
3191
|
+
for (let i in e) {
|
|
3192
|
+
let r = e[i];
|
|
3193
|
+
if (m.moduleBindings[i])
|
|
3194
|
+
for (let o in r)
|
|
3195
|
+
m._extendModule(i, o, r[o]);
|
|
3196
|
+
else {
|
|
3197
|
+
m.moduleExtensions[i] || (m.moduleExtensions[i] = {});
|
|
3198
|
+
for (let o in r)
|
|
3199
|
+
m.moduleExtensions[i][o] || (m.moduleExtensions[i][o] = {}), Object.assign(m.moduleExtensions[i][o], r[o]);
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3202
|
+
m._extendModuleFromQueue(t);
|
|
3203
|
+
}
|
|
3204
|
+
static _extendModuleFromQueue(t) {
|
|
3205
|
+
var e = m.moduleExtensions[t.moduleName];
|
|
3206
|
+
if (e)
|
|
3207
|
+
for (let i in e)
|
|
3208
|
+
m._extendModule(t.moduleName, i, e[i]);
|
|
3209
|
+
}
|
|
3210
|
+
//ensure that module are bound to instantiated function
|
|
3211
|
+
_bindModules() {
|
|
3212
|
+
var t = [], e = [], i = [];
|
|
3213
|
+
this.modules = {};
|
|
3214
|
+
for (var r in m.moduleBindings) {
|
|
3215
|
+
let o = m.moduleBindings[r], a = new o(this);
|
|
3216
|
+
this.modules[r] = a, o.prototype.moduleCore ? this.modulesCore.push(a) : o.moduleInitOrder ? o.moduleInitOrder < 0 ? t.push(a) : e.push(a) : i.push(a);
|
|
3217
|
+
}
|
|
3218
|
+
t.sort((o, a) => o.moduleInitOrder > a.moduleInitOrder ? 1 : -1), e.sort((o, a) => o.moduleInitOrder > a.moduleInitOrder ? 1 : -1), this.modulesRegular = t.concat(i.concat(e));
|
|
3219
|
+
}
|
|
3220
|
+
};
|
|
3221
|
+
E(m, "moduleBindings", {}), E(m, "moduleExtensions", {}), E(m, "modulesRegistered", !1), E(m, "defaultModules", !1);
|
|
3222
|
+
let j = m;
|
|
3223
|
+
class Lt extends y {
|
|
3224
|
+
constructor(t) {
|
|
3225
|
+
super(t), this.element = this._createAlertElement(), this.msgElement = this._createMsgElement(), this.type = null, this.element.appendChild(this.msgElement);
|
|
3226
|
+
}
|
|
3227
|
+
_createAlertElement() {
|
|
3228
|
+
var t = document.createElement("div");
|
|
3229
|
+
return t.classList.add("tabulator-alert"), t;
|
|
3230
|
+
}
|
|
3231
|
+
_createMsgElement() {
|
|
3232
|
+
var t = document.createElement("div");
|
|
3233
|
+
return t.classList.add("tabulator-alert-msg"), t.setAttribute("role", "alert"), t;
|
|
3234
|
+
}
|
|
3235
|
+
_typeClass() {
|
|
3236
|
+
return "tabulator-alert-state-" + this.type;
|
|
3237
|
+
}
|
|
3238
|
+
alert(t, e = "msg") {
|
|
3239
|
+
if (t) {
|
|
3240
|
+
for (this.clear(), this.dispatch("alert-show", e), this.type = e; this.msgElement.firstChild; ) this.msgElement.removeChild(this.msgElement.firstChild);
|
|
3241
|
+
this.msgElement.classList.add(this._typeClass()), typeof t == "function" && (t = t()), t instanceof HTMLElement ? this.msgElement.appendChild(t) : this.msgElement.innerHTML = t, this.table.element.appendChild(this.element);
|
|
3242
|
+
}
|
|
3243
|
+
}
|
|
3244
|
+
clear() {
|
|
3245
|
+
this.dispatch("alert-hide", this.type), this.element.parentNode && this.element.parentNode.removeChild(this.element), this.msgElement.classList.remove(this._typeClass());
|
|
3246
|
+
}
|
|
3247
|
+
}
|
|
3248
|
+
const z = class z extends j {
|
|
3249
|
+
static extendModule() {
|
|
3250
|
+
z.initializeModuleBinder(), z._extendModule(...arguments);
|
|
3251
|
+
}
|
|
3252
|
+
static registerModule() {
|
|
3253
|
+
z.initializeModuleBinder(), z._registerModule(...arguments);
|
|
3254
|
+
}
|
|
3255
|
+
constructor(t, e, i) {
|
|
3256
|
+
super(), z.initializeModuleBinder(i), this.options = {}, this.columnManager = null, this.rowManager = null, this.footerManager = null, this.alertManager = null, this.vdomHoz = null, this.externalEvents = null, this.eventBus = null, this.interactionMonitor = !1, this.browser = "", this.browserSlow = !1, this.browserMobile = !1, this.rtl = !1, this.originalElement = null, this.componentFunctionBinder = new yt(this), this.dataLoader = !1, this.modules = {}, this.modulesCore = [], this.modulesRegular = [], this.deprecationAdvisor = new Rt(this), this.optionsList = new tt(this, "table constructor"), this.dependencyRegistry = new Dt(this), this.initialized = !1, this.destroyed = !1, this.initializeElement(t) && (this.initializeCoreSystems(e), setTimeout(() => {
|
|
3257
|
+
this._create();
|
|
3258
|
+
})), this.constructor.registry.register(this);
|
|
3259
|
+
}
|
|
3260
|
+
initializeElement(t) {
|
|
3261
|
+
return typeof HTMLElement < "u" && t instanceof HTMLElement ? (this.element = t, !0) : typeof t == "string" ? (this.element = document.querySelector(t), this.element ? !0 : (console.error("Tabulator Creation Error - no element found matching selector: ", t), !1)) : (console.error("Tabulator Creation Error - Invalid element provided:", t), !1);
|
|
3262
|
+
}
|
|
3263
|
+
initializeCoreSystems(t) {
|
|
3264
|
+
this.columnManager = new mt(this), this.rowManager = new gt(this), this.footerManager = new vt(this), this.dataLoader = new xt(this), this.alertManager = new Lt(this), this._bindModules(), this.options = this.optionsList.generate(z.defaultOptions, t), this._clearObjectPointers(), this._mapDeprecatedFunctionality(), this.externalEvents = new Ct(this, this.options, this.options.debugEventsExternal), this.eventBus = new Et(this.options.debugEventsInternal), this.interactionMonitor = new wt(this), this.dataLoader.initialize(), this.footerManager.initialize(), this.dependencyRegistry.initialize();
|
|
3265
|
+
}
|
|
3266
|
+
//convert deprecated functionality to new functions
|
|
3267
|
+
_mapDeprecatedFunctionality() {
|
|
3268
|
+
}
|
|
3269
|
+
_clearSelection() {
|
|
3270
|
+
this.element.classList.add("tabulator-block-select"), window.getSelection ? window.getSelection().empty ? window.getSelection().empty() : window.getSelection().removeAllRanges && window.getSelection().removeAllRanges() : document.selection && document.selection.empty(), this.element.classList.remove("tabulator-block-select");
|
|
3271
|
+
}
|
|
3272
|
+
//create table
|
|
3273
|
+
_create() {
|
|
3274
|
+
this.externalEvents.dispatch("tableBuilding"), this.eventBus.dispatch("table-building"), this._rtlCheck(), this._buildElement(), this._initializeTable(), this.initialized = !0, this._loadInitialData().finally(() => {
|
|
3275
|
+
this.eventBus.dispatch("table-initialized"), this.externalEvents.dispatch("tableBuilt");
|
|
3276
|
+
});
|
|
3277
|
+
}
|
|
3278
|
+
_rtlCheck() {
|
|
3279
|
+
var t = window.getComputedStyle(this.element);
|
|
3280
|
+
switch (this.options.textDirection) {
|
|
3281
|
+
case "auto":
|
|
3282
|
+
if (t.direction !== "rtl")
|
|
3283
|
+
break;
|
|
3284
|
+
case "rtl":
|
|
3285
|
+
this.element.classList.add("tabulator-rtl"), this.rtl = !0;
|
|
3286
|
+
break;
|
|
3287
|
+
case "ltr":
|
|
3288
|
+
this.element.classList.add("tabulator-ltr");
|
|
3289
|
+
default:
|
|
3290
|
+
this.rtl = !1;
|
|
3291
|
+
}
|
|
3292
|
+
}
|
|
3293
|
+
//clear pointers to objects in default config object
|
|
3294
|
+
_clearObjectPointers() {
|
|
3295
|
+
this.options.columns = this.options.columns.slice(0), Array.isArray(this.options.data) && !this.options.reactiveData && (this.options.data = this.options.data.slice(0));
|
|
3296
|
+
}
|
|
3297
|
+
//build tabulator element
|
|
3298
|
+
_buildElement() {
|
|
3299
|
+
var t = this.element, e = this.options, i;
|
|
3300
|
+
if (t.tagName === "TABLE") {
|
|
3301
|
+
this.originalElement = this.element, i = document.createElement("div");
|
|
3302
|
+
var r = t.attributes;
|
|
3303
|
+
for (var o in r)
|
|
3304
|
+
typeof r[o] == "object" && i.setAttribute(r[o].name, r[o].value);
|
|
3305
|
+
t.parentNode.replaceChild(i, t), this.element = t = i;
|
|
3306
|
+
}
|
|
3307
|
+
for (t.classList.add("tabulator"), t.setAttribute("role", "grid"); t.firstChild; ) t.removeChild(t.firstChild);
|
|
3308
|
+
e.height && (e.height = isNaN(e.height) ? e.height : e.height + "px", t.style.height = e.height), e.minHeight !== !1 && (e.minHeight = isNaN(e.minHeight) ? e.minHeight : e.minHeight + "px", t.style.minHeight = e.minHeight), e.maxHeight !== !1 && (e.maxHeight = isNaN(e.maxHeight) ? e.maxHeight : e.maxHeight + "px", t.style.maxHeight = e.maxHeight);
|
|
3309
|
+
}
|
|
3310
|
+
//initialize core systems and modules
|
|
3311
|
+
_initializeTable() {
|
|
3312
|
+
var t = this.element, e = this.options;
|
|
3313
|
+
this.interactionMonitor.initialize(), this.columnManager.initialize(), this.rowManager.initialize(), this._detectBrowser(), this.modulesCore.forEach((i) => {
|
|
3314
|
+
i.initialize();
|
|
3315
|
+
}), t.appendChild(this.columnManager.getElement()), t.appendChild(this.rowManager.getElement()), e.footerElement && this.footerManager.activate(), e.autoColumns && e.data && this.columnManager.generateColumnsFromRowData(this.options.data), this.modulesRegular.forEach((i) => {
|
|
3316
|
+
i.initialize();
|
|
3317
|
+
}), this.columnManager.setColumns(e.columns), this.eventBus.dispatch("table-built");
|
|
3318
|
+
}
|
|
3319
|
+
_loadInitialData() {
|
|
3320
|
+
return this.dataLoader.load(this.options.data).finally(() => {
|
|
3321
|
+
this.columnManager.verticalAlignHeaders();
|
|
3322
|
+
});
|
|
3323
|
+
}
|
|
3324
|
+
//deconstructor
|
|
3325
|
+
destroy() {
|
|
3326
|
+
var t = this.element;
|
|
3327
|
+
for (this.destroyed = !0, this.constructor.registry.deregister(this), this.eventBus.dispatch("table-destroy"), this.rowManager.destroy(); t.firstChild; ) t.removeChild(t.firstChild);
|
|
3328
|
+
t.classList.remove("tabulator"), this.externalEvents.dispatch("tableDestroyed");
|
|
3329
|
+
}
|
|
3330
|
+
_detectBrowser() {
|
|
3331
|
+
var t = navigator.userAgent || navigator.vendor || window.opera;
|
|
3332
|
+
t.indexOf("Trident") > -1 ? (this.browser = "ie", this.browserSlow = !0) : t.indexOf("Edge") > -1 ? (this.browser = "edge", this.browserSlow = !0) : t.indexOf("Firefox") > -1 ? (this.browser = "firefox", this.browserSlow = !1) : t.indexOf("Mac OS") > -1 ? (this.browser = "safari", this.browserSlow = !1) : (this.browser = "other", this.browserSlow = !1), this.browserMobile = /(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t) || /1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw-(n|u)|c55\/|capi|ccwa|cdm-|cell|chtm|cldc|cmd-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc-s|devi|dica|dmob|do(c|p)o|ds(12|-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(-|_)|g1 u|g560|gene|gf-5|g-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd-(m|p|t)|hei-|hi(pt|ta)|hp( i|ip)|hs-c|ht(c(-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i-(20|go|ma)|i230|iac( |-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|-[a-w])|libw|lynx|m1-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|-([1-8]|c))|phil|pire|pl(ay|uc)|pn-2|po(ck|rt|se)|prox|psio|pt-g|qa-a|qc(07|12|21|32|60|-[2-7]|i-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h-|oo|p-)|sdk\/|se(c(-|0|1)|47|mc|nd|ri)|sgh-|shar|sie(-|m)|sk-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h-|v-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl-|tdg-|tel(i|m)|tim-|t-mo|to(pl|sh)|ts(70|m-|m3|m5)|tx-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas-|your|zeto|zte-/i.test(t.slice(0, 4));
|
|
3333
|
+
}
|
|
3334
|
+
initGuard(t, e) {
|
|
3335
|
+
var i, r;
|
|
3336
|
+
return this.options.debugInitialization && !this.initialized && (t || (i = new Error().stack.split(`
|
|
3337
|
+
`), r = i[0] == "Error" ? i[2] : i[1], r[0] == " " ? t = r.trim().split(" ")[1].split(".")[1] : t = r.trim().split("@")[0]), console.warn("Table Not Initialized - Calling the " + t + " function before the table is initialized may result in inconsistent behavior, Please wait for the `tableBuilt` event before calling this function." + (e ? " " + e : ""))), this.initialized;
|
|
3338
|
+
}
|
|
3339
|
+
////////////////// Data Handling //////////////////
|
|
3340
|
+
//block table redrawing
|
|
3341
|
+
blockRedraw() {
|
|
3342
|
+
this.initGuard(), this.eventBus.dispatch("redraw-blocking"), this.rowManager.blockRedraw(), this.columnManager.blockRedraw(), this.eventBus.dispatch("redraw-blocked");
|
|
3343
|
+
}
|
|
3344
|
+
//restore table redrawing
|
|
3345
|
+
restoreRedraw() {
|
|
3346
|
+
this.initGuard(), this.eventBus.dispatch("redraw-restoring"), this.rowManager.restoreRedraw(), this.columnManager.restoreRedraw(), this.eventBus.dispatch("redraw-restored");
|
|
3347
|
+
}
|
|
3348
|
+
//load data
|
|
3349
|
+
setData(t, e, i) {
|
|
3350
|
+
return this.initGuard(!1, "To set initial data please use the 'data' property in the table constructor."), this.dataLoader.load(t, e, i, !1);
|
|
3351
|
+
}
|
|
3352
|
+
//clear data
|
|
3353
|
+
clearData() {
|
|
3354
|
+
this.initGuard(), this.dataLoader.blockActiveLoad(), this.rowManager.clearData();
|
|
3355
|
+
}
|
|
3356
|
+
//get table data array
|
|
3357
|
+
getData(t) {
|
|
3358
|
+
return this.rowManager.getData(t);
|
|
3359
|
+
}
|
|
3360
|
+
//get table data array count
|
|
3361
|
+
getDataCount(t) {
|
|
3362
|
+
return this.rowManager.getDataCount(t);
|
|
3363
|
+
}
|
|
3364
|
+
//replace data, keeping table in position with same sort
|
|
3365
|
+
replaceData(t, e, i) {
|
|
3366
|
+
return this.initGuard(), this.dataLoader.load(t, e, i, !0, !0);
|
|
3367
|
+
}
|
|
3368
|
+
//update table data
|
|
3369
|
+
updateData(t) {
|
|
3370
|
+
var e = 0;
|
|
3371
|
+
return this.initGuard(), new Promise((i, r) => {
|
|
3372
|
+
this.dataLoader.blockActiveLoad(), typeof t == "string" && (t = JSON.parse(t)), t && t.length > 0 ? t.forEach((o) => {
|
|
3373
|
+
var a = this.rowManager.findRow(o[this.options.index]);
|
|
3374
|
+
a ? (e++, a.updateData(o).then(() => {
|
|
3375
|
+
e--, e || i();
|
|
3376
|
+
}).catch((s) => {
|
|
3377
|
+
r("Update Error - Unable to update row", o, s);
|
|
3378
|
+
})) : r("Update Error - Unable to find row", o);
|
|
3379
|
+
}) : (console.warn("Update Error - No data provided"), r("Update Error - No data provided"));
|
|
3380
|
+
});
|
|
3381
|
+
}
|
|
3382
|
+
addData(t, e, i) {
|
|
3383
|
+
return this.initGuard(), new Promise((r, o) => {
|
|
3384
|
+
this.dataLoader.blockActiveLoad(), typeof t == "string" && (t = JSON.parse(t)), t ? this.rowManager.addRows(t, e, i).then((a) => {
|
|
3385
|
+
var s = [];
|
|
3386
|
+
a.forEach(function(l) {
|
|
3387
|
+
s.push(l.getComponent());
|
|
3388
|
+
}), r(s);
|
|
3389
|
+
}) : (console.warn("Update Error - No data provided"), o("Update Error - No data provided"));
|
|
3390
|
+
});
|
|
3391
|
+
}
|
|
3392
|
+
//update table data
|
|
3393
|
+
updateOrAddData(t) {
|
|
3394
|
+
var e = [], i = 0;
|
|
3395
|
+
return this.initGuard(), new Promise((r, o) => {
|
|
3396
|
+
this.dataLoader.blockActiveLoad(), typeof t == "string" && (t = JSON.parse(t)), t && t.length > 0 ? t.forEach((a) => {
|
|
3397
|
+
var s = this.rowManager.findRow(a[this.options.index]);
|
|
3398
|
+
i++, s ? s.updateData(a).then(() => {
|
|
3399
|
+
i--, e.push(s.getComponent()), i || r(e);
|
|
3400
|
+
}) : this.rowManager.addRows(a).then((l) => {
|
|
3401
|
+
i--, e.push(l[0].getComponent()), i || r(e);
|
|
3402
|
+
});
|
|
3403
|
+
}) : (console.warn("Update Error - No data provided"), o("Update Error - No data provided"));
|
|
3404
|
+
});
|
|
3405
|
+
}
|
|
3406
|
+
//get row object
|
|
3407
|
+
getRow(t) {
|
|
3408
|
+
var e = this.rowManager.findRow(t);
|
|
3409
|
+
return e ? e.getComponent() : (console.warn("Find Error - No matching row found:", t), !1);
|
|
3410
|
+
}
|
|
3411
|
+
//get row object
|
|
3412
|
+
getRowFromPosition(t) {
|
|
3413
|
+
var e = this.rowManager.getRowFromPosition(t);
|
|
3414
|
+
return e ? e.getComponent() : (console.warn("Find Error - No matching row found:", t), !1);
|
|
3415
|
+
}
|
|
3416
|
+
//delete row from table
|
|
3417
|
+
deleteRow(t) {
|
|
3418
|
+
var e = [];
|
|
3419
|
+
this.initGuard(), Array.isArray(t) || (t = [t]);
|
|
3420
|
+
for (let i of t) {
|
|
3421
|
+
let r = this.rowManager.findRow(i, !0);
|
|
3422
|
+
if (r)
|
|
3423
|
+
e.push(r);
|
|
3424
|
+
else
|
|
3425
|
+
return console.error("Delete Error - No matching row found:", i), Promise.reject("Delete Error - No matching row found");
|
|
3426
|
+
}
|
|
3427
|
+
return e.sort((i, r) => this.rowManager.rows.indexOf(i) > this.rowManager.rows.indexOf(r) ? 1 : -1), e.forEach((i) => {
|
|
3428
|
+
i.delete();
|
|
3429
|
+
}), this.rowManager.reRenderInPosition(), Promise.resolve();
|
|
3430
|
+
}
|
|
3431
|
+
//add row to table
|
|
3432
|
+
addRow(t, e, i) {
|
|
3433
|
+
return this.initGuard(), typeof t == "string" && (t = JSON.parse(t)), this.rowManager.addRows(t, e, i, !0).then((r) => r[0].getComponent());
|
|
3434
|
+
}
|
|
3435
|
+
//update a row if it exists otherwise create it
|
|
3436
|
+
updateOrAddRow(t, e) {
|
|
3437
|
+
var i = this.rowManager.findRow(t);
|
|
3438
|
+
return this.initGuard(), typeof e == "string" && (e = JSON.parse(e)), i ? i.updateData(e).then(() => i.getComponent()) : this.rowManager.addRows(e).then((r) => r[0].getComponent());
|
|
3439
|
+
}
|
|
3440
|
+
//update row data
|
|
3441
|
+
updateRow(t, e) {
|
|
3442
|
+
var i = this.rowManager.findRow(t);
|
|
3443
|
+
return this.initGuard(), typeof e == "string" && (e = JSON.parse(e)), i ? i.updateData(e).then(() => Promise.resolve(i.getComponent())) : (console.warn("Update Error - No matching row found:", t), Promise.reject("Update Error - No matching row found"));
|
|
3444
|
+
}
|
|
3445
|
+
//scroll to row in DOM
|
|
3446
|
+
scrollToRow(t, e, i) {
|
|
3447
|
+
var r = this.rowManager.findRow(t);
|
|
3448
|
+
return r ? this.rowManager.scrollToRow(r, e, i) : (console.warn("Scroll Error - No matching row found:", t), Promise.reject("Scroll Error - No matching row found"));
|
|
3449
|
+
}
|
|
3450
|
+
moveRow(t, e, i) {
|
|
3451
|
+
var r = this.rowManager.findRow(t);
|
|
3452
|
+
this.initGuard(), r ? r.moveToRow(e, i) : console.warn("Move Error - No matching row found:", t);
|
|
3453
|
+
}
|
|
3454
|
+
getRows(t) {
|
|
3455
|
+
return this.rowManager.getComponents(t);
|
|
3456
|
+
}
|
|
3457
|
+
//get position of row in table
|
|
3458
|
+
getRowPosition(t) {
|
|
3459
|
+
var e = this.rowManager.findRow(t);
|
|
3460
|
+
return e ? e.getPosition() : (console.warn("Position Error - No matching row found:", t), !1);
|
|
3461
|
+
}
|
|
3462
|
+
/////////////// Column Functions ///////////////
|
|
3463
|
+
setColumns(t) {
|
|
3464
|
+
this.initGuard(!1, "To set initial columns please use the 'columns' property in the table constructor"), this.columnManager.setColumns(t);
|
|
3465
|
+
}
|
|
3466
|
+
getColumns(t) {
|
|
3467
|
+
return this.columnManager.getComponents(t);
|
|
3468
|
+
}
|
|
3469
|
+
getColumn(t) {
|
|
3470
|
+
var e = this.columnManager.findColumn(t);
|
|
3471
|
+
return e ? e.getComponent() : (console.warn("Find Error - No matching column found:", t), !1);
|
|
3472
|
+
}
|
|
3473
|
+
getColumnDefinitions() {
|
|
3474
|
+
return this.columnManager.getDefinitionTree();
|
|
3475
|
+
}
|
|
3476
|
+
showColumn(t) {
|
|
3477
|
+
var e = this.columnManager.findColumn(t);
|
|
3478
|
+
if (this.initGuard(), e)
|
|
3479
|
+
e.show();
|
|
3480
|
+
else
|
|
3481
|
+
return console.warn("Column Show Error - No matching column found:", t), !1;
|
|
3482
|
+
}
|
|
3483
|
+
hideColumn(t) {
|
|
3484
|
+
var e = this.columnManager.findColumn(t);
|
|
3485
|
+
if (this.initGuard(), e)
|
|
3486
|
+
e.hide();
|
|
3487
|
+
else
|
|
3488
|
+
return console.warn("Column Hide Error - No matching column found:", t), !1;
|
|
3489
|
+
}
|
|
3490
|
+
toggleColumn(t) {
|
|
3491
|
+
var e = this.columnManager.findColumn(t);
|
|
3492
|
+
if (this.initGuard(), e)
|
|
3493
|
+
e.visible ? e.hide() : e.show();
|
|
3494
|
+
else
|
|
3495
|
+
return console.warn("Column Visibility Toggle Error - No matching column found:", t), !1;
|
|
3496
|
+
}
|
|
3497
|
+
addColumn(t, e, i) {
|
|
3498
|
+
var r = this.columnManager.findColumn(i);
|
|
3499
|
+
return this.initGuard(), this.columnManager.addColumn(t, e, r).then((o) => o.getComponent());
|
|
3500
|
+
}
|
|
3501
|
+
deleteColumn(t) {
|
|
3502
|
+
var e = this.columnManager.findColumn(t);
|
|
3503
|
+
return this.initGuard(), e ? e.delete() : (console.warn("Column Delete Error - No matching column found:", t), Promise.reject());
|
|
3504
|
+
}
|
|
3505
|
+
updateColumnDefinition(t, e) {
|
|
3506
|
+
var i = this.columnManager.findColumn(t);
|
|
3507
|
+
return this.initGuard(), i ? i.updateDefinition(e) : (console.warn("Column Update Error - No matching column found:", t), Promise.reject());
|
|
3508
|
+
}
|
|
3509
|
+
moveColumn(t, e, i) {
|
|
3510
|
+
var r = this.columnManager.findColumn(t), o = this.columnManager.findColumn(e);
|
|
3511
|
+
this.initGuard(), r ? o ? this.columnManager.moveColumn(r, o, i) : console.warn("Move Error - No matching column found:", o) : console.warn("Move Error - No matching column found:", t);
|
|
3512
|
+
}
|
|
3513
|
+
//scroll to column in DOM
|
|
3514
|
+
scrollToColumn(t, e, i) {
|
|
3515
|
+
return new Promise((r, o) => {
|
|
3516
|
+
var a = this.columnManager.findColumn(t);
|
|
3517
|
+
return a ? this.columnManager.scrollToColumn(a, e, i) : (console.warn("Scroll Error - No matching column found:", t), Promise.reject("Scroll Error - No matching column found"));
|
|
3518
|
+
});
|
|
3519
|
+
}
|
|
3520
|
+
//////////// General Public Functions ////////////
|
|
3521
|
+
//redraw list without updating data
|
|
3522
|
+
redraw(t) {
|
|
3523
|
+
this.initGuard(), this.columnManager.redraw(t), this.rowManager.redraw(t);
|
|
3524
|
+
}
|
|
3525
|
+
setHeight(t) {
|
|
3526
|
+
this.options.height = isNaN(t) ? t : t + "px", this.element.style.height = this.options.height, this.rowManager.initializeRenderer(), this.rowManager.redraw(!0);
|
|
3527
|
+
}
|
|
3528
|
+
//////////////////// Event Bus ///////////////////
|
|
3529
|
+
on(t, e) {
|
|
3530
|
+
this.externalEvents.subscribe(t, e);
|
|
3531
|
+
}
|
|
3532
|
+
off(t, e) {
|
|
3533
|
+
this.externalEvents.unsubscribe(t, e);
|
|
3534
|
+
}
|
|
3535
|
+
dispatchEvent() {
|
|
3536
|
+
var t = Array.from(arguments);
|
|
3537
|
+
t.shift(), this.externalEvents.dispatch(...arguments);
|
|
3538
|
+
}
|
|
3539
|
+
//////////////////// Alerts ///////////////////
|
|
3540
|
+
alert(t, e) {
|
|
3541
|
+
this.initGuard(), this.alertManager.alert(t, e);
|
|
3542
|
+
}
|
|
3543
|
+
clearAlert() {
|
|
3544
|
+
this.initGuard(), this.alertManager.clear();
|
|
3545
|
+
}
|
|
3546
|
+
////////////// Extension Management //////////////
|
|
3547
|
+
modExists(t, e) {
|
|
3548
|
+
return this.modules[t] ? !0 : (e && console.error("Tabulator Module Not Installed: " + t), !1);
|
|
3549
|
+
}
|
|
3550
|
+
module(t) {
|
|
3551
|
+
var e = this.modules[t];
|
|
3552
|
+
return e || console.error("Tabulator module not installed: " + t), e;
|
|
3553
|
+
}
|
|
3554
|
+
};
|
|
3555
|
+
//default setup options
|
|
3556
|
+
E(z, "defaultOptions", ut);
|
|
3557
|
+
let G = z;
|
|
3558
|
+
var _t = G;
|
|
3559
|
+
const Wt = '.shadow{box-shadow:var(--prism-shadow-xs-base)}.tabulator{background-color:var(--prism-color-material-primary-base);border:1px solid color-mix(in srgb,var(--prism-color-border-primary-base) var(--prism-alpha-tertiary-percentage),transparent);font-size:14px;overflow:hidden;position:relative;text-align:left;transform:translateZ(0)}.tabulator[tabulator-layout=fitDataFill] .tabulator-tableholder .tabulator-table{min-width:100%}.tabulator[tabulator-layout=fitDataTable]{display:inline-block}.tabulator.tabulator-block-select,.tabulator.tabulator-ranges .tabulator-cell:not(.tabulator-editing){-webkit-user-select:none;-moz-user-select:none;user-select:none}.tabulator .tabulator-header{background-color:var(--prism-color-material-secondary-base);border-bottom:1px solid color-mix(in srgb,var(--prism-color-border-primary-base) var(--prism-alpha-tertiary-percentage),transparent);box-sizing:border-box;color:var(--prism-color-text-primary-base);font-weight:700;outline:none;overflow:hidden;position:relative;white-space:nowrap;width:100%}.tabulator .tabulator-header.tabulator-header-hidden{display:none}.tabulator .tabulator-header .tabulator-header-contents{overflow:hidden;position:relative}.tabulator .tabulator-header .tabulator-header-contents .tabulator-headers{display:inline-block}.tabulator .tabulator-header .tabulator-col{background:var(--prism-color-material-secondary-base);border-right:1px solid color-mix(in srgb,var(--prism-color-border-primary-base) var(--prism-alpha-tertiary-percentage),transparent);box-sizing:border-box;display:inline-flex;flex-direction:column;justify-content:flex-start;overflow:hidden;position:relative;text-align:left;vertical-align:bottom}.tabulator .tabulator-header .tabulator-col.tabulator-moving{background:var(--prism-color-material-brand-primary-base);border:1px solid var(--prism-color-border-primary-base);pointer-events:none;position:absolute}.tabulator .tabulator-header .tabulator-col.tabulator-range-highlight{background-color:var(--prism-color-material-brand-primary-base);color:var(--prism-color-text-primary-base)}.tabulator .tabulator-header .tabulator-col.tabulator-range-selected{background-color:var(--prism-color-material-info-base);color:var(--prism-color-text-primary-inverse-base)}.tabulator .tabulator-header .tabulator-col .tabulator-col-content{box-sizing:border-box;padding:var(--prism-data-table-header-cell-spacing,var(--prism-spacer-size-lg) var(--prism-spacer-size-md));position:relative}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-popup-button{padding:0 8px}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-header-popup-button:hover{cursor:pointer;opacity:.6}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title-holder{position:relative}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title{box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;vertical-align:bottom;white-space:nowrap;width:100%}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title.tabulator-col-title-wrap{text-overflow:clip;white-space:normal}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title .tabulator-title-editor{background:var(--prism-color-material-neutral-base);border:1px solid var(--prism-color-border-primary-base);box-sizing:border-box;padding:1px;width:100%}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title .tabulator-header-popup-button+.tabulator-title-editor{width:calc(100% - 22px)}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter{align-items:center;bottom:0;display:flex;position:absolute;right:4px;top:0}.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter .tabulator-arrow{border-bottom:6px solid color-mix(in srgb,var(--prism-color-border-primary-base) var(--prism-alpha-secondary-percentage),transparent);border-left:6px solid transparent;border-right:6px solid transparent;height:0;width:0}.tabulator .tabulator-header .tabulator-col.tabulator-col-group .tabulator-col-group-cols{border-top:1px solid color-mix(in srgb,var(--prism-color-border-primary-base) var(--prism-alpha-tertiary-percentage),transparent);display:flex;margin-right:-1px;overflow:hidden;position:relative}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter{box-sizing:border-box;margin-top:2px;position:relative;text-align:center;width:100%}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter textarea{height:auto!important}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter svg{margin-top:3px}.tabulator .tabulator-header .tabulator-col .tabulator-header-filter input::-ms-clear{height:0;width:0}.tabulator .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title{padding-right:25px}@media (hover:hover) and (pointer:fine){.tabulator .tabulator-header .tabulator-col.tabulator-sortable.tabulator-col-sorter-element:hover{background-color:var(--prism-color-material-secondary-hover);cursor:pointer}}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=none] .tabulator-col-content .tabulator-col-sorter{color:var(--prism-color-text-primary-hover)}@media (hover:hover) and (pointer:fine){.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=none] .tabulator-col-content .tabulator-col-sorter.tabulator-col-sorter-element .tabulator-arrow:hover{border-bottom:6px solid var(--prism-color-border-primary-base);cursor:pointer}}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=none] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow{border-bottom:6px solid var(--prism-color-border-primary-base);border-top:none}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=ascending] .tabulator-col-content .tabulator-col-sorter{color:var(--prism-color-text-primary-base)}@media (hover:hover) and (pointer:fine){.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=ascending] .tabulator-col-content .tabulator-col-sorter.tabulator-col-sorter-element .tabulator-arrow:hover{border-bottom:6px solid var(--prism-color-border-primary-base);cursor:pointer}}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=ascending] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow{border-bottom:6px solid var(--prism-color-border-primary-base);border-top:none}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=descending] .tabulator-col-content .tabulator-col-sorter{color:var(--prism-color-text-primary-base)}@media (hover:hover) and (pointer:fine){.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=descending] .tabulator-col-content .tabulator-col-sorter.tabulator-col-sorter-element .tabulator-arrow:hover{border-top:6px solid var(--prism-color-border-primary-base);cursor:pointer}}.tabulator .tabulator-header .tabulator-col.tabulator-sortable[aria-sort=descending] .tabulator-col-content .tabulator-col-sorter .tabulator-arrow{border-bottom:none;border-top:6px solid var(--prism-color-border-primary-base);color:var(--prism-color-text-primary-base)}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical .tabulator-col-content .tabulator-col-title{align-items:center;display:flex;justify-content:center;text-orientation:mixed;writing-mode:vertical-rl}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-col-vertical-flip .tabulator-col-title{transform:rotate(180deg)}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-col-title{padding-right:0;padding-top:20px}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable.tabulator-col-vertical-flip .tabulator-col-title{padding-bottom:20px;padding-right:0}.tabulator .tabulator-header .tabulator-col.tabulator-col-vertical.tabulator-sortable .tabulator-col-sorter{bottom:auto;justify-content:center;left:0;right:0;top:4px}.tabulator .tabulator-header .tabulator-frozen{left:0;position:-webkit-sticky;position:sticky;z-index:11}.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-left{border-right:2px solid var(--prism-color-border-primary-base)}.tabulator .tabulator-header .tabulator-frozen.tabulator-frozen-right{border-left:2px solid var(--prism-color-border-primary-base)}.tabulator .tabulator-header .tabulator-calcs-holder{border-bottom:1px solid var(--prism-color-border-primary-base);border-top:1px solid var(--prism-color-border-primary-base);box-sizing:border-box;display:inline-block}.tabulator .tabulator-header .tabulator-calcs-holder,.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row{background:color-mix(in srgb,var(--prism-color-material-primary-base) var(--prism-alpha-secondary-percentage),transparent)!important}.tabulator .tabulator-header .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle{display:none}.tabulator .tabulator-header .tabulator-frozen-rows-holder{display:inline-block}.tabulator .tabulator-header .tabulator-frozen-rows-holder:empty{display:none}.tabulator .tabulator-tableholder{-webkit-overflow-scrolling:touch;overflow:auto;position:relative;white-space:nowrap;width:100%}.tabulator .tabulator-tableholder:focus{outline:none}.tabulator .tabulator-tableholder .tabulator-placeholder{align-items:center;box-sizing:border-box;display:flex;justify-content:center;min-width:100%;width:100%}.tabulator .tabulator-tableholder .tabulator-placeholder[tabulator-render-mode=virtual]{min-height:100%}.tabulator .tabulator-tableholder .tabulator-placeholder .tabulator-placeholder-contents{color:var(--prism-color-text-primary-base);display:inline-block;font-size:20px;font-weight:700;padding:10px;text-align:center;white-space:normal}.tabulator .tabulator-tableholder .tabulator-table{background-color:var(--prism-color-material-primary-base);color:var(--prism-color-text-primary-base);display:inline-block;overflow:visible;position:relative;white-space:nowrap}.tabulator .tabulator-tableholder .tabulator-table .tabulator-row.tabulator-calcs{background:var(--prism-color-material-secondary-base)!important;font-weight:700}.tabulator .tabulator-tableholder .tabulator-table .tabulator-row.tabulator-calcs.tabulator-calcs-top{border-bottom:2px solid var(--prism-color-border-primary-base)}.tabulator .tabulator-tableholder .tabulator-table .tabulator-row.tabulator-calcs.tabulator-calcs-bottom{border-top:2px solid var(--prism-color-border-primary-base)}.tabulator .tabulator-tableholder .tabulator-range-overlay{bottom:0;left:0;pointer-events:none;position:absolute;right:0;top:0;z-index:10}.tabulator .tabulator-tableholder .tabulator-range-overlay .tabulator-range{border:1px solid var(--prism-color-border-info-base);box-sizing:border-box;position:absolute}.tabulator .tabulator-tableholder .tabulator-range-overlay .tabulator-range.tabulator-range-active:after{background-color:var(--prism-color-fill-info-base);border-radius:999px;bottom:-3px;content:"";height:6px;position:absolute;right:-3px;width:6px}.tabulator .tabulator-tableholder .tabulator-range-overlay .tabulator-range-cell-active{border:2px solid var(--prism-color-border-info-base);box-sizing:border-box;position:absolute}.tabulator .tabulator-footer{background-color:var(--prism-color-material-secondary-base);border-top:1px solid var(--prism-color-border-primary-base);color:var(--prism-color-text-primary-base);font-weight:700;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.tabulator .tabulator-footer .tabulator-footer-contents{align-items:center;display:flex;flex-direction:row;justify-content:space-between;padding:5px 10px}.tabulator .tabulator-footer .tabulator-footer-contents:empty{display:none}.tabulator .tabulator-footer .tabulator-spreadsheet-tabs{margin-top:-5px;overflow-x:auto}.tabulator .tabulator-footer .tabulator-spreadsheet-tabs .tabulator-spreadsheet-tab{border:1px solid var(--prism-color-border-primary-base);border-bottom-left-radius:5px;border-bottom-right-radius:5px;border-top:none;display:inline-block;font-size:.9em;margin-left:2px;margin-right:2px;padding:8px}.tabulator .tabulator-footer .tabulator-spreadsheet-tabs .tabulator-spreadsheet-tab:hover{cursor:pointer;opacity:.7}.tabulator .tabulator-footer .tabulator-spreadsheet-tabs .tabulator-spreadsheet-tab.tabulator-spreadsheet-tab-active{background-color:var(--prism-color-material-primary-base)}.tabulator .tabulator-footer .tabulator-calcs-holder{background:var(--prism-color-material-secondary-base)!important;border-bottom:1px solid var(--prism-color-border-primary-base);border-top:1px solid var(--prism-color-border-primary-base);box-sizing:border-box;overflow:hidden;text-align:left;width:100%}.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row{background:var(--prism-color-material-secondary-base)!important;display:inline-block}.tabulator .tabulator-footer .tabulator-calcs-holder .tabulator-row .tabulator-col-resize-handle{display:none}.tabulator .tabulator-footer .tabulator-calcs-holder:only-child{border-bottom:none;margin-bottom:-5px}.tabulator .tabulator-footer>*+.tabulator-page-counter{margin-left:10px}.tabulator .tabulator-footer .tabulator-page-counter{font-weight:400}.tabulator .tabulator-footer .tabulator-paginator{color:var(--prism-color-text-primary-base);flex:1;font-family:inherit;font-size:inherit;font-weight:inherit;text-align:right}.tabulator .tabulator-footer .tabulator-page-size{border:1px solid var(--prism-color-border-primary-base);border-radius:3px;display:inline-block;margin:0 5px;padding:2px 5px}.tabulator .tabulator-footer .tabulator-pages{margin:0 7px}.tabulator .tabulator-footer .tabulator-page{background:color-mix(in srgb,var(--prism-color-material-secondary-base) 20%,transparent);border:1px solid var(--prism-color-border-primary-base);border-radius:3px;display:inline-block;margin:0 2px;padding:2px 5px}.tabulator .tabulator-footer .tabulator-page.active{color:var(--prism-color-text-brand-primary-base)}.tabulator .tabulator-footer .tabulator-page:disabled{opacity:.5}@media (hover:hover) and (pointer:fine){.tabulator .tabulator-footer .tabulator-page:not(disabled):hover{background:color-mix(in srgb,var(--prism-color-material-primary-inverse-base) 20%,transparent);color:var(--prism-color-text-primary-inverse-base);cursor:pointer}}.tabulator .tabulator-col-resize-handle{display:inline-block;margin-left:-3px;margin-right:-3px;position:relative;vertical-align:middle;width:6px;z-index:11}@media (hover:hover) and (pointer:fine){.tabulator .tabulator-col-resize-handle:hover{cursor:ew-resize}}.tabulator .tabulator-col-resize-handle:last-of-type{margin-right:0;width:3px}.tabulator .tabulator-col-resize-guide{height:100%;margin-left:-.5px;top:0;width:4px}.tabulator .tabulator-col-resize-guide,.tabulator .tabulator-row-resize-guide{background-color:color-mix(in srgb,var(--prism-color-material-primary-base) 40%,transparent);opacity:.5;position:absolute}.tabulator .tabulator-row-resize-guide{height:4px;left:0;margin-top:-.5px;width:100%}.tabulator .tabulator-alert{align-items:center;background:color-mix(in srgb,var(--prism-color-material-primary-base) 40%,transparent);display:flex;height:100%;left:0;position:absolute;text-align:center;top:0;width:100%;z-index:100}.tabulator .tabulator-alert .tabulator-alert-msg{background-color:var(--prism-color-fill-brand-primary-base);border-radius:10px;display:inline-block;font-size:16px;font-weight:700;margin:0 auto;padding:10px 20px}.tabulator .tabulator-alert .tabulator-alert-msg.tabulator-alert-state-msg{border:4px solid var(--prism-color-border-primary-base);color:var(--prism-color-text-primary-base)}.tabulator .tabulator-alert .tabulator-alert-msg.tabulator-alert-state-error{border:4px solid var(--prism-color-border-danger-base);color:var(--prism-color-text-danger-base)}.tabulator-row{background-color:var(--prism-color-material-primary-base);box-sizing:border-box;min-height:22px;position:relative}.tabulator-row.tabulator-row-even{background-color:var(--prism-color-material-secondary-base)}@media (hover:hover) and (pointer:fine){.tabulator-row.tabulator-selectable:hover{background-color:var(--prism-color-material-primary-hover);cursor:pointer}}.tabulator-row.tabulator-selected{background-color:var(--prism-color-material-brand-primary-base)}@media (hover:hover) and (pointer:fine){.tabulator-row.tabulator-selected:hover{background-color:var(--prism-color-material-brand-primary-hover);cursor:pointer}}.tabulator-row.tabulator-row-moving{background-color:var(--prism-color-material-primary-base);border:1px solid var(--prism-color-border-primary-base)}.tabulator-row.tabulator-moving{border-bottom:1px solid var(--prism-color-border-primary-base);border-top:1px solid var(--prism-color-border-primary-base);pointer-events:none;position:absolute;z-index:15}.tabulator-row.tabulator-range-highlight .tabulator-cell.tabulator-range-row-header{background-color:var(--prism-color-material-brand-primary-base);color:var(--prism-color-text-primary-base)}.tabulator-row.tabulator-range-highlight.tabulator-range-selected .tabulator-cell.tabulator-range-row-header,.tabulator-row.tabulator-range-selected .tabulator-cell.tabulator-range-row-header{background-color:var(--prism-color-fill-info-base);color:var(--prism-color-text-primary-inverse-base)}.tabulator-row .tabulator-row-resize-handle{bottom:0;height:5px;left:0;position:absolute;right:0}.tabulator-row .tabulator-row-resize-handle.prev{bottom:auto;top:0}@media (hover:hover) and (pointer:fine){.tabulator-row .tabulator-row-resize-handle:hover{cursor:ns-resize}}.tabulator-row .tabulator-responsive-collapse{border-bottom:1px solid var(--prism-color-border-primary-base);border-top:1px solid var(--prism-color-border-primary-base);box-sizing:border-box;padding:5px}.tabulator-row .tabulator-responsive-collapse:empty{display:none}.tabulator-row .tabulator-responsive-collapse table{font-size:14px}.tabulator-row .tabulator-responsive-collapse table tr td{position:relative}.tabulator-row .tabulator-responsive-collapse table tr td:first-of-type{padding-right:10px}.tabulator-row .tabulator-cell{border-right:1px solid color-mix(in srgb,var(--prism-color-border-primary-base) var(--prism-alpha-tertiary-percentage),transparent);box-sizing:border-box;display:inline-block;outline:none;overflow:hidden;padding:var(--prism-data-table-cell-spacing,var(--prism-spacer-size-lg) var(--prism-spacer-size-md));position:relative;text-overflow:ellipsis;vertical-align:middle;white-space:nowrap}.tabulator-row .tabulator-cell.tabulator-row-header{background:var(--prism-color-material-secondary-base);border-bottom:1px solid var(--prism-color-border-primary-base);border-right:1px solid var(--prism-color-border-primary-base)}.tabulator-row .tabulator-cell.tabulator-frozen{background-color:inherit;display:inline-block;left:0;position:-webkit-sticky;position:sticky;z-index:11}.tabulator-row .tabulator-cell.tabulator-frozen.tabulator-frozen-left{border-right:2px solid var(--prism-color-border-primary-base)}.tabulator-row .tabulator-cell.tabulator-frozen.tabulator-frozen-right{border-left:2px solid var(--prism-color-border-primary-base)}.tabulator-row .tabulator-cell.tabulator-editing{border:1px solid var(--prism-color-border-info-base);outline:none;padding:0}.tabulator-row .tabulator-cell.tabulator-editing input,.tabulator-row .tabulator-cell.tabulator-editing select{background:transparent;border:1px;outline:none}.tabulator-row .tabulator-cell.tabulator-validation-fail{border:1px solid var(--prism-color-border-danger-base)}.tabulator-row .tabulator-cell.tabulator-validation-fail input,.tabulator-row .tabulator-cell.tabulator-validation-fail select{background:transparent;border:1px;color:var(--prism-color-text-danger-base)}.tabulator-row .tabulator-cell.tabulator-row-handle{align-items:center;display:inline-flex;justify-content:center}.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box{width:80%}.tabulator-row .tabulator-cell.tabulator-row-handle .tabulator-row-handle-box .tabulator-row-handle-bar{background-color:var(--prism-color-fill-primary-base);height:3px;margin-top:2px;width:100%}.tabulator-row .tabulator-cell.tabulator-range-selected:not(.tabulator-range-only-cell-selected):not(.tabulator-range-row-header){background-color:var(--prism-color-material-info-down)}.tabulator-row .tabulator-cell .tabulator-data-tree-branch-empty{display:inline-block;width:7px}.tabulator-row .tabulator-cell .tabulator-data-tree-branch{border-bottom:2px solid var(--prism-color-border-primary-base);border-bottom-left-radius:1px;border-left:2px solid var(--prism-color-border-primary-base);display:inline-block;height:9px;margin-right:5px;margin-top:-9px;vertical-align:middle;width:7px}.tabulator-row .tabulator-cell .tabulator-data-tree-control{align-items:center;background:color-mix(in srgb,var(--prism-color-material-primary-inverse-base) 10%,transparent);border:1px solid var(--prism-color-border-primary-base);border-radius:2px;display:inline-flex;height:11px;justify-content:center;margin-right:5px;overflow:hidden;vertical-align:middle;width:11px}@media (hover:hover) and (pointer:fine){.tabulator-row .tabulator-cell .tabulator-data-tree-control:hover{background:color-mix(in srgb,var(--prism-color-material-primary-inverse-base) 20%,transparent);cursor:pointer}}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse{background:transparent;display:inline-block;height:7px;position:relative;width:1px}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after{background-color:var(--prism-color-fill-primary-base);content:"";height:1px;left:-3px;position:absolute;top:3px;width:7px}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand{background-color:var(--prism-color-fill-primary-base);display:inline-block;height:7px;position:relative;width:1px}.tabulator-row .tabulator-cell .tabulator-data-tree-control .tabulator-data-tree-control-expand:after{background-color:var(--prism-color-fill-primary-base);content:"";height:1px;left:-3px;position:absolute;top:3px;width:7px}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle{align-items:center;background-color:var(--prism-color-fill-primary-base);border-radius:20px;color:var(--prism-color-text-primary-inverse-base);display:inline-flex;font-size:1.1em;font-weight:700;height:15px;justify-content:center;width:15px}@media (hover:hover) and (pointer:fine){.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle:hover{cursor:pointer;opacity:.7}}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-close{display:initial}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle.open .tabulator-responsive-collapse-toggle-open{display:none}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle svg{stroke:currentcolor}.tabulator-row .tabulator-cell .tabulator-responsive-collapse-toggle .tabulator-responsive-collapse-toggle-close{display:none}.tabulator-row .tabulator-cell .tabulator-traffic-light{border-radius:14px;display:inline-block;height:14px;width:14px}.tabulator-row.tabulator-group{background:var(--prism-color-material-secondary-base);border-bottom:1px solid color-mix(in srgb,var(--prism-color-border-primary-base) var(--prism-alpha-tertiary-percentage),transparent);border-right:1px solid color-mix(in srgb,var(--prism-color-border-primary-base) var(--prism-alpha-tertiary-percentage),transparent);border-top:1px solid color-mix(in srgb,var(--prism-color-border-primary-base) var(--prism-alpha-tertiary-percentage),transparent);box-sizing:border-box;font-weight:700;min-width:100%;padding:5px 5px 5px 10px}@media (hover:hover) and (pointer:fine){.tabulator-row.tabulator-group:hover{background-color:var(--prism-color-material-primary-hover);cursor:pointer}}.tabulator-row.tabulator-group.tabulator-group-visible .tabulator-arrow{border-bottom:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid var(--prism-color-border-primary-base);margin-right:10px}.tabulator-row.tabulator-group.tabulator-group-level-1{padding-left:30px}.tabulator-row.tabulator-group.tabulator-group-level-2{padding-left:50px}.tabulator-row.tabulator-group.tabulator-group-level-3{padding-left:70px}.tabulator-row.tabulator-group.tabulator-group-level-4{padding-left:90px}.tabulator-row.tabulator-group.tabulator-group-level-5{padding-left:110px}.tabulator-row.tabulator-group .tabulator-group-toggle{display:inline-block}.tabulator-row.tabulator-group .tabulator-arrow{border-bottom:6px solid transparent;border-left:6px solid var(--prism-color-border-primary-base);border-right:0;border-top:6px solid transparent;display:inline-block;height:0;margin-right:16px;vertical-align:middle;width:0}.tabulator-row.tabulator-group span{color:var(--prism-color-text-danger-base);margin-left:10px}.tabulator-toggle{background-color:var(--prism-color-material-secondary-base);border:1px solid color-mix(in srgb,var(--prism-color-border-primary-base) var(--prism-alpha-tertiary-percentage),transparent);box-sizing:border-box;display:flex;flex-direction:row}.tabulator-toggle.tabulator-toggle-on{background-color:var(--prism-color-fill-info-base)}.tabulator-popup-container,.tabulator-toggle .tabulator-toggle-switch{background-color:var(--prism-color-material-brand-primary-base);border:1px solid var(--prism-color-border-primary-base);box-sizing:border-box}.tabulator-popup-container{--tw-shadow:var(--prism-shadow-xs-base);--tw-shadow-colored:var(--prism-shadow-xs-base);-webkit-overflow-scrolling:touch;box-shadow:var(--tw-ring-offset-shadow,0 0 #0000),var(--tw-ring-shadow,0 0 #0000),var(--tw-shadow);display:inline-block;font-size:14px;overflow-y:auto;position:absolute;z-index:10000}.tabulator-popup{border-radius:3px;padding:5px}.tabulator-tooltip{border-radius:2px;box-shadow:none;font-size:12px;max-width:min(500px,100%);padding:3px 5px;pointer-events:none}.tabulator-menu .tabulator-menu-item{box-sizing:border-box;padding:5px 10px;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.tabulator-menu .tabulator-menu-item.tabulator-menu-item-disabled{opacity:.5}@media (hover:hover) and (pointer:fine){.tabulator-menu .tabulator-menu-item:not(.tabulator-menu-item-disabled):hover{background-color:var(--prism-color-material-secondary-base);cursor:pointer}}.tabulator-menu .tabulator-menu-item.tabulator-menu-item-submenu{padding-right:25px}.tabulator-menu .tabulator-menu-item.tabulator-menu-item-submenu:after{border-color:var(--prism-color-border-primary-base);border-style:solid;border-width:1px 1px 0 0;content:"";display:inline-block;height:7px;position:absolute;right:10px;top:calc(5px + .4em);transform:rotate(45deg);vertical-align:top;width:7px}.tabulator-menu .tabulator-menu-separator{border-top:1px solid var(--prism-color-border-primary-base)}.tabulator-edit-list{-webkit-overflow-scrolling:touch;font-size:14px;max-height:200px;overflow-y:auto}.tabulator-edit-list .tabulator-edit-list-item{color:var(--prism-color-text-primary-base);outline:none;padding:4px}.tabulator-edit-list .tabulator-edit-list-item.active{background-color:var(--prism-color-fill-info-base);color:var(--prism-color-text-primary-inverse-base)}.tabulator-edit-list .tabulator-edit-list-item.active.focused{outline:1px solid var(--prism-color-border-primary-inverse-focus)}.tabulator-edit-list .tabulator-edit-list-item.focused{outline:1px solid var(--prism-color-border-info-focus)}@media (hover:hover) and (pointer:fine){.tabulator-edit-list .tabulator-edit-list-item:hover{background-color:var(--prism-color-fill-info-base);color:var(--prism-color-text-primary-inverse-base);cursor:pointer}}.tabulator-edit-list .tabulator-edit-list-placeholder{color:var(--prism-color-text-secondary-base);padding:4px;text-align:center}.tabulator-edit-list .tabulator-edit-list-group{border-bottom:1px solid var(--prism-color-border-primary-base);color:var(--prism-color-text-secondary-base);font-weight:700;padding:6px 4px 4px}.tabulator-edit-list .tabulator-edit-list-group.tabulator-edit-list-group-level-2,.tabulator-edit-list .tabulator-edit-list-item.tabulator-edit-list-group-level-2{padding-left:12px}.tabulator-edit-list .tabulator-edit-list-group.tabulator-edit-list-group-level-3,.tabulator-edit-list .tabulator-edit-list-item.tabulator-edit-list-group-level-3{padding-left:20px}.tabulator-edit-list .tabulator-edit-list-group.tabulator-edit-list-group-level-4,.tabulator-edit-list .tabulator-edit-list-item.tabulator-edit-list-group-level-4{padding-left:28px}.tabulator-edit-list .tabulator-edit-list-group.tabulator-edit-list-group-level-5,.tabulator-edit-list .tabulator-edit-list-item.tabulator-edit-list-group-level-5{padding-left:36px}.tabulator.tabulator-ltr{direction:ltr}.tabulator.tabulator-rtl{direction:rtl;text-align:initial}.tabulator.tabulator-rtl .tabulator-header .tabulator-col{border-left:1px solid var(--prism-color-border-primary-base);border-right:initial;text-align:initial}.tabulator.tabulator-rtl .tabulator-header .tabulator-col.tabulator-col-group .tabulator-col-group-cols{margin-left:-1px;margin-right:0}.tabulator.tabulator-rtl .tabulator-header .tabulator-col.tabulator-sortable .tabulator-col-title{padding-left:25px;padding-right:0}.tabulator.tabulator-rtl .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-sorter{left:8px;right:auto}.tabulator.tabulator-rtl .tabulator-tableholder .tabulator-range-overlay .tabulator-range.tabulator-range-active:after{background-color:var(--prism-color-fill-info-base);border-radius:999px;bottom:-3px;content:"";height:6px;left:-3px;position:absolute;right:auto;width:6px}.tabulator.tabulator-rtl .tabulator-row .tabulator-cell{border-left:1px solid var(--prism-color-border-primary-base);border-right:initial}.tabulator.tabulator-rtl .tabulator-row .tabulator-cell .tabulator-data-tree-branch{border-bottom-left-radius:0;border-bottom-right-radius:1px;border-left:initial;border-right:2px solid var(--prism-color-border-primary-base);margin-left:5px;margin-right:0}.tabulator.tabulator-rtl .tabulator-row .tabulator-cell .tabulator-data-tree-control{margin-left:5px;margin-right:0}.tabulator.tabulator-rtl .tabulator-row .tabulator-cell.tabulator-frozen.tabulator-frozen-left{border-left:2px solid var(--prism-color-border-primary-base)}.tabulator.tabulator-rtl .tabulator-row .tabulator-cell.tabulator-frozen.tabulator-frozen-right{border-right:2px solid var(--prism-color-border-primary-base)}.tabulator.tabulator-rtl .tabulator-row .tabulator-col-resize-handle:last-of-type{margin-left:0;margin-right:-3px;width:3px}.tabulator.tabulator-rtl .tabulator-footer .tabulator-calcs-holder{text-align:initial}.tabulator-print-fullscreen{bottom:0;left:0;position:absolute;right:0;top:0;z-index:10000}body.tabulator-print-fullscreen-hide>:not(.tabulator-print-fullscreen){display:none!important}.tabulator-print-table{border-collapse:collapse}.tabulator-print-table .tabulator-data-tree-branch{border-bottom:2px solid var(--prism-color-border-primary-base);border-bottom-left-radius:1px;border-left:2px solid var(--prism-color-border-primary-base);display:inline-block;height:9px;margin-right:5px;margin-top:-9px;vertical-align:middle;width:7px}.tabulator-print-table .tabulator-print-table-group{background-color:var(--prism-color-material-primary-base);border-bottom:1px solid var(--prism-color-border-primary-base);border-right:1px solid var(--prism-color-border-primary-base);border-top:1px solid var(--prism-color-border-primary-base);box-sizing:border-box;font-weight:700;min-width:100%;padding:5px 5px 5px 10px}@media (hover:hover) and (pointer:fine){.tabulator-print-table .tabulator-print-table-group:hover{background-color:color-mix(in srgb,var(--prism-color-material-primary-inverse-base) var(--prism-alpha-tertiary-percentage),transparent);cursor:pointer}}.tabulator-print-table .tabulator-print-table-group.tabulator-group-visible .tabulator-arrow{border-bottom:0;border-left:6px solid transparent;border-right:6px solid transparent;border-top:6px solid var(--prism-color-border-primary-base);margin-right:10px}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-1 td{padding-left:30px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-2 td{padding-left:50px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-3 td{padding-left:70px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-4 td{padding-left:90px!important}.tabulator-print-table .tabulator-print-table-group.tabulator-group-level-5 td{padding-left:110px!important}.tabulator-print-table .tabulator-print-table-group .tabulator-group-toggle{display:inline-block}.tabulator-print-table .tabulator-print-table-group .tabulator-arrow{border-bottom:6px solid transparent;border-left:6px solid var(--prism-color-border-primary-base);border-right:0;border-top:6px solid transparent;display:inline-block;height:0;margin-right:16px;vertical-align:middle;width:0}.tabulator-print-table .tabulator-print-table-group span{color:var(--prism-color-border-danger-base);margin-left:10px}.tabulator-print-table .tabulator-data-tree-control{align-items:center;background:color-mix(in srgb,var(--prism-color-material-primary-base) 10%,transparent);border:1px solid #333;border-radius:2px;display:inline-flex;height:11px;justify-content:center;margin-right:5px;overflow:hidden;vertical-align:middle;width:11px}@media (hover:hover) and (pointer:fine){.tabulator-print-table .tabulator-data-tree-control:hover{background:color-mix(in srgb,var(--prism-color-material-primary-base) 20%,transparent);cursor:pointer}}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse{background:transparent;display:inline-block;height:7px;position:relative;width:1px}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-collapse:after{background-color:var(--prism-color-material-primary-base);content:"";height:1px;left:-3px;position:absolute;top:3px;width:7px}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand{background-color:var(--prism-color-material-primary-base);display:inline-block;height:7px;position:relative;width:1px}.tabulator-print-table .tabulator-data-tree-control .tabulator-data-tree-control-expand:after{background-color:var(--prism-color-material-primary-base);content:"";height:1px;left:-3px;position:absolute;top:3px;width:7px}', Bt = Wt, At = class {
|
|
3560
|
+
constructor(d) {
|
|
3561
|
+
ot(this, d), this.uid = st(), this.prismId = `prism-data-table-${this.uid}`, this.gridData = {}, this.shadow = !1;
|
|
3562
|
+
}
|
|
3563
|
+
connectedCallback() {
|
|
3564
|
+
lt("prism-data-table");
|
|
3565
|
+
}
|
|
3566
|
+
/**
|
|
3567
|
+
* getGrid() - exposed public method for Tabulator
|
|
3568
|
+
*/
|
|
3569
|
+
async getGrid() {
|
|
3570
|
+
return this.table;
|
|
3571
|
+
}
|
|
3572
|
+
componentDidLoad() {
|
|
3573
|
+
this.table = new _t(this.tableEl, Object.assign({ popupContainer: this.parentEl, headerSortElement: function(d, t) {
|
|
3574
|
+
switch (t) {
|
|
3575
|
+
case "asc":
|
|
3576
|
+
return "<prism-icon name='sort_up' aria-hidden='true' priority='secondary' display='fill'></prism-icon>";
|
|
3577
|
+
case "desc":
|
|
3578
|
+
return "<prism-icon name='sort_down' aria-hidden='true' priority='secondary' display='fill'></prism-icon>";
|
|
3579
|
+
default:
|
|
3580
|
+
return "<prism-icon name='sort_updown' aria-hidden='true' priority='secondary' display='outline'></prism-icon>";
|
|
3581
|
+
}
|
|
3582
|
+
} }, this.gridData));
|
|
3583
|
+
}
|
|
3584
|
+
render() {
|
|
3585
|
+
return B(at, { key: "164d068f4429f46269f9f8d4a77d5b3d57fa9aac", id: this.prismId }, B("slot", { key: "3fef5937b64b0f2d7f535acbcbe2975f9cc7c3be", name: "header" }), B("div", { key: "ac5b98be87010037cf67be9fd2764f1a2541d00c", ref: (d) => this.parentEl = d, class: { "data-grid": !0, shadow: this.shadow } }, B("div", { key: "3f177953f28ba3ad8b9dcb11fd06fa164efbcce0", ref: (d) => this.tableEl = d })), B("slot", { key: "f92e169d698893149e56359d5ef06791d23b8771", name: "footer" }));
|
|
3586
|
+
}
|
|
3587
|
+
};
|
|
3588
|
+
At.style = Bt;
|
|
3589
|
+
export {
|
|
3590
|
+
At as prism_data_table
|
|
3591
|
+
};
|