@aplus-frontend/ui 0.0.20 → 0.0.22

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 (53) hide show
  1. package/es/index.mjs +34 -32
  2. package/es/src/ap-form/hooks/use-watch.d.ts +2 -2
  3. package/es/src/ap-form/modal-form/index.vue.mjs +41 -39
  4. package/es/src/ap-list/hooks/use-offline-list.d.ts +21 -0
  5. package/es/src/ap-list/hooks/use-offline-list.mjs +32 -0
  6. package/es/src/ap-list/index.d.ts +4 -0
  7. package/es/src/ap-list/index.mjs +2 -0
  8. package/es/src/ap-list/index.vue.d.ts +153 -0
  9. package/es/src/ap-list/index.vue.mjs +137 -0
  10. package/es/src/ap-list/index.vue2.mjs +4 -0
  11. package/es/src/ap-list/interface.d.ts +100 -0
  12. package/es/src/ap-list/interface.mjs +1 -0
  13. package/es/src/ap-list/style/index.css +11 -0
  14. package/es/src/ap-table/ap-table.vue.mjs +123 -113
  15. package/es/src/ap-table/interface.d.ts +8 -6
  16. package/es/src/ap-table/style/ap-table.css +19 -0
  17. package/es/src/ap-table/utils.d.ts +826 -670
  18. package/es/src/editable-table/hooks/use-get-columns.d.ts +3 -25
  19. package/es/src/editable-table/hooks/use-get-columns.mjs +47 -45
  20. package/es/src/editable-table/interface.d.ts +6 -1
  21. package/es/src/editable-table/style/index.css +3 -0
  22. package/es/src/index.d.ts +1 -0
  23. package/es/src/index.mjs +230 -227
  24. package/es/src/theme/ap-list/index.css +11 -0
  25. package/es/src/theme/ap-table/ap-table.css +19 -0
  26. package/es/src/theme/editable-table/index.css +3 -0
  27. package/lib/index.js +1 -1
  28. package/lib/src/ap-form/hooks/use-watch.d.ts +2 -2
  29. package/lib/src/ap-form/modal-form/index.vue.js +1 -1
  30. package/lib/src/ap-list/hooks/use-offline-list.d.ts +21 -0
  31. package/lib/src/ap-list/hooks/use-offline-list.js +1 -0
  32. package/lib/src/ap-list/index.d.ts +4 -0
  33. package/lib/src/ap-list/index.js +1 -0
  34. package/lib/src/ap-list/index.vue.d.ts +153 -0
  35. package/lib/src/ap-list/index.vue.js +1 -0
  36. package/lib/src/ap-list/index.vue2.js +1 -0
  37. package/lib/src/ap-list/interface.d.ts +100 -0
  38. package/lib/src/ap-list/interface.js +1 -0
  39. package/lib/src/ap-list/style/index.css +11 -0
  40. package/lib/src/ap-table/ap-table.vue.js +1 -1
  41. package/lib/src/ap-table/interface.d.ts +8 -6
  42. package/lib/src/ap-table/style/ap-table.css +19 -0
  43. package/lib/src/ap-table/utils.d.ts +826 -670
  44. package/lib/src/editable-table/hooks/use-get-columns.d.ts +3 -25
  45. package/lib/src/editable-table/hooks/use-get-columns.js +1 -1
  46. package/lib/src/editable-table/interface.d.ts +6 -1
  47. package/lib/src/editable-table/style/index.css +3 -0
  48. package/lib/src/index.d.ts +1 -0
  49. package/lib/src/index.js +1 -1
  50. package/lib/src/theme/ap-list/index.css +11 -0
  51. package/lib/src/theme/ap-table/ap-table.css +19 -0
  52. package/lib/src/theme/editable-table/index.css +3 -0
  53. package/package.json +1 -1
@@ -1,28 +1,6 @@
1
+ import { ComputedRef } from 'vue';
1
2
  import { EditableTableFormItemProps, EditableTableProps } from '../interface';
2
- import { ComputedRef, VNode, RendererNode, RendererElement } from 'vue';
3
- import { TableColumnType } from 'ant-design-vue';
4
- import { ValueEnum } from '../..';
3
+ import { ColumnType } from 'ant-design-vue/es/table';
5
4
 
