@bytenew/bn-bus-ui 1.1.399

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 (46) hide show
  1. package/README.md +637 -0
  2. package/common.scss +715 -0
  3. package/dist/assocTableSearch-C9KUFIpd.js +349 -0
  4. package/dist/assocTableSearch.css +1 -0
  5. package/dist/bn-bus-ui.es.js +58 -0
  6. package/dist/bn-bus-ui.umd.js +42 -0
  7. package/dist/chooseIPaasData-Bfm58C-0.js +391 -0
  8. package/dist/chooseIPaasData.css +1 -0
  9. package/dist/defaultSet-BA11k622.js +322 -0
  10. package/dist/defaultSet.css +1 -0
  11. package/dist/fileFormData-D_Q1vylE.js +53 -0
  12. package/dist/formItemFooter-B3nlSwnS.js +108 -0
  13. package/dist/formItemFooter.css +1 -0
  14. package/dist/funcExprDialog-DeHPFa-L.js +139 -0
  15. package/dist/funcExprDialog.css +1 -0
  16. package/dist/index-B8KbssVN.js +45 -0
  17. package/dist/index-CTZ-0Tyh.js +45 -0
  18. package/dist/index-CZOFm8wK.js +135 -0
  19. package/dist/index-C_ix9-hS.js +44 -0
  20. package/dist/index-Cov88CtD.js +221 -0
  21. package/dist/index-DAtLc2a1.js +89 -0
  22. package/dist/index-DCbIfKgk.js +66 -0
  23. package/dist/index-DDy1d3BS.js +178 -0
  24. package/dist/index-DJ15iYPg.js +89 -0
  25. package/dist/index-DNHXG3dr.js +62 -0
  26. package/dist/index-Dg5V1uNO.js +740 -0
  27. package/dist/index-Dme97Hra.js +118 -0
  28. package/dist/index-DnzoAsk8.js +109 -0
  29. package/dist/index-DrngruPb.js +64 -0
  30. package/dist/index-Q08paoUN.js +51 -0
  31. package/dist/index-VbL1cqCu.js +58 -0
  32. package/dist/index-aooX1QXm.js +183 -0
  33. package/dist/index.css +1 -0
  34. package/dist/index2.css +1 -0
  35. package/dist/index3.css +1 -0
  36. package/dist/index4.css +1 -0
  37. package/dist/index5.css +1 -0
  38. package/dist/index6.css +1 -0
  39. package/dist/index7.css +1 -0
  40. package/dist/install-DSQCBsd_.js +19155 -0
  41. package/dist/install.css +1 -0
  42. package/dist/setOption-BOD7nAuG.js +329 -0
  43. package/dist/setOption.css +1 -0
  44. package/dist/setRelationOption-D7FqiLWj.js +5217 -0
  45. package/dist/setRelationOption.css +1 -0
  46. package/package.json +57 -0
