@aplus-frontend/ui 7.7.11 → 7.8.0

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 (57) hide show
  1. package/es/index.mjs +224 -222
  2. package/es/src/ap-field/hooks/use-default-placeholder.d.ts +2 -1
  3. package/es/src/ap-field/hooks/use-default-placeholder.mjs +8 -7
  4. package/es/src/ap-field/index.d.ts +10 -2
  5. package/es/src/ap-field/index.mjs +65 -58
  6. package/es/src/ap-field/interface.d.ts +11 -0
  7. package/es/src/ap-field/second/helper.d.ts +7 -0
  8. package/es/src/ap-field/second/helper.mjs +9 -0
  9. package/es/src/ap-field/second/index.vue.d.ts +44 -0
  10. package/es/src/ap-field/second/index.vue.mjs +90 -0
  11. package/es/src/ap-field/second/index.vue2.mjs +4 -0
  12. package/es/src/ap-field/second/read.vue.d.ts +6 -0
  13. package/es/src/ap-field/second/read.vue.mjs +4 -0
  14. package/es/src/ap-field/second/read.vue2.mjs +58 -0
  15. package/es/src/ap-field/style/textarea.mjs +15 -5
  16. package/es/src/ap-field/text-area/index.vue.d.ts +3 -0
  17. package/es/src/ap-field/text-area/index.vue.mjs +44 -28
  18. package/es/src/ap-field/text-area/read.vue.d.ts +3 -0
  19. package/es/src/ap-field/text-area/read.vue2.mjs +26 -8
  20. package/es/src/ap-field/text-area/utils.d.ts +1 -0
  21. package/es/src/ap-field/text-area/utils.mjs +13 -0
  22. package/es/src/ap-form/items/text-area/index.vue.d.ts +12 -0
  23. package/es/src/ap-table/constants.d.ts +9 -0
  24. package/es/src/business/ap-batch-action-group/MenuItemGroup.vue2.mjs +19 -19
  25. package/es/src/business/ap-batch-action-group/interface.d.ts +4 -1
  26. package/es/src/index.mjs +194 -192
  27. package/es/src/version.d.ts +1 -1
  28. package/es/src/version.mjs +1 -1
  29. package/lib/index.js +1 -1
  30. package/lib/src/ap-field/hooks/use-default-placeholder.d.ts +2 -1
  31. package/lib/src/ap-field/hooks/use-default-placeholder.js +1 -1
  32. package/lib/src/ap-field/index.d.ts +10 -2
  33. package/lib/src/ap-field/index.js +1 -1
  34. package/lib/src/ap-field/interface.d.ts +11 -0
  35. package/lib/src/ap-field/second/helper.d.ts +7 -0
  36. package/lib/src/ap-field/second/helper.js +1 -0
  37. package/lib/src/ap-field/second/index.vue.d.ts +44 -0
  38. package/lib/src/ap-field/second/index.vue.js +1 -0
  39. package/lib/src/ap-field/second/index.vue2.js +1 -0
  40. package/lib/src/ap-field/second/read.vue.d.ts +6 -0
  41. package/lib/src/ap-field/second/read.vue.js +1 -0
  42. package/lib/src/ap-field/second/read.vue2.js +1 -0
  43. package/lib/src/ap-field/style/textarea.js +1 -1
  44. package/lib/src/ap-field/text-area/index.vue.d.ts +3 -0
  45. package/lib/src/ap-field/text-area/index.vue.js +1 -1
  46. package/lib/src/ap-field/text-area/read.vue.d.ts +3 -0
  47. package/lib/src/ap-field/text-area/read.vue2.js +1 -1
  48. package/lib/src/ap-field/text-area/utils.d.ts +1 -0
  49. package/lib/src/ap-field/text-area/utils.js +1 -0
  50. package/lib/src/ap-form/items/text-area/index.vue.d.ts +12 -0
  51. package/lib/src/ap-table/constants.d.ts +9 -0
  52. package/lib/src/business/ap-batch-action-group/MenuItemGroup.vue2.js +1 -1
  53. package/lib/src/business/ap-batch-action-group/interface.d.ts +4 -1
  54. package/lib/src/index.js +1 -1
  55. package/lib/src/version.d.ts +1 -1
  56. package/lib/src/version.js +1 -1
  57. package/package.json +1 -1
