fast-element-plus 2.0.18 → 2.0.20

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 (130) hide show
  1. package/CHANGELOG.md +52 -19
  2. package/CONTRIBUTING.md +3 -4
  3. package/README.md +80 -27
  4. package/README.zh.md +66 -27
  5. package/dist/component.d.ts +123 -123
  6. package/dist/components/avatar/src/avatar.d.ts +26 -26
  7. package/dist/components/avatar/src/avatar.mjs +10 -10
  8. package/dist/components/avatar/src/avatar.mjs.map +1 -1
  9. package/dist/components/button/src/button.d.ts +32 -27
  10. package/dist/components/button/src/button.mjs +57 -36
  11. package/dist/components/button/src/button.mjs.map +1 -1
  12. package/dist/components/carNumber/src/carNumber.d.ts +8 -8
  13. package/dist/components/carNumber/src/carNumber.mjs +5 -5
  14. package/dist/components/carNumber/src/carNumber.mjs.map +1 -1
  15. package/dist/components/contextMenu/src/contextMenu.d.ts +7 -7
  16. package/dist/components/contextMenu/src/contextMenu.mjs +7 -7
  17. package/dist/components/contextMenu/src/contextMenu.mjs.map +1 -1
  18. package/dist/components/contextMenu/src/contextMenu.type.d.ts +7 -7
  19. package/dist/components/dialog/src/dialog.d.ts +76 -76
  20. package/dist/components/dialog/src/dialog.mjs +34 -34
  21. package/dist/components/dialog/src/dialog.mjs.map +1 -1
  22. package/dist/components/drawer/src/drawer.d.ts +59 -59
  23. package/dist/components/drawer/src/drawer.mjs +27 -27
  24. package/dist/components/drawer/src/drawer.mjs.map +1 -1
  25. package/dist/components/form/src/form.d.ts +30 -30
  26. package/dist/components/form/src/form.mjs +16 -16
  27. package/dist/components/form/src/form.mjs.map +1 -1
  28. package/dist/components/form/src/formItem.d.ts +30 -30
  29. package/dist/components/form/src/formItem.mjs +13 -13
  30. package/dist/components/form/src/formItem.mjs.map +1 -1
  31. package/dist/components/formItemTip/src/formItemTip.d.ts +9 -9
  32. package/dist/components/formItemTip/src/formItemTip.mjs +3 -3
  33. package/dist/components/formItemTip/src/formItemTip.mjs.map +1 -1
  34. package/dist/components/icon/src/icon.d.ts +10 -10
  35. package/dist/components/icon/src/icon.mjs +4 -4
  36. package/dist/components/icon/src/icon.mjs.map +1 -1
  37. package/dist/components/iconSelector/src/iconSelector.d.ts +6 -6
  38. package/dist/components/iconSelector/src/iconSelector.mjs +4 -4
  39. package/dist/components/iconSelector/src/iconSelector.mjs.map +1 -1
  40. package/dist/components/image/src/image.d.ts +36 -36
  41. package/dist/components/image/src/image.mjs +11 -11
  42. package/dist/components/image/src/image.mjs.map +1 -1
  43. package/dist/components/inputDialogPage/src/inputDialogPage.d.ts +37 -37
  44. package/dist/components/inputDialogPage/src/inputDialogPage.mjs +16 -16
  45. package/dist/components/inputDialogPage/src/inputDialogPage.mjs.map +1 -1
  46. package/dist/components/layoutGrid/src/layoutGrid.d.ts +12 -12
  47. package/dist/components/layoutGrid/src/layoutGrid.mjs +6 -6
  48. package/dist/components/layoutGrid/src/layoutGrid.mjs.map +1 -1
  49. package/dist/components/layoutGrid/src/layoutGridItem.d.ts +19 -19
  50. package/dist/components/layoutGrid/src/layoutGridItem.mjs +9 -9
  51. package/dist/components/layoutGrid/src/layoutGridItem.mjs.map +1 -1
  52. package/dist/components/select/src/select.d.ts +89 -89
  53. package/dist/components/select/src/select.mjs +30 -30
  54. package/dist/components/select/src/select.mjs.map +1 -1
  55. package/dist/components/select/src/selectOption.d.ts +13 -13
  56. package/dist/components/select/src/selectOption.mjs +6 -6
  57. package/dist/components/select/src/selectOption.mjs.map +1 -1
  58. package/dist/components/selectPage/src/selectPage.d.ts +76 -76
  59. package/dist/components/selectPage/src/selectPage.mjs +50 -36
  60. package/dist/components/selectPage/src/selectPage.mjs.map +1 -1
  61. package/dist/components/selectV2/index.mjs +2 -1
  62. package/dist/components/selectV2/index.mjs.map +1 -1
  63. package/dist/components/selectV2/src/selectV2.d.ts +161 -852
  64. package/dist/components/selectV2/src/selectV2.mjs +32 -340
  65. package/dist/components/selectV2/src/selectV2.mjs.map +1 -1
  66. package/dist/components/table/index.mjs +3 -2
  67. package/dist/components/table/index.mjs.map +1 -1
  68. package/dist/components/table/src/page.type.d.ts +1 -1
  69. package/dist/components/table/src/table.d.ts +211 -744
  70. package/dist/components/table/src/table.mjs +111 -307
  71. package/dist/components/table/src/table.mjs.map +1 -1
  72. package/dist/components/table/src/table.state.d.ts +3 -3
  73. package/dist/components/table/src/table.type.d.ts +1 -9
  74. package/dist/components/table/src/table.type.mjs.map +1 -1
  75. package/dist/components/table/src/tableColumn.d.ts +102 -399
  76. package/dist/components/table/src/tableColumn.mjs +28 -185
  77. package/dist/components/table/src/tableColumn.mjs.map +1 -1
  78. package/dist/components/table/src/tableColumnSettingDialog.d.ts +4 -4
  79. package/dist/components/table/src/tableColumnSettingDialog.mjs +3 -3
  80. package/dist/components/table/src/tableColumnSettingDialog.mjs.map +1 -1
  81. package/dist/components/table/src/tablePagination.d.ts +4 -4
  82. package/dist/components/table/src/tablePagination.mjs +3 -3
  83. package/dist/components/table/src/tablePagination.mjs.map +1 -1
  84. package/dist/components/table/src/tableSearchForm.d.ts +12 -12
  85. package/dist/components/table/src/tableSearchForm.mjs +6 -6
  86. package/dist/components/table/src/tableSearchForm.mjs.map +1 -1
  87. package/dist/components/table/src/tableSearchFormItem.d.ts +4 -4
  88. package/dist/components/table/src/tableSearchFormItem.mjs +2 -2
  89. package/dist/components/table/src/tableSearchFormItem.mjs.map +1 -1
  90. package/dist/components/table/src/useTable.d.ts +1 -0
  91. package/dist/components/table/src/useTable.mjs +109 -65
  92. package/dist/components/table/src/useTable.mjs.map +1 -1
  93. package/dist/components/table/utils/table.d.ts +4 -4
  94. package/dist/components/table/utils/table.mjs +4 -4
  95. package/dist/components/table/utils/table.mjs.map +1 -1
  96. package/dist/components/tree/src/tree.d.ts +87 -87
  97. package/dist/components/tree/src/tree.mjs +48 -48
  98. package/dist/components/tree/src/tree.mjs.map +1 -1
  99. package/dist/components/treeSelect/src/treeSelect.d.ts +139 -133
  100. package/dist/components/treeSelect/src/treeSelect.mjs +57 -57
  101. package/dist/components/treeSelect/src/treeSelect.mjs.map +1 -1
  102. package/dist/components/upload/src/upload.d.ts +36 -36
  103. package/dist/components/upload/src/upload.mjs +19 -19
  104. package/dist/components/upload/src/upload.mjs.map +1 -1
  105. package/dist/components/uploadImage/src/uploadImage.d.ts +47 -47
  106. package/dist/components/uploadImage/src/uploadImage.mjs +24 -28
  107. package/dist/components/uploadImage/src/uploadImage.mjs.map +1 -1
  108. package/dist/components/uploadImages/src/uploadImages.d.ts +41 -41
  109. package/dist/components/uploadImages/src/uploadImages.mjs +21 -21
  110. package/dist/components/uploadImages/src/uploadImages.mjs.map +1 -1
  111. package/dist/directives/click-debounce/index.mjs +19 -11
  112. package/dist/directives/click-debounce/index.mjs.map +1 -1
  113. package/dist/directives/click-throttle/index.d.ts +4 -2
  114. package/dist/directives/click-throttle/index.mjs +21 -11
  115. package/dist/directives/click-throttle/index.mjs.map +1 -1
  116. package/dist/index.css +1 -1
  117. package/dist/index.css.map +1 -1
  118. package/dist/index.global.min.js +3 -3
  119. package/dist/index.global.min.js.map +1 -1
  120. package/dist/index.mjs +3 -3
  121. package/dist/internal/props.d.ts +685 -0
  122. package/dist/internal/props.mjs +683 -0
  123. package/dist/internal/props.mjs.map +1 -0
  124. package/dist/utils/loading-tasks.d.ts +5 -0
  125. package/dist/utils/loading-tasks.mjs +32 -0
  126. package/dist/utils/loading-tasks.mjs.map +1 -0
  127. package/dist/version.d.ts +1 -1
  128. package/dist/version.mjs +1 -1
  129. package/dist/version.mjs.map +1 -1
  130. package/package.json +5 -10
