@tmagic/element-plus-adapter 1.6.1 → 1.7.0-beta.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.
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.6.1",
2
+ "version": "1.7.0-beta.1",
3
3
  "name": "@tmagic/element-plus-adapter",
4
4
  "type": "module",
5
5
  "main": "dist/tmagic-element-plus-adapter.umd.cjs",
@@ -37,7 +37,7 @@
37
37
  "peerDependencies": {
38
38
  "element-plus": ">=2.9.0",
39
39
  "typescript": "^5.9.3",
40
- "@tmagic/design": "1.6.1"
40
+ "@tmagic/design": "1.7.0-beta.1"
41
41
  },
42
42
  "peerDependenciesMeta": {
43
43
  "typescript": {
@@ -0,0 +1,26 @@
1
+ <template>
2
+ <ElFormItem v-bind="itemProps">
3
+ <template #label>
4
+ <slot name="label"></slot>
5
+ </template>
6
+ <slot></slot>
7
+ <div v-if="extra" v-html="extra" class="m-form-tip"></div>
8
+ </ElFormItem>
9
+ </template>
10
+
11
+ <script setup lang="ts">
12
+ import { computed } from 'vue';
13
+
14
+ import { FormItemProps } from '@tmagic/design';
15
+
16
+ defineOptions({
17
+ name: 'TElAdapterFormItem',
18
+ });
19
+
20
+ const props = defineProps<FormItemProps>();
21
+
22
+ const itemProps = computed(() => {
23
+ const { extra, ...rest } = props;
24
+ return rest;
25
+ });
26
+ </script>
package/src/Table.vue ADDED
@@ -0,0 +1,92 @@
1
+ <template>
2
+ <ElTable
3
+ ref="table"
4
+ :data="data"
5
+ :border="border"
6
+ :max-height="maxHeight"
7
+ :default-expand-all="defaultExpandAll"
8
+ :show-header="showHeader"
9
+ :row-key="rowKey"
10
+ :tree-props="treeProps"
11
+ :empty-text="emptyText"
12
+ :show-overflow-tooltip="showOverflowTooltip"
13
+ :tooltip-effect="tooltipEffect"
14
+ :tooltip-options="tooltipOptions"
15
+ :span-method="spanMethod"
16
+ @sort-change="sortChange"
17
+ @select="selectHandler"
18
+ @select-all="selectAllHandler"
19
+ @selection-change="selectionChangeHandler"
20
+ @cell-click="cellClickHandler"
21
+ @expand-change="expandChange"
22
+ >
23
+ <template v-for="(item, columnIndex) in columns" :key="columnIndex">
24
+ <ElTableColumn v-bind="item.props || {}">
25
+ <template #default="scope" v-if="item.cell">
26
+ <component :is="item.cell(scope)"></component>
27
+ </template>
28
+ </ElTableColumn>
29
+ </template>
30
+ </ElTable>
31
+ </template>
32
+
33
+ <script setup lang="ts">
34
+ import { useTemplateRef } from 'vue';
35
+ import { ElTable, ElTableColumn } from 'element-plus';
36
+
37
+ import type { TableProps } from '@tmagic/design';
38
+
39
+ defineOptions({
40
+ name: 'TElAdapterTable',
41
+ });
42
+
43
+ const emit = defineEmits(['sort-change', 'select', 'select-all', 'selection-change', 'expand-change', 'cell-click']);
44
+
45
+ defineProps<TableProps>();
46
+
47
+ const tableRef = useTemplateRef('table');
48
+
49
+ const sortChange = (data: any) => {
50
+ emit('sort-change', data);
51
+ };
52
+
53
+ const selectHandler = (...args: any[]) => {
54
+ emit('select', ...args);
55
+ };
56
+
57
+ const selectAllHandler = (...args: any[]) => {
58
+ emit('select-all', ...args);
59
+ };
60
+
61
+ const selectionChangeHandler = (...args: any[]) => {
62
+ emit('selection-change', ...args);
63
+ };
64
+
65
+ const cellClickHandler = (...args: any[]) => {
66
+ emit('cell-click', ...args);
67
+ };
68
+
69
+ const expandChange = (...args: any[]) => {
70
+ emit('expand-change', ...args);
71
+ };
72
+
73
+ const toggleRowSelection = (row: any, selected: boolean) => {
74
+ tableRef.value?.toggleRowSelection(row, selected);
75
+ };
76
+
77
+ const toggleRowExpansion = (row: any, expanded: boolean) => {
78
+ tableRef.value?.toggleRowExpansion(row, expanded);
79
+ };
80
+
81
+ const clearSelection = () => {
82
+ tableRef.value?.clearSelection();
83
+ };
84
+
85
+ defineExpose({
86
+ getEl: () => tableRef.value?.$el,
87
+ getTableRef: () => tableRef.value,
88
+ clearSelection,
89
+ toggleRowSelection,
90
+ toggleRowExpansion,
91
+ });
92
+ </script>
package/src/index.ts CHANGED
@@ -18,7 +18,6 @@ import {
18
18
  ElDropdownItem,
19
19
  ElDropdownMenu,
20
20
  ElForm,
21
- ElFormItem,
22
21
  ElIcon,
23
22
  ElInput,
24
23
  ElInputNumber,
@@ -28,6 +27,7 @@ import {
28
27
  ElOption,
29
28
  ElOptionGroup,
30
29
  ElPagination,
30
+ ElPopconfirm,
31
31
  ElRadio,
32
32
  ElRadioButton,
33
33
  ElRadioGroup,
@@ -37,14 +37,11 @@ import {
37
37
  ElStep,
38
38
  ElSteps,
39
39
  ElSwitch,
40
- ElTable,
41
- ElTableColumn,
42
40
  ElTabPane,
43
41
  ElTabs,
44
42
  ElTag,
45
43
  ElTimePicker,
46
44
  ElTooltip,
47
- ElTree,
48
45
  ElUpload,
49
46
  useZIndex,
50
47
  } from 'element-plus';
@@ -76,6 +73,7 @@ import type {
76
73
  OptionGroupProps,
77
74
  OptionProps,
78
75
  PaginationProps,
76
+ PopconfirmProps,
79
77
  RadioButtonProps,
80
78
  RadioGroupProps,
81
79
  RadioProps,
@@ -83,17 +81,18 @@ import type {
83
81
  StepProps,
84
82
  StepsProps,
85
83
  SwitchProps,
86
- TableColumnProps,
87
84
  TableProps,
88
85
  TabPaneProps,
89
86
  TabsProps,
90
87
  TagProps,
91
88
  TimePickerProps,
92
89
  TooltipProps,
93
- TreeProps,
94
90
  UploadProps,
95
91
  } from '@tmagic/design';
96
92
 
93
+ import FormItem from './FormItem.vue';
94
+ import Table from './Table.vue';
95
+
97
96
  const adapter: DesignPluginOptions = {
98
97
  useZIndex,
99
98
  message: ElMessage,
@@ -195,7 +194,7 @@ const adapter: DesignPluginOptions = {
195
194
  },
196
195
 
197
196
  formItem: {
198
- component: ElFormItem as any,
197
+ component: FormItem as any,
199
198
  props: (props: FormItemProps) => props,
200
199
  },
201
200
 
@@ -275,15 +274,10 @@ const adapter: DesignPluginOptions = {
275
274
  },
276
275
 
277
276
  table: {
278
- component: ElTable as any,
277
+ component: Table as any,
279
278
  props: (props: TableProps) => props,
280
279
  },
281
280
 
282
- tableColumn: {
283
- component: ElTableColumn as any,
284
- props: (props: TableColumnProps) => props,
285
- },
286
-
287
281
  tabPane: {
288
282
  component: ElTabPane as any,
289
283
  props: (props: TabPaneProps) => props,
@@ -309,15 +303,15 @@ const adapter: DesignPluginOptions = {
309
303
  props: (props: TooltipProps) => props,
310
304
  },
311
305
 
312
- tree: {
313
- component: ElTree as any,
314
- props: (props: TreeProps) => props,
315
- },
316
-
317
306
  upload: {
318
307
  component: ElUpload as any,
319
308
  props: (props: UploadProps) => props,
320
309
  },
310
+
311
+ popconfirm: {
312
+ component: ElPopconfirm as any,
313
+ props: (props: PopconfirmProps) => props,
314
+ },
321
315
  },
322
316
  loading: ElLoading.directive,
323
317
  };