@aplus-frontend/ui 0.0.15 → 0.0.17

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 (71) hide show
  1. package/es/index.mjs +42 -38
  2. package/es/src/ap-form/modal-form/index.vue.mjs +1 -1
  3. package/es/src/ap-table/ap-table.vue.d.ts +2 -2
  4. package/es/src/ap-table/ap-table.vue.mjs +1 -1
  5. package/es/src/ap-table/interface.d.ts +12 -11
  6. package/es/src/ap-table/style/ap-table.css +6 -0
  7. package/es/src/ap-table/utils.d.ts +2188 -5
  8. package/es/src/business/title/style.css +29 -9
  9. package/es/src/check-card/checked.svg.mjs +4 -0
  10. package/es/src/check-card/context.d.ts +6 -0
  11. package/es/src/check-card/context.mjs +16 -0
  12. package/es/src/check-card/group.vue.d.ts +57 -0
  13. package/es/src/check-card/group.vue.mjs +57 -0
  14. package/es/src/check-card/group.vue2.mjs +4 -0
  15. package/es/src/check-card/index.d.ts +9 -0
  16. package/es/src/check-card/index.mjs +11 -0
  17. package/es/src/check-card/index.vue.d.ts +54 -0
  18. package/es/src/check-card/index.vue.mjs +4 -0
  19. package/es/src/check-card/index.vue2.mjs +133 -0
  20. package/es/src/check-card/interface.d.ts +100 -0
  21. package/es/src/check-card/interface.mjs +1 -0
  22. package/es/src/check-card/style/index.css +108 -0
  23. package/es/src/editable-table/hooks/use-get-columns.d.ts +26 -3
  24. package/es/src/editable-table/hooks/use-get-columns.mjs +54 -52
  25. package/es/src/editable-table/interface.d.ts +24 -7
  26. package/es/src/hooks/useControllableValue.mjs +15 -13
  27. package/es/src/index.d.ts +1 -0
  28. package/es/src/index.mjs +194 -190
  29. package/es/src/theme/antd-global-overwrite/admin/index.css +6 -6
  30. package/es/src/theme/antd-global-overwrite/admin/modal.css +6 -6
  31. package/es/src/theme/antd-global-overwrite/aplus/index.css +6 -6
  32. package/es/src/theme/antd-global-overwrite/aplus/modal.css +6 -6
  33. package/es/src/theme/ap-table/ap-table.css +6 -0
  34. package/es/src/theme/ap-title/ap-title.css +29 -9
  35. package/es/src/theme/check-card/index.css +108 -0
  36. package/lib/index.js +1 -1
  37. package/lib/src/ap-form/modal-form/index.vue.js +1 -1
  38. package/lib/src/ap-table/ap-table.vue.d.ts +2 -2
  39. package/lib/src/ap-table/ap-table.vue.js +1 -1
  40. package/lib/src/ap-table/interface.d.ts +12 -11
  41. package/lib/src/ap-table/style/ap-table.css +6 -0
  42. package/lib/src/ap-table/utils.d.ts +2188 -5
  43. package/lib/src/business/title/style.css +29 -9
  44. package/lib/src/check-card/checked.svg.js +1 -0
  45. package/lib/src/check-card/context.d.ts +6 -0
  46. package/lib/src/check-card/context.js +1 -0
  47. package/lib/src/check-card/group.vue.d.ts +57 -0
  48. package/lib/src/check-card/group.vue.js +1 -0
  49. package/lib/src/check-card/group.vue2.js +1 -0
  50. package/lib/src/check-card/index.d.ts +9 -0
  51. package/lib/src/check-card/index.js +1 -0
  52. package/lib/src/check-card/index.vue.d.ts +54 -0
  53. package/lib/src/check-card/index.vue.js +1 -0
  54. package/lib/src/check-card/index.vue2.js +1 -0
  55. package/lib/src/check-card/interface.d.ts +100 -0
  56. package/lib/src/check-card/interface.js +1 -0
  57. package/lib/src/check-card/style/index.css +108 -0
  58. package/lib/src/editable-table/hooks/use-get-columns.d.ts +26 -3
  59. package/lib/src/editable-table/hooks/use-get-columns.js +1 -1
  60. package/lib/src/editable-table/interface.d.ts +24 -7
  61. package/lib/src/hooks/useControllableValue.js +1 -1
  62. package/lib/src/index.d.ts +1 -0
  63. package/lib/src/index.js +1 -1
  64. package/lib/src/theme/antd-global-overwrite/admin/index.css +6 -6
  65. package/lib/src/theme/antd-global-overwrite/admin/modal.css +6 -6
  66. package/lib/src/theme/antd-global-overwrite/aplus/index.css +6 -6
  67. package/lib/src/theme/antd-global-overwrite/aplus/modal.css +6 -6
  68. package/lib/src/theme/ap-table/ap-table.css +6 -0
  69. package/lib/src/theme/ap-title/ap-title.css +29 -9
  70. package/lib/src/theme/check-card/index.css +108 -0
  71. package/package.json +2 -2
