cnhis-design-vue 3.1.14-beta.11.2 → 3.1.14-beta.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,343 +1,20 @@
1
- import { defineComponent, ref, computed, reactive, onMounted, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, normalizeClass, createCommentVNode, createBlock, normalizeStyle, toDisplayString, withDirectives, vShow, vModelSelect, vModelText, renderSlot, createTextVNode } from 'vue';
2
- import { NSpin, NCheckbox, NTooltip, NButton } from 'naive-ui';
3
- import Draggable from 'vuedraggable';
1
+ import { defineComponent, openBlock, createElementBlock, Fragment, createCommentVNode, createBlock, normalizeProps, mergeProps } from 'vue';
2
+ import './OldFieldSet.js';
3
+ import './NewFieldSet.js';
4
+ import script$1 from './OldFieldSet.vue_vue_type_script_setup_true_lang.js';
5
+ import script$2 from './NewFieldSet.vue_vue_type_script_setup_true_lang.js';
4
6
 
5
- const _hoisted_1 = { class: "fields-set-content" };
6
- const _hoisted_2 = { class: "fields-table" };
7
- const _hoisted_3 = /* @__PURE__ */ createElementVNode("span", {
8
- class: "width-show",
9
- style: { "width": "4%" }
10
- }, null, -1);
11
- const _hoisted_4 = /* @__PURE__ */ createElementVNode("span", { class: "width-large" }, "\u6240\u6709\u5B57\u6BB5", -1);
12
- const _hoisted_5 = { class: "width-show" };
13
- const _hoisted_6 = /* @__PURE__ */ createTextVNode(" \u663E\u793A ");
14
- const _hoisted_7 = { class: "width-show" };
15
- const _hoisted_8 = /* @__PURE__ */ createTextVNode(" \u6392\u5E8F ");
16
- const _hoisted_9 = /* @__PURE__ */ createElementVNode("span", { class: "width-showed" }, "\u56FA\u5B9A", -1);
17
- const _hoisted_10 = /* @__PURE__ */ createElementVNode("span", { class: "width-word" }, "\u81EA\u5B9A\u4E49\u6807\u9898", -1);
18
- const _hoisted_11 = /* @__PURE__ */ createElementVNode("span", { class: "width-showed" }, "\u5217\u5BBD", -1);
19
- const _hoisted_12 = ["onClick"];
20
- const _hoisted_13 = { class: "width-show drag-icon-wrap" };
21
- const _hoisted_14 = /* @__PURE__ */ createElementVNode("span", {
22
- class: "iconfont icon-a-menzhenyishengzhanxitongtubiaotuozhuai",
23
- style: { "color": "#000" }
24
- }, null, -1);
25
- const _hoisted_15 = /* @__PURE__ */ createElementVNode("span", null, "\u62D6\u62FD\u8C03\u6574\u987A\u5E8F", -1);
26
- const _hoisted_16 = /* @__PURE__ */ createElementVNode("span", { style: { "width": "14px", "margin-right": "6px" } }, null, -1);
27
- const _hoisted_17 = { class: "width-show" };
28
- const _hoisted_18 = { class: "width-show" };
29
- const _hoisted_19 = { class: "width-showed" };
30
- const _hoisted_20 = ["onUpdate:modelValue"];
31
- const _hoisted_21 = /* @__PURE__ */ createElementVNode("option", { value: "NONE" }, "\u4E0D\u56FA\u5B9A", -1);
32
- const _hoisted_22 = /* @__PURE__ */ createElementVNode("option", { value: "LEFT" }, "\u5DE6\u56FA\u5B9A", -1);
33
- const _hoisted_23 = /* @__PURE__ */ createElementVNode("option", { value: "RIGHT" }, "\u53F3\u56FA\u5B9A", -1);
34
- const _hoisted_24 = [
35
- _hoisted_21,
36
- _hoisted_22,
37
- _hoisted_23
38
- ];
39
- const _hoisted_25 = { class: "width-word" };
40
- const _hoisted_26 = ["onUpdate:modelValue"];
41
- const _hoisted_27 = { class: "width-showed" };
42
- const _hoisted_28 = ["onUpdate:modelValue"];
43
- const _hoisted_29 = {
44
- key: 0,
45
- class: "check-options"
46
- };
47
- const _hoisted_30 = { class: "btn-operate" };
48
- const _hoisted_31 = /* @__PURE__ */ createTextVNode("\u53D6\u6D88");
49
- const _hoisted_32 = /* @__PURE__ */ createTextVNode("\u4FDD\u5B58");
50
7
  var script = /* @__PURE__ */ defineComponent({
51
8
  __name: "FieldSet",
52
9
  props: {
53
- fields: {
54
- type: Array,
55
- default: function() {
56
- return [];
57
- }
58
- },
59
- menuSource: {
60
- type: String,
61
- default: ""
62
- },
63
- drawerDirection: {
64
- type: String,
65
- default: "right"
66
- },
67
- footerFlag: {
68
- type: Boolean,
69
- default: true
70
- },
71
- type: {
72
- type: String,
73
- default: "old"
74
- }
10
+ type: { type: String, required: false, default: "old" }
75
11
  },
76
- emits: ["onSave", "onClose"],
77
- setup(__props, { expose, emit }) {
78
- const props = __props;
79
- const fieldsMapping = {
80
- sid: "id",
81
- columnName: "name",
82
- isShow: "show",
83
- isSort: "sort",
84
- isFixed: "fixedShow",
85
- colWidth: "columnWidth"
86
- };
87
- const settingView = ref(null);
88
- const realityFields = computed(() => {
89
- const result = props.fields ? JSON.parse(JSON.stringify(props.fields)) : [];
90
- if (props.type == "old") {
91
- Object.keys(fieldsMapping).forEach((key) => {
92
- result.forEach((item) => {
93
- if (Reflect.has(item, key)) {
94
- item[fieldsMapping[key]] = item[key];
95
- Reflect.deleteProperty(item, key);
96
- }
97
- });
98
- });
99
- }
100
- return result;
101
- });
102
- const state = reactive({
103
- spinning: false,
104
- isCustomSearch: true,
105
- clickItem: {},
106
- fields: realityFields.value
107
- });
108
- const leftStyle = (ele) => {
109
- return {
110
- background: state.clickItem.id === ele.id ? "#f2f2f2" : void 0
111
- };
112
- };
113
- const showCheckBox = (key) => {
114
- return state.fields.some((i) => Object.prototype.hasOwnProperty.call(i, key));
115
- };
116
- const hideTab = () => {
117
- var _a, _b;
118
- if (props.drawerDirection === "right") {
119
- (_a = settingView.value) == null ? void 0 : _a.style.setProperty("margin", "auto");
120
- } else {
121
- (_b = settingView.value) == null ? void 0 : _b.style.setProperty("margin", "auto");
122
- }
123
- };
124
- const getTableFields = () => {
125
- if (props.type == "old") {
126
- let tableFields = [];
127
- if (state.fields.length > 0) {
128
- state.fields.forEach((item, i) => {
129
- tableFields.push({
130
- id: item.id,
131
- field: item.name,
132
- visible: item.show,
133
- sequence: i,
134
- sortable: item.sort,
135
- title: item.alias || item.title,
136
- fixed: item.fixedWay,
137
- minWidth: item.columnWidth
138
- });
139
- });
140
- }
141
- return tableFields;
142
- } else {
143
- return state.fields;
144
- }
145
- };
146
- const handleFieldSave = () => {
147
- emit("onSave", { tableFields: getTableFields() });
148
- };
149
- const onCancle = () => {
150
- emit("onClose");
151
- };
152
- const calculateCheck = (key) => {
153
- if (!state.fields.length)
154
- return false;
155
- return state.fields.every((i) => {
156
- if (!Object.prototype.hasOwnProperty.call(i, key))
157
- return true;
158
- return i[key];
159
- });
160
- };
161
- const handleAllCheck = (e, key) => {
162
- const value = e;
163
- const data = state.fields.map((i) => {
164
- if (Object.prototype.hasOwnProperty.call(i, key)) {
165
- i[key] = value;
166
- }
167
- return i;
168
- });
169
- state.fields = data;
170
- };
171
- const handleFieldClick = (item) => {
172
- state.clickItem = item;
173
- };
174
- onMounted(() => {
175
- hideTab();
176
- });
177
- expose({
178
- getTableFields
179
- });
12
+ setup(__props) {
180
13
  return (_ctx, _cache) => {
181
- return openBlock(), createElementBlock("div", {
182
- ref_key: "settingView",
183
- ref: settingView,
184
- class: "c-field-set"
185
- }, [
186
- createVNode(unref(NSpin), {
187
- show: state.spinning,
188
- tip: "...",
189
- style: { "width": "100%", "height": "100%" }
190
- }, {
191
- default: withCtx(() => [
192
- createElementVNode("div", _hoisted_1, [
193
- createElementVNode("div", _hoisted_2, [
194
- createElementVNode("div", {
195
- class: normalizeClass(["setting-title", { "seting-title-api": !state.isCustomSearch }])
196
- }, [
197
- _hoisted_3,
198
- createCommentVNode(" \u5B57\u6BB5\u540D\u79F0 "),
199
- _hoisted_4,
200
- createCommentVNode(" \u663E\u793A "),
201
- createElementVNode("span", _hoisted_5, [
202
- showCheckBox("show") ? (openBlock(), createBlock(unref(NCheckbox), {
203
- key: 0,
204
- checked: calculateCheck("show"),
205
- "onUpdate:checked": _cache[0] || (_cache[0] = ($event) => handleAllCheck($event, "show"))
206
- }, null, 8, ["checked"])) : createCommentVNode("v-if", true),
207
- _hoisted_6
208
- ]),
209
- createCommentVNode(" \u6392\u5E8F "),
210
- createElementVNode("span", _hoisted_7, [
211
- showCheckBox("sort") ? (openBlock(), createBlock(unref(NCheckbox), {
212
- key: 0,
213
- checked: calculateCheck("sort"),
214
- "onUpdate:checked": _cache[1] || (_cache[1] = ($event) => handleAllCheck($event, "sort"))
215
- }, null, 8, ["checked"])) : createCommentVNode("v-if", true),
216
- _hoisted_8
217
- ]),
218
- createCommentVNode(" \u56FA\u5B9A "),
219
- _hoisted_9,
220
- createCommentVNode(" \u81EA\u5B9A\u4E49\u6807\u9898 "),
221
- _hoisted_10,
222
- createCommentVNode(" \u5217\u5BBD "),
223
- _hoisted_11
224
- ], 2),
225
- createElementVNode("div", {
226
- ref: "setShow",
227
- class: normalizeClass(["set-show", { "set-show-api": !state.isCustomSearch }])
228
- }, [
229
- createVNode(unref(Draggable), {
230
- list: state.fields,
231
- animation: "150",
232
- "item-key": "id",
233
- tag: "ul"
234
- }, {
235
- item: withCtx(({ element }) => [
236
- createElementVNode("li", {
237
- class: "left-style",
238
- style: normalizeStyle(leftStyle(element)),
239
- onClick: ($event) => handleFieldClick(element)
240
- }, [
241
- createElementVNode("span", _hoisted_13, [
242
- createVNode(unref(NTooltip), { trigger: "hover" }, {
243
- trigger: withCtx(() => [
244
- _hoisted_14
245
- ]),
246
- default: withCtx(() => [
247
- _hoisted_15
248
- ]),
249
- _: 1
250
- })
251
- ]),
252
- createCommentVNode(" \u5B57\u6BB5\u540D\u79F0 "),
253
- createElementVNode("span", {
254
- class: normalizeClass(["width-large title-item", { blue: element.extraField }])
255
- }, [
256
- _hoisted_16,
257
- createElementVNode("span", null, toDisplayString(element.title), 1)
258
- ], 2),
259
- createCommentVNode(" \u663E\u793A "),
260
- createElementVNode("span", _hoisted_17, [
261
- withDirectives(createVNode(unref(NCheckbox), {
262
- checked: element.show,
263
- "onUpdate:checked": ($event) => element.show = $event
264
- }, null, 8, ["checked", "onUpdate:checked"]), [
265
- [vShow, element.id != "0001"]
266
- ])
267
- ]),
268
- createCommentVNode(" \u6392\u5E8F "),
269
- createElementVNode("span", _hoisted_18, [
270
- withDirectives(createVNode(unref(NCheckbox), {
271
- checked: element.sort,
272
- "onUpdate:checked": ($event) => element.sort = $event,
273
- disabled: element.notParticipatingSort == 1
274
- }, null, 8, ["checked", "onUpdate:checked", "disabled"]), [
275
- [vShow, element.id != "0001"]
276
- ])
277
- ]),
278
- createCommentVNode(" \u56FA\u5B9A "),
279
- createElementVNode("span", _hoisted_19, [
280
- withDirectives(createElementVNode("select", {
281
- "onUpdate:modelValue": ($event) => element.fixedWay = $event,
282
- class: "is-sort-style"
283
- }, _hoisted_24, 8, _hoisted_20), [
284
- [vModelSelect, element.fixedWay]
285
- ])
286
- ]),
287
- createCommentVNode(" \u81EA\u5B9A\u4E49\u6807\u9898 "),
288
- createElementVNode("span", _hoisted_25, [
289
- withDirectives(createElementVNode("input", {
290
- "onUpdate:modelValue": ($event) => element.alias = $event,
291
- class: "alias-style"
292
- }, null, 8, _hoisted_26), [
293
- [vShow, element.id != "0001"],
294
- [vModelText, element.alias]
295
- ])
296
- ]),
297
- createCommentVNode(" \u5217\u5BBD "),
298
- createElementVNode("span", _hoisted_27, [
299
- withDirectives(createElementVNode("input", {
300
- "onUpdate:modelValue": ($event) => element.columnWidth = $event,
301
- class: "alias-style col-width-style"
302
- }, null, 8, _hoisted_28), [
303
- [vModelText, element.columnWidth]
304
- ])
305
- ])
306
- ], 12, _hoisted_12)
307
- ]),
308
- _: 1
309
- }, 8, ["list"])
310
- ], 2)
311
- ]),
312
- props.footerFlag ? (openBlock(), createElementBlock("div", _hoisted_29, [
313
- createElementVNode("div", _hoisted_30, [
314
- renderSlot(_ctx.$slots, "footer", {}, () => [
315
- createVNode(unref(NButton), {
316
- style: { "margin-right": "8px" },
317
- onClick: onCancle
318
- }, {
319
- default: withCtx(() => [
320
- _hoisted_31
321
- ]),
322
- _: 1
323
- }),
324
- createVNode(unref(NButton), {
325
- type: "primary",
326
- onClick: handleFieldSave
327
- }, {
328
- default: withCtx(() => [
329
- _hoisted_32
330
- ]),
331
- _: 1
332
- })
333
- ])
334
- ])
335
- ])) : createCommentVNode("v-if", true)
336
- ])
337
- ]),
338
- _: 3
339
- }, 8, ["show"])
340
- ], 512);
14
+ return openBlock(), createElementBlock(Fragment, null, [
15
+ createCommentVNode(' <component :is="currentComp"></component> '),
16
+ __props.type == "old" ? (openBlock(), createBlock(script$1, normalizeProps(mergeProps({ key: 0 }, _ctx.$attrs)), null, 16)) : (openBlock(), createBlock(script$2, normalizeProps(mergeProps({ key: 1 }, _ctx.$attrs)), null, 16))
17
+ ], 2112);
341
18
  };
342
19
  }
343
20
  });
@@ -0,0 +1,4 @@
1
+ import script from './NewFieldSet.vue_vue_type_script_setup_true_lang.js';
2
+ export { default } from './NewFieldSet.vue_vue_type_script_setup_true_lang.js';
3
+
4
+ script.__file = "packages/field-set/src/NewFieldSet.vue";