@umbraco-cms/backoffice 14.0.0--preview004-64d63c8e → 14.0.0--preview004-fb4b6c24

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 (18) hide show
  1. package/dist-cms/custom-elements.json +197 -0
  2. package/dist-cms/packages/core/components/index.d.ts +1 -0
  3. package/dist-cms/packages/core/components/index.js +1 -0
  4. package/dist-cms/packages/core/components/multiple-color-picker-input/index.d.ts +2 -0
  5. package/dist-cms/packages/core/components/multiple-color-picker-input/index.js +2 -0
  6. package/dist-cms/packages/core/components/multiple-color-picker-input/multiple-color-picker-input.element.d.ts +65 -0
  7. package/dist-cms/packages/core/components/multiple-color-picker-input/multiple-color-picker-input.element.js +207 -0
  8. package/dist-cms/packages/core/components/multiple-color-picker-input/multiple-color-picker-item-input.element.d.ts +39 -0
  9. package/dist-cms/packages/core/components/multiple-color-picker-input/multiple-color-picker-item-input.element.js +209 -0
  10. package/dist-cms/packages/core/property-editor/schemas/Umbraco.ColorPicker.js +1 -1
  11. package/dist-cms/packages/core/property-editor/uis/color-editor/manifests.d.ts +2 -0
  12. package/dist-cms/packages/core/property-editor/uis/color-editor/manifests.js +11 -0
  13. package/dist-cms/packages/core/property-editor/uis/color-editor/property-editor-ui-color-editor.element.d.ts +20 -0
  14. package/dist-cms/packages/core/property-editor/uis/color-editor/property-editor-ui-color-editor.element.js +48 -0
  15. package/dist-cms/packages/core/property-editor/uis/manifests.js +2 -0
  16. package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
  17. package/dist-cms/vscode-html-custom-data.json +83 -0
  18. package/package.json +1 -1
@@ -1937,6 +1937,176 @@
1937
1937
  }
1938
1938
  ]
1939
1939
  },
