logo dile-components dile-components

dile-crud-single

The dile-crud-single component is designed to display the details of a record from a REST API, along with the available actions for it and any related resources.

Installation

npm i @dile/crud

Usage

Import the dile-crud component.

import '@dile/crud/components/single/crud-single.js';

Use the component.

<dile-crud-single
  relatedId="1"
  .config="${this.config}"
></dile-crud-single>

Properties

Layouts

The component can arrange the record detail and its actions in two ways:

In the sidebar layout the detail takes the look of the action group cards by default: background, border, box shadow and border radius (in the four corners) come from the --dile-crud-single-group-* variables (--dile-crud-single-group-background-color, --dile-crud-single-group-border, --dile-crud-single-group-box-shadow and --dile-crud-single-group-border-radius), so changing them restyles the groups and the detail together. If you set any of the dile-crud-detail variables (--dile-crud-detail-data-background-color, --dile-crud-detail-data-border, --dile-crud-detail-data-box-shadow, --dile-crud-detail-data-border-*-radius) they take precedence. The stacked layout keeps the default detail look.

<dile-crud-single
  relatedId="1"
  layout="sidebar"
  .config="${this.config}"
></dile-crud-single>

You can also set the layout for a whole resource in its configuration object, with customization.singleLayout:

customization: {
  singleLayout: 'sidebar',
},

Action groups

Single actions can be organized in blocks of full-width buttons with actions.singleGroups. Each group has an optional title and the list of action names it contains. Every button can show an icon (dile-iconlib "family.name" format) and a variant: 'primary', 'outline' or 'danger' (by default 'danger' for destructive actions and 'primary' for the rest).

import '@dile/iconlib/lucide-icons/mail.js';
import '@dile/iconlib/lucide-icons/download.js';

// In the configuration object
actions: {
  single: [
    { name: 'SendEmail', label: 'Send by email', icon: 'lucide.mail', onClick: (element) => sendEmail(element) },
    { name: 'DownloadPdf', label: 'Download PDF', icon: 'lucide.download', variant: 'outline', onClick: (element) => download(element) },
    { name: 'CancelInvoice', label: 'Cancel invoice', destructive: true },
  ],
  singleGroups: [
    { title: 'Quick actions', actions: ['SendEmail', 'DownloadPdf'] },
    { actions: ['CancelInvoice'] },
  ],
},
dile-crud-single {
  --dile-crud-single-group-action-justify-content: flex-start;
  --dile-crud-single-group-action-text-align: start;
}

More details in the actions configuration page.

Methods

Triggering Actions with Initial Data

You can programmatically trigger an action and pre-populate its form with initial data. This is particularly useful when an action needs to create something related to the current item.

For example, if you have a "Create Invoice" button next to each habitual product, you can open the action with the product already selected:

const crudSingle = document.querySelector('dile-crud-single');
crudSingle.triggerAction('CreateInvoiceDraftFromHabitualProductsAction', {
  products: [{ product_uuid: uuid, units: 1 }],
});

The form will be populated with the provided data and displayed to the user. After the action completes (either successfully or via cancellation), the form will reset on the next opening, ensuring a clean state for new operations.

Events

This component is built on multiple components from the @dile/crud catalog. As a result, it can dispatch a large number of events, such as those detailed in dile-crud, dile-crud-update, dile-crud-item-delete, and others.

Action events:

The dile-crud-single component includes actions functionality via dile-crud-single-actions. The following events are dispatched by the actions system and propagate through the component hierarchy:

Other useful events:

Refer to the documentation of other components to discover many more events available in dile-crud-single.

CSS Custom Properties

You can customize it using CSS Custom Properties.

