@dative-gpi/foundation-shared-components 0.0.211 → 0.0.213

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.
@@ -65,13 +65,13 @@
65
65
  >
66
66
  <FSText
67
67
  v-if="fileSelected && fileSelected.fileName"
68
- lineClamp="2"
69
68
  font="text-body"
69
+ :lineClamp="2"
70
70
  >
71
71
  {{ fileSelected.fileName }}
72
72
  </FSText>
73
73
  <FSCol
74
- gap="0"
74
+ gap="0px"
75
75
  >
76
76
  <FSText
77
77
  class="fs-edit-image-overline"
@@ -97,7 +97,7 @@
97
97
  <FSButtonFileMini
98
98
  accept="image/*"
99
99
  :readFile="false"
100
- @update:modelValue="onUpload"
100
+ @update:metadata="onUpload"
101
101
  />
102
102
  <FSButtonRemoveMini
103
103
  @click="onRemove"
@@ -124,7 +124,7 @@
124
124
  <FSButtonFileMini
125
125
  accept="image/*"
126
126
  :readFile="false"
127
- @update:modelValue="onUpload"
127
+ @update:metadata="onUpload"
128
128
  />
129
129
  <FSButtonRemoveMini
130
130
  @click="onRemove"
@@ -147,17 +147,17 @@
147
147
  mdi-plus-box-outline
148
148
  </FSIcon>
149
149
  <FSText
150
- lineClamp="2"
151
150
  font="text-body"
151
+ :lineClamp="2"
152
152
  >
153
153
  {{ $tr('ui.edit-image.add-image', 'Add an image.') }}
154
154
  </FSText>
155
155
  <FSButtonFileMini
156
- ref="invisibleButtonRef"
157
156
  class="fs-edit-image-hidden-button"
157
+ ref="invisibleButtonRef"
158
158
  accept="image/*"
159
159
  :readFile="false"
160
- @update:modelValue="onUpload"
160
+ @update:metadata="onUpload"
161
161
  />
162
162
  </FSRow>
163
163
  </FSClickable>
@@ -165,13 +165,11 @@
165
165
  </template>
166
166
 
167
167
  <script lang="ts">
168
- import type { PropType} from "vue";
169
- import { computed, defineComponent, ref, watch } from "vue";
168
+ import { computed, defineComponent, type PropType, ref, watch } from "vue";
170
169
 
171
170
  import { useBreakpoints, useColors } from "@dative-gpi/foundation-shared-components/composables";
171
+ import { ColorEnum, type FileImage } from "@dative-gpi/foundation-shared-components/models";
172
172
  import { useFiles } from "@dative-gpi/foundation-shared-services/composables";
173
- import type { FileImage } from "@dative-gpi/foundation-shared-components/models";
174
- import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
175
173
 
176
174
  import FSButtonRemoveMini from "./buttons/FSButtonRemoveMini.vue";
177
175
  import FSButtonFileMini from "./buttons/FSButtonFileMini.vue";
@@ -138,10 +138,10 @@
138
138
  :elevation="true"
139
139
  >
140
140
  <FSAutoCompleteField
141
- itemTitle="code"
141
+ itemTitle="label"
142
+ itemValue="code"
142
143
  :placeholder="$tr('ui.rich-text-field.variable-placeholder', 'Choose a variable...')"
143
144
  :items="$props.variableReferences"
144
- :returnObject="true"
145
145
  @update:modelValue="insertVariable($event)"
146
146
  />
147
147
  </FSCard>
@@ -291,7 +291,7 @@ export default defineComponent({
291
291
  default: () => []
292
292
  },
293
293
  variableValues: {
294
- type: Object,
294
+ type: Object as PropType<{ [key: string]: any }>,
295
295
  required: false,
296
296
  default: () => ({})
297
297
  },
@@ -502,12 +502,16 @@ export default defineComponent({
502
502
  });
503
503
  };
504
504
 
