@pisell/common 0.0.31 → 0.0.32
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.
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
var _getConfig, _getConfig$ENV;
|
|
3
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -14,14 +13,26 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
14
13
|
* @LastEditTime: 2022-07-15 09:09
|
|
15
14
|
*/
|
|
16
15
|
import { createFromIconfontCN } from '@ant-design/icons';
|
|
17
|
-
import React from 'react';
|
|
16
|
+
import React, { useMemo } from 'react';
|
|
18
17
|
import { getConfig } from "../../config";
|
|
19
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
var createIconfontInstance = function () {
|
|
20
|
+
var MyIcon = null;
|
|
21
|
+
return function () {
|
|
22
|
+
if (!MyIcon) {
|
|
23
|
+
var _getConfig, _getConfig$ENV;
|
|
24
|
+
MyIcon = createFromIconfontCN({
|
|
25
|
+
scriptUrl: ((_getConfig = getConfig()) === null || _getConfig === void 0 ? void 0 : (_getConfig$ENV = _getConfig.ENV) === null || _getConfig$ENV === void 0 ? void 0 : _getConfig$ENV.static) + '/static/fonts/iconfont/iconfont.js?q=' + new Date().getTime() // 在 iconfont.cn 上生成
|
|
26
|
+
});
|
|
27
|
+
}
|
|
23
28
|
|
|
29
|
+
return MyIcon;
|
|
30
|
+
};
|
|
31
|
+
}();
|
|
24
32
|
var IconFont = function IconFont(props) {
|
|
33
|
+
var MyIcon = useMemo(function () {
|
|
34
|
+
return createIconfontInstance();
|
|
35
|
+
}, []);
|
|
25
36
|
return /*#__PURE__*/_jsx(MyIcon, _objectSpread(_objectSpread({}, props), {}, {
|
|
26
37
|
className: props.className
|
|
27
38
|
}));
|
|
@@ -35,12 +35,23 @@ module.exports = __toCommonJS(Iconfont_exports);
|
|
|
35
35
|
var import_icons = require("@ant-design/icons");
|
|
36
36
|
var import_react = __toESM(require("react"));
|
|
37
37
|
var import_config = require("../../config");
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
var createIconfontInstance = (() => {
|
|
39
|
+
let MyIcon = null;
|
|
40
|
+
return () => {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
if (!MyIcon) {
|
|
43
|
+
MyIcon = (0, import_icons.createFromIconfontCN)({
|
|
44
|
+
scriptUrl: ((_b = (_a = (0, import_config.getConfig)()) == null ? void 0 : _a.ENV) == null ? void 0 : _b.static) + "/static/fonts/iconfont/iconfont.js?q=" + new Date().getTime()
|
|
45
|
+
// 在 iconfont.cn 上生成
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return MyIcon;
|
|
49
|
+
};
|
|
50
|
+
})();
|
|
43
51
|
var IconFont = (props) => {
|
|
52
|
+
const MyIcon = (0, import_react.useMemo)(() => {
|
|
53
|
+
return createIconfontInstance();
|
|
54
|
+
}, []);
|
|
44
55
|
return /* @__PURE__ */ import_react.default.createElement(MyIcon, { ...props, className: props.className });
|
|
45
56
|
};
|
|
46
57
|
var Iconfont_default = IconFont;
|