@dative-gpi/foundation-shared-components 1.1.4 → 1.1.6

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.
@@ -1,58 +1,156 @@
1
1
  <template>
2
2
  <FSWrapGroup
3
- v-if="$props.variant === 'wrap'"
3
+ v-if="$props.variant == ChipGroupVariants.Wrap"
4
4
  v-bind="$attrs"
5
5
  >
6
- <FSChip
7
- v-for="(label, index) in $props.labels"
6
+ <template
7
+ v-for="(item, index) in $props.items"
8
8
  :key="index"
9
- :variant="$props.chipVariant"
10
- :color="$props.color"
11
- :label="label"
12
- />
9
+ >
10
+ <slot
11
+ name="item.chip"
12
+ v-bind="{ index, item }"
13
+ >
14
+ <FSChip
15
+ :variant="$props.chipVariant"
16
+ :color="$props.color"
17
+ :label="item.label ?? item"
18
+ />
19
+ </slot>
20
+ </template>
13
21
  <slot />
14
22
  </FSWrapGroup>
15
23
  <FSSlideGroup
16
- v-if="$props.variant === 'slide'"
24
+ v-else-if="$props.variant == ChipGroupVariants.Slide"
17
25
  v-bind="$attrs"
18
26
  >
19
- <FSChip
20
- v-for="(label, index) in $props.labels"
27
+ <template
28
+ v-for="(item, index) in $props.items"
21
29
  :key="index"
22
- :variant="$props.chipVariant"
23
- :color="$props.color"
24
- :label="label"
25
- />
30
+ >
31
+ <slot
32
+ name="item.chip"
33
+ v-bind="{ index, item }"
34
+ >
35
+ <FSChip
36
+ :variant="$props.chipVariant"
37
+ :color="$props.color"
38
+ :label="item.label ?? item"
39
+ />
40
+ </slot>
41
+ </template>
26
42
  <slot />
27
43
  </FSSlideGroup>
44
+ <FSRow
45
+ v-else-if="$props.variant == ChipGroupVariants.Menu && $props.items"
46
+ :wrap="false"
47
+ >
48
+ <template
49
+ v-for="(item, index) in $props.items.slice(0, $props.maxItems ?? $props.items.length)"
50
+ :key="index"
51
+ >
52
+ <slot
53
+ name="item.chip"
54
+ v-bind="{ index, item }"
55
+ >
56
+ <FSChip
57
+ :variant="$props.chipVariant"
58
+ :color="$props.color"
59
+ :label="item.label ?? item"
60
+ />
61
+ </slot>
62
+ </template>
63
+ <FSMenu
64
+ v-if="$props.maxItems && $props.items.length > $props.maxItems"
65
+ location="bottom end"
66
+ v-model="menuOpen"
67
+ >
68
+ <template
69
+ #activator="{ props: activatorProps }"
70
+ >
71
+ <FSChip
72
+ v-bind="activatorProps"
73
+ variant="full"
74
+ :label="`+${$props.items.length - $props.maxItems}`"
75
+ :color="menuActivatorColor"
76
+ :clickable="true"
77
+ />
78
+ </template>
79
+ <FSCard
80
+ padding="16px 24px"
81
+ >
82
+ <template
83
+ #top-right
84
+ >
85
+ <FSButton
86
+ icon="mdi-close"
87
+ variant="icon"
88
+ iconSize="18px"
89
+ :color="ColorEnum.Dark"
90
+ @click="menuOpen = false"
91
+ />
92
+ </template>
93
+ <FSCol
94
+ gap="12px"
95
+ >
96
+ <template
97
+ v-for="(item, index) in $props.items"
98
+ :key="index"
99
+ >
100
+ <slot
101
+ name="item.chip"
102
+ v-bind="{ index, item }"
103
+ >
104
+ <FSChip
105
+ :variant="$props.chipVariant"
106
+ :color="$props.color"
107
+ :label="item.label ?? item"
108
+ />
109
+ </slot>
110
+ </template>
111
+ </FSCol>
112
+ </FSCard>
113
+ </FSMenu>
114
+ <slot />
115
+ </FSRow>
28
116
  </template>
29
117
 
