nexa-ui-kit 0.6.4 → 0.7.1

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,108 @@
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-309b6eb8',
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
+ const imgRef = signal(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
+ const setRef = (el) => {
45
+ imgRef.value = el
46
+ if (observer && el) observer.observe(el)
47
+ }
48
+ onMounted(() => {
49
+ if (!props.lazy) return
50
+ observer = new IntersectionObserver(entries => {
51
+ if (entries[0].isIntersecting) {
52
+ visible.value = true
53
+ observer?.disconnect()
54
+ }
55
+ }, { rootMargin: '200px' })
56
+ if (imgRef.value) observer.observe(imgRef.value)
57
+ })
58
+ onUnmounted(() => {
59
+ observer?.disconnect()
60
+ })
61
+ const onLoad = () => { loaded.value = true }
62
+ const onError = () => { error.value = true; loaded.value = true }
63
+ return { loaded, error, visible, observer, imgRef, currentSrc, wrapperStyle, imgStyle, setRef, onLoad, onError, $slots }
64
+ }
65
+ })
66
+ // Injected render function
67
+ _sfc_main.render = function(ctx) {
68
+ const { loaded, error, visible, observer, imgRef, currentSrc, wrapperStyle, imgStyle, setRef, onLoad, onError, $slots, src, alt, fallback, fit, lazy, width, height, rounded, blur, Fragment: _ntc_Fragment } = ctx
69
+ return h('span', { class: "n-image-wrapper", style: wrapperStyle.value, ref: setRef, "data-v-309b6eb8": "" }, [
70
+ "\n ",
71
+ (!loaded.value) ? h('span', { class: "n-image-skeleton", "data-v-309b6eb8": "" }) : null,
72
+ (visible.value) ? h('img', { class: "n-image", src: currentSrc.value, alt: alt, style: imgStyle.value, onLoad: onLoad, onError: onError, "data-v-309b6eb8": "" }) : null
73
+ ])
74
+ }
75
+ _sfc_main.__scopeId = 'data-v-309b6eb8'
76
+ _sfc_main.__hmrId = 'NImage_nexa'
77
+
78
+ export default _sfc_main
79
+
80
+ const __style = `.n-image-wrapper[data-v-309b6eb8]{
81
+ background: var(--n-color-surface-hover, #1a1a2e);
82
+ display: inline-block;
83
+ }
84
+
85
+ .n-image-skeleton[data-v-309b6eb8]{
86
+ position: absolute;
87
+ inset: 0;
88
+ background: linear-gradient(
89
+ 90deg,
90
+ var(--n-color-surface, #111827) 25%,
91
+ var(--n-color-surface-hover, #1f2937) 50%,
92
+ var(--n-color-surface, #111827) 75%
93
+ );
94
+ background-size: 200% 100%;
95
+ animation: n-img-shimmer 1.5s infinite;
96
+ }
97
+
98
+ @keyframes n-img-shimmer {
99
+ 0%[data-v-309b6eb8]{ background-position: 200% 0; }
100
+ 100%[data-v-309b6eb8]{ background-position: -200% 0; }
101
+ }
102
+
103
+ .n-image[data-v-309b6eb8]{
104
+ display: block;
105
+ position: relative;
106
+ z-index: 1;
107
+ }`
108
+ injectStyle('data-v-309b6eb8', __style)
@@ -0,0 +1,117 @@
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
+ const imgRef = signal(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
+ const setRef = (el) => {
46
+ imgRef.value = el
47
+ if (observer && el) observer.observe(el)
48
+ }
49
+
50
+ onMounted(() => {
51
+ if (!props.lazy) return
52
+ observer = new IntersectionObserver(entries => {
53
+ if (entries[0].isIntersecting) {
54
+ visible.value = true
55
+ observer?.disconnect()
56
+ }
57
+ }, { rootMargin: '200px' })
58
+ if (imgRef.value) observer.observe(imgRef.value)
59
+ })
60
+
61
+ onUnmounted(() => {
62
+ observer?.disconnect()
63
+ })
64
+
65
+ const onLoad = () => { loaded.value = true }
66
+ const onError = () => { error.value = true; loaded.value = true }
67
+ </script>
68
+
69
+ <template>
70
+ <span
71
+ class="n-image-wrapper"
72
+ :style="wrapperStyle.value"
73
+ :ref="setRef"
74
+ >
75
+ <span v-if="!loaded.value" class="n-image-skeleton" />
76
+ <img
77
+ v-if="visible.value"
78
+ :src="currentSrc.value"
79
+ :alt="alt"
80
+ :style="imgStyle.value"
81
+ class="n-image"
82
+ @load="onLoad"
83
+ @error="onError"
84
+ />
85
+ </span>
86
+ </template>
87
+
88
+ <style scoped>
89
+ .n-image-wrapper {
90
+ background: var(--n-color-surface-hover, #1a1a2e);
91
+ display: inline-block;
92
+ }
93
+
94
+ .n-image-skeleton {
95
+ position: absolute;
96
+ inset: 0;
97
+ background: linear-gradient(
98
+ 90deg,
99
+ var(--n-color-surface, #111827) 25%,
100
+ var(--n-color-surface-hover, #1f2937) 50%,
101
+ var(--n-color-surface, #111827) 75%
102
+ );
103
+ background-size: 200% 100%;
104
+ animation: n-img-shimmer 1.5s infinite;
105
+ }
106
+
107
+ @keyframes n-img-shimmer {
108
+ 0% { background-position: 200% 0; }
109
+ 100% { background-position: -200% 0; }
110
+ }
111
+
112
+ .n-image {
113
+ display: block;
114
+ position: relative;
115
+ z-index: 1;
116
+ }
117
+ </style>
@@ -91,7 +91,9 @@ _sfc_main.render = function(ctx) {
91
91
  (closable && closeLeft) ? h('button', { class: "n-modal-close", onClick: close, "aria-label": "Close", "data-v-39fa634f": "" }, [
92
92
  "×"
93
93
  ]) : null,
94
- ctx.$slots.header ? ctx.$slots.header() : null,
94
+ ctx.$slots.header ? ctx.$slots.header() : ["\n ", h('h3', null, [
95
+ title
96
+ ]), "\n "],
95
97
  "\n ",
96
98
  (closable && !closeLeft) ? h('button', { class: "n-modal-close", onClick: close, "aria-label": "Close", "data-v-39fa634f": "" }, [
97
99
  "×"
@@ -0,0 +1,128 @@
1
+ import { signal, computed, h, hText, effect, defineComponent, registerComponent, reloadComponent, injectStyle } from 'nexa-framework'
2
+
3
+ const _sfc_main = defineComponent({
4
+ __scopeId: 'data-v-7469d561',
5
+ __hmrId: 'NScrollView_nexa',
6
+ props: {
7
+ onRefresh: { type: Function, default: null },
8
+ onEndReached: { type: Function, default: null },
9
+ endReachedThreshold: { type: Number, default: 80 },
10
+ horizontal: { type: Boolean, default: false }
11
+ },
12
+ setup(props, setupContext) {
13
+ const { emit, slots, slots: $slots } = setupContext
14
+ const isRefreshing = signal(false)
15
+ const pullDelta = signal(0)
16
+ const refreshThreshold = 60
17
+ let touchStartY = 0
18
+ let startScrollTop = 0
19
+ const pullProgress = computed(() =>
20
+ Math.min(1, pullDelta.value / refreshThreshold)
21
+ )
22
+ const spinnerScale = computed(() =>
23
+ `scale(${pullProgress.value})`
24
+ )
25
+ const onTouchStart = (e) => {
26
+ const container = e.currentTarget
27
+ startScrollTop = container.scrollTop
28
+ touchStartY = e.touches[0].clientY
29
+ }
30
+ const onTouchMove = (e) => {
31
+ if (isRefreshing.value || !props.onRefresh) return
32
+ const container = e.currentTarget
33
+ const dy = e.touches[0].clientY - touchStartY
34
+ if (container.scrollTop === 0 && dy > 0 && startScrollTop === 0) {
35
+ pullDelta.value = Math.min(dy * 0.5, refreshThreshold * 1.5)
36
+ }
37
+ }
38
+ const onTouchEnd = async () => {
39
+ if (!props.onRefresh || pullDelta.value < refreshThreshold) {
40
+ pullDelta.value = 0
41
+ return
42
+ }
43
+ isRefreshing.value = true
44
+ pullDelta.value = 0
45
+ try {
46
+ await props.onRefresh()
47
+ } finally {
48
+ isRefreshing.value = false
49
+ }
50
+ }
51
+ const onScroll = (e) => {
52
+ if (!props.onEndReached) return
53
+ const el = e.target
54
+ const distanceFromBottom = props.horizontal
55
+ ? el.scrollWidth - el.scrollLeft - el.clientWidth
56
+ : el.scrollHeight - el.scrollTop - el.clientHeight
57
+ if (distanceFromBottom <= props.endReachedThreshold) {
58
+ props.onEndReached()
59
+ }
60
+ }
61
+ return { isRefreshing, pullDelta, refreshThreshold, touchStartY, startScrollTop, pullProgress, spinnerScale, onTouchStart, onTouchMove, onTouchEnd, onScroll, $slots }
62
+ }
63
+ })
64
+ // Injected render function
65
+ _sfc_main.render = function(ctx) {
66
+ const { isRefreshing, pullDelta, refreshThreshold, touchStartY, startScrollTop, pullProgress, spinnerScale, onTouchStart, onTouchMove, onTouchEnd, onScroll, $slots, onRefresh, onEndReached, endReachedThreshold, horizontal, Fragment: _ntc_Fragment } = ctx
67
+ return h('div', { class: ["n-scroll-view", { 'n-scroll-view--horizontal': horizontal }], onScroll: onScroll, onTouchstart: onTouchStart, onTouchmove: onTouchMove, onTouchend: onTouchEnd, "data-v-7469d561": "" }, [
68
+ "\n ",
69
+ (onRefresh) ? h('div', { class: ["n-scroll-view-ptr", { 'is-refreshing': isRefreshing.value }], style: { height: pullDelta.value + 'px' }, "data-v-7469d561": "" }, [
70
+ "\n ",
71
+ h('div', { class: "n-scroll-view-spinner", style: { transform: isRefreshing.value ? 'scale(1)' : spinnerScale.value }, "data-v-7469d561": "" }, [
72
+ "\n ⟳\n "
73
+ ]),
74
+ "\n "
75
+ ]) : null,
76
+ ctx.$slots.default ? ctx.$slots.default() : null,
77
+ "\n "
78
+ ])
79
+ }
80
+ _sfc_main.__scopeId = 'data-v-7469d561'
81
+ _sfc_main.__hmrId = 'NScrollView_nexa'
82
+
83
+ export default _sfc_main
84
+
85
+ const __style = `.n-scroll-view[data-v-7469d561]{
86
+ overflow-y: auto;
87
+ overflow-x: hidden;
88
+ width: 100%;
89
+ height: 100%;
90
+ -webkit-overflow-scrolling: touch;
91
+ overscroll-behavior: contain;
92
+ position: relative;
93
+ }
94
+
95
+ .n-scroll-view--horizontal[data-v-7469d561]{
96
+ overflow-y: hidden;
97
+ overflow-x: auto;
98
+ display: flex;
99
+ }
100
+
101
+ .n-scroll-view-ptr[data-v-7469d561]{
102
+ display: flex;
103
+ align-items: center;
104
+ justify-content: center;
105
+ overflow: hidden;
106
+ transition: height 0.1s;
107
+ }
108
+
109
+ .n-scroll-view-ptr.is-refreshing[data-v-7469d561]{
110
+ height: 52px !important;
111
+ }
112
+
113
+ .n-scroll-view-spinner[data-v-7469d561]{
114
+ font-size: 24px;
115
+ color: var(--n-color-primary, #6366f1);
116
+ transition: transform 0.1s;
117
+ line-height: 1;
118
+ transform-origin: center;
119
+ }
120
+
121
+ .n-scroll-view-ptr.is-refreshing .n-scroll-view-spinner[data-v-7469d561]{
122
+ animation: n-spin 0.8s linear infinite;
123
+ }
124
+
125
+ @keyframes n-spin {
126
+ to[data-v-7469d561]{ transform: rotate(360deg) scale(1); }
127
+ }`
128
+ injectStyle('data-v-7469d561', __style)