@beda.software/web-item-controls 0.1.6 → 0.1.12-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.
Files changed (35) hide show
  1. package/dist/components/BaseQuestionnaireResponseForm/hooks.d.ts +4 -4
  2. package/dist/components/BaseQuestionnaireResponseForm/hooks.d.ts.map +1 -1
  3. package/dist/components/BaseQuestionnaireResponseForm/hooks.js +28 -56
  4. package/dist/components/BaseQuestionnaireResponseForm/utils.js +12 -3
  5. package/dist/components/FormWrapper/index.d.ts +4 -3
  6. package/dist/components/FormWrapper/index.d.ts.map +1 -1
  7. package/dist/controls/Boolean/index.js +10 -10
  8. package/dist/controls/Display/index.js +6 -5
  9. package/dist/controls/EditableGroup/hooks.js +5 -5
  10. package/dist/controls/GroupTable/RenderFormItemReadOnly/index.js +6 -5
  11. package/dist/controls/GroupTable/hooks.js +13 -13
  12. package/dist/controls/InsideText/index.js +10 -10
  13. package/dist/controls/Number/index.js +37 -37
  14. package/dist/controls/PasswordInput/index.d.ts.map +1 -1
  15. package/dist/controls/PasswordInput/index.js +12 -12
  16. package/dist/controls/Reference/index.d.ts +3 -3
  17. package/dist/controls/Reference/index.d.ts.map +1 -1
  18. package/dist/controls/String/index.d.ts.map +1 -1
  19. package/dist/controls/String/index.js +31 -31
  20. package/dist/controls/controls.d.ts +6 -0
  21. package/dist/controls/controls.d.ts.map +1 -0
  22. package/dist/controls/controls.js +137 -0
  23. package/dist/controls/index.d.ts +2 -0
  24. package/dist/controls/index.d.ts.map +1 -1
  25. package/dist/controls/index.js +69 -61
  26. package/dist/readonly-controls/Display/index.js +6 -5
  27. package/dist/readonly-controls/index.d.ts +1 -0
  28. package/dist/readonly-controls/index.d.ts.map +1 -1
  29. package/dist/readonly-controls/index.js +41 -36
  30. package/dist/readonly-controls/readonly-controls.d.ts +6 -0
  31. package/dist/readonly-controls/readonly-controls.d.ts.map +1 -0
  32. package/dist/readonly-controls/readonly-controls.js +57 -0
  33. package/package.json +28 -36
  34. package/dist/components/BaseQuestionnaireResponseForm/controls.d.ts +0 -6
  35. package/dist/components/BaseQuestionnaireResponseForm/controls.d.ts.map +0 -1
@@ -1,15 +1,15 @@
1
1
  import { FormItemProps } from 'antd';
