@teamias/pro-layout 0.0.13 → 0.0.15

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,3 +1,9 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
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; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
1
7
  import { useEffect } from 'react';
2
8
  import { useIntl } from 'react-intl';
3
9
  import { useAccessRouter } from "../hooks";
@@ -10,7 +16,8 @@ export var DocumentTitle = function DocumentTitle(_ref) {
10
16
  pageStatus = _useAccessRouter$loca.pageStatus,
11
17
  pathname = _useAccessRouter$loca.pathname,
12
18
  pageTitle = _useAccessRouter$loca.pageTitle,
13
- intlMenuConfig = _useAccessRouter$loca.intlMenuConfig;
19
+ intlMenuConfig = _useAccessRouter$loca.intlMenuConfig,
20
+ localLangKey = _useAccessRouter$loca.localLangKey;
14
21
  var _useIntl = useIntl(),
15
22
  formatMessage = _useIntl.formatMessage;
16
23
  useEffect(function () {
@@ -22,7 +29,9 @@ export var DocumentTitle = function DocumentTitle(_ref) {
22
29
  // document.title = pageStatus + '';
23
30
  // return;
24
31
  // }
25
- document.title = pageTitle || formatMessage(intlMenuConfig || {});
26
- }, [pathname, pageStatus, pageTitle, intlMenuConfig, title]);
32
+ document.title = pageTitle || formatMessage(_objectSpread(_objectSpread({}, intlMenuConfig || localLangKey), {}, {
33
+ id: (intlMenuConfig === null || intlMenuConfig === void 0 ? void 0 : intlMenuConfig.id) || (localLangKey === null || localLangKey === void 0 ? void 0 : localLangKey.id) || 'menu.unknown'
34
+ }));
35
+ }, [pathname, pageStatus, pageTitle, intlMenuConfig, localLangKey, title]);
27
36
  return /*#__PURE__*/_jsx(_Fragment, {});
28
37
  };
@@ -24,6 +24,11 @@ export declare class KeepAliveClass {
24
24
  defaultMessage: string;
25
25
  localConfigPath: string;
26
26
  } | undefined;
27
+ localLangKey?: {
28
+ id: string;
29
+ defaultMessage: string;
30
+ localConfigPath: string;
31
+ } | undefined;
27
32
  })[];
28
33
  /** 关闭页面 */
29
34
  closePage(assignKey: string): number;
@@ -44,6 +49,11 @@ export declare class KeepAliveClass {
44
49
  defaultMessage: string;
45
50
  localConfigPath: string;
46
51
  } | undefined;
52
+ localLangKey?: {
53
+ id: string;
54
+ defaultMessage: string;
55
+ localConfigPath: string;
56
+ } | undefined;
47
57
  })[];
48
58
  /** 更新当前路由页面 */
49
59
  updateCurrentPage(index?: number): void;
@@ -13,6 +13,11 @@ export declare const useKeepAlivePages: () => (import("react-router-dom").Locati
13
13
  defaultMessage: string;
14
14
  localConfigPath: string;
15
15
  } | undefined;
16
+ localLangKey?: {
17
+ id: string;
18
+ defaultMessage: string;
19
+ localConfigPath: string;
20
+ } | undefined;
16
21
  })[];
17
22
  /** 根 */
18
23
  export declare const KeepAliveRoot: () => import("react/jsx-runtime").JSX.Element;
@@ -133,12 +133,15 @@ export var TabsLayout = function TabsLayout() {
133
133
  };
134
134
  }()),
135
135
  items: pathNameList.map(function (item) {
136
+ var _item$intlMenuConfig, _item$localLangKey;
136
137
  // 判断是否当前活跃标签
137
138
  var isCurrent = eq(state.activeKey, item.pathname);
138
139
  return {
139
140
  key: item.pathname,
140
141
  label: /*#__PURE__*/_jsx(TabItem, {
141
- pageTitle: item.pageTitle || /*#__PURE__*/_jsx(FormattedMessage, _objectSpread({}, item.intlMenuConfig)),
142
+ pageTitle: item.pageTitle || /*#__PURE__*/_jsx(FormattedMessage, _objectSpread(_objectSpread({}, item.intlMenuConfig || item.localLangKey), {}, {
143
+ id: ((_item$intlMenuConfig = item.intlMenuConfig) === null || _item$intlMenuConfig === void 0 ? void 0 : _item$intlMenuConfig.id) || ((_item$localLangKey = item.localLangKey) === null || _item$localLangKey === void 0 ? void 0 : _item$localLangKey.id) || 'menu.unknown'
144
+ })),
142
145
  pathname: item.pathname,
143
146
  isCurrent: isCurrent,
144
147
  onClickMenu: handleClickMenu
@@ -19,5 +19,11 @@ export declare const useAccessRouter: () => {
19
19
  defaultMessage: string;
20
20
  localConfigPath: string;
21
21
  } | undefined;
22
+ /** 兼容历史数据保留的, 只在使用时候会用到 */
23
+ localLangKey?: {
24
+ id: string;
25
+ defaultMessage: string;
26
+ localConfigPath: string;
27
+ } | undefined;
22
28
  };
23
29
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamias/pro-layout",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "A react library developed with dumi",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",