ps-toolkit-ui 1.17.46 → 1.17.48
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 +307 -348
- 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/form.class.js +96 -6
- package/esm2015/lib/classes/helper.class.js +38 -1
- package/esm2015/lib/classes/request.class.js +7 -251
- package/esm2015/lib/classes/table.class.js +90 -10
- package/esm2015/lib/components/table/row/table.row.component.js +7 -7
- package/esm2015/lib/components/table/table.component.js +2 -2
- package/fesm2015/ps-toolkit-ui.js +232 -269
- package/fesm2015/ps-toolkit-ui.js.map +1 -1
- package/lib/classes/form.class.d.ts +3 -1
- package/lib/classes/helper.class.d.ts +1 -0
- package/lib/classes/request.class.d.ts +3 -9
- package/lib/classes/table.class.d.ts +2 -6
- package/package.json +1 -1
- package/ps-toolkit-ui.metadata.json +1 -1
|
@@ -1799,10 +1799,49 @@
|
|
|
1799
1799
|
}
|
|
1800
1800
|
return p;
|
|
1801
1801
|
};
|
|
1802
|
+
HelperClass.jsonToFormData = function (json, formData, parentKey) {
|
|
1803
|
+
var _this = this;
|
|
1804
|
+
if (formData === void 0) { formData = new FormData(); }
|
|
1805
|
+
if (parentKey === void 0) { parentKey = ''; }
|
|
1806
|
+
if (typeof json === 'object' && json !== null) {
|
|
1807
|
+
Object.keys(json).forEach(function (key) {
|
|
1808
|
+
var fullKey = parentKey ? parentKey + "[" + key + "]" : key;
|
|
1809
|
+
var value = json[key];
|
|
1810
|
+
if (value === null) {
|
|
1811
|
+
// اگر مقدار null است، آن را نادیده بگیر
|
|
1812
|
+
return;
|
|
1813
|
+
}
|
|
1814
|
+
else if (typeof value === 'object' && !Array.isArray(value)) {
|
|
1815
|
+
// اگر آبجکت است، به صورت بازگشتی فراخوانی کن
|
|
1816
|
+
_this.jsonToFormData(value, formData, fullKey);
|
|
1817
|
+
}
|
|
1818
|
+
else if (Array.isArray(value)) {
|
|
1819
|
+
// اگر آرایه است، هر عضو را جداگانه اضافه کن
|
|
1820
|
+
value.forEach(function (item, index) {
|
|
1821
|
+
var arrayKey = fullKey + "[" + index + "]";
|
|
1822
|
+
if (item === null) {
|
|
1823
|
+
// اگر مقدار null است، آن را نادیده بگیر
|
|
1824
|
+
return;
|
|
1825
|
+
}
|
|
1826
|
+
else if (typeof item === 'object') {
|
|
1827
|
+
_this.jsonToFormData(item, formData, arrayKey);
|
|
1828
|
+
}
|
|
1829
|
+
else {
|
|
1830
|
+
formData.append(arrayKey, item);
|
|
1831
|
+
}
|
|
1832
|
+
});
|
|
1833
|
+
}
|
|
1834
|
+
else {
|
|
1835
|
+
// مقدار ساده را اضافه کن
|
|
1836
|
+
formData.append(fullKey, value);
|
|
1837
|
+
}
|
|
1838
|
+
});
|
|
1839
|
+
}
|
|
1840
|
+
return formData;
|
|
1841
|
+
};
|
|
1802
1842
|
return HelperClass;
|
|
1803
1843
|
}());
|
|
1804
1844
|
|
|
1805
|
-
exports.request = null;
|
|
1806
1845
|
var RequestClass = /** @class */ (function () {
|
|
1807
1846
|
function RequestClass(environment, l) {
|
|
1808
1847
|
if (environment === void 0) { environment = null; }
|
|
@@ -1810,233 +1849,12 @@
|
|
|
1810
1849
|
this.environment = environment;
|
|
1811
1850
|
this.l = l;
|
|
1812
1851
|
}
|
|
1813
|
-
RequestClass.prototype.
|
|
1814
|
-
var e_1, _a, e_2, _b;
|
|
1815
|
-
if (onSubmit === void 0) { onSubmit = null; }
|
|
1816
|
-
if (!form.check()) {
|
|
1817
|
-
return;
|
|
1818
|
-
}
|
|
1819
|
-
if (form.onBeforeSubmit && !form.onBeforeSubmit()) {
|
|
1820
|
-
return;
|
|
1821
|
-
}
|
|
1822
|
-
var btns = form.inputs.filter(function (x) { return x.type === exports.InputType.Submit; });
|
|
1823
|
-
try {
|
|
1824
|
-
for (var btns_1 = __values(btns), btns_1_1 = btns_1.next(); !btns_1_1.done; btns_1_1 = btns_1.next()) {
|
|
1825
|
-
var btn = btns_1_1.value;
|
|
1826
|
-
if (btn.loading) {
|
|
1827
|
-
return;
|
|
1828
|
-
}
|
|
1829
|
-
btn.loading = true;
|
|
1830
|
-
}
|
|
1831
|
-
}
|
|
1832
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
1833
|
-
finally {
|
|
1834
|
-
try {
|
|
1835
|
-
if (btns_1_1 && !btns_1_1.done && (_a = btns_1.return)) _a.call(btns_1);
|
|
1836
|
-
}
|
|
1837
|
-
finally { if (e_1) throw e_1.error; }
|
|
1838
|
-
}
|
|
1839
|
-
var data = form.data();
|
|
1840
|
-
if (onSubmit) {
|
|
1841
|
-
try {
|
|
1842
|
-
for (var btns_2 = __values(btns), btns_2_1 = btns_2.next(); !btns_2_1.done; btns_2_1 = btns_2.next()) {
|
|
1843
|
-
var btn = btns_2_1.value;
|
|
1844
|
-
btn.loading = false;
|
|
1845
|
-
}
|
|
1846
|
-
}
|
|
1847
|
-
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
1848
|
-
finally {
|
|
1849
|
-
try {
|
|
1850
|
-
if (btns_2_1 && !btns_2_1.done && (_b = btns_2.return)) _b.call(btns_2);
|
|
1851
|
-
}
|
|
1852
|
-
finally { if (e_2) throw e_2.error; }
|
|
1853
|
-
}
|
|
1854
|
-
onSubmit(data);
|
|
1855
|
-
if (form.onSuccess) {
|
|
1856
|
-
form.onSuccess(data);
|
|
1857
|
-
}
|
|
1858
|
-
return;
|
|
1859
|
-
}
|
|
1860
|
-
this.getClient(form.url, form.method, data, function (res) {
|
|
1861
|
-
var e_3, _a;
|
|
1862
|
-
if (res.status === exports.ResultStatusEnum.Success) {
|
|
1863
|
-
if (form.onSuccess) {
|
|
1864
|
-
form.onSuccess(res.result);
|
|
1865
|
-
}
|
|
1866
|
-
if (form.onSuccessBase) {
|
|
1867
|
-
form.onSuccessBase(res.result);
|
|
1868
|
-
}
|
|
1869
|
-
}
|
|
1870
|
-
else {
|
|
1871
|
-
var m = '';
|
|
1872
|
-
if (res.status === exports.ResultStatusEnum.NotRegistered) {
|
|
1873
|
-
m = form.l('FormBaseErrorNotRegistered');
|
|
1874
|
-
}
|
|
1875
|
-
else if (res.status === exports.ResultStatusEnum.ExpiredRegistered) {
|
|
1876
|
-
m = form.l('FormBaseErrorExpiredRegistered');
|
|
1877
|
-
}
|
|
1878
|
-
else if (res.status === exports.ResultStatusEnum.InvalidIp) {
|
|
1879
|
-
m = form.l('FormBaseErrorInvalidIp');
|
|
1880
|
-
}
|
|
1881
|
-
else if (res.status === exports.ResultStatusEnum.NoCredit) {
|
|
1882
|
-
m = form.l('FormBaseErrorNoCredit');
|
|
1883
|
-
}
|
|
1884
|
-
else if (res.status === exports.ResultStatusEnum.Unauthorized) {
|
|
1885
|
-
m = form.l('FormBaseErrorExpired');
|
|
1886
|
-
}
|
|
1887
|
-
else if (res.status === exports.ResultStatusEnum.NotAccess) {
|
|
1888
|
-
m = form.l('FormBaseErrorAccess');
|
|
1889
|
-
}
|
|
1890
|
-
else if (res.status === exports.ResultStatusEnum.NotPermission) {
|
|
1891
|
-
m = form.l('FormBaseErrorPermission');
|
|
1892
|
-
}
|
|
1893
|
-
else {
|
|
1894
|
-
if (typeof res.message === 'string') {
|
|
1895
|
-
var am = res.message.split(':');
|
|
1896
|
-
m = form.l(am[0], am.length > 1 ? am.slice(1) : null);
|
|
1897
|
-
}
|
|
1898
|
-
else {
|
|
1899
|
-
// tslint:disable-next-line:forin
|
|
1900
|
-
for (var msg in res.message) {
|
|
1901
|
-
// noinspection JSUnfilteredForInLoop
|
|
1902
|
-
m = form.l(msg, res.message[msg]);
|
|
1903
|
-
}
|
|
1904
|
-
}
|
|
1905
|
-
form.setError(res);
|
|
1906
|
-
}
|
|
1907
|
-
if (m) {
|
|
1908
|
-
HelperClass.addNotification(m);
|
|
1909
|
-
}
|
|
1910
|
-
if (form.onFailed) {
|
|
1911
|
-
form.onFailed(res.message);
|
|
1912
|
-
}
|
|
1913
|
-
}
|
|
1914
|
-
try {
|
|
1915
|
-
for (var btns_3 = __values(btns), btns_3_1 = btns_3.next(); !btns_3_1.done; btns_3_1 = btns_3.next()) {
|
|
1916
|
-
var btn = btns_3_1.value;
|
|
1917
|
-
btn.loading = false;
|
|
1918
|
-
}
|
|
1919
|
-
}
|
|
1920
|
-
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
1921
|
-
finally {
|
|
1922
|
-
try {
|
|
1923
|
-
if (btns_3_1 && !btns_3_1.done && (_a = btns_3.return)) _a.call(btns_3);
|
|
1924
|
-
}
|
|
1925
|
-
finally { if (e_3) throw e_3.error; }
|
|
1926
|
-
}
|
|
1927
|
-
}, function (res) {
|
|
1928
|
-
var e_4, _a;
|
|
1929
|
-
HelperClass.addNotification(form.l('Error'));
|
|
1930
|
-
if (form.onFailed) {
|
|
1931
|
-
form.onFailed('Error');
|
|
1932
|
-
}
|
|
1933
|
-
try {
|
|
1934
|
-
for (var btns_4 = __values(btns), btns_4_1 = btns_4.next(); !btns_4_1.done; btns_4_1 = btns_4.next()) {
|
|
1935
|
-
var btn = btns_4_1.value;
|
|
1936
|
-
btn.loading = false;
|
|
1937
|
-
}
|
|
1938
|
-
}
|
|
1939
|
-
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1940
|
-
finally {
|
|
1941
|
-
try {
|
|
1942
|
-
if (btns_4_1 && !btns_4_1.done && (_a = btns_4.return)) _a.call(btns_4);
|
|
1943
|
-
}
|
|
1944
|
-
finally { if (e_4) throw e_4.error; }
|
|
1945
|
-
}
|
|
1946
|
-
});
|
|
1947
|
-
};
|
|
1948
|
-
RequestClass.prototype.table = function (table, btn) {
|
|
1949
|
-
if (btn === void 0) { btn = null; }
|
|
1950
|
-
if (table.searchForm && !table.searchForm.check()) {
|
|
1951
|
-
return;
|
|
1952
|
-
}
|
|
1953
|
-
table.loading = true;
|
|
1954
|
-
if (btn) {
|
|
1955
|
-
if (btn.loading) {
|
|
1956
|
-
return;
|
|
1957
|
-
}
|
|
1958
|
-
btn.loading = true;
|
|
1959
|
-
}
|
|
1960
|
-
this.getClient(table.url, table.method, table.searchData(), function (res) {
|
|
1961
|
-
if (res.status === exports.ResultStatusEnum.Success) {
|
|
1962
|
-
if (table.vertical) {
|
|
1963
|
-
var c_1 = {};
|
|
1964
|
-
table.cols.forEach(function (x) { return c_1[x.name] = x.name; });
|
|
1965
|
-
c_1.ColType = 'Column';
|
|
1966
|
-
res.result.List.unshift({ Data: c_1, Options: [] });
|
|
1967
|
-
}
|
|
1968
|
-
table.rows = res.result.List;
|
|
1969
|
-
table.count = res.result.Count;
|
|
1970
|
-
if (table.onLoad) {
|
|
1971
|
-
table.onLoad(res.result.Data);
|
|
1972
|
-
}
|
|
1973
|
-
if (btn) {
|
|
1974
|
-
btn.loading = false;
|
|
1975
|
-
}
|
|
1976
|
-
table.loading = false;
|
|
1977
|
-
}
|
|
1978
|
-
else {
|
|
1979
|
-
var m = '';
|
|
1980
|
-
if (res.status === exports.ResultStatusEnum.NotRegistered) {
|
|
1981
|
-
m = 'FormBaseErrorNotRegistered';
|
|
1982
|
-
}
|
|
1983
|
-
else if (res.status === exports.ResultStatusEnum.ExpiredRegistered) {
|
|
1984
|
-
m = 'FormBaseErrorExpiredRegistered';
|
|
1985
|
-
}
|
|
1986
|
-
else if (res.status === exports.ResultStatusEnum.InvalidIp) {
|
|
1987
|
-
m = 'FormBaseErrorInvalidIp';
|
|
1988
|
-
}
|
|
1989
|
-
else if (res.status === exports.ResultStatusEnum.NoCredit) {
|
|
1990
|
-
m = 'FormBaseErrorNoCredit';
|
|
1991
|
-
}
|
|
1992
|
-
else if (res.status === exports.ResultStatusEnum.Unauthorized) {
|
|
1993
|
-
m = 'FormBaseErrorExpired';
|
|
1994
|
-
}
|
|
1995
|
-
else if (res.status === exports.ResultStatusEnum.NotAccess) {
|
|
1996
|
-
m = 'FormBaseErrorAccess';
|
|
1997
|
-
}
|
|
1998
|
-
else if (res.status === exports.ResultStatusEnum.NotPermission) {
|
|
1999
|
-
m = 'FormBaseErrorPermission';
|
|
2000
|
-
}
|
|
2001
|
-
else {
|
|
2002
|
-
if (typeof res.message === 'string') {
|
|
2003
|
-
var am = res.message.split(':');
|
|
2004
|
-
m = table.l(am[0], am.length > 1 ? am.slice(1) : null);
|
|
2005
|
-
}
|
|
2006
|
-
else {
|
|
2007
|
-
// tslint:disable-next-line:forin
|
|
2008
|
-
for (var msg in res.message) {
|
|
2009
|
-
// noinspection JSUnfilteredForInLoop
|
|
2010
|
-
m = table.l(msg, res.message[msg]);
|
|
2011
|
-
}
|
|
2012
|
-
}
|
|
2013
|
-
}
|
|
2014
|
-
if (m) {
|
|
2015
|
-
HelperClass.addNotification(table.l(m));
|
|
2016
|
-
}
|
|
2017
|
-
table.rows = [];
|
|
2018
|
-
table.count = 0;
|
|
2019
|
-
table.page = 1;
|
|
2020
|
-
if (btn) {
|
|
2021
|
-
btn.loading = false;
|
|
2022
|
-
}
|
|
2023
|
-
table.loading = false;
|
|
2024
|
-
}
|
|
2025
|
-
}, function (res) {
|
|
2026
|
-
table.rows = [];
|
|
2027
|
-
table.count = 0;
|
|
2028
|
-
table.page = 1;
|
|
2029
|
-
if (btn) {
|
|
2030
|
-
btn.loading = false;
|
|
2031
|
-
}
|
|
2032
|
-
table.loading = false;
|
|
2033
|
-
});
|
|
2034
|
-
};
|
|
2035
|
-
RequestClass.prototype.send = function (url, method, data, btn, success, failure) {
|
|
1852
|
+
RequestClass.prototype.send = function (url, method, data, btn, success, failure, request) {
|
|
2036
1853
|
var _this = this;
|
|
2037
1854
|
if (btn === void 0) { btn = null; }
|
|
2038
1855
|
if (success === void 0) { success = null; }
|
|
2039
1856
|
if (failure === void 0) { failure = null; }
|
|
1857
|
+
if (request === void 0) { request = null; }
|
|
2040
1858
|
if (btn) {
|
|
2041
1859
|
if (btn.loading) {
|
|
2042
1860
|
return;
|
|
@@ -2046,7 +1864,7 @@
|
|
|
2046
1864
|
if (data === null) {
|
|
2047
1865
|
data = new FormData();
|
|
2048
1866
|
}
|
|
2049
|
-
this.getClient(url, method, data, function (res) {
|
|
1867
|
+
this.getClient(request, url, method, data, function (res) {
|
|
2050
1868
|
if (res.status === exports.ResultStatusEnum.Success) {
|
|
2051
1869
|
if (success) {
|
|
2052
1870
|
success(res.result);
|
|
@@ -2123,7 +1941,7 @@
|
|
|
2123
1941
|
if (data === null) {
|
|
2124
1942
|
data = new FormData();
|
|
2125
1943
|
}
|
|
2126
|
-
this.getClient(url, method, data, function (res) {
|
|
1944
|
+
this.getClient(null, url, method, data, function (res) {
|
|
2127
1945
|
if (success) {
|
|
2128
1946
|
success(res);
|
|
2129
1947
|
}
|
|
@@ -2139,11 +1957,11 @@
|
|
|
2139
1957
|
}
|
|
2140
1958
|
});
|
|
2141
1959
|
};
|
|
2142
|
-
RequestClass.prototype.getClient = function (url, method, data, done, fail) {
|
|
1960
|
+
RequestClass.prototype.getClient = function (request, url, method, data, done, fail) {
|
|
2143
1961
|
var _this = this;
|
|
2144
1962
|
var token = HelperClass.getCookie('Authorization');
|
|
2145
1963
|
if (!(data instanceof FormData)) {
|
|
2146
|
-
data =
|
|
1964
|
+
data = HelperClass.jsonToFormData(data);
|
|
2147
1965
|
}
|
|
2148
1966
|
var settings = {
|
|
2149
1967
|
url: (url.includes('https://') || url.includes('http://') ? '' : this.environment.apiUrl) + url,
|
|
@@ -2153,95 +1971,23 @@
|
|
|
2153
1971
|
data: data,
|
|
2154
1972
|
headers: token == null ? {} : { Authorization: token }
|
|
2155
1973
|
};
|
|
2156
|
-
if (
|
|
2157
|
-
|
|
1974
|
+
if (request != null) {
|
|
1975
|
+
request.abort();
|
|
2158
1976
|
}
|
|
2159
|
-
|
|
2160
|
-
|
|
1977
|
+
request = $$1.ajax(settings);
|
|
1978
|
+
request.done(function (response) {
|
|
2161
1979
|
if (!_this.environment.production) {
|
|
2162
1980
|
console.log('%c' + exports.Method[method].toString() + ' : ' + url, 'background: #2f6054; color: white', response);
|
|
2163
1981
|
}
|
|
2164
1982
|
done(response);
|
|
2165
1983
|
});
|
|
2166
|
-
|
|
1984
|
+
request.fail(function (response) {
|
|
2167
1985
|
if (!_this.environment.production) {
|
|
2168
1986
|
console.log('%c' + exports.Method[method].toString() + ' : ' + url, 'background: #8c413a; color: white', response);
|
|
2169
1987
|
}
|
|
2170
1988
|
fail(response);
|
|
2171
1989
|
});
|
|
2172
1990
|
};
|
|
2173
|
-
RequestClass.prototype.jsonToFormData = function (json, formData, parentKey) {
|
|
2174
|
-
var _this = this;
|
|
2175
|
-
if (formData === void 0) { formData = new FormData(); }
|
|
2176
|
-
if (parentKey === void 0) { parentKey = ''; }
|
|
2177
|
-
if (typeof json === 'object' && json !== null) {
|
|
2178
|
-
Object.keys(json).forEach(function (key) {
|
|
2179
|
-
var fullKey = parentKey ? parentKey + "[" + key + "]" : key;
|
|
2180
|
-
var value = json[key];
|
|
2181
|
-
if (value === null) {
|
|
2182
|
-
// اگر مقدار null است، آن را نادیده بگیر
|
|
2183
|
-
return;
|
|
2184
|
-
}
|
|
2185
|
-
else if (typeof value === 'object' && !Array.isArray(value)) {
|
|
2186
|
-
// اگر آبجکت است، به صورت بازگشتی فراخوانی کن
|
|
2187
|
-
_this.jsonToFormData(value, formData, fullKey);
|
|
2188
|
-
}
|
|
2189
|
-
else if (Array.isArray(value)) {
|
|
2190
|
-
// اگر آرایه است، هر عضو را جداگانه اضافه کن
|
|
2191
|
-
value.forEach(function (item, index) {
|
|
2192
|
-
var arrayKey = fullKey + "[" + index + "]";
|
|
2193
|
-
if (item === null) {
|
|
2194
|
-
// اگر مقدار null است، آن را نادیده بگیر
|
|
2195
|
-
return;
|
|
2196
|
-
}
|
|
2197
|
-
else if (typeof item === 'object') {
|
|
2198
|
-
_this.jsonToFormData(item, formData, arrayKey);
|
|
2199
|
-
}
|
|
2200
|
-
else {
|
|
2201
|
-
formData.append(arrayKey, item);
|
|
2202
|
-
}
|
|
2203
|
-
});
|
|
2204
|
-
}
|
|
2205
|
-
else {
|
|
2206
|
-
// مقدار ساده را اضافه کن
|
|
2207
|
-
formData.append(fullKey, value);
|
|
2208
|
-
}
|
|
2209
|
-
});
|
|
2210
|
-
}
|
|
2211
|
-
return formData;
|
|
2212
|
-
};
|
|
2213
|
-
RequestClass.prototype.jsonToFormDataOld = function (json, formData, parentKey) {
|
|
2214
|
-
var _this = this;
|
|
2215
|
-
if (formData === void 0) { formData = new FormData(); }
|
|
2216
|
-
if (parentKey === void 0) { parentKey = ''; }
|
|
2217
|
-
if (typeof json === 'object' && json !== null) {
|
|
2218
|
-
Object.keys(json).forEach(function (key) {
|
|
2219
|
-
var fullKey = parentKey ? parentKey + "[" + key + "]" : key;
|
|
2220
|
-
var value = json[key];
|
|
2221
|
-
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
2222
|
-
// اگر آبجکت است، به صورت بازگشتی فراخوانی کن
|
|
2223
|
-
_this.jsonToFormData(value, formData, fullKey);
|
|
2224
|
-
}
|
|
2225
|
-
else if (Array.isArray(value)) {
|
|
2226
|
-
// اگر آرایه است، هر عضو را جداگانه اضافه کن
|
|
2227
|
-
value.forEach(function (item, index) {
|
|
2228
|
-
var arrayKey = fullKey + "[" + index + "]";
|
|
2229
|
-
if (typeof item === 'object' && item !== null) {
|
|
2230
|
-
_this.jsonToFormData(item, formData, arrayKey);
|
|
2231
|
-
}
|
|
2232
|
-
else {
|
|
2233
|
-
formData.append(arrayKey, item);
|
|
2234
|
-
}
|
|
2235
|
-
});
|
|
2236
|
-
}
|
|
2237
|
-
else {
|
|
2238
|
-
// مقدار ساده را اضافه کن
|
|
2239
|
-
formData.append(fullKey, value);
|
|
2240
|
-
}
|
|
2241
|
-
});
|
|
2242
|
-
}
|
|
2243
|
-
return formData;
|
|
2244
|
-
};
|
|
2245
1991
|
return RequestClass;
|
|
2246
1992
|
}());
|
|
2247
1993
|
|
|
@@ -2292,6 +2038,7 @@
|
|
|
2292
2038
|
this.loading = false;
|
|
2293
2039
|
this.onTop = false;
|
|
2294
2040
|
this.displayLabel = true;
|
|
2041
|
+
this.request = null;
|
|
2295
2042
|
this.inputs = [];
|
|
2296
2043
|
this.onSuccessBase = null;
|
|
2297
2044
|
this.onSuccess = null;
|
|
@@ -2325,7 +2072,7 @@
|
|
|
2325
2072
|
_this.permission = false;
|
|
2326
2073
|
_this.loading = false;
|
|
2327
2074
|
}
|
|
2328
|
-
});
|
|
2075
|
+
}, this.request);
|
|
2329
2076
|
};
|
|
2330
2077
|
FormClass.prototype.focus = function () {
|
|
2331
2078
|
var i = this.inputs.find(function (x) { return !x.disabled && x.type !== exports.InputType.Label && x.type !== exports.InputType.Hidden &&
|
|
@@ -2336,8 +2083,140 @@
|
|
|
2336
2083
|
}
|
|
2337
2084
|
};
|
|
2338
2085
|
FormClass.prototype.submit = function (onSubmit) {
|
|
2086
|
+
var e_1, _c, e_2, _d;
|
|
2087
|
+
var _this = this;
|
|
2339
2088
|
if (onSubmit === void 0) { onSubmit = null; }
|
|
2340
|
-
|
|
2089
|
+
if (!this.check()) {
|
|
2090
|
+
return;
|
|
2091
|
+
}
|
|
2092
|
+
if (this.onBeforeSubmit && !this.onBeforeSubmit()) {
|
|
2093
|
+
return;
|
|
2094
|
+
}
|
|
2095
|
+
var btns = this.inputs.filter(function (x) { return x.type === exports.InputType.Submit; });
|
|
2096
|
+
try {
|
|
2097
|
+
for (var btns_1 = __values(btns), btns_1_1 = btns_1.next(); !btns_1_1.done; btns_1_1 = btns_1.next()) {
|
|
2098
|
+
var btn = btns_1_1.value;
|
|
2099
|
+
if (btn.loading) {
|
|
2100
|
+
return;
|
|
2101
|
+
}
|
|
2102
|
+
btn.loading = true;
|
|
2103
|
+
}
|
|
2104
|
+
}
|
|
2105
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
2106
|
+
finally {
|
|
2107
|
+
try {
|
|
2108
|
+
if (btns_1_1 && !btns_1_1.done && (_c = btns_1.return)) _c.call(btns_1);
|
|
2109
|
+
}
|
|
2110
|
+
finally { if (e_1) throw e_1.error; }
|
|
2111
|
+
}
|
|
2112
|
+
var data = this.data();
|
|
2113
|
+
if (onSubmit) {
|
|
2114
|
+
try {
|
|
2115
|
+
for (var btns_2 = __values(btns), btns_2_1 = btns_2.next(); !btns_2_1.done; btns_2_1 = btns_2.next()) {
|
|
2116
|
+
var btn = btns_2_1.value;
|
|
2117
|
+
btn.loading = false;
|
|
2118
|
+
}
|
|
2119
|
+
}
|
|
2120
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
2121
|
+
finally {
|
|
2122
|
+
try {
|
|
2123
|
+
if (btns_2_1 && !btns_2_1.done && (_d = btns_2.return)) _d.call(btns_2);
|
|
2124
|
+
}
|
|
2125
|
+
finally { if (e_2) throw e_2.error; }
|
|
2126
|
+
}
|
|
2127
|
+
onSubmit(data);
|
|
2128
|
+
if (this.onSuccess) {
|
|
2129
|
+
this.onSuccess(data);
|
|
2130
|
+
}
|
|
2131
|
+
return;
|
|
2132
|
+
}
|
|
2133
|
+
new RequestClass(this.environment).getClient(this.request, this.url, this.method, data, function (res) {
|
|
2134
|
+
var e_3, _c;
|
|
2135
|
+
if (res.status === exports.ResultStatusEnum.Success) {
|
|
2136
|
+
if (_this.onSuccess) {
|
|
2137
|
+
_this.onSuccess(res.result);
|
|
2138
|
+
}
|
|
2139
|
+
if (_this.onSuccessBase) {
|
|
2140
|
+
_this.onSuccessBase(res.result);
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
else {
|
|
2144
|
+
var m = '';
|
|
2145
|
+
if (res.status === exports.ResultStatusEnum.NotRegistered) {
|
|
2146
|
+
m = _this.l('FormBaseErrorNotRegistered');
|
|
2147
|
+
}
|
|
2148
|
+
else if (res.status === exports.ResultStatusEnum.ExpiredRegistered) {
|
|
2149
|
+
m = _this.l('FormBaseErrorExpiredRegistered');
|
|
2150
|
+
}
|
|
2151
|
+
else if (res.status === exports.ResultStatusEnum.InvalidIp) {
|
|
2152
|
+
m = _this.l('FormBaseErrorInvalidIp');
|
|
2153
|
+
}
|
|
2154
|
+
else if (res.status === exports.ResultStatusEnum.NoCredit) {
|
|
2155
|
+
m = _this.l('FormBaseErrorNoCredit');
|
|
2156
|
+
}
|
|
2157
|
+
else if (res.status === exports.ResultStatusEnum.Unauthorized) {
|
|
2158
|
+
m = _this.l('FormBaseErrorExpired');
|
|
2159
|
+
}
|
|
2160
|
+
else if (res.status === exports.ResultStatusEnum.NotAccess) {
|
|
2161
|
+
m = _this.l('FormBaseErrorAccess');
|
|
2162
|
+
}
|
|
2163
|
+
else if (res.status === exports.ResultStatusEnum.NotPermission) {
|
|
2164
|
+
m = _this.l('FormBaseErrorPermission');
|
|
2165
|
+
}
|
|
2166
|
+
else {
|
|
2167
|
+
if (typeof res.message === 'string') {
|
|
2168
|
+
var am = res.message.split(':');
|
|
2169
|
+
m = _this.l(am[0], am.length > 1 ? am.slice(1) : null);
|
|
2170
|
+
}
|
|
2171
|
+
else {
|
|
2172
|
+
// tslint:disable-next-line:forin
|
|
2173
|
+
for (var msg in res.message) {
|
|
2174
|
+
// noinspection JSUnfilteredForInLoop
|
|
2175
|
+
m = _this.l(msg, res.message[msg]);
|
|
2176
|
+
}
|
|
2177
|
+
}
|
|
2178
|
+
_this.setError(res);
|
|
2179
|
+
}
|
|
2180
|
+
if (m) {
|
|
2181
|
+
HelperClass.addNotification(m);
|
|
2182
|
+
}
|
|
2183
|
+
if (_this.onFailed) {
|
|
2184
|
+
_this.onFailed(res.message);
|
|
2185
|
+
}
|
|
2186
|
+
}
|
|
2187
|
+
try {
|
|
2188
|
+
for (var btns_3 = __values(btns), btns_3_1 = btns_3.next(); !btns_3_1.done; btns_3_1 = btns_3.next()) {
|
|
2189
|
+
var btn = btns_3_1.value;
|
|
2190
|
+
btn.loading = false;
|
|
2191
|
+
}
|
|
2192
|
+
}
|
|
2193
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
2194
|
+
finally {
|
|
2195
|
+
try {
|
|
2196
|
+
if (btns_3_1 && !btns_3_1.done && (_c = btns_3.return)) _c.call(btns_3);
|
|
2197
|
+
}
|
|
2198
|
+
finally { if (e_3) throw e_3.error; }
|
|
2199
|
+
}
|
|
2200
|
+
}, function () {
|
|
2201
|
+
var e_4, _c;
|
|
2202
|
+
HelperClass.addNotification(_this.l('Error'));
|
|
2203
|
+
if (_this.onFailed) {
|
|
2204
|
+
_this.onFailed('Error');
|
|
2205
|
+
}
|
|
2206
|
+
try {
|
|
2207
|
+
for (var btns_4 = __values(btns), btns_4_1 = btns_4.next(); !btns_4_1.done; btns_4_1 = btns_4.next()) {
|
|
2208
|
+
var btn = btns_4_1.value;
|
|
2209
|
+
btn.loading = false;
|
|
2210
|
+
}
|
|
2211
|
+
}
|
|
2212
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
2213
|
+
finally {
|
|
2214
|
+
try {
|
|
2215
|
+
if (btns_4_1 && !btns_4_1.done && (_c = btns_4.return)) _c.call(btns_4);
|
|
2216
|
+
}
|
|
2217
|
+
finally { if (e_4) throw e_4.error; }
|
|
2218
|
+
}
|
|
2219
|
+
});
|
|
2341
2220
|
};
|
|
2342
2221
|
FormClass.prototype.check = function () {
|
|
2343
2222
|
var valid = true;
|
|
@@ -2367,10 +2246,9 @@
|
|
|
2367
2246
|
inp.clear();
|
|
2368
2247
|
});
|
|
2369
2248
|
};
|
|
2370
|
-
FormClass.prototype.setButtons = function (formOnTop, edit, insertAccess, updateAccess
|
|
2249
|
+
FormClass.prototype.setButtons = function (formOnTop, edit, insertAccess, updateAccess) {
|
|
2371
2250
|
if (insertAccess === void 0) { insertAccess = false; }
|
|
2372
2251
|
if (updateAccess === void 0) { updateAccess = false; }
|
|
2373
|
-
if (id === void 0) { id = null; }
|
|
2374
2252
|
var s = this.inputs.find(function (x) { return x.type === exports.InputType.Submit; });
|
|
2375
2253
|
if (!s) {
|
|
2376
2254
|
return;
|
|
@@ -2431,7 +2309,7 @@
|
|
|
2431
2309
|
}
|
|
2432
2310
|
}
|
|
2433
2311
|
var setD = function (n, vl) {
|
|
2434
|
-
var
|
|
2312
|
+
var e_5, _c;
|
|
2435
2313
|
if (d instanceof FormData) {
|
|
2436
2314
|
if (vl instanceof Array) {
|
|
2437
2315
|
try {
|
|
@@ -2440,12 +2318,12 @@
|
|
|
2440
2318
|
d.append(n, v);
|
|
2441
2319
|
}
|
|
2442
2320
|
}
|
|
2443
|
-
catch (
|
|
2321
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
2444
2322
|
finally {
|
|
2445
2323
|
try {
|
|
2446
2324
|
if (vl_1_1 && !vl_1_1.done && (_c = vl_1.return)) _c.call(vl_1);
|
|
2447
2325
|
}
|
|
2448
|
-
finally { if (
|
|
2326
|
+
finally { if (e_5) throw e_5.error; }
|
|
2449
2327
|
}
|
|
2450
2328
|
}
|
|
2451
2329
|
else {
|
|
@@ -2467,7 +2345,7 @@
|
|
|
2467
2345
|
}
|
|
2468
2346
|
};
|
|
2469
2347
|
this.inputs.forEach(function (inp) {
|
|
2470
|
-
var
|
|
2348
|
+
var e_6, _c;
|
|
2471
2349
|
var vl = inp.data();
|
|
2472
2350
|
if (vl !== null) {
|
|
2473
2351
|
if (typeof vl === 'object' && !(vl instanceof Array)) {
|
|
@@ -2477,12 +2355,12 @@
|
|
|
2477
2355
|
setD(key, value);
|
|
2478
2356
|
}
|
|
2479
2357
|
}
|
|
2480
|
-
catch (
|
|
2358
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
2481
2359
|
finally {
|
|
2482
2360
|
try {
|
|
2483
2361
|
if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
|
|
2484
2362
|
}
|
|
2485
|
-
finally { if (
|
|
2363
|
+
finally { if (e_6) throw e_6.error; }
|
|
2486
2364
|
}
|
|
2487
2365
|
}
|
|
2488
2366
|
else {
|
|
@@ -2498,7 +2376,7 @@
|
|
|
2498
2376
|
d = {};
|
|
2499
2377
|
}
|
|
2500
2378
|
this.inputs.forEach(function (inp) {
|
|
2501
|
-
var
|
|
2379
|
+
var e_7, _c;
|
|
2502
2380
|
var vl = inp.data();
|
|
2503
2381
|
if (vl !== null && vl !== '') {
|
|
2504
2382
|
if (vl instanceof Array) {
|
|
@@ -2508,12 +2386,12 @@
|
|
|
2508
2386
|
d[inp.name] = v;
|
|
2509
2387
|
}
|
|
2510
2388
|
}
|
|
2511
|
-
catch (
|
|
2389
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
2512
2390
|
finally {
|
|
2513
2391
|
try {
|
|
2514
2392
|
if (vl_2_1 && !vl_2_1.done && (_c = vl_2.return)) _c.call(vl_2);
|
|
2515
2393
|
}
|
|
2516
|
-
finally { if (
|
|
2394
|
+
finally { if (e_7) throw e_7.error; }
|
|
2517
2395
|
}
|
|
2518
2396
|
}
|
|
2519
2397
|
else {
|
|
@@ -2626,6 +2504,7 @@
|
|
|
2626
2504
|
this.rows = [];
|
|
2627
2505
|
this.level = null;
|
|
2628
2506
|
this.modal = null;
|
|
2507
|
+
this.request = null;
|
|
2629
2508
|
this.nameFun = null;
|
|
2630
2509
|
this.onFocusOut = null;
|
|
2631
2510
|
this.changeType = function () { };
|
|
@@ -2696,7 +2575,7 @@
|
|
|
2696
2575
|
if (done) {
|
|
2697
2576
|
done();
|
|
2698
2577
|
}
|
|
2699
|
-
});
|
|
2578
|
+
}, function () { }, this.request);
|
|
2700
2579
|
}
|
|
2701
2580
|
}
|
|
2702
2581
|
else {
|
|
@@ -2770,7 +2649,7 @@
|
|
|
2770
2649
|
return this.getSelectedOptions(opts).map(function (x) { return x.value; });
|
|
2771
2650
|
};
|
|
2772
2651
|
InputClass.prototype.getSelectedOptions = function (opts) {
|
|
2773
|
-
var
|
|
2652
|
+
var e_8, _c;
|
|
2774
2653
|
if (opts === void 0) { opts = this.options; }
|
|
2775
2654
|
var l = [];
|
|
2776
2655
|
try {
|
|
@@ -2783,17 +2662,17 @@
|
|
|
2783
2662
|
l = l.concat(rs);
|
|
2784
2663
|
}
|
|
2785
2664
|
}
|
|
2786
|
-
catch (
|
|
2665
|
+
catch (e_8_1) { e_8 = { error: e_8_1 }; }
|
|
2787
2666
|
finally {
|
|
2788
2667
|
try {
|
|
2789
2668
|
if (opts_1_1 && !opts_1_1.done && (_c = opts_1.return)) _c.call(opts_1);
|
|
2790
2669
|
}
|
|
2791
|
-
finally { if (
|
|
2670
|
+
finally { if (e_8) throw e_8.error; }
|
|
2792
2671
|
}
|
|
2793
2672
|
return l;
|
|
2794
2673
|
};
|
|
2795
2674
|
InputClass.prototype.getSelectedRows = function (rows) {
|
|
2796
|
-
var
|
|
2675
|
+
var e_9, _c;
|
|
2797
2676
|
if (rows === void 0) { rows = this.rows; }
|
|
2798
2677
|
var l = [];
|
|
2799
2678
|
try {
|
|
@@ -2806,17 +2685,17 @@
|
|
|
2806
2685
|
l = l.concat(rs);
|
|
2807
2686
|
}
|
|
2808
2687
|
}
|
|
2809
|
-
catch (
|
|
2688
|
+
catch (e_9_1) { e_9 = { error: e_9_1 }; }
|
|
2810
2689
|
finally {
|
|
2811
2690
|
try {
|
|
2812
2691
|
if (rows_1_1 && !rows_1_1.done && (_c = rows_1.return)) _c.call(rows_1);
|
|
2813
2692
|
}
|
|
2814
|
-
finally { if (
|
|
2693
|
+
finally { if (e_9) throw e_9.error; }
|
|
2815
2694
|
}
|
|
2816
2695
|
return l;
|
|
2817
2696
|
};
|
|
2818
2697
|
InputClass.prototype.getAllRows = function (rows) {
|
|
2819
|
-
var
|
|
2698
|
+
var e_10, _c;
|
|
2820
2699
|
if (rows === void 0) { rows = this.rows; }
|
|
2821
2700
|
var l = [];
|
|
2822
2701
|
try {
|
|
@@ -2829,12 +2708,12 @@
|
|
|
2829
2708
|
l = l.concat(rs);
|
|
2830
2709
|
}
|
|
2831
2710
|
}
|
|
2832
|
-
catch (
|
|
2711
|
+
catch (e_10_1) { e_10 = { error: e_10_1 }; }
|
|
2833
2712
|
finally {
|
|
2834
2713
|
try {
|
|
2835
2714
|
if (rows_2_1 && !rows_2_1.done && (_c = rows_2.return)) _c.call(rows_2);
|
|
2836
2715
|
}
|
|
2837
|
-
finally { if (
|
|
2716
|
+
finally { if (e_10) throw e_10.error; }
|
|
2838
2717
|
}
|
|
2839
2718
|
return l;
|
|
2840
2719
|
};
|
|
@@ -2893,7 +2772,7 @@
|
|
|
2893
2772
|
this.rows = rows;
|
|
2894
2773
|
}
|
|
2895
2774
|
AccordionClass.prototype.check = function () {
|
|
2896
|
-
var
|
|
2775
|
+
var e_11, _c;
|
|
2897
2776
|
try {
|
|
2898
2777
|
for (var _d = __values(this.rows), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
2899
2778
|
var row = _e.value;
|
|
@@ -2903,12 +2782,12 @@
|
|
|
2903
2782
|
}
|
|
2904
2783
|
}
|
|
2905
2784
|
}
|
|
2906
|
-
catch (
|
|
2785
|
+
catch (e_11_1) { e_11 = { error: e_11_1 }; }
|
|
2907
2786
|
finally {
|
|
2908
2787
|
try {
|
|
2909
2788
|
if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
|
|
2910
2789
|
}
|
|
2911
|
-
finally { if (
|
|
2790
|
+
finally { if (e_11) throw e_11.error; }
|
|
2912
2791
|
}
|
|
2913
2792
|
return true;
|
|
2914
2793
|
};
|
|
@@ -3462,7 +3341,7 @@
|
|
|
3462
3341
|
$__namespace(_this.childrenDiv.nativeElement).slideDown();
|
|
3463
3342
|
_this.showChildren.icon = 'fa-duotone fa-angle-down f-s-22';
|
|
3464
3343
|
}, 50);
|
|
3465
|
-
});
|
|
3344
|
+
}, function () { }, this.table.request);
|
|
3466
3345
|
};
|
|
3467
3346
|
TableRowComponent.prototype.select = function () {
|
|
3468
3347
|
this.row.selected = !this.row.selected;
|
|
@@ -3496,7 +3375,7 @@
|
|
|
3496
3375
|
if (_this.table.onSort) {
|
|
3497
3376
|
_this.table.onSort();
|
|
3498
3377
|
}
|
|
3499
|
-
});
|
|
3378
|
+
}, function () { }, _this.table.request);
|
|
3500
3379
|
}
|
|
3501
3380
|
});
|
|
3502
3381
|
}
|
|
@@ -3515,7 +3394,7 @@
|
|
|
3515
3394
|
_this.row.Data[option.Action] = !inp.data();
|
|
3516
3395
|
new RequestClass(_this.table.environment, _this.table.l).send(_this.table.getOptionUrl(option.Url, _this.table.permissions.RelatedId, _this.row.Data.Id), exports.Method.Post, null, null, function () {
|
|
3517
3396
|
_this.table.load();
|
|
3518
|
-
});
|
|
3397
|
+
}, function () { }, _this.table.request);
|
|
3519
3398
|
};
|
|
3520
3399
|
inp.displayLabel = false;
|
|
3521
3400
|
opts.push(inp);
|
|
@@ -3853,7 +3732,7 @@
|
|
|
3853
3732
|
if (this.table.permissions.Type === exports.PermissionTypeEnum.Form) {
|
|
3854
3733
|
this.table.form.name = opt.name;
|
|
3855
3734
|
this.table.form.setData(this.row.Data);
|
|
3856
|
-
this.table.form.setButtons(this.table.form.onTop, true, false, true
|
|
3735
|
+
this.table.form.setButtons(this.table.form.onTop, true, false, true);
|
|
3857
3736
|
this.table.form.inputs.filter(function (x) { return x.inEditDisabled; }).forEach(function (x) { return x.disabled = true; });
|
|
3858
3737
|
this.table.form.inputs.filter(function (x) { return !x.inEditVisible; }).forEach(function (x) { return x.visible = false; });
|
|
3859
3738
|
this.table.form.inputs.forEach(function (x) { return x.required = x.inEditRequired; });
|
|
@@ -3869,7 +3748,7 @@
|
|
|
3869
3748
|
new RequestClass(this.table.environment, this.table.l).send(this.table.getOptionUrl(option.Url.replace('update', 'get'), this.table.permissions.RelatedId, this.row.Data.Id), exports.Method.Post, data, opt, function (result) {
|
|
3870
3749
|
_this.table.form.name = opt.name;
|
|
3871
3750
|
_this.table.form.setData(result);
|
|
3872
|
-
_this.table.form.setButtons(_this.table.form.onTop, true, false, true
|
|
3751
|
+
_this.table.form.setButtons(_this.table.form.onTop, true, false, true);
|
|
3873
3752
|
_this.table.form.inputs.filter(function (x) { return x.inEditDisabled; }).forEach(function (x) { return x.disabled = true; });
|
|
3874
3753
|
_this.table.form.inputs.filter(function (x) { return !x.inEditVisible; }).forEach(function (x) { return x.visible = false; });
|
|
3875
3754
|
_this.table.form.inputs.forEach(function (x) { return x.required = x.inEditRequired; });
|
|
@@ -3879,7 +3758,7 @@
|
|
|
3879
3758
|
if (_this.table.form.onLoad) {
|
|
3880
3759
|
_this.table.form.onLoad(result);
|
|
3881
3760
|
}
|
|
3882
|
-
});
|
|
3761
|
+
}, function () { }, this.table.request);
|
|
3883
3762
|
}
|
|
3884
3763
|
};
|
|
3885
3764
|
TableRowComponent.prototype.getChildren = function () {
|
|
@@ -4113,7 +3992,7 @@
|
|
|
4113
3992
|
if (_this.table.onSort) {
|
|
4114
3993
|
_this.table.onSort();
|
|
4115
3994
|
}
|
|
4116
|
-
});
|
|
3995
|
+
}, function () { }, _this.table.request);
|
|
4117
3996
|
}
|
|
4118
3997
|
}).disableSelection();
|
|
4119
3998
|
}, 500);
|
|
@@ -9246,7 +9125,6 @@
|
|
|
9246
9125
|
this.count = 0;
|
|
9247
9126
|
this.page = 1;
|
|
9248
9127
|
this.sort = null;
|
|
9249
|
-
this.queryParams = {};
|
|
9250
9128
|
this.title = null;
|
|
9251
9129
|
this.description = null;
|
|
9252
9130
|
this.sortType = null;
|
|
@@ -9268,6 +9146,7 @@
|
|
|
9268
9146
|
this.relatedRow = false;
|
|
9269
9147
|
this.listAccess = null;
|
|
9270
9148
|
this.insertAccess = null;
|
|
9149
|
+
this.request = null;
|
|
9271
9150
|
this.onLoad = null;
|
|
9272
9151
|
this.onSort = null;
|
|
9273
9152
|
this.getRowClass = null;
|
|
@@ -9284,7 +9163,7 @@
|
|
|
9284
9163
|
TableClass.prototype.load = function (btn) {
|
|
9285
9164
|
if (btn === void 0) { btn = null; }
|
|
9286
9165
|
if (this.url) {
|
|
9287
|
-
|
|
9166
|
+
this.sendRequest(btn);
|
|
9288
9167
|
}
|
|
9289
9168
|
else {
|
|
9290
9169
|
this.loading = false;
|
|
@@ -9293,6 +9172,94 @@
|
|
|
9293
9172
|
TableClass.prototype.data = function () {
|
|
9294
9173
|
return this.rows.filter(function (x) { return x.selected; }).map(function (x) { return x.Data; });
|
|
9295
9174
|
};
|
|
9175
|
+
TableClass.prototype.sendRequest = function (btn) {
|
|
9176
|
+
var _this = this;
|
|
9177
|
+
if (btn === void 0) { btn = null; }
|
|
9178
|
+
if (this.searchForm && !this.searchForm.check()) {
|
|
9179
|
+
return;
|
|
9180
|
+
}
|
|
9181
|
+
this.loading = true;
|
|
9182
|
+
if (btn) {
|
|
9183
|
+
if (btn.loading) {
|
|
9184
|
+
return;
|
|
9185
|
+
}
|
|
9186
|
+
btn.loading = true;
|
|
9187
|
+
}
|
|
9188
|
+
new RequestClass(this.environment).getClient(this.request, this.url, this.method, this.searchData(), function (res) {
|
|
9189
|
+
if (res.status === exports.ResultStatusEnum.Success) {
|
|
9190
|
+
if (_this.vertical) {
|
|
9191
|
+
var c_1 = {};
|
|
9192
|
+
_this.cols.forEach(function (x) { return c_1[x.name] = x.name; });
|
|
9193
|
+
c_1.ColType = 'Column';
|
|
9194
|
+
res.result.List.unshift({ Data: c_1, Options: [] });
|
|
9195
|
+
}
|
|
9196
|
+
_this.rows = res.result.List;
|
|
9197
|
+
_this.count = res.result.Count;
|
|
9198
|
+
if (_this.onLoad) {
|
|
9199
|
+
_this.onLoad(res.result.Data);
|
|
9200
|
+
}
|
|
9201
|
+
if (btn) {
|
|
9202
|
+
btn.loading = false;
|
|
9203
|
+
}
|
|
9204
|
+
_this.loading = false;
|
|
9205
|
+
}
|
|
9206
|
+
else {
|
|
9207
|
+
var m = '';
|
|
9208
|
+
if (res.status === exports.ResultStatusEnum.NotRegistered) {
|
|
9209
|
+
m = 'FormBaseErrorNotRegistered';
|
|
9210
|
+
}
|
|
9211
|
+
else if (res.status === exports.ResultStatusEnum.ExpiredRegistered) {
|
|
9212
|
+
m = 'FormBaseErrorExpiredRegistered';
|
|
9213
|
+
}
|
|
9214
|
+
else if (res.status === exports.ResultStatusEnum.InvalidIp) {
|
|
9215
|
+
m = 'FormBaseErrorInvalidIp';
|
|
9216
|
+
}
|
|
9217
|
+
else if (res.status === exports.ResultStatusEnum.NoCredit) {
|
|
9218
|
+
m = 'FormBaseErrorNoCredit';
|
|
9219
|
+
}
|
|
9220
|
+
else if (res.status === exports.ResultStatusEnum.Unauthorized) {
|
|
9221
|
+
m = 'FormBaseErrorExpired';
|
|
9222
|
+
}
|
|
9223
|
+
else if (res.status === exports.ResultStatusEnum.NotAccess) {
|
|
9224
|
+
m = 'FormBaseErrorAccess';
|
|
9225
|
+
}
|
|
9226
|
+
else if (res.status === exports.ResultStatusEnum.NotPermission) {
|
|
9227
|
+
m = 'FormBaseErrorPermission';
|
|
9228
|
+
}
|
|
9229
|
+
else {
|
|
9230
|
+
if (typeof res.message === 'string') {
|
|
9231
|
+
var am = res.message.split(':');
|
|
9232
|
+
m = _this.l(am[0], am.length > 1 ? am.slice(1) : null);
|
|
9233
|
+
}
|
|
9234
|
+
else {
|
|
9235
|
+
// tslint:disable-next-line:forin
|
|
9236
|
+
for (var msg in res.message) {
|
|
9237
|
+
// noinspection JSUnfilteredForInLoop
|
|
9238
|
+
m = _this.l(msg, res.message[msg]);
|
|
9239
|
+
}
|
|
9240
|
+
}
|
|
9241
|
+
}
|
|
9242
|
+
if (m) {
|
|
9243
|
+
HelperClass.addNotification(_this.l(m));
|
|
9244
|
+
}
|
|
9245
|
+
_this.rows = [];
|
|
9246
|
+
_this.count = 0;
|
|
9247
|
+
_this.page = 1;
|
|
9248
|
+
if (btn) {
|
|
9249
|
+
btn.loading = false;
|
|
9250
|
+
}
|
|
9251
|
+
_this.loading = false;
|
|
9252
|
+
}
|
|
9253
|
+
}, function () {
|
|
9254
|
+
_this.rows = [];
|
|
9255
|
+
_this.count = 0;
|
|
9256
|
+
_this.page = 1;
|
|
9257
|
+
if (btn) {
|
|
9258
|
+
btn.loading = false;
|
|
9259
|
+
}
|
|
9260
|
+
_this.loading = false;
|
|
9261
|
+
});
|
|
9262
|
+
};
|
|
9296
9263
|
TableClass.prototype.getOptionUrl = function (url, relatedId, rowId) {
|
|
9297
9264
|
return (relatedId ? url.replace('{}', relatedId) : (url.match(/{}/g) || []).length > 1 ? url.replace('/{}', '') : url).replace('{}', rowId);
|
|
9298
9265
|
};
|
|
@@ -9599,13 +9566,6 @@
|
|
|
9599
9566
|
this.sort = type === exports.TableCollType.Image ? false : sort;
|
|
9600
9567
|
}
|
|
9601
9568
|
return TableCollClass;
|
|
9602
|
-
}());
|
|
9603
|
-
var TableRowClass = /** @class */ (function () {
|
|
9604
|
-
function TableRowClass(data, children) {
|
|
9605
|
-
this.data = data;
|
|
9606
|
-
this.children = children;
|
|
9607
|
-
}
|
|
9608
|
-
return TableRowClass;
|
|
9609
9569
|
}());
|
|
9610
9570
|
|
|
9611
9571
|
// @ts-ignore
|
|
@@ -9951,7 +9911,6 @@
|
|
|
9951
9911
|
exports.TableClass = TableClass;
|
|
9952
9912
|
exports.TableCollClass = TableCollClass;
|
|
9953
9913
|
exports.TableComponent = TableComponent;
|
|
9954
|
-
exports.TableRowClass = TableRowClass;
|
|
9955
9914
|
exports.TooltipComponent = TooltipComponent;
|
|
9956
9915
|
exports.TreeRowClass = TreeRowClass;
|
|
9957
9916
|
exports.ɵa = FormSelectItemComponent;
|