@web-utils/form-ui 1.0.0-beta56 → 1.0.0-beta58

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 (153) hide show
  1. package/chunks/-qKZw-3p2.mjs +23 -0
  2. package/chunks/{CauzhVSa2.mjs → 4-vc_q1t.mjs} +12 -12
  3. package/chunks/{Bq62m7IR2.mjs → 4C611CU2.mjs} +11 -11
  4. package/chunks/{gLPy4Sus.mjs → 8P-OAGbj.mjs} +1 -1
  5. package/chunks/B2PuSZ_F.mjs +35 -0
  6. package/chunks/B6B-rhhB.mjs +37 -0
  7. package/chunks/{C7Mak2La.mjs → BHT38Us-.mjs} +7 -6
  8. package/chunks/BWoKh6f6.mjs +66 -0
  9. package/chunks/{Dt_s96gL2.mjs → BXrA0SYn2.mjs} +2 -2
  10. package/chunks/BZ0v5mka.mjs +30 -0
  11. package/chunks/{5KomemiE2.mjs → BlmtfUfl2.mjs} +29 -29
  12. package/chunks/CE1uX9hJ.mjs +95 -0
  13. package/chunks/CGnOR2gn.mjs +59 -0
  14. package/chunks/CJ1-f8sg.mjs +30 -0
  15. package/chunks/{B3A-CnYr.mjs → CSnlDCNV.mjs} +5 -5
  16. package/chunks/CdzoVG6J.mjs +47 -0
  17. package/chunks/{BZTAuJxn2.mjs → CqoMZ9Wo2.mjs} +1 -1
  18. package/chunks/CrQmTHMA.mjs +105 -0
  19. package/chunks/Crh2RUrS.mjs +106 -0
  20. package/chunks/DBUJ7Bva.mjs +56 -0
  21. package/chunks/DB_UKPay.mjs +27 -0
  22. package/chunks/{BvKUeniN.mjs → DEC2O0q-.mjs} +46 -44
  23. package/chunks/{BoJgSMkL.mjs → DUhF8YOY.mjs} +2 -2
  24. package/chunks/{g8MIBMw92.mjs → Dqq8z1t4.mjs} +13 -13
  25. package/chunks/Du1PslcN.mjs +28 -0
  26. package/chunks/{Dluor05A.mjs → DyEYDv4B.mjs} +7 -6
  27. package/chunks/EAJCsX8W.mjs +32 -0
  28. package/chunks/ZFJ73RWd2.mjs +29 -0
  29. package/chunks/{D2B9Y3oT.mjs → fmIV_kHp.mjs} +2 -2
  30. package/chunks/h5488Kii.mjs +27 -0
  31. package/chunks/k3cC9SGC.mjs +27 -0
  32. package/chunks/{7GmKqdbC.mjs → usyXQe35.mjs} +1 -1
  33. package/chunks/{BpCiVuKL.mjs → v3wbYL_-.mjs} +7 -6
  34. package/chunks/vd9nXj8B.mjs +59 -0
  35. package/confirm-button/index.mjs +1 -1
  36. package/confirmable/index.mjs +1 -1
  37. package/editable-tree/index.mjs +591 -2
  38. package/element-dialog/index.mjs +1 -1
  39. package/element-resize-observer/index.mjs +1 -1
  40. package/form-cascader/index.mjs +1 -1
  41. package/form-checkbox/index.mjs +1 -1
  42. package/form-checkbox-group/index.mjs +1 -1
  43. package/form-date-picker/index.mjs +1 -1
  44. package/form-holder/index.mjs +1 -1
  45. package/form-image/index.mjs +1 -1
  46. package/form-input/index.mjs +1 -1
  47. package/form-input-cron-expression/index.mjs +1 -1
  48. package/form-input-email/index.mjs +1 -1
  49. package/form-input-id-card/index.mjs +1 -1
  50. package/form-input-number/index.mjs +1 -1
  51. package/form-input-phone-number/index.mjs +1 -1
  52. package/form-input-tag/index.mjs +1 -1
  53. package/form-input-time/index.mjs +1 -1
  54. package/form-item-group/index.mjs +1 -1
  55. package/form-item-x/index.mjs +1 -1
  56. package/form-radio-group/index.mjs +1 -1
  57. package/form-rate/index.mjs +1 -1
  58. package/form-row/index.mjs +1 -1
  59. package/form-select/index.mjs +1 -1
  60. package/form-slider/index.mjs +1 -1
  61. package/form-switch/index.mjs +1 -1
  62. package/form-table/index.mjs +1 -1
  63. package/form-table-plus/index.mjs +1 -1
  64. package/form-text/index.mjs +1 -1
  65. package/form-textarea/index.mjs +1 -1
  66. package/form-time-select/index.mjs +1 -1
  67. package/helper/dictionary.mjs +1 -1
  68. package/helper/form-item.d.ts +1 -1
  69. package/helper/form-item.mjs +27 -2
  70. package/helper/input.mjs +1 -1
  71. package/iframe-window/index.mjs +1 -1
  72. package/index.mjs +37 -37
  73. package/package.json +1 -1
  74. package/pageable-table/index.mjs +1 -1
  75. package/props/cascader.d.ts +326 -0
  76. package/{chunks/Czz_49pC.mjs → props/cascader.mjs} +8 -58
  77. package/props/checkbox-group.d.ts +213 -0
  78. package/props/checkbox-group.mjs +83 -0
  79. package/props/checkbox.d.ts +202 -0
  80. package/props/checkbox.mjs +71 -0
  81. package/props/col.d.ts +74 -0
  82. package/props/col.mjs +32 -0
  83. package/props/common.d.ts +114 -0
  84. package/props/common.mjs +18 -0
  85. package/props/date.d.ts +339 -0
  86. package/props/date.mjs +145 -0
  87. package/props/form-item.d.ts +144 -0
  88. package/props/form-item.mjs +73 -0
  89. package/props/form.d.ts +157 -0
  90. package/props/form.mjs +89 -0
  91. package/props/image.d.ts +102 -0
  92. package/props/image.mjs +10 -0
  93. package/props/input-cron.d.ts +102 -0
  94. package/props/input-cron.mjs +16 -0
  95. package/props/input-number.d.ts +216 -0
  96. package/props/input-number.mjs +72 -0
  97. package/props/input-tag.d.ts +123 -0
  98. package/props/input-tag.mjs +33 -0
  99. package/props/input.d.ts +299 -0
  100. package/props/input.mjs +97 -0
  101. package/props/radio-group.d.ts +205 -0
  102. package/props/radio-group.mjs +84 -0
  103. package/props/rate.d.ts +211 -0
  104. package/{chunks/D0kIhzQo.mjs → props/rate.mjs} +7 -28
  105. package/props/select.d.ts +450 -0
  106. package/props/select.mjs +218 -0
  107. package/props/slide.d.ts +235 -0
  108. package/{chunks/DZrQmH9Y.mjs → props/slide.mjs} +7 -28
  109. package/props/switch.d.ts +229 -0
  110. package/{chunks/ecpQ-ODX.mjs → props/switch.mjs} +7 -33
  111. package/props/text.d.ts +127 -0
  112. package/props/text.mjs +22 -0
  113. package/props/textarea.d.ts +266 -0
  114. package/{chunks/CNK4mfga.mjs → props/textarea.mjs} +19 -31
  115. package/props/time-select.d.ts +216 -0
  116. package/props/time-select.mjs +67 -0
  117. package/props/time.d.ts +304 -0
  118. package/{chunks/C3MF_-bN.mjs → props/time.mjs} +8 -39
  119. package/props/tree.d.ts +76 -0
  120. package/props/tree.mjs +75 -0
  121. package/sub-table/index.mjs +1 -1
  122. package/sub-table-plus/index.mjs +1 -1
  123. package/table-column/index.mjs +1 -1
  124. package/table-column-def/index.mjs +1 -1
  125. package/table-view/index.mjs +13 -13
  126. package/toolbar/index.mjs +1 -1
  127. package/toolbar-button/index.mjs +1 -1
  128. package/vue-cron/index.mjs +1 -1
  129. package/web-types.json +1 -1
  130. package/x-input-tag/index.mjs +2 -2
  131. package/year-calendar/index.mjs +1 -1
  132. package/chunks/6GcIyEQV.mjs +0 -95
  133. package/chunks/8c9TEVNY.mjs +0 -36
  134. package/chunks/AAZfNtly.mjs +0 -119
  135. package/chunks/BKlMENhV.mjs +0 -57
  136. package/chunks/BNVYEWWW.mjs +0 -57
  137. package/chunks/BTuzBfTA.mjs +0 -141
  138. package/chunks/C6Dq9Dgb.mjs +0 -17
  139. package/chunks/C6u76g6o.mjs +0 -158
  140. package/chunks/CLO5X9Lb.mjs +0 -176
  141. package/chunks/CdoiMj7L2.mjs +0 -39
  142. package/chunks/DTVTvvq-.mjs +0 -189
  143. package/chunks/DWE67l1f.mjs +0 -317
  144. package/chunks/DWMePN6q.mjs +0 -660
  145. package/chunks/D_L1p3vm2.mjs +0 -90
  146. package/chunks/Dy_5vPdP.mjs +0 -101
  147. package/chunks/Goee5Y-H.mjs +0 -198
  148. /package/chunks/{BlxLaWcU.mjs → 6av50rJm.mjs} +0 -0
  149. /package/chunks/{CkOD-_VV.mjs → B1MSrc6f.mjs} +0 -0
  150. /package/chunks/{BNqVEHk_.mjs → C-0zqLII.mjs} +0 -0
  151. /package/chunks/{xq_LR6R2.mjs → CI1ehQi5.mjs} +0 -0
  152. /package/chunks/{DcTVYqeJ.mjs → DuOxL6xh.mjs} +0 -0
  153. /package/chunks/{CXsoKP22.mjs → mekxD3ef.mjs} +0 -0
