@uxland/primary-shell 4.1.0 → 4.2.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/dist/index.js +5193 -4896
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +457 -390
- package/dist/index.umd.cjs.map +1 -1
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/add/add-async-history-items/request.d.ts +1 -1
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/UI/active-filters-badges/active-filters-badges.d.ts +11 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/UI/active-filters-badges/template.d.ts +4 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/UI/active-filters-header/active-filters-header.d.ts +10 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/UI/active-filters-header/template.d.ts +4 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/selectors.d.ts +147 -1
- package/dist/primary/shell/src/internal-plugins/activity-history/localization.d.ts +3 -0
- package/dist/style.css +1 -1
- package/package.json +6 -5
- package/src/internal-plugins/activity-history/activity-history-item/add/add-async-history-items/request.ts +1 -1
- package/src/internal-plugins/activity-history/activity-history-item/filter/UI/active-filters-badges/active-filters-badges.ts +43 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/UI/active-filters-badges/styles.css +31 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/UI/active-filters-badges/template.ts +79 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/UI/active-filters-header/active-filters-header.ts +32 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/UI/active-filters-header/styles.css +12 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/UI/active-filters-header/template.ts +14 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/selectors.ts +26 -0
- package/src/internal-plugins/activity-history/activity-history-item/list/UI/main-view/template.ts +1 -1
- package/src/internal-plugins/activity-history/activity-history-item/list/bootstrapper.ts +1 -0
- package/src/internal-plugins/activity-history/activity-history-item/search/activity-history-search-results/styles.css +1 -10
- package/src/internal-plugins/activity-history/activity-history-item/search/bootstrapper.ts +1 -0
- package/src/internal-plugins/activity-history/localization.ts +6 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@uxland/primary-shell",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"description": "Primaria Shell",
|
|
5
5
|
"author": "UXLand <dev@uxland.es>",
|
|
6
6
|
"homepage": "https://github.com/uxland/harmonix/tree/app#readme",
|
|
@@ -24,15 +24,16 @@
|
|
|
24
24
|
"bugs": {
|
|
25
25
|
"url": "https://github.com/uxland/harmonix/issues"
|
|
26
26
|
},
|
|
27
|
-
"dependencies": {
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@uxland/harmonix": "^1.0.5",
|
|
29
|
+
"@uxland/harmonix-adapters": "^1.0.1"
|
|
30
|
+
},
|
|
28
31
|
"devDependencies": {
|
|
29
32
|
"@reduxjs/toolkit": "^2.6.1",
|
|
30
|
-
"@uxland/harmonix-adapters": "^1.0.1",
|
|
31
33
|
"axios": "^1.7.2",
|
|
32
34
|
"date-fns": "^3.6.0",
|
|
33
35
|
"ramda": "^0.30.1",
|
|
34
36
|
"@primaria/plugins-core": "^1.0.14",
|
|
35
|
-
"@uxland/harmonix": "^1.0.0",
|
|
36
37
|
"@uxland/lit-utilities": "^1.0.0",
|
|
37
38
|
"@uxland/localization": "^1.0.3",
|
|
38
39
|
"@uxland/regions": "^1.0.0",
|
|
@@ -40,7 +41,7 @@
|
|
|
40
41
|
"axios-mock-adapter": "^2.0.0",
|
|
41
42
|
"inversify": "^6.0.2",
|
|
42
43
|
"inversify-inject-decorators": "^3.1.0",
|
|
43
|
-
"@salut/design-system-salut": "../../design-system-salut-2.
|
|
44
|
+
"@salut/design-system-salut": "../../design-system-salut-2.2.0.tgz",
|
|
44
45
|
"jwt-decode": "^4.0.0",
|
|
45
46
|
"lit": "^3.1.0",
|
|
46
47
|
"mediatr-ts": "^1.2.1",
|
|
@@ -7,7 +7,7 @@ export interface InjectAsyncHistoryItemsPayload {
|
|
|
7
7
|
componentFactory: (item: IActivityHistoryItem) => HTMLElement;
|
|
8
8
|
searchPredicate?: (searchString: string, item: IActivityHistoryItem) => boolean;
|
|
9
9
|
errorMessage: string;
|
|
10
|
-
filters
|
|
10
|
+
filters: IActivityHistoryCommonFilterGroup;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const addAsyncHistoryItemsCommand = "inject_async_history_items_request";
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { LitElement, css, html, unsafeCSS } from "lit";
|
|
2
|
+
import { customElement } from "lit/decorators.js";
|
|
3
|
+
import { connectedProperty } from "../../../../infrastructure/state/connected-property";
|
|
4
|
+
import { lazyInject } from "../../../../infrastructure/ioc/container";
|
|
5
|
+
import { PrimariaApi } from "../../../../../../api/api";
|
|
6
|
+
import { TYPES } from "../../../../infrastructure/ioc/types";
|
|
7
|
+
import { template } from "./template";
|
|
8
|
+
import styles from "./styles.css?inline";
|
|
9
|
+
import {
|
|
10
|
+
activeGroupsWithEnabledFilters,
|
|
11
|
+
activityHistoryCustomFilterGroupsSelector,
|
|
12
|
+
} from "../../custom-filters/selectors";
|
|
13
|
+
import { SetCustomFilterValue } from "../../custom-filters/set-custom-filter-value/request";
|
|
14
|
+
import { IActivityHistoryCustomFilterGroup } from "../../model";
|
|
15
|
+
|
|
16
|
+
//@ts-ignore
|
|
17
|
+
@customElement("active-filters-badges")
|
|
18
|
+
export class ActiveFiltersBadges extends LitElement {
|
|
19
|
+
render() {
|
|
20
|
+
return html`${template(this)}`;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
static styles = css`
|
|
24
|
+
${unsafeCSS(styles)}
|
|
25
|
+
`;
|
|
26
|
+
|
|
27
|
+
@lazyInject(TYPES.primaryApi)
|
|
28
|
+
api: PrimariaApi;
|
|
29
|
+
|
|
30
|
+
@connectedProperty(activeGroupsWithEnabledFilters)
|
|
31
|
+
enabledFilters: IActivityHistoryCustomFilterGroup[];
|
|
32
|
+
|
|
33
|
+
_onDeleteFilterValue(filterGroupId: string, filterId: string, optionId: string, value: boolean) {
|
|
34
|
+
this.api.broker.send(
|
|
35
|
+
new SetCustomFilterValue({
|
|
36
|
+
filterGroupId,
|
|
37
|
+
filterId,
|
|
38
|
+
optionId,
|
|
39
|
+
enabled: value,
|
|
40
|
+
}),
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
.filters-container{
|
|
2
|
+
display: flex;
|
|
3
|
+
gap: var(--dss-spacing-md);
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.filters-header{
|
|
7
|
+
font-weight: 700;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.filter-groups{
|
|
11
|
+
display: flex;
|
|
12
|
+
gap: var(--dss-spacing-xs);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.filter-group{
|
|
16
|
+
display: flex;
|
|
17
|
+
gap: var(--dss-spacing-xs);
|
|
18
|
+
color: var(--color-neutral-600);
|
|
19
|
+
font-weight: 600;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.popover-content {
|
|
23
|
+
box-sizing: border-box;
|
|
24
|
+
display: flex;
|
|
25
|
+
flex-wrap: wrap;
|
|
26
|
+
gap: var(--dss-spacing-xs);
|
|
27
|
+
padding: 10px;
|
|
28
|
+
max-width: 368px;
|
|
29
|
+
max-height: 336px;
|
|
30
|
+
overflow: auto;
|
|
31
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { html, nothing } from "lit";
|
|
2
|
+
import { ActiveFiltersBadges } from "./active-filters-badges";
|
|
3
|
+
import { translate } from "../../../../localization";
|
|
4
|
+
|
|
5
|
+
const MAX_VISIBLE_CHIPS = 5;
|
|
6
|
+
|
|
7
|
+
const renderChip = (id, filter, value, props) => html`
|
|
8
|
+
<dss-chip
|
|
9
|
+
label=${value}
|
|
10
|
+
size="sm"
|
|
11
|
+
hasdelete
|
|
12
|
+
selected
|
|
13
|
+
@click=${() => props._onDeleteFilterValue(id, filter.id, value, false)}
|
|
14
|
+
@onDelete=${() => props._onDeleteFilterValue(id, filter.id, value, false)}
|
|
15
|
+
></dss-chip>
|
|
16
|
+
`;
|
|
17
|
+
|
|
18
|
+
const renderFilterTitle = (title) => html`<div class="filter-title">${`${title}:`}</div>`;
|
|
19
|
+
|
|
20
|
+
export const template = (props: ActiveFiltersBadges) => {
|
|
21
|
+
if (props.enabledFilters.length === 0) return nothing;
|
|
22
|
+
|
|
23
|
+
let visibleCount = 0;
|
|
24
|
+
const visibleChips: any[] = [];
|
|
25
|
+
const hiddenElements: any[] = [];
|
|
26
|
+
const hiddenChips: any[] = [];
|
|
27
|
+
|
|
28
|
+
for (const { title, id, filters } of props.enabledFilters) {
|
|
29
|
+
let titleAddedToVisible = false;
|
|
30
|
+
let titleAddedToHidden = false;
|
|
31
|
+
|
|
32
|
+
for (const filter of filters) {
|
|
33
|
+
for (const value of [...new Set(filter.enabledValues)]) {
|
|
34
|
+
const chip = renderChip(id, filter, value, props);
|
|
35
|
+
|
|
36
|
+
if (visibleCount < MAX_VISIBLE_CHIPS) {
|
|
37
|
+
if (!titleAddedToVisible) {
|
|
38
|
+
visibleChips.push(renderFilterTitle(title));
|
|
39
|
+
titleAddedToVisible = true;
|
|
40
|
+
}
|
|
41
|
+
visibleChips.push(chip);
|
|
42
|
+
visibleCount++;
|
|
43
|
+
} else {
|
|
44
|
+
if (!titleAddedToHidden) {
|
|
45
|
+
hiddenElements.push(renderFilterTitle(title));
|
|
46
|
+
titleAddedToHidden = true;
|
|
47
|
+
}
|
|
48
|
+
hiddenElements.push(chip);
|
|
49
|
+
hiddenChips.push(chip);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return html`
|
|
56
|
+
<div class="filters-container">
|
|
57
|
+
<div class="filters-header">${translate("chipHeader.selection")}</div>
|
|
58
|
+
<div class="filter-groups">
|
|
59
|
+
${visibleChips}
|
|
60
|
+
${
|
|
61
|
+
hiddenChips.length > 0
|
|
62
|
+
? html`
|
|
63
|
+
<div>
|
|
64
|
+
<dss-button label="+ ${hiddenChips.length}" size="sm" variant="primary"></dss-button>
|
|
65
|
+
<dss-popover title=${translate("chipHeader.selection")} position="bottom" popoverFixed>
|
|
66
|
+
<dss-popover-body slot="body">
|
|
67
|
+
<div class="popover-content">
|
|
68
|
+
${hiddenElements}
|
|
69
|
+
</div>
|
|
70
|
+
</dss-popover-body>
|
|
71
|
+
</dss-popover>
|
|
72
|
+
</div>
|
|
73
|
+
`
|
|
74
|
+
: nothing
|
|
75
|
+
}
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
`;
|
|
79
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { LitElement, css, html, unsafeCSS } from "lit";
|
|
2
|
+
import { template } from "./template";
|
|
3
|
+
import styles from "./styles.css?inline";
|
|
4
|
+
import { customElement } from "lit/decorators.js";
|
|
5
|
+
import { connectedProperty } from "../../../../infrastructure/state/connected-property";
|
|
6
|
+
import { activityHistorySearchStringSelector } from "../../../search/selectors";
|
|
7
|
+
import {
|
|
8
|
+
activityHistoryCustomFilterGroupsSelector,
|
|
9
|
+
areCustomFiltersActive,
|
|
10
|
+
} from "../../custom-filters/selectors";
|
|
11
|
+
import { IActivityHistoryCustomFilterGroup } from "../../model";
|
|
12
|
+
|
|
13
|
+
//@ts-ignore
|
|
14
|
+
@customElement("active-filters-header")
|
|
15
|
+
export class ActiveFiltersHeader extends LitElement {
|
|
16
|
+
render() {
|
|
17
|
+
return html`${template(this)}`;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
static styles = css`
|
|
21
|
+
${unsafeCSS(styles)}
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
@connectedProperty(activityHistorySearchStringSelector)
|
|
25
|
+
searchString: string;
|
|
26
|
+
|
|
27
|
+
@connectedProperty(activityHistoryCustomFilterGroupsSelector)
|
|
28
|
+
filters: IActivityHistoryCustomFilterGroup[];
|
|
29
|
+
|
|
30
|
+
@connectedProperty(areCustomFiltersActive)
|
|
31
|
+
areCustomFiltersActive: boolean;
|
|
32
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
.active-filters-header{
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
border-width: 0px 0px 1px 0px;
|
|
5
|
+
border-style: solid;
|
|
6
|
+
border-color: #D8D8D8;
|
|
7
|
+
background-color: #FFFFFF;
|
|
8
|
+
padding: var(--dss-spacing-sm) var(--dss-spacing-md);
|
|
9
|
+
gap: var(--dss-spacing-xs);
|
|
10
|
+
font-size: 14px;
|
|
11
|
+
line-height: 24px;
|
|
12
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { html, nothing } from "lit";
|
|
2
|
+
import { ActiveFiltersHeader } from "./active-filters-header";
|
|
3
|
+
import { when } from "lit/directives/when.js";
|
|
4
|
+
|
|
5
|
+
export const template = (props: ActiveFiltersHeader) => {
|
|
6
|
+
if (!props.areCustomFiltersActive && props.searchString.length < 1) return nothing;
|
|
7
|
+
|
|
8
|
+
return html`
|
|
9
|
+
<div class="active-filters-header">
|
|
10
|
+
<active-filters-badges></active-filters-badges>
|
|
11
|
+
${when(props.searchString.length > 1, () => html`<activity-history-search-results searchQuery=${props.searchString}></activity-history-search-results>`)}
|
|
12
|
+
</div>
|
|
13
|
+
`;
|
|
14
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createSelector } from "@reduxjs/toolkit";
|
|
2
2
|
import {
|
|
3
|
+
IActivityHistoryCustomFilter,
|
|
3
4
|
IActivityHistoryCustomFilterGroup,
|
|
4
5
|
IActivityHistoryFilterGroup,
|
|
5
6
|
isNotCommonFilterGroup,
|
|
@@ -18,3 +19,28 @@ const sortBySortProperty = (
|
|
|
18
19
|
a: IActivityHistoryCustomFilterGroup,
|
|
19
20
|
b: IActivityHistoryCustomFilterGroup,
|
|
20
21
|
) => Number(a.sort) - Number(b.sort);
|
|
22
|
+
|
|
23
|
+
export const areCustomFiltersActive = createSelector(
|
|
24
|
+
activityHistoryCustomFilterGroupsSelector,
|
|
25
|
+
(filters: IActivityHistoryCustomFilterGroup[]) => {
|
|
26
|
+
return filters.some((filter) =>
|
|
27
|
+
filter.filters.some((singleFilter) => singleFilter.enabledValues?.length),
|
|
28
|
+
);
|
|
29
|
+
},
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
export const activeGroupsWithEnabledFilters = createSelector(
|
|
33
|
+
activityHistoryCustomFilterGroupsSelector,
|
|
34
|
+
(filters: IActivityHistoryCustomFilterGroup[]) => {
|
|
35
|
+
return filters
|
|
36
|
+
.filter((group) => group.enabled)
|
|
37
|
+
.map(({ id, title, enabled, sort, filters }) => ({
|
|
38
|
+
id,
|
|
39
|
+
title,
|
|
40
|
+
enabled,
|
|
41
|
+
sort,
|
|
42
|
+
filters: filters.filter((filter) => filter.enabledValues?.length),
|
|
43
|
+
}))
|
|
44
|
+
.filter((group) => group.filters.length > 0);
|
|
45
|
+
},
|
|
46
|
+
);
|
package/src/internal-plugins/activity-history/activity-history-item/list/UI/main-view/template.ts
CHANGED
|
@@ -33,7 +33,7 @@ export const template = (props: ActivityHistoryMain) =>
|
|
|
33
33
|
<div class="wrapper" ?maximized=${props.maximized}>
|
|
34
34
|
<activity-history-filters .wrapperMaximized=${props.maximized}></activity-history-filters>
|
|
35
35
|
<div class="content">
|
|
36
|
-
|
|
36
|
+
<active-filters-header></active-filters-header>
|
|
37
37
|
<activity-history-busy></activity-history-busy>
|
|
38
38
|
<activity-history-timeline></activity-history-timeline>
|
|
39
39
|
</div>
|
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
.search-header {
|
|
2
|
-
padding-inline: 16px;
|
|
3
|
-
padding-top: 12px;
|
|
4
|
-
padding-bottom: 12px;
|
|
5
|
-
gap: var(--dss-spacing-xs);
|
|
6
|
-
border-width: 0px 0px 1px 0px;
|
|
7
|
-
border-style: solid;
|
|
8
|
-
border-color: #D8D8D8;
|
|
9
|
-
background-color: #FFFFFF;
|
|
10
2
|
color: var(--color-neutral-900);
|
|
11
3
|
font-weight: 600;
|
|
12
|
-
|
|
13
|
-
line-height: 24px;
|
|
4
|
+
|
|
14
5
|
}
|
|
@@ -4,6 +4,7 @@ import { SearchActivityHistoryItems } from "./request";
|
|
|
4
4
|
import { BrokerDisposableHandler } from "../../../../api/broker/primaria-broker";
|
|
5
5
|
import "./activity-history-search-results/activity-history-search-results";
|
|
6
6
|
import "./activity-history-search-bar/activity-history-search-bar";
|
|
7
|
+
import "../filter/UI/active-filters-badges/active-filters-badges";
|
|
7
8
|
|
|
8
9
|
let request: BrokerDisposableHandler;
|
|
9
10
|
|
|
@@ -54,14 +54,15 @@ export const locales = {
|
|
|
54
54
|
allActivityHistory: "Tot l’històric d’activitat",
|
|
55
55
|
onlyAppliedFilters: "Només amb filtres aplicats",
|
|
56
56
|
selectDateRange: "En el cas que sigui necessari, selecciona un rang de dates",
|
|
57
|
-
helpText:
|
|
57
|
+
helpText:
|
|
58
|
+
"Sense seleccionar data, s'aplicarà la de la primera entrada. Sense seleccionar data de fi, s'aplicarà la de l'última entrada.",
|
|
58
59
|
startDate: "Data Inici",
|
|
59
60
|
endDate: "Data Fi",
|
|
60
61
|
cancel: "Cancel·lar",
|
|
61
62
|
export: "Exportar",
|
|
62
63
|
},
|
|
63
64
|
filters: {
|
|
64
|
-
filters: "Filtres",
|
|
65
|
+
filters: "Filtres",
|
|
65
66
|
searchFilter: "Cercar filtre",
|
|
66
67
|
ownFilters: "Els meus",
|
|
67
68
|
rellevantFilters: "Rellevants",
|
|
@@ -84,6 +85,9 @@ export const locales = {
|
|
|
84
85
|
variablees: "Variables",
|
|
85
86
|
prescriptions: "Prescripcions",
|
|
86
87
|
},
|
|
88
|
+
chipHeader: {
|
|
89
|
+
selection: "Selecció:",
|
|
90
|
+
},
|
|
87
91
|
},
|
|
88
92
|
},
|
|
89
93
|
};
|