@uxland/primary-shell 3.5.3 → 4.0.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 +23845 -13736
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +962 -797
- package/dist/index.umd.cjs.map +1 -1
- package/dist/primary/shell/src/UI/shared-components/index.d.ts +1 -0
- package/dist/primary/shell/src/index.d.ts +1 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/add/add-async-history-items/request.d.ts +5 -4
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/add/add-history-item/request.d.ts +1 -1
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/add/add-history-items/request.d.ts +1 -1
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/domain/specs/common-filter-spec.d.ts +9 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/domain/specs/custom-filter-spec.d.ts +10 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/domain/specs/false-spec.d.ts +6 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/domain/specs/prop-path-spec.d.ts +9 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/domain/specs/type-spec.d.ts +14 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/export-to-pdf/export-pdf-modal/export-pdf-modal.d.ts +1 -1
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/UI/activity-history-filters/activity-history-filters.d.ts +7 -2
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/common-filters/common-filters.d.ts +3 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/common-filters/selectors.d.ts +92 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/common-filters/set-common-filter/actions.d.ts +4 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/{set-common-filter → common-filters/set-common-filter}/handler.d.ts +1 -1
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/common-filters/set-common-filter/reducer.d.ts +6 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/add-custom-filters/actions.d.ts +1 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/add-custom-filters/bootstrapper.d.ts +4 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/add-custom-filters/handler.d.ts +6 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/add-custom-filters/reducer.d.ts +4 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/add-custom-filters/request.d.ts +6 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/selectors.d.ts +33 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-group/actions.d.ts +4 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-group/bootstrapper.d.ts +4 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-group/handler.d.ts +6 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-group/reducer.d.ts +6 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-group/request.d.ts +10 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-value/actions.d.ts +1 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-value/bootstrapper.d.ts +4 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-value/handler.d.ts +6 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-value/reducer.d.ts +4 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-value/request.d.ts +10 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/index.d.ts +1 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/model.d.ts +35 -5
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/selectors.d.ts +0 -154
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/slice.d.ts +20 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/index.d.ts +5 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/list/handle-error/actions.d.ts +4 -1
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/list/handle-error/reducers.d.ts +7 -2
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/selectors.d.ts +294 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/update/request.d.ts +1 -1
- package/dist/primary/shell/src/internal-plugins/activity-history/index.d.ts +1 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/infrastructure/state/store.d.ts +4 -4
- package/dist/primary/shell/src/internal-plugins/activity-history/localization.d.ts +3 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/utils/get-unique-values-by-prop-path.d.ts +4 -0
- package/dist/primary/shell/src/locales.d.ts +5 -0
- package/dist/style.css +1 -1
- package/package.json +4 -4
- package/src/UI/components/shell-header/template.ts +11 -6
- package/src/UI/shared-components/index.ts +1 -0
- package/src/index.ts +1 -1
- package/src/internal-plugins/activity-history/activity-history-item/add/add-async-history-items/bootstrapper.ts +2 -2
- package/src/internal-plugins/activity-history/activity-history-item/add/add-async-history-items/handler.ts +5 -4
- package/src/internal-plugins/activity-history/activity-history-item/add/add-async-history-items/request.ts +5 -4
- package/src/internal-plugins/activity-history/activity-history-item/add/add-history-item/bootstrapper.ts +2 -2
- package/src/internal-plugins/activity-history/activity-history-item/add/add-history-item/request.ts +1 -1
- package/src/internal-plugins/activity-history/activity-history-item/add/add-history-items/bootstrapper.ts +2 -2
- package/src/internal-plugins/activity-history/activity-history-item/add/add-history-items/request.ts +1 -1
- package/src/internal-plugins/activity-history/activity-history-item/domain/specs/common-filter-spec.ts +18 -0
- package/src/internal-plugins/activity-history/activity-history-item/domain/specs/custom-filter-spec.ts +59 -0
- package/src/internal-plugins/activity-history/activity-history-item/domain/specs/false-spec.ts +8 -0
- package/src/internal-plugins/activity-history/activity-history-item/domain/specs/prop-path-spec.ts +19 -0
- package/src/internal-plugins/activity-history/activity-history-item/domain/specs/type-spec.ts +26 -0
- package/src/internal-plugins/activity-history/activity-history-item/export-to-pdf/export-pdf-modal/export-pdf-modal.css +3 -3
- package/src/internal-plugins/activity-history/activity-history-item/export-to-pdf/export-pdf-modal/template.ts +1 -2
- package/src/internal-plugins/activity-history/activity-history-item/filter/UI/activity-history-filters/activity-history-filters.ts +40 -5
- package/src/internal-plugins/activity-history/activity-history-item/filter/UI/activity-history-filters/styles.css +20 -4
- package/src/internal-plugins/activity-history/activity-history-item/filter/UI/activity-history-filters/template.ts +85 -13
- package/src/internal-plugins/activity-history/activity-history-item/filter/bootstrapper.ts +19 -1
- package/src/internal-plugins/activity-history/activity-history-item/filter/common-filters/common-filters.ts +26 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/common-filters/selectors.ts +14 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/{actions.ts → common-filters/set-common-filter/actions.ts} +1 -1
- package/src/internal-plugins/activity-history/activity-history-item/filter/{set-common-filter → common-filters/set-common-filter}/handler.ts +2 -2
- package/src/internal-plugins/activity-history/activity-history-item/filter/common-filters/set-common-filter/reducer.ts +18 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/add-custom-filters/actions.ts +3 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/add-custom-filters/bootstrapper.ts +14 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/add-custom-filters/handler.ts +14 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/add-custom-filters/reducer.ts +9 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/add-custom-filters/request.ts +5 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/selectors.ts +20 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-group/actions.ts +3 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-group/bootstrapper.ts +14 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-group/handler.ts +13 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-group/reducer.ts +17 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-group/request.ts +3 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-value/actions.ts +3 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-value/bootstrapper.ts +14 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-value/handler.ts +13 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-value/reducer.ts +41 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/custom-filters/set-custom-filter-value/request.ts +10 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/index.ts +1 -0
- package/src/internal-plugins/activity-history/activity-history-item/filter/model.ts +44 -5
- package/src/internal-plugins/activity-history/activity-history-item/filter/selectors.ts +0 -24
- package/src/internal-plugins/activity-history/activity-history-item/filter/slice.ts +11 -15
- package/src/internal-plugins/activity-history/activity-history-item/index.ts +5 -0
- package/src/internal-plugins/activity-history/activity-history-item/list/UI/main-view/activity-history-main.ts +1 -1
- package/src/internal-plugins/activity-history/activity-history-item/list/UI/main-view/template.ts +3 -3
- package/src/internal-plugins/activity-history/activity-history-item/list/UI/timeline/activity-history-timeline.ts +1 -1
- package/src/internal-plugins/activity-history/activity-history-item/list/handle-error/reducers.ts +7 -2
- package/src/internal-plugins/activity-history/activity-history-item/search/activity-history-search-bar/styles.css +1 -1
- package/src/internal-plugins/activity-history/activity-history-item/search/activity-history-search-results/styles.css +1 -1
- package/src/internal-plugins/activity-history/activity-history-item/selectors.ts +107 -0
- package/src/internal-plugins/activity-history/activity-history-item/update/bootstrapper.ts +2 -2
- package/src/internal-plugins/activity-history/activity-history-item/update/request.ts +1 -1
- package/src/internal-plugins/activity-history/index.ts +1 -0
- package/src/internal-plugins/activity-history/localization.ts +3 -0
- package/src/internal-plugins/activity-history/utils/get-unique-values-by-prop-path.ts +19 -0
- package/src/locales.ts +5 -0
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/actions.d.ts +0 -1
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/common-filters.d.ts +0 -3
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/constants.d.ts +0 -7
- package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/list/selectors.d.ts +0 -156
- package/src/internal-plugins/activity-history/activity-history-item/filter/common-filters.ts +0 -29
- package/src/internal-plugins/activity-history/activity-history-item/filter/constants.ts +0 -8
- package/src/internal-plugins/activity-history/activity-history-item/list/selectors.ts +0 -62
- /package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/{set-common-filter → common-filters/set-common-filter}/bootstrapper.d.ts +0 -0
- /package/dist/primary/shell/src/internal-plugins/activity-history/activity-history-item/filter/{set-common-filter → common-filters/set-common-filter}/request.d.ts +0 -0
- /package/src/internal-plugins/activity-history/activity-history-item/filter/{set-common-filter → common-filters/set-common-filter}/bootstrapper.ts +0 -0
- /package/src/internal-plugins/activity-history/activity-history-item/filter/{set-common-filter → common-filters/set-common-filter}/request.ts +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { createSelector } from "@reduxjs/toolkit";
|
|
2
|
+
import { isCommonFilterGroup } from "../model";
|
|
3
|
+
import { activityHistoryFiltersSelector } from "../selectors";
|
|
4
|
+
|
|
5
|
+
export const activityHistoryCommonFiltersSelector = createSelector(
|
|
6
|
+
activityHistoryFiltersSelector,
|
|
7
|
+
(filters) => filters.find(isCommonFilterGroup)?.filters || [],
|
|
8
|
+
);
|
|
9
|
+
|
|
10
|
+
export const isEnabledCommonFilterSelector = (filterId: string) =>
|
|
11
|
+
createSelector(
|
|
12
|
+
activityHistoryCommonFiltersSelector,
|
|
13
|
+
(filterSpecs) => filterSpecs?.find((s) => s.id === filterId)?.enabled,
|
|
14
|
+
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StoreBaseHandler } from "
|
|
2
|
-
import { setCommonFilterValue } from "
|
|
1
|
+
import { StoreBaseHandler } from "../../../../infrastructure/base-handlers";
|
|
2
|
+
import { setCommonFilterValue } from "./actions";
|
|
3
3
|
import { SetCommonFilter } from "./request";
|
|
4
4
|
|
|
5
5
|
export class SetCommonFilterHandler extends StoreBaseHandler {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { PayloadAction } from "@reduxjs/toolkit";
|
|
2
|
+
|
|
3
|
+
export function setCommonFilterValueReducer(
|
|
4
|
+
state,
|
|
5
|
+
action: PayloadAction<{ id: string; enabled: boolean }>,
|
|
6
|
+
) {
|
|
7
|
+
state.filters = state.filters.map((f) => {
|
|
8
|
+
if (f.id === "common") {
|
|
9
|
+
return {
|
|
10
|
+
...f,
|
|
11
|
+
filters: f.filters.map((ff) =>
|
|
12
|
+
ff.id === action.payload.id ? { ...ff, enabled: action.payload.enabled } : ff,
|
|
13
|
+
),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return f;
|
|
17
|
+
});
|
|
18
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BrokerExtensions } from "@primaria/plugins-core";
|
|
2
|
+
import { BrokerDisposableHandler } from "../../../../../../api/broker/primaria-broker";
|
|
3
|
+
import { AddCustomFiltersHandler } from "./handler";
|
|
4
|
+
import { AddCustomFiltersCommand } from "./request";
|
|
5
|
+
|
|
6
|
+
let request: BrokerDisposableHandler;
|
|
7
|
+
|
|
8
|
+
export const bootstrapAddCustomFilter = (broker: BrokerExtensions) => {
|
|
9
|
+
request = broker.registerRequest(AddCustomFiltersCommand, AddCustomFiltersHandler);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const teardownAddCustomFilter = () => {
|
|
13
|
+
request?.dispose();
|
|
14
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StoreBaseHandler } from "../../../../infrastructure/base-handlers";
|
|
2
|
+
import { addCustomFilters } from "./actions";
|
|
3
|
+
import { AddCustomFiltersCommand } from "./request";
|
|
4
|
+
|
|
5
|
+
export class AddCustomFiltersHandler extends StoreBaseHandler {
|
|
6
|
+
async handle(request: AddCustomFiltersCommand) {
|
|
7
|
+
try {
|
|
8
|
+
//TODO ensure are valid filters
|
|
9
|
+
this.store.dispatch(addCustomFilters(request.payload));
|
|
10
|
+
} catch (e) {
|
|
11
|
+
console.log(e.message);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PayloadAction } from "@reduxjs/toolkit";
|
|
2
|
+
import { IActivityHistoryCommonFilterGroup } from "../model";
|
|
3
|
+
|
|
4
|
+
export function addCustomFiltersReducer(
|
|
5
|
+
state,
|
|
6
|
+
action: PayloadAction<IActivityHistoryCommonFilterGroup>,
|
|
7
|
+
) {
|
|
8
|
+
state.filters = [...state.filters, action.payload];
|
|
9
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createSelector } from "@reduxjs/toolkit";
|
|
2
|
+
import {
|
|
3
|
+
IActivityHistoryCustomFilterGroup,
|
|
4
|
+
IActivityHistoryFilterGroup,
|
|
5
|
+
isNotCommonFilterGroup,
|
|
6
|
+
} from "../model";
|
|
7
|
+
import { activityHistoryFiltersSelector } from "../selectors";
|
|
8
|
+
|
|
9
|
+
export const activityHistoryCustomFilterGroupsSelector = createSelector(
|
|
10
|
+
activityHistoryFiltersSelector,
|
|
11
|
+
(filters: IActivityHistoryFilterGroup[]) => {
|
|
12
|
+
const customFilters = filters.filter(isNotCommonFilterGroup);
|
|
13
|
+
return customFilters.sort(sortBySortProperty);
|
|
14
|
+
},
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
const sortBySortProperty = (
|
|
18
|
+
a: IActivityHistoryCustomFilterGroup,
|
|
19
|
+
b: IActivityHistoryCustomFilterGroup,
|
|
20
|
+
) => Number(a.sort) - Number(b.sort);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BrokerExtensions } from "@primaria/plugins-core";
|
|
2
|
+
import { BrokerDisposableHandler } from "../../../../../../api/broker/primaria-broker";
|
|
3
|
+
import { SetCustomFilterGroup } from "./request";
|
|
4
|
+
import { SetCustomFilterGroupHandler } from "./handler";
|
|
5
|
+
|
|
6
|
+
let request: BrokerDisposableHandler;
|
|
7
|
+
|
|
8
|
+
export const bootstrapSetCustomFilterGroup = (broker: BrokerExtensions) => {
|
|
9
|
+
request = broker.registerRequest(SetCustomFilterGroup, SetCustomFilterGroupHandler);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const teardownSetCustomFilterGroup = () => {
|
|
13
|
+
request?.dispose();
|
|
14
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StoreBaseHandler } from "../../../../infrastructure/base-handlers";
|
|
2
|
+
import { setCustomFilterGroupValue } from "./actions";
|
|
3
|
+
import { SetCustomFilterGroup } from "./request";
|
|
4
|
+
|
|
5
|
+
export class SetCustomFilterGroupHandler extends StoreBaseHandler {
|
|
6
|
+
async handle(request: SetCustomFilterGroup) {
|
|
7
|
+
try {
|
|
8
|
+
this.store.dispatch(setCustomFilterGroupValue(request.payload));
|
|
9
|
+
} catch (e) {
|
|
10
|
+
console.log(e.message);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { PayloadAction } from "@reduxjs/toolkit";
|
|
2
|
+
|
|
3
|
+
export function setCustomFilterGroupValueReducer(
|
|
4
|
+
state,
|
|
5
|
+
action: PayloadAction<{ id: string; enabled: boolean }>,
|
|
6
|
+
) {
|
|
7
|
+
//seteamos el valor de enabled en el filterGroup, y ademas vamos a todos los hijos y deshabilitamos todas sus opciones si estamos deshabilitando el grupo.
|
|
8
|
+
state.filters = state.filters.map((f) => {
|
|
9
|
+
if (f.id === action.payload.id) {
|
|
10
|
+
return {
|
|
11
|
+
...f,
|
|
12
|
+
enabled: action.payload.enabled,
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
return f;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BrokerExtensions } from "@primaria/plugins-core";
|
|
2
|
+
import { BrokerDisposableHandler } from "../../../../../../api/broker/primaria-broker";
|
|
3
|
+
import { SetCustomFilterValue } from "./request";
|
|
4
|
+
import { SetCustomFilterValueHandler } from "./handler";
|
|
5
|
+
|
|
6
|
+
let request: BrokerDisposableHandler;
|
|
7
|
+
|
|
8
|
+
export const bootstrapSetCustomFilterValue = (broker: BrokerExtensions) => {
|
|
9
|
+
request = broker.registerRequest(SetCustomFilterValue, SetCustomFilterValueHandler);
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const teardownSetCustomFilterValue = () => {
|
|
13
|
+
request?.dispose();
|
|
14
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { StoreBaseHandler } from "../../../../infrastructure/base-handlers";
|
|
2
|
+
import { setCustomFilterValue } from "./actions";
|
|
3
|
+
import { SetCustomFilterValue } from "./request";
|
|
4
|
+
|
|
5
|
+
export class SetCustomFilterValueHandler extends StoreBaseHandler {
|
|
6
|
+
async handle(request: SetCustomFilterValue) {
|
|
7
|
+
try {
|
|
8
|
+
this.store.dispatch(setCustomFilterValue(request.payload));
|
|
9
|
+
} catch (e) {
|
|
10
|
+
console.log(e.message);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { PayloadAction } from "@reduxjs/toolkit";
|
|
2
|
+
import { SetCustomFilterValuePayload } from "./request";
|
|
3
|
+
|
|
4
|
+
export function setCustomFilterValueReducer(
|
|
5
|
+
state,
|
|
6
|
+
action: PayloadAction<SetCustomFilterValuePayload>,
|
|
7
|
+
) {
|
|
8
|
+
state.filters = state.filters.map((f) => {
|
|
9
|
+
if (f.id === action.payload.filterGroupId) {
|
|
10
|
+
return {
|
|
11
|
+
...f,
|
|
12
|
+
filters: f.filters.map((ff) =>
|
|
13
|
+
ff.id === action.payload.filterId
|
|
14
|
+
? ff.singleOption
|
|
15
|
+
? setSingleOptionFilterValue(ff, action.payload.enabled)
|
|
16
|
+
: setMultipleOptionsFilterValue(ff, action.payload)
|
|
17
|
+
: ff,
|
|
18
|
+
),
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return f;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const setMultipleOptionsFilterValue = (filter, payload: SetCustomFilterValuePayload) => {
|
|
26
|
+
const { optionId, enabled } = payload;
|
|
27
|
+
return {
|
|
28
|
+
...filter,
|
|
29
|
+
enabledValues: enabled
|
|
30
|
+
? [...(filter.enabledValues || []), optionId]
|
|
31
|
+
: filter.enabledValues.filter((id) => id !== optionId),
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const setSingleOptionFilterValue = (filter, value: boolean) => {
|
|
36
|
+
return {
|
|
37
|
+
...filter,
|
|
38
|
+
enabled: value,
|
|
39
|
+
enabledValues: value ? [true] : [],
|
|
40
|
+
};
|
|
41
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./model";
|
|
@@ -1,20 +1,59 @@
|
|
|
1
1
|
import { IActivityHistoryItem } from "../domain/model";
|
|
2
2
|
import { Spec } from "../domain/specs/spec";
|
|
3
|
-
import { ActivityHistoryFilterOperation, ActivityHistoryFilterType } from "./constants";
|
|
4
3
|
|
|
5
4
|
type Constructor<T> = new (...args: any[]) => T;
|
|
6
5
|
|
|
7
|
-
export
|
|
6
|
+
export enum ActivityHistoryFilterType {
|
|
7
|
+
Switch = "switch",
|
|
8
|
+
Checkbox = "checkbox",
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export enum ActivityHistoryFilterOperation {
|
|
12
|
+
And = "and",
|
|
13
|
+
Or = "or",
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface IActivityHistoryCommonFilterGroup {
|
|
8
17
|
id: string;
|
|
9
18
|
title: string;
|
|
10
|
-
filters:
|
|
19
|
+
filters: IActivityHistoryCommonFilter[];
|
|
11
20
|
}
|
|
12
21
|
|
|
13
|
-
export interface
|
|
22
|
+
export interface IActivityHistoryCommonFilter {
|
|
14
23
|
id: string;
|
|
15
24
|
title: string;
|
|
16
25
|
spec: Constructor<Spec<IActivityHistoryItem>>;
|
|
17
26
|
enabled: boolean;
|
|
18
27
|
type: ActivityHistoryFilterType;
|
|
19
|
-
operation: ActivityHistoryFilterOperation;
|
|
20
28
|
}
|
|
29
|
+
|
|
30
|
+
export interface IActivityHistoryCustomFilterGroup {
|
|
31
|
+
id: string;
|
|
32
|
+
title: string;
|
|
33
|
+
enabled: boolean;
|
|
34
|
+
sort: string;
|
|
35
|
+
filters: IActivityHistoryCustomFilter[];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type IActivityHistoryFilterGroup =
|
|
39
|
+
| IActivityHistoryCommonFilterGroup
|
|
40
|
+
| IActivityHistoryCustomFilterGroup;
|
|
41
|
+
|
|
42
|
+
export interface IActivityHistoryCustomFilter {
|
|
43
|
+
id: string;
|
|
44
|
+
title: string;
|
|
45
|
+
propPathValue: string[];
|
|
46
|
+
propsPathDescription: string[];
|
|
47
|
+
enabled: boolean;
|
|
48
|
+
type: ActivityHistoryFilterType;
|
|
49
|
+
singleOption?: boolean;
|
|
50
|
+
options?: {
|
|
51
|
+
id: string;
|
|
52
|
+
title: string;
|
|
53
|
+
}[];
|
|
54
|
+
enabledValues?: string[];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const isCommonFilterGroup = (group: IActivityHistoryFilterGroup) => group.id === "common";
|
|
58
|
+
export const isNotCommonFilterGroup = (group: IActivityHistoryFilterGroup) =>
|
|
59
|
+
!isCommonFilterGroup(group);
|
|
@@ -1,28 +1,4 @@
|
|
|
1
|
-
import { createSelector } from "@reduxjs/toolkit";
|
|
2
1
|
import { RootState } from "../../infrastructure/state/store";
|
|
3
|
-
import { TrueSpec } from "../domain/specs/true-spec";
|
|
4
|
-
import { IActivityHistoryFilter } from "./model";
|
|
5
2
|
|
|
6
3
|
export const activityHistoryFiltersSelector = (state: RootState) =>
|
|
7
4
|
state.activityHistoryFilters.filters;
|
|
8
|
-
|
|
9
|
-
export const activityHistoryCommonFiltersSelector = createSelector(
|
|
10
|
-
activityHistoryFiltersSelector,
|
|
11
|
-
(filters) => filters.find((f) => f.id === "common")?.filters,
|
|
12
|
-
);
|
|
13
|
-
export const isEnabledCommonFilterSelector = (filterId: string) =>
|
|
14
|
-
createSelector(
|
|
15
|
-
activityHistoryCommonFiltersSelector,
|
|
16
|
-
(filterSpecs) => filterSpecs?.find((s) => s.id === filterId)?.enabled,
|
|
17
|
-
);
|
|
18
|
-
|
|
19
|
-
export const commonSpecSelector = createSelector(
|
|
20
|
-
activityHistoryCommonFiltersSelector,
|
|
21
|
-
(commonFilters: IActivityHistoryFilter[]) => {
|
|
22
|
-
const enabledCommonFilters = commonFilters.filter((f) => f.enabled);
|
|
23
|
-
const finalCommonSpec = enabledCommonFilters.reduce((acc, filter) => {
|
|
24
|
-
return acc.and(new filter.spec());
|
|
25
|
-
}, new TrueSpec());
|
|
26
|
-
return finalCommonSpec;
|
|
27
|
-
},
|
|
28
|
-
);
|
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
import { createSlice } from "@reduxjs/toolkit";
|
|
2
|
-
import { commonFilters } from "./common-filters";
|
|
3
2
|
import { setSearchStringReducer } from "../search/reducer";
|
|
3
|
+
import { commonFilters } from "./common-filters/common-filters";
|
|
4
|
+
import { setCommonFilterValueReducer } from "./common-filters/set-common-filter/reducer";
|
|
5
|
+
import { addCustomFiltersReducer } from "./custom-filters/add-custom-filters/reducer";
|
|
6
|
+
import { setCustomFilterGroupValueReducer } from "./custom-filters/set-custom-filter-group/reducer";
|
|
7
|
+
import { setCustomFilterValueReducer } from "./custom-filters/set-custom-filter-value/reducer";
|
|
8
|
+
import { IActivityHistoryFilterGroup } from "./model";
|
|
4
9
|
|
|
5
10
|
export const activityHistoryFiltersSlice = createSlice({
|
|
6
11
|
name: "activity-history-filters",
|
|
7
12
|
initialState: {
|
|
8
13
|
searchString: "",
|
|
9
|
-
filters: [...commonFilters],
|
|
14
|
+
filters: [...commonFilters] as IActivityHistoryFilterGroup[],
|
|
10
15
|
},
|
|
11
16
|
reducers: {
|
|
12
17
|
setSearchString: setSearchStringReducer,
|
|
13
|
-
setCommonFilterValue
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
...f,
|
|
18
|
-
filters: f.filters.map((ff) =>
|
|
19
|
-
ff.id === action.payload.id ? { ...ff, enabled: action.payload.enabled } : ff,
|
|
20
|
-
),
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
return f;
|
|
24
|
-
});
|
|
25
|
-
},
|
|
18
|
+
setCommonFilterValue: setCommonFilterValueReducer,
|
|
19
|
+
addCustomFilters: addCustomFiltersReducer,
|
|
20
|
+
setCustomFilterGroupValue: setCustomFilterGroupValueReducer,
|
|
21
|
+
setCustomFilterValue: setCustomFilterValueReducer,
|
|
26
22
|
},
|
|
27
23
|
});
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from "./filter";
|
|
2
|
+
export { addAsyncHistoryItemsCommand } from "./add/add-async-history-items/request";
|
|
3
|
+
export { addHistoryItemsCommand } from "./add/add-history-items/request";
|
|
4
|
+
export { addHistoryItemCommand } from "./add/add-history-item/request";
|
|
5
|
+
export { updateHistoryItemCommand } from "./update/request";
|
|
@@ -8,7 +8,7 @@ import { lazyInject } from "../../../../infrastructure/ioc/container";
|
|
|
8
8
|
import { TYPES } from "../../../../infrastructure/ioc/types";
|
|
9
9
|
import { connectedProperty } from "../../../../infrastructure/state/connected-property";
|
|
10
10
|
import { SearchActivityHistoryItems } from "../../../search/request";
|
|
11
|
-
import { activityHistoryCollectionsSelector } from "
|
|
11
|
+
import { activityHistoryCollectionsSelector } from "../../../selectors";
|
|
12
12
|
import { ActivityHistoryTimeline } from "../timeline/activity-history-timeline";
|
|
13
13
|
import styles from "./styles.css?inline";
|
|
14
14
|
import { template } from "./template";
|
package/src/internal-plugins/activity-history/activity-history-item/list/UI/main-view/template.ts
CHANGED
|
@@ -19,9 +19,9 @@ export const template = (props: ActivityHistoryMain) =>
|
|
|
19
19
|
</div>
|
|
20
20
|
|
|
21
21
|
<div class="header__right">
|
|
22
|
-
<dss-icon-button @click=${() => props._maximize()} size="md" variant="primary" icon="arrow_forward" label
|
|
22
|
+
<dss-icon-button @click=${() => props._maximize()} size="md" variant="primary" icon="arrow_forward" label=${translate("actions.maximizeButton")}></dss-icon-button>
|
|
23
23
|
<div>|</div>
|
|
24
|
-
<dss-icon-button size="md" variant="primary" icon="more_vert" label
|
|
24
|
+
<dss-icon-button size="md" variant="primary" icon="more_vert" label=${translate("actions.menuButton")}></dss-icon-button>
|
|
25
25
|
<dss-action-menu position="bottom-start">
|
|
26
26
|
<dss-action-menu-item lefticon="view_timeline" label=${translate("actions.cronogram")}></dss-action-menu-item>
|
|
27
27
|
<dss-action-menu-item lefticon="file_download" label=${translate("actions.exportPdf")} @click=${() => props.api.broker.send(new ExportPdf())}></dss-action-menu-item>
|
|
@@ -31,7 +31,7 @@ export const template = (props: ActivityHistoryMain) =>
|
|
|
31
31
|
</div>`
|
|
32
32
|
}
|
|
33
33
|
<div class="wrapper" ?maximized=${props.maximized}>
|
|
34
|
-
<activity-history-filters></activity-history-filters>
|
|
34
|
+
<activity-history-filters .wrapperMaximized=${props.maximized}></activity-history-filters>
|
|
35
35
|
<div class="content">
|
|
36
36
|
${when(props.searchQuery.length > 1, () => html`<activity-history-search-header searchQuery="${props.searchQuery}"></activity-history-search-header>`)}
|
|
37
37
|
<activity-history-busy></activity-history-busy>
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
isAnyCollectionLoadingWithoutAnyLoaded,
|
|
8
8
|
isSomeCollectionLoadedAndOtherLoading,
|
|
9
9
|
} from "../../handle-busy/selectors";
|
|
10
|
-
import { activityHistoryGroupedItems } from "
|
|
10
|
+
import { activityHistoryGroupedItems } from "../../../selectors";
|
|
11
11
|
import styles from "./styles.css?inline";
|
|
12
12
|
import { template } from "./template";
|
|
13
13
|
|
package/src/internal-plugins/activity-history/activity-history-item/list/handle-error/reducers.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
import { PayloadAction } from "@reduxjs/toolkit";
|
|
2
|
+
|
|
3
|
+
export function addErrorHistoryItemReducer(
|
|
4
|
+
state,
|
|
5
|
+
action: PayloadAction<{ id: string; message: string }>,
|
|
6
|
+
) {
|
|
2
7
|
state.error.push(action.payload);
|
|
3
8
|
}
|
|
4
|
-
export function removeErrorHistoryItemReducer(state, action) {
|
|
9
|
+
export function removeErrorHistoryItemReducer(state, action: PayloadAction<string>) {
|
|
5
10
|
state.error = state.error.filter((i) => i !== action.payload);
|
|
6
11
|
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { createSelector } from "@reduxjs/toolkit";
|
|
2
|
+
import { RootState } from "../infrastructure/state/store";
|
|
3
|
+
import { getUniqueObjects } from "../utils/get-unique-values-by-prop-path";
|
|
4
|
+
import {
|
|
5
|
+
IActivityHistoryItem,
|
|
6
|
+
IActivityHistoryItemCollection,
|
|
7
|
+
TSearchActivityHistoryItemPredicate,
|
|
8
|
+
} from "./domain/model";
|
|
9
|
+
import { CommonFilterSpec } from "./domain/specs/common-filter-spec";
|
|
10
|
+
import { CustomFilterSpec } from "./domain/specs/custom-filter-spec";
|
|
11
|
+
import { SearchStringSpec } from "./domain/specs/search-string-spec";
|
|
12
|
+
import { ComposedTypeSpec } from "./domain/specs/type-spec";
|
|
13
|
+
import { IActivityHistoryCommonFilter, IActivityHistoryCustomFilterGroup } from "./filter";
|
|
14
|
+
import { activityHistoryCommonFiltersSelector } from "./filter/common-filters/selectors";
|
|
15
|
+
import { activityHistoryCustomFilterGroupsSelector } from "./filter/custom-filters/selectors";
|
|
16
|
+
import { groupActivityHistoryItems } from "./list/group-history-items/group-history-items";
|
|
17
|
+
import { sortGroupsByMostRecentDate } from "./list/sort-history-items-by-date/sort-history-items-by-date";
|
|
18
|
+
import { activityHistorySearchStringSelector } from "./search/selectors";
|
|
19
|
+
|
|
20
|
+
export const activityHistoryCollectionsSelector = (state: RootState) =>
|
|
21
|
+
state.activityHistoryCollections.collections;
|
|
22
|
+
|
|
23
|
+
const mapItemsWithMetadata = (
|
|
24
|
+
items: IActivityHistoryItem[],
|
|
25
|
+
componentFactory: any,
|
|
26
|
+
type: string,
|
|
27
|
+
searchPredicate: TSearchActivityHistoryItemPredicate,
|
|
28
|
+
) => {
|
|
29
|
+
return items.map(
|
|
30
|
+
(item) =>
|
|
31
|
+
({
|
|
32
|
+
...item,
|
|
33
|
+
searchPredicate,
|
|
34
|
+
componentFactory,
|
|
35
|
+
type,
|
|
36
|
+
}) as IActivityHistoryItem,
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export const activityHistoryMappedItems = createSelector(
|
|
41
|
+
activityHistoryCollectionsSelector,
|
|
42
|
+
(collections: Record<string, IActivityHistoryItemCollection>) => {
|
|
43
|
+
return Object.values(collections).flatMap((collection: IActivityHistoryItemCollection) => {
|
|
44
|
+
return mapItemsWithMetadata(
|
|
45
|
+
collection.items,
|
|
46
|
+
collection.componentFactory,
|
|
47
|
+
collection.id,
|
|
48
|
+
collection.searchPredicate,
|
|
49
|
+
);
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
export const customFilterGroupsWithOptionsSelector = createSelector(
|
|
55
|
+
activityHistoryCustomFilterGroupsSelector,
|
|
56
|
+
activityHistoryCollectionsSelector,
|
|
57
|
+
(
|
|
58
|
+
filterGroups: IActivityHistoryCustomFilterGroup[],
|
|
59
|
+
collections: Record<string, IActivityHistoryItemCollection>,
|
|
60
|
+
) => {
|
|
61
|
+
const result = filterGroups.map((filterGroup: IActivityHistoryCustomFilterGroup) => {
|
|
62
|
+
const collection = collections[filterGroup.id] as IActivityHistoryItemCollection;
|
|
63
|
+
return {
|
|
64
|
+
...filterGroup,
|
|
65
|
+
filters: filterGroup.filters.map((f) => {
|
|
66
|
+
return {
|
|
67
|
+
...f,
|
|
68
|
+
options:
|
|
69
|
+
(!f.singleOption
|
|
70
|
+
? getUniqueObjects<IActivityHistoryItem>(
|
|
71
|
+
collection.items,
|
|
72
|
+
f.propPathValue,
|
|
73
|
+
f.propsPathDescription,
|
|
74
|
+
)
|
|
75
|
+
: []) || [],
|
|
76
|
+
};
|
|
77
|
+
}),
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
return result;
|
|
81
|
+
},
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
export const activityHistoryGroupedItems = createSelector(
|
|
85
|
+
activityHistoryMappedItems,
|
|
86
|
+
activityHistorySearchStringSelector,
|
|
87
|
+
activityHistoryCommonFiltersSelector,
|
|
88
|
+
activityHistoryCustomFilterGroupsSelector,
|
|
89
|
+
(
|
|
90
|
+
items: IActivityHistoryItem[],
|
|
91
|
+
searchString: string,
|
|
92
|
+
commonFilters: IActivityHistoryCommonFilter[],
|
|
93
|
+
customFilters: IActivityHistoryCustomFilterGroup[],
|
|
94
|
+
) => {
|
|
95
|
+
const filteredItems = items.filter((item: IActivityHistoryItem) =>
|
|
96
|
+
new SearchStringSpec(searchString, item.searchPredicate)
|
|
97
|
+
.and(new CommonFilterSpec(commonFilters))
|
|
98
|
+
.and(new ComposedTypeSpec(customFilters))
|
|
99
|
+
.and(new CustomFilterSpec(customFilters))
|
|
100
|
+
.isSatisfiedBy(item),
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
const groupedItems = groupActivityHistoryItems(filteredItems);
|
|
104
|
+
const sortedByMostRecentDate = sortGroupsByMostRecentDate(groupedItems);
|
|
105
|
+
return sortedByMostRecentDate;
|
|
106
|
+
},
|
|
107
|
+
);
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { BrokerExtensions } from "@primaria/plugins-core";
|
|
2
2
|
import { UpdateHistoryItemHandler } from "./handler";
|
|
3
|
-
import {
|
|
3
|
+
import { updateHistoryItemCommand } from "./request";
|
|
4
4
|
import { BrokerDisposableHandler } from "../../../../api/broker/primaria-broker";
|
|
5
5
|
|
|
6
6
|
let request: BrokerDisposableHandler;
|
|
7
7
|
|
|
8
8
|
export const bootstrapUpdateHistoryItem = (broker: BrokerExtensions) => {
|
|
9
|
-
request = broker.registerRequest(
|
|
9
|
+
request = broker.registerRequest(updateHistoryItemCommand, UpdateHistoryItemHandler);
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export const teardownUpdateHistoryItem = () => {
|
|
@@ -46,12 +46,15 @@ export const locales = {
|
|
|
46
46
|
noteLegend: "Llegenda notes",
|
|
47
47
|
moreOptions: "Més opcions",
|
|
48
48
|
entryLegend: "Llegenda entrades",
|
|
49
|
+
maximizeButton: "Botó maximitzar",
|
|
50
|
+
menuButton: "Botó menu",
|
|
49
51
|
},
|
|
50
52
|
modal: {
|
|
51
53
|
selectExportOption: "Tria una opció d'exportació",
|
|
52
54
|
allActivityHistory: "Tot l’històric d’activitat",
|
|
53
55
|
onlyAppliedFilters: "Només amb filtres aplicats",
|
|
54
56
|
selectDateRange: "En el cas que sigui necessari, selecciona un rang de dates",
|
|
57
|
+
helpText: "Sense seleccionar data, s'aplicarà la de la primera entrada. Sense seleccionar data de fi, s'aplicarà la de l'última entrada.",
|
|
55
58
|
startDate: "Data Inici",
|
|
56
59
|
endDate: "Data Fi",
|
|
57
60
|
cancel: "Cancel·lar",
|