@solidstarters/solid-core-ui 1.1.10 → 1.1.11

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.
Files changed (166) hide show
  1. package/dist/components/core/extension/dynamicComponentMap.d.ts +3 -0
  2. package/dist/components/core/extension/dynamicComponentMap.d.ts.map +1 -0
  3. package/dist/components/core/extension/dynamicComponentMap.js +6 -0
  4. package/dist/components/core/extension/dynamicComponentMap.js.map +1 -0
  5. package/dist/components/core/filter/SolidManyToOneFilterElement.js +7 -5
  6. package/dist/components/core/filter/SolidManyToOneFilterElement.js.map +1 -1
  7. package/dist/components/core/form/SolidFormView.d.ts.map +1 -1
  8. package/dist/components/core/form/SolidFormView.js +31 -5
  9. package/dist/components/core/form/SolidFormView.js.map +1 -1
  10. package/dist/components/core/form/fields/SolidBooleanField.d.ts.map +1 -1
  11. package/dist/components/core/form/fields/SolidBooleanField.js +5 -1
  12. package/dist/components/core/form/fields/SolidBooleanField.js.map +1 -1
  13. package/dist/components/core/form/fields/SolidDateField.d.ts.map +1 -1
  14. package/dist/components/core/form/fields/SolidDateField.js +5 -1
  15. package/dist/components/core/form/fields/SolidDateField.js.map +1 -1
  16. package/dist/components/core/form/fields/SolidDateTimeField.d.ts.map +1 -1
  17. package/dist/components/core/form/fields/SolidDateTimeField.js +5 -1
  18. package/dist/components/core/form/fields/SolidDateTimeField.js.map +1 -1
  19. package/dist/components/core/form/fields/SolidDecimalField.d.ts.map +1 -1
  20. package/dist/components/core/form/fields/SolidDecimalField.js +5 -1
  21. package/dist/components/core/form/fields/SolidDecimalField.js.map +1 -1
  22. package/dist/components/core/form/fields/SolidIntegerField.d.ts.map +1 -1
  23. package/dist/components/core/form/fields/SolidIntegerField.js +5 -1
  24. package/dist/components/core/form/fields/SolidIntegerField.js.map +1 -1
  25. package/dist/components/core/form/fields/SolidLongTextField.d.ts.map +1 -1
  26. package/dist/components/core/form/fields/SolidLongTextField.js +5 -1
  27. package/dist/components/core/form/fields/SolidLongTextField.js.map +1 -1
  28. package/dist/components/core/form/fields/SolidSelectionStaticField.d.ts.map +1 -1
  29. package/dist/components/core/form/fields/SolidSelectionStaticField.js +14 -5
  30. package/dist/components/core/form/fields/SolidSelectionStaticField.js.map +1 -1
  31. package/dist/components/core/form/fields/SolidShortTextField.d.ts.map +1 -1
  32. package/dist/components/core/form/fields/SolidShortTextField.js +5 -1
  33. package/dist/components/core/form/fields/SolidShortTextField.js.map +1 -1
  34. package/dist/components/core/form/fields/SolidTimeField.d.ts.map +1 -1
  35. package/dist/components/core/form/fields/SolidTimeField.js +5 -1
  36. package/dist/components/core/form/fields/SolidTimeField.js.map +1 -1
  37. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js +20 -13
  38. package/dist/components/core/form/fields/relations/SolidRelationManyToManyField.js.map +1 -1
  39. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js +9 -6
  40. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js.map +1 -1
  41. package/dist/components/core/hooks/GlobalStateContext.d.ts +11 -0
  42. package/dist/components/core/hooks/GlobalStateContext.d.ts.map +1 -0
  43. package/dist/components/core/hooks/GlobalStateContext.js +17 -0
  44. package/dist/components/core/hooks/GlobalStateContext.js.map +1 -0
  45. package/dist/components/core/list/SolidListView.d.ts.map +1 -1
  46. package/dist/components/core/list/SolidListView.js +31 -9
  47. package/dist/components/core/list/SolidListView.js.map +1 -1
  48. package/dist/components/core/list/SolidManyToOneFilterElement.js +7 -5
  49. package/dist/components/core/list/SolidManyToOneFilterElement.js.map +1 -1
  50. package/dist/components/core/list/columns/SolidBooleanColumn.js +3 -1
  51. package/dist/components/core/list/columns/SolidBooleanColumn.js.map +1 -1
  52. package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.js +2 -1
  53. package/dist/components/core/list/columns/relations/SolidRelationManyToOneColumn.js.map +1 -1
  54. package/dist/components/core/model/FieldMetaDataForm.d.ts.map +1 -1
  55. package/dist/components/core/model/FieldMetaDataForm.js +67 -54
  56. package/dist/components/core/model/FieldMetaDataForm.js.map +1 -1
  57. package/dist/components/core/model/FieldSelector.js +1 -1
  58. package/dist/components/core/model/FieldSelector.js.map +1 -1
  59. package/dist/components/core/model/ModelMetaData.d.ts.map +1 -1
  60. package/dist/components/core/model/ModelMetaData.js +12 -17
  61. package/dist/components/core/model/ModelMetaData.js.map +1 -1
  62. package/package.json +1 -1
  63. package/src/components/core/filter/SolidManyToOneFilterElement.tsx +2 -2
  64. package/src/components/core/form/SolidFormView.tsx +33 -5
  65. package/src/components/core/form/fields/SolidBooleanField.tsx +6 -1
  66. package/src/components/core/form/fields/SolidDateField.tsx +6 -1
  67. package/src/components/core/form/fields/SolidDateTimeField.tsx +6 -1
  68. package/src/components/core/form/fields/SolidDecimalField.tsx +6 -1
  69. package/src/components/core/form/fields/SolidIntegerField.tsx +6 -1
  70. package/src/components/core/form/fields/SolidLongTextField.tsx +6 -1
  71. package/src/components/core/form/fields/SolidSelectionStaticField.tsx +19 -9
  72. package/src/components/core/form/fields/SolidShortTextField.tsx +7 -2
  73. package/src/components/core/form/fields/SolidTimeField.tsx +6 -1
  74. package/src/components/core/form/fields/relations/SolidRelationManyToManyField.tsx +7 -7
  75. package/src/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +3 -3
  76. package/src/components/core/list/SolidListView.tsx +32 -7
  77. package/src/components/core/list/SolidManyToOneFilterElement.tsx +2 -2
  78. package/src/components/core/list/columns/SolidBooleanColumn.tsx +2 -2
  79. package/src/components/core/list/columns/relations/SolidRelationManyToOneColumn.tsx +1 -1
  80. package/src/components/core/model/FieldMetaDataForm.tsx +166 -87
  81. package/src/components/core/model/FieldSelector.tsx +1 -1
  82. package/src/components/core/model/ModelMetaData.tsx +8 -7
  83. package/dist/components/core/filter/columns/SolidBigintField.d.ts +0 -4
  84. package/dist/components/core/filter/columns/SolidBigintField.d.ts.map +0 -1
  85. package/dist/components/core/filter/columns/SolidBigintField.js +0 -8
  86. package/dist/components/core/filter/columns/SolidBigintField.js.map +0 -1
  87. package/dist/components/core/filter/columns/SolidBooleanField.d.ts +0 -4
  88. package/dist/components/core/filter/columns/SolidBooleanField.d.ts.map +0 -1
  89. package/dist/components/core/filter/columns/SolidBooleanField.js +0 -27
  90. package/dist/components/core/filter/columns/SolidBooleanField.js.map +0 -1
  91. package/dist/components/core/filter/columns/SolidComputedField.d.ts +0 -4
  92. package/dist/components/core/filter/columns/SolidComputedField.d.ts.map +0 -1
  93. package/dist/components/core/filter/columns/SolidComputedField.js +0 -22
  94. package/dist/components/core/filter/columns/SolidComputedField.js.map +0 -1
  95. package/dist/components/core/filter/columns/SolidDateField.d.ts +0 -9
  96. package/dist/components/core/filter/columns/SolidDateField.d.ts.map +0 -1
  97. package/dist/components/core/filter/columns/SolidDateField.js +0 -35
  98. package/dist/components/core/filter/columns/SolidDateField.js.map +0 -1
  99. package/dist/components/core/filter/columns/SolidDatetimeField.d.ts +0 -4
  100. package/dist/components/core/filter/columns/SolidDatetimeField.d.ts.map +0 -1
  101. package/dist/components/core/filter/columns/SolidDatetimeField.js +0 -24
  102. package/dist/components/core/filter/columns/SolidDatetimeField.js.map +0 -1
  103. package/dist/components/core/filter/columns/SolidDecimalField.d.ts +0 -4
  104. package/dist/components/core/filter/columns/SolidDecimalField.d.ts.map +0 -1
  105. package/dist/components/core/filter/columns/SolidDecimalField.js +0 -8
  106. package/dist/components/core/filter/columns/SolidDecimalField.js.map +0 -1
  107. package/dist/components/core/filter/columns/SolidExternalIdField.d.ts +0 -4
  108. package/dist/components/core/filter/columns/SolidExternalIdField.d.ts.map +0 -1
  109. package/dist/components/core/filter/columns/SolidExternalIdField.js +0 -25
  110. package/dist/components/core/filter/columns/SolidExternalIdField.js.map +0 -1
  111. package/dist/components/core/filter/columns/SolidFloatField.d.ts +0 -4
  112. package/dist/components/core/filter/columns/SolidFloatField.d.ts.map +0 -1
  113. package/dist/components/core/filter/columns/SolidFloatField.js +0 -8
  114. package/dist/components/core/filter/columns/SolidFloatField.js.map +0 -1
  115. package/dist/components/core/filter/columns/SolidIdField.d.ts +0 -4
  116. package/dist/components/core/filter/columns/SolidIdField.d.ts.map +0 -1
  117. package/dist/components/core/filter/columns/SolidIdField.js +0 -25
  118. package/dist/components/core/filter/columns/SolidIdField.js.map +0 -1
  119. package/dist/components/core/filter/columns/SolidIntField.d.ts +0 -4
  120. package/dist/components/core/filter/columns/SolidIntField.d.ts.map +0 -1
  121. package/dist/components/core/filter/columns/SolidIntField.js +0 -34
  122. package/dist/components/core/filter/columns/SolidIntField.js.map +0 -1
  123. package/dist/components/core/filter/columns/SolidLongTextField.d.ts +0 -4
  124. package/dist/components/core/filter/columns/SolidLongTextField.d.ts.map +0 -1
  125. package/dist/components/core/filter/columns/SolidLongTextField.js +0 -8
  126. package/dist/components/core/filter/columns/SolidLongTextField.js.map +0 -1
  127. package/dist/components/core/filter/columns/SolidMediaMultipleField.d.ts +0 -4
  128. package/dist/components/core/filter/columns/SolidMediaMultipleField.d.ts.map +0 -1
  129. package/dist/components/core/filter/columns/SolidMediaMultipleField.js +0 -35
  130. package/dist/components/core/filter/columns/SolidMediaMultipleField.js.map +0 -1
  131. package/dist/components/core/filter/columns/SolidMediaSingleField.d.ts +0 -4
  132. package/dist/components/core/filter/columns/SolidMediaSingleField.d.ts.map +0 -1
  133. package/dist/components/core/filter/columns/SolidMediaSingleField.js +0 -35
  134. package/dist/components/core/filter/columns/SolidMediaSingleField.js.map +0 -1
  135. package/dist/components/core/filter/columns/SolidRelationField.d.ts +0 -4
  136. package/dist/components/core/filter/columns/SolidRelationField.d.ts.map +0 -1
  137. package/dist/components/core/filter/columns/SolidRelationField.js +0 -12
  138. package/dist/components/core/filter/columns/SolidRelationField.js.map +0 -1
  139. package/dist/components/core/filter/columns/SolidRichTextField.d.ts +0 -4
  140. package/dist/components/core/filter/columns/SolidRichTextField.d.ts.map +0 -1
  141. package/dist/components/core/filter/columns/SolidRichTextField.js +0 -8
  142. package/dist/components/core/filter/columns/SolidRichTextField.js.map +0 -1
  143. package/dist/components/core/filter/columns/SolidSelectionDynamicField.d.ts +0 -4
  144. package/dist/components/core/filter/columns/SolidSelectionDynamicField.d.ts.map +0 -1
  145. package/dist/components/core/filter/columns/SolidSelectionDynamicField.js +0 -25
  146. package/dist/components/core/filter/columns/SolidSelectionDynamicField.js.map +0 -1
  147. package/dist/components/core/filter/columns/SolidSelectionStaticField.d.ts +0 -4
  148. package/dist/components/core/filter/columns/SolidSelectionStaticField.d.ts.map +0 -1
  149. package/dist/components/core/filter/columns/SolidSelectionStaticField.js +0 -26
  150. package/dist/components/core/filter/columns/SolidSelectionStaticField.js.map +0 -1
  151. package/dist/components/core/filter/columns/SolidShortTextField.d.ts +0 -4
  152. package/dist/components/core/filter/columns/SolidShortTextField.d.ts.map +0 -1
  153. package/dist/components/core/filter/columns/SolidShortTextField.js +0 -33
  154. package/dist/components/core/filter/columns/SolidShortTextField.js.map +0 -1
  155. package/dist/components/core/filter/columns/SolidTimeField.d.ts +0 -4
  156. package/dist/components/core/filter/columns/SolidTimeField.d.ts.map +0 -1
  157. package/dist/components/core/filter/columns/SolidTimeField.js +0 -24
  158. package/dist/components/core/filter/columns/SolidTimeField.js.map +0 -1
  159. package/dist/components/core/filter/columns/SolidUuidField.d.ts +0 -4
  160. package/dist/components/core/filter/columns/SolidUuidField.d.ts.map +0 -1
  161. package/dist/components/core/filter/columns/SolidUuidField.js +0 -25
  162. package/dist/components/core/filter/columns/SolidUuidField.js.map +0 -1
  163. package/dist/components/core/filter/columns/relations/SolidRelationManyToOneField.d.ts +0 -4
  164. package/dist/components/core/filter/columns/relations/SolidRelationManyToOneField.d.ts.map +0 -1
  165. package/dist/components/core/filter/columns/relations/SolidRelationManyToOneField.js +0 -54
  166. package/dist/components/core/filter/columns/relations/SolidRelationManyToOneField.js.map +0 -1
