@94ai/nf-table 6.1.13 → 6.1.15

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/lib/index.d.ts CHANGED
@@ -988,6 +988,8 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
988
988
  }[];
989
989
  getOptions?: Function | undefined;
990
990
  singleHeadMutiColSlot?: any;
991
+ operationSpan?: number | undefined;
992
+ operationList?: object[] | undefined;
991
993
  attr?: {
992
994
  type?: "index" | "selection" | "expand" | undefined;
993
995
  label?: string | undefined;
@@ -1658,6 +1660,8 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
1658
1660
  }[];
1659
1661
  getOptions?: Function | undefined;
1660
1662
  singleHeadMutiColSlot?: any;
1663
+ operationSpan?: number | undefined;
1664
+ operationList?: object[] | undefined;
1661
1665
  attr?: {
1662
1666
  type?: "index" | "selection" | "expand" | undefined;
1663
1667
  label?: string | undefined;
@@ -2071,5 +2075,144 @@ declare const _default: import("vue/types/v3-component-public-instance").Compone
2071
2075
  default: boolean;
2072
2076
  };
2073
2077
  };
2074
- } & PluginObject<undefined>;
2078
+ } & (new () => {
2079
+ $scopedSlots: Partial<Record<any, (_: {
2080
+ slot: any;
2081
+ }) => any>> & Partial<Record<any, (_: {
2082
+ slot: any;
2083
+ }) => any>> & Partial<Record<any, (_: {
2084
+ slot: any;
2085
+ }) => any>> & Partial<Record<any, (_: {
2086
+ slot: any;
2087
+ }) => any>> & Partial<Record<any, (_: {
2088
+ slot: any;
2089
+ }) => any>> & Partial<Record<any, (_: {
2090
+ slot: any;
2091
+ }) => any>> & Partial<Record<any, (_: {
2092
+ slot: any;
2093
+ }) => any>> & Partial<Record<any, (_: {
2094
+ slot: any;
2095
+ }) => any>> & Partial<Record<any, (_: {
2096
+ slot: any;
2097
+ }) => any>> & Partial<Record<any, (_: {
2098
+ slot: any;
2099
+ }) => any>> & Partial<Record<any, (_: {
2100
+ slot: any;
2101
+ }) => any>> & Partial<Record<any, (_: {
2102
+ slot: any;
2103
+ }) => any>> & Partial<Record<any, (_: {
2104
+ row: any;
2105
+ index: any;
2106
+ }) => any>> & Partial<Record<any, (_: {}) => any>> & Partial<Record<any, (_: {
2107
+ $index: any;
2108
+ column: any;
2109
+ }) => any>> & Partial<Record<any, (_: {
2110
+ row: any;
2111
+ index: any;
2112
+ }) => any>> & Partial<Record<string, (_: {
2113
+ slot: string;
2114
+ }) => any>> & Partial<Record<string, (_: {
2115
+ slot: string;
2116
+ }) => any>> & Partial<Record<string, (_: {
2117
+ slot: string;
2118
+ }) => any>> & Partial<Record<string, (_: {
2119
+ slot: string;
2120
+ }) => any>> & Partial<Record<string, (_: {
2121
+ slot: string;
2122
+ }) => any>> & Partial<Record<string, (_: {
2123
+ slot: string;
2124
+ }) => any>> & Partial<Record<string, (_: {
2125
+ slot: string;
2126
+ }) => any>> & Partial<Record<string, (_: {
2127
+ slot: string;
2128
+ }) => any>> & {
2129
+ searchBox?(_: {
2130
+ ref: string;
2131
+ }): any;
2132
+ btnBox?(_: {
2133
+ slot: string;
2134
+ }): any;
2135
+ searchFormColumnEditDialogTitle?(_: {
2136
+ slot: string;
2137
+ }): any;
2138
+ searchFormColumnEditDialogFooter?(_: {
2139
+ slot: string;
2140
+ }): any;
2141
+ columnEdit?(_: {}): any;
2142
+ operationIconColumnCheck?(_: {
2143
+ column: {
2144
+ _index?: number | undefined;
2145
+ __index?: number | undefined;
2146
+ initHidden?: boolean | undefined;
2147
+ destory?: boolean | undefined;
2148
+ type?: "index" | "selection" | "expand" | undefined;
2149
+ label?: string | undefined;
2150
+ addLabel?: string | undefined;
2151
+ prop?: string | undefined;
2152
+ render?: Function | undefined;
2153
+ slot?: any;
2154
+ headerSlot?: any;
2155
+ labelTooltip?: string | undefined;
2156
+ labelTooltipPlacement?: string | undefined;
2157
+ unit?: string | undefined;
2158
+ options: {
2159
+ label: string;
2160
+ value: string | number;
2161
+ tagType?: any;
2162
+ }[];
2163
+ getOptions?: Function | undefined;
2164
+ singleHeadMutiColSlot?: any;
2165
+ operationSpan?: number | undefined;
2166
+ operationList?: object[] | undefined;
2167
+ attr?: {
2168
+ type?: "index" | "selection" | "expand" | undefined;
2169
+ label?: string | undefined;
2170
+ prop?: string | undefined;
2171
+ index?: number | ((index: number) => number) | undefined;
2172
+ 'column-key'?: string | undefined;
2173
+ width?: string | undefined;
2174
+ 'min-width'?: string | undefined;
2175
+ fixed?: boolean | "left" | "right" | undefined;
2176
+ 'render-header'?: Function | undefined;
2177
+ sortable?: boolean | "custom" | undefined;
2178
+ 'sort-method'?: Function | undefined;
2179
+ 'sort-by'?: string | Function | string[] | undefined;
2180
+ 'sort-orders'?: ["descending" | "ascending" | null, "descending" | "ascending" | null, "descending" | "ascending" | null] | undefined;
2181
+ resizable?: boolean | undefined;
2182
+ formatter?: Function | undefined;
2183
+ 'show-overflow-tooltip'?: boolean | undefined;
2184
+ align?: "left" | "right" | "center" | undefined;
2185
+ 'class-name'?: string | undefined;
2186
+ 'label-class-name'?: string | undefined;
2187
+ selectable?: Function | undefined;
2188
+ 'reserve-selection'?: boolean | undefined;
2189
+ filters?: {
2190
+ text?: string | number | undefined;
2191
+ value?: string | number | undefined;
2192
+ }[] | undefined;
2193
+ 'filter-placement'?: "bottom" | "left" | "right" | "top" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end" | undefined;
2194
+ 'filter-multiple'?: boolean | undefined;
2195
+ 'filter-method'?: Function | undefined;
2196
+ 'filtered-value'?: string[] | undefined;
2197
+ } | undefined;
2198
+ };
2199
+ }): any;
2200
+ append?(_: {
2201
+ slot: string;
2202
+ }): any;
2203
+ empty?(_: {
2204
+ slot: string;
2205
+ }): any;
2206
+ actionBar?(_: {
2207
+ ref: string;
2208
+ }): any;
2209
+ pagination?(_: {}): any;
2210
+ title?(_: {
2211
+ slot: string;
2212
+ }): any;
2213
+ footer?(_: {
2214
+ slot: string;
2215
+ }): any;
2216
+ };
2217
+ }) & PluginObject<undefined>;
2075
2218
  export default _default;
