@solidxai/core-ui 0.1.12-beta.3 → 0.1.12-beta.6
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/AuthLayout.d.ts.map +1 -1
- package/dist/components/auth/AuthLayout.js +12 -5
- package/dist/components/auth/AuthLayout.js.map +1 -1
- package/dist/components/auth/AuthLayout.tsx +15 -4
- package/dist/components/auth/AuthSettingsContext.js +1 -1
- package/dist/components/auth/AuthSettingsContext.js.map +1 -1
- package/dist/components/auth/AuthSettingsContext.tsx +1 -1
- package/dist/components/core/chatter/SolidChatterHeader.d.ts.map +1 -1
- package/dist/components/core/chatter/SolidChatterHeader.js +18 -4
- package/dist/components/core/chatter/SolidChatterHeader.js.map +1 -1
- package/dist/components/core/chatter/SolidChatterHeader.tsx +17 -3
- package/dist/components/core/common/SolidGenericImport/SolidImportTransaction.d.ts.map +1 -1
- package/dist/components/core/common/SolidGenericImport/SolidImportTransaction.js +12 -2
- package/dist/components/core/common/SolidGenericImport/SolidImportTransaction.js.map +1 -1
- package/dist/components/core/common/SolidGenericImport/SolidImportTransaction.tsx +12 -1
- package/dist/components/core/extension/solid-core/metadata/MetadataExplorerFormWidget.d.ts +2 -0
- package/dist/components/core/extension/solid-core/metadata/MetadataExplorerFormWidget.d.ts.map +1 -1
- package/dist/components/core/extension/solid-core/metadata/MetadataExplorerFormWidget.js +4 -2
- package/dist/components/core/extension/solid-core/metadata/MetadataExplorerFormWidget.js.map +1 -1
- package/dist/components/core/extension/solid-core/metadata/MetadataExplorerFormWidget.tsx +11 -3
- package/dist/components/core/form/SolidFormView.js +1 -1
- package/dist/components/core/form/SolidFormView.js.map +1 -1
- package/dist/components/core/form/SolidFormView.tsx +1 -1
- package/dist/components/core/form/fields/relations/RolesGroupedByModuleWidget.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/RolesGroupedByModuleWidget.js +11 -1
- package/dist/components/core/form/fields/relations/RolesGroupedByModuleWidget.js.map +1 -1
- package/dist/components/core/form/fields/relations/RolesGroupedByModuleWidget.tsx +26 -19
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.d.ts.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js +13 -5
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js.map +1 -1
- package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +16 -9
- package/dist/components/core/json/SolidJsonEditor.css +7 -0
- package/dist/components/core/list/SolidDataTable.d.ts.map +1 -1
- package/dist/components/core/list/SolidDataTable.js +2 -2
- package/dist/components/core/list/SolidDataTable.js.map +1 -1
- package/dist/components/core/list/SolidDataTable.tsx +2 -1
- package/dist/components/core/list/SolidListView.d.ts.map +1 -1
- package/dist/components/core/list/SolidListView.js +58 -58
- package/dist/components/core/list/SolidListView.js.map +1 -1
- package/dist/components/core/list/SolidListView.tsx +5 -4
- package/dist/components/core/model/FieldMetaDataForm.d.ts +1 -1
- package/dist/components/core/model/FieldMetaDataForm.d.ts.map +1 -1
- package/dist/components/core/model/FieldMetaDataForm.js +119 -102
- package/dist/components/core/model/FieldMetaDataForm.js.map +1 -1
- package/dist/components/core/model/FieldMetaDataForm.tsx +82 -39
- package/dist/components/core/model/FieldSelector.d.ts +5 -1
- package/dist/components/core/model/FieldSelector.d.ts.map +1 -1
- package/dist/components/core/model/FieldSelector.js +25 -6
- package/dist/components/core/model/FieldSelector.js.map +1 -1
- package/dist/components/core/model/FieldSelector.tsx +50 -5
- package/dist/components/core/module/CreateModule.css +60 -6
- package/dist/components/core/module/CreateModule.d.ts.map +1 -1
- package/dist/components/core/module/CreateModule.js +2 -2
- package/dist/components/core/module/CreateModule.js.map +1 -1
- package/dist/components/core/module/CreateModule.tsx +56 -37
- package/dist/components/layout/AdminTopHeader.js +1 -1
- package/dist/components/layout/AdminTopHeader.js.map +1 -1
- package/dist/components/layout/AdminTopHeader.tsx +2 -2
- package/dist/components/shad-cn-ui/SolidSelect.d.ts +2 -1
- package/dist/components/shad-cn-ui/SolidSelect.d.ts.map +1 -1
- package/dist/components/shad-cn-ui/SolidSelect.js +12 -4
- package/dist/components/shad-cn-ui/SolidSelect.js.map +1 -1
- package/dist/components/shad-cn-ui/SolidSelect.tsx +13 -1
- package/dist/helpers/modelViewPersistence.d.ts.map +1 -1
- package/dist/helpers/modelViewPersistence.js +3 -2
- package/dist/helpers/modelViewPersistence.js.map +1 -1
- package/dist/helpers/modelViewPersistence.ts +3 -2
- package/dist/redux/api/datasourceIntrospectionApi.d.ts +43 -1
- package/dist/redux/api/datasourceIntrospectionApi.d.ts.map +1 -1
- package/dist/redux/api/datasourceIntrospectionApi.js +34 -1
- package/dist/redux/api/datasourceIntrospectionApi.js.map +1 -1
- package/dist/redux/api/datasourceIntrospectionApi.ts +61 -0
- package/dist/redux/store/defaultStoreConfig.d.ts +11 -0
- package/dist/redux/store/defaultStoreConfig.d.ts.map +1 -1
- package/dist/resources/solid-custom.css +3 -86
- package/dist/resources/solid-tailwind-generated.css +1 -1
- package/dist/resources/themes/solid-dark-purple/theme-variables.css +226 -0
- package/dist/resources/themes/solid-dark-purple/theme.css +1 -185
- package/dist/resources/themes/solid-light-purple/theme-variables.css +237 -0
- package/dist/resources/themes/solid-light-purple/theme.css +1 -206
- package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.css +396 -31
- package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.d.ts.map +1 -1
- package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.js +680 -152
- package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.js.map +1 -1
- package/dist/routes/pages/admin/core/DatasourceIntrospectionPage.tsx +1358 -441
- package/package.json +1 -1
|
@@ -868,7 +868,27 @@ const createValidationSchema = (currentFields: any, selectedType: any, allFields
|
|
|
868
868
|
return Yup.object(schema);
|
|
869
869
|
};
|
|
870
870
|
|
|
871
|
-
const FieldMetaDataForm = ({
|
|
871
|
+
const FieldMetaDataForm = ({
|
|
872
|
+
setIsDirty,
|
|
873
|
+
modelMetaData,
|
|
874
|
+
fieldMetaData,
|
|
875
|
+
setFieldMetaData,
|
|
876
|
+
allFields,
|
|
877
|
+
deleteModelFunction,
|
|
878
|
+
setVisiblePopup,
|
|
879
|
+
params,
|
|
880
|
+
setIsRequiredPopUp,
|
|
881
|
+
showToaster,
|
|
882
|
+
onDraftSubmit,
|
|
883
|
+
onClose,
|
|
884
|
+
availableFieldTypes,
|
|
885
|
+
forceShowTypeSelector = false,
|
|
886
|
+
selectorRequireContinue = false,
|
|
887
|
+
selectorContinueLabel = "Next",
|
|
888
|
+
selectorInitialFieldType = null,
|
|
889
|
+
disableIdentityEditingForExisting = true,
|
|
890
|
+
submitLabel = "Finish",
|
|
891
|
+
}: any) => {
|
|
872
892
|
const booleanOptions = ["false", "true"];
|
|
873
893
|
const booleanSegmentedOptions = booleanOptions.map((value) => ({
|
|
874
894
|
label: capitalize(value),
|
|
@@ -898,9 +918,13 @@ const FieldMetaDataForm = ({ setIsDirty, modelMetaData, fieldMetaData, setFieldM
|
|
|
898
918
|
const [markdownText, setMarkdownText] = useState<string>();
|
|
899
919
|
const [encryptState, setEncryptState] = useState<boolean>(Boolean(fieldMetaData?.encrypt));
|
|
900
920
|
|
|
901
|
-
const [showTypeFilter, setShowTypeFilter] = useState(
|
|
921
|
+
const [showTypeFilter, setShowTypeFilter] = useState(forceShowTypeSelector || !fieldMetaData);
|
|
902
922
|
const [selectedType, setSelectedType] = useState<{ label: string; value: string } | null>(
|
|
903
|
-
fieldMetaData?.type
|
|
923
|
+
fieldMetaData?.type
|
|
924
|
+
? { label: fieldMetaData.type, value: fieldMetaData.type }
|
|
925
|
+
: selectorInitialFieldType
|
|
926
|
+
? { label: selectorInitialFieldType, value: selectorInitialFieldType }
|
|
927
|
+
: null
|
|
904
928
|
);
|
|
905
929
|
const selectedTypeValue = selectedType?.value || "";
|
|
906
930
|
const [selectedComputedFieldValueType, setSelectedComputedFieldValueType] = useState(fieldMetaData?.computedFieldValueType && { label: fieldMetaData.computedFieldValueType, value: fieldMetaData.computedFieldValueType });
|
|
@@ -939,6 +963,18 @@ const FieldMetaDataForm = ({ setIsDirty, modelMetaData, fieldMetaData, setFieldM
|
|
|
939
963
|
const showOrmOptions = currentFields.includes("ormType") && Boolean(ormTypeOptions && ormTypeOptions.length);
|
|
940
964
|
const showValidationSection =
|
|
941
965
|
selectedTypeValue !== "relation" && (showRegexFields || showMinFields || showMaxFields || showOrmOptions);
|
|
966
|
+
const isExistingFieldReadOnly = disableIdentityEditingForExisting && Boolean(fieldMetaData?.id);
|
|
967
|
+
|
|
968
|
+
const closeForm = useCallback(() => {
|
|
969
|
+
if (typeof onClose === "function") {
|
|
970
|
+
onClose();
|
|
971
|
+
return;
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
if (typeof setVisiblePopup === "function") {
|
|
975
|
+
setVisiblePopup(false);
|
|
976
|
+
}
|
|
977
|
+
}, [onClose, setVisiblePopup]);
|
|
942
978
|
|
|
943
979
|
const searchMediaStorageProvIderId = async (event: any) => {
|
|
944
980
|
try {
|
|
@@ -1395,34 +1431,37 @@ const FieldMetaDataForm = ({ setIsDirty, modelMetaData, fieldMetaData, setFieldM
|
|
|
1395
1431
|
enableReinitialize: true,
|
|
1396
1432
|
onSubmit: async (values) => {
|
|
1397
1433
|
try {
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
setIsRequiredPopUp(true);
|
|
1434
|
+
const newFieldData = { ...values, isSystem: values.isSystem == true ? true : '' }
|
|
1435
|
+
const formtatedFieldPayload = fieldBasedPayloadFormating(newFieldData, currentFields, fieldMetaData);
|
|
1436
|
+
|
|
1437
|
+
if (typeof onDraftSubmit === "function") {
|
|
1438
|
+
onDraftSubmit(formtatedFieldPayload);
|
|
1439
|
+
} else {
|
|
1440
|
+
setFieldMetaData((prevItems: any) => {
|
|
1441
|
+
const existingIndex = prevItems.findIndex((item: any) => item.identifier === formtatedFieldPayload.identifier);
|
|
1442
|
+
let updatedItems;
|
|
1443
|
+
if (existingIndex !== -1) {
|
|
1444
|
+
updatedItems = [...prevItems];
|
|
1445
|
+
updatedItems[existingIndex] = formtatedFieldPayload;
|
|
1446
|
+
return updatedItems
|
|
1412
1447
|
}
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1448
|
+
else {
|
|
1449
|
+
updatedItems = [...prevItems, formtatedFieldPayload];
|
|
1450
|
+
if (params?.id !== 'new' && formtatedFieldPayload?.required && !formtatedFieldPayload?.defaultValue) {
|
|
1451
|
+
setIsRequiredPopUp(true);
|
|
1452
|
+
}
|
|
1453
|
+
}
|
|
1454
|
+
return updatedItems;
|
|
1455
|
+
});
|
|
1456
|
+
if (values.userKey) {
|
|
1457
|
+
const data = {
|
|
1458
|
+
modelName: values.relationCoModelSingularName,
|
|
1459
|
+
fieldName: values.userKey
|
|
1460
|
+
}
|
|
1461
|
+
updateUserKey(data);
|
|
1421
1462
|
}
|
|
1422
|
-
updateUserKey(data);
|
|
1423
1463
|
}
|
|
1424
|
-
|
|
1425
|
-
setVisiblePopup(false);
|
|
1464
|
+
closeForm();
|
|
1426
1465
|
|
|
1427
1466
|
} catch (err) {
|
|
1428
1467
|
console.error(ERROR_MESSAGES.CREATE_MODEL, err);
|
|
@@ -1773,6 +1812,10 @@ const FieldMetaDataForm = ({ setIsDirty, modelMetaData, fieldMetaData, setFieldM
|
|
|
1773
1812
|
<FieldSelector
|
|
1774
1813
|
handleTypeSelect={handleTypeSelect}
|
|
1775
1814
|
modelMetaData={modelMetaData}
|
|
1815
|
+
availableFieldTypes={availableFieldTypes}
|
|
1816
|
+
initialSelectedValue={selectedType?.value ?? selectorInitialFieldType}
|
|
1817
|
+
requireExplicitContinue={selectorRequireContinue}
|
|
1818
|
+
continueLabel={selectorContinueLabel}
|
|
1776
1819
|
></FieldSelector>
|
|
1777
1820
|
:
|
|
1778
1821
|
<div className="p-3" style={{ maxHeight: '80vh', overflowY: 'auto', overflowX: 'hidden' }}>
|
|
@@ -1795,7 +1838,7 @@ const FieldMetaDataForm = ({ setIsDirty, modelMetaData, fieldMetaData, setFieldM
|
|
|
1795
1838
|
</label>
|
|
1796
1839
|
<SolidInput
|
|
1797
1840
|
type="text"
|
|
1798
|
-
disabled={
|
|
1841
|
+
disabled={isExistingFieldReadOnly}
|
|
1799
1842
|
id="displayName"
|
|
1800
1843
|
name="displayName"
|
|
1801
1844
|
onChange={(e) => {
|
|
@@ -1823,7 +1866,7 @@ const FieldMetaDataForm = ({ setIsDirty, modelMetaData, fieldMetaData, setFieldM
|
|
|
1823
1866
|
Name
|
|
1824
1867
|
</label>
|
|
1825
1868
|
<SolidInput
|
|
1826
|
-
disabled={
|
|
1869
|
+
disabled={isExistingFieldReadOnly}
|
|
1827
1870
|
type="text"
|
|
1828
1871
|
id="name"
|
|
1829
1872
|
name="name"
|
|
@@ -1878,7 +1921,7 @@ const FieldMetaDataForm = ({ setIsDirty, modelMetaData, fieldMetaData, setFieldM
|
|
|
1878
1921
|
}
|
|
1879
1922
|
}}
|
|
1880
1923
|
checked={showColumnName}
|
|
1881
|
-
disabled={
|
|
1924
|
+
disabled={isExistingFieldReadOnly}
|
|
1882
1925
|
/>
|
|
1883
1926
|
<label htmlFor="ingredient1" className="form-field-label">
|
|
1884
1927
|
Set Column Name
|
|
@@ -1890,7 +1933,7 @@ const FieldMetaDataForm = ({ setIsDirty, modelMetaData, fieldMetaData, setFieldM
|
|
|
1890
1933
|
Column Name
|
|
1891
1934
|
</label>
|
|
1892
1935
|
<SolidInput
|
|
1893
|
-
disabled={
|
|
1936
|
+
disabled={isExistingFieldReadOnly}
|
|
1894
1937
|
type="text"
|
|
1895
1938
|
id="columnName"
|
|
1896
1939
|
name="columnName"
|
|
@@ -2389,7 +2432,7 @@ const FieldMetaDataForm = ({ setIsDirty, modelMetaData, fieldMetaData, setFieldM
|
|
|
2389
2432
|
id="relationCoModelColumnName"
|
|
2390
2433
|
name="relationCoModelColumnName"
|
|
2391
2434
|
onChange={formik.handleChange}
|
|
2392
|
-
disabled={
|
|
2435
|
+
disabled={isExistingFieldReadOnly}
|
|
2393
2436
|
value={formik.values.relationCoModelColumnName}
|
|
2394
2437
|
className={classNames(styles.fieldInput, {
|
|
2395
2438
|
"p-invalid": isFormFieldValid(
|
|
@@ -2528,7 +2571,7 @@ const FieldMetaDataForm = ({ setIsDirty, modelMetaData, fieldMetaData, setFieldM
|
|
|
2528
2571
|
id="relationCoModelFieldName"
|
|
2529
2572
|
name="relationCoModelFieldName"
|
|
2530
2573
|
onChange={formik.handleChange}
|
|
2531
|
-
disabled={
|
|
2574
|
+
disabled={isExistingFieldReadOnly}
|
|
2532
2575
|
value={formik.values.relationCoModelFieldName}
|
|
2533
2576
|
className={classNames(styles.fieldInput, {
|
|
2534
2577
|
"p-invalid": isFormFieldValid(
|
|
@@ -2598,7 +2641,7 @@ const FieldMetaDataForm = ({ setIsDirty, modelMetaData, fieldMetaData, setFieldM
|
|
|
2598
2641
|
id="relationJoinTableName"
|
|
2599
2642
|
name="relationJoinTableName"
|
|
2600
2643
|
onChange={formik.handleChange}
|
|
2601
|
-
disabled={
|
|
2644
|
+
disabled={isExistingFieldReadOnly}
|
|
2602
2645
|
value={formik.values.relationJoinTableName}
|
|
2603
2646
|
className={classNames(styles.fieldInput, {
|
|
2604
2647
|
"p-invalid": isFormFieldValid(
|
|
@@ -3050,7 +3093,7 @@ const FieldMetaDataForm = ({ setIsDirty, modelMetaData, fieldMetaData, setFieldM
|
|
|
3050
3093
|
"min"
|
|
3051
3094
|
),
|
|
3052
3095
|
})}
|
|
3053
|
-
disabled={
|
|
3096
|
+
disabled={isExistingFieldReadOnly}
|
|
3054
3097
|
/>
|
|
3055
3098
|
</div>
|
|
3056
3099
|
{isFormFieldValid(formik, "min") && (
|
|
@@ -3088,7 +3131,7 @@ const FieldMetaDataForm = ({ setIsDirty, modelMetaData, fieldMetaData, setFieldM
|
|
|
3088
3131
|
"max"
|
|
3089
3132
|
),
|
|
3090
3133
|
})}
|
|
3091
|
-
disabled={
|
|
3134
|
+
disabled={isExistingFieldReadOnly}
|
|
3092
3135
|
/>
|
|
3093
3136
|
</div>
|
|
3094
3137
|
|
|
@@ -3447,10 +3490,10 @@ const FieldMetaDataForm = ({ setIsDirty, modelMetaData, fieldMetaData, setFieldM
|
|
|
3447
3490
|
</TabView>
|
|
3448
3491
|
<div className="mt-4 flex gap-4">
|
|
3449
3492
|
<div>
|
|
3450
|
-
<SolidButton label=
|
|
3493
|
+
<SolidButton label={submitLabel} size="small" onClick={() => showError()} type="submit" />
|
|
3451
3494
|
</div>
|
|
3452
3495
|
<div>
|
|
3453
|
-
<SolidButton label="Cancel" size="small" severity="secondary" type="reset" onClick={
|
|
3496
|
+
<SolidButton label="Cancel" size="small" severity="secondary" type="reset" onClick={closeForm} outlined />
|
|
3454
3497
|
</div>
|
|
3455
3498
|
</div>
|
|
3456
3499
|
</div>
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
type FieldSelectorProps = {
|
|
2
2
|
handleTypeSelect: (value: string, label: string) => void;
|
|
3
3
|
modelMetaData?: any;
|
|
4
|
+
availableFieldTypes?: string[];
|
|
5
|
+
initialSelectedValue?: string | null;
|
|
6
|
+
requireExplicitContinue?: boolean;
|
|
7
|
+
continueLabel?: string;
|
|
4
8
|
};
|
|
5
|
-
declare const FieldSelector: ({ handleTypeSelect }: FieldSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
declare const FieldSelector: ({ handleTypeSelect, availableFieldTypes, initialSelectedValue, requireExplicitContinue, continueLabel, }: FieldSelectorProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
10
|
export default FieldSelector;
|
|
7
11
|
//# sourceMappingURL=FieldSelector.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/core/model/FieldSelector.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FieldSelector.d.ts","sourceRoot":"","sources":["../../../../src/components/core/model/FieldSelector.tsx"],"names":[],"mappings":"AA4BA,KAAK,kBAAkB,GAAG;IACxB,gBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACzD,aAAa,CAAC,EAAE,GAAG,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAwDF,QAAA,MAAM,aAAa,6GAMhB,kBAAkB,4CAqEpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from "react";
|
|
3
|
-
import { AlignLeft, Calculator, Calendar, Clock9, Code2, Feather, Fingerprint, FunctionSquare, Hash, Image, Images, ListChecks, ListFilter, Mail, Share2, Shield, Sigma, Timer, ToggleLeft, Type, } from "lucide-react";
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { AlignLeft, Calculator, Calendar, Clock9, Code2, Feather, Fingerprint, FunctionSquare, Hash, Image, Images, ListChecks, ListFilter, Mail, Share2, Shield, Sigma, Timer, ToggleLeft, Type, ArrowRight, } from "lucide-react";
|
|
4
|
+
import { SolidButton } from "../../shad-cn-ui";
|
|
4
5
|
var fieldToneMap = {
|
|
5
6
|
int: "blue",
|
|
6
7
|
bigint: "blue",
|
|
@@ -46,13 +47,31 @@ var solidFieldOptions = [
|
|
|
46
47
|
{ label: "UUID", description: "Unique identifier", Icon: Fingerprint, value: "uuid", tone: fieldToneMap.uuid },
|
|
47
48
|
];
|
|
48
49
|
var FieldSelector = function (_a) {
|
|
49
|
-
var handleTypeSelect = _a.handleTypeSelect;
|
|
50
|
-
var
|
|
50
|
+
var handleTypeSelect = _a.handleTypeSelect, availableFieldTypes = _a.availableFieldTypes, _b = _a.initialSelectedValue, initialSelectedValue = _b === void 0 ? null : _b, _c = _a.requireExplicitContinue, requireExplicitContinue = _c === void 0 ? false : _c, _d = _a.continueLabel, continueLabel = _d === void 0 ? "Next" : _d;
|
|
51
|
+
var _e = useState(initialSelectedValue), selectedField = _e[0], setSelectedField = _e[1];
|
|
52
|
+
useEffect(function () {
|
|
53
|
+
setSelectedField(initialSelectedValue);
|
|
54
|
+
}, [initialSelectedValue]);
|
|
55
|
+
var visibleFieldOptions = useMemo(function () {
|
|
56
|
+
if (!(availableFieldTypes === null || availableFieldTypes === void 0 ? void 0 : availableFieldTypes.length)) {
|
|
57
|
+
return solidFieldOptions;
|
|
58
|
+
}
|
|
59
|
+
var allowedTypes = new Set(availableFieldTypes);
|
|
60
|
+
return solidFieldOptions.filter(function (option) { return allowedTypes.has(option.value); });
|
|
61
|
+
}, [availableFieldTypes]);
|
|
51
62
|
var handleSelect = function (option) {
|
|
52
63
|
setSelectedField(option.value);
|
|
53
|
-
|
|
64
|
+
if (!requireExplicitContinue) {
|
|
65
|
+
handleTypeSelect(option.value, option.label);
|
|
66
|
+
}
|
|
54
67
|
};
|
|
55
|
-
|
|
68
|
+
var handleContinue = function () {
|
|
69
|
+
var selectedOption = visibleFieldOptions.find(function (option) { return option.value === selectedField; });
|
|
70
|
+
if (!selectedOption)
|
|
71
|
+
return;
|
|
72
|
+
handleTypeSelect(selectedOption.value, selectedOption.label);
|
|
73
|
+
};
|
|
74
|
+
return (_jsxs("div", { className: "solid-field-selector-container", children: [_jsxs("div", { className: "solid-field-selector-header", children: [_jsx("p", { className: "form-wrapper-heading", children: "Select Field Type" }), _jsx("p", { className: "solid-field-selector-subheading", children: "Choose the data type you want to add to the model." })] }), _jsx("div", { className: "solid-field-selector-grid", children: visibleFieldOptions.map(function (option) { return (_jsx("button", { type: "button", className: "solid-field-selector-card ".concat(selectedField === option.value ? "is-active" : ""), onClick: function () { return handleSelect(option); }, children: _jsxs("div", { className: "solid-field-selector-card-inner", children: [_jsx("span", { className: "solid-field-selector-icon solid-field-selector-icon-".concat(option.tone), children: _jsx(option.Icon, { size: 18, strokeWidth: 1.8 }) }), _jsxs("div", { className: "solid-field-selector-text", children: [_jsx("span", { className: "solid-field-selector-title", children: option.label }), _jsx("span", { className: "solid-field-selector-description", children: option.description })] })] }) }, option.value)); }) }), requireExplicitContinue ? (_jsx("div", { className: "mt-4 flex justify-end", children: _jsx(SolidButton, { size: "small", leftIcon: _jsx(ArrowRight, { size: 14 }), onClick: handleContinue, disabled: !selectedField, children: continueLabel }) })) : null] }));
|
|
56
75
|
};
|
|
57
76
|
export default FieldSelector;
|
|
58
77
|
//# sourceMappingURL=FieldSelector.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldSelector.js","sourceRoot":"","sources":["../../../../src/components/core/model/FieldSelector.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,OAAO,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,KAAK,EACL,OAAO,EACP,WAAW,EACX,cAAc,EACd,IAAI,EACJ,KAAK,EACL,MAAM,EACN,UAAU,EACV,UAAU,EACV,IAAI,EACJ,MAAM,EACN,MAAM,EACN,KAAK,EACL,KAAK,EACL,UAAU,EACV,IAAI,GACL,MAAM,cAAc,CAAC;AAetB,IAAM,YAAY,GAAwC;IACxD,GAAG,EAAE,MAAM;IACX,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,MAAM;IACf,SAAS,EAAE,QAAQ;IACnB,QAAQ,EAAE,QAAQ;IA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AC/C,CAAC,CAAC;IAEF,OAAO,CACL,eAAK,SAAS,EAAC,gCAAgC,aAC7C,eAAK,SAAS,EAAC,6BAA6B,aAC1C,YAAG,SAAS,EAAC,sBAAsB,kCAAsB,EACzD,YAAG,SAAS,EAAC,iCAAiC,mEAAuD,IACjG,EACN,cAAK,SAAS,EAAC,2BAA2B,YACvC,iBAAiB,CAAC,GAAG,CAAC,UAAC,MAAM,IAAK,OAAA,CACjC,iBAEE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,oCAA6B,aAAa,KAAK,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAE,EAC3F,OAAO,EAAE,cAAM,OAAA,YAAY,CAAC,MAAM,CAAC,EAApB,CAAoB,YAEnC,eAAK,SAAS,EAAC,iCAAiC,aAC9C,eAAM,SAAS,EAAE,8DAAuD,MAAM,CAAC,IAAI,CAAE,YACnF,KAAC,MAAM,CAAC,IAAI,IAAC,IAAI,EAAE,EAAE,EAAE,WAAW,EAAE,GAAG,GAAI,GACtC,EACP,eAAK,SAAS,EAAC,2BAA2B,aACxC,eAAM,SAAS,EAAC,4BAA4B,YAAE,MAAM,CAAC,KAAK,GAAQ,EAClE,eAAM,SAAS,EAAC,kCAAkC,YAAE,MAAM,CAAC,WAAW,GAAQ,IAC1E,IACF,IAbD,MAAM,CAAC,KAAK,CAcV,CACV,EAjBkC,CAiBlC,CAAC,GACE,IACF,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["\nimport { useState } from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\nimport {\n AlignLeft,\n Calculator,\n Calendar,\n Clock9,\n Code2,\n Feather,\n Fingerprint,\n FunctionSquare,\n Hash,\n Image,\n Images,\n ListChecks,\n ListFilter,\n Mail,\n Share2,\n Shield,\n Sigma,\n Timer,\n ToggleLeft,\n Type,\n} from \"lucide-react\";\n\ntype FieldSelectorProps = {\n handleTypeSelect: (value: string, label: string) => void;\n modelMetaData?: any;\n};\n\ntype FieldOption = {\n label: string;\n description: string;\n Icon: LucideIcon;\n value: string;\n tone: \"blue\" | \"violet\" | \"green\" | \"orange\" | \"cyan\";\n};\n\nconst fieldToneMap: Record<string, FieldOption[\"tone\"]> = {\n int: \"blue\",\n bigint: \"blue\",\n decimal: \"blue\",\n shortText: \"violet\",\n longText: \"violet\",\n richText: \"violet\",\n json: \"cyan\",\n boolean: \"green\",\n date: \"orange\",\n datetime: \"orange\",\n time: \"orange\",\n relation: \"cyan\",\n mediaSingle: \"violet\",\n mediaMultiple: \"violet\",\n email: \"cyan\",\n password: \"cyan\",\n selectionStatic: \"green\",\n selectionDynamic: \"green\",\n computed: \"blue\",\n uuid: \"blue\",\n};\n\nconst solidFieldOptions: FieldOption[] = [\n { label: \"Integer\", description: \"Whole number (int)\", Icon: Hash, value: \"int\", tone: fieldToneMap.int },\n { label: \"Big Integer\", description: \"Large whole number (bigint)\", Icon: Calculator, value: \"bigint\", tone: fieldToneMap.bigint },\n { label: \"Decimal\", description: \"64-bit floating-point number\", Icon: Sigma, value: \"decimal\", tone: fieldToneMap.decimal },\n { label: \"Short Text\", description: \"Small text field\", Icon: Type, value: \"shortText\", tone: fieldToneMap.shortText },\n { label: \"Long Text\", description: \"Large text field\", Icon: AlignLeft, value: \"longText\", tone: fieldToneMap.longText },\n { label: \"Rich Text\", description: \"Rich text editor\", Icon: Feather, value: \"richText\", tone: fieldToneMap.richText },\n { label: \"JSON\", description: \"JSON data format\", Icon: Code2, value: \"json\", tone: fieldToneMap.json },\n { label: \"Boolean\", description: \"True / False value\", Icon: ToggleLeft, value: \"boolean\", tone: fieldToneMap.boolean },\n { label: \"Date\", description: \"Date field\", Icon: Calendar, value: \"date\", tone: fieldToneMap.date },\n { label: \"Datetime\", description: \"Date & time field\", Icon: Clock9, value: \"datetime\", tone: fieldToneMap.datetime },\n { label: \"Time\", description: \"Time picker\", Icon: Timer, value: \"time\", tone: fieldToneMap.time },\n { label: \"Relation\", description: \"Reference another entity\", Icon: Share2, value: \"relation\", tone: fieldToneMap.relation },\n { label: \"Single Media\", description: \"Single file upload\", Icon: Image, value: \"mediaSingle\", tone: fieldToneMap.mediaSingle },\n { label: \"Multiple Media\", description: \"Multiple file upload\", Icon: Images, value: \"mediaMultiple\", tone: fieldToneMap.mediaMultiple },\n { label: \"Email\", description: \"Email field\", Icon: Mail, value: \"email\", tone: fieldToneMap.email },\n { label: \"Password\", description: \"Password input\", Icon: Shield, value: \"password\", tone: fieldToneMap.password },\n { label: \"Static Selection\", description: \"Predefined values\", Icon: ListChecks, value: \"selectionStatic\", tone: fieldToneMap.selectionStatic },\n { label: \"Dynamic Selection\", description: \"Dynamic list\", Icon: ListFilter, value: \"selectionDynamic\", tone: fieldToneMap.selectionDynamic },\n { label: \"Computed\", description: \"Derive value from data\", Icon: FunctionSquare, value: \"computed\", tone: fieldToneMap.computed },\n { label: \"UUID\", description: \"Unique identifier\", Icon: Fingerprint, value: \"uuid\", tone: fieldToneMap.uuid },\n];\n\nconst FieldSelector = ({ handleTypeSelect }: FieldSelectorProps) => {\n const [selectedField, setSelectedField] = useState<string | null>(null);\n\n const handleSelect = (option: FieldOption) => {\n setSelectedField(option.value);\n handleTypeSelect(option.value, option.label);\n };\n\n return (\n <div className=\"solid-field-selector-container\">\n <div className=\"solid-field-selector-header\">\n <p className=\"form-wrapper-heading\">Select Field Type</p>\n <p className=\"solid-field-selector-subheading\">Choose the data type you want to add to the model.</p>\n </div>\n <div className=\"solid-field-selector-grid\">\n {solidFieldOptions.map((option) => (\n <button\n key={option.value}\n type=\"button\"\n className={`solid-field-selector-card ${selectedField === option.value ? \"is-active\" : \"\"}`}\n onClick={() => handleSelect(option)}\n >\n <div className=\"solid-field-selector-card-inner\">\n <span className={`solid-field-selector-icon solid-field-selector-icon-${option.tone}`}>\n <option.Icon size={18} strokeWidth={1.8} />\n </span>\n <div className=\"solid-field-selector-text\">\n <span className=\"solid-field-selector-title\">{option.label}</span>\n <span className=\"solid-field-selector-description\">{option.description}</span>\n </div>\n </div>\n </button>\n ))}\n </div>\n </div>\n );\n};\n\nexport default FieldSelector;\n"]}
|
|
1
|
+
{"version":3,"file":"FieldSelector.js","sourceRoot":"","sources":["../../../../src/components/core/model/FieldSelector.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAErD,OAAO,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,KAAK,EACL,OAAO,EACP,WAAW,EACX,cAAc,EACd,IAAI,EACJ,KAAK,EACL,MAAM,EACN,UAAU,EACV,UAAU,EACV,IAAI,EACJ,MAAM,EACN,MAAM,EACN,KAAK,EACL,KAAK,EACL,UAAU,EACV,IAAI,EACJ,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAmB/C,IAAM,YAAY,GAAwC;IACxD,GAAG,EAAE,MAAM;IACX,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,MAAM;IACf,SAAS,EAAE,QAAQ;IACnB,QAAQ,EAAE,QAAQ;IAClB,QAAQ,EAAE,QAAQ;IAClB,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,OAAO;IAChB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,QAAQ;IAClB,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,MAAM;IAChB,WAAW,EAAE,QAAQ;IACrB,aAAa,EAAE,QAAQ;IACvB,KAAK,EAAE,MAAM;IACb,QAAQ,EAAE,MAAM;IAChB,eAAe,EAAE,OAAO;IACxB,gBAAgB,EAAE,OAAO;IACzB,QAAQ,EAAE,MAAM;IAChB,IAAI,EAAE,MAAM;CACb,CAAC;AAEF,IAAM,iBAAiB,GAAkB;IACvC,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,oBAAoB,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK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EAAC,4BAA4B,YAAE,MAAM,CAAC,KAAK,GAAQ,EAClE,eAAM,SAAS,EAAC,kCAAkC,YAAE,MAAM,CAAC,WAAW,GAAQ,IAC1E,IACF,IAbD,MAAM,CAAC,KAAK,CAcV,CACV,EAjBoC,CAiBpC,CAAC,GACE,EACL,uBAAuB,CAAC,CAAC,CAAC,CACzB,cAAK,SAAS,EAAC,uBAAuB,YACpC,KAAC,WAAW,IACV,IAAI,EAAC,OAAO,EACZ,QAAQ,EAAE,KAAC,UAAU,IAAC,IAAI,EAAE,EAAE,GAAI,EAClC,OAAO,EAAE,cAAc,EACvB,QAAQ,EAAE,CAAC,aAAa,YAEvB,aAAa,GACF,GACV,CACP,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,aAAa,CAAC","sourcesContent":["\nimport { useEffect, useMemo, useState } from \"react\";\nimport type { LucideIcon } from \"lucide-react\";\nimport {\n AlignLeft,\n Calculator,\n Calendar,\n Clock9,\n Code2,\n Feather,\n Fingerprint,\n FunctionSquare,\n Hash,\n Image,\n Images,\n ListChecks,\n ListFilter,\n Mail,\n Share2,\n Shield,\n Sigma,\n Timer,\n ToggleLeft,\n Type,\n ArrowRight,\n} from \"lucide-react\";\nimport { SolidButton } from \"../../shad-cn-ui\";\n\ntype FieldSelectorProps = {\n handleTypeSelect: (value: string, label: string) => void;\n modelMetaData?: any;\n availableFieldTypes?: string[];\n initialSelectedValue?: string | null;\n requireExplicitContinue?: boolean;\n continueLabel?: string;\n};\n\ntype FieldOption = {\n label: string;\n description: string;\n Icon: LucideIcon;\n value: string;\n tone: \"blue\" | \"violet\" | \"green\" | \"orange\" | \"cyan\";\n};\n\nconst fieldToneMap: Record<string, FieldOption[\"tone\"]> = {\n int: \"blue\",\n bigint: \"blue\",\n decimal: \"blue\",\n shortText: \"violet\",\n longText: \"violet\",\n richText: \"violet\",\n json: \"cyan\",\n boolean: \"green\",\n date: \"orange\",\n datetime: \"orange\",\n time: \"orange\",\n relation: \"cyan\",\n mediaSingle: \"violet\",\n mediaMultiple: \"violet\",\n email: \"cyan\",\n password: \"cyan\",\n selectionStatic: \"green\",\n selectionDynamic: \"green\",\n computed: \"blue\",\n uuid: \"blue\",\n};\n\nconst solidFieldOptions: FieldOption[] = [\n { label: \"Integer\", description: \"Whole number (int)\", Icon: Hash, value: \"int\", tone: fieldToneMap.int },\n { label: \"Big Integer\", description: \"Large whole number (bigint)\", Icon: Calculator, value: \"bigint\", tone: fieldToneMap.bigint },\n { label: \"Decimal\", description: \"64-bit floating-point number\", Icon: Sigma, value: \"decimal\", tone: fieldToneMap.decimal },\n { label: \"Short Text\", description: \"Small text field\", Icon: Type, value: \"shortText\", tone: fieldToneMap.shortText },\n { label: \"Long Text\", description: \"Large text field\", Icon: AlignLeft, value: \"longText\", tone: fieldToneMap.longText },\n { label: \"Rich Text\", description: \"Rich text editor\", Icon: Feather, value: \"richText\", tone: fieldToneMap.richText },\n { label: \"JSON\", description: \"JSON data format\", Icon: Code2, value: \"json\", tone: fieldToneMap.json },\n { label: \"Boolean\", description: \"True / False value\", Icon: ToggleLeft, value: \"boolean\", tone: fieldToneMap.boolean },\n { label: \"Date\", description: \"Date field\", Icon: Calendar, value: \"date\", tone: fieldToneMap.date },\n { label: \"Datetime\", description: \"Date & time field\", Icon: Clock9, value: \"datetime\", tone: fieldToneMap.datetime },\n { label: \"Time\", description: \"Time picker\", Icon: Timer, value: \"time\", tone: fieldToneMap.time },\n { label: \"Relation\", description: \"Reference another entity\", Icon: Share2, value: \"relation\", tone: fieldToneMap.relation },\n { label: \"Single Media\", description: \"Single file upload\", Icon: Image, value: \"mediaSingle\", tone: fieldToneMap.mediaSingle },\n { label: \"Multiple Media\", description: \"Multiple file upload\", Icon: Images, value: \"mediaMultiple\", tone: fieldToneMap.mediaMultiple },\n { label: \"Email\", description: \"Email field\", Icon: Mail, value: \"email\", tone: fieldToneMap.email },\n { label: \"Password\", description: \"Password input\", Icon: Shield, value: \"password\", tone: fieldToneMap.password },\n { label: \"Static Selection\", description: \"Predefined values\", Icon: ListChecks, value: \"selectionStatic\", tone: fieldToneMap.selectionStatic },\n { label: \"Dynamic Selection\", description: \"Dynamic list\", Icon: ListFilter, value: \"selectionDynamic\", tone: fieldToneMap.selectionDynamic },\n { label: \"Computed\", description: \"Derive value from data\", Icon: FunctionSquare, value: \"computed\", tone: fieldToneMap.computed },\n { label: \"UUID\", description: \"Unique identifier\", Icon: Fingerprint, value: \"uuid\", tone: fieldToneMap.uuid },\n];\n\nconst FieldSelector = ({\n handleTypeSelect,\n availableFieldTypes,\n initialSelectedValue = null,\n requireExplicitContinue = false,\n continueLabel = \"Next\",\n}: FieldSelectorProps) => {\n const [selectedField, setSelectedField] = useState<string | null>(initialSelectedValue);\n\n useEffect(() => {\n setSelectedField(initialSelectedValue);\n }, [initialSelectedValue]);\n\n const visibleFieldOptions = useMemo(() => {\n if (!availableFieldTypes?.length) {\n return solidFieldOptions;\n }\n\n const allowedTypes = new Set(availableFieldTypes);\n return solidFieldOptions.filter((option) => allowedTypes.has(option.value));\n }, [availableFieldTypes]);\n\n const handleSelect = (option: FieldOption) => {\n setSelectedField(option.value);\n if (!requireExplicitContinue) {\n handleTypeSelect(option.value, option.label);\n }\n };\n\n const handleContinue = () => {\n const selectedOption = visibleFieldOptions.find((option) => option.value === selectedField);\n if (!selectedOption) return;\n handleTypeSelect(selectedOption.value, selectedOption.label);\n };\n\n return (\n <div className=\"solid-field-selector-container\">\n <div className=\"solid-field-selector-header\">\n <p className=\"form-wrapper-heading\">Select Field Type</p>\n <p className=\"solid-field-selector-subheading\">Choose the data type you want to add to the model.</p>\n </div>\n <div className=\"solid-field-selector-grid\">\n {visibleFieldOptions.map((option) => (\n <button\n key={option.value}\n type=\"button\"\n className={`solid-field-selector-card ${selectedField === option.value ? \"is-active\" : \"\"}`}\n onClick={() => handleSelect(option)}\n >\n <div className=\"solid-field-selector-card-inner\">\n <span className={`solid-field-selector-icon solid-field-selector-icon-${option.tone}`}>\n <option.Icon size={18} strokeWidth={1.8} />\n </span>\n <div className=\"solid-field-selector-text\">\n <span className=\"solid-field-selector-title\">{option.label}</span>\n <span className=\"solid-field-selector-description\">{option.description}</span>\n </div>\n </div>\n </button>\n ))}\n </div>\n {requireExplicitContinue ? (\n <div className=\"mt-4 flex justify-end\">\n <SolidButton\n size=\"small\"\n leftIcon={<ArrowRight size={14} />}\n onClick={handleContinue}\n disabled={!selectedField}\n >\n {continueLabel}\n </SolidButton>\n </div>\n ) : null}\n </div>\n );\n};\n\nexport default FieldSelector;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { useState } from "react";
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
3
|
import type { LucideIcon } from "lucide-react";
|
|
4
4
|
import {
|
|
5
5
|
AlignLeft,
|
|
@@ -22,11 +22,17 @@ import {
|
|
|
22
22
|
Timer,
|
|
23
23
|
ToggleLeft,
|
|
24
24
|
Type,
|
|
25
|
+
ArrowRight,
|
|
25
26
|
} from "lucide-react";
|
|
27
|
+
import { SolidButton } from "../../shad-cn-ui";
|
|
26
28
|
|
|
27
29
|
type FieldSelectorProps = {
|
|
28
30
|
handleTypeSelect: (value: string, label: string) => void;
|
|
29
31
|
modelMetaData?: any;
|
|
32
|
+
availableFieldTypes?: string[];
|
|
33
|
+
initialSelectedValue?: string | null;
|
|
34
|
+
requireExplicitContinue?: boolean;
|
|
35
|
+
continueLabel?: string;
|
|
30
36
|
};
|
|
31
37
|
|
|
32
38
|
type FieldOption = {
|
|
@@ -83,12 +89,39 @@ const solidFieldOptions: FieldOption[] = [
|
|
|
83
89
|
{ label: "UUID", description: "Unique identifier", Icon: Fingerprint, value: "uuid", tone: fieldToneMap.uuid },
|
|
84
90
|
];
|
|
85
91
|
|
|
86
|
-
const FieldSelector = ({
|
|
87
|
-
|
|
92
|
+
const FieldSelector = ({
|
|
93
|
+
handleTypeSelect,
|
|
94
|
+
availableFieldTypes,
|
|
95
|
+
initialSelectedValue = null,
|
|
96
|
+
requireExplicitContinue = false,
|
|
97
|
+
continueLabel = "Next",
|
|
98
|
+
}: FieldSelectorProps) => {
|
|
99
|
+
const [selectedField, setSelectedField] = useState<string | null>(initialSelectedValue);
|
|
100
|
+
|
|
101
|
+
useEffect(() => {
|
|
102
|
+
setSelectedField(initialSelectedValue);
|
|
103
|
+
}, [initialSelectedValue]);
|
|
104
|
+
|
|
105
|
+
const visibleFieldOptions = useMemo(() => {
|
|
106
|
+
if (!availableFieldTypes?.length) {
|
|
107
|
+
return solidFieldOptions;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
const allowedTypes = new Set(availableFieldTypes);
|
|
111
|
+
return solidFieldOptions.filter((option) => allowedTypes.has(option.value));
|
|
112
|
+
}, [availableFieldTypes]);
|
|
88
113
|
|
|
89
114
|
const handleSelect = (option: FieldOption) => {
|
|
90
115
|
setSelectedField(option.value);
|
|
91
|
-
|
|
116
|
+
if (!requireExplicitContinue) {
|
|
117
|
+
handleTypeSelect(option.value, option.label);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const handleContinue = () => {
|
|
122
|
+
const selectedOption = visibleFieldOptions.find((option) => option.value === selectedField);
|
|
123
|
+
if (!selectedOption) return;
|
|
124
|
+
handleTypeSelect(selectedOption.value, selectedOption.label);
|
|
92
125
|
};
|
|
93
126
|
|
|
94
127
|
return (
|
|
@@ -98,7 +131,7 @@ const FieldSelector = ({ handleTypeSelect }: FieldSelectorProps) => {
|
|
|
98
131
|
<p className="solid-field-selector-subheading">Choose the data type you want to add to the model.</p>
|
|
99
132
|
</div>
|
|
100
133
|
<div className="solid-field-selector-grid">
|
|
101
|
-
{
|
|
134
|
+
{visibleFieldOptions.map((option) => (
|
|
102
135
|
<button
|
|
103
136
|
key={option.value}
|
|
104
137
|
type="button"
|
|
@@ -117,6 +150,18 @@ const FieldSelector = ({ handleTypeSelect }: FieldSelectorProps) => {
|
|
|
117
150
|
</button>
|
|
118
151
|
))}
|
|
119
152
|
</div>
|
|
153
|
+
{requireExplicitContinue ? (
|
|
154
|
+
<div className="mt-4 flex justify-end">
|
|
155
|
+
<SolidButton
|
|
156
|
+
size="small"
|
|
157
|
+
leftIcon={<ArrowRight size={14} />}
|
|
158
|
+
onClick={handleContinue}
|
|
159
|
+
disabled={!selectedField}
|
|
160
|
+
>
|
|
161
|
+
{continueLabel}
|
|
162
|
+
</SolidButton>
|
|
163
|
+
</div>
|
|
164
|
+
) : null}
|
|
120
165
|
</div>
|
|
121
166
|
);
|
|
122
167
|
};
|
|
@@ -22,12 +22,6 @@
|
|
|
22
22
|
border-bottom: 1px solid color-mix(in srgb, var(--border) 86%, transparent);
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
.solid-module-form-tab-extra {
|
|
26
|
-
display: inline-flex;
|
|
27
|
-
align-items: center;
|
|
28
|
-
padding-right: 0.35rem;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
25
|
.solid-module-form-workspace .solid-module-form-tabpanel {
|
|
32
26
|
padding-top: 0.65rem;
|
|
33
27
|
}
|
|
@@ -110,3 +104,63 @@
|
|
|
110
104
|
font-size: 0.875rem;
|
|
111
105
|
line-height: 1.4;
|
|
112
106
|
}
|
|
107
|
+
|
|
108
|
+
.solid-module-automap-panel {
|
|
109
|
+
display: flex;
|
|
110
|
+
flex-direction: column;
|
|
111
|
+
gap: 1rem;
|
|
112
|
+
padding: 1rem 1.1rem;
|
|
113
|
+
border: 1px solid color-mix(in srgb, var(--primary-color, var(--primary)) 16%, var(--border, #d6dae5) 84%);
|
|
114
|
+
border-radius: 1rem;
|
|
115
|
+
background:
|
|
116
|
+
linear-gradient(
|
|
117
|
+
180deg,
|
|
118
|
+
color-mix(in srgb, var(--primary-color, var(--primary)) 5%, #ffffff 95%),
|
|
119
|
+
color-mix(in srgb, var(--primary-color, var(--primary)) 9%, #f8fafc 91%)
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.solid-module-automap-copy {
|
|
124
|
+
display: flex;
|
|
125
|
+
flex-direction: column;
|
|
126
|
+
gap: 0.55rem;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.solid-module-automap-eyebrow {
|
|
130
|
+
font-size: 0.72rem;
|
|
131
|
+
font-weight: 700;
|
|
132
|
+
letter-spacing: 0.08em;
|
|
133
|
+
text-transform: uppercase;
|
|
134
|
+
color: color-mix(in srgb, var(--primary-color, var(--primary)) 70%, #4b5563 30%);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.solid-module-automap-copy h4 {
|
|
138
|
+
margin: 0;
|
|
139
|
+
color: var(--foreground, #111827);
|
|
140
|
+
font-size: 1rem;
|
|
141
|
+
font-weight: 700;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.solid-module-automap-copy p {
|
|
145
|
+
margin: 0;
|
|
146
|
+
color: color-mix(in srgb, var(--foreground, #111827) 76%, var(--muted-foreground, #6b7280));
|
|
147
|
+
font-size: 0.9rem;
|
|
148
|
+
line-height: 1.55;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.solid-module-automap-list {
|
|
152
|
+
margin: 0;
|
|
153
|
+
padding-left: 1.15rem;
|
|
154
|
+
color: color-mix(in srgb, var(--foreground, #111827) 76%, var(--muted-foreground, #6b7280));
|
|
155
|
+
font-size: 0.86rem;
|
|
156
|
+
line-height: 1.55;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.solid-module-automap-list li + li {
|
|
160
|
+
margin-top: 0.22rem;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.solid-module-automap-actions {
|
|
164
|
+
display: flex;
|
|
165
|
+
justify-content: center;
|
|
166
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CreateModule.d.ts","sourceRoot":"","sources":["../../../../src/components/core/module/CreateModule.tsx"],"names":[],"mappings":"AA+BA,OAAO,oBAAoB,CAAC;AAK5B,QAAA,MAAM,YAAY,qBAAsB,GAAG,
|
|
1
|
+
{"version":3,"file":"CreateModule.d.ts","sourceRoot":"","sources":["../../../../src/components/core/module/CreateModule.tsx"],"names":[],"mappings":"AA+BA,OAAO,oBAAoB,CAAC;AAK5B,QAAA,MAAM,YAAY,qBAAsB,GAAG,4CAmiB1C,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -306,8 +306,8 @@ var CreateModule = function (_a) {
|
|
|
306
306
|
if (pathname.includes('new')) {
|
|
307
307
|
formik.setFieldValue("name", toKebabCase);
|
|
308
308
|
}
|
|
309
|
-
}, value: formik.values.displayName, className: styles.fieldInput }), isFormFieldValid(formik, "displayName") && (_jsx("p", { className: styles.fieldError, children: (_c = (_b = formik === null || formik === void 0 ? void 0 : formik.errors) === null || _b === void 0 ? void 0 : _b.displayName) === null || _c === void 0 ? void 0 : _c.toString() }))] }) }), _jsx("div", { className: "field w-full px-2 pt-2 lg:w-1/2", children: _jsxs("div", { className: styles.fieldWrapper, children: [_jsxs("label", { htmlFor: "name", className: "".concat(styles.fieldLabel, " form-field-label"), children: ["Name ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx(SolidInput, { disabled: true, type: "text", id: "name", name: "name", onChange: formik.handleChange, value: formik.values.name, className: styles.fieldInput }), isFormFieldValid(formik, "name") && (_jsx("p", { className: styles.fieldError, children: (_e = (_d = formik === null || formik === void 0 ? void 0 : formik.errors) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.toString() }))] }) })] }), _jsxs("div", { className: "mt-4 flex flex-wrap -mx-2 -mt-2", children: [_jsx("div", { className: "field w-full px-2 pt-2 pb-3 lg:w-1/2 lg:pb-0", children: _jsxs("div", { className: styles.fieldWrapper, children: [_jsx("label", { htmlFor: "menuSequenceNumber", className: "".concat(styles.fieldLabel, " form-field-label"), children: "Menu Sequence Number" }), _jsx(SolidInput, { id: "menuSequenceNumber", type: "number", onChange: formik.handleChange, min: 0, value: formik.values.menuSequenceNumber, className: styles.fieldInput }), isFormFieldValid(formik, "menuSequenceNumber") && (_jsx("p", { className: styles.fieldError, children: (_g = (_f = formik === null || formik === void 0 ? void 0 : formik.errors) === null || _f === void 0 ? void 0 : _f.menuSequenceNumber) === null || _g === void 0 ? void 0 : _g.toString() }))] }) }), _jsx("div", { className: "field w-full px-2 pt-2 lg:w-1/2", children: _jsxs("div", { className: styles.fieldWrapper, children: [_jsxs("label", { htmlFor: "description", className: "".concat(styles.fieldLabel, " form-field-label"), children: ["Description ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx(SolidTextarea, { id: "description", name: "description", onChange: formik.handleChange, value: formik.values.description, className: styles.fieldTextarea, rows: 5, cols: 30 }), isFormFieldValid(formik, "description") && (_jsx("p", { className: styles.fieldError, children: (_j = (_h = formik === null || formik === void 0 ? void 0 : formik.errors) === null || _h === void 0 ? void 0 : _h.description) === null || _j === void 0 ? void 0 : _j.toString() }))] }) })] })
|
|
310
|
-
return (_jsx("div", { className: "solid-form-wrapper", children: _jsxs("div", { className: "solid-form-section", style: { borderRight: params.embeded !== true ? '1px solid var(--primary-light-color)' : '' }, children: [isCreateMode && (_jsxs("div", { className: "solid-form-header flex flex-wrap items-center justify-between gap-3", children: [_jsx("div", { className: "flex flex-col gap-1" }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(SolidButton, { variant: "outline", size: "sm", type: "button", onClick: handleCancel, className: "bg-[var(--primary-color-text)]", children: "Cancel" }), shouldShowGeneralSave && formik.dirty && (_jsx(SolidButton, { size: "sm", type: "submit", form: "module-general-info-form", onClick: function () { return showError(); }, children: "Save" }))] })] })), isCreateMode ? (generalInfoContent) : (_jsx("div", { className: "solid-module-form-workspace", children: _jsx(SolidTabGroup, { value: activeWorkspaceTab, onValueChange: setActiveWorkspaceTab, className: "solid-module-form-tabs", listClassName: "solid-module-form-tablist", panelClassName: "solid-module-form-tabpanel",
|
|
309
|
+
}, value: formik.values.displayName, className: styles.fieldInput }), isFormFieldValid(formik, "displayName") && (_jsx("p", { className: styles.fieldError, children: (_c = (_b = formik === null || formik === void 0 ? void 0 : formik.errors) === null || _b === void 0 ? void 0 : _b.displayName) === null || _c === void 0 ? void 0 : _c.toString() }))] }) }), _jsx("div", { className: "field w-full px-2 pt-2 lg:w-1/2", children: _jsxs("div", { className: styles.fieldWrapper, children: [_jsxs("label", { htmlFor: "name", className: "".concat(styles.fieldLabel, " form-field-label"), children: ["Name ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx(SolidInput, { disabled: true, type: "text", id: "name", name: "name", onChange: formik.handleChange, value: formik.values.name, className: styles.fieldInput }), isFormFieldValid(formik, "name") && (_jsx("p", { className: styles.fieldError, children: (_e = (_d = formik === null || formik === void 0 ? void 0 : formik.errors) === null || _d === void 0 ? void 0 : _d.name) === null || _e === void 0 ? void 0 : _e.toString() }))] }) })] }), _jsxs("div", { className: "mt-4 flex flex-wrap -mx-2 -mt-2", children: [_jsx("div", { className: "field w-full px-2 pt-2 pb-3 lg:w-1/2 lg:pb-0", children: _jsxs("div", { className: styles.fieldWrapper, children: [_jsx("label", { htmlFor: "menuSequenceNumber", className: "".concat(styles.fieldLabel, " form-field-label"), children: "Menu Sequence Number" }), _jsx(SolidInput, { id: "menuSequenceNumber", type: "number", onChange: formik.handleChange, min: 0, value: formik.values.menuSequenceNumber, className: styles.fieldInput }), isFormFieldValid(formik, "menuSequenceNumber") && (_jsx("p", { className: styles.fieldError, children: (_g = (_f = formik === null || formik === void 0 ? void 0 : formik.errors) === null || _f === void 0 ? void 0 : _f.menuSequenceNumber) === null || _g === void 0 ? void 0 : _g.toString() }))] }) }), _jsx("div", { className: "field w-full px-2 pt-2 lg:w-1/2", children: _jsxs("div", { className: styles.fieldWrapper, children: [_jsxs("label", { htmlFor: "description", className: "".concat(styles.fieldLabel, " form-field-label"), children: ["Description ", _jsx("span", { className: "text-red-500", children: "*" })] }), _jsx(SolidTextarea, { id: "description", name: "description", onChange: formik.handleChange, value: formik.values.description, className: styles.fieldTextarea, rows: 5, cols: 30 }), isFormFieldValid(formik, "description") && (_jsx("p", { className: styles.fieldError, children: (_j = (_h = formik === null || formik === void 0 ? void 0 : formik.errors) === null || _h === void 0 ? void 0 : _h.description) === null || _j === void 0 ? void 0 : _j.toString() }))] }) })] }), _jsx("div", { className: "mt-4 flex flex-wrap -mx-2 -mt-2", children: _jsx("div", { className: "field w-full px-2 pt-2", children: _jsxs("div", { className: "".concat(styles.fieldWrapper, " relative"), children: [_jsxs("label", { htmlFor: "menuIconUrl", className: "".concat(styles.fieldLabel, " form-field-label"), children: ["Menu Icon ", _jsx("small", { className: "text-red-500 helper-text", children: "(only svg, png and jpeg are allowed)" })] }), _jsxs("div", __assign({}, getRootPropsmenuIcon(), { className: "solid-dropzone-wrapper", children: [_jsx("input", __assign({}, getInputPropsmenuIcon())), _jsx(DropzonePlaceholder, {})] })), isFormFieldValid(formik, "menuIconUrl") && (_jsx(SolidMessage, { severity: "error", text: (_l = (_k = formik === null || formik === void 0 ? void 0 : formik.errors) === null || _k === void 0 ? void 0 : _k.menuIconUrl) === null || _l === void 0 ? void 0 : _l.toString(), className: "mt-2" })), fileDetails && (_jsxs("div", { className: "solid-file-upload-wrapper mt-4", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(FileReaderExt, { fileDetails: fileDetails }), _jsxs("div", { className: "flex w-full flex-col gap-1", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("div", { className: "font-bold solid-module-mobile-text-wrapper", children: fileDetails.name }), _jsx("button", { type: "button", className: "solid-file-icon-btn is-danger solid-module-upload-remove", "aria-label": "Remove uploaded menu icon", onClick: handleCancelUpload, children: _jsx(SolidIcon, { name: "si-times", "aria-hidden": true }) })] }), uploadCompleted ? (_jsxs("div", { className: "flex items-center gap-2 text-sm", children: [totalSize, " of ", totalSize, _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "4", height: "4", viewBox: "0 0 4 4", fill: "none", children: _jsx("circle", { cx: "2", cy: "2", r: "2", fill: "#C1C1C1" }) }), _jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [_jsx("mask", { id: "mask0_2480_8635", style: { maskType: 'alpha' }, maskUnits: "userSpaceOnUse", x: "0", y: "0", width: "20", height: "20", children: _jsx("rect", { width: "20", height: "20", fill: "#D9D9D9" }) }), _jsx("g", { mask: "url(#mask0_2480_8635)", children: _jsx("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 5.215 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: "var(--primary-color, var(--primary))" }) })] }), "Completed"] })) : (_jsxs("div", { className: "flex items-center gap-2 text-sm", children: [uploadedSize, " of ", totalSize, _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "4", height: "4", viewBox: "0 0 4 4", fill: "none", children: _jsx("circle", { cx: "2", cy: "2", r: "2", fill: "#C1C1C1" }) }), _jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: _jsx("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" }) }), "Uploading $", uploadProgress, "% Completed"] }))] })] }), _jsx(SolidProgressBar, { value: uploadProgress, showValue: false, style: { height: 4 }, className: "mt-2" })] }))] }) }) })] }), _jsx(SolidPanel, { header: "Datasource Configuration", className: "solid-column-panel mt-4", children: _jsxs("div", { className: "mt-3 flex flex-wrap -mx-2 -mt-2", children: [_jsx("div", { className: "field w-full px-2 pt-2", children: _jsxs("div", { className: styles.fieldWrapper, children: [_jsx("label", { htmlFor: "defaultDataSource", className: "".concat(styles.fieldLabel, " form-field-label"), children: "Default Data Source" }), _jsx("div", { className: "solid-standard-autocomplete w-full", children: _jsx(SolidAutocomplete, { disabled: !!data, value: defaultDataSourceField.selectedItem, suggestions: defaultDataSourceField.filteredItems, completeMethod: defaultDataSourceField.searchItems, onChange: defaultDataSourceField.handleChange, dropdown: true, field: "label", className: "w-full" }) }), isFormFieldValid(formik, "defaultDataSource") && (_jsx("p", { className: styles.fieldError, children: (_o = (_m = formik === null || formik === void 0 ? void 0 : formik.errors) === null || _m === void 0 ? void 0 : _m.defaultDataSource) === null || _o === void 0 ? void 0 : _o.toString() }))] }) }), !isCreateMode ? (_jsx("div", { className: "field w-full px-2 pt-4", children: _jsxs("div", { className: "solid-module-automap-panel", children: [_jsxs("div", { className: "solid-module-automap-copy", children: [_jsx("div", { className: "solid-module-automap-eyebrow", children: "Legacy Table Mapping" }), _jsx("h4", { children: "Auto map datasource tables into this module" }), _jsx("p", { children: "Open the datasource introspection workspace to inspect legacy tables, preview field mappings, review metadata JSON changes, and generate the supporting migration template for SolidX system fields." }), _jsxs("ul", { className: "solid-module-automap-list", children: [_jsx("li", { children: "Review tables available on the selected datasource." }), _jsx("li", { children: "Control which legacy columns are included in each mapping session." }), _jsx("li", { children: "Preview the metadata JSON and migration output before saving." })] })] }), _jsx("div", { className: "solid-module-automap-actions", children: _jsx(SolidButton, { type: "button", size: "sm", onClick: function () { return router.push("/admin/core/solid-core/modules/".concat(data === null || data === void 0 ? void 0 : data.id, "/datasource-introspection")); }, children: "Auto Map Tables" }) })] }) })) : null] }) })] }) }), _jsx(SolidFormFooter, { params: params })] }));
|
|
310
|
+
return (_jsx("div", { className: "solid-form-wrapper", children: _jsxs("div", { className: "solid-form-section", style: { borderRight: params.embeded !== true ? '1px solid var(--primary-light-color)' : '' }, children: [isCreateMode && (_jsxs("div", { className: "solid-form-header flex flex-wrap items-center justify-between gap-3", children: [_jsx("div", { className: "flex flex-col gap-1" }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(SolidButton, { variant: "outline", size: "sm", type: "button", onClick: handleCancel, className: "bg-[var(--primary-color-text)]", children: "Cancel" }), shouldShowGeneralSave && formik.dirty && (_jsx(SolidButton, { size: "sm", type: "submit", form: "module-general-info-form", onClick: function () { return showError(); }, children: "Save" }))] })] })), isCreateMode ? (generalInfoContent) : (_jsx("div", { className: "solid-module-form-workspace", children: _jsx(SolidTabGroup, { value: activeWorkspaceTab, onValueChange: setActiveWorkspaceTab, className: "solid-module-form-tabs", listClassName: "solid-module-form-tablist", panelClassName: "solid-module-form-tabpanel", tabs: [
|
|
311
311
|
{
|
|
312
312
|
value: "general",
|
|
313
313
|
label: _jsx("span", { className: "solid-module-form-tab-label", children: "General Info" }),
|