@aplus-frontend/ui 0.0.35 → 0.0.37

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 (83) hide show
  1. package/es/index.mjs +16 -14
  2. package/es/src/ap-descriptions/ap-descriptions.vue.d.ts +27 -0
  3. package/es/src/ap-descriptions/ap-descriptions.vue.mjs +97 -0
  4. package/es/src/ap-descriptions/ap-descriptions.vue2.mjs +5 -0
  5. package/es/src/ap-descriptions/formatter/index.d.ts +78 -0
  6. package/es/src/ap-descriptions/formatter/index.mjs +127 -0
  7. package/es/src/ap-descriptions/formatter/utils.d.ts +7 -0
  8. package/es/src/ap-descriptions/formatter/utils.mjs +6 -0
  9. package/es/src/ap-descriptions/help-message/index.vue.d.ts +23 -0
  10. package/es/src/ap-descriptions/help-message/index.vue.mjs +4 -0
  11. package/es/src/ap-descriptions/help-message/index.vue2.mjs +27 -0
  12. package/es/src/ap-descriptions/helper.d.ts +10 -0
  13. package/es/src/ap-descriptions/helper.mjs +24 -0
  14. package/es/src/ap-descriptions/index.d.ts +4 -0
  15. package/es/src/ap-descriptions/index.mjs +2 -0
  16. package/es/src/ap-descriptions/interface.d.ts +50 -0
  17. package/es/src/ap-descriptions/interface.mjs +1 -0
  18. package/es/src/ap-descriptions/style/ap-descriptions.css +57 -0
  19. package/es/src/ap-download/ap-download.vue.mjs +27 -21
  20. package/es/src/ap-field/date/index.vue.mjs +35 -33
  21. package/es/src/ap-field/date-range/index.vue.mjs +55 -53
  22. package/es/src/ap-field/hooks/use-default-placeholder.d.ts +16 -0
  23. package/es/src/ap-field/hooks/use-default-placeholder.mjs +25 -0
  24. package/es/src/ap-field/interface.d.ts +4 -3
  25. package/es/src/ap-field/number/index.vue.mjs +25 -23
  26. package/es/src/ap-field/select/index.vue.d.ts +2 -0
  27. package/es/src/ap-field/select/index.vue.mjs +63 -53
  28. package/es/src/ap-field/text/index.vue2.mjs +26 -24
  29. package/es/src/ap-field/text/password.vue.mjs +28 -26
  30. package/es/src/ap-field/text-area/index.vue.mjs +15 -13
  31. package/es/src/ap-table/constants.d.ts +9 -0
  32. package/es/src/config-provider/config-provider-props.d.ts +5 -1
  33. package/es/src/config-provider/config-provider-props.mjs +6 -2
  34. package/es/src/config-provider/config-provider.d.ts +14 -1
  35. package/es/src/config-provider/config-provider.mjs +17 -16
  36. package/es/src/config-provider/constants.d.ts +3 -0
  37. package/es/src/config-provider/hooks/use-global-config.d.ts +5 -1
  38. package/es/src/config-provider/index.d.ts +20 -1
  39. package/es/src/index.d.ts +1 -0
  40. package/es/src/index.mjs +241 -238
  41. package/es/src/theme/ap-descriptions/ap-descriptions.css +57 -0
  42. package/lib/index.js +1 -1
  43. package/lib/src/ap-descriptions/ap-descriptions.vue.d.ts +27 -0
  44. package/lib/src/ap-descriptions/ap-descriptions.vue.js +1 -0
  45. package/lib/src/ap-descriptions/ap-descriptions.vue2.js +1 -0
  46. package/lib/src/ap-descriptions/formatter/index.d.ts +78 -0
  47. package/lib/src/ap-descriptions/formatter/index.js +1 -0
  48. package/lib/src/ap-descriptions/formatter/utils.d.ts +7 -0
  49. package/lib/src/ap-descriptions/formatter/utils.js +1 -0
  50. package/lib/src/ap-descriptions/help-message/index.vue.d.ts +23 -0
  51. package/lib/src/ap-descriptions/help-message/index.vue.js +1 -0
  52. package/lib/src/ap-descriptions/help-message/index.vue2.js +1 -0
  53. package/lib/src/ap-descriptions/helper.d.ts +10 -0
  54. package/lib/src/ap-descriptions/helper.js +1 -0
  55. package/lib/src/ap-descriptions/index.d.ts +4 -0
  56. package/lib/src/ap-descriptions/index.js +1 -0
  57. package/lib/src/ap-descriptions/interface.d.ts +50 -0
  58. package/lib/src/ap-descriptions/interface.js +1 -0
  59. package/lib/src/ap-descriptions/style/ap-descriptions.css +57 -0
  60. package/lib/src/ap-download/ap-download.vue.js +1 -1
  61. package/lib/src/ap-field/date/index.vue.js +1 -1
  62. package/lib/src/ap-field/date-range/index.vue.js +1 -1
  63. package/lib/src/ap-field/hooks/use-default-placeholder.d.ts +16 -0
  64. package/lib/src/ap-field/hooks/use-default-placeholder.js +1 -0
  65. package/lib/src/ap-field/interface.d.ts +4 -3
  66. package/lib/src/ap-field/number/index.vue.js +1 -1
  67. package/lib/src/ap-field/select/index.vue.d.ts +2 -0
  68. package/lib/src/ap-field/select/index.vue.js +1 -1
  69. package/lib/src/ap-field/text/index.vue2.js +1 -1
  70. package/lib/src/ap-field/text/password.vue.js +1 -1
  71. package/lib/src/ap-field/text-area/index.vue.js +1 -1
  72. package/lib/src/ap-table/constants.d.ts +9 -0
  73. package/lib/src/config-provider/config-provider-props.d.ts +5 -1
  74. package/lib/src/config-provider/config-provider-props.js +1 -1
  75. package/lib/src/config-provider/config-provider.d.ts +14 -1
  76. package/lib/src/config-provider/config-provider.js +1 -1
  77. package/lib/src/config-provider/constants.d.ts +3 -0
  78. package/lib/src/config-provider/hooks/use-global-config.d.ts +5 -1
  79. package/lib/src/config-provider/index.d.ts +20 -1
  80. package/lib/src/index.d.ts +1 -0
  81. package/lib/src/index.js +1 -1
  82. package/lib/src/theme/ap-descriptions/ap-descriptions.css +57 -0
  83. package/package.json +1 -1
