vue3-smart-table 0.0.2 → 1.0.2

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # CX-SmartTable v0.0.1 使用文档
1
+ # SmartTable 使用文档
2
2
 
3
3
  ## 概览
4
4
 
@@ -55,10 +55,7 @@ export interface ColumnConfig<R = any> {
55
55
 
56
56
  visible?: boolean
57
57
  inControl?: boolean
58
-
59
58
  render?: string
60
- editable?: boolean
61
- editType?: 'input' | 'number' | 'select'
62
59
 
63
60
  renderProps?: Record<string, any>
64
61
  columnProps?: Record<string, any>
@@ -119,8 +116,12 @@ export interface ButtonConfig<R = any> {
119
116
  | `dict` | 字典映射 |
120
117
  | `map` | key-value 映射 |
121
118
  | `formatter` | 自定义格式化 |
122
- | `editable` | 可编辑单元格(input / number / select) |
123
119
  | `icon` | iconfont / svg / url |
120
+ | `input` | 可编辑单元格 |
121
+ | `input-number` | 可编辑单元格 |
122
+ | `select` | 可编辑单元格 |
123
+ | `button` | 单行按钮 |
124
+ | `link` | 单行链接 |
124
125
 
125
126
  ### copy 示例
126
127
 
@@ -143,12 +144,39 @@ export interface ButtonConfig<R = any> {
143
144
  key: 'avatar',
144
145
  label: '头像',
145
146
  render: 'img',
146
- renderProps: { style: 'width:50px;height:50px' }
147
- }
148
-
147
+ columnProps: { minWidth: 150},
148
+ renderProps: {
149
+ width: '60px',
150
+ height: '60px',
151
+ fit: 'cover',
152
+ placeholder: '--'
153
+ }
154
+ },
155
+ {
156
+ key: 'gallery',
157
+ label: '相册',
158
+ render: 'img',
159
+ columnProps: { minWidth: 150},
160
+ renderProps: {
161
+ width: '100px',
162
+ height: '100px'
163
+ }
164
+ },
165
+ const tableData = reactive([
166
+ { id: 3, name: 'Charlie', code: '9525', status: 0, map: 1, regionCode:'海外', orderNum: 1, selectId: 2,
167
+ avatar: 'https://iconfont.alicdn.com/p/illus_3d/file/UMAqlm6KX5gw/8e357f00-9a4e-44c4-b0c5-bbed255cff24.png' ,
168
+ gallery: [
169
+ 'https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png',
170
+ 'https://iconfont.alicdn.com/p/illus_3d/file/UMAqlm6KX5gw/8e357f00-9a4e-44c4-b0c5-bbed255cff24.png',
171
+ ],
172
+ },
173
+ ])
149
174
  ```
150
- - 支持图片预览
151
- - 可传入 previewSrcList、fit、style 等 renderProps
175
+ - 单张图片:正常显示并支持预览
176
+ - 多张图片:显示第一张,右侧显示剩余数量(如:+2)
177
+ - 支持 previewSrcList 自定义预览列表
178
+ - 支持图片大小(width/height)、填充模式(fit)配置
179
+ - 无图片时显示占位符或空内容
152
180
 
153
181
  ### map 示例
154
182
 
@@ -208,23 +236,21 @@ const Enables = [
208
236
  ```
209
237
  - 使用自定义函数格式化显示内容
210
238
 
211
- ### editable 渲染器
239
+ ### 编辑型 渲染器
212
240
 
213
241
  ```ts
214
242
  {
215
243
  key: 'age',
216
244
  label: '年龄',
217
- render: 'editable',
218
- editable: true,
219
- editType: 'number',
245
+ render: 'input-number',
220
246
  renderProps: { min: 0, max: 120 }
221
247
  }
222
248
  ```
223
249
  - 支持类型:input / number / select
224
250
  - 支持事件:
225
- - cellChange(row, key) 值变化
226
- - cellBlur(row, key) 失去焦点
227
- - cellEnter(row, key) 回车事件(input)
251
+ - cellChange(row, col) 值变化
252
+ - cellBlur(row, col) 失去焦点
253
+ - cellEnter(row, col) 回车事件(input)
228
254
  ### icon 示例
229
255
  ```ts
230
256
  {
@@ -237,7 +263,21 @@ const Enables = [
237
263
  - 支持网络图片 URL
238
264
  - 支持 svg 字符串
239
265
  - 支持 iconfont class
266
+
267
+ ### button / link
268
+ ```ts
269
+ { key: 'action', label: '操作', render: 'button', renderProps: { label: '编辑', type: 'text' } }
270
+ { key: 'url', label: '查看', render: 'link', renderProps: { label: '详情', href: 'https://example.com', blank: true } }
271
+
272
+ ```
273
+ - 支持事件:
274
+ - cellClick(row, col) 点击事件
275
+
276
+
240
277
  ## 5. useTableColumns(列显隐缓存)
278
+ ```ts
279
+ const { columns } = useTableColumns(defaultColumns, { pageKey: 'user-list', userId: currentUserId })
280
+ ```
241
281
 
242
282
  ### 设计原则
243
283
 
@@ -257,26 +297,242 @@ const { columns } = useTableColumns(defaultColumns, {
257
297
  - 不传则不启用缓存
258
298
 
259
299
  ---
300
+ ## 6. 事件
301
+ - 支持类型:input / number / select
302
+ - 支持事件:
303
+ - cellChange(row, col) 值变化
304
+ - cellBlur(row, col) 失去焦点
305
+ - cellEnter(row, col) 回车事件(input)
306
+ - cellClick(row, col) 点击事件
307
+
260
308
 
261
- ## 6. 使用示例
309
+ ## 7. 使用示例
262
310
 
263
311
  ```vue
312
+ <!-- 全局注册 -->
313
+ import { createApp } from 'vue'
314
+ import App from './App.vue'
315
+ import { SmartTable } from 'vue3-smart-table'
316
+
317
+ const app = createApp(App)
318
+ app.component('SmartTable', SmartTable)
319
+ app.mount('#app')
320
+
321
+ <!-- 或者局部注册 -->
322
+ <script setup>
323
+ import { SmartTable } from 'vue3-smart-table'
324
+ </script>
325
+
264
326
  <SmartTable
265
- :data="tableData"
266
327
  v-model:columns="columns"
267
- :permissions="userPermissions"
268
- :user-id="userId"
269
- page-key="user-list"
328
+ :border="true"
329
+ :loading="loading"
330
+ :pageKey="route.name"
331
+ :rowKey="'appId'"
332
+ :data="tabList"
333
+ :userId="userInfo?.userId"
334
+ :permissions="userStore.permissions"
270
335
  @cellChange="onCellChange"
271
- />
336
+ @cellBlur="onCellBlur"
337
+ @cellEnter="onCellEnter"
338
+ @cellClick="onCellClick" >
339
+ </SmartTable>
340
+ ```
341
+ ## 完整示例代码
342
+ ![DEMO](./demo/assets/dmeo.jpg)
343
+ ```vue
344
+ <template>
345
+ <div class="demo-container" style="padding: 20px;">
346
+ <h2>Demo</h2>
347
+ <SmartTable
348
+ class="h-400px"
349
+ class-name="table-flex"
350
+ :border="true"
351
+ :loading="loading"
352
+ :pageKey="'route.name'"
353
+ :rowKey="'id'"
354
+ :data="tableData"
355
+ v-model:columns="columns"
356
+ :userId="'userId'"
357
+ :permissions="permissions"
358
+ @cell-blur="onCellBlur"
359
+ @cell-enter="onCellEnter"
360
+ @cell-change="onCellChange"
361
+ @cell-click="onCellClick"
362
+ />
363
+ </div>
364
+ </template>
365
+
366
+ <script setup lang="ts" name="APP">
367
+ import { reactive, ref } from 'vue'
368
+ import { SmartTable } from 'vue3-smart-table'
369
+ const loading = ref(false)
370
+ const Enables = [
371
+ { label: '启用', value: 1, listClass: 'primary' },
372
+ { label: '禁用', value: 0, listClass: 'warning' }
373
+ ]
374
+ const buttonConfigs = [
375
+ { permission: 'edit', label: '编辑', type: 'primary', action: (row: any) => console.log(row)},
376
+ { permission: 'view', label:'删除', type: 'danger', action: (row: any) => console.log(row)},
377
+ { permission: 'copy', label: '复制', type: 'success', action: (row: any) => console.log(row)},
378
+ ]
379
+ const permissions = ['edit', 'view']
380
+ const columns = ref([
381
+ {
382
+ type: 'selection',
383
+ key: 'index',
384
+ inControl: false,
385
+ },
386
+ {
387
+ type: 'index',
388
+ key: 'index',
389
+ label: '序号',
390
+ inControl: false,
391
+ columnProps: { width: 60}
392
+ },
393
+ {
394
+ type: 'operation',
395
+ key: 'opt',
396
+ label: '操作',
397
+ inControl: false,
398
+ buttons: buttonConfigs,
399
+ columnProps: {
400
+ fixed: "right",
401
+ align: "left"
402
+ }
403
+ },
404
+ {
405
+ key: 'action',
406
+ label: '按钮',
407
+ render: 'button',
408
+ renderProps: {
409
+ label: '编辑',
410
+ type: 'text'
411
+ }
412
+ },
413
+ {
414
+ key: 'url',
415
+ label: 'li单元格',
416
+ render: 'link',
417
+ renderProps: {
418
+ label: '查看详情',
419
+ href: 'https://example.com',
420
+ blank: true
421
+ }
422
+ },
423
+ {
424
+ key: "selectId",
425
+ label: "可选单元格",
426
+ visible: true,
427
+ render: 'select',
428
+ columnProps: { minWidth: 150},
429
+ renderProps:{
430
+ options: [
431
+ {label: '选中-1', value: 1},
432
+ {label: '选中-2', value: 2},
433
+ ]
434
+ }
435
+ },
436
+ {
437
+ key: "orderNum",
438
+ label: "输入单元格",
439
+ visible: true,
440
+ render: 'input-number',
441
+ columnProps: { minWidth: 150, sortable: true}
442
+ },
443
+ {
444
+ key: 'avatar',
445
+ label: '头像',
446
+ render: 'img',
447
+ columnProps: { minWidth: 150, sortable: true},
448
+ renderProps: {
449
+ width: '60px',
450
+ height: '60px',
451
+ fit: 'cover',
452
+ placeholder: '--'
453
+ }
454
+ },
455
+ {
456
+ key: 'gallery',
457
+ label: '相册',
458
+ render: 'img',
459
+ columnProps: { minWidth: 150, sortable: true},
460
+ renderProps: {
461
+ width: '100px',
462
+ height: '100px'
463
+ }
464
+ },
465
+ {
466
+ key: 'name',
467
+ label: 'Name',
468
+ visible: true,
469
+ render: 'html'
470
+ },
471
+ {
472
+ key: "code",
473
+ label: "系统标识",
474
+ visible: true,
475
+ render: "copy",
476
+ columnProps: { minWidth: 160, sortable: true}
477
+ },
478
+ {
479
+ key: "status",
480
+ label: "状态",
481
+ visible: true,
482
+ render: "dict",
483
+ renderProps: {
484
+ options: Enables,
485
+ },
486
+ columnProps: { minWidth: 80, sortable: true}
487
+ },
488
+ {
489
+ key: 'map',
490
+ label: 'Map',
491
+ visible: true,
492
+ render: 'map',
493
+ renderProps: { options: { 1: 'Active', 0: 'Inactive' } }
494
+ },
495
+ {
496
+ key: "regionCode",
497
+ label: "区域",
498
+ visible: true,
499
+ render: "formatter",
500
+ columnProps: { minWidth: 100, sortable: true, align: 'left'},
501
+ formatter: (val: string) => `${val}-123`,
502
+ },
503
+ ])
504
+
505
+ const tableData = reactive([
506
+ { id: 1, name: 'Alice', code: '9527', status: 1, map: 1, regionCode:'海外', orderNum: 1, selectId: 1 },
507
+ { id: 2, name: 'Bob', code: '9526', status: 1, map: 1, regionCode:'海外', orderNum: 1, selectId: 1 },
508
+ { id: 3, name: 'Charlie', code: '9525', status: 0, map: 1, regionCode:'海外', orderNum: 1, selectId: 2 },
509
+ { id: 3, name: 'Charlie', code: '9525', status: 0, map: 1, regionCode:'海外', orderNum: 1, selectId: 2,
510
+ avatar: 'https://iconfont.alicdn.com/p/illus_3d/file/UMAqlm6KX5gw/8e357f00-9a4e-44c4-b0c5-bbed255cff24.png' ,
511
+ gallery: [
512
+ 'https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png',
513
+ 'https://iconfont.alicdn.com/p/illus_3d/file/UMAqlm6KX5gw/8e357f00-9a4e-44c4-b0c5-bbed255cff24.png',
514
+ ],
515
+ },
516
+ ])
517
+
518
+ // 编辑单元格回调
519
+ const onCellBlur = (row: any, col: any) => {
520
+ console.log('cell blur:', row, col)
521
+ }
522
+ const onCellEnter = (row: any, col: any) => {
523
+ console.log('cell enter:', row, col)
524
+ }
525
+ const onCellChange = (row: any, col: any) => {
526
+ console.log('cell Change:', row, col)
527
+ }
528
+
529
+ const onCellClick = (row: any, col: any) => {
530
+ console.log('cell button click:', row, col)
531
+ }
532
+ </script>
533
+
272
534
  ```
273
535
 
274
- ## 7. 设计边界说明
275
-
276
- - SmartTable **不关心权限系统如何实现**
277
- - permission 只是 string 比对
278
- - renderer 只负责 UI,不处理权限
279
- - 操作列是否显示由 SmartTable 统一决策
280
536
 
281
537
 
282
538
 
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),C=require("element-plus"),S=e.defineComponent({__name:"input",props:{row:{},col:{},onCellBlur:{type:Function},onCellEnter:{type:Function}},setup(n){const t=n,l=e.ref(t.row[t.col.key]);e.watch(l,s=>{t.row[t.col.key]=s});const r=()=>{var s;return(s=t.onCellBlur)==null?void 0:s.call(t,t.row,t.col)},o=()=>{var s;return(s=t.onCellEnter)==null?void 0:s.call(t,t.row,t.col)};return(s,c)=>{const m=e.resolveComponent("el-input");return e.openBlock(),e.createBlock(m,e.mergeProps({modelValue:l.value,"onUpdate:modelValue":c[0]||(c[0]=d=>l.value=d)},{placeholder:"",size:"small",clearable:!0,...n.col.renderProps},{onBlur:r,onKeyup:e.withKeys(o,["enter"])}),null,16,["modelValue"])}}}),V=e.defineComponent({__name:"inputNumber",props:{row:{},col:{},onCellChange:{type:Function},onCellBlur:{type:Function},onCellEnter:{type:Function}},setup(n){const t=n,l=e.ref(t.row[t.col.key]);e.watch(l,s=>{var c;t.row[t.col.key]=s,(c=t.onCellChange)==null||c.call(t,t.row,t.col)});const r=()=>{var s;return(s=t.onCellBlur)==null?void 0:s.call(t,t.row,t.col)},o=()=>{var s;return(s=t.onCellEnter)==null?void 0:s.call(t,t.row,t.col)};return(s,c)=>{const m=e.resolveComponent("el-input-number");return e.openBlock(),e.createBlock(m,e.mergeProps({modelValue:l.value,"onUpdate:modelValue":c[0]||(c[0]=d=>l.value=d)},{min:0,max:99999,controls:!1,size:"small",...n.col.renderProps},{onBlur:r,onKeyup:e.withKeys(o,["enter"])}),null,16,["modelValue"])}}}),F=e.defineComponent({__name:"select",props:{row:{},col:{},onCellChange:{type:Function},onCellBlur:{type:Function},onCellEnter:{type:Function}},setup(n){const t=n,l=e.ref(t.row[t.col.key]);e.watch(l,c=>{t.row[t.col.key]=c});const r=()=>{var c;return(c=t.onCellChange)==null?void 0:c.call(t,t.row,t.col)},o=()=>{var c;return(c=t.onCellBlur)==null?void 0:c.call(t,t.row,t.col)},s=()=>{var c;return(c=t.onCellEnter)==null?void 0:c.call(t,t.row,t.col)};return(c,m)=>{const d=e.resolveComponent("el-option"),i=e.resolveComponent("el-select");return e.openBlock(),e.createBlock(i,e.mergeProps({modelValue:l.value,"onUpdate:modelValue":m[0]||(m[0]=f=>l.value=f)},{placeholder:"请选择",size:"small",clearable:!0,...n.col.renderProps},{onChange:r,onBlur:o,onKeyup:e.withKeys(s,["enter"])}),{default:e.withCtx(()=>{var f;return[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(((f=n.col.renderProps)==null?void 0:f.options)||[],u=>(e.openBlock(),e.createBlock(d,{key:u.value,label:u.label,value:u.value},null,8,["label","value"]))),128))]}),_:1},16,["modelValue"])}}}),_=n=>e.defineComponent({props:["row","col","onCellChange","onCellBlur","onCellEnter","onClick"],setup(t){return()=>e.h(n,t)}});function A(n){return typeof n.formatter=="function"}function K(){return{input:_(S),"input-number":_(V),select:_(F),button:n=>{const t=n.col.renderProps||{};return e.h(C.ElButton,{type:t.type||"primary",...t,onClick:()=>{var l;return(l=n.onClick)==null?void 0:l.call(n,n.row,n.col)}},()=>t.label||n.row[n.col.key])},link:n=>{const t=n.col.renderProps||{};return e.h("a",{href:t.href||"#",target:t.blank?"_blank":"_self",style:t.style||"color:#409EFF;cursor:pointer;",onClick:l=>{var r;l.preventDefault(),(r=n.onClick)==null||r.call(n,n.row,n.col)}},t.label||n.row[n.col.key])},html:n=>{var t;return e.h("div",{class:"line-clamp-2",innerHTML:n.row[n.col.key]??"",...((t=n.col)==null?void 0:t.renderProps)||{}})},copy:n=>{const t=n.row[n.col.key]??"";return e.h("div",{class:"copy-wrapper",style:"position: relative; display: inline-block;"},[e.h("span",{class:"copy-text line-clamp-1",style:"padding-right: 20px;"},t),e.h("span",{class:"copy-btn",style:`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),k=require("element-plus"),V=e.defineComponent({__name:"input",props:{row:{},col:{},onCellBlur:{type:Function},onCellEnter:{type:Function}},setup(n){const t=n,r=e.ref(t.row[t.col.key]);e.watch(r,s=>{t.row[t.col.key]=s});const o=()=>{var s;return(s=t.onCellBlur)==null?void 0:s.call(t,t.row,t.col)},l=()=>{var s;return(s=t.onCellEnter)==null?void 0:s.call(t,t.row,t.col)};return(s,c)=>{const a=e.resolveComponent("el-input");return e.openBlock(),e.createBlock(a,e.mergeProps({modelValue:r.value,"onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d)},{placeholder:"",size:"small",clearable:!0,...n.col.renderProps},{onBlur:o,onKeyup:e.withKeys(l,["enter"])}),null,16,["modelValue"])}}}),F=e.defineComponent({__name:"inputNumber",props:{row:{},col:{},onCellChange:{type:Function},onCellBlur:{type:Function},onCellEnter:{type:Function}},setup(n){const t=n,r=e.ref(t.row[t.col.key]);e.watch(r,s=>{var c;t.row[t.col.key]=s,(c=t.onCellChange)==null||c.call(t,t.row,t.col)});const o=()=>{var s;return(s=t.onCellBlur)==null?void 0:s.call(t,t.row,t.col)},l=()=>{var s;return(s=t.onCellEnter)==null?void 0:s.call(t,t.row,t.col)};return(s,c)=>{const a=e.resolveComponent("el-input-number");return e.openBlock(),e.createBlock(a,e.mergeProps({modelValue:r.value,"onUpdate:modelValue":c[0]||(c[0]=d=>r.value=d)},{min:0,max:99999,controls:!1,size:"small",...n.col.renderProps},{onBlur:o,onKeyup:e.withKeys(l,["enter"])}),null,16,["modelValue"])}}}),A=e.defineComponent({__name:"select",props:{row:{},col:{},onCellChange:{type:Function},onCellBlur:{type:Function},onCellEnter:{type:Function}},setup(n){const t=n,r=e.ref(t.row[t.col.key]);e.watch(r,c=>{t.row[t.col.key]=c});const o=()=>{var c;return(c=t.onCellChange)==null?void 0:c.call(t,t.row,t.col)},l=()=>{var c;return(c=t.onCellBlur)==null?void 0:c.call(t,t.row,t.col)},s=()=>{var c;return(c=t.onCellEnter)==null?void 0:c.call(t,t.row,t.col)};return(c,a)=>{const d=e.resolveComponent("el-option"),u=e.resolveComponent("el-select");return e.openBlock(),e.createBlock(u,e.mergeProps({modelValue:r.value,"onUpdate:modelValue":a[0]||(a[0]=f=>r.value=f)},{placeholder:"请选择",size:"small",clearable:!0,...n.col.renderProps},{onChange:o,onBlur:l,onKeyup:e.withKeys(s,["enter"])}),{default:e.withCtx(()=>{var f;return[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(((f=n.col.renderProps)==null?void 0:f.options)||[],p=>(e.openBlock(),e.createBlock(d,{key:p.value,label:p.label,value:p.value},null,8,["label","value"]))),128))]}),_:1},16,["modelValue"])}}}),x=n=>e.defineComponent({props:["row","col","onCellChange","onCellBlur","onCellEnter","onClick"],setup(t){return()=>e.h(n,t)}});function K(n){return typeof n.formatter=="function"}function O(){return{input:x(V),"input-number":x(F),select:x(A),button:n=>{const t=n.col.renderProps||{};return e.h(k.ElButton,{type:t.type||"primary",...t,onClick:()=>{var r;return(r=n.onClick)==null?void 0:r.call(n,n.row,n.col)}},()=>t.label||n.row[n.col.key])},link:n=>{const t=n.col.renderProps||{};return e.h("a",{href:t.href||"#",target:t.blank?"_blank":"_self",style:t.style||"color:#409EFF;cursor:pointer;",onClick:r=>{var o;r.preventDefault(),(o=n.onClick)==null||o.call(n,n.row,n.col)}},t.label||n.row[n.col.key])},html:n=>{var t;return e.h("div",{class:"line-clamp-2",innerHTML:n.row[n.col.key]??"",...((t=n.col)==null?void 0:t.renderProps)||{}})},copy:n=>{const t=n.row[n.col.key]??"";return e.h("div",{class:"copy-wrapper",style:"position: relative; display: inline-block;"},[e.h("span",{class:"copy-text line-clamp-1",style:"padding-right: 20px;"},t),e.h("span",{class:"copy-btn",style:`
2
2
  position: absolute;
3
3
  right: 0;
4
4
  top: 50%;
@@ -8,4 +8,14 @@
8
8
  font-size: 12px;
9
9
  color: #409EFF;
10
10
  user-select: none;
11
- `,onClick:()=>{if(t)try{if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(t).then(()=>{C.ElMessage.success("复制成功")}).catch(()=>{C.ElMessage.error("复制失败")});else{const l=document.createElement("textarea");l.value=t,l.style.position="fixed",l.style.opacity="0",document.body.appendChild(l),l.select();const r=document.execCommand("copy");document.body.removeChild(l),r?C.ElMessage.success("复制成功"):C.ElMessage.error("复制失败")}}catch{C.ElMessage.error("复制失败")}}},"📋")])},img:n=>{var r;const t=n.row[n.col.key]??"",l=((r=n.col)==null?void 0:r.renderProps)||{};return e.h(C.ElImage,{src:t,previewSrcList:(l==null?void 0:l.previewSrcList)??(Array.isArray(t)?t:[t]),fit:"contain",style:"width:80px;height:80px",...l})},dict:n=>{const t=n.row[n.col.key],l=n.col.renderProps||{},r=l.options??[],o=l.showValue??!1;if(t==null||t==="")return"";const s=Array.isArray(t)?t.map(String):[String(t)],c=r.filter(i=>s.includes(String(i.value))),m=s.filter(i=>!r.some(f=>String(f.value)===i)),d=c.map((i,f)=>e.h(C.ElTag,{key:i.value,type:i.listClass,class:i.cssClass,disableTransitions:!0},{default:()=>i.label+" "}));return o&&m.length>0&&d.push(e.h("span",{},m.join(" "))),e.h("div",{},d)},map:n=>{var r;const t=n.row[n.col.key],l=((r=n.col.renderProps)==null?void 0:r.options)??{};return t!=null?l[t]??"":""},formatter:n=>{var o;const{col:t,row:l}=n,r=l[t.key];return A(t)?(o=t.formatter)==null?void 0:o.call(t,r,l):r??""},icon:n=>{const t=n.row[n.col.key]??"",l=n.col.renderProps||{};return t?/^https?:\/\//.test(t)?e.h(C.ElImage,{src:t,previewSrcList:[t],fit:"contain",style:"width:40px;height:40px",...l}):/^\s*<svg[\s\S]*<\/svg>\s*$/.test(t)?e.h("div",{innerHTML:t,style:`width:40px;height:40px;display:inline-block;${l.style||""}`,...l}):e.h("i",{class:t,style:`font-size:20px;${l.style||""}`,...l}):""}}}function O(n,t=10,l=[]){const o="*:*:*",s=a=>{if(!a)return!0;const p=Array.isArray(a)?a:[a];return l.some(y=>y===o||p.includes(y))},c=e.computed(()=>n.some(a=>s(a.permission))),m=e.computed(()=>n.filter(p=>s(p.permission)).slice(0,t).reduce((p,y)=>p+(y.width??55),0)),d=(a,p)=>s(a.permission)&&(a.visible?a.visible(p):!0),i=a=>n.filter(y=>d(y,a)).slice(0,t).reduce((y,w)=>y+(w.width??55),0);return{hasAnyButton:c,optWidth:m,hasAnyVisibleButton:a=>a!=null&&a.length?a.some(p=>n.some(y=>d(y,p))):!1,getMaxOptWidth:a=>a!=null&&a.length?a.reduce((p,y)=>Math.max(p,i(y)),0):m.value,getVisibleButtons:a=>n.filter(p=>d(p,a)).slice(0,t)}}const M=e.defineComponent({__name:"index",props:{col:{type:Object,required:!0},permissions:{type:Array,default:()=>[]}},emits:["cellBlur","cellEnter","cellChange","cellClick"],setup(n,{emit:t}){const l=n,r=t,{col:o}=e.toRefs(l),s=(h,k)=>r("cellChange",h,k),c=(h,k)=>r("cellBlur",h,k),m=(h,k)=>r("cellEnter",h,k),d=(h,k)=>r("cellClick",h,k),i=K(),{hasAnyButton:f,hasAnyVisibleButton:u,optWidth:g,getMaxOptWidth:a,getVisibleButtons:p}=O(o.value.buttons||[],o.value.maxbtn??10,l.permissions||[]),y=e.computed(()=>(o.value.buttons||[]).length?(o.value.__rows||[]).length?u(o.value.__rows||[]):f.value:!1),w=e.computed(()=>o.value.__rows?a(o.value.__rows):g.value);function E(h){return!(h.type==="selection"||h.type==="index"||h.type==="operation"&&!y.value||h.visible===!1)}return(h,k)=>{const b=e.resolveComponent("el-table-column"),P=e.resolveComponent("el-button");return e.unref(o).type==="selection"?(e.openBlock(),e.createBlock(b,e.mergeProps({key:0,type:"selection"},e.unref(o).columnProps),null,16)):e.unref(o).type==="index"?(e.openBlock(),e.createBlock(b,e.mergeProps({key:1,type:"index",label:e.unref(o).label||"#",align:"center"},e.unref(o).columnProps),null,16,["label"])):e.unref(o).type==="operation"&&y.value?(e.openBlock(),e.createBlock(b,e.mergeProps({key:2,label:e.unref(o).label||"操作",align:"center"},{...e.unref(o).columnProps,width:w.value}),{default:e.withCtx(({row:v})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(p)(v),B=>(e.openBlock(),e.createBlock(P,{key:B.label,type:B.type||"primary",link:"",onClick:N=>B.action(v)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(B.label),1)]),_:2},1032,["type","onClick"]))),128))]),_:1},16,["label"])):E(e.unref(o))?(e.openBlock(),e.createBlock(b,e.mergeProps({key:3,prop:e.unref(o).key,label:e.unref(o).label,align:"center"},e.unref(o).columnProps||{}),{default:e.withCtx(({row:v})=>[e.unref(o).render&&e.unref(i)[e.unref(o).render]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(i)[e.unref(o).render]),{key:0,row:v,col:e.unref(o),onCellChange:s,onCellBlur:c,onCellEnter:m,onClick:d},null,40,["row","col"])):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(v[e.unref(o).key]),1)],64))]),_:1},16,["prop","label"])):e.createCommentVNode("",!0)}}}),I="table_columns_";function $(n,t){return`${I}${n}_${t}`}function x(n,t){if(!(t!=null&&t.length))return n;const l=new Map(t.map(r=>[r.key,r]));return n.map(r=>{const o=l.get(r.key);return o?{...r,visible:typeof o.visible=="boolean"?o.visible:r.visible}:r})}function T(n,t){const{pageKey:l,userId:r,storage:o=localStorage}=t||{},c=r?$(r,l||""):null,m=c?o.getItem(c):null,d=e.ref(x(n,m?JSON.parse(m):[]));return e.watch(d,i=>{if(!c)return;const f=i.map(u=>({key:u.key,visible:u.visible,columnOpts:u.columnOpts}));o.setItem(c,JSON.stringify(f))},{deep:!0}),{columns:d,setColumns(i){d.value=x(n,i),c&&o.setItem(c,JSON.stringify(i))},resetColumns(){d.value=n,c&&o.removeItem(c)}}}const W=e.defineComponent({__name:"index",props:{data:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},pageKey:String,rowKey:{type:String,default:"id"},loading:{type:Boolean,default:!1},permissions:{type:Array,default:()=>[]},userId:{type:[String,Number],default:""}},emits:["update:columns","cellChange","cellBlur","cellEnter","cell-click"],setup(n,{expose:t,emit:l}){const r=n,o=l,{columns:s}=T(r.columns,{pageKey:r.pageKey??"",userId:r.userId??""});e.watch(s,u=>o("update:columns",u),{deep:!0,immediate:!0});const c=(u,g)=>o("cellChange",u,g),m=(u,g)=>{o("cellBlur",u,g)},d=(u,g)=>{console.log("enter"),o("cellEnter",u,g)},i=(u,g)=>{g&&o("cell-click",u,g)},f=e.ref();return t({tableRef:f}),(u,g)=>{const a=e.resolveComponent("el-table"),p=e.resolveDirective("loading");return e.withDirectives((e.openBlock(),e.createBlock(a,e.mergeProps({ref_key:"tableRef",ref:f},u.$attrs,{data:n.data,"row-key":n.rowKey,class:"smart-table"}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),y=>(e.openBlock(),e.createBlock(M,{key:y.key,col:y,permissions:n.permissions,onCellChange:c,onCellBlur:m,onCellEnter:d,onCellClick:i},null,8,["col","permissions"]))),128))]),_:1},16,["data","row-key"])),[[p,n.loading]])}}}),D=(n,t)=>{const l=n.__vccOpts||n;for(const[r,o]of t)l[r]=o;return l},L=D(W,[["__scopeId","data-v-338b77db"]]);exports.SmartTable=L;
11
+ `,onClick:()=>{if(t)try{if(navigator.clipboard&&navigator.clipboard.writeText)navigator.clipboard.writeText(t).then(()=>{k.ElMessage.success("复制成功")}).catch(()=>{k.ElMessage.error("复制失败")});else{const r=document.createElement("textarea");r.value=t,r.style.position="fixed",r.style.opacity="0",document.body.appendChild(r),r.select();const o=document.execCommand("copy");document.body.removeChild(r),o?k.ElMessage.success("复制成功"):k.ElMessage.error("复制失败")}}catch{k.ElMessage.error("复制失败")}}},"📋")])},img:n=>{var c;const t=n.row[n.col.key],r=((c=n.col)==null?void 0:c.renderProps)||{},l=t?Array.isArray(t)?t.filter(a=>a&&typeof a=="string"):[t]:[];if(l.length===0)return r.placeholder||"";const s={width:r.width||"80px",height:r.height||"80px",marginRight:l.length>1?"4px":"0",...r.style||{}};return l.length===1?e.h(k.ElImage,{src:l[0],previewSrcList:r.previewSrcList||l,fit:r.fit||"contain",style:s,...r}):(console.log(r.previewSrcList),e.h("div",{style:"display: flex; align-items: center; position: relative"},[e.h(k.ElImage,{src:l[0],previewSrcList:r.previewSrcList||l,fit:r.fit||"contain",style:s,...r}),l.length>1&&e.h("span",{style:`
12
+ margin-left: 8px;
13
+ font-size: 12px;
14
+ color: #666;
15
+ background: #f0f0f0;
16
+ padding: 2px 6px;
17
+ border-radius: 2px;
18
+ position: absolute;
19
+ top: 0;
20
+ right: 0;
21
+ `,title:`共 ${l.length} 张图片`},`+${l.length-1}`)]))},dict:n=>{const t=n.row[n.col.key],r=n.col.renderProps||{},o=r.options??[],l=r.showValue??!1;if(t==null||t==="")return"";const s=Array.isArray(t)?t.map(String):[String(t)],c=o.filter(u=>s.includes(String(u.value))),a=s.filter(u=>!o.some(f=>String(f.value)===u)),d=c.map((u,f)=>e.h(k.ElTag,{key:u.value,type:u.listClass,class:u.cssClass,disableTransitions:!0},{default:()=>u.label+" "}));return l&&a.length>0&&d.push(e.h("span",{},a.join(" "))),e.h("div",{},d)},map:n=>{var o;const t=n.row[n.col.key],r=((o=n.col.renderProps)==null?void 0:o.options)??{};return t!=null?r[t]??"":""},formatter:n=>{var l;const{col:t,row:r}=n,o=r[t.key];return K(t)?(l=t.formatter)==null?void 0:l.call(t,o,r):o??""},icon:n=>{const t=n.row[n.col.key]??"",r=n.col.renderProps||{};return t?/^https?:\/\//.test(t)?e.h(k.ElImage,{src:t,previewSrcList:[t],fit:"contain",style:"width:40px;height:40px",...r}):/^\s*<svg[\s\S]*<\/svg>\s*$/.test(t)?e.h("div",{innerHTML:t,style:`width:40px;height:40px;display:inline-block;${r.style||""}`,...r}):e.h("i",{class:t,style:`font-size:20px;${r.style||""}`,...r}):""}}}function I(n,t=10,r=[]){const l="*:*:*",s=i=>{if(!i)return!0;const m=Array.isArray(i)?i:[i];return r.some(y=>y===l||m.includes(y))},c=e.computed(()=>n.some(i=>s(i.permission))),a=e.computed(()=>n.filter(m=>s(m.permission)).slice(0,t).reduce((m,y)=>m+(y.width??55),0)),d=(i,m)=>s(i.permission)&&(i.visible?i.visible(m):!0),u=i=>n.filter(y=>d(y,i)).slice(0,t).reduce((y,w)=>y+(w.width??55),0);return{hasAnyButton:c,optWidth:a,hasAnyVisibleButton:i=>i!=null&&i.length?i.some(m=>n.some(y=>d(y,m))):!1,getMaxOptWidth:i=>i!=null&&i.length?i.reduce((m,y)=>Math.max(m,u(y)),0):a.value,getVisibleButtons:i=>n.filter(m=>d(m,i)).slice(0,t)}}const L=["title"],M=e.defineComponent({__name:"index",props:{col:{type:Object,required:!0},permissions:{type:Array,default:()=>[]}},emits:["cellBlur","cellEnter","cellChange","cellClick"],setup(n,{emit:t}){const r=n,o=t,{col:l}=e.toRefs(r),s=(h,C)=>o("cellChange",h,C),c=(h,C)=>o("cellBlur",h,C),a=(h,C)=>o("cellEnter",h,C),d=(h,C)=>o("cellClick",h,C),u=O(),{hasAnyButton:f,hasAnyVisibleButton:p,optWidth:g,getMaxOptWidth:i,getVisibleButtons:m}=I(l.value.buttons||[],l.value.maxbtn??10,r.permissions||[]),y=e.computed(()=>(l.value.buttons||[]).length?(l.value.__rows||[]).length?p(l.value.__rows||[]):f.value:!1),w=e.computed(()=>l.value.__rows?i(l.value.__rows):g.value);function P(h){return!(h.type==="selection"||h.type==="index"||h.type==="operation"&&!y.value||h.visible===!1)}return(h,C)=>{const B=e.resolveComponent("el-table-column"),S=e.resolveComponent("el-button");return e.unref(l).type==="selection"?(e.openBlock(),e.createBlock(B,e.mergeProps({key:0,type:"selection"},e.unref(l).columnProps),null,16)):e.unref(l).type==="index"?(e.openBlock(),e.createBlock(B,e.mergeProps({key:1,type:"index",label:e.unref(l).label||"#",align:"center"},e.unref(l).columnProps),null,16,["label"])):e.unref(l).type==="operation"&&y.value?(e.openBlock(),e.createBlock(B,e.mergeProps({key:2,label:e.unref(l).label||"操作",align:"center"},{...e.unref(l).columnProps,width:w.value}),{default:e.withCtx(({row:b})=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(m)(b),v=>(e.openBlock(),e.createBlock(S,{key:v.label,type:v.type||"primary",link:"",onClick:_=>v.action(b)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(v.label),1)]),_:2},1032,["type","onClick"]))),128))]),_:1},16,["label"])):P(e.unref(l))?(e.openBlock(),e.createBlock(B,e.mergeProps({key:3,prop:e.unref(l).key,label:e.unref(l).label,align:"center"},e.unref(l).columnProps||{}),{default:e.withCtx(({row:b})=>{var v,_;return[e.unref(l).render&&e.unref(u)[e.unref(l).render]?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(u)[e.unref(l).render]),{key:0,row:b,col:e.unref(l),onCellChange:s,onCellBlur:c,onCellEnter:a,onClick:d},null,40,["row","col"])):(e.openBlock(),e.createElementBlock("span",{key:1,style:e.normalizeStyle(((v=e.unref(l).renderProps)==null?void 0:v.style)||""),class:e.normalizeClass(((_=e.unref(l).renderProps)==null?void 0:_.class)||""),title:b[e.unref(l).key]},e.toDisplayString(b[e.unref(l).key]),15,L))]}),_:1},16,["prop","label"])):e.createCommentVNode("",!0)}}}),$="table_columns_";function T(n,t){return`${$}${n}_${t}`}function E(n,t){if(!(t!=null&&t.length))return n;const r=new Map(t.map(o=>[o.key,o]));return n.map(o=>{const l=r.get(o.key);return l?{...o,visible:typeof l.visible=="boolean"?l.visible:o.visible}:o})}function W(n,t){const{pageKey:r,userId:o,storage:l=localStorage}=t||{},c=o?T(o,r||""):null,a=c?l.getItem(c):null,d=e.ref(E(n,a?JSON.parse(a):[]));return e.watch(d,u=>{if(!c)return;const f=u.map(p=>({key:p.key,visible:p.visible,columnOpts:p.columnOpts}));l.setItem(c,JSON.stringify(f))},{deep:!0}),{columns:d,setColumns(u){d.value=E(n,u),c&&l.setItem(c,JSON.stringify(u))},resetColumns(){d.value=n,c&&l.removeItem(c)}}}const z=e.defineComponent({__name:"index",props:{data:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},pageKey:String,rowKey:{type:String,default:"id"},loading:{type:Boolean,default:!1},permissions:{type:Array,default:()=>[]},userId:{type:[String,Number],default:""}},emits:["update:columns","cellChange","cellBlur","cellEnter","cell-click"],setup(n,{expose:t,emit:r}){const o=n,l=r,{columns:s}=W(o.columns,{pageKey:o.pageKey??"",userId:o.userId??""});e.watch(s,p=>l("update:columns",p),{deep:!0,immediate:!0});const c=(p,g)=>l("cellChange",p,g),a=(p,g)=>{l("cellBlur",p,g)},d=(p,g)=>{console.log("enter"),l("cellEnter",p,g)},u=(p,g)=>{g&&l("cell-click",p,g)},f=e.ref();return t({tableRef:f}),(p,g)=>{const i=e.resolveComponent("el-table"),m=e.resolveDirective("loading");return e.withDirectives((e.openBlock(),e.createBlock(i,e.mergeProps({ref_key:"tableRef",ref:f},p.$attrs,{data:n.data,"row-key":n.rowKey,class:"smart-table"}),{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(s),y=>(e.openBlock(),e.createBlock(M,{key:y.key,col:y,permissions:n.permissions,onCellChange:c,onCellBlur:a,onCellEnter:d,onCellClick:u},null,8,["col","permissions"]))),128))]),_:1},16,["data","row-key"])),[[m,n.loading]])}}}),D=(n,t)=>{const r=n.__vccOpts||n;for(const[o,l]of t)r[o]=l;return r},N=D(z,[["__scopeId","data-v-338b77db"]]);exports.SmartTable=N;
@@ -1,6 +1,6 @@
1
- import { defineComponent as x, ref as V, watch as S, resolveComponent as w, createBlock as b, openBlock as f, mergeProps as _, withKeys as M, withCtx as P, createElementBlock as O, Fragment as K, renderList as T, h as g, computed as $, toRefs as U, createCommentVNode as j, unref as d, createTextVNode as D, toDisplayString as N, resolveDynamicComponent as H, resolveDirective as q, withDirectives as X } from "vue";
2
- import { ElImage as L, ElTag as Y, ElMessage as E, ElButton as G } from "element-plus";
3
- const Q = /* @__PURE__ */ x({
1
+ import { defineComponent as E, ref as V, watch as A, resolveComponent as x, createBlock as b, openBlock as h, mergeProps as _, withKeys as M, withCtx as P, createElementBlock as O, Fragment as T, renderList as z, h as f, computed as K, toRefs as U, createCommentVNode as j, unref as c, createTextVNode as H, toDisplayString as D, resolveDynamicComponent as q, normalizeClass as X, normalizeStyle as Y, resolveDirective as G, withDirectives as Q } from "vue";
2
+ import { ElImage as L, ElTag as Z, ElMessage as S, ElButton as ee } from "element-plus";
3
+ const te = /* @__PURE__ */ E({
4
4
  __name: "input",
5
5
  props: {
6
6
  row: {},
@@ -9,29 +9,29 @@ const Q = /* @__PURE__ */ x({
9
9
  onCellEnter: { type: Function }
10
10
  },
11
11
  setup(t) {
12
- const e = t, n = V(e.row[e.col.key]);
13
- S(n, (c) => {
14
- e.row[e.col.key] = c;
12
+ const e = t, l = V(e.row[e.col.key]);
13
+ A(l, (s) => {
14
+ e.row[e.col.key] = s;
15
15
  });
16
16
  const r = () => {
17
- var c;
18
- return (c = e.onCellBlur) == null ? void 0 : c.call(e, e.row, e.col);
19
- }, l = () => {
20
- var c;
21
- return (c = e.onCellEnter) == null ? void 0 : c.call(e, e.row, e.col);
17
+ var s;
18
+ return (s = e.onCellBlur) == null ? void 0 : s.call(e, e.row, e.col);
19
+ }, n = () => {
20
+ var s;
21
+ return (s = e.onCellEnter) == null ? void 0 : s.call(e, e.row, e.col);
22
22
  };
23
- return (c, o) => {
24
- const y = w("el-input");
25
- return f(), b(y, _({
26
- modelValue: n.value,
27
- "onUpdate:modelValue": o[0] || (o[0] = (u) => n.value = u)
23
+ return (s, o) => {
24
+ const a = x("el-input");
25
+ return h(), b(a, _({
26
+ modelValue: l.value,
27
+ "onUpdate:modelValue": o[0] || (o[0] = (y) => l.value = y)
28
28
  }, { placeholder: "", size: "small", clearable: !0, ...t.col.renderProps }, {
29
29
  onBlur: r,
30
- onKeyup: M(l, ["enter"])
30
+ onKeyup: M(n, ["enter"])
31
31
  }), null, 16, ["modelValue"]);
32
32
  };
33
33
  }
34
- }), Z = /* @__PURE__ */ x({
34
+ }), ne = /* @__PURE__ */ E({
35
35
  __name: "inputNumber",
36
36
  props: {
37
37
  row: {},
@@ -41,30 +41,30 @@ const Q = /* @__PURE__ */ x({
41
41
  onCellEnter: { type: Function }
42
42
  },
43
43
  setup(t) {
44
- const e = t, n = V(e.row[e.col.key]);
45
- S(n, (c) => {
44
+ const e = t, l = V(e.row[e.col.key]);
45
+ A(l, (s) => {
46
46
  var o;
47
- e.row[e.col.key] = c, (o = e.onCellChange) == null || o.call(e, e.row, e.col);
47
+ e.row[e.col.key] = s, (o = e.onCellChange) == null || o.call(e, e.row, e.col);
48
48
  });
49
49
  const r = () => {
50
- var c;
51
- return (c = e.onCellBlur) == null ? void 0 : c.call(e, e.row, e.col);
52
- }, l = () => {
53
- var c;
54
- return (c = e.onCellEnter) == null ? void 0 : c.call(e, e.row, e.col);
50
+ var s;
51
+ return (s = e.onCellBlur) == null ? void 0 : s.call(e, e.row, e.col);
52
+ }, n = () => {
53
+ var s;
54
+ return (s = e.onCellEnter) == null ? void 0 : s.call(e, e.row, e.col);
55
55
  };
56
- return (c, o) => {
57
- const y = w("el-input-number");
58
- return f(), b(y, _({
59
- modelValue: n.value,
60
- "onUpdate:modelValue": o[0] || (o[0] = (u) => n.value = u)
56
+ return (s, o) => {
57
+ const a = x("el-input-number");
58
+ return h(), b(a, _({
59
+ modelValue: l.value,
60
+ "onUpdate:modelValue": o[0] || (o[0] = (y) => l.value = y)
61
61
  }, { min: 0, max: 99999, controls: !1, size: "small", ...t.col.renderProps }, {
62
62
  onBlur: r,
63
- onKeyup: M(l, ["enter"])
63
+ onKeyup: M(n, ["enter"])
64
64
  }), null, 16, ["modelValue"]);
65
65
  };
66
66
  }
67
- }), ee = /* @__PURE__ */ x({
67
+ }), le = /* @__PURE__ */ E({
68
68
  __name: "select",
69
69
  props: {
70
70
  row: {},
@@ -74,37 +74,37 @@ const Q = /* @__PURE__ */ x({
74
74
  onCellEnter: { type: Function }
75
75
  },
76
76
  setup(t) {
77
- const e = t, n = V(e.row[e.col.key]);
78
- S(n, (o) => {
77
+ const e = t, l = V(e.row[e.col.key]);
78
+ A(l, (o) => {
79
79
  e.row[e.col.key] = o;
80
80
  });
81
81
  const r = () => {
82
82
  var o;
83
83
  return (o = e.onCellChange) == null ? void 0 : o.call(e, e.row, e.col);
84
- }, l = () => {
84
+ }, n = () => {
85
85
  var o;
86
86
  return (o = e.onCellBlur) == null ? void 0 : o.call(e, e.row, e.col);
87
- }, c = () => {
87
+ }, s = () => {
88
88
  var o;
89
89
  return (o = e.onCellEnter) == null ? void 0 : o.call(e, e.row, e.col);
90
90
  };
91
- return (o, y) => {
92
- const u = w("el-option"), i = w("el-select");
93
- return f(), b(i, _({
94
- modelValue: n.value,
95
- "onUpdate:modelValue": y[0] || (y[0] = (h) => n.value = h)
91
+ return (o, a) => {
92
+ const y = x("el-option"), u = x("el-select");
93
+ return h(), b(u, _({
94
+ modelValue: l.value,
95
+ "onUpdate:modelValue": a[0] || (a[0] = (g) => l.value = g)
96
96
  }, { placeholder: "请选择", size: "small", clearable: !0, ...t.col.renderProps }, {
97
97
  onChange: r,
98
- onBlur: l,
99
- onKeyup: M(c, ["enter"])
98
+ onBlur: n,
99
+ onKeyup: M(s, ["enter"])
100
100
  }), {
101
101
  default: P(() => {
102
- var h;
102
+ var g;
103
103
  return [
104
- (f(!0), O(K, null, T(((h = t.col.renderProps) == null ? void 0 : h.options) || [], (a) => (f(), b(u, {
105
- key: a.value,
106
- label: a.label,
107
- value: a.value
104
+ (h(!0), O(T, null, z(((g = t.col.renderProps) == null ? void 0 : g.options) || [], (d) => (h(), b(y, {
105
+ key: d.value,
106
+ label: d.label,
107
+ value: d.value
108
108
  }, null, 8, ["label", "value"]))), 128))
109
109
  ];
110
110
  }),
@@ -112,46 +112,46 @@ const Q = /* @__PURE__ */ x({
112
112
  }, 16, ["modelValue"]);
113
113
  };
114
114
  }
115
- }), W = (t) => x({
115
+ }), W = (t) => E({
116
116
  props: ["row", "col", "onCellChange", "onCellBlur", "onCellEnter", "onClick"],
117
117
  setup(e) {
118
- return () => g(t, e);
118
+ return () => f(t, e);
119
119
  }
120
120
  });
121
- function te(t) {
121
+ function re(t) {
122
122
  return typeof t.formatter == "function";
123
123
  }
124
- function ne() {
124
+ function oe() {
125
125
  return {
126
- input: W(Q),
127
- "input-number": W(Z),
128
- select: W(ee),
126
+ input: W(te),
127
+ "input-number": W(ne),
128
+ select: W(le),
129
129
  button: (t) => {
130
130
  const e = t.col.renderProps || {};
131
- return g(G, {
131
+ return f(ee, {
132
132
  type: e.type || "primary",
133
133
  ...e,
134
134
  onClick: () => {
135
- var n;
136
- return (n = t.onClick) == null ? void 0 : n.call(t, t.row, t.col);
135
+ var l;
136
+ return (l = t.onClick) == null ? void 0 : l.call(t, t.row, t.col);
137
137
  }
138
138
  }, () => e.label || t.row[t.col.key]);
139
139
  },
140
140
  link: (t) => {
141
141
  const e = t.col.renderProps || {};
142
- return g("a", {
142
+ return f("a", {
143
143
  href: e.href || "#",
144
144
  target: e.blank ? "_blank" : "_self",
145
145
  style: e.style || "color:#409EFF;cursor:pointer;",
146
- onClick: (n) => {
146
+ onClick: (l) => {
147
147
  var r;
148
- n.preventDefault(), (r = t.onClick) == null || r.call(t, t.row, t.col);
148
+ l.preventDefault(), (r = t.onClick) == null || r.call(t, t.row, t.col);
149
149
  }
150
150
  }, e.label || t.row[t.col.key]);
151
151
  },
152
152
  html: (t) => {
153
153
  var e;
154
- return g("div", {
154
+ return f("div", {
155
155
  class: "line-clamp-2",
156
156
  innerHTML: t.row[t.col.key] ?? "",
157
157
  ...((e = t.col) == null ? void 0 : e.renderProps) || {}
@@ -159,18 +159,18 @@ function ne() {
159
159
  },
160
160
  copy: (t) => {
161
161
  const e = t.row[t.col.key] ?? "";
162
- return g(
162
+ return f(
163
163
  "div",
164
164
  {
165
165
  class: "copy-wrapper",
166
166
  style: "position: relative; display: inline-block;"
167
167
  },
168
168
  [
169
- g("span", {
169
+ f("span", {
170
170
  class: "copy-text line-clamp-1",
171
171
  style: "padding-right: 20px;"
172
172
  }, e),
173
- g(
173
+ f(
174
174
  "span",
175
175
  {
176
176
  class: "copy-btn",
@@ -190,18 +190,18 @@ function ne() {
190
190
  try {
191
191
  if (navigator.clipboard && navigator.clipboard.writeText)
192
192
  navigator.clipboard.writeText(e).then(() => {
193
- E.success("复制成功");
193
+ S.success("复制成功");
194
194
  }).catch(() => {
195
- E.error("复制失败");
195
+ S.error("复制失败");
196
196
  });
197
197
  else {
198
- const n = document.createElement("textarea");
199
- n.value = e, n.style.position = "fixed", n.style.opacity = "0", document.body.appendChild(n), n.select();
198
+ const l = document.createElement("textarea");
199
+ l.value = e, l.style.position = "fixed", l.style.opacity = "0", document.body.appendChild(l), l.select();
200
200
  const r = document.execCommand("copy");
201
- document.body.removeChild(n), r ? E.success("复制成功") : E.error("复制失败");
201
+ document.body.removeChild(l), r ? S.success("复制成功") : S.error("复制失败");
202
202
  }
203
203
  } catch {
204
- E.error("复制失败");
204
+ S.error("复制失败");
205
205
  }
206
206
  }
207
207
  },
@@ -212,85 +212,119 @@ function ne() {
212
212
  );
213
213
  },
214
214
  img: (t) => {
215
- var r;
216
- const e = t.row[t.col.key] ?? "", n = ((r = t.col) == null ? void 0 : r.renderProps) || {};
217
- return g(L, {
218
- src: e,
219
- previewSrcList: (n == null ? void 0 : n.previewSrcList) ?? (Array.isArray(e) ? e : [e]),
220
- fit: "contain",
221
- style: "width:80px;height:80px",
222
- ...n
223
- });
215
+ var o;
216
+ const e = t.row[t.col.key], l = ((o = t.col) == null ? void 0 : o.renderProps) || {}, n = e ? Array.isArray(e) ? e.filter((a) => a && typeof a == "string") : [e] : [];
217
+ if (n.length === 0)
218
+ return l.placeholder || "";
219
+ const s = {
220
+ width: l.width || "80px",
221
+ height: l.height || "80px",
222
+ marginRight: n.length > 1 ? "4px" : "0",
223
+ ...l.style || {}
224
+ };
225
+ return n.length === 1 ? f(L, {
226
+ src: n[0],
227
+ previewSrcList: l.previewSrcList || n,
228
+ fit: l.fit || "contain",
229
+ style: s,
230
+ ...l
231
+ }) : (console.log(l.previewSrcList), f("div", {
232
+ style: "display: flex; align-items: center; position: relative"
233
+ }, [
234
+ // 显示第一张图片,点击可预览所有
235
+ f(L, {
236
+ src: n[0],
237
+ previewSrcList: l.previewSrcList || n,
238
+ fit: l.fit || "contain",
239
+ style: s,
240
+ ...l
241
+ }),
242
+ // 如果图片数量大于1,显示剩余图片数量
243
+ n.length > 1 && f("span", {
244
+ style: `
245
+ margin-left: 8px;
246
+ font-size: 12px;
247
+ color: #666;
248
+ background: #f0f0f0;
249
+ padding: 2px 6px;
250
+ border-radius: 2px;
251
+ position: absolute;
252
+ top: 0;
253
+ right: 0;
254
+ `,
255
+ title: `共 ${n.length} 张图片`
256
+ }, `+${n.length - 1}`)
257
+ ]));
224
258
  },
225
259
  dict: (t) => {
226
- const e = t.row[t.col.key], n = t.col.renderProps || {}, r = n.options ?? [], l = n.showValue ?? !1;
260
+ const e = t.row[t.col.key], l = t.col.renderProps || {}, r = l.options ?? [], n = l.showValue ?? !1;
227
261
  if (e == null || e === "") return "";
228
- const c = Array.isArray(e) ? e.map(String) : [String(e)], o = r.filter((i) => c.includes(String(i.value))), y = c.filter((i) => !r.some((h) => String(h.value) === i)), u = o.map((i, h) => g(
229
- Y,
230
- { key: i.value, type: i.listClass, class: i.cssClass, disableTransitions: !0 },
231
- { default: () => i.label + " " }
262
+ const s = Array.isArray(e) ? e.map(String) : [String(e)], o = r.filter((u) => s.includes(String(u.value))), a = s.filter((u) => !r.some((g) => String(g.value) === u)), y = o.map((u, g) => f(
263
+ Z,
264
+ { key: u.value, type: u.listClass, class: u.cssClass, disableTransitions: !0 },
265
+ { default: () => u.label + " " }
232
266
  ));
233
- return l && y.length > 0 && u.push(g("span", {}, y.join(" "))), g("div", {}, u);
267
+ return n && a.length > 0 && y.push(f("span", {}, a.join(" "))), f("div", {}, y);
234
268
  },
235
269
  map: (t) => {
236
270
  var r;
237
- const e = t.row[t.col.key], n = ((r = t.col.renderProps) == null ? void 0 : r.options) ?? {};
238
- return e != null ? n[e] ?? "" : "";
271
+ const e = t.row[t.col.key], l = ((r = t.col.renderProps) == null ? void 0 : r.options) ?? {};
272
+ return e != null ? l[e] ?? "" : "";
239
273
  },
240
274
  formatter: (t) => {
241
- var l;
242
- const { col: e, row: n } = t, r = n[e.key];
243
- return te(e) ? (l = e.formatter) == null ? void 0 : l.call(e, r, n) : r ?? "";
275
+ var n;
276
+ const { col: e, row: l } = t, r = l[e.key];
277
+ return re(e) ? (n = e.formatter) == null ? void 0 : n.call(e, r, l) : r ?? "";
244
278
  },
245
279
  icon: (t) => {
246
- const e = t.row[t.col.key] ?? "", n = t.col.renderProps || {};
247
- return e ? /^https?:\/\//.test(e) ? g(L, {
280
+ const e = t.row[t.col.key] ?? "", l = t.col.renderProps || {};
281
+ return e ? /^https?:\/\//.test(e) ? f(L, {
248
282
  src: e,
249
283
  previewSrcList: [e],
250
284
  fit: "contain",
251
285
  style: "width:40px;height:40px",
252
- ...n
253
- }) : /^\s*<svg[\s\S]*<\/svg>\s*$/.test(e) ? g("div", {
286
+ ...l
287
+ }) : /^\s*<svg[\s\S]*<\/svg>\s*$/.test(e) ? f("div", {
254
288
  innerHTML: e,
255
- style: `width:40px;height:40px;display:inline-block;${n.style || ""}`,
256
- ...n
257
- }) : g("i", {
289
+ style: `width:40px;height:40px;display:inline-block;${l.style || ""}`,
290
+ ...l
291
+ }) : f("i", {
258
292
  class: e,
259
293
  // val 直接当 className
260
- style: `font-size:20px;${n.style || ""}`,
261
- ...n
294
+ style: `font-size:20px;${l.style || ""}`,
295
+ ...l
262
296
  }) : "";
263
297
  }
264
298
  };
265
299
  }
266
- function le(t, e = 10, n = []) {
267
- const l = "*:*:*", c = (s) => {
268
- if (!s) return !0;
269
- const m = Array.isArray(s) ? s : [s];
270
- return n.some(
271
- (p) => p === l || m.includes(p)
300
+ function se(t, e = 10, l = []) {
301
+ const n = "*:*:*", s = (i) => {
302
+ if (!i) return !0;
303
+ const m = Array.isArray(i) ? i : [i];
304
+ return l.some(
305
+ (p) => p === n || m.includes(p)
272
306
  );
273
- }, o = $(() => t.some((s) => c(s.permission))), y = $(() => t.filter((m) => c(m.permission)).slice(0, e).reduce(
307
+ }, o = K(() => t.some((i) => s(i.permission))), a = K(() => t.filter((m) => s(m.permission)).slice(0, e).reduce(
274
308
  (m, p) => m + (p.width ?? 55),
275
309
  0
276
- )), u = (s, m) => c(s.permission) && (s.visible ? s.visible(m) : !0), i = (s) => t.filter((p) => u(p, s)).slice(0, e).reduce(
277
- (p, I) => p + (I.width ?? 55),
310
+ )), y = (i, m) => s(i.permission) && (i.visible ? i.visible(m) : !0), u = (i) => t.filter((p) => y(p, i)).slice(0, e).reduce(
311
+ (p, $) => p + ($.width ?? 55),
278
312
  0
279
313
  );
280
314
  return {
281
315
  hasAnyButton: o,
282
- optWidth: y,
283
- hasAnyVisibleButton: (s) => s != null && s.length ? s.some(
284
- (m) => t.some((p) => u(p, m))
316
+ optWidth: a,
317
+ hasAnyVisibleButton: (i) => i != null && i.length ? i.some(
318
+ (m) => t.some((p) => y(p, m))
285
319
  ) : !1,
286
- getMaxOptWidth: (s) => s != null && s.length ? s.reduce(
287
- (m, p) => Math.max(m, i(p)),
320
+ getMaxOptWidth: (i) => i != null && i.length ? i.reduce(
321
+ (m, p) => Math.max(m, u(p)),
288
322
  0
289
- ) : y.value,
290
- getVisibleButtons: (s) => t.filter((m) => u(m, s)).slice(0, e)
323
+ ) : a.value,
324
+ getVisibleButtons: (i) => t.filter((m) => y(m, i)).slice(0, e)
291
325
  };
292
326
  }
293
- const re = /* @__PURE__ */ x({
327
+ const ie = ["title"], ce = /* @__PURE__ */ E({
294
328
  __name: "index",
295
329
  props: {
296
330
  col: { type: Object, required: !0 },
@@ -298,143 +332,149 @@ const re = /* @__PURE__ */ x({
298
332
  },
299
333
  emits: ["cellBlur", "cellEnter", "cellChange", "cellClick"],
300
334
  setup(t, { emit: e }) {
301
- const n = t, r = e, { col: l } = U(n), c = (v, k) => r("cellChange", v, k), o = (v, k) => r("cellBlur", v, k), y = (v, k) => r("cellEnter", v, k), u = (v, k) => r("cellClick", v, k), i = ne(), {
302
- hasAnyButton: h,
303
- hasAnyVisibleButton: a,
335
+ const l = t, r = e, { col: n } = U(l), s = (v, k) => r("cellChange", v, k), o = (v, k) => r("cellBlur", v, k), a = (v, k) => r("cellEnter", v, k), y = (v, k) => r("cellClick", v, k), u = oe(), {
336
+ hasAnyButton: g,
337
+ hasAnyVisibleButton: d,
304
338
  optWidth: C,
305
- getMaxOptWidth: s,
339
+ getMaxOptWidth: i,
306
340
  getVisibleButtons: m
307
- } = le(
308
- l.value.buttons || [],
309
- l.value.maxbtn ?? 10,
310
- n.permissions || []
311
- ), p = $(() => (l.value.buttons || []).length ? (l.value.__rows || []).length ? a(l.value.__rows || []) : h.value : !1), I = $(() => l.value.__rows ? s(l.value.__rows) : C.value);
312
- function z(v) {
341
+ } = se(
342
+ n.value.buttons || [],
343
+ n.value.maxbtn ?? 10,
344
+ l.permissions || []
345
+ ), p = K(() => (n.value.buttons || []).length ? (n.value.__rows || []).length ? d(n.value.__rows || []) : g.value : !1), $ = K(() => n.value.__rows ? i(n.value.__rows) : C.value);
346
+ function R(v) {
313
347
  return !(v.type === "selection" || v.type === "index" || v.type === "operation" && !p.value || v.visible === !1);
314
348
  }
315
349
  return (v, k) => {
316
- const A = w("el-table-column"), J = w("el-button");
317
- return d(l).type === "selection" ? (f(), b(A, _({
350
+ const F = x("el-table-column"), J = x("el-button");
351
+ return c(n).type === "selection" ? (h(), b(F, _({
318
352
  key: 0,
319
353
  type: "selection"
320
- }, d(l).columnProps), null, 16)) : d(l).type === "index" ? (f(), b(A, _({
354
+ }, c(n).columnProps), null, 16)) : c(n).type === "index" ? (h(), b(F, _({
321
355
  key: 1,
322
356
  type: "index",
323
- label: d(l).label || "#",
357
+ label: c(n).label || "#",
324
358
  align: "center"
325
- }, d(l).columnProps), null, 16, ["label"])) : d(l).type === "operation" && p.value ? (f(), b(A, _({
359
+ }, c(n).columnProps), null, 16, ["label"])) : c(n).type === "operation" && p.value ? (h(), b(F, _({
326
360
  key: 2,
327
- label: d(l).label || "操作",
361
+ label: c(n).label || "操作",
328
362
  align: "center"
329
363
  }, {
330
- ...d(l).columnProps,
331
- width: I.value
364
+ ...c(n).columnProps,
365
+ width: $.value
332
366
  }), {
333
367
  default: P(({ row: B }) => [
334
- (f(!0), O(K, null, T(d(m)(B), (F) => (f(), b(J, {
335
- key: F.label,
336
- type: F.type || "primary",
368
+ (h(!0), O(T, null, z(c(m)(B), (w) => (h(), b(J, {
369
+ key: w.label,
370
+ type: w.type || "primary",
337
371
  link: "",
338
- onClick: (ue) => F.action(B)
372
+ onClick: (I) => w.action(B)
339
373
  }, {
340
374
  default: P(() => [
341
- D(N(F.label), 1)
375
+ H(D(w.label), 1)
342
376
  ]),
343
377
  _: 2
344
378
  }, 1032, ["type", "onClick"]))), 128))
345
379
  ]),
346
380
  _: 1
347
- }, 16, ["label"])) : z(d(l)) ? (f(), b(A, _({
381
+ }, 16, ["label"])) : R(c(n)) ? (h(), b(F, _({
348
382
  key: 3,
349
- prop: d(l).key,
350
- label: d(l).label,
383
+ prop: c(n).key,
384
+ label: c(n).label,
351
385
  align: "center"
352
- }, d(l).columnProps || {}), {
353
- default: P(({ row: B }) => [
354
- d(l).render && d(i)[d(l).render] ? (f(), b(H(d(i)[d(l).render]), {
355
- key: 0,
356
- row: B,
357
- col: d(l),
358
- onCellChange: c,
359
- onCellBlur: o,
360
- onCellEnter: y,
361
- onClick: u
362
- }, null, 40, ["row", "col"])) : (f(), O(K, { key: 1 }, [
363
- D(N(B[d(l).key]), 1)
364
- ], 64))
365
- ]),
386
+ }, c(n).columnProps || {}), {
387
+ default: P(({ row: B }) => {
388
+ var w, I;
389
+ return [
390
+ c(n).render && c(u)[c(n).render] ? (h(), b(q(c(u)[c(n).render]), {
391
+ key: 0,
392
+ row: B,
393
+ col: c(n),
394
+ onCellChange: s,
395
+ onCellBlur: o,
396
+ onCellEnter: a,
397
+ onClick: y
398
+ }, null, 40, ["row", "col"])) : (h(), O("span", {
399
+ key: 1,
400
+ style: Y(((w = c(n).renderProps) == null ? void 0 : w.style) || ""),
401
+ class: X(((I = c(n).renderProps) == null ? void 0 : I.class) || ""),
402
+ title: B[c(n).key]
403
+ }, D(B[c(n).key]), 15, ie))
404
+ ];
405
+ }),
366
406
  _: 1
367
407
  }, 16, ["prop", "label"])) : j("", !0);
368
408
  };
369
409
  }
370
- }), oe = "table_columns_";
371
- function ce(t, e) {
372
- return `${oe}${t}_${e}`;
410
+ }), ae = "table_columns_";
411
+ function ue(t, e) {
412
+ return `${ae}${t}_${e}`;
373
413
  }
374
- function R(t, e) {
414
+ function N(t, e) {
375
415
  if (!(e != null && e.length)) return t;
376
- const n = new Map(
416
+ const l = new Map(
377
417
  e.map((r) => [r.key, r])
378
418
  );
379
419
  return t.map((r) => {
380
- const l = n.get(r.key);
381
- return l ? {
420
+ const n = l.get(r.key);
421
+ return n ? {
382
422
  ...r,
383
- visible: typeof l.visible == "boolean" ? l.visible : r.visible
423
+ visible: typeof n.visible == "boolean" ? n.visible : r.visible
384
424
  } : r;
385
425
  });
386
426
  }
387
- function se(t, e) {
427
+ function de(t, e) {
388
428
  const {
389
- pageKey: n,
429
+ pageKey: l,
390
430
  userId: r,
391
- storage: l = localStorage
392
- } = e || {}, o = r ? ce(r, n || "") : null, y = o ? l.getItem(o) : null, u = V(
393
- R(
431
+ storage: n = localStorage
432
+ } = e || {}, o = r ? ue(r, l || "") : null, a = o ? n.getItem(o) : null, y = V(
433
+ N(
394
434
  t,
395
- y ? JSON.parse(y) : []
435
+ a ? JSON.parse(a) : []
396
436
  )
397
437
  );
398
- return S(
399
- u,
400
- (i) => {
438
+ return A(
439
+ y,
440
+ (u) => {
401
441
  if (!o) return;
402
- const h = i.map((a) => ({
403
- key: a.key,
404
- visible: a.visible,
405
- columnOpts: a.columnOpts
442
+ const g = u.map((d) => ({
443
+ key: d.key,
444
+ visible: d.visible,
445
+ columnOpts: d.columnOpts
406
446
  }));
407
- l.setItem(
447
+ n.setItem(
408
448
  o,
409
- JSON.stringify(h)
449
+ JSON.stringify(g)
410
450
  );
411
451
  },
412
452
  { deep: !0 }
413
453
  ), {
414
454
  /** 当前列配置(响应式) */
415
- columns: u,
455
+ columns: y,
416
456
  /**
417
457
  * 主动设置列配置
418
458
  * 常用于:列设置弹窗 / 拖拽排序完成
419
459
  */
420
- setColumns(i) {
421
- u.value = R(
460
+ setColumns(u) {
461
+ y.value = N(
422
462
  t,
423
- i
424
- ), o && l.setItem(
463
+ u
464
+ ), o && n.setItem(
425
465
  o,
426
- JSON.stringify(i)
466
+ JSON.stringify(u)
427
467
  );
428
468
  },
429
469
  /**
430
470
  * 重置为默认列配置
431
471
  */
432
472
  resetColumns() {
433
- u.value = t, o && l.removeItem(o);
473
+ y.value = t, o && n.removeItem(o);
434
474
  }
435
475
  };
436
476
  }
437
- const ie = /* @__PURE__ */ x({
477
+ const ye = /* @__PURE__ */ E({
438
478
  __name: "index",
439
479
  props: {
440
480
  data: { type: Array, default: () => [] },
@@ -460,44 +500,44 @@ const ie = /* @__PURE__ */ x({
460
500
  "cellEnter",
461
501
  "cell-click"
462
502
  ],
463
- setup(t, { expose: e, emit: n }) {
464
- const r = t, l = n, { columns: c } = se(r.columns, {
503
+ setup(t, { expose: e, emit: l }) {
504
+ const r = t, n = l, { columns: s } = de(r.columns, {
465
505
  pageKey: r.pageKey ?? "",
466
506
  userId: r.userId ?? ""
467
507
  });
468
- S(
469
- c,
470
- (a) => l("update:columns", a),
508
+ A(
509
+ s,
510
+ (d) => n("update:columns", d),
471
511
  { deep: !0, immediate: !0 }
472
512
  );
473
- const o = (a, C) => l("cellChange", a, C), y = (a, C) => {
474
- l("cellBlur", a, C);
475
- }, u = (a, C) => {
476
- console.log("enter"), l("cellEnter", a, C);
477
- }, i = (a, C) => {
478
- C && l("cell-click", a, C);
479
- }, h = V();
513
+ const o = (d, C) => n("cellChange", d, C), a = (d, C) => {
514
+ n("cellBlur", d, C);
515
+ }, y = (d, C) => {
516
+ console.log("enter"), n("cellEnter", d, C);
517
+ }, u = (d, C) => {
518
+ C && n("cell-click", d, C);
519
+ }, g = V();
480
520
  return e({
481
- tableRef: h
482
- }), (a, C) => {
483
- const s = w("el-table"), m = q("loading");
484
- return X((f(), b(s, _({
521
+ tableRef: g
522
+ }), (d, C) => {
523
+ const i = x("el-table"), m = G("loading");
524
+ return Q((h(), b(i, _({
485
525
  ref_key: "tableRef",
486
- ref: h
487
- }, a.$attrs, {
526
+ ref: g
527
+ }, d.$attrs, {
488
528
  data: t.data,
489
529
  "row-key": t.rowKey,
490
530
  class: "smart-table"
491
531
  }), {
492
532
  default: P(() => [
493
- (f(!0), O(K, null, T(d(c), (p) => (f(), b(re, {
533
+ (h(!0), O(T, null, z(c(s), (p) => (h(), b(ce, {
494
534
  key: p.key,
495
535
  col: p,
496
536
  permissions: t.permissions,
497
537
  onCellChange: o,
498
- onCellBlur: y,
499
- onCellEnter: u,
500
- onCellClick: i
538
+ onCellBlur: a,
539
+ onCellEnter: y,
540
+ onCellClick: u
501
541
  }, null, 8, ["col", "permissions"]))), 128))
502
542
  ]),
503
543
  _: 1
@@ -506,12 +546,12 @@ const ie = /* @__PURE__ */ x({
506
546
  ]);
507
547
  };
508
548
  }
509
- }), ae = (t, e) => {
510
- const n = t.__vccOpts || t;
511
- for (const [r, l] of e)
512
- n[r] = l;
513
- return n;
514
- }, me = /* @__PURE__ */ ae(ie, [["__scopeId", "data-v-338b77db"]]);
549
+ }), me = (t, e) => {
550
+ const l = t.__vccOpts || t;
551
+ for (const [r, n] of e)
552
+ l[r] = n;
553
+ return l;
554
+ }, he = /* @__PURE__ */ me(ye, [["__scopeId", "data-v-338b77db"]]);
515
555
  export {
516
- me as SmartTable
556
+ he as SmartTable
517
557
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vue3-smart-table",
3
- "version": "0.0.2",
3
+ "version": "1.0.2",
4
4
  "description": "基于 Vue 3 + Element Plus 的高可复用表格组件",
5
5
  "main": "dist/vue3-smart-table.cjs.js",
6
6
  "module": "dist/vue3-smart-table.es.js",