@@ -1,76 +1,78 @@
1
- import { computed as x, createVNode as d, mergeProps as g } from "vue";
1
+ import { computed as g, createVNode as c, mergeProps as x } from "vue";
2
2
  import { isFunction as C } from "lodash-unified";
3
3
  import { getEditableComponent as T } from "../utils.mjs";
4
4
  import { updateFormProps as h, getFieldProps as F, getPlaceholder as R, getTableRenderProps as I } from "../../ap-table/utils.mjs";
5
5
  import "../../config-provider/index.mjs";
6
- import { apTableRenderItemMap as v, noRenderAsFormItemValueList as L } from "../../ap-table/constants.mjs";
7
- import { Typography as M } from "ant-design-vue";
8
- import { useLocale as N } from "../../config-provider/hooks/use-locale.mjs";
9
- const q = (a) => {
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) => {
10
10
  const {
11
- t: u
12
- } = N(), i = x(() => {
13
- let n = a.columns;
14
- return n ? (n = n.map((e) => ({
11
+ t: s
12
+ } = M(), f = g(() => {
13
+ let o = a.columns;
14
+ return o ? (o = o.map((e) => ({
15
15
  ...e,
16
16
  customRender({
17
- value: o,
18
- ...l
17
+ value: l,
18
+ ...t
19
19
  }) {
20
- if (e.customRender)
21
- return e.customRender({
22
- value: o,
23
- ...l,
24
- column: e
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) => {
28
+ var p;
29
+ return (p = a.onFieldChange) == null ? void 0 : p.call(a, t.index, e.dataIndex, y);
25
30
  });
26
- {
27
- if (C(e.editable) ? e.editable(l.text, l.record, l.index) : !!e.editable) {
28
- const m = T(e.valueType), t = h(e, F(e.fieldProps, {
29
- value: o,
30
- ...l
31
- })), r = {};
32
- a.onFieldChange && (r[`onUpdate:${t.valuePropName || "value"}`] = (y) => {
33
- var c;
34
- return (c = a.onFieldChange) == null ? void 0 : c.call(a, l.index, e.dataIndex, y);
35
- });
36
- const b = {
37
- name: [a.name, l.index, e.dataIndex],
38
- ...t || {},
39
- // 格式化placeholder
40
- placeholder: R(u, e.valueType, t == null ? void 0 : t.placeholder),
41
- field: {
42
- style: "width: 100%",
43
- ...(t == null ? void 0 : t.field) || {},
44
- ...r
45
- }
46
- };
47
- return d(m, b, null);
48
- }
49
- const s = v[e.valueType], f = I(e, {
50
- value: o,
51
- ...l
31
+ const b = {
32
+ name: [a.name, t.index, e.dataIndex],
33
+ ...n || {},
34
+ // 格式化placeholder
35
+ placeholder: R(s, e.valueType, n == null ? void 0 : n.placeholder),
36
+ field: {
37
+ style: "width: 100%",
38
+ ...(n == null ? void 0 : n.field) || {},
39
+ ...i
40
+ }
41
+ };
42
+ d = c(r, b, null);
43
+ } else {
44
+ const r = N[e.valueType], n = I(e, {
45
+ value: l,
46
+ ...t
52
47
  });
53
- return p(e, o, d(s, g(f, {
48
+ d = m(e, l, c(r, x(n, {
54
49
  mode: "read"
55
50
  }), null));
56
51
  }
52
+ return e.customRender ? e.customRender({
53
+ value: l,
54
+ ...t,
55
+ column: e,
56
+ editable: u,
57
+ originalNode: d
58
+ }) : d;
57
59
  }
58
- })), n) : [];
60
+ })), o) : [];
59
61
  });
60
- function p(n, e, o) {
61
- return L.includes(n.valueType) ? o : n.copyable || n.ellipsis ? d(M.Text, {
62
- copyable: n.copyable ? {
62
+ function m(o, e, l) {
63
+ return v.includes(o.valueType) ? l : o.copyable || o.ellipsis ? c(L.Text, {
64
+ copyable: o.copyable ? {
63
65
  text: e,
64
66
  tooltip: !1
65
67
  } : !1,
66
- ellipsis: n.ellipsis ? {
68
+ ellipsis: o.ellipsis ? {
67
69
  tooltip: e
68
70
  } : !1,
69
- content: o
70
- }, null) : o;
71
+ content: l
72
+ }, null) : l;
71
73
  }
72
- return i;
74
+ return f;
73
75
  };
74
76
  export {
75
- q as default
77
+ k as default
76
78
  };
@@ -1,10 +1,12 @@
1
1
  import { ColumnType, TableProps } from 'ant-design-vue/es/table';
2
- import { ApTableValueFields, ValueEnum } from '../ap-table';
2
+ import { ApTableValueFields, ApTableValueTypes, ValueEnum } from '../ap-table';
3
3
  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
+ import { VNode } from 'vue';
6
7
 
7
- export type EditableColumnType<ValueType extends keyof ApTableValueFields = 'text', RecordType = any> = Omit<ColumnType<RecordType>, 'children'> & {
8
+ export type EditableColumnType<RecordType = any, ValueType extends ApTableValueTypes = ApTableValueTypes> = ValueType extends ApTableValueTypes ? Omit<ColumnType<RecordType>, 'children' | 'customRender'> & {
9
+ children?: EditableColumnType<RecordType, ValueType>;
8
10
  /**
9
11
  * 在title之后展示一个icon并触发tooltip
10
12
  */
@@ -25,11 +27,11 @@ export type EditableColumnType<ValueType extends keyof ApTableValueFields = 'tex
25
27
  * 自定义表单
26
28
  * @deprecated 未实现,请使用`customRender`
27
29
  */
28
- customRenderFormItem?: (config: EditableColumnType<ValueType, RecordType>) => any;
30
+ customRenderFormItem?: (config: EditableColumnType<RecordType, ValueType>) => any;
29
31
  /**
30
32
  * 指定值类型(将会用于普通列和可编辑表格的渲染)
31
33
  */
32
- valueType?: keyof ApTableValueFields;
34
+ valueType?: ValueType;
33
35
  /**
34
36
  * 值类型额外配置的参数(支持函数)
35
37
  */
@@ -39,14 +41,29 @@ export type EditableColumnType<ValueType extends keyof ApTableValueFields = 'tex
39
41
  record: RecordType;
40
42
  index: number;
41
43
  renderIndex: number;
42
- column: EditableColumnType<ValueType, RecordType>;
44
+ column: EditableColumnType<RecordType, ValueType>;
43
45
  }) => ApTableValueFields[ValueType]);
44
- };
46
+ /**
47
+ * 自定义渲染,添加了`editable`以及`originalNode`
48
+ * @param opt
49
+ * @returns
50
+ */
51
+ customRender?: (opt: {
52
+ value: any;
53
+ text: any;
54
+ record: RecordType;
55
+ index: number;
56
+ renderIndex: number;
57
+ column: ColumnType<RecordType>;
58
+ editable?: boolean;
59
+ originalNode?: VNode;
60
+ }) => any;
61
+ } : never;
45
62
  export type EditableTableProps<RecordType = any> = Omit<TableProps<RecordType>, 'columns' | 'dataSource'> & {
46
63
  /**
47
64
  * 列配置
48
65
  */
49
- columns?: EditableColumnType<any, RecordType>[];
66
+ columns?: EditableColumnType<RecordType, any>[];
50
67
  /**
51
68
  * 表格数据v-model
52
69
  */
@@ -1,21 +1,23 @@
1
- import { ref as c, watch as m } from "vue";
2
- function N(a, r, e) {
3
- const d = (e == null ? void 0 : e.defaultValuePropName) || "defaultValue", u = (e == null ? void 0 : e.valuePropName) || "value", f = c(
4
- a[u] || a[d] || (e == null ? void 0 : e.defaultValue)
5
- );
6
- function v(l) {
7
- a[u] === void 0 && (f.value = l), r(`update:${u}`, l);
1
+ import { ref as v, watch as V } from "vue";
2
+ import { isUndefined as d } from "lodash-unified";
3
+ function P(u, t, e) {
4
+ const f = (e == null ? void 0 : e.defaultValuePropName) || "defaultValue", a = (e == null ? void 0 : e.valuePropName) || "value", r = v(c());
5
+ function m(l) {
6
+ u[a] === void 0 && (r.value = l), t(`update:${a}`, l);
8
7
  }
9
- return m(
10
- () => a[u],
8
+ function c() {
9
+ return d(u[a]) ? d(u[f]) ? e == null ? void 0 : e.defaultValue : u[f] : u[a];
10
+ }
11
+ return V(
12
+ () => u[a],
11
13
  (l) => {
12
- f.value = l;
14
+ r.value = l;
13
15
  }
14
16
  ), {
15
- value: f,
16
- updateValue: v
17
+ value: r,
18
+ updateValue: m
17
19
  };
18
20
  }
19
21
  export {
20
- N as useControllableValue
22
+ P as useControllableValue
21
23
  };
package/es/src/index.d.ts CHANGED
@@ -26,6 +26,7 @@ export * from './ap-tag';
26
26
  export * from './ap-layout';
27
27
  export * from './ap-upload';
28
28
  export * from './ap-download';
29
+ export * from './check-card';
29
30
  export * from './business';
30
31
  export * from './ap-table';
31
32
  export * from './editable-table';