505
- const insertVariable = (variable: { code: string; defaultValue: any; type: string }) => {
505
+ const insertVariable = (code: string) => {
506
+ const variable = props.variableReferences.find((v) => v.code === code);
507
+ if (!variable) {
508
+ return;
509
+ }
506
510
  menuVariable.value = false;
507
511
  editor.update(() => {
508
512
  const selection = $getSelection();
509
513
  if ($isRangeSelection(selection)) {
510
- const variableNode = $createVariableNode(variable.code, variable.defaultValue, variable.type);
514
+ const variableNode = $createVariableNode(code, variable.defaultValue);
511
515
  selection.insertNodes([variableNode]);
512
516
  }
513
517
  });
@@ -34,7 +34,7 @@
34
34
  class="fs-map-overlay-edit-button"
35
35
  >
36
36
  <FSButton
37
- prependIcon="mdi-pencil"
37
+ prependIcon="mdi-pencil-outline"
38
38
  :label="$tr('ui.map.modify', 'Modify')"
39
39
  @click="editingLocation = true"
40
40
  />
@@ -1,5 +1,5 @@
1
1
  export interface RichTextVariable {
2
+ label: string;
2
3
  code: string;
3
4
  defaultValue: string;
4
- typeName: string;
5
5
  }
@@ -1,12 +1,12 @@
1
1
  import { type LexicalNode, DecoratorNode, type SerializedLexicalNode, type Spread, type EditorConfig, type LexicalEditor } from "lexical";
2
- import type { RichTextVariable } from "./richTextVariable";
2
+
3
+ import { type RichTextVariable } from "./richTextVariable";
3
4
 
4
5
  export type SerializedVariableNode = Spread<
5
6
  {
6
7
  type: "variable";
7
8
  code: string;
8
9
  defaultValue: string;
9
- typeName: string;
10
10
  },
11
11
  SerializedLexicalNode
12
12
  >;
@@ -14,7 +14,6 @@ export type SerializedVariableNode = Spread<
14
14
  export class VariableNode extends DecoratorNode<Element> {
15
15
  __code: string;
16
16
  __defaultValue: string;
17
- __typeName: string;
18
17
  readonlyMode: boolean;
19
18
 
20
19
  static getType() {
@@ -22,20 +21,21 @@ export class VariableNode extends DecoratorNode<Element> {
22
21
  }
23
22
 
24
23
  static clone(node: VariableNode) {
25
- return new VariableNode(node.__code, node.__defaultValue, node.__typeName, node.__key);
24
+ return new VariableNode(node.__code, node.__defaultValue, node.__key);
26
25
  }
27
26
 
28
- constructor(code: string, defaultValue: string, typeName: string, key?: string) {
27
+ constructor(code: string, defaultValue: string, key?: string) {
29
28
  super(key);
30
29
  this.__code = code;
31
30
  this.__defaultValue = defaultValue;
32
- this.__typeName = typeName;
33
31
  this.readonlyMode = false;
34
32
  }
35
33
 
36
34
  getValue(editorElement: HTMLElement): any {
37
35
  const variableValues = editorElement.dataset.variableValues;
38
- if (!variableValues) { return this.__defaultValue; }
36
+ if (!variableValues) {
37
+ return this.__defaultValue;
38
+ }
39
39
  const values = JSON.parse(variableValues);
40
40
  return values[this.__code] ?? this.__defaultValue;
41
41
  }
@@ -51,10 +51,12 @@ export class VariableNode extends DecoratorNode<Element> {
51
51
  content.classList.add("fs-rich-text-field-node-variable-value");
52
52
  if (_editor._rootElement) {
53
53
  content.textContent = this.getValue(_editor._rootElement);
54
- } else {
54
+ }
55
+ else {
55
56
  content.textContent = this.__defaultValue;
56
57
  }
57
- } else {
58
+ }
59
+ else {
58
60
  content.classList.add("fs-rich-text-field-node-variable-code");
59
61
  content.textContent = `{${this.__code}}`
60
62
  }
@@ -71,8 +73,7 @@ export class VariableNode extends DecoratorNode<Element> {
71
73
  type: "variable",
72
74
  version: 1,
73
75
  code: this.__code,
74
- defaultValue: this.__defaultValue,
75
- typeName: this.__typeName,
76
+ defaultValue: this.__defaultValue
76
77
  };
77
78
  }
78
79
 
@@ -83,20 +84,18 @@ export class VariableNode extends DecoratorNode<Element> {
83
84
  static importJSON(serializedNode: SerializedVariableNode): VariableNode {
84
85
  return new VariableNode(
85
86
  serializedNode.code,
86
- serializedNode.defaultValue,
87
- serializedNode.typeName
87
+ serializedNode.defaultValue
88
88
  );
89
89
  }
90
90
  }
91
91
 
92
- export function $createVariableNode(code: string, defaultValue: string, typeName: string): VariableNode {
93
- return new VariableNode(code, defaultValue, typeName);
92
+ export function $createVariableNode(code: string, defaultValue: string): VariableNode {
93
+ return new VariableNode(code, defaultValue);
94
94
  }
95
95
 
96
96
  export function $modifyVariableNode(node: VariableNode, newValue: RichTextVariable): VariableNode {
97
97
  node.__code = newValue.code;
98
98
  node.__defaultValue = newValue.defaultValue;
99
- node.__typeName = newValue.typeName;
100
99
  return node;
101
100
  }
102
101
 
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.211",
4
+ "version": "0.0.213",
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.211",
14
- "@dative-gpi/foundation-shared-services": "0.0.211"
13
+ "@dative-gpi/foundation-shared-domain": "0.0.213",
14
+ "@dative-gpi/foundation-shared-services": "0.0.213"
15
15
  },
16
16
  "peerDependencies": {
17
17
  "@dative-gpi/bones-ui": "^0.0.75",
@@ -35,5 +35,5 @@
35
35
  "sass": "1.71.1",
36
36
  "sass-loader": "13.3.2"
37
37
  },
38
- "gitHead": "8590b4c465c53844253e13aceb01d14ad25c95ee"
38
+ "gitHead": "0b705c623649ff8e3a9d03c9ae2ac0463864de45"
39
39
  }