@@ -22,71 +22,78 @@ import "./checkbox/read.vue.mjs";
22
22
  import "./select/read.vue.mjs";
23
23
  import "./switch/read.vue.mjs";
24
24
  import "./tree-select/read.vue.mjs";
25
+ import "./second/index.vue2.mjs";
26
+ import "./second/read.vue.mjs";
25
27
  import "./interface.mjs";
26
- import i from "./text/read-password.vue2.mjs";
28
+ import i from "./second/read.vue2.mjs";
29
+ import o from "./text/read-password.vue2.mjs";
27
30
  import r from "./tree-select/read.vue2.mjs";
28
- import o from "./switch/read.vue2.mjs";
29
- import t from "./select/read.vue2.mjs";
30
- import e from "./checkbox/read.vue2.mjs";
31
- import p from "./radio/read.vue2.mjs";
32
- import a from "./date-range/read.vue2.mjs";
33
- import f from "./date/read.vue2.mjs";
34
- import _ from "./number/read.vue2.mjs";
31
+ import t from "./switch/read.vue2.mjs";
32
+ import e from "./select/read.vue2.mjs";
33
+ import p from "./checkbox/read.vue2.mjs";
34
+ import a from "./radio/read.vue2.mjs";
35
+ import f from "./date-range/read.vue2.mjs";
36
+ import _ from "./date/read.vue2.mjs";
37
+ import c from "./number/read.vue2.mjs";
35
38
  import s from "./text-area/read.vue2.mjs";
36
- import c from "./text/read.vue2.mjs";
37
- import n from "./tree-select/index.vue.mjs";
38
- import d from "./rate/index.vue.mjs";
39
- import l from "./segmented/index.vue.mjs";
40
- import $ from "./slider/index.vue.mjs";
41
- import A from "./switch/index.vue.mjs";
42
- import F from "./select/index.vue.mjs";
43
- import S from "./checkbox/index.vue.mjs";
44
- import x from "./radio/index.vue.mjs";
45
- import R from "./date-range/index.vue.mjs";
46
- import T from "./date/index.vue.mjs";
47
- import b from "./number/index.vue.mjs";
48
- import h from "./text-area/index.vue.mjs";
49
- const Sm = {
50
- Text: c,
39
+ import n from "./text/read.vue2.mjs";
40
+ import d from "./second/index.vue.mjs";
41
+ import l from "./tree-select/index.vue.mjs";
42
+ import $ from "./rate/index.vue.mjs";
43
+ import A from "./segmented/index.vue.mjs";
44
+ import F from "./slider/index.vue.mjs";
45
+ import S from "./switch/index.vue.mjs";
46
+ import x from "./select/index.vue.mjs";
47
+ import R from "./checkbox/index.vue.mjs";
48
+ import T from "./radio/index.vue.mjs";
49
+ import b from "./date-range/index.vue.mjs";
50
+ import h from "./date/index.vue.mjs";
51
+ import g from "./number/index.vue.mjs";
52
+ import D from "./text-area/index.vue.mjs";
53
+ const gm = {
54
+ Text: n,
51
55
  TextArea: s,
52
- Number: _,
53
- Date: f,
54
- DateRange: a,
55
- Radio: p,
56
- Checkbox: e,
57
- Select: t,
58
- Switch: o,
56
+ Number: c,
57
+ Date: _,
58
+ DateRange: f,
59
+ Radio: a,
60
+ Checkbox: p,
61
+ Select: e,
62
+ Switch: t,
59
63
  TreeSelect: r,
60
- Password: i
61
- }, xm = {
64
+ Password: o,
65
+ Second: i
66
+ }, Dm = {
62
67
  Text: m,
63
- TextArea: h,
64
- Number: b,
65
- Date: T,
66
- DateRange: R,
67
- Radio: x,
68
- Checkbox: S,
69
- Select: F,
70
- Switch: A,
71
- Slider: $,
72
- Segmented: l,
73
- Rate: d,
74
- TreeSelect: n
68
+ TextArea: D,
69
+ Number: g,
70
+ Date: h,
71
+ DateRange: b,
72
+ Radio: T,
73
+ Checkbox: R,
74
+ Select: x,
75
+ Switch: S,
76
+ Slider: F,
77
+ Segmented: A,
78
+ Rate: $,
79
+ TreeSelect: l,
80
+ Second: d
75
81
  };
76
82
  export {
77
- xm as ApField,
78
- S as ApFieldCheckbox,
79
- T as ApFieldDate,
80
- R as ApFieldDateRange,
81
- b as ApFieldNumber,
82
- x as ApFieldRadio,
83
- d as ApFieldRate,
84
- Sm as ApFieldRead,
85
- l as ApFieldSegmented,
86
- F as ApFieldSelect,
87
- $ as ApFieldSlider,
88
- A as ApFieldSwitch,
83
+ Dm as ApField,
84
+ R as ApFieldCheckbox,
85
+ h as ApFieldDate,
86
+ b as ApFieldDateRange,
87
+ g as ApFieldNumber,
88
+ T as ApFieldRadio,
89
+ $ as ApFieldRate,
90
+ gm as ApFieldRead,
91
+ d as ApFieldSecond,
92
+ A as ApFieldSegmented,
93
+ x as ApFieldSelect,
94
+ F as ApFieldSlider,
95
+ S as ApFieldSwitch,
89
96
  m as ApFieldText,
90
- h as ApFieldTextArea,
91
- n as ApFieldTreeSelect
97
+ D as ApFieldTextArea,
98
+ l as ApFieldTreeSelect
92
99
  };
@@ -107,6 +107,12 @@ export type ApFieldTextAreaProps = BasicApFieldProps<Omit<TextAreaProps, 'autosi
107
107
  * @returns
108
108
  */
109
109
  beforeInput?: (nextVal: string) => string;
110
+ /**
111
+ * 是否是代码片段
112
+ */
113
+ code?: boolean | {
114
+ language?: 'text' | 'json';
115
+ };
110
116
  };
