ls-pro-common 1.0.10 → 1.0.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.
package/es/http/index.js CHANGED
@@ -2,7 +2,7 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
2
2
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
3
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
4
  import { extend } from 'umi-request';
5
- import { getCache, getUrlQuery, showError, toGatewayUrl } from '../utils'; //默认超时时间为1分钟
5
+ import { getCache, getUrlQuery, showError } from '../utils'; //默认超时时间为1分钟
6
6
 
7
7
  var request = extend({
8
8
  timeout: 60000
@@ -23,7 +23,7 @@ request.interceptors.request.use(function (url, options) {
23
23
  }
24
24
 
25
25
  return {
26
- url: toGatewayUrl(url),
26
+ url: url,
27
27
  options: opts
28
28
  };
29
29
  });
@@ -1,18 +1,4 @@
1
- export declare const getUrlQuery: (name: string, url?: string) => string;
2
- /**
3
- * 设置url传参
4
- * @param {*} url
5
- * @param {*} keyvals
6
- * @returns
7
- */
8
- export declare const setUrlQuery: (url: string, keyvals?: Record<string, any>) => string;
9
- /**
10
- * 给 url 添加网关
11
- * @param url 原url,以 / 打头
12
- * @param defGateway 默认网关 /petrel
13
- * @returns
14
- */
15
- export declare const toGatewayUrl: (url: string, defGateway?: string) => string;
1
+ export { getUrlQuery, setUrlQuery, dateFormat, toGatewayUrl } from 'ls-pro-table/lib/utils';
16
2
  /**
17
3
  * 设置文档title
18
4
  * @param {*} title
@@ -49,13 +35,6 @@ export declare const setCache: (key: string, data: any) => void;
49
35
  * @returns 关键字对应的值
50
36
  */
51
37
  export declare const getCache: any;
52
- /**
53
- * 简单日期格式化
54
- * @param {*} dt 传入时间参数,若不传取当前时间
55
- * @param {*} showTime 是否返回当前时间,默认返回时间
56
- * @returns xxxx年-xx月-xx日 [xx时:xx分:xx秒]
57
- */
58
- export declare const dateFormat: (dt: Date | undefined | null, showTime?: boolean) => string;
59
38
  /** @name 显示错误 */
60
39
  export declare const showError: (text: string) => void;
61
40
  /** @name 显示警示 */
package/es/utils/index.js CHANGED
@@ -6,51 +6,7 @@ import _message from "antd/es/message";
6
6
  import _typeof from "@babel/runtime/helpers/esm/typeof";
7
7
  import React from "react";
8
8
  import { QuestionCircleOutlined } from '@ant-design/icons';
9
- export var getUrlQuery = function getUrlQuery(name) {
10
- var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : location.search.substr(1) || '';
11
- var reg = new RegExp('(^|[&|?])' + name + '=([^&]*)(&|$)'),
12
- r = url.match(reg);
13
- if (r != null) return unescape(decodeURI(r[2]));
14
- return '';
15
- };
16
- /**
17
- * 设置url传参
18
- * @param {*} url
19
- * @param {*} keyvals
20
- * @returns
21
- */
22
-
23
- export var setUrlQuery = function setUrlQuery(url) {
24
- var keyvals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
25
- var newUrl = url;
26
-
27
- for (var name in keyvals) {
28
- var reg = new RegExp('(^|)' + name + '=([^&]*)(|$)');
29
- var tmp = name + '=' + keyvals[name];
30
-
31
- if (newUrl.match(reg) != null) {
32
- // @ts-ignore
33
- newUrl = newUrl.replace(eval(reg), tmp);
34
- } else {
35
- newUrl = newUrl + (newUrl.match('[\?]') ? '&' : '?') + tmp;
36
- }
37
- }
38
-
39
- return newUrl;
40
- };
41
- /**
42
- * 给 url 添加网关
43
- * @param url 原url,以 / 打头
44
- * @param defGateway 默认网关 /petrel
45
- * @returns
46
- */
47
-
48
- export var toGatewayUrl = function toGatewayUrl(url) {
49
- var defGateway = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '/petrel';
50
- if (url.startsWith('http://') || url.startsWith('https://') || url.startsWith('//')) return url;
51
- var gateway = getUrlQuery('gateway') || location.origin + defGateway;
52
- return gateway + url;
53
- };
9
+ export { getUrlQuery, setUrlQuery, dateFormat, toGatewayUrl } from "ls-pro-table/es/utils";
54
10
  /**
55
11
  * 设置文档title
56
12
  * @param {*} title
@@ -126,24 +82,6 @@ export var getCache = function getCache(key) {
126
82
 
127
83
  return data;
128
84
  };
129
- /**
130
- * 简单日期格式化
131
- * @param {*} dt 传入时间参数,若不传取当前时间
132
- * @param {*} showTime 是否返回当前时间,默认返回时间
133
- * @returns xxxx年-xx月-xx日 [xx时:xx分:xx秒]
134
- */
135
-
136
- export var dateFormat = function dateFormat(dt) {
137
- var showTime = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
138
- var ct = dt ? dt : new Date(Date.now());
139
- var str = ct.getFullYear() + '-' + ('' + (ct.getMonth() + 1)).padStart(2, '0') + '-' + ('' + ct.getDate()).padStart(2, '0');
140
-
141
- if (showTime) {
142
- str += ' ' + (ct.getHours() + '').padStart(2, '0') + ':' + (ct.getMinutes() + '').padStart(2, '0') + ":" + (ct.getSeconds() + '').padStart(2, '0');
143
- }
144
-
145
- return str;
146
- };
147
85
  /** @name 显示错误 */
148
86
 
149
87
  export var showError = function showError(text) {
package/lib/http/index.js CHANGED
@@ -42,7 +42,7 @@ request.interceptors.request.use(function (url, options) {
42
42
  }
43
43
 
44
44
  return {
45
- url: (0, _utils.toGatewayUrl)(url),
45
+ url: url,
46
46
  options: opts
47
47
  };
48
48
  });
@@ -1,18 +1,4 @@
1
- export declare const getUrlQuery: (name: string, url?: string) => string;
2
- /**
3
- * 设置url传参
4
- * @param {*} url
5
- * @param {*} keyvals
6
- * @returns
7
- */
8
- export declare const setUrlQuery: (url: string, keyvals?: Record<string, any>) => string;
9
- /**
10
- * 给 url 添加网关
11
- * @param url 原url,以 / 打头
12
- * @param defGateway 默认网关 /petrel
13
- * @returns
14
- */
15
- export declare const toGatewayUrl: (url: string, defGateway?: string) => string;
1
+ export { getUrlQuery, setUrlQuery, dateFormat, toGatewayUrl } from 'ls-pro-table/lib/utils';
16
2
  /**
17
3
  * 设置文档title
18
4
  * @param {*} title
@@ -49,13 +35,6 @@ export declare const setCache: (key: string, data: any) => void;
49
35
  * @returns 关键字对应的值
50
36
  */
51
37
  export declare const getCache: any;
52
- /**
53
- * 简单日期格式化
54
- * @param {*} dt 传入时间参数,若不传取当前时间
55
- * @param {*} showTime 是否返回当前时间,默认返回时间
56
- * @returns xxxx年-xx月-xx日 [xx时:xx分:xx秒]
57
- */
58
- export declare const dateFormat: (dt: Date | undefined | null, showTime?: boolean) => string;
59
38
  /** @name 显示错误 */
60
39
  export declare const showError: (text: string) => void;
61
40
  /** @name 显示警示 */
@@ -5,7 +5,34 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.yesnoList = exports.treeFind = exports.treeEach = exports.toGatewayUrl = exports.statusList = exports.showWarn = exports.showSuccess = exports.showError = exports.showConfirm = exports.setUrlQuery = exports.setTitle = exports.setCookie = exports.setCache = exports.rangeToSearch = exports.isLogin = exports.getUserName = exports.getUserInfo = exports.getUrlQuery = exports.getLoginName = exports.getCookie = exports.getCompanyId = exports.getCache = exports.dateFormat = void 0;
8
+ Object.defineProperty(exports, "dateFormat", {
9
+ enumerable: true,
10
+ get: function get() {
11
+ return _utils.dateFormat;
12
+ }
13
+ });
14
+ exports.getLoginName = exports.getCookie = exports.getCompanyId = exports.getCache = void 0;
15
+ Object.defineProperty(exports, "getUrlQuery", {
16
+ enumerable: true,
17
+ get: function get() {
18
+ return _utils.getUrlQuery;
19
+ }
20
+ });
21
+ exports.setTitle = exports.setCookie = exports.setCache = exports.rangeToSearch = exports.isLogin = exports.getUserName = exports.getUserInfo = void 0;
22
+ Object.defineProperty(exports, "setUrlQuery", {
23
+ enumerable: true,
24
+ get: function get() {
25
+ return _utils.setUrlQuery;
26
+ }
27
+ });
28
+ exports.statusList = exports.showWarn = exports.showSuccess = exports.showError = exports.showConfirm = void 0;
29
+ Object.defineProperty(exports, "toGatewayUrl", {
30
+ enumerable: true,
31
+ get: function get() {
32
+ return _utils.toGatewayUrl;
33
+ }
34
+ });
35
+ exports.yesnoList = exports.treeFind = exports.treeEach = void 0;
9
36
 
10
37
  var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/createForOfIteratorHelper"));
11
38
 
@@ -23,66 +50,13 @@ var _react = _interopRequireDefault(require("react"));
23
50
 
24
51
  var _icons = require("@ant-design/icons");
25
52
 
26
- var getUrlQuery = function getUrlQuery(name) {
27
- var url = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : location.search.substr(1) || '';
28
- var reg = new RegExp('(^|[&|?])' + name + '=([^&]*)(&|$)'),
29
- r = url.match(reg);
30
- if (r != null) return unescape(decodeURI(r[2]));
31
- return '';
32
- };
33
- /**
34
- * 设置url传参
35
- * @param {*} url
36
- * @param {*} keyvals
37
- * @returns
38
- */
39
-
40
-
41
- exports.getUrlQuery = getUrlQuery;
42
-
43
- var setUrlQuery = function setUrlQuery(url) {
44
- var keyvals = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
45
- var newUrl = url;
46
-
47
- for (var name in keyvals) {
48
- var reg = new RegExp('(^|)' + name + '=([^&]*)(|$)');
49
- var tmp = name + '=' + keyvals[name];
50
-
51
- if (newUrl.match(reg) != null) {
52
- // @ts-ignore
53
- newUrl = newUrl.replace(eval(reg), tmp);
54
- } else {
55
- newUrl = newUrl + (newUrl.match('[\?]') ? '&' : '?') + tmp;
56
- }
57
- }
58
-
59
- return newUrl;
60
- };
61
- /**
62
- * 给 url 添加网关
63
- * @param url 原url,以 / 打头
64
- * @param defGateway 默认网关 /petrel
65
- * @returns
66
- */
67
-
68
-
69
- exports.setUrlQuery = setUrlQuery;
53
+ var _utils = require("ls-pro-table/lib/utils");
70
54
 
71
- var toGatewayUrl = function toGatewayUrl(url) {
72
- var defGateway = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '/petrel';
73
- if (url.startsWith('http://') || url.startsWith('https://') || url.startsWith('//')) return url;
74
- var gateway = getUrlQuery('gateway') || location.origin + defGateway;
75
- return gateway + url;
76
- };
77
55
  /**
78
56
  * 设置文档title
79
57
  * @param {*} title
80
58
  * @returns
81
59
  */
82
-
83
-
84
- exports.toGatewayUrl = toGatewayUrl;
85
-
86
60
  var setTitle = function setTitle(title) {
87
61
  if (!title) return;
88
62
  title = title.length > 10 ? title.substring(0, 10) + '...' : title;
@@ -167,31 +141,10 @@ var getCache = function getCache(key) {
167
141
 
168
142
  return data;
169
143
  };
170
- /**
171
- * 简单日期格式化
172
- * @param {*} dt 传入时间参数,若不传取当前时间
173
- * @param {*} showTime 是否返回当前时间,默认返回时间
174
- * @returns xxxx年-xx月-xx日 [xx时:xx分:xx秒]
175
- */
176
-
177
-
178
- exports.getCache = getCache;
179
-
180
- var dateFormat = function dateFormat(dt) {
181
- var showTime = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
182
- var ct = dt ? dt : new Date(Date.now());
183
- var str = ct.getFullYear() + '-' + ('' + (ct.getMonth() + 1)).padStart(2, '0') + '-' + ('' + ct.getDate()).padStart(2, '0');
184
-
185
- if (showTime) {
186
- str += ' ' + (ct.getHours() + '').padStart(2, '0') + ':' + (ct.getMinutes() + '').padStart(2, '0') + ":" + (ct.getSeconds() + '').padStart(2, '0');
187
- }
188
-
189
- return str;
190
- };
191
144
  /** @name 显示错误 */
192
145
 
193
146
 
194
- exports.dateFormat = dateFormat;
147
+ exports.getCache = getCache;
195
148
 
196
149
  var showError = function showError(text) {
197
150
  _message2.default.error(text);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ls-pro-common",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "ls-pro-common",
5
5
  "keywords": [
6
6
  "antd",
@@ -28,7 +28,7 @@
28
28
  ],
29
29
  "dependencies": {
30
30
  "@ant-design/icons": "^4.3.0",
31
- "ls-pro-table": "2.62.16",
31
+ "ls-pro-table": "2.62.17",
32
32
  "ls-pro-form": "1.52.20",
33
33
  "@babel/runtime": "^7.16.3",
34
34
  "classnames": "^2.2.6",