@aplus-frontend/ui 0.1.2 → 0.1.4

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 (45) hide show
  1. package/es/index.mjs +42 -41
  2. package/es/src/ap-action/style/item-dropdown.css +1 -0
  3. package/es/src/ap-download/interface.d.ts +4 -1
  4. package/es/src/ap-field/text/index.vue.d.ts +5 -5
  5. package/es/src/ap-modal/type.d.ts +2 -2
  6. package/es/src/ap-modal/utils/createModal.mjs +35 -27
  7. package/es/src/ap-table/constants.d.ts +10 -10
  8. package/es/src/business/ap-input-radio/ApInputRadio.vue.d.ts +37 -0
  9. package/es/src/business/ap-input-radio/ApInputRadio.vue.mjs +4 -0
  10. package/es/src/business/ap-input-radio/ApInputRadio.vue2.mjs +59 -0
  11. package/es/src/business/ap-input-radio/index.d.ts +3 -0
  12. package/es/src/business/ap-input-radio/interface.d.ts +14 -0
  13. package/es/src/business/ap-input-radio/style.css +7 -0
  14. package/es/src/business/index.d.ts +152 -1
  15. package/es/src/business/index.mjs +15 -12
  16. package/es/src/editable-table/hooks/use-get-columns.mjs +46 -64
  17. package/es/src/editable-table/interface.d.ts +2 -3
  18. package/es/src/editable-table/utils.d.ts +1 -0
  19. package/es/src/editable-table/utils.mjs +75 -35
  20. package/es/src/index.mjs +188 -187
  21. package/es/src/theme/ap-action/item-dropdown.css +1 -0
  22. package/es/src/theme/ap-input-radio/ap-input-radio.css +7 -0
  23. package/lib/index.js +1 -1
  24. package/lib/src/ap-action/style/item-dropdown.css +1 -0
  25. package/lib/src/ap-download/interface.d.ts +4 -1
  26. package/lib/src/ap-field/text/index.vue.d.ts +5 -5
  27. package/lib/src/ap-modal/type.d.ts +2 -2
  28. package/lib/src/ap-modal/utils/createModal.js +1 -1
  29. package/lib/src/ap-table/constants.d.ts +10 -10
  30. package/lib/src/business/ap-input-radio/ApInputRadio.vue.d.ts +37 -0
  31. package/lib/src/business/ap-input-radio/ApInputRadio.vue.js +1 -0
  32. package/lib/src/business/ap-input-radio/ApInputRadio.vue2.js +1 -0
  33. package/lib/src/business/ap-input-radio/index.d.ts +3 -0
  34. package/lib/src/business/ap-input-radio/interface.d.ts +14 -0
  35. package/lib/src/business/ap-input-radio/style.css +7 -0
  36. package/lib/src/business/index.d.ts +152 -1
  37. package/lib/src/business/index.js +1 -1
  38. package/lib/src/editable-table/hooks/use-get-columns.js +1 -1
  39. package/lib/src/editable-table/interface.d.ts +2 -3
  40. package/lib/src/editable-table/utils.d.ts +1 -0
  41. package/lib/src/editable-table/utils.js +1 -1
  42. package/lib/src/index.js +1 -1
  43. package/lib/src/theme/ap-action/item-dropdown.css +1 -0
  44. package/lib/src/theme/ap-input-radio/ap-input-radio.css +7 -0
  45. package/package.json +4 -4
@@ -1,13 +1,17 @@
1
- import { CreateComponentPublicInstance, ExtractPropTypes, PropType, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ComponentOptionsBase, Plugin, CSSProperties, PublicProps, ShallowUnwrapRef, VNode, RendererNode, RendererElement } from 'vue';
1
+ import { CreateComponentPublicInstance, ExtractPropTypes, PropType, ComponentOptionsMixin, VNodeProps, AllowedComponentProps, ComponentCustomProps, ComponentOptionsBase, Plugin, CSSProperties, PublicProps, ShallowUnwrapRef, VNode, RendererNode, RendererElement, DefineComponent } from 'vue';
2
2
  import { TooltipPlacement } from 'ant-design-vue/es/tooltip';
