@asaleh37/ui-base 25.8.1 → 25.8.2-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/.github/workflows/publish-npm.yml +1 -1
- package/dist/index.d.ts +15 -2
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +7 -7
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/index.ts +0 -1
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormElementField.tsx +30 -1
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/CheckBox.tsx +2 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/ComboBox.tsx +2 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/Datefield.tsx +5 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/DatetimeField.tsx +7 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/SystemLookupCombobox.tsx +1 -0
- package/src/components/templates/DataEntryTemplates/TemplateDataGrid/TemplateGrid.tsx +1 -1
- package/src/components/templates/index.ts +2 -0
- package/src/hooks/index.ts +11 -0
package/package.json
CHANGED
package/src/components/index.ts
CHANGED
|
@@ -46,7 +46,11 @@ const FormElementField: React.FC<FormElementFieldProps> = (
|
|
|
46
46
|
? true
|
|
47
47
|
: false
|
|
48
48
|
}
|
|
49
|
-
hidden={
|
|
49
|
+
hidden={
|
|
50
|
+
props?.hidden || element.hiddenFields.includes(fieldName)
|
|
51
|
+
? true
|
|
52
|
+
: false
|
|
53
|
+
}
|
|
50
54
|
label={props?.fieldLabel}
|
|
51
55
|
value={formValues[fieldName]}
|
|
52
56
|
onChange={(event) => {
|
|
@@ -90,6 +94,11 @@ const FormElementField: React.FC<FormElementFieldProps> = (
|
|
|
90
94
|
? true
|
|
91
95
|
: false
|
|
92
96
|
}
|
|
97
|
+
hidden={
|
|
98
|
+
props?.hidden || element.hiddenFields.includes(fieldName)
|
|
99
|
+
? true
|
|
100
|
+
: false
|
|
101
|
+
}
|
|
93
102
|
label={props?.fieldLabel}
|
|
94
103
|
onChangeCallBack={(v: any) => {
|
|
95
104
|
formManager.setValue(fieldName, v);
|
|
@@ -127,6 +136,11 @@ const FormElementField: React.FC<FormElementFieldProps> = (
|
|
|
127
136
|
);
|
|
128
137
|
}
|
|
129
138
|
}}
|
|
139
|
+
hidden={
|
|
140
|
+
props?.hidden || element.hiddenFields.includes(fieldName)
|
|
141
|
+
? true
|
|
142
|
+
: false
|
|
143
|
+
}
|
|
130
144
|
value={formValues[fieldName]}
|
|
131
145
|
error={formManager.formState.errors[fieldName] != undefined}
|
|
132
146
|
errorMessage={formManager?.formState?.errors[
|
|
@@ -146,6 +160,11 @@ const FormElementField: React.FC<FormElementFieldProps> = (
|
|
|
146
160
|
);
|
|
147
161
|
}
|
|
148
162
|
}}
|
|
163
|
+
hidden={
|
|
164
|
+
props?.hidden || element.hiddenFields.includes(fieldName)
|
|
165
|
+
? true
|
|
166
|
+
: false
|
|
167
|
+
}
|
|
149
168
|
value={formValues[fieldName]}
|
|
150
169
|
checkedValue={props?.checkedValue || true}
|
|
151
170
|
unCheckedValue={props?.unCheckedValue || false}
|
|
@@ -165,6 +184,11 @@ const FormElementField: React.FC<FormElementFieldProps> = (
|
|
|
165
184
|
? true
|
|
166
185
|
: false
|
|
167
186
|
}
|
|
187
|
+
hidden={
|
|
188
|
+
props?.hidden || element.hiddenFields.includes(fieldName)
|
|
189
|
+
? true
|
|
190
|
+
: false
|
|
191
|
+
}
|
|
168
192
|
onChangeCallBack={(v: any, selectedRecord: any) => {
|
|
169
193
|
let newValue = null;
|
|
170
194
|
if (v) {
|
|
@@ -197,6 +221,11 @@ const FormElementField: React.FC<FormElementFieldProps> = (
|
|
|
197
221
|
? true
|
|
198
222
|
: false
|
|
199
223
|
}
|
|
224
|
+
hidden={
|
|
225
|
+
props?.hidden || element.hiddenFields.includes(fieldName)
|
|
226
|
+
? true
|
|
227
|
+
: false
|
|
228
|
+
}
|
|
200
229
|
onChangeCallBack={(v: any, selectedRecord: any) => {
|
|
201
230
|
let newValue = null;
|
|
202
231
|
if (v) {
|
package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/CheckBox.tsx
CHANGED
|
@@ -5,6 +5,7 @@ interface CheckBoxProps {
|
|
|
5
5
|
value: any;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
required?: boolean;
|
|
8
|
+
hidden?: boolean;
|
|
8
9
|
label: string;
|
|
9
10
|
checkedValue?: any;
|
|
10
11
|
unCheckedValue?: any;
|
|
@@ -17,6 +18,7 @@ const CheckBox: React.FC<CheckBoxProps> = (props) => {
|
|
|
17
18
|
return (
|
|
18
19
|
<FormControlLabel
|
|
19
20
|
sx={props.sx}
|
|
21
|
+
hidden={props?.hidden || false}
|
|
20
22
|
disabled={props.disabled || false}
|
|
21
23
|
required={props.required || false}
|
|
22
24
|
control={
|
package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/ComboBox.tsx
CHANGED
|
@@ -10,6 +10,7 @@ interface ComboBoxProps {
|
|
|
10
10
|
required?: boolean;
|
|
11
11
|
options: Array<any>;
|
|
12
12
|
errorMessage?: any;
|
|
13
|
+
hidden?: boolean;
|
|
13
14
|
displayField: string;
|
|
14
15
|
valueField: string;
|
|
15
16
|
sx?: any;
|
|
@@ -32,6 +33,7 @@ const ComboBox: React.FC<ComboBoxProps> = (props) => {
|
|
|
32
33
|
value={getValue(props.value)}
|
|
33
34
|
options={props.options}
|
|
34
35
|
disabled={props.disabled}
|
|
36
|
+
hidden={props?.hidden || false}
|
|
35
37
|
onChange={(event, newValue) => {
|
|
36
38
|
if (
|
|
37
39
|
props.onChangeCallBack !== undefined &&
|
package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/Datefield.tsx
CHANGED
|
@@ -3,12 +3,14 @@ import { AdapterMoment } from "@mui/x-date-pickers/AdapterMoment";
|
|
|
3
3
|
import moment from "moment";
|
|
4
4
|
import { DATE_FORMAT } from "../../../../../util/constants";
|
|
5
5
|
import { useTranslation } from "react-i18next";
|
|
6
|
+
import TemplateTextField from "./TemplateTextField";
|
|
6
7
|
|
|
7
8
|
interface DatefieldProps {
|
|
8
9
|
value: string | null;
|
|
9
10
|
label: string;
|
|
10
11
|
disabled?: boolean;
|
|
11
12
|
required?: boolean;
|
|
13
|
+
hidden?: boolean;
|
|
12
14
|
sx?: any;
|
|
13
15
|
format?: string;
|
|
14
16
|
errorMessage?: any;
|
|
@@ -18,6 +20,9 @@ interface DatefieldProps {
|
|
|
18
20
|
|
|
19
21
|
const Datefield: React.FC<DatefieldProps> = (props) => {
|
|
20
22
|
const { t } = useTranslation();
|
|
23
|
+
if (props?.hidden) {
|
|
24
|
+
return <></>;
|
|
25
|
+
}
|
|
21
26
|
return (
|
|
22
27
|
<LocalizationProvider dateAdapter={AdapterMoment}>
|
|
23
28
|
<DatePicker
|
package/src/components/templates/DataEntryTemplates/TemplateDataForm/FormFields/DatetimeField.tsx
CHANGED
|
@@ -3,12 +3,15 @@ import { AdapterMoment } from "@mui/x-date-pickers/AdapterMoment";
|
|
|
3
3
|
import moment from "moment";
|
|
4
4
|
import { useTranslation } from "react-i18next";
|
|
5
5
|
import { DATE_TIME_FORMAT } from "../../../../../util/constants";
|
|
6
|
+
import TemplateTextField from "./TemplateTextField";
|
|
7
|
+
import { Hidden, TextField } from "@mui/material";
|
|
6
8
|
|
|
7
9
|
interface DatetimeFieldProps {
|
|
8
10
|
value: string | null;
|
|
9
11
|
label: string;
|
|
10
12
|
disabled?: boolean;
|
|
11
13
|
required?: boolean;
|
|
14
|
+
hidden?: boolean;
|
|
12
15
|
format?: string;
|
|
13
16
|
sx?: any;
|
|
14
17
|
errorMessage?: any;
|
|
@@ -18,6 +21,9 @@ interface DatetimeFieldProps {
|
|
|
18
21
|
|
|
19
22
|
const DatetimeField: React.FC<DatetimeFieldProps> = (props) => {
|
|
20
23
|
const { t } = useTranslation();
|
|
24
|
+
if (props?.hidden) {
|
|
25
|
+
return <></>;
|
|
26
|
+
}
|
|
21
27
|
return (
|
|
22
28
|
<LocalizationProvider dateAdapter={AdapterMoment}>
|
|
23
29
|
<DateTimePicker
|
|
@@ -44,6 +50,7 @@ const DatetimeField: React.FC<DatetimeFieldProps> = (props) => {
|
|
|
44
50
|
}}
|
|
45
51
|
slotProps={{
|
|
46
52
|
textField: {
|
|
53
|
+
InputLabelProps: { shrink: true },
|
|
47
54
|
variant: "outlined",
|
|
48
55
|
required: props.required,
|
|
49
56
|
error:
|
|
@@ -140,7 +140,7 @@ const TemplateGrid: React.FC<TemplateGridProps> = (props) => {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
const themeDirection = useSelector(
|
|
143
|
-
(state: any) =>
|
|
143
|
+
(state: any) => state.AppLayout.appDirection
|
|
144
144
|
);
|
|
145
145
|
|
|
146
146
|
const clearGridState = () => {
|
|
@@ -29,5 +29,7 @@ export { default as TemplatePieChart } from "./visuals/charts/TemplatePieChart";
|
|
|
29
29
|
export { default as DashboardRouteView } from "./visuals/DashboardRouteView";
|
|
30
30
|
export { default as DashboardViewer } from "./visuals/DashboardViewer";
|
|
31
31
|
|
|
32
|
+
export { default as FormElement } from "./DataEntryTemplates/TemplateDataForm/FormElementField";
|
|
33
|
+
|
|
32
34
|
export type * from "./DataEntryTemplates/DataEntryTypes";
|
|
33
35
|
export type { TransferListProps } from "./TransferList";
|
package/src/hooks/index.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { useTranslation } from "react-i18next";
|
|
2
|
+
import { useForm } from "react-hook-form";
|
|
3
|
+
import { useParams } from "react-router-dom";
|
|
4
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
1
7
|
export { default as useAxios } from "./useAxios";
|
|
2
8
|
export { useConfirmationWindow } from "./UseConfirmationWindow";
|
|
3
9
|
export { default as useLoadingMask } from "./useLoadingMask";
|
|
@@ -5,3 +11,8 @@ export { useIsMobile } from "./UseMobile";
|
|
|
5
11
|
export { default as useSession } from "./UseSession";
|
|
6
12
|
export { useWindow } from "./UseWindow";
|
|
7
13
|
export { default as useApiActions } from "./useApiActions";
|
|
14
|
+
export { useDispatch };
|
|
15
|
+
export { useSelector };
|
|
16
|
+
export { useParams };
|
|
17
|
+
export { useForm, zodResolver, z as ZodLib };
|
|
18
|
+
export { useTranslation };
|