@solidstarters/solid-core-ui 1.1.65 → 1.1.67

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 (47) hide show
  1. package/dist/components/Svg/FileSvg.d.ts.map +1 -1
  2. package/dist/components/Svg/FileSvg.js +1 -1
  3. package/dist/components/Svg/FileSvg.js.map +1 -1
  4. package/dist/components/core/common/FilterComponent.d.ts.map +1 -1
  5. package/dist/components/core/common/FilterComponent.js +1 -1
  6. package/dist/components/core/common/FilterComponent.js.map +1 -1
  7. package/dist/components/core/common/SolidGlobalSearchElement.d.ts.map +1 -1
  8. package/dist/components/core/common/SolidGlobalSearchElement.js +1 -1
  9. package/dist/components/core/common/SolidGlobalSearchElement.js.map +1 -1
  10. package/dist/components/core/form/SolidFormView.d.ts +0 -1
  11. package/dist/components/core/form/SolidFormView.d.ts.map +1 -1
  12. package/dist/components/core/form/SolidFormView.js +2 -5
  13. package/dist/components/core/form/SolidFormView.js.map +1 -1
  14. package/dist/components/core/form/fields/ISolidField.d.ts +1 -2
  15. package/dist/components/core/form/fields/ISolidField.d.ts.map +1 -1
  16. package/dist/components/core/form/fields/SolidRelationField.d.ts +1 -1
  17. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.d.ts +1 -1
  18. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.d.ts.map +1 -1
  19. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js +14 -29
  20. package/dist/components/core/form/fields/relations/SolidRelationManyToOneField.js.map +1 -1
  21. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.d.ts.map +1 -1
  22. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js +18 -25
  23. package/dist/components/core/form/fields/relations/SolidRelationOneToManyField.js.map +1 -1
  24. package/dist/components/core/form/fields/widgets/SolidBooleanCheckboxFieldWidget.d.ts.map +1 -1
  25. package/dist/components/core/form/fields/widgets/SolidBooleanCheckboxFieldWidget.js +1 -0
  26. package/dist/components/core/form/fields/widgets/SolidBooleanCheckboxFieldWidget.js.map +1 -1
  27. package/dist/components/core/users/CreateUser.d.ts.map +1 -1
  28. package/dist/components/core/users/CreateUser.js +9 -3
  29. package/dist/components/core/users/CreateUser.js.map +1 -1
  30. package/dist/resources/globals.css +17 -69
  31. package/dist/resources/stylesheets/_menu.scss +0 -5
  32. package/dist/resources/themes/solid-dark-purple/theme.css +844 -741
  33. package/dist/resources/themes/solid-light-purple/theme.css +109 -3
  34. package/package.json +1 -1
  35. package/src/components/Svg/FileSvg.tsx +13 -12
  36. package/src/components/core/common/FilterComponent.tsx +3 -7
  37. package/src/components/core/common/SolidGlobalSearchElement.tsx +3 -2
  38. package/src/components/core/form/SolidFormView.tsx +2 -7
  39. package/src/components/core/form/fields/ISolidField.tsx +2 -3
  40. package/src/components/core/form/fields/relations/SolidRelationManyToOneField.tsx +6 -25
  41. package/src/components/core/form/fields/relations/SolidRelationOneToManyField.tsx +0 -3
  42. package/src/components/core/form/fields/widgets/SolidBooleanCheckboxFieldWidget.tsx +1 -0
  43. package/src/components/core/users/CreateUser.tsx +10 -6
  44. package/src/resources/globals.css +17 -69
  45. package/src/resources/stylesheets/_menu.scss +0 -5
  46. package/src/resources/themes/solid-dark-purple/theme.css +844 -741
  47. package/src/resources/themes/solid-light-purple/theme.css +109 -3
@@ -43,6 +43,7 @@
43
43
  --maskbg: rgba(0, 0, 0, 0.4);
44
44
  --primary-light-color: #D8E2EA;
45
45
  --highlight-bg: #F5F5F5;
46
+ --hightlight-bg-secondary: #FAFAFA;
46
47
  --highlight-text-color: #4C1D95;
47
48
  --icon-color: #000000E0;
48
49
  --auth-title-color: #000000;
@@ -59,6 +60,13 @@
59
60
  --solid-stepper-border: #CFD6DC;
60
61
  --solid-setting-title: rgba(0, 0, 0, 0.88);
