@mmlogic/components 0.3.4 → 0.3.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.
Files changed (173) hide show
  1. package/dist/{collection/utils/cell-renderer.js → mosterdcomponents/cell-renderer-CbRwLOo8.js} +9 -3
  2. package/dist/mosterdcomponents/cell-renderer-CbRwLOo8.js.map +1 -0
  3. package/dist/{esm/index.js → mosterdcomponents/client-layout-D88nn5zf.js} +4 -1
  4. package/dist/mosterdcomponents/client-layout-D88nn5zf.js.map +1 -0
  5. package/dist/{collection/utils/format.js → mosterdcomponents/format-BAfsQfy1.js} +12 -7
  6. package/dist/mosterdcomponents/format-BAfsQfy1.js.map +1 -0
  7. package/dist/{collection/utils/i18n.js → mosterdcomponents/i18n-hoGGKbKU.js} +6 -1
  8. package/dist/mosterdcomponents/i18n-hoGGKbKU.js.map +1 -0
  9. package/dist/mosterdcomponents/index-B_tPFIvS.js +4585 -0
  10. package/dist/mosterdcomponents/index-B_tPFIvS.js.map +1 -0
  11. package/dist/mosterdcomponents/index-I5SuYv7a.js +4 -0
  12. package/dist/mosterdcomponents/index-I5SuYv7a.js.map +1 -0
  13. package/dist/mosterdcomponents/index.esm.js +5 -1
  14. package/dist/mosterdcomponents/index.esm.js.map +1 -0
  15. package/dist/mosterdcomponents/mosterdcomponents.css +180 -1
  16. package/dist/mosterdcomponents/mosterdcomponents.esm.js +50 -1
  17. package/dist/mosterdcomponents/mosterdcomponents.esm.js.map +1 -0
  18. package/dist/mosterdcomponents/mrd-boolean-field.entry.js +37 -0
  19. package/dist/mosterdcomponents/mrd-boolean-field.entry.js.map +1 -0
  20. package/dist/mosterdcomponents/mrd-currency-field.entry.js +67 -0
  21. package/dist/mosterdcomponents/mrd-currency-field.entry.js.map +1 -0
  22. package/dist/mosterdcomponents/mrd-date-field.entry.js +46 -0
  23. package/dist/mosterdcomponents/mrd-date-field.entry.js.map +1 -0
  24. package/dist/mosterdcomponents/mrd-datetime-field.entry.js +78 -0
  25. package/dist/mosterdcomponents/mrd-datetime-field.entry.js.map +1 -0
  26. package/dist/mosterdcomponents/mrd-email-field.entry.js +50 -0
  27. package/dist/mosterdcomponents/mrd-email-field.entry.js.map +1 -0
  28. package/dist/{collection/components/mrd-field/mrd-field.js → mosterdcomponents/mrd-field.entry.js} +28 -179
  29. package/dist/mosterdcomponents/mrd-field.entry.js.map +1 -0
  30. package/dist/mosterdcomponents/mrd-file-field.entry.js +108 -0
  31. package/dist/mosterdcomponents/mrd-file-field.entry.js.map +1 -0
  32. package/dist/{collection/components/mrd-form/mrd-form.js → mosterdcomponents/mrd-form.entry.js} +82 -280
  33. package/dist/mosterdcomponents/mrd-form.entry.js.map +1 -0
  34. package/dist/mosterdcomponents/mrd-hyperlink-field.entry.js +87 -0
  35. package/dist/mosterdcomponents/mrd-hyperlink-field.entry.js.map +1 -0
  36. package/dist/mosterdcomponents/mrd-image-field.entry.js +122 -0
  37. package/dist/mosterdcomponents/mrd-image-field.entry.js.map +1 -0
  38. package/dist/{collection/components/mrd-layout-section/mrd-layout-section.js → mosterdcomponents/mrd-layout-section.entry.js} +31 -418
  39. package/dist/mosterdcomponents/mrd-layout-section.entry.js.map +1 -0
  40. package/dist/mosterdcomponents/mrd-list-field.entry.js +107 -0
  41. package/dist/mosterdcomponents/mrd-list-field.entry.js.map +1 -0
  42. package/dist/mosterdcomponents/mrd-longtext-field.entry.js +47 -0
  43. package/dist/mosterdcomponents/mrd-longtext-field.entry.js.map +1 -0
  44. package/dist/mosterdcomponents/mrd-number-field.entry.js +87 -0
  45. package/dist/mosterdcomponents/mrd-number-field.entry.js.map +1 -0
  46. package/dist/mosterdcomponents/mrd-relation-field.entry.js +267 -0
  47. package/dist/mosterdcomponents/mrd-relation-field.entry.js.map +1 -0
  48. package/dist/mosterdcomponents/mrd-secret-field.entry.js +49 -0
  49. package/dist/mosterdcomponents/mrd-secret-field.entry.js.map +1 -0
  50. package/dist/{collection/components/mrd-table/mrd-table.js → mosterdcomponents/mrd-table.entry.js} +67 -398
  51. package/dist/mosterdcomponents/mrd-table.entry.js.map +1 -0
  52. package/dist/mosterdcomponents/mrd-text-field.entry.js +47 -0
  53. package/dist/mosterdcomponents/mrd-text-field.entry.js.map +1 -0
  54. package/dist/mosterdcomponents/mrd-textarea-field.entry.js +86 -0
  55. package/dist/mosterdcomponents/mrd-textarea-field.entry.js.map +1 -0
  56. package/dist/mosterdcomponents/mrd-time-field.entry.js +46 -0
  57. package/dist/mosterdcomponents/mrd-time-field.entry.js.map +1 -0
  58. package/dist/{esm/quill-CiuCgGz_.js → mosterdcomponents/quill-C9pgw_k-.js} +16282 -1397
  59. package/dist/mosterdcomponents/quill-C9pgw_k-.js.map +1 -0
  60. package/dist/{collection/utils/validation.js → mosterdcomponents/validation-ixb43cqU.js} +12 -5
  61. package/dist/mosterdcomponents/validation-ixb43cqU.js.map +1 -0
  62. package/dist/types/components/mrd-form/mrd-form.d.ts +13 -1
  63. package/dist/types/components/mrd-relation-field/mrd-relation-field.d.ts +3 -0
  64. package/dist/types/components/mrd-table/mrd-table.d.ts +4 -0
  65. package/dist/types/components.d.ts +19 -9
  66. package/package.json +1 -1
  67. package/dist/cjs/app-globals-V2Kpy_OQ.js +0 -5
  68. package/dist/cjs/index-BPj2cBXs.js +0 -1570
  69. package/dist/cjs/index.cjs.js +0 -66
  70. package/dist/cjs/loader.cjs.js +0 -13
  71. package/dist/cjs/mosterdcomponents.cjs.js +0 -25
  72. package/dist/cjs/mrd-boolean-field_20.cjs.entry.js +0 -3848
  73. package/dist/cjs/quill-DmFfnC1f.js +0 -16272
  74. package/dist/collection/collection-manifest.json +0 -32
  75. package/dist/collection/components/mrd-boolean-field/mrd-boolean-field.js +0 -199
  76. package/dist/collection/components/mrd-boolean-field/mrd-boolean-field.scss +0 -77
  77. package/dist/collection/components/mrd-currency-field/mrd-currency-field.js +0 -248
  78. package/dist/collection/components/mrd-currency-field/mrd-currency-field.scss +0 -100
  79. package/dist/collection/components/mrd-date-field/mrd-date-field.js +0 -206
  80. package/dist/collection/components/mrd-date-field/mrd-date-field.scss +0 -66
  81. package/dist/collection/components/mrd-datetime-field/mrd-datetime-field.js +0 -240
  82. package/dist/collection/components/mrd-datetime-field/mrd-datetime-field.scss +0 -66
  83. package/dist/collection/components/mrd-email-field/mrd-email-field.js +0 -230
  84. package/dist/collection/components/mrd-email-field/mrd-email-field.scss +0 -69
  85. package/dist/collection/components/mrd-field/mrd-field.scss +0 -118
  86. package/dist/collection/components/mrd-file-field/mrd-file-field.js +0 -341
  87. package/dist/collection/components/mrd-file-field/mrd-file-field.scss +0 -153
  88. package/dist/collection/components/mrd-form/mrd-form.scss +0 -148
  89. package/dist/collection/components/mrd-hyperlink-field/mrd-hyperlink-field.js +0 -291
  90. package/dist/collection/components/mrd-hyperlink-field/mrd-hyperlink-field.scss +0 -91
  91. package/dist/collection/components/mrd-image-field/mrd-image-field.js +0 -356
  92. package/dist/collection/components/mrd-image-field/mrd-image-field.scss +0 -190
  93. package/dist/collection/components/mrd-layout-section/mrd-layout-section.scss +0 -445
  94. package/dist/collection/components/mrd-list-field/mrd-list-field.js +0 -313
  95. package/dist/collection/components/mrd-list-field/mrd-list-field.scss +0 -109
  96. package/dist/collection/components/mrd-longtext-field/mrd-longtext-field.js +0 -227
  97. package/dist/collection/components/mrd-longtext-field/mrd-longtext-field.scss +0 -78
  98. package/dist/collection/components/mrd-number-field/mrd-number-field.js +0 -316
  99. package/dist/collection/components/mrd-number-field/mrd-number-field.scss +0 -77
  100. package/dist/collection/components/mrd-relation-field/mrd-relation-field.js +0 -678
  101. package/dist/collection/components/mrd-relation-field/mrd-relation-field.scss +0 -266
  102. package/dist/collection/components/mrd-secret-field/mrd-secret-field.js +0 -229
  103. package/dist/collection/components/mrd-secret-field/mrd-secret-field.scss +0 -73
  104. package/dist/collection/components/mrd-table/mrd-table.scss +0 -742
  105. package/dist/collection/components/mrd-text-field/mrd-text-field.js +0 -227
  106. package/dist/collection/components/mrd-text-field/mrd-text-field.scss +0 -69
  107. package/dist/collection/components/mrd-textarea-field/mrd-textarea-field.js +0 -267
  108. package/dist/collection/components/mrd-textarea-field/mrd-textarea-field.scss +0 -79
  109. package/dist/collection/components/mrd-time-field/mrd-time-field.js +0 -206
  110. package/dist/collection/components/mrd-time-field/mrd-time-field.scss +0 -66
  111. package/dist/collection/dev/api.js +0 -136
  112. package/dist/collection/dev/app.js +0 -868
  113. package/dist/collection/dev/auth.js +0 -156
  114. package/dist/collection/dev/example-data.js +0 -403
  115. package/dist/collection/dev/sprites.svg +0 -55
  116. package/dist/collection/index.js +0 -1
  117. package/dist/collection/types/client-layout.js +0 -64
  118. package/dist/collection/types/index.js +0 -1
  119. package/dist/components/client-layout.js +0 -1
  120. package/dist/components/format.js +0 -1
  121. package/dist/components/i18n.js +0 -1
  122. package/dist/components/index.js +0 -1
  123. package/dist/components/mrd-boolean-field.js +0 -1
  124. package/dist/components/mrd-boolean-field2.js +0 -1
  125. package/dist/components/mrd-currency-field.js +0 -1
  126. package/dist/components/mrd-currency-field2.js +0 -1
  127. package/dist/components/mrd-date-field.js +0 -1
  128. package/dist/components/mrd-date-field2.js +0 -1
  129. package/dist/components/mrd-datetime-field.js +0 -1
  130. package/dist/components/mrd-datetime-field2.js +0 -1
  131. package/dist/components/mrd-email-field.js +0 -1
  132. package/dist/components/mrd-email-field2.js +0 -1
  133. package/dist/components/mrd-field.js +0 -1
  134. package/dist/components/mrd-field2.js +0 -1
  135. package/dist/components/mrd-file-field.js +0 -1
  136. package/dist/components/mrd-file-field2.js +0 -1
  137. package/dist/components/mrd-form.js +0 -1
  138. package/dist/components/mrd-hyperlink-field.js +0 -1
  139. package/dist/components/mrd-hyperlink-field2.js +0 -1
  140. package/dist/components/mrd-image-field.js +0 -1
  141. package/dist/components/mrd-image-field2.js +0 -1
  142. package/dist/components/mrd-layout-section.js +0 -1
  143. package/dist/components/mrd-list-field.js +0 -1
  144. package/dist/components/mrd-list-field2.js +0 -1
  145. package/dist/components/mrd-longtext-field.js +0 -1
  146. package/dist/components/mrd-longtext-field2.js +0 -1
  147. package/dist/components/mrd-number-field.js +0 -1
  148. package/dist/components/mrd-number-field2.js +0 -1
  149. package/dist/components/mrd-relation-field.js +0 -1
  150. package/dist/components/mrd-relation-field2.js +0 -1
  151. package/dist/components/mrd-secret-field.js +0 -1
  152. package/dist/components/mrd-secret-field2.js +0 -1
  153. package/dist/components/mrd-table.js +0 -1
  154. package/dist/components/mrd-table2.js +0 -1
  155. package/dist/components/mrd-text-field.js +0 -1
  156. package/dist/components/mrd-text-field2.js +0 -1
  157. package/dist/components/mrd-textarea-field.js +0 -1
  158. package/dist/components/mrd-textarea-field2.js +0 -1
  159. package/dist/components/mrd-time-field.js +0 -1
  160. package/dist/components/mrd-time-field2.js +0 -1
  161. package/dist/components/quill.js +0 -1
  162. package/dist/components/validation.js +0 -1
  163. package/dist/esm/app-globals-DQuL1Twl.js +0 -3
  164. package/dist/esm/index-_tsCCkAi.js +0 -1561
  165. package/dist/esm/loader.js +0 -11
  166. package/dist/esm/mosterdcomponents.js +0 -21
  167. package/dist/esm/mrd-boolean-field_20.entry.js +0 -3827
  168. package/dist/index.cjs.js +0 -1
  169. package/dist/index.js +0 -1
  170. package/dist/mosterdcomponents/p-CiuCgGz_.js +0 -1
  171. package/dist/mosterdcomponents/p-DQuL1Twl.js +0 -1
  172. package/dist/mosterdcomponents/p-_tsCCkAi.js +0 -2
  173. package/dist/mosterdcomponents/p-c9839596.entry.js +0 -1
