@ftjs/antd 0.4.5 → 0.5.1

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.
@@ -0,0 +1,17 @@
1
+ import { FtAntdFormColumn } from './register';
2
+ declare const _default: <F extends Record<string, any>>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
3
+ props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & {
4
+ column: FtAntdFormColumn<F>;
5
+ isView?: boolean;
6
+ } & Partial<{}>> & import('vue').PublicProps;
7
+ expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
8
+ attrs: any;
9
+ slots: {};
10
+ emit: {};
11
+ }>) => import('vue').VNode & {
12
+ __ctx?: Awaited<typeof __VLS_setup>;
13
+ };
14
+ export default _default;
15
+ type __VLS_PrettifyLocal<T> = {
16
+ [K in keyof T]: T[K];
17
+ } & {};
@@ -9,7 +9,9 @@ declare const _default: <F extends Record<string, any>>(__VLS_props: NonNullable
9
9
  setAsDefault: import('@ftjs/core').SetAsDefault<F>;
10
10
  }>): void;
11
11
  attrs: any;
12
- slots: {};
12
+ slots: {
13
+ footer?: ((props: {}) => any) | undefined;
14
+ };
13
15
  emit: {};
14
16
  }>) => import('vue').VNode & {
15
17
  __ctx?: Awaited<typeof __VLS_setup>;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { getField, useFormItem, unrefs, useForm, set, get, cloneDeep, useTable } from "@ftjs/core";
2
- import { computed, toValue, createVNode, mergeProps, unref, createTextVNode, isVNode, defineComponent, createElementBlock, openBlock, Fragment, renderList, createBlock, resolveDynamicComponent, ref, useId, withCtx, createCommentVNode, createElementVNode, toDisplayString, reactive, watch, h, onMounted, onUnmounted, useTemplateRef, nextTick, normalizeStyle, renderSlot, createSlots, normalizeProps } from "vue";
1
+ import { getField, useFormItem, unrefs, useFormInject, useForm, set, get, cloneDeep, useTable } from "@ftjs/core";
2
+ import { computed, toValue, createVNode, mergeProps, unref, createTextVNode, isVNode, defineComponent, createBlock, openBlock, resolveDynamicComponent, createElementBlock, Fragment, renderList, ref, useId, withCtx, renderSlot, createCommentVNode, createElementVNode, toDisplayString, reactive, watch, h, onMounted, onUnmounted, useTemplateRef, nextTick, 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, Table, Spin, Pagination } from "ant-design-vue";
4
4
  import dayjs from "dayjs";
5
5
  import { SwapOutlined, SettingOutlined } from "@ant-design/icons-vue";
@@ -487,6 +487,37 @@ const formRenderMap = /* @__PURE__ */ new Map([["input", input], ["textarea", te
487
487
  function registerForm(type, Component) {
488
488
  formRenderMap.set(type, Component);
489
489
  }
490
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
491
+ ...{
492
+ name: "FtAntdFormContentItem",
493
+ inheritAttrs: false
494
+ },
495
+ __name: "form-content-item",
496
+ props: {
497
+ column: {},
498
+ isView: { type: Boolean }
499
+ },
500
+ setup(__props) {
501
+ const props = __props;
502
+ const { form } = useFormInject();
503
+ const isView = computed(() => {
504
+ return toValue(props.column.isView) ?? props.isView;
505
+ });
506
+ return (_ctx, _cache) => {
507
+ return isView.value && _ctx.column.viewRender ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.column.viewRender), {
508
+ key: 0,
509
+ formData: unref(form)
510
+ }, null, 8, ["formData"])) : !isView.value && _ctx.column.editRender ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.column.editRender), {
511
+ key: 1,
512
+ formData: unref(form)
513
+ }, null, 8, ["formData"])) : (openBlock(), createBlock(resolveDynamicComponent(unref(formRenderMap).get(_ctx.column.type)), {
514
+ key: 2,
515
+ column: _ctx.column,
516
+ "is-view": isView.value
517
+ }, null, 8, ["column", "is-view"]));
518
+ };
519
+ }
520
+ });
490
521
  const _sfc_main$4 = /* @__PURE__ */ defineComponent({
491
522
  ...{
492
523
  name: "FtAntdFormContent",
@@ -498,16 +529,12 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
498
529
  isView: { type: Boolean }
499
530
  },
500
531
  setup(__props) {
501
- const props = __props;
502
- const isView = (column) => {
503
- return toValue(column.isView) ?? props.isView;
504
- };
505
532
  return (_ctx, _cache) => {
506
533
  return openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columns, (column) => {
507
- return openBlock(), createBlock(resolveDynamicComponent(unref(formRenderMap).get(column.type)), {
534
+ return openBlock(), createBlock(_sfc_main$5, {
508
535
  key: unref(getField)(column),
509
536
  column,
510
- "is-view": isView(column)
537
+ "is-view": _ctx.isView
511
538
  }, null, 8, ["column", "is-view"]);
512
539
  }), 128);
513
540
  };
@@ -574,7 +601,8 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
574
601
  columns: unref(visibleColumns),
575
602
  "is-view": _ctx.isView
576
603
  }, null, 8, ["columns", "is-view"]),
577
- !_ctx.hideFooter ? (openBlock(), createBlock(unref(FormItem), {
604
+ renderSlot(_ctx.$slots, "footer"),
605
+ !_ctx.hideFooter && !_ctx.$slots.footer && !_ctx.isView ? (openBlock(), createBlock(unref(FormItem), {
578
606
  key: 0,
579
607
  label: " ",
580
608
  colon: false
@@ -606,7 +634,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
606
634
  _: 1
607
635
  })) : createCommentVNode("", true)
608
636
  ]),
609
- _: 1
637
+ _: 3
610
638
  }, 16, ["name", "style"]);
611
639
  };
612
640
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ftjs/antd",
3
- "version": "0.4.5",
3
+ "version": "0.5.1",
4
4
  "keywords": [],
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "vite": "^6.1.0",
31
31
  "vite-plugin-dts": "^4.5.0",
32
32
  "vue-tsc": "2.2.0",
33
- "@ftjs/core": "0.4.5"
33
+ "@ftjs/core": "0.5.1"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@ant-design/icons-vue": ">=7.0.0",