@haiilo/catalyst 2.4.5 → 2.4.6
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/catalyst/catalyst.esm.js +1 -1
- package/dist/catalyst/{p-51a48b4c.entry.js → p-6e5d8f29.entry.js} +2 -2
- package/dist/catalyst/p-6e5d8f29.entry.js.map +1 -0
- package/dist/cjs/cat-alert_23.cjs.entry.js +16 -5
- package/dist/cjs/cat-alert_23.cjs.entry.js.map +1 -1
- package/dist/collection/components/cat-select/cat-select.js +16 -4
- package/dist/collection/components/cat-select/cat-select.js.map +1 -1
- package/dist/collection/components/cat-select-demo/cat-select-demo.js +2 -1
- package/dist/collection/components/cat-select-demo/cat-select-demo.js.map +1 -1
- package/dist/components/cat-select-demo.js +2 -1
- package/dist/components/cat-select-demo.js.map +1 -1
- package/dist/components/cat-select2.js +14 -4
- package/dist/components/cat-select2.js.map +1 -1
- package/dist/esm/cat-alert_23.entry.js +16 -5
- package/dist/esm/cat-alert_23.entry.js.map +1 -1
- package/dist/types/components/cat-select/cat-select.d.ts +2 -0
- package/package.json +2 -2
- package/dist/catalyst/p-51a48b4c.entry.js.map +0 -1
|
@@ -4209,6 +4209,7 @@ const CatSelect = class {
|
|
|
4209
4209
|
this._id = `cat-input-${nextUniqueId$4++}`;
|
|
4210
4210
|
this.term$ = new Subject();
|
|
4211
4211
|
this.more$ = new Subject();
|
|
4212
|
+
this.valueChangedBySelection = false;
|
|
4212
4213
|
this.state = INIT_STATE;
|
|
4213
4214
|
this.hasSlottedLabel = false;
|
|
4214
4215
|
/**
|
|
@@ -4255,6 +4256,9 @@ const CatSelect = class {
|
|
|
4255
4256
|
this.reset(connector);
|
|
4256
4257
|
this.resolve();
|
|
4257
4258
|
}
|
|
4259
|
+
onValueChange() {
|
|
4260
|
+
!this.valueChangedBySelection ? this.resolve() : (this.valueChangedBySelection = false);
|
|
4261
|
+
}
|
|
4258
4262
|
onStateChange(newState, oldState) {
|
|
4259
4263
|
var _a;
|
|
4260
4264
|
const changed = (key) => newState[key] !== oldState[key];
|
|
@@ -4265,16 +4269,17 @@ const CatSelect = class {
|
|
|
4265
4269
|
}
|
|
4266
4270
|
}
|
|
4267
4271
|
if (changed('selection')) {
|
|
4272
|
+
let newValue;
|
|
4268
4273
|
if (!this.multiple && this.state.selection.length) {
|
|
4269
4274
|
this.hide();
|
|
4270
4275
|
}
|
|
4271
4276
|
const idsSelected = this.state.selection.map(item => item.item.id);
|
|
4272
4277
|
if (!this.tags) {
|
|
4273
4278
|
if (this.multiple) {
|
|
4274
|
-
|
|
4279
|
+
newValue = idsSelected;
|
|
4275
4280
|
}
|
|
4276
4281
|
else {
|
|
4277
|
-
|
|
4282
|
+
newValue = idsSelected.length ? idsSelected[0] : '';
|
|
4278
4283
|
}
|
|
4279
4284
|
}
|
|
4280
4285
|
else {
|
|
@@ -4283,12 +4288,16 @@ const CatSelect = class {
|
|
|
4283
4288
|
.filter(item => item.item.id.startsWith(`select-${this.id}-tag`))
|
|
4284
4289
|
.map(item => item.render.label);
|
|
4285
4290
|
if (this.multiple) {
|
|
4286
|
-
|
|
4291
|
+
newValue = { ids, tags };
|
|
4287
4292
|
}
|
|
4288
4293
|
else {
|
|
4289
|
-
|
|
4294
|
+
newValue = { id: ids.length ? ids[0] : '', tag: tags.length ? tags[0] : '' };
|
|
4290
4295
|
}
|
|
4291
4296
|
}
|
|
4297
|
+
if (!oldState.isResolving) {
|
|
4298
|
+
this.valueChangedBySelection = true;
|
|
4299
|
+
this.value = newValue;
|
|
4300
|
+
}
|
|
4292
4301
|
this.catChange.emit();
|
|
4293
4302
|
}
|
|
4294
4303
|
}
|
|
@@ -4759,6 +4768,7 @@ const CatSelect = class {
|
|
|
4759
4768
|
get hostElement() { return index.getElement(this); }
|
|
4760
4769
|
static get watchers() { return {
|
|
4761
4770
|
"connector": ["onConnectorChange"],
|
|
4771
|
+
"value": ["onValueChange"],
|
|
4762
4772
|
"state": ["onStateChange"]
|
|
4763
4773
|
}; }
|
|
4764
4774
|
};
|
|
@@ -4867,8 +4877,9 @@ const CatSelectTest = class {
|
|
|
4867
4877
|
description: user.desc
|
|
4868
4878
|
})
|
|
4869
4879
|
});
|
|
4870
|
-
(_e = this.singleSelectAvatar) === null || _e === void 0 ? void 0 : _e.connect(
|
|
4880
|
+
(_e = this.singleSelectAvatar) === null || _e === void 0 ? void 0 : _e.connect(this.countryConnector);
|
|
4871
4881
|
(_f = this.singleSelectTagging) === null || _f === void 0 ? void 0 : _f.connect(this.countryConnector);
|
|
4882
|
+
setTimeout(() => this.multipleSelect && (this.multipleSelect.value = []), 5000);
|
|
4872
4883
|
}
|
|
4873
4884
|
render() {
|
|
4874
4885
|
return (index.h(index.Host, { style: { display: 'flex', flexDirection: 'column' } }, index.h("cat-select", { label: "Multiple Select", hint: "This is a hint!", ref: el => (this.multipleSelect = el), value: ['1'], placeholder: "Hello World", onCatChange: () => { var _a; return console.log((_a = this.multipleSelect) === null || _a === void 0 ? void 0 : _a.value); }, onCatBlur: e => console.log('Multiple blur', e), multiple: true, clearable: true }, index.h("span", { slot: "hint" }, "Searching for \"no\" -", '>', " no options are returned!")), index.h("cat-select", { label: "Multiple with img", ref: el => (this.multipleSelectAvatar = el), value: ['1'], placeholder: "Hello World", multiple: true, clearable: true }), index.h("cat-select", { label: "Multiple with tagging support", hint: "This is a hint!", ref: el => (this.multipleSelectTagging = el), value: { ids: ['1'], tags: ['Test', 'Albania', 'Algeria'] }, placeholder: "Select country", onCatChange: () => { var _a; return console.log((_a = this.multipleSelectTagging) === null || _a === void 0 ? void 0 : _a.value); }, multiple: true, tags: true, clearable: true }), index.h("cat-select", { label: "Single Select", hint: "This is a hint!", ref: el => (this.singleSelect = el), placeholder: "Search for a country or capital", onCatBlur: e => console.log('Single blur', e), clearable: true }), index.h("cat-select", { label: "Single with img", ref: el => (this.singleSelectAvatar = el), value: '1', onCatChange: () => { var _a; return console.log((_a = this.singleSelectAvatar) === null || _a === void 0 ? void 0 : _a.value); }, placeholder: "Search for a country or capital", clearable: true }), index.h("cat-dropdown", { overflow: true, noAutoClose: true }, index.h("cat-button", { slot: "trigger", style: { width: '50%' } }, "Open select"), index.h("div", { slot: "content", style: { width: '400px' } }, index.h("cat-select", { label: "Single with tagging support", ref: el => (this.singleSelectTagging = el), value: { id: '', tag: 'Albania' }, placeholder: "Search for a country or capital", onCatChange: () => { var _a; return console.log('Single', (_a = this.singleSelectTagging) === null || _a === void 0 ? void 0 : _a.value); }, tagHint: "new country", tags: true, clearable: true, style: { width: '90%' } })))));
|