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

customization: CSS, String template, Row template #15

Merged
merged 7 commits into from
Jul 6, 2021

Commits on Jul 1, 2021

  1. import custom <style> tag to Shadow DOM

    this small but powerful addition allows a user of the element to define
    a custom <style> element inside of the custom element, which is then
    moved in to the Shadow DOM. The <style> tag can define arbitrary CSS of
    course, but the main (and supported) way of using it is to override CSS
    variables to customize the styling of the element.
    
    Example:
    
    <ge-autocomplete …>
    	<style>
    	  :host {
    	    --input-bg: salmon;
    	    --loading-color: red;
    	  }
    	</style>
    </ge-autocomplete>
    mxlje committed Jul 1, 2021
    Configuration menu
    Copy the full SHA
    4df54bf View commit details
    Browse the repository at this point in the history
  2. customization: support custom lodash template to render result row

    this is the second (after CSS), very powerful customization feature: it
    allows a user of the element to define a <template row> tag inside the
    custom element, and inside of that they can create HTML markup as well
    as access the data of the row (the Feature) through the lodash template
    language.
    
    Example:
    
    <ge-autocomplete …>
    	<template row>
    	  <div>${feature.properties.gid}: ${feature.properties.name}</div>
    	</template>
    </ge-autocomplete>
    mxlje committed Jul 1, 2021
    Configuration menu
    Copy the full SHA
    d1d036a View commit details
    Browse the repository at this point in the history
  3. customization: add string template

    this template allows customization of the way a Feature is converted
    into a string and can be used for "smaller" customization where a fully
    new template with custom styles would be overkill.
    
    Also this applies to the resulting string that is placed in the input
    field after an item is selected.
    
    this commit also refactors the way templates are passed to parse them
    both in a single function instead of duplicating the logic. This also
    allows easily adding more templates in the future.
    mxlje committed Jul 1, 2021
    Configuration menu
    Copy the full SHA
    c6e4561 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    c3e5419 View commit details
    Browse the repository at this point in the history

Commits on Jul 2, 2021

  1. docs: customization: fix code sample

    Co-authored-by: Julian Simioni <orangejulius@users.noreply.github.com>
    mxlje and orangejulius committed Jul 2, 2021
    Configuration menu
    Copy the full SHA
    90193d0 View commit details
    Browse the repository at this point in the history
  2. customization: templates: namespace feature as item.feature

    by moving the actual feature data one level down we can add metadata to
    the top level of the object, such as `active`, `index`, and
    `searchTerm`, so the template can use
    
    ${item.feature.properties} ${item.active}
    
    that way the meta properties don’t conflict with the geo data itself
    mxlje committed Jul 2, 2021
    Configuration menu
    Copy the full SHA
    46dfc02 View commit details
    Browse the repository at this point in the history

Commits on Jul 6, 2021

  1. Configuration menu
    Copy the full SHA
    fcb8647 View commit details
    Browse the repository at this point in the history