@zeedhi/common 1.70.0 → 1.72.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 +23 -51
- package/dist/zd-common.umd.js +22 -51
- package/package.json +2 -2
- package/types/components/zd-iterable/column.d.ts +1 -0
- package/types/components/zd-iterable/interfaces.d.ts +1 -0
- package/types/components/zd-tree-grid/interfaces.d.ts +1 -0
- package/types/components/zd-tree-grid/tree-grid.d.ts +4 -0
- package/types/services/index.d.ts +0 -1
- package/types/services/zd-modal/modal-service.d.ts +1 -1
package/dist/zd-common.esm.js
CHANGED
|
@@ -2869,9 +2869,9 @@ class ModalService {
|
|
|
2869
2869
|
* Creates a new modal instance from JSON
|
|
2870
2870
|
* @param modal modal structure
|
|
2871
2871
|
*/
|
|
2872
|
-
static createFromJson(modalPath, local) {
|
|
2872
|
+
static createFromJson(modalPath, local, JSONCache) {
|
|
2873
2873
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2874
|
-
const modal = yield Metadata.get(modalPath, local);
|
|
2874
|
+
const modal = yield Metadata.get(modalPath, local, JSONCache);
|
|
2875
2875
|
return this.create(modal);
|
|
2876
2876
|
});
|
|
2877
2877
|
}
|
|
@@ -2948,37 +2948,6 @@ class LoadingService {
|
|
|
2948
2948
|
}
|
|
2949
2949
|
}
|
|
2950
2950
|
|
|
2951
|
-
class JsonCacheService {
|
|
2952
|
-
static saveJSONCache(jsonCollection) {
|
|
2953
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2954
|
-
const jsonCollectionInCache = jsonCollection.map((jsonItem) => __awaiter(this, void 0, void 0, function* () {
|
|
2955
|
-
const { path } = jsonItem;
|
|
2956
|
-
const metadata = yield Metadata.get(path, true);
|
|
2957
|
-
localStorage.setItem(path, JSON.stringify(metadata));
|
|
2958
|
-
}));
|
|
2959
|
-
yield Promise.all(jsonCollectionInCache);
|
|
2960
|
-
});
|
|
2961
|
-
}
|
|
2962
|
-
static getJSONCache(path) {
|
|
2963
|
-
const getMetadaFromCache = localStorage.getItem(path);
|
|
2964
|
-
let metadataValueReturn = false;
|
|
2965
|
-
if (typeof getMetadaFromCache === 'string') {
|
|
2966
|
-
metadataValueReturn = JSON.parse(getMetadaFromCache);
|
|
2967
|
-
}
|
|
2968
|
-
return metadataValueReturn;
|
|
2969
|
-
}
|
|
2970
|
-
static clearJSONCache(jsonCollection) {
|
|
2971
|
-
jsonCollection.map((jsonItem) => __awaiter(this, void 0, void 0, function* () {
|
|
2972
|
-
const { path } = jsonItem;
|
|
2973
|
-
localStorage.removeItem(path);
|
|
2974
|
-
}));
|
|
2975
|
-
}
|
|
2976
|
-
}
|
|
2977
|
-
/**
|
|
2978
|
-
* jsons collection
|
|
2979
|
-
*/
|
|
2980
|
-
JsonCacheService.jsonCollection = [];
|
|
2981
|
-
|
|
2982
2951
|
/**
|
|
2983
2952
|
* Base class for Dashboard component.
|
|
2984
2953
|
*/
|
|
@@ -4589,18 +4558,8 @@ class Frame extends ComponentRender {
|
|
|
4589
4558
|
}
|
|
4590
4559
|
getMetadata() {
|
|
4591
4560
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4592
|
-
let page;
|
|
4593
4561
|
try {
|
|
4594
|
-
|
|
4595
|
-
page = JsonCacheService.getJSONCache(this.path);
|
|
4596
|
-
if (page === false) {
|
|
4597
|
-
yield JsonCacheService.saveJSONCache([{ path: this.path }]);
|
|
4598
|
-
page = yield this.requestPage();
|
|
4599
|
-
}
|
|
4600
|
-
}
|
|
4601
|
-
else {
|
|
4602
|
-
page = yield this.requestPage();
|
|
4603
|
-
}
|
|
4562
|
+
const page = yield this.requestPage();
|
|
4604
4563
|
if (typeof page !== 'object')
|
|
4605
4564
|
throw new Error();
|
|
4606
4565
|
this.metadata = merge(page, this.override);
|
|
@@ -4640,7 +4599,7 @@ class Frame extends ComponentRender {
|
|
|
4640
4599
|
if (this.type === 'post') {
|
|
4641
4600
|
return Metadata.post(this.path, this.params);
|
|
4642
4601
|
}
|
|
4643
|
-
return Metadata.get(this.path, this.local);
|
|
4602
|
+
return Metadata.get(this.path, this.local, this.JSONCache);
|
|
4644
4603
|
}
|
|
4645
4604
|
const url = Metadata.getMetadataUrl(this.path, this.local);
|
|
4646
4605
|
const cache = yield caches.open(Frame.cacheName);
|
|
@@ -4753,6 +4712,7 @@ class Column extends Component {
|
|
|
4753
4712
|
this.align = 'left';
|
|
4754
4713
|
this.label = '';
|
|
4755
4714
|
this.mask = '';
|
|
4715
|
+
this.actionFixed = false;
|
|
4756
4716
|
this.sortable = true;
|
|
4757
4717
|
this.loading = false;
|
|
4758
4718
|
this.componentProps = {};
|
|
@@ -4801,6 +4761,7 @@ class Column extends Component {
|
|
|
4801
4761
|
this.mask = this.getInitValue('mask', props.mask, this.mask);
|
|
4802
4762
|
this.overflow = this.getInitValue('overflow', props.overflow, this.overflow);
|
|
4803
4763
|
this.type = this.getInitValue('type', props.type, this.type);
|
|
4764
|
+
this.actionFixed = this.getInitValue('actionFixed', props.actionFixed, this.actionFixed);
|
|
4804
4765
|
this.sortable = this.getInitValue('sortable', props.sortable, this.sortable);
|
|
4805
4766
|
this.loading = this.getInitValue('loading', props.loading, this.loading);
|
|
4806
4767
|
this.style = this.getInitValue('style', props.style, this.style);
|
|
@@ -4866,9 +4827,15 @@ class Column extends Component {
|
|
|
4866
4827
|
this.lookupData[value] = this.lookupDatasource.data[dataIndex];
|
|
4867
4828
|
return this.lookupData[value];
|
|
4868
4829
|
}
|
|
4869
|
-
|
|
4870
|
-
|
|
4871
|
-
|
|
4830
|
+
const hasLookupColumn = this.lookupDatasource.data.every((row) => Reflect.has(row, lookupColumn));
|
|
4831
|
+
if (hasLookupColumn) {
|
|
4832
|
+
this.dataToLookup = (this.dataToLookup || []);
|
|
4833
|
+
this.dataToLookup.push(value);
|
|
4834
|
+
this.lookup(lookupColumn);
|
|
4835
|
+
}
|
|
4836
|
+
else {
|
|
4837
|
+
console.warn(`Row datasource do not have a key: ${lookupColumn}`);
|
|
4838
|
+
}
|
|
4872
4839
|
return emptyRow;
|
|
4873
4840
|
}
|
|
4874
4841
|
/**
|
|
@@ -11609,6 +11576,7 @@ class TreeGrid extends Grid {
|
|
|
11609
11576
|
this.parentField = this.getInitValue('parentField', props.parentField, this.parentField);
|
|
11610
11577
|
this.fetchOnDemand = this.getInitValue('fetchOnDemand', props.fetchOnDemand, this.fetchOnDemand);
|
|
11611
11578
|
this.flat = this.getInitValue('flat', props.flat, this.flat);
|
|
11579
|
+
this.fieldHasChild = this.getInitValue('fieldHasChild', props.fieldHasChild, this.fieldHasChild);
|
|
11612
11580
|
this.detach = this.getInitValue('detach', props.detach, this.detach);
|
|
11613
11581
|
this.treeDataStructure = new TreeDataStructure(this);
|
|
11614
11582
|
this.createAccessors();
|
|
@@ -11727,7 +11695,9 @@ class TreeGrid extends Grid {
|
|
|
11727
11695
|
* @param isSelected row is selected
|
|
11728
11696
|
*/
|
|
11729
11697
|
selectRow(row, isSelected) {
|
|
11730
|
-
const childrenRows = !this.flat
|
|
11698
|
+
const childrenRows = !this.flat
|
|
11699
|
+
? this.treeDataStructure.getChildren(row)
|
|
11700
|
+
: [];
|
|
11731
11701
|
const rows = [row, ...childrenRows];
|
|
11732
11702
|
if (isSelected) {
|
|
11733
11703
|
this.selectedRows = this.removeDuplicates(this.selectedRows.concat(rows), this.datasource.uniqueKey);
|
|
@@ -11770,7 +11740,9 @@ class TreeGrid extends Grid {
|
|
|
11770
11740
|
selectParents(row) {
|
|
11771
11741
|
if (row[this.parentField]) {
|
|
11772
11742
|
const parentRow = this.treeDataStructure.getRowData(row).tree__parent;
|
|
11773
|
-
const every = this.treeDataStructure
|
|
11743
|
+
const every = this.treeDataStructure
|
|
11744
|
+
.getChildren(parentRow)
|
|
11745
|
+
.every((item) => {
|
|
11774
11746
|
const index = this.treeDataStructure.findDataIndex(this.selectedRows, item[this.datasource.uniqueKey]);
|
|
11775
11747
|
if (index > -1)
|
|
11776
11748
|
return true;
|
|
@@ -13438,4 +13410,4 @@ const AutoNumeric = require('@zeedhi/autonumeric/dist/autoNumeric');
|
|
|
13438
13410
|
const packageContent = require('../package.json');
|
|
13439
13411
|
VersionService.addPackageVersion(packageContent.name, packageContent.version);
|
|
13440
13412
|
|
|
13441
|
-
export { Alert, AlertService, ApexChart, AutoNumeric, Badge, Breadcrumbs, Button, ButtonGroup, CSVReport, Card, Carousel, Checkbox, CheckboxMultiple, ChildNotFoundError, Chip, CodeEditor, Col, CollapseCard, Column, ColumnNotFoundError, Component, ComponentRender, Container, Currency, Dashboard, Date$1 as Date, DateRange, Dialog, DialogService, Divider, Dropdown, FileInput, Footer, Form, Frame, FramePage, Grid, GridColumn, GridColumnEditable, GridEditable, Header, Icon, Icons, Image, Increment, Input, Iterable, IterableColumnsButton, IterableColumnsButtonController, IterableComponentRender, IterablePageComponent, IterablePageInfo, IterablePageSize, IterablePagination,
|
|
13413
|
+
export { Alert, AlertService, ApexChart, AutoNumeric, Badge, Breadcrumbs, Button, ButtonGroup, CSVReport, Card, Carousel, Checkbox, CheckboxMultiple, ChildNotFoundError, Chip, CodeEditor, Col, CollapseCard, Column, ColumnNotFoundError, Component, ComponentRender, Container, Currency, Dashboard, Date$1 as Date, DateRange, Dialog, DialogService, Divider, Dropdown, FileInput, Footer, Form, Frame, FramePage, Grid, GridColumn, GridColumnEditable, GridEditable, Header, Icon, Icons, Image, Increment, Input, Iterable, IterableColumnsButton, IterableColumnsButtonController, IterableComponentRender, IterablePageComponent, IterablePageInfo, IterablePageSize, IterablePagination, List, ListGroup, ListItem, Loading, LoadingService, Login, LoginButton, MasterDetail, Menu, MenuButton, MenuGroup, MenuLink, MenuSeparator, Modal, ModalCloseButton, ModalService, Month, Number$1 as Number, PDFReport, Password, Progress, Radio, RangeSlider, Report, Row, Search, Select, SelectMultiple, SelectTree, SelectTreeMultiple, SelectableList, SpeedDial, Steppers, SvgMap, Switch, Tab, Table, Tabs, Tag, Text, TextInput, Textarea, Time, Toggleable, Tooltip, Tree, TreeDataStructure, TreeGrid, TreeGridEditable, WatchURL, XLS2Report, XLS3Report, XLSReport, initTheme };
|
package/dist/zd-common.umd.js
CHANGED
|
@@ -2876,9 +2876,9 @@
|
|
|
2876
2876
|
* Creates a new modal instance from JSON
|
|
2877
2877
|
* @param modal modal structure
|
|
2878
2878
|
*/
|
|
2879
|
-
static createFromJson(modalPath, local) {
|
|
2879
|
+
static createFromJson(modalPath, local, JSONCache) {
|
|
2880
2880
|
return __awaiter(this, void 0, void 0, function* () {
|
|
2881
|
-
const modal = yield core.Metadata.get(modalPath, local);
|
|
2881
|
+
const modal = yield core.Metadata.get(modalPath, local, JSONCache);
|
|
2882
2882
|
return this.create(modal);
|
|
2883
2883
|
});
|
|
2884
2884
|
}
|
|
@@ -2955,37 +2955,6 @@
|
|
|
2955
2955
|
}
|
|
2956
2956
|
}
|
|
2957
2957
|
|
|
2958
|
-
class JsonCacheService {
|
|
2959
|
-
static saveJSONCache(jsonCollection) {
|
|
2960
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2961
|
-
const jsonCollectionInCache = jsonCollection.map((jsonItem) => __awaiter(this, void 0, void 0, function* () {
|
|
2962
|
-
const { path } = jsonItem;
|
|
2963
|
-
const metadata = yield core.Metadata.get(path, true);
|
|
2964
|
-
localStorage.setItem(path, JSON.stringify(metadata));
|
|
2965
|
-
}));
|
|
2966
|
-
yield Promise.all(jsonCollectionInCache);
|
|
2967
|
-
});
|
|
2968
|
-
}
|
|
2969
|
-
static getJSONCache(path) {
|
|
2970
|
-
const getMetadaFromCache = localStorage.getItem(path);
|
|
2971
|
-
let metadataValueReturn = false;
|
|
2972
|
-
if (typeof getMetadaFromCache === 'string') {
|
|
2973
|
-
metadataValueReturn = JSON.parse(getMetadaFromCache);
|
|
2974
|
-
}
|
|
2975
|
-
return metadataValueReturn;
|
|
2976
|
-
}
|
|
2977
|
-
static clearJSONCache(jsonCollection) {
|
|
2978
|
-
jsonCollection.map((jsonItem) => __awaiter(this, void 0, void 0, function* () {
|
|
2979
|
-
const { path } = jsonItem;
|
|
2980
|
-
localStorage.removeItem(path);
|
|
2981
|
-
}));
|
|
2982
|
-
}
|
|
2983
|
-
}
|
|
2984
|
-
/**
|
|
2985
|
-
* jsons collection
|
|
2986
|
-
*/
|
|
2987
|
-
JsonCacheService.jsonCollection = [];
|
|
2988
|
-
|
|
2989
2958
|
/**
|
|
2990
2959
|
* Base class for Dashboard component.
|
|
2991
2960
|
*/
|
|
@@ -4596,18 +4565,8 @@
|
|
|
4596
4565
|
}
|
|
4597
4566
|
getMetadata() {
|
|
4598
4567
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4599
|
-
let page;
|
|
4600
4568
|
try {
|
|
4601
|
-
|
|
4602
|
-
page = JsonCacheService.getJSONCache(this.path);
|
|
4603
|
-
if (page === false) {
|
|
4604
|
-
yield JsonCacheService.saveJSONCache([{ path: this.path }]);
|
|
4605
|
-
page = yield this.requestPage();
|
|
4606
|
-
}
|
|
4607
|
-
}
|
|
4608
|
-
else {
|
|
4609
|
-
page = yield this.requestPage();
|
|
4610
|
-
}
|
|
4569
|
+
const page = yield this.requestPage();
|
|
4611
4570
|
if (typeof page !== 'object')
|
|
4612
4571
|
throw new Error();
|
|
4613
4572
|
this.metadata = merge__default["default"](page, this.override);
|
|
@@ -4647,7 +4606,7 @@
|
|
|
4647
4606
|
if (this.type === 'post') {
|
|
4648
4607
|
return core.Metadata.post(this.path, this.params);
|
|
4649
4608
|
}
|
|
4650
|
-
return core.Metadata.get(this.path, this.local);
|
|
4609
|
+
return core.Metadata.get(this.path, this.local, this.JSONCache);
|
|
4651
4610
|
}
|
|
4652
4611
|
const url = core.Metadata.getMetadataUrl(this.path, this.local);
|
|
4653
4612
|
const cache = yield caches.open(Frame.cacheName);
|
|
@@ -4760,6 +4719,7 @@
|
|
|
4760
4719
|
this.align = 'left';
|
|
4761
4720
|
this.label = '';
|
|
4762
4721
|
this.mask = '';
|
|
4722
|
+
this.actionFixed = false;
|
|
4763
4723
|
this.sortable = true;
|
|
4764
4724
|
this.loading = false;
|
|
4765
4725
|
this.componentProps = {};
|
|
@@ -4808,6 +4768,7 @@
|
|
|
4808
4768
|
this.mask = this.getInitValue('mask', props.mask, this.mask);
|
|
4809
4769
|
this.overflow = this.getInitValue('overflow', props.overflow, this.overflow);
|
|
4810
4770
|
this.type = this.getInitValue('type', props.type, this.type);
|
|
4771
|
+
this.actionFixed = this.getInitValue('actionFixed', props.actionFixed, this.actionFixed);
|
|
4811
4772
|
this.sortable = this.getInitValue('sortable', props.sortable, this.sortable);
|
|
4812
4773
|
this.loading = this.getInitValue('loading', props.loading, this.loading);
|
|
4813
4774
|
this.style = this.getInitValue('style', props.style, this.style);
|
|
@@ -4873,9 +4834,15 @@
|
|
|
4873
4834
|
this.lookupData[value] = this.lookupDatasource.data[dataIndex];
|
|
4874
4835
|
return this.lookupData[value];
|
|
4875
4836
|
}
|
|
4876
|
-
|
|
4877
|
-
|
|
4878
|
-
|
|
4837
|
+
const hasLookupColumn = this.lookupDatasource.data.every((row) => Reflect.has(row, lookupColumn));
|
|
4838
|
+
if (hasLookupColumn) {
|
|
4839
|
+
this.dataToLookup = (this.dataToLookup || []);
|
|
4840
|
+
this.dataToLookup.push(value);
|
|
4841
|
+
this.lookup(lookupColumn);
|
|
4842
|
+
}
|
|
4843
|
+
else {
|
|
4844
|
+
console.warn(`Row datasource do not have a key: ${lookupColumn}`);
|
|
4845
|
+
}
|
|
4879
4846
|
return emptyRow;
|
|
4880
4847
|
}
|
|
4881
4848
|
/**
|
|
@@ -11616,6 +11583,7 @@
|
|
|
11616
11583
|
this.parentField = this.getInitValue('parentField', props.parentField, this.parentField);
|
|
11617
11584
|
this.fetchOnDemand = this.getInitValue('fetchOnDemand', props.fetchOnDemand, this.fetchOnDemand);
|
|
11618
11585
|
this.flat = this.getInitValue('flat', props.flat, this.flat);
|
|
11586
|
+
this.fieldHasChild = this.getInitValue('fieldHasChild', props.fieldHasChild, this.fieldHasChild);
|
|
11619
11587
|
this.detach = this.getInitValue('detach', props.detach, this.detach);
|
|
11620
11588
|
this.treeDataStructure = new TreeDataStructure(this);
|
|
11621
11589
|
this.createAccessors();
|
|
@@ -11734,7 +11702,9 @@
|
|
|
11734
11702
|
* @param isSelected row is selected
|
|
11735
11703
|
*/
|
|
11736
11704
|
selectRow(row, isSelected) {
|
|
11737
|
-
const childrenRows = !this.flat
|
|
11705
|
+
const childrenRows = !this.flat
|
|
11706
|
+
? this.treeDataStructure.getChildren(row)
|
|
11707
|
+
: [];
|
|
11738
11708
|
const rows = [row, ...childrenRows];
|
|
11739
11709
|
if (isSelected) {
|
|
11740
11710
|
this.selectedRows = this.removeDuplicates(this.selectedRows.concat(rows), this.datasource.uniqueKey);
|
|
@@ -11777,7 +11747,9 @@
|
|
|
11777
11747
|
selectParents(row) {
|
|
11778
11748
|
if (row[this.parentField]) {
|
|
11779
11749
|
const parentRow = this.treeDataStructure.getRowData(row).tree__parent;
|
|
11780
|
-
const every = this.treeDataStructure
|
|
11750
|
+
const every = this.treeDataStructure
|
|
11751
|
+
.getChildren(parentRow)
|
|
11752
|
+
.every((item) => {
|
|
11781
11753
|
const index = this.treeDataStructure.findDataIndex(this.selectedRows, item[this.datasource.uniqueKey]);
|
|
11782
11754
|
if (index > -1)
|
|
11783
11755
|
return true;
|
|
@@ -13499,7 +13471,6 @@
|
|
|
13499
13471
|
exports.IterablePageInfo = IterablePageInfo;
|
|
13500
13472
|
exports.IterablePageSize = IterablePageSize;
|
|
13501
13473
|
exports.IterablePagination = IterablePagination;
|
|
13502
|
-
exports.JsonCacheService = JsonCacheService;
|
|
13503
13474
|
exports.List = List;
|
|
13504
13475
|
exports.ListGroup = ListGroup;
|
|
13505
13476
|
exports.ListItem = ListItem;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeedhi/common",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.72.0",
|
|
4
4
|
"description": "Zeedhi Common",
|
|
5
5
|
"author": "Zeedhi <zeedhi@teknisa.com>",
|
|
6
6
|
"license": "ISC",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"lodash.times": "^4.3.2",
|
|
40
40
|
"mockdate": "^3.0.2"
|
|
41
41
|
},
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "4844a8a23f08e63110e73fddb458514a7f3bfa18"
|
|
43
43
|
}
|
|
@@ -19,6 +19,10 @@ export declare class TreeGrid extends Grid implements ITreeGrid {
|
|
|
19
19
|
* Defines if the tree will be fetch data only when opening a level
|
|
20
20
|
*/
|
|
21
21
|
fetchOnDemand: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Defines if the node tree has child
|
|
24
|
+
*/
|
|
25
|
+
fieldHasChild?: string;
|
|
22
26
|
/**
|
|
23
27
|
* Defines if should wait and not execute GET method when Datasource is created
|
|
24
28
|
*/
|
|
@@ -16,7 +16,7 @@ export declare class ModalService {
|
|
|
16
16
|
* Creates a new modal instance from JSON
|
|
17
17
|
* @param modal modal structure
|
|
18
18
|
*/
|
|
19
|
-
static createFromJson(modalPath: string, local?: boolean): Promise<Modal>;
|
|
19
|
+
static createFromJson(modalPath: string, local?: boolean, JSONCache?: boolean): Promise<Modal>;
|
|
20
20
|
/**
|
|
21
21
|
* Creates a new modal instance from JSON
|
|
22
22
|
* @param modal modal structure
|