fast-vue-multi-pages 1.0.20 → 1.0.21

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,6 +12,7 @@ import { FastVueMultiWindow } from "./other/FastVueMultiWindow";
12
12
  import { FastVueMultiFile } from "./other/FastVueMultiFile";
13
13
  import { FastVueMultiBase64 } from "./other/FastVueMultiBase64";
14
14
  import { FastVueMultiEventBus } from "./other/FastVueMultiEventBus";
15
+ import { FastVueMultiObject } from "./other/FastVueMultiObject";
15
16
  /**
16
17
  * FastVueMultiTool 手机APP功能工具类
17
18
  */
@@ -44,6 +45,10 @@ export declare class FastVueMultiTool {
44
45
  * Lodash工具类 https://lodash.com/docs/
45
46
  */
46
47
  static Lodash: _.LoDashStatic;
48
+ /**
49
+ * Lodash工具类 https://lodash.com/docs/
50
+ */
51
+ static _: _.LoDashStatic;
47
52
  /**
48
53
  * crypto-js工具类 https://cryptojs.gitbook.io/docs/
49
54
  */
@@ -80,4 +85,8 @@ export declare class FastVueMultiTool {
80
85
  * 事件传递
81
86
  */
82
87
  static EventBus: typeof FastVueMultiEventBus;
88
+ /**
89
+ * 对象相关操作
90
+ */
91
+ static Object: typeof FastVueMultiObject;
83
92
  }
@@ -16,6 +16,7 @@ const FastVueMultiWindow_1 = require("./other/FastVueMultiWindow");
16
16
  const FastVueMultiFile_1 = require("./other/FastVueMultiFile");
17
17
  const FastVueMultiBase64_1 = require("./other/FastVueMultiBase64");
18
18
  const FastVueMultiEventBus_1 = require("./other/FastVueMultiEventBus");
19
+ const FastVueMultiObject_1 = require("./other/FastVueMultiObject");
19
20
  /**
20
21
  * FastVueMultiTool 手机APP功能工具类
21
22
  */
@@ -48,6 +49,10 @@ class FastVueMultiTool {
48
49
  * Lodash工具类 https://lodash.com/docs/
49
50
  */
50
51
  static Lodash = lodash_1.default;
52
+ /**
53
+ * Lodash工具类 https://lodash.com/docs/
54
+ */
55
+ static _ = lodash_1.default;
51
56
  /**
52
57
  * crypto-js工具类 https://cryptojs.gitbook.io/docs/
53
58
  */
@@ -84,5 +89,9 @@ class FastVueMultiTool {
84
89
  * 事件传递
85
90
  */
86
91
  static EventBus = FastVueMultiEventBus_1.FastVueMultiEventBus;
92
+ /**
93
+ * 对象相关操作
94
+ */
95
+ static Object = FastVueMultiObject_1.FastVueMultiObject;
87
96
  }
88
97
  exports.FastVueMultiTool = FastVueMultiTool;
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.FastVueMultiBoolean = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
6
+ const FastVueMultiObject_1 = require("./FastVueMultiObject");
6
7
  class FastVueMultiBoolean {
7
8
  /**
8
9
  * 判断目标值是否为布尔值
@@ -23,10 +24,10 @@ class FastVueMultiBoolean {
23
24
  * @param defaultValue 默认值,当为空或无效的布尔值时 返回
24
25
  */
25
26
  static parse(source, defaultValue) {
26
- if (lodash_1.default.isEmpty(defaultValue)) {
27
+ if (FastVueMultiObject_1.FastVueMultiObject.isNotValid(defaultValue)) {
27
28
  defaultValue = false;
28
29
  }
29
- if (lodash_1.default.isEmpty(source)) {
30
+ if (FastVueMultiObject_1.FastVueMultiObject.isNotValid(source)) {
30
31
  return defaultValue;
31
32
  }
32
33
  if (lodash_1.default.isString(source)) {
@@ -4,6 +4,7 @@ exports.FastVueMultiDate = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const moment_1 = tslib_1.__importDefault(require("moment"));
6
6
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
7
+ const FastVueMultiObject_1 = require("./FastVueMultiObject");
7
8
  class FastVueMultiDate {
8
9
  /**
9
10
  * 判断目标值是否是日期类型
@@ -24,7 +25,7 @@ class FastVueMultiDate {
24
25
  * @param pattern 格式类型,例如:yyyy-MM-DD HH:mm:ss,更多查看:https://momentjs.com/docs/#/displaying/
25
26
  */
26
27
  static format(source, pattern) {
27
- if (lodash_1.default.isEmpty(pattern)) {
28
+ if (FastVueMultiObject_1.FastVueMultiObject.isNotValid(pattern)) {
28
29
  return source.toLocaleString();
29
30
  }
30
31
  if (!source) {
@@ -37,7 +38,7 @@ class FastVueMultiDate {
37
38
  * @param source 日期值
38
39
  */
39
40
  static parse(source) {
40
- if (lodash_1.default.isEmpty(source)) {
41
+ if (FastVueMultiObject_1.FastVueMultiObject.isNotValid(source)) {
41
42
  return null;
42
43
  }
43
44
  return (0, moment_1.default)(source).toDate();
@@ -48,7 +49,7 @@ class FastVueMultiDate {
48
49
  * @param level 精确级别 1 分钟 2 小时 3 天 4 周 5 月
49
50
  */
50
51
  static formatNice(source, level) {
51
- if (lodash_1.default.isEmpty(source)) {
52
+ if (FastVueMultiObject_1.FastVueMultiObject.isNotValid(source)) {
52
53
  return source;
53
54
  }
54
55
  if (level === undefined) {
@@ -9,13 +9,13 @@ export declare class FastVueMultiEventBus {
9
9
  private static startTimer;
10
10
  private static pushWatcher;
11
11
  /**
12
- * 启动一个事件监听器
12
+ * 监听事件
13
13
  * @param eventName 事件名称 string|array
14
14
  * @param callback 事件触发的回调 function(eventName,eventParams){}
15
15
  */
16
16
  static on(eventName: any, callback: any): void;
17
17
  /**
18
- * 通知事件监听者
18
+ * 触发事件
19
19
  * @param eventName 事件名称 string|array
20
20
  * @param eventParams 携带参数 any
21
21
  */
@@ -4,6 +4,7 @@ exports.FastVueMultiEventBus = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const lodash_1 = tslib_1.__importDefault(require("lodash"));
6
6
  const js_cookie_1 = tslib_1.__importDefault(require("js-cookie"));
7
+ const FastVueMultiObject_1 = require("./FastVueMultiObject");
7
8
  /**
8
9
  * 事件监听器
9
10
  */
@@ -67,12 +68,12 @@ class FastVueMultiEventBus {
67
68
  }
68
69
  }
69
70
  /**
70
- * 启动一个事件监听器
71
+ * 监听事件
71
72
  * @param eventName 事件名称 string|array
72
73
  * @param callback 事件触发的回调 function(eventName,eventParams){}
73
74
  */
74
75
  static on(eventName, callback) {
75
- if (!callback || lodash_1.default.isEmpty(eventName)) {
76
+ if (!callback || FastVueMultiObject_1.FastVueMultiObject.isNotValid(eventName)) {
76
77
  //未携带回调函数的监听者,认为是无效监听
77
78
  return;
78
79
  }
@@ -87,12 +88,12 @@ class FastVueMultiEventBus {
87
88
  this.startTimer();
88
89
  }
89
90
  /**
90
- * 通知事件监听者
91
+ * 触发事件
91
92
  * @param eventName 事件名称 string|array
92
93
  * @param eventParams 携带参数 any
93
94
  */
94
95
  static emit(eventName, eventParams) {
95
- if (lodash_1.default.isEmpty(eventName)) {
96
+ if (FastVueMultiObject_1.FastVueMultiObject.isNotValid(eventName)) {
96
97
  return;
97
98
  }
98
99
  if (lodash_1.default.isArray(eventName)) {
@@ -0,0 +1,12 @@
1
+ export declare class FastVueMultiObject {
2
+ /**
3
+ * 判断目标值是否无效,支持判断字符串、对象、数组等
4
+ * @param value
5
+ */
6
+ static isNotValid(value: any): boolean;
7
+ /**
8
+ * 判断目标值是否有效,支持判断字符串、对象、数组等
9
+ * @param value
10
+ */
11
+ static isValid(value: any): boolean;
12
+ }
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FastVueMultiObject = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const lodash_1 = tslib_1.__importDefault(require("lodash"));
6
+ class FastVueMultiObject {
7
+ /**
8
+ * 判断目标值是否无效,支持判断字符串、对象、数组等
9
+ * @param value
10
+ */
11
+ static isNotValid(value) {
12
+ return !this.isValid(value);
13
+ }
14
+ /**
15
+ * 判断目标值是否有效,支持判断字符串、对象、数组等
16
+ * @param value
17
+ */
18
+ static isValid(value) {
19
+ if (lodash_1.default.isNull(value)) {
20
+ return false;
21
+ }
22
+ if (lodash_1.default.isUndefined(value)) {
23
+ return false;
24
+ }
25
+ if (lodash_1.default.isNil(value)) {
26
+ return false;
27
+ }
28
+ if (lodash_1.default.isNaN(value)) {
29
+ return false;
30
+ }
31
+ if (lodash_1.default.isString(value)) {
32
+ if (value.toString().length === 0) {
33
+ return false;
34
+ }
35
+ }
36
+ return true;
37
+ }
38
+ }
39
+ exports.FastVueMultiObject = FastVueMultiObject;
@@ -12,6 +12,7 @@ import { FastVueMultiWindow } from "./other/FastVueMultiWindow";
12
12
  import { FastVueMultiFile } from "./other/FastVueMultiFile";
13
13
  import { FastVueMultiBase64 } from "./other/FastVueMultiBase64";
14
14
  import { FastVueMultiEventBus } from "./other/FastVueMultiEventBus";
15
+ import { FastVueMultiObject } from "./other/FastVueMultiObject";
15
16
  /**
16
17
  * FastVueMultiTool 手机APP功能工具类
17
18
  */
@@ -44,6 +45,10 @@ export declare class FastVueMultiTool {
44
45
  * Lodash工具类 https://lodash.com/docs/
45
46
  */
46
47
  static Lodash: _.LoDashStatic;
48
+ /**
49
+ * Lodash工具类 https://lodash.com/docs/
50
+ */
51
+ static _: _.LoDashStatic;
47
52
  /**
48
53
  * crypto-js工具类 https://cryptojs.gitbook.io/docs/
49
54
  */
@@ -80,4 +85,8 @@ export declare class FastVueMultiTool {
80
85
  * 事件传递
81
86
  */
82
87
  static EventBus: typeof FastVueMultiEventBus;
88
+ /**
89
+ * 对象相关操作
90
+ */
91
+ static Object: typeof FastVueMultiObject;
83
92
  }
@@ -1,4 +1,4 @@
1
- define(["require", "exports", "tslib", "lodash", "./http/FastVueMultiHttp", "./other/FastVueMultiStore", "./vue/FastVueMultiConfig", "./http/FastVueMultiCookie", "./other/FastVueMultiClipboard", "./other/FastVueMultiDate", "./other/FastVueMultiBoolean", "./other/FastVueMultiFunction", "./other/FastVueMultiElement", "./other/FastVueMultiWindow", "./other/FastVueMultiFile", "./other/FastVueMultiBase64", "./other/FastVueMultiEventBus"], function (require, exports, tslib_1, lodash_1, FastVueMultiHttp_1, FastVueMultiStore_1, FastVueMultiConfig_1, FastVueMultiCookie_1, FastVueMultiClipboard_1, FastVueMultiDate_1, FastVueMultiBoolean_1, FastVueMultiFunction_1, FastVueMultiElement_1, FastVueMultiWindow_1, FastVueMultiFile_1, FastVueMultiBase64_1, FastVueMultiEventBus_1) {
1
+ define(["require", "exports", "tslib", "lodash", "./http/FastVueMultiHttp", "./other/FastVueMultiStore", "./vue/FastVueMultiConfig", "./http/FastVueMultiCookie", "./other/FastVueMultiClipboard", "./other/FastVueMultiDate", "./other/FastVueMultiBoolean", "./other/FastVueMultiFunction", "./other/FastVueMultiElement", "./other/FastVueMultiWindow", "./other/FastVueMultiFile", "./other/FastVueMultiBase64", "./other/FastVueMultiEventBus", "./other/FastVueMultiObject"], function (require, exports, tslib_1, lodash_1, FastVueMultiHttp_1, FastVueMultiStore_1, FastVueMultiConfig_1, FastVueMultiCookie_1, FastVueMultiClipboard_1, FastVueMultiDate_1, FastVueMultiBoolean_1, FastVueMultiFunction_1, FastVueMultiElement_1, FastVueMultiWindow_1, FastVueMultiFile_1, FastVueMultiBase64_1, FastVueMultiEventBus_1, FastVueMultiObject_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.FastVueMultiTool = void 0;
@@ -37,6 +37,10 @@ define(["require", "exports", "tslib", "lodash", "./http/FastVueMultiHttp", "./o
37
37
  * Lodash工具类 https://lodash.com/docs/
38
38
  */
39
39
  FastVueMultiTool.Lodash = lodash_1.default;
40
+ /**
41
+ * Lodash工具类 https://lodash.com/docs/
42
+ */
43
+ FastVueMultiTool._ = lodash_1.default;
40
44
  /**
41
45
  * crypto-js工具类 https://cryptojs.gitbook.io/docs/
42
46
  */
@@ -73,6 +77,10 @@ define(["require", "exports", "tslib", "lodash", "./http/FastVueMultiHttp", "./o
73
77
  * 事件传递
74
78
  */
75
79
  FastVueMultiTool.EventBus = FastVueMultiEventBus_1.FastVueMultiEventBus;
80
+ /**
81
+ * 对象相关操作
82
+ */
83
+ FastVueMultiTool.Object = FastVueMultiObject_1.FastVueMultiObject;
76
84
  return FastVueMultiTool;
77
85
  }());
78
86
  exports.FastVueMultiTool = FastVueMultiTool;
@@ -1,4 +1,4 @@
1
- define(["require", "exports", "tslib", "lodash"], function (require, exports, tslib_1, lodash_1) {
1
+ define(["require", "exports", "tslib", "lodash", "./FastVueMultiObject"], function (require, exports, tslib_1, lodash_1, FastVueMultiObject_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.FastVueMultiBoolean = void 0;
@@ -25,10 +25,10 @@ define(["require", "exports", "tslib", "lodash"], function (require, exports, ts
25
25
  * @param defaultValue 默认值,当为空或无效的布尔值时 返回
26
26
  */
27
27
  FastVueMultiBoolean.parse = function (source, defaultValue) {
28
- if (lodash_1.default.isEmpty(defaultValue)) {
28
+ if (FastVueMultiObject_1.FastVueMultiObject.isNotValid(defaultValue)) {
29
29
  defaultValue = false;
30
30
  }
31
- if (lodash_1.default.isEmpty(source)) {
31
+ if (FastVueMultiObject_1.FastVueMultiObject.isNotValid(source)) {
32
32
  return defaultValue;
33
33
  }
34
34
  if (lodash_1.default.isString(source)) {
@@ -1,4 +1,4 @@
1
- define(["require", "exports", "tslib", "moment", "lodash"], function (require, exports, tslib_1, moment_1, lodash_1) {
1
+ define(["require", "exports", "tslib", "moment", "lodash", "./FastVueMultiObject"], function (require, exports, tslib_1, moment_1, lodash_1, FastVueMultiObject_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.FastVueMultiDate = void 0;
@@ -26,7 +26,7 @@ define(["require", "exports", "tslib", "moment", "lodash"], function (require, e
26
26
  * @param pattern 格式类型,例如:yyyy-MM-DD HH:mm:ss,更多查看:https://momentjs.com/docs/#/displaying/
27
27
  */
28
28
  FastVueMultiDate.format = function (source, pattern) {
29
- if (lodash_1.default.isEmpty(pattern)) {
29
+ if (FastVueMultiObject_1.FastVueMultiObject.isNotValid(pattern)) {
30
30
  return source.toLocaleString();
31
31
  }
32
32
  if (!source) {
@@ -39,7 +39,7 @@ define(["require", "exports", "tslib", "moment", "lodash"], function (require, e
39
39
  * @param source 日期值
40
40
  */
41
41
  FastVueMultiDate.parse = function (source) {
42
- if (lodash_1.default.isEmpty(source)) {
42
+ if (FastVueMultiObject_1.FastVueMultiObject.isNotValid(source)) {
43
43
  return null;
44
44
  }
45
45
  return (0, moment_1.default)(source).toDate();
@@ -50,7 +50,7 @@ define(["require", "exports", "tslib", "moment", "lodash"], function (require, e
50
50
  * @param level 精确级别 1 分钟 2 小时 3 天 4 周 5 月
51
51
  */
52
52
  FastVueMultiDate.formatNice = function (source, level) {
53
- if (lodash_1.default.isEmpty(source)) {
53
+ if (FastVueMultiObject_1.FastVueMultiObject.isNotValid(source)) {
54
54
  return source;
55
55
  }
56
56
  if (level === undefined) {
@@ -9,13 +9,13 @@ export declare class FastVueMultiEventBus {
9
9
  private static startTimer;
10
10
  private static pushWatcher;
11
11
  /**
12
- * 启动一个事件监听器
12
+ * 监听事件
13
13
  * @param eventName 事件名称 string|array
14
14
  * @param callback 事件触发的回调 function(eventName,eventParams){}
15
15
  */
16
16
  static on(eventName: any, callback: any): void;
17
17
  /**
18
- * 通知事件监听者
18
+ * 触发事件
19
19
  * @param eventName 事件名称 string|array
20
20
  * @param eventParams 携带参数 any
21
21
  */
@@ -1,4 +1,4 @@
1
- define(["require", "exports", "tslib", "lodash", "js-cookie"], function (require, exports, tslib_1, lodash_1, js_cookie_1) {
1
+ define(["require", "exports", "tslib", "lodash", "js-cookie", "./FastVueMultiObject"], function (require, exports, tslib_1, lodash_1, js_cookie_1, FastVueMultiObject_1) {
2
2
  "use strict";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.FastVueMultiEventBus = void 0;
@@ -71,12 +71,12 @@ define(["require", "exports", "tslib", "lodash", "js-cookie"], function (require
71
71
  }
72
72
  };
73
73
  /**
74
- * 启动一个事件监听器
74
+ * 监听事件
75
75
  * @param eventName 事件名称 string|array
76
76
  * @param callback 事件触发的回调 function(eventName,eventParams){}
77
77
  */
78
78
  FastVueMultiEventBus.on = function (eventName, callback) {
79
- if (!callback || lodash_1.default.isEmpty(eventName)) {
79
+ if (!callback || FastVueMultiObject_1.FastVueMultiObject.isNotValid(eventName)) {
80
80
  //未携带回调函数的监听者,认为是无效监听
81
81
  return;
82
82
  }
@@ -92,12 +92,12 @@ define(["require", "exports", "tslib", "lodash", "js-cookie"], function (require
92
92
  this.startTimer();
93
93
  };
94
94
  /**
95
- * 通知事件监听者
95
+ * 触发事件
96
96
  * @param eventName 事件名称 string|array
97
97
  * @param eventParams 携带参数 any
98
98
  */
99
99
  FastVueMultiEventBus.emit = function (eventName, eventParams) {
100
- if (lodash_1.default.isEmpty(eventName)) {
100
+ if (FastVueMultiObject_1.FastVueMultiObject.isNotValid(eventName)) {
101
101
  return;
102
102
  }
103
103
  if (lodash_1.default.isArray(eventName)) {
@@ -0,0 +1,12 @@
1
+ export declare class FastVueMultiObject {
2
+ /**
3
+ * 判断目标值是否无效,支持判断字符串、对象、数组等
4
+ * @param value
5
+ */
6
+ static isNotValid(value: any): boolean;
7
+ /**
8
+ * 判断目标值是否有效,支持判断字符串、对象、数组等
9
+ * @param value
10
+ */
11
+ static isValid(value: any): boolean;
12
+ }
@@ -0,0 +1,43 @@
1
+ define(["require", "exports", "tslib", "lodash"], function (require, exports, tslib_1, lodash_1) {
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.FastVueMultiObject = void 0;
5
+ lodash_1 = tslib_1.__importDefault(lodash_1);
6
+ var FastVueMultiObject = /** @class */ (function () {
7
+ function FastVueMultiObject() {
8
+ }
9
+ /**
10
+ * 判断目标值是否无效,支持判断字符串、对象、数组等
11
+ * @param value
12
+ */
13
+ FastVueMultiObject.isNotValid = function (value) {
14
+ return !this.isValid(value);
15
+ };
16
+ /**
17
+ * 判断目标值是否有效,支持判断字符串、对象、数组等
18
+ * @param value
19
+ */
20
+ FastVueMultiObject.isValid = function (value) {
21
+ if (lodash_1.default.isNull(value)) {
22
+ return false;
23
+ }
24
+ if (lodash_1.default.isUndefined(value)) {
25
+ return false;
26
+ }
27
+ if (lodash_1.default.isNil(value)) {
28
+ return false;
29
+ }
30
+ if (lodash_1.default.isNaN(value)) {
31
+ return false;
32
+ }
33
+ if (lodash_1.default.isString(value)) {
34
+ if (value.toString().length === 0) {
35
+ return false;
36
+ }
37
+ }
38
+ return true;
39
+ };
40
+ return FastVueMultiObject;
41
+ }());
42
+ exports.FastVueMultiObject = FastVueMultiObject;
43
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fast-vue-multi-pages",
3
- "version": "1.0.20",
3
+ "version": "1.0.21",
4
4
  "author": "janesen",
5
5
  "description": "快速搭建VUE项目工具类的基本库,主要用于每个功能页面独立生成html",
6
6
  "main": "./dist/cjs/index.js",