@ftjs/antd 0.4.3 → 0.5.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.
@@ -1,15 +1,12 @@
1
- import { ValueOf, FtBaseTableProps, FtTableColumn } from '@ftjs/core';
1
+ import { ValueOf, ExtractColumnType, FtBaseTableProps, FtTableColumn } from '@ftjs/core';
2
2
  import { TableColumnType, TableProps as AntTableProps } from 'ant-design-vue';
3
- import { FtAntdFormSearchProps } from '../form/define-form';
3
+ import { FtAntdFormSearchProps } from '../form';
4
4
  import { FtAntdFormColumn } from '../form/register';
5
5
  import { EditMap } from './column-edit';
6
- type ExtractType<T> = T extends {
7
- type: infer U;
8
- } ? U : never;
9
6
  /**
10
7
  * 列定义
11
8
  */
12
- export interface FtAntdTableColumn<T extends Record<string, any>, S extends Record<string, any>> extends FtTableColumn<T, FtAntdFormColumn<S> | ExtractType<FtAntdFormColumn<S>>>, Omit<TableColumnType<T>, "title" | "dataIndex"> {
9
+ export interface FtAntdTableColumn<T extends Record<string, any>, S extends Record<string, any>> extends FtTableColumn<T, FtAntdFormColumn<S> | ExtractColumnType<FtAntdFormColumn<S>>>, Omit<TableColumnType<T>, "title" | "dataIndex"> {
13
10
  /**
14
11
  * 行内编辑
15
12
  */
@@ -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
+ } & {};
@@ -1,4 +1,4 @@
1
- import { FtAntdFormSearchProps } from './define-form';
1
+ import { FtAntdFormSearchProps } from './index';
2
2
  import { FormInstance } from 'ant-design-vue';
3
3
  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<{
4
4
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & FtAntdFormSearchProps<F> & Partial<{}>> & import('vue').PublicProps;
@@ -1,4 +1,4 @@
1
- import { FtAntdFormProps } from './define-form';
1
+ import { FtAntdFormProps } from './index';
2
2
  import { FormInstance } from 'ant-design-vue';
3
3
  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<{
4
4
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & FtAntdFormProps<F> & Partial<{}>> & import('vue').PublicProps;
@@ -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.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from './form/define-form';
1
+ export * from './form';
2
2
  export { registerForm, defineFormItem } from './form/register';
3
3
  export type { FtAntdFormColumn, AntdColumnBase, RegisterColumnMap, } from './form/register';
4
4
  export * from './vxe-table';
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
  }
@@ -1543,9 +1571,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1543
1571
  ..._ctx.$attrs,
1544
1572
  ...internalTableProps.value
1545
1573
  }), createSlots({
1546
- pager: withCtx(() => [_ctx.$slots.pager ? renderSlot(_ctx.$slots, "pager", {
1574
+ pager: withCtx((slotData) => [_ctx.$slots.pager ? renderSlot(_ctx.$slots, "pager", normalizeProps(mergeProps({
1547
1575
  key: 0
1548
- }) : !_ctx.hidePagination ? (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(unref(Pagination), {
1576
+ }, slotData))) : !_ctx.hidePagination ? (openBlock(), createElementBlock("div", _hoisted_1, [createVNode(unref(Pagination), {
1549
1577
  current: current.value,
1550
1578
  "onUpdate:current": _cache[0] || (_cache[0] = ($event) => current.value = $event),
1551
1579
  pageSize: pageSize.value,
@@ -1560,9 +1588,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1560
1588
  return (_a = _ctx.onSearch) == null ? void 0 : _a.call(_ctx);
1561
1589
  })
1562
1590
  }, null, 8, ["current", "pageSize", "total", "defaultPageSize"])])) : createCommentVNode("", true)]),
1563
- loading: withCtx(() => [_ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", {
1591
+ loading: withCtx((slotData) => [_ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", normalizeProps(mergeProps({
1564
1592
  key: 0
1565
- }) : (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(unref(Spin))]))]),
1593
+ }, slotData))) : (openBlock(), createElementBlock("div", _hoisted_2, [createVNode(unref(Spin))]))]),
1566
1594
  _: 2
