@dative-gpi/foundation-shared-components 0.0.109 → 0.0.111

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.
@@ -43,12 +43,12 @@
43
43
  :wrap="false"
44
44
  >
45
45
  <FSImage
46
- v-if="$props.imageId || realSource"
46
+ v-if="$props.imageId || $props.modelValue"
47
47
  :aspectRatio="$props.aspectRatio"
48
48
  :height="$props.height"
49
49
  :width="$props.width"
50
50
  :imageId="$props.imageId"
51
- :imageB64="realSource"
51
+ :imageB64="$props.modelValue"
52
52
  />
53
53
  <FSCard
54
54
  v-else
@@ -106,7 +106,7 @@
106
106
  </FSRow>
107
107
  </FSCard>
108
108
  <FSRow
109
- v-else-if="$props.imageId || realSource"
109
+ v-else-if="$props.imageId || $props.modelValue"
110
110
  :width="$props.width"
111
111
  class="fs-edit-image-full"
112
112
  >
@@ -115,7 +115,7 @@
115
115
  :height="$props.height"
116
116
  :width="$props.width"
117
117
  :imageId="$props.imageId"
118
- :imageB64="realSource"
118
+ :imageB64="$props.modelValue"
119
119
  />
120
120
  <FSRow
121
121
  class="fs-edit-image-full-toolbar"