61
62
  --solid-dark-title: rgba(0, 0, 0, 0.88);
63
+ --solid-dropzone-bg: rgba(255, 255, 255, 0.60);
64
+ --solid-file-wrapper: #E0E0E0;
65
+ --solid-chatter-dash: #00000026;
66
+ --solid-chatter-date-border: rgba(0, 0, 0, 0.15);
67
+ --solid-chatter-input-bg: #FEFCFF;
68
+ --solid-chatter-input-placeholder: rgba(51, 51, 51, 0.20);
69
+ --solid-kanban-wrapper: #E0E0E0;
62
70
  color-scheme: light;
63
71
  }
64
72
 
@@ -337,6 +345,7 @@
337
345
  /* box-shadow: 0 0 0 0.2rem #d3b5f5; */
338
346
  border-color: #722ED1;
339
347
  }
348
+
340
349
  .p-autocomplete .p-autocomplete-multiple-container .p-autocomplete-input-token input {
341
350
  font-family: var(--font-family);
342
351
  font-feature-settings: var(--font-feature-settings, normal);
@@ -1686,7 +1695,7 @@
1686
1695
  box-shadow: 0 0 0 0.2rem #d3b5f5;
1687
1696
  }
1688
1697
 
1689
-
1698
+
1690
1699
  .p-treeselect-panel .p-treeselect-items-wrapper .p-treeselect-empty-message {
1691
1700
  padding: 0.75rem 1.25rem;
1692
1701
  color: #4b5563;
@@ -3443,7 +3452,7 @@
3443
3452
  border-bottom: 0 none;
3444
3453
  }
3445
3454
 
3446
-
3455
+
3447
3456
  .p-picklist .p-picklist-filter-container .p-picklist-filter-icon {
3448
3457
  right: 0.75rem;
3449
3458
  color: #6b7280;
@@ -4546,7 +4555,7 @@
4546
4555
  border-top-left-radius: 6px;
4547
4556
  }
4548
4557
 
