Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: time control navigation property #1449

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions elements/layercontrol/src/components/layer-datetime.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export class EOxLayerControlLayerDatetime extends LitElement {
* @type {{
* disablePlay?: boolean;
* slider?: boolean;
* navigation?: boolean;
* currentStep: string|number;
* controlValues: (string|number)[];
* displayFormat?: string;
Expand Down Expand Up @@ -107,6 +108,7 @@ export class EOxLayerControlLayerDatetime extends LitElement {
?unstyled=${this.unstyled}
.for=${undefined}
.layer=${undefined}
.navigation=${this.layerDatetime.navigation ?? false}
.slider=${this.layerDatetime.slider ?? false}
.disablePlay=${this.layerDatetime.disablePlay ?? false}
.controlValues=${this.layerDatetime.controlValues}
Expand Down
39 changes: 29 additions & 10 deletions elements/timecontrol/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ export class EOxTimeControl extends LitElement {
*/
slider: { type: Boolean },

/**
* Display left & right navigation buttons for the values
*/
navigation: { type: Boolean },

/**
* Original params of layer source
*/
Expand Down Expand Up @@ -79,6 +84,8 @@ export class EOxTimeControl extends LitElement {
/** @type {boolean} */
this.disablePlay = false;
/** @type {boolean} */
this.navigation = true;
/** @type {boolean} */
this.slider = false;
/**
* Query selector of an `eox-map` (`String`, passed as an attribute or property)
Expand Down Expand Up @@ -301,23 +308,35 @@ export class EOxTimeControl extends LitElement {
</style>
<main>
<div id="controls" part="controls">
<button
part="previous"
class="icon previous"
@click="${() => this.previous()}"
>
<
</button>
${this.navigation
? html`
<button
part="previous"
class="icon previous"
@click="${() => this.previous()}"
>
<
</button>
`
: nothing}
<span part="current">
${this.displayFormat
? dayjs(this.controlValues[this._newStepIndex]).format(
this.displayFormat,
)
: this.controlValues[this._newStepIndex]}
</span>
<button part="next" class="icon next" @click="${() => this.next()}">
>
</button>
${this.navigation
? html`
<button
part="next"
class="icon next"
@click="${() => this.next()}"
>
>
</button>
`
: nothing}
${!this.disablePlay
? html`
<button
Expand Down
Loading