@elementplus-kit/uikit 1.7.0 → 1.8.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 (36) hide show
  1. package/components/button/index.ts +2 -4
  2. package/components/button/src/index.ts +58 -53
  3. package/components/button/src/type.ts +15 -0
  4. package/components/dialog/index.ts +2 -6
  5. package/components/dialog/src/index.ts +3 -3
  6. package/components/dialog/src/type.ts +1 -0
  7. package/components/dictLabel/src/type.ts +1 -0
  8. package/components/drawer/index.ts +2 -4
  9. package/components/drawer/src/index.ts +3 -3
  10. package/components/drawer/src/type.ts +1 -0
  11. package/components/form/index.ts +2 -4
  12. package/components/form/src/FormItem.ts +24 -16
  13. package/components/form/src/index.ts +4 -4
  14. package/components/form/src/type.ts +68 -0
  15. package/components/importText/index.ts +2 -0
  16. package/components/importText/src/index.ts +1 -0
  17. package/components/importText/src/type.ts +3 -0
  18. package/components/index.ts +10 -31
  19. package/components/pagination/index.ts +2 -4
  20. package/components/pagination/src/index.ts +4 -4
  21. package/components/pagination/src/type.ts +1 -0
  22. package/components/search/index.ts +2 -4
  23. package/components/search/src/index.tsx +47 -35
  24. package/components/search/src/type.ts +2 -0
  25. package/components/table/index.ts +2 -4
  26. package/components/table/src/index.ts +5 -4
  27. package/components/table/src/type.ts +19 -0
  28. package/dist/index.css +1 -0
  29. package/dist/index.mjs +1079 -0
  30. package/dist/index.umd.js +1 -0
  31. package/package.json +1 -1
  32. package/build.log +0 -0
  33. package/components/form/src/types.ts +0 -39
  34. package/components/table/src/index2.ts +0 -219
  35. package/components/table/src/index3.ts +0 -233
  36. package/components/table/src/tableaa.ts +0 -71
@@ -1,27 +1,39 @@
1
- import { ref, defineComponent, onMounted, onUnmounted, nextTick, watch } from "vue";
1
+ import {
2
+ ref,
3
+ defineComponent,
4
+ onMounted,
5
+ onUnmounted,
6
+ type PropType,
7
+ type ExtractPropTypes,
8
+ } from "vue";
2
9
 
3
10
  import { CForm, CDrawer } from "@elementplus-kit/uikit";
4
11
  import { ArrowUpBold } from "@element-plus/icons-vue";
5
12
  import "../style/index.scss";
6
13
 
