@trudb/tru-common-lib 0.0.298 → 0.0.300
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/esm2020/lib/base-classes/tru-search-control-range-base.mjs +47 -0
- package/esm2020/lib/components/data-grid/tru-data-grid.mjs +9 -9
- package/esm2020/lib/services/tru-util.mjs +10 -1
- package/esm2020/public-api.mjs +2 -1
- package/fesm2015/trudb-tru-common-lib.mjs +63 -9
- package/fesm2015/trudb-tru-common-lib.mjs.map +1 -1
- package/fesm2020/trudb-tru-common-lib.mjs +63 -9
- package/fesm2020/trudb-tru-common-lib.mjs.map +1 -1
- package/lib/base-classes/tru-search-control-range-base.d.ts +25 -0
- package/lib/services/tru-util.d.ts +1 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -24,6 +24,7 @@ import * as i1$4 from '@angular/material/select';
|
|
|
24
24
|
import { MatSelectModule } from '@angular/material/select';
|
|
25
25
|
import * as i5 from '@angular/material/core';
|
|
26
26
|
import { MatOptionModule } from '@angular/material/core';
|
|
27
|
+
import moment$1 from 'moment';
|
|
27
28
|
import { MatButtonModule } from '@angular/material/button';
|
|
28
29
|
import { MatInputModule } from '@angular/material/input';
|
|
29
30
|
import * as i1$5 from '@angular/platform-browser';
|
|
@@ -111,6 +112,51 @@ class TruSearchControlConfigBase {
|
|
|
111
112
|
constructor() { }
|
|
112
113
|
}
|
|
113
114
|
|
|
115
|
+
/*
|
|
116
|
+
* The abstract class needs the Angular @Component decorator in order in implement @Input
|
|
117
|
+
*/
|
|
118
|
+
class TruSearchControlRangeBase {
|
|
119
|
+
constructor() {
|
|
120
|
+
this.operatorLookup = {
|
|
121
|
+
'equal': 'eq',
|
|
122
|
+
'not-equal': 'not-eq',
|
|
123
|
+
'greater-than': 'gt',
|
|
124
|
+
'greater-than-or-equal': 'ge',
|
|
125
|
+
'less-than': 'lt',
|
|
126
|
+
'less-than-or-equal': 'le',
|
|
127
|
+
'contains': 'contains',
|
|
128
|
+
'default': 'eq'
|
|
129
|
+
};
|
|
130
|
+
this.operatorIconLookup = {
|
|
131
|
+
'equal': 'equal-operator-icon',
|
|
132
|
+
'not-equal': 'not-equal-operator-icon',
|
|
133
|
+
'greater-than': 'greater-than-operator-icon',
|
|
134
|
+
'greater-than-or-equal': 'greater-than-or-equal-operator-icon',
|
|
135
|
+
'less-than': 'less-than-operator-icon',
|
|
136
|
+
'less-than-or-equal': 'less-than-or-equal-operator-icon',
|
|
137
|
+
'contains': 'contains-operator-icon',
|
|
138
|
+
'default': 'equal-operator-icon',
|
|
139
|
+
};
|
|
140
|
+
this.operatorIconTitleLookup = {
|
|
141
|
+
'equal': 'Equal To',
|
|
142
|
+
'not-equal': 'Not Equal To',
|
|
143
|
+
'greater-than': 'Greater Than',
|
|
144
|
+
'greater-than-or-equal': 'Greater Than Or Equal To',
|
|
145
|
+
'less-than': 'Less Than',
|
|
146
|
+
'less-than-or-equal': 'Less Than Or Equal To',
|
|
147
|
+
'contains': 'Contains',
|
|
148
|
+
'default': 'Equal To',
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
TruSearchControlRangeBase.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruSearchControlRangeBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
153
|
+
TruSearchControlRangeBase.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.1", type: TruSearchControlRangeBase, inputs: { config: "config" }, ngImport: i0 });
|
|
154
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImport: i0, type: TruSearchControlRangeBase, decorators: [{
|
|
155
|
+
type: Directive
|
|
156
|
+
}], propDecorators: { config: [{
|
|
157
|
+
type: Input
|
|
158
|
+
}] } });
|
|
159
|
+
|
|
114
160
|
class TruSearchConfigBase {
|
|
115
161
|
constructor() { }
|
|
116
162
|
}
|
|
@@ -1636,6 +1682,14 @@ class TruUtil {
|
|
|
1636
1682
|
}
|
|
1637
1683
|
return null;
|
|
1638
1684
|
};
|
|
1685
|
+
this.strIsDate = (date, format = undefined) => {
|
|
1686
|
+
if (moment$1(date, format || "MM/DD/YYYY", true).isValid()) {
|
|
1687
|
+
return true;
|
|
1688
|
+
}
|
|
1689
|
+
else {
|
|
1690
|
+
return false;
|
|
1691
|
+
}
|
|
1692
|
+
};
|
|
1639
1693
|
}
|
|
1640
1694
|
tryParseBool(value, defaultValue) {
|
|
1641
1695
|
return (value == 'true' || value == 'false' || value === true || value === false) && JSON.parse(value) || defaultValue;
|
|
@@ -1786,7 +1840,7 @@ class TruDataGrid {
|
|
|
1786
1840
|
this.gridOptions.api.forEachNode((rowNode, index) => {
|
|
1787
1841
|
return rowNodes.push(rowNode);
|
|
1788
1842
|
});
|
|
1789
|
-
for (
|
|
1843
|
+
for (let i = rowNodes.length - 1; i >= 0; --i)
|
|
1790
1844
|
if (rowNodes[i].data.$entity[this.selectedResultConfig.value.entityType.name + 'Ref'] < 0)
|
|
1791
1845
|
this.gridOptions.api.updateRowData({ remove: [rowNodes[i].data] });
|
|
1792
1846
|
this.gridOptions.api.redrawRows();
|
|
@@ -1795,8 +1849,8 @@ class TruDataGrid {
|
|
|
1795
1849
|
this.appEnvironment.onDeleteComplete$.subscribe(event => {
|
|
1796
1850
|
if (event?.successful && event.entities && event.entities.length) {
|
|
1797
1851
|
let rowsToRemove = [];
|
|
1798
|
-
for (
|
|
1799
|
-
for (
|
|
1852
|
+
for (let i = this.rowData.length - 1; i >= 0; i--) {
|
|
1853
|
+
for (let j = event.entities.length - 1; j >= 0; j--) {
|
|
1800
1854
|
if (this.rowData[i].$entity === event.entities[j])
|
|
1801
1855
|
rowsToRemove.push(this.rowData[i]);
|
|
1802
1856
|
}
|
|
@@ -1817,8 +1871,8 @@ class TruDataGrid {
|
|
|
1817
1871
|
this.rowData = associatedEntities.map(this.enhanceRowDataForEntity, associatedEntities);
|
|
1818
1872
|
else
|
|
1819
1873
|
associatedEntities = this.rowData.map((e) => { return e.$entity; });
|
|
1820
|
-
|
|
1821
|
-
|
|
1874
|
+
let associatableTypeName = this.selectedResultConfig.value.entityManyToManyType.name;
|
|
1875
|
+
let associatedMapOfAssociatable = _.map(associatedEntities, function (e) { return e['o' + associatableTypeName]; });
|
|
1822
1876
|
this.unassociatedChoices = associatableEntities.filter(object1 => {
|
|
1823
1877
|
return !associatedMapOfAssociatable.some(object2 => { return object1.value.$ === object2[associatableTypeName + 'Ref']; });
|
|
1824
1878
|
});
|
|
@@ -1827,7 +1881,7 @@ class TruDataGrid {
|
|
|
1827
1881
|
this.uiNotification.showExportDialog().then((result) => {
|
|
1828
1882
|
if (!result)
|
|
1829
1883
|
return;
|
|
1830
|
-
|
|
1884
|
+
let exportGridSpec;
|
|
1831
1885
|
if (this.selectedResultConfig.value.entityType)
|
|
1832
1886
|
exportGridSpec = this.selectedResultConfig.value.entityType.name;
|
|
1833
1887
|
else
|
|
@@ -1914,7 +1968,7 @@ class TruDataGrid {
|
|
|
1914
1968
|
}
|
|
1915
1969
|
}
|
|
1916
1970
|
else {
|
|
1917
|
-
|
|
1971
|
+
let newEntity = this.enhanceRowDataForEntity(this.dataContext.entityAccess().add(this.selectedResultConfig.value.entityType));
|
|
1918
1972
|
this.gridOptions.api.applyTransaction({ add: [newEntity], addIndex: 0 });
|
|
1919
1973
|
}
|
|
1920
1974
|
};
|
|
@@ -1961,7 +2015,7 @@ class TruDataGrid {
|
|
|
1961
2015
|
this.onSearch(this.selectedResultConfig.value.setupQuery(this.entity));
|
|
1962
2016
|
}
|
|
1963
2017
|
ngAfterViewInit() {
|
|
1964
|
-
|
|
2018
|
+
let mappedResultConfigs = this.config.resultConfigs.map((config) => { return { label: config.name, value: config }; }, this.resultConfigs);
|
|
1965
2019
|
this.resultConfigs = mappedResultConfigs;
|
|
1966
2020
|
this.selectedResultConfig = mappedResultConfigs[0];
|
|
1967
2021
|
this.columnDefs = mappedResultConfigs[0].value.columnDefs;
|
|
@@ -4871,5 +4925,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.1", ngImpor
|
|
|
4871
4925
|
* Generated bundle index. Do not edit.
|
|
4872
4926
|
*/
|
|
4873
4927
|
|
|
4874
|
-
export { DetailViewModule, TruAppEnvironment, TruBreezeContext, TruBreezeContextFactory, TruBreezeMetadataProvider, TruChoice, TruColumn, TruColumnModule, TruCommonModule, TruComponentConfigBase, TruComponentLookup, TruConfirmDialog, TruConfirmDialogConfig, TruConfirmDialogModule, TruContextFilter, TruContextFilterChoice, TruContextFilters, TruControlComponentConfigBase, TruDataContext, TruDataGrid, TruDataGridModule, TruDataGridTypes, TruDesktop, TruDesktopManager, TruDesktopModule, TruDetailViewBase, TruEntityAccessor, TruEntityBase, TruExportDialog, TruExportDialogConfig, TruExportDialogModule, TruForm, TruFormModule, TruFormulaEval, TruGroupBox, TruGroupBoxModule, TruPredicate, TruPredicateMap, TruPropertyConfigBase, TruPropertyConfigCloudFile, TruPropertyConfigDate, TruPropertyConfigDecimal, TruPropertyConfigFile, TruPropertyConfigForeignKey, TruPropertyConfigInteger, TruPropertyConfigPassword, TruPropertyConfigPercentage, TruPropertyConfigScientific, TruPropertyConfigText, TruPropertyConfigTextChoices, TruPropertyConfigUsaAddress, TruPropertyConfigZipCode, TruQueryPredicateManager, TruRow, TruRowModule, TruSearchConfigBase, TruSearchControlBase, TruSearchControlConfigBase, TruSearchIconModule, TruSearchPanelPositionManager, TruSearchPanelPositionManagerModule, TruSearchViewBase, TruSearchViewBaseModule, TruSearchViewControlEventHandler, TruSearchViewEventHandler, TruSort, TruTableConfigBase, TruTextManager, TruToolbar, TruToolbarButton, TruToolbarButtonModule, TruToolbarContextFilter, TruToolbarContextFilterModule, TruToolbarDropdown, TruToolbarDropdownModule, TruToolbarMenu, TruToolbarMenuModule, TruToolbarModule, TruToolbarSeparator, TruToolbarSeparatorModule, TruToolbarText, TruToolbarTextModule, TruUiNotification, TruUser, TruUtil, TruWindowActionEventHandler, TruWindowAddViewEventArgs, TruWindowEventArgs, TruWindowEventHandler };
|
|
4928
|
+
export { DetailViewModule, TruAppEnvironment, TruBreezeContext, TruBreezeContextFactory, TruBreezeMetadataProvider, TruChoice, TruColumn, TruColumnModule, TruCommonModule, TruComponentConfigBase, TruComponentLookup, TruConfirmDialog, TruConfirmDialogConfig, TruConfirmDialogModule, TruContextFilter, TruContextFilterChoice, TruContextFilters, TruControlComponentConfigBase, TruDataContext, TruDataGrid, TruDataGridModule, TruDataGridTypes, TruDesktop, TruDesktopManager, TruDesktopModule, TruDetailViewBase, TruEntityAccessor, TruEntityBase, TruExportDialog, TruExportDialogConfig, TruExportDialogModule, TruForm, TruFormModule, TruFormulaEval, TruGroupBox, TruGroupBoxModule, TruPredicate, TruPredicateMap, TruPropertyConfigBase, TruPropertyConfigCloudFile, TruPropertyConfigDate, TruPropertyConfigDecimal, TruPropertyConfigFile, TruPropertyConfigForeignKey, TruPropertyConfigInteger, TruPropertyConfigPassword, TruPropertyConfigPercentage, TruPropertyConfigScientific, TruPropertyConfigText, TruPropertyConfigTextChoices, TruPropertyConfigUsaAddress, TruPropertyConfigZipCode, TruQueryPredicateManager, TruRow, TruRowModule, TruSearchConfigBase, TruSearchControlBase, TruSearchControlConfigBase, TruSearchControlRangeBase, TruSearchIconModule, TruSearchPanelPositionManager, TruSearchPanelPositionManagerModule, TruSearchViewBase, TruSearchViewBaseModule, TruSearchViewControlEventHandler, TruSearchViewEventHandler, TruSort, TruTableConfigBase, TruTextManager, TruToolbar, TruToolbarButton, TruToolbarButtonModule, TruToolbarContextFilter, TruToolbarContextFilterModule, TruToolbarDropdown, TruToolbarDropdownModule, TruToolbarMenu, TruToolbarMenuModule, TruToolbarModule, TruToolbarSeparator, TruToolbarSeparatorModule, TruToolbarText, TruToolbarTextModule, TruUiNotification, TruUser, TruUtil, TruWindowActionEventHandler, TruWindowAddViewEventArgs, TruWindowEventArgs, TruWindowEventHandler };
|
|
4875
4929
|
//# sourceMappingURL=trudb-tru-common-lib.mjs.map
|