@enos5/enos-vue-default

中文文档
2.0.10发布于 2026/11/11MITTypeScriptES Module近 30 天下载 2822

Shared Vue 3 UI components from Enos, packaged as the Default workspace inside the monorepo.

原始使用文档
文档目录9 节
  1. Requirements
  2. Install
  3. Use In Another Project
  4. Table column controls
  5. Publish To npm
  6. Floating action hints
  7. File uploads
  8. Responsive table search
  9. DateWeekInput

@enos5/enos-vue-default

Shared Vue 3 UI components from Enos, packaged as the Default workspace inside the monorepo.

Requirements

  • Node.js 20+
  • npm

Install

From the workspace root:

npm install

Build this package:

npm run build -w @enos5/enos-vue-default

Use In Another Project

Install the published package:

npm install @enos5/enos-vue-default

This package expects these peer dependencies in the consuming app:

  • vue
  • @inertiajs/vue3 (^2.0.0 or ^3.0.0)
  • @heroicons/vue
  • vue-i18n

Rich text support uses TinyMCE and is bundled as a regular dependency in this library. The component set mirrors the Jetstream package except for ApplicationLogo, AuthenticationCard, Banner, NavGroup, NavLink, NavMenu, and ResponsiveNavLink.

You can register everything globally:

import { createApp } from 'vue'
import App from './App.vue'
import { EnosVueDefault } from '@enos5/enos-vue-default'

createApp(App).use(EnosVueDefault).mount('#app')

Or import individual components:

import { Button, ColorPicker, TextInput } from '@enos5/enos-vue-default'

ColorPicker resolves its built-in UI labels through vue-i18n using the English copy as keys. If your app wants localized picker chrome, define translations for keys such as Color, Selected color, Pick color from screen, Hue, Opacity, Hex value, Saturation and brightness for {color}, and Rainbow color area for {color}.

DateInput and DateRangeInput default to English locale behavior. Pass locale to override that, and for native browser date fields remember the final picker UI is still browser-controlled, with lang used as the locale hint.

Styles are loaded automatically when you import the package entrypoint, so consumers do not have to remember a separate CSS import.

If a consuming app wants earlier stylesheet loading during npm run dev, it can opt into the stable stylesheet entry explicitly:

import '@enos5/enos-vue-default/styles.css'

That explicit import is optional. It mainly improves dev-mode first paint and avoids importing from dist directly.

Table column controls

TableList keeps its existing behavior unless the new controls are enabled:

<script setup>
import { ref } from 'vue'
import { TableList } from '@enos5/enos-vue-default'

const hiddenColumns = ref(['brand'])
const columns = [
  { key: 'name', label: 'Name', hideable: false },
  { key: 'brand', label: 'Brand' },
  { key: 'status', label: 'Status', sticky: 'right', width: '8rem' },
]
</script>

<template>
  <TableList
    v-model:hidden-columns="hiddenColumns"
    :columns="columns"
    :data="rows"
    column-visibility
    sticky-actions
  >
    <template #actions="{ item }">
      <!-- row actions -->
    </template>
  </TableList>
</template>
  • sticky-actions keeps the dedicated actions slot column visible at the right edge during horizontal scrolling, keeps multi-button groups on one line, and right-aligns the whole group.
  • column.sticky: 'right' (or true) pins a regular data column. A regular column can render custom buttons through its named slot, but it remains distinct from the dedicated actions slot column. Multiple sticky columns calculate their right offsets automatically.
  • column-visibility displays the built-in settings button and dialog.
  • v-model:hidden-columns controls the hidden column keys. Without the model, column.hidden: true supplies the initial internal state.
  • column.hideable: false omits a required column from the settings dialog.
  • Checkbox and “Show all” changes remain drafts until the user confirms with “OK”. Cancel, Escape, and backdrop dismissal discard the draft.
  • The columnVisibility* label props localize the button, title, description, “Show all”, apply, and cancel labels.

TableListForm supports the same sticky-actions prop and column.sticky: 'right' behavior. Column visibility is intentionally limited to TableList so an actively edited field cannot disappear from an editable row.

Publish To npm

Before publishing, build the package and verify the tarball:

npm run build -w @enos5/enos-vue-default
npm pack --dry-run -w packages/default

Then bump the version in packages/default/package.json, commit the change, and publish the workspace:

npm publish -w packages/default --access public

The first public release of this package needs --access public. After the package exists on npm, subsequent publishes can use the same command.

Floating action hints

FloatingActionHint is available in the Default package. It requires a unique id, a label, and a description. Bind the default slot’s descriptionId to the action’s aria-describedby. The hint opens on hover or focus, closes on Escape or leaving the action, and follows viewport resizing and container scrolling. Its content is teleported to body to avoid clipping by ancestor containers.

<script setup lang="ts">
import { FloatingActionHint } from '@enos5/enos-vue-default'
</script>

