@verbb/formie-core 1.0.15 → 1.0.16
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/CHANGELOG.md +8 -0
- package/dist/calculations.d.ts +4 -0
- package/dist/calculations.d.ts.map +1 -1
- package/dist/index.js +65 -63
- package/package.json +45 -45
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
## 1.0.16 - 2026-10-28
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
- Updated the package build toolchain to Vite 8.3.4.
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- Fixed calculations using formatted calculation values as numeric inputs.
|
|
12
|
+
|
|
5
13
|
## 1.0.15 - 2026-10-15
|
|
6
14
|
|
|
7
15
|
### Changed
|
package/dist/calculations.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calculations.d.ts","sourceRoot":"","sources":["../src/calculations.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,mBAAmB,GAAG;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"calculations.d.ts","sourceRoot":"","sources":["../src/calculations.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,mBAAmB,GAAG;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,E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M,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,OAAO,EAAE,kBAAkB,GAC5B,MAAM,GAAG,MAAM,CAEjB"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region \0rolldown/runtime.js
|
|
2
|
-
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, i, o, s) => {
|
|
2
|
+
var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t, t.exports), e = null), t.exports), s = (e, i, o, s) => {
|
|
3
3
|
if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
|
|
4
4
|
get: ((e) => i[e]).bind(null, d),
|
|
5
5
|
enumerable: !(s = n(i, d)) || s.enumerable
|
|
@@ -789,9 +789,7 @@ function K(e, t, n, r, i) {
|
|
|
789
789
|
a.forEach((e) => {
|
|
790
790
|
e.meta?.hidden !== !0 && K(e, o[e.handle], n, `${r}.${e.handle}`, i);
|
|
791
791
|
}), Oe(e, o, r, i);
|
|
792
|
-
|
|
793
|
-
}
|
|
794
|
-
if (D(e)) {
|
|
792
|
+
} else if (D(e)) {
|
|
795
793
|
let a = Array.isArray(t) ? t : [], o = M(e);
|
|
796
794
|
a.forEach((e, t) => {
|
|
797
795
|
let a = e && typeof e == "object" ? e : {};
|
|
@@ -941,7 +939,7 @@ function J({ envelope: e, transport: t }) {
|
|
|
941
939
|
values: o.values,
|
|
942
940
|
action: s
|
|
943
941
|
});
|
|
944
|
-
return l(f)
|
|
942
|
+
return l(f) || (c((e) => W({
|
|
945
943
|
...e,
|
|
946
944
|
status: "ready",
|
|
947
945
|
session: r.session ?? e.session,
|
|
@@ -951,7 +949,7 @@ function J({ envelope: e, transport: t }) {
|
|
|
951
949
|
})), n.emit("formie:submit:result", r), (r.currentPageId || r.nextPageId) && n.emit("formie:page:navigate", {
|
|
952
950
|
currentPageId: o.currentPageId,
|
|
953
951
|
nextPageId: r.nextPageId || r.currentPageId
|
|
954
|
-
}), r
|
|
952
|
+
})), r;
|
|
955
953
|
} catch (e) {
|
|
956
954
|
let t = e instanceof Error ? e.message : "Submission failed.", r = {
|
|
957
955
|
success: !1,
|
|
@@ -974,60 +972,59 @@ function J({ envelope: e, transport: t }) {
|
|
|
974
972
|
async setPage(e) {
|
|
975
973
|
if (o.status === "destroyed" || o.status === "submitting") return;
|
|
976
974
|
let r = ++a;
|
|
977
|
-
if (!t.setPage) {
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
session
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
}
|
|
986
|
-
}));
|
|
987
|
-
return;
|
|
988
|
-
}
|
|
989
|
-
c((e) => ({
|
|
990
|
-
...e,
|
|
991
|
-
status: "refreshing"
|
|
975
|
+
if (!t.setPage) c((t) => W({
|
|
976
|
+
...t,
|
|
977
|
+
status: "ready",
|
|
978
|
+
currentPageId: e,
|
|
979
|
+
session: {
|
|
980
|
+
...t.session,
|
|
981
|
+
currentPageId: e
|
|
982
|
+
}
|
|
992
983
|
}));
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
984
|
+
else {
|
|
985
|
+
c((e) => ({
|
|
986
|
+
...e,
|
|
987
|
+
status: "refreshing"
|
|
988
|
+
}));
|
|
989
|
+
try {
|
|
990
|
+
let i = await t.setPage({
|
|
991
|
+
definition: o.definition,
|
|
992
|
+
session: o.session,
|
|
993
|
+
values: o.values,
|
|
994
|
+
currentPageId: o.currentPageId,
|
|
995
|
+
targetPageId: e
|
|
996
|
+
});
|
|
997
|
+
if (l(r)) return;
|
|
998
|
+
if (!i.success || !i.session) {
|
|
999
|
+
c((e) => ({
|
|
1000
|
+
...e,
|
|
1001
|
+
status: "ready",
|
|
1002
|
+
errors: i.errors,
|
|
1003
|
+
lastSubmitResult: i
|
|
1004
|
+
})), n.emit("formie:submit:result", i);
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
let a = i.session;
|
|
1008
|
+
c((e) => W({
|
|
1004
1009
|
...e,
|
|
1005
1010
|
status: "ready",
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
})), n.emit("formie:
|
|
1009
|
-
|
|
1011
|
+
session: a,
|
|
1012
|
+
currentPageId: a.currentPageId
|
|
1013
|
+
})), n.emit("formie:page:navigate", {
|
|
1014
|
+
currentPageId: o.currentPageId,
|
|
1015
|
+
nextPageId: e
|
|
1016
|
+
});
|
|
1017
|
+
} catch (t) {
|
|
1018
|
+
let i = t instanceof Error ? t.message : "Unable to change page.";
|
|
1019
|
+
l(r) || (c((e) => ({
|
|
1020
|
+
...e,
|
|
1021
|
+
status: "ready"
|
|
1022
|
+
})), n.emit("formie:page:navigate:error", {
|
|
1023
|
+
currentPageId: o.currentPageId,
|
|
1024
|
+
nextPageId: e,
|
|
1025
|
+
error: i
|
|
1026
|
+
}));
|
|
1010
1027
|
}
|
|
1011
|
-
let a = i.session;
|
|
1012
|
-
c((e) => W({
|
|
1013
|
-
...e,
|
|
1014
|
-
status: "ready",
|
|
1015
|
-
session: a,
|
|
1016
|
-
currentPageId: a.currentPageId
|
|
1017
|
-
})), n.emit("formie:page:navigate", {
|
|
1018
|
-
currentPageId: o.currentPageId,
|
|
1019
|
-
nextPageId: e
|
|
1020
|
-
});
|
|
1021
|
-
} catch (t) {
|
|
1022
|
-
let i = t instanceof Error ? t.message : "Unable to change page.";
|
|
1023
|
-
l(r) || (c((e) => ({
|
|
1024
|
-
...e,
|
|
1025
|
-
status: "ready"
|
|
1026
|
-
})), n.emit("formie:page:navigate:error", {
|
|
1027
|
-
currentPageId: o.currentPageId,
|
|
1028
|
-
nextPageId: e,
|
|
1029
|
-
error: i
|
|
1030
|
-
}));
|
|
1031
1028
|
}
|
|
1032
1029
|
},
|
|
1033
1030
|
async refreshSession() {
|
|
@@ -1096,10 +1093,10 @@ var Y = [
|
|
|
1096
1093
|
"formie:session:refreshed",
|
|
1097
1094
|
"formie:session:refresh:error",
|
|
1098
1095
|
"formie:state:reset"
|
|
1099
|
-
], Ne = /* @__PURE__ */ c((/* @__PURE__ */ o(((e, t) => {
|
|
1096
|
+
], Ne = /* @__PURE__ */ c((/* @__PURE__ */ o(((e, t, n) => {
|
|
1100
1097
|
(function(n, r) {
|
|
1101
1098
|
typeof e == "object" && t !== void 0 ? r(e) : typeof define == "function" && define.amd ? define(["exports"], r) : r((n = typeof globalThis < "u" ? globalThis : n || self).ExpressionLanguage = {});
|
|
1102
|
-
})(
|
|
1099
|
+
})(n, function(e) {
|
|
1103
1100
|
function t(e, t, n) {
|
|
1104
1101
|
return (t = function(e) {
|
|
1105
1102
|
var t = function(e, t) {
|
|
@@ -1110,7 +1107,7 @@ var Y = [
|
|
|
1110
1107
|
if (typeof r != "object") return r;
|
|
1111
1108
|
throw TypeError("@@toPrimitive must return a primitive value.");
|
|
1112
1109
|
}
|
|
1113
|
-
return
|
|
1110
|
+
return String(e);
|
|
1114
1111
|
}(e, "string");
|
|
1115
1112
|
return typeof t == "symbol" ? t : t + "";
|
|
1116
1113
|
}(t)) in e ? Object.defineProperty(e, t, {
|
|
@@ -3979,7 +3976,7 @@ var Y = [
|
|
|
3979
3976
|
e in n || (n[e] = t[e]);
|
|
3980
3977
|
}), e.ExpressionLanguage = n;
|
|
3981
3978
|
}
|
|
3982
|
-
}(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self :
|
|
3979
|
+
}(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : n);
|
|
3983
3980
|
})))(), 1), Pe = null;
|
|
3984
3981
|
function Fe() {
|
|
3985
3982
|
let e = Ne, t = e.ExpressionLanguage || e.default || Ne;
|
|
@@ -4000,9 +3997,7 @@ function Z(e, t) {
|
|
|
4000
3997
|
if (Array.isArray(n)) {
|
|
4001
3998
|
let r = n.map((e) => typeof e == "string" && e.trim() !== "" && !Number.isNaN(Number(e)) ? Number(e) : e), i = r.filter((e) => typeof e == "number");
|
|
4002
3999
|
e[t] = i.length === r.length && r.length > 0 ? i.reduce((e, t) => e + Number(t || 0), 0) : r;
|
|
4003
|
-
|
|
4004
|
-
}
|
|
4005
|
-
typeof n == "string" && n.trim() !== "" && !Number.isNaN(Number(n)) && (e[t] = Number(n));
|
|
4000
|
+
} else typeof n == "string" && n.trim() !== "" && !Number.isNaN(Number(n)) && (e[t] = Number(n));
|
|
4006
4001
|
}), e;
|
|
4007
4002
|
}
|
|
4008
4003
|
function Q(e, t) {
|
|
@@ -4013,6 +4008,13 @@ function Q(e, t) {
|
|
|
4013
4008
|
return `${t.prefix || ""}${i}${t.suffix || ""}`;
|
|
4014
4009
|
}
|
|
4015
4010
|
function Re(e, t) {
|
|
4011
|
+
if (e.numberFormat) {
|
|
4012
|
+
let { prefix: n = "", suffix: r = "" } = e.numberFormat, i = (e) => {
|
|
4013
|
+
let t = e;
|
|
4014
|
+
return n && t.startsWith(n) && (t = t.slice(n.length)), r && t.endsWith(r) && (t = t.slice(0, -r.length)), Number(t || 0);
|
|
4015
|
+
};
|
|
4016
|
+
return Array.isArray(t) ? t.map(i) : i(t);
|
|
4017
|
+
}
|
|
4016
4018
|
let n = e.type?.endsWith("\\Number");
|
|
4017
4019
|
return e.type?.endsWith("\\Checkboxes") ? Array.isArray(t) ? t.length ? t : "" : t ? [t] : "" : Array.isArray(t) ? t.length ? n ? t.map((e) => Number(e || 0)) : t : "" : n ? Number(t || 0) : t;
|
|
4018
4020
|
}
|
package/package.json
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
"bugs": {
|
|
19
|
-
"url": "https://github.com/verbb/formie/issues"
|
|
20
|
-
},
|
|
21
|
-
"homepage": "https://docs.verbb.io/formie",
|
|
22
|
-
"engines": {
|
|
23
|
-
"node": ">=20.0.0"
|
|
24
|
-
},
|
|
25
|
-
"sideEffects": false,
|
|
26
|
-
"exports": {
|
|
27
|
-
".": {
|
|
28
|
-
"types": "./dist/index.d.ts",
|
|
29
|
-
"import": "./dist/index.js"
|
|
2
|
+
"name": "@verbb/formie-core",
|
|
3
|
+
"version": "1.0.16",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"module": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"CHANGELOG.md",
|
|
11
|
+
"LICENSE.md"
|
|
12
|
+
],
|
|
13
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "git+https://github.com/verbb/formie.git"
|
|
30
17
|
},
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"
|
|
47
|
-
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/verbb/formie/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://docs.verbb.io/formie",
|
|
22
|
+
"engines": {
|
|
23
|
+
"node": ">=20.0.0"
|
|
24
|
+
},
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./package.json": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "node ../../scripts/build-condition-schema.mjs && vite build && npx tsc -p tsconfig.json",
|
|
38
|
+
"test": "vitest run"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"expression-language": "^2.5.4"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"typescript": "^6.0.3",
|
|
45
|
+
"vite": "^8.3.5",
|
|
46
|
+
"vitest": "^4.1.11"
|
|
47
|
+
}
|
|
48
48
|
}
|