igniteui-webcomponents
Version:
Ignite UI for Web Components is a complete library of UI components, giving you the ability to build modern web applications using encapsulation and the concept of reusable components in a dependency-free approach.
77 lines • 2.72 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { html, LitElement } from 'lit';
import { property } from 'lit/decorators.js';
import { addThemingController } from '../../theming/theming-controller.js';
import { registerComponent } from '../common/definitions/register.js';
import { createHighlightController, } from './service.js';
import { styles as shared } from './themes/shared/highlight.common.css.js';
import { all } from './themes/themes.js';
export default class IgcHighlightComponent extends LitElement {
static { this.tagName = 'igc-highlight'; }
static { this.styles = [shared]; }
static register() {
registerComponent(IgcHighlightComponent);
}
set caseSensitive(value) {
this._caseSensitive = value;
this.search();
}
get caseSensitive() {
return this._caseSensitive;
}
set searchText(value) {
this._searchText = value;
this.search();
}
get searchText() {
return this._searchText;
}
get size() {
return this._service.size;
}
get current() {
return this._service.current;
}
constructor() {
super();
this._service = createHighlightController(this);
this._caseSensitive = false;
this._searchText = '';
addThemingController(this, all, {
themeChange: this._addStylesheet,
});
}
_addStylesheet() {
this._service.attachStylesheet();
}
next(options) {
this._service.next(options);
}
previous(options) {
this._service.previous(options);
}
setActive(index, options) {
this._service.setActive(index, options);
}
search() {
if (this.hasUpdated) {
this._service.clear();
this._service.find(this.searchText);
}
}
render() {
return html `<slot></slot>`;
}
}
__decorate([
property({ type: Boolean, reflect: true, attribute: 'case-sensitive' })
], IgcHighlightComponent.prototype, "caseSensitive", null);
__decorate([
property({ attribute: 'search-text' })
], IgcHighlightComponent.prototype, "searchText", null);
//# sourceMappingURL=highlight.js.map