slickgrid-react 4.0.2 → 4.2.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/README.md +3 -0
- package/dist/cjs/components/slickgrid-react.js +4 -3
- package/dist/cjs/components/slickgrid-react.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/models/index.js +0 -1
- package/dist/cjs/models/index.js.map +1 -1
- package/dist/esm/components/slickgrid-react.js +5 -4
- package/dist/esm/components/slickgrid-react.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/models/index.js +0 -1
- package/dist/esm/models/index.js.map +1 -1
- package/dist/types/components/slickgrid-react.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/models/index.d.ts +0 -1
- package/dist/types/models/index.d.ts.map +1 -1
- package/dist/types/models/slickgridReactInstance.interface.d.ts +1 -2
- package/dist/types/models/slickgridReactInstance.interface.d.ts.map +1 -1
- package/package.json +33 -28
- package/src/slickgrid-react/components/slickgrid-react.tsx +1600 -0
- package/src/slickgrid-react/components/slickgridEventAggregator.ts +12 -0
- package/src/slickgrid-react/components/slickgridReactProps.ts +195 -0
- package/src/slickgrid-react/constants.ts +89 -0
- package/src/slickgrid-react/global-grid-options.ts +262 -0
- package/src/slickgrid-react/index.ts +28 -0
- package/src/slickgrid-react/models/gridOption.interface.ts +7 -0
- package/src/slickgrid-react/models/index.ts +3 -0
- package/src/slickgrid-react/models/reactComponentOutput.interface.ts +7 -0
- package/src/slickgrid-react/models/slickgridReactInstance.interface.ts +70 -0
- package/src/slickgrid-react/services/container.service.ts +13 -0
- package/src/slickgrid-react/services/index.ts +4 -0
- package/src/slickgrid-react/services/reactUtil.service.ts +26 -0
- package/src/slickgrid-react/services/singletons.ts +7 -0
- package/src/slickgrid-react/services/translater.service.ts +36 -0
- package/src/slickgrid-react/services/utilities.ts +18 -0
- package/src/slickgrid-react/slickgrid-config.ts +10 -0
- package/.gitbook.yaml +0 -5
- package/dist/cjs/models/slickGrid.interface.js +0 -3
- package/dist/cjs/models/slickGrid.interface.js.map +0 -1
- package/dist/esm/models/slickGrid.interface.js +0 -2
- package/dist/esm/models/slickGrid.interface.js.map +0 -1
- package/dist/types/models/slickGrid.interface.d.ts +0 -7
- package/dist/types/models/slickGrid.interface.d.ts.map +0 -1
- package/global.d.ts +0 -2
- package/tsconfig.json +0 -44
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { 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,26 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
import { SlickgridReactComponentOutput } from '../models/reactComponentOutput.interface';
|
|
4
|
+
|
|
5
|
+
export class ReactUtilService {
|
|
6
|
+
createReactComponentAppendToDom(component: any, targetElement?: HTMLElement | Element, clearTargetContent = false, props: any = undefined, children: ReactNode[] = []): SlickgridReactComponentOutput {
|
|
7
|
+
const componentElement = React.createElement(component, props, children);
|
|
8
|
+
let componentInstance: any;
|
|
9
|
+
|
|
10
|
+
// Append DOM element to the HTML element specified
|
|
11
|
+
if (targetElement) {
|
|
12
|
+
if (clearTargetContent && targetElement.innerHTML) {
|
|
13
|
+
targetElement.innerHTML = '';
|
|
14
|
+
}
|
|
15
|
+
// @ts-ignore
|
|
16
|
+
componentInstance = ReactDOM.render(componentElement, targetElement);
|
|
17
|
+
} else {
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
componentInstance = ReactDOM.render(componentElement, document.body);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const domElement = ReactDOM.findDOMNode(componentInstance);
|
|
23
|
+
|
|
24
|
+
return { componentInstance, componentElement, domElement };
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SharedService } from '@slickgrid-universal/common';
|
|
2
|
+
import { EventPubSubService } from '@slickgrid-universal/event-pub-sub';
|
|
3
|
+
import { ContainerService } from './container.service';
|
|
4
|
+
|
|
5
|
+
export const GlobalEventPubSubService = new EventPubSubService();
|
|
6
|
+
export const GlobalEventSharedService = new SharedService();
|
|
7
|
+
export const GlobalContainerService = new ContainerService();
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { TranslaterService as UniversalTranslateService } from '@slickgrid-universal/common';
|
|
2
|
+
import i18next, { i18n } from 'i18next';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* This is a Translate Service Wrapper for Slickgrid-Universal monorepo lib to work properly,
|
|
6
|
+
* it must implement Slickgrid-Universal TranslaterService interface to work properly
|
|
7
|
+
*/
|
|
8
|
+
export class TranslaterService implements UniversalTranslateService {
|
|
9
|
+
private readonly i18n: i18n = i18next;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Method to return the current language used by the App
|
|
13
|
+
* @return {string} current language
|
|
14
|
+
*/
|
|
15
|
+
getCurrentLanguage(): string {
|
|
16
|
+
return this.i18n.language;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Method to set the language to use in the App and Translate Service
|
|
21
|
+
* @param {string} language
|
|
22
|
+
* @return {Promise} output
|
|
23
|
+
*/
|
|
24
|
+
async use(newLang: string): Promise<any> {
|
|
25
|
+
return this.i18n.changeLanguage(newLang);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Method which receives a translation key and returns the translated value assigned to that key
|
|
30
|
+
* @param {string} translation key
|
|
31
|
+
* @return {string} translated value
|
|
32
|
+
*/
|
|
33
|
+
translate(translationKey: string): string {
|
|
34
|
+
return this.i18n.t(translationKey);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { 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
|
+
}
|
package/.gitbook.yaml
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slickGrid.interface.js","sourceRoot":"","sources":["../../../src/slickgrid-react/models/slickGrid.interface.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slickGrid.interface.js","sourceRoot":"","sources":["../../../src/slickgrid-react/models/slickGrid.interface.ts"],"names":[],"mappings":""}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { SlickGrid as UniversalSlickGrid } from '@slickgrid-universal/common';
|
|
2
|
-
import { GridOption } from './gridOption.interface';
|
|
3
|
-
export interface SlickGrid extends UniversalSlickGrid {
|
|
4
|
-
/** Returns an object containing all of the Grid options set on the grid. See a list of Grid Options here. */
|
|
5
|
-
getOptions(): GridOption;
|
|
6
|
-
}
|
|
7
|
-
//# sourceMappingURL=slickGrid.interface.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"slickGrid.interface.d.ts","sourceRoot":"","sources":["../../../src/slickgrid-react/models/slickGrid.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,IAAI,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,MAAM,WAAW,SAAU,SAAQ,kBAAkB;IACnD,8GAA8G;IAC9G,UAAU,IAAI,UAAU,CAAC;CAC1B"}
|
package/global.d.ts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compileOnSave": false,
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es2018",
|
|
5
|
-
"module": "esnext",
|
|
6
|
-
"sourceMap": true,
|
|
7
|
-
"allowSyntheticDefaultImports": true,
|
|
8
|
-
"downlevelIteration": true,
|
|
9
|
-
"emitDecoratorMetadata": true,
|
|
10
|
-
"experimentalDecorators": true,
|
|
11
|
-
"esModuleInterop": true,
|
|
12
|
-
"moduleResolution": "node",
|
|
13
|
-
"allowJs": true,
|
|
14
|
-
"baseUrl": "src",
|
|
15
|
-
"resolveJsonModule": true,
|
|
16
|
-
"skipLibCheck": true,
|
|
17
|
-
"strict": true,
|
|
18
|
-
"jsx": "react",
|
|
19
|
-
"lib": [
|
|
20
|
-
"es2018",
|
|
21
|
-
"dom"
|
|
22
|
-
],
|
|
23
|
-
"typeRoots": [
|
|
24
|
-
"node_modules/@types",
|
|
25
|
-
"src/typings"
|
|
26
|
-
]
|
|
27
|
-
},
|
|
28
|
-
"exclude": [
|
|
29
|
-
"react_project",
|
|
30
|
-
"dist",
|
|
31
|
-
"node_modules",
|
|
32
|
-
"**/*.spec.ts"
|
|
33
|
-
],
|
|
34
|
-
"filesGlob": [
|
|
35
|
-
"./src/**/*.ts",
|
|
36
|
-
"./test/**/*.ts",
|
|
37
|
-
"./custom_typings/**/*.d.ts"
|
|
38
|
-
],
|
|
39
|
-
"include": [
|
|
40
|
-
"src/**/*.ts",
|
|
41
|
-
"src/typings/**/*.ts"
|
|
42
|
-
],
|
|
43
|
-
"typeAcquisition": { "include": ["jest"] }
|
|
44
|
-
}
|