@@ -1,176 +0,0 @@
1
- import { n as e, o as t } from "./BvKUeniN.mjs";
2
- import { n } from "./C6Dq9Dgb.mjs";
3
- import { useDictionary as r } from "../hook/useDictionary.mjs";
4
- import { t as i } from "./C6u76g6o.mjs";
5
- import { computed as a, createVNode as o, defineComponent as s, isVNode as c, mergeProps as l, useModel as u } from "vue";
6
- import { ElCheckbox as d, ElCheckboxButton as f, ElCheckboxGroup as p } from "element-plus/es";
7
- //#region src/components/form/props/checkbox-group.ts
8
- var m = {
9
- ...n,
10
- modelValue: {
11
- type: [Array, String],
12
- default: () => []
13
- },
14
- size: String,
15
- min: Number,
16
- max: Number,
17
- ariaLabel: String,
18
- textColor: {
19
- type: String,
20
- default: "#ffffff"
21
- },
22
- fill: {
23
- type: String,
24
- default: "#409eff"
25
- },
26
- tag: {
27
- type: String,
28
- default: "div"
29
- },
30
- validateEvent: {
31
- type: Boolean,
32
- default: !0
33
- },
34
- options: {
35
- type: Array,
36
- default: () => []
37
- },
38
- props: {
39
- type: Object,
40
- default: () => ({
41
- value: "value",
42
- label: "label",
43
- disabled: "disabled"
44
- })
45
- },
46
- type: {
47
- type: String,
48
- default: "checkbox"
49
- },
50
- stringMode: Boolean,
51
- delimiter: {
52
- type: String,
53
- default: ","
54
- },
55
- other: [String],
56
- otherVal: [String],
57
- otherProp: String,
58
- otherPlaceholder: String,
59
- otherLabel: String,
60
- otherWidth: {
61
- type: String,
62
- default: "200px"
63
- },
64
- otherMaxLength: String,
65
- gender: Boolean,
66
- confirm: Boolean,
67
- labelProp: {
68
- type: String,
69
- default: "name"
70
- },
71
- valueProp: {
72
- type: String,
73
- default: "code"
74
- },
75
- split: Boolean,
76
- sort: Boolean,
77
- classic: Boolean,
78
- fillRow: Boolean,
79
- ellipsis: Boolean,
80
- dictType: String
81
- }, h = {
82
- modelValue: !0,
83
- type: !0,
84
- disabled: !0,
85
- options: !0
86
- }, g = (e) => n[e] === void 0 && h[e] !== !0;
87
- //#endregion
88
- //#region src/components/form/FormCheckboxGroup.vue?vue&type=script&lang.jsx
89
- function _(e) {
90
- return typeof e == "function" || Object.prototype.toString.call(e) === "[object Object]" && !c(e);
91
- }
92
- //#endregion
93
- //#region src/components/form/FormCheckboxGroup.vue
94
- var v = /* @__PURE__ */ s({
95
- name: "FormCheckboxGroup",
96
- inheritAttrs: !1,
97
- props: { ...m },
98
- emits: {
99
- ...e,
100
- "update:other": null
101
- },
102
- setup(e, { emit: n, slots: s, attrs: c }) {
103
- let m = u(e, "other"), { emitInput: h, render: v, disabled: y, listeners: b, inputProps: x } = t(e, {
104
- emit: n,
105
- slots: s,
106
- attrs: c,
107
- predicate: g,
108
- messagePrefix: "请选择",
109
- class: a(() => ["form-checkbox-group", {
110
- "form-checkbox-group-row": e.fillRow,
111
- "form-checkbox-group-row-break-word": e.fillRow,
112
- "form-checkbox-group-row-ellipsis": e.ellipsis
113
- }])
114
- }), S = (t) => {
115
- let n = t;
116
- e.sort && (n = t.sort()), e.stringMode || e.split ? h(n.join(",")) : h(n);
117
- }, C = a(() => {
118
- if (e.stringMode || e.split) {
119
- var t;
120
- return Array.isArray(e.modelValue) ? e.modelValue.filter((e) => e) : ((t = e.modelValue) == null ? void 0 : t.split(e.delimiter).filter((e) => e)) ?? [];
121
- }
122
- return e.modelValue || [];
123
- }), w = a(() => e.classic ? "label" : e.labelProp), T = a(() => e.classic ? "value" : e.valueProp), { dictItems: E } = r(e), D = a(() => e.dictType ? E.value : e.gender ? [{
124
- [w.value]: "男",
125
- [T.value]: "男"
126
- }, {
127
- [w.value]: "女",
128
- [T.value]: "女"
129
- }] : e.confirm ? [{
130
- [w.value]: "是",
131
- [T.value]: "是"
132
- }, {
133
- [w.value]: "否",
134
- [T.value]: "否"
135
- }] : e.options);
136
- return () => v({ vNodes: [o(p, l(b.value, x.value, {
137
- modelValue: C.value,
138
- disabled: y.value,
139
- "onUpdate:modelValue": S
140
- }), {
141
- ...s,
142
- default: s.default || (() => {
143
- var t;
144
- return (t = D.value) == null ? void 0 : t.map(({ value: t, label: n, disabled: r }) => e.type === "button" ? o(f, {
145
- key: t,
146
- value: t,
147
- disabled: r
148
- }, _(n) ? n : { default: () => [n] }) : o(d, {
149
- key: t,
150
- value: t,
151
- disabled: r
152
- }, _(n) ? n : { default: () => [n] }));
153
- })
154
- }), C.value.includes(e.otherVal) ? o(i, {
155
- "wrap-col": !1,
156
- class: "form-checkbox-group-other",
157
- "hide-label": !0,
158
- "label-width": "0",
159
- prop: e.otherProp,
160
- disabled: y.value,
161
- required: !!e.otherProp,
162
- placeholder: e.otherPlaceholder,
163
- label: e.otherLabel,
164
- "show-message": !!e.otherLabel,
165
- style: e.otherLabel ? { width: e.otherWidth } : {
166
- marginBottom: 0,
167
- width: e.otherWidth
168
- },
169
- modelValue: m.value,
170
- "onUpdate:modelValue": (e) => m.value = e,
171
- "max-length": e.otherMaxLength
172
- }, null) : null] });
173
- }
174
- });
175
- //#endregion
176
- export { v as t };
@@ -1,39 +0,0 @@
1
- import { f as e } from "./DcTVYqeJ.mjs";
2
- import { t } from "./AAZfNtly.mjs";
3
- import { r as n } from "./BvKUeniN.mjs";
4
- import { n as r } from "./C6Dq9Dgb.mjs";
5
- import { createVNode as i, mergeProps as a } from "vue";
6
- import { ElText as o } from "element-plus/es";
7
- //#region src/components/form/props/text.ts
8
- var s = {
9
- ...r,
10
- type: String,
11
- size: {
12
- type: String,
13
- default: "default"
14
- },
15
- truncated: {
16
- type: Boolean,
17
- default: !1
18
- },
19
- lineClamp: [String, Number],
20
- tag: {
21
- type: String,
22
- default: "span"
23
- },
24
- text: String
25
- }, c = { modelValue: !0 }, l = (e) => r[e] === void 0 && c[e] !== !0, u = {
26
- name: "FormText",
27
- inheritAttrs: !1,
28
- props: { ...s },
29
- setup(r, { slots: s, attrs: c }) {
30
- let u = t(r, { attrs: c }), d = e(r, l);
31
- return () => n(r, {
32
- vNodes: i(o, a(d.value, c), { default: s.default || (() => r.text) }),
33
- formItemProps: u,
34
- slots: s
35
- });
36
- }
37
- };
38
- //#endregion
39
- export { u as t };
@@ -1,189 +0,0 @@
1
- import { d as e } from "./DcTVYqeJ.mjs";
2
- import { formHolderContextKey as t, formViewContextKey as n } from "../constants/index.mjs";
3
- import r from "../form-advice/index.mjs";
4
- import i from "../form-red-table/index.mjs";
5
- import { animate as a } from "@web-utils/core";
6
- import { computed as o, createVNode as s, inject as c, mergeProps as l, nextTick as u, provide as d, reactive as f, toRef as p, useTemplateRef as m } from "vue";
7
- import { ElForm as h, ElRow as g } from "element-plus/es";
8
- //#region src/components/form/props/form.ts
9
- var _ = {
10
- model: Object,
11
- rules: Object,
12
- inline: {
13
- type: Boolean,
14
- default: !1
15
- },
16
- labelPosition: {
17
- type: String,
18
- default: "right"
19
- },
20
- labelWidth: {
21
- type: [String, Number],
22
- default: "auto"
23
- },
24
- labelSuffix: {
25
- type: String,
26
- default: ""
27
- },
28
- hideRequiredAsterisk: {
29
- type: Boolean,
30
- default: !1
31
- },
32
- requireAsteriskPosition: {
33
- type: String,
34
- default: "left"
35
- },
36
- showMessage: {
37
- type: Boolean,
38
- default: !0
39
- },
40
- inlineMessage: {
41
- type: Boolean,
42
- default: !1
43
- },
44
- statusIcon: {
45
- type: Boolean,
46
- default: !1
47
- },
48
- validateOnRuleChange: {
49
- type: Boolean,
50
- default: !0
51
- },
52
- size: String,
53
- disabled: {
54
- type: Boolean,
55
- default: void 0
56
- },
57
- scrollToError: {
58
- type: Boolean,
59
- default: !1
60
- },
61
- scrollIntoViewOptions: [Object, Boolean],
62
- requiredFields: Array,
63
- disabledFields: Array,
64
- enabledFields: Array,
65
- showAdvice: {
66
- type: Boolean,
67
- default: !0
68
- },
69
- columns: [Array, Object],
70
- colCount: Number,
71
- notTableForm: {
72
- type: Boolean,
73
- default: void 0
74
- },
75
- commentValueColspan: Number,
76
- commentLabelColspan: Number,
77
- wrapRow: {
78
- type: Boolean,
79
- default: !0
80
- }
81
- }, v = {
82
- showMessage: !0,
83
- required: !0,
84
- requiredFields: !0,
85
- disabledFields: !0,
86
- enabledFields: !0,
87
- showAdvice: !0,
88
- columns: !0,
89
- colCount: !0,
90
- notTableForm: !0,
91
- commentValueColspan: !0,
92
- commentLabelColspan: !0,
93
- wrapRow: !0
94
- }, y = (e) => v[e] !== !0, b = {
95
- name: "FormHolder",
96
- inheritAttrs: !1,
97
- props: { ..._ },
98
- emits: {},
99
- setup(_, { slots: v, expose: b, attrs: x }) {
100
- let { autoBindProps: S, listeners: C } = e(_, { predicate: y }), w = c(n, null), T = m("form"), E = o(() => _.notTableForm === void 0 ? (w == null ? void 0 : w.tableForm) === void 0 ? !1 : w == null ? void 0 : w.tableForm : !_.notTableForm), D = o(() => E.value ? !1 : _.showMessage), O = o(() => {
101
- let e = {};
102
- return _.disabledFields && _.disabledFields.forEach((t) => {
103
- e[t] = !0;
104
- }), e;
105
- }), k = o(() => {
106
- let e = {};
107
- return _.enabledFields && _.enabledFields.length && _.enabledFields.forEach((t) => {
108
- e[t] = !0;
109
- }), e;
110
- }), A = o(() => {
111
- let e = {};
112
- return _.requiredFields && _.requiredFields.length && _.requiredFields.forEach((t) => {
113
- e[t] = !0;
114
- }), e;
115
- }), j = o(() => _.disabled === !0 ? !0 : _.disabled), M = p(() => _.enabledFields), N = p(() => _.requiredFields), P = p(() => _.disabledFields), F = async () => {
116
- await u();
117
- let e = T.value.$el.querySelector(".el-form-item.is-error");
118
- e && e.scrollIntoView({
119
- block: "center",
120
- inline: "center",
121
- behavior: "smooth"
122
- });
123
- }, I = f({
124
- tableForm: E,
125
- disabled: j,
126
- enabledFields: M,
127
- requiredFields: N,
128
- enabledFieldsMap: k,
129
- disabledFieldsMap: O,
130
- requiredFieldsMap: A,
131
- disabledFields: P,
132
- scrollIntoRequiredField: F,
133
- formRef: T,
134
- validate: async () => {
135
- try {
136
- return await T.value.validate();
137
- } catch {
138
- throw await F(), T.value.$el.querySelectorAll(".el-form-item.is-error .el-form-item__content > :first-child").forEach((e) => {
139
- a(e, "breathe-animation");
140
- }), Error("表单验证不通过!");
141
- }
142
- },
143
- validateField: (e) => T.value.validateField(e),
144
- resetFields: (e) => T.value.resetFields(e),
145
- scrollToField: (e) => T.value.scrollToField(e),
146
- clearValidate: (e) => T.value.clearValidate(e),
147
- getField: () => T.value.getField(),
148
- setInitialValues: (e) => T.value.setInitialValues(e),
149
- getFields: () => T.value.fields
150
- });
151
- return d(t, I), b(I), () => s(h, l(C.value, S.value, x, {
152
- ref: "form",
153
- class: [
154
- "form-holder",
155
- "clear-fix",
156
- { "red-form": E }
157
- ],
158
- "show-message": D.value
159
- }), { default: () => {
160
- if (E.value) {
161
- var e, t, n;
162
- return [
163
- (e = v.top) == null ? void 0 : e.call(v),
164
- s(i, {
165
- class: { "hide-error-message": E.value },
166
- columns: _.columns,
167
- "col-count": _.colCount
168
- }, { default: () => {
169
- var e;
170
- return [(e = v.default) == null ? void 0 : e.call(v), _.showAdvice ? s(r, {
171
- "label-colspan": _.commentLabelColspan,
172
- "value-colspan": _.commentValueColspan
173
- }, null) : null];
174
- } }),
175
- (t = v.bottom) == null ? void 0 : t.call(v),
176
- s("div", { class: "red-form-footer" }, [(n = v.footer) == null ? void 0 : n.call(v)])
177
- ];
178
- } else {
179
- var a;
180
- return _.wrapRow ? s(g, null, { default: () => {
181
- var e;
182
- return [(e = v.default) == null ? void 0 : e.call(v)];
183
- } }) : (a = v.default) == null ? void 0 : a.call(v);
184
- }
185
- } });
186
- }
187
- };
188
- //#endregion
189
- export { b as t };
@@ -1,317 +0,0 @@
1
- import { n as e, o as t } from "./BvKUeniN.mjs";
2
- import { n } from "./C6Dq9Dgb.mjs";
3
- import { useDictionary as r } from "../hook/useDictionary.mjs";
4
- import { isNumber as i, isPlainObject as a, isString as o } from "@web-utils/core";
5
- import { computed as s, createVNode as c, mergeProps as l, ref as u, watchEffect as d } from "vue";
6
- import { ElOption as f, ElSelect as p } from "element-plus/es";
7
- //#region src/components/form/props/select.ts
8
- var m = {
9
- ...n,
10
- modelValue: [
11
- String,
12
- Number,
13
- Boolean,
14
- Object,
15
- Array
16
- ],
17
- multiple: {
18
- type: Boolean,
19
- default: !1
20
- },
21
- options: {
22
- type: Array,
23
- default: () => []
24
- },
25
- props: {
26
- type: Object,
27
- default: () => ({
28
- label: "label",
29
- value: "value"
30
- })
31
- },
32
- valueKey: {
33
- type: String,
34
- default: "value"
35
- },
36
- size: String,
37
- clearable: {
38
- type: Boolean,
39
- default: !0
40
- },
41
- collapseTags: {
42
- type: Boolean,
43
- default: !1
44
- },
45
- collapseTagsTooltip: {
46
- type: Boolean,
47
- default: !1
48
- },
49
- tagTooltip: {
50
- type: Object,
51
- default: () => ({})
52
- },
53
- multipleLimit: {
54
- type: Number,
55
- default: 0
56
- },
57
- id: String,
58
- name: String,
59
- effect: {
60
- type: String,
61
- default: "light"
62
- },
63
- autocomplete: {
64
- type: String,
65
- default: "off"
66
- },
67
- placeholder: String,
68
- filterable: {
69
- type: Boolean,
70
- default: !1
71
- },
72
- allowCreate: {
73
- type: Boolean,
74
- default: !1
75
- },
76
- filterMethod: Function,
77
- remote: {
78
- type: Boolean,
79
- default: !1
80
- },
81
- debounce: {
82
- type: Number,
83
- default: 300
84
- },
85
- remoteMethod: Function,
86
- remoteShowSuffix: {
87
- type: Boolean,
88
- default: !1
89
- },
90
- loading: {
91
- type: Boolean,
92
- default: !1
93
- },
94
- loadingText: String,
95
- noMatchText: String,
96
- noDataText: String,
97
- popperClass: {
98
- type: String,
99
- default: ""
100
- },
101
- popperStyle: [String, Object],
102
- reserveKeyword: {
103
- type: Boolean,
104
- default: !0
105
- },
106
- defaultFirstOption: {
107
- type: Boolean,
108
- default: !1
109
- },
110
- teleported: {
111
- type: Boolean,
112
- default: !0
113
- },
114
- appendTo: [String, Object],
115
- persistent: {
116
- type: Boolean,
117
- default: !0
118
- },
119
- automaticDropdown: {
120
- type: Boolean,
121
- default: !1
122
- },
123
- clearIcon: [String, Object],
124
- fitInputWidth: {
125
- type: Boolean,
126
- default: !1
127
- },
128
- suffixIcon: [String, Object],
129
- tagType: {
130
- type: String,
131
- default: "info"
132
- },
133
- tagEffect: {
134
- type: String,
135
- default: "light"
136
- },
137
- validateEvent: {
138
- type: Boolean,
139
- default: !0
140
- },
141
- dropDownOffset: {
142
- type: Number,
143
- default: 12
144
- },
145
- showArrow: {
146
- type: Boolean,
147
- default: !0
148
- },
149
- placement: {
150
- type: String,
151
- default: "bottom-start"
152
- },
153
- fallbackPlacements: {
154
- type: Array,
155
- default: () => [
156
- "bottom-start",
157
- "top-start",
158
- "right",
159
- "left"
160
- ]
161
- },
162
- maxCollapseTags: {
163
- type: Number,
164
- default: 1
165
- },
166
- popperOptions: {
167
- type: Object,
168
- default: () => ({})
169
- },
170
- ariaLabel: String,
171
- emptyValues: Array,
172
- valueOnClear: [
173
- String,
174
- Number,
175
- Boolean,
176
- Function
177
- ],
178
- suffixTransition: {
179
- type: Boolean,
180
- default: !0
181
- },
182
- tabindex: [String, Number],
183
- dictType: String,
184
- gender: Boolean,
185
- year: [Boolean, Number],
186
- all: Boolean,
187
- confirm: Boolean,
188
- start: Number,
189
- end: Number,
190
- optionLabel: [String, Number],
191
- emitLabel: Boolean,
192
- english: Boolean,
193
- chinese: Boolean,
194
- typing: Boolean,
195
- multipleStringMode: Boolean,
196
- multipleStringSeparator: {
197
- type: String,
198
- default: ","
199
- }
200
- }, h = {
201
- modelValue: !0,
202
- emptyValues: !0,
203
- disabled: !0,
204
- dropDownOffset: !0,
205
- valueOnClear: !0,
206
- options: !0,
207
- dictType: !0,
208
- gender: !0,
209
- year: !0,
210
- all: !0,
211
- confirm: !0,
212
- start: !0,
213
- end: !0,
214
- optionLabel: !0,
215
- emitLabel: !0,
216
- english: !0,
217
- chinese: !0,
218
- typing: !0,
219
- multipleStringMode: !0,
220
- multipleStringSeparator: !0
221
- }, g = (e) => n[e] === void 0 && h[e] !== !0, _ = {
222
- name: "FormSelect",
223
- inheritAttrs: !1,
224
- props: { ...m },
225
- emits: { ...e },
226
- setup(e, { emit: n, slots: m, attrs: h }) {
227
- let { emitInput: _, render: v, placeholder: y, disabled: b, listeners: x, inputProps: S } = t(e, {
228
- emit: n,
229
- slots: m,
230
- attrs: h,
231
- predicate: g,
232
- messagePrefix: "请选择"
233
- }), C = u(null), w = u(!1);
234
- d(() => {
235
- if (e.multiple && e.multipleStringMode) {
236
- var t;
237
- C.value = (t = e.modelValue) == null ? void 0 : t.split(",").filter((e) => e);
238
- } else C.value = e.modelValue;
239
- });
240
- let T = (t) => {
241
- if (e.multiple && e.multipleStringMode ? _(t.join(e.multipleStringSeparator)) : _(t), e.emitLabel) {
242
- let r = O.value.find((n) => n[e.props.value] === t), i = r == null ? void 0 : r[e.props.label];
243
- i !== e.optionLabel && n("update:optionLabel", i);
244
- }
245
- }, { dictItems: E } = r(e), D = u([]), O = s(() => {
246
- if (e.dictType) return E.value;
247
- if (e.remote) return D.value;
248
- if (e.gender) return [{
249
- [e.props.label]: "男",
250
- [e.props.value]: e.chinese ? "男" : e.typing ? 1 : "1"
251
- }, {
252
- [e.props.label]: "女",
253
- [e.props.value]: e.chinese ? "女" : e.typing ? 2 : "2"
254
- }];
255
- if (e.confirm) return [{
256
- [e.props.label]: "是",
257
- [e.props.value]: e.chinese ? "是" : e.english ? "Y" : e.typing ? 1 : "1"
258
- }, {
259
- [e.props.label]: "否",
260
- [e.props.value]: e.chinese ? "否" : e.english ? "N" : e.typing ? 0 : "0"
261
- }];
262
- if (e.all) return [{
263
- [e.props.value]: "",
264
- [e.props.label]: "全部"
265
- }, ...e.options];
266
- if (e.start && e.end) return Array(e.end - e.start + 1).fill(1).map((t, n) => ({
267
- [e.props.label]: e.start + n,
268
- [e.props.value]: e.start + n
269
- }));
270
- if (e.year) {
271
- let t = (/* @__PURE__ */ new Date()).getFullYear(), n = [], r = 10;
272
- i(e.year) && (r = e.year);
273
- for (let i = -r; i <= r; i++) {
274
- let r = t + i;
275
- n.push({
276
- [e.props.label]: r,
277
- [e.props.value]: r
278
- });
279
- }
280
- return n;
281
- }
282
- return e.options ? e.options.map((t) => (t[e.props.value] = t[e.props.value] ?? t[e.props.label], t)) : [];
283
- }), k = async (t) => {
284
- try {
285
- var n;
286
- w.value = !0;
287
- let r = await e.remoteMethod(t, e.prop);
288
- ((n = r.data.data) == null ? void 0 : n.length) >= 0 ? o(r.data.data[0]) ? D.value = r.data.data.map((t) => ({
289
- [e.props.value]: t,
290
- [e.props.label]: t
291
- })) : a(r.data.data[0]) && (D.value = r.data.data) : D.value = [];
292
- } catch {}
293
- w.value = !1;
294
- };
295
- return d(() => {
296
- e.remote && k();
297
- }), () => v({ vNodes: c(p, l(x.value, S.value, {
298
- offset: e.dropDownOffset,
299
- "model-value": C.value,
300
- "onUpdate:modelValue": T,
301
- disabled: b.value,
302
- placeholder: y.value
303
- }), {
304
- ...m,
305
- default: m.default || (() => {
306
- var e;
307
- return (e = O.value) == null ? void 0 : e.map(({ value: e, label: t }) => c(f, {
308
- key: e,
309
- label: t,
310
- value: e
311
- }, null));
312
- })
313
- }) });
314
- }
315
- };
316
- //#endregion
317
- export { _ as t };