@vue-ui-kit/ant 2.5.0 → 2.5.2

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,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-ui-kit/ant",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
4
4
  "description": "Vue3 UI Kit based on Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -27,7 +27,8 @@
27
27
  "tsconfig.json"
28
28
  ],
29
29
  "scripts": {
30
- "dev": "vue-tsc --noEmit --skipLibCheck & vite",
30
+ "dev": "ts-patch uninstall && vue-tsc --noEmit --skipLibCheck & vite",
31
+ "typecheck": "ts-patch uninstall && vue-tsc --noEmit --skipLibCheck",
31
32
  "build": "ts-patch install && vite build && sass src/packages/styles/index.scss dist/style.css --no-source-map",
32
33
  "prepack": "rimraf dist && pnpm build",
33
34
  "prepare": "husky",
@@ -46,8 +47,8 @@
46
47
  "email": "adoin@qq.com"
47
48
  },
48
49
  "dependencies": {
49
- "e-virt-table": "^1.3.25",
50
- "uuid": "^10.0.0",
50
+ "e-virt-table": "1.4.2",
51
+ "uuid": "^11.1.1",
51
52
  "xe-utils": "^3.7.6"
52
53
  },
53
54
  "peerDependencies": {
@@ -63,7 +64,6 @@
63
64
  "@ant-design/icons-vue": ">=7.0.0",
64
65
  "@commitlint/cli": "^21.0.0",
65
66
  "@commitlint/config-conventional": "^21.0.0",
66
- "@types/uuid": "^10.0.0",
67
67
  "@vitejs/plugin-vue": "^6.0.5",
68
68
  "@vitejs/plugin-vue-jsx": "^5.1.5",
69
69
  "ant-design-vue": "^4.2.3",
@@ -79,6 +79,7 @@
79
79
  "vite": "^8.0.8",
80
80
  "vite-plugin-dts": "^4.5.4",
81
81
  "vue": "^3.5.33",
82
+ "vue-tsc": "3.3.5",
82
83
  "vue-types": "^3.0.2"
83
84
  }
84
85
  }
@@ -1,23 +1,5 @@
1
- <script
2
- lang="ts"
3
- setup
4
- generic="D extends Recordable = Recordable, F extends Recordable = Recordable"
5
- name="PCanvasGrid"
6
- >
7
- import PCanvasTable from './PCanvasTable.vue';
8
- import {
9
- computed,
10
- useAttrs,
11
- ref,
12
- Ref,
13
- reactive,
14
- onMounted,
15
- nextTick,
16
- toRefs,
17
- onBeforeUnmount,
18
- watch,
19
- } from 'vue';
20
- import { debounce, get, isBoolean, isFunction, isObject, isString, omit, uniq } from 'xe-utils';
1
+ <script lang="ts" setup generic="D extends Recordable = Recordable, F extends Recordable = Recordable"
2
+ name="PCanvasGrid">
21
3
  import {
22
4
  CanvasColumnProps,
23
5
  PCanvasGridProps,
@@ -25,28 +7,42 @@
25
7
  PFormItemProps,
26
8
  ResponsePathConfig,
27
9
  } from '#/antProxy';
28
- import { v4 as uuid_v4 } from 'uuid';
29
- import { isGoodValue } from '@/utils/is';
30
10
  import PFormCol from '@/components/PFormCol.vue';
31
- import { defaultLabelCol } from '@/utils/core';
32
- import Icon from '@/renders/Icon';
33
11
  import { $confirm, $error, $success, $warning } from '@/hooks/useMessage';
34
- import {
35
- Button as AButton,
36
- Form as AForm,
37
- Row as ARow,
38
- Spin as ASpin,
39
- Pagination as APagination,
40
- } from 'ant-design-vue';
41
- import { DownOutlined } from '@ant-design/icons-vue';
42
- import { getCanvasTableDefaults, getGridDefaults } from '@/utils/config';
12
+ import Icon from '@/renders/Icon';
43
13
  import {
44
14
  createAutoViewportBoxController,
45
15
  parseAutoViewportBoxOffset,
46
16
  type AutoViewportBoxController,
47
17
  type AutoViewportBoxOffsetInput,
48
18
  } from '@/utils/autoViewportBox';
19
+ import { getCanvasTableDefaults, getGridDefaults } from '@/utils/config';
20
+ import { defaultLabelCol } from '@/utils/core';
21
+ import { isGoodValue } from '@/utils/is';
49
22
  import { eachTree } from '@/utils/treeHelper';
