impaktapps-ui-builder 0.0.101-alpha.217 → 0.0.101-alpha.218

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impaktapps-ui-builder",
3
- "version": "0.0.101-alpha.217",
3
+ "version": "0.0.101-alpha.218",
4
4
  "scripts": {
5
5
  "dev": "vite",
6
6
  "build": "tsc && vite build",
@@ -14,7 +14,7 @@ import { buildWrapperSection } from "./buildWrapperSection";
14
14
  import { buildTextField } from "./buildText";
15
15
  import { buildSelect } from "./buildSelect";
16
16
  import { buildButton } from "./buildButton";
17
- import { buildTable } from "./buildTable";
17
+ import { buildTable } from "./buildTable";
18
18
  import { buildLabel } from "./buildLabel";
19
19
  import { buildUploadFile } from "./buildUplaodFile";
20
20
  import { buildDownloadFile } from "./buildDownloadFile";
@@ -343,54 +343,49 @@ const buildUiSchema = (config: any, store?: any) => {
343
343
  }
344
344
  else if (config.type == "Table") {
345
345
  const sizeMap = {}
346
- // const filterMap = {}
346
+ const filterMap = {}
347
347
  if (config.sizeHolder) {
348
348
  config.sizeHolder.map((e, i) => {
349
349
  sizeMap[e.keyName] = e.value
350
350
  });
351
351
  }
352
- // if(config.enableColumnFilter){
353
- // config.enableColumnFilter.map((e)=>{
354
- // filterMap[e.keyName] = true
355
- // })
356
- // }
352
+ if (config.enableColumnFilter) {
353
+ config.enableColumnFilter.map((e) => {
354
+ filterMap[e.keyName] = true
355
+ })
356
+ }
357
357
  elements.elements = config.elements.map((cellElem, elemInd) => {
358
+ const commonProperties = {
359
+ accessorKey: cellElem.name,
360
+ type: cellElem.columnFormat,
361
+ header: cellElem.label || cellElem.name,
362
+ size: sizeMap[cellElem.name] || 180,
363
+ enableColumnFilter: Object.keys(filterMap).length === 0 ? true : filterMap[cellElem.name] ?? false,
364
+ columnFilterModeOptions: config.filteringOptions,
365
+ enableSorting: config.enableSorting === "No" ? false : true,
366
+ columnKey: config.columnKey
367
+ }
358
368
  if (cellElem.type) {
359
369
  return {
360
- accessorKey: cellElem.name,
361
- header: cellElem.label || cellElem.name,
362
- size: sizeMap[cellElem.name] || 180,
363
- type: cellElem.columnFormat,
364
370
  widget: cellElem.type != "ColumnGroup" ? buildUiSchema(cellElem, store) : undefined,
365
371
  elements: cellElem.type == "ColumnGroup" ? cellElem.elements.map((childCellElem) => buildUiSchema(childCellElem, store)) : [],
366
- // enableColumnFilter: Object.keys(filterMap).length === 0 ? true : filterMap[cellElem.name] ?? false,
367
- columnFilterModeOptions: cellElem.filteringOptions,
368
- enableColumnFilter: cellElem.enableFilter === "Yes" ? true : false,
369
- enableSorting: cellElem.enableSorting === "Yes" ? true : false
372
+ ...commonProperties
373
+
370
374
  }
371
375
  } else {
372
- return {
373
- accessorKey: cellElem.name,
374
- type: cellElem.columnFormat,
375
- header: cellElem.label || cellElem.name,
376
- size: sizeMap[cellElem.name] || 180,
377
- // enableColumnFilter: Object.keys(filterMap).length === 0 ? true : filterMap[cellElem.name] ?? false,
378
- columnFilterModeOptions: cellElem.filteringOptions,
379
- enableColumnFilter: cellElem.enableFilter === "Yes" ? true : false,
380
- enableSorting: cellElem.enableSorting === "Yes" ? true : false
381
- }
376
+ return commonProperties
382
377
  }
383
378
 
384
379
  })
385
380
  }
386
381
  else if (config.type == "Array") {
387
382
  elements.options.detail.elements = config.elements.map((e: any, elemInd: number) => {
388
- return buildUiSchema(e,store)
383
+ return buildUiSchema(e, store)
389
384
  });
390
385
  }
391
386
  else {
392
387
  elements.elements = config.elements.map((e: any, elemInd: number) => {
393
- return buildUiSchema(e,store)
388
+ return buildUiSchema(e, store)
394
389
  });
395
390
  }
396
391
  }
