admin_lsac 1.2.8 → 1.2.10

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.
@@ -1,8 +1,8 @@
1
- import { PageSchema } from "./schema";
2
- import { event } from "../pages/event";
3
- import { page } from "../pages/page";
4
-
5
- export const pages: PageSchema[] = [
6
- event, // example schema
7
- page,
8
- ];
1
+ import { PageSchema } from "./schema";
2
+ import { event } from "../pages/event";
3
+ import { page } from "../pages/page";
4
+
5
+ export const pages: PageSchema[] = [
6
+ event, // example schema
7
+ page,
8
+ ];
@@ -1,63 +1,63 @@
1
- import * as React from "react";
2
-
3
- export interface TableField {
4
- name: string;
5
- access: (obj: any) => string | number | React.ReactElement;
6
- }
7
-
8
- export interface SimpleField {
9
- name: string;
10
- label: string;
11
- type: "string" | "number" | "file";
12
- validationSchema: any;
13
- }
14
-
15
- export interface Option {
16
- value: string | number | boolean;
17
- display: string;
18
- }
19
-
20
- export interface DropdownField {
21
- name: string;
22
- label: string;
23
- type: "dropdown";
24
- options?: Option[] | undefined;
25
- getOptions: () => Promise<Option[]>;
26
- }
27
-
28
- export interface ObjectField {
29
- name: string;
30
- label: string;
31
- type: "object";
32
- fields: FormField[];
33
- }
34
-
35
- export interface ArrayField {
36
- name: string;
37
- label: string;
38
- type: "array";
39
- element: Exclude<FormField, ArrayField>;
40
- }
41
-
42
- export type FormField = SimpleField | DropdownField | ObjectField | ArrayField;
43
-
44
- export interface Action {
45
- name: string;
46
- fields?: FormField[];
47
- onSubmit: (obj1: any, obj2?: any) => Promise<any>;
48
- }
49
-
50
- export interface RowAction {
51
- name: string;
52
- fields?: FormField[];
53
- initialise: (obj: any) => any;
54
- onSubmit: (obj1: any, obj2?: any) => Promise<any>;
55
- }
56
-
57
- export interface PageSchema {
58
- name: string;
59
- actions: Action[];
60
- rowActions: RowAction[];
61
- getRequest: () => Promise<any[]>;
62
- tableFields: TableField[];
63
- }
1
+ import * as React from "react";
2
+
3
+ export interface TableField {
4
+ name: string;
5
+ access: (obj: any) => string | number | React.ReactElement;
6
+ }
7
+
8
+ export interface SimpleField {
9
+ name: string;
10
+ label: string;
11
+ type: "string" | "number" | "file";
12
+ validationSchema: any;
13
+ }
14
+
15
+ export interface Option {
16
+ value: string | number | boolean;
17
+ display: string;
18
+ }
19
+
20
+ export interface DropdownField {
21
+ name: string;
22
+ label: string;
23
+ type: "dropdown";
24
+ options?: Option[] | undefined;
25
+ getOptions: () => Promise<Option[]>;
26
+ }
27
+
28
+ export interface ObjectField {
29
+ name: string;
30
+ label: string;
31
+ type: "object";
32
+ fields: FormField[];
33
+ }
34
+
35
+ export interface ArrayField {
36
+ name: string;
37
+ label: string;
38
+ type: "array";
39
+ element: Exclude<FormField, ArrayField>;
40
+ }
41
+
42
+ export type FormField = SimpleField | DropdownField | ObjectField | ArrayField;
43
+
44
+ export interface Action {
45
+ name: string;
46
+ fields?: FormField[];
47
+ onSubmit: (obj1: any, obj2?: any) => Promise<any>;
48
+ }
49
+
50
+ export interface RowAction {
51
+ name: string;
52
+ fields?: FormField[];
53
+ initialise?: (obj: any) => any;
54
+ onSubmit: (obj1: any, obj2?: any) => Promise<any>;
55
+ }
56
+
57
+ export interface PageSchema {
58
+ name: string;
59
+ actions: Action[];
60
+ rowActions: RowAction[];
61
+ getRequest: () => Promise<any[]>;
62
+ tableFields: TableField[];
63
+ }
@@ -0,0 +1,17 @@
1
+ import io from "socket.io-client";
2
+ import { useEffect } from "react";
3
+
4
+ const Socket = (setSocket: any, apiURL: string) => {
5
+ useEffect(() => {
6
+ const socketRef = io(apiURL, {
7
+ transports: ["websocket"],
8
+ });
9
+ setSocket(socketRef);
10
+ return () => {
11
+ socketRef.removeAllListeners();
12
+ socketRef.disconnect();
13
+ };
14
+ }, []);
15
+ };
16
+
17
+ export const newSocket = (setSocket: any, apiURL: string) => Socket(setSocket, apiURL);