@ftjs/antd 1.4.0 → 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.
Files changed (2) hide show
  1. package/dist/index.js +62 -44
  2. package/package.json +3 -3
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, toDisplayString, createElementVNode, onMounted, h, useTemplateRef, normalizeStyle, createSlots, normalizeProps } from "vue";
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, normalizeClass, 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 = `请输入${formItemProps.value.label}`;
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 `请选择${formItemProps.value.label}`;
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 = `请输入${formItemProps.value.label}`;
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 = `请选择${formItemProps.value.label}`;
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": `请输入${formItemProps.value.label}`,
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": `请输入${formItemProps.value.label}`
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 = `请输入${formItemProps.value.label}`;
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
@@ -489,8 +496,7 @@ function registerForm(type, Component) {
489
496
  }
490
497
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
491
498
  ...{
492
- name: "FtAntdFormContentItem",
493
- inheritAttrs: false
499
+ name: "FtAntdFormContentItem"
494
500
  },
495
501
  __name: "form-content-item",
496
502
  props: {
@@ -534,8 +540,11 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
534
540
  return openBlock(), createBlock(_sfc_main$4, {
535
541
  key: unref(getField)(column),
536
542
  column,
537
- "is-view": _ctx.isView
538
- }, null, 8, ["column", "is-view"]);
543
+ "is-view": _ctx.isView,
544
+ class: normalizeClass({
545
+ "ftjs-form-is-view": _ctx.isView
546
+ })
547
+ }, null, 8, ["column", "is-view", "class"]);
539
548
  }), 128);
540
549
  };
541
550
  }
@@ -551,18 +560,19 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
551
560
  hideFooter: { type: Boolean },
552
561
  hideConfirm: { type: Boolean },
553
562
  hideReset: { type: Boolean },
554
- confirmText: { default: "确认" },
555
- resetText: { default: "重置" },
563
+ confirmText: {},
564
+ resetText: {},
556
565
  columns: {},
557
566
  internalFormProps: {},
558
567
  formData: {},
559
- "onUpdate:formData": {},
560
- onSubmit: {},
568
+ "onUpdate:formData": { type: Function },
569
+ onSubmit: { type: Function },
561
570
  isView: { type: Boolean },
562
571
  cache: {}
563
572
  },
564
573
  setup(__props, { expose: __expose }) {
565
574
  const props = __props;
575
+ const locale = useLocale();
566
576
  const { getFormData, visibleColumns, form, resetToDefault, setAsDefault } = useForm(props);
567
577
  const { rules } = useRules(props);
568
578
  const formRef = ref();
@@ -616,7 +626,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
616
626
  htmlType: "submit"
617
627
  }, {
618
628
  default: withCtx(() => [
619
- createTextVNode(toDisplayString(_ctx.confirmText), 1)
629
+ createTextVNode(toDisplayString(_ctx.confirmText ?? unref(locale).form.submit), 1)
620
630
  ]),
621
631
  _: 1
622
632
  })) : createCommentVNode("", true),
@@ -628,7 +638,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
628
638
  onClick: _cache[0] || (_cache[0] = () => unref(resetToDefault)())
629
639
  }, {
630
640
  default: withCtx(() => [
631
- createTextVNode(toDisplayString(_ctx.resetText), 1)
641
+ createTextVNode(toDisplayString(_ctx.resetText ?? unref(locale).form.reset), 1)
632
642
  ]),
633
643
  _: 1
634
644
  })) : createCommentVNode("", true)
@@ -641,9 +651,10 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
641
651
  };
642
652
  }
643
653
  });
