<templates>
  <t t-name="o-spreadsheet-PivotDimension">
    <div
      class="py-1 px-2 d-flex flex-column shadow-sm pivot-dimension border rounded"
      t-att-class="{'pivot-dimension-invalid': !this.props.dimension.isValid}">
      <div class="d-flex flex-row justify-content-between align-items-center">
        <div
          class="d-flex align-items-center overflow-hidden text-nowrap"
          t-att-title="this.props.dimension.displayName">
          <span class="text-danger me-1" t-if="!this.props.dimension.isValid">
            <t t-call="o-spreadsheet-Icon.TRIANGLE_EXCLAMATION"/>
          </span>
          <TextInput
            t-if="this.props.onNameUpdated"
            value="this.props.dimension.displayName"
            onChange.bind="this.updateName"
            class="'o-fw-bold'"
            selectContentOnFocus="true"
          />
          <span t-else="1" class="o-fw-bold text-truncate" t-out="this.dimensionDisplayName"/>
        </div>
        <div class="d-flex flex-rows">
          <t t-call-slot="upper-right-icons"/>
          <i
            class="o-button-icon oi oi-filled pe-1 ps-1"
            data-icon="delete_f"
            t-if="this.props.onRemoved"
            t-on-click="() => this.props.onRemoved(this.props.dimension)"
          />
        </div>
      </div>
      <t t-call-slot="default"/>
    </div>
  </t>
</templates>
