@limetech/lime-crm-building-blocks 1.96.0 → 1.98.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.
Files changed (179) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/{_MapCache-2e84a981.js → _MapCache-8b125fbb.js} +0 -26
  3. package/dist/cjs/{_Uint8Array-1e99726d.js → _Uint8Array-95263550.js} +1 -12
  4. package/dist/cjs/_baseIsEqual-cb7951b0.js +496 -0
  5. package/dist/cjs/_defineProperty-40a6ad5d.js +15 -0
  6. package/dist/cjs/{get-1acf79ce.js → get-932b213e.js} +5 -4
  7. package/dist/cjs/isEqual-e77cce75.js +37 -0
  8. package/dist/cjs/isSymbol-5b36aeee.js +30 -0
  9. package/dist/cjs/lime-crm-building-blocks.cjs.js +1 -1
  10. package/dist/cjs/lime-query.types-bcb63a22.js +61 -0
  11. package/dist/cjs/limebb-component-config.cjs.entry.js +3 -2
  12. package/dist/cjs/limebb-lime-query-builder.cjs.entry.js +378 -150
  13. package/dist/cjs/limebb-lime-query-filter-and_5.cjs.entry.js +278 -0
  14. package/dist/cjs/limebb-lime-query-value-input.cjs.entry.js +239 -0
  15. package/dist/cjs/limebb-limetype-field_2.cjs.entry.js +406 -0
  16. package/dist/cjs/limebb-live-docs-info.cjs.entry.js +2 -2
  17. package/dist/cjs/limebb-locale-picker.cjs.entry.js +13 -498
  18. package/dist/cjs/limebb-mention-group-counter.cjs.entry.js +2 -2
  19. package/dist/cjs/limebb-navigation-button_2.cjs.entry.js +3 -3
  20. package/dist/cjs/limebb-notification-item.cjs.entry.js +1 -1
  21. package/dist/cjs/limebb-percentage-visualizer.cjs.entry.js +2 -2
  22. package/dist/cjs/limebb-property-selector.cjs.entry.js +234 -0
  23. package/dist/cjs/limebb-response-format-item.cjs.entry.js +80 -0
  24. package/dist/cjs/limebb-text-editor.cjs.entry.js +20 -61
  25. package/dist/cjs/limebb-trend-indicator.cjs.entry.js +1 -1
  26. package/dist/cjs/limetype-1fe0207f.js +90 -0
  27. package/dist/cjs/loader.cjs.js +1 -1
  28. package/dist/cjs/property-resolution-fb42a46b.js +66 -0
  29. package/dist/collection/collection-manifest.json +10 -0
  30. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-and.css +121 -0
  31. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-and.js +257 -0
  32. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.css +39 -0
  33. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-comparison.js +246 -0
  34. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-expression.css +104 -0
  35. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-expression.js +220 -0
  36. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.css +107 -0
  37. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-not.js +212 -0
  38. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-or.css +123 -0
  39. package/dist/collection/components/lime-query-builder/expressions/lime-query-filter-or.js +237 -0
  40. package/dist/collection/components/lime-query-builder/expressions/lime-query-value-input.css +48 -0
  41. package/dist/collection/components/lime-query-builder/expressions/lime-query-value-input.js +457 -0
  42. package/dist/collection/components/lime-query-builder/filter-conversion.js +118 -21
  43. package/dist/collection/components/lime-query-builder/lime-query-builder.css +30 -17
  44. package/dist/collection/components/lime-query-builder/lime-query-builder.js +253 -27
  45. package/dist/collection/components/lime-query-builder/limetype-field/limetype-field.js +435 -0
  46. package/dist/collection/components/lime-query-builder/property-selection-format.js +158 -0
  47. package/dist/collection/components/lime-query-builder/property-selector/property-selector.css +8 -0
  48. package/dist/collection/components/lime-query-builder/property-selector/property-selector.js +422 -0
  49. package/dist/collection/components/lime-query-builder/response-format-editor.css +72 -0
  50. package/dist/collection/components/lime-query-builder/response-format-editor.js +249 -0
  51. package/dist/collection/components/lime-query-builder/response-format-item.css +61 -0
  52. package/dist/collection/components/lime-query-builder/response-format-item.js +208 -0
  53. package/dist/collection/components/limeobject/file-viewer/live-docs-info.js +2 -2
  54. package/dist/collection/components/locale-picker/locale-picker.js +1 -1
  55. package/dist/collection/components/notification-list/notification-item/notification-item.js +1 -1
  56. package/dist/collection/components/percentage-visualizer/percentage-visualizer.js +2 -2
  57. package/dist/collection/components/summary-popover/summary-popover.js +3 -3
  58. package/dist/collection/components/text-editor/mention-group-counter.js +2 -2
  59. package/dist/collection/components/text-editor/text-editor.js +1 -1
  60. package/dist/collection/components/trend-indicator/trend-indicator.js +1 -1
  61. package/dist/components/_MapCache.js +2 -27
  62. package/dist/components/_Uint8Array.js +2 -12
  63. package/dist/components/_baseIsEqual.js +494 -0
  64. package/dist/components/_defineProperty.js +13 -0
  65. package/dist/components/get.js +2 -1
  66. package/dist/components/isEqual.js +35 -0
  67. package/dist/components/isSymbol.js +28 -0
  68. package/dist/components/lime-query-filter-and.js +408 -0
  69. package/dist/components/lime-query-filter-comparison.js +152 -0
  70. package/dist/components/lime-query-value-input.js +266 -0
  71. package/dist/components/limebb-lime-query-builder.js +437 -149
  72. package/dist/components/limebb-lime-query-filter-and.d.ts +11 -0
  73. package/dist/components/limebb-lime-query-filter-and.js +6 -0
  74. package/dist/components/limebb-lime-query-filter-comparison.d.ts +11 -0
  75. package/dist/components/limebb-lime-query-filter-comparison.js +6 -0
  76. package/dist/components/limebb-lime-query-filter-expression.d.ts +11 -0
  77. package/dist/components/limebb-lime-query-filter-expression.js +6 -0
  78. package/dist/components/limebb-lime-query-filter-not.d.ts +11 -0
  79. package/dist/components/limebb-lime-query-filter-not.js +6 -0
  80. package/dist/components/limebb-lime-query-filter-or.d.ts +11 -0
  81. package/dist/components/limebb-lime-query-filter-or.js +6 -0
  82. package/dist/components/limebb-lime-query-value-input.d.ts +11 -0
  83. package/dist/components/limebb-lime-query-value-input.js +6 -0
  84. package/dist/components/limebb-limetype-field.d.ts +11 -0
  85. package/dist/components/limebb-limetype-field.js +6 -0
  86. package/dist/components/limebb-locale-picker.js +8 -493
  87. package/dist/components/limebb-mention-group-counter.js +2 -2
  88. package/dist/components/limebb-percentage-visualizer.js +2 -2
  89. package/dist/components/limebb-property-selector.d.ts +11 -0
  90. package/dist/components/limebb-property-selector.js +6 -0
  91. package/dist/components/limebb-response-format-editor.d.ts +11 -0
  92. package/dist/components/limebb-response-format-editor.js +6 -0
  93. package/dist/components/limebb-response-format-item.d.ts +11 -0
  94. package/dist/components/limebb-response-format-item.js +6 -0
  95. package/dist/components/limebb-text-editor.js +7 -48
  96. package/dist/components/limebb-trend-indicator.js +1 -1
  97. package/dist/components/limetype-field.js +184 -0
  98. package/dist/components/limetype.js +85 -0
  99. package/dist/components/live-docs-info.js +2 -2
  100. package/dist/components/notification-item.js +1 -1
  101. package/dist/components/property-selector.js +317 -0
  102. package/dist/components/response-format-editor.js +278 -0
  103. package/dist/components/response-format-item.js +104 -0
  104. package/dist/components/summary-popover.js +3 -3
  105. package/dist/esm/{_MapCache-6484495d.js → _MapCache-af496e9d.js} +2 -27
  106. package/dist/esm/{_Uint8Array-e5cac922.js → _Uint8Array-d6ebd526.js} +3 -13
  107. package/dist/esm/_baseIsEqual-28053b81.js +494 -0
  108. package/dist/esm/_defineProperty-e6a185c3.js +13 -0
  109. package/dist/esm/{get-f9e0b2e1.js → get-3e42932b.js} +2 -1
  110. package/dist/esm/isEqual-57d0c223.js +35 -0
  111. package/dist/esm/isSymbol-1c5f65cc.js +28 -0
  112. package/dist/esm/lime-crm-building-blocks.js +1 -1
  113. package/dist/esm/lime-query.types-f72355e1.js +59 -0
  114. package/dist/esm/limebb-component-config.entry.js +3 -2
  115. package/dist/esm/limebb-lime-query-builder.entry.js +375 -147
  116. package/dist/esm/limebb-lime-query-filter-and_5.entry.js +270 -0
  117. package/dist/esm/limebb-lime-query-value-input.entry.js +235 -0
  118. package/dist/esm/limebb-limetype-field_2.entry.js +401 -0
  119. package/dist/esm/limebb-live-docs-info.entry.js +2 -2
  120. package/dist/esm/limebb-locale-picker.entry.js +9 -494
  121. package/dist/esm/limebb-mention-group-counter.entry.js +2 -2
  122. package/dist/esm/limebb-navigation-button_2.entry.js +3 -3
  123. package/dist/esm/limebb-notification-item.entry.js +1 -1
  124. package/dist/esm/limebb-percentage-visualizer.entry.js +2 -2
  125. package/dist/esm/limebb-property-selector.entry.js +230 -0
  126. package/dist/esm/limebb-response-format-item.entry.js +76 -0
  127. package/dist/esm/limebb-text-editor.entry.js +7 -48
  128. package/dist/esm/limebb-trend-indicator.entry.js +1 -1
  129. package/dist/esm/limetype-6e7552a7.js +85 -0
  130. package/dist/esm/loader.js +1 -1
  131. package/dist/esm/property-resolution-fde2375e.js +63 -0
  132. package/dist/lime-crm-building-blocks/lime-crm-building-blocks.esm.js +1 -1
  133. package/dist/lime-crm-building-blocks/{p-88c64360.entry.js → p-00da9b24.entry.js} +1 -1
  134. package/dist/lime-crm-building-blocks/p-02c0cc04.entry.js +1 -0
  135. package/dist/lime-crm-building-blocks/p-0957b2a6.entry.js +1 -0
  136. package/dist/lime-crm-building-blocks/p-123190c3.js +1 -0
  137. package/dist/lime-crm-building-blocks/p-244ee55b.entry.js +1 -0
  138. package/dist/lime-crm-building-blocks/p-35897ec3.js +1 -0
  139. package/dist/lime-crm-building-blocks/{p-85b7291c.entry.js → p-3932077b.entry.js} +1 -1
  140. package/dist/lime-crm-building-blocks/p-3b0a15ec.js +1 -0
  141. package/dist/lime-crm-building-blocks/p-5a6d2e7f.js +1 -0
  142. package/dist/lime-crm-building-blocks/p-60971d64.js +1 -0
  143. package/dist/lime-crm-building-blocks/p-6c1146ca.entry.js +1 -0
  144. package/dist/lime-crm-building-blocks/p-70a28b93.entry.js +1 -0
  145. package/dist/lime-crm-building-blocks/p-7e6fb4af.js +1 -0
  146. package/dist/lime-crm-building-blocks/{p-8664381a.entry.js → p-8c4eb49f.entry.js} +1 -1
  147. package/dist/lime-crm-building-blocks/p-96beaabc.entry.js +1 -0
  148. package/dist/lime-crm-building-blocks/p-a659d55a.js +1 -0
  149. package/dist/lime-crm-building-blocks/p-baf4e428.entry.js +1 -0
  150. package/dist/lime-crm-building-blocks/p-d298b34e.js +1 -0
  151. package/dist/lime-crm-building-blocks/{p-7c4bdc1b.entry.js → p-d89c44ad.entry.js} +1 -1
  152. package/dist/lime-crm-building-blocks/p-e0ab1554.js +1 -0
  153. package/dist/lime-crm-building-blocks/{p-8064cbfb.entry.js → p-e9d23ef7.entry.js} +1 -1
  154. package/dist/lime-crm-building-blocks/p-ef8a5266.entry.js +1 -0
  155. package/dist/lime-crm-building-blocks/{p-c9126885.entry.js → p-f52125a0.entry.js} +1 -1
  156. package/dist/lime-crm-building-blocks/p-f99c611d.entry.js +1 -0
  157. package/dist/lime-crm-building-blocks/p-fe2b91d9.js +1 -0
  158. package/dist/types/components/lime-query-builder/expressions/lime-query-filter-and.d.ts +56 -0
  159. package/dist/types/components/lime-query-builder/expressions/lime-query-filter-comparison.d.ts +64 -0
  160. package/dist/types/components/lime-query-builder/expressions/lime-query-filter-expression.d.ts +53 -0
  161. package/dist/types/components/lime-query-builder/expressions/lime-query-filter-not.d.ts +54 -0
  162. package/dist/types/components/lime-query-builder/expressions/lime-query-filter-or.d.ts +55 -0
  163. package/dist/types/components/lime-query-builder/expressions/lime-query-value-input.d.ts +92 -0
  164. package/dist/types/components/lime-query-builder/filter-conversion.d.ts +18 -0
  165. package/dist/types/components/lime-query-builder/lime-query-builder.d.ts +40 -7
  166. package/dist/types/components/lime-query-builder/limetype-field/limetype-field.d.ts +96 -0
  167. package/dist/types/components/lime-query-builder/property-selection-format.d.ts +23 -0
  168. package/dist/types/components/lime-query-builder/property-selector/property-selector.d.ts +71 -0
  169. package/dist/types/components/lime-query-builder/response-format-editor.d.ts +57 -0
  170. package/dist/types/components/lime-query-builder/response-format-item.d.ts +46 -0
  171. package/dist/types/components.d.ts +1587 -114
  172. package/package.json +1 -1
  173. package/dist/lime-crm-building-blocks/p-00e7e0d4.entry.js +0 -1
  174. package/dist/lime-crm-building-blocks/p-11ac105b.entry.js +0 -1
  175. package/dist/lime-crm-building-blocks/p-5abe3fff.entry.js +0 -1
  176. package/dist/lime-crm-building-blocks/p-8044ffbd.js +0 -1
  177. package/dist/lime-crm-building-blocks/p-92ec9205.entry.js +0 -1
  178. package/dist/lime-crm-building-blocks/p-bcc23575.js +0 -1
  179. package/dist/lime-crm-building-blocks/p-c40a3f4b.js +0 -1