@@ -203,6 +203,11 @@ export default defineComponent({
203
203
  required: false,
204
204
  default: null
205
205
  },
206
+ label: {
207
+ type: String as PropType<string | null>,
208
+ required: false,
209
+ default: null
210
+ },
206
211
  imageId: {
207
212
  type: String as PropType<string | null>,
208
213
  required: false,
@@ -232,11 +237,6 @@ export default defineComponent({
232
237
  type: Boolean,
233
238
  required: false,
234
239
  default: false
235
- },
236
- label: {
237
- type: String as PropType<string | null>,
238
- required: false,
239
- default: null
240
240
  }
241
241
  },
242
242
  emits: ["update:modelValue", "update:imageId"],
@@ -260,13 +260,6 @@ export default defineComponent({
260
260
  };
261
261
  });
262
262
 
263
- const realSource = computed(() => {
264
- if (fileSelected.value && fileSelected.value.fileName) {
265
- return fileSelected.value.fileContent as string;
266
- }
267
- return props.modelValue;
268
- });
269
-
270
263
  const onUpload = async (payload: File) => {
271
264
  const content = (await readFile(payload)) as string;
272
265
  fileSelected.value.fileName = payload.name;
@@ -292,7 +285,6 @@ export default defineComponent({
292
285
  invisibleButtonRef,
293
286
  fileSelected,
294
287
  isExtraSmall,
295
- realSource,
296
288
  style,
297
289
  onUpload,
298
290
  onRemove
@@ -47,9 +47,14 @@ export default defineComponent({
47
47
  await (formRef.value as any).validate();
48
48
  emit("update:modelValue", !!((formRef.value as any).isValid ?? true));
49
49
  emit("submit", !!((formRef.value as any).isValid ?? true));
50
-
51
50
  };
52
51
 
52
+ const validate = async () => {
53
+ submitted.value = true;
54
+ await (formRef.value as any).validate();
55
+ emit("update:modelValue", !!((formRef.value as any).isValid ?? true));
56
+ };
57
+
53
58
  provide("validateOn", validateOn);
54
59
  provide("submitted", submitted);
55
60
 
@@ -57,7 +62,8 @@ export default defineComponent({
57
62
  validateOn,
58
63
  submitted,
59
64
  formRef,
60
- onSubmit
65
+ onSubmit,
66
+ validate
61
67
  };
62
68
  }
63
69
  });
@@ -107,31 +107,27 @@ export default defineComponent({
107
107
 
108
108
  const goToStart = () => {
109
109
  if (slideGroupRef.value) {
110
- (slideGroupRef.value as any).scrollOffset = 0;
110
+ (slideGroupRef.value as any).scrollTo("prev");
111
+ (slideGroupRef.value as any).scrollTo("prev");
111
112
  }
112
113
  };
113
114
 
114
115
  const goToPrev = () => {
115
116
  if (slideGroupRef.value) {
116
- (slideGroupRef.value as any).scrollOffset = Math.max(0, (slideGroupRef.value as any).scrollOffset - props.speed);
117
+ (slideGroupRef.value as any).scrollTo("prev");
117
118
  }
118
119
  };
119
120
 
120
121
  const goToEnd = () => {
121
122
  if (slideGroupRef.value) {
122
- const contentSize = (slideGroupRef.value as any).$el.children[1].children[0].clientWidth;
123
- const containerSize = (slideGroupRef.value as any).$el.clientWidth;
124
- const arrowsOffset = props.dash ? 104 : 64;
125
- (slideGroupRef.value as any).scrollOffset = (contentSize - containerSize + arrowsOffset);
123
+ (slideGroupRef.value as any).scrollTo("next");
124
+ (slideGroupRef.value as any).scrollTo("next");
126
125
  }
127
126
  };
128
127
 
129
128
  const goToNext = () => {
130
129
  if (slideGroupRef.value) {
131
- const contentSize = (slideGroupRef.value as any).$el.children[1].children[0].clientWidth;
132
- const containerSize = (slideGroupRef.value as any).$el.clientWidth;
133
- const arrowsOffset = props.dash ? 104 : 64;
134
- (slideGroupRef.value as any).scrollOffset = Math.min(contentSize - containerSize + arrowsOffset, (slideGroupRef.value as any).scrollOffset + props.speed);
130
+ (slideGroupRef.value as any).scrollTo("next");
135
131
  }
136
132
  };
137
133
 
@@ -7,7 +7,7 @@
7
7
  :required="$props.required"
8
8
  :editable="$props.editable"
9
9
  :placeholder="placeholder"
10
- @keydown.enter="$emit('update:modelValue', innerValue)"
10
+ @keydown.enter="onSearch"
11
11
  v-model="innerValue"
12
12
  v-bind="$attrs"
13
13
  >
@@ -23,7 +23,7 @@
23
23
  :icon="$props.prependInnerIcon"
24
24
  :editable="$props.editable"
25
25
  :color="ColorEnum.Dark"
26
- @click="$emit('update:modelValue', innerValue)"
26
+ @click="onSearch"
27
27
  />
28
28
  </slot>
29
29
  </template>
@@ -41,7 +41,7 @@
41
41
  :variant="$props.buttonVariant"
42
42
  :color="$props.buttonColor"
43
43
  :editable="$props.editable"
44
- @click="$emit('update:modelValue', innerValue)"
44
+ @click="onSearch"
45
45
  />
46
46
  </slot>
47
47
  </template>
@@ -163,6 +163,12 @@ export default defineComponent({
163
163
  return props.buttonLabel ?? $tr('ui.button.search', 'Search');
164
164
  });
165
165
 
166
+ const onSearch = (event: Event) => {
167
+ event.stopImmediatePropagation();
168
+ event.preventDefault();
169
+ emit('update:modelValue', innerValue.value);
170
+ };
171
+
166
172
  watch(innerValue, () => {
167
173
  if (["instant"].includes(props.variant)) {
168
174
  emit("update:modelValue", innerValue.value);
@@ -173,7 +179,8 @@ export default defineComponent({
173
179
  placeholder,
174
180
  buttonLabel,
175
181
  innerValue,
176
- ColorEnum
182
+ ColorEnum,
183
+ onSearch
177
184
  };
178
185
  }
179
186
  });
@@ -141,7 +141,9 @@ export default defineComponent({
141
141
 
142
142
  const messages = computed((): string[] => getMessages(props.modelValue, props.rules));
143
143
 
144
- const onAdd = (): void => {
144
+ const onAdd = (event: Event): void => {
145
+ event.stopImmediatePropagation();
146
+ event.preventDefault();
145
147
  if (!props.editable) {
146
148
  return;
147
149
  }
@@ -79,6 +79,7 @@
79
79
  </FSCol>
80
80
  <FSDivider
81
81
  v-if="showFiltersDivider"
82
+ :size="['30px', '24px']"
82
83
  :vertical="true"
83
84
  />
84
85
  <FSCol>
@@ -89,7 +90,7 @@
89
90
  v-if="showFilters && resetable"
90
91
  variant="standard"
91
92
  :label="$tr('ui.data-table.reset-filters', 'Reset')"
92
- :height="[30, 24]"
93
+ :height="['30px', '24px']"
93
94
  :color="ColorEnum.Error"
94
95
  :editable="true"
95
96
  @click="resetFilter"
@@ -373,7 +374,7 @@
373
374
  {{ $tr("ui.data-table.rows-per-page", "Rows per page") }}
374
375
  </FSText>
375
376
  <FSSelectField
376
- class="fs-data-table-rows-per-page"
377
+ class="fs-data-table-rows-per-page fs-small-input"
377
378
  :clearable="false"
378
379
  :hideHeader="true"
379
380
  :items="rowsPerPageOptions"
@@ -382,7 +383,7 @@
382
383
  </FSRow>
383
384
  <FSToggleSet
384
385
  v-if="innerRowsPerPage !== -1"
385
- class="fs-data-table-pagination"
386
+ class="fs-data-table-pagination fs-small-input"
386
387
  variant="slide"
387
388
  :dash="pageOptions.length > 8"
388
389
  :values="pageOptions"
@@ -529,7 +530,7 @@
529
530
  width="120px"
530
531
  >
531
532
  <FSSelectField
532
- class="fs-data-table-rows-per-page"
533
+ class="fs-data-table-rows-per-page fs-small-input"
533
534
  :clearable="false"
534
535
  :hideHeader="true"
535
536
  :items="rowsPerPageOptions"
@@ -539,7 +540,7 @@
539
540
  </FSRow>
540
541
  <FSToggleSet
541
542
  v-if="innerRowsPerPage !== -1"
542
- class="fs-data-table-pagination"
543
+ class="fs-data-table-pagination fs-small-input"
543
544
  variant="slide"
544
545
  :dash="pageOptions.length > 8"
545
546
  :values="pageOptions"
@@ -944,8 +945,19 @@ export default defineComponent({
944
945
  }
945
946
  return {
946
947
  ...c,
947
- sort: (a: any, b: any): number => JSON.stringify(a)
948
- .localeCompare(JSON.stringify(b), undefined, { numeric: true })
948
+ sort: (a: any, b: any): number =>{
949
+ if (a === undefined && b === undefined) {
950
+ return 0;
951
+ }
952
+ if (a === undefined) {
953
+ return -1;
954
+ }
955
+ if (b === undefined) {
956
+ return 1;
957
+ }
958
+ return JSON.stringify(a)
959
+ .localeCompare(JSON.stringify(b), undefined, { numeric: true })
960
+ }
949
961
  };
950
962
  })
951
963
  });
@@ -1420,7 +1432,7 @@ export default defineComponent({
1420
1432
  emit("update:rowsPerPage", innerRowsPerPage.value);
1421
1433
  });
1422
1434
 
1423
- watch(() => props.headers, () => {
1435
+ watch([() => props.headers, () => props.items], () => {
1424
1436
  computeFilters();
1425
1437
  });
1426
1438
 
package/models/tables.ts CHANGED
@@ -28,6 +28,6 @@ export interface FSDataTableFilter {
28
28
  }
29
29
 
30
30
  export interface FSDataTableOrder {
31
- key: string;
32
- order: "asc" | "desc";
31
+ key: string | null;
32
+ order: "asc" | "desc" | null;
33
33
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-shared-components",
3
3
  "sideEffects": false,
4
- "version": "0.0.109",
4
+ "version": "0.0.111",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -10,8 +10,8 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "@dative-gpi/foundation-shared-domain": "0.0.109",
14
- "@dative-gpi/foundation-shared-services": "0.0.109",
13
+ "@dative-gpi/foundation-shared-domain": "0.0.111",
14
+ "@dative-gpi/foundation-shared-services": "0.0.111",
15
15
  "@fontsource/montserrat": "^5.0.16",
16
16
  "@lexical/clipboard": "^0.12.5",
17
17
  "@lexical/history": "^0.12.5",
@@ -32,5 +32,5 @@
32
32
  "sass": "^1.69.5",
33
33
  "sass-loader": "^13.3.2"
34
34
  },
35
- "gitHead": "2d4b8a76e9b8361a8a1e9b327311afef20a53950"
35
+ "gitHead": "6856c1334706daad1394d57eeb456f1f4497389e"
36
36
  }
@@ -106,9 +106,9 @@
106
106
  background-color: var(--fs-data-table-background-color);
107
107
  }
108
108
 
109
- .fs-data-table-rows-per-page > .fs-select-field {
110
- min-width: 120px !important;
111
- width: 120px !important;
109
+ .fs-data-table-rows-per-page {
110
+ min-width: 100px;
111
+ width: 100px;
112
112
  }
113
113
 
114
114
  .fs-data-table-pagination {
@@ -30,7 +30,7 @@
30
30
  .v-input {
31
31
  padding: 0px !important;
32
32
 
33
- &:not(.v-checkbox):not(.v-slider) {
33
+ &:not(.v-checkbox):not(.v-slider):not(.fs-small-input) {
34
34
  min-width: 200px;
35
35
  width: 100%;
36
36
  }