@abgov/jsonforms-components 2.68.1 → 2.70.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/index.esm.js +938 -69
- package/package.json +2 -2
- package/renderer-catalog.json +2 -2
- package/src/lib/Controls/FormStepper/context/reducer.d.ts +2 -1
- package/src/lib/Controls/FormStepper/context/types.d.ts +10 -0
- package/src/lib/Controls/FormStepper/context/util.d.ts +7 -9
- package/src/lib/Controls/FormStepper/util/conditionalDeps.d.ts +2 -1
- package/src/lib/common/Constants.d.ts +6 -0
package/index.esm.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { jsx, Fragment
|
|
2
|
-
import React, { useContext, useReducer, useMemo,
|
|
3
|
-
import { GoabFormItem, GoabDropdown, GoabDropdownItem, GoabInput, GoabTextArea, GoabCallout, GoabRadioGroup, GoabRadioItem, GoabCheckbox, GoabIcon, GoabButton, GoabTable, GoabGrid, GoabIconButton, GoabModal, GoabButtonGroup, GoabContainer, GoabDetails, GoabFormStepper, GoabFormStep, GoabPages, GoabBadge, GoabText, GoabFileUploadInput, GoabCircularProgress, GoabSpinner } from '@abgov/react-components';
|
|
1
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import React, { useRef, useEffect, useContext, useReducer, useMemo, createContext, useCallback, useState, useLayoutEffect } from 'react';
|
|
4
3
|
import Ajv from 'ajv';
|
|
5
4
|
import styled from 'styled-components';
|
|
6
5
|
import axios from 'axios';
|
|
@@ -15,6 +14,7 @@ import merge from 'lodash/merge';
|
|
|
15
14
|
import isEmpty$1 from 'lodash/isEmpty';
|
|
16
15
|
import range from 'lodash/range';
|
|
17
16
|
import pluralize from 'pluralize';
|
|
17
|
+
import { GoabTable as GoabTable$1, GoabGrid as GoabGrid$1, GoabContainer as GoabContainer$1 } from '@abgov/react-components';
|
|
18
18
|
import { compileSync } from '@mdx-js/mdx';
|
|
19
19
|
import ReactMarkdown from 'react-markdown';
|
|
20
20
|
import rehypeSanitize, { defaultSchema } from 'rehype-sanitize';
|
|
@@ -1826,6 +1826,759 @@ $$J({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
|
|
|
1826
1826
|
}
|
|
1827
1827
|
});
|
|
1828
1828
|
|
|
1829
|
+
const lowercase = (input) => input.toLowerCase();
|
|
1830
|
+
function transformProps(props, transform = lowercase) {
|
|
1831
|
+
const result = {};
|
|
1832
|
+
for (const [key, value] of Object.entries(props)) {
|
|
1833
|
+
if (value === void 0) continue;
|
|
1834
|
+
if (key.startsWith("data-")) {
|
|
1835
|
+
result[key] = value;
|
|
1836
|
+
} else {
|
|
1837
|
+
result[transform(key)] = value;
|
|
1838
|
+
}
|
|
1839
|
+
}
|
|
1840
|
+
return result;
|
|
1841
|
+
}
|
|
1842
|
+
|
|
1843
|
+
function getIconValue(icon, iconType) {
|
|
1844
|
+
if (icon !== void 0) {
|
|
1845
|
+
return icon ? "true" : "false";
|
|
1846
|
+
}
|
|
1847
|
+
return iconType ? "true" : "false";
|
|
1848
|
+
}
|
|
1849
|
+
function GoabBadge({ icon, iconType, ...rest }) {
|
|
1850
|
+
const _props = transformProps(rest, lowercase);
|
|
1851
|
+
return /* @__PURE__ */ jsx(
|
|
1852
|
+
"goa-badge",
|
|
1853
|
+
{
|
|
1854
|
+
icon: getIconValue(icon, iconType),
|
|
1855
|
+
icontype: iconType,
|
|
1856
|
+
..._props
|
|
1857
|
+
}
|
|
1858
|
+
);
|
|
1859
|
+
}
|
|
1860
|
+
function GoabButton({
|
|
1861
|
+
disabled,
|
|
1862
|
+
onClick,
|
|
1863
|
+
actionArgs,
|
|
1864
|
+
actionArg,
|
|
1865
|
+
children,
|
|
1866
|
+
...rest
|
|
1867
|
+
}) {
|
|
1868
|
+
const el = useRef(null);
|
|
1869
|
+
const _props = transformProps(rest, lowercase);
|
|
1870
|
+
useEffect(() => {
|
|
1871
|
+
if (!el.current) {
|
|
1872
|
+
return;
|
|
1873
|
+
}
|
|
1874
|
+
if (!onClick) {
|
|
1875
|
+
return;
|
|
1876
|
+
}
|
|
1877
|
+
const current = el.current;
|
|
1878
|
+
const listener = () => {
|
|
1879
|
+
onClick == null ? void 0 : onClick();
|
|
1880
|
+
};
|
|
1881
|
+
current.addEventListener("_click", listener);
|
|
1882
|
+
return () => {
|
|
1883
|
+
current.removeEventListener("_click", listener);
|
|
1884
|
+
};
|
|
1885
|
+
}, [el, onClick]);
|
|
1886
|
+
return /* @__PURE__ */ jsx(
|
|
1887
|
+
"goa-button",
|
|
1888
|
+
{
|
|
1889
|
+
ref: el,
|
|
1890
|
+
disabled: disabled ? "true" : void 0,
|
|
1891
|
+
"action-arg": actionArg,
|
|
1892
|
+
"action-args": JSON.stringify(actionArgs),
|
|
1893
|
+
..._props,
|
|
1894
|
+
children
|
|
1895
|
+
}
|
|
1896
|
+
);
|
|
1897
|
+
}
|
|
1898
|
+
function GoabButtonGroup({
|
|
1899
|
+
children,
|
|
1900
|
+
...rest
|
|
1901
|
+
}) {
|
|
1902
|
+
const _props = transformProps(rest, lowercase);
|
|
1903
|
+
return /* @__PURE__ */ jsx("goa-button-group", { ..._props, children });
|
|
1904
|
+
}
|
|
1905
|
+
const GoabCallout = ({
|
|
1906
|
+
type = "information",
|
|
1907
|
+
iconTheme = "outline",
|
|
1908
|
+
size = "large",
|
|
1909
|
+
ariaLive = "off",
|
|
1910
|
+
children,
|
|
1911
|
+
...rest
|
|
1912
|
+
}) => {
|
|
1913
|
+
const _props = transformProps(
|
|
1914
|
+
{ type, icontheme: iconTheme, size, arialive: ariaLive, ...rest },
|
|
1915
|
+
lowercase
|
|
1916
|
+
);
|
|
1917
|
+
return /* @__PURE__ */ jsx("goa-callout", { ..._props, children });
|
|
1918
|
+
};
|
|
1919
|
+
function GoabCheckbox({
|
|
1920
|
+
error,
|
|
1921
|
+
checked,
|
|
1922
|
+
indeterminate,
|
|
1923
|
+
disabled,
|
|
1924
|
+
value,
|
|
1925
|
+
description,
|
|
1926
|
+
reveal,
|
|
1927
|
+
onChange,
|
|
1928
|
+
name,
|
|
1929
|
+
children,
|
|
1930
|
+
...rest
|
|
1931
|
+
}) {
|
|
1932
|
+
const el = useRef(null);
|
|
1933
|
+
const _props = transformProps(rest, lowercase);
|
|
1934
|
+
useEffect(() => {
|
|
1935
|
+
if (!el.current) {
|
|
1936
|
+
return;
|
|
1937
|
+
}
|
|
1938
|
+
const current = el.current;
|
|
1939
|
+
const listener = (e) => {
|
|
1940
|
+
const detail = e.detail;
|
|
1941
|
+
onChange == null ? void 0 : onChange({ ...detail, event: e });
|
|
1942
|
+
};
|
|
1943
|
+
current.addEventListener("_change", listener);
|
|
1944
|
+
return () => {
|
|
1945
|
+
current.removeEventListener("_change", listener);
|
|
1946
|
+
};
|
|
1947
|
+
}, [name, onChange]);
|
|
1948
|
+
return /* @__PURE__ */ jsxs(
|
|
1949
|
+
"goa-checkbox",
|
|
1950
|
+
{
|
|
1951
|
+
ref: el,
|
|
1952
|
+
..._props,
|
|
1953
|
+
name,
|
|
1954
|
+
error: error ? "true" : void 0,
|
|
1955
|
+
checked: checked ? "true" : void 0,
|
|
1956
|
+
indeterminate: indeterminate ? "true" : void 0,
|
|
1957
|
+
disabled: disabled ? "true" : void 0,
|
|
1958
|
+
value: typeof value === "boolean" ? value ? "true" : void 0 : value,
|
|
1959
|
+
description: typeof description === "string" ? description : void 0,
|
|
1960
|
+
children: [
|
|
1961
|
+
children,
|
|
1962
|
+
typeof description !== "string" && description && /* @__PURE__ */ jsx("div", { slot: "description", children: description }),
|
|
1963
|
+
reveal && /* @__PURE__ */ jsx("div", { slot: "reveal", children: reveal })
|
|
1964
|
+
]
|
|
1965
|
+
}
|
|
1966
|
+
);
|
|
1967
|
+
}
|
|
1968
|
+
const GoabCircularProgress = ({
|
|
1969
|
+
visible,
|
|
1970
|
+
message,
|
|
1971
|
+
progress,
|
|
1972
|
+
variant,
|
|
1973
|
+
size,
|
|
1974
|
+
testId
|
|
1975
|
+
}) => {
|
|
1976
|
+
return /* @__PURE__ */ jsx(
|
|
1977
|
+
"goa-circular-progress",
|
|
1978
|
+
{
|
|
1979
|
+
visible: visible ? "true" : void 0,
|
|
1980
|
+
message,
|
|
1981
|
+
progress,
|
|
1982
|
+
variant,
|
|
1983
|
+
size,
|
|
1984
|
+
testid: testId
|
|
1985
|
+
}
|
|
1986
|
+
);
|
|
1987
|
+
};
|
|
1988
|
+
function GoabContainer({
|
|
1989
|
+
heading,
|
|
1990
|
+
title,
|
|
1991
|
+
actions,
|
|
1992
|
+
children,
|
|
1993
|
+
...rest
|
|
1994
|
+
}) {
|
|
1995
|
+
const _props = transformProps(rest, lowercase);
|
|
1996
|
+
const headingContent = heading || title;
|
|
1997
|
+
return /* @__PURE__ */ jsxs("goa-container", { ..._props, children: [
|
|
1998
|
+
headingContent && /* @__PURE__ */ jsx("div", { slot: "title", children: headingContent }),
|
|
1999
|
+
children,
|
|
2000
|
+
actions && /* @__PURE__ */ jsx("div", { slot: "actions", children: actions })
|
|
2001
|
+
] });
|
|
2002
|
+
}
|
|
2003
|
+
function GoabDetails({
|
|
2004
|
+
open,
|
|
2005
|
+
children,
|
|
2006
|
+
...rest
|
|
2007
|
+
}) {
|
|
2008
|
+
const _props = transformProps(rest, lowercase);
|
|
2009
|
+
return /* @__PURE__ */ jsx(
|
|
2010
|
+
"goa-details",
|
|
2011
|
+
{
|
|
2012
|
+
open: open ? "true" : void 0,
|
|
2013
|
+
..._props,
|
|
2014
|
+
children
|
|
2015
|
+
}
|
|
2016
|
+
);
|
|
2017
|
+
}
|
|
2018
|
+
function stringify(value) {
|
|
2019
|
+
if (typeof value === "undefined") {
|
|
2020
|
+
return "";
|
|
2021
|
+
}
|
|
2022
|
+
if (typeof value === "string") {
|
|
2023
|
+
return value;
|
|
2024
|
+
}
|
|
2025
|
+
return JSON.stringify(value);
|
|
2026
|
+
}
|
|
2027
|
+
function GoabDropdown({
|
|
2028
|
+
value,
|
|
2029
|
+
onChange,
|
|
2030
|
+
disabled,
|
|
2031
|
+
error,
|
|
2032
|
+
filterable,
|
|
2033
|
+
multiselect,
|
|
2034
|
+
native,
|
|
2035
|
+
relative,
|
|
2036
|
+
children,
|
|
2037
|
+
...rest
|
|
2038
|
+
}) {
|
|
2039
|
+
const el = useRef(null);
|
|
2040
|
+
const _props = transformProps(rest, lowercase);
|
|
2041
|
+
useEffect(() => {
|
|
2042
|
+
if (!el.current) {
|
|
2043
|
+
return;
|
|
2044
|
+
}
|
|
2045
|
+
const current = el.current;
|
|
2046
|
+
const handler = (e) => {
|
|
2047
|
+
const detail = e.detail;
|
|
2048
|
+
onChange == null ? void 0 : onChange({ ...detail, event: e });
|
|
2049
|
+
};
|
|
2050
|
+
if (onChange) {
|
|
2051
|
+
current.addEventListener("_change", handler);
|
|
2052
|
+
}
|
|
2053
|
+
return () => {
|
|
2054
|
+
if (onChange) {
|
|
2055
|
+
current.removeEventListener("_change", handler);
|
|
2056
|
+
}
|
|
2057
|
+
};
|
|
2058
|
+
}, [el, onChange]);
|
|
2059
|
+
return /* @__PURE__ */ jsx(
|
|
2060
|
+
"goa-dropdown",
|
|
2061
|
+
{
|
|
2062
|
+
ref: el,
|
|
2063
|
+
value: stringify(value),
|
|
2064
|
+
disabled: disabled ? "true" : void 0,
|
|
2065
|
+
error: error ? "true" : void 0,
|
|
2066
|
+
filterable: filterable ? "true" : void 0,
|
|
2067
|
+
multiselect: multiselect ? "true" : void 0,
|
|
2068
|
+
native: native ? "true" : void 0,
|
|
2069
|
+
relative: relative ? "true" : void 0,
|
|
2070
|
+
..._props,
|
|
2071
|
+
children
|
|
2072
|
+
}
|
|
2073
|
+
);
|
|
2074
|
+
}
|
|
2075
|
+
function GoabDropdownItem({
|
|
2076
|
+
value,
|
|
2077
|
+
label,
|
|
2078
|
+
filter,
|
|
2079
|
+
name,
|
|
2080
|
+
mountType = "append"
|
|
2081
|
+
}) {
|
|
2082
|
+
return /* @__PURE__ */ jsx(
|
|
2083
|
+
"goa-dropdown-item",
|
|
2084
|
+
{
|
|
2085
|
+
value,
|
|
2086
|
+
label,
|
|
2087
|
+
filter,
|
|
2088
|
+
name,
|
|
2089
|
+
mount: mountType
|
|
2090
|
+
}
|
|
2091
|
+
);
|
|
2092
|
+
}
|
|
2093
|
+
function GoabFileUploadInput({
|
|
2094
|
+
onSelectFile,
|
|
2095
|
+
...rest
|
|
2096
|
+
}) {
|
|
2097
|
+
const el = useRef(null);
|
|
2098
|
+
const _props = transformProps(rest, lowercase);
|
|
2099
|
+
useEffect(() => {
|
|
2100
|
+
if (!el.current) return;
|
|
2101
|
+
const current = el.current;
|
|
2102
|
+
const handler = (e) => {
|
|
2103
|
+
const detail = e.detail;
|
|
2104
|
+
onSelectFile({ ...detail, event: e });
|
|
2105
|
+
};
|
|
2106
|
+
current.addEventListener("_selectFile", handler);
|
|
2107
|
+
return () => {
|
|
2108
|
+
current.removeEventListener("_selectFile", handler);
|
|
2109
|
+
};
|
|
2110
|
+
}, [el, onSelectFile]);
|
|
2111
|
+
return /* @__PURE__ */ jsx("goa-file-upload-input", { ref: el, ..._props });
|
|
2112
|
+
}
|
|
2113
|
+
function GoabFormItem({
|
|
2114
|
+
error,
|
|
2115
|
+
helpText,
|
|
2116
|
+
publicFormSummaryOrder,
|
|
2117
|
+
children,
|
|
2118
|
+
...rest
|
|
2119
|
+
}) {
|
|
2120
|
+
const _props = transformProps(rest, lowercase);
|
|
2121
|
+
return /* @__PURE__ */ jsxs(
|
|
2122
|
+
"goa-form-item",
|
|
2123
|
+
{
|
|
2124
|
+
error: typeof error === "string" ? error : void 0,
|
|
2125
|
+
helptext: typeof helpText === "string" ? helpText : void 0,
|
|
2126
|
+
"public-form-summary-order": publicFormSummaryOrder,
|
|
2127
|
+
..._props,
|
|
2128
|
+
children: [
|
|
2129
|
+
error && typeof error !== "string" && /* @__PURE__ */ jsx("div", { slot: "error", children: error }),
|
|
2130
|
+
helpText && typeof helpText !== "string" && /* @__PURE__ */ jsx("div", { slot: "helptext", children: helpText }),
|
|
2131
|
+
children
|
|
2132
|
+
]
|
|
2133
|
+
}
|
|
2134
|
+
);
|
|
2135
|
+
}
|
|
2136
|
+
function GoabFormStep(props) {
|
|
2137
|
+
return /* @__PURE__ */ jsx("goa-form-step", { text: props.text, status: props.status });
|
|
2138
|
+
}
|
|
2139
|
+
function GoabFormStepper({
|
|
2140
|
+
testId,
|
|
2141
|
+
step,
|
|
2142
|
+
mt,
|
|
2143
|
+
mb,
|
|
2144
|
+
ml,
|
|
2145
|
+
mr,
|
|
2146
|
+
onChange,
|
|
2147
|
+
children
|
|
2148
|
+
}) {
|
|
2149
|
+
const ref = useRef(null);
|
|
2150
|
+
useEffect(() => {
|
|
2151
|
+
if (!ref.current) {
|
|
2152
|
+
return;
|
|
2153
|
+
}
|
|
2154
|
+
const current = ref.current;
|
|
2155
|
+
const changeListener = (e) => {
|
|
2156
|
+
const detail = e.detail;
|
|
2157
|
+
onChange == null ? void 0 : onChange(detail);
|
|
2158
|
+
};
|
|
2159
|
+
current.addEventListener("_change", changeListener);
|
|
2160
|
+
return () => {
|
|
2161
|
+
current.removeEventListener("_change", changeListener);
|
|
2162
|
+
};
|
|
2163
|
+
}, [ref, onChange]);
|
|
2164
|
+
return /* @__PURE__ */ jsx(
|
|
2165
|
+
"goa-form-stepper",
|
|
2166
|
+
{
|
|
2167
|
+
ref,
|
|
2168
|
+
testid: testId,
|
|
2169
|
+
step,
|
|
2170
|
+
mt,
|
|
2171
|
+
mr,
|
|
2172
|
+
mb,
|
|
2173
|
+
ml,
|
|
2174
|
+
children
|
|
2175
|
+
}
|
|
2176
|
+
);
|
|
2177
|
+
}
|
|
2178
|
+
function GoabGrid({
|
|
2179
|
+
gap,
|
|
2180
|
+
minChildWidth,
|
|
2181
|
+
mt,
|
|
2182
|
+
mr,
|
|
2183
|
+
mb,
|
|
2184
|
+
ml,
|
|
2185
|
+
testId,
|
|
2186
|
+
children
|
|
2187
|
+
}) {
|
|
2188
|
+
return /* @__PURE__ */ jsx(
|
|
2189
|
+
"goa-grid",
|
|
2190
|
+
{
|
|
2191
|
+
gap,
|
|
2192
|
+
minchildwidth: minChildWidth,
|
|
2193
|
+
mt,
|
|
2194
|
+
mr,
|
|
2195
|
+
mb,
|
|
2196
|
+
ml,
|
|
2197
|
+
testid: testId,
|
|
2198
|
+
children
|
|
2199
|
+
}
|
|
2200
|
+
);
|
|
2201
|
+
}
|
|
2202
|
+
function GoabIconButton({
|
|
2203
|
+
variant = "color",
|
|
2204
|
+
size = "medium",
|
|
2205
|
+
disabled,
|
|
2206
|
+
onClick,
|
|
2207
|
+
actionArgs,
|
|
2208
|
+
actionArg,
|
|
2209
|
+
children,
|
|
2210
|
+
...rest
|
|
2211
|
+
}) {
|
|
2212
|
+
const ref = useRef(null);
|
|
2213
|
+
const _props = transformProps(
|
|
2214
|
+
{ variant, size, ...rest },
|
|
2215
|
+
lowercase
|
|
2216
|
+
);
|
|
2217
|
+
useEffect(() => {
|
|
2218
|
+
if (!ref.current) {
|
|
2219
|
+
return;
|
|
2220
|
+
}
|
|
2221
|
+
if (!onClick) {
|
|
2222
|
+
return;
|
|
2223
|
+
}
|
|
2224
|
+
const current = ref.current;
|
|
2225
|
+
const listener = () => {
|
|
2226
|
+
onClick == null ? void 0 : onClick();
|
|
2227
|
+
};
|
|
2228
|
+
current.addEventListener("_click", listener);
|
|
2229
|
+
return () => {
|
|
2230
|
+
current.removeEventListener("_click", listener);
|
|
2231
|
+
};
|
|
2232
|
+
}, [ref, onClick]);
|
|
2233
|
+
return /* @__PURE__ */ jsx(
|
|
2234
|
+
"goa-icon-button",
|
|
2235
|
+
{
|
|
2236
|
+
ref,
|
|
2237
|
+
disabled: disabled ? "true" : void 0,
|
|
2238
|
+
"action-arg": actionArg,
|
|
2239
|
+
"action-args": JSON.stringify(actionArgs),
|
|
2240
|
+
..._props,
|
|
2241
|
+
children
|
|
2242
|
+
}
|
|
2243
|
+
);
|
|
2244
|
+
}
|
|
2245
|
+
function GoabIcon({
|
|
2246
|
+
inverted,
|
|
2247
|
+
...rest
|
|
2248
|
+
}) {
|
|
2249
|
+
const _props = transformProps(rest, lowercase);
|
|
2250
|
+
return /* @__PURE__ */ jsx(
|
|
2251
|
+
"goa-icon",
|
|
2252
|
+
{
|
|
2253
|
+
inverted: typeof inverted === "boolean" ? inverted ? "true" : void 0 : inverted,
|
|
2254
|
+
..._props
|
|
2255
|
+
}
|
|
2256
|
+
);
|
|
2257
|
+
}
|
|
2258
|
+
function GoabInput({
|
|
2259
|
+
variant = "goa",
|
|
2260
|
+
textAlign = "left",
|
|
2261
|
+
focused,
|
|
2262
|
+
disabled,
|
|
2263
|
+
readonly,
|
|
2264
|
+
error,
|
|
2265
|
+
leadingContent,
|
|
2266
|
+
trailingContent,
|
|
2267
|
+
onTrailingIconClick,
|
|
2268
|
+
onChange,
|
|
2269
|
+
onFocus,
|
|
2270
|
+
onBlur,
|
|
2271
|
+
onKeyPress,
|
|
2272
|
+
...rest
|
|
2273
|
+
}) {
|
|
2274
|
+
const ref = useRef(null);
|
|
2275
|
+
const _props = transformProps({ variant, textalign: textAlign, ...rest }, lowercase);
|
|
2276
|
+
useEffect(() => {
|
|
2277
|
+
if (!ref.current) {
|
|
2278
|
+
return;
|
|
2279
|
+
}
|
|
2280
|
+
const current = ref.current;
|
|
2281
|
+
const changeListener = (e) => {
|
|
2282
|
+
const detail = e.detail;
|
|
2283
|
+
onChange == null ? void 0 : onChange({ ...detail, event: e });
|
|
2284
|
+
};
|
|
2285
|
+
const clickListener = () => {
|
|
2286
|
+
onTrailingIconClick == null ? void 0 : onTrailingIconClick();
|
|
2287
|
+
};
|
|
2288
|
+
const focusListener = (e) => {
|
|
2289
|
+
const detail = e.detail;
|
|
2290
|
+
onFocus == null ? void 0 : onFocus({ ...detail, event: e });
|
|
2291
|
+
};
|
|
2292
|
+
const blurListener = (e) => {
|
|
2293
|
+
const detail = e.detail;
|
|
2294
|
+
onBlur == null ? void 0 : onBlur({ ...detail, event: e });
|
|
2295
|
+
};
|
|
2296
|
+
const keypressListener = (e) => {
|
|
2297
|
+
const detail = e.detail;
|
|
2298
|
+
onKeyPress == null ? void 0 : onKeyPress({ ...detail, event: e });
|
|
2299
|
+
};
|
|
2300
|
+
current.addEventListener("_change", changeListener);
|
|
2301
|
+
current.addEventListener("_trailingIconClick", clickListener);
|
|
2302
|
+
current.addEventListener("_focus", focusListener);
|
|
2303
|
+
current.addEventListener("_blur", blurListener);
|
|
2304
|
+
current.addEventListener("_keyPress", keypressListener);
|
|
2305
|
+
return () => {
|
|
2306
|
+
current.removeEventListener("_change", changeListener);
|
|
2307
|
+
current.removeEventListener("_trailingIconClick", clickListener);
|
|
2308
|
+
current.removeEventListener("_focus", focusListener);
|
|
2309
|
+
current.removeEventListener("_blur", blurListener);
|
|
2310
|
+
current.removeEventListener("_keyPress", keypressListener);
|
|
2311
|
+
};
|
|
2312
|
+
}, [ref, onChange, onTrailingIconClick, onFocus, onBlur, onKeyPress]);
|
|
2313
|
+
return /* @__PURE__ */ jsxs(
|
|
2314
|
+
"goa-input",
|
|
2315
|
+
{
|
|
2316
|
+
ref,
|
|
2317
|
+
..._props,
|
|
2318
|
+
focused: focused ? "true" : void 0,
|
|
2319
|
+
disabled: disabled ? "true" : void 0,
|
|
2320
|
+
readonly: readonly ? "true" : void 0,
|
|
2321
|
+
error: error ? "true" : void 0,
|
|
2322
|
+
handletrailingiconclick: onTrailingIconClick ? "true" : "false",
|
|
2323
|
+
children: [
|
|
2324
|
+
leadingContent && /* @__PURE__ */ jsx("div", { slot: "leadingContent", children: leadingContent }),
|
|
2325
|
+
trailingContent && /* @__PURE__ */ jsx("div", { slot: "trailingContent", children: trailingContent })
|
|
2326
|
+
]
|
|
2327
|
+
}
|
|
2328
|
+
);
|
|
2329
|
+
}
|
|
2330
|
+
function GoabModal({
|
|
2331
|
+
heading,
|
|
2332
|
+
children,
|
|
2333
|
+
maxWidth,
|
|
2334
|
+
open,
|
|
2335
|
+
actions,
|
|
2336
|
+
transition,
|
|
2337
|
+
calloutVariant,
|
|
2338
|
+
onClose,
|
|
2339
|
+
testId
|
|
2340
|
+
}) {
|
|
2341
|
+
const el = useRef(null);
|
|
2342
|
+
useEffect(() => {
|
|
2343
|
+
if (!el.current) {
|
|
2344
|
+
return;
|
|
2345
|
+
}
|
|
2346
|
+
const current = el.current;
|
|
2347
|
+
const listener = () => {
|
|
2348
|
+
onClose == null ? void 0 : onClose();
|
|
2349
|
+
};
|
|
2350
|
+
current.addEventListener("_close", listener);
|
|
2351
|
+
return () => {
|
|
2352
|
+
current.removeEventListener("_close", listener);
|
|
2353
|
+
};
|
|
2354
|
+
}, [el, onClose]);
|
|
2355
|
+
return /* @__PURE__ */ jsxs(
|
|
2356
|
+
"goa-modal",
|
|
2357
|
+
{
|
|
2358
|
+
ref: el,
|
|
2359
|
+
open: open ? "true" : void 0,
|
|
2360
|
+
closable: onClose ? "true" : "false",
|
|
2361
|
+
heading: typeof heading === "string" ? heading : void 0,
|
|
2362
|
+
maxwidth: maxWidth,
|
|
2363
|
+
transition,
|
|
2364
|
+
calloutvariant: calloutVariant,
|
|
2365
|
+
testid: testId,
|
|
2366
|
+
children: [
|
|
2367
|
+
heading && typeof heading !== "string" && /* @__PURE__ */ jsx("div", { slot: "heading", children: heading }),
|
|
2368
|
+
actions && /* @__PURE__ */ jsx("div", { slot: "actions", children: actions }),
|
|
2369
|
+
children
|
|
2370
|
+
]
|
|
2371
|
+
}
|
|
2372
|
+
);
|
|
2373
|
+
}
|
|
2374
|
+
function GoabPages(props) {
|
|
2375
|
+
return /* @__PURE__ */ jsx(
|
|
2376
|
+
"goa-pages",
|
|
2377
|
+
{
|
|
2378
|
+
current: props.current,
|
|
2379
|
+
ml: props.ml,
|
|
2380
|
+
mr: props.mr,
|
|
2381
|
+
mt: props.mt,
|
|
2382
|
+
mb: props.mb,
|
|
2383
|
+
children: props.children
|
|
2384
|
+
}
|
|
2385
|
+
);
|
|
2386
|
+
}
|
|
2387
|
+
function GoabRadioItem({
|
|
2388
|
+
name,
|
|
2389
|
+
label,
|
|
2390
|
+
value,
|
|
2391
|
+
description,
|
|
2392
|
+
reveal,
|
|
2393
|
+
revealAriaLabel,
|
|
2394
|
+
maxWidth,
|
|
2395
|
+
disabled,
|
|
2396
|
+
checked,
|
|
2397
|
+
error,
|
|
2398
|
+
ariaLabel,
|
|
2399
|
+
children,
|
|
2400
|
+
mt,
|
|
2401
|
+
mr,
|
|
2402
|
+
mb,
|
|
2403
|
+
ml
|
|
2404
|
+
}) {
|
|
2405
|
+
return /* @__PURE__ */ jsxs(
|
|
2406
|
+
"goa-radio-item",
|
|
2407
|
+
{
|
|
2408
|
+
name,
|
|
2409
|
+
label,
|
|
2410
|
+
value,
|
|
2411
|
+
description: typeof description === "string" ? description : void 0,
|
|
2412
|
+
maxwidth: maxWidth,
|
|
2413
|
+
error: error ? "true" : void 0,
|
|
2414
|
+
disabled: disabled ? "true" : void 0,
|
|
2415
|
+
checked: checked ? "true" : void 0,
|
|
2416
|
+
arialabel: ariaLabel,
|
|
2417
|
+
revealarialabel: revealAriaLabel,
|
|
2418
|
+
mt,
|
|
2419
|
+
mr,
|
|
2420
|
+
mb,
|
|
2421
|
+
ml,
|
|
2422
|
+
children: [
|
|
2423
|
+
description && typeof description !== "string" && /* @__PURE__ */ jsx("div", { slot: "description", children: description }),
|
|
2424
|
+
reveal && /* @__PURE__ */ jsx("div", { slot: "reveal", children: reveal }),
|
|
2425
|
+
children
|
|
2426
|
+
]
|
|
2427
|
+
}
|
|
2428
|
+
);
|
|
2429
|
+
}
|
|
2430
|
+
function GoabRadioGroup({
|
|
2431
|
+
disabled,
|
|
2432
|
+
error,
|
|
2433
|
+
onChange,
|
|
2434
|
+
name,
|
|
2435
|
+
children,
|
|
2436
|
+
...rest
|
|
2437
|
+
}) {
|
|
2438
|
+
const el = useRef(null);
|
|
2439
|
+
const _props = transformProps(rest, lowercase);
|
|
2440
|
+
useEffect(() => {
|
|
2441
|
+
if (!el.current) return;
|
|
2442
|
+
const listener = (e) => {
|
|
2443
|
+
const detail = e.detail;
|
|
2444
|
+
onChange == null ? void 0 : onChange({ ...detail, event: e });
|
|
2445
|
+
};
|
|
2446
|
+
const currentEl = el.current;
|
|
2447
|
+
if (onChange) {
|
|
2448
|
+
currentEl.addEventListener("_change", listener);
|
|
2449
|
+
}
|
|
2450
|
+
return () => {
|
|
2451
|
+
if (onChange) {
|
|
2452
|
+
currentEl.removeEventListener("_change", listener);
|
|
2453
|
+
}
|
|
2454
|
+
};
|
|
2455
|
+
}, [name, onChange]);
|
|
2456
|
+
return /* @__PURE__ */ jsx(
|
|
2457
|
+
"goa-radio-group",
|
|
2458
|
+
{
|
|
2459
|
+
ref: el,
|
|
2460
|
+
..._props,
|
|
2461
|
+
name,
|
|
2462
|
+
disabled: disabled ? "true" : void 0,
|
|
2463
|
+
error: error ? "true" : void 0,
|
|
2464
|
+
children
|
|
2465
|
+
}
|
|
2466
|
+
);
|
|
2467
|
+
}
|
|
2468
|
+
function GoabSpinner({
|
|
2469
|
+
type,
|
|
2470
|
+
size,
|
|
2471
|
+
progress,
|
|
2472
|
+
invert,
|
|
2473
|
+
testId
|
|
2474
|
+
}) {
|
|
2475
|
+
return /* @__PURE__ */ jsx(
|
|
2476
|
+
"goa-spinner",
|
|
2477
|
+
{
|
|
2478
|
+
type,
|
|
2479
|
+
size,
|
|
2480
|
+
progress,
|
|
2481
|
+
invert: invert ? "true" : void 0,
|
|
2482
|
+
testid: testId
|
|
2483
|
+
}
|
|
2484
|
+
);
|
|
2485
|
+
}
|
|
2486
|
+
function GoabTable({ onSort, ...props }) {
|
|
2487
|
+
const ref = useRef(null);
|
|
2488
|
+
useEffect(() => {
|
|
2489
|
+
if (!ref.current) {
|
|
2490
|
+
return;
|
|
2491
|
+
}
|
|
2492
|
+
const current = ref.current;
|
|
2493
|
+
const sortListener = (e) => {
|
|
2494
|
+
const detail = e.detail;
|
|
2495
|
+
onSort == null ? void 0 : onSort(detail);
|
|
2496
|
+
};
|
|
2497
|
+
current.addEventListener("_sort", sortListener);
|
|
2498
|
+
return () => {
|
|
2499
|
+
current.removeEventListener("_sort", sortListener);
|
|
2500
|
+
};
|
|
2501
|
+
}, [ref, onSort]);
|
|
2502
|
+
return /* @__PURE__ */ jsx(
|
|
2503
|
+
"goa-table",
|
|
2504
|
+
{
|
|
2505
|
+
ref,
|
|
2506
|
+
width: props.width,
|
|
2507
|
+
variant: props.variant,
|
|
2508
|
+
testid: props.testId,
|
|
2509
|
+
mt: props.mt,
|
|
2510
|
+
mb: props.mb,
|
|
2511
|
+
ml: props.ml,
|
|
2512
|
+
mr: props.mr,
|
|
2513
|
+
children: /* @__PURE__ */ jsx("table", { style: { width: "100%" }, children: props.children })
|
|
2514
|
+
}
|
|
2515
|
+
);
|
|
2516
|
+
}
|
|
2517
|
+
function GoabText({
|
|
2518
|
+
as,
|
|
2519
|
+
tag,
|
|
2520
|
+
children,
|
|
2521
|
+
...rest
|
|
2522
|
+
}) {
|
|
2523
|
+
const _props = transformProps(rest, lowercase);
|
|
2524
|
+
return /* @__PURE__ */ jsx(
|
|
2525
|
+
"goa-text",
|
|
2526
|
+
{
|
|
2527
|
+
as: tag || as,
|
|
2528
|
+
..._props,
|
|
2529
|
+
children
|
|
2530
|
+
}
|
|
2531
|
+
);
|
|
2532
|
+
}
|
|
2533
|
+
function GoabTextArea({
|
|
2534
|
+
readOnly,
|
|
2535
|
+
disabled,
|
|
2536
|
+
error,
|
|
2537
|
+
onChange,
|
|
2538
|
+
onKeyPress,
|
|
2539
|
+
onBlur,
|
|
2540
|
+
...rest
|
|
2541
|
+
}) {
|
|
2542
|
+
const el = useRef(null);
|
|
2543
|
+
const _props = transformProps(rest, lowercase);
|
|
2544
|
+
useEffect(() => {
|
|
2545
|
+
if (!el.current) {
|
|
2546
|
+
return;
|
|
2547
|
+
}
|
|
2548
|
+
const current = el.current;
|
|
2549
|
+
const changeListener = (e) => {
|
|
2550
|
+
const detail = e.detail;
|
|
2551
|
+
onChange == null ? void 0 : onChange({ ...detail, event: e });
|
|
2552
|
+
};
|
|
2553
|
+
const keypressListener = (e) => {
|
|
2554
|
+
const detail = e.detail;
|
|
2555
|
+
onKeyPress == null ? void 0 : onKeyPress({ ...detail, event: e });
|
|
2556
|
+
};
|
|
2557
|
+
const blurListener = (e) => {
|
|
2558
|
+
const detail = e.detail;
|
|
2559
|
+
onBlur == null ? void 0 : onBlur({ ...detail, event: e });
|
|
2560
|
+
};
|
|
2561
|
+
current.addEventListener("_change", changeListener);
|
|
2562
|
+
current.addEventListener("_keyPress", keypressListener);
|
|
2563
|
+
current.addEventListener("_blur", blurListener);
|
|
2564
|
+
return () => {
|
|
2565
|
+
current.removeEventListener("_change", changeListener);
|
|
2566
|
+
current.removeEventListener("_keyPress", keypressListener);
|
|
2567
|
+
current.removeEventListener("_blur", blurListener);
|
|
2568
|
+
};
|
|
2569
|
+
}, [el, onChange, onKeyPress, onBlur]);
|
|
2570
|
+
return /* @__PURE__ */ jsx(
|
|
2571
|
+
"goa-textarea",
|
|
2572
|
+
{
|
|
2573
|
+
ref: el,
|
|
2574
|
+
readOnly: readOnly ? "true" : void 0,
|
|
2575
|
+
disabled: disabled ? "true" : void 0,
|
|
2576
|
+
error: error ? "true" : void 0,
|
|
2577
|
+
..._props
|
|
2578
|
+
}
|
|
2579
|
+
);
|
|
2580
|
+
}
|
|
2581
|
+
|
|
1829
2582
|
var NATIVE_BIND$1 = functionBindNative;
|
|
1830
2583
|
|
|
1831
2584
|
var FunctionPrototype = Function.prototype;
|
|
@@ -6441,7 +7194,6 @@ function collectRequiredPaths(schema, basePath = '') {
|
|
|
6441
7194
|
}
|
|
6442
7195
|
return out;
|
|
6443
7196
|
}
|
|
6444
|
-
// eslint-disable-next-line
|
|
6445
7197
|
function collectControllerKeys(ifSchema) {
|
|
6446
7198
|
if (!isObj(ifSchema)) return [];
|
|
6447
7199
|
const keys = new Set();
|
|
@@ -6454,7 +7206,6 @@ function collectControllerKeys(ifSchema) {
|
|
|
6454
7206
|
}
|
|
6455
7207
|
return [...keys];
|
|
6456
7208
|
}
|
|
6457
|
-
// eslint-disable-next-line
|
|
6458
7209
|
function buildConditionalDeps(rootSchema) {
|
|
6459
7210
|
const deps = new Map();
|
|
6460
7211
|
// eslint-disable-next-line
|
|
@@ -6489,9 +7240,55 @@ function buildConditionalDeps(rootSchema) {
|
|
|
6489
7240
|
return out;
|
|
6490
7241
|
}
|
|
6491
7242
|
|
|
7243
|
+
const sinTitle = 'Social insurance number';
|
|
7244
|
+
const invalidSin = 'Social insurance number is invalid';
|
|
7245
|
+
const DEFAULT_MAX_ITEMS = 50;
|
|
7246
|
+
const REQUIRED_PROPERTY_ERROR = 'is a required property';
|
|
7247
|
+
const ADDRESS_LOOKUP_LABELS = {
|
|
7248
|
+
addressLine1: 'Address line 1',
|
|
7249
|
+
addressLine2: 'Address line 2',
|
|
7250
|
+
municipality: 'City',
|
|
7251
|
+
postalCode: 'Postal code',
|
|
7252
|
+
subdivisionCode: 'Province',
|
|
7253
|
+
country: 'Country'
|
|
7254
|
+
};
|
|
7255
|
+
const VALIDATION_KEYWORDS = {
|
|
7256
|
+
REQUIRED: 'required',
|
|
7257
|
+
MIN_LENGTH: 'minLength',
|
|
7258
|
+
MAX_LENGTH: 'maxLength',
|
|
7259
|
+
FORMAT: 'format',
|
|
7260
|
+
MINIMUM: 'minimum',
|
|
7261
|
+
MAXIMUM: 'maximum',
|
|
7262
|
+
TYPE: 'type',
|
|
7263
|
+
ERROR_MESSAGE: 'errorMessage'
|
|
7264
|
+
};
|
|
7265
|
+
var StepStatus;
|
|
7266
|
+
(function (StepStatus) {
|
|
7267
|
+
StepStatus["NOT_STARTED"] = "NotStarted";
|
|
7268
|
+
StepStatus["IN_PROGRESS"] = "InProgress";
|
|
7269
|
+
StepStatus["COMPLETED"] = "Completed";
|
|
7270
|
+
})(StepStatus || (StepStatus = {}));
|
|
7271
|
+
const getAddressLookupFieldLabel = fieldName => {
|
|
7272
|
+
return ADDRESS_LOOKUP_LABELS[fieldName] || fieldName;
|
|
7273
|
+
};
|
|
7274
|
+
|
|
7275
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7276
|
+
function getValueAtPath(obj, path) {
|
|
7277
|
+
return path.split('.').reduce((acc, key) => acc == null ? void 0 : acc[key], obj);
|
|
7278
|
+
}
|
|
7279
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7280
|
+
function hasMeaningfulValue(val) {
|
|
7281
|
+
if (val === undefined || val === null) return false;
|
|
7282
|
+
if (typeof val === 'string') return val.trim() !== '';
|
|
7283
|
+
if (Array.isArray(val)) return val.length > 0;
|
|
7284
|
+
if (typeof val === 'object') return Object.keys(val).length > 0;
|
|
7285
|
+
return true;
|
|
7286
|
+
}
|
|
7287
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6492
7288
|
function getSubSchema(schema, path) {
|
|
6493
7289
|
const parts = path.replace(/^#\//, '').split('/').filter(p => p !== 'properties') // remove 'properties' segments
|
|
6494
7290
|
.slice(0, -1);
|
|
7291
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6495
7292
|
let current = schema;
|
|
6496
7293
|
for (const part of parts) {
|
|
6497
7294
|
if (!current) return undefined;
|
|
@@ -6505,6 +7302,28 @@ function getSubSchema(schema, path) {
|
|
|
6505
7302
|
}
|
|
6506
7303
|
return current;
|
|
6507
7304
|
}
|
|
7305
|
+
// Checks whether any of the given normalized scopes (dot-path form, e.g. "a.b.c")
|
|
7306
|
+
// resolve to a property name present in the required array. Returns true if at
|
|
7307
|
+
// least one scope's property name is required, false otherwise.
|
|
7308
|
+
function isScopeRequired(normalizedScopes, required) {
|
|
7309
|
+
if (!(normalizedScopes != null && normalizedScopes.length) || !(required != null && required.length)) return false;
|
|
7310
|
+
return normalizedScopes.some(scope => {
|
|
7311
|
+
const propertyName = scope.split('.').pop();
|
|
7312
|
+
return !!propertyName && required.includes(propertyName);
|
|
7313
|
+
});
|
|
7314
|
+
}
|
|
7315
|
+
// Aggregates the required property names applicable to a step's scopes: the
|
|
7316
|
+
// schema's top-level required array plus the required array of each scope's
|
|
7317
|
+
// immediate parent (sub)schema (for nested objects).
|
|
7318
|
+
function getRequiredForScopes(scopes, schema) {
|
|
7319
|
+
const topLevelRequired = schema.required || [];
|
|
7320
|
+
const scopeSets = scopes.reduce((acc, scope) => {
|
|
7321
|
+
const subSchema = getSubSchema(schema, scope);
|
|
7322
|
+
return acc.concat((subSchema == null ? void 0 : subSchema.required) || []);
|
|
7323
|
+
}, topLevelRequired);
|
|
7324
|
+
return Array.from(new Set(scopeSets));
|
|
7325
|
+
}
|
|
7326
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6508
7327
|
function anyRequiredFieldEmpty(scopes, data, required, schema) {
|
|
6509
7328
|
for (const scope of scopes) {
|
|
6510
7329
|
const path = scope.replace(/^#\//, '').split('/').filter(p => p !== 'properties');
|
|
@@ -6528,6 +7347,15 @@ function anyRequiredFieldEmpty(scopes, data, required, schema) {
|
|
|
6528
7347
|
}
|
|
6529
7348
|
return false;
|
|
6530
7349
|
}
|
|
7350
|
+
// Resolve a single schema scope against the provided data and determine whether
|
|
7351
|
+
// it already holds a meaningful value. Used to derive the initial "visited"
|
|
7352
|
+
// state of a step from populated form data.
|
|
7353
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7354
|
+
function hasValueAtScope(data, scope) {
|
|
7355
|
+
const path = normalizeSchemaPath(scope);
|
|
7356
|
+
if (!path) return false;
|
|
7357
|
+
return hasMeaningfulValue(getValueAtPath(data, path));
|
|
7358
|
+
}
|
|
6531
7359
|
function getStepStatus(opts) {
|
|
6532
7360
|
const {
|
|
6533
7361
|
scopes,
|
|
@@ -6536,22 +7364,50 @@ function getStepStatus(opts) {
|
|
|
6536
7364
|
data,
|
|
6537
7365
|
visited
|
|
6538
7366
|
} = opts;
|
|
6539
|
-
if (!visited) {
|
|
6540
|
-
return 'NotStarted';
|
|
6541
|
-
}
|
|
6542
7367
|
const normalizedScopes = scopes.map(normalizeSchemaPath).filter(Boolean);
|
|
7368
|
+
// A step with no required fields has nothing that must be filled in, so once
|
|
7369
|
+
// the user has visited it (e.g. navigated back to the application overview
|
|
7370
|
+
// page) it is trivially Completed, regardless of whether its optional
|
|
7371
|
+
// fields hold any data.
|
|
7372
|
+
const requiredForScopes = getRequiredForScopes(scopes, schema);
|
|
7373
|
+
const stepHasRequiredFields = isScopeRequired(normalizedScopes, requiredForScopes);
|
|
7374
|
+
// NotStarted is data-driven: if any scoped field has a defined value the step has been started.
|
|
7375
|
+
// For non-standard scopes that cannot be normalised, fall back to the visited flag so those
|
|
7376
|
+
// steps are never stuck in NotStarted when the form is pre-populated or already visited.
|
|
7377
|
+
const stepHasData = normalizedScopes.length > 0 ? normalizedScopes.some(path => hasMeaningfulValue(get$1(data || {}, path))) : visited != null ? visited : false;
|
|
7378
|
+
if (!stepHasRequiredFields && (visited || stepHasData)) {
|
|
7379
|
+
return {
|
|
7380
|
+
status: StepStatus.COMPLETED,
|
|
7381
|
+
hasRequiredFields: stepHasRequiredFields
|
|
7382
|
+
};
|
|
7383
|
+
}
|
|
7384
|
+
if (!stepHasData) {
|
|
7385
|
+
return {
|
|
7386
|
+
status: StepStatus.NOT_STARTED,
|
|
7387
|
+
hasRequiredFields: stepHasRequiredFields
|
|
7388
|
+
};
|
|
7389
|
+
}
|
|
6543
7390
|
const incompleteInStep = getIncompletePaths(errors, scopes);
|
|
6544
7391
|
if (incompleteInStep.length > 0) {
|
|
6545
|
-
return
|
|
7392
|
+
return {
|
|
7393
|
+
status: StepStatus.IN_PROGRESS,
|
|
7394
|
+
hasRequiredFields: stepHasRequiredFields
|
|
7395
|
+
};
|
|
6546
7396
|
}
|
|
6547
7397
|
const required = schema.required || [];
|
|
6548
7398
|
if (anyRequiredFieldEmpty(scopes, data, required, schema)) {
|
|
6549
|
-
return
|
|
7399
|
+
return {
|
|
7400
|
+
status: StepStatus.IN_PROGRESS,
|
|
7401
|
+
hasRequiredFields: stepHasRequiredFields
|
|
7402
|
+
};
|
|
6550
7403
|
}
|
|
6551
7404
|
const deps = buildConditionalDeps(schema);
|
|
6552
7405
|
const controllersInStep = normalizedScopes.filter(s => deps.has(s));
|
|
6553
7406
|
if (controllersInStep.length === 0) {
|
|
6554
|
-
return
|
|
7407
|
+
return {
|
|
7408
|
+
status: StepStatus.COMPLETED,
|
|
7409
|
+
hasRequiredFields: stepHasRequiredFields
|
|
7410
|
+
};
|
|
6555
7411
|
}
|
|
6556
7412
|
const affected = new Set();
|
|
6557
7413
|
for (const controller of controllersInStep) {
|
|
@@ -6560,27 +7416,38 @@ function getStepStatus(opts) {
|
|
|
6560
7416
|
}
|
|
6561
7417
|
}
|
|
6562
7418
|
if (affected.size === 0) {
|
|
6563
|
-
return
|
|
7419
|
+
return {
|
|
7420
|
+
status: StepStatus.COMPLETED,
|
|
7421
|
+
hasRequiredFields: stepHasRequiredFields
|
|
7422
|
+
};
|
|
6564
7423
|
}
|
|
6565
7424
|
const affectedPaths = [...affected];
|
|
6566
7425
|
for (const err of errors || []) {
|
|
6567
7426
|
for (const candidate of collectErrorCandidates(err)) {
|
|
6568
7427
|
if (affectedPaths.some(path => isUnder(candidate, path))) {
|
|
6569
|
-
return
|
|
7428
|
+
return {
|
|
7429
|
+
status: StepStatus.IN_PROGRESS,
|
|
7430
|
+
hasRequiredFields: stepHasRequiredFields
|
|
7431
|
+
};
|
|
6570
7432
|
}
|
|
6571
7433
|
}
|
|
6572
7434
|
}
|
|
6573
|
-
return
|
|
7435
|
+
return {
|
|
7436
|
+
status: StepStatus.COMPLETED,
|
|
7437
|
+
hasRequiredFields: stepHasRequiredFields
|
|
7438
|
+
};
|
|
6574
7439
|
}
|
|
6575
7440
|
function collectErrorCandidates(e) {
|
|
6576
7441
|
var _e$params;
|
|
6577
7442
|
const out = [];
|
|
7443
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6578
7444
|
const missing = (_e$params = e.params) == null ? void 0 : _e$params.missingProperty;
|
|
6579
|
-
if (e.keyword ===
|
|
7445
|
+
if (e.keyword === VALIDATION_KEYWORDS.REQUIRED && missing) {
|
|
6580
7446
|
const base = normalizeInstancePath(e.instancePath || '');
|
|
6581
7447
|
out.push(base ? `${base}.${missing}` : missing);
|
|
6582
7448
|
}
|
|
6583
7449
|
if (e.instancePath) out.push(normalizeInstancePath(e.instancePath));
|
|
7450
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6584
7451
|
if (e.dataPath) out.push(normalizeInstancePath(e.dataPath));
|
|
6585
7452
|
return out.filter(Boolean);
|
|
6586
7453
|
}
|
|
@@ -6609,9 +7476,10 @@ function getIncompletePaths(errors, scopePaths) {
|
|
|
6609
7476
|
const incomplete = new Set();
|
|
6610
7477
|
for (const error of errors) {
|
|
6611
7478
|
var _error$params;
|
|
7479
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6612
7480
|
const missingProperty = (_error$params = error.params) == null ? void 0 : _error$params.missingProperty;
|
|
6613
7481
|
const candidates = [];
|
|
6614
|
-
if (error.keyword ===
|
|
7482
|
+
if (error.keyword === VALIDATION_KEYWORDS.REQUIRED && missingProperty) {
|
|
6615
7483
|
candidates.push(missingProperty);
|
|
6616
7484
|
if (error.instancePath) {
|
|
6617
7485
|
const base = normalizeInstancePath(error.instancePath);
|
|
@@ -6672,7 +7540,22 @@ const stepperReducer = (state, action) => {
|
|
|
6672
7540
|
switch (action.type) {
|
|
6673
7541
|
case 'update/uischema':
|
|
6674
7542
|
{
|
|
6675
|
-
|
|
7543
|
+
const newState = action.payload.state;
|
|
7544
|
+
// createStepperContextInitData recomputes categories purely from the
|
|
7545
|
+
// current data/schema snapshot, so a category with no data in its scopes
|
|
7546
|
+
// is reported as not visited even if the user already navigated through it
|
|
7547
|
+
// (page/next, page/prev, or setVisited previously marked it visited).
|
|
7548
|
+
// Preserve any previously-tracked isVisited=true so navigation history
|
|
7549
|
+
// isn't lost whenever unrelated form data changes trigger this recompute.
|
|
7550
|
+
const mergedCategories = newState.categories.map(newCategory => {
|
|
7551
|
+
const previousCategory = categories.find(c => c.id === newCategory.id);
|
|
7552
|
+
return Object.assign({}, newCategory, {
|
|
7553
|
+
isVisited: (previousCategory == null ? void 0 : previousCategory.isVisited) || newCategory.isVisited
|
|
7554
|
+
});
|
|
7555
|
+
});
|
|
7556
|
+
return Object.assign({}, newState, {
|
|
7557
|
+
categories: mergedCategories
|
|
7558
|
+
});
|
|
6676
7559
|
}
|
|
6677
7560
|
case 'page/next':
|
|
6678
7561
|
{
|
|
@@ -6740,7 +7623,9 @@ const stepperReducer = (state, action) => {
|
|
|
6740
7623
|
}
|
|
6741
7624
|
const filteredErrors = ajv.errors && ajv.errors.filter(error => (error == null ? void 0 : error.data) != null);
|
|
6742
7625
|
const visited = true;
|
|
6743
|
-
const
|
|
7626
|
+
const {
|
|
7627
|
+
status
|
|
7628
|
+
} = getStepStatus({
|
|
6744
7629
|
scopes: cat.scopes,
|
|
6745
7630
|
data,
|
|
6746
7631
|
errors: filteredErrors != null ? filteredErrors : [],
|
|
@@ -6748,9 +7633,9 @@ const stepperReducer = (state, action) => {
|
|
|
6748
7633
|
visited
|
|
6749
7634
|
});
|
|
6750
7635
|
return Object.assign({}, cat, {
|
|
6751
|
-
isCompleted: status ===
|
|
6752
|
-
isValid: status ===
|
|
6753
|
-
status
|
|
7636
|
+
isCompleted: status === StepStatus.COMPLETED,
|
|
7637
|
+
isValid: status === StepStatus.COMPLETED,
|
|
7638
|
+
status: status
|
|
6754
7639
|
});
|
|
6755
7640
|
});
|
|
6756
7641
|
return Object.assign({}, state, {
|
|
@@ -6810,26 +7695,38 @@ const createStepperContextInitData = props => {
|
|
|
6810
7695
|
// run validation once, capture errors
|
|
6811
7696
|
const valid = ajv.validate(schema, data || {});
|
|
6812
7697
|
const isPage = (uischema == null || (_uischema$options = uischema.options) == null ? void 0 : _uischema$options.variant) === 'pages';
|
|
7698
|
+
//TODO: Determine if cachedStatus is still being used by anything in the library
|
|
7699
|
+
// If not, do a proper clean up.
|
|
6813
7700
|
const isCacheStatus = (_uischema$options2 = uischema.options) == null ? void 0 : _uischema$options2.cacheStatus;
|
|
6814
7701
|
isCacheStatus && getIsVisitFromLocalStorage() || [];
|
|
6815
7702
|
const categories = (_categorization$eleme = categorization.elements) == null ? void 0 : _categorization$eleme.map((c, id) => {
|
|
6816
7703
|
var _deriveLabelForUISche;
|
|
6817
7704
|
const scopes = pickPropertyValues(c, 'scope', 'ListWithDetail');
|
|
6818
|
-
|
|
6819
|
-
|
|
7705
|
+
// Treat a step as visited when its scoped fields already contain data so
|
|
7706
|
+
// that getStepStatus returns the real data-driven status on initial mount initially.
|
|
7707
|
+
let visited = scopes.some(scope => hasValueAtScope(data, scope));
|
|
7708
|
+
const {
|
|
7709
|
+
status,
|
|
7710
|
+
hasRequiredFields
|
|
7711
|
+
} = getStepStatus({
|
|
6820
7712
|
scopes,
|
|
6821
7713
|
data,
|
|
6822
7714
|
errors: filteredErrors != null ? filteredErrors : [],
|
|
6823
7715
|
schema,
|
|
6824
7716
|
visited
|
|
6825
7717
|
});
|
|
7718
|
+
//If the step has all conditional fields, set visited to true so that the step status will be
|
|
7719
|
+
//completed to enable form to be saved.
|
|
7720
|
+
if (!hasRequiredFields) {
|
|
7721
|
+
visited = true;
|
|
7722
|
+
}
|
|
6826
7723
|
return {
|
|
6827
7724
|
id,
|
|
6828
7725
|
label: (_deriveLabelForUISche = deriveLabelForUISchemaElement(c, t)) != null ? _deriveLabelForUISche : `Step ${id + 1}`,
|
|
6829
7726
|
scopes,
|
|
6830
|
-
isCompleted: status ===
|
|
6831
|
-
isValid: status ===
|
|
6832
|
-
isVisited: status
|
|
7727
|
+
isCompleted: status === StepStatus.COMPLETED || visited && !hasRequiredFields,
|
|
7728
|
+
isValid: status === StepStatus.COMPLETED || visited && !hasRequiredFields,
|
|
7729
|
+
isVisited: [StepStatus.COMPLETED, StepStatus.IN_PROGRESS].includes(status),
|
|
6833
7730
|
status,
|
|
6834
7731
|
uischema: c,
|
|
6835
7732
|
isEnabled: isEnabled(c, data, '', ajv, undefined),
|
|
@@ -6999,7 +7896,7 @@ const JsonFormsStepperContextProvider = ({
|
|
|
6999
7896
|
}
|
|
7000
7897
|
}
|
|
7001
7898
|
//eslint-disable-next-line
|
|
7002
|
-
}, [JSON.stringify(StepperProps.uischema), JSON.stringify(StepperProps.schema)]);
|
|
7899
|
+
}, [JSON.stringify(StepperProps.uischema), JSON.stringify(StepperProps.schema), JSON.stringify(StepperProps.data)]);
|
|
7003
7900
|
return jsx(JsonFormsStepperContext.Provider, {
|
|
7004
7901
|
value: context,
|
|
7005
7902
|
children: children
|
|
@@ -7264,32 +8161,6 @@ fixRegExpWellKnownSymbolLogic$1('match', function (MATCH, nativeMatch, maybeCall
|
|
|
7264
8161
|
];
|
|
7265
8162
|
});
|
|
7266
8163
|
|
|
7267
|
-
const sinTitle = 'Social insurance number';
|
|
7268
|
-
const invalidSin = 'Social insurance number is invalid';
|
|
7269
|
-
const DEFAULT_MAX_ITEMS = 50;
|
|
7270
|
-
const REQUIRED_PROPERTY_ERROR = 'is a required property';
|
|
7271
|
-
const ADDRESS_LOOKUP_LABELS = {
|
|
7272
|
-
addressLine1: 'Address line 1',
|
|
7273
|
-
addressLine2: 'Address line 2',
|
|
7274
|
-
municipality: 'City',
|
|
7275
|
-
postalCode: 'Postal code',
|
|
7276
|
-
subdivisionCode: 'Province',
|
|
7277
|
-
country: 'Country'
|
|
7278
|
-
};
|
|
7279
|
-
const VALIDATION_KEYWORDS = {
|
|
7280
|
-
REQUIRED: 'required',
|
|
7281
|
-
MIN_LENGTH: 'minLength',
|
|
7282
|
-
MAX_LENGTH: 'maxLength',
|
|
7283
|
-
FORMAT: 'format',
|
|
7284
|
-
MINIMUM: 'minimum',
|
|
7285
|
-
MAXIMUM: 'maximum',
|
|
7286
|
-
TYPE: 'type',
|
|
7287
|
-
ERROR_MESSAGE: 'errorMessage'
|
|
7288
|
-
};
|
|
7289
|
-
const getAddressLookupFieldLabel = fieldName => {
|
|
7290
|
-
return ADDRESS_LOOKUP_LABELS[fieldName] || fieldName;
|
|
7291
|
-
};
|
|
7292
|
-
|
|
7293
8164
|
//type DebounceValueType = string | boolean | number | Record<string, unknown>;
|
|
7294
8165
|
/**
|
|
7295
8166
|
* A helper util to return a value at a certain delay. The delay is reset if the value arg changes
|
|
@@ -8560,7 +9431,8 @@ const CheckboxGroup = props => {
|
|
|
8560
9431
|
newData = newData.filter(item => item !== enumValue);
|
|
8561
9432
|
}
|
|
8562
9433
|
handleChange(path, newData.length === 0 ? undefined : newData);
|
|
8563
|
-
}
|
|
9434
|
+
},
|
|
9435
|
+
mt: "s"
|
|
8564
9436
|
}), enumValue);
|
|
8565
9437
|
})
|
|
8566
9438
|
});
|
|
@@ -9199,7 +10071,7 @@ const DataTable = ({
|
|
|
9199
10071
|
columnLabels
|
|
9200
10072
|
}) => {
|
|
9201
10073
|
var _Object$keys;
|
|
9202
|
-
return jsxs(GoabTable, {
|
|
10074
|
+
return jsxs(GoabTable$1, {
|
|
9203
10075
|
width: "100%",
|
|
9204
10076
|
children: [jsx("thead", {
|
|
9205
10077
|
children: jsx("tr", {
|
|
@@ -10544,7 +11416,6 @@ const GoAInputBaseTableReview = props => {
|
|
|
10544
11416
|
})]
|
|
10545
11417
|
}), stepId !== undefined && !((_uischema$options6 = uischema.options) != null && (_uischema$options6 = _uischema$options6.componentProps) != null && _uischema$options6.readOnly) && jsx(GoabButton, {
|
|
10546
11418
|
type: "tertiary",
|
|
10547
|
-
size: "compact",
|
|
10548
11419
|
onClick: handleChangeClick,
|
|
10549
11420
|
children: "Change"
|
|
10550
11421
|
})]
|
|
@@ -10826,7 +11697,7 @@ const LayoutRenderer = ({
|
|
|
10826
11697
|
if (direction === 'row') {
|
|
10827
11698
|
return jsx(Visible, {
|
|
10828
11699
|
"$visible": visible,
|
|
10829
|
-
children: jsx(GoabGrid, {
|
|
11700
|
+
children: jsx(GoabGrid$1, {
|
|
10830
11701
|
minChildWidth: width || '10ch',
|
|
10831
11702
|
children: renderLayoutElements(elements, schema, path, enabled, renderers, cells)
|
|
10832
11703
|
})
|
|
@@ -11337,8 +12208,7 @@ const FullNameControlReview = props => {
|
|
|
11337
12208
|
children: " (required)"
|
|
11338
12209
|
})]
|
|
11339
12210
|
}), stepId !== undefined && !((_uischema$options = uischema.options) != null && (_uischema$options = _uischema$options.componentProps) != null && _uischema$options.readOnly) && jsx(GoabButton, {
|
|
11340
|
-
type: "
|
|
11341
|
-
size: "compact",
|
|
12211
|
+
type: "text",
|
|
11342
12212
|
onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
|
|
11343
12213
|
testId: `${fieldName}-change-btn`,
|
|
11344
12214
|
children: "Change"
|
|
@@ -11386,8 +12256,7 @@ const FullNameDobReviewControl = props => {
|
|
|
11386
12256
|
children: " (required)"
|
|
11387
12257
|
})]
|
|
11388
12258
|
}), stepId !== undefined && !((_uischema$options2 = uischema.options) != null && (_uischema$options2 = _uischema$options2.componentProps) != null && _uischema$options2.readOnly) && jsx(GoabButton, {
|
|
11389
|
-
type: "
|
|
11390
|
-
size: "compact",
|
|
12259
|
+
type: "text",
|
|
11391
12260
|
onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
|
|
11392
12261
|
testId: `${fieldName}-change-btn`,
|
|
11393
12262
|
children: "Change"
|
|
@@ -11776,8 +12645,7 @@ const ContractInfoControlReview = props => {
|
|
|
11776
12645
|
children: [jsx(ReviewLabel, {
|
|
11777
12646
|
children: fieldLabel
|
|
11778
12647
|
}), stepId !== undefined && !((_uischema$options = uischema.options) != null && (_uischema$options = _uischema$options.componentProps) != null && _uischema$options.readOnly) && jsx(GoabButton, {
|
|
11779
|
-
type: "
|
|
11780
|
-
size: "compact",
|
|
12648
|
+
type: "text",
|
|
11781
12649
|
onClick: () => context == null ? void 0 : context.goToPage(stepId, uischema.scope),
|
|
11782
12650
|
testId: `${fieldName}-change-btn`,
|
|
11783
12651
|
children: "Change"
|
|
@@ -12953,6 +13821,7 @@ const PrimitiveArrayControl = props => {
|
|
|
12953
13821
|
checked: checked,
|
|
12954
13822
|
disabled: !enabled,
|
|
12955
13823
|
testId: `${value}-checkbox`,
|
|
13824
|
+
mt: "s",
|
|
12956
13825
|
onChange: detail => {
|
|
12957
13826
|
let newValue = [...items];
|
|
12958
13827
|
if (detail.value) {
|
|
@@ -13382,7 +14251,7 @@ const AddressLoopUpControlTableReview = props => {
|
|
|
13382
14251
|
children: " (required)"
|
|
13383
14252
|
})]
|
|
13384
14253
|
}), showButton && stepId !== undefined && !((_uischema$options2 = uischema.options) != null && (_uischema$options2 = _uischema$options2.componentProps) != null && _uischema$options2.readOnly) && jsx(GoabButton, {
|
|
13385
|
-
type: "
|
|
14254
|
+
type: "text",
|
|
13386
14255
|
size: "compact",
|
|
13387
14256
|
onClick: () => formStepperCtx == null ? void 0 : formStepperCtx.goToPage(stepId, targetScope),
|
|
13388
14257
|
testId: "address-change-btn",
|
|
@@ -13408,7 +14277,7 @@ const AddressLoopUpControlTableReview = props => {
|
|
|
13408
14277
|
children: [jsx(ReviewLabel, {
|
|
13409
14278
|
children: `${isAlbertaAddress ? 'Alberta' : 'Canada'} postal address`
|
|
13410
14279
|
}), stepId !== undefined && !((_uischema$options3 = uischema.options) != null && (_uischema$options3 = _uischema$options3.componentProps) != null && _uischema$options3.readOnly) && jsx(GoabButton, {
|
|
13411
|
-
type: "
|
|
14280
|
+
type: "text",
|
|
13412
14281
|
size: "compact",
|
|
13413
14282
|
onClick: () => formStepperCtx == null ? void 0 : formStepperCtx.goToPage(stepId, targetScope),
|
|
13414
14283
|
testId: "address-change-btn",
|
|
@@ -13538,20 +14407,20 @@ const GoAGroupControlComponent = props => {
|
|
|
13538
14407
|
const accent = componentProps == null ? void 0 : componentProps.accent;
|
|
13539
14408
|
return jsxs(Visible, {
|
|
13540
14409
|
"$visible": visible,
|
|
13541
|
-
children: [accent === 'thick' && jsx(GoabContainer, Object.assign({
|
|
14410
|
+
children: [accent === 'thick' && jsx(GoabContainer$1, Object.assign({
|
|
13542
14411
|
heading: group.label
|
|
13543
14412
|
}, componentProps, {
|
|
13544
14413
|
children: renderLayoutElements(group.elements, schema, path, enabled, renderers, cells)
|
|
13545
14414
|
})), (accent === 'thin' || accent === 'filled') && jsxs("div", {
|
|
13546
14415
|
children: [group.label && jsx("h3", {
|
|
13547
14416
|
children: group.label
|
|
13548
|
-
}), jsx(GoabContainer, Object.assign({}, componentProps, {
|
|
14417
|
+
}), jsx(GoabContainer$1, Object.assign({}, componentProps, {
|
|
13549
14418
|
children: renderLayoutElements(group.elements, schema, path, enabled, renderers, cells)
|
|
13550
14419
|
}))]
|
|
13551
14420
|
}), componentProps && !accent && jsxs("div", {
|
|
13552
14421
|
children: [group.label && jsx("h3", {
|
|
13553
14422
|
children: group.label
|
|
13554
|
-
}), jsx(GoabContainer, Object.assign({}, componentProps, {
|
|
14423
|
+
}), jsx(GoabContainer$1, Object.assign({}, componentProps, {
|
|
13555
14424
|
children: renderLayoutElements(group.elements, schema, path, enabled, renderers, cells)
|
|
13556
14425
|
}))]
|
|
13557
14426
|
}), !componentProps && jsxs("div", {
|
|
@@ -13559,7 +14428,7 @@ const GoAGroupControlComponent = props => {
|
|
|
13559
14428
|
children: group.label
|
|
13560
14429
|
}), isStepperReview ? jsx(Fragment, {
|
|
13561
14430
|
children: renderLayoutElements(group.elements, schema, path, enabled, renderers, cells)
|
|
13562
|
-
}) : jsx(GoabContainer, {
|
|
14431
|
+
}) : jsx(GoabContainer$1, {
|
|
13563
14432
|
children: renderLayoutElements(group.elements, schema, path, enabled, renderers, cells)
|
|
13564
14433
|
})]
|
|
13565
14434
|
})]
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@abgov/jsonforms-components",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.70.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Government of Alberta - React renderers for JSON Forms based on the design system.",
|
|
6
6
|
"repository": "https://github.com/GovAlta/adsp-monorepo",
|
|
7
7
|
"peerDependencies": {
|
|
8
8
|
"@abgov/react-components": "^6.9.3",
|
|
9
|
-
"@abgov/ui-components-common": "
|
|
9
|
+
"@abgov/ui-components-common": "2.2.1",
|
|
10
10
|
"@jsonforms/core": "^3.1.0",
|
|
11
11
|
"@jsonforms/react": "^3.1.0",
|
|
12
12
|
"react": "^18.0.0",
|
package/renderer-catalog.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": "1.0.0",
|
|
3
|
-
"generatedAt": "2026-07-
|
|
4
|
-
"sourceCommit": "
|
|
3
|
+
"generatedAt": "2026-07-23T15:27:18.993Z",
|
|
4
|
+
"sourceCommit": "f9c7063696b8fa8c87eb247175573525da9d3ffe",
|
|
5
5
|
"sourcePath": "libs/jsonforms-components/src/index.ts",
|
|
6
6
|
"rendererCount": 33,
|
|
7
7
|
"renderers": [
|
|
@@ -2,6 +2,7 @@ import { StepperContextDataType } from './types';
|
|
|
2
2
|
import { ErrorObject } from 'ajv';
|
|
3
3
|
import { Dispatch } from 'react';
|
|
4
4
|
import Ajv from 'ajv';
|
|
5
|
+
import { JsonSchema } from '@jsonforms/core';
|
|
5
6
|
export type JsonFormStepperDispatch = Dispatch<StepperAction>;
|
|
6
7
|
export type StepperAction = {
|
|
7
8
|
type: 'page/next';
|
|
@@ -24,7 +25,7 @@ export type StepperAction = {
|
|
|
24
25
|
errors?: ErrorObject[];
|
|
25
26
|
id: number;
|
|
26
27
|
ajv: Ajv;
|
|
27
|
-
schema:
|
|
28
|
+
schema: JsonSchema;
|
|
28
29
|
data: any;
|
|
29
30
|
};
|
|
30
31
|
} | {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Categorization, Category } from '@jsonforms/core';
|
|
2
|
+
import { StepStatusType } from '../../../common/Constants';
|
|
2
3
|
export interface CategoryInternalState {
|
|
3
4
|
isCompleted?: boolean;
|
|
4
5
|
isVisited?: boolean;
|
|
@@ -16,6 +17,15 @@ export interface CategoryConfig {
|
|
|
16
17
|
}
|
|
17
18
|
export type CategoryState = CategoryInternalState & CategoryConfig;
|
|
18
19
|
export type CategoriesState = Array<CategoryState>;
|
|
20
|
+
export interface StepConfig {
|
|
21
|
+
id: string;
|
|
22
|
+
label: string;
|
|
23
|
+
scopePaths: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface StepStatusData {
|
|
26
|
+
status: StepStatusType;
|
|
27
|
+
hasRequiredFields: boolean;
|
|
28
|
+
}
|
|
19
29
|
export interface StepperContextDataType {
|
|
20
30
|
categories: CategoriesState;
|
|
21
31
|
activeId: number;
|
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import { JsonSchema } from '@jsonforms/core';
|
|
1
2
|
import type { ErrorObject } from 'ajv';
|
|
3
|
+
import { StepStatusData } from './types';
|
|
2
4
|
export declare function hasMeaningfulValue(val: any): boolean;
|
|
5
|
+
export declare function isScopeRequired(normalizedScopes: string[], required: string[]): boolean;
|
|
6
|
+
export declare function hasValueAtScope(data: any, scope: string): boolean;
|
|
3
7
|
export declare function getStepStatus(opts: {
|
|
4
8
|
scopes: string[];
|
|
5
9
|
data: any;
|
|
6
10
|
errors: AjvError[];
|
|
7
|
-
schema:
|
|
8
|
-
visited
|
|
9
|
-
}):
|
|
11
|
+
schema: JsonSchema;
|
|
12
|
+
visited?: boolean;
|
|
13
|
+
}): StepStatusData;
|
|
10
14
|
export declare const isErrorPathIncluded: (errorPaths: string[], path: string) => boolean;
|
|
11
15
|
type AjvError = ErrorObject & {
|
|
12
16
|
dataPath?: string;
|
|
@@ -14,12 +18,6 @@ type AjvError = ErrorObject & {
|
|
|
14
18
|
export declare function normalizeSchemaPath(schemaPath: string): string;
|
|
15
19
|
export declare function normalizeInstancePath(instancePath: string): string;
|
|
16
20
|
export declare function getIncompletePaths(errors: AjvError[] | null | undefined, scopePaths: string[]): string[];
|
|
17
|
-
export type StepStatus = 'not-started' | 'in-progress' | 'completed';
|
|
18
|
-
export interface StepConfig {
|
|
19
|
-
id: string;
|
|
20
|
-
label: string;
|
|
21
|
-
scopePaths: string[];
|
|
22
|
-
}
|
|
23
21
|
export declare const subErrorInParent: (error: ErrorObject, paths: string[]) => boolean;
|
|
24
22
|
export declare const getErrorsInScopes: (errors: ErrorObject[] | null | undefined, scopes: string[]) => ErrorObject[];
|
|
25
23
|
export declare const hasDataInScopes: (data: object, scopes: string[]) => boolean;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { JsonSchema } from '@jsonforms/core';
|
|
2
|
+
export declare function buildConditionalDeps(rootSchema: JsonSchema): Map<string, string[]>;
|
|
@@ -20,4 +20,10 @@ export declare const VALIDATION_KEYWORDS: {
|
|
|
20
20
|
TYPE: string;
|
|
21
21
|
ERROR_MESSAGE: string;
|
|
22
22
|
};
|
|
23
|
+
export declare enum StepStatus {
|
|
24
|
+
NOT_STARTED = "NotStarted",
|
|
25
|
+
IN_PROGRESS = "InProgress",
|
|
26
|
+
COMPLETED = "Completed"
|
|
27
|
+
}
|
|
28
|
+
export type StepStatusType = StepStatus.COMPLETED | StepStatus.NOT_STARTED | StepStatus.IN_PROGRESS;
|
|
23
29
|
export declare const getAddressLookupFieldLabel: (fieldName: string) => string;
|