@@ -0,0 +1,401 @@
1
+ import { r as registerInstance, c as createEvent, h } from './index-96dd111f.js';
2
+ import { c } from './index.esm-d8fdeb18.js';
3
+ import { b as getIcon } from './limetype-6e7552a7.js';
4
+ import { i as isNonNull } from './non-null-5a66a269.js';
5
+ import { i as isEqual } from './isEqual-57d0c223.js';
6
+ import { i as isArray, a as isObjectLike, b as baseGetTag } from './_Map-aede53b6.js';
7
+ import './_baseIsEqual-28053b81.js';
8
+ import './_Uint8Array-d6ebd526.js';
9
+ import './_MapCache-af496e9d.js';
10
+ import './_getTag-d02a95fa.js';
11
+
12
+ /** `Object#toString` result references. */
13
+ var stringTag = '[object String]';
14
+
15
+ /**
16
+ * Checks if `value` is classified as a `String` primitive or object.
17
+ *
18
+ * @static
19
+ * @since 0.1.0
20
+ * @memberOf _
21
+ * @category Lang
22
+ * @param {*} value The value to check.
23
+ * @returns {boolean} Returns `true` if `value` is a string, else `false`.
24
+ * @example
25
+ *
26
+ * _.isString('abc');
27
+ * // => true
28
+ *
29
+ * _.isString(1);
30
+ * // => false
31
+ */
32
+ function isString(value) {
33
+ return typeof value == 'string' ||
34
+ (!isArray(value) && isObjectLike(value) && baseGetTag(value) == stringTag);
35
+ }
36
+
37
+ const RELATION_PROPERTY_TYPES = [
38
+ 'belongsto',
39
+ 'hasone',
40
+ 'hasmany',
41
+ 'hasandbelongstomany',
42
+ ];
43
+ const DEFAULT_ALLOWED_PROPERTY_TYPES = [
44
+ 'string',
45
+ 'text',
46
+ 'phone',
47
+ 'integer',
48
+ 'decimal',
49
+ 'percent',
50
+ 'time',
51
+ 'date',
52
+ 'year',
53
+ 'quarter',
54
+ 'month',
55
+ 'yesno',
56
+ 'link',
57
+ 'user',
58
+ 'xml',
59
+ 'option',
60
+ 'set',
61
+ 'file',
62
+ 'system',
63
+ ];
64
+
65
+ const allNonSystemPropertyTypes = DEFAULT_ALLOWED_PROPERTY_TYPES.filter((propertyType) => propertyType !== 'system');
66
+ allNonSystemPropertyTypes.push(...RELATION_PROPERTY_TYPES);
67
+ const LimetypeField = class {
68
+ constructor(hostRef) {
69
+ registerInstance(this, hostRef);
70
+ this.change = createEvent(this, "change", 7);
71
+ /**
72
+ * A list of property fields that should be updated when the selected limetype changes.
73
+ */
74
+ this.propertyFields = [];
75
+ /**
76
+ * The name of this field. May be used as reference when a property mapping
77
+ * depends on the selected limetype.
78
+ */
79
+ this.fieldName = 'limetype';
80
+ this.handleChange = (event) => {
81
+ event.stopPropagation();
82
+ let selectedLimetype = '';
83
+ if (event.detail && 'value' in event.detail) {
84
+ selectedLimetype = event.detail.value;
85
+ }
86
+ this.change.emit(selectedLimetype || undefined);
87
+ };
88
+ }
89
+ componentWillLoad() {
90
+ const language = this.platform
91
+ .get(c.Application)
92
+ .getLanguage();
93
+ this.collator = new Intl.Collator(language, {
94
+ numeric: true,
95
+ sensitivity: 'base',
96
+ });
97
+ }
98
+ componentShouldUpdate(newValue, oldValue, property) {
99
+ var _a, _b;
100
+ return (property !== 'formInfo' ||
101
+ !isEqual((_a = newValue === null || newValue === void 0 ? void 0 : newValue.schema) === null || _a === void 0 ? void 0 : _a.oneOf, (_b = oldValue === null || oldValue === void 0 ? void 0 : oldValue.schema) === null || _b === void 0 ? void 0 : _b.oneOf));
102
+ }
103
+ render() {
104
+ var _a;
105
+ const options = this.getLimeTypes().map(limeTypeToOption);
106
+ options.sort((a, b) => this.collator.compare(a.text, b.text));
107
+ let selectedOption = options.find((option) => option.value === this.value);
108
+ let invalid = this.invalid;
109
+ if (this.value && !selectedOption) {
110
+ invalid = true;
111
+ options.unshift({
112
+ text: ((_a = this.limeTypeRepository.getLimeType(this.value)) === null || _a === void 0 ? void 0 : _a.localname.singular) || this.value,
113
+ value: this.value,
114
+ });
115
+ selectedOption = options[0];
116
+ }
117
+ const emptyOption = {
118
+ text: '',
119
+ value: '',
120
+ };
121
+ options.unshift(emptyOption);
122
+ return (h("limel-select", { key: '82ce4b92e4ff1285e259f07a35634df722f5baab', label: this.label, options: options, value: selectedOption, required: this.required, helperText: this.helperText, invalid: invalid, disabled: this.disabled || this.readonly, onChange: this.handleChange }));
123
+ }
124
+ componentWillRender() {
125
+ this.updatePropertyFields(this.value || '');
126
+ }
127
+ getLimeTypes() {
128
+ var _a, _b;
129
+ let limetypes = this.limetypes;
130
+ if ((_b = (_a = this.formInfo) === null || _a === void 0 ? void 0 : _a.schema) === null || _b === void 0 ? void 0 : _b.oneOf) {
131
+ limetypes = this.formInfo.schema.oneOf
132
+ .map((choice) => choice.const)
133
+ .filter(isString);
134
+ }
135
+ if (!limetypes) {
136
+ return this.limeTypeRepository.getLimeTypes();
137
+ }
138
+ return limetypes
139
+ .map((limetype) => this.limeTypeRepository.getLimeType(limetype))
140
+ .filter(isNonNull);
141
+ }
142
+ updatePropertyFields(selectedLimetype) {
143
+ for (const field of this.propertyFields) {
144
+ field.limetype = selectedLimetype;
145
+ if (field.allowedPropertyTypes === DEFAULT_ALLOWED_PROPERTY_TYPES) {
146
+ field.allowedPropertyTypes = allNonSystemPropertyTypes;
147
+ }
148
+ }
149
+ }
150
+ get limeTypeRepository() {
151
+ return this.platform.get(c.LimeTypeRepository);
152
+ }
153
+ };
154
+ const limeTypeToOption = (limetype) => ({
155
+ text: limetype.localname.singular,
156
+ value: limetype.name,
157
+ icon: getIcon(limetype),
158
+ });
159
+
160
+ /**
161
+ * Process a single property value and add to items array
162
+ * @param items Array to add items to
163
+ * @param fullPath Full property path
164
+ * @param value Property value to process
165
+ */
166
+ function processPropertyValue(items, fullPath, value) {
167
+ if (value === null) {
168
+ items.push({ path: fullPath });
169
+ return;
170
+ }
171
+ // Cast to record for checking
172
+ const valueObj = value;
173
+ const keys = Object.keys(valueObj);
174
+ const hasAlias = '_alias' in valueObj;
175
+ const hasDescription = '#description' in valueObj;
176
+ const otherKeys = keys.filter((k) => k !== '_alias' && k !== '#description');
177
+ // If it's {} or only has metadata (_alias, #description), treat as simple property
178
+ if (otherKeys.length === 0) {
179
+ const aliasValue = valueObj._alias;
180
+ const descriptionValue = valueObj['#description'];
181
+ if (aliasValue || descriptionValue) {
182
+ items.push({
183
+ path: fullPath,
184
+ alias: aliasValue,
185
+ description: descriptionValue,
186
+ });
187
+ }
188
+ else {
189
+ items.push({ path: fullPath });
190
+ }
191
+ return;
192
+ }
193
+ // If has metadata + other properties, we need to handle both
194
+ // Add the nested properties (metadata is preserved in conversion back)
195
+ if (hasAlias || hasDescription) {
196
+ // Build a PropertySelection without the metadata for recursion
197
+ const nestedSelection = {};
198
+ for (const key of otherKeys) {
199
+ nestedSelection[key] = valueObj[key];
200
+ }
201
+ items.push(...propertySelectionToItems(nestedSelection, fullPath));
202
+ return;
203
+ }
204
+ // Nested property selection without metadata
205
+ items.push(...propertySelectionToItems(value, fullPath));
206
+ }
207
+ /**
208
+ * Convert a nested PropertySelection to a flat list of property items
209
+ * @param selection The nested PropertySelection object
210
+ * @param prefix Current path prefix (used for recursion)
211
+ * @returns Flat array of PropertySelectionItem objects
212
+ */
213
+ function propertySelectionToItems(selection, prefix = '') {
214
+ if (!selection) {
215
+ return [];
216
+ }
217
+ const items = [];
218
+ for (const [key, value] of Object.entries(selection)) {
219
+ const fullPath = prefix ? `${prefix}.${key}` : key;
220
+ if (typeof value === 'object') {
221
+ // NOTE: We want to send null values to the processPropertyValue
222
+ // function but we don't need a special check for null, since
223
+ // `typeof null === 'object'`
224
+ processPropertyValue(items, fullPath, value);
225
+ }
226
+ }
227
+ return items;
228
+ }
229
+ /**
230
+ * Set the final property value (with or without alias/description)
231
+ * @param current Current PropertySelection object
232
+ * @param part Property name/key
233
+ * @param item Property selection item with path and optional alias/description
234
+ */
235
+ function setPropertyValue(current, part, item) {
236
+ // Check if there's already a nested PropertySelection with properties
237
+ const existing = current[part];
238
+ if (existing &&
239
+ typeof existing === 'object' &&
240
+ !('_alias' in existing) &&
241
+ !('#description' in existing)) {
242
+ // There's already a nested PropertySelection object with properties
243
+ // Don't overwrite it - preserve the nested selections
244
+ return;
245
+ }
246
+ // Build metadata object, stripping empty values
247
+ const metadata = {};
248
+ if (item.alias && item.alias.trim() !== '') {
249
+ metadata._alias = item.alias;
250
+ }
251
+ if (item.description && item.description.trim() !== '') {
252
+ metadata['#description'] = item.description;
253
+ }
254
+ // If we have metadata, use it; otherwise use null
255
+ if (Object.keys(metadata).length > 0) {
256
+ current[part] = metadata;
257
+ }
258
+ else {
259
+ current[part] = null;
260
+ }
261
+ }
262
+ /**
263
+ * Ensure a nested object exists and return it
264
+ * Preserves any existing _alias and #description when converting to nested object
265
+ * @param current Current PropertySelection object
266
+ * @param part Property name/key
267
+ * @returns The nested PropertySelection object
268
+ */
269
+ function ensureNestedObject(current, part) {
270
+ const existing = current[part];
271
+ // If doesn't exist or is null, create empty object
272
+ if (!existing) {
273
+ current[part] = {};
274
+ return current[part];
275
+ }
276
+ // If it's already a PropertySelection object, check for metadata
277
+ if (typeof existing === 'object') {
278
+ const existingObj = existing;
279
+ // If it has metadata but no other properties, preserve the metadata
280
+ const keys = Object.keys(existingObj);
281
+ const hasMetadata = '_alias' in existingObj || '#description' in existingObj;
282
+ const otherKeys = keys.filter((k) => k !== '_alias' && k !== '#description');
283
+ if (hasMetadata && otherKeys.length === 0) {
284
+ // Convert { _alias: "...", "#description": "..." } to { _alias: "...", "#description": "...", ...nested }
285
+ // Keep the existing object and return it (caller will add nested props)
286
+ return existingObj;
287
+ }
288
+ // Already has nested properties, return as is
289
+ return existingObj;
290
+ }
291
+ // Shouldn't reach here, but fallback to creating new object
292
+ current[part] = {};
293
+ return current[part];
294
+ }
295
+ /**
296
+ * Convert a flat list of property items to a nested PropertySelection structure
297
+ * @param items Array of PropertySelectionItem objects
298
+ * @returns Nested PropertySelection object
299
+ */
300
+ function itemsToPropertySelection(items) {
301
+ const result = {};
302
+ for (const item of items) {
303
+ const parts = item.path.split('.');
304
+ let current = result;
305
+ for (let i = 0; i < parts.length; i++) {
306
+ const part = parts[i];
307
+ const isLast = i === parts.length - 1;
308
+ if (isLast) {
309
+ setPropertyValue(current, part, item);
310
+ }
311
+ else {
312
+ current = ensureNestedObject(current, part);
313
+ }
314
+ }
315
+ }
316
+ return result;
317
+ }
318
+
319
+ const responseFormatEditorCss = ":host(limebb-response-format-editor){display:block;width:100%}.response-format-editor{display:flex;flex-direction:column;gap:1rem;padding:1rem}.header{display:flex;justify-content:space-between;align-items:center;gap:1rem}.header h4{margin:0;font-size:1rem;font-weight:600;color:rgb(var(--contrast-1000))}.property-list{display:flex;flex-direction:column;gap:1rem;padding:0.5rem;border:1px solid rgb(var(--contrast-300));border-radius:0.25rem;background-color:rgb(var(--contrast-50));min-height:4rem}.property-item{padding:0.5rem;border-radius:0.25rem;transition:background-color 0.2s}.property-item:hover{background-color:rgb(var(--contrast-100))}.actions{display:flex;justify-content:flex-start}.summary{display:flex;justify-content:space-between;align-items:center;padding-top:0.5rem;border-top:1px solid rgb(var(--contrast-300))}.summary .count{font-size:0.875rem;font-weight:500;color:rgb(var(--contrast-900))}.empty-state{padding:2rem;text-align:center;color:rgb(var(--contrast-700));font-style:italic}.empty-state p{margin:0}";
320
+ const LimebbResponseFormatEditorStyle0 = responseFormatEditorCss;
321
+
322
+ const ResponseFormatEditor = class {
323
+ constructor(hostRef) {
324
+ registerInstance(this, hostRef);
325
+ this.change = createEvent(this, "change", 7);
326
+ /**
327
+ * Optional label
328
+ */
329
+ this.label = 'Select Properties to Return';
330
+ this.items = [{ path: '_id' }];
331
+ this.handleItemChange = (index) => (event) => {
332
+ event.stopPropagation();
333
+ const newItems = [...this.items];
334
+ if (event.detail === null) {
335
+ // Remove item
336
+ newItems.splice(index, 1);
337
+ }
338
+ else {
339
+ // Update item
340
+ newItems[index] = event.detail;
341
+ }
342
+ // Ensure we always have at least _id
343
+ if (newItems.length === 0) {
344
+ newItems.push({ path: '_id' });
345
+ }
346
+ this.items = newItems;
347
+ this.emitChange();
348
+ };
349
+ this.handleAddProperty = () => {
350
+ this.items = [...this.items, { path: '' }];
351
+ this.emitChange();
352
+ };
353
+ }
354
+ componentWillLoad() {
355
+ var _a;
356
+ if ((_a = this.value) === null || _a === void 0 ? void 0 : _a.object) {
357
+ const converted = propertySelectionToItems(this.value.object);
358
+ if (converted.length > 0) {
359
+ this.items = converted;
360
+ }
361
+ }
362
+ }
363
+ componentWillUpdate() {
364
+ var _a;
365
+ if ((_a = this.value) === null || _a === void 0 ? void 0 : _a.object) {
366
+ const currentItems = propertySelectionToItems(this.value.object);
367
+ // Check if items have changed
368
+ const itemsChanged = currentItems.length !== this.items.length ||
369
+ !currentItems.every((item, index) => {
370
+ const current = this.items[index];
371
+ return (current &&
372
+ item.path === current.path &&
373
+ item.alias === current.alias &&
374
+ item.description === current.description);
375
+ });
376
+ if (itemsChanged) {
377
+ this.items =
378
+ currentItems.length > 0 ? currentItems : [{ path: '_id' }];
379
+ }
380
+ }
381
+ }
382
+ render() {
383
+ if (!this.limetype) {
384
+ return (h("div", { class: "empty-state" }, h("p", null, "Select a limetype to choose properties")));
385
+ }
386
+ return (h("div", { class: "response-format-editor" }, h("div", { class: "header" }, h("h4", null, this.label)), h("div", { class: "property-list" }, this.items.map((item, index) => this.renderItem(item, index))), h("div", { class: "actions" }, h("limel-button", { label: "Add Property", icon: "plus_math", onClick: this.handleAddProperty })), h("div", { class: "summary" }, h("span", { class: "count" }, this.items.length, ' ', this.items.length === 1 ? 'property' : 'properties', ' ', "selected"))));
387
+ }
388
+ renderItem(item, index) {
389
+ return (h("limebb-response-format-item", { key: `${item.path}-${index}`, class: "property-item", platform: this.platform, context: this.context, limetype: this.limetype, item: item, onItemChange: this.handleItemChange(index) }));
390
+ }
391
+ emitChange() {
392
+ const propertySelection = itemsToPropertySelection(this.items);
393
+ const responseFormat = {
394
+ object: propertySelection,
395
+ };
396
+ this.change.emit(responseFormat);
397
+ }
398
+ };
399
+ ResponseFormatEditor.style = LimebbResponseFormatEditorStyle0;
400
+
401
+ export { LimetypeField as limebb_limetype_field, ResponseFormatEditor as limebb_response_format_editor };
@@ -9,8 +9,8 @@ const LiveDocsInfo = class {
9
9
  }