3
3
  import { LiteralUnion } from 'ant-design-vue/es/_util/type';
4
4
  import { ApStatusProps, ApStatusGroupItemProps } from './ap-status/interface';
5
5
  import { ApSelectItem } from './ap-select-layout/interface';
6
+ import { ValueType } from 'ant-design-vue/es/input-number/src/utils/MiniDecimal';
7
+ import { ApInputRadioOptions } from './ap-input-radio/interface';
8
+ import { KeyboardEventHandler } from 'ant-design-vue/es/_util/EventInterface';
6
9
  export type { ApTitleProps } from './title/interface';
7
10
  export type { ApExpandAlertProps } from './expandAlert/interface';
8
11
  export type { ApLabelProps } from './ap-label/interface';
9
12
  export type { ApStatusProps, ApStatusGroupProps, ApStatusGroupItemProps } from './ap-status/interface';
10
13
  export type { ApSelectItem, ApSelectLayoutProps } from './ap-select-layout/interface';
14
+ export type { ApInputRadioProps } from './ap-input-radio/interface';
11
15
  export declare const ApTitle: {
12
16
  new (...args: any[]): CreateComponentPublicInstance<Readonly< ExtractPropTypes<{
13
17
  title: {
@@ -1028,3 +1032,150 @@ export declare const ApExportGroup: {
1028
1032
  onClick?: () => void;
1029
1033
  };
1030
1034
  }))));
1035
+ export declare const ApInputRadio: DefineComponent<{
1036
+ onBlur: {
1037
+ type: PropType<(e: FocusEvent) => void>;
1038
+ };
1039
+ onChange: {
1040
+ type: PropType<(value: ValueType) => void>;
1041
+ };
1042
+ onFocus: {
1043
+ type: PropType<(e: FocusEvent) => void>;
1044
+ };
1045
+ onInput: {
1046
+ type: PropType<(text: string) => void>;
1047
+ };
1048
+ value: {
1049
+ type: PropType<Record<"inputval" | "radioVal", string | number>>;
1050
+ required: true;
1051
+ };
1052
+ options: {
1053
+ type: PropType<ApInputRadioOptions>;
1054
+ required: true;
1055
+ };
1056
+ disabled: {
1057
+ type: PropType<boolean>;
1058
+ };
1059
+ bordered: {
1060
+ type: PropType<boolean>;
1061
+ default: boolean;
1062
+ };
1063
+ autofocus: {
1064
+ type: PropType<boolean>;
1065
+ };
1066
+ onPressEnter: {
1067
+ type: PropType<KeyboardEventHandler>;
1068
+ };
1069
+ stringMode: {
1070
+ type: PropType<boolean>;
1071
+ default: boolean;
1072
+ };
1073
+ min: {
1074
+ type: PropType<ValueType>;
1075
+ };
1076
+ max: {
1077
+ type: PropType<ValueType>;
1078
+ };
1079
+ step: {
1080
+ type: PropType<ValueType>;
1081
+ };
1082
+ controls: {
1083
+ type: PropType<boolean>;
1084
+ default: boolean;
1085
+ };
1086
+ formatter: {
1087
+ type: PropType<(value: ValueType, info: {
1088
+ userTyping: boolean;
1089
+ input: string;
1090
+ }) => string>;
1091
+ };
1092
+ precision: {
1093
+ type: PropType<number>;
1094
+ };
1095
+ decimalSeparator: {
1096
+ type: PropType<string>;
1097
+ };
1098
+ onStep: {
1099
+ type: PropType<(value: ValueType, info: {
1100
+ offset: ValueType;
1101
+ type: "up" | "down";
1102
+ }) => void>;
1103
+ };
1104
+ }, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
1105
+ "update:value": (...args: any[]) => void;
1106
+ }, string, PublicProps, Readonly< ExtractPropTypes<{
1107
+ onBlur: {
1108
+ type: PropType<(e: FocusEvent) => void>;
1109
+ };
1110
+ onChange: {
1111
+ type: PropType<(value: ValueType) => void>;
1112
+ };
1113
+ onFocus: {
1114
+ type: PropType<(e: FocusEvent) => void>;
1115
+ };
1116
+ onInput: {
1117
+ type: PropType<(text: string) => void>;
1118
+ };
1119
+ value: {
1120
+ type: PropType<Record<"inputval" | "radioVal", string | number>>;
1121
+ required: true;
1122
+ };
1123
+ options: {
1124
+ type: PropType<ApInputRadioOptions>;
1125
+ required: true;
1126
+ };
1127
+ disabled: {
1128
+ type: PropType<boolean>;
1129
+ };
1130
+ bordered: {
1131
+ type: PropType<boolean>;
1132
+ default: boolean;
1133
+ };
1134
+ autofocus: {
1135
+ type: PropType<boolean>;
1136
+ };
1137
+ onPressEnter: {
1138
+ type: PropType<KeyboardEventHandler>;
1139
+ };
1140
+ stringMode: {
1141
+ type: PropType<boolean>;
1142
+ default: boolean;
1143
+ };
1144
+ min: {
1145
+ type: PropType<ValueType>;
1146
+ };
1147
+ max: {
1148
+ type: PropType<ValueType>;
1149
+ };
1150
+ step: {
1151
+ type: PropType<ValueType>;
1152
+ };
1153
+ controls: {
1154
+ type: PropType<boolean>;
1155
+ default: boolean;
1156
+ };
1157
+ formatter: {
1158
+ type: PropType<(value: ValueType, info: {
1159
+ userTyping: boolean;
1160
+ input: string;
1161
+ }) => string>;
1162
+ };
1163
+ precision: {
1164
+ type: PropType<number>;
1165
+ };
1166
+ decimalSeparator: {
1167
+ type: PropType<string>;
1168
+ };
1169
+ onStep: {
1170
+ type: PropType<(value: ValueType, info: {
1171
+ offset: ValueType;
1172
+ type: "up" | "down";
1173
+ }) => void>;
1174
+ };
1175
+ }>> & {
1176
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
1177
+ }, {
1178
+ bordered: boolean;
1179
+ stringMode: boolean;
1180
+ controls: boolean;
1181
+ }, {}>;
@@ -6,20 +6,23 @@ import "./ap-status/ApStatus.vue.mjs";
6
6
  import "./ap-status/ApStatusGroup.vue.mjs";