23
+ import { DownOutlined } from '@ant-design/icons-vue';
24
+ import {
25
+ Button as AButton,
26
+ Form as AForm,
27
+ Pagination as APagination,
28
+ Row as ARow,
29
+ Spin as ASpin,
30
+ } from 'ant-design-vue';
31
+ import { v4 as uuid_v4 } from 'uuid';
32
+ import {
33
+ Ref,
34
+ computed,
35
+ nextTick,
36
+ onBeforeUnmount,
37
+ onMounted,
38
+ reactive,
39
+ ref,
40
+ toRefs,
41
+ useAttrs,
42
+ watch,
43
+ } from 'vue';
44
+ import { debounce, get, isBoolean, isFunction, isObject, isString, omit, uniq } from 'xe-utils';
45
+ import PCanvasTable from './PCanvasTable.vue';
50
46
  const props = withDefaults(defineProps<PCanvasGridProps<D, F>>(), {
51
47
  lazyReset: () => getGridDefaults().lazyReset ?? false,
52
48
  fitHeight: () => getGridDefaults().fitCanvasHeight ?? 0,
@@ -99,13 +95,13 @@
99
95
  const pg = computed(() =>
100
96
  mode.value === 'pagination'
101
97
  ? {
102
- current: pagination.page,
103
- total: totalCount.value,
104
- pageSize: pagination.size,
105
- responsive: false,
106
- showSizeChanger: true,
107
- showTotal: (total: number) => `共${total}条数据`,
108
- }
98
+ current: pagination.page,
99
+ total: totalCount.value,
100
+ pageSize: pagination.size,
101
+ responsive: false,
102
+ showSizeChanger: true,
103
+ showTotal: (total: number) => `共${total}条数据`,
104
+ }
109
105
  : false,
110
106
  );
111
107
 
@@ -188,30 +184,30 @@
188
184
  const handleResponse = (response: Recordable, pathConfig?: ResponsePathConfig<D>) =>
189
185
  pathConfig
190
186
  ? {
191
- list: isString(pathConfig.list)
192
- ? get(response, pathConfig.list)
193
- : isFunction(pathConfig.list)
194
- ? pathConfig.list(response)
195
- : undefined,
196
- total: isString(pathConfig.total)
197
- ? get(response, pathConfig.total)
198
- : isFunction(pathConfig.total)
199
- ? pathConfig.total(response)
200
- : undefined,
201
- result: isString(pathConfig.result)
202
- ? get(response, pathConfig.result)
203
- : isFunction(pathConfig.result)
204
- ? pathConfig.result(response)
205
- : undefined,
206
- message: isString(pathConfig.message)
207
- ? get(response, pathConfig.message)
208
- : isFunction(pathConfig.message)
209
- ? pathConfig.message(response)
210
- : undefined,
211
- }
187
+ list: isString(pathConfig.list)
188
+ ? get(response, pathConfig.list)
189
+ : isFunction(pathConfig.list)
190
+ ? pathConfig.list(response)
191
+ : undefined,
192
+ total: isString(pathConfig.total)
193
+ ? get(response, pathConfig.total)
194
+ : isFunction(pathConfig.total)
195
+ ? pathConfig.total(response)
196
+ : undefined,
197
+ result: isString(pathConfig.result)
198
+ ? get(response, pathConfig.result)
199
+ : isFunction(pathConfig.result)
200
+ ? pathConfig.result(response)
201
+ : undefined,
202
+ message: isString(pathConfig.message)
203
+ ? get(response, pathConfig.message)
204
+ : isFunction(pathConfig.message)
205
+ ? pathConfig.message(response)
206
+ : undefined,
207
+ }
212
208
  : {
213
- list: response,
214
- };
209
+ list: response,
210
+ };
215
211
  const toolBtnClick = (code: string) => {
216
212
  emit('toolbarButtonClick', {
217
213
  data: tableData.value,
@@ -333,31 +329,31 @@
333
329
  const firstColumn: CanvasColumnProps<D> =
334
330
  staticConfig.value.selectable && staticConfig.value.tree
335
331
  ? {
336
- type: 'selection-tree',
332
+ type: 'selection-tree',
333
+ width: 40,
334
+ widthFillDisable: true,
335
+ title: '',
336
+ }
337
+ : staticConfig.value.selectable
338
+ ? {
339
+ type: 'selection',
337
340
  width: 40,
338
341
  widthFillDisable: true,
339
342
  title: '',
340
343
  }
341
- : staticConfig.value.selectable
342
- ? {
343
- type: 'selection',
344
+ : staticConfig.value.tree
345
+ ? {
346
+ type: 'tree',
344
347
  width: 40,
345
348
  widthFillDisable: true,
346
349
  title: '',
347
350
  }
348
- : staticConfig.value.tree
349
- ? {
350
- type: 'tree',
351
- width: 40,
352
- widthFillDisable: true,
353
- title: '',
354
- }
355
351
  : {
356
- type: 'index',
357
- width: 40,
358
- widthFillDisable: true,
359
- title: '',
360
- };
352
+ type: 'index',
353
+ width: 40,
354
+ widthFillDisable: true,
355
+ title: '',
356
+ };
361
357
  return [firstColumn, ...columns.value];
362
358
  });
363
359
  const resetQueryFormData = (lazy?: boolean) => {
@@ -535,66 +531,40 @@
535
531
  });