package/es/index.mjs CHANGED
@@ -5,7 +5,7 @@ import { configProviderProps as x } from "./src/config-provider/config-provider-
5
5
  import { configProviderContextKey as n, tableDefaultConfig as u } from "./src/config-provider/constants.mjs";
6
6
  import { keysOf as c, provideGlobalConfig as F, useGlobalConfig as T } from "./src/config-provider/hooks/use-global-config.mjs";
7
7
  import { buildLocaleContext as S, buildTranslator as b, localeContextKey as I, translate as g, useLocale as P } from "./src/config-provider/hooks/use-locale.mjs";
8
- import { defaultNamespace as D, namespaceContextKey as R, useGetDerivedNamespace as v, useNamespace as M } from "./src/config-provider/hooks/use-namespace.mjs";
8
+ import { defaultNamespace as h, namespaceContextKey as R, useGetDerivedNamespace as v, useNamespace as M } from "./src/config-provider/hooks/use-namespace.mjs";
9
9
  import { ConfigProvider as w, globalConfigCached as B } from "./src/config-provider/config-provider.mjs";
10
10
  import { APConfigProvider as L } from "./src/config-provider/index.mjs";
11
11
  import { Scrollbar as N } from "./src/scroll-bar/index.mjs";
@@ -22,7 +22,7 @@ import { useComponentRegister as Fe } from "./src/pro-form/hooks/use-component-r
22
22
  import { useForm as Ce } from "./src/pro-form/hooks/use-form.mjs";
23
23
  import { isComponentFormSchema as be, isSlotFormSchema as Ie } from "./src/pro-form/types/form.mjs";
24
24
  import { Field as Pe } from "./src/pro-form/index.mjs";
25
- import { default as De } from "./src/pro-form/components/api-cascader.vue.mjs";
25
+ import { default as he } from "./src/pro-form/components/api-cascader.vue.mjs";
26
26
  import { default as ve } from "./src/pro-form/components/api-radio-group.vue.mjs";
27
27
  import { default as ke } from "./src/pro-form/components/api-select.vue.mjs";
28
28
  import { default as Be } from "./src/pro-form/components/api-transfer.vue.mjs";
@@ -47,7 +47,7 @@ import { default as To } from "./src/pro-table/pro-table.vue.mjs";
47
47
  import { default as So } from "./src/pro-table/components/table-action.vue.mjs";
