@aliens-syndicate/table 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.md +221 -2
- package/declare.mjs +319 -0
- package/elements/ui-table/ui-table.markup +22 -0
- package/elements/ui-table/ui-table.style +253 -0
- package/elements/ui-table-action/ui-table-action.markup +5 -0
- package/elements/ui-table-cell/ui-table-cell.markup +6 -0
- package/elements/ui-table-column/ui-table-column.markup +14 -0
- package/elements/ui-table-count/ui-table-count.markup +6 -0
- package/elements/ui-table-engine/ui-table-engine.logic +13 -0
- package/elements/ui-table-filter-range/ui-table-filter-range.markup +8 -0
- package/elements/ui-table-filter-select/ui-table-filter-select.markup +8 -0
- package/elements/ui-table-filter-text/ui-table-filter-text.markup +4 -0
- package/elements/ui-table-option/ui-table-option.markup +4 -0
- package/elements/ui-table-page-size/ui-table-page-size.markup +6 -0
- package/elements/ui-table-pagination/ui-table-pagination.markup +11 -0
- package/elements/ui-table-refresh/ui-table-refresh.markup +5 -0
- package/elements/ui-table-search/ui-table-search.markup +5 -0
- package/elements/ui-table-select/ui-table-select.markup +4 -0
- package/elements/ui-table-sort/ui-table-sort.markup +8 -0
- package/elements/ui-table-state/ui-table-state.markup +5 -0
- package/engine.mjs +848 -0
- package/index.mjs +92 -0
- package/package.json +49 -4
package/index.mjs
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
2
|
+
|
|
3
|
+
// @aliens-syndicate/table: data tables for Aliens. A .logic declares a table (table <name> <Model>:) with its columns,
|
|
4
|
+
// key and the features it turns on; the markup links ui-table by id and repeats the cells with for <row> in <name>. The
|
|
5
|
+
// build inlines createTables into the page and checks every link and type; the controls are drawn by
|
|
6
|
+
// @aliens-syndicate/elements.
|
|
7
|
+
export { createTables } from './engine.mjs';
|
|
8
|
+
export const elementsDirectory = fileURLToPath(new URL('./elements/', import.meta.url));
|
|
9
|
+
// The rules of the declarations (tables, Models, markup links), shared with the editor.
|
|
10
|
+
export { compileTable, checkLogic, checkMarkup, readModel, rowFields, tableHead, fieldMarker, filterKinds, controls } from './declare.mjs';
|
|
11
|
+
|
|
12
|
+
const needs = '@aliens-syndicate/elements';
|
|
13
|
+
const control = { table: '', position: 'top' };
|
|
14
|
+
export const catalog = [
|
|
15
|
+
{
|
|
16
|
+
name: 'ui-table', needs,
|
|
17
|
+
properties: ['id', 'caption', 'empty', 'loading-text', 'empty-text', 'error-text', 'resize-text', 'density', 'striped', 'sticky-header', 'lines',
|
|
18
|
+
'width', 'max-height', 'background', 'color', 'border-size', 'border-color', 'radius', 'shadow', 'padding', 'gap', 'font-size',
|
|
19
|
+
'header-background', 'header-color', 'header-font-size', 'header-font-weight', 'header-transform', 'header-padding', 'header-border-color',
|
|
20
|
+
'row-background', 'row-alt-background', 'row-hover-background', 'row-selected-background', 'row-color', 'row-border-color', 'row-gap', 'row-radius',
|
|
21
|
+
'row-shadow', 'row-height', 'cell-padding'],
|
|
22
|
+
variants: ['ui-table'],
|
|
23
|
+
defaults: {
|
|
24
|
+
caption: '', empty: '—', 'loading-text': 'Loading…', 'empty-text': 'No rows to show.', 'error-text': 'The rows could not be loaded. {error}',
|
|
25
|
+
'resize-text': 'Resize {column}', density: 'normal', striped: 'false', 'sticky-header': 'false', lines: 'rows',
|
|
26
|
+
width: '100%', 'max-height': 'none', background: 'var(--color-canvas, #ffffff)', color: 'var(--color-text, #182015)', 'border-size': '1px',
|
|
27
|
+
'border-color': 'var(--color-outline, #d5ddd1)', radius: 'var(--radius-lg, 0.75rem)', shadow: 'none', padding: 'var(--space-4, 1rem)',
|
|
28
|
+
gap: 'var(--space-3, 0.75rem)', 'font-size': 'var(--text-body, 1rem)',
|
|
29
|
+
'header-background': 'var(--color-surface, #f6f8f3)', 'header-color': 'var(--color-text, #182015)', 'header-font-size': 'var(--text-small, 0.875rem)',
|
|
30
|
+
'header-font-weight': 'var(--weight-bold, 700)', 'header-transform': 'none', 'header-padding': 'var(--space-3, 0.75rem) var(--space-4, 1rem)',
|
|
31
|
+
'header-border-color': 'var(--color-outline, #d5ddd1)', 'row-background': 'transparent', 'row-alt-background': 'var(--color-surface, #f6f8f3)',
|
|
32
|
+
'row-hover-background': 'var(--color-surface, #f6f8f3)', 'row-selected-background': 'var(--color-accent, #e7f4d3)', 'row-color': 'inherit',
|
|
33
|
+
'row-border-color': 'var(--color-outline, #d5ddd1)', 'row-gap': '0', 'row-radius': '0', 'row-shadow': 'none', 'row-height': 'auto',
|
|
34
|
+
'cell-padding': 'var(--space-3, 0.75rem) var(--space-4, 1rem)'
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'ui-table-column', needs, variants: [],
|
|
39
|
+
properties: ['id', 'label', 'kind', 'align', 'width', 'min-width', 'wrap', 'empty', 'select-label'],
|
|
40
|
+
defaults: { label: '', kind: 'data', align: 'start', width: 'auto', 'min-width': 'auto', wrap: 'nowrap', empty: 'inherit', 'select-label': 'Select the rows of this page' }
|
|
41
|
+
},
|
|
42
|
+
{ name: 'ui-table-cell', needs, variants: [], properties: ['column', 'empty', 'align'], defaults: { empty: 'inherit', align: '' } },
|
|
43
|
+
{ name: 'ui-table-select', needs, variants: [], properties: ['column', 'label'], defaults: { label: 'Select row' } },
|
|
44
|
+
{
|
|
45
|
+
name: 'ui-table-search', needs, variants: [], properties: ['table', 'label', 'placeholder', 'position', 'delay', 'width'],
|
|
46
|
+
defaults: { ...control, label: 'Search', placeholder: '', delay: '300', width: '18rem' }
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'ui-table-filter-text', needs, variants: [], properties: ['table', 'column', 'label', 'placeholder', 'position', 'width'],
|
|
50
|
+
defaults: { ...control, label: '', placeholder: '', width: '14rem' }
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'ui-table-filter-select', needs, variants: [], properties: ['table', 'column', 'label', 'placeholder', 'all-text', 'options', 'position', 'width'],
|
|
54
|
+
defaults: { ...control, label: '', placeholder: '', 'all-text': 'All', options: 'auto', width: '12rem' }
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'ui-table-filter-range', needs, variants: [], properties: ['table', 'column', 'label', 'min-placeholder', 'max-placeholder', 'position', 'width'],
|
|
58
|
+
defaults: { ...control, label: '', 'min-placeholder': 'Min', 'max-placeholder': 'Max', width: '14rem' }
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'ui-table-action', needs, variants: [], properties: ['text', 'icon', 'layout', 'action', 'variant', 'disabled'],
|
|
62
|
+
defaults: { icon: 'edit-02', layout: 'text', variant: 'ui-button_ghost', disabled: 'false' }
|
|
63
|
+
},
|
|
64
|
+
{ name: 'ui-table-option', needs, variants: [], properties: ['value', 'text'], defaults: {} },
|
|
65
|
+
{
|
|
66
|
+
name: 'ui-table-pagination', needs, variants: [],
|
|
67
|
+
properties: ['table', 'label', 'position', 'align', 'numbers', 'status-text', 'unknown-text', 'page-text', 'previous-text', 'next-text',
|
|
68
|
+
'previous-icon', 'next-icon', 'previous-layout', 'next-layout', 'variant'],
|
|
69
|
+
defaults: {
|
|
70
|
+
...control, position: 'bottom', label: 'Pages', align: 'between', numbers: 'false', 'status-text': '{from}–{to} of {total}', 'unknown-text': '{from}–{to}',
|
|
71
|
+
'page-text': 'Page {page} of {pages}', 'previous-text': 'Previous', 'next-text': 'Next', 'previous-icon': 'arrow-left-01', 'next-icon': 'arrow-right-01',
|
|
72
|
+
'previous-layout': 'icon-start', 'next-layout': 'icon-end', variant: 'ui-button_secondary'
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: 'ui-table-page-size', needs, variants: [], properties: ['table', 'label', 'option-text', 'position', 'width'],
|
|
77
|
+
defaults: { ...control, position: 'bottom', label: 'Rows per page', 'option-text': '{size}', width: '9rem' }
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'ui-table-sort', needs, variants: [], properties: ['table', 'label', 'placeholder', 'ascending-text', 'descending-text', 'variant', 'position', 'width'],
|
|
81
|
+
defaults: { ...control, label: 'Sort by', placeholder: '—', 'ascending-text': 'Ascending', 'descending-text': 'Descending', variant: 'ui-button_secondary', width: '12rem' }
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
name: 'ui-table-refresh', needs, variants: [], properties: ['table', 'text', 'icon', 'layout', 'variant', 'position'],
|
|
85
|
+
defaults: { ...control, text: 'Refresh', icon: 'refresh', layout: 'icon-start', variant: 'ui-button_secondary' }
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'ui-table-count', needs, variants: [], properties: ['table', 'show', 'text', 'position'],
|
|
89
|
+
defaults: { ...control, show: 'total', text: '{count} rows' }
|
|
90
|
+
},
|
|
91
|
+
{ name: 'ui-table-state', needs, variants: [], properties: ['table', 'when'], defaults: { table: '', when: 'empty' } }
|
|
92
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aliens-syndicate/table",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Data tables for Aliens: typed table declarations in .logic, rows repeated with for, opt-in search, filters, sorting, pagination and selection, local or remote, drawn with @aliens-syndicate/elements.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Aliens Syndicate",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": "./index.mjs",
|
|
10
|
+
"./engine": "./engine.mjs",
|
|
11
|
+
"./declare": "./declare.mjs"
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"index.mjs",
|
|
15
|
+
"engine.mjs",
|
|
16
|
+
"declare.mjs",
|
|
17
|
+
"elements/"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"test": "node --test test.mjs",
|
|
21
|
+
"prepublishOnly": "npm test"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@aliens-syndicate/elements": "^0.2.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"linkedom": "0.18.15"
|
|
28
|
+
},
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=22.13"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"aliens",
|
|
34
|
+
"space",
|
|
35
|
+
"table",
|
|
36
|
+
"data-table",
|
|
37
|
+
"sorting",
|
|
38
|
+
"pagination",
|
|
39
|
+
"filters",
|
|
40
|
+
"selection"
|
|
41
|
+
],
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "git+https://github.com/AliensSyndicate/aliens-syndicate-framework.git",
|
|
45
|
+
"directory": "packages/table"
|
|
46
|
+
},
|
|
47
|
+
"homepage": "https://github.com/AliensSyndicate/aliens-syndicate-framework/tree/main/packages/table#readme",
|
|
48
|
+
"publishConfig": {
|
|
49
|
+
"access": "public"
|
|
50
|
+
}
|
|
51
|
+
}
|