meixioacomponent 1.1.42 → 1.1.43

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.
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ exports.__esModule = true;
3
+ var ProTableLocalConfigManage = /** @class */ (function () {
4
+ function ProTableLocalConfigManage() {
5
+ var _this = this;
6
+ this.setProTableLocalConfigByTableKey = function (tableKey, value) {
7
+ _this.localConfig["".concat(tableKey)] = value;
8
+ console.log(_this.localConfig);
9
+ _this.setProTableLocalConfigByLocalStorage();
10
+ };
11
+ this.checkRenderTableConfigAccordLocal = function (tableKey, renderTable) {
12
+ var _value = _this.hasConfigByTableKey(tableKey);
13
+ var checkFlag = true;
14
+ if (_value) {
15
+ console.log(renderTable);
16
+ console.log(_value);
17
+ if (_value.length !== renderTable.length) {
18
+ checkFlag = false;
19
+ _this.deleteProTableLocalConfigByTableKey(tableKey);
20
+ return checkFlag;
21
+ }
22
+ var _loop_1 = function (i) {
23
+ var item = renderTable[i];
24
+ var index = _value.findIndex(function (cItem) {
25
+ return item.key === cItem.key;
26
+ });
27
+ if (index < 0) {
28
+ checkFlag = false;
29
+ _this.deleteProTableLocalConfigByTableKey(tableKey);
30
+ return "break";
31
+ }
32
+ };
33
+ for (var i = 0; i < renderTable.length; i++) {
34
+ var state_1 = _loop_1(i);
35
+ if (state_1 === "break")
36
+ break;
37
+ }
38
+ return checkFlag;
39
+ }
40
+ return false;
41
+ };
42
+ this.deleteProTableLocalConfigByTableKey = function (tableKey) {
43
+ console.log('deleteProTableLocalConfigByTableKey');
44
+ var _value = _this.hasConfigByTableKey(tableKey);
45
+ if (_value) {
46
+ delete _this.localConfig["".concat(tableKey)];
47
+ _this.setProTableLocalConfigByLocalStorage();
48
+ }
49
+ };
50
+ this.hasConfigByTableKey = function (tableKey) {
51
+ var value = _this.localConfig["".concat(tableKey)];
52
+ if (value) {
53
+ return value;
54
+ }
55
+ return false;
56
+ };
57
+ this.setProTableLocalConfigByLocalStorage = function () {
58
+ window.localStorage.setItem('proTableLocalConfig', JSON.stringify(_this.localConfig));
59
+ console.log('setProTableLocalConfigByLocalStorage');
60
+ };
61
+ this.localConfig = {};
62
+ }
63
+ ProTableLocalConfigManage.prototype.initByProTableLocalConfigManage = function () {
64
+ var _localConfig = window.localStorage.getItem('proTableLocalConfig');
65
+ if (_localConfig) {
66
+ this.localConfig = JSON.parse(_localConfig);
67
+ }
68
+ else {
69
+ this.setProTableLocalConfigByLocalStorage();
70
+ }
71
+ };
72
+ return ProTableLocalConfigManage;
73
+ }());
74
+ var proTableLocalConfigManage = new ProTableLocalConfigManage();
75
+ exports["default"] = proTableLocalConfigManage;
@@ -0,0 +1,99 @@
1
+ class ProTableLocalConfigManage {
2
+
3
+ public localConfig: Record<string, any>;
4
+
5
+
6
+ constructor() {
7
+
8
+ this.localConfig = {};
9
+ }
10
+
11
+ public initByProTableLocalConfigManage() {
12
+ const _localConfig = window.localStorage.getItem('proTableLocalConfig');
13
+ if (_localConfig) {
14
+ this.localConfig = JSON.parse(_localConfig);
15
+ } else {
16
+ this.setProTableLocalConfigByLocalStorage();
17
+ }
18
+ }
19
+
20
+
21
+ public setProTableLocalConfigByTableKey = (tableKey: string, value: any) => {
22
+
23
+ this.localConfig[`${tableKey}`] = value;
24
+ console.log(this.localConfig);
25
+ this.setProTableLocalConfigByLocalStorage();
26
+
27
+ }
28
+
29
+
30
+ public checkRenderTableConfigAccordLocal = (tableKey: string, renderTable: Array<any>) => {
31
+ const _value = this.hasConfigByTableKey(tableKey);
32
+ let checkFlag = true;
33
+ if (_value) {
34
+ console.log(renderTable);
35
+ console.log(_value);
36
+ if (_value.length !== renderTable.length) {
37
+ checkFlag = false;
38
+ this.deleteProTableLocalConfigByTableKey(tableKey);
39
+ return checkFlag;
40
+ }
41
+
42
+ for (let i = 0; i < renderTable.length; i++) {
43
+
44
+ const item = renderTable[i];
45
+
46
+ const index = _value.findIndex(cItem => {
47
+ return item.key === cItem.key;
48
+ })
49
+ if (index < 0) {
50
+ checkFlag = false;
51
+ this.deleteProTableLocalConfigByTableKey(tableKey);
52
+ break;
53
+ }
54
+ }
55
+
56
+ return checkFlag;
57
+ }
58
+ return false
59
+
60
+
61
+ }
62
+
63
+
64
+ public deleteProTableLocalConfigByTableKey = (tableKey: string) => {
65
+
66
+ console.log('deleteProTableLocalConfigByTableKey');
67
+ const _value = this.hasConfigByTableKey(tableKey);
68
+
69
+ if (_value) {
70
+ delete this.localConfig[`${tableKey}`];
71
+ this.setProTableLocalConfigByLocalStorage();
72
+ }
73
+
74
+ }
75
+
76
+
77
+ public hasConfigByTableKey = (tableKey: string) => {
78
+
79
+ const value = this.localConfig[`${tableKey}`];
80
+
81
+ if (value) {
82
+ return value;
83
+ }
84
+ return false;
85
+
86
+ }
87
+
88
+
89
+ private setProTableLocalConfigByLocalStorage = () => {
90
+ window.localStorage.setItem('proTableLocalConfig', JSON.stringify(this.localConfig));
91
+ console.log('setProTableLocalConfigByLocalStorage')
92
+ }
93
+ }
94
+
95
+
96
+ const proTableLocalConfigManage = new ProTableLocalConfigManage();
97
+
98
+
99
+ export default proTableLocalConfigManage;