@ftjs/antd 0.1.0 → 0.1.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.
@@ -10,3 +10,4 @@ export interface EditMap<_TableData extends Record<string, any>> {
10
10
  select: Edit<"select", SelectProps>;
11
11
  }
12
12
  export declare const editMap: Map<keyof EditMap<any>, Component>;
13
+ export declare const registerEdit: (type: keyof EditMap<any>, component: Component) => void;
@@ -92,11 +92,6 @@ interface ExtendedProps<TableData extends Record<string, any>, SearchData extend
92
92
  * @default 210
93
93
  */
94
94
  minHeight?: number;
95
- /**
96
- * 是否隐藏搜索
97
- * @default false
98
- */
99
- hideSearch?: boolean;
100
95
  /**
101
96
  * 是否隐藏分页
102
97
  * @default false
package/dist/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export { registerForm } from './form/register';
3
3
  export type { FormColumn, AntdColumnBase, RegisterColumnMap, } from './form/register';
4
4
  export * from './antd-table/define-table';
5
5
  export * from './vxe-table/define-vxe-table';
6
+ export * from './antd-table/column-edit';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { computed, toValue, createVNode, mergeProps, unref, isVNode, ref, useId, Fragment, createTextVNode, watchEffect, onMounted, onUnmounted, nextTick, reactive, watch, h } from "vue";
2
2
  import { SwapOutlined, SettingOutlined } from "@ant-design/icons-vue";
3
3
  import { getField, defineFormComponent, useFormItem, unrefs, defineFtForm, useFormInject, set, defineFtTable, useTableInject, get, cloneDeep } from "@ftjs/core";
4
- import { FormItem, Input, Select, DatePicker, RangePicker, Radio, Textarea, Upload, Cascader, AutoComplete, CheckboxGroup, InputNumber, Mentions, Rate, Slider, Switch, TreeSelect, Modal, Tree, Button, Form, Table, Spin, Pagination } from "ant-design-vue";
4
+ import { FormItem, Input, Select, DatePicker, RangePicker, Radio, Textarea, Upload, Cascader, AutoComplete, CheckboxGroup, InputNumber, Mentions, Rate, Slider, Switch, TreeSelect, Modal, Tree, Button, Form, Divider, Table, Spin, Pagination } from "ant-design-vue";
5
5
  import dayjs from "dayjs";
6
6
  import { VxeGrid } from "vxe-table";
7
7
  const useFormItemProps = (column) => {
@@ -685,6 +685,9 @@ const editMap = /* @__PURE__ */ new Map([
685
685
  ["input", Input],
686
686
  ["select", Select]
687
687
  ]);
