@ftjs/antd 1.4.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/index.js +55 -39
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getField, useFormItem, unrefs, useFormInject, toValueWithForm, useForm, set, useTable, get } from "@ftjs/core";
|
|
1
|
+
import { getField, useFormItem, useLocale, unrefs, useFormInject, toValueWithForm, useForm, set, useTable, get } from "@ftjs/core";
|
|
2
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";
|
|
@@ -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,18 +558,19 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
551
558
|
hideFooter: { type: Boolean },
|
|
552
559
|
hideConfirm: { type: Boolean },
|
|
553
560
|
hideReset: { type: Boolean },
|
|
554
|
-
confirmText: {
|
|
555
|
-
resetText: {
|
|
561
|
+
confirmText: {},
|
|
562
|
+
resetText: {},
|
|
556
563
|
columns: {},
|
|
557
564
|
internalFormProps: {},
|
|
558
565
|
formData: {},
|
|
559
|
-
"onUpdate:formData": {},
|
|
560
|
-
onSubmit: {},
|
|
566
|
+
"onUpdate:formData": { type: Function },
|
|
567
|
+
onSubmit: { type: Function },
|
|
561
568
|
isView: { type: Boolean },
|
|
562
569
|
cache: {}
|
|
563
570
|
},
|
|
564
571
|
setup(__props, { expose: __expose }) {
|
|
565
572
|
const props = __props;
|
|
573
|
+
const locale = useLocale();
|
|
566
574
|
const { getFormData, visibleColumns, form, resetToDefault, setAsDefault } = useForm(props);
|
|
567
575
|
const { rules } = useRules(props);
|
|
568
576
|
const formRef = ref();
|
|
@@ -616,7 +624,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
616
624
|
htmlType: "submit"
|
|
617
625
|
}, {
|
|
618
626
|
default: withCtx(() => [
|
|
619
|
-
createTextVNode(toDisplayString(_ctx.confirmText), 1)
|
|
627
|
+
createTextVNode(toDisplayString(_ctx.confirmText ?? unref(locale).form.submit), 1)
|
|
620
628
|
]),
|
|
621
629
|
_: 1
|
|
622
630
|
})) : createCommentVNode("", true),
|
|
@@ -628,7 +636,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
628
636
|
onClick: _cache[0] || (_cache[0] = () => unref(resetToDefault)())
|
|
629
637
|
}, {
|
|
630
638
|
default: withCtx(() => [
|
|
631
|
-
createTextVNode(toDisplayString(_ctx.resetText), 1)
|
|
639
|
+
createTextVNode(toDisplayString(_ctx.resetText ?? unref(locale).form.reset), 1)
|
|
632
640
|
]),
|
|
633
641
|
_: 1
|
|
634
642
|
})) : createCommentVNode("", true)
|
|
@@ -641,9 +649,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
641
649
|
};
|
|
642
650
|
}
|
|
643
651
|
});
|
|
644
|
-
const _hoisted_1$1 = { style: { "
|
|
645
|
-
const _hoisted_2$1 = { style: { "
|
|
646
|
-
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" } };
|
|
647
656
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
648
657
|
...{
|
|
649
658
|
name: "FtAntdFormSearch",
|
|
@@ -661,6 +670,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
661
670
|
},
|
|
662
671
|
setup(__props, { expose: __expose }) {
|
|
663
672
|
const props = __props;
|
|
673
|
+
const locale = useLocale();
|
|
664
674
|
const {
|
|
665
675
|
visibleColumns,
|
|
666
676
|
form,
|
|
@@ -701,7 +711,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
701
711
|
const settingModal = ref(false);
|
|
702
712
|
let oldSortList = [];
|
|
703
713
|
const createColumnsTree = () => {
|
|
704
|
-
const treeData = [
|
|
714
|
+
const treeData = [
|
|
715
|
+
{
|
|
716
|
+
title: locale.value.searchSettings.selectAll,
|
|
717
|
+
key: "__all",
|
|
718
|
+
children: []
|
|
719
|
+
}
|
|
720
|
+
];
|
|
705
721
|
const children = [];
|
|
706
722
|
for (const column of props.columns) {
|
|
707
723
|
const key = getField(column);
|
|
@@ -782,31 +798,31 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
782
798
|
maskClosable: false,
|
|
783
799
|
destroyOnClose: ""
|
|
784
800
|
}, {
|
|
785
|
-
title: withCtx(() =>
|
|
801
|
+
title: withCtx(() => [
|
|
786
802
|
createElementVNode("span", null, [
|
|
787
|
-
createTextVNode("
|
|
788
|
-
createElementVNode("span",
|
|
789
|
-
]
|
|
790
|
-
])
|
|
803
|
+
createTextVNode(toDisplayString(unref(locale).searchSettings.title) + " ", 1),
|
|
804
|
+
createElementVNode("span", _hoisted_1$1, toDisplayString(unref(locale).searchSettings.dragHint), 1)
|
|
805
|
+
])
|
|
806
|
+
]),
|
|
791
807
|
footer: withCtx(() => [
|
|
792
|
-
createElementVNode("div",
|
|
808
|
+
createElementVNode("div", _hoisted_2$1, [
|
|
793
809
|
createVNode(unref(Button), {
|
|
794
810
|
type: "primary",
|
|
795
811
|
danger: "",
|
|
796
812
|
onClick: onCancel
|
|
797
813
|
}, {
|
|
798
|
-
default: withCtx(() =>
|
|
799
|
-
createTextVNode(
|
|
800
|
-
])
|
|
814
|
+
default: withCtx(() => [
|
|
815
|
+
createTextVNode(toDisplayString(unref(locale).searchSettings.reset), 1)
|
|
816
|
+
]),
|
|
801
817
|
_: 1
|
|
802
818
|
}),
|
|
803
819
|
createVNode(unref(Button), {
|
|
804
820
|
type: "primary",
|
|
805
821
|
onClick: onSettingOk
|
|
806
822
|
}, {
|
|
807
|
-
default: withCtx(() =>
|
|
808
|
-
createTextVNode(
|
|
809
|
-
])
|
|
823
|
+
default: withCtx(() => [
|
|
824
|
+
createTextVNode(toDisplayString(unref(locale).searchSettings.save), 1)
|
|
825
|
+
]),
|
|
810
826
|
_: 1
|
|
811
827
|
})
|
|
812
828
|
])
|
|
@@ -826,7 +842,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
826
842
|
onDrop
|
|
827
843
|
}, {
|
|
828
844
|
title: withCtx((node) => [
|
|
829
|
-
createElementVNode("div",
|
|
845
|
+
createElementVNode("div", _hoisted_3, [
|
|
830
846
|
createElementVNode("span", null, toDisplayString(node.title), 1),
|
|
831
847
|
node.key !== "__all" ? (openBlock(), createBlock(unref(SwapOutlined), {
|
|
832
848
|
key: 0,
|
|
@@ -853,7 +869,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
853
869
|
}, null, 8, ["columns", "is-view"]),
|
|
854
870
|
createVNode(unref(FormItem), { style: { "--ft-form-control-width": "220px" } }, {
|
|
855
871
|
default: withCtx(() => [
|
|
856
|
-
createElementVNode("div",
|
|
872
|
+
createElementVNode("div", _hoisted_4, [
|
|
857
873
|
_ctx.cache ? (openBlock(), createBlock(unref(Button), {
|
|
858
874
|
key: 0,
|
|
859
875
|
onClick: setting
|
|
@@ -862,7 +878,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
862
878
|
createVNode(unref(SettingOutlined))
|
|
863
879
|
]),
|
|
864
880
|
default: withCtx(() => [
|
|
865
|
-
|
|
881
|
+
createTextVNode(" " + toDisplayString(unref(locale).form.settings), 1)
|
|
866
882
|
]),
|
|
867
883
|
_: 1
|
|
868
884
|
})) : createCommentVNode("", true),
|
|
@@ -870,9 +886,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
870
886
|
type: "primary",
|
|
871
887
|
htmlType: "submit"
|
|
872
888
|
}, {
|
|
873
|
-
default: withCtx(() =>
|
|
874
|
-
createTextVNode(
|
|
875
|
-
])
|
|
889
|
+
default: withCtx(() => [
|
|
890
|
+
createTextVNode(toDisplayString(unref(locale).form.search), 1)
|
|
891
|
+
]),
|
|
876
892
|
_: 1
|
|
877
893
|
}),
|
|
878
894
|
createVNode(unref(Button), {
|
|
@@ -881,9 +897,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
881
897
|
htmlType: "reset",
|
|
882
898
|
onClick: _cache[2] || (_cache[2] = () => unref(resetToDefault)())
|
|
883
899
|
}, {
|
|
884
|
-
default: withCtx(() =>
|
|
885
|
-
createTextVNode(
|
|
886
|
-
])
|
|
900
|
+
default: withCtx(() => [
|
|
901
|
+
createTextVNode(toDisplayString(unref(locale).form.reset), 1)
|
|
902
|
+
]),
|
|
887
903
|
_: 1
|
|
888
904
|
})
|
|
889
905
|
])
|
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,12 +30,12 @@
|
|
|
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"
|