@emuanalytics/flow-rdf-ui 4.1.0-preview.10 → 4.1.0-preview.11
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/components/dialog/dialog.styles.mjs +13 -5
- package/dist/components/icon/library.system.mjs +2 -1
- package/dist/components/list/list.component.mjs +101 -0
- package/dist/components/list/list.mjs +5 -0
- package/dist/components/list/list.styles.mjs +21 -0
- package/dist/components/list-item/list-item.component.mjs +197 -0
- package/dist/components/list-item/list-item.mjs +5 -0
- package/dist/components/list-item/list-item.styles.mjs +63 -0
- package/dist/components/query-builder/query-builder.component.mjs +19 -12
- package/dist/custom-elements.json +2416 -1789
- package/dist/index.d.mts +142 -2
- package/dist/index.d.ts +142 -2
- package/dist/index.mjs +2 -0
- package/dist/package.json.mjs +1 -1
- package/dist/utilities/register-components.mjs +7 -0
- package/dist/vscode.html-custom-data.json +132 -78
- package/package.json +1 -1
- package/themes/dark.css +9 -1
- package/themes/dark.styles.js +9 -1
- package/themes/light.css +2 -1
- package/themes/light.styles.js +2 -1
|
@@ -6,9 +6,9 @@ const styles = css`
|
|
|
6
6
|
|
|
7
7
|
:host {
|
|
8
8
|
--width: 31rem;
|
|
9
|
-
--header-spacing: var(--flow-ui-spacing-
|
|
10
|
-
--body-spacing: var(--flow-ui-spacing-
|
|
11
|
-
--footer-spacing: var(--flow-ui-spacing-
|
|
9
|
+
--header-spacing: var(--flow-ui-spacing-large);
|
|
10
|
+
--body-spacing: var(--flow-ui-spacing-large);
|
|
11
|
+
--footer-spacing: var(--flow-ui-spacing-large);
|
|
12
12
|
|
|
13
13
|
display: contents;
|
|
14
14
|
}
|
|
@@ -18,6 +18,14 @@ const styles = css`
|
|
|
18
18
|
--body-spacing: 0 var(--flow-ui-spacing-x-large);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
::slotted(:nth-child(1 of :not([slot]))) {
|
|
22
|
+
margin-top: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
::slotted(:nth-last-child(1 of :not([slot]))) {
|
|
26
|
+
margin-bottom: 0;
|
|
27
|
+
}
|
|
28
|
+
|
|
21
29
|
.dialog {
|
|
22
30
|
display: flex;
|
|
23
31
|
align-items: center;
|
|
@@ -92,7 +100,7 @@ const styles = css`
|
|
|
92
100
|
.dialog__body {
|
|
93
101
|
flex: 1 1 auto;
|
|
94
102
|
display: block;
|
|
95
|
-
padding: var(--body-spacing);
|
|
103
|
+
padding-inline: var(--body-spacing);
|
|
96
104
|
overflow: auto;
|
|
97
105
|
-webkit-overflow-scrolling: touch;
|
|
98
106
|
}
|
|
@@ -104,7 +112,7 @@ const styles = css`
|
|
|
104
112
|
}
|
|
105
113
|
|
|
106
114
|
.dialog__footer ::slotted(flow-ui-button:not(:first-of-type)) {
|
|
107
|
-
margin-inline-start: var(--flow-ui-spacing-
|
|
115
|
+
margin-inline-start: var(--flow-ui-spacing-small);
|
|
108
116
|
}
|
|
109
117
|
|
|
110
118
|
.dialog:not(.dialog--has-footer) .dialog__footer {
|
|
@@ -143,7 +143,8 @@ const icons = {
|
|
|
143
143
|
plus: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" class="flow-ui-icon"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M256 80c0-17.7-14.3-32-32-32s-32 14.3-32 32v144H48c-17.7 0-32 14.3-32 32s14.3 32 32 32h144v144c0 17.7 14.3 32 32 32s32-14.3 32-32V288h144c17.7 0 32-14.3 32-32s-14.3-32-32-32H256V80z"/></svg>',
|
|
144
144
|
"square-plus": '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" class="flow-ui-icon"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M64 32C28.7 32 0 60.7 0 96v320c0 35.3 28.7 64 64 64h320c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zm136 312v-64h-64c-13.3 0-24-10.7-24-24s10.7-24 24-24h64v-64c0-13.3 10.7-24 24-24s24 10.7 24 24v64h64c13.3 0 24 10.7 24 24s-10.7 24-24 24h-64v64c0 13.3-10.7 24-24 24s-24-10.7-24-24z"/></svg>',
|
|
145
145
|
"square-minus": '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" class="flow-ui-icon"><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d="M64 32C28.7 32 0 60.7 0 96v320c0 35.3 28.7 64 64 64h320c35.3 0 64-28.7 64-64V96c0-35.3-28.7-64-64-64H64zm88 200h144c13.3 0 24 10.7 24 24s-10.7 24-24 24H152c-13.3 0-24-10.7-24-24s10.7-24 24-24z"/></svg>',
|
|
146
|
-
"ellipsis-vertical": "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 128 512' class='flow-ui-icon'><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d='M64 360a56 56 0 100 112 56 56 0 100-112zm0-160a56 56 0 100 112 56 56 0 100-112zm56-104A56 56 0 108 96a56 56 0 10112 0z'/></svg>"
|
|
146
|
+
"ellipsis-vertical": "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 128 512' class='flow-ui-icon'><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d='M64 360a56 56 0 100 112 56 56 0 100-112zm0-160a56 56 0 100 112 56 56 0 100-112zm56-104A56 56 0 108 96a56 56 0 10112 0z'/></svg>",
|
|
147
|
+
bars: "<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 448 512' class='flow-ui-icon'><!--! Font Awesome Free 6.4.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2023 Fonticons, Inc.--><path d='M0 96c0-17.7 14.3-32 32-32h384c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zm0 160c0-17.7 14.3-32 32-32h384c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zm448 160c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32h384c17.7 0 32 14.3 32 32z'/></svg>"
|
|
147
148
|
};
|
|
148
149
|
const systemLibrary = {
|
|
149
150
|
name: "system",
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import FlowRdfElement from '../../internal/flow-ui-rdf-element.mjs';
|
|
5
|
+
import styles from './list.styles.mjs';
|
|
6
|
+
|
|
7
|
+
var __defProp = Object.defineProperty;
|
|
8
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
9
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
10
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
11
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
12
|
+
if (decorator = decorators[i])
|
|
13
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
14
|
+
if (kind && result)
|
|
15
|
+
__defProp(target, key, result);
|
|
16
|
+
return result;
|
|
17
|
+
};
|
|
18
|
+
class FlowUiList extends FlowRdfElement {
|
|
19
|
+
constructor() {
|
|
20
|
+
super();
|
|
21
|
+
this.draggedItem = null;
|
|
22
|
+
this.draggedOverItem = null;
|
|
23
|
+
this.readonly = false;
|
|
24
|
+
this.reorder = false;
|
|
25
|
+
this.removable = false;
|
|
26
|
+
}
|
|
27
|
+
connectedCallback() {
|
|
28
|
+
super.connectedCallback();
|
|
29
|
+
}
|
|
30
|
+
disconnectedCallback() {
|
|
31
|
+
super.disconnectedCallback();
|
|
32
|
+
}
|
|
33
|
+
get listItems() {
|
|
34
|
+
return [...this.querySelectorAll("flow-ui-list-item")];
|
|
35
|
+
}
|
|
36
|
+
handleDragStart(ev) {
|
|
37
|
+
this.draggedItem = ev.target;
|
|
38
|
+
console.log(`parent drag start: ${this.draggedItem.value}`, this.draggedItem);
|
|
39
|
+
}
|
|
40
|
+
handleDragOver(ev) {
|
|
41
|
+
ev.stopPropagation();
|
|
42
|
+
if (!this.draggedItem) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
let target = ev.target.closest("flow-ui-list-item");
|
|
46
|
+
if (target === this.draggedItem) {
|
|
47
|
+
target = null;
|
|
48
|
+
}
|
|
49
|
+
if (target && target !== this.draggedOverItem) {
|
|
50
|
+
if (this.draggedItem === target.previousElementSibling) {
|
|
51
|
+
console.log("moving down");
|
|
52
|
+
this.insertBefore(this.draggedItem, target.nextSibling);
|
|
53
|
+
} else if (this.draggedItem === target.nextElementSibling) {
|
|
54
|
+
this.insertBefore(this.draggedItem, target);
|
|
55
|
+
}
|
|
56
|
+
this.draggedOverItem = null;
|
|
57
|
+
} else {
|
|
58
|
+
this.draggedOverItem = target;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
handleDrop(_ev) {
|
|
62
|
+
if (!this.draggedItem || !this.draggedOverItem) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
console.log(`parent drop: ${this.draggedItem.value} onto target: ${this.draggedOverItem.value}`);
|
|
66
|
+
}
|
|
67
|
+
handleDragEnd(ev) {
|
|
68
|
+
const target = ev.target.value;
|
|
69
|
+
console.log(`parent drag end: target: ${target}`);
|
|
70
|
+
this.draggedItem = null;
|
|
71
|
+
this.draggedOverItem = null;
|
|
72
|
+
}
|
|
73
|
+
render() {
|
|
74
|
+
return html`
|
|
75
|
+
<div
|
|
76
|
+
part="base"
|
|
77
|
+
class=${classMap({
|
|
78
|
+
list: true
|
|
79
|
+
})}
|
|
80
|
+
@flow-ui-drag-start=${this.handleDragStart}
|
|
81
|
+
@flow-ui-drag-over=${this.handleDragOver}
|
|
82
|
+
@flow-ui-drag-drop=${this.handleDrop}
|
|
83
|
+
@flow-ui-drag-end=${this.handleDragEnd}
|
|
84
|
+
>
|
|
85
|
+
<slot></slot>
|
|
86
|
+
</div>
|
|
87
|
+
`;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
FlowUiList.styles = styles;
|
|
91
|
+
__decorateClass([
|
|
92
|
+
property({ type: Boolean })
|
|
93
|
+
], FlowUiList.prototype, "readonly", 2);
|
|
94
|
+
__decorateClass([
|
|
95
|
+
property({ type: Boolean })
|
|
96
|
+
], FlowUiList.prototype, "reorder", 2);
|
|
97
|
+
__decorateClass([
|
|
98
|
+
property({ type: Boolean })
|
|
99
|
+
], FlowUiList.prototype, "removable", 2);
|
|
100
|
+
|
|
101
|
+
export { FlowUiList as default };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
import componentStyles from '../../styles/component.styles.mjs';
|
|
3
|
+
|
|
4
|
+
const styles = css`
|
|
5
|
+
${componentStyles}
|
|
6
|
+
|
|
7
|
+
:host {
|
|
8
|
+
display: block;
|
|
9
|
+
|
|
10
|
+
--divider-color: var(--flow-ui-divider-color);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.list {
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
gap: max(var(--flow-ui-divider-width), 2px);
|
|
17
|
+
background-color: var(--divider-color);
|
|
18
|
+
}
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
export { styles as default };
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { html, nothing } from 'lit';
|
|
2
|
+
import { query, property } from 'lit/decorators.js';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import { boolean } from '../../internal/boolean.mjs';
|
|
5
|
+
import FlowRdfElement from '../../internal/flow-ui-rdf-element.mjs';
|
|
6
|
+
import { HasSlotController } from '../../internal/slot.mjs';
|
|
7
|
+
import styles from './list-item.styles.mjs';
|
|
8
|
+
|
|
9
|
+
var __defProp = Object.defineProperty;
|
|
10
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
11
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
12
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
13
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
14
|
+
if (decorator = decorators[i])
|
|
15
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
16
|
+
if (kind && result)
|
|
17
|
+
__defProp(target, key, result);
|
|
18
|
+
return result;
|
|
19
|
+
};
|
|
20
|
+
class FlowUiListItem extends FlowRdfElement {
|
|
21
|
+
constructor() {
|
|
22
|
+
super();
|
|
23
|
+
this.hasSlotController = new HasSlotController(this, "prefix", "suffix", "menu");
|
|
24
|
+
this.readonly = false;
|
|
25
|
+
this.reorder = false;
|
|
26
|
+
this.removable = false;
|
|
27
|
+
this.handleDragStart = (ev) => {
|
|
28
|
+
ev.stopPropagation();
|
|
29
|
+
ev.dataTransfer.setData("application/flow-ui-list-item", this.value);
|
|
30
|
+
ev.dataTransfer.effectAllowed = "move";
|
|
31
|
+
this.emit("flow-ui-drag-start");
|
|
32
|
+
};
|
|
33
|
+
this.handleDragStart = this.handleDragStart.bind(this);
|
|
34
|
+
this.handleDragOver = this.handleDragOver.bind(this);
|
|
35
|
+
this.handleDrop = this.handleDrop.bind(this);
|
|
36
|
+
this.handleDragEnd = this.handleDragEnd.bind(this);
|
|
37
|
+
}
|
|
38
|
+
connectedCallback() {
|
|
39
|
+
super.connectedCallback();
|
|
40
|
+
this.readonly = boolean(this.readonly);
|
|
41
|
+
this.reorder = boolean(this.reorder);
|
|
42
|
+
this.removable = boolean(this.removable);
|
|
43
|
+
this.addEventListener("dragover", this.handleDragOver);
|
|
44
|
+
this.addEventListener("drop", this.handleDrop);
|
|
45
|
+
}
|
|
46
|
+
disconnectedCallback() {
|
|
47
|
+
super.disconnectedCallback();
|
|
48
|
+
this.removeEventListener("dragover", this.handleDragOver);
|
|
49
|
+
this.removeEventListener("drop", this.handleDrop);
|
|
50
|
+
}
|
|
51
|
+
rename() {
|
|
52
|
+
this.input.focus();
|
|
53
|
+
}
|
|
54
|
+
handleMenuSelect(ev) {
|
|
55
|
+
const menuItem = ev.detail.item;
|
|
56
|
+
if (menuItem.value === "rename") {
|
|
57
|
+
this.updateComplete.then(() => this.rename());
|
|
58
|
+
} else if (menuItem.value === "remove") {
|
|
59
|
+
const requestRemove = this.emit("flow-ui-remove", { cancelable: true });
|
|
60
|
+
if (!requestRemove.defaultPrevented) {
|
|
61
|
+
this.remove();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
handleInputEvents(ev) {
|
|
66
|
+
if (ev.type === "flow-ui-change") {
|
|
67
|
+
this.label = this.input.value;
|
|
68
|
+
this.input.blur();
|
|
69
|
+
} else {
|
|
70
|
+
ev.stopPropagation();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
handleReorderPointerDown(_ev) {
|
|
74
|
+
this.addEventListener("dragstart", this.handleDragStart);
|
|
75
|
+
console.log("adding dragstart");
|
|
76
|
+
this.addEventListener("dragend", this.handleDragEnd);
|
|
77
|
+
this.setAttribute("draggable", "true");
|
|
78
|
+
}
|
|
79
|
+
handleReorderPointerUp(_ev) {
|
|
80
|
+
this.removeEventListener("dragstart", this.handleDragStart);
|
|
81
|
+
console.log("removing dragstart");
|
|
82
|
+
this.removeEventListener("dragend", this.handleDragEnd);
|
|
83
|
+
this.removeAttribute("draggable");
|
|
84
|
+
}
|
|
85
|
+
handleDragOver(ev) {
|
|
86
|
+
ev.stopPropagation();
|
|
87
|
+
ev.preventDefault();
|
|
88
|
+
if (ev.dataTransfer?.types.includes("application/flow-ui-list-item")) {
|
|
89
|
+
ev.dataTransfer.dropEffect = "move";
|
|
90
|
+
this.emit("flow-ui-drag-over");
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
handleDragEnd(ev) {
|
|
94
|
+
ev.stopPropagation();
|
|
95
|
+
this.removeEventListener("dragstart", this.handleDragStart);
|
|
96
|
+
console.log("removing dragstart");
|
|
97
|
+
this.removeEventListener("dragend", this.handleDragEnd);
|
|
98
|
+
this.removeAttribute("draggable");
|
|
99
|
+
this.emit("flow-ui-drag-end");
|
|
100
|
+
}
|
|
101
|
+
handleDrop(ev) {
|
|
102
|
+
ev.preventDefault();
|
|
103
|
+
ev.stopPropagation();
|
|
104
|
+
this.emit("flow-ui-drag-drop");
|
|
105
|
+
}
|
|
106
|
+
renderMenu() {
|
|
107
|
+
const hasCustomMenuDivider = (!this.readonly || this.removable) && this.hasSlotController.test("menu");
|
|
108
|
+
return html`
|
|
109
|
+
<flow-ui-dropdown placement="bottom-end" class="list-item__menu-dropdown">
|
|
110
|
+
<flow-ui-icon-button
|
|
111
|
+
part="menu-button"
|
|
112
|
+
class="list-item__menu-button"
|
|
113
|
+
slot="trigger"
|
|
114
|
+
name="ellipsis-vertical"
|
|
115
|
+
library="system"
|
|
116
|
+
></flow-ui-icon-button>
|
|
117
|
+
<flow-ui-menu @flow-ui-select=${this.handleMenuSelect}>
|
|
118
|
+
${!this.readonly ? html`
|
|
119
|
+
<flow-ui-menu-item value="rename">Rename</flow-ui-menu-item>
|
|
120
|
+
` : nothing}
|
|
121
|
+
${this.removable ? html`
|
|
122
|
+
<flow-ui-menu-item value="remove">Delete</flow-ui-menu-item>
|
|
123
|
+
` : nothing}
|
|
124
|
+
${hasCustomMenuDivider ? html`
|
|
125
|
+
<flow-ui-divider></flow-ui-divider>
|
|
126
|
+
` : nothing}
|
|
127
|
+
${this.hasSlotController.test("menu") ? html`
|
|
128
|
+
<slot name="menu"></slot>
|
|
129
|
+
` : nothing}
|
|
130
|
+
</flow-ui-menu>
|
|
131
|
+
<slot name="menu"></slot>
|
|
132
|
+
</flow-ui-dropdown>
|
|
133
|
+
`;
|
|
134
|
+
}
|
|
135
|
+
render() {
|
|
136
|
+
const hasMenu = this.readonly || this.removable || this.hasSlotController.test("menu");
|
|
137
|
+
return html`
|
|
138
|
+
<div
|
|
139
|
+
part="base"
|
|
140
|
+
class=${classMap({
|
|
141
|
+
"list-item": true,
|
|
142
|
+
"list-item--has-prefix": this.hasSlotController.test("prefix"),
|
|
143
|
+
"list-item--has-suffix": this.hasSlotController.test("suffix"),
|
|
144
|
+
"list-item--has-menu": this.hasSlotController.test("menu"),
|
|
145
|
+
"list-item--readonly": this.readonly
|
|
146
|
+
})}
|
|
147
|
+
>
|
|
148
|
+
${this.reorder ? html`
|
|
149
|
+
<flow-ui-icon
|
|
150
|
+
part="reorder-icon"
|
|
151
|
+
name="bars"
|
|
152
|
+
library="system"
|
|
153
|
+
class="list-item__reorder-icon"
|
|
154
|
+
@pointerdown=${this.handleReorderPointerDown}
|
|
155
|
+
@pointerup=${this.handleReorderPointerUp}
|
|
156
|
+
></flow-ui-icon>
|
|
157
|
+
` : nothing}
|
|
158
|
+
<slot name="prefix" part="prefix" class="list-item__prefix"></slot>
|
|
159
|
+
|
|
160
|
+
<flow-ui-input
|
|
161
|
+
exportparts="input"
|
|
162
|
+
inline
|
|
163
|
+
class="list-item__input"
|
|
164
|
+
.value=${this.label}
|
|
165
|
+
.readonly=${this.readonly}
|
|
166
|
+
@flow-ui-change=${this.handleInputEvents}
|
|
167
|
+
@flow-ui-input=${this.handleInputEvents}
|
|
168
|
+
></flow-ui-input>
|
|
169
|
+
<div class="list-item__spacer"></div>
|
|
170
|
+
<slot name="suffix" part="suffix" class="list-item__suffix"></slot>
|
|
171
|
+
|
|
172
|
+
${hasMenu ? this.renderMenu() : nothing}
|
|
173
|
+
</div>
|
|
174
|
+
`;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
FlowUiListItem.styles = styles;
|
|
178
|
+
__decorateClass([
|
|
179
|
+
query(".list-item__input")
|
|
180
|
+
], FlowUiListItem.prototype, "input", 2);
|
|
181
|
+
__decorateClass([
|
|
182
|
+
property({ reflect: true })
|
|
183
|
+
], FlowUiListItem.prototype, "label", 2);
|
|
184
|
+
__decorateClass([
|
|
185
|
+
property({ reflect: true })
|
|
186
|
+
], FlowUiListItem.prototype, "value", 2);
|
|
187
|
+
__decorateClass([
|
|
188
|
+
property({ type: Boolean, reflect: true })
|
|
189
|
+
], FlowUiListItem.prototype, "readonly", 2);
|
|
190
|
+
__decorateClass([
|
|
191
|
+
property({ type: Boolean, reflect: true })
|
|
192
|
+
], FlowUiListItem.prototype, "reorder", 2);
|
|
193
|
+
__decorateClass([
|
|
194
|
+
property({ type: Boolean, reflect: true })
|
|
195
|
+
], FlowUiListItem.prototype, "removable", 2);
|
|
196
|
+
|
|
197
|
+
export { FlowUiListItem as default };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
import componentStyles from '../../styles/component.styles.mjs';
|
|
3
|
+
|
|
4
|
+
const styles = css`
|
|
5
|
+
${componentStyles}
|
|
6
|
+
|
|
7
|
+
:host {
|
|
8
|
+
display: block;
|
|
9
|
+
--padding: var(--flow-ui-list-item-padding);
|
|
10
|
+
--height: var(--flow-ui-list-item-height);
|
|
11
|
+
--color: var(--flow-ui-list-item-color);
|
|
12
|
+
--accessory-color: var(--flow-ui-list-item-accessory-color);
|
|
13
|
+
--background-color: var(--flow-ui-list-item-background-color);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:host([draggable='true']) {
|
|
17
|
+
opacity: 0.1;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.list-item {
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
gap: var(--flow-ui-spacing-small);
|
|
24
|
+
|
|
25
|
+
height: var(--height);
|
|
26
|
+
padding: var(--padding);
|
|
27
|
+
|
|
28
|
+
color: var(--color);
|
|
29
|
+
background-color: var(--background-color);
|
|
30
|
+
user-select: none;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.list-item__prefix,
|
|
34
|
+
.list-item__suffix,
|
|
35
|
+
.list-item__menu-button,
|
|
36
|
+
.list-item__reorder-icon {
|
|
37
|
+
color: var(--accessory-color);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.list-item__spacer {
|
|
41
|
+
flex: 1;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.list-item.list-item--readonly .list-item__input::part(form-control) {
|
|
45
|
+
--control-background-color-hover: transparent;
|
|
46
|
+
--control-border-color-hover: transparent;
|
|
47
|
+
--control-background-color-focus: transparent;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.list-item__menu-button {
|
|
51
|
+
visibility: hidden;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.list-item:hover .list-item__menu-button {
|
|
55
|
+
visibility: visible;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.list-item__reorder-icon {
|
|
59
|
+
cursor: move;
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
|
|
63
|
+
export { styles as default };
|
|
@@ -118,11 +118,14 @@ const _FlowUiQueryBuilder = class _FlowUiQueryBuilder extends FlowRdfElement {
|
|
|
118
118
|
*/
|
|
119
119
|
handleRemoveRule(ev, index) {
|
|
120
120
|
ev.stopPropagation();
|
|
121
|
-
this.
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
this.
|
|
125
|
-
|
|
121
|
+
const confirmDelete = this.emit("flow-ui-remove", { cancelable: true });
|
|
122
|
+
if (!confirmDelete.defaultPrevented) {
|
|
123
|
+
this._value.rules.splice(index, 1);
|
|
124
|
+
this.requestUpdate();
|
|
125
|
+
this.updateComplete.then(() => {
|
|
126
|
+
this.emitValueChange();
|
|
127
|
+
});
|
|
128
|
+
}
|
|
126
129
|
}
|
|
127
130
|
handleSubQueryValueChange(ev) {
|
|
128
131
|
ev.stopPropagation();
|
|
@@ -160,9 +163,12 @@ const _FlowUiQueryBuilder = class _FlowUiQueryBuilder extends FlowRdfElement {
|
|
|
160
163
|
const duplicateRule = cloneDeep(rule);
|
|
161
164
|
this._value.rules.splice(index, 0, duplicateRule);
|
|
162
165
|
} else if (menuItem.value === "delete") {
|
|
163
|
-
this.
|
|
164
|
-
if (
|
|
165
|
-
this._value.rules.
|
|
166
|
+
const confirmDelete = this.emit("flow-ui-remove", { cancelable: true });
|
|
167
|
+
if (!confirmDelete.defaultPrevented) {
|
|
168
|
+
this._value.rules.splice(index, 1);
|
|
169
|
+
if (this._value.rules.length === 0) {
|
|
170
|
+
this._value.rules.push({ field: "", operator: "=", enabled: true });
|
|
171
|
+
}
|
|
166
172
|
}
|
|
167
173
|
}
|
|
168
174
|
this.requestUpdate();
|
|
@@ -185,6 +191,7 @@ const _FlowUiQueryBuilder = class _FlowUiQueryBuilder extends FlowRdfElement {
|
|
|
185
191
|
} else if (menuItem.value === "clear-filters") {
|
|
186
192
|
updateValue = true;
|
|
187
193
|
this._value = emptyRuleSet;
|
|
194
|
+
this.emit("flow-ui-clear");
|
|
188
195
|
}
|
|
189
196
|
if (updateValue) {
|
|
190
197
|
this.requestUpdate();
|
|
@@ -249,6 +256,10 @@ const _FlowUiQueryBuilder = class _FlowUiQueryBuilder extends FlowRdfElement {
|
|
|
249
256
|
library="system"
|
|
250
257
|
></flow-ui-icon-button>
|
|
251
258
|
<flow-ui-menu @flow-ui-select=${(ev) => this.handleToolbarMenuSelect(ev)}>
|
|
259
|
+
${this.hasSlotController.test("menu") ? html`
|
|
260
|
+
<slot name="menu"></slot>
|
|
261
|
+
<flow-ui-divider></flow-ui-divider>
|
|
262
|
+
` : nothing}
|
|
252
263
|
<flow-ui-menu-item value="add-group">Add Filter Group</flow-ui-menu-item>
|
|
253
264
|
${this.subQueryBuilder ? html`
|
|
254
265
|
<flow-ui-divider></flow-ui-divider>
|
|
@@ -256,10 +267,6 @@ const _FlowUiQueryBuilder = class _FlowUiQueryBuilder extends FlowRdfElement {
|
|
|
256
267
|
Delete Filter Group
|
|
257
268
|
</flow-ui-menu-item>
|
|
258
269
|
` : nothing}
|
|
259
|
-
${this.hasSlotController.test("menu") ? html`
|
|
260
|
-
<flow-ui-divider></flow-ui-divider>
|
|
261
|
-
<slot name="menu"></slot>
|
|
262
|
-
` : nothing}
|
|
263
270
|
${this.subQueryBuilder ? nothing : html`
|
|
264
271
|
<flow-ui-divider></flow-ui-divider>
|
|
265
272
|
<flow-ui-menu-item value="clear-filters" class="menu-item--danger">Clear Filters</flow-ui-menu-item>
|