@fctc/widget-logic 1.1.3 → 1.1.5

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/dist/index.d.mts CHANGED
@@ -1,95 +1,75 @@
1
- export { useClickOutside, useDebounce } from './hooks.mjs';
1
+ export { ActionResultType, Context, Record, ViewResponse, useAuth, useAuthType, useCallAction, useCallActionType, useClickOutside, useConfig, useConfigType, useDebounce, useDetail, useListData, useListDataType, useMenu, useMenuType, useProfile, useUser, useUserType, useViewV2, useViewV2Type } from './hooks.mjs';
2
2
  export { CloseIcon, EyeIcon, LoadingIcon } from './icons.mjs';
3
- import { ValuePropsType, WidgetPropsType, ColorWrapperControllerProps, ColorType, IInputFieldProps } from './types.mjs';
4
- export { GoogleLoginType } from './types.mjs';
3
+ import { IInputFieldProps, ValuePropsType } from './types.mjs';
5
4
  import * as react from 'react';
6
- import react__default, { ChangeEvent } from 'react';
7
- import * as _tanstack_query_core from '@tanstack/query-core';
8
- import * as _fctc_interface_logic from '@fctc/interface-logic';
9
- import { BaseModelInit } from '@fctc/interface-logic';
10
- import * as _fctc_interface_logic_dist_index_C_nK1Mii from '@fctc/interface-logic/dist/index-C_nK1Mii';
5
+ import { ChangeEvent } from 'react';
11
6
  import day from 'react-datepicker/dist/day';
12
7
  import month from 'react-datepicker/dist/month';
13
8
  import year from 'react-datepicker/dist/year';
14
9
  import moment from 'moment';
10
+ export { API_APP_URL, API_PRESCHOOL_URL, STORAGES, combineContexts, convertFieldsToArray, countSum, getDateRange, languages, mergeButtons, setStorageItemAsync, useGetRowIds, useStorageState } from './utils.mjs';
11
+ import '@tanstack/react-query';
12
+ import '@fctc/interface-logic';
15
13
 
16
14
  type TStatus = 'normal' | 'done' | 'blocked';
