@lingxiteam/ebe-utils 0.2.34 → 0.2.35

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.
@@ -139,7 +139,7 @@
139
139
  resolved "https://registry.npmmirror.com/@ant-design/icons-svg/-/icons-svg-4.4.2.tgz#ed2be7fb4d82ac7e1d45a54a5b06d6cecf8be6f6"
140
140
  integrity sha512-vHbT+zJEVzllwP+CM+ul7reTEfBR0vgxFe7+lREAsAA7YGsYpboiq2sQNeQeRvh09GfQgs/GyFEvZpJ9cLXpXA==
141
141
 
142
- "@ant-design/icons@^4.0.0", "@ant-design/icons@^4.2.2", "@ant-design/icons@^4.7.0":
142
+ "@ant-design/icons@^4.2.2", "@ant-design/icons@^4.7.0":
143
143
  version "4.8.3"
144
144
  resolved "https://registry.npmmirror.com/@ant-design/icons/-/icons-4.8.3.tgz#41555408ed5e9b0c3d53f3f24fe6a73abfcf4000"
145
145
  integrity sha512-HGlIQZzrEbAhpJR6+IGdzfbPym94Owr6JZkJ2QCCnOkPVIWMO2xgIVcOKnl8YcpijIo39V7l2qQL5fmtw56cMw==
@@ -1449,20 +1449,19 @@
1449
1449
  resolved "https://registry.npmmirror.com/@lingxiteam/editor-types/-/editor-types-3.7.1.tgz#d6bb18884fa5ef68e636cffa74ac0b6af71e91bf"
1450
1450
  integrity sha512-I3u3XqcC74k9ecCcaJy5j7tQolCNfNRjBjc8wl6eZVY5YlZOSOApOG2pTgdF0yHNBYYcM0BMpexrjhZp4FVNAQ==
1451
1451
 
1452
- "@lingxiteam/icons@0.0.3":
1453
- version "0.0.3"
1454
- resolved "https://registry.npmmirror.com/@lingxiteam/icons/-/icons-0.0.3.tgz#5948d8ace7f666fc64b410133cf4261b473fa694"
1455
- integrity sha512-w1t3LCBH4mKYK6dxpuVtY8qmQjXgO9Jgqg1x+H83AMfgMJ2qauM0M0O8Iwe5liBsyVMJtCNM0A7JJ2Cv/Pvppw==
1452
+ "@lingxiteam/icons@^4.3.1-alhpa.2":
1453
+ version "4.3.1-alhpa.2"
1454
+ resolved "https://registry.npmmirror.com/@lingxiteam/icons/-/icons-4.3.1-alhpa.2.tgz#80f74d8ab6d8bab734a67dd5b41b4bd269fa1139"
1455
+ integrity sha512-4wbfqGxXDV3BUdSqm5sFPYcuEIDtP5+9VBNVhJ5TPFpjcLsf3Dwnh4P7thXFu+3bSZVaXffGHQGzvWrgLeILsQ==
1456
1456
  dependencies:
1457
- "@ant-design/icons" "^4.0.0"
1458
- lodash.camelcase "4.3.0"
1459
- lodash.upperfirst "4.3.1"
1460
- rc-util "4.10.0"
1457
+ "@ant-design/icons" "^4.7.0"
1458
+ "@babel/runtime" "7.23.2"
1459
+ rc-util "^4.10.0"
1461
1460
 
1462
- "@lingxiteam/lcdp-ueditor-react@^1.0.0-alpha.19":
1463
- version "1.0.2"
1464
- resolved "https://registry.npmmirror.com/@lingxiteam/lcdp-ueditor-react/-/lcdp-ueditor-react-1.0.2.tgz#2a4c84b6f1d94fcd71157cc9b73b4064a3d38495"
1465
- integrity sha512-W2IXgQPqeieQWontO9Q93YlhlGWfwOLf5XpDFbYRHMYT+ziNfmZ+cqCCflw/DlHBZDaD3MOjEO006ayOXrx0ww==
1461
+ "@lingxiteam/lcdp-ueditor-react@1.0.3-alpha.6":
1462
+ version "1.0.3-alpha.6"
1463
+ resolved "https://registry.npmmirror.com/@lingxiteam/lcdp-ueditor-react/-/lcdp-ueditor-react-1.0.3-alpha.6.tgz#10419b1098449ffef6a5b5c1e6451514060a8b8c"
1464
+ integrity sha512-dPbL/IMcpElQEQNnW3ksd8+0NfHuPd7cRl9TxWdeV9k6cx+Hr667WKO3EWOVKogYP1ZKUqaqu8FF99b1ll7ADQ==
1466
1465
  dependencies:
1467
1466
  "@babel/runtime" "7.23.2"
1468
1467
 
@@ -1480,6 +1479,16 @@
1480
1479
  "@toast-ui/editor" "^3.2.2"
1481
1480
  react-color "^2.19.3"
1482
1481
 
1482
+ "@lingxiteam/security@>= 1":
1483
+ version "1.2.6"
1484
+ resolved "https://registry.npmmirror.com/@lingxiteam/security/-/security-1.2.6.tgz#75da514a79fbff58c5977786482330d8b8ed9c49"
1485
+ integrity sha512-92aRqkDFTMiSmB4cNypOFvzdy3+BcPZzoA0tYSWpJu7UIpVRkDrpXV4yq7MQsu03iMLbLRg3Chio7QQ+e2gyYg==
1486
+ dependencies:
1487
+ crypto-js "^4.2.0"
1488
+ jsencrypt "^3.3.2"
1489
+ merge "^2.1.1"
1490
+ uuid "^9.0.1"
1491
+
1483
1492
  "@lingxiteam/types@3.3.1-alpha.14":
1484
1493
  version "3.3.1-alpha.14"
1485
1494
  resolved "https://registry.npmmirror.com/@lingxiteam/types/-/types-3.3.1-alpha.14.tgz#fda8ebc1c121fff4b1fdb3245cf202290d82380c"
@@ -7222,40 +7231,11 @@ lodash-es@^4.17.15, lodash-es@^4.17.21:
7222
7231
  resolved "https://registry.npmmirror.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
7223
7232
  integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==
7224
7233
 
