@zat-design/sisyphus-react 3.4.5-beta.10 → 3.4.5-beta.11

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,13 +1,13 @@
1
1
  import "antd/es/button/style";
2
2
  import _Button from "antd/es/button";
3
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
3
  import "antd/es/tooltip/style";
5
4
  import _Tooltip from "antd/es/tooltip";
5
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
6
6
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
7
7
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
8
8
  var _excluded = ["type", "onClick", "size", "color", "className", "style", "spin", "rotate", "theme", "disabled", "mode", "buttonProps", "children", "mapList", "src", "actionMap", "tooltip"];
9
9
  import { jsx as _jsx } from "react/jsx-runtime";
10
- import { useExternal } from 'ahooks';
10
+ import { useExternal, useLocalStorageState } from 'ahooks';
11
11
  import classNames from 'classnames';
12
12
  import { uniqBy } from 'lodash';
13
13
  import { ReactSVG } from 'react-svg';
@@ -56,6 +56,10 @@ var ProIcon = function ProIcon(props) {
56
56
  primaryColor = _ref$primaryColor === void 0 ? '#006AFF' : _ref$primaryColor,
57
57
  _ref$qiankunPrimaryCo = _ref.qiankunPrimaryColor,
58
58
  qiankunPrimaryColor = _ref$qiankunPrimaryCo === void 0 ? '#006AFF' : _ref$qiankunPrimaryCo;
59
+ // 本地存储初始化主题
60
+ var _useLocalStorageState = useLocalStorageState('themeConfig'),
61
+ _useLocalStorageState2 = _slicedToArray(_useLocalStorageState, 1),
62
+ themeConfig = _useLocalStorageState2[0];
59
63
  // 文档内部就不用判断window.top !== window.self了
60
64
  var isQiankun =
61
65
  // @ts-ignore
@@ -156,6 +160,7 @@ var ProIcon = function ProIcon(props) {
156
160
  useEffect(function () {
157
161
  // 处于主子应用情况下才会执行下方逻辑,主题色的变更以主框架的为准
158
162
  if (actionMap && isQiankun) {
163
+ var _themeConfig$data;
159
164
  observer = new MutationObserver(function (mutationsList) {
160
165
  var targetEntries = mutationsList[0];
161
166
  if (targetEntries) {
@@ -203,6 +208,19 @@ var ProIcon = function ProIcon(props) {
203
208
  attributes: true,
204
209
  attributeFilter: ['style']
205
210
  });
211
+ // 未变更时及初始化时
212
+ var extendFromMainColor = themeConfig === null || themeConfig === void 0 ? void 0 : (_themeConfig$data = themeConfig.data) === null || _themeConfig$data === void 0 ? void 0 : _themeConfig$data.zauiBrand;
213
+ if (extendFromMainColor && qiankunPrimaryColor !== extendFromMainColor) {
214
+ dispatch({
215
+ type: 'set',
216
+ payload: {
217
+ theme: {
218
+ primaryColor: primaryColor,
219
+ qiankunPrimaryColor: extendFromMainColor
220
+ }
221
+ }
222
+ });
223
+ }
206
224
  }
207
225
  }, []);
208
226
  useEffect(function () {
@@ -60,6 +60,10 @@ var ProIcon = function ProIcon(props) {
60
60
  primaryColor = _ref$primaryColor === void 0 ? '#006AFF' : _ref$primaryColor,
61
61
  _ref$qiankunPrimaryCo = _ref.qiankunPrimaryColor,
62
62
  qiankunPrimaryColor = _ref$qiankunPrimaryCo === void 0 ? '#006AFF' : _ref$qiankunPrimaryCo;
63
+ // 本地存储初始化主题
64
+ var _useLocalStorageState = (0, _ahooks.useLocalStorageState)('themeConfig'),
65
+ _useLocalStorageState2 = (0, _slicedToArray2.default)(_useLocalStorageState, 1),
66
+ themeConfig = _useLocalStorageState2[0];
63
67
  // 文档内部就不用判断window.top !== window.self了
64
68
  var isQiankun =
65
69
  // @ts-ignore
@@ -160,6 +164,7 @@ var ProIcon = function ProIcon(props) {
160
164
  (0, _react.useEffect)(function () {
161
165
  // 处于主子应用情况下才会执行下方逻辑,主题色的变更以主框架的为准
162
166
  if (actionMap && isQiankun) {
167
+ var _themeConfig$data;
163
168
  observer = new MutationObserver(function (mutationsList) {
164
169
  var targetEntries = mutationsList[0];
165
170
  if (targetEntries) {
@@ -207,6 +212,19 @@ var ProIcon = function ProIcon(props) {
207
212
  attributes: true,
208
213
  attributeFilter: ['style']
209
214
  });
215
+ // 未变更时及初始化时
216
+ var extendFromMainColor = themeConfig === null || themeConfig === void 0 ? void 0 : (_themeConfig$data = themeConfig.data) === null || _themeConfig$data === void 0 ? void 0 : _themeConfig$data.zauiBrand;
217
+ if (extendFromMainColor && qiankunPrimaryColor !== extendFromMainColor) {
218
+ dispatch({
219
+ type: 'set',
220
+ payload: {
221
+ theme: {
222
+ primaryColor: primaryColor,
223
+ qiankunPrimaryColor: extendFromMainColor
224
+ }
225
+ }
226
+ });
227
+ }
210
228
  }
211
229
  }, []);
212
230
  (0, _react.useEffect)(function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.4.5-beta.10",
3
+ "version": "3.4.5-beta.11",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",