jsuites 6.0.3 → 6.1.1

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/jsuites.css CHANGED
@@ -3521,11 +3521,6 @@ body.lm-dark-mode {
3521
3521
  gap: 1px;
3522
3522
  }
3523
3523
 
3524
- .lm-calendar-navigation i:hover {
3525
- background-color: var(--lm-background-color-highlight, #ebebeb);
3526
- color: #000;
3527
- }
3528
-
3529
3524
  .lm-calendar-weekdays {
3530
3525
  display: none;
3531
3526
  grid-template-columns: repeat(7, 1fr);
@@ -3638,7 +3633,6 @@ body.lm-dark-mode {
3638
3633
  top: calc(25%);
3639
3634
  height: 50%;
3640
3635
  background-color: var(--lm-main-color-alpha, #2196f388);
3641
- z-index: -1;
3642
3636
  }
3643
3637
 
3644
3638
  .lm-calendar-content > div[data-start="true"]::before {
@@ -3695,7 +3689,7 @@ body.lm-dark-mode {
3695
3689
  .lm-calendar-input {
3696
3690
  padding-right: 24px !important;
3697
3691
  box-sizing: border-box;
3698
- background: url("data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 -960 960 960\" width=\"24\"><path d=\"M200-80q-33 0-56.5-23.5T120-160v-560q0-33 23.5-56.5T200-800h40v-80h80v80h320v-80h80v80h40q33 0 56.5 23.5T840-720v560q0 33-23.5 56.5T760-80H200Zm0-80h560v-400H200v400Zm0-480h560v-80H200v80Zm0 0v-80 80Zm280 240q-17 0-28.5-11.5T440-440q0-17 11.5-28.5T480-480q17 0 28.5 11.5T520-440q0 17-11.5 28.5T480-400Zm-160 0q-17 0-28.5-11.5T280-440q0-17 11.5-28.5T320-480q17 0 28.5 11.5T360-440q0 17-11.5 28.5T320-400Zm320 0q-17 0-28.5-11.5T600-440q0-17 11.5-28.5T640-480q17 0 28.5 11.5T680-440q0 17-11.5 28.5T640-400ZM480-240q-17 0-28.5-11.5T440-280q0-17 11.5-28.5T480-320q17 0 28.5 11.5T520-280q0 17-11.5 28.5T480-240Zm-160 0q-17 0-28.5-11.5T280-280q0-17 11.5-28.5T320-320q17 0 28.5 11.5T360-280q0 17-11.5 28.5T320-240Zm320 0q-17 0-28.5-11.5T600-280q0-17 11.5-28.5T640-320q17 0 28.5 11.5T680-280q0 17-11.5 28.5T640-240Z\" fill=\"gray\" /></svg>") top 50% right 1px no-repeat;
3692
+ background: url("data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24\" viewBox=\"0 -960 960 960\" width=\"24\"><path d=\"M200-80q-33 0-56.5-23.5T120-160v-560q0-33 23.5-56.5T200-800h40v-80h80v80h320v-80h80v80h40q33 0 56.5 23.5T840-720v560q0 33-23.5 56.5T760-80H200Zm0-80h560v-400H200v400Zm0-480h560v-80H200v80Zm0 0v-80 80Zm280 240q-17 0-28.5-11.5T440-440q0-17 11.5-28.5T480-480q17 0 28.5 11.5T520-440q0 17-11.5 28.5T480-400Zm-160 0q-17 0-28.5-11.5T280-440q0-17 11.5-28.5T320-480q17 0 28.5 11.5T360-440q0 17-11.5 28.5T320-400Zm320 0q-17 0-28.5-11.5T600-440q0-17 11.5-28.5T640-480q17 0 28.5 11.5T680-440q0 17-11.5 28.5T640-400ZM480-240q-17 0-28.5-11.5T440-280q0-17 11.5-28.5T480-320q17 0 28.5 11.5T520-280q0 17-11.5 28.5T480-240Zm-160 0q-17 0-28.5-11.5T280-280q0-17 11.5-28.5T320-320q17 0 28.5 11.5T360-280q0 17-11.5 28.5T320-240Zm320 0q-17 0-28.5-11.5T600-280q0-17 11.5-28.5T640-320q17 0 28.5 11.5T680-280q0 17-11.5 28.5T640-240Z\" fill=\"gray\" /></svg>") top 50% right 5px no-repeat;
3699
3693
  }
3700
3694
 
3701
3695
  .lm-calendar-time[data-visible="false"] {
@@ -4077,6 +4071,10 @@ body.lm-dark-mode {
4077
4071
  border: 1px solid var(--lm-border-color, #767676);
4078
4072
  border-radius: var(--lm-border-radius, 2px);
4079
4073
  position: relative;
4074
+ line-height: normal;
4075
+ display: flex;
4076
+ align-items: center;
4077
+ font: inherit;
4080
4078
  }
4081
4079
 
4082
4080
  .lm-dropdown-input > br {
package/dist/jsuites.js CHANGED
@@ -4579,8 +4579,6 @@ const Mask = utils.Mask;
4579
4579
  // Back to the days
4580
4580
  self.view = 'days';
4581
4581
  } else if (! s.disabled) {
4582
- setCursor(s);
4583
-
4584
4582
  if (isTrue(self.range)) {
4585
4583
  // Start a new range
4586
4584
  if (self.rangeValues && (self.rangeValues[0] >= s.number || self.rangeValues[1])) {
@@ -4596,7 +4594,10 @@ const Mask = utils.Mask;
4596
4594
  s.end = true;
4597
4595
  self.rangeValues[1] = s.number;
4598
4596
  }
4597
+ setCursor(s);
4599
4598
  } else {
4599
+ setCursor(s);
4600
+
4600
4601
  update();
4601
4602
  }
4602
4603
  }
@@ -6712,7 +6713,13 @@ if (!Modal && "function" === 'function') {
6712
6713
 
6713
6714
  if (Array.isArray(data)) {
6714
6715
  data.map(function (s) {
6715
- s.selected = newValue.some(v => v == s.value);
6716
+ s.selected = newValue.some(v => {
6717
+ // Use strict equality when either value is empty string to avoid '' == 0 being true
6718
+ if (v === '' || s.value === '') {
6719
+ return v === s.value;
6720
+ }
6721
+ return v == s.value;
6722
+ });
6716
6723
  if (s.selected) {
6717
6724
  value.push(s);
6718
6725
  }
@@ -6747,6 +6754,20 @@ if (!Modal && "function" === 'function') {
6747
6754
  return null;
6748
6755
  }
6749
6756
 
6757
+ const getText = function () {
6758
+ if (self.multiple) {
6759
+ if (value && value.length) {
6760
+ return value.filter(v => v.selected).map(i => i.text);
6761
+ }
6762
+ } else {
6763
+ if (value && value.length) {
6764
+ return value[0].text;
6765
+ }
6766
+ }
6767
+
6768
+ return null;
6769
+ }
6770
+
6750
6771
  const onopen = function () {
6751
6772
  self.state = true;
6752
6773
  // Value
@@ -6917,7 +6938,11 @@ if (!Modal && "function" === 'function') {
6917
6938
 
6918
6939
  // Debounce the search with 300ms delay
6919
6940
  searchTimeout = setTimeout(() => {
6920
- fetch(`${self.url}?q=${query}`, http).then(r => r.json()).then(resetData).catch((error) => {
6941
+ let url = self.url;
6942
+ url += url.indexOf('?') === -1 ? '?' : '&';
6943
+ url += `q=${query}`;
6944
+
6945
+ fetch(url, http).then(r => r.json()).then(resetData).catch((error) => {
6921
6946
  resetData([]);
6922
6947
  });
6923
6948
  }, 300);
@@ -7197,6 +7222,10 @@ if (!Modal && "function" === 'function') {
7197
7222
  return self.value;
7198
7223
  }
7199
7224
 
7225
+ self.getText = function() {
7226
+ return getText();
7227
+ }
7228
+
7200
7229
  self.setValue = function(v) {
7201
7230
  self.value = v;
7202
7231
  }
@@ -7795,7 +7824,7 @@ if (!lemonade && "function" === 'function') {
7795
7824
  }
7796
7825
  }
7797
7826
 
7798
- const Modal = function (template, { onchange, onload }) {
7827
+ const Modal = function (template, { onchange, onload, track }) {
7799
7828
  let self = this;
7800
7829
  let backdrop = null;
7801
7830
  let elements = null;
@@ -8200,7 +8229,12 @@ if (!lemonade && "function" === 'function') {
8200
8229
  }
8201
8230
  });
8202
8231
 
8203
- return render => render`<div class="lm-modal" animation="{{self.animation}}" position="{{self.position}}" closed="{{self.closed}}" closable="{{self.closable}}" minimizable="{{self.minimizable}}" minimized="{{self.minimized}}" overflow="{{self.overflow}}" :top="self.top" :left="self.left" :width="self.width" :height="self.height" tabindex="-1" role="modal" onmousedown="${mousedown}" onmousemove="${mousemove}" onclick="${click}">
8232
+ track('top');
8233
+ track('left');
8234
+ track('width');
8235
+ track('height');
8236
+
8237
+ return render => render`<div class="lm-modal" animation="{{self.animation}}" position="{{self.position}}" closed="{{self.closed}}" closable="{{self.closable}}" minimizable="{{self.minimizable}}" minimized="{{self.minimized}}" overflow="{{self.overflow}}" tabindex="-1" role="modal" onmousedown="${mousedown}" onmousemove="${mousemove}" onclick="${click}">
8204
8238
  <div class="lm-modal-title" data-title="{{self.title}}" data-icon="{{self.icon}}"><div class="lm-modal-icon">{{self.icon}}</div><div>{{self.title}}</div><div class="lm-modal-icon lm-modal-minimize" tabindex="0"></div><div class="lm-modal-icon lm-modal-close" tabindex="0"></div></div>
8205
8239
  <div :ref="self.root">${template}</div>
8206
8240
  </div>`
@@ -10202,13 +10236,12 @@ if (! Contextmenu && "function" === 'function') {
10202
10236
 
10203
10237
  // Event property to the element
10204
10238
  event = () => {
10205
- let value = getAttribute(getElement(item), 'value');
10206
- if (lemon.self[prop] !== value) {
10207
- setAttribute(getElement(item), 'value', lemon.self[prop]);
10208
- }
10239
+ setAttribute(getElement(item), 'value', lemon.self[prop]);
10209
10240
  }
10210
10241
  // Append event
10211
10242
  appendEvent(prop, event, true);
10243
+ } else if (prop.value instanceof state) {
10244
+ // TODO: implement :bind states
10212
10245
  }
10213
10246
  }
10214
10247
 
@@ -10372,6 +10405,8 @@ if (! Contextmenu && "function" === 'function') {
10372
10405
  } else {
10373
10406
  // Register parent
10374
10407
  register(self, 'parent', lemon.self);
10408
+ // Pass parent view for expressions in loop templates
10409
+ item.parentView = lemon.view;
10375
10410
  // Render
10376
10411
  L.render(method, root, self, item);
10377
10412
  }
@@ -10634,76 +10669,81 @@ if (! Contextmenu && "function" === 'function') {
10634
10669
  item.props = reorderProps(item.props);
10635
10670
  // Order by priority
10636
10671
  item.props.forEach(function(prop) {
10637
- // If the property is an event
10638
- let event = getAttributeEvent(prop.name);
10639
- // When event for a DOM
10640
- if (event) {
10641
- // Element
10642
- let element = item.element;
10643
- // Value
10644
- let value = prop.value;
10645
- if (value) {
10646
- let handler = null; // Reset handler for each iteration
10647
- if (typeof (value) === 'function') {
10648
- handler = value;
10649
- } else {
10650
- let t = extractFromPath.call(lemon.self, value);
10651
- if (t) {
10652
- if (typeof (t) === 'function') {
10653
- prop.value = handler = t;
10654
- }
10655
- }
10656
- }
10657
- // When the element is a DOM
10658
- if (isDOM(element)) {
10659
- // Create the event handler
10660
- let eventHandler;
10661
- // Bind event
10662
- if (typeof(handler) === 'function') {
10663
- eventHandler = function(e, a, b) {
10664
- return handler.call(element, e, lemon.self, a, b);
10665
- }
10672
+ try {
10673
+ // If the property is an event
10674
+ let event = getAttributeEvent(prop.name);
10675
+ // When event for a DOM
10676
+ if (event) {
10677
+ // Element
10678
+ let element = item.element;
10679
+ // Value
10680
+ let value = prop.value;
10681
+ if (value) {
10682
+ let handler = null; // Reset handler for each iteration
10683
+ if (typeof (value) === 'function') {
10684
+ handler = value;
10666
10685
  } else {
10667
- // Legacy compatibility. Inline scripting is non-Compliance with Content Security Policy (CSP).
10668
- eventHandler = function (e) {
10669
- return Function('e', 'self', value).call(element, e, lemon.self); // TODO, quebra tudo se mudar
10686
+ let t = extractFromPath.call(lemon.self, value);
10687
+ if (t) {
10688
+ if (typeof (t) === 'function') {
10689
+ prop.value = handler = t;
10690
+ }
10670
10691
  }
10671
10692
  }
10693
+ // When the element is a DOM
10694
+ if (isDOM(element)) {
10695
+ // Create the event handler
10696
+ let eventHandler;
10697
+ // Bind event
10698
+ if (typeof(handler) === 'function') {
10699
+ eventHandler = function(e, a, b) {
10700
+ return handler.call(element, e, lemon.self, a, b);
10701
+ }
10702
+ } else {
10703
+ // Legacy compatibility. Inline scripting is non-Compliance with Content Security Policy (CSP).
10704
+ eventHandler = function (e) {
10705
+ return Function('e', 'self', value).call(element, e, lemon.self); // TODO, quebra tudo se mudar
10706
+ }
10707
+ }
10672
10708
 
10673
- if (isValidEventName(element, prop.name)) {
10674
- element.addEventListener(event.substring(2), eventHandler);
10675
- } else {
10676
- if (element.tagName?.includes('-')) {
10677
- element[event] = handler;
10709
+ if (isValidEventName(element, prop.name)) {
10710
+ element.addEventListener(event.substring(2), eventHandler);
10678
10711
  } else {
10679
- element[event] = eventHandler;
10712
+ if (element.tagName?.includes('-')) {
10713
+ element[event] = handler;
10714
+ } else {
10715
+ element[event] = eventHandler;
10716
+ }
10680
10717
  }
10718
+ } else {
10719
+ item.self[event] = handler || value;
10681
10720
  }
10721
+ }
10722
+ } else if (prop.name.startsWith(':') || prop.name.startsWith('@') || prop.name.startsWith('lm-')) {
10723
+ // Special lemonade attribute name
10724
+ let attrName = getAttributeName(prop.name);
10725
+ // Special properties bound to the self
10726
+ if (attrName === 'ready') {
10727
+ whenIsReady(item, prop);
10728
+ } else if (attrName === 'ref') {
10729
+ createReference(item, prop);
10730
+ } else if (attrName === 'loop') {
10731
+ registerLoop(item, prop);
10732
+ } else if (attrName === 'bind') {
10733
+ applyBindHandler(item, prop);
10734
+ } else if (attrName === 'path') {
10735
+ registerPath(item, prop);
10736
+ } else if (attrName === 'render') {
10737
+ applyRenderHandler(item, prop);
10682
10738
  } else {
10683
- item.self[event] = handler || value;
10739
+ setDynamicValue(item, prop, attrName);
10684
10740
  }
10685
- }
10686
- } else if (prop.name.startsWith(':') || prop.name.startsWith('@') || prop.name.startsWith('lm-')) {
10687
- // Special lemonade attribute name
10688
- let attrName = getAttributeName(prop.name);
10689
- // Special properties bound to the self
10690
- if (attrName === 'ready') {
10691
- whenIsReady(item, prop);
10692
- } else if (attrName === 'ref') {
10693
- createReference(item, prop);
10694
- } else if (attrName === 'loop') {
10695
- registerLoop(item, prop);
10696
- } else if (attrName === 'bind') {
10697
- applyBindHandler(item, prop);
10698
- } else if (attrName === 'path') {
10699
- registerPath(item, prop);
10700
- } else if (attrName === 'render') {
10701
- applyRenderHandler(item, prop);
10702
10741
  } else {
10703
- setDynamicValue(item, prop, attrName);
10742
+ applyElementAttribute(item, prop);
10704
10743
  }
10705
- } else {
10706
- applyElementAttribute(item, prop);
10744
+ } catch (e) {
10745
+ let propValue = prop.expression || prop.value;
10746
+ console.error(`${prop.name}="${propValue}" - ${e.message}`, item);
10707
10747
  }
10708
10748
  })
10709
10749
  }
@@ -11065,7 +11105,7 @@ if (! Contextmenu && "function" === 'function') {
11065
11105
  self: self,
11066
11106
  ready: [],
11067
11107
  change: [],
11068
- events: [],
11108
+ events: {},
11069
11109
  components: {},
11070
11110
  elements: [],
11071
11111
  root: root,
@@ -11090,6 +11130,10 @@ if (! Contextmenu && "function" === 'function') {
11090
11130
  // New self
11091
11131
  if (component === Basic) {
11092
11132
  view = cloneChildren(item.children[0]);
11133
+
11134
+ if (item.parentView) {
11135
+ lemon.view = item.parentView;
11136
+ }
11093
11137
  } else {
11094
11138
  R.currentLemon = lemon;
11095
11139
 
@@ -11266,7 +11310,10 @@ if (! Contextmenu && "function" === 'function') {
11266
11310
  let props = Object.keys(lemon.events);
11267
11311
  if (props.length) {
11268
11312
  for (let i = 0; i <props.length; i++) {
11269
- trackProperty(lemon, props[i]);
11313
+ let prop = props[i];
11314
+ if (prop != Number(prop)) {
11315
+ trackProperty(lemon, prop);
11316
+ }
11270
11317
  }
11271
11318
  }
11272
11319
  }
@@ -11537,6 +11584,8 @@ if (! Contextmenu && "function" === 'function') {
11537
11584
  for (let i = 0; i < elements.length; i++) {
11538
11585
  let v = Path.call(newValue, elements[i].path)
11539
11586
  setAttribute(elements[i].element, 'value', v);
11587
+ // Also sync value to the data object (use '' for undefined to match form behavior)
11588
+ Path.call(lemon.path.value, elements[i].path, v !== undefined ? v : '');
11540
11589
  }
11541
11590
  }
11542
11591
  }
@@ -22973,7 +23022,7 @@ var jSuites = {
22973
23022
  ...dictionary,
22974
23023
  ...helpers,
22975
23024
  /** Current version */
22976
- version: '6.0.1',
23025
+ version: '6.1.1',
22977
23026
  /** Bind new extensions to Jsuites */
22978
23027
  setExtensions: function(o) {
22979
23028
  if (typeof(o) == 'object') {
package/package.json CHANGED
@@ -26,18 +26,18 @@
26
26
  },
27
27
  "main": "dist/jsuites.js",
28
28
  "types": "dist/jsuites.d.ts",
29
- "version": "6.0.3",
29
+ "version": "6.1.1",
30
30
  "bugs": "https://github.com/jsuites/jsuites/issues",
31
31
  "homepage": "https://github.com/jsuites/jsuites",
32
32
  "docs": "https://jsuites.net",
33
33
  "download": "https://github.com/jsuites/jsuites/archive/master.zip",
34
34
  "dependencies": {
35
35
  "@jsuites/utils": "^6.0.3",
36
- "@lemonadejs/calendar": "^5.8.0",
36
+ "@lemonadejs/calendar": "^5.8.3",
37
37
  "@lemonadejs/color": "^5.8.0",
38
38
  "@lemonadejs/contextmenu": "^5.8.0",
39
- "@lemonadejs/dropdown": "^5.8.0",
40
- "@lemonadejs/modal": "^5.8.0",
39
+ "@lemonadejs/dropdown": "^5.8.1",
40
+ "@lemonadejs/modal": "^5.8.1",
41
41
  "@lemonadejs/rating": "^5.8.1",
42
42
  "@lemonadejs/switch": "^5.8.0",
43
43
  "@lemonadejs/tabs": "^5.8.0",