@zeedhi/common 1.83.0 → 1.84.0

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.
@@ -565,7 +565,7 @@ class ApexChart extends ComponentRender {
565
565
  return series;
566
566
  }
567
567
  translateOptions(propOptions = {}) {
568
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
568
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
569
569
  let value;
570
570
  value = this.getPropValue((_c = (_b = (_a = propOptions.annotations) === null || _a === void 0 ? void 0 : _a.yaxis) === null || _b === void 0 ? void 0 : _b.label) === null || _c === void 0 ? void 0 : _c.text);
571
571
  if (value)
@@ -579,10 +579,13 @@ class ApexChart extends ComponentRender {
579
579
  value = this.getPropValue((_l = (_k = propOptions.annotations) === null || _k === void 0 ? void 0 : _k.texts) === null || _l === void 0 ? void 0 : _l.text);
580
580
  if (value)
581
581
  propOptions.annotations.texts.text = I18n.translate(value);
582
+ value = this.getPropValue((_m = propOptions.xaxis) === null || _m === void 0 ? void 0 : _m.categories);
583
+ if (value && Array.isArray(value))
584
+ propOptions.xaxis.categories = value.map((item) => I18n.translate(item));
582
585
  value = this.getPropValue(propOptions.labels);
583
586
  if (value && Array.isArray(value))
584
587
  propOptions.labels = value.map((item) => I18n.translate(item));
585
- value = this.getPropValue((_r = (_q = (_p = (_o = (_m = propOptions.plotOptions) === null || _m === void 0 ? void 0 : _m.pie) === null || _o === void 0 ? void 0 : _o.donut) === null || _p === void 0 ? void 0 : _p.labels) === null || _q === void 0 ? void 0 : _q.total) === null || _r === void 0 ? void 0 : _r.label);
588
+ value = this.getPropValue((_s = (_r = (_q = (_p = (_o = propOptions.plotOptions) === null || _o === void 0 ? void 0 : _o.pie) === null || _p === void 0 ? void 0 : _p.donut) === null || _q === void 0 ? void 0 : _q.labels) === null || _r === void 0 ? void 0 : _r.total) === null || _s === void 0 ? void 0 : _s.label);
586
589
  if (value)
587
590
  propOptions.plotOptions.pie.donut.labels.total.label = I18n.translate(value);
588
591
  value = this.getPropValue(propOptions.series);
@@ -593,22 +596,22 @@ class ApexChart extends ComponentRender {
593
596
  return item;
594
597
  });
595
598
  }
596
- value = this.getPropValue((_s = propOptions.subtitle) === null || _s === void 0 ? void 0 : _s.text);
599
+ value = this.getPropValue((_t = propOptions.subtitle) === null || _t === void 0 ? void 0 : _t.text);
597
600
  if (value)
598
601
  propOptions.subtitle.text = I18n.translate(value);
599
- value = this.getPropValue((_t = propOptions.title) === null || _t === void 0 ? void 0 : _t.text);
602
+ value = this.getPropValue((_u = propOptions.title) === null || _u === void 0 ? void 0 : _u.text);
600
603
  if (value)
601
604
  propOptions.title.text = I18n.translate(value);
602
- value = this.getPropValue((_v = (_u = propOptions.xaxis) === null || _u === void 0 ? void 0 : _u.title) === null || _v === void 0 ? void 0 : _v.text);
605
+ value = this.getPropValue((_w = (_v = propOptions.xaxis) === null || _v === void 0 ? void 0 : _v.title) === null || _w === void 0 ? void 0 : _w.text);
603
606
  if (value)
604
607
  propOptions.xaxis.title.text = I18n.translate(value);
605
- value = this.getPropValue((_x = (_w = propOptions.yaxis) === null || _w === void 0 ? void 0 : _w.title) === null || _x === void 0 ? void 0 : _x.text);
608
+ value = this.getPropValue((_y = (_x = propOptions.yaxis) === null || _x === void 0 ? void 0 : _x.title) === null || _y === void 0 ? void 0 : _y.text);
606
609
  if (value)
607
610
  propOptions.yaxis.title.text = I18n.translate(value);
608
- value = this.getPropValue((_y = propOptions.noData) === null || _y === void 0 ? void 0 : _y.text);
611
+ value = this.getPropValue((_z = propOptions.noData) === null || _z === void 0 ? void 0 : _z.text);
609
612
  if (value)
