intelliwaketssveltekitv25 1.0.81 → 1.0.82
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/INTEGRATION.md +574 -0
- package/README.md +199 -45
- package/dist/ArrayTable.stories.js +215 -0
- package/dist/ArrayTable.svelte +46 -0
- package/dist/ArrayTable.svelte.d.ts +44 -0
- package/dist/DropDown.stories.d.ts +96 -0
- package/dist/DropDown.stories.js +192 -0
- package/dist/DropDown.svelte +32 -0
- package/dist/DropDown.svelte.d.ts +30 -0
- package/dist/InputNumber.stories.d.ts +122 -0
- package/dist/InputNumber.stories.js +186 -0
- package/dist/InputNumber.svelte +52 -0
- package/dist/InputNumber.svelte.d.ts +27 -0
- package/dist/Modal.stories.d.ts +114 -0
- package/dist/Modal.stories.js +139 -0
- package/dist/Modal.svelte +34 -3
- package/dist/Modal.svelte.d.ts +35 -3
- package/dist/MultiSelect.stories.js +338 -0
- package/dist/MultiSelect.svelte +81 -0
- package/dist/MultiSelect.svelte.d.ts +38 -0
- package/dist/Switch.stories.d.ts +81 -0
- package/dist/Switch.stories.js +99 -0
- package/dist/Switch.svelte +40 -0
- package/dist/Switch.svelte.d.ts +26 -0
- package/dist/TextArea.stories.d.ts +180 -0
- package/dist/TextArea.stories.js +216 -0
- package/dist/TextArea.svelte +32 -0
- package/dist/TextArea.svelte.d.ts +24 -0
- package/dist/app.css +1 -1
- package/llm.txt +1635 -0
- package/package.json +6 -2
package/README.md
CHANGED
|
@@ -1,77 +1,231 @@
|
|
|
1
|
-
#
|
|
1
|
+
# IntelliWakeTSSvelteKitV2.5
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A professional SvelteKit component library with 41+ reusable UI components and utilities. Built with Svelte 5, TypeScript, and Tailwind CSS v4.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**Version:** 1.0.81 | **License:** MIT
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
---
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
## Quick Start
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
### Installation
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
- `primary-light`
|
|
17
|
-
- `primary-selected`
|
|
18
|
-
- `secondary-main`
|
|
19
|
-
- `secondary-light`
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add intelliwaketssveltekitv25
|
|
15
|
+
```
|
|
20
16
|
|
|
21
|
-
###
|
|
17
|
+
### Basic Usage
|
|
22
18
|
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
```svelte
|
|
20
|
+
<script>
|
|
21
|
+
import { Switch, InputNumber, Modal, ArrayTable } from 'intelliwaketssveltekitv25';
|
|
22
|
+
import 'intelliwaketssveltekitv25/dist/app.css';
|
|
25
23
|
|
|
26
|
-
|
|
24
|
+
let enabled = $state(false);
|
|
25
|
+
let price = $state(29.99);
|
|
26
|
+
</script>
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
<Switch bind:checked={enabled}>Enable Feature</Switch>
|
|
29
|
+
<InputNumber bind:value={price} currency />
|
|
30
|
+
```
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
# create a new project in the current directory
|
|
32
|
-
npm create svelte@latest
|
|
32
|
+
---
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
npm create svelte@latest my-app
|
|
36
|
-
```
|
|
34
|
+
## Documentation
|
|
37
35
|
|
|
38
|
-
|
|
36
|
+
### For Developers
|
|
39
37
|
|
|
40
|
-
|
|
38
|
+
- **[Integration Guide (INTEGRATION.md)](./INTEGRATION.md)** - Installation, setup, and configuration
|
|
39
|
+
- **[Storybook](http://localhost:6006)** - Interactive component examples (run `pnpm storybook`)
|
|
40
|
+
- **[Development Guide (CLAUDE.md)](./CLAUDE.md)** - Contributing and development workflow
|
|
41
41
|
|
|
42
|
-
|
|
43
|
-
npm run dev
|
|
42
|
+
### For AI Assistants (Claude Code, Copilot, etc.)
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
npm run dev -- --open
|
|
47
|
-
```
|
|
44
|
+
- **[LLM Component Guide (LLM.md)](llm.txt)** - AI-optimized component reference with usage examples and common mistakes
|
|
48
45
|
|
|
49
|
-
|
|
46
|
+
---
|
|
50
47
|
|
|
51
|
-
##
|
|
48
|
+
## Featured Components
|
|
52
49
|
|
|
53
|
-
|
|
50
|
+
### Form Controls (Replace Native HTML)
|
|
54
51
|
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
- **Switch** - Toggle switches (replaces `<input type="checkbox">`)
|
|
53
|
+
- **InputNumber** - Formatted numeric inputs with currency/percent support (replaces `<input type="number">`)
|
|
54
|
+
- **CheckBox** - Custom checkboxes with flexible styling
|
|
55
|
+
- **TextArea** - Auto-resizing textarea
|
|
56
|
+
- **DropDown** - Rich dropdown menus (replaces `<select>`)
|
|
57
|
+
- **MultiSelect** - Multi-select dropdown with search
|
|
58
|
+
|
|
59
|
+
### Layout & Navigation
|
|
60
|
+
|
|
61
|
+
- **Modal** - Feature-rich dialog with drag support (replaces `<dialog>`)
|
|
62
|
+
- **MasterDetailLayout** - Responsive master-detail pattern
|
|
63
|
+
- **TabHeader** / **TabHref** - Tab navigation components
|
|
64
|
+
- **Paginator** - Pagination controls
|
|
65
|
+
|
|
66
|
+
### Data Display
|
|
67
|
+
|
|
68
|
+
- **ArrayTable** - Sortable, type-safe data tables (replaces manual `<table>`)
|
|
69
|
+
- **VirtualList** / **VirtualTable** - High-performance virtual scrolling for large datasets
|
|
70
|
+
- **Calendar** - Date picker and calendar display
|
|
71
|
+
- **DateRangePicker** - Date range selection
|
|
72
|
+
|
|
73
|
+
### Utilities
|
|
74
|
+
|
|
75
|
+
- **PathAnalyzer** - Route parsing and navigation helpers
|
|
76
|
+
- **ArrayFunctions** - Data manipulation utilities
|
|
77
|
+
- **FormEnhance** - Form enhancement utilities
|
|
78
|
+
- **Functions** / **FunctionsBrowser** / **FunctionsServer** - Cross-environment utilities
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Requirements
|
|
83
|
+
|
|
84
|
+
### Peer Dependencies
|
|
85
|
+
|
|
86
|
+
```json
|
|
87
|
+
{
|
|
88
|
+
"@solidbasisventures/intelliwaketsfoundation": "^5.13.57",
|
|
89
|
+
"@sveltejs/kit": "^2.49.2",
|
|
90
|
+
"svelte": "^5.46.1"
|
|
91
|
+
}
|
|
57
92
|
```
|
|
58
93
|
|
|
59
|
-
|
|
94
|
+
### Tailwind Configuration
|
|
95
|
+
|
|
96
|
+
Your project must define these custom colors in `tailwind.config.js`:
|
|
97
|
+
|
|
98
|
+
```javascript
|
|
99
|
+
theme: {
|
|
100
|
+
extend: {
|
|
101
|
+
colors: {
|
|
102
|
+
primary: {
|
|
103
|
+
main: '#your-color', // Primary brand color
|
|
104
|
+
face: '#your-color', // Darker for contrast
|
|
105
|
+
hover: '#your-color', // Hover state
|
|
106
|
+
light: '#your-color', // Light background
|
|
107
|
+
selected: '#your-color' // Selected state
|
|
108
|
+
},
|
|
109
|
+
secondary: {
|
|
110
|
+
main: '#your-color',
|
|
111
|
+
light: '#your-color'
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
See [INTEGRATION.md](./INTEGRATION.md) for complete setup instructions.
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Key Features
|
|
123
|
+
|
|
124
|
+
- **Svelte 5 Runes** - Modern reactive programming with `$state`, `$derived`, `$effect`, `$bindable`
|
|
125
|
+
- **TypeScript Generics** - Type-safe components (e.g., `ArrayTable<YourDataType>`)
|
|
126
|
+
- **Tailwind CSS v4** - Utility-first styling with custom theme integration
|
|
127
|
+
- **Comprehensive Testing** - Vitest for unit tests, Playwright for E2E, Storybook for visual testing
|
|
128
|
+
- **Accessibility** - ARIA labels, keyboard navigation, and screen reader support
|
|
129
|
+
- **Performance** - Virtual scrolling, lazy loading, and optimized rendering
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Development Commands
|
|
60
134
|
|
|
61
135
|
```bash
|
|
62
|
-
|
|
136
|
+
# Development
|
|
137
|
+
pnpm dev # Start dev server
|
|
138
|
+
pnpm test # Run tests in watch mode
|
|
139
|
+
pnpm storybook # Start Storybook on port 6006
|
|
140
|
+
|
|
141
|
+
# Building
|
|
142
|
+
pnpm build # Build library and package
|
|
143
|
+
pnpm package # Package for distribution
|
|
144
|
+
|
|
145
|
+
# Quality Checks
|
|
146
|
+
pnpm lint # Run ESLint and Prettier
|
|
147
|
+
pnpm format # Format code
|
|
148
|
+
pnpm check # Type check with svelte-check
|
|
149
|
+
pnpm docs:check # Check documentation coverage
|
|
150
|
+
|
|
151
|
+
# Publishing
|
|
152
|
+
pnpm Publish # Bump patch version and publish to npm
|
|
63
153
|
```
|
|
64
154
|
|
|
65
|
-
|
|
155
|
+
---
|
|
66
156
|
|
|
67
|
-
|
|
157
|
+
## Documentation Coverage
|
|
68
158
|
|
|
69
|
-
|
|
159
|
+
Phase 1 components (5/41) are fully documented with JSDoc, Storybook stories, and LLM.md entries:
|
|
70
160
|
|
|
71
|
-
|
|
161
|
+
1. ✅ **Switch** - Toggle switches
|
|
162
|
+
2. ✅ **InputNumber** - Formatted numeric inputs
|
|
163
|
+
3. ✅ **Modal** - Dialog overlays
|
|
164
|
+
4. ✅ **DropDown** - Rich dropdown menus
|
|
165
|
+
5. ✅ **ArrayTable** - Sortable data tables
|
|
72
166
|
|
|
73
|
-
|
|
167
|
+
Run `pnpm docs:check` to see current documentation status.
|
|
74
168
|
|
|
75
|
-
|
|
76
|
-
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Project Structure
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
intelliwaketssveltekitv25/
|
|
175
|
+
├── src/
|
|
176
|
+
│ ├── lib/ # Component library (published)
|
|
177
|
+
│ │ ├── *.svelte # 41 UI components
|
|
178
|
+
│ │ ├── *.stories.ts # Storybook stories
|
|
179
|
+
│ │ └── index.ts # Public API exports
|
|
180
|
+
│ ├── routes/ # Demo application (not published)
|
|
181
|
+
│ └── params/ # SvelteKit parameter matchers
|
|
182
|
+
├── dist/ # Build output
|
|
183
|
+
├── LLM.md # AI assistant documentation
|
|
184
|
+
├── INTEGRATION.md # Setup and integration guide
|
|
185
|
+
├── CLAUDE.md # Development guide
|
|
186
|
+
└── README.md # This file
|
|
77
187
|
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Browser Support
|
|
192
|
+
|
|
193
|
+
- Chrome/Edge (latest 2 versions)
|
|
194
|
+
- Firefox (latest 2 versions)
|
|
195
|
+
- Safari (latest 2 versions)
|
|
196
|
+
- iOS Safari (latest 2 versions)
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## Contributing
|
|
201
|
+
|
|
202
|
+
See [CLAUDE.md](./CLAUDE.md) for development workflow and contribution guidelines.
|
|
203
|
+
|
|
204
|
+
---
|
|
205
|
+
|
|
206
|
+
## License
|
|
207
|
+
|
|
208
|
+
MIT License - See LICENSE file for details
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Links
|
|
213
|
+
|
|
214
|
+
- **Package:** [npm](https://www.npmjs.com/package/intelliwaketssveltekitv25)
|
|
215
|
+
- **Repository:** Contact maintainer for repository access
|
|
216
|
+
- **Issues:** Contact maintainer for issue tracking
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Support
|
|
221
|
+
|
|
222
|
+
For questions or issues:
|
|
223
|
+
|
|
224
|
+
1. Check [LLM.md](llm.txt) for component usage and common mistakes
|
|
225
|
+
2. Review [INTEGRATION.md](./INTEGRATION.md) for setup instructions
|
|
226
|
+
3. Explore Storybook examples (`pnpm storybook`)
|
|
227
|
+
4. Contact the library maintainer
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
**Built with ❤️ using Svelte 5, TypeScript, and Tailwind CSS**
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import ArrayTable from './ArrayTable.svelte';
|
|
2
|
+
const sampleUsers = [
|
|
3
|
+
{ id: 1, name: 'John Doe', email: 'john@example.com', role: 'Admin', salary: 75000, active: true },
|
|
4
|
+
{ id: 2, name: 'Jane Smith', email: 'jane@example.com', role: 'User', salary: 60000, active: true },
|
|
5
|
+
{ id: 3, name: 'Bob Johnson', email: 'bob@example.com', role: 'User', salary: 55000, active: false },
|
|
6
|
+
{ id: 4, name: 'Alice Williams', email: 'alice@example.com', role: 'Manager', salary: 85000, active: true }
|
|
7
|
+
];
|
|
8
|
+
const meta = {
|
|
9
|
+
title: 'Components/ArrayTable',
|
|
10
|
+
component: ArrayTable,
|
|
11
|
+
tags: ['autodocs'],
|
|
12
|
+
argTypes: {
|
|
13
|
+
arrayData: {
|
|
14
|
+
control: 'object',
|
|
15
|
+
description: 'Array of data objects (generic type T)'
|
|
16
|
+
},
|
|
17
|
+
arrayStructure: {
|
|
18
|
+
control: 'object',
|
|
19
|
+
description: 'Column definitions and table configuration'
|
|
20
|
+
},
|
|
21
|
+
bordered: {
|
|
22
|
+
control: 'boolean',
|
|
23
|
+
description: 'Add borders to table cells'
|
|
24
|
+
},
|
|
25
|
+
scrollable: {
|
|
26
|
+
control: 'boolean',
|
|
27
|
+
description: 'Make table sticky-header scrollable'
|
|
28
|
+
},
|
|
29
|
+
class: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
description: 'Additional CSS classes for table element'
|
|
32
|
+
},
|
|
33
|
+
hideCosts: {
|
|
34
|
+
control: 'boolean',
|
|
35
|
+
description: 'Hide columns marked as costs'
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
export default meta;
|
|
40
|
+
export const Default = {
|
|
41
|
+
args: {
|
|
42
|
+
arrayData: sampleUsers,
|
|
43
|
+
arrayStructure: {
|
|
44
|
+
columns: [
|
|
45
|
+
{ fieldName: 'name', title: 'Name' },
|
|
46
|
+
{ fieldName: 'email', title: 'Email' },
|
|
47
|
+
{ fieldName: 'role', title: 'Role' }
|
|
48
|
+
],
|
|
49
|
+
sortable: true
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
export const WithCurrency = {
|
|
54
|
+
args: {
|
|
55
|
+
arrayData: sampleUsers,
|
|
56
|
+
arrayStructure: {
|
|
57
|
+
columns: [
|
|
58
|
+
{ fieldName: 'id', title: 'ID', size: 'sm' },
|
|
59
|
+
{ fieldName: 'name', title: 'Name' },
|
|
60
|
+
{ fieldName: 'salary', title: 'Salary', type: 'currency', sum: true }
|
|
61
|
+
],
|
|
62
|
+
sortable: true,
|
|
63
|
+
defaultSortColumn: 'name'
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
export const WithComputedColumn = {
|
|
68
|
+
args: {
|
|
69
|
+
arrayData: sampleUsers,
|
|
70
|
+
arrayStructure: {
|
|
71
|
+
columns: [
|
|
72
|
+
{ fieldName: 'name', title: 'Name' },
|
|
73
|
+
{ fieldName: 'email', title: 'Email' },
|
|
74
|
+
{
|
|
75
|
+
fieldName: 'active',
|
|
76
|
+
title: 'Status',
|
|
77
|
+
compute: (val) => val ? 'Active' : 'Inactive'
|
|
78
|
+
}
|
|
79
|
+
],
|
|
80
|
+
sortable: true
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
export const Bordered = {
|
|
85
|
+
args: {
|
|
86
|
+
arrayData: sampleUsers,
|
|
87
|
+
arrayStructure: {
|
|
88
|
+
columns: [
|
|
89
|
+
{ fieldName: 'name' },
|
|
90
|
+
{ fieldName: 'email' },
|
|
91
|
+
{ fieldName: 'role' }
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
bordered: true
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
export const WithRowClick = {
|
|
98
|
+
args: {
|
|
99
|
+
arrayData: sampleUsers,
|
|
100
|
+
arrayStructure: {
|
|
101
|
+
columns: [
|
|
102
|
+
{ fieldName: 'name', title: 'Name' },
|
|
103
|
+
{ fieldName: 'email', title: 'Email' },
|
|
104
|
+
{ fieldName: 'role', title: 'Role' }
|
|
105
|
+
],
|
|
106
|
+
rowClick: (user) => alert(`Clicked: ${user.name}`)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
export const EmptyState = {
|
|
111
|
+
args: {
|
|
112
|
+
arrayData: [],
|
|
113
|
+
arrayStructure: {
|
|
114
|
+
columns: [
|
|
115
|
+
{ fieldName: 'name', title: 'Name' },
|
|
116
|
+
{ fieldName: 'email', title: 'Email' }
|
|
117
|
+
],
|
|
118
|
+
emptyMessage: 'No users found. Add your first user to get started.'
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
export const EmptyStateNoMessage = {
|
|
123
|
+
args: {
|
|
124
|
+
arrayData: [],
|
|
125
|
+
arrayStructure: {
|
|
126
|
+
columns: [
|
|
127
|
+
{ fieldName: 'name' },
|
|
128
|
+
{ fieldName: 'email' }
|
|
129
|
+
],
|
|
130
|
+
emptyMessage: false
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
};
|
|
134
|
+
export const WithHiddenColumn = {
|
|
135
|
+
args: {
|
|
136
|
+
arrayData: sampleUsers,
|
|
137
|
+
arrayStructure: {
|
|
138
|
+
columns: [
|
|
139
|
+
{ fieldName: 'id', hidden: true },
|
|
140
|
+
{ fieldName: 'name', title: 'Name' },
|
|
141
|
+
{ fieldName: 'email', title: 'Email' },
|
|
142
|
+
{ fieldName: 'role', title: 'Role' }
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
export const WithCellClick = {
|
|
148
|
+
args: {
|
|
149
|
+
arrayData: sampleUsers,
|
|
150
|
+
arrayStructure: {
|
|
151
|
+
columns: [
|
|
152
|
+
{ fieldName: 'name', title: 'Name' },
|
|
153
|
+
{
|
|
154
|
+
fieldName: 'email',
|
|
155
|
+
title: 'Email',
|
|
156
|
+
onclick: (user, e) => {
|
|
157
|
+
e.stopPropagation();
|
|
158
|
+
alert(`Email: ${user.email}`);
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
{ fieldName: 'role', title: 'Role' }
|
|
162
|
+
],
|
|
163
|
+
rowClick: (user) => alert(`Row clicked: ${user.name}`)
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
export const WithFooterTotals = {
|
|
168
|
+
args: {
|
|
169
|
+
arrayData: sampleUsers,
|
|
170
|
+
arrayStructure: {
|
|
171
|
+
columns: [
|
|
172
|
+
{ fieldName: 'name', title: 'Name' },
|
|
173
|
+
{ fieldName: 'role', title: 'Role' },
|
|
174
|
+
{
|
|
175
|
+
fieldName: 'salary',
|
|
176
|
+
title: 'Salary',
|
|
177
|
+
type: 'currency',
|
|
178
|
+
sum: true
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
fieldName: 'id',
|
|
182
|
+
title: 'Count',
|
|
183
|
+
count: true
|
|
184
|
+
}
|
|
185
|
+
],
|
|
186
|
+
sortable: true
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
export const Unsortable = {
|
|
191
|
+
args: {
|
|
192
|
+
arrayData: sampleUsers,
|
|
193
|
+
arrayStructure: {
|
|
194
|
+
columns: [
|
|
195
|
+
{ fieldName: 'name' },
|
|
196
|
+
{ fieldName: 'email' },
|
|
197
|
+
{ fieldName: 'role' }
|
|
198
|
+
],
|
|
199
|
+
sortable: false
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
export const MixedSortable = {
|
|
204
|
+
args: {
|
|
205
|
+
arrayData: sampleUsers,
|
|
206
|
+
arrayStructure: {
|
|
207
|
+
columns: [
|
|
208
|
+
{ fieldName: 'name', title: 'Name (sortable)' },
|
|
209
|
+
{ fieldName: 'email', title: 'Email (not sortable)', doNotSort: true },
|
|
210
|
+
{ fieldName: 'role', title: 'Role (sortable)' }
|
|
211
|
+
],
|
|
212
|
+
sortable: true
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
};
|
package/dist/ArrayTable.svelte
CHANGED
|
@@ -1,3 +1,49 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
@component
|
|
3
|
+
Type-safe, sortable data table with automatic formatting, custom cell rendering, and row/column interactions.
|
|
4
|
+
Replaces manual <table> implementations with sorting, formatting, and event handling.
|
|
5
|
+
|
|
6
|
+
@example
|
|
7
|
+
```svelte
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { ArrayTable, type IArrayStructure } from 'intelliwaketssveltekitv25';
|
|
10
|
+
|
|
11
|
+
interface User {
|
|
12
|
+
name: string;
|
|
13
|
+
email: string;
|
|
14
|
+
salary: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const users: User[] = [
|
|
18
|
+
{ name: 'John', email: 'john@example.com', salary: 75000 }
|
|
19
|
+
];
|
|
20
|
+
|
|
21
|
+
const structure: IArrayStructure<User> = {
|
|
22
|
+
columns: [
|
|
23
|
+
{ fieldName: 'name', title: 'Name' },
|
|
24
|
+
{ fieldName: 'email', title: 'Email' },
|
|
25
|
+
{ fieldName: 'salary', type: 'currency', sum: true }
|
|
26
|
+
],
|
|
27
|
+
sortable: true
|
|
28
|
+
};
|
|
29
|
+
</script>
|
|
30
|
+
|
|
31
|
+
<ArrayTable arrayData={users} arrayStructure={structure} bordered />
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
@remarks
|
|
35
|
+
- Uses TypeScript generics for type-safe column definitions
|
|
36
|
+
- Auto-formatting: currency, percentages, dates based on column type
|
|
37
|
+
- Sortable: click column headers to sort (ascending/descending toggle)
|
|
38
|
+
- Computed values: transform data before display with compute functions
|
|
39
|
+
- Footer totals: automatic sums, averages, and counts
|
|
40
|
+
- Empty state: customizable message when no data
|
|
41
|
+
- Row and cell click handlers for interactions
|
|
42
|
+
|
|
43
|
+
@see VirtualTable - For very large datasets (10,000+ rows) with virtual scrolling
|
|
44
|
+
@see ArrayFunctions - Utility functions for array/table operations
|
|
45
|
+
-->
|
|
46
|
+
|
|
1
47
|
<script lang="ts" generics="T extends Record<string, any>">
|
|
2
48
|
|
|
3
49
|
import {
|
|
@@ -29,6 +29,50 @@ interface $$IsomorphicComponent {
|
|
|
29
29
|
<T extends Record<string, any>>(internal: unknown, props: ReturnType<__sveltets_Render<T>['props']> & {}): ReturnType<__sveltets_Render<T>['exports']>;
|
|
30
30
|
z_$$bindings?: ReturnType<__sveltets_Render<any>['bindings']>;
|
|
31
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Type-safe, sortable data table with automatic formatting, custom cell rendering, and row/column interactions.
|
|
34
|
+
* Replaces manual <table> implementations with sorting, formatting, and event handling.
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```svelte
|
|
38
|
+
* <script lang="ts">
|
|
39
|
+
* import { ArrayTable, type IArrayStructure } from 'intelliwaketssveltekitv25';
|
|
40
|
+
*
|
|
41
|
+
* interface User {
|
|
42
|
+
* name: string;
|
|
43
|
+
* email: string;
|
|
44
|
+
* salary: number;
|
|
45
|
+
* }
|
|
46
|
+
*
|
|
47
|
+
* const users: User[] = [
|
|
48
|
+
* { name: 'John', email: 'john@example.com', salary: 75000 }
|
|
49
|
+
* ];
|
|
50
|
+
*
|
|
51
|
+
* const structure: IArrayStructure<User> = {
|
|
52
|
+
* columns: [
|
|
53
|
+
* { fieldName: 'name', title: 'Name' },
|
|
54
|
+
* { fieldName: 'email', title: 'Email' },
|
|
55
|
+
* { fieldName: 'salary', type: 'currency', sum: true }
|
|
56
|
+
* ],
|
|
57
|
+
* sortable: true
|
|
58
|
+
* };
|
|
59
|
+
* </script>
|
|
60
|
+
*
|
|
61
|
+
* <ArrayTable arrayData={users} arrayStructure={structure} bordered />
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* - Uses TypeScript generics for type-safe column definitions
|
|
66
|
+
* - Auto-formatting: currency, percentages, dates based on column type
|
|
67
|
+
* - Sortable: click column headers to sort (ascending/descending toggle)
|
|
68
|
+
* - Computed values: transform data before display with compute functions
|
|
69
|
+
* - Footer totals: automatic sums, averages, and counts
|
|
70
|
+
* - Empty state: customizable message when no data
|
|
71
|
+
* - Row and cell click handlers for interactions
|
|
72
|
+
*
|
|
73
|
+
* @see VirtualTable - For very large datasets (10,000+ rows) with virtual scrolling
|
|
74
|
+
* @see ArrayFunctions - Utility functions for array/table operations
|
|
75
|
+
*/
|
|
32
76
|
declare const ArrayTable: $$IsomorphicComponent;
|
|
33
77
|
type ArrayTable<T extends Record<string, any>> = InstanceType<typeof ArrayTable<T>>;
|
|
34
78
|
export default ArrayTable;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/svelte';
|
|
2
|
+
type DropDownProps = {
|
|
3
|
+
show?: boolean;
|
|
4
|
+
ddActions?: any[];
|
|
5
|
+
buttonTitle?: string | null;
|
|
6
|
+
noCaret?: boolean;
|
|
7
|
+
buttonClass?: string;
|
|
8
|
+
inputControl?: boolean;
|
|
9
|
+
fullBlock?: boolean;
|
|
10
|
+
sameSize?: boolean;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
hidden?: boolean;
|
|
13
|
+
};
|
|
14
|
+
declare const meta: {
|
|
15
|
+
title: string;
|
|
16
|
+
component: import("svelte").Component<{
|
|
17
|
+
show?: boolean;
|
|
18
|
+
position?: import("./Definitions").TDropDownControlPosition;
|
|
19
|
+
ddActions?: import("./Definitions").IDDAction[];
|
|
20
|
+
noCaret?: boolean;
|
|
21
|
+
buttonTitle?: string | null;
|
|
22
|
+
buttonClass?: string;
|
|
23
|
+
controlClass?: string;
|
|
24
|
+
toggleClass?: string;
|
|
25
|
+
inputControl?: boolean;
|
|
26
|
+
fullBlock?: boolean;
|
|
27
|
+
bodyClass?: string;
|
|
28
|
+
sameSize?: boolean;
|
|
29
|
+
zIndex?: number;
|
|
30
|
+
disabled?: boolean;
|
|
31
|
+
hidden?: boolean;
|
|
32
|
+
hideEmptyDDActions?: boolean;
|
|
33
|
+
button?: import("svelte").Snippet;
|
|
34
|
+
verbose?: boolean;
|
|
35
|
+
actions?: import("svelte").Snippet;
|
|
36
|
+
dataColor?: TDefaultColorPalate;
|
|
37
|
+
clientWidth?: number;
|
|
38
|
+
}, {}, "show" | "clientWidth">;
|
|
39
|
+
tags: string[];
|
|
40
|
+
argTypes: {
|
|
41
|
+
show: {
|
|
42
|
+
control: "boolean";
|
|
43
|
+
description: string;
|
|
44
|
+
};
|
|
45
|
+
ddActions: {
|
|
46
|
+
control: "object";
|
|
47
|
+
description: string;
|
|
48
|
+
};
|
|
49
|
+
buttonTitle: {
|
|
50
|
+
control: "text";
|
|
51
|
+
description: string;
|
|
52
|
+
};
|
|
53
|
+
noCaret: {
|
|
54
|
+
control: "boolean";
|
|
55
|
+
description: string;
|
|
56
|
+
};
|
|
57
|
+
buttonClass: {
|
|
58
|
+
control: "text";
|
|
59
|
+
description: string;
|
|
60
|
+
};
|
|
61
|
+
inputControl: {
|
|
62
|
+
control: "boolean";
|
|
63
|
+
description: string;
|
|
64
|
+
};
|
|
65
|
+
fullBlock: {
|
|
66
|
+
control: "boolean";
|
|
67
|
+
description: string;
|
|
68
|
+
};
|
|
69
|
+
sameSize: {
|
|
70
|
+
control: "boolean";
|
|
71
|
+
description: string;
|
|
72
|
+
};
|
|
73
|
+
disabled: {
|
|
74
|
+
control: "boolean";
|
|
75
|
+
description: string;
|
|
76
|
+
};
|
|
77
|
+
hidden: {
|
|
78
|
+
control: "boolean";
|
|
79
|
+
description: string;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
export default meta;
|
|
84
|
+
type Story = StoryObj<DropDownProps>;
|
|
85
|
+
export declare const Default: Story;
|
|
86
|
+
export declare const WithActiveItem: Story;
|
|
87
|
+
export declare const WithDisabledItems: Story;
|
|
88
|
+
export declare const WithHeaders: Story;
|
|
89
|
+
export declare const WithGrouping: Story;
|
|
90
|
+
export declare const WithNavigation: Story;
|
|
91
|
+
export declare const WithDownloads: Story;
|
|
92
|
+
export declare const WithAlternateActions: Story;
|
|
93
|
+
export declare const AsSelectReplacement: Story;
|
|
94
|
+
export declare const Disabled: Story;
|
|
95
|
+
export declare const NoCaret: Story;
|
|
96
|
+
export declare const FullWidth: Story;
|