intable 0.0.7 → 0.0.8
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/.github/copilot-instructions.md +102 -0
- package/docs/index-BaMALNy6.css +1 -1
- package/docs/index-CDN48t9E.js +2 -2
- package/index.html +13 -14
- package/package.json +9 -4
- package/packages/intable/package.json +1 -1
- package/packages/intable/src/index.tsx +25 -17
- package/packages/intable/src/plugins/CopyPastePlugin.tsx +49 -13
- package/packages/intable/src/plugins/DiffPlugin.tsx +31 -18
- package/packages/intable/src/theme/dark.scss +46 -0
- package/packages/intable/src/theme/github.scss +80 -0
- package/packages/intable/src/theme/material.scss +73 -0
- package/packages/intable/src/theme/shadcn.scss +66 -0
- package/packages/intable/src/theme/stripe.scss +57 -0
- package/packages/react/package.json +13 -8
- package/packages/react/src/index.ts +1 -1
- package/packages/vue/package.json +1 -1
- package/scripts/publish.js +1 -1
- package/src/index.tsx +20 -0
- package/src/pages/demo/BasicDemo.tsx +19 -0
- package/src/pages/demo/CellMergeDemo.tsx +41 -0
- package/src/pages/demo/CellSelectionDemo.tsx +24 -0
- package/src/pages/demo/CompositeDemo.tsx +60 -0
- package/src/pages/demo/CopyPasteDemo.tsx +26 -0
- package/src/pages/demo/DiffDemo.tsx +33 -0
- package/src/pages/demo/DragDemo.tsx +25 -0
- package/src/pages/demo/EditableDemo.tsx +58 -0
- package/src/pages/demo/ExpandDemo.tsx +32 -0
- package/src/pages/demo/HeaderGroupDemo.tsx +36 -0
- package/src/pages/demo/HistoryDemo.tsx +28 -0
- package/src/pages/demo/ReactDemo.tsx +59 -0
- package/src/pages/demo/ResizeDemo.tsx +24 -0
- package/src/pages/demo/RowGroupDemo.tsx +43 -0
- package/src/pages/demo/RowSelectionDemo.tsx +27 -0
- package/src/pages/demo/TreeDemo.tsx +45 -0
- package/src/pages/demo/VirtualScrollDemo.tsx +21 -0
- package/src/pages/demo/helpers.tsx +39 -0
- package/src/pages/demo/index.tsx +180 -0
- package/src/pages/index.tsx +2 -0
- package/src/pages/website.scss +37 -0
- package/src/pages/website.tsx +651 -0
- package/vite.config.ts +70 -63
- package/src/demo.tsx +0 -107
package/vite.config.ts
CHANGED
|
@@ -1,63 +1,70 @@
|
|
|
1
|
-
import { defineConfig, type Plugin } from 'vite'
|
|
2
|
-
import solid from 'vite-plugin-solid'
|
|
3
|
-
import path from 'path'
|
|
4
|
-
|
|
5
|
-
export default defineConfig({
|
|
6
|
-
base: './',
|
|
7
|
-
build: {
|
|
8
|
-
outDir: 'docs',
|
|
9
|
-
assetsDir: './',
|
|
10
|
-
},
|
|
11
|
-
resolve: {
|
|
12
|
-
alias: { '@': path.resolve(__dirname, 'src') }
|
|
13
|
-
},
|
|
14
|
-
plugins: [
|
|
15
|
-
(await import('babel-plugin-solid-undestructure')).undestructurePlugin('ts'),
|
|
16
|
-
(await import('babel-plugin-solid-undestructure')).undestructurePlugin('vanilla-js'),
|
|
17
|
-
{ load: (id) => id.includes('undestructure-macros') ? '' : null },
|
|
18
|
-
|
|
19
|
-
solid(),
|
|
20
|
-
|
|
21
|
-
(await import('
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
}),
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
1
|
+
import { defineConfig, type Plugin } from 'vite'
|
|
2
|
+
import solid from 'vite-plugin-solid'
|
|
3
|
+
import path from 'path'
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
base: './',
|
|
7
|
+
build: {
|
|
8
|
+
outDir: 'docs',
|
|
9
|
+
assetsDir: './',
|
|
10
|
+
},
|
|
11
|
+
resolve: {
|
|
12
|
+
alias: { '@': path.resolve(__dirname, 'src') }
|
|
13
|
+
},
|
|
14
|
+
plugins: [
|
|
15
|
+
(await import('babel-plugin-solid-undestructure')).undestructurePlugin('ts'),
|
|
16
|
+
(await import('babel-plugin-solid-undestructure')).undestructurePlugin('vanilla-js'),
|
|
17
|
+
{ load: (id) => id.includes('undestructure-macros') ? '' : null },
|
|
18
|
+
|
|
19
|
+
solid(),
|
|
20
|
+
|
|
21
|
+
(await import('vite-plugin-pages')).default({
|
|
22
|
+
resolver: 'solid',
|
|
23
|
+
dirs: 'src/pages',
|
|
24
|
+
extendRoute: (route: any) => route,
|
|
25
|
+
generate: { dts: 'src/types/pages.d.ts' },
|
|
26
|
+
}),
|
|
27
|
+
|
|
28
|
+
(await import('unocss/vite')).default({
|
|
29
|
+
presets: [
|
|
30
|
+
// (await import('@ameinhardt/unocss-preset-daisy')).presetDaisy({ base: true, utils: true, logs: true, styled: true }),
|
|
31
|
+
(await import('unocss/preset-wind4')).default({ dark: 'media' }),
|
|
32
|
+
{
|
|
33
|
+
name: "@preset-rem-to-px",
|
|
34
|
+
postprocess: (util) => {
|
|
35
|
+
util.entries.forEach((i) => {
|
|
36
|
+
const value = i[1];
|
|
37
|
+
if (typeof value === "string" && value.includes('var(--spacing)')) i[1] = value.replaceAll('var(--spacing)', '4px')
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
transformers: [
|
|
43
|
+
(await import('@unocss/transformer-directives')).default(),
|
|
44
|
+
(await import('unocss')).transformerVariantGroup(),
|
|
45
|
+
],
|
|
46
|
+
shortcuts: {
|
|
47
|
+
aic: 'items-center',
|
|
48
|
+
},
|
|
49
|
+
// theme: (await import('daisyui/functions/variables.js')).default
|
|
50
|
+
}),
|
|
51
|
+
{
|
|
52
|
+
enforce: 'post',
|
|
53
|
+
transform: (code, id) => /__uno.css(.*?raw)$/.test(id) ? `export default \`${code.replaceAll('\\', '\\\\')}\`` : void 0
|
|
54
|
+
} as Plugin,
|
|
55
|
+
|
|
56
|
+
(await import('unplugin-auto-import/vite')).default({
|
|
57
|
+
dts: './src/types/auto-imports.d.ts',
|
|
58
|
+
resolvers: [(await import('unplugin-icons/resolver')).default({ extension: 'jsx', customCollections: ['my'] })]
|
|
59
|
+
}),
|
|
60
|
+
(await import('unplugin-icons/vite')).default({
|
|
61
|
+
autoInstall: true,
|
|
62
|
+
compiler: 'solid',
|
|
63
|
+
customCollections: {
|
|
64
|
+
my: (await import('unplugin-icons/loaders')).FileSystemIconLoader('src/assets')
|
|
65
|
+
}
|
|
66
|
+
}),
|
|
67
|
+
|
|
68
|
+
(await import('rollup-plugin-visualizer')).visualizer()
|
|
69
|
+
],
|
|
70
|
+
})
|
package/src/demo.tsx
DELETED
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { batch, createComputed, createMemo } from 'solid-js'
|
|
2
|
-
import { render } from 'solid-js/web'
|
|
3
|
-
import { createMutable, createStore, produce, reconcile } from 'solid-js/store'
|
|
4
|
-
import { range } from 'es-toolkit'
|
|
5
|
-
|
|
6
|
-
// import Intable from 'intable'
|
|
7
|
-
// import { log } from 'intable/utils'
|
|
8
|
-
// import { VirtualScrollPlugin } from 'intable/plugins/VirtualScrollPlugin'
|
|
9
|
-
|
|
10
|
-
import { Intable } from '../packages/intable/src'
|
|
11
|
-
// import '../packages/intable/src/theme/element-plus.scss'
|
|
12
|
-
import { log } from '../packages/intable/src/utils'
|
|
13
|
-
import { VirtualScrollPlugin } from '../packages/intable/src/plugins/VirtualScrollPlugin'
|
|
14
|
-
import { HistoryPlugin } from '../packages/intable/src/plugins/HistoryPlugin'
|
|
15
|
-
import { DiffPlugin } from '../packages/intable/src/plugins/DiffPlugin'
|
|
16
|
-
// import 'intable/theme/element-plus.scss'
|
|
17
|
-
// import 'intable/dist/theme/element-plus.scss'
|
|
18
|
-
|
|
19
|
-
const root = document.body.appendChild(document.createElement('div'))
|
|
20
|
-
|
|
21
|
-
const state = createMutable({ bool: true })
|
|
22
|
-
|
|
23
|
-
const cols = createMutable([
|
|
24
|
-
{ name: '基本信息', children: [
|
|
25
|
-
{ id: 'col_0', name: 'col_0', width: 80, editable: true },
|
|
26
|
-
{ id: 'col_1', name: 'col_1', width: 80, editable: true },
|
|
27
|
-
{ name: '333', width: 80, editable: true },
|
|
28
|
-
]},
|
|
29
|
-
{ name: 'xxx' },
|
|
30
|
-
{ name: '详细数据', children: [
|
|
31
|
-
{ id: 'col_2', name: 'col_2', width: 80, editable: true },
|
|
32
|
-
{ id: 'col_3', name: 'col_3', width: 80, editable: true },
|
|
33
|
-
{ id: 'col_4', name: 'col_4', width: 80, editable: true },
|
|
34
|
-
]},
|
|
35
|
-
...range(20).map(e => ({ name: 'col_' + (e + 5), id: 'col_' + (e + 5), width: 80, editable: true })),
|
|
36
|
-
] as any[])
|
|
37
|
-
const leafColIds = range(20).map(e => 'col_' + e)
|
|
38
|
-
let data = createMutable(range(500).map((e, i) => Object.fromEntries(leafColIds.map(id => [id, id + '_' + i + 1]))))
|
|
39
|
-
|
|
40
|
-
// render(() => <input type='checkbox' checked={state.bool} onChange={(e) => state.bool = e.currentTarget.checked} />, root)
|
|
41
|
-
// render(() => <button onClick={() => data[0].col_1 = 'xxx'}>xxx</button>, root)
|
|
42
|
-
|
|
43
|
-
// const cols = [{name:'asd'},{}]
|
|
44
|
-
// const data = [{},{},{}]
|
|
45
|
-
// const data = [{},{},{}]
|
|
46
|
-
|
|
47
|
-
// cols[2].fixed = 'left'
|
|
48
|
-
// cols[0].editable = true
|
|
49
|
-
// cols[0].editor = 'select'
|
|
50
|
-
// cols[0].enum = { 1: 1, 2: 2, 3: 3 }
|
|
51
|
-
// cols[0].render = 'file'
|
|
52
|
-
// cols.forEach(e => (e.editable = true))
|
|
53
|
-
|
|
54
|
-
// cols.at(-3)!.width = undefined
|
|
55
|
-
// cols.at(-1)!.width = undefined
|
|
56
|
-
|
|
57
|
-
cols.unshift({ name: 'qwe' })
|
|
58
|
-
|
|
59
|
-
cols[0].fixed = 'left'
|
|
60
|
-
cols.at(-2)!.fixed = 'right'
|
|
61
|
-
cols.at(-1)!.fixed = 'right'
|
|
62
|
-
|
|
63
|
-
data.forEach(e => e.g = e.col_0 % 10)
|
|
64
|
-
data.forEach(e => e.n = e.col_0 % 3)
|
|
65
|
-
|
|
66
|
-
// render(() => (
|
|
67
|
-
// <Menu items={[
|
|
68
|
-
// { label: 'xx' }
|
|
69
|
-
// ]} />
|
|
70
|
-
// ), root)
|
|
71
|
-
|
|
72
|
-
render(() => <Intable
|
|
73
|
-
class='w-50vw! h-40vh m-10'
|
|
74
|
-
// class='m-10'
|
|
75
|
-
// style='width: 50vw; height: 40vh;'
|
|
76
|
-
rowDrag
|
|
77
|
-
colDrag
|
|
78
|
-
size='small'
|
|
79
|
-
index={state.bool}
|
|
80
|
-
stickyHeader={state.bool}
|
|
81
|
-
columns={cols}
|
|
82
|
-
onColumnsChange={v => batch(() => (cols.length = 0, cols.push(...v)))}
|
|
83
|
-
data={data}
|
|
84
|
-
onDataChange={v => batch(() => (data.length = 0, data.push(...v)))}
|
|
85
|
-
border
|
|
86
|
-
resizable={{ row: { enable: true } }}
|
|
87
|
-
plugins={[
|
|
88
|
-
VirtualScrollPlugin,
|
|
89
|
-
// HistoryPlugin,
|
|
90
|
-
// DiffPlugin,
|
|
91
|
-
]}
|
|
92
|
-
expand={{ enable: true, render: ({ data }) => <div class='p-2 c-red'>{JSON.stringify(data)}</div> }}
|
|
93
|
-
// rowGroup={{ fields: ['g', 'n'] }}
|
|
94
|
-
// rowGroup={{ fields: ['g'] }}
|
|
95
|
-
diff={{
|
|
96
|
-
onCommit: (...arg) => log(arg)
|
|
97
|
-
}}
|
|
98
|
-
virtual={{
|
|
99
|
-
// x: { enable: true, overscan: 0 },
|
|
100
|
-
// y: { enable: false },
|
|
101
|
-
}}
|
|
102
|
-
rowSelection={{
|
|
103
|
-
// enable: true,
|
|
104
|
-
// multiple: true,
|
|
105
|
-
// onChange: (selected, unselected) => log(selected, unselected)
|
|
106
|
-
}}
|
|
107
|
-
/>, root)
|