dynamic-modal 1.0.0 → 1.0.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/examples/enable-if.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/examples/live-data.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1
2
|
import { IModalConfigLoader } from '../src/interfaces/modal'
|
|
2
3
|
import { IOption } from '../src/interfaces/option'
|
|
3
4
|
|
|
@@ -6,7 +7,7 @@ type IncomingProps = {
|
|
|
6
7
|
|
|
7
8
|
//Define function to receive selected element and formData (if you need to use) make read or select operations and build
|
|
8
9
|
//next select array of elements
|
|
9
|
-
optionReadAction : (typeId: string, formData:
|
|
10
|
+
optionReadAction : (typeId: string, formData: any) => Promise<Array<IOption>>
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
type ResultProps = Omit<IncomingProps,'optionReadAction'|'typeList'> & Record<'typeId'|'optionId', string>
|
package/examples/render-if.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
package/package.json
CHANGED
package/src/interfaces/modal.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1
2
|
import { CSSProperties } from 'react'
|
|
2
3
|
import { IMakeSelect } from './make-select'
|
|
3
4
|
import { IMakeInput } from './make-field'
|
|
@@ -18,7 +19,7 @@ export type IFormField = IMakeSelect | IMakeInput | IMakeTextarea | IMakeToggle
|
|
|
18
19
|
export type IModalRenderCondition = Record<string, Array<string | number>>
|
|
19
20
|
|
|
20
21
|
export type IModalLiveDataCondition = {
|
|
21
|
-
action: (data: string, ...args:
|
|
22
|
+
action: (data: string, ...args: any[]) => Promise<Array<IOption>>;
|
|
22
23
|
condition: string
|
|
23
24
|
}
|
|
24
25
|
|
|
@@ -27,7 +28,7 @@ export interface IModalConfigProps {
|
|
|
27
28
|
title: string
|
|
28
29
|
action: {
|
|
29
30
|
name: string
|
|
30
|
-
action?: (data:
|
|
31
|
+
action?: (data: any) => void
|
|
31
32
|
hide?: boolean
|
|
32
33
|
}
|
|
33
34
|
cancel?: {
|
|
@@ -41,7 +42,7 @@ export interface IModalConfigProps {
|
|
|
41
42
|
minHeightBody?: string | number
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
export type IModalConfigLoader<T =
|
|
45
|
+
export type IModalConfigLoader<T = any, D = any> = (props: T, action: (modalResult: D) => void) => IModalConfigProps
|
|
45
46
|
|
|
46
47
|
export interface IModal {
|
|
47
48
|
open: boolean;
|