ados-rcm 1.0.84 → 1.0.86
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,12 +1,19 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { TUseValues } from '../../AHooks/useValues';
|
|
2
3
|
import { Resources } from '../AResource/AResource';
|
|
3
|
-
import { IAEvent
|
|
4
|
+
import { IAEvent } from '../ATypes/ATypes';
|
|
4
5
|
/**
|
|
5
6
|
* onOk와 ok의 네이밍 차이 : 해당 function이 Action임을 정의하는 기준을 고찰.
|
|
6
7
|
* onAction은 callback으로 action이 수행될 때 호출된다. 따라서 기본적으로 onAction을 호출하는 곳은 action 한 곳 뿐이다.
|
|
7
8
|
* 이와 다르게 action은 여러 곳에서 해당 action을 수행하고 싶을 때 호출할 수 있다. 만약 한 곳에서만 action을 호출하는 상황이라면 onAction을 사용하도록 한다.
|
|
8
9
|
*/
|
|
9
|
-
export interface
|
|
10
|
+
export interface IADialogAction {
|
|
11
|
+
/**
|
|
12
|
+
* open : () => void
|
|
13
|
+
*
|
|
14
|
+
* Description : open dialog
|
|
15
|
+
*/
|
|
16
|
+
open: () => void;
|
|
10
17
|
/**
|
|
11
18
|
* close : () => void
|
|
12
19
|
*
|
|
@@ -30,13 +37,17 @@ export interface IADialogChildren {
|
|
|
30
37
|
children?: React.ReactNode;
|
|
31
38
|
}
|
|
32
39
|
export type TADialogTypes = 'okCancel' | 'cancelOk' | 'ok' | 'cancel' | 'none';
|
|
40
|
+
export type TADialogContext<P> = (props: P) => {
|
|
41
|
+
children: JSX.Element;
|
|
42
|
+
isOkDisabled: boolean;
|
|
43
|
+
};
|
|
33
44
|
export interface IADialogProps {
|
|
34
45
|
/**
|
|
35
|
-
*
|
|
46
|
+
* dlgCore : IADialogCore
|
|
36
47
|
*
|
|
37
|
-
* Description :
|
|
48
|
+
* Description : core of the dialog
|
|
38
49
|
*/
|
|
39
|
-
|
|
50
|
+
dlgCore: IADialogCore;
|
|
40
51
|
/**
|
|
41
52
|
* type? : TADialogTypes = 'okCancel'
|
|
42
53
|
*
|
|
@@ -49,12 +60,6 @@ export interface IADialogProps {
|
|
|
49
60
|
* Description : title of the dialog
|
|
50
61
|
*/
|
|
51
62
|
title?: React.ReactNode;
|
|
52
|
-
/**
|
|
53
|
-
* actionRef? : TActionRef<IADialogActions>
|
|
54
|
-
*
|
|
55
|
-
* Description : actionRef of the dialog
|
|
56
|
-
*/
|
|
57
|
-
actionRef?: TActionRef<IADialogActions>;
|
|
58
63
|
/**
|
|
59
64
|
* children? : React.ReactNode
|
|
60
65
|
*
|
|
@@ -164,71 +169,85 @@ export interface IADialogProps {
|
|
|
164
169
|
* Description : ADialog is a dialog component.
|
|
165
170
|
*
|
|
166
171
|
*
|
|
167
|
-
* Basic Usage :
|
|
172
|
+
* Basic Usage : You should use 'createADialog' and 'ADialog' to make dialog component,
|
|
173
|
+
* and manage it with 'useADialogCore(s)'.
|
|
168
174
|
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
*
|
|
172
|
-
*
|
|
173
|
-
* console.log('cancel')
|
|
174
|
-
* }
|
|
175
|
+
* const DTest = createADialog((props: { dlgCore: IADialogCore }) => {
|
|
176
|
+
* const { dlgCore } = props;
|
|
177
|
+
* const onOk = () => console.log('ok')
|
|
178
|
+
* const onCancel = () => console.log('cancel')
|
|
175
179
|
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* <ADialogFrame dlgState={dlgState}>
|
|
179
|
-
* <ADialog dlgState={dlgState}
|
|
180
|
+
* return (
|
|
181
|
+
* <ADialog dlgCore={dlgCore}
|
|
180
182
|
* title='Dialog Title'
|
|
181
183
|
* onOk={onOk}
|
|
182
184
|
* onCancel={onCancel}>
|
|
183
185
|
* <div>Content</div>
|
|
186
|
+
* <AButton onClick={dlgCore.action.close}>close</AButton>
|
|
184
187
|
* </ADialog>
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
* </>
|
|
188
|
+
* );
|
|
189
|
+
* });
|
|
188
190
|
*
|
|
189
|
-
* if (case
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
*
|
|
195
|
-
*
|
|
191
|
+
* if (case 1)
|
|
192
|
+
* const CallerComponent = () => {
|
|
193
|
+
* const dlgCore = useADialogCore();
|
|
194
|
+
* return (
|
|
195
|
+
* <div>
|
|
196
|
+
* <AButton onClick={dlgCore.action.open}>Open Dialog</AButton>
|
|
197
|
+
* <DTest dlgCore={dlgCore}/>
|
|
198
|
+
* </div>
|
|
199
|
+
* )
|
|
196
200
|
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
* </ADialog>
|
|
209
|
-
* )
|
|
210
|
-
* }
|
|
201
|
+
* if (case 2)
|
|
202
|
+
* const CallerComponent = () => {
|
|
203
|
+
* const dlgCores = useADialogCores('dlg1');
|
|
204
|
+
* return (
|
|
205
|
+
* <div>
|
|
206
|
+
* some contents
|
|
207
|
+
* <AButton onClick={dlgCores.dlg1.action.open}>Open Dialog</AButton>
|
|
208
|
+
* <DTest dlgState={dlgCores.dlg1}/>
|
|
209
|
+
* </div>
|
|
210
|
+
* );
|
|
211
|
+
* }
|
|
211
212
|
*
|
|
212
213
|
*/
|
|
213
214
|
export declare const ADialog: (props: IADialogProps) => React.ReactPortal;
|
|
214
215
|
export interface IADialogState {
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
/**
|
|
217
|
+
* useIsOpen : [boolean, (isOpen: boolean) => void]
|
|
218
|
+
*
|
|
219
|
+
* Description : [ASystem] use should not modify this property.
|
|
220
|
+
*/
|
|
221
|
+
useIsOpen: TUseValues<boolean>;
|
|
222
|
+
/**
|
|
223
|
+
* setAction : (action: Partial<IADialogAction>) => void
|
|
224
|
+
*
|
|
225
|
+
* Description : set action of the dialog
|
|
226
|
+
*/
|
|
227
|
+
setAction: (action: Partial<IADialogAction>) => void;
|
|
219
228
|
}
|
|
220
|
-
export
|
|
221
|
-
|
|
229
|
+
export type TADialogCores<T extends string> = {
|
|
230
|
+
[key in T]: IADialogCore;
|
|
231
|
+
};
|
|
232
|
+
export interface IADialogCore {
|
|
222
233
|
/**
|
|
223
|
-
*
|
|
234
|
+
* state : IADialogState
|
|
224
235
|
*
|
|
225
|
-
* Description :
|
|
226
|
-
* you can 'close' using actionRef. not this.
|
|
236
|
+
* Description : [ASystem] use should not modify this property.
|
|
227
237
|
*/
|
|
228
|
-
|
|
238
|
+
state: IADialogState;
|
|
229
239
|
/**
|
|
230
|
-
*
|
|
240
|
+
* action : IADialogAction
|
|
241
|
+
*
|
|
242
|
+
* Description : action of the dialog
|
|
231
243
|
*/
|
|
232
|
-
|
|
244
|
+
action: IADialogAction;
|
|
233
245
|
}
|
|
234
|
-
export
|
|
246
|
+
export type TADialogActions<T extends string> = {
|
|
247
|
+
[key in T]: IADialogAction;
|
|
248
|
+
};
|
|
249
|
+
export declare const useADialogCores: <T extends string>(...dlgNames: T[]) => TADialogCores<T>;
|
|
250
|
+
export declare const useADialogCore: () => IADialogCore;
|
|
251
|
+
export declare const createADialog: <P extends {
|
|
252
|
+
dlgCore: IADialogCore;
|
|
253
|
+
}>(Builder: (props: P) => JSX.Element) => (props: P) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -5,7 +5,7 @@ import { IItem } from '../../AUtils/objF';
|
|
|
5
5
|
import { IATablePagination, IATableSortation, IATableTRProps, TATableDefs, TATableFilteration } from './ATable';
|
|
6
6
|
interface IATableBodyProps<T extends IItem> {
|
|
7
7
|
defs: TATableDefs<T>;
|
|
8
|
-
rProps?: TCanCallback<IATableTRProps<T>, React.DetailedHTMLProps<React.HTMLAttributes<
|
|
8
|
+
rProps?: TCanCallback<IATableTRProps<T>, React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>>;
|
|
9
9
|
useSelect?: TUseValues<T[]>;
|
|
10
10
|
isTableDisabled?: boolean;
|
|
11
11
|
isSelectMulti?: boolean;
|