slickgrid-vue 1.0.2 → 1.1.1

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/README.md CHANGED
@@ -7,9 +7,6 @@
7
7
  [![npm bundle size](https://img.shields.io/bundlephobia/minzip/slickgrid-vue?color=success&label=gzip)](https://bundlephobia.com/result?p=slickgrid-vue)
8
8
  [![Actions Status](https://github.com/ghiscoding/slickgrid-universal/actions/workflows/vue-cypress.yml/badge.svg)](https://github.com/ghiscoding/slickgrid-universal/actions/workflows/vue-cypress.yml)
9
9
 
10
- > [!WARNING]
11
- > Please note that Slickgrid-Vue is still in active development and usage might change depending on feedback provided by external users like you. However, I don't expect much changes since all examples are working as expected. Give it a try and star ⭐ the project if you like it, thanks!
12
-
13
10
  ## Description
14
11
  SlickGrid-Vue is a custom component created specifically for [VueJS](https://vuejs.org/) framework, it is a wrapper on top of Slickgrid-Universal library which contains the core functionalities. Slickgrid-Universal is written with TypeScript in browser native code, it is framework agnostic and is a monorepo that includes all Editors, Filters, Extensions and Services related to SlickGrid usage with also a few optional packages (like GraphQL, OData, Export to Excel, ...).
15
12
 
@@ -31,21 +28,23 @@ import { type Column, type GridOption, SlickgridVue } from 'slickgrid-vue';
31
28
  const columnDefinitions: Ref<Column[]> = ref([
32
29
  { id: 'firstName', name: 'First Name', field: 'firstName', sortable: true },
33
30
  { id: 'lastName', name: 'Last Name', field: 'lastName', sortable: true },
34
- { id: 'age', name: 'Age', field: 'age', type: 'number', sortable: true }
31
+ { id: 'age', name: 'Age', field: 'age', type: 'number', sortable: true },
35
32
  ]);
36
33
  const dataset = ref([
37
34
  { id: 1, firstName: 'John', lastName: 'Doe', age: 20 },
38
- { id: 2, firstName: 'Jane', lastName: 'Smith', age: 21 }
35
+ { id: 2, firstName: 'Jane', lastName: 'Smith', age: 21 },
39
36
  ]);
40
37
  const gridOptions = ref<GridOption>({ /*...*/ }); // optional grid options
41
38
  </script>
42
39
 
43
- <slickgrid-vue
40
+ <template>
41
+ <slickgrid-vue
44
42
  grid-id="grid1"
45
43
  v-model:columns="columnDefinitions"
46
44
  v-model:data="dataset"
47
45
  v-model:options="gridOptions"
48
- ></slickgrid-vue>
46
+ ></slickgrid-vue>
47
+ </template>
49
48
  ```
50
49
 
51
50
  #### Requirements
@@ -53,11 +52,12 @@ const gridOptions = ref<GridOption>({ /*...*/ }); // optional grid options
53
52
 
54
53
  ### Stackblitz
55
54
 
56
- You can also play with the live Stackbliz [Slickgrid-Vite-Demos](https://github.com/ghiscoding/slickgrid-vue-demos). It is also the recommended way to provide a repro when opening a new bug/feature request.
55
+ You can also play with the live Stackbliz [Slickgrid-Vue-Demos](https://github.com/ghiscoding/slickgrid-vue-demos).
56
+ Stackblitz is also the recommended way to provide a repro when opening a new bug or feature request.
57
57
 
58
58
  [![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/ghiscoding/slickgrid-vue-demos)
59
59
 
60
- Visit the **[Docs - Quick Start](https://ghiscoding.gitbook.io/slickgrid-vue/getting-started/quick-start)** and/or clone the [Slickgrid-Vue-Demos](https://github.com/ghiscoding/slickgrid-vue-demos) repository for a local demo. Please make sure to read the documentation before opening any new issue and also consider asking installation and/or general questions on [Stack Overflow](https://stackoverflow.com/search?tab=newest&q=slickgrid) unless you think there's a bug with the library.
60
+ Visit the **[Docs - Quick Start](https://ghiscoding.gitbook.io/slickgrid-vue/getting-started/quick-start)** and/or clone the [Slickgrid-Vue-Demos](https://github.com/ghiscoding/slickgrid-vue-demos) repository for a fully working local demo. Please make sure to read the documentation before opening any new issue and also consider asking installation and/or general questions on [Stack Overflow](https://stackoverflow.com/search?tab=newest&q=slickgrid) unless you think there's a bug with the library.
61
61
 
62
62
  ### Styling Themes
63
63
 
@@ -67,14 +67,14 @@ Multiple styling themes are available
67
67
  - Material (see [Slickgrid-Universal](https://ghiscoding.github.io/slickgrid-universal/#/example07))
68
68
  - Salesforce (see [Slickgrid-Universal](https://ghiscoding.github.io/slickgrid-universal/#/example16))
69
69
 
70
- Also note that all of these themes also have a **Dark Theme** equivalent and even though Bootstrap is often used for live demos, it does work well with any other UI framework like Bulma, Material, Quasar...
70
+ Also note that all of these themes also include a **Dark Theme** equivalent and even though Bootstrap is often used in the live demos, it also works well with any other UI framework like Bulma, Material, Quasar...
71
71
 
72
72
  ### Live Demo page
73
- `Slickgrid-Vue` works with all Bootstrap versions, you can see a demo of each one below. It also works well with any other frameworks like Material, Bulma, Quasar... and there are also extra styling themes based on Material & Salesforce which are also available. You can also use different SVG icons, you may want to look at the [Docs - SVG Icons](https://ghiscoding.gitbook.io/slickgrid-vue/styling/svg-icons)
73
+ `Slickgrid-Vue` works with Bootstrap or any other UI frameworks like Material, Bulma, Quasar... and there are also extra styling themes based on Material & Salesforce which are also available. You can also use different SVG icons, you may want to look at the [Docs - SVG Icons](https://ghiscoding.gitbook.io/slickgrid-vue/styling/svg-icons)
74
74
  - [Bootstrap 5 demo](https://ghiscoding.github.io/slickgrid-vue-demos) / [examples repo](https://github.com/ghiscoding/slickgrid-vue-demos)
75
75
 
76
76
  #### Working Demos
77
- For a complete set of working demos (40+ examples), we strongly suggest you to clone the [Slickgrid-Vue Demos](https://github.com/ghiscoding/slickgrid-vue-demos) repository (instructions are provided in it). The repo comes with multiple examples and are updated frequently (basically every time a new version is out) and it is also used as the GitHub live demo page.
77
+ For a complete set of working demos (45+ examples), we strongly suggest you to clone the [Slickgrid-Vue Demos](https://github.com/ghiscoding/slickgrid-vue-demos) repository (instructions are provided in it). The repo comes with multiple examples and are updated frequently (basically every time a new version is out) and it is also used as the GitHub [live demo]([https://github.com/ghiscoding/slickgrid-vue-demos](https://ghiscoding.github.io/slickgrid-vue-demos/) page.
78
78
 
79
79
  ## License
80
80
  [MIT License](LICENSE)
@@ -83,9 +83,9 @@ For a complete set of working demos (40+ examples), we strongly suggest you to c
83
83
  Check out the [Releases](https://github.com/ghiscoding/slickgrid-universal/releases) section for all latest News & Releases.
84
84
 
85
85
  ### Tested with [Cypress](https://www.cypress.io/) (E2E Tests)
86
- Slickgrid-Universal has **100%** Unit Test Coverage and all Slickgrid-Vue Examples are tested with [Cypress](https://www.cypress.io/) for E2E testing and they run anytime a new PR is created.
86
+ Slickgrid-Universal has **100%** Unit Test Coverage and all Slickgrid-Vue Examples are tested with [Cypress](https://www.cypress.io/) for E2E testing and they are running on every new PR.
87
87
 
88
88
  ### Like it? ⭐ it
89
- You like **Slickgrid-Vue**? Be sure to upvote ⭐, and perhaps support me with caffeine [☕](https://ko-fi.com/ghiscoding) or sponsor me on GitHub and feel free to contribute at any time. Thanks
89
+ You like **Slickgrid-Vue**? Be sure to upvote the project, and perhaps support me with caffeine [☕](https://ko-fi.com/ghiscoding) or sponsor me on GitHub. Any contributions are also very welcome. Thanks
90
90
 
91
- <a href='https://ko-fi.com/ghiscoding' target='_blank'><img height='32' style='border:0px;height:32px;' src='https://az743702.vo.msecnd.net/cdn/kofi3.png?v=0' border='0' alt='Buy Me a Coffee at ko-fi.com' />
91
+ <a href='https://ko-fi.com/N4N679OT' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi3.png?v=6' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a>
package/dist/index.d.ts CHANGED
@@ -28,8 +28,6 @@ import { GroupTotalFormatters } from '@slickgrid-universal/common';
28
28
  import { HeaderButtonOnCommandArgs } from '@slickgrid-universal/common';
29
29
  import { HeaderGroupingService } from '@slickgrid-universal/common';
30
30
  import { HeaderMenuCommandItemCallbackArgs } from '@slickgrid-universal/common';
31
- import { i18n } from 'i18next';
32
- import type * as i18next from 'i18next';
33
31
  import { MenuCommandItemCallbackArgs } from '@slickgrid-universal/common';
34
32
  import { MenuFromCellCallbackArgs } from '@slickgrid-universal/common';
35
33
  import { MenuOptionItemCallbackArgs } from '@slickgrid-universal/common';
@@ -87,7 +85,6 @@ import { SingleColumnSort } from '@slickgrid-universal/common';
87
85
  import { SlickControlList } from '@slickgrid-universal/common';
88
86
  import { SlickDataView } from '@slickgrid-universal/common';
89
87
  import { SlickEventData } from '@slickgrid-universal/common';
90
- import { SlickEventHandler } from '@slickgrid-universal/common';
91
88
  import { SlickGrid } from '@slickgrid-universal/common';
92
89
  import { SlickPluginList } from '@slickgrid-universal/common';
93
90
  import { SlickRange } from '@slickgrid-universal/common';
@@ -150,12 +147,15 @@ declare type __VLS_WithTemplateSlots<T, S> = T & {
150
147
 
151
148
  export { Aggregators }
152
149
 
150
+ declare type Callback = (error: any, t: Function) => void;
151
+
153
152
  export { Column }
154
153
 
155
154
  declare interface CreatedView {
156
155
  id: string | number;
157
156
  dataContext: any;
158
157
  app: App | null;
158
+ rendered?: boolean;
159
159
  instance: ComponentPublicInstance | null;
160
160
  }
161
161
 
@@ -180,13 +180,40 @@ export declare interface GridOption<C extends Column = Column> extends GridOptio
180
180
  /** External Custom Pagination Component that can be provided by the user */
181
181
  customPaginationComponent?: DefineComponent<any, BasePaginationModel, any>;
182
182
  /** I18N translation service instance */
183
- i18n?: i18next.i18n;
183
+ i18n?: I18Next;
184
184
  /** Row Detail View Plugin options & events (columnId, cssClass, toolTip, width) */
185
185
  rowDetailView?: RowDetailView;
186
186
  }
187
187
 
188
188
  export { GroupTotalFormatters }
189
189
 
190
+ declare interface I18Next {
191
+ /**
192
+ * Is set to the current detected or set language.
193
+ * If you need the primary used language depending on your configuration (supportedLngs, load) you will prefer using i18next.languages[0].
194
+ */
195
+ language: string;
196
+ /**
197
+ * Changes the language. The callback will be called as soon translations were loaded or an error occurs while loading.
198
+ * HINT: For easy testing - setting lng to 'cimode' will set t function to always return the key.
199
+ */
200
+ changeLanguage(lng?: string, callback?: Callback): Promise<Function>;
201
+ /**
202
+ * Gets fired when changeLanguage got called.
203
+ */
204
+ on(event: 'languageChanged', callback: (lng: string) => void): void;
205
+ /**
206
+ * Event listener
207
+ */
208
+ on(event: string, listener: (...args: any[]) => void): void;
209
+ /**
210
+ * Remove event listener
211
+ * removes all callback when callback not specified
212
+ */
213
+ off(event: string, listener?: (...args: any[]) => void): void;
214
+ t(key: string, options?: any): string;
215
+ }
216
+
190
217
  export declare interface RowDetailView extends RowDetailView_2 {
191
218
  /**
192
219
  * Optionally pass your Parent Component reference to your Child Component (row detail component).
@@ -663,6 +690,7 @@ export declare class SlickRowDetailView extends SlickRowDetailView_2 {
663
690
  private readonly eventPubSubService;
664
691
  protected _component?: any;
665
692
  protected _preloadComponent?: any;
693
+ protected _preloadApp?: App<Element>;
666
694
  protected _views: CreatedView[];
667
695
  protected _subscriptions: EventSubscription[];
668
696
  protected _userProcessFn?: (item: any) => Promise<any>;
@@ -670,14 +698,13 @@ export declare class SlickRowDetailView extends SlickRowDetailView_2 {
670
698
  constructor(eventPubSubService: EventPubSubService);
671
699
  get addonOptions(): RowDetailViewOption;
672
700
  protected get datasetIdPropName(): string;
673
- get eventHandler(): SlickEventHandler;
674
- set eventHandler(eventHandler: SlickEventHandler);
675
701
  get gridOptions(): GridOption;
676
702
  get rowDetailViewOptions(): RowDetailView | undefined;
677
703
  /** Dispose of the RowDetailView Extension */
678
704
  dispose(): void;
679
705
  /** Dispose of all the opened Row Detail Panels Components */
680
706
  disposeAllViewComponents(): void;
707
+ disposeViewByItem(item: any, removeFromArray?: boolean): void;
681
708
  /** Get the instance of the SlickGrid addon (control or plugin). */
682
709
  getAddonInstance(): SlickRowDetailView | null;
683
710
  init(grid: SlickGrid): void;
@@ -687,16 +714,22 @@ export declare class SlickRowDetailView extends SlickRowDetailView_2 {
687
714
  */
688
715
  register(rowSelectionPlugin?: SlickRowSelectionModel): this;
689
716
  /** Redraw (re-render) all the expanded row detail View Components */
690
- redrawAllViewComponents(): Promise<void>;
717
+ redrawAllViewComponents(forceRedraw?: boolean): void;
691
718
  /** Render all the expanded row detail View Components */
692
- renderAllViewModels(): Promise<void>;
719
+ renderAllViewModels(): void;
693
720
  /** Redraw the necessary View Component */
694
- redrawViewComponent(view: CreatedView): Promise<void>;
721
+ redrawViewComponent(view: CreatedView): void;
695
722
  /** Render (or re-render) the View Component (Row Detail) */
696
- renderPreloadView(item: any): Promise<void>;
723
+ renderPreloadView(item: any): void;
697
724
  /** Render (or re-render) the View Component (Row Detail) */
698
- renderViewModel(item: any): Promise<void>;
699
- protected addViewInfoToViewsRef(item: any, app: App | null, instance: ComponentPublicInstance | null): void;
725
+ renderViewModel(item: any): void;
726
+ /** remove any previous mounted views, if found then unmount them and delete them from our references array */
727
+ protected unmountViewWhenExists(itemId: string | number): void;
728
+ protected upsertViewRefs(item: any, options: {
729
+ app: App | null;
730
+ instance: ComponentPublicInstance | null;
731
+ rendered: boolean;
732
+ }): void;
700
733
  protected disposeViewComponent(expandedView: CreatedView): CreatedView | void;
701
734
  /**
702
735
  * Just before the row get expanded or collapsed we will do the following
@@ -716,7 +749,7 @@ export declare class SlickRowDetailView extends SlickRowDetailView_2 {
716
749
  expandedRows: (string | number)[];
717
750
  rowIdsOutOfViewport: (string | number)[];
718
751
  grid: SlickGrid;
719
- }): Promise<void>;
752
+ }): void;
720
753
  /**
721
754
  * notify the onAsyncResponse with the "args.item" (required property)
722
755
  * the plugin will then use item to populate the row detail panel with the "postTemplate"
@@ -737,9 +770,9 @@ export { SortComparers }
737
770
  * it must implement Slickgrid-Universal TranslaterService interface to work properly
738
771
  */
739
772
  export declare class TranslaterI18NextService implements TranslaterService {
740
- i18n?: i18n;
773
+ i18n?: I18Next;
741
774
  /** I18Next instance setter */
742
- set i18nInstance(i18n: i18n);
775
+ set i18nInstance(i18n: I18Next);
743
776
  /**
744
777
  * Method to return the current language used by the App
745
778
  * @return {string} current language