@umbraco-cms/backoffice 14.0.0--preview004-d0befea1 → 14.0.0--preview004-81428bf9
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-cms/custom-elements.json +78 -0
- package/dist-cms/packages/core/modal/token/import-dictionary-modal.token.d.ts +1 -1
- package/dist-cms/packages/dictionary/dictionary/components/dictionary-item-input/dictionary-item-input.context.d.ts +6 -0
- package/dist-cms/packages/dictionary/dictionary/components/dictionary-item-input/dictionary-item-input.context.js +7 -0
- package/dist-cms/packages/dictionary/dictionary/components/dictionary-item-input/dictionary-item-input.element.d.ts +50 -0
- package/dist-cms/packages/dictionary/dictionary/components/dictionary-item-input/dictionary-item-input.element.js +134 -0
- package/dist-cms/packages/dictionary/dictionary/components/index.d.ts +1 -0
- package/dist-cms/packages/dictionary/dictionary/components/index.js +1 -0
- package/dist-cms/packages/dictionary/dictionary/entity-actions/export/export.action.js +16 -5
- package/dist-cms/packages/dictionary/dictionary/entity-actions/import/import-dictionary-modal.element.d.ts +6 -6
- package/dist-cms/packages/dictionary/dictionary/entity-actions/import/import-dictionary-modal.element.js +150 -127
- package/dist-cms/packages/dictionary/dictionary/entity-actions/import/import.action.js +3 -9
- package/dist-cms/packages/dictionary/dictionary/index.d.ts +1 -0
- package/dist-cms/packages/dictionary/dictionary/index.js +1 -0
- package/dist-cms/tsconfig.build.tsbuildinfo +1 -1
- package/dist-cms/vscode-html-custom-data.json +27 -1
- package/package.json +1 -1
|
@@ -5377,6 +5377,84 @@
|
|
|
5377
5377
|
}
|
|
5378
5378
|
]
|
|
5379
5379
|
},
|
|
5380
|
+
{
|
|
5381
|
+
"name": "umb-dictionary-item-input",
|
|
5382
|
+
"path": "./../src/packages/dictionary/dictionary/components/dictionary-item-input/dictionary-item-input.element.ts",
|
|
5383
|
+
"attributes": [
|
|
5384
|
+
{
|
|
5385
|
+
"name": "min",
|
|
5386
|
+
"description": "This is a minimum amount of selected items in this input.",
|
|
5387
|
+
"type": "number",
|
|
5388
|
+
"default": "\"0\""
|
|
5389
|
+
},
|
|
5390
|
+
{
|
|
5391
|
+
"name": "max",
|
|
5392
|
+
"description": "This is a maximum amount of selected items in this input.",
|
|
5393
|
+
"type": "number",
|
|
5394
|
+
"default": "\"Infinity\""
|
|
5395
|
+
},
|
|
5396
|
+
{
|
|
5397
|
+
"name": "min-message",
|
|
5398
|
+
"description": "Min validation message.",
|
|
5399
|
+
"type": "boolean",
|
|
5400
|
+
"default": "\"\""
|
|
5401
|
+
},
|
|
5402
|
+
{
|
|
5403
|
+
"name": "maxMessage",
|
|
5404
|
+
"description": "Max validation message.",
|
|
5405
|
+
"type": "boolean",
|
|
5406
|
+
"default": "\"\""
|
|
5407
|
+
},
|
|
5408
|
+
{
|
|
5409
|
+
"name": "value",
|
|
5410
|
+
"type": "string"
|
|
5411
|
+
}
|
|
5412
|
+
],
|
|
5413
|
+
"properties": [
|
|
5414
|
+
{
|
|
5415
|
+
"name": "min",
|
|
5416
|
+
"attribute": "min",
|
|
5417
|
+
"description": "This is a minimum amount of selected items in this input.",
|
|
5418
|
+
"type": "number",
|
|
5419
|
+
"default": "\"0\""
|
|
5420
|
+
},
|
|
5421
|
+
{
|
|
5422
|
+
"name": "max",
|
|
5423
|
+
"attribute": "max",
|
|
5424
|
+
"description": "This is a maximum amount of selected items in this input.",
|
|
5425
|
+
"type": "number",
|
|
5426
|
+
"default": "\"Infinity\""
|
|
5427
|
+
},
|
|
5428
|
+
{
|
|
5429
|
+
"name": "minMessage",
|
|
5430
|
+
"attribute": "min-message",
|
|
5431
|
+
"description": "Min validation message.",
|
|
5432
|
+
"type": "boolean",
|
|
5433
|
+
"default": "\"\""
|
|
5434
|
+
},
|
|
5435
|
+
{
|
|
5436
|
+
"name": "maxMessage",
|
|
5437
|
+
"attribute": "maxMessage",
|
|
5438
|
+
"description": "Max validation message.",
|
|
5439
|
+
"type": "boolean",
|
|
5440
|
+
"default": "\"\""
|
|
5441
|
+
},
|
|
5442
|
+
{
|
|
5443
|
+
"name": "selectedIds",
|
|
5444
|
+
"type": "string[]"
|
|
5445
|
+
},
|
|
5446
|
+
{
|
|
5447
|
+
"name": "value",
|
|
5448
|
+
"attribute": "value",
|
|
5449
|
+
"type": "string"
|
|
5450
|
+
},
|
|
5451
|
+
{
|
|
5452
|
+
"name": "styles",
|
|
5453
|
+
"type": "array",
|
|
5454
|
+
"default": "[null]"
|
|
5455
|
+
}
|
|
5456
|
+
]
|
|
5457
|
+
},
|
|
5380
5458
|
{
|
|
5381
5459
|
"name": "umb-create-dictionary-modal",
|
|
5382
5460
|
"path": "./../src/packages/dictionary/dictionary/entity-actions/create/create-dictionary-modal.element.ts",
|
|
@@ -3,7 +3,7 @@ export interface UmbImportDictionaryModalData {
|
|
|
3
3
|
unique: string | null;
|
|
4
4
|
}
|
|
5
5
|
export interface UmbImportDictionaryModalValue {
|
|
6
|
-
temporaryFileId
|
|
6
|
+
temporaryFileId: string;
|
|
7
7
|
parentId?: string;
|
|
8
8
|
}
|
|
9
9
|
export declare const UMB_IMPORT_DICTIONARY_MODAL: UmbModalToken<UmbImportDictionaryModalData, UmbImportDictionaryModalValue>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { UmbPickerInputContext } from '../../../../core/picker-input/index.js';
|
|
2
|
+
import { UmbControllerHostElement } from '../../../../../libs/controller-api/index.js';
|
|
3
|
+
import { DictionaryItemItemResponseModel } from '../../../../../external/backend-api/index.js';
|
|
4
|
+
export declare class UmbDictionaryItemPickerContext extends UmbPickerInputContext<DictionaryItemItemResponseModel> {
|
|
5
|
+
constructor(host: UmbControllerHostElement);
|
|
6
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UmbPickerInputContext } from '../../../../core/picker-input/index.js';
|
|
2
|
+
import { UMB_DICTIONARY_ITEM_PICKER_MODAL } from '../../../../core/modal/index.js';
|
|
3
|
+
export class UmbDictionaryItemPickerContext extends UmbPickerInputContext {
|
|
4
|
+
constructor(host) {
|
|
5
|
+
super(host, 'Umb.Repository.Dictionary', UMB_DICTIONARY_ITEM_PICKER_MODAL);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { UmbLitElement } from '../../../../../shared/lit-element/index.js';
|
|
2
|
+
declare const UmbDictionaryItemInputElement_base: (new (...args: any[]) => import("../../../../../external/uui/index.js").FormControlMixinInterface) & typeof UmbLitElement;
|
|
3
|
+
export declare class UmbDictionaryItemInputElement extends UmbDictionaryItemInputElement_base {
|
|
4
|
+
#private;
|
|
5
|
+
/**
|
|
6
|
+
* This is a minimum amount of selected items in this input.
|
|
7
|
+
* @type {number}
|
|
8
|
+
* @attr
|
|
9
|
+
* @default 0
|
|
10
|
+
*/
|
|
11
|
+
get min(): number;
|
|
12
|
+
set min(value: number);
|
|
13
|
+
/**
|
|
14
|
+
* Min validation message.
|
|
15
|
+
* @type {boolean}
|
|
16
|
+
* @attr
|
|
17
|
+
* @default
|
|
18
|
+
*/
|
|
19
|
+
minMessage: string;
|
|
20
|
+
/**
|
|
21
|
+
* This is a maximum amount of selected items in this input.
|
|
22
|
+
* @type {number}
|
|
23
|
+
* @attr
|
|
24
|
+
* @default Infinity
|
|
25
|
+
*/
|
|
26
|
+
get max(): number;
|
|
27
|
+
set max(value: number);
|
|
28
|
+
/**
|
|
29
|
+
* Max validation message.
|
|
30
|
+
* @type {boolean}
|
|
31
|
+
* @attr
|
|
32
|
+
* @default
|
|
33
|
+
*/
|
|
34
|
+
maxMessage: string;
|
|
35
|
+
get selectedIds(): Array<string>;
|
|
36
|
+
set selectedIds(ids: Array<string>);
|
|
37
|
+
set value(idsString: string);
|
|
38
|
+
private _items?;
|
|
39
|
+
constructor();
|
|
40
|
+
protected getFormElement(): undefined;
|
|
41
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
42
|
+
private _renderItem;
|
|
43
|
+
static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
|
|
44
|
+
}
|
|
45
|
+
export default UmbDictionaryItemInputElement;
|
|
46
|
+
declare global {
|
|
47
|
+
interface HTMLElementTagNameMap {
|
|
48
|
+
'umb-dictionary-item-input': UmbDictionaryItemInputElement;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
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 { UmbDictionaryItemPickerContext } from './dictionary-item-input.context.js';
|
|
8
|
+
import { css, html, customElement, property, state, ifDefined, repeat } from '../../../../../external/lit/index.js';
|
|
9
|
+
import { FormControlMixin } from '../../../../../external/uui/index.js';
|
|
10
|
+
import { UmbLitElement } from '../../../../../shared/lit-element/index.js';
|
|
11
|
+
export let UmbDictionaryItemInputElement = class UmbDictionaryItemInputElement extends FormControlMixin(UmbLitElement) {
|
|
12
|
+
/**
|
|
13
|
+
* This is a minimum amount of selected items in this input.
|
|
14
|
+
* @type {number}
|
|
15
|
+
* @attr
|
|
16
|
+
* @default 0
|
|
17
|
+
*/
|
|
18
|
+
get min() {
|
|
19
|
+
return this.#pickerContext.min;
|
|
20
|
+
}
|
|
21
|
+
set min(value) {
|
|
22
|
+
this.#pickerContext.min = value;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* This is a maximum amount of selected items in this input.
|
|
26
|
+
* @type {number}
|
|
27
|
+
* @attr
|
|
28
|
+
* @default Infinity
|
|
29
|
+
*/
|
|
30
|
+
get max() {
|
|
31
|
+
return this.#pickerContext.max;
|
|
32
|
+
}
|
|
33
|
+
set max(value) {
|
|
34
|
+
this.#pickerContext.max = value;
|
|
35
|
+
}
|
|
36
|
+
get selectedIds() {
|
|
37
|
+
return this.#pickerContext.getSelection();
|
|
38
|
+
}
|
|
39
|
+
set selectedIds(ids) {
|
|
40
|
+
this.#pickerContext.setSelection(ids);
|
|
41
|
+
}
|
|
42
|
+
set value(idsString) {
|
|
43
|
+
// Its with full purpose we don't call super.value, as thats being handled by the observation of the context selection.
|
|
44
|
+
this.selectedIds = idsString.split(/[ ,]+/);
|
|
45
|
+
}
|
|
46
|
+
#pickerContext;
|
|
47
|
+
constructor() {
|
|
48
|
+
super();
|
|
49
|
+
/**
|
|
50
|
+
* Min validation message.
|
|
51
|
+
* @type {boolean}
|
|
52
|
+
* @attr
|
|
53
|
+
* @default
|
|
54
|
+
*/
|
|
55
|
+
this.minMessage = 'This field need more items';
|
|
56
|
+
/**
|
|
57
|
+
* Max validation message.
|
|
58
|
+
* @type {boolean}
|
|
59
|
+
* @attr
|
|
60
|
+
* @default
|
|
61
|
+
*/
|
|
62
|
+
this.maxMessage = 'This field exceeds the allowed amount of items';
|
|
63
|
+
this.#pickerContext = new UmbDictionaryItemPickerContext(this);
|
|
64
|
+
this.addValidator('rangeUnderflow', () => this.minMessage, () => !!this.min && this.#pickerContext.getSelection().length < this.min);
|
|
65
|
+
this.addValidator('rangeOverflow', () => this.maxMessage, () => !!this.max && this.#pickerContext.getSelection().length > this.max);
|
|
66
|
+
this.observe(this.#pickerContext.selection, (selection) => (super.value = selection.join(',')));
|
|
67
|
+
this.observe(this.#pickerContext.selectedItems, (selectedItems) => (this._items = selectedItems));
|
|
68
|
+
}
|
|
69
|
+
getFormElement() {
|
|
70
|
+
return undefined;
|
|
71
|
+
}
|
|
72
|
+
render() {
|
|
73
|
+
return html `
|
|
74
|
+
${this._items
|
|
75
|
+
? html ` <uui-ref-list
|
|
76
|
+
>${repeat(this._items, (item) => item.id, (item) => this._renderItem(item))}
|
|
77
|
+
</uui-ref-list>`
|
|
78
|
+
: ''}
|
|
79
|
+
${this.#renderAddButton()}
|
|
80
|
+
`;
|
|
81
|
+
}
|
|
82
|
+
#renderAddButton() {
|
|
83
|
+
if (this.max > 0 && this.selectedIds.length >= this.max)
|
|
84
|
+
return;
|
|
85
|
+
return html `<uui-button
|
|
86
|
+
id="add-button"
|
|
87
|
+
look="placeholder"
|
|
88
|
+
@click=${() => this.#pickerContext.openPicker()}
|
|
89
|
+
label=${this.localize.term('general_add')}></uui-button>`;
|
|
90
|
+
}
|
|
91
|
+
_renderItem(item) {
|
|
92
|
+
if (!item.id)
|
|
93
|
+
return;
|
|
94
|
+
return html `
|
|
95
|
+
<uui-ref-node name=${ifDefined(item.name)} detail=${ifDefined(item.id)}>
|
|
96
|
+
<!-- TODO: implement is trashed <uui-tag size="s" slot="tag" color="danger">Trashed</uui-tag> -->
|
|
97
|
+
<uui-action-bar slot="actions">
|
|
98
|
+
<uui-button
|
|
99
|
+
@click=${() => this.#pickerContext.requestRemoveItem(item.id)}
|
|
100
|
+
label=${this.localize.term('actions_remove')}></uui-button>
|
|
101
|
+
</uui-action-bar>
|
|
102
|
+
</uui-ref-node>
|
|
103
|
+
`;
|
|
104
|
+
}
|
|
105
|
+
static { this.styles = [
|
|
106
|
+
css `
|
|
107
|
+
#add-button {
|
|
108
|
+
width: 100%;
|
|
109
|
+
}
|
|
110
|
+
`,
|
|
111
|
+
]; }
|
|
112
|
+
};
|
|
113
|
+
__decorate([
|
|
114
|
+
property({ type: Number })
|
|
115
|
+
], UmbDictionaryItemInputElement.prototype, "min", null);
|
|
116
|
+
__decorate([
|
|
117
|
+
property({ type: String, attribute: 'min-message' })
|
|
118
|
+
], UmbDictionaryItemInputElement.prototype, "minMessage", void 0);
|
|
119
|
+
__decorate([
|
|
120
|
+
property({ type: Number })
|
|
121
|
+
], UmbDictionaryItemInputElement.prototype, "max", null);
|
|
122
|
+
__decorate([
|
|
123
|
+
property({ type: String, attribute: 'min-message' })
|
|
124
|
+
], UmbDictionaryItemInputElement.prototype, "maxMessage", void 0);
|
|
125
|
+
__decorate([
|
|
126
|
+
property()
|
|
127
|
+
], UmbDictionaryItemInputElement.prototype, "value", null);
|
|
128
|
+
__decorate([
|
|
129
|
+
state()
|
|
130
|
+
], UmbDictionaryItemInputElement.prototype, "_items", void 0);
|
|
131
|
+
UmbDictionaryItemInputElement = __decorate([
|
|
132
|
+
customElement('umb-dictionary-item-input')
|
|
133
|
+
], UmbDictionaryItemInputElement);
|
|
134
|
+
export default UmbDictionaryItemInputElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dictionary-item-input/dictionary-item-input.element.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './dictionary-item-input/dictionary-item-input.element.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UmbTextStyles } from
|
|
1
|
+
import { UmbTextStyles } from '../../../../../shared/style/index.js';
|
|
2
2
|
import { UmbEntityActionBase } from '../../../../core/entity-action/index.js';
|
|
3
3
|
import { UMB_MODAL_MANAGER_CONTEXT_TOKEN, UMB_EXPORT_DICTIONARY_MODAL, } from '../../../../core/modal/index.js';
|
|
4
4
|
export default class UmbExportDictionaryEntityAction extends UmbEntityActionBase {
|
|
@@ -11,16 +11,27 @@ export default class UmbExportDictionaryEntityAction extends UmbEntityActionBase
|
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
async execute() {
|
|
14
|
-
// TODO: what to do if modal service is not available?
|
|
15
14
|
if (!this.#modalContext)
|
|
16
15
|
return;
|
|
17
16
|
const modalContext = this.#modalContext?.open(UMB_EXPORT_DICTIONARY_MODAL, { unique: this.unique });
|
|
18
|
-
// TODO: get type from modal result
|
|
19
17
|
const { includeChildren } = await modalContext.onSubmit();
|
|
20
18
|
if (includeChildren === undefined)
|
|
21
19
|
return;
|
|
20
|
+
// Export the file
|
|
22
21
|
const result = await this.repository?.export(this.unique, includeChildren);
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
const blobContent = await result?.data;
|
|
23
|
+
if (!blobContent)
|
|
24
|
+
return;
|
|
25
|
+
const blob = new Blob([blobContent], { type: 'text/plain' });
|
|
26
|
+
const a = document.createElement('a');
|
|
27
|
+
const url = window.URL.createObjectURL(blob);
|
|
28
|
+
// Download
|
|
29
|
+
a.href = url;
|
|
30
|
+
a.download = `${this.unique}.udt`;
|
|
31
|
+
document.body.appendChild(a);
|
|
32
|
+
a.click();
|
|
33
|
+
document.body.removeChild(a);
|
|
34
|
+
// Clean up
|
|
35
|
+
window.URL.revokeObjectURL(url);
|
|
25
36
|
}
|
|
26
37
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
+
import '../../components/dictionary-item-input/dictionary-item-input.element.js';
|
|
1
2
|
import { UmbImportDictionaryModalData, UmbImportDictionaryModalValue, UmbModalBaseElement } from '../../../../core/modal/index.js';
|
|
2
3
|
export declare class UmbImportDictionaryModalLayout extends UmbModalBaseElement<UmbImportDictionaryModalData, UmbImportDictionaryModalValue> {
|
|
3
4
|
#private;
|
|
4
|
-
|
|
5
|
+
private _parentId?;
|
|
6
|
+
private _temporaryFileId?;
|
|
5
7
|
private _form;
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
private _showImportView;
|
|
9
|
-
private _showErrorView;
|
|
10
|
-
private _selection;
|
|
8
|
+
constructor();
|
|
9
|
+
connectedCallback(): void;
|
|
11
10
|
render(): import("lit-html").TemplateResult<1>;
|
|
11
|
+
static styles: import("@lit/reactive-element/css-tag.js").CSSResult[];
|
|
12
12
|
}
|
|
13
13
|
export default UmbImportDictionaryModalLayout;
|
|
14
14
|
declare global {
|