ns-base-module 1.1.67 → 1.1.69
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.
|
@@ -32,7 +32,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
32
32
|
// import { initLang } from "@/utils/language";
|
|
33
33
|
import { CopyOutlined, DeleteOutlined, PlusOutlined, SettingOutlined, ShareAltOutlined, UserOutlined } from "@ant-design/icons";
|
|
34
34
|
import { Button, Checkbox, Input, message, Popconfirm, Popover, Radio, Tooltip, Tree } from "antd";
|
|
35
|
-
import { cloneDeep, isArray, isEmpty } from "lodash";
|
|
35
|
+
import { cloneDeep, get, isArray, isEmpty } from "lodash";
|
|
36
36
|
import React, { memo, useEffect, useMemo, useState } from "react";
|
|
37
37
|
import { DndProvider } from "react-dnd";
|
|
38
38
|
import { HTML5Backend } from "react-dnd-html5-backend";
|
|
@@ -707,6 +707,18 @@ var ColumnsToolbar = function ColumnsToolbar(_ref4) {
|
|
|
707
707
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
708
708
|
curItem = _useState20[0],
|
|
709
709
|
setCurItem = _useState20[1];
|
|
710
|
+
var mode = useMemo(function () {
|
|
711
|
+
try {
|
|
712
|
+
var userInfoStr = window.localStorage.getItem("userInfo");
|
|
713
|
+
if (userInfoStr) {
|
|
714
|
+
var userInfo = JSON.parse(userInfoStr);
|
|
715
|
+
return get(userInfo, "userPreferenceConfig.mode", "");
|
|
716
|
+
}
|
|
717
|
+
return "";
|
|
718
|
+
} catch (error) {
|
|
719
|
+
return "";
|
|
720
|
+
}
|
|
721
|
+
}, []);
|
|
710
722
|
var saveTempale = /*#__PURE__*/function () {
|
|
711
723
|
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(params) {
|
|
712
724
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
@@ -738,7 +750,7 @@ var ColumnsToolbar = function ColumnsToolbar(_ref4) {
|
|
|
738
750
|
var getColumnsFilter = /*#__PURE__*/function () {
|
|
739
751
|
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
740
752
|
var _res;
|
|
741
|
-
var res, _res2, _templateUser, _template;
|
|
753
|
+
var res, _res2, _templateUser, _template, hasDefault;
|
|
742
754
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
743
755
|
while (1) switch (_context4.prev = _context4.next) {
|
|
744
756
|
case 0:
|
|
@@ -771,6 +783,7 @@ var ColumnsToolbar = function ColumnsToolbar(_ref4) {
|
|
|
771
783
|
if ((_res = res) !== null && _res !== void 0 && (_res = _res.data) !== null && _res !== void 0 && _res.data) {
|
|
772
784
|
_templateUser = [];
|
|
773
785
|
_template = [];
|
|
786
|
+
hasDefault = false;
|
|
774
787
|
(_res2 = res) === null || _res2 === void 0 || (_res2 = _res2.data) === null || _res2 === void 0 || _res2.data.forEach(function (item) {
|
|
775
788
|
if (item.perms_type === "private") {
|
|
776
789
|
_templateUser.push(item);
|
|
@@ -778,6 +791,11 @@ var ColumnsToolbar = function ColumnsToolbar(_ref4) {
|
|
|
778
791
|
_template.push(item);
|
|
779
792
|
}
|
|
780
793
|
if (item.is_default === "Y") {
|
|
794
|
+
hasDefault = true;
|
|
795
|
+
setValue(item.value);
|
|
796
|
+
setCurItem(item);
|
|
797
|
+
}
|
|
798
|
+
if (item.is_default_public === "Y" && !hasDefault) {
|
|
781
799
|
setValue(item.value);
|
|
782
800
|
setCurItem(item);
|
|
783
801
|
}
|
|
@@ -961,7 +979,10 @@ var ColumnsToolbar = function ColumnsToolbar(_ref4) {
|
|
|
961
979
|
id: "message.success.set"
|
|
962
980
|
}));
|
|
963
981
|
// 刷新列表
|
|
964
|
-
|
|
982
|
+
setCurItem(_objectSpread(_objectSpread({}, item), {}, {
|
|
983
|
+
is_default: code !== "public" ? isDefault : "N",
|
|
984
|
+
is_default_public: code === "public" ? isDefault : "N"
|
|
985
|
+
}));
|
|
965
986
|
getColumnsFilter();
|
|
966
987
|
}
|
|
967
988
|
});
|
|
@@ -1099,7 +1120,7 @@ var ColumnsToolbar = function ColumnsToolbar(_ref4) {
|
|
|
1099
1120
|
}, /*#__PURE__*/React.createElement(Radio, {
|
|
1100
1121
|
value: item.value,
|
|
1101
1122
|
className: "list-radio-label"
|
|
1102
|
-
}, item.label), item.
|
|
1123
|
+
}, item.label), item.is_default_public === "Y" && /*#__PURE__*/React.createElement("span", {
|
|
1103
1124
|
className: "set-text-default"
|
|
1104
1125
|
}, initLang({
|
|
1105
1126
|
id: "prompt.text.default"
|
|
@@ -1168,7 +1189,7 @@ var ColumnsToolbar = function ColumnsToolbar(_ref4) {
|
|
|
1168
1189
|
type: "primary"
|
|
1169
1190
|
}, initLang({
|
|
1170
1191
|
id: "button.set.default"
|
|
1171
|
-
}))), (curItem === null || curItem === void 0 ? void 0 : curItem.perms_type) == "public" && /*#__PURE__*/React.createElement(React.Fragment, null, (curItem === null || curItem === void 0 ? void 0 : curItem.is_default_public) === "Y" ? /*#__PURE__*/React.createElement(Button, {
|
|
1192
|
+
}))), (curItem === null || curItem === void 0 ? void 0 : curItem.perms_type) == "public" && mode === "DEV" && /*#__PURE__*/React.createElement(React.Fragment, null, (curItem === null || curItem === void 0 ? void 0 : curItem.is_default_public) === "Y" ? /*#__PURE__*/React.createElement(Button, {
|
|
1172
1193
|
onClick: function onClick() {
|
|
1173
1194
|
return handleSaveDefault("N", "public");
|
|
1174
1195
|
},
|
|
@@ -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,96 +137,104 @@ 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
|
+
updateTemplateFilds(JsonPares, _columns);
|
|
229
|
+
return {
|
|
230
|
+
JsonPares: JsonPares,
|
|
231
|
+
item: item
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
} catch (error) {
|
|
227
235
|
return {
|
|
228
|
-
JsonPares:
|
|
229
|
-
item:
|
|
236
|
+
JsonPares: null,
|
|
237
|
+
item: null
|
|
230
238
|
};
|
|
231
239
|
}
|
|
232
240
|
}
|