smoothly 1.0.0-alpha.208 → 1.0.0-alpha.209
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/cjs/smoothly-app_80.cjs.entry.js +21 -10
- package/dist/cjs/smoothly-app_80.cjs.entry.js.map +1 -1
- package/dist/collection/components/filter/toggle/index.js +18 -7
- package/dist/collection/components/filter/toggle/index.js.map +1 -1
- package/dist/collection/components/table/demo/filtered/Root.js.map +1 -1
- package/dist/collection/components/table/demo/filtered/index.js +3 -3
- package/dist/collection/components/table/demo/filtered/index.js.map +1 -1
- package/dist/custom-elements/index.js +21 -10
- package/dist/custom-elements/index.js.map +1 -1
- package/dist/esm/smoothly-app_80.entry.js +21 -10
- package/dist/esm/smoothly-app_80.entry.js.map +1 -1
- package/dist/smoothly/p-8a0913a8.entry.js +2 -0
- package/dist/smoothly/p-8a0913a8.entry.js.map +1 -0
- package/dist/smoothly/smoothly.esm.js +1 -1
- package/dist/types/components/filter/toggle/index.d.ts +2 -0
- package/dist/types/components/table/demo/filtered/Root.d.ts +1 -0
- package/package.json +1 -1
- package/dist/smoothly/p-aa352ede.entry.js +0 -2
- package/dist/smoothly/p-aa352ede.entry.js.map +0 -1
|
@@ -6654,15 +6654,19 @@ const SmoothlyFilterToggle = class {
|
|
|
6654
6654
|
const criteria = !this.not ? r : r instanceof Not ? r.criteria : undefined;
|
|
6655
6655
|
return value == ""
|
|
6656
6656
|
? !(criteria instanceof Property && criteria.name == key)
|
|
6657
|
-
: (criteria
|
|
6658
|
-
criteria instanceof Property &&
|
|
6659
|
-
this.properties[criteria.name] &&
|
|
6660
|
-
criteria.criteria instanceof Is;
|
|
6657
|
+
: this.isCriteria(criteria, key, value);
|
|
6661
6658
|
}));
|
|
6662
6659
|
}
|
|
6663
6660
|
else
|
|
6664
6661
|
this.active = false;
|
|
6665
6662
|
}
|
|
6663
|
+
isCriteria(criteria, key, value) {
|
|
6664
|
+
const [property, ...rest] = key.split(".");
|
|
6665
|
+
return (criteria instanceof Property &&
|
|
6666
|
+
criteria.name == property &&
|
|
6667
|
+
((criteria.criteria instanceof Is && criteria.criteria.value == value) ||
|
|
6668
|
+
this.isCriteria(criteria.criteria, rest.join("."), value)));
|
|
6669
|
+
}
|
|
6666
6670
|
activeHandler(activate) {
|
|
6667
6671
|
const manipulate = (criteria) => {
|
|
6668
6672
|
let result = criteria;
|
|
@@ -6672,8 +6676,8 @@ const SmoothlyFilterToggle = class {
|
|
|
6672
6676
|
const newCriteria = !this.active || (this.active && value == "")
|
|
6673
6677
|
? undefined
|
|
6674
6678
|
: this.not
|
|
6675
|
-
? not(
|
|
6676
|
-
:
|
|
6679
|
+
? not(this.createCriteria(key, value))
|
|
6680
|
+
: this.createCriteria(key, value);
|
|
6677
6681
|
const index = result.rules.findIndex(r => this.findInstanceOf(r, key));
|
|
6678
6682
|
!newCriteria && index >= 0
|
|
6679
6683
|
? result.rules.splice(index, 1)
|
|
@@ -6689,9 +6693,16 @@ const SmoothlyFilterToggle = class {
|
|
|
6689
6693
|
};
|
|
6690
6694
|
this.smoothlyFilterManipulate.emit(manipulate.bind(this));
|
|
6691
6695
|
}
|
|
6696
|
+
createCriteria(key, value) {
|
|
6697
|
+
const [property$1, ...rest] = key.split(".");
|
|
6698
|
+
return property(property$1, rest.length == 0 ? is(value) : this.createCriteria(rest.join("."), value));
|
|
6699
|
+
}
|
|
6692
6700
|
findInstanceOf(criteria, property) {
|
|
6693
6701
|
const check = !this.not ? criteria : criteria instanceof Not ? criteria.criteria : false;
|
|
6694
|
-
|
|
6702
|
+
const [current, ...rest] = property.split(".");
|
|
6703
|
+
return (check instanceof Property &&
|
|
6704
|
+
check.name == current &&
|
|
6705
|
+
(rest.length == 0 || (!!check.criteria && this.findInstanceOf(check.criteria, rest.join(".")))));
|
|
6695
6706
|
}
|
|
6696
6707
|
render() {
|
|
6697
6708
|
return (index.h("smoothly-icon", { fill: "clear", color: this.active ? "success" : "medium", name: (this.active ? `${this.icon}` : `${this.icon}-outline`), toolTip: this.toolTip, onClick: () => this.activeHandler(true) }));
|
|
@@ -10416,13 +10427,13 @@ const TableDemoFiltered = class {
|
|
|
10416
10427
|
const response = await fetch("https://catfact.ninja/breeds?limit=15");
|
|
10417
10428
|
this.cats =
|
|
10418
10429
|
response.status == 200 &&
|
|
10419
|
-
(await response.body).data.map((cat) => (Object.assign(Object.assign({}, cat), { price: [...cat.breed].reduce((r, c) => r + c.charCodeAt(0), 0) })));
|
|
10430
|
+
(await response.body).data.map((cat) => (Object.assign(Object.assign({}, cat), { price: [...cat.breed].reduce((r, c) => r + c.charCodeAt(0), 0), nested: cat })));
|
|
10420
10431
|
}
|
|
10421
10432
|
render() {
|
|
10422
10433
|
const cats = this.cats && filter(this.criteria, this.cats);
|
|
10423
|
-
return (index.h(index.Host, null, index.h("smoothly-filter", null, index.h("smoothly-filter-toggle", { properties: { pattern: "Ticked", breed: "" }, icon: "paw", toolTip: "Ticked cats", slot: "bar" }), index.h("smoothly-filter-toggle", { properties: { breed: "Bombay", pattern: "Solid" }, icon: "radio-button-on", toolTip: "Solid bombay cats", slot: "bar" }), index.h("smoothly-filter-toggle", { properties: { pattern: "Colorpoint" }, not: true, active: true, icon: "alert", toolTip: "Colored cats", slot: "bar" }), index.h("smoothly-filter-picker", { property: "coat", slot: "bar", multiple: false }, this.cats &&
|
|
10434
|
+
return (index.h(index.Host, null, index.h("smoothly-filter", null, index.h("smoothly-filter-toggle", { properties: { ["nested.pattern"]: "Ticked", breed: "" }, icon: "add", toolTip: "Nested Ticked", slot: "bar" }), index.h("smoothly-filter-toggle", { properties: { pattern: "Ticked", breed: "" }, icon: "paw", toolTip: "Ticked cats", slot: "bar" }), index.h("smoothly-filter-toggle", { properties: { breed: "Bombay", pattern: "Solid" }, icon: "radio-button-on", toolTip: "Solid bombay cats", slot: "bar" }), index.h("smoothly-filter-toggle", { properties: { pattern: "Colorpoint" }, not: true, active: true, icon: "alert", toolTip: "Colored cats", slot: "bar" }), index.h("smoothly-filter-picker", { property: "coat", slot: "bar", multiple: false }, this.cats &&
|
|
10424
10435
|
this.cats.map(cat => cat.coat && index.h("smoothly-picker-option", { value: cat.coat }, cat.coat))), index.h("div", { slot: "detail" }, index.h("smoothly-form", { looks: "border" }, index.h("smoothly-filter-picker", { property: "breed", multiple: false }, this.cats &&
|
|
10425
|
-
this.cats.map(cat => cat.breed && index.h("smoothly-picker-option", { value: cat.breed }, cat.breed))), index.h("smoothly-filter-input", { property: "coat", placeholder: "ex. Short" })))), !cats ? ("Failed to load data.") : (index.h("smoothly-table", null, index.h("smoothly-table-row", null, index.h("smoothly-table-header", null, this.selector.render(cats)), index.h("smoothly-table-header", null, "Breed"), index.h("smoothly-table-header", null, "Coat"), index.h("smoothly-table-header", null, "Price")), cats.map(cat => (index.h("smoothly-table-row", null, index.h("smoothly-table-cell", null, this.selector.render(cat)), index.h("smoothly-table-expandable-cell", null, cat.breed, index.h("div", { slot: "detail" }, "Country: ", cat.country)), index.h("smoothly-table-expandable-cell", null, cat.coat, index.h("div", { slot: "detail" }, "Pattern: ", cat.pattern)), index.h("smoothly-table-cell", null, index.h("smoothly-display", { type: "price", value:
|
|
10436
|
+
this.cats.map(cat => cat.breed && index.h("smoothly-picker-option", { value: cat.breed }, cat.breed))), index.h("smoothly-filter-input", { property: "coat", placeholder: "ex. Short" })))), !cats ? ("Failed to load data.") : (index.h("smoothly-table", null, index.h("smoothly-table-row", null, index.h("smoothly-table-header", null, this.selector.render(cats)), index.h("smoothly-table-header", null, "Breed"), index.h("smoothly-table-header", null, "Coat"), index.h("smoothly-table-header", null, "Price")), cats.map(cat => (index.h("smoothly-table-row", null, index.h("smoothly-table-cell", null, this.selector.render(cat)), index.h("smoothly-table-expandable-cell", null, cat.breed, index.h("div", { slot: "detail" }, "Country: ", cat.country)), index.h("smoothly-table-expandable-cell", null, cat.coat, index.h("div", { slot: "detail" }, "Pattern: ", cat.pattern)), index.h("smoothly-table-cell", null, index.h("smoothly-display", { type: "price", value: cat.price, currency: "SEK" }))))), index.h("smoothly-table-footer", null, index.h("td", { colSpan: 5 }, index.h("smoothly-display", { type: "text", value: `Selected: ${this.selector.selected.length != 0 ? this.selector.selected.length : cats ? cats.length : "?"}` })))))));
|
|
10426
10437
|
}
|
|
10427
10438
|
};
|
|
10428
10439
|
TableDemoFiltered.style = styleCss$d;
|