6
- declare const useGetColumns: (props: EditableTableProps | EditableTableFormItemProps) => ComputedRef<(Omit< TableColumnType<any>, "children" | "customRender"> & {
7
- children?: (Omit< TableColumnType<any>, "children" | "customRender"> & any) | undefined;
8
- tooltip?: string | undefined;
9
- copyable?: boolean | undefined;
10
- editable?: boolean | ((text: any, record: any, index: number) => boolean) | undefined;
11
- valueEnum?: ValueEnum | undefined;
12
- customRenderFormItem?: ((config: Omit< TableColumnType<any>, "children" | "customRender"> & any) => any) | undefined;
13
- valueType?: any;
14
- fieldProps?: any;
15
- customRender?: ((opt: {
16
- value: any;
17
- text: any;
18
- record: any;
19
- index: number;
20
- renderIndex: number;
21
- column: TableColumnType<any>;
22
- editable?: boolean | undefined;
23
- originalNode?: VNode<RendererNode, RendererElement, {
24
- [key: string]: any;
25
- }> | undefined;
26
- }) => any) | undefined;
27
- })[]>;
5
+ declare const useGetColumns: (props: EditableTableProps | EditableTableFormItemProps) => ComputedRef<ColumnType<any>[]>;
28
6
  export default useGetColumns;
@@ -1,78 +1,80 @@
1
- import { computed as g, createVNode as c, mergeProps as x } from "vue";
2
- import { isFunction as C } from "lodash-unified";
3
- import { getEditableComponent as T } from "../utils.mjs";
4
- import { updateFormProps as h, getFieldProps as F, getPlaceholder as R, getTableRenderProps as I } from "../../ap-table/utils.mjs";
1
+ import { computed as y, createVNode as i, mergeProps as x } from "vue";
2
+ import { omit as h, isFunction as C, isBoolean as F } from "lodash-unified";
3
+ import { getEditableComponent as R } from "../utils.mjs";
4
+ import { updateFormProps as T, getFieldProps as I, getPlaceholder as N, getTableRenderProps as L } from "../../ap-table/utils.mjs";
5
5
  import "../../config-provider/index.mjs";
