@ticatec/uniface-element 0.2.3 → 0.3.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.
Files changed (178) hide show
  1. package/dist/accordion/README.md +169 -0
  2. package/dist/accordion/README_CN.md +176 -0
  3. package/dist/action-bar/README.md +275 -0
  4. package/dist/action-bar/README_CN.md +285 -0
  5. package/dist/app-layout/README.md +374 -0
  6. package/dist/app-layout/README_CN.md +381 -0
  7. package/dist/app-top-bar/README.md +357 -0
  8. package/dist/app-top-bar/README_CN.md +365 -0
  9. package/dist/attachment-files/AttachmentFilesField.svelte +67 -1
  10. package/dist/attachment-files/AttachmentFilesField.svelte.d.ts +8 -1
  11. package/dist/base-calendar/CalendarBase.svelte +0 -3
  12. package/dist/box/README.md +385 -0
  13. package/dist/box/README_CN.md +393 -0
  14. package/dist/breadcrumbs/README.md +442 -0
  15. package/dist/breadcrumbs/README_CN.md +442 -0
  16. package/dist/button/Button.svelte +27 -7
  17. package/dist/button/Button.svelte.d.ts +3 -1
  18. package/dist/button/IconButton.svelte +26 -6
  19. package/dist/button/IconButton.svelte.d.ts +3 -1
  20. package/dist/button/IconButton_README.md +513 -0
  21. package/dist/button/IconButton_README_CN.md +513 -0
  22. package/dist/button/README.md +428 -0
  23. package/dist/button/README_CN.md +428 -0
  24. package/dist/button/TextButton.svelte +26 -6
  25. package/dist/button/TextButton.svelte.d.ts +3 -1
  26. package/dist/button/TextButton_README.md +571 -0
  27. package/dist/button/TextButton_README_CN.md +571 -0
  28. package/dist/card/README.md +666 -0
  29. package/dist/card/README_CN.md +666 -0
  30. package/dist/cascade-options-select/CascadeOptionSelect.svelte +43 -7
  31. package/dist/cascade-options-select/CascadeOptionSelect.svelte.d.ts +3 -4
  32. package/dist/cascade-options-select/README.md +663 -2
  33. package/dist/cascade-options-select/README_CN.md +664 -0
  34. package/dist/checkbox/CheckBox.svelte +20 -6
  35. package/dist/checkbox/CheckBox.svelte.d.ts +4 -2
  36. package/dist/checkbox/README.md +562 -0
  37. package/dist/checkbox/README_CN.md +727 -0
  38. package/dist/common-editor/NumberInput.svelte +39 -26
  39. package/dist/common-editor/NumberInput.svelte.d.ts +5 -1
  40. package/dist/concise-data-table/ConciseListTable.svelte +133 -36
  41. package/dist/concise-data-table/ConciseListTable.svelte.d.ts +8 -1
  42. package/dist/concise-data-table/DataCell.svelte +5 -6
  43. package/dist/concise-data-table/DataRow.svelte +22 -2
  44. package/dist/concise-data-table/DataRow.svelte.d.ts +1 -0
  45. package/dist/concise-data-table/README.md +606 -0
  46. package/dist/concise-data-table/README_CN.md +611 -0
  47. package/dist/context-menu/ContextMenu.svelte +138 -21
  48. package/dist/context-menu/ContextMenu.svelte.d.ts +5 -0
  49. package/dist/context-menu/ContextMenuItem.d.ts +20 -4
  50. package/dist/context-menu/README.md +551 -0
  51. package/dist/context-menu/README_CN.md +551 -0
  52. package/dist/criteria-field/CriteriaField.svelte +3 -5
  53. package/dist/criteria-field/README.md +532 -0
  54. package/dist/criteria-field/README_CN.md +532 -0
  55. package/dist/data-table/README.md +712 -0
  56. package/dist/data-table/README_CN.md +712 -0
  57. package/dist/date-picker/DatePicker.svelte +44 -7
  58. package/dist/date-picker/DatePicker.svelte.d.ts +3 -4
  59. package/dist/date-picker/DateTimePicker.svelte +32 -8
  60. package/dist/date-picker/DateTimePicker.svelte.d.ts +3 -4
  61. package/dist/date-picker/README.md +326 -0
  62. package/dist/date-picker/README_CN.md +316 -0
  63. package/dist/date-picker/ScrollBar.svelte +18 -8
  64. package/dist/date-picker/ScrollBar.svelte.d.ts +1 -1
  65. package/dist/date-picker/TimePanel.svelte +5 -5
  66. package/dist/date-picker/TimePanel.svelte.d.ts +1 -1
  67. package/dist/date-range/README.md +374 -0
  68. package/dist/date-range/README_CN.md +374 -0
  69. package/dist/dialog/DialogBoard.svelte +1 -1
  70. package/dist/dialog/README.md +596 -0
  71. package/dist/dialog/README_CN.md +596 -0
  72. package/dist/drawer/README.md +679 -1
  73. package/dist/drawer/README_CN.md +679 -0
  74. package/dist/group-box/group-check-box/GroupCheckBox.svelte +62 -5
  75. package/dist/group-box/group-check-box/GroupCheckBox.svelte.d.ts +7 -2
  76. package/dist/group-box/group-check-box/README.md +749 -0
  77. package/dist/group-box/group-check-box/README_CN.md +750 -0
  78. package/dist/group-box/group-radio-box/GroupRadioBox.svelte +69 -4
  79. package/dist/group-box/group-radio-box/GroupRadioBox.svelte.d.ts +8 -2
  80. package/dist/group-box/group-radio-box/README.md +920 -0
  81. package/dist/group-box/group-radio-box/README_CN.md +920 -0
  82. package/dist/image-files/README.md +1346 -0
  83. package/dist/image-files/README_CN.md +1346 -0
  84. package/dist/input-options-select/InputOptionsSelect.svelte +161 -65
  85. package/dist/input-options-select/InputOptionsSelect.svelte.d.ts +4 -1
  86. package/dist/lib/forwardAllEvents.d.ts +3 -0
  87. package/dist/lib/forwardAllEvents.js +24 -0
  88. package/dist/list-box/README.md +579 -0
  89. package/dist/list-box/README_CN.md +682 -0
  90. package/dist/lookup-editor/LookupEditor.svelte +15 -3
  91. package/dist/lookup-editor/LookupEditor.svelte.d.ts +3 -4
  92. package/dist/lookup-editor/README.md +684 -0
  93. package/dist/lookup-editor/README_CN.md +684 -0
  94. package/dist/memo-editor/MemoEditor.svelte +77 -27
  95. package/dist/memo-editor/MemoEditor.svelte.d.ts +6 -3
  96. package/dist/memo-editor/README.md +819 -0
  97. package/dist/memo-editor/README_CN.md +819 -0
  98. package/dist/message-box/README.md +398 -0
  99. package/dist/message-box/README_CN.md +398 -0
  100. package/dist/number-editor/NumberEditor.svelte +2 -2
  101. package/dist/number-editor/NumberEditor.svelte.d.ts +1 -1
  102. package/dist/number-editor/README.md +353 -22
  103. package/dist/number-editor/README_CN.md +357 -0
  104. package/dist/number-range/README.md +443 -0
  105. package/dist/number-range/README_CN.md +443 -0
  106. package/dist/options-multi-select/OptionsMultiSelect.svelte +87 -12
  107. package/dist/options-multi-select/OptionsMultiSelect.svelte.d.ts +3 -1
  108. package/dist/options-multi-select/README.md +480 -0
  109. package/dist/options-multi-select/README_CN.md +480 -0
  110. package/dist/options-select/OptionsSelect.svelte +36 -5
  111. package/dist/options-select/OptionsSelect.svelte.d.ts +3 -4
  112. package/dist/options-select/README.md +632 -0
  113. package/dist/options-select/README_CN.md +632 -0
  114. package/dist/page/README.md +605 -0
  115. package/dist/page/README_CN.md +605 -0
  116. package/dist/pagination/README.md +946 -0
  117. package/dist/pagination/README_CN.md +946 -0
  118. package/dist/pagination-panel/README.md +1075 -0
  119. package/dist/pagination-panel/README_CN.md +1075 -0
  120. package/dist/popup-hint/README.md +841 -0
  121. package/dist/popup-hint/README_CN.md +840 -0
  122. package/dist/progress-bar/README.md +242 -0
  123. package/dist/progress-bar/README_CN.md +242 -0
  124. package/dist/progress-step-bar/README.md +316 -0
  125. package/dist/progress-step-bar/README_CN.md +316 -0
  126. package/dist/prompts-text-editor/PromptsTextEditor.svelte +6 -3
  127. package/dist/prompts-text-editor/PromptsTextEditor.svelte.d.ts +3 -1
  128. package/dist/prompts-text-editor/README.md +329 -0
  129. package/dist/prompts-text-editor/README_CN.md +329 -0
  130. package/dist/property-editor/README.md +969 -0
  131. package/dist/property-editor/README_CN.md +969 -0
  132. package/dist/radio-button/README.md +372 -0
  133. package/dist/radio-button/README_CN.md +372 -0
  134. package/dist/radio-button/RadioButton.svelte +32 -3
  135. package/dist/radio-button/RadioButton.svelte.d.ts +12 -1
  136. package/dist/search-box/README.md +425 -0
  137. package/dist/search-box/README_CN.md +424 -0
  138. package/dist/search-box/SearchBox.svelte +22 -6
  139. package/dist/search-box/SearchBox.svelte.d.ts +4 -1
  140. package/dist/tabs/README.md +919 -0
  141. package/dist/tabs/README_CN.md +920 -0
  142. package/dist/tag/README.md +922 -0
  143. package/dist/tag/README_CN.md +922 -0
  144. package/dist/text-editor/PasswordEditor.svelte +17 -2
  145. package/dist/text-editor/PasswordEditor.svelte.d.ts +3 -3
  146. package/dist/text-editor/PasswordEditor_README.md +551 -0
  147. package/dist/text-editor/PasswordEditor_README_CN.md +551 -0
  148. package/dist/text-editor/README.md +466 -0
  149. package/dist/text-editor/README_CN.md +466 -0
  150. package/dist/text-editor/TextEditor.svelte +51 -19
  151. package/dist/text-editor/TextEditor.svelte.d.ts +0 -1
  152. package/dist/ticatec-uniface-web.css +1 -0
  153. package/dist/time-editor/README.md +498 -24
  154. package/dist/time-editor/README_CN.md +498 -0
  155. package/dist/time-editor/TimeEditor.svelte +7 -3
  156. package/dist/time-editor/TimeEditor.svelte.d.ts +3 -1
  157. package/dist/toast/README.md +667 -0
  158. package/dist/toast/README_CN.md +667 -0
  159. package/dist/transfer/README.md +795 -0
  160. package/dist/transfer/Transfer.svelte +6 -4
  161. package/dist/transfer/Transfer.svelte.d.ts +3 -1
  162. package/dist/tree-view/README.md +761 -0
  163. package/dist/tree-view/README_CN.md +761 -0
  164. package/dist/tree-view/TreeView.svelte +5 -3
  165. package/dist/tree-view/TreeView.svelte.d.ts +3 -1
  166. package/dist/unit-number-editor/README.md +546 -20
  167. package/dist/unit-number-editor/README_CN.md +525 -0
  168. package/dist/unit-number-editor/UnitNumberEditor.svelte +62 -8
  169. package/dist/unit-number-editor/UnitNumberEditor.svelte.d.ts +5 -1
  170. package/docs/form-field/cn/README_CN.md +364 -0
  171. package/docs/form-field/en/README.md +364 -0
  172. package/docs/form-panel/flex-form/cn/README_CN.md +586 -0
  173. package/docs/form-panel/flex-form/en/README.md +586 -0
  174. package/docs/form-panel/flex-row-form/cn/README_CN.md +787 -0
  175. package/docs/form-panel/flex-row-form/en/README.md +787 -0
  176. package/docs/form-panel/grid-form/en/README.md +744 -0
  177. package/package.json +1 -1
  178. package/dist/drawer/README-CN.md +0 -1