1940
+ {
1941
+ "name": "umb-multiple-color-picker-input",
1942
+ "path": "./../src/packages/core/components/multiple-color-picker-input/multiple-color-picker-input.element.ts",
1943
+ "attributes": [
1944
+ {
1945
+ "name": "min",
1946
+ "description": "This is a minimum amount of selected items in this input.",
1947
+ "type": "number",
1948
+ "default": "\"undefined\""
1949
+ },
1950
+ {
1951
+ "name": "max",
1952
+ "description": "This is a maximum amount of selected items in this input.",
1953
+ "type": "number",
1954
+ "default": "\"undefined\""
1955
+ },
1956
+ {
1957
+ "name": "min-message",
1958
+ "description": "Min validation message.",
1959
+ "type": "boolean",
1960
+ "default": "\"\""
1961
+ },
1962
+ {
1963
+ "name": "maxMessage",
1964
+ "description": "Max validation message.",
1965
+ "type": "boolean",
1966
+ "default": "\"\""
1967
+ },
1968
+ {
1969
+ "name": "disabled",
1970
+ "description": "Disables the input",
1971
+ "type": "boolean",
1972
+ "default": "\"false\""
1973
+ },
1974
+ {
1975
+ "name": "readonly",
1976
+ "description": "Makes the input readonly",
1977
+ "type": "boolean",
1978
+ "default": "\"false\""
1979
+ },
1980
+ {
1981
+ "name": "showLabels",
1982
+ "type": "boolean",
1983
+ "default": "true"
1984
+ },
1985
+ {
1986
+ "name": "items",
1987
+ "type": "array"
1988
+ }
1989
+ ],
1990
+ "properties": [
1991
+ {
1992
+ "name": "min",
1993
+ "attribute": "min",
1994
+ "description": "This is a minimum amount of selected items in this input.",
1995
+ "type": "number",
1996
+ "default": "\"undefined\""
1997
+ },
1998
+ {
1999
+ "name": "max",
2000
+ "attribute": "max",
2001
+ "description": "This is a maximum amount of selected items in this input.",
2002
+ "type": "number",
2003
+ "default": "\"undefined\""
2004
+ },
2005
+ {
2006
+ "name": "minMessage",
2007
+ "attribute": "min-message",
2008
+ "description": "Min validation message.",
2009
+ "type": "boolean",
2010
+ "default": "\"\""
2011
+ },
2012
+ {
2013
+ "name": "maxMessage",
2014
+ "attribute": "maxMessage",
2015
+ "description": "Max validation message.",
2016
+ "type": "boolean",
2017
+ "default": "\"\""
2018
+ },
2019
+ {
2020
+ "name": "disabled",
2021
+ "attribute": "disabled",
2022
+ "description": "Disables the input",
2023
+ "type": "boolean",
2024
+ "default": "\"false\""
2025
+ },
2026
+ {
2027
+ "name": "readonly",
2028
+ "attribute": "readonly",
2029
+ "description": "Makes the input readonly",
2030
+ "type": "boolean",
2031
+ "default": "\"false\""
2032
+ },
2033
+ {
2034
+ "name": "showLabels",
2035
+ "attribute": "showLabels",
2036
+ "type": "boolean",
2037
+ "default": "true"
2038
+ },
2039
+ {
2040
+ "name": "items",
2041
+ "attribute": "items",
2042
+ "type": "array"
2043
+ },
2044
+ {
2045
+ "name": "styles",
2046
+ "type": "array",
2047
+ "default": "[null]"
2048
+ }
2049
+ ]
2050
+ },
2051
+ {
2052
+ "name": "umb-multiple-color-picker-item-input",
2053
+ "path": "./../src/packages/core/components/multiple-color-picker-input/multiple-color-picker-item-input.element.ts",
2054
+ "attributes": [
2055
+ {
2056
+ "name": "disabled",
2057
+ "description": "Disables the input",
2058
+ "type": "boolean",
2059
+ "default": "\"false\""
2060
+ },
2061
+ {
2062
+ "name": "readonly",
2063
+ "description": "Disables the input",
2064
+ "type": "boolean",
2065
+ "default": "\"false\""
2066
+ },
2067
+ {
2068
+ "name": "label",
2069
+ "type": "string | undefined"
2070
+ },
2071
+ {
2072
+ "name": "showLabels",
2073
+ "type": "boolean",
2074
+ "default": "true"
2075
+ }
2076
+ ],
2077
+ "properties": [
2078
+ {
2079
+ "name": "disabled",
2080
+ "attribute": "disabled",
2081
+ "description": "Disables the input",
2082
+ "type": "boolean",
2083
+ "default": "\"false\""
2084
+ },
2085
+ {
2086
+ "name": "readonly",
2087
+ "attribute": "readonly",
2088
+ "description": "Disables the input",
2089
+ "type": "boolean",
2090
+ "default": "\"false\""
2091
+ },
2092
+ {
2093
+ "name": "label",
2094
+ "attribute": "label",
2095
+ "type": "string | undefined"
2096
+ },
2097
+ {
2098
+ "name": "showLabels",
2099
+ "attribute": "showLabels",
2100
+ "type": "boolean",
2101
+ "default": "true"
2102
+ },
2103
+ {
2104
+ "name": "styles",
2105
+ "type": "array",
2106
+ "default": "[null]"
2107
+ }
2108
+ ]
2109
+ },
1940
2110
  {
1941
2111
  "name": "umb-input-multiple-text-string-item",
1942
2112
  "path": "./../src/packages/core/components/multiple-text-string-input/input-multiple-text-string-item.element.ts",
@@ -3624,6 +3794,33 @@
3624
3794
  }
3625
3795
  ]
3626
3796
  },
