@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
package/dist/mock.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ export declare const componentGoList: {
2
+ key: string;
3
+ label: string;
4
+ list: {
5
+ key: string;
6
+ title: string;
7
+ package: string;
8
+ category: string;
9
+ categoryName: string;
10
+ conKey: string;
11
+ image: string;
12
+ }[];
13
+ }[];
package/dist/style.css ADDED
@@ -0,0 +1 @@
1
+ .table-toolbar-inner-popover-title{padding:3px 0}.table-toolbar-right-icon{margin-left:12px;font-size:16px;color:var(--text-color);cursor:pointer}.table-toolbar-right-icon :hover{color:#1890ff}.table-toolbar-inner-checkbox{display:flex;align-items:center;padding:10px 14px}.table-toolbar-inner-checkbox:hover{background:rgba(19,180,151,.3)}.table-toolbar-inner-checkbox .drag-icon{display:inline-flex;margin-right:8px;cursor:move}.table-toolbar-inner-checkbox .drag-icon-hidden{visibility:hidden;cursor:default}.table-toolbar-inner-checkbox .ant-checkbox-wrapper{flex:1}.table-toolbar-inner-checkbox .ant-checkbox-wrapper:hover{color:#1890ff!important}.table-toolbar-inner-checkbox-dark:hover{background:hsla(0,0%,100%,.08)}.toolbar-popover .n-popover__content{padding:0}.table-toolbar[data-v-880c0022]{display:flex;justify-content:space-between}.table-toolbar-left[data-v-880c0022]{display:flex;align-items:center;justify-content:flex-start;flex:1}.table-toolbar-left-title[data-v-880c0022]{display:flex;align-items:center;justify-content:flex-start;font-size:16px;font-weight:600}.table-toolbar-right[data-v-880c0022]{display:flex;justify-content:flex-end;flex:1}.table-toolbar-right-icon[data-v-880c0022]{margin-left:12px;font-size:16px;cursor:pointer;color:var(--text-color)}.table-toolbar-right-icon[data-v-880c0022] :hover{color:#1890ff}[data-v-880c0022] .n-data-table-base-table{height:95%!important}.table-toolbar-inner-popover-title[data-v-880c0022]{padding:2px 0}.s-table[data-v-880c0022]{border-radius:8px 8px 0 0;transition:all .4s}.s-table[data-v-880c0022] .n-data-table .n-data-table-th .n-data-table-resize-button:after{background-color:#6e7d8b}.s-table[data-v-880c0022] .n-data-table .n-data-table-th .n-data-table-resize-button:hover:after{background-color:var(--n-th-icon-color-active)!important}
@@ -0,0 +1,34 @@
1
+ export interface PropMeta {
2
+ type: string;
3
+ default?: any;
4
+ description: string;
5
+ options?: string[];
6
+ }
7
+ export interface EventMeta {
8
+ name: string;
9
+ description: string;
10
+ payload?: string;
11
+ }
12
+ export interface SlotMeta {
13
+ name: string;
14
+ description: string;
15
+ }
16
+ export type Nullable<T> = T | null;
17
+ export type Recordable<T = any> = Record<string, T>;
18
+ export interface ComponentMeta {
19
+ name: string;
20
+ label: string;
21
+ description: string;
22
+ props: Record<string, PropMeta>;
23
+ events: EventMeta[];
24
+ slots?: SlotMeta[];
25
+ usage: string;
26
+ package?: string;
27
+ category?: string;
28
+ key?: string;
29
+ conKey?: string;
30
+ image?: string;
31
+ }
32
+ export type FormaxComponent = any & {
33
+ __doc_meta__?: ComponentMeta;
34
+ };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 文档页用 i18n 占位实现,避免在浏览器中加载 i18n-auto-extractor 及其依赖(如 js-md5)。
3
+ * 仅导出 $at:直接返回原文,满足组件展示即可。
4
+ */
5
+ function $at(zhText) {
6
+ return zhText;
7
+ }
8
+ function setCurrentLang() {}
9
+ function getCurrentLang() {
10
+ return { lang: 'zh-CN', langMap: {} };
11
+ }
12
+ export { $at, getCurrentLang, setCurrentLang };
@@ -0,0 +1,314 @@
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 组件文档</title>
7
+ <script type="importmap">
8
+ {
9
+ "imports": {
10
+ "vue": "https://unpkg.com/vue@3.4.15/dist/vue.esm-browser.prod.js",
11
+ "naive-ui": "./index.mjs",
12
+ "@vicons/antd": "https://esm.sh/@vicons/antd@0.12.0",
13
+ "formax-ui": "/dist/index.mjs",
14
+ "i18n-auto-extractor": "./i18n-stub.mjs"
15
+ }
16
+ }
17
+ </script>
18
+ <link rel="stylesheet" href="./tailwind.generated.css" />
19
+ <style>
20
+ body {
21
+ margin: 0;
22
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
23
+ 'Helvetica Neue', Arial, sans-serif;
24
+ height: 100vh;
25
+ }
26
+
27
+ #app {
28
+ display: flex;
29
+ width: 100%;
30
+ height: 100%;
31
+ }
32
+
33
+ .sidebar {
34
+ flex: 0 0 250px;
35
+ width: 250px;
36
+ background: #f5f7fa;
37
+ border-right: 1px solid #e4e7ed;
38
+ padding: 20px;
39
+ overflow-y: auto;
40
+ position: sticky;
41
+ top: 0;
42
+ height: 100%;
43
+ }
44
+
45
+ .sidebar h2 {
46
+ font-size: 18px;
47
+ margin-bottom: 10px;
48
+ color: #303133;
49
+ }
50
+
51
+ .nav-item {
52
+ padding: 10px;
53
+ cursor: pointer;
54
+ color: #606266;
55
+ border-radius: 4px;
56
+ transition: background 0.3s;
57
+ }
58
+
59
+ .nav-item:hover {
60
+ background: #e6e8eb;
61
+ }
62
+
63
+ .nav-item.active {
64
+ background: #409eff;
65
+ color: #fff;
66
+ }
67
+
68
+ .main {
69
+ flex: 1;
70
+ padding: 40px;
71
+ overflow-y: auto;
72
+ }
73
+
74
+ .component-title {
75
+ font-size: 28px;
76
+ font-weight: 600;
77
+ margin-bottom: 10px;
78
+ }
79
+
80
+ .component-desc {
81
+ color: #909399;
82
+ margin-bottom: 30px;
83
+ font-size: 16px;
84
+ }
85
+
86
+ .section-title {
87
+ font-size: 20px;
88
+ font-weight: 500;
89
+ margin: 30px 0 15px;
90
+ padding-bottom: 10px;
91
+ border-bottom: 1px solid #eee;
92
+ }
93
+
94
+ .demo-block {
95
+ border: 1px solid #ebeef5;
96
+ border-radius: 4px;
97
+ padding: 24px;
98
+ margin-bottom: 20px;
99
+ }
100
+
101
+ .prop-table,
102
+ .event-table {
103
+ width: 100%;
104
+ border-collapse: collapse;
105
+ margin-top: 10px;
106
+ }
107
+
108
+ .prop-table th,
109
+ .prop-table td,
110
+ .event-table th,
111
+ .event-table td {
112
+ border: 1px solid #ebeef5;
113
+ padding: 12px;
114
+ text-align: left;
115
+ }
116
+
117
+ .prop-table th,
118
+ .event-table th {
119
+ background: #fafafa;
120
+ color: #909399;
121
+ font-weight: 600;
122
+ }
123
+
124
+ code {
125
+ background: #f4f4f5;
126
+ padding: 2px 4px;
127
+ border-radius: 4px;
128
+ color: #c0341d;
129
+ font-family: monospace;
130
+ }
131
+
132
+ pre {
133
+ background: #282c34;
134
+ color: #abb2bf;
135
+ padding: 15px;
136
+ border-radius: 4px;
137
+ overflow-x: auto;
138
+ }
139
+ </style>
140
+ </head>
141
+
142
+ <body>
143
+ <div id="app">
144
+ <div class="sidebar">
145
+ <h2>Formax UI</h2>
146
+ <div
147
+ v-for="item in componentList"
148
+ :key="item.name"
149
+ class="nav-item"
150
+ :class="{ active: current.name === item.name }"
151
+ @click="current = item"
152
+ >
153
+ {{ item.name }}
154
+ <span style="font-size: 12px; opacity: 0.8">{{ item.label }}</span>
155
+ </div>
156
+ </div>
157
+ <div class="main" v-if="current">
158
+ <div class="component-title">
159
+ {{ current.name }}
160
+ <span style="font-size: 20px; color: #999"
161
+ >({{ current.label }})</span
162
+ >
163
+ </div>
164
+ <div class="component-desc">{{ current.description }}</div>
165
+
166
+ <!-- 预览区域 -->
167
+ <div class="section-title">组件预览</div>
168
+ <div class="demo-block">
169
+ <n-config-provider>
170
+ <component
171
+ :is="current.name"
172
+ v-bind="getPreviewProps(current)"
173
+ ></component>
174
+ </n-config-provider>
175
+ </div>
176
+
177
+ <!-- 属性表格 -->
178
+ <div class="section-title">Props (属性)</div>
179
+ <table class="prop-table">
180
+ <thead>
181
+ <tr>
182
+ <th>参数名称</th>
183
+ <th>说明</th>
184
+ <th>类型</th>
185
+ <th>可选值</th>
186
+ <th>默认值</th>
187
+ </tr>
188
+ </thead>
189
+ <tbody>
190
+ <tr v-for="(prop, key) in current.props" :key="key">
191
+ <td>{{ key }}</td>
192
+ <td>{{ prop.description }}</td>
193
+ <td><code>{{ prop.type }}</code></td>
194
+ <td>{{ prop.options ? prop.options.join(', ') : '-' }}</td>
195
+ <td>{{ prop.default }}</td>
196
+ </tr>
197
+ </tbody>
198
+ </table>
199
+
200
+ <!-- 事件表格 -->
201
+ <div class="section-title">Events (事件)</div>
202
+ <table
203
+ class="event-table"
204
+ v-if="current.events && current.events.length"
205
+ >
206
+ <thead>
207
+ <tr>
208
+ <th>事件名称</th>
209
+ <th>说明</th>
210
+ <th>回调参数</th>
211
+ </tr>
212
+ </thead>
213
+ <tbody>
214
+ <tr v-for="event in current.events" :key="event.name">
215
+ <td>{{ event.name }}</td>
216
+ <td>{{ event.description }}</td>
217
+ <td><code>{{ event.payload }}</code></td>
218
+ </tr>
219
+ </tbody>
220
+ </table>
221
+ <div v-else style="color: #909399; margin-top: 10px">无事件</div>
222
+
223
+ <!-- 插槽表格 -->
224
+ <div class="section-title">Slots (插槽)</div>
225
+ <table class="event-table" v-if="current.slots && current.slots.length">
226
+ <thead>
227
+ <tr>
228
+ <th>插槽名称</th>
229
+ <th>说明</th>
230
+ </tr>
231
+ </thead>
232
+ <tbody>
233
+ <tr
234
+ v-for="slot in current.slots"
235
+ :key="typeof slot === 'string' ? slot : slot.name"
236
+ >
237
+ <td>{{ typeof slot === 'string' ? slot : slot.name }}</td>
238
+ <td>
239
+ {{ typeof slot === 'string' ? '-' : slot.description || '-' }}
240
+ </td>
241
+ </tr>
242
+ </tbody>
243
+ </table>
244
+ <div v-else style="color: #909399; margin-top: 10px">无插槽</div>
245
+
246
+ <!-- 使用示例 -->
247
+ <div class="section-title">代码示例</div>
248
+ <pre>{{ current.usage }}</pre>
249
+ </div>
250
+ </div>
251
+
252
+ <script type="module">
253
+ import { createApp, ref } from 'vue'
254
+ import NaiveUI from 'naive-ui'
255
+ import { $at } from 'i18n-auto-extractor'
256
+
257
+ import FormaxUI, {
258
+ componentList as list,
259
+ componentGoList,
260
+ } from 'formax-ui'
261
+ const FM = FormaxUI
262
+ const App = {
263
+ setup() {
264
+ let componentList =
265
+ list && list.length
266
+ ? list
267
+ : Object.keys(FM)
268
+ .map((k) => {
269
+ const v = FM[k]
270
+ return v && v.__doc_meta__ ? v.__doc_meta__ : null
271
+ })
272
+ .filter(Boolean)
273
+ const current = ref(componentList[0] || null)
274
+
275
+ const getPreviewProps = (meta) => {
276
+ const props = {}
277
+ if (meta.props) {
278
+ Object.keys(meta.props).forEach((key) => {
279
+ props[key] = meta.props[key].default
280
+ })
281
+ }
282
+ if (meta.name === 'FormaxButton') {
283
+ props.type = 'primary'
284
+ props.label = 'Hello World'
285
+ }
286
+ if (meta.name === 'FormaxTable') {
287
+ props.title = '示例表格'
288
+ props.columns = [
289
+ { title: '姓名', key: 'name', width: 100 },
290
+ { title: '年龄', key: 'age' },
291
+ { title: '地址', key: 'address' },
292
+ ]
293
+ props.dataSource = [
294
+ { name: '232322222222222222222222', age: 18, address: '北京' },
295
+ { name: '李四', age: 20, address: '上海' },
296
+ { name: '王五', age: 22, address: '广州' },
297
+ ]
298
+ props.toolbarShow = true
299
+ }
300
+ return props
301
+ }
302
+
303
+ return { componentList, current, getPreviewProps }
304
+ },
305
+ }
306
+
307
+ const app = createApp(App)
308
+ app.use(NaiveUI)
309
+ app.use(FM)
310
+ app.config.globalProperties.$at = $at
311
+ app.mount('#app')
312
+ </script>
313
+ </body>
314
+ </html>