Select Git revision
embedded-pagination.mjs 2.57 KiB
/**
* Copyright 2023 schukai GmbH
* SPDX-License-Identifier: AGPL-3.0
*/
import {assembleMethodSymbol, registerCustomElement} from "../../dom/customelement.mjs";
import {EmbeddedPaginationStyleSheet} from "./stylesheet/embedded-pagination.mjs";
import {instanceSymbol} from "../../constants.mjs";
import "../form/select.mjs";
import {Pagination} from "./pagination.mjs";
import "./datasource/dom.mjs";
import "./datasource/rest.mjs";
export {EmbeddedPagination};
/**
* The EmbeddedPagination component is used to show the current page and the total number of pages.
*
* <img src="./images/embedded-pagination.png">
*
* Dependencies: the system uses functions of the [monsterjs](https://monsterjs.org/) library
*
* You can create this control either by specifying the HTML tag <monster-datatable />` directly in the HTML or using
* Javascript via the `document.createElement('monster-datatable');` method.
*
* ```html
* <monster-pagination></monster-pagination>
* ```
*
* Or you can create this CustomControl directly in Javascript:
*
* ```js
* import '@schukai/component-datatable/source/pagination.mjs';
* document.createElement('monster-pagination');
* ```
*
* @startuml embedded-pagination.png
* skinparam monochrome true
* skinparam shadowing false
* HTMLElement <|-- CustomElement
* CustomElement <|-- Pagination
* @enduml
*
* @copyright schukai GmbH
* @memberOf Monster.Components.Datatable
* @summary A datatable
*/
class EmbeddedPagination extends Pagination {
/**
* This method is called by the `instanceof` operator.
* @returns {symbol}
*/
static get [instanceSymbol]() {
return Symbol.for("@schukai/monster/components/embedded-pagination");
}
[assembleMethodSymbol]() {
super[assembleMethodSymbol]();
}
get defaults() {
return Object.assign(
{},
super.defaults,
{
classes: {
spinner: "monster-spinner monster-theme-primary-3",
spinnerContainer: "monster-theme-primary-2 ",
error: "monster-theme-error-2 monster-bg-color-primary-2",
errorContainer: "monster-theme-primary-2",
},
}
);
}
/**
*
* @return {string}
*/
static getTag() {
return "monster-embedded-pagination";
}
/**
* @private
* @returns {CSSStyleSheet}
*/
static getControlCSSStyleSheet() {
return EmbeddedPaginationStyleSheet;
}
}
registerCustomElement(EmbeddedPagination);