@ouestfrance/sipa-bms-ui 8.5.4 → 8.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouestfrance/sipa-bms-ui",
3
- "version": "8.5.4",
3
+ "version": "8.6.0",
4
4
  "author": "Ouest-France BMS",
5
5
  "license": "ISC",
6
6
  "scripts": {
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@chromatic-com/storybook": "^4.0.0",
33
- "@codemirror/lang-html": "6.4.9",
33
+ "@codemirror/lang-html": "6.4.10",
34
34
  "@codemirror/lang-json": "6.0.2",
35
35
  "@commitlint/cli": "19.8.1",
36
36
  "@commitlint/config-conventional": "19.8.1",
@@ -40,39 +40,39 @@
40
40
  "@storybook/addon-links": "9.1.5",
41
41
  "@storybook/vue3-vite": "9.1.5",
42
42
  "@types/lodash": "4.17.20",
43
- "@types/uuid": "10.0.0",
43
+ "@types/uuid": "11.0.0",
44
44
  "@vitejs/plugin-vue": "6.0.1",
45
45
  "@vue/test-utils": "2.4.6",
46
46
  "@vueuse/core": "13.9.0",
47
47
  "@vueuse/motion": "^3.0.0",
48
- "axios": "1.11.0",
48
+ "axios": "1.12.2",
49
49
  "blob-util": "^2.0.2",
50
50
  "chromatic": "13.1.4",
51
51
  "codemirror": "6.0.2",
52
52
  "cors": "^2.8.5",
53
53
  "cross-env": "^10.0.0",
54
54
  "cy2": "^4.0.0",
55
- "cypress": "15.1.0",
55
+ "cypress": "15.2.0",
56
56
  "express": "^5.0.0",
57
57
  "husky": "9.1.7",
58
- "jsdom": "26.1.0",
58
+ "jsdom": "27.0.0",
59
59
  "keycloak-js": "26.1.2",
60
60
  "lint-staged": "16.1.6",
61
61
  "lodash": "4.17.21",
62
- "lucide-vue-next": "0.542.0",
62
+ "lucide-vue-next": "0.544.0",
63
63
  "msw-storybook-addon": "^2.0.3",
64
64
  "normalize.css": "8.0.1",
65
65
  "path": "0.12.7",
66
66
  "prettier": "3.6.2",
67
67
  "sass": "1.92.1",
68
- "semantic-release": "24.2.7",
68
+ "semantic-release": "24.2.8",
69
69
  "start-server-and-test": "2.1.0",
70
70
  "storybook": "9.1.5",
71
71
  "storybook-addon-pseudo-states": "9.1.5",
72
72
  "storybook-vue3-router": "^6.0.2",
73
73
  "typescript": "5.2.2",
74
- "uuid": "11.1.0",
75
- "vite": "7.1.4",
74
+ "uuid": "13.0.0",
75
+ "vite": "7.1.5",
76
76
  "vite-plugin-dts": "^4.1.0",
77
77
  "vite-plugin-mkcert": "1.17.8",
78
78
  "vite-plugin-pages": "0.33.1",
@@ -82,7 +82,7 @@
82
82
  "vue-codemirror": "6.1.1",
83
83
  "vue-loader": "17.4.2",
84
84
  "vue-router": "4.5.1",
85
- "vue-tsc": "3.0.6"
85
+ "vue-tsc": "3.0.7"
86
86
  },
