iglooform 2.4.24 → 2.4.25

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.
@@ -7,6 +7,8 @@ import _Menu from "antd/es/menu";
7
7
  import "antd/es/dropdown/style";
8
8
  import _Dropdown from "antd/es/dropdown";
9
9
 
10
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
11
+
10
12
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
11
13
 
12
14
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -20,7 +22,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
20
22
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
23
 
22
24
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
23
- import { useState } from 'react';
25
+ import { useState, useMemo } from 'react';
24
26
  import defaultIcon from '../square/default.svg';
25
27
  import { ArrowDownOutlined } from 'iglooicon';
26
28
  import './style/index.less';
@@ -40,6 +42,33 @@ var SwitchPlatform = function SwitchPlatform(_ref) {
40
42
  onChange(e.key);
41
43
  };
42
44
 
45
+ var currentName = useMemo(function () {
46
+ var name = currentPlatform;
47
+
48
+ var _iterator = _createForOfIteratorHelper(platforms),
49
+ _step;
50
+
51
+ try {
52
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
53
+ var platform = _step.value;
54
+
55
+ if (typeof platform === 'string') {
56
+ break;
57
+ }
58
+
59
+ if (platform.key === currentPlatform) {
60
+ name = platform.name;
61
+ break;
62
+ }
63
+ }
64
+ } catch (err) {
65
+ _iterator.e(err);
66
+ } finally {
67
+ _iterator.f();
68
+ }
69
+
70
+ return name;
71
+ }, [platforms, currentPlatform]);
43
72
  return _jsx(_Dropdown, {
44
73
  className: "igloo-switch-platform",
45
74
  trigger: ['click'],
@@ -86,7 +115,7 @@ var SwitchPlatform = function SwitchPlatform(_ref) {
86
115
  className: "igloo-switch-platform-default-logo"
87
116
  }, void 0), _jsx("span", {
88
117
  className: "igloo-switch-platform-name",
89
- children: currentPlatform
118
+ children: currentName
90
119
  }, void 0)]
91
120
  }, void 0)
92
121
  }, void 0), _jsx(ArrowDownOutlined, {
@@ -33,6 +33,8 @@ require("./style/index.less");
33
33
 
34
34
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
35
35
 
36
+ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
37
+
36
38
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
37
39
 
38
40
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
@@ -60,6 +62,33 @@ var SwitchPlatform = function SwitchPlatform(_ref) {
60
62
  onChange(e.key);
61
63
  };
62
64
 
65
+ var currentName = (0, _react.useMemo)(function () {
66
+ var name = currentPlatform;
67
+
68
+ var _iterator = _createForOfIteratorHelper(platforms),
69
+ _step;
70
+
71
+ try {
72
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
73
+ var platform = _step.value;
74
+
75
+ if (typeof platform === 'string') {
76
+ break;
77
+ }
78
+
79
+ if (platform.key === currentPlatform) {
80
+ name = platform.name;
81
+ break;
82
+ }
83
+ }
84
+ } catch (err) {
85
+ _iterator.e(err);
86
+ } finally {
87
+ _iterator.f();
88
+ }
89
+
90
+ return name;
91
+ }, [platforms, currentPlatform]);
63
92
  return (0, _jsxRuntime.jsx)(_dropdown.default, {
64
93
  className: "igloo-switch-platform",
65
94
  trigger: ['click'],
@@ -106,7 +135,7 @@ var SwitchPlatform = function SwitchPlatform(_ref) {
106
135
  className: "igloo-switch-platform-default-logo"
107
136
  }, void 0), (0, _jsxRuntime.jsx)("span", {
108
137
  className: "igloo-switch-platform-name",
109
- children: currentPlatform
138
+ children: currentName
110
139
  }, void 0)]
111
140
  }, void 0)
112
141
  }, void 0), (0, _jsxRuntime.jsx)(_iglooicon.ArrowDownOutlined, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iglooform",
3
- "version": "2.4.24",
3
+ "version": "2.4.25",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "build-dev": "dumi build",