610
613
  propOptions.noData.text = I18n.translate(value);
611
- value = this.getPropValue((_1 = (_0 = (_z = propOptions.chart) === null || _z === void 0 ? void 0 : _z.toolbar) === null || _0 === void 0 ? void 0 : _0.tools) === null || _1 === void 0 ? void 0 : _1.customIcons);
614
+ value = this.getPropValue((_2 = (_1 = (_0 = propOptions.chart) === null || _0 === void 0 ? void 0 : _0.toolbar) === null || _1 === void 0 ? void 0 : _1.tools) === null || _2 === void 0 ? void 0 : _2.customIcons);
612
615
  if (value && Array.isArray(value)) {
613
616
  propOptions.chart.toolbar.tools.customIcons = value.map((item) => (Object.assign(Object.assign({}, item), { title: item.title ? I18n.translate(item.title) : item.title })));
614
617
  }
@@ -2881,22 +2884,24 @@ class Number$1 extends TextInput {
2881
2884
  */
2882
2885
  parser(value) { return this.parserFn(value, this); }
2883
2886
  }
2884
- FormatterParserProvider.registerFormatter('ZdNumber', (value, { mask = Config.masks.numberMask, } = {}) => {
2887
+ FormatterParserProvider.registerFormatter('ZdNumber', (value, { mask = {}, } = {}) => {
2885
2888
  let maskDef = mask;
2886
2889
  if (Accessor.isAccessorDefinition(maskDef)) {
2887
2890
  const [controller, accessor] = Accessor.getAccessor(maskDef);
2888
2891
  maskDef = Loader.getInstance(controller)[accessor];
2889
2892
  }
2890
- const maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.unformat(value)) : maskDef;
2893
+ let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.unformat(value)) : maskDef;
2894
+ maskValue = Object.assign(Object.assign({}, Config.masks.numberMask), maskValue);
2891
2895
  return value === null ? '' : AutoNumeric.format(value, maskValue);
2892
2896
  });
