@beda.software/web-item-controls 0.1.6 → 0.1.14-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/README.md +0 -12
- package/dist/components/BaseQuestionnaireResponseForm/hooks.d.ts +4 -4
- package/dist/components/BaseQuestionnaireResponseForm/hooks.d.ts.map +1 -1
- package/dist/components/BaseQuestionnaireResponseForm/hooks.js +28 -56
- package/dist/components/BaseQuestionnaireResponseForm/utils.d.ts.map +1 -1
- package/dist/components/BaseQuestionnaireResponseForm/utils.js +12 -3
- package/dist/components/FormWrapper/index.d.ts +4 -3
- package/dist/components/FormWrapper/index.d.ts.map +1 -1
- package/dist/components/SearchBar/SearchBarMobile/index.js +36 -0
- package/dist/components/SearchBar/SearchBarMobile/styles.js +49 -37
- package/dist/components/SearchBar/hooks.js +70 -0
- package/dist/components/SearchBar/index.js +27 -0
- package/dist/components/SearchBar/styles.js +23 -16
- package/dist/components/SearchBar/utils.js +10 -0
- package/dist/components/SearchBar/validate.js +46 -0
- package/dist/components/Table/TableCards/index.js +60 -0
- package/dist/components/Table/TableCards/styles.js +43 -31
- package/dist/components/Table/index.js +17 -0
- package/dist/components/Table/styles.js +18 -12
- package/dist/components/index.d.ts +10 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +26 -0
- package/dist/controls/Boolean/index.js +10 -10
- package/dist/controls/Display/index.js +6 -5
- package/dist/controls/EditableGroup/hooks.js +5 -5
- package/dist/controls/GroupTable/RenderFormItemReadOnly/index.js +6 -5
- package/dist/controls/GroupTable/hooks.js +13 -13
- package/dist/controls/GroupTable/index.d.ts +3 -0
- package/dist/controls/GroupTable/index.d.ts.map +1 -1
- package/dist/controls/GroupTable/index.js +28 -25
- package/dist/controls/InsideText/index.js +10 -10
- package/dist/controls/Number/index.js +37 -37
- package/dist/controls/PasswordInput/index.d.ts.map +1 -1
- package/dist/controls/PasswordInput/index.js +12 -12
- package/dist/controls/Reference/index.d.ts +3 -3
- package/dist/controls/Reference/index.d.ts.map +1 -1
- package/dist/controls/String/index.d.ts.map +1 -1
- package/dist/controls/String/index.js +31 -31
- package/dist/controls/controls.d.ts +6 -0
- package/dist/controls/controls.d.ts.map +1 -0
- package/dist/controls/controls.js +137 -0
- package/dist/controls/index.d.ts +2 -1
- package/dist/controls/index.d.ts.map +1 -1
- package/dist/controls/index.js +83 -71
- package/dist/readonly-controls/Display/index.js +6 -5
- package/dist/readonly-controls/index.d.ts +1 -0
- package/dist/readonly-controls/index.d.ts.map +1 -1
- package/dist/readonly-controls/index.js +41 -36
- package/dist/readonly-controls/readonly-controls.d.ts +6 -0
- package/dist/readonly-controls/readonly-controls.d.ts.map +1 -0
- package/dist/readonly-controls/readonly-controls.js +57 -0
- package/dist/style.css +1 -1
- package/dist/theme/palette.d.ts +2 -2
- package/dist/utils/theme.d.ts +1 -1
- package/package.json +48 -38
- package/src/locale/de/messages.po +6 -6
- package/src/locale/en/messages.po +6 -6
- package/src/locale/es/messages.po +6 -6
- package/src/locale/ru/messages.po +6 -6
- package/dist/components/BaseQuestionnaireResponseForm/controls.d.ts +0 -6
- package/dist/components/BaseQuestionnaireResponseForm/controls.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -87,18 +87,6 @@ Build the package:
|
|
|
87
87
|
yarn build:lib
|
|
88
88
|
```
|
|
89
89
|
|
|
90
|
-
Validate generated package shape:
|
|
91
|
-
|
|
92
|
-
```sh
|
|
93
|
-
yarn check:package
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
Smoke test a packed tarball in a temporary consumer project:
|
|
97
|
-
|
|
98
|
-
```sh
|
|
99
|
-
yarn smoke:package
|
|
100
|
-
```
|
|
101
|
-
|
|
102
90
|
Run TypeScript checks:
|
|
103
91
|
|
|
104
92
|
```sh
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { FormItemProps } from 'antd';
|
|
2
|
-
import { FCEQuestionnaireItem
|
|
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
|
-
|
|
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;
|
|
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
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
}
|
|
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
|
-
...
|
|
50
|
-
|
|
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
|
-
|
|
33
|
+
M as useFieldController
|
|
62
34
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/BaseQuestionnaireResponseForm/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/BaseQuestionnaireResponseForm/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE3C,wBAAgB,oBAAoB,CAChC,KAAK,EAAE,qBAAqB,CAAC,GAAG,EAAE,GAAG,CAAC,EACtC,UAAU,EAAE,oBAAoB,EAChC,IAAI,CAAC,EAAE,MAAM,sBAehB;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,gBAAgB,uBAShD"}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
function
|
|
2
|
-
return !
|
|
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
|
-
|
|
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?:
|
|
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;
|
|
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"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Trans as i } from "@lingui/react";
|
|
3
|
+
import { FilterFilled as f, CloseOutlined as h } from "@ant-design/icons";
|
|
4
|
+
import { Button as n } from "antd";
|
|
5
|
+
import u from "lodash";
|
|
6
|
+
import { useState as C } from "react";
|
|
7
|
+
import { Title as g } from "../../Typography.js";
|
|
8
|
+
import { S as r } from "./styles.js";
|
|
9
|
+
import { SearchBarColumn as F } from "../SearchBarColumn/index.js";
|
|
10
|
+
function D(s) {
|
|
11
|
+
const {
|
|
12
|
+
columnsFilterValues: a,
|
|
13
|
+
onChangeColumnFilter: m,
|
|
14
|
+
onResetFilters: p
|
|
15
|
+
} = s, [d, l] = C(!1), c = u.compact(a.map((t) => t.value)).length;
|
|
16
|
+
return /* @__PURE__ */ o(r.Container, { children: [
|
|
17
|
+
/* @__PURE__ */ o(r.FiltersButton, { children: [
|
|
18
|
+
/* @__PURE__ */ e(n, { type: "default", icon: /* @__PURE__ */ e(f, {}), onClick: () => l(!0) }),
|
|
19
|
+
c ? /* @__PURE__ */ e(r.Badge, { count: c, size: "small" }) : null
|
|
20
|
+
] }),
|
|
21
|
+
/* @__PURE__ */ o(r.Drawer, { placement: "bottom", onClose: () => l(!1), open: d, closable: !1, width: "100%", height: "100%", children: [
|
|
22
|
+
/* @__PURE__ */ o(r.DrawerHeader, { children: [
|
|
23
|
+
/* @__PURE__ */ e(g, { level: 5, children: /* @__PURE__ */ e(i, { id: "cSev+j" }) }),
|
|
24
|
+
/* @__PURE__ */ e(r.CloseIcon, { type: "text", icon: /* @__PURE__ */ e(h, {}), onClick: () => l(!1) })
|
|
25
|
+
] }),
|
|
26
|
+
/* @__PURE__ */ e(r.DrawerContent, { children: a.map((t) => /* @__PURE__ */ e(F, { columnFilterValue: t, onChange: m }, `search-bar-column-${t.column.id}`)) }),
|
|
27
|
+
/* @__PURE__ */ o(r.DrawerFooter, { children: [
|
|
28
|
+
/* @__PURE__ */ e(n, { type: "primary", onClick: () => l(!1), size: "large", children: /* @__PURE__ */ e(i, { id: "zCjei3" }) }),
|
|
29
|
+
/* @__PURE__ */ e(n, { type: "default", onClick: p, size: "large", children: /* @__PURE__ */ e(i, { id: "u8JHrO" }) })
|
|
30
|
+
] })
|
|
31
|
+
] })
|
|
32
|
+
] });
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
D as SearchBarMobile
|
|
36
|
+
};
|
|
@@ -1,39 +1,51 @@
|
|
|
1
1
|
import { Badge as o, Button as a, Drawer as i } from "antd";
|
|
2
2
|
import t from "styled-components";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
})(["
|
|
30
|
-
|
|
31
|
-
}) => e.neutralPalette.
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
})
|
|
38
|
-
|
|
39
|
-
|
|
3
|
+
const p = {
|
|
4
|
+
Container: t.div.withConfig({
|
|
5
|
+
displayName: "SearchBarMobile__Container",
|
|
6
|
+
componentId: "sc-nh45q8-0"
|
|
7
|
+
})([""]),
|
|
8
|
+
FiltersButton: t.div.withConfig({
|
|
9
|
+
displayName: "SearchBarMobile__FiltersButton",
|
|
10
|
+
componentId: "sc-nh45q8-1"
|
|
11
|
+
})(["position:relative;"]),
|
|
12
|
+
Badge: t(o).withConfig({
|
|
13
|
+
displayName: "SearchBarMobile__Badge",
|
|
14
|
+
componentId: "sc-nh45q8-2"
|
|
15
|
+
})(["position:absolute;right:-3px;top:-3px;.ant-badge-count{background-color:", ";color:", ";}"], ({
|
|
16
|
+
theme: e
|
|
17
|
+
}) => e.primaryPalette.bcp_2, ({
|
|
18
|
+
theme: e
|
|
19
|
+
}) => e.primary),
|
|
20
|
+
CloseIcon: t(a).withConfig({
|
|
21
|
+
displayName: "SearchBarMobile__CloseIcon",
|
|
22
|
+
componentId: "sc-nh45q8-3"
|
|
23
|
+
})(["height:56px;width:48px !important;color:", " !important;&:hover{background:0 !important;}"], ({
|
|
24
|
+
theme: e
|
|
25
|
+
}) => e.neutralPalette.gray_7),
|
|
26
|
+
Drawer: t(i).withConfig({
|
|
27
|
+
displayName: "SearchBarMobile__Drawer",
|
|
28
|
+
componentId: "sc-nh45q8-4"
|
|
29
|
+
})(["padding-top:56px;padding-bottom:129px;background-color:", ";.ant-drawer-body{padding:0;display:flex;flex-direction:column;justify-content:space-between;}.ant-input-search,.ant-picker,.react-select__control{width:100%;max-width:450px;}"], ({
|
|
30
|
+
theme: e
|
|
31
|
+
}) => e.neutralPalette.gray_1),
|
|
32
|
+
DrawerHeader: t.div.withConfig({
|
|
33
|
+
displayName: "SearchBarMobile__DrawerHeader",
|
|
34
|
+
componentId: "sc-nh45q8-5"
|
|
35
|
+
})(["position:absolute;left:0;right:0;top:0;height:56px;padding-left:16px;display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid ", ";"], ({
|
|
36
|
+
theme: e
|
|
37
|
+
}) => e.neutralPalette.gray_4),
|
|
38
|
+
DrawerContent: t.div.withConfig({
|
|
39
|
+
displayName: "SearchBarMobile__DrawerContent",
|
|
40
|
+
componentId: "sc-nh45q8-6"
|
|
41
|
+
})(["padding:16px;display:flex;flex-direction:column;gap:16px;flex:1;"]),
|
|
42
|
+
DrawerFooter: t.div.withConfig({
|
|
43
|
+
displayName: "SearchBarMobile__DrawerFooter",
|
|
44
|
+
componentId: "sc-nh45q8-7"
|
|
45
|
+
})(["position:absolute;left:0;right:0;bottom:0;padding:16px;display:flex;flex-direction:column;gap:16px;border-top:1px solid ", ";"], ({
|
|
46
|
+
theme: e
|
|
47
|
+
}) => e.neutralPalette.gray_4)
|
|
48
|
+
};
|
|
49
|
+
export {
|
|
50
|
+
p as S
|
|
51
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { useMemo as V, useState as F, useCallback as a } from "react";
|
|
2
|
+
import { isStringColumn as S, isDateColumn as p, isSingleDateColumn as m, isReferenceColumn as v, isChoiceColumn as g, isSolidChoiceColumn as h, isSplitStringColumn as D, isStringColumnFilterValue as w, isDateColumnFilterValue as R, isSingleDateColumnFilterValue as y, isReferenceColumnFilterValue as E, isChoiceColumnFilterValue as U, isSolidChoiceColumnFilterValue as b, isSplitStringColumnFilterValue as c } from "./types.js";
|
|
3
|
+
import { validateStringColumnFilterValue as k, validateDateColumnFilterValue as x, validateSingleDateColumnFilterValue as B, validateReferenceColumnFilterValue as M, validateChoiceColumnFilterValue as j, validateSolidChoiceColumnFilterValue as q, validateSplitStringColumnFilterValue as z } from "./validate.js";
|
|
4
|
+
function I(n) {
|
|
5
|
+
const {
|
|
6
|
+
columns: u
|
|
7
|
+
} = n, l = V(() => u.map((e) => {
|
|
8
|
+
if (S(e))
|
|
9
|
+
return {
|
|
10
|
+
column: e,
|
|
11
|
+
value: e.defaultValue ?? void 0
|
|
12
|
+
};
|
|
13
|
+
if (p(e))
|
|
14
|
+
return {
|
|
15
|
+
column: e,
|
|
16
|
+
value: e.defaultValue ?? void 0
|
|
17
|
+
};
|
|
18
|
+
if (m(e))
|
|
19
|
+
return {
|
|
20
|
+
column: e,
|
|
21
|
+
value: e.defaultValue ?? void 0
|
|
22
|
+
};
|
|
23
|
+
if (v(e))
|
|
24
|
+
return {
|
|
25
|
+
column: e,
|
|
26
|
+
value: e.defaultValue ? {
|
|
27
|
+
value: {
|
|
28
|
+
Reference: e.defaultValue
|
|
29
|
+
}
|
|
30
|
+
} : null
|
|
31
|
+
};
|
|
32
|
+
if (g(e))
|
|
33
|
+
return {
|
|
34
|
+
column: e,
|
|
35
|
+
value: e.defaultValue ? [e.defaultValue] : null
|
|
36
|
+
};
|
|
37
|
+
if (h(e))
|
|
38
|
+
return {
|
|
39
|
+
column: e,
|
|
40
|
+
value: e.defaultValue ? [e.defaultValue] : null
|
|
41
|
+
};
|
|
42
|
+
if (D(e))
|
|
43
|
+
return {
|
|
44
|
+
column: e,
|
|
45
|
+
value: e.defaultValue ?? void 0
|
|
46
|
+
};
|
|
47
|
+
throw new Error("Unsupported column type");
|
|
48
|
+
}), [u]), [o, t] = F(l), f = a((e, C) => {
|
|
49
|
+
t((d) => d.map((r) => {
|
|
50
|
+
if (r.column.id !== C)
|
|
51
|
+
return r;
|
|
52
|
+
const i = {
|
|
53
|
+
...r
|
|
54
|
+
};
|
|
55
|
+
if (w(i) && k(e) || R(i) && x(e) || y(i) && B(e) || E(i) && M(e) || U(i) && j(e) || b(i) && q(e) || c(i) && z(e))
|
|
56
|
+
return i.value = e, i;
|
|
57
|
+
throw new Error("Unsupported column type");
|
|
58
|
+
}));
|
|
59
|
+
}, [t]), s = a(() => {
|
|
60
|
+
t(l);
|
|
61
|
+
}, [t, l]);
|
|
62
|
+
return {
|
|
63
|
+
columnsFilterValues: o,
|
|
64
|
+
onChangeColumnFilter: f,
|
|
65
|
+
onResetFilters: s
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
export {
|
|
69
|
+
I as useSearchBar
|
|
70
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsxs as m, Fragment as h, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { Trans as u } from "@lingui/react";
|
|
3
|
+
import { Button as f } from "antd";
|
|
4
|
+
import { useMemo as p } from "react";
|
|
5
|
+
import { SearchBarColumn as d } from "./SearchBarColumn/index.js";
|
|
6
|
+
import { SearchBarMobile as B } from "./SearchBarMobile/index.js";
|
|
7
|
+
import { S as o } from "./styles.js";
|
|
8
|
+
import { isSearchBarFilter as S } from "./utils.js";
|
|
9
|
+
function x(n) {
|
|
10
|
+
const {
|
|
11
|
+
columnsFilterValues: i,
|
|
12
|
+
onChangeColumnFilter: a,
|
|
13
|
+
onResetFilters: s,
|
|
14
|
+
showInDrawerOnMobile: l = !0,
|
|
15
|
+
level: c = 1
|
|
16
|
+
} = n, t = p(() => i.filter((e) => S(e)), [JSON.stringify(i)]);
|
|
17
|
+
return /* @__PURE__ */ m(h, { children: [
|
|
18
|
+
/* @__PURE__ */ m(o.SearchBar, { $showInDrawerOnMobile: l, children: [
|
|
19
|
+
/* @__PURE__ */ r(o.LeftColumn, { children: t.map((e) => /* @__PURE__ */ r(d, { columnFilterValue: e, onChange: a }, `search-bar-column-${e.column.id}`)) }),
|
|
20
|
+
t.length > 1 ? /* @__PURE__ */ r(f, { onClick: s, children: /* @__PURE__ */ r(u, { id: "u8JHrO" }) }) : null
|
|
21
|
+
] }),
|
|
22
|
+
/* @__PURE__ */ r(o.MobileFilters, { $showInDrawerOnMobile: l, $level: c, children: /* @__PURE__ */ r(B, { ...n }) })
|
|
23
|
+
] });
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
x as SearchBar
|
|
27
|
+
};
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
import i, { css as t } from "styled-components";
|
|
2
2
|
import { mobileWidth as a } from "../../theme/utils.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
}) => e && t(["
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
3
|
+
const p = {
|
|
4
|
+
SearchBar: i.div.withConfig({
|
|
5
|
+
displayName: "SearchBar",
|
|
6
|
+
componentId: "sc-t5bis6-0"
|
|
7
|
+
})(["position:relative;display:flex;flex-direction:row;justify-content:space-between;align-items:center;gap:16px;flex-wrap:wrap;.ant-input-search,.ant-picker,.react-select__control{width:270px;}", ""], ({
|
|
8
|
+
$showInDrawerOnMobile: e
|
|
9
|
+
}) => e && t(["@media screen and (max-width:", "){display:none;}"], () => `${a - 1}px`)),
|
|
10
|
+
MobileFilters: i.div.withConfig({
|
|
11
|
+
displayName: "SearchBar__MobileFilters",
|
|
12
|
+
componentId: "sc-t5bis6-1"
|
|
13
|
+
})(["position:absolute;right:24px;top:24px;", " ", ""], ({
|
|
14
|
+
$level: e
|
|
15
|
+
}) => e === 2 && t(["right:0;top:0;"]), ({
|
|
16
|
+
$showInDrawerOnMobile: e
|
|
17
|
+
}) => e && t(["@media screen and (min-width:", "){display:none;}"], () => `${a}px`)),
|
|
18
|
+
LeftColumn: i.div.withConfig({
|
|
19
|
+
displayName: "SearchBar__LeftColumn",
|
|
20
|
+
componentId: "sc-t5bis6-2"
|
|
21
|
+
})(["display:flex;flex-direction:row;align-items:center;flex-wrap:wrap;gap:10px 8px;"])
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
p as S
|
|
25
|
+
};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import n from "lodash";
|
|
2
|
+
import e from "moment";
|
|
3
|
+
function l(i) {
|
|
4
|
+
if (n.isUndefined(i) || n.isString(i))
|
|
5
|
+
return !0;
|
|
6
|
+
throw new Error("Invalid string column filter value");
|
|
7
|
+
}
|
|
8
|
+
function o(i) {
|
|
9
|
+
if (n.isUndefined(i) || n.isArray(i) && i.length === 2 && e.isMoment(i[0]) && e.isMoment(i[1]))
|
|
10
|
+
return !0;
|
|
11
|
+
throw new Error("Invalid date column filter value");
|
|
12
|
+
}
|
|
13
|
+
function d(i) {
|
|
14
|
+
if (n.isUndefined(i) || e.isMoment(i))
|
|
15
|
+
return !0;
|
|
16
|
+
throw new Error("Invalid single date column filter value");
|
|
17
|
+
}
|
|
18
|
+
function u(i) {
|
|
19
|
+
if (n.isUndefined(i) || n.isNull(i) || n.isObject(i) && "value" in i && "Reference" in i.value)
|
|
20
|
+
return !0;
|
|
21
|
+
throw new Error("Invalid reference column filter value");
|
|
22
|
+
}
|
|
23
|
+
function f(i) {
|
|
24
|
+
if (n.isUndefined(i) || n.isNull(i) || n.isArray(i) && i.length > 0 && n.isObject(i[0]) && "value" in i[0] && "Coding" in i[0].value)
|
|
25
|
+
return !0;
|
|
26
|
+
throw new Error("Invalid choice column filter value");
|
|
27
|
+
}
|
|
28
|
+
function c(i) {
|
|
29
|
+
if (n.isUndefined(i) || n.isNull(i) || n.isArray(i) && i.length > 0 && n.isObject(i[0]) && "code" in i[0] && "display" in i[0])
|
|
30
|
+
return !0;
|
|
31
|
+
throw new Error("Invalid solid choice column filter value");
|
|
32
|
+
}
|
|
33
|
+
function s(i) {
|
|
34
|
+
if (n.isUndefined(i) || n.isString(i))
|
|
35
|
+
return !0;
|
|
36
|
+
throw new Error("Invalid split string column filter value");
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
f as validateChoiceColumnFilterValue,
|
|
40
|
+
o as validateDateColumnFilterValue,
|
|
41
|
+
u as validateReferenceColumnFilterValue,
|
|
42
|
+
d as validateSingleDateColumnFilterValue,
|
|
43
|
+
c as validateSolidChoiceColumnFilterValue,
|
|
44
|
+
s as validateSplitStringColumnFilterValue,
|
|
45
|
+
l as validateStringColumnFilterValue
|
|
46
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as i, jsxs as g } from "react/jsx-runtime";
|
|
2
|
+
import { Empty as y, Checkbox as R, Pagination as _ } from "antd";
|
|
3
|
+
import c from "lodash";
|
|
4
|
+
import { S as r } from "./styles.js";
|
|
5
|
+
function z(l) {
|
|
6
|
+
const {
|
|
7
|
+
pagination: o,
|
|
8
|
+
onChange: x,
|
|
9
|
+
dataSource: h = [],
|
|
10
|
+
columns: k = [],
|
|
11
|
+
rowKey: s,
|
|
12
|
+
rowSelection: n
|
|
13
|
+
} = l, E = (t) => typeof t == "function" ? /* @__PURE__ */ i(r.Title, { children: t({}) }) : /* @__PURE__ */ i(r.Title, { children: t }), I = (t) => typeof s == "function" ? s(t) : s;
|
|
14
|
+
return h.length === 0 ? /* @__PURE__ */ i(y, { image: y.PRESENTED_IMAGE_SIMPLE }) : /* @__PURE__ */ g(r.Container, { children: [
|
|
15
|
+
h.map((t, f) => {
|
|
16
|
+
const a = I(t), d = (n == null ? void 0 : n.selectedRowKeys) ?? [];
|
|
17
|
+
return /* @__PURE__ */ g(r.Card, { children: [
|
|
18
|
+
/* @__PURE__ */ i(r.Columns, { children: k.map((e) => /* @__PURE__ */ g(r.Column, { children: [
|
|
19
|
+
e != null && e.title ? E(e.title) : null,
|
|
20
|
+
/* @__PURE__ */ i(r.Content, {
|
|
21
|
+
// @ts-ignore
|
|
22
|
+
children: e != null && e.render ? e == null ? void 0 : e.render(
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
e.dataIndex ? c.get(t, e.dataIndex) : t,
|
|
25
|
+
t,
|
|
26
|
+
f
|
|
27
|
+
) : (
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
c.get(t, e.dataIndex)
|
|
30
|
+
)
|
|
31
|
+
})
|
|
32
|
+
] }, `${a}-${e.key}`)) }),
|
|
33
|
+
n ? /* @__PURE__ */ i(r.RowSelection, { children: /* @__PURE__ */ i(R, { checked: d.includes(a), onChange: (e) => {
|
|
34
|
+
var C, p;
|
|
35
|
+
if (e.target.checked)
|
|
36
|
+
(C = n.onChange) == null || C.call(n, [...d, a], [], {
|
|
37
|
+
type: "single"
|
|
38
|
+
});
|
|
39
|
+
else {
|
|
40
|
+
const T = d.filter((P) => P !== a);
|
|
41
|
+
(p = n.onChange) == null || p.call(n, T, [], {
|
|
42
|
+
type: "single"
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
} }) }) : null
|
|
46
|
+
] }, a);
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ i(r.Pagination, { children: /* @__PURE__ */ i(_, { ...o, size: "small", onChange: (t, f) => {
|
|
49
|
+
const a = {
|
|
50
|
+
...o ?? {},
|
|
51
|
+
current: t,
|
|
52
|
+
pageSize: f
|
|
53
|
+
};
|
|
54
|
+
x(a, {}, {}, {});
|
|
55
|
+
} }) })
|
|
56
|
+
] });
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
z as TableCards
|
|
60
|
+
};
|