@genesislcap/blank-app-seed 5.2.0-prerelease.15 → 5.2.0-prerelease.16

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/blank-app-seed-config",
3
3
  "description": "Genesis Blank App Seed Configuration",
4
- "version": "5.2.0-prerelease.15",
4
+ "version": "5.2.0-prerelease.16",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "lint": "eslint .",
@@ -1,8 +1,9 @@
1
1
  import { CustomEventHandler } from "../../../utils/customEvents";
2
+ import { UiSchema } from '@genesislcap/foundation-forms';
2
3
 
3
4
  {{#each tile.config.customEvents}}
4
5
  {{#if this.hasForm}}
5
- export const {{camelCase this.name}}FormSchema = {{{this.uischema}}};
6
+ export const {{camelCase this.name}}FormSchema: UiSchema = {{{this.uischema}}};
6
7
  {{/if}}
7
8
  {{/each}}
8
9
 
@@ -19,9 +19,9 @@ import { createPortal } from 'react-dom';
19
19
  import { getConnect } from '@genesislcap/foundation-comms';
20
20
  import type { ActionRendererParams } from '@genesislcap/rapid-grid-pro';
21
21
  import { RapidAgActionRenderer } from '@genesislcap/rapid-grid-pro';
22
- import { Modal } from '@genesislcap/rapid-design-system';
22
+ import { UiSchema } from '@genesislcap/foundation-forms';
23
23
  import { customEvents, customEventFormSchemas } from './{{pascalCase tile.title}}EventsConfig';
24
- import { useCustomEvent, type CustomEventHandler, type CustomEventState } from '../../../utils/customEvents';
24
+ import { useCustomEvent, type CustomEventState } from '../../../utils/customEvents';
25
25
  {{/if}}
26
26
  {{#if tile.config.createFormUiSchema~}}
27
27
  import { createFormSchema as createFormSchemaTile } from './{{pascalCase tile.title}}CreateFormSchema';
@@ -80,22 +80,28 @@ export const {{pascalCase tile.componentName}}: React.FC = () => {
80
80
  maxWidth: 50,
81
81
  headerTooltip: '{{this.tooltip}}',
82
82
  pinned: 'right',
83
+ suppressCellFlash: true,
83
84
  cellRenderer: RapidAgActionRenderer,
84
85
  cellRendererParams: {
85
86
  actionClick: async (rowData) => {
87
+ setIsModalVisible(false);
88
+
86
89
  const customEvent = customEvents.find(e => e.name === '{{this.name}}');
87
90
  if (customEvent) {
88
91
  const handleCustomEvent = useCustomEvent(
89
92
  customEvent,
90
93
  rowData,
91
94
  setCustomEventFormData,
92
- setActiveCustomEvent
95
+ setActiveCustomEvent,
96
+ setResourceName,
97
+ setUiSchema,
98
+ customEventFormSchemas
93
99
  );
94
100
  await handleCustomEvent();
95
101
  }
96
102
  },
97
103
  contentTemplate: `
98
- <rapid-icon name="{{this.icon}}"></rapid-icon>
104
+ <rapid-icon name="{{this.icon}}" title="{{this.name}}"></rapid-icon>
99
105
  `,
100
106
  } as ActionRendererParams,
101
107
  },
@@ -132,63 +138,31 @@ export const {{pascalCase tile.componentName}}: React.FC = () => {
132
138
  {{/if}}
133
139
 
134
140
  {{#if tile.config.customEvents}}
135
- const customEventModalRef = useRef<Modal>(null);
136
141
  const [activeCustomEvent, setActiveCustomEvent] = useState<CustomEventState | null>(null);
137
142
  const [customEventFormData, setCustomEventFormData] = useState<Record<string, any>>({});
143
+ const [resourceName, setResourceName] = useState<string>('');
144
+ const [uiSchema, setUiSchema] = useState<UiSchema | null>(null);
145
+ const [isModalVisible, setIsModalVisible] = useState<boolean>(false);
138
146
 
139
147
  useEffect(() => {
140
148
  if (activeCustomEvent) {
141
- customEventModalRef.current?.show();
142
- } else {
143
- customEventModalRef.current?.close();
149
+ setIsModalVisible(true);
144
150
  }
145
151
  }, [activeCustomEvent]);
146
152
 
147
- const handleCustomEventSubmit = () => {
148
- setActiveCustomEvent(null);
149
- setCustomEventFormData({});
150
- };
151
-
152
- const getActiveCustomEvent = () => {
153
- if (!activeCustomEvent) return null;
154
- return customEvents.find(e => e.name === activeCustomEvent.name);
155
- };
156
-
157
- const getCustomEventModalTitle = () => {
158
- const customEvent = getActiveCustomEvent();
159
- return customEvent?.name || 'Custom Event';
160
- };
161
-
162
- const getCustomEventResourceName = () => {
163
- if (!activeCustomEvent) return '';
164
- return `EVENT_${activeCustomEvent.event}`;
165
- };
166
-
167
- const getCustomEventUiSchema = () => {
168
- const customEvent = getActiveCustomEvent();
169
- return customEvent && customEvent.name in customEventFormSchemas
170
- ? customEventFormSchemas[customEvent.name as keyof typeof customEventFormSchemas]
171
- : null;
172
- };
173
-
174
153
  const renderFormModal = () => {
175
154
  if (!activeCustomEvent) return null;
176
155
 
177
156
  return createPortal(
178
- <rapid-modal
179
- ref={customEventModalRef}
180
- onCloseCallback={() => setActiveCustomEvent(null)}
181
- >
182
- <h4 slot="top">{getCustomEventModalTitle()}</h4>
183
- <foundation-form
184
- resourceName={getCustomEventResourceName()}
185
- uischema={getCustomEventUiSchema()}
186
- data={customEventFormData}
187
- onsubmit-success={handleCustomEventSubmit}
188
- onsubmit={submitFailureNotification}
189
- onsubmit-failure={submitFailureNotification}
190
- ></foundation-form>
191
- </rapid-modal>,
157
+ <smart-form-modal
158
+ entityLabel="{{ tile.config.entityName }}"
159
+ modal-position="{{ tile.config.modalPosition }}"
160
+ modalFormType={isModalVisible && 'update'}
161
+ editModalVisible={isModalVisible}
162
+ formResourceName={resourceName}
163
+ formUiSchema={uiSchema}
164
+ editedEntity={customEventFormData}
165
+ ></smart-form-modal>,
192
166
  document.querySelector('rapid-design-system-provider')!
193
167
  );
194
168
  };
@@ -49,6 +49,9 @@ hasUserPermission('{{config.permissions.viewRight}}') ? (
49
49
  {{#if config.columns~}}
50
50
  columns={columnDefs}
51
51
  {{/if}}
52
+ {{#if config.entityName}}
53
+ entityLabel="{{ config.entityName }}"
54
+ {{/if}}
52
55
  {{#if config.modalPosition~}}
53
56
  modal-position="{{ config.modalPosition }}"
54
57
  {{/if}}
@@ -10,7 +10,6 @@ import { ColDef } from '@ag-grid-community/core';
10
10
  {{#if tile.config.customEvents}}
11
11
  import type { ActionRendererParams } from '@genesislcap/rapid-grid-pro';
12
12
  import { RapidAgActionRenderer } from '@genesislcap/rapid-grid-pro';
13
- import { Modal } from '@genesislcap/rapid-design-system';
14
13
  import { customEvents, customEventFormSchemas } from './{{kebabCase tile.title}}.events.config';
15
14
  import { handleFormCustomEvent, handleNonFormCustomEvent, showCustomEventConfirmation, type CustomEventHandler, type CustomEventState } from '../../../utils/customEvents';
16
15
  {{/if}}
@@ -34,35 +33,24 @@ export class {{pascalCase tile.componentName}} extends GenesisElement {
34
33
  @Connect connect!: Connect;
35
34
 
36
35
  {{#if tile.config.customEvents}}
37
- customEventModal: Modal;
38
36
  @observable customEvents: CustomEventHandler[] = customEvents;
39
37
  @observable activeCustomEvent: CustomEventState | null = null;
40
38
  @observable customEventFormData: Record<string, any> = {};
41
39
 
42
- async handleCustomEventSubmit() {
43
- this.activeCustomEvent = null;
44
- this.customEventFormData = {};
45
- this.customEventModal.close();
46
- }
47
-
48
40
  async handleCustomEventClick(eventName: string, rowData: any) {
49
- const customEvent = this.customEvents.find(e => e.name === eventName);
41
+ const customEvent = this.customEvents.find((e) => e.name === eventName);
50
42
  if (!customEvent) return;
51
43
 
52
44
  if (customEvent.hasForm) {
53
45
  handleFormCustomEvent(
54
46
  customEvent,
55
47
  rowData,
56
- (data) => this.customEventFormData = data,
57
- (event) => this.activeCustomEvent = event,
58
- () => this.customEventModal.show()
48
+ (data) => (this.customEventFormData = data),
49
+ (event) => (this.activeCustomEvent = event),
59
50
  );
60
51
  } else {
61
- await handleNonFormCustomEvent(
62
- this.connect,
63
- customEvent,
64
- rowData,
65
- (onConfirm) => showCustomEventConfirmation(customEvent, onConfirm)
52
+ await handleNonFormCustomEvent(this.connect, customEvent, rowData, (onConfirm) =>
53
+ showCustomEventConfirmation(customEvent, onConfirm),
66
54
  );
67
55
  }
68
56
  }
@@ -72,11 +60,6 @@ export class {{pascalCase tile.componentName}} extends GenesisElement {
72
60
  return this.customEvents.find(e => e.name === this.activeCustomEvent.name);
73
61
  }
74
62
 
75
- getCustomEventModalTitle() {
76
- const customEvent = this.getActiveCustomEvent();
77
- return customEvent?.name || 'Custom Event';
78
- }
79
-
80
63
  getCustomEventResourceName() {
81
64
  if (!this.activeCustomEvent) return '';
82
65
  return `EVENT_${this.activeCustomEvent.event}`;
@@ -100,13 +83,14 @@ export class {{pascalCase tile.componentName}} extends GenesisElement {
100
83
  maxWidth: 50,
101
84
  headerTooltip: '{{this.tooltip}}',
102
85
  pinned: 'right',
86
+ suppressCellFlash: true,
103
87
  cellRenderer: RapidAgActionRenderer,
104
88
  cellRendererParams: <ActionRendererParams>{
105
89
  actionClick: async (rowData) => {
106
90
  await this.handleCustomEventClick('{{this.name}}', rowData);
107
91
  },
108
92
  contentTemplate: `
109
- <rapid-icon name="{{this.icon}}"></rapid-icon>
93
+ <rapid-icon name="{{this.icon}}" title="{{this.name}}"></rapid-icon>
110
94
  `,
111
95
  },
112
96
  },
@@ -1,8 +1,5 @@
1
- import { html, when, whenElse, ref, repeat } from '@genesislcap/web-core';
2
- {{#if tile.config.customEvents}}
3
- import { customEvent } from '@genesislcap/foundation-events';
4
- {{/if}}
5
- import { getViewUpdateRightComponent{{#if tile.config.customEvents}}, submitFailureNotification{{/if}} } from '../../../utils';
1
+ import { html, whenElse, repeat } from '@genesislcap/web-core';
2
+ import { getViewUpdateRightComponent } from '../../../utils';
6
3
  import type { {{pascalCase tile.componentName}} } from './{{kebabCase tile.title}}';
7
4
  {{#if tile.config.createFormUiSchema}}
8
5
  import { createFormSchema } from './{{kebabCase tile.title}}.create.form.schema';
@@ -51,25 +51,15 @@ ${whenElse(
51
51
  {{/if}}
52
52
  ></entity-management>
53
53
  {{#if config.customEvents}}
54
- <rapid-modal
55
- ${ref('customEventModal')}
56
- :onCloseCallback=${(x) => (x.activeCustomEvent = null)}
57
- >
58
- <h4 slot="top">${(x) => x.getCustomEventModalTitle()}</h4>
59
- ${when(
60
- (x) => x.activeCustomEvent,
61
- html`
62
- <foundation-form
63
- resourceName=${(x) => x.getCustomEventResourceName()}
64
- :uischema=${(x) => x.getCustomEventUiSchema()}
65
- :data=${(x) => x.customEventFormData}
66
- @submit-success=${(x) => x.handleCustomEventSubmit()}
67
- @submit=${(_, c) => submitFailureNotification(customEvent(c))}
68
- @submit-failure=${(_, c) => submitFailureNotification(customEvent(c))}
69
- ></foundation-form>
70
- `,
71
- )}
72
- </rapid-modal>
54
+ <smart-form-modal
55
+ entityLabel="{{ config.entityName }}"
56
+ modal-position="{{ config.modalPosition }}"
57
+ :modalFormType=${(x) => !!x.activeCustomEvent && 'update'}
58
+ :editModalVisible=${(x) => !!x.activeCustomEvent}
59
+ :formResourceName=${(x) => x.getCustomEventResourceName()}
60
+ :formUiSchema=${(x) => x.getCustomEventUiSchema()}
61
+ :editedEntity=${(x) => x.customEventFormData}
62
+ ></smart-form-modal>
73
63
  {{/if}}
74
64
  `,
75
65
  html`
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [5.2.0-prerelease.16](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v5.2.0-prerelease.15...v5.2.0-prerelease.16) (2025-07-10)
4
+
5
+
6
+ ### Features
7
+
8
+ * smart-form-modal react GENC-1162 d82bf2b
9
+ * use smart-form-modal GENC-1162 (#485) 744ad5b
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * update type for customEventFormSchemas GENC-1162 9985837
15
+ * use smart-form-modal GENC-1162 d4d112f
16
+
3
17
  ## [5.2.0-prerelease.15](https://github.com/genesiscommunitysuccess/blank-app-seed/compare/v5.2.0-prerelease.14...v5.2.0-prerelease.15) (2025-07-09)
4
18
 
5
19
 
@@ -44,12 +44,16 @@
44
44
  {{#if FDC3.includeDependencies}}
45
45
  "@genesislcap/foundation-fdc3": "{{versions.UI}}",
46
46
  {{/if}}
47
+ "@genesislcap/foundation-events": "{{versions.UI}}",
48
+ "@genesislcap/foundation-forms": "{{versions.UI}}",
47
49
  "@genesislcap/foundation-header": "{{versions.UI}}",
48
50
  "@genesislcap/foundation-layout": "{{versions.UI}}",
49
51
  "@genesislcap/foundation-logger": "{{versions.UI}}",
50
52
  "@genesislcap/foundation-login": "{{versions.UI}}",
53
+ "@genesislcap/foundation-notifications": "{{versions.UI}}",
51
54
  "@genesislcap/foundation-shell": "{{versions.UI}}",
52
55
  "@genesislcap/foundation-ui": "{{versions.UI}}",
56
+ "@genesislcap/foundation-user": "{{versions.UI}}",
53
57
  "@genesislcap/foundation-utils": "{{versions.UI}}",
54
58
  "@genesislcap/foundation-zero-grid-tabulator": "{{versions.UI}}",
55
59
  "@genesislcap/rapid-design-system": "{{versions.UI}}",
@@ -8,6 +8,7 @@ declare module "react/jsx-runtime" {
8
8
  'rapid-design-system-provider': CustomElement;
9
9
  'entity-management': CustomElement;
10
10
  'foundation-form': CustomElement;
11
+ 'smart-form-modal': CustomElement;
11
12
  'rapid-grid-pro': CustomElement;
12
13
  'grid-pro-genesis-datasource': CustomElement;
13
14
  'grid-pro-column': CustomElement;
@@ -1,4 +1,4 @@
1
- import { EntityManagement } from '@genesislcap/foundation-entity-management';
1
+ import { EntityManagement, SmartFormModal } from '@genesislcap/foundation-entity-management';
2
2
  import { Form } from '@genesislcap/foundation-forms';
3
3
  import { foundationLayoutComponents } from '@genesislcap/foundation-layout';
4
4
  import { getApp } from '@genesislcap/foundation-shell/app';
@@ -13,6 +13,7 @@ import { FoundationRouter } from '@genesislcap/foundation-ui';
13
13
  FoundationRouter;
14
14
  EntityManagement;
15
15
  Form;
16
+ SmartFormModal;
16
17
 
17
18
  /**
18
19
  * registerComponents.
@@ -1,4 +1,5 @@
1
1
  import { getConnect } from '@genesislcap/foundation-comms';
2
+ import { UiSchema } from '@genesislcap/foundation-forms';
2
3
  import { showNotification, showNotificationDialog } from '@genesislcap/foundation-notifications';
3
4
 
4
5
  interface ConfirmSubmit {
@@ -150,7 +151,10 @@ export const useCustomEvent =
150
151
  customEvent: CustomEventHandler,
151
152
  rowData: any,
152
153
  setFormData: (data: Record<string, any>) => void,
153
- setActiveEvent: (event: CustomEventState | null) => void
154
+ setActiveEvent: (event: CustomEventState | null) => void,
155
+ setResourceName?: (name: string) => void,
156
+ setUiSchema?: (schema: UiSchema) => void,
157
+ customEventFormSchemas?: Record<string, UiSchema>
154
158
  ) =>
155
159
  async () => {
156
160
  if (customEvent.hasForm) {
@@ -162,6 +166,15 @@ export const useCustomEvent =
162
166
  event: customEvent.baseEvent,
163
167
  rowData,
164
168
  });
169
+
170
+ if (setResourceName) {
171
+ setResourceName(`EVENT_${customEvent.baseEvent}`);
172
+ }
173
+
174
+ if (setUiSchema && customEventFormSchemas) {
175
+ const uiSchema = customEventFormSchemas[customEvent.name];
176
+ setUiSchema(uiSchema || null);
177
+ }
165
178
  } else {
166
179
  if (customEvent.confirmSubmit?.state === 'enabled') {
167
180
  showCustomEventConfirmation(customEvent, () =>
@@ -1,4 +1,4 @@
1
- import { EntityManagement } from '@genesislcap/foundation-entity-management';
1
+ import { EntityManagement, SmartFormModal } from '@genesislcap/foundation-entity-management';
2
2
  import { Form } from '@genesislcap/foundation-forms';
3
3
  import { foundationLayoutComponents } from '@genesislcap/foundation-layout';
4
4
  import { getApp } from '@genesislcap/foundation-shell/app';
@@ -16,6 +16,7 @@ FoundationRouter;
16
16
  EntityManagement;
17
17
  Form;
18
18
  NotPermittedComponent;
19
+ SmartFormModal;
19
20
 
20
21
  /**
21
22
  * registerComponents.
@@ -144,14 +144,12 @@ export const handleFormCustomEvent = (
144
144
  rowData: any,
145
145
  setFormData: (data: Record<string, any>) => void,
146
146
  setActiveEvent: (event: CustomEventState) => void,
147
- showModal: () => void,
148
147
  ): void => {
149
148
  const defaultValues = customEvent.defaultValues || {};
150
149
  const formData = mapDefaultValues(defaultValues, rowData);
151
150
 
152
151
  setFormData(formData);
153
152
  setActiveEvent({ name: customEvent.name, event: customEvent.baseEvent, rowData });
154
- showModal();
155
153
  };
156
154
 
157
155
  export const handleNonFormCustomEvent = async (
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@genesislcap/blank-app-seed",
3
3
  "description": "Genesis Blank App Seed",
4
- "version": "5.2.0-prerelease.15",
4
+ "version": "5.2.0-prerelease.16",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
7
7
  "release": "semantic-release"