2893
- FormatterParserProvider.registerParser('ZdNumber', (value, { mask = Config.masks.numberMask, } = {}) => {
2897
+ FormatterParserProvider.registerParser('ZdNumber', (value, { mask = {}, } = {}) => {
2894
2898
  let maskDef = mask;
2895
2899
  if (Accessor.isAccessorDefinition(maskDef)) {
2896
2900
  const [controller, accessor] = Accessor.getAccessor(maskDef);
2897
2901
  maskDef = Loader.getInstance(controller)[accessor];
2898
2902
  }
2899
- const maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
2903
+ let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
2904
+ maskValue = Object.assign(Object.assign({}, Config.masks.numberMask), maskValue);
2900
2905
  return value === '' ? null : AutoNumeric.unformat(value, maskValue);
2901
2906
  });
2902
2907
 
@@ -2915,22 +2920,24 @@ class Currency extends Number$1 {
2915
2920
  this.validateMask();
2916
2921
  }
2917
2922
  }
2918
- FormatterParserProvider.registerFormatter('ZdCurrency', (value, { mask = Object.assign(Object.assign({}, Config.masks.numberMask), Config.masks.currencyMask), } = {}) => {
2923
+ FormatterParserProvider.registerFormatter('ZdCurrency', (value, { mask = {}, } = {}) => {
2919
2924
  let maskDef = mask;
2920
2925
  if (Accessor.isAccessorDefinition(maskDef)) {
2921
2926
  const [controller, accessor] = Accessor.getAccessor(maskDef);
2922
2927
  maskDef = Loader.getInstance(controller)[accessor];
2923
2928
  }
2924
- const maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.unformat(value)) : maskDef;
2929
+ let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.unformat(value)) : maskDef;
2930
+ maskValue = Object.assign(Object.assign(Object.assign({}, Config.masks.numberMask), Config.masks.currencyMask), maskValue);
2925
2931
  return value === null ? '' : AutoNumeric.format(value, maskValue);
2926
2932
  });
2927
- FormatterParserProvider.registerParser('ZdCurrency', (value, { mask = Object.assign(Object.assign({}, Config.masks.numberMask), Config.masks.currencyMask), } = {}) => {
2933
+ FormatterParserProvider.registerParser('ZdCurrency', (value, { mask = {}, } = {}) => {
2928
2934
  let maskDef = mask;
2929
2935
  if (Accessor.isAccessorDefinition(maskDef)) {
2930
2936
  const [controller, accessor] = Accessor.getAccessor(maskDef);
2931
2937
  maskDef = Loader.getInstance(controller)[accessor];
2932
2938
  }
2933
- const maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
2939
+ let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
2940
+ maskValue = Object.assign(Object.assign(Object.assign({}, Config.masks.numberMask), Config.masks.currencyMask), maskValue);
2934
2941
  return value === '' ? null : AutoNumeric.unformat(value, maskValue);
2935
2942
  });
2936
2943
 
@@ -6211,43 +6218,56 @@ class Grid extends Iterable {
6211
6218
  return response;
6212
6219
  });
6213
6220
  }
6214
- getActionComponent(actionComponent, column, row, parentPath = '') {
6215
- var _a, _b, _c, _d;
6221
+ getActionProps(actionComponent, column, row, parentPath) {
6222
+ var _a, _b, _c;
6216
6223
  const rowKey = row[this.datasource.uniqueKey];
6217
6224
  const compName = actionComponent.name;
6218
6225
  const instanceName = `${compName}_${rowKey}`;
6219
6226
  const path = parentPath ? `${parentPath}.${compName}` : compName;
6220
- const newComponent = merge({}, actionComponent, (_b = (_a = this.actionsApplied[rowKey]) === null || _a === void 0 ? void 0 : _a[column.name]) === null || _b === void 0 ? void 0 : _b[path]);
6227
+ const props = merge({}, actionComponent, (_b = (_a = this.actionsApplied[rowKey]) === null || _a === void 0 ? void 0 : _a[column.name]) === null || _b === void 0 ? void 0 : _b[path]);
6221
6228
  let newClickEvt;
6222
- if ((_c = newComponent.events) === null || _c === void 0 ? void 0 : _c.click) {
6223
- const compEvents = Event.factory(newComponent.events);
6229
+ if ((_c = props.events) === null || _c === void 0 ? void 0 : _c.click) {
6230
+ const compEvents = Event.factory(props.events);
6224
6231
  if (typeof compEvents.click === 'function') {
6225
6232
  newClickEvt = ({ component, event, element }) => compEvents.click({
6226
6233
  component, event, element, row, column,
6227
6234
  });
6228
6235
  }
6229
6236
  }
6230
- const newChildren = (_d = newComponent.children) === null || _d === void 0 ? void 0 : _d.map((child) => this.getActionComponent(child, column, row, path));
6231
- newComponent.name = instanceName;
6232
- newComponent.children = newChildren;
6233
- newComponent.allowDuplicate = true;
6237
+ const children = props.children || [];
6238
+ const newChildren = children.map((child) => this.getActionProps(child, column, row, path).props);
6239
+ props.children = newChildren;
6240
+ props.name = instanceName;
6241
+ props.allowDuplicate = true;
6242
+ let instance = null;
6234
6243
  try {
6235
- const updatedComponent = Object.assign({}, newComponent);
6236
- delete updatedComponent.datasource;
6237
- delete updatedComponent.events;
6238
- const instance = Metadata.updateInstance(instanceName, updatedComponent);
6244
+ instance = this.updateActionInstance(instanceName, props);
6239
6245
  if (newClickEvt)
6240
6246
  instance.events.click = newClickEvt;
6241
- return instance;
6242
6247
  }
6243
6248
  catch (e) {
6244
- if (!newComponent.events) {
6245
- newComponent.events = {};
6246
- }
6247
- if (newClickEvt)
6248
- newComponent.events.click = newClickEvt;
6249
- return newComponent;
6249
+ instance = null;
6250
+ }
6251
+ if (!props.events) {
6252
+ props.events = {};
6253
+ }
6254
+ if (newClickEvt)
6255
+ props.events.click = newClickEvt;
6256
+ return { props, instance };
6257
+ }
6258
+ updateActionInstance(instanceName, newComponent) {
6259
+ const updatedComponent = Object.assign({}, newComponent);
6260
+ delete updatedComponent.datasource;
6261
+ delete updatedComponent.events;
6262
+ const instance = Metadata.updateInstance(instanceName, updatedComponent);
6263
+ return instance;
6264
+ }
6265
+ getActionComponent(actionComponent, column, row, parentPath = '') {
6266
+ const { props, instance } = this.getActionProps(actionComponent, column, row, parentPath);
6267
+ if (instance) {
6268
+ return instance;
6250
6269
  }
6270
+ return props;
6251
6271
  }
6252
6272
  changeDefaultSlotNames(slot) {
6253
6273
  const strMetadata = JSON.stringify(slot);
@@ -10294,6 +10314,7 @@ class TreeDataStructure {
10294
10314
  originalData.splice(index + 1, 0, ...data);
10295
10315
  this.originalDatasource.data = originalData;
10296
10316
  this.originalDatasource.currentRow = this.clearRow(row);
10317
+ delete this.originalDatasource.filter[this.parentField];
10297
10318
  return data;
10298
10319
  }
10299
10320
  return undefined;
@@ -572,7 +572,7 @@
572
572
  return series;
573
573
  }
574
574
  translateOptions(propOptions = {}) {
575
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
575
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2;
576
576
  let value;
577
577
  value = this.getPropValue((_c = (_b = (_a = propOptions.annotations) === null || _a === void 0 ? void 0 : _a.yaxis) === null || _b === void 0 ? void 0 : _b.label) === null || _c === void 0 ? void 0 : _c.text);
578
578
  if (value)
@@ -586,10 +586,13 @@
586
586
  value = this.getPropValue((_l = (_k = propOptions.annotations) === null || _k === void 0 ? void 0 : _k.texts) === null || _l === void 0 ? void 0 : _l.text);
587
587
  if (value)
588
588
  propOptions.annotations.texts.text = core.I18n.translate(value);
589
+ value = this.getPropValue((_m = propOptions.xaxis) === null || _m === void 0 ? void 0 : _m.categories);
590
+ if (value && Array.isArray(value))
591
+ propOptions.xaxis.categories = value.map((item) => core.I18n.translate(item));
589
592
  value = this.getPropValue(propOptions.labels);
590
593
  if (value && Array.isArray(value))
591
594
  propOptions.labels = value.map((item) => core.I18n.translate(item));
592
- value = this.getPropValue((_r = (_q = (_p = (_o = (_m = propOptions.plotOptions) === null || _m === void 0 ? void 0 : _m.pie) === null || _o === void 0 ? void 0 : _o.donut) === null || _p === void 0 ? void 0 : _p.labels) === null || _q === void 0 ? void 0 : _q.total) === null || _r === void 0 ? void 0 : _r.label);
595
+ value = this.getPropValue((_s = (_r = (_q = (_p = (_o = propOptions.plotOptions) === null || _o === void 0 ? void 0 : _o.pie) === null || _p === void 0 ? void 0 : _p.donut) === null || _q === void 0 ? void 0 : _q.labels) === null || _r === void 0 ? void 0 : _r.total) === null || _s === void 0 ? void 0 : _s.label);
593
596
  if (value)
594
597
  propOptions.plotOptions.pie.donut.labels.total.label = core.I18n.translate(value);
595
598
  value = this.getPropValue(propOptions.series);
@@ -600,22 +603,22 @@
600
603
  return item;
601
604
  });
602
605
  }
603
- value = this.getPropValue((_s = propOptions.subtitle) === null || _s === void 0 ? void 0 : _s.text);
606
+ value = this.getPropValue((_t = propOptions.subtitle) === null || _t === void 0 ? void 0 : _t.text);
604
607
  if (value)
605
608
  propOptions.subtitle.text = core.I18n.translate(value);
606
- value = this.getPropValue((_t = propOptions.title) === null || _t === void 0 ? void 0 : _t.text);
609
+ value = this.getPropValue((_u = propOptions.title) === null || _u === void 0 ? void 0 : _u.text);
607
610
  if (value)
608
611
  propOptions.title.text = core.I18n.translate(value);
609
- value = this.getPropValue((_v = (_u = propOptions.xaxis) === null || _u === void 0 ? void 0 : _u.title) === null || _v === void 0 ? void 0 : _v.text);
612
+ value = this.getPropValue((_w = (_v = propOptions.xaxis) === null || _v === void 0 ? void 0 : _v.title) === null || _w === void 0 ? void 0 : _w.text);
610
613
  if (value)
611
614
  propOptions.xaxis.title.text = core.I18n.translate(value);
612
- value = this.getPropValue((_x = (_w = propOptions.yaxis) === null || _w === void 0 ? void 0 : _w.title) === null || _x === void 0 ? void 0 : _x.text);
615
+ value = this.getPropValue((_y = (_x = propOptions.yaxis) === null || _x === void 0 ? void 0 : _x.title) === null || _y === void 0 ? void 0 : _y.text);
613
616
  if (value)
614
617
  propOptions.yaxis.title.text = core.I18n.translate(value);
615
- value = this.getPropValue((_y = propOptions.noData) === null || _y === void 0 ? void 0 : _y.text);
618
+ value = this.getPropValue((_z = propOptions.noData) === null || _z === void 0 ? void 0 : _z.text);
616
619
  if (value)
617
620
  propOptions.noData.text = core.I18n.translate(value);
618
- value = this.getPropValue((_1 = (_0 = (_z = propOptions.chart) === null || _z === void 0 ? void 0 : _z.toolbar) === null || _0 === void 0 ? void 0 : _0.tools) === null || _1 === void 0 ? void 0 : _1.customIcons);
621
+ value = this.getPropValue((_2 = (_1 = (_0 = propOptions.chart) === null || _0 === void 0 ? void 0 : _0.toolbar) === null || _1 === void 0 ? void 0 : _1.tools) === null || _2 === void 0 ? void 0 : _2.customIcons);
619
622
  if (value && Array.isArray(value)) {
620
623
  propOptions.chart.toolbar.tools.customIcons = value.map((item) => (Object.assign(Object.assign({}, item), { title: item.title ? core.I18n.translate(item.title) : item.title })));
621
624
  }
@@ -2888,22 +2891,24 @@
2888
2891
  */
2889
2892
  parser(value) { return this.parserFn(value, this); }
2890
2893
  }
