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.
@@ -0,0 +1,299 @@
1
+ import { defineComponent, ref, reactive, onMounted, computed, openBlock, createElementBlock, createVNode, unref, withCtx, createElementVNode, normalizeClass, createCommentVNode, createBlock, renderSlot, normalizeStyle, toDisplayString, withDirectives, vShow, vModelSelect, vModelText, createTextVNode } from 'vue';
2
+ import { NSpin, NCheckbox, NTooltip, NButton } from 'naive-ui';
3
+ import Draggable from 'vuedraggable';
4
+
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
+ var script = /* @__PURE__ */ defineComponent({
51
+ __name: "NewFieldSet",
52
+ 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
+ },
72
+ emits: ["onSave", "onClose"],
73
+ setup(__props, { emit }) {
74
+ const props = __props;
75
+ const settingView = ref(null);
76
+ const state = reactive({
77
+ spinning: false,
78
+ isCustomSearch: true,
79
+ clickItem: {},
80
+ fields: props.fields
81
+ });
82
+ onMounted(() => {
83
+ hideTab();
84
+ });
85
+ const leftStyle = (ele) => {
86
+ return {
87
+ background: state.clickItem.id === ele.id ? "#f2f2f2" : void 0
88
+ };
89
+ };
90
+ const isMiddleAndAdmin = computed(() => props.menuSource == "middle");
91
+ const showCheckBox = (key) => {
92
+ return state.fields.some((i) => Object.prototype.hasOwnProperty.call(i, key));
93
+ };
94
+ const hideTab = () => {
95
+ var _a, _b;
96
+ if (isMiddleAndAdmin.value)
97
+ return;
98
+ if (props.drawerDirection === "right") {
99
+ (_a = settingView.value) == null ? void 0 : _a.style.setProperty("margin", "auto");
100
+ } else {
101
+ (_b = settingView.value) == null ? void 0 : _b.style.setProperty("margin", "auto");
102
+ }
103
+ };
104
+ const handleFieldSave = () => {
105
+ emit("onSave", { tableFields: state.fields });
106
+ };
107
+ const onCancle = () => {
108
+ emit("onClose");
109
+ };
110
+ const calculateCheck = (key) => {
111
+ if (!state.fields.length)
112
+ return false;
113
+ return state.fields.every((i) => {
114
+ if (!Object.prototype.hasOwnProperty.call(i, key))
115
+ return true;
116
+ return i[key];
117
+ });
118
+ };
119
+ const handleAllCheck = (e, key) => {
120
+ const value = e;
121
+ const data = state.fields.map((i) => {
122
+ if (Object.prototype.hasOwnProperty.call(i, key)) {
123
+ i[key] = value;
124
+ }
125
+ return i;
126
+ });
127
+ state.fields = data;
128
+ };
129
+ const handleFieldClick = (item) => {
130
+ state.clickItem = item;
131
+ };
132
+ return (_ctx, _cache) => {
133
+ return openBlock(), createElementBlock("div", {
134
+ ref_key: "settingView",
135
+ ref: settingView,
136
+ class: "c-field-set"
137
+ }, [
138
+ createVNode(unref(NSpin), {
139
+ show: state.spinning,
140
+ tip: "...",
141
+ style: { "width": "100%", "height": "100%" }
142
+ }, {
143
+ default: withCtx(() => [
144
+ createElementVNode("div", _hoisted_1, [
145
+ createElementVNode("div", _hoisted_2, [
146
+ createElementVNode("div", {
147
+ class: normalizeClass(["setting-title", { "seting-title-api": !state.isCustomSearch }])
148
+ }, [
149
+ _hoisted_3,
150
+ createCommentVNode(" \u5B57\u6BB5\u540D\u79F0 "),
151
+ _hoisted_4,
152
+ createCommentVNode(" \u663E\u793A "),
153
+ createElementVNode("span", _hoisted_5, [
154
+ showCheckBox("show") ? (openBlock(), createBlock(unref(NCheckbox), {
155
+ key: 0,
156
+ checked: calculateCheck("show"),
157
+ "onUpdate:checked": _cache[0] || (_cache[0] = ($event) => handleAllCheck($event, "show"))
158
+ }, null, 8, ["checked"])) : createCommentVNode("v-if", true),
159
+ _hoisted_6
160
+ ]),
161
+ createCommentVNode(" \u6392\u5E8F "),
162
+ createElementVNode("span", _hoisted_7, [
163
+ showCheckBox("sort") ? (openBlock(), createBlock(unref(NCheckbox), {
164
+ key: 0,
165
+ checked: calculateCheck("sort"),
166
+ "onUpdate:checked": _cache[1] || (_cache[1] = ($event) => handleAllCheck($event, "sort"))
167
+ }, null, 8, ["checked"])) : createCommentVNode("v-if", true),
168
+ _hoisted_8
169
+ ]),
170
+ createCommentVNode(" \u56FA\u5B9A "),
171
+ _hoisted_9,
172
+ renderSlot(_ctx.$slots, "default", {}, () => [
173
+ createCommentVNode(" \u81EA\u5B9A\u4E49\u6807\u9898 "),
174
+ _hoisted_10
175
+ ]),
176
+ createCommentVNode(" \u5217\u5BBD "),
177
+ _hoisted_11
178
+ ], 2),
179
+ createElementVNode("div", {
180
+ ref: "setShow",
181
+ class: normalizeClass(["set-show", { "set-show-api": !state.isCustomSearch }])
182
+ }, [
183
+ createVNode(unref(Draggable), {
184
+ list: state.fields,
185
+ animation: "150",
186
+ "item-key": "id",
187
+ tag: "ul"
188
+ }, {
189
+ item: withCtx(({ element }) => [
190
+ createElementVNode("li", {
191
+ class: "left-style",
192
+ style: normalizeStyle(leftStyle(element)),
193
+ onClick: ($event) => handleFieldClick(element)
194
+ }, [
195
+ createElementVNode("span", _hoisted_13, [
196
+ createVNode(unref(NTooltip), { trigger: "hover" }, {
197
+ trigger: withCtx(() => [
198
+ _hoisted_14
199
+ ]),
200
+ default: withCtx(() => [
201
+ _hoisted_15
202
+ ]),
203
+ _: 1
204
+ })
205
+ ]),
206
+ createCommentVNode(" \u5B57\u6BB5\u540D\u79F0 "),
207
+ createElementVNode("span", {
208
+ class: normalizeClass(["width-large title-item", { blue: element.extraField }])
209
+ }, [
210
+ _hoisted_16,
211
+ createElementVNode("span", null, toDisplayString(element.alias), 1)
212
+ ], 2),
213
+ createCommentVNode(" \u663E\u793A "),
214
+ createElementVNode("span", _hoisted_17, [
215
+ withDirectives(createVNode(unref(NCheckbox), {
216
+ checked: element.show,
217
+ "onUpdate:checked": ($event) => element.show = $event
218
+ }, null, 8, ["checked", "onUpdate:checked"]), [
219
+ [vShow, element.id != "0001"]
220
+ ])
221
+ ]),
222
+ createCommentVNode(" \u6392\u5E8F "),
223
+ createElementVNode("span", _hoisted_18, [
224
+ withDirectives(createVNode(unref(NCheckbox), {
225
+ checked: element.sort,
226
+ "onUpdate:checked": ($event) => element.sort = $event,
227
+ disabled: element.notParticipatingSort == 1
228
+ }, null, 8, ["checked", "onUpdate:checked", "disabled"]), [
229
+ [vShow, element.id != "0001"]
230
+ ])
231
+ ]),
232
+ createCommentVNode(" \u56FA\u5B9A "),
233
+ createElementVNode("span", _hoisted_19, [
234
+ withDirectives(createElementVNode("select", {
235
+ "onUpdate:modelValue": ($event) => element.fixedWay = $event,
236
+ class: "is-sort-style"
237
+ }, _hoisted_24, 8, _hoisted_20), [
238
+ [vModelSelect, element.fixedWay]
239
+ ])
240
+ ]),
241
+ renderSlot(_ctx.$slots, "default", {}, () => [
242
+ createCommentVNode(" \u81EA\u5B9A\u4E49\u6807\u9898 "),
243
+ createElementVNode("span", _hoisted_25, [
244
+ withDirectives(createElementVNode("input", {
245
+ "onUpdate:modelValue": ($event) => element.alias = $event,
246
+ class: "alias-style"
247
+ }, null, 8, _hoisted_26), [
248
+ [vShow, element.id != "0001"],
249
+ [vModelText, element.alias]
250
+ ])
251
+ ])
252
+ ]),
253
+ createCommentVNode(" \u5217\u5BBD "),
254
+ createElementVNode("span", _hoisted_27, [
255
+ withDirectives(createElementVNode("input", {
256
+ "onUpdate:modelValue": ($event) => element.columnWidth = $event,
257
+ class: "alias-style col-width-style"
258
+ }, null, 8, _hoisted_28), [
259
+ [vModelText, element.columnWidth]
260
+ ])
261
+ ])
262
+ ], 12, _hoisted_12)
263
+ ]),
264
+ _: 3
265
+ }, 8, ["list"])
266
+ ], 2)
267
+ ]),
268
+ props.footerFlag ? (openBlock(), createElementBlock("div", _hoisted_29, [
269
+ createElementVNode("div", _hoisted_30, [
270
+ createVNode(unref(NButton), {
271
+ style: { "margin-right": "8px" },
272
+ onClick: onCancle
273
+ }, {
274
+ default: withCtx(() => [
275
+ _hoisted_31
276
+ ]),
277
+ _: 1
278
+ }),
279
+ createVNode(unref(NButton), {
280
+ type: "primary",
281
+ onClick: handleFieldSave
282
+ }, {
283
+ default: withCtx(() => [
284
+ _hoisted_32
285
+ ]),
286
+ _: 1
287
+ })
288
+ ])
289
+ ])) : createCommentVNode("v-if", true)
290
+ ])
291
+ ]),
292
+ _: 3
293
+ }, 8, ["show"])
294
+ ], 512);
295
+ };
296
+ }
297
+ });
298
+
299
+ export { script as default };
@@ -0,0 +1,4 @@
1
+ import script from './OldFieldSet.vue_vue_type_script_setup_true_lang.js';
2
+ export { default } from './OldFieldSet.vue_vue_type_script_setup_true_lang.js';
3
+
4
+ script.__file = "packages/field-set/src/OldFieldSet.vue";