536
532
  </script>
537
533
  <template>
538
- <div
539
- ref="boxEl"
540
- :class="[
541
- 'p-wrapper flex flex-col gap-8px overflow-y-auto',
542
- autoBoxSize ? 'min-h-0 min-w-0 flex-1 w-full' : 'h-full',
543
- ]"
544
- v-bind="attrs"
545
- >
534
+ <div ref="boxEl" :class="[
535
+ 'p-wrapper flex flex-col gap-8px overflow-y-auto',
536
+ autoBoxSize ? 'min-h-0 min-w-0 flex-1 w-full' : 'h-full',
537
+ ]" v-bind="attrs">
546
538
  <div v-if="mode === 'bad'">请检查配置</div>
547
539
  <template v-else>
548
- <div
549
- v-if="formConfig?.items?.some((s: PFormItemProps<F>) => s.field && s.itemRender)"
550
- class="p-pane p-form-wrapper"
551
- ref="pFormWrapper"
552
- >
540
+ <div v-if="formConfig?.items?.some((s: PFormItemProps<F>) => s.field && s.itemRender)"
541
+ class="p-pane p-form-wrapper" ref="pFormWrapper">
553
542
  <a-spin :spinning="loading.form">
554
- <a-form
555
- :key="renderFormKey"
556
- ref="formEl"
557
- :model="queryFormData"
558
- v-bind="fc"
559
- @submit="handleFormSubmit"
560
- >
543
+ <a-form :key="renderFormKey" ref="formEl" :model="queryFormData" v-bind="fc" @submit="handleFormSubmit">
561
544
  <a-row :gutter="[6, 12]">
562
- <p-form-col
563
- v-for="(item, idx) in formConfig!.items"
564
- :key="`_col_${item.field || idx}`"
565
- :form-data="queryFormData"
566
- :item="item as PFormItemProps<Partial<F>>"
567
- @reset="resetQueryFormData(props.lazyReset)"
568
- />
545
+ <p-form-col v-for="(item, idx) in formConfig!.items" :key="`_col_${item.field || idx}`"
546
+ :form-data="queryFormData" :item="item as PFormItemProps<Partial<F>>"
547
+ @reset="resetQueryFormData(props.lazyReset)" />
569
548
  </a-row>
570
549
  </a-form>
571
550
  </a-spin>
572
551
  </div>
573
- <div
574
- v-if="toolbarConfig"
575
- class="p-canvas-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"
576
- >
552
+ <div v-if="toolbarConfig"
553
+ class="p-canvas-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px">
577
554
  <div class="flex items-center flex-1 gap-4px">
578
555
  <template v-if="toolbarConfig.buttons && toolbarConfig.buttons.length > 0">
579
556
  <template v-for="(btn, idx) in toolbarConfig.buttons" :key="idx">
580
557
  <a-dropdown v-if="btn.dropdowns && btn.dropdowns.length">
581
558
  <template #overlay>
582
559
  <a-menu @click="toolBtnMenuClick">
583
- <a-menu-item v-for="sub in btn.dropdowns" :key="sub.code"
584
- >{{ sub.content }}
560
+ <a-menu-item v-for="sub in btn.dropdowns" :key="sub.code">{{ sub.content }}
585
561
  </a-menu-item>
586
562
  </a-menu>
587
563
  </template>
588
- <a-button
589
- :type="btn.type"
590
- :size="btn.size ?? 'middle'"
564
+ <a-button :type="btn.type" :size="btn.size ?? 'middle'"
591
565
  :disabled="toolbarConfig.disabled || btn.disabled"
592
- :loading="loading.toolbar || (!!btn.code && codeLoadings[btn.code])"
593
- :danger="btn.danger"
594
- :shape="btn.shape"
595
- :ghost="btn.ghost"
596
- :block="btn.block"
597
- >
566
+ :loading="loading.toolbar || (!!btn.code && codeLoadings[btn.code])" :danger="btn.danger"
567
+ :shape="btn.shape" :ghost="btn.ghost" :block="btn.block">
598
568
  <div class="flex items-center gap-4px">
599
569
  <Icon v-if="btn.icon" :icon="btn.icon" />
600
570
  <template v-if="btn.content && isStringContent(renderContent(btn.content))">
@@ -605,18 +575,10 @@
605
575
  </div>
606
576
  </a-button>
607
577
  </a-dropdown>