644
- const _hoisted_1$1 = { style: { "text-align": "center" } };
645
- const _hoisted_2$1 = { style: { "display": "flex" } };
646
- const _hoisted_3 = { style: { "display": "flex", "gap": "10px" } };
654
+ const _hoisted_1$1 = { style: { "font-size": "12px", "color": "gray" } };
655
+ const _hoisted_2$1 = { style: { "text-align": "center" } };
656
+ const _hoisted_3 = { style: { "display": "flex" } };
657
+ const _hoisted_4 = { style: { "display": "flex", "gap": "10px" } };
647
658
  const _sfc_main$1 = /* @__PURE__ */ defineComponent({
648
659
  ...{
649
660
  name: "FtAntdFormSearch",
@@ -661,6 +672,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
661
672
  },
662
673
  setup(__props, { expose: __expose }) {
663
674
  const props = __props;
675
+ const locale = useLocale();
664
676
  const {
665
677
  visibleColumns,
666
678
  form,
@@ -701,7 +713,13 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
701
713
  const settingModal = ref(false);
702
714
  let oldSortList = [];
703
715
  const createColumnsTree = () => {
704
- const treeData = [{ title: "全选", key: "__all", children: [] }];
716
+ const treeData = [
717
+ {
718
+ title: locale.value.searchSettings.selectAll,
719
+ key: "__all",
720
+ children: []
721
+ }
722
+ ];
705
723
  const children = [];
706
724
  for (const column of props.columns) {
707
725
  const key = getField(column);
@@ -782,31 +800,31 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
782
800
  maskClosable: false,
783
801
  destroyOnClose: ""
784
802
  }, {
785
- title: withCtx(() => _cache[3] || (_cache[3] = [
803
+ title: withCtx(() => [
786
804
  createElementVNode("span", null, [
787
- createTextVNode(" 配置筛选项 "),
788
- createElementVNode("span", { style: { "font-size": "12px", "color": "gray" } }, " (可拖动排序) ")
789
- ], -1)
790
- ])),
805
+ createTextVNode(toDisplayString(unref(locale).searchSettings.title) + " ", 1),
806
+ createElementVNode("span", _hoisted_1$1, toDisplayString(unref(locale).searchSettings.dragHint), 1)
807
+ ])
808
+ ]),
791
809
  footer: withCtx(() => [
792
- createElementVNode("div", _hoisted_1$1, [
810
+ createElementVNode("div", _hoisted_2$1, [
793
811
  createVNode(unref(Button), {
794
812
  type: "primary",
795
813
  danger: "",
796
814
  onClick: onCancel
797
815
  }, {
798
- default: withCtx(() => _cache[4] || (_cache[4] = [
799
- createTextVNode(" 重置 ")
800
- ])),
816
+ default: withCtx(() => [
817
+ createTextVNode(toDisplayString(unref(locale).searchSettings.reset), 1)
818
+ ]),
801
819
  _: 1
802
820
  }),
803
821
  createVNode(unref(Button), {
804
822
  type: "primary",
805
823
  onClick: onSettingOk
806
824
  }, {
807
- default: withCtx(() => _cache[5] || (_cache[5] = [
808
- createTextVNode(" 保存 ")
809
- ])),
825
+ default: withCtx(() => [
826
+ createTextVNode(toDisplayString(unref(locale).searchSettings.save), 1)
827
+ ]),
810
828
  _: 1
811
829
  })
812
830
  ])
@@ -826,7 +844,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
826
844
  onDrop
827
845
  }, {
828
846
  title: withCtx((node) => [
829
- createElementVNode("div", _hoisted_2$1, [
847
+ createElementVNode("div", _hoisted_3, [
830
848
  createElementVNode("span", null, toDisplayString(node.title), 1),
831
849
  node.key !== "__all" ? (openBlock(), createBlock(unref(SwapOutlined), {
832
850
  key: 0,
@@ -853,7 +871,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
853
871
  }, null, 8, ["columns", "is-view"]),
854
872
  createVNode(unref(FormItem), { style: { "--ft-form-control-width": "220px" } }, {
855
873
  default: withCtx(() => [
856
- createElementVNode("div", _hoisted_3, [
874
+ createElementVNode("div", _hoisted_4, [
857
875
  _ctx.cache ? (openBlock(), createBlock(unref(Button), {
858
876
  key: 0,
859
877
  onClick: setting
@@ -862,7 +880,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
862
880
  createVNode(unref(SettingOutlined))
863
881
  ]),
864
882
  default: withCtx(() => [
865
- _cache[6] || (_cache[6] = createTextVNode(" 配置 "))
883
+ createTextVNode(" " + toDisplayString(unref(locale).form.settings), 1)
866
884
  ]),
867
885
  _: 1
868
886
  })) : createCommentVNode("", true),
@@ -870,9 +888,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
870
888
  type: "primary",
871
889
  htmlType: "submit"
872
890
  }, {
873
- default: withCtx(() => _cache[7] || (_cache[7] = [
874
- createTextVNode(" 查询 ")
875
- ])),
891
+ default: withCtx(() => [
892
+ createTextVNode(toDisplayString(unref(locale).form.search), 1)
893
+ ]),
876
894
  _: 1
877
895
  }),
878
896
  createVNode(unref(Button), {
@@ -881,9 +899,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
881
899
  htmlType: "reset",
882
900
  onClick: _cache[2] || (_cache[2] = () => unref(resetToDefault)())
883
901
  }, {
884
- default: withCtx(() => _cache[8] || (_cache[8] = [
885
- createTextVNode(" 重置 ")
886
- ])),
902
+ default: withCtx(() => [
903
+ createTextVNode(toDisplayString(unref(locale).form.reset), 1)
904
+ ]),
887
905
  _: 1
888
906
  })
889
907
  ])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ftjs/antd",
3
- "version": "1.4.0",
3
+ "version": "2.1.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.2.1"
33
+ "@ftjs/core": "1.3.1"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@ant-design/icons-vue": ">=7.0.0",
37
37
  "vue": ">=3.3.0",
38
- "@ftjs/core": "^1.2.1",
38
+ "@ftjs/core": "^1.3.1",
39
39
  "ant-design-vue": ">=4.0.0",
40
40
  "dayjs": ">=1.0.0",
41
41
  "vxe-table": ">=4.0.0"