nexa-ui-kit 0.6.4 → 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.
- package/dist/components/NCard.js +5 -1
- package/dist/components/NDataTable.js +50 -38
- package/dist/components/NDataTable.nexa +19 -2
- package/dist/components/NImage.js +104 -0
- package/dist/components/NImage.nexa +112 -0
- package/dist/components/NModal.js +3 -1
- package/dist/components/NScrollView.js +128 -0
- package/dist/components/NScrollView.nexa +136 -0
- package/dist/components/NTabs.js +1 -1
- package/dist/components/NVirtualList.js +91 -0
- package/dist/components/NVirtualList.nexa +94 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/package.json +4 -4
- package/src/components/NDataTable.nexa +19 -2
- package/src/components/NImage.nexa +112 -0
- package/src/components/NScrollView.nexa +136 -0
- package/src/components/NVirtualList.nexa +94 -0
- package/src/index.ts +3 -0
package/dist/components/NCard.js
CHANGED
|
@@ -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() :
|
|
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-
|
|
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-
|
|
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-
|
|
173
|
-
h('div', { class: "n-dt-global", "data-v-
|
|
174
|
-
h('input', { class: "n-dt-global-input", value: effectiveFilters.value.__global || '', placeholder: "Search...", onInput: setGlobal, "data-v-
|
|
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-
|
|
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-
|
|
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-
|
|
182
|
+
h('thead', { class: "n-dt-thead", "data-v-17a3d2ce": "" }, [
|
|
183
183
|
"\n ",
|
|
184
|
-
h('tr', { class: "n-dt-head-row", "data-v-
|
|
185
|
-
|
|
186
|
-
(selectionMode
|
|
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-
|
|
190
|
-
|
|
191
|
-
h('
|
|
192
|
-
|
|
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
|
-
|
|
195
|
-
(
|
|
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-
|
|
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
|
-
|
|
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-
|
|
208
|
-
(selectionMode) ? h('th', { class: "n-dt-th is-selection", "data-v-
|
|
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-
|
|
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-
|
|
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-
|
|
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-
|
|
221
|
-
|
|
222
|
-
h('
|
|
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-
|
|
226
|
-
|
|
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-
|
|
233
|
-
h('td', { class: "n-dt-empty", colspan: normalizeColumns.value.length + (selectionMode ? 1 : 0), "data-v-
|
|
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-
|
|
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-
|
|
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-
|
|
252
|
-
injectStyle('data-v-
|
|
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"
|
|
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)"
|
|
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>
|
|
@@ -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)
|