diff --git a/src/components/atoms/ac-button/readme.md b/src/components/atoms/ac-button/readme.md index a2e445ad..c289fdb9 100644 --- a/src/components/atoms/ac-button/readme.md +++ b/src/components/atoms/ac-button/readme.md @@ -28,6 +28,7 @@ - [ac-header](../ac-header) - [ac-input](../../molecules/ac-input) - [ac-modal](../../organisms/ac-modal) + - [ac-navdrawer](../ac-navdrawer) - [ac-select](../../molecules/ac-select) - [ac-upload](../../organisms/ac-upload) @@ -38,6 +39,7 @@ graph TD; ac-header --> ac-button ac-input --> ac-button ac-modal --> ac-button + ac-navdrawer --> ac-button ac-select --> ac-button ac-upload --> ac-button style ac-button fill:#f9f,stroke:#333,stroke-width:4px diff --git a/src/components/atoms/ac-input-base/ac-input-base.tsx b/src/components/atoms/ac-input-base/ac-input-base.tsx index 01718230..e0cb6564 100644 --- a/src/components/atoms/ac-input-base/ac-input-base.tsx +++ b/src/components/atoms/ac-input-base/ac-input-base.tsx @@ -139,6 +139,7 @@ export class AcInputBase implements ComponentInterface { @Bind private handleBlur() { this.hasFocus = false; + this.host.dispatchEvent(new Event('blur')); } @Bind diff --git a/src/components/atoms/ac-input-base/readme.md b/src/components/atoms/ac-input-base/readme.md index 67acc457..c26dc336 100644 --- a/src/components/atoms/ac-input-base/readme.md +++ b/src/components/atoms/ac-input-base/readme.md @@ -38901,6 +38901,7 @@ Type: `Promise` - [ac-date-picker](../ac-date-picker) - [ac-input](../../molecules/ac-input) - [ac-menu](../../molecules/ac-menu) + - [ac-pagination](../../molecules/ac-pagination) - [ac-select](../../molecules/ac-select) ### Graph @@ -38909,6 +38910,7 @@ graph TD; ac-date-picker --> ac-input-base ac-input --> ac-input-base ac-menu --> ac-input-base + ac-pagination --> ac-input-base ac-select --> ac-input-base style ac-input-base fill:#f9f,stroke:#333,stroke-width:4px ``` diff --git a/src/components/atoms/ac-navdrawer/ac-navdrawer-controller/readme.md b/src/components/atoms/ac-navdrawer/ac-navdrawer-controller/readme.md index e69de29b..9d28cac0 100644 --- a/src/components/atoms/ac-navdrawer/ac-navdrawer-controller/readme.md +++ b/src/components/atoms/ac-navdrawer/ac-navdrawer-controller/readme.md @@ -0,0 +1,53 @@ +# ac-navdrawer-controller + + + + + + +## Properties + +| Property | Attribute | Description | Type | Default | +| -------- | --------- | --------------------------------------------------------------------------------------------- | -------- | ----------- | +| `bound` | `bound` | An optional property used to refer the parent element that the component will be attached to. | `string` | `undefined` | + + +## Methods + +### `create(props: ControllerComponentOptions) => Promise` + +Setup a new navdrawer on the screen. + +#### Returns + +Type: `Promise` + + + +### `dismiss() => Promise` + +Clear all modals that are displayed. + +#### Returns + +Type: `Promise` + + + + +## Dependencies + +### Depends on + +- [ac-overlay](../../../portals/ac-overlay) + +### Graph +```mermaid +graph TD; + ac-navdrawer-controller --> ac-overlay + style ac-navdrawer-controller fill:#f9f,stroke:#333,stroke-width:4px +``` + +---------------------------------------------- + +*Built with [StencilJS](https://stenciljs.com/)* diff --git a/src/components/atoms/ac-navdrawer/readme.md b/src/components/atoms/ac-navdrawer/readme.md index 0f6a4203..a4a2a642 100644 --- a/src/components/atoms/ac-navdrawer/readme.md +++ b/src/components/atoms/ac-navdrawer/readme.md @@ -159,12 +159,34 @@ ## Properties -| Property | Attribute | Description | Type | Default | -| --------- | --------- | ---------------- | --------- | ----------- | -| `compact` | `compact` | Compact mode. | `boolean` | `undefined` | -| `theme` | `theme` | The color theme. | `string` | `undefined` | +| Property | Attribute | Description | Type | Default | +| ------------ | ------------- | --------------------------------------------- | --------- | ----------- | +| `compact` | `compact` | Compact mode. | `boolean` | `undefined` | +| `showToggle` | `show-toggle` | Show or hide toggle button | `boolean` | `true` | +| `theme` | `theme` | The color theme. | `string` | `undefined` | +| `title` | `title` | Show title in the navdrawer and toggle header | `string` | `undefined` | +## Events + +| Event | Description | Type | +| ------- | ----------- | ------------------- | +| `close` | | `CustomEvent` | + + +## Dependencies + +### Depends on + +- [ac-button](../ac-button) + +### Graph +```mermaid +graph TD; + ac-navdrawer --> ac-button + style ac-navdrawer fill:#f9f,stroke:#333,stroke-width:4px +``` + ---------------------------------------------- *Built with [StencilJS](https://stenciljs.com/)* diff --git a/src/components/molecules/ac-menu/readme.md b/src/components/molecules/ac-menu/readme.md index e9bdec4e..f721d14d 100644 --- a/src/components/molecules/ac-menu/readme.md +++ b/src/components/molecules/ac-menu/readme.md @@ -29,12 +29,14 @@ - [ac-input-base](../../atoms/ac-input-base) - [ac-menu-item](ac-menu-item) +- [ac-menu-item](ac-menu-item) ### Graph ```mermaid graph TD; ac-menu --> ac-input-base ac-menu --> ac-menu-item + ac-menu --> ac-menu-item style ac-menu fill:#f9f,stroke:#333,stroke-width:4px ``` diff --git a/src/components/molecules/ac-pagination/ac-pagination.scss b/src/components/molecules/ac-pagination/ac-pagination.scss index 5d207d48..dd4f7418 100644 --- a/src/components/molecules/ac-pagination/ac-pagination.scss +++ b/src/components/molecules/ac-pagination/ac-pagination.scss @@ -9,6 +9,22 @@ ac-pagination { } } + + .page-counter__container { + color: var-color("primary", "normal"); + width: 20px; + height: 20px; + display: flex; + align-items: flex-end; + .page-counter__container--icon { + fill: var-color("primary", "normal"); + } + } + .page-counter__container--expand { + flex: 0 0 84px; + align-items: center; + } + .skip-pages { display: flex; align-items: center; diff --git a/src/components/molecules/ac-pagination/ac-pagination.tsx b/src/components/molecules/ac-pagination/ac-pagination.tsx index ee78388e..887e8d23 100644 --- a/src/components/molecules/ac-pagination/ac-pagination.tsx +++ b/src/components/molecules/ac-pagination/ac-pagination.tsx @@ -1,10 +1,10 @@ import { faAngleLeft } from '@fortawesome/free-solid-svg-icons/faAngleLeft'; import { faAngleRight } from '@fortawesome/free-solid-svg-icons/faAngleRight'; -import { Component, Event, EventEmitter, Listen, Prop, Watch, h } from '@stencil/core'; +import { Component, Event, EventEmitter, Listen, Prop, Watch, h, State, Element } from '@stencil/core'; import { Bind } from '../../../utils/lang/bind'; -import { count } from '../../../utils/lang/count'; import { AcFaIcon } from '../../utils/ac-fa-icon'; +import { faEllipsisH } from '@fortawesome/free-solid-svg-icons'; @Component({ tag: 'ac-pagination', @@ -14,6 +14,12 @@ import { AcFaIcon } from '../../utils/ac-fa-icon'; export class AcPagination { private skipPagesNext: HTMLDivElement; private skipPagesPrevious: HTMLDivElement; + + + @Element() host: HTMLElement; + + @State() showPageEditor = false; + @State() pageCount = [ 1, 2, 3 ,4 , 5 ]; /** * The amount of pages. @@ -63,6 +69,7 @@ export class AcPagination { @Watch('totalPages') @Watch('selected') definePages() { + this.updatePageCount(); if (this.selected === 1 && this.skipPagesPrevious) { this.skipPagesPrevious.classList.add('skip-pages__disable'); } else if (this.skipPagesPrevious) { @@ -72,14 +79,19 @@ export class AcPagination { this.skipPagesNext.classList.add('skip-pages__disable'); } else if (this.skipPagesNext) { this.skipPagesNext.classList.remove('skip-pages__disable'); - + } + } + componentDidUpdate() { + const tabs = this.host.querySelector('ac-tabs'); + if (tabs) { + tabs.selected = this.selected; } } render() { return [ this.totalPages > 0 && - +
{this.previousLabel}
- { - ...count(this.totalPages).map(i => - {i + 1} - ) + {this.pageCount.map(this.renderAcTabWithPageNumber)} + {this.totalPages > 5 && +
+ {this.showPageEditor + ? + + : + } +
} + {this.renderAcTabWithPageNumber(this.totalPages)}
this.skipPagesNext = skipPagesNext as any}> {this.nextLabel} @@ -100,4 +127,34 @@ export class AcPagination { ] } + + @Bind + showFocusGoToInput() { + this.showPageEditor = true; + } + + @Bind + private goTo(evt) { + const pageNumber: number = parseInt(evt.target.value); + this.showPageEditor = false; + if (pageNumber > this.totalPages || pageNumber < 1) { + return; + } + this.selected = pageNumber; + } + + private renderAcTabWithPageNumber(number: number) { + return {number} + } + + private updatePageCount() { + if (this.selected <= 5) { + this.pageCount = [1,2,3,4,5]; + } else { + const pageNumber = this.selected === this.totalPages + ? this.selected - 1 + : this.selected; + this.pageCount = this.pageCount.map(x => x + (pageNumber - this.pageCount[this.pageCount.length -1])) + } + } } diff --git a/src/components/molecules/ac-pagination/readme.md b/src/components/molecules/ac-pagination/readme.md index 67ae3d2d..7fa08c66 100644 --- a/src/components/molecules/ac-pagination/readme.md +++ b/src/components/molecules/ac-pagination/readme.md @@ -27,12 +27,14 @@ ### Depends on - [ac-tabs](../ac-tabs) +- [ac-input-base](../../atoms/ac-input-base) - [ac-tab](../ac-tabs/ac-tab) ### Graph ```mermaid graph TD; ac-pagination --> ac-tabs + ac-pagination --> ac-input-base ac-pagination --> ac-tab style ac-pagination fill:#f9f,stroke:#333,stroke-width:4px ``` diff --git a/src/components/portals/ac-overlay/readme.md b/src/components/portals/ac-overlay/readme.md index a8e002ab..319f0e79 100644 --- a/src/components/portals/ac-overlay/readme.md +++ b/src/components/portals/ac-overlay/readme.md @@ -41,12 +41,14 @@ Type: `Promise` ### Used by - [ac-modal-controller](../../organisms/ac-modal/ac-modal-controller) + - [ac-navdrawer-controller](../../atoms/ac-navdrawer/ac-navdrawer-controller) - [ac-toast-controller](../../atoms/ac-toast/ac-toast-controller) ### Graph ```mermaid graph TD; ac-modal-controller --> ac-overlay + ac-navdrawer-controller --> ac-overlay ac-toast-controller --> ac-overlay style ac-overlay fill:#f9f,stroke:#333,stroke-width:4px ```