@startinblox/core 0.19.21-beta.2 → 0.19.22-beta.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.
@@ -1526,6 +1526,32 @@ const compare = {
1526
1526
  return ret;
1527
1527
  }
1528
1528
  };
1529
+ function generalComparator(a, b, order = "asc") {
1530
+ let comparison = 0;
1531
+ if (typeof a === "boolean" && typeof b === "boolean") {
1532
+ comparison = a === b ? 0 : a ? 1 : -1;
1533
+ } else if (!isNaN(a) && !isNaN(b)) {
1534
+ comparison = Number(a) - Number(b);
1535
+ } else if (Array.isArray(a) && Array.isArray(b)) {
1536
+ comparison = a.length - b.length;
1537
+ } else if (!isNaN(Date.parse(a)) && !isNaN(Date.parse(b))) {
1538
+ const dateA = new Date(a);
1539
+ const dateB = new Date(a);
1540
+ comparison = dateA.getTime() - dateB.getTime();
1541
+ } else if (typeof a === "object" && typeof b === "object") {
1542
+ const aKeys = Object.keys(a);
1543
+ const bKeys = Object.keys(b);
1544
+ comparison = aKeys.length - bKeys.length;
1545
+ } else if (a == null || b == null) {
1546
+ comparison = a == null ? b == null ? 0 : -1 : b == null ? 1 : 0;
1547
+ } else {
1548
+ comparison = a.toString().localeCompare(b.toString());
1549
+ }
1550
+ if (order === "desc") {
1551
+ comparison = comparison * -1;
1552
+ }
1553
+ return comparison;
1554
+ }
1529
1555
  function transformArrayToContainer(resource) {
1530
1556
  const newValue = { ...resource };
1531
1557
  for (let predicate of Object.keys(newValue)) {
@@ -1631,6 +1657,7 @@ const helpers = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
1631
1657
  evalTemplateString,
1632
1658
  findClosingBracketMatchIndex,
1633
1659
  fuzzyCompare,
1660
+ generalComparator,
1634
1661
  importCSS,
1635
1662
  importInlineCSS,
1636
1663
  importJS,
@@ -1649,14 +1676,15 @@ export {
1649
1676
  defineComponent as d,
1650
1677
  evalTemplateString as e,
1651
1678
  fuzzyCompare as f,
1652
- importCSS as g,
1679
+ generalComparator as g,
1653
1680
  helpers as h,
1654
1681
  importInlineCSS as i,
1655
- importJS as j,
1656
- domIsReady as k,
1682
+ importCSS as j,
1683
+ importJS as k,
1657
1684
  loadScript as l,
1658
- asyncQuerySelector as m,
1659
- asyncQuerySelectorAll as n,
1685
+ domIsReady as m,
1686
+ asyncQuerySelector as n,
1687
+ asyncQuerySelectorAll as o,
1660
1688
  parseFieldsString as p,
1661
1689
  setDeepProperty as s,
1662
1690
  transformArrayToContainer as t,
package/dist/helpers.js CHANGED
@@ -1,18 +1,19 @@
1
- import { A, m, n, c, A as A2, d, k, e, a, f, g, i, j, l, p, s, b, t, u } from "./helpers-4tVqSOBU.js";
1
+ import { A, n, o, c, A as A2, d, m, e, a, f, g, j, i, k, l, p, s, b, t, u } from "./helpers-Fl7SPUjU.js";
2
2
  export {
3
3
  A as AsyncIterableBuilder,
4
- m as asyncQuerySelector,
5
- n as asyncQuerySelectorAll,
4
+ n as asyncQuerySelector,
5
+ o as asyncQuerySelectorAll,
6
6
  c as compare,
7
7
  A2 as default,
8
8
  d as defineComponent,
9
- k as domIsReady,
9
+ m as domIsReady,
10
10
  e as evalTemplateString,
11
11
  a as findClosingBracketMatchIndex,
12
12
  f as fuzzyCompare,
13
- g as importCSS,
13
+ g as generalComparator,
14
+ j as importCSS,
14
15
  i as importInlineCSS,
15
- j as importJS,
16
+ k as importJS,
16
17
  l as loadScript,
17
18
  p as parseFieldsString,
18
19
  s as setDeepProperty,
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { d as defineComponent, u as uniqID, i as importInlineCSS, f as fuzzyCompare, p as parseFieldsString, a as findClosingBracketMatchIndex, c as compare, e as evalTemplateString, s as setDeepProperty, t as transformArrayToContainer } from "./helpers-4tVqSOBU.js";
2
- import { h } from "./helpers-4tVqSOBU.js";
1
+ import { d as defineComponent, u as uniqID, i as importInlineCSS, f as fuzzyCompare, p as parseFieldsString, a as findClosingBracketMatchIndex, c as compare, e as evalTemplateString, g as generalComparator, s as setDeepProperty, t as transformArrayToContainer } from "./helpers-Fl7SPUjU.js";
2
+ import { h } from "./helpers-Fl7SPUjU.js";
3
3
  import PubSub$1 from "https://cdn.skypack.dev/pubsub-js";
4
4
  import L from "https://cdn.skypack.dev/leaflet";
5
5
  import "https://cdn.skypack.dev/leaflet.markercluster";
@@ -52180,6 +52180,14 @@ const GrouperMixin = {
52180
52180
  groupClass: {
52181
52181
  type: String,
52182
52182
  default: ""
52183
+ },
52184
+ orderGroupAsc: {
52185
+ type: Boolean,
52186
+ default: null
52187
+ },
52188
+ orderGroupDesc: {
52189
+ type: Boolean,
52190
+ default: null
52183
52191
  }
52184
52192
  },
52185
52193
  attached() {
@@ -52197,7 +52205,14 @@ const GrouperMixin = {
52197
52205
  groups[valueGroup] = { resources: [] };
52198
52206
  groups[valueGroup].resources.push(resource);
52199
52207
  }
52200
- const parents = Object.keys(groups).map((g2) => ({ group: g2, parent: this.renderGroup(g2, div2) }));
52208
+ let sortedKeys = Object.keys(groups);
52209
+ if (this.orderGroupAsc !== null || this.orderGroupDesc !== null) {
52210
+ const order2 = this.orderGroupDesc !== null ? "desc" : "asc";
52211
+ sortedKeys = Object.keys(groups).sort((a, b) => {
52212
+ return generalComparator(a, b, order2);
52213
+ });
52214
+ }
52215
+ const parents = sortedKeys.map((g2) => ({ group: g2, parent: this.renderGroup(g2, div2) }));
52201
52216
  for (let { group, parent } of parents) {
52202
52217
  if (nextProcessor)
52203
52218
  await nextProcessor(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startinblox/core",
3
- "version": "0.19.21-beta.2",
3
+ "version": "0.19.22-beta.1",
4
4
  "description": "This is a series of web component respecting both the web components standards and the Linked Data Platform convention.",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",