@@ -6246,6 +6246,9 @@ __sfc_main.setup = (__props, __ctx) => {
6246
6246
  }
6247
6247
  return column.operationList || [];
6248
6248
  };
6249
+ const showOperationBtn = (destoryState, scope) => {
6250
+ return typeof destoryState === "function" ? !destoryState(scope.row) : !destoryState;
6251
+ };
6249
6252
  const routeName = vueDemi.computed(() => useRoute().name);
6250
6253
  const instance = (_a = vueDemi.getCurrentInstance()) == null ? void 0 : _a.proxy;
6251
6254
  const elTableRef = vueDemi.ref();
@@ -6278,7 +6281,9 @@ __sfc_main.setup = (__props, __ctx) => {
6278
6281
  onNfSearchFormSearch();
6279
6282
  };
6280
6283
  const handleCurrentChange = (val, isSearch = true) => {
6281
- cPageAttrs["current-page"] = val;
6284
+ if (val !== void 0) {
6285
+ cPageAttrs["current-page"] = val;
6286
+ }
6282
6287
  if (isSearch && cPageChangeSearchApi.value)
6283
6288
  onNfSearchFormSearch();
6284
6289
  };
@@ -6772,13 +6777,13 @@ __sfc_main.setup = (__props, __ctx) => {
6772
6777
  elTableHeight.value = (_b = props.tableAttrs) == null ? void 0 : _b.height;
6773
6778
  }
6774
6779
  };