6
- import { apTableRenderItemMap as N, noRenderAsFormItemValueList as v } from "../../ap-table/constants.mjs";
7
- import { Typography as L } from "ant-design-vue";
8
- import { useLocale as M } from "../../config-provider/hooks/use-locale.mjs";
9
- const k = (a) => {
6
+ import { apTableRenderItemMap as M, noRenderAsFormItemValueList as V } from "../../ap-table/constants.mjs";
7
+ import { Typography as w } from "ant-design-vue";
8
+ import { useLocale as A } from "../../config-provider/hooks/use-locale.mjs";
9
+ const q = (t) => {
10
10
  const {
11
- t: s
12
- } = M(), f = g(() => {
13
- let o = a.columns;
11
+ t: u
12
+ } = A(), f = y(() => {
13
+ let o = t.columns;
14
14
  return o ? (o = o.map((e) => ({
15
- ...e,
15
+ ...h(e, ["ellipsis"]),
16
16
  customRender({
17
- value: l,
18
- ...t
17
+ value: n,
18
+ ...a
19
19
  }) {
20
- const u = C(e.editable) ? e.editable(t.text, t.record, t.index) : !!e.editable;
21
- let d;
22
- if (u) {
23
- const r = T(e.valueType), n = h(e, F(e.fieldProps, {
24
- value: l,
25
- ...t
26
- })), i = {};
27
- a.onFieldChange && (i[`onUpdate:${n.valuePropName || "value"}`] = (y) => {
20
+ const c = C(e.editable) ? e.editable(a.text, a.record, a.index) : !!e.editable;
21
+ let r;
22
+ if (c) {
23
+ const d = R(e.valueType), l = T(e, I(e.fieldProps, {
24
+ value: n,
25
+ ...a
26
+ })), s = {};
27
+ t.onFieldChange && (s[`onUpdate:${l.valuePropName || "value"}`] = (g) => {
28
28
  var p;
29
- return (p = a.onFieldChange) == null ? void 0 : p.call(a, t.index, e.dataIndex, y);
29
+ return (p = t.onFieldChange) == null ? void 0 : p.call(t, a.index, e.dataIndex, g);
30
30
  });
31
31
  const b = {
32
- name: [a.name, t.index, e.dataIndex],
33
- ...n || {},
32
+ name: [t.name, a.index, e.dataIndex],
33
+ ...l || {},
34
34
  // 格式化placeholder
35
- placeholder: R(s, e.valueType, n == null ? void 0 : n.placeholder),
35
+ placeholder: N(u, e.valueType, l == null ? void 0 : l.placeholder),
36
36
  field: {
37
37
  style: "width: 100%",
38
- ...(n == null ? void 0 : n.field) || {},
39
- ...i
38
+ ...(l == null ? void 0 : l.field) || {},
39
+ ...s
40
40
  }
41
41
  };
42
- d = c(r, b, null);
42
+ r = i(d, b, null);
43
43
  } else {
44
- const r = N[e.valueType], n = I(e, {
45
- value: l,
46
- ...t
44
+ const d = M[e.valueType], l = L(e, {
45
+ value: n,
46
+ ...a
47
47
  });
48
- d = m(e, l, c(r, x(n, {
48
+ r = m(e, n, i(d, x(l, {
49
49
  mode: "read"
50
50
  }), null));
51
51
  }
52
52
  return e.customRender ? e.customRender({
53
- value: l,
54
- ...t,
55
- column: e,
56
- editable: u,
57
- originalNode: d
58
- }) : d;
53
+ value: n,
54
+ ...a,
55
+ editable: c,
56
+ originalNode: r
57
+ }) : r;
59
58
  }
60
59
  })), o) : [];
61
60
  });
62
- function m(o, e, l) {
63
- return v.includes(o.valueType) ? l : o.copyable || o.ellipsis ? c(L.Text, {
61
+ function m(o, e, n) {
62
+ return V.includes(o.valueType) ? n : o.copyable || o.ellipsis ? i(w.Paragraph, {
64
63
  copyable: o.copyable ? {
65
64
  text: e,
66
65
  tooltip: !1
67
66
  } : !1,
68
- ellipsis: o.ellipsis ? {
67
+ ellipsis: o.ellipsis ? F(o.ellipsis) ? {
68
+ tooltip: e
69
+ } : {
70
+ ...o.ellipsis,
69
71
  tooltip: e
70
72
  } : !1,
71
- content: l
72
- }, null) : l;
73
+ content: o.ellipsis ? e : n
74
+ }, null) : n;
73
75
  }
74
76
  return f;
75
77
  };
76
78
  export {
77
- k as default
79
+ q as default
78
80
  };
@@ -4,8 +4,9 @@ import { NamePath, ValidateOptions } from 'ant-design-vue/es/form/interface';
4
4
  import { DataIndex } from 'ant-design-vue/es/vc-table/interface';
5
5
  import { FormItemProps } from 'ant-design-vue';
6
6
  import { VNode } from 'vue';
7
+ import { EllipsisConfig } from 'ant-design-vue/es/typography/Base';
7
8
 
8
- export type EditableColumnType<RecordType = any, ValueType extends ApTableValueTypes = ApTableValueTypes> = ValueType extends ApTableValueTypes ? Omit<ColumnType<RecordType>, 'children' | 'customRender'> & {
9
+ export type EditableColumnType<RecordType = any, ValueType extends ApTableValueTypes = ApTableValueTypes> = ValueType extends ApTableValueTypes ? Omit<ColumnType<RecordType>, 'children' | 'customRender' | 'ellipsis'> & {
9
10
  children?: EditableColumnType<RecordType, ValueType>;
10
11
  /**
11
12
  * 在title之后展示一个icon并触发tooltip
@@ -15,6 +16,10 @@ export type EditableColumnType<RecordType = any, ValueType extends ApTableValueT
15
16
  * 是否可以复制(不可编辑模式下可用)
16
17
  */
17
18
  copyable?: boolean;
19
+ /**
20
+ * 是否省略自动溢出,自动溢出省略,为对象时可设置省略行数、是否可展开、添加后缀等
21
+ */
22
+ ellipsis?: boolean | EllipsisConfig;
18
23
  /**
19
24
  * 是否可编辑
20
25
  */
@@ -43,3 +43,6 @@
43
43
  .aplus-editable-table .ant-table-small .ant-table-cell {
44
44
  padding: 9px 16px !important;
45
45
  }
46
+ .aplus-editable-table .ant-table-cell .ant-typography {
47
+ margin-bottom: 0;
48
+ }
package/es/src/index.d.ts CHANGED
@@ -28,6 +28,7 @@ export * from './ap-upload';
28
28
  export * from './ap-download';
29
29
  export * from './check-card';
30
30
  export * from './ap-modal';
31
+ export * from './ap-list';
31
32
  export * from './business';
32
33
  export * from './ap-table';
33
34
  export * from './editable-table';