impaktapps-ui-builder 0.0.974 → 0.0.1051

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 (45) hide show
  1. package/dist/impaktapps-ui-builder.es.js +1391 -1366
  2. package/dist/impaktapps-ui-builder.es.js.map +1 -1
  3. package/dist/impaktapps-ui-builder.umd.js +11 -11
  4. package/dist/impaktapps-ui-builder.umd.js.map +1 -1
  5. package/dist/src/impaktapps-ui-builder/builder/build/buildThoughtOfTheDay.d.ts +1 -0
  6. package/dist/src/impaktapps-ui-builder/builder/build/uischema/button.d.ts +0 -1
  7. package/dist/src/impaktapps-ui-builder/builder/build/uischema/card.d.ts +90 -23
  8. package/dist/src/impaktapps-ui-builder/builder/build/uischema/graph.d.ts +50 -23
  9. package/dist/src/impaktapps-ui-builder/builder/build/uischema/leaderBoard.d.ts +10 -301
  10. package/dist/src/impaktapps-ui-builder/builder/build/uischema/progressBar.d.ts +6 -1
  11. package/dist/src/impaktapps-ui-builder/builder/build/uischema/thoughtOfTheDay.d.ts +17 -0
  12. package/dist/src/impaktapps-ui-builder/builder/build/uischema/timer.d.ts +1 -14
  13. package/dist/src/impaktapps-ui-builder/builder/services/utils.d.ts +1 -1
  14. package/package.json +5 -1
  15. package/src/impaktapps-ui-builder/builder/build/buildCard.ts +7 -3
  16. package/src/impaktapps-ui-builder/builder/build/buildConfig.ts +1 -1
  17. package/src/impaktapps-ui-builder/builder/build/buildHorizontalBarGraph.ts +43 -44
  18. package/src/impaktapps-ui-builder/builder/build/buildInputSlider.ts +1 -1
  19. package/src/impaktapps-ui-builder/builder/build/buildLeaderboard.ts +18 -13
  20. package/src/impaktapps-ui-builder/builder/build/buildLineGraph.ts +10 -11
  21. package/src/impaktapps-ui-builder/builder/build/buildPieGraph.ts +4 -15
  22. package/src/impaktapps-ui-builder/builder/build/buildRankCard.ts +4 -10
  23. package/src/impaktapps-ui-builder/builder/build/buildStackBarGraph.ts +16 -13
  24. package/src/impaktapps-ui-builder/builder/build/buildText.ts +21 -18
  25. package/src/impaktapps-ui-builder/builder/build/buildThoughtOfTheDay.ts +22 -0
  26. package/src/impaktapps-ui-builder/builder/build/buildUiSchema.ts +14 -6
  27. package/src/impaktapps-ui-builder/builder/build/uischema/buildPropertiesSection.ts +18 -13
  28. package/src/impaktapps-ui-builder/builder/build/uischema/button.ts +0 -1
  29. package/src/impaktapps-ui-builder/builder/build/uischema/card.ts +102 -46
  30. package/src/impaktapps-ui-builder/builder/build/uischema/graph.ts +13 -28
  31. package/src/impaktapps-ui-builder/builder/build/uischema/leaderBoard.ts +10 -366
  32. package/src/impaktapps-ui-builder/builder/build/uischema/progressBar.ts +1 -1
  33. package/src/impaktapps-ui-builder/builder/build/uischema/rankCard.ts +1 -1
  34. package/src/impaktapps-ui-builder/builder/build/uischema/runnerBoyProgressBar.ts +1 -1
  35. package/src/impaktapps-ui-builder/builder/build/uischema/thoughtOfTheDay.ts +14 -0
  36. package/src/impaktapps-ui-builder/builder/build/uischema/timer.ts +2 -16
  37. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/schema.ts +1 -0
  38. package/src/impaktapps-ui-builder/builder/elements/UiSchema/Component/uiSchema.ts +581 -487
  39. package/src/impaktapps-ui-builder/builder/elements/UiSchema/PageMaster/uiSchema.ts +177 -111
  40. package/src/impaktapps-ui-builder/builder/elements/UiSchema/event/uiSchema.ts +90 -59
  41. package/src/impaktapps-ui-builder/builder/services/component.ts +127 -30
  42. package/src/impaktapps-ui-builder/builder/services/event.ts +1 -1
  43. package/src/impaktapps-ui-builder/builder/services/utils.ts +2 -2
  44. package/src/impaktapps-ui-builder/runtime/services/events.ts +32 -21
  45. package/src/impaktapps-ui-builder/runtime/services/service.ts +5 -4