3797
+ {
3798
+ "name": "umb-property-editor-ui-color-editor",
3799
+ "path": "./../src/packages/core/property-editor/uis/color-editor/property-editor-ui-color-editor.element.ts",
3800
+ "attributes": [
3801
+ {
3802
+ "name": "value",
3803
+ "type": "array",
3804
+ "default": "[]"
3805
+ }
3806
+ ],
3807
+ "properties": [
3808
+ {
3809
+ "name": "value",
3810
+ "attribute": "value",
3811
+ "type": "array",
3812
+ "default": "[]"
3813
+ },
3814
+ {
3815
+ "name": "config"
3816
+ }
3817
+ ],
3818
+ "events": [
3819
+ {
3820
+ "name": "property-value-change"
3821
+ }
3822
+ ]
3823
+ },
3627
3824
  {
3628
3825
  "name": "umb-property-editor-ui-color-picker",
3629
3826
  "path": "./../src/packages/core/property-editor/uis/color-picker/property-editor-ui-color-picker.element.ts",
@@ -31,3 +31,4 @@ export * from './tooltip-menu/index.js';
31
31
  export * from './variant-selector/index.js';
32
32
  export * from './popover-layout/index.js';
33
33
  export * from './multiple-text-string-input/index.js';
34
+ export * from './multiple-color-picker-input/index.js';
@@ -33,3 +33,4 @@ export * from './tooltip-menu/index.js';
33
33
  export * from './variant-selector/index.js';
34
34
  export * from './popover-layout/index.js';
35
35
  export * from './multiple-text-string-input/index.js';
36
+ export * from './multiple-color-picker-input/index.js';
@@ -0,0 +1,2 @@
1
+ export * from './multiple-color-picker-input.element.js';
2
+ export * from './multiple-color-picker-item-input.element.js';
@@ -0,0 +1,2 @@
1
+ export * from './multiple-color-picker-input.element.js';
2
+ export * from './multiple-color-picker-item-input.element.js';
@@ -0,0 +1,65 @@
1
+ import type { UmbSwatchDetails } from '../../../../shared/models/index.js';
2
+ import { UmbLitElement } from '../../../../shared/lit-element/index.js';
3
+ declare const UmbMultipleColorPickerInputElement_base: (new (...args: any[]) => import("../../../../external/uui/index.js").FormControlMixinInterface) & typeof UmbLitElement;
4
+ /**
5
+ * @element umb-multiple-color-picker-input
6
+ */
7
+ export declare class UmbMultipleColorPickerInputElement extends UmbMultipleColorPickerInputElement_base {
8
+ #private;
9
+ /**
10
+ * This is a minimum amount of selected items in this input.
11
+ * @type {number}
12
+ * @attr
13
+ * @default undefined
14
+ */
15
+ min?: number;
16
+ /**
17
+ * Min validation message.
18
+ * @type {boolean}
19
+ * @attr
20
+ * @default
21
+ */
22
+ minMessage: string;
23
+ /**
24
+ * This is a maximum amount of selected items in this input.
25
+ * @type {number}
26
+ * @attr
27
+ * @default undefined
28
+ */
29
+ max?: number;
30
+ /**
31
+ * Max validation message.
32
+ * @type {boolean}
33
+ * @attr
34
+ * @default
35
+ */
36
+ maxMessage: string;
37
+ /**
38
+ * Disables the input
39
+ * @type {boolean}
40
+ * @attr
41
+ * @default false
42
+ */
43
+ disabled: boolean;
44
+ /**
45
+ * Makes the input readonly
46
+ * @type {boolean}
47
+ * @attr
48
+ * @default false
49
+ */
50
+ readonly: boolean;
51
+ showLabels: boolean;
52
+ constructor();
53
+ private _items;
54
+ get items(): Array<UmbSwatchDetails>;
55
+ set items(items: Array<UmbSwatchDetails>);
56
+ protected getFormElement(): undefined;
57
+ render(): import("lit-html").TemplateResult<1>;
58
+ static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
59
+ }
60
+ export default UmbMultipleColorPickerInputElement;
61
+ declare global {
62
+ interface HTMLElementTagNameMap {
63
+ 'umb-multiple-color-picker-input': UmbMultipleColorPickerInputElement;
64
+ }
65
+ }
@@ -0,0 +1,207 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ import { UMB_DATA_TYPE_WORKSPACE_CONTEXT } from '../../data-type/workspace/data-type-workspace.context.js';
8
+ import { css, html, nothing, repeat, customElement, property, state, ifDefined, } from '../../../../external/lit/index.js';
9
+ import { FormControlMixin } from '../../../../external/uui/index.js';
10
+ import { UmbChangeEvent } from '../../event/index.js';
11
+ import { UmbLitElement } from '../../../../shared/lit-element/index.js';
12
+ import { UmbSorterController } from '../../sorter/index.js';
13
+ const SORTER_CONFIG = {
14
+ compareElementToModel: (element, model) => {
15
+ return element.getAttribute('data-sort-entry-id') === model.value;
16
+ },
17
+ querySelectModelToElement: (container, modelEntry) => {
18
+ return container.querySelector('data-sort-entry-id=[' + modelEntry.value + ']');
19
+ },
20
+ identifier: 'Umb.SorterIdentifier.ColorEditor',
21
+ itemSelector: 'umb-multiple-color-picker-item-input',
22
+ containerSelector: '#sorter-wrapper',
23
+ };
24
+ /**
25
+ * @element umb-multiple-color-picker-input
26
+ */
27
+ let UmbMultipleColorPickerInputElement = class UmbMultipleColorPickerInputElement extends FormControlMixin(UmbLitElement) {
28
+ #prevalueSorter;
29
+ constructor() {
30
+ super();
31
+ this.#prevalueSorter = new UmbSorterController(this, {
32
+ ...SORTER_CONFIG,
33
+ performItemInsert: (args) => {
34
+ const frozenArray = [...this.items];
35
+ const indexToMove = frozenArray.findIndex((x) => x.value === args.item.value);
36
+ frozenArray.splice(indexToMove, 1);
37
+ frozenArray.splice(args.newIndex, 0, args.item);
38
+ this.items = frozenArray;
39
+ this.dispatchEvent(new UmbChangeEvent());
40
+ return true;
41
+ },
42
+ performItemRemove: (args) => {
43
+ return true;
44
+ },
45
+ });
46
+ /**
47
+ * Min validation message.
48
+ * @type {boolean}
49
+ * @attr
50
+ * @default
51
+ */
52
+ this.minMessage = 'This field need more items';
53
+ /**
54
+ * Max validation message.
55
+ * @type {boolean}
56
+ * @attr
57
+ * @default
58
+ */
59
+ this.maxMessage = 'This field exceeds the allowed amount of items';
60
+ /**
61
+ * Disables the input
62
+ * @type {boolean}
63
+ * @attr
64
+ * @default false
65
+ */
66
+ this.disabled = false;
67
+ /**
68
+ * Makes the input readonly
69
+ * @type {boolean}
70
+ * @attr
71
+ * @default false
72
+ */
73
+ this.readonly = false;
74
+ this.showLabels = true;
75
+ this._items = [];
76
+ this.consumeContext(UMB_DATA_TYPE_WORKSPACE_CONTEXT, (instance) => {
77
+ const workspace = instance;
78
+ this.observe(workspace.data, (data) => {
79
+ const property = data?.values.find((setting) => setting.alias === 'useLabel');
80
+ if (property)
81
+ this.showLabels = property.value;
82
+ });
83
+ });
84
+ this.addValidator('rangeUnderflow', () => this.minMessage, () => !!this.min && this._items.length < this.min);
85
+ this.addValidator('rangeOverflow', () => this.maxMessage, () => !!this.max && this._items.length > this.max);
86
+ }
87
+ get items() {
88
+ return this._items;
89
+ }
90
+ set items(items) {
91
+ this._items = items ?? [];
92
+ this.#prevalueSorter.setModel(this.items);
93
+ }
94
+ #onAdd() {
95
+ this._items = [...this._items, { value: '', label: '' }];
96
+ this.pristine = false;
97
+ this.dispatchEvent(new UmbChangeEvent());
98
+ this.#focusNewItem();
99
+ }
100
+ #onChange(event, currentIndex) {
101
+ event.stopPropagation();
102
+ const target = event.currentTarget;
103
+ const value = target.value;
104
+ const label = target.label;
105
+ this.items = this._items.map((item, index) => (index === currentIndex ? { value, label } : item));
106
+ this.dispatchEvent(new UmbChangeEvent());
107
+ }
108
+ async #focusNewItem() {
109
+ await this.updateComplete;
110
+ const items = this.shadowRoot?.querySelectorAll('umb-multiple-color-picker-item-input');
111
+ const newItem = items[items.length - 1];
112
+ newItem.focus();
113
+ }
114
+ #deleteItem(event, itemIndex) {
115
+ event.stopPropagation();
116
+ this._items = this._items.filter((item, index) => index !== itemIndex);
117
+ this.pristine = false;
118
+ this.dispatchEvent(new UmbChangeEvent());
119
+ }
120
+ getFormElement() {
121
+ return undefined;
122
+ }
123
+ render() {
124
+ return html `<div id="sorter-wrapper">${this.#renderItems()}</div>
125
+ ${this.#renderAddButton()} `;
126
+ }
127
+ #renderItems() {
128
+ return html `
129
+ ${repeat(this._items, (item) => item.value, (item, index) => html ` <umb-multiple-color-picker-item-input
130
+ ?showLabels=${this.showLabels}
131
+ value=${item.value}
132
+ data-sort-entry-id=${item.value}
133
+ label=${ifDefined(item.label)}
134
+ name="item-${index}"
135
+ @change=${(event) => this.#onChange(event, index)}
136
+ @delete="${(event) => this.#deleteItem(event, index)}"
137
+ ?disabled=${this.disabled}
138
+ ?readonly=${this.readonly}
139
+ required
140
+ required-message="Item ${index + 1} is missing a value"></umb-multiple-color-picker-item-input>`)}
141
+ `;
142
+ }
143
+ #renderAddButton() {
144
+ return html `
145
+ ${this.disabled || this.readonly
146
+ ? nothing
147
+ : html `<uui-button
148
+ id="action"
149
+ label=${this.localize.term('general_add')}
150
+ look="placeholder"
151
+ color="default"
152
+ @click="${this.#onAdd}"
153
+ ?disabled=${this.disabled}></uui-button>`}
154
+ `;
155
+ }
156
+ static { this.styles = [
157
+ css `
158
+ #action {
159
+ display: block;
160
+ }
161
+
162
+ .--umb-sorter-placeholder {
163
+ position: relative;
164
+ visibility: hidden;
165
+ }
166
+ .--umb-sorter-placeholder::after {
167
+ content: '';
168
+ position: absolute;
169
+ inset: 0px;
170
+ border-radius: var(--uui-border-radius);
171
+ border: 1px dashed var(--uui-color-divider-emphasis);
172
+ }
173
+ `,
174
+ ]; }
175
+ };
176
+ __decorate([
177
+ property({ type: Number })
178
+ ], UmbMultipleColorPickerInputElement.prototype, "min", void 0);
179
+ __decorate([
180
+ property({ type: String, attribute: 'min-message' })
181
+ ], UmbMultipleColorPickerInputElement.prototype, "minMessage", void 0);
182
+ __decorate([
183
+ property({ type: Number })
184
+ ], UmbMultipleColorPickerInputElement.prototype, "max", void 0);
185
+ __decorate([
186
+ property({ type: String, attribute: 'min-message' })
187
+ ], UmbMultipleColorPickerInputElement.prototype, "maxMessage", void 0);
188
+ __decorate([
189
+ property({ type: Boolean, reflect: true })
190
+ ], UmbMultipleColorPickerInputElement.prototype, "disabled", void 0);
191
+ __decorate([
192
+ property({ type: Boolean, reflect: true })
193
+ ], UmbMultipleColorPickerInputElement.prototype, "readonly", void 0);
194
+ __decorate([
195
+ property({ type: Boolean })
196
+ ], UmbMultipleColorPickerInputElement.prototype, "showLabels", void 0);
197
+ __decorate([
198
+ state()
199
+ ], UmbMultipleColorPickerInputElement.prototype, "_items", void 0);
200
+ __decorate([
201
+ property({ type: Array })
202
+ ], UmbMultipleColorPickerInputElement.prototype, "items", null);
203
+ UmbMultipleColorPickerInputElement = __decorate([
204
+ customElement('umb-multiple-color-picker-input')
205
+ ], UmbMultipleColorPickerInputElement);
206
+ export { UmbMultipleColorPickerInputElement };
207
+ export default UmbMultipleColorPickerInputElement;
@@ -0,0 +1,39 @@
1
+ import { UUIColorPickerElement, UUIInputElement } from '../../../../external/uui/index.js';
2
+ import { UmbLitElement } from '../../../../shared/lit-element/index.js';
3
+ declare const UmbMultipleColorPickerItemInputElement_base: (new (...args: any[]) => import("../../../../external/uui/index.js").FormControlMixinInterface) & typeof UmbLitElement;
4
+ /**
5
+ * @element umb-multiple-color-picker-item-input
6
+ */
7
+ export declare class UmbMultipleColorPickerItemInputElement extends UmbMultipleColorPickerItemInputElement_base {
8
+ #private;
9
+ /**
10
+ * Disables the input
11
+ * @type {boolean}
12
+ * @attr
13
+ * @default false
14
+ */
15
+ disabled: boolean;
16
+ /**
17
+ * Disables the input
18
+ * @type {boolean}
19
+ * @attr
20
+ * @default false
21
+ */
22
+ readonly: boolean;
23
+ label?: string;
24
+ protected _input?: UUIInputElement;
25
+ protected _colorPicker: UUIColorPickerElement;
26
+ private _modalContext?;
27
+ showLabels: boolean;
28
+ constructor();
29
+ focus(): Promise<void>;
30
+ protected getFormElement(): undefined;
31
+ render(): import("lit-html").TemplateResult<1>;
32
+ static styles: import("@lit/reactive-element/css-tag").CSSResult[];
33
+ }
34
+ export default UmbMultipleColorPickerItemInputElement;
35
+ declare global {
36
+ interface HTMLElementTagNameMap {
37
+ 'umb-multiple-color-picker-item-input': UmbMultipleColorPickerItemInputElement;
38
+ }
39
+ }