Custom property Description Default
--dile-primary-dark-color Actions bar background color #d7d353
--dile-box-selector-item-text-align Text alignment for box selector items center
--dile-box-selector-item-font-weight Font weight for box selector items bold
--dile-card-border Border style for action card none
--dile-card-background-color Background color for action card var(--dile-secondary-light-color, #beed8e)
--dile-card-text-color Text color for action card var(--dile-on-secondary-light-color, #303030)
--dile-box-selector-item-background-color Background color for box selector items on hover var(--dile-primary-light-color, #fbfbe9)
--dile-box-selector-item-color Text color for box selector items on hover var(--dile-on-primary-light-color, #303030)
--dile-box-selector-item-border Border for box selector items on hover 4px solid var(--dile-primary-color, #f3f3ae)
--dile-crud-action-color Color for action buttons and icons #888
--dile-on-crud-action-color Text/foreground color for action buttons #fff
--dile-crud-list-options-font-size Font size of action buttons (Edit, Actions, Run action) Inherits from --dile-button-font-size or 1rem
--dile-crud-list-options-font-weight Font weight of action buttons (Edit, Actions, Run action) Inherits from --dile-button-font-weight or bold
--dile-crud-list-options-text-transform Text transformation of action buttons (Edit, Actions, Run action) Inherits from --dile-button-text-transform or none
--dile-crud-list-options-letter-spacing Letter spacing of action buttons (Edit, Actions, Run action) Inherits from --dile-button-letter-spacing or 0
--dile-crud-list-options-padding-y Vertical padding of action buttons (Edit, Actions, Run action) Inherits from --dile-button-padding-y or 0.5rem
--dile-crud-list-options-padding-x Horizontal padding of action buttons (Edit, Actions, Run action) Inherits from --dile-button-padding-x or 0.8rem
--dile-crud-single-actions-columns Grid columns of the actions card 1fr 1fr (1fr in the sidebar layout)
--dile-crud-single-actions-card-margin-bottom Bottom margin of the actions card 1.5rem (0 in the sidebar layout)
--dile-crud-single-sidebar-width Width of the actions column in the sidebar layout 18rem
--dile-crud-single-gap Gap between the detail and the actions column in the sidebar layout 1.5rem
--dile-crud-single-sidebar-gap Gap between the blocks of the actions column 1rem
--dile-crud-single-sidebar-actions-background-color Background color of the actions bar in the sidebar layout var(--dile-primary-dark-color, #d7d353)
--dile-crud-single-sidebar-actions-padding Padding of the actions bar in the sidebar layout 1rem
--dile-crud-single-sidebar-actions-border-radius Border radius of the actions bar in the sidebar layout 0.5rem
--dile-crud-single-groups-min-width Minimum width of each group column in the stacked layout grid 16rem
--dile-crud-single-groups-gap Gap between action groups 1rem
--dile-crud-single-group-background-color Background color of an action group var(--dile-background-color, #fff)
--dile-crud-single-group-text-color Text color of an action group var(--dile-on-background-color, #303030)
--dile-crud-single-group-border Border of an action group 1px solid rgba(0, 0, 0, 0.08)
--dile-crud-single-group-box-shadow Box shadow of an action group 0 1px 3px rgba(0, 0, 0, 0.08)
--dile-crud-single-group-border-radius Border radius of an action group 0.5rem
--dile-crud-single-group-padding Padding of an action group 1rem
--dile-crud-single-group-buttons-gap Gap between the buttons of a group 0.6rem
--dile-crud-single-group-title-font-size Font size of the group title 1.25rem
--dile-crud-single-group-title-font-weight Font weight of the group title 400
--dile-crud-single-group-title-color Color of the group title inherit
--dile-crud-single-group-action-font-size Font size of grouped action buttons 1rem
--dile-crud-single-group-action-font-weight Font weight of grouped action buttons normal
--dile-crud-single-group-action-border-radius Border radius of grouped action buttons 0.5rem
--dile-crud-single-group-action-border-width Border width of grouped action buttons 1px
--dile-crud-single-group-action-padding-y Vertical padding of grouped action buttons 0.6rem
--dile-crud-single-group-action-padding-x Horizontal padding of grouped action buttons 0.8rem
--dile-crud-single-group-action-justify-content Alignment of the content (icon + label) of the grouped action buttons and, in the sidebar layout, of every button in the actions column (edit, direct actions and the batch "Actions" menu). Use flex-start to align left center
--dile-crud-single-group-action-text-transform Text transform of the grouped action buttons and, in the sidebar layout, of the edit, direct actions and "Actions" buttons of the column. When set, it takes precedence over --dile-crud-list-options-text-transform for those column buttons. It does not affect the buttons of the action forms and modals Grouped buttons: --dile-button-text-transform or none. Column buttons: --dile-crud-list-options-text-transform or none
--dile-crud-single-group-action-text-align Alignment of the label lines when a button text wraps, for the same buttons. Use start together with flex-start above center
--dile-crud-single-action-{variant}-background-color Background color of grouped buttons for a variant (primary, outline, danger) primary: var(--dile-primary-color); outline: transparent; danger: light tint of var(--dile-danger-color)
--dile-crud-single-action-{variant}-text-color Text and icon color for a variant primary: var(--dile-on-primary-color); outline: var(--dile-on-background-color); danger: var(--dile-danger-color)
--dile-crud-single-action-{variant}-border-color Border color for a variant primary: var(--dile-primary-color); outline: currentColor; danger: tint of var(--dile-danger-color)
--dile-crud-single-action-{variant}-hover-background-color Hover background color for a variant primary: var(--dile-primary-dark-color); outline: rgba(0, 0, 0, 0.05); danger: var(--dile-danger-color)
--dile-crud-single-action-{variant}-hover-text-color Hover text color for a variant primary: var(--dile-on-primary-dark-color); outline: var(--dile-on-background-color); danger: var(--dile-on-danger-color)
--dile-crud-single-action-{variant}-hover-border-color Hover border color for a variant primary: var(--dile-primary-dark-color); outline: var(--dile-on-background-color); danger: var(--dile-danger-color)

The dile-crud-detail component, used internally to display the details of the element, has additional CSS custom properties available for customization.

Generating Single Components with the CLI

You can use the Dile Components CLI to create the scaffolding for single components from @dile/crud that are already configured for use with dile-crud-single. To do this, run the following command:

dile g-single post/post-single

This command requires that the resource configuration file has been generated previously, which you can do using the CLI command g-resource-config. More information is available on the resource configuration page.

If you want to see the help with the complete options for this command, run:

dile g-single --help

Configuration

Please refer to the general documentation to find the established mechanisms for configuring the dile-crud component.

Examples

Configuration object

Find the guides for creating the configuration object on the resource configuration page.

<script type="module">
import { html } from 'lit';
import { CrudConfigBuilder } from '@dile/crud/lib/CrudConfigBuilder';
import '@dile/ui/components/pages/pages';

// For the correct functioning of this declaration in the demo system, we have defined the variable with the configuration object globally. Normally, it would be created in a module and exported.
window.countryConfig = new CrudConfigBuilder('https://timer.escuelait.com/api/countries', {
  templates: {
    item: (country) => html`<demo-country-item .country=${country}></demo-country-item>`,
    insertForm: () => html`<demo-country-form id="insertform"></demo-country-form>`,
    updateForm: () => html`<demo-country-form id="updateform"></demo-country-form>`,
    help: () => html`<p>This is the help provided to the countries resource.</p>`,
    detail: (country) => html`<demo-country-detail .country="${country}"></demo-country-detail>`,
    relations: (country) => html`<demo-country-relations .country=${country}></demo-country-relations>`,
    formSingleActions: (actionName, country) => html`
        <dile-pages attrForSelected="action" selected="${actionName}">
            <demo-set-europe-as-continent-action action="SetEurope" .country=${country}></demo-set-europe-as-continent-action>
            <demo-set-asia-as-continent-action action="SetAsia" .country=${country}></demo-set-asia-as-continent-action>
        </dile-pages>
    `,
  },
  customization: {
    disablePagination: true,
    disableHelp: false,
    disableKeywordSearch: false,
    disableSort: false,
    disableFilter: false,
  },
  actions: {
    single: [
      {
        name: "SetEurope",
        label: "Set Europe as continent"
      },
      {
        name: "SetAsia",
        label: "Set Asia as continent"
      },
    ]
  },
  labels: {
    helpTitle: 'Country help',
  },
  sort: {
    options: [
      {
        name: 'name',
        label: 'Name',
        direction: 'desc'
      },
    ],
    initialSortField: 'name',
  },
  availableFilters: [
      {
        name: 'continent',
        label: 'Continent',
        active: false,
        value: false,
        type: 'select',
        options: [
            {
                value: 'Europe',
                label: 'Europe'
            },
            {
                value: 'Africa',
                label: 'Africa'
            },
            {
              value: 'Asia',
              label: 'Asia'
          },
        ]
      },
    ],
});
</script>

Resource form component

The resource form provides the necessary fields for editing the record.

Instructions on how to create these forms can be found in the dile-crud-insert and dile-ajax-form component documentation.

<script type="module">
import { LitElement, html, css } from 'lit';
import '@dile/ui/components/input/input.js';
import '@dile/ui/components/select/select.js';
import { DileForm } from '@dile/ui/mixins/form'

export class DemoCountryForm extends DileForm(LitElement) {
  static styles = [
    css`
      :host {
        display: block;
      }
    `
  ];

  render() {
    return html`
      <dile-input label="Country name" name="name" id="name" required hideErrorOnInput></dile-input>
      <dile-input label="Slug" name="slug" id="slug" required hideErrorOnInput></dile-input>
      <dile-select name="continent" id="continent" required label="Continent" hideErrorOnInput>
        <select slot="select">
          <option value="">Select...</option>
          <option value="Europe">Europa</option>
          <option value="South America">América del Sur</option>
          <option value="North America">Norte América</option>
          <option value="Asia">Asia</option>
          <option value="Africa">Africa</option>
          <option value="Oceania">Oceania</option>
        </select>
      </dile-select>
    `;
  }
}
customElements.define('demo-country-form', DemoCountryForm);
</script>
<demo-country-form></demo-country-form>

Detail template component

Technically, it's not necessary to build a component to define the details of the item you want to display, as a simple template would be enough. However, to keep things organized and reusable, you would typically use a component dedicated to displaying the details, which also allows you to include additional functionality if needed.

<script type="module">
import { LitElement, html, css } from 'lit';

export class DemoCountryDetail extends LitElement {
  static styles = [
    css`
      :host {
        display: block;
        color: #303030;
      }
      p {
        margin: 0 0 1rem;
      }
      .last {
        margin-bottom: 0;
      }
    `
  ];

  static get properties() {
    return {
      country: { type: Object }
    };
  }

  render() {
    return html`
      <p>Name: ${this.country.name}</p>
      <p class="last">Continent: ${this.country.continent}</p>
    `;
  }
}
customElements.define('demo-country-detail', DemoCountryDetail);
</script>

Action components

Some actions that can be performed from the crud-single component include:

<script type="module">
import { LitElement, html, css } from 'lit';
import { DileForm } from '@dile/ui/mixins/form';

class DemoSetEuropeAsContinentAction extends DileForm(LitElement) {
  static styles = [
    css`
      :host {
        display: block;
      }
    `
  ];

  static get properties() {
    return {
      country: { type: Object }
    };
  }

  render() {
    return html`
    <p>Do you really want to set Europe as continent of ${this.country?.name}?</p>
    `;
  }
}
customElements.define('demo-set-europe-as-continent-action', DemoSetEuropeAsContinentAction);


class DemoSetAsiaAsContinentAction extends DileForm(LitElement) {
  static styles = [
    css`
      :host {
        display: block;
      }
    `
  ];

  static get properties() {
    return {
      country: { type: Object }
    };
  }

  render() {
    return html`
    <p>Do you really want to set Asia as continent of ${this.country?.name}?</p>
    `;
  }
}
customElements.define('demo-set-asia-as-continent-action', DemoSetAsiaAsContinentAction);
</script>

Component for Relationships

The single pages of a CRUD can display records of related entities using dile-crud components, filtered by the belongsTo and relationId properties.

For this relationship to work, we need the components required by the board games CRUD itself.

Configuration object

Find the guides for creating the configuration object on the resource configuration page.

<script type="module">
import { html } from 'lit';
import { CrudConfigBuilder } from '@dile/crud/lib/CrudConfigBuilder';
import { ResponseApiAdapter } from '@dile/crud/lib/ResponseApiAdapter';

class BoardGameResponseApiAdapter extends ResponseApiAdapter {
  getElementList() {
    return this.response.data.result.data;
  }
}
// For the correct functioning of this declaration in the demo system, we have defined the variable with the configuration object globally. Normally, it would be created in a module and exported.
window.boardGameConfig = new CrudConfigBuilder('https://timer.escuelait.com/api/board-games', {
  customization: {
    hideCountSummary: false,
    hideCheckboxSelection: false,
    disablePagination: false,
    disableHelp: true,
    disableKeywordSearch: false,
    disableSort: false,
    disableFilter: false,
  },
  sort: {
    options: [
      {
        name: 'name',
        label: 'Name',
        direction: 'asc'
      },
      {
        name: 'year',
        label: 'Year',
        direction: 'desc'
      },
    ],
    initialSortField: 'year',
  },
  availableFilters: [
    {
      name: 'essential',
      label: 'Is essential',
      active: false,
      value: false,
      type: 'boolean',
    },
  ],
  responseAdapter: new BoardGameResponseApiAdapter(),
  actions: {
    list: [
      {
        label: 'Delete board games',
        name: 'DeleteAction'
      },
      {
        label: 'Change Essential',
        name: 'DemoChangeEssentialAction'
      },
      {
        label: 'Change Name',
        name: 'DemoChangeNameAction'
      },
    ],
  },
  validation: {
    // The insert and update forms are the same component, with different rules: the year is only required when the game is created
    insert: {
      year: ['required', 'integer', ['between', 1900, 2100]],
    },
    update: {
      year: ['integer', ['between', 1900, 2100]],
    },
    actions: {
      DemoChangeNameAction: { name: 'required|minLength:3|maxLength:80' },
    },
    messages: {
      'year.required': 'Tell us the year of the game',
    },
  },
  templates: {
    item: (boardGame) => html`<demo-board-game-item .boardGame=${boardGame}></demo-board-game-item>`,
    insertForm: (belongsTo, relationId) => html`<demo-board-game-form id="insertform" belongsTo="${belongsTo}" relationId="${relationId}"></demo-board-game-form>`,
    updateForm: () => html`<demo-board-game-form id="updateform"></demo-board-game-form>`,
    formActions: (actionName, actionIds) => html`
        <dile-pages attrForSelected="action" selected="${actionName}">
            <dile-crud-delete-action action="DeleteAction"></dile-crud-delete-action>
            <demo-change-essential-action action="DemoChangeEssentialAction" .actionIds=${actionIds}></demo-change-essential-action>
            <demo-change-name-action action="DemoChangeNameAction" .actionIds=${actionIds}></demo-change-name-action>
        </dile-pages>
    `,
  },
});
</script>

Item component

The item component to display each of the elements in the list.

<script type="module">
import { LitElement, html, css } from 'lit';

export class DemoBoardGameItem extends LitElement {
  static styles = [
    css`
      :host {
        display: block;
        color: var(--dile-on-background-color, #303030);
      }
    `
  ];

  static get properties() {
    return {
      boardGame: { type: Object }
    };
  }

  render() {
    return html`
      ${this.boardGame.name} - (${this.boardGame.year})
    `;
  }
}
customElements.define('demo-board-game-item', DemoBoardGameItem);
</script>

Resource form component

The resource form.

<script type="module">
import { LitElement, html, css } from 'lit';
import '@dile/ui/components/input/input.js';
import '@dile/ui/components/input/input-integer.js';
import '@dile/ui/components/checkbox/checkbox.js';
import '@dile/crud/components/ajax-select-crud/ajax-select-crud';

import { DileForm } from '@dile/ui/mixins/form'
import { DileFormValidation } from '@dile/validation';

export class DemoBoardGamesForm extends DileFormValidation(DileForm(LitElement)) {
  static validations = {
    name: 'maxLength:80',
    slug: 'pattern:[a-z0-9-]+',
    year: ['integer', ['between', 1900, 2100]],
  };

  static styles = [
    css`
      :host {
        display: block;
      }
    `
  ];

  static get properties() {
    return {
      belongsTo: { type: String },
      relationId: { type: String },
    };
  }

  firstUpdated() {
    if(this.belongsTo == "country" && this.relationId) {
      this.shadowRoot.getElementById('countryselect').value = this.relationId;
    }
  }

  render() {
    return html`
      <dile-input label="Nombre" name="name" id="name" required></dile-input>
      <dile-input label="Slug" name="slug" id="slug" required></dile-input>
      <dile-input-integer name="year" label="Year" id="year"></dile-input-integer>
      <dile-ajax-select-crud
          id="countryselect"
          idProperty="id"
          name="country_id"
          label="País"
          endpoint="https://timer.escuelait.com/api/countries" 
          queryStringVariable="keyword"
          placeholder="Buscar país"
          resultDataProperty="data"
          displayProperty="name"
          selectDefaultPlaceholder="Seleccionar país..."
      ></dile-ajax-select-crud>
      <p><dile-checkbox name="essential">Essential</dile-checkbox></p>
    `;
  }
}
customElements.define('demo-board-game-form', DemoBoardGamesForm);
</script>
<demo-board-game-form></demo-board-game-form>

Action component

The board game custom batch action.

<script type="module">
import { LitElement, html, css } from 'lit';
import { DileForm } from '@dile/ui/mixins/form';
import '@dile/ui/components/select/select.js';

export class DemoChangeEssentialAction extends DileForm(LitElement) {
  static styles = [
    css`
      :host {
        display: block;
      }
    `
  ];

  static get properties() {
    return {
      actionIds: { type: Array }
    };
  }

  constructor() {
    super();
    this.actionIds = [];
  }

  render() {
    return html`
      <p>Change essential game state of ${this.actionIds.length} elements.</p>
      <dile-select name="essential">
        <select slot="select">
          <option value="0">Not Essential</option>
          <option value="1">Essential</option>
        </select>
      </dile-select>
    `;
  }
}
customElements.define('demo-change-essential-action', DemoChangeEssentialAction);
</script>

Single relations component

This is the component that allows you to define relationships. In this component, we use a dile-crud, but technically you could include any type of content.

<script type="module">
import { LitElement, html, css } from 'lit';

export class DemoCountryRelations extends LitElement {
  static styles = [
    css`
      :host {
        display: block;
      }
    `
  ];

  static get properties() {
    return {
      boardGameConfig: { type: Object },
      country: { type: Object },
    };
  }

  constructor() {
    super();
    this.boardGameConfig = boardGameConfig.getConfig();
  }

  firstUpdated() {
    console.log(this.country);
  }

  render() {
    return html`
    ${this.country
      ? html `
        <dile-crud
          title="Juegos de ${this.country.name}"
          .config="${this.boardGameConfig}"
          belongsTo="country"
          relationId="${this.country.id}"
        ></dile-crud>  
      `
      : ''
    }
    
    `;
  }
}
customElements.define('demo-country-relations', DemoCountryRelations);
</script>

Crud single Component

<script type="module">
import { LitElement, html, css } from 'lit';
import '@dile/crud/components/single/crud-single'

export class DemoCountrySingle extends LitElement {
  static styles = [
    css`
      :host {
        display: block;
      }
    `
  ];

  static get properties() {
    return {
      config: { type: Object },
    };
  }

  constructor() {
    super();
    this.config = window.countryConfig.getConfig();
  }

  render() {
    return html`
      <dile-crud-single
        relatedId="1"
        .config="${this.config}"
      ></dile-crud-single>
    `;
  }
}
customElements.define('demo-country-single', DemoCountrySingle);
</script>
<demo-country-single></demo-country-single>

Crud single with sidebar layout

The same record using layout="sidebar". The dile-crud-single element is already registered on the page, so it doesn't need to be imported again.

<script type="module">
import { LitElement, html } from 'lit';

export class DemoCountrySingleSidebar extends LitElement {
  static get properties() {
    return {
      config: { type: Object },
    };
  }

  constructor() {
    super();
    this.config = window.countryConfig.getConfig();
  }

  render() {
    return html`
      <dile-crud-single
        relatedId="1"
        layout="sidebar"
        .config="${this.config}"
      ></dile-crud-single>
    `;
  }
}
customElements.define('demo-country-single-sidebar', DemoCountrySingleSidebar);
</script>
<demo-country-single-sidebar></demo-country-single-sidebar>

Crud single with action groups

The sidebar layout with the actions organized in groups, with icons and variants.

<script type="module">
import { LitElement, html } from 'lit';
import '@dile/iconlib/lucide-icons/mail.js';
import '@dile/iconlib/lucide-icons/download.js';
import '@dile/iconlib/lucide-icons/ban.js';

export class DemoCountrySingleGroups extends LitElement {
  static get properties() {
    return {
      config: { type: Object },
    };
  }

  constructor() {
    super();
    const baseConfig = window.countryConfig.getConfig();
    const log = (message) => (element) => console.log(message, element);
    this.config = {
      ...baseConfig,
      actions: {
        ...baseConfig.actions,
        single: [
          ...baseConfig.actions.single,
          { name: 'SendEmail', label: 'Send by email', icon: 'lucide.mail', onClick: log('Send by email') },
          { name: 'DownloadPdf', label: 'Download PDF', icon: 'lucide.download', variant: 'outline', onClick: log('Download PDF') },
          { name: 'Archive', label: 'Archive country', icon: 'lucide.ban', destructive: true, onClick: log('Archive') },
        ],
        singleGroups: [
          { title: 'Quick actions', actions: ['SendEmail', 'DownloadPdf', 'SetEurope'] },
          { actions: ['SetAsia'] },
          { actions: ['Archive'] },
        ],
      },
    };
  }

  render() {
    return html`
      <dile-crud-single
        relatedId="1"
        layout="sidebar"
        .config="${this.config}"
      ></dile-crud-single>
    `;
  }
}
customElements.define('demo-country-single-groups', DemoCountrySingleGroups);
</script>
<demo-country-single-groups></demo-country-single-groups>