@omegagrid/bucket 0.10.2 → 0.10.5
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/constants.d.ts +54 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +12 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/options.d.ts +12 -0
- package/dist/options.d.ts.map +1 -0
- package/dist/options.js +16 -0
- package/dist/options.js.map +1 -0
- package/dist/types.d.ts +87 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/ui/bucket.alerts.d.ts +17 -0
- package/dist/ui/bucket.alerts.d.ts.map +1 -0
- package/dist/ui/bucket.alerts.js +47 -0
- package/dist/ui/bucket.alerts.js.map +1 -0
- package/dist/ui/bucket.components.d.ts +24 -0
- package/dist/ui/bucket.components.d.ts.map +1 -0
- package/dist/ui/bucket.components.js +111 -0
- package/dist/ui/bucket.components.js.map +1 -0
- package/dist/ui/bucket.d.ts +83 -0
- package/dist/ui/bucket.d.ts.map +1 -0
- package/dist/ui/bucket.dialogs.d.ts +11 -0
- package/dist/ui/bucket.dialogs.d.ts.map +1 -0
- package/dist/ui/bucket.dialogs.js +46 -0
- package/dist/ui/bucket.dialogs.js.map +1 -0
- package/dist/ui/bucket.js +372 -0
- package/dist/ui/bucket.js.map +1 -0
- package/dist/ui/bucket.sidebars.d.ts +15 -0
- package/dist/ui/bucket.sidebars.d.ts.map +1 -0
- package/dist/ui/bucket.sidebars.js +77 -0
- package/dist/ui/bucket.sidebars.js.map +1 -0
- package/dist/ui/bucket.style.d.ts +3 -0
- package/dist/ui/bucket.style.d.ts.map +1 -0
- package/dist/ui/bucket.style.js +90 -0
- package/dist/ui/bucket.style.js.map +1 -0
- package/dist/ui/bucketAlert.d.ts +20 -0
- package/dist/ui/bucketAlert.d.ts.map +1 -0
- package/dist/ui/bucketAlert.js +114 -0
- package/dist/ui/bucketAlert.js.map +1 -0
- package/dist/ui/bucketAlert.style.d.ts +2 -0
- package/dist/ui/bucketAlert.style.d.ts.map +1 -0
- package/dist/ui/bucketAlert.style.js +58 -0
- package/dist/ui/bucketAlert.style.js.map +1 -0
- package/dist/ui/bucketButton.d.ts +12 -0
- package/dist/ui/bucketButton.d.ts.map +1 -0
- package/dist/ui/bucketButton.js +105 -0
- package/dist/ui/bucketButton.js.map +1 -0
- package/dist/ui/commonMenus.d.ts +4 -0
- package/dist/ui/commonMenus.d.ts.map +1 -0
- package/dist/ui/commonMenus.js +7 -0
- package/dist/ui/commonMenus.js.map +1 -0
- package/dist/ui/componentHost.d.ts +19 -0
- package/dist/ui/componentHost.d.ts.map +1 -0
- package/dist/ui/componentHost.js +119 -0
- package/dist/ui/componentHost.js.map +1 -0
- package/dist/ui/index.d.ts +11 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +11 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/modalSidebar.d.ts +22 -0
- package/dist/ui/modalSidebar.d.ts.map +1 -0
- package/dist/ui/modalSidebar.js +85 -0
- package/dist/ui/modalSidebar.js.map +1 -0
- package/dist/ui/modalSidebar.style.d.ts +3 -0
- package/dist/ui/modalSidebar.style.d.ts.map +1 -0
- package/dist/ui/modalSidebar.style.js +58 -0
- package/dist/ui/modalSidebar.style.js.map +1 -0
- package/dist/ui/path.d.ts +17 -0
- package/dist/ui/path.d.ts.map +1 -0
- package/dist/ui/path.js +97 -0
- package/dist/ui/path.js.map +1 -0
- package/dist/ui/sidebar.d.ts +15 -0
- package/dist/ui/sidebar.d.ts.map +1 -0
- package/dist/ui/sidebar.js +62 -0
- package/dist/ui/sidebar.js.map +1 -0
- package/dist/ui/sidemenu.d.ts +23 -0
- package/dist/ui/sidemenu.d.ts.map +1 -0
- package/dist/ui/sidemenu.js +135 -0
- package/dist/ui/sidemenu.js.map +1 -0
- package/dist/ui/top.d.ts +14 -0
- package/dist/ui/top.d.ts.map +1 -0
- package/dist/ui/top.js +64 -0
- package/dist/ui/top.js.map +1 -0
- package/dist/ui/top.style.d.ts +3 -0
- package/dist/ui/top.style.d.ts.map +1 -0
- package/dist/ui/top.style.js +35 -0
- package/dist/ui/top.style.js.map +1 -0
- package/package.json +6 -6
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Button, ColorTypes, Container, OmegaComponent } from '@omegagrid/core';
|
|
2
|
+
import { BucketAlertOptions } from '../types';
|
|
3
|
+
export declare class AlertEvent extends Event {
|
|
4
|
+
constructor(type: string);
|
|
5
|
+
}
|
|
6
|
+
export declare class BucketAlert extends OmegaComponent {
|
|
7
|
+
static styles: import("lit").CSSResultGroup[];
|
|
8
|
+
options: BucketAlertOptions;
|
|
9
|
+
color: ColorTypes;
|
|
10
|
+
noCopy: boolean;
|
|
11
|
+
container: Container;
|
|
12
|
+
btnCopy: Button;
|
|
13
|
+
willUpdate(props: Map<PropertyKey, unknown>): void;
|
|
14
|
+
private get iconSpec();
|
|
15
|
+
close(dispatchEvent?: boolean): void;
|
|
16
|
+
updated(): Promise<void>;
|
|
17
|
+
copy: () => Promise<void>;
|
|
18
|
+
render: () => import("lit-html").TemplateResult<1>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=bucketAlert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bucketAlert.d.ts","sourceRoot":"","sources":["../../src/ui/bucketAlert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAY,cAAc,EAAkB,MAAM,iBAAiB,CAAC;AAG1G,OAAO,EAAE,kBAAkB,EAAmB,MAAM,UAAU,CAAC;AAY/D,qBAAa,UAAW,SAAQ,KAAK;gBACxB,IAAI,EAAE,MAAM;CAGxB;AAED,qBAEa,WAAY,SAAQ,cAAc;IAE9C,MAAM,CAAC,MAAM,iCAAkC;IAG/C,OAAO,EAAE,kBAAkB,CAAC;IAG5B,KAAK,EAAE,UAAU,CAAC;IAGlB,MAAM,UAAS;IAGf,SAAS,EAAE,SAAS,CAAC;IAGrB,OAAO,EAAE,MAAM,CAAC;IAEhB,UAAU,CAAC,KAAK,EAAE,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC;IAM3C,OAAO,KAAK,QAAQ,GAQnB;IAED,KAAK,CAAC,aAAa,UAAO;IAKpB,OAAO;IASb,IAAI,sBAYH;IAED,MAAM,6CAmBJ;CAEF"}
|
|
@@ -0,0 +1,114 @@
|
|
|
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 { ColorTypes, OmegaComponent, colorable, dom } from '@omegagrid/core';
|
|
8
|
+
import { html } from 'lit';
|
|
9
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
10
|
+
import { msg } from '@omegagrid/localize';
|
|
11
|
+
import { style } from './bucketAlert.style';
|
|
12
|
+
import constants from '../constants';
|
|
13
|
+
const typeMap = {
|
|
14
|
+
'info': [ColorTypes.Accent, 'circle-info'],
|
|
15
|
+
'danger': [ColorTypes.Red, 'circle-exclamation'],
|
|
16
|
+
'warning': [ColorTypes.Yellow, 'circle-exclamation'],
|
|
17
|
+
'success': [ColorTypes.Green, 'circle-check']
|
|
18
|
+
};
|
|
19
|
+
export class AlertEvent extends Event {
|
|
20
|
+
constructor(type) {
|
|
21
|
+
super(`alert.${type}`, { bubbles: true, composed: true });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
let BucketAlert = class BucketAlert extends OmegaComponent {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
this.noCopy = false;
|
|
28
|
+
this.copy = async () => {
|
|
29
|
+
if (this.options?.content) {
|
|
30
|
+
try {
|
|
31
|
+
await navigator.clipboard.writeText(this.options.content.toString());
|
|
32
|
+
this.btnCopy.text = msg('copied');
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
console.error('Failed to copy to clipboard:', error);
|
|
36
|
+
this.btnCopy.text = msg('failed');
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
setTimeout(() => this.btnCopy.text = '', 2000);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
this.render = () => html `
|
|
44
|
+
<div class="header">
|
|
45
|
+
<og-icon .icon="${this.iconSpec}"></og-icon>
|
|
46
|
+
<div class="title">${this.options?.title}</div>
|
|
47
|
+
${this.noCopy ? null : html `
|
|
48
|
+
<og-button
|
|
49
|
+
class="copy"
|
|
50
|
+
color="transparent"
|
|
51
|
+
icon="copy"
|
|
52
|
+
title="${msg('Copy to clipboard')}"
|
|
53
|
+
@click="${this.copy}">
|
|
54
|
+
</og-button>
|
|
55
|
+
`}
|
|
56
|
+
<div class="close" @click="${() => this.close()}">×</div>
|
|
57
|
+
</div>
|
|
58
|
+
|
|
59
|
+
<og-container class="body">
|
|
60
|
+
<div class="content" slot="content">${this.options?.content}</div>
|
|
61
|
+
</og-container>
|
|
62
|
+
`;
|
|
63
|
+
}
|
|
64
|
+
willUpdate(props) {
|
|
65
|
+
if (props.has('options')) {
|
|
66
|
+
this.color = this.options?.type ? typeMap[this.options.type][0] : ColorTypes.Accent;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
get iconSpec() {
|
|
70
|
+
if (this.options?.icon)
|
|
71
|
+
return this.options.icon;
|
|
72
|
+
const icon = { icon: 'info' };
|
|
73
|
+
if (this.options?.type) {
|
|
74
|
+
icon.color = typeMap[this.options.type][0];
|
|
75
|
+
icon.icon = typeMap[this.options.type][1];
|
|
76
|
+
}
|
|
77
|
+
return icon;
|
|
78
|
+
}
|
|
79
|
+
close(dispatchEvent = true) {
|
|
80
|
+
dom.hideElement(this);
|
|
81
|
+
if (dispatchEvent)
|
|
82
|
+
this.dispatchEvent(new Event('close'));
|
|
83
|
+
}
|
|
84
|
+
async updated() {
|
|
85
|
+
await this.container.updateComplete;
|
|
86
|
+
const h = this.container.scrollHeight;
|
|
87
|
+
if (h > constants.ALERT_DEFAULT_HEIGHT) {
|
|
88
|
+
this.container.style.height = dom.px(Math.min(h, constants.ALERT_MAX_HEIGHT));
|
|
89
|
+
this.container.updateSliders();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
BucketAlert.styles = [OmegaComponent.styles, style];
|
|
94
|
+
__decorate([
|
|
95
|
+
property({ type: Object })
|
|
96
|
+
], BucketAlert.prototype, "options", void 0);
|
|
97
|
+
__decorate([
|
|
98
|
+
property({ type: String, reflect: true })
|
|
99
|
+
], BucketAlert.prototype, "color", void 0);
|
|
100
|
+
__decorate([
|
|
101
|
+
property({ type: Boolean })
|
|
102
|
+
], BucketAlert.prototype, "noCopy", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
query('.body')
|
|
105
|
+
], BucketAlert.prototype, "container", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
query('.copy')
|
|
108
|
+
], BucketAlert.prototype, "btnCopy", void 0);
|
|
109
|
+
BucketAlert = __decorate([
|
|
110
|
+
customElement('og-bucket-alert'),
|
|
111
|
+
colorable({ props: ['border'] })
|
|
112
|
+
], BucketAlert);
|
|
113
|
+
export { BucketAlert };
|
|
114
|
+
//# sourceMappingURL=bucketAlert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bucketAlert.js","sourceRoot":"","sources":["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CACM;AAGrB;IADC,KAAK,CAAC,OAAO,CAAC;4CACC;AAjBJ,WAAW;IAFvB,aAAa,CAAC,iBAAiB,CAAC;IAChC,SAAS,CAAC,EAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,EAAC,CAAC;GAClB,WAAW,CAoFvB","sourcesContent":["import { Button, ColorTypes, Container, IconSpec, OmegaComponent, colorable, dom } from '@omegagrid/core';\nimport { html } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { BucketAlertOptions, BucketAlertType } from '../types';\nimport { msg } from '@omegagrid/localize';\nimport { style } from './bucketAlert.style';\nimport constants from '../constants';\n\nconst typeMap: Record<BucketAlertType, [ColorTypes, string]> = {\n\t'info': [ColorTypes.Accent, 'circle-info'],\n\t'danger': [ColorTypes.Red, 'circle-exclamation'],\n\t'warning': [ColorTypes.Yellow, 'circle-exclamation'],\n\t'success': [ColorTypes.Green, 'circle-check']\n};\n\nexport class AlertEvent extends Event {\n\tconstructor(type: string) {\n\t\tsuper(`alert.${type}`, {bubbles: true, composed: true});\n\t}\n}\n\n@customElement('og-bucket-alert')\n@colorable({props: ['border']})\nexport class BucketAlert extends OmegaComponent {\n\n\tstatic styles = [OmegaComponent.styles, style];\n\t\n\t@property({type: Object})\n\toptions: BucketAlertOptions;\n\n\t@property({type: String, reflect: true})\n\tcolor: ColorTypes;\n\n\t@property({type: Boolean})\n\tnoCopy = false;\n\n\t@query('.body')\n\tcontainer: Container;\n\n\t@query('.copy')\n\tbtnCopy: Button;\n\n\twillUpdate(props: Map<PropertyKey, unknown>) {\n\t\tif (props.has('options')) {\n\t\t\tthis.color = this.options?.type ? typeMap[this.options.type][0] : ColorTypes.Accent;\n\t\t}\n\t}\n\n\tprivate get iconSpec() {\n\t\tif (this.options?.icon) return this.options.icon;\n\t\tconst icon: IconSpec = {icon: 'info'};\n\t\tif (this.options?.type) {\n\t\t\ticon.color = typeMap[this.options.type][0];\n\t\t\ticon.icon = typeMap[this.options.type][1];\n\t\t}\n\t\treturn icon;\n\t}\n\n\tclose(dispatchEvent = true) {\n\t\tdom.hideElement(this);\n\t\tif (dispatchEvent) this.dispatchEvent(new Event('close'));\n\t}\n\n\tasync updated() {\n\t\tawait this.container.updateComplete;\n\t\tconst h = this.container.scrollHeight;\n\t\tif (h > constants.ALERT_DEFAULT_HEIGHT) {\n\t\t\tthis.container.style.height = dom.px(Math.min(h, constants.ALERT_MAX_HEIGHT));\n\t\t\tthis.container.updateSliders();\n\t\t}\n\t}\n\n\tcopy = async () => {\n\t\tif (this.options?.content) {\n\t\t\ttry {\n\t\t\t\tawait navigator.clipboard.writeText(this.options.content.toString());\n\t\t\t\tthis.btnCopy.text = msg('copied');\n\t\t\t} catch (error) {\n\t\t\t\tconsole.error('Failed to copy to clipboard:', error);\n\t\t\t\tthis.btnCopy.text = msg('failed');\n\t\t\t} finally {\n\t\t\t\tsetTimeout(() => this.btnCopy.text = '', 2000);\n\t\t\t}\n\t\t}\n\t}\n\n\trender = () => html`\n\t\t<div class=\"header\">\n\t\t\t<og-icon .icon=\"${this.iconSpec}\"></og-icon>\n\t\t\t<div class=\"title\">${this.options?.title}</div>\n\t\t\t${this.noCopy ? null : html`\n\t\t\t\t<og-button\n\t\t\t\t\tclass=\"copy\"\n\t\t\t\t\tcolor=\"transparent\"\n\t\t\t\t\ticon=\"copy\"\n\t\t\t\t\ttitle=\"${msg('Copy to clipboard')}\"\n\t\t\t\t\t@click=\"${this.copy}\">\n\t\t\t\t</og-button>\n\t\t\t`}\n\t\t\t<div class=\"close\" @click=\"${() => this.close()}\">×</div>\n\t\t</div>\n\n\t\t<og-container class=\"body\">\n\t\t\t<div class=\"content\" slot=\"content\">${this.options?.content}</div>\n\t\t</og-container>\n\t`;\n\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bucketAlert.style.d.ts","sourceRoot":"","sources":["../../src/ui/bucketAlert.style.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,KAAK,yBAsDjB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
import constants from '../constants';
|
|
3
|
+
export const style = css `
|
|
4
|
+
* {
|
|
5
|
+
box-sizing: border-box;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
:host {
|
|
9
|
+
font-size: var(--og-font-size);
|
|
10
|
+
display: block;
|
|
11
|
+
background-color: var(--og-background-color);
|
|
12
|
+
border: 1px solid var(--og-accent-color);
|
|
13
|
+
min-width: 250px;
|
|
14
|
+
max-width: 300px;
|
|
15
|
+
transition: bottom 0.5s;
|
|
16
|
+
position: absolute;
|
|
17
|
+
bottom: -100px;
|
|
18
|
+
box-shadow: 8px 8px 4px -3px var(--og-dialog-shadow);
|
|
19
|
+
z-index: 1000;
|
|
20
|
+
border-radius: var(--og-base-radius);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.header {
|
|
24
|
+
height: 20px;
|
|
25
|
+
position: relative;
|
|
26
|
+
display: flex;
|
|
27
|
+
gap: 3px;
|
|
28
|
+
flex-direction: row;
|
|
29
|
+
align-items: center;
|
|
30
|
+
padding-left: 2px;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.header .title {
|
|
34
|
+
flex: 1;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.header .copy {
|
|
38
|
+
flex: 0 0 auto;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.header .close {
|
|
42
|
+
height: 100%;
|
|
43
|
+
flex: 0 0 20px;
|
|
44
|
+
line-height: 20px;
|
|
45
|
+
cursor: pointer;
|
|
46
|
+
text-align: center;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.body {
|
|
50
|
+
max-height: 120px;
|
|
51
|
+
min-height: ${constants.ALERT_DEFAULT_HEIGHT}px;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.content {
|
|
55
|
+
padding: 5px;
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
//# sourceMappingURL=bucketAlert.style.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bucketAlert.style.js","sourceRoot":"","sources":["../../src/ui/bucketAlert.style.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,MAAM,CAAC,MAAM,KAAK,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAgDR,SAAS,CAAC,oBAAoB;;;;;;CAM7C,CAAC","sourcesContent":["import { css } from 'lit';\nimport constants from '../constants';\n\nexport const style = css`\n\t* {\n\t\tbox-sizing: border-box;\n\t}\n\t\n\t:host {\n\t\tfont-size: var(--og-font-size);\n\t\tdisplay: block;\n\t\tbackground-color: var(--og-background-color);\n\t\tborder: 1px solid var(--og-accent-color);\n\t\tmin-width: 250px;\n\t\tmax-width: 300px;\n\t\ttransition: bottom 0.5s;\n\t\tposition: absolute;\n\t\tbottom: -100px;\n\t\tbox-shadow: 8px 8px 4px -3px var(--og-dialog-shadow);\n\t\tz-index: 1000;\n\t\tborder-radius: var(--og-base-radius);\n\t}\n\n\t.header {\n\t\theight: 20px;\n\t\tposition: relative;\n\t\tdisplay: flex;\n\t\tgap: 3px;\n\t\tflex-direction: row;\n\t\talign-items: center;\n\t\tpadding-left: 2px;\n\t}\n\n\t.header .title {\n\t\tflex: 1;\n\t}\n\n\t.header .copy {\n\t\tflex: 0 0 auto;\n\t}\n\n\t.header .close {\n\t\theight: 100%;\n\t\tflex: 0 0 20px;\n\t\tline-height: 20px;\n\t\tcursor: pointer;\n\t\ttext-align: center;\n\t}\n\n\t.body {\n\t\tmax-height: 120px;\n\t\tmin-height: ${constants.ALERT_DEFAULT_HEIGHT}px;\n\t}\n\n\t.content {\n\t\tpadding: 5px;\n\t}\n`;\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { IconSpec } from '@omegagrid/core';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
export declare class BucketButton extends LitElement {
|
|
4
|
+
text: string;
|
|
5
|
+
icon: IconSpec | string;
|
|
6
|
+
active: boolean;
|
|
7
|
+
statusIcon: string | [string, string];
|
|
8
|
+
static styles: import("lit").CSSResult;
|
|
9
|
+
private get iconSpec();
|
|
10
|
+
render: () => import("lit-html").TemplateResult<1>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=bucketButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bucketButton.d.ts","sourceRoot":"","sources":["../../src/ui/bucketButton.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAS,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAa,MAAM,KAAK,CAAC;AAG5C,qBACa,YAAa,SAAQ,UAAU;IAG3C,IAAI,EAAE,MAAM,CAAC;IAGb,IAAI,EAAE,QAAQ,GAAC,MAAM,CAAC;IAGtB,MAAM,UAAQ;IAGd,UAAU,EAAE,MAAM,GAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAEpC,MAAM,CAAC,MAAM,0BA2DX;IAEF,OAAO,KAAK,QAAQ,GAEnB;IAED,MAAM,6CASJ;CAEF"}
|
|
@@ -0,0 +1,105 @@
|
|
|
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 { utils } from '@omegagrid/core';
|
|
8
|
+
import { LitElement, html, css } from 'lit';
|
|
9
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
10
|
+
let BucketButton = class BucketButton extends LitElement {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.active = false;
|
|
14
|
+
this.render = () => html `
|
|
15
|
+
<div class="inner">
|
|
16
|
+
<div class="icon">
|
|
17
|
+
<og-icon .icon="${this.iconSpec}"></og-icon>
|
|
18
|
+
</div>
|
|
19
|
+
${this.text == null ? '' : html `
|
|
20
|
+
<div class="text">${this.text}</div>
|
|
21
|
+
`}
|
|
22
|
+
</div>
|
|
23
|
+
`;
|
|
24
|
+
}
|
|
25
|
+
get iconSpec() {
|
|
26
|
+
return Object.assign(utils.isObject(this.icon) ? this.icon : { icon: this.icon }, { size: 'lg' });
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
BucketButton.styles = css `
|
|
30
|
+
:host {
|
|
31
|
+
display: block;
|
|
32
|
+
width: 40px;
|
|
33
|
+
height: 40px;
|
|
34
|
+
cursor: pointer;
|
|
35
|
+
padding: 4px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
:host(:hover) .inner {
|
|
39
|
+
background-color: var(--og-accent-color-alpha-30);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
:host([active]) .inner {
|
|
43
|
+
border-color: var(--og-accent-color);
|
|
44
|
+
background-color: var(--og-accent-color-alpha-30);
|
|
45
|
+
color: var(--og-text-color-3);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
* {
|
|
49
|
+
box-sizing: border-box;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.inner {
|
|
53
|
+
width: 100%;
|
|
54
|
+
height: 100%;
|
|
55
|
+
display: flex;
|
|
56
|
+
flex-direction: column;
|
|
57
|
+
align-items: center;
|
|
58
|
+
justify-content: center;
|
|
59
|
+
border-radius: var(--og-base-radius);
|
|
60
|
+
overflow: hidden;
|
|
61
|
+
transition: background-color 0.3s ease-in-out;
|
|
62
|
+
border: 1px solid transparent;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.icon {
|
|
66
|
+
flex: 1;
|
|
67
|
+
line-height: 22px;
|
|
68
|
+
display: flex;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.icon og-icon {
|
|
72
|
+
flex: 1;
|
|
73
|
+
display: flex;
|
|
74
|
+
justify-content: center;
|
|
75
|
+
align-items: center;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.text {
|
|
79
|
+
flex: 0;
|
|
80
|
+
font-size: 8px;
|
|
81
|
+
height: 10px;
|
|
82
|
+
line-height: 10px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.statusicon {
|
|
86
|
+
color: var(--og-accent-color);
|
|
87
|
+
}
|
|
88
|
+
`;
|
|
89
|
+
__decorate([
|
|
90
|
+
property({ type: String })
|
|
91
|
+
], BucketButton.prototype, "text", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
property()
|
|
94
|
+
], BucketButton.prototype, "icon", void 0);
|
|
95
|
+
__decorate([
|
|
96
|
+
property({ type: Boolean, reflect: true })
|
|
97
|
+
], BucketButton.prototype, "active", void 0);
|
|
98
|
+
__decorate([
|
|
99
|
+
property({ type: String })
|
|
100
|
+
], BucketButton.prototype, "statusIcon", void 0);
|
|
101
|
+
BucketButton = __decorate([
|
|
102
|
+
customElement('og-bucket-button')
|
|
103
|
+
], BucketButton);
|
|
104
|
+
export { BucketButton };
|
|
105
|
+
//# sourceMappingURL=bucketButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bucketButton.js","sourceRoot":"","sources":["../../src/ui/bucketButton.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAY,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGrD,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAArC;;QASN,WAAM,GAAG,KAAK,CAAA;QAsEd,WAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAA;;;sBAGE,IAAI,CAAC,QAAQ;;KAE9B,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;wBACV,IAAI,CAAC,IAAI;IAC7B;;EAEF,CAAC;IAEH,CAAC;IAfA,IAAY,QAAQ;QACnB,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAC,EAAE,EAAC,IAAI,EAAE,IAAI,EAAC,CAAa,CAAC;IAC3G,CAAC;;AA/DM,mBAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2DlB,AA3DY,CA2DX;AAtEF;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;0CACZ;AAGb;IADC,QAAQ,EAAE;0CACW;AAGtB;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,CAAC;4CAC3B;AAGd;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;gDACW;AAZxB,YAAY;IADxB,aAAa,CAAC,kBAAkB,CAAC;GACrB,YAAY,CA0FxB","sourcesContent":["import { IconSpec, utils } from '@omegagrid/core';\nimport { LitElement, html, css } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\n@customElement('og-bucket-button')\nexport class BucketButton extends LitElement {\n\n\t@property({type: String})\n\ttext: string;\n\n\t@property()\n\ticon: IconSpec|string;\n\n\t@property({type: Boolean, reflect: true})\n\tactive = false\n\n\t@property({type: String})\n\tstatusIcon: string|[string, string];\n\n\tstatic styles = css`\n\t\t:host {\n\t\t\tdisplay: block;\n\t\t\twidth: 40px;\n\t\t\theight: 40px;\n\t\t\tcursor: pointer;\n\t\t\tpadding: 4px;\n\t\t}\n\n\t\t:host(:hover) .inner {\n\t\t\tbackground-color: var(--og-accent-color-alpha-30);\n\t\t}\n\t\t\n\t\t:host([active]) .inner {\n\t\t\tborder-color: var(--og-accent-color);\n\t\t\tbackground-color: var(--og-accent-color-alpha-30);\n\t\t\tcolor: var(--og-text-color-3);\n\t\t}\n\n\t\t* {\n\t\t\tbox-sizing: border-box;\n\t\t}\n\n\t\t.inner {\n\t\t\twidth: 100%;\n\t\t\theight: 100%;\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\talign-items: center;\n\t\t\tjustify-content: center;\n\t\t\tborder-radius: var(--og-base-radius);\n\t\t\toverflow: hidden;\n\t\t\ttransition: background-color 0.3s ease-in-out;\n\t\t\tborder: 1px solid transparent;\n\t\t}\n\n\t\t.icon {\n\t\t\tflex: 1;\n\t\t\tline-height: 22px;\n\t\t\tdisplay: flex;\n\t\t}\n\n\t\t.icon og-icon {\n\t\t\tflex: 1;\n\t\t\tdisplay: flex;\n\t\t\tjustify-content: center;\n\t\t\talign-items: center;\n\t\t}\n\n\t\t.text {\n\t\t\tflex: 0;\n\t\t\tfont-size: 8px;\n\t\t\theight: 10px;\n\t\t\tline-height: 10px;\n\t\t}\n\n\t\t.statusicon {\n\t\t\tcolor: var(--og-accent-color);\n\t\t}\n\t`;\n\n\tprivate get iconSpec() {\n\t\treturn Object.assign(utils.isObject(this.icon) ? this.icon : {icon: this.icon}, {size: 'lg'}) as IconSpec;\n\t}\n\n\trender = () => html`\n\t\t<div class=\"inner\">\n\t\t\t<div class=\"icon\">\n\t\t\t\t<og-icon .icon=\"${this.iconSpec}\"></og-icon>\n\t\t\t</div>\n\t\t\t${this.text == null ? '' : html`\n\t\t\t\t<div class=\"text\">${this.text}</div>\n\t\t\t`}\n\t\t</div>\n\t`;\n\n}"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonMenus.d.ts","sourceRoot":"","sources":["../../src/ui/commonMenus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC;AAElC,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,UAAU,EAAE,aAAa,EAAE,CAK3D,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commonMenus.js","sourceRoot":"","sources":["../../src/ui/commonMenus.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,WAAW,GAAwC;IAC/D,QAAQ,EAAE;QACT,EAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAC;QACtB,EAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAC;KACrB;CACD,CAAA","sourcesContent":["import { CommandSource } from '@omegagrid/commands';\n\nexport type CommonMenu = 'yes_no';\n\nexport const commonMenus: Record<CommonMenu, CommandSource[]> = {\n\t'yes_no': [\n\t\t{id: 'Y', name: 'Yes'},\n\t\t{id: 'N', name: 'No'}\n\t]\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ComponentId, Layout, OmegaComponent } from '@omegagrid/core';
|
|
2
|
+
import { Bucket } from './bucket';
|
|
3
|
+
import { BucketPath } from './path';
|
|
4
|
+
export declare class ComponentHost extends OmegaComponent implements Layout {
|
|
5
|
+
static styles: import("lit").CSSResultGroup[];
|
|
6
|
+
bucket: Bucket;
|
|
7
|
+
componentId: ComponentId;
|
|
8
|
+
head: HTMLDivElement;
|
|
9
|
+
body: HTMLDivElement;
|
|
10
|
+
path: BucketPath;
|
|
11
|
+
private component;
|
|
12
|
+
private isEdited;
|
|
13
|
+
layout(): void;
|
|
14
|
+
_onEdit: () => void;
|
|
15
|
+
_onSave: () => void;
|
|
16
|
+
updated(props: Map<PropertyKey, unknown>): Promise<void>;
|
|
17
|
+
render: () => import("lit-html").TemplateResult<1>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=componentHost.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"componentHost.d.ts","sourceRoot":"","sources":["../../src/ui/componentHost.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAO,MAAM,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAG3E,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC,qBACa,aAAc,SAAQ,cAAe,YAAW,MAAM;IAElE,MAAM,CAAC,MAAM,iCAoBV;IAGH,MAAM,EAAE,MAAM,CAAC;IAGf,WAAW,EAAE,WAAW,CAAC;IAGzB,IAAI,EAAE,cAAc,CAAC;IAGrB,IAAI,EAAE,cAAc,CAAC;IAGrB,IAAI,EAAE,UAAU,CAAC;IAEjB,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,QAAQ,CAAS;IAEzB,MAAM;IAMN,OAAO,aAQN;IAED,OAAO,aAQN;IAEK,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC;IA8B9C,MAAM,6CAOJ;CAEF"}
|
|
@@ -0,0 +1,119 @@
|
|
|
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 { dom, OmegaComponent } from '@omegagrid/core';
|
|
8
|
+
import { css, html } from 'lit';
|
|
9
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
10
|
+
let ComponentHost = class ComponentHost extends OmegaComponent {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.isEdited = false;
|
|
14
|
+
this._onEdit = () => {
|
|
15
|
+
if (this.isEdited)
|
|
16
|
+
return;
|
|
17
|
+
this.bucket.editorContainer.model.walk(tab => {
|
|
18
|
+
if (tab.id == this.componentId)
|
|
19
|
+
tab.unsaved = true;
|
|
20
|
+
});
|
|
21
|
+
this.isEdited = true;
|
|
22
|
+
this.bucket.editorContainer.updateTabs();
|
|
23
|
+
this.bucket.components.unsavedComponents.add(this.componentId);
|
|
24
|
+
};
|
|
25
|
+
this._onSave = () => {
|
|
26
|
+
if (!this.isEdited)
|
|
27
|
+
return;
|
|
28
|
+
this.bucket.editorContainer.model.walk(tab => {
|
|
29
|
+
if (tab.id == this.componentId)
|
|
30
|
+
tab.unsaved = false;
|
|
31
|
+
});
|
|
32
|
+
this.isEdited = false;
|
|
33
|
+
this.bucket.editorContainer.updateTabs();
|
|
34
|
+
this.bucket.components.unsavedComponents.delete(this.componentId);
|
|
35
|
+
};
|
|
36
|
+
this.render = () => html `
|
|
37
|
+
<div class="container">
|
|
38
|
+
<div class="head" style="display: none">
|
|
39
|
+
<og-bucket-path></og-bucket-path>
|
|
40
|
+
</div>
|
|
41
|
+
<div class="body"></div>
|
|
42
|
+
</div>
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
layout() {
|
|
46
|
+
if (this.component?.layout) {
|
|
47
|
+
this.component.layout();
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async updated(props) {
|
|
51
|
+
if (props.has('componentId') && this.componentId) {
|
|
52
|
+
this.component = await this.bucket.components.get(this.componentId);
|
|
53
|
+
}
|
|
54
|
+
if (this.component) {
|
|
55
|
+
dom.empty(this.body);
|
|
56
|
+
this.body.appendChild(this.component);
|
|
57
|
+
this.component.removeEventListener('edit', this._onEdit);
|
|
58
|
+
this.component.addEventListener('edit', this._onEdit);
|
|
59
|
+
this.component.removeEventListener('save', this._onSave);
|
|
60
|
+
this.component.addEventListener('save', this._onSave);
|
|
61
|
+
}
|
|
62
|
+
if (props.has('componentId') && this.componentId) {
|
|
63
|
+
let path = [];
|
|
64
|
+
path = await this.bucket.components.getPath(this.componentId);
|
|
65
|
+
this.path.path = path;
|
|
66
|
+
const show = path.length > 0;
|
|
67
|
+
if (!dom.isHidden(this.head) != show) {
|
|
68
|
+
if (show) {
|
|
69
|
+
dom.showElement(this.head);
|
|
70
|
+
setTimeout(() => this.layout(), 100);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
dom.hideElement(this.head);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
ComponentHost.styles = [OmegaComponent.styles, css `
|
|
80
|
+
:host {
|
|
81
|
+
display: block;
|
|
82
|
+
height: 100%;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.container {
|
|
86
|
+
display: flex;
|
|
87
|
+
flex-direction: column;
|
|
88
|
+
height: 100%;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.head {
|
|
92
|
+
flex: 0 0 15px;
|
|
93
|
+
line-height: 15px;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.body {
|
|
97
|
+
flex: 1;
|
|
98
|
+
}
|
|
99
|
+
`];
|
|
100
|
+
__decorate([
|
|
101
|
+
property({ type: Object })
|
|
102
|
+
], ComponentHost.prototype, "bucket", void 0);
|
|
103
|
+
__decorate([
|
|
104
|
+
property({ type: String })
|
|
105
|
+
], ComponentHost.prototype, "componentId", void 0);
|
|
106
|
+
__decorate([
|
|
107
|
+
query('.head')
|
|
108
|
+
], ComponentHost.prototype, "head", void 0);
|
|
109
|
+
__decorate([
|
|
110
|
+
query('.body')
|
|
111
|
+
], ComponentHost.prototype, "body", void 0);
|
|
112
|
+
__decorate([
|
|
113
|
+
query('og-bucket-path')
|
|
114
|
+
], ComponentHost.prototype, "path", void 0);
|
|
115
|
+
ComponentHost = __decorate([
|
|
116
|
+
customElement('og-bucket-component-host')
|
|
117
|
+
], ComponentHost);
|
|
118
|
+
export { ComponentHost };
|
|
119
|
+
//# sourceMappingURL=componentHost.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"componentHost.js","sourceRoot":"","sources":["../../src/ui/componentHost.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAe,GAAG,EAAU,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAM5D,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,cAAc;IAA1C;;QAwCE,aAAQ,GAAG,KAAK,CAAC;QAQzB,YAAO,GAAG,GAAG,EAAE;YACd,IAAI,IAAI,CAAC,QAAQ;gBAAE,OAAO;YAC1B,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;gBAC5C,IAAI,GAAG,CAAC,EAAE,IAAI,IAAI,CAAC,WAAW;oBAAE,GAAG,CAAC,OAAO,GAAG,IAAI,CAAC;YACpD,CAAC,CAAC,CAAC;YACH,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;YACrB,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;YACzC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC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I,EAAE,MAAM,EAAC,CAAC;6CACV;AAGf;IADC,QAAQ,CAAC,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC;kDACA;AAGzB;IADC,KAAK,CAAC,OAAO,CAAC;2CACM;AAGrB;IADC,KAAK,CAAC,OAAO,CAAC;2CACM;AAGrB;IADC,KAAK,CAAC,gBAAgB,CAAC;2CACP;AArCL,aAAa;IADzB,aAAa,CAAC,0BAA0B,CAAC;GAC7B,aAAa,CA2GzB","sourcesContent":["import { ComponentId, dom, Layout, OmegaComponent } from '@omegagrid/core';\nimport { css, html } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { Bucket } from './bucket';\nimport { PathSegments } from '../types';\nimport { BucketPath } from './path';\n\n@customElement('og-bucket-component-host')\nexport class ComponentHost extends OmegaComponent implements Layout {\n\n\tstatic styles = [OmegaComponent.styles, css`\n\t\t:host {\n\t\t\tdisplay: block;\n\t\t\theight: 100%;\n\t\t}\n\n\t\t.container {\n\t\t\tdisplay: flex;\n\t\t\tflex-direction: column;\n\t\t\theight: 100%;\n\t\t}\n\n\t\t.head {\n\t\t\tflex: 0 0 15px;\n\t\t\tline-height: 15px;\n\t\t}\n\n\t\t.body {\n\t\t\tflex: 1;\n\t\t}\n\t`];\n\n\t@property({type: Object})\n\tbucket: Bucket;\n\n\t@property({type: String})\n\tcomponentId: ComponentId;\n\n\t@query('.head')\n\thead: HTMLDivElement;\n\n\t@query('.body')\n\tbody: HTMLDivElement;\n\n\t@query('og-bucket-path')\n\tpath: BucketPath;\n\n\tprivate component: HTMLElement;\n\tprivate isEdited = false;\n\n\tlayout() {\n\t\tif ((this.component as Layout)?.layout) {\n\t\t\t(this.component as Layout).layout();\n\t\t}\n\t}\n\n\t_onEdit = () => {\n\t\tif (this.isEdited) return;\n\t\tthis.bucket.editorContainer.model.walk(tab => {\n\t\t\tif (tab.id == this.componentId) tab.unsaved = true;\n\t\t});\n\t\tthis.isEdited = true;\n\t\tthis.bucket.editorContainer.updateTabs();\n\t\tthis.bucket.components.unsavedComponents.add(this.componentId);\n\t}\n\n\t_onSave = () => {\n\t\tif (!this.isEdited) return;\n\t\tthis.bucket.editorContainer.model.walk(tab => {\n\t\t\tif (tab.id == this.componentId) tab.unsaved = false;\n\t\t});\n\t\tthis.isEdited = false;\n\t\tthis.bucket.editorContainer.updateTabs();\n\t\tthis.bucket.components.unsavedComponents.delete(this.componentId);\n\t}\n\n\tasync updated(props: Map<PropertyKey, unknown>) {\n\t\tif (props.has('componentId') && this.componentId) {\n\t\t\tthis.component = await this.bucket.components.get(this.componentId);\n\t\t}\n\n\t\tif (this.component) {\n\t\t\tdom.empty(this.body);\n\t\t\tthis.body.appendChild(this.component);\n\t\t\tthis.component.removeEventListener('edit', this._onEdit);\n\t\t\tthis.component.addEventListener('edit', this._onEdit);\n\t\t\tthis.component.removeEventListener('save', this._onSave);\n\t\t\tthis.component.addEventListener('save', this._onSave);\n\t\t}\n\n\t\tif (props.has('componentId') && this.componentId) {\n\t\t\tlet path: PathSegments = [];\n\t\t\tpath = await this.bucket.components.getPath(this.componentId);\n\t\t\tthis.path.path = path as PathSegments;\n\t\t\tconst show = path.length > 0;\n\t\t\tif (!dom.isHidden(this.head) != show) {\n\t\t\t\tif (show) {\n\t\t\t\t\tdom.showElement(this.head);\n\t\t\t\t\tsetTimeout(() => this.layout(), 100);\n\t\t\t\t} else {\n\t\t\t\t\tdom.hideElement(this.head);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\trender = () => html`\n\t\t<div class=\"container\">\n\t\t\t<div class=\"head\" style=\"display: none\">\n\t\t\t\t<og-bucket-path></og-bucket-path>\n\t\t\t</div>\n\t\t\t<div class=\"body\"></div>\n\t\t</div>\n\t`;\n\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './bucket';
|
|
2
|
+
export * from './bucketAlert';
|
|
3
|
+
export * from './sidebar';
|
|
4
|
+
export * from './sidemenu';
|
|
5
|
+
export * from './top';
|
|
6
|
+
export * from './bucketButton';
|
|
7
|
+
export * from './componentHost';
|
|
8
|
+
export * from './modalSidebar';
|
|
9
|
+
export * from './commonMenus';
|
|
10
|
+
export * from './path';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC"}
|
package/dist/ui/index.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from './bucket';
|
|
2
|
+
export * from './bucketAlert';
|
|
3
|
+
export * from './sidebar';
|
|
4
|
+
export * from './sidemenu';
|
|
5
|
+
export * from './top';
|
|
6
|
+
export * from './bucketButton';
|
|
7
|
+
export * from './componentHost';
|
|
8
|
+
export * from './modalSidebar';
|
|
9
|
+
export * from './commonMenus';
|
|
10
|
+
export * from './path';
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC","sourcesContent":["export * from './bucket';\nexport * from './bucketAlert';\nexport * from './sidebar';\nexport * from './sidemenu';\nexport * from './top';\nexport * from './bucketButton';\nexport * from './componentHost';\nexport * from './modalSidebar';\nexport * from './commonMenus';\nexport * from './path';\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ComponentId, Layout, Overlay } from '@omegagrid/core';
|
|
2
|
+
import { LitElement } from 'lit';
|
|
3
|
+
import { Bucket } from './bucket';
|
|
4
|
+
export declare class ModalSidebar extends LitElement implements Layout {
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
caption: string;
|
|
7
|
+
closable: boolean;
|
|
8
|
+
bucket: Bucket;
|
|
9
|
+
componentId: ComponentId;
|
|
10
|
+
body: HTMLDivElement;
|
|
11
|
+
overlay: Overlay;
|
|
12
|
+
private component;
|
|
13
|
+
layout(): void;
|
|
14
|
+
showLoader: () => void;
|
|
15
|
+
hideLoader: () => HTMLElement;
|
|
16
|
+
_onClose: () => void;
|
|
17
|
+
disconnectedCallback(): void;
|
|
18
|
+
updated(props: Map<PropertyKey, unknown>): Promise<void>;
|
|
19
|
+
close(): void;
|
|
20
|
+
render: () => import("lit-html").TemplateResult<1>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=modalSidebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modalSidebar.d.ts","sourceRoot":"","sources":["../../src/ui/modalSidebar.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAO,MAAM,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAEvC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAGlC,qBACa,YAAa,SAAQ,UAAW,YAAW,MAAM;IAE7D,MAAM,CAAC,MAAM,4BAAW;IAGxB,OAAO,EAAE,MAAM,CAAC;IAGhB,QAAQ,UAAS;IAGjB,MAAM,EAAE,MAAM,CAAC;IAGf,WAAW,EAAE,WAAW,CAAC;IAGzB,IAAI,EAAE,cAAc,CAAC;IAGrB,OAAO,EAAE,OAAO,CAAC;IAEjB,OAAO,CAAC,SAAS,CAAc;IAG/B,MAAM;IAaN,UAAU,aAAiC;IAC3C,UAAU,oBAA6B;IAEvC,QAAQ,aAEP;IAED,oBAAoB;IAId,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,WAAW,EAAE,OAAO,CAAC;IAe9C,KAAK;IAIL,MAAM,6CAOJ;CAEF"}
|