7
7
  import "./ap-select-layout/select-layout.vue.mjs";
8
8
  import "./ap-export-group/ApExportGroup.vue.mjs";
9
+ import "./ap-input-radio/ApInputRadio.vue.mjs";
9
10
  import t from "./title/ApTitle.vue2.mjs";
10
11
  import m from "./expandAlert/ApExpandAlert.vue2.mjs";
11
- import r from "./ap-label/ApLabel.vue2.mjs";
12
- import p from "./ap-status/ApStatus.vue2.mjs";
12
+ import p from "./ap-label/ApLabel.vue2.mjs";
13
+ import r from "./ap-status/ApStatus.vue2.mjs";
13
14
  import i from "./ap-status/ApStatusGroup.vue2.mjs";
14
- import s from "./ap-select-layout/select-layout.vue2.mjs";
15
- import n from "./ap-export-group/ApExportGroup.vue2.mjs";
16
- const d = o(t), h = m, w = o(r), y = o(p), I = o(i), T = o(s), g = o(n);
15
+ import n from "./ap-select-layout/select-layout.vue2.mjs";
16
+ import s from "./ap-export-group/ApExportGroup.vue2.mjs";
17
+ import c from "./ap-input-radio/ApInputRadio.vue2.mjs";
18
+ const w = o(t), y = m, R = o(p), T = o(r), g = o(i), j = o(n), k = o(s), q = c;
17
19
  export {
18
- h as ApExpandAlert,
19
- g as ApExportGroup,
20
- w as ApLabel,
21
- T as ApSelectLayout,
22
- y as ApStatus,
23
- I as ApStatusGroup,
24
- d as ApTitle
20
+ y as ApExpandAlert,
21
+ k as ApExportGroup,
22
+ q as ApInputRadio,
23
+ R as ApLabel,
24
+ j as ApSelectLayout,
25
+ T as ApStatus,
26
+ g as ApStatusGroup,
27
+ w as ApTitle
25
28
  };
