rb-document-form-constructor 0.1.5 → 0.1.9
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.
- package/dist/rb-document-form-constructor.esm.js +1069 -351
- package/dist/rb-document-form-constructor.min.js +2 -3
- package/dist/rb-document-form-constructor.ssr.js +1029 -350
- package/dist/scss/components/_field-rule-form-modal.scss +27 -0
- package/dist/scss/components.scss +1 -0
- package/package.json +5 -3
- package/src/assets/fontello/README.txt +75 -0
- package/src/components/DocForm.vue +48 -25
- package/src/components/DocTemplateConstructor.vue +25 -20
- package/src/components/DocTemplateFacetList.vue +6 -6
- package/src/components/DocTemplateFieldSidebar.vue +88 -9
- package/src/components/FieldRuleFormModal.vue +260 -0
|
@@ -1,13 +1,98 @@
|
|
|
1
|
+
import crypto from 'crypto';
|
|
2
|
+
|
|
3
|
+
const UtFormConfig = {
|
|
4
|
+
findField(fieldName, formConfig) {
|
|
5
|
+
if (!formConfig || !formConfig.sections) {
|
|
6
|
+
return null;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let found = null;
|
|
10
|
+
formConfig.sections.every(r => {
|
|
11
|
+
if (r.columns) {
|
|
12
|
+
r.columns.every(c => {
|
|
13
|
+
c.fields.forEach(f => {
|
|
14
|
+
if (f.name === fieldName) {
|
|
15
|
+
found = f;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
if (found) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if (found) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
return found;
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
findRule(ruleId, formConfig) {
|
|
33
|
+
if (!formConfig || !formConfig.sections) {
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let found = null;
|
|
38
|
+
formConfig.sections.every(s => {
|
|
39
|
+
if (s.columns) {
|
|
40
|
+
s.columns.every(c => {
|
|
41
|
+
c.fields.every(f => {
|
|
42
|
+
if (f.rules) {
|
|
43
|
+
f.rules.forEach(r => {
|
|
44
|
+
if (r.id === ruleId) {
|
|
45
|
+
found = r;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (found) {
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
if (found) {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (found) {
|
|
62
|
+
return false;
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
return found;
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
getFields(formConfig) {
|
|
69
|
+
let fields = [];
|
|
70
|
+
formConfig.sections.forEach(s => {
|
|
71
|
+
if (s.columns) {
|
|
72
|
+
s.columns.forEach(c => {
|
|
73
|
+
if (c.fields) {
|
|
74
|
+
c.fields.forEach(f => {
|
|
75
|
+
fields.push(f);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
return fields;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
};
|
|
85
|
+
|
|
1
86
|
let __clone = function (data) {
|
|
2
87
|
return JSON.parse(JSON.stringify(data));
|
|
3
88
|
};
|
|
4
89
|
|
|
5
90
|
let __assign = function () {
|
|
6
91
|
__assign = Object.assign || function __assign(t) {
|
|
7
|
-
for (
|
|
92
|
+
for (let s, i = 1, n = arguments.length; i < n; i++) {
|
|
8
93
|
s = arguments[i];
|
|
9
94
|
|
|
10
|
-
for (
|
|
95
|
+
for (let p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
11
96
|
}
|
|
12
97
|
|
|
13
98
|
return t;
|
|
@@ -16,6 +101,50 @@ let __assign = function () {
|
|
|
16
101
|
return __assign.apply(this, arguments);
|
|
17
102
|
};
|
|
18
103
|
|
|
104
|
+
let __mergeInputInMapOfArrays = function (inputs, formConfigInputs) {
|
|
105
|
+
for (let dataType in formConfigInputs) {
|
|
106
|
+
let foundInputs = inputs[dataType];
|
|
107
|
+
|
|
108
|
+
if (foundInputs) {
|
|
109
|
+
__mergeInputsInArray(foundInputs, formConfigInputs[dataType]);
|
|
110
|
+
} else {
|
|
111
|
+
inputs[dataType] = formConfigInputs[dataType];
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
let __mergeInputsInMap = function (inputs, formConfigInputs) {
|
|
117
|
+
for (let name in formConfigInputs) {
|
|
118
|
+
inputs[name] = __assign(inputs[name] ? inputs[name] : {}, formConfigInputs[name] ? formConfigInputs[name] : {});
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
let __mergeInputsInArray = function (inputs, formConfigInputs) {
|
|
123
|
+
formConfigInputs.forEach(input => {
|
|
124
|
+
let index = inputs.findIndex(item => item.name === input.name);
|
|
125
|
+
|
|
126
|
+
if (index >= 0) {
|
|
127
|
+
inputs[index] = input;
|
|
128
|
+
} else {
|
|
129
|
+
inputs.push(input);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
let __applyDefaultProps = function (input) {
|
|
135
|
+
for (let propName in input.props) {
|
|
136
|
+
input.propsData[propName] = input.props[propName].default;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
let __applyRefProps = function (input, refConfig) {
|
|
141
|
+
if (refConfig !== null && refConfig !== void 0 && refConfig.propsData) {
|
|
142
|
+
for (let propName in refConfig.propsData) {
|
|
143
|
+
input.propsData[propName] = refConfig.propsData[propName];
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
19
148
|
let fcInputs = {
|
|
20
149
|
text: {
|
|
21
150
|
text: 'Текст',
|
|
@@ -113,6 +242,7 @@ let baseConfig = {
|
|
|
113
242
|
dictInputs: __clone(fcDictInputs),
|
|
114
243
|
refInputs: __clone(fcRefInputs),
|
|
115
244
|
refInputConfigs: __clone(fcRefInputConfigs),
|
|
245
|
+
rules: [],
|
|
116
246
|
icons: {
|
|
117
247
|
iconExpandFacet: 'icon-chevron-up',
|
|
118
248
|
iconCollapseFacet: 'icon-chevron-down',
|
|
@@ -122,9 +252,10 @@ let baseConfig = {
|
|
|
122
252
|
iconEdit: 'icon-edit',
|
|
123
253
|
iconDelete: 'icon-delete',
|
|
124
254
|
iconDrag: 'icon-reorder'
|
|
125
|
-
}
|
|
255
|
+
},
|
|
256
|
+
ruleContext: {}
|
|
126
257
|
};
|
|
127
|
-
const
|
|
258
|
+
const UtFormConstructor = {
|
|
128
259
|
config: {},
|
|
129
260
|
|
|
130
261
|
init(formConfig) {
|
|
@@ -132,19 +263,19 @@ const UtFormConfig = {
|
|
|
132
263
|
|
|
133
264
|
if (formConfig) {
|
|
134
265
|
if (formConfig.inputs) {
|
|
135
|
-
|
|
266
|
+
__mergeInputsInMap(this.config.inputs, formConfig.inputs);
|
|
136
267
|
}
|
|
137
268
|
|
|
138
269
|
if (formConfig.primitiveInputs) {
|
|
139
|
-
|
|
270
|
+
__mergeInputInMapOfArrays(this.config.primitiveInputs, formConfig.primitiveInputs);
|
|
140
271
|
}
|
|
141
272
|
|
|
142
273
|
if (formConfig.dictInputs) {
|
|
143
|
-
|
|
274
|
+
__mergeInputsInArray(this.config.dictInputs, formConfig.dictInputs);
|
|
144
275
|
}
|
|
145
276
|
|
|
146
277
|
if (formConfig.refInputs) {
|
|
147
|
-
|
|
278
|
+
__mergeInputInMapOfArrays(this.config.refInputs, formConfig.refInputs);
|
|
148
279
|
}
|
|
149
280
|
|
|
150
281
|
if (formConfig.refInputConfigs) {
|
|
@@ -154,45 +285,15 @@ const UtFormConfig = {
|
|
|
154
285
|
if (formConfig.icons) {
|
|
155
286
|
this.config.icons = __assign(this.config.icons, formConfig.icons);
|
|
156
287
|
}
|
|
157
|
-
}
|
|
158
|
-
},
|
|
159
288
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
let foundInputs = inputs[dataType];
|
|
163
|
-
|
|
164
|
-
if (foundInputs) {
|
|
165
|
-
this.mergeInputsInArray(foundInputs, formConfigInputs[dataType]);
|
|
166
|
-
} else {
|
|
167
|
-
inputs[dataType] = formConfigInputs[dataType];
|
|
289
|
+
if (formConfig.rules) {
|
|
290
|
+
this.config.rules = formConfig.rules;
|
|
168
291
|
}
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
292
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
inputs[name] = __assign(inputs[name] ? inputs[name] : {}, formConfigInputs[name] ? formConfigInputs[name] : {});
|
|
175
|
-
}
|
|
176
|
-
},
|
|
177
|
-
|
|
178
|
-
mergeInputsInArray(inputs, formConfigInputs) {
|
|
179
|
-
formConfigInputs.forEach(input => {
|
|
180
|
-
let index = inputs.findIndex(item => item.name === input.name);
|
|
181
|
-
|
|
182
|
-
if (index >= 0) {
|
|
183
|
-
inputs[index] = input;
|
|
184
|
-
} else {
|
|
185
|
-
inputs.push(input);
|
|
293
|
+
if (formConfig.ruleContext) {
|
|
294
|
+
this.config.ruleContext = formConfig.ruleContext;
|
|
186
295
|
}
|
|
187
|
-
}
|
|
188
|
-
},
|
|
189
|
-
|
|
190
|
-
getAllInputTypes() {
|
|
191
|
-
return this.config.inputs;
|
|
192
|
-
},
|
|
193
|
-
|
|
194
|
-
getAllDictInputs() {
|
|
195
|
-
return this.config.dictInputs;
|
|
296
|
+
}
|
|
196
297
|
},
|
|
197
298
|
|
|
198
299
|
getInputTypes(field) {
|
|
@@ -216,18 +317,21 @@ const UtFormConfig = {
|
|
|
216
317
|
|
|
217
318
|
if (field.ref && this.config.refInputs[field.ref]) {
|
|
218
319
|
input = __clone(this.config.refInputs[field.ref][0]);
|
|
219
|
-
|
|
320
|
+
|
|
321
|
+
__applyDefaultProps(input);
|
|
220
322
|
|
|
221
323
|
if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
|
|
222
|
-
|
|
324
|
+
__applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
|
|
223
325
|
}
|
|
224
326
|
} else if (field.dict) {
|
|
225
327
|
input = __clone(this.config.dictInputs[0]);
|
|
226
328
|
input.props.dict.default = field.ref;
|
|
227
|
-
|
|
329
|
+
|
|
330
|
+
__applyDefaultProps(input);
|
|
228
331
|
} else {
|
|
229
332
|
input = __clone(this.config.primitiveInputs[field.type][0]);
|
|
230
|
-
|
|
333
|
+
|
|
334
|
+
__applyDefaultProps(input);
|
|
231
335
|
}
|
|
232
336
|
|
|
233
337
|
return input;
|
|
@@ -237,47 +341,47 @@ const UtFormConfig = {
|
|
|
237
341
|
let input = JSON.parse(JSON.stringify(this.config.inputs[name]));
|
|
238
342
|
|
|
239
343
|
if (field.ref && this.config.refInputs[field.ref]) {
|
|
240
|
-
|
|
344
|
+
__applyDefaultProps(input);
|
|
241
345
|
|
|
242
346
|
if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
|
|
243
|
-
|
|
347
|
+
__applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
|
|
244
348
|
}
|
|
245
349
|
} else if (field.dict) {
|
|
246
350
|
input.props.dict.default = field.ref;
|
|
247
|
-
|
|
351
|
+
|
|
352
|
+
__applyDefaultProps(input);
|
|
248
353
|
} else {
|
|
249
|
-
|
|
354
|
+
__applyDefaultProps(input);
|
|
250
355
|
}
|
|
251
356
|
|
|
357
|
+
input.propsData['ref'] = field.name;
|
|
252
358
|
return input;
|
|
253
359
|
},
|
|
254
360
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}
|
|
361
|
+
getAvailableFieldRules(field) {
|
|
362
|
+
return this.config.rules.filter(rule => {
|
|
363
|
+
return !rule.fields || rule.fields.length === 0 || rule.fields.indexOf(field.name) >= 0;
|
|
364
|
+
});
|
|
259
365
|
},
|
|
260
366
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
for (let propName in refConfig.propsData) {
|
|
264
|
-
input.propsData[propName] = refConfig.propsData[propName];
|
|
265
|
-
}
|
|
266
|
-
}
|
|
367
|
+
getRuleContext() {
|
|
368
|
+
return this.config.ruleContext;
|
|
267
369
|
},
|
|
268
370
|
|
|
269
|
-
|
|
270
|
-
let
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
371
|
+
runRule(context, script) {
|
|
372
|
+
let appendScript = `
|
|
373
|
+
var doc = this.form.doc;
|
|
374
|
+
var form = this.form;
|
|
375
|
+
var event = this.event;
|
|
376
|
+
var eventName = this.eventName;
|
|
377
|
+
|
|
378
|
+
`;
|
|
379
|
+
|
|
380
|
+
let func = function (script) {
|
|
381
|
+
return eval(script);
|
|
382
|
+
};
|
|
383
|
+
|
|
384
|
+
func.call(context, appendScript + script);
|
|
281
385
|
}
|
|
282
386
|
|
|
283
387
|
};
|
|
@@ -301,7 +405,7 @@ const UtFormConfig = {
|
|
|
301
405
|
//
|
|
302
406
|
//
|
|
303
407
|
//
|
|
304
|
-
var script$
|
|
408
|
+
var script$5 = {
|
|
305
409
|
name: 'DocTemplateSectionModal',
|
|
306
410
|
props: {
|
|
307
411
|
section: Object,
|
|
@@ -435,10 +539,10 @@ function normalizeComponent(template, style, script, scopeId, isFunctionalTempla
|
|
|
435
539
|
}
|
|
436
540
|
|
|
437
541
|
/* script */
|
|
438
|
-
const __vue_script__$
|
|
542
|
+
const __vue_script__$5 = script$5;
|
|
439
543
|
/* template */
|
|
440
544
|
|
|
441
|
-
var __vue_render__$
|
|
545
|
+
var __vue_render__$5 = function () {
|
|
442
546
|
var _vm = this;
|
|
443
547
|
|
|
444
548
|
var _h = _vm.$createElement;
|
|
@@ -486,19 +590,19 @@ var __vue_render__$4 = function () {
|
|
|
486
590
|
})], 1)], 1)], 1)], 1)], 1);
|
|
487
591
|
};
|
|
488
592
|
|
|
489
|
-
var __vue_staticRenderFns__$
|
|
593
|
+
var __vue_staticRenderFns__$5 = [];
|
|
490
594
|
/* style */
|
|
491
595
|
|
|
492
|
-
const __vue_inject_styles__$
|
|
596
|
+
const __vue_inject_styles__$5 = undefined;
|
|
493
597
|
/* scoped */
|
|
494
598
|
|
|
495
|
-
const __vue_scope_id__$
|
|
599
|
+
const __vue_scope_id__$5 = undefined;
|
|
496
600
|
/* module identifier */
|
|
497
601
|
|
|
498
|
-
const __vue_module_identifier__$
|
|
602
|
+
const __vue_module_identifier__$5 = undefined;
|
|
499
603
|
/* functional template */
|
|
500
604
|
|
|
501
|
-
const __vue_is_functional_template__$
|
|
605
|
+
const __vue_is_functional_template__$5 = false;
|
|
502
606
|
/* style inject */
|
|
503
607
|
|
|
504
608
|
/* style inject SSR */
|
|
@@ -506,9 +610,9 @@ const __vue_is_functional_template__$4 = false;
|
|
|
506
610
|
/* style inject shadow dom */
|
|
507
611
|
|
|
508
612
|
const __vue_component__$6 = /*#__PURE__*/normalizeComponent({
|
|
509
|
-
render: __vue_render__$
|
|
510
|
-
staticRenderFns: __vue_staticRenderFns__$
|
|
511
|
-
}, __vue_inject_styles__$
|
|
613
|
+
render: __vue_render__$5,
|
|
614
|
+
staticRenderFns: __vue_staticRenderFns__$5
|
|
615
|
+
}, __vue_inject_styles__$5, __vue_script__$5, __vue_scope_id__$5, __vue_is_functional_template__$5, __vue_module_identifier__$5, false, undefined, undefined, undefined);
|
|
512
616
|
|
|
513
617
|
var DocTemplateSectionModal = __vue_component__$6;
|
|
514
618
|
|
|
@@ -5901,7 +6005,7 @@ if (typeof window !== "undefined" && "Vue" in window) {
|
|
|
5901
6005
|
});
|
|
5902
6006
|
|
|
5903
6007
|
//
|
|
5904
|
-
var script$
|
|
6008
|
+
var script$4 = {
|
|
5905
6009
|
name: 'DocTemplateFacetList',
|
|
5906
6010
|
components: {
|
|
5907
6011
|
draggable: vuedraggable_umd
|
|
@@ -5923,11 +6027,11 @@ var script$3 = {
|
|
|
5923
6027
|
|
|
5924
6028
|
computed: {
|
|
5925
6029
|
iconExpandFacet() {
|
|
5926
|
-
return
|
|
6030
|
+
return UtFormConstructor.config.icons.iconExpandFacet;
|
|
5927
6031
|
},
|
|
5928
6032
|
|
|
5929
6033
|
iconCollapseFacet() {
|
|
5930
|
-
return
|
|
6034
|
+
return UtFormConstructor.config.icons.iconCollapseFacet;
|
|
5931
6035
|
}
|
|
5932
6036
|
|
|
5933
6037
|
},
|
|
@@ -5944,7 +6048,7 @@ var script$3 = {
|
|
|
5944
6048
|
methods: {
|
|
5945
6049
|
onFieldCloned(cloneField) {
|
|
5946
6050
|
let field = JSON.parse(JSON.stringify(cloneField));
|
|
5947
|
-
field.input =
|
|
6051
|
+
field.input = UtFormConstructor.getDefaultInput(field);
|
|
5948
6052
|
return field;
|
|
5949
6053
|
},
|
|
5950
6054
|
|
|
@@ -5993,10 +6097,10 @@ var script$3 = {
|
|
|
5993
6097
|
};
|
|
5994
6098
|
|
|
5995
6099
|
/* script */
|
|
5996
|
-
const __vue_script__$
|
|
6100
|
+
const __vue_script__$4 = script$4;
|
|
5997
6101
|
/* template */
|
|
5998
6102
|
|
|
5999
|
-
var __vue_render__$
|
|
6103
|
+
var __vue_render__$4 = function () {
|
|
6000
6104
|
var _vm = this;
|
|
6001
6105
|
|
|
6002
6106
|
var _h = _vm.$createElement;
|
|
@@ -6027,18 +6131,17 @@ var __vue_render__$3 = function () {
|
|
|
6027
6131
|
key: facet.name,
|
|
6028
6132
|
staticClass: "rb-facet"
|
|
6029
6133
|
}, [_c('h6', {
|
|
6030
|
-
staticClass: "rb-facet-label d-flex"
|
|
6134
|
+
staticClass: "rb-facet-label d-flex cursor-pointer",
|
|
6135
|
+
on: {
|
|
6136
|
+
"click": function ($event) {
|
|
6137
|
+
facet.expanded = !facet.expanded;
|
|
6138
|
+
}
|
|
6139
|
+
}
|
|
6031
6140
|
}, [_c('rb-text', {
|
|
6032
6141
|
staticClass: "flex-fill"
|
|
6033
6142
|
}, [_vm._v(_vm._s(facet.labelRu))]), _vm._v(" "), _c('rb-icon', {
|
|
6034
|
-
staticClass: "cursor-pointer",
|
|
6035
6143
|
attrs: {
|
|
6036
6144
|
"icon": facet.expanded ? _vm.iconCollapseFacet : _vm.iconExpandFacet
|
|
6037
|
-
},
|
|
6038
|
-
on: {
|
|
6039
|
-
"click": function ($event) {
|
|
6040
|
-
facet.expanded = !facet.expanded;
|
|
6041
|
-
}
|
|
6042
6145
|
}
|
|
6043
6146
|
})], 1), _vm._v(" "), facet.expanded ? _c('b-list-group', [_c('draggable', {
|
|
6044
6147
|
attrs: {
|
|
@@ -6072,19 +6175,19 @@ var __vue_render__$3 = function () {
|
|
|
6072
6175
|
}), 0)], 1);
|
|
6073
6176
|
};
|
|
6074
6177
|
|
|
6075
|
-
var __vue_staticRenderFns__$
|
|
6178
|
+
var __vue_staticRenderFns__$4 = [];
|
|
6076
6179
|
/* style */
|
|
6077
6180
|
|
|
6078
|
-
const __vue_inject_styles__$
|
|
6181
|
+
const __vue_inject_styles__$4 = undefined;
|
|
6079
6182
|
/* scoped */
|
|
6080
6183
|
|
|
6081
|
-
const __vue_scope_id__$
|
|
6184
|
+
const __vue_scope_id__$4 = undefined;
|
|
6082
6185
|
/* module identifier */
|
|
6083
6186
|
|
|
6084
|
-
const __vue_module_identifier__$
|
|
6187
|
+
const __vue_module_identifier__$4 = undefined;
|
|
6085
6188
|
/* functional template */
|
|
6086
6189
|
|
|
6087
|
-
const __vue_is_functional_template__$
|
|
6190
|
+
const __vue_is_functional_template__$4 = false;
|
|
6088
6191
|
/* style inject */
|
|
6089
6192
|
|
|
6090
6193
|
/* style inject SSR */
|
|
@@ -6092,123 +6195,820 @@ const __vue_is_functional_template__$3 = false;
|
|
|
6092
6195
|
/* style inject shadow dom */
|
|
6093
6196
|
|
|
6094
6197
|
const __vue_component__$5 = /*#__PURE__*/normalizeComponent({
|
|
6095
|
-
render: __vue_render__$
|
|
6096
|
-
staticRenderFns: __vue_staticRenderFns__$
|
|
6097
|
-
}, __vue_inject_styles__$
|
|
6198
|
+
render: __vue_render__$4,
|
|
6199
|
+
staticRenderFns: __vue_staticRenderFns__$4
|
|
6200
|
+
}, __vue_inject_styles__$4, __vue_script__$4, __vue_scope_id__$4, __vue_is_functional_template__$4, __vue_module_identifier__$4, false, undefined, undefined, undefined);
|
|
6098
6201
|
|
|
6099
6202
|
var DocTemplateFacetList = __vue_component__$5;
|
|
6100
6203
|
|
|
6101
|
-
//
|
|
6102
|
-
var script$2 = {
|
|
6103
|
-
name: 'DocTemplateFieldSidebar',
|
|
6104
|
-
props: {
|
|
6105
|
-
value: {
|
|
6106
|
-
type: Object,
|
|
6107
|
-
default: null
|
|
6108
|
-
},
|
|
6109
|
-
visible: {
|
|
6110
|
-
type: Boolean,
|
|
6111
|
-
default: null
|
|
6112
|
-
}
|
|
6113
|
-
},
|
|
6204
|
+
const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate
|
|
6114
6205
|
|
|
6115
|
-
|
|
6116
|
-
|
|
6117
|
-
|
|
6118
|
-
|
|
6119
|
-
|
|
6120
|
-
|
|
6121
|
-
},
|
|
6206
|
+
let poolPtr = rnds8Pool.length;
|
|
6207
|
+
function rng() {
|
|
6208
|
+
if (poolPtr > rnds8Pool.length - 16) {
|
|
6209
|
+
crypto.randomFillSync(rnds8Pool);
|
|
6210
|
+
poolPtr = 0;
|
|
6211
|
+
}
|
|
6122
6212
|
|
|
6123
|
-
|
|
6124
|
-
|
|
6125
|
-
return this.field ? UtFormConfig.getInputTypes(this.field) : [];
|
|
6126
|
-
},
|
|
6213
|
+
return rnds8Pool.slice(poolPtr, poolPtr += 16);
|
|
6214
|
+
}
|
|
6127
6215
|
|
|
6128
|
-
|
|
6129
|
-
return UtFormConfig.config.icons.iconCloseFieldSidebar;
|
|
6130
|
-
},
|
|
6216
|
+
var REGEX = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;
|
|
6131
6217
|
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
|
|
6218
|
+
function validate(uuid) {
|
|
6219
|
+
return typeof uuid === 'string' && REGEX.test(uuid);
|
|
6220
|
+
}
|
|
6135
6221
|
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
|
|
6139
|
-
|
|
6140
|
-
},
|
|
6222
|
+
/**
|
|
6223
|
+
* Convert array of 16 byte values to UUID string format of the form:
|
|
6224
|
+
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
|
|
6225
|
+
*/
|
|
6141
6226
|
|
|
6142
|
-
|
|
6143
|
-
this.field = this.value;
|
|
6227
|
+
const byteToHex = [];
|
|
6144
6228
|
|
|
6145
|
-
|
|
6146
|
-
|
|
6147
|
-
|
|
6148
|
-
},
|
|
6229
|
+
for (let i = 0; i < 256; ++i) {
|
|
6230
|
+
byteToHex.push((i + 0x100).toString(16).substr(1));
|
|
6231
|
+
}
|
|
6149
6232
|
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6233
|
+
function stringify(arr, offset = 0) {
|
|
6234
|
+
// Note: Be careful editing this code! It's been tuned for performance
|
|
6235
|
+
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
|
|
6236
|
+
const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
|
|
6237
|
+
// of the following:
|
|
6238
|
+
// - One or more input array values don't map to a hex octet (leading to
|
|
6239
|
+
// "undefined" in the uuid)
|
|
6240
|
+
// - Invalid input values for the RFC `version` or `variant` fields
|
|
6241
|
+
|
|
6242
|
+
if (!validate(uuid)) {
|
|
6243
|
+
throw TypeError('Stringified UUID is invalid');
|
|
6244
|
+
}
|
|
6154
6245
|
|
|
6155
|
-
|
|
6156
|
-
|
|
6246
|
+
return uuid;
|
|
6247
|
+
}
|
|
6248
|
+
|
|
6249
|
+
function v4(options, buf, offset) {
|
|
6250
|
+
options = options || {};
|
|
6251
|
+
const rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
|
|
6252
|
+
|
|
6253
|
+
rnds[6] = rnds[6] & 0x0f | 0x40;
|
|
6254
|
+
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
|
|
6255
|
+
|
|
6256
|
+
if (buf) {
|
|
6257
|
+
offset = offset || 0;
|
|
6258
|
+
|
|
6259
|
+
for (let i = 0; i < 16; ++i) {
|
|
6260
|
+
buf[offset + i] = rnds[i];
|
|
6157
6261
|
}
|
|
6158
6262
|
|
|
6159
|
-
|
|
6160
|
-
|
|
6161
|
-
hide() {
|
|
6162
|
-
this.innerVisible = false;
|
|
6163
|
-
this.$emit('hide');
|
|
6164
|
-
},
|
|
6263
|
+
return buf;
|
|
6264
|
+
}
|
|
6165
6265
|
|
|
6166
|
-
|
|
6167
|
-
|
|
6168
|
-
return 'b-form-input';
|
|
6169
|
-
} else {
|
|
6170
|
-
return 'rb-boolean-single-option-input';
|
|
6171
|
-
}
|
|
6172
|
-
},
|
|
6266
|
+
return stringify(rnds);
|
|
6267
|
+
}
|
|
6173
6268
|
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6269
|
+
//
|
|
6270
|
+
var script$3 = {
|
|
6271
|
+
name: 'DocForm',
|
|
6272
|
+
props: {
|
|
6273
|
+
formConfig: Object,
|
|
6274
|
+
applyDefaultValues: {
|
|
6275
|
+
type: Boolean,
|
|
6276
|
+
default: true
|
|
6277
|
+
},
|
|
6278
|
+
doc: {
|
|
6279
|
+
type: Object,
|
|
6280
|
+
default: () => ({})
|
|
6281
|
+
},
|
|
6282
|
+
validationState: {
|
|
6283
|
+
type: Object,
|
|
6284
|
+
default: () => ({})
|
|
6285
|
+
}
|
|
6286
|
+
},
|
|
6287
|
+
methods: {
|
|
6288
|
+
onEventFired(eventName, event, field) {
|
|
6289
|
+
if (field.rules) {
|
|
6290
|
+
field.rules.forEach(rule => {
|
|
6291
|
+
if (rule.event === eventName && rule.script) {
|
|
6292
|
+
let ruleContext = UtFormConstructor.getRuleContext();
|
|
6293
|
+
ruleContext.form = this;
|
|
6294
|
+
ruleContext.event = event;
|
|
6295
|
+
ruleContext.eventName = eventName;
|
|
6296
|
+
UtFormConstructor.runRule(ruleContext, rule.script);
|
|
6297
|
+
}
|
|
6298
|
+
});
|
|
6181
6299
|
}
|
|
6182
6300
|
}
|
|
6183
6301
|
|
|
6184
6302
|
},
|
|
6185
6303
|
|
|
6186
6304
|
created() {
|
|
6187
|
-
this.
|
|
6188
|
-
|
|
6189
|
-
|
|
6190
|
-
|
|
6191
|
-
|
|
6305
|
+
if (this.applyDefaultValues) {
|
|
6306
|
+
this.formConfig.sections.forEach(r => {
|
|
6307
|
+
r.columns.forEach(c => {
|
|
6308
|
+
c.fields.forEach(f => {
|
|
6309
|
+
this.$set(this.doc, f.name, f.defaultValue == null ? null : f.defaultValue);
|
|
6310
|
+
});
|
|
6311
|
+
});
|
|
6312
|
+
});
|
|
6192
6313
|
}
|
|
6193
6314
|
}
|
|
6194
6315
|
|
|
6195
6316
|
};
|
|
6196
6317
|
|
|
6197
6318
|
/* script */
|
|
6198
|
-
const __vue_script__$
|
|
6319
|
+
const __vue_script__$3 = script$3;
|
|
6199
6320
|
/* template */
|
|
6200
6321
|
|
|
6201
|
-
var __vue_render__$
|
|
6322
|
+
var __vue_render__$3 = function () {
|
|
6202
6323
|
var _vm = this;
|
|
6203
6324
|
|
|
6204
6325
|
var _h = _vm.$createElement;
|
|
6205
6326
|
|
|
6206
6327
|
var _c = _vm._self._c || _h;
|
|
6207
6328
|
|
|
6208
|
-
return _c('b-
|
|
6209
|
-
staticClass: "rb-doc-
|
|
6210
|
-
|
|
6211
|
-
|
|
6329
|
+
return _c('b-form', {
|
|
6330
|
+
staticClass: "rb-doc-form"
|
|
6331
|
+
}, _vm._l(_vm.formConfig.sections, function (section) {
|
|
6332
|
+
return _c('div', {
|
|
6333
|
+
key: section.labelRu,
|
|
6334
|
+
staticClass: "rb-form-section"
|
|
6335
|
+
}, [_c('h4', [_vm._v(_vm._s(section.labelRu))]), _vm._v(" "), _c('div', {
|
|
6336
|
+
staticClass: "d-flex flex-row"
|
|
6337
|
+
}, _vm._l(section.columns, function (column) {
|
|
6338
|
+
return _c('div', {
|
|
6339
|
+
key: column.index,
|
|
6340
|
+
staticClass: "rb-form-column"
|
|
6341
|
+
}, [_vm._l(column.fields, function (field) {
|
|
6342
|
+
return [field.visible ? _c('b-form-row', {
|
|
6343
|
+
key: field.name
|
|
6344
|
+
}, [_c('b-col', {
|
|
6345
|
+
attrs: {
|
|
6346
|
+
"lg": "12"
|
|
6347
|
+
}
|
|
6348
|
+
}, [_c('b-form-group', {
|
|
6349
|
+
ref: "inputContainer",
|
|
6350
|
+
refInFor: true,
|
|
6351
|
+
attrs: {
|
|
6352
|
+
"label": field.labelRu
|
|
6353
|
+
}
|
|
6354
|
+
}, [_c(field.input.type, _vm._b({
|
|
6355
|
+
ref: field.name,
|
|
6356
|
+
refInFor: true,
|
|
6357
|
+
tag: "component",
|
|
6358
|
+
attrs: {
|
|
6359
|
+
"disabled": !field.editable,
|
|
6360
|
+
"state": _vm.validationState[field.name]
|
|
6361
|
+
},
|
|
6362
|
+
on: {
|
|
6363
|
+
"input": function ($event) {
|
|
6364
|
+
return _vm.onEventFired('input', $event, field);
|
|
6365
|
+
},
|
|
6366
|
+
"change": function ($event) {
|
|
6367
|
+
return _vm.onEventFired('change', $event, field);
|
|
6368
|
+
},
|
|
6369
|
+
"click": function ($event) {
|
|
6370
|
+
return _vm.onEventFired('click', $event, field);
|
|
6371
|
+
}
|
|
6372
|
+
},
|
|
6373
|
+
model: {
|
|
6374
|
+
value: _vm.doc[field.name],
|
|
6375
|
+
callback: function ($$v) {
|
|
6376
|
+
_vm.$set(_vm.doc, field.name, $$v);
|
|
6377
|
+
},
|
|
6378
|
+
expression: "doc[field.name]"
|
|
6379
|
+
}
|
|
6380
|
+
}, 'component', field.input.propsData, false))], 1)], 1)], 1) : _vm._e()];
|
|
6381
|
+
})], 2);
|
|
6382
|
+
}), 0)]);
|
|
6383
|
+
}), 0);
|
|
6384
|
+
};
|
|
6385
|
+
|
|
6386
|
+
var __vue_staticRenderFns__$3 = [];
|
|
6387
|
+
/* style */
|
|
6388
|
+
|
|
6389
|
+
const __vue_inject_styles__$3 = undefined;
|
|
6390
|
+
/* scoped */
|
|
6391
|
+
|
|
6392
|
+
const __vue_scope_id__$3 = undefined;
|
|
6393
|
+
/* module identifier */
|
|
6394
|
+
|
|
6395
|
+
const __vue_module_identifier__$3 = undefined;
|
|
6396
|
+
/* functional template */
|
|
6397
|
+
|
|
6398
|
+
const __vue_is_functional_template__$3 = false;
|
|
6399
|
+
/* style inject */
|
|
6400
|
+
|
|
6401
|
+
/* style inject SSR */
|
|
6402
|
+
|
|
6403
|
+
/* style inject shadow dom */
|
|
6404
|
+
|
|
6405
|
+
const __vue_component__$4 = /*#__PURE__*/normalizeComponent({
|
|
6406
|
+
render: __vue_render__$3,
|
|
6407
|
+
staticRenderFns: __vue_staticRenderFns__$3
|
|
6408
|
+
}, __vue_inject_styles__$3, __vue_script__$3, __vue_scope_id__$3, __vue_is_functional_template__$3, __vue_module_identifier__$3, false, undefined, undefined, undefined);
|
|
6409
|
+
|
|
6410
|
+
var DocForm = __vue_component__$4;
|
|
6411
|
+
|
|
6412
|
+
//
|
|
6413
|
+
var script$2 = {
|
|
6414
|
+
name: 'FieldRuleFormModal',
|
|
6415
|
+
components: {
|
|
6416
|
+
DocForm
|
|
6417
|
+
},
|
|
6418
|
+
props: {
|
|
6419
|
+
field: Object,
|
|
6420
|
+
rule: Object,
|
|
6421
|
+
formConfig: Object,
|
|
6422
|
+
mode: {
|
|
6423
|
+
type: String,
|
|
6424
|
+
default: 'ins'
|
|
6425
|
+
},
|
|
6426
|
+
onAfterOk: Function
|
|
6427
|
+
},
|
|
6428
|
+
|
|
6429
|
+
data() {
|
|
6430
|
+
return {
|
|
6431
|
+
id: 'rb-field-rule-form-modal',
|
|
6432
|
+
state: this.getDefaultState(),
|
|
6433
|
+
innerFormConfig: null,
|
|
6434
|
+
innerRule: null
|
|
6435
|
+
};
|
|
6436
|
+
},
|
|
6437
|
+
|
|
6438
|
+
computed: {
|
|
6439
|
+
title() {
|
|
6440
|
+
return this.mode === 'ins' ? 'Добавление правила' : 'Редактирование правила';
|
|
6441
|
+
},
|
|
6442
|
+
|
|
6443
|
+
fields() {
|
|
6444
|
+
return UtFormConfig.getFields(this.formConfig);
|
|
6445
|
+
},
|
|
6446
|
+
|
|
6447
|
+
rulePresets() {
|
|
6448
|
+
return UtFormConstructor.getAvailableFieldRules(this.field);
|
|
6449
|
+
}
|
|
6450
|
+
|
|
6451
|
+
},
|
|
6452
|
+
watch: {
|
|
6453
|
+
formConfig() {
|
|
6454
|
+
this.copyToInnerFormConfig();
|
|
6455
|
+
},
|
|
6456
|
+
|
|
6457
|
+
rule() {
|
|
6458
|
+
if (this.rule) {
|
|
6459
|
+
this.innerRule = this.rule;
|
|
6460
|
+
} else {
|
|
6461
|
+
this.innerRule = this.getDefaultRule();
|
|
6462
|
+
}
|
|
6463
|
+
}
|
|
6464
|
+
|
|
6465
|
+
},
|
|
6466
|
+
methods: {
|
|
6467
|
+
validateFields(fieldName) {
|
|
6468
|
+
let fields = fieldName ? [fieldName] : ['name', 'event', 'script'];
|
|
6469
|
+
fields.forEach(field => {
|
|
6470
|
+
if (!this.innerRule[field]) {
|
|
6471
|
+
this.state[field] = false;
|
|
6472
|
+
this.state[`${field}_feedback`] = 'Заполните название';
|
|
6473
|
+
} else {
|
|
6474
|
+
this.state[field] = true;
|
|
6475
|
+
this.state[`${field}_feedback`] = null;
|
|
6476
|
+
}
|
|
6477
|
+
});
|
|
6478
|
+
},
|
|
6479
|
+
|
|
6480
|
+
copyToInnerFormConfig() {
|
|
6481
|
+
this.innerFormConfig = JSON.parse(JSON.stringify(this.formConfig));
|
|
6482
|
+
},
|
|
6483
|
+
|
|
6484
|
+
applyRuleToInnerFormConfig() {
|
|
6485
|
+
if (this.innerFormConfig) {
|
|
6486
|
+
let foundRule = UtFormConfig.findRule(this.innerRule.id, this.innerFormConfig);
|
|
6487
|
+
|
|
6488
|
+
if (!foundRule) {
|
|
6489
|
+
let foundField = UtFormConfig.findField(this.field.name, this.innerFormConfig);
|
|
6490
|
+
|
|
6491
|
+
if (foundField) {
|
|
6492
|
+
foundField.rules = foundField.rules ? foundField.rules : [];
|
|
6493
|
+
foundField.rules.push(this.rule);
|
|
6494
|
+
}
|
|
6495
|
+
} else {
|
|
6496
|
+
Object.assign(foundRule, this.innerRule);
|
|
6497
|
+
}
|
|
6498
|
+
}
|
|
6499
|
+
},
|
|
6500
|
+
|
|
6501
|
+
onActivateTab(index) {
|
|
6502
|
+
if (index > 0) {
|
|
6503
|
+
this.copyToInnerFormConfig();
|
|
6504
|
+
this.applyRuleToInnerFormConfig();
|
|
6505
|
+
}
|
|
6506
|
+
},
|
|
6507
|
+
|
|
6508
|
+
getDefaultState() {
|
|
6509
|
+
return {
|
|
6510
|
+
name: null,
|
|
6511
|
+
event: null,
|
|
6512
|
+
script: null
|
|
6513
|
+
};
|
|
6514
|
+
},
|
|
6515
|
+
|
|
6516
|
+
getDefaultRule() {
|
|
6517
|
+
return {
|
|
6518
|
+
id: v4(),
|
|
6519
|
+
name: null,
|
|
6520
|
+
event: null,
|
|
6521
|
+
script: null
|
|
6522
|
+
};
|
|
6523
|
+
},
|
|
6524
|
+
|
|
6525
|
+
resetModal() {
|
|
6526
|
+
this.state = this.getDefaultState();
|
|
6527
|
+
this.innerRule = null;
|
|
6528
|
+
},
|
|
6529
|
+
|
|
6530
|
+
addVariableToScript(varName) {
|
|
6531
|
+
let r = this.innerRule;
|
|
6532
|
+
r.script = r.script ? r.script + varName : varName;
|
|
6533
|
+
},
|
|
6534
|
+
|
|
6535
|
+
addSetVariableToScript(field) {
|
|
6536
|
+
let r = this.innerRule;
|
|
6537
|
+
let setVariableScript = `doc['${field.name}'] = Значение;`;
|
|
6538
|
+
r.script = r.script ? r.script + setVariableScript : setVariableScript;
|
|
6539
|
+
},
|
|
6540
|
+
|
|
6541
|
+
addCallInputFunction(field) {
|
|
6542
|
+
let r = this.innerRule;
|
|
6543
|
+
let setVariableScript = `form.$refs['${field.name}'].Название функции();`;
|
|
6544
|
+
r.script = r.script ? r.script + setVariableScript : setVariableScript;
|
|
6545
|
+
},
|
|
6546
|
+
|
|
6547
|
+
onRuleSelected(ruleName) {
|
|
6548
|
+
let rule = this.rulePresets.find(rule => rule.name === ruleName);
|
|
6549
|
+
|
|
6550
|
+
if (rule) {
|
|
6551
|
+
Object.assign(this.innerRule, rule);
|
|
6552
|
+
this.innerRule.script = this.innerRule.script.trim();
|
|
6553
|
+
}
|
|
6554
|
+
},
|
|
6555
|
+
|
|
6556
|
+
onOk() {
|
|
6557
|
+
this.validateFields();
|
|
6558
|
+
|
|
6559
|
+
if (this.state.name && this.state.script) {
|
|
6560
|
+
if (this.onAfterOk) {
|
|
6561
|
+
this.onAfterOk(this.innerRule);
|
|
6562
|
+
}
|
|
6563
|
+
|
|
6564
|
+
this.$nextTick(() => {
|
|
6565
|
+
this.resetModal();
|
|
6566
|
+
this.$bvModal.hide(this.id);
|
|
6567
|
+
});
|
|
6568
|
+
}
|
|
6569
|
+
}
|
|
6570
|
+
|
|
6571
|
+
},
|
|
6572
|
+
|
|
6573
|
+
created() {
|
|
6574
|
+
this.copyToInnerFormConfig();
|
|
6575
|
+
}
|
|
6576
|
+
|
|
6577
|
+
};
|
|
6578
|
+
|
|
6579
|
+
/* script */
|
|
6580
|
+
const __vue_script__$2 = script$2;
|
|
6581
|
+
/* template */
|
|
6582
|
+
|
|
6583
|
+
var __vue_render__$2 = function () {
|
|
6584
|
+
var _vm = this;
|
|
6585
|
+
|
|
6586
|
+
var _h = _vm.$createElement;
|
|
6587
|
+
|
|
6588
|
+
var _c = _vm._self._c || _h;
|
|
6589
|
+
|
|
6590
|
+
return _c('b-modal', {
|
|
6591
|
+
attrs: {
|
|
6592
|
+
"id": _vm.id,
|
|
6593
|
+
"title": _vm.title,
|
|
6594
|
+
"modal-class": "rb-field-rule-form-modal",
|
|
6595
|
+
"size": "lg",
|
|
6596
|
+
"ok-title": "Сохранить правило",
|
|
6597
|
+
"cancel-variant": "outline-gray",
|
|
6598
|
+
"cancel-title": "Отмена"
|
|
6599
|
+
},
|
|
6600
|
+
on: {
|
|
6601
|
+
"ok": function ($event) {
|
|
6602
|
+
$event.preventDefault();
|
|
6603
|
+
return _vm.onOk.apply(null, arguments);
|
|
6604
|
+
}
|
|
6605
|
+
}
|
|
6606
|
+
}, [_c('b-card', {
|
|
6607
|
+
attrs: {
|
|
6608
|
+
"no-body": ""
|
|
6609
|
+
}
|
|
6610
|
+
}, [_c('b-tabs', {
|
|
6611
|
+
attrs: {
|
|
6612
|
+
"card": ""
|
|
6613
|
+
},
|
|
6614
|
+
on: {
|
|
6615
|
+
"activate-tab": _vm.onActivateTab
|
|
6616
|
+
}
|
|
6617
|
+
}, [_c('b-tab', {
|
|
6618
|
+
attrs: {
|
|
6619
|
+
"title": "Правило",
|
|
6620
|
+
"active": ""
|
|
6621
|
+
}
|
|
6622
|
+
}, [_vm.innerRule ? _c('b-form', [_c('b-form-row', [_c('b-col', {
|
|
6623
|
+
attrs: {
|
|
6624
|
+
"log": "12"
|
|
6625
|
+
}
|
|
6626
|
+
}, [_vm.rulePresets.length > 0 ? _c('b-form-group', {
|
|
6627
|
+
attrs: {
|
|
6628
|
+
"label": "Выбрать"
|
|
6629
|
+
},
|
|
6630
|
+
scopedSlots: _vm._u([{
|
|
6631
|
+
key: "description",
|
|
6632
|
+
fn: function () {
|
|
6633
|
+
return [_vm._v("\n Выберите готовое правило из списка и если нужно, измените\n ")];
|
|
6634
|
+
},
|
|
6635
|
+
proxy: true
|
|
6636
|
+
}], null, false, 3419583775)
|
|
6637
|
+
}, [_vm._v(" "), _c('b-form-select', {
|
|
6638
|
+
on: {
|
|
6639
|
+
"input": function ($event) {
|
|
6640
|
+
return _vm.onRuleSelected($event);
|
|
6641
|
+
}
|
|
6642
|
+
}
|
|
6643
|
+
}, _vm._l(_vm.rulePresets, function (r) {
|
|
6644
|
+
return _c('b-form-select-option', {
|
|
6645
|
+
key: r.name,
|
|
6646
|
+
attrs: {
|
|
6647
|
+
"value": r.name
|
|
6648
|
+
}
|
|
6649
|
+
}, [_vm._v("\n " + _vm._s(r.name) + "\n ")]);
|
|
6650
|
+
}), 1)], 1) : _vm._e()], 1), _vm._v(" "), _c('b-col', {
|
|
6651
|
+
attrs: {
|
|
6652
|
+
"lg": "12"
|
|
6653
|
+
}
|
|
6654
|
+
}, [_c('b-form-group', {
|
|
6655
|
+
attrs: {
|
|
6656
|
+
"label": "Название"
|
|
6657
|
+
},
|
|
6658
|
+
scopedSlots: _vm._u([{
|
|
6659
|
+
key: "description",
|
|
6660
|
+
fn: function () {
|
|
6661
|
+
return [_vm._v("\n Задайте уникальное название, чтобы отличать правило в списке\n ")];
|
|
6662
|
+
},
|
|
6663
|
+
proxy: true
|
|
6664
|
+
}], null, false, 3665649506)
|
|
6665
|
+
}, [_vm._v(" "), _c('b-form-input', {
|
|
6666
|
+
attrs: {
|
|
6667
|
+
"state": _vm.state.name,
|
|
6668
|
+
"invalid-feedback": _vm.state.name_feedback
|
|
6669
|
+
},
|
|
6670
|
+
model: {
|
|
6671
|
+
value: _vm.innerRule.name,
|
|
6672
|
+
callback: function ($$v) {
|
|
6673
|
+
_vm.$set(_vm.innerRule, "name", $$v);
|
|
6674
|
+
},
|
|
6675
|
+
expression: "innerRule.name"
|
|
6676
|
+
}
|
|
6677
|
+
})], 1)], 1), _vm._v(" "), _c('b-col', {
|
|
6678
|
+
attrs: {
|
|
6679
|
+
"lg": "12"
|
|
6680
|
+
}
|
|
6681
|
+
}, [_c('b-form-group', {
|
|
6682
|
+
attrs: {
|
|
6683
|
+
"label": "Событие"
|
|
6684
|
+
},
|
|
6685
|
+
scopedSlots: _vm._u([{
|
|
6686
|
+
key: "description",
|
|
6687
|
+
fn: function () {
|
|
6688
|
+
return [_vm._v("\n При возникновении этого события будет выполняться правило\n ")];
|
|
6689
|
+
},
|
|
6690
|
+
proxy: true
|
|
6691
|
+
}], null, false, 1461632685)
|
|
6692
|
+
}, [_vm._v(" "), _c('b-form-select', {
|
|
6693
|
+
attrs: {
|
|
6694
|
+
"state": _vm.state.event,
|
|
6695
|
+
"invalid-feedback": _vm.state.event_feedback
|
|
6696
|
+
},
|
|
6697
|
+
model: {
|
|
6698
|
+
value: _vm.innerRule.event,
|
|
6699
|
+
callback: function ($$v) {
|
|
6700
|
+
_vm.$set(_vm.innerRule, "event", $$v);
|
|
6701
|
+
},
|
|
6702
|
+
expression: "innerRule.event"
|
|
6703
|
+
}
|
|
6704
|
+
}, [_c('b-form-select-option', {
|
|
6705
|
+
attrs: {
|
|
6706
|
+
"value": 'input'
|
|
6707
|
+
}
|
|
6708
|
+
}, [_vm._v("\n Ввод значения\n ")]), _vm._v(" "), _c('b-form-select-option', {
|
|
6709
|
+
attrs: {
|
|
6710
|
+
"value": 'change'
|
|
6711
|
+
}
|
|
6712
|
+
}, [_vm._v("\n Изменение значения\n ")]), _vm._v(" "), _c('b-form-select-option', {
|
|
6713
|
+
attrs: {
|
|
6714
|
+
"value": 'click'
|
|
6715
|
+
}
|
|
6716
|
+
}, [_vm._v("\n Клик\n ")])], 1)], 1)], 1), _vm._v(" "), _c('b-col', {
|
|
6717
|
+
attrs: {
|
|
6718
|
+
"lg": "12"
|
|
6719
|
+
}
|
|
6720
|
+
}, [_c('b-form-group', {
|
|
6721
|
+
attrs: {
|
|
6722
|
+
"label": "Скрипт"
|
|
6723
|
+
},
|
|
6724
|
+
scopedSlots: _vm._u([{
|
|
6725
|
+
key: "description",
|
|
6726
|
+
fn: function () {
|
|
6727
|
+
return [_vm._v("\n Здесь указывается скрипт правила. Скрипт должен быть написан на языке\n javascript\n ")];
|
|
6728
|
+
},
|
|
6729
|
+
proxy: true
|
|
6730
|
+
}], null, false, 2031959747)
|
|
6731
|
+
}, [_vm._v(" "), _c('div', {
|
|
6732
|
+
staticClass: "rb-script-input"
|
|
6733
|
+
}, [_c('b-button-toolbar', [_c('b-dropdown', {
|
|
6734
|
+
staticClass: "mx-1",
|
|
6735
|
+
attrs: {
|
|
6736
|
+
"text": "Переменные",
|
|
6737
|
+
"variant": "outline-secondary",
|
|
6738
|
+
"size": "sm"
|
|
6739
|
+
}
|
|
6740
|
+
}, [_c('b-dropdown-item', {
|
|
6741
|
+
on: {
|
|
6742
|
+
"click": function ($event) {
|
|
6743
|
+
return _vm.addVariableToScript('doc');
|
|
6744
|
+
}
|
|
6745
|
+
}
|
|
6746
|
+
}, [_vm._v("\n Документ\n ")]), _vm._v(" "), _c('b-dropdown-item', {
|
|
6747
|
+
on: {
|
|
6748
|
+
"click": function ($event) {
|
|
6749
|
+
return _vm.addVariableToScript('form');
|
|
6750
|
+
}
|
|
6751
|
+
}
|
|
6752
|
+
}, [_vm._v("\n Форма\n ")]), _vm._v(" "), _c('b-dropdown-item', {
|
|
6753
|
+
on: {
|
|
6754
|
+
"click": function ($event) {
|
|
6755
|
+
return _vm.addVariableToScript('event');
|
|
6756
|
+
}
|
|
6757
|
+
}
|
|
6758
|
+
}, [_vm._v("\n Значение события\n ")])], 1), _vm._v(" "), _c('b-dropdown', {
|
|
6759
|
+
staticClass: "mx-1",
|
|
6760
|
+
attrs: {
|
|
6761
|
+
"text": "Задать значение",
|
|
6762
|
+
"variant": "outline-secondary",
|
|
6763
|
+
"size": "sm"
|
|
6764
|
+
}
|
|
6765
|
+
}, _vm._l(_vm.fields, function (f) {
|
|
6766
|
+
return _vm.fields ? _c('b-dropdown-item', {
|
|
6767
|
+
key: f.name,
|
|
6768
|
+
on: {
|
|
6769
|
+
"click": function ($event) {
|
|
6770
|
+
return _vm.addSetVariableToScript(f);
|
|
6771
|
+
}
|
|
6772
|
+
}
|
|
6773
|
+
}, [_vm._v("\n " + _vm._s(f.name) + "\n ")]) : _vm._e();
|
|
6774
|
+
}), 1), _vm._v(" "), _c('b-dropdown', {
|
|
6775
|
+
staticClass: "mx-1",
|
|
6776
|
+
attrs: {
|
|
6777
|
+
"text": "Вызвать функцию инпута",
|
|
6778
|
+
"variant": "outline-secondary",
|
|
6779
|
+
"size": "sm"
|
|
6780
|
+
}
|
|
6781
|
+
}, _vm._l(_vm.fields, function (f) {
|
|
6782
|
+
return _vm.fields ? _c('b-dropdown-item', {
|
|
6783
|
+
key: f.name,
|
|
6784
|
+
on: {
|
|
6785
|
+
"click": function ($event) {
|
|
6786
|
+
return _vm.addCallInputFunction(f);
|
|
6787
|
+
}
|
|
6788
|
+
}
|
|
6789
|
+
}, [_vm._v("\n " + _vm._s(f.name) + "\n ")]) : _vm._e();
|
|
6790
|
+
}), 1)], 1), _vm._v(" "), _c('b-form-textarea', {
|
|
6791
|
+
attrs: {
|
|
6792
|
+
"state": _vm.state.script,
|
|
6793
|
+
"invalid-feedback": _vm.state.script_feedback,
|
|
6794
|
+
"rows": "8"
|
|
6795
|
+
},
|
|
6796
|
+
model: {
|
|
6797
|
+
value: _vm.innerRule.script,
|
|
6798
|
+
callback: function ($$v) {
|
|
6799
|
+
_vm.$set(_vm.innerRule, "script", $$v);
|
|
6800
|
+
},
|
|
6801
|
+
expression: "innerRule.script"
|
|
6802
|
+
}
|
|
6803
|
+
})], 1)])], 1)], 1)], 1) : _vm._e()], 1), _vm._v(" "), _vm.innerFormConfig ? _c('b-tab', {
|
|
6804
|
+
attrs: {
|
|
6805
|
+
"title": "Протестировать правило"
|
|
6806
|
+
}
|
|
6807
|
+
}, [_c('doc-form', {
|
|
6808
|
+
attrs: {
|
|
6809
|
+
"form-config": _vm.innerFormConfig
|
|
6810
|
+
}
|
|
6811
|
+
})], 1) : _vm._e()], 1)], 1)], 1);
|
|
6812
|
+
};
|
|
6813
|
+
|
|
6814
|
+
var __vue_staticRenderFns__$2 = [];
|
|
6815
|
+
/* style */
|
|
6816
|
+
|
|
6817
|
+
const __vue_inject_styles__$2 = undefined;
|
|
6818
|
+
/* scoped */
|
|
6819
|
+
|
|
6820
|
+
const __vue_scope_id__$2 = undefined;
|
|
6821
|
+
/* module identifier */
|
|
6822
|
+
|
|
6823
|
+
const __vue_module_identifier__$2 = undefined;
|
|
6824
|
+
/* functional template */
|
|
6825
|
+
|
|
6826
|
+
const __vue_is_functional_template__$2 = false;
|
|
6827
|
+
/* style inject */
|
|
6828
|
+
|
|
6829
|
+
/* style inject SSR */
|
|
6830
|
+
|
|
6831
|
+
/* style inject shadow dom */
|
|
6832
|
+
|
|
6833
|
+
const __vue_component__$3 = /*#__PURE__*/normalizeComponent({
|
|
6834
|
+
render: __vue_render__$2,
|
|
6835
|
+
staticRenderFns: __vue_staticRenderFns__$2
|
|
6836
|
+
}, __vue_inject_styles__$2, __vue_script__$2, __vue_scope_id__$2, __vue_is_functional_template__$2, __vue_module_identifier__$2, false, undefined, undefined, undefined);
|
|
6837
|
+
|
|
6838
|
+
var FieldRuleFormModal = __vue_component__$3;
|
|
6839
|
+
|
|
6840
|
+
//
|
|
6841
|
+
var script$1 = {
|
|
6842
|
+
name: 'DocTemplateFieldSidebar',
|
|
6843
|
+
components: {
|
|
6844
|
+
FieldRuleFormModal
|
|
6845
|
+
},
|
|
6846
|
+
props: {
|
|
6847
|
+
value: {
|
|
6848
|
+
type: Object,
|
|
6849
|
+
default: null
|
|
6850
|
+
},
|
|
6851
|
+
visible: {
|
|
6852
|
+
type: Boolean,
|
|
6853
|
+
default: null
|
|
6854
|
+
},
|
|
6855
|
+
formConfig: Object
|
|
6856
|
+
},
|
|
6857
|
+
|
|
6858
|
+
data() {
|
|
6859
|
+
return {
|
|
6860
|
+
innerVisible: null,
|
|
6861
|
+
field: null,
|
|
6862
|
+
currentInputName: null,
|
|
6863
|
+
modalId: 'rb-field-rule-form-modal',
|
|
6864
|
+
ruleModalCfg: {
|
|
6865
|
+
rule: {},
|
|
6866
|
+
mode: 'ins'
|
|
6867
|
+
},
|
|
6868
|
+
rulesHash: v4()
|
|
6869
|
+
};
|
|
6870
|
+
},
|
|
6871
|
+
|
|
6872
|
+
computed: {
|
|
6873
|
+
inputOptions() {
|
|
6874
|
+
return this.field ? UtFormConstructor.getInputTypes(this.field) : [];
|
|
6875
|
+
},
|
|
6876
|
+
|
|
6877
|
+
iconCloseSidebar() {
|
|
6878
|
+
return UtFormConstructor.config.icons.iconCloseFieldSidebar;
|
|
6879
|
+
},
|
|
6880
|
+
|
|
6881
|
+
iconOpenSidebar() {
|
|
6882
|
+
return UtFormConstructor.config.icons.iconOpenFieldSidebar;
|
|
6883
|
+
},
|
|
6884
|
+
|
|
6885
|
+
iconAdd() {
|
|
6886
|
+
return UtFormConstructor.config.icons.iconAdd;
|
|
6887
|
+
},
|
|
6888
|
+
|
|
6889
|
+
rules() {
|
|
6890
|
+
return UtFormConstructor.getAvailableFieldRules(this.field);
|
|
6891
|
+
}
|
|
6892
|
+
|
|
6893
|
+
},
|
|
6894
|
+
watch: {
|
|
6895
|
+
visible() {
|
|
6896
|
+
this.innerVisible = this.visible;
|
|
6897
|
+
},
|
|
6898
|
+
|
|
6899
|
+
value() {
|
|
6900
|
+
this.field = this.value;
|
|
6901
|
+
|
|
6902
|
+
if (this.field && this.field.input) {
|
|
6903
|
+
this.currentInputName = this.field.input.name;
|
|
6904
|
+
}
|
|
6905
|
+
},
|
|
6906
|
+
|
|
6907
|
+
field() {
|
|
6908
|
+
this.$emit('input', this.field);
|
|
6909
|
+
this.$emit('change', this.field);
|
|
6910
|
+
},
|
|
6911
|
+
|
|
6912
|
+
currentInputName() {
|
|
6913
|
+
this.field.input = UtFormConstructor.getInputTypeByName(this.currentInputName, this.field);
|
|
6914
|
+
}
|
|
6915
|
+
|
|
6916
|
+
},
|
|
6917
|
+
methods: {
|
|
6918
|
+
hide() {
|
|
6919
|
+
this.innerVisible = false;
|
|
6920
|
+
this.$emit('hide');
|
|
6921
|
+
},
|
|
6922
|
+
|
|
6923
|
+
getPropInputType(prop, propName) {
|
|
6924
|
+
if (prop.type === 'string') {
|
|
6925
|
+
return 'b-form-input';
|
|
6926
|
+
} else {
|
|
6927
|
+
return 'rb-boolean-single-option-input';
|
|
6928
|
+
}
|
|
6929
|
+
},
|
|
6930
|
+
|
|
6931
|
+
getPropInputPropData(prop, propName) {
|
|
6932
|
+
if (prop.type === 'string') {
|
|
6933
|
+
return {
|
|
6934
|
+
type: 'text'
|
|
6935
|
+
};
|
|
6936
|
+
} else {
|
|
6937
|
+
return {};
|
|
6938
|
+
}
|
|
6939
|
+
},
|
|
6940
|
+
|
|
6941
|
+
addRule() {
|
|
6942
|
+
this.ruleModalCfg = {
|
|
6943
|
+
mode: 'ins',
|
|
6944
|
+
rule: {
|
|
6945
|
+
name: null,
|
|
6946
|
+
script: null
|
|
6947
|
+
},
|
|
6948
|
+
onAfterOk: rule => {
|
|
6949
|
+
this.field.rules = this.field.rules ? this.field.rules : [];
|
|
6950
|
+
this.field.rules.push({ ...rule
|
|
6951
|
+
});
|
|
6952
|
+
this.rulesHash = v4();
|
|
6953
|
+
}
|
|
6954
|
+
};
|
|
6955
|
+
this.$bvModal.show(this.modalId);
|
|
6956
|
+
},
|
|
6957
|
+
|
|
6958
|
+
editRule(rule, event) {
|
|
6959
|
+
if (event.target.classList && event.target.classList.contains('rb-remove-rule')) {
|
|
6960
|
+
return;
|
|
6961
|
+
}
|
|
6962
|
+
|
|
6963
|
+
this.ruleModalCfg = {
|
|
6964
|
+
mode: 'upd',
|
|
6965
|
+
rule: { ...rule
|
|
6966
|
+
},
|
|
6967
|
+
onAfterOk: modalRule => {
|
|
6968
|
+
Object.assign(rule, modalRule);
|
|
6969
|
+
}
|
|
6970
|
+
};
|
|
6971
|
+
this.$bvModal.show(this.modalId);
|
|
6972
|
+
},
|
|
6973
|
+
|
|
6974
|
+
removeRule(rule) {
|
|
6975
|
+
let index = this.field.rules.findIndex(r => r.id === rule.id);
|
|
6976
|
+
|
|
6977
|
+
if (index >= 0) {
|
|
6978
|
+
this.field.rules.splice(index, 1);
|
|
6979
|
+
}
|
|
6980
|
+
|
|
6981
|
+
this.rulesHash = v4();
|
|
6982
|
+
}
|
|
6983
|
+
|
|
6984
|
+
},
|
|
6985
|
+
|
|
6986
|
+
created() {
|
|
6987
|
+
this.innerVisible = this.visible;
|
|
6988
|
+
this.field = this.value;
|
|
6989
|
+
|
|
6990
|
+
if (this.field && this.field.input) {
|
|
6991
|
+
this.currentInputName = this.field.input.name;
|
|
6992
|
+
}
|
|
6993
|
+
}
|
|
6994
|
+
|
|
6995
|
+
};
|
|
6996
|
+
|
|
6997
|
+
/* script */
|
|
6998
|
+
const __vue_script__$1 = script$1;
|
|
6999
|
+
/* template */
|
|
7000
|
+
|
|
7001
|
+
var __vue_render__$1 = function () {
|
|
7002
|
+
var _vm = this;
|
|
7003
|
+
|
|
7004
|
+
var _h = _vm.$createElement;
|
|
7005
|
+
|
|
7006
|
+
var _c = _vm._self._c || _h;
|
|
7007
|
+
|
|
7008
|
+
return _c('b-sidebar', {
|
|
7009
|
+
staticClass: "rb-doc-template-field-sidebar",
|
|
7010
|
+
attrs: {
|
|
7011
|
+
"right": "",
|
|
6212
7012
|
"bg-variant": "white",
|
|
6213
7013
|
"shadow": ""
|
|
6214
7014
|
},
|
|
@@ -6389,7 +7189,7 @@ var __vue_render__$2 = function () {
|
|
|
6389
7189
|
staticClass: "rb-form-section"
|
|
6390
7190
|
}, [_c('div', {
|
|
6391
7191
|
staticClass: "rb-title"
|
|
6392
|
-
}, [_vm._v("
|
|
7192
|
+
}, [_vm._v("Значение по-умолчанию")]), _vm._v(" "), _c('b-form-row', [_c('b-col', {
|
|
6393
7193
|
attrs: {
|
|
6394
7194
|
"lg": "12"
|
|
6395
7195
|
}
|
|
@@ -6407,37 +7207,85 @@ var __vue_render__$2 = function () {
|
|
|
6407
7207
|
},
|
|
6408
7208
|
expression: "field.defaultValue"
|
|
6409
7209
|
}
|
|
6410
|
-
}, 'component', _vm.field.input.propsData, false))], 1)], 1)], 1)], 1) : _vm._e()
|
|
7210
|
+
}, 'component', _vm.field.input.propsData, false))], 1)], 1)], 1)], 1) : _vm._e(), _vm._v(" "), _c('div', {
|
|
7211
|
+
staticClass: "rb-form-section"
|
|
7212
|
+
}, [_c('div', {
|
|
7213
|
+
staticClass: "rb-title"
|
|
7214
|
+
}, [_vm._v("Правила")]), _vm._v(" "), _c('b-list-group', {
|
|
7215
|
+
attrs: {
|
|
7216
|
+
"data-hash": _vm.rulesHash
|
|
7217
|
+
}
|
|
7218
|
+
}, [_vm._l(_vm.field.rules, function (rule) {
|
|
7219
|
+
return _c('b-list-group-item', {
|
|
7220
|
+
key: rule.id,
|
|
7221
|
+
staticClass: "cursor-pointer d-flex justify-content-between align-items-center",
|
|
7222
|
+
attrs: {
|
|
7223
|
+
"data-hash": _vm.rulesHash
|
|
7224
|
+
},
|
|
7225
|
+
on: {
|
|
7226
|
+
"click": function ($event) {
|
|
7227
|
+
return _vm.editRule(rule, $event);
|
|
7228
|
+
}
|
|
7229
|
+
}
|
|
7230
|
+
}, [_c('rb-text', [_vm._v(_vm._s(rule.name))]), _vm._v(" "), _c('rb-icon', {
|
|
7231
|
+
staticClass: "rb-remove-rule",
|
|
7232
|
+
attrs: {
|
|
7233
|
+
"icon": "icon-close"
|
|
7234
|
+
},
|
|
7235
|
+
on: {
|
|
7236
|
+
"click": function ($event) {
|
|
7237
|
+
return _vm.removeRule(rule);
|
|
7238
|
+
}
|
|
7239
|
+
}
|
|
7240
|
+
})], 1);
|
|
7241
|
+
}), _vm._v(" "), _c('b-list-group-item', {
|
|
7242
|
+
staticClass: "cursor-pointer",
|
|
7243
|
+
on: {
|
|
7244
|
+
"click": _vm.addRule
|
|
7245
|
+
}
|
|
7246
|
+
}, [_c('rb-icon', {
|
|
7247
|
+
attrs: {
|
|
7248
|
+
"icon": _vm.iconAdd
|
|
7249
|
+
}
|
|
7250
|
+
}), _vm._v(" "), _c('rb-text', [_vm._v("Добавить правило ...")])], 1)], 2)], 1)]) : _vm._e(), _vm._v(" "), _c('field-rule-form-modal', {
|
|
7251
|
+
attrs: {
|
|
7252
|
+
"rule": _vm.ruleModalCfg.rule,
|
|
7253
|
+
"form-config": _vm.formConfig,
|
|
7254
|
+
"field": _vm.field,
|
|
7255
|
+
"mode": _vm.ruleModalCfg.mode,
|
|
7256
|
+
"on-after-ok": _vm.ruleModalCfg.onAfterOk
|
|
7257
|
+
}
|
|
7258
|
+
})], 1);
|
|
6411
7259
|
};
|
|
6412
7260
|
|
|
6413
|
-
var __vue_staticRenderFns__$
|
|
7261
|
+
var __vue_staticRenderFns__$1 = [];
|
|
6414
7262
|
/* style */
|
|
6415
7263
|
|
|
6416
|
-
const __vue_inject_styles__$
|
|
7264
|
+
const __vue_inject_styles__$1 = undefined;
|
|
6417
7265
|
/* scoped */
|
|
6418
7266
|
|
|
6419
|
-
const __vue_scope_id__$
|
|
7267
|
+
const __vue_scope_id__$1 = undefined;
|
|
6420
7268
|
/* module identifier */
|
|
6421
7269
|
|
|
6422
|
-
const __vue_module_identifier__$
|
|
7270
|
+
const __vue_module_identifier__$1 = undefined;
|
|
6423
7271
|
/* functional template */
|
|
6424
7272
|
|
|
6425
|
-
const __vue_is_functional_template__$
|
|
7273
|
+
const __vue_is_functional_template__$1 = false;
|
|
6426
7274
|
/* style inject */
|
|
6427
7275
|
|
|
6428
7276
|
/* style inject SSR */
|
|
6429
7277
|
|
|
6430
7278
|
/* style inject shadow dom */
|
|
6431
7279
|
|
|
6432
|
-
const __vue_component__$
|
|
6433
|
-
render: __vue_render__$
|
|
6434
|
-
staticRenderFns: __vue_staticRenderFns__$
|
|
6435
|
-
}, __vue_inject_styles__$
|
|
7280
|
+
const __vue_component__$2 = /*#__PURE__*/normalizeComponent({
|
|
7281
|
+
render: __vue_render__$1,
|
|
7282
|
+
staticRenderFns: __vue_staticRenderFns__$1
|
|
7283
|
+
}, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, undefined, undefined, undefined);
|
|
6436
7284
|
|
|
6437
|
-
var DocTemplateFieldSidebar = __vue_component__$
|
|
7285
|
+
var DocTemplateFieldSidebar = __vue_component__$2;
|
|
6438
7286
|
|
|
6439
7287
|
//
|
|
6440
|
-
var script
|
|
7288
|
+
var script = {
|
|
6441
7289
|
name: 'DocTemplateConstructor',
|
|
6442
7290
|
components: {
|
|
6443
7291
|
DocTemplateFacetList,
|
|
@@ -6479,24 +7327,28 @@ var script$1 = {
|
|
|
6479
7327
|
|
|
6480
7328
|
computed: {
|
|
6481
7329
|
iconAdd() {
|
|
6482
|
-
return
|
|
7330
|
+
return UtFormConstructor.config.icons.iconAdd;
|
|
6483
7331
|
},
|
|
6484
7332
|
|
|
6485
7333
|
iconEdit() {
|
|
6486
|
-
return
|
|
7334
|
+
return UtFormConstructor.config.icons.iconEdit;
|
|
6487
7335
|
},
|
|
6488
7336
|
|
|
6489
7337
|
iconDelete() {
|
|
6490
|
-
return
|
|
7338
|
+
return UtFormConstructor.config.icons.iconDelete;
|
|
6491
7339
|
},
|
|
6492
7340
|
|
|
6493
7341
|
iconDrag() {
|
|
6494
|
-
return
|
|
7342
|
+
return UtFormConstructor.config.icons.iconDrag;
|
|
6495
7343
|
}
|
|
6496
7344
|
|
|
6497
7345
|
},
|
|
6498
7346
|
methods: {
|
|
6499
|
-
showProperties(field) {
|
|
7347
|
+
showProperties(field, event) {
|
|
7348
|
+
if (event.target.classList && event.target.classList.contains('rb-remove-field')) {
|
|
7349
|
+
return;
|
|
7350
|
+
}
|
|
7351
|
+
|
|
6500
7352
|
this.sidebarVisible = true;
|
|
6501
7353
|
this.sidebarField = field;
|
|
6502
7354
|
},
|
|
@@ -6570,12 +7422,7 @@ var script$1 = {
|
|
|
6570
7422
|
let index = newIndex != null ? newIndex : -1;
|
|
6571
7423
|
|
|
6572
7424
|
if (index < 0) {
|
|
6573
|
-
column.fields.
|
|
6574
|
-
if (field.name === f.name) {
|
|
6575
|
-
index = i;
|
|
6576
|
-
return false;
|
|
6577
|
-
}
|
|
6578
|
-
});
|
|
7425
|
+
index = column.fields.findIndex(f => field.name === f.name);
|
|
6579
7426
|
}
|
|
6580
7427
|
|
|
6581
7428
|
if (index >= 0) {
|
|
@@ -6632,10 +7479,10 @@ var script$1 = {
|
|
|
6632
7479
|
};
|
|
6633
7480
|
|
|
6634
7481
|
/* script */
|
|
6635
|
-
const __vue_script__
|
|
7482
|
+
const __vue_script__ = script;
|
|
6636
7483
|
/* template */
|
|
6637
7484
|
|
|
6638
|
-
var __vue_render__
|
|
7485
|
+
var __vue_render__ = function () {
|
|
6639
7486
|
var _vm = this;
|
|
6640
7487
|
|
|
6641
7488
|
var _h = _vm.$createElement;
|
|
@@ -6655,7 +7502,7 @@ var __vue_render__$1 = function () {
|
|
|
6655
7502
|
staticClass: "rb-form-constructor flex-fill"
|
|
6656
7503
|
}, [_c('div', {
|
|
6657
7504
|
staticClass: "rb-constructor-toolbar d-flex flex-row"
|
|
6658
|
-
}, [_c('h4', [_vm._v("
|
|
7505
|
+
}, [_c('h4', [_vm._v("Добавить секцию: ")]), _vm._v(" "), _c('div', {
|
|
6659
7506
|
staticClass: "rb-layout-buttons"
|
|
6660
7507
|
}, [_c('b-button', {
|
|
6661
7508
|
attrs: {
|
|
@@ -6667,7 +7514,7 @@ var __vue_render__$1 = function () {
|
|
|
6667
7514
|
return _vm.addSection(1);
|
|
6668
7515
|
}
|
|
6669
7516
|
}
|
|
6670
|
-
}, [_c('rb-text', [_vm._v("1
|
|
7517
|
+
}, [_c('rb-text', [_vm._v("Секция с 1 колонкой")]), _vm._v(" "), _c('rb-icon', {
|
|
6671
7518
|
attrs: {
|
|
6672
7519
|
"icon": _vm.iconAdd
|
|
6673
7520
|
}
|
|
@@ -6681,7 +7528,7 @@ var __vue_render__$1 = function () {
|
|
|
6681
7528
|
return _vm.addSection(2);
|
|
6682
7529
|
}
|
|
6683
7530
|
}
|
|
6684
|
-
}, [_c('rb-text', [_vm._v("2
|
|
7531
|
+
}, [_c('rb-text', [_vm._v("Секция с 2 колонками")]), _vm._v(" "), _c('rb-icon', {
|
|
6685
7532
|
attrs: {
|
|
6686
7533
|
"icon": _vm.iconAdd
|
|
6687
7534
|
}
|
|
@@ -6695,7 +7542,7 @@ var __vue_render__$1 = function () {
|
|
|
6695
7542
|
return _vm.addSection(3);
|
|
6696
7543
|
}
|
|
6697
7544
|
}
|
|
6698
|
-
}, [_c('rb-text', [_vm._v("3
|
|
7545
|
+
}, [_c('rb-text', [_vm._v("Секция с 3 колонками")]), _vm._v(" "), _c('rb-icon', {
|
|
6699
7546
|
attrs: {
|
|
6700
7547
|
"icon": _vm.iconAdd
|
|
6701
7548
|
}
|
|
@@ -6797,7 +7644,7 @@ var __vue_render__$1 = function () {
|
|
|
6797
7644
|
staticClass: "cursor-pointer",
|
|
6798
7645
|
on: {
|
|
6799
7646
|
"click": function ($event) {
|
|
6800
|
-
return _vm.showProperties(field);
|
|
7647
|
+
return _vm.showProperties(field, $event);
|
|
6801
7648
|
}
|
|
6802
7649
|
}
|
|
6803
7650
|
}, [_c('b-col', {
|
|
@@ -6817,6 +7664,7 @@ var __vue_render__$1 = function () {
|
|
|
6817
7664
|
"icon": _vm.iconDrag
|
|
6818
7665
|
}
|
|
6819
7666
|
}), _vm._v(" "), _c('rb-text', [_vm._v(_vm._s(field.labelRu))]), _vm._v(" "), _c('rb-icon', {
|
|
7667
|
+
staticClass: "rb-remove-field",
|
|
6820
7668
|
attrs: {
|
|
6821
7669
|
"icon": _vm.iconDelete
|
|
6822
7670
|
},
|
|
@@ -6841,7 +7689,8 @@ var __vue_render__$1 = function () {
|
|
|
6841
7689
|
}), 1)]);
|
|
6842
7690
|
}), 1)], 1), _vm._v(" "), _c('doc-template-field-sidebar', {
|
|
6843
7691
|
attrs: {
|
|
6844
|
-
"visible": _vm.sidebarVisible
|
|
7692
|
+
"visible": _vm.sidebarVisible,
|
|
7693
|
+
"form-config": _vm.formConfig
|
|
6845
7694
|
},
|
|
6846
7695
|
on: {
|
|
6847
7696
|
"hide": function ($event) {
|
|
@@ -6864,139 +7713,6 @@ var __vue_render__$1 = function () {
|
|
|
6864
7713
|
})], 1)], 1);
|
|
6865
7714
|
};
|
|
6866
7715
|
|
|
6867
|
-
var __vue_staticRenderFns__$1 = [];
|
|
6868
|
-
/* style */
|
|
6869
|
-
|
|
6870
|
-
const __vue_inject_styles__$1 = undefined;
|
|
6871
|
-
/* scoped */
|
|
6872
|
-
|
|
6873
|
-
const __vue_scope_id__$1 = undefined;
|
|
6874
|
-
/* module identifier */
|
|
6875
|
-
|
|
6876
|
-
const __vue_module_identifier__$1 = undefined;
|
|
6877
|
-
/* functional template */
|
|
6878
|
-
|
|
6879
|
-
const __vue_is_functional_template__$1 = false;
|
|
6880
|
-
/* style inject */
|
|
6881
|
-
|
|
6882
|
-
/* style inject SSR */
|
|
6883
|
-
|
|
6884
|
-
/* style inject shadow dom */
|
|
6885
|
-
|
|
6886
|
-
const __vue_component__$2 = /*#__PURE__*/normalizeComponent({
|
|
6887
|
-
render: __vue_render__$1,
|
|
6888
|
-
staticRenderFns: __vue_staticRenderFns__$1
|
|
6889
|
-
}, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, undefined, undefined, undefined);
|
|
6890
|
-
|
|
6891
|
-
var __vue_component__$3 = __vue_component__$2;
|
|
6892
|
-
|
|
6893
|
-
//
|
|
6894
|
-
//
|
|
6895
|
-
//
|
|
6896
|
-
//
|
|
6897
|
-
//
|
|
6898
|
-
//
|
|
6899
|
-
//
|
|
6900
|
-
//
|
|
6901
|
-
//
|
|
6902
|
-
//
|
|
6903
|
-
//
|
|
6904
|
-
//
|
|
6905
|
-
//
|
|
6906
|
-
//
|
|
6907
|
-
//
|
|
6908
|
-
//
|
|
6909
|
-
//
|
|
6910
|
-
//
|
|
6911
|
-
//
|
|
6912
|
-
//
|
|
6913
|
-
//
|
|
6914
|
-
//
|
|
6915
|
-
//
|
|
6916
|
-
//
|
|
6917
|
-
//
|
|
6918
|
-
var script = {
|
|
6919
|
-
name: 'DocForm',
|
|
6920
|
-
props: {
|
|
6921
|
-
formConfig: Object
|
|
6922
|
-
},
|
|
6923
|
-
|
|
6924
|
-
data() {
|
|
6925
|
-
return {
|
|
6926
|
-
doc: {
|
|
6927
|
-
type: Object,
|
|
6928
|
-
default: () => ({})
|
|
6929
|
-
}
|
|
6930
|
-
};
|
|
6931
|
-
},
|
|
6932
|
-
|
|
6933
|
-
created() {
|
|
6934
|
-
this.formConfig.sections.forEach(r => {
|
|
6935
|
-
r.columns.forEach(c => {
|
|
6936
|
-
c.fields.forEach(f => {
|
|
6937
|
-
this.$set(this.doc, f.name, f.defaultValue == null ? null : f.defaultValue);
|
|
6938
|
-
});
|
|
6939
|
-
});
|
|
6940
|
-
});
|
|
6941
|
-
}
|
|
6942
|
-
|
|
6943
|
-
};
|
|
6944
|
-
|
|
6945
|
-
/* script */
|
|
6946
|
-
const __vue_script__ = script;
|
|
6947
|
-
/* template */
|
|
6948
|
-
|
|
6949
|
-
var __vue_render__ = function () {
|
|
6950
|
-
var _vm = this;
|
|
6951
|
-
|
|
6952
|
-
var _h = _vm.$createElement;
|
|
6953
|
-
|
|
6954
|
-
var _c = _vm._self._c || _h;
|
|
6955
|
-
|
|
6956
|
-
return _c('b-form', {
|
|
6957
|
-
staticClass: "rb-doc-form"
|
|
6958
|
-
}, _vm._l(_vm.formConfig.sections, function (section) {
|
|
6959
|
-
return _c('div', {
|
|
6960
|
-
key: section.labelRu,
|
|
6961
|
-
staticClass: "rb-form-section"
|
|
6962
|
-
}, [_c('h4', [_vm._v(_vm._s(section.labelRu))]), _vm._v(" "), _c('div', {
|
|
6963
|
-
staticClass: "d-flex flex-row"
|
|
6964
|
-
}, _vm._l(section.columns, function (column) {
|
|
6965
|
-
return _c('div', {
|
|
6966
|
-
key: column.index,
|
|
6967
|
-
staticClass: "rb-form-column",
|
|
6968
|
-
class: {
|
|
6969
|
-
'rb-single-column': section.columnCount === 1
|
|
6970
|
-
}
|
|
6971
|
-
}, _vm._l(column.fields, function (field) {
|
|
6972
|
-
return _c('b-form-row', {
|
|
6973
|
-
key: field.name,
|
|
6974
|
-
staticClass: "cursor-pointer"
|
|
6975
|
-
}, [_c('b-col', {
|
|
6976
|
-
attrs: {
|
|
6977
|
-
"lg": "12"
|
|
6978
|
-
}
|
|
6979
|
-
}, [_c('b-form-group', {
|
|
6980
|
-
ref: "inputContainer",
|
|
6981
|
-
refInFor: true,
|
|
6982
|
-
attrs: {
|
|
6983
|
-
"label": field.labelRu
|
|
6984
|
-
}
|
|
6985
|
-
}, [_c(field.input.type, _vm._b({
|
|
6986
|
-
tag: "component",
|
|
6987
|
-
model: {
|
|
6988
|
-
value: _vm.doc[field.name],
|
|
6989
|
-
callback: function ($$v) {
|
|
6990
|
-
_vm.$set(_vm.doc, field.name, $$v);
|
|
6991
|
-
},
|
|
6992
|
-
expression: "doc[field.name]"
|
|
6993
|
-
}
|
|
6994
|
-
}, 'component', field.input.propsData, false))], 1)], 1)], 1);
|
|
6995
|
-
}), 1);
|
|
6996
|
-
}), 0)]);
|
|
6997
|
-
}), 0);
|
|
6998
|
-
};
|
|
6999
|
-
|
|
7000
7716
|
var __vue_staticRenderFns__ = [];
|
|
7001
7717
|
/* style */
|
|
7002
7718
|
|
|
@@ -7028,11 +7744,13 @@ var __vue_component__$1 = __vue_component__;
|
|
|
7028
7744
|
var components = /*#__PURE__*/Object.freeze({
|
|
7029
7745
|
__proto__: null,
|
|
7030
7746
|
UtFormConfig: UtFormConfig,
|
|
7747
|
+
UtFormConstructor: UtFormConstructor,
|
|
7031
7748
|
DocTemplateSectionModal: DocTemplateSectionModal,
|
|
7032
7749
|
DocTemplateFacetList: DocTemplateFacetList,
|
|
7033
7750
|
DocTemplateFieldSidebar: DocTemplateFieldSidebar,
|
|
7034
|
-
DocTemplateConstructor: __vue_component__$
|
|
7035
|
-
|
|
7751
|
+
DocTemplateConstructor: __vue_component__$1,
|
|
7752
|
+
FieldRuleFormModal: FieldRuleFormModal,
|
|
7753
|
+
DocForm: DocForm
|
|
7036
7754
|
});
|
|
7037
7755
|
|
|
7038
7756
|
// Import vue components
|
|
@@ -7044,4 +7762,4 @@ const install = function installRbDocumentFormConstructor(Vue) {
|
|
|
7044
7762
|
});
|
|
7045
7763
|
}; // Create module definition for Vue.use()
|
|
7046
7764
|
|
|
7047
|
-
export {
|
|
7765
|
+
export { DocForm, __vue_component__$1 as DocTemplateConstructor, DocTemplateFacetList, DocTemplateFieldSidebar, DocTemplateSectionModal, FieldRuleFormModal, UtFormConfig, UtFormConstructor, install as default };
|