@@ -0,0 +1,946 @@
1
+ # Pagination
2
+
3
+ A smart pagination component that provides intuitive page navigation with intelligent page number display and gap handling for large datasets.
4
+
5
+ ## Features
6
+
7
+ - **Smart Page Display**: Intelligent algorithm to show relevant page numbers with gaps
8
+ - **Multiple Styles**: Support for plain, round, and circle visual styles
9
+ - **Size Variants**: Normal and big size options
10
+ - **Click Navigation**: Easy page selection with click handlers
11
+ - **Responsive Logic**: Adapts page display based on current position
12
+ - **Boundary Handling**: Automatic boundary validation and correction
13
+ - **Gap Indication**: Shows ellipsis (...) for non-consecutive page ranges
14
+ - **Current Page Highlighting**: Visual indication of the active page
15
+
16
+ ## Installation
17
+
18
+ ```bash
19
+ npm install @ticatec/uniface-element
20
+ ```
21
+
22
+ ## Basic Usage
23
+
24
+ ```svelte
25
+ <script>
26
+ import Pagination from '@ticatec/uniface-element/Pagination';
27
+
28
+ let currentPage = 1;
29
+ let totalPages = 10;
30
+
31
+ function handlePageChange(page) {
32
+ currentPage = page;
33
+ console.log('Page changed to:', page);
34
+ }
35
+ </script>
36
+
37
+ <Pagination
38
+ pageNo={currentPage}
39
+ pageCount={totalPages}
40
+ onPageChange={handlePageChange}
41
+ />
42
+ ```
43
+
44
+ ## API Reference
45
+
46
+ ### Props
47
+
48
+ | Prop | Type | Default | Description |
49
+ |------|------|---------|-------------|
50
+ | `pageNo` | `number` | `1` | Current active page number |
51
+ | `pageCount` | `number` | `0` | Total number of pages |
52
+ | `type` | `'plain' \| 'round' \| 'circle'` | `'round'` | Visual style variant |
53
+ | `style` | `string` | `''` | Custom CSS styles |
54
+ | `big` | `boolean` | `false` | Enable larger size variant |
55
+ | `onPageChange` | `OnPageChange` | `undefined` | Page change event handler |
56
+
57
+ ### Types
58
+
59
+ ```typescript
60
+ export type OnPageChange = (page: number) => void;
61
+ ```
62
+
63
+ ## Page Display Logic
64
+
65
+ The pagination component uses intelligent logic to display page numbers:
66
+
67
+ - **1-5 pages**: Show all page numbers
68
+ - **6+ pages**: Show first page, relevant middle pages, and last page with gaps
69
+ - **Current page positioning**: Adjusts display based on current page position
70
+ - **Gap representation**: Uses ellipsis (...) for non-consecutive ranges
71
+
72
+ ## Examples
73
+
74
+ ### Basic Data Table Pagination
75
+
76
+ ```svelte
77
+ <script>
78
+ import Pagination from '@ticatec/uniface-element/Pagination';
79
+
80
+ let currentPage = 1;
81
+ let totalPages = 20;
82
+ let itemsPerPage = 10;
83
+ let totalItems = 200;
84
+
85
+ let data = [];
86
+
87
+ function loadData(page) {
88
+ // Simulate API call
89
+ const startIndex = (page - 1) * itemsPerPage;
90
+ const endIndex = startIndex + itemsPerPage;
91
+
92
+ data = Array.from({ length: itemsPerPage }, (_, i) => ({
93
+ id: startIndex + i + 1,
94
+ name: `Item ${startIndex + i + 1}`,
95
+ value: Math.random() * 100
96
+ }));
97
+ }
98
+
99
+ function handlePageChange(page) {
100
+ currentPage = page;
101
+ loadData(page);
102
+ }
103
+
104
+ // Load initial data
105
+ loadData(currentPage);
106
+ </script>
107
+
108
+ <div class="data-table">
109
+ <table>
110
+ <thead>
111
+ <tr>
112
+ <th>ID</th>
113
+ <th>Name</th>
114
+ <th>Value</th>
115
+ </tr>
116
+ </thead>
117
+ <tbody>
118
+ {#each data as item}
119
+ <tr>
120
+ <td>{item.id}</td>
121
+ <td>{item.name}</td>
122
+ <td>{item.value.toFixed(2)}</td>
123
+ </tr>
124
+ {/each}
125
+ </tbody>
126
+ </table>
127
+
128
+ <div class="pagination-wrapper">
129
+ <Pagination
130
+ pageNo={currentPage}
131
+ pageCount={totalPages}
132
+ onPageChange={handlePageChange}
133
+ type="round"
134
+ />
135
+ </div>
136
+ </div>
137
+
138
+ <style>
139
+ .data-table {
140
+ width: 100%;
141
+ }
142
+
143
+ table {
144
+ width: 100%;
145
+ border-collapse: collapse;
146
+ margin-bottom: 20px;
147
+ }
148
+
149
+ th, td {
150
+ padding: 12px;
151
+ text-align: left;
152
+ border-bottom: 1px solid #ddd;
153
+ }
154
+
155
+ th {
156
+ background-color: #f5f5f5;
157
+ font-weight: 600;
158
+ }
159
+
160
+ .pagination-wrapper {
161
+ display: flex;
162
+ justify-content: center;
163
+ margin-top: 20px;
164
+ }
165
+ </style>
166
+ ```
167
+
168
+ ### Search Results Pagination
169
+
170
+ ```svelte
171
+ <script>
172
+ import Pagination from '@ticatec/uniface-element/Pagination';
173
+
174
+ let searchQuery = '';
175
+ let currentPage = 1;
176
+ let totalPages = 0;
177
+ let results = [];
178
+ let loading = false;
179
+
180
+ async function performSearch(query, page = 1) {
181
+ if (!query.trim()) return;
182
+
183
+ loading = true;
184
+
185
+ try {
186
+ // Simulate API search
187
+ await new Promise(resolve => setTimeout(resolve, 500));
188
+
189
+ const mockResults = Array.from({ length: 10 }, (_, i) => ({
190
+ id: i + 1,
191
+ title: `Search Result ${i + 1} for "${query}"`,
192
+ description: `This is a description for search result ${i + 1}`,
193
+ url: `https://example.com/result-${i + 1}`
194
+ }));
195
+
196
+ results = mockResults;
197
+ totalPages = Math.ceil(100 / 10); // Assume 100 total results
198
+ currentPage = page;
199
+ } finally {
200
+ loading = false;
201
+ }
202
+ }
203
+
204
+ function handlePageChange(page) {
205
+ performSearch(searchQuery, page);
206
+ }
207
+
208
+ function handleSearch() {
209
+ currentPage = 1;
210
+ performSearch(searchQuery, 1);
211
+ }
212
+ </script>
213
+
214
+ <div class="search-container">
215
+ <div class="search-box">
216
+ <input
217
+ type="text"
218
+ bind:value={searchQuery}
219
+ placeholder="Enter search query..."
220
+ on:keydown={(e) => e.key === 'Enter' && handleSearch()}
221
+ />
222
+ <button on:click={handleSearch}>Search</button>
223
+ </div>
224
+
225
+ {#if loading}
226
+ <div class="loading">Searching...</div>
227
+ {:else if results.length > 0}
228
+ <div class="results">
229
+ {#each results as result}
230
+ <div class="result-item">
231
+ <h3>{result.title}</h3>
232
+ <p>{result.description}</p>
233
+ <a href={result.url} target="_blank">{result.url}</a>
234
+ </div>
235
+ {/each}
236
+
237
+ <Pagination
238
+ pageNo={currentPage}
239
+ pageCount={totalPages}
240
+ onPageChange={handlePageChange}
241
+ type="circle"
242
+ style="margin-top: 30px;"
243
+ />
244
+ </div>
245
+ {/if}
246
+ </div>
247
+
248
+ <style>
249
+ .search-container {
250
+ max-width: 800px;
251
+ margin: 0 auto;
252
+ padding: 20px;
253
+ }
254
+
255
+ .search-box {
256
+ display: flex;
257
+ gap: 10px;
258
+ margin-bottom: 20px;
259
+ }
260
+
261
+ .search-box input {
262
+ flex: 1;
263
+ padding: 10px;
264
+ border: 1px solid #ddd;
265
+ border-radius: 4px;
266
+ }
267
+
268
+ .search-box button {
269
+ padding: 10px 20px;
270
+ background: #007bff;
271
+ color: white;
272
+ border: none;
273
+ border-radius: 4px;
274
+ cursor: pointer;
275
+ }
276
+
277
+ .loading {
278
+ text-align: center;
279
+ padding: 40px;
280
+ color: #666;
281
+ }
282
+
283
+ .result-item {
284
+ padding: 20px 0;
285
+ border-bottom: 1px solid #eee;
286
+ }
287
+
288
+ .result-item h3 {
289
+ margin: 0 0 10px 0;
290
+ color: #007bff;
291
+ }
292
+
293
+ .result-item p {
294
+ margin: 0 0 10px 0;
295
+ color: #666;
296
+ }
297
+
298
+ .result-item a {
299
+ color: #28a745;
300
+ text-decoration: none;
301
+ }
302
+ </style>
303
+ ```
304
+
305
+ ### Blog Posts with Different Styles
306
+
307
+ ```svelte
308
+ <script>
309
+ import Pagination from '@ticatec/uniface-element/Pagination';
310
+
311
+ let posts = [];
312
+ let currentPage = 1;
313
+ let totalPages = 15;
314
+ let paginationStyle = 'round';
315
+
316
+ function loadPosts(page) {
317
+ // Simulate loading blog posts
318
+ posts = Array.from({ length: 5 }, (_, i) => ({
319
+ id: (page - 1) * 5 + i + 1,
320
+ title: `Blog Post ${(page - 1) * 5 + i + 1}`,
321
+ excerpt: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit...',
322
+ author: `Author ${i + 1}`,
323
+ date: new Date(2024, 0, (page - 1) * 5 + i + 1).toLocaleDateString()
324
+ }));
325
+ }
326
+
327
+ function handlePageChange(page) {
328
+ currentPage = page;
329
+ loadPosts(page);
330
+ }
331
+
332
+ // Load initial posts
333
+ loadPosts(currentPage);
334
+ </script>
335
+
336
+ <div class="blog-container">
337
+ <div class="style-selector">
338
+ <label>Pagination Style:</label>
339
+ <select bind:value={paginationStyle}>
340
+ <option value="plain">Plain</option>
341
+ <option value="round">Round</option>
342
+ <option value="circle">Circle</option>
343
+ </select>
344
+ </div>
345
+
346
+ <div class="posts">
347
+ {#each posts as post}
348
+ <article class="post">
349
+ <h2>{post.title}</h2>
350
+ <div class="post-meta">
351
+ By {post.author} on {post.date}
352
+ </div>
353
+ <p>{post.excerpt}</p>
354
+ <a href="/posts/{post.id}">Read more</a>
355
+ </article>
356
+ {/each}
357
+ </div>
358
+
359
+ <div class="pagination-container">
360
+ <Pagination
361
+ pageNo={currentPage}
362
+ pageCount={totalPages}
363
+ onPageChange={handlePageChange}
364
+ type={paginationStyle}
365
+ />
366
+ </div>
367
+ </div>
368
+
369
+ <style>
370
+ .blog-container {
371
+ max-width: 900px;
372
+ margin: 0 auto;
373
+ padding: 20px;
374
+ }
375
+
376
+ .style-selector {
377
+ margin-bottom: 30px;
378
+ display: flex;
379
+ align-items: center;
380
+ gap: 10px;
381
+ }
382
+
383
+ .style-selector select {
384
+ padding: 5px 10px;
385
+ border: 1px solid #ddd;
386
+ border-radius: 4px;
387
+ }
388
+
389
+ .post {
390
+ padding: 30px 0;
391
+ border-bottom: 1px solid #eee;
392
+ }
393
+
394
+ .post h2 {
395
+ margin: 0 0 10px 0;
396
+ color: #333;
397
+ }
398
+
399
+ .post-meta {
400
+ color: #666;
401
+ font-size: 14px;
402
+ margin-bottom: 15px;
403
+ }
404
+
405
+ .post p {
406
+ margin: 0 0 15px 0;
407
+ line-height: 1.6;
408
+ }
409
+
410
+ .post a {
411
+ color: #007bff;
412
+ text-decoration: none;
413
+ }
414
+
415
+ .pagination-container {
416
+ display: flex;
417
+ justify-content: center;
418
+ margin-top: 40px;
419
+ }
420
+ </style>
421
+ ```
422
+
423
+ ### Gallery with Large Pagination
424
+
425
+ ```svelte
426
+ <script>
427
+ import Pagination from '@ticatec/uniface-element/Pagination';
428
+
429
+ let images = [];
430
+ let currentPage = 1;
431
+ let totalPages = 25;
432
+
433
+ function loadImages(page) {
434
+ // Simulate loading gallery images
435
+ images = Array.from({ length: 12 }, (_, i) => ({
436
+ id: (page - 1) * 12 + i + 1,
437
+ src: `https://picsum.photos/300/200?random=${(page - 1) * 12 + i + 1}`,
438
+ title: `Image ${(page - 1) * 12 + i + 1}`,
439
+ description: `Beautiful image number ${(page - 1) * 12 + i + 1}`
440
+ }));
441
+ }
442
+
443
+ function handlePageChange(page) {
444
+ currentPage = page;
445
+ loadImages(page);
446
+ // Scroll to top after page change
447
+ window.scrollTo({ top: 0, behavior: 'smooth' });
448
+ }
449
+
450
+ // Load initial images
451
+ loadImages(currentPage);
452
+ </script>
453
+
454
+ <div class="gallery-container">
455
+ <h1>Photo Gallery</h1>
456
+ <p>Page {currentPage} of {totalPages}</p>
457
+
458
+ <div class="image-grid">
459
+ {#each images as image}
460
+ <div class="image-card">
461
+ <img src={image.src} alt={image.title} loading="lazy" />
462
+ <div class="image-info">
463
+ <h3>{image.title}</h3>
464
+ <p>{image.description}</p>
465
+ </div>
466
+ </div>
467
+ {/each}
468
+ </div>
469
+
470
+ <div class="pagination-wrapper">
471
+ <Pagination
472
+ pageNo={currentPage}
473
+ pageCount={totalPages}
474
+ onPageChange={handlePageChange}
475
+ type="round"
476
+ big
477
+ />
478
+ </div>
479
+ </div>
480
+
481
+ <style>
482
+ .gallery-container {
483
+ max-width: 1200px;
484
+ margin: 0 auto;
485
+ padding: 20px;
486
+ }
487
+
488
+ .gallery-container h1 {
489
+ text-align: center;
490
+ margin-bottom: 10px;
491
+ }
492
+
493
+ .gallery-container p {
494
+ text-align: center;
495
+ color: #666;
496
+ margin-bottom: 30px;
497
+ }
498
+
499
+ .image-grid {
500
+ display: grid;
501
+ grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
502
+ gap: 20px;
503
+ margin-bottom: 40px;
504
+ }
505
+
506
+ .image-card {
507
+ border: 1px solid #ddd;
508
+ border-radius: 8px;
509
+ overflow: hidden;
510
+ box-shadow: 0 2px 4px rgba(0,0,0,0.1);
511
+ transition: transform 0.2s;
512
+ }
513
+
514
+ .image-card:hover {
515
+ transform: translateY(-2px);
516
+ }
517
+
518
+ .image-card img {
519
+ width: 100%;
520
+ height: 200px;
521
+ object-fit: cover;
522
+ }
523
+
524
+ .image-info {
525
+ padding: 15px;
526
+ }
527
+
528
+ .image-info h3 {
529
+ margin: 0 0 5px 0;
530
+ font-size: 16px;
531
+ }
532
+
533
+ .image-info p {
534
+ margin: 0;
535
+ color: #666;
536
+ font-size: 14px;
537
+ }
538
+
539
+ .pagination-wrapper {
540
+ display: flex;
541
+ justify-content: center;
542
+ }
543
+ </style>
544
+ ```
545
+
546
+ ### E-commerce Product Listing
547
+
548
+ ```svelte
549
+ <script>
550
+ import Pagination from '@ticatec/uniface-element/Pagination';
551
+
552
+ let products = [];
553
+ let currentPage = 1;
554
+ let totalPages = 12;
555
+ let sortBy = 'name';
556
+
557
+ function loadProducts(page, sort = 'name') {
558
+ // Simulate loading products
559
+ products = Array.from({ length: 8 }, (_, i) => ({
560
+ id: (page - 1) * 8 + i + 1,
561
+ name: `Product ${(page - 1) * 8 + i + 1}`,
562
+ price: (Math.random() * 100 + 10).toFixed(2),
563
+ rating: (Math.random() * 2 + 3).toFixed(1),
564
+ image: `https://picsum.photos/250/250?random=${(page - 1) * 8 + i + 1}`,
565
+ description: 'High quality product with excellent features'
566
+ }));
567
+
568
+ // Sort products
569
+ if (sort === 'price') {
570
+ products.sort((a, b) => parseFloat(a.price) - parseFloat(b.price));
571
+ } else if (sort === 'rating') {
572
+ products.sort((a, b) => parseFloat(b.rating) - parseFloat(a.rating));
573
+ }
574
+ }
575
+
576
+ function handlePageChange(page) {
577
+ currentPage = page;
578
+ loadProducts(page, sortBy);
579
+ }
580
+
581
+ function handleSortChange() {
582
+ loadProducts(currentPage, sortBy);
583
+ }
584
+
585
+ // Load initial products
586
+ loadProducts(currentPage, sortBy);
587
+ </script>
588
+
589
+ <div class="shop-container">
590
+ <div class="shop-header">
591
+ <h1>Our Products</h1>
592
+ <div class="sort-controls">
593
+ <label>Sort by:</label>
594
+ <select bind:value={sortBy} on:change={handleSortChange}>
595
+ <option value="name">Name</option>
596
+ <option value="price">Price</option>
597
+ <option value="rating">Rating</option>
598
+ </select>
599
+ </div>
600
+ </div>
601
+
602
+ <div class="products-grid">
603
+ {#each products as product}
604
+ <div class="product-card">
605
+ <img src={product.image} alt={product.name} />
606
+ <div class="product-info">
607
+ <h3>{product.name}</h3>
608
+ <p class="description">{product.description}</p>
609
+ <div class="product-details">
610
+ <span class="price">${product.price}</span>
611
+ <span class="rating">★ {product.rating}</span>
612
+ </div>
613
+ <button class="add-to-cart">Add to Cart</button>
614
+ </div>
615
+ </div>
616
+ {/each}
617
+ </div>
618
+
619
+ <div class="pagination-footer">
620
+ <Pagination
621
+ pageNo={currentPage}
622
+ pageCount={totalPages}
623
+ onPageChange={handlePageChange}
624
+ type="round"
625
+ />
626
+ <div class="page-info">
627
+ Showing page {currentPage} of {totalPages}
628
+ </div>
629
+ </div>
630
+ </div>
631
+
632
+ <style>
633
+ .shop-container {
634
+ max-width: 1200px;
635
+ margin: 0 auto;
636
+ padding: 20px;
637
+ }
638
+
639
+ .shop-header {
640
+ display: flex;
641
+ justify-content: space-between;
642
+ align-items: center;
643
+ margin-bottom: 30px;
644
+ }
645
+
646
+ .sort-controls {
647
+ display: flex;
648
+ align-items: center;
649
+ gap: 10px;
650
+ }
651
+
652
+ .sort-controls select {
653
+ padding: 5px 10px;
654
+ border: 1px solid #ddd;
655
+ border-radius: 4px;
656
+ }
657
+
658
+ .products-grid {
659
+ display: grid;
660
+ grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
661
+ gap: 24px;
662
+ margin-bottom: 40px;
663
+ }
664
+
665
+ .product-card {
666
+ border: 1px solid #ddd;
667
+ border-radius: 8px;
668
+ overflow: hidden;
669
+ transition: box-shadow 0.2s;
670
+ }
671
+
672
+ .product-card:hover {
673
+ box-shadow: 0 4px 12px rgba(0,0,0,0.15);
674
+ }
675
+
676
+ .product-card img {
677
+ width: 100%;
678
+ height: 250px;
679
+ object-fit: cover;
680
+ }
681
+
682
+ .product-info {
683
+ padding: 16px;
684
+ }
685
+
686
+ .product-info h3 {
687
+ margin: 0 0 8px 0;
688
+ font-size: 18px;
689
+ }
690
+
691
+ .description {
692
+ color: #666;
693
+ font-size: 14px;
694
+ margin: 0 0 12px 0;
695
+ }
696
+
697
+ .product-details {
698
+ display: flex;
699
+ justify-content: space-between;
700
+ align-items: center;
701
+ margin-bottom: 16px;
702
+ }
703
+
704
+ .price {
705
+ font-size: 20px;
706
+ font-weight: bold;
707
+ color: #007bff;
708
+ }
709
+
710
+ .rating {
711
+ color: #ff9500;
712
+ }
713
+
714
+ .add-to-cart {
715
+ width: 100%;
716
+ padding: 10px;
717
+ background: #007bff;
718
+ color: white;
719
+ border: none;
720
+ border-radius: 4px;
721
+ cursor: pointer;
722
+ font-size: 16px;
723
+ }
724
+
725
+ .add-to-cart:hover {
726
+ background: #0056b3;
727
+ }
728
+
729
+ .pagination-footer {
730
+ display: flex;
731
+ flex-direction: column;
732
+ align-items: center;
733
+ gap: 10px;
734
+ }
735
+
736
+ .page-info {
737
+ color: #666;
738
+ font-size: 14px;
739
+ }
740
+ </style>
741
+ ```
742
+
743
+ ### Mobile-Responsive Pagination
744
+
745
+ ```svelte
746
+ <script>
747
+ import Pagination from '@ticatec/uniface-element/Pagination';
748
+
749
+ let currentPage = 1;
750
+ let totalPages = 20;
751
+ let isMobile = false;
752
+
753
+ import { onMount } from 'svelte';
754
+
755
+ onMount(() => {
756
+ const checkMobile = () => {
757
+ isMobile = window.innerWidth < 768;
758
+ };
759
+
760
+ checkMobile();
761
+ window.addEventListener('resize', checkMobile);
762
+
763
+ return () => window.removeEventListener('resize', checkMobile);
764
+ });
765
+
766
+ function handlePageChange(page) {
767
+ currentPage = page;
768
+ }
769
+ </script>
770
+
771
+ <div class="responsive-container">
772
+ <div class="content">
773
+ <h2>Responsive Pagination Example</h2>
774
+ <p>This pagination adapts to mobile and desktop screens.</p>
775
+
776
+ <!-- Sample content -->
777
+ <div class="sample-content">
778
+ {#each Array(10) as _, i}
779
+ <div class="content-item">
780
+ Item {(currentPage - 1) * 10 + i + 1}
781
+ </div>
782
+ {/each}
783
+ </div>
784
+ </div>
785
+
786
+ <div class="pagination-section">
787
+ <Pagination
788
+ pageNo={currentPage}
789
+ pageCount={totalPages}
790
+ onPageChange={handlePageChange}
791
+ type="round"
792
+ style={isMobile ? 'transform: scale(0.9);' : ''}
793
+ />
794
+
795
+ {#if isMobile}
796
+ <div class="mobile-info">
797
+ Page {currentPage} of {totalPages}
798
+ </div>
799
+ {/if}
800
+ </div>
801
+ </div>
802
+
803
+ <style>
804
+ .responsive-container {
805
+ max-width: 800px;
806
+ margin: 0 auto;
807
+ padding: 20px;
808
+ }
809
+
810
+ .content h2 {
811
+ text-align: center;
812
+ margin-bottom: 10px;
813
+ }
814
+
815
+ .content p {
816
+ text-align: center;
817
+ color: #666;
818
+ margin-bottom: 30px;
819
+ }
820
+
821
+ .sample-content {
822
+ display: grid;
823
+ grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
824
+ gap: 16px;
825
+ margin-bottom: 30px;
826
+ }
827
+
828
+ .content-item {
829
+ padding: 20px;
830
+ background: #f8f9fa;
831
+ border: 1px solid #dee2e6;
832
+ border-radius: 8px;
833
+ text-align: center;
834
+ }
835
+
836
+ .pagination-section {
837
+ display: flex;
838
+ flex-direction: column;
839
+ align-items: center;
840
+ gap: 10px;
841
+ }
842
+
843
+ .mobile-info {
844
+ font-size: 14px;
845
+ color: #666;
846
+ }
847
+
848
+ @media (max-width: 767px) {
849
+ .sample-content {
850
+ grid-template-columns: 1fr 1fr;
851
+ gap: 12px;
852
+ }
853
+
854
+ .content-item {
855
+ padding: 16px;
856
+ font-size: 14px;
857
+ }
858
+ }
859
+ </style>
860
+ ```
861
+
862
+ ## Best Practices
863
+
864
+ 1. **Page State Management**: Always maintain current page state properly
865
+ 2. **Loading States**: Show loading indicators during page transitions
866
+ 3. **URL Synchronization**: Keep URL in sync with current page when appropriate
867
+ 4. **Accessibility**: Ensure keyboard navigation and screen reader support
868
+ 5. **Mobile Optimization**: Consider touch-friendly sizing on mobile devices
869
+ 6. **Performance**: Implement virtual scrolling for very large datasets
870
+ 7. **User Feedback**: Provide clear indication of current page and total pages
871
+
872
+ ## Styling
873
+
874
+ The Pagination component provides several CSS classes for customization:
875
+
876
+ ```css
877
+ .uniface-pagination-panel {
878
+ display: flex;
879
+ align-items: center;
880
+ gap: 4px;
881
+ }
882
+
883
+ .uniface-pagination-panel.big {
884
+ /* Larger size variant */
885
+ }
886
+
887
+ .uniface-page-no {
888
+ cursor: pointer;
889
+ padding: 8px 12px;
890
+ border-radius: 4px;
891
+ transition: background-color 0.2s;
892
+ }
893
+
894
+ .uniface-page-no:hover {
895
+ background-color: #f5f5f5;
896
+ }
897
+
898
+ .uniface-page-no.selected {
899
+ background-color: #007bff;
900
+ color: white;
901
+ }
902
+
903
+ .uniface-page-gap {
904
+ padding: 8px 4px;
905
+ color: #666;
906
+ }
907
+
908
+ /* Style variants */
909
+ .uniface-pagination-panel.round .uniface-page-no {
910
+ border-radius: 8px;
911
+ }
912
+
913
+ .uniface-pagination-panel.circle .uniface-page-no {
914
+ border-radius: 50%;
915
+ width: 40px;
916
+ height: 40px;
917
+ display: flex;
918
+ align-items: center;
919
+ justify-content: center;
920
+ }
921
+
922
+ .uniface-pagination-panel.plain .uniface-page-no {
923
+ border-radius: 0;
924
+ border-bottom: 2px solid transparent;
925
+ }
926
+
927
+ .uniface-pagination-panel.plain .uniface-page-no.selected {
928
+ background-color: transparent;
929
+ color: #007bff;
930
+ border-bottom-color: #007bff;
931
+ }
932
+ ```
933
+
934
+ ## Accessibility
935
+
936
+ - Keyboard navigation support (Tab, Enter, Space)
937
+ - ARIA labels for screen readers
938
+ - Focus management and visual indicators
939
+ - High contrast mode compatibility
940
+ - Semantic HTML structure
941
+
942
+ ## Related Components
943
+
944
+ - [PaginationPanel](../pagination-panel/README.md) - Full pagination panel with page size controls
945
+ - [DataTable](../data-table/README.md) - Data table with built-in pagination
946
+ - [Button](../button/README.md) - For custom pagination controls