@@ -1,81 +1,63 @@
1
- import { computed as y, createVNode as s, mergeProps as x } from "vue";
2
- import { omit as C, isFunction as h, isBoolean as R } from "lodash-unified";
3
- import { getEditableComponent as F, mergeClass as T, getRawDisplayValue as I } from "../utils.mjs";
4
- import { updateFormProps as N, getFieldProps as V, getPlaceholder as w, getTableRenderProps as L } from "../../ap-table/utils.mjs";
1
+ import { computed as f } from "vue";
2
+ import { omit as g, isFunction as F } from "lodash-unified";
3
+ import { mergeClass as b, getFinalNode as x } from "../utils.mjs";
4
+ import { updateFormProps as R, getFieldProps as h, getPlaceholder as C, getTableRenderProps as I } from "../../ap-table/utils.mjs";
5
5
  import "../../config-provider/index.mjs";
6
- import { apTableRenderItemMap as M, noRenderAsFormItemValueList as A } from "../../ap-table/constants.mjs";
7
- import { Typography as B } from "ant-design-vue";
8
- import { useLocale as D } from "../../config-provider/hooks/use-locale.mjs";
9
- const v = (t) => {
6
+ import { useLocale as y } from "../../config-provider/hooks/use-locale.mjs";
7
+ const $ = (o) => {
10
8
  const {
11
- t: u
12
- } = D(), f = y(() => {
13
- let l = t.columns;
14
- return l ? (l = l.map((e) => ({
15
- ...C(e, ["ellipsis"]),
9
+ t: i
10
+ } = y();
11
+ return f(() => {
12
+ let d = o.columns;
13
+ return d ? (d = d.map((e) => ({
14
+ ...g(e, ["ellipsis"]),
16
15
  customRender({
17
- value: n,
18
- ...a
16
+ value: t,
17
+ ...l
19
18
  }) {
20
- const i = h(e.editable) ? e.editable(a.text, a.record, a.index) : !!e.editable;
21
- let r;
22
- if (i) {
23
- const d = F(e.valueType), o = N(e, V(e.fieldProps, {
24
- value: n,
25
- ...a
26
- })), c = {};
27
- t.onFieldChange && (c[`onUpdate:${o.valuePropName || "value"}`] = (b) => {
28
- var p;
29
- return (p = t.onFieldChange) == null ? void 0 : p.call(t, a.index, e.dataIndex, b);
30
- });
31
- const g = {
32
- name: [t.name, a.index, e.dataIndex],
33
- ...o || {},
19
+ const a = F(e.editable) ? e.editable(l.text, l.record, l.index) : !!e.editable;
20
+ if (!e.valueType && !e.customRender && !e.customRenderFormItem)
21
+ return console.warn("can not render table cell because no `valueType` / `customRender` / `customRenderFormItem`"), null;
22
+ let c;
23
+ if (a) {
24
+ const n = R(e, h(e.fieldProps, {
25
+ value: t,
26
+ ...l
27
+ })), u = {};
28
+ o.onFieldChange && (u[`onUpdate:${n.valuePropName || "value"}`] = (s) => {
29
+ var m;
30
+ return (m = o.onFieldChange) == null ? void 0 : m.call(o, l.index, e.dataIndex, s);
31
+ }), c = {
32
+ name: [o.name, l.index, e.dataIndex],
33
+ ...n || {},
34
34
  // 格式化placeholder
35
- placeholder: w(u, e.valueType, o == null ? void 0 : o.placeholder),
35
+ placeholder: C(i, e.valueType, n == null ? void 0 : n.placeholder),
36
36
  field: {
37
37
  style: "width: 100%",
38
- ...(o == null ? void 0 : o.field) || {},
39
- ...c,
40
- class: T("is-editable", o.class)
38
+ ...(n == null ? void 0 : n.field) || {},
39
+ ...u,
40
+ class: b("is-editable", n.class)
41
41
  }
42
42
  };
43
- r = s(d, g, null);
44
- } else {
45
- const d = M[e.valueType], o = L(e, {
46
- value: n,
47
- ...a
48
- });
49
- r = m(e, n, s(d, x(o, {
50
- mode: "read"
51
- }), null));
52
- }
43
+ } else
44
+ c = {
45
+ field: I(e, {
46
+ value: t,
47
+ ...l
48
+ })
49
+ };
50
+ const r = x(e, a, c, t);
53
51
  return e.customRender ? e.customRender({
54
- value: n,
55
- ...a,
56
- editable: i,
52
+ value: t,
53
+ ...l,
54
+ editable: a,
57
55
  originalNode: r
58
56
  }) : r;
59
57
  }
60
- })), l) : [];
58
+ })), d) : [];
61
59
  });
62
- function m(l, e, n) {
63
- return A.includes(l.valueType) ? n : l.copyable || l.ellipsis ? s(B.Paragraph, {
64
- copyable: l.copyable ? {
65
- text: e,
66
- tooltip: !1
67
- } : !1,
68
- ellipsis: l.ellipsis ? R(l.ellipsis) ? {
69
- tooltip: e
70
- } : {
71
- ...l.ellipsis,
72
- tooltip: e
73
- } : !1,
74
- content: l.ellipsis ? I(l, e) : n
75
- }, null) : n;
76
- }
77
- return f;
78
60
  };
79
61
  export {
80
- v as default
62
+ $ as default
81
63
  };
@@ -29,10 +29,9 @@ export type EditableColumnType<RecordType = any, ValueType extends ApTableValueT
29
29
  */
30
30
  valueEnum?: ValueEnum;
31
31
  /**
32
- * 自定义表单
33
- * @deprecated 未实现,请使用`customRender`
32
+ * 自定义表单,适用于内置`valueType`不满足的情况下使用
34
33
  */
35
- customRenderFormItem?: (config: EditableColumnType<RecordType, ValueType>) => any;
34
+ customRenderFormItem?: (config: EditableColumnType<RecordType, ValueType>, fieldProps: Record<string, any>, editable: boolean) => any;
36
35
  /**
37
36
  * 指定值类型(将会用于普通列和可编辑表格的渲染)
38
37
  */
@@ -27,3 +27,4 @@ export declare function mergeClass(current: string, classNames?: string | string
27
27
  * @param options
28
28
  */
29
29
  export declare function scrollToRowIndex(index: number, container?: HTMLElement, options?: StandardBehaviorOptions): void;
30
+ export declare function getFinalNode(column: EditableColumnType, editable: boolean, innerProps: Record<string, any>, value: any): any;
@@ -1,50 +1,90 @@
1
- import { isFunction as i, isArray as n } from "lodash-unified";
2
- import { apTableFormItemMap as s } from "../ap-table/constants.mjs";
3
- import { isDef as f } from "../utils/index.mjs";
4
- import { getValueStr as l } from "../ap-field/number/helper.mjs";
5
- import d from "scroll-into-view-if-needed";
6
- function m(r) {
7
- const e = s[r];
8
- return e || console.warn(
9
- `${r} can not render because of no default renderer, use customRender instead.`
10
- ), e;
11
- }
12
- function b(r) {
13
- if (!r.fieldProps)
1
+ import { isVNode as f, createVNode as s, mergeProps as d } from "vue";
2
+ import { isFunction as n, isArray as p, isBoolean as a, omit as u } from "lodash-unified";
3
+ import { apTableFormItemMap as c, noRenderAsFormItemValueList as y, apTableRenderItemMap as m } from "../ap-table/constants.mjs";
4
+ import { isDef as b } from "../utils/index.mjs";
5
+ import { getValueStr as g } from "../ap-field/number/helper.mjs";
6
+ import T from "scroll-into-view-if-needed";
7
+ import { Typography as C } from "ant-design-vue";
8
+ import "../ap-form/index.mjs";
9
+ import I from "../ap-form/ap-form-item.vue.mjs";
10
+ function P(e) {
11
+ return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !f(e);
12
+ }
13
+ function R(e) {
14
+ return c[e];
15
+ }
16
+ function _(e) {
17
+ if (!e.fieldProps)
14
18
  return !1;
15
- const e = i(r.fieldProps) ? r.fieldProps({}) : r.fieldProps;
16
- return f(e.required) ? e.required : (n(e.rules) ? e.rules : e.rules ? [e.rules] : []).some((t) => t.required);
17
- }
18
- function g(r, e) {
19
- if (r.valueType === "text" || r.valueType === "textArea")
20
- return e || "--";
21
- if (r.valueType === "number") {
22
- const o = r.fieldProps ? i(r.fieldProps) ? r.fieldProps({}) : r.fieldProps : {};
23
- return l(e, o) || "--";
19
+ const r = n(e.fieldProps) ? e.fieldProps({}) : e.fieldProps;
20
+ return b(r.required) ? r.required : (p(r.rules) ? r.rules : r.rules ? [r.rules] : []).some((t) => t.required);
21
+ }
22
+ function F(e, r) {
23
+ if (e.valueType === "text" || e.valueType === "textArea")
24
+ return r || "--";
25
+ if (e.valueType === "number") {
26
+ const o = e.fieldProps ? n(e.fieldProps) ? e.fieldProps({}) : e.fieldProps : {};
27
+ return g(r, o) || "--";
24
28
  }
25
- return e;
29
+ return r;
26
30
  }
27
- function w(r, e) {
28
- const o = [r];
29
- if (e) {
30
- const t = n(e) ? e : [e];
31
+ function D(e, r) {
32
+ const o = [e];
33
+ if (r) {
34
+ const t = p(r) ? r : [r];
31
35
  o.unshift(...t);
32
36
  }
33
37
  return o.join(" ");
34
38
  }
35
- function y(r, e = document.body, o = {}) {
36
- const t = e.querySelectorAll("tr.ant-table-row")[r];
37
- console.log(t), t && d(t, {
39
+ function N(e, r = document.body, o = {}) {
40
+ const t = r.querySelectorAll("tr.ant-table-row")[e];
41
+ console.log(t), t && T(t, {
38
42
  scrollMode: "if-needed",
39
43
  block: "nearest",
40
44
  behavior: "smooth",
41
45
  ...o
42
46
  });
43
47
  }
48
+ function V(e, r, o) {
49
+ return y.includes(e.valueType) ? o : e.copyable || e.ellipsis ? s(C.Paragraph, {
50
+ copyable: e.copyable ? {
51
+ text: r,
52
+ tooltip: !1
53
+ } : !1,
54
+ ellipsis: e.ellipsis ? a(e.ellipsis) ? {
55
+ tooltip: r
56
+ } : {
57
+ ...e.ellipsis,
58
+ tooltip: r
59
+ } : !1,
60
+ content: e.ellipsis ? F(e, r) : o
61
+ }, null) : o;
62
+ }
63
+ function O(e, r, o, t) {
64
+ let l;
65
+ if (e.valueType)
66
+ if (r) {
67
+ const i = R(e.valueType);
68
+ l = s(i, o, null);
69
+ } else {
70
+ const i = m[e.valueType];
71
+ l = V(e, t, s(i, d(o.field, {
72
+ mode: "read"
73
+ }), null));
74
+ }
75
+ if (e.customRenderFormItem) {
76
+ const i = e.customRenderFormItem(e, o.field, r);
77
+ l = s(I, u(o, ["field"]), P(i) ? i : {
78
+ default: () => [i]
79
+ });
80
+ }
81
+ return l;
82
+ }
44
83
  export {
45
- b as getColumnIsRequired,
46
- m as getEditableComponent,
47
- g as getRawDisplayValue,
48
- w as mergeClass,
49
- y as scrollToRowIndex
84
+ _ as getColumnIsRequired,
85
+ R as getEditableComponent,
86
+ O as getFinalNode,
87
+ F as getRawDisplayValue,
88
+ D as mergeClass,
89
+ N as scrollToRowIndex
50
90
  };