111
117
  export type ApFieldTextAreaExpose = {
112
118
  focus: (options?: InputFocusOptions) => void;
@@ -225,3 +231,8 @@ export type ApFieldRateExpose = {
225
231
  focus: () => void;
226
232
  blur: () => void;
227
233
  };
234
+ export type ApFieldSecondProps = BasicApFieldProps<InputNumberProps> & {
235
+ placeholder?: string;
236
+ emptyText?: string;
237
+ };
238
+ export type ApFieldSecondExpose = ApiFieldNumberExpose;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 格式化秒
3
+ *
4
+ * @param result
5
+ * @returns {string}
6
+ */
7
+ export declare function formatSecond(result: number): string;
@@ -0,0 +1,9 @@
1
+ function a(n) {
2
+ let o = n, t = "", f = !1;
3
+ o < 0 && (o = -o, f = !0);
4
+ const e = Math.floor(o / (3600 * 24)), r = Math.floor(o / 3600 % 24), l = Math.floor(o / 60 % 60);
5
+ return t = `${Math.floor(o % 60)}秒`, l > 0 && (t = `${l}分钟${t}`), r > 0 && (t = `${r}小时${t}`), e > 0 && (t = `${e}天${t}`), f && (t += "前"), t;
6
+ }
7
+ export {
8
+ a as formatSecond
9
+ };
@@ -0,0 +1,44 @@
1
+ import { ApFieldSecondProps } from '../interface';
2
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
3
+ import { ValueType } from '@aplus-frontend/antdv/es/input-number/src/utils/MiniDecimal';
4
+ type ApFieldSecondSlots = {
5
+ addonBefore?: any;
6
+ addonAfter?: any;
7
+ prefix?: any;
8
+ default?: any;
9
+ upIcon?: any;
10
+ downIcon?: any;
11
+ };
12
+ declare function __VLS_template(): {
13
+ attrs: Partial<{}>;
14
+ slots: Readonly<ApFieldSecondSlots> & ApFieldSecondSlots;
15
+ refs: {};
16
+ rootEl: any;
17
+ };
18
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
19
+ declare const __VLS_component: DefineComponent<ApFieldSecondProps, {
20
+ focus: () => void;
21
+ blur: () => void;
22
+ }, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {
23
+ "update:value": (...args: any[]) => void;
24
+ }, string, PublicProps, Readonly<ApFieldSecondProps> & Readonly<{
25
+ "onUpdate:value"?: ((...args: any[]) => any) | undefined;
26
+ }>, {
27
+ step: ValueType;
28
+ disabled: boolean;
29
+ keyboard: boolean;
30
+ bordered: boolean;
31
+ emptyText: string;
32
+ changeOnWheel: boolean;
33
+ changeOnBlur: boolean;
34
+ min: ValueType;
35
+ max: ValueType;
36
+ controls: boolean;
37
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, any>;
38
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
39
+ export default _default;
40
+ type __VLS_WithTemplateSlots<T, S> = T & {
41
+ new (): {
42
+ $slots: S;
43
+ };
44
+ };
@@ -0,0 +1,90 @@
1
+ import { defineComponent as h, shallowRef as B, useSlots as b, createElementBlock as x, createBlock as S, openBlock as r, toDisplayString as _, unref as e, mergeProps as g, createSlots as k, renderList as C, withCtx as P, renderSlot as I, normalizeProps as U, guardReactiveProps as w } from "vue";
2
+ import "../../hooks/index.mjs";
3
+ import { formatSecond as R } from "./helper.mjs";
4
+ import { InputNumber as V } from "@aplus-frontend/antdv";
5
+ import { useDefaultPlaceholder as z } from "../hooks/use-default-placeholder.mjs";
6
+ import { omit as A } from "lodash-unified";
7
+ import { useControllableValue as D } from "../../hooks/useControllableValue.mjs";
8
+ const E = { key: 0 }, q = /* @__PURE__ */ h({
9
+ name: "ApFieldSecond",
10
+ __name: "index",
11
+ props: {
12
+ mode: {},
13
+ class: {},
14
+ style: {},
15
+ size: {},
16
+ bordered: { type: Boolean, default: !0 },
17
+ placeholder: {},
18
+ name: {},
19
+ id: {},
20
+ type: {},
21
+ addonBefore: {},
22
+ addonAfter: {},
23
+ prefix: {},
24
+ suffix: {},
25
+ "onUpdate:value": {},
26
+ valueModifiers: {},
27
+ status: {},
28
+ variant: {},
29
+ changeOnWheel: { type: Boolean, default: void 0 },
30
+ changeOnBlur: { type: Boolean, default: void 0 },
31
+ stringMode: { type: Boolean },
32
+ defaultValue: {},
33
+ value: {},
34
+ prefixCls: {},
35
+ min: { default: -1 / 0 },
36
+ max: { default: 1 / 0 },
37
+ step: { default: 1 },
38
+ tabindex: {},
39
+ controls: { type: Boolean, default: !0 },
40
+ readonly: { type: Boolean },
41
+ disabled: { type: Boolean, default: void 0 },
42
+ autofocus: { type: Boolean },
43
+ keyboard: { type: Boolean, default: !0 },
44
+ parser: {},
45
+ formatter: {},
46
+ precision: {},
47
+ decimalSeparator: {},
48
+ onInput: {},
49
+ onChange: {},
50
+ onPressEnter: {},
51
+ onStep: {},
52
+ onBlur: {},
53
+ onFocus: {},
54
+ emptyText: { default: "--" }
55
+ },
56
+ emits: ["update:value"],
57
+ setup(u, { expose: d, emit: s }) {
58
+ const o = u, p = s, t = B(), { value: a, updateValue: i } = D(
59
+ o,
60
+ p
61
+ ), f = b(), c = z("Second", o);
62
+ function m() {
63
+ t.value?.focus();
64
+ }
65
+ function y() {
66
+ t.value?.blur();
67
+ }
68
+ return d({ focus: m, blur: y }), (l, F) => l.mode === "read" ? (r(), x("span", E, _(e(R)(Number(e(a)))), 1)) : (r(), S(e(V), g(
69
+ {
70
+ key: 1,
71
+ min: 0,
72
+ style: { width: "100%" },
73
+ placeholder: e(c),
74
+ value: e(a)
75
+ },
76
+ e(A)(o, ["value", "onUpdate:value", "min", "placeholder", "mode"]),
77
+ { "onUpdate:value": e(i) }
78
+ ), k({ _: 2 }, [
79
+ C(f, (M, n) => ({
80
+ name: n,
81
+ fn: P((v) => [
82
+ I(l.$slots, n, U(w(v || {})))
83
+ ])
84
+ }))
85
+ ]), 1040, ["placeholder", "value", "onUpdate:value"]));
86
+ }
87
+ });
88
+ export {
89
+ q as default
90
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./index.vue.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,6 @@
1
+ import { ApFieldSecondProps } from '../interface';
2
+ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
3
+ declare const _default: DefineComponent<ApFieldSecondProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ApFieldSecondProps> & Readonly<{}>, {
4
+ emptyText: string;
5
+ }, {}, {}, {}, string, ComponentProvideOptions, false, {}, HTMLSpanElement>;
6
+ export default _default;
@@ -0,0 +1,4 @@
1
+ import f from "./read.vue2.mjs";
2
+ export {
3
+ f as default
4
+ };
@@ -0,0 +1,58 @@
1
+ import { defineComponent as n, createElementBlock as t, openBlock as r, toDisplayString as l, unref as p } from "vue";
2
+ import { formatSecond as s } from "./helper.mjs";
3
+ const m = /* @__PURE__ */ n({
4
+ name: "ApFieldSecond",
5
+ __name: "read",
6
+ props: {
7
+ mode: {},
8
+ class: {},
9
+ style: {},
10
+ size: {},
11
+ bordered: { type: Boolean },
12
+ placeholder: {},
13
+ name: {},
14
+ id: {},
15
+ type: {},
16
+ addonBefore: {},
17
+ addonAfter: {},
18
+ prefix: {},
19
+ suffix: {},
20
+ "onUpdate:value": {},
21
+ valueModifiers: {},
22
+ status: {},
23
+ variant: {},
24
+ changeOnWheel: { type: Boolean },
25
+ changeOnBlur: { type: Boolean },
26
+ stringMode: { type: Boolean },
27
+ defaultValue: {},
28
+ value: {},
29
+ prefixCls: {},
30
+ min: {},
31
+ max: {},
32
+ step: {},
33
+ tabindex: {},
34
+ controls: { type: Boolean },
35
+ readonly: { type: Boolean },
36
+ disabled: { type: Boolean },
37
+ autofocus: { type: Boolean },
38
+ keyboard: { type: Boolean },
39
+ parser: {},
40
+ formatter: {},
41
+ precision: {},
42
+ decimalSeparator: {},
43
+ onInput: {},
44
+ onChange: {},
45
+ onPressEnter: {},
46
+ onStep: {},
47
+ onBlur: {},
48
+ onFocus: {},
49
+ emptyText: { default: "--" }
50
+ },
51
+ setup(o) {
52
+ const a = o;
53
+ return (e, d) => (r(), t("span", null, l(e.value ? p(s)(Number(a.value)) : e.emptyText), 1));
54
+ }
55
+ });
56
+ export {
57
+ m as default
58
+ };
@@ -1,12 +1,22 @@
1
- const t = (a) => {
2
- const { componentCls: e } = a;
1
+ const a = (e) => {
2
+ const { componentCls: r } = e;
3
3
  return {
4
- [`${e}-textarea--read`]: {
4
+ [`${r}-textarea--read`]: {
5
5
  whiteSpace: "pre-wrap",
6
6
  wordWrap: "break-word",
7
7
  wordBreak: "break-all"
8
8
  },
9
- [`${e}-textarea`]: {
9
+ [`${r}-textarea--code`]: {
10
+ padding: e.spaceXL,
11
+ overflow: "auto",
12
+ fontSize: "85%",
13
+ lineHeight: 1.45,
14
+ color: e.textColor2,
15
+ backgroundColor: "rgba(150, 150, 150, 0.1)",
16
+ borderRadius: e.borderRadiusSM,
17
+ width: "min-content"
18
+ },
19
+ [`${r}-textarea`]: {
10
20
  "&.ant-input-affix-wrapper-textarea-with-clear-btn .ant-input-clear-icon": {
11
21
  insetBlockStart: "9px"
12
22
  // (28 - 10) / 2
@@ -15,5 +25,5 @@ const t = (a) => {
15
25
  };
16
26
  };
17
27
  export {
18
- t as genTextareaStyle
28
+ a as genTextareaStyle
19
29
  };
@@ -18,6 +18,9 @@ declare const _default: DefineComponent<ApFieldTextAreaProps, {
18
18
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
19
19
  }>, {
20
20
  type: "number" | "reset" | "submit" | "button" | "search" | "time" | "month" | "date" | "week" | "hidden" | "checkbox" | "radio" | "color" | "text" | "range" | "image" | "tel" | "url" | "email" | "datetime-local" | "file" | "password";
21
+ code: boolean | {
22
+ language?: "text" | "json";
23
+ };
21
24
  mode: FieldMode;
22
25
  disabled: boolean;
23
26
  bordered: boolean;
@@ -1,13 +1,14 @@
1
- import { defineComponent as B, shallowRef as b, computed as I, createElementBlock as A, createBlock as C, openBlock as s, normalizeClass as g, unref as e, toDisplayString as z, mergeProps as T } from "vue";
2
- import { isNil as w, omit as k } from "lodash-unified";
1
+ import { defineComponent as A, shallowRef as k, computed as c, createElementBlock as s, createBlock as z, openBlock as n, Fragment as T, normalizeClass as m, unref as e, toDisplayString as f, createElementVNode as w, mergeProps as R } from "vue";
2
+ import { isNil as F, omit as S } from "lodash-unified";
3
3
  import "../../hooks/index.mjs";
4
4
  import "../../config-provider/index.mjs";
5
- import { Input as R } from "@aplus-frontend/antdv";
6
- import { useDefaultPlaceholder as S } from "../hooks/use-default-placeholder.mjs";
7
- import _ from "../style/index.mjs";
8
- import { useControllableValue as U } from "../../hooks/useControllableValue.mjs";
9
- import { useNamespace as V } from "../../config-provider/hooks/use-namespace.mjs";
10
- const q = /* @__PURE__ */ B({
5
+ import { Input as V } from "@aplus-frontend/antdv";
6
+ import { useDefaultPlaceholder as E } from "../hooks/use-default-placeholder.mjs";
7
+ import U from "../style/index.mjs";
8
+ import { languageFormat as _ } from "./utils.mjs";
9
+ import { useControllableValue as j } from "../../hooks/useControllableValue.mjs";
10
+ import { useNamespace as M } from "../../config-provider/hooks/use-namespace.mjs";
11
+ const L = /* @__PURE__ */ A({
11
12
  name: "ApFieldTextArea",
12
13
  __name: "index",
13
14
  props: {
@@ -59,40 +60,55 @@ const q = /* @__PURE__ */ B({
59
60
  clearIcon: {},
60
61
  allowClear: { type: Boolean, default: !0 },
61
62
  emptyText: { default: "--" },
62
- beforeInput: {}
63
+ beforeInput: {},
64
+ code: { type: [Boolean, Object], default: !1 }
63
65
  },
64
66
  emits: ["update:value"],
65
- setup(i, { expose: d, emit: c }) {
66
- const o = b(), a = i, m = c, { value: l, updateValue: f } = U(a, m), { b: y, m: x } = V("field-textarea"), r = _("field"), v = S("TextArea", a);
67
- function h(t) {
68
- const n = t.target.value || "", u = a.beforeInput ? a.beforeInput?.(n) : n, p = o.value?.$el?.querySelector("textarea");
69
- p && (p.value = u), f(u);
67
+ setup(y, { expose: g, emit: v }) {
68
+ const a = k(), o = y, x = v, { value: l, updateValue: h } = j(o, x), { b: B, m: p } = M("field-textarea"), r = U("field"), b = E("TextArea", o), I = c(() => {
69
+ if (o.code)
70
+ return o.code === !0 ? {
71
+ language: "text"
72
+ } : {
73
+ language: o.code?.language ?? "text"
74
+ };
75
+ });
76
+ function C(t) {
77
+ const u = t.target.value || "", d = o.beforeInput ? o.beforeInput?.(u) : u, i = a.value?.$el?.querySelector("textarea");
78
+ i && (i.value = d), h(d);
70
79
  }
71
- return d({
80
+ return g({
72
81
  focus: (t) => {
73
- o.value?.focus(t);
82
+ a.value?.focus(t);
74
83
  },
75
84
  blur: () => {
76
- o.value?.blur();
85
+ a.value?.blur();
77
86
  },
78
- resizableTextArea: I(() => o.value?.resizableTextArea)
79
- }), (t, n) => t.mode === "read" ? (s(), A("span", {
80
- key: 0,
81
- class: g([e(x)("read"), e(r)])
82
- }, z(e(w)(e(l)) || e(l) === "" ? t.emptyText : e(l)), 3)) : (s(), C(e(R).TextArea, T(
87
+ resizableTextArea: c(() => a.value?.resizableTextArea)
88
+ }), (t, u) => t.mode === "read" ? (n(), s(T, { key: 0 }, [
89
+ t.code ? (n(), s("pre", {
90
+ key: 1,
91
+ class: m([e(p)("code"), e(r)])
92
+ }, [
93
+ w("code", null, f(e(_)(e(l), I.value.language)), 1)
94
+ ], 2)) : (n(), s("span", {
95
+ key: 0,
96
+ class: m([e(p)("read"), e(r)])
97
+ }, f(e(F)(e(l)) || e(l) === "" ? t.emptyText : e(l)), 3))
98
+ ], 64)) : (n(), z(e(V).TextArea, R(
83
99
  { key: 1 },
84
- e(k)(a, ["onUpdate:value", "value", "beforeInput", "emptyText"]),
100
+ e(S)(o, ["onUpdate:value", "value", "beforeInput", "emptyText"]),
85
101
  {
86
102
  ref_key: "textAreaRef",
87
- ref: o,
88
- placeholder: e(v),
103
+ ref: a,
104
+ placeholder: e(b),
89
105
  value: e(l),
90
- class: [e(y)(), e(r)],
91
- onInput: h
106
+ class: [e(B)(), e(r)],
107
+ onInput: C
92
108
  }
93
109
  ), null, 16, ["placeholder", "value", "class"]));
94
110
  }
95
111
  });
96
112
  export {
97
- q as default
113
+ L as default
98
114
  };
@@ -3,6 +3,9 @@ import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOp
3
3
  import { FieldMode } from '..';
4
4
  declare const _default: DefineComponent<ApFieldTextAreaProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ApFieldTextAreaProps> & Readonly<{}>, {
5
5
  type: "number" | "reset" | "submit" | "button" | "search" | "time" | "month" | "date" | "week" | "hidden" | "checkbox" | "radio" | "color" | "text" | "range" | "image" | "tel" | "url" | "email" | "datetime-local" | "file" | "password";
6
+ code: boolean | {
7
+ language?: "text" | "json";
8
+ };
6
9
  mode: FieldMode;
7
10
  disabled: boolean;
8
11
  bordered: boolean;
@@ -1,13 +1,17 @@
1
- import { defineComponent as o, createElementBlock as t, createCommentVNode as a, openBlock as n, toDisplayString as l, unref as r } from "vue";
2
- import { isNil as p } from "lodash-unified";
3
- const u = {
1
+ import { defineComponent as s, computed as i, createElementBlock as a, openBlock as n, toDisplayString as l, unref as o, normalizeClass as m, createElementVNode as c } from "vue";
2
+ import { isNil as f } from "lodash-unified";
3
+ import "../../config-provider/index.mjs";
4
+ import y from "../style/index.mjs";
5
+ import { languageFormat as g } from "./utils.mjs";
6
+ import { useNamespace as B } from "../../config-provider/hooks/use-namespace.mjs";
7
+ const h = {
4
8
  key: 0,
5
9
  style: {
6
10
  whiteSpace: "pre-wrap",
7
11
  wordWrap: "break-word",
8
12
  wordBreak: "break-all"
9
13
  }
10
- }, y = /* @__PURE__ */ o({
14
+ }, I = /* @__PURE__ */ s({
11
15
  name: "ApFieldTextAreaRead",
12
16
  __name: "read",
13
17
  props: {
@@ -59,12 +63,26 @@ const u = {
59
63
  clearIcon: {},
60
64
  allowClear: { type: Boolean, default: !0 },
61
65
  emptyText: { default: "--" },
62
- beforeInput: {}
66
+ beforeInput: {},
67
+ code: { type: [Boolean, Object], default: !1 }
63
68
  },
64
- setup(d) {
65
- return (e, s) => e.mode === "read" ? (n(), t("span", u, l(r(p)(e.value) || e.value === "" ? e.emptyText : e.value), 1)) : a("", !0);
69
+ setup(r) {
70
+ const { m: u } = B("field-textarea"), d = y("field"), t = r, p = i(() => {
71
+ if (t.code)
72
+ return t.code === !0 ? {
73
+ language: "text"
74
+ } : {
75
+ language: t.code?.language ?? "text"
76
+ };
77
+ });
78
+ return (e, v) => e.code ? (n(), a("pre", {
79
+ key: 1,
80
+ class: m([o(u)("code"), o(d)])
81
+ }, [
82
+ c("code", null, l(o(g)(e.value, p.value.language)), 1)
83
+ ], 2)) : (n(), a("span", h, l(o(f)(e.value) || e.value === "" ? e.emptyText : e.value), 1));
66
84
  }
67
85
  });
68
86
  export {
69
- y as default
87
+ I as default
70
88
  };
@@ -0,0 +1 @@
1
+ export declare const languageFormat: (text: string, language: string) => string;
@@ -0,0 +1,13 @@
1
+ const o = (r, n) => {
2
+ if (console.log("text", r, n), typeof r != "string")
3
+ return r;
4
+ try {
5
+ if (n === "json")
6
+ return JSON.stringify(JSON.parse(r), null, 2);
7
+ } catch {
8
+ }
9
+ return r;
10
+ };
11
+ export {
12
+ o as languageFormat
13
+ };
@@ -24,6 +24,9 @@ declare function __VLS_template(): {
24
24
  "update:value": (...args: any[]) => void;
25
25
  }, PublicProps, {
26
26
  type: "number" | "reset" | "submit" | "button" | "search" | "time" | "month" | "date" | "week" | "hidden" | "checkbox" | "radio" | "color" | "text" | "range" | "image" | "tel" | "url" | "email" | "datetime-local" | "file" | "password";
27
+ code: boolean | {
28
+ language?: "text" | "json";
29
+ };
27
30
  mode: FieldMode;
28
31
  disabled: boolean;
29
32
  bordered: boolean;
@@ -314,6 +317,9 @@ declare function __VLS_template(): {
314
317
  resizableTextArea: any;
315
318
  }, {}, {}, {}, {
316
319
  type: "number" | "reset" | "submit" | "button" | "search" | "time" | "month" | "date" | "week" | "hidden" | "checkbox" | "radio" | "color" | "text" | "range" | "image" | "tel" | "url" | "email" | "datetime-local" | "file" | "password";
320
+ code: boolean | {
321
+ language?: "text" | "json";
322
+ };
317
323
  mode: FieldMode;
318
324
  disabled: boolean;
319
325
  bordered: boolean;
@@ -348,6 +354,9 @@ declare const __VLS_component: DefineComponent<ApFormItemTextAreaProps, {
348
354
  "update:value": (...args: any[]) => void;
349
355
  }, PublicProps, {
350
356
  type: "number" | "reset" | "submit" | "button" | "search" | "time" | "month" | "date" | "week" | "hidden" | "checkbox" | "radio" | "color" | "text" | "range" | "image" | "tel" | "url" | "email" | "datetime-local" | "file" | "password";
357
+ code: boolean | {
358
+ language?: "text" | "json";
359
+ };
351
360
  mode: FieldMode;
352
361
  disabled: boolean;
353
362
  bordered: boolean;
@@ -638,6 +647,9 @@ declare const __VLS_component: DefineComponent<ApFormItemTextAreaProps, {
638
647
  resizableTextArea: any;
639
648
  }, {}, {}, {}, {
640
649
  type: "number" | "reset" | "submit" | "button" | "search" | "time" | "month" | "date" | "week" | "hidden" | "checkbox" | "radio" | "color" | "text" | "range" | "image" | "tel" | "url" | "email" | "datetime-local" | "file" | "password";
650
+ code: boolean | {
651
+ language?: "text" | "json";
652
+ };
641
653
  mode: FieldMode;
642
654
  disabled: boolean;
643
655
  bordered: boolean;