@startinblox/core 0.19.20 → 0.19.21

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";
@@ -12492,16 +12492,25 @@ const FormFileMixin = {
12492
12492
  this.listAttributes["resetFile"] = this.resetFile.bind(this);
12493
12493
  },
12494
12494
  attached() {
12495
- document.addEventListener("reset", (e) => {
12496
- if (e.target && e.target.contains(this.element)) {
12495
+ this.element.closest("form").addEventListener("reset", this.resetFormFile.bind(this));
12496
+ this.element.closest("solid-form").addEventListener("populate", this.onPopulate.bind(this));
12497
+ },
12498
+ onPopulate() {
12499
+ const dataHolder = this.element.querySelector("input[data-holder]");
12500
+ dataHolder.value = this.value;
12501
+ dataHolder.dispatchEvent(new Event("change"));
12502
+ },
12503
+ resetFormFile(e) {
12504
+ if (e.target && e.target.contains(this.element)) {
12505
+ if (this.initialValue !== "") {
12497
12506
  this.value = this.initialValue;
12498
- this.listAttributes["resetButtonHidden"] = true;
12499
- this.planRender();
12500
- const dataHolder = this.element.querySelector("input[data-holder]");
12501
- dataHolder.value = this.value;
12502
- dataHolder.dispatchEvent(new Event("change"));
12503
12507
  }
12504
- });
12508
+ this.listAttributes["resetButtonHidden"] = true;
12509
+ this.planRender();
12510
+ const dataHolder = this.element.querySelector("input[data-holder]");
12511
+ dataHolder.value = this.value;
12512
+ dataHolder.dispatchEvent(new Event("change"));
12513
+ }
12505
12514
  },
12506
12515
  selectFile() {
12507
12516
  if (this.uploadUrl === null)
@@ -52165,6 +52174,14 @@ const GrouperMixin = {
52165
52174
  groupClass: {
52166
52175
  type: String,
52167
52176
  default: ""
52177
+ },
52178
+ orderGroupAsc: {
52179
+ type: Boolean,
52180
+ default: null
52181
+ },
52182
+ orderGroupDesc: {
52183
+ type: Boolean,
52184
+ default: null
52168
52185
  }
52169
52186
  },
52170
52187
  attached() {
@@ -52182,7 +52199,14 @@ const GrouperMixin = {
52182
52199
  groups[valueGroup] = { resources: [] };
52183
52200
  groups[valueGroup].resources.push(resource);
52184
52201
  }
52185
- const parents = Object.keys(groups).map((g2) => ({ group: g2, parent: this.renderGroup(g2, div2) }));
52202
+ let sortedKeys = Object.keys(groups);
52203
+ if (this.orderGroupAsc !== null || this.orderGroupDesc !== null) {
52204
+ const order2 = this.orderGroupDesc !== null ? "desc" : "asc";
52205
+ sortedKeys = Object.keys(groups).sort((a, b) => {
52206
+ return generalComparator(a, b, order2);
52207
+ });
52208
+ }
52209
+ const parents = sortedKeys.map((g2) => ({ group: g2, parent: this.renderGroup(g2, div2) }));
52186
52210
  for (let { group, parent } of parents) {
52187
52211
  if (nextProcessor)
52188
52212
  await nextProcessor(
@@ -53199,12 +53223,24 @@ const SolidForm = {
53199
53223
  name: "solid-form",
53200
53224
  use: [WidgetMixin, StoreMixin, NextMixin, ValidationMixin],
53201
53225
  attributes: {
53226
+ autosave: {
53227
+ type: Boolean,
53228
+ default: null
53229
+ },
53230
+ classSubmitButton: {
53231
+ type: String,
53232
+ default: void 0
53233
+ },
53202
53234
  defaultWidget: {
53203
53235
  type: String,
53204
53236
  default: "solid-form-label-text"
53205
53237
  },
53206
53238
  naked: {
53207
- type: String,
53239
+ type: Boolean,
53240
+ default: null
53241
+ },
53242
+ partial: {
53243
+ type: Boolean,
53208
53244
  default: null
53209
53245
  },
53210
53246
  submitButton: {
@@ -53218,18 +53254,6 @@ const SolidForm = {
53218
53254
  submitWidget: {
53219
53255
  type: String,
53220
53256
  default: null
53221
- },
53222
- classSubmitButton: {
53223
- type: String,
53224
- default: void 0
53225
- },
53226
- partial: {
53227
- type: Boolean,
53228
- default: null
53229
- },
53230
- autosave: {
53231
- type: Boolean,
53232
- default: null
53233
53257
  }
53234
53258
  },
53235
53259
  initialState: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startinblox/core",
3
- "version": "0.19.20",
3
+ "version": "0.19.21",
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",