@jumoo/usync 18.2.0 → 18.3.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/LICENCE +372 -372
- package/README.md +16 -10
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.js +1 -1
- package/dist/api/sdk.gen.d.ts +2 -1
- package/dist/api/sdk.gen.js +5 -0
- package/dist/api/types.gen.d.ts +37 -0
- package/dist/components/usync-action-box.js +71 -71
- package/dist/components/usync-change-detail.js +409 -409
- package/dist/components/usync-change-view.js +49 -49
- package/dist/components/usync-content-preview.d.ts +27 -0
- package/dist/components/usync-content-preview.js +532 -0
- package/dist/components/usync-content-type-preview.d.ts +25 -0
- package/dist/components/usync-content-type-preview.js +530 -0
- package/dist/components/usync-data-type-preview.d.ts +21 -0
- package/dist/components/usync-data-type-preview.js +295 -0
- package/dist/components/usync-progress-box.js +113 -113
- package/dist/components/usync-result-row.js +65 -65
- package/dist/components/usync-results-group-view.js +63 -63
- package/dist/components/usync-results-view.js +77 -69
- package/dist/components/usync-sync-file-info-view.js +10 -10
- package/dist/constants.js +1 -1
- package/dist/dialogs/details-modal-element.d.ts +15 -0
- package/dist/dialogs/details-modal-element.js +260 -50
- package/dist/dialogs/details-modal-token.d.ts +10 -1
- package/dist/dialogs/error-modal-element.js +22 -22
- package/dist/dialogs/legacy-modal-element.js +22 -22
- package/dist/dialogs/single-import-modal.element.js +31 -31
- package/dist/exports.d.ts +1 -0
- package/dist/exports.js +1 -0
- package/dist/icons/svg/logo.js +20 -20
- package/dist/lang/files/da-dk.d.ts +37 -0
- package/dist/lang/files/da-dk.js +49 -12
- package/dist/lang/files/de-de.d.ts +37 -0
- package/dist/lang/files/de-de.js +49 -12
- package/dist/lang/files/en-us.d.ts +50 -0
- package/dist/lang/files/en-us.js +62 -12
- package/dist/lang/files/es-es.d.ts +37 -0
- package/dist/lang/files/es-es.js +49 -12
- package/dist/lang/files/fr-fr.d.ts +37 -0
- package/dist/lang/files/fr-fr.js +49 -12
- package/dist/lang/files/nl-nl.d.ts +37 -0
- package/dist/lang/files/nl-nl.js +49 -12
- package/dist/manifests.js +2 -0
- package/dist/preview/index.d.ts +1 -0
- package/dist/preview/index.js +1 -0
- package/dist/preview/manifest.d.ts +2 -0
- package/dist/preview/manifest.js +22 -0
- package/dist/preview/types.d.ts +72 -0
- package/dist/preview/types.js +2 -0
- package/dist/repository/SyncAction.respositoy.d.ts +13 -0
- package/dist/repository/SyncAction.respositoy.js +6 -0
- package/dist/repository/sources/SyncAction.source.d.ts +10 -0
- package/dist/repository/sources/SyncAction.source.js +6 -1
- package/dist/signalr/signalr.context.js +73 -26
- package/dist/tree/usync.menu-element.js +8 -8
- package/dist/utils/preview/content-type-diff.d.ts +18 -0
- package/dist/utils/preview/content-type-diff.js +72 -0
- package/dist/utils/preview/content-type-layout.d.ts +39 -0
- package/dist/utils/preview/content-type-layout.js +100 -0
- package/dist/workspace/components/usync-action-button.js +53 -53
- package/dist/workspace/components/usync-file-picker.element.js +33 -33
- package/dist/workspace/components/usync-file-upload.element.js +25 -25
- package/dist/workspace/dialogs/import-modal.element.js +22 -22
- package/dist/workspace/views/addons/addons.element.js +97 -97
- package/dist/workspace/views/default/default.element.js +186 -186
- package/dist/workspace/views/legacy/legacy.element.js +81 -81
- package/dist/workspace/views/settings/components/usyncSettingItem.element.js +38 -38
- package/dist/workspace/views/settings/settings.element.js +124 -124
- package/dist/workspace/workspace.element.js +16 -16
- package/package.json +77 -77
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { deepEqual } from '../diff/deep-equal.js';
|
|
2
|
+
import { compositionIds, } from './content-type-layout.js';
|
|
3
|
+
const TYPE_FIELDS = [
|
|
4
|
+
'alias',
|
|
5
|
+
'name',
|
|
6
|
+
'description',
|
|
7
|
+
'icon',
|
|
8
|
+
'allowedAsRoot',
|
|
9
|
+
'variesByCulture',
|
|
10
|
+
'variesBySegment',
|
|
11
|
+
'isElement',
|
|
12
|
+
'collection',
|
|
13
|
+
];
|
|
14
|
+
const PROPERTY_FIELDS = [
|
|
15
|
+
'alias',
|
|
16
|
+
'name',
|
|
17
|
+
'description',
|
|
18
|
+
'dataType',
|
|
19
|
+
'container',
|
|
20
|
+
'sortOrder',
|
|
21
|
+
'variesByCulture',
|
|
22
|
+
'variesBySegment',
|
|
23
|
+
'validation',
|
|
24
|
+
'appearance',
|
|
25
|
+
];
|
|
26
|
+
const CONTAINER_FIELDS = ['name', 'type', 'parent', 'sortOrder'];
|
|
27
|
+
/**
|
|
28
|
+
* compare two versions of a content type by key. Items only in the current
|
|
29
|
+
* version are being removed, items only in the incoming version are being added.
|
|
30
|
+
*/
|
|
31
|
+
export function diffContentTypes(current, incoming) {
|
|
32
|
+
const fields = new Set();
|
|
33
|
+
if (current && incoming) {
|
|
34
|
+
for (const field of TYPE_FIELDS) {
|
|
35
|
+
if (!deepEqual(current[field], incoming[field]))
|
|
36
|
+
fields.add(field);
|
|
37
|
+
}
|
|
38
|
+
if (!deepEqual([...compositionIds(current)].sort(), [...compositionIds(incoming)].sort())) {
|
|
39
|
+
fields.add('compositions');
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
fields,
|
|
44
|
+
properties: diffById(current?.properties, incoming?.properties, PROPERTY_FIELDS),
|
|
45
|
+
containers: diffById(current?.containers, incoming?.containers, CONTAINER_FIELDS),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function diffById(current, incoming, fields) {
|
|
49
|
+
const changes = new Map();
|
|
50
|
+
// a whole type being added or removed is shown by its headline, don't mark every item.
|
|
51
|
+
if (!current || !incoming)
|
|
52
|
+
return changes;
|
|
53
|
+
const before = new Map(current.map((item) => [item.id, item]));
|
|
54
|
+
const after = new Map(incoming.map((item) => [item.id, item]));
|
|
55
|
+
for (const [id, item] of before) {
|
|
56
|
+
const other = after.get(id);
|
|
57
|
+
if (!other) {
|
|
58
|
+
changes.set(id, { status: 'removed', fields: [] });
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
const changed = fields
|
|
62
|
+
.filter((field) => !deepEqual(item[field], other[field]))
|
|
63
|
+
.map(String);
|
|
64
|
+
if (changed.length > 0)
|
|
65
|
+
changes.set(id, { status: 'changed', fields: changed });
|
|
66
|
+
}
|
|
67
|
+
for (const id of after.keys()) {
|
|
68
|
+
if (!before.has(id))
|
|
69
|
+
changes.set(id, { status: 'added', fields: [] });
|
|
70
|
+
}
|
|
71
|
+
return changes;
|
|
72
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { DocumentTypeResponseModel, MediaTypeResponseModel, MemberTypeResponseModel } from '@umbraco-cms/backoffice/external/backend-api';
|
|
2
|
+
/**
|
|
3
|
+
* the shape document, media and member types share - enough to lay out
|
|
4
|
+
* the editor view and compare two versions.
|
|
5
|
+
*/
|
|
6
|
+
export type USyncPreviewContentType = DocumentTypeResponseModel | MediaTypeResponseModel | MemberTypeResponseModel;
|
|
7
|
+
export type USyncPreviewProperty = USyncPreviewContentType['properties'][number];
|
|
8
|
+
export type USyncPreviewContainer = USyncPreviewContentType['containers'][number];
|
|
9
|
+
export interface USyncLayoutProperty {
|
|
10
|
+
property: USyncPreviewProperty;
|
|
11
|
+
/** name of the composition this property comes from (undefined when it's the type's own) */
|
|
12
|
+
inheritedFrom?: string;
|
|
13
|
+
}
|
|
14
|
+
export interface USyncLayoutGroup {
|
|
15
|
+
name: string;
|
|
16
|
+
/** ids of every container merged into this group (own + compositions) */
|
|
17
|
+
ids: string[];
|
|
18
|
+
inherited: boolean;
|
|
19
|
+
sortOrder: number;
|
|
20
|
+
properties: USyncLayoutProperty[];
|
|
21
|
+
}
|
|
22
|
+
export interface USyncLayoutTab {
|
|
23
|
+
name: string;
|
|
24
|
+
ids: string[];
|
|
25
|
+
inherited: boolean;
|
|
26
|
+
sortOrder: number;
|
|
27
|
+
/** properties placed directly on the tab, outside any group */
|
|
28
|
+
properties: USyncLayoutProperty[];
|
|
29
|
+
groups: USyncLayoutGroup[];
|
|
30
|
+
}
|
|
31
|
+
/** name used for the tab that holds groups which aren't inside a tab */
|
|
32
|
+
export declare const USYNC_GENERIC_TAB = "";
|
|
33
|
+
/** the ids of the types this one is composed of (or inherits from). */
|
|
34
|
+
export declare function compositionIds(type: USyncPreviewContentType): string[];
|
|
35
|
+
/**
|
|
36
|
+
* build the tabs and groups an editor would see, merging in the containers
|
|
37
|
+
* and properties from compositions the way the backoffice does (by name).
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildContentTypeLayout(type: USyncPreviewContentType, compositions: Map<string, USyncPreviewContentType>): USyncLayoutTab[];
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/** name used for the tab that holds groups which aren't inside a tab */
|
|
2
|
+
export const USYNC_GENERIC_TAB = '';
|
|
3
|
+
/** the ids of the types this one is composed of (or inherits from). */
|
|
4
|
+
export function compositionIds(type) {
|
|
5
|
+
return type.compositions.map((composition) => {
|
|
6
|
+
if ('documentType' in composition)
|
|
7
|
+
return composition.documentType.id;
|
|
8
|
+
if ('mediaType' in composition)
|
|
9
|
+
return composition.mediaType.id;
|
|
10
|
+
return composition.memberType.id;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* build the tabs and groups an editor would see, merging in the containers
|
|
15
|
+
* and properties from compositions the way the backoffice does (by name).
|
|
16
|
+
*/
|
|
17
|
+
export function buildContentTypeLayout(type, compositions) {
|
|
18
|
+
const tabs = new Map();
|
|
19
|
+
const tabFor = (name, id, sortOrder, inherited) => {
|
|
20
|
+
let tab = tabs.get(name);
|
|
21
|
+
if (!tab) {
|
|
22
|
+
tab = { name, ids: [], inherited, sortOrder, properties: [], groups: [] };
|
|
23
|
+
tabs.set(name, tab);
|
|
24
|
+
}
|
|
25
|
+
if (id)
|
|
26
|
+
tab.ids.push(id);
|
|
27
|
+
tab.inherited && (tab.inherited = inherited);
|
|
28
|
+
return tab;
|
|
29
|
+
};
|
|
30
|
+
const groupFor = (tab, name, id, sortOrder, inherited) => {
|
|
31
|
+
let group = tab.groups.find((g) => g.name === name);
|
|
32
|
+
if (!group) {
|
|
33
|
+
group = { name, ids: [], inherited, sortOrder, properties: [] };
|
|
34
|
+
tab.groups.push(group);
|
|
35
|
+
}
|
|
36
|
+
group.ids.push(id);
|
|
37
|
+
group.inherited && (group.inherited = inherited);
|
|
38
|
+
return group;
|
|
39
|
+
};
|
|
40
|
+
for (const source of contributors(type, compositions)) {
|
|
41
|
+
const inherited = source !== type;
|
|
42
|
+
const containers = new Map(source.containers.map((c) => [c.id, c]));
|
|
43
|
+
// where each container (and so each property) lands in the merged layout.
|
|
44
|
+
const placed = new Map();
|
|
45
|
+
for (const container of [...source.containers].sort(bySortOrder)) {
|
|
46
|
+
if (container.type === 'Tab') {
|
|
47
|
+
placed.set(container.id, tabFor(container.name ?? '', container.id, container.sortOrder, inherited));
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
for (const container of [...source.containers].sort(bySortOrder)) {
|
|
51
|
+
if (container.type !== 'Group')
|
|
52
|
+
continue;
|
|
53
|
+
const parent = container.parent ? containers.get(container.parent.id) : undefined;
|
|
54
|
+
const tab = parent
|
|
55
|
+
? tabFor(parent.name ?? '', undefined, parent.sortOrder, inherited)
|
|
56
|
+
: tabFor(USYNC_GENERIC_TAB, undefined, -1, inherited);
|
|
57
|
+
placed.set(container.id, groupFor(tab, container.name ?? '', container.id, container.sortOrder, inherited));
|
|
58
|
+
}
|
|
59
|
+
for (const property of [...source.properties].sort(bySortOrder)) {
|
|
60
|
+
const target = property.container ? placed.get(property.container.id) : undefined;
|
|
61
|
+
const entry = { property, inheritedFrom: inherited ? source.name : undefined };
|
|
62
|
+
if (target) {
|
|
63
|
+
target.properties.push(entry);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
tabFor(USYNC_GENERIC_TAB, undefined, -1, inherited).properties.push(entry);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const result = [...tabs.values()].sort(bySortOrder);
|
|
71
|
+
for (const tab of result) {
|
|
72
|
+
tab.groups.sort(bySortOrder);
|
|
73
|
+
tab.properties.sort((a, b) => a.property.sortOrder - b.property.sortOrder);
|
|
74
|
+
for (const group of tab.groups) {
|
|
75
|
+
group.properties.sort((a, b) => a.property.sortOrder - b.property.sortOrder);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return result.filter((tab) => tab.properties.length > 0 || tab.groups.length > 0);
|
|
79
|
+
}
|
|
80
|
+
/** the type itself first, then everything it is composed of (depth first, no repeats). */
|
|
81
|
+
function contributors(type, compositions) {
|
|
82
|
+
const seen = new Set();
|
|
83
|
+
const out = [];
|
|
84
|
+
const visit = (current) => {
|
|
85
|
+
if (seen.has(current.id))
|
|
86
|
+
return;
|
|
87
|
+
seen.add(current.id);
|
|
88
|
+
out.push(current);
|
|
89
|
+
for (const id of compositionIds(current)) {
|
|
90
|
+
const composition = compositions.get(id);
|
|
91
|
+
if (composition)
|
|
92
|
+
visit(composition);
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
visit(type);
|
|
96
|
+
return out;
|
|
97
|
+
}
|
|
98
|
+
function bySortOrder(a, b) {
|
|
99
|
+
return a.sortOrder - b.sortOrder;
|
|
100
|
+
}
|
|
@@ -26,58 +26,58 @@ let SyncActionButtonElement = class SyncActionButtonElement extends UmbLitElemen
|
|
|
26
26
|
: this.renderSingleAction();
|
|
27
27
|
}
|
|
28
28
|
renderSingleAction() {
|
|
29
|
-
return html ` <uui-button
|
|
30
|
-
class="action-button"
|
|
31
|
-
.disabled=${this.disabled}
|
|
32
|
-
label=${this.localize.termOrDefault(`uSync_${this.button?.label}`, this.button?.label ?? '')}
|
|
33
|
-
color=${this.button?.color}
|
|
34
|
-
look=${this.button?.look}
|
|
35
|
-
state=${ifDefined(this.state)}
|
|
29
|
+
return html ` <uui-button
|
|
30
|
+
class="action-button"
|
|
31
|
+
.disabled=${this.disabled}
|
|
32
|
+
label=${this.localize.termOrDefault(`uSync_${this.button?.label}`, this.button?.label ?? '')}
|
|
33
|
+
color=${this.button?.color}
|
|
34
|
+
look=${this.button?.look}
|
|
35
|
+
state=${ifDefined(this.state)}
|
|
36
36
|
@click=${() => __classPrivateFieldGet(this, _SyncActionButtonElement_instances, "m", _SyncActionButtonElement_onClick).call(this, this.button)}></uui-button>`;
|
|
37
37
|
}
|
|
38
38
|
renderMultipleActions(parent) {
|
|
39
39
|
if (!this.button?.children)
|
|
40
40
|
return nothing;
|
|
41
41
|
const buttons = this.button?.children.map((item) => {
|
|
42
|
-
return html ` <uui-menu-item
|
|
43
|
-
.disabled=${this.disabled}
|
|
44
|
-
.label=${this.localize.termOrDefault(`uSync_${item.label}`, item.label)}
|
|
42
|
+
return html ` <uui-menu-item
|
|
43
|
+
.disabled=${this.disabled}
|
|
44
|
+
.label=${this.localize.termOrDefault(`uSync_${item.label}`, item.label)}
|
|
45
45
|
@click-label=${() => __classPrivateFieldGet(this, _SyncActionButtonElement_instances, "m", _SyncActionButtonElement_onClick).call(this, item)}></uui-menu-item>`;
|
|
46
46
|
});
|
|
47
47
|
if (buttons.length == 0)
|
|
48
48
|
return nothing;
|
|
49
49
|
const popoverId = `popover_${parent?.key}`;
|
|
50
|
-
return html `
|
|
51
|
-
<uui-button-group class="action-button">
|
|
52
|
-
<uui-button
|
|
53
|
-
.disabled=${this.disabled}
|
|
54
|
-
.label=${this.button.label}
|
|
55
|
-
color=${parent?.color}
|
|
56
|
-
look=${parent?.look}
|
|
57
|
-
@click=${() => __classPrivateFieldGet(this, _SyncActionButtonElement_instances, "m", _SyncActionButtonElement_onClick).call(this, this.button)}>
|
|
58
|
-
${this.localize.termOrDefault(`uSync_${this.button?.label}`, this.button?.label ?? '')}
|
|
59
|
-
</uui-button>
|
|
60
|
-
<uui-button
|
|
61
|
-
.disabled=${this.disabled}
|
|
62
|
-
popovertarget=${popoverId}
|
|
63
|
-
.label=${this.button.label}
|
|
64
|
-
color=${parent?.color}
|
|
65
|
-
look=${parent?.look}
|
|
66
|
-
compact>
|
|
67
|
-
<uui-symbol-expand
|
|
68
|
-
class="expand-symbol"
|
|
69
|
-
.open=${this._popoverOpen}></uui-symbol-expand>
|
|
70
|
-
</uui-button>
|
|
71
|
-
</uui-button-group>
|
|
72
|
-
|
|
73
|
-
<uui-popover-container
|
|
74
|
-
id=${popoverId}
|
|
75
|
-
placement="bottom-end"
|
|
76
|
-
@toggle=${__classPrivateFieldGet(this, _SyncActionButtonElement_instances, "m", _SyncActionButtonElement_onPopoverToggle)}>
|
|
77
|
-
<umb-popover-layout>
|
|
78
|
-
<uui-scroll-container> ${buttons} </uui-scroll-container>
|
|
79
|
-
</umb-popover-layout>
|
|
80
|
-
</uui-popover-container>
|
|
50
|
+
return html `
|
|
51
|
+
<uui-button-group class="action-button">
|
|
52
|
+
<uui-button
|
|
53
|
+
.disabled=${this.disabled}
|
|
54
|
+
.label=${this.button.label}
|
|
55
|
+
color=${parent?.color}
|
|
56
|
+
look=${parent?.look}
|
|
57
|
+
@click=${() => __classPrivateFieldGet(this, _SyncActionButtonElement_instances, "m", _SyncActionButtonElement_onClick).call(this, this.button)}>
|
|
58
|
+
${this.localize.termOrDefault(`uSync_${this.button?.label}`, this.button?.label ?? '')}
|
|
59
|
+
</uui-button>
|
|
60
|
+
<uui-button
|
|
61
|
+
.disabled=${this.disabled}
|
|
62
|
+
popovertarget=${popoverId}
|
|
63
|
+
.label=${this.button.label}
|
|
64
|
+
color=${parent?.color}
|
|
65
|
+
look=${parent?.look}
|
|
66
|
+
compact>
|
|
67
|
+
<uui-symbol-expand
|
|
68
|
+
class="expand-symbol"
|
|
69
|
+
.open=${this._popoverOpen}></uui-symbol-expand>
|
|
70
|
+
</uui-button>
|
|
71
|
+
</uui-button-group>
|
|
72
|
+
|
|
73
|
+
<uui-popover-container
|
|
74
|
+
id=${popoverId}
|
|
75
|
+
placement="bottom-end"
|
|
76
|
+
@toggle=${__classPrivateFieldGet(this, _SyncActionButtonElement_instances, "m", _SyncActionButtonElement_onPopoverToggle)}>
|
|
77
|
+
<umb-popover-layout>
|
|
78
|
+
<uui-scroll-container> ${buttons} </uui-scroll-container>
|
|
79
|
+
</umb-popover-layout>
|
|
80
|
+
</uui-popover-container>
|
|
81
81
|
`;
|
|
82
82
|
}
|
|
83
83
|
};
|
|
@@ -90,18 +90,18 @@ _SyncActionButtonElement_onClick = function _SyncActionButtonElement_onClick(ite
|
|
|
90
90
|
_SyncActionButtonElement_onPopoverToggle = function _SyncActionButtonElement_onPopoverToggle(e) {
|
|
91
91
|
this._popoverOpen = e.newState === 'open';
|
|
92
92
|
};
|
|
93
|
-
SyncActionButtonElement.styles = css `
|
|
94
|
-
.action-button {
|
|
95
|
-
min-width: 110px;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.expand-symbol {
|
|
99
|
-
transform: rotate(90deg);
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.expand-symbol[open] {
|
|
103
|
-
transform: rotate(180deg);
|
|
104
|
-
}
|
|
93
|
+
SyncActionButtonElement.styles = css `
|
|
94
|
+
.action-button {
|
|
95
|
+
min-width: 110px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.expand-symbol {
|
|
99
|
+
transform: rotate(90deg);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.expand-symbol[open] {
|
|
103
|
+
transform: rotate(180deg);
|
|
104
|
+
}
|
|
105
105
|
`;
|
|
106
106
|
__decorate([
|
|
107
107
|
property({ type: Object })
|
|
@@ -38,53 +38,53 @@ let uSyncFilePicker = class uSyncFilePicker extends UmbLitElement {
|
|
|
38
38
|
this.dispatchEvent(new uSyncFilePickerChangeEvent(this._file));
|
|
39
39
|
}
|
|
40
40
|
render() {
|
|
41
|
-
return html `<input
|
|
42
|
-
@click=${(e) => e.stopPropagation()}
|
|
43
|
-
type="file"
|
|
44
|
-
id="file"
|
|
45
|
-
this.accept=${this.accept}
|
|
46
|
-
@change=${this._onFilePickerChange} />
|
|
41
|
+
return html `<input
|
|
42
|
+
@click=${(e) => e.stopPropagation()}
|
|
43
|
+
type="file"
|
|
44
|
+
id="file"
|
|
45
|
+
this.accept=${this.accept}
|
|
46
|
+
@change=${this._onFilePickerChange} />
|
|
47
47
|
${this._renderFile()} ${this._renderButton()}`;
|
|
48
48
|
}
|
|
49
49
|
_renderFile() {
|
|
50
50
|
if (!this._file)
|
|
51
51
|
return nothing;
|
|
52
|
-
return html ` <div class="file">
|
|
53
|
-
<div>${this._file.name}</div>
|
|
54
|
-
<uui-button
|
|
55
|
-
@click="${() => this._removeFile()}"
|
|
56
|
-
compact
|
|
57
|
-
color="danger"
|
|
58
|
-
label="Remove">
|
|
59
|
-
<umb-icon name="icon-trash"></umb-icon>
|
|
60
|
-
</uui-button>
|
|
52
|
+
return html ` <div class="file">
|
|
53
|
+
<div>${this._file.name}</div>
|
|
54
|
+
<uui-button
|
|
55
|
+
@click="${() => this._removeFile()}"
|
|
56
|
+
compact
|
|
57
|
+
color="danger"
|
|
58
|
+
label="Remove">
|
|
59
|
+
<umb-icon name="icon-trash"></umb-icon>
|
|
60
|
+
</uui-button>
|
|
61
61
|
</div>`;
|
|
62
62
|
}
|
|
63
63
|
_renderButton() {
|
|
64
64
|
return this._file
|
|
65
65
|
? nothing
|
|
66
|
-
: html ` <uui-button
|
|
67
|
-
id="add-button"
|
|
68
|
-
look="placeholder"
|
|
69
|
-
label=${this.label}
|
|
66
|
+
: html ` <uui-button
|
|
67
|
+
id="add-button"
|
|
68
|
+
look="placeholder"
|
|
69
|
+
label=${this.label}
|
|
70
70
|
@click="${this._onUpload}"></uui-button>`;
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
uSyncFilePicker.styles = [
|
|
74
|
-
css `
|
|
75
|
-
.file {
|
|
76
|
-
display: flex;
|
|
77
|
-
align-items: center;
|
|
78
|
-
gap: var(--uui-size-space-2);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
#file {
|
|
82
|
-
display: none;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
#add-button {
|
|
86
|
-
width: 100%;
|
|
87
|
-
}
|
|
74
|
+
css `
|
|
75
|
+
.file {
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
gap: var(--uui-size-space-2);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
#file {
|
|
82
|
+
display: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
#add-button {
|
|
86
|
+
width: 100%;
|
|
87
|
+
}
|
|
88
88
|
`,
|
|
89
89
|
];
|
|
90
90
|
__decorate([
|
|
@@ -46,22 +46,22 @@ let uSyncFileUploadElement = class uSyncFileUploadElement extends UmbLitElement
|
|
|
46
46
|
return html ` ${this.renderFile()} ${this.renderUploadButton()} `;
|
|
47
47
|
}
|
|
48
48
|
renderFile() {
|
|
49
|
-
return html `
|
|
50
|
-
<div class="upload-box">
|
|
51
|
-
<usync-upload-file-picker
|
|
52
|
-
label="Select uSync Zip file"
|
|
53
|
-
@change=${__classPrivateFieldGet(this, _uSyncFileUploadElement_instances, "m", _uSyncFileUploadElement_onFileChange)}></usync-upload-file-picker>
|
|
54
|
-
</div>
|
|
49
|
+
return html `
|
|
50
|
+
<div class="upload-box">
|
|
51
|
+
<usync-upload-file-picker
|
|
52
|
+
label="Select uSync Zip file"
|
|
53
|
+
@change=${__classPrivateFieldGet(this, _uSyncFileUploadElement_instances, "m", _uSyncFileUploadElement_onFileChange)}></usync-upload-file-picker>
|
|
54
|
+
</div>
|
|
55
55
|
`;
|
|
56
56
|
}
|
|
57
57
|
renderUploadButton() {
|
|
58
58
|
if (!this.selected)
|
|
59
59
|
return nothing;
|
|
60
|
-
return html `<uui-button
|
|
61
|
-
type="button"
|
|
62
|
-
look="primary"
|
|
63
|
-
@click="${__classPrivateFieldGet(this, _uSyncFileUploadElement_instances, "m", _uSyncFileUploadElement_onUpload)}"
|
|
64
|
-
label="Upload"
|
|
60
|
+
return html `<uui-button
|
|
61
|
+
type="button"
|
|
62
|
+
look="primary"
|
|
63
|
+
@click="${__classPrivateFieldGet(this, _uSyncFileUploadElement_instances, "m", _uSyncFileUploadElement_onUpload)}"
|
|
64
|
+
label="Upload"
|
|
65
65
|
.state=${this.buttonState}></uui-button>`;
|
|
66
66
|
}
|
|
67
67
|
};
|
|
@@ -90,20 +90,20 @@ _uSyncFileUploadElement_uploadComplete = async function _uSyncFileUploadElement_
|
|
|
90
90
|
_uSyncFileUploadElement_onFileChange = function _uSyncFileUploadElement_onFileChange(e) {
|
|
91
91
|
this.selected = e.file;
|
|
92
92
|
};
|
|
93
|
-
uSyncFileUploadElement.styles = css `
|
|
94
|
-
:host {
|
|
95
|
-
display: flex;
|
|
96
|
-
justify-content: space-between;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.upload-box {
|
|
100
|
-
flex-grow: 2;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
usync-upload-file-picker {
|
|
104
|
-
width: 100%;
|
|
105
|
-
flex-grow: 2;
|
|
106
|
-
}
|
|
93
|
+
uSyncFileUploadElement.styles = css `
|
|
94
|
+
:host {
|
|
95
|
+
display: flex;
|
|
96
|
+
justify-content: space-between;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.upload-box {
|
|
100
|
+
flex-grow: 2;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
usync-upload-file-picker {
|
|
104
|
+
width: 100%;
|
|
105
|
+
flex-grow: 2;
|
|
106
|
+
}
|
|
107
107
|
`;
|
|
108
108
|
__decorate([
|
|
109
109
|
state()
|
|
@@ -18,30 +18,30 @@ let uSyncImportModalDialog = class uSyncImportModalDialog extends UmbModalBaseEl
|
|
|
18
18
|
_uSyncImportModalDialog_instances.add(this);
|
|
19
19
|
}
|
|
20
20
|
render() {
|
|
21
|
-
return html `
|
|
22
|
-
<umb-body-layout .headline=${this.localize.termOrDefault('uSync_importHeader', 'Import from file')}>
|
|
23
|
-
${this.renderForm()} ${this.renderResult()}
|
|
24
|
-
</umb-body-layout>
|
|
21
|
+
return html `
|
|
22
|
+
<umb-body-layout .headline=${this.localize.termOrDefault('uSync_importHeader', 'Import from file')}>
|
|
23
|
+
${this.renderForm()} ${this.renderResult()}
|
|
24
|
+
</umb-body-layout>
|
|
25
25
|
`;
|
|
26
26
|
}
|
|
27
27
|
renderForm() {
|
|
28
28
|
if (this.result !== undefined)
|
|
29
29
|
return;
|
|
30
|
-
return html ` ${this.localize.termOrDefault('uSync_uploadIntro', 'Select a zip file containing uSync files that you want to upload')}
|
|
31
|
-
<usync-file-upload @uploaded=${__classPrivateFieldGet(this, _uSyncImportModalDialog_instances, "m", _uSyncImportModalDialog_onUploaded)}></usync-file-upload>
|
|
32
|
-
<div slot="actions">
|
|
33
|
-
<uui-button
|
|
34
|
-
id="cancel"
|
|
35
|
-
.label=${this.localize.term('general_close')}
|
|
36
|
-
@click="${__classPrivateFieldGet(this, _uSyncImportModalDialog_instances, "m", _uSyncImportModalDialog_onClose)}"></uui-button>
|
|
30
|
+
return html ` ${this.localize.termOrDefault('uSync_uploadIntro', 'Select a zip file containing uSync files that you want to upload')}
|
|
31
|
+
<usync-file-upload @uploaded=${__classPrivateFieldGet(this, _uSyncImportModalDialog_instances, "m", _uSyncImportModalDialog_onUploaded)}></usync-file-upload>
|
|
32
|
+
<div slot="actions">
|
|
33
|
+
<uui-button
|
|
34
|
+
id="cancel"
|
|
35
|
+
.label=${this.localize.term('general_close')}
|
|
36
|
+
@click="${__classPrivateFieldGet(this, _uSyncImportModalDialog_instances, "m", _uSyncImportModalDialog_onClose)}"></uui-button>
|
|
37
37
|
</div>`;
|
|
38
38
|
}
|
|
39
39
|
renderResult() {
|
|
40
40
|
if (this.result == undefined)
|
|
41
41
|
return;
|
|
42
|
-
return html `${when(this.result.success, () => html `${this.localize.termOrDefault('uSync_uploadSuccess', 'The files have been uploaded and extracted to the uSync folder')}`, () => html `${this.localize.termOrDefault('uSync_uploadError', 'There was an error uploading the files')} ${this.result?.errors}`)}
|
|
43
|
-
<div slot="actions">
|
|
44
|
-
<uui-button id="continue" label="Import" @click="${__classPrivateFieldGet(this, _uSyncImportModalDialog_instances, "m", _uSyncImportModalDialog_onImport)}"></uui-button>
|
|
42
|
+
return html `${when(this.result.success, () => html `${this.localize.termOrDefault('uSync_uploadSuccess', 'The files have been uploaded and extracted to the uSync folder')}`, () => html `${this.localize.termOrDefault('uSync_uploadError', 'There was an error uploading the files')} ${this.result?.errors}`)}
|
|
43
|
+
<div slot="actions">
|
|
44
|
+
<uui-button id="continue" label="Import" @click="${__classPrivateFieldGet(this, _uSyncImportModalDialog_instances, "m", _uSyncImportModalDialog_onImport)}"></uui-button>
|
|
45
45
|
</div>`;
|
|
46
46
|
}
|
|
47
47
|
};
|
|
@@ -56,14 +56,14 @@ _uSyncImportModalDialog_onImport = function _uSyncImportModalDialog_onImport() {
|
|
|
56
56
|
_uSyncImportModalDialog_onUploaded = function _uSyncImportModalDialog_onUploaded(e) {
|
|
57
57
|
this.result = e.result;
|
|
58
58
|
};
|
|
59
|
-
uSyncImportModalDialog.styles = css `
|
|
60
|
-
umb-body-layout {
|
|
61
|
-
max-width: 450px;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
usync-file-upload {
|
|
65
|
-
padding: 10px 0;
|
|
66
|
-
}
|
|
59
|
+
uSyncImportModalDialog.styles = css `
|
|
60
|
+
umb-body-layout {
|
|
61
|
+
max-width: 450px;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
usync-file-upload {
|
|
65
|
+
padding: 10px 0;
|
|
66
|
+
}
|
|
67
67
|
`;
|
|
68
68
|
__decorate([
|
|
69
69
|
state()
|