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