@beda.software/web-item-controls 0.1.2 → 0.1.5

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.
@@ -15,7 +15,7 @@ export declare const DatePicker: (<ValueType = import('moment').Moment>(props: i
15
15
  RangePicker: import('react').ForwardRefExoticComponent<Omit<import('rc-picker').RangePickerProps<import('moment').Moment>, "locale" | "generateConfig" | "hideHeader"> & {
16
16
  locale?: import('antd/es/date-picker/generatePicker').PickerLocale | undefined;
17
17
  size?: import('antd/es/button').ButtonSize;
18
- placement?: "topLeft" | "topRight" | "bottomLeft" | "bottomRight" | undefined;
18
+ placement?: "bottomLeft" | "bottomRight" | "topLeft" | "topRight" | undefined;
19
19
  bordered?: boolean | undefined;
20
20
  status?: "" | "error" | "warning" | undefined;
21
21
  variant?: "filled" | "outlined" | "borderless" | "underlined" | undefined;
@@ -11,6 +11,7 @@ import "react-select/async";
11
11
  import "../Select/styles.js";
12
12
  import "lodash";
13
13
  import "../../contexts/valueset-expand.js";
14
+ import "../../contexts/markdown-editor-context.js";
14
15
  import "moment";
15
16
  import "@lingui/core";
16
17
  import "yup";
@@ -30,7 +31,7 @@ import "../Table/table.scss.js";
30
31
  import "../TimePicker/index.js";
31
32
  import m from "../BaseQuestionnaireResponseForm/BaseQuestionnaireResponseForm.module.scss.js";
32
33
  import { useModalQuestionnaireGroupItem as I } from "./hooks.js";
33
- function W(t) {
34
+ function X(t) {
34
35
  const {
35
36
  open: i,
36
37
  groupItem: e,
@@ -51,5 +52,5 @@ function W(t) {
51
52
  return /* @__PURE__ */ o(h, { title: u, open: i, onOk: a, onCancel: p, destroyOnClose: !0, closable: !1, children: /* @__PURE__ */ o("div", { className: d(m.content, "form__content", m.form), children: /* @__PURE__ */ o(f, { questionItems: s, parentPath: [...c], context: l }) }) });
52
53
  }
53
54
  export {
54
- W as ModalQuestionnaireGroupItem
55
+ X as ModalQuestionnaireGroupItem
55
56
  };
@@ -1,28 +1,29 @@
1
- import s from "lodash";
1
+ import i from "lodash";
2
2
  import { useContext as p, useCallback as f } from "react";
3
3
  import { ValueSetExpandProvider as g } from "../../../../contexts/valueset-expand.js";
4
- function y(i) {
4
+ import "../../../../contexts/markdown-editor-context.js";
5
+ function h(u) {
5
6
  const {
6
7
  columnFilterValue: r,
7
8
  onChange: o
8
- } = i, {
9
+ } = u, {
9
10
  id: l,
10
11
  valueSet: a,
11
- repeats: u
12
- } = r.column, c = p(g), d = async (e) => c(a, e), m = s.debounce((e, t) => {
12
+ repeats: s
13
+ } = r.column, c = p(g), d = async (e) => c(a, e), m = i.debounce((e, t) => {
13
14
  (async () => t(await d(e)))();
14
15
  }, 500);
15
16
  return {
16
17
  onSelect: f((e) => {
17
- if (!e || s.isArray(e) && e.length === 0)
18
+ if (!e || i.isArray(e) && e.length === 0)
18
19
  return o(null, l);
19
- if (u)
20
+ if (s)
20
21
  return o(e, l);
21
22
  o([e], l);
22
- }, [l, o, u]),
23
+ }, [l, o, s]),
23
24
  isOptionSelected: (e) => {
24
25
  var t;
25
- return !!r.value && ((t = r.value) == null ? void 0 : t.findIndex((n) => s.isEqual(n, e))) !== -1;
26
+ return !!r.value && ((t = r.value) == null ? void 0 : t.findIndex((n) => i.isEqual(n, e))) !== -1;
26
27
  },
27
28
  getOptionLabel: (e) => {
28
29
  var t, n;
@@ -32,5 +33,5 @@ function y(i) {
32
33
  };
33
34
  }
34
35
  export {
35
- y as useChoiceColumn
36
+ h as useChoiceColumn
36
37
  };
@@ -16,7 +16,7 @@ export declare const S: {
16
16
  Title: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components').FastOmit<import('antd/es/typography/Title').TitleProps & import('react').RefAttributes<HTMLElement>, never>> & string & Omit<import('react').ForwardRefExoticComponent<import('antd/es/typography/Title').TitleProps & import('react').RefAttributes<HTMLElement>>, keyof import('react').Component<any, {}, any>>;
17
17
  Icon: import('styled-components/dist/types').IStyledComponentBase<"web", import('styled-components/dist/types').Substitute<import('react').DetailedHTMLProps<import('react').HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {
18
18
  $active: boolean;
19
- $status?: "wait" | "error" | "process" | "finish" | undefined;
19
+ $status?: "error" | "wait" | "process" | "finish" | undefined;
20
20
  $size?: "small" | "default" | undefined;
21
21
  $disabled?: boolean | undefined;
22
22
  }>> & string;
@@ -1,2 +1,3 @@
1
1
  export * from './valueset-expand';
2
+ export * from './markdown-editor-context';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,2BAA2B,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { ValueSetExpandProvider as e } from "./valueset-expand.js";
2
+ import { MarkdownProcessorContext as a, defaultMarkdownProcessor as d } from "./markdown-editor-context.js";
3
+ export {
4
+ a as MarkdownProcessorContext,
5
+ e as ValueSetExpandProvider,
6
+ d as defaultMarkdownProcessor
7
+ };
@@ -8,11 +8,12 @@ import v from "../../components/BaseQuestionnaireResponseForm/BaseQuestionnaireR
8
8
  import { useFieldController as w } from "../../components/BaseQuestionnaireResponseForm/hooks.js";
9
9
  import { Select as V, AsyncSelect as k } from "../../components/Select/index.js";
10
10
  import { ValueSetExpandProvider as D } from "../../contexts/valueset-expand.js";
11
+ import "../../contexts/markdown-editor-context.js";
11
12
  import { getDisplay as S } from "../../utils/questionnaire.js";
12
13
  function E(d) {
13
14
  const {
14
15
  value: e,
15
- onChange: n,
16
+ onChange: i,
16
17
  options: u,
17
18
  repeats: a = !1,
18
19
  placeholder: l = C._(
@@ -26,21 +27,21 @@ function E(d) {
26
27
  } = d;
27
28
  return /* @__PURE__ */ r(O, { children: /* @__PURE__ */ r(V, { value: e, options: u.map((o) => ({
28
29
  value: I(o, "value")
29
- })), className: v.select, onChange: (o) => n(o), isOptionSelected: (o) => !!e && (e == null ? void 0 : e.findIndex((i) => g.isEqual(i == null ? void 0 : i.value, o.value))) !== -1, isMulti: a, getOptionLabel: (o) => S(o.value, s) || "", classNamePrefix: "react-select", placeholder: l, isDisabled: c }) });
30
+ })), className: v.select, onChange: (o) => i(o), isOptionSelected: (o) => !!e && (e == null ? void 0 : e.findIndex((n) => g.isEqual(n == null ? void 0 : n.value, o.value))) !== -1, isMulti: a, getOptionLabel: (o) => S(o.value, s) || "", classNamePrefix: "react-select", placeholder: l, isDisabled: c }) });
30
31
  }
31
- function B({
32
+ function G({
32
33
  parentPath: d,
33
34
  questionItem: e
34
35
  }) {
35
36
  const {
36
- linkId: n,
37
+ linkId: i,
37
38
  answerOption: u,
38
39
  repeats: a,
39
40
  answerValueSet: l,
40
41
  choiceColumn: s
41
- } = e, c = [...d, n], {
42
+ } = e, c = [...d, i], {
42
43
  value: o,
43
- formItem: i,
44
+ formItem: n,
44
45
  onSelect: m,
45
46
  placeholder: f = C._(
46
47
  /*i18n*/
@@ -50,25 +51,25 @@ function B({
50
51
  ),
51
52
  disabled: t
52
53
  } = w(c, e);
53
- return l ? /* @__PURE__ */ r(h.Item, { ...i, "data-testid": "question-choice", "data-linkid": n, children: /* @__PURE__ */ r(F, { answerValueSet: l, value: o ?? [], onChange: m, repeats: a, placeholder: f, choiceColumn: s, preferredTerminologyServer: e.preferredTerminologyServer, disabled: t }) }) : /* @__PURE__ */ r(h.Item, { ...i, "data-testid": "question-choice", "data-linkid": n, children: /* @__PURE__ */ r(E, { options: u ?? [], value: o ?? [], onChange: m, repeats: a, placeholder: f, choiceColumn: s, disabled: t }) });
54
+ return l ? /* @__PURE__ */ r(h.Item, { ...n, "data-testid": "question-choice", "data-linkid": i, children: /* @__PURE__ */ r(F, { answerValueSet: l, value: o ?? [], onChange: m, repeats: a, placeholder: f, choiceColumn: s, preferredTerminologyServer: e.preferredTerminologyServer, disabled: t }) }) : /* @__PURE__ */ r(h.Item, { ...n, "data-testid": "question-choice", "data-linkid": i, children: /* @__PURE__ */ r(E, { options: u ?? [], value: o ?? [], onChange: m, repeats: a, placeholder: f, choiceColumn: s, disabled: t }) });
54
55
  }
55
56
  function F(d) {
56
57
  const {
57
58
  answerValueSet: e,
58
- value: n,
59
+ value: i,
59
60
  onChange: u,
60
61
  repeats: a = !1,
61
62
  placeholder: l,
62
63
  choiceColumn: s,
63
64
  preferredTerminologyServer: c,
64
65
  disabled: o
65
- } = d, i = x(D), m = y(async (t) => i(e, t, c), [e, i, c]), f = b((t, p) => {
66
+ } = d, n = x(D), m = y(async (t) => n(e, t, c), [e, n, c]), f = b((t, p) => {
66
67
  (async () => p(await m(t)))();
67
68
  }, 500);
68
- return /* @__PURE__ */ r(k, { loadOptions: f, defaultOptions: !0, value: n, onChange: (t) => u(t), isOptionSelected: (t) => !!n && (n == null ? void 0 : n.findIndex((p) => g.isEqual(p == null ? void 0 : p.value, t.value))) !== -1, isMulti: a, getOptionLabel: (t) => S(t.value, s) || "", placeholder: l, isDisabled: o });
69
+ return /* @__PURE__ */ r(k, { loadOptions: f, defaultOptions: !0, value: i, onChange: (t) => u(t), isOptionSelected: (t) => !!i && (i == null ? void 0 : i.findIndex((p) => g.isEqual(p == null ? void 0 : p.value, t.value))) !== -1, isMulti: a, getOptionLabel: (t) => S(t.value, s) || "", placeholder: l, isDisabled: o });
69
70
  }
70
71
  export {
71
72
  E as ChoiceQuestionSelect,
72
73
  F as ChoiceQuestionValueSet,
73
- B as QuestionChoice
74
+ G as QuestionChoice
74
75
  };
package/dist/style.css CHANGED
@@ -1 +1 @@
1
- ._column_14bfg_1{display:flex;flex-direction:column}._row_14bfg_6{display:flex;flex-direction:row;justify-content:space-between;align-items:center}._questionText_14bfg_13{font-weight:700;margin:0}._answer_14bfg_18{display:block;min-width:40%;max-width:40%}._row_dy31e_1{display:flex}._inputWrapper_dy31e_5{flex:auto}._splitterWrapper_dy31e_9{display:flex;flex-direction:column;justify-content:flex-end}._splitter_dy31e_9{position:relative;bottom:22px;margin:0 8px;font-weight:400;font-size:20px;line-height:22px}._group_1ndd9_1{display:flex;flex-direction:column;gap:16px;width:100%}._groupTitle_1ndd9_8{font-weight:700;font-size:16px;line-height:24px}._row_1ndd9_14{display:flex;flex-direction:row;justify-content:space-between;gap:16px;width:100%}._col_1ndd9_22{display:flex;flex-direction:column;gap:16px}._form_1v4sy_1 .ant-form-item-label{font-weight:700}._form_1v4sy_1 .ant-form-item-row{flex:1;flex-direction:column;justify-content:space-between;gap:12px}._form_1v4sy_1 .ant-form-item-label{text-align:start;white-space:normal}._form_1v4sy_1 .ant-form-item-label label{display:flex;height:auto}._form_1v4sy_1 .ant-form-item-label label:after{display:none}._form_1v4sy_1 .ant-form-item-control{flex-grow:0}._content_1v4sy_25{display:flex;flex-direction:column;gap:24px}._field_1v4sy_31{width:100%;margin-bottom:0;display:flex}._field_1v4sy_31.__hidden_1v4sy_36{display:none}._inputContainer_gs0vq_1{display:flex;flex-direction:column}._inputHeader_gs0vq_6{display:flex;margin-bottom:12px;align-items:center;justify-content:space-between}._label_gs0vq_13{font-weight:700;font-size:14px;line-height:22px}.ant-dropdown .ant-table-filter-dropdown{border:0;background:none;box-shadow:none;position:relative;overflow:visible}
1
+ ._row_dy31e_1{display:flex}._inputWrapper_dy31e_5{flex:auto}._splitterWrapper_dy31e_9{display:flex;flex-direction:column;justify-content:flex-end}._splitter_dy31e_9{position:relative;bottom:22px;margin:0 8px;font-weight:400;font-size:20px;line-height:22px}._group_1ndd9_1{display:flex;flex-direction:column;gap:16px;width:100%}._groupTitle_1ndd9_8{font-weight:700;font-size:16px;line-height:24px}._row_1ndd9_14{display:flex;flex-direction:row;justify-content:space-between;gap:16px;width:100%}._col_1ndd9_22{display:flex;flex-direction:column;gap:16px}._form_1v4sy_1 .ant-form-item-label{font-weight:700}._form_1v4sy_1 .ant-form-item-row{flex:1;flex-direction:column;justify-content:space-between;gap:12px}._form_1v4sy_1 .ant-form-item-label{text-align:start;white-space:normal}._form_1v4sy_1 .ant-form-item-label label{display:flex;height:auto}._form_1v4sy_1 .ant-form-item-label label:after{display:none}._form_1v4sy_1 .ant-form-item-control{flex-grow:0}._content_1v4sy_25{display:flex;flex-direction:column;gap:24px}._field_1v4sy_31{width:100%;margin-bottom:0;display:flex}._field_1v4sy_31.__hidden_1v4sy_36{display:none}._inputContainer_gs0vq_1{display:flex;flex-direction:column}._inputHeader_gs0vq_6{display:flex;margin-bottom:12px;align-items:center;justify-content:space-between}._label_gs0vq_13{font-weight:700;font-size:14px;line-height:22px}._column_14bfg_1{display:flex;flex-direction:column}._row_14bfg_6{display:flex;flex-direction:row;justify-content:space-between;align-items:center}._questionText_14bfg_13{font-weight:700;margin:0}._answer_14bfg_18{display:block;min-width:40%;max-width:40%}.ant-dropdown .ant-table-filter-dropdown{border:0;background:none;box-shadow:none;position:relative;overflow:visible}
@@ -1,8 +1,8 @@
1
1
  import { DefaultTheme } from 'styled-components';
2
2
  export declare const brandColors: Pick<DefaultTheme, 'primary' | 'secondary'>;
3
3
  export declare const colors: {
4
- link: string;
5
4
  error: string;
5
+ link: string;
6
6
  success: string;
7
7
  warning: string;
8
8
  secondary: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@beda.software/web-item-controls",
3
- "version": "0.1.2",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",
@@ -64,7 +64,7 @@
64
64
  "typescript": "^5.1.6"
65
65
  },
66
66
  "peerDependencies": {
67
- "@beda.software/fhir-questionnaire": "git+https://github.com/beda-software/fhir-questionnaire.git#sdc-service-provider",
67
+ "@beda.software/fhir-questionnaire": "git+https://github.com/beda-software/fhir-questionnaire.git#76f7e715e744",
68
68
  "@beda.software/fhir-react": "^1.11.1",
69
69
  "@lingui/cli": "^4.3.0",
70
70
  "@lingui/core": "^4.3.0",
@@ -81,7 +81,7 @@
81
81
  },
82
82
  "devDependencies": {
83
83
  "@babel/preset-typescript": "^7.26.0",
84
- "@beda.software/fhir-questionnaire": "git+https://github.com/beda-software/fhir-questionnaire.git#sdc-service-provider",
84
+ "@beda.software/fhir-questionnaire": "git+https://github.com/beda-software/fhir-questionnaire.git#76f7e715e744",
85
85
  "@beda.software/fhir-react": "^1.11.1",
86
86
  "@beda.software/vite-plugin-dts": "4.0.0-beta.1",
87
87
  "@chromatic-com/storybook": "^3.2.2",
@@ -162,6 +162,10 @@
162
162
  "./readonly-controls": {
163
163
  "types": "./dist/readonly-controls/index.d.ts",
164
164
  "import": "./dist/readonly-controls/index.js"
165
+ },
166
+ "./contexts": {
167
+ "types": "./dist/contexts/index.d.ts",
168
+ "import": "./dist/contexts/index.js"
165
169
  }
166
170
  }
167
171
  }