17
- interface IStatusDropdownFieldProps {
18
- selection?: [string | number, string][] | any;
19
- isForm?: boolean;
20
- id?: string | number;
21
- model?: string;
22
- name?: string;
23
- state?: string | undefined;
24
- onRefetch?: Function;
15
+ interface TStatusDropdownFieldProps extends IInputFieldProps {
16
+ state: any;
17
+ selection: any;
18
+ id: any;
25
19
  }
26
20
 
27
- declare const statusDropdownController: (props: IStatusDropdownFieldProps) => {
21
+ declare const statusDropdownController: (props: TStatusDropdownFieldProps) => {
28
22
  handleClick: (status: any) => Promise<void>;
29
23
  buttonRef: react.RefObject<HTMLDivElement>;
30
24
  isForm: boolean | undefined;
31
25
  setIsOpen: react.Dispatch<react.SetStateAction<boolean>>;
32
26
  isOpen: boolean;
33
27
  selection: any;
34
- state: string | undefined;
28
+ state: any;
35
29
  colors: Record<TStatus, string>;
36
30
  };
37
31
 
38
- interface Many2OneProps {
39
- name: string;
40
- methods: any;
41
- formValues: any;
42
- domain: any;
43
- relation: any;
44
- onChange: any;
45
- value: any;
46
- context: any;
47
- options: any;
48
- showDetail: any;
49
- actionData: any;
32
+ interface IMany2OneProps extends IInputFieldProps {
33
+ context?: any;
34
+ options?: any;
35
+ showDetail?: boolean;
36
+ actionData?: any;
50
37
  }
51
38
 
52
- declare const many2oneFieldController: (props: Many2OneProps) => {
53
- allowShowDetail: any;
39
+ declare const many2oneFieldController: (props: IMany2OneProps) => {
40
+ allowShowDetail: boolean;
54
41
  handleClose: () => void;
55
42
  handleChooseRecord: (idRecord: number) => void;
56
43
  handleSelectChange: (selectedOption: any) => void;
57
44
  initValue: any;
58
45
  isFetching: boolean;
59
46
  isShowModalMany2Many: boolean;
60
- options: never[];
47
+ options: any[];
61
48
  fetchMoreOptions: () => void;
62
- domainModal: null;
49
+ domainModal: any;
63
50
  tempSelectedOption: any;
64
- setTempSelectedOption: react.Dispatch<any>;
65
- setDomainModal: react.Dispatch<react.SetStateAction<null>>;
51
+ setTempSelectedOption: React.Dispatch<React.SetStateAction<any>>;
52
+ setDomainModal: React.Dispatch<React.SetStateAction<any>>;
66
53
  dataOfSelection: any;
67
- refetch: (options?: _tanstack_query_core.RefetchOptions) => Promise<_tanstack_query_core.QueryObserverResult<any, Error>>;
68
- selectOptions: any;
69
- optionsObject: {};
54
+ refetch: () => void;
55
+ selectOptions: any[];
56
+ optionsObject: any;
70
57
  contextObject: any;
71
58
  actionId: any;
72
- setIsShowModalMany2Many: react.Dispatch<react.SetStateAction<boolean>>;
59
+ setIsShowModalMany2Many: React.Dispatch<React.SetStateAction<boolean>>;
73
60
  };
74
61
 
75
62
  type Option = {
76
63
  value: number;
77
64
  label: string;
78
65
  };
79
- declare const many2oneButtonController: ({ relation, methods, domain, }: {
80
- relation: string;
81
- methods: any;
82
- domain: any;
83
- }) => {
66
+ declare const many2oneButtonController: (props: IInputFieldProps) => {
84
67
  options: Option[];
85
68
  };
86
69
 
87
- interface Many2ManyControllerProps {
88
- relation: string;
89
- domain: any;
70
+ interface IMany2ManyControllerProps extends IInputFieldProps {
90
71
  context: any;
91
72
  tab: any;
92
- model: string;
93
73
  aid: number;
94
74
  setSelectedRowKeys: any;
95
75
  fields: any;
@@ -100,69 +80,27 @@ interface Many2ManyControllerProps {
100
80
  sessionStorageUtils: any;
101
81
  }
102
82
 
103
- declare const many2manyFieldController: (props: Many2ManyControllerProps) => {
104
- rows: any[];
105
- columns: any;
106
- typeTable: "list" | "group" | "calendar" | undefined;
107
- handleCreateNewOnPage: () => Promise<void>;
108
- isLoadedData: boolean;
109
- domainMany2Many: any;
110
- isDataLoading: boolean;
111
- isDataResponseFetched: boolean;
112
- isPlaceholderData: boolean;
113
- queryKey: any[];
114
- data: {
115
- model: string;
116
- specification: Record<string, any> | null;
117
- domain: any;
118
- offset: number;
119
- limit: number;
120
- context: any;
121
- fields: any;
122
- groupby: any[];
123
- sort: string | null;
124
- };
125
- specification: Record<string, any> | null;
126
- enabled: boolean;
127
- isViewReponseFetched: boolean;
128
- actionData: any;
129
- viewResponse: any;
130
- debouncedPage: number;
131
- order: undefined;
132
- default_order: any;
133
- optionsObject: {} | null;
134
- setDomainMany2Many: react.Dispatch<any>;
135
- selectedTags: [];
136
- initModel: {
137
- initModel: (modelData: _fctc_interface_logic_dist_index_C_nK1Mii.a) => _fctc_interface_logic.BaseModel;
138
- };
139
- modelInstance: _fctc_interface_logic.BaseModel | null;
140
- baseModel: BaseModelInit;
141
- dataResponse: any;
142
- isLoading: boolean;
143
- setOrder: react.Dispatch<react.SetStateAction<undefined>>;
144
- };
83
+ declare const many2manyFieldController: (props: IMany2ManyControllerProps) => {};
84
+
85
+ interface IMany2ManyTagFieldProps extends IInputFieldProps {
86
+ options: any;
87
+ widget: string;
88
+ placeholderNoOption: string;
89
+ }
145
90
 
146
- declare const many2manyTagsController: (props: any) => {
91
+ declare const many2manyTagsController: (props: IMany2ManyTagFieldProps) => {
147
92
  options: any;
148
- customNoOptionsMessage: () => any;
93
+ customNoOptionsMessage: () => string;
149
94
  tranfer: (data: any) => any;
150
95
  dataOfSelection: any;
151
96
  isUser: boolean;
152
97
  };
153
98
 
154
- interface IDurationProps {
155
- relation?: string;
156
- defaultValue?: string | number | ValuePropsType;
157
- domain?: string | [] | any;
158
- formValues?: Record<string, any>;
159
- name?: string;
160
- id?: string | number;
161
- model?: string;
162
- onRefetch?: Function;
99
+ interface IDurationFieldProps extends IInputFieldProps {
100
+ id: any;
163
101
  }
164
102
 
165
- declare const durationController: (props: IDurationProps) => {
103
+ declare const durationController: (props: IDurationFieldProps) => {
166
104
  defaultValue: string | number | ValuePropsType | undefined;
167
105
  dataResponse: any;
168
106
  handleClick: (stage_id: any) => Promise<void>;
@@ -171,23 +109,17 @@ declare const durationController: (props: IDurationProps) => {
171
109
  setModalStatus: react.Dispatch<react.SetStateAction<boolean>>;
172
110
  };
173
111
 
174
- interface PriorityFieldProps {
175
- value: any;
112
+ interface IPriorityFieldProps extends IInputFieldProps {
176
113
  selection: any;
177
- isForm: boolean;
178
- name: string;
179
- methods: any;
180
- id: string;
181
- onChange: any;
182
- model: any;
114
+ id: any;
183
115
  actionData: any;
184
116
  viewData: any;
185
117
  context: any;
186
118
  }
187
119
 
188
- declare const priorityFieldController: (props: PriorityFieldProps) => {
120
+ declare const priorityFieldController: (props: IPriorityFieldProps) => {
189
121
  selection: any;
190
- isForm: boolean;
122
+ isForm: boolean | undefined;
191
123
  methods: any;
192
124
  defaultPriority: number;
193
125
  savePriorities: ({ value, resetPriority, }: {
@@ -195,8 +127,8 @@ declare const priorityFieldController: (props: PriorityFieldProps) => {
195
127
  resetPriority?: () => void;
196
128
  }) => Promise<void>;
197
129
  label: any;
198
- id: string;
199
- onChange: any;
130
+ id: any;
131
+ onChange: ((name: string, value: any) => void) | undefined;
200
132
  };
201
133
 
202
134
  declare const floatTimeFiledController: ({ onChange: fieldOnChange, onBlur, value, isDirty, props, }: {
@@ -205,7 +137,7 @@ declare const floatTimeFiledController: ({ onChange: fieldOnChange, onBlur, valu
205
137
  value: any;
206
138
  error: any;
207
139
  isDirty: any;
208
- props: WidgetPropsType;
140
+ props: IInputFieldProps;
209
141
  }) => {
210
142
  handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
211
143
  handleBlur: () => void;
@@ -217,7 +149,7 @@ declare const floatTimeFiledController: ({ onChange: fieldOnChange, onBlur, valu
217
149
  declare const floatController: ({ onChange, value, props, }: {
218
150
  onChange: any;
219
151
  value: any;
220
- props: WidgetPropsType;
152
+ props: IInputFieldProps;
221
153
  }) => {
222
154
  handleInputMouseLeave: () => void;
223
155
  handleInputChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
@@ -233,24 +165,26 @@ declare const downloadFileController: () => {
233
165
  handleFileDownload: () => void;
234
166
  };
235
167
 
236
- type TDownLoadBinaryProps = {
237
- value: any;
238
- defaultValue: any;
239
- formValues: any;
240
- };
241
-
242
- declare const downLoadBinaryController: (props: TDownLoadBinaryProps) => {
168
+ declare const downLoadBinaryController: (props: IInputFieldProps) => {
243
169
  handleFileDownload: (e: any) => Promise<void>;
244
170
  };
245
171
 
246
- declare const dateFieldController: (props: any) => {
172
+ interface IDateFieldProps extends IInputFieldProps {
173
+ showTime: boolean;
174
+ widget: string;
175
+ min: number | string;
176
+ max: number | string;
177
+ viewData: any;
178
+ }
179
+
180
+ declare const dateFieldController: (props: IDateFieldProps) => {
247
181
  formatDate: string;
248
182
  formatDateParse: string;
249
183
  range: (start: number, end: number, step?: number) => number[];
250
184
  years: number[];
251
185
  months_vi: string[];
252
186
  months_en: string[];
253
- customValidateMinMax: (date: any) => boolean;
187
+ customValidateMinMax: (date: any) => string | false;
254
188
  minNowValue: boolean | moment.Moment | null;
255
189
  maxNowValue: boolean | moment.Moment | null;
256
190
  year: typeof year;
@@ -258,31 +192,18 @@ declare const dateFieldController: (props: any) => {
258
192
  day: typeof day;
259
193
  };
260
194
 
261
- declare const copyLinkButtonController: (props: any) => {
195
+ declare const copyLinkButtonController: (props: IInputFieldProps) => {
262
196
  isCopied: boolean;
263
197
  handleCopyToClipboard: (value: string) => Promise<void>;
264
198
  propValue: any;
265
199
  };
266
200
 
267
- declare const colorWrapperController: (props: ColorWrapperControllerProps) => {
268
- selectedColor: ColorType;
269
- showFullColors: boolean;
270
- setSelectedColor: react.Dispatch<react.SetStateAction<ColorType>>;
271
- handleShowFullColors: () => void;
272
- pickColorsRef: react.RefObject<HTMLDivElement>;
273
- savePickColor: any;
274
- };
275
-
276
- interface ColorFieldProps extends IInputFieldProps {
277
- value?: string | number | ValuePropsType | null | Record<any, any> | any;
278
- isForm?: boolean;
279
- name?: string;
280
- methods?: any;
281
- onChange?: (name: string, value: any) => void;
282
- [key: string]: any;
201
+ interface IColorFieldProps extends IInputFieldProps {
202
+ actionData: any;
203
+ idForm: number | string;
283
204
  }
284
205
 
285
- declare const colorFieldController: (props: ColorFieldProps) => {
206
+ declare const colorFieldController: (props: IColorFieldProps) => {
286
207
  savePickColor: (colorObject: any) => Promise<void>;
287
208
  };
288
209
 
@@ -298,49 +219,4 @@ declare const binaryFieldController: (props: IInputFieldProps) => {
298
219
  getImageBase64WithMimeType: (base64: any) => string | null;
299
220
  };
300
221
 
301
- declare const ModalConfirm: ({ name, isShowModal, onClick, onClose, title, content, isLoading, }: {
302
- name: "delete" | "duplicate" | "archive" | "unarchive";
303
- isShowModal: boolean;
304
- isLoading?: boolean;
305
- onClick: () => void;
306
- onClose: () => void;
307
- title?: string;
308
- content?: React.ReactNode;
309
- }) => JSX.Element;
310
-
311
- declare const ModalDetail: ({ idToolTip, title, model, idForm, aid, place, renderDetail, context, }: any) => react.ReactPortal;
312
-
313
- declare const ModalLayer: ({ isOpen, onClose, title, children, }: {
314
- isOpen: boolean;
315
- onClose: () => void;
316
- title?: string;
317
- children: react__default.ReactNode;
318
- }) => JSX.Element;
319
-
320
- declare const LayerLoading: () => JSX.Element;
321
-
322
- declare const LoadingSmall: () => JSX.Element;
323
-
324
- interface UseTableProps {
325
- data: {
326
- fields: any[];
327
- records: any[];
328
- dataModel: {
329
- [fieldName: string]: {
330
- string?: string;
331
- [key: string]: any;
332
- };
333
- };
334
- context: any;
335
- typeTable?: 'list' | 'group' | 'calendar';
336
- };
337
- }
338
-
339
- declare const useTableHandler: ({ data }: UseTableProps) => {
340
- rows: any[];
341
- columns: any;
342
- onToggleColumnOptional: (item: any) => void;
343
- typeTable: "list" | "group" | "calendar" | undefined;
344
- };
345
-
346
- export { ColorType, ColorWrapperControllerProps, IInputFieldProps, LayerLoading, LoadingSmall, ModalConfirm, ModalDetail, ModalLayer, ValuePropsType, WidgetPropsType, binaryFieldController, colorFieldController, colorWrapperController, copyLinkButtonController, dateFieldController, downLoadBinaryController, downloadFileController, durationController, floatController, floatTimeFiledController, many2manyFieldController, many2manyTagsController, many2oneButtonController, many2oneFieldController, priorityFieldController, statusDropdownController, useTableHandler };
222
+ export { IInputFieldProps, ValuePropsType, binaryFieldController, colorFieldController, copyLinkButtonController, dateFieldController, downLoadBinaryController, downloadFileController, durationController, floatController, floatTimeFiledController, many2manyFieldController, many2manyTagsController, many2oneButtonController, many2oneFieldController, priorityFieldController, statusDropdownController };