@94ai/nf-table 3.1.37 → 3.1.39

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.
@@ -1,4 +1,3 @@
1
-
2
1
  import { NfTableColumnAttributes, ElTableAttributes, ElTableEventKey, ElPaginationEventKey, ElPaginationAttributes, NfSearchFormAttributes, NfSearchFormEventKey, NfTableActionBtnAttributes } from './types';
3
2
  declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineComponent<{
4
3
  data: {
@@ -326,6 +325,10 @@ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineCompone
326
325
  alwaysShowPage: boolean;
327
326
  operationPropKey: string;
328
327
  }>, Partial<Record<any, (_: {
328
+ slot: any;
329
+ }) => any>> & Partial<Record<any, (_: {
330
+ slot: any;
331
+ }) => any>> & Partial<Record<any, (_: {
329
332
  row: any;
330
333
  index: any;
331
334
  }) => any>> & Partial<Record<any, (_: {}) => any>> & Partial<Record<any, (_: {
@@ -0,0 +1,8 @@
1
+ import NfTable from './nf-table.vue'
2
+ import { Vue2, PluginObject } from 'vue-demi'
3
+
4
+ NfTable.install = (app: typeof Vue2) => {
5
+ app!.component('nf-table', NfTable)
6
+ }
7
+
8
+ export default NfTable as typeof NfTable & PluginObject<undefined>
@@ -0,0 +1,160 @@
1
+ <template>
2
+ <el-dialog
3
+ @open="$emit('open', $event)"
4
+ @opened="$emit('opened', $event)"
5
+ @close="$emit('close', $event)"
6
+ @closed="$emit('closed', $event)"
7
+ :visible.sync="visible"
8
+ :title="title"
9
+ :width="width"
10
+ :modal-append-to-body="modalAppendToBody"
11
+ :modal="modal"
12
+ :fullscreen="fullscreen"
13
+ :top="top"
14
+ :append-to-body="appendToBody"
15
+ :lock-scroll="lockScroll"
16
+ :custom-class="(customClass || '') + ' nf-table-nf-column-check-dialog'"
17
+ :close-on-click-modal="closeOnlickModal"
18
+ :close-on-press-escape="closeOnPressEscape"
19
+ :show-close="showClose"
20
+ :before-close="beforeClose"
21
+ :center="center"
22
+ :destroy-on-close="destroyOnClose"
23
+ >
24
+ <slot slot="title" name="title"></slot>
25
+ <div class="nf-table-nf-column-check-dialog-check-content">
26
+ <div v-for="(item,index) in fields" :key="index" class="nf-check-item">
27
+ <div class="nf-check-title">{{ item.name }}</div>
28
+ <el-checkbox v-for="obj in item.list" :key="obj.prop" v-model="tableData[obj.prop]" class="nf-check-box" :label="obj.prop">{{ obj.label }}</el-checkbox>
29
+ </div>
30
+ </div>
31
+ <slot slot="footer" name="footer">
32
+ <div class="nf-table-nf-column-check-dialog-button-container">
33
+ <el-button size="mini" @click="visible=false" class="nf-table-nf-column-check-dialog-button-cancel">{{ cancelText }}</el-button>
34
+ <el-button type="primary" size="mini" @click="submit" class="nf-table-nf-column-check-dialog-button-confirm">{{ confirmText }}</el-button>
35
+ </div>
36
+ </slot>
37
+ </el-dialog>
38
+ </template>
39
+
40
+
41
+ <script lang="ts">
42
+ import { defineComponent } from 'vue-demi'
43
+
44
+ export default defineComponent({
45
+ name: "NfColumnCheckDialog",
46
+ })
47
+ </script>
48
+
49
+ <script lang="ts" setup>
50
+ import {
51
+ computed,
52
+ onMounted,
53
+ ref
54
+ } from 'vue-demi'
55
+
56
+ const props = withDefaults(defineProps<{
57
+ show?: boolean,
58
+ title?: string,
59
+ width?: string,
60
+ confirmText?: string
61
+ cancelText?: string
62
+ tableColumns?: Record<string, any>[],
63
+ showColumn?: string[]
64
+ modalAppendToBody?: boolean,
65
+ modal?: boolean,
66
+ fullscreen?: boolean,
67
+ top?: string,
68
+ appendToBody?: boolean,
69
+ lockScroll?: boolean,
70
+ customClass?: string,
71
+ closeOnlickModal?: boolean,
72
+ closeOnPressEscape?: boolean,
73
+ showClose?: boolean,
74
+ beforeClose?: Function,
75
+ center?: boolean,
76
+ destroyOnClose?: boolean,
77
+ }>(), {
78
+ show: false,
79
+ width: '600px',
80
+ title: '设置显示字段',
81
+ cancelText: '取 消',
82
+ confirmText: '保 存',
83
+ tableColumns: () => [],
84
+ showColumn: undefined,
85
+ modalAppendToBody: true,
86
+ modal: true,
87
+ fullscreen: false,
88
+ top: '15vh',
89
+ appendToBody: false,
90
+ lockScroll: true,
91
+ customClass: '',
92
+ closeOnlickModal: true,
93
+ closeOnPressEscape: true,
94
+ showClose: true,
95
+ beforeClose: undefined,
96
+ center: false,
97
+ destroyOnClose: false,
98
+ })
99
+
100
+
101
+ const emit = defineEmits<{
102
+ (e: 'update:show', event: boolean): void
103
+ (e: 'save', event: Record<string, any>): void
104
+ }>()
105
+
106
+
107
+
108
+ const tableData = ref<Record<string, any>>({})
109
+
110
+
111
+ const visible = computed({
112
+ get() {
113
+ return props.show
114
+ },
115
+ set(val) {
116
+ emit('update:show', val)
117
+ }
118
+ })
119
+
120
+ const fields = computed(() => {
121
+ const obj: Record<string, any> = {}
122
+ props.tableColumns.map(item => {
123
+ if (!item.type) {
124
+ const key = item.category || '基础字段'
125
+ if (!obj[key]) {
126
+ obj[key] = []
127
+ }
128
+ obj[key].push(item)
129
+ }
130
+ })
131
+ const fields: {name: string, list:Record<string, any>[] }[] = []
132
+ for (const key in obj) {
133
+ fields.push({
134
+ name: key,
135
+ list: obj[key]
136
+ })
137
+ }
138
+ return fields
139
+ })
140
+
141
+
142
+ const submit = () =>{
143
+ visible.value = false
144
+ emit('save', tableData.value)
145
+ }
146
+
147
+ const addInitValue = () => {
148
+ const obj: Record<string, any> = {}
149
+ props.tableColumns.forEach(v => {
150
+ obj[v.prop] = props.showColumn?.length ? (props.showColumn || []).includes(v.prop) : true
151
+ })
152
+ tableData.value = obj
153
+ }
154
+
155
+ onMounted(() => {
156
+ addInitValue()
157
+ })
158
+
159
+ </script>
160
+
@@ -0,0 +1,20 @@
1
+ <script lang="ts">
2
+ import { defineComponent } from 'vue-demi'
3
+
4
+ export default defineComponent({
5
+ props: {
6
+ render: {
7
+ type: Function
8
+ },
9
+ row: {
10
+ type: Object,
11
+ default: () => ({})
12
+ }
13
+ },
14
+ render(h) {
15
+ // @ts-ignore
16
+ return this.render(h, this.row)
17
+ }
18
+ })
19
+
20
+ </script>