2891
- core.FormatterParserProvider.registerFormatter('ZdNumber', (value, { mask = core.Config.masks.numberMask, } = {}) => {
2894
+ core.FormatterParserProvider.registerFormatter('ZdNumber', (value, { mask = {}, } = {}) => {
2892
2895
  let maskDef = mask;
2893
2896
  if (core.Accessor.isAccessorDefinition(maskDef)) {
2894
2897
  const [controller, accessor] = core.Accessor.getAccessor(maskDef);
2895
2898
  maskDef = core.Loader.getInstance(controller)[accessor];
2896
2899
  }
2897
- const maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.unformat(value)) : maskDef;
2900
+ let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.unformat(value)) : maskDef;
2901
+ maskValue = Object.assign(Object.assign({}, core.Config.masks.numberMask), maskValue);
2898
2902
  return value === null ? '' : AutoNumeric.format(value, maskValue);
2899
2903
  });
2900
- core.FormatterParserProvider.registerParser('ZdNumber', (value, { mask = core.Config.masks.numberMask, } = {}) => {
2904
+ core.FormatterParserProvider.registerParser('ZdNumber', (value, { mask = {}, } = {}) => {
2901
2905
  let maskDef = mask;
2902
2906
  if (core.Accessor.isAccessorDefinition(maskDef)) {
2903
2907
  const [controller, accessor] = core.Accessor.getAccessor(maskDef);
2904
2908
  maskDef = core.Loader.getInstance(controller)[accessor];
2905
2909
  }
2906
- const maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
2910
+ let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
2911
+ maskValue = Object.assign(Object.assign({}, core.Config.masks.numberMask), maskValue);
2907
2912
  return value === '' ? null : AutoNumeric.unformat(value, maskValue);
2908
2913
  });
2909
2914
 
@@ -2922,22 +2927,24 @@
2922
2927
  this.validateMask();
2923
2928
  }
2924
2929
  }
