ados-rcm 1.1.764 → 1.1.766

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.
@@ -323,8 +323,21 @@ export type TADialogActions<T extends string> = {
323
323
  export type TADialogStates<T extends string> = {
324
324
  [key in T]: IADialogState;
325
325
  };
326
- export declare const useADialogCore: () => IADialogCore;
326
+ /**
327
+ * useADialogCores
328
+ *
329
+ * Description : useADialogCores is a hook that creates dialog cores.
330
+ *
331
+ * Basic Usage : You should use 'useADialogCores' or 'useADialogCore' to make dialog core,
332
+ *
333
+ * if (case 1)
334
+ * const dlgCores = useADialogCores(['dlgName', 'testName']);
335
+ * const dlgCore = dlgCores.dlgName;
336
+ * const testDlgCore = dlgCores.testName;
337
+ *
338
+ */
327
339
  export declare const useADialogCores: <T extends string>(extDlgNames: T[] | readonly T[]) => TADialogCores<T>;
340
+ export declare const useADialogCore: () => IADialogCore;
328
341
  export declare const CreateADC: <P extends {
329
342
  dlgCore: IADialogCore;
330
343
  }>(Builder: (props: P) => React.ReactNode) => (props: P) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,346 @@
1
+ import { default as React } from 'react';
2
+ import { TUseValues } from '../../AHooks/useValues';
3
+ import { IAProgressBarProps } from '../AProgressBar/AProgressBar';
4
+ import { Resources } from '../AResource/AResource';
5
+ import { IAEvent, TPromisable } from '../ATypes/ATypes';
6
+ /**
7
+ * onOk와 ok의 네이밍 차이 : 해당 function이 Action임을 정의하는 기준을 고찰.
8
+ * onAction은 callback으로 action이 수행될 때 호출된다. 따라서 기본적으로 onAction을 호출하는 곳은 action 한 곳 뿐이다.
9
+ * 이와 다르게 action은 여러 곳에서 해당 action을 수행하고 싶을 때 호출할 수 있다. 만약 한 곳에서만 action을 호출하는 상황이라면 onAction을 사용하도록 한다.
10
+ */
11
+ export interface IADialogActions {
12
+ /**
13
+ * cancel : () => void
14
+ *
15
+ * Description : run cancel of the dialog
16
+ */
17
+ cancel: () => void;
18
+ /**
19
+ * close : () => void
20
+ *
21
+ * Description : close dialog
22
+ */
23
+ close: () => void;
24
+ /**
25
+ * ok : () => void
26
+ *
27
+ * Description : run ok of the dialog
28
+ */
29
+ ok: () => void;
30
+ /**
31
+ * open : () => void
32
+ *
33
+ * Description : open dialog
34
+ */
35
+ open: () => void;
36
+ }
37
+ export interface IADialogChildren {
38
+ children?: React.ReactNode;
39
+ }
40
+ export declare const ADialogTypes: readonly ["okCancel", "cancelOk", "ok", "cancel", "none"];
41
+ export type TADialogTypes = (typeof ADialogTypes)[number];
42
+ export type TADialogContext<P> = (props: P) => {
43
+ children: React.ReactElement;
44
+ isOkDisabled: boolean;
45
+ };
46
+ export interface IADialogProps {
47
+ /**
48
+ * ProgressRenderer? : React.ComponentType<IAProgressBarProps>
49
+ *
50
+ * Description : component for rendering progress bar
51
+ */
52
+ ProgressRenderer?: React.ComponentType<IAProgressBarProps>;
53
+ /**
54
+ * actionStyle? : React.CSSProperties
55
+ *
56
+ * Description : actionStyle of the dialog
57
+ */
58
+ actionStyle?: React.CSSProperties;
59
+ /**
60
+ * bodyStyle? : React.CSSProperties
61
+ *
62
+ * Description : bodyStyle of the dialog
63
+ */
64
+ bodyStyle?: React.CSSProperties;
65
+ /**
66
+ * buttonNoInteractive? : boolean
67
+ *
68
+ * Description : if true, action buttons are not interactive
69
+ */
70
+ buttonNoInteractive?: boolean;
71
+ /**
72
+ * cancelButtonClassName? : string
73
+ *
74
+ * Description : className of the cancel button
75
+ */
76
+ cancelButtonClassName?: string;
77
+ /**
78
+ * cancelButtonStyle? : React.CSSProperties
79
+ *
80
+ * Description : cancelButtonStyle of the dialog
81
+ */
82
+ cancelButtonStyle?: React.CSSProperties;
83
+ /**
84
+ * children? : React.ReactNode
85
+ *
86
+ * Description : children of the dialog
87
+ */
88
+ children?: React.ReactNode;
89
+ /**
90
+ * contentStyle? : React.CSSProperties
91
+ *
92
+ * Description : contentStyle of the dialog
93
+ */
94
+ contentStyle?: React.CSSProperties;
95
+ /**
96
+ * dlgCore : IADialogCore
97
+ *
98
+ * Description : core of the dialog
99
+ */
100
+ dlgCore: IADialogCore;
101
+ /**
102
+ * isCancelDisabled? : boolean | string
103
+ *
104
+ * Description : if truthy, cancel button is disabled
105
+ */
106
+ isCancelDisabled?: boolean | string;
107
+ /**
108
+ * isCancelLoading? : any
109
+ *
110
+ * Description : if truthy, cancel button is loading
111
+ */
112
+ isCancelLoading?: any;
113
+ /**
114
+ * isChanged? : boolean
115
+ *
116
+ * Description : if true, cancel will be disabled
117
+ */
118
+ isChanged?: boolean;
119
+ /**
120
+ * isLoading? : any
121
+ *
122
+ * Description : if truthy, dialog is loading
123
+ */
124
+ isLoading?: any;
125
+ /**
126
+ * isOkDisabled? : boolean | string
127
+ *
128
+ * Description : if truthy, ok button is disabled
129
+ */
130
+ isOkDisabled?: boolean | string;
131
+ /**
132
+ * isOkLoading? : any
133
+ *
134
+ * Description : if truthy, ok button is loading
135
+ */
136
+ isOkLoading?: any;
137
+ /**
138
+ * noDim? : boolean = false
139
+ *
140
+ * Description : decides whether the dialog has dim or not
141
+ */
142
+ noDim?: boolean;
143
+ /**
144
+ * okButtonClassName? : string
145
+ *
146
+ * Description : className of the ok button
147
+ */
148
+ okButtonClassName?: string;
149
+ /**
150
+ * okButtonStyle? : React.CSSProperties
151
+ *
152
+ * Description : okButtonStyle of the dialog
153
+ */
154
+ okButtonStyle?: React.CSSProperties;
155
+ /**
156
+ * onCancel : (e: IAEvent) => void;
157
+ *
158
+ * Description : onCancel of the dialog. it runs close by default
159
+ */
160
+ onCancel?: (e: IAEvent) => TPromisable<any>;
161
+ /**
162
+ * onClose : () => void;
163
+ *
164
+ * Description : onClose of the dialog. it runs dlgState.onClose by default
165
+ */
166
+ onClose?: () => void;
167
+ /**
168
+ * onEnterPress : (e: IAEvent) => void;
169
+ *
170
+ * Description : onEnterPress of the dialog. it runs ok by default
171
+ */
172
+ onEnterPress?: (e: IAEvent) => TPromisable<any>;
173
+ /**
174
+ * onEscPress : (e: IAEvent) => void;
175
+ *
176
+ * Description : onEscPress of the dialog. it runs cancel by default
177
+ */
178
+ onEscPress?: (e: IAEvent) => TPromisable<any>;
179
+ /**
180
+ * onOk : (e: IAEvent) => void;
181
+ *
182
+ * Description : onOk of the dialog. it runs close by default
183
+ */
184
+ onOk?: (e: IAEvent) => TPromisable<any>;
185
+ /**
186
+ * onPaperClick : (e: IAEvent) => void;
187
+ *
188
+ * Description : onPaperClick of the dialog. it runs cancel by default
189
+ */
190
+ onPaperClick?: (e: IAEvent) => TPromisable<any>;
191
+ /**
192
+ * onSpacePress : (e: IAEvent) => void;
193
+ *
194
+ * Description : onSpacePress of the dialog. it runs ok by default
195
+ */
196
+ onSpacePress?: (e: IAEvent) => TPromisable<any>;
197
+ /**
198
+ * progress? : number
199
+ *
200
+ * Description : if provided, shows a progress bar with the given percentage
201
+ */
202
+ progress?: number;
203
+ /**
204
+ * progressProps? : Omit<IAProgressBarProps, 'progress'>;
205
+ *
206
+ * Description : props of the progress bar
207
+ */
208
+ progressProps?: Omit<IAProgressBarProps, 'progress'>;
209
+ /**
210
+ * resources? : Partial<typeof Resources.ADialog>
211
+ *
212
+ * Description : language resources of the dialog
213
+ */
214
+ resources?: Partial<typeof Resources.ADialog>;
215
+ /**
216
+ * style? : React.CSSProperties
217
+ *
218
+ * Description : style of the dialog
219
+ */
220
+ style?: React.CSSProperties;
221
+ /**
222
+ * title? : React.ReactNode
223
+ *
224
+ * Description : title of the dialog
225
+ */
226
+ title?: React.ReactNode;
227
+ /**
228
+ * titleStyle? : React.CSSProperties
229
+ *
230
+ * Description : titleStyle of the dialog
231
+ */
232
+ titleStyle?: React.CSSProperties;
233
+ /**
234
+ * type? : TADialogTypes = 'okCancel'
235
+ *
236
+ * Description : type of dialog. decides the type of action buttons
237
+ */
238
+ type?: TADialogTypes;
239
+ }
240
+ /**
241
+ * AComponent : ADialog
242
+ *
243
+ * Description : ADialog is a dialog component.
244
+ *
245
+ *
246
+ * Basic Usage : You should use 'createADialog' and 'ADialog' to make dialog component,
247
+ * and manage it with 'useADialogCore(s)'.
248
+ *
249
+ * const DTest = createADialog((props: { dlgCore: IADialogCore }) => {
250
+ * const { dlgCore } = props;
251
+ * const onOk = () => console.log('ok')
252
+ * const onCancel = () => console.log('cancel')
253
+ *
254
+ * return (
255
+ * <ADialog dlgCore={dlgCore}
256
+ * title='Dialog Title'
257
+ * onOk={onOk}
258
+ * onCancel={onCancel}>
259
+ * <div>Content</div>
260
+ * <AButton onClick={dlgCore.action.close}>close</AButton>
261
+ * </ADialog>
262
+ * );
263
+ * });
264
+ *
265
+ * if (case 1)
266
+ * const CallerComponent = () => {
267
+ * const dlgCore = useADialogCore();
268
+ * return (
269
+ * <div>
270
+ * <AButton onClick={dlgCore.action.open}>Open Dialog</AButton>
271
+ * <DTest dlgCore={dlgCore}/>
272
+ * </div>
273
+ * )
274
+ *
275
+ * if (case 2)
276
+ * const CallerComponent = () => {
277
+ * const dlgCores = useADialogCores('dlg1');
278
+ * return (
279
+ * <div>
280
+ * some contents
281
+ * <AButton onClick={dlgCores.dlg1.action.open}>Open Dialog</AButton>
282
+ * <DTest dlgState={dlgCores.dlg1}/>
283
+ * </div>
284
+ * );
285
+ * }
286
+ *
287
+ */
288
+ export declare const ADialog: (props: IADialogProps) => React.ReactPortal;
289
+ export interface IADialogState {
290
+ /**
291
+ * setAction : (action: Partial<IADialogActions>) => void
292
+ *
293
+ * Description : set action of the dialog
294
+ */
295
+ setAction: (action: Partial<IADialogActions>) => void;
296
+ /**
297
+ * useIsOpen : [boolean, (isOpen: boolean) => void]
298
+ *
299
+ * Description : [ASystem] use should not modify this property.
300
+ */
301
+ useIsOpen: TUseValues<boolean>;
302
+ }
303
+ export type TADialogCores<T extends string> = {
304
+ [key in T]: IADialogCore;
305
+ };
306
+ export interface IADialogCore {
307
+ /**
308
+ * action : IADialogAction
309
+ *
310
+ * Description : action of the dialog
311
+ */
312
+ action: IADialogActions;
313
+ /**
314
+ * state : IADialogState
315
+ *
316
+ * Description : [ASystem] use should not modify this property.
317
+ */
318
+ state: IADialogState;
319
+ }
320
+ export type TADialogActions<T extends string> = {
321
+ [key in T]: IADialogActions;
322
+ };
323
+ export type TADialogStates<T extends string> = {
324
+ [key in T]: IADialogState;
325
+ };
326
+ /**
327
+ * useADialogCores
328
+ *
329
+ * Description : useADialogCores is a hook that creates dialog cores.
330
+ *
331
+ * Basic Usage : You should use 'useADialogCores' or 'useADialogCore' to make dialog core,
332
+ *
333
+ * if (case 1)
334
+ * const dlgCores = useADialogCores(['dlgName', 'testName']);
335
+ * const dlgCore = dlgCores.dlgName;
336
+ * const testDlgCore = dlgCores.testName;
337
+ *
338
+ */
339
+ export declare const useADialogCores: <T extends string>(extDlgNames: T[] | readonly T[]) => TADialogCores<T>;
340
+ export declare const useADialogCore: () => IADialogCore;
341
+ export declare const CreateADC: <P extends {
342
+ dlgCore: IADialogCore;
343
+ }>(Builder: (props: P) => React.ReactNode) => (props: P) => import("react/jsx-runtime").JSX.Element;
344
+ export declare const dlgF: {
345
+ closeAllDlgs: () => void;
346
+ };