@@ -1,122 +1,122 @@
1
1
  import type { TableProps } from "element-plus";
2
2
  import type { PropType } from "vue";
3
3
  import type { DefaultRow, PagedInput, PagedResult } from "../../table";
4
- /** FaInputDialogPage 的运行时 Props 定义。 */
4
+ /** FaInputDialogPage 的运行时 Props 定义 */
5
5
  export declare const faInputDialogPageProps: {
6
- /** @description key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */
6
+ /** key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */
7
7
  rowKey: {
8
8
  type: PropType<NonNullable<TableProps<DefaultRow>["rowKey"]>>;
9
9
  default: string;
10
10
  };
11
- /** @description v-model绑定值 */
11
+ /** v-model 绑定值 */
12
12
  modelValue: PropType<string | number | null>;
13
- /** @description v-model:label绑定值 */
13
+ /** v-model:label 绑定值 */
14
14
  label: PropType<string | null>;
15
- /** @description 输入框占位文本 */
15
+ /** 输入框占位文本 */
16
16
  placeholder: {
17
17
  type: StringConstructor;
18
18
  default: string;
19
19
  };
20
- /** @description 禁用 */
20
+ /** 禁用 */
21
21
  disabled: BooleanConstructor;
22
- /** @description 标题 */
22
+ /** 标题 */
23
23
  title: StringConstructor;
24
- /** @description 请求api */
24
+ /** 请求数据的函数 */
25
25
  requestApi: {
26
26
  type: PropType<(params?: PagedInput) => Promise<PagedResult | DefaultRow[]>>;
27
27
  };
28
28
  /** 初始化参数 */
29
29
  initParam: PropType<string | number | PagedInput>;
30
- /** @description 显示文本 Key */
30
+ /** 显示文本 Key */
31
31
  labelKey: {
32
32
  type: StringConstructor;
33
33
  default: string;
34
34
  };
35
35
  };
36
- /** FaInputDialogPage 的运行时 Emits 定义。 */
36
+ /** FaInputDialogPage 的运行时 Emits 定义 */
37
37
  export declare const faInputDialogPageEmits: {
38
- /** @description v-model 回调 */
38
+ /** v-model 回调 */
39
39
  "update:modelValue": (value: string | number | null) => boolean;
40
- /** @description v-model:label 回调 */
40
+ /** v-model:label 回调 */
41
41
  "update:label": (value: string | null) => boolean;
42
- /** @description 选中数据改变 */
42
+ /** 选中数据改变 */
43
43
  change: (_data: DefaultRow | null, _value?: string | number | null) => boolean;
44
44
  };
45
- /** FaInputDialogPage 的插槽参数。 */
45
+ /** FaInputDialogPage 的插槽参数 */
46
46
  export interface FaInputDialogPageSlots extends Record<string, unknown> {
47
- /** @description 默认内容插槽 */
47
+ /** 默认内容插槽 */
48
48
  default: never;
49
49
  }
50
50
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
51
- /** @description key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */
51
+ /** key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */
52
52
  rowKey: {
53
53
  type: PropType<NonNullable<TableProps<DefaultRow>["rowKey"]>>;
54
54
  default: string;
55
55
  };
56
- /** @description v-model绑定值 */
56
+ /** v-model 绑定值 */
57
57
  modelValue: PropType<string | number | null>;
58
- /** @description v-model:label绑定值 */
58
+ /** v-model:label 绑定值 */
59
59
  label: PropType<string | null>;
60
- /** @description 输入框占位文本 */
60
+ /** 输入框占位文本 */
61
61
  placeholder: {
62
62
  type: StringConstructor;
63
63
  default: string;
64
64
  };
65
- /** @description 禁用 */
65
+ /** 禁用 */
66
66
  disabled: BooleanConstructor;
67
- /** @description 标题 */
67
+ /** 标题 */
68
68
  title: StringConstructor;
69
- /** @description 请求api */
69
+ /** 请求数据的函数 */
70
70
  requestApi: {
71
71
  type: PropType<(params?: PagedInput) => Promise<PagedResult | DefaultRow[]>>;
72
72
  };
73
73
  /** 初始化参数 */
74
74
  initParam: PropType<string | number | PagedInput>;
75
- /** @description 显示文本 Key */
75
+ /** 显示文本 Key */
76
76
  labelKey: {
77
77
  type: StringConstructor;
78
78
  default: string;
79
79
  };
80
80
  }>, {
81
- /** @description 选择行数据 */
81
+ /** 选择行数据 */
82
82
  selectionRow: import("vue").ComputedRef<DefaultRow | undefined>;
83
- /** @description 打开选择器弹窗 */
83
+ /** 打开选择器弹窗 */
84
84
  open: () => Promise<void>;
85
- /** @description 清除选择 */
85
+ /** 清除选择 */
86
86
  clear: () => void;
87
87
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
88
- /** @description v-model 回调 */
88
+ /** v-model 回调 */
89
89
  "update:modelValue": (value: string | number | null) => boolean;
90
- /** @description v-model:label 回调 */
90
+ /** v-model:label 回调 */
91
91
  "update:label": (value: string | null) => boolean;
92
- /** @description 选中数据改变 */
92
+ /** 选中数据改变 */
93
93
  change: (_data: DefaultRow | null, _value?: string | number | null) => boolean;
94
94
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
95
- /** @description key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */
95
+ /** key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */
96
96
  rowKey: {
97
97
  type: PropType<NonNullable<TableProps<DefaultRow>["rowKey"]>>;
98
98
  default: string;
99
99
  };
100
- /** @description v-model绑定值 */
100
+ /** v-model 绑定值 */
101
101
  modelValue: PropType<string | number | null>;
102
- /** @description v-model:label绑定值 */
102
+ /** v-model:label 绑定值 */
103
103
  label: PropType<string | null>;
104
- /** @description 输入框占位文本 */
104
+ /** 输入框占位文本 */
105
105
  placeholder: {
106
106
  type: StringConstructor;
107
107
  default: string;
108
108
  };
109
- /** @description 禁用 */
109
+ /** 禁用 */
110
110
  disabled: BooleanConstructor;
111
- /** @description 标题 */
111
+ /** 标题 */
112
112
  title: StringConstructor;
113
- /** @description 请求api */
113
+ /** 请求数据的函数 */
114
114
  requestApi: {
115
115
  type: PropType<(params?: PagedInput) => Promise<PagedResult | DefaultRow[]>>;
116
116
  };
117
117
  /** 初始化参数 */
118
118
  initParam: PropType<string | number | PagedInput>;
119
- /** @description 显示文本 Key */
119
+ /** 显示文本 Key */
120
120
  labelKey: {
121
121
  type: StringConstructor;
122
122
  default: string;
@@ -9,27 +9,27 @@ import { computed, createVNode, defineComponent, reactive, shallowRef, useModel
9
9
  import { Delete, Search } from "@element-plus/icons-vue";
10
10
  import { ElButton, ElButtonGroup, ElInput } from "element-plus";
11
11
  //#region src/components/inputDialogPage/src/inputDialogPage.tsx
12
- /** FaInputDialogPage 的运行时 Props 定义。 */
12
+ /** FaInputDialogPage 的运行时 Props 定义 */
13
13
  const faInputDialogPageProps = {
14
- /** @description key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */
14
+ /** key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */
15
15
  rowKey: {
16
16
  type: [String, Function],
17
17
  default: "id"
18
18
  },
19
- /** @description v-model绑定值 */
19
+ /** v-model 绑定值 */
20
20
  modelValue: [String, Number],
21
- /** @description v-model:label绑定值 */
21
+ /** v-model:label 绑定值 */
22
22
  label: String,
23
- /** @description 输入框占位文本 */
23
+ /** 输入框占位文本 */
24
24
  placeholder: {
25
25
  type: String,
26
26
  default: "请选择"
27
27
  },
28
- /** @description 禁用 */
28
+ /** 禁用 */
29
29
  disabled: Boolean,
30
- /** @description 标题 */
30
+ /** 标题 */
31
31
  title: String,
32
- /** @description 请求api */
32
+ /** 请求数据的函数 */
33
33
  requestApi: { type: definePropType(Function) },
34
34
  /** 初始化参数 */
35
35
  initParam: definePropType([
@@ -37,19 +37,19 @@ const faInputDialogPageProps = {
37
37
  Number,
38
38
  Object
39
39
  ]),
40
- /** @description 显示文本 Key */
40
+ /** 显示文本 Key */
41
41
  labelKey: {
42
42
  type: String,
43
43
  default: "name"
44
44
  }
45
45
  };
46
- /** FaInputDialogPage 的运行时 Emits 定义。 */
46
+ /** FaInputDialogPage 的运行时 Emits 定义 */
47
47
  const faInputDialogPageEmits = {
48
- /** @description v-model 回调 */
48
+ /** v-model 回调 */
49
49
  "update:modelValue": (value) => typeof value === "string" || typeof value === "number" || value === null,
50
- /** @description v-model:label 回调 */
50
+ /** v-model:label 回调 */
51
51
  "update:label": (value) => typeof value === "string" || value === null,
52
- /** @description 选中数据改变 */
52
+ /** 选中数据改变 */
53
53
  change: (_data, _value) => true
54
54
  };
55
55
  var inputDialogPage_default = defineComponent({
@@ -137,11 +137,11 @@ var inputDialogPage_default = defineComponent({
137
137
  "onRowDblclick": handleTableRowDblclick
138
138
  }, { default: () => slots.default?.() })] })]));