87
87
  "files": [
88
88
  "dist",
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <BmsSelect
3
- v-model:open="open"
4
3
  v-bind="$props"
4
+ :options="displayedOptions"
5
5
  :model-value="modelValue"
6
6
  @update:model-value="onSelect"
7
7
  >
@@ -59,7 +59,6 @@ const searching = ref('');
59
59
  const modelValue = defineModel<InputOption[]>('modelValue', {
60
60
  required: true,
61
61
  });
62
- const open = defineModel<boolean>('open', { default: false });
63
62
 
64
63
  const onSelect = (value: string) => {
65
64
  const option = props.options.find((o) => o.value === value);
@@ -1,6 +1,7 @@
1
1
  import UiBmsTable from '@/components/table/UiBmsTable.vue';
2
2
  import { Save, Trash } from 'lucide-vue-next';
3
3
  import BmsIconButton from '@/components/button/BmsIconButton.vue';
4
+ import { ColumnType } from '@/models/table.model';
4
5
 
5
6
  import template from '@/documentation/template_internal_component.mdx';
6
7
 
@@ -379,6 +380,42 @@ SelectableDisabled.args = {
379
380
  selectableDisabled: true,
380
381
  totalSize: 2,
381
382
  };
383
+ export const Typed = Template.bind({});
384
+ Typed.args = {
385
+ headers: [
386
+ {
387
+ label: 'Column boolean',
388
+ key: 'col1',
389
+ align: 'start',
390
+ columnType: ColumnType.Boolean,
391
+ },
392
+ {
393
+ label: 'Column date',
394
+ key: 'col2',
395
+ align: 'center',
396
+ columnType: ColumnType.Date,
397
+ },
398
+ {
399
+ label: 'Column 3',
400
+ key: 'col3',
401
+ align: 'end',
402
+ },
403
+ ],
404
+ items: [
405
+ {
406
+ col1: true,
407
+ col2: '2024-10-10T12:00:00Z',
408
+ col3: 'Value3',
409
+ },
410
+ {
411
+ col1: false,
412
+ col2: '2025-01-01T18:00:00Z',
413
+ col3: 'Value3',
414
+ },
415
+ ],
416
+ hasFilters: true,
417
+ totalSize: 2,
418
+ };
382
419
 
383
420
  const TemplateWithActionColumn = (args) => ({
384
421
  components: {
@@ -0,0 +1,25 @@
1
+ <template>
2
+ <template v-if="cell.columnType === ColumnType.Boolean">
3
+ <BmsChip v-if="cellValue" :color="ChipColor.Green">Oui</BmsChip>
4
+ <BmsChip v-else>Non</BmsChip>
5
+ </template>
6
+ <template v-else-if="cell.columnType === ColumnType.Date">
7
+ <BmsRelativeTime :relativeTo="relativeToTime" />
8
+ </template>
9
+ <template v-else>
10
+ {{ cellValue }}
11
+ </template>
12
+ </template>
13
+
14
+ <script setup lang="ts">
15
+ import { ChipColor, ColumnType, TableHeader } from '@/models';
16
+ import _get from 'lodash/get';
17
+ import BmsChip from '../form/BmsChip.vue';
18
+ import { computed } from 'vue';
19
+ import BmsRelativeTime from '../utils/BmsRelativeTime.vue';
20
+
21
+ const props = defineProps<{ cell: TableHeader; item: any }>();
22
+
23
+ const cellValue = computed(() => _get(props.item, props.cell.key) ?? '');
24
+ const relativeToTime = computed(() => new Date(cellValue.value)?.getTime());
25
+ </script>
@@ -1,4 +1,5 @@
1
1
  import UiBmsTableRow from '@/components/table/UiBmsTableRow.vue';
2
+ import { ColumnType } from '@/models/table.model';
2
3
 
3
4
  export default {
4
5
  title: 'Composants/table/UiBmsTableRow',
@@ -141,3 +142,32 @@ IsChildElement.args = {
141
142
  },
142
143
  },
143
144
  };
145
+
146
+ export const Typed = Template.bind({});
147
+ Typed.args = {
148
+ headers: [
149
+ {
150
+ label: 'Column boolean',
151
+ key: 'col1',
152
+ align: 'start',
153
+ columnType: ColumnType.Boolean,
154
+ },
155
+ {
156
+ label: 'Column date',
157
+ key: 'col2',
158
+ align: 'center',
159
+ columnType: ColumnType.Date,
160
+ },
161
+ {
162
+ label: 'Column 3',
163
+ key: 'col3',
164
+ align: 'end',
165
+ },
166
+ ],
167
+ selectedItems: [],
168
+ item: {
169
+ col1: true,
170
+ col2: '2022-01-01',
171
+ col3: 'Value3',
172
+ },
173
+ };
@@ -37,7 +37,7 @@
37
37
  :row="item.childElement"
38
38
  :isChildElement="isChildElement"
39
39
  >
40
- {{ _get(item.childElement, cell.key) || '' }}
40
+ <UiBmsTableCell :item="item.childElement" :cell="cell" />
41
41
  </slot>
42
42
  </div>
43
43
  <div v-else-if="cell?.action" class="bms-table__row__cell--action">
@@ -53,7 +53,7 @@
53
53
  :row="item"
54
54
  :isChildElement="isChildElement"
55
55
  >
56
- {{ _get(item, cell.key) || '' }}
56
+ <UiBmsTableCell :item="item" :cell="cell" />
57
57
  </slot>
58
58
  </td>
59
59
  </slot>
@@ -68,6 +68,7 @@ import _get from 'lodash/get';
68
68
  import UiBmsInputCheckbox from '../form/UiBmsInputCheckbox.vue';
69
69
  import BmsTooltip from '../feedback/BmsTooltip.vue';
70
70
  import { CornerDownRight } from 'lucide-vue-next';
71
+ import UiBmsTableCell from './UiBmsTableCell.vue';
71
72
 
72
73
  interface Props {
73
74
  item: any;
@@ -25,7 +25,7 @@ const timeout = ref<any>();
25
25
  const date = ref<string>();
26
26
 
27
27
  const formattedDate = computed(() => {
28
- return new Date(props.relativeTo).toLocaleString();
28
+ return new Date(props.relativeTo)?.toLocaleString() ?? '';
29
29
  });
30
30
 
31
31
  onMounted(() => {
@@ -1,6 +1,12 @@
1
1
  import { InputType } from './form.model';
2
2
  import { Sort, SortFunction } from './sort.model';
3
3
 
4
+ export enum ColumnType {
5
+ Boolean = 'Boolean',
6
+ Date = 'Date',
7
+ String = 'String',
8
+ }
9
+
4
10
  export interface TableHeader {
5
11
  label: string;
6
12
  key: string;
@@ -10,6 +16,7 @@ export interface TableHeader {
10
16
  sortable?: boolean;
11
17
  sortFunction?: SortFunction;
12
18
  action?: boolean;
19
+ columnType?: ColumnType;
13
20
  }
14
21
 
15
22
  export interface ServerTableRequestParams {
@@ -14,21 +14,6 @@
14
14
  @saveFilter="onSaveFilter"
15
15
  @deleteSavedFilter="onDeleteSavedFilter"
16
16
  >
17
- <template #date="{ row }">
18
- <bms-tooltip :tooltip-text="row.date.toUTCString()">
19
- {{ row.date.toLocaleDateString() }}
20
- </bms-tooltip>
21
- </template>
22
- <template #dateUpdate="{ row }">
23
- <bms-tooltip :tooltip-text="row.dateUpdate.toUTCString()">
24
- {{ row.dateUpdate.toLocaleDateString() }}
25
- </bms-tooltip>
26
- </template>
27
- <template #dateDelete="{ row }">
28
- <bms-tooltip :tooltip-text="row.dateDelete.toUTCString()">
29
- {{ row.dateDelete.toLocaleDateString() }}
30
- </bms-tooltip>
31
- </template>
32
17
  <template #choice2="{ row }">
33
18
  <BmsTooltip tooltipText="tooltip">
34
19
  {{ row.choice2 }}
@@ -65,6 +50,7 @@
65
50
  <script lang="ts" setup>
66
51
  import { BmsBackButton, BmsButton, useNotifications } from '@/index';
67
52
  import {
53
+ ColumnType,
68
54
  Filter,
69
55
  InputType,
70
56
  SavedFilter,
@@ -86,9 +72,9 @@ const headers = [
86
72
  { label: 'Colonne 1', key: 'column1', sortable: true },
87
73
  { label: 'actions', key: 'action', action: true },
88
74
  { label: 'Colonne 2', key: 'column2' },
89
- { label: 'Date', key: 'date' },
90
- { label: 'DateUpdate', key: 'dateUpdate' },
91
- { label: 'DateDelete', key: 'dateDelete' },
75
+ { label: 'Date', key: 'date', columnType: ColumnType.Date },
76
+ { label: 'DateUpdate', key: 'dateUpdate', columnType: ColumnType.Date },
77
+ { label: 'DateDelete', key: 'dateDelete', columnType: ColumnType.Date },
92
78
  { label: 'choice1', key: 'choice1' },
93
79
  { label: 'choice2', key: 'choice2' },
94
80
  {