@gct-paas/render 0.1.4-dev.8 → 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 +13 -0
- package/es/Event/Dependency/controller.mjs +84 -0
- package/es/Event/Dependency/displayRule.d.ts +19 -0
- package/es/Event/Dependency/displayRule.mjs +138 -0
- package/es/Event/Dependency/useDependency.d.ts +7 -0
- package/es/Event/Dependency/useDependency.mjs +117 -0
- package/es/Event/Dependency/useDependencyToShow.d.ts +10 -0
- package/es/Event/Dependency/useDependencyToShow.mjs +113 -0
- package/es/Event/baseEvent.d.ts +156 -0
- package/es/Event/baseEvent.mjs +389 -0
- package/es/Event/bizServiceRequest.d.ts +26 -0
- package/es/Event/bizServiceRequest.mjs +35 -0
- package/es/Event/eventType.d.ts +20 -0
- package/es/Event/eventType.mjs +1 -0
- package/es/Event/index.d.ts +7 -0
- package/es/Event/index.mjs +7 -0
- package/es/Event/utils/appRedis.d.ts +29 -0
- package/es/Event/utils/appRedis.mjs +40 -0
- package/es/Event/utils/globalLoading.d.ts +13 -0
- package/es/Event/utils/globalLoading.mjs +104 -0
- package/es/Event/utils/processRovedInfo.d.ts +100 -0
- package/es/Event/utils/processRovedInfo.mjs +231 -0
- package/es/Event/utils/runGlobalByPage.d.ts +335 -0
- package/es/Event/utils/runGlobalByPage.mjs +302 -0
- package/es/Event/utils/verificationVar.d.ts +2 -0
- package/es/Event/utils/verificationVar.mjs +36 -0
- 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.d.ts +14 -0
- package/es/enums/index.mjs +18 -0
- 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.d.ts +9 -0
- package/es/hooks/useStorageRef.mjs +37 -0
- package/es/index.d.ts +6 -0
- package/es/index.mjs +36 -1
- 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 +2 -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.d.ts +54 -0
- package/es/register/render-register/render-register.mjs +64 -0
- 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/types/index.d.ts +6 -0
- package/es/utils/cacheAdapter.d.ts +7 -0
- package/es/utils/cacheAdapter.mjs +65 -0
- package/es/utils/expression/index.d.ts +6 -0
- package/es/utils/expression/index.mjs +116 -0
- package/es/utils/expression/regularExpression/methods.d.ts +77 -0
- package/es/utils/expression/regularExpression/methods.mjs +588 -0
- package/es/utils/field-attrs/basicAttrs.mjs +56 -80
- package/es/utils/field-attrs/index.d.ts +1 -1
- package/es/utils/field-attrs/index.mjs +16 -13
- package/es/utils/get-ref-data.d.ts +1 -0
- package/es/utils/get-ref-data.mjs +44 -0
- package/es/utils/getFieldSchema.d.ts +1 -3
- package/es/utils/getFieldSchema.mjs +69 -0
- package/es/utils/index.d.ts +8 -0
- package/es/utils/index.mjs +11 -0
- package/es/utils/model-transformer.d.ts +46 -0
- package/es/utils/model-transformer.mjs +87 -0
- 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 +21 -0
- package/es/utils/useStyle.mjs +22 -0
- package/package.json +33 -11
- package/dist/index.esm.min.mjs +0 -89
- package/dist/index.min.cjs +0 -1
- package/dist/index.system.min.js +0 -1
|
@@ -0,0 +1,588 @@
|
|
|
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
|
+
});
|
|
86
|
+
dayjs.extend(utc);
|
|
87
|
+
dayjs.extend(timezone);
|
|
88
|
+
dayjs.extend(quarterOfYear);
|
|
89
|
+
dayjs.extend(toArray);
|
|
90
|
+
dayjs.extend(isoWeek);
|
|
91
|
+
function IF(expr, v, l) {
|
|
92
|
+
const fn = () => {
|
|
93
|
+
return expr ? v : l;
|
|
94
|
+
};
|
|
95
|
+
return fn();
|
|
96
|
+
}
|
|
97
|
+
function ISEMPTY(v) {
|
|
98
|
+
const func = () => v == null || v === "" || v === 0;
|
|
99
|
+
return func();
|
|
100
|
+
}
|
|
101
|
+
function ISNULL(v) {
|
|
102
|
+
const func = () => isNull(v);
|
|
103
|
+
return func();
|
|
104
|
+
}
|
|
105
|
+
function ISUNDEFINED(v) {
|
|
106
|
+
const func = () => isUndefined(v);
|
|
107
|
+
return func();
|
|
108
|
+
}
|
|
109
|
+
function AND(...e) {
|
|
110
|
+
const func = () => {
|
|
111
|
+
for (const i of e) if (!i) return false;
|
|
112
|
+
return true;
|
|
113
|
+
};
|
|
114
|
+
return func();
|
|
115
|
+
}
|
|
116
|
+
function OR(...e) {
|
|
117
|
+
const func = () => e.some((i) => i);
|
|
118
|
+
return func();
|
|
119
|
+
}
|
|
120
|
+
function EQ(v, o) {
|
|
121
|
+
const func = () => isEqual(v, o);
|
|
122
|
+
return func();
|
|
123
|
+
}
|
|
124
|
+
function NE(v, o) {
|
|
125
|
+
const func = () => v !== o;
|
|
126
|
+
return func();
|
|
127
|
+
}
|
|
128
|
+
function LE(v, o) {
|
|
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();
|
|
135
|
+
}
|
|
136
|
+
function LT(v, o) {
|
|
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();
|
|
142
|
+
}
|
|
143
|
+
function GE(v, o) {
|
|
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();
|
|
150
|
+
}
|
|
151
|
+
function GT(v, o) {
|
|
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();
|
|
158
|
+
}
|
|
159
|
+
function LEN(v) {
|
|
160
|
+
const fn = () => v?.length || 0;
|
|
161
|
+
return fn();
|
|
162
|
+
}
|
|
163
|
+
function CONCAT(...args) {
|
|
164
|
+
const fn = () => args.join("");
|
|
165
|
+
return fn();
|
|
166
|
+
}
|
|
167
|
+
function SUBSTRING(v = "", s, e) {
|
|
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();
|
|
173
|
+
}
|
|
174
|
+
function SUBSTR(v = "", s, l) {
|
|
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();
|
|
180
|
+
}
|
|
181
|
+
function UPPER(v = "") {
|
|
182
|
+
const fn = () => v.toUpperCase();
|
|
183
|
+
return fn();
|
|
184
|
+
}
|
|
185
|
+
function LOWER(v = "") {
|
|
186
|
+
const fn = () => v.toLowerCase();
|
|
187
|
+
return fn();
|
|
188
|
+
}
|
|
189
|
+
function TRIM(v = "") {
|
|
190
|
+
const fn = () => v.trim();
|
|
191
|
+
return fn();
|
|
192
|
+
}
|
|
193
|
+
function LTRIM(v = "") {
|
|
194
|
+
const fn = () => v.replace(/^\s\s*/, "");
|
|
195
|
+
return fn();
|
|
196
|
+
}
|
|
197
|
+
function RTRIM(v = "") {
|
|
198
|
+
const fn = () => v.replace(/\s\s*$/, "");
|
|
199
|
+
return fn();
|
|
200
|
+
}
|
|
201
|
+
function REPEAT(v = "", c = "") {
|
|
202
|
+
const fn = () => v.match(new RegExp(c, "g"))?.length || null;
|
|
203
|
+
return fn();
|
|
204
|
+
}
|
|
205
|
+
function REPLACE(v = "", o = "", t = "") {
|
|
206
|
+
const fn = () => v.replace(new RegExp(o, "g"), t);
|
|
207
|
+
return fn();
|
|
208
|
+
}
|
|
209
|
+
function FINDSTR(v = "", c = "") {
|
|
210
|
+
const fn = () => v.includes(c);
|
|
211
|
+
return fn();
|
|
212
|
+
}
|
|
213
|
+
function SEARCHSTR(v = "", c = "") {
|
|
214
|
+
const fn = () => {
|
|
215
|
+
const l = v.match(new RegExp(c, "g"))?.length;
|
|
216
|
+
return l ? l : 0;
|
|
217
|
+
};
|
|
218
|
+
return fn();
|
|
219
|
+
}
|
|
220
|
+
function PARSENUMBER(v = "") {
|
|
221
|
+
const fn = () => {
|
|
222
|
+
const num = parseFloat(v);
|
|
223
|
+
return isNaN(num) ? null : num;
|
|
224
|
+
};
|
|
225
|
+
return fn();
|
|
226
|
+
}
|
|
227
|
+
function SPLIT(v = "", c = "") {
|
|
228
|
+
const fn = () => v.split(c);
|
|
229
|
+
return fn();
|
|
230
|
+
}
|
|
231
|
+
function SUM(...args) {
|
|
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();
|
|
236
|
+
}
|
|
237
|
+
function ADD(...args) {
|
|
238
|
+
const v = args.flat();
|
|
239
|
+
const fn = () => v.reduce(plus, 0);
|
|
240
|
+
return fn();
|
|
241
|
+
}
|
|
242
|
+
function REDUCE(v, ...args) {
|
|
243
|
+
const fn = () => args.reduce(minus, v);
|
|
244
|
+
return fn();
|
|
245
|
+
}
|
|
246
|
+
function MULTIPLICATION(val, ...args) {
|
|
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();
|
|
251
|
+
}
|
|
252
|
+
function DIVISION(v, ...args) {
|
|
253
|
+
const fn = () => args.reduce(div, v);
|
|
254
|
+
return fn();
|
|
255
|
+
}
|
|
256
|
+
function FIXED(v, n) {
|
|
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();
|
|
270
|
+
}
|
|
271
|
+
function ROUND(v, n) {
|
|
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();
|
|
282
|
+
}
|
|
283
|
+
function ROUNDUP(v, n) {
|
|
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();
|
|
288
|
+
}
|
|
289
|
+
function MAX(...args) {
|
|
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
|
+
}
|
|
295
|
+
function LARGE(v, n) {
|
|
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();
|
|
301
|
+
}
|
|
302
|
+
function MIN(...args) {
|
|
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();
|
|
307
|
+
}
|
|
308
|
+
function SMALL(v, n) {
|
|
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();
|
|
314
|
+
}
|
|
315
|
+
function AVERAGE(...args) {
|
|
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();
|
|
322
|
+
}
|
|
323
|
+
function ABS(v) {
|
|
324
|
+
const fn = () => Math.abs.call(null, v);
|
|
325
|
+
return fn();
|
|
326
|
+
}
|
|
327
|
+
function MOD(v, n) {
|
|
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();
|
|
335
|
+
}
|
|
336
|
+
function toSafeNumber(x) {
|
|
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;
|
|
349
|
+
}
|
|
350
|
+
function POWER(v, n) {
|
|
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();
|
|
359
|
+
}
|
|
360
|
+
function SQRT(v) {
|
|
361
|
+
const fn = () => {
|
|
362
|
+
const n = toSafeNumber(v);
|
|
363
|
+
if (n === null) return NaN;
|
|
364
|
+
return Math.sqrt(n);
|
|
365
|
+
};
|
|
366
|
+
return fn();
|
|
367
|
+
}
|
|
368
|
+
function GET(v, p) {
|
|
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();
|
|
377
|
+
}
|
|
378
|
+
function PUT(a, b, c) {
|
|
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();
|
|
388
|
+
}
|
|
389
|
+
function PUSH(v, n) {
|
|
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();
|
|
396
|
+
}
|
|
397
|
+
function HEADPUSH(v, n) {
|
|
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();
|
|
404
|
+
}
|
|
405
|
+
function TIMESTAMP2DATE(v) {
|
|
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();
|
|
413
|
+
}
|
|
414
|
+
function DATE2TIMESTAMP(v) {
|
|
415
|
+
if (!v) return;
|
|
416
|
+
const fn = () => dayjs(v).unix();
|
|
417
|
+
return fn();
|
|
418
|
+
}
|
|
419
|
+
function DATEFORMAT(v, f) {
|
|
420
|
+
if (!v) return;
|
|
421
|
+
const fn = () => dayjs(v).format(f);
|
|
422
|
+
return fn();
|
|
423
|
+
}
|
|
424
|
+
function NOW() {
|
|
425
|
+
return dayjs().format("YYYY-MM-DD HH:MM:ss");
|
|
426
|
+
}
|
|
427
|
+
function TODAY() {
|
|
428
|
+
return dayjs().format("YYYY-MM-DD");
|
|
429
|
+
}
|
|
430
|
+
function YEAR(v) {
|
|
431
|
+
return dayjs(v).year();
|
|
432
|
+
}
|
|
433
|
+
function MONTH(v) {
|
|
434
|
+
const fn = () => {
|
|
435
|
+
return dayjs(v).month();
|
|
436
|
+
};
|
|
437
|
+
return fn();
|
|
438
|
+
}
|
|
439
|
+
function DAY(v) {
|
|
440
|
+
const fn = () => {
|
|
441
|
+
return dayjs(v).day();
|
|
442
|
+
};
|
|
443
|
+
return fn();
|
|
444
|
+
}
|
|
445
|
+
function HOUR(v) {
|
|
446
|
+
const fn = () => {
|
|
447
|
+
return dayjs(v).hour();
|
|
448
|
+
};
|
|
449
|
+
return fn();
|
|
450
|
+
}
|
|
451
|
+
function MINUTE(v) {
|
|
452
|
+
const fn = () => {
|
|
453
|
+
return dayjs(v).minute();
|
|
454
|
+
};
|
|
455
|
+
return fn();
|
|
456
|
+
}
|
|
457
|
+
function WEEKRANGE() {
|
|
458
|
+
const fn = () => {
|
|
459
|
+
return [convertToCST(dayjs().startOf("week").toDate()), convertToCST(dayjs().endOf("week").toDate())];
|
|
460
|
+
};
|
|
461
|
+
return fn();
|
|
462
|
+
}
|
|
463
|
+
function LASTWEEKRANGE() {
|
|
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();
|
|
468
|
+
}
|
|
469
|
+
function MONTHRANGE() {
|
|
470
|
+
const fn = () => {
|
|
471
|
+
return [convertToCST(dayjs().startOf("month").toDate()), convertToCST(dayjs().endOf("month").toDate())];
|
|
472
|
+
};
|
|
473
|
+
return fn();
|
|
474
|
+
}
|
|
475
|
+
function LASTMONTHRANGE() {
|
|
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();
|
|
480
|
+
}
|
|
481
|
+
function YEARRANGE() {
|
|
482
|
+
const fn = () => {
|
|
483
|
+
return [convertToCST(dayjs().startOf("year").toDate()), convertToCST(dayjs().endOf("year").toDate())];
|
|
484
|
+
};
|
|
485
|
+
return fn();
|
|
486
|
+
}
|
|
487
|
+
function LASTYEARRANGE() {
|
|
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();
|
|
492
|
+
}
|
|
493
|
+
function QUARTER() {
|
|
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();
|
|
499
|
+
}
|
|
500
|
+
function LASTQUARTER() {
|
|
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();
|
|
506
|
+
}
|
|
507
|
+
function ISDATERANGE(v, r) {
|
|
508
|
+
const fn = () => {
|
|
509
|
+
const [startDate, endDate] = r;
|
|
510
|
+
return v >= startDate && v <= endDate;
|
|
511
|
+
};
|
|
512
|
+
return fn();
|
|
513
|
+
}
|
|
514
|
+
function ISTIMERANGE(v, r) {
|
|
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();
|
|
525
|
+
}
|
|
526
|
+
function convertToCST(isoDateString) {
|
|
527
|
+
return dayjs(isoDateString).tz("America/Chicago").format("YYYY-MM-DD HH:mm:ss.SSSSSSSSS ZZ");
|
|
528
|
+
}
|
|
529
|
+
function TUPLE(...args) {
|
|
530
|
+
return [...args];
|
|
531
|
+
}
|
|
532
|
+
function SEQMAP(...args) {
|
|
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;
|
|
540
|
+
}
|
|
541
|
+
function SUMSQ(...args) {
|
|
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
|
+
/**数组计数 */
|
|
552
|
+
function COUNT(v) {
|
|
553
|
+
if (!Array.isArray(v)) return "";
|
|
554
|
+
return v.length;
|
|
555
|
+
}
|
|
556
|
+
/**标准差函数 */
|
|
557
|
+
function STDEV(...args) {
|
|
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);
|
|
566
|
+
}
|
|
567
|
+
function plus(a, b) {
|
|
568
|
+
const result = new BigNumberJS(a).plus(new BigNumberJS(b)).toNumber();
|
|
569
|
+
if (isNaN(result)) return "";
|
|
570
|
+
return result;
|
|
571
|
+
}
|
|
572
|
+
function minus(a, b) {
|
|
573
|
+
const result = new BigNumberJS(a).minus(new BigNumberJS(b)).toNumber();
|
|
574
|
+
if (isNaN(result)) return "";
|
|
575
|
+
return result;
|
|
576
|
+
}
|
|
577
|
+
function multipliedBy(a, b) {
|
|
578
|
+
const result = new BigNumberJS(a).multipliedBy(new BigNumberJS(b)).toNumber();
|
|
579
|
+
if (isNaN(result)) return "";
|
|
580
|
+
return result;
|
|
581
|
+
}
|
|
582
|
+
function div(a, b) {
|
|
583
|
+
const result = new BigNumberJS(a).div(new BigNumberJS(b)).toNumber();
|
|
584
|
+
if (isNaN(result)) return "";
|
|
585
|
+
return result;
|
|
586
|
+
}
|
|
587
|
+
//#endregion
|
|
588
|
+
export { methods_exports };
|