@@ -0,0 +1,329 @@
1
+ import { cloneDeep as _ } from "lodash";
2
+ import { resolveComponent as p, openBlock as u, createElementBlock as c, createElementVNode as s, toDisplayString as V, createVNode as d, withCtx as r, createTextVNode as h, createCommentVNode as w, withKeys as k, normalizeClass as g } from "vue";
3
+ import { _ as I } from "./install-DSQCBsd_.js";
4
+ const F = {
5
+ name: "setOption",
6
+ props: {
7
+ columnData: {
8
+ type: Object,
9
+ default: () => ({})
10
+ },
11
+ openDataField: Boolean,
12
+ // 是否支持数据字典配置
13
+ postFunc: Function,
14
+ // API请求函数
15
+ extendPost: Object
16
+ // 额外的请求参数
17
+ },
18
+ data() {
19
+ return {
20
+ addOptionText: "",
21
+ // 批量添加输入框内容
22
+ showBatchAdd: !1,
23
+ // 是否显示批量添加区域
24
+ newOptions: [],
25
+ // 新增选项名称数组(用于橘黄色高亮)
26
+ oldTitle: "",
27
+ // 记录修改前的标题(用于更新newOptions)
28
+ componentWidth: 0,
29
+ // 组件宽度
30
+ filedType: ""
31
+ //是否选择数据字典 option选项 DataFields数据字典
32
+ };
33
+ },
34
+ mounted() {
35
+ var e;
36
+ this.filedType = ((e = this.columnData.insideDataSourceInfo) == null ? void 0 : e.type) || "", this.calculateWidth();
37
+ },
38
+ methods: {
39
+ /**
40
+ * 计算组件宽度
41
+ */
42
+ calculateWidth() {
43
+ this.$nextTick(() => {
44
+ const e = this.$el;
45
+ e && (this.componentWidth = e.offsetWidth);
46
+ });
47
+ },
48
+ /**
49
+ * 切换字典还是选项
50
+ */
51
+ changeFiledType() {
52
+ this.columnData.moduleDefinition = [], this.columnData.defaultInfo = {}, this.columnData.insideDataSourceInfo = {}, this.filedType == "DataFields" && (this.columnData.insideDataSourceInfo = { type: "DataFields", table: "", field: "" });
53
+ },
54
+ /**
55
+ * 判断是否为新增选项(用于橘黄色高亮)
56
+ */
57
+ isNewOption(e) {
58
+ return this.newOptions.includes(e);
59
+ },
60
+ /**
61
+ * 更新选项标题
62
+ * 当用户修改输入框内容时,同步更新newOptions数组
63
+ */
64
+ updateOptionTitle(e) {
65
+ if (this.oldTitle === e) return;
66
+ const t = this.newOptions.indexOf(this.oldTitle);
67
+ t > -1 && this.newOptions.splice(t, 1, e), this.oldTitle = "";
68
+ },
69
+ /**
70
+ * 解析批量输入文本
71
+ * 支持换行、中英文逗号、空格分隔,自动去重,最多100个
72
+ */
73
+ parseBatchText(e) {
74
+ return e.split(/[\n,,\s]+/).map((t) => t.trim()).filter(Boolean).slice(0, 100);
75
+ },
76
+ /**
77
+ * 过滤已存在的选项
78
+ * 返回需要真正新增的选项列表
79
+ */
80
+ filterExistingOptions(e) {
81
+ const t = this.columnData.moduleDefinition.map((i) => i.title);
82
+ return e.filter((i) => !t.includes(i));
83
+ },
84
+ /**
85
+ * 构造选项对象
86
+ */
87
+ buildOptions(e, t) {
88
+ const i = this.columnData.moduleDefinition.length + 1;
89
+ return e.map((f, n) => ({
90
+ sequence: i + n,
91
+ code: t[n],
92
+ columnStatus: 1,
93
+ id: t[n],
94
+ title: f
95
+ }));
96
+ },
97
+ /**
98
+ * 滚动到列表底部
99
+ */
100
+ scrollToBottom() {
101
+ this.$nextTick(() => {
102
+ const e = this.$refs.optionList;
103
+ if (e && e.$el) {
104
+ const t = e.$el.querySelector(".el-scrollbar__wrap");
105
+ t && (t.scrollTop = t.scrollHeight);
106
+ }
107
+ });
108
+ },
109
+ /**
110
+ * 添加选项
111
+ * @param {String} type - 操作类型:'add'追加、'cover'覆盖、undefined单个添加
112
+ */
113
+ async addOption(e) {
114
+ var n;
115
+ let t = [];
116
+ if (e) {
117
+ if (t = [...new Set(this.parseBatchText(this.addOptionText))], this.newOptions.push(...t), t = this.filterExistingOptions(t), t.length === 0) return;
118
+ } else {
119
+ const a = `选项${this.newOptions.length + 1}`;
120
+ t = [a], this.newOptions.push(a);
121
+ }
122
+ const i = ((n = this.extendPost) == null ? void 0 : n.appId) || "noApp", f = await this.postFunc(
123
+ `/v2/projects/customId/${t.length}/${i}`,
124
+ null,
125
+ "get"
126
+ );
127
+ if (!f.code) {
128
+ const l = this.buildOptions(t, f.data);
129
+ this.columnData.moduleDefinition = e === "cover" ? _(l) : [...this.columnData.moduleDefinition, ...l], this.scrollToBottom();
130
+ }
131
+ },
132
+ /**
133
+ * 删除选项
134
+ */
135
+ deleteOption(e, t) {
136
+ this.columnData.moduleDefinition.splice(e, 1);
137
+ const i = this.newOptions.indexOf(t);
138
+ i > -1 && this.newOptions.splice(i, 1);
139
+ }
140
+ }
141
+ }, B = { class: "setOpt" }, U = { class: "setOpt-top w-flex-center w-flex-between" }, S = { class: "w-flex-center" }, C = { class: "w-color-orange" }, A = {
142
+ key: 0,
143
+ class: "w-margin-left8"
144
+ }, N = {
145
+ key: 0,
146
+ class: "w-flex-center"
147
+ }, W = { class: "setOpt-filedType" }, E = {
148
+ key: 0,
149
+ class: "setOpt-batch"
150
+ }, j = { class: "w-flex-right w-margin-top8" }, q = { key: 1 }, z = ["onClick"], L = {
151
+ key: 0,
152
+ class: "w-empty"
153
+ }, K = {
154
+ key: 2,
155
+ class: "w-margin-top8"
156
+ };
157
+ function P(e, t, i, f, n, l) {
158
+ const a = p("el-button"), D = p("el-segmented"), O = p("el-input"), v = p("el-switch"), y = p("draggable"), T = p("el-scrollbar"), b = p("BnSelect");
159
+ return u(), c("div", B, [
160
+ s("div", U, [
161
+ s("div", S, [
162
+ t[12] || (t[12] = s("div", { class: "setOpt-top-title" }, "选项配置", -1)),
163
+ s("div", C, " (共" + V(i.columnData.moduleDefinition.length) + "个选项) ", 1),
164
+ n.filedType != "DataFields" ? (u(), c("div", A, [
165
+ d(a, {
166
+ link: "",
167
+ type: "primary",
168
+ onClick: t[0] || (t[0] = (o) => {
169
+ n.showBatchAdd = !n.showBatchAdd, n.addOptionText = "";
170
+ }),
171
+ class: "w-padding0"
172
+ }, {
173
+ default: r(() => [...t[10] || (t[10] = [
174
+ s("span", { class: "bnUIcon bnUIcon-batchAdd w-padding-right2 w-font14" }, null, -1),
175
+ h(" 批量 ", -1)
176
+ ])]),
177
+ _: 1
178
+ }),
179
+ d(a, {
180
+ link: "",
181
+ type: "primary",
182
+ onClick: t[1] || (t[1] = (o) => l.addOption()),
183
+ class: "w-padding0"
184
+ }, {
185
+ default: r(() => [...t[11] || (t[11] = [
186
+ s("span", { class: "bnUIcon bnUIcon-addFile w-padding-right2 w-font14" }, null, -1),
187
+ h("添加 ", -1)
188
+ ])]),
189
+ _: 1
190
+ })
191
+ ])) : w("", !0)
192
+ ]),
193
+ i.openDataField ? (u(), c("div", N, [
194
+ s("div", W, [
195
+ d(D, {
196
+ modelValue: n.filedType,
197
+ "onUpdate:modelValue": t[2] || (t[2] = (o) => n.filedType = o),
198
+ props: { value: "id", label: "title" },
199
+ onChange: l.changeFiledType,
200
+ options: [{ id: "", title: "选项" }, { id: "DataFields", title: "数据字典" }]
201
+ }, null, 8, ["modelValue", "onChange"])
202
+ ])
203
+ ])) : w("", !0)
204
+ ]),
205
+ n.showBatchAdd && n.filedType != "DataFields" ? (u(), c("div", E, [
206
+ d(O, {
207
+ modelValue: n.addOptionText,
208
+ "onUpdate:modelValue": t[3] || (t[3] = (o) => n.addOptionText = o),
209
+ type: "textarea",
210
+ clearable: "",
211
+ rows: 4,
212
+ resize: "none",
213
+ onKeydown: t[4] || (t[4] = k((o) => l.addOption("add"), ["enter"])),
214
+ placeholder: "支持换行、逗号、空格分隔,自动去重,最多添加100个,手动按回车键自动进行追加操作"
215
+ }, null, 8, ["modelValue"]),
216
+ s("div", j, [
217
+ d(a, {
218
+ link: "",
219
+ type: "warning",
220
+ onClick: t[5] || (t[5] = (o) => {
221
+ n.showBatchAdd = !1, n.addOptionText = "";
222
+ })
223
+ }, {
224
+ default: r(() => [...t[13] || (t[13] = [
225
+ h("收起", -1)
226
+ ])]),
227
+ _: 1
228
+ }),
229
+ d(a, {
230
+ link: "",
231
+ type: "primary",
232
+ onClick: t[6] || (t[6] = (o) => l.addOption("add"))
233
+ }, {
234
+ default: r(() => [...t[14] || (t[14] = [
235
+ h("追加", -1)
236
+ ])]),
237
+ _: 1
238
+ }),
239
+ d(a, {
240
+ link: "",
241
+ type: "primary",
242
+ onClick: t[7] || (t[7] = (o) => l.addOption("cover"))
243
+ }, {
244
+ default: r(() => [...t[15] || (t[15] = [
245
+ h("覆盖", -1)
246
+ ])]),
247
+ _: 1
248
+ })
249
+ ])
250
+ ])) : w("", !0),
251
+ n.filedType != "DataFields" ? (u(), c("div", q, [
252
+ d(T, {
253
+ "max-height": "260px",
254
+ class: "setOpt-list",
255
+ ref: "optionList"
256
+ }, {
257
+ default: r(() => [
258
+ d(y, {
259
+ modelValue: i.columnData.moduleDefinition,
260
+ "onUpdate:modelValue": t[8] || (t[8] = (o) => i.columnData.moduleDefinition = o),
261
+ "item-key": "id",
262
+ handle: ".setOpt-list-item-drag",
263
+ "ghost-class": "ghost-item",
264
+ "chosen-class": "chosen-item",
265
+ animation: "300",
266
+ tag: "div"
267
+ }, {
268
+ item: r(({ element: o, index: x }) => [
269
+ s("div", {
270
+ class: g(["setOpt-list-item", [n.componentWidth > 400 ? "two" : "one"]])
271
+ }, [
272
+ t[16] || (t[16] = s("div", { class: "setOpt-list-item-drag w-default-hover" }, [
273
+ s("span", { class: "bnUIcon bnUIcon-move" })
274
+ ], -1)),
275
+ d(O, {
276
+ modelValue: o.title,
277
+ "onUpdate:modelValue": (m) => o.title = m,
278
+ modelModifiers: { trim: !0 },
279
+ clearable: "",
280
+ class: g({ "is-new-option": l.isNewOption(o.title) }),
281
+ onFocus: (m) => n.oldTitle = o.title,
282
+ maxlength: "100",
283
+ "show-word-limit": "",
284
+ onBlur: (m) => l.updateOptionTitle(o.title)
285
+ }, null, 8, ["modelValue", "onUpdate:modelValue", "class", "onFocus", "onBlur"]),
286
+ d(v, {
287
+ modelValue: o.columnStatus,
288
+ "onUpdate:modelValue": (m) => o.columnStatus = m,
289
+ "active-value": 1,
290
+ "inactive-value": 0,
291
+ class: "w-padding-lr6"
292
+ }, null, 8, ["modelValue", "onUpdate:modelValue"]),
293
+ s("span", {
294
+ class: "bnUIcon bnUIcon-delete",
295
+ onClick: (m) => l.deleteOption(x, o.title)
296
+ }, null, 8, z)
297
+ ], 2)
298
+ ]),
299
+ _: 1
300
+ }, 8, ["modelValue"])
301
+ ]),
302
+ _: 1
303
+ }, 512),
304
+ !i.columnData.moduleDefinition || i.columnData.moduleDefinition.length == 0 ? (u(), c("div", L, "暂无选项数据")) : w("", !0)
305
+ ])) : (u(), c("div", K, [
306
+ d(b, {
307
+ modelValue: i.columnData.insideDataSourceInfo.field,
308
+ "onUpdate:modelValue": t[9] || (t[9] = (o) => i.columnData.insideDataSourceInfo.field = o),
309
+ clearable: "",
310
+ filterable: "",
311
+ labelInValue: !1,
312
+ placeholder: "请选择你的数据字典",
313
+ pathUrl: "/ipaas/web/enum/userList",
314
+ "post-data": {
315
+ pageSize: 1e3,
316
+ pageNum: 1,
317
+ data: {
318
+ type: 1
319
+ }
320
+ },
321
+ postFunc: i.postFunc
322
+ }, null, 8, ["modelValue", "postFunc"])
323
+ ]))
324
+ ]);
325
+ }
326
+ const J = /* @__PURE__ */ I(F, [["render", P], ["__scopeId", "data-v-39464814"]]);
327
+ export {
328
+ J as default
329
+ };
@@ -0,0 +1 @@
1
+ .setOpt-top[data-v-39464814]{height:32px;font-size:14px}.setOpt-top-title[data-v-39464814]{font-weight:500}.setOpt-batch[data-v-39464814]{margin-top:10px}.setOpt-filedType .el-segmented[data-v-39464814]{--el-segmented-item-selected-color: #fff;--el-segmented-item-selected-bg-color: #409EFF;--el-border-radius-base: 16px}.setOpt-list[data-v-39464814]{margin-top:10px;padding-right:10px}.setOpt-list .el-scrollbar__view>div[data-v-39464814]{display:flex;flex-wrap:wrap;gap:10px}.setOpt-list-item[data-v-39464814]{display:flex;align-items:center;cursor:pointer}.setOpt-list-item.two[data-v-39464814]{width:calc(50% - 5px)}.setOpt-list-item.one[data-v-39464814]{width:100%}.setOpt-list-item-drag[data-v-39464814]{padding-right:8px}.setOpt-list-item[data-v-39464814] .is-new-option .el-input__wrapper{box-shadow:0 0 0 1px #ff9800 inset}.setOpt-list-item[data-v-39464814] .is-new-option .el-input__wrapper:hover,.setOpt-list-item[data-v-39464814] .is-new-option .el-input__wrapper.is-focus{box-shadow:0 0 0 1px #ff9800 inset!important}