@@ -38,11 +38,13 @@ const sectionLabels = {
38
38
  DataGrid: ["Core", "Components", "Properties", "Event", "Style"],
39
39
  InputSlider: ["Core", "Properties", "Event", "Style", "Validation"],
40
40
  TreeMap: ["Core", "Components", "Properties", "Event", "Style"],
41
- ColumnGroup: ["Core", "Components"]
41
+ ColumnGroup: ["Core", "Components"],
42
+ Thought: ["Core", "Properties", "Event", "Style", "Validation"]
42
43
  }
43
44
 
44
- export function refreshPage (type: string, store: any) {
45
+ export function refreshPage(type: string, store: any) {
45
46
  const UiSchema = _.cloneDeep(componentBasicUiSchema(store.theme.myTheme))
47
+ const currentConfig = JSON.parse(sessionStorage.getItem("pageFormdata"));
46
48
  if (type) {
47
49
  const sectionUiSchema = {
48
50
  Core: CoreSection,
@@ -57,7 +59,95 @@ export function refreshPage (type: string, store: any) {
57
59
  UiSchema.elements[1].config.main.tabLabels = sectionLabels[type] || ["Core", "Style", "Event", "Validation"];
58
60
  UiSchema.elements[1].elements = elements || [CoreSection, StyleSection, EventSection(store.theme.myTheme), ValidationSection];
59
61
  }
60
- if (sessionStorage.getItem("copiedConfig") ) {
62
+ // Get Widget Type of parent
63
+ const path = store.searchParams?.get("path");
64
+ const lastDotIndex = path.lastIndexOf('.')
65
+ const parentPath = path.slice(0, lastDotIndex)
66
+
67
+ const parentObj = _.get(currentConfig, parentPath)
68
+
69
+ if (parentObj?.type === "Table") {
70
+ UiSchema.elements[1].elements[0].elements[3] =
71
+ {
72
+ type: "Control",
73
+ scope: "#/properties/columnFormat",
74
+ options: {
75
+ widget: "SelectInputField",
76
+ },
77
+ config: {
78
+ layout: { xs: 6, sm: 6, md: 4, lg: 3 },
79
+ main: {
80
+ label: "Column Format",
81
+
82
+ },
83
+ },
84
+ };
85
+ UiSchema.elements[1].elements[0].elements[4] =
86
+ {
87
+ type: "Control",
88
+ scope: "#/properties/enableFilter",
89
+ options: {
90
+ widget: "RadioInputField",
91
+ },
92
+ config: {
93
+ layout: { xs: 6, sm: 6, md: 4, lg: 3 },
94
+ main: {
95
+ label: "Enable Filter",
96
+ options: ["Yes", "No"],
97
+ },
98
+ },
99
+ },
100
+ UiSchema.elements[1].elements[0].elements[5] =
101
+ {
102
+ type: "Control",
103
+ scope: "#/properties/filteringOptions",
104
+ options: {
105
+ widget: "SelectInputField",
106
+ },
107
+ config: {
108
+ layout: { xs: 6, sm: 6, md: 4, lg: 3 },
109
+ main: {
110
+ label: "Filter Mode",
111
+ multiple: true
112
+ },
113
+ },
114
+ };
115
+
116
+ UiSchema.elements[0].elements[0].elements[6] =
117
+ {
118
+ type: "Control",
119
+ scope: "#/properties/enableSorting",
120
+ options: {
121
+ widget: "RadioInputField",
122
+ },
123
+ config: {
124
+ layout: { xs: 6, sm: 6, md: 4, lg: 3 },
125
+ main: {
126
+ label: "Enable Sorting",
127
+ options: ["Yes", "No"],
128
+ },
129
+ },
130
+ },
131
+ UiSchema.elements[0].elements[0].elements[7] =
132
+ {
133
+ type: "Control",
134
+ scope: "#/properties/columnKey",
135
+
136
+ options: {
137
+ widget: "InputField",
138
+ },
139
+ config: {
140
+ layout: { xs: 6, sm: 6, md: 4, lg: 4 },
141
+ main: {
142
+ label: "Column Key",
143
+ options: [],
144
+ color: "secondary",
145
+ required: true,
146
+ },
147
+ },
148
+ }
149
+ }
150
+ if (sessionStorage.getItem("copiedConfig")) {
61
151
  this.ElementPathSetter(UiSchema);
62
152
  }
63
153
  store.setUiSchema(UiSchema);
@@ -80,13 +170,13 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
80
170
  },
81
171
  getSchema: function () {
82
172
  const schema = _.cloneDeep(ComponentSchema);
83
- if (sessionStorage.getItem("copiedConfig") ) {
173
+ if (sessionStorage.getItem("copiedConfig")) {
84
174
  schema.properties.RemoveItemButton.disabled = false;
85
175
  }
86
176
  return schema;
87
177
  },
88
178
  okHandler: () => okHandler(store),
89
- saveHandler: async () => await saveHandler(store, service, submitHandler, "PageMaster"),
179
+ saveHandler: async () => await saveHandler(store, service, submitHandler),
90
180
  onChange: function () {
91
181
  if (
92
182
  store?.formData?.type !== store?.newData?.type &&
@@ -168,22 +258,22 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
168
258
  },
169
259
  deletePopUpComponent: function () {
170
260
  const rowId = dynamicData.path.split(".")[1];
171
- sessionStorage.setItem('rowId',rowId);
261
+ sessionStorage.setItem('rowId', rowId);
172
262
  store.updateDialog("popUpComponentSection");
173
263
  },
174
264
  deletePopUpEvent: function () {
175
265
  const rowId = dynamicData.path.split(".")[1];
176
- sessionStorage.setItem('rowId',rowId);
266
+ sessionStorage.setItem('rowId', rowId);
177
267
  store.updateDialog("popUpEventSection");
178
268
  },
179
269
 
180
- copyPasteElement: function(paramStore: any, setPage: any = this.setPage.bind(this) ){
270
+ copyPasteElement: function (paramStore: any, setPage: any = this.setPage.bind(this)) {
181
271
  const [actionType, elementType] = dynamicData.path.split('.').pop()?.split('_');
182
272
  actionType === "Copy" ? this.CopyElement(paramStore, elementType) : this.PasteElement(setPage, elementType);
183
273
  },
184
- CopyElement: function(paramStore: any = store, elementType: string){
185
- const schema = cloneDeep(paramStore.schema );
186
- const uiSchema = cloneDeep(paramStore.uiSchema );
274
+ CopyElement: function (paramStore: any = store, elementType: string) {
275
+ const schema = cloneDeep(paramStore.schema);
276
+ const uiSchema = cloneDeep(paramStore.uiSchema);
187
277
  schema.properties.RemoveItemButton.disabled = false;
188
278
 
189
279
  const rowId = dynamicData.path.split(".")[1];
@@ -191,13 +281,13 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
191
281
  const copiedElementPath = this.elementPathHandler(parentPathOfCopiedComponent, rowId, elementType);
192
282
  const copiedFormData = getFormdataFromSessionStorage(copiedElementPath);
193
283
 
194
- this.ElementPathSetter(uiSchema,copiedFormData);
195
- sessionStorage.setItem('copiedConfig',JSON.stringify(copiedFormData));
284
+ this.ElementPathSetter(uiSchema, copiedFormData);
285
+ sessionStorage.setItem('copiedConfig', JSON.stringify(copiedFormData));
196
286
  store.setSchema(schema);
197
287
  store.setUiSchema(uiSchema);
198
- },
199
- PasteElement: function( setPage: any , elementType: string){
200
- if (!sessionStorage.getItem("copiedConfig") ) {
288
+ },
289
+ PasteElement: function (setPage: any, elementType: string) {
290
+ if (!sessionStorage.getItem("copiedConfig")) {
201
291
  store.setNotify({
202
292
  FailMessage: "No item has been copied.",
203
293
  Fail: true,
@@ -205,8 +295,15 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
205
295
  return;
206
296
  }
207
297
  const pastedElementParentPath = store.searchParams?.get("path");
208
- const formData = getFormdataFromSessionStorage(pastedElementParentPath);
209
- const insertElementIndex = elementType === "Component" ? formData.elements.length : formData.events.length;
298
+ if (!Array.isArray(store.formData.elements)) {
299
+ store.formData.elements = []
300
+ }
301
+ if (!Array.isArray(store.formData.events)) {
302
+ store.formData.events = []
303
+ }
304
+ saveFormdataInSessionStorage(store.ctx.core.data, pastedElementParentPath);
305
+ const formData = getFormdataFromSessionStorage(pastedElementParentPath);
306
+ const insertElementIndex = elementType === "Component" ? formData.elements.length : formData.events.length;
210
307
  const pastedElementPath = this.elementPathHandler(pastedElementParentPath, insertElementIndex, elementType);
211
308
 
212
309
  const copiedConfig = JSON.parse(sessionStorage.getItem("copiedConfig"));
@@ -214,25 +311,25 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
214
311
  Event: " The event cannot be integrated into the component section.",
215
312
  Component: "The component cannot be integrated into the event section."
216
313
  };
217
- if(copiedConfig.Handler && elementType === "Component"){
314
+ if (copiedConfig.Handler && elementType === "Component") {
218
315
  store.setNotify({
219
316
  FailMessage: notificationMessages.Event,
220
317
  Fail: true,
221
318
  });
222
319
  }
223
- else if(copiedConfig.name && elementType === "Event"){
320
+ else if (copiedConfig.name && elementType === "Event") {
224
321
  store.setNotify({
225
322
  FailMessage: notificationMessages.Component,
226
323
  Fail: true,
227
324
  });
228
325
  }
229
- else{
326
+ else {
230
327
  saveFormdataInSessionStorage(copiedConfig, pastedElementPath);
231
328
  setPage();
232
329
  }
233
- },
234
- RemoveItemButton: function(paramStore: any = store){
235
- const schema = cloneDeep(paramStore.schema );
330
+ },
331
+ RemoveItemButton: function (paramStore: any = store) {
332
+ const schema = cloneDeep(paramStore.schema);
236
333
  const uiSchema = cloneDeep(paramStore.uiSchema);
237
334
  schema.properties.RemoveItemButton.disabled = true;
238
335
  uiSchema.elements[2].elements[1].config.main.heading = `No element copied`;
@@ -240,15 +337,15 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
240
337
  store.setSchema(schema);
241
338
  store.setUiSchema(uiSchema);
242
339
  },
243
- elementPathHandler: function(parentPath: string, rowId: any, elementType: string){
244
- if(elementType === "Component"){
245
- return parentPath ? `${parentPath}.elements[${rowId}]` : `elements[${rowId}]`;
340
+ elementPathHandler: function (parentPath: string, rowId: any, elementType: string) {
341
+ if (elementType === "Component") {
342
+ return parentPath ? `${parentPath}.elements[${rowId}]` : `elements[${rowId}]`;
246
343
  }
247
- return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
344
+ return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
248
345
  },
249
- ElementPathSetter: function(uiSchema: any,copiedFormData?: any){
346
+ ElementPathSetter: function (uiSchema: any, copiedFormData?: any) {
250
347
  const formData = copiedFormData || JSON.parse(sessionStorage.getItem("copiedConfig"));
251
- uiSchema.elements[2].elements[1].config.main.heading = `Copied Path: ${formData.pageName}`;
348
+ uiSchema.elements[2].elements[1].config.main.heading = `Copied Path: ${formData.pageName}`;
252
349
  }
253
350
  }
254
351
  };
@@ -105,7 +105,7 @@ export default (
105
105
  return schema;
106
106
  },
107
107
  okHandler: () => okHandler(store),
108
- saveHandler: async () => await saveHandler(store, service, submitHandler, "PageMaster"),
108
+ saveHandler: async () => await saveHandler(store, service, submitHandler),
109
109
  onChange: function () {
110
110
  if (
111
111
  store?.formData?.Handler !== store?.newData?.Handler &&
@@ -57,7 +57,7 @@ export const getFormdataFromSessionStorage = (path?: string) => {
57
57
 
58
58
  }
59
59
 
60
- export async function saveHandler(store, service, submitHandler, pageName?: string) {
60
+ export async function saveHandler(store, service, submitHandler) {
61
61
  const id = store.searchParams?.get("id");
62
62
  const path = store.searchParams?.get("path");
63
63
  saveFormdataInSessionStorage(store.ctx.core.data, path);
@@ -65,7 +65,7 @@ export async function saveHandler(store, service, submitHandler, pageName?: stri
65
65
  if (_.isEmpty(store.ctx.core.errors)) {
66
66
  try {
67
67
  const saveReturn = await submitHandler(store, service, config);
68
- navigateHandler(store, true, pageName ? `/${pageName}?id=${saveReturn.id}` : "/PageMasterRecords")
68
+ navigateHandler(store, true,"/PageMasterRecords")
69
69
  } catch (err) {
70
70
  navigateHandler(store, false)
71
71
  }
@@ -1,4 +1,4 @@
1
- import _, { cloneDeep } from "lodash";
1
+ import _ from "lodash";
2
2
  import { handlersProps } from "./interface";
3
3
  export const executeEvents = (params: handlersProps) => {
4
4
  let nextEvent = [];
@@ -146,32 +146,36 @@ function executeCustomHandler(params: handlersProps) {
146
146
  }
147
147
 
148
148
  function mergeFormdata(handlerResponse: any, componentName: string, eventConfig: any, store: any, service: any, formDataHolder: any) {
149
- if (eventConfig.type === "Select" && handlerResponse?.data && !_.isEmpty(handlerResponse?.data)) {
150
- store.setSchema((pre) => {
151
- return {
152
- ...pre, properties: {
153
- ...pre.properties, [componentName]: {
154
- ...pre.properties?.[componentName],
155
- oneOf: handlerResponse.data
149
+ if (eventConfig.type === "Select" && handlerResponse?.data) {
150
+ if (!_.isEmpty(handlerResponse?.data)) {
151
+ store.setSchema((pre) => {
152
+ return {
153
+ ...pre, properties: {
154
+ ...pre.properties, [componentName]: {
155
+ ...pre.properties?.[componentName],
156
+ oneOf: handlerResponse.data
157
+ }
156
158
  }
157
159
  }
158
- }
159
- })
160
+ })
161
+ }
160
162
  }
161
- else if (eventConfig.type === "MultipleSelect" && handlerResponse?.data && !_.isEmpty(handlerResponse?.data)) {
162
- store.setSchema((pre) => {
163
- return {
164
- ...pre, properties: {
165
- ...pre.properties, [componentName]: {
166
- ...pre.properties?.[componentName],
167
- type: "array",
168
- items: {
169
- oneOf: handlerResponse?.data
163
+ else if (eventConfig.type === "MultipleSelect" && handlerResponse?.data) {
164
+ if (!_.isEmpty(handlerResponse?.data)) {
165
+ store.setSchema((pre) => {
166
+ return {
167
+ ...pre, properties: {
168
+ ...pre.properties, [componentName]: {
169
+ ...pre.properties?.[componentName],
170
+ type: "array",
171
+ items: {
172
+ oneOf: handlerResponse?.data
173
+ }
170
174
  }
171
175
  }
172
176
  }
173
- }
174
- })
177
+ })
178
+ }
175
179
  }
176
180
  else if (eventConfig.type === "page") {
177
181
  if (!(_.isEmpty(handlerResponse?.data) && handlerResponse?.data)) {
@@ -182,6 +186,13 @@ function mergeFormdata(handlerResponse: any, componentName: string, eventConfig:
182
186
  store.setFormdata((pre: any) => { return { ...pre, ...handlerResponse?.data } })
183
187
  }
184
188
  }
189
+ else if (eventConfig.type === "Table" && eventConfig.lazyLoading) {
190
+ if (handlerResponse && handlerResponse?.data) {
191
+ formDataHolder[componentName] = handlerResponse.data?.data
192
+ formDataHolder[`${componentName}_RowCount`] = handlerResponse.data?.meta?.totalRowCount
193
+ store.setFormdata((pre) => { return { ...pre, ...formDataHolder } });
194
+ }
195
+ }
185
196
  else {
186
197
  if (handlerResponse) {
187
198
  formDataHolder[componentName] = handlerResponse.data
@@ -189,7 +189,7 @@ export default (funcParams: funcParamsProps) => {
189
189
  fontSize: "14px",
190
190
  cursor: "pointer",
191
191
  marginLeft: "2px",
192
-
192
+
193
193
  top: 3,
194
194
  right: "12px",
195
195
  position: "absolute",
@@ -214,12 +214,12 @@ export default (funcParams: funcParamsProps) => {
214
214
  await executeRefreshHandler({
215
215
  config: {}, componentName: "",
216
216
  store: funcParams.store, dynamicData: funcParams.dynamicData, userValue: funcParams.userValue, service: funcParams.service,
217
- serviceHolder: this, eventGroups, formDataHolder
217
+ serviceHolder: this, eventGroups, formDataHolder: {}
218
218
  })
219
219
  funcParams.store.setSchema(
220
220
  (pre: any) => {
221
221
  return {
222
- ...schema,...pre, properties:
222
+ ...schema, ...pre, properties:
223
223
  { ...schema.properties, ...pre.properties, }
224
224
  }
225
225
  }
@@ -231,7 +231,8 @@ export default (funcParams: funcParamsProps) => {
231
231
  if (eventGroups.onCellRenderer) {
232
232
  let finalResponse = {};
233
233
  const path = funcParams.dynamicData?.tableButtonPath || funcParams?.dynamicData?.path?.split(".")[0];
234
- for (const eventConfig of eventGroups?.onCellRenderer[path]) {
234
+
235
+ for (const eventConfig of eventGroups?.onCellRenderer?.[path]) {
235
236
  executeEventsParameters.store.functionParameters = cellParams
236
237
  finalResponse = executeEvents({
237
238
  ...executeEventsParameters,