@solidstarters/solid-core-ui 1.1.5 → 1.1.7
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/components/auth/SolidChangeForcePassword.d.ts.map +1 -1
- package/dist/components/auth/SolidChangeForcePassword.js +7 -7
- package/dist/components/auth/SolidChangeForcePassword.js.map +1 -1
- package/dist/components/auth/SolidForgotPassword.d.ts.map +1 -1
- package/dist/components/auth/SolidForgotPassword.js +9 -4
- package/dist/components/auth/SolidForgotPassword.js.map +1 -1
- package/dist/components/auth/SolidLogin.d.ts.map +1 -1
- package/dist/components/auth/SolidLogin.js +14 -7
- package/dist/components/auth/SolidLogin.js.map +1 -1
- package/dist/components/common/BackButton.d.ts +2 -0
- package/dist/components/common/BackButton.d.ts.map +1 -0
- package/dist/components/common/BackButton.js +17 -0
- package/dist/components/common/BackButton.js.map +1 -0
- package/dist/components/common/CancelButton.js +2 -2
- package/dist/components/common/CancelButton.js.map +1 -1
- package/dist/components/common/DropzonePlaceholder.d.ts.map +1 -1
- package/dist/components/common/DropzonePlaceholder.js +2 -1
- package/dist/components/common/DropzonePlaceholder.js.map +1 -1
- package/dist/components/common/FileReaderExt.d.ts +4 -0
- package/dist/components/common/FileReaderExt.d.ts.map +1 -0
- package/dist/components/common/FileReaderExt.js +15 -0
- package/dist/components/common/FileReaderExt.js.map +1 -0
- package/dist/components/common/GeneralSettings.d.ts +4 -0
- package/dist/components/common/GeneralSettings.d.ts.map +1 -0
- package/dist/components/common/GeneralSettings.js +139 -0
- package/dist/components/common/GeneralSettings.js.map +1 -0
- package/dist/components/common/SingleSelectAutoCompleteField.d.ts.map +1 -1
- package/dist/components/common/SingleSelectAutoCompleteField.js +1 -1
- package/dist/components/common/SingleSelectAutoCompleteField.js.map +1 -1
- package/dist/components/common/SocialMediaLogin.js +1 -1
- package/dist/components/common/SocialMediaLogin.js.map +1 -1
- package/dist/components/common/SolidFormStepper.d.ts +2 -0
- package/dist/components/common/SolidFormStepper.d.ts.map +1 -0
- package/dist/components/common/SolidFormStepper.js +6 -0
- package/dist/components/common/SolidFormStepper.js.map +1 -0
- package/dist/components/core/form/SolidFormView.d.ts.map +1 -1
- package/dist/components/core/form/SolidFormView.js +83 -54
- package/dist/components/core/form/SolidFormView.js.map +1 -1
- package/dist/components/core/form/fields/SolidBooleanField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidBooleanField.js +4 -4
- package/dist/components/core/form/fields/SolidBooleanField.js.map +1 -1
- package/dist/components/core/form/fields/SolidDateField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidDateField.js +7 -7
- package/dist/components/core/form/fields/SolidDateField.js.map +1 -1
- package/dist/components/core/form/fields/SolidDateTimeField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidDateTimeField.js +7 -7
- package/dist/components/core/form/fields/SolidDateTimeField.js.map +1 -1
- package/dist/components/core/form/fields/SolidDecimalField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidDecimalField.js +4 -4
- package/dist/components/core/form/fields/SolidDecimalField.js.map +1 -1
- package/dist/components/core/form/fields/SolidIntegerField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidIntegerField.js +4 -4
- package/dist/components/core/form/fields/SolidIntegerField.js.map +1 -1
- package/dist/components/core/form/fields/SolidJsonField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidJsonField.js +2 -2
- package/dist/components/core/form/fields/SolidJsonField.js.map +1 -1
- package/dist/components/core/form/fields/SolidLongTextField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidLongTextField.js +2 -2
- package/dist/components/core/form/fields/SolidLongTextField.js.map +1 -1
- package/dist/components/core/form/fields/SolidMediaMultipleField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidMediaMultipleField.js +11 -11
- package/dist/components/core/form/fields/SolidMediaMultipleField.js.map +1 -1
- package/dist/components/core/form/fields/SolidMediaSingleField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidMediaSingleField.js +13 -13
- package/dist/components/core/form/fields/SolidMediaSingleField.js.map +1 -1
- package/dist/components/core/form/fields/SolidRichTextField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidRichTextField.js +2 -2
- package/dist/components/core/form/fields/SolidRichTextField.js.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionDynamicField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionDynamicField.js +4 -4
- package/dist/components/core/form/fields/SolidSelectionDynamicField.js.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionStaticField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidSelectionStaticField.js +4 -4
- package/dist/components/core/form/fields/SolidSelectionStaticField.js.map +1 -1
- package/dist/components/core/form/fields/SolidShortTextField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidShortTextField.js +2 -2
- package/dist/components/core/form/fields/SolidShortTextField.js.map +1 -1
- package/dist/components/core/form/fields/SolidTimeField.d.ts.map +1 -1
- package/dist/components/core/form/fields/SolidTimeField.js +7 -7
- package/dist/components/core/form/fields/SolidTimeField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js +15 -14
- package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js +2 -2
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js +2 -2
- package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js.map +1 -1
- package/dist/components/core/model/CreateModel.d.ts.map +1 -1
- package/dist/components/core/model/CreateModel.js +15 -11
- package/dist/components/core/model/CreateModel.js.map +1 -1
- package/dist/components/core/model/FieldMetaData.d.ts.map +1 -1
- package/dist/components/core/model/FieldMetaData.js +6 -6
- package/dist/components/core/model/FieldMetaData.js.map +1 -1
- package/dist/components/core/model/FieldMetaDataForm.d.ts.map +1 -1
- package/dist/components/core/model/FieldMetaDataForm.js +167 -152
- package/dist/components/core/model/FieldMetaDataForm.js.map +1 -1
- package/dist/components/core/model/FieldSelector.d.ts.map +1 -1
- package/dist/components/core/model/FieldSelector.js +1 -1
- package/dist/components/core/model/FieldSelector.js.map +1 -1
- package/dist/components/core/model/ModelMetaData.d.ts.map +1 -1
- package/dist/components/core/model/ModelMetaData.js +46 -42
- package/dist/components/core/model/ModelMetaData.js.map +1 -1
- package/dist/components/core/module/CreateModule.d.ts.map +1 -1
- package/dist/components/core/module/CreateModule.js +98 -60
- package/dist/components/core/module/CreateModule.js.map +1 -1
- package/dist/components/core/users/CreateUser.d.ts.map +1 -1
- package/dist/components/core/users/CreateUser.js +18 -15
- package/dist/components/core/users/CreateUser.js.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/redux/api/solidSettingsApi.d.ts +9 -0
- package/dist/redux/api/solidSettingsApi.d.ts.map +1 -0
- package/dist/redux/api/solidSettingsApi.js +40 -0
- package/dist/redux/api/solidSettingsApi.js.map +1 -0
- package/package.json +1 -1
- package/src/components/auth/SolidChangeForcePassword.tsx +2 -3
- package/src/components/auth/SolidForgotPassword.tsx +9 -4
- package/src/components/auth/SolidLogin.tsx +22 -13
- package/src/components/common/BackButton.tsx +27 -0
- package/src/components/common/CancelButton.tsx +2 -2
- package/src/components/common/DropzonePlaceholder.tsx +11 -3
- package/src/components/common/FileReaderExt.tsx +18 -0
- package/src/components/common/GeneralSettings.tsx +286 -0
- package/src/components/common/SingleSelectAutoCompleteField.tsx +0 -1
- package/src/components/common/SocialMediaLogin.tsx +1 -1
- package/src/components/common/SolidFormStepper.tsx +12 -0
- package/src/components/core/form/SolidFormView.tsx +201 -186
- package/src/components/core/form/fields/SolidBooleanField.tsx +3 -7
- package/src/components/core/form/fields/SolidDateField.tsx +2 -8
- package/src/components/core/form/fields/SolidDateTimeField.tsx +19 -24
- package/src/components/core/form/fields/SolidDecimalField.tsx +2 -7
- package/src/components/core/form/fields/SolidIntegerField.tsx +17 -22
- package/src/components/core/form/fields/SolidJsonField.tsx +15 -19
- package/src/components/core/form/fields/SolidLongTextField.tsx +19 -24
- package/src/components/core/form/fields/SolidMediaMultipleField.tsx +47 -51
- package/src/components/core/form/fields/SolidMediaSingleField.tsx +47 -51
- package/src/components/core/form/fields/SolidRichTextField.tsx +3 -7
- package/src/components/core/form/fields/SolidSelectionDynamicField.tsx +2 -7
- package/src/components/core/form/fields/SolidSelectionStaticField.tsx +20 -25
- package/src/components/core/form/fields/SolidShortTextField.tsx +18 -23
- package/src/components/core/form/fields/SolidTimeField.tsx +19 -24
- package/src/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +51 -52
- package/src/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +20 -25
- package/src/components/core/form/fields/relations/SolidRelationOneToManyField.tsx +6 -5
- package/src/components/core/model/CreateModel.tsx +68 -53
- package/src/components/core/model/FieldMetaData.tsx +16 -21
- package/src/components/core/model/FieldMetaDataForm.tsx +802 -896
- package/src/components/core/model/FieldSelector.tsx +10 -15
- package/src/components/core/model/ModelMetaData.tsx +364 -356
- package/src/components/core/module/CreateModule.tsx +327 -295
- package/src/components/core/users/CreateUser.tsx +175 -167
- package/src/index.ts +5 -2
- package/src/redux/api/solidSettingsApi.tsx +47 -0
- package/solidstarters-solid-core-ui-1.1.2.tgz +0 -0
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
"use client"
|
|
2
|
+
import { BackButton } from "@/components/common/BackButton";
|
|
2
3
|
import { CancelButton } from "@/components/common/CancelButton";
|
|
3
4
|
import { DropzonePlaceholder } from "@/components/common/DropzonePlaceholder";
|
|
4
5
|
import { DropzoneUpload } from "@/components/common/DropzoneUpload";
|
|
6
|
+
import { FileReaderExt } from "@/components/common/FileReaderExt";
|
|
5
7
|
import { SingleSelectAutoCompleteField } from "@/components/common/SingleSelectAutoCompleteField";
|
|
8
|
+
import { SolidFormStepper } from "@/components/common/SolidFormStepper";
|
|
6
9
|
import { getSingularAndPlural } from "@/helpers/helpers";
|
|
7
10
|
import { handleError } from "@/helpers/ToastContainer";
|
|
8
11
|
import { useGetFieldDefaultMetaDataQuery } from "@/redux/api/fieldApi";
|
|
@@ -16,6 +19,8 @@ import { Divider } from "primereact/divider";
|
|
|
16
19
|
import { InputText } from "primereact/inputtext";
|
|
17
20
|
import { InputTextarea } from "primereact/inputtextarea";
|
|
18
21
|
import { Message } from "primereact/message";
|
|
22
|
+
import { OverlayPanel } from "primereact/overlaypanel";
|
|
23
|
+
import { ProgressBar } from "primereact/progressbar";
|
|
19
24
|
import { Toast } from "primereact/toast";
|
|
20
25
|
import { classNames } from "primereact/utils";
|
|
21
26
|
import React, { useEffect, useRef, useState } from "react";
|
|
@@ -47,6 +52,17 @@ const CreateModule = ({ data }: any) => {
|
|
|
47
52
|
const [menuIconPreview, setmenuIconPreview] = useState<
|
|
48
53
|
string | ArrayBuffer | null
|
|
49
54
|
>(null);
|
|
55
|
+
const [uploadProgress, setUploadProgress] = useState<number>(0);
|
|
56
|
+
const [uploadCompleted, setUploadCompleted] = useState<boolean>(false);
|
|
57
|
+
const [fileDetails, setFileDetails] = useState<{ name: string; type: string } | null>(null);
|
|
58
|
+
const [uploadedSize, setUploadedSize] = useState<string>("0 MB");
|
|
59
|
+
const [totalSize, setTotalSize] = useState<string>("0 KB");
|
|
60
|
+
|
|
61
|
+
const formatFileSize = (size: number) => {
|
|
62
|
+
return size >= 1024 * 1024
|
|
63
|
+
? `${(size / (1024 * 1024)).toFixed(1)} MB`
|
|
64
|
+
: `${(size / 1024).toFixed(1)} KB`;
|
|
65
|
+
};
|
|
50
66
|
|
|
51
67
|
const [
|
|
52
68
|
CreateModule,
|
|
@@ -144,19 +160,38 @@ const CreateModule = ({ data }: any) => {
|
|
|
144
160
|
},
|
|
145
161
|
});
|
|
146
162
|
|
|
147
|
-
|
|
148
163
|
const handleDropmenuIcon = (acceptedFiles: File[]) => {
|
|
149
164
|
const file = acceptedFiles[0];
|
|
150
|
-
if (file)
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
165
|
+
if (!file) return;
|
|
166
|
+
|
|
167
|
+
setUploadCompleted(false);
|
|
168
|
+
setUploadProgress(0);
|
|
169
|
+
setTotalSize(formatFileSize(file.size));
|
|
170
|
+
setUploadedSize("0 KB");
|
|
171
|
+
setFileDetails({ name: file.name, type: file.type });
|
|
172
|
+
|
|
173
|
+
const reader = new FileReader();
|
|
174
|
+
|
|
175
|
+
reader.onloadstart = () => {
|
|
176
|
+
setUploadProgress(0);
|
|
177
|
+
setUploadedSize("0 KB");
|
|
178
|
+
};
|
|
179
|
+
reader.onprogress = (event) => {
|
|
180
|
+
if (event.loaded && event.total) {
|
|
181
|
+
const percent = Math.round((event.loaded / event.total) * 100);
|
|
182
|
+
setUploadProgress(percent);
|
|
183
|
+
setUploadedSize(formatFileSize(event.loaded));
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
reader.onloadend = () => {
|
|
188
|
+
setUploadProgress(100);
|
|
189
|
+
setUploadCompleted(true);
|
|
190
|
+
setUploadedSize(totalSize); // Set uploaded size to total size after completion
|
|
191
|
+
};
|
|
192
|
+
|
|
193
|
+
reader.readAsDataURL(file);
|
|
194
|
+
formik.setFieldValue("menuIconUrl", file);
|
|
160
195
|
};
|
|
161
196
|
|
|
162
197
|
const { getRootProps: getRootPropsmenuIcon, getInputProps: getInputPropsmenuIcon, isDragActive: isDragActivemenuIcon } = useDropzone({
|
|
@@ -170,16 +205,28 @@ const CreateModule = ({ data }: any) => {
|
|
|
170
205
|
});
|
|
171
206
|
|
|
172
207
|
useEffect(() => {
|
|
173
|
-
if (data
|
|
208
|
+
if (data) {
|
|
174
209
|
setmenuIconPreview(`${process.env.API_URL}/${data.menuIconUrl}`);
|
|
210
|
+
|
|
211
|
+
const fileName = data.menuIconUrl.split("/").pop(); // Extract filename from URL
|
|
212
|
+
setFileDetails({ name: fileName || "Unknown File", type: "Uploaded File" });
|
|
213
|
+
|
|
214
|
+
// Set the upload progress to 100% since the file is already uploaded
|
|
215
|
+
setUploadProgress(100);
|
|
216
|
+
setUploadCompleted(true);
|
|
217
|
+
|
|
218
|
+
// Ensure Formik has the existing file URL
|
|
219
|
+
formik.setFieldValue("menuIconUrl", data.menuIconUrl);
|
|
175
220
|
}
|
|
176
221
|
}, [data])
|
|
177
|
-
|
|
178
|
-
const handleDeleteMenuIcon = (e: React.MouseEvent) => {
|
|
222
|
+
const handleCancelUpload = (e: React.MouseEvent) => {
|
|
179
223
|
e.stopPropagation();
|
|
180
|
-
|
|
224
|
+
setUploadProgress(0);
|
|
225
|
+
setUploadCompleted(false);
|
|
226
|
+
setFileDetails(null);
|
|
181
227
|
formik.setFieldValue("menuIconUrl", null);
|
|
182
|
-
}
|
|
228
|
+
};
|
|
229
|
+
|
|
183
230
|
|
|
184
231
|
const deteleAction = async () => {
|
|
185
232
|
deleteModule(data.id);
|
|
@@ -276,301 +323,286 @@ const CreateModule = ({ data }: any) => {
|
|
|
276
323
|
});
|
|
277
324
|
}, [isError, isModuleUpdateError, isModuleDeleteError, isMediaDeleteError])
|
|
278
325
|
|
|
279
|
-
|
|
280
|
-
|
|
326
|
+
const op = useRef(null);
|
|
327
|
+
|
|
328
|
+
const formActionDropdown = () => {
|
|
329
|
+
return (
|
|
330
|
+
<div>
|
|
331
|
+
<Button
|
|
332
|
+
outlined
|
|
333
|
+
severity="secondary"
|
|
334
|
+
type="button"
|
|
335
|
+
icon='pi pi-ellipsis-h'
|
|
336
|
+
size="small"
|
|
337
|
+
className="max-w-2rem bg-primary-reverse"
|
|
338
|
+
onClick={(e) =>
|
|
339
|
+
// @ts-ignore
|
|
340
|
+
op.current.toggle(e)
|
|
341
|
+
}
|
|
342
|
+
/>
|
|
343
|
+
<OverlayPanel ref={op} className="solid-custom-overlay" style={{ top: 10 }}>
|
|
344
|
+
<div className="flex flex-column gap-1 p-1">
|
|
345
|
+
<Button
|
|
346
|
+
text
|
|
347
|
+
type="button"
|
|
348
|
+
className="w-8rem text-left gap-2 text-color"
|
|
349
|
+
label="Duplicate"
|
|
350
|
+
size="small"
|
|
351
|
+
iconPos="left"
|
|
352
|
+
icon={<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
|
353
|
+
<path d="M6 11.9997C5.63333 11.9997 5.31944 11.8691 5.05833 11.608C4.79722 11.3469 4.66667 11.033 4.66667 10.6663V2.66634C4.66667 2.29967 4.79722 1.98579 5.05833 1.72467C5.31944 1.46356 5.63333 1.33301 6 1.33301H12C12.3667 1.33301 12.6806 1.46356 12.9417 1.72467C13.2028 1.98579 13.3333 2.29967 13.3333 2.66634V10.6663C13.3333 11.033 13.2028 11.3469 12.9417 11.608C12.6806 11.8691 12.3667 11.9997 12 11.9997H6ZM6 10.6663H12V2.66634H6V10.6663ZM3.33333 14.6663C2.96667 14.6663 2.65278 14.5358 2.39167 14.2747C2.13056 14.0136 2 13.6997 2 13.333V3.99967H3.33333V13.333H10.6667V14.6663H3.33333Z" fill="black" fill-opacity="0.88" />
|
|
354
|
+
</svg>}
|
|
355
|
+
/>
|
|
356
|
+
<Button
|
|
357
|
+
text
|
|
358
|
+
type="button"
|
|
359
|
+
className="w-8rem text-left gap-2 text-color"
|
|
360
|
+
label="Delete"
|
|
361
|
+
size="small"
|
|
362
|
+
iconPos="left"
|
|
363
|
+
icon={<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
|
364
|
+
<path d="M4.66666 14C4.29999 14 3.9861 13.8694 3.72499 13.6083C3.46388 13.3472 3.33332 13.0333 3.33332 12.6667V4H2.66666V2.66667H5.99999V2H9.99999V2.66667H13.3333V4H12.6667V12.6667C12.6667 13.0333 12.5361 13.3472 12.275 13.6083C12.0139 13.8694 11.7 14 11.3333 14H4.66666ZM11.3333 4H4.66666V12.6667H11.3333V4ZM5.99999 11.3333H7.33332V5.33333H5.99999V11.3333ZM8.66666 11.3333H9.99999V5.33333H8.66666V11.3333Z" fill="#4B4D52" />
|
|
365
|
+
</svg>
|
|
366
|
+
}
|
|
367
|
+
onClick={deteleAction}
|
|
368
|
+
/>
|
|
369
|
+
</div>
|
|
370
|
+
</OverlayPanel>
|
|
371
|
+
</div>
|
|
372
|
+
)
|
|
373
|
+
}
|
|
281
374
|
|
|
282
375
|
return (
|
|
283
|
-
<div className="
|
|
284
|
-
<
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
<div className="flex
|
|
290
|
-
<
|
|
291
|
-
|
|
292
|
-
<div className="gap-3 flex">
|
|
293
|
-
<div>
|
|
294
|
-
<Button label="Save" size="small" onClick={() => showError()} type="submit" className="small-button" />
|
|
295
|
-
</div>
|
|
296
|
-
<CancelButton />
|
|
297
|
-
</div>
|
|
376
|
+
<div className="solid-form-wrapper">
|
|
377
|
+
<Toast ref={toast} />
|
|
378
|
+
<form onSubmit={formik.handleSubmit}>
|
|
379
|
+
<div className="solid-form-header">
|
|
380
|
+
{pathname.includes('new') ?
|
|
381
|
+
<>
|
|
382
|
+
<div className="flex align-items-center gap-3">
|
|
383
|
+
<BackButton />
|
|
384
|
+
<div className="form-wrapper-title">Create Module</div>
|
|
298
385
|
</div>
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
<
|
|
302
|
-
<div className="gap-3 flex">
|
|
303
|
-
{data?.isSystem !== true &&
|
|
304
|
-
<>
|
|
305
|
-
<div>
|
|
306
|
-
<Button label="Save" size="small" onClick={() => showError()} type="submit" className="small-button" />
|
|
307
|
-
</div>
|
|
308
|
-
<div>
|
|
309
|
-
<Button size="small" type="button" label="Delete" severity="danger" onClick={deteleAction} className="small-button" />
|
|
310
|
-
</div>
|
|
311
|
-
</>
|
|
312
|
-
}
|
|
313
|
-
<CancelButton />
|
|
314
|
-
</div>
|
|
386
|
+
<div className="gap-3 flex">
|
|
387
|
+
<Button label="Save" size="small" onClick={() => showError()} type="submit" />
|
|
388
|
+
<CancelButton />
|
|
315
389
|
</div>
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
name="displayName"
|
|
332
|
-
// onChange={formik.handleChange}
|
|
333
|
-
onChange={(e) => {
|
|
334
|
-
|
|
335
|
-
formik.handleChange(e);
|
|
336
|
-
const { toKebabCase, toSnakeCase, toPluralCamelCase } = getSingularAndPlural(e.target.value);
|
|
337
|
-
if (pathname.includes('new')) {
|
|
338
|
-
formik.setFieldValue("name", toKebabCase);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
}}
|
|
342
|
-
value={formik.values.displayName}
|
|
343
|
-
className={classNames("p-inputtext-sm small-input w-full", {
|
|
344
|
-
"p-invalid": isFormFieldValid(formik, "displayName"),
|
|
345
|
-
})}
|
|
346
|
-
/>
|
|
347
|
-
{isFormFieldValid(formik, "displayName") && (
|
|
348
|
-
<Message
|
|
349
|
-
severity="error"
|
|
350
|
-
text={formik?.errors?.displayName?.toString()}
|
|
351
|
-
/>
|
|
352
|
-
)}
|
|
353
|
-
</div>
|
|
354
|
-
</div>
|
|
355
|
-
<div className="md:col-12 sm:col-12 mx-auto">
|
|
356
|
-
<div className="field">
|
|
357
|
-
<label htmlFor="name" className="form-label form-field-label">
|
|
358
|
-
Name <span style={{ color: 'red' }}>*</span>
|
|
359
|
-
</label>
|
|
360
|
-
<InputText
|
|
361
|
-
disabled
|
|
362
|
-
type="text"
|
|
363
|
-
id="name"
|
|
364
|
-
name="name"
|
|
365
|
-
onChange={formik.handleChange}
|
|
366
|
-
value={formik.values.name}
|
|
367
|
-
className={classNames("p-inputtext-sm small-input w-full", {
|
|
368
|
-
"p-invalid": isFormFieldValid(formik, "name"),
|
|
369
|
-
})}
|
|
370
|
-
/>
|
|
371
|
-
{isFormFieldValid(formik, "name") && (
|
|
372
|
-
<Message severity="error" text={formik?.errors?.name?.toString()} />
|
|
373
|
-
)}
|
|
374
|
-
</div>
|
|
375
|
-
</div>
|
|
376
|
-
<div className="md:col-12 sm:col-12 mx-auto">
|
|
377
|
-
<div className="field">
|
|
378
|
-
<label htmlFor="description" className="form-label form-field-label">
|
|
379
|
-
Description <span style={{ color: 'red' }}>*</span>
|
|
380
|
-
</label>
|
|
381
|
-
<InputTextarea
|
|
382
|
-
id="description"
|
|
383
|
-
name="description"
|
|
384
|
-
onChange={formik.handleChange}
|
|
385
|
-
value={formik.values.description}
|
|
386
|
-
className={classNames("p-inputtext-sm w-full", {
|
|
387
|
-
"p-invalid": isFormFieldValid(formik, "description"),
|
|
388
|
-
})}
|
|
389
|
-
rows={5}
|
|
390
|
-
cols={30}
|
|
391
|
-
/>
|
|
392
|
-
{isFormFieldValid(formik, "description") && (
|
|
393
|
-
<Message
|
|
394
|
-
severity="error"
|
|
395
|
-
text={formik?.errors?.description?.toString()}
|
|
396
|
-
/>
|
|
397
|
-
)}
|
|
398
|
-
</div>
|
|
399
|
-
</div>
|
|
400
|
-
|
|
401
|
-
<div className="md:col-12 sm:col-12 mx-auto">
|
|
402
|
-
<div className="field">
|
|
403
|
-
<label htmlFor="description" className="form-label form-field-label">
|
|
404
|
-
Menu Sequence Number
|
|
405
|
-
</label>
|
|
406
|
-
<InputText
|
|
407
|
-
id="menuSequenceNumber"
|
|
408
|
-
type="number"
|
|
409
|
-
onChange={formik.handleChange}
|
|
410
|
-
min={0}
|
|
411
|
-
value={formik.values.menuSequenceNumber}
|
|
412
|
-
className={classNames("p-inputtext-sm w-full", {
|
|
413
|
-
"p-invalid": isFormFieldValid(formik, "menuSequenceNumber"),
|
|
414
|
-
})}
|
|
415
|
-
/>
|
|
416
|
-
{isFormFieldValid(formik, "menuSequenceNumber") && (
|
|
417
|
-
<Message
|
|
418
|
-
severity="error"
|
|
419
|
-
text={formik?.errors?.menuSequenceNumber?.toString()}
|
|
420
|
-
/>
|
|
421
|
-
)}
|
|
422
|
-
</div>
|
|
423
|
-
</div>
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
</div>
|
|
428
|
-
</div>
|
|
390
|
+
</>
|
|
391
|
+
:
|
|
392
|
+
<>
|
|
393
|
+
<div className="flex align-items-center gap-3">
|
|
394
|
+
<BackButton />
|
|
395
|
+
<div className="form-wrapper-title"> Edit Module</div>
|
|
396
|
+
</div>
|
|
397
|
+
<div className="gap-3 flex">
|
|
398
|
+
{data?.isSystem !== true &&
|
|
399
|
+
<>
|
|
400
|
+
<Button label="Save" size="small" onClick={() => showError()} type="submit" />
|
|
401
|
+
<CancelButton />
|
|
402
|
+
{formActionDropdown()}
|
|
403
|
+
</>
|
|
404
|
+
}
|
|
429
405
|
</div>
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
name="defaultDataSource"
|
|
457
|
-
value={formik.values.defaultDataSource}
|
|
458
|
-
options={dataSources}
|
|
459
|
-
onChange={(e) =>
|
|
460
|
-
formik.setFieldValue("defaultDataSource", e.value)
|
|
406
|
+
</>
|
|
407
|
+
}
|
|
408
|
+
</div>
|
|
409
|
+
<div className="solid-form-stepper">
|
|
410
|
+
<SolidFormStepper />
|
|
411
|
+
</div>
|
|
412
|
+
<div className="p-4 solid-form-content">
|
|
413
|
+
<div className="grid">
|
|
414
|
+
<div className="col-8 mx-auto">
|
|
415
|
+
<p className="form-wrapper-heading text-base">Basic Info</p>
|
|
416
|
+
<div className="formgrid grid">
|
|
417
|
+
<div className="field col-6 flex flex-column gap-2">
|
|
418
|
+
<label htmlFor="displayName" className="form-field-label">
|
|
419
|
+
Display Name <span style={{ color: 'red' }}>*</span>
|
|
420
|
+
</label>
|
|
421
|
+
<InputText
|
|
422
|
+
disabled={data ? true : false}
|
|
423
|
+
type="text"
|
|
424
|
+
id="displayName"
|
|
425
|
+
name="displayName"
|
|
426
|
+
// onChange={formik.handleChange}
|
|
427
|
+
onChange={(e) => {
|
|
428
|
+
formik.handleChange(e);
|
|
429
|
+
const { toKebabCase, toSnakeCase, toPluralCamelCase } = getSingularAndPlural(e.target.value);
|
|
430
|
+
if (pathname.includes('new')) {
|
|
431
|
+
formik.setFieldValue("name", toKebabCase);
|
|
461
432
|
}
|
|
462
|
-
placeholder="Select a Data Source"
|
|
463
|
-
className={classNames("p-inputtext-sm w-full", {
|
|
464
|
-
"p-invalid": isFormFieldValid(
|
|
465
|
-
formik,
|
|
466
|
-
"defaultDataSource"
|
|
467
|
-
),
|
|
468
|
-
})}
|
|
469
|
-
/> */}
|
|
470
|
-
{isFormFieldValid(formik, "defaultDataSource") && (
|
|
471
|
-
<Message
|
|
472
|
-
severity="error"
|
|
473
|
-
text={formik?.errors?.defaultDataSource?.toString()}
|
|
474
|
-
/>
|
|
475
|
-
)}
|
|
476
|
-
</div>
|
|
477
|
-
</div>
|
|
478
433
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
434
|
+
}}
|
|
435
|
+
value={formik.values.displayName}
|
|
436
|
+
className={classNames("", {
|
|
437
|
+
"p-invalid": isFormFieldValid(formik, "displayName"),
|
|
438
|
+
})}
|
|
439
|
+
/>
|
|
440
|
+
{isFormFieldValid(formik, "displayName") && (
|
|
441
|
+
<Message
|
|
442
|
+
severity="error"
|
|
443
|
+
text={formik?.errors?.displayName?.toString()}
|
|
444
|
+
/>
|
|
445
|
+
)}
|
|
446
|
+
</div>
|
|
447
|
+
<div className="field col-6 flex flex-column gap-2">
|
|
448
|
+
<label htmlFor="name" className="form-field-label">
|
|
449
|
+
Name <span style={{ color: 'red' }}>*</span>
|
|
450
|
+
</label>
|
|
451
|
+
<InputText
|
|
452
|
+
disabled
|
|
453
|
+
type="text"
|
|
454
|
+
id="name"
|
|
455
|
+
name="name"
|
|
456
|
+
onChange={formik.handleChange}
|
|
457
|
+
value={formik.values.name}
|
|
458
|
+
className={classNames("", {
|
|
459
|
+
"p-invalid": isFormFieldValid(formik, "name"),
|
|
460
|
+
})}
|
|
461
|
+
/>
|
|
462
|
+
{isFormFieldValid(formik, "name") && (
|
|
463
|
+
<Message severity="error" text={formik?.errors?.name?.toString()} />
|
|
464
|
+
)}
|
|
465
|
+
</div>
|
|
466
|
+
</div>
|
|
467
|
+
<div className="formgrid grid mt-4">
|
|
468
|
+
<div className="field col-6 flex flex-column gap-2">
|
|
469
|
+
<label htmlFor="description" className="form-field-label">
|
|
470
|
+
Menu Sequence Number
|
|
471
|
+
</label>
|
|
472
|
+
<InputText
|
|
473
|
+
id="menuSequenceNumber"
|
|
474
|
+
type="number"
|
|
475
|
+
onChange={formik.handleChange}
|
|
476
|
+
min={0}
|
|
477
|
+
value={formik.values.menuSequenceNumber}
|
|
478
|
+
className={classNames("", {
|
|
479
|
+
"p-invalid": isFormFieldValid(formik, "menuSequenceNumber"),
|
|
480
|
+
})}
|
|
481
|
+
/>
|
|
482
|
+
{isFormFieldValid(formik, "menuSequenceNumber") && (
|
|
483
|
+
<Message
|
|
484
|
+
severity="error"
|
|
485
|
+
text={formik?.errors?.menuSequenceNumber?.toString()}
|
|
486
|
+
/>
|
|
487
|
+
)}
|
|
488
|
+
</div>
|
|
489
|
+
<div className="field col-6 flex flex-column gap-2">
|
|
490
|
+
<label htmlFor="description" className="form-field-label">
|
|
491
|
+
Description <span style={{ color: 'red' }}>*</span>
|
|
492
|
+
</label>
|
|
493
|
+
<InputTextarea
|
|
494
|
+
id="description"
|
|
495
|
+
name="description"
|
|
496
|
+
onChange={formik.handleChange}
|
|
497
|
+
value={formik.values.description}
|
|
498
|
+
className={classNames("", {
|
|
499
|
+
"p-invalid": isFormFieldValid(formik, "description"),
|
|
500
|
+
})}
|
|
501
|
+
rows={5}
|
|
502
|
+
cols={30}
|
|
503
|
+
/>
|
|
504
|
+
{isFormFieldValid(formik, "description") && (
|
|
505
|
+
<Message
|
|
506
|
+
severity="error"
|
|
507
|
+
text={formik?.errors?.description?.toString()}
|
|
508
|
+
/>
|
|
509
|
+
)}
|
|
510
|
+
</div>
|
|
511
|
+
</div>
|
|
512
|
+
<Divider />
|
|
513
|
+
<p className="form-wrapper-heading text-base" style={{ fontSize: 16 }}>Configurations</p>
|
|
514
|
+
<div className="formgrid grid">
|
|
515
|
+
<div className="field col-6 flex flex-column gap-2">
|
|
516
|
+
<label htmlFor="defaultDataSource" className="form-field-label">
|
|
517
|
+
Default Data Source
|
|
518
|
+
</label>
|
|
519
|
+
<SingleSelectAutoCompleteField
|
|
520
|
+
disabled={data ? true : false}
|
|
521
|
+
key="defaultDataSource"
|
|
522
|
+
formik={formik}
|
|
523
|
+
isFormFieldValid={isFormFieldValid}
|
|
524
|
+
// relationField={false}
|
|
525
|
+
fieldName="defaultDataSource"
|
|
526
|
+
fieldNameId={null}
|
|
527
|
+
labelKey="label"
|
|
528
|
+
valueKey="value"
|
|
529
|
+
searchData={serachDDefaultDataSource}
|
|
530
|
+
existingData={formik.values.defaultDataSource}
|
|
531
|
+
/>
|
|
532
|
+
{isFormFieldValid(formik, "defaultDataSource") && (
|
|
533
|
+
<Message
|
|
534
|
+
severity="error"
|
|
535
|
+
text={formik?.errors?.defaultDataSource?.toString()}
|
|
536
|
+
/>
|
|
537
|
+
)}
|
|
538
|
+
</div>
|
|
539
|
+
<div className="field col-6 flex flex-column gap-2">
|
|
540
|
+
<label htmlFor="menuIconUrl" className="form-label form-field-label">
|
|
541
|
+
Menu Icon <small className="text-red-500 helper-text">(only svg, png and jpeg are allowed)</small>
|
|
542
|
+
</label>
|
|
543
|
+
<div {...getRootPropsmenuIcon()} className="solid-dropzone-wrapper">
|
|
544
|
+
<input {...getInputPropsmenuIcon()} />
|
|
545
|
+
<DropzonePlaceholder />
|
|
546
|
+
</div>
|
|
547
|
+
{isFormFieldValid(formik, "menuIconUrl") && (
|
|
548
|
+
<Message severity="error" text={formik?.errors?.menuIconUrl?.toString()} />
|
|
549
|
+
)}
|
|
550
|
+
|
|
551
|
+
{fileDetails && (
|
|
552
|
+
<div className="solid-file-upload-wrapper">
|
|
553
|
+
<div className="flex align-items-center gap-2">
|
|
554
|
+
<FileReaderExt fileDetails={fileDetails} />
|
|
555
|
+
<div className="w-full flex flex-column gap-1">
|
|
556
|
+
<div className="flex align-items-center justify-content-between">
|
|
557
|
+
<div className="font-bold">{fileDetails.name}</div>
|
|
558
|
+
<div className="cancel-upload-button" onClick={handleCancelUpload}>
|
|
559
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="6" height="6" viewBox="0 0 6 6" fill="none">
|
|
560
|
+
<path d="M0.6 6L0 5.4L2.4 3L0 0.6L0.6 0L3 2.4L5.4 0L6 0.6L3.6 3L6 5.4L5.4 6L3 3.6L0.6 6Z" fill="#4B4D52" />
|
|
561
|
+
</svg>
|
|
509
562
|
</div>
|
|
510
|
-
) : (<DropzonePlaceholder />)
|
|
511
|
-
)}
|
|
512
|
-
</div>
|
|
513
|
-
<p className="text-xs text-color-secondary">Note : For optimal display, use an image with dimensions of 24px width and 24px height.</p>
|
|
514
|
-
{isFormFieldValid(formik, "menuIconUrl") && (
|
|
515
|
-
<Message severity="error" text={formik?.errors?.menuIconUrl?.toString()} />
|
|
516
|
-
)}
|
|
517
|
-
</div>
|
|
518
|
-
</div>
|
|
519
|
-
|
|
520
|
-
{/*
|
|
521
|
-
<div className="md:col-12 sm:col-12 mx-auto">
|
|
522
|
-
<div className="field">
|
|
523
|
-
<label htmlFor="menuIconUrl" className="form-label form-field-label">
|
|
524
|
-
Menu Icon
|
|
525
|
-
</label>
|
|
526
|
-
<InputText
|
|
527
|
-
type="text"
|
|
528
|
-
id="menuIconUrl"
|
|
529
|
-
name="menuIconUrl"
|
|
530
|
-
onChange={formik.handleChange}
|
|
531
|
-
value={formik.values.menuIconUrl}
|
|
532
|
-
className={classNames("p-inputtext-sm small-input w-full", {
|
|
533
|
-
"p-invalid": isFormFieldValid(formik, "menuIconUrl"),
|
|
534
|
-
})}
|
|
535
|
-
/>
|
|
536
|
-
{isFormFieldValid(formik, "menuIconUrl") && (
|
|
537
|
-
<Message severity="error" text={formik?.errors?.menuIconUrl?.toString()} />
|
|
538
|
-
)}
|
|
539
|
-
</div>
|
|
540
|
-
</div> */}
|
|
541
|
-
{data &&
|
|
542
|
-
<div className="md:col-6 sm:col-12 mt-4">
|
|
543
|
-
<div className="field">
|
|
544
|
-
<div className="flex align-items-center">
|
|
545
|
-
<Checkbox
|
|
546
|
-
name="isSystem"
|
|
547
|
-
onChange={(e) => {
|
|
548
|
-
formik.setFieldValue("isSystem", e.checked);
|
|
549
|
-
}}
|
|
550
|
-
checked={formik.values.isSystem}
|
|
551
|
-
></Checkbox>
|
|
552
|
-
<label htmlFor="isSystem" className="form-field-label ml-2">
|
|
553
|
-
Is System
|
|
554
|
-
</label>
|
|
555
563
|
</div>
|
|
556
|
-
{
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
564
|
+
{
|
|
565
|
+
uploadCompleted ?
|
|
566
|
+
<div className="flex align-items-center gap-2 text-sm">
|
|
567
|
+
{totalSize} of {totalSize}
|
|
568
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="4" height="4" viewBox="0 0 4 4" fill="none">
|
|
569
|
+
<circle cx="2" cy="2" r="2" fill="#C1C1C1" />
|
|
570
|
+
</svg>
|
|
571
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
572
|
+
<mask id="mask0_2480_8635" style={{ maskType: 'alpha' }} maskUnits="userSpaceOnUse" x="0" y="0" width="20" height="20">
|
|
573
|
+
<rect width="20" height="20" fill="#D9D9D9" />
|
|
574
|
+
</mask>
|
|
575
|
+
<g mask="url(#mask0_2480_8635)">
|
|
576
|
+
<path d="M9.16 12.76L13.39 8.53L12.55 7.69L9.16 11.08L7.45 9.37L6.61 10.21L9.16 12.76ZM10 16C9.17 16 8.39 15.8424 7.66 15.5272C6.93 15.2124 6.295 14.785 5.755 14.245C5.215 13.705 4.7876 13.07 4.4728 12.34C4.1576 11.61 4 10.83 4 10C4 9.17 4.1576 8.39 4.4728 7.66C4.7876 6.93 5.215 6.295 5.755 5.755C6.295 5.215 6.93 4.7874 7.66 4.4722C8.39 4.1574 9.17 4 10 4C10.83 4 11.61 4.1574 12.34 4.4722C13.07 4.7874 13.705 5.215 14.245 5.755C14.785 6.295 15.2124 6.93 15.5272 7.66C15.8424 8.39 16 9.17 16 10C16 10.83 15.8424 11.61 15.5272 12.34C15.2124 13.07 14.785 13.705 14.245 14.245C13.705 14.785 13.07 15.2124 12.34 15.5272C11.61 15.8424 10.83 16 10 16Z" fill="#722ED1" />
|
|
577
|
+
</g>
|
|
578
|
+
</svg>
|
|
579
|
+
Completed
|
|
580
|
+
</div>
|
|
581
|
+
:
|
|
582
|
+
<div className="flex align-items-center gap-2 text-sm">
|
|
583
|
+
{uploadedSize} of {totalSize}
|
|
584
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="4" height="4" viewBox="0 0 4 4" fill="none">
|
|
585
|
+
<circle cx="2" cy="2" r="2" fill="#C1C1C1" />
|
|
586
|
+
</svg>
|
|
587
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16" fill="none">
|
|
588
|
+
<path d="M7.375 10.5V5.40625L5.75 7.03125L4.875 6.125L8 3L11.125 6.125L10.25 7.03125L8.625 5.40625V10.5H7.375ZM4.25 13C3.90625 13 3.61198 12.8776 3.36719 12.6328C3.1224 12.388 3 12.0938 3 11.75V9.875H4.25V11.75H11.75V9.875H13V11.75C13 12.0938 12.8776 12.388 12.6328 12.6328C12.388 12.8776 12.0938 13 11.75 13H4.25Z" fill="black" />
|
|
589
|
+
</svg>
|
|
590
|
+
Uploading ${uploadProgress}% Completed
|
|
591
|
+
</div>
|
|
592
|
+
}
|
|
562
593
|
</div>
|
|
563
594
|
</div>
|
|
564
|
-
|
|
565
|
-
|
|
595
|
+
<ProgressBar value={uploadProgress} showValue={false} style={{ height: 4 }} className="mt-2" />
|
|
596
|
+
</div>
|
|
597
|
+
)}
|
|
566
598
|
</div>
|
|
567
599
|
</div>
|
|
568
600
|
</div>
|
|
569
|
-
</
|
|
601
|
+
</div>
|
|
570
602
|
</div>
|
|
571
|
-
</
|
|
603
|
+
</form>
|
|
572
604
|
</div>
|
|
573
605
|
);
|
|
574
606
|
};
|
|
575
607
|
|
|
576
|
-
export default CreateModule;
|
|
608
|
+
export default CreateModule;
|