@emuanalytics/flow-rdf-ui 4.1.9 → 4.1.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.
@@ -120,7 +120,6 @@ class FlowUiList extends FlowRdfElement {
120
120
  }
121
121
  handleDragStart(ev) {
122
122
  this.draggedItem = ev.target;
123
- console.log(`parent drag start: ${this.draggedItem.value}`, this.draggedItem);
124
123
  }
125
124
  handleDragOver(ev) {
126
125
  ev.stopPropagation();
@@ -133,7 +132,6 @@ class FlowUiList extends FlowRdfElement {
133
132
  }
134
133
  if (target && target !== this.draggedOverItem) {
135
134
  if (this.draggedItem === target.previousElementSibling) {
136
- console.log("moving down");
137
135
  this.insertBefore(this.draggedItem, target.nextSibling);
138
136
  } else if (this.draggedItem === target.nextElementSibling) {
139
137
  this.insertBefore(this.draggedItem, target);
@@ -147,11 +145,8 @@ class FlowUiList extends FlowRdfElement {
147
145
  if (!this.draggedItem || !this.draggedOverItem) {
148
146
  return;
149
147
  }
150
- console.log(`parent drop: ${this.draggedItem.value} onto target: ${this.draggedOverItem.value}`);
151
148
  }
152
- handleDragEnd(ev) {
153
- const target = ev.target.value;
154
- console.log(`parent drag end: target: ${target}`);
149
+ handleDragEnd(_ev) {
155
150
  this.draggedItem = null;
156
151
  this.draggedOverItem = null;
157
152
  }
@@ -104,13 +104,11 @@ class FlowUiListItem extends FlowRdfElement {
104
104
  }
105
105
  handleReorderPointerDown(_ev) {
106
106
  this.addEventListener("dragstart", this.handleDragStart);
107
- console.log("adding dragstart");
108
107
  this.addEventListener("dragend", this.handleDragEnd);
109
108
  this.setAttribute("draggable", "true");
110
109
  }
111
110
  handleReorderPointerUp(_ev) {
112
111
  this.removeEventListener("dragstart", this.handleDragStart);
113
- console.log("removing dragstart");
114
112
  this.removeEventListener("dragend", this.handleDragEnd);
115
113
  this.removeAttribute("draggable");
116
114
  }
@@ -125,7 +123,6 @@ class FlowUiListItem extends FlowRdfElement {
125
123
  handleDragEnd(ev) {
126
124
  ev.stopPropagation();
127
125
  this.removeEventListener("dragstart", this.handleDragStart);
128
- console.log("removing dragstart");
129
126
  this.removeEventListener("dragend", this.handleDragEnd);
130
127
  this.removeAttribute("draggable");
131
128
  this.emit("flow-ui-drag-end");
@@ -384,6 +384,7 @@ const _FlowUiQueryBuilder = class _FlowUiQueryBuilder extends FlowRdfElement {
384
384
  .value=${ruleSet}
385
385
  .config=${this.config}
386
386
  size=${this.size}
387
+ !borders=${this.borders}
387
388
  ?tree-lines=${this.treeLines}
388
389
  @flow-ui-change=${this.handleSubQueryValueChange}
389
390
  @flow-ui-remove=${(ev) => this.handleRemoveRule(ev, index)}
@@ -226,7 +226,7 @@ const styles = css`
226
226
  &::after {
227
227
  content: '';
228
228
  left: -10px;
229
- border-color: var(--flow-ui-color-neutral-200);
229
+ border-color: var(--control-border-color);
230
230
  border-style: solid;
231
231
  width: 9px;
232
232
  position: absolute;
@@ -315,6 +315,14 @@ const styles = css`
315
315
  .query-builder__footer ::slotted(flow-ui-button:not(:first-of-type)) {
316
316
  margin-inline-start: var(--flow-ui-spacing-x-small);
317
317
  }
318
+
319
+ /* Sub query builder styling */
320
+
321
+ .query-builder--child[borders='true'] {
322
+ /* remove right border */
323
+ border-radius: var(--control-border-radius) 0 0 var(--control-border-radius);
324
+ border-right: 0;
325
+ }
318
326
  `;
319
327
 
320
328
  export { styles as default };
@@ -23,6 +23,9 @@ var __decorateClass = (decorators, target, key, kind) => {
23
23
  class FlowUiSplitView extends FlowRdfElement {
24
24
  constructor() {
25
25
  super(...arguments);
26
+ // Saved panel layouts for restoring when panels are dynamically added/removed
27
+ // The key is a comma-separated concatenation of panel ids e.g. 'pane-1,pane-2,pane-3'
28
+ this._panelLayouts = {};
26
29
  this._panels = [];
27
30
  this.noDragClose = false;
28
31
  this.positions = ["auto", "auto", "auto", "auto"];
@@ -302,6 +305,7 @@ class FlowUiSplitView extends FlowRdfElement {
302
305
  if (splitViewSize === 0) {
303
306
  return;
304
307
  }
308
+ this.savePanelLayouts();
305
309
  const numOpenPanels = this._panels.filter((panel) => !panel.closed && !panel.hidden).length;
306
310
  const panelSizes = this._panels.map((panel) => {
307
311
  if (panel.hidden) {
@@ -348,7 +352,9 @@ class FlowUiSplitView extends FlowRdfElement {
348
352
  panel.divider = !panel.hidden;
349
353
  }
350
354
  const lastVisiblePanel = this._panels.slice().reverse().find((panel) => !panel.hidden);
351
- lastVisiblePanel.divider = false;
355
+ if (lastVisiblePanel) {
356
+ lastVisiblePanel.divider = false;
357
+ }
352
358
  this.positions = panelSizes.map((size) => size + "px");
353
359
  }
354
360
  resizePanels() {
@@ -459,20 +465,51 @@ class FlowUiSplitView extends FlowRdfElement {
459
465
  }
460
466
  handlePanelAdded(panel) {
461
467
  this.updatePanelInfo();
462
- if (isUndefined(panel.size) || panel.size === "auto") {
463
- panel.size = panel.minSize ?? "50px";
468
+ if (!this.restorePanelLayouts()) {
469
+ if (isUndefined(panel.size) || panel.size === "auto") {
470
+ panel.size = panel.minSize ?? "50px";
471
+ }
472
+ this.shrinkPanels(this._panels.length - 1, -1, true, this.sizeToPixels(panel.size));
464
473
  }
465
- this.shrinkPanels(this._panels.length - 1, -1, true, this.sizeToPixels(panel.size));
466
474
  }
467
475
  handlePanelRemoved(panel) {
468
476
  this.updatePanelInfo();
469
- this.growPanels(this._panels.length - 1, -1, true, this.sizeToPixels(panel.size));
477
+ if (!this.restorePanelLayouts()) {
478
+ this.growPanels(this._panels.length - 1, -1, true, this.sizeToPixels(panel.size));
479
+ }
470
480
  }
471
481
  updatePanelInfo() {
472
482
  this._panels = [...this.panelSlot.assignedElements()].filter(
473
483
  (el) => el.tagName.toLowerCase() === "flow-ui-split-view-pane"
474
484
  );
475
485
  }
486
+ // Key used to stor panel layouts for a given set of panels
487
+ // This is a comma-separated concatenation of panel ids e.g. 'pane-1,pane-2,pane-3'
488
+ panelLayoutsKey() {
489
+ return this._panels.map((panel) => panel.id).join(",");
490
+ }
491
+ savePanelLayouts() {
492
+ const panelLayoutsKey = this.panelLayoutsKey();
493
+ const panelLayouts = this._panels.map(
494
+ (panel) => ({ id: panel.id, size: panel.size, closed: panel.closed })
495
+ );
496
+ this._panelLayouts[panelLayoutsKey] = panelLayouts;
497
+ }
498
+ restorePanelLayouts() {
499
+ const panelLayoutsKey = this.panelLayoutsKey();
500
+ if (this._panelLayouts[panelLayoutsKey]) {
501
+ this._panelLayouts[panelLayoutsKey].forEach((panelLayout) => {
502
+ const panel = this._panels.find((p) => p.id === panelLayout.id);
503
+ if (panel) {
504
+ panel.size = panelLayout.size;
505
+ panel.closed = panelLayout.closed;
506
+ }
507
+ });
508
+ return true;
509
+ } else {
510
+ return false;
511
+ }
512
+ }
476
513
  }
477
514
  FlowUiSplitView.styles = styles;
478
515
  __decorateClass([
@@ -5,6 +5,7 @@ import { boolean } from '../../internal/boolean.mjs';
5
5
  import FlowRdfElement from '../../internal/flow-ui-rdf-element.mjs';
6
6
  import { setDefaultAnimation } from '../../utilities/animation-registry.mjs';
7
7
  import styles from './split-view-pane.styles.mjs';
8
+ import { isStringFull } from '../../internal/type-checks.mjs';
8
9
 
9
10
  var __defProp = Object.defineProperty;
10
11
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -17,9 +18,12 @@ var __decorateClass = (decorators, target, key, kind) => {
17
18
  __defProp(target, key, result);
18
19
  return result;
19
20
  };
21
+ let id = 0;
20
22
  class FlowUiSplitViewPane extends FlowRdfElement {
21
23
  constructor() {
22
24
  super(...arguments);
25
+ this.attrId = ++id;
26
+ this.componentId = `flow-ui-split-view-pane-${this.attrId}`;
23
27
  this.vertical = false;
24
28
  this.closed = false;
25
29
  this.divider = false;
@@ -27,6 +31,7 @@ class FlowUiSplitViewPane extends FlowRdfElement {
27
31
  }
28
32
  connectedCallback() {
29
33
  super.connectedCallback();
34
+ this.id = isStringFull(this.id) ? this.id : this.componentId;
30
35
  this.vertical = boolean(this.vertical, true);
31
36
  this.closed = boolean(this.closed, true);
32
37
  this.divider = boolean(this.divider, true);
@@ -3,12 +3,11 @@ import { floorDateTime } from '../../internal/datetime.mjs';
3
3
 
4
4
  const TIMER_INTERVAL = 100;
5
5
  class Ticker {
6
- constructor(tickUnit, tickValue, zone) {
6
+ constructor(tickInterval = { seconds: 5 }, zone) {
7
7
  this.subscribers = [];
8
8
  this.currentDateTime = DateTime.fromMillis(0);
9
9
  this.nextUpdateAt = DateTime.fromMillis(0);
10
- this.tickUnit = tickUnit;
11
- this.tickValue = tickValue;
10
+ this.tickInterval = tickInterval;
12
11
  this.zone = zone;
13
12
  }
14
13
  subscribe(fn) {
@@ -42,9 +41,8 @@ class Ticker {
42
41
  setZone(zone) {
43
42
  this.zone = zone;
44
43
  }
45
- setTick(tickUnit, tickValue) {
46
- this.tickUnit = tickUnit;
47
- this.tickValue = tickValue;
44
+ setTickInterval(tickInterval) {
45
+ this.tickInterval = tickInterval;
48
46
  }
49
47
  /**
50
48
  * Tick the clock
@@ -59,8 +57,10 @@ class Ticker {
59
57
  const now = DateTime.local({ zone: this.zone }).set({ millisecond: 0 });
60
58
  if (now >= this.nextUpdateAt) {
61
59
  this.nextUpdateAt = floorDateTime(now.plus({ second: 1 }), "second", 1);
60
+ const majorStepUnit = Object.keys(this.tickInterval)[0];
61
+ const majorStepValue = this.tickInterval[majorStepUnit];
62
62
  let minorFlooredNow = floorDateTime(now, "second", 1);
63
- const majorFlooredNow = floorDateTime(now, this.tickUnit, this.tickValue);
63
+ const majorFlooredNow = floorDateTime(now, majorStepUnit, majorStepValue);
64
64
  if (forceMajor) {
65
65
  minorFlooredNow = majorFlooredNow;
66
66
  }
@@ -35,6 +35,7 @@ class FlowUiTimer extends FlowRdfElement {
35
35
  this.zoneFormat = "ZZZZ";
36
36
  this.majorStep = "1 minute";
37
37
  this.minorStep = "5 seconds";
38
+ this.updateInterval = "5 seconds";
38
39
  this.hideZone = false;
39
40
  this.placement = "bottom-start";
40
41
  this.debouncedEmitChange = debounce(
@@ -50,7 +51,7 @@ class FlowUiTimer extends FlowRdfElement {
50
51
  super.connectedCallback();
51
52
  this.hideZone = boolean(this.hideZone, true);
52
53
  this.running = boolean(this.running, true);
53
- this.ticker = new Ticker("second", 5, "Europe/London");
54
+ this.ticker = new Ticker({ seconds: 5 }, "Europe/London");
54
55
  this.tickerSubscription = this.ticker.subscribe((dateTime, tickType) => {
55
56
  if (tickType === "major") {
56
57
  this.value = dateTime;
@@ -72,6 +73,10 @@ class FlowUiTimer extends FlowRdfElement {
72
73
  this.minorStepDuration = parseDuration(this.minorStep) ?? { second: 5 };
73
74
  this.majorStepDuration = parseDuration(this.majorStep) ?? { minute: 1 };
74
75
  }
76
+ updateUpdateInterval() {
77
+ const updateIntervalDuration = parseDuration(this.updateInterval) ?? { second: 5 };
78
+ this.ticker.setTickInterval(updateIntervalDuration);
79
+ }
75
80
  updateRunning() {
76
81
  if (this.running) {
77
82
  this.ticker.start();
@@ -113,32 +118,16 @@ class FlowUiTimer extends FlowRdfElement {
113
118
  const minorStepValue = this.minorStepDuration[minorStepUnit];
114
119
  switch (direction) {
115
120
  case "fast-back":
116
- dateTime = ceilDateTime(
117
- this._displayDateTime.minus(this.majorStepDuration),
118
- majorStepUnit,
119
- majorStepValue
120
- );
121
+ dateTime = ceilDateTime(this._displayDateTime.minus(this.majorStepDuration), majorStepUnit, majorStepValue);
121
122
  break;
122
123
  case "back":
123
- dateTime = ceilDateTime(
124
- this._displayDateTime.minus(this.minorStepDuration),
125
- minorStepUnit,
126
- minorStepValue
127
- );
124
+ dateTime = ceilDateTime(this._displayDateTime.minus(this.minorStepDuration), minorStepUnit, minorStepValue);
128
125
  break;
129
126
  case "forward":
130
- dateTime = floorDateTime(
131
- this._displayDateTime.plus(this.minorStepDuration),
132
- minorStepUnit,
133
- minorStepValue
134
- );
127
+ dateTime = floorDateTime(this._displayDateTime.plus(this.minorStepDuration), minorStepUnit, minorStepValue);
135
128
  break;
136
129
  case "fast-forward":
137
- dateTime = floorDateTime(
138
- this._displayDateTime.plus(this.majorStepDuration),
139
- majorStepUnit,
140
- majorStepValue
141
- );
130
+ dateTime = floorDateTime(this._displayDateTime.plus(this.majorStepDuration), majorStepUnit, majorStepValue);
142
131
  break;
143
132
  default:
144
133
  dateTime = this._displayDateTime;
@@ -182,11 +171,17 @@ class FlowUiTimer extends FlowRdfElement {
182
171
  <div class="timer__time-container">
183
172
  <span class="timer__time">${this.formattedDisplayDateTime(this.timeFormat)}</span>
184
173
 
185
- ${!this.hideZone ? html`
186
- <flow-ui-tooltip hoist placement="top" content=${this.formattedDisplayDateTime("ZZZZZ")}>
187
- <span class="timer__zone">${this.formattedDisplayDateTime(this.zoneFormat)}</span>
188
- </flow-ui-tooltip>
189
- ` : nothing}
174
+ ${// Note that flow-ui-show event was causing timer to stop because of dropdown handling of flow-ui-show above
175
+ !this.hideZone ? html`
176
+ <flow-ui-tooltip
177
+ hoist
178
+ placement="top"
179
+ content=${this.formattedDisplayDateTime("ZZZZZ")}
180
+ @flow-ui-show=${(ev) => ev.stopImmediatePropagation()}
181
+ >
182
+ <span class="timer__zone">${this.formattedDisplayDateTime(this.zoneFormat)}</span>
183
+ </flow-ui-tooltip>
184
+ ` : nothing}
190
185
  </div>
191
186
  </div>
192
187
 
@@ -279,6 +274,9 @@ __decorateClass([
279
274
  __decorateClass([
280
275
  property({ attribute: "minor-step" })
281
276
  ], FlowUiTimer.prototype, "minorStep", 2);
277
+ __decorateClass([
278
+ property({ attribute: "update-interval" })
279
+ ], FlowUiTimer.prototype, "updateInterval", 2);
282
280
  __decorateClass([
283
281
  property({ type: Boolean, attribute: "hide-zone" })
284
282
  ], FlowUiTimer.prototype, "hideZone", 2);
@@ -291,6 +289,9 @@ __decorateClass([
291
289
  __decorateClass([
292
290
  watch(["majorStep", "minorStep"])
293
291
  ], FlowUiTimer.prototype, "updateParsedSteps", 1);
292
+ __decorateClass([
293
+ watch(["updateInterval"])
294
+ ], FlowUiTimer.prototype, "updateUpdateInterval", 1);
294
295
  __decorateClass([
295
296
  watch("running")
296
297
  ], FlowUiTimer.prototype, "updateRunning", 1);
@@ -36,6 +36,7 @@ const _FlowUiTreeItem = class _FlowUiTreeItem extends FlowRdfElement {
36
36
  this.disabled = false;
37
37
  this.lazy = false;
38
38
  this.size = "medium";
39
+ this.hidden = false;
39
40
  }
40
41
  /** @internal */
41
42
  static isTreeItem(node) {
@@ -47,6 +48,7 @@ const _FlowUiTreeItem = class _FlowUiTreeItem extends FlowRdfElement {
47
48
  this.selected = boolean(this.selected, true);
48
49
  this.disabled = boolean(this.disabled, true);
49
50
  this.lazy = boolean(this.lazy, true);
51
+ this.hidden = boolean(this.hidden, true);
50
52
  this.setAttribute("role", "treeitem");
51
53
  this.setAttribute("tabindex", "-1");
52
54
  if (this.isNestedItem()) {
@@ -158,6 +160,7 @@ const _FlowUiTreeItem = class _FlowUiTreeItem extends FlowRdfElement {
158
160
  "tree-item--expanded": this.expanded,
159
161
  "tree-item--selected": this.selected,
160
162
  "tree-item--disabled": this.disabled,
163
+ "tree-item--hidden": this.hidden,
161
164
  "tree-item--small": this.size === "small",
162
165
  "tree-item--medium": this.size === "medium",
163
166
  "tree-item--large": this.size === "large",
@@ -272,6 +275,9 @@ __decorateClass([
272
275
  __decorateClass([
273
276
  property({ reflect: true })
274
277
  ], _FlowUiTreeItem.prototype, "size", 2);
278
+ __decorateClass([
279
+ property({ type: Boolean, reflect: true })
280
+ ], _FlowUiTreeItem.prototype, "hidden", 2);
275
281
  __decorateClass([
276
282
  query("slot:not([name])")
277
283
  ], _FlowUiTreeItem.prototype, "defaultSlot", 2);
@@ -106,6 +106,10 @@ const styles = css`
106
106
  display: none;
107
107
  }
108
108
 
109
+ .tree-item.tree-item--hidden {
110
+ display: none;
111
+ }
112
+
109
113
  .tree-item__expand-button--visible {
110
114
  cursor: pointer;
111
115
  }