ps-toolkit-ui 0.0.113 → 0.0.114
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/bundles/ps-toolkit-ui.umd.js +224 -220
- package/bundles/ps-toolkit-ui.umd.js.map +1 -1
- package/bundles/ps-toolkit-ui.umd.min.js +1 -1
- package/bundles/ps-toolkit-ui.umd.min.js.map +1 -1
- package/esm2015/lib/classes/table.class.js +2 -101
- package/esm2015/lib/components/table/row/table.row.component.js +141 -38
- package/fesm2015/ps-toolkit-ui.js +184 -181
- package/fesm2015/ps-toolkit-ui.js.map +1 -1
- package/package.json +1 -1
- package/ps-toolkit-ui.metadata.json +1 -1
|
@@ -1842,6 +1842,51 @@ TablePaginationComponent.propDecorators = {
|
|
|
1842
1842
|
table: [{ type: Input }]
|
|
1843
1843
|
};
|
|
1844
1844
|
|
|
1845
|
+
class PermissionClass {
|
|
1846
|
+
constructor(Name = '', Icon = '', Type = null, InputType = null, InputAction = null, Area = '', Controller = '', Action = '', Condition = null, Accesses = []) {
|
|
1847
|
+
this.Name = Name;
|
|
1848
|
+
this.Icon = Icon;
|
|
1849
|
+
this.Type = Type;
|
|
1850
|
+
this.InputType = InputType;
|
|
1851
|
+
this.InputAction = InputAction;
|
|
1852
|
+
this.Area = Area;
|
|
1853
|
+
this.Controller = Controller;
|
|
1854
|
+
this.Action = Action;
|
|
1855
|
+
this.Condition = Condition;
|
|
1856
|
+
this.Accesses = Accesses;
|
|
1857
|
+
this.RelatedId = null;
|
|
1858
|
+
this.OnClick = null;
|
|
1859
|
+
}
|
|
1860
|
+
getAccess(a) {
|
|
1861
|
+
const c = this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Access);
|
|
1862
|
+
return c.length > 0 ? c[0] : null;
|
|
1863
|
+
}
|
|
1864
|
+
hasAccess(a) {
|
|
1865
|
+
return this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Access).length > 0;
|
|
1866
|
+
}
|
|
1867
|
+
getAccesses() {
|
|
1868
|
+
return this.Accesses.filter(x => x.Type === PermissionTypeEnum.Access);
|
|
1869
|
+
}
|
|
1870
|
+
delete(a) {
|
|
1871
|
+
this.Accesses = this.Accesses.filter(x => x.Action !== a);
|
|
1872
|
+
}
|
|
1873
|
+
hasOption(a) {
|
|
1874
|
+
return this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Option).length > 0;
|
|
1875
|
+
}
|
|
1876
|
+
getOptions() {
|
|
1877
|
+
return this.Accesses.filter(x => x.Type === PermissionTypeEnum.Option);
|
|
1878
|
+
}
|
|
1879
|
+
getOption(a) {
|
|
1880
|
+
const c = this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Option);
|
|
1881
|
+
return c.length > 0 ? c[0] : null;
|
|
1882
|
+
}
|
|
1883
|
+
getUrl() {
|
|
1884
|
+
return (this.Area ? '/' + this.Area : '') + '/' + this.Controller + '/' +
|
|
1885
|
+
(this.RelatedId ? `${this.RelatedId}/` : '') +
|
|
1886
|
+
(this.Action ? this.Action : '');
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1845
1890
|
class TableRowComponent {
|
|
1846
1891
|
constructor(service) {
|
|
1847
1892
|
this.service = service;
|
|
@@ -1874,23 +1919,23 @@ class TableRowComponent {
|
|
|
1874
1919
|
if (this.table.permissions.hasAccess('Insert')) {
|
|
1875
1920
|
this.addChildren = new InputClass(this.table.environment, this.table.l, this.table.name + 'AddSubsetTitle', 'fad fa-plus fa-rotate-90', InputType.Icon, 'green m-h-5 h-25 d-ib va-m f-u');
|
|
1876
1921
|
this.addChildren.onClick = () => {
|
|
1877
|
-
this.table.form.inputs.find(x => x.name === 'ParentId').setValue(this.row.Id, false);
|
|
1922
|
+
this.table.form.inputs.find(x => x.name === 'ParentId').setValue(this.row.Data.Id, false);
|
|
1878
1923
|
this.table.form.onSuccessBase = () => {
|
|
1879
1924
|
this.table.modal.hide();
|
|
1880
1925
|
this.showChildren.type = InputType.Icon;
|
|
1881
|
-
this.loadChildren(this.row.Id);
|
|
1926
|
+
this.loadChildren(this.row.Data.Id);
|
|
1882
1927
|
};
|
|
1883
1928
|
this.table.showInsertModal();
|
|
1884
1929
|
};
|
|
1885
1930
|
}
|
|
1886
|
-
this.showChildren = new InputClass(this.table.environment, this.table.l, this.table.name + 'SubsetTitle', 'fad fa-angle-left f-s-22', this.row.CountChild > 0 || (!this.table.childrenAutoLoad && this.children.length > 0) ? InputType.Icon : InputType.Hidden, 'h-25 m-h-5 d-ib va-m f-u');
|
|
1931
|
+
this.showChildren = new InputClass(this.table.environment, this.table.l, this.table.name + 'SubsetTitle', 'fad fa-angle-left f-s-22', this.row.Data.CountChild > 0 || (!this.table.childrenAutoLoad && this.children.length > 0) ? InputType.Icon : InputType.Hidden, 'h-25 m-h-5 d-ib va-m f-u');
|
|
1887
1932
|
this.showChildren.onClick = () => {
|
|
1888
1933
|
if ($(this.childrenDiv.nativeElement).is(':visible')) {
|
|
1889
1934
|
$(this.childrenDiv.nativeElement).hide();
|
|
1890
1935
|
this.showChildren.icon = 'fad fa-angle-left f-s-22';
|
|
1891
1936
|
}
|
|
1892
1937
|
else if (this.children.length === 0) {
|
|
1893
|
-
this.loadChildren(this.row.Id);
|
|
1938
|
+
this.loadChildren(this.row.Data.Id);
|
|
1894
1939
|
}
|
|
1895
1940
|
else {
|
|
1896
1941
|
$(this.childrenDiv.nativeElement).show();
|
|
@@ -1899,8 +1944,8 @@ class TableRowComponent {
|
|
|
1899
1944
|
};
|
|
1900
1945
|
}
|
|
1901
1946
|
if (this.table.hasStatus) {
|
|
1902
|
-
this.optStatus = new InputClass(this.table.environment, this.table.l, 'Status', this.row.Active ? 'fa-toggle-on' : 'fa-toggle-off', InputType.Icon, 'm-h-5 h-20 ' + (this.row.Active ? 'green' : ''));
|
|
1903
|
-
this.optStatus.row = this.row;
|
|
1947
|
+
this.optStatus = new InputClass(this.table.environment, this.table.l, 'Status', this.row.Data.Active ? 'fa-toggle-on' : 'fa-toggle-off', InputType.Icon, 'm-h-5 h-20 ' + (this.row.Data.Active ? 'green' : ''));
|
|
1948
|
+
this.optStatus.row = this.row.Data;
|
|
1904
1949
|
this.optStatus.onClick = (btn) => {
|
|
1905
1950
|
new RequestClass(this.table.l).send(this.table.url + '/Status/' + btn.row.Id, Method.Post, null, btn, (r) => {
|
|
1906
1951
|
btn.class = 'm-h-5 h-20 ' + (r ? 'green' : '');
|
|
@@ -1912,12 +1957,12 @@ class TableRowComponent {
|
|
|
1912
1957
|
if (this.optEdit !== null) {
|
|
1913
1958
|
if (this.table.form) {
|
|
1914
1959
|
this.optEdit.onClick = () => {
|
|
1915
|
-
this.table.form.url = this.table.url + 'Update/' + this.row.Id;
|
|
1916
|
-
if (this.table.hasChildren && this.row.ParentId != null) {
|
|
1960
|
+
this.table.form.url = this.table.url + 'Update/' + this.row.Data.Id;
|
|
1961
|
+
if (this.table.hasChildren && this.row.Data.ParentId != null) {
|
|
1917
1962
|
this.table.form.onSuccessBase = () => {
|
|
1918
1963
|
this.table.modal.hide();
|
|
1919
1964
|
if (this.table.childrenAutoLoad) {
|
|
1920
|
-
this.loadParent.emit(this.row.ParentId);
|
|
1965
|
+
this.loadParent.emit(this.row.Data.ParentId);
|
|
1921
1966
|
}
|
|
1922
1967
|
else {
|
|
1923
1968
|
this.table.load();
|
|
@@ -1937,7 +1982,7 @@ class TableRowComponent {
|
|
|
1937
1982
|
};
|
|
1938
1983
|
}
|
|
1939
1984
|
else {
|
|
1940
|
-
this.optEdit.url = this.table.url + '/Update/' + this.row.Id;
|
|
1985
|
+
this.optEdit.url = this.table.url + '/Update/' + this.row.Data.Id;
|
|
1941
1986
|
}
|
|
1942
1987
|
}
|
|
1943
1988
|
if (this.optDelete != null) {
|
|
@@ -1946,13 +1991,13 @@ class TableRowComponent {
|
|
|
1946
1991
|
this.table.form.clear();
|
|
1947
1992
|
}
|
|
1948
1993
|
if (this.table.permissions.Type === PermissionTypeEnum.Form) {
|
|
1949
|
-
this.table.rows = this.table.rows.filter(x => x.Id !== this.row.Id);
|
|
1950
|
-
this.changeRows.emit(this.row);
|
|
1994
|
+
this.table.rows = this.table.rows.filter(x => x.Id !== this.row.Data.Id);
|
|
1995
|
+
this.changeRows.emit(this.row.Data);
|
|
1951
1996
|
}
|
|
1952
1997
|
else {
|
|
1953
|
-
this.confirmShow.emit({ id: this.row.Id, accept: () => {
|
|
1954
|
-
if (this.table.hasChildren && this.table.childrenAutoLoad && this.row.ParentId != null) {
|
|
1955
|
-
this.loadParent.emit(this.row.ParentId);
|
|
1998
|
+
this.confirmShow.emit({ id: this.row.Data.Id, accept: () => {
|
|
1999
|
+
if (this.table.hasChildren && this.table.childrenAutoLoad && this.row.Data.ParentId != null) {
|
|
2000
|
+
this.loadParent.emit(this.row.Data.ParentId);
|
|
1956
2001
|
}
|
|
1957
2002
|
else {
|
|
1958
2003
|
this.table.load();
|
|
@@ -1975,7 +2020,7 @@ class TableRowComponent {
|
|
|
1975
2020
|
});
|
|
1976
2021
|
}
|
|
1977
2022
|
select() {
|
|
1978
|
-
this.row.selected = !this.row.selected;
|
|
2023
|
+
this.row.Data.selected = !this.row.Data.selected;
|
|
1979
2024
|
}
|
|
1980
2025
|
onChangeRows(e) {
|
|
1981
2026
|
return this.changeRows.emit(e);
|
|
@@ -2005,25 +2050,127 @@ class TableRowComponent {
|
|
|
2005
2050
|
}, 500);
|
|
2006
2051
|
}
|
|
2007
2052
|
getOptions() {
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
i.url = i.url.replace('{}', this.row.Id);
|
|
2053
|
+
const opts = this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ?
|
|
2054
|
+
[this.addChildren] : [];
|
|
2055
|
+
for (const option of this.row.Options) {
|
|
2056
|
+
if (this.options.filter(x => x.name === option.Name).length > 0) {
|
|
2057
|
+
continue;
|
|
2014
2058
|
}
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
|
|
2020
|
-
|
|
2059
|
+
const opt = new InputClass(this.table.environment, this.table.l, option.Name, option.Icon, option.InputType === PermissionInputTypeEnum.Icon ? InputType.Icon : InputType.Button, 'blue h-25 m-h-5 d-ib va-m f-u');
|
|
2060
|
+
opt.condition = option.Condition;
|
|
2061
|
+
if (option.InputAction === PermissionInputActionEnum.Link || option.InputAction === PermissionInputActionEnum.LinkNewTab) {
|
|
2062
|
+
const p = new PermissionClass();
|
|
2063
|
+
p.RelatedId = this.table.permissions.RelatedId;
|
|
2064
|
+
p.Area = this.table.permissions.Area;
|
|
2065
|
+
p.Controller = option.Controller ? option.Controller : this.table.permissions.Controller;
|
|
2066
|
+
p.Action = this.table.permissions.Action;
|
|
2067
|
+
opt.url = p.getUrl() + option.Action + '/{}';
|
|
2068
|
+
opt.urlNewTab = option.InputAction === PermissionInputActionEnum.LinkNewTab;
|
|
2069
|
+
}
|
|
2070
|
+
else if (option.InputAction === PermissionInputActionEnum.Modal) {
|
|
2071
|
+
opt.modal = option.Modal;
|
|
2072
|
+
opt.onClick = (btn) => {
|
|
2073
|
+
if (opt.modal.table) {
|
|
2074
|
+
const p = new PermissionClass();
|
|
2075
|
+
p.RelatedId = btn.row.Id;
|
|
2076
|
+
p.Area = this.table.permissions.Area;
|
|
2077
|
+
p.Controller = this.table.permissions.Controller;
|
|
2078
|
+
p.Action = option.Action;
|
|
2079
|
+
p.Accesses = option.Accesses;
|
|
2080
|
+
opt.modal.table.permissions = p;
|
|
2081
|
+
if (opt.modal.table.form) {
|
|
2082
|
+
opt.modal.table.form.url = p.getUrl() + 'Insert';
|
|
2083
|
+
opt.modal.table.form.baseUrl = p.getUrl() + 'Insert';
|
|
2084
|
+
}
|
|
2085
|
+
opt.modal.table.set();
|
|
2086
|
+
}
|
|
2087
|
+
if (opt.modal.form) {
|
|
2088
|
+
opt.modal.form.name = option.Name;
|
|
2089
|
+
opt.modal.form.url = opt.modal.form.baseUrl + 'Update/' + btn.row.Id;
|
|
2090
|
+
opt.modal.form.loadData(opt.modal.form.baseUrl + 'Get/' + btn.row.Id);
|
|
2091
|
+
opt.modal.form.onSuccessBase = () => {
|
|
2092
|
+
opt.modal.hide();
|
|
2093
|
+
};
|
|
2094
|
+
}
|
|
2095
|
+
if (opt.modal.accordion) {
|
|
2096
|
+
for (const r of opt.modal.accordion.rows) {
|
|
2097
|
+
if (r.table) {
|
|
2098
|
+
const p = new PermissionClass();
|
|
2099
|
+
p.RelatedId = btn.row.Id;
|
|
2100
|
+
p.Area = this.table.permissions.Area;
|
|
2101
|
+
p.Controller = this.table.permissions.Controller;
|
|
2102
|
+
p.Action = r.name;
|
|
2103
|
+
p.Accesses = option.Accesses;
|
|
2104
|
+
r.table.permissions = p;
|
|
2105
|
+
if (r.table.form) {
|
|
2106
|
+
r.table.form.url = p.getUrl() + 'Insert';
|
|
2107
|
+
r.table.form.baseUrl = p.getUrl() + 'Insert';
|
|
2108
|
+
}
|
|
2109
|
+
r.table.set();
|
|
2110
|
+
}
|
|
2111
|
+
}
|
|
2112
|
+
}
|
|
2113
|
+
};
|
|
2114
|
+
}
|
|
2115
|
+
else if (option.InputAction === PermissionInputActionEnum.Report) {
|
|
2116
|
+
const p = new PermissionClass();
|
|
2117
|
+
p.RelatedId = 'Index';
|
|
2118
|
+
p.Area = this.table.permissions.Area;
|
|
2119
|
+
p.Controller = 'Print';
|
|
2120
|
+
p.Action = option.Action;
|
|
2121
|
+
opt.url = '/Report' + p.getUrl() + '/{}';
|
|
2122
|
+
opt.urlNewTab = true;
|
|
2123
|
+
}
|
|
2124
|
+
else if (option.InputAction === PermissionInputActionEnum.File) {
|
|
2125
|
+
const p = new PermissionClass();
|
|
2126
|
+
p.RelatedId = this.table.permissions.RelatedId;
|
|
2127
|
+
p.Area = this.table.permissions.Area;
|
|
2128
|
+
p.Controller = this.table.permissions.Controller;
|
|
2129
|
+
p.Action = (this.table.permissions.Action ? this.table.permissions.Action : '') + option.Action;
|
|
2130
|
+
opt.url = '/File' + p.getUrl() + '/{}';
|
|
2131
|
+
opt.urlNewTab = true;
|
|
2132
|
+
}
|
|
2133
|
+
else if (option.InputAction === PermissionInputActionEnum.Confirm) {
|
|
2134
|
+
opt.onClick = (btn) => {
|
|
2135
|
+
const p = new PermissionClass();
|
|
2136
|
+
p.RelatedId = this.table.permissions.RelatedId;
|
|
2137
|
+
p.Area = this.table.permissions.Area;
|
|
2138
|
+
p.Controller = this.table.permissions.Controller;
|
|
2139
|
+
p.Action = option.Action;
|
|
2140
|
+
this.table.showConfirm(this.table.l(option.Action + 'Confirm'), p.getUrl() + '/' + btn.row.Id, null, () => {
|
|
2141
|
+
this.table.load();
|
|
2142
|
+
});
|
|
2143
|
+
};
|
|
2144
|
+
}
|
|
2145
|
+
else if (option.Type === PermissionTypeEnum.Option) {
|
|
2146
|
+
if (option.OnClick) {
|
|
2147
|
+
opt.onClick = (btn) => {
|
|
2148
|
+
option.OnClick(btn);
|
|
2149
|
+
};
|
|
2150
|
+
}
|
|
2151
|
+
}
|
|
2152
|
+
opts.push(opt);
|
|
2153
|
+
}
|
|
2154
|
+
return opts;
|
|
2155
|
+
// return (this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ? [this.addChildren] : [])
|
|
2156
|
+
// .concat(this.table.options.filter(x => x.condition == null ||
|
|
2157
|
+
// (x.condition.startsWith('!') ? !this.row.Data[x.condition.substring(1)] : this.row.Data[x.condition])).map((o) => {
|
|
2158
|
+
// const i = HelperClass.clone(o);
|
|
2159
|
+
// if (i.url){
|
|
2160
|
+
// i.url = i.url.replace('{}', this.row.Data.Id);
|
|
2161
|
+
// }
|
|
2162
|
+
// i.row = this.row.Data;
|
|
2163
|
+
// i.class = i.class + ' m-h-5 h-25 d-ib va-m f-u';
|
|
2164
|
+
// return i;
|
|
2165
|
+
// })).concat(this.table.hasStatus ? [this.optStatus] : [])
|
|
2166
|
+
// .concat(this.table.permissions.hasAccess('Update') ? [this.optEdit] : [])
|
|
2167
|
+
// .concat(this.table.permissions.hasAccess('Delete') ? [this.optDelete] : []);
|
|
2021
2168
|
}
|
|
2022
2169
|
getCell(col) {
|
|
2023
2170
|
console.log('getCell');
|
|
2024
|
-
const cv = get(this.row, col.name);
|
|
2171
|
+
const cv = get(this.row.Data, col.name);
|
|
2025
2172
|
if (col.fun != null) {
|
|
2026
|
-
return col.fun(this.row);
|
|
2173
|
+
return col.fun(this.row.Data);
|
|
2027
2174
|
}
|
|
2028
2175
|
else if (col.enum !== null) {
|
|
2029
2176
|
return col.enum.get(cv);
|
|
@@ -2075,7 +2222,7 @@ class TableRowComponent {
|
|
|
2075
2222
|
return this.table.l(cv);
|
|
2076
2223
|
}
|
|
2077
2224
|
getCol(n) {
|
|
2078
|
-
let c = this.row;
|
|
2225
|
+
let c = this.row.Data;
|
|
2079
2226
|
n.split('.').forEach((x) => {
|
|
2080
2227
|
c = c[x];
|
|
2081
2228
|
});
|
|
@@ -2085,15 +2232,15 @@ class TableRowComponent {
|
|
|
2085
2232
|
const editAccess = this.table.permissions.getAccess('Update');
|
|
2086
2233
|
if (this.table.permissions.Type === PermissionTypeEnum.Form) {
|
|
2087
2234
|
this.table.form.name = editAccess.Name;
|
|
2088
|
-
this.table.form.setData(this.row);
|
|
2089
|
-
this.table.form.setButtons(this.table.form.onTop, true, this.row.Id);
|
|
2235
|
+
this.table.form.setData(this.row.Data);
|
|
2236
|
+
this.table.form.setButtons(this.table.form.onTop, true, this.row.Data.Id);
|
|
2090
2237
|
this.table.form.inputs.filter(x => x.inEditDisabled).forEach(x => x.disabled = true);
|
|
2091
2238
|
this.table.form.inputs.filter(x => !x.inEditVisible).forEach(x => x.visible = false);
|
|
2092
2239
|
}
|
|
2093
2240
|
else {
|
|
2094
|
-
new RequestClass(this.table.environment, this.table.l).send(this.table.url + 'Get/' + this.row.Id, Method.Post, null, this.optEdit, (result) => {
|
|
2241
|
+
new RequestClass(this.table.environment, this.table.l).send(this.table.url + 'Get/' + this.row.Data.Id, Method.Post, null, this.optEdit, (result) => {
|
|
2095
2242
|
this.table.form.name = editAccess.Name;
|
|
2096
|
-
this.table.form.setButtons(this.table.form.onTop, true, this.row.Id);
|
|
2243
|
+
this.table.form.setButtons(this.table.form.onTop, true, this.row.Data.Id);
|
|
2097
2244
|
this.table.form.setData(result);
|
|
2098
2245
|
this.table.form.inputs.filter(x => x.inEditDisabled).forEach(x => x.disabled = true);
|
|
2099
2246
|
this.table.form.inputs.filter(x => !x.inEditVisible).forEach(x => x.visible = false);
|
|
@@ -2104,7 +2251,7 @@ class TableRowComponent {
|
|
|
2104
2251
|
}
|
|
2105
2252
|
}
|
|
2106
2253
|
getChildren() {
|
|
2107
|
-
return this.row.Id ? this.table.rows.filter(x => x.ParentId === this.row.Id) : [];
|
|
2254
|
+
return this.row.Data.Id ? this.table.rows.filter(x => x.ParentId === this.row.Data.Id) : [];
|
|
2108
2255
|
}
|
|
2109
2256
|
}
|
|
2110
2257
|
TableRowComponent.decorators = [
|
|
@@ -4263,51 +4410,6 @@ FormSelectComponent.propDecorators = {
|
|
|
4263
4410
|
inputLabel: [{ type: ViewChild, args: ['inputLabel',] }]
|
|
4264
4411
|
};
|
|
4265
4412
|
|
|
4266
|
-
class PermissionClass {
|
|
4267
|
-
constructor(Name = '', Icon = '', Type = null, InputType = null, InputAction = null, Area = '', Controller = '', Action = '', Condition = null, Accesses = []) {
|
|
4268
|
-
this.Name = Name;
|
|
4269
|
-
this.Icon = Icon;
|
|
4270
|
-
this.Type = Type;
|
|
4271
|
-
this.InputType = InputType;
|
|
4272
|
-
this.InputAction = InputAction;
|
|
4273
|
-
this.Area = Area;
|
|
4274
|
-
this.Controller = Controller;
|
|
4275
|
-
this.Action = Action;
|
|
4276
|
-
this.Condition = Condition;
|
|
4277
|
-
this.Accesses = Accesses;
|
|
4278
|
-
this.RelatedId = null;
|
|
4279
|
-
this.OnClick = null;
|
|
4280
|
-
}
|
|
4281
|
-
getAccess(a) {
|
|
4282
|
-
const c = this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Access);
|
|
4283
|
-
return c.length > 0 ? c[0] : null;
|
|
4284
|
-
}
|
|
4285
|
-
hasAccess(a) {
|
|
4286
|
-
return this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Access).length > 0;
|
|
4287
|
-
}
|
|
4288
|
-
getAccesses() {
|
|
4289
|
-
return this.Accesses.filter(x => x.Type === PermissionTypeEnum.Access);
|
|
4290
|
-
}
|
|
4291
|
-
delete(a) {
|
|
4292
|
-
this.Accesses = this.Accesses.filter(x => x.Action !== a);
|
|
4293
|
-
}
|
|
4294
|
-
hasOption(a) {
|
|
4295
|
-
return this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Option).length > 0;
|
|
4296
|
-
}
|
|
4297
|
-
getOptions() {
|
|
4298
|
-
return this.Accesses.filter(x => x.Type === PermissionTypeEnum.Option);
|
|
4299
|
-
}
|
|
4300
|
-
getOption(a) {
|
|
4301
|
-
const c = this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Option);
|
|
4302
|
-
return c.length > 0 ? c[0] : null;
|
|
4303
|
-
}
|
|
4304
|
-
getUrl() {
|
|
4305
|
-
return (this.Area ? '/' + this.Area : '') + '/' + this.Controller + '/' +
|
|
4306
|
-
(this.RelatedId ? `${this.RelatedId}/` : '') +
|
|
4307
|
-
(this.Action ? this.Action : '');
|
|
4308
|
-
}
|
|
4309
|
-
}
|
|
4310
|
-
|
|
4311
4413
|
class FormTableComponent {
|
|
4312
4414
|
constructor() {
|
|
4313
4415
|
this.changeIndex = new EventEmitter();
|
|
@@ -6154,7 +6256,7 @@ class TableClass {
|
|
|
6154
6256
|
this.permission = false;
|
|
6155
6257
|
return;
|
|
6156
6258
|
}
|
|
6157
|
-
for (const access of this.permissions.getAccesses()) {
|
|
6259
|
+
for (const access of this.permissions.getAccesses().filter(x => x.InputAction !== PermissionInputActionEnum.None)) {
|
|
6158
6260
|
const accessInp = new InputClass(this.environment, this.l, access.Name, access.Icon, access.InputType === PermissionInputTypeEnum.Button ? InputType.Button : InputType.Icon, 'w-u h-30');
|
|
6159
6261
|
if (access.Action === 'Insert') {
|
|
6160
6262
|
if (this.form) {
|
|
@@ -6224,105 +6326,6 @@ class TableClass {
|
|
|
6224
6326
|
this.modal.form = this.form;
|
|
6225
6327
|
}
|
|
6226
6328
|
}
|
|
6227
|
-
for (const option of this.permissions.getOptions()) {
|
|
6228
|
-
if (this.options.filter(x => x.name === option.Name).length > 0) {
|
|
6229
|
-
continue;
|
|
6230
|
-
}
|
|
6231
|
-
const opt = new InputClass(this.environment, this.l, option.Name, option.Icon, option.InputType === PermissionInputTypeEnum.Icon ? InputType.Icon : InputType.Button, 'blue h-25 m-h-5 d-ib va-m f-u');
|
|
6232
|
-
opt.condition = option.Condition;
|
|
6233
|
-
if (option.InputAction === PermissionInputActionEnum.Link || option.InputAction === PermissionInputActionEnum.LinkNewTab) {
|
|
6234
|
-
const p = new PermissionClass();
|
|
6235
|
-
p.RelatedId = this.permissions.RelatedId;
|
|
6236
|
-
p.Area = this.permissions.Area;
|
|
6237
|
-
p.Controller = option.Controller ? option.Controller : this.permissions.Controller;
|
|
6238
|
-
p.Action = this.permissions.Action;
|
|
6239
|
-
opt.url = p.getUrl() + option.Action + '/{}';
|
|
6240
|
-
opt.urlNewTab = option.InputAction === PermissionInputActionEnum.LinkNewTab;
|
|
6241
|
-
}
|
|
6242
|
-
else if (option.InputAction === PermissionInputActionEnum.Modal) {
|
|
6243
|
-
opt.modal = option.Modal;
|
|
6244
|
-
opt.onClick = (btn) => {
|
|
6245
|
-
if (opt.modal.table) {
|
|
6246
|
-
const p = new PermissionClass();
|
|
6247
|
-
p.RelatedId = btn.row.Id;
|
|
6248
|
-
p.Area = this.permissions.Area;
|
|
6249
|
-
p.Controller = this.permissions.Controller;
|
|
6250
|
-
p.Action = option.Action;
|
|
6251
|
-
p.Accesses = option.Accesses;
|
|
6252
|
-
opt.modal.table.permissions = p;
|
|
6253
|
-
if (opt.modal.table.form) {
|
|
6254
|
-
opt.modal.table.form.url = p.getUrl() + 'Insert';
|
|
6255
|
-
opt.modal.table.form.baseUrl = p.getUrl() + 'Insert';
|
|
6256
|
-
}
|
|
6257
|
-
opt.modal.table.set();
|
|
6258
|
-
}
|
|
6259
|
-
if (opt.modal.form) {
|
|
6260
|
-
opt.modal.form.name = option.Name;
|
|
6261
|
-
opt.modal.form.url = opt.modal.form.baseUrl + 'Update/' + btn.row.Id;
|
|
6262
|
-
opt.modal.form.loadData(opt.modal.form.baseUrl + 'Get/' + btn.row.Id);
|
|
6263
|
-
opt.modal.form.onSuccessBase = () => {
|
|
6264
|
-
opt.modal.hide();
|
|
6265
|
-
};
|
|
6266
|
-
}
|
|
6267
|
-
if (opt.modal.accordion) {
|
|
6268
|
-
for (const r of opt.modal.accordion.rows) {
|
|
6269
|
-
if (r.table) {
|
|
6270
|
-
const p = new PermissionClass();
|
|
6271
|
-
p.RelatedId = btn.row.Id;
|
|
6272
|
-
p.Area = this.permissions.Area;
|
|
6273
|
-
p.Controller = this.permissions.Controller;
|
|
6274
|
-
p.Action = r.name;
|
|
6275
|
-
p.Accesses = option.Accesses;
|
|
6276
|
-
r.table.permissions = p;
|
|
6277
|
-
if (r.table.form) {
|
|
6278
|
-
r.table.form.url = p.getUrl() + 'Insert';
|
|
6279
|
-
r.table.form.baseUrl = p.getUrl() + 'Insert';
|
|
6280
|
-
}
|
|
6281
|
-
r.table.set();
|
|
6282
|
-
}
|
|
6283
|
-
}
|
|
6284
|
-
}
|
|
6285
|
-
};
|
|
6286
|
-
}
|
|
6287
|
-
else if (option.InputAction === PermissionInputActionEnum.Report) {
|
|
6288
|
-
const p = new PermissionClass();
|
|
6289
|
-
p.RelatedId = 'Index';
|
|
6290
|
-
p.Area = this.permissions.Area;
|
|
6291
|
-
p.Controller = 'Print';
|
|
6292
|
-
p.Action = option.Action;
|
|
6293
|
-
opt.url = '/Report' + p.getUrl() + '/{}';
|
|
6294
|
-
opt.urlNewTab = true;
|
|
6295
|
-
}
|
|
6296
|
-
else if (option.InputAction === PermissionInputActionEnum.File) {
|
|
6297
|
-
const p = new PermissionClass();
|
|
6298
|
-
p.RelatedId = this.permissions.RelatedId;
|
|
6299
|
-
p.Area = this.permissions.Area;
|
|
6300
|
-
p.Controller = this.permissions.Controller;
|
|
6301
|
-
p.Action = (this.permissions.Action ? this.permissions.Action : '') + option.Action;
|
|
6302
|
-
opt.url = '/File' + p.getUrl() + '/{}';
|
|
6303
|
-
opt.urlNewTab = true;
|
|
6304
|
-
}
|
|
6305
|
-
else if (option.InputAction === PermissionInputActionEnum.Confirm) {
|
|
6306
|
-
opt.onClick = (btn) => {
|
|
6307
|
-
const p = new PermissionClass();
|
|
6308
|
-
p.RelatedId = this.permissions.RelatedId;
|
|
6309
|
-
p.Area = this.permissions.Area;
|
|
6310
|
-
p.Controller = this.permissions.Controller;
|
|
6311
|
-
p.Action = option.Action;
|
|
6312
|
-
this.showConfirm(this.l(option.Action + 'Confirm'), p.getUrl() + '/' + btn.row.Id, null, () => {
|
|
6313
|
-
this.load();
|
|
6314
|
-
});
|
|
6315
|
-
};
|
|
6316
|
-
}
|
|
6317
|
-
else if (option.Type === PermissionTypeEnum.Option) {
|
|
6318
|
-
if (option.OnClick) {
|
|
6319
|
-
opt.onClick = (btn) => {
|
|
6320
|
-
option.OnClick(btn);
|
|
6321
|
-
};
|
|
6322
|
-
}
|
|
6323
|
-
}
|
|
6324
|
-
this.options.push(opt);
|
|
6325
|
-
}
|
|
6326
6329
|
}
|
|
6327
6330
|
}
|
|
6328
6331
|
class TableCollClass {
|