608
- <a-button
609
- v-else-if="btn.code"
610
- :type="btn.type"
611
- :size="btn.size ?? 'middle'"
578
+ <a-button v-else-if="btn.code" :type="btn.type" :size="btn.size ?? 'middle'"
612
579
  :disabled="toolbarConfig.disabled || btn.disabled"
613
- :loading="loading.toolbar || (!!btn.code && codeLoadings[btn.code])"
614
- :danger="btn.danger"
615
- :shape="btn.shape"
616
- :ghost="btn.ghost"
617
- :block="btn.block"
618
- @click="debounceToolBtnClick(btn.code)"
619
- >
580
+ :loading="loading.toolbar || (!!btn.code && codeLoadings[btn.code])" :danger="btn.danger"
581
+ :shape="btn.shape" :ghost="btn.ghost" :block="btn.block" @click="debounceToolBtnClick(btn.code)">
620
582
  <div class="flex items-center gap-4px">
621
583
  <Icon v-if="btn.icon" :icon="btn.icon" />
622
584
  <template v-if="btn.content && isStringContent(renderContent(btn.content))">
@@ -631,19 +593,10 @@
631
593
  </div>
632
594
  <span class="flex items-center gap-4px">
633
595
  <template v-if="toolbarConfig.tools && toolbarConfig.tools.length > 0">
634
- <a-button
635
- v-for="(tool, idx) in toolbarConfig.tools"
636
- :key="idx"
637
- :type="tool.type"
638
- :size="tool.size ?? 'middle'"
639
- :disabled="toolbarConfig.disabled || tool.disabled"
640
- :danger="tool.danger"
641
- :shape="tool.shape"
642
- :ghost="tool.ghost"
643
- :block="tool.block"
644
- @click="debounceToolToolClick(tool.code)"
645
- :loading="loading.toolbar || (!!tool.code && codeLoadings[tool.code])"
646
- >
596
+ <a-button v-for="(tool, idx) in toolbarConfig.tools" :key="idx" :type="tool.type"
597
+ :size="tool.size ?? 'middle'" :disabled="toolbarConfig.disabled || tool.disabled" :danger="tool.danger"
598
+ :shape="tool.shape" :ghost="tool.ghost" :block="tool.block" @click="debounceToolToolClick(tool.code)"
599
+ :loading="loading.toolbar || (!!tool.code && codeLoadings[tool.code])">
647
600
  <div class="flex items-center gap-4px">
648
601
  <Icon v-if="tool.icon" :icon="tool.icon" />
649
602
  <template v-if="tool.content && isStringContent(renderContent(tool.content))">
@@ -655,40 +608,23 @@
655
608
  </template>
656
609
  </span>
657
610
  </div>
658
- <div ref="tableWrapperEl" class="p-pane flex-1 h-0 min-h-0 flex flex-col p-inner-scroll">
611
+ <div ref="tableWrapperEl" class="flex-1 h-0 min-h-0 flex flex-col p-inner-scroll">
659
612
  <div ref="tableBodyEl" class="flex-1 min-h-0 overflow-hidden">
660
- <p-canvas-table
661
- ref="canvasTableRef"
662
- :columns="finalColumns"
663
- :config="{
664
- ...propsWithDefaults.config,
665
- HEIGHT: renderHeight,
666
- }"
667
- :data="tableData"
668
- :loading="loading.table"
669
- @selection-change="handleSelectionChange"
670
- >
613
+ <p-canvas-table ref="canvasTableRef" :columns="finalColumns" :config="{
614
+ ...propsWithDefaults.config,
615
+ HEIGHT: renderHeight,
616
+ }" :data="tableData" :loading="loading.table" @selection-change="handleSelectionChange">
671
617
  <template v-for="(_, name) in $slots" #[name]="slotProps">
672
618
  <slot :name="name" v-bind="slotProps"></slot>
673
619
  </template>
674
620
  </p-canvas-table>
675
621
  </div>
676
622
  <div ref="tableFooterEl" class="flex-shrink-0">
677
- <div
678
- v-if="staticConfig?.selectable && staticConfig.showCount"
679
- class="w-full text-slate-5 pl-4"
680
- >
623
+ <div v-if="staticConfig?.selectable && staticConfig.showCount" class="w-full text-slate-5 pl-4">
681
624
  已选:{{ selectedRowKeys.length }}
682
625
  </div>
683
- <a-pagination
684
- class="p-canvas-pagination"
685
- v-if="mode === 'pagination'"
686
- size="small"
687
- :current="pagination.page"
688
- :page-size="pagination.size"
689
- :total="totalCount"
690
- @change="handleTableChange"
691
- />
626
+ <a-pagination class="p-canvas-pagination" v-if="mode === 'pagination'" size="small" :current="pagination.page"
627
+ :page-size="pagination.size" :total="totalCount" @change="handleTableChange" />
692
628
  </div>
693
629
  </div>
694
630
  </template>