4549
-
4558
+
4550
4559
  .p-megamenu .p-submenu-list .p-menuitem-separator {
4551
4560
  border-top: 1px solid #CED0D6;
4552
4561
  margin: 0.25rem 0;
@@ -6126,4 +6135,101 @@
6126
6135
  .solid-custom-title {
6127
6136
  color: var(--solid-form-title);
6128
6137
  }
6138
+
6139
+
6140
+ .solid-global-search-element {
6141
+ border: 1px solid #d1d5db;
6142
+ }
6143
+
6144
+ .custom-filter-button {
6145
+ border-left: 1px solid #d1d5db;
6146
+ }
6147
+
6148
+ .solid-layout-accordion label {
6149
+ color: #000;
6150
+ }
6151
+
6152
+ .primary-filter-fieldset {
6153
+ background-color: #F8F7FC;
6154
+ }
6155
+
6156
+ .nested-custom-filter .primary-filter-fieldset {
6157
+ background-color: #FFF;
6158
+ }
6159
+
6160
+ .solid-column-panel.p-panel .p-panel-header {
6161
+ background: #F9F9F9;
6162
+ }
6163
+
6164
+ .solid-column-panel.p-panel .p-panel-header,
6165
+ .solid-column-panel.p-panel .p-panel-content {
6166
+ border: 1px solid rgba(216, 226, 234, 0.40);
6167
+ }
6168
+
6169
+ .form-field-label {
6170
+ color: rgba(0, 0, 0, 0.88) !important;
6171
+ }
6172
+
6173
+ .solid-standard-autocomplete .p-autocomplete-dropdown.p-button {
6174
+ background-color: #fff;
6175
+ border-color: #d1d5db;
6176
+ color: rgba(0, 0, 0, 0.60);
6177
+ }
6178
+
6179
+
6180
+ .solid-standard-autocomplete .p-inputtext:focus+.p-button {
6181
+ border-color: #d1d5db !important;
6182
+ }
6183
+
6184
+ .solid-custom-editor .ql-toolbar.ql-snow {
6185
+ border: 1px solid #d1d5db;
6186
+ }
6187
+
6188
+ .solid-custom-editor .ql-container.ql-snow {
6189
+ border: 1px solid #d1d5db;
6190
+ }
6191
+
6192
+ .view-widget-chip.p-chip {
6193
+ background-color: #f9f9f9 !important;
6194
+ }
6195
+
6196
+ .solid-step-button.p-button.p-button-text,
6197
+ .solid-step-button.p-button.p-button-text:not(:disabled):active,
6198
+ .solid-step-button.p-button.p-button-text:not(:disabled):hover,
6199
+ .solid-step-button.btn-step-first,
6200
+ .solid-step-button.btn-step-last {
6201
+ color: #0D0B26 !important;
6202
+ }
6203
+
6204
+ .active-menu-image {
6205
+ background-color: #EFF1F4;
6206
+ }
6207
+
6208
+ .solid-kanban-card,
6209
+ .solid-media-card {
6210
+ border: 1px solid var(--solid-kanban-wrapper);
6211
+ background: var(--hightlight-bg-secondary);
6212
+ }
6213
+
6214
+ .solid-kanban-card:hover,
6215
+ .solid-media-card:hover {
6216
+ border: 1px solid #722ED1;
6217
+ background: #F9F0FF;
6218
+ }
6219
+
6220
+
6221
+ .solid-mimetype-chip {
6222
+ background: #F0F0F0;
6223
+ }
6224
+
6225
+ .kanban-image-preview,
6226
+ .kanban-media-image-preview,
6227
+ .kanban-media-view-card {
6228
+ background-color: #fff;
6229
+ }
6230
+
6231
+ .kanban-count-badge {
6232
+ background: #F6FAFF;
6233
+ color: var(--primary-color);
6234
+ }
6129
6235
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solidstarters/solid-core-ui",
3
- "version": "1.1.65",
3
+ "version": "1.1.67",
4
4
  "scripts": {
5
5
  "prebuild": "npm run copy-styles",
6
6
  "build": "tsc && tsc-alias",
@@ -2,17 +2,18 @@ import * as React from "react"
2
2
  import { SVGProps } from "react"
3
3
  const FileSvg = (props: SVGProps<SVGSVGElement>) => (
4
4
  <svg
5
- xmlns="http://www.w3.org/2000/svg"
6
- width={64}
7
- height={64}
8
- fill="none"
9
- {...props}
10
- >
11
- <path
12
- fill="#F9F0FF"
13
- d="M36.03 25.291a2 2 0 0 1-2-2V6.271H16a6 6 0 0 0-6 6v40.08a6 6 0 0 0 6 6h31.06a6.01 6.01 0 0 0 6-6v-27.06H36.03Z"
14
- />
15
- <path fill="#722ED1" d="M51.88 21.291 38.03 7.441v13.85h13.85Z" />
16
- </svg>
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ width={64}
7
+ height={64}
8
+ fill="none"
9
+ {...props}
10
+ className="solid-file-reader"
11
+ >
12
+ <path
13
+ fill="#F9F0FF"
14
+ d="M36.03 25.291a2 2 0 0 1-2-2V6.271H16a6 6 0 0 0-6 6v40.08a6 6 0 0 0 6 6h31.06a6.01 6.01 0 0 0 6-6v-27.06H36.03Z"
15
+ />
16
+ <path fill="#722ED1" d="M51.88 21.291 38.03 7.441v13.85h13.85Z" />
17
+ </svg>
17
18
  )
18
19
  export default FileSvg
@@ -144,11 +144,7 @@ const FilterRuleComponent = ({ viewData, fields, rule, onChange, onAddRule, onAd
144
144
  <Button text severity='secondary' icon="pi pi-plus" size='small' onClick={() => onAddRule(rule.parentRule)} className='solid-filter-action-btn' />
145
145
  </div>
146
146
  <div className='col-4 px-0 flex align-items-center'>
147
- <Button text severity='secondary' icon={
148
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 20 20" fill="none">
149
- <path d="M11.6665 13.334H13.3332V11.6673H14.9998V10.0007H13.3332V8.33398H11.6665V10.0007H9.99984V11.6673H11.6665V13.334ZM3.33317 16.6673C2.87484 16.6673 2.48248 16.5041 2.15609 16.1777C1.8297 15.8513 1.6665 15.459 1.6665 15.0007V5.00065C1.6665 4.54232 1.8297 4.14996 2.15609 3.82357C2.48248 3.49718 2.87484 3.33398 3.33317 3.33398H8.33317L9.99984 5.00065H16.6665C17.1248 5.00065 17.5172 5.16385 17.8436 5.49023C18.17 5.81662 18.3332 6.20898 18.3332 6.66732V15.0007C18.3332 15.459 18.17 15.8513 17.8436 16.1777C17.5172 16.5041 17.1248 16.6673 16.6665 16.6673H3.33317ZM3.33317 15.0007H16.6665V6.66732H9.31234L7.64567 5.00065H3.33317V15.0007Z" fill="#4B4D52" />
150
- </svg>
151
- } size='small' onClick={() => onAddGroup(rule.id)} className='solid-filter-action-btn p-0' />
147
+ <Button text severity='secondary' icon={"pi pi-folder-plus"} size='small' onClick={() => onAddGroup(rule.id)} className='solid-filter-action-btn' />
152
148
  </div>
153
149
  <div className='col-4 px-0 flex align-items-center'>
154
150
  <Button text severity='secondary' icon="pi pi-trash" size='small' onClick={() => onDelete(rule.id)} className='solid-filter-action-btn' />
@@ -352,7 +348,7 @@ const FilterComponent = ({ viewData, fields, filterRules, setFilterRules, transf
352
348
  // };
353
349
 
354
350
 
355
- const removeEmptyGroups = (rule) => {
351
+ const removeEmptyGroups = (rule) => {
356
352
  if (rule.type === "rule_group" && rule.children.length === 0) {
357
353
  return null;
358
354
  }
@@ -366,7 +362,7 @@ const FilterComponent = ({ viewData, fields, filterRules, setFilterRules, transf
366
362
 
367
363
 
368
364
  const handleDeleteRule = (id) => {
369
- if(filterRules[0].children.length === 1 && filterRules[0].children[0].id === id ){
365
+ if (filterRules[0].children.length === 1 && filterRules[0].children[0].id === id) {
370
366
  return
371
367
  }
372
368
  const deleteRecursively = (rules, id, isRoot = false) => {
@@ -699,6 +699,7 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
699
699
  </>
700
700
  );
701
701
 
702
+
702
703
  const [showOverlay, setShowOverlay] = useState(false);
703
704
 
704
705
  return (
@@ -741,7 +742,7 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
741
742
  </div>
742
743
 
743
744
  {showOverlay && (
744
- <div className="absolute w-full z-5 bg-white border-round border-1 border-300 shadow-2" style={{ top: 35 }}>
745
+ <div className="absolute w-full z-5 surface-0 border-round border-1 border-300 shadow-2" style={{ top: 35 }}>
745
746
  {inputValue ? (
746
747
  <>
747
748
  <div className="custom-filter-search-options px-2 py-2 flex flex-column">
@@ -756,7 +757,7 @@ export const SolidGlobalSearchElement = forwardRef(({ viewData, handleApplyCusto
756
757
  size="small"
757
758
  >
758
759
  Search <strong>{value}</strong> for :
759
- <span className="font-bold" style={{ color: '#000' }}>{inputValue}</span>
760
+ <span className="font-bold text-color">{inputValue}</span>
760
761
  </Button>
761
762
  ))
762
763
  }
@@ -59,7 +59,6 @@ export type SolidFormViewProps = {
59
59
  customCreateHandler?: any
60
60
  inlineCreateAutoSave?: boolean,
61
61
  customLayout?: any,
62
- populateData?: any,
63
62
  };
64
63
 
65
64
 
@@ -151,7 +150,7 @@ const fieldFactory = (type: string, fieldContext: SolidFieldProps, setLightboxUr
151
150
  }
152
151
 
153
152
  // solidFieldsMetadata={solidFieldsMetadata} solidView={solidView}
154
- const SolidField = ({ formik, field, fieldMetadata, initialEntityData, solidFormViewMetaData, modelName, readOnly, viewMode, onChange, onBlur, populateData, setLightboxUrls, setOpenLightbox }: any) => {
153
+ const SolidField = ({ formik, field, fieldMetadata, initialEntityData, solidFormViewMetaData, modelName, readOnly, viewMode, onChange, onBlur, setLightboxUrls, setOpenLightbox }: any) => {
155
154
  const fieldContext: SolidFieldProps = {
156
155
  // field metadata - coming from the field-metadata table.
157
156
  fieldMetadata: fieldMetadata,
@@ -167,9 +166,6 @@ const SolidField = ({ formik, field, fieldMetadata, initialEntityData, solidForm
167
166
  onChange: onChange,
168
167
  onBlur: onBlur
169
168
  }
170
- if (populateData) {
171
- fieldContext.populateData = populateData;
172
- }
173
169
  const solidField = fieldFactory(fieldMetadata?.type, fieldContext, setLightboxUrls, setOpenLightbox);
174
170
 
175
171
  return solidField?.render(formik);
@@ -944,14 +940,13 @@ const SolidFormView = (params: SolidFormViewProps) => {
944
940
  field={element}
945
941
  formik={formik}
946
942
  fieldMetadata={fieldMetadata}
947
- initialEntityData={solidFormViewData ? solidFormViewData.data : {}}
943
+ initialEntityData={solidFormViewData ? solidFormViewData.data : null}
948
944
  solidFormViewMetaData={solidFormViewMetaData}
949
945
  modelName={params.modelName}
950
946
  readOnly={readOnlyPermission}
951
947
  viewMode={viewMode}
952
948
  onChange={formFieldOnXXX}
953
949
  onBlur={formFieldOnXXX}
954
- populateData={params.populateData}
955
950
  setLightboxUrls={setLightboxUrls}
956
951
  setOpenLightbox={setOpenLightbox}
957
952
  />;
@@ -11,8 +11,7 @@ export type SolidFieldProps = {
11
11
  readOnly?: any,
12
12
  viewMode? :any
13
13
  onChange?: any,
14
- onBlur?: any,
15
- populateData?: any
14
+ onBlur?: any
16
15
  };
17
16
 
18
17
  export type FormikObject = {
@@ -65,6 +64,6 @@ export type FormikObject = {
65
64
  export interface ISolidField {
66
65
  initialValue(): any;
67
66
  validationSchema(): Schema;
68
- render(formik: FormikObject): React.JSX.Element | null;
67
+ render(formik: FormikObject): React.JSX.Element;
69
68
  updateFormData(value: any, formData: FormData): any;
70
69
  }
@@ -3,7 +3,7 @@ import { createSolidEntityApi } from "@/redux/api/solidEntityApi";
3
3
  import { AutoComplete, AutoCompleteCompleteEvent } from "primereact/autocomplete";
4
4
  import { Message } from "primereact/message";
5
5
  import qs from "qs";
6
- import { useState, useEffect } from "react";
6
+ import { useState } from "react";
7
7
  import * as Yup from 'yup';
8
8
  import { Schema } from "yup";
9
9
  import { FormikObject, ISolidField, SolidFieldProps } from "../ISolidField";
@@ -25,22 +25,15 @@ export class SolidRelationManyToOneField implements ISolidField {
25
25
  }
26
26
 
27
27
  initialValue(): any {
28
- const manyToOneFieldData = this.fieldContext?.data[this.fieldContext?.field?.attrs?.name];
29
- const fieldMetadata = this.fieldContext?.fieldMetadata;
28
+
29
+ const manyToOneFieldData = this.fieldContext.data[this.fieldContext.field.attrs.name];
30
+ const fieldMetadata = this.fieldContext.fieldMetadata;
30
31
  const userKeyField = fieldMetadata?.relationModel?.userKeyField?.name;
31
32
  const manyToOneColVal = manyToOneFieldData ? manyToOneFieldData[userKeyField] : '';
32
33
  if (manyToOneColVal) {
33
34
  return { label: manyToOneColVal || '', value: manyToOneFieldData?.id || '' };
34
35
  }
35
-
36
- if (this.fieldContext.populateData) {
37
- const [key, value]: any = Object.entries(this.fieldContext.populateData)[0] || [];
38
- if (key && value !== undefined) {
39
- return { label: value.label, value: value.value };
40
- }
41
- }
42
-
43
- return {};
36
+ return {}
44
37
  }
45
38
 
46
39
  updateFormData(value: any, formData: FormData): any {
@@ -75,19 +68,7 @@ export class SolidRelationManyToOneField implements ISolidField {
75
68
  const readOnlyPermission = this.fieldContext.readOnly;
76
69
  const [visibleCreateRelationEntity, setvisibleCreateRelationEntity] = useState(false);
77
70
 
78
- useEffect(() => {
79
- const newValue = this.initialValue();
80
- if (this.fieldContext.populateData) {
81
- formik.setFieldValue(fieldLayoutInfo.attrs.name, newValue);
82
- }
83
- }, [this.fieldContext.populateData]);
84
-
85
- const isVisible = fieldLayoutInfo.attrs?.visible !== false && !this.fieldContext.populateData;
86
-
87
- if (!isVisible) {
88
- return null;
89
- }
90
-
71
+ // auto complete specific code.
91
72
  const entityApi = createSolidEntityApi(fieldMetadata.relationCoModelSingularName);
92
73
  const { useLazyGetSolidEntitiesQuery } = entityApi;
93
74
  const [triggerGetSolidEntities] = useLazyGetSolidEntitiesQuery();
@@ -68,7 +68,6 @@ export class SolidRelationOneToManyField implements ISolidField {
68
68
  const readOnlyPermission = this.fieldContext.readOnly;
69
69
  const pathname = usePathname();
70
70
  const lastPathSegment = pathname.split('/').pop();
71
- const userKeyField: any = Object.entries(this.fieldContext.solidFormViewMetaData.data.solidFieldsMetadata).find(([_, value]: any) => value.isUserKey)?.[0];
72
71
 
73
72
  const handlePopupOpen = (id: any) => {
74
73
  const formviewparams = {
@@ -77,7 +76,6 @@ export class SolidRelationOneToManyField implements ISolidField {
77
76
  embeded: true,
78
77
  isCustomCreate: false,
79
78
  customLayout: fieldLayoutInfo?.attrs?.inlineCreateLayout,
80
- populateData: userKeyField ? {[userKeyField] : {label: this.fieldContext.data[userKeyField], value: this.fieldContext.data['id']}} : {},
81
79
  modelName: camelCase(this.fieldContext.fieldMetadata.relationCoModelSingularName)
82
80
  }
83
81
  setformViewParams(formviewparams);
@@ -132,7 +130,6 @@ export class SolidRelationOneToManyField implements ISolidField {
132
130
  embeded: true,
133
131
  isCustomCreate: false,
134
132
  customLayout: fieldLayoutInfo?.attrs?.inlineCreateLayout,
135
- populateData: userKeyField ? {[userKeyField] : {label: this.fieldContext.data[userKeyField], value: this.fieldContext.data['id']}} : {},
136
133
  modelName: camelCase(this.fieldContext.fieldMetadata.relationCoModelSingularName),
137
134
  }
138
135
  setformViewParams(formviewparams)
@@ -17,6 +17,7 @@ export const SolidBooleanFieldCheckboxWidget = ({ formik, fieldContext }: SolidB
17
17
  // Set default value to false on mount
18
18
  useEffect(() => {
19
19
  if (formik.values[fieldLayoutInfo.attrs.name] === undefined) {
20
+ console.log("Setting default value:", false);
20
21
  formik.setFieldValue(fieldLayoutInfo.attrs.name, false);
21
22
  }
22
23
  }, []);
@@ -70,11 +70,15 @@ const CreateUser = ({ data, params }: any) => {
70
70
  }, [data]);
71
71
 
72
72
  const handleCheckboxChange = (roleName: string) => {
73
+ let updatedRoles;
73
74
  if (selectedRoles.includes(roleName)) {
74
- setSelectedRoles(selectedRoles.filter((name) => name !== roleName));
75
+ updatedRoles = selectedRoles.filter((name) => name !== roleName);
75
76
  } else {
76
- setSelectedRoles([...selectedRoles, roleName]);
77
+ updatedRoles = [...selectedRoles, roleName];
77
78
  }
79
+ setSelectedRoles(updatedRoles);
80
+ formik.setFieldTouched('roles', true); // fake "touched"
81
+ formik.setFieldValue('roles', updatedRoles);
78
82
  };
79
83
 
80
84
  const initialValues = {
@@ -244,9 +248,9 @@ const CreateUser = ({ data, params }: any) => {
244
248
  <div className="form-wrapper-title">Create User</div>
245
249
  </div>
246
250
  <div className="gap-3 flex">
247
- {/* {formik.dirty && */}
251
+ {formik.dirty &&
248
252
  <Button label="Save" size="small" type="submit" />
249
- {/* } */}
253
+ }
250
254
  <CancelButton />
251
255
  </div>
252
256
  </>
@@ -258,9 +262,9 @@ const CreateUser = ({ data, params }: any) => {
258
262
  </div>
259
263
  <div>
260
264
  <div className="gap-3 flex">
261
- {/* {formik.dirty && */}
265
+ {formik.dirty &&
262
266
  <Button label="Save" size="small" type="submit" />
263
- {/* } */}
267
+ }
264
268
  {data &&
265
269
  <Button outlined label="Delete" size="small" severity="danger" type="button" onClick={() => deleteUser(data.id)} />
266
270
  }