@limetech/lime-crm-building-blocks 1.96.0 → 1.97.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 +7 -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 +382 -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 +233 -28
- 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 +441 -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 +379 -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-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-b7c72179.entry.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 +30 -8
- 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 +1558 -117
- 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,435 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { PlatformServiceName, } from "@limetech/lime-web-components";
|
|
3
|
+
import { DEFAULT_ALLOWED_PROPERTY_TYPES, RELATION_PROPERTY_TYPES, } from "../property-types";
|
|
4
|
+
import { getIcon } from "../../../util/limetype";
|
|
5
|
+
import { isEqual, isString } from "lodash-es";
|
|
6
|
+
import { isNonNull } from "../../../util/non-null";
|
|
7
|
+
const allNonSystemPropertyTypes = DEFAULT_ALLOWED_PROPERTY_TYPES.filter((propertyType) => propertyType !== 'system');
|
|
8
|
+
allNonSystemPropertyTypes.push(...RELATION_PROPERTY_TYPES);
|
|
9
|
+
/**
|
|
10
|
+
* Limetype Field Component
|
|
11
|
+
*
|
|
12
|
+
* A dropdown selector for choosing a limetype (object type) from the available
|
|
13
|
+
* limetypes in the system.
|
|
14
|
+
*
|
|
15
|
+
* This component:
|
|
16
|
+
* - Displays all limetypes with their icons and localized names
|
|
17
|
+
* - Supports restricting to a specific list of limetypes
|
|
18
|
+
* - Can update dependent property-path fields when selection changes
|
|
19
|
+
* - Implements the FormComponent interface for use in forms
|
|
20
|
+
*
|
|
21
|
+
* Common use cases:
|
|
22
|
+
* - Selecting which object type to query in a lime query builder
|
|
23
|
+
* - Choosing target limetype for relations
|
|
24
|
+
* - Configuring limetype-dependent settings
|
|
25
|
+
*
|
|
26
|
+
* @private
|
|
27
|
+
*/
|
|
28
|
+
export class LimetypeField {
|
|
29
|
+
constructor() {
|
|
30
|
+
/**
|
|
31
|
+
* A list of property fields that should be updated when the selected limetype changes.
|
|
32
|
+
*/
|
|
33
|
+
this.propertyFields = [];
|
|
34
|
+
/**
|
|
35
|
+
* The name of this field. May be used as reference when a property mapping
|
|
36
|
+
* depends on the selected limetype.
|
|
37
|
+
*/
|
|
38
|
+
this.fieldName = 'limetype';
|
|
39
|
+
this.handleChange = (event) => {
|
|
40
|
+
event.stopPropagation();
|
|
41
|
+
let selectedLimetype = '';
|
|
42
|
+
if (event.detail && 'value' in event.detail) {
|
|
43
|
+
selectedLimetype = event.detail.value;
|
|
44
|
+
}
|
|
45
|
+
this.change.emit(selectedLimetype || undefined);
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
componentWillLoad() {
|
|
49
|
+
const language = this.platform
|
|
50
|
+
.get(PlatformServiceName.Application)
|
|
51
|
+
.getLanguage();
|
|
52
|
+
this.collator = new Intl.Collator(language, {
|
|
53
|
+
numeric: true,
|
|
54
|
+
sensitivity: 'base',
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
componentShouldUpdate(newValue, oldValue, property) {
|
|
58
|
+
var _a, _b;
|
|
59
|
+
return (property !== 'formInfo' ||
|
|
60
|
+
!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));
|
|
61
|
+
}
|
|
62
|
+
render() {
|
|
63
|
+
var _a;
|
|
64
|
+
const options = this.getLimeTypes().map(limeTypeToOption);
|
|
65
|
+
options.sort((a, b) => this.collator.compare(a.text, b.text));
|
|
66
|
+
let selectedOption = options.find((option) => option.value === this.value);
|
|
67
|
+
let invalid = this.invalid;
|
|
68
|
+
if (this.value && !selectedOption) {
|
|
69
|
+
invalid = true;
|
|
70
|
+
options.unshift({
|
|
71
|
+
text: ((_a = this.limeTypeRepository.getLimeType(this.value)) === null || _a === void 0 ? void 0 : _a.localname.singular) || this.value,
|
|
72
|
+
value: this.value,
|
|
73
|
+
});
|
|
74
|
+
selectedOption = options[0];
|
|
75
|
+
}
|
|
76
|
+
const emptyOption = {
|
|
77
|
+
text: '',
|
|
78
|
+
value: '',
|
|
79
|
+
};
|
|
80
|
+
options.unshift(emptyOption);
|
|
81
|
+
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 }));
|
|
82
|
+
}
|
|
83
|
+
componentWillRender() {
|
|
84
|
+
this.updatePropertyFields(this.value || '');
|
|
85
|
+
}
|
|
86
|
+
getLimeTypes() {
|
|
87
|
+
var _a, _b;
|
|
88
|
+
let limetypes = this.limetypes;
|
|
89
|
+
if ((_b = (_a = this.formInfo) === null || _a === void 0 ? void 0 : _a.schema) === null || _b === void 0 ? void 0 : _b.oneOf) {
|
|
90
|
+
limetypes = this.formInfo.schema.oneOf
|
|
91
|
+
.map((choice) => choice.const)
|
|
92
|
+
.filter(isString);
|
|
93
|
+
}
|
|
94
|
+
if (!limetypes) {
|
|
95
|
+
return this.limeTypeRepository.getLimeTypes();
|
|
96
|
+
}
|
|
97
|
+
return limetypes
|
|
98
|
+
.map((limetype) => this.limeTypeRepository.getLimeType(limetype))
|
|
99
|
+
.filter(isNonNull);
|
|
100
|
+
}
|
|
101
|
+
updatePropertyFields(selectedLimetype) {
|
|
102
|
+
for (const field of this.propertyFields) {
|
|
103
|
+
field.limetype = selectedLimetype;
|
|
104
|
+
if (field.allowedPropertyTypes === DEFAULT_ALLOWED_PROPERTY_TYPES) {
|
|
105
|
+
field.allowedPropertyTypes = allNonSystemPropertyTypes;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
get limeTypeRepository() {
|
|
110
|
+
return this.platform.get(PlatformServiceName.LimeTypeRepository);
|
|
111
|
+
}
|
|
112
|
+
static get is() { return "limebb-limetype-field"; }
|
|
113
|
+
static get properties() {
|
|
114
|
+
return {
|
|
115
|
+
"platform": {
|
|
116
|
+
"type": "unknown",
|
|
117
|
+
"mutable": false,
|
|
118
|
+
"complexType": {
|
|
119
|
+
"original": "LimeWebComponentPlatform",
|
|
120
|
+
"resolved": "LimeWebComponentPlatform",
|
|
121
|
+
"references": {
|
|
122
|
+
"LimeWebComponentPlatform": {
|
|
123
|
+
"location": "import",
|
|
124
|
+
"path": "@limetech/lime-web-components",
|
|
125
|
+
"id": "node_modules::LimeWebComponentPlatform"
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
"required": false,
|
|
130
|
+
"optional": false,
|
|
131
|
+
"docs": {
|
|
132
|
+
"tags": [{
|
|
133
|
+
"name": "inheritdoc",
|
|
134
|
+
"text": undefined
|
|
135
|
+
}],
|
|
136
|
+
"text": "Reference to the platform"
|
|
137
|
+
},
|
|
138
|
+
"getter": false,
|
|
139
|
+
"setter": false
|
|
140
|
+
},
|
|
141
|
+
"context": {
|
|
142
|
+
"type": "unknown",
|
|
143
|
+
"mutable": false,
|
|
144
|
+
"complexType": {
|
|
145
|
+
"original": "LimeWebComponentContext",
|
|
146
|
+
"resolved": "LimeWebComponentContext",
|
|
147
|
+
"references": {
|
|
148
|
+
"LimeWebComponentContext": {
|
|
149
|
+
"location": "import",
|
|
150
|
+
"path": "@limetech/lime-web-components",
|
|
151
|
+
"id": "node_modules::LimeWebComponentContext"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"required": false,
|
|
156
|
+
"optional": false,
|
|
157
|
+
"docs": {
|
|
158
|
+
"tags": [{
|
|
159
|
+
"name": "inheritdoc",
|
|
160
|
+
"text": undefined
|
|
161
|
+
}],
|
|
162
|
+
"text": "The context this component belongs to"
|
|
163
|
+
},
|
|
164
|
+
"getter": false,
|
|
165
|
+
"setter": false
|
|
166
|
+
},
|
|
167
|
+
"label": {
|
|
168
|
+
"type": "string",
|
|
169
|
+
"mutable": false,
|
|
170
|
+
"complexType": {
|
|
171
|
+
"original": "string",
|
|
172
|
+
"resolved": "string",
|
|
173
|
+
"references": {}
|
|
174
|
+
},
|
|
175
|
+
"required": false,
|
|
176
|
+
"optional": false,
|
|
177
|
+
"docs": {
|
|
178
|
+
"tags": [{
|
|
179
|
+
"name": "inheritdoc",
|
|
180
|
+
"text": undefined
|
|
181
|
+
}],
|
|
182
|
+
"text": "The label of the current property"
|
|
183
|
+
},
|
|
184
|
+
"getter": false,
|
|
185
|
+
"setter": false,
|
|
186
|
+
"attribute": "label",
|
|
187
|
+
"reflect": true
|
|
188
|
+
},
|
|
189
|
+
"required": {
|
|
190
|
+
"type": "boolean",
|
|
191
|
+
"mutable": false,
|
|
192
|
+
"complexType": {
|
|
193
|
+
"original": "boolean",
|
|
194
|
+
"resolved": "boolean",
|
|
195
|
+
"references": {}
|
|
196
|
+
},
|
|
197
|
+
"required": false,
|
|
198
|
+
"optional": false,
|
|
199
|
+
"docs": {
|
|
200
|
+
"tags": [{
|
|
201
|
+
"name": "inheritdoc",
|
|
202
|
+
"text": undefined
|
|
203
|
+
}],
|
|
204
|
+
"text": "Whether or not the current property is required"
|
|
205
|
+
},
|
|
206
|
+
"getter": false,
|
|
207
|
+
"setter": false,
|
|
208
|
+
"attribute": "required",
|
|
209
|
+
"reflect": true
|
|
210
|
+
},
|
|
211
|
+
"readonly": {
|
|
212
|
+
"type": "boolean",
|
|
213
|
+
"mutable": false,
|
|
214
|
+
"complexType": {
|
|
215
|
+
"original": "boolean",
|
|
216
|
+
"resolved": "boolean",
|
|
217
|
+
"references": {}
|
|
218
|
+
},
|
|
219
|
+
"required": false,
|
|
220
|
+
"optional": false,
|
|
221
|
+
"docs": {
|
|
222
|
+
"tags": [{
|
|
223
|
+
"name": "inheritdoc",
|
|
224
|
+
"text": undefined
|
|
225
|
+
}],
|
|
226
|
+
"text": "Whether or not the current property is readonly"
|
|
227
|
+
},
|
|
228
|
+
"getter": false,
|
|
229
|
+
"setter": false,
|
|
230
|
+
"attribute": "readonly",
|
|
231
|
+
"reflect": true
|
|
232
|
+
},
|
|
233
|
+
"disabled": {
|
|
234
|
+
"type": "boolean",
|
|
235
|
+
"mutable": false,
|
|
236
|
+
"complexType": {
|
|
237
|
+
"original": "boolean",
|
|
238
|
+
"resolved": "boolean",
|
|
239
|
+
"references": {}
|
|
240
|
+
},
|
|
241
|
+
"required": false,
|
|
242
|
+
"optional": false,
|
|
243
|
+
"docs": {
|
|
244
|
+
"tags": [{
|
|
245
|
+
"name": "inheritdoc",
|
|
246
|
+
"text": undefined
|
|
247
|
+
}],
|
|
248
|
+
"text": "Whether or not the current property is disabled"
|
|
249
|
+
},
|
|
250
|
+
"getter": false,
|
|
251
|
+
"setter": false,
|
|
252
|
+
"attribute": "disabled",
|
|
253
|
+
"reflect": true
|
|
254
|
+
},
|
|
255
|
+
"value": {
|
|
256
|
+
"type": "string",
|
|
257
|
+
"mutable": false,
|
|
258
|
+
"complexType": {
|
|
259
|
+
"original": "string",
|
|
260
|
+
"resolved": "string",
|
|
261
|
+
"references": {}
|
|
262
|
+
},
|
|
263
|
+
"required": false,
|
|
264
|
+
"optional": false,
|
|
265
|
+
"docs": {
|
|
266
|
+
"tags": [{
|
|
267
|
+
"name": "inheritdoc",
|
|
268
|
+
"text": undefined
|
|
269
|
+
}],
|
|
270
|
+
"text": "The value of the current property"
|
|
271
|
+
},
|
|
272
|
+
"getter": false,
|
|
273
|
+
"setter": false,
|
|
274
|
+
"attribute": "value",
|
|
275
|
+
"reflect": true
|
|
276
|
+
},
|
|
277
|
+
"helperText": {
|
|
278
|
+
"type": "string",
|
|
279
|
+
"mutable": false,
|
|
280
|
+
"complexType": {
|
|
281
|
+
"original": "string",
|
|
282
|
+
"resolved": "string",
|
|
283
|
+
"references": {}
|
|
284
|
+
},
|
|
285
|
+
"required": false,
|
|
286
|
+
"optional": false,
|
|
287
|
+
"docs": {
|
|
288
|
+
"tags": [{
|
|
289
|
+
"name": "inheritdoc",
|
|
290
|
+
"text": undefined
|
|
291
|
+
}],
|
|
292
|
+
"text": "The helper text for the current property"
|
|
293
|
+
},
|
|
294
|
+
"getter": false,
|
|
295
|
+
"setter": false,
|
|
296
|
+
"attribute": "helper-text",
|
|
297
|
+
"reflect": true
|
|
298
|
+
},
|
|
299
|
+
"invalid": {
|
|
300
|
+
"type": "boolean",
|
|
301
|
+
"mutable": false,
|
|
302
|
+
"complexType": {
|
|
303
|
+
"original": "boolean",
|
|
304
|
+
"resolved": "boolean",
|
|
305
|
+
"references": {}
|
|
306
|
+
},
|
|
307
|
+
"required": false,
|
|
308
|
+
"optional": false,
|
|
309
|
+
"docs": {
|
|
310
|
+
"tags": [{
|
|
311
|
+
"name": "inheritdoc",
|
|
312
|
+
"text": undefined
|
|
313
|
+
}],
|
|
314
|
+
"text": ""
|
|
315
|
+
},
|
|
316
|
+
"getter": false,
|
|
317
|
+
"setter": false,
|
|
318
|
+
"attribute": "invalid",
|
|
319
|
+
"reflect": false
|
|
320
|
+
},
|
|
321
|
+
"limetypes": {
|
|
322
|
+
"type": "unknown",
|
|
323
|
+
"mutable": false,
|
|
324
|
+
"complexType": {
|
|
325
|
+
"original": "string[]",
|
|
326
|
+
"resolved": "string[] | undefined",
|
|
327
|
+
"references": {}
|
|
328
|
+
},
|
|
329
|
+
"required": false,
|
|
330
|
+
"optional": true,
|
|
331
|
+
"docs": {
|
|
332
|
+
"tags": [],
|
|
333
|
+
"text": "The limetypes to choose from"
|
|
334
|
+
},
|
|
335
|
+
"getter": false,
|
|
336
|
+
"setter": false
|
|
337
|
+
},
|
|
338
|
+
"propertyFields": {
|
|
339
|
+
"type": "unknown",
|
|
340
|
+
"mutable": false,
|
|
341
|
+
"complexType": {
|
|
342
|
+
"original": "DependentPropertyField[]",
|
|
343
|
+
"resolved": "DependentPropertyField[]",
|
|
344
|
+
"references": {
|
|
345
|
+
"DependentPropertyField": {
|
|
346
|
+
"location": "global",
|
|
347
|
+
"id": "global::DependentPropertyField"
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
},
|
|
351
|
+
"required": false,
|
|
352
|
+
"optional": false,
|
|
353
|
+
"docs": {
|
|
354
|
+
"tags": [],
|
|
355
|
+
"text": "A list of property fields that should be updated when the selected limetype changes."
|
|
356
|
+
},
|
|
357
|
+
"getter": false,
|
|
358
|
+
"setter": false,
|
|
359
|
+
"defaultValue": "[]"
|
|
360
|
+
},
|
|
361
|
+
"fieldName": {
|
|
362
|
+
"type": "string",
|
|
363
|
+
"mutable": false,
|
|
364
|
+
"complexType": {
|
|
365
|
+
"original": "string",
|
|
366
|
+
"resolved": "string",
|
|
367
|
+
"references": {}
|
|
368
|
+
},
|
|
369
|
+
"required": false,
|
|
370
|
+
"optional": false,
|
|
371
|
+
"docs": {
|
|
372
|
+
"tags": [],
|
|
373
|
+
"text": "The name of this field. May be used as reference when a property mapping\ndepends on the selected limetype."
|
|
374
|
+
},
|
|
375
|
+
"getter": false,
|
|
376
|
+
"setter": false,
|
|
377
|
+
"attribute": "field-name",
|
|
378
|
+
"reflect": false,
|
|
379
|
+
"defaultValue": "'limetype'"
|
|
380
|
+
},
|
|
381
|
+
"formInfo": {
|
|
382
|
+
"type": "unknown",
|
|
383
|
+
"mutable": false,
|
|
384
|
+
"complexType": {
|
|
385
|
+
"original": "FormInfo",
|
|
386
|
+
"resolved": "FormInfo | undefined",
|
|
387
|
+
"references": {
|
|
388
|
+
"FormInfo": {
|
|
389
|
+
"location": "import",
|
|
390
|
+
"path": "@limetech/lime-elements",
|
|
391
|
+
"id": "node_modules::FormInfo"
|
|
392
|
+
}
|
|
393
|
+
}
|
|
394
|
+
},
|
|
395
|
+
"required": false,
|
|
396
|
+
"optional": true,
|
|
397
|
+
"docs": {
|
|
398
|
+
"tags": [{
|
|
399
|
+
"name": "inheritdoc",
|
|
400
|
+
"text": undefined
|
|
401
|
+
}],
|
|
402
|
+
"text": "Additional contextual information about the form"
|
|
403
|
+
},
|
|
404
|
+
"getter": false,
|
|
405
|
+
"setter": false
|
|
406
|
+
}
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
static get events() {
|
|
410
|
+
return [{
|
|
411
|
+
"method": "change",
|
|
412
|
+
"name": "change",
|
|
413
|
+
"bubbles": true,
|
|
414
|
+
"cancelable": true,
|
|
415
|
+
"composed": true,
|
|
416
|
+
"docs": {
|
|
417
|
+
"tags": [{
|
|
418
|
+
"name": "inheritdoc",
|
|
419
|
+
"text": undefined
|
|
420
|
+
}],
|
|
421
|
+
"text": "The event to emit when the value of the current property has changed"
|
|
422
|
+
},
|
|
423
|
+
"complexType": {
|
|
424
|
+
"original": "string",
|
|
425
|
+
"resolved": "string",
|
|
426
|
+
"references": {}
|
|
427
|
+
}
|
|
428
|
+
}];
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
const limeTypeToOption = (limetype) => ({
|
|
432
|
+
text: limetype.localname.singular,
|
|
433
|
+
value: limetype.name,
|
|
434
|
+
icon: getIcon(limetype),
|
|
435
|
+
});
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Process a single property value and add to items array
|
|
3
|
+
* @param items Array to add items to
|
|
4
|
+
* @param fullPath Full property path
|
|
5
|
+
* @param value Property value to process
|
|
6
|
+
*/
|
|
7
|
+
function processPropertyValue(items, fullPath, value) {
|
|
8
|
+
if (value === null) {
|
|
9
|
+
items.push({ path: fullPath });
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
// Cast to record for checking
|
|
13
|
+
const valueObj = value;
|
|
14
|
+
const keys = Object.keys(valueObj);
|
|
15
|
+
const hasAlias = '_alias' in valueObj;
|
|
16
|
+
const hasDescription = '#description' in valueObj;
|
|
17
|
+
const otherKeys = keys.filter((k) => k !== '_alias' && k !== '#description');
|
|
18
|
+
// If it's {} or only has metadata (_alias, #description), treat as simple property
|
|
19
|
+
if (otherKeys.length === 0) {
|
|
20
|
+
const aliasValue = valueObj._alias;
|
|
21
|
+
const descriptionValue = valueObj['#description'];
|
|
22
|
+
if (aliasValue || descriptionValue) {
|
|
23
|
+
items.push({
|
|
24
|
+
path: fullPath,
|
|
25
|
+
alias: aliasValue,
|
|
26
|
+
description: descriptionValue,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
items.push({ path: fullPath });
|
|
31
|
+
}
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
// If has metadata + other properties, we need to handle both
|
|
35
|
+
// Add the nested properties (metadata is preserved in conversion back)
|
|
36
|
+
if (hasAlias || hasDescription) {
|
|
37
|
+
// Build a PropertySelection without the metadata for recursion
|
|
38
|
+
const nestedSelection = {};
|
|
39
|
+
for (const key of otherKeys) {
|
|
40
|
+
nestedSelection[key] = valueObj[key];
|
|
41
|
+
}
|
|
42
|
+
items.push(...propertySelectionToItems(nestedSelection, fullPath));
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
// Nested property selection without metadata
|
|
46
|
+
items.push(...propertySelectionToItems(value, fullPath));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Convert a nested PropertySelection to a flat list of property items
|
|
50
|
+
* @param selection The nested PropertySelection object
|
|
51
|
+
* @param prefix Current path prefix (used for recursion)
|
|
52
|
+
* @returns Flat array of PropertySelectionItem objects
|
|
53
|
+
*/
|
|
54
|
+
export function propertySelectionToItems(selection, prefix = '') {
|
|
55
|
+
if (!selection) {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
const items = [];
|
|
59
|
+
for (const [key, value] of Object.entries(selection)) {
|
|
60
|
+
const fullPath = prefix ? `${prefix}.${key}` : key;
|
|
61
|
+
if (typeof value === 'object') {
|
|
62
|
+
// NOTE: We want to send null values to the processPropertyValue
|
|
63
|
+
// function but we don't need a special check for null, since
|
|
64
|
+
// `typeof null === 'object'`
|
|
65
|
+
processPropertyValue(items, fullPath, value);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return items;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Set the final property value (with or without alias/description)
|
|
72
|
+
* @param current Current PropertySelection object
|
|
73
|
+
* @param part Property name/key
|
|
74
|
+
* @param item Property selection item with path and optional alias/description
|
|
75
|
+
*/
|
|
76
|
+
function setPropertyValue(current, part, item) {
|
|
77
|
+
// Check if there's already a nested PropertySelection with properties
|
|
78
|
+
const existing = current[part];
|
|
79
|
+
if (existing &&
|
|
80
|
+
typeof existing === 'object' &&
|
|
81
|
+
!('_alias' in existing) &&
|
|
82
|
+
!('#description' in existing)) {
|
|
83
|
+
// There's already a nested PropertySelection object with properties
|
|
84
|
+
// Don't overwrite it - preserve the nested selections
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
// Build metadata object, stripping empty values
|
|
88
|
+
const metadata = {};
|
|
89
|
+
if (item.alias && item.alias.trim() !== '') {
|
|
90
|
+
metadata._alias = item.alias;
|
|
91
|
+
}
|
|
92
|
+
if (item.description && item.description.trim() !== '') {
|
|
93
|
+
metadata['#description'] = item.description;
|
|
94
|
+
}
|
|
95
|
+
// If we have metadata, use it; otherwise use null
|
|
96
|
+
if (Object.keys(metadata).length > 0) {
|
|
97
|
+
current[part] = metadata;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
current[part] = null;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Ensure a nested object exists and return it
|
|
105
|
+
* Preserves any existing _alias and #description when converting to nested object
|
|
106
|
+
* @param current Current PropertySelection object
|
|
107
|
+
* @param part Property name/key
|
|
108
|
+
* @returns The nested PropertySelection object
|
|
109
|
+
*/
|
|
110
|
+
function ensureNestedObject(current, part) {
|
|
111
|
+
const existing = current[part];
|
|
112
|
+
// If doesn't exist or is null, create empty object
|
|
113
|
+
if (!existing) {
|
|
114
|
+
current[part] = {};
|
|
115
|
+
return current[part];
|
|
116
|
+
}
|
|
117
|
+
// If it's already a PropertySelection object, check for metadata
|
|
118
|
+
if (typeof existing === 'object') {
|
|
119
|
+
const existingObj = existing;
|
|
120
|
+
// If it has metadata but no other properties, preserve the metadata
|
|
121
|
+
const keys = Object.keys(existingObj);
|
|
122
|
+
const hasMetadata = '_alias' in existingObj || '#description' in existingObj;
|
|
123
|
+
const otherKeys = keys.filter((k) => k !== '_alias' && k !== '#description');
|
|
124
|
+
if (hasMetadata && otherKeys.length === 0) {
|
|
125
|
+
// Convert { _alias: "...", "#description": "..." } to { _alias: "...", "#description": "...", ...nested }
|
|
126
|
+
// Keep the existing object and return it (caller will add nested props)
|
|
127
|
+
return existingObj;
|
|
128
|
+
}
|
|
129
|
+
// Already has nested properties, return as is
|
|
130
|
+
return existingObj;
|
|
131
|
+
}
|
|
132
|
+
// Shouldn't reach here, but fallback to creating new object
|
|
133
|
+
current[part] = {};
|
|
134
|
+
return current[part];
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Convert a flat list of property items to a nested PropertySelection structure
|
|
138
|
+
* @param items Array of PropertySelectionItem objects
|
|
139
|
+
* @returns Nested PropertySelection object
|
|
140
|
+
*/
|
|
141
|
+
export function itemsToPropertySelection(items) {
|
|
142
|
+
const result = {};
|
|
143
|
+
for (const item of items) {
|
|
144
|
+
const parts = item.path.split('.');
|
|
145
|
+
let current = result;
|
|
146
|
+
for (let i = 0; i < parts.length; i++) {
|
|
147
|
+
const part = parts[i];
|
|
148
|
+
const isLast = i === parts.length - 1;
|
|
149
|
+
if (isLast) {
|
|
150
|
+
setPropertyValue(current, part, item);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
current = ensureNestedObject(current, part);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return result;
|
|
158
|
+
}
|