ns-base-module 1.1.67 → 1.1.68
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.
|
@@ -738,7 +738,7 @@ var ColumnsToolbar = function ColumnsToolbar(_ref4) {
|
|
|
738
738
|
var getColumnsFilter = /*#__PURE__*/function () {
|
|
739
739
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
740
740
|
var _res;
|
|
741
|
-
var res, _res2, _templateUser, _template;
|
|
741
|
+
var res, _res2, _templateUser, _template, hasDefault;
|
|
742
742
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
743
743
|
while (1) switch (_context4.prev = _context4.next) {
|
|
744
744
|
case 0:
|
|
@@ -771,6 +771,7 @@ var ColumnsToolbar = function ColumnsToolbar(_ref4) {
|
|
|
771
771
|
if ((_res = res) !== null && _res !== void 0 && (_res = _res.data) !== null && _res !== void 0 && _res.data) {
|
|
772
772
|
_templateUser = [];
|
|
773
773
|
_template = [];
|
|
774
|
+
hasDefault = false;
|
|
774
775
|
(_res2 = res) === null || _res2 === void 0 || (_res2 = _res2.data) === null || _res2 === void 0 || _res2.data.forEach(function (item) {
|
|
775
776
|
if (item.perms_type === "private") {
|
|
776
777
|
_templateUser.push(item);
|
|
@@ -778,6 +779,11 @@ var ColumnsToolbar = function ColumnsToolbar(_ref4) {
|
|
|
778
779
|
_template.push(item);
|
|
779
780
|
}
|
|
780
781
|
if (item.is_default === "Y") {
|
|
782
|
+
hasDefault = true;
|
|
783
|
+
setValue(item.value);
|
|
784
|
+
setCurItem(item);
|
|
785
|
+
}
|
|
786
|
+
if (item.is_default_public === "Y" && !hasDefault) {
|
|
781
787
|
setValue(item.value);
|
|
782
788
|
setCurItem(item);
|
|
783
789
|
}
|
|
@@ -961,7 +967,10 @@ var ColumnsToolbar = function ColumnsToolbar(_ref4) {
|
|
|
961
967
|
id: "message.success.set"
|
|
962
968
|
}));
|
|
963
969
|
// 刷新列表
|
|
964
|
-
|
|
970
|
+
setCurItem(_objectSpread(_objectSpread({}, item), {}, {
|
|
971
|
+
is_default: code !== "public" ? isDefault : "N",
|
|
972
|
+
is_default_public: code === "public" ? isDefault : "N"
|
|
973
|
+
}));
|
|
965
974
|
getColumnsFilter();
|
|
966
975
|
}
|
|
967
976
|
});
|
|
@@ -1099,7 +1108,7 @@ var ColumnsToolbar = function ColumnsToolbar(_ref4) {
|
|
|
1099
1108
|
}, /*#__PURE__*/React.createElement(Radio, {
|
|
1100
1109
|
value: item.value,
|
|
1101
1110
|
className: "list-radio-label"
|
|
1102
|
-
}, item.label), item.
|
|
1111
|
+
}, item.label), item.is_default_public === "Y" && /*#__PURE__*/React.createElement("span", {
|
|
1103
1112
|
className: "set-text-default"
|
|
1104
1113
|
}, initLang({
|
|
1105
1114
|
id: "prompt.text.default"
|
|
@@ -46,7 +46,8 @@ export var initColumns = function initColumns(arr, parent) {
|
|
|
46
46
|
var flatColumns = function flatColumns(_columns) {
|
|
47
47
|
var initArr = [];
|
|
48
48
|
var flatArr = function flatArr(arr) {
|
|
49
|
-
|
|
49
|
+
var _arr$forEach;
|
|
50
|
+
arr === null || arr === void 0 || (_arr$forEach = arr.forEach) === null || _arr$forEach === void 0 || _arr$forEach.call(arr, function (item) {
|
|
50
51
|
initArr.push(item);
|
|
51
52
|
if (Array.isArray(item.children) && item.children.length) {
|
|
52
53
|
// 子级是动态列 父级也必须是
|
|
@@ -105,7 +106,6 @@ var updateTemplateFilds = function updateTemplateFilds(JsonPares, _columns) {
|
|
|
105
106
|
* */
|
|
106
107
|
export function adapterColumns(customColumns, columns) {
|
|
107
108
|
if (customColumns && customColumns.length && columns && columns.length) {
|
|
108
|
-
var _item2;
|
|
109
109
|
// 展平 columns, 1,子是动态列 父级必须是,父级的表头宽度取决于子级设置.2,子级是浮动 父级同步 解决首行选择框的浮动
|
|
110
110
|
var _columns = flatColumns(columns);
|
|
111
111
|
var itemLoop = function itemLoop(arr, commad) {
|
|
@@ -137,98 +137,101 @@ export function adapterColumns(customColumns, columns) {
|
|
|
137
137
|
break;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
|
|
141
|
-
var
|
|
140
|
+
try {
|
|
141
|
+
var _item2;
|
|
142
|
+
if ((_item2 = item) !== null && _item2 !== void 0 && _item2.is_default) {
|
|
143
|
+
var JsonPares = JSON.parse(item.define);
|
|
142
144
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
+
// 删 旧模板多出的字段
|
|
146
|
+
itemLoop(JsonPares, "del");
|
|
145
147
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
148
|
+
// 展平 columns
|
|
149
|
+
var flaJsonPares = flatColumns(JsonPares);
|
|
150
|
+
// 增 新字段加最后
|
|
151
|
+
var _loop3 = function _loop3(j) {
|
|
152
|
+
var _code = _columns[j].code ? "code" : "dataIndex";
|
|
153
|
+
if (!find(flaJsonPares, function (o) {
|
|
154
|
+
return o[_code] === _columns[j][_code];
|
|
155
|
+
})) {
|
|
156
|
+
var _item = initColumns([_columns[j]], null)[0];
|
|
157
|
+
if (_item.customizable !== false) {
|
|
158
|
+
// 不是动态列
|
|
159
|
+
if (_item.fixed === "left") {
|
|
160
|
+
JsonPares.unshift(_item);
|
|
161
|
+
} else {
|
|
162
|
+
JsonPares.push(_item);
|
|
163
|
+
}
|
|
161
164
|
}
|
|
162
165
|
}
|
|
163
|
-
}
|
|
164
166
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
167
|
+
// 动态列 columns[j].customizable === false 不能用模板,用列表数据
|
|
168
|
+
if (_columns[j].customizable === false && _code) {
|
|
169
|
+
var loopSetChildren = function loopSetChildren(arr1, arr2) {
|
|
170
|
+
arr1.forEach(function (d) {
|
|
171
|
+
var h = find(arr2, function (o) {
|
|
172
|
+
return o[_code] === d[_code];
|
|
173
|
+
});
|
|
174
|
+
if (h) {
|
|
175
|
+
d.width = h.width;
|
|
176
|
+
d.fixed = h.fixed;
|
|
177
|
+
d.checked = h.checked;
|
|
178
|
+
}
|
|
179
|
+
if (d.children && d.children.length && h !== null && h !== void 0 && h.children && h !== null && h !== void 0 && h.children.length) {
|
|
180
|
+
loopSetChildren(d.children, h.children);
|
|
181
|
+
}
|
|
171
182
|
});
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
checked: _JsonPares[i].checked
|
|
189
|
-
};
|
|
190
|
-
_columns[j] = _objectSpread(_objectSpread({}, _columns[j]), obj);
|
|
191
|
-
if (_columns[j].children && _columns[j].children.length && _JsonPares[i].children && _JsonPares[i].children.length) {
|
|
192
|
-
loopSetChildren(_columns[j].children, _JsonPares[i].children);
|
|
183
|
+
};
|
|
184
|
+
var loopSetZable = function loopSetZable(_JsonPares) {
|
|
185
|
+
for (var i = 0, l = _JsonPares.length; i < l; i++) {
|
|
186
|
+
if (_columns[j][_code] === _JsonPares[i][_code]) {
|
|
187
|
+
var obj = {
|
|
188
|
+
width: _JsonPares[i].width,
|
|
189
|
+
fixed: _JsonPares[i].fixed,
|
|
190
|
+
checked: _JsonPares[i].checked
|
|
191
|
+
};
|
|
192
|
+
_columns[j] = _objectSpread(_objectSpread({}, _columns[j]), obj);
|
|
193
|
+
if (_columns[j].children && _columns[j].children.length && _JsonPares[i].children && _JsonPares[i].children.length) {
|
|
194
|
+
loopSetChildren(_columns[j].children, _JsonPares[i].children);
|
|
195
|
+
}
|
|
196
|
+
var d = initColumns([_columns[j]], null)[0];
|
|
197
|
+
_JsonPares[i] = _objectSpread({}, d);
|
|
198
|
+
return;
|
|
193
199
|
}
|
|
194
|
-
|
|
195
|
-
_JsonPares[i]
|
|
196
|
-
|
|
200
|
+
// else {
|
|
201
|
+
// if (_JsonPares[i].children && _JsonPares[i].children.length) {
|
|
202
|
+
// loopSetZable(_JsonPares[i].children);
|
|
203
|
+
// }
|
|
204
|
+
// }
|
|
197
205
|
}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
};
|
|
205
|
-
loopSetZable(JsonPares);
|
|
206
|
+
};
|
|
207
|
+
loopSetZable(JsonPares);
|
|
208
|
+
}
|
|
209
|
+
};
|
|
210
|
+
for (var j = 0, k = _columns.length; j < k; j++) {
|
|
211
|
+
_loop3(j);
|
|
206
212
|
}
|
|
207
|
-
};
|
|
208
|
-
for (var j = 0, k = _columns.length; j < k; j++) {
|
|
209
|
-
_loop3(j);
|
|
210
|
-
}
|
|
211
213
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
214
|
+
// 子级是否全部 浮动
|
|
215
|
+
JsonPares.forEach(function (dd) {
|
|
216
|
+
if (dd.fixed && dd.children && dd.children.length) {
|
|
217
|
+
var isAllChildrenFixed = true;
|
|
218
|
+
dd.children.forEach(function (hh) {
|
|
219
|
+
if (hh.checked && hh.fixed !== dd.fixed) {
|
|
220
|
+
isAllChildrenFixed = false;
|
|
221
|
+
}
|
|
222
|
+
});
|
|
223
|
+
dd.isAllChildrenFixed = isAllChildrenFixed;
|
|
224
|
+
}
|
|
225
|
+
});
|
|
224
226
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
227
|
+
// 替成新配置
|
|
228
|
+
updateTemplateFilds(JsonPares, _columns);
|
|
229
|
+
return {
|
|
230
|
+
JsonPares: JsonPares,
|
|
231
|
+
item: item
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
} catch (error) {}
|
|
232
235
|
}
|
|
233
236
|
return {
|
|
234
237
|
JsonPares: null,
|