@dative-gpi/foundation-core-components 1.0.87 → 1.0.89

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.
@@ -58,10 +58,9 @@ import { computed, defineComponent, type PropType } from "vue";
58
58
 
59
59
  import { type ChartOrganisationFilters, type ChartOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
60
60
  import { useChartOrganisations, useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
61
+ import { chartOriginColor, chartOriginLabel } from "@dative-gpi/foundation-shared-components/tools";
61
62
  import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
62
63
  import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
63
-
64
- import { chartOriginColor, chartOriginLabel } from "../../utils";
65
64
  import { ChartOrigin } from "@dative-gpi/foundation-shared-domain/enums";
66
65
 
67
66
  import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <FSLoadDataTable
3
- v-if="($props.tableCode && !initialized) || gettingUserOrganisationTable"
3
+ v-if="($props.tableCode && !initialized) || gettingUserOrganisationTable || !table"
4
4
  />
5
5
  <FSDataTableUI
6
6
  v-else
@@ -89,8 +89,8 @@ export default defineComponent({
89
89
  }
90
90
  }, { immediate: true });
91
91
 
92
- watch(() => table.value, () => {
93
- if (table.value && initialized.value) {
92
+ watch(() => (table.value ? { ...table.value } : null), (_, former) => {
93
+ if (table.value && former && initialized.value) {
94
94
  debounce(update, props.debounceTime);
95
95
  }
96
96
  }, { deep: true });
@@ -30,6 +30,7 @@
30
30
  :canEditRemove="currentUser?.id === comment.userId"
31
31
  :comment="comment.comment"
32
32
  :edited="comment.edited"
33
+ :removing="removing"
33
34
  :id="comment.id"
34
35
  @edit="updateComment"
35
36
  @remove="removeComment(comment.id)"
@@ -39,7 +40,7 @@
39
40
 
40
41
  <script lang="ts">
41
42
  import type { PropType} from "vue";
42
- import { computed, defineComponent, onMounted, watch } from "vue";
43
+ import { computed, defineComponent, onMounted, ref, watch } from "vue";
43
44
  import _ from "lodash";
44
45
 
45
46
  import { useDateFormat, useCurrentUser } from "@dative-gpi/foundation-shared-services/composables";
@@ -73,13 +74,15 @@ export default defineComponent({
73
74
  }
74
75
  },
75
76
  setup(props) {
76
- const {fetch : fetchCurrentUser, entity: currentUser} = useCurrentUser();
77
+ const { fetch : fetchCurrentUser, entity: currentUser } = useCurrentUser();
77
78
  const { create: createComment, creating : creatingComment } = useCreateComment();
78
79
  const { getMany: fetchComments, entities: comments } = useComments();
79
- const {update } = useUpdateComment();
80
- const {remove } = useRemoveComment();
80
+ const { update } = useUpdateComment();
81
+ const { remove, removing } = useRemoveComment();
81
82
  const { epochToLongTimeFormat } = useDateFormat();
82
83
 
84
+ const error = ref<string | null>(null);
85
+
83
86
  const orderedComments = computed(() => {
84
87
  return _.orderBy(comments.value, ['timestamp'], ['desc']);
85
88
  });
@@ -101,8 +104,14 @@ export default defineComponent({
101
104
  update(payload.commentId, {comment : payload.comment})
102
105
  }
103
106
 
104
- const removeComment = (commentId : string) => {
105
- remove(commentId)
107
+ const removeComment = async (commentId : string) => {
108
+ try {
109
+ error.value = null;
110
+ await remove(commentId);
111
+ }
112
+ catch (exception: any) {
113
+ error.value = exception.response.data;
114
+ }
106
115
  }
107
116
 
108
117
  watch(() => props.commentFilters, (next, previous) => {
@@ -112,15 +121,18 @@ export default defineComponent({
112
121
  }, { immediate: true });
113
122
 
114
123
  return {
115
- comments,
116
- ColorEnum,
117
124
  creatingComment,
118
- currentUser,
119
125
  orderedComments,
126
+ currentUser,
127
+ ColorEnum,
128
+ comments,
129
+ removing,
130
+ error,
131
+ epochToLongTimeFormat,
120
132
  createNewComment,
121
133
  updateComment,
122
134
  removeComment,
123
- epochToLongTimeFormat
135
+
124
136
  };
125
137
  }
126
138
  });
@@ -13,7 +13,8 @@ import { computed, defineComponent, type PropType } from "vue";
13
13
 
14
14
  import { AggregationType } from "@dative-gpi/foundation-shared-domain/enums";
15
15
 
16
- import {aggregationTypeLabel, getEnumEntries} from "../../utils";
16
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
17
+ import { aggregationTypeLabel } from "@dative-gpi/foundation-shared-components/tools";
17
18
 
18
19
  import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
19
20
 
@@ -13,7 +13,8 @@ import { computed, defineComponent, type PropType } from "vue";
13
13
 
14
14
  import {AxisType} from "@dative-gpi/foundation-shared-domain/enums";
15
15
 
16
- import {axisTypeLabel, getEnumEntries} from "../../utils";
16
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
17
+ import { axisTypeLabel } from "@dative-gpi/foundation-shared-components/tools";
17
18
 
18
19
  import FSToggleSet from "@dative-gpi/foundation-shared-components/components/FSToggleSet.vue";
19
20
 
@@ -13,9 +13,10 @@ import { computed, defineComponent, type PropType } from "vue";
13
13
 
14
14
  import {DisplayAs} from "@dative-gpi/foundation-shared-domain/enums";
15
15
 
16
- import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
16
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
17
+ import { displayAsLabel } from "@dative-gpi/foundation-shared-components/tools";
17
18
 
18
- import {displayAsLabel, getEnumEntries} from "../../utils";
19
+ import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
19
20
 
20
21
  export default defineComponent({
21
22
  components: {
@@ -14,9 +14,10 @@ import { computed, defineComponent, type PropType } from "vue";
14
14
 
15
15
  import {FilterType} from "@dative-gpi/foundation-shared-domain/enums";
16
16
 
17
- import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
17
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
18
+ import { filterTypeLabel } from "@dative-gpi/foundation-shared-components/tools";
18
19
 
19
- import {filterTypeLabel, getEnumEntries} from "../../utils";
20
+ import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
20
21
 
21
22
  export default defineComponent({
22
23
  components: {
@@ -13,9 +13,11 @@ import { computed, defineComponent, type PropType } from "vue";
13
13
 
14
14
  import {HeatmapRule} from "@dative-gpi/foundation-shared-domain/enums";
15
15
 
16
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
17
+ import { heatmapRuleLabel } from "@dative-gpi/foundation-shared-components/tools";
18
+
16
19
  import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
17
20
 
18
- import {heatmapRuleLabel, getEnumEntries} from "../../utils";
19
21
 
20
22
  export default defineComponent({
21
23
  components: {
@@ -13,9 +13,11 @@ import { computed, defineComponent, type PropType } from "vue";
13
13
 
14
14
  import {OperationOn} from "@dative-gpi/foundation-shared-domain/enums";
15
15
 
16
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
17
+ import { operationOnLabel} from "@dative-gpi/foundation-shared-components/tools";
18
+
16
19
  import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
17
20
 
18
- import {operationOnLabel, getEnumEntries} from "../../utils";
19
21
 
20
22
  export default defineComponent({
21
23
  components: {
@@ -13,9 +13,11 @@ import { computed, defineComponent, type PropType } from "vue";
13
13
 
14
14
  import {PlanningType} from "@dative-gpi/foundation-shared-domain/enums";
15
15
 
16
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
17
+ import { planningTypeLabel } from "@dative-gpi/foundation-shared-components/tools";
18
+
16
19
  import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
17
20
 
18
- import {planningTypeLabel, getEnumEntries} from "../../utils";
19
21
 
20
22
  export default defineComponent({
21
23
  components: {
@@ -13,9 +13,10 @@ import { computed, defineComponent, type PropType } from "vue";
13
13
 
14
14
  import {PlotPer} from "@dative-gpi/foundation-shared-domain/enums";
15
15
 
16
- import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
16
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
17
+ import { plotPerLabel } from "@dative-gpi/foundation-shared-components/tools";
17
18
 
18
- import {plotPerLabel, getEnumEntries} from "../../utils";
19
+ import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
19
20
 
20
21
  export default defineComponent({
21
22
  components: {
@@ -13,9 +13,11 @@ import { computed, defineComponent, type PropType } from "vue";
13
13
 
14
14
  import {SerieType} from "@dative-gpi/foundation-shared-domain/enums";
15
15
 
16
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
17
+ import { serieTypeLabel } from "@dative-gpi/foundation-shared-components/tools";
18
+
16
19
  import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
17
20
 
18
- import {serieTypeLabel, getEnumEntries} from "../../utils";
19
21
 
20
22
  export default defineComponent({
21
23
  components: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-core-components",
3
3
  "sideEffects": false,
4
- "version": "1.0.87",
4
+ "version": "1.0.89",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -10,11 +10,11 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "@dative-gpi/foundation-core-domain": "1.0.87",
14
- "@dative-gpi/foundation-core-services": "1.0.87",
15
- "@dative-gpi/foundation-shared-components": "1.0.87",
16
- "@dative-gpi/foundation-shared-domain": "1.0.87",
17
- "@dative-gpi/foundation-shared-services": "1.0.87"
13
+ "@dative-gpi/foundation-core-domain": "1.0.89",
14
+ "@dative-gpi/foundation-core-services": "1.0.89",
15
+ "@dative-gpi/foundation-shared-components": "1.0.89",
16
+ "@dative-gpi/foundation-shared-domain": "1.0.89",
17
+ "@dative-gpi/foundation-shared-services": "1.0.89"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@dative-gpi/bones-ui": "^1.0.0",
@@ -26,5 +26,5 @@
26
26
  "sass": "1.71.1",
27
27
  "sass-loader": "13.3.2"
28
28
  },
29
- "gitHead": "180b62cf6fa6a72b6eff933df6f245c7cdc341db"
29
+ "gitHead": "9744715fd11929d7cd01e09aebe822283a6214e5"
30
30
  }
package/utils/index.ts CHANGED
@@ -1,4 +1,3 @@
1
- export * from "./charts";
2
1
  export * from "./dashboards";
3
2
  export * from "./roles";
4
3
  export * from "./users";
package/utils/charts.ts DELETED
@@ -1,137 +0,0 @@
1
- import { AggregationType, AxisType, ChartOrigin, DisplayAs, FilterType, HeatmapRule, OperationOn, PlanningType, PlotPer, SerieType } from "@dative-gpi/foundation-shared-domain/enums";
2
- import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui/composables";
3
- import { type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
4
-
5
- const { $tr } = useTranslationsProvider();
6
-
7
-
8
- export const chartOriginLabel = (type: ChartOrigin): string => {
9
- switch (type) {
10
- case ChartOrigin.None: return $tr("ui.chart-type.none", "None");
11
- case ChartOrigin.Organisation: return $tr("ui.chart-type.organisation", "Custom");
12
- case ChartOrigin.OrganisationType: return $tr("ui.chart-type.organisation-type", "Shared");
13
- }
14
- };
15
-
16
- export const chartOriginColor = (type: ChartOrigin): ColorBase => {
17
- switch (type) {
18
- case ChartOrigin.None: return ColorEnum.Error;
19
- case ChartOrigin.Organisation: return ColorEnum.Primary;
20
- case ChartOrigin.OrganisationType: return ColorEnum.Warning;
21
- }
22
- };
23
-
24
- export const aggregationTypeLabel = (aggregationType : AggregationType): string => {
25
- switch (aggregationType) {
26
- case AggregationType.Sum: return $tr("ui.common.sum", "Sum");
27
- case AggregationType.Cardinal: return $tr("ui.common.cardinal", "Cardinal");
28
- case AggregationType.Mean: return $tr("ui.common.mean", "Mean");
29
- case AggregationType.Median: return $tr("ui.common.median", "Median");
30
- case AggregationType.First: return $tr("ui.common.first", "First");
31
- case AggregationType.Last: return $tr("ui.common.last", "Last");
32
- case AggregationType.Difference: return $tr("ui.common.difference", "Difference");
33
- case AggregationType.Minimum: return $tr("ui.common.minimum", "Minimum");
34
- case AggregationType.Maximum: return $tr("ui.common.maximum", "Maximum");
35
- case AggregationType.Range: return $tr("ui.common.range", "Range");
36
- default : return $tr("ui.common.none", "None");
37
- }
38
- };
39
-
40
- export const axisTypeLabel = (axisType: AxisType | number): string => {
41
- switch (axisType) {
42
- case AxisType.Date: return $tr("ui.common.date", "Date");
43
- case AxisType.Value: return $tr("ui.common.value", "Value");
44
- case AxisType.Category: return $tr("ui.common.category", "Category");
45
- default: return $tr("ui.common.none", "None");
46
- }
47
- };
48
-
49
- export const displayAsLabel = (display: DisplayAs | number): string => {
50
- switch (display) {
51
- case DisplayAs.Bars: return $tr("ui.common.bars", "Bars");
52
- case DisplayAs.Lines: return $tr("ui.common.lines", "Lines");
53
- case DisplayAs.Points: return $tr("ui.common.point", "Points");
54
- default: return $tr("ui.common.none", "None");
55
- }
56
- };
57
-
58
- export const filterTypeLabel = (filterType: FilterType | number): string => {
59
- switch (filterType) {
60
- case FilterType.Contains: return $tr("ui.common.contains", "contains");
61
- case FilterType.Different: return "≠";
62
- case FilterType.EndsWith: return $tr("ui.common.ends-with", "ends with") ;
63
- case FilterType.Equal: return "=";
64
- case FilterType.Less: return "<";
65
- case FilterType.LessOrEqual: return "≤";
66
- case FilterType.More: return ">";
67
- case FilterType.MoreOrEqual: return "≥";
68
- case FilterType.StartsWith: return $tr("ui.common.starts-with", "start with");
69
- default: return $tr("ui.common.none", "None");
70
- }
71
- };
72
-
73
- export const heatmapRuleLabel = (heatMap: HeatmapRule | number): string => {
74
- switch (heatMap) {
75
- case HeatmapRule.Gradient: return $tr("ui.common.gradient", "Gradient");
76
- case HeatmapRule.Ranges: return $tr("ui.common.ranges", "Ranges");
77
- case HeatmapRule.Fixed : return $tr("ui.common.fixed", "Fixed");
78
- default: return $tr("ui.common.none", "None");
79
- }
80
- };
81
-
82
- export const operationOnLabel = (operationOn: OperationOn | number): string => {
83
- switch (operationOn) {
84
- case OperationOn.SameEntity: return $tr("ui.common.same-entity", "Same entity");
85
- case OperationOn.SameGroup: return $tr("ui.common.same-group", "Same group");
86
- case OperationOn.SameGroupAndEntity: return $tr("ui.common.same-group-entity", "Same group and entity");
87
- default: return $tr("ui.common.none", "None");
88
- }
89
- };
90
-
91
- export const planningTypeLabel = (planningType : PlanningType | number): string => {
92
- switch (planningType) {
93
- case PlanningType.UntilNext: return $tr("ui.common.until-next", "Until next");
94
- case PlanningType.ElapsedTime: return $tr("ui.common.elapsed-time", "Elapsed time");
95
- case PlanningType.SinglePoint: return $tr("ui.common.single-point", "Single point");
96
- default: return $tr("ui.common.none", "None");
97
- }
98
- };
99
-
100
- export const plotPerLabel = (plotper: PlotPer | number): string => {
101
- switch (plotper) {
102
- case PlotPer.SinglePlot: return $tr("ui.common.single-slot", "Single slot");
103
- case PlotPer.Model: return $tr("ui.common.model", "Model");
104
- case PlotPer.Group: return $tr("ui.common.group", "Group");
105
- case PlotPer.Location: return $tr("ui.common.location", "Location");
106
- case PlotPer.Device: return $tr("ui.common.device", "Device");
107
- default: return $tr("ui.common.none", "None");
108
- }
109
- };
110
-
111
- export const serieTypeLabel = (serieType : SerieType): string => {
112
- switch (serieType) {
113
- case SerieType.Lines: return $tr("ui.common.lines", "Lines");
114
- case SerieType.Area: return $tr("ui.common.area", "Area");
115
- case SerieType.Range: return $tr("ui.common.range", "Range");
116
- case SerieType.Histogram: return $tr("ui.common.histogram", "Histogram");
117
- case SerieType.Operation: return $tr("ui.common.operation", "Operation");
118
- case SerieType.Planning: return $tr("ui.common.planning", "Planning");
119
- case SerieType.ScatterPlot: return $tr("ui.common.scatter-plot", "Scatter plot");
120
- case SerieType.Top: return $tr("ui.common.top", "Top");
121
- case SerieType.Bars: return $tr("ui.common.bars", "Bars");
122
- case SerieType.StackedBars: return $tr("ui.common.stacked-bars", "Stacked bars");
123
- case SerieType.Pie: return $tr("ui.common.pie", "Pie");
124
- case SerieType.Heatmap: return $tr('ui.common.heatmap', 'Heatmap');
125
- case SerieType.Slider: return $tr("ui.common.slider", "Slider");
126
- case SerieType.Gauge: return $tr("ui.common.gauge", "Gauge");
127
- case SerieType.ScoreCard: return $tr("ui.common.score-card", "Score card");
128
- case SerieType.Table: return $tr("ui.common.table", "Table");
129
- default: return "";
130
- }
131
- };
132
-
133
- export const getEnumEntries = (e: any) => {
134
- return Object.keys(e)
135
- .filter(key => isNaN(Number(key)))
136
- .map(key => ({key : key, value : e[key]}));
137
- };