@hoenergy/hoenergy-template-pc 1.0.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 (63) hide show
  1. package/.i18n_extractor.json +13 -0
  2. package/dist/components/data/table/FormaxTable/index.d.ts +7 -0
  3. package/dist/components/data/table/FormaxTable/src/BasicTable.d.ts +6 -0
  4. package/dist/components/data/table/FormaxTable/src/Table.vue.d.ts +99 -0
  5. package/dist/components/data/table/FormaxTable/src/components/settings/ColumnSetting.vue.d.ts +31 -0
  6. package/dist/components/data/table/FormaxTable/src/const.d.ts +9 -0
  7. package/dist/components/data/table/FormaxTable/src/hooks/useColumns.d.ts +10 -0
  8. package/dist/components/data/table/FormaxTable/src/hooks/useDataSource.d.ts +20 -0
  9. package/dist/components/data/table/FormaxTable/src/hooks/useLoading.d.ts +6 -0
  10. package/dist/components/data/table/FormaxTable/src/hooks/usePagination.d.ts +10 -0
  11. package/dist/components/data/table/FormaxTable/src/hooks/useTableContext.d.ts +13 -0
  12. package/dist/components/data/table/FormaxTable/src/props.d.ts +1 -0
  13. package/dist/components/data/table/FormaxTable/src/types/componentType.d.ts +1 -0
  14. package/dist/components/data/table/FormaxTable/src/types/pagination.d.ts +10 -0
  15. package/dist/components/data/table/FormaxTable/src/types/table.d.ts +36 -0
  16. package/dist/components/data/table/FormaxTable/src/types/tableAction.d.ts +23 -0
  17. package/dist/components/data/table/FormaxTable/src/utils.d.ts +11 -0
  18. package/dist/components/general/button/FormaxButton/index.d.ts +2 -0
  19. package/dist/index.d.ts +41 -0
  20. package/dist/index.js +37 -0
  21. package/dist/index.mjs +1862 -0
  22. package/dist/mock.d.ts +13 -0
  23. package/dist/style.css +1 -0
  24. package/dist/types.d.ts +34 -0
  25. package/docs/i18n-stub.mjs +12 -0
  26. package/docs/index.html +314 -0
  27. package/docs/index.js +658 -0
  28. package/docs/index.mjs +113892 -0
  29. package/docs/tailwind.css +4 -0
  30. package/docs/tailwind.generated.css +1 -0
  31. package/package.json +51 -0
  32. package/playground/App.vue +60 -0
  33. package/playground/index.html +12 -0
  34. package/playground/main.ts +12 -0
  35. package/src/components/data/table/FormaxTable/index.ts +143 -0
  36. package/src/components/data/table/FormaxTable/src/BasicTable.ts +12 -0
  37. package/src/components/data/table/FormaxTable/src/Table.vue +412 -0
  38. package/src/components/data/table/FormaxTable/src/components/TableAction.vue +155 -0
  39. package/src/components/data/table/FormaxTable/src/components/settings/ColumnSetting.vue +248 -0
  40. package/src/components/data/table/FormaxTable/src/const.ts +11 -0
  41. package/src/components/data/table/FormaxTable/src/hooks/useColumns.ts +147 -0
  42. package/src/components/data/table/FormaxTable/src/hooks/useDataSource.ts +238 -0
  43. package/src/components/data/table/FormaxTable/src/hooks/useLoading.ts +21 -0
  44. package/src/components/data/table/FormaxTable/src/hooks/usePagination.ts +65 -0
  45. package/src/components/data/table/FormaxTable/src/hooks/useTableContext.ts +23 -0
  46. package/src/components/data/table/FormaxTable/src/props.ts +77 -0
  47. package/src/components/data/table/FormaxTable/src/types/componentType.ts +9 -0
  48. package/src/components/data/table/FormaxTable/src/types/pagination.ts +10 -0
  49. package/src/components/data/table/FormaxTable/src/types/table.ts +45 -0
  50. package/src/components/data/table/FormaxTable/src/types/tableAction.ts +25 -0
  51. package/src/components/data/table/FormaxTable/src/utils.ts +65 -0
  52. package/src/components/general/button/FormaxButton/index.ts +70 -0
  53. package/src/index.ts +66 -0
  54. package/src/locales/en.json +13 -0
  55. package/src/locales/zh-CN.json +13 -0
  56. package/src/mock.ts +17 -0
  57. package/src/shims-vue.d.ts +6 -0
  58. package/src/types/i18n-auto-extractor.d.ts +3 -0
  59. package/src/types.ts +40 -0
  60. package/tailwind.config.cjs +12 -0
  61. package/tsconfig.json +16 -0
  62. package/tsup.config.ts +16 -0
  63. package/vite.config.ts +59 -0
