@ftjs/tdesign 1.2.1 → 2.1.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 +60 -41
- package/package.json +13 -3
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { computed, toValue, createVNode, mergeProps, createTextVNode, h, isVNode, defineComponent, createBlock, openBlock, resolveDynamicComponent, unref, createElementBlock, Fragment, renderList, normalizeStyle, ref, useId, withCtx, renderSlot, createCommentVNode, createElementVNode } from "vue";
|
|
2
|
-
import { getField, set, useFormItem, useFormInject, toValueWithForm, unrefs, useForm } from "@ftjs/core";
|
|
1
|
+
import { computed, toValue, createVNode, mergeProps, createTextVNode, h, isVNode, defineComponent, createBlock, openBlock, resolveDynamicComponent, unref, createElementBlock, Fragment, renderList, normalizeClass, normalizeStyle, ref, useId, withCtx, renderSlot, createCommentVNode, toDisplayString, createElementVNode } from "vue";
|
|
2
|
+
import { getField, set, useFormItem, useLocale, useFormInject, toValueWithForm, unrefs, useForm } from "@ftjs/core";
|
|
3
3
|
import { FormItem, AutoComplete as AutoComplete$1, Cascader as Cascader$1, CheckboxGroup, ColorPicker as ColorPicker$1, DatePicker as DatePicker$1, DateRangePicker as DateRangePicker$1, Input as Input$1, InputAdornment, InputNumber as InputNumber$1, Tag, TagInput as TagInput$1, RadioGroup, RangeInput as RangeInput$1, Select as Select$1, Slider as Slider$1, Switch as Switch$1, Textarea as Textarea$1, TimePicker as TimePicker$1, TreeSelect as TreeSelect$1, Form, Button, Dialog, Tree } from "tdesign-vue-next";
|
|
4
4
|
import { MoveIcon, SettingIcon } from "tdesign-icons-vue-next";
|
|
5
5
|
const useFormItemProps = (column) => {
|
|
@@ -32,12 +32,13 @@ const AutoComplete = defineFormItem((props) => {
|
|
|
32
32
|
props
|
|
33
33
|
});
|
|
34
34
|
const formItemProps = useFormItemProps(props.column);
|
|
35
|
+
const locale = useLocale();
|
|
35
36
|
return () => {
|
|
36
37
|
return createVNode(FormItem, formItemProps.value, {
|
|
37
38
|
default: () => [props.isView ? createVNode("div", null, [valueComputed.value || "-"]) : createVNode(AutoComplete$1, mergeProps({
|
|
38
39
|
"value": valueComputed.value,
|
|
39
40
|
"onUpdate:value": ($event) => valueComputed.value = $event,
|
|
40
|
-
"placeholder":
|
|
41
|
+
"placeholder": locale.value.placeholder.input(formItemProps.value.label)
|
|
41
42
|
}, props.unrefsProps), null)]
|
|
42
43
|
});
|
|
43
44
|
};
|
|
@@ -111,6 +112,7 @@ const Cascader = defineFormItem((props) => {
|
|
|
111
112
|
props
|
|
112
113
|
});
|
|
113
114
|
const formItemProps = useFormItemProps(props.column);
|
|
115
|
+
const locale = useLocale();
|
|
114
116
|
return () => {
|
|
115
117
|
const _props = props.unrefsProps;
|
|
116
118
|
const viewRender = () => {
|
|
@@ -125,7 +127,7 @@ const Cascader = defineFormItem((props) => {
|
|
|
125
127
|
}, [viewRender()]) : createVNode(Cascader$1, mergeProps({
|
|
126
128
|
"value": valueComputed.value,
|
|
127
129
|
"onUpdate:value": ($event) => valueComputed.value = $event,
|
|
128
|
-
"placeholder":
|
|
130
|
+
"placeholder": locale.value.placeholder.select(formItemProps.value.label)
|
|
129
131
|
}, _props), null)]
|
|
130
132
|
});
|
|
131
133
|
};
|
|
@@ -245,6 +247,7 @@ const DatePicker = defineFormItem((props) => {
|
|
|
245
247
|
props
|
|
246
248
|
});
|
|
247
249
|
const formItemProps = useFormItemProps(props.column);
|
|
250
|
+
const locale = useLocale();
|
|
248
251
|
return () => {
|
|
249
252
|
return createVNode(FormItem, formItemProps.value, {
|
|
250
253
|
default: () => [props.isView ? createVNode("div", null, [valueComputed.value || "-"]) : (
|
|
@@ -252,7 +255,7 @@ const DatePicker = defineFormItem((props) => {
|
|
|
252
255
|
createVNode(DatePicker$1, mergeProps({
|
|
253
256
|
"value": valueComputed.value,
|
|
254
257
|
"onUpdate:value": ($event) => valueComputed.value = $event,
|
|
255
|
-
"placeholder":
|
|
258
|
+
"placeholder": locale.value.placeholder.select(formItemProps.value.label)
|
|
256
259
|
}, props.unrefsProps), null)
|
|
257
260
|
)]
|
|
258
261
|
});
|
|
@@ -265,12 +268,13 @@ const DateRangePicker = defineFormItem((props) => {
|
|
|
265
268
|
props
|
|
266
269
|
});
|
|
267
270
|
const formItemProps = useFormItemProps(props.column);
|
|
271
|
+
const locale = useLocale();
|
|
268
272
|
return () => {
|
|
269
273
|
return createVNode(FormItem, formItemProps.value, {
|
|
270
274
|
default: () => [props.isView ? createVNode("div", null, [valueComputed.value ? valueComputed.value.join(" ~ ") : "-"]) : createVNode(DateRangePicker$1, mergeProps({
|
|
271
275
|
"value": valueComputed.value,
|
|
272
276
|
"onUpdate:value": ($event) => valueComputed.value = $event,
|
|
273
|
-
"placeholder":
|
|
277
|
+
"placeholder": locale.value.placeholder.select(formItemProps.value.label)
|
|
274
278
|
}, props.unrefsProps), null)]
|
|
275
279
|
});
|
|
276
280
|
};
|
|
@@ -285,6 +289,7 @@ const Input = defineFormItem((props) => {
|
|
|
285
289
|
props
|
|
286
290
|
});
|
|
287
291
|
const formItemProps = useFormItemProps(props.column);
|
|
292
|
+
const locale = useLocale();
|
|
288
293
|
return () => {
|
|
289
294
|
var _a, _b;
|
|
290
295
|
let _slot;
|
|
@@ -294,7 +299,7 @@ const Input = defineFormItem((props) => {
|
|
|
294
299
|
const inputVNode = createVNode(Input$1, mergeProps({
|
|
295
300
|
"value": valueComputed.value,
|
|
296
301
|
"onUpdate:value": ($event) => valueComputed.value = $event,
|
|
297
|
-
"placeholder":
|
|
302
|
+
"placeholder": locale.value.placeholder.input(formItemProps.value.label)
|
|
298
303
|
}, props.unrefsProps), null);
|
|
299
304
|
if (append || prepend) {
|
|
300
305
|
return createVNode(InputAdornment, {
|
|
@@ -327,12 +332,13 @@ const InputNumber = defineFormItem((props) => {
|
|
|
327
332
|
props
|
|
328
333
|
});
|
|
329
334
|
const formItemProps = useFormItemProps(props.column);
|
|
335
|
+
const locale = useLocale();
|
|
330
336
|
return () => {
|
|
331
337
|
return createVNode(FormItem, formItemProps.value, {
|
|
332
338
|
default: () => [props.isView ? createVNode("div", null, [valueComputed.value || "-"]) : createVNode(InputNumber$1, mergeProps({
|
|
333
339
|
"value": valueComputed.value,
|
|
334
340
|
"onUpdate:value": ($event) => valueComputed.value = $event,
|
|
335
|
-
"placeholder":
|
|
341
|
+
"placeholder": locale.value.placeholder.input(formItemProps.value.label)
|
|
336
342
|
}, props.unrefsProps), null)]
|
|
337
343
|
});
|
|
338
344
|
};
|
|
@@ -347,6 +353,7 @@ const TagInput = defineFormItem((props) => {
|
|
|
347
353
|
props
|
|
348
354
|
});
|
|
349
355
|
const formItemProps = useFormItemProps(props.column);
|
|
356
|
+
const locale = useLocale();
|
|
350
357
|
return () => {
|
|
351
358
|
return createVNode(FormItem, formItemProps.value, {
|
|
352
359
|
default: () => {
|
|
@@ -361,7 +368,7 @@ const TagInput = defineFormItem((props) => {
|
|
|
361
368
|
})) || "-"]) : createVNode(TagInput$1, mergeProps({
|
|
362
369
|
"value": valueComputed.value,
|
|
363
370
|
"onUpdate:value": ($event) => valueComputed.value = $event,
|
|
364
|
-
"placeholder":
|
|
371
|
+
"placeholder": locale.value.placeholder.input(formItemProps.value.label)
|
|
365
372
|
}, props.unrefsProps), null)];
|
|
366
373
|
}
|
|
367
374
|
});
|
|
@@ -492,6 +499,7 @@ const Textarea = defineFormItem((props) => {
|
|
|
492
499
|
props
|
|
493
500
|
});
|
|
494
501
|
const formItemProps = useFormItemProps(props.column);
|
|
502
|
+
const locale = useLocale();
|
|
495
503
|
return () => {
|
|
496
504
|
const viewRender = () => {
|
|
497
505
|
return valueComputed.value ?? "-";
|
|
@@ -500,7 +508,7 @@ const Textarea = defineFormItem((props) => {
|
|
|
500
508
|
default: () => [props.isView ? createVNode("div", null, [viewRender()]) : createVNode(Textarea$1, mergeProps({
|
|
501
509
|
"value": valueComputed.value,
|
|
502
510
|
"onUpdate:value": ($event) => valueComputed.value = $event,
|
|
503
|
-
"placeholder":
|
|
511
|
+
"placeholder": locale.value.placeholder.input(formItemProps.value.label)
|
|
504
512
|
}, props.unrefsProps), null)]
|
|
505
513
|
});
|
|
506
514
|
};
|
|
@@ -631,8 +639,11 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
631
639
|
key: unref(getField)(column),
|
|
632
640
|
column,
|
|
633
641
|
"is-view": _ctx.isView,
|
|
634
|
-
style: normalizeStyle(getStyle(column))
|
|
635
|
-
|
|
642
|
+
style: normalizeStyle(getStyle(column)),
|
|
643
|
+
class: normalizeClass({
|
|
644
|
+
"ftjs-form-is-view": _ctx.isView
|
|
645
|
+
})
|
|
646
|
+
}, null, 8, ["column", "is-view", "style", "class"]);
|
|
636
647
|
}), 128);
|
|
637
648
|
};
|
|
638
649
|
}
|
|
@@ -658,6 +669,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
658
669
|
},
|
|
659
670
|
setup(__props, { expose: __expose }) {
|
|
660
671
|
const props = __props;
|
|
672
|
+
const locale = useLocale();
|
|
661
673
|
const { getFormData, visibleColumns, form, resetToDefault, setAsDefault } = useForm(props);
|
|
662
674
|
const formRef = ref();
|
|
663
675
|
const { rules } = useRules(props);
|
|
@@ -705,9 +717,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
705
717
|
theme: "primary",
|
|
706
718
|
type: "submit"
|
|
707
719
|
}, {
|
|
708
|
-
default: withCtx(() =>
|
|
709
|
-
createTextVNode(
|
|
710
|
-
])
|
|
720
|
+
default: withCtx(() => [
|
|
721
|
+
createTextVNode(toDisplayString(unref(locale).form.submit), 1)
|
|
722
|
+
]),
|
|
711
723
|
_: 1
|
|
712
724
|
})) : createCommentVNode("", true),
|
|
713
725
|
!_ctx.hideReset ? (openBlock(), createBlock(unref(Button), {
|
|
@@ -716,9 +728,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
716
728
|
theme: "danger",
|
|
717
729
|
onClick: _cache[0] || (_cache[0] = () => unref(resetToDefault)())
|
|
718
730
|
}, {
|
|
719
|
-
default: withCtx(() =>
|
|
720
|
-
createTextVNode(
|
|
721
|
-
])
|
|
731
|
+
default: withCtx(() => [
|
|
732
|
+
createTextVNode(toDisplayString(unref(locale).form.reset), 1)
|
|
733
|
+
]),
|
|
722
734
|
_: 1
|
|
723
735
|
})) : createCommentVNode("", true)
|
|
724
736
|
]),
|
|
@@ -730,8 +742,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
730
742
|
};
|
|
731
743
|
}
|
|
732
744
|
});
|
|
733
|
-
const _hoisted_1 = { style: { "
|
|
734
|
-
const _hoisted_2 = { style: { "
|
|
745
|
+
const _hoisted_1 = { style: { "font-size": "12px", "color": "gray" } };
|
|
746
|
+
const _hoisted_2 = { style: { "text-align": "center" } };
|
|
747
|
+
const _hoisted_3 = { style: { "display": "flex", "gap": "10px" } };
|
|
735
748
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
736
749
|
...{
|
|
737
750
|
name: "FtTdFormSearch",
|
|
@@ -751,6 +764,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
751
764
|
},
|
|
752
765
|
setup(__props, { expose: __expose }) {
|
|
753
766
|
const props = __props;
|
|
767
|
+
const locale = useLocale();
|
|
754
768
|
const {
|
|
755
769
|
visibleColumns,
|
|
756
770
|
form,
|
|
@@ -781,7 +795,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
781
795
|
let oldSortList = [];
|
|
782
796
|
const createColumnsTree = () => {
|
|
783
797
|
const treeData = [
|
|
784
|
-
{
|
|
798
|
+
{
|
|
799
|
+
label: locale.value.searchSettings.selectAll,
|
|
800
|
+
value: "__all",
|
|
801
|
+
draggable: false,
|
|
802
|
+
children: []
|
|
803
|
+
}
|
|
785
804
|
];
|
|
786
805
|
const children = [];
|
|
787
806
|
for (const column of props.columns) {
|
|
@@ -860,30 +879,30 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
860
879
|
width: 260,
|
|
861
880
|
destroyOnClose: ""
|
|
862
881
|
}, {
|
|
863
|
-
header: withCtx(() =>
|
|
882
|
+
header: withCtx(() => [
|
|
864
883
|
createElementVNode("span", null, [
|
|
865
|
-
createTextVNode("
|
|
866
|
-
createElementVNode("span",
|
|
867
|
-
]
|
|
868
|
-
])
|
|
884
|
+
createTextVNode(toDisplayString(unref(locale).searchSettings.title) + " ", 1),
|
|
885
|
+
createElementVNode("span", _hoisted_1, toDisplayString(unref(locale).searchSettings.dragHint), 1)
|
|
886
|
+
])
|
|
887
|
+
]),
|
|
869
888
|
footer: withCtx(() => [
|
|
870
|
-
createElementVNode("div",
|
|
889
|
+
createElementVNode("div", _hoisted_2, [
|
|
871
890
|
createVNode(unref(Button), {
|
|
872
891
|
theme: "danger",
|
|
873
892
|
onClick: onReset
|
|
874
893
|
}, {
|
|
875
|
-
default: withCtx(() =>
|
|
876
|
-
createTextVNode(
|
|
877
|
-
])
|
|
894
|
+
default: withCtx(() => [
|
|
895
|
+
createTextVNode(toDisplayString(unref(locale).searchSettings.reset), 1)
|
|
896
|
+
]),
|
|
878
897
|
_: 1
|
|
879
898
|
}),
|
|
880
899
|
createVNode(unref(Button), {
|
|
881
900
|
theme: "primary",
|
|
882
901
|
onClick: onSettingOk
|
|
883
902
|
}, {
|
|
884
|
-
default: withCtx(() =>
|
|
885
|
-
createTextVNode(
|
|
886
|
-
])
|
|
903
|
+
default: withCtx(() => [
|
|
904
|
+
createTextVNode(toDisplayString(unref(locale).searchSettings.save), 1)
|
|
905
|
+
]),
|
|
887
906
|
_: 1
|
|
888
907
|
})
|
|
889
908
|
])
|
|
@@ -928,7 +947,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
928
947
|
}, null, 8, ["columns", "is-view"]),
|
|
929
948
|
createVNode(unref(FormItem), null, {
|
|
930
949
|
default: withCtx(() => [
|
|
931
|
-
createElementVNode("div",
|
|
950
|
+
createElementVNode("div", _hoisted_3, [
|
|
932
951
|
_ctx.cache ? (openBlock(), createBlock(unref(Button), {
|
|
933
952
|
key: 0,
|
|
934
953
|
theme: "primary",
|
|
@@ -939,7 +958,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
939
958
|
createVNode(unref(SettingIcon))
|
|
940
959
|
]),
|
|
941
960
|
default: withCtx(() => [
|
|
942
|
-
|
|
961
|
+
createTextVNode(" " + toDisplayString(unref(locale).form.settings), 1)
|
|
943
962
|
]),
|
|
944
963
|
_: 1
|
|
945
964
|
})) : createCommentVNode("", true),
|
|
@@ -947,18 +966,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
947
966
|
theme: "primary",
|
|
948
967
|
type: "submit"
|
|
949
968
|
}, {
|
|
950
|
-
default: withCtx(() =>
|
|
951
|
-
createTextVNode(
|
|
952
|
-
])
|
|
969
|
+
default: withCtx(() => [
|
|
970
|
+
createTextVNode(toDisplayString(unref(locale).form.search), 1)
|
|
971
|
+
]),
|
|
953
972
|
_: 1
|
|
954
973
|
}),
|
|
955
974
|
createVNode(unref(Button), {
|
|
956
975
|
theme: "danger",
|
|
957
976
|
onClick: _cache[2] || (_cache[2] = () => unref(resetToDefault)())
|
|
958
977
|
}, {
|
|
959
|
-
default: withCtx(() =>
|
|
960
|
-
createTextVNode(
|
|
961
|
-
])
|
|
978
|
+
default: withCtx(() => [
|
|
979
|
+
createTextVNode(toDisplayString(unref(locale).form.reset), 1)
|
|
980
|
+
]),
|
|
962
981
|
_: 1
|
|
963
982
|
})
|
|
964
983
|
])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ftjs/tdesign",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,14 +29,24 @@
|
|
|
29
29
|
"vite": "^6.1.0",
|
|
30
30
|
"vite-plugin-dts": "^4.5.0",
|
|
31
31
|
"vue-tsc": "2.2.0",
|
|
32
|
-
"@ftjs/core": "1.
|
|
32
|
+
"@ftjs/core": "1.3.1"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"vue": ">=3.3.0",
|
|
36
|
-
"@ftjs/core": "^1.
|
|
36
|
+
"@ftjs/core": "^1.3.1",
|
|
37
37
|
"dayjs": ">=1.0.0",
|
|
38
38
|
"tdesign-vue-next": ">=1.11.5"
|
|
39
39
|
},
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public",
|
|
42
|
+
"registry": "https://registry.npmjs.org/",
|
|
43
|
+
"provenance": true
|
|
44
|
+
},
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/yuhengshen/ftjs",
|
|
48
|
+
"directory": "packages/tdesign"
|
|
49
|
+
},
|
|
40
50
|
"scripts": {
|
|
41
51
|
"build": "vite build",
|
|
42
52
|
"minify": "pnpm dlx esbuild ./dist/index.js --minify --outfile=./dist/index.min.js"
|