@@ -1,678 +0,0 @@
1
- import { Host, h } from "@stencil/core";
2
- import { t } from "../../utils/i18n";
3
- import { validateRequired } from "../../utils/validation";
4
- import { ClientLayoutItemRelationDisplayType, ClientLayoutItemRelationEditBehavior } from "../../types";
5
- export class MrdRelationField {
6
- constructor() {
7
- this.name = '';
8
- this.label = '';
9
- this.required = false;
10
- this.disabled = false;
11
- this.locale = navigator.language;
12
- this.relatedClass = '';
13
- /** When set, used instead of relatedClass for search queries (mostSignificantClass from API). */
14
- this.mostSignificantClass = '';
15
- this.displayType = ClientLayoutItemRelationDisplayType.SEARCH;
16
- this.multiple = false;
17
- this.dropdownValues = [];
18
- /** Plain href string/array for normal use; pass { id, label } objects to pre-fill a loaded record. */
19
- this.value = null;
20
- this.searchQuery = '';
21
- this.searchResults = [];
22
- this.allRecords = [];
23
- this.isLoading = false;
24
- this.selectedItems = [];
25
- this.showResults = false;
26
- this.error = '';
27
- this.highlightedIndex = -1;
28
- this.searchDebounce = null;
29
- this.handleKeyDown = (e) => {
30
- if (!this.showResults || this.searchResults.length === 0) {
31
- if (e.key === 'Escape') {
32
- this.showResults = false;
33
- this.highlightedIndex = -1;
34
- }
35
- return;
36
- }
37
- if (e.key === 'ArrowDown') {
38
- e.preventDefault();
39
- this.highlightedIndex = Math.min(this.highlightedIndex + 1, this.searchResults.length - 1);
40
- }
41
- else if (e.key === 'ArrowUp') {
42
- e.preventDefault();
43
- this.highlightedIndex = Math.max(this.highlightedIndex - 1, 0);
44
- }
45
- else if (e.key === 'Enter') {
46
- e.preventDefault();
47
- if (this.highlightedIndex >= 0) {
48
- this.handleResultSelect(this.searchResults[this.highlightedIndex]);
49
- }
50
- }
51
- else if (e.key === 'Escape') {
52
- this.showResults = false;
53
- this.highlightedIndex = -1;
54
- }
55
- };
56
- this.clearSelection = () => {
57
- this.selectedItems = [];
58
- this.searchQuery = '';
59
- this.searchResults = [];
60
- this.showResults = false;
61
- this.highlightedIndex = -1;
62
- this.mrdChange.emit({ name: this.name, value: this.multiple ? [] : null });
63
- };
64
- this.handleSearchInput = (e) => {
65
- const query = e.target.value;
66
- this.searchQuery = query;
67
- if (this.searchDebounce)
68
- clearTimeout(this.searchDebounce);
69
- if (query.trim().length >= 2) {
70
- this.isLoading = true;
71
- this.showResults = true;
72
- this.searchDebounce = setTimeout(() => {
73
- this.mrdSearch.emit({ name: this.name, query, relatedClass: this.mostSignificantClass });
74
- }, 300);
75
- }
76
- else {
77
- this.searchResults = [];
78
- this.showResults = false;
79
- this.isLoading = false;
80
- }
81
- };
82
- this.handleResultSelect = (result) => {
83
- if (this.multiple) {
84
- if (!this.selectedItems.find(i => i.id === result.id)) {
85
- this.selectedItems = [...this.selectedItems, result];
86
- }
87
- this.searchQuery = '';
88
- this.searchResults = [];
89
- this.showResults = false;
90
- const ids = this.selectedItems.map(i => i.id);
91
- this.mrdChange.emit({ name: this.name, value: ids });
92
- }
93
- else {
94
- this.selectedItems = [result];
95
- this.searchQuery = result.label;
96
- this.showResults = false;
97
- this.mrdChange.emit({ name: this.name, value: result.id });
98
- }
99
- if (this.required && !validateRequired(this.selectedItems)) {
100
- this.error = t('required', this.locale);
101
- }
102
- else {
103
- this.error = '';
104
- }
105
- };
106
- this.handleRemoveSelected = (id) => {
107
- this.selectedItems = this.selectedItems.filter(i => i.id !== id);
108
- const ids = this.selectedItems.map(i => i.id);
109
- this.mrdChange.emit({ name: this.name, value: this.multiple ? ids : null });
110
- };
111
- this.handleDropdownChange = (e) => {
112
- const val = e.target.value;
113
- if (this.required && !validateRequired(val)) {
114
- this.error = t('required', this.locale);
115
- }
116
- else {
117
- this.error = '';
118
- }
119
- this.mrdChange.emit({ name: this.name, value: val });
120
- };
121
- this.handleBlur = () => {
122
- var _a, _b;
123
- setTimeout(() => {
124
- this.showResults = false;
125
- this.highlightedIndex = -1;
126
- }, 200);
127
- const val = this.multiple ? this.selectedItems.map(i => i.id) : ((_b = (_a = this.selectedItems[0]) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : null);
128
- this.mrdBlur.emit({ name: this.name, value: val });
129
- };
130
- }
131
- async setAllRecords(records) {
132
- this.allRecords = records;
133
- }
134
- getValueHref() {
135
- var _a, _b, _c;
136
- const v = Array.isArray(this.value) ? ((_a = this.value[0]) !== null && _a !== void 0 ? _a : '') : ((_b = this.value) !== null && _b !== void 0 ? _b : '');
137
- if (!v)
138
- return '';
139
- if (typeof v === 'object')
140
- return (_c = v.id) !== null && _c !== void 0 ? _c : '';
141
- return v;
142
- }
143
- allRecordsChanged() {
144
- if (this.editBehavior !== ClientLayoutItemRelationEditBehavior.DROPDOWN)
145
- return;
146
- const current = this.getValueHref();
147
- if (!current)
148
- return;
149
- // Defer past Stencil's async render cycle: options must exist in the DOM before
150
- // select.value can be set. setAttribute('selected') alone is ignored by browsers
151
- // when the select already has an established value.
152
- setTimeout(() => {
153
- var _a;
154
- const select = (_a = this.el) === null || _a === void 0 ? void 0 : _a.querySelector('select');
155
- if (select)
156
- select.value = current;
157
- }, 0);
158
- }
159
- async setSearchResults(results) {
160
- this.searchResults = results;
161
- this.isLoading = false;
162
- this.showResults = true;
163
- this.highlightedIndex = -1;
164
- }
165
- async setLoading(loading) {
166
- this.isLoading = loading;
167
- }
168
- componentWillLoad() {
169
- var _a;
170
- // Pre-fill selectedItems when value is passed as { id, label } objects
171
- // (e.g. when editing an existing record fetched from the API).
172
- if (this.value) {
173
- if (Array.isArray(this.value)) {
174
- if (this.value.length > 0 && typeof this.value[0] === 'object') {
175
- this.selectedItems = this.value;
176
- this.searchQuery = '';
177
- }
178
- }
179
- else if (typeof this.value === 'object') {
180
- this.selectedItems = [this.value];
181
- this.searchQuery = (_a = this.value.label) !== null && _a !== void 0 ? _a : '';
182
- }
183
- }
184
- }
185
- componentDidLoad() {
186
- // Only emit when there is no commonRelation dependency — the form orchestrates those.
187
- if (this.editBehavior === ClientLayoutItemRelationEditBehavior.DROPDOWN && !this.commonRelation) {
188
- // Defer to next tick so parent event listeners are registered after DOM patching
189
- setTimeout(() => {
190
- this.mrdFetchAll.emit({
191
- name: this.name,
192
- relatedClass: this.relatedClass,
193
- mostSignificantClass: this.mostSignificantClass || undefined,
194
- });
195
- }, 0);
196
- }
197
- }
198
- render() {
199
- var _a, _b;
200
- const hasError = !!this.error;
201
- if (this.editBehavior === ClientLayoutItemRelationEditBehavior.DROPDOWN) {
202
- const currentValue = this.getValueHref();
203
- return (h(Host, null, h("div", { class: "mrd-relation-field" }, this.label && (h("label", { class: `mrd-relation-field__label${this.required ? ' mrd-relation-field__label--required' : ''}` }, this.label)), h("select", { class: `mrd-relation-field__select${hasError ? ' mrd-relation-field__select--error' : ''}`, name: this.name, required: this.required, disabled: this.disabled, onChange: this.handleDropdownChange }, h("option", { value: "" }, t('select_placeholder', this.locale)), this.allRecords.map(record => (h("option", { key: record.id, value: record.id, selected: record.id === currentValue }, record.label)))), hasError && h("span", { class: "mrd-relation-field__error" }, this.error))));
204
- }
205
- if (this.displayType === ClientLayoutItemRelationDisplayType.DROPDOWN) {
206
- const currentValue = Array.isArray(this.value) ? ((_a = this.value[0]) !== null && _a !== void 0 ? _a : '') : ((_b = this.value) !== null && _b !== void 0 ? _b : '');
207
- return (h(Host, null, h("div", { class: "mrd-relation-field" }, this.label && (h("label", { class: `mrd-relation-field__label${this.required ? ' mrd-relation-field__label--required' : ''}` }, this.label)), h("select", { class: `mrd-relation-field__select${hasError ? ' mrd-relation-field__select--error' : ''}`, name: this.name, required: this.required, disabled: this.disabled, onChange: this.handleDropdownChange }, h("option", { value: "" }, t('select_placeholder', this.locale)), this.dropdownValues.map(dv => (h("option", { key: dv.key, value: dv.key, selected: dv.key === currentValue }, dv.label)))), hasError && h("span", { class: "mrd-relation-field__error" }, this.error))));
208
- }
209
- // SEARCH mode
210
- const labelEl = this.label && (h("label", { class: `mrd-relation-field__label${this.required ? ' mrd-relation-field__label--required' : ''}` }, this.label));
211
- // Single selection: show selected value as a badge, hide the search input
212
- if (!this.multiple && this.selectedItems.length > 0) {
213
- return (h(Host, null, h("div", { class: "mrd-relation-field" }, labelEl, h("div", { class: `mrd-relation-field__selected-value${hasError ? ' mrd-relation-field__selected-value--error' : ''}` }, h("span", { class: "mrd-relation-field__selected-name" }, this.selectedItems[0].label), h("button", { type: "button", class: "mrd-relation-field__selected-clear", onClick: this.clearSelection, "aria-label": t('remove', this.locale) }, "\u2715")), hasError && h("span", { class: "mrd-relation-field__error" }, this.error))));
214
- }
215
- return (h(Host, null, h("div", { class: "mrd-relation-field" }, labelEl, this.multiple && this.selectedItems.length > 0 && (h("div", { class: "mrd-relation-field__tags" }, this.selectedItems.map(item => (h("span", { key: item.id, class: "mrd-relation-field__tag" }, item.label, h("button", { type: "button", class: "mrd-relation-field__tag-remove", onClick: () => this.handleRemoveSelected(item.id), "aria-label": t('remove', this.locale) }, "\u2715")))))), h("div", { class: "mrd-relation-field__search-wrapper" }, h("input", { class: `mrd-relation-field__search${hasError ? ' mrd-relation-field__search--error' : ''}`, type: "text", value: this.searchQuery, placeholder: t('search_placeholder', this.locale), disabled: this.disabled, onInput: this.handleSearchInput, onKeyDown: this.handleKeyDown, onBlur: this.handleBlur }), this.isLoading && (h("span", { class: "mrd-relation-field__spinner", "aria-label": t('loading', this.locale) }))), this.showResults && (h("div", { class: "mrd-relation-field__results" }, this.searchResults.length === 0 && !this.isLoading ? (h("div", { class: "mrd-relation-field__no-results" }, t('no_results', this.locale))) : (this.searchResults.map((result, i) => (h("div", { key: result.id, class: `mrd-relation-field__result-item${i === this.highlightedIndex ? ' mrd-relation-field__result-item--highlighted' : ''}`, onMouseDown: () => this.handleResultSelect(result) }, h("span", { class: "mrd-relation-field__result-label" }, result.label), result.description && (h("span", { class: "mrd-relation-field__result-desc" }, result.description)))))))), hasError && h("span", { class: "mrd-relation-field__error" }, this.error))));
216
- }
217
- static get is() { return "mrd-relation-field"; }
218
- static get encapsulation() { return "scoped"; }
219
- static get originalStyleUrls() {
220
- return {
221
- "$": ["mrd-relation-field.scss"]
222
- };
223
- }
224
- static get styleUrls() {
225
- return {
226
- "$": ["mrd-relation-field.css"]
227
- };
228
- }
229
- static get properties() {
230
- return {
231
- "name": {
232
- "type": "string",
233
- "mutable": false,
234
- "complexType": {
235
- "original": "string",
236
- "resolved": "string",
237
- "references": {}
238
- },
239
- "required": false,
240
- "optional": false,
241
- "docs": {
242
- "tags": [],
243
- "text": ""
244
- },
245
- "getter": false,
246
- "setter": false,
247
- "reflect": false,
248
- "attribute": "name",
249
- "defaultValue": "''"
250
- },
251
- "label": {
252
- "type": "string",
253
- "mutable": false,
254
- "complexType": {
255
- "original": "string",
256
- "resolved": "string",
257
- "references": {}
258
- },
259
- "required": false,
260
- "optional": false,
261
- "docs": {
262
- "tags": [],
263
- "text": ""
264
- },
265
- "getter": false,
266
- "setter": false,
267
- "reflect": false,
268
- "attribute": "label",
269
- "defaultValue": "''"
270
- },
271
- "required": {
272
- "type": "boolean",
273
- "mutable": false,
274
- "complexType": {
275
- "original": "boolean",
276
- "resolved": "boolean",
277
- "references": {}
278
- },
279
- "required": false,
280
- "optional": false,
281
- "docs": {
282
- "tags": [],
283
- "text": ""
284
- },
285
- "getter": false,
286
- "setter": false,
287
- "reflect": false,
288
- "attribute": "required",
289
- "defaultValue": "false"
290
- },
291
- "disabled": {
292
- "type": "boolean",
293
- "mutable": false,
294
- "complexType": {
295
- "original": "boolean",
296
- "resolved": "boolean",
297
- "references": {}
298
- },
299
- "required": false,
300
- "optional": false,
301
- "docs": {
302
- "tags": [],
303
- "text": ""
304
- },
305
- "getter": false,
306
- "setter": false,
307
- "reflect": false,
308
- "attribute": "disabled",
309
- "defaultValue": "false"
310
- },
311
- "locale": {
312
- "type": "string",
313
- "mutable": false,
314
- "complexType": {
315
- "original": "string",
316
- "resolved": "string",
317
- "references": {}
318
- },
319
- "required": false,
320
- "optional": false,
321
- "docs": {
322
- "tags": [],
323
- "text": ""
324
- },
325
- "getter": false,
326
- "setter": false,
327
- "reflect": false,
328
- "attribute": "locale",
329
- "defaultValue": "navigator.language"
330
- },
331
- "relatedClass": {
332
- "type": "string",
333
- "mutable": false,
334
- "complexType": {
335
- "original": "string",
336
- "resolved": "string",
337
- "references": {}
338
- },
339
- "required": false,
340
- "optional": false,
341
- "docs": {
342
- "tags": [],
343
- "text": ""
344
- },
345
- "getter": false,
346
- "setter": false,
347
- "reflect": false,
348
- "attribute": "related-class",
349
- "defaultValue": "''"
350
- },
351
- "mostSignificantClass": {
352
- "type": "string",
353
- "mutable": false,
354
- "complexType": {
355
- "original": "string",
356
- "resolved": "string",
357
- "references": {}
358
- },
359
- "required": false,
360
- "optional": false,
361
- "docs": {
362
- "tags": [],
363
- "text": "When set, used instead of relatedClass for search queries (mostSignificantClass from API)."
364
- },
365
- "getter": false,
366
- "setter": false,
367
- "reflect": false,
368
- "attribute": "most-significant-class",
369
- "defaultValue": "''"
370
- },
371
- "displayType": {
372
- "type": "string",
373
- "mutable": false,
374
- "complexType": {
375
- "original": "ClientLayoutItemRelationDisplayType",
376
- "resolved": "ClientLayoutItemRelationDisplayType.CHECKBOX | ClientLayoutItemRelationDisplayType.DROPDOWN | ClientLayoutItemRelationDisplayType.SEARCH",
377
- "references": {
378
- "ClientLayoutItemRelationDisplayType": {
379
- "location": "import",
380
- "path": "../../types",
381
- "id": "src/types/index.ts::ClientLayoutItemRelationDisplayType",
382
- "referenceLocation": "ClientLayoutItemRelationDisplayType"
383
- }
384
- }
385
- },
386
- "required": false,
387
- "optional": false,
388
- "docs": {
389
- "tags": [],
390
- "text": ""
391
- },
392
- "getter": false,
393
- "setter": false,
394
- "reflect": false,
395
- "attribute": "display-type",
396
- "defaultValue": "ClientLayoutItemRelationDisplayType.SEARCH"
397
- },
398
- "editBehavior": {
399
- "type": "string",
400
- "mutable": false,
401
- "complexType": {
402
- "original": "ClientLayoutItemRelationEditBehavior | null",
403
- "resolved": "ClientLayoutItemRelationEditBehavior.CHECKBOX | ClientLayoutItemRelationEditBehavior.DROPDOWN | ClientLayoutItemRelationEditBehavior.SEARCH | null | undefined",
404
- "references": {
405
- "ClientLayoutItemRelationEditBehavior": {
406
- "location": "import",
407
- "path": "../../types",
408
- "id": "src/types/index.ts::ClientLayoutItemRelationEditBehavior",
409
- "referenceLocation": "ClientLayoutItemRelationEditBehavior"
410
- }
411
- }
412
- },
413
- "required": false,
414
- "optional": true,
415
- "docs": {
416
- "tags": [],
417
- "text": ""
418
- },
419
- "getter": false,
420
- "setter": false,
421
- "reflect": false,
422
- "attribute": "edit-behavior"
423
- },
424
- "commonRelation": {
425
- "type": "string",
426
- "mutable": false,
427
- "complexType": {
428
- "original": "string",
429
- "resolved": "string | undefined",
430
- "references": {}
431
- },
432
- "required": false,
433
- "optional": true,
434
- "docs": {
435
- "tags": [],
436
- "text": ""
437
- },
438
- "getter": false,
439
- "setter": false,
440
- "reflect": false,
441
- "attribute": "common-relation"
442
- },
443
- "multiple": {
444
- "type": "boolean",
445
- "mutable": false,
446
- "complexType": {
447
- "original": "boolean",
448
- "resolved": "boolean",
449
- "references": {}
450
- },
451
- "required": false,
452
- "optional": false,
453
- "docs": {
454
- "tags": [],
455
- "text": ""
456
- },
457
- "getter": false,
458
- "setter": false,
459
- "reflect": false,
460
- "attribute": "multiple",
461
- "defaultValue": "false"
462
- },
463
- "dropdownValues": {
464
- "type": "unknown",
465
- "mutable": false,
466
- "complexType": {
467
- "original": "ClientListValue[]",
468
- "resolved": "ClientListValue[]",
469
- "references": {
470
- "ClientListValue": {
471
- "location": "import",
472
- "path": "../../types",
473
- "id": "src/types/index.ts::ClientListValue",
474
- "referenceLocation": "ClientListValue"
475
- }
476
- }
477
- },
478
- "required": false,
479
- "optional": false,
480
- "docs": {
481
- "tags": [],
482
- "text": ""
483
- },
484
- "getter": false,
485
- "setter": false,
486
- "defaultValue": "[]"
487
- },
488
- "value": {
489
- "type": "string",
490
- "mutable": false,
491
- "complexType": {
492
- "original": "string | string[] | RelationSearchResult | RelationSearchResult[] | null",
493
- "resolved": "RelationSearchResult | RelationSearchResult[] | null | string | string[]",
494
- "references": {
495
- "RelationSearchResult": {
496
- "location": "import",
497
- "path": "../../types",
498
- "id": "src/types/index.ts::RelationSearchResult",
499
- "referenceLocation": "RelationSearchResult"
500
- }
501
- }
502
- },
503
- "required": false,
504
- "optional": false,
505
- "docs": {
506
- "tags": [],
507
- "text": "Plain href string/array for normal use; pass { id, label } objects to pre-fill a loaded record."
508
- },
509
- "getter": false,
510
- "setter": false,
511
- "reflect": false,
512
- "attribute": "value",
513
- "defaultValue": "null"
514
- }
515
- };
516
- }
517
- static get states() {
518
- return {
519
- "searchQuery": {},
520
- "searchResults": {},
521
- "allRecords": {},
522
- "isLoading": {},
523
- "selectedItems": {},
524
- "showResults": {},
525
- "error": {},
526
- "highlightedIndex": {}
527
- };
528
- }
529
- static get events() {
530
- return [{
531
- "method": "mrdChange",
532
- "name": "mrdChange",
533
- "bubbles": true,
534
- "cancelable": true,
535
- "composed": true,
536
- "docs": {
537
- "tags": [],
538
- "text": ""
539
- },
540
- "complexType": {
541
- "original": "{ name: string; value: string | string[] | null }",
542
- "resolved": "{ name: string; value: string | string[] | null; }",
543
- "references": {}
544
- }
545
- }, {
546
- "method": "mrdBlur",
547
- "name": "mrdBlur",
548
- "bubbles": true,
549
- "cancelable": true,
550
- "composed": true,
551
- "docs": {
552
- "tags": [],
553
- "text": ""
554
- },
555
- "complexType": {
556
- "original": "{ name: string; value: string | string[] | null }",
557
- "resolved": "{ name: string; value: string | string[] | null; }",
558
- "references": {}
559
- }
560
- }, {
561
- "method": "mrdSearch",
562
- "name": "mrdSearch",
563
- "bubbles": true,
564
- "cancelable": true,
565
- "composed": true,
566
- "docs": {
567
- "tags": [],
568
- "text": ""
569
- },
570
- "complexType": {
571
- "original": "{ name: string; query: string; relatedClass: string }",
572
- "resolved": "{ name: string; query: string; relatedClass: string; }",
573
- "references": {}
574
- }
575
- }, {
576
- "method": "mrdFetchAll",
577
- "name": "mrdFetchAll",
578
- "bubbles": true,
579
- "cancelable": true,
580
- "composed": true,
581
- "docs": {
582
- "tags": [],
583
- "text": ""
584
- },
585
- "complexType": {
586
- "original": "{ name: string; relatedClass: string; mostSignificantClass?: string; commonRelation?: string; filter?: string; filterValue?: string }",
587
- "resolved": "{ name: string; relatedClass: string; mostSignificantClass?: string | undefined; commonRelation?: string | undefined; filter?: string | undefined; filterValue?: string | undefined; }",
588
- "references": {}
589
- }
590
- }];
591
- }
592
- static get methods() {
593
- return {
594
- "setAllRecords": {
595
- "complexType": {
596
- "signature": "(records: RelationSearchResult[]) => Promise<void>",
597
- "parameters": [{
598
- "name": "records",
599
- "type": "RelationSearchResult[]",
600
- "docs": ""
601
- }],
602
- "references": {
603
- "Promise": {
604
- "location": "global",
605
- "id": "global::Promise"
606
- },
607
- "RelationSearchResult": {
608
- "location": "import",
609
- "path": "../../types",
610
- "id": "src/types/index.ts::RelationSearchResult",
611
- "referenceLocation": "RelationSearchResult"
612
- }
613
- },
614
- "return": "Promise<void>"
615
- },
616
- "docs": {
617
- "text": "",
618
- "tags": []
619
- }
620
- },
621
- "setSearchResults": {
622
- "complexType": {
623
- "signature": "(results: RelationSearchResult[]) => Promise<void>",
624
- "parameters": [{
625
- "name": "results",
626
- "type": "RelationSearchResult[]",
627
- "docs": ""
628
- }],
629
- "references": {
630
- "Promise": {
631
- "location": "global",
632
- "id": "global::Promise"
633
- },
634
- "RelationSearchResult": {
635
- "location": "import",
636
- "path": "../../types",
637
- "id": "src/types/index.ts::RelationSearchResult",
638
- "referenceLocation": "RelationSearchResult"
639
- }
640
- },
641
- "return": "Promise<void>"
642
- },
643
- "docs": {
644
- "text": "",
645
- "tags": []
646
- }
647
- },
648
- "setLoading": {
649
- "complexType": {
650
- "signature": "(loading: boolean) => Promise<void>",
651
- "parameters": [{
652
- "name": "loading",
653
- "type": "boolean",
654
- "docs": ""
655
- }],
656
- "references": {
657
- "Promise": {
658
- "location": "global",
659
- "id": "global::Promise"
660
- }
661
- },
662
- "return": "Promise<void>"
663
- },
664
- "docs": {
665
- "text": "",
666
- "tags": []
667
- }
668
- }
669
- };
670
- }
671
- static get elementRef() { return "el"; }
672
- static get watchers() {
673
- return [{
674
- "propName": "allRecords",
675
- "methodName": "allRecordsChanged"
676
- }];
677
- }
678
- }