@ftjs/tdesign 1.2.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 +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, 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
|
};
|
|
@@ -658,6 +666,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
658
666
|
},
|
|
659
667
|
setup(__props, { expose: __expose }) {
|
|
660
668
|
const props = __props;
|
|
669
|
+
const locale = useLocale();
|
|
661
670
|
const { getFormData, visibleColumns, form, resetToDefault, setAsDefault } = useForm(props);
|
|
662
671
|
const formRef = ref();
|
|
663
672
|
const { rules } = useRules(props);
|
|
@@ -705,9 +714,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
705
714
|
theme: "primary",
|
|
706
715
|
type: "submit"
|
|
707
716
|
}, {
|
|
708
|
-
default: withCtx(() =>
|
|
709
|
-
createTextVNode(
|
|
710
|
-
])
|
|
717
|
+
default: withCtx(() => [
|
|
718
|
+
createTextVNode(toDisplayString(unref(locale).form.submit), 1)
|
|
719
|
+
]),
|
|
711
720
|
_: 1
|
|
712
721
|
})) : createCommentVNode("", true),
|
|
713
722
|
!_ctx.hideReset ? (openBlock(), createBlock(unref(Button), {
|
|
@@ -716,9 +725,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
716
725
|
theme: "danger",
|
|
717
726
|
onClick: _cache[0] || (_cache[0] = () => unref(resetToDefault)())
|
|
718
727
|
}, {
|
|
719
|
-
default: withCtx(() =>
|
|
720
|
-
createTextVNode(
|
|
721
|
-
])
|
|
728
|
+
default: withCtx(() => [
|
|
729
|
+
createTextVNode(toDisplayString(unref(locale).form.reset), 1)
|
|
730
|
+
]),
|
|
722
731
|
_: 1
|
|
723
732
|
})) : createCommentVNode("", true)
|
|
724
733
|
]),
|
|
@@ -730,8 +739,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
730
739
|
};
|
|
731
740
|
}
|
|
732
741
|
});
|
|
733
|
-
const _hoisted_1 = { style: { "
|
|
734
|
-
const _hoisted_2 = { style: { "
|
|
742
|
+
const _hoisted_1 = { style: { "font-size": "12px", "color": "gray" } };
|
|
743
|
+
const _hoisted_2 = { style: { "text-align": "center" } };
|
|
744
|
+
const _hoisted_3 = { style: { "display": "flex", "gap": "10px" } };
|
|
735
745
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
736
746
|
...{
|
|
737
747
|
name: "FtTdFormSearch",
|
|
@@ -751,6 +761,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
751
761
|
},
|
|
752
762
|
setup(__props, { expose: __expose }) {
|
|
753
763
|
const props = __props;
|
|
764
|
+
const locale = useLocale();
|
|
754
765
|
const {
|
|
755
766
|
visibleColumns,
|
|
756
767
|
form,
|
|
@@ -781,7 +792,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
781
792
|
let oldSortList = [];
|
|
782
793
|
const createColumnsTree = () => {
|
|
783
794
|
const treeData = [
|
|
784
|
-
{
|
|
795
|
+
{
|
|
796
|
+
label: locale.value.searchSettings.selectAll,
|
|
797
|
+
value: "__all",
|
|
798
|
+
draggable: false,
|
|
799
|
+
children: []
|
|
800
|
+
}
|
|
785
801
|
];
|
|
786
802
|
const children = [];
|
|
787
803
|
for (const column of props.columns) {
|
|
@@ -860,30 +876,30 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
860
876
|
width: 260,
|
|
861
877
|
destroyOnClose: ""
|
|
862
878
|
}, {
|
|
863
|
-
header: withCtx(() =>
|
|
879
|
+
header: withCtx(() => [
|
|
864
880
|
createElementVNode("span", null, [
|
|
865
|
-
createTextVNode("
|
|
866
|
-
createElementVNode("span",
|
|
867
|
-
]
|
|
868
|
-
])
|
|
881
|
+
createTextVNode(toDisplayString(unref(locale).searchSettings.title) + " ", 1),
|
|
882
|
+
createElementVNode("span", _hoisted_1, toDisplayString(unref(locale).searchSettings.dragHint), 1)
|
|
883
|
+
])
|
|
884
|
+
]),
|
|
869
885
|
footer: withCtx(() => [
|
|
870
|
-
createElementVNode("div",
|
|
886
|
+
createElementVNode("div", _hoisted_2, [
|
|
871
887
|
createVNode(unref(Button), {
|
|
872
888
|
theme: "danger",
|
|
873
889
|
onClick: onReset
|
|
874
890
|
}, {
|
|
875
|
-
default: withCtx(() =>
|
|
876
|
-
createTextVNode(
|
|
877
|
-
])
|
|
891
|
+
default: withCtx(() => [
|
|
892
|
+
createTextVNode(toDisplayString(unref(locale).searchSettings.reset), 1)
|
|
893
|
+
]),
|
|
878
894
|
_: 1
|
|
879
895
|
}),
|
|
880
896
|
createVNode(unref(Button), {
|
|
881
897
|
theme: "primary",
|
|
882
898
|
onClick: onSettingOk
|
|
883
899
|
}, {
|
|
884
|
-
default: withCtx(() =>
|
|
885
|
-
createTextVNode(
|
|
886
|
-
])
|
|
900
|
+
default: withCtx(() => [
|
|
901
|
+
createTextVNode(toDisplayString(unref(locale).searchSettings.save), 1)
|
|
902
|
+
]),
|
|
887
903
|
_: 1
|
|
888
904
|
})
|
|
889
905
|
])
|
|
@@ -928,7 +944,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
928
944
|
}, null, 8, ["columns", "is-view"]),
|
|
929
945
|
createVNode(unref(FormItem), null, {
|
|
930
946
|
default: withCtx(() => [
|
|
931
|
-
createElementVNode("div",
|
|
947
|
+
createElementVNode("div", _hoisted_3, [
|
|
932
948
|
_ctx.cache ? (openBlock(), createBlock(unref(Button), {
|
|
933
949
|
key: 0,
|
|
934
950
|
theme: "primary",
|
|
@@ -939,7 +955,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
939
955
|
createVNode(unref(SettingIcon))
|
|
940
956
|
]),
|
|
941
957
|
default: withCtx(() => [
|
|
942
|
-
|
|
958
|
+
createTextVNode(" " + toDisplayString(unref(locale).form.settings), 1)
|
|
943
959
|
]),
|
|
944
960
|
_: 1
|
|
945
961
|
})) : createCommentVNode("", true),
|
|
@@ -947,18 +963,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
947
963
|
theme: "primary",
|
|
948
964
|
type: "submit"
|
|
949
965
|
}, {
|
|
950
|
-
default: withCtx(() =>
|
|
951
|
-
createTextVNode(
|
|
952
|
-
])
|
|
966
|
+
default: withCtx(() => [
|
|
967
|
+
createTextVNode(toDisplayString(unref(locale).form.search), 1)
|
|
968
|
+
]),
|
|
953
969
|
_: 1
|
|
954
970
|
}),
|
|
955
971
|
createVNode(unref(Button), {
|
|
956
972
|
theme: "danger",
|
|
957
973
|
onClick: _cache[2] || (_cache[2] = () => unref(resetToDefault)())
|
|
958
974
|
}, {
|
|
959
|
-
default: withCtx(() =>
|
|
960
|
-
createTextVNode(
|
|
961
|
-
])
|
|
975
|
+
default: withCtx(() => [
|
|
976
|
+
createTextVNode(toDisplayString(unref(locale).form.reset), 1)
|
|
977
|
+
]),
|
|
962
978
|
_: 1
|
|
963
979
|
})
|
|
964
980
|
])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ftjs/tdesign",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.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"
|