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.
Files changed (44) hide show
  1. package/dist/components/SlickgridVue.vue.d.ts +44 -0
  2. package/dist/components/slickgridVueProps.interface.d.ts +274 -0
  3. package/dist/constants.d.ts +23 -0
  4. package/dist/extensions/slickRowDetailView.d.ts +81 -0
  5. package/dist/global-grid-options.d.ts +5 -0
  6. package/dist/index.cjs +2 -0
  7. package/dist/index.cjs.map +1 -0
  8. package/dist/index.d.cts +12 -0
  9. package/dist/index.d.ts +12 -0
  10. package/dist/index.mjs +1286 -0
  11. package/dist/index.mjs.map +1 -0
  12. package/dist/models/gridOption.interface.d.ts +12 -0
  13. package/dist/models/index.d.ts +5 -0
  14. package/dist/models/rowDetailView.interface.d.ts +13 -0
  15. package/dist/models/viewModelBindableData.interface.d.ts +9 -0
  16. package/dist/models/viewModelBindableInputData.interface.d.ts +8 -0
  17. package/dist/models/vueGridInstance.interface.d.ts +39 -0
  18. package/dist/services/container.service.d.ts +6 -0
  19. package/dist/services/index.d.ts +3 -0
  20. package/dist/services/translater.service.d.ts +27 -0
  21. package/dist/services/utilities.d.ts +7 -0
  22. package/dist/services/vueUtils.d.ts +16 -0
  23. package/dist/slickgrid-config.d.ts +5 -0
  24. package/package.json +75 -0
  25. package/src/assets/vue.svg +1 -0
  26. package/src/components/SlickgridVue.vue +1638 -0
  27. package/src/components/slickgridVueProps.interface.ts +150 -0
  28. package/src/constants.ts +95 -0
  29. package/src/extensions/slickRowDetailView.ts +416 -0
  30. package/src/global-grid-options.ts +288 -0
  31. package/src/index.ts +34 -0
  32. package/src/models/gridOption.interface.ts +16 -0
  33. package/src/models/index.ts +5 -0
  34. package/src/models/rowDetailView.interface.ts +16 -0
  35. package/src/models/viewModelBindableData.interface.ts +10 -0
  36. package/src/models/viewModelBindableInputData.interface.ts +9 -0
  37. package/src/models/vueGridInstance.interface.ts +77 -0
  38. package/src/services/container.service.ts +13 -0
  39. package/src/services/index.ts +3 -0
  40. package/src/services/translater.service.ts +41 -0
  41. package/src/services/utilities.ts +18 -0
  42. package/src/services/vueUtils.ts +26 -0
  43. package/src/slickgrid-config.ts +10 -0
  44. package/src/vite-env.d.ts +1 -0
