@ftjs/antd 0.2.0 → 0.2.1
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/dist/form/components/upload.d.ts +2 -8
- package/dist/index.js +18 -8
- package/package.json +2 -2
|
@@ -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
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ftjs/antd",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
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.2.
|
|
33
|
+
"@ftjs/core": "0.2.1"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@ant-design/icons-vue": ">=7.0.0",
|