<template>
  <FloatingActionHint
    id="save-action-hint"
    label="Save"
    description="Save your changes without leaving this page."
  >
    <template #default="{ descriptionId }">
      <button type="button" :aria-describedby="descriptionId">Save</button>
    </template>
  </FloatingActionHint>
</template>

A runnable usage example is available in examples/FloatingActionHint.vue.

File uploads

Use InputGroup with type="file" for an upload control without a current-image preview. It accepts any file type by default. Pass accept to limit the browser picker using comma-separated extensions or MIME types.

<script setup>
import { ref } from 'vue'
import { InputGroup } from '@enos5/enos-vue-default'

const attachment = ref(null)
</script>

<template>
  <InputGroup
    v-model="attachment"
    type="file"
    label="Attachment"
    accept=".pdf,.docx"
  />
</template>

The model receives a File or null. The picker filter does not replace server-side file validation. FileInput is also available as a standalone component.

TableSearch sizes its layout from its container, including inside sidebars and panels. Below 1280px, the search input sits above the filters; the filter grid fits one column on narrow phones and adds columns as space allows. At 1280px and wider, the search input and all filter fields share one row, with more space reserved for filters and the search input capped at 40rem. The deleted toggle and result count stay together to their right, vertically centered on the search row. On smaller containers they stack beneath the search and filters. On tablet-sized containers, toggle and count share a row with space between them; on phones the count sits below the toggle. Long query summaries wrap. search-fields-layout="stacked" keeps search above extra fields.

Pass fields directly to the slot; the wrapper uses an auto-fitting grid:

<TableList
  v-model:search-value="search"
  :data="users"
  :columns="columns"
  search
  :search-show-deleted-toggle="true"
  :search-show-deleted="showDeleted"
  @update:search-show-deleted="showDeleted = $event"
  :search-ui="{
    input: 'min-w-[min(100%,16rem)] flex-[2_1_24rem]',
    fields: 'grid min-w-[min(100%,12rem)] flex-1 gap-3 sm:grid-cols-2',
  }"
>
  <template #search-fields>
    <InputGroup v-model="role" type="select" :options="roles" />
    <InputGroup v-model="status" type="select" :options="statuses" />
  </template>
</TableList>

Use ui on TableSearch directly, or search-ui on TableList. Each key accepts a Vue class value (string, array, or object) and replaces that wrapper's default classes. Unspecified keys retain their defaults. No internal selectors are needed.

KeyTarget
rootSearch card styling; falls back to the existing card-class prop
layoutContainer holding the fields and controls
contentContainer holding search and extra fields
inputSearch InputGroup root wrapper
fieldsExtra fields grid wrapper
controlsDeleted toggle, custom controls slot, and total group
toggleDeleted toggle wrapper
countResult count and query summary wrapper

The named @container/table-search stays on the root even when ui.root is provided, so ordinary named container variants remain available in overrides. Changing classes does not change filtering, models, events, or server/client modes.

DateWeekInput

Select a calendar week with v-model="week", where week is { start: 'YYYY-MM-DD', end: 'YYYY-MM-DD' }. Set week-starts-on to 0 (Sunday, the default) or 1 (Monday). The filter callback receives a week and returns whether it can be selected. locale, placeholder, and disabled are also supported.

DateRangeInput also accepts week-starts-on: 0 for Sunday (default) or 1 for Monday. This controls both the weekday headings and calendar grid. DateInput uses the browser native picker and does not control its week start.

版本与发布记录

@enos5/enos-vue-default 共发布 124 个版本,首次发布于 2026/04/07;过去 12 个月发布了 124 个版本。

版本发布日期距今
2.0.10latest2026/11/112 天前
2.0.92026/11/113 天前
2.0.82026/11/113 天前
2.0.72026/11/113 天前
2.0.62026/11/113 天前
2.0.52026/11/113 天前

关于 @enos5/enos-vue-default 的常见问题

@enos5/enos-vue-default 是什么?

Shared Vue 3 UI components from Enos, packaged as the Default workspace inside the monorepo.

如何安装 @enos5/enos-vue-default?

在项目目录运行 npm install @enos5/enos-vue-default,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:vue(^3.4.0)、vue-i18n(^11.0.0)、@inertiajs/vue3(^2.0.0 || ^3.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@enos5/enos-vue-default 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@enos5/enos-vue-default 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@enos5/enos-vue-default 可以商用吗?

@enos5/enos-vue-default 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@enos5/enos-vue-default 的下载量有多少?

根据 npm 官方下载统计,@enos5/enos-vue-default 在 2026/10/14 – 2026/11/12 这 30 天内被下载 2,822 次,日均约 94 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@enos5/enos-vue-default 还在维护吗?

最新版本 2.0.10 发布于 2026/11/11(2 天前);至今共发布 124 个版本,其中过去 12 个月发布了 124 个;首次发布于 2026/04/07。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。