@pisell/common 0.0.31 → 0.0.33

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 MyIcon = createFromIconfontCN({
21
- 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 上生成
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
  }));
@@ -269,7 +269,7 @@ function _updateVersion() {
269
269
  pre: 'https://pre.pisellapi.com',
270
270
  prod: 'https://pisellapi.com'
271
271
  };
272
- fetch(host[env] + '/core/management-version', {
272
+ fetch(host[env] + '/shop/management-version', {
273
273
  method: 'POST',
274
274
  headers: {
275
275
  'Content-Type': 'application/json'
@@ -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 _a, _b;
39
- var MyIcon = (0, import_icons.createFromIconfontCN)({
40
- 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()
41
- // iconfont.cn 上生成
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;
@@ -212,7 +212,7 @@ async function updateVersion(params, env) {
212
212
  pre: "https://pre.pisellapi.com",
213
213
  prod: "https://pisellapi.com"
214
214
  };
215
- fetch(host[env] + "/core/management-version", {
215
+ fetch(host[env] + "/shop/management-version", {
216
216
  method: "POST",
217
217
  headers: {
218
218
  "Content-Type": "application/json"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/common",
3
- "version": "0.0.31",
3
+ "version": "0.0.33",
4
4
  "description": "A collection of reusable UI components for web development",
5
5
  "license": "MIT",
6
6
  "sideEffects": [