ps-toolkit-ui 0.0.112 → 0.0.116
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 +286 -264
- 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/enum.class.js +17 -14
- package/esm2015/lib/classes/permission.class.js +10 -6
- package/esm2015/lib/classes/table.class.js +38 -138
- package/esm2015/lib/components/base.component.js +2 -2
- package/esm2015/lib/components/table/row/table.row.component.js +144 -39
- package/fesm2015/ps-toolkit-ui.js +240 -229
- package/fesm2015/ps-toolkit-ui.js.map +1 -1
- package/lib/classes/enum.class.d.ts +11 -9
- package/lib/classes/permission.class.d.ts +5 -3
- package/lib/components/table/row/table.row.component.d.ts +0 -1
- package/package.json +1 -1
- package/ps-toolkit-ui.metadata.json +1 -1
|
@@ -469,20 +469,23 @@ var PermissionTypeEnum;
|
|
|
469
469
|
PermissionTypeEnum[PermissionTypeEnum["Form"] = -1] = "Form";
|
|
470
470
|
PermissionTypeEnum[PermissionTypeEnum["Item"] = 0] = "Item";
|
|
471
471
|
PermissionTypeEnum[PermissionTypeEnum["Access"] = 1] = "Access";
|
|
472
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
473
|
-
PermissionTypeEnum[PermissionTypeEnum["Option"] = 3] = "Option";
|
|
474
|
-
PermissionTypeEnum[PermissionTypeEnum["OptionLink"] = 4] = "OptionLink";
|
|
475
|
-
PermissionTypeEnum[PermissionTypeEnum["OptionLinkNewTab"] = 5] = "OptionLinkNewTab";
|
|
476
|
-
PermissionTypeEnum[PermissionTypeEnum["OptionReport"] = 6] = "OptionReport";
|
|
477
|
-
PermissionTypeEnum[PermissionTypeEnum["OptionFile"] = 7] = "OptionFile";
|
|
478
|
-
PermissionTypeEnum[PermissionTypeEnum["OptionModal"] = 8] = "OptionModal";
|
|
479
|
-
PermissionTypeEnum[PermissionTypeEnum["OptionConfirm"] = 9] = "OptionConfirm";
|
|
472
|
+
PermissionTypeEnum[PermissionTypeEnum["Option"] = 2] = "Option";
|
|
480
473
|
})(PermissionTypeEnum || (PermissionTypeEnum = {}));
|
|
481
|
-
var
|
|
482
|
-
(function (
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
474
|
+
var PermissionInputActionEnum;
|
|
475
|
+
(function (PermissionInputActionEnum) {
|
|
476
|
+
PermissionInputActionEnum[PermissionInputActionEnum["None"] = 0] = "None";
|
|
477
|
+
PermissionInputActionEnum[PermissionInputActionEnum["Link"] = 1] = "Link";
|
|
478
|
+
PermissionInputActionEnum[PermissionInputActionEnum["LinkNewTab"] = 2] = "LinkNewTab";
|
|
479
|
+
PermissionInputActionEnum[PermissionInputActionEnum["Report"] = 3] = "Report";
|
|
480
|
+
PermissionInputActionEnum[PermissionInputActionEnum["File"] = 4] = "File";
|
|
481
|
+
PermissionInputActionEnum[PermissionInputActionEnum["Modal"] = 5] = "Modal";
|
|
482
|
+
PermissionInputActionEnum[PermissionInputActionEnum["Confirm"] = 6] = "Confirm";
|
|
483
|
+
})(PermissionInputActionEnum || (PermissionInputActionEnum = {}));
|
|
484
|
+
var PermissionInputTypeEnum;
|
|
485
|
+
(function (PermissionInputTypeEnum) {
|
|
486
|
+
PermissionInputTypeEnum[PermissionInputTypeEnum["Icon"] = 0] = "Icon";
|
|
487
|
+
PermissionInputTypeEnum[PermissionInputTypeEnum["Button"] = 1] = "Button";
|
|
488
|
+
})(PermissionInputTypeEnum || (PermissionInputTypeEnum = {}));
|
|
486
489
|
var VehicleType;
|
|
487
490
|
(function (VehicleType) {
|
|
488
491
|
VehicleType[VehicleType["Car"] = 1] = "Car";
|
|
@@ -1839,6 +1842,51 @@ TablePaginationComponent.propDecorators = {
|
|
|
1839
1842
|
table: [{ type: Input }]
|
|
1840
1843
|
};
|
|
1841
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
|
+
|
|
1842
1890
|
class TableRowComponent {
|
|
1843
1891
|
constructor(service) {
|
|
1844
1892
|
this.service = service;
|
|
@@ -1871,23 +1919,23 @@ class TableRowComponent {
|
|
|
1871
1919
|
if (this.table.permissions.hasAccess('Insert')) {
|
|
1872
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');
|
|
1873
1921
|
this.addChildren.onClick = () => {
|
|
1874
|
-
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);
|
|
1875
1923
|
this.table.form.onSuccessBase = () => {
|
|
1876
1924
|
this.table.modal.hide();
|
|
1877
1925
|
this.showChildren.type = InputType.Icon;
|
|
1878
|
-
this.loadChildren(this.row.Id);
|
|
1926
|
+
this.loadChildren(this.row.Data.Id);
|
|
1879
1927
|
};
|
|
1880
1928
|
this.table.showInsertModal();
|
|
1881
1929
|
};
|
|
1882
1930
|
}
|
|
1883
|
-
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');
|
|
1884
1932
|
this.showChildren.onClick = () => {
|
|
1885
1933
|
if ($(this.childrenDiv.nativeElement).is(':visible')) {
|
|
1886
1934
|
$(this.childrenDiv.nativeElement).hide();
|
|
1887
1935
|
this.showChildren.icon = 'fad fa-angle-left f-s-22';
|
|
1888
1936
|
}
|
|
1889
1937
|
else if (this.children.length === 0) {
|
|
1890
|
-
this.loadChildren(this.row.Id);
|
|
1938
|
+
this.loadChildren(this.row.Data.Id);
|
|
1891
1939
|
}
|
|
1892
1940
|
else {
|
|
1893
1941
|
$(this.childrenDiv.nativeElement).show();
|
|
@@ -1896,8 +1944,8 @@ class TableRowComponent {
|
|
|
1896
1944
|
};
|
|
1897
1945
|
}
|
|
1898
1946
|
if (this.table.hasStatus) {
|
|
1899
|
-
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' : ''));
|
|
1900
|
-
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;
|
|
1901
1949
|
this.optStatus.onClick = (btn) => {
|
|
1902
1950
|
new RequestClass(this.table.l).send(this.table.url + '/Status/' + btn.row.Id, Method.Post, null, btn, (r) => {
|
|
1903
1951
|
btn.class = 'm-h-5 h-20 ' + (r ? 'green' : '');
|
|
@@ -1905,16 +1953,15 @@ class TableRowComponent {
|
|
|
1905
1953
|
});
|
|
1906
1954
|
};
|
|
1907
1955
|
}
|
|
1908
|
-
this.options = this.getOptions();
|
|
1909
1956
|
if (this.optEdit !== null) {
|
|
1910
1957
|
if (this.table.form) {
|
|
1911
1958
|
this.optEdit.onClick = () => {
|
|
1912
|
-
this.table.form.url = this.table.url + 'Update/' + this.row.Id;
|
|
1913
|
-
if (this.table.hasChildren && this.row.ParentId != null) {
|
|
1959
|
+
this.table.form.url = this.table.url + 'Update/' + this.row.Data.Id;
|
|
1960
|
+
if (this.table.hasChildren && this.row.Data.ParentId != null) {
|
|
1914
1961
|
this.table.form.onSuccessBase = () => {
|
|
1915
1962
|
this.table.modal.hide();
|
|
1916
1963
|
if (this.table.childrenAutoLoad) {
|
|
1917
|
-
this.loadParent.emit(this.row.ParentId);
|
|
1964
|
+
this.loadParent.emit(this.row.Data.ParentId);
|
|
1918
1965
|
}
|
|
1919
1966
|
else {
|
|
1920
1967
|
this.table.load();
|
|
@@ -1934,7 +1981,7 @@ class TableRowComponent {
|
|
|
1934
1981
|
};
|
|
1935
1982
|
}
|
|
1936
1983
|
else {
|
|
1937
|
-
this.optEdit.url = this.table.url + '/Update/' + this.row.Id;
|
|
1984
|
+
this.optEdit.url = this.table.url + '/Update/' + this.row.Data.Id;
|
|
1938
1985
|
}
|
|
1939
1986
|
}
|
|
1940
1987
|
if (this.optDelete != null) {
|
|
@@ -1943,13 +1990,13 @@ class TableRowComponent {
|
|
|
1943
1990
|
this.table.form.clear();
|
|
1944
1991
|
}
|
|
1945
1992
|
if (this.table.permissions.Type === PermissionTypeEnum.Form) {
|
|
1946
|
-
this.table.rows = this.table.rows.filter(x => x.Id !== this.row.Id);
|
|
1947
|
-
this.changeRows.emit(this.row);
|
|
1993
|
+
this.table.rows = this.table.rows.filter(x => x.Id !== this.row.Data.Id);
|
|
1994
|
+
this.changeRows.emit(this.row.Data);
|
|
1948
1995
|
}
|
|
1949
1996
|
else {
|
|
1950
|
-
this.confirmShow.emit({ id: this.row.Id, accept: () => {
|
|
1951
|
-
if (this.table.hasChildren && this.table.childrenAutoLoad && this.row.ParentId != null) {
|
|
1952
|
-
this.loadParent.emit(this.row.ParentId);
|
|
1997
|
+
this.confirmShow.emit({ id: this.row.Data.Id, accept: () => {
|
|
1998
|
+
if (this.table.hasChildren && this.table.childrenAutoLoad && this.row.Data.ParentId != null) {
|
|
1999
|
+
this.loadParent.emit(this.row.Data.ParentId);
|
|
1953
2000
|
}
|
|
1954
2001
|
else {
|
|
1955
2002
|
this.table.load();
|
|
@@ -1972,7 +2019,7 @@ class TableRowComponent {
|
|
|
1972
2019
|
});
|
|
1973
2020
|
}
|
|
1974
2021
|
select() {
|
|
1975
|
-
this.row.selected = !this.row.selected;
|
|
2022
|
+
this.row.Data.selected = !this.row.Data.selected;
|
|
1976
2023
|
}
|
|
1977
2024
|
onChangeRows(e) {
|
|
1978
2025
|
return this.changeRows.emit(e);
|
|
@@ -2002,25 +2049,130 @@ class TableRowComponent {
|
|
|
2002
2049
|
}, 500);
|
|
2003
2050
|
}
|
|
2004
2051
|
getOptions() {
|
|
2005
|
-
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2052
|
+
const opts = this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ?
|
|
2053
|
+
[this.addChildren] : [];
|
|
2054
|
+
console.log(this.row.Options);
|
|
2055
|
+
for (const option of this.row.Options) {
|
|
2056
|
+
console.log(this.table.options.filter(x => x.name === option.Name).length);
|
|
2057
|
+
if (this.table.options.filter(x => x.name === option.Name).length > 0) {
|
|
2058
|
+
continue;
|
|
2011
2059
|
}
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2060
|
+
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');
|
|
2061
|
+
opt.condition = option.Condition;
|
|
2062
|
+
console.log(option.InputAction);
|
|
2063
|
+
if (option.InputAction === PermissionInputActionEnum.Link || option.InputAction === PermissionInputActionEnum.LinkNewTab) {
|
|
2064
|
+
const p = new PermissionClass();
|
|
2065
|
+
p.RelatedId = this.table.permissions.RelatedId;
|
|
2066
|
+
p.Area = this.table.permissions.Area;
|
|
2067
|
+
p.Controller = option.Controller ? option.Controller : this.table.permissions.Controller;
|
|
2068
|
+
p.Action = this.table.permissions.Action;
|
|
2069
|
+
opt.url = p.getUrl() + option.Action + '/{}';
|
|
2070
|
+
opt.urlNewTab = option.InputAction === PermissionInputActionEnum.LinkNewTab;
|
|
2071
|
+
}
|
|
2072
|
+
else if (option.InputAction === PermissionInputActionEnum.Modal) {
|
|
2073
|
+
opt.modal = option.Modal;
|
|
2074
|
+
opt.onClick = (btn) => {
|
|
2075
|
+
if (opt.modal.table) {
|
|
2076
|
+
const p = new PermissionClass();
|
|
2077
|
+
p.RelatedId = btn.row.Id;
|
|
2078
|
+
p.Area = this.table.permissions.Area;
|
|
2079
|
+
p.Controller = this.table.permissions.Controller;
|
|
2080
|
+
p.Action = option.Action;
|
|
2081
|
+
p.Accesses = option.Accesses;
|
|
2082
|
+
opt.modal.table.permissions = p;
|
|
2083
|
+
if (opt.modal.table.form) {
|
|
2084
|
+
opt.modal.table.form.url = p.getUrl() + 'Insert';
|
|
2085
|
+
opt.modal.table.form.baseUrl = p.getUrl() + 'Insert';
|
|
2086
|
+
}
|
|
2087
|
+
opt.modal.table.set();
|
|
2088
|
+
}
|
|
2089
|
+
if (opt.modal.form) {
|
|
2090
|
+
opt.modal.form.name = option.Name;
|
|
2091
|
+
opt.modal.form.url = opt.modal.form.baseUrl + 'Update/' + btn.row.Id;
|
|
2092
|
+
opt.modal.form.loadData(opt.modal.form.baseUrl + 'Get/' + btn.row.Id);
|
|
2093
|
+
opt.modal.form.onSuccessBase = () => {
|
|
2094
|
+
opt.modal.hide();
|
|
2095
|
+
};
|
|
2096
|
+
}
|
|
2097
|
+
if (opt.modal.accordion) {
|
|
2098
|
+
for (const r of opt.modal.accordion.rows) {
|
|
2099
|
+
if (r.table) {
|
|
2100
|
+
const p = new PermissionClass();
|
|
2101
|
+
p.RelatedId = btn.row.Id;
|
|
2102
|
+
p.Area = this.table.permissions.Area;
|
|
2103
|
+
p.Controller = this.table.permissions.Controller;
|
|
2104
|
+
p.Action = r.name;
|
|
2105
|
+
p.Accesses = option.Accesses;
|
|
2106
|
+
r.table.permissions = p;
|
|
2107
|
+
if (r.table.form) {
|
|
2108
|
+
r.table.form.url = p.getUrl() + 'Insert';
|
|
2109
|
+
r.table.form.baseUrl = p.getUrl() + 'Insert';
|
|
2110
|
+
}
|
|
2111
|
+
r.table.set();
|
|
2112
|
+
}
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
};
|
|
2116
|
+
}
|
|
2117
|
+
else if (option.InputAction === PermissionInputActionEnum.Report) {
|
|
2118
|
+
const p = new PermissionClass();
|
|
2119
|
+
p.RelatedId = 'Index';
|
|
2120
|
+
p.Area = this.table.permissions.Area;
|
|
2121
|
+
p.Controller = 'Print';
|
|
2122
|
+
p.Action = option.Action;
|
|
2123
|
+
opt.url = '/Report' + p.getUrl() + '/{}';
|
|
2124
|
+
opt.urlNewTab = true;
|
|
2125
|
+
}
|
|
2126
|
+
else if (option.InputAction === PermissionInputActionEnum.File) {
|
|
2127
|
+
const p = new PermissionClass();
|
|
2128
|
+
p.RelatedId = this.table.permissions.RelatedId;
|
|
2129
|
+
p.Area = this.table.permissions.Area;
|
|
2130
|
+
p.Controller = this.table.permissions.Controller;
|
|
2131
|
+
p.Action = (this.table.permissions.Action ? this.table.permissions.Action : '') + option.Action;
|
|
2132
|
+
opt.url = '/File' + p.getUrl() + '/{}';
|
|
2133
|
+
opt.urlNewTab = true;
|
|
2134
|
+
}
|
|
2135
|
+
else if (option.InputAction === PermissionInputActionEnum.Confirm) {
|
|
2136
|
+
opt.onClick = (btn) => {
|
|
2137
|
+
const p = new PermissionClass();
|
|
2138
|
+
p.RelatedId = this.table.permissions.RelatedId;
|
|
2139
|
+
p.Area = this.table.permissions.Area;
|
|
2140
|
+
p.Controller = this.table.permissions.Controller;
|
|
2141
|
+
p.Action = option.Action;
|
|
2142
|
+
this.table.showConfirm(this.table.l(option.Action + 'Confirm'), p.getUrl() + '/' + btn.row.Id, null, () => {
|
|
2143
|
+
this.table.load();
|
|
2144
|
+
});
|
|
2145
|
+
};
|
|
2146
|
+
}
|
|
2147
|
+
else if (option.Type === PermissionTypeEnum.Option) {
|
|
2148
|
+
if (option.OnClick) {
|
|
2149
|
+
opt.onClick = (btn) => {
|
|
2150
|
+
option.OnClick(btn);
|
|
2151
|
+
};
|
|
2152
|
+
}
|
|
2153
|
+
}
|
|
2154
|
+
opts.push(opt);
|
|
2155
|
+
}
|
|
2156
|
+
return opts;
|
|
2157
|
+
// return (this.addChildren !== null && (this.table.level === null || this.table.level > this.level) ? [this.addChildren] : [])
|
|
2158
|
+
// .concat(this.table.options.filter(x => x.condition == null ||
|
|
2159
|
+
// (x.condition.startsWith('!') ? !this.row.Data[x.condition.substring(1)] : this.row.Data[x.condition])).map((o) => {
|
|
2160
|
+
// const i = HelperClass.clone(o);
|
|
2161
|
+
// if (i.url){
|
|
2162
|
+
// i.url = i.url.replace('{}', this.row.Data.Id);
|
|
2163
|
+
// }
|
|
2164
|
+
// i.row = this.row.Data;
|
|
2165
|
+
// i.class = i.class + ' m-h-5 h-25 d-ib va-m f-u';
|
|
2166
|
+
// return i;
|
|
2167
|
+
// })).concat(this.table.hasStatus ? [this.optStatus] : [])
|
|
2168
|
+
// .concat(this.table.permissions.hasAccess('Update') ? [this.optEdit] : [])
|
|
2169
|
+
// .concat(this.table.permissions.hasAccess('Delete') ? [this.optDelete] : []);
|
|
2018
2170
|
}
|
|
2019
2171
|
getCell(col) {
|
|
2020
2172
|
console.log('getCell');
|
|
2021
|
-
const cv = get(this.row, col.name);
|
|
2173
|
+
const cv = get(this.row.Data, col.name);
|
|
2022
2174
|
if (col.fun != null) {
|
|
2023
|
-
return col.fun(this.row);
|
|
2175
|
+
return col.fun(this.row.Data);
|
|
2024
2176
|
}
|
|
2025
2177
|
else if (col.enum !== null) {
|
|
2026
2178
|
return col.enum.get(cv);
|
|
@@ -2072,7 +2224,7 @@ class TableRowComponent {
|
|
|
2072
2224
|
return this.table.l(cv);
|
|
2073
2225
|
}
|
|
2074
2226
|
getCol(n) {
|
|
2075
|
-
let c = this.row;
|
|
2227
|
+
let c = this.row.Data;
|
|
2076
2228
|
n.split('.').forEach((x) => {
|
|
2077
2229
|
c = c[x];
|
|
2078
2230
|
});
|
|
@@ -2082,15 +2234,15 @@ class TableRowComponent {
|
|
|
2082
2234
|
const editAccess = this.table.permissions.getAccess('Update');
|
|
2083
2235
|
if (this.table.permissions.Type === PermissionTypeEnum.Form) {
|
|
2084
2236
|
this.table.form.name = editAccess.Name;
|
|
2085
|
-
this.table.form.setData(this.row);
|
|
2086
|
-
this.table.form.setButtons(this.table.form.onTop, true, this.row.Id);
|
|
2237
|
+
this.table.form.setData(this.row.Data);
|
|
2238
|
+
this.table.form.setButtons(this.table.form.onTop, true, this.row.Data.Id);
|
|
2087
2239
|
this.table.form.inputs.filter(x => x.inEditDisabled).forEach(x => x.disabled = true);
|
|
2088
2240
|
this.table.form.inputs.filter(x => !x.inEditVisible).forEach(x => x.visible = false);
|
|
2089
2241
|
}
|
|
2090
2242
|
else {
|
|
2091
|
-
new RequestClass(this.table.environment, this.table.l).send(this.table.url + 'Get/' + this.row.Id, Method.Post, null, this.optEdit, (result) => {
|
|
2243
|
+
new RequestClass(this.table.environment, this.table.l).send(this.table.url + 'Get/' + this.row.Data.Id, Method.Post, null, this.optEdit, (result) => {
|
|
2092
2244
|
this.table.form.name = editAccess.Name;
|
|
2093
|
-
this.table.form.setButtons(this.table.form.onTop, true, this.row.Id);
|
|
2245
|
+
this.table.form.setButtons(this.table.form.onTop, true, this.row.Data.Id);
|
|
2094
2246
|
this.table.form.setData(result);
|
|
2095
2247
|
this.table.form.inputs.filter(x => x.inEditDisabled).forEach(x => x.disabled = true);
|
|
2096
2248
|
this.table.form.inputs.filter(x => !x.inEditVisible).forEach(x => x.visible = false);
|
|
@@ -2101,7 +2253,7 @@ class TableRowComponent {
|
|
|
2101
2253
|
}
|
|
2102
2254
|
}
|
|
2103
2255
|
getChildren() {
|
|
2104
|
-
return this.row.Id ? this.table.rows.filter(x => x.ParentId === this.row.Id) : [];
|
|
2256
|
+
return this.row.Data.Id ? this.table.rows.filter(x => x.ParentId === this.row.Data.Id) : [];
|
|
2105
2257
|
}
|
|
2106
2258
|
}
|
|
2107
2259
|
TableRowComponent.decorators = [
|
|
@@ -4260,47 +4412,6 @@ FormSelectComponent.propDecorators = {
|
|
|
4260
4412
|
inputLabel: [{ type: ViewChild, args: ['inputLabel',] }]
|
|
4261
4413
|
};
|
|
4262
4414
|
|
|
4263
|
-
class PermissionClass {
|
|
4264
|
-
constructor(Name = '', Icon = '', Type = null, OptionType = null, Area = '', Controller = '', Action = '', Condition = null, Accesses = []) {
|
|
4265
|
-
this.Name = Name;
|
|
4266
|
-
this.Icon = Icon;
|
|
4267
|
-
this.Type = Type;
|
|
4268
|
-
this.OptionType = OptionType;
|
|
4269
|
-
this.Area = Area;
|
|
4270
|
-
this.Controller = Controller;
|
|
4271
|
-
this.Action = Action;
|
|
4272
|
-
this.Condition = Condition;
|
|
4273
|
-
this.Accesses = Accesses;
|
|
4274
|
-
this.RelatedId = null;
|
|
4275
|
-
this.OnClick = null;
|
|
4276
|
-
}
|
|
4277
|
-
getAccess(a) {
|
|
4278
|
-
const c = this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Access);
|
|
4279
|
-
return c.length > 0 ? c[0] : null;
|
|
4280
|
-
}
|
|
4281
|
-
hasAccess(a) {
|
|
4282
|
-
return this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Access).length > 0;
|
|
4283
|
-
}
|
|
4284
|
-
delete(a) {
|
|
4285
|
-
this.Accesses = this.Accesses.filter(x => x.Action !== a);
|
|
4286
|
-
}
|
|
4287
|
-
hasOption(a) {
|
|
4288
|
-
return this.Accesses.filter(x => x.Action === a && x.Type !== PermissionTypeEnum.Access).length > 0;
|
|
4289
|
-
}
|
|
4290
|
-
getOptions() {
|
|
4291
|
-
return this.Accesses.filter(x => x.Type !== PermissionTypeEnum.Access);
|
|
4292
|
-
}
|
|
4293
|
-
getOption(a) {
|
|
4294
|
-
const c = this.Accesses.filter(x => x.Action === a && x.Type !== PermissionTypeEnum.Access);
|
|
4295
|
-
return c.length > 0 ? c[0] : null;
|
|
4296
|
-
}
|
|
4297
|
-
getUrl() {
|
|
4298
|
-
return (this.Area ? '/' + this.Area : '') + '/' + this.Controller + '/' +
|
|
4299
|
-
(this.RelatedId ? `${this.RelatedId}/` : '') +
|
|
4300
|
-
(this.Action ? this.Action : '');
|
|
4301
|
-
}
|
|
4302
|
-
}
|
|
4303
|
-
|
|
4304
4415
|
class FormTableComponent {
|
|
4305
4416
|
constructor() {
|
|
4306
4417
|
this.changeIndex = new EventEmitter();
|
|
@@ -6000,7 +6111,7 @@ class BaseComponent {
|
|
|
6000
6111
|
return p.length > 0 ? this.getPermissionClass(p[0]) : null;
|
|
6001
6112
|
}
|
|
6002
6113
|
getPermissionClass(p) {
|
|
6003
|
-
return new PermissionClass(p.Name, p.Icon, p.Type, p.
|
|
6114
|
+
return new PermissionClass(p.Name, p.Icon, p.Type, p.InputType, p.InputAction, this.app.area, p.Controller, p.Action, p.Condition, this.getPermissionAccessesClass(p.Id));
|
|
6004
6115
|
}
|
|
6005
6116
|
getPermissionAccessesClass(parentId) {
|
|
6006
6117
|
return this.app.currentUser.Permissions.filter(x => x.ParentId === parentId).map(x => this.getPermissionClass(x));
|
|
@@ -6147,50 +6258,49 @@ class TableClass {
|
|
|
6147
6258
|
this.permission = false;
|
|
6148
6259
|
return;
|
|
6149
6260
|
}
|
|
6150
|
-
const
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6261
|
+
for (const access of this.permissions.getAccesses().filter(x => x.InputAction !== PermissionInputActionEnum.None)) {
|
|
6262
|
+
const accessInp = new InputClass(this.environment, this.l, access.Name, access.Icon, access.InputType === PermissionInputTypeEnum.Button ? InputType.Button : InputType.Icon, 'w-u h-30');
|
|
6263
|
+
if (access.Action === 'Insert') {
|
|
6264
|
+
if (this.form) {
|
|
6265
|
+
this.form.url = this.form.baseUrl = this.url + 'Insert';
|
|
6266
|
+
if (!this.form.onTop) {
|
|
6267
|
+
accessInp.onClick = () => {
|
|
6268
|
+
this.form.onSuccessBase = () => {
|
|
6269
|
+
this.modal.hide();
|
|
6270
|
+
this.load();
|
|
6271
|
+
};
|
|
6272
|
+
this.showInsertModal();
|
|
6160
6273
|
};
|
|
6161
|
-
this.
|
|
6162
|
-
}
|
|
6163
|
-
|
|
6274
|
+
this.buttons.unshift(accessInp);
|
|
6275
|
+
}
|
|
6276
|
+
else {
|
|
6277
|
+
this.form.displayLabel = false;
|
|
6278
|
+
}
|
|
6164
6279
|
}
|
|
6165
6280
|
else {
|
|
6166
|
-
this.
|
|
6281
|
+
this.buttons.unshift(accessInp);
|
|
6282
|
+
if (this.modal) {
|
|
6283
|
+
accessInp.onClick = () => {
|
|
6284
|
+
this.modal.show();
|
|
6285
|
+
};
|
|
6286
|
+
}
|
|
6287
|
+
else {
|
|
6288
|
+
accessInp.url = this.url + 'Insert';
|
|
6289
|
+
}
|
|
6167
6290
|
}
|
|
6168
6291
|
}
|
|
6169
|
-
else {
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
insert.url = this.url + 'Insert';
|
|
6178
|
-
}
|
|
6292
|
+
else if (access.InputAction === PermissionInputActionEnum.Report) {
|
|
6293
|
+
const p = new PermissionClass();
|
|
6294
|
+
p.RelatedId = 'Index';
|
|
6295
|
+
p.Area = this.permissions.Area;
|
|
6296
|
+
p.Controller = 'Print';
|
|
6297
|
+
p.Action = this.permissions.Controller;
|
|
6298
|
+
accessInp.url = '/Report' + p.getUrl();
|
|
6299
|
+
accessInp.urlNewTab = true;
|
|
6179
6300
|
}
|
|
6301
|
+
this.buttons.push(accessInp);
|
|
6180
6302
|
}
|
|
6181
|
-
|
|
6182
|
-
if (reportAccess != null) {
|
|
6183
|
-
const report = new InputClass(this.environment, this.l, reportAccess.Name, reportAccess.Icon, InputType.Button, 'm-h-5');
|
|
6184
|
-
const p = new PermissionClass();
|
|
6185
|
-
p.RelatedId = 'Index';
|
|
6186
|
-
p.Area = this.permissions.Area;
|
|
6187
|
-
p.Controller = 'Print';
|
|
6188
|
-
p.Action = this.permissions.Controller;
|
|
6189
|
-
report.url = '/Report' + p.getUrl();
|
|
6190
|
-
report.urlNewTab = true;
|
|
6191
|
-
this.extraButtons.push(report);
|
|
6192
|
-
}
|
|
6193
|
-
if ((this.permissions.hasAccess('Insert') || this.permissions.hasAccess('Update')) && this.form) {
|
|
6303
|
+
if ((this.permissions.hasAccess('Insert') || this.permissions.hasOption('Update')) && this.form) {
|
|
6194
6304
|
this.form.addButtons('Save', 'green', true, this.permissions.Type === PermissionTypeEnum.Form ? (data) => {
|
|
6195
6305
|
if (data.Id) {
|
|
6196
6306
|
const i = this.rows.findIndex(x => x.Id === data.Id);
|
|
@@ -6218,105 +6328,6 @@ class TableClass {
|
|
|
6218
6328
|
this.modal.form = this.form;
|
|
6219
6329
|
}
|
|
6220
6330
|
}
|
|
6221
|
-
for (const option of this.permissions.getOptions()) {
|
|
6222
|
-
if (this.options.filter(x => x.name === option.Name).length > 0) {
|
|
6223
|
-
continue;
|
|
6224
|
-
}
|
|
6225
|
-
const opt = new InputClass(this.environment, this.l, option.Name, option.Icon, option.OptionType === PermissionOptionTypeEnum.Icon ? InputType.Icon : InputType.Button, 'blue h-25 m-h-5 d-ib va-m f-u');
|
|
6226
|
-
opt.condition = option.Condition;
|
|
6227
|
-
if (option.Type === PermissionTypeEnum.OptionLink || option.Type === PermissionTypeEnum.OptionLinkNewTab) {
|
|
6228
|
-
const p = new PermissionClass();
|
|
6229
|
-
p.RelatedId = this.permissions.RelatedId;
|
|
6230
|
-
p.Area = this.permissions.Area;
|
|
6231
|
-
p.Controller = option.Controller ? option.Controller : this.permissions.Controller;
|
|
6232
|
-
p.Action = this.permissions.Action;
|
|
6233
|
-
opt.url = p.getUrl() + option.Action + '/{}';
|
|
6234
|
-
opt.urlNewTab = option.Type === PermissionTypeEnum.OptionLinkNewTab;
|
|
6235
|
-
}
|
|
6236
|
-
else if (option.Type === PermissionTypeEnum.OptionModal) {
|
|
6237
|
-
opt.modal = option.Modal;
|
|
6238
|
-
opt.onClick = (btn) => {
|
|
6239
|
-
if (opt.modal.table) {
|
|
6240
|
-
const p = new PermissionClass();
|
|
6241
|
-
p.RelatedId = btn.row.Id;
|
|
6242
|
-
p.Area = this.permissions.Area;
|
|
6243
|
-
p.Controller = this.permissions.Controller;
|
|
6244
|
-
p.Action = option.Action;
|
|
6245
|
-
p.Accesses = option.Accesses;
|
|
6246
|
-
opt.modal.table.permissions = p;
|
|
6247
|
-
if (opt.modal.table.form) {
|
|
6248
|
-
opt.modal.table.form.url = p.getUrl() + 'Insert';
|
|
6249
|
-
opt.modal.table.form.baseUrl = p.getUrl() + 'Insert';
|
|
6250
|
-
}
|
|
6251
|
-
opt.modal.table.set();
|
|
6252
|
-
}
|
|
6253
|
-
if (opt.modal.form) {
|
|
6254
|
-
opt.modal.form.name = option.Name;
|
|
6255
|
-
opt.modal.form.url = opt.modal.form.baseUrl + 'Update/' + btn.row.Id;
|
|
6256
|
-
opt.modal.form.loadData(opt.modal.form.baseUrl + 'Get/' + btn.row.Id);
|
|
6257
|
-
opt.modal.form.onSuccessBase = () => {
|
|
6258
|
-
opt.modal.hide();
|
|
6259
|
-
};
|
|
6260
|
-
}
|
|
6261
|
-
if (opt.modal.accordion) {
|
|
6262
|
-
for (const r of opt.modal.accordion.rows) {
|
|
6263
|
-
if (r.table) {
|
|
6264
|
-
const p = new PermissionClass();
|
|
6265
|
-
p.RelatedId = btn.row.Id;
|
|
6266
|
-
p.Area = this.permissions.Area;
|
|
6267
|
-
p.Controller = this.permissions.Controller;
|
|
6268
|
-
p.Action = r.name;
|
|
6269
|
-
p.Accesses = option.Accesses;
|
|
6270
|
-
r.table.permissions = p;
|
|
6271
|
-
if (r.table.form) {
|
|
6272
|
-
r.table.form.url = p.getUrl() + 'Insert';
|
|
6273
|
-
r.table.form.baseUrl = p.getUrl() + 'Insert';
|
|
6274
|
-
}
|
|
6275
|
-
r.table.set();
|
|
6276
|
-
}
|
|
6277
|
-
}
|
|
6278
|
-
}
|
|
6279
|
-
};
|
|
6280
|
-
}
|
|
6281
|
-
else if (option.Type === PermissionTypeEnum.OptionReport) {
|
|
6282
|
-
const p = new PermissionClass();
|
|
6283
|
-
p.RelatedId = 'Index';
|
|
6284
|
-
p.Area = this.permissions.Area;
|
|
6285
|
-
p.Controller = 'Print';
|
|
6286
|
-
p.Action = option.Action;
|
|
6287
|
-
opt.url = '/Report' + p.getUrl() + '/{}';
|
|
6288
|
-
opt.urlNewTab = true;
|
|
6289
|
-
}
|
|
6290
|
-
else if (option.Type === PermissionTypeEnum.OptionFile) {
|
|
6291
|
-
const p = new PermissionClass();
|
|
6292
|
-
p.RelatedId = this.permissions.RelatedId;
|
|
6293
|
-
p.Area = this.permissions.Area;
|
|
6294
|
-
p.Controller = this.permissions.Controller;
|
|
6295
|
-
p.Action = (this.permissions.Action ? this.permissions.Action : '') + option.Action;
|
|
6296
|
-
opt.url = '/File' + p.getUrl() + '/{}';
|
|
6297
|
-
opt.urlNewTab = true;
|
|
6298
|
-
}
|
|
6299
|
-
else if (option.Type === PermissionTypeEnum.OptionConfirm) {
|
|
6300
|
-
opt.onClick = (btn) => {
|
|
6301
|
-
const p = new PermissionClass();
|
|
6302
|
-
p.RelatedId = this.permissions.RelatedId;
|
|
6303
|
-
p.Area = this.permissions.Area;
|
|
6304
|
-
p.Controller = this.permissions.Controller;
|
|
6305
|
-
p.Action = option.Action;
|
|
6306
|
-
this.showConfirm(this.l(option.Action + 'Confirm'), p.getUrl() + '/' + btn.row.Id, null, () => {
|
|
6307
|
-
this.load();
|
|
6308
|
-
});
|
|
6309
|
-
};
|
|
6310
|
-
}
|
|
6311
|
-
else if (option.Type === PermissionTypeEnum.Option) {
|
|
6312
|
-
if (option.OnClick) {
|
|
6313
|
-
opt.onClick = (btn) => {
|
|
6314
|
-
option.OnClick(btn);
|
|
6315
|
-
};
|
|
6316
|
-
}
|
|
6317
|
-
}
|
|
6318
|
-
this.options.push(opt);
|
|
6319
|
-
}
|
|
6320
6331
|
}
|
|
6321
6332
|
}
|
|
6322
6333
|
class TableCollClass {
|
|
@@ -6348,5 +6359,5 @@ class TableRowClass {
|
|
|
6348
6359
|
* Generated bundle index. Do not edit.
|
|
6349
6360
|
*/
|
|
6350
6361
|
|
|
6351
|
-
export { AccordionClass, AccordionComponent, AccordionRowClass, AlertComponent, BaseComponent, ConfirmComponent, DayClass, EnumUtils, FooterComponent, FormBankCardComponent, FormButtonComponent, FormCarComponent, FormCarSearchComponent, FormCheckboxComponent, FormClass, FormComponent, FormDateComponent, FormDatetimeComponent, FormFileComponent, FormFingerComponent, FormIconComponent, FormLabelComponent, FormPlaqueComponent, FormPlaqueSelectComponent, FormRadioComponent, FormSelectComponent, FormTableComponent, FormTextareaComponent, FormTextboxComponent, FormTimeComponent, FormTreeComponent, HeaderComponent, HelperClass, InputClass, InputError, InputType, LangClass, LayoutComponent, LoadingComponent, LoginClass, LoginStepClass, Method, ModalClass, ModalComponent, NotfoundComponent, OperationEnum, OptionClass, PaymentStatusEnum, PermissionClass,
|
|
6362
|
+
export { AccordionClass, AccordionComponent, AccordionRowClass, AlertComponent, BaseComponent, ConfirmComponent, DayClass, EnumUtils, FooterComponent, FormBankCardComponent, FormButtonComponent, FormCarComponent, FormCarSearchComponent, FormCheckboxComponent, FormClass, FormComponent, FormDateComponent, FormDatetimeComponent, FormFileComponent, FormFingerComponent, FormIconComponent, FormLabelComponent, FormPlaqueComponent, FormPlaqueSelectComponent, FormRadioComponent, FormSelectComponent, FormTableComponent, FormTextareaComponent, FormTextboxComponent, FormTimeComponent, FormTreeComponent, HeaderComponent, HelperClass, InputClass, InputError, InputType, LangClass, LayoutComponent, LoadingComponent, LoginClass, LoginStepClass, Method, ModalClass, ModalComponent, NotfoundComponent, OperationEnum, OptionClass, PaymentStatusEnum, PermissionClass, PermissionInputActionEnum, PermissionInputTypeEnum, PermissionTypeEnum, Progress, PsToolkitUiModule, RequestClass, ResultStatusEnum, SidebarClass, SidebarComponent, StatusEnum, StepsClass, StepsComponent, StepsItemClass, SubHeaderComponent, TableClass, TableCollClass, TableCollType, TableComponent, TableOptionType, TableRowClass, TooltipComponent, TreeRowClass, UserType, VehicleType, FormSelectItemComponent as ɵa, TablePaginationComponent as ɵb, SidebarItemComponent as ɵc, PsToolkitUiConfigService as ɵd, TableLoadingComponent as ɵe, FormTreeItemComponent as ɵf, TableRowComponent as ɵg, TableReportComponent as ɵh, SafeStylePipe as ɵi, LoginComponent as ɵj, NotificationComponent as ɵk };
|
|
6352
6363
|
//# sourceMappingURL=ps-toolkit-ui.js.map
|