slickgrid-vue 9.7.0 → 9.9.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/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { EventPubSubService as ze } from "@slickgrid-universal/event-pub-sub";
|
|
2
2
|
import { EventPubSubService as Pn } from "@slickgrid-universal/event-pub-sub";
|
|
3
|
-
import { unsubscribeAll as
|
|
3
|
+
import { unsubscribeAll as xt, createDomElement as He, SlickRowSelectionModel as kt, emptyElement as tt, SlickEventData as Pt, DelimiterType as Tt, EventNamingStyle as ve, Filters as Ft, SlickgridConfig as Vt, SlickEventHandler as _t, BackendUtilityService as Mt, GridEventService as Bt, SharedService as Gt, CollectionService as zt, ExtensionUtility as Ht, FilterFactory as Lt, FilterService as Nt, ResizerService as Wt, SortService as Kt, TreeDataService as Le, PaginationService as Ut, ExtensionService as $t, GridService as Ne, GridStateService as We, HeaderGroupingService as Ke, SlickGroupItemMetadataProvider as qt, SlickDataView as jt, autoAddEditorFormatterToColumnsWithEditor as Ue, SlickGrid as Yt, collectionObserver as Jt, ExtensionName as $e, isColumnDateType as Xt } from "@slickgrid-universal/common";
|
|
4
4
|
export * from "@slickgrid-universal/common";
|
|
5
5
|
import { Aggregators as Vn, Enums as _n, Formatters as Mn, GroupTotalFormatters as Bn, SortComparers as Gn, Utilities as zn } from "@slickgrid-universal/common";
|
|
6
|
-
import { createApp as
|
|
6
|
+
import { createApp as we, defineComponent as Qt, mergeModels as Zt, useAttrs as en, ref as L, computed as qe, useModel as ie, watch as se, onBeforeUnmount as tn, onMounted as nn, inject as on, nextTick as an, createElementBlock as rn, openBlock as sn, renderSlot as je, createElementVNode as ln } from "vue";
|
|
7
7
|
import { SlickFooterComponent as dn } from "@slickgrid-universal/custom-footer-component";
|
|
8
8
|
import { SlickEmptyWarningComponent as Ye } from "@slickgrid-universal/empty-warning-component";
|
|
9
9
|
import { SlickPaginationComponent as cn } from "@slickgrid-universal/pagination-component";
|
|
10
10
|
import { deepCopy as un, extend as fn } from "@slickgrid-universal/utils";
|
|
11
11
|
import { SlickRowDetailView as mn } from "@slickgrid-universal/row-detail-view-plugin";
|
|
12
12
|
var Je = Object.prototype.hasOwnProperty;
|
|
13
|
-
function
|
|
13
|
+
function de(u, o) {
|
|
14
14
|
var a, s;
|
|
15
15
|
if (u === o) return !0;
|
|
16
16
|
if (u && o && (a = u.constructor) === o.constructor) {
|
|
@@ -18,19 +18,19 @@ function ce(u, o) {
|
|
|
18
18
|
if (a === RegExp) return u.toString() === o.toString();
|
|
19
19
|
if (a === Array) {
|
|
20
20
|
if ((s = u.length) === o.length)
|
|
21
|
-
for (; s-- &&
|
|
21
|
+
for (; s-- && de(u[s], o[s]); ) ;
|
|
22
22
|
return s === -1;
|
|
23
23
|
}
|
|
24
24
|
if (!a || typeof u == "object") {
|
|
25
25
|
s = 0;
|
|
26
26
|
for (a in u)
|
|
27
|
-
if (Je.call(u, a) && ++s && !Je.call(o, a) || !(a in o) || !
|
|
27
|
+
if (Je.call(u, a) && ++s && !Je.call(o, a) || !(a in o) || !de(u[a], o[a])) return !1;
|
|
28
28
|
return Object.keys(o).length === s;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
return u !== u && o !== o;
|
|
32
32
|
}
|
|
33
|
-
const
|
|
33
|
+
const le = "container_", Xe = "container_loading";
|
|
34
34
|
class Qe extends mn {
|
|
35
35
|
constructor(o) {
|
|
36
36
|
super(o), this.eventPubSubService = o;
|
|
@@ -56,7 +56,7 @@ class Qe extends mn {
|
|
|
56
56
|
}
|
|
57
57
|
/** Dispose of the RowDetailView Extension */
|
|
58
58
|
dispose() {
|
|
59
|
-
this.disposeAllViewComponents(),
|
|
59
|
+
this.disposeAllViewComponents(), xt(this._subscriptions), super.dispose();
|
|
60
60
|
}
|
|
61
61
|
/** Dispose of all the opened Row Detail Panels Components */
|
|
62
62
|
disposeAllViewComponents() {
|
|
@@ -85,7 +85,7 @@ class Qe extends mn {
|
|
|
85
85
|
this._userProcessFn = this.gridOptions.rowDetailView.process, this.addonOptions.process = (a) => this.onProcessing(a);
|
|
86
86
|
else
|
|
87
87
|
throw new Error('[Slickgrid-Vue] You need to provide a "process" function for the Row Detail Extension to work properly');
|
|
88
|
-
return this._grid && this.gridOptions?.rowDetailView && (this.gridOptions.rowDetailView.preTemplate || (this._preloadComponent = this.gridOptions?.rowDetailView?.preloadComponent, this.addonOptions.preTemplate = () => He("div", { className: `${Xe}` })), this.gridOptions.rowDetailView.postTemplate || (this._component = this.gridOptions?.rowDetailView?.viewComponent, this.addonOptions.postTemplate = (a) => He("div", { className: `${
|
|
88
|
+
return this._grid && this.gridOptions?.rowDetailView && (this.gridOptions.rowDetailView.preTemplate || (this._preloadComponent = this.gridOptions?.rowDetailView?.preloadComponent, this.addonOptions.preTemplate = () => He("div", { className: `${Xe}` })), this.gridOptions.rowDetailView.postTemplate || (this._component = this.gridOptions?.rowDetailView?.viewComponent, this.addonOptions.postTemplate = (a) => He("div", { className: `${le}${a[this.datasetIdPropName]}` })), this._grid && this.gridOptions && ((!o || !this._grid.getSelectionModel()) && (o = new kt(this.gridOptions.rowSelectionOptions || { selectActiveRow: !0 }), this._grid.setSelectionModel(o)), this._grid && this.rowDetailViewOptions && (this.rowDetailViewOptions.onExtensionRegistered && this.rowDetailViewOptions.onExtensionRegistered(this), this._eventHandler.subscribe(this.onAsyncResponse, (a, s) => {
|
|
89
89
|
typeof this.rowDetailViewOptions?.onAsyncResponse == "function" && this.rowDetailViewOptions.onAsyncResponse(a, s);
|
|
90
90
|
}), this._eventHandler.subscribe(this.onAsyncEndUpdate, async (a, s) => {
|
|
91
91
|
this._preloadApp?.unmount(), queueMicrotask(async () => {
|
|
@@ -126,7 +126,7 @@ class Qe extends mn {
|
|
|
126
126
|
}
|
|
127
127
|
/** Redraw the necessary View Component */
|
|
128
128
|
redrawViewComponent(o) {
|
|
129
|
-
this.gridContainerElement.querySelector(`.${
|
|
129
|
+
this.gridContainerElement.querySelector(`.${le}${o.id}`) && this.renderViewModel(o.dataContext);
|
|
130
130
|
}
|
|
131
131
|
/** Render (or re-render) the View Component (Row Detail) */
|
|
132
132
|
renderPreloadView(o) {
|
|
@@ -139,14 +139,14 @@ class Qe extends mn {
|
|
|
139
139
|
dataView: this.dataView,
|
|
140
140
|
parentRef: this.rowDetailViewOptions?.parentRef
|
|
141
141
|
}, x = document.createElement("div");
|
|
142
|
-
this._preloadApp =
|
|
142
|
+
this._preloadApp = we(this._preloadComponent, p);
|
|
143
143
|
const n = this._preloadApp.mount(x);
|
|
144
144
|
p.parentRef = n, a.appendChild(n.$el), s && (s.app = this._preloadApp, s.instance = n);
|
|
145
145
|
}
|
|
146
146
|
}
|
|
147
147
|
/** Render (or re-render) the View Component (Row Detail) */
|
|
148
148
|
renderViewModel(o) {
|
|
149
|
-
const a = this.gridContainerElement.querySelector(`.${
|
|
149
|
+
const a = this.gridContainerElement.querySelector(`.${le}${o[this.datasetIdPropName]}`);
|
|
150
150
|
if (this._component && a) {
|
|
151
151
|
const s = {
|
|
152
152
|
model: o,
|
|
@@ -155,8 +155,8 @@ class Qe extends mn {
|
|
|
155
155
|
dataView: this.dataView,
|
|
156
156
|
parentRef: this.rowDetailViewOptions?.parentRef
|
|
157
157
|
};
|
|
158
|
-
this.unmountViewWhenExists(o[this.datasetIdPropName]);
|
|
159
|
-
const p = document.createElement("div"), x =
|
|
158
|
+
this.unmountViewWhenExists(o[this.datasetIdPropName]), tt(a);
|
|
159
|
+
const p = document.createElement("div"), x = we(this._component, s), n = x.mount(p);
|
|
160
160
|
s.parentRef = x.component, a.appendChild(n.$el), this.upsertViewRefs(o, { app: x, instance: n, rendered: !0 });
|
|
161
161
|
}
|
|
162
162
|
}
|
|
@@ -184,7 +184,7 @@ class Qe extends mn {
|
|
|
184
184
|
disposeViewComponent(o) {
|
|
185
185
|
if (o?.instance) {
|
|
186
186
|
o.rendered = !1;
|
|
187
|
-
const a = this.gridContainerElement.querySelector(`.${
|
|
187
|
+
const a = this.gridContainerElement.querySelector(`.${le}${o.id}`);
|
|
188
188
|
if (a)
|
|
189
189
|
return o.app?.unmount(), a.textContent = "", o;
|
|
190
190
|
}
|
|
@@ -209,7 +209,7 @@ class Qe extends mn {
|
|
|
209
209
|
* @param item
|
|
210
210
|
*/
|
|
211
211
|
notifyTemplate(o) {
|
|
212
|
-
this.onAsyncResponse.notify({ item: o }, new
|
|
212
|
+
this.onAsyncResponse.notify({ item: o }, new Pt(), this);
|
|
213
213
|
}
|
|
214
214
|
/**
|
|
215
215
|
* On Processing, we will notify the plugin with the new item detail once backend server call completes
|
|
@@ -325,7 +325,7 @@ const Ze = {
|
|
|
325
325
|
// but disable it when using backend services
|
|
326
326
|
},
|
|
327
327
|
datasetIdPropertyName: "id",
|
|
328
|
-
defaultFilter:
|
|
328
|
+
defaultFilter: Ft.input,
|
|
329
329
|
defaultBackendServiceFilterTypingDebounce: 500,
|
|
330
330
|
defaultColumnSortFieldId: "id",
|
|
331
331
|
defaultFilterPlaceholder: "🔎︎",
|
|
@@ -362,7 +362,7 @@ const Ze = {
|
|
|
362
362
|
enableMouseHoverHighlightRow: !0,
|
|
363
363
|
enableSorting: !0,
|
|
364
364
|
enableTextSelectionOnCells: !0,
|
|
365
|
-
eventNamingStyle:
|
|
365
|
+
eventNamingStyle: ve.camelCaseWithExtraOnPrefix,
|
|
366
366
|
explicitInitialization: !0,
|
|
367
367
|
excelExportOptions: {
|
|
368
368
|
addGroupIndentation: !0,
|
|
@@ -376,7 +376,7 @@ const Ze = {
|
|
|
376
376
|
sanitizeDataExport: !1
|
|
377
377
|
},
|
|
378
378
|
textExportOptions: {
|
|
379
|
-
delimiter:
|
|
379
|
+
delimiter: Tt.comma,
|
|
380
380
|
exportWithFormatter: !1,
|
|
381
381
|
filename: "export",
|
|
382
382
|
format: "csv",
|
|
@@ -477,7 +477,6 @@ const Ze = {
|
|
|
477
477
|
resizeByContentOnlyOnFirstLoad: !0,
|
|
478
478
|
resizeByContentOptions: {
|
|
479
479
|
alwaysRecalculateColumnWidth: !1,
|
|
480
|
-
cellCharWidthInPx: 7.8,
|
|
481
480
|
cellPaddingWidthInPx: 14,
|
|
482
481
|
defaultRatioForStringType: 0.88,
|
|
483
482
|
formatterPaddingWidthInPx: 0,
|
|
@@ -683,77 +682,77 @@ const Cn = ["id"], vn = ["id"], wn = 1e4, In = /* @__PURE__ */ Qt({
|
|
|
683
682
|
}),
|
|
684
683
|
emits: ["update:options", "update:pagination", "update:columns", "update:data", "update:hierarchical"],
|
|
685
684
|
setup(u) {
|
|
686
|
-
const o = en(), a = u, s = L(), p = L(), x = L(null), n = L({}), k = L(0),
|
|
687
|
-
let N = 0, m = null, l,
|
|
688
|
-
const
|
|
689
|
-
f.eventNamingStyle =
|
|
690
|
-
const C = new pn(), T = new hn(),
|
|
691
|
-
|
|
685
|
+
const o = en(), a = u, s = L(), p = L(), x = L(null), n = L({}), k = L(0), nt = qe(() => `slickGridContainer-${a.gridId}`), Se = qe(() => Oe.value?.backendServiceApi?.service);
|
|
686
|
+
let N = 0, m = null, l, be = [], j, Y = !1, B, J = !1, ce = !1, oe = !1, ue = !1, W = !1, K = !0, ye, h = [], fe = !1, X = !1, U = [], ae, Q, F, Z, G, P;
|
|
687
|
+
const it = new Vt(), z = new _t(), f = new ze();
|
|
688
|
+
f.eventNamingStyle = ve.camelCaseWithExtraOnPrefix;
|
|
689
|
+
const C = new pn(), T = new hn(), R = new Mt(), $ = new Bt(), c = new Gt(), me = new zt(T), pe = new Ht(c, R, T), Ae = new Lt(it, T, me), v = new Nt(Ae, f, c, R), O = new Wt(f), b = new Kt(me, c, f, R), D = new Le(f, v, c, b), E = new Ut(f, c, R), y = new $t(
|
|
690
|
+
pe,
|
|
692
691
|
v,
|
|
693
692
|
f,
|
|
694
693
|
c,
|
|
695
|
-
|
|
696
|
-
|
|
694
|
+
b,
|
|
695
|
+
D,
|
|
697
696
|
T,
|
|
698
697
|
() => ee
|
|
699
698
|
), V = new We(
|
|
700
|
-
|
|
699
|
+
y,
|
|
701
700
|
v,
|
|
702
701
|
f,
|
|
703
702
|
c,
|
|
704
|
-
|
|
705
|
-
|
|
703
|
+
b,
|
|
704
|
+
D
|
|
706
705
|
), ee = new Ne(
|
|
707
706
|
V,
|
|
708
707
|
v,
|
|
709
708
|
f,
|
|
710
|
-
|
|
709
|
+
E,
|
|
711
710
|
c,
|
|
711
|
+
b,
|
|
712
|
+
D
|
|
713
|
+
), te = new Ke(pe);
|
|
714
|
+
let Re = [
|
|
712
715
|
y,
|
|
713
|
-
I
|
|
714
|
-
), te = new Ke(he);
|
|
715
|
-
let Oe = [
|
|
716
|
-
A,
|
|
717
716
|
v,
|
|
718
717
|
$,
|
|
719
718
|
ee,
|
|
720
719
|
V,
|
|
721
720
|
te,
|
|
722
|
-
D,
|
|
723
721
|
E,
|
|
724
|
-
|
|
725
|
-
|
|
722
|
+
O,
|
|
723
|
+
b,
|
|
724
|
+
D
|
|
726
725
|
];
|
|
727
|
-
C.registerInstance("PubSubService", f), C.registerInstance("EventPubSubService", f), C.registerInstance("ExtensionUtility",
|
|
728
|
-
const
|
|
729
|
-
n.value = { ...Ze, ...
|
|
730
|
-
const
|
|
731
|
-
|
|
732
|
-
const
|
|
733
|
-
|
|
734
|
-
const M =
|
|
735
|
-
|
|
726
|
+
C.registerInstance("PubSubService", f), C.registerInstance("EventPubSubService", f), C.registerInstance("ExtensionUtility", pe), C.registerInstance("FilterService", v), C.registerInstance("CollectionService", me), C.registerInstance("ExtensionService", y), C.registerInstance("GridEventService", $), C.registerInstance("GridService", ee), C.registerInstance("GridStateService", V), C.registerInstance("HeaderGroupingService", te), C.registerInstance("PaginationService", E), C.registerInstance("ResizerService", O), C.registerInstance("SharedService", c), C.registerInstance("SortService", b), C.registerInstance("TranslaterService", T), C.registerInstance("TreeDataService", D);
|
|
727
|
+
const Oe = ie(u, "options");
|
|
728
|
+
n.value = { ...Ze, ...Oe.value };
|
|
729
|
+
const A = L(), ot = ie(u, "pagination");
|
|
730
|
+
se(ot, (e) => gt(e));
|
|
731
|
+
const w = L([]), _ = ie(u, "columns");
|
|
732
|
+
se(_, (e) => Ee(e), { immediate: !0 });
|
|
733
|
+
const M = ie(u, "data");
|
|
734
|
+
se(
|
|
736
735
|
M,
|
|
737
736
|
(e) => {
|
|
738
|
-
const t = N, i =
|
|
737
|
+
const t = N, i = de(e, M.value || []);
|
|
739
738
|
let r = n.value?.enableDeepCopyDatasetOnPageLoad ? un(e) : e;
|
|
740
|
-
l && n.value?.enableTreeData && Array.isArray(e) && (e.length > 0 || e.length !== t || !i) && (
|
|
739
|
+
l && n.value?.enableTreeData && Array.isArray(e) && (e.length > 0 || e.length !== t || !i) && (ue = !1, r = Me(e, !i)), Ie(r || []), N = (e || []).length, l && n.value?.autoFitColumnsOnFirstLoad && t === 0 && !J && (l.autosizeColumns(), J = !0);
|
|
741
740
|
},
|
|
742
741
|
{ immediate: !0 }
|
|
743
742
|
);
|
|
744
|
-
const q =
|
|
745
|
-
|
|
743
|
+
const q = ie(u, "hierarchical");
|
|
744
|
+
se(
|
|
746
745
|
q,
|
|
747
746
|
(e) => {
|
|
748
|
-
const t =
|
|
749
|
-
c && (c.hierarchicalDataset = e), e &&
|
|
747
|
+
const t = de(e, c?.hierarchicalDataset ?? []), i = N;
|
|
748
|
+
c && (c.hierarchicalDataset = e), e && w.value && v?.clearFilters && v.clearFilters(), m && e && l && b?.processTreeDataInitialSort && (m.setItems([], n.value?.datasetIdPropertyName ?? "id"), b.processTreeDataInitialSort(), D.initHierarchicalTree(), queueMicrotask(() => {
|
|
750
749
|
const r = m?.getItemCount() || 0;
|
|
751
750
|
r > 0 && (r !== i || !t) && v.refreshTreeDataFilters();
|
|
752
|
-
}),
|
|
751
|
+
}), ue = !0);
|
|
753
752
|
},
|
|
754
753
|
{ immediate: !0 }
|
|
755
754
|
), Y = n.value?.showHeaderRow === !1, tn(() => {
|
|
756
|
-
|
|
755
|
+
De();
|
|
757
756
|
}), nn(() => {
|
|
758
757
|
if (!_.value)
|
|
759
758
|
throw new Error(
|
|
@@ -775,88 +774,86 @@ const Cn = ["id"], vn = ["id"], wn = 1e4, In = /* @__PURE__ */ Qt({
|
|
|
775
774
|
}
|
|
776
775
|
}
|
|
777
776
|
}
|
|
778
|
-
if (
|
|
777
|
+
if (at(), ce = !0, ne() || (n.value.enablePagination = !!(n.value.backendServiceApi && n.value.enablePagination === void 0 || n.value.enablePagination)), !W && !q.value && n.value?.enablePagination && K && (X = !0, Fe(M.value)), n.value?.enableEmptyDataWarningMessage) {
|
|
779
778
|
const e = M.value || [];
|
|
780
779
|
if (Array.isArray(e)) {
|
|
781
780
|
const t = e.length;
|
|
782
|
-
|
|
781
|
+
he(t < 1);
|
|
783
782
|
}
|
|
784
783
|
}
|
|
785
|
-
n.value.darkMode &&
|
|
784
|
+
n.value.darkMode && ke(!0), q.value && (c.hierarchicalDataset = q.value || []), It(), wt();
|
|
786
785
|
});
|
|
787
|
-
function
|
|
788
|
-
e && (
|
|
786
|
+
function Ee(e) {
|
|
787
|
+
e && (w.value = e), ce && vt(w.value), w.value.length > 0 && St(w.value);
|
|
789
788
|
}
|
|
790
|
-
function
|
|
789
|
+
function at() {
|
|
791
790
|
if (!n.value || !_.value)
|
|
792
791
|
throw new Error(
|
|
793
792
|
'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.'
|
|
794
793
|
);
|
|
795
|
-
if (n.value.translater = T, J = !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), f.eventNamingStyle = n.value?.eventNamingStyle ??
|
|
794
|
+
if (n.value.translater = T, J = !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), f.eventNamingStyle = n.value?.eventNamingStyle ?? ve.camelCaseWithExtraOnPrefix, f.publish("onBeforeGridCreate", !0), N = M.value?.length || 0, n.value = At(n.value), A.value = n.value?.pagination, G = n.value?.backendServiceApi, K = !G, n.value?.enableTranslate || n.value?.i18n)
|
|
796
795
|
if (B = on("i18next", null), B)
|
|
797
796
|
T.i18nInstance = B;
|
|
798
797
|
else
|
|
799
798
|
throw new Error(
|
|
800
799
|
"[Slickgrid-Vue] Enabling translation requires you to provide I18Next in your App, for example: `provide('i18next', useTranslation().i18next)`."
|
|
801
800
|
);
|
|
802
|
-
n.value?.backendServiceApi && !n.value.backendServiceApi?.disableInternalPostProcess &&
|
|
801
|
+
n.value?.backendServiceApi && !n.value.backendServiceApi?.disableInternalPostProcess && dt(n.value);
|
|
803
802
|
const e = n.value?.dataView && n.value.dataView.inlineFilters || !1;
|
|
804
803
|
let t = {
|
|
805
804
|
...n.value.dataView,
|
|
806
805
|
inlineFilters: e
|
|
807
806
|
};
|
|
808
|
-
(n.value?.draggableGrouping || n.value?.enableGrouping) && (j = new
|
|
807
|
+
(n.value?.draggableGrouping || n.value?.enableGrouping) && (j = new qt(), c.groupItemMetadataProvider = j, t = { ...t, groupItemMetadataProvider: j }), m = new jt(t, f), f.publish("onDataviewCreated", m), Ot(), w.value = Be(_.value || []), n.value?.autoAddCustomEditorFormatter && Ue(w.value, n.value?.autoAddCustomEditorFormatter), c.allColumns = w.value, c.visibleColumns = w.value, y.createExtensionsBeforeGridCreation(w.value, n.value), n.value?.presets?.pinning && (n.value = { ...n.value, ...n.value.presets.pinning }), l = new Yt(
|
|
809
808
|
`#${a.gridId}`,
|
|
810
809
|
m,
|
|
811
|
-
|
|
810
|
+
w.value,
|
|
812
811
|
n.value,
|
|
813
812
|
f
|
|
814
|
-
), c.dataView = m, c.slickGrid = l, c.gridContainerElement = s.value, j && l.registerPlugin(j),
|
|
815
|
-
const i =
|
|
816
|
-
i
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
const w = n.value?.enableTreeData ? Be(M.value || []) : M.value;
|
|
820
|
-
if (Array.isArray(w) && m.setItems(w, n.value.datasetIdPropertyName ?? "id"), l?.getSelectionModel() && n.value?.dataView && "syncGridSelection" in n.value.dataView) {
|
|
813
|
+
), c.dataView = m, c.slickGrid = l, c.gridContainerElement = s.value, j && l.registerPlugin(j), y.bindDifferentExtensions(), ct(l, n.value, m), c.frozenVisibleColumnId = l.getFrozenColumnId(), Et(), l.init();
|
|
814
|
+
const i = s.value;
|
|
815
|
+
if (i && O.init(l, i), !n.value?.enablePagination && n.value?.showCustomFooter && n.value?.customFooterOptions && i && (Q = new dn(l, n.value?.customFooterOptions, f, T), Q.renderFooter(i)), m) {
|
|
816
|
+
const d = n.value?.enableTreeData ? Me(M.value || []) : M.value;
|
|
817
|
+
if (Array.isArray(d) && m.setItems(d, n.value.datasetIdPropertyName ?? "id"), l?.getSelectionModel() && n.value?.dataView && "syncGridSelection" in n.value.dataView) {
|
|
821
818
|
let S = !1;
|
|
822
819
|
n.value.backendServiceApi && "syncGridSelectionWithBackendService" in n.value.dataView && (S = n.value.dataView.syncGridSelectionWithBackendService);
|
|
823
|
-
const
|
|
824
|
-
if (typeof
|
|
825
|
-
let
|
|
826
|
-
K || (
|
|
827
|
-
} else typeof
|
|
820
|
+
const g = n.value.dataView.syncGridSelection;
|
|
821
|
+
if (typeof g == "boolean") {
|
|
822
|
+
let I = g;
|
|
823
|
+
K || (I = g && S), m.syncGridSelection(l, I);
|
|
824
|
+
} else typeof g == "object" && m.syncGridSelection(l, g.preserveHidden, g.preserveHiddenOnSelectionChange);
|
|
828
825
|
}
|
|
829
|
-
M.value?.length && (!
|
|
826
|
+
M.value?.length && (!oe && (n.value.enableCheckboxSelector || n.value.enableRowSelection) && Ve(), Ce(), oe = !0);
|
|
830
827
|
}
|
|
831
|
-
Y && (
|
|
832
|
-
const
|
|
828
|
+
Y && (Ct(!1), c.hideHeaderRowAfterPageLoad = Y), f.publish("onGridCreated", l), pt(l, n.value), mt(l, n.value), n.value?.backendServiceApi && ut(n.value);
|
|
829
|
+
const r = {
|
|
833
830
|
element: s.value,
|
|
834
831
|
// Slick Grid & DataView objects
|
|
835
832
|
dataView: m,
|
|
836
833
|
slickGrid: l,
|
|
837
834
|
// public methods
|
|
838
|
-
dispose:
|
|
835
|
+
dispose: rt,
|
|
839
836
|
// return all available Services (non-singleton)
|
|
840
|
-
backendService:
|
|
837
|
+
backendService: Se.value,
|
|
841
838
|
eventPubSubService: f,
|
|
842
839
|
filterService: v,
|
|
843
840
|
gridEventService: $,
|
|
844
841
|
gridStateService: V,
|
|
845
842
|
gridService: ee,
|
|
846
843
|
headerGroupingService: te,
|
|
847
|
-
extensionService:
|
|
844
|
+
extensionService: y,
|
|
848
845
|
paginationComponent: F,
|
|
849
|
-
paginationService:
|
|
850
|
-
resizerService:
|
|
851
|
-
sortService:
|
|
852
|
-
treeDataService:
|
|
846
|
+
paginationService: E,
|
|
847
|
+
resizerService: O,
|
|
848
|
+
sortService: b,
|
|
849
|
+
treeDataService: D
|
|
853
850
|
};
|
|
854
|
-
p.value =
|
|
851
|
+
p.value = y?.extensionList, x.value = r, f.publish("onVueGridCreated", r);
|
|
855
852
|
}
|
|
856
|
-
function
|
|
857
|
-
if (f.publish("onBeforeGridDestroy", l), z?.unsubscribeAll(), typeof B?.off == "function" && B.off("languageChanged"), e &&
|
|
853
|
+
function De(e = !1) {
|
|
854
|
+
if (f.publish("onBeforeGridDestroy", l), z?.unsubscribeAll(), typeof B?.off == "function" && B.off("languageChanged"), e && lt(), be.forEach((t) => t?.disconnect()), f.publish("onAfterGridDestroyed", !0), Re.forEach((t) => {
|
|
858
855
|
t?.dispose && t.dispose();
|
|
859
|
-
}),
|
|
856
|
+
}), Re = [], Se.value?.dispose?.(), st(), ae?.dispose(), Q?.dispose(), F?.dispose(), m && (m.setItems && m.setItems([]), m.destroy && m.destroy()), l?.destroy && l.destroy(e), U = gn(U), G) {
|
|
860
857
|
for (const t of Object.keys(G))
|
|
861
858
|
G[t] = null;
|
|
862
859
|
G = void 0;
|
|
@@ -866,10 +863,10 @@ const Cn = ["id"], vn = ["id"], wn = 1e4, In = /* @__PURE__ */ Qt({
|
|
|
866
863
|
for (const t of Object.keys(c))
|
|
867
864
|
c[t] = null;
|
|
868
865
|
}
|
|
869
|
-
function
|
|
870
|
-
|
|
866
|
+
function rt(e = !1) {
|
|
867
|
+
De(e);
|
|
871
868
|
}
|
|
872
|
-
function
|
|
869
|
+
function st() {
|
|
873
870
|
if (Array.isArray(h))
|
|
874
871
|
for (; h.length > 0; ) {
|
|
875
872
|
const e = h.pop();
|
|
@@ -877,111 +874,111 @@ const Cn = ["id"], vn = ["id"], wn = 1e4, In = /* @__PURE__ */ Qt({
|
|
|
877
874
|
}
|
|
878
875
|
h = [];
|
|
879
876
|
}
|
|
880
|
-
function
|
|
877
|
+
function lt() {
|
|
881
878
|
const e = n.value?.gridContainerId ?? "grid1", t = document.querySelector(`#${e}`);
|
|
882
|
-
|
|
879
|
+
tt(t);
|
|
883
880
|
}
|
|
884
|
-
function
|
|
881
|
+
function dt(e) {
|
|
885
882
|
const t = e?.backendServiceApi;
|
|
886
883
|
if (t?.service) {
|
|
887
884
|
const i = t.service;
|
|
888
885
|
typeof i.getDatasetName == "function" && (t.internalPostProcess = (r) => {
|
|
889
886
|
const d = t && i && typeof i.getDatasetName == "function" ? i.getDatasetName() : "";
|
|
890
887
|
if (r?.data[d]) {
|
|
891
|
-
const
|
|
892
|
-
|
|
888
|
+
const S = "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;
|
|
889
|
+
Ie(S, g || 0);
|
|
893
890
|
}
|
|
894
891
|
});
|
|
895
892
|
}
|
|
896
893
|
}
|
|
897
|
-
function
|
|
898
|
-
if (t.enableTranslate &&
|
|
899
|
-
f.publish("onLanguageChange"), t.enableTranslate && (
|
|
894
|
+
function ct(e, t, i) {
|
|
895
|
+
if (t.enableTranslate && y.translateAllExtensions(), typeof B?.on == "function" && B.on("languageChanged", (r) => {
|
|
896
|
+
f.publish("onLanguageChange"), t.enableTranslate && (y.translateAllExtensions(r), (t.createPreHeaderPanel && t.createTopHeaderPanel || t.createPreHeaderPanel && !t.enableDraggableGrouping) && te.translateHeaderGrouping());
|
|
900
897
|
}), t.backendServiceApi) {
|
|
901
898
|
const r = t.backendServiceApi;
|
|
902
899
|
r?.service?.init && r.service.init(r.options, t.pagination, e, c);
|
|
903
900
|
}
|
|
904
|
-
i && e && ($.bindOnBeforeEditCell(e), $.bindOnCellChange(e), $.bindOnClick(e), i && e && (t.enableSorting && (t.backendServiceApi && !t.backendServiceApi.useLocalSorting ?
|
|
901
|
+
i && e && ($.bindOnBeforeEditCell(e), $.bindOnCellChange(e), $.bindOnClick(e), i && e && (t.enableSorting && (t.backendServiceApi && !t.backendServiceApi.useLocalSorting ? b.bindBackendOnSort(e) : b.bindLocalOnSort(e)), t.enableFiltering && (v.init(e), t.backendServiceApi && !t.backendServiceApi.useLocalFiltering ? v.bindBackendOnFilter(e) : v.bindLocalOnFilter(e)), z.subscribe(e.onColumnsReordered, (r, d) => {
|
|
905
902
|
c.hasColumnsReordered = !0, c.visibleColumns = d.impactedColumns;
|
|
906
903
|
}), z.subscribe(e.onSetOptions, (r, d) => {
|
|
907
|
-
d.optionsBefore.darkMode !== d.optionsAfter.darkMode && c.gridContainerElement &&
|
|
908
|
-
}),
|
|
909
|
-
!t.enableRowDetailView || !Array.isArray(d.changedRows) || d.changedRows.length === d.itemCount ? e.invalidate() : (e.invalidateRows(d.changedRows), e.render()),
|
|
904
|
+
d.optionsBefore.darkMode !== d.optionsAfter.darkMode && c.gridContainerElement && ke(d.optionsAfter.darkMode);
|
|
905
|
+
}), yt(), Ce(), z.subscribe(i.onRowCountChanged, (r, d) => {
|
|
906
|
+
!t.enableRowDetailView || !Array.isArray(d.changedRows) || d.changedRows.length === d.itemCount ? e.invalidate() : (e.invalidateRows(d.changedRows), e.render()), Pe(i.getFilteredItemCount() || 0, i.getItemCount() || 0);
|
|
910
907
|
}), z.subscribe(i.onSetItemsCalled, (r, d) => {
|
|
911
|
-
c.isItemsDateParsed = !1,
|
|
912
|
-
}), (t?.enableFiltering || t?.dataView?.globalItemMetadataProvider) && !t.enableRowDetailView && z.subscribe(i.onRowsChanged, (r, { calledOnRowCountChanged: d, rows:
|
|
913
|
-
if (!d && Array.isArray(
|
|
914
|
-
const
|
|
915
|
-
|
|
908
|
+
c.isItemsDateParsed = !1, Pe(i.getFilteredItemCount() || 0, d.itemCount), d.itemCount > 0 && (t.autosizeColumnsByCellContentOnFirstLoad || t.enableAutoResizeColumnsByCellContent) && O.resizeColumnsByCellContent(!t?.resizeByContentOnlyOnFirstLoad);
|
|
909
|
+
}), (t?.enableFiltering || t?.dataView?.globalItemMetadataProvider) && !t.enableRowDetailView && z.subscribe(i.onRowsChanged, (r, { calledOnRowCountChanged: d, rows: S }) => {
|
|
910
|
+
if (!d && Array.isArray(S)) {
|
|
911
|
+
const g = e.getRenderedRange();
|
|
912
|
+
S.filter((I) => I >= g.top && I <= g.bottom).forEach((I) => e.updateRow(I)), e.render();
|
|
916
913
|
}
|
|
917
914
|
})));
|
|
918
915
|
}
|
|
919
|
-
function
|
|
916
|
+
function ut(e) {
|
|
920
917
|
const t = e.backendServiceApi, i = t?.service, r = i?.options || {}, d = r ? r && "executeProcessCommandOnInit" in r ? r.executeProcessCommandOnInit : !0 : !1;
|
|
921
918
|
if (i) {
|
|
922
919
|
if (e?.presets) {
|
|
923
920
|
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) {
|
|
924
|
-
const
|
|
925
|
-
i.updateSorters(void 0,
|
|
921
|
+
const S = n.value?.multiColumnSort ? e.presets.sorters : e.presets.sorters.slice(0, 1);
|
|
922
|
+
i.updateSorters(void 0, S);
|
|
926
923
|
}
|
|
927
924
|
if (i.updatePagination && e.presets.pagination && !ne()) {
|
|
928
|
-
const { pageNumber:
|
|
929
|
-
i.updatePagination(
|
|
925
|
+
const { pageNumber: S, pageSize: g } = e.presets.pagination;
|
|
926
|
+
i.updatePagination(S, g);
|
|
930
927
|
}
|
|
931
928
|
} else {
|
|
932
|
-
const
|
|
933
|
-
|
|
929
|
+
const S = v.getColumnFilters();
|
|
930
|
+
S && i.updateFilters && i.updateFilters(S, !1);
|
|
934
931
|
}
|
|
935
932
|
if (t && i && (t.onInit || d)) {
|
|
936
|
-
const
|
|
933
|
+
const S = typeof i.buildQuery == "function" ? i.buildQuery() : "", g = d ? t.process?.(S) ?? null : t.onInit?.(S) ?? null;
|
|
937
934
|
queueMicrotask(() => {
|
|
938
|
-
const
|
|
935
|
+
const I = /* @__PURE__ */ new Date();
|
|
939
936
|
t.preProcess && t.preProcess();
|
|
940
|
-
const
|
|
941
|
-
|
|
942
|
-
(H) =>
|
|
943
|
-
).catch((H) =>
|
|
944
|
-
|
|
945
|
-
(H) =>
|
|
946
|
-
(H) =>
|
|
937
|
+
const Ge = n.value?.pagination?.totalItems ?? 0;
|
|
938
|
+
g instanceof Promise ? g.then(
|
|
939
|
+
(H) => R.executeBackendProcessesCallback(I, H, t, Ge)
|
|
940
|
+
).catch((H) => R.onBackendError(H, t)) : g && P?.isObservable(g) && U.push(
|
|
941
|
+
g.subscribe(
|
|
942
|
+
(H) => R.executeBackendProcessesCallback(I, H, t, Ge),
|
|
943
|
+
(H) => R.onBackendError(H, t)
|
|
947
944
|
)
|
|
948
945
|
);
|
|
949
946
|
});
|
|
950
947
|
}
|
|
951
|
-
t.service.options?.infiniteScroll &&
|
|
948
|
+
t.service.options?.infiniteScroll && ft();
|
|
952
949
|
}
|
|
953
950
|
}
|
|
954
|
-
function
|
|
951
|
+
function ft() {
|
|
955
952
|
if (l && n.value.backendServiceApi && ne() && !n.value.backendServiceApi?.onScrollEnd) {
|
|
956
953
|
const e = () => {
|
|
957
|
-
|
|
958
|
-
i ||
|
|
954
|
+
R.setInfiniteScrollBottomHit(!0), E.goToNextPage().then((i) => {
|
|
955
|
+
i || R.setInfiniteScrollBottomHit(!1);
|
|
959
956
|
});
|
|
960
957
|
};
|
|
961
958
|
n.value.backendServiceApi.onScrollEnd = e, z.subscribe(l.onScroll, (i, r) => {
|
|
962
959
|
const d = r.grid.getViewportNode();
|
|
963
|
-
["mousewheel", "scroll"].includes(r.triggeredBy || "") &&
|
|
960
|
+
["mousewheel", "scroll"].includes(r.triggeredBy || "") && E?.totalItems && r.scrollTop > 0 && Math.ceil(d.offsetHeight + r.scrollTop) >= r.scrollHeight && (fe || (e(), fe = !0));
|
|
964
961
|
});
|
|
965
962
|
const t = n.value.backendServiceApi.postProcess;
|
|
966
963
|
n.value.backendServiceApi.postProcess = (i) => {
|
|
967
|
-
|
|
964
|
+
fe = !1, t && t(i);
|
|
968
965
|
};
|
|
969
966
|
}
|
|
970
967
|
}
|
|
971
|
-
function
|
|
968
|
+
function mt(e, t) {
|
|
972
969
|
if (t.autoFitColumnsOnFirstLoad && t.autosizeColumnsByCellContentOnFirstLoad || t.enableAutoSizeColumns && t.enableAutoResizeColumnsByCellContent)
|
|
973
970
|
throw new Error(
|
|
974
971
|
'[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").'
|
|
975
972
|
);
|
|
976
|
-
t.gridHeight || t.gridWidth ?
|
|
973
|
+
t.gridHeight || t.gridWidth ? O.resizeGrid(0, { height: t.gridHeight, width: t.gridWidth }) : O.resizeGrid(), e && t?.enableAutoResize && t.autoFitColumnsOnFirstLoad && t.enableAutoSizeColumns && !J && (e.autosizeColumns(), J = !0);
|
|
977
974
|
}
|
|
978
|
-
function
|
|
975
|
+
function pt(e, t) {
|
|
979
976
|
if (t.enableSorting && t.presets && Array.isArray(t.presets.sorters)) {
|
|
980
977
|
const i = n.value.multiColumnSort ? t.presets.sorters : t.presets.sorters.slice(0, 1);
|
|
981
|
-
|
|
978
|
+
b.loadGridSorters(i);
|
|
982
979
|
}
|
|
983
980
|
}
|
|
984
|
-
function
|
|
981
|
+
function ht(e) {
|
|
985
982
|
const t = V?.needToPreserveRowSelection() ?? !1;
|
|
986
983
|
l && !t && n.value?.backendServiceApi && (n.value.enableRowSelection || n.value.enableCheckboxSelector) && l.setSelectedRows([]);
|
|
987
984
|
const { pageNumber: i, pageSize: r } = e;
|
|
@@ -990,123 +987,123 @@ const Cn = ["id"], vn = ["id"], wn = 1e4, In = /* @__PURE__ */ Qt({
|
|
|
990
987
|
gridState: V.getCurrentGridState()
|
|
991
988
|
});
|
|
992
989
|
}
|
|
993
|
-
function
|
|
994
|
-
e &&
|
|
990
|
+
function gt(e) {
|
|
991
|
+
e && A.value ? A.value = { ...A.value, ...e } : A.value = e, n.value && (n.value.pagination = A.value, E.updateTotalItems(e?.totalItems ?? 0, !0));
|
|
995
992
|
}
|
|
996
|
-
function
|
|
997
|
-
if (n.value?.enablePagination && K && (X = !0,
|
|
993
|
+
function Ie(e, t) {
|
|
994
|
+
if (n.value?.enablePagination && K && (X = !0, Fe(e)), n.value?.enableEmptyDataWarningMessage && Array.isArray(e)) {
|
|
998
995
|
const i = t || e.length;
|
|
999
|
-
|
|
996
|
+
he(i < 1);
|
|
1000
997
|
}
|
|
1001
998
|
if (Array.isArray(e) && l && m?.setItems) {
|
|
1002
|
-
if (m.setItems(e, n.value.datasetIdPropertyName ?? "id"), !n.value.backendServiceApi && !n.value.enableTreeData && m.reSort(), e.length > 0 && (
|
|
1003
|
-
const i =
|
|
999
|
+
if (m.setItems(e, n.value.datasetIdPropertyName ?? "id"), !n.value.backendServiceApi && !n.value.enableTreeData && m.reSort(), e.length > 0 && (oe || (Ce(), n.value.enableCheckboxSelector && Ve()), oe = !0), e && l.invalidate(), X = !!(n.value && (n.value.enablePagination || n.value.backendServiceApi && n.value.enablePagination === void 0)), A.value && n.value?.pagination && n.value?.backendServiceApi) {
|
|
1000
|
+
const i = xe(
|
|
1004
1001
|
n.value,
|
|
1005
|
-
|
|
1002
|
+
A.value
|
|
1006
1003
|
), r = t !== void 0 ? t : n.value?.pagination?.totalItems;
|
|
1007
|
-
r !== void 0 && r !== k.value && (k.value = +r), W ?
|
|
1004
|
+
r !== void 0 && r !== k.value && (k.value = +r), W ? E.updateTotalItems(k.value) : Te(i);
|
|
1008
1005
|
}
|
|
1009
1006
|
if (l && n.value.enableAutoResize) {
|
|
1010
1007
|
const i = n.value.autoResize && n.value.autoResize.delay;
|
|
1011
|
-
|
|
1008
|
+
O.resizeGrid(i || 10);
|
|
1012
1009
|
}
|
|
1013
1010
|
}
|
|
1014
1011
|
}
|
|
1015
|
-
function
|
|
1016
|
-
return l?.setHeaderRowVisibility(e), e === !0 &&
|
|
1012
|
+
function Ct(e = !0) {
|
|
1013
|
+
return l?.setHeaderRowVisibility(e), e === !0 && ce && l?.setColumns(_.value), e;
|
|
1017
1014
|
}
|
|
1018
|
-
function
|
|
1015
|
+
function xe(e, t) {
|
|
1019
1016
|
return e.presets?.pagination && e.pagination && (ne() ? 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;
|
|
1020
1017
|
}
|
|
1021
|
-
function
|
|
1018
|
+
function ke(e = !1) {
|
|
1022
1019
|
c.gridContainerElement?.classList.toggle("slick-dark-mode", e);
|
|
1023
1020
|
}
|
|
1024
|
-
function
|
|
1025
|
-
e && (e =
|
|
1021
|
+
function vt(e) {
|
|
1022
|
+
e && (e = Be(e), n.value.autoAddCustomEditorFormatter && Ue(e, n.value.autoAddCustomEditorFormatter), n.value.enableTranslate ? y.translateColumnHeaders(void 0, e) : y.renderColumnHeaders(e, !0), n.value?.enableAutoSizeColumns ? l?.autosizeColumns() : n.value?.enableAutoResizeColumnsByCellContent && O?.resizeColumnsByCellContent && O.resizeColumnsByCellContent());
|
|
1026
1023
|
}
|
|
1027
|
-
function
|
|
1028
|
-
|
|
1024
|
+
function wt() {
|
|
1025
|
+
be.push(Jt(_.value, Ee));
|
|
1029
1026
|
}
|
|
1030
|
-
function
|
|
1027
|
+
function St(e) {
|
|
1031
1028
|
e.forEach((t) => t.originalWidth = t.width);
|
|
1032
1029
|
}
|
|
1033
|
-
function
|
|
1034
|
-
|
|
1030
|
+
function he(e = !0) {
|
|
1031
|
+
ae?.showEmptyDataMessage(e);
|
|
1035
1032
|
}
|
|
1036
|
-
function
|
|
1037
|
-
N = t,
|
|
1033
|
+
function Pe(e, t) {
|
|
1034
|
+
N = t, ye = {
|
|
1038
1035
|
startTime: /* @__PURE__ */ new Date(),
|
|
1039
1036
|
endTime: /* @__PURE__ */ new Date(),
|
|
1040
1037
|
itemCount: e,
|
|
1041
1038
|
totalItemCount: t
|
|
1042
|
-
}, Q && (Q.metrics =
|
|
1039
|
+
}, Q && (Q.metrics = ye), K && n.value?.enableEmptyDataWarningMessage && he(e === 0), n.value.enableAutoResize && O.isAutoHeightEnabled && e > 0 && O.resizeGrid();
|
|
1043
1040
|
}
|
|
1044
|
-
function
|
|
1045
|
-
n.value && (
|
|
1046
|
-
f.subscribe("onPaginationChanged", (t) =>
|
|
1041
|
+
function Te(e) {
|
|
1042
|
+
n.value && (E.totalItems = k.value, E.init(l, e, G), U.push(
|
|
1043
|
+
f.subscribe("onPaginationChanged", (t) => ht(t)),
|
|
1047
1044
|
f.subscribe("onPaginationVisibilityChanged", (t) => {
|
|
1048
|
-
X = t?.visible ?? !1, n.value?.backendServiceApi &&
|
|
1045
|
+
X = t?.visible ?? !1, n.value?.backendServiceApi && R?.refreshBackendDataset(n.value), _e(X);
|
|
1049
1046
|
})
|
|
1050
|
-
),
|
|
1047
|
+
), _e(), W = !0);
|
|
1051
1048
|
}
|
|
1052
|
-
function
|
|
1049
|
+
function bt(e) {
|
|
1053
1050
|
if (e?.editor) {
|
|
1054
1051
|
const t = e.editor.collectionAsync;
|
|
1055
1052
|
e.editor.disabled = !0, t instanceof Promise ? t.then((i) => {
|
|
1056
|
-
Array.isArray(i) ?
|
|
1053
|
+
Array.isArray(i) ? re(e, i) : i instanceof Response && typeof i.json == "function" ? i.bodyUsed ? console.warn(
|
|
1057
1054
|
"[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()"
|
|
1058
|
-
) : i.json().then((r) =>
|
|
1055
|
+
) : i.json().then((r) => re(e, r)) : i?.content && re(e, i.content);
|
|
1059
1056
|
}) : P?.isObservable(t) && queueMicrotask(() => {
|
|
1060
1057
|
U.push(
|
|
1061
|
-
t.subscribe((i) =>
|
|
1058
|
+
t.subscribe((i) => re(e, i))
|
|
1062
1059
|
);
|
|
1063
1060
|
});
|
|
1064
1061
|
}
|
|
1065
1062
|
}
|
|
1066
|
-
function
|
|
1067
|
-
if (
|
|
1068
|
-
const i =
|
|
1063
|
+
function ge(e, t) {
|
|
1064
|
+
if (w.value) {
|
|
1065
|
+
const i = w.value.findIndex((r) => r.id === e);
|
|
1069
1066
|
if (i >= 0) {
|
|
1070
|
-
const r =
|
|
1067
|
+
const r = w.value[i];
|
|
1071
1068
|
r?.id === e && !t.some((d) => d.id === e) && (i > 0 ? t.splice(i, 0, r) : t.unshift(r));
|
|
1072
1069
|
}
|
|
1073
1070
|
}
|
|
1074
1071
|
}
|
|
1075
|
-
function
|
|
1072
|
+
function yt() {
|
|
1076
1073
|
if (n.value.presets && Array.isArray(n.value.presets.columns) && n.value.presets.columns.length > 0) {
|
|
1077
1074
|
const e = V.getAssociatedGridColumns(l, n.value.presets.columns);
|
|
1078
|
-
if (e && Array.isArray(e) && e.length > 0 && Array.isArray(
|
|
1075
|
+
if (e && Array.isArray(e) && e.length > 0 && Array.isArray(w.value)) {
|
|
1079
1076
|
if (n.value.enableRowMoveManager) {
|
|
1080
1077
|
const t = n.value?.rowMoveManager?.columnId ?? "_move";
|
|
1081
|
-
|
|
1078
|
+
ge(t, e);
|
|
1082
1079
|
}
|
|
1083
1080
|
if (n.value.enableCheckboxSelector) {
|
|
1084
1081
|
const t = n.value?.checkboxSelector?.columnId ?? "_checkbox_selector";
|
|
1085
|
-
|
|
1082
|
+
ge(t, e);
|
|
1086
1083
|
}
|
|
1087
1084
|
if (n.value.enableRowDetailView) {
|
|
1088
1085
|
const t = n.value?.rowDetailView?.columnId ?? "_detail_selector";
|
|
1089
|
-
|
|
1086
|
+
ge(t, e);
|
|
1090
1087
|
}
|
|
1091
1088
|
e.forEach((t) => t.originalWidth = t.width), l?.setColumns(e), c.visibleColumns = e;
|
|
1092
1089
|
}
|
|
1093
1090
|
}
|
|
1094
1091
|
}
|
|
1095
|
-
function
|
|
1092
|
+
function Ce() {
|
|
1096
1093
|
n.value && n.value.presets && (Array.isArray(n.value.presets.filters) || Array.isArray(n.value.presets?.treeData?.toggledItems)) && v.populateColumnFilterSearchTermPresets(n.value.presets?.filters || []);
|
|
1097
1094
|
}
|
|
1098
|
-
function
|
|
1099
|
-
if (n.value &&
|
|
1100
|
-
if (k.value = Array.isArray(e) ? e.length : 0,
|
|
1095
|
+
function Fe(e) {
|
|
1096
|
+
if (n.value && A.value) {
|
|
1097
|
+
if (k.value = Array.isArray(e) ? e.length : 0, A.value && m?.getPagingInfo) {
|
|
1101
1098
|
const i = m.getPagingInfo();
|
|
1102
|
-
"totalRows" in i &&
|
|
1099
|
+
"totalRows" in i && A.value.totalItems !== i.totalRows && (k.value = i.totalRows || 0);
|
|
1103
1100
|
}
|
|
1104
|
-
|
|
1105
|
-
const t =
|
|
1106
|
-
|
|
1101
|
+
A.value.totalItems = k.value;
|
|
1102
|
+
const t = xe(n.value, A.value);
|
|
1103
|
+
Te(t);
|
|
1107
1104
|
}
|
|
1108
1105
|
}
|
|
1109
|
-
function
|
|
1106
|
+
function Ve() {
|
|
1110
1107
|
const e = n.value?.presets;
|
|
1111
1108
|
if (n.value && (n.value.enableCheckboxSelector || n.value.enableRowSelection) && l?.getSelectionModel() && e?.rowSelection && (Array.isArray(e.rowSelection.gridRowIndexes) || Array.isArray(e.rowSelection.dataContextIds))) {
|
|
1112
1109
|
let i = e.rowSelection.dataContextIds, r = e.rowSelection.gridRowIndexes;
|
|
@@ -1121,65 +1118,65 @@ const Cn = ["id"], vn = ["id"], wn = 1e4, In = /* @__PURE__ */ Qt({
|
|
|
1121
1118
|
function ne(e) {
|
|
1122
1119
|
return !!(e || n.value).backendServiceApi?.service.options?.infiniteScroll;
|
|
1123
1120
|
}
|
|
1124
|
-
function
|
|
1121
|
+
function At(e) {
|
|
1125
1122
|
e.gridId = a.gridId, e.gridContainerId = `slickGridContainer-${a.gridId}`;
|
|
1126
1123
|
const t = fn(!0, {}, Ze, e);
|
|
1127
1124
|
return ne(e) || (e.enablePagination = !!(e.backendServiceApi && e.enablePagination === void 0 || e.enablePagination)), t?.pagination && (e.enablePagination || e.backendServiceApi) && e.pagination && Array.isArray(e.pagination.pageSizes) && (t.pagination.pageSizes = e.pagination.pageSizes), Y = t.showHeaderRow === !1, t.enableFiltering && !t.showHeaderRow && (t.showHeaderRow = t.enableFiltering), t && !t.enableFiltering && t.enablePagination && K && (t.enableFiltering = !0, t.showHeaderRow = !1, Y = !0, c && (c.hideHeaderRowAfterPageLoad = !0)), t;
|
|
1128
1125
|
}
|
|
1129
|
-
function
|
|
1126
|
+
function Rt(e) {
|
|
1130
1127
|
if (Array.isArray(e))
|
|
1131
1128
|
for (const t of e)
|
|
1132
1129
|
l && typeof t.init == "function" && t.init(l, C);
|
|
1133
1130
|
}
|
|
1134
|
-
function
|
|
1131
|
+
function Ot() {
|
|
1135
1132
|
if (h = n.value?.externalResources || [], Array.isArray(h))
|
|
1136
1133
|
for (const e of h)
|
|
1137
|
-
e?.className === "RxJsResource" &&
|
|
1138
|
-
n.value.enableRowDetailView && !h.some((e) => e instanceof Qe) && (Z = new Qe(f), Z.create(
|
|
1134
|
+
e?.className === "RxJsResource" && Dt(e);
|
|
1135
|
+
n.value.enableRowDetailView && !h.some((e) => e instanceof Qe) && (Z = new Qe(f), Z.create(w.value, n.value), y.addExtensionToList($e.rowDetailView, {
|
|
1139
1136
|
name: $e.rowDetailView,
|
|
1140
1137
|
instance: Z
|
|
1141
1138
|
}));
|
|
1142
1139
|
}
|
|
1143
|
-
function
|
|
1144
|
-
Array.isArray(h) && (c.externalRegisteredResources = h), h.some((e) => e instanceof Ne) || h.push(ee), h.some((e) => e instanceof We) || h.push(V), (n.value.createPreHeaderPanel && n.value.createTopHeaderPanel || n.value.createPreHeaderPanel && !n.value.enableDraggableGrouping) && !h.some((e) => e instanceof Ke) && h.push(te), n.value.enableTreeData && !h.some((e) => e instanceof Le) && h.push(
|
|
1140
|
+
function Et() {
|
|
1141
|
+
Array.isArray(h) && (c.externalRegisteredResources = h), h.some((e) => e instanceof Ne) || h.push(ee), h.some((e) => e instanceof We) || h.push(V), (n.value.createPreHeaderPanel && n.value.createTopHeaderPanel || n.value.createPreHeaderPanel && !n.value.enableDraggableGrouping) && !h.some((e) => e instanceof Ke) && h.push(te), n.value.enableTreeData && !h.some((e) => e instanceof Le) && h.push(D), n.value.enableTranslate && y.translateColumnHeaders(), h.some((e) => e instanceof Ye) || (ae = new Ye(), h.push(ae)), Rt(h), n.value.enableRowDetailView && Z && Z.init(l);
|
|
1145
1142
|
}
|
|
1146
|
-
function
|
|
1147
|
-
P = e,
|
|
1143
|
+
function Dt(e) {
|
|
1144
|
+
P = e, R.addRxJsResource(P), Ae.addRxJsResource(P), v.addRxJsResource(P), b.addRxJsResource(P), E.addRxJsResource(P), C.registerInstance("RxJsResource", P);
|
|
1148
1145
|
}
|
|
1149
|
-
async function
|
|
1146
|
+
async function _e(e = !0) {
|
|
1150
1147
|
if (l && n.value?.enablePagination && !W && e) {
|
|
1151
1148
|
if (n.value.customPaginationComponent) {
|
|
1152
|
-
const t = document.createElement("section"), i =
|
|
1149
|
+
const t = document.createElement("section"), i = we(n.value.customPaginationComponent).mount(
|
|
1153
1150
|
t
|
|
1154
1151
|
);
|
|
1155
1152
|
s.value.appendChild(i.$el), F = i;
|
|
1156
1153
|
} else
|
|
1157
1154
|
F = new cn();
|
|
1158
1155
|
an(() => {
|
|
1159
|
-
F && (F.init(l,
|
|
1156
|
+
F && (F.init(l, E, f, T), F.renderPagination(s.value), W = !0);
|
|
1160
1157
|
});
|
|
1161
1158
|
} else e || (F?.dispose(), W = !1);
|
|
1162
1159
|
}
|
|
1163
|
-
function
|
|
1160
|
+
function Me(e, t = !1) {
|
|
1164
1161
|
const i = N;
|
|
1165
1162
|
let r, d = [];
|
|
1166
|
-
return
|
|
1163
|
+
return ue && q.value ? (r = D.sortHierarchicalDataset(q.value), d = r.flat) : Array.isArray(e) && e.length > 0 && (r = D.convertFlatParentChildToTreeDatasetAndSort(
|
|
1167
1164
|
e,
|
|
1168
|
-
|
|
1165
|
+
w.value || [],
|
|
1169
1166
|
n.value
|
|
1170
1167
|
), c.hierarchicalDataset = r.hierarchical, d = r.flat), e.length > 0 && (t || e.length !== i) && v.refreshTreeDataFilters(d), d;
|
|
1171
1168
|
}
|
|
1172
|
-
function
|
|
1169
|
+
function Be(e) {
|
|
1173
1170
|
return e.some((t) => `${t.id}`.includes(".")) && console.warn(
|
|
1174
1171
|
'[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".'
|
|
1175
|
-
), e.map((t) => (t.editor?.collectionAsync &&
|
|
1172
|
+
), e.map((t) => (t.editor?.collectionAsync && bt(t), { ...t, editorClass: t.editor?.model }));
|
|
1176
1173
|
}
|
|
1177
|
-
function
|
|
1174
|
+
function It() {
|
|
1178
1175
|
m.getItemCount() > wn && !n.value.silenceWarnings && !n.value.preParseDateColumns && l?.getColumns().some((e) => Xt(e.type)) && console.warn(
|
|
1179
1176
|
"[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"
|
|
1180
1177
|
);
|
|
1181
1178
|
}
|
|
1182
|
-
function
|
|
1179
|
+
function re(e, t) {
|
|
1183
1180
|
if (l && e.editor) {
|
|
1184
1181
|
e.editor.collection = t, e.editor.disabled = !1;
|
|
1185
1182
|
const i = l.getCellEditor();
|
|
@@ -1187,7 +1184,7 @@ const Cn = ["id"], vn = ["id"], wn = 1e4, In = /* @__PURE__ */ Qt({
|
|
|
1187
1184
|
}
|
|
1188
1185
|
}
|
|
1189
1186
|
return (e, t) => (sn(), rn("div", {
|
|
1190
|
-
id:
|
|
1187
|
+
id: nt.value,
|
|
1191
1188
|
ref_key: "elm",
|
|
1192
1189
|
ref: s,
|
|
1193
1190
|
class: "grid-pane"
|