vap1 0.8.4 → 0.8.6

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.
@@ -8,4 +8,6 @@ export type ApiGlobalOption = ApiOption & {
8
8
  */
9
9
  namespace?: string;
10
10
  };
11
- export declare const useApiGlobal: (options: string | ApiGlobalOption) => ApiListState;
11
+ type UseAppGlobal = (option: string | ApiGlobalOption) => ApiListState;
12
+ export declare const useApiGlobal: UseAppGlobal;
13
+ export {};
@@ -33,10 +33,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
33
33
  exports.useApiGlobal = void 0;
34
34
  var lodash_1 = __importDefault(require("lodash"));
35
35
  var react_1 = require("react");
36
+ // import { clearURL } from '../utils/PageUtil'
36
37
  var _list_1 = require("./_list");
37
38
  var useGlobal_1 = require("./useGlobal");
38
39
  var useApiBase_1 = require("./useApiBase");
39
- var toKey = function (pathname, hash) {
40
+ var useApi_1 = require("./useApi");
41
+ var toKey = function () {
42
+ var pathname = location.pathname, hash = location.hash;
40
43
  var root = lodash_1.default.trim(pathname).toLowerCase();
41
44
  if (root.endsWith('/'))
42
45
  root = root.substring(0, root.length - 1);
@@ -45,7 +48,7 @@ var toKey = function (pathname, hash) {
45
48
  root = root.replace('/', '-');
46
49
  return root + hash;
47
50
  };
48
- var useApiGlobal = function (options) {
51
+ exports.useApiGlobal = (lodash_1.default.has(window, '__MICRO_APP_BASE_ROUTE__') && window['__MICRO_APP_BASE_ROUTE__']) ? useApi_1.useApi : function (options) {
49
52
  var config = lodash_1.default.isString(options) ? { api: options } : options;
50
53
  var BASE = __assign(__assign({}, _list_1.DEFAULT_STATE), { effect: null });
51
54
  BASE.rowKey = config.rowKey || 'id';
@@ -57,10 +60,8 @@ var useApiGlobal = function (options) {
57
60
  var namespace = (0, react_1.useMemo)(function () {
58
61
  if (config.namespace)
59
62
  return config.namespace;
60
- var pathname = location.pathname, hash = location.hash;
61
- return toKey(pathname, hash);
63
+ return toKey();
62
64
  }, []);
63
65
  var _a = __read((0, useGlobal_1.useGlobal)(namespace, BASE), 2), state = _a[0], doLoad = _a[1];
64
66
  return (0, useApiBase_1.useApiBase)(config, state, doLoad, 'api-global');
65
67
  };
66
- exports.useApiGlobal = useApiGlobal;
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"vap1","version":"0.8.4","description":"vap1, Both support MicroService and SAP FrameWork, Support IE>9","main":"index.js","author":"Xiang da","license":"ISC"}
1
+ {"name":"vap1","version":"0.8.6","description":"vap1, Both support MicroService and SAP FrameWork, Support IE>9","main":"index.js","author":"Xiang da","license":"ISC"}