@zeedhi/common 1.83.1 → 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.
- package/dist/zd-common.esm.js +44 -28
- package/dist/zd-common.umd.js +44 -28
- package/package.json +3 -3
- package/types/components/zd-grid/grid.d.ts +6 -0
package/dist/zd-common.esm.js
CHANGED
|
@@ -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 =
|
|
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((
|
|
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((
|
|
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((
|
|
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((
|
|
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((
|
|
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((
|
|
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
|
}
|
|
@@ -6215,43 +6218,56 @@ class Grid extends Iterable {
|
|
|
6215
6218
|
return response;
|
|
6216
6219
|
});
|
|
6217
6220
|
}
|
|
6218
|
-
|
|
6219
|
-
var _a, _b, _c
|
|
6221
|
+
getActionProps(actionComponent, column, row, parentPath) {
|
|
6222
|
+
var _a, _b, _c;
|
|
6220
6223
|
const rowKey = row[this.datasource.uniqueKey];
|
|
6221
6224
|
const compName = actionComponent.name;
|
|
6222
6225
|
const instanceName = `${compName}_${rowKey}`;
|
|
6223
6226
|
const path = parentPath ? `${parentPath}.${compName}` : compName;
|
|
6224
|
-
const
|
|
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]);
|
|
6225
6228
|
let newClickEvt;
|
|
6226
|
-
if ((_c =
|
|
6227
|
-
const compEvents = Event.factory(
|
|
6229
|
+
if ((_c = props.events) === null || _c === void 0 ? void 0 : _c.click) {
|
|
6230
|
+
const compEvents = Event.factory(props.events);
|
|
6228
6231
|
if (typeof compEvents.click === 'function') {
|
|
6229
6232
|
newClickEvt = ({ component, event, element }) => compEvents.click({
|
|
6230
6233
|
component, event, element, row, column,
|
|
6231
6234
|
});
|
|
6232
6235
|
}
|
|
6233
6236
|
}
|
|
6234
|
-
const
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
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;
|
|
6238
6243
|
try {
|
|
6239
|
-
|
|
6240
|
-
delete updatedComponent.datasource;
|
|
6241
|
-
delete updatedComponent.events;
|
|
6242
|
-
const instance = Metadata.updateInstance(instanceName, updatedComponent);
|
|
6244
|
+
instance = this.updateActionInstance(instanceName, props);
|
|
6243
6245
|
if (newClickEvt)
|
|
6244
6246
|
instance.events.click = newClickEvt;
|
|
6245
|
-
return instance;
|
|
6246
6247
|
}
|
|
6247
6248
|
catch (e) {
|
|
6248
|
-
|
|
6249
|
-
|
|
6250
|
-
|
|
6251
|
-
|
|
6252
|
-
|
|
6253
|
-
|
|
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;
|
|
6254
6269
|
}
|
|
6270
|
+
return props;
|
|
6255
6271
|
}
|
|
6256
6272
|
changeDefaultSlotNames(slot) {
|
|
6257
6273
|
const strMetadata = JSON.stringify(slot);
|
package/dist/zd-common.umd.js
CHANGED
|
@@ -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 =
|
|
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((
|
|
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((
|
|
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((
|
|
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((
|
|
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((
|
|
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((
|
|
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
|
}
|
|
@@ -6222,43 +6225,56 @@
|
|
|
6222
6225
|
return response;
|
|
6223
6226
|
});
|
|
6224
6227
|
}
|
|
6225
|
-
|
|
6226
|
-
var _a, _b, _c
|
|
6228
|
+
getActionProps(actionComponent, column, row, parentPath) {
|
|
6229
|
+
var _a, _b, _c;
|
|
6227
6230
|
const rowKey = row[this.datasource.uniqueKey];
|
|
6228
6231
|
const compName = actionComponent.name;
|
|
6229
6232
|
const instanceName = `${compName}_${rowKey}`;
|
|
6230
6233
|
const path = parentPath ? `${parentPath}.${compName}` : compName;
|
|
6231
|
-
const
|
|
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]);
|
|
6232
6235
|
let newClickEvt;
|
|
6233
|
-
if ((_c =
|
|
6234
|
-
const compEvents = core.Event.factory(
|
|
6236
|
+
if ((_c = props.events) === null || _c === void 0 ? void 0 : _c.click) {
|
|
6237
|
+
const compEvents = core.Event.factory(props.events);
|
|
6235
6238
|
if (typeof compEvents.click === 'function') {
|
|
6236
6239
|
newClickEvt = ({ component, event, element }) => compEvents.click({
|
|
6237
6240
|
component, event, element, row, column,
|
|
6238
6241
|
});
|
|
6239
6242
|
}
|
|
6240
6243
|
}
|
|
6241
|
-
const
|
|
6242
|
-
|
|
6243
|
-
|
|
6244
|
-
|
|
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;
|
|
6245
6250
|
try {
|
|
6246
|
-
|
|
6247
|
-
delete updatedComponent.datasource;
|
|
6248
|
-
delete updatedComponent.events;
|
|
6249
|
-
const instance = core.Metadata.updateInstance(instanceName, updatedComponent);
|
|
6251
|
+
instance = this.updateActionInstance(instanceName, props);
|
|
6250
6252
|
if (newClickEvt)
|
|
6251
6253
|
instance.events.click = newClickEvt;
|
|
6252
|
-
return instance;
|
|
6253
6254
|
}
|
|
6254
6255
|
catch (e) {
|
|
6255
|
-
|
|
6256
|
-
|
|
6257
|
-
|
|
6258
|
-
|
|
6259
|
-
|
|
6260
|
-
|
|
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;
|
|
6261
6276
|
}
|
|
6277
|
+
return props;
|
|
6262
6278
|
}
|
|
6263
6279
|
changeDefaultSlotNames(slot) {
|
|
6264
6280
|
const strMetadata = JSON.stringify(slot);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/common",
|
|
3
|
-
"version": "1.
|
|
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": "
|
|
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;
|