@golemui/gui-lit 1.4.0 → 1.5.0-rc.1
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 +33 -0
- package/{dropdown.element-D9wMyqWQ.js → dropdown.element-COwjfvGf.js} +1 -1
- package/file-upload.element-l_l_ubxJ.js +90 -0
- package/index.js +881 -806
- package/index.umd.cjs +142 -76
- package/lib/components/file-upload.element.d.ts +18 -0
- package/lib/components/multi-file-upload.element.d.ts +18 -0
- package/{multi-dropdown.element-iEOlPvux.js → multi-dropdown.element-BpLDJIil.js} +1 -1
- package/multi-file-upload.element-DzAZAfc1.js +90 -0
- package/package.json +6 -6
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { InputWidget, WithWidget } from '@golemui/core';
|
|
2
|
+
import { InputWidgetAdapter, LitFormContext } from '@golemui/lit';
|
|
3
|
+
import { FileItem } from '@golemui/gui-shared/internals';
|
|
4
|
+
import { LitElement } from 'lit';
|
|
5
|
+
import { Subscription } from 'rxjs';
|
|
6
|
+
export declare class FileUploadElement extends LitElement implements WithWidget {
|
|
7
|
+
widget: InputWidget<FileItem | null>;
|
|
8
|
+
formContext: LitFormContext<any>;
|
|
9
|
+
adapter: InputWidgetAdapter<FileItem | null, import('@golemui/gui-shared/internals').FileUploadBaseProps>;
|
|
10
|
+
subscriptions: Subscription[];
|
|
11
|
+
createRenderRoot(): this;
|
|
12
|
+
updated(changedProperties: any): void;
|
|
13
|
+
connectedCallback(): void;
|
|
14
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
15
|
+
valueChanged(event: CustomEvent): void;
|
|
16
|
+
onInputError(event: CustomEvent): void;
|
|
17
|
+
disconnectedCallback(): void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { InputWidget, WithWidget } from '@golemui/core';
|
|
2
|
+
import { InputWidgetAdapter, LitFormContext } from '@golemui/lit';
|
|
3
|
+
import { FileItem } from '@golemui/gui-shared/internals';
|
|
4
|
+
import { LitElement } from 'lit';
|
|
5
|
+
import { Subscription } from 'rxjs';
|
|
6
|
+
export declare class MultiFileUploadElement extends LitElement implements WithWidget {
|
|
7
|
+
widget: InputWidget<FileItem[]>;
|
|
8
|
+
formContext: LitFormContext<any>;
|
|
9
|
+
adapter: InputWidgetAdapter<FileItem[], import('@golemui/gui-shared/internals').FileUploadBaseProps>;
|
|
10
|
+
subscriptions: Subscription[];
|
|
11
|
+
createRenderRoot(): this;
|
|
12
|
+
updated(changedProperties: any): void;
|
|
13
|
+
connectedCallback(): void;
|
|
14
|
+
render(): import('lit-html').TemplateResult<1>;
|
|
15
|
+
valueChanged(event: CustomEvent): void;
|
|
16
|
+
onInputError(event: CustomEvent): void;
|
|
17
|
+
disconnectedCallback(): void;
|
|
18
|
+
}
|
|
@@ -38,7 +38,7 @@ class o extends R {
|
|
|
38
38
|
t ? this.style.flex = String(t) : this.style.removeProperty("flex");
|
|
39
39
|
}
|
|
40
40
|
connectedCallback() {
|
|
41
|
-
super.connectedCallback(), document.addEventListener("click", this.onDocumentClick), this.classList.add("gui-multi-dropdown", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this._filteredItems = this.adapter.templateData.items, this.subscriptions.push(
|
|
41
|
+
super.connectedCallback(), typeof document < "u" && document.addEventListener("click", this.onDocumentClick), this.classList.add("gui-multi-dropdown", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this._filteredItems = this.adapter.templateData.items, this.subscriptions.push(
|
|
42
42
|
this.adapter.templateDataChanged$.subscribe(() => {
|
|
43
43
|
const e = this.adapter.templateData;
|
|
44
44
|
e.items && this._listItems?.length === 0 && this._filteredItems?.length === 0 && (this._filteredItems = e.items, this._listItems = e.items), this.requestUpdate();
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { InputWidgetAdapter as n, formContext as d, inputContext as p } from "@golemui/lit";
|
|
2
|
+
import "@golemui/gui-components/multi-file-upload";
|
|
3
|
+
import { consume as u, provide as c } from "@lit/context";
|
|
4
|
+
import { LitElement as m, html as h } from "lit";
|
|
5
|
+
import { property as g } from "lit/decorators.js";
|
|
6
|
+
import { unsubscribeAll as $, safeDefine as b } from "@golemui/lit/internals";
|
|
7
|
+
import "rxjs";
|
|
8
|
+
var f = Object.defineProperty, l = (r, e, t, v) => {
|
|
9
|
+
for (var a = void 0, i = r.length - 1, o; i >= 0; i--)
|
|
10
|
+
(o = r[i]) && (a = o(e, t, a) || a);
|
|
11
|
+
return a && f(e, t, a), a;
|
|
12
|
+
};
|
|
13
|
+
class s extends m {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments), this.adapter = new n(), this.subscriptions = [];
|
|
16
|
+
}
|
|
17
|
+
createRenderRoot() {
|
|
18
|
+
return this;
|
|
19
|
+
}
|
|
20
|
+
updated(e) {
|
|
21
|
+
super.updated(e);
|
|
22
|
+
const t = this.adapter.templateData.size;
|
|
23
|
+
t ? this.style.flex = String(t) : this.style.removeProperty("flex");
|
|
24
|
+
}
|
|
25
|
+
connectedCallback() {
|
|
26
|
+
super.connectedCallback(), this.classList.add("gui-multi-file-upload", "gui-field"), this.adapter.context = this.formContext, this.adapter.init(this.widget), this.subscriptions.push(
|
|
27
|
+
this.adapter.templateDataChanged$.subscribe(() => this.requestUpdate())
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
render() {
|
|
31
|
+
super.render();
|
|
32
|
+
const e = this.adapter.templateData;
|
|
33
|
+
return h`
|
|
34
|
+
<gui-multi-file-upload
|
|
35
|
+
.uid=${this.widget.uid}
|
|
36
|
+
.path=${this.widget.path}
|
|
37
|
+
.label=${e.label}
|
|
38
|
+
.hint=${e.hint}
|
|
39
|
+
.errors=${e.errors}
|
|
40
|
+
?touched=${e.touched}
|
|
41
|
+
?required=${e.validator?.required}
|
|
42
|
+
?disabled=${e.disabled}
|
|
43
|
+
?readonly=${e.readonly}
|
|
44
|
+
.values=${e.value ?? []}
|
|
45
|
+
.dependencies=${e.deps}
|
|
46
|
+
.icon=${e.icon}
|
|
47
|
+
.accept=${e.accept}
|
|
48
|
+
.maxSize=${e.maxSize}
|
|
49
|
+
.buttonLabel=${e.buttonLabel}
|
|
50
|
+
.removeAriaLabel=${e.removeAriaLabel}
|
|
51
|
+
.cancelAriaLabel=${e.cancelAriaLabel}
|
|
52
|
+
.retryAriaLabel=${e.retryAriaLabel}
|
|
53
|
+
.removeIcon=${e.removeIcon}
|
|
54
|
+
.retryIcon=${e.retryIcon}
|
|
55
|
+
.maxSizeMessage=${e.maxSizeMessage}
|
|
56
|
+
.acceptMessage=${e.acceptMessage}
|
|
57
|
+
.interruptedMessage=${e.interruptedMessage}
|
|
58
|
+
.missingServiceMessage=${e.missingServiceMessage}
|
|
59
|
+
.uploadedMessage=${e.uploadedMessage}
|
|
60
|
+
.removedMessage=${e.removedMessage}
|
|
61
|
+
.failedMessage=${e.failedMessage}
|
|
62
|
+
@change=${this.valueChanged}
|
|
63
|
+
@blur=${() => this.adapter.onBlur()}
|
|
64
|
+
@inputError=${this.onInputError}
|
|
65
|
+
></gui-multi-file-upload>
|
|
66
|
+
`;
|
|
67
|
+
}
|
|
68
|
+
valueChanged(e) {
|
|
69
|
+
const t = e.detail.value;
|
|
70
|
+
this.adapter.valueChanged(t);
|
|
71
|
+
}
|
|
72
|
+
onInputError(e) {
|
|
73
|
+
const t = e.detail.message;
|
|
74
|
+
this.adapter.injectValidationIssues(t ? [t] : null);
|
|
75
|
+
}
|
|
76
|
+
disconnectedCallback() {
|
|
77
|
+
super.disconnectedCallback(), this.adapter.destroy(), $(this.subscriptions);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
l([
|
|
81
|
+
u({ context: d }),
|
|
82
|
+
g({ attribute: !1 })
|
|
83
|
+
], s.prototype, "formContext");
|
|
84
|
+
l([
|
|
85
|
+
c({ context: p })
|
|
86
|
+
], s.prototype, "adapter");
|
|
87
|
+
b("gui-multi-file-upload-input", s);
|
|
88
|
+
export {
|
|
89
|
+
s as MultiFileUploadElement
|
|
90
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@golemui/gui-lit",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0-rc.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"*.md"
|
|
26
26
|
],
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@golemui/lit": "1.
|
|
29
|
-
"@golemui/core": "1.
|
|
30
|
-
"@golemui/gui-components": "1.
|
|
31
|
-
"@golemui/gui-shared": "1.
|
|
32
|
-
"@golemui/gui-validators": "1.
|
|
28
|
+
"@golemui/lit": "1.5.0-rc.1",
|
|
29
|
+
"@golemui/core": "1.5.0-rc.1",
|
|
30
|
+
"@golemui/gui-components": "1.5.0-rc.1",
|
|
31
|
+
"@golemui/gui-shared": "1.5.0-rc.1",
|
|
32
|
+
"@golemui/gui-validators": "1.5.0-rc.1",
|
|
33
33
|
"@lit/context": "^1.1.6",
|
|
34
34
|
"lit-html": "^3.3.1",
|
|
35
35
|
"lit": "^3.3.1",
|