smoothly 1.0.0-alpha.211 → 1.0.0-alpha.213
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 +34 -41
- package/dist/cjs/smoothly-app_80.cjs.entry.js.map +1 -1
- package/dist/collection/components/filter/field/index.js +2 -2
- package/dist/collection/components/filter/field/index.js.map +1 -1
- package/dist/collection/components/filter/input/index.js +26 -5
- package/dist/collection/components/filter/input/index.js.map +1 -1
- package/dist/collection/components/filter/toggle/index.js +2 -2
- package/dist/collection/components/filter/toggle/index.js.map +1 -1
- package/dist/collection/components/picker/index.js +3 -21
- package/dist/collection/components/picker/index.js.map +1 -1
- package/dist/collection/components/picker/menu/index.js +2 -12
- package/dist/collection/components/picker/menu/index.js.map +1 -1
- package/dist/collection/components/table/demo/filtered/index.js +1 -1
- package/dist/collection/components/table/demo/filtered/index.js.map +1 -1
- package/dist/custom-elements/index.js +34 -41
- package/dist/custom-elements/index.js.map +1 -1
- package/dist/esm/smoothly-app_80.entry.js +34 -41
- package/dist/esm/smoothly-app_80.entry.js.map +1 -1
- package/dist/smoothly/p-8aaad050.entry.js +2 -0
- package/dist/smoothly/p-8aaad050.entry.js.map +1 -0
- package/dist/smoothly/smoothly.esm.js +1 -1
- package/dist/types/components/filter/input/index.d.ts +2 -0
- package/dist/types/components/picker/menu/index.d.ts +1 -5
- package/dist/types/components.d.ts +1 -1
- package/package.json +1 -1
- package/dist/smoothly/p-b9165e1d.entry.js +0 -2
- package/dist/smoothly/p-b9165e1d.entry.js.map +0 -1
|
@@ -6489,8 +6489,8 @@ const SmoothlyFilterField = class {
|
|
|
6489
6489
|
await ((_a = this.input) === null || _a === void 0 ? void 0 : _a.clear());
|
|
6490
6490
|
}
|
|
6491
6491
|
filterFieldEmit() {
|
|
6492
|
-
var _a;
|
|
6493
|
-
this.smoothlyFilterField.emit(parse$2((_a = this.input) === null || _a === void 0 ? void 0 : _a.value));
|
|
6492
|
+
var _a, _b;
|
|
6493
|
+
this.smoothlyFilterField.emit(parse$2((_b = (_a = this.input) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : ""));
|
|
6494
6494
|
}
|
|
6495
6495
|
render() {
|
|
6496
6496
|
return (index.h(index.Host, { onKeyDown: (e) => e.key == "Enter" && this.filterFieldEmit() }, index.h("smoothly-input", { name: "filter", ref: e => (this.input = e), value: this.criteria.toString(), onSmoothlyInputLooks: e => e.stopPropagation(), onSmoothlyBlur: e => {
|
|
@@ -6519,19 +6519,32 @@ const SmoothlyFilterInput = class {
|
|
|
6519
6519
|
this.smoothlyFilterUpdate.emit(this.update.bind(this));
|
|
6520
6520
|
}
|
|
6521
6521
|
update(expression) {
|
|
6522
|
-
var _a
|
|
6522
|
+
var _a;
|
|
6523
6523
|
if (expression instanceof And && expression.rules.length > 0)
|
|
6524
|
-
|
|
6525
|
-
|
|
6524
|
+
for (const rule of expression.rules) {
|
|
6525
|
+
const criteria = this.isCriteria(rule, this.property);
|
|
6526
|
+
if (criteria) {
|
|
6527
|
+
this.needle = (_a = criteria.needle) !== null && _a !== void 0 ? _a : "";
|
|
6528
|
+
break;
|
|
6529
|
+
}
|
|
6530
|
+
}
|
|
6526
6531
|
else
|
|
6527
6532
|
this.needle = "";
|
|
6528
6533
|
}
|
|
6534
|
+
isCriteria(criteria, key) {
|
|
6535
|
+
const [property, ...rest] = key.split(".");
|
|
6536
|
+
return ((criteria instanceof Property &&
|
|
6537
|
+
criteria.name == property &&
|
|
6538
|
+
((criteria.criteria instanceof Includes && criteria.criteria) ||
|
|
6539
|
+
(criteria.criteria instanceof Property && this.isCriteria(criteria.criteria, rest.join("."))))) ||
|
|
6540
|
+
undefined);
|
|
6541
|
+
}
|
|
6529
6542
|
inputHandler(event) {
|
|
6530
6543
|
event.stopPropagation();
|
|
6531
6544
|
const needle = event.detail[this.property];
|
|
6532
6545
|
const manipulate = (criteria) => {
|
|
6533
6546
|
let result = criteria;
|
|
6534
|
-
const newCriteria = needle ?
|
|
6547
|
+
const newCriteria = needle ? this.getCriteria(needle) : undefined;
|
|
6535
6548
|
if (result instanceof And) {
|
|
6536
6549
|
const index = result.rules.findIndex(r => this.findInstanceOf(r, this.property));
|
|
6537
6550
|
!newCriteria
|
|
@@ -6545,8 +6558,16 @@ const SmoothlyFilterInput = class {
|
|
|
6545
6558
|
};
|
|
6546
6559
|
this.smoothlyFilterManipulate.emit(manipulate.bind(this));
|
|
6547
6560
|
}
|
|
6561
|
+
getCriteria(needle) {
|
|
6562
|
+
return this.property
|
|
6563
|
+
.split(".")
|
|
6564
|
+
.reduceRight((r, e) => property(e, r), includes(needle));
|
|
6565
|
+
}
|
|
6548
6566
|
findInstanceOf(criteria, property) {
|
|
6549
|
-
|
|
6567
|
+
const [key, ...rest] = property.split(".");
|
|
6568
|
+
return (criteria instanceof Property &&
|
|
6569
|
+
criteria.name == key &&
|
|
6570
|
+
(rest.length == 0 || (!!criteria.criteria && this.findInstanceOf(criteria.criteria, rest.join(".")))));
|
|
6550
6571
|
}
|
|
6551
6572
|
render() {
|
|
6552
6573
|
return (index.h("smoothly-input", { name: this.property, value: this.needle, type: this.type, placeholder: this.placeholder, onSmoothlyInputLooks: e => e.stopPropagation(), onSmoothlyBlur: e => e.stopPropagation(), onSmoothlyFormDisable: e => e.stopPropagation(), onSmoothlyInputLoad: e => e.stopPropagation(), onSmoothlyChange: e => e.stopPropagation(), onSmoothlyInput: e => this.inputHandler(e) }, index.h("slot", null)));
|
|
@@ -6717,9 +6738,9 @@ const SmoothlyFilterToggle = class {
|
|
|
6717
6738
|
}
|
|
6718
6739
|
findInstanceOf(criteria, property) {
|
|
6719
6740
|
const check = !this.not ? criteria : criteria instanceof Not ? criteria.criteria : false;
|
|
6720
|
-
const [
|
|
6741
|
+
const [key, ...rest] = property.split(".");
|
|
6721
6742
|
return (check instanceof Property &&
|
|
6722
|
-
check.name ==
|
|
6743
|
+
check.name == key &&
|
|
6723
6744
|
(rest.length == 0 || (!!check.criteria && this.findInstanceOf(check.criteria, rest.join(".")))));
|
|
6724
6745
|
}
|
|
6725
6746
|
render() {
|
|
@@ -9536,18 +9557,6 @@ Notifier.style = styleCss$x;
|
|
|
9536
9557
|
|
|
9537
9558
|
const styleCss$w = ".sc-smoothly-picker-h{box-sizing:border-box}.sc-smoothly-picker-h[looks=\"border\"].sc-smoothly-picker-s>smoothly-picker-menu smoothly-input,[looks=\"border\"].sc-smoothly-picker-h{border:rgb(var(--text-color, var(--smoothly-color-contrast))) solid 1px}[looks=\"border\"][readonly].sc-smoothly-picker-h{border:rgba(var(--text-color, var(--smoothly-color-contrast)), .1) solid 1px}.sc-smoothly-picker-h[looks=\"line\"].sc-smoothly-picker-s>smoothly-picker-menu smoothly-input,[looks=\"line\"].sc-smoothly-picker-h{border-bottom:rgb(var(--text-color, var(--smoothly-color-contrast))) solid 1px}[looks=\"line\"][readonly].sc-smoothly-picker-h{border-bottom:rgba(var(--text-color, var(--smoothly-color-contrast)), .1) solid 1px}.sc-smoothly-picker-h[looks=\"grid\"].sc-smoothly-picker-s>smoothly-picker-menu smoothly-input,[looks=\"grid\"].sc-smoothly-picker-h{border:rgba(var(--text-color, var(--smoothly-color-contrast)), .5) solid .5px}[looks=\"grid\"][readonly].sc-smoothly-picker-h{border:rgba(var(--text-color, var(--smoothly-color-contrast)), .2) solid .5px}[looks=\"transparent\"].sc-smoothly-picker-h{border:none}[looks=\"transparent\"].sc-smoothly-picker-h:not(:focus-within){background-color:transparent}[looks=\"transparent\"].sc-smoothly-picker-h:not(:focus-within) input.sc-smoothly-picker{background:transparent}[looks=\"transparent\"].sc-smoothly-picker-h:focus-within{outline:1px solid rgb(var(--smoothly-color-contrast))}.sc-smoothly-picker-h{display:flex;position:relative;width:max-content;padding:1.2em 0.7em 0.2em 0.8em;background-color:rgb(var(--background-color, var(--smoothly-color-shade)))}.sc-smoothly-picker-h div.element.sc-smoothly-picker{display:flex;background-color:inherit}smoothly-slot-elements.sc-smoothly-picker{white-space:nowrap}.selected.sc-smoothly-picker{position:relative;display:flex;align-items:center;gap:1rem;width:100%;overflow:hidden;text-overflow:ellipsis;margin-right:2px}.selected.sc-smoothly-picker::after{content:\"\";position:absolute;top:0;bottom:0;right:0;width:2ch}.sc-smoothly-picker-h:not([looks=transparent]) .selected.sc-smoothly-picker::after{background:linear-gradient(90deg, rgba(var(--background-color, var(--smoothly-color-shade)), 0) 0%, rgba(var(--background-color, var(--smoothly-color-shade)), 1) 100%)}.selected.sc-smoothly-picker *.sc-smoothly-picker{display:none}.label.sc-smoothly-picker{position:absolute;left:0.4rem;top:0.6rem;color:rgb(var(--text-color, var(--smoothly-color-contrast)));opacity:0.8;user-select:none;cursor:inherit;transform-origin:top left;transition:transform 100ms ease}.selected.sc-smoothly-picker:not(:empty)+.label.sc-smoothly-picker{top:0.4em;transform:scale(0.6)}";
|
|
9538
9559
|
|
|
9539
|
-
var __rest$1 = (undefined && undefined.__rest) || function (s, e) {
|
|
9540
|
-
var t = {};
|
|
9541
|
-
for (var p in s)
|
|
9542
|
-
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
9543
|
-
t[p] = s[p];
|
|
9544
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
9545
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
9546
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9547
|
-
t[p[i]] = s[p[i]];
|
|
9548
|
-
}
|
|
9549
|
-
return t;
|
|
9550
|
-
};
|
|
9551
9560
|
const SmoothlyPicker = class {
|
|
9552
9561
|
constructor(hostRef) {
|
|
9553
9562
|
index.registerInstance(this, hostRef);
|
|
@@ -9569,12 +9578,9 @@ const SmoothlyPicker = class {
|
|
|
9569
9578
|
this.smoothlyInputLooks.emit(looks => (this.looks = looks));
|
|
9570
9579
|
}
|
|
9571
9580
|
selectedChanged() {
|
|
9572
|
-
var _a;
|
|
9573
9581
|
const selected = Array.from(this.selected.values(), option => option.value);
|
|
9574
|
-
|
|
9575
|
-
|
|
9576
|
-
this.smoothlyChange.emit({ [this.name]: this.multiple ? selected : selected.at(0) });
|
|
9577
|
-
}
|
|
9582
|
+
this.smoothlyInput.emit({ [this.name]: this.multiple ? selected : selected.at(0) });
|
|
9583
|
+
this.smoothlyChange.emit({ [this.name]: this.multiple ? selected : selected.at(0) });
|
|
9578
9584
|
this.display = Array.from(this.selected.values(), option => {
|
|
9579
9585
|
const span = document.createElement("span");
|
|
9580
9586
|
option.slotted.forEach(node => span.appendChild(node.cloneNode(true)));
|
|
@@ -9583,10 +9589,7 @@ const SmoothlyPicker = class {
|
|
|
9583
9589
|
}
|
|
9584
9590
|
componentDidLoad() {
|
|
9585
9591
|
if (this.controls)
|
|
9586
|
-
this.smoothlyPickerLoaded.emit(
|
|
9587
|
-
var controls = __rest$1(_a, ["synced"]);
|
|
9588
|
-
return controls;
|
|
9589
|
-
})(this.controls));
|
|
9592
|
+
this.smoothlyPickerLoaded.emit(this.controls);
|
|
9590
9593
|
}
|
|
9591
9594
|
smoothlyInputLooksHandler(event) {
|
|
9592
9595
|
if (event.target != this.element)
|
|
@@ -9720,7 +9723,6 @@ const SmoothlyPickerMenu = class {
|
|
|
9720
9723
|
index.registerInstance(this, hostRef);
|
|
9721
9724
|
this.notice = index.createEvent(this, "notice", 7);
|
|
9722
9725
|
this.smoothlyPickerMenuLoaded = index.createEvent(this, "smoothlyPickerMenuLoaded", 7);
|
|
9723
|
-
this.synced = false;
|
|
9724
9726
|
this.looks = undefined;
|
|
9725
9727
|
this.open = false;
|
|
9726
9728
|
this.multiple = false;
|
|
@@ -9747,12 +9749,6 @@ const SmoothlyPickerMenu = class {
|
|
|
9747
9749
|
}, { threshold }));
|
|
9748
9750
|
}
|
|
9749
9751
|
}
|
|
9750
|
-
sync() {
|
|
9751
|
-
if (this.backend.size != this.options.size)
|
|
9752
|
-
this.synced = false;
|
|
9753
|
-
else
|
|
9754
|
-
this.synced = true;
|
|
9755
|
-
}
|
|
9756
9752
|
componentDidLoad() {
|
|
9757
9753
|
this.smoothlyPickerMenuLoaded.emit({
|
|
9758
9754
|
remember: () => {
|
|
@@ -9786,7 +9782,6 @@ const SmoothlyPickerMenu = class {
|
|
|
9786
9782
|
this.options = new Map(Array.from(this.options.entries()).filter(([key]) => !this.created.has(key)));
|
|
9787
9783
|
this.created = new Map();
|
|
9788
9784
|
},
|
|
9789
|
-
synced: () => this.synced,
|
|
9790
9785
|
});
|
|
9791
9786
|
}
|
|
9792
9787
|
disconnectedCallback() {
|
|
@@ -9813,7 +9808,6 @@ const SmoothlyPickerMenu = class {
|
|
|
9813
9808
|
optionLoadHandler(event) {
|
|
9814
9809
|
if (!this.listElement || !event.composedPath().includes(this.listElement)) {
|
|
9815
9810
|
event.stopPropagation();
|
|
9816
|
-
this.sync();
|
|
9817
9811
|
event.detail.set.readonly(this.readonly);
|
|
9818
9812
|
const current = this.options.get(event.detail.value);
|
|
9819
9813
|
if (current)
|
|
@@ -9831,7 +9825,6 @@ const SmoothlyPickerMenu = class {
|
|
|
9831
9825
|
}
|
|
9832
9826
|
else
|
|
9833
9827
|
this.options.set(event.detail.value, event.detail);
|
|
9834
|
-
this.sync();
|
|
9835
9828
|
}
|
|
9836
9829
|
optionChangeHandler(event) {
|
|
9837
9830
|
var _a;
|
|
@@ -10458,7 +10451,7 @@ const TableDemoFiltered = class {
|
|
|
10458
10451
|
var _a;
|
|
10459
10452
|
return ((_a = cat.nested) === null || _a === void 0 ? void 0 : _a.coat) && (index.h("smoothly-picker-option", { value: cat.nested.coat }, cat.nested.coat));
|
|
10460
10453
|
})), index.h("smoothly-filter-picker", { label: "breed", property: "breed", multiple: false }, this.cats &&
|
|
10461
|
-
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 : "?"}` })))))));
|
|
10454
|
+
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" }), index.h("smoothly-filter-input", { property: "nested.coat", placeholder: "ex. Rex" })))), !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 : "?"}` })))))));
|
|
10462
10455
|
}
|
|
10463
10456
|
};
|
|
10464
10457
|
TableDemoFiltered.style = styleCss$d;
|