@stonecrop/atable 0.2.67 → 0.3.1
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/assets/index.css +1 -1
- package/dist/atable.d.ts +35 -127
- package/dist/atable.js +652 -652
- package/dist/atable.js.map +1 -1
- package/dist/atable.umd.cjs +2 -2
- package/dist/atable.umd.cjs.map +1 -1
- package/dist/src/stores/table.d.ts +1 -1
- package/dist/src/stores/table.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/components/ACell.vue +3 -5
- package/src/components/AExpansionRow.vue +1 -1
- package/src/components/ARow.vue +1 -1
- package/src/components/ATable.vue +13 -8
- package/src/components/ATableHeader.vue +2 -2
- package/src/components/ATableModal.vue +1 -1
- package/src/stores/table.ts +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type CSSProperties } from 'vue';
|
|
2
|
-
import type { CellContext, TableColumn, TableConfig, TableDisplay, TableModal, TableRow } from '
|
|
2
|
+
import type { CellContext, TableColumn, TableConfig, TableDisplay, TableModal, TableRow } from '../types';
|
|
3
3
|
/**
|
|
4
4
|
* Create a table store
|
|
5
5
|
* @param initData - Initial data for the table store
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/stores/table.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,KAAK,CAAA;AAEvD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/stores/table.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,aAAa,EAAiB,MAAM,KAAK,CAAA;AAEvD,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MA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;gCAkChC,MAAM;;;;;;;;;;;;2CApHzB,CAAA;;+CAKF,CAAC;;;;;;;;;;;;2CALC,CAAA;;+CAKF,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;wBAyJY,UAAU;kBA7EhB,CAAC,kBAAkB,MAAM,YAAY,MAAM,KAAG,CAAC;oCAmD7B,MAAM,YAAY,MAAM;kCAK1B,MAAM,YAAY,MAAM,SAAS,GAAG;iCA3CrC,WAAW,KAAG,aAAa;0BA0ElC,MAAM,gBAAgB,MAAM;mCAhEnB,MAAM;6BAJZ,MAAM;4BAlBP,MAAM,YAAY,MAAM,SAAS,GAAG;gCAkChC,MAAM;gMAyF1C,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stonecrop/atable",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"author": {
|
|
@@ -34,12 +34,12 @@
|
|
|
34
34
|
"**/*.css"
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@vueuse/components": "^
|
|
38
|
-
"@vueuse/core": "^
|
|
37
|
+
"@vueuse/components": "^12.0.0",
|
|
38
|
+
"@vueuse/core": "^12.0.0",
|
|
39
39
|
"pinia": "^2.3.0",
|
|
40
40
|
"vue": "^3.5.11",
|
|
41
|
-
"@stonecrop/
|
|
42
|
-
"@stonecrop/
|
|
41
|
+
"@stonecrop/themes": "0.3.1",
|
|
42
|
+
"@stonecrop/utilities": "0.3.1"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@microsoft/api-documenter": "^7.26.2",
|
package/src/components/ACell.vue
CHANGED
|
@@ -14,8 +14,7 @@
|
|
|
14
14
|
@input="updateCellData"
|
|
15
15
|
@click="showModal"
|
|
16
16
|
class="atable-cell"
|
|
17
|
-
:class="pinned ? 'sticky-column' : ''"
|
|
18
|
-
v-on-click-outside="store.closeModal">
|
|
17
|
+
:class="pinned ? 'sticky-column' : ''">
|
|
19
18
|
<component
|
|
20
19
|
v-if="column.cellComponent"
|
|
21
20
|
:is="column.cellComponent"
|
|
@@ -28,12 +27,11 @@
|
|
|
28
27
|
|
|
29
28
|
<script setup lang="ts">
|
|
30
29
|
import { KeypressHandlers, defaultKeypressHandlers, useKeyboardNav } from '@stonecrop/utilities'
|
|
31
|
-
import { vOnClickOutside } from '@vueuse/components'
|
|
32
30
|
import { useElementBounding } from '@vueuse/core'
|
|
33
31
|
import { computed, CSSProperties, ref, useTemplateRef } from 'vue'
|
|
34
32
|
|
|
35
|
-
import { createTableStore } from '
|
|
36
|
-
import { isHtmlString } from '
|
|
33
|
+
import { createTableStore } from '../stores/table'
|
|
34
|
+
import { isHtmlString } from '../utils'
|
|
37
35
|
|
|
38
36
|
const {
|
|
39
37
|
colIndex,
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
import { type KeypressHandlers, useKeyboardNav } from '@stonecrop/utilities'
|
|
17
17
|
import { computed, useTemplateRef } from 'vue'
|
|
18
18
|
|
|
19
|
-
import { createTableStore } from '
|
|
19
|
+
import { createTableStore } from '../stores/table'
|
|
20
20
|
|
|
21
21
|
const {
|
|
22
22
|
rowIndex,
|
package/src/components/ARow.vue
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
import { type KeypressHandlers, useKeyboardNav, defaultKeypressHandlers } from '@stonecrop/utilities'
|
|
29
29
|
import { useTemplateRef } from 'vue'
|
|
30
30
|
|
|
31
|
-
import { createTableStore } from '
|
|
31
|
+
import { createTableStore } from '../stores/table'
|
|
32
32
|
|
|
33
33
|
const {
|
|
34
34
|
rowIndex,
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<table
|
|
2
|
+
<table
|
|
3
|
+
ref="table"
|
|
4
|
+
class="atable"
|
|
5
|
+
:style="{ width: store.config.fullWidth ? '100%' : 'auto' }"
|
|
6
|
+
v-on-click-outside="store.closeModal">
|
|
3
7
|
<slot name="header" :data="store">
|
|
4
8
|
<ATableHeader :columns="store.columns" :store="store" />
|
|
5
9
|
</slot>
|
|
@@ -53,15 +57,16 @@
|
|
|
53
57
|
</template>
|
|
54
58
|
|
|
55
59
|
<script setup lang="ts">
|
|
60
|
+
import { vOnClickOutside } from '@vueuse/components'
|
|
56
61
|
import { useMutationObserver } from '@vueuse/core'
|
|
57
62
|
import { nextTick, watch, onMounted, useTemplateRef } from 'vue'
|
|
58
63
|
|
|
59
|
-
import ACell from '
|
|
60
|
-
import ARow from '
|
|
61
|
-
import ATableHeader from '
|
|
62
|
-
import ATableModal from '
|
|
63
|
-
import { createTableStore } from '
|
|
64
|
-
import type { TableColumn, TableConfig, TableRow } from '
|
|
64
|
+
import ACell from './ACell.vue'
|
|
65
|
+
import ARow from './ARow.vue'
|
|
66
|
+
import ATableHeader from './ATableHeader.vue'
|
|
67
|
+
import ATableModal from './ATableModal.vue'
|
|
68
|
+
import { createTableStore } from '../stores/table'
|
|
69
|
+
import type { TableColumn, TableConfig, TableRow } from '../types'
|
|
65
70
|
|
|
66
71
|
const {
|
|
67
72
|
id,
|
|
@@ -121,7 +126,7 @@ const assignStickyCellWidths = () => {
|
|
|
121
126
|
const firstDataRow = table.rows[1]
|
|
122
127
|
const headerCells = headerRow ? Array.from(headerRow.cells) : []
|
|
123
128
|
for (const [index, headerCell] of headerCells.entries()) {
|
|
124
|
-
const rowCell = firstDataRow
|
|
129
|
+
const rowCell = firstDataRow?.cells[index]
|
|
125
130
|
if (rowCell) {
|
|
126
131
|
headerCell.style.width = `${rowCell.offsetWidth}px`
|
|
127
132
|
}
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
</template>
|
|
24
24
|
|
|
25
25
|
<script setup lang="ts">
|
|
26
|
-
import { createTableStore } from '
|
|
27
|
-
import type { TableColumn } from '
|
|
26
|
+
import { createTableStore } from '../stores/table'
|
|
27
|
+
import type { TableColumn } from '../types'
|
|
28
28
|
|
|
29
29
|
const { columns, store } = defineProps<{
|
|
30
30
|
columns: TableColumn[]
|
package/src/stores/table.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineStore } from 'pinia'
|
|
2
2
|
import { type CSSProperties, computed, ref } from 'vue'
|
|
3
3
|
|
|
4
|
-
import type { CellContext, TableColumn, TableConfig, TableDisplay, TableModal, TableRow } from '
|
|
4
|
+
import type { CellContext, TableColumn, TableConfig, TableDisplay, TableModal, TableRow } from '../types'
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Create a table store
|