@stonecrop/atable 0.13.14 → 0.15.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 (48) hide show
  1. package/README.md +12 -11
  2. package/dist/assets/index.css +1 -1
  3. package/dist/atable.d.ts +533 -20
  4. package/dist/atable.js +1557 -1552
  5. package/dist/atable.js.map +1 -1
  6. package/dist/icons/stonecrop-ui-icon-add.svg +5 -0
  7. package/dist/icons/stonecrop-ui-icon-delete.svg +5 -0
  8. package/dist/icons/stonecrop-ui-icon-duplicate.svg +5 -0
  9. package/dist/icons/stonecrop-ui-icon-insert-above.svg +15 -0
  10. package/dist/icons/stonecrop-ui-icon-insert-below.svg +15 -0
  11. package/dist/icons/stonecrop-ui-icon-move.svg +4 -0
  12. package/dist/icons/stonecrop-ui-icon-open.svg +5 -0
  13. package/dist/src/icons/index.d.ts.map +1 -1
  14. package/dist/src/icons/index.js +5 -0
  15. package/dist/src/index.d.ts +1 -2
  16. package/dist/src/index.d.ts.map +1 -1
  17. package/dist/src/index.js +1 -3
  18. package/dist/src/schemaToColumns.d.ts +2 -2
  19. package/dist/src/schemaToColumns.d.ts.map +1 -1
  20. package/dist/src/schemaToColumns.js +7 -10
  21. package/dist/src/stores/table.d.ts +523 -12
  22. package/dist/src/stores/table.d.ts.map +1 -1
  23. package/dist/src/stores/table.js +17 -12
  24. package/dist/src/types/index.d.ts +14 -3
  25. package/dist/src/types/index.d.ts.map +1 -1
  26. package/dist/themes/default.css +1 -0
  27. package/package.json +26 -24
  28. package/src/components/ACell.vue +12 -10
  29. package/src/components/ARow.vue +61 -11
  30. package/src/components/ARowActions.vue +43 -15
  31. package/src/components/ATable.vue +18 -2
  32. package/src/components/ATableColumnFilter.vue +19 -18
  33. package/src/components/ATableHeader.vue +0 -2
  34. package/src/components/ATableModal.vue +0 -2
  35. package/src/icons/index.ts +8 -0
  36. package/src/index.ts +0 -3
  37. package/src/schemaToColumns.ts +7 -9
  38. package/src/stores/table.ts +14 -12
  39. package/src/types/index.ts +16 -3
  40. package/dist/atable.umd.cjs +0 -51
  41. package/dist/atable.umd.cjs.map +0 -1
  42. package/dist/icons/index.js +0 -31
  43. package/dist/index.js +0 -31
  44. package/dist/src/tsdoc-metadata.json +0 -11
  45. package/dist/stores/table.js +0 -795
  46. package/dist/types/index.js +0 -0
  47. package/dist/utils.js +0 -7
  48. package/src/components/AExpansionRow.vue +0 -105
File without changes
package/dist/utils.js DELETED
@@ -1,7 +0,0 @@
1
- export const isHtmlString = (htmlString) => {
2
- const $document = new DOMParser().parseFromString(htmlString, 'text/html');
3
- return Array.from($document.body.childNodes).some(node => node.nodeType === 1);
4
- };
5
- export const generateHash = (length = 8) => {
6
- return Array.from({ length }, () => Math.floor(Math.random() * 16).toString(16)).join('');
7
- };
@@ -1,105 +0,0 @@
1
- <template>
2
- <tr v-bind="$attrs" ref="rowEl" :tabindex="tabIndex" class="expandable-row">
3
- <td :tabIndex="-1" class="row-index" @click="store.toggleRowExpand(rowIndex)">
4
- {{ rowExpandSymbol }}
5
- </td>
6
- <slot name="row" />
7
- </tr>
8
- <tr v-if="store.display[rowIndex].expanded" ref="rowExpanded" :tabindex="tabIndex" class="expanded-row">
9
- <td :tabIndex="-1" :colspan="store.columns.length + 1" class="expanded-row-content">
10
- <slot name="content" />
11
- </td>
12
- </tr>
13
- </template>
14
-
15
- <script setup lang="ts">
16
- import { defaultKeypressHandlers, type KeypressHandlers, useKeyboardNav } from '@stonecrop/utilities'
17
- import { computed, useTemplateRef } from 'vue'
18
-
19
- import { createTableStore } from '../stores/table'
20
-
21
- const {
22
- rowIndex,
23
- store,
24
- tabIndex = -1,
25
- addNavigation = defaultKeypressHandlers,
26
- } = defineProps<{
27
- rowIndex: number
28
- store: ReturnType<typeof createTableStore>
29
- tabIndex?: number
30
- addNavigation?: boolean | KeypressHandlers
31
- }>()
32
-
33
- const rowRef = useTemplateRef<HTMLTableRowElement>('rowEl')
34
- // const expandedRowRef = useTemplateRef<HTMLDivElement>('rowExpanded')
35
-
36
- const rowExpandSymbol = computed(() => {
37
- return store.display[rowIndex].expanded ? '▼' : '►'
38
- })
39
-
40
- if (addNavigation) {
41
- const handlers: KeypressHandlers = {
42
- 'keydown.control.g': (event: KeyboardEvent) => {
43
- event.stopPropagation()
44
- event.preventDefault()
45
- store.toggleRowExpand(rowIndex)
46
- },
47
- }
48
-
49
- if (typeof addNavigation === 'object') {
50
- Object.assign(handlers, addNavigation)
51
- }
52
-
53
- useKeyboardNav([
54
- {
55
- selectors: rowRef,
56
- handlers: handlers,
57
- },
58
- ])
59
- }
60
- </script>
61
-
62
- <style>
63
- @import url('@stonecrop/themes/default.css');
64
-
65
- .row-index {
66
- color: var(--sc-header-text-color);
67
- font-weight: bold;
68
- text-align: center;
69
- user-select: none;
70
- width: 2ch;
71
- display: flex;
72
- align-items: center;
73
- justify-content: center;
74
- }
75
-
76
- .expandable-row {
77
- border-top: 1px solid var(--sc-row-border-color);
78
- height: var(--sc-atable-row-height);
79
- }
80
-
81
- .expandable-row > td:first-child {
82
- border-left: 4px solid var(--sc-row-border-color);
83
- }
84
-
85
- .expanded-row {
86
- border-left: 2px solid var(--sc-row-border-color);
87
- }
88
-
89
- .expandable-row:last-child {
90
- border-bottom: 1px solid var(--sc-row-border-color);
91
- }
92
-
93
- .expanded-row-content {
94
- border-top: 1px solid var(--sc-row-border-color);
95
- padding: 1.5rem;
96
- }
97
- </style>
98
-
99
- <style scoped>
100
- .expandable-row.changed-row-gradient:has(td.cell-modified) {
101
- --cell-color-start: color-mix(in srgb, var(--sc-cell-changed-color), #fff 20%);
102
- --cell-color-end: color-mix(in srgb, var(--sc-cell-changed-color), #fff 60%);
103
- background: linear-gradient(90deg, var(--cell-color-start), var(--cell-color-end));
104
- }
105
- </style>