10
10
  render() {
11
11
  return [
12
- h("div", { key: '4a4d9cfcfb7b37d5f98cef9a5e963b47125188b7', class: "header" }, h("limel-icon", { key: '832c49b5cbd38319e1a36eaff63a41417713d2c3', name: "not_showing_video_frames" }), h("h2", { key: '8e19c71383923d6964df4308fe030e68d69c9e46' }, "Viewing this file type requires ", h("em", { key: '9c5c93d320748dc4ff19c682d4228acca653e5b1' }, "Live Docs"))),
13
- h("p", { key: '157a0f930aba54e52e8c777a90cd3445bf80fa5d' }, h("em", { key: '4db4bc76949be8ef1668e9ce7f416c1a3f66aa44' }, "Live Docs"), " not only enables you to view many file formats such as Microsoft Office documents, but it also empowers you to edit them right in the CRM. No need to download anything on your device!", h("a", { key: 'cf2e7bb006ab10ca91b60f740919d937e36974b2', target: "_blank", href: "https://www.lime-technologies.com/en/lime-crm/live-docs/" }, "Learn more")),
12
+ h("div", { key: '98c48e74c9cade3b2da713618d585dd8f80e3116', class: "header" }, h("limel-icon", { key: 'b8f56066533f64842a25a324c2794914700c2e8a', name: "not_showing_video_frames" }), h("h2", { key: 'c1e8c722d1fc7d22a85f348a66094ffd8c5a5dd3' }, "Viewing this file type requires ", h("em", { key: '8aca798b2cf1bfe81be5142496e693f57efea8b1' }, "Live Docs"))),
13
+ h("p", { key: '3934d0c93f6c4b6524643c2ecadd0f3f0f925b09' }, h("em", { key: '1d3b811bf94ba19644231e77434442f9f1ade8f6' }, "Live Docs"), " not only enables you to view many file formats such as Microsoft Office documents, but it also empowers you to edit them right in the CRM. No need to download anything on your device!", h("a", { key: '023c16b0cfc5b57d750c9a344690fcce51350100', target: "_blank", href: "https://www.lime-technologies.com/en/lime-crm/live-docs/" }, "Learn more")),
14
14
  ];
15
15
  }
16
16
  };