@haiilo/catalyst 4.1.1 → 4.1.2

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.
@@ -5858,10 +5858,10 @@ const CatSelect = class {
5858
5858
  (_a = this.subscription) === null || _a === void 0 ? void 0 : _a.unsubscribe();
5859
5859
  this.subscription = this.term$
5860
5860
  .asObservable()
5861
- .pipe(debounce(term => (term ? timer(this.debounce) : of(0))), distinctUntilChanged(), tap(() => (number$ = this.more$.pipe(filter(() => !this.state.isLoading), scan(n => n + 1, 0), startWith(0)))), tap(() => this.patchState({ options: [] })), switchMap(term => number$.pipe(tap(() => this.patchState({ isLoading: true })), switchMap(number => this.connectorSafe.retrieve(term, number)), tap(page => this.patchState({ isLoading: false, totalElements: page.totalElements })), takeWhile(page => !page.last, true), scan((items, page) => [...items, ...page.content], []))))
5861
+ .pipe(debounce(term => (term ? timer(this.debounce) : of(0))), distinctUntilChanged(), tap(() => (number$ = this.more$.pipe(filter(() => !this.state.isLoading), scan(n => n + 1, 0), startWith(0)))), tap(() => this.patchState({ options: [] })), switchMap(term => number$.pipe(tap(() => this.patchState({ isLoading: true })), switchMap(number => connector.retrieve(term, number)), tap(page => this.patchState({ isLoading: false, totalElements: page.totalElements })), takeWhile(page => !page.last, true), scan((items, page) => [...items, ...page.content], []))))
5862
5862
  .subscribe(items => {
5863
5863
  var _a;
5864
- const options = this.toSelectItems(items);
5864
+ const options = this.toSelectItems(connector, items);
5865
5865
  if (this.tags &&
5866
5866
  this.state.term.trim().length &&
5867
5867
  !options.find(value1 => value1.render.label.toLowerCase() === this.state.term.toLowerCase())) {
@@ -5920,24 +5920,24 @@ const CatSelect = class {
5920
5920
  }, onFocus: () => { var _a; return (_a = this.input) === null || _a === void 0 ? void 0 : _a.focus(); }, onClick: () => (isTagOption ? this.createTag(item.render.label) : this.select(item)), tabIndex: -1 }, item.render.avatar ? (index.h("cat-avatar", { label: item.render.label, round: item.render.avatar.round, src: item.render.avatar.src, initials: (_b = item.render.avatar.initials) !== null && _b !== void 0 ? _b : '' })) : null, index.h("span", { class: "select-option-text" }, index.h("span", { class: "select-option-label" }, getLabel()), index.h("span", { class: "select-option-description" }, item.render.description))))));
5921
5921
  });
5922
5922
  }
5923
- get connectorSafe() {
5924
- if (this.connector) {
5925
- return this.connector;
5926
- }
5927
- throw new Error('CatSelectConnector not set');
5928
- }
5929
5923
  resolve() {
5924
+ const connector = this.connector;
5925
+ if (!connector) {
5926
+ return;
5927
+ }
5930
5928
  this.patchState({ isResolving: true });
5931
5929
  const ids = this.initIds();
5932
5930
  let tags;
5933
5931
  if (this.tags) {
5934
5932
  tags = this.initTags();
5935
5933
  }
5936
- const data$ = ids.length ? this.connectorSafe.resolve(ids).pipe(first()) : of([]);
5934
+ const data$ = ids.length ? connector.resolve(ids).pipe(first()) : of([]);
5937
5935
  data$.pipe(catchError(() => of([]))).subscribe(items => {
5938
- const selection = items.length ? this.toSelectItems(items) : [];
5936
+ const selection = this.toSelectItems(connector, items);
5939
5937
  if (this.tags) {
5940
- tags === null || tags === void 0 ? void 0 : tags.filter(tag => !this.isTagSelected(tag, selection)).forEach((tag, index) => {
5938
+ tags
5939
+ .filter(tag => !this.isTagSelected(tag, selection))
5940
+ .forEach((tag, index) => {
5941
5941
  const item = { id: `select-${this.id}-tag-${index}`, name: tag };
5942
5942
  selection.push({ item, render: { label: item.name } });
5943
5943
  });
@@ -5949,10 +5949,10 @@ const CatSelect = class {
5949
5949
  });
5950
5950
  });
5951
5951
  }
5952
- toSelectItems(items) {
5953
- return items === null || items === void 0 ? void 0 : items.map(item => ({
5954
- item: Object.assign(Object.assign({}, item), { id: this.connectorSafe.customId ? this.connectorSafe.customId(item) : item.id }),
5955
- render: this.connectorSafe.render(item)
5952
+ toSelectItems(connector, items) {
5953
+ return items.map(item => ({
5954
+ item: Object.assign(Object.assign({}, item), { id: connector.customId ? connector.customId(item) : item.id }),
5955
+ render: connector.render(item)
5956
5956
  }));
5957
5957
  }
5958
5958
  show() {