@donglegeyu/company-ui 2.7.0 → 2.9.0
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/dist/cjs/template-components/AdminLayoutTemplate/index.js +14 -17
- package/dist/cjs/template-components/CompanySidebar/CustomNavPanel.js +5 -3
- package/dist/cjs/template-components/CompanySidebar/FirstSidebar.d.ts +4 -3
- package/dist/cjs/template-components/CompanySidebar/FirstSidebar.js +21 -11
- package/dist/cjs/template-components/CompanySidebar/MoreMenuDrawer.js +3 -3
- package/dist/cjs/template-components/CompanySidebar/SecondSidebar.js +2 -2
- package/dist/cjs/template-components/CompanySidebar/index.d.ts +3 -2
- package/dist/cjs/template-components/CompanySidebar/index.js +59 -16
- package/dist/cjs/template-components/CompanySidebar/index.scss +42 -0
- package/dist/cjs/template-components/CompanySidebar/menuIconMap.js +5 -4
- package/dist/cjs/template-components/IconSelect/index.js +13 -2
- package/dist/es/template-components/AdminLayoutTemplate/index.js +4 -10
- package/dist/es/template-components/CompanySidebar/CustomNavPanel.js +6 -4
- package/dist/es/template-components/CompanySidebar/FirstSidebar.d.ts +4 -3
- package/dist/es/template-components/CompanySidebar/FirstSidebar.js +22 -11
- package/dist/es/template-components/CompanySidebar/MoreMenuDrawer.js +8 -3
- package/dist/es/template-components/CompanySidebar/SecondSidebar.js +2 -2
- package/dist/es/template-components/CompanySidebar/index.d.ts +3 -2
- package/dist/es/template-components/CompanySidebar/index.js +94 -20
- package/dist/es/template-components/CompanySidebar/index.scss +42 -0
- package/dist/es/template-components/CompanySidebar/menuIconMap.js +10 -3
- package/dist/es/template-components/IconSelect/index.js +45 -30
- package/package.json +1 -1
|
@@ -66,6 +66,9 @@ var iconMap = {
|
|
|
66
66
|
setting: "setting"
|
|
67
67
|
};
|
|
68
68
|
function getIconName(icon) {
|
|
69
|
+
// 精选集原生键原样渲染(iconMap 旧名翻译不得误伤同名键,如 search/tool/clipboard/user),
|
|
70
|
+
// 仅对不在精选集的值(antd 旧名、自定义 sprite id)做翻译/透传
|
|
71
|
+
if (iconNames.includes(icon)) return icon;
|
|
69
72
|
return iconMap[icon] || icon;
|
|
70
73
|
}
|
|
71
74
|
export default function IconSelect(props) {
|
|
@@ -195,12 +198,12 @@ function IconSelectInner(_ref) {
|
|
|
195
198
|
return _saveIconConfig.apply(this, arguments);
|
|
196
199
|
}
|
|
197
200
|
function _saveIconConfig() {
|
|
198
|
-
_saveIconConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
199
|
-
return _regeneratorRuntime().wrap(function
|
|
200
|
-
while (1) switch (
|
|
201
|
+
_saveIconConfig = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(data) {
|
|
202
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
203
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
201
204
|
case 0:
|
|
202
|
-
|
|
203
|
-
|
|
205
|
+
_context3.prev = 0;
|
|
206
|
+
_context3.next = 3;
|
|
204
207
|
return fetch(iconEndpoint, {
|
|
205
208
|
method: "PUT",
|
|
206
209
|
headers: {
|
|
@@ -209,17 +212,17 @@ function IconSelectInner(_ref) {
|
|
|
209
212
|
body: JSON.stringify(data)
|
|
210
213
|
});
|
|
211
214
|
case 3:
|
|
212
|
-
|
|
215
|
+
_context3.next = 8;
|
|
213
216
|
break;
|
|
214
217
|
case 5:
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
console.error("[IconSelect] saveIconConfig failed:",
|
|
218
|
+
_context3.prev = 5;
|
|
219
|
+
_context3.t0 = _context3["catch"](0);
|
|
220
|
+
console.error("[IconSelect] saveIconConfig failed:", _context3.t0);
|
|
218
221
|
case 8:
|
|
219
222
|
case "end":
|
|
220
|
-
return
|
|
223
|
+
return _context3.stop();
|
|
221
224
|
}
|
|
222
|
-
},
|
|
225
|
+
}, _callee3, null, [[0, 5]]);
|
|
223
226
|
}));
|
|
224
227
|
return _saveIconConfig.apply(this, arguments);
|
|
225
228
|
}
|
|
@@ -237,22 +240,19 @@ function IconSelectInner(_ref) {
|
|
|
237
240
|
setSearchText("");
|
|
238
241
|
onChange === null || onChange === void 0 || onChange(val);
|
|
239
242
|
}, [onChange]);
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
_loadSvgScript = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(url) {
|
|
245
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
246
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
243
|
+
var loadSvgScript = useCallback( /*#__PURE__*/function () {
|
|
244
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(url) {
|
|
245
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
246
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
247
247
|
case 0:
|
|
248
248
|
if (!loadedScriptsRef.current.has(url)) {
|
|
249
|
-
|
|
249
|
+
_context2.next = 2;
|
|
250
250
|
break;
|
|
251
251
|
}
|
|
252
|
-
return
|
|
252
|
+
return _context2.abrupt("return", true);
|
|
253
253
|
case 2:
|
|
254
|
-
|
|
255
|
-
|
|
254
|
+
_context2.prev = 2;
|
|
255
|
+
_context2.next = 5;
|
|
256
256
|
return new Promise(function (resolve, reject) {
|
|
257
257
|
var existing = document.querySelector("script[src=\"".concat(url, "\"]"));
|
|
258
258
|
if (existing) {
|
|
@@ -271,19 +271,34 @@ function IconSelectInner(_ref) {
|
|
|
271
271
|
});
|
|
272
272
|
case 5:
|
|
273
273
|
loadedScriptsRef.current.add(url);
|
|
274
|
-
return
|
|
274
|
+
return _context2.abrupt("return", true);
|
|
275
275
|
case 9:
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
return
|
|
276
|
+
_context2.prev = 9;
|
|
277
|
+
_context2.t0 = _context2["catch"](2);
|
|
278
|
+
return _context2.abrupt("return", false);
|
|
279
279
|
case 12:
|
|
280
280
|
case "end":
|
|
281
|
-
return
|
|
281
|
+
return _context2.stop();
|
|
282
282
|
}
|
|
283
|
-
},
|
|
283
|
+
}, _callee2, null, [[2, 9]]);
|
|
284
284
|
}));
|
|
285
|
-
return
|
|
286
|
-
|
|
285
|
+
return function (_x2) {
|
|
286
|
+
return _ref3.apply(this, arguments);
|
|
287
|
+
};
|
|
288
|
+
}(), []);
|
|
289
|
+
|
|
290
|
+
// SVG Symbol URL 输入后自动加载 sprite(防抖):首次添加时抽屉预览即可真实渲染。
|
|
291
|
+
// 否则 sprite 只在点「确定」后才注入,预览恒为空,「预览为空=图标标识不存在」提示反而误导
|
|
292
|
+
useEffect(function () {
|
|
293
|
+
var url = newIconSvgUrl.trim();
|
|
294
|
+
if (!url) return;
|
|
295
|
+
var timer = setTimeout(function () {
|
|
296
|
+
void loadSvgScript(url);
|
|
297
|
+
}, 500);
|
|
298
|
+
return function () {
|
|
299
|
+
return clearTimeout(timer);
|
|
300
|
+
};
|
|
301
|
+
}, [newIconSvgUrl, loadSvgScript]);
|
|
287
302
|
function handleAddIcon() {
|
|
288
303
|
return _handleAddIcon.apply(this, arguments);
|
|
289
304
|
}
|