@@ -0,0 +1,288 @@
1
+ import {
2
+ type Column,
3
+ DelimiterType,
4
+ EventNamingStyle,
5
+ FileType,
6
+ Filters,
7
+ OperatorType,
8
+ type TreeDataOption,
9
+ } from '@slickgrid-universal/common';
10
+
11
+ import type { GridOption, RowDetailView } from './models/index.js';
12
+
13
+ /**
14
+ * Default Options that can be passed to the Aurelia-Slickgrid
15
+ */
16
+ export const GlobalGridOptions: Partial<GridOption> = {
17
+ alwaysShowVerticalScroll: true,
18
+ autoEdit: false,
19
+ asyncEditorLoading: false,
20
+ autoFitColumnsOnFirstLoad: true,
21
+ autoResize: {
22
+ applyResizeToContainer: true,
23
+ calculateAvailableSizeBy: 'window',
24
+ bottomPadding: 20,
25
+ minHeight: 180,
26
+ minWidth: 300,
27
+ rightPadding: 0,
28
+ },
29
+ cellHighlightCssClass: 'slick-cell-modified',
30
+ checkboxSelector: {
31
+ cssClass: 'slick-cell-checkboxsel',
32
+ width: 40,
33
+ },
34
+ cellMenu: {
35
+ autoAdjustDrop: true,
36
+ autoAlignSide: true,
37
+ hideCloseButton: true,
38
+ hideCommandSection: false,
39
+ hideOptionSection: false,
40
+ },
41
+ columnGroupSeparator: ' - ',
42
+ columnPicker: {
43
+ hideForceFitButton: false,
44
+ hideSyncResizeButton: true,
45
+ headerColumnValueExtractor: pickerHeaderColumnValueExtractor,
46
+ },
47
+ compositeEditorOptions: {
48
+ labels: {
49
+ cancelButtonKey: 'CANCEL',
50
+ cloneButtonKey: 'CLONE',
51
+ resetEditorButtonTooltipKey: 'RESET_INPUT_VALUE',
52
+ resetFormButtonKey: 'RESET_FORM',
53
+ massSelectionButtonKey: 'APPLY_TO_SELECTION',
54
+ massSelectionStatusKey: 'X_OF_Y_MASS_SELECTED',
55
+ massUpdateButtonKey: 'APPLY_MASS_UPDATE',
56
+ massUpdateStatusKey: 'ALL_X_RECORDS_SELECTED',
57
+ saveButtonKey: 'SAVE',
58
+ },
59
+ resetEditorButtonCssClass: 'mdi mdi-refresh mdi-15px',
60
+ resetFormButtonIconCssClass: 'mdi mdi-refresh mdi-16px mdi-flip-h',
61
+ },
62
+ contextMenu: {
63
+ autoAdjustDrop: true,
64
+ autoAlignSide: true,
65
+ hideCloseButton: true,
66
+ hideClearAllGrouping: false,
67
+ hideCollapseAllGroups: false,
68
+ hideCommandSection: false,
69
+ hideCopyCellValueCommand: false,
70
+ hideExpandAllGroups: false,
71
+ hideExportCsvCommand: false,
72
+ hideExportExcelCommand: false,
73
+ hideExportTextDelimitedCommand: true,
74
+ hideMenuOnScroll: true,
75
+ hideOptionSection: false,
76
+ iconCollapseAllGroupsCommand: 'mdi mdi-arrow-collapse',
77
+ iconExpandAllGroupsCommand: 'mdi mdi-arrow-expand',
78
+ iconClearGroupingCommand: 'mdi mdi-close',
79
+ iconCopyCellValueCommand: 'mdi mdi-content-copy',
80
+ iconExportCsvCommand: 'mdi mdi-download',
81
+ iconExportExcelCommand: 'mdi mdi-file-excel-outline text-success',
82
+ iconExportTextDelimitedCommand: 'mdi mdi-download',
83
+ },
84
+ customFooterOptions: {
85
+ dateFormat: 'YYYY-MM-DD, hh:mm a',
86
+ hideRowSelectionCount: false,
87
+ hideTotalItemCount: false,
88
+ hideLastUpdateTimestamp: true,
89
+ footerHeight: 25,
90
+ leftContainerClass: 'col-xs-12 col-sm-5',
91
+ rightContainerClass: 'col-xs-6 col-sm-7',
92
+ metricSeparator: '|',
93
+ metricTexts: {
94
+ items: 'items',
95
+ itemsKey: 'ITEMS',
96
+ of: 'of',
97
+ ofKey: 'OF',
98
+ itemsSelected: 'items selected',
99
+ itemsSelectedKey: 'ITEMS_SELECTED',
100
+ },
101
+ },
102
+ dataView: {
103
+ // when enabled, this will preserve the row selection even after filtering/sorting/grouping
104
+ syncGridSelection: {
105
+ preserveHidden: false,
106
+ preserveHiddenOnSelectionChange: true,
107
+ },
108
+ syncGridSelectionWithBackendService: false, // but disable it when using backend services
109
+ },
110
+ datasetIdPropertyName: 'id',
111
+ defaultFilter: Filters.input,
112
+ defaultBackendServiceFilterTypingDebounce: 500,
113
+ defaultColumnSortFieldId: 'id',
114
+ defaultFilterPlaceholder: '🔎︎', // magnifying glass icon
115
+ defaultFilterRangeOperator: OperatorType.rangeInclusive,
116
+ editable: false,
117
+ editorTypingDebounce: 450,
118
+ filterTypingDebounce: 0,
119
+ enableEmptyDataWarningMessage: true,
120
+ enableFilterTrimWhiteSpace: false, // do we want to trim white spaces on all Filters?
121
+ emptyDataWarning: {
122
+ className: 'slick-empty-data-warning',
123
+ message: 'No data to display.',
124
+ messageKey: 'EMPTY_DATA_WARNING_MESSAGE',
125
+ hideFrozenLeftWarning: false,
126
+ hideFrozenRightWarning: false,
127
+ leftViewportMarginLeft: '40%',
128
+ rightViewportMarginLeft: '40%',
129
+ frozenLeftViewportMarginLeft: '0px',
130
+ frozenRightViewportMarginLeft: '40%',
131
+ },
132
+ enableAutoResize: true,
133
+ enableAutoSizeColumns: true,
134
+ enableCellNavigation: false,
135
+ enableColumnPicker: true,
136
+ enableColumnReorder: true,
137
+ enableColumnResizeOnDoubleClick: true,
138
+ enableContextMenu: true,
139
+ enableExcelExport: false,
140
+ enableTextExport: false,
141
+ enableGridMenu: true,
142
+ enableHeaderMenu: true,
143
+ enableMouseHoverHighlightRow: true,
144
+ enableSorting: true,
145
+ enableTextSelectionOnCells: true,
146
+ eventNamingStyle: EventNamingStyle.camelCaseWithExtraOnPrefix,
147
+ explicitInitialization: true,
148
+ excelExportOptions: {
149
+ addGroupIndentation: true,
150
+ exportWithFormatter: false,
151
+ filename: 'export',
152
+ format: FileType.xlsx,
153
+ groupingColumnHeaderTitle: 'Group By',
154
+ groupCollapsedSymbol: '⮞',
155
+ groupExpandedSymbol: '⮟',
156
+ groupingAggregatorRowText: '',
157
+ sanitizeDataExport: false,
158
+ },
159
+ textExportOptions: {
160
+ delimiter: DelimiterType.comma,
161
+ exportWithFormatter: false,
162
+ filename: 'export',
163
+ format: FileType.csv,
164
+ groupingColumnHeaderTitle: 'Group By',
165
+ groupingAggregatorRowText: '',
166
+ sanitizeDataExport: false,
167
+ useUtf8WithBom: true,
168
+ },
169
+ forceFitColumns: false,
170
+ frozenHeaderWidthCalcDifferential: 1,
171
+ gridMenu: {
172
+ dropSide: 'left',
173
+ commandLabels: {
174
+ clearAllFiltersCommandKey: 'CLEAR_ALL_FILTERS',
175
+ clearAllSortingCommandKey: 'CLEAR_ALL_SORTING',
176
+ clearFrozenColumnsCommandKey: 'CLEAR_PINNING',
177
+ exportCsvCommandKey: 'EXPORT_TO_CSV',
178
+ exportExcelCommandKey: 'EXPORT_TO_EXCEL',
179
+ exportTextDelimitedCommandKey: 'EXPORT_TO_TAB_DELIMITED',
180
+ refreshDatasetCommandKey: 'REFRESH_DATASET',
181
+ toggleDarkModeCommandKey: 'TOGGLE_DARK_MODE',
182
+ toggleFilterCommandKey: 'TOGGLE_FILTER_ROW',
183
+ togglePreHeaderCommandKey: 'TOGGLE_PRE_HEADER_ROW',
184
+ },
185
+ hideClearAllFiltersCommand: false,
186
+ hideClearAllSortingCommand: false,
187
+ hideClearFrozenColumnsCommand: true, // opt-in command
188
+ hideExportCsvCommand: false,
189
+ hideExportExcelCommand: false,
190
+ hideExportTextDelimitedCommand: true,
191
+ hideForceFitButton: false,
192
+ hideRefreshDatasetCommand: false,
193
+ hideSyncResizeButton: true,
194
+ hideToggleDarkModeCommand: true,
195
+ hideToggleFilterCommand: false,
196
+ hideTogglePreHeaderCommand: false,
197
+ iconCssClass: 'mdi mdi-menu',
198
+ iconClearAllFiltersCommand: 'mdi mdi-filter-remove-outline',
199
+ iconClearAllSortingCommand: 'mdi mdi-sort-variant-off',
200
+ iconClearFrozenColumnsCommand: 'mdi mdi-close',
201
+ iconExportCsvCommand: 'mdi mdi-download',
202
+ iconExportExcelCommand: 'mdi mdi-file-excel-outline',
203
+ iconExportTextDelimitedCommand: 'mdi mdi-download',
204
+ iconRefreshDatasetCommand: 'mdi mdi-sync',
205
+ iconToggleDarkModeCommand: 'mdi mdi-brightness-4 mdi mdi-brightness-4',
206
+ iconToggleFilterCommand: 'mdi mdi-flip-vertical',
207
+ iconTogglePreHeaderCommand: 'mdi mdi-flip-vertical',
208
+ menuWidth: 16,
209
+ resizeOnShowHeaderRow: true,
210
+ headerColumnValueExtractor: pickerHeaderColumnValueExtractor,
211
+ },
212
+ headerMenu: {
213
+ autoAlign: true,
214
+ autoAlignOffset: 12,
215
+ minWidth: 140,
216
+ iconClearFilterCommand: 'mdi mdi-filter-remove-outline',
217
+ iconClearSortCommand: 'mdi mdi-sort-variant-off',
218
+ iconFreezeColumns: 'mdi mdi-pin-outline',
219
+ iconSortAscCommand: 'mdi mdi-sort-ascending',
220
+ iconSortDescCommand: 'mdi mdi-sort-descending',
221
+ iconColumnHideCommand: 'mdi mdi-close',
222
+ iconColumnResizeByContentCommand: 'mdi mdi-arrow-expand-horizontal',
223
+ hideColumnResizeByContentCommand: false,
224
+ hideColumnHideCommand: false,
225
+ hideClearFilterCommand: false,
226
+ hideClearSortCommand: false,
227
+ hideFreezeColumnsCommand: true, // opt-in command
228
+ hideSortCommands: false,
229
+ },
230
+ multiColumnSort: true,
231
+ numberedMultiColumnSort: true,
232
+ tristateMultiColumnSort: false,
233
+ sortColNumberInSeparateSpan: true,
234
+ suppressActiveCellChangeOnEdit: false,
235
+ pagination: {
236
+ pageSizes: [10, 15, 20, 25, 30, 40, 50, 75, 100],
237
+ pageSize: 25,
238
+ totalItems: 0,
239
+ },
240
+ rowDetailView: {
241
+ collapseAllOnSort: true,
242
+ cssClass: 'detail-view-toggle',
243
+ panelRows: 1,
244
+ keyPrefix: '__',
245
+ useRowClick: false,
246
+ useSimpleViewportCalc: true,
247
+ saveDetailViewOnScroll: false,
248
+ } as RowDetailView,
249
+ headerRowHeight: 35,
250
+ rowHeight: 35,
251
+ topPanelHeight: 30,
252
+ preHeaderPanelWidth: '100%', // mostly useful for Draggable Grouping dropzone to take full width
253
+ translationNamespaceSeparator: ':',
254
+ resetFilterSearchValueAfterOnBeforeCancellation: true,
255
+ resizeByContentOnlyOnFirstLoad: true,
256
+ resizeByContentOptions: {
257
+ alwaysRecalculateColumnWidth: false,
258
+ cellCharWidthInPx: 7.8,
259
+ cellPaddingWidthInPx: 14,
260
+ defaultRatioForStringType: 0.88,
261
+ formatterPaddingWidthInPx: 0,
262
+ maxItemToInspectCellContentWidth: 1000,
263
+ maxItemToInspectSingleColumnWidthByContent: 5000,
264
+ widthToRemoveFromExceededWidthReadjustment: 50,
265
+ },
266
+ treeDataOptions: {
267
+ exportIndentMarginLeft: 5,
268
+ exportIndentationLeadingChar: '͏͏͏͏͏͏͏͏͏·',
269
+ } as unknown as TreeDataOption,
270
+ };
271
+
272
+ /**
273
+ * Value Extractor for both ColumnPicker & GridMenu Picker
274
+ * when using Column Header Grouping, we'll prefix the column group title
275
+ * else we'll simply return the column name title
276
+ */
277
+ function pickerHeaderColumnValueExtractor(column: Column, gridOptions?: GridOption) {
278
+ let colName = column?.columnPickerLabel ?? column?.name ?? '';
279
+ if (colName instanceof HTMLElement || colName instanceof DocumentFragment) {
280
+ colName = colName.textContent || '';
281
+ }
282
+ const headerGroup = column?.columnGroup || '';
283
+ const columnGroupSeparator = gridOptions?.columnGroupSeparator ?? ' - ';
284
+ if (headerGroup) {
285
+ return headerGroup + columnGroupSeparator + colName;
286
+ }
287
+ return colName;
288
+ }
package/src/index.ts ADDED
@@ -0,0 +1,34 @@
1
+ import { Aggregators, type Column, type Editors, Enums, type Filters, Formatters, GroupTotalFormatters, SortComparers, Utilities } from '@slickgrid-universal/common';
2
+ import { BindingService } from '@slickgrid-universal/binding';
3
+ import { EventPubSubService } from '@slickgrid-universal/event-pub-sub';
4
+ export * from '@slickgrid-universal/common';
5
+
6
+ import SlickgridVue from './components/SlickgridVue.vue';
7
+ import { SlickRowDetailView } from './extensions/slickRowDetailView.js';
8
+ import type { GridOption, RowDetailView, SlickgridVueInstance } from './models/index.js';
9
+ import type { SlickgridConfig } from './slickgrid-config.js';
10
+
11
+ // expose all public classes
12
+ export type { SlickgridVueProps } from './components/slickgridVueProps.interface.js';
13
+ export { disposeAllSubscriptions, TranslaterService } from './services/index.js';
14
+
15
+ export {
16
+ Aggregators,
17
+ type Column,
18
+ type Editors,
19
+ type Filters,
20
+ Enums,
21
+ EventPubSubService,
22
+ Formatters,
23
+ type GridOption,
24
+ GroupTotalFormatters,
25
+ type RowDetailView,
26
+ SlickgridConfig,
27
+ SlickgridVue,
28
+ type SlickgridVueInstance,
29
+ SlickRowDetailView,
30
+ SortComparers,
31
+ Utilities,
32
+ };
33
+
34
+ export { BindingService };
@@ -0,0 +1,16 @@
1
+ import type { BasePaginationModel, Column, GridOption as UniversalGridOption } from '@slickgrid-universal/common';
2
+ import type * as i18next from 'i18next';
3
+ import type { DefineComponent } from 'vue';
4
+
5
+ import type { RowDetailView } from './rowDetailView.interface.js';
6
+
7
+ export interface GridOption<C extends Column = Column> extends UniversalGridOption<C> {
8
+ /** External Custom Pagination Component that can be provided by the user */
9
+ customPaginationComponent?: DefineComponent<any, BasePaginationModel, any>;
10
+
11
+ /** I18N translation service instance */
12
+ i18n?: i18next.i18n;
13
+
14
+ /** Row Detail View Plugin options & events (columnId, cssClass, toolTip, width) */
15
+ rowDetailView?: RowDetailView;
16
+ }
@@ -0,0 +1,5 @@
1
+ export type * from './gridOption.interface.js';
2
+ export type * from './rowDetailView.interface.js';
3
+ export type * from './viewModelBindableData.interface.js';
4
+ export type * from './viewModelBindableInputData.interface.js';
5
+ export type * from './vueGridInstance.interface.js';
@@ -0,0 +1,16 @@
1
+ import type { RowDetailView as UniversalRowDetailView } from '@slickgrid-universal/common';
2
+ import type { DefineComponent } from 'vue';
3
+
4
+ export interface RowDetailView extends UniversalRowDetailView {
5
+ /**
6
+ * Optionally pass your Parent Component reference to your Child Component (row detail component).
7
+ * note:: If anyone finds a better way of passing the parent to the row detail extension, please reach out and/or create a PR
8
+ */
9
+ parent?: any;
10
+
11
+ /** View Model of the preload template which shows after opening row detail & before row detail data shows up */
12
+ preloadComponent?: DefineComponent<any, any, any>;
13
+
14
+ /** View Model template that will be loaded once the async function finishes */
15
+ viewComponent?: DefineComponent<any, any, any, any, any, any>;
16
+ }
@@ -0,0 +1,10 @@
1
+ import type { SlickDataView, SlickGrid } from '@slickgrid-universal/common';
2
+
3
+ export interface ViewModelBindableData {
4
+ template: string;
5
+ model: any;
6
+ addon: any;
7
+ grid: SlickGrid;
8
+ dataView: SlickDataView;
9
+ parent?: any;
10
+ }
@@ -0,0 +1,9 @@
1
+ import type { SlickDataView, SlickGrid } from '@slickgrid-universal/common';
2
+
3
+ export interface ViewModelBindableInputData {
4
+ model: any;
5
+ addon: any;
6
+ grid: SlickGrid;
7
+ dataView: SlickDataView;
8
+ parent?: any;
9
+ }
@@ -0,0 +1,77 @@
1
+ import type {
2
+ BackendService,
3
+ BasePaginationComponent,
4
+ ExtensionService,
5
+ FilterService,
6
+ GridEventService,
7
+ GridService,
8
+ GridStateService,
9
+ HeaderGroupingService,
10
+ PaginationService,
11
+ ResizerService,
12
+ SlickDataView,
13
+ SlickGrid,
14
+ SortService,
15
+ TreeDataService,
16
+ } from '@slickgrid-universal/common';
17
+ import type { EventPubSubService } from '@slickgrid-universal/event-pub-sub';
18
+
19
+ export interface SlickgridVueInstance {
20
+ element: HTMLDivElement;
21
+
22
+ /** Slick DataView object */
23
+ dataView: SlickDataView;
24
+
25
+ /** Slick Grid object */
26
+ slickGrid: SlickGrid;
27
+
28
+ // --
29
+ // Methods
30
+ /** Dispose of the grid and optionally empty the DOM element grid container as well */
31
+ dispose: (emptyDomElementContainer?: boolean) => void;
32
+
33
+ // --
34
+ // Services
35
+
36
+ /** Backend Service, when available */
37
+ backendService?: BackendService;
38
+
39
+ /** EventPubSub Service instance that is used internal by the lib and could be used externally to subscribe to Aurelia-Slickgrid events */
40
+ eventPubSubService?: EventPubSubService;
41
+
42
+ /** Extension (Plugins & Controls) Service */
43
+ extensionService: ExtensionService;
44
+
45
+ /** Filter Service */
46
+ filterService: FilterService;
47
+
48
+ /** Grid Service (grid extra functionalities) */
49
+ gridService: GridService;
50
+
51
+ /** Grid Events Service */
52
+ gridEventService: GridEventService;
53
+
54
+ /** Grid State Service */
55
+ gridStateService: GridStateService;
56
+
57
+ /** @deprecated @use `headerGroupingService` */
58
+ groupingService: HeaderGroupingService;
59
+
60
+ /** Grouping (and colspan) Service */
61
+ headerGroupingService: HeaderGroupingService;
62
+
63
+ /** Pagination Component */
64
+ paginationComponent?: BasePaginationComponent;
65
+
66
+ /** Pagination Service (allows you to programmatically go to first/last page, etc...) */
67
+ paginationService?: PaginationService;
68
+
69
+ /** Resizer Service (including auto-resize) */
70
+ resizerService: ResizerService;
71
+
72
+ /** Sort Service */
73
+ sortService: SortService;
74
+
75
+ /** Tree Data View Service */
76
+ treeDataService: TreeDataService;
77
+ }
@@ -0,0 +1,13 @@
1
+ import type { ContainerService as UniversalContainerService } from '@slickgrid-universal/common';
2
+
3
+ export class ContainerService implements UniversalContainerService {
4
+ private readonly container: { [key: string]: any } = {};
5
+
6
+ get<T = any>(key: string): T | null {
7
+ return this.container[key];
8
+ }
9
+
10
+ registerInstance(key: string, instance: any) {
11
+ this.container[key] = instance;
12
+ }
13
+ }
@@ -0,0 +1,3 @@
1
+ export * from './container.service.js';
2
+ export * from './translater.service.js';
3
+ export * from './utilities.js';
@@ -0,0 +1,41 @@
1
+ import type { TranslaterService as UniversalTranslateService } from '@slickgrid-universal/common';
2
+ import { type i18n } from 'i18next';
3
+ import { useTranslation } from 'i18next-vue';
4
+
5
+ /**
6
+ * This is a Translate Service Wrapper for Slickgrid-Universal monorepo lib to work properly,
7
+ * it must implement Slickgrid-Universal TranslaterService interface to work properly
8
+ */
9
+ export class TranslaterService implements UniversalTranslateService {
10
+ public i18n: i18n;
11
+
12
+ constructor() {
13
+ this.i18n = useTranslation().i18next;
14
+ }
15
+
16
+ /**
17
+ * Method to return the current language used by the App
18
+ * @return {string} current language
19
+ */
20
+ getCurrentLanguage(): string {
21
+ return this.i18n.language;
22
+ }
23
+
24
+ /**
25
+ * Method to set the language to use in the App and Translate Service
26
+ * @param {string} language
27
+ * @return {Promise} output
28
+ */
29
+ async use(newLang: string): Promise<any> {
30
+ return this.i18n.changeLanguage(newLang);
31
+ }
32
+
33
+ /**
34
+ * Method which receives a translation key and returns the translated value assigned to that key
35
+ * @param {string} translation key
36
+ * @return {string} translated value
37
+ */
38
+ translate(translationKey: string): string {
39
+ return this.i18n.t(translationKey);
40
+ }
41
+ }
@@ -0,0 +1,18 @@
1
+ import type { EventSubscription } from '@slickgrid-universal/common';
2
+
3
+ /**
4
+ * Loop through and dispose of all subscriptions when they are disposable
5
+ * @param subscriptions
6
+ * @return empty array
7
+ */
8
+ export function disposeAllSubscriptions(subscriptions: Array<EventSubscription>): Array<EventSubscription> {
9
+ if (Array.isArray(subscriptions)) {
10
+ while (subscriptions.length > 0) {
11
+ const subscription = subscriptions.pop() as EventSubscription;
12
+ if ((subscription as EventSubscription)?.unsubscribe) {
13
+ (subscription as EventSubscription).unsubscribe!();
14
+ }
15
+ }
16
+ }
17
+ return subscriptions;
18
+ }
@@ -0,0 +1,26 @@
1
+ import { createVNode, render, type VNode, type VNodeProps } from 'vue';
2
+
3
+ type Data = Record<string, unknown>;
4
+ interface MountOptions {
5
+ props: (Data & VNodeProps) | null;
6
+ children: unknown;
7
+ element: HTMLElement | null;
8
+ app: any;
9
+ }
10
+
11
+ export function mount(component: any, { props, children, element, app } = {} as Partial<MountOptions>) {
12
+ let el = element;
13
+
14
+ let vNode: VNode | null = createVNode(component, props, children);
15
+ if (app && app._context) vNode.appContext = app._context;
16
+ if (el) render(vNode, el);
17
+ else if (typeof document !== 'undefined') render(vNode, (el = document.createElement('div')));
18
+
19
+ const destroy = () => {
20
+ if (el) render(null, el);
21
+ el = null;
22
+ vNode = null;
23
+ };
24
+
25
+ return { vNode, destroy, el };
26
+ }
@@ -0,0 +1,10 @@
1
+ import { GlobalGridOptions } from './global-grid-options.js';
2
+ import type { GridOption } from './models/gridOption.interface.js';
3
+
4
+ export class SlickgridConfig {
5
+ options: Partial<GridOption>;
6
+
7
+ constructor() {
8
+ this.options = GlobalGridOptions;
9
+ }
10
+ }
@@ -0,0 +1 @@
1
+ /// <reference types="vite/client" />