capibara 1.3.59 → 1.3.61

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capibara",
3
- "version": "1.3.59",
3
+ "version": "1.3.61",
4
4
  "main": "dist/index.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -60,6 +60,44 @@
60
60
  margin: 0.3em 1em;
61
61
  }
62
62
 
63
+ &.is-section-label {
64
+ cursor: unset;
65
+ font-size: 0.7em;
66
+ padding: 0.3em 1em 0.1em;
67
+ text-transform: uppercase;
68
+ letter-spacing: 0.06em;
69
+ &:hover {
70
+ background: none;
71
+ }
72
+ }
73
+
74
+ &.has-children {
75
+ position: relative;
76
+
77
+ .cap-context-menu--submenu {
78
+ display: none;
79
+ position: absolute;
80
+ left: 100%;
81
+ top: 0;
82
+ min-width: 180px;
83
+ z-index: 3;
84
+ font-size: 1em;
85
+ }
86
+
87
+ &:hover {
88
+ > .cap-context-menu--submenu {
89
+ display: block;
90
+ }
91
+ }
92
+ }
93
+
94
+ &_chevron {
95
+ margin-left: auto;
96
+ padding-left: 0.5em;
97
+ font-size: 1.1em;
98
+ opacity: 0.7;
99
+ }
100
+
63
101
  &_icon {
64
102
  display: inline-block;
65
103
  flex: 0 0 auto;
@@ -84,6 +122,17 @@
84
122
  fill: mapGet($theme, color);
85
123
  }
86
124
  }
125
+ .cap-context-menu--submenu {
126
+ color: mapGet($theme, color);
127
+ border-color: mapGet($theme, detailDay, border);
128
+ background: mapGet($theme, detailDay, background);
129
+ }
130
+ .cap-context-menu_item.is-section-label {
131
+ color: rgba(mapGet($theme, color), 0.6);
132
+ }
133
+ .cap-context-menu_item.is-divider {
134
+ border-bottom-color: rgba(mapGet($theme, color), 0.2);
135
+ }
87
136
  }
88
137
  }
89
138
  }
@@ -227,6 +227,19 @@
227
227
  border-color: red red transparent transparent;
228
228
  z-index: 1;
229
229
  }
230
+
231
+ &.has-filter:before {
232
+ content: "";
233
+ display: block;
234
+ position: absolute;
235
+ width: 7px;
236
+ height: 7px;
237
+ left: 2px;
238
+ top: 2px;
239
+ border-radius: 50%;
240
+ background: #43a047;
241
+ z-index: 1;
242
+ }
230
243
  }
231
244
  }
232
245
  }
