@limetech/lime-elements 34.1.0-next.9 → 34.1.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/dist/cjs/{checkbox.template-d4423721.js → checkbox.template-312308d8.js} +9 -1
- package/dist/cjs/lime-elements.cjs.js +1 -1
- package/dist/cjs/limel-checkbox.cjs.entry.js +3 -3
- package/dist/cjs/limel-chip-set.cjs.entry.js +50 -28
- package/dist/cjs/limel-code-editor.cjs.entry.js +1 -1
- package/dist/cjs/limel-color-picker-palette_2.cjs.entry.js +1 -1
- package/dist/cjs/limel-color-picker.cjs.entry.js +2 -2
- package/dist/cjs/limel-file.cjs.entry.js +1 -1
- package/dist/cjs/limel-form.cjs.entry.js +45 -14
- package/dist/cjs/limel-grid.cjs.entry.js +1 -1
- package/dist/cjs/limel-input-field.cjs.entry.js +1 -1
- package/dist/cjs/limel-list_3.cjs.entry.js +19 -2
- package/dist/cjs/limel-menu-list.cjs.entry.js +1 -1
- package/dist/cjs/limel-picker.cjs.entry.js +1 -1
- package/dist/cjs/limel-slider.cjs.entry.js +69 -13
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/collection/components/checkbox/checkbox.css +96 -0
- package/dist/collection/components/checkbox/checkbox.js +19 -1
- package/dist/collection/components/checkbox/checkbox.template.js +9 -1
- package/dist/collection/components/chip-set/chip-set.css +14 -0
- package/dist/collection/components/chip-set/chip-set.js +75 -35
- package/dist/collection/components/code-editor/code-editor.css +7 -0
- package/dist/collection/components/color-picker/color-picker-palette.css +38 -1
- package/dist/collection/components/color-picker/color-picker.css +37 -0
- package/dist/collection/components/color-picker/color-picker.js +1 -1
- package/dist/collection/components/file/file.js +1 -1
- package/dist/collection/components/form/adapters/widget-adapter.js +4 -1
- package/dist/collection/components/form/form.js +50 -0
- package/dist/collection/components/form/templates/array-field-collapsible-item.js +8 -8
- package/dist/collection/components/form/templates/common.js +1 -1
- package/dist/collection/components/form/widgets/select.js +3 -4
- package/dist/collection/components/grid/grid.css +1 -1
- package/dist/collection/components/input-field/input-field.css +13 -0
- package/dist/collection/components/list/list-renderer.js +17 -0
- package/dist/collection/components/list/list.css +421 -2
- package/dist/collection/components/list/list.js +1 -0
- package/dist/collection/components/menu-list/menu-list.css +1408 -60
- package/dist/collection/components/picker/picker.js +18 -1
- package/dist/collection/components/slider/slider.js +69 -13
- package/dist/esm/{checkbox.template-dbdd27c8.js → checkbox.template-4be69ce6.js} +9 -1
- package/dist/esm/lime-elements.js +1 -1
- package/dist/esm/limel-checkbox.entry.js +3 -3
- package/dist/esm/limel-chip-set.entry.js +50 -28
- package/dist/esm/limel-code-editor.entry.js +1 -1
- package/dist/esm/limel-color-picker-palette_2.entry.js +1 -1
- package/dist/esm/limel-color-picker.entry.js +2 -2
- package/dist/esm/limel-file.entry.js +1 -1
- package/dist/esm/limel-form.entry.js +45 -14
- package/dist/esm/limel-grid.entry.js +1 -1
- package/dist/esm/limel-input-field.entry.js +1 -1
- package/dist/esm/limel-list_3.entry.js +19 -2
- package/dist/esm/limel-menu-list.entry.js +1 -1
- package/dist/esm/limel-picker.entry.js +1 -1
- package/dist/esm/limel-slider.entry.js +69 -13
- package/dist/esm/loader.js +1 -1
- package/dist/lime-elements/lime-elements.esm.js +1 -1
- package/dist/lime-elements/{p-bcafdb7a.entry.js → p-03aa01b5.entry.js} +1 -1
- package/dist/lime-elements/p-0c121e2f.js +1 -0
- package/dist/lime-elements/{p-c6b97214.entry.js → p-0ce9165f.entry.js} +1 -1
- package/dist/lime-elements/p-1876a96a.entry.js +1 -0
- package/dist/lime-elements/p-46af5a60.entry.js +82 -0
- package/dist/lime-elements/p-5170a62c.entry.js +1 -0
- package/dist/lime-elements/p-5a9ecd77.entry.js +73 -0
- package/dist/lime-elements/p-6003f817.entry.js +1 -0
- package/dist/lime-elements/p-622be09b.entry.js +126 -0
- package/dist/lime-elements/p-8a2c1038.entry.js +16 -0
- package/dist/lime-elements/{p-a1153d2a.entry.js → p-8ad5e143.entry.js} +1 -1
- package/dist/lime-elements/{p-b386bfeb.entry.js → p-a2cf74c1.entry.js} +1 -1
- package/dist/lime-elements/{p-81258617.entry.js → p-a77cbb08.entry.js} +1 -1
- package/dist/lime-elements/{p-23d59a30.entry.js → p-fbe6100e.entry.js} +1 -1
- package/dist/types/components/checkbox/checkbox.d.ts +5 -0
- package/dist/types/components/checkbox/checkbox.template.d.ts +1 -0
- package/dist/types/components/chip-set/chip-set.d.ts +12 -0
- package/dist/types/components/form/form.d.ts +7 -1
- package/dist/types/components/list/list-item.types.d.ts +14 -0
- package/dist/types/components/list/list-renderer.d.ts +2 -0
- package/dist/types/components/list/list.d.ts +1 -0
- package/dist/types/components/picker/picker.d.ts +4 -0
- package/dist/types/components/slider/slider.d.ts +8 -0
- package/dist/types/components.d.ts +33 -1
- package/package.json +1 -1
- package/dist/lime-elements/p-18fe2eb1.entry.js +0 -1
- package/dist/lime-elements/p-1cf833c8.entry.js +0 -16
- package/dist/lime-elements/p-89b5a983.js +0 -1
- package/dist/lime-elements/p-8d8bd2ab.entry.js +0 -73
- package/dist/lime-elements/p-b5d6abc3.entry.js +0 -126
- package/dist/lime-elements/p-cc154284.entry.js +0 -1
- package/dist/lime-elements/p-df55ee67.entry.js +0 -82
- package/dist/lime-elements/p-f5a3e526.entry.js +0 -1
|
@@ -87,9 +87,12 @@ export class LimeElementsWidgetAdapter extends React.Component {
|
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
89
|
isDisabled() {
|
|
90
|
+
var _a, _b;
|
|
90
91
|
const widgetProps = this.props.widgetProps;
|
|
91
92
|
const options = widgetProps.schema.lime;
|
|
92
|
-
return widgetProps.disabled ||
|
|
93
|
+
return (widgetProps.disabled ||
|
|
94
|
+
(options === null || options === void 0 ? void 0 : options.disabled) ||
|
|
95
|
+
((_b = (_a = options === null || options === void 0 ? void 0 : options.component) === null || _a === void 0 ? void 0 : _a.props) === null || _b === void 0 ? void 0 : _b.disabled));
|
|
93
96
|
}
|
|
94
97
|
isReadOnly() {
|
|
95
98
|
const widgetProps = this.props.widgetProps;
|
|
@@ -20,6 +20,7 @@ import { isInteger } from './validators';
|
|
|
20
20
|
* @exampleComponent limel-example-props-factory-form
|
|
21
21
|
* @exampleComponent limel-example-form-layout
|
|
22
22
|
* @exampleComponent limel-example-form-span-fields
|
|
23
|
+
* @exampleComponent limel-example-custom-error-message
|
|
23
24
|
*/
|
|
24
25
|
export class Form {
|
|
25
26
|
constructor() {
|
|
@@ -33,6 +34,7 @@ export class Form {
|
|
|
33
34
|
this.disabled = false;
|
|
34
35
|
this.isValid = true;
|
|
35
36
|
this.handleChange = this.handleChange.bind(this);
|
|
37
|
+
this.getCustomErrorMessages = this.getCustomErrorMessages.bind(this);
|
|
36
38
|
}
|
|
37
39
|
connectedCallback() {
|
|
38
40
|
this.initialize();
|
|
@@ -78,6 +80,7 @@ export class Form {
|
|
|
78
80
|
ArrayFieldTemplate: ArrayFieldTemplate,
|
|
79
81
|
ObjectFieldTemplate: ObjectFieldTemplate,
|
|
80
82
|
disabled: this.disabled,
|
|
83
|
+
transformErrors: this.getCustomErrorMessages,
|
|
81
84
|
formContext: {
|
|
82
85
|
schema: this.modifiedSchema,
|
|
83
86
|
rootValue: this.value,
|
|
@@ -139,6 +142,33 @@ export class Form {
|
|
|
139
142
|
};
|
|
140
143
|
});
|
|
141
144
|
}
|
|
145
|
+
getCustomErrorMessages(originalErrors) {
|
|
146
|
+
if (!this.transformErrors) {
|
|
147
|
+
return originalErrors;
|
|
148
|
+
}
|
|
149
|
+
const errors = originalErrors.map((error) => {
|
|
150
|
+
return {
|
|
151
|
+
name: error.name,
|
|
152
|
+
property: error.property,
|
|
153
|
+
message: error.message,
|
|
154
|
+
// For some reason 'schemaPath' is missing from the AjvError type definition:
|
|
155
|
+
// https://github.com/rjsf-team/react-jsonschema-form/issues/2140
|
|
156
|
+
// eslint-disable-next-line @typescript-eslint/dot-notation
|
|
157
|
+
schemaPath: error['schemaPath'],
|
|
158
|
+
};
|
|
159
|
+
});
|
|
160
|
+
// Use `.call({}, …)` here to bind `this` to an empty object to prevent
|
|
161
|
+
// the consumer submitted `transformErrors` from getting access to our
|
|
162
|
+
// component's internals. /Ads
|
|
163
|
+
return this.transformErrors
|
|
164
|
+
.call({}, errors)
|
|
165
|
+
.map((transformedError) => {
|
|
166
|
+
const originalError = originalErrors.find((error) => {
|
|
167
|
+
return transformedError.property === error.property;
|
|
168
|
+
});
|
|
169
|
+
return Object.assign(Object.assign({}, originalError), { message: transformedError.message });
|
|
170
|
+
});
|
|
171
|
+
}
|
|
142
172
|
static get is() { return "limel-form"; }
|
|
143
173
|
static get encapsulation() { return "shadow"; }
|
|
144
174
|
static get originalStyleUrls() { return {
|
|
@@ -215,6 +245,26 @@ export class Form {
|
|
|
215
245
|
"tags": [],
|
|
216
246
|
"text": "Factory for creating properties for custom form components\n\nWhen using custom components in the form some properties might have to be\nset dynamically. If this factory is set, it will be called with the\ncurrent schema for the field for each custom component in the form. The\nfactory must return an object where each key is the name of the property\nthat should be set, along with its value."
|
|
217
247
|
}
|
|
248
|
+
},
|
|
249
|
+
"transformErrors": {
|
|
250
|
+
"type": "unknown",
|
|
251
|
+
"mutable": false,
|
|
252
|
+
"complexType": {
|
|
253
|
+
"original": "(errors: FormError[]) => FormError[]",
|
|
254
|
+
"resolved": "(errors: FormError[]) => FormError[]",
|
|
255
|
+
"references": {
|
|
256
|
+
"FormError": {
|
|
257
|
+
"location": "import",
|
|
258
|
+
"path": "./form.types"
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
"required": false,
|
|
263
|
+
"optional": true,
|
|
264
|
+
"docs": {
|
|
265
|
+
"tags": [],
|
|
266
|
+
"text": "Custom function to customize the default error messages"
|
|
267
|
+
}
|
|
218
268
|
}
|
|
219
269
|
}; }
|
|
220
270
|
static get events() { return [{
|
|
@@ -35,10 +35,10 @@ export class CollapsibleItemTemplate extends React.Component {
|
|
|
35
35
|
const { item, index } = this.props;
|
|
36
36
|
const actions = [
|
|
37
37
|
{
|
|
38
|
-
id: '
|
|
39
|
-
icon: '
|
|
40
|
-
disabled: !item.
|
|
41
|
-
run: item.
|
|
38
|
+
id: 'down',
|
|
39
|
+
icon: 'down_arrow',
|
|
40
|
+
disabled: !item.hasMoveDown,
|
|
41
|
+
run: item.onReorderClick(index, index + 1),
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
id: 'up',
|
|
@@ -47,10 +47,10 @@ export class CollapsibleItemTemplate extends React.Component {
|
|
|
47
47
|
run: item.onReorderClick(index, index - 1),
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
|
-
id: '
|
|
51
|
-
icon: '
|
|
52
|
-
disabled: !item.
|
|
53
|
-
run: item.
|
|
50
|
+
id: 'remove',
|
|
51
|
+
icon: 'trash',
|
|
52
|
+
disabled: !item.hasRemove,
|
|
53
|
+
run: item.onDropIndexClick(index),
|
|
54
54
|
},
|
|
55
55
|
];
|
|
56
56
|
element.actions = actions;
|
|
@@ -59,7 +59,7 @@ function findFirstEntry(data, subSchema) {
|
|
|
59
59
|
getRequiredEntry(data, subSchema),
|
|
60
60
|
...Object.entries(data),
|
|
61
61
|
];
|
|
62
|
-
return entries.filter(([_, value]) => !!value)[0];
|
|
62
|
+
return entries.filter(([_, value]) => !!value && typeof value !== 'boolean')[0];
|
|
63
63
|
}
|
|
64
64
|
function getRequiredEntry(data, subSchema) {
|
|
65
65
|
if (!('required' in subSchema)) {
|
|
@@ -11,6 +11,7 @@ export class Select extends React.Component {
|
|
|
11
11
|
this.handleChange = this.handleChange.bind(this);
|
|
12
12
|
}
|
|
13
13
|
render() {
|
|
14
|
+
var _a, _b;
|
|
14
15
|
const props = this.props;
|
|
15
16
|
const enumOptions = props.options.enumOptions;
|
|
16
17
|
const options = enumOptions.map(createOption);
|
|
@@ -21,6 +22,7 @@ export class Select extends React.Component {
|
|
|
21
22
|
else {
|
|
22
23
|
value = findValue(props.value, options);
|
|
23
24
|
}
|
|
25
|
+
const additionalProps = ((_b = (_a = props.schema.lime) === null || _a === void 0 ? void 0 : _a.component) === null || _b === void 0 ? void 0 : _b.props) || {};
|
|
24
26
|
return React.createElement(LimeElementsWidgetAdapter, {
|
|
25
27
|
name: 'limel-select',
|
|
26
28
|
value: value,
|
|
@@ -28,10 +30,7 @@ export class Select extends React.Component {
|
|
|
28
30
|
change: this.handleChange,
|
|
29
31
|
},
|
|
30
32
|
widgetProps: props,
|
|
31
|
-
extraProps: {
|
|
32
|
-
multiple: props.multiple,
|
|
33
|
-
options: options,
|
|
34
|
-
},
|
|
33
|
+
extraProps: Object.assign({ multiple: props.multiple, options: options }, additionalProps),
|
|
35
34
|
});
|
|
36
35
|
}
|
|
37
36
|
handleChange(event) {
|
|
@@ -23,7 +23,7 @@ slot {
|
|
|
23
23
|
display: grid;
|
|
24
24
|
grid-template-areas: var(--lime-grid-area, "");
|
|
25
25
|
grid-template-columns: repeat(var(--lime-grid-columns, 4), minmax(0, 1fr));
|
|
26
|
-
|
|
26
|
+
gap: var(--lime-grid-gutter, 1rem);
|
|
27
27
|
grid-auto-flow: row dense;
|
|
28
28
|
grid-auto-rows: var(--lime-grid-cell-height, 2.5rem);
|
|
29
29
|
margin: 0;
|
|
@@ -1885,6 +1885,9 @@ input.mdc-text-field__input::-webkit-search-cancel-button:active {
|
|
|
1885
1885
|
input.mdc-text-field__input::-webkit-search-cancel-button:hover {
|
|
1886
1886
|
background-color: #757580;
|
|
1887
1887
|
}
|
|
1888
|
+
input.mdc-text-field__input::-webkit-search-cancel-button:active {
|
|
1889
|
+
transform: none;
|
|
1890
|
+
}
|
|
1888
1891
|
|
|
1889
1892
|
.mdc-text-field:not(.mdc-text-field--disabled) .mdc-text-field-character-counter, .mdc-text-field:not(.mdc-text-field--disabled) + .mdc-text-field-helper-line .mdc-text-field-character-counter, .mdc-text-field:not(.mdc-text-field--disabled) + .mdc-text-field-helper-line .mdc-text-field-helper-text {
|
|
1890
1893
|
color: rgba(var(--contrast-1200), 1);
|
|
@@ -1949,4 +1952,14 @@ input.mdc-text-field__input::-webkit-search-cancel-button:hover {
|
|
|
1949
1952
|
:host([type=urlAsText]) .mdc-text-field.lime-text-field--readonly:hover .mdc-text-field__input,
|
|
1950
1953
|
:host([type=tel]) .mdc-text-field.lime-text-field--readonly:hover .mdc-text-field__input {
|
|
1951
1954
|
z-index: 1;
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
:host([type=url]) .mdc-text-field.lime-text-field--readonly .mdc-text-field__input,
|
|
1958
|
+
:host([type=email]) .mdc-text-field.lime-text-field--readonly .mdc-text-field__input,
|
|
1959
|
+
:host([type=urlAsText]) .mdc-text-field.lime-text-field--readonly .mdc-text-field__input,
|
|
1960
|
+
:host([type=tel]) .mdc-text-field.lime-text-field--readonly .mdc-text-field__input {
|
|
1961
|
+
overflow: hidden;
|
|
1962
|
+
white-space: nowrap;
|
|
1963
|
+
text-overflow: ellipsis;
|
|
1964
|
+
width: calc(100% - 2.75rem);
|
|
1952
1965
|
}
|
|
@@ -55,6 +55,7 @@ export class ListRenderer {
|
|
|
55
55
|
'mdc-deprecated-list-item': true,
|
|
56
56
|
'mdc-deprecated-list-item--disabled': item.disabled,
|
|
57
57
|
'mdc-deprecated-list-item--selected': item.selected,
|
|
58
|
+
'has-primary-component': this.hasPrimaryComponent(item),
|
|
58
59
|
};
|
|
59
60
|
const attributes = {};
|
|
60
61
|
if (index === this.applyTabIndexToItemAtIndex) {
|
|
@@ -62,10 +63,15 @@ export class ListRenderer {
|
|
|
62
63
|
}
|
|
63
64
|
return (h("li", Object.assign({ class: classNames, "aria-disabled": item.disabled ? 'true' : 'false', "aria-selected": item.selected ? 'true' : 'false', "data-index": index }, attributes),
|
|
64
65
|
item.icon ? this.renderIcon(this.config, item) : null,
|
|
66
|
+
this.getPrimaryComponent(item),
|
|
65
67
|
this.renderText(item),
|
|
66
68
|
this.twoLines && this.avatarList ? this.renderDivider() : null,
|
|
67
69
|
this.renderActionMenu(item.actions)));
|
|
68
70
|
};
|
|
71
|
+
this.hasPrimaryComponent = (item) => {
|
|
72
|
+
var _a;
|
|
73
|
+
return !!((_a = item === null || item === void 0 ? void 0 : item.primaryComponent) === null || _a === void 0 ? void 0 : _a.name);
|
|
74
|
+
};
|
|
69
75
|
/**
|
|
70
76
|
* Render the text of the list item
|
|
71
77
|
*
|
|
@@ -135,6 +141,7 @@ export class ListRenderer {
|
|
|
135
141
|
'mdc-deprecated-list-item': true,
|
|
136
142
|
'mdc-deprecated-list-item--disabled': item.disabled,
|
|
137
143
|
'mdc-deprecated-list-item__text': !item.secondaryText,
|
|
144
|
+
'has-primary-component': this.hasPrimaryComponent(item),
|
|
138
145
|
};
|
|
139
146
|
const attributes = {};
|
|
140
147
|
if (index === this.applyTabIndexToItemAtIndex) {
|
|
@@ -146,12 +153,14 @@ export class ListRenderer {
|
|
|
146
153
|
if (this.hasIcons) {
|
|
147
154
|
return [
|
|
148
155
|
item.icon ? this.renderIcon(config, item) : null,
|
|
156
|
+
this.getPrimaryComponent(item),
|
|
149
157
|
this.renderText(item),
|
|
150
158
|
h("div", { class: "mdc-deprecated-list-item__meta" }, itemTemplate),
|
|
151
159
|
];
|
|
152
160
|
}
|
|
153
161
|
return [
|
|
154
162
|
h("div", { class: "mdc-deprecated-list-item__graphic" }, itemTemplate),
|
|
163
|
+
this.getPrimaryComponent(item),
|
|
155
164
|
this.renderText(item),
|
|
156
165
|
];
|
|
157
166
|
};
|
|
@@ -191,4 +200,12 @@ export class ListRenderer {
|
|
|
191
200
|
};
|
|
192
201
|
return (h("ul", { class: classNames, role: role, "aria-orientation": "vertical" }, items.map(this.renderListItem)));
|
|
193
202
|
}
|
|
203
|
+
getPrimaryComponent(item) {
|
|
204
|
+
if (!this.hasPrimaryComponent(item)) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
const PrimaryComponent = item.primaryComponent.name;
|
|
208
|
+
const props = item.primaryComponent.props;
|
|
209
|
+
return h(PrimaryComponent, Object.assign({}, props));
|
|
210
|
+
}
|
|
194
211
|
}
|