@ftjs/antd 1.3.0 → 2.0.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.
- package/dist/form/index.d.ts +10 -0
- package/dist/index.js +62 -41
- package/dist/vxe-table/column-edit.d.ts +3 -1
- package/package.json +13 -3
package/dist/form/index.d.ts
CHANGED
|
@@ -25,6 +25,16 @@ export interface FtAntdFormProps<F extends Record<string, any>> extends FtFormPr
|
|
|
25
25
|
* @default false
|
|
26
26
|
*/
|
|
27
27
|
hideReset?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* 提交按钮文本
|
|
30
|
+
* @default '确认'
|
|
31
|
+
*/
|
|
32
|
+
confirmText?: string;
|
|
33
|
+
/**
|
|
34
|
+
* 重置按钮文本
|
|
35
|
+
* @default '重置'
|
|
36
|
+
*/
|
|
37
|
+
resetText?: string;
|
|
28
38
|
}
|
|
29
39
|
export interface FtAntdFormSearchProps<F extends Record<string, any>> extends FtFormProps<F> {
|
|
30
40
|
}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getField, useFormItem, unrefs, useFormInject, toValueWithForm, useForm, set, useTable, get } from "@ftjs/core";
|
|
2
|
-
import { computed, toValue, createVNode, mergeProps, unref, createTextVNode, isVNode, defineComponent, createBlock, openBlock, resolveDynamicComponent, createElementBlock, Fragment, renderList, ref, useId, withCtx, renderSlot, createCommentVNode,
|
|
1
|
+
import { getField, useFormItem, useLocale, unrefs, useFormInject, toValueWithForm, useForm, set, useTable, get } from "@ftjs/core";
|
|
2
|
+
import { computed, toValue, createVNode, mergeProps, unref, createTextVNode, isVNode, defineComponent, createBlock, openBlock, resolveDynamicComponent, createElementBlock, Fragment, renderList, ref, useId, withCtx, renderSlot, createCommentVNode, toDisplayString, createElementVNode, onMounted, h, useTemplateRef, normalizeStyle, createSlots, normalizeProps } from "vue";
|
|
3
3
|
import { FormItem, Input, Select, DatePicker, RangePicker, Radio, Textarea, Upload, Cascader, AutoComplete, CheckboxGroup, InputNumber, Mentions, Rate, Slider, Switch, TreeSelect, Form, Button, Modal, Tree, Divider, Spin, Pagination } from "ant-design-vue";
|
|
4
4
|
import dayjs from "dayjs";
|
|
5
5
|
import { SwapOutlined, SettingOutlined } from "@ant-design/icons-vue";
|
|
@@ -22,9 +22,10 @@ const input = defineFormItem((props) => {
|
|
|
22
22
|
props
|
|
23
23
|
});
|
|
24
24
|
const formItemProps = useFormItemProps(props.column);
|
|
25
|
+
const locale = useLocale();
|
|
25
26
|
return () => {
|
|
26
27
|
const _props = unrefs(props.column.props);
|
|
27
|
-
const placeholder =
|
|
28
|
+
const placeholder = locale.value.placeholder.input(formItemProps.value.label);
|
|
28
29
|
return createVNode(FormItem, formItemProps.value, {
|
|
29
30
|
default: () => [props.isView ? createVNode("div", null, [valueComputed.value]) : createVNode(Input, mergeProps({
|
|
30
31
|
"value": valueComputed.value,
|
|
@@ -43,8 +44,9 @@ const select = defineFormItem((props) => {
|
|
|
43
44
|
props
|
|
44
45
|
});
|
|
45
46
|
const formItemProps = useFormItemProps(props.column);
|
|
47
|
+
const locale = useLocale();
|
|
46
48
|
const placeholder = computed(() => {
|
|
47
|
-
return
|
|
49
|
+
return locale.value.placeholder.select(formItemProps.value.label);
|
|
48
50
|
});
|
|
49
51
|
const isViewTextVNode = computed(() => {
|
|
50
52
|
var _a, _b;
|
|
@@ -172,9 +174,10 @@ const textarea = defineFormItem((props) => {
|
|
|
172
174
|
props
|
|
173
175
|
});
|
|
174
176
|
const formItemProps = useFormItemProps(props.column);
|
|
177
|
+
const locale = useLocale();
|
|
175
178
|
return () => {
|
|
176
179
|
const _props = unrefs(props.column.props);
|
|
177
|
-
const placeholder =
|
|
180
|
+
const placeholder = locale.value.placeholder.input(formItemProps.value.label);
|
|
178
181
|
return createVNode(FormItem, formItemProps.value, {
|
|
179
182
|
default: () => [props.isView ? createVNode("div", null, [valueComputed.value]) : createVNode(Textarea, mergeProps({
|
|
180
183
|
"value": valueComputed.value,
|
|
@@ -231,9 +234,10 @@ const cascader = defineFormItem((props) => {
|
|
|
231
234
|
props
|
|
232
235
|
});
|
|
233
236
|
const formItemProps = useFormItemProps(props.column);
|
|
237
|
+
const locale = useLocale();
|
|
234
238
|
return () => {
|
|
235
239
|
const _props = unrefs(props.column.props);
|
|
236
|
-
const placeholder =
|
|
240
|
+
const placeholder = locale.value.placeholder.select(formItemProps.value.label);
|
|
237
241
|
const getTextFromOptions = (options, value, level = 0) => {
|
|
238
242
|
if (!options || !value || level >= value.length) return void 0;
|
|
239
243
|
const currentValue = value[level];
|
|
@@ -273,13 +277,14 @@ const autoComplete = defineFormItem((props) => {
|
|
|
273
277
|
props
|
|
274
278
|
});
|
|
275
279
|
const formItemProps = useFormItemProps(props.column);
|
|
280
|
+
const locale = useLocale();
|
|
276
281
|
return () => {
|
|
277
282
|
const _props = unrefs(props.column.props);
|
|
278
283
|
return createVNode(FormItem, formItemProps.value, {
|
|
279
284
|
default: () => [props.isView ? createVNode("div", null, [valueComputed.value || "-"]) : createVNode(AutoComplete, mergeProps({
|
|
280
285
|
"value": valueComputed.value,
|
|
281
286
|
"onUpdate:value": ($event) => valueComputed.value = $event,
|
|
282
|
-
"placeholder":
|
|
287
|
+
"placeholder": locale.value.placeholder.input(formItemProps.value.label),
|
|
283
288
|
"allowClear": true
|
|
284
289
|
}, _props), null)]
|
|
285
290
|
});
|
|
@@ -342,13 +347,14 @@ const inputNumber = defineFormItem((props) => {
|
|
|
342
347
|
props
|
|
343
348
|
});
|
|
344
349
|
const formItemProps = useFormItemProps(props.column);
|
|
350
|
+
const locale = useLocale();
|
|
345
351
|
return () => {
|
|
346
352
|
const _props = unrefs(props.column.props);
|
|
347
353
|
return createVNode(FormItem, formItemProps.value, {
|
|
348
354
|
default: () => [props.isView ? createVNode("div", null, [valueComputed.value]) : createVNode(InputNumber, mergeProps({
|
|
349
355
|
"value": valueComputed.value,
|
|
350
356
|
"onUpdate:value": ($event) => valueComputed.value = $event,
|
|
351
|
-
"placeholder":
|
|
357
|
+
"placeholder": locale.value.placeholder.input(formItemProps.value.label)
|
|
352
358
|
}, _props), null)]
|
|
353
359
|
});
|
|
354
360
|
};
|
|
@@ -436,6 +442,7 @@ const treeSelect = defineFormItem((props) => {
|
|
|
436
442
|
props
|
|
437
443
|
});
|
|
438
444
|
const formItemProps = useFormItemProps(props.column);
|
|
445
|
+
const locale = useLocale();
|
|
439
446
|
const isViewText = computed(() => {
|
|
440
447
|
var _a, _b;
|
|
441
448
|
if (props.isView && valueComputed.value) {
|
|
@@ -462,7 +469,7 @@ const treeSelect = defineFormItem((props) => {
|
|
|
462
469
|
});
|
|
463
470
|
return () => {
|
|
464
471
|
const _props = unrefs(props.column.props);
|
|
465
|
-
const placeholder =
|
|
472
|
+
const placeholder = locale.value.placeholder.select(formItemProps.value.label);
|
|
466
473
|
return createVNode(FormItem, formItemProps.value, {
|
|
467
474
|
default: () => [props.isView ? createVNode("div", {
|
|
468
475
|
"style": isViewOptionsStyle
|
|
@@ -551,6 +558,8 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
551
558
|
hideFooter: { type: Boolean },
|
|
552
559
|
hideConfirm: { type: Boolean },
|
|
553
560
|
hideReset: { type: Boolean },
|
|
561
|
+
confirmText: {},
|
|
562
|
+
resetText: {},
|
|
554
563
|
columns: {},
|
|
555
564
|
internalFormProps: {},
|
|
556
565
|
formData: {},
|
|
@@ -561,6 +570,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
561
570
|
},
|
|
562
571
|
setup(__props, { expose: __expose }) {
|
|
563
572
|
const props = __props;
|
|
573
|
+
const locale = useLocale();
|
|
564
574
|
const { getFormData, visibleColumns, form, resetToDefault, setAsDefault } = useForm(props);
|
|
565
575
|
const { rules } = useRules(props);
|
|
566
576
|
const formRef = ref();
|
|
@@ -613,9 +623,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
613
623
|
type: "primary",
|
|
614
624
|
htmlType: "submit"
|
|
615
625
|
}, {
|
|
616
|
-
default: withCtx(() =>
|
|
617
|
-
createTextVNode(
|
|
618
|
-
])
|
|
626
|
+
default: withCtx(() => [
|
|
627
|
+
createTextVNode(toDisplayString(_ctx.confirmText ?? unref(locale).form.submit), 1)
|
|
628
|
+
]),
|
|
619
629
|
_: 1
|
|
620
630
|
})) : createCommentVNode("", true),
|
|
621
631
|
!_ctx.hideReset ? (openBlock(), createBlock(unref(Button), {
|
|
@@ -625,9 +635,9 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
625
635
|
danger: "",
|
|
626
636
|
onClick: _cache[0] || (_cache[0] = () => unref(resetToDefault)())
|
|
627
637
|
}, {
|
|
628
|
-
default: withCtx(() =>
|
|
629
|
-
createTextVNode(
|
|
630
|
-
])
|
|
638
|
+
default: withCtx(() => [
|
|
639
|
+
createTextVNode(toDisplayString(_ctx.resetText ?? unref(locale).form.reset), 1)
|
|
640
|
+
]),
|
|
631
641
|
_: 1
|
|
632
642
|
})) : createCommentVNode("", true)
|
|
633
643
|
]),
|
|
@@ -639,9 +649,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
639
649
|
};
|
|
640
650
|
}
|
|
641
651
|
});
|
|
642
|
-
const _hoisted_1$1 = { style: { "
|
|
643
|
-
const _hoisted_2$1 = { style: { "
|
|
644
|
-
const _hoisted_3 = { style: { "display": "flex"
|
|
652
|
+
const _hoisted_1$1 = { style: { "font-size": "12px", "color": "gray" } };
|
|
653
|
+
const _hoisted_2$1 = { style: { "text-align": "center" } };
|
|
654
|
+
const _hoisted_3 = { style: { "display": "flex" } };
|
|
655
|
+
const _hoisted_4 = { style: { "display": "flex", "gap": "10px" } };
|
|
645
656
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
646
657
|
...{
|
|
647
658
|
name: "FtAntdFormSearch",
|
|
@@ -659,6 +670,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
659
670
|
},
|
|
660
671
|
setup(__props, { expose: __expose }) {
|
|
661
672
|
const props = __props;
|
|
673
|
+
const locale = useLocale();
|
|
662
674
|
const {
|
|
663
675
|
visibleColumns,
|
|
664
676
|
form,
|
|
@@ -699,7 +711,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
699
711
|
const settingModal = ref(false);
|
|
700
712
|
let oldSortList = [];
|
|
701
713
|
const createColumnsTree = () => {
|
|
702
|
-
const treeData = [
|
|
714
|
+
const treeData = [
|
|
715
|
+
{
|
|
716
|
+
title: locale.value.searchSettings.selectAll,
|
|
717
|
+
key: "__all",
|
|
718
|
+
children: []
|
|
719
|
+
}
|
|
720
|
+
];
|
|
703
721
|
const children = [];
|
|
704
722
|
for (const column of props.columns) {
|
|
705
723
|
const key = getField(column);
|
|
@@ -780,31 +798,31 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
780
798
|
maskClosable: false,
|
|
781
799
|
destroyOnClose: ""
|
|
782
800
|
}, {
|
|
783
|
-
title: withCtx(() =>
|
|
801
|
+
title: withCtx(() => [
|
|
784
802
|
createElementVNode("span", null, [
|
|
785
|
-
createTextVNode("
|
|
786
|
-
createElementVNode("span",
|
|
787
|
-
]
|
|
788
|
-
])
|
|
803
|
+
createTextVNode(toDisplayString(unref(locale).searchSettings.title) + " ", 1),
|
|
804
|
+
createElementVNode("span", _hoisted_1$1, toDisplayString(unref(locale).searchSettings.dragHint), 1)
|
|
805
|
+
])
|
|
806
|
+
]),
|
|
789
807
|
footer: withCtx(() => [
|
|
790
|
-
createElementVNode("div",
|
|
808
|
+
createElementVNode("div", _hoisted_2$1, [
|
|
791
809
|
createVNode(unref(Button), {
|
|
792
810
|
type: "primary",
|
|
793
811
|
danger: "",
|
|
794
812
|
onClick: onCancel
|
|
795
813
|
}, {
|
|
796
|
-
default: withCtx(() =>
|
|
797
|
-
createTextVNode(
|
|
798
|
-
])
|
|
814
|
+
default: withCtx(() => [
|
|
815
|
+
createTextVNode(toDisplayString(unref(locale).searchSettings.reset), 1)
|
|
816
|
+
]),
|
|
799
817
|
_: 1
|
|
800
818
|
}),
|
|
801
819
|
createVNode(unref(Button), {
|
|
802
820
|
type: "primary",
|
|
803
821
|
onClick: onSettingOk
|
|
804
822
|
}, {
|
|
805
|
-
default: withCtx(() =>
|
|
806
|
-
createTextVNode(
|
|
807
|
-
])
|
|
823
|
+
default: withCtx(() => [
|
|
824
|
+
createTextVNode(toDisplayString(unref(locale).searchSettings.save), 1)
|
|
825
|
+
]),
|
|
808
826
|
_: 1
|
|
809
827
|
})
|
|
810
828
|
])
|
|
@@ -824,7 +842,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
824
842
|
onDrop
|
|
825
843
|
}, {
|
|
826
844
|
title: withCtx((node) => [
|
|
827
|
-
createElementVNode("div",
|
|
845
|
+
createElementVNode("div", _hoisted_3, [
|
|
828
846
|
createElementVNode("span", null, toDisplayString(node.title), 1),
|
|
829
847
|
node.key !== "__all" ? (openBlock(), createBlock(unref(SwapOutlined), {
|
|
830
848
|
key: 0,
|
|
@@ -851,7 +869,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
851
869
|
}, null, 8, ["columns", "is-view"]),
|
|
852
870
|
createVNode(unref(FormItem), { style: { "--ft-form-control-width": "220px" } }, {
|
|
853
871
|
default: withCtx(() => [
|
|
854
|
-
createElementVNode("div",
|
|
872
|
+
createElementVNode("div", _hoisted_4, [
|
|
855
873
|
_ctx.cache ? (openBlock(), createBlock(unref(Button), {
|
|
856
874
|
key: 0,
|
|
857
875
|
onClick: setting
|
|
@@ -860,7 +878,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
860
878
|
createVNode(unref(SettingOutlined))
|
|
861
879
|
]),
|
|
862
880
|
default: withCtx(() => [
|
|
863
|
-
|
|
881
|
+
createTextVNode(" " + toDisplayString(unref(locale).form.settings), 1)
|
|
864
882
|
]),
|
|
865
883
|
_: 1
|
|
866
884
|
})) : createCommentVNode("", true),
|
|
@@ -868,9 +886,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
868
886
|
type: "primary",
|
|
869
887
|
htmlType: "submit"
|
|
870
888
|
}, {
|
|
871
|
-
default: withCtx(() =>
|
|
872
|
-
createTextVNode(
|
|
873
|
-
])
|
|
889
|
+
default: withCtx(() => [
|
|
890
|
+
createTextVNode(toDisplayString(unref(locale).form.search), 1)
|
|
891
|
+
]),
|
|
874
892
|
_: 1
|
|
875
893
|
}),
|
|
876
894
|
createVNode(unref(Button), {
|
|
@@ -879,9 +897,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
879
897
|
htmlType: "reset",
|
|
880
898
|
onClick: _cache[2] || (_cache[2] = () => unref(resetToDefault)())
|
|
881
899
|
}, {
|
|
882
|
-
default: withCtx(() =>
|
|
883
|
-
createTextVNode(
|
|
884
|
-
])
|
|
900
|
+
default: withCtx(() => [
|
|
901
|
+
createTextVNode(toDisplayString(unref(locale).form.reset), 1)
|
|
902
|
+
]),
|
|
885
903
|
_: 1
|
|
886
904
|
})
|
|
887
905
|
])
|
|
@@ -914,6 +932,8 @@ function isComponentTuple(value) {
|
|
|
914
932
|
return Array.isArray(value);
|
|
915
933
|
}
|
|
916
934
|
const editMap = /* @__PURE__ */ new Map([
|
|
935
|
+
["auto-complete", AutoComplete],
|
|
936
|
+
["cascader", Cascader],
|
|
917
937
|
["input", Input],
|
|
918
938
|
["select", Select],
|
|
919
939
|
["input-number", InputNumber],
|
|
@@ -1054,7 +1074,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1054
1074
|
value2 = valueSetter(value2);
|
|
1055
1075
|
}
|
|
1056
1076
|
set(row, field, value2);
|
|
1057
|
-
}
|
|
1077
|
+
},
|
|
1078
|
+
style: "width: 100%"
|
|
1058
1079
|
};
|
|
1059
1080
|
return h(component, props2);
|
|
1060
1081
|
} : null,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Refs } from '@ftjs/core';
|
|
2
|
-
import { InputProps, SelectProps, SwitchProps, InputNumberProps } from 'ant-design-vue';
|
|
2
|
+
import { InputProps, SelectProps, SwitchProps, InputNumberProps, AutoCompleteProps, CascaderProps } from 'ant-design-vue';
|
|
3
3
|
import { Component, MaybeRefOrGetter } from 'vue';
|
|
4
4
|
import { VxeTableDefines } from 'vxe-table';
|
|
5
5
|
export interface Edit<Type, Props, Row extends Record<string, any>> {
|
|
@@ -20,6 +20,8 @@ export interface Edit<Type, Props, Row extends Record<string, any>> {
|
|
|
20
20
|
rules?: MaybeRefOrGetter<VxeTableDefines.ValidatorRule<Row>[]>;
|
|
21
21
|
}
|
|
22
22
|
export interface EditMap<_TableData extends Record<string, any>> {
|
|
23
|
+
"auto-complete": Edit<"auto-complete", Refs<AutoCompleteProps>, _TableData>;
|
|
24
|
+
cascader: Edit<"cascader", Refs<CascaderProps>, _TableData>;
|
|
23
25
|
input: Edit<"input", Refs<InputProps>, _TableData>;
|
|
24
26
|
select: Edit<"select", Refs<SelectProps>, _TableData>;
|
|
25
27
|
switch: Edit<"switch", Refs<SwitchProps>, _TableData>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ftjs/antd",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,16 +30,26 @@
|
|
|
30
30
|
"vite": "^6.1.0",
|
|
31
31
|
"vite-plugin-dts": "^4.5.0",
|
|
32
32
|
"vue-tsc": "2.2.0",
|
|
33
|
-
"@ftjs/core": "1.
|
|
33
|
+
"@ftjs/core": "1.3.0"
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"@ant-design/icons-vue": ">=7.0.0",
|
|
37
37
|
"vue": ">=3.3.0",
|
|
38
|
-
"@ftjs/core": "^1.
|
|
38
|
+
"@ftjs/core": "^1.3.0",
|
|
39
39
|
"ant-design-vue": ">=4.0.0",
|
|
40
40
|
"dayjs": ">=1.0.0",
|
|
41
41
|
"vxe-table": ">=4.0.0"
|
|
42
42
|
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public",
|
|
45
|
+
"registry": "https://registry.npmjs.org/",
|
|
46
|
+
"provenance": true
|
|
47
|
+
},
|
|
48
|
+
"repository": {
|
|
49
|
+
"type": "git",
|
|
50
|
+
"url": "https://github.com/yuhengshen/ftjs",
|
|
51
|
+
"directory": "packages/antd"
|
|
52
|
+
},
|
|
43
53
|
"scripts": {
|
|
44
54
|
"build": "vite build",
|
|
45
55
|
"minify": "pnpm dlx esbuild ./dist/index.js --minify --outfile=./dist/index.min.js"
|