@@ -71,7 +71,7 @@ export const ComponentSchema: any = {
71
71
  type: "array",
72
72
  items: {
73
73
  type: "object",
74
- properties: {
74
+ properties: {
75
75
  key: {
76
76
  type: "string",
77
77
  oneOf: [
@@ -192,7 +192,7 @@ export const ComponentSchema: any = {
192
192
  },
193
193
  },
194
194
  },
195
- enableColumnFilter:{
195
+ enableColumnFilter: {
196
196
  type: "array",
197
197
  items: {
198
198
  type: "object",
@@ -203,22 +203,23 @@ export const ComponentSchema: any = {
203
203
  },
204
204
  },
205
205
  },
206
- filteringOptions:{
207
- oneOf: [
208
- { const: 'fuzzy', title: 'Fuzzy' },
209
- { const: 'contains', title: 'Contain' },
210
- { const: 'startsWith', title: 'Starts with' },
211
- { const: 'endsWith', title: 'Ends with' },
212
- { const: 'equals', title: 'Equals' },
213
- { const: 'notEquals', title: 'Not Equals' },
214
- { const: 'between', title: 'Between' },
215
- { const: 'betweenInclusive', title: 'Between inclusive' },
216
- { const: 'greaterThan', title: 'Greater than' },
217
- { const: 'greaterThanOrEqualTo', title: 'Greater than or equal to' },
218
- { const: 'lessThan', title: 'Less than' },
219
- { const: 'lessThanOrEqualTo', title: 'Less than or equal to' },
220
- ]
206
+ filteringOptions: {
207
+ oneOf: [
208
+ { const: 'fuzzy', title: 'Fuzzy' },
209
+ { const: 'contains', title: 'Contain' },
210
+ { const: 'startsWith', title: 'Starts with' },
211
+ { const: 'endsWith', title: 'Ends with' },
212
+ { const: 'equals', title: 'Equals' },
213
+ { const: 'notEquals', title: 'Not Equals' },
214
+ { const: 'between', title: 'Between' },
215
+ { const: 'betweenInclusive', title: 'Between inclusive' },
216
+ { const: 'greaterThan', title: 'Greater than' },
217
+ { const: 'greaterThanOrEqualTo', title: 'Greater than or equal to' },
218
+ { const: 'lessThan', title: 'Less than' },
219
+ { const: 'lessThanOrEqualTo', title: 'Less than or equal to' },
220
+ ]
221
221
  },
222
+
222
223
  legendLabels: {
223
224
  type: "array",
224
225
  items: {
@@ -344,7 +345,7 @@ export const ComponentSchema: any = {
344
345
  type: "string",
345
346
  },
346
347
  label: { type: 'string' },
347
- RemoveItemButton:{
348
+ RemoveItemButton: {
348
349
  disabled: true,
349
350
  },
350
351
  },
@@ -1,4 +1,4 @@
1
- export const componentBasicUiSchema: any = (theme)=>{
1
+ export const componentBasicUiSchema: any = (theme) => {
2
2
  const uiSchema = {
3
3
  type: "HorizontalLayout",
4
4
  heading: "Page-Component",
@@ -42,7 +42,7 @@ const sectionLabels = {
42
42
  Thought: ["Core", "Properties", "Events", "Style", "Validation"]
43
43
  }
44
44
 
45
- export function refreshPage (type: string, store: any) {
45
+ export function refreshPage(type: string, store: any) {
46
46
  const UiSchema = _.cloneDeep(componentBasicUiSchema(store.theme.myTheme))
47
47
  const currentConfig = JSON.parse(sessionStorage.getItem("pageFormdata"));
48
48
  if (type) {
@@ -164,7 +164,7 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
164
164
  },
165
165
  getSchema: function () {
166
166
  const schema = _.cloneDeep(ComponentSchema);
167
- if (sessionStorage.getItem("copiedConfig") ) {
167
+ if (sessionStorage.getItem("copiedConfig")) {
168
168
  schema.properties.RemoveItemButton.disabled = false;
169
169
  }
170
170
 
@@ -281,22 +281,22 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
281
281
  },
282
282
  deletePopUpComponent: function () {
283
283
  const rowId = dynamicData.path.split(".")[1];
284
- sessionStorage.setItem('rowId',rowId);
284
+ sessionStorage.setItem('rowId', rowId);
285
285
  store.updateDialog("popUpComponentSection");
286
286
  },
287
287
  deletePopUpEvent: function () {
288
288
  const rowId = dynamicData.path.split(".")[1];
289
- sessionStorage.setItem('rowId',rowId);
289
+ sessionStorage.setItem('rowId', rowId);
290
290
  store.updateDialog("popUpEventSection");
291
291
  },
292
292
 
293
- copyPasteElement: function(paramStore: any, setPage: any = this.setPage.bind(this) ){
293
+ copyPasteElement: function (paramStore: any, setPage: any = this.setPage.bind(this)) {
294
294
  const [actionType, elementType] = dynamicData.path.split('.').pop()?.split('_');
295
295
  actionType === "Copy" ? this.CopyElement(paramStore, elementType) : this.PasteElement(setPage, elementType);
296
296
  },
297
- CopyElement: function(paramStore: any = store, elementType: string){
298
- const schema = cloneDeep(paramStore.schema );
299
- const uiSchema = cloneDeep(paramStore.uiSchema );
297
+ CopyElement: function (paramStore: any = store, elementType: string) {
298
+ const schema = cloneDeep(paramStore.schema);
299
+ const uiSchema = cloneDeep(paramStore.uiSchema);
300
300
  schema.properties.RemoveItemButton.disabled = false;
301
301
 
302
302
  const rowId = dynamicData.path.split(".")[1];
@@ -312,9 +312,9 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
312
312
  })
313
313
  store.setSchema(schema);
314
314
  store.setUiSchema(uiSchema);
315
- },
316
- PasteElement: function( setPage: any , elementType: string){
317
- if (!sessionStorage.getItem("copiedConfig") ) {
315
+ },
316
+ PasteElement: function (setPage: any, elementType: string) {
317
+ if (!sessionStorage.getItem("copiedConfig")) {
318
318
  store.setNotify({
319
319
  FailMessage: "No item has been copied.",
320
320
  Fail: true,
@@ -322,15 +322,15 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
322
322
  return;
323
323
  }
324
324
  const pastedElementParentPath = store.searchParams?.get("path");
325
- if (!Array.isArray(store.formData.elements) ) {
325
+ if (!Array.isArray(store.formData.elements)) {
326
326
  store.formData.elements = []
327
327
  }
328
328
  if (!Array.isArray(store.formData.events)) {
329
329
  store.formData.events = []
330
330
  }
331
331
  saveFormdataInSessionStorage(store.ctx.core.data, pastedElementParentPath);
332
- const formData = getFormdataFromSessionStorage(pastedElementParentPath);
333
- const insertElementIndex = elementType === "Component" ? formData.elements.length : formData.events.length;
332
+ const formData = getFormdataFromSessionStorage(pastedElementParentPath);
333
+ const insertElementIndex = elementType === "Component" ? formData.elements.length : formData.events.length;
334
334
  const pastedElementPath = this.elementPathHandler(pastedElementParentPath, insertElementIndex, elementType);
335
335
 
336
336
  const copiedConfig = JSON.parse(sessionStorage.getItem("copiedConfig"));
@@ -338,7 +338,7 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
338
338
  Events: " The Events cannot be integrated into the component section.",
339
339
  Component: "The component cannot be integrated into the Events section."
340
340
  };
341
- if(copiedConfig.Handler && elementType === "Component"){
341
+ if (copiedConfig.Handler && elementType === "Component") {
342
342
  store.setNotify({
343
343
  FailMessage: notificationMessages.Events,
344
344
  Fail: true,
@@ -350,13 +350,13 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
350
350
  Fail: true,
351
351
  });
352
352
  }
353
- else{
353
+ else {
354
354
  saveFormdataInSessionStorage(copiedConfig, pastedElementPath);
355
355
  setPage();
356
356
  }
357
- },
358
- RemoveItemButton: function(paramStore: any = store){
359
- const schema = cloneDeep(paramStore.schema );
357
+ },
358
+ RemoveItemButton: function (paramStore: any = store) {
359
+ const schema = cloneDeep(paramStore.schema);
360
360
  const uiSchema = cloneDeep(paramStore.uiSchema);
361
361
  schema.properties.RemoveItemButton.disabled = true;
362
362
  uiSchema.elements[2].elements[1].config.main.heading = `No element copied`;
@@ -364,13 +364,13 @@ export default (store: any, dynamicData: any, submitHandler: any, service: any)
364
364
  store.setSchema(schema);
365
365
  store.setUiSchema(uiSchema);
366
366
  },
367
- elementPathHandler: function(parentPath: string, rowId: any, elementType: string){
368
- if(elementType === "Component"){
369
- return parentPath ? `${parentPath}.elements[${rowId}]` : `elements[${rowId}]`;
367
+ elementPathHandler: function (parentPath: string, rowId: any, elementType: string) {
368
+ if (elementType === "Component") {
369
+ return parentPath ? `${parentPath}.elements[${rowId}]` : `elements[${rowId}]`;
370
370
  }
371
- return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
371
+ return parentPath ? `${parentPath}.events[${rowId}]` : `events[${rowId}]`;
372
372
  },
373
- ElementPathSetter: function(uiSchema: any,copiedFormData?: any){
373
+ ElementPathSetter: function (uiSchema: any, copiedFormData?: any) {
374
374
  const formData = copiedFormData || JSON.parse(sessionStorage.getItem("copiedConfig"));
375
375
  if(uiSchema?.elements?.[1]?.elements?.[0]?.config?.main?.headerIcons){
376
376
  uiSchema.elements[1].elements[0].config.main.headerIcons.elements[1].widget.config.main.tooltipMessage = `Copied Component: ${formData.name}`;