48
48
  import { default as Io } from "./src/pro-table/components/edit-table-header-icon.vue.mjs";
49
49
  import { default as Po } from "./src/pro-table/components/table-image.vue.mjs";
50
- import { useTable as Do } from "./src/pro-table/hooks/use-table.mjs";
50
+ import { useTable as ho } from "./src/pro-table/hooks/use-table.mjs";
51
51
  import { ApFormItemText as vo } from "./src/ap-form/items/text/index.mjs";
52
52
  import { default as ko } from "./src/ap-form/items/text-area/index.vue.mjs";
53
53
  import { default as Bo } from "./src/ap-form/items/number/index.vue.mjs";
@@ -74,7 +74,7 @@ import { default as Tr } from "./src/ap-field/switch/index.vue.mjs";
74
74
  import { default as Sr } from "./src/ap-field/text-area/index.vue.mjs";
75
75
  import { default as Ir } from "./src/ap-field/date-range/index.vue.mjs";
76
76
  import { default as Pr } from "./src/ap-field/select/index.vue.mjs";
77
- import { default as Dr } from "./src/ap-field/text/password.vue.mjs";
77
+ import { default as hr } from "./src/ap-field/text/password.vue.mjs";
78
78
  import { default as vr } from "./src/ap-field/slider/index.vue.mjs";
79
79
  import { default as kr } from "./src/ap-field/segmented/index.vue.mjs";
80
80
  import { default as Br } from "./src/ap-field/rate/index.vue.mjs";
@@ -100,14 +100,15 @@ import { default as Ft } from "./src/ap-download/ap-download.vue.mjs";
100
100
  import { CheckCard as Ct } from "./src/check-card/index.mjs";
101
101
  import { default as bt } from "./src/check-card/group.vue.mjs";
102
102
  import { ApModal as gt } from "./src/ap-modal/index.mjs";
103
- import { default as ht } from "./src/ap-list/index.vue.mjs";
103
+ import { default as Dt } from "./src/ap-list/index.vue.mjs";
104
104
  import { ApExpandAlert as Rt, ApLabel as vt, ApSelectLayout as Mt, ApStatus as kt, ApStatusGroup as wt, ApTitle as Bt } from "./src/business/index.mjs";
105
105
  import { useTablePaging as Lt } from "./src/ap-table/hooks/use-table-paging.mjs";
106
106
  import { default as Nt } from "./src/ap-table/ap-table.vue.mjs";
107
107
  import { default as Xt } from "./src/editable-table/index.vue.mjs";
108
108
  import { default as Yt } from "./src/editable-table/form-item.vue.mjs";