6775
- const searchApi = async (formData = {}) => {
6780
+ const searchApi = async (formData = {}, refresh = false) => {
6776
6781
  var _a2, _b, _c;
6777
6782
  (_b = (_a2 = props.searchFormEvents) == null ? void 0 : _a2["onSearch"]) == null ? void 0 : _b.call(_a2, formData);
6778
6783
  if (!((_c = instance == null ? void 0 : instance.$listeners) == null ? void 0 : _c.searchApi))
6779
6784
  return;
6780
6785
  tableLoading.value = true;
6781
- if (JSON.stringify(preSearchFormData.value) !== JSON.stringify(formData)) {
6786
+ if (refresh || JSON.stringify(preSearchFormData.value) !== JSON.stringify(formData)) {
6782
6787
  handleCurrentChange(1, false);
6783
6788
  }
6784
6789
  preSearchFormData.value = formData;
@@ -6809,6 +6814,7 @@ __sfc_main.setup = (__props, __ctx) => {
6809
6814
  const nfTableBorder = window.nfTableBorder;
6810
6815
  return Object.assign({
6811
6816
  getOperationListLocal,
6817
+ showOperationBtn,
6812
6818
  elTableRef,
6813
6819
  nfTableActionContainerRef,
6814
6820
  nfTablePaginationRef,
@@ -7071,14 +7077,30 @@ var _sfc_render = function render3() {
7071
7077
  "height": _vm.elTableHeight
7072
7078
  }
7073
7079
  }, "el-table", _vm.tableAttrer, false), _vm.tableEventer), [_vm._l(_vm.tableColumns, function(column) {
7074
- return [column.type && _vm.isShow(column) ? _c("el-table-column", _vm._b({
7080
+ return [column.type && _vm.isShow(column) ? [column.type !== "expand" ? _c("el-table-column", _vm._b({
7075
7081
  key: column.key || column.prop || column.type,
7076
7082
  attrs: {
7077
7083
  "type": column.type,
7078
7084
  "prop": column.prop,
7079
7085
  "label": column.label
7080
7086
  }
7081
- }, "el-table-column", column.attr, false), [column.singleHeadMutiColSlot ? _vm._t(column.singleHeadMutiColSlot) : _vm._e()], 2) : !column.type && _vm.isShow(column) ? _c("el-table-column", _vm._b({
7087
+ }, "el-table-column", column.attr, false)) : _c("el-table-column", _vm._b({
7088
+ key: column.key || column.prop || column.type,
7089
+ attrs: {
7090
+ "type": column.type,
7091
+ "prop": column.prop,
7092
+ "label": column.label
7093
+ },
7094
+ scopedSlots: _vm._u([{
7095
+ key: "default",
7096
+ fn: function(scope) {
7097
+ return column.slot ? [_vm._t(column.slot, null, {
7098
+ "row": scope.row,
7099
+ "index": scope.$index
7100
+ })] : void 0;
7101
+ }
7102
+ }], null, true)
7103
+ }, "el-table-column", column.attr, false))] : !column.type && _vm.isShow(column) ? _c("el-table-column", _vm._b({
7082
7104
  key: column.key || column.prop || column.type,
7083
7105
  attrs: {
7084
7106
  "type": column.type,
@@ -7142,27 +7164,39 @@ var _sfc_render = function render3() {
7142
7164
  "render": column.render,
7143
7165
  "row": scope.row
7144
7166
  }
7145
- }) : column.prop === _vm.operationPropKey && !_vm.hasOperationSlot ? _vm._l(_vm.getOperationListLocal(column, scope), function(item, index2) {
7146
- return _c("nf-button", _vm._g({
7167
+ }) : column.prop === _vm.operationPropKey && !_vm.hasOperationSlot ? _c("nf-action", {
7168
+ attrs: {
7169
+ "span": column.operationSpan || 0,
7170
+ "unique": scope.index
7171
+ }
7172
+ }, [_vm._l(_vm.getOperationListLocal(column, scope), function(item, index2) {
7173
+ return [_vm.showOperationBtn(item.destory, scope) ? _c("nf-button", {
7147
7174
  key: item.key || index2,
7148
7175
  class: item.class,
7149
7176
  style: item.style,
7150
7177
  attrs: {
7151
7178
  "size": item.size || "mini",
7152
- "type": item.type || "text",
7179
+ "type": item.type || "primary",
7180
+ "text": typeof item.text === void 0 ? item.text : true,
7153
7181
  "disabled": item.disabled,
7154
7182
  "loading": item.loading,
7155
7183
  "plain": item.plain,
7156
7184
  "icon": item.icon,
7157
7185
  "round": item.round,
7158
7186
  "circle": item.circle
7187
+ },
7188
+ on: {
7189
+ "click": function($event) {
7190
+ return item.onClick(scope.row, column, scope);
7191
+ }
7159
7192
  }
7160
- }, item.events), [_vm._v(_vm._s(item.text) + " ")]);
7161
- }) : ((_a2 = column.attr) == null ? void 0 : _a2.formatter) ? _c("span", [_vm._v(" " + _vm._s(column.attr.formatter(scope.row, column, scope.row[column.prop], scope.$index)) + " ")]) : column.optionsEnum ? [column.optionsTag[scope.row[column.prop]] ? _c("nf-tag", {
7193
+ }, [_vm._v(_vm._s(item.name) + " ")]) : _vm._e()];
7194
+ })], 2) : ((_a2 = column.attr) == null ? void 0 : _a2.formatter) ? _c("span", [_vm._v(" " + _vm._s(column.attr.formatter(scope.row, column, scope.row[column.prop], scope.$index)) + " ")]) : column.optionsEnum ? [column.optionsTag[scope.row[column.prop]] ? _c("nf-tag", {
7162
7195
  attrs: {
7163
- "type": column.optionsTag[scope.row[column.prop]]
7196
+ "type": column.optionsTag[scope.row[column.prop]],
7197
+ "value": column.optionsEnum[scope.row[column.prop]]
7164
7198
  }
7165
- }, [_vm._v(_vm._s(column.optionsEnum[scope.row[column.prop]]))]) : _c("span", [_vm._v(" " + _vm._s(column.optionsEnum[scope.row[column.prop]]) + " ")])] : _c("span", [_vm._v(" " + _vm._s(scope.row[column.prop]) + _vm._s(column.unit) + " ")])];
7199
+ }) : _c("span", [_vm._v(" " + _vm._s(column.optionsEnum[scope.row[column.prop]]) + " ")])] : _c("span", [_vm._v(" " + _vm._s(scope.row[column.prop]) + _vm._s(column.unit) + " ")])];
7166
7200
  }
7167
7201
  }], null, true)
7168
7202
  }, "el-table-column", column.attr, false), [column.singleHeadMutiColSlot ? _vm._t(column.singleHeadMutiColSlot) : _vm._e()], 2) : _vm._e()];
@@ -6244,6 +6244,9 @@ __sfc_main.setup = (__props, __ctx) => {
6244
6244
  }
6245
6245
  return column.operationList || [];
6246
6246
  };