@@ -781,11 +781,15 @@ export default {
781
781
  let hasAlert = config.timeline.header.dateHasAlert
782
782
  ? config.timeline.header.dateHasAlert(day)
783
783
  : false;
784
+ let hasFilter = config.timeline.header.dateHasFilter
785
+ ? config.timeline.header.dateHasFilter(day)
786
+ : false;
784
787
  let date = dateUtils.formatDate(day.date);
785
- str += `<div class="dia-calendario
788
+ str += `<div class="dia-calendario
786
789
  ${isToday ? "today" : ""}
787
790
  ${isWeekend ? "weekend" : ""}
788
791
  ${hasAlert ? "has-alert" : ""}
792
+ ${hasFilter ? "has-filter" : ""}
789
793
  ${config.timeline.dateSelectable ? "is-clickeable" : ""}
790
794
  ${config.timeline.dateWithContextMenu ? "is-clickeable" : ""}
791
795
  " date="${date}">${keyD}</div>`;
@@ -4658,27 +4662,72 @@ export default {
4658
4662
  optionClassName += "is-divider ";
4659
4663
  }
4660
4664
 
4665
+ if (option.isSectionLabel) {
4666
+ isClickeable = false;
4667
+ optionClassName += "is-section-label ";
4668
+ }
4669
+
4661
4670
  if (option.label) {
4662
- label = `<span>${option.label}</span>`;
4671
+ label = "<span>" + option.label + "</span>";
4663
4672
  }
4664
4673
 
4665
4674
  if (option.icon) {
4666
- strIcon = `<div class="cap-context-menu_item_icon">
4667
- <svg viewBox="0 0 24 24">
4668
- <path d="${option.icon}" />
4669
- </svg>
4670
- </div>`;
4675
+ strIcon = "<div class=\"cap-context-menu_item_icon\"><svg viewBox=\"0 0 24 24\"><path d=\"" + option.icon + "\" /></svg></div>";
4671
4676
  }
4672
4677
 
4673
- let optionStrHtml = `
4674
- <div class="cap-context-menu_item ${optionClassName}">
4675
- ${strIcon}
4676
- ${label}
4677
- </div>`;
4678
+ var resolvedChildren = null;
4679
+ if (option.children) {
4680
+ resolvedChildren = typeof option.children === "function"
4681
+ ? option.children({ config: config, date: date, item: item, selected: selected, tabSelected: tabSelected, target: target })
4682
+ : option.children;
4683
+ }
4684
+
4685
+ var chevron = resolvedChildren && resolvedChildren.length > 0
4686
+ ? "<span class=\"cap-context-menu_item_chevron\">&#8250;</span>"
4687
+ : "";
4688
+
4689
+ var hasChildrenClass = resolvedChildren && resolvedChildren.length > 0 ? "has-children" : "";
4690
+
4691
+ let optionStrHtml = "<div class=\"cap-context-menu_item " + hasChildrenClass + " " + optionClassName + "\">" + strIcon + label + chevron + "</div>";
4678
4692
 
4679
4693
  let $option = dom.createElementFromHTML(optionStrHtml);
4680
4694
 
4681
- if (isEnabled && isClickeable) {
4695
+ if (resolvedChildren && resolvedChildren.length > 0) {
4696
+ var $submenu = document.createElement("div");
4697
+ $submenu.className = "cap-context-menu cap-context-menu--submenu";
4698
+
4699
+ resolvedChildren.forEach(function(child) {
4700
+ var childEnabled = true;
4701
+ if (child.enableIf) {
4702
+ childEnabled = child.enableIf({ config: config, date: date, item: item, selected: selected, tabSelected: tabSelected });
4703
+ }
4704
+ var childClassName = childEnabled ? "" : "is-disabled ";
4705
+ var childIcon = "";
4706
+ var childLabel = child.label ? "<span>" + child.label + "</span>" : "";
4707
+ if (child.icon) {
4708
+ childIcon = "<div class=\"cap-context-menu_item_icon\"><svg viewBox=\"0 0 24 24\"><path d=\"" + child.icon + "\" /></svg></div>";
4709
+ }
4710
+ var childHtml = "<div class=\"cap-context-menu_item " + childClassName + "\">" + childIcon + childLabel + "</div>";
4711
+ var $child = dom.createElementFromHTML(childHtml);
4712
+ if (childEnabled && child.onClick) {
4713
+ (function(c) {
4714
+ $child.addEventListener("click", function(evtClick) {
4715
+ c.onClick({ config: config, evt: evtClick, date: date, item: item, selected: selected, tabSelected: tabSelected, target: target });
4716
+ });
4717
+ })(child);
4718
+ } else {
4719
+ $child.addEventListener("click", function(evtClick) {
4720
+ evtClick.preventDefault();
4721
+ evtClick.stopPropagation();
4722
+ });
4723
+ }
4724
+ $submenu.appendChild($child);
4725
+ });
4726
+
4727
+ $option.appendChild($submenu);
4728
+ }
4729
+
4730
+ if (isEnabled && isClickeable && !(resolvedChildren && resolvedChildren.length > 0)) {
4682
4731
  $option.addEventListener("click", (evtClick) =>
4683
4732
  option.onClick({
4684
4733
  config,
@@ -4690,7 +4739,7 @@ export default {
4690
4739
  target,
4691
4740
  })
4692
4741
  );
4693
- } else {
4742
+ } else if (!(resolvedChildren && resolvedChildren.length > 0)) {
4694
4743
  $option.addEventListener("click", (evtClick) => {
4695
4744
  evtClick.preventDefault();
4696
4745
  evtClick.stopPropagation();