7
- export default defineComponent({
8
- props: {
9
- modelValue: {
10
- type: Object,
11
- default: {},
12
- },
13
- formOptions: {
14
- type: Array,
15
- default: () => [],
16
- },
17
- isDrawer: {
18
- type: Boolean,
19
- default: false,
20
- },
14
+ import { FormOptions } from "../../form/src/type.ts";
15
+
16
+ export type SearchAttrs = ExtractPropTypes<typeof searchAttrs>;
17
+
18
+ const searchAttrs = {
19
+ modelValue: {
20
+ type: Object,
21
+ default: {},
21
22
  },
23
+ formOptions: {
24
+ type: Array as PropType<FormOptions>,
25
+ default: () => [],
26
+ },
27
+ isDrawer: {
28
+ type: Boolean,
29
+ default: false,
30
+ },
31
+ }
32
+ export default defineComponent({
33
+ props: searchAttrs,
22
34
  emits: ["update:modelValue", "search", "reset", "close"],
23
35
 
24
- setup(props, { emit, slots, attrs, expose }) {
36
+ setup(props: SearchAttrs, { emit, slots, attrs, expose }) {
25
37
  // 自己的 slot
26
38
  const slotsList = ["btn-left", "btn-right"];
27
39
  // 解析 attrs 中的事件
@@ -207,8 +219,9 @@ export default defineComponent({
207
219
  {slots["arrow-left"]?.()}
208
220
  {showCount.value < props.formOptions?.length && (
209
221
  <div
210
- className={`c-search-simple-icon ${showSearchForm.value ? "icon-rotate" : ""
211
- }`}
222
+ className={`c-search-simple-icon ${
223
+ showSearchForm.value ? "icon-rotate" : ""
224
+ }`}
212
225
  onClick={handleShow}
213
226
  >
214
227
  <el-icon className="el-icon c-search-icon">
@@ -216,21 +229,20 @@ export default defineComponent({
216
229
  </el-icon>
217
230
  </div>
218
231
  )}
219
- {slots["search-btn"]
220
- ? slots["search-btn"]()
221
- : (
222
- <>
223
- {slots["btn-left"]?.()}
224
- <el-button type="primary" onClick={handleSearch}>
225
- 搜索
226
- </el-button>
227
- <el-button type="primary" onClick={handleReset}>
228
- 重置
229
- </el-button>
230
- {slots["btn-right"]?.()}
231
- </>
232
- )
233
- }
232
+ {slots["search-btn"] ? (
233
+ slots["search-btn"]()
234
+ ) : (
235
+ <>
236
+ {slots["btn-left"]?.()}
237
+ <el-button type="primary" onClick={handleSearch}>
238
+ 搜索
239
+ </el-button>
240
+ <el-button type="primary" onClick={handleReset}>
241
+ 重置
242
+ </el-button>
243
+ {slots["btn-right"]?.()}
244
+ </>
245
+ )}
234
246
  </div>
235
247
  </div>
236
248
 
@@ -246,7 +258,7 @@ export default defineComponent({
246
258
  inline
247
259
  model={props.modelValue}
248
260
  formOptions={props.formOptions.filter(
249
- (item, index) => index >= showCount.value
261
+ (item, index) => index >= showCount.value,
250
262
  )}
251
263
  ref="formRef"
252
264
  >
@@ -271,7 +283,7 @@ export default defineComponent({
271
283
  col={12}
272
284
  model={props.modelValue}
273
285
  formOptions={props.formOptions.filter(
274
- (item, index) => index >= showCount.value
286
+ (item, index) => index >= showCount.value,
275
287
  )}
276
288
  ref="formRef"
277
289
  >
@@ -0,0 +1,2 @@
1
+ export type { SearchAttrs as SearchProps } from "./index.tsx";
2
+ export default "./index.tsx";
@@ -1,4 +1,2 @@
1
- import Table from "./src/index";
2
- export * from "./src/index";
3
- export { Table };
4
- export default Table;
1
+ export * from "./src/type.ts";
2
+ export default "./src/index.ts";
@@ -14,7 +14,7 @@ import {
14
14
  indexColumn,
15
15
  } from "./constants.ts";
16
16
  import { isArray, isObject, isFunction } from "lodash-es";
17
- const propsAttrs = {
17
+ const tableAttrs = {
18
18
  module: {
19
19
  type: Object,
20
20
  default: () => {},
@@ -49,14 +49,15 @@ const propsAttrs = {
49
49
  },
50
50
  };
51
51
 
52
- export type PropsAttrs = ExtractPropTypes<typeof propsAttrs>;
52
+ // 类型处理
53
+ export type TableAttrs = ExtractPropTypes<typeof tableAttrs>;
53
54
 
54
55
  export default defineComponent({
55
- props: propsAttrs,
56
+ props: tableAttrs,
56
57
  // emits: eventList,
57
58
 
58
59
  // attrs, emit会继承, slots需要设置
59
- setup(props: PropsAttrs, { attrs, emit, slots, expose }) {
60
+ setup(props: TableAttrs, { attrs, emit, slots, expose }) {
60
61
  // 暴露elTable组件上的方法
61
62
  const vm = getCurrentInstance(); // 获取虚拟DOM实例
62
63
  const cTableFnRef = (el) => {
@@ -0,0 +1,19 @@
1
+ import { type ExtractPropTypes } from "vue";
2
+ import type { TableColumnCtx } from "element-plus";
3
+ import elTableDefaults from "element-plus/es/components/table/src/table/defaults";
4
+ type Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never; // 展开类型工具
5
+
6
+ import { type TableAttrs } from "./index.ts";
7
+
8
+ // 表格属性
9
+ type ElTableProps = ExtractPropTypes<typeof elTableDefaults>;
10
+ export type TableProps = Expand<Partial<TableAttrs>> &
11
+ Expand<Partial<ElTableProps>>;
12
+
13
+ // 表格项属性
14
+ export type TableColumnProps = {
15
+ vIf?: (params: any) => boolean;
16
+ render?: (scope: any) => any;
17
+ options?: Array<{ label: string; value: any }>;
18
+ children?: Array<TableColumnProps>;
19
+ } & Expand<Partial<TableColumnCtx>>;
package/dist/index.css ADDED
@@ -0,0 +1 @@
1
+ @charset "UTF-8";.c-form.el-form--inline .el-select{--el-select-width: 220px}.search-btn{margin-right:20px;margin-left:auto}.c-search{position:relative;height:50px}.c-search .c-search-simple{display:flex;justify-content:space-between}.c-search .c-search-simple-form{flex:1;overflow:auto;scrollbar-width:none}.c-search .c-simple-form-container{display:inline-block}.c-search .c-simple-form-container>.c-form{white-space:nowrap}.c-search .c-search-simple-btn{display:flex;margin-left:auto}.c-search .c-search-simple-icon{display:flex;justify-content:center;align-items:center;cursor:pointer;height:32px;width:32px;margin-right:10px;border-radius:4px;background-color:#409eff;transition:all .2s}.c-search .c-search-simple-icon:hover{background-color:#79bbff}.c-search .c-search-simple-icon:active{background-color:#337ecc}.c-search .c-search-icon{color:#fff;transition:all .2s}.c-search .icon-rotate{background-color:#337ecc}.c-search .icon-rotate .c-search-icon{transform:rotate(180deg)}.c-search .c-search-form{width:100%;position:absolute;top:50px;left:0;overflow:hidden;z-index:10;background-color:#fff}.search-form-transition-enter-active,.search-form-transition-leave-active{transition:all .3s ease;overflow:hidden;max-height:500px}.search-form-transition-enter-from,.search-form-transition-leave-to{max-height:0;opacity:0;padding-top:0;padding-bottom:0}.el-button+.el-dropdown{margin-left:10px}