@@ -141,7 +141,7 @@ const SolidField = ({ formik, field, fieldMetadata, initialEntityData, solidForm
141
141
  solidFormViewMetaData: solidFormViewMetaData,
142
142
  modelName: modelName,
143
143
  }
144
- const solidField = fieldFactory(fieldMetadata.type, fieldContext);
144
+ const solidField = fieldFactory(fieldMetadata?.type, fieldContext);
145
145
 
146
146
  return solidField?.render(formik);
147
147
  };
@@ -281,6 +281,8 @@ const SolidFormView = (params: SolidFormViewProps) => {
281
281
 
282
282
  const [actionsAllowed, setActionsAllowed] = useState<string[]>([]);
283
283
 
284
+ const errorFields: string[] = [];
285
+
284
286
  const [triggerCheckIfPermissionExists] = useLazyCheckIfPermissionExistsQuery();
285
287
  useEffect(() => {
286
288
 
@@ -456,7 +458,7 @@ const SolidFormView = (params: SolidFormViewProps) => {
456
458
  modelName: params.modelName,
457
459
  }
458
460
 
459
- let solidField = fieldFactory(fieldMetadata.type, fieldContext);
461
+ let solidField = fieldFactory(fieldMetadata?.type, fieldContext);
460
462
 
461
463
  // Append each field to the FormData
462
464
  if (value !== undefined && value !== null && solidField) {
@@ -480,6 +482,26 @@ const SolidFormView = (params: SolidFormViewProps) => {
480
482
  }
481
483
  }
482
484
 
485
+ const showFieldError = () => {
486
+ if (errorFields.length === 0) return;
487
+ errorFields.forEach((error) => {
488
+ toast?.current?.show({
489
+ severity: "error",
490
+ summary: "Metadata Error",
491
+ detail: error,
492
+ life: 3000,
493
+ });
494
+
495
+ });
496
+
497
+ // errorFields.length = 0;
498
+ };
499
+ useEffect(() => {
500
+ if (errorFields.length > 0) {
501
+ showFieldError();
502
+ }
503
+ }, [errorFields])
504
+
483
505
  // - - - - - - - - - - - -- - - - - - - - - - - - DATA here
484
506
  // Fetch the actual data here.
485
507
  // This is the initial value of this form, will come from an API call in the case of edit.
@@ -493,10 +515,10 @@ const SolidFormView = (params: SolidFormViewProps) => {
493
515
  for (let i = 0; i < layoutFields.length; i++) {
494
516
  const formLayoutField = layoutFields[i];
495
517
  const fieldMetadata = solidFieldsMetadata[formLayoutField.attrs.name];
496
- if (fieldMetadata.type === 'relation') {
518
+ if (fieldMetadata?.type === 'relation') {
497
519
  toPopulate.push(fieldMetadata.name);
498
520
  }
499
- if (fieldMetadata.type === 'mediaSingle' || fieldMetadata.type === 'mediaMultiple') {
521
+ if (fieldMetadata?.type === 'mediaSingle' || fieldMetadata?.type === 'mediaMultiple') {
500
522
  toPopulateMedia.push(fieldMetadata.name);
501
523
  }
502
524
  }
@@ -550,7 +572,13 @@ const SolidFormView = (params: SolidFormViewProps) => {
550
572
  solidFormViewMetaData: solidFormViewMetaData,
551
573
  modelName: params.modelName,
552
574
  }
553
- let solidField = fieldFactory(fieldMetadata.type, fieldContext);
575
+ let solidField = fieldFactory(fieldMetadata?.type, fieldContext);
576
+ if (!fieldMetadata?.type) {
577
+ const errorMessage = formLayoutField.attrs.label;
578
+ if (!errorFields.includes(errorMessage)) {
579
+ errorFields.push(errorMessage);
580
+ }
581
+ }
554
582
  if (solidField) {
555
583
  // @ts-ignore
556
584
  validationSchema[formLayoutField.attrs.name] = solidField.validationSchema();
@@ -23,7 +23,12 @@ export class SolidBooleanField implements ISolidField {
23
23
  }
24
24
 
25
25
  initialValue(): any {
26
- return this.fieldContext.data[this.fieldContext.field.attrs.name];
26
+ const fieldName = this.fieldContext.field.attrs.name;
27
+ const fieldDefaultValue = this.fieldContext?.fieldMetadata?.defaultValue;
28
+
29
+ const existingValue = this.fieldContext.data[fieldName];
30
+
31
+ return existingValue !== undefined && existingValue !== null ? existingValue : fieldDefaultValue || '';
27
32
  }
28
33
 
29
34
  validationSchema(): Schema {
@@ -22,7 +22,12 @@ export class SolidDateField implements ISolidField {
22
22
  }
23
23
 
24
24
  initialValue(): any {
25
- return this.fieldContext.data[this.fieldContext.field.attrs.name];
25
+ const fieldName = this.fieldContext.field.attrs.name;
26
+ const fieldDefaultValue = this.fieldContext?.fieldMetadata?.defaultValue;
27
+
28
+ const existingValue = this.fieldContext.data[fieldName];
29
+
30
+ return existingValue !== undefined && existingValue !== null ? existingValue : fieldDefaultValue || '';
26
31
  }
27
32
 
28
33
  validationSchema(): Schema {
@@ -22,7 +22,12 @@ export class SolidDateTimeField implements ISolidField {
22
22
  }
23
23
 
24
24
  initialValue(): any {
25
- return this.fieldContext.data[this.fieldContext.field.attrs.name];
25
+ const fieldName = this.fieldContext.field.attrs.name;
26
+ const fieldDefaultValue = this.fieldContext?.fieldMetadata?.defaultValue;
27
+
28
+ const existingValue = this.fieldContext.data[fieldName];
29
+
30
+ return existingValue !== undefined && existingValue !== null ? existingValue : fieldDefaultValue || '';
26
31
  }
27
32
 
28
33
  validationSchema(): Schema {
@@ -21,7 +21,12 @@ export class SolidDecimalField implements ISolidField {
21
21
  }
22
22
 
23
23
  initialValue(): any {
24
- return this.fieldContext.data[this.fieldContext.field.attrs.name];
24
+ const fieldName = this.fieldContext.field.attrs.name;
25
+ const fieldDefaultValue = this.fieldContext?.fieldMetadata?.defaultValue;
26
+
27
+ const existingValue = this.fieldContext.data[fieldName];
28
+
29
+ return existingValue !== undefined && existingValue !== null ? existingValue : fieldDefaultValue || '';
25
30
  }
26
31
 
27
32
  validationSchema(): Schema {
@@ -21,7 +21,12 @@ export class SolidIntegerField implements ISolidField {
21
21
  }
22
22
 
23
23
  initialValue(): any {
24
- return this.fieldContext.data[this.fieldContext.field.attrs.name];
24
+ const fieldName = this.fieldContext.field.attrs.name;
25
+ const fieldDefaultValue = this.fieldContext?.fieldMetadata?.defaultValue;
26
+
27
+ const existingValue = this.fieldContext.data[fieldName];
28
+
29
+ return existingValue !== undefined && existingValue !== null ? existingValue : fieldDefaultValue || '';
25
30
  }
26
31
 
27
32
  validationSchema(): Schema {
@@ -21,7 +21,12 @@ export class SolidLongTextField implements ISolidField {
21
21
  }
22
22
 
23
23
  initialValue(): any {
24
- return this.fieldContext.data[this.fieldContext.field.attrs.name];
24
+ const fieldName = this.fieldContext.field.attrs.name;
25
+ const fieldDefaultValue = this.fieldContext?.fieldMetadata?.defaultValue;
26
+
27
+ const existingValue = this.fieldContext.data[fieldName];
28
+
29
+ return existingValue !== undefined && existingValue !== null ? existingValue : fieldDefaultValue || '';
25
30
  }
26
31
 
27
32
  validationSchema(): Schema {
@@ -22,12 +22,17 @@ export class SolidSelectionStaticField implements ISolidField {
22
22
  }
23
23
 
24
24
  initialValue(): any {
25
- // TODO: Use the field metadata to re-create the object in the valid format
26
- // {label: '', value: ''}
27
- const optionValue = this.fieldContext.data[this.fieldContext.field.attrs.name];
25
+ // Get field name and metadata
26
+ const fieldName = this.fieldContext.field.attrs.name;
28
27
  const fieldMetadata = this.fieldContext.fieldMetadata;
29
-
30
- const getDisplayValue = (value: string): string | null => {
28
+ const fieldDefaultValue = fieldMetadata?.defaultValue;
29
+
30
+ // Get existing value from form data
31
+ const existingValue = this.fieldContext.data[fieldName];
32
+
33
+ // Function to get display value based on selectionStaticValues
34
+ const getDisplayValue = (value: string | null): string | null => {
35
+ if (!value) return null;
31
36
  for (const item of fieldMetadata.selectionStaticValues) {
32
37
  const [lhs, rhs] = item.split(':');
33
38
  if (lhs === value) {
@@ -36,11 +41,16 @@ export class SolidSelectionStaticField implements ISolidField {
36
41
  }
37
42
  return null;
38
43
  };
39
-
40
- const displayValue = getDisplayValue(optionValue)
41
-
42
- return { label: displayValue ?? '', value: optionValue };
44
+
45
+ // Determine the final value to use (existing value or default value)
46
+ const finalValue = existingValue ?? fieldDefaultValue ?? '';
47
+
48
+ // Get display value for the final value
49
+ const displayValue = getDisplayValue(finalValue);
50
+
51
+ return { label: displayValue ?? '', value: finalValue };
43
52
  }
53
+
44
54
 
45
55
  validationSchema(): Schema {
46
56
 
@@ -21,8 +21,14 @@ export class SolidShortTextField implements ISolidField {
21
21
  }
22
22
 
23
23
  initialValue(): any {
24
- return this.fieldContext.data[this.fieldContext.field.attrs.name];
24
+ const fieldName = this.fieldContext.field.attrs.name;
25
+ const fieldDefaultValue = this.fieldContext?.fieldMetadata?.defaultValue;
26
+
27
+ const existingValue = this.fieldContext.data[fieldName];
28
+
29
+ return existingValue !== undefined && existingValue !== null ? existingValue : fieldDefaultValue || '';
25
30
  }
31
+
26
32
 
27
33
  validationSchema(): Schema {
28
34
  let schema: Yup.StringSchema<string | null | undefined> = Yup.string();
@@ -62,7 +68,6 @@ export class SolidShortTextField implements ISolidField {
62
68
  const fieldLabel = fieldLayoutInfo.attrs.label ?? fieldMetadata.displayName;
63
69
  const fieldDescription = fieldLayoutInfo.attrs.description ?? fieldMetadata.description;
64
70
  const solidFormViewMetaData = this.fieldContext.solidFormViewMetaData;
65
-
66
71
  const isFormFieldValid = (formik: any, fieldName: string) => formik.touched[fieldName] && formik.errors[fieldName];
67
72
 
68
73
  const fieldDisabled = fieldLayoutInfo.attrs?.disabled;
@@ -22,7 +22,12 @@ export class SolidTimeField implements ISolidField {
22
22
  }
23
23
 
24
24
  initialValue(): any {
25
- return this.fieldContext.data[this.fieldContext.field.attrs.name];
25
+ const fieldName = this.fieldContext.field.attrs.name;
26
+ const fieldDefaultValue = this.fieldContext?.fieldMetadata?.defaultValue;
27
+
28
+ const existingValue = this.fieldContext.data[fieldName];
29
+
30
+ return existingValue !== undefined && existingValue !== null ? existingValue : fieldDefaultValue || '';
26
31
  }
27
32
 
28
33
  validationSchema(): Schema {
@@ -29,7 +29,7 @@ export class SolidRelationManyToManyField implements ISolidField {
29
29
 
30
30
  const manyToManyFieldData = this.fieldContext.data[this.fieldContext.field.attrs.name];
31
31
  const fieldMetadata = this.fieldContext.fieldMetadata;
32
- const userKeyField = fieldMetadata.relationModel.userKeyField.name;
32
+ const userKeyField = fieldMetadata?.relationModel?.userKeyField?.name;
33
33
  if (manyToManyFieldData) {
34
34
  return manyToManyFieldData.map((e: any) => {
35
35
  const manyToManyColVal = e[userKeyField] || '';
@@ -150,7 +150,7 @@ export class SolidRelationManyToManyField implements ISolidField {
150
150
  let filterQuery;
151
151
  if (query) {
152
152
  filterQuery = {
153
- [fieldMetadata.relationModel.userKeyField.name]: {
153
+ [fieldMetadata?.relationModel?.userKeyField?.name]: {
154
154
  '$containsi': query
155
155
  }
156
156
  }
@@ -175,7 +175,7 @@ export class SolidRelationManyToManyField implements ISolidField {
175
175
  if (autocompleteData) {
176
176
  const autoCompleteItems = autocompleteData.records.map((item: any) => {
177
177
  return {
178
- label: item[fieldMetadata.relationModel.userKeyField.name],
178
+ label: item[fieldMetadata?.relationModel?.userKeyField?.name],
179
179
  value: item['id'],
180
180
  original: item
181
181
  }
@@ -205,7 +205,7 @@ export class SolidRelationManyToManyField implements ISolidField {
205
205
  const updatedRelationData = [
206
206
  ...currentRelationData,
207
207
  {
208
- label: jsonValues[fieldMetadata.relationModel.userKeyField.name],
208
+ label: jsonValues[fieldMetadata?.relationModel?.userKeyField?.name],
209
209
  value: "new",
210
210
  original: jsonValues,
211
211
  },
@@ -309,7 +309,7 @@ export class SolidRelationManyToManyField implements ISolidField {
309
309
  offset: 0,
310
310
  limit: 10,
311
311
  filters: {
312
- [fieldMetadata.relationModel.userKeyField.name]: {
312
+ [fieldMetadata?.relationModel?.userKeyField?.name]: {
313
313
  '$containsi': event.query
314
314
  }
315
315
  }
@@ -328,7 +328,7 @@ export class SolidRelationManyToManyField implements ISolidField {
328
328
  if (autocompleteData) {
329
329
  const autoCompleteItems = autocompleteData.records.map((item: any) => {
330
330
  return {
331
- label: item[fieldMetadata.relationModel.userKeyField.name],
331
+ label: item[fieldMetadata?.relationModel?.userKeyField?.name],
332
332
  value: item['id'],
333
333
  original: item
334
334
 
@@ -344,7 +344,7 @@ export class SolidRelationManyToManyField implements ISolidField {
344
344
  const updatedRelationData = [
345
345
  ...currentRelationData,
346
346
  {
347
- label: jsonValues[fieldMetadata.relationModel.userKeyField.name],
347
+ label: jsonValues[fieldMetadata?.relationModel?.userKeyField?.name],
348
348
  value: "new",
349
349
  original: jsonValues,
350
350
  },
@@ -21,7 +21,7 @@ export class SolidRelationManyToOneField implements ISolidField {
21
21
 
22
22
  const manyToOneFieldData = this.fieldContext.data[this.fieldContext.field.attrs.name];
23
23
  const fieldMetadata = this.fieldContext.fieldMetadata;
24
- const userKeyField = fieldMetadata.relationModel.userKeyField.name;
24
+ const userKeyField = fieldMetadata?.relationModel?.userKeyField?.name;
25
25
  const manyToOneColVal = manyToOneFieldData ? manyToOneFieldData[userKeyField] : '';
26
26
  if (manyToOneColVal) {
27
27
  return { label: manyToOneColVal || '', value: manyToOneFieldData?.id || '' };
@@ -77,7 +77,7 @@ export class SolidRelationManyToOneField implements ISolidField {
77
77
  offset: 0,
78
78
  limit: 10,
79
79
  filters: {
80
- [fieldMetadata.relationModel.userKeyField.name]: {
80
+ [fieldMetadata?.relationModel?.userKeyField?.name]: {
81
81
  '$containsi': event.query
82
82
  }
83
83
  }
@@ -96,7 +96,7 @@ export class SolidRelationManyToOneField implements ISolidField {
96
96
  if (autocompleteData) {
97
97
  const autoCompleteItems = autocompleteData.records.map((item: any) => {
98
98
  return {
99
- label: item[fieldMetadata.relationModel.userKeyField.name],
99
+ label: item[fieldMetadata?.relationModel?.userKeyField?.name],
100
100
  value: item['id']
101
101
  }
102
102
  });
@@ -121,20 +121,23 @@ export const SolidListView = (params: SolidListViewParams) => {
121
121
 
122
122
  const initialFilters: any = {};
123
123
  const toPopulate: string[] = [];
124
- for (let i = 0; i < solidView.layout.children.length; i++) {
124
+ for (let i = 0; i < solidView.layout.children?.length; i++) {
125
125
  const column = solidView.layout.children[i];
126
126
  const fieldMetadata = solidFieldsMetadata[column.attrs.name];
127
-
127
+ if (!fieldMetadata?.type) {
128
+ showFieldError(`${column.attrs.label} is not present in metadata`)
129
+ return;
130
+ }
128
131
  // Form the initial filters after iterating over the columns and field metadata.
129
- if (['int', 'bigint', 'float', 'decimal'].includes(fieldMetadata.type)) {
132
+ if (['int', 'bigint', 'float', 'decimal'].includes(fieldMetadata?.type)) {
130
133
  // initialFilters[column.attrs.name] = { operator: FilterOperator.OR, constraints: [{ value: null, matchMode: FilterMatchMode.EQUALS }] }
131
134
  initialFilters[column.attrs.name] = { value: null, matchMode: FilterMatchMode.EQUALS }
132
135
  }
133
- else if (['date', 'datetime', 'time', 'boolean'].includes(fieldMetadata.type)) {
136
+ else if (['date', 'datetime', 'time', 'boolean'].includes(fieldMetadata?.type)) {
134
137
  // initialFilters[column.attrs.name] = { operator: FilterOperator.OR, constraints: [{ value: null, matchMode: FilterMatchMode.DATE_IS }] }
135
138
  initialFilters[column.attrs.name] = { value: null, matchMode: FilterMatchMode.EQUALS }
136
139
  }
137
- else if (['relation', 'selectionStatic', 'selectionDynamic'].includes(fieldMetadata.type)) {
140
+ else if (['relation', 'selectionStatic', 'selectionDynamic'].includes(fieldMetadata?.type)) {
138
141
  initialFilters[column.attrs.name] = { value: null, matchMode: FilterMatchMode.IN }
139
142
  }
140
143
  else {
@@ -402,7 +405,7 @@ export const SolidListView = (params: SolidListViewParams) => {
402
405
  if (sortField) {
403
406
  const sortFieldMetadata = solidFieldsMetadata[sortField];
404
407
  if (sortFieldMetadata.type === 'relation' && sortFieldMetadata.relationType === 'many-to-one') {
405
- sortField = `${sortField}.${sortFieldMetadata.relationModel.userKeyField.name}`;
408
+ sortField = `${sortField}.${sortFieldMetadata?.relationModel?.userKeyField?.name}`;
406
409
  }
407
410
  queryData.sort = [
408
411
  `${sortField}:${sortOrder == 0 ? null : sortOrder == 1 ? "asc" : "desc"}`,
@@ -556,6 +559,28 @@ export const SolidListView = (params: SolidListViewParams) => {
556
559
  }
557
560
  };
558
561
 
562
+ const showFieldError = async (error) => {
563
+ if (error) {
564
+ toast?.current?.show({
565
+ severity: "error",
566
+ summary: "Can you send me the report?",
567
+ // sticky: true,
568
+ life: 3000,
569
+ //@ts-ignore
570
+ content: (props) => (
571
+ <div
572
+ className="flex flex-column align-items-left"
573
+ style={{ flex: "1" }}
574
+ >
575
+ <div className="flex align-items-center gap-2" >
576
+ <span className="font-bold text-900">{String(error)}</span>
577
+ </div>
578
+ </div>
579
+ ),
580
+ });
581
+ }
582
+ };
583
+
559
584
  // handle bulk deletion
560
585
  const deleteBulk = () => {
561
586
  let deleteList: any = [];
@@ -587,7 +612,7 @@ export const SolidListView = (params: SolidListViewParams) => {
587
612
  if (!solidView || !solidFieldsMetadata) {
588
613
  return;
589
614
  }
590
- return solidView.layout.children.map((column: any) => {
615
+ return solidView.layout.children?.map((column: any) => {
591
616
  const fieldMetadata = solidFieldsMetadata[column.attrs.name];
592
617
  if (!fieldMetadata) {
593
618
  return;
@@ -19,7 +19,7 @@ export const SolidManyToOneFilterElement = ({ value, updateInputs, index, fieldM
19
19
  offset: 0,
20
20
  limit: 10,
21
21
  filters: {
22
- [fieldMetadata.relationModel.userKeyField.name]: {
22
+ [fieldMetadata?.relationModel?.userKeyField?.name]: {
23
23
  $containsi: event.query
24
24
  }
25
25
  }
@@ -38,7 +38,7 @@ export const SolidManyToOneFilterElement = ({ value, updateInputs, index, fieldM
38
38
  if (autocompleteData) {
39
39
  const autoCompleteItems = autocompleteData.records.map((item: any) => {
40
40
  return {
41
- label: item[fieldMetadata.relationModel.userKeyField.name],
41
+ label: item[fieldMetadata?.relationModel?.userKeyField?.name],
42
42
  value: item['id']
43
43
  }
44
44
  });
@@ -30,12 +30,12 @@ const SolidBooleanColumn = ({ solidListViewMetaData, fieldMetadata, column }: So
30
30
 
31
31
  // Custom body template for Boolean column
32
32
  const bodyTemplate = (rowData: any) => {
33
- return rowData.isActive ? 'Yes' : 'No';
33
+ const fieldKey = column.attrs.label ?? fieldMetadata.name;
34
+ return rowData[fieldKey] ? 'Yes' : 'No';
34
35
  };
35
36
 
36
37
  const header = column.attrs.label ?? fieldMetadata.displayName;
37
38
 
38
-
39
39
  // TODO: filterTemplate, bodyTemplate & filterMatchModeOptions to be provided.
40
40
 
41
41
  return (
@@ -34,7 +34,7 @@ const SolidRelationManyToOneColumn = ({ solidListViewMetaData, fieldMetadata, co
34
34
  // This is the userkey that will be present within the rowData.
35
35
  if (manyToOneFieldData) {
36
36
  // Since this is a many-to-one field, we fetch the user key field of the associated model.
37
- const userKeyField = fieldMetadata.relationModel.userKeyField.name;
37
+ const userKeyField = fieldMetadata?.relationModel?.userKeyField?.name;
38
38
 
39
39
  const manyToOneColVal = manyToOneFieldData[userKeyField];
40
40