7225
- lodash._getnative@^3.0.0:
7226
- version "3.9.1"
7227
- resolved "https://registry.npmmirror.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5"
7228
- integrity sha512-RrL9VxMEPyDMHOd9uFbvMe8X55X16/cGM5IgOKgRElQZutpX89iS6vwl64duTV1/16w5JY7tuFNXqoekmh1EmA==
7229
-
7230
- lodash.camelcase@4.3.0:
7231
- version "4.3.0"
7232
- resolved "https://registry.npmmirror.com/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz#b28aa6288a2b9fc651035c7711f65ab6190331a6"
7233
- integrity sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==
7234
-
7235
7234
  lodash.debounce@^4.0.8:
7236
7235
  version "4.0.8"
7237
7236
  resolved "https://registry.npmmirror.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af"
7238
7237
  integrity sha512-FT1yDzDYEoYWhnSGnpE/4Kj1fLZkDFyqRb7fNt6FdYOSxlUWAtp42Eh6Wb0rGIv/m9Bgo7x4GhQbm5Ys4SG5ow==
7239
7238
 
7240
- lodash.isarguments@^3.0.0:
7241
- version "3.1.0"
7242
- resolved "https://registry.npmmirror.com/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz#2f573d85c6a24289ff00663b491c1d338ff3458a"
7243
- integrity sha512-chi4NHZlZqZD18a0imDHnZPrDeBbTtVN7GXMwuGdRH9qotxAjYs3aVLKc7zNOG9eddR5Ksd8rvFEBc9SsggPpg==
7244
-
7245
- lodash.isarray@^3.0.0:
7246
- version "3.0.4"
7247
- resolved "https://registry.npmmirror.com/lodash.isarray/-/lodash.isarray-3.0.4.tgz#79e4eb88c36a8122af86f844aa9bcd851b5fbb55"
7248
- integrity sha512-JwObCrNJuT0Nnbuecmqr5DgtuBppuCvGD9lxjFpAzwnVtdGoDQ1zig+5W8k5/6Gcn0gZ3936HDAlGd28i7sOGQ==
7249
-
7250
- lodash.keys@^3.1.2:
7251
- version "3.1.2"
7252
- resolved "https://registry.npmmirror.com/lodash.keys/-/lodash.keys-3.1.2.tgz#4dbc0472b156be50a0b286855d1bd0b0c656098a"
7253
- integrity sha512-CuBsapFjcubOGMn3VD+24HOAPxM79tH+V6ivJL3CHYjtrawauDJHUk//Yew9Hvc6e9rbCrURGk8z6PC+8WJBfQ==
7254
- dependencies:
7255
- lodash._getnative "^3.0.0"
7256
- lodash.isarguments "^3.0.0"
7257
- lodash.isarray "^3.0.0"
7258
-
7259
7239
  lodash.merge@^4.6.2:
7260
7240
  version "4.6.2"
7261
7241
  resolved "https://registry.npmmirror.com/lodash.merge/-/lodash.merge-4.6.2.tgz#558aa53b43b661e1925a0afdfa36a9a1085fe57a"
@@ -7271,11 +7251,6 @@ lodash.tonumber@^4.0.3:
7271
7251
  resolved "https://registry.npmmirror.com/lodash.tonumber/-/lodash.tonumber-4.0.3.tgz#0b96b31b35672793eb7f5a63ee791f1b9e9025d9"
7272
7252
  integrity sha512-SY0SwuPOHRwKcCNTdsntPYb+Zddz5mDUIVFABzRMqmAiL41pMeyoQFGxYAw5zdc9NnH4pbJqiqqp5ckfxa+zSA==
7273
7253
 
7274
- lodash.upperfirst@4.3.1:
7275
- version "4.3.1"
7276
- resolved "https://registry.npmmirror.com/lodash.upperfirst/-/lodash.upperfirst-4.3.1.tgz#1365edf431480481ef0d1c68957a5ed99d49f7ce"
7277
- integrity sha512-sReKOYJIJf74dhJONhU4e0/shzi1trVbSWDOhKYE5XV2O+H7Sb2Dihwuc7xWxVl+DgFPyTqIN3zMfT9cq5iWDg==
7278
-
7279
7254
  lodash@^4.0.1, lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.15, lodash@^4.17.20, lodash@^4.17.21, lodash@^4.17.4:
7280
7255
  version "4.17.21"
7281
7256
  resolved "https://registry.npmmirror.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
@@ -9433,19 +9408,7 @@ rc-upload@~4.3.0:
9433
9408
  classnames "^2.2.5"
9434
9409
  rc-util "^5.2.0"
9435
9410
 
9436
- rc-util@4.10.0:
9437
- version "4.10.0"
9438
- resolved "https://registry.npmmirror.com/rc-util/-/rc-util-4.10.0.tgz#25da93c78f996a23998c76922f75d54387c9e9fc"
9439
- integrity sha512-bDjf3Yx4rs/777G3TQ3J2Ii8AeEa/z8duR8efBQKH+ShuumtCvWiRA0/iAL2WZNdG3U1z+EIbocNNdcUpsPT7Q==
9440
- dependencies:
9441
- add-dom-event-listener "^1.1.0"
9442
- babel-runtime "6.x"
9443
- prop-types "^15.5.10"
9444
- react-lifecycles-compat "^3.0.4"
9445
- shallowequal "^0.2.2"
9446
- warning "^4.0.3"
9447
-
9448
- rc-util@4.x, rc-util@^4.0.4, rc-util@^4.15.3, rc-util@^4.19.0, rc-util@^4.4.0:
9411
+ rc-util@4.x, rc-util@^4.0.4, rc-util@^4.10.0, rc-util@^4.15.3, rc-util@^4.19.0, rc-util@^4.4.0:
9449
9412
  version "4.21.1"
9450
9413
  resolved "https://registry.npmmirror.com/rc-util/-/rc-util-4.21.1.tgz#88602d0c3185020aa1053d9a1e70eac161becb05"
9451
9414
  integrity sha512-Z+vlkSQVc1l8O2UjR3WQ+XdWlhj5q9BMQNLk2iOBch75CqPfrJyGtcWMcnhRlNuDu0Ndtt4kLVO8JI8BrABobg==
@@ -10380,13 +10343,6 @@ shallow-equal@^1.2.1:
10380
10343
  resolved "https://registry.npmmirror.com/shallow-equal/-/shallow-equal-1.2.1.tgz#4c16abfa56043aa20d050324efa68940b0da79da"
10381
10344
  integrity sha512-S4vJDjHHMBaiZuT9NPb616CSmLf618jawtv3sufLl6ivK8WocjAo58cXwbRV1cgqxH0Qbv+iUt6m05eqEa2IRA==