139
139
  return useExpose(expose, {
140
- /** @description 选择行数据 */
140
+ /** 选择行数据 */
141
141
  selectionRow: computed(() => state.selectionRow),
142
- /** @description 打开选择器弹窗 */
142
+ /** 打开选择器弹窗 */
143
143
  open: handleSearchClick,
144
- /** @description 清除选择 */
144
+ /** 清除选择 */
145
145
  clear: handleDeleteClick
146
146
  });
147
147
  }
@@ -1 +1 @@
1
- {"version":3,"file":"inputDialogPage.mjs","names":["update:modelValue","update:label"],"sources":["../../../../src/components/inputDialogPage/src/inputDialogPage.tsx"],"sourcesContent":["import { computed, defineComponent, reactive, shallowRef, useModel } from \"vue\";\nimport { Delete, Search } from \"@element-plus/icons-vue\";\nimport { ElButton, ElButtonGroup, ElInput } from \"element-plus\";\nimport { definePropType, makeSlots, useExpose, useRender, withDefineType } from \"../../../utils\";\nimport FaDialog from \"../../dialog\";\nimport { FaTable } from \"../../table\";\nimport type { TableProps } from \"element-plus\";\nimport type { PropType } from \"vue\";\nimport type { FaDialogInstance } from \"../../dialog\";\nimport type { DefaultRow, FaTableInstance, PagedInput, PagedResult } from \"../../table\";\n\n/** FaInputDialogPage 的运行时 Props 定义。 */\nexport const faInputDialogPageProps = {\n\t/** @description key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */\n\trowKey: {\n\t\ttype: [String, Function] as PropType<NonNullable<TableProps<DefaultRow>[\"rowKey\"]>>,\n\t\tdefault: \"id\",\n\t},\n\t/** @description v-model绑定值 */\n\tmodelValue: [String, Number] as PropType<string | number | null>,\n\t/** @description v-model:label绑定值 */\n\tlabel: String as PropType<string | null>,\n\t/** @description 输入框占位文本 */\n\tplaceholder: {\n\t\ttype: String,\n\t\tdefault: \"请选择\",\n\t},\n\t/** @description 禁用 */\n\tdisabled: Boolean,\n\t/** @description 标题 */\n\ttitle: String,\n\t/** @description 请求api */\n\trequestApi: {\n\t\ttype: definePropType<(params?: PagedInput) => Promise<PagedResult | DefaultRow[]>>(Function),\n\t},\n\t/** 初始化参数 */\n\tinitParam: definePropType<string | number | PagedInput>([String, Number, Object]),\n\t/** @description 显示文本 Key */\n\tlabelKey: {\n\t\ttype: String,\n\t\tdefault: \"name\",\n\t},\n};\n\n/** FaInputDialogPage 的运行时 Emits 定义。 */\nexport const faInputDialogPageEmits = {\n\t/** @description v-model 回调 */\n\t\"update:modelValue\": (value: string | number | null) => typeof value === \"string\" || typeof value === \"number\" || value === null,\n\t/** @description v-model:label 回调 */\n\t\"update:label\": (value: string | null) => typeof value === \"string\" || value === null,\n\t/** @description 选中数据改变 */\n\tchange: (_data: DefaultRow | null, _value?: string | number | null) => true,\n};\n\n/** FaInputDialogPage 的插槽参数。 */\nexport interface FaInputDialogPageSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n}\n\nexport default defineComponent({\n\tname: \"FaInputDialogPage\",\n\tprops: faInputDialogPageProps,\n\temits: faInputDialogPageEmits,\n\tslots: makeSlots<FaInputDialogPageSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst modelValue = useModel(props, \"modelValue\");\n\t\tconst selectedLabel = useModel(props, \"label\");\n\n\t\tconst faDialogRef = shallowRef<FaDialogInstance | null>(null);\n\t\tconst faTableRef = shallowRef<FaTableInstance | null>(null);\n\n\t\tconst state = reactive({\n\t\t\tselectionRow: withDefineType<DefaultRow | undefined>(),\n\t\t});\n\n\t\tconst handleDeleteClick = () => {\n\t\t\tmodelValue.value = null;\n\t\t\tselectedLabel.value = null;\n\t\t\tstate.selectionRow = undefined;\n\t\t\temit(\"change\", null, null);\n\t\t};\n\n\t\tconst handleSearchClick = async () => {\n\t\t\tawait faDialogRef.value?.open(() => {\n\t\t\t\tconst table = faTableRef.value;\n\t\t\t\tif (table === null) return;\n\t\t\t\tif (state.selectionRow) {\n\t\t\t\t\t// 判断当前行是否选中\n\t\t\t\t\tconst rawRowKey: unknown =\n\t\t\t\t\t\ttypeof props.rowKey === \"function\" ? props.rowKey(state.selectionRow) : state.selectionRow[props.rowKey];\n\t\t\t\t\tconst rowSelected = (typeof rawRowKey === \"string\" || typeof rawRowKey === \"number\") && table.selectedListIds.includes(rawRowKey);\n\t\t\t\t\tif (!rowSelected) {\n\t\t\t\t\t\ttable.toggleRowSelection?.(state.selectionRow);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\tconst handleConfirmClick = () => {\n\t\t\tfaDialogRef.value?.close(() => {\n\t\t\t\tconst table = faTableRef.value;\n\t\t\t\tconst selectedData = table?.selectedList[0];\n\t\t\t\tif (table?.selected && selectedData) {\n\t\t\t\t\tstate.selectionRow = selectedData;\n\t\t\t\t\tconst selectedValue: unknown = typeof props.rowKey === \"function\" ? props.rowKey(selectedData) : selectedData[props.rowKey];\n\t\t\t\t\tmodelValue.value = typeof selectedValue === \"string\" || typeof selectedValue === \"number\" ? selectedValue : null;\n\t\t\t\t\tconst label: unknown = selectedData[props.labelKey];\n\t\t\t\t\tselectedLabel.value = typeof label === \"string\" ? label : null;\n\t\t\t\t\temit(\"change\", selectedData, modelValue.value);\n\t\t\t\t} else {\n\t\t\t\t\tmodelValue.value = null;\n\t\t\t\t\tselectedLabel.value = null;\n\t\t\t\t\tstate.selectionRow = undefined;\n\t\t\t\t\temit(\"change\", null, null);\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\tconst handleTableRowDblclick = (row: DefaultRow) => {\n\t\t\tfaTableRef.value?.clearSelection?.();\n\t\t\tfaTableRef.value?.toggleRowSelection?.(row);\n\t\t\tstate.selectionRow = row;\n\t\t\thandleConfirmClick();\n\t\t};\n\n\t\tuseRender(() => (\n\t\t\t<div class=\"fa-input-dialog-page\">\n\t\t\t\t<ElInput vModel={selectedLabel.value} placeholder={props.placeholder} disabled={props.disabled} readonly>\n\t\t\t\t\t{{\n\t\t\t\t\t\tappend: () => (\n\t\t\t\t\t\t\t<ElButtonGroup>\n\t\t\t\t\t\t\t\t<ElButton disabled={props.disabled} icon={Delete} onClick={handleDeleteClick} />\n\t\t\t\t\t\t\t\t<ElButton disabled={props.disabled} icon={Search} onClick={handleSearchClick} />\n\t\t\t\t\t\t\t</ElButtonGroup>\n\t\t\t\t\t\t),\n\t\t\t\t\t}}\n\t\t\t\t</ElInput>\n\t\t\t\t<FaDialog\n\t\t\t\t\tref={faDialogRef}\n\t\t\t\t\tstyle=\"--height: 70%;\"\n\t\t\t\t\twidth=\"50%\"\n\t\t\t\t\ttitle={props.title}\n\t\t\t\t\tfullHeight\n\t\t\t\t\tdisabledConfirmButton={!faTableRef.value?.selected}\n\t\t\t\t\tonConfirmClick={handleConfirmClick}\n\t\t\t\t>\n\t\t\t\t\t<FaTable\n\t\t\t\t\t\tref={faTableRef}\n\t\t\t\t\t\trowKey={props.rowKey}\n\t\t\t\t\t\trequestApi={props.requestApi}\n\t\t\t\t\t\tinitParam={props.initParam}\n\t\t\t\t\t\tsingle\n\t\t\t\t\t\trowClickSelection\n\t\t\t\t\t\thideSearchTime\n\t\t\t\t\t\tonRowDblclick={handleTableRowDblclick}\n\t\t\t\t\t>\n\t\t\t\t\t\t{{\n\t\t\t\t\t\t\tdefault: () => slots.default?.(),\n\t\t\t\t\t\t}}\n\t\t\t\t\t</FaTable>\n\t\t\t\t</FaDialog>\n\t\t\t</div>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 选择行数据 */\n\t\t\tselectionRow: computed(() => state.selectionRow),\n\t\t\t/** @description 打开选择器弹窗 */\n\t\t\topen: handleSearchClick,\n\t\t\t/** @description 清除选择 */\n\t\t\tclear: handleDeleteClick,\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,yBAAyB;;CAErC,QAAQ;EACP,MAAM,CAAC,QAAQ,QAAQ;EACvB,SAAS;CACV;;CAEA,YAAY,CAAC,QAAQ,MAAM;;CAE3B,OAAO;;CAEP,aAAa;EACZ,MAAM;EACN,SAAS;CACV;;CAEA,UAAU;;CAEV,OAAO;;CAEP,YAAY,EACX,MAAM,eAA6E,QAAQ,EAC5F;;CAEA,WAAW,eAA6C;EAAC;EAAQ;EAAQ;CAAM,CAAC;;CAEhF,UAAU;EACT,MAAM;EACN,SAAS;CACV;AACD;;AAGA,MAAa,yBAAyB;;CAErC,sBAAsB,UAAkC,OAAO,UAAU,YAAY,OAAO,UAAU,YAAY,UAAU;;CAE5H,iBAAiB,UAAyB,OAAO,UAAU,YAAY,UAAU;;CAEjF,SAAS,OAA0B,WAAoC;AACxE;AAQA,IAAA,0BAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;CACP,OAAO;CACP,OAAO,UAAkC;CACzC,MAAM,OAAO,EAAE,OAAO,MAAM,UAAU;EACrC,MAAM,aAAa,SAAS,OAAO,YAAY;EAC/C,MAAM,gBAAgB,SAAS,OAAO,OAAO;EAE7C,MAAM,cAAc,WAAoC,IAAI;EAC5D,MAAM,aAAa,WAAmC,IAAI;EAE1D,MAAM,QAAQ,SAAS,EACtB,cAAc,eAAuC,EACtD,CAAC;EAED,MAAM,0BAA0B;GAC/B,WAAW,QAAQ;GACnB,cAAc,QAAQ;GACtB,MAAM,eAAe,KAAA;GACrB,KAAK,UAAU,MAAM,IAAI;EAC1B;EAEA,MAAM,oBAAoB,YAAY;GACrC,MAAM,YAAY,OAAO,WAAW;IACnC,MAAM,QAAQ,WAAW;IACzB,IAAI,UA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A,GAAA,YAAA,UAAA;GAAA,YACxD,MAAM;GAAQ,QAAQ;GAAM,WAAW;EAAiB,GAAA,IAAA,CAAA,EAAA,CAAA,EAE7E,CAAA,GAAA,YAAA,UAAA;GAAA,OAIG;GAAW,SAAA;GAAA,SAAA;GAAA,SAGT,MAAM;GAAK,cAAA;GAAA,yBAEK,CAAC,WAAW,OAAO;GAAQ,kBAClC;EAAkB,GAAA,EAAA,eAAA,CAAA,YAAA,SAAA;GAAA,OAG5B;GAAU,UACP,MAAM;GAAM,cACR,MAAM;GAAU,aACjB,MAAM;GAAS,UAAA;GAAA,qBAAA;GAAA,kBAAA;GAAA,iBAIX;EAAsB,GAAA,EAGpC,eAAe,MAAM,UAAU,EAAC,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAKpC;EAED,OAAO,UAAU,QAAQ;;GAExB,cAAc,eAAe,MAAM,YAAY;;GAE/C,MAAM;;GAEN,OAAO;EACR,CAAC;CACF;AACD,CAAC"}
1
+ {"version":3,"file":"inputDialogPage.mjs","names":["update:modelValue","update:label"],"sources":["../../../../src/components/inputDialogPage/src/inputDialogPage.tsx"],"sourcesContent":["import { computed, defineComponent, reactive, shallowRef, useModel } from \"vue\";\nimport { Delete, Search } from \"@element-plus/icons-vue\";\nimport { ElButton, ElButtonGroup, ElInput } from \"element-plus\";\nimport { definePropType, makeSlots, useExpose, useRender, withDefineType } from \"../../../utils\";\nimport FaDialog from \"../../dialog\";\nimport { FaTable } from \"../../table\";\nimport type { TableProps } from \"element-plus\";\nimport type { PropType } from \"vue\";\nimport type { FaDialogInstance } from \"../../dialog\";\nimport type { DefaultRow, FaTableInstance, PagedInput, PagedResult } from \"../../table\";\n\n/** FaInputDialogPage 的运行时 Props 定义 */\nexport const faInputDialogPageProps = {\n\t/** key of row data, used for optimizing rendering. Required if `reserve-selection` is on or display tree data. When its type is String, multi-level access is supported, e.g. `user.info.id`, but `user.info[0].id` is not supported, in which case `Function` should be used */\n\trowKey: {\n\t\ttype: [String, Function] as PropType<NonNullable<TableProps<DefaultRow>[\"rowKey\"]>>,\n\t\tdefault: \"id\",\n\t},\n\t/** v-model 绑定值 */\n\tmodelValue: [String, Number] as PropType<string | number | null>,\n\t/** v-model:label 绑定值 */\n\tlabel: String as PropType<string | null>,\n\t/** 输入框占位文本 */\n\tplaceholder: {\n\t\ttype: String,\n\t\tdefault: \"请选择\",\n\t},\n\t/** 禁用 */\n\tdisabled: Boolean,\n\t/** 标题 */\n\ttitle: String,\n\t/** 请求数据的函数 */\n\trequestApi: {\n\t\ttype: definePropType<(params?: PagedInput) => Promise<PagedResult | DefaultRow[]>>(Function),\n\t},\n\t/** 初始化参数 */\n\tinitParam: definePropType<string | number | PagedInput>([String, Number, Object]),\n\t/** 显示文本 Key */\n\tlabelKey: {\n\t\ttype: String,\n\t\tdefault: \"name\",\n\t},\n};\n\n/** FaInputDialogPage 的运行时 Emits 定义 */\nexport const faInputDialogPageEmits = {\n\t/** v-model 回调 */\n\t\"update:modelValue\": (value: string | number | null) => typeof value === \"string\" || typeof value === \"number\" || value === null,\n\t/** v-model:label 回调 */\n\t\"update:label\": (value: string | null) => typeof value === \"string\" || value === null,\n\t/** 选中数据改变 */\n\tchange: (_data: DefaultRow | null, _value?: string | number | null) => true,\n};\n\n/** FaInputDialogPage 的插槽参数 */\nexport interface FaInputDialogPageSlots extends Record<string, unknown> {\n\t/** 默认内容插槽 */\n\tdefault: never;\n}\n\nexport default defineComponent({\n\tname: \"FaInputDialogPage\",\n\tprops: faInputDialogPageProps,\n\temits: faInputDialogPageEmits,\n\tslots: makeSlots<FaInputDialogPageSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst modelValue = useModel(props, \"modelValue\");\n\t\tconst selectedLabel = useModel(props, \"label\");\n\n\t\tconst faDialogRef = shallowRef<FaDialogInstance | null>(null);\n\t\tconst faTableRef = shallowRef<FaTableInstance | null>(null);\n\n\t\tconst state = reactive({\n\t\t\tselectionRow: withDefineType<DefaultRow | undefined>(),\n\t\t});\n\n\t\tconst handleDeleteClick = () => {\n\t\t\tmodelValue.value = null;\n\t\t\tselectedLabel.value = null;\n\t\t\tstate.selectionRow = undefined;\n\t\t\temit(\"change\", null, null);\n\t\t};\n\n\t\tconst handleSearchClick = async () => {\n\t\t\tawait faDialogRef.value?.open(() => {\n\t\t\t\tconst table = faTableRef.value;\n\t\t\t\tif (table === null) return;\n\t\t\t\tif (state.selectionRow) {\n\t\t\t\t\t// 判断当前行是否选中\n\t\t\t\t\tconst rawRowKey: unknown =\n\t\t\t\t\t\ttypeof props.rowKey === \"function\" ? props.rowKey(state.selectionRow) : state.selectionRow[props.rowKey];\n\t\t\t\t\tconst rowSelected = (typeof rawRowKey === \"string\" || typeof rawRowKey === \"number\") && table.selectedListIds.includes(rawRowKey);\n\t\t\t\t\tif (!rowSelected) {\n\t\t\t\t\t\ttable.toggleRowSelection?.(state.selectionRow);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\tconst handleConfirmClick = () => {\n\t\t\tfaDialogRef.value?.close(() => {\n\t\t\t\tconst table = faTableRef.value;\n\t\t\t\tconst selectedData = table?.selectedList[0];\n\t\t\t\tif (table?.selected && selectedData) {\n\t\t\t\t\tstate.selectionRow = selectedData;\n\t\t\t\t\tconst selectedValue: unknown = typeof props.rowKey === \"function\" ? props.rowKey(selectedData) : selectedData[props.rowKey];\n\t\t\t\t\tmodelValue.value = typeof selectedValue === \"string\" || typeof selectedValue === \"number\" ? selectedValue : null;\n\t\t\t\t\tconst label: unknown = selectedData[props.labelKey];\n\t\t\t\t\tselectedLabel.value = typeof label === \"string\" ? label : null;\n\t\t\t\t\temit(\"change\", selectedData, modelValue.value);\n\t\t\t\t} else {\n\t\t\t\t\tmodelValue.value = null;\n\t\t\t\t\tselectedLabel.value = null;\n\t\t\t\t\tstate.selectionRow = undefined;\n\t\t\t\t\temit(\"change\", null, null);\n\t\t\t\t}\n\t\t\t});\n\t\t};\n\n\t\tconst handleTableRowDblclick = (row: DefaultRow) => {\n\t\t\tfaTableRef.value?.clearSelection?.();\n\t\t\tfaTableRef.value?.toggleRowSelection?.(row);\n\t\t\tstate.selectionRow = row;\n\t\t\thandleConfirmClick();\n\t\t};\n\n\t\tuseRender(() => (\n\t\t\t<div class=\"fa-input-dialog-page\">\n\t\t\t\t<ElInput vModel={selectedLabel.value} placeholder={props.placeholder} disabled={props.disabled} readonly>\n\t\t\t\t\t{{\n\t\t\t\t\t\tappend: () => (\n\t\t\t\t\t\t\t<ElButtonGroup>\n\t\t\t\t\t\t\t\t<ElButton disabled={props.disabled} icon={Delete} onClick={handleDeleteClick} />\n\t\t\t\t\t\t\t\t<ElButton disabled={props.disabled} icon={Search} onClick={handleSearchClick} />\n\t\t\t\t\t\t\t</ElButtonGroup>\n\t\t\t\t\t\t),\n\t\t\t\t\t}}\n\t\t\t\t</ElInput>\n\t\t\t\t<FaDialog\n\t\t\t\t\tref={faDialogRef}\n\t\t\t\t\tstyle=\"--height: 70%;\"\n\t\t\t\t\twidth=\"50%\"\n\t\t\t\t\ttitle={props.title}\n\t\t\t\t\tfullHeight\n\t\t\t\t\tdisabledConfirmButton={!faTableRef.value?.selected}\n\t\t\t\t\tonConfirmClick={handleConfirmClick}\n\t\t\t\t>\n\t\t\t\t\t<FaTable\n\t\t\t\t\t\tref={faTableRef}\n\t\t\t\t\t\trowKey={props.rowKey}\n\t\t\t\t\t\trequestApi={props.requestApi}\n\t\t\t\t\t\tinitParam={props.initParam}\n\t\t\t\t\t\tsingle\n\t\t\t\t\t\trowClickSelection\n\t\t\t\t\t\thideSearchTime\n\t\t\t\t\t\tonRowDblclick={handleTableRowDblclick}\n\t\t\t\t\t>\n\t\t\t\t\t\t{{\n\t\t\t\t\t\t\tdefault: () => slots.default?.(),\n\t\t\t\t\t\t}}\n\t\t\t\t\t</FaTable>\n\t\t\t\t</FaDialog>\n\t\t\t</div>\n\t\t));\n\n\t\treturn useExpose(expose, {\n\t\t\t/** 选择行数据 */\n\t\t\tselectionRow: comput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MAAM;GAAQ,QAAQ;GAAM,WAAW;EAAiB,GAAA,IAAA,CAAA,EAAA,CAAA,EAE7E,CAAA,GAAA,YAAA,UAAA;GAAA,OAIG;GAAW,SAAA;GAAA,SAAA;GAAA,SAGT,MAAM;GAAK,cAAA;GAAA,yBAEK,CAAC,WAAW,OAAO;GAAQ,kBAClC;EAAkB,GAAA,EAAA,eAAA,CAAA,YAAA,SAAA;GAAA,OAG5B;GAAU,UACP,MAAM;GAAM,cACR,MAAM;GAAU,aACjB,MAAM;GAAS,UAAA;GAAA,qBAAA;GAAA,kBAAA;GAAA,iBAIX;EAAsB,GAAA,EAGpC,eAAe,MAAM,UAAU,EAAC,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAKpC;EAED,OAAO,UAAU,QAAQ;;GAExB,cAAc,eAAe,MAAM,YAAY;;GAE/C,MAAM;;GAEN,OAAO;EACR,CAAC;CACF;AACD,CAAC"}
@@ -1,11 +1,11 @@
1
1
  import type { FaLayoutGridBreakpoint } from "./layoutGrid.type";
2
- /** FaLayoutGrid 的插槽参数。 */
2
+ /** FaLayoutGrid 的插槽参数 */
3
3
  export interface FaLayoutGridSlots extends Record<string, unknown> {
4
- /** @description 默认内容插槽 */
4
+ /** 默认内容插槽 */
5
5
  default: never;
6
6
  }
7
7
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
- /** @description Grid布局列配置 */
8
+ /** Grid布局列配置 */
9
9
  cols: {
10
10
  type: import("vue").PropType<string | number | Partial<Record<FaLayoutGridBreakpoint, number>>>;
11
11
  default: () => {
@@ -16,28 +16,28 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
16
16
  xl: number;
17
17
  };
18
18
  };
19
- /** @description 折叠 */
19
+ /** 折叠 */
20
20
  collapsed: BooleanConstructor;
21
- /** @description 折叠行数 */
21
+ /** 折叠行数 */
22
22
  collapsedRows: {
23
23
  type: (NumberConstructor | StringConstructor)[];
24
24
  default: number;
25
25
  };
26
- /** @description 间距,偏移 */
26
+ /** 间距,偏移 */
27
27
  gap: {
28
28
  type: import("vue").PropType<number | [number, number]>;
29
29
  default: number;
30
30
  };
31
31
  }>, {
32
- /** @description 响应式断点 */
32
+ /** 响应式断点 */
33
33
  breakpoint: import("vue").Ref<FaLayoutGridBreakpoint, FaLayoutGridBreakpoint>;
34
34
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
35
- /** @description 断点变化事件 */
35
+ /** 断点变化事件 */
36
36
  breakpointChange: ({ breakpoint: _breakpoint }: {
37
37
  breakpoint: FaLayoutGridBreakpoint;
38
38
  }) => true;
39
39
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
40
- /** @description Grid布局列配置 */
40
+ /** Grid布局列配置 */
41
41
  cols: {
42
42
  type: import("vue").PropType<string | number | Partial<Record<FaLayoutGridBreakpoint, number>>>;
43
43
  default: () => {
@@ -48,14 +48,14 @@ declare const _default: import("vue").DefineComponent<import("vue").ExtractPropT
48
48
  xl: number;
49
49
  };
50
50
  };
51
- /** @description 折叠 */
51
+ /** 折叠 */
52
52
  collapsed: BooleanConstructor;
53
- /** @description 折叠行数 */
53
+ /** 折叠行数 */
54
54
  collapsedRows: {
55
55
  type: (NumberConstructor | StringConstructor)[];
56
56
  default: number;
57
57
  };
58
- /** @description 间距,偏移 */
58
+ /** 间距,偏移 */
59
59
  gap: {
60
60
  type: import("vue").PropType<number | [number, number]>;
61
61
  default: number;
@@ -7,7 +7,7 @@ import { computed, createVNode, defineComponent, nextTick, onActivated, onDeacti
7
7
  var layoutGrid_default = defineComponent({
8
8
  name: "FaLayoutGrid",
9
9
  props: {
10
- /** @description Grid布局列配置 */
10
+ /** Grid布局列配置 */
11
11
  cols: {
12
12
  type: definePropType([
13
13
  String,
@@ -22,21 +22,21 @@ var layoutGrid_default = defineComponent({
22
22
  xl: 5
23
23
  })
24
24
  },
25
- /** @description 折叠 */
25
+ /** 折叠 */
26
26
  collapsed: Boolean,
27
- /** @description 折叠行数 */
27
+ /** 折叠行数 */
28
28
  collapsedRows: {
29
29
  type: [String, Number],
30
30
  default: 1
31
31
  },
32
- /** @description 间距,偏移 */
32
+ /** 间距,偏移 */
33
33
  gap: {
34
34
  type: definePropType([Number, Array]),
35
35
  default: 0
36
36
  }
37
37
  },
38
38
  emits: {
39
- /** @description 断点变化事件 */
39
+ /** 断点变化事件 */
40
40
  breakpointChange: ({ breakpoint: _breakpoint }) => true },
41
41
  slots: makeSlots(),
42
42
  setup(props, { slots, emit, expose }) {
@@ -150,7 +150,7 @@ breakpointChange: ({ breakpoint: _breakpoint }) => true },
150
150
  }, [defaultSlot]);
151
151
  });
152
152
  return useExpose(expose, {
153
- /** @description 响应式断点 */
153
+ /** 响应式断点 */
154
154
  breakpoint });
155
155
  }
156
156
  });
@@ -1 +1 @@
1
- {"version":3,"file":"layoutGrid.mjs","names":[],"sources":["../../../../src/components/layoutGrid/src/layoutGrid.tsx"],"sourcesContent":["import { computed, defineComponent, nextTick, onActivated, onDeactivated, onMounted, onUnmounted, provide, ref, shallowRef, watch } from \"vue\";\nimport { definePropType, makeSlots, useExpose, useRender } from \"../../../utils\";\nimport type { VNode, VNodeArrayChildren } from \"vue\";\nimport type { FaLayoutGridBreakpoint, FaLayoutGridItemResponsive } from \"./layoutGrid.type\";\n\n/** FaLayoutGrid 的插槽参数。 */\nexport interface FaLayoutGridSlots extends Record<string, unknown> {\n\t/** @description 默认内容插槽 */\n\tdefault: never;\n}\n\nexport default defineComponent({\n\tname: \"FaLayoutGrid\",\n\tprops: {\n\t\t/** @description Grid布局列配置 */\n\t\tcols: {\n\t\t\ttype: definePropType<string | number | Partial<Record<FaLayoutGridBreakpoint, number>>>([String, Number, Object]),\n\t\t\tdefault: () => ({ xs: 1, sm: 2, md: 3, lg: 4, xl: 5 }),\n\t\t},\n\t\t/** @description 折叠 */\n\t\tcollapsed: Boolean,\n\t\t/** @description 折叠行数 */\n\t\tcollapsedRows: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: 1,\n\t\t},\n\t\t/** @description 间距,偏移 */\n\t\tgap: {\n\t\t\ttype: definePropType<number | [number, number]>([Number, Array]),\n\t\t\tdefault: 0,\n\t\t},\n\t},\n\temits: {\n\t\t/** @description 断点变化事件 */\n\t\tbreakpointChange: ({ breakpoint: _breakpoint }: { breakpoint: FaLayoutGridBreakpoint }) => true,\n\t},\n\tslots: makeSlots<FaLayoutGridSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst containerRef = shallowRef<HTMLElement | null>(null);\n\n\t\t// 注入响应式横向 gap 间距\n\t\tconst horizontalGap = computed(() => (Array.isArray(props.gap) ? props.gap[0] : props.gap));\n\t\tprovide(\"gap\", horizontalGap);\n\n\t\t// 注入响应式断点\n\t\tconst breakpoint = ref<FaLayoutGridBreakpoint>(\"xl\");\n\t\tprovide(\"breakpoint\", breakpoint);\n\n\t\t// 注入要开始折叠的 index\n\t\tconst firstHiddenIndex = ref(-1);\n\t\tprovide(\"firstHiddenIndex\", firstHiddenIndex);\n\n\t\t// 注入 cols\n\t\tconst cols = computed<string | number>(() => {\n\t\t\tif (typeof props.cols === \"object\" && props.cols !== null) return props.cols[breakpoint.value] ?? 1;\n\t\t\treturn props.cols;\n\t\t});\n\t\tprovide(\"cols\", cols);\n\n\t\tconst collapsedRows = computed(() => (typeof props.collapsedRows === \"number\" ? props.collapsedRows : Number(props.collapsedRows)));\n\n\t\t// 设置间距\n\t\tconst gap = computed(() => {\n\t\t\tif (typeof props.gap === \"number\") return `${props.gap}px`;\n\t\t\tif (Array.isArray(props.gap)) return `${props.gap[1]}px ${props.gap[0]}px`;\n\t\t\treturn \"unset\";\n\t\t});\n\n\t\t// 设置 style\n\t\tconst style = computed(() => {\n\t\t\treturn {\n\t\t\t\tdisplay: \"grid\",\n\t\t\t\tgridGap: gap.value,\n\t\t\t\tgridTemplateColumns: `repeat(${cols.value}, minmax(0, 1fr))`,\n\t\t\t};\n\t\t});\n\n\t\t// 断点映射\n\t\tconst breakpoints = {\n\t\t\t// 小于480屏幕(如手机)\n\t\t\txs: { min: 0, max: 479 },\n\t\t\t// 平板竖屏\n\t\t\tsm: { min: 480, max: 768 },\n\t\t\t// 平板横屏\n\t\t\tmd: { min: 768, max: 1024 },\n\t\t\t// 小型桌面\n\t\t\tlg: { min: 1024, max: 1440 },\n\t\t\t// 大型桌面\n\t\t\txl: { min: 1440, max: Infinity },\n\t\t};\n\n\t\t// 监听屏幕变化\n\t\tconst resize = (e: ResizeObserverEntry[]) => {\n\t\t\t// 当前只监听布局容器,ResizeObserver 每次回调应当只有一个目标。\n\t\t\tif (e.length !== 1 || e[0] === undefined) throw new Error(\"FaLayoutGrid 监听到了非预期数量的布局容器。\");\n\t\t\tconst curEl = e[0];\n\t\t\tconst width = curEl.target.scrollWidth;\n\n\t\t\tfor (const [key, { min, max }] of Object.entries(breakpoints)) {\n\t\t\t\tif (width >= min && width <= max) {\n\t\t\t\t\tbreakpoint.value = key as FaLayoutGridBreakpoint;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tlet resizeObserver: ResizeObserver | undefined;\n\t\tconst observeResize = () => {\n\t\t\tconst element = containerRef.value;\n\t\t\tif (!element) return;\n\t\t\tresizeObserver?.disconnect();\n\t\t\tresizeObserver = new ResizeObserver(resize);\n\t\t\tresizeObserver.observe(element);\n\t\t};\n\n\t\twatch(\n\t\t\t() => breakpoint.value,\n\t\t\t(newValue) => {\n\t\t\t\temit(\"breakpointChange\", { breakpoint: newValue });\n\t\t\t}\n\t\t);\n\n\t\tonMounted(() => {\n\t\t\tnextTick(observeResize);\n\t\t\temit(\"breakpointChange\", { breakpoint: breakpoint.value });\n\t\t});\n\n\t\tonActivated(() => nextTick(observeResize));\n\n\t\tonDeactivated(() => {\n\t\t\tresizeObserver?.disconnect();\n\t\t});\n\n\t\tonUnmounted(() => {\n\t\t\tresizeObserver?.disconnect();\n\t\t});\n\n\t\tuseRender(() => {\n\t\t\tconst defaultSlot = slots.default?.() ?? [];\n\n\t\t\tif (props.collapsed) {\n\t\t\t\tconst fields: VNodeArrayChildren = [];\n\t\t\t\tlet suffix: VNode | undefined;\n\n\t\t\t\tdefaultSlot.forEach((slot) => {\n\t\t\t\t\t// suffix\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof slot.type === \"object\" &&\n\t\t\t\t\t\t\"name\" in slot.type &&\n\t\t\t\t\t\tslot.type.name === \"FaLayoutGridItem\" &&\n\t\t\t\t\t\tslot.props?.[\"suffix\"] !== undefined\n\t\t\t\t\t) {\n\t\t\t\t\t\tsuffix = slot;\n\t\t\t\t\t}\n\t\t\t\t\t// slot children\n\t\t\t\t\tif (typeof slot.type === \"symbol\" && Array.isArray(slot.children)) fields.push(...slot.children);\n\t\t\t\t});\n\n\t\t\t\t// 计算 suffix 所占用的列\n\t\t\t\tlet suffixCols = 0;\n\t\t\t\tif (suffix?.props) {\n\t\t\t\t\tconst activeBreakpointProps = suffix.props[breakpoint.value] as FaLayoutGridItemResponsive | undefined;\n\t\t\t\t\tsuffixCols =\n\t\t\t\t\t\t(activeBreakpointProps?.span ?? Number(suffix.props[\"span\"] ?? 1)) +\n\t\t\t\t\t\t(activeBreakpointProps?.offset ?? Number(suffix.props[\"offset\"] ?? 0));\n\t\t\t\t}\n\n\t\t\t\tlet occupiedCols = 0;\n\t\t\t\tfirstHiddenIndex.value = -1;\n\t\t\t\tfor (const [index, current] of fields.entries()) {\n\t\t\t\t\tconst currentVNode = current as VNode;\n\t\t\t\t\tconst currentProps = currentVNode.props;\n\t\t\t\t\tif (currentProps === null) continue;\n\t\t\t\t\tconst activeBreakpointProps = currentProps[breakpoint.value] as FaLayoutGridItemResponsive | undefined;\n\t\t\t\t\toccupiedCols +=\n\t\t\t\t\t\t(activeBreakpointProps?.span ?? Number(currentProps[\"span\"] ?? 1)) +\n\t\t\t\t\t\t(activeBreakpointProps?.offset ?? Number(currentProps[\"offset\"] ?? 0));\n\t\t\t\t\tif (occupiedCols > collapsedRows.value * Number(cols.value) - suffixCols) {\n\t\t\t\t\t\tfirstHiddenIndex.value = index;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfirstHiddenIndex.value = -1;\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div ref={containerRef} style={style.value}>\n\t\t\t\t\t{defaultSlot}\n\t\t\t\t</div>\n\t\t\t);\n\t\t});\n\n\t\treturn useExpose(expose, {\n\t\t\t/** @description 响应式断点 */\n\t\t\tbreakpoint,\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;AAWA,IAAA,qBAAe,gBAAgB;CAC9B,MAAM;CACN,OAAO;;EAEN,MAAM;GACL,MAAM,eAAkF;IAAC;IAAQ;IAAQ;GAAM,CAAC;GAChH,gBAAgB;IAAE,IAAI;IAAG,IAAI;IAAG,IAAI;IAAG,IAAI;IAAG,IAAI;GAAE;EACrD;;EAEA,WAAW;;EAEX,eAAe;GACd,MAAM,CAAC,QAAQ,MAAM;GACrB,SAAS;EACV;;EAEA,KAAK;GACJ,MAAM,eAA0C,CAAC,QAAQ,KAAK,CAAC;GAC/D,SAAS;EACV;CACD;CACA,OAAO;;AAEN,mBAAmB,EAAE,YAAY,kBAA0D,KAC5F;CACA,OAAO,UAA6B;CACpC,MAAM,OAAO,EAAE,OAAO,MAAM,UAAU;EACrC,MAAM,eAAe,WAA+B,IAAI;EAGxD,MAAM,gBAAgB,eAAgB,MAAM,QAAQ,MAAM,GAAG,IAAI,MAAM,IAAI,KAAK,MAAM,GAAI;EAC1F,QAAQ,OAAO,aAAa;EAG5B,MAAM,aAAa,IAA4B,IAAI;EACnD,QAAQ,cAAc,UAAU;EAGhC,MAAM,mBAAmB,IAAI,EAAE;EAC/B,QAAQ,oBAAoB,gBAAgB;EAG5C,MAAM,OAAO,eAAgC;GAC5C,IAAI,OAAO,MAAM,SAAS,YAAY,MAAM,SAAS,MAAM,OAAO,MAAM,KAAK,WAAW,UAAU;GAClG,OA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AAA,OACW;IAAY,SAAS,MAAM;GAAK,GAAA,CACxC,WAAW,CAAA;EAGf,CAAC;EAED,OAAO,UAAU,QAAQ;;AAExB,WACD,CAAC;CACF;AACD,CAAC"}
1
+ {"version":3,"file":"layoutGrid.mjs","names":[],"sources":["../../../../src/components/layoutGrid/src/layoutGrid.tsx"],"sourcesContent":["import { computed, defineComponent, nextTick, onActivated, onDeactivated, onMounted, onUnmounted, provide, ref, shallowRef, watch } from \"vue\";\nimport { definePropType, makeSlots, useExpose, useRender } from \"../../../utils\";\nimport type { VNode, VNodeArrayChildren } from \"vue\";\nimport type { FaLayoutGridBreakpoint, FaLayoutGridItemResponsive } from \"./layoutGrid.type\";\n\n/** FaLayoutGrid 的插槽参数 */\nexport interface FaLayoutGridSlots extends Record<string, unknown> {\n\t/** 默认内容插槽 */\n\tdefault: never;\n}\n\nexport default defineComponent({\n\tname: \"FaLayoutGrid\",\n\tprops: {\n\t\t/** Grid布局列配置 */\n\t\tcols: {\n\t\t\ttype: definePropType<string | number | Partial<Record<FaLayoutGridBreakpoint, number>>>([String, Number, Object]),\n\t\t\tdefault: () => ({ xs: 1, sm: 2, md: 3, lg: 4, xl: 5 }),\n\t\t},\n\t\t/** 折叠 */\n\t\tcollapsed: Boolean,\n\t\t/** 折叠行数 */\n\t\tcollapsedRows: {\n\t\t\ttype: [String, Number],\n\t\t\tdefault: 1,\n\t\t},\n\t\t/** 间距,偏移 */\n\t\tgap: {\n\t\t\ttype: definePropType<number | [number, number]>([Number, Array]),\n\t\t\tdefault: 0,\n\t\t},\n\t},\n\temits: {\n\t\t/** 断点变化事件 */\n\t\tbreakpointChange: ({ breakpoint: _breakpoint }: { breakpoint: FaLayoutGridBreakpoint }) => true,\n\t},\n\tslots: makeSlots<FaLayoutGridSlots>(),\n\tsetup(props, { slots, emit, expose }) {\n\t\tconst containerRef = shallowRef<HTMLElement | null>(null);\n\n\t\t// 注入响应式横向 gap 间距\n\t\tconst horizontalGap = computed(() => (Array.isArray(props.gap) ? props.gap[0] : props.gap));\n\t\tprovide(\"gap\", horizontalGap);\n\n\t\t// 注入响应式断点\n\t\tconst breakpoint = ref<FaLayoutGridBreakpoint>(\"xl\");\n\t\tprovide(\"breakpoint\", breakpoint);\n\n\t\t// 注入要开始折叠的 index\n\t\tconst firstHiddenIndex = ref(-1);\n\t\tprovide(\"firstHiddenIndex\", firstHiddenIndex);\n\n\t\t// 注入 cols\n\t\tconst cols = computed<string | number>(() => {\n\t\t\tif (typeof props.cols === \"object\" && props.cols !== null) return props.cols[breakpoint.value] ?? 1;\n\t\t\treturn props.cols;\n\t\t});\n\t\tprovide(\"cols\", cols);\n\n\t\tconst collapsedRows = computed(() => (typeof props.collapsedRows === \"number\" ? props.collapsedRows : Number(props.collapsedRows)));\n\n\t\t// 设置间距\n\t\tconst gap = computed(() => {\n\t\t\tif (typeof props.gap === \"number\") return `${props.gap}px`;\n\t\t\tif (Array.isArray(props.gap)) return `${props.gap[1]}px ${props.gap[0]}px`;\n\t\t\treturn \"unset\";\n\t\t});\n\n\t\t// 设置 style\n\t\tconst style = computed(() => {\n\t\t\treturn {\n\t\t\t\tdisplay: \"grid\",\n\t\t\t\tgridGap: gap.value,\n\t\t\t\tgridTemplateColumns: `repeat(${cols.value}, minmax(0, 1fr))`,\n\t\t\t};\n\t\t});\n\n\t\t// 断点映射\n\t\tconst breakpoints = {\n\t\t\t// 小于480屏幕(如手机)\n\t\t\txs: { min: 0, max: 479 },\n\t\t\t// 平板竖屏\n\t\t\tsm: { min: 480, max: 768 },\n\t\t\t// 平板横屏\n\t\t\tmd: { min: 768, max: 1024 },\n\t\t\t// 小型桌面\n\t\t\tlg: { min: 1024, max: 1440 },\n\t\t\t// 大型桌面\n\t\t\txl: { min: 1440, max: Infinity },\n\t\t};\n\n\t\t// 监听屏幕变化\n\t\tconst resize = (e: ResizeObserverEntry[]) => {\n\t\t\t// 当前只监听布局容器,ResizeObserver 每次回调应当只有一个目标。\n\t\t\tif (e.length !== 1 || e[0] === undefined) throw new Error(\"FaLayoutGrid 监听到了非预期数量的布局容器。\");\n\t\t\tconst curEl = e[0];\n\t\t\tconst width = curEl.target.scrollWidth;\n\n\t\t\tfor (const [key, { min, max }] of Object.entries(breakpoints)) {\n\t\t\t\tif (width >= min && width <= max) {\n\t\t\t\t\tbreakpoint.value = key as FaLayoutGridBreakpoint;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tlet resizeObserver: ResizeObserver | undefined;\n\t\tconst observeResize = () => {\n\t\t\tconst element = containerRef.value;\n\t\t\tif (!element) return;\n\t\t\tresizeObserver?.disconnect();\n\t\t\tresizeObserver = new ResizeObserver(resize);\n\t\t\tresizeObserver.observe(element);\n\t\t};\n\n\t\twatch(\n\t\t\t() => breakpoint.value,\n\t\t\t(newValue) => {\n\t\t\t\temit(\"breakpointChange\", { breakpoint: newValue });\n\t\t\t}\n\t\t);\n\n\t\tonMounted(() => {\n\t\t\tnextTick(observeResize);\n\t\t\temit(\"breakpointChange\", { breakpoint: breakpoint.value });\n\t\t});\n\n\t\tonActivated(() => nextTick(observeResize));\n\n\t\tonDeactivated(() => {\n\t\t\tresizeObserver?.disconnect();\n\t\t});\n\n\t\tonUnmounted(() => {\n\t\t\tresizeObserver?.disconnect();\n\t\t});\n\n\t\tuseRender(() => {\n\t\t\tconst defaultSlot = slots.default?.() ?? [];\n\n\t\t\tif (props.collapsed) {\n\t\t\t\tconst fields: VNodeArrayChildren = [];\n\t\t\t\tlet suffix: VNode | undefined;\n\n\t\t\t\tdefaultSlot.forEach((slot) => {\n\t\t\t\t\t// suffix\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof slot.type === \"object\" &&\n\t\t\t\t\t\t\"name\" in slot.type &&\n\t\t\t\t\t\tslot.type.name === \"FaLayoutGridItem\" &&\n\t\t\t\t\t\tslot.props?.[\"suffix\"] !== undefined\n\t\t\t\t\t) {\n\t\t\t\t\t\tsuffix = slot;\n\t\t\t\t\t}\n\t\t\t\t\t// slot children\n\t\t\t\t\tif (typeof slot.type === \"symbol\" && Array.isArray(slot.children)) fields.push(...slot.children);\n\t\t\t\t});\n\n\t\t\t\t// 计算 suffix 所占用的列\n\t\t\t\tlet suffixCols = 0;\n\t\t\t\tif (suffix?.props) {\n\t\t\t\t\tconst activeBreakpointProps = suffix.props[breakpoint.value] as FaLayoutGridItemResponsive | undefined;\n\t\t\t\t\tsuffixCols =\n\t\t\t\t\t\t(activeBreakpointProps?.span ?? Number(suffix.props[\"span\"] ?? 1)) +\n\t\t\t\t\t\t(activeBreakpointProps?.offset ?? Number(suffix.props[\"offset\"] ?? 0));\n\t\t\t\t}\n\n\t\t\t\tlet occupiedCols = 0;\n\t\t\t\tfirstHiddenIndex.value = -1;\n\t\t\t\tfor (const [index, current] of fields.entries()) {\n\t\t\t\t\tconst currentVNode = current as VNode;\n\t\t\t\t\tconst currentProps = currentVNode.props;\n\t\t\t\t\tif (currentProps === null) continue;\n\t\t\t\t\tconst activeBreakpointProps = currentProps[breakpoint.value] as FaLayoutGridItemResponsive | undefined;\n\t\t\t\t\toccupiedCols +=\n\t\t\t\t\t\t(activeBreakpointProps?.span ?? Number(currentProps[\"span\"] ?? 1)) +\n\t\t\t\t\t\t(activeBreakpointProps?.offset ?? Number(currentProps[\"offset\"] ?? 0));\n\t\t\t\t\tif (occupiedCols > collapsedRows.value * Number(cols.value) - suffixCols) {\n\t\t\t\t\t\tfirstHiddenIndex.value = index;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfirstHiddenIndex.value = -1;\n\t\t\t}\n\n\t\t\treturn (\n\t\t\t\t<div ref={containerRef} style={style.value}>\n\t\t\t\t\t{defaultSlot}\n\t\t\t\t</div>\n\t\t\t);\n\t\t});\n\n\t\treturn useExpose(expose, {\n\t\t\t/** 响应式断点 */\n\t\t\tbreakpoint,\n\t\t});\n\t},\n});\n"],"mappings":";;;;;;AAWA,IAAA,qBAAe,gBAAgB;C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AK,SAAS,YACrB,UAAU,KAAK,QACf,KAAK,KAAK,SAAS,sBACnB,KAAK,QAAQ,cAAc,KAAA,GAE3B,SAAS;KAGV,IAAI,OAAO,KAAK,SAAS,YAAY,MAAM,QAAQ,KAAK,QAAQ,GAAG,OAAO,KAAK,GAAG,KAAK,QAAQ;IAChG,CAAC;IAGD,IAAI,aAAa;IACjB,IAAI,QAAQ,OAAO;KAClB,MAAM,wBAAwB,OAAO,MAAM,WAAW;KACtD,cACE,uBAAuB,QAAQ,OAAO,OAAO,MAAM,WAAW,CAAC,MAC/D,uBAAuB,UAAU,OAAO,OAAO,MAAM,aAAa,CAAC;IACtE;IAEA,IAAI,eAAe;IACnB,iBAAiB,QAAQ;IACzB,KAAK,MAAM,CAAC,OAAO,YAAY,OAAO,QAAQ,GAAG;KAEhD,MAAM,eAAe,QAAa;KAClC,IAAI,iBAAiB,MAAM;KAC3B,MAAM,wBAAwB,aAAa,WAAW;KACtD,iBACE,uBAAuB,QAAQ,OAAO,aAAa,WAAW,CAAC,MAC/D,uBAAuB,UAAU,OAAO,aAAa,aAAa,CAAC;KACrE,IAAI,eAAe,cAAc,QAAQ,OAAO,KAAK,KAAK,IAAI,YAAY;MACzE,iBAAiB,QAAQ;MACzB;KACD;IACD;GACD,OACC,iBAAiB,QAAQ;GAG1B,OAAA,YAAA,OAAA;IAAA,OACW;IAAY,SAAS,MAAM;GAAK,GAAA,CACxC,WAAW,CAAA;EAGf,CAAC;EAED,OAAO,UAAU,QAAQ;;AAExB,WACD,CAAC;CACF;AACD,CAAC"}
@@ -1,89 +1,89 @@
1
1
  import type { FaLayoutGridItemResponsive } from "./layoutGrid.type";
2
- /** FaLayoutGridItem 的插槽参数。 */
2
+ /** FaLayoutGridItem 的插槽参数 */
3
3
  export interface FaLayoutGridItemSlots extends Record<string, unknown> {
4
- /** @description 默认内容插槽 */
4
+ /** 默认内容插槽 */
5
5
  default: never;
6
6
  }
7
7
  declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
8
- /** @description 偏移 */
8
+ /** 偏移 */
9
9
  offset: {
10
10
  type: (NumberConstructor | StringConstructor)[];
11
11
  default: number;
12
12
  };
13
- /** @description 占位 */
13
+ /** 占位 */
14
14
  span: {
15
15
  type: (NumberConstructor | StringConstructor)[];
16
16
  default: number;
17
17
  };
18
- /** @description 后缀 */
18
+ /** 后缀 */
19
19
  suffix: {
20
20
  type: BooleanConstructor;
21
21
  default: boolean;
22
22
  };
23
- /** @description 响应式,小于480px屏幕配置 */
23
+ /** 响应式,小于480px屏幕配置 */
24
24
  xs: {
25
25
  type: import("vue").PropType<FaLayoutGridItemResponsive>;
26
26
  default: undefined;
27
27
  };
28
- /** @description 响应式,平板竖屏配置 */
28
+ /** 响应式,平板竖屏配置 */
29
29
  sm: {
30
30
  type: import("vue").PropType<FaLayoutGridItemResponsive>;
31
31
  default: undefined;
32
32
  };
33
- /** @description 响应式,平板横屏配置 */
33
+ /** 响应式,平板横屏配置 */
34
34
  md: {
35
35
  type: import("vue").PropType<FaLayoutGridItemResponsive>;
36
36
  default: undefined;
37
37
  };
38
- /** @description 响应式,小型桌面配置 */
38
+ /** 响应式,小型桌面配置 */
39
39
  lg: {
40
40
  type: import("vue").PropType<FaLayoutGridItemResponsive>;
41
41
  default: undefined;
42
42
  };
43
- /** @description 响应式,大型桌面配置 */
43
+ /** 响应式,大型桌面配置 */
44
44
  xl: {
45
45
  type: import("vue").PropType<FaLayoutGridItemResponsive>;
46
46
  default: undefined;
47
47
  };
48
48
  }>, {
49
- show: boolean;
49
+ show: import("vue").ComputedRef<boolean>;
50
50
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
51
- /** @description 偏移 */
51
+ /** 偏移 */
52
52
  offset: {
53
53
  type: (NumberConstructor | StringConstructor)[];
54
54
  default: number;
55
55
  };
56
- /** @description 占位 */
56
+ /** 占位 */
57
57
  span: {
58
58
  type: (NumberConstructor | StringConstructor)[];
59
59
  default: number;
60
60
  };
61
- /** @description 后缀 */
61
+ /** 后缀 */
62
62
  suffix: {
63
63
  type: BooleanConstructor;
64
64
  default: boolean;
65
65
  };
66
- /** @description 响应式,小于480px屏幕配置 */
66
+ /** 响应式,小于480px屏幕配置 */
67
67
  xs: {
68
68
  type: import("vue").PropType<FaLayoutGridItemResponsive>;
69
69
  default: undefined;
70
70
  };
71
- /** @description 响应式,平板竖屏配置 */
71
+ /** 响应式,平板竖屏配置 */
72
72
  sm: {
73
73
  type: import("vue").PropType<FaLayoutGridItemResponsive>;
74
74
  default: undefined;
75
75
  };
76
- /** @description 响应式,平板横屏配置 */
76
+ /** 响应式,平板横屏配置 */
77
77
  md: {
78
78
  type: import("vue").PropType<FaLayoutGridItemResponsive>;
79
79
  default: undefined;
80
80
  };
81
- /** @description 响应式,小型桌面配置 */
81
+ /** 响应式,小型桌面配置 */
82
82
  lg: {
83
83
  type: import("vue").PropType<FaLayoutGridItemResponsive>;
84
84
  default: undefined;
85
85
  };
86
- /** @description 响应式,大型桌面配置 */
86
+ /** 响应式,大型桌面配置 */
87
87
  xl: {
88
88
  type: import("vue").PropType<FaLayoutGridItemResponsive>;
89
89
  default: undefined;
@@ -7,42 +7,42 @@ import { computed, createVNode, defineComponent, inject, reactive, ref, vShow, w
7
7
  var layoutGridItem_default = defineComponent({
8
8
  name: "FaLayoutGridItem",
9
9
  props: {
10
- /** @description 偏移 */
10
+ /** 偏移 */
11
11
  offset: {
12
12
  type: [String, Number],
13
13
  default: 0
14
14
  },
15
- /** @description 占位 */
15
+ /** 占位 */
16
16
  span: {
17
17
  type: [String, Number],
18
18
  default: 1
19
19
  },
20
- /** @description 后缀 */
20
+ /** 后缀 */
21
21
  suffix: {
22
22
  type: Boolean,
23
23
  default: false
24
24
  },
25
- /** @description 响应式,小于480px屏幕配置 */
25
+ /** 响应式,小于480px屏幕配置 */
26
26
  xs: {
27
27
  type: definePropType(Object),
28
28
  default: void 0
29
29
  },
30
- /** @description 响应式,平板竖屏配置 */
30
+ /** 响应式,平板竖屏配置 */
31
31
  sm: {
32
32
  type: definePropType(Object),
33
33
  default: void 0
34
34
  },
35
- /** @description 响应式,平板横屏配置 */
35
+ /** 响应式,平板横屏配置 */
36
36
  md: {
37
37
  type: definePropType(Object),
38
38
  default: void 0
39
39
  },
40
- /** @description 响应式,小型桌面配置 */
40
+ /** 响应式,小型桌面配置 */
41
41
  lg: {
42
42
  type: definePropType(Object),
43
43
  default: void 0
44
44
  },
45
- /** @description 响应式,大型桌面配置 */
45
+ /** 响应式,大型桌面配置 */
46
46
  xl: {
47
47
  type: definePropType(Object),
48
48
  default: void 0
@@ -75,7 +75,7 @@ var layoutGridItem_default = defineComponent({
75
75
  if (Number.isInteger(index)) state.show = !(n[0] !== -1 && index >= Number(n[0]));
76
76
  }, { immediate: true });
77
77
  useRender(() => withDirectives(createVNode("div", { "style": style.value }, [slots.default?.()]), [[vShow, state.show]]));
78
- return useExpose(expose, { show: state.show });
78
+ return useExpose(expose, { show: computed(() => state.show) });
79
79
  }
80
80
  });
81
81
  //#endregion