@ftjs/antd 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { Refs } from '@ftjs/core';
|
|
1
|
+
import { CommonSlots, Refs } from '@ftjs/core';
|
|
2
2
|
import { UploadProps } from 'ant-design-vue';
|
|
3
|
-
import { VNodeChild } from 'vue';
|
|
4
3
|
import { AntdColumnBase } from '../register';
|
|
5
4
|
export interface FtFormColumnUpload<T extends Record<string, any>> extends AntdColumnBase<T> {
|
|
6
5
|
/**
|
|
@@ -8,12 +7,7 @@ export interface FtFormColumnUpload<T extends Record<string, any>> extends AntdC
|
|
|
8
7
|
*/
|
|
9
8
|
type: "upload";
|
|
10
9
|
props?: Refs<UploadProps>;
|
|
11
|
-
slots:
|
|
12
|
-
default: (ctx: {
|
|
13
|
-
value: any;
|
|
14
|
-
isView: boolean;
|
|
15
|
-
}) => VNodeChild;
|
|
16
|
-
};
|
|
10
|
+
slots: CommonSlots<["default"]>;
|
|
17
11
|
}
|
|
18
12
|
declare const _default: import('vue').DefineSetupFnComponent<import('@ftjs/core').CommonFormItemProps<FtFormColumnUpload<any>>, import('vue').EmitsOptions, {}, import('@ftjs/core').CommonFormItemProps<FtFormColumnUpload<any>> & ({
|
|
19
13
|
[x: `on${Capitalize<string>}`]: ((...args: any[]) => any) | undefined;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed, toValue, createVNode, mergeProps, unref, createTextVNode, ref, useId, Fragment, watchEffect, onMounted, onUnmounted, nextTick, reactive, watch, h } from "vue";
|
|
1
|
+
import { computed, toValue, createVNode, mergeProps, unref, createTextVNode, isVNode, ref, useId, Fragment, watchEffect, onMounted, onUnmounted, nextTick, reactive, watch, h } from "vue";
|
|
2
2
|
import { SwapOutlined, SettingOutlined } from "@ant-design/icons-vue";
|
|
3
3
|
import { getField, defineFormComponent, useFormItem, unrefs, defineFtForm, useFormInject, set, defineFtTable, useTableInject, get, cloneDeep } from "@ftjs/core";
|
|
4
4
|
import { FormItem, Input, Select, DatePicker, RangePicker, Radio, Textarea, Upload, Cascader, AutoComplete, CheckboxGroup, InputNumber, Mentions, Rate, Slider, Switch, TreeSelect, Modal, Tree, Button, Form, Divider, Table, Spin, Pagination } from "ant-design-vue";
|
|
@@ -186,9 +186,13 @@ const textarea = defineFormComponent((props) => {
|
|
|
186
186
|
});
|
|
187
187
|
};
|
|
188
188
|
});
|
|
189
|
+
function _isSlot(s) {
|
|
190
|
+
return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !isVNode(s);
|
|
191
|
+
}
|
|
189
192
|
const upload = defineFormComponent((props) => {
|
|
190
193
|
const {
|
|
191
|
-
valueComputed
|
|
194
|
+
valueComputed,
|
|
195
|
+
slots
|
|
192
196
|
} = useFormItem({
|
|
193
197
|
props
|
|
194
198
|
});
|
|
@@ -200,16 +204,22 @@ const upload = defineFormComponent((props) => {
|
|
|
200
204
|
return () => {
|
|
201
205
|
const _props = unrefs(props.column.props);
|
|
202
206
|
return createVNode(FormItem, formItemProps.value, {
|
|
203
|
-
default: () => [createVNode(Upload, mergeProps({
|
|
207
|
+
default: () => [props.isView ? createVNode(Upload, mergeProps({
|
|
208
|
+
"file-list": valueComputed.value
|
|
209
|
+
}, _props, {
|
|
210
|
+
"disabled": true
|
|
211
|
+
}), {
|
|
212
|
+
default: () => {
|
|
213
|
+
var _a;
|
|
214
|
+
return [!((_a = valueComputed.value) == null ? void 0 : _a.length) && createVNode("div", null, [createTextVNode("-")])];
|
|
215
|
+
}
|
|
216
|
+
}) : createVNode(Upload, mergeProps({
|
|
204
217
|
"file-list": valueComputed.value,
|
|
205
218
|
"onUpdate:file-list": ($event) => valueComputed.value = $event
|
|
206
219
|
}, _props, {
|
|
207
220
|
"disabled": disabled.value
|
|
208
|
-
}), {
|
|
209
|
-
default: () => [
|
|
210
|
-
value: valueComputed.value,
|
|
211
|
-
isView: props.isView
|
|
212
|
-
})]
|
|
221
|
+
}), _isSlot(slots) ? slots : {
|
|
222
|
+
default: () => [slots]
|
|
213
223
|
})]
|
|
214
224
|
});
|
|
215
225
|
};
|
|
@@ -1119,7 +1129,7 @@ const FtVxeTable = defineFtTable((_, ctx) => {
|
|
|
1119
1129
|
const {
|
|
1120
1130
|
formColumns,
|
|
1121
1131
|
tableColumns,
|
|
1122
|
-
internalTableProps,
|
|
1132
|
+
internalTableProps: _internalTableProps,
|
|
1123
1133
|
internalFormProps,
|
|
1124
1134
|
tableData,
|
|
1125
1135
|
loading,
|
|
@@ -1131,11 +1141,6 @@ const FtVxeTable = defineFtTable((_, ctx) => {
|
|
|
1131
1141
|
fitFlexHeight,
|
|
1132
1142
|
minHeight,
|
|
1133
1143
|
hidePagination,
|
|
1134
|
-
rowConfig: _rowConfig,
|
|
1135
|
-
customConfig: _customConfig,
|
|
1136
|
-
toolbarConfig: _toolbarConfig,
|
|
1137
|
-
columnConfig: _columnConfig,
|
|
1138
|
-
treeConfig,
|
|
1139
1144
|
onSearch,
|
|
1140
1145
|
"onUpdate:exposed": onUpdateExposed
|
|
1141
1146
|
} = useTableInject();
|
|
@@ -1160,12 +1165,6 @@ const FtVxeTable = defineFtTable((_, ctx) => {
|
|
|
1160
1165
|
handleSearch();
|
|
1161
1166
|
}
|
|
1162
1167
|
});
|
|
1163
|
-
const rowConfig = computed(() => {
|
|
1164
|
-
return {
|
|
1165
|
-
keyField: keyField.value,
|
|
1166
|
-
..._rowConfig.value
|
|
1167
|
-
};
|
|
1168
|
-
});
|
|
1169
1168
|
const enableEdit = computed(() => {
|
|
1170
1169
|
return tableColumns.value.some((column) => {
|
|
1171
1170
|
var _a;
|
|
@@ -1240,34 +1239,42 @@ const FtVxeTable = defineFtTable((_, ctx) => {
|
|
|
1240
1239
|
};
|
|
1241
1240
|
});
|
|
1242
1241
|
});
|
|
1243
|
-
const
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
return {
|
|
1252
|
-
custom: true,
|
|
1253
|
-
zoom: true,
|
|
1254
|
-
..._toolbarConfig.value
|
|
1255
|
-
};
|
|
1256
|
-
});
|
|
1257
|
-
const editConfig = computed(() => {
|
|
1258
|
-
if (!enableEdit.value) return void 0;
|
|
1259
|
-
return {
|
|
1260
|
-
mode: "row",
|
|
1261
|
-
showStatus: true,
|
|
1262
|
-
trigger: "manual",
|
|
1263
|
-
autoClear: false,
|
|
1264
|
-
autoPos: true
|
|
1265
|
-
};
|
|
1266
|
-
});
|
|
1267
|
-
const columnConfig = computed(() => {
|
|
1242
|
+
const internalTableProps = computed(() => {
|
|
1243
|
+
const {
|
|
1244
|
+
columnConfig,
|
|
1245
|
+
editConfig,
|
|
1246
|
+
toolbarConfig,
|
|
1247
|
+
customConfig,
|
|
1248
|
+
rowConfig
|
|
1249
|
+
} = _internalTableProps.value ?? {};
|
|
1268
1250
|
return {
|
|
1269
|
-
|
|
1270
|
-
|
|
1251
|
+
..._internalTableProps.value,
|
|
1252
|
+
columnConfig: {
|
|
1253
|
+
resizable: true,
|
|
1254
|
+
...columnConfig
|
|
1255
|
+
},
|
|
1256
|
+
editConfig: enableEdit.value ? {
|
|
1257
|
+
mode: "row",
|
|
1258
|
+
showStatus: true,
|
|
1259
|
+
trigger: "manual",
|
|
1260
|
+
autoClear: false,
|
|
1261
|
+
autoPos: true,
|
|
1262
|
+
...editConfig
|
|
1263
|
+
} : void 0,
|
|
1264
|
+
toolbarConfig: {
|
|
1265
|
+
custom: true,
|
|
1266
|
+
zoom: true,
|
|
1267
|
+
...toolbarConfig
|
|
1268
|
+
},
|
|
1269
|
+
customConfig: {
|
|
1270
|
+
storage: true,
|
|
1271
|
+
enabled: cache.value != null,
|
|
1272
|
+
...customConfig
|
|
1273
|
+
},
|
|
1274
|
+
rowConfig: {
|
|
1275
|
+
keyField: keyField.value,
|
|
1276
|
+
...rowConfig
|
|
1277
|
+
}
|
|
1271
1278
|
};
|
|
1272
1279
|
});
|
|
1273
1280
|
let containerStyle = {
|
|
@@ -1325,14 +1332,8 @@ const FtVxeTable = defineFtTable((_, ctx) => {
|
|
|
1325
1332
|
"loading": loading.value,
|
|
1326
1333
|
"data": tableData.value,
|
|
1327
1334
|
"minHeight": minHeight.value ?? 310,
|
|
1328
|
-
"rowConfig": rowConfig.value,
|
|
1329
|
-
"treeConfig": treeConfig.value,
|
|
1330
1335
|
"id": cache.value,
|
|
1331
|
-
"
|
|
1332
|
-
"customConfig": customConfig.value,
|
|
1333
|
-
"columnConfig": columnConfig.value,
|
|
1334
|
-
"keepSource": enableEdit.value,
|
|
1335
|
-
"editConfig": editConfig.value
|
|
1336
|
+
"keepSource": enableEdit.value
|
|
1336
1337
|
}, internalTableProps.value), {
|
|
1337
1338
|
pager() {
|
|
1338
1339
|
return hidePagination.value ? null : createVNode("div", {
|
|
@@ -1369,7 +1370,7 @@ const FtVxeTable = defineFtTable((_, ctx) => {
|
|
|
1369
1370
|
default: true
|
|
1370
1371
|
}], "fitFlexHeight", "minHeight", ["hidePagination", {
|
|
1371
1372
|
type: Boolean
|
|
1372
|
-
}], "exposed", "onUpdate:exposed"
|
|
1373
|
+
}], "exposed", "onUpdate:exposed"]);
|
|
1373
1374
|
export {
|
|
1374
1375
|
FtForm,
|
|
1375
1376
|
FtFormSearch,
|
|
@@ -46,7 +46,7 @@ type VxeTableColumn<TableData extends Record<string, any>> = FtTableColumn<Table
|
|
|
46
46
|
/**
|
|
47
47
|
* 内部表格 props
|
|
48
48
|
*/
|
|
49
|
-
interface InternalVxeTableProps<TableData extends Record<string, any>> extends Omit<VxeGridProps<TableData>, "columns" | "minHeight"
|
|
49
|
+
interface InternalVxeTableProps<TableData extends Record<string, any>> extends Omit<VxeGridProps<TableData>, "columns" | "minHeight"> {
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* 表格插槽
|
|
@@ -72,26 +72,6 @@ interface VxeExtendedProps<TableData extends Record<string, any>, SearchData ext
|
|
|
72
72
|
* @default 310
|
|
73
73
|
*/
|
|
74
74
|
minHeight?: number;
|
|
75
|
-
/**
|
|
76
|
-
* vxe-table 树形配置
|
|
77
|
-
*/
|
|
78
|
-
treeConfig?: VxeGridProps<TableData>["treeConfig"];
|
|
79
|
-
/**
|
|
80
|
-
* vxe-table 行配置
|
|
81
|
-
*/
|
|
82
|
-
rowConfig?: VxeGridProps<TableData>["rowConfig"];
|
|
83
|
-
/**
|
|
84
|
-
* vxe-table 自定义配置
|
|
85
|
-
*/
|
|
86
|
-
customConfig?: VxeGridProps<TableData>["customConfig"];
|
|
87
|
-
/**
|
|
88
|
-
* vxe-table 工具栏配置
|
|
89
|
-
*/
|
|
90
|
-
toolbarConfig?: VxeGridProps<TableData>["toolbarConfig"];
|
|
91
|
-
/**
|
|
92
|
-
* vxe-table 列配置
|
|
93
|
-
*/
|
|
94
|
-
columnConfig?: VxeGridProps<TableData>["columnConfig"];
|
|
95
75
|
/**
|
|
96
76
|
* 是否隐藏分页
|
|
97
77
|
* @default false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ftjs/antd",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"vite": "^6.1.0",
|
|
31
31
|
"vite-plugin-dts": "^4.5.0",
|
|
32
32
|
"vue-tsc": "2.2.0",
|
|
33
|
-
"@ftjs/core": "0.
|
|
33
|
+
"@ftjs/core": "0.3.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@ant-design/icons-vue": ">=7.0.0",
|