@gct-paas/render 0.1.4-dev.9 → 0.1.5-dev.0
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/dist/index.min.css +2 -0
- package/dist/loader.esm.min.js +1 -0
- package/es/Event/Dependency/controller.d.ts +1 -1
- package/es/Event/Dependency/controller.mjs +81 -94
- package/es/Event/Dependency/displayRule.mjs +130 -68
- package/es/Event/Dependency/useDependency.mjs +117 -0
- package/es/Event/Dependency/useDependencyToShow.d.ts +1 -1
- package/es/Event/Dependency/useDependencyToShow.mjs +100 -96
- package/es/Event/baseEvent.d.ts +28 -32
- package/es/Event/baseEvent.mjs +383 -439
- package/es/Event/bizServiceRequest.d.ts +1 -1
- package/es/Event/bizServiceRequest.mjs +29 -41
- package/es/Event/eventType.d.ts +1 -1
- package/es/Event/eventType.mjs +1 -0
- package/es/Event/index.d.ts +6 -3
- package/es/Event/index.mjs +7 -0
- package/es/Event/utils/appRedis.mjs +39 -49
- package/es/Event/utils/globalLoading.d.ts +13 -0
- package/es/Event/utils/globalLoading.mjs +104 -0
- package/es/Event/utils/processRovedInfo.mjs +228 -294
- package/es/Event/utils/runGlobalByPage.d.ts +4 -1
- package/es/Event/utils/runGlobalByPage.mjs +297 -301
- package/es/Event/utils/verificationVar.mjs +32 -38
- package/es/_virtual/_plugin-vue_export-helper.mjs +8 -0
- package/es/_virtual/_rolldown/runtime.mjs +13 -0
- package/es/components/HandwritingPad.vue.d.ts +27 -0
- package/es/components/HandwritingPad.vue.mjs +7 -0
- package/es/components/HandwritingPad.vue_vue_type_script_setup_true_name_HandwritingPad_lang.mjs +109 -0
- package/es/components/HandwritingPad.vue_vue_type_style_index_0_scoped_d5b980b7_lang.css +9 -0
- package/es/components/index.d.ts +2 -0
- package/es/components/index.mjs +1 -0
- package/es/constant/data-format.d.ts +52 -0
- package/es/constant/data-format.mjs +66 -0
- package/es/constant/date-time.d.ts +99 -0
- package/es/constant/date-time.mjs +187 -0
- package/es/constant/index.d.ts +94 -0
- package/es/constant/index.mjs +100 -0
- package/es/controller/design-render/design-render.controller.d.ts +18 -0
- package/es/controller/design-render/design-render.controller.mjs +78 -0
- package/es/controller/design-render-base/design-render-base.controller.d.ts +9 -0
- package/es/controller/design-render-base/design-render-base.controller.mjs +12 -0
- package/es/controller/design-render-container/design-render-container.controller.d.ts +4 -0
- package/es/controller/design-render-container/design-render-container.controller.mjs +5 -0
- package/es/controller/design-render-item/design-render-item.controller.d.ts +4 -0
- package/es/controller/design-render-item/design-render-item.controller.mjs +5 -0
- package/es/controller/index.d.ts +4 -0
- package/es/controller/index.mjs +4 -0
- package/es/enums/index.mjs +17 -5
- package/es/hooks/index.d.ts +2 -0
- package/es/hooks/index.mjs +2 -0
- package/es/hooks/use-design-render-controller/use-design-render-controller.d.ts +11 -0
- package/es/hooks/use-design-render-controller/use-design-render-controller.mjs +32 -0
- package/es/hooks/useStorageRef.mjs +35 -31
- package/es/index.d.ts +4 -0
- package/es/index.mjs +34 -21
- package/es/interface/controller/i-design-render-base.controller.d.ts +43 -0
- package/es/interface/controller/i-design-render-container.controller.d.ts +7 -0
- package/es/interface/controller/i-design-render-item.controller.d.ts +7 -0
- package/es/interface/controller/i-design-render.controller.d.ts +93 -0
- package/es/interface/index.d.ts +12 -0
- package/es/interface/provider/i-render-base-node.provider.d.ts +45 -0
- package/es/interface/provider/i-render-container-node.provider.d.ts +30 -0
- package/es/interface/provider/i-render-editor-node.provider.d.ts +29 -0
- package/es/interface/provider/i-render-item-node.provider.d.ts +30 -0
- package/es/interface/state/i-design-render-base.state.d.ts +19 -0
- package/es/interface/state/i-design-render-container.state.d.ts +11 -0
- package/es/interface/state/i-design-render-item.state.d.ts +11 -0
- package/es/interface/state/i-design-render.state.d.ts +18 -0
- package/es/loader.d.ts +1 -0
- package/es/register/index.d.ts +1 -0
- package/es/register/index.mjs +2 -0
- package/es/register/node/node.register.d.ts +92 -0
- package/es/register/node/node.register.mjs +116 -0
- package/es/register/render-register/render-register.mjs +63 -58
- package/es/state/design-render/design-render.state.d.ts +13 -0
- package/es/state/design-render/design-render.state.mjs +15 -0
- package/es/state/design-render-base/design-render-base.state.d.ts +4 -0
- package/es/state/design-render-base/design-render-base.state.mjs +6 -0
- package/es/state/design-render-container/design-render-container.state.d.ts +4 -0
- package/es/state/design-render-item/design-render-item.state.d.ts +4 -0
- package/es/state/index.d.ts +4 -0
- package/es/utils/cacheAdapter.mjs +62 -54
- package/es/utils/expression/index.d.ts +1 -1
- package/es/utils/expression/index.mjs +105 -122
- package/es/utils/expression/regularExpression/methods.mjs +426 -567
- package/es/utils/field-attrs/basicAttrs.mjs +56 -80
- package/es/utils/field-attrs/index.mjs +16 -13
- package/es/utils/get-ref-data.mjs +41 -59
- package/es/utils/getFieldSchema.mjs +66 -80
- package/es/utils/index.d.ts +6 -3
- package/es/utils/index.mjs +11 -0
- package/es/utils/model-transformer.mjs +74 -64
- package/es/utils/render-plugin-pkg-util/render-plugin-pkg-util.d.ts +43 -0
- package/es/utils/render-plugin-pkg-util/render-plugin-pkg-util.mjs +65 -0
- package/es/utils/search/index.d.ts +2 -0
- package/es/utils/search/index.mjs +2 -0
- package/es/utils/search/search-default-value.d.ts +7 -0
- package/es/utils/search/search-default-value.mjs +244 -0
- package/es/utils/search/search-hooks.d.ts +6 -0
- package/es/utils/search/search-hooks.mjs +67 -0
- package/es/utils/useStyle.d.ts +2 -2
- package/es/utils/useStyle.mjs +20 -15
- package/package.json +20 -17
- package/dist/index.esm.min.mjs +0 -7758
- package/dist/index.min.cjs +0 -9
- package/dist/index.system.min.js +0 -9
|
@@ -1,729 +1,588 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import dayjs from
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
1
|
+
import { __exportAll } from "../../../_virtual/_rolldown/runtime.mjs";
|
|
2
|
+
import dayjs from "dayjs";
|
|
3
|
+
import { isEqual, isNull, isUndefined } from "lodash-es";
|
|
4
|
+
import utc from "dayjs/plugin/utc";
|
|
5
|
+
import timezone from "dayjs/plugin/timezone";
|
|
6
|
+
import quarterOfYear from "dayjs/plugin/quarterOfYear";
|
|
7
|
+
import toArray from "dayjs/plugin/toArray";
|
|
8
|
+
import isoWeek from "dayjs/plugin/isoWeek";
|
|
9
|
+
import BigNumberJS from "bignumber.js";
|
|
10
|
+
//#region src/utils/expression/regularExpression/methods.ts
|
|
11
|
+
var methods_exports = /* @__PURE__ */ __exportAll({
|
|
12
|
+
ABS: () => ABS,
|
|
13
|
+
ADD: () => ADD,
|
|
14
|
+
AND: () => AND,
|
|
15
|
+
AVERAGE: () => AVERAGE,
|
|
16
|
+
CONCAT: () => CONCAT,
|
|
17
|
+
COUNT: () => COUNT,
|
|
18
|
+
DATE2TIMESTAMP: () => DATE2TIMESTAMP,
|
|
19
|
+
DATEFORMAT: () => DATEFORMAT,
|
|
20
|
+
DAY: () => DAY,
|
|
21
|
+
DIVISION: () => DIVISION,
|
|
22
|
+
EQ: () => EQ,
|
|
23
|
+
FINDSTR: () => FINDSTR,
|
|
24
|
+
FIXED: () => FIXED,
|
|
25
|
+
GE: () => GE,
|
|
26
|
+
GET: () => GET,
|
|
27
|
+
GT: () => GT,
|
|
28
|
+
HEADPUSH: () => HEADPUSH,
|
|
29
|
+
HOUR: () => HOUR,
|
|
30
|
+
IF: () => IF,
|
|
31
|
+
ISDATERANGE: () => ISDATERANGE,
|
|
32
|
+
ISEMPTY: () => ISEMPTY,
|
|
33
|
+
ISNULL: () => ISNULL,
|
|
34
|
+
ISTIMERANGE: () => ISTIMERANGE,
|
|
35
|
+
ISUNDEFINED: () => ISUNDEFINED,
|
|
36
|
+
LARGE: () => LARGE,
|
|
37
|
+
LASTMONTHRANGE: () => LASTMONTHRANGE,
|
|
38
|
+
LASTQUARTER: () => LASTQUARTER,
|
|
39
|
+
LASTWEEKRANGE: () => LASTWEEKRANGE,
|
|
40
|
+
LASTYEARRANGE: () => LASTYEARRANGE,
|
|
41
|
+
LE: () => LE,
|
|
42
|
+
LEN: () => LEN,
|
|
43
|
+
LOWER: () => LOWER,
|
|
44
|
+
LT: () => LT,
|
|
45
|
+
LTRIM: () => LTRIM,
|
|
46
|
+
MAX: () => MAX,
|
|
47
|
+
MIN: () => MIN,
|
|
48
|
+
MINUTE: () => MINUTE,
|
|
49
|
+
MOD: () => MOD,
|
|
50
|
+
MONTH: () => MONTH,
|
|
51
|
+
MONTHRANGE: () => MONTHRANGE,
|
|
52
|
+
MULTIPLICATION: () => MULTIPLICATION,
|
|
53
|
+
NE: () => NE,
|
|
54
|
+
NOW: () => NOW,
|
|
55
|
+
OR: () => OR,
|
|
56
|
+
PARSENUMBER: () => PARSENUMBER,
|
|
57
|
+
POWER: () => POWER,
|
|
58
|
+
PUSH: () => PUSH,
|
|
59
|
+
PUT: () => PUT,
|
|
60
|
+
QUARTER: () => QUARTER,
|
|
61
|
+
REDUCE: () => REDUCE,
|
|
62
|
+
REPEAT: () => REPEAT,
|
|
63
|
+
REPLACE: () => REPLACE,
|
|
64
|
+
ROUND: () => ROUND,
|
|
65
|
+
ROUNDUP: () => ROUNDUP,
|
|
66
|
+
RTRIM: () => RTRIM,
|
|
67
|
+
SEARCHSTR: () => SEARCHSTR,
|
|
68
|
+
SEQMAP: () => SEQMAP,
|
|
69
|
+
SMALL: () => SMALL,
|
|
70
|
+
SPLIT: () => SPLIT,
|
|
71
|
+
SQRT: () => SQRT,
|
|
72
|
+
STDEV: () => STDEV,
|
|
73
|
+
SUBSTR: () => SUBSTR,
|
|
74
|
+
SUBSTRING: () => SUBSTRING,
|
|
75
|
+
SUM: () => SUM,
|
|
76
|
+
SUMSQ: () => SUMSQ,
|
|
77
|
+
TIMESTAMP2DATE: () => TIMESTAMP2DATE,
|
|
78
|
+
TODAY: () => TODAY,
|
|
79
|
+
TRIM: () => TRIM,
|
|
80
|
+
TUPLE: () => TUPLE,
|
|
81
|
+
UPPER: () => UPPER,
|
|
82
|
+
WEEKRANGE: () => WEEKRANGE,
|
|
83
|
+
YEAR: () => YEAR,
|
|
84
|
+
YEARRANGE: () => YEARRANGE
|
|
85
|
+
});
|
|
10
86
|
dayjs.extend(utc);
|
|
11
87
|
dayjs.extend(timezone);
|
|
12
88
|
dayjs.extend(quarterOfYear);
|
|
13
89
|
dayjs.extend(toArray);
|
|
14
90
|
dayjs.extend(isoWeek);
|
|
15
91
|
function IF(expr, v, l) {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return isIfFn();
|
|
92
|
+
const fn = () => {
|
|
93
|
+
return expr ? v : l;
|
|
94
|
+
};
|
|
95
|
+
return fn();
|
|
21
96
|
}
|
|
22
97
|
function ISEMPTY(v) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return isEmptyFn();
|
|
98
|
+
const func = () => v == null || v === "" || v === 0;
|
|
99
|
+
return func();
|
|
26
100
|
}
|
|
27
101
|
function ISNULL(v) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
return isNullFn();
|
|
102
|
+
const func = () => isNull(v);
|
|
103
|
+
return func();
|
|
31
104
|
}
|
|
32
105
|
function ISUNDEFINED(v) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return isUndefinedFn();
|
|
106
|
+
const func = () => isUndefined(v);
|
|
107
|
+
return func();
|
|
36
108
|
}
|
|
37
109
|
function AND(...e) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
};
|
|
44
|
-
const isAndFn = func;
|
|
45
|
-
return isAndFn();
|
|
110
|
+
const func = () => {
|
|
111
|
+
for (const i of e) if (!i) return false;
|
|
112
|
+
return true;
|
|
113
|
+
};
|
|
114
|
+
return func();
|
|
46
115
|
}
|
|
47
116
|
function OR(...e) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return isOrFn();
|
|
117
|
+
const func = () => e.some((i) => i);
|
|
118
|
+
return func();
|
|
51
119
|
}
|
|
52
120
|
function EQ(v, o) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return isEqFn();
|
|
121
|
+
const func = () => isEqual(v, o);
|
|
122
|
+
return func();
|
|
56
123
|
}
|
|
57
124
|
function NE(v, o) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
return isNotEqual();
|
|
125
|
+
const func = () => v !== o;
|
|
126
|
+
return func();
|
|
61
127
|
}
|
|
62
128
|
function LE(v, o) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
} else {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
};
|
|
74
|
-
const isLeFn = fn;
|
|
75
|
-
return isLeFn();
|
|
129
|
+
const fn = () => {
|
|
130
|
+
if (typeof v === "number" && typeof o === "number" || typeof v === "string" && typeof o === "string" || v instanceof Date && o instanceof Date) if (v <= o) return true;
|
|
131
|
+
else return false;
|
|
132
|
+
else return false;
|
|
133
|
+
};
|
|
134
|
+
return fn();
|
|
76
135
|
}
|
|
77
136
|
function LT(v, o) {
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
const isLtFn = fn;
|
|
86
|
-
return isLtFn();
|
|
137
|
+
const fn = () => {
|
|
138
|
+
if (typeof v === "number" && typeof o === "number" || typeof v === "string" && typeof o === "string" || v instanceof Date && o instanceof Date) return v < o;
|
|
139
|
+
else return false;
|
|
140
|
+
};
|
|
141
|
+
return fn();
|
|
87
142
|
}
|
|
88
143
|
function GE(v, o) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
} else {
|
|
97
|
-
return false;
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
const isGeFn = fn;
|
|
101
|
-
return isGeFn();
|
|
144
|
+
const fn = () => {
|
|
145
|
+
if (typeof v === "number" && typeof o === "number" || typeof v === "string" && typeof o === "string" || v instanceof Date && o instanceof Date) if (v >= o) return true;
|
|
146
|
+
else return false;
|
|
147
|
+
else return false;
|
|
148
|
+
};
|
|
149
|
+
return fn();
|
|
102
150
|
}
|
|
103
151
|
function GT(v, o) {
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
} else {
|
|
112
|
-
return false;
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
const isGtFn = fn;
|
|
116
|
-
return isGtFn();
|
|
152
|
+
const fn = () => {
|
|
153
|
+
if (typeof v === "number" && typeof o === "number" || typeof v === "string" && typeof o === "string" || v instanceof Date && o instanceof Date) if (v > o) return true;
|
|
154
|
+
else return false;
|
|
155
|
+
else return false;
|
|
156
|
+
};
|
|
157
|
+
return fn();
|
|
117
158
|
}
|
|
118
159
|
function LEN(v) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
return isLenFn();
|
|
160
|
+
const fn = () => v?.length || 0;
|
|
161
|
+
return fn();
|
|
122
162
|
}
|
|
123
163
|
function CONCAT(...args) {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
return isConcatFn();
|
|
164
|
+
const fn = () => args.join("");
|
|
165
|
+
return fn();
|
|
127
166
|
}
|
|
128
167
|
function SUBSTRING(v = "", s, e) {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
return s < 0 ? [...val].reverse().join("") : val;
|
|
135
|
-
};
|
|
136
|
-
const isSubstringFn = fn;
|
|
137
|
-
return isSubstringFn();
|
|
168
|
+
const fn = () => {
|
|
169
|
+
const val = (s < 0 ? [...v].reverse().join("") : v).slice(Math.abs(s + Number(s < 0)), Math.abs(e) + Number(s >= 0));
|
|
170
|
+
return s < 0 ? [...val].reverse().join("") : val;
|
|
171
|
+
};
|
|
172
|
+
return fn();
|
|
138
173
|
}
|
|
139
174
|
function SUBSTR(v = "", s, l) {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return s < 0 ? [...val].reverse().join("") : val;
|
|
146
|
-
};
|
|
147
|
-
const isSubstrFn = fn;
|
|
148
|
-
return isSubstrFn();
|
|
175
|
+
const fn = () => {
|
|
176
|
+
const val = (s < 0 ? [...v].reverse().join("") : v).slice(Math.abs(s + Number(s < 0)), Math.abs(s + Number(s < 0)) + Math.abs(l));
|
|
177
|
+
return s < 0 ? [...val].reverse().join("") : val;
|
|
178
|
+
};
|
|
179
|
+
return fn();
|
|
149
180
|
}
|
|
150
181
|
function UPPER(v = "") {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
return isUpperFn();
|
|
182
|
+
const fn = () => v.toUpperCase();
|
|
183
|
+
return fn();
|
|
154
184
|
}
|
|
155
185
|
function LOWER(v = "") {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
return isLowerFn();
|
|
186
|
+
const fn = () => v.toLowerCase();
|
|
187
|
+
return fn();
|
|
159
188
|
}
|
|
160
189
|
function TRIM(v = "") {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
return isTrimFn();
|
|
190
|
+
const fn = () => v.trim();
|
|
191
|
+
return fn();
|
|
164
192
|
}
|
|
165
193
|
function LTRIM(v = "") {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
return isTrimFn();
|
|
194
|
+
const fn = () => v.replace(/^\s\s*/, "");
|
|
195
|
+
return fn();
|
|
169
196
|
}
|
|
170
197
|
function RTRIM(v = "") {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
return isTrimFn();
|
|
198
|
+
const fn = () => v.replace(/\s\s*$/, "");
|
|
199
|
+
return fn();
|
|
174
200
|
}
|
|
175
201
|
function REPEAT(v = "", c = "") {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
return isRepeatFn();
|
|
202
|
+
const fn = () => v.match(new RegExp(c, "g"))?.length || null;
|
|
203
|
+
return fn();
|
|
179
204
|
}
|
|
180
205
|
function REPLACE(v = "", o = "", t = "") {
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
return isReplaceFn();
|
|
206
|
+
const fn = () => v.replace(new RegExp(o, "g"), t);
|
|
207
|
+
return fn();
|
|
184
208
|
}
|
|
185
209
|
function FINDSTR(v = "", c = "") {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
return isFindStrFn();
|
|
210
|
+
const fn = () => v.includes(c);
|
|
211
|
+
return fn();
|
|
189
212
|
}
|
|
190
213
|
function SEARCHSTR(v = "", c = "") {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
return isSearchstrFn();
|
|
214
|
+
const fn = () => {
|
|
215
|
+
const l = v.match(new RegExp(c, "g"))?.length;
|
|
216
|
+
return l ? l : 0;
|
|
217
|
+
};
|
|
218
|
+
return fn();
|
|
197
219
|
}
|
|
198
220
|
function PARSENUMBER(v = "") {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
return isParsenumberFn();
|
|
221
|
+
const fn = () => {
|
|
222
|
+
const num = parseFloat(v);
|
|
223
|
+
return isNaN(num) ? null : num;
|
|
224
|
+
};
|
|
225
|
+
return fn();
|
|
205
226
|
}
|
|
206
227
|
function SPLIT(v = "", c = "") {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
return isSplitFn();
|
|
228
|
+
const fn = () => v.split(c);
|
|
229
|
+
return fn();
|
|
210
230
|
}
|
|
211
231
|
function SUM(...args) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
return isSumFn();
|
|
232
|
+
const v = args.flat().filter((i) => i !== "" && i !== null && i !== void 0);
|
|
233
|
+
if (!v.length) return "";
|
|
234
|
+
const fn = () => v.reduce(plus, 0);
|
|
235
|
+
return fn();
|
|
217
236
|
}
|
|
218
237
|
function ADD(...args) {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
return isSumFn();
|
|
238
|
+
const v = args.flat();
|
|
239
|
+
const fn = () => v.reduce(plus, 0);
|
|
240
|
+
return fn();
|
|
223
241
|
}
|
|
224
242
|
function REDUCE(v, ...args) {
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
return isReduceFN();
|
|
243
|
+
const fn = () => args.reduce(minus, v);
|
|
244
|
+
return fn();
|
|
228
245
|
}
|
|
229
246
|
function MULTIPLICATION(val, ...args) {
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
return isMultiFn();
|
|
247
|
+
const v = args.flat().filter((i) => i !== "" && i !== null && i !== void 0);
|
|
248
|
+
if (!v.length) return "";
|
|
249
|
+
const fn = () => v.reduce(multipliedBy, val);
|
|
250
|
+
return fn();
|
|
235
251
|
}
|
|
236
252
|
function DIVISION(v, ...args) {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return isDivision();
|
|
253
|
+
const fn = () => args.reduce(div, v);
|
|
254
|
+
return fn();
|
|
240
255
|
}
|
|
241
256
|
function FIXED(v, n) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
const count = decimalArr.length;
|
|
256
|
-
for (let i = 0; i < n - count; i++) {
|
|
257
|
-
decimalArr.push("0");
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
return `${integer}.${decimalArr.join("")}`;
|
|
261
|
-
};
|
|
262
|
-
const isFixedFn = fn;
|
|
263
|
-
return isFixedFn();
|
|
257
|
+
const fn = () => {
|
|
258
|
+
if (n < 0) throw new Error("Decimal places should be non-negative.");
|
|
259
|
+
const [integer, decimal = ""] = v.toString().split(".");
|
|
260
|
+
if (n == 0) return integer;
|
|
261
|
+
let decimalArr = decimal.split("");
|
|
262
|
+
if (decimalArr.length > n) decimalArr = decimalArr.slice(0, n);
|
|
263
|
+
else {
|
|
264
|
+
const count = decimalArr.length;
|
|
265
|
+
for (let i = 0; i < n - count; i++) decimalArr.push("0");
|
|
266
|
+
}
|
|
267
|
+
return `${integer}.${decimalArr.join("")}`;
|
|
268
|
+
};
|
|
269
|
+
return fn();
|
|
264
270
|
}
|
|
265
271
|
function ROUND(v, n) {
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
};
|
|
277
|
-
const isRoundFn = fn;
|
|
278
|
-
return isRoundFn();
|
|
272
|
+
const fn = () => {
|
|
273
|
+
if (v === null || v === "" || v === void 0) return "";
|
|
274
|
+
if (n < 0) throw new Error("Decimal places should be non-negative.");
|
|
275
|
+
const digits = Math.trunc(n);
|
|
276
|
+
const numValue = Number(v);
|
|
277
|
+
if (isNaN(numValue)) return "";
|
|
278
|
+
const num = numValue > 0 ? (+(Math.round(Number(numValue + `e${digits}`)) + `e-${digits}`)).toFixed(digits) : -(+(Math.round(Number(-numValue + `e${digits}`)) + `e-${digits}`)).toFixed(digits);
|
|
279
|
+
return parseFloat(num + "");
|
|
280
|
+
};
|
|
281
|
+
return fn();
|
|
279
282
|
}
|
|
280
283
|
function ROUNDUP(v, n) {
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
n = n ? parseInt(n + "") : 0;
|
|
286
|
-
return new BigNumberJS(v).decimalPlaces(n, BigNumberJS.ROUND_UP).toNumber();
|
|
284
|
+
if (v === null || v === "" || v === void 0) return "";
|
|
285
|
+
if (n < 0) throw new Error("Decimal places should be non-negative.");
|
|
286
|
+
n = n ? parseInt(n + "") : 0;
|
|
287
|
+
return new BigNumberJS(v).decimalPlaces(n, BigNumberJS.ROUND_UP).toNumber();
|
|
287
288
|
}
|
|
288
289
|
function MAX(...args) {
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
return isMaxFn();
|
|
290
|
+
const v = args.flat().filter((i) => i !== "" && i !== null && i !== void 0);
|
|
291
|
+
if (!v.length) return "";
|
|
292
|
+
const fn = () => Math.max.apply(null, v);
|
|
293
|
+
return fn();
|
|
294
294
|
}
|
|
295
295
|
function LARGE(v, n) {
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
const s = v.sort((a, b) => b - a);
|
|
303
|
-
return s[n - 1];
|
|
304
|
-
};
|
|
305
|
-
const isLargeFn = fn;
|
|
306
|
-
return isLargeFn();
|
|
296
|
+
const fn = () => {
|
|
297
|
+
if (n < 1 || n > v.length) throw new Error("Invalid value of n. It should be between 1 and the array length.");
|
|
298
|
+
return v.sort((a, b) => b - a)[n - 1];
|
|
299
|
+
};
|
|
300
|
+
return fn();
|
|
307
301
|
}
|
|
308
302
|
function MIN(...args) {
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
return isMinFn();
|
|
303
|
+
const v = args.flat().filter((i) => i !== "" && i !== null && i !== void 0);
|
|
304
|
+
if (!v.length) return "";
|
|
305
|
+
const fn = () => Math.min.apply(null, v);
|
|
306
|
+
return fn();
|
|
314
307
|
}
|
|
315
308
|
function SMALL(v, n) {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
}
|
|
322
|
-
const s = v.sort((a, b) => a - b);
|
|
323
|
-
return s[n - 1];
|
|
324
|
-
};
|
|
325
|
-
const isSmallFn = fn;
|
|
326
|
-
return isSmallFn();
|
|
309
|
+
const fn = () => {
|
|
310
|
+
if (n < 1 || n > v.length) throw new Error("Invalid value of n. It should be between 1 and the array length.");
|
|
311
|
+
return v.sort((a, b) => a - b)[n - 1];
|
|
312
|
+
};
|
|
313
|
+
return fn();
|
|
327
314
|
}
|
|
328
315
|
function AVERAGE(...args) {
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
return sum.dividedBy(count).toNumber();
|
|
316
|
+
const numbers = args.flat().filter((i) => i !== "" && i !== null && i !== void 0);
|
|
317
|
+
const count = numbers.length;
|
|
318
|
+
if (!count) return "";
|
|
319
|
+
let sum = new BigNumberJS(0);
|
|
320
|
+
for (const number of numbers) sum = sum.plus(number);
|
|
321
|
+
return sum.dividedBy(count).toNumber();
|
|
337
322
|
}
|
|
338
323
|
function ABS(v) {
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
return isAbsFn();
|
|
324
|
+
const fn = () => Math.abs.call(null, v);
|
|
325
|
+
return fn();
|
|
342
326
|
}
|
|
343
327
|
function MOD(v, n) {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
};
|
|
352
|
-
const isModFn = fn;
|
|
353
|
-
return isModFn();
|
|
328
|
+
const fn = () => {
|
|
329
|
+
if (v === 0) throw new Error("The second value should not be zero.");
|
|
330
|
+
const result = new BigNumberJS(v).mod(n).toNumber();
|
|
331
|
+
if (isNaN(result)) return "";
|
|
332
|
+
return result;
|
|
333
|
+
};
|
|
334
|
+
return fn();
|
|
354
335
|
}
|
|
355
336
|
function toSafeNumber(x) {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
}
|
|
369
|
-
return null;
|
|
337
|
+
if (typeof x === "number") return Number.isFinite(x) ? x : null;
|
|
338
|
+
if (typeof x === "string") {
|
|
339
|
+
const s = x.trim();
|
|
340
|
+
if (s === "") return null;
|
|
341
|
+
const n = Number(s);
|
|
342
|
+
return Number.isFinite(n) ? n : null;
|
|
343
|
+
}
|
|
344
|
+
if (typeof x === "bigint") {
|
|
345
|
+
const n = Number(x);
|
|
346
|
+
return Number.isFinite(n) ? n : null;
|
|
347
|
+
}
|
|
348
|
+
return null;
|
|
370
349
|
}
|
|
371
350
|
function POWER(v, n) {
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
const result = Math.pow(base, exp);
|
|
381
|
-
return result;
|
|
382
|
-
};
|
|
383
|
-
const isProwerFn = fn;
|
|
384
|
-
return isProwerFn();
|
|
351
|
+
const fn = () => {
|
|
352
|
+
const base = toSafeNumber(v);
|
|
353
|
+
const exp = toSafeNumber(n);
|
|
354
|
+
if (base === null || exp === null) return NaN;
|
|
355
|
+
if (Math.abs(exp) > 1e9) return exp > 0 ? Infinity : 0;
|
|
356
|
+
return Math.pow(base, exp);
|
|
357
|
+
};
|
|
358
|
+
return fn();
|
|
385
359
|
}
|
|
386
360
|
function SQRT(v) {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
return isSqrt();
|
|
361
|
+
const fn = () => {
|
|
362
|
+
const n = toSafeNumber(v);
|
|
363
|
+
if (n === null) return NaN;
|
|
364
|
+
return Math.sqrt(n);
|
|
365
|
+
};
|
|
366
|
+
return fn();
|
|
394
367
|
}
|
|
395
368
|
function GET(v, p) {
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
if (typeof p === "string") {
|
|
405
|
-
return v[p];
|
|
406
|
-
} else {
|
|
407
|
-
throw new Error(
|
|
408
|
-
"For objects, the second argument (b) should be a string."
|
|
409
|
-
);
|
|
410
|
-
}
|
|
411
|
-
} else {
|
|
412
|
-
throw new Error(
|
|
413
|
-
"Unsupported data type. The first argument (a) should be an array or an object."
|
|
414
|
-
);
|
|
415
|
-
}
|
|
416
|
-
};
|
|
417
|
-
const isGetFn = fn;
|
|
418
|
-
return isGetFn();
|
|
369
|
+
const fn = () => {
|
|
370
|
+
if (Array.isArray(v)) if (typeof p === "number") return v[p];
|
|
371
|
+
else throw new Error("For arrays, the second argument should be a number.");
|
|
372
|
+
else if (typeof v === "object") if (typeof p === "string") return v[p];
|
|
373
|
+
else throw new Error("For objects, the second argument (b) should be a string.");
|
|
374
|
+
else throw new Error("Unsupported data type. The first argument (a) should be an array or an object.");
|
|
375
|
+
};
|
|
376
|
+
return fn();
|
|
419
377
|
}
|
|
420
378
|
function PUT(a, b, c) {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
} else if (typeof a === "object") {
|
|
431
|
-
if (typeof b === "string" && a) {
|
|
432
|
-
a[b] = c;
|
|
433
|
-
} else {
|
|
434
|
-
throw new Error(
|
|
435
|
-
"For objects, the second argument (b) should be a string."
|
|
436
|
-
);
|
|
437
|
-
}
|
|
438
|
-
} else {
|
|
439
|
-
throw new Error(
|
|
440
|
-
"Unsupported data type. The first argument (a) should be an array or an object."
|
|
441
|
-
);
|
|
442
|
-
}
|
|
443
|
-
return a;
|
|
444
|
-
};
|
|
445
|
-
const isPutFn = fn;
|
|
446
|
-
return isPutFn();
|
|
379
|
+
const fn = () => {
|
|
380
|
+
if (Array.isArray(a)) if (typeof b === "number" && b >= 0 && b < a.length) a[b] = c;
|
|
381
|
+
else throw new Error("For arrays, the second argument (b) should be a number.");
|
|
382
|
+
else if (typeof a === "object") if (typeof b === "string" && a) a[b] = c;
|
|
383
|
+
else throw new Error("For objects, the second argument (b) should be a string.");
|
|
384
|
+
else throw new Error("Unsupported data type. The first argument (a) should be an array or an object.");
|
|
385
|
+
return a;
|
|
386
|
+
};
|
|
387
|
+
return fn();
|
|
447
388
|
}
|
|
448
389
|
function PUSH(v, n) {
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
v.push(n);
|
|
456
|
-
return v;
|
|
457
|
-
};
|
|
458
|
-
const isPushFn = fn;
|
|
459
|
-
return isPushFn();
|
|
390
|
+
const fn = () => {
|
|
391
|
+
if (!n) throw new Error("For arrays, the second argument should not be null or undefined");
|
|
392
|
+
v.push(n);
|
|
393
|
+
return v;
|
|
394
|
+
};
|
|
395
|
+
return fn();
|
|
460
396
|
}
|
|
461
397
|
function HEADPUSH(v, n) {
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
v.unshift(n);
|
|
469
|
-
return v;
|
|
470
|
-
};
|
|
471
|
-
const isHeadpushFn = fn;
|
|
472
|
-
return isHeadpushFn();
|
|
398
|
+
const fn = () => {
|
|
399
|
+
if (!n) throw new Error("For arrays, the second argument should not be null or undefined");
|
|
400
|
+
v.unshift(n);
|
|
401
|
+
return v;
|
|
402
|
+
};
|
|
403
|
+
return fn();
|
|
473
404
|
}
|
|
474
405
|
function TIMESTAMP2DATE(v) {
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
const month = String(dateObj.getMonth() + 1).padStart(2, "0");
|
|
483
|
-
const day = String(dateObj.getDate()).padStart(2, "0");
|
|
484
|
-
const hours = String(dateObj.getHours()).padStart(2, "0");
|
|
485
|
-
const minutes = String(dateObj.getMinutes()).padStart(2, "0");
|
|
486
|
-
const seconds = String(dateObj.getSeconds()).padStart(2, "0");
|
|
487
|
-
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
|
488
|
-
};
|
|
489
|
-
const isTimeStampFn = fn;
|
|
490
|
-
return isTimeStampFn();
|
|
406
|
+
if (!v) return;
|
|
407
|
+
const fn = () => {
|
|
408
|
+
if (!v) throw new Error("the frist argument should not be null");
|
|
409
|
+
const dateObj = /* @__PURE__ */ new Date(v * 1e3);
|
|
410
|
+
return `${dateObj.getFullYear()}-${String(dateObj.getMonth() + 1).padStart(2, "0")}-${String(dateObj.getDate()).padStart(2, "0")} ${String(dateObj.getHours()).padStart(2, "0")}:${String(dateObj.getMinutes()).padStart(2, "0")}:${String(dateObj.getSeconds()).padStart(2, "0")}`;
|
|
411
|
+
};
|
|
412
|
+
return fn();
|
|
491
413
|
}
|
|
492
414
|
function DATE2TIMESTAMP(v) {
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
return isDateToTimestampFn();
|
|
415
|
+
if (!v) return;
|
|
416
|
+
const fn = () => dayjs(v).unix();
|
|
417
|
+
return fn();
|
|
497
418
|
}
|
|
498
419
|
function DATEFORMAT(v, f) {
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
return isDateFormatFn();
|
|
420
|
+
if (!v) return;
|
|
421
|
+
const fn = () => dayjs(v).format(f);
|
|
422
|
+
return fn();
|
|
503
423
|
}
|
|
504
424
|
function NOW() {
|
|
505
|
-
|
|
425
|
+
return dayjs().format("YYYY-MM-DD HH:MM:ss");
|
|
506
426
|
}
|
|
507
427
|
function TODAY() {
|
|
508
|
-
|
|
428
|
+
return dayjs().format("YYYY-MM-DD");
|
|
509
429
|
}
|
|
510
430
|
function YEAR(v) {
|
|
511
|
-
|
|
431
|
+
return dayjs(v).year();
|
|
512
432
|
}
|
|
513
433
|
function MONTH(v) {
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
const isMonthFn = fn;
|
|
519
|
-
return isMonthFn();
|
|
434
|
+
const fn = () => {
|
|
435
|
+
return dayjs(v).month();
|
|
436
|
+
};
|
|
437
|
+
return fn();
|
|
520
438
|
}
|
|
521
439
|
function DAY(v) {
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
const isDayFn = fn;
|
|
527
|
-
return isDayFn();
|
|
440
|
+
const fn = () => {
|
|
441
|
+
return dayjs(v).day();
|
|
442
|
+
};
|
|
443
|
+
return fn();
|
|
528
444
|
}
|
|
529
445
|
function HOUR(v) {
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
const isHourFn = fn;
|
|
535
|
-
return isHourFn();
|
|
446
|
+
const fn = () => {
|
|
447
|
+
return dayjs(v).hour();
|
|
448
|
+
};
|
|
449
|
+
return fn();
|
|
536
450
|
}
|
|
537
451
|
function MINUTE(v) {
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
const isMinuteFn = fn;
|
|
543
|
-
return isMinuteFn();
|
|
452
|
+
const fn = () => {
|
|
453
|
+
return dayjs(v).minute();
|
|
454
|
+
};
|
|
455
|
+
return fn();
|
|
544
456
|
}
|
|
545
457
|
function WEEKRANGE() {
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
};
|
|
551
|
-
const isWeekDayFn = fn;
|
|
552
|
-
return isWeekDayFn();
|
|
458
|
+
const fn = () => {
|
|
459
|
+
return [convertToCST(dayjs().startOf("week").toDate()), convertToCST(dayjs().endOf("week").toDate())];
|
|
460
|
+
};
|
|
461
|
+
return fn();
|
|
553
462
|
}
|
|
554
463
|
function LASTWEEKRANGE() {
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
const endOfLastWeek = convertToCST(
|
|
560
|
-
dayjs().subtract(1, "week").endOf("week").toDate()
|
|
561
|
-
);
|
|
562
|
-
return [startOfLastWeek, endOfLastWeek];
|
|
563
|
-
};
|
|
564
|
-
const isLastWeekFn = fn;
|
|
565
|
-
return isLastWeekFn();
|
|
464
|
+
const fn = () => {
|
|
465
|
+
return [convertToCST(dayjs().subtract(1, "week").startOf("week").toDate()), convertToCST(dayjs().subtract(1, "week").endOf("week").toDate())];
|
|
466
|
+
};
|
|
467
|
+
return fn();
|
|
566
468
|
}
|
|
567
469
|
function MONTHRANGE() {
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
};
|
|
573
|
-
const isMonthRangeFn = fn;
|
|
574
|
-
return isMonthRangeFn();
|
|
470
|
+
const fn = () => {
|
|
471
|
+
return [convertToCST(dayjs().startOf("month").toDate()), convertToCST(dayjs().endOf("month").toDate())];
|
|
472
|
+
};
|
|
473
|
+
return fn();
|
|
575
474
|
}
|
|
576
475
|
function LASTMONTHRANGE() {
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
const endOfLastMonth = convertToCST(
|
|
582
|
-
dayjs().subtract(1, "month").endOf("month").toDate()
|
|
583
|
-
);
|
|
584
|
-
return [startOfLastMonth, endOfLastMonth];
|
|
585
|
-
};
|
|
586
|
-
const isLastMonthRangeFn = fn;
|
|
587
|
-
return isLastMonthRangeFn();
|
|
476
|
+
const fn = () => {
|
|
477
|
+
return [convertToCST(dayjs().subtract(1, "month").startOf("month").toDate()), convertToCST(dayjs().subtract(1, "month").endOf("month").toDate())];
|
|
478
|
+
};
|
|
479
|
+
return fn();
|
|
588
480
|
}
|
|
589
481
|
function YEARRANGE() {
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
};
|
|
595
|
-
const isYearRange = fn;
|
|
596
|
-
return isYearRange();
|
|
482
|
+
const fn = () => {
|
|
483
|
+
return [convertToCST(dayjs().startOf("year").toDate()), convertToCST(dayjs().endOf("year").toDate())];
|
|
484
|
+
};
|
|
485
|
+
return fn();
|
|
597
486
|
}
|
|
598
487
|
function LASTYEARRANGE() {
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
const endOfLastYear = convertToCST(
|
|
604
|
-
dayjs().subtract(1, "year").endOf("year").toDate()
|
|
605
|
-
);
|
|
606
|
-
return [startOfLastYear, endOfLastYear];
|
|
607
|
-
};
|
|
608
|
-
const isLastYearRange = fn;
|
|
609
|
-
return isLastYearRange();
|
|
488
|
+
const fn = () => {
|
|
489
|
+
return [convertToCST(dayjs().subtract(1, "year").startOf("year").toDate()), convertToCST(dayjs().subtract(1, "year").endOf("year").toDate())];
|
|
490
|
+
};
|
|
491
|
+
return fn();
|
|
610
492
|
}
|
|
611
493
|
function QUARTER() {
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
const endOfCurrentQuarter = convertToCST(
|
|
618
|
-
dayjs().quarter(currentQuarter).endOf("quarter").toDate()
|
|
619
|
-
);
|
|
620
|
-
return [startOfCurrentQuarter, endOfCurrentQuarter];
|
|
621
|
-
};
|
|
622
|
-
const isQuarterFn = fn;
|
|
623
|
-
return isQuarterFn();
|
|
494
|
+
const fn = () => {
|
|
495
|
+
const currentQuarter = Math.floor((dayjs().month() + 3) / 3);
|
|
496
|
+
return [convertToCST(dayjs().quarter(currentQuarter).startOf("quarter").toDate()), convertToCST(dayjs().quarter(currentQuarter).endOf("quarter").toDate())];
|
|
497
|
+
};
|
|
498
|
+
return fn();
|
|
624
499
|
}
|
|
625
500
|
function LASTQUARTER() {
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
const endOfLastQuarter = convertToCST(
|
|
632
|
-
dayjs().quarter(currentQuarter - 1).endOf("quarter").toDate()
|
|
633
|
-
);
|
|
634
|
-
return [startOfLastQuarter, endOfLastQuarter];
|
|
635
|
-
};
|
|
636
|
-
const isLastQuarter = fn;
|
|
637
|
-
return isLastQuarter();
|
|
501
|
+
const fn = () => {
|
|
502
|
+
const currentQuarter = Math.floor((dayjs().month() + 3) / 3);
|
|
503
|
+
return [convertToCST(dayjs().quarter(currentQuarter - 1).startOf("quarter").toDate()), convertToCST(dayjs().quarter(currentQuarter - 1).endOf("quarter").toDate())];
|
|
504
|
+
};
|
|
505
|
+
return fn();
|
|
638
506
|
}
|
|
639
507
|
function ISDATERANGE(v, r) {
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
return isDateRangFn();
|
|
508
|
+
const fn = () => {
|
|
509
|
+
const [startDate, endDate] = r;
|
|
510
|
+
return v >= startDate && v <= endDate;
|
|
511
|
+
};
|
|
512
|
+
return fn();
|
|
646
513
|
}
|
|
647
514
|
function ISTIMERANGE(v, r) {
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
};
|
|
659
|
-
const isTimeRangFn = fn;
|
|
660
|
-
return isTimeRangFn();
|
|
515
|
+
const fn = () => {
|
|
516
|
+
const [startTime, endTime] = r;
|
|
517
|
+
const dtTime = dayjs(v, "HH:mm");
|
|
518
|
+
if (startTime > endTime) {
|
|
519
|
+
const startTimeAfterMidnight = dayjs(startTime, "HH:mm");
|
|
520
|
+
const endTimeBeforeMidnight = dayjs(endTime, "HH:mm").add(1, "day");
|
|
521
|
+
return dtTime >= startTimeAfterMidnight || dtTime <= endTimeBeforeMidnight;
|
|
522
|
+
} else return dtTime >= dayjs(startTime, "HH:mm") && dtTime <= dayjs(endTime, "HH:mm");
|
|
523
|
+
};
|
|
524
|
+
return fn();
|
|
661
525
|
}
|
|
662
526
|
function convertToCST(isoDateString) {
|
|
663
|
-
|
|
664
|
-
return cstFormattedDate;
|
|
527
|
+
return dayjs(isoDateString).tz("America/Chicago").format("YYYY-MM-DD HH:mm:ss.SSSSSSSSS ZZ");
|
|
665
528
|
}
|
|
666
529
|
function TUPLE(...args) {
|
|
667
|
-
|
|
530
|
+
return [...args];
|
|
668
531
|
}
|
|
669
532
|
function SEQMAP(...args) {
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
return map;
|
|
533
|
+
const len = (args.length - args.length % 2) / 2;
|
|
534
|
+
const map = {};
|
|
535
|
+
Array(len).forEach((i) => {
|
|
536
|
+
const key = args[i * 2];
|
|
537
|
+
map[key] = args[i * 2 + 1];
|
|
538
|
+
});
|
|
539
|
+
return map;
|
|
678
540
|
}
|
|
679
541
|
function SUMSQ(...args) {
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
542
|
+
args = args.flat().filter((i) => i !== "" && i !== null && i !== void 0);
|
|
543
|
+
if (args.length === 0) return "";
|
|
544
|
+
return args.map((value) => {
|
|
545
|
+
const square = multipliedBy(value, value);
|
|
546
|
+
return square !== "" ? square : new BigNumberJS(0).toNumber();
|
|
547
|
+
}).reduce((sum, square) => {
|
|
548
|
+
return plus(sum, square) || BigNumberJS(0).toNumber();
|
|
549
|
+
}, new BigNumberJS(0).toNumber());
|
|
550
|
+
}
|
|
551
|
+
/**数组计数 */
|
|
690
552
|
function COUNT(v) {
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
}
|
|
694
|
-
return v.length;
|
|
553
|
+
if (!Array.isArray(v)) return "";
|
|
554
|
+
return v.length;
|
|
695
555
|
}
|
|
556
|
+
/**标准差函数 */
|
|
696
557
|
function STDEV(...args) {
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
}, 0) / (data.length - 1);
|
|
706
|
-
return Math.sqrt(variance);
|
|
558
|
+
const data = args.flat().map((v) => Number(v)).filter((v) => Number.isFinite(v));
|
|
559
|
+
if (data.length < 2) return "";
|
|
560
|
+
const mean = data.reduce((sum, val) => sum + val, 0) / data.length;
|
|
561
|
+
const variance = data.reduce((sum, val) => {
|
|
562
|
+
const diff = val - mean;
|
|
563
|
+
return sum + diff * diff;
|
|
564
|
+
}, 0) / (data.length - 1);
|
|
565
|
+
return Math.sqrt(variance);
|
|
707
566
|
}
|
|
708
567
|
function plus(a, b) {
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
568
|
+
const result = new BigNumberJS(a).plus(new BigNumberJS(b)).toNumber();
|
|
569
|
+
if (isNaN(result)) return "";
|
|
570
|
+
return result;
|
|
712
571
|
}
|
|
713
572
|
function minus(a, b) {
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
573
|
+
const result = new BigNumberJS(a).minus(new BigNumberJS(b)).toNumber();
|
|
574
|
+
if (isNaN(result)) return "";
|
|
575
|
+
return result;
|
|
717
576
|
}
|
|
718
577
|
function multipliedBy(a, b) {
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
578
|
+
const result = new BigNumberJS(a).multipliedBy(new BigNumberJS(b)).toNumber();
|
|
579
|
+
if (isNaN(result)) return "";
|
|
580
|
+
return result;
|
|
722
581
|
}
|
|
723
582
|
function div(a, b) {
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
583
|
+
const result = new BigNumberJS(a).div(new BigNumberJS(b)).toNumber();
|
|
584
|
+
if (isNaN(result)) return "";
|
|
585
|
+
return result;
|
|
727
586
|
}
|
|
728
|
-
|
|
729
|
-
export {
|
|
587
|
+
//#endregion
|
|
588
|
+
export { methods_exports };
|