@@ -0,0 +1,4 @@
1
+ @tailwind base;
2
+ @tailwind components;
3
+ @tailwind utilities;
4
+
@@ -0,0 +1 @@
1
+ *,:after,:before{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x:0;--tw-border-spacing-y:0;--tw-translate-x:0;--tw-translate-y:0;--tw-rotate:0;--tw-skew-x:0;--tw-skew-y:0;--tw-scale-x:1;--tw-scale-y:1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness:proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-color:rgba(59,130,246,.5);--tw-ring-offset-shadow:0 0 #0000;--tw-ring-shadow:0 0 #0000;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }/*! tailwindcss v3.4.19 | MIT License | https://tailwindcss.com*/*,:after,:before{box-sizing:border-box;border:0 solid #e5e7eb}:after,:before{--tw-content:""}:host,html{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,pre,samp{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dd,dl,figure,h1,h2,h3,h4,h5,h6,hr,p,pre{margin:0}fieldset{margin:0}fieldset,legend{padding:0}menu,ol,ul{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}[role=button],button{cursor:pointer}:disabled{cursor:default}audio,canvas,embed,iframe,img,object,svg,video{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.collapse{visibility:collapse}.fixed{position:fixed}.sticky{position:sticky}.mx-1{margin-right:.25rem}.ml-1,.mx-1{margin-left:.25rem}.ml-auto{margin-left:auto}.mt-1{margin-top:.25rem}.flex{display:flex}.\!table{display:table!important}.table{display:table}.hidden{display:none}.h-full{height:100%}.border-collapse{border-collapse:collapse}.cursor-pointer{cursor:pointer}.resize{resize:both}.flex-row{flex-direction:row}.items-center{align-items:center}.border{border-width:1px}.p-0{padding:0}.pb-\[16px\]{padding-bottom:16px}.text-gray-400{--tw-text-opacity:1;color:rgb(156 163 175/var(--tw-text-opacity,1))}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@hoenergy/hoenergy-template-pc",
3
+ "version": "1.0.0",
4
+ "description": "A cross-compatible Vue component library with metadata extraction",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "main": "dist/index.js",
9
+ "module": "dist/index.js",
10
+ "types": "dist/index.d.ts",
11
+ "unpkg": "dist/index.global.js",
12
+ "exports": {
13
+ ".": {
14
+ "import": "./dist/index.mjs",
15
+ "require": "./dist/index.js"
16
+ }
17
+ },
18
+ "scripts": {
19
+ "build:tailwind": "tailwindcss -i ./docs/tailwind.css -o ./docs/tailwind.generated.css --minify",
20
+ "build": "npm run build:tailwind && vite build --mode library",
21
+ "dev": "npm run build:tailwind && http-server . -p 3000 -c-1",
22
+ "test": "vite",
23
+ "start": "npm run dev"
24
+ },
25
+ "peerDependencies": {
26
+ "naive-ui": ">=2.12.0",
27
+ "vue": "^3.0.0"
28
+ },
29
+ "dependencies": {
30
+ "i18n-auto-extractor": "^1.3.2",
31
+ "sass": "^1.97.3",
32
+ "vite-plugin-dts": "^4.5.4",
33
+ "vue-i18n": "^11.2.8",
34
+ "vuedraggable": "^2.24.3"
35
+ },
36
+ "devDependencies": {
37
+ "@vicons/antd": "^0.12.0",
38
+ "@vitejs/plugin-vue": "^4.6.2",
39
+ "autoprefixer": "^10.4.18",
40
+ "http-server": "^14.1.1",
41
+ "i18n-auto-extractor": "^1.3.2",
42
+ "naive-ui": "^2.34.4",
43
+ "postcss": "^8.4.35",
44
+ "tailwindcss": "^3.3.5",
45
+ "tsup": "^6.1.0",
46
+ "typescript": "^5.0.0",
47
+ "vite": "^4.5.14",
48
+ "vue": "^3.3.0",
49
+ "vue-i18n": "^11.2.8"
50
+ }
51
+ }
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <n-config-provider :locale="zhCN" :date-locale="dateZhCN">
3
+ <div class="p-8">
4
+ <p2>组件测试</p2>
5
+ <FormaxTable :columns="columns" :request="loadDataTable" :toolbar-show="true" :can-resize="false"
6
+ :row-key="(row: any) => row.name" />
7
+ </div>
8
+ </n-config-provider>
9
+ </template>
10
+
11
+ <script setup lang="ts">
12
+ import { FormaxButton, FormaxTable } from '../src'
13
+ import { NConfigProvider, zhCN, dateZhCN, viVN, dateViVN } from 'naive-ui'
14
+ let columns = [
15
+ { title: '姓名', key: 'name' },
16
+ { title: '年龄', key: 'age' },
17
+ { title: '地址', key: 'address' },
18
+ ]
19
+ async function loadDataTable() {
20
+
21
+ return {
22
+ total: 23,
23
+ list: [
24
+ { name: '张三2323233333333333333333333333333333333333333', age: 18, address: '北京' },
25
+ { name: '李四', age: 20, address: '上海' },
26
+ { name: '王五', age: 22, address: '广州' },
27
+ { name: '赵六', age: 24, address: '深圳' },
28
+ { name: '王二', age: 26, address: '成都' },
29
+ { name: '王二', age: 26, address: '成都' },
30
+ { name: '张三2323233333333333333333333333333333333333333', age: 18, address: '北京' },
31
+ { name: '张三2323233333333333333333333333333333333333333', age: 18, address: '北京' },
32
+ { name: '李四', age: 20, address: '上海' },
33
+ { name: '王五', age: 22, address: '广州' },
34
+ { name: '赵六', age: 24, address: '深圳' },
35
+ { name: '王二', age: 26, address: '成都' },
36
+ { name: '王二', age: 26, address: '成都' },
37
+ { name: '张三2323233333333333333333333333333333333333333', age: 18, address: '北京' },
38
+ { name: '张三2323233333333333333333333333333333333333333', age: 18, address: '北京' },
39
+ { name: '李四', age: 20, address: '上海' },
40
+ { name: '王五', age: 22, address: '广州' },
41
+ { name: '赵六', age: 24, address: '深圳' },
42
+ { name: '王二', age: 26, address: '成都' },
43
+ { name: '王二', age: 26, address: '成都' },
44
+ { name: '张三2323233333333333333333333333333333333333333', age: 18, address: '北京' },
45
+ { name: '张三2323233333333333333333333333333333333333333', age: 18, address: '北京' },
46
+ { name: '李四', age: 20, address: '上海' },
47
+ { name: '王五', age: 22, address: '广州' },
48
+ { name: '赵六', age: 24, address: '深圳' },
49
+ { name: '王二', age: 26, address: '成都' },
50
+ { name: '王二', age: 26, address: '成都' }
51
+ ]
52
+ }
53
+ }
54
+ </script>
55
+
56
+ <style scoped>
57
+ section {
58
+ @apply border p-4 rounded-lg;
59
+ }
60
+ </style>
@@ -0,0 +1,12 @@
1
+ <!DOCTYPE html>
2
+ <html lang="zh-CN">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <title>Formax UI Playground</title>
7
+ </head>
8
+ <body>
9
+ <div id="app"></div>
10
+ <script type="module" src="./main.ts"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,12 @@
1
+ import { createApp } from 'vue'
2
+ import App from './App.vue'
3
+ import NaiveUI from 'naive-ui'
4
+ import FormaxUI from '../src'
5
+ import '../docs/tailwind.generated.css'
6
+ import { $at } from 'i18n-auto-extractor'
7
+
8
+ const app = createApp(App)
9
+ app.use(NaiveUI)
10
+ app.use(FormaxUI)
11
+ app.config.globalProperties.$at = $at
12
+ app.mount('#app')
@@ -0,0 +1,143 @@
1
+ import BasicTable from './src/Table.vue'
2
+ import type { FormaxComponent, ComponentMeta } from '../../../../types'
3
+
4
+ export { BasicTable }
5
+ export * from './src/types/table'
6
+ export * from './src/types/tableAction'
7
+
8
+ export const FormaxTableComponent = BasicTable as any as FormaxComponent
9
+
10
+ const meta: ComponentMeta = {
11
+ name: 'FormaxTable',
12
+ label: '高级数据表格',
13
+ description:
14
+ '基于 Naive UI 封装的高级数据表格组件,支持请求分页、工具栏、列设置等能力。',
15
+ props: {
16
+ title: {
17
+ type: 'string',
18
+ default: '',
19
+ description: '表格标题',
20
+ },
21
+ titleTooltip: {
22
+ type: 'string',
23
+ default: '',
24
+ description: '标题右侧提示文案',
25
+ },
26
+ dataSource: {
27
+ type: 'array | function',
28
+ default: [],
29
+ description: '表格数据源,或请求数据的函数(结合 request 使用)',
30
+ },
31
+ columns: {
32
+ type: 'array',
33
+ default: [],
34
+ description: '列配置,兼容 Naive UI NDataTable 的列定义',
35
+ },
36
+ pagination: {
37
+ type: 'object | boolean',
38
+ default: {},
39
+ description: '分页配置,false 时不显示分页',
40
+ },
41
+ toolbarShow: {
42
+ type: 'boolean',
43
+ default: false,
44
+ description: '是否显示右侧工具栏(斑马纹 / 刷新 / 密度 / 列设置)',
45
+ },
46
+ hasForm: {
47
+ type: 'boolean',
48
+ default: true,
49
+ description: '是否有顶部查询表单,用于计算表格高度',
50
+ },
51
+ canResize: {
52
+ type: 'boolean',
53
+ default: true,
54
+ description: '是否自动计算表格高度',
55
+ },
56
+ canExpand: {
57
+ type: 'boolean',
58
+ default: true,
59
+ description: '是否允许展开行(树形表格时)',
60
+ },
61
+ request: {
62
+ type: 'function',
63
+ default: undefined,
64
+ description: '远程请求函数,返回 Promise,配合分页参数使用',
65
+ },
66
+ },
67
+ events: [
68
+ {
69
+ name: 'fetch-success',
70
+ description: '请求成功时触发',
71
+ payload: '{ items, resultTotal }',
72
+ },
73
+ { name: 'fetch-error', description: '请求失败时触发', payload: 'Error' },
74
+ {
75
+ name: 'update:checked-row-keys',
76
+ description: '勾选行变化时触发',
77
+ payload: 'rowKeys: string[]',
78
+ },
79
+ {
80
+ name: 'edit-end',
81
+ description: '单元格编辑结束时触发',
82
+ payload: 'row, column',
83
+ },
84
+ { name: 'edit-row-end', description: '整行编辑结束时触发', payload: 'row' },
85
+ ],
86
+ slots: [
87
+ {
88
+ name: 'tableTitle',
89
+ description: '表格左上头部插槽,一般用来放置操作按钮',
90
+ },
91
+ {
92
+ name: 'toolbar',
93
+ description: '表格右上工具栏插槽,一般用来放置刷新、密度、列设置等按钮',
94
+ },
95
+ { name: 'default', description: '默认插槽,一般用来放置表格内容' },
96
+ ],
97
+ usage: `<template>
98
+ <FormaxTable
99
+ title="用户列表"
100
+ title-tooltip="支持请求分页、工具栏、列设置等能力"
101
+ :columns="columns"
102
+ :data-source="tableData"
103
+ :toolbar-show="true"
104
+ :has-form="true"
105
+ :can-resize="true"
106
+ :can-expand="true"
107
+ :request="fetchTableData"
108
+ />
109
+ </template>
110
+
111
+ <script setup lang="ts">
112
+ import type { BasicColumn } from 'formax-ui'
113
+
114
+ const columns: BasicColumn[] = [
115
+ { title: '姓名', key: 'name' },
116
+ { title: '年龄', key: 'age' },
117
+ { title: '地址', key: 'address' },
118
+ ]
119
+
120
+ const tableData = [
121
+ { name: '张三2323233333333333333333333333333333333333333', age: 18, address: '北京' },
122
+ { name: '李四', age: 20, address: '上海' },
123
+ ]
124
+
125
+ async function fetchTableData(params: Record<string, any>) {
126
+ // 这里可以对接实际接口
127
+ // 返回结构示例:
128
+ return {
129
+ total: 100,
130
+ list: [],
131
+ }
132
+ }
133
+ </script>`,
134
+ package: 'data',
135
+ category: 'table',
136
+ key: 'FormaxTable',
137
+ conKey: 'DCFormaxTable',
138
+ image: 'DCFormaxTable.png',
139
+ }
140
+
141
+ ;(FormaxTableComponent as any).__doc_meta__ = meta
142
+
143
+ export default FormaxTableComponent
@@ -0,0 +1,12 @@
1
+ import { defineComponent, h } from 'vue'
2
+ import { basicProps } from './props'
3
+ // @ts-ignore
4
+ import Table from './Table.vue'
5
+
6
+ export default defineComponent({
7
+ name: 'FormaxBasicTable',
8
+ props: basicProps,
9
+ setup(props, { slots }) {
10
+ return () => h(Table, props, slots)
11
+ },
12
+ })