688
+ const registerEdit = (type, component) => {
689
+ editMap.set(type, component);
690
+ };
688
691
  const FtTable = defineFtTable((_p, ctx) => {
689
692
  const {
690
693
  formColumns,
@@ -700,7 +703,6 @@ const FtTable = defineFtTable((_p, ctx) => {
700
703
  initSearch,
701
704
  fitFlexHeight,
702
705
  minHeight,
703
- hideSearch,
704
706
  hidePagination,
705
707
  onSearch,
706
708
  onChange,
@@ -717,7 +719,7 @@ const FtTable = defineFtTable((_p, ctx) => {
717
719
  if (!pagination && !hidePagination.value) {
718
720
  pagination = {
719
721
  page: 1,
720
- pageSize: defaultPageSize.value ?? 20
722
+ pageSize: defaultPageSize.value
721
723
  };
722
724
  }
723
725
  onSearch(formData, {
@@ -745,7 +747,7 @@ const FtTable = defineFtTable((_p, ctx) => {
745
747
  bordered: true,
746
748
  pagination: hidePagination.value ? false : {
747
749
  total: total.value,
748
- defaultPageSize: defaultPageSize.value ?? 20,
750
+ defaultPageSize: defaultPageSize.value,
749
751
  current: currentPage.value,
750
752
  onChange: (page, pageSize) => {
751
753
  currentPage.value = page;
@@ -779,6 +781,7 @@ const FtTable = defineFtTable((_p, ctx) => {
779
781
  };
780
782
  let tableStyle;
781
783
  const containerRef = ref();
784
+ const tableRef = ref();
782
785
  const calcTableHeight = () => {
783
786
  const container = containerRef.value;
784
787
  const table = container == null ? void 0 : container.querySelector(".ant-table-wrapper");
@@ -789,7 +792,7 @@ const FtTable = defineFtTable((_p, ctx) => {
789
792
  let y = table.clientHeight - // pagination不是立即渲染的,其高度为64
790
793
  // 多减去2px,避免出现小数
791
794
  64 - 2 - ((header == null ? void 0 : header.clientHeight) ?? 0) - ((footer == null ? void 0 : footer.clientHeight) ?? 0);
792
- const minHeightValue = minHeight.value ?? 210;
795
+ const minHeightValue = minHeight.value;
793
796
  if (y < minHeightValue) y = minHeightValue;
794
797
  _scrollY.value = y;
795
798
  };
@@ -807,6 +810,7 @@ const FtTable = defineFtTable((_p, ctx) => {
807
810
  let prevHeight;
808
811
  let timer;
809
812
  onMounted(() => {
813
+ var _a;
810
814
  resizeObserver = new ResizeObserver((entries) => {
811
815
  const height = entries[0].contentRect.height;
812
816
  if (prevHeight === height) return;
@@ -818,7 +822,7 @@ const FtTable = defineFtTable((_p, ctx) => {
818
822
  calcTableHeight();
819
823
  }, 100);
820
824
  });
821
- resizeObserver.observe(containerRef.value);
825
+ resizeObserver.observe((_a = tableRef.value) == null ? void 0 : _a.$el);
822
826
  });
823
827
  onUnmounted(() => {
824
828
  resizeObserver.disconnect();
@@ -871,13 +875,17 @@ const FtTable = defineFtTable((_p, ctx) => {
871
875
  return createVNode("div", {
872
876
  "ref": containerRef,
873
877
  "style": containerStyle
874
- }, [!hideSearch.value && createVNode(FtFormSearch, mergeProps({
878
+ }, [formColumns.value.length > 0 && createVNode(Fragment, null, [createVNode(FtFormSearch, mergeProps({
875
879
  "exposed": formExposed.value,
876
880
  "onUpdate:exposed": ($event) => formExposed.value = $event,
877
881
  "cache": cache.value,
878
882
  "columns": formColumns.value,
879
883
  "onSubmit": () => handleSearch()
880
- }, internalFormProps.value), null), (ctx.slots.buttons || ctx.slots.tools) && createVNode("div", null, [(_b = (_a = ctx.slots).buttons) == null ? void 0 : _b.call(_a), (_d = (_c = ctx.slots).tools) == null ? void 0 : _d.call(_c)]), createVNode(Table, mergeProps({
884
+ }, internalFormProps.value), null), createVNode(Divider, {
885
+ "dashed": true,
886
+ "style": "margin: 0"
887
+ }, null)]), (ctx.slots.buttons || ctx.slots.tools) && createVNode("div", null, [(_b = (_a = ctx.slots).buttons) == null ? void 0 : _b.call(_a), (_d = (_c = ctx.slots).tools) == null ? void 0 : _d.call(_c)]), createVNode(Table, mergeProps({
888
+ "ref": tableRef,
881
889
  "style": tableStyle,
882
890
  "columns": columns.value,
883
891
  "loading": loading.value,
@@ -896,11 +904,12 @@ const FtTable = defineFtTable((_p, ctx) => {
896
904
  }, ["onChange", "onExpand", "onExpandedRowsChange", "onResizeColumn", "onSearch", ["initSearch", {
897
905
  type: Boolean,
898
906
  default: true
899
- }], "fitFlexHeight", "minHeight", ["hidePagination", {
907
+ }], "fitFlexHeight", ["minHeight", {
908
+ type: Number,
909
+ default: 210
910
+ }], ["hidePagination", {
900
911
  type: Boolean
901
- }], "exposed", "onUpdate:exposed", ["hideSearch", {
902
- type: Boolean
903
- }]]);
912
+ }], "exposed", "onUpdate:exposed"]);
904
913
  function useEdit(tableData) {
905
914
  const editRowMap = reactive(/* @__PURE__ */ new Map());
906
915
  const createBodyCell = (bodyCellDefault) => {
@@ -986,7 +995,6 @@ const FtVxeTable = defineFtTable((_, ctx) => {
986
995
  initSearch,
987
996
  fitFlexHeight,
988
997
  minHeight,
989
- hideSearch,
990
998
  hidePagination,
991
999
  rowConfig: _rowConfig,
992
1000
  customConfig: _customConfig,
@@ -1005,7 +1013,7 @@ const FtVxeTable = defineFtTable((_, ctx) => {
1005
1013
  if (!pagination && !hidePagination.value) {
1006
1014
  pagination = {
1007
1015
  page: 1,
1008
- pageSize: defaultPageSize.value ?? 20
1016
+ pageSize: defaultPageSize.value
1009
1017
  };
1010
1018
  }
1011
1019
  await onSearch(formData, {
@@ -1138,13 +1146,16 @@ const FtVxeTable = defineFtTable((_, ctx) => {
1138
1146
  return () => createVNode("div", {
1139
1147
  "ref": containerRef,
1140
1148
  "style": containerStyle
1141
- }, [!hideSearch.value && createVNode(FtFormSearch, mergeProps({
1149
+ }, [formColumns.value.length > 0 && createVNode(Fragment, null, [createVNode(FtFormSearch, mergeProps({
1142
1150
  "exposed": formExposed.value,
1143
1151
  "onUpdate:exposed": ($event) => formExposed.value = $event,
1144
1152
  "cache": cache.value,
1145
1153
  "columns": formColumns.value,
1146
1154
  "onSubmit": () => handleSearch()
1147
- }, internalFormProps.value), null), createVNode("div", {
1155
+ }, internalFormProps.value), null), createVNode(Divider, {
1156
+ "dashed": true,
1157
+ "style": "margin: 0"
1158
+ }, null)]), createVNode("div", {
1148
1159
  "style": tableStyle
1149
1160
  }, [createVNode(VxeGrid, mergeProps({
1150
1161
  "ref": (ref2) => tableExposed.value = ref2,
@@ -1172,8 +1183,9 @@ const FtVxeTable = defineFtTable((_, ctx) => {
1172
1183
  "onUpdate:current": ($event) => current.value = $event,
1173
1184
  "showQuickJumper": true,
1174
1185
  "showSizeChanger": true,
1186
+ "showLessItems": true,
1175
1187
  "total": total.value,
1176
- "defaultPageSize": defaultPageSize.value ?? 20,
1188
+ "defaultPageSize": defaultPageSize.value,
1177
1189
  "showTotal": (total2) => {
1178
1190
  if (total2 === 0) return null;
1179
1191
  return `共 ${total2} 条数据`;
@@ -1198,14 +1210,14 @@ const FtVxeTable = defineFtTable((_, ctx) => {
1198
1210
  default: true
1199
1211
  }], "fitFlexHeight", "minHeight", ["hidePagination", {
1200
1212
  type: Boolean
1201
- }], "exposed", "onUpdate:exposed", ["hideSearch", {
1202
- type: Boolean
1203
- }], "rowConfig", "treeConfig", "customConfig", "toolbarConfig", "columnConfig"]);
1213
+ }], "exposed", "onUpdate:exposed", "rowConfig", "treeConfig", "customConfig", "toolbarConfig", "columnConfig"]);
1204
1214
  export {
1205
1215
  FtForm,
1206
1216
  FtFormSearch,
1207
1217
  FtTable,
1208
1218
  FtVxeTable,
1219
+ editMap,
1220
+ registerEdit,
1209
1221
  registerForm,
1210
1222
  useRules
1211
1223
  };
@@ -92,11 +92,6 @@ interface VxeExtendedProps<TableData extends Record<string, any>, SearchData ext
92
92
  * vxe-table 列配置
93
93
  */
94
94
  columnConfig?: VxeGridProps<TableData>["columnConfig"];
95
- /**
96
- * 是否隐藏搜索
97
- * @default false
98
- */
99
- hideSearch?: boolean;
100
95
  /**
101
96
  * 是否隐藏分页
102
97
  * @default false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ftjs/antd",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "keywords": [],
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -23,14 +23,14 @@
23
23
  "dayjs": "^1.11.13",
24
24
  "vue": "^3.5.13",
25
25
  "vue-component-type-helpers": "^2.2.0",
26
- "vxe-table": "4.11.10",
26
+ "vxe-table": "4.11.15",
27
27
  "@vitejs/plugin-vue": "^5.2.1",
28
28
  "@vitejs/plugin-vue-jsx": "^4.1.1",
29
29
  "typescript": "^5.7.3",
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.1.0"
33
+ "@ftjs/core": "0.1.1"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@ant-design/icons-vue": ">=7.0.0",