@vue-ui-kit/ant 2.0.0 → 2.0.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.
@@ -6,7 +6,10 @@ declare const _default: <T extends Recordable = Recordable, B extends Recordable
6
6
  readonly onChange?: ((value: any[]) => any) | undefined;
7
7
  readonly onReady?: ((value: EVirtTable) => any) | undefined;
8
8
  } & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps, never>, "onChange" | "onReady"> & CanvasTableProps<T, B> & Partial<{}>> & import('vue').PublicProps;
9
- expose(exposed: import('vue').ShallowUnwrapRef<{}>): void;
9
+ expose(exposed: import('vue').ShallowUnwrapRef<{
10
+ $table: null;
11
+ selectedRecords: import('vue').ComputedRef<import('@vue/reactivity').UnwrapRefSimple<T>[]>;
12
+ }>): void;
10
13
  attrs: any;
11
14
  slots: Partial<Record<string, (_: {
12
15
  cell: Cell | import('e-virt-table/dist/lib/CellHeader').default;
package/dist/style.scss CHANGED
@@ -1,4 +1,8 @@
1
- @use 'variables';
1
+ // Variables inlined for npm distribution
2
+ :root {
3
+ --p-theme-bg: #fff;
4
+ }
5
+
2
6
 
3
7
  .p-pane {
4
8
  background-color: var(--p-theme-bg);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue-ui-kit/ant",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "Vue3 UI Kit based on Ant Design",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",
@@ -5,6 +5,7 @@ import { FormProps } from 'ant-design-vue/lib/form/Form';
5
5
  import { TableColumnType, TableProps, TooltipProps } from 'ant-design-vue';
6
6
  import { ButtonType } from 'ant-design-vue/lib/button/buttonTypes';
7
7
  import type { ConfigType, Column as EVirtColumn } from 'e-virt-table';
8
+ import EVirtTable from 'e-virt-table';
8
9
 
9
10
  export interface CellFuncArg<D extends Recordable = Recordable> {
10
11
  row: D;
@@ -371,3 +372,7 @@ export interface PFormGroupInstance {
371
372
  validate: (index: number, ignoreTabError?: boolean) => Promise<void>;
372
373
  validateFields: (index: number, fields: string[], ignoreTabError?: boolean) => Promise<void>;
373
374
  }
375
+ export interface PCanvasTableInstance<T extends Recordable = Recordable> {
376
+ $table: InstanceType<typeof EVirtTable>;
377
+ selectedRecords: T[];
378
+ }
@@ -28,6 +28,7 @@
28
28
  const defaultConfig = {
29
29
  DISABLED: true,
30
30
  };
31
+ const selectedRecords = ref<T[]>([]);
31
32
  const props = defineProps<CanvasTableProps<T, B>>();
32
33
  let eVirtTable: EVirtTable | null = null;
33
34
  const attrs = useAttrs();
@@ -163,6 +164,9 @@
163
164
  eVirtTable.on('doneEdit', () => {
164
165
  editorType.value = 'text';
165
166
  });
167
+ eVirtTable.on('selectionChange', (selection) => {
168
+ selectedRecords.value = selection;
169
+ });
166
170
  emit('ready', eVirtTable);
167
171
  });
168
172
  function saveCellValue(value) {
@@ -172,6 +176,9 @@
172
176
  const { rowKey, key } = editorCell.value;
173
177
  eVirtTable?.setItemValueByEditor(rowKey, key, value);
174
178
  }
179
+ const getPopupContainer = () => {
180
+ return document.body;
181
+ };
175
182
  watch(
176
183
  props.data,
177
184
  (newValue) => {
@@ -202,9 +209,10 @@
202
209
  },
203
210
  { deep: true },
204
211
  );
205
- const getPopupContainer = () => {
206
- return document.body;
207
- };
212
+ defineExpose({
213
+ $table: eVirtTable,
214
+ selectedRecords: computed(() => selectedRecords.value),
215
+ });
208
216
  </script>
209
217
  <template>
210
218
  <a-spin :spinning="loading">
@@ -1,4 +1,9 @@
1
- <script lang="ts" setup name="PromisePicker" generic="D extends Recordable = Recordable, F extends Recordable = Recordable">
1
+ <script
2
+ lang="ts"
3
+ setup
4
+ name="PromisePicker"
5
+ generic="D extends Recordable = Recordable, F extends Recordable = Recordable"
6
+ >
2
7
  import { reactive, ref, computed } from 'vue';
3
8
  import { PGridInstance, PromisePickerProps } from '#/antProxy';
4
9
  import PGrid from '@/components/PGrid.vue';
@@ -6,7 +11,15 @@
6
11
  import { Button as AButton, Modal as AModal } from 'ant-design-vue';
7
12
 
8
13
  const gridEl = ref<PGridInstance<D>>();
9
-
14
+ const defaultBodyStyle = {
15
+ minHeight: '642px',
16
+ };
17
+ const mergedBodyStyle = computed(() => {
18
+ return {
19
+ ...defaultBodyStyle,
20
+ ...props.bodyStyle,
21
+ };
22
+ });
10
23
  const props = withDefaults(defineProps<PromisePickerProps<D, F>>(), {
11
24
  title: '数据选择',
12
25
  width: '70%',
@@ -82,7 +95,7 @@
82
95
  :width="width"
83
96
  :footer="isMultiple ? undefined : null"
84
97
  @cancel="handleCancel"
85
- :body-style="bodyStyle"
98
+ :body-style="mergedBodyStyle"
86
99
  >
87
100
  <p-grid v-bind="gridSetting" ref="gridEl" @pick="selectRow" />
88
101
  <template v-if="isMultiple" #footer>