109
- import { useMessage as Ht } from "./src/hooks/useMessage.mjs";
110
- import { useControllableValue as zt } from "./src/hooks/useControllableValue.mjs";
109
+ import { default as Ht } from "./src/ap-descriptions/ap-descriptions.vue.mjs";
110
+ import { useMessage as zt } from "./src/hooks/useMessage.mjs";
111
+ import { useControllableValue as Vt } from "./src/hooks/useControllableValue.mjs";
111
112
  const p = {
112
113
  install: (r) => {
113
114
  for (const t in o) {
@@ -125,6 +126,7 @@ export {
125
126
  Or as ApActionItemPopconfirm,
126
127
  Qr as ApCustomColumn,
127
128
  _r as ApCustomSelect,
129
+ Ht as ApDescriptions,
128
130
  Ft as ApDownload,
129
131
  Rt as ApExpandAlert,
130
132
  fr as ApField,
@@ -132,7 +134,7 @@ export {
132
134
  ir as ApFieldDate,
133
135
  Ir as ApFieldDateRange,
134
136
  ur as ApFieldNumber,
135
- Dr as ApFieldPassword,
137
+ hr as ApFieldPassword,
136
138
  cr as ApFieldRadio,
137
139
  Br as ApFieldRate,
138
140
  kr as ApFieldSegmented,
@@ -159,7 +161,7 @@ export {
159
161
  rr as ApFormSearchForm,
160
162
  xt as ApInfoLayout,
161
163
  vt as ApLabel,
162
- ht as ApList,
164
+ Dt as ApList,
163
165
  gt as ApModal,
164
166
  Mt as ApSelectLayout,
165
167
  kt as ApStatus,
@@ -169,7 +171,7 @@ export {
169
171
  st as ApTagGroup,
170
172
  Bt as ApTitle,
171
173
  At as ApUpload,
172
- De as ApiCascader,
174
+ he as ApiCascader,
173
175
  ve as ApiRadioGroup,
174
176
  ke as ApiSelect,
175
177
  Be as ApiTransfer,
@@ -235,7 +237,7 @@ export {
235
237
  uo as createPrompt,
236
238
  tt as createWorkOrderModal,
237
239
  p as default,
238
- D as defaultNamespace,
240
+ h as defaultNamespace,
239
241
  U as en,
240
242
  $r as generateTableList,
241
243
  B as globalConfigCached,
@@ -249,18 +251,18 @@ export {
249
251
  g as translate,
250
252
  qr as useCacheColumnSetting,
251
253
  Fe as useComponentRegister,
252
- zt as useControllableValue,
254
+ Vt as useControllableValue,
253
255
  ne as useDescription,
254
256
  Ce as useForm,
255
257
  v as useGetDerivedNamespace,
256
258
  T as useGlobalConfig,
257
259
  P as useLocale,
258
- Ht as useMessage,
260
+ zt as useMessage,
259
261
  ro as useModal,
260
262
  eo as useModalContext,
261
263
  to as useModalInner,
262
264
  M as useNamespace,
263
- Do as useTable,
265
+ ho as useTable,
264
266
  Lt as useTablePaging,
265
267
  W as zhCn
266
268
  };
@@ -0,0 +1,27 @@
1
+ import { DisplayInfoProps } from './interface';
2
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes, VNode, RendererNode, RendererElement, VNodeChild, PropType } from 'vue';
3
+
4
+ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_TypePropsToRuntimeProps<DisplayInfoProps>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_TypePropsToRuntimeProps<DisplayInfoProps>>>, {}, {}>, Partial<Record<string, (_: {
5
+ index: number;
6
+ item: VNode<RendererNode, RendererElement, {
7
+ [key: string]: any;
8
+ }> | VNodeChild;
9
+ record: {
10
+ [x: string]: any;
11
+ } | undefined;
12
+ }) => any>>>;
13
+ export default _default;
14
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
15
+ type __VLS_TypePropsToRuntimeProps<T> = {
16
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
17
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
18
+ } : {
19
+ type: PropType<T[K]>;
20
+ required: true;
21
+ };
22
+ };
23
+ type __VLS_WithTemplateSlots<T, S> = T & {
24
+ new (): {
25
+ $slots: S;
26
+ };
27
+ };
@@ -0,0 +1,97 @@
1
+ import { defineComponent as D, openBlock as o, createElementBlock as s, normalizeClass as N, unref as r, normalizeStyle as w, createVNode as F, mergeProps as B, withCtx as y, Fragment as p, renderList as T, createBlock as c, h as d, renderSlot as _, resolveDynamicComponent as M } from "vue";
2
+ import { Descriptions as V, DescriptionsItem as f } from "ant-design-vue";
3
+ import { transformValue as h, isEmptyWithType as j } from "./helper.mjs";
4
+ import { get as S } from "lodash-unified";
5
+ import "./help-message/index.vue.mjs";
6
+ import "../config-provider/index.mjs";
7
+ import "./style/ap-descriptions.css";
8
+ import { useGlobalConfig as m } from "../config-provider/hooks/use-global-config.mjs";
9
+ import { useNamespace as x } from "../config-provider/hooks/use-namespace.mjs";
10
+ import z from "./help-message/index.vue2.mjs";
11
+ const E = { key: 0 }, J = /* @__PURE__ */ D({
12
+ __name: "ap-descriptions",
13
+ props: {
14
+ descriptionsProps: {},
15
+ schemas: {},
16
+ dataSource: {},
17
+ style: { type: [Boolean, null, String, Object, Array] },
18
+ className: {}
19
+ },
20
+ setup(b) {
21
+ const i = b, k = m("uiMode", "admin"), g = m("apDescriptions"), { m: P, b: v } = x("ap-descriptions"), C = (t = {}) => {
22
+ var l;
23
+ let a = "";
24
+ return ((l = i.descriptionsProps) == null ? void 0 : l.layout) === "vertical" && (a = "start"), {
25
+ justifyContent: a,
26
+ ...t
27
+ };
28
+ }, u = (t) => {
29
+ var e, n;
30
+ const a = S(i.dataSource, t.field);
31
+ if (t.customRender)
32
+ return t.customRender(i.dataSource);
33
+ const l = (e = g.value) == null ? void 0 : e.downloadFile;
34
+ return t.valueType === "attachment" && !((n = t.extraProps) != null && n.downloadFile) && l && (t.extraProps ? t.extraProps.downloadFile = l : t.extraProps = {
35
+ downloadFile: l
36
+ }), h({ value: a, record: i.dataSource }, t);
37
+ };
38
+ return (t, a) => {
39
+ var l;
40
+ return o(), s("div", {
41
+ class: N([t.className, r(v)(), r(P)(r(k))]),
42
+ style: w(t.style)
43
+ }, [
44
+ F(r(V), B(t.descriptionsProps, {
45
+ labelStyle: C({ ...((l = t.descriptionsProps) == null ? void 0 : l.labelStyle) || {} })
46
+ }), {
47
+ default: y(() => [
48
+ (o(!0), s(p, null, T(t.schemas, (e, n) => (o(), s(p, {
49
+ key: e.field || "empty" + n
50
+ }, [
51
+ e.valueType === "empty" ? (o(), c(r(f), {
52
+ key: 0,
53
+ contentStyle: e.contentStyle,
54
+ labelStyle: e.labelStyle,
55
+ span: e.span
56
+ }, null, 8, ["contentStyle", "labelStyle", "span"])) : (o(), c(r(f), {
57
+ key: 1,
58
+ label: e.label ? d(p, [
59
+ d(
60
+ z,
61
+ { helpMessage: e.helpMessage },
62
+ { default: () => e.label }
63
+ )
64
+ ]) : null,
65
+ span: e.span,
66
+ contentStyle: e.contentStyle,
67
+ labelStyle: e.labelStyle
68
+ }, {
69
+ default: y(() => [
70
+ r(j)(r(S)(t.dataSource, e.field), e.valueType) ? (o(), s("span", E, "--")) : (o(), s(p, { key: 1 }, [
71
+ e.contentSlotName ? _(t.$slots, e.contentSlotName, {
72
+ key: 0,
73
+ index: n,
74
+ item: u(e),
75
+ record: t.dataSource
76
+ }) : (o(), c(M(
77
+ d(p, [
78
+ e.prefix,
79
+ u(e),
80
+ e.suffix
81
+ ])
82
+ ), { key: 1 }))
83
+ ], 64))
84
+ ]),
85
+ _: 2
86
+ }, 1032, ["label", "span", "contentStyle", "labelStyle"]))
87
+ ], 64))), 128))
88
+ ]),
89
+ _: 3
90
+ }, 16, ["labelStyle"])
91
+ ], 6);
92
+ };
93
+ }
94
+ });
95
+ export {
96
+ J as default
97
+ };
@@ -0,0 +1,5 @@
1
+ import o from "./ap-descriptions.vue.mjs";
2
+ import "./style/ap-descriptions.css?vue&type=style&index=0&src=true&lang.css";
3
+ export {
4
+ o as default
5
+ };
@@ -0,0 +1,78 @@
1
+ import { ZoneAlias } from '@aplus-frontend/utils';
2
+ import { FieldPath, FormatOptions } from '../interface';
3
+ import { StyleValue } from 'vue';
4
+
5
+ /** 处理文本类型 */
6
+ export declare function text(opt: FormatOptions): any;
7
+ interface ArrayExtraProps {
8
+ /** 默认值空格链接 */
9
+ joinSymbol?: string;
10
+ }
11
+ /** 处理数组类型 */
12
+ export declare function array({ value }: FormatOptions, extraProps?: ArrayExtraProps): any;
13
+ interface DateExtraProps {
14
+ /** 时区默认为LA */
15
+ zoneAlias?: ZoneAlias;
16
+ /** 格式化日期格式默认 YYYY-MM-DD HH:mm:ss*/
17
+ format?: string;
18
+ }
19
+ /** 处理日期 */
20
+ export declare function date({ value }: FormatOptions, extraProps?: DateExtraProps): string;
21
+ interface TemplateExtraProps {
22
+ /** 字段列表,有顺序要求 */
23
+ fieldList?: FieldPath[];
24
+ /** 模版字符串: 格式为 ‘{0}-{0}-{1}’ */
25
+ templateString?: string;
26
+ /** 获取值后的处理函数 */
27
+ formatter?: (value: any, index: number) => any;
28
+ }
29
+ /** 处理字符串模版 */
30
+ export declare function template({ value, record }: FormatOptions, extraProps: TemplateExtraProps): string;
31
+ interface DateRangeExtraProps {
32
+ /** 字段列表,有顺序要求 */
33
+ fieldList: [FieldPath, FieldPath];
34
+ /** 日期格式化
35
+ * @default 'YYYY-MM-DD HH:mm:ss''
36
+ */
37
+ format?: string | [string, string];
38
+ /** 链接符号
39
+ * @default '~'
40
+ */
41
+ joinSymbol?: string;
42
+ /** 时区别名
43
+ * @default 'LA' */
44
+ zoneAlias?: ZoneAlias;
45
+ }
46
+ /** 处理日期范围 */
47
+ export declare function dateRange({ value, record }: FormatOptions, extraProps: DateRangeExtraProps): string;
48
+ interface AttachmentExtraProps {
49
+ /** url字段路径 */
50
+ urlPath?: string | string[];
51
+ /** 资源名称字段路径 */
52
+ namePath?: string | string[];
53
+ /** 字段样式 */
54
+ style?: StyleValue;
55
+ /** 类名称 */
56
+ className?: string;
57
+ /** 下载资源函数,可以通过descriptions的downloadFile属性统一设置 */
58
+ downloadFile?: (url: string, name: string) => void;
59
+ }
60
+ /** 处理附件类型 */
61
+ export declare function attachment({ record }: FormatOptions, opt: AttachmentExtraProps): import("vue/jsx-runtime").JSX.Element;
62
+ interface NumberExtraProps {
63
+ style?: StyleValue;
64
+ /** 限制小数点位数 */
65
+ precision?: number;
66
+ }
67
+ /** 处理数字型数据 */
68
+ export declare function number({ value }: FormatOptions, opt: NumberExtraProps): import("vue/jsx-runtime").JSX.Element;
69
+ export declare const formatterMap: {
70
+ text: typeof text;
71
+ array: typeof array;
72
+ date: typeof date;
73
+ dateRange: typeof dateRange;
74
+ template: typeof template;
75
+ number: typeof number;
76
+ attachment: typeof attachment;
77
+ };
78
+ export {};
@@ -0,0 +1,127 @@
1
+ import { createVNode as l } from "vue";
2
+ import { getTimeFormatToZone as g } from "@aplus-frontend/utils";
3
+ import { merge as p, get as f } from "lodash-unified";
4
+ import { formatString as h } from "./utils.mjs";
5
+ import { toDecimalMark as Y } from "@fruits-chain/utils";
6
+ function A(t) {
7
+ return t.value;
8
+ }
9
+ function M({
10
+ value: t
11
+ }, r) {
12
+ var n;
13
+ const {
14
+ joinSymbol: e
15
+ } = p({
16
+ joinSymbol: " "
17
+ }, r);
18
+ return (n = t == null ? void 0 : t.join) == null ? void 0 : n.call(t, e);
19
+ }
20
+ function u({
21
+ value: t
22
+ }, r) {
23
+ const {
24
+ zoneAlias: e,
25
+ format: n
26
+ } = p({
27
+ zoneAlias: "LA",
28
+ format: "YYYY-MM-DD HH:mm:ss"
29
+ }, r);
30
+ return g(t, e, n);
31
+ }
32
+ function y({
33
+ value: t,
34
+ record: r
35
+ }, e) {
36
+ const {
37
+ fieldList: n,
38
+ templateString: o = "{0}",
39
+ formatter: m
40
+ } = e, s = (n == null ? void 0 : n.map((a, i) => {
41
+ const c = f(r, a);
42
+ return m ? m(c, i) : c;
43
+ })) || [];
44
+ return s.length === 0 && s.push(t), h(o, s);
45
+ }
46
+ function S({
47
+ value: t,
48
+ record: r
49
+ }, e) {
50
+ const {
51
+ fieldList: n,
52
+ format: o = "YYYY-MM-DD HH:mm:ss",
53
+ joinSymbol: m = "~",
54
+ zoneAlias: s = "LA"
55
+ } = e, a = Array.isArray(o) ? o : [o, o];
56
+ return y({
57
+ value: t,
58
+ record: r
59
+ }, {
60
+ fieldList: n,
61
+ templateString: `{0} ${m} {1}`,
62
+ formatter(i, c) {
63
+ return u({
64
+ value: i,
65
+ record: r
66
+ }, {
67
+ format: a[c],
68
+ zoneAlias: s
69
+ });
70
+ }
71
+ });
72
+ }
73
+ function b({
74
+ record: t
75
+ }, r) {
76
+ const {
77
+ urlPath: e = "url",
78
+ namePath: n = "name",
79
+ style: o,
80
+ downloadFile: m,
81
+ className: s
82
+ } = r, a = f(t, n), i = f(t, e);
83
+ return l("span", {
84
+ style: o,
85
+ class: [s, "ap-descriptions-item-content__link "],
86
+ onClick: () => {
87
+ m == null || m(i, a);
88
+ }
89
+ }, [a]);
90
+ }
91
+ function k({
92
+ value: t
93
+ }, r) {
94
+ const {
95
+ style: e = {},
96
+ precision: n
97
+ } = r;
98
+ let o = "";
99
+ try {
100
+ o = Y(t, n);
101
+ } catch {
102
+ o = t;
103
+ }
104
+ return l("span", {
105
+ style: e,
106
+ class: "ap-descriptions-item-content__number"
107
+ }, [o]);
108
+ }
109
+ const z = {
110
+ text: A,
111
+ array: M,
112
+ date: u,
113
+ dateRange: S,
114
+ template: y,
115
+ number: k,
116
+ attachment: b
117
+ };
118
+ export {
119
+ M as array,
120
+ b as attachment,
121
+ u as date,
122
+ S as dateRange,
123
+ z as formatterMap,
124
+ k as number,
125
+ y as template,
126
+ A as text
127
+ };
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 处理字符串格式化类型为:“{0}-{1}-{2}” 的字符串
3
+ * @param str 处理前的字符串
4
+ * @param values 插入的值
5
+ * @returns 处理后的字符串
6
+ */
7
+ export declare function formatString(str: string, values: string[]): string;
@@ -0,0 +1,6 @@
1
+ function f(e, r) {
2
+ return e.replace(/{(\d+)}/g, (n, t) => typeof r[t] < "u" ? r[t] : n);
3
+ }
4
+ export {
5
+ f as formatString
6
+ };
@@ -0,0 +1,23 @@
1
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ExtractPropTypes, PropType } from 'vue';
2
+ declare const _default: __VLS_WithTemplateSlots< DefineComponent<__VLS_TypePropsToRuntimeProps<{
3
+ helpMessage?: string | undefined;
4
+ }>, {}, unknown, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly< ExtractPropTypes<__VLS_TypePropsToRuntimeProps<{
5
+ helpMessage?: string | undefined;
6
+ }>>>, {}, {}>, {
7
+ default?(_: {}): any;
8
+ }>;
9
+ export default _default;
10
+ type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
11
+ type __VLS_TypePropsToRuntimeProps<T> = {
12
+ [K in keyof T]-?: {} extends Pick<T, K> ? {
13
+ type: PropType<__VLS_NonUndefinedable<T[K]>>;
14
+ } : {
15
+ type: PropType<T[K]>;
16
+ required: true;
17
+ };
18
+ };
19
+ type __VLS_WithTemplateSlots<T, S> = T & {
20
+ new (): {
21
+ $slots: S;
22
+ };
23
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue2.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,27 @@
1
+ import { defineComponent as s, openBlock as t, createElementBlock as l, renderSlot as n, createBlock as r, unref as o, withCtx as p, createVNode as a, createCommentVNode as i } from "vue";
2
+ import { QuestionCircleOutlined as c } from "@ant-design/icons-vue";
3
+ import { Tooltip as m } from "ant-design-vue";
4
+ const d = { style: { display: "flex", "align-items": "center" } }, k = /* @__PURE__ */ s({
5
+ __name: "index",
6
+ props: {
7
+ helpMessage: {}
8
+ },
9
+ setup(f) {
10
+ return (e, u) => (t(), l("span", d, [
11
+ n(e.$slots, "default"),
12
+ e.helpMessage ? (t(), r(o(m), {
13
+ key: 0,
14
+ placement: "topLeft",
15
+ title: e.helpMessage
16
+ }, {
17
+ default: p(() => [
18
+ a(o(c), { class: "ap-descriptions-item-content__help" })
19
+ ]),
20
+ _: 1
21
+ }, 8, ["title"])) : i("", !0)
22
+ ]));
23
+ }
24
+ });
25
+ export {
26
+ k as default
27
+ };
@@ -0,0 +1,10 @@
1
+ import { FormatOptions, FormatterValueType, TransformOptionType } from './interface';
2
+ import { VNode, VNodeChild } from 'vue';
3
+
4
+ export declare function transformValue(data: FormatOptions, opt: TransformOptionType): VNodeChild | VNode;
5
+ /**
6
+ * 根据type判断是否为空
7
+ * @param value 值
8
+ * @param type 类型
9
+ */
10
+ export declare function isEmptyWithType(value: unknown, type: FormatterValueType): boolean;
@@ -0,0 +1,24 @@
1
+ import { isEmpty as a } from "lodash-unified";
2
+ import { formatterMap as n } from "./formatter/index.mjs";
3
+ function c(t, r) {
4
+ const e = n[r.valueType];
5
+ return e ? e(t, r.extraProps || {}) : t.value;
6
+ }
7
+ function m(t, r) {
8
+ switch (r) {
9
+ case "text":
10
+ case "number":
11
+ case "dateRange":
12
+ case "date":
13
+ return t == null || t === "";
14
+ case "array":
15
+ case "attachment":
16
+ return a(t);
17
+ default:
18
+ return !t;
19
+ }
20
+ }
21
+ export {
22
+ m as isEmptyWithType,
23
+ c as transformValue
24
+ };
@@ -0,0 +1,4 @@
1
+ import { default as ApDescriptions } from './ap-descriptions.vue';
2
+
3
+ export * from './interface';
4
+ export { ApDescriptions };
@@ -0,0 +1,2 @@
1
+ import "./ap-descriptions.vue2.mjs";
2
+ import "./interface.mjs";
@@ -0,0 +1,50 @@
1
+ import { DescriptionsProps } from 'ant-design-vue';
2
+ import { CSSProperties, StyleValue, VNode, VNodeChild } from 'vue';
3
+ import { formatterMap } from './formatter';
4
+
5
+ /** 字段路径 */
6
+ export type FieldPath = string | string[];
7
+ type FormatterMapType = typeof formatterMap;
8
+ export type FormatterValueType = keyof typeof formatterMap;
9
+ /** 提取某个对象类型的某个key和key的类型 */
10
+ type MixObjectPropertyType<O, key extends keyof O> = key extends keyof O ? {
11
+ valueType: key;
12
+ extraProps?: O[key] extends (a: infer _, b: infer B) => unknown ? B : O[key];
13
+ } : never;
14
+ export type TransformOptionType = MixObjectPropertyType<FormatterMapType, FormatterValueType>;
15
+ type Recordable = Record<string, any>;
16
+ /** 基本描述类型 */
17
+ export interface ItemSchema<T extends Recordable = Recordable> {
18
+ label: VNodeChild | VNode;
19
+ field: keyof T;
20
+ span?: number;
21
+ prefix?: VNodeChild | VNode;
22
+ suffix?: VNodeChild | VNode;
23
+ contentStyle?: CSSProperties;
24
+ labelStyle?: CSSProperties;
25
+ customRender?: (record?: T) => VNodeChild | VNode;
26
+ contentSlotName?: string;
27
+ helpMessage?: string;
28
+ }
29
+ /** 空的类型描述类型 */
30
+ export type EmptyItemSchema = {
31
+ valueType: 'empty';
32
+ } & Partial<ItemSchema>;
33
+ /** 混合处理函数类型的描述类型 */
34
+ export type MixSchemaAndOptionType<T extends Recordable = Recordable, Y extends TransformOptionType = TransformOptionType> = TransformOptionType extends TransformOptionType ? ItemSchema<T> & Y : ItemSchema<T>;
35
+ /** 所有的描述类型 */
36
+ export type DescriptionsItemSchema<T extends Recordable = any> = MixSchemaAndOptionType<T> | EmptyItemSchema;
37
+ /** descriptions的props类型 */
38
+ export interface DisplayInfoProps {
39
+ descriptionsProps?: DescriptionsProps;
40
+ schemas?: DescriptionsItemSchema[];
41
+ dataSource?: Recordable;
42
+ style?: StyleValue;
43
+ className?: string;
44
+ }
45
+ /** 传给转换函数 */
46
+ export interface FormatOptions {
47
+ value: any;
48
+ record: any;
49
+ }
50
+ export {};