nexa-ui-kit 0.6.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,11 @@ _sfc_main.render = function(ctx) {
24
24
  (image) ? h('img', { class: "n-card-image", src: image, "data-v-34850782": "" }) : null,
25
25
  (title || $slots.header) ? h('div', { class: "n-card-header", "data-v-34850782": "" }, [
26
26
  "\n ",
27
- ctx.$slots.header ? ctx.$slots.header() : null,
27
+ ctx.$slots.header ? ctx.$slots.header() : ["\n ", h('h3', { class: "n-card-title" }, [
28
+ title
29
+ ]), "\n ", h('p', { class: "n-card-subtitle" }, [
30
+ subtitle
31
+ ]), "\n "],
28
32
  "\n "
29
33
  ]) : null,
30
34
  h('div', { class: ['n-card-body', padding ? 'has-padding' : ''], "data-v-34850782": "" }, [
@@ -2,7 +2,7 @@ import { signal, computed, effect, h, hText, defineComponent, registerComponent,
2
2
  import NPaginator from './NPaginator.js'
3
3
 
4
4
  const _sfc_main = defineComponent({
5
- __scopeId: 'data-v-71b71cd6',
5
+ __scopeId: 'data-v-17a3d2ce',
6
6
  __hmrId: 'NDataTable_nexa',
7
7
  props: { value: { type: Array, default: () => [] }, columns: { type: Array, default: () => [] }, stripedRows: { type: Boolean, default: false }, hoverRows: { type: Boolean, default: true }, size: { type: String, default: 'md' }, scrollable: { type: Boolean, default: true }, paginator: { type: Boolean, default: true }, rows: { type: Number, default: 10 }, first: { type: Number, default: 0 }, rowsPerPageOptions: { type: Array, default: () => [10, 20, 50] }, selectionMode: { type: String, default: '' }, selection: { type: null, default: null }, dataKey: { type: String, default: '' }, sortField: { type: String, default: '' }, sortOrder: { type: Number, default: 1 }, resizableColumns: { type: Boolean, default: true }, columnResizeMode: { type: String, default: 'fit' }, filterDisplay: { type: String, default: 'row' }, globalFilter: { type: String, default: '' }, globalFilterFields: { type: Array, default: null }, filters: { type: null, default: null }, lazy: { type: Boolean, default: false }, totalRecords: { type: Number, default: 0 }, emptyMessage: { type: String, default: 'No records found' }, showGridlines: { type: Boolean, default: false } },
8
8
  emits: ['update:first', 'update:rows', 'update:selection', 'update:sortField', 'update:sortOrder', 'update:globalFilter', 'update:filters', 'updateFirst', 'updateRows', 'updateSelection', 'updateSortField', 'updateSortOrder', 'updateGlobalFilter', 'updateFilters', 'page', 'rowSelect', 'rowUnselect', 'sort', 'filter'],
@@ -167,70 +167,82 @@ const _sfc_main = defineComponent({
167
167
  // Injected render function
168
168
  _sfc_main.render = function(ctx) {
169
169
  const { internalFirst, internalRows, internalSortField, internalSortOrder, internalFilters, effectiveFilters, columnWidths, resizing, internalSelection, lastPropGlobal, lastPropSelection, normalizeColumns, getRowKey, effectiveSelection, isRowSelected, toggleRowSelection, allVisibleSelected, toggleAllVisible, getHeaderContent, getRawValue, getCellContent, matchFilter, filteredRows, sortedRows, totalRecords, visibleRows, setSort, onSortClick, setGlobal, setColumnFilter, onColumnFilterInput, onPage, getWidth, startResize, NPaginator: _ntc_NPaginator, $slots, emit, value, columns, stripedRows, hoverRows, size, scrollable, paginator, rows, first, rowsPerPageOptions, selectionMode, selection, dataKey, sortField, sortOrder, resizableColumns, columnResizeMode, filterDisplay, globalFilter, globalFilterFields, filters, lazy, emptyMessage, showGridlines, Fragment: _ntc_Fragment } = ctx
170
- return h('div', { class: ["n-dt", [`n-dt-${size}`, showGridlines ? 'is-grid' : '', scrollable ? 'is-scroll' : '']], "data-v-71b71cd6": "" }, [
170
+ return h('div', { class: ["n-dt", [`n-dt-${size}`, showGridlines ? 'is-grid' : '', scrollable ? 'is-scroll' : '']], "data-v-17a3d2ce": "" }, [
171
171
  "\n ",
172
- h('div', { class: "n-dt-toolbar", "data-v-71b71cd6": "" }, [
173
- h('div', { class: "n-dt-global", "data-v-71b71cd6": "" }, [
174
- h('input', { class: "n-dt-global-input", value: effectiveFilters.value.__global || '', placeholder: "Search...", onInput: setGlobal, "data-v-71b71cd6": "" })
172
+ h('div', { class: "n-dt-toolbar", "data-v-17a3d2ce": "" }, [
173
+ h('div', { class: "n-dt-global", "data-v-17a3d2ce": "" }, [
174
+ h('input', { class: "n-dt-global-input", value: effectiveFilters.value.__global || '', placeholder: "Search...", onInput: setGlobal, "data-v-17a3d2ce": "" })
175
175
  ])
176
176
  ]),
177
177
  "\n ",
178
- h('div', { class: "n-dt-wrapper", "data-v-71b71cd6": "" }, [
178
+ h('div', { class: "n-dt-wrapper", "data-v-17a3d2ce": "" }, [
179
179
  "\n ",
180
- h('table', { class: ["n-dt-table", { 'is-striped': stripedRows, 'is-hover': hoverRows }], "data-v-71b71cd6": "" }, [
180
+ h('table', { class: ["n-dt-table", { 'is-striped': stripedRows, 'is-hover': hoverRows }], "data-v-17a3d2ce": "" }, [
181
181
  "\n ",
182
- h('thead', { class: "n-dt-thead", "data-v-71b71cd6": "" }, [
182
+ h('thead', { class: "n-dt-thead", "data-v-17a3d2ce": "" }, [
183
183
  "\n ",
184
- h('tr', { class: "n-dt-head-row", "data-v-71b71cd6": "" }, [
185
- (selectionMode) ? h('th', { class: "n-dt-th is-selection", "data-v-71b71cd6": "" }, [
186
- (selectionMode === 'multiple') ? h('input', { class: "n-dt-selectbox", type: "checkbox", checked: allVisibleSelected.value, onClick: ($event) => { $event.stopPropagation(); (toggleAllVisible)($event) }, "data-v-71b71cd6": "" }) : null
184
+ h('tr', { class: "n-dt-head-row", "data-v-17a3d2ce": "" }, [
185
+ "\n ",
186
+ (selectionMode) ? h('th', { class: "n-dt-th is-selection", "data-v-17a3d2ce": "" }, [
187
+ (selectionMode === 'multiple') ? h('input', { class: "n-dt-selectbox", type: "checkbox", checked: allVisibleSelected.value, onClick: ($event) => { $event.stopPropagation(); (toggleAllVisible)($event) }, "data-v-17a3d2ce": "" }) : null
187
188
  ]) : null,
188
189
  normalizeColumns.value.map((col, index) =>
189
- h('th', { class: ["n-dt-th", [`is-${col.align}`, col.sortable ? 'is-sortable' : '']], key: col.field, style: { width: getWidth(col) || undefined, minWidth: col.minWidth }, "data-field": col.field, onClick: onSortClick, "data-v-71b71cd6": "" }, [
190
- h('div', { class: "n-dt-th-content", "data-v-71b71cd6": "" }, [
191
- h('span', { class: "n-dt-th-text", "data-v-71b71cd6": "" }, [
192
- getHeaderContent(col)
190
+ h('th', { class: ["n-dt-th", [`is-${col.align}`, col.sortable ? 'is-sortable' : '']], key: col.field, style: { width: getWidth(col) || undefined, minWidth: col.minWidth }, "data-field": col.field, onClick: onSortClick, "data-v-17a3d2ce": "" }, [
191
+ "\n ",
192
+ h('div', { class: "n-dt-th-content", "data-v-17a3d2ce": "" }, [
193
+ "\n ",
194
+ h('span', { class: "n-dt-th-text", "data-v-17a3d2ce": "" }, [
195
+ $slots.value && $slots.value[`header-${col.field}`] ? $slots[`header-${col.field}`]({ column: col }) : getHeaderContent(col)
193
196
  ]),
194
- (col.sortable) ? h('span', { class: ["n-dt-sort", { 'is-active': internalSortField.value === col.field }], "data-v-71b71cd6": "" }, [
195
- (internalSortField.value !== col.field) ? h('span', { class: "n-dt-sort-icon", "data-v-71b71cd6": "" }, [
197
+ "\n ",
198
+ (col.sortable) ? h('span', { class: ["n-dt-sort", { 'is-active': internalSortField.value === col.field }], "data-v-17a3d2ce": "" }, [
199
+ "\n ",
200
+ (internalSortField.value !== col.field) ? h('span', { class: "n-dt-sort-icon", "data-v-17a3d2ce": "" }, [
196
201
  "↕"
197
- ]) : (true) ? h('span', { class: "n-dt-sort-icon", "data-v-71b71cd6": "" }, [
202
+ ]) : (true) ? h('span', { class: "n-dt-sort-icon", "data-v-17a3d2ce": "" }, [
198
203
  internalSortOrder.value === 1 ? '↑' : '↓'
199
- ]) : null
204
+ ]) : null,
205
+ "\n "
200
206
  ]) : null
201
207
  ]),
202
- (resizableColumns) ? h('span', { class: "n-dt-resizer", "data-field": col.field, onMousedown: startResize, "data-v-71b71cd6": "" }) : null
208
+ "\n ",
209
+ (resizableColumns) ? h('span', { class: "n-dt-resizer", "data-field": col.field, onMousedown: startResize, "data-v-17a3d2ce": "" }) : null
203
210
  ])
204
- )
211
+ ),
212
+ "\n "
205
213
  ]),
206
214
  "\n ",
207
- (filterDisplay === 'row') ? h('tr', { class: "n-dt-filter-row", "data-v-71b71cd6": "" }, [
208
- (selectionMode) ? h('th', { class: "n-dt-th is-selection", "data-v-71b71cd6": "" }) : null,
215
+ (filterDisplay === 'row') ? h('tr', { class: "n-dt-filter-row", "data-v-17a3d2ce": "" }, [
216
+ (selectionMode) ? h('th', { class: "n-dt-th is-selection", "data-v-17a3d2ce": "" }) : null,
209
217
  normalizeColumns.value.map((col, index) =>
210
- h('th', { class: ["n-dt-th", `is-${col.align}`], key: col.field, style: { width: getWidth(col) || undefined, minWidth: col.minWidth }, "data-v-71b71cd6": "" }, [
211
- (col.filterable) ? h('input', { class: "n-dt-filter", "data-field": col.field, value: (effectiveFilters.value[col.field]?.value) || '', placeholder: "Filter", onInput: onColumnFilterInput, "data-v-71b71cd6": "" }) : null
218
+ h('th', { class: ["n-dt-th", `is-${col.align}`], key: col.field, style: { width: getWidth(col) || undefined, minWidth: col.minWidth }, "data-v-17a3d2ce": "" }, [
219
+ (col.filterable) ? h('input', { class: "n-dt-filter", "data-field": col.field, value: (effectiveFilters.value[col.field]?.value) || '', placeholder: "Filter", onInput: onColumnFilterInput, "data-v-17a3d2ce": "" }) : null
212
220
  ])
213
221
  )
214
222
  ]) : null
215
223
  ]),
216
224
  "\n ",
217
- h('tbody', { class: "n-dt-tbody", "data-v-71b71cd6": "" }, [
225
+ h('tbody', { class: "n-dt-tbody", "data-v-17a3d2ce": "" }, [
218
226
  "\n ",
219
227
  visibleRows.value.map((row, i) =>
220
- h('tr', { class: ["n-dt-row", { 'is-selected': isRowSelected(row, i + internalFirst.value) }], key: getRowKey(row, i + internalFirst.value), onClick: ($event) => { toggleRowSelection(row, i + internalFirst.value) }, "data-v-71b71cd6": "" }, [
221
- (selectionMode) ? h('td', { class: "n-dt-td is-selection", "data-v-71b71cd6": "" }, [
222
- h('input', { class: "n-dt-selectbox", type: "checkbox", checked: isRowSelected(row, i + internalFirst.value), onClick: ($event) => { $event.stopPropagation(); (($event) => { toggleRowSelection(row, i + internalFirst.value) })($event) }, "data-v-71b71cd6": "" })
228
+ h('tr', { class: ["n-dt-row", { 'is-selected': isRowSelected(row, i + internalFirst.value) }], key: getRowKey(row, i + internalFirst.value), onClick: ($event) => { toggleRowSelection(row, i + internalFirst.value) }, "data-v-17a3d2ce": "" }, [
229
+ "\n ",
230
+ (selectionMode) ? h('td', { class: "n-dt-td is-selection", "data-v-17a3d2ce": "" }, [
231
+ h('input', { class: "n-dt-selectbox", type: "checkbox", checked: isRowSelected(row, i + internalFirst.value), onClick: ($event) => { $event.stopPropagation(); (($event) => { toggleRowSelection(row, i + internalFirst.value) })($event) }, "data-v-17a3d2ce": "" })
223
232
  ]) : null,
224
233
  normalizeColumns.value.map((col, index) =>
225
- h('td', { class: ["n-dt-td", `is-${col.align}`], key: col.field, style: { width: getWidth(col) || undefined, minWidth: col.minWidth }, "data-v-71b71cd6": "" }, [
226
- getCellContent(row, col, i + internalFirst.value)
234
+ h('td', { class: ["n-dt-td", `is-${col.align}`], key: col.field, style: { width: getWidth(col) || undefined, minWidth: col.minWidth }, "data-v-17a3d2ce": "" }, [
235
+ "\n ",
236
+ $slots.value && $slots.value[`body-${col.field}`] ? $slots[`body-${col.field}`]({ data: row, column: col, index: i + internalFirst.value }) : getCellContent(row, col, i + internalFirst.value),
237
+ "\n "
227
238
  ])
228
- )
239
+ ),
240
+ "\n "
229
241
  ])
230
242
  ),
231
243
  "\n ",
232
- (visibleRows.value.length === 0) ? h('tr', { class: "n-dt-empty-row", "data-v-71b71cd6": "" }, [
233
- h('td', { class: "n-dt-empty", colspan: normalizeColumns.value.length + (selectionMode ? 1 : 0), "data-v-71b71cd6": "" }, [
244
+ (visibleRows.value.length === 0) ? h('tr', { class: "n-dt-empty-row", "data-v-17a3d2ce": "" }, [
245
+ h('td', { class: "n-dt-empty", colspan: normalizeColumns.value.length + (selectionMode ? 1 : 0), "data-v-17a3d2ce": "" }, [
234
246
  emptyMessage
235
247
  ])
236
248
  ]) : null
@@ -240,13 +252,13 @@ _sfc_main.render = function(ctx) {
240
252
  "\n "
241
253
  ]),
242
254
  "\n ",
243
- (paginator) ? h(_ntc_NPaginator, { first: internalFirst.value, rows: internalRows.value, totalRecords: totalRecords.value, rowsPerPageOptions: rowsPerPageOptions, onPage: onPage, "data-v-71b71cd6": "" }) : null
255
+ (paginator) ? h(_ntc_NPaginator, { first: internalFirst.value, rows: internalRows.value, totalRecords: totalRecords.value, rowsPerPageOptions: rowsPerPageOptions, onPage: onPage, "data-v-17a3d2ce": "" }) : null
244
256
  ])
245
257
  }
246
- _sfc_main.__scopeId = 'data-v-71b71cd6'
258
+ _sfc_main.__scopeId = 'data-v-17a3d2ce'
247
259
  _sfc_main.__hmrId = 'NDataTable_nexa'
248
260
 
249
261
  export default _sfc_main
250
262
 
251
- const __style = `.n-dt[data-v-71b71cd6]{border:1px solid var(--n-color-border);border-radius:var(--n-radius-lg);background:var(--n-color-surface);overflow:hidden;font-family:var(--n-font-sans)}.n-dt-toolbar{display:flex;align-items:center;justify-content:space-between;padding:var(--n-space-3) var(--n-space-4);border-bottom:1px solid var(--n-color-border);background:linear-gradient(180deg,rgba(255,255,255,.04),rgba(0,0,0,.08))}.n-dt-global{display:flex;align-items:center;gap:var(--n-space-2)}.n-dt-global-input{width:280px;max-width:100%;background:var(--n-color-bg);border:1px solid var(--n-color-border);border-radius:var(--n-radius-md);padding:0.55rem 0.75rem;color:var(--n-color-text);font-size:var(--n-text-sm);outline:none;box-sizing:border-box}.n-dt-global-input:focus{border-color:var(--n-color-primary);box-shadow:0 0 0 3px var(--n-color-primary-light)}.n-dt-wrapper{width:100%;overflow:auto}.n-dt-table{width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed}.n-dt-thead{background:var(--n-color-surface)}.n-dt-th,.n-dt-td{padding:0.75rem 0.9rem;border-bottom:1px solid var(--n-color-border);color:var(--n-color-text);font-size:var(--n-text-sm);vertical-align:middle}.n-dt-th{position:relative;overflow:hidden;background:rgba(0,0,0,.10);color:var(--n-color-text-secondary);font-weight:var(--n-weight-semibold);user-select:none}.n-dt-th.is-sortable{cursor:pointer}.n-dt-th-content{display:flex;align-items:center;justify-content:space-between;gap:0.5rem}.n-dt-sort{display:inline-flex;align-items:center;gap:0.25rem;color:var(--n-color-text-muted)}.n-dt-sort.is-active{color:var(--n-color-primary)}.n-dt-resizer{position:absolute;right:0;top:0;bottom:0;width:8px;cursor:col-resize}.n-dt-filter-row .n-dt-th{background:rgba(0,0,0,.06)}.n-dt-filter{width:100%;max-width:100%;display:block;background:var(--n-color-bg);border:1px solid var(--n-color-border);border-radius:var(--n-radius-sm);padding:0.35rem 0.5rem;color:var(--n-color-text);font-size:var(--n-text-xs);outline:none;box-sizing:border-box}.n-dt-filter:focus{border-color:var(--n-color-primary)}.n-dt-td{background:transparent;color:var(--n-color-text)}.n-dt-row.is-selected .n-dt-td{background:rgba(59,130,246,.12)}.n-dt-table.is-striped .n-dt-row:nth-child(even) .n-dt-td{background:rgba(0,0,0,.06)}.n-dt-table.is-hover .n-dt-row:hover .n-dt-td{background:rgba(255,255,255,.06)}.n-dt-empty{text-align:center;color:var(--n-color-text-muted);padding:1.25rem}.is-left{text-align:left}.is-right{text-align:right}.is-center{text-align:center}.is-selection{width:44px;min-width:44px;max-width:44px;text-align:center}.n-dt-selectbox{width:16px;height:16px;accent-color:var(--n-color-primary)}.n-dt-check{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:4px;border:1px solid var(--n-color-border);color:var(--n-color-primary)}.is-grid .n-dt-td,.is-grid .n-dt-th{border-right:1px solid var(--n-color-border)}.is-grid .n-dt-td:last-child,.is-grid .n-dt-th:last-child{border-right:none}.n-dt-sm .n-dt-th,.n-dt-sm .n-dt-td{padding:0.55rem 0.7rem}.n-dt-lg .n-dt-th,.n-dt-lg .n-dt-td{padding:0.9rem 1rem}`
252
- injectStyle('data-v-71b71cd6', __style)
263
+ const __style = `.n-dt[data-v-17a3d2ce]{border:1px solid var(--n-color-border);border-radius:var(--n-radius-lg);background:var(--n-color-surface);overflow:hidden;font-family:var(--n-font-sans)}.n-dt-toolbar{display:flex;align-items:center;justify-content:space-between;padding:var(--n-space-3) var(--n-space-4);border-bottom:1px solid var(--n-color-border);background:linear-gradient(180deg,rgba(255,255,255,.04),rgba(0,0,0,.08))}.n-dt-global{display:flex;align-items:center;gap:var(--n-space-2)}.n-dt-global-input{width:280px;max-width:100%;background:var(--n-color-bg);border:1px solid var(--n-color-border);border-radius:var(--n-radius-md);padding:0.55rem 0.75rem;color:var(--n-color-text);font-size:var(--n-text-sm);outline:none;box-sizing:border-box}.n-dt-global-input:focus{border-color:var(--n-color-primary);box-shadow:0 0 0 3px var(--n-color-primary-light)}.n-dt-wrapper{width:100%;overflow:auto}.n-dt-table{width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed}.n-dt-thead{background:var(--n-color-surface)}.n-dt-th,.n-dt-td{padding:0.75rem 0.9rem;border-bottom:1px solid var(--n-color-border);color:var(--n-color-text);font-size:var(--n-text-sm);vertical-align:middle}.n-dt-th{position:relative;overflow:hidden;background:rgba(0,0,0,.10);color:var(--n-color-text-secondary);font-weight:var(--n-weight-semibold);user-select:none}.n-dt-th.is-sortable{cursor:pointer}.n-dt-th-content{display:flex;align-items:center;justify-content:space-between;gap:0.5rem}.n-dt-sort{display:inline-flex;align-items:center;gap:0.25rem;color:var(--n-color-text-muted)}.n-dt-sort.is-active{color:var(--n-color-primary)}.n-dt-resizer{position:absolute;right:0;top:0;bottom:0;width:8px;cursor:col-resize}.n-dt-filter-row .n-dt-th{background:rgba(0,0,0,.06)}.n-dt-filter{width:100%;max-width:100%;display:block;background:var(--n-color-bg);border:1px solid var(--n-color-border);border-radius:var(--n-radius-sm);padding:0.35rem 0.5rem;color:var(--n-color-text);font-size:var(--n-text-xs);outline:none;box-sizing:border-box}.n-dt-filter:focus{border-color:var(--n-color-primary)}.n-dt-td{background:transparent;color:var(--n-color-text)}.n-dt-row.is-selected .n-dt-td{background:rgba(59,130,246,.12)}.n-dt-table.is-striped .n-dt-row:nth-child(even) .n-dt-td{background:rgba(0,0,0,.06)}.n-dt-table.is-hover .n-dt-row:hover .n-dt-td{background:rgba(255,255,255,.06)}.n-dt-empty{text-align:center;color:var(--n-color-text-muted);padding:1.25rem}.is-left{text-align:left}.is-right{text-align:right}.is-center{text-align:center}.is-selection{width:44px;min-width:44px;max-width:44px;text-align:center}.n-dt-selectbox{width:16px;height:16px;accent-color:var(--n-color-primary)}.n-dt-check{display:inline-flex;align-items:center;justify-content:center;width:18px;height:18px;border-radius:4px;border:1px solid var(--n-color-border);color:var(--n-color-primary)}.is-grid .n-dt-td,.is-grid .n-dt-th{border-right:1px solid var(--n-color-border)}.is-grid .n-dt-td:last-child,.is-grid .n-dt-th:last-child{border-right:none}.n-dt-sm .n-dt-th,.n-dt-sm .n-dt-td{padding:0.55rem 0.7rem}.n-dt-lg .n-dt-th,.n-dt-lg .n-dt-td{padding:0.9rem 1rem}`
264
+ injectStyle('data-v-17a3d2ce', __style)
@@ -168,11 +168,28 @@ const startResize = (e) => { if (!props.resizableColumns) return; const field =
168
168
  <div class="n-dt-wrapper">
169
169
  <table class="n-dt-table" :class="{ 'is-striped': stripedRows, 'is-hover': hoverRows }">
170
170
  <thead class="n-dt-thead">
171
- <tr class="n-dt-head-row"><th v-if="selectionMode" class="n-dt-th is-selection"><input v-if="selectionMode === 'multiple'" class="n-dt-selectbox" type="checkbox" :checked="allVisibleSelected.value" @click.stop="toggleAllVisible" /></th><th v-for="col in normalizeColumns.value" :key="col.field" class="n-dt-th" :class="[`is-${col.align}`, col.sortable ? 'is-sortable' : '']" :style="{ width: getWidth(col) || undefined, minWidth: col.minWidth }" :data-field="col.field" @click="onSortClick"><div class="n-dt-th-content"><span class="n-dt-th-text">{{ getHeaderContent(col) }}</span><span v-if="col.sortable" class="n-dt-sort" :class="{ 'is-active': internalSortField.value === col.field }"><span v-if="internalSortField.value !== col.field" class="n-dt-sort-icon">↕</span><span v-else class="n-dt-sort-icon">{{ internalSortOrder.value === 1 ? '↑' : '↓' }}</span></span></div><span v-if="resizableColumns" class="n-dt-resizer" :data-field="col.field" @mousedown="startResize"></span></th></tr>
171
+ <tr class="n-dt-head-row">
172
+ <th v-if="selectionMode" class="n-dt-th is-selection"><input v-if="selectionMode === 'multiple'" class="n-dt-selectbox" type="checkbox" :checked="allVisibleSelected.value" @click.stop="toggleAllVisible" /></th>
173
+ <th v-for="col in normalizeColumns.value" :key="col.field" class="n-dt-th" :class="[`is-${col.align}`, col.sortable ? 'is-sortable' : '']" :style="{ width: getWidth(col) || undefined, minWidth: col.minWidth }" :data-field="col.field" @click="onSortClick">
174
+ <div class="n-dt-th-content">
175
+ <span class="n-dt-th-text">{{ $slots.value && $slots.value[`header-${col.field}`] ? $slots[`header-${col.field}`]({ column: col }) : getHeaderContent(col) }}</span>
176
+ <span v-if="col.sortable" class="n-dt-sort" :class="{ 'is-active': internalSortField.value === col.field }">
177
+ <span v-if="internalSortField.value !== col.field" class="n-dt-sort-icon">↕</span>
178
+ <span v-else class="n-dt-sort-icon">{{ internalSortOrder.value === 1 ? '↑' : '↓' }}</span>
179
+ </span>
180
+ </div>
181
+ <span v-if="resizableColumns" class="n-dt-resizer" :data-field="col.field" @mousedown="startResize"></span>
182
+ </th>
183
+ </tr>
172
184
  <tr v-if="filterDisplay === 'row'" class="n-dt-filter-row"><th v-if="selectionMode" class="n-dt-th is-selection"></th><th v-for="col in normalizeColumns.value" :key="col.field" class="n-dt-th" :class="`is-${col.align}`" :style="{ width: getWidth(col) || undefined, minWidth: col.minWidth }"><input v-if="col.filterable" class="n-dt-filter" :data-field="col.field" :value="(effectiveFilters.value[col.field]?.value) || ''" placeholder="Filter" @input="onColumnFilterInput" /></th></tr>
173
185
  </thead>
174
186
  <tbody class="n-dt-tbody">
175
- <tr v-for="(row, i) in visibleRows.value" :key="getRowKey(row, i + internalFirst.value)" class="n-dt-row" :class="{ 'is-selected': isRowSelected(row, i + internalFirst.value) }" @click="toggleRowSelection(row, i + internalFirst.value)"><td v-if="selectionMode" class="n-dt-td is-selection"><input class="n-dt-selectbox" type="checkbox" :checked="isRowSelected(row, i + internalFirst.value)" @click.stop="toggleRowSelection(row, i + internalFirst.value)" /></td><td v-for="col in normalizeColumns.value" :key="col.field" class="n-dt-td" :class="`is-${col.align}`" :style="{ width: getWidth(col) || undefined, minWidth: col.minWidth }">{{ getCellContent(row, col, i + internalFirst.value) }}</td></tr>
187
+ <tr v-for="(row, i) in visibleRows.value" :key="getRowKey(row, i + internalFirst.value)" class="n-dt-row" :class="{ 'is-selected': isRowSelected(row, i + internalFirst.value) }" @click="toggleRowSelection(row, i + internalFirst.value)">
188
+ <td v-if="selectionMode" class="n-dt-td is-selection"><input class="n-dt-selectbox" type="checkbox" :checked="isRowSelected(row, i + internalFirst.value)" @click.stop="toggleRowSelection(row, i + internalFirst.value)" /></td>
189
+ <td v-for="col in normalizeColumns.value" :key="col.field" class="n-dt-td" :class="`is-${col.align}`" :style="{ width: getWidth(col) || undefined, minWidth: col.minWidth }">
190
+ {{ $slots.value && $slots.value[`body-${col.field}`] ? $slots[`body-${col.field}`]({ data: row, column: col, index: i + internalFirst.value }) : getCellContent(row, col, i + internalFirst.value) }}
191
+ </td>
192
+ </tr>
176
193
  <tr v-if="visibleRows.value.length === 0" class="n-dt-empty-row"><td :colspan="normalizeColumns.value.length + (selectionMode ? 1 : 0)" class="n-dt-empty">{{ emptyMessage }}</td></tr>
177
194
  </tbody>
178
195
  </table>
@@ -0,0 +1,104 @@
1
+ import { signal, computed, onMounted, onUnmounted, h, hText, effect, defineComponent, registerComponent, reloadComponent, injectStyle } from 'nexa-framework'
2
+
3
+ const _sfc_main = defineComponent({
4
+ __scopeId: 'data-v-1f83e1a6',
5
+ __hmrId: 'NImage_nexa',
6
+ props: {
7
+ src: { type: String, required: true },
8
+ alt: { type: String, default: '' },
9
+ fallback: { type: String, default: '' },
10
+ fit: { type: String, default: 'cover' },
11
+ lazy: { type: Boolean, default: true },
12
+ width: { type: String, default: null },
13
+ height: { type: String, default: null },
14
+ rounded: { type: Boolean, default: false },
15
+ blur: { type: Boolean, default: true }
16
+ },
17
+ setup(props, setupContext) {
18
+ const { emit, slots, slots: $slots } = setupContext
19
+ const loaded = signal(false)
20
+ const error = signal(false)
21
+ const visible = signal(!props.lazy)
22
+ let observer = null
23
+ let imgRef = null
24
+ const currentSrc = computed(() => {
25
+ if (error.value && props.fallback) return props.fallback
26
+ return props.src
27
+ })
28
+ const wrapperStyle = computed(() => ({
29
+ width: props.width ?? '100%',
30
+ height: props.height ?? 'auto',
31
+ position: 'relative',
32
+ overflow: 'hidden',
33
+ display: 'block',
34
+ borderRadius: props.rounded ? '50%' : undefined
35
+ }))
36
+ const imgStyle = computed(() => ({
37
+ width: '100%',
38
+ height: '100%',
39
+ objectFit: props.fit,
40
+ transition: 'opacity 0.3s ease, filter 0.4s ease',
41
+ opacity: loaded.value ? '1' : '0',
42
+ filter: (props.blur && !loaded.value) ? 'blur(8px)' : 'none'
43
+ }))
44
+ onMounted(() => {
45
+ if (!props.lazy) return
46
+ observer = new IntersectionObserver(entries => {
47
+ if (entries[0].isIntersecting) {
48
+ visible.value = true
49
+ observer?.disconnect()
50
+ }
51
+ }, { rootMargin: '200px' })
52
+ if (imgRef) observer.observe(imgRef)
53
+ })
54
+ onUnmounted(() => {
55
+ observer?.disconnect()
56
+ })
57
+ const onLoad = () => { console.log('ON_LOAD_CALLED'); loaded.value = true }
58
+ const onError = () => { console.log('ON_ERROR_CALLED'); error.value = true; loaded.value = true }
59
+ return { loaded, error, visible, observer, imgRef, currentSrc, wrapperStyle, imgStyle, onLoad, onError, $slots }
60
+ }
61
+ })
62
+ // Injected render function
63
+ _sfc_main.render = function(ctx) {
64
+ const { loaded, error, visible, observer, imgRef, currentSrc, wrapperStyle, imgStyle, onLoad, onError, $slots, src, alt, fallback, fit, lazy, width, height, rounded, blur, Fragment: _ntc_Fragment } = ctx
65
+ return h('span', { class: "n-image-wrapper", style: wrapperStyle.value, ref: el => imgRef = el, "data-v-1f83e1a6": "" }, [
66
+ "\n ",
67
+ (!loaded.value) ? h('span', { class: "n-image-skeleton", "data-v-1f83e1a6": "" }) : null,
68
+ (visible.value) ? h('img', { class: "n-image", src: currentSrc.value, alt: alt, style: { width: '100%', height: '100%', objectFit: fit, transition: 'opacity 0.3s ease, filter 0.4s ease', opacity: loaded.value ? '1' : '0', filter: (blur && !loaded.value) ? 'blur(8px)' : 'none' }, onLoad: onLoad, onError: onError, "data-v-1f83e1a6": "" }) : null
69
+ ])
70
+ }
71
+ _sfc_main.__scopeId = 'data-v-1f83e1a6'
72
+ _sfc_main.__hmrId = 'NImage_nexa'
73
+
74
+ export default _sfc_main
75
+
76
+ const __style = `.n-image-wrapper[data-v-1f83e1a6]{
77
+ background: var(--n-color-surface-hover, #1a1a2e);
78
+ display: inline-block;
79
+ }
80
+
81
+ .n-image-skeleton[data-v-1f83e1a6]{
82
+ position: absolute;
83
+ inset: 0;
84
+ background: linear-gradient(
85
+ 90deg,
86
+ var(--n-color-surface, #111827) 25%,
87
+ var(--n-color-surface-hover, #1f2937) 50%,
88
+ var(--n-color-surface, #111827) 75%
89
+ );
90
+ background-size: 200% 100%;
91
+ animation: n-img-shimmer 1.5s infinite;
92
+ }
93
+
94
+ @keyframes n-img-shimmer {
95
+ 0%[data-v-1f83e1a6]{ background-position: 200% 0; }
96
+ 100%[data-v-1f83e1a6]{ background-position: -200% 0; }
97
+ }
98
+
99
+ .n-image[data-v-1f83e1a6]{
100
+ display: block;
101
+ position: relative;
102
+ z-index: 1;
103
+ }`
104
+ injectStyle('data-v-1f83e1a6', __style)
@@ -0,0 +1,112 @@
1
+ <script setup>
2
+ import { signal, computed, onMounted, onUnmounted } from 'nexa-framework'
3
+
4
+ const props = defineProps({
5
+ src: { type: String, required: true },
6
+ alt: { type: String, default: '' },
7
+ fallback: { type: String, default: '' },
8
+ fit: { type: String, default: 'cover' },
9
+ lazy: { type: Boolean, default: true },
10
+ width: { type: String, default: null },
11
+ height: { type: String, default: null },
12
+ rounded: { type: Boolean, default: false },
13
+ blur: { type: Boolean, default: true }
14
+ })
15
+
16
+ const loaded = signal(false)
17
+ const error = signal(false)
18
+ const visible = signal(!props.lazy)
19
+ let observer = null
20
+ let imgRef = null
21
+
22
+ const currentSrc = computed(() => {
23
+ if (error.value && props.fallback) return props.fallback
24
+ return props.src
25
+ })
26
+
27
+ const wrapperStyle = computed(() => ({
28
+ width: props.width ?? '100%',
29
+ height: props.height ?? 'auto',
30
+ position: 'relative',
31
+ overflow: 'hidden',
32
+ display: 'block',
33
+ borderRadius: props.rounded ? '50%' : undefined
34
+ }))
35
+
36
+ const imgStyle = computed(() => ({
37
+ width: '100%',
38
+ height: '100%',
39
+ objectFit: props.fit,
40
+ transition: 'opacity 0.3s ease, filter 0.4s ease',
41
+ opacity: loaded.value ? '1' : '0',
42
+ filter: (props.blur && !loaded.value) ? 'blur(8px)' : 'none'
43
+ }))
44
+
45
+ onMounted(() => {
46
+ if (!props.lazy) return
47
+ observer = new IntersectionObserver(entries => {
48
+ if (entries[0].isIntersecting) {
49
+ visible.value = true
50
+ observer?.disconnect()
51
+ }
52
+ }, { rootMargin: '200px' })
53
+ if (imgRef) observer.observe(imgRef)
54
+ })
55
+
56
+ onUnmounted(() => {
57
+ observer?.disconnect()
58
+ })
59
+
60
+ const onLoad = () => { console.log('ON_LOAD_CALLED'); loaded.value = true }
61
+ const onError = () => { console.log('ON_ERROR_CALLED'); error.value = true; loaded.value = true }
62
+ </script>
63
+
64
+ <template>
65
+ <span
66
+ class="n-image-wrapper"
67
+ :style="wrapperStyle.value"
68
+ :ref="el => imgRef = el"
69
+ >
70
+ <span v-if="!loaded.value" class="n-image-skeleton" />
71
+ <img
72
+ v-if="visible.value"
73
+ :src="currentSrc.value"
74
+ :alt="alt"
75
+ :style="{ width: '100%', height: '100%', objectFit: fit, transition: 'opacity 0.3s ease, filter 0.4s ease', opacity: loaded.value ? '1' : '0', filter: (blur && !loaded.value) ? 'blur(8px)' : 'none' }"
76
+ class="n-image"
77
+ @load="onLoad"
78
+ @error="onError"
79
+ />
80
+ </span>
81
+ </template>
82
+
83
+ <style scoped>
84
+ .n-image-wrapper {
85
+ background: var(--n-color-surface-hover, #1a1a2e);
86
+ display: inline-block;
87
+ }
88
+
89
+ .n-image-skeleton {
90
+ position: absolute;
91
+ inset: 0;
92
+ background: linear-gradient(
93
+ 90deg,
94
+ var(--n-color-surface, #111827) 25%,
95
+ var(--n-color-surface-hover, #1f2937) 50%,
96
+ var(--n-color-surface, #111827) 75%
97
+ );
98
+ background-size: 200% 100%;
99
+ animation: n-img-shimmer 1.5s infinite;
100
+ }
101
+
102
+ @keyframes n-img-shimmer {
103
+ 0% { background-position: 200% 0; }
104
+ 100% { background-position: -200% 0; }
105
+ }
106
+
107
+ .n-image {
108
+ display: block;
109
+ position: relative;
110
+ z-index: 1;
111
+ }
112
+ </style>
@@ -1,13 +1,14 @@
1
1
  import { signal, effect, onMounted, onUnmounted, h, hText, defineComponent, registerComponent, reloadComponent, injectStyle, Teleport } from 'nexa-framework'
2
2
 
3
3
  const _sfc_main = defineComponent({
4
- __scopeId: 'data-v-42ba3820',
4
+ __scopeId: 'data-v-39fa634f',
5
5
  __hmrId: 'NModal_nexa',
6
6
  props: {
7
7
  show: { type: Boolean, default: false },
8
8
  title: { type: String, default: '' },
9
9
  size: { type: String, default: 'md' },
10
- closable: { type: Boolean, default: true }
10
+ closable: { type: Boolean, default: true },
11
+ closeLeft: { type: Boolean, default: false }
11
12
  },
12
13
  emits: ['close'],
13
14
  setup(props, setupContext) {
@@ -76,30 +77,35 @@ const _sfc_main = defineComponent({
76
77
  })
77
78
  // Injected render function
78
79
  _sfc_main.render = function(ctx) {
79
- const { isVisible, modalEl, previousFocus, bodyOverflow, sizeMap, close, handleEsc, handleOverlayClick, focusableSelector, handleKeydown, $slots, emit, show, title, size, closable, Fragment: _ntc_Fragment, Teleport: _ntc_Teleport } = ctx
80
- return h(_ntc_Teleport, { to: "body", "data-v-42ba3820": "" }, [
80
+ const { isVisible, modalEl, previousFocus, bodyOverflow, sizeMap, close, handleEsc, handleOverlayClick, focusableSelector, handleKeydown, $slots, emit, show, title, size, closable, closeLeft, Fragment: _ntc_Fragment, Teleport: _ntc_Teleport } = ctx
81
+ return h(_ntc_Teleport, { to: "body", "data-v-39fa634f": "" }, [
81
82
  "\n ",
82
- (isVisible.value) ? h('div', { class: "n-modal-root", "data-v-42ba3820": "" }, [
83
+ (isVisible.value) ? h('div', { class: "n-modal-root", "data-v-39fa634f": "" }, [
83
84
  "\n ",
84
- h('div', { class: ["n-modal-overlay", { 'is-active': show }], onClick: handleOverlayClick, "data-v-42ba3820": "" }),
85
+ h('div', { class: ["n-modal-overlay", { 'is-active': show }], onClick: handleOverlayClick, "data-v-39fa634f": "" }),
85
86
  "\n ",
86
- h('div', { class: ["n-modal-container", { 'is-active': show }], ref: "modalEl", style: { maxWidth: sizeMap[size] || size }, tabindex: "-1", onKeydown: handleKeydown, "data-v-42ba3820": "" }, [
87
+ h('div', { class: ["n-modal-container", { 'is-active': show }], ref: "modalEl", style: { maxWidth: sizeMap[size] || size }, tabindex: "-1", onKeydown: handleKeydown, "data-v-39fa634f": "" }, [
87
88
  "\n ",
88
- (title) ? h('div', { class: "n-modal-header", "data-v-42ba3820": "" }, [
89
+ (title || $slots.header) ? h('div', { class: ["n-modal-header", { 'close-left': closeLeft }], "data-v-39fa634f": "" }, [
89
90
  "\n ",
90
- ctx.$slots.header ? ctx.$slots.header() : null,
91
+ (closable && closeLeft) ? h('button', { class: "n-modal-close", onClick: close, "aria-label": "Close", "data-v-39fa634f": "" }, [
92
+ "×"
93
+ ]) : null,
94
+ ctx.$slots.header ? ctx.$slots.header() : ["\n ", h('h3', null, [
95
+ title
96
+ ]), "\n "],
91
97
  "\n ",
92
- (closable) ? h('button', { class: "n-modal-close", onClick: close, "aria-label": "Close", "data-v-42ba3820": "" }, [
98
+ (closable && !closeLeft) ? h('button', { class: "n-modal-close", onClick: close, "aria-label": "Close", "data-v-39fa634f": "" }, [
93
99
  "×"
94
100
  ]) : null
95
101
  ]) : null,
96
- h('div', { class: "n-modal-content", "data-v-42ba3820": "" }, [
102
+ h('div', { class: "n-modal-content", "data-v-39fa634f": "" }, [
97
103
  "\n ",
98
104
  ctx.$slots.default ? ctx.$slots.default() : null,
99
105
  "\n "
100
106
  ]),
101
107
  "\n ",
102
- ($slots.footer) ? h('div', { class: "n-modal-footer", "data-v-42ba3820": "" }, [
108
+ ($slots.footer) ? h('div', { class: "n-modal-footer", "data-v-39fa634f": "" }, [
103
109
  "\n ",
104
110
  ctx.$slots.footer ? ctx.$slots.footer() : null,
105
111
  "\n "
@@ -109,12 +115,12 @@ _sfc_main.render = function(ctx) {
109
115
  ]) : null
110
116
  ])
111
117
  }
112
- _sfc_main.__scopeId = 'data-v-42ba3820'
118
+ _sfc_main.__scopeId = 'data-v-39fa634f'
113
119
  _sfc_main.__hmrId = 'NModal_nexa'
114
120
 
115
121
  export default _sfc_main
116
122
 
117
- const __style = `.n-modal-root[data-v-42ba3820]{
123
+ const __style = `.n-modal-root[data-v-39fa634f]{
118
124
  position: fixed;
119
125
  top: 0;
120
126
  left: 0;
@@ -126,7 +132,7 @@ const __style = `.n-modal-root[data-v-42ba3820]{
126
132
  z-index: var(--n-z-modal);
127
133
  }
128
134
 
129
- .n-modal-overlay[data-v-42ba3820]{
135
+ .n-modal-overlay[data-v-39fa634f]{
130
136
  position: absolute;
131
137
  top: 0;
132
138
  left: 0;
@@ -138,11 +144,11 @@ const __style = `.n-modal-root[data-v-42ba3820]{
138
144
  transition: opacity 0.25s ease;
139
145
  }
140
146
 
141
- .n-modal-overlay.is-active[data-v-42ba3820]{
147
+ .n-modal-overlay.is-active[data-v-39fa634f]{
142
148
  opacity: 1;
143
149
  }
144
150
 
145
- .n-modal-container[data-v-42ba3820]{
151
+ .n-modal-container[data-v-39fa634f]{
146
152
  position: relative;
147
153
  width: 90%;
148
154
  background: var(--n-color-surface);
@@ -159,12 +165,12 @@ const __style = `.n-modal-root[data-v-42ba3820]{
159
165
  flex-direction: column;
160
166
  }
161
167
 
162
- .n-modal-container.is-active[data-v-42ba3820]{
168
+ .n-modal-container.is-active[data-v-39fa634f]{
163
169
  transform: scale(1) translateY(0);
164
170
  opacity: 1;
165
171
  }
166
172
 
167
- .n-modal-header[data-v-42ba3820]{
173
+ .n-modal-header[data-v-39fa634f]{
168
174
  padding: var(--n-space-6) var(--n-space-8);
169
175
  border-bottom: 1px solid var(--n-color-border);
170
176
  display: flex;
@@ -173,14 +179,14 @@ const __style = `.n-modal-root[data-v-42ba3820]{
173
179
  flex-shrink: 0;
174
180
  }
175
181
 
176
- .n-modal-header h3[data-v-42ba3820]{
182
+ .n-modal-header h3[data-v-39fa634f]{
177
183
  margin: 0;
178
184
  font-size: var(--n-text-xl);
179
185
  font-weight: var(--n-weight-bold);
180
186
  color: var(--n-color-text);
181
187
  }
182
188
 
183
- .n-modal-close[data-v-42ba3820]{
189
+ .n-modal-close[data-v-39fa634f]{
184
190
  background: transparent;
185
191
  border: none;
186
192
  color: var(--n-color-text-secondary);
@@ -197,19 +203,19 @@ const __style = `.n-modal-root[data-v-42ba3820]{
197
203
  border-radius: var(--n-radius-sm);
198
204
  }
199
205
 
200
- .n-modal-close[data-v-42ba3820]:hover{
206
+ .n-modal-close[data-v-39fa634f]:hover{
201
207
  color: var(--n-color-text);
202
208
  background: var(--n-color-glass);
203
209
  }
204
210
 
205
- .n-modal-content[data-v-42ba3820]{
211
+ .n-modal-content[data-v-39fa634f]{
206
212
  padding: var(--n-space-8);
207
213
  color: var(--n-color-text-secondary);
208
214
  overflow-y: auto;
209
215
  flex: 1;
210
216
  }
211
217
 
212
- .n-modal-footer[data-v-42ba3820]{
218
+ .n-modal-footer[data-v-39fa634f]{
213
219
  padding: var(--n-space-5) var(--n-space-8);
214
220
  background: rgba(0, 0, 0, 0.15);
215
221
  border-top: 1px solid var(--n-color-border);
@@ -218,4 +224,4 @@ const __style = `.n-modal-root[data-v-42ba3820]{
218
224
  gap: var(--n-space-4);
219
225
  flex-shrink: 0;
220
226
  }`
221
- injectStyle('data-v-42ba3820', __style)
227
+ injectStyle('data-v-39fa634f', __style)
@@ -5,7 +5,8 @@ const props = defineProps({
5
5
  show: { type: Boolean, default: false },
6
6
  title: { type: String, default: '' },
7
7
  size: { type: String, default: 'md' },
8
- closable: { type: Boolean, default: true }
8
+ closable: { type: Boolean, default: true },
9
+ closeLeft: { type: Boolean, default: false }
9
10
  })
10
11
 
11
12
  const emit = defineEmits(['close'])
@@ -96,11 +97,12 @@ onUnmounted(() => {
96
97
  tabindex="-1"
97
98
  @keydown="handleKeydown"
98
99
  >
99
- <div v-if="title" class="n-modal-header">
100
+ <div v-if="title || $slots.header" class="n-modal-header" :class="{ 'close-left': closeLeft }">
101
+ <button v-if="closable && closeLeft" class="n-modal-close" @click="close" aria-label="Close">&times;</button>
100
102
  <slot name="header">
101
103
  <h3>{{ title }}</h3>
102
104
  </slot>
103
- <button v-if="closable" class="n-modal-close" @click="close" aria-label="Close">&times;</button>
105
+ <button v-if="closable && !closeLeft" class="n-modal-close" @click="close" aria-label="Close">&times;</button>
104
106
  </div>
105
107
  <div class="n-modal-content">
106
108
  <slot />