6247
+ const showOperationBtn = (destoryState, scope) => {
6248
+ return typeof destoryState === "function" ? !destoryState(scope.row) : !destoryState;
6249
+ };
6247
6250
  const routeName = computed(() => useRoute().name);
6248
6251
  const instance = (_a = getCurrentInstance()) == null ? void 0 : _a.proxy;
6249
6252
  const elTableRef = ref();
@@ -6276,7 +6279,9 @@ __sfc_main.setup = (__props, __ctx) => {
6276
6279
  onNfSearchFormSearch();
6277
6280
  };
6278
6281
  const handleCurrentChange = (val, isSearch = true) => {
6279
- cPageAttrs["current-page"] = val;
6282
+ if (val !== void 0) {
6283
+ cPageAttrs["current-page"] = val;
6284
+ }
6280
6285
  if (isSearch && cPageChangeSearchApi.value)
6281
6286
  onNfSearchFormSearch();
6282
6287
  };
@@ -6770,13 +6775,13 @@ __sfc_main.setup = (__props, __ctx) => {
6770
6775
  elTableHeight.value = (_b = props.tableAttrs) == null ? void 0 : _b.height;
6771
6776
  }
6772
6777
  };
6773
- const searchApi = async (formData = {}) => {
6778
+ const searchApi = async (formData = {}, refresh = false) => {
6774
6779
  var _a2, _b, _c;
6775
6780
  (_b = (_a2 = props.searchFormEvents) == null ? void 0 : _a2["onSearch"]) == null ? void 0 : _b.call(_a2, formData);
6776
6781
  if (!((_c = instance == null ? void 0 : instance.$listeners) == null ? void 0 : _c.searchApi))
6777
6782
  return;
6778
6783
  tableLoading.value = true;
6779
- if (JSON.stringify(preSearchFormData.value) !== JSON.stringify(formData)) {
6784
+ if (refresh || JSON.stringify(preSearchFormData.value) !== JSON.stringify(formData)) {
6780
6785
  handleCurrentChange(1, false);
6781
6786
  }
6782
6787
  preSearchFormData.value = formData;
@@ -6807,6 +6812,7 @@ __sfc_main.setup = (__props, __ctx) => {
6807
6812
  const nfTableBorder = window.nfTableBorder;
6808
6813
  return Object.assign({
6809
6814
  getOperationListLocal,
6815
+ showOperationBtn,
6810
6816
  elTableRef,
6811
6817
  nfTableActionContainerRef,
6812
6818
  nfTablePaginationRef,
@@ -7069,14 +7075,30 @@ var _sfc_render = function render3() {
7069
7075
  "height": _vm.elTableHeight
7070
7076
  }
7071
7077
  }, "el-table", _vm.tableAttrer, false), _vm.tableEventer), [_vm._l(_vm.tableColumns, function(column) {
7072
- return [column.type && _vm.isShow(column) ? _c("el-table-column", _vm._b({
7078
+ return [column.type && _vm.isShow(column) ? [column.type !== "expand" ? _c("el-table-column", _vm._b({
7073
7079
  key: column.key || column.prop || column.type,
7074
7080
  attrs: {
7075
7081
  "type": column.type,
7076
7082
  "prop": column.prop,
7077
7083
  "label": column.label
7078
7084
  }
7079
- }, "el-table-column", column.attr, false), [column.singleHeadMutiColSlot ? _vm._t(column.singleHeadMutiColSlot) : _vm._e()], 2) : !column.type && _vm.isShow(column) ? _c("el-table-column", _vm._b({
7085
+ }, "el-table-column", column.attr, false)) : _c("el-table-column", _vm._b({
7086
+ key: column.key || column.prop || column.type,
7087
+ attrs: {
7088
+ "type": column.type,
7089
+ "prop": column.prop,
7090
+ "label": column.label
7091
+ },
7092
+ scopedSlots: _vm._u([{
7093
+ key: "default",
7094
+ fn: function(scope) {
7095
+ return column.slot ? [_vm._t(column.slot, null, {
7096
+ "row": scope.row,
7097
+ "index": scope.$index
7098
+ })] : void 0;
7099
+ }
7100
+ }], null, true)
7101
+ }, "el-table-column", column.attr, false))] : !column.type && _vm.isShow(column) ? _c("el-table-column", _vm._b({
7080
7102
  key: column.key || column.prop || column.type,
7081
7103
  attrs: {
7082
7104
  "type": column.type,
@@ -7140,27 +7162,39 @@ var _sfc_render = function render3() {
7140
7162
  "render": column.render,
7141
7163
  "row": scope.row
7142
7164
  }
7143
- }) : column.prop === _vm.operationPropKey && !_vm.hasOperationSlot ? _vm._l(_vm.getOperationListLocal(column, scope), function(item, index2) {
7144
- return _c("nf-button", _vm._g({
7165
+ }) : column.prop === _vm.operationPropKey && !_vm.hasOperationSlot ? _c("nf-action", {
7166
+ attrs: {
7167
+ "span": column.operationSpan || 0,
7168
+ "unique": scope.index
7169
+ }
7170
+ }, [_vm._l(_vm.getOperationListLocal(column, scope), function(item, index2) {
7171
+ return [_vm.showOperationBtn(item.destory, scope) ? _c("nf-button", {
7145
7172
  key: item.key || index2,
7146
7173
  class: item.class,
7147
7174
  style: item.style,
7148
7175
  attrs: {
7149
7176
  "size": item.size || "mini",
7150
- "type": item.type || "text",
7177
+ "type": item.type || "primary",
7178
+ "text": typeof item.text === void 0 ? item.text : true,
7151
7179
  "disabled": item.disabled,
7152
7180
  "loading": item.loading,
7153
7181
  "plain": item.plain,
7154
7182
  "icon": item.icon,
7155
7183
  "round": item.round,
7156
7184
  "circle": item.circle
7185
+ },
7186
+ on: {
7187
+ "click": function($event) {
7188
+ return item.onClick(scope.row, column, scope);
7189
+ }
7157
7190
  }
7158
- }, item.events), [_vm._v(_vm._s(item.text) + " ")]);
7159
- }) : ((_a2 = column.attr) == null ? void 0 : _a2.formatter) ? _c("span", [_vm._v(" " + _vm._s(column.attr.formatter(scope.row, column, scope.row[column.prop], scope.$index)) + " ")]) : column.optionsEnum ? [column.optionsTag[scope.row[column.prop]] ? _c("nf-tag", {
7191
+ }, [_vm._v(_vm._s(item.name) + " ")]) : _vm._e()];
7192
+ })], 2) : ((_a2 = column.attr) == null ? void 0 : _a2.formatter) ? _c("span", [_vm._v(" " + _vm._s(column.attr.formatter(scope.row, column, scope.row[column.prop], scope.$index)) + " ")]) : column.optionsEnum ? [column.optionsTag[scope.row[column.prop]] ? _c("nf-tag", {
7160
7193
  attrs: {
7161
- "type": column.optionsTag[scope.row[column.prop]]
7194
+ "type": column.optionsTag[scope.row[column.prop]],
7195
+ "value": column.optionsEnum[scope.row[column.prop]]
7162
7196
  }
7163
- }, [_vm._v(_vm._s(column.optionsEnum[scope.row[column.prop]]))]) : _c("span", [_vm._v(" " + _vm._s(column.optionsEnum[scope.row[column.prop]]) + " ")])] : _c("span", [_vm._v(" " + _vm._s(scope.row[column.prop]) + _vm._s(column.unit) + " ")])];
7197
+ }) : _c("span", [_vm._v(" " + _vm._s(column.optionsEnum[scope.row[column.prop]]) + " ")])] : _c("span", [_vm._v(" " + _vm._s(scope.row[column.prop]) + _vm._s(column.unit) + " ")])];
7164
7198
  }
7165
7199
  }], null, true)
7166
7200
  }, "el-table-column", column.attr, false), [column.singleHeadMutiColSlot ? _vm._t(column.singleHeadMutiColSlot) : _vm._e()], 2) : _vm._e()];
@@ -1,6 +1,6 @@
1
1
  import { NfTableColumnAttributes, ElTableAttributes, ElTableEventKey, ElPaginationEventKey, ElPaginationAttributes, NfSearchFormAttributes, NfSearchFormEventKey, NfTableActionBtnAttributes } from './types';
2
2
  import { ITabItem } from '@94ai/nf-drawer/lib/types';
3
- declare const _default: import("vue-demi").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
3
+ declare const _default: __VLS_WithTemplateSlots<import("vue-demi").DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<{
4
4
  data?: Record<string, any>[] | undefined;
5
5
  columns?: NfTableColumnAttributes[] | any;
6
6
  searchFormAttrs?: NfSearchFormAttributes | undefined;
@@ -194,6 +194,8 @@ declare const _default: import("vue-demi").DefineComponent<__VLS_WithDefaults<__
194
194
  }[];
195
195
  getOptions?: Function | undefined;
196
196
  singleHeadMutiColSlot?: any;
197
+ operationSpan?: number | undefined;
198
+ operationList?: object[] | undefined;
197
199
  attr?: {
198
200
  type?: "index" | "selection" | "expand" | undefined;
199
201
  label?: string | undefined;
@@ -462,6 +464,143 @@ declare const _default: import("vue-demi").DefineComponent<__VLS_WithDefaults<__
462
464
  lock: boolean;
463
465
  spinner: string;
464
466
  alwaysShowPage: boolean;
467
+ }>, Partial<Record<any, (_: {
468
+ slot: any;
469
+ }) => any>> & Partial<Record<any, (_: {
470
+ slot: any;
471
+ }) => any>> & Partial<Record<any, (_: {
472
+ slot: any;
473
+ }) => any>> & Partial<Record<any, (_: {
474
+ slot: any;
475
+ }) => any>> & Partial<Record<any, (_: {
476
+ slot: any;
477
+ }) => any>> & Partial<Record<any, (_: {
478
+ slot: any;
479
+ }) => any>> & Partial<Record<any, (_: {
480
+ slot: any;
481
+ }) => any>> & Partial<Record<any, (_: {
482
+ slot: any;
483
+ }) => any>> & Partial<Record<any, (_: {
484
+ slot: any;
485
+ }) => any>> & Partial<Record<any, (_: {
486
+ slot: any;
487
+ }) => any>> & Partial<Record<any, (_: {
488
+ slot: any;
489
+ }) => any>> & Partial<Record<any, (_: {
490
+ slot: any;
491
+ }) => any>> & Partial<Record<any, (_: {
492
+ row: any;
493
+ index: any;
494
+ }) => any>> & Partial<Record<any, (_: {}) => any>> & Partial<Record<any, (_: {
495
+ $index: any;
496
+ column: any;
497
+ }) => any>> & Partial<Record<any, (_: {
498
+ row: any;
499
+ index: any;
500
+ }) => any>> & Partial<Record<string, (_: {
501
+ slot: string;
502
+ }) => any>> & Partial<Record<string, (_: {
503
+ slot: string;
504
+ }) => any>> & Partial<Record<string, (_: {
505
+ slot: string;
506
+ }) => any>> & Partial<Record<string, (_: {
507
+ slot: string;
508
+ }) => any>> & Partial<Record<string, (_: {
509
+ slot: string;
510
+ }) => any>> & Partial<Record<string, (_: {
511
+ slot: string;
512
+ }) => any>> & Partial<Record<string, (_: {
513
+ slot: string;
514
+ }) => any>> & Partial<Record<string, (_: {
515
+ slot: string;
516
+ }) => any>> & {
517
+ searchBox?(_: {
518
+ ref: string;
519
+ }): any;
520
+ btnBox?(_: {
521
+ slot: string;
522
+ }): any;
523
+ searchFormColumnEditDialogTitle?(_: {
524
+ slot: string;
525
+ }): any;
526
+ searchFormColumnEditDialogFooter?(_: {
527
+ slot: string;
528
+ }): any;
529
+ columnEdit?(_: {}): any;
530
+ operationIconColumnCheck?(_: {
531
+ column: {
532
+ _index?: number | undefined;
533
+ __index?: number | undefined;
534
+ initHidden?: boolean | undefined;
535
+ destory?: boolean | undefined;
536
+ type?: "index" | "selection" | "expand" | undefined;
537
+ label?: string | undefined;
538
+ addLabel?: string | undefined;
539
+ prop?: string | undefined;
540
+ render?: Function | undefined;
541
+ slot?: any;
542
+ headerSlot?: any;
543
+ labelTooltip?: string | undefined;
544
+ labelTooltipPlacement?: string | undefined;
545
+ unit?: string | undefined;
546
+ options: {
547
+ label: string;
548
+ value: string | number;
549
+ tagType?: any;
550
+ }[];
551
+ getOptions?: Function | undefined;
552
+ singleHeadMutiColSlot?: any;
553
+ operationSpan?: number | undefined;
554
+ operationList?: object[] | undefined;
555
+ attr?: {
556
+ type?: "index" | "selection" | "expand" | undefined;
557
+ label?: string | undefined;
558
+ prop?: string | undefined;
559
+ index?: number | ((index: number) => number) | undefined;
560
+ 'column-key'?: string | undefined;
561
+ width?: string | undefined;
562
+ 'min-width'?: string | undefined;
563
+ fixed?: boolean | "left" | "right" | undefined;
564
+ 'render-header'?: Function | undefined;
565
+ sortable?: boolean | "custom" | undefined;
566
+ 'sort-method'?: Function | undefined;
567
+ 'sort-by'?: string | Function | string[] | undefined;
568
+ 'sort-orders'?: ["descending" | "ascending" | null, "descending" | "ascending" | null, "descending" | "ascending" | null] | undefined;
569
+ resizable?: boolean | undefined;
570
+ formatter?: Function | undefined;
571
+ 'show-overflow-tooltip'?: boolean | undefined;
572
+ align?: "left" | "right" | "center" | undefined;
573
+ 'class-name'?: string | undefined;
574
+ 'label-class-name'?: string | undefined;
575
+ selectable?: Function | undefined;
576
+ 'reserve-selection'?: boolean | undefined;
577
+ filters?: {
578
+ text?: string | number | undefined;
579
+ value?: string | number | undefined;
580
+ }[] | undefined;
581
+ 'filter-placement'?: "bottom" | "left" | "right" | "top" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "left-start" | "left-end" | "right-start" | "right-end" | undefined;
582
+ 'filter-multiple'?: boolean | undefined;
583
+ 'filter-method'?: Function | undefined;
584
+ 'filtered-value'?: string[] | undefined;
585
+ } | undefined;
586
+ };
587
+ }): any;
588
+ append?(_: {
589
+ slot: string;
590
+ }): any;
591
+ empty?(_: {
592
+ slot: string;
593
+ }): any;
594
+ actionBar?(_: {
595
+ ref: string;
596
+ }): any;
597
+ pagination?(_: {}): any;
598
+ title?(_: {
599
+ slot: string;
600
+ }): any;
601
+ footer?(_: {
602
+ slot: string;
603
+ }): any;
465
604
  }>;
466
605
  export default _default;
467
606
  declare type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -481,3 +620,8 @@ declare type __VLS_WithDefaults<P, D> = {
481
620
  declare type __VLS_Prettify<T> = {
482
621
  [K in keyof T]: T[K];
483
622
  } & {};
623
+ declare type __VLS_WithTemplateSlots<T, S> = T & {
624
+ new (): {
625
+ $scopedSlots: S;
626
+ };
627
+ };
package/lib/types.d.ts CHANGED
@@ -196,6 +196,8 @@ export interface NfTableColumnAttributes {
196
196
  }[];
197
197
  getOptions?: Function;
198
198
  singleHeadMutiColSlot?: any;
199
+ operationSpan?: number;
200
+ operationList?: object[];
199
201
  attr?: ElTableColumnAttributes;
200
202
  }
201
203
  export interface NfTableActionBtnAttributes {
@@ -56,17 +56,29 @@
56
56
  >
57
57
  <template v-for="column in tableColumns">
58
58
  <!-- 特殊类型,如selection -->
59
- <el-table-column
60
- v-if="column.type && isShow(column)"
61
- :key="column.key || column.prop || column.type"
62
- :type="column.type"
63
- :prop="column.prop"
64
- :label="column.label"
65
- v-bind="column.attr"
66
- >
67
- <!-- column套column -->
68
- <slot v-if="column.singleHeadMutiColSlot" :name="column.singleHeadMutiColSlot" />
69
- </el-table-column>
59
+ <template v-if="column.type && isShow(column)">
60
+ <el-table-column
61
+ v-if="column.type!=='expand'"
62
+ :key="column.key || column.prop || column.type"
63
+ :type="column.type"
64
+ :prop="column.prop"
65
+ :label="column.label"
66
+ v-bind="column.attr"
67
+ >
68
+ </el-table-column>
69
+ <el-table-column
70
+ v-else
71
+ :key="column.key || column.prop || column.type"
72
+ :type="column.type"
73
+ :prop="column.prop"
74
+ :label="column.label"
75
+ v-bind="column.attr"
76
+ >
77
+ <template slot-scope="scope" v-if="column.slot">
78
+ <slot :name="column.slot" :row="scope.row" :index="scope.$index" />
79
+ </template>
80
+ </el-table-column>
81
+ </template>
70
82
  <el-table-column
71
83
  v-else-if="!column.type && isShow(column)"
72
84
  :key="column.key || column.prop || column.type"
@@ -132,23 +144,31 @@
132
144
  :row="scope.row"
133
145
  />
134
146
  <!-- 操作 -->
135
- <nf-button
147
+ <nf-action
136
148
  v-else-if="column.prop === operationPropKey && !hasOperationSlot"
137
- :size="item.size || 'mini'"
138
- :type="item.type || 'text'"
139
- :disabled="item.disabled"
140
- :loading="item.loading"
141
- :class="item.class"
142
- :plain="item.plain"
143
- :icon="item.icon"
144
- :round="item.round"
145
- :circle="item.circle"
146
- :style="item.style"
147
- v-for="(item, index) in getOperationListLocal(column, scope)"
148
- v-on="item.events"
149
- :key="item.key || index"
150
- >{{ item.text }}
151
- </nf-button>
149
+ :span="column.operationSpan || 0"
150
+ :unique="scope.index"
151
+ >
152
+ <template v-for="(item, index) in getOperationListLocal(column, scope)">
153
+ <nf-button
154
+ v-if="showOperationBtn(item.destory, scope)"
155
+ :size="item.size || 'mini'"
156
+ :type="item.type || 'primary'"
157
+ :text="typeof item.text === undefined ? item.text : true"
158
+ :disabled="item.disabled"
159
+ :loading="item.loading"
160
+ :class="item.class"
161
+ :plain="item.plain"
162
+ :icon="item.icon"
163
+ :round="item.round"
164
+ :circle="item.circle"
165
+ :style="item.style"
166
+ @click="item.onClick(scope.row, column, scope)"
167
+ :key="item.key || index"
168
+ >{{ item.name }}
169
+ </nf-button>
170
+ </template>
171
+ </nf-action>
152
172
  <span v-else-if="column.attr?.formatter">
153
173
  {{ column.attr.formatter(scope.row, column, scope.row[column.prop], scope.$index) }}
154
174
  </span>
@@ -156,7 +176,8 @@
156
176
  <nf-tag
157
177
  v-if="column.optionsTag[scope.row[column.prop]]"
158
178
  :type='column.optionsTag[scope.row[column.prop]]'
159
- >{{ column.optionsEnum[scope.row[column.prop]] }}</nf-tag>
179
+ :value="column.optionsEnum[scope.row[column.prop]]"
180
+ />
160
181
  <span v-else>
161
182
  {{ column.optionsEnum[scope.row[column.prop]] }}
162
183
  </span>
@@ -810,6 +831,9 @@ const getOperationListLocal = (column, scope) => {
810
831
  }
811
832
  return column.operationList || []
812
833
  }
834
+ const showOperationBtn = (destoryState, scope) => {
835
+ return typeof destoryState === 'function' ? !destoryState(scope.row) : !destoryState
836
+ }
813
837
 
814
838
  const routeName = computed(() => useRoute().name)
815
839
  const instance = getCurrentInstance()?.proxy
@@ -848,7 +872,9 @@ const handleSizeChange = (val) => {
848
872
  // 切换页码
849
873
  const handleCurrentChange = (val, isSearch = true) => {
850
874
  // props.pageEvents?.['current-change']?.(val)
851
- cPageAttrs['current-page'] = val
875
+ if (val !== undefined) {
876
+ cPageAttrs['current-page'] = val
877
+ }
852
878
  if (isSearch && cPageChangeSearchApi.value) onNfSearchFormSearch()
853
879
  }
854
880
 
@@ -1360,14 +1386,14 @@ const calcTableHeight = () => {
1360
1386
  }
1361
1387
 
1362
1388
  // 触发列表查询
1363
- const searchApi = async (formData = {}) => {
1389
+ const searchApi = async (formData = {}, refresh = false) => {
1364
1390
  // search-form-events有配置onSearch,则触发(兼容老版本)
1365
1391
  props.searchFormEvents?.['onSearch']?.(formData)
1366
1392
  if (!instance?.$listeners?.searchApi) return
1367
1393
  // 以下是配置@searchApi触发
1368
1394
  tableLoading.value = true
1369
1395
  // 查询条件改变,重置当前页数为1
1370
- if (JSON.stringify(preSearchFormData.value) !== JSON.stringify(formData)) {
1396
+ if (refresh || JSON.stringify(preSearchFormData.value) !== JSON.stringify(formData)) {
1371
1397
  handleCurrentChange(1, false)
1372
1398
  }
1373
1399
  preSearchFormData.value = formData
package/package/types.ts CHANGED
@@ -285,6 +285,10 @@ export interface NfTableColumnAttributes {
285
285
  * 嵌套表格头用slot
286
286
  */
287
287
  singleHeadMutiColSlot?: any,
288
+ /** 操作栏 nf-action span 默认0 */
289
+ operationSpan?: number
290
+ /** 操作栏按钮数组 */
291
+ operationList?: object[]
288
292
  attr?: ElTableColumnAttributes
289
293
  }
290
294
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@94ai/nf-table",
3
- "version": "6.1.13",
3
+ "version": "6.1.15",
4
4
  "description": "> TODO: description",
5
5
  "keywords": [],
6
6
  "author": "zoujiahe <zoujiahe@94ai.com>",
@@ -14,13 +14,13 @@
14
14
  "url": "http://94ai.gitlab.com/zoujiahe/common-ui.git"
15
15
  },
16
16
  "dependencies": {
17
- "@94ai/common-utils": "^6.1.13",
18
- "@94ai/nf-button": "^6.1.13",
19
- "@94ai/nf-drawer": "^6.1.13",
20
- "@94ai/nf-message": "^6.1.13",
21
- "@94ai/nf-search-form": "^6.1.13",
22
- "@94ai/nf-tag": "^6.1.13",
23
- "@94ai/nf-theme-chalk": "^6.1.13",
17
+ "@94ai/common-utils": "^6.1.15",
18
+ "@94ai/nf-button": "^6.1.15",
19
+ "@94ai/nf-drawer": "^6.1.15",
20
+ "@94ai/nf-message": "^6.1.15",
21
+ "@94ai/nf-search-form": "^6.1.15",
22
+ "@94ai/nf-tag": "^6.1.15",
23
+ "@94ai/nf-theme-chalk": "^6.1.15",
24
24
  "idb-keyval": "^6.2.1",
25
25
  "vue-demi": "^0.14.5",
26
26
  "vue-router": "3.6.4",
@@ -39,5 +39,5 @@
39
39
  "types": "lib/index.d.ts",
40
40
  "main": "lib/nf-table.cjs.js",
41
41
  "module": "lib/nf-table.esm-bundler.js",
42
- "gitHead": "c170847f6493387bf69985e7661c5d44e0a1decd"
42
+ "gitHead": "eb5f3e53e097e7c502d297739ec358c35af2541b"
43
43
  }