@social-mail/social-mail-client 1.0.55 → 1.0.56

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.
@@ -22859,7 +22859,6 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
22859
22859
 
22860
22860
  display: flex;
22861
22861
  flex-direction: column;
22862
- gap: 5px;
22863
22862
 
22864
22863
  & [data-layout=tree-view-item] {
22865
22864
 
@@ -22868,11 +22867,9 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
22868
22867
  grid-template-rows: auto auto;
22869
22868
  align-items: center;
22870
22869
 
22871
- &[data-selected] {
22872
- & > [data-element=label] {
22873
- background-color: Highlight;
22874
- color: HighlightText;
22875
- }
22870
+ &:hover {
22871
+ background-color: var(--hover-color);
22872
+ color: var(--hover-text-color);
22876
22873
  }
22877
22874
 
22878
22875
  & > [data-element=action] {
@@ -22883,9 +22880,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
22883
22880
  & > [data-element=label] {
22884
22881
  grid-row: 1;
22885
22882
  grid-column: 2;
22886
- padding: 2px;
22887
- padding-left: 5px;
22888
- padding-right: 5px;
22883
+ padding: 5px;
22889
22884
  max-width: 200px;
22890
22885
  white-space: nowrap;
22891
22886
  text-overflow: ellipsis;
@@ -22893,6 +22888,11 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
22893
22888
  cursor: pointer;
22894
22889
  }
22895
22890
 
22891
+ &[data-selected] {
22892
+ background-color: var(--selection-color);
22893
+ color: var(--selection-text-color);
22894
+ }
22895
+
22896
22896
  & > [data-element=expand-collapse] {
22897
22897
 
22898
22898
  grid-row: 1;
@@ -22905,15 +22905,6 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
22905
22905
  }
22906
22906
  }
22907
22907
 
22908
- & > [data-element=children] {
22909
-
22910
- display: none;
22911
- padding: 5px;
22912
- grid-row: 2;
22913
- grid-column: 1 / span 2;
22914
- padding-left: 10px;
22915
- }
22916
-
22917
22908
  &[data-expanded] {
22918
22909
 
22919
22910
  & > [data-element=expand-collapse] {
@@ -22986,7 +22977,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
22986
22977
  rootElement === null || rootElement === void 0 ? void 0 : rootElement.dispose();
22987
22978
  if (this.root && this.childrenProperty && this.labelRenderer && this.collapseIconRenderer) {
22988
22979
  this.element.innerHTML = "";
22989
- this.createElement(this.element, this.root, -1);
22980
+ this.createElement(this.root, void 0, -1);
22990
22981
  this.expand(this.root);
22991
22982
  if (this.selectedItem) {
22992
22983
  this.selectItem(this.selectedItem);
@@ -23026,7 +23017,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
23026
23017
  this.runAfterInit(() => {
23027
23018
  if (this.root && !this.element.firstElementChild) {
23028
23019
  if (this.childrenProperty) {
23029
- this.createElement(this.element, this.root);
23020
+ this.createElement(this.root);
23030
23021
  this.expand(this.root);
23031
23022
  }
23032
23023
  if (this.selectedItem) {
@@ -23055,6 +23046,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
23055
23046
  bubbles: true,
23056
23047
  cancelable: true
23057
23048
  }));
23049
+ this.updateExpanded();
23058
23050
  }
23059
23051
  } else {
23060
23052
  element.setAttribute("data-expanded", "true");
@@ -23063,75 +23055,111 @@ System.register(["tslib", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/di
23063
23055
  bubbles: true,
23064
23056
  cancelable: true
23065
23057
  }));
23058
+ this.updateExpanded();
23066
23059
  }
23067
23060
  }
23068
23061
  }
23069
- createElement(parent, item, insertIndex = -1) {
23062
+ createElement(item, parentItem, insertIndex = -1) {
23070
23063
  var _a, _b, _c, _d, _e, _f;
23071
23064
  const element = document.createElement("div");
23072
23065
  element.setAttribute("data-layout", "tree-view-item");
23073
23066
  element.dataItem = item;
23074
- element.parentItem = ((_a = parent.parentElement) !== null && _a !== void 0 ? _a : parent).dataItem;
23067
+ element.parentItem = parentItem;
23075
23068
  this.map.set(item, element);
23076
23069
  const children = this.childrenProperty(item);
23077
23070
  if (!children) {
23078
23071
  throw new Error("Children array must not be empty");
23079
23072
  }
23080
- const childrenElement = document.createElement("div");
23081
- childrenElement.setAttribute("data-element", "children");
23082
- element.appendChild(childrenElement);
23083
23073
  const watcher = children.watch((target, event, index, child) => {
23074
+ var _a;
23084
23075
  if (event === "add" || event === "set") {
23085
- this.createElement(childrenElement, child, index);
23076
+ this.createElement(child, item, index);
23086
23077
  return;
23087
23078
  }
23088
23079
  if (event === "remove") {
23089
- for (const iterator of Array.from(childrenElement.children)) {
23090
- if (iterator.dataItem === child) {
23091
- iterator.remove();
23092
- return;
23093
- }
23094
- }
23080
+ const childElement = this.map.get(child);
23081
+ childElement === null || childElement === void 0 ? void 0 : childElement.dispose();
23082
+ return;
23095
23083
  }
23096
- for (const iterator of Array.from(childrenElement.children)) {
23097
- iterator === null || iterator === void 0 ? void 0 : iterator.dispose();
23084
+ for (const iterator of children) {
23085
+ (_a = this.map.get(iterator)) === null || _a === void 0 ? void 0 : _a.dispose();
23098
23086
  }
23099
23087
  for (const iterator of children) {
23100
- this.createElement(element, iterator);
23088
+ this.createElement(iterator, item);
23101
23089
  }
23102
23090
  });
23103
23091
  element.dispose = () => {
23092
+ var _a;
23104
23093
  watcher.dispose();
23105
- for (const iterator of Array.from(childrenElement.children)) {
23106
- iterator === null || iterator === void 0 ? void 0 : iterator.dispose();
23094
+ for (const iterator of children) {
23095
+ (_a = this.map.get(iterator)) === null || _a === void 0 ? void 0 : _a.dispose();
23107
23096
  }
23108
23097
  element.remove();
23109
23098
  };
23110
- const actionElement = (_b = this.actionRenderer) === null || _b === void 0 ? void 0 : _b.call(this, item);
23099
+ const actionElement = (_a = this.actionRenderer) === null || _a === void 0 ? void 0 : _a.call(this, item);
23111
23100
  const collapseElement = this.collapseIconRenderer(item);
23112
23101
  const labelElement = this.labelRenderer(item);
23113
23102
  if (labelElement) {
23114
- const a = (_c = labelElement.attributes) !== null && _c !== void 0 ? _c : labelElement.attributes = {};
23103
+ const a = (_b = labelElement.attributes) !== null && _b !== void 0 ? _b : labelElement.attributes = {};
23115
23104
  a["data-element"] = "label";
23116
- (_d = a["data-click-event"]) !== null && _d !== void 0 ? _d : a["data-click-event"] = "select-item";
23105
+ (_c = a["data-click-event"]) !== null && _c !== void 0 ? _c : a["data-click-event"] = "select-item";
23117
23106
  this.render(XNode.create("div", null, labelElement), element, this);
23118
23107
  }
23119
23108
  if (actionElement) {
23120
- ((_e = actionElement.attributes) !== null && _e !== void 0 ? _e : actionElement.attributes = {})["data-element"] = "action";
23109
+ ((_d = actionElement.attributes) !== null && _d !== void 0 ? _d : actionElement.attributes = {})["data-element"] = "action";
23121
23110
  this.render(XNode.create("div", null, actionElement), element, this);
23122
23111
  }
23123
23112
  if (collapseElement) {
23124
- const a = (_f = collapseElement.attributes) !== null && _f !== void 0 ? _f : collapseElement.attributes = {};
23113
+ const a = (_e = collapseElement.attributes) !== null && _e !== void 0 ? _e : collapseElement.attributes = {};
23125
23114
  a["data-element"] = "expand-collapse";
23126
23115
  a["data-click-event"] = "toggle-expand";
23127
23116
  this.render(XNode.create("div", null, collapseElement), element, this);
23128
23117
  }
23118
+ const header = document.createElement("div");
23119
+ header.setAttribute("data-element", "header");
23120
+ element.appendChild(header);
23121
+ const parentElement = this.map.get(parentItem);
23122
+ let last = parentElement;
23123
+ if (parentItem) {
23124
+ const siblings = this.childrenProperty(parentItem);
23125
+ if (insertIndex === -1) {
23126
+ insertIndex = siblings.indexOf(item);
23127
+ }
23128
+ if (insertIndex >= 1) {
23129
+ last = this.map.get(siblings[insertIndex - 1]);
23130
+ }
23131
+ last.insertAdjacentElement("afterend", element);
23132
+ const pad = Number((_f = parentElement.getAttribute("data-pad")) !== null && _f !== void 0 ? _f : "0") + 10;
23133
+ element.setAttribute("data-pad", `${pad}`);
23134
+ element.style.paddingLeft = `${pad}px`;
23135
+ } else {
23136
+ this.element.appendChild(element);
23137
+ this.expandElement(element, false);
23138
+ }
23129
23139
  for (const iterator of children) {
23130
- this.createElement(childrenElement, iterator);
23140
+ this.createElement(iterator, item);
23131
23141
  }
23132
- parent.appendChild(element);
23142
+ setTimeout(() => this.updateExpanded(), 1);
23133
23143
  return element;
23134
23144
  }
23145
+ updateExpanded(item = this.root, show) {
23146
+ item !== null && item !== void 0 ? item : item = this.root;
23147
+ const element = this.map.get(item);
23148
+ if (!element) {
23149
+ return;
23150
+ }
23151
+ show !== null && show !== void 0 ? show : show = item === this.root || element.getAttribute("data-expanded") === "true";
23152
+ if (show) {
23153
+ element.style.display = "";
23154
+ } else {
23155
+ element.style.display = "none";
23156
+ }
23157
+ const children = this.childrenProperty(element.dataItem);
23158
+ show && (show = element.getAttribute("data-expanded") === "true");
23159
+ for (const iterator of children) {
23160
+ this.updateExpanded(iterator, show);
23161
+ }
23162
+ }
23135
23163
  });
23136
23164
  __decorate([BindableProperty, __metadata("design:type", Object)], TreeView.prototype, "root", void 0);
23137
23165
  __decorate([BindableProperty, __metadata("design:type", Object)], TreeView.prototype, "selectedItem", void 0);