1567
1595
  }, [renderList(_ctx.$slots, (_, name) => {
1568
1596
  return {
@@ -1,5 +1,5 @@
1
1
  import { FtVxeTableProps } from './types';
2
- import { VxeGridInstance } from 'vxe-table';
2
+ import { VxeGridInstance, VxeGridSlots } from 'vxe-table';
3
3
  declare const _default: <T extends Record<string, any>, S 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<{
4
4
  props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, never> & FtVxeTableProps<T, S> & Partial<{}>> & import('vue').PublicProps;
5
5
  expose(exposed: import('vue').ShallowUnwrapRef<{
@@ -34,60 +34,7 @@ declare const _default: <T extends Record<string, any>, S extends Record<string,
34
34
  refresh: () => Promise<void>;
35
35
  }>): void;
36
36
  attrs: any;
37
- slots: {
38
- [x: string]: ((props: {
39
- [key: string]: any;
40
- $table: import('vxe-table').VxeTableConstructor<any>;
41
- $grid: import('vxe-table').VxeGridConstructor<any> | null | undefined;
42
- rowid: string;
43
- row: any;
44
- rowIndex: number;
45
- $rowIndex: number;
46
- _rowIndex: number;
47
- column: import("vxe-table").VxeTableDefines.ColumnInfo<any>;
48
- columnIndex: number;
49
- $columnIndex: number;
50
- _columnIndex: number;
51
- type: string;
52
- fixed: import("vxe-table").VxeColumnPropTypes.Fixed;
53
- checked?: boolean;
54
- indeterminate?: boolean;
55
- seq: string | number;
56
- level: number;
57
- isEdit: boolean;
58
- isHidden: boolean;
59
- visibleData: any[];
60
- data: any[];
61
- items: any[];
62
- }) => any) | undefined;
63
- [x: number]: ((props: {
64
- [key: string]: any;
65
- $table: import('vxe-table').VxeTableConstructor<any>;
66
- $grid: import('vxe-table').VxeGridConstructor<any> | null | undefined;
67
- rowid: string;
68
- row: any;
69
- rowIndex: number;
70
- $rowIndex: number;
71
- _rowIndex: number;
72
- column: import("vxe-table").VxeTableDefines.ColumnInfo<any>;
73
- columnIndex: number;
74
- $columnIndex: number;
75
- _columnIndex: number;
76
- type: string;
77
- fixed: import("vxe-table").VxeColumnPropTypes.Fixed;
78
- checked?: boolean;
79
- indeterminate?: boolean;
80
- seq: string | number;
81
- level: number;
82
- isEdit: boolean;
83
- isHidden: boolean;
84
- visibleData: any[];
85
- data: any[];
86
- items: any[];
87
- }) => any) | undefined;
88
- pager?: ((props: {}) => any) | undefined;
89
- loading?: ((props: {}) => any) | undefined;
90
- };
37
+ slots: VxeGridSlots<any>;
91
38
  emit: {};
92
39
  }>) => import('vue').VNode & {
93
40
  __ctx?: Awaited<typeof __VLS_setup>;
@@ -1,15 +1,12 @@
1
- import { FtBaseTableProps, FtTableColumn, ValueOf } from '@ftjs/core';
1
+ import { ExtractColumnType, FtBaseTableProps, FtTableColumn, ValueOf } from '@ftjs/core';
2
2
  import { VxeGridProps, VxeGridPropTypes } from 'vxe-table';
3
- import { FtAntdFormSearchProps } from '../form/define-form';
3
+ import { FtAntdFormSearchProps } from '../form';
4
4
  import { FtAntdFormColumn } from '../form/register';
5
5
  import { EditMap } from '../antd-table/column-edit';
6
- type ExtractType<T> = T extends {
7
- type: infer U;
8
- } ? U : never;
9
6
  /**
10
7
  * 列定义
11
8
  */
12
- type VxeTableColumn<T extends Record<string, any>, S extends Record<string, any>> = FtTableColumn<T, FtAntdFormColumn<S> | ExtractType<FtAntdFormColumn<S>>> & Omit<VxeGridPropTypes.Column<T>, "title" | "editRender"> & {
9
+ type VxeTableColumn<T extends Record<string, any>, S extends Record<string, any>> = FtTableColumn<T, FtAntdFormColumn<S> | ExtractColumnType<FtAntdFormColumn<S>>> & Omit<VxeGridPropTypes.Column<T>, "title" | "editRender"> & {
13
10
  /**
14
11
  * 行内编辑
15
12
  */
@@ -46,6 +43,6 @@ export interface FtVxeTableProps<T extends Record<string, any>, S extends Record
46
43
  hidePagination?: boolean;
47
44
  internalTableProps?: InternalVxeTableProps<T>;
48
45
  internalFormProps?: FtAntdFormSearchProps<S>;
49
- onSearch: () => Promise<void> | void;
46
+ onSearch?: () => Promise<void> | void;
50
47
  }
51
48
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ftjs/antd",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
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.3"
33
+ "@ftjs/core": "0.5.0"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@ant-design/icons-vue": ">=7.0.0",
File without changes