10382
10345
 
10383
- shallowequal@^0.2.2:
10384
- version "0.2.2"
10385
- resolved "https://registry.npmmirror.com/shallowequal/-/shallowequal-0.2.2.tgz#1e32fd5bcab6ad688a4812cb0cc04efc75c7014e"
10386
- integrity sha512-ePvPM7jqd9KrZdgSTN4bECWxeRcu+ysyZlSx8gPcDaYElHrDm7+1l5Q3QLbMm6t/7ejhS9U1ffGXybXs2j+qGw==
10387
- dependencies:
10388
- lodash.keys "^3.1.2"
10389
-
10390
10346
  shallowequal@^1.0.1, shallowequal@^1.1.0:
10391
10347
  version "1.1.0"
10392
10348
  resolved "https://registry.npmmirror.com/shallowequal/-/shallowequal-1.1.0.tgz#188d521de95b9087404fd4dcb68b13df0ae4e7f8"
@@ -1,7 +1,5 @@
1
- import security from '../Security';
2
1
  import { FunctorDefine } from './types';
3
-
4
- const defaultAESKey = 'd86d7bab3d6ac01a';
2
+ import security, { aesKey } from '@lingxiteam/security';
5
3
 
6
4
  export const AES_DECRYPT = FunctorDefine({
7
5
  label: '内容解密',
@@ -11,7 +9,7 @@ export const AES_DECRYPT = FunctorDefine({
11
9
  if ([null, undefined, ''].includes(x as any)) {
12
10
  return '';
13
11
  }
14
- return security.AESDecrypt(x, security.KEYS.aesKey || defaultAESKey);
12
+ return security.AESDecrypt(x, aesKey);
15
13
  },
16
14
  define: ['将内容进行AES方式解密'],
17
15
  description: {
@@ -1,7 +1,5 @@
1
- import security from '../Security';
2
1
  import { FunctorDefine } from './types';
3
-
4
- const defaultAESKey = 'd86d7bab3d6ac01a';
2
+ import security, { aesKey } from '@lingxiteam/security';
5
3
 
6
4
  export const AES_ENCRYPT = FunctorDefine({
7
5
  label: '内容加密',
@@ -11,7 +9,7 @@ export const AES_ENCRYPT = FunctorDefine({
11
9
  if ([null, undefined, ''].includes(x as any)) {
12
10
  return '';
13
11
  }
14
- return security.AESEncrypt(x, security.KEYS.aesKey || defaultAESKey);
12
+ return security.AESEncrypt(x, aesKey);
15
13
  },
16
14
  define: ['将内容进行AES方式加密'],
17
15
  description: {
@@ -5,7 +5,7 @@ import { FunctorDefine } from './types';
5
5
  type DataMaskType = 'mobile' | 'email' | 'ID' | 'phone' | 'default' | 'service';
6
6
 
7
7
  if (!String.prototype.repeat) {
8
- String.prototype.repeat = function (count) {
8
+ String.prototype.repeat = function(count) {
9
9
  if (this == null) {
10
10
  throw new TypeError(`can't convert ${this} to object`);
11
11
  }
@@ -107,7 +107,10 @@ export const DATAMASK = FunctorDefine({
107
107
  type: 'DATAMASK',
108
108
  value: "DATAMASK('88888888@test.com', 'email')",
109
109
  functor: processDataMaskValue,
110
- define: ['对敏感信息进行脱敏', 'email: 邮件脱敏,phone: 手机脱敏,ID: 身份证脱敏,common: 通用'],
110
+ define: [
111
+ '对敏感信息进行脱敏',
112
+ 'email: 邮件脱敏,phone: 手机脱敏,ID: 身份证脱敏,common: 通用',
113
+ ],
111
114
  description: {
112
115
  tips: [],
113
116
  title: '(文本)',
@@ -1,32 +1,29 @@
1
- import type { ManipulateType } from 'dayjs';
2
- import dayjs from 'dayjs';
3
1
  import { FunctorDefine } from './types';
2
+ import dayjs from 'dayjs';
3
+ import { isFullTimeFormat } from './utils/tools';
4
+
4
5
 
5
- export const DATEADD = FunctorDefine({
6
- label: '为日期加减时间',
7
- type: 'DATEADD',
8
- value: "DATEADD('2008-11-11 12:23','+8h','YYYY-MM-DD hh:mm')",
9
- functor: (date: string | Date, unitDis: string, formatter?: string): Date | string => {
10
- const day = dayjs(date);
11
- const unitLen = unitDis.length;
12
- const unit = unitDis.charAt(unitLen - 1) as ManipulateType;
13
- const resultDate = day.add(parseFloat(unitDis), unit);
14
- if (!formatter) {
15
- return resultDate.toDate();
16
- }
17
- return resultDate.format(formatter);
6
+ export const dateAdd = FunctorDefine({
7
+ label: '获取当前时间往后N天',
8
+ type: 'dateAdd',
9
+ value: "dateAdd('当前日期','天数')",
10
+ functor: (date: string, days: number): string => {
11
+ const formatType = isFullTimeFormat(date) ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD';
12
+ return dayjs(date).add(days, 'day').format(formatType);
18
13
  },
19
- define: ['对某个日期(时间)添加/减去一定时间段,再对计算结果设置格式'],
14
+ define: ['在“当前日期”的基础上,往后累加“N天”。'],
20
15
  description: {
21
16
  tips: [
22
- "· 计算式:'+'或'-'代表添加或减去;时间段的单位,'y'代表年、'M'代表月、'd'代表天、'h'代表小时、'm'代表分钟、's'代表秒",
23
- '· [输出格式]:YYYY-MM-DD;如果不指定这个参数,则默认是Date类型',
17
+ '“当前日期”为时间值,字符串类型,需满足YYYY-MM-DD、YYYY-MM-DD HH:mm:ss格式,“天数”为字符串类型,需输入数字。',
18
+ '字符串类型,返回值与输入的时间格式相同。',
24
19
  ],
25
- title: '(初始日期,计算式,[输出格式])',
20
+ title: '(当前日期,天数)',
26
21
  },
27
22
  example: {
28
- tips: [],
29
- title: "('2008-11-11 12:23','+8h','YYYY-MM-DD hh:mm') ,结果:2008-11-11 20:23",
23
+ title: '(\'2022-12-12\',\'7\'),结果:\'2022-12-19\'',
24
+ tips: [
25
+ '在“2022-12-12”的基础上累加7天,则为2022-12-19。',
26
+ ],
30
27
  },
31
28
  groupsName: ['日期函数', '常用函数'],
32
29
  });
@@ -1,5 +1,5 @@
1
- import dayjs from 'dayjs';
2
1
  import { FunctorDefine } from './types';
2
+ import dayjs from 'dayjs';
3
3
  import { getGreenText } from './utils/tools';
4
4
 
5
5
  export const DATENOW = FunctorDefine({
@@ -14,7 +14,7 @@ export const IF = FunctorDefine({
14
14
  },
15
15
  example: {
16
16
  tips: ['如果分数大于等于60分,则记为及格,否则记为不及格'],
17
- title: "(分数>=60,'及格','不及格'),结果:'及格'",
17
+ title: '(分数>=60,\'及格\',\'不及格\'),结果:\'及格\'',
18
18
  },
19
19
  groupsName: '常用函数',
20
20
  });
@@ -1,6 +1,7 @@
1
1
  import { FunctorDefine } from './types';
2
2
  import { getGreenText, includes } from './utils/tools';
3
3
 
4
+
4
5
  export const NUMBER = FunctorDefine({
5
6
  label: '强制转为数值',
6
7
  type: 'NUMBER',
@@ -17,7 +18,7 @@ export const NUMBER = FunctorDefine({
17
18
  title: '(文本)',
18
19
  },
19
20
  example: {
20
- tips: ["将 '-1' 和 5 相加(if输出的结果类型固定为文本)"],
21
+ tips: ['\'-1\' 和 5 相加(if输出的结果类型固定为文本)'],
21
22
  title: `(${getGreenText('IF')}(${getGreenText('TRUE')}(),'-1','0'))+5,结果:4`,
22
23
  },
23
24
  groupsName: '数学函数',
@@ -9,7 +9,7 @@ export const ROUND = FunctorDefine({
9
9
  if (includes([x, digits], [null, undefined, ''])) {
10
10
  return undefined;
11
11
  }
12
- return Math.round(x * 10 ** digits) / 10 ** digits;
12
+ return Math.round(x * (10 ** digits)) / (10 ** digits);
13
13
  },
14
14
  define: ['按指定位数对数字进行四舍五入'],
15
15
  description: {
@@ -9,7 +9,7 @@ export const ROUNDDOWN = FunctorDefine({
9
9
  if (includes([x, digits], [null, undefined, ''])) {
10
10
  return undefined;
11
11
  }
12
- return Math.floor(x * 10 ** digits) / 10 ** digits;
12
+ return Math.floor(x * (10 ** digits)) / (10 ** digits);
13
13
  },
14
14
  define: ['以绝对值减小的方向按指定位数舍入数字'],
15
15
  description: {
@@ -0,0 +1,32 @@
1
+ import { FunctorDefine } from './types';
2
+ import type { ManipulateType } from 'dayjs';
3
+ import dayjs from 'dayjs';
4
+
5
+ export const DATEADD = FunctorDefine({
6
+ label: '为日期加减时间',
7
+ type: 'DATEADD',
8
+ value: "DATEADD('2008-11-11 12:23','+8h','YYYY-MM-DD hh:mm')",
9
+ functor: (date: string | Date, unitDis: string, formatter?: string): Date | string => {
10
+ const day = dayjs(date);
11
+ const unitLen = unitDis.length;
12
+ const unit = unitDis.charAt(unitLen - 1) as ManipulateType;
13
+ const resultDate = day.add(parseFloat(unitDis), unit);
14
+ if (!formatter) {
15
+ return resultDate.toDate();
16
+ }
17
+ return resultDate.format(formatter);
18
+ },
19
+ define: ['对某个日期(时间)添加/减去一定时间段,再对计算结果设置格式'],
20
+ description: {
21
+ tips: [
22
+ '· 计算式:\'+\'或\'-\'代表添加或减去;时间段的单位,\'y\'代表年、\'M\'代表月、\'d\'代表天、\'h\'代表小时、\'m\'代表分钟、\'s\'代表秒',
23
+ '· [输出格式]:YYYY-MM-DD;如果不指定这个参数,则默认是Date类型',
24
+ ],
25
+ title: '(初始日期,计算式,[输出格式])',
26
+ },
27
+ example: {
28
+ tips: [],
29
+ title: '(\'2008-11-11 12:23\',\'+8h\',\'YYYY-MM-DD hh:mm\') ,结果:2008-11-11 20:23',
30
+ },
31
+ groupsName: ['日期函数', '常用函数'],
32
+ });
@@ -0,0 +1,25 @@
1
+ import { FunctorDefine } from './types';
2
+
3
+ export const concatString = FunctorDefine({
4
+ label: '字符串拼接',
5
+ type: 'concatString',
6
+ value: "concatString('参数1','参数2', '参数3', ...参数)",
7
+ functor: (...restStr): string => {
8
+ return restStr.length > 0 ? restStr.join('') : '';
9
+ },
10
+ define: ['“参数1”减去“参数2”的差值,已这几种测量单位衡量。例如:年、月、周、日、小时、分钟、秒。'],
11
+ description: {
12
+ tips: [
13
+ '有多少个参数要拼接,则传入多少个',
14
+ '返回拼接后的字符串',
15
+ ],
16
+ title: "('参数1','参数2', '参数3', ...参数)",
17
+ },
18
+ example: {
19
+ title: '(\'张三\',\'25\',\'岁\'),结果:\'张三25岁\'',
20
+ tips: [
21
+ '如果参数有“整数”类型,会自动转为“字符”类型。',
22
+ ],
23
+ },
24
+ groupsName: '常用函数',
25
+ });
@@ -0,0 +1,27 @@
1
+ import { FunctorDefine } from './types';
2
+ import dayjs from 'dayjs';
3
+
4
+
5
+ export const dateDiff = FunctorDefine({
6
+ label: '计算时间差',
7
+ type: 'dateDiff',
8
+ value: "dateDiff('参数1','参数2','差值单位')",
9
+ functor: (dateStart: string, dateEnd: string, unit: 'seconds' | 'minutes' | 'hours' | 'days' | 'weeks' |'months' | 'years'): number => {
10
+ return dayjs(dateStart).diff(dateEnd, unit);
11
+ },
12
+ define: ['“参数1”减去“参数2”的差值,已这几种测量单位衡量。例如:年、月、周、日、小时、分钟、秒。'],
13
+ description: {
14
+ tips: [
15
+ '“参数1”、“参数2”,都为时间值,需满足YYYY-MM-DD格式,第三个参数为最终的结果单位有: years(年)、months(月)、weeks(周)、days(日)、hours(小时)、minutes(分钟) 和 seconds(秒)。',
16
+ '整数类型,可能是正数,可能是负数。',
17
+ ],
18
+ title: '(开始时间,结束时间,差值单位)',
19
+ },
20
+ example: {
21
+ title: '(\'2022-12-12\',\'2024-12-12\',\'days\'),结果:\'-731\'',
22
+ tips: [
23
+ '若仅想取差值,不关心正数负数,可对最终结果,再使用绝对值函数,例如:Math.abs(diff(\'2022-12-12\',\'2024-12-12\',\'days\'))。',
24
+ ],
25
+ },
26
+ groupsName: ['日期函数', '常用函数'],
27
+ });
@@ -0,0 +1,26 @@
1
+ import { FunctorDefine } from './types';
2
+ import dayjs from 'dayjs';
3
+
4
+
5
+ export const dateFormatCurrent = FunctorDefine({
6
+ label: '字符串拼接',
7
+ type: 'dateFormatCurrent',
8
+ value: "dateFormatCurrent('时间格式')",
9
+ functor: (format: string): string => {
10
+ return dayjs().format(format);
11
+ },
12
+ define: ['获取当前时间,按照指定时间格式返回。'],
13
+ description: {
14
+ tips: [
15
+ '“时间格式”为字符串类型,代表时间格式,格式可以是以年:YY、月:MM、日:DD、时:HH、分:mm、秒:ss的任意组合,例如:YYYY-MM-DD、YYYY-MM-DD HH:mm:ss、YYYY年MM月DD日、MM/DD/YYYY(月/日/年)。',
16
+ '字符串类型,按照指定时间格式返回。',
17
+ ],
18
+ title: "('时间格式')",
19
+ },
20
+ example: {
21
+ title: '(\'MM/DD/YYYY(月/日/年)\'),结果:\'10/11/2024(月/日/年)\'',
22
+ tips: [
23
+ '若当前时间为“2024-10-11”日,那么结果即为\'10/11/2024(月/日/年)\''],
24
+ },
25
+ groupsName: '常用函数',
26
+ });
@@ -0,0 +1,29 @@
1
+ import { FunctorDefine } from './types';
2
+ import dayjs from 'dayjs';
3
+ import { isFullTimeFormat } from './utils/tools';
4
+
5
+
6
+ export const dateSubtract = FunctorDefine({
7
+ label: '获取当前时间往前N天',
8
+ type: 'dateSubtract',
9
+ value: "dateSubtract('当前日期','天数')",
10
+ functor: (date: string, days: number): string => {
11
+ const formatType = isFullTimeFormat(date) ? 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD';
12
+ return dayjs(date).subtract(days, 'day').format(formatType);
13
+ },
14
+ define: ['在“当前日期”的基础上,往前逆推“N天”。'],
15
+ description: {
16
+ tips: [
17
+ '“当前日期”为时间值,字符串类型,需满足YYYY-MM-DD、YYYY-MM-DD HH:mm:ss格式,“天数”为字符串类型,需输入数字。',
18
+ '字符串类型,返回值与输入的时间格式相同。',
19
+ ],
20
+ title: '(当前日期,天数)',
21
+ },
22
+ example: {
23
+ title: '(\'2022-12-12\',\'7\'),结果:\'2022-12-05\'',
24
+ tips: [
25
+ '在“2022-12-12”的基础上减掉7天,则为2022-12-05。',
26
+ ],
27
+ },
28
+ groupsName: ['日期函数', '常用函数'],
29
+ });
@@ -1,32 +1,16 @@
1
- export { ABS } from './ABS';
2
- export { AES_DECRYPT } from './AESDECRYPT';
3
- export { AES_ENCRYPT } from './AESENCRYPT';
4
- export { ARRAYINDEX } from './ARRAYINDEX';
5
- export { ARRAYTOSTR } from './ARRAYTOSTR';
6
- export { AVERAGE } from './AVERAGE';
7
- export { CONCAT } from './CONCAT';
8
- export { COUNTA } from './COUNTA';
9
- export { COUNTARRAY } from './COUNTARRAY';
10
- export { COUNTBLANK } from './COUNTBLANK';
11
- export { COUNTCHAR } from './COUNTCHAR';
12
- export { DATAMASK } from './DATAMASK';
13
- export { DATEADD } from './DATEADD';
14
- export { DATENOW } from './DATENOW';
15
- export { DATETIME } from './DATETIME';
16
- export { IF } from './IF';
17
- export { INT } from './INT';
18
- export { LOG } from './LOG';
19
- export { MAX } from './MAX';
20
- export { MIN } from './MIN';
21
- export { MOD } from './MOD';
22
- export { NUMBER } from './NUMBER';
23
- export { OBJECTVALUE } from './OBJECTVALUE';
24
- export { POWER } from './POWER';
25
- export { PRODUCT } from './PRODUCT';
26
- export { RANDBETWEEN } from './RANDBETWEEN';
27
- export { RANDOMNUM } from './RANDOMNUM';
28
- export { ROUND } from './ROUND';
29
- export { ROUNDDOWN } from './ROUNDDOWN';
30
- export { ROUNDUP } from './ROUNDUP';
31
- export { STRTOARRAY } from './STRTOARRAY';
32
- export { SUM } from './SUM';
1
+ import registerFns, { isBrowser } from './utils/register.functor';
2
+ import { version } from './utils/VERSION';
3
+
4
+ export * from './utils/export';
5
+ export * from './types';
6
+
7
+ const globalThis = isBrowser() ? window : global;
8
+
9
+ // @ts-ignore
10
+ globalThis.LXFunctors = {
11
+ version,
12
+ };
13
+
14
+ export { getNormalFunc, getPresetFunctorsList } from './utils/normal.func';
15
+
16
+ export default registerFns;
@@ -22,7 +22,10 @@ export type FunctorDefineReturn = Omit<FunctorDefineParams, 'functor'> & Functor
22
22
 
23
23
  export type FunctorDefineFn = (params: FunctorDefineParams) => FunctorDefineReturn;
24
24
 
25
- export const FunctorDefine: FunctorDefineFn = ({ functor, ...restProps }) => {
25
+ export const FunctorDefine: FunctorDefineFn = ({
26
+ functor,
27
+ ...restProps
28
+ }) => {
26
29
  const fn = functor as unknown as FunctorDefineReturn;
27
30
  Object.assign(fn, restProps);
28
31
  return fn;
@@ -0,0 +1,2 @@
1
+ // @ts-ignore
2
+ export const version = '0.4.3';
@@ -0,0 +1,117 @@
1
+ import { IF } from '../IF';
2
+ import { CONCAT } from '../CONCAT';
3
+ import { AVERAGE } from '../AVERAGE';
4
+ import { SUM } from '../SUM';
5
+ import { MIN } from '../MIN';
6
+ import { MAX } from '../MAX';
7
+ import { PRODUCT } from '../PRODUCT';
8
+ import { COUNTA } from '../COUNTA';
9
+ import { ABS } from '../ABS';
10
+ import { INT } from '../INT';
11
+ import { MOD } from '../MOD';
12
+ import { ROUND } from '../ROUND';
13
+ import { ROUNDUP } from '../ROUNDUP';
14
+ import { ROUNDDOWN } from '../ROUNDDOWN';
15
+ import { POWER } from '../POWER';
16
+ import { LOG } from '../LOG';
17
+ import { COUNTBLANK } from '../COUNTBLANK';
18
+ import { COUNTARRAY } from '../COUNTARRAY';
19
+ import { COUNTCHAR } from '../COUNTCHAR';
20
+ import { RANDBETWEEN } from '../RANDBETWEEN';
21
+ import { NUMBER } from '../NUMBER';
22
+ import { DATEADD } from '../_DATEADD';
23
+ import { DATENOW } from '../DATENOW';
24
+ import { ARRAYINDEX } from '../ARRAYINDEX';
25
+ import { OBJECTVALUE } from '../OBJECTVALUE';
26
+ import { ARRAYTOSTR } from '../ARRAYTOSTR';
27
+ import { STRTOARRAY } from '../STRTOARRAY';
28
+ import { DATETIME } from '../DATETIME';
29
+ import { RANDOMNUM } from '../RANDOMNUM';
30
+ import { AES_ENCRYPT } from '../AESENCRYPT';
31
+ import { AES_DECRYPT } from '../AESDECRYPT';
32
+ import { DATAMASK } from '../DATAMASK';
33
+ import { dateAdd } from '../dateAdd';
34
+ import { dateSubtract } from '../dateSubtract';
35
+ import { dateDiff } from '../dateDiff';
36
+ import { concatString } from '../concatString';
37
+ import { dateFormatCurrent } from '../dateFormatCurrent';
38
+
39
+ export {
40
+ IF,
41
+ CONCAT,
42
+ AVERAGE,
43
+ SUM,
44
+ MIN,
45
+ MAX,
46
+ PRODUCT,
47
+ COUNTA,
48
+ ABS,
49
+ INT,
50
+ MOD,
51
+ ROUND,
52
+ ROUNDUP,
53
+ ROUNDDOWN,
54
+ POWER,
55
+ LOG,
56
+ COUNTBLANK,
57
+ COUNTARRAY,
58
+ COUNTCHAR,
59
+ RANDBETWEEN,
60
+ NUMBER,
61
+ DATEADD,
62
+ DATENOW,
63
+ ARRAYINDEX,
64
+ OBJECTVALUE,
65
+ ARRAYTOSTR,
66
+ STRTOARRAY,
67
+ DATETIME,
68
+ RANDOMNUM,
69
+ AES_ENCRYPT,
70
+ AES_DECRYPT,
71
+ DATAMASK,
72
+ dateAdd,
73
+ dateSubtract,
74
+ dateDiff,
75
+ concatString,
76
+ dateFormatCurrent,
77
+ };
78
+
79
+ export default {
80
+ IF,
81
+ CONCAT,
82
+ AVERAGE,
83
+ SUM,
84
+ MIN,
85
+ MAX,
86
+ PRODUCT,
87
+ COUNTA,
88
+ ABS,
89
+ INT,
90
+ MOD,
91
+ ROUND,
92
+ ROUNDUP,
93
+ ROUNDDOWN,
94
+ POWER,
95
+ LOG,
96
+ COUNTBLANK,
97
+ COUNTARRAY,
98
+ COUNTCHAR,
99
+ RANDBETWEEN,
100
+ NUMBER,
101
+ DATEADD,
102
+ DATENOW,
103
+ ARRAYINDEX,
104
+ OBJECTVALUE,
105
+ ARRAYTOSTR,
106
+ STRTOARRAY,
107
+ DATETIME,
108
+ RANDOMNUM,
109
+ AES_ENCRYPT,
110
+ AES_DECRYPT,
111
+ DATAMASK,
112
+ dateAdd,
113
+ dateSubtract,
114
+ dateDiff,
115
+ concatString,
116
+ dateFormatCurrent,
117
+ };
@@ -0,0 +1,339 @@
1
+ import _ from 'lodash';
2
+ import dayjs from 'dayjs';
3
+ import relativeTime from 'dayjs/plugin/relativeTime';
4
+ import calendar from 'dayjs/plugin/calendar';
5
+ import FunctorsMap from './export';
6
+
7
+ dayjs.extend(relativeTime);
8
+ dayjs.extend(calendar);
9
+
10
+
11
+ /**
12
+ * 通用函数列表
13
+ * @param INFC
14
+ * @returns
15
+ */
16
+ export const getNormalFunc = (INFC: string = 'INFC') => {
17
+ const funcList = [
18
+ {
19
+ value: 'normal',
20
+ title: '常用函数',
21
+ children: [
22
+ {
23
+ value: 'map',
24
+ title: 'map (对象数组转简单数组)',
25
+ code: `${INFC}.map(_.filter([{ key: '1', value: 'barney'},{ key: '2', value: 'fred'}], {key: '2'}), 'value')`,
26
+ implementation: _.map,
27
+ },
28
+ {
29
+ value: 'filter',
30
+ title: 'filter (遍历数组提取命中值返回数组)',
31
+ code: `${INFC}.filter([{ key: '1', value: 'barney'},{ key: '2', value: 'fred'}], { key: '1', value: 'barney'})`,
32
+ implementation: _.filter,
33
+ },
34
+ {
35
+ value: 'find',
36
+ title: 'find (遍历数组提取命中值返回对象)',
37
+ code: `${INFC}.find([{ key: '1', value: 'barney'},{ key: '2', value: 'fred'}], { key: '1', value: 'barney'})`,
38
+ implementation: _.find,
39
+ },
40
+ {
41
+ value: 'join',
42
+ title: 'join (数组转字符串)',
43
+ code: `${INFC}.join(['a', 'b', 'c'], '~')`,
44
+ implementation: _.join,
45
+ },
46
+ {
47
+ value: 'stringify',
48
+ title: 'stringify (对象转字符串)',
49
+ code: "JSON.stringify({ key: 'fred', value: '1' })",
50
+ implementation: JSON.stringify,
51
+ },
52
+ {
53
+ value: 'parse',
54
+ title: 'parse (字符串转对象)',
55
+ code: 'JSON.parse(\'{"key":"fred","value":"1"}\')',
56
+ implementation: JSON.parse,
57
+ },
58
+ {
59
+ value: 'assign',
60
+ title: 'assign (对象重命名)',
61
+ code: `${INFC}.assign({ key: 'fred', value: '1' }, {value: '2'})`,
62
+ implementation: _.assign,
63
+ },
64
+ {
65
+ value: 'cloneDeep',
66
+ title: 'cloneDeep (深拷贝)',
67
+ code: `${INFC}.cloneDeep({ key: 'fred', value: '1' })`,
68
+ implementation: _.cloneDeep,
69
+ },
70
+ {
71
+ value: 'isObject',
72
+ title: 'isObject (判断对象类型)',
73
+ code: `${INFC}.isObject({ key: 'fred', value: '1' })`,
74
+ implementation: _.isObject,
75
+ },
76
+ ],
77
+ },
78
+ {
79
+ value: 'string',
80
+ title: '字符串函数',
81
+ children: [
82
+ {
83
+ value: 'split',
84
+ title: 'split (返回拆分字符串数组)',
85
+ code: `${INFC}.split('a-b-c', '-', 2)`,
86
+ implementation: _.split,
87
+ },
88
+ {
89
+ value: 'truncate',
90
+ title: 'truncate (字符串截取)',
91
+ code: `${INFC}.truncate('hi-diddly-ho there, neighborino', {length: 12})`,
92
+ implementation: _.truncate,
93
+ },
94
+ {
95
+ value: 'replace',
96
+ title: 'replace (字符串替换)',
97
+ code: `${INFC}.replace('Hi a', 'a', 'b')`,
98
+ implementation: _.replace,
99
+ },
100
+ {
101
+ value: 'escape',
102
+ title: 'escape (HTML字符转义)',
103
+ code: `${INFC}.escape('fred, <div></div>, & pebbles')`,
104
+ implementation: _.escape,
105
+ },
106
+ {
107
+ value: 'escapeRegExp',
108
+ title: 'escapeRegExp (特殊字符转义)',
109
+ code: `${INFC}.escapeRegExp('[lodash](//lodash.com/)')`,
110
+ implementation: _.escapeRegExp,
111
+ },
112
+ {
113
+ value: 'startsWith',
114
+ title: 'startsWith (检查字符串开头)',
115
+ code: `${INFC}.startsWith('abc', 'a')`,
116
+ implementation: _.startsWith,
117
+ },
118
+ ],
119
+ },
120
+ {
121
+ value: 'math',
122
+ title: '数学函数',
123
+ children: [
124
+ {
125
+ value: 'sum',
126
+ title: 'sum (求和)',
127
+ code: `${INFC}.sum([6, 4, 5])`,
128
+ implementation: _.sum,
129
+ },
130
+ {
131
+ value: 'add',
132
+ title: 'add (相加)',
133
+ code: `${INFC}.add(6, 4)`,
134
+ implementation: _.add,
135
+ },
136
+ {
137
+ value: 'subtract',
138
+ title: 'subtract (相减)',
139
+ code: `${INFC}.subtract(6, 4)`,
140
+ implementation: _.subtract,
141
+ },
142
+ {
143
+ value: 'multiply',
144
+ title: 'multiply (相乘)',
145
+ code: `${INFC}.multiply(6, 4)`,
146
+ implementation: _.multiply,
147
+ },
148
+ {
149
+ value: 'round',
150
+ title: 'round (四舍五入)',
151
+ code: `${INFC}.round(4.006, 2)`,
152
+ implementation: _.round,
153
+ },
154
+ {
155
+ value: 'ceil',
156
+ title: 'ceil (向上舍入)',
157
+ code: `${INFC}.ceil(6.004, 2)`,
158
+ implementation: _.ceil,
159
+ },
160
+ {
161
+ value: 'floor',
162
+ title: 'floor (向下舍入)',
163
+ code: `${INFC}.floor(0.046, 2)`,
164
+ implementation: _.floor,
165
+ },
166
+ {
167
+ value: 'divide',
168
+ title: 'divide (相除)',
169
+ code: `${INFC}.divide(6, 4)`,
170
+ implementation: _.divide,
171
+ },
172
+ {
173
+ value: 'max',
174
+ title: 'max (最大值)',
175
+ code: `${INFC}.max([4, 2, 8, 6])`,
176
+ implementation: _.max,
177
+ },
178
+ {
179
+ value: 'min',
180
+ title: 'min (最小值)',
181
+ code: `${INFC}.min([4, 2, 8, 6])`,
182
+ implementation: _.min,
183
+ },
184
+ {
185
+ value: 'mean',
186
+ title: 'mean (平均值)',
187
+ code: `${INFC}.mean([4, 2, 8, 6])`,
188
+ implementation: _.mean,
189
+ },
190
+ ],
191
+ },
192
+ {
193
+ value: 'date',
194
+ title: '日期函数',
195
+ children: [
196
+ {
197
+ value: 'format',
198
+ title: 'format (日期格式化)',
199
+ code: `${INFC}.dateFormat('2022-12-09 00:00:00', 'YYYY-MM-DD HH:mm:ss')`,
200
+ implementation: (date: string, format: string) => dayjs(date).format(format),
201
+ },
202
+ {
203
+ value: 'fromNow',
204
+ title: 'fromNow (相对时间)',
205
+ code: `${INFC}.fromNow('2022-12-9')`,
206
+ implementation: (date: string) => dayjs(date).fromNow(),
207
+ },
208
+ {
209
+ value: 'calendar',
210
+ title: 'calendar (日历时间)',
211
+ code: `${INFC}.calendar('2022-12-9')`,
212
+ implementation: (date: string) => dayjs(date).calendar(),
213
+ },
214
+ ],
215
+ },
216
+ {
217
+ value: 'other',
218
+ title: '其他函数',
219
+ children: [
220
+ {
221
+ value: 'random',
222
+ title: 'random (返回随机数)',
223
+ code: `${INFC}.random(5)`,
224
+ implementation: _.random,
225
+ },
226
+ {
227
+ value: 'chunk',
228
+ title: 'chunk (数组拆分)',
229
+ code: `${INFC}.chunk(['a', 'b', 'c', 'd'], 2)`,
230
+ implementation: _.chunk,
231
+ },
232
+ {
233
+ value: 'head',
234
+ title: 'head (获取数据第一个元素)',
235
+ code: `${INFC}.head('2022-12-9')`,
236
+ implementation: _.head,
237
+ },
238
+ {
239
+ value: 'last',
240
+ title: 'last (获取数据最后一个元素)',
241
+ code: `${INFC}.last([1, 2, 3])`,
242
+ implementation: _.last,
243
+ },
244
+ {
245
+ value: 'castArray',
246
+ title: 'castArray (转换为数组)',
247
+ code: `${INFC}.castArray({ 'a': 1 })`,
248
+ implementation: _.castArray,
249
+ },
250
+ {
251
+ value: 'eq',
252
+ title: 'eq (是否相等)',
253
+ code: `${INFC}.eq({ 'a': 1 }, { 'a': 1 })`,
254
+ implementation: _.eq,
255
+ },
256
+ {
257
+ value: 'size',
258
+ title: 'size (获取长度)',
259
+ code: `${INFC}.size('Array|Object')`,
260
+ implementation: _.size,
261
+ },
262
+ ],
263
+ },
264
+ ];
265
+
266
+ const funcObj: any = {};
267
+
268
+ funcList.map(it => it.children).flat().forEach(({ value, implementation }) => {
269
+ funcObj[value] = implementation;
270
+ });
271
+
272
+ return {
273
+ list: funcList,
274
+ INFC: funcObj,
275
+ };
276
+ };
277
+
278
+
279
+ /**
280
+ * 获取预置函数列表
281
+ * @param INFC
282
+ * @returns
283
+ */
284
+ export const getPresetFunctorsList = (INFC: string = 'INFC') => {
285
+ if (!FunctorsMap || Object.keys(FunctorsMap).length === 0) {
286
+ return {
287
+ list: [],
288
+ INFC: {},
289
+ };
290
+ }
291
+
292
+ const list = [
293
+ {
294
+ value: '1',
295
+ title: '常用函数',
296
+ children: [] as unknown as [{
297
+ title: string,
298
+ value: string,
299
+ implementation: (args: any[]) => void,
300
+ code: string
301
+ }],
302
+ },
303
+ ];
304
+ Object.keys(FunctorsMap).forEach(key => {
305
+ // @ts-ignore
306
+ const fn = FunctorsMap[key];
307
+ const { groupsName = '其它', value, label, type } = fn;
308
+ const groupNames = Array.isArray(groupsName) ? groupsName : [groupsName || '其它'];
309
+ groupNames.forEach(groupName => {
310
+ const groupItem = list.find(it => it.title === groupName);
311
+ if (groupItem?.title) {
312
+ groupItem.children?.push({
313
+ title: `${type}(${label})`,
314
+ value: type,
315
+ implementation: fn,
316
+ code: `${INFC}.${value}`,
317
+ });
318
+ } else {
319
+ list.push({
320
+ value: `${groupName}-${type}`,
321
+ title: groupName,
322
+ children: [
323
+ {
324
+ title: `${type}(${label})`,
325
+ value: type,
326
+ implementation: fn,
327
+ code: `${INFC}.${value}`,
328
+ },
329
+ ],
330
+ });
331
+ }
332
+ });
333
+ });
334
+
335
+ return {
336
+ list,
337
+ INFC: FunctorsMap,
338
+ };
339
+ };
@@ -0,0 +1,37 @@
1
+
2
+ import { FunctorDefineReturn } from 'src/types';
3
+ import FunctorsMap from './export';
4
+
5
+ export const isBrowser = (): boolean =>
6
+ typeof window !== 'undefined' &&
7
+ typeof window.document !== 'undefined' &&
8
+ typeof window.document.createElement !== 'undefined';
9
+
10
+ /**
11
+ * 忽略注册的函数
12
+ */
13
+ const ignoreFunctors = ['RANDBETWEEN', 'RANDOMNUM'];
14
+
15
+ export default () => {
16
+ // @ts-ignore
17
+ const { wufengController } = isBrowser() ? window : global;
18
+ if (!wufengController?.registerFunction) {
19
+ console.error(
20
+ '[@lingxiteam/functor]: 注册函数库需要依赖@wufengteam/core, 请前往安装'
21
+ );
22
+ return;
23
+ }
24
+
25
+ Object.keys(FunctorsMap).forEach(functorKey => {
26
+ // @ts-ignore
27
+ const functor: FunctorDefineReturn = FunctorsMap[functorKey];
28
+ if (functor.type && functor.label && !ignoreFunctors.includes(functorKey)) {
29
+ wufengController.registerFunction(functor, {
30
+ type: functor.type,
31
+ name: functor.label,
32
+ description: functor?.description?.title,
33
+ groupsName: functor.groupsName,
34
+ });
35
+ }
36
+ });
37
+ };
@@ -12,3 +12,12 @@ export const includes = (targetArr: (string | number)[], contained: any) => {
12
12
  }
13
13
  return targetArr.findIndex(target => contained.includes(target)) > -1;
14
14
  };
15
+
16
+ /**
17
+ * 判断日期是否为 YYYY-MM-DD HH:mm:ss 格式
18
+ * @param dateStr 日期格式
19
+ */
20
+ export const isFullTimeFormat = (dateStr: string) => {
21
+ const regex = /^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}$/;
22
+ return regex.test(dateStr);
23
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingxiteam/ebe-utils",
3
- "version": "0.2.34",
3
+ "version": "0.2.35",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "",
@@ -19,7 +19,7 @@
19
19
  "@babel/types": "^7.12.12",
20
20
  "cac": "^6.7.14",
21
21
  "fs-extra": "9.x",
22
- "@lingxiteam/ebe": "0.2.34"
22
+ "@lingxiteam/ebe": "0.2.35"
23
23
  },
24
24
  "publishConfig": {
25
25
  "access": "public"