30
118
  <script lang="ts">
31
- import { defineComponent, type PropType } from "vue";
119
+ import { defineComponent, ref, type PropType, computed } from "vue";
32
120
 
33
- import { type CardVariant, CardVariants, type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
121
+ import { type CardVariant, CardVariants, type ChipGroupVariant, ChipGroupVariants, type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
34
122
 
35
123
  import FSSlideGroup from "./FSSlideGroup.vue";
36
124
  import FSWrapGroup from "./FSWrapGroup.vue";
125
+ import FSButton from "./FSButton.vue";
37
126
  import FSChip from "./FSChip.vue";
127
+ import FSCard from "./FSCard.vue";
128
+ import FSMenu from "./FSMenu.vue";
129
+ import FSCol from "./FSCol.vue";
130
+
131
+ import { useColors } from "../composables";
38
132
 
39
133
  export default defineComponent({
40
134
  name: "FSChipGroup",
41
135
  components: {
42
136
  FSSlideGroup,
43
137
  FSWrapGroup,
44
- FSChip
138
+ FSButton,
139
+ FSChip,
140
+ FSCard,
141
+ FSMenu,
142
+ FSCol
45
143
  },
46
144
  props: {
47
- labels: {
48
- type: Array as PropType<string[]>,
145
+ items: {
146
+ type: Array as PropType<any[] | string[]>,
49
147
  required: false,
50
148
  default: () => []
51
149
  },
52
150
  variant: {
53
- type: String as PropType<"wrap" | "slide">,
151
+ type: String as PropType<ChipGroupVariant>,
54
152
  required: false,
55
- default: "wrap"
153
+ default: ChipGroupVariants.Wrap
56
154
  },
57
155
  chipVariant: {
58
156
  type: String as PropType<CardVariant>,
@@ -63,7 +161,27 @@ export default defineComponent({
63
161
  type: String as PropType<ColorBase>,
64
162
  required: false,
65
163
  default: ColorEnum.Light
164
+ },
165
+ maxItems: {
166
+ type: Number as PropType<number | null>,
167
+ required: false,
168
+ default: null
66
169
  }
170
+ },
171
+ setup(props) {
172
+ const { getColors } = useColors();
173
+ const menuOpen = ref(false);
174
+
175
+ const menuActivatorColor = computed((): string => {
176
+ return getColors(props.color).dark;
177
+ });
178
+
179
+ return {
180
+ menuActivatorColor,
181
+ ChipGroupVariants,
182
+ ColorEnum,
183
+ menuOpen
184
+ };
67
185
  }
68
186
  });
69
187
  </script>
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <FSChip
3
+ :height="$props.height"
4
+ :width="$props.width"
5
+ :variant="$props.variant"
6
+ :color="chipColor"
7
+ :disableHoverStyle="$props.disableHoverStyle"
8
+ >
9
+ <FSRow
10
+ align="center-center"
11
+ width="hug"
12
+ :wrap="false"
13
+ >
14
+ <FSRow
15
+ align="center-center"
16
+ width="hug"
17
+ gap="6px"
18
+ :wrap="false"
19
+ >
20
+ <FSIcon
21
+ :color="$props.iconColor"
22
+ :size="$props.iconSize"
23
+ >
24
+ {{ $props.icon }}
25
+ </FSIcon>
26
+ <FSText
27
+ font="text-overline"
28
+ :color="textColor"
29
+ >
30
+ {{ $props.label }}
31
+ </FSText>
32
+ </FSRow>
33
+ </FSRow>
34
+ </FSChip>
35
+ </template>
36
+
37
+ <script lang="ts">
38
+ import { defineComponent, type PropType } from "vue";
39
+
40
+ import { type CardVariant, CardVariants, type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
41
+
42
+ import FSIcon from "./FSIcon.vue";
43
+ import FSText from "./FSText.vue";
44
+ import FSChip from "./FSChip.vue";
45
+ import FSRow from "./FSRow.vue";
46
+
47
+ import { useColors } from "../composables";
48
+
49
+ export default defineComponent({
50
+ name: "FSSubgroupingChip",
51
+ components: {
52
+ FSChip,
53
+ FSIcon,
54
+ FSText,
55
+ FSRow
56
+ },
57
+ inheritAttrs: false,
58
+ props: {
59
+ label: {
60
+ type: String as PropType<string>,
61
+ required: true
62
+ },
63
+ icon: {
64
+ type: String as PropType<string>,
65
+ required: true
66
+ },
67
+ iconColor: {
68
+ type: String as PropType<ColorBase>,
69
+ required: false,
70
+ default: ColorEnum.Dark
71
+ },
72
+ height: {
73
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
74
+ required: false,
75
+ default: () => [24, 20]
76
+ },
77
+ width: {
78
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
79
+ required: false,
80
+ default: "hug"
81
+ },
82
+ color: {
83
+ type: String as PropType<ColorBase>,
84
+ required: false,
85
+ default: ColorEnum.Light
86
+ },
87
+ variant: {
88
+ type: String as PropType<CardVariant>,
89
+ required: false,
90
+ default: CardVariants.Background
91
+ },
92
+ iconSize: {
93
+ type: [Array, String, Number] as PropType<"s" | "m" | "l" | string[] | number[] | string | number | null>,
94
+ required: false,
95
+ default: "18px"
96
+ },
97
+ disableHoverStyle: {
98
+ type: Boolean,
99
+ required: false,
100
+ default: true
101
+ }
102
+ },
103
+ setup(props) {
104
+ const { getColors } = useColors();
105
+
106
+ const chipColor = getColors(props.color).dark;
107
+ const textColor = getColors(ColorEnum.Dark).dark;
108
+
109
+ return {
110
+ chipColor,
111
+ textColor,
112
+ ColorEnum
113
+ };
114
+ }
115
+ });
116
+ </script>
@@ -0,0 +1,138 @@
1
+ <template>
2
+ <FSChip
3
+ :color="chipColor"
4
+ :width="$props.width"
5
+ :height="$props.height"
6
+ :variant="$props.variant"
7
+ :disableHoverStyle="$props.disableHoverStyle"
8
+ :title="`${$props.groupingLabel} - ${$props.label}`"
9
+ >
10
+ <FSRow
11
+ align="center-left"
12
+ width="fill"
13
+ :wrap="false"
14
+ >
15
+ <FSRow
16
+ align="center-center"
17
+ width="hug"
18
+ gap="6px"
19
+ :wrap="false"
20
+ >
21
+ <FSIcon
22
+ :color="$props.groupingColor"
23
+ :size="$props.iconSize"
24
+ >
25
+ {{ $props.groupingIcon }}
26
+ </FSIcon>
27
+ <FSSpan
28
+ font="text-overline"
29
+ >
30
+ {{ $props.groupingLabel }}
31
+ </FSSpan>
32
+ </FSRow>
33
+ <FSRow
34
+ align="center-center"
35
+ width="hug"
36
+ gap="6px"
37
+ :wrap="false"
38
+ >
39
+ <FSIcon
40
+ :size="$props.iconSize"
41
+ >
42
+ {{ $props.icon }}
43
+ </FSIcon>
44
+ <FSSpan
45
+ font="text-overline"
46
+ >
47
+ {{ $props.label }}
48
+ </FSSpan>
49
+ </FSRow>
50
+ </FSRow>
51
+ </FSChip>
52
+ </template>
53
+
54
+ <script lang="ts">
55
+ import { defineComponent, type PropType } from "vue";
56
+
57
+ import { type CardVariant, CardVariants, type ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
58
+
59
+ import FSIcon from "./FSIcon.vue";
60
+ import FSSpan from "./FSSpan.vue";
61
+ import FSChip from "./FSChip.vue";
62
+ import FSRow from "./FSRow.vue";
63
+
64
+ import { useColors } from "../composables";
65
+
66
+ export default defineComponent({
67
+ name: "FSSubgroupingChip",
68
+ components: {
69
+ FSChip,
70
+ FSIcon,
71
+ FSSpan,
72
+ FSRow
73
+ },
74
+ props: {
75
+ groupingLabel: {
76
+ type: String as PropType<string>,
77
+ required: true
78
+ },
79
+ groupingIcon: {
80
+ type: String as PropType<string>,
81
+ required: true
82
+ },
83
+ groupingColor: {
84
+ type: String as PropType<ColorBase>,
85
+ required: false,
86
+ default: ColorEnum.Dark
87
+ },
88
+ label: {
89
+ type: String as PropType<string>,
90
+ required: true
91
+ },
92
+ icon: {
93
+ type: String as PropType<string>,
94
+ required: true
95
+ },
96
+ height: {
97
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
98
+ required: false,
99
+ default: () => [24, 20]
100
+ },
101
+ width: {
102
+ type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
103
+ required: false,
104
+ default: "hug"
105
+ },
106
+ variant: {
107
+ type: String as PropType<CardVariant>,
108
+ required: false,
109
+ default: CardVariants.Background
110
+ },
111
+ color: {
112
+ type: String as PropType<ColorBase>,
113
+ required: false,
114
+ default: ColorEnum.Light
115
+ },
116
+ iconSize: {
117
+ type: [Array, String, Number] as PropType<"s" | "m" | "l" | string[] | number[] | string | number | null>,
118
+ required: false,
119
+ default: "18px"
120
+ },
121
+ disableHoverStyle: {
122
+ type: Boolean,
123
+ required: false,
124
+ default: true
125
+ }
126
+ },
127
+ setup(props) {
128
+ const { getColors } = useColors();
129
+
130
+ const chipColor = getColors(props.color).dark;
131
+
132
+ return {
133
+ chipColor,
134
+ ColorEnum
135
+ };
136
+ }
137
+ });
138
+ </script>
@@ -233,6 +233,14 @@ export default defineComponent({
233
233
  {
234
234
  id: EntityType.Folder,
235
235
  label: $tr("ui.common.folders", "Folders")
236
+ },
237
+ {
238
+ id: EntityType.Grouping,
239
+ label: $tr("ui.common.groupings", "Groupings")
240
+ },
241
+ {
242
+ id: EntityType.Subgrouping,
243
+ label: $tr("ui.common.subgroupings", "Subgroupings")
236
244
  }
237
245
  ];
238
246
 
@@ -259,6 +267,10 @@ export default defineComponent({
259
267
  return "mdi-view-dashboard";
260
268
  case EntityType.Folder:
261
269
  return "mdi-folder";
270
+ case EntityType.Grouping:
271
+ return "mdi-chart-donut";
272
+ case EntityType.Subgrouping:
273
+ return "mdi-shape-outline";
262
274
  default:
263
275
  return "mdi-cube";
264
276
  }
@@ -97,6 +97,14 @@
97
97
  :filters="filters[header.value]"
98
98
  @update:filter="(value) => toggleFilter(header.value, value)"
99
99
  >
100
+ <template
101
+ #custom="{ filter, toggle, variant }"
102
+ >
103
+ <slot
104
+ :name="`${filterSlot(header)}-custom`"
105
+ v-bind="{ filter, toggle, variant }"
106
+ />
107
+ </template>
100
108
  <template
101
109
  #default="{ filter }"
102
110
  >
@@ -57,27 +57,35 @@
57
57
  <FSCol
58
58
  gap="6px"
59
59
  >
60
- <FSChip
60
+ <template
61
61
  v-for="(filter, index) in searchedFilters"
62
- class="fs-filter-button-chip"
63
- :variant="getVariant(filter)"
64
- :height="['30px', '24px']"
65
- :color="$props.color"
66
- :label="filter.text"
67
- align="center-left"
68
- :clickable="true"
69
- :border="false"
70
62
  :key="index"
71
- @click="() => onToggle(filter)"
72
63
  >
73
- <template
74
- #default
64
+ <slot
65
+ name="custom"
66
+ v-bind="{ filter, toggle: () => onToggle(filter), variant: getVariant(filter) }"
75
67
  >
76
- <slot
77
- v-bind="{ filter }"
78
- />
79
- </template>
80
- </FSChip>
68
+ <FSChip
69
+ class="fs-filter-button-chip"
70
+ :variant="getVariant(filter)"
71
+ :height="['30px', '24px']"
72
+ :color="$props.color"
73
+ :label="filter.text"
74
+ align="center-left"
75
+ :clickable="true"
76
+ :border="false"
77
+ @click="() => onToggle(filter)"
78
+ >
79
+ <template
80
+ #default
81
+ >
82
+ <slot
83
+ v-bind="{ filter }"
84
+ />
85
+ </template>
86
+ </FSChip>
87
+ </slot>
88
+ </template>
81
89
  </FSCol>
82
90
  </FSFadeOut>
83
91
  </FSCol>
@@ -0,0 +1,46 @@
1
+ <template>
2
+ <FSSimpleTileUI
3
+ :bottomColor="null"
4
+ v-bind="$attrs"
5
+ >
6
+ <template
7
+ #append-info
8
+ >
9
+ <FSEntityCountBadge
10
+ :label="$tr('ui.common.equipments', 'Équipements')"
11
+ :count="$props.deviceOrganisationsCount ?? 0"
12
+ :color="ColorEnum.Primary"
13
+ />
14
+ </template>
15
+ </FSSimpleTileUI>
16
+ </template>
17
+
18
+ <script lang="ts">
19
+ import { defineComponent } from "vue";
20
+
21
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
22
+
23
+ import FSEntityCountBadge from "./FSEntityCountBadge.vue";
24
+ import FSSimpleTileUI from './FSSimpleTileUI.vue';
25
+
26
+ export default defineComponent({
27
+ name: "FSSubgroupingTileUI",
28
+ components: {
29
+ FSSimpleTileUI,
30
+ FSEntityCountBadge
31
+ },
32
+ props: {
33
+ deviceOrganisationsCount: {
34
+ type: Number,
35
+ required: false,
36
+ default: null
37
+ }
38
+ },
39
+ inheritAttrs: false,
40
+ setup() {
41
+ return {
42
+ ColorEnum,
43
+ };
44
+ }
45
+ });
46
+ </script>
package/models/tables.ts CHANGED
@@ -26,6 +26,7 @@ export interface FSDataTableFilter {
26
26
  text: string;
27
27
  value: string;
28
28
  hidden: boolean;
29
+ custom?: boolean;
29
30
  filter?: ((value: any, property: any, item: any) => boolean) | null;
30
31
  }
31
32
 
@@ -23,4 +23,11 @@ export enum DialogMultiFormModes {
23
23
  Pagination = "pagination",
24
24
  Tabs = "tabs",
25
25
  Hidden = "hidden"
26
+ }
27
+
28
+ export type ChipGroupVariant = "wrap" | "slide" | "menu";
29
+ export enum ChipGroupVariants {
30
+ Wrap = "wrap",
31
+ Slide = "slide",
32
+ Menu = "menu"
26
33
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "url": "https://github.com/Dative-GPI/foundation-shared-ui.git"
5
5
  },
6
6
  "sideEffects": false,
7
- "version": "1.1.4",
7
+ "version": "1.1.6",
8
8
  "description": "",
9
9
  "publishConfig": {
10
10
  "access": "public"
@@ -13,8 +13,8 @@
13
13
  "author": "",
14
14
  "license": "ISC",
15
15
  "dependencies": {
16
- "@dative-gpi/foundation-shared-domain": "1.1.4",
17
- "@dative-gpi/foundation-shared-services": "1.1.4"
16
+ "@dative-gpi/foundation-shared-domain": "1.1.6",
17
+ "@dative-gpi/foundation-shared-services": "1.1.6"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@dative-gpi/bones-ui": "^1.0.0",
@@ -38,5 +38,5 @@
38
38
  "sass": "1.71.1",
39
39
  "sass-loader": "13.3.2"
40
40
  },
41
- "gitHead": "a9b44d2e225cc899966d6ccfa1f0d14df9c50273"
41
+ "gitHead": "6e1d16c39cd615e25ac4e991c4489209ef223722"
42
42
  }
@@ -1,5 +1,10 @@
1
1
  .fs-filter-button-menu {
2
- width: 300px;
2
+ max-width: 400px;
3
+ overflow: hidden;
4
+ }
5
+
6
+ .fs-filter-button-menu * {
7
+ min-width: 0;
3
8
  }
4
9
 
5
10
  .fs-filter-button-chip {