2
- import { FCEQuestionnaireItem, FormAnswerItems } from 'sdc-qrf';
2
+ import { FCEQuestionnaireItem } from 'sdc-qrf';
3
3
  export declare function useFieldController<T = unknown>(fieldName: Array<string | number>, questionItem: FCEQuestionnaireItem): {
4
+ formItem: FormItemProps<any>;
4
5
  value: T | undefined;
5
- onMultiChange: (option: FormAnswerItems) => void;
6
+ onChange: (value: T | undefined) => void;
7
+ onMultiChange: (option: import('sdc-qrf').FormAnswerItems) => void;
6
8
  onSelect: (option: unknown) => void;
7
9
  fieldState: import('react-hook-form').ControllerFieldState;
8
10
  disabled: boolean | undefined;
9
- formItem: FormItemProps<any>;
10
11
  placeholder: string | undefined;
11
12
  helpText: string | undefined;
12
- onChange: (...event: any[]) => void;
13
13
  onBlur: import('react-hook-form').Noop;
14
14
  name: import('react-hook-form').FieldPath<TFieldValues>;
15
15
  ref: import('react-hook-form').RefCallBack;
@@ -1 +1 @@
1
- {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/components/BaseQuestionnaireResponseForm/hooks.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAKrC,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAuC,MAAM,SAAS,CAAC;AAOrG,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,YAAY,EAAE,oBAAoB;WAuDvF,CAAC,GAAG,SAAS;4BAzB1B,eAAe;uBAqBU,OAAO;;;;;;eAnD9B,GAAG;;;;EAgErB"}
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../src/components/BaseQuestionnaireResponseForm/hooks.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAS/C,wBAAgB,kBAAkB,CAAC,CAAC,GAAG,OAAO,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,YAAY,EAAE,oBAAoB;;;;;;;;;;;8CAChD,YAAW;;EAkB/E"}
@@ -1,62 +1,34 @@
1
- import { jsx as j } from "react/jsx-runtime";
2
- import E from "classnames";
3
- import G from "lodash";
4
- import { useCallback as i } from "react";
5
- import { useFormContext as N, useController as O } from "react-hook-form";
6
- import { useQuestionnaireResponseFormContext as _ } from "sdc-qrf";
7
- import { getFieldErrorMessage as k } from "./utils.js";
8
- import m from "./BaseQuestionnaireResponseForm.module.scss.js";
9
- import { FieldLabel as q } from "./FieldLabel.js";
10
- function B(c, s) {
11
- const d = _(), {
12
- readOnly: u,
13
- hidden: l,
14
- repeats: t,
15
- text: f,
16
- required: p,
17
- entryFormat: C,
18
- helpText: h
19
- } = s, {
20
- control: g
21
- } = N(), v = s.type === "group" ? {
22
- items: []
23
- } : [], {
24
- field: e,
25
- fieldState: o
26
- } = O({
27
- control: g,
28
- name: c.join("."),
29
- ...t ? {
30
- defaultValue: v
31
- } : {}
32
- }), x = k(e, o, f), F = {
33
- label: /* @__PURE__ */ j(q, { questionItem: s }),
34
- hidden: l,
35
- validateStatus: o != null && o.invalid ? "error" : "success",
36
- help: x,
37
- required: p,
38
- className: E(m.field, {
39
- [m._hidden]: l
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import f from "classnames";
3
+ import { useFieldController as p } from "@beda.software/fhir-questionnaire";
4
+ import { getFieldErrorMessage as u } from "./utils.js";
5
+ import l from "./BaseQuestionnaireResponseForm.module.scss.js";
6
+ import { FieldLabel as F } from "./FieldLabel.js";
7
+ function M(i, e) {
8
+ const o = p(i, e), {
9
+ fieldState: r,
10
+ name: t
11
+ } = o, {
12
+ hidden: s,
13
+ required: m,
14
+ text: a
15
+ } = e, d = u({
16
+ name: t
17
+ }, r, a), n = {
18
+ label: /* @__PURE__ */ c(F, { questionItem: e }),
19
+ hidden: s,
20
+ validateStatus: r != null && r.invalid ? "error" : "success",
21
+ help: d,
22
+ required: m,
23
+ className: f(l.field, {
24
+ [l._hidden]: s
40
25
  })
41
- }, b = i((r) => {
42
- if (t) {
43
- const n = e.value ?? [], a = n.findIndex((M) => G.isEqual(M.value, r.value));
44
- a === -1 ? e.onChange([...n, r]) : (n.splice(a, 1), e.onChange(n));
45
- } else
46
- e.onChange([r]);
47
- }, [t, e]), y = i((r) => e.onChange([].concat(r)), [e]);
26
+ };
48
27
  return {
49
- ...e,
50
- value: e.value,
51
- onMultiChange: b,
52
- onSelect: y,
53
- fieldState: o,
54
- disabled: u || d.readOnly,
55
- formItem: F,
56
- placeholder: C,
57
- helpText: h
28
+ ...o,
29
+ formItem: n
58
30
  };
59
31
  }
60
32
  export {
61
- B as useFieldController
33
+ M as useFieldController
62
34
  };
@@ -1,6 +1,15 @@
1
- function o(r, e, a) {
2
- return !e || !e.invalid || !e.error || !e.error.message ? void 0 : e.error.message.replace(/\[(\d+)\]/g, ".$1").replace(r.name, a ?? "");
1
+ function t(e, r, i) {
2
+ return !r || !r.invalid || !r.error || !r.error.message ? void 0 : r.error.message.replace(/\[(\d+)\]/g, ".$1").replace(e.name, i ?? "");
3
+ }
4
+ function d(e) {
5
+ var r;
6
+ return (r = e.item) == null ? void 0 : r.some((i) => {
7
+ var a, n, s;
8
+ const o = (s = (n = (a = i.itemControl) == null ? void 0 : a.coding) == null ? void 0 : n[0]) == null ? void 0 : s.code;
9
+ return o && ["wizard", "wizard-with-tooltips", "wizard-vertical", "wizard-navigation-group"].includes(o);
10
+ });
3
11
  }
4
12
  export {
5
- o as getFieldErrorMessage
13
+ t as getFieldErrorMessage,
14
+ d as isGroupWizard
6
15
  };
@@ -1,17 +1,18 @@
1
1
  import { QuestionnaireResponse } from 'fhir/r4b';
2
2
  import { ReactElement } from 'react';
3
- import { GroupItemProps } from 'sdc-qrf';
4
3
  import { FormWrapperProps } from '@beda.software/fhir-questionnaire/components';
5
4
  import { RemoteDataResult } from '@beda.software/remote-data';
5
+ import { FormFooterComponentProps } from '../BaseQuestionnaireResponseForm/FormFooter';
6
6
  export declare function FormWrapper(props: FormWrapperProps & {
7
7
  onCancel?: () => void;
8
8
  onSaveDraft?: (questionnaireResponse: QuestionnaireResponse) => Promise<RemoteDataResult<QuestionnaireResponse>>;
9
- saveButtonTitle?: string | ReactElement;
9
+ saveButtonTitle?: ReactElement | string;
10
+ cancelButtonTitle?: ReactElement | string;
11
+ FormFooterComponent?: React.ElementType<FormFooterComponentProps>;
10
12
  }): import("react/jsx-runtime").JSX.Element;
11
13
  export declare function ReadonlyFormWrapper(props: FormWrapperProps & {
12
14
  onCancel?: () => void;
13
15
  onSaveDraft?: (questionnaireResponse: QuestionnaireResponse) => Promise<RemoteDataResult<QuestionnaireResponse>>;
14
16
  saveButtonTitle?: string | ReactElement;
15
17
  }): import("react/jsx-runtime").JSX.Element;
16
- export declare function GroupItemComponent(itemProps: GroupItemProps): import("react/jsx-runtime").JSX.Element;
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FormWrapper/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAEhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAQ9D,wBAAgB,WAAW,CACvB,KAAK,EAAE,gBAAgB,GAAG;IACtB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,CACV,qBAAqB,EAAE,qBAAqB,KAC3C,OAAO,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,CAAC,CAAC;IACtD,eAAe,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;CAC3C,2CAqCJ;AAED,wBAAgB,mBAAmB,CAC/B,KAAK,EAAE,gBAAgB,GAAG;IACtB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,CACV,qBAAqB,EAAE,qBAAqB,KAC3C,OAAO,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,CAAC,CAAC;IACtD,eAAe,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;CAC3C,2CAyBJ;AACD,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,cAAc,2CAI3D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/FormWrapper/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,OAAO,EAAE,YAAY,EAAY,MAAM,OAAO,CAAC;AAE/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AAEhF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAE9D,OAAO,EAAc,wBAAwB,EAAE,MAAM,yDAAyD,CAAC;AAK/G,wBAAgB,WAAW,CACvB,KAAK,EAAE,gBAAgB,GAAG;IACtB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,CACV,qBAAqB,EAAE,qBAAqB,KAC3C,OAAO,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,CAAC,CAAC;IACtD,eAAe,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IACxC,iBAAiB,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC;IAC1C,mBAAmB,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;CACrE,2CAoCJ;AACD,wBAAgB,mBAAmB,CAC/B,KAAK,EAAE,gBAAgB,GAAG;IACtB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,WAAW,CAAC,EAAE,CACV,qBAAqB,EAAE,qBAAqB,KAC3C,OAAO,CAAC,gBAAgB,CAAC,qBAAqB,CAAC,CAAC,CAAC;IACtD,eAAe,CAAC,EAAE,MAAM,GAAG,YAAY,CAAC;CAC3C,2CAyBJ"}
@@ -1,23 +1,23 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
- import { Form as h, Checkbox as u } from "antd";
2
+ import { Form as u, Checkbox as k } from "antd";
3
3
  import { useFieldController as p } from "../../components/BaseQuestionnaireResponseForm/hooks.js";
4
4
  import { S as b } from "./styles.js";
5
- function C({
5
+ function g({
6
6
  parentPath: a,
7
7
  questionItem: o
8
8
  }) {
9
9
  const {
10
10
  linkId: r,
11
- text: l
12
- } = o, n = [...a, r, 0, "value", "boolean"], {
13
- value: i,
14
- onChange: d,
11
+ text: n
12
+ } = o, l = [...a, r, 0, "value", "boolean"], {
13
+ value: d,
14
+ onChange: i,
15
15
  disabled: c,
16
16
  formItem: t,
17
- onBlur: m
18
- } = p(n, o), s = t.validateStatus === "error";
19
- return /* @__PURE__ */ e(h.Item, { ...t, valuePropName: "checked", "data-testid": "question-boolean", "data-linkid": r, label: void 0, children: /* @__PURE__ */ e(b.CheckboxWrapper, { $hasError: s, children: /* @__PURE__ */ e(u, { disabled: c, onChange: d, checked: i, "data-testid": "checkbox", onBlur: m, children: l }) }) });
17
+ onBlur: h
18
+ } = p(l, o), m = t.validateStatus === "error";
19
+ return /* @__PURE__ */ e(u.Item, { ...t, valuePropName: "checked", "data-testid": "question-boolean", "data-linkid": r, label: void 0, children: /* @__PURE__ */ e(b.CheckboxWrapper, { $hasError: m, children: /* @__PURE__ */ e(k, { disabled: c, onChange: (s) => i(s.target.checked), checked: d, "data-testid": "checkbox", onBlur: h, children: n }) }) });
20
20
  }
21
21
  export {
22
- C as QuestionBoolean
22
+ g as QuestionBoolean
23
23
  };
@@ -10,9 +10,7 @@ import "@beda.software/fhir-react";
10
10
  import "../../components/AudioRecorder/styles.js";
11
11
  import "react";
12
12
  import "@beda.software/remote-data";
13
- import "lodash";
14
- import "react-hook-form";
15
- import "sdc-qrf";
13
+ import "@beda.software/fhir-questionnaire";
16
14
  import "../../components/BaseQuestionnaireResponseForm/BaseQuestionnaireResponseForm.module.scss.js";
17
15
  import "../Group/context.js";
18
16
  import "../../components/BaseQuestionnaireResponseForm/BaseQuestionnaireResponseForm.styles.js";
@@ -21,13 +19,16 @@ import "../../services/fhir.js";
21
19
  import "../../readonly-controls/ReadonlyWidgets.module.scss.js";
22
20
  import "../../readonly-controls/ReadonlyWidgets.styles.js";
23
21
  import "@lingui/core";
22
+ import "lodash";
24
23
  import "yup";
24
+ import "sdc-qrf";
25
25
  import "fhirpath";
26
26
  import "../../utils/yup-locale.js";
27
27
  import { S as d } from "./styles.js";
28
28
  import "antd/es/layout/layout";
29
29
  import "styled-components";
30
30
  import "antd/es/layout/Sider";
31
+ import "react-hook-form";
31
32
  import "../../components/Wizard/styles.js";
32
33
  import "../GroupWizard/index.js";
33
34
  import "../../readonly-controls/GroupWizard/styles.js";
@@ -37,7 +38,7 @@ import "react-select/async";
37
38
  import "../../components/Select/styles.js";
38
39
  import "fhirpath/fhir-context/r4";
39
40
  import "../../sharedState/index.js";
40
- function C({
41
+ function rr({
41
42
  questionItem: m
42
43
  }) {
43
44
  var p, e;
@@ -63,6 +64,6 @@ const a = ({
63
64
  return t == null ? void 0 : t.map((r, o) => r.startsWith("http://") || r.startsWith("https://") ? /* @__PURE__ */ i("a", { href: r, target: "_blank", rel: "noreferrer", children: r }, o) : /* @__PURE__ */ i("span", { children: r }, o));
64
65
  };
65
66
  export {
66
- C as Display,
67
+ rr as Display,
67
68
  a as TextWithLink
68
69
  };
@@ -21,9 +21,9 @@ function Q(V) {
21
21
  control: O,
22
22
  getValues: l,
23
23
  reset: a
24
- } = _(), [E, m] = I(!1), [u, p] = I(null), [R, f] = I(null), W = z({
24
+ } = _(), [v, m] = I(!1), [u, p] = I(null), [E, f] = I(null), R = z({
25
25
  control: O
26
- }), o = t.get(W, r), h = i(() => s == null ? void 0 : s.filter((e) => !e.hidden && e.type !== "display"), [s]), j = i(() => o != null && o.items ? [o.items] : [], [o]), v = i(() => t.map(h, (e) => e.linkId), [h]), F = H(v, j, n), S = c(() => {
26
+ }), o = t.get(R, r), h = i(() => s == null ? void 0 : s.filter((e) => !e.hidden && e.type !== "display"), [s]), W = i(() => o != null && o.items ? [o.items] : [], [o]), j = i(() => t.map(h, (e) => e.linkId), [h]), F = H(j, W, n), S = c(() => {
27
27
  p(t.cloneDeep(o)), f(t.cloneDeep(F));
28
28
  }, [F, o]), w = c(() => {
29
29
  S(), m(!0);
@@ -32,7 +32,7 @@ function Q(V) {
32
32
  t.set(e, r, t.cloneDeep(u)), a(e, {
33
33
  keepDirty: !0
34
34
  }), y({
35
- items: u
35
+ items: u ?? void 0
36
36
  }), p(null), f(null), m(!1);
37
37
  }, [r, l, y, a, u]), N = c(() => {
38
38
  p(null), f(null);
@@ -54,11 +54,11 @@ function Q(V) {
54
54
  title: q,
55
55
  dataSource: F,
56
56
  dataColumns: P,
57
- isModalVisible: E,
57
+ isModalVisible: v,
58
58
  handleCancel: G,
59
59
  handleUpdate: w,
60
60
  handleSave: N,
61
- snapshotDataSource: R
61
+ snapshotDataSource: E
62
62
  };
63
63
  }
64
64
  export {
@@ -8,9 +8,7 @@ import "@beda.software/fhir-react";
8
8
  import "../../../components/AudioRecorder/styles.js";
9
9
  import "react";
10
10
  import "@beda.software/remote-data";
11
- import "lodash";
12
- import "react-hook-form";
13
- import "sdc-qrf";
11
+ import "@beda.software/fhir-questionnaire";
14
12
  import "../../../components/BaseQuestionnaireResponseForm/BaseQuestionnaireResponseForm.module.scss.js";
15
13
  import "../../../components/BaseQuestionnaireResponseForm/BaseQuestionnaireResponseForm.styles.js";
16
14
  import "../../Group/context.js";
@@ -19,13 +17,16 @@ import "../../../services/fhir.js";
19
17
  import "../../../readonly-controls/ReadonlyWidgets.module.scss.js";
20
18
  import "../../../readonly-controls/ReadonlyWidgets.styles.js";
21
19
  import "@lingui/core";
20
+ import "lodash";
22
21
  import "yup";
22
+ import "sdc-qrf";
23
23
  import "fhirpath";
24
24
  import "../../../utils/yup-locale.js";
25
25
  import "../../Display/styles.js";
26
26
  import "antd/es/layout/layout";
27
27
  import "styled-components";
28
28
  import "antd/es/layout/Sider";
29
+ import "react-hook-form";
29
30
  import "../../../components/Wizard/styles.js";
30
31
  import "../../GroupWizard/index.js";
31
32
  import "../../../readonly-controls/GroupWizard/styles.js";
@@ -37,7 +38,7 @@ import "fhirpath/fhir-context/r4";
37
38
  import "../../../sharedState/index.js";
38
39
  import { useRenderFormItemReadOnly as h } from "./hooks.js";
39
40
  import { S as i } from "./styles.js";
40
- const Z = (p) => {
41
+ const _ = (p) => {
41
42
  const {
42
43
  rows: m,
43
44
  emptySymbol: e
@@ -51,5 +52,5 @@ const Z = (p) => {
51
52
  }) });
52
53
  };
53
54
  export {
54
- Z as RenderFormItemReadOnly
55
+ _ as RenderFormItemReadOnly
55
56
  };
@@ -3,7 +3,7 @@ import { i18n as re } from "@lingui/core";
3
3
  import { MinusOutlined as Oe, PlusOutlined as Te } from "@ant-design/icons";
4
4
  import { Button as oe, Popconfirm as je } from "antd";
5
5
  import s from "lodash";
6
- import { useMemo as S, useState as P, useCallback as g, useEffect as z, useRef as Z } from "react";
6
+ import { useMemo as S, useState as P, useCallback as g, useEffect as z, useRef as v } from "react";
7
7
  import { useFormContext as Ge, useWatch as Ke } from "react-hook-form";
8
8
  import { populateItemKey as Pe } from "sdc-qrf";
9
9
  import { useFieldController as _e } from "../../components/BaseQuestionnaireResponseForm/hooks.js";
@@ -11,7 +11,7 @@ import { TableFilter as qe } from "../../components/Table/TableFilter/index.js";
11
11
  import { RenderFormItemReadOnly as ge } from "./RenderFormItemReadOnly/index.js";
12
12
  import { S as se } from "./styles.js";
13
13
  import { getChartYRange as Be, getDataSource as Le, getColumnWidth as ze, getSearchBarColumnType as Ne, isColumnTypeArray as xe, createColumnFilterValue as Xe, getGroupSorter as Ye, isTableItemMatchesFilter as $e } from "./utils.js";
14
- function Ze() {
14
+ function ve() {
15
15
  const [F, y] = P({}), d = g((l, i, a) => {
16
16
  y((p) => l && !s.isEmpty(l) ? {
17
17
  ...p,
@@ -54,7 +54,7 @@ function Ze() {
54
54
  }, [F, u, d])
55
55
  };
56
56
  }
57
- function ve() {
57
+ function Ze() {
58
58
  const F = (u) => {
59
59
  const f = u.item || [];
60
60
  return s.reduce(f, (i, a) => {
@@ -92,7 +92,7 @@ function Je(F) {
92
92
  const {
93
93
  expandableMaxHeight: y,
94
94
  dataSource: d
95
- } = F, u = 32, f = Z({}), l = Z(null), i = Z(/* @__PURE__ */ new WeakMap()), a = Z(y), [p, m] = P({}), [E, h] = P([]), C = g((t, e) => {
95
+ } = F, u = 32, f = v({}), l = v(null), i = v(/* @__PURE__ */ new WeakMap()), a = v(y), [p, m] = P({}), [E, h] = P([]), C = g((t, e) => {
96
96
  if (t.length !== e.length)
97
97
  return !1;
98
98
  const r = new Set(e.map(String));
@@ -162,7 +162,7 @@ function Je(F) {
162
162
  h((e) => C(e, t) ? e : t);
163
163
  }, [C, d, M]), R = g(() => {
164
164
  h((t) => t.length === 0 ? t : []);
165
- }, []), W = S(() => d.map((t) => t.key).filter((t) => M(t)), [d, M]), O = W.length > 0, _ = S(() => new Set(E.map(String)), [E]), B = O && W.every((t) => _.has(t)), v = E.length > 0;
165
+ }, []), W = S(() => d.map((t) => t.key).filter((t) => M(t)), [d, M]), O = W.length > 0, _ = S(() => new Set(E.map(String)), [E]), B = O && W.every((t) => _.has(t)), Z = E.length > 0;
166
166
  return {
167
167
  observeRow: V,
168
168
  rowHeightExceedsMaxHeight: M,
@@ -173,7 +173,7 @@ function Je(F) {
173
173
  isRowExpanded: E,
174
174
  hasExpandableRows: O,
175
175
  isAllExpandableRowsExpanded: B,
176
- hasExpandedRows: v
176
+ hasExpandedRows: Z
177
177
  };
178
178
  }
179
179
  function ut(F) {
@@ -195,11 +195,11 @@ function ut(F) {
195
195
  control: N,
196
196
  getValues: w,
197
197
  reset: R
198
- } = Ge(), [W, O] = P(!C && !V), [_, B] = P(!1), [v, t] = P(void 0), [e, r] = P(null), [o, k] = P(null), {
198
+ } = Ge(), [W, O] = P(!C && !V), [_, B] = P(!1), [Z, t] = P(void 0), [e, r] = P(null), [o, k] = P(null), {
199
199
  populateColumnWithFilters: H
200
- } = Ze(), {
200
+ } = ve(), {
201
201
  populateColumnWithSorters: X
202
- } = ve(), Ee = Ke({
202
+ } = Ze(), Ee = Ke({
203
203
  control: N
204
204
  }), T = s.get(Ee, h), q = S(() => m == null ? void 0 : m.filter((n) => !n.hidden && n.type !== "display"), [m]), j = S(() => (T == null ? void 0 : T.items) || [], [T]), Y = S(() => s.map(q, (n) => n.linkId), [q]), G = S(() => Le(Y, j, d), [Y, j, d]), {
205
205
  observeRow: we,
@@ -224,7 +224,7 @@ function ut(F) {
224
224
  s.set(n, h, s.cloneDeep(e)), R(n, {
225
225
  keepDirty: !0
226
226
  }), I({
227
- items: e
227
+ items: e ?? void 0
228
228
  }), r(null), k(null), t(void 0), B(!1);
229
229
  }, [h, w, I, R, e]), Ce = g(() => {
230
230
  r(null), k(null);
@@ -337,7 +337,7 @@ function ut(F) {
337
337
  columns: De,
338
338
  expandable: Ve,
339
339
  isModalVisible: _,
340
- editIndex: v,
340
+ editIndex: Z,
341
341
  handleCancel: ke,
342
342
  handleSave: Ce,
343
343
  snapshotDataSource: o,
@@ -356,7 +356,7 @@ function ut(F) {
356
356
  }
357
357
  export {
358
358
  ut as useGroupTable,
359
- Ze as useGroupTableFilter,
360
- ve as useGroupTableSorter,
359
+ ve as useGroupTableFilter,
360
+ Ze as useGroupTableSorter,
361
361
  Je as useRowExpandability
362
362
  };
@@ -1,7 +1,7 @@
1
- import { jsx as u } from "react/jsx-runtime";
2
- import { useFieldController as a } from "../../components/BaseQuestionnaireResponseForm/hooks.js";
3
- import p from "./InputInsideText.js";
4
- function m({
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import { useFieldController as p } from "../../components/BaseQuestionnaireResponseForm/hooks.js";
3
+ import x from "./InputInsideText.js";
4
+ function g({
5
5
  parentPath: t,
6
6
  questionItem: e
7
7
  }) {
@@ -10,12 +10,12 @@ function m({
10
10
  } = e, o = [...t, n, 0, "value", "string"], {
11
11
  value: r,
12
12
  onChange: l,
13
- disabled: i,
14
- onBlur: d,
15
- placeholder: s
16
- } = a(o, e);
17
- return /* @__PURE__ */ u(p, { value: r ?? "", disabled: i, onChange: l, onBlur: d, placeholder: s, text: e.text ?? "" });
13
+ disabled: a,
14
+ onBlur: i,
15
+ placeholder: u
16
+ } = p(o, e);
17
+ return /* @__PURE__ */ s(x, { value: r ?? "", disabled: a, onChange: (d) => l(d.target.value), onBlur: i, placeholder: u, text: e.text ?? "" });
18
18
  }
19
19
  export {
20
- m as QuestionInputInsideText
20
+ g as QuestionInputInsideText
21
21
  };
@@ -1,83 +1,83 @@
1
- import { jsx as s } from "react/jsx-runtime";
1
+ import { jsx as i } from "react/jsx-runtime";
2
2
  import { Form as f, InputNumber as g, Select as k } from "antd";
3
3
  import x from "lodash";
4
4
  import { useState as N } from "react";
5
5
  import { useFieldController as v } from "../../components/BaseQuestionnaireResponseForm/hooks.js";
6
- const I = {
6
+ const C = {
7
7
  width: "100%"
8
8
  };
9
9
  function M({
10
10
  parentPath: c,
11
- questionItem: n
11
+ questionItem: o
12
12
  }) {
13
13
  const {
14
- linkId: d,
15
- required: o
16
- } = n, {
14
+ linkId: n,
15
+ required: d
16
+ } = o, {
17
17
  unit: e
18
- } = n, m = [...c, d, 0, "value", "integer"], {
18
+ } = o, m = [...c, n, 0, "value", "integer"], {
19
19
  value: u,
20
20
  onChange: t,
21
- disabled: i,
21
+ disabled: s,
22
22
  formItem: r,
23
- placeholder: y
24
- } = v(m, n);
25
- return /* @__PURE__ */ s(f.Item, { ...r, "data-testid": d, "data-linkid": d, children: /* @__PURE__ */ s(g, { addonAfter: e == null ? void 0 : e.display, style: I, disabled: i, onChange: t, value: u, required: o, placeholder: y, parser: (h) => x.toInteger(h) }) });
23
+ placeholder: h
24
+ } = v(m, o);
25
+ return /* @__PURE__ */ i(f.Item, { ...r, "data-testid": n, "data-linkid": n, children: /* @__PURE__ */ i(g, { addonAfter: e == null ? void 0 : e.display, style: C, disabled: s, onChange: (p) => t(p ?? void 0), value: u, required: d, placeholder: h, parser: (p) => x.toInteger(p) }) });
26
26
  }
27
27
  function P({
28
28
  parentPath: c,
29
- questionItem: n
29
+ questionItem: o
30
30
  }) {
31
31
  const {
32
- linkId: d
33
- } = n, {
34
- unit: o
35
- } = n, e = [...c, d, 0, "value", "decimal"], {
32
+ linkId: n
33
+ } = o, {
34
+ unit: d
35
+ } = o, e = [...c, n, 0, "value", "decimal"], {
36
36
  value: m,
37
37
  onChange: u,
38
38
  disabled: t,
39
- formItem: i,
39
+ formItem: s,
40
40
  placeholder: r
41
- } = v(e, n);
42
- return /* @__PURE__ */ s(f.Item, { ...i, "data-testid": d, "data-linkid": d, children: /* @__PURE__ */ s(g, { addonAfter: o == null ? void 0 : o.display, style: I, disabled: t, onChange: u, value: m, placeholder: r }) });
41
+ } = v(e, o);
42
+ return /* @__PURE__ */ i(f.Item, { ...s, "data-testid": n, "data-linkid": n, children: /* @__PURE__ */ i(g, { addonAfter: d == null ? void 0 : d.display, style: C, disabled: t, onChange: (h) => u(h ?? void 0), value: m, placeholder: r }) });
43
43
  }
44
44
  function _(c) {
45
45
  const {
46
- parentPath: n,
47
- questionItem: d
46
+ parentPath: o,
47
+ questionItem: n
48
48
  } = c, {
49
- linkId: o,
49
+ linkId: d,
50
50
  unitOption: e,
51
51
  required: m
52
- } = d, u = [...n, o, 0, "value", "Quantity"], {
52
+ } = n, u = [...o, d, 0, "value", "Quantity"], {
53
53
  value: t,
54
- onChange: i,
54
+ onChange: s,
55
55
  disabled: r,
56
- formItem: y,
57
- placeholder: h
58
- } = v(u, d), [C, Q] = N(t == null ? void 0 : t.value), [a, S] = N(t ? {
56
+ formItem: h,
57
+ placeholder: p
58
+ } = v(u, n), [I, Q] = N(t == null ? void 0 : t.value), [a, S] = N(t ? {
59
59
  code: t.code,
60
60
  display: t.unit,
61
61
  system: t.system
62
62
  } : e == null ? void 0 : e[0]), b = (l) => {
63
- const p = e == null ? void 0 : e.find((V) => V.display === l);
64
- p && (S(p), i({
65
- value: C,
66
- unit: p.display,
67
- system: p.system,
68
- code: p.code
63
+ const y = e == null ? void 0 : e.find((V) => V.display === l);
64
+ y && (S(y), s({
65
+ value: I,
66
+ unit: y.display,
67
+ system: y.system,
68
+ code: y.code
69
69
  }));
70
70
  }, A = (l) => {
71
- Q(l || void 0), i({
72
- value: l,
71
+ Q(l || void 0), s({
72
+ value: l ?? void 0,
73
73
  unit: a == null ? void 0 : a.display,
74
74
  system: a == null ? void 0 : a.system,
75
75
  code: a == null ? void 0 : a.code
76
76
  });
77
77
  };
78
- return /* @__PURE__ */ s(f.Item, { ...y, "data-testid": o, "data-linkid": o, children: /* @__PURE__ */ s(g, { addonAfter: e && e.length > 1 ? /* @__PURE__ */ s(k, { value: a == null ? void 0 : a.display, onChange: b, style: {
78
+ return /* @__PURE__ */ i(f.Item, { ...h, "data-testid": d, "data-linkid": d, children: /* @__PURE__ */ i(g, { addonAfter: e && e.length > 1 ? /* @__PURE__ */ i(k, { value: a == null ? void 0 : a.display, onChange: b, style: {
79
79
  minWidth: 70
80
- }, disabled: r, popupMatchSelectWidth: !1, children: e.map((l) => /* @__PURE__ */ s(k.Option, { value: l.display, children: l.display }, l.code)) }) : a == null ? void 0 : a.display, style: I, disabled: r, onChange: A, value: C, placeholder: h, required: m }) });
80
+ }, disabled: r, popupMatchSelectWidth: !1, children: e.map((l) => /* @__PURE__ */ i(k.Option, { value: l.display, children: l.display }, l.code)) }) : a == null ? void 0 : a.display, style: C, disabled: r, onChange: A, value: I, placeholder: p, required: m }) });
81
81
  }
82
82
  export {
83
83
  P as QuestionDecimal,
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/PasswordInput/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAI5C,wBAAgB,aAAa,CAAC,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,iBAAiB,2CAU5E"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/controls/PasswordInput/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAI5C,wBAAgB,aAAa,CAAC,EAAE,UAAU,EAAE,YAAY,EAAE,EAAE,iBAAiB,2CAe5E"}
@@ -1,21 +1,21 @@
1
1
  import { jsx as r } from "react/jsx-runtime";
2
- import { Form as a, Input as u } from "antd";
3
- import { useFieldController as f } from "../../components/BaseQuestionnaireResponseForm/hooks.js";
4
- function g({
2
+ import { Form as u, Input as f } from "antd";
3
+ import { useFieldController as p } from "../../components/BaseQuestionnaireResponseForm/hooks.js";
4
+ function h({
5
5
  parentPath: n,
6
6
  questionItem: o
7
7
  }) {
8
8
  const {
9
- linkId: t
10
- } = o, e = [...n, t, 0, "value", "string"], {
9
+ linkId: e
10
+ } = o, t = [...n, e, 0, "value", "string"], {
11
11
  value: l,
12
- onChange: m,
13
- disabled: s,
14
- formItem: i,
15
- onBlur: d
16
- } = f(e, o);
17
- return /* @__PURE__ */ r(a.Item, { ...i, children: /* @__PURE__ */ r(u.Password, { value: l, disabled: s, onChange: m, onBlur: d }) });
12
+ onChange: a,
13
+ disabled: m,
14
+ formItem: s,
15
+ onBlur: i
16
+ } = p(t, o);
17
+ return /* @__PURE__ */ r(u.Item, { ...s, children: /* @__PURE__ */ r(f.Password, { value: l, disabled: m, onChange: (d) => a(d.target.value), onBlur: i }) });
18
18
  }
19
19
  export {
20
- g as PasswordInput
20
+ h as PasswordInput
21
21
  };
@@ -32,17 +32,17 @@ export declare function useAnswerReference<R extends Resource = any, IR extends
32
32
  resourceType: string | undefined;
33
33
  deps: string[];
34
34
  fieldController: {
35
+ formItem: import('antd').FormItemProps<any>;
35
36
  value: FormAnswerItems[] | undefined;
37
+ onChange: (value: FormAnswerItems[] | undefined) => void;
36
38
  onMultiChange: (option: FormAnswerItems) => void;
37
39
  onSelect: (option: unknown) => void;
38
40
  fieldState: import('react-hook-form').ControllerFieldState;
39
41
  disabled: boolean | undefined;
40
- formItem: import('antd').FormItemProps<any>;
41
42
  placeholder: string | undefined;
42
43
  helpText: string | undefined;
43
- onChange: (...event: any[]) => void;
44
44
  onBlur: import('react-hook-form').Noop;
45
- name: import('react-hook-form').Path<TFieldValues>;
45
+ name: import('react-hook-form').FieldPath<TFieldValues>;
46
46
  ref: import('react-hook-form').RefCallBack;
47
47
  };
48
48
  text: string | undefined;