2925
- core.FormatterParserProvider.registerFormatter('ZdCurrency', (value, { mask = Object.assign(Object.assign({}, core.Config.masks.numberMask), core.Config.masks.currencyMask), } = {}) => {
2930
+ core.FormatterParserProvider.registerFormatter('ZdCurrency', (value, { mask = {}, } = {}) => {
2926
2931
  let maskDef = mask;
2927
2932
  if (core.Accessor.isAccessorDefinition(maskDef)) {
2928
2933
  const [controller, accessor] = core.Accessor.getAccessor(maskDef);
2929
2934
  maskDef = core.Loader.getInstance(controller)[accessor];
2930
2935
  }
2931
- const maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.unformat(value)) : maskDef;
2936
+ let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.unformat(value)) : maskDef;
2937
+ maskValue = Object.assign(Object.assign(Object.assign({}, core.Config.masks.numberMask), core.Config.masks.currencyMask), maskValue);
2932
2938
  return value === null ? '' : AutoNumeric.format(value, maskValue);
2933
2939
  });
2934
- core.FormatterParserProvider.registerParser('ZdCurrency', (value, { mask = Object.assign(Object.assign({}, core.Config.masks.numberMask), core.Config.masks.currencyMask), } = {}) => {
2940
+ core.FormatterParserProvider.registerParser('ZdCurrency', (value, { mask = {}, } = {}) => {
2935
2941
  let maskDef = mask;
2936
2942
  if (core.Accessor.isAccessorDefinition(maskDef)) {
2937
2943
  const [controller, accessor] = core.Accessor.getAccessor(maskDef);
2938
2944
  maskDef = core.Loader.getInstance(controller)[accessor];
2939
2945
  }
2940
- const maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
2946
+ let maskValue = typeof (maskDef) === 'function' ? maskDef(AutoNumeric.format(value)) : maskDef;
2947
+ maskValue = Object.assign(Object.assign(Object.assign({}, core.Config.masks.numberMask), core.Config.masks.currencyMask), maskValue);
2941
2948
  return value === '' ? null : AutoNumeric.unformat(value, maskValue);
2942
2949
  });
2943
2950
 
@@ -6218,43 +6225,56 @@
6218
6225
  return response;
6219
6226
  });
6220
6227
  }
6221
- getActionComponent(actionComponent, column, row, parentPath = '') {
6222
- var _a, _b, _c, _d;
6228
+ getActionProps(actionComponent, column, row, parentPath) {
6229
+ var _a, _b, _c;
6223
6230
  const rowKey = row[this.datasource.uniqueKey];
6224
6231
  const compName = actionComponent.name;
6225
6232
  const instanceName = `${compName}_${rowKey}`;
6226
6233
  const path = parentPath ? `${parentPath}.${compName}` : compName;
6227
- const newComponent = merge__default["default"]({}, actionComponent, (_b = (_a = this.actionsApplied[rowKey]) === null || _a === void 0 ? void 0 : _a[column.name]) === null || _b === void 0 ? void 0 : _b[path]);
6234
+ const props = merge__default["default"]({}, actionComponent, (_b = (_a = this.actionsApplied[rowKey]) === null || _a === void 0 ? void 0 : _a[column.name]) === null || _b === void 0 ? void 0 : _b[path]);
6228
6235
  let newClickEvt;
6229
- if ((_c = newComponent.events) === null || _c === void 0 ? void 0 : _c.click) {
6230
- const compEvents = core.Event.factory(newComponent.events);
6236
+ if ((_c = props.events) === null || _c === void 0 ? void 0 : _c.click) {
6237
+ const compEvents = core.Event.factory(props.events);
6231
6238
  if (typeof compEvents.click === 'function') {
6232
6239
  newClickEvt = ({ component, event, element }) => compEvents.click({
6233
6240
  component, event, element, row, column,
6234
6241
  });
6235
6242
  }
6236
6243
  }
6237
- const newChildren = (_d = newComponent.children) === null || _d === void 0 ? void 0 : _d.map((child) => this.getActionComponent(child, column, row, path));
6238
- newComponent.name = instanceName;
6239
- newComponent.children = newChildren;
6240
- newComponent.allowDuplicate = true;
6244
+ const children = props.children || [];
6245
+ const newChildren = children.map((child) => this.getActionProps(child, column, row, path).props);
6246
+ props.children = newChildren;
6247
+ props.name = instanceName;
6248
+ props.allowDuplicate = true;
6249
+ let instance = null;
6241
6250
  try {
6242
- const updatedComponent = Object.assign({}, newComponent);
6243
- delete updatedComponent.datasource;
6244
- delete updatedComponent.events;
6245
- const instance = core.Metadata.updateInstance(instanceName, updatedComponent);
6251
+ instance = this.updateActionInstance(instanceName, props);
6246
6252
  if (newClickEvt)
6247
6253
  instance.events.click = newClickEvt;
6248
- return instance;
6249
6254
  }
6250
6255
  catch (e) {
6251
- if (!newComponent.events) {
6252
- newComponent.events = {};
6253
- }
6254
- if (newClickEvt)
6255
- newComponent.events.click = newClickEvt;
6256
- return newComponent;
6256
+ instance = null;
6257
+ }
6258
+ if (!props.events) {
6259
+ props.events = {};
6260
+ }
6261
+ if (newClickEvt)
6262
+ props.events.click = newClickEvt;
6263
+ return { props, instance };
6264
+ }
6265
+ updateActionInstance(instanceName, newComponent) {
6266
+ const updatedComponent = Object.assign({}, newComponent);
6267
+ delete updatedComponent.datasource;
6268
+ delete updatedComponent.events;
6269
+ const instance = core.Metadata.updateInstance(instanceName, updatedComponent);
6270
+ return instance;
6271
+ }
6272
+ getActionComponent(actionComponent, column, row, parentPath = '') {
6273
+ const { props, instance } = this.getActionProps(actionComponent, column, row, parentPath);
6274
+ if (instance) {
6275
+ return instance;
6257
6276
  }
6277
+ return props;
6258
6278
  }
6259
6279
  changeDefaultSlotNames(slot) {
6260
6280
  const strMetadata = JSON.stringify(slot);
@@ -10301,6 +10321,7 @@
10301
10321
  originalData.splice(index + 1, 0, ...data);
10302
10322
  this.originalDatasource.data = originalData;
10303
10323
  this.originalDatasource.currentRow = this.clearRow(row);
10324
+ delete this.originalDatasource.filter[this.parentField];
10304
10325
  return data;
10305
10326
  }
10306
10327
  return undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeedhi/common",
3
- "version": "1.83.0",
3
+ "version": "1.84.0",
4
4
  "description": "Zeedhi Common",
5
5
  "author": "Zeedhi <zeedhi@teknisa.com>",
6
6
  "license": "ISC",
@@ -15,7 +15,7 @@
15
15
  "build:scss": "rollup -c rollup.scss.config.js",
16
16
  "docs": "typedoc --out docs src/",
17
17
  "lint": "eslint . --fix --ext .ts",
18
- "test": "jest",
18
+ "test": "node --expose-gc ./../../node_modules/jest/bin/jest.js",
19
19
  "watch": "npm run build -- -w"
20
20
  },
21
21
  "dependencies": {
@@ -43,5 +43,5 @@
43
43
  "lodash.times": "4.3.*",
44
44
  "mockdate": "3.0.*"
45
45
  },
46
- "gitHead": "40cb1a2c5fe9d6ebb8d5ceb0add7e08f26cf5659"
46
+ "gitHead": "98ba15335f7f421c7856de217ebbea4a8506af95"
47
47
  }
@@ -3,6 +3,7 @@ import { IGrid, IGridColumn, IGridEvents } from './interfaces';
3
3
  import { Iterable } from '../zd-iterable/iterable';
4
4
  import { IComponent, IComponentRender } from '../zd-component/interfaces';
5
5
  import { GridColumn } from './grid-column';
6
+ import { Component } from '../zd-component/component';
6
7
  /**
7
8
  * Base class for Grid component
8
9
  */
@@ -202,6 +203,11 @@ export declare class Grid extends Iterable implements IGrid {
202
203
  protected navigatePageUp(): void;
203
204
  protected navigatePageDown(): void;
204
205
  deleteRows(): Promise<any[]>;
206
+ protected getActionProps(actionComponent: IComponent, column: GridColumn, row: IDictionary, parentPath: string): {
207
+ props: IComponent;
208
+ instance: Component | null;
209
+ };
210
+ protected updateActionInstance(instanceName: string, newComponent: IComponent): Component;
205
211
  getActionComponent(actionComponent: IComponent, column: GridColumn, row: IDictionary, parentPath?: string): IComponent;
206
212
  protected changeDefaultSlotNames(slot: IComponentRender[]): any;
207
213
  callDisableSelection(row: IDictionary<any>): boolean;