slickgrid-vue 0.1.0
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/SlickgridVue.vue.d.ts +44 -0
- package/dist/components/slickgridVueProps.interface.d.ts +274 -0
- package/dist/constants.d.ts +23 -0
- package/dist/extensions/slickRowDetailView.d.ts +81 -0
- package/dist/global-grid-options.d.ts +5 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +12 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.mjs +1286 -0
- package/dist/index.mjs.map +1 -0
- package/dist/models/gridOption.interface.d.ts +12 -0
- package/dist/models/index.d.ts +5 -0
- package/dist/models/rowDetailView.interface.d.ts +13 -0
- package/dist/models/viewModelBindableData.interface.d.ts +9 -0
- package/dist/models/viewModelBindableInputData.interface.d.ts +8 -0
- package/dist/models/vueGridInstance.interface.d.ts +39 -0
- package/dist/services/container.service.d.ts +6 -0
- package/dist/services/index.d.ts +3 -0
- package/dist/services/translater.service.d.ts +27 -0
- package/dist/services/utilities.d.ts +7 -0
- package/dist/services/vueUtils.d.ts +16 -0
- package/dist/slickgrid-config.d.ts +5 -0
- package/package.json +75 -0
- package/src/assets/vue.svg +1 -0
- package/src/components/SlickgridVue.vue +1638 -0
- package/src/components/slickgridVueProps.interface.ts +150 -0
- package/src/constants.ts +95 -0
- package/src/extensions/slickRowDetailView.ts +416 -0
- package/src/global-grid-options.ts +288 -0
- package/src/index.ts +34 -0
- package/src/models/gridOption.interface.ts +16 -0
- package/src/models/index.ts +5 -0
- package/src/models/rowDetailView.interface.ts +16 -0
- package/src/models/viewModelBindableData.interface.ts +10 -0
- package/src/models/viewModelBindableInputData.interface.ts +9 -0
- package/src/models/vueGridInstance.interface.ts +77 -0
- package/src/services/container.service.ts +13 -0
- package/src/services/index.ts +3 -0
- package/src/services/translater.service.ts +41 -0
- package/src/services/utilities.ts +18 -0
- package/src/services/vueUtils.ts +26 -0
- package/src/slickgrid-config.ts +10 -0
- package/src/vite-env.d.ts +1 -0
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,1286 @@
|
|
|
1
|
+
var Qt = Object.defineProperty;
|
|
2
|
+
var Zt = (c, a, o) => a in c ? Qt(c, a, { enumerable: !0, configurable: !0, writable: !0, value: o }) : c[a] = o;
|
|
3
|
+
var W = (c, a, o) => Zt(c, typeof a != "symbol" ? a + "" : a, o);
|
|
4
|
+
import { unsubscribeAll as en, SlickRowSelectionModel as tn, addToArrayWhenNotExists as nn, SlickEventData as on, Filters as an, OperatorType as rn, EventNamingStyle as Pe, FileType as lt, DelimiterType as sn, SlickgridConfig as ln, SlickEventHandler as dn, BackendUtilityService as un, GridEventService as cn, SharedService as fn, CollectionService as mn, ExtensionUtility as hn, FilterFactory as pn, FilterService as vn, ResizerService as Cn, SortService as gn, TreeDataService as dt, PaginationService as Sn, ExtensionService as wn, GridStateService as ut, GridService as ct, HeaderGroupingService as ft, SlickGroupItemMetadataProvider as bn, SlickDataView as yn, autoAddEditorFormatterToColumnsWithEditor as mt, SlickGrid as En, emptyElement as An, ExtensionName as ht, isColumnDateType as Rn, GridStateType as xn } from "@slickgrid-universal/common";
|
|
5
|
+
export * from "@slickgrid-universal/common";
|
|
6
|
+
import { Aggregators as ri, Enums as si, Formatters as li, GroupTotalFormatters as di, SortComparers as ui, Utilities as ci } from "@slickgrid-universal/common";
|
|
7
|
+
import { EventPubSubService as pt } from "@slickgrid-universal/event-pub-sub";
|
|
8
|
+
import { EventPubSubService as mi } from "@slickgrid-universal/event-pub-sub";
|
|
9
|
+
import { createApp as Oe, defineComponent as Dn, mergeModels as In, useAttrs as Pn, ref as J, computed as vt, useModel as pe, watch as ge, onBeforeUnmount as On, onMounted as Tn, nextTick as _n, openBlock as kn, createElementBlock as Fn, renderSlot as Ct, createElementVNode as Bn } from "vue";
|
|
10
|
+
import { SlickFooterComponent as Vn } from "@slickgrid-universal/custom-footer-component";
|
|
11
|
+
import { SlickEmptyWarningComponent as gt } from "@slickgrid-universal/empty-warning-component";
|
|
12
|
+
import { SlickPaginationComponent as Mn } from "@slickgrid-universal/pagination-component";
|
|
13
|
+
import { extend as St } from "@slickgrid-universal/utils";
|
|
14
|
+
import { useTranslation as Rt } from "i18next-vue";
|
|
15
|
+
import { SlickRowDetailView as Gn } from "@slickgrid-universal/row-detail-view-plugin";
|
|
16
|
+
class ti {
|
|
17
|
+
constructor(a) {
|
|
18
|
+
this._value = null, this._boundedEventWithListeners = [], this._elementBindings = [], this._binding = a, this._property = a.property || "", this._elementBindings = [], a.property && a.variable && (a.variable.hasOwnProperty(a.property) || a.property in a.variable) ? this._value = a.variable[a.property] : this._value = a.variable, typeof a.variable == "object" && Object.defineProperty(a.variable, a.property, {
|
|
19
|
+
get: this.valueGetter.bind(this),
|
|
20
|
+
set: this.valueSetter.bind(this)
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
get boundedEventWithListeners() {
|
|
24
|
+
return this._boundedEventWithListeners;
|
|
25
|
+
}
|
|
26
|
+
get elementBindings() {
|
|
27
|
+
return this._elementBindings;
|
|
28
|
+
}
|
|
29
|
+
get property() {
|
|
30
|
+
return this._property;
|
|
31
|
+
}
|
|
32
|
+
dispose() {
|
|
33
|
+
this.unbindAll(), this._boundedEventWithListeners = [], this._elementBindings = [];
|
|
34
|
+
}
|
|
35
|
+
valueGetter() {
|
|
36
|
+
return this._value;
|
|
37
|
+
}
|
|
38
|
+
valueSetter(a) {
|
|
39
|
+
if (this._value = a, Array.isArray(this._elementBindings))
|
|
40
|
+
for (const o of this._elementBindings)
|
|
41
|
+
o != null && o.element && (o != null && o.attribute) && (o.element[o.attribute] = a);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Add binding to 1 or more DOM Element by an object attribute and optionally on an event, we can do it in couple ways
|
|
45
|
+
* 1- if there's no event provided, it will simply replace the DOM elemnt (by an attribute), for example an innerHTML
|
|
46
|
+
* 2- when an event is provided, we will replace the DOM element (by an attribute) every time an event is triggered
|
|
47
|
+
* 2.1- we could also provide an extra callback method to execute when the event gets triggered
|
|
48
|
+
*/
|
|
49
|
+
bind(a, o, l, f) {
|
|
50
|
+
return a && a.forEach ? a.forEach((h) => this.bindSingleElement(h, o, l, f)) : a && this.bindSingleElement(a, o, l, f), this;
|
|
51
|
+
}
|
|
52
|
+
/** Unbind (remove) an element event listener */
|
|
53
|
+
unbind(a, o, l, f, h) {
|
|
54
|
+
if (a) {
|
|
55
|
+
a.removeEventListener(o, l, f);
|
|
56
|
+
const S = this._boundedEventWithListeners.findIndex((n) => n.uid === h);
|
|
57
|
+
S >= 0 && this._boundedEventWithListeners.splice(S, 1);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/** Unbind All (remove) bounded elements with listeners */
|
|
61
|
+
unbindAll() {
|
|
62
|
+
let a = this._boundedEventWithListeners.pop();
|
|
63
|
+
for (; a; ) {
|
|
64
|
+
const { element: o, eventName: l, listener: f, uid: h } = a;
|
|
65
|
+
this.unbind(o, l, f, void 0, h), a = this._boundedEventWithListeners.pop();
|
|
66
|
+
}
|
|
67
|
+
this._boundedEventWithListeners = [];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Add binding to a single element by an object attribute and optionally on an event, we can do it in couple ways
|
|
71
|
+
* 1- if there's no event provided, it will simply replace the DOM element (by an attribute), for example an innerHTML
|
|
72
|
+
* 2- when an event is provided, we will replace the DOM element (by an attribute) every time an event is triggered
|
|
73
|
+
* 2.1- we could also provide an extra callback method to execute when the event gets triggered
|
|
74
|
+
*/
|
|
75
|
+
bindSingleElement(a, o, l, f) {
|
|
76
|
+
const h = { element: a, attribute: o };
|
|
77
|
+
if (a) {
|
|
78
|
+
if (l) {
|
|
79
|
+
const S = () => {
|
|
80
|
+
let n = a[o];
|
|
81
|
+
if (this.hasData(n) && (a == null ? void 0 : a.type) === "number" && (n = +n), this.valueSetter(n), (this._binding.variable.hasOwnProperty(this._binding.property) || this._binding.property in this._binding.variable) && (this._binding.variable[this._binding.property] = this.valueGetter()), typeof f == "function")
|
|
82
|
+
return f(this.valueGetter());
|
|
83
|
+
};
|
|
84
|
+
h.event = l, h.listener = S, a.addEventListener(l, S), this._boundedEventWithListeners.push({ element: a, eventName: l, listener: S, uid: this.generateUuidV4() });
|
|
85
|
+
}
|
|
86
|
+
this._elementBindings.push(h), a[o] = this._value;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
/** Generate a UUID version 4 RFC compliant */
|
|
90
|
+
generateUuidV4() {
|
|
91
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (a) => {
|
|
92
|
+
const o = Math.random() * 16 | 0;
|
|
93
|
+
return (a === "x" ? o : o & 3 | 8).toString(16);
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
hasData(a) {
|
|
97
|
+
return a != null && a !== "";
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
var wt = Object.prototype.hasOwnProperty;
|
|
101
|
+
function we(c, a) {
|
|
102
|
+
var o, l;
|
|
103
|
+
if (c === a) return !0;
|
|
104
|
+
if (c && a && (o = c.constructor) === a.constructor) {
|
|
105
|
+
if (o === Date) return c.getTime() === a.getTime();
|
|
106
|
+
if (o === RegExp) return c.toString() === a.toString();
|
|
107
|
+
if (o === Array) {
|
|
108
|
+
if ((l = c.length) === a.length)
|
|
109
|
+
for (; l-- && we(c[l], a[l]); ) ;
|
|
110
|
+
return l === -1;
|
|
111
|
+
}
|
|
112
|
+
if (!o || typeof c == "object") {
|
|
113
|
+
l = 0;
|
|
114
|
+
for (o in c)
|
|
115
|
+
if (wt.call(c, o) && ++l && !wt.call(a, o) || !(o in a) || !we(c[o], a[o])) return !1;
|
|
116
|
+
return Object.keys(a).length === l;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return c !== c && a !== a;
|
|
120
|
+
}
|
|
121
|
+
const Se = "container_", bt = "container_loading";
|
|
122
|
+
class yt extends Gn {
|
|
123
|
+
constructor(o) {
|
|
124
|
+
super(o);
|
|
125
|
+
W(this, "_component");
|
|
126
|
+
W(this, "_preloadComponent");
|
|
127
|
+
W(this, "_views", []);
|
|
128
|
+
W(this, "_subscriptions", []);
|
|
129
|
+
W(this, "_userProcessFn");
|
|
130
|
+
W(this, "gridContainerElement");
|
|
131
|
+
this.eventPubSubService = o;
|
|
132
|
+
}
|
|
133
|
+
get addonOptions() {
|
|
134
|
+
return this.getOptions();
|
|
135
|
+
}
|
|
136
|
+
get datasetIdPropName() {
|
|
137
|
+
return this.gridOptions.datasetIdPropertyName || "id";
|
|
138
|
+
}
|
|
139
|
+
get eventHandler() {
|
|
140
|
+
return this._eventHandler;
|
|
141
|
+
}
|
|
142
|
+
set eventHandler(o) {
|
|
143
|
+
this._eventHandler = o;
|
|
144
|
+
}
|
|
145
|
+
get gridOptions() {
|
|
146
|
+
var o;
|
|
147
|
+
return ((o = this._grid) == null ? void 0 : o.getOptions()) || {};
|
|
148
|
+
}
|
|
149
|
+
get rowDetailViewOptions() {
|
|
150
|
+
return this.gridOptions.rowDetailView;
|
|
151
|
+
}
|
|
152
|
+
/** Dispose of the RowDetailView Extension */
|
|
153
|
+
dispose() {
|
|
154
|
+
this.disposeAllViewComponents(), en(this._subscriptions), super.dispose();
|
|
155
|
+
}
|
|
156
|
+
/** Dispose of all the opened Row Detail Panels Components */
|
|
157
|
+
disposeAllViewComponents() {
|
|
158
|
+
Array.isArray(this._views) && this._views.forEach((o) => this.disposeViewComponent(o)), this._views = [];
|
|
159
|
+
}
|
|
160
|
+
/** Get the instance of the SlickGrid addon (control or plugin). */
|
|
161
|
+
getAddonInstance() {
|
|
162
|
+
return this;
|
|
163
|
+
}
|
|
164
|
+
init(o) {
|
|
165
|
+
this._grid = o, super.init(this._grid), this.gridContainerElement = o.getContainerNode(), this.register(o == null ? void 0 : o.getSelectionModel());
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Create the plugin before the Grid creation, else it will behave oddly.
|
|
169
|
+
* Mostly because the column definitions might change after the grid creation
|
|
170
|
+
*/
|
|
171
|
+
register(o) {
|
|
172
|
+
var l, f, h, S, n, P, M, F;
|
|
173
|
+
if (typeof ((l = this.gridOptions.rowDetailView) == null ? void 0 : l.process) == "function")
|
|
174
|
+
this._userProcessFn = this.gridOptions.rowDetailView.process, this.addonOptions.process = (C) => this.onProcessing(C);
|
|
175
|
+
else
|
|
176
|
+
throw new Error('[Slickgrid-React] You need to provide a "process" function for the Row Detail Extension to work properly');
|
|
177
|
+
return this._grid && ((f = this.gridOptions) != null && f.rowDetailView) && (this.gridOptions.rowDetailView.preTemplate || (this._preloadComponent = (S = (h = this.gridOptions) == null ? void 0 : h.rowDetailView) == null ? void 0 : S.preloadComponent, this.addonOptions.preTemplate = () => this._grid.sanitizeHtmlString(`<div class="${bt}"></div>`)), this.gridOptions.rowDetailView.postTemplate || (this._component = (P = (n = this.gridOptions) == null ? void 0 : n.rowDetailView) == null ? void 0 : P.viewComponent, this.addonOptions.postTemplate = (C) => this._grid.sanitizeHtmlString(
|
|
178
|
+
`<div class="${Se}${C[this.datasetIdPropName]}"></div>`
|
|
179
|
+
)), this._grid && this.gridOptions && ((!o || !this._grid.getSelectionModel()) && (o = new tn(this.gridOptions.rowSelectionOptions || { selectActiveRow: !0 }), this._grid.setSelectionModel(o)), this._grid && this.rowDetailViewOptions && (this.rowDetailViewOptions.onExtensionRegistered && this.rowDetailViewOptions.onExtensionRegistered(this), this.onAsyncResponse && this._eventHandler.subscribe(this.onAsyncResponse, (C, u) => {
|
|
180
|
+
var s;
|
|
181
|
+
typeof ((s = this.rowDetailViewOptions) == null ? void 0 : s.onAsyncResponse) == "function" && this.rowDetailViewOptions.onAsyncResponse(C, u);
|
|
182
|
+
}), this.onAsyncEndUpdate && this._eventHandler.subscribe(this.onAsyncEndUpdate, async (C, u) => {
|
|
183
|
+
var s;
|
|
184
|
+
await this.renderViewModel(u == null ? void 0 : u.item), typeof ((s = this.rowDetailViewOptions) == null ? void 0 : s.onAsyncEndUpdate) == "function" && this.rowDetailViewOptions.onAsyncEndUpdate(C, u);
|
|
185
|
+
}), this.onAfterRowDetailToggle && this._eventHandler.subscribe(this.onAfterRowDetailToggle, async (C, u) => {
|
|
186
|
+
var s;
|
|
187
|
+
await this.renderPreloadView(u.item), this.renderAllViewModels(), typeof ((s = this.rowDetailViewOptions) == null ? void 0 : s.onAfterRowDetailToggle) == "function" && this.rowDetailViewOptions.onAfterRowDetailToggle(C, u);
|
|
188
|
+
}), this.onBeforeRowDetailToggle && this._eventHandler.subscribe(this.onBeforeRowDetailToggle, (C, u) => {
|
|
189
|
+
var s;
|
|
190
|
+
return this.handleOnBeforeRowDetailToggle(C, u), typeof ((s = this.rowDetailViewOptions) == null ? void 0 : s.onBeforeRowDetailToggle) == "function" ? this.rowDetailViewOptions.onBeforeRowDetailToggle(C, u) : !0;
|
|
191
|
+
}), this.onRowBackToViewportRange && this._eventHandler.subscribe(this.onRowBackToViewportRange, async (C, u) => {
|
|
192
|
+
var s;
|
|
193
|
+
await this.handleOnRowBackToViewportRange(C, u), typeof ((s = this.rowDetailViewOptions) == null ? void 0 : s.onRowBackToViewportRange) == "function" && this.rowDetailViewOptions.onRowBackToViewportRange(C, u);
|
|
194
|
+
}), this.onRowOutOfViewportRange && this._eventHandler.subscribe(this.onRowOutOfViewportRange, (C, u) => {
|
|
195
|
+
var s;
|
|
196
|
+
typeof ((s = this.rowDetailViewOptions) == null ? void 0 : s.onRowOutOfViewportRange) == "function" && this.rowDetailViewOptions.onRowOutOfViewportRange(C, u);
|
|
197
|
+
}), this.eventHandler.subscribe(this._grid.onColumnsReordered, this.redrawAllViewComponents.bind(this)), (this.gridOptions.enableRowSelection || this.gridOptions.enableCheckboxSelector) && this._eventHandler.subscribe(this._grid.onSelectedRowsChanged, this.redrawAllViewComponents.bind(this)), this._eventHandler.subscribe(this._grid.onSort, this.disposeAllViewComponents.bind(this)), this._subscriptions.push(
|
|
198
|
+
(M = this.eventPubSubService) == null ? void 0 : M.subscribe(
|
|
199
|
+
["onFilterChanged", "onGridMenuColumnsChanged", "onColumnPickerColumnsChanged"],
|
|
200
|
+
this.redrawAllViewComponents.bind(this)
|
|
201
|
+
),
|
|
202
|
+
(F = this.eventPubSubService) == null ? void 0 : F.subscribe(
|
|
203
|
+
["onGridMenuClearAllFilters", "onGridMenuClearAllSorting"],
|
|
204
|
+
() => window.setTimeout(() => this.redrawAllViewComponents())
|
|
205
|
+
)
|
|
206
|
+
)))), this;
|
|
207
|
+
}
|
|
208
|
+
/** Redraw (re-render) all the expanded row detail View Components */
|
|
209
|
+
async redrawAllViewComponents() {
|
|
210
|
+
await Promise.all(this._views.map(async (o) => this.redrawViewComponent(o)));
|
|
211
|
+
}
|
|
212
|
+
/** Render all the expanded row detail View Components */
|
|
213
|
+
async renderAllViewModels() {
|
|
214
|
+
await Promise.all(this._views.filter((o) => o == null ? void 0 : o.dataContext).map(async (o) => this.renderViewModel(o.dataContext)));
|
|
215
|
+
}
|
|
216
|
+
/** Redraw the necessary View Component */
|
|
217
|
+
async redrawViewComponent(o) {
|
|
218
|
+
const l = this.gridContainerElement.getElementsByClassName(`${Se}${o.id}`);
|
|
219
|
+
(l == null ? void 0 : l.length) >= 0 && await this.renderViewModel(o.dataContext);
|
|
220
|
+
}
|
|
221
|
+
/** Render (or re-render) the View Component (Row Detail) */
|
|
222
|
+
async renderPreloadView(o) {
|
|
223
|
+
var f, h;
|
|
224
|
+
const l = this.gridContainerElement.getElementsByClassName(`${bt}`);
|
|
225
|
+
if (this._preloadComponent && (l != null && l.length)) {
|
|
226
|
+
const S = this._views.find((C) => C.id === o[this.datasetIdPropName]), n = {
|
|
227
|
+
model: o,
|
|
228
|
+
addon: this,
|
|
229
|
+
grid: this._grid,
|
|
230
|
+
dataView: this.dataView,
|
|
231
|
+
// @deprecated @use `parentRef`
|
|
232
|
+
parent: (f = this.rowDetailViewOptions) == null ? void 0 : f.parent,
|
|
233
|
+
parentRef: (h = this.rowDetailViewOptions) == null ? void 0 : h.parent
|
|
234
|
+
}, P = document.createElement("div"), M = Oe(this._preloadComponent, n), F = M.mount(P);
|
|
235
|
+
n.parent = F, l[l.length - 1].appendChild(F.$el), S && (S.app = M, S.instance = F);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/** Render (or re-render) the View Component (Row Detail) */
|
|
239
|
+
async renderViewModel(o) {
|
|
240
|
+
var f, h;
|
|
241
|
+
const l = this.gridContainerElement.getElementsByClassName(
|
|
242
|
+
`${Se}${o[this.datasetIdPropName]}`
|
|
243
|
+
);
|
|
244
|
+
if (this._component && (l != null && l.length)) {
|
|
245
|
+
const S = this._views.find((C) => C.id === o[this.datasetIdPropName]), n = {
|
|
246
|
+
model: o,
|
|
247
|
+
addon: this,
|
|
248
|
+
grid: this._grid,
|
|
249
|
+
dataView: this.dataView,
|
|
250
|
+
// @deprecated @use `parentRef`
|
|
251
|
+
parent: (f = this.rowDetailViewOptions) == null ? void 0 : f.parent,
|
|
252
|
+
parentRef: (h = this.rowDetailViewOptions) == null ? void 0 : h.parent
|
|
253
|
+
};
|
|
254
|
+
S != null && S.app && S.app.unmount();
|
|
255
|
+
const P = document.createElement("div"), M = Oe(this._component, n), F = M.mount(P);
|
|
256
|
+
n.parent = M.component, l[l.length - 1].appendChild(F.$el), S || this.addViewInfoToViewsRef(o, M, F);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
// --
|
|
260
|
+
// protected functions
|
|
261
|
+
// ------------------
|
|
262
|
+
addViewInfoToViewsRef(o, l, f) {
|
|
263
|
+
const h = {
|
|
264
|
+
id: o[this.datasetIdPropName],
|
|
265
|
+
dataContext: o,
|
|
266
|
+
app: l,
|
|
267
|
+
instance: f
|
|
268
|
+
}, S = this.gridOptions.datasetIdPropertyName || "id";
|
|
269
|
+
nn(this._views, h, S);
|
|
270
|
+
}
|
|
271
|
+
disposeViewComponent(o) {
|
|
272
|
+
var l;
|
|
273
|
+
if (o && o != null && o.instance) {
|
|
274
|
+
const f = this.gridContainerElement.getElementsByClassName(`${Se}${this._views[0].id}`);
|
|
275
|
+
if (f != null && f.length)
|
|
276
|
+
return (l = o.app) == null || l.unmount(), f[0].textContent = "", o;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Just before the row get expanded or collapsed we will do the following
|
|
281
|
+
* First determine if the row is expanding or collapsing,
|
|
282
|
+
* if it's expanding we will add it to our View Components reference array if we don't already have it
|
|
283
|
+
* or if it's collapsing we will remove it from our View Components reference array
|
|
284
|
+
*/
|
|
285
|
+
handleOnBeforeRowDetailToggle(o, l) {
|
|
286
|
+
var f;
|
|
287
|
+
if ((f = l == null ? void 0 : l.item) != null && f.__collapsed)
|
|
288
|
+
this.addViewInfoToViewsRef(l.item, null, null);
|
|
289
|
+
else {
|
|
290
|
+
const h = this._views.findIndex((S) => S.id === l.item[this.datasetIdPropName]);
|
|
291
|
+
h >= 0 && this.disposeViewComponent(this._views[h]) && this._views.splice(h, 1);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
/** When Row comes back to Viewport Range, we need to redraw the View */
|
|
295
|
+
async handleOnRowBackToViewportRange(o, l) {
|
|
296
|
+
l != null && l.item && await this.redrawAllViewComponents();
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* notify the onAsyncResponse with the "args.item" (required property)
|
|
300
|
+
* the plugin will then use item to populate the row detail panel with the "postTemplate"
|
|
301
|
+
* @param item
|
|
302
|
+
*/
|
|
303
|
+
notifyTemplate(o) {
|
|
304
|
+
this.onAsyncResponse && this.onAsyncResponse.notify({ item: o, itemDetail: o }, new on(), this);
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* On Processing, we will notify the plugin with the new item detail once backend server call completes
|
|
308
|
+
* @param item
|
|
309
|
+
*/
|
|
310
|
+
async onProcessing(o) {
|
|
311
|
+
if (o && typeof this._userProcessFn == "function") {
|
|
312
|
+
let l;
|
|
313
|
+
const h = await this._userProcessFn(o);
|
|
314
|
+
if (this.datasetIdPropName in h ? l = h : h instanceof Response && typeof h.json == "function" ? l = await h.json() : h && h.content && (l = h.content), !l || !(this.datasetIdPropName in l))
|
|
315
|
+
throw new Error(
|
|
316
|
+
'[Slickgrid-React] could not process the Row Detail, please make sure that your "process" callback (a Promise or an HttpClient call returning an Observable) returns an item object that has an "${this.datasetIdPropName}" property'
|
|
317
|
+
);
|
|
318
|
+
this.notifyTemplate(l || {});
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
const Et = {
|
|
323
|
+
alwaysShowVerticalScroll: !0,
|
|
324
|
+
autoEdit: !1,
|
|
325
|
+
asyncEditorLoading: !1,
|
|
326
|
+
autoFitColumnsOnFirstLoad: !0,
|
|
327
|
+
autoResize: {
|
|
328
|
+
applyResizeToContainer: !0,
|
|
329
|
+
calculateAvailableSizeBy: "window",
|
|
330
|
+
bottomPadding: 20,
|
|
331
|
+
minHeight: 180,
|
|
332
|
+
minWidth: 300,
|
|
333
|
+
rightPadding: 0
|
|
334
|
+
},
|
|
335
|
+
cellHighlightCssClass: "slick-cell-modified",
|
|
336
|
+
checkboxSelector: {
|
|
337
|
+
cssClass: "slick-cell-checkboxsel",
|
|
338
|
+
width: 40
|
|
339
|
+
},
|
|
340
|
+
cellMenu: {
|
|
341
|
+
autoAdjustDrop: !0,
|
|
342
|
+
autoAlignSide: !0,
|
|
343
|
+
hideCloseButton: !0,
|
|
344
|
+
hideCommandSection: !1,
|
|
345
|
+
hideOptionSection: !1
|
|
346
|
+
},
|
|
347
|
+
columnGroupSeparator: " - ",
|
|
348
|
+
columnPicker: {
|
|
349
|
+
hideForceFitButton: !1,
|
|
350
|
+
hideSyncResizeButton: !0,
|
|
351
|
+
headerColumnValueExtractor: At
|
|
352
|
+
},
|
|
353
|
+
compositeEditorOptions: {
|
|
354
|
+
labels: {
|
|
355
|
+
cancelButtonKey: "CANCEL",
|
|
356
|
+
cloneButtonKey: "CLONE",
|
|
357
|
+
resetEditorButtonTooltipKey: "RESET_INPUT_VALUE",
|
|
358
|
+
resetFormButtonKey: "RESET_FORM",
|
|
359
|
+
massSelectionButtonKey: "APPLY_TO_SELECTION",
|
|
360
|
+
massSelectionStatusKey: "X_OF_Y_MASS_SELECTED",
|
|
361
|
+
massUpdateButtonKey: "APPLY_MASS_UPDATE",
|
|
362
|
+
massUpdateStatusKey: "ALL_X_RECORDS_SELECTED",
|
|
363
|
+
saveButtonKey: "SAVE"
|
|
364
|
+
},
|
|
365
|
+
resetEditorButtonCssClass: "mdi mdi-refresh mdi-15px",
|
|
366
|
+
resetFormButtonIconCssClass: "mdi mdi-refresh mdi-16px mdi-flip-h"
|
|
367
|
+
},
|
|
368
|
+
contextMenu: {
|
|
369
|
+
autoAdjustDrop: !0,
|
|
370
|
+
autoAlignSide: !0,
|
|
371
|
+
hideCloseButton: !0,
|
|
372
|
+
hideClearAllGrouping: !1,
|
|
373
|
+
hideCollapseAllGroups: !1,
|
|
374
|
+
hideCommandSection: !1,
|
|
375
|
+
hideCopyCellValueCommand: !1,
|
|
376
|
+
hideExpandAllGroups: !1,
|
|
377
|
+
hideExportCsvCommand: !1,
|
|
378
|
+
hideExportExcelCommand: !1,
|
|
379
|
+
hideExportTextDelimitedCommand: !0,
|
|
380
|
+
hideMenuOnScroll: !0,
|
|
381
|
+
hideOptionSection: !1,
|
|
382
|
+
iconCollapseAllGroupsCommand: "mdi mdi-arrow-collapse",
|
|
383
|
+
iconExpandAllGroupsCommand: "mdi mdi-arrow-expand",
|
|
384
|
+
iconClearGroupingCommand: "mdi mdi-close",
|
|
385
|
+
iconCopyCellValueCommand: "mdi mdi-content-copy",
|
|
386
|
+
iconExportCsvCommand: "mdi mdi-download",
|
|
387
|
+
iconExportExcelCommand: "mdi mdi-file-excel-outline text-success",
|
|
388
|
+
iconExportTextDelimitedCommand: "mdi mdi-download"
|
|
389
|
+
},
|
|
390
|
+
customFooterOptions: {
|
|
391
|
+
dateFormat: "YYYY-MM-DD, hh:mm a",
|
|
392
|
+
hideRowSelectionCount: !1,
|
|
393
|
+
hideTotalItemCount: !1,
|
|
394
|
+
hideLastUpdateTimestamp: !0,
|
|
395
|
+
footerHeight: 25,
|
|
396
|
+
leftContainerClass: "col-xs-12 col-sm-5",
|
|
397
|
+
rightContainerClass: "col-xs-6 col-sm-7",
|
|
398
|
+
metricSeparator: "|",
|
|
399
|
+
metricTexts: {
|
|
400
|
+
items: "items",
|
|
401
|
+
itemsKey: "ITEMS",
|
|
402
|
+
of: "of",
|
|
403
|
+
ofKey: "OF",
|
|
404
|
+
itemsSelected: "items selected",
|
|
405
|
+
itemsSelectedKey: "ITEMS_SELECTED"
|
|
406
|
+
}
|
|
407
|
+
},
|
|
408
|
+
dataView: {
|
|
409
|
+
// when enabled, this will preserve the row selection even after filtering/sorting/grouping
|
|
410
|
+
syncGridSelection: {
|
|
411
|
+
preserveHidden: !1,
|
|
412
|
+
preserveHiddenOnSelectionChange: !0
|
|
413
|
+
},
|
|
414
|
+
syncGridSelectionWithBackendService: !1
|
|
415
|
+
// but disable it when using backend services
|
|
416
|
+
},
|
|
417
|
+
datasetIdPropertyName: "id",
|
|
418
|
+
defaultFilter: an.input,
|
|
419
|
+
defaultBackendServiceFilterTypingDebounce: 500,
|
|
420
|
+
defaultColumnSortFieldId: "id",
|
|
421
|
+
defaultFilterPlaceholder: "🔎︎",
|
|
422
|
+
// magnifying glass icon
|
|
423
|
+
defaultFilterRangeOperator: rn.rangeInclusive,
|
|
424
|
+
editable: !1,
|
|
425
|
+
editorTypingDebounce: 450,
|
|
426
|
+
filterTypingDebounce: 0,
|
|
427
|
+
enableEmptyDataWarningMessage: !0,
|
|
428
|
+
enableFilterTrimWhiteSpace: !1,
|
|
429
|
+
// do we want to trim white spaces on all Filters?
|
|
430
|
+
emptyDataWarning: {
|
|
431
|
+
className: "slick-empty-data-warning",
|
|
432
|
+
message: "No data to display.",
|
|
433
|
+
messageKey: "EMPTY_DATA_WARNING_MESSAGE",
|
|
434
|
+
hideFrozenLeftWarning: !1,
|
|
435
|
+
hideFrozenRightWarning: !1,
|
|
436
|
+
leftViewportMarginLeft: "40%",
|
|
437
|
+
rightViewportMarginLeft: "40%",
|
|
438
|
+
frozenLeftViewportMarginLeft: "0px",
|
|
439
|
+
frozenRightViewportMarginLeft: "40%"
|
|
440
|
+
},
|
|
441
|
+
enableAutoResize: !0,
|
|
442
|
+
enableAutoSizeColumns: !0,
|
|
443
|
+
enableCellNavigation: !1,
|
|
444
|
+
enableColumnPicker: !0,
|
|
445
|
+
enableColumnReorder: !0,
|
|
446
|
+
enableColumnResizeOnDoubleClick: !0,
|
|
447
|
+
enableContextMenu: !0,
|
|
448
|
+
enableExcelExport: !1,
|
|
449
|
+
enableTextExport: !1,
|
|
450
|
+
enableGridMenu: !0,
|
|
451
|
+
enableHeaderMenu: !0,
|
|
452
|
+
enableMouseHoverHighlightRow: !0,
|
|
453
|
+
enableSorting: !0,
|
|
454
|
+
enableTextSelectionOnCells: !0,
|
|
455
|
+
eventNamingStyle: Pe.camelCaseWithExtraOnPrefix,
|
|
456
|
+
explicitInitialization: !0,
|
|
457
|
+
excelExportOptions: {
|
|
458
|
+
addGroupIndentation: !0,
|
|
459
|
+
exportWithFormatter: !1,
|
|
460
|
+
filename: "export",
|
|
461
|
+
format: lt.xlsx,
|
|
462
|
+
groupingColumnHeaderTitle: "Group By",
|
|
463
|
+
groupCollapsedSymbol: "⮞",
|
|
464
|
+
groupExpandedSymbol: "⮟",
|
|
465
|
+
groupingAggregatorRowText: "",
|
|
466
|
+
sanitizeDataExport: !1
|
|
467
|
+
},
|
|
468
|
+
textExportOptions: {
|
|
469
|
+
delimiter: sn.comma,
|
|
470
|
+
exportWithFormatter: !1,
|
|
471
|
+
filename: "export",
|
|
472
|
+
format: lt.csv,
|
|
473
|
+
groupingColumnHeaderTitle: "Group By",
|
|
474
|
+
groupingAggregatorRowText: "",
|
|
475
|
+
sanitizeDataExport: !1,
|
|
476
|
+
useUtf8WithBom: !0
|
|
477
|
+
},
|
|
478
|
+
forceFitColumns: !1,
|
|
479
|
+
frozenHeaderWidthCalcDifferential: 1,
|
|
480
|
+
gridMenu: {
|
|
481
|
+
dropSide: "left",
|
|
482
|
+
commandLabels: {
|
|
483
|
+
clearAllFiltersCommandKey: "CLEAR_ALL_FILTERS",
|
|
484
|
+
clearAllSortingCommandKey: "CLEAR_ALL_SORTING",
|
|
485
|
+
clearFrozenColumnsCommandKey: "CLEAR_PINNING",
|
|
486
|
+
exportCsvCommandKey: "EXPORT_TO_CSV",
|
|
487
|
+
exportExcelCommandKey: "EXPORT_TO_EXCEL",
|
|
488
|
+
exportTextDelimitedCommandKey: "EXPORT_TO_TAB_DELIMITED",
|
|
489
|
+
refreshDatasetCommandKey: "REFRESH_DATASET",
|
|
490
|
+
toggleDarkModeCommandKey: "TOGGLE_DARK_MODE",
|
|
491
|
+
toggleFilterCommandKey: "TOGGLE_FILTER_ROW",
|
|
492
|
+
togglePreHeaderCommandKey: "TOGGLE_PRE_HEADER_ROW"
|
|
493
|
+
},
|
|
494
|
+
hideClearAllFiltersCommand: !1,
|
|
495
|
+
hideClearAllSortingCommand: !1,
|
|
496
|
+
hideClearFrozenColumnsCommand: !0,
|
|
497
|
+
// opt-in command
|
|
498
|
+
hideExportCsvCommand: !1,
|
|
499
|
+
hideExportExcelCommand: !1,
|
|
500
|
+
hideExportTextDelimitedCommand: !0,
|
|
501
|
+
hideForceFitButton: !1,
|
|
502
|
+
hideRefreshDatasetCommand: !1,
|
|
503
|
+
hideSyncResizeButton: !0,
|
|
504
|
+
hideToggleDarkModeCommand: !0,
|
|
505
|
+
hideToggleFilterCommand: !1,
|
|
506
|
+
hideTogglePreHeaderCommand: !1,
|
|
507
|
+
iconCssClass: "mdi mdi-menu",
|
|
508
|
+
iconClearAllFiltersCommand: "mdi mdi-filter-remove-outline",
|
|
509
|
+
iconClearAllSortingCommand: "mdi mdi-sort-variant-off",
|
|
510
|
+
iconClearFrozenColumnsCommand: "mdi mdi-close",
|
|
511
|
+
iconExportCsvCommand: "mdi mdi-download",
|
|
512
|
+
iconExportExcelCommand: "mdi mdi-file-excel-outline",
|
|
513
|
+
iconExportTextDelimitedCommand: "mdi mdi-download",
|
|
514
|
+
iconRefreshDatasetCommand: "mdi mdi-sync",
|
|
515
|
+
iconToggleDarkModeCommand: "mdi mdi-brightness-4 mdi mdi-brightness-4",
|
|
516
|
+
iconToggleFilterCommand: "mdi mdi-flip-vertical",
|
|
517
|
+
iconTogglePreHeaderCommand: "mdi mdi-flip-vertical",
|
|
518
|
+
menuWidth: 16,
|
|
519
|
+
resizeOnShowHeaderRow: !0,
|
|
520
|
+
headerColumnValueExtractor: At
|
|
521
|
+
},
|
|
522
|
+
headerMenu: {
|
|
523
|
+
autoAlign: !0,
|
|
524
|
+
autoAlignOffset: 12,
|
|
525
|
+
minWidth: 140,
|
|
526
|
+
iconClearFilterCommand: "mdi mdi-filter-remove-outline",
|
|
527
|
+
iconClearSortCommand: "mdi mdi-sort-variant-off",
|
|
528
|
+
iconFreezeColumns: "mdi mdi-pin-outline",
|
|
529
|
+
iconSortAscCommand: "mdi mdi-sort-ascending",
|
|
530
|
+
iconSortDescCommand: "mdi mdi-sort-descending",
|
|
531
|
+
iconColumnHideCommand: "mdi mdi-close",
|
|
532
|
+
iconColumnResizeByContentCommand: "mdi mdi-arrow-expand-horizontal",
|
|
533
|
+
hideColumnResizeByContentCommand: !1,
|
|
534
|
+
hideColumnHideCommand: !1,
|
|
535
|
+
hideClearFilterCommand: !1,
|
|
536
|
+
hideClearSortCommand: !1,
|
|
537
|
+
hideFreezeColumnsCommand: !0,
|
|
538
|
+
// opt-in command
|
|
539
|
+
hideSortCommands: !1
|
|
540
|
+
},
|
|
541
|
+
multiColumnSort: !0,
|
|
542
|
+
numberedMultiColumnSort: !0,
|
|
543
|
+
tristateMultiColumnSort: !1,
|
|
544
|
+
sortColNumberInSeparateSpan: !0,
|
|
545
|
+
suppressActiveCellChangeOnEdit: !1,
|
|
546
|
+
pagination: {
|
|
547
|
+
pageSizes: [10, 15, 20, 25, 30, 40, 50, 75, 100],
|
|
548
|
+
pageSize: 25,
|
|
549
|
+
totalItems: 0
|
|
550
|
+
},
|
|
551
|
+
rowDetailView: {
|
|
552
|
+
collapseAllOnSort: !0,
|
|
553
|
+
cssClass: "detail-view-toggle",
|
|
554
|
+
panelRows: 1,
|
|
555
|
+
keyPrefix: "__",
|
|
556
|
+
useRowClick: !1,
|
|
557
|
+
useSimpleViewportCalc: !0,
|
|
558
|
+
saveDetailViewOnScroll: !1
|
|
559
|
+
},
|
|
560
|
+
headerRowHeight: 35,
|
|
561
|
+
rowHeight: 35,
|
|
562
|
+
topPanelHeight: 30,
|
|
563
|
+
preHeaderPanelWidth: "100%",
|
|
564
|
+
// mostly useful for Draggable Grouping dropzone to take full width
|
|
565
|
+
translationNamespaceSeparator: ":",
|
|
566
|
+
resetFilterSearchValueAfterOnBeforeCancellation: !0,
|
|
567
|
+
resizeByContentOnlyOnFirstLoad: !0,
|
|
568
|
+
resizeByContentOptions: {
|
|
569
|
+
alwaysRecalculateColumnWidth: !1,
|
|
570
|
+
cellCharWidthInPx: 7.8,
|
|
571
|
+
cellPaddingWidthInPx: 14,
|
|
572
|
+
defaultRatioForStringType: 0.88,
|
|
573
|
+
formatterPaddingWidthInPx: 0,
|
|
574
|
+
maxItemToInspectCellContentWidth: 1e3,
|
|
575
|
+
maxItemToInspectSingleColumnWidthByContent: 5e3,
|
|
576
|
+
widthToRemoveFromExceededWidthReadjustment: 50
|
|
577
|
+
},
|
|
578
|
+
treeDataOptions: {
|
|
579
|
+
exportIndentMarginLeft: 5,
|
|
580
|
+
exportIndentationLeadingChar: "͏͏͏͏͏͏͏͏͏·"
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
function At(c, a) {
|
|
584
|
+
let o = (c == null ? void 0 : c.columnPickerLabel) ?? (c == null ? void 0 : c.name) ?? "";
|
|
585
|
+
(o instanceof HTMLElement || o instanceof DocumentFragment) && (o = o.textContent || "");
|
|
586
|
+
const l = (c == null ? void 0 : c.columnGroup) || "", f = (a == null ? void 0 : a.columnGroupSeparator) ?? " - ";
|
|
587
|
+
return l ? l + f + o : o;
|
|
588
|
+
}
|
|
589
|
+
class Ln {
|
|
590
|
+
constructor() {
|
|
591
|
+
W(this, "container", {});
|
|
592
|
+
}
|
|
593
|
+
get(a) {
|
|
594
|
+
return this.container[a];
|
|
595
|
+
}
|
|
596
|
+
registerInstance(a, o) {
|
|
597
|
+
this.container[a] = o;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
class zn {
|
|
601
|
+
constructor() {
|
|
602
|
+
W(this, "i18n");
|
|
603
|
+
this.i18n = Rt().i18next;
|
|
604
|
+
}
|
|
605
|
+
/**
|
|
606
|
+
* Method to return the current language used by the App
|
|
607
|
+
* @return {string} current language
|
|
608
|
+
*/
|
|
609
|
+
getCurrentLanguage() {
|
|
610
|
+
return this.i18n.language;
|
|
611
|
+
}
|
|
612
|
+
/**
|
|
613
|
+
* Method to set the language to use in the App and Translate Service
|
|
614
|
+
* @param {string} language
|
|
615
|
+
* @return {Promise} output
|
|
616
|
+
*/
|
|
617
|
+
async use(a) {
|
|
618
|
+
return this.i18n.changeLanguage(a);
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* Method which receives a translation key and returns the translated value assigned to that key
|
|
622
|
+
* @param {string} translation key
|
|
623
|
+
* @return {string} translated value
|
|
624
|
+
*/
|
|
625
|
+
translate(a) {
|
|
626
|
+
return this.i18n.t(a);
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
function Hn(c) {
|
|
630
|
+
if (Array.isArray(c))
|
|
631
|
+
for (; c.length > 0; ) {
|
|
632
|
+
const a = c.pop();
|
|
633
|
+
a != null && a.unsubscribe && a.unsubscribe();
|
|
634
|
+
}
|
|
635
|
+
return c;
|
|
636
|
+
}
|
|
637
|
+
const Nn = ["id"], Wn = ["id"], Kn = 1e4, ni = /* @__PURE__ */ Dn({
|
|
638
|
+
__name: "SlickgridVue",
|
|
639
|
+
props: /* @__PURE__ */ In({
|
|
640
|
+
header: {},
|
|
641
|
+
footer: {},
|
|
642
|
+
extensions: {},
|
|
643
|
+
gridId: { default: "myGrid" },
|
|
644
|
+
instances: {},
|
|
645
|
+
onOnActiveCellChanged: {},
|
|
646
|
+
onOnActiveCellPositionChanged: {},
|
|
647
|
+
onOnAddNewRow: {},
|
|
648
|
+
onOnAutosizeColumns: {},
|
|
649
|
+
onOnBeforeAppendCell: {},
|
|
650
|
+
onOnBeforeSearchChange: {},
|
|
651
|
+
onOnBeforeCellEditorDestroy: {},
|
|
652
|
+
onOnBeforeColumnsResize: {},
|
|
653
|
+
onOnBeforeDestroy: {},
|
|
654
|
+
onOnBeforeEditCell: {},
|
|
655
|
+
onOnBeforeHeaderCellDestroy: {},
|
|
656
|
+
onOnBeforeHeaderRowCellDestroy: {},
|
|
657
|
+
onOnBeforeFooterRowCellDestroy: {},
|
|
658
|
+
onOnBeforeSetColumns: {},
|
|
659
|
+
onOnBeforeSort: {},
|
|
660
|
+
onOnCellChange: {},
|
|
661
|
+
onOnCellCssStylesChanged: {},
|
|
662
|
+
onOnClick: {},
|
|
663
|
+
onOnColumnsDrag: {},
|
|
664
|
+
onOnColumnsReordered: {},
|
|
665
|
+
onOnColumnsResized: {},
|
|
666
|
+
onOnColumnsResizeDblClick: {},
|
|
667
|
+
onOnCompositeEditorChange: {},
|
|
668
|
+
onOnContextMenu: {},
|
|
669
|
+
onOnDrag: {},
|
|
670
|
+
onOnDragEnd: {},
|
|
671
|
+
onOnDragInit: {},
|
|
672
|
+
onOnDragStart: {},
|
|
673
|
+
onOnDblClick: {},
|
|
674
|
+
onOnFooterContextMenu: {},
|
|
675
|
+
onOnFooterRowCellRendered: {},
|
|
676
|
+
onOnHeaderCellRendered: {},
|
|
677
|
+
onOnFooterClick: {},
|
|
678
|
+
onOnHeaderClick: {},
|
|
679
|
+
onOnHeaderContextMenu: {},
|
|
680
|
+
onOnHeaderMouseEnter: {},
|
|
681
|
+
onOnHeaderMouseLeave: {},
|
|
682
|
+
onOnHeaderRowCellRendered: {},
|
|
683
|
+
onOnHeaderRowMouseEnter: {},
|
|
684
|
+
onOnHeaderRowMouseLeave: {},
|
|
685
|
+
onOnKeyDown: {},
|
|
686
|
+
onOnMouseEnter: {},
|
|
687
|
+
onOnMouseLeave: {},
|
|
688
|
+
onOnValidationError: {},
|
|
689
|
+
onOnViewportChanged: {},
|
|
690
|
+
onOnRendered: {},
|
|
691
|
+
onOnSelectedRowsChanged: {},
|
|
692
|
+
onOnSetOptions: {},
|
|
693
|
+
onOnScroll: {},
|
|
694
|
+
onOnSort: {},
|
|
695
|
+
onOnBeforePagingInfoChanged: {},
|
|
696
|
+
onOnGroupExpanded: {},
|
|
697
|
+
onOnGroupCollapsed: {},
|
|
698
|
+
onOnPagingInfoChanged: {},
|
|
699
|
+
onOnRowCountChanged: {},
|
|
700
|
+
onOnRowsChanged: {},
|
|
701
|
+
onOnRowsOrCountChanged: {},
|
|
702
|
+
onOnSetItemsCalled: {},
|
|
703
|
+
onOnAfterExportToExcel: {},
|
|
704
|
+
onOnBeforePaginationChange: {},
|
|
705
|
+
onOnBeforeExportToExcel: {},
|
|
706
|
+
onOnBeforeFilterChange: {},
|
|
707
|
+
onOnBeforeFilterClear: {},
|
|
708
|
+
onOnBeforeSortChange: {},
|
|
709
|
+
onOnBeforeToggleTreeCollapse: {},
|
|
710
|
+
onOnFilterChanged: {},
|
|
711
|
+
onOnFilterCleared: {},
|
|
712
|
+
onOnItemDeleted: {},
|
|
713
|
+
onOnGridStateChanged: {},
|
|
714
|
+
onOnPaginationChanged: {},
|
|
715
|
+
onOnReactGridCreated: {},
|
|
716
|
+
onOnSelectedRowIdsChanged: {},
|
|
717
|
+
onOnSortChanged: {},
|
|
718
|
+
onOnToggleTreeCollapsed: {},
|
|
719
|
+
onOnTreeItemToggled: {},
|
|
720
|
+
onOnTreeFullToggleEnd: {},
|
|
721
|
+
onOnTreeFullToggleStart: {},
|
|
722
|
+
onVueGridCreated: {}
|
|
723
|
+
}, {
|
|
724
|
+
options: { required: !0 },
|
|
725
|
+
optionsModifiers: {},
|
|
726
|
+
pagination: {},
|
|
727
|
+
paginationModifiers: {},
|
|
728
|
+
columns: { required: !0, default: [] },
|
|
729
|
+
columnsModifiers: {},
|
|
730
|
+
data: { required: !1 },
|
|
731
|
+
dataModifiers: {},
|
|
732
|
+
hierarchical: { required: !1 },
|
|
733
|
+
hierarchicalModifiers: {}
|
|
734
|
+
}),
|
|
735
|
+
emits: ["update:options", "update:pagination", "update:columns", "update:data", "update:hierarchical"],
|
|
736
|
+
setup(c) {
|
|
737
|
+
var $e;
|
|
738
|
+
const { i18next: a } = Rt(), o = Pn(), l = c, f = J(), h = J(), S = J(null), n = J({}), P = J(0), M = vt(() => `slickGridContainer-${l.gridId}`), F = vt(() => {
|
|
739
|
+
var e, t;
|
|
740
|
+
return (t = (e = Fe.value) == null ? void 0 : e.backendServiceApi) == null ? void 0 : t.service;
|
|
741
|
+
});
|
|
742
|
+
let C = 0, u = null, s, oe, ae = !1, re = !1, be = !1, ve = !1, ye = !1, X = !1, Q = !0, Te, b = [], Ee = !1, se = !1, Z = [], K, q, B, le, j, _;
|
|
743
|
+
const xt = new ln(), H = new dn(), v = new pt();
|
|
744
|
+
v.eventNamingStyle = Pe.camelCaseWithExtraOnPrefix;
|
|
745
|
+
const E = new Ln(), U = new zn(), O = new un(), ee = new cn(), m = new fn(), Ae = new mn(U), Re = new hn(m, O, U), _e = new pn(xt, U, Ae), A = new vn(_e, v, m, O), V = new Cn(v), D = new gn(Ae, m, v, O), N = new dt(v, m, D), T = new Sn(v, m, O), I = new wn(
|
|
746
|
+
Re,
|
|
747
|
+
A,
|
|
748
|
+
v,
|
|
749
|
+
m,
|
|
750
|
+
D,
|
|
751
|
+
N,
|
|
752
|
+
U,
|
|
753
|
+
() => de
|
|
754
|
+
), G = new ut(
|
|
755
|
+
I,
|
|
756
|
+
A,
|
|
757
|
+
v,
|
|
758
|
+
m,
|
|
759
|
+
D,
|
|
760
|
+
N
|
|
761
|
+
), de = new ct(
|
|
762
|
+
G,
|
|
763
|
+
A,
|
|
764
|
+
v,
|
|
765
|
+
T,
|
|
766
|
+
m,
|
|
767
|
+
D,
|
|
768
|
+
N
|
|
769
|
+
), te = new ft(Re);
|
|
770
|
+
let ke = [
|
|
771
|
+
I,
|
|
772
|
+
A,
|
|
773
|
+
ee,
|
|
774
|
+
de,
|
|
775
|
+
G,
|
|
776
|
+
te,
|
|
777
|
+
T,
|
|
778
|
+
V,
|
|
779
|
+
D,
|
|
780
|
+
N
|
|
781
|
+
];
|
|
782
|
+
E.registerInstance("PubSubService", v), E.registerInstance("EventPubSubService", v), E.registerInstance("ExtensionUtility", Re), E.registerInstance("FilterService", A), E.registerInstance("CollectionService", Ae), E.registerInstance("ExtensionService", I), E.registerInstance("GridEventService", ee), E.registerInstance("GridService", de), E.registerInstance("GridStateService", G), E.registerInstance("HeaderGroupingService", te), E.registerInstance("PaginationService", T), E.registerInstance("ResizerService", V), E.registerInstance("SharedService", m), E.registerInstance("SortService", D), E.registerInstance("TranslaterService", U), E.registerInstance("TreeDataService", N);
|
|
783
|
+
const Fe = pe(c, "options");
|
|
784
|
+
n.value = { ...Et, ...Fe.value };
|
|
785
|
+
const k = J(), Dt = pe(c, "pagination");
|
|
786
|
+
ge(Dt, (e) => zt(e));
|
|
787
|
+
const y = J(), Y = pe(c, "columns");
|
|
788
|
+
ge(Y, (e) => It(e), { immediate: !0 });
|
|
789
|
+
const $ = pe(c, "data");
|
|
790
|
+
ge(
|
|
791
|
+
$,
|
|
792
|
+
(e) => {
|
|
793
|
+
var p, g, w;
|
|
794
|
+
const t = C, i = we(e, $.value || []);
|
|
795
|
+
let d = !!((p = n.value) != null && p.enableDeepCopyDatasetOnPageLoad) ? St(!0, [], e) : e;
|
|
796
|
+
s && ((g = n.value) != null && g.enableTreeData) && Array.isArray(e) && (e.length > 0 || e.length !== t || !i) && (ye = !1, d = Ke(e, !i)), Ve(d || []), C = (e || []).length, s && ((w = n.value) != null && w.autoFitColumnsOnFirstLoad) && t === 0 && !re && (s.autosizeColumns(), re = !0);
|
|
797
|
+
},
|
|
798
|
+
{ immediate: !0 }
|
|
799
|
+
);
|
|
800
|
+
const ne = pe(c, "hierarchical");
|
|
801
|
+
ge(
|
|
802
|
+
ne,
|
|
803
|
+
(e) => {
|
|
804
|
+
var r;
|
|
805
|
+
const t = we(e, (m == null ? void 0 : m.hierarchicalDataset) ?? []), i = C;
|
|
806
|
+
m && (m.hierarchicalDataset = e), e && y.value && (A != null && A.clearFilters) && A.clearFilters(), u && e && s && (D != null && D.processTreeDataInitialSort) && (u.setItems([], ((r = n.value) == null ? void 0 : r.datasetIdPropertyName) ?? "id"), D.processTreeDataInitialSort(), queueMicrotask(() => {
|
|
807
|
+
const d = (u == null ? void 0 : u.getItemCount()) || 0;
|
|
808
|
+
d > 0 && (d !== i || !t) && A.refreshTreeDataFilters();
|
|
809
|
+
}), ye = !0);
|
|
810
|
+
},
|
|
811
|
+
{ immediate: !0 }
|
|
812
|
+
), ae = (($e = n.value) == null ? void 0 : $e.showHeaderRow) === !1, On(() => {
|
|
813
|
+
Be();
|
|
814
|
+
}), Tn(() => {
|
|
815
|
+
var e, t;
|
|
816
|
+
if (!n.value || !Y.value)
|
|
817
|
+
throw new Error(
|
|
818
|
+
"Using `<Slickgrid-Vue>` requires `v-model:options` and `v-model:columns` props, it seems that you might have forgot to provide them since at least of them is undefined."
|
|
819
|
+
);
|
|
820
|
+
if (f.value && v instanceof pt) {
|
|
821
|
+
v.elementSource = f.value;
|
|
822
|
+
for (const i in { ...o, ...l })
|
|
823
|
+
if (i.startsWith("onOn")) {
|
|
824
|
+
const r = o[i] || l[i];
|
|
825
|
+
if (typeof r == "function") {
|
|
826
|
+
const d = i.replace(/^onOn/, "on");
|
|
827
|
+
Z.push(
|
|
828
|
+
v.subscribe(d, (p) => {
|
|
829
|
+
const g = v.getEventNameByNamingConvention(d, "");
|
|
830
|
+
typeof r == "function" && r.call(null, new CustomEvent(g, { detail: p }));
|
|
831
|
+
})
|
|
832
|
+
);
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
if (Pt(), be = !0, ue() || (n.value.enablePagination = !!(n.value.backendServiceApi && n.value.enablePagination === void 0 || n.value.enablePagination)), !X && !ne.value && ((e = n.value) != null && e.enablePagination) && Q && (se = !0, He($.value)), (t = n.value) != null && t.enableEmptyDataWarningMessage) {
|
|
837
|
+
const i = $.value || [];
|
|
838
|
+
if (Array.isArray(i)) {
|
|
839
|
+
const r = i.length;
|
|
840
|
+
xe(r < 1);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
n.value.darkMode && Ge(!0), ne.value && (m.hierarchicalDataset = ne.value || []), Xt();
|
|
844
|
+
});
|
|
845
|
+
function It(e) {
|
|
846
|
+
e && (y.value = e), be && Nt(y.value), y.value.length > 0 && Wt(y.value);
|
|
847
|
+
}
|
|
848
|
+
function Pt() {
|
|
849
|
+
var p, g, w, R, x, L, ce, fe, me, he, z, qe, je, Ye, Je, Xe, Qe, Ze, et, tt, nt, it, ot;
|
|
850
|
+
if (!n.value || !Y.value)
|
|
851
|
+
throw new Error(
|
|
852
|
+
'Using `<Slickgrid-Vue>` requires `v-model:columns="columnDefinitions"` and `v-model:options="gridOptions.value"`, it seems that you might have forgot to provide them since at least of them is undefined.'
|
|
853
|
+
);
|
|
854
|
+
n.value.translater = U, re = !1, n.value && (n.value.frozenRow !== void 0 && n.value.frozenRow >= 0 || n.value.frozenColumn !== void 0 && n.value.frozenColumn >= 0) && n.value.enableMouseWheelScrollHandler === void 0 && (n.value.enableMouseWheelScrollHandler = !0), v.eventNamingStyle = ((p = n.value) == null ? void 0 : p.eventNamingStyle) ?? Pe.camelCaseWithExtraOnPrefix, v.publish("onBeforeGridCreate", !0), C = ((g = $.value) == null ? void 0 : g.length) || 0, n.value = $t(n.value), k.value = (w = n.value) == null ? void 0 : w.pagination, j = (R = n.value) == null ? void 0 : R.backendServiceApi, Q = !j, (x = n.value) != null && x.backendServiceApi && !((L = n.value.backendServiceApi) != null && L.disableInternalPostProcess) && kt(n.value);
|
|
855
|
+
let t = { inlineFilters: ((ce = n.value) == null ? void 0 : ce.dataView) && n.value.dataView.inlineFilters || !1 };
|
|
856
|
+
((fe = n.value) != null && fe.draggableGrouping || (me = n.value) != null && me.enableGrouping) && (oe = new bn(), m.groupItemMetadataProvider = oe, t = { ...t, groupItemMetadataProvider: oe }), u = new yn(t, v), v.publish("onDataviewCreated", u), jt(), y.value = Ue(Y.value || []), (he = n.value) != null && he.autoAddCustomEditorFormatter && mt(y.value, (z = n.value) == null ? void 0 : z.autoAddCustomEditorFormatter), m.allColumns = y.value, m.visibleColumns = y.value, I.createExtensionsBeforeGridCreation(y.value, n.value), (je = (qe = n.value) == null ? void 0 : qe.presets) != null && je.pinning && (n.value = { ...n.value, ...n.value.presets.pinning }), s = new En(
|
|
857
|
+
`#${l.gridId}`,
|
|
858
|
+
u,
|
|
859
|
+
y.value,
|
|
860
|
+
n.value,
|
|
861
|
+
v
|
|
862
|
+
), m.dataView = u, m.slickGrid = s, m.gridContainerElement = f.value, oe && s.registerPlugin(oe), I.bindDifferentExtensions(), Ft(s, n.value, u);
|
|
863
|
+
const i = ((Ye = n.value) == null ? void 0 : Ye.frozenColumn) ?? -1;
|
|
864
|
+
i >= 0 && i <= y.value.length && y.value.length > 0 && (m.frozenVisibleColumnId = ((Je = y.value[i]) == null ? void 0 : Je.id) ?? ""), Yt(), s.init();
|
|
865
|
+
const r = f.value;
|
|
866
|
+
if (r && V.init(s, r), !((Xe = n.value) != null && Xe.enablePagination) && ((Qe = n.value) != null && Qe.showCustomFooter) && ((Ze = n.value) != null && Ze.customFooterOptions) && r && (q = new Vn(s, (et = n.value) == null ? void 0 : et.customFooterOptions, v, U), q.renderFooter(r)), u) {
|
|
867
|
+
const at = (tt = n.value) != null && tt.enableTreeData ? Ke($.value || []) : $.value;
|
|
868
|
+
if (Array.isArray(at) && u.setItems(at, n.value.datasetIdPropertyName ?? "id"), s != null && s.getSelectionModel() && ((nt = n.value) != null && nt.dataView) && "syncGridSelection" in n.value.dataView) {
|
|
869
|
+
let rt = !1;
|
|
870
|
+
n.value.backendServiceApi && "syncGridSelectionWithBackendService" in n.value.dataView && (rt = n.value.dataView.syncGridSelectionWithBackendService);
|
|
871
|
+
const ie = n.value.dataView.syncGridSelection;
|
|
872
|
+
if (typeof ie == "boolean") {
|
|
873
|
+
let st = ie;
|
|
874
|
+
Q || (st = ie && rt), u.syncGridSelection(s, st);
|
|
875
|
+
} else typeof ie == "object" && u.syncGridSelection(s, ie.preserveHidden, ie.preserveHiddenOnSelectionChange);
|
|
876
|
+
}
|
|
877
|
+
(it = $.value) != null && it.length && (!ve && (n.value.enableCheckboxSelector || n.value.enableRowSelection) && Ne(), Ie(), ve = !0);
|
|
878
|
+
}
|
|
879
|
+
ae && (Ht(!1), m.hideHeaderRowAfterPageLoad = ae), v.publish("onGridCreated", s), Gt(s, n.value), Mt(s, n.value), (ot = n.value) != null && ot.backendServiceApi && Bt(n.value);
|
|
880
|
+
const d = {
|
|
881
|
+
element: f.value,
|
|
882
|
+
// Slick Grid & DataView objects
|
|
883
|
+
dataView: u,
|
|
884
|
+
slickGrid: s,
|
|
885
|
+
// public methods
|
|
886
|
+
dispose: Ot,
|
|
887
|
+
// return all available Services (non-singleton)
|
|
888
|
+
backendService: F.value,
|
|
889
|
+
eventPubSubService: v,
|
|
890
|
+
filterService: A,
|
|
891
|
+
gridEventService: ee,
|
|
892
|
+
gridStateService: G,
|
|
893
|
+
gridService: de,
|
|
894
|
+
groupingService: te,
|
|
895
|
+
headerGroupingService: te,
|
|
896
|
+
extensionService: I,
|
|
897
|
+
paginationComponent: B,
|
|
898
|
+
paginationService: T,
|
|
899
|
+
resizerService: V,
|
|
900
|
+
sortService: D,
|
|
901
|
+
treeDataService: N
|
|
902
|
+
};
|
|
903
|
+
h.value = I == null ? void 0 : I.extensionList, S.value = d, v.publish("onVueGridCreated", d);
|
|
904
|
+
}
|
|
905
|
+
function Be(e = !1) {
|
|
906
|
+
var t, i;
|
|
907
|
+
if (v.publish("onBeforeGridDestroy", s), H == null || H.unsubscribeAll(), a.off("languageChanged"), e && _t(), v.publish("onAfterGridDestroyed", !0), ke.forEach((r) => {
|
|
908
|
+
r != null && r.dispose && r.dispose();
|
|
909
|
+
}), ke = [], (i = (t = F.value) == null ? void 0 : t.dispose) == null || i.call(t), Tt(), K == null || K.dispose(), q == null || q.dispose(), B == null || B.dispose(), u && (u.setItems && u.setItems([]), u.destroy && u.destroy()), s != null && s.destroy && s.destroy(e), Z = Hn(Z), j) {
|
|
910
|
+
for (const r of Object.keys(j))
|
|
911
|
+
j[r] = null;
|
|
912
|
+
j = void 0;
|
|
913
|
+
}
|
|
914
|
+
for (const r of Object.keys(Y.value))
|
|
915
|
+
Y.value[r] = null;
|
|
916
|
+
for (const r of Object.keys(m))
|
|
917
|
+
m[r] = null;
|
|
918
|
+
}
|
|
919
|
+
function Ot(e = !1) {
|
|
920
|
+
Be(e);
|
|
921
|
+
}
|
|
922
|
+
function Tt() {
|
|
923
|
+
if (Array.isArray(b))
|
|
924
|
+
for (; b.length > 0; ) {
|
|
925
|
+
const e = b.pop();
|
|
926
|
+
e != null && e.dispose && e.dispose();
|
|
927
|
+
}
|
|
928
|
+
b = [];
|
|
929
|
+
}
|
|
930
|
+
function _t() {
|
|
931
|
+
var i;
|
|
932
|
+
const e = ((i = n.value) == null ? void 0 : i.gridContainerId) ?? "grid1", t = document.querySelector(`#${e}`);
|
|
933
|
+
An(t);
|
|
934
|
+
}
|
|
935
|
+
function kt(e) {
|
|
936
|
+
const t = e == null ? void 0 : e.backendServiceApi;
|
|
937
|
+
if (t != null && t.service) {
|
|
938
|
+
const i = t.service;
|
|
939
|
+
typeof i.getDatasetName == "function" && (t.internalPostProcess = (r) => {
|
|
940
|
+
const d = t && i && typeof i.getDatasetName == "function" ? i.getDatasetName() : "";
|
|
941
|
+
if (r != null && r.data[d]) {
|
|
942
|
+
const p = "nodes" in r.data[d] ? r.data[d].nodes : r.data[d], g = "totalCount" in r.data[d] ? r.data[d].totalCount : r.data[d].length;
|
|
943
|
+
Ve(p, g || 0);
|
|
944
|
+
}
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
function Ft(e, t, i) {
|
|
949
|
+
var r;
|
|
950
|
+
if (t.enableTranslate && I.translateAllExtensions(), a.on("languageChanged", (d) => {
|
|
951
|
+
v.publish("onLanguageChange"), t.enableTranslate && (I.translateAllExtensions(d), (t.createPreHeaderPanel && t.createTopHeaderPanel || t.createPreHeaderPanel && !t.enableDraggableGrouping) && te.translateHeaderGrouping());
|
|
952
|
+
}), t.backendServiceApi) {
|
|
953
|
+
const d = t.backendServiceApi;
|
|
954
|
+
(r = d == null ? void 0 : d.service) != null && r.init && d.service.init(d.options, t.pagination, e, m);
|
|
955
|
+
}
|
|
956
|
+
i && e && (ee.bindOnBeforeEditCell(e), ee.bindOnCellChange(e), ee.bindOnClick(e), i && e && (t.enableSorting && (t.backendServiceApi && !t.backendServiceApi.useLocalSorting ? D.bindBackendOnSort(e) : D.bindLocalOnSort(e)), t.enableFiltering && (A.init(e), t.backendServiceApi && !t.backendServiceApi.useLocalFiltering ? A.bindBackendOnFilter(e) : A.bindLocalOnFilter(e)), H.subscribe(e.onColumnsReordered, (d, p) => {
|
|
957
|
+
m.hasColumnsReordered = !0, m.visibleColumns = p.impactedColumns;
|
|
958
|
+
}), H.subscribe(e.onSetOptions, (d, p) => {
|
|
959
|
+
p.optionsBefore.darkMode !== p.optionsAfter.darkMode && m.gridContainerElement && Ge(p.optionsAfter.darkMode);
|
|
960
|
+
}), Ut(), Ie(), H.subscribe(i.onRowCountChanged, () => {
|
|
961
|
+
e.invalidate(), Le(i.getFilteredItemCount() || 0, i.getItemCount() || 0);
|
|
962
|
+
}), H.subscribe(i.onSetItemsCalled, (d, p) => {
|
|
963
|
+
m.isItemsDateParsed = !1, Le(i.getFilteredItemCount() || 0, p.itemCount), p.itemCount > 0 && (t.autosizeColumnsByCellContentOnFirstLoad || t.enableAutoResizeColumnsByCellContent) && V.resizeColumnsByCellContent(!(t != null && t.resizeByContentOnlyOnFirstLoad));
|
|
964
|
+
}), t != null && t.enableFiltering && !t.enableRowDetailView && H.subscribe(i.onRowsChanged, (d, { calledOnRowCountChanged: p, rows: g }) => {
|
|
965
|
+
if (!p && Array.isArray(g)) {
|
|
966
|
+
const w = e.getRenderedRange();
|
|
967
|
+
g.filter((R) => R >= w.top && R <= w.bottom).forEach((R) => e.updateRow(R)), e.render();
|
|
968
|
+
}
|
|
969
|
+
}))), t != null && t.colspanCallback && (i != null && i.getItem) && (i != null && i.getItemMetadata) && (i.getItemMetadata = (d) => {
|
|
970
|
+
let p = null;
|
|
971
|
+
return t.colspanCallback && (p = t.colspanCallback(i.getItem(d))), p;
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
function Bt(e) {
|
|
975
|
+
var p, g, w, R;
|
|
976
|
+
const t = e.backendServiceApi, i = t == null ? void 0 : t.service, r = (i == null ? void 0 : i.options) || {}, d = r ? r && "executeProcessCommandOnInit" in r ? r.executeProcessCommandOnInit : !0 : !1;
|
|
977
|
+
if (i) {
|
|
978
|
+
if (e != null && e.presets) {
|
|
979
|
+
if (i.updateFilters && Array.isArray(e.presets.filters) && e.presets.filters.length > 0 && i.updateFilters(e.presets.filters, !0), i.updateSorters && Array.isArray(e.presets.sorters) && e.presets.sorters.length > 0) {
|
|
980
|
+
const x = (p = n.value) != null && p.multiColumnSort ? e.presets.sorters : e.presets.sorters.slice(0, 1);
|
|
981
|
+
i.updateSorters(void 0, x);
|
|
982
|
+
}
|
|
983
|
+
if (i.updatePagination && e.presets.pagination && !ue()) {
|
|
984
|
+
const { pageNumber: x, pageSize: L } = e.presets.pagination;
|
|
985
|
+
i.updatePagination(x, L);
|
|
986
|
+
}
|
|
987
|
+
} else {
|
|
988
|
+
const x = A.getColumnFilters();
|
|
989
|
+
x && i.updateFilters && i.updateFilters(x, !1);
|
|
990
|
+
}
|
|
991
|
+
if (t && i && (t.onInit || d)) {
|
|
992
|
+
const x = typeof i.buildQuery == "function" ? i.buildQuery() : "", L = d ? ((g = t.process) == null ? void 0 : g.call(t, x)) ?? null : ((w = t.onInit) == null ? void 0 : w.call(t, x)) ?? null;
|
|
993
|
+
queueMicrotask(() => {
|
|
994
|
+
var me, he;
|
|
995
|
+
const ce = /* @__PURE__ */ new Date();
|
|
996
|
+
t.preProcess && t.preProcess();
|
|
997
|
+
const fe = ((he = (me = n.value) == null ? void 0 : me.pagination) == null ? void 0 : he.totalItems) ?? 0;
|
|
998
|
+
L instanceof Promise ? L.then(
|
|
999
|
+
(z) => O.executeBackendProcessesCallback(ce, z, t, fe)
|
|
1000
|
+
).catch((z) => O.onBackendError(z, t)) : L && (_ != null && _.isObservable(L)) && Z.push(
|
|
1001
|
+
L.subscribe(
|
|
1002
|
+
(z) => O.executeBackendProcessesCallback(ce, z, t, fe),
|
|
1003
|
+
(z) => O.onBackendError(z, t)
|
|
1004
|
+
)
|
|
1005
|
+
);
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
(R = t.service.options) != null && R.infiniteScroll && Vt();
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
function Vt() {
|
|
1012
|
+
var e;
|
|
1013
|
+
if (s && n.value.backendServiceApi && ue() && !((e = n.value.backendServiceApi) != null && e.onScrollEnd)) {
|
|
1014
|
+
const t = () => {
|
|
1015
|
+
O.setInfiniteScrollBottomHit(!0), T.goToNextPage().then((r) => {
|
|
1016
|
+
r || O.setInfiniteScrollBottomHit(!1);
|
|
1017
|
+
});
|
|
1018
|
+
};
|
|
1019
|
+
n.value.backendServiceApi.onScrollEnd = t, H.subscribe(s.onScroll, (r, d) => {
|
|
1020
|
+
const p = d.grid.getViewportNode();
|
|
1021
|
+
["mousewheel", "scroll"].includes(d.triggeredBy || "") && (T != null && T.totalItems) && d.scrollTop > 0 && Math.ceil(p.offsetHeight + d.scrollTop) >= d.scrollHeight && (Ee || (t(), Ee = !0));
|
|
1022
|
+
});
|
|
1023
|
+
const i = n.value.backendServiceApi.postProcess;
|
|
1024
|
+
n.value.backendServiceApi.postProcess = (r) => {
|
|
1025
|
+
Ee = !1, i && i(r);
|
|
1026
|
+
};
|
|
1027
|
+
}
|
|
1028
|
+
}
|
|
1029
|
+
function Mt(e, t) {
|
|
1030
|
+
if (t.autoFitColumnsOnFirstLoad && t.autosizeColumnsByCellContentOnFirstLoad || t.enableAutoSizeColumns && t.enableAutoResizeColumnsByCellContent)
|
|
1031
|
+
throw new Error(
|
|
1032
|
+
'[Slickgrid-Vue] You cannot enable both autosize/fit viewport & resize by content, you must choose which resize technique to use. You can enable these 2 options ("autoFitColumnsOnFirstLoad" and "enableAutoSizeColumns") OR these other 2 options ("autosizeColumnsByCellContentOnFirstLoad" and "enableAutoResizeColumnsByCellContent").'
|
|
1033
|
+
);
|
|
1034
|
+
t.gridHeight || t.gridWidth ? V.resizeGrid(0, { height: t.gridHeight, width: t.gridWidth }) : V.resizeGrid(), e && (t != null && t.enableAutoResize) && t.autoFitColumnsOnFirstLoad && t.enableAutoSizeColumns && !re && (e.autosizeColumns(), re = !0);
|
|
1035
|
+
}
|
|
1036
|
+
function Gt(e, t) {
|
|
1037
|
+
if (t.enableSorting && t.presets && Array.isArray(t.presets.sorters)) {
|
|
1038
|
+
const i = n.value.multiColumnSort ? t.presets.sorters : t.presets.sorters.slice(0, 1);
|
|
1039
|
+
D.loadGridSorters(i);
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1042
|
+
function Lt(e) {
|
|
1043
|
+
var d;
|
|
1044
|
+
const t = (G == null ? void 0 : G.needToPreserveRowSelection()) ?? !1;
|
|
1045
|
+
s && !t && ((d = n.value) != null && d.backendServiceApi) && (n.value.enableRowSelection || n.value.enableCheckboxSelector) && s.setSelectedRows([]);
|
|
1046
|
+
const { pageNumber: i, pageSize: r } = e;
|
|
1047
|
+
m && r !== void 0 && i !== void 0 && (m.currentPagination = { pageNumber: i, pageSize: r }), v.publish("onGridStateChanged", {
|
|
1048
|
+
change: { newValues: { pageNumber: i, pageSize: r }, type: xn.pagination },
|
|
1049
|
+
gridState: G.getCurrentGridState()
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
function zt(e) {
|
|
1053
|
+
e && k.value ? k.value = { ...k.value, ...e } : k.value = e, n.value && (n.value.pagination = k.value, T.updateTotalItems((e == null ? void 0 : e.totalItems) ?? 0, !0));
|
|
1054
|
+
}
|
|
1055
|
+
function Ve(e, t) {
|
|
1056
|
+
var i, r, d, p, g, w;
|
|
1057
|
+
if ((i = n.value) != null && i.enablePagination && Q && (se = !0, He(e)), (r = n.value) != null && r.enableEmptyDataWarningMessage && Array.isArray(e)) {
|
|
1058
|
+
const R = t || e.length;
|
|
1059
|
+
xe(R < 1);
|
|
1060
|
+
}
|
|
1061
|
+
if (Array.isArray(e) && s && (u != null && u.setItems)) {
|
|
1062
|
+
if (u.setItems(e, n.value.datasetIdPropertyName ?? "id"), !n.value.backendServiceApi && !n.value.enableTreeData && u.reSort(), e.length > 0 && (ve || (Ie(), n.value.enableCheckboxSelector && Ne()), ve = !0), e && s.invalidate(), se = !!(n.value && (n.value.enablePagination || n.value.backendServiceApi && n.value.enablePagination === void 0)), k.value && ((d = n.value) != null && d.pagination) && ((p = n.value) != null && p.backendServiceApi)) {
|
|
1063
|
+
const R = Me(
|
|
1064
|
+
n.value,
|
|
1065
|
+
k.value
|
|
1066
|
+
), x = t !== void 0 ? t : (w = (g = n.value) == null ? void 0 : g.pagination) == null ? void 0 : w.totalItems;
|
|
1067
|
+
x !== void 0 && x !== P.value && (P.value = +x), X ? T.updateTotalItems(P.value) : ze(R);
|
|
1068
|
+
}
|
|
1069
|
+
if (s && n.value.enableAutoResize) {
|
|
1070
|
+
const R = n.value.autoResize && n.value.autoResize.delay;
|
|
1071
|
+
V.resizeGrid(R || 10);
|
|
1072
|
+
}
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
function Ht(e = !0) {
|
|
1076
|
+
return s == null || s.setHeaderRowVisibility(e), e === !0 && be && (s == null || s.setColumns(Y.value)), e;
|
|
1077
|
+
}
|
|
1078
|
+
function Me(e, t) {
|
|
1079
|
+
var i;
|
|
1080
|
+
return (i = e.presets) != null && i.pagination && e.pagination && (ue() ? console.warn("[Slickgrid-Vue] `presets.pagination` is not supported with Infinite Scroll, reverting to first page.") : (t.pageSize = e.presets.pagination.pageSize, t.pageNumber = e.presets.pagination.pageNumber)), t;
|
|
1081
|
+
}
|
|
1082
|
+
function Ge(e = !1) {
|
|
1083
|
+
var t, i;
|
|
1084
|
+
e ? (t = m.gridContainerElement) == null || t.classList.add("slick-dark-mode") : (i = m.gridContainerElement) == null || i.classList.remove("slick-dark-mode");
|
|
1085
|
+
}
|
|
1086
|
+
function Nt(e) {
|
|
1087
|
+
var t, i;
|
|
1088
|
+
e && (e = Ue(e), n.value.autoAddCustomEditorFormatter && mt(e, n.value.autoAddCustomEditorFormatter), n.value.enableTranslate ? I.translateColumnHeaders(void 0, e) : I.renderColumnHeaders(e, !0), (t = n.value) != null && t.enableAutoSizeColumns ? s == null || s.autosizeColumns() : (i = n.value) != null && i.enableAutoResizeColumnsByCellContent && (V != null && V.resizeColumnsByCellContent) && V.resizeColumnsByCellContent());
|
|
1089
|
+
}
|
|
1090
|
+
function Wt(e) {
|
|
1091
|
+
e.forEach((t) => t.originalWidth = t.width);
|
|
1092
|
+
}
|
|
1093
|
+
function xe(e = !0) {
|
|
1094
|
+
K == null || K.showEmptyDataMessage(e);
|
|
1095
|
+
}
|
|
1096
|
+
function Le(e, t) {
|
|
1097
|
+
var i;
|
|
1098
|
+
C = t, Te = {
|
|
1099
|
+
startTime: /* @__PURE__ */ new Date(),
|
|
1100
|
+
endTime: /* @__PURE__ */ new Date(),
|
|
1101
|
+
itemCount: e,
|
|
1102
|
+
totalItemCount: t
|
|
1103
|
+
}, q && (q.metrics = Te), Q && ((i = n.value) != null && i.enableEmptyDataWarningMessage) && xe(e === 0);
|
|
1104
|
+
}
|
|
1105
|
+
function ze(e) {
|
|
1106
|
+
n.value && (T.totalItems = P.value, T.init(s, e, j), Z.push(
|
|
1107
|
+
v.subscribe("onPaginationChanged", (t) => Lt(t)),
|
|
1108
|
+
v.subscribe("onPaginationVisibilityChanged", (t) => {
|
|
1109
|
+
var i;
|
|
1110
|
+
se = (t == null ? void 0 : t.visible) ?? !1, (i = n.value) != null && i.backendServiceApi && (O == null || O.refreshBackendDataset(n.value)), We(se);
|
|
1111
|
+
})
|
|
1112
|
+
), We(), X = !0);
|
|
1113
|
+
}
|
|
1114
|
+
function Kt(e) {
|
|
1115
|
+
if (e != null && e.editor) {
|
|
1116
|
+
const t = e.editor.collectionAsync;
|
|
1117
|
+
e.editor.disabled = !0, t instanceof Promise ? t.then((i) => {
|
|
1118
|
+
Array.isArray(i) ? Ce(e, i) : i instanceof Response && typeof i.json == "function" ? i.bodyUsed ? console.warn(
|
|
1119
|
+
"[SlickGrid-Vue] The response body passed to collectionAsync was already read. Either pass the dataset from the Response or clone the response first using response.clone()"
|
|
1120
|
+
) : i.json().then((r) => Ce(e, r)) : i != null && i.content && Ce(e, i.content);
|
|
1121
|
+
}) : _ != null && _.isObservable(t) && queueMicrotask(() => {
|
|
1122
|
+
Z.push(
|
|
1123
|
+
t.subscribe((i) => Ce(e, i))
|
|
1124
|
+
);
|
|
1125
|
+
});
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
function De(e, t) {
|
|
1129
|
+
if (y.value) {
|
|
1130
|
+
const i = y.value.findIndex((r) => r.id === e);
|
|
1131
|
+
if (i >= 0) {
|
|
1132
|
+
const r = y.value[i];
|
|
1133
|
+
(r == null ? void 0 : r.id) === e && !t.some((d) => d.id === e) && (i > 0 ? t.splice(i, 0, r) : t.unshift(r));
|
|
1134
|
+
}
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
function Ut() {
|
|
1138
|
+
var e, t, i, r, d, p;
|
|
1139
|
+
if (n.value.presets && Array.isArray(n.value.presets.columns) && n.value.presets.columns.length > 0) {
|
|
1140
|
+
const g = G.getAssociatedGridColumns(s, n.value.presets.columns);
|
|
1141
|
+
if (g && Array.isArray(g) && g.length > 0 && Array.isArray(y.value)) {
|
|
1142
|
+
if (n.value.enableRowMoveManager) {
|
|
1143
|
+
const w = ((t = (e = n.value) == null ? void 0 : e.rowMoveManager) == null ? void 0 : t.columnId) ?? "_move";
|
|
1144
|
+
De(w, g);
|
|
1145
|
+
}
|
|
1146
|
+
if (n.value.enableCheckboxSelector) {
|
|
1147
|
+
const w = ((r = (i = n.value) == null ? void 0 : i.checkboxSelector) == null ? void 0 : r.columnId) ?? "_checkbox_selector";
|
|
1148
|
+
De(w, g);
|
|
1149
|
+
}
|
|
1150
|
+
if (n.value.enableRowDetailView) {
|
|
1151
|
+
const w = ((p = (d = n.value) == null ? void 0 : d.rowDetailView) == null ? void 0 : p.columnId) ?? "_detail_selector";
|
|
1152
|
+
De(w, g);
|
|
1153
|
+
}
|
|
1154
|
+
g.forEach((w) => w.originalWidth = w.width), s == null || s.setColumns(g), m.visibleColumns = g;
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
function Ie() {
|
|
1159
|
+
var e, t, i;
|
|
1160
|
+
n.value && n.value.presets && (Array.isArray(n.value.presets.filters) || Array.isArray((t = (e = n.value.presets) == null ? void 0 : e.treeData) == null ? void 0 : t.toggledItems)) && A.populateColumnFilterSearchTermPresets(((i = n.value.presets) == null ? void 0 : i.filters) || []);
|
|
1161
|
+
}
|
|
1162
|
+
function He(e) {
|
|
1163
|
+
if (n.value && k.value) {
|
|
1164
|
+
if (P.value = Array.isArray(e) ? e.length : 0, k.value && (u != null && u.getPagingInfo)) {
|
|
1165
|
+
const i = u.getPagingInfo();
|
|
1166
|
+
"totalRows" in i && k.value.totalItems !== i.totalRows && (P.value = i.totalRows || 0);
|
|
1167
|
+
}
|
|
1168
|
+
k.value.totalItems = P.value;
|
|
1169
|
+
const t = Me(n.value, k.value);
|
|
1170
|
+
ze(t);
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
function Ne() {
|
|
1174
|
+
var i;
|
|
1175
|
+
const e = (i = n.value) == null ? void 0 : i.presets;
|
|
1176
|
+
if (n.value && (n.value.enableCheckboxSelector || n.value.enableRowSelection) && (s != null && s.getSelectionModel()) && (e != null && e.rowSelection) && (Array.isArray(e.rowSelection.gridRowIndexes) || Array.isArray(e.rowSelection.dataContextIds))) {
|
|
1177
|
+
let r = e.rowSelection.dataContextIds, d = e.rowSelection.gridRowIndexes;
|
|
1178
|
+
Array.isArray(r) && r.length > 0 ? d = (u == null ? void 0 : u.mapIdsToRows(r)) || [] : Array.isArray(d) && d.length > 0 && (r = (u == null ? void 0 : u.mapRowsToIds(d)) || []), s && Array.isArray(d) && (s.setSelectedRows(d), u.setSelectedIds(r || [], {
|
|
1179
|
+
isRowBeingAdded: !0,
|
|
1180
|
+
shouldTriggerEvent: !1,
|
|
1181
|
+
// do not trigger when presetting the grid
|
|
1182
|
+
applyRowSelectionToGrid: !0
|
|
1183
|
+
}));
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
function ue(e) {
|
|
1187
|
+
var t, i;
|
|
1188
|
+
return !!((i = (t = (e || n.value).backendServiceApi) == null ? void 0 : t.service.options) != null && i.infiniteScroll);
|
|
1189
|
+
}
|
|
1190
|
+
function $t(e) {
|
|
1191
|
+
e.gridId = l.gridId, e.gridContainerId = `slickGridContainer-${l.gridId}`;
|
|
1192
|
+
const t = St(!0, {}, Et, e);
|
|
1193
|
+
return ue(e) || (e.enablePagination = !!(e.backendServiceApi && e.enablePagination === void 0 || e.enablePagination)), t != null && t.pagination && (e.enablePagination || e.backendServiceApi) && e.pagination && Array.isArray(e.pagination.pageSizes) && (t.pagination.pageSizes = e.pagination.pageSizes), ae = t.showHeaderRow === !1, t.enableFiltering && !t.showHeaderRow && (t.showHeaderRow = t.enableFiltering), t && !t.enableFiltering && t.enablePagination && Q && (t.enableFiltering = !0, t.showHeaderRow = !1, ae = !0, m && (m.hideHeaderRowAfterPageLoad = !0)), t;
|
|
1194
|
+
}
|
|
1195
|
+
function qt(e) {
|
|
1196
|
+
if (Array.isArray(e))
|
|
1197
|
+
for (const t of e)
|
|
1198
|
+
s && typeof t.init == "function" && t.init(s, E);
|
|
1199
|
+
}
|
|
1200
|
+
function jt() {
|
|
1201
|
+
var e;
|
|
1202
|
+
if (b = ((e = n.value) == null ? void 0 : e.externalResources) || [], Array.isArray(b))
|
|
1203
|
+
for (const t of b)
|
|
1204
|
+
(t == null ? void 0 : t.className) === "RxJsResource" && Jt(t);
|
|
1205
|
+
n.value.enableRowDetailView && !b.some((t) => t instanceof yt) && (le = new yt(v), le.create(y.value, n.value), I.addExtensionToList(ht.rowDetailView, { name: ht.rowDetailView, instance: le }));
|
|
1206
|
+
}
|
|
1207
|
+
function Yt() {
|
|
1208
|
+
Array.isArray(b) && (m.externalRegisteredResources = b), b.some((e) => e instanceof ct) || b.push(de), b.some((e) => e instanceof ut) || b.push(G), (n.value.createPreHeaderPanel && n.value.createTopHeaderPanel || n.value.createPreHeaderPanel && !n.value.enableDraggableGrouping) && !b.some((e) => e instanceof ft) && b.push(te), n.value.enableTreeData && !b.some((e) => e instanceof dt) && b.push(N), n.value.enableTranslate && I.translateColumnHeaders(), b.some((e) => e instanceof gt) || (K = new gt(), b.push(K)), qt(b), n.value.enableRowDetailView && le && le.init(s);
|
|
1209
|
+
}
|
|
1210
|
+
function Jt(e) {
|
|
1211
|
+
_ = e, O.addRxJsResource(_), _e.addRxJsResource(_), A.addRxJsResource(_), D.addRxJsResource(_), T.addRxJsResource(_), E.registerInstance("RxJsResource", _);
|
|
1212
|
+
}
|
|
1213
|
+
async function We(e = !0) {
|
|
1214
|
+
var t;
|
|
1215
|
+
if (s && ((t = n.value) != null && t.enablePagination) && !X && e) {
|
|
1216
|
+
if (n.value.customPaginationComponent) {
|
|
1217
|
+
const i = document.createElement("section"), r = Oe(n.value.customPaginationComponent).mount(
|
|
1218
|
+
i
|
|
1219
|
+
);
|
|
1220
|
+
f.value.appendChild(r.$el), B = r;
|
|
1221
|
+
} else
|
|
1222
|
+
B = new Mn();
|
|
1223
|
+
_n(() => {
|
|
1224
|
+
B && (B.init(s, T, v, U), B.renderPagination(f.value), X = !0);
|
|
1225
|
+
});
|
|
1226
|
+
} else e || (B == null || B.dispose(), X = !1);
|
|
1227
|
+
}
|
|
1228
|
+
function Ke(e, t = !1) {
|
|
1229
|
+
const i = C;
|
|
1230
|
+
let r, d = [];
|
|
1231
|
+
return ye && ne.value ? (r = N.sortHierarchicalDataset(ne.value), d = r.flat) : Array.isArray(e) && e.length > 0 && (r = N.convertFlatParentChildToTreeDatasetAndSort(
|
|
1232
|
+
e,
|
|
1233
|
+
y.value || [],
|
|
1234
|
+
n.value
|
|
1235
|
+
), m.hierarchicalDataset = r.hierarchical, d = r.flat), e.length > 0 && (t || e.length !== i) && A.refreshTreeDataFilters(d), d;
|
|
1236
|
+
}
|
|
1237
|
+
function Ue(e) {
|
|
1238
|
+
return e.some((t) => `${t.id}`.includes(".")) && console.error(
|
|
1239
|
+
'[Slickgrid-Vue] Make sure that none of your Column Definition "id" property includes a dot in its name because that will cause some problems with the Editors. For example if your column definition "field" property is "user.firstName" then use "firstName" as the column "id".'
|
|
1240
|
+
), e.map((t) => {
|
|
1241
|
+
var i, r;
|
|
1242
|
+
return (i = t.editor) != null && i.collectionAsync && Kt(t), { ...t, editorClass: (r = t.editor) == null ? void 0 : r.model };
|
|
1243
|
+
});
|
|
1244
|
+
}
|
|
1245
|
+
function Xt() {
|
|
1246
|
+
u.getItemCount() > Kn && !n.value.silenceWarnings && !n.value.preParseDateColumns && (s != null && s.getColumns().some((e) => Rn(e.type))) && console.warn(
|
|
1247
|
+
"[Slickgrid-Universal] For getting better perf, we suggest you enable the `preParseDateColumns` grid option, for more info visit => https://ghiscoding.gitbook.io/slickgrid-vue/column-functionalities/sorting#pre-parse-date-columns-for-better-perf"
|
|
1248
|
+
);
|
|
1249
|
+
}
|
|
1250
|
+
function Ce(e, t) {
|
|
1251
|
+
if (s && e.editor) {
|
|
1252
|
+
e.editor.collection = t, e.editor.disabled = !1;
|
|
1253
|
+
const i = s.getCellEditor();
|
|
1254
|
+
i != null && i.disable && (i != null && i.renderDomElement) && (i.destroy(), i.disable(!1), i.renderDomElement(t));
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
return (e, t) => (kn(), Fn("div", {
|
|
1258
|
+
id: M.value,
|
|
1259
|
+
ref_key: "elm",
|
|
1260
|
+
ref: f,
|
|
1261
|
+
class: "grid-pane"
|
|
1262
|
+
}, [
|
|
1263
|
+
Ct(e.$slots, "header"),
|
|
1264
|
+
Bn("div", {
|
|
1265
|
+
id: e.gridId,
|
|
1266
|
+
class: "slickgrid-container"
|
|
1267
|
+
}, null, 8, Wn),
|
|
1268
|
+
Ct(e.$slots, "footer")
|
|
1269
|
+
], 8, Nn));
|
|
1270
|
+
}
|
|
1271
|
+
});
|
|
1272
|
+
export {
|
|
1273
|
+
ri as Aggregators,
|
|
1274
|
+
ti as BindingService,
|
|
1275
|
+
si as Enums,
|
|
1276
|
+
mi as EventPubSubService,
|
|
1277
|
+
li as Formatters,
|
|
1278
|
+
di as GroupTotalFormatters,
|
|
1279
|
+
yt as SlickRowDetailView,
|
|
1280
|
+
ni as SlickgridVue,
|
|
1281
|
+
ui as SortComparers,
|
|
1282
|
+
zn as TranslaterService,
|
|
1283
|
+
ci as Utilities,
|
|
1284
|
+
Hn as disposeAllSubscriptions
|
|
1285
|
+
};
|
|
1286
|
+
//# sourceMappingURL=index.mjs.map
|