rb-document-form-constructor 0.1.6 → 0.2.0

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.
@@ -83,6 +83,309 @@ const UtFormConfig = {
83
83
 
84
84
  };
85
85
 
86
+ let __clone = function (data) {
87
+ return JSON.parse(JSON.stringify(data));
88
+ };
89
+
90
+ let __assign = function () {
91
+ __assign = Object.assign || function __assign(t) {
92
+ for (let s, i = 1, n = arguments.length; i < n; i++) {
93
+ s = arguments[i];
94
+
95
+ for (let p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
96
+ }
97
+
98
+ return t;
99
+ };
100
+
101
+ return __assign.apply(this, arguments);
102
+ };
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
+
148
+ let fcInputs = {
149
+ text: {
150
+ text: 'Текст',
151
+ name: 'text',
152
+ type: 'b-form-input',
153
+ props: {
154
+ placeholder: {
155
+ type: 'string',
156
+ default: null,
157
+ label: 'Надпись внутри',
158
+ visible: true
159
+ },
160
+ type: {
161
+ type: 'string',
162
+ default: 'text',
163
+ label: 'Тип данных',
164
+ visible: false
165
+ }
166
+ },
167
+ propsData: {},
168
+ defaultValue: null
169
+ },
170
+ number: {
171
+ text: 'Число',
172
+ name: 'number',
173
+ type: 'b-form-input',
174
+ props: {
175
+ placeholder: {
176
+ type: 'string',
177
+ default: null,
178
+ label: 'Надпись внутри',
179
+ visible: true
180
+ },
181
+ type: {
182
+ type: 'string',
183
+ default: 'number',
184
+ label: 'Тип данных',
185
+ visible: false
186
+ }
187
+ },
188
+ propsData: {},
189
+ defaultValue: null
190
+ },
191
+ memo: {
192
+ text: 'Большой текст',
193
+ name: 'memo',
194
+ type: 'b-form-textarea',
195
+ props: {
196
+ placeholder: {
197
+ type: 'string',
198
+ default: null,
199
+ label: 'Надпись внутри',
200
+ visible: true
201
+ }
202
+ },
203
+ propsData: {},
204
+ defaultValue: null
205
+ },
206
+ date: {
207
+ text: 'Дата',
208
+ name: 'date',
209
+ type: 'rb-date-picker-input',
210
+ props: {},
211
+ propsData: {},
212
+ defaultValue: null
213
+ },
214
+ phone: {
215
+ text: 'Телефон',
216
+ name: 'phone',
217
+ type: 'rb-phone-input',
218
+ props: {
219
+ placeholder: {
220
+ type: 'string',
221
+ default: 'Телефон',
222
+ label: 'Надпись внутри',
223
+ visible: true
224
+ }
225
+ },
226
+ propsData: {},
227
+ defaultValue: null
228
+ }
229
+ };
230
+ let fcPrimitiveInputs = {
231
+ text: [__clone(fcInputs.text), __clone(fcInputs.number), __clone(fcInputs.memo), __clone(fcInputs.phone)],
232
+ memo: [__clone(fcInputs.memo), __clone(fcInputs.text)],
233
+ number: [__clone(fcInputs.text), __clone(fcInputs.number)],
234
+ date: [__clone(fcInputs.date)]
235
+ };
236
+ let fcDictInputs = [];
237
+ let fcRefInputs = {};
238
+ let fcRefInputConfigs = {};
239
+ let baseConfig = {
240
+ inputs: __clone(fcInputs),
241
+ primitiveInputs: __clone(fcPrimitiveInputs),
242
+ dictInputs: __clone(fcDictInputs),
243
+ refInputs: __clone(fcRefInputs),
244
+ refInputConfigs: __clone(fcRefInputConfigs),
245
+ rules: [],
246
+ icons: {
247
+ iconExpandFacet: 'icon-chevron-up',
248
+ iconCollapseFacet: 'icon-chevron-down',
249
+ iconCloseFieldSidebar: 'icon-chevron-right',
250
+ iconOpenFieldSidebar: 'icon-chevron-left',
251
+ iconAdd: 'icon-add',
252
+ iconEdit: 'icon-edit',
253
+ iconDelete: 'icon-delete',
254
+ iconDrag: 'icon-reorder'
255
+ },
256
+ ruleContext: {}
257
+ };
258
+ const UtFormConstructor = {
259
+ config: {},
260
+
261
+ init(formConfig) {
262
+ this.config = __clone(baseConfig);
263
+
264
+ if (formConfig) {
265
+ if (formConfig.inputs) {
266
+ __mergeInputsInMap(this.config.inputs, formConfig.inputs);
267
+ }
268
+
269
+ if (formConfig.primitiveInputs) {
270
+ __mergeInputInMapOfArrays(this.config.primitiveInputs, formConfig.primitiveInputs);
271
+ }
272
+
273
+ if (formConfig.dictInputs) {
274
+ __mergeInputsInArray(this.config.dictInputs, formConfig.dictInputs);
275
+ }
276
+
277
+ if (formConfig.refInputs) {
278
+ __mergeInputInMapOfArrays(this.config.refInputs, formConfig.refInputs);
279
+ }
280
+
281
+ if (formConfig.refInputConfigs) {
282
+ this.config.refInputConfigs = formConfig.refInputConfigs;
283
+ }
284
+
285
+ if (formConfig.icons) {
286
+ this.config.icons = __assign(this.config.icons, formConfig.icons);
287
+ }
288
+
289
+ if (formConfig.rules) {
290
+ this.config.rules = formConfig.rules;
291
+ }
292
+
293
+ if (formConfig.ruleContext) {
294
+ this.config.ruleContext = formConfig.ruleContext;
295
+ }
296
+ }
297
+ },
298
+
299
+ getInputTypes(field) {
300
+ if (!field) {
301
+ return [];
302
+ }
303
+
304
+ if (field.dict && !this.config.refInputs[field.ref]) {
305
+ return this.config.dictInputs;
306
+ }
307
+
308
+ if (field.ref) {
309
+ return this.config.refInputs[field.ref];
310
+ }
311
+
312
+ return this.config.primitiveInputs[field.type];
313
+ },
314
+
315
+ getDefaultInput(field) {
316
+ let input = null;
317
+
318
+ if (field.ref && this.config.refInputs[field.ref]) {
319
+ input = __clone(this.config.refInputs[field.ref][0]);
320
+
321
+ __applyDefaultProps(input);
322
+
323
+ if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
324
+ __applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
325
+ }
326
+ } else if (field.dict) {
327
+ input = __clone(this.config.dictInputs[0]);
328
+ input.props.dict.default = field.ref;
329
+
330
+ __applyDefaultProps(input);
331
+ } else {
332
+ input = __clone(this.config.primitiveInputs[field.type][0]);
333
+
334
+ __applyDefaultProps(input);
335
+ }
336
+
337
+ return input;
338
+ },
339
+
340
+ getInputTypeByName(name, field) {
341
+ let input = JSON.parse(JSON.stringify(this.config.inputs[name]));
342
+
343
+ if (field.ref && this.config.refInputs[field.ref]) {
344
+ __applyDefaultProps(input);
345
+
346
+ if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
347
+ __applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
348
+ }
349
+ } else if (field.dict) {
350
+ input.props.dict.default = field.ref;
351
+
352
+ __applyDefaultProps(input);
353
+ } else {
354
+ __applyDefaultProps(input);
355
+ }
356
+
357
+ input.propsData['ref'] = field.name;
358
+ return input;
359
+ },
360
+
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
+ });
365
+ },
366
+
367
+ getRuleContext() {
368
+ return this.config.ruleContext;
369
+ },
370
+
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);
385
+ }
386
+
387
+ };
388
+
86
389
  //
87
390
  //
88
391
  //
@@ -5074,935 +5377,632 @@ function _iterableToArrayLimit(arr, i) {
5074
5377
  var _arr = [];
5075
5378
  var _n = true;
5076
5379
  var _d = false;
5077
- var _e = undefined;
5078
-
5079
- try {
5080
- for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
5081
- _arr.push(_s.value);
5082
-
5083
- if (i && _arr.length === i) break;
5084
- }
5085
- } catch (err) {
5086
- _d = true;
5087
- _e = err;
5088
- } finally {
5089
- try {
5090
- if (!_n && _i["return"] != null) _i["return"]();
5091
- } finally {
5092
- if (_d) throw _e;
5093
- }
5094
- }
5095
-
5096
- return _arr;
5097
- }
5098
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
5099
- function _arrayLikeToArray(arr, len) {
5100
- if (len == null || len > arr.length) len = arr.length;
5101
-
5102
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
5103
- arr2[i] = arr[i];
5104
- }
5105
-
5106
- return arr2;
5107
- }
5108
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
5109
-
5110
- function _unsupportedIterableToArray(o, minLen) {
5111
- if (!o) return;
5112
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
5113
- var n = Object.prototype.toString.call(o).slice(8, -1);
5114
- if (n === "Object" && o.constructor) n = o.constructor.name;
5115
- if (n === "Map" || n === "Set") return Array.from(o);
5116
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
5117
- }
5118
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
5119
- function _nonIterableRest() {
5120
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5121
- }
5122
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
5123
-
5124
-
5125
-
5126
-
5127
- function _slicedToArray(arr, i) {
5128
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
5129
- }
5130
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es7.array.includes.js
5131
- __webpack_require__("6762");
5132
-
5133
- // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.string.includes.js
5134
- __webpack_require__("2fdb");
5135
-
5136
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
5137
-
5138
- function _arrayWithoutHoles(arr) {
5139
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
5140
- }
5141
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
5142
- function _iterableToArray(iter) {
5143
- if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
5144
- }
5145
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
5146
- function _nonIterableSpread() {
5147
- throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5148
- }
5149
- // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
5150
-
5151
-
5152
-
5153
-
5154
- function _toConsumableArray(arr) {
5155
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
5156
- }
5157
- // EXTERNAL MODULE: external {"commonjs":"sortablejs","commonjs2":"sortablejs","amd":"sortablejs","root":"Sortable"}
5158
- var external_commonjs_sortablejs_commonjs2_sortablejs_amd_sortablejs_root_Sortable_ = __webpack_require__("a352");
5159
- var external_commonjs_sortablejs_commonjs2_sortablejs_amd_sortablejs_root_Sortable_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_sortablejs_commonjs2_sortablejs_amd_sortablejs_root_Sortable_);
5160
-
5161
- // EXTERNAL MODULE: ./src/util/helper.js
5162
- var helper = __webpack_require__("c649");
5163
-
5164
- // CONCATENATED MODULE: ./src/vuedraggable.js
5165
-
5166
-
5167
-
5168
-
5169
-
5170
-
5171
-
5172
-
5173
-
5174
-
5175
-
5176
-
5177
- function buildAttribute(object, propName, value) {
5178
- if (value === undefined) {
5179
- return object;
5180
- }
5181
-
5182
- object = object || {};
5183
- object[propName] = value;
5184
- return object;
5185
- }
5186
-
5187
- function computeVmIndex(vnodes, element) {
5188
- return vnodes.map(function (elt) {
5189
- return elt.elm;
5190
- }).indexOf(element);
5191
- }
5192
-
5193
- function _computeIndexes(slots, children, isTransition, footerOffset) {
5194
- if (!slots) {
5195
- return [];
5196
- }
5197
-
5198
- var elmFromNodes = slots.map(function (elt) {
5199
- return elt.elm;
5200
- });
5201
- var footerIndex = children.length - footerOffset;
5202
-
5203
- var rawIndexes = _toConsumableArray(children).map(function (elt, idx) {
5204
- return idx >= footerIndex ? elmFromNodes.length : elmFromNodes.indexOf(elt);
5205
- });
5206
-
5207
- return isTransition ? rawIndexes.filter(function (ind) {
5208
- return ind !== -1;
5209
- }) : rawIndexes;
5210
- }
5211
-
5212
- function emit(evtName, evtData) {
5213
- var _this = this;
5214
-
5215
- this.$nextTick(function () {
5216
- return _this.$emit(evtName.toLowerCase(), evtData);
5217
- });
5218
- }
5219
-
5220
- function delegateAndEmit(evtName) {
5221
- var _this2 = this;
5222
-
5223
- return function (evtData) {
5224
- if (_this2.realList !== null) {
5225
- _this2["onDrag" + evtName](evtData);
5226
- }
5227
-
5228
- emit.call(_this2, evtName, evtData);
5229
- };
5230
- }
5231
-
5232
- function isTransitionName(name) {
5233
- return ["transition-group", "TransitionGroup"].includes(name);
5234
- }
5235
-
5236
- function vuedraggable_isTransition(slots) {
5237
- if (!slots || slots.length !== 1) {
5238
- return false;
5239
- }
5240
-
5241
- var _slots = _slicedToArray(slots, 1),
5242
- componentOptions = _slots[0].componentOptions;
5243
-
5244
- if (!componentOptions) {
5245
- return false;
5246
- }
5247
-
5248
- return isTransitionName(componentOptions.tag);
5249
- }
5250
-
5251
- function getSlot(slot, scopedSlot, key) {
5252
- return slot[key] || (scopedSlot[key] ? scopedSlot[key]() : undefined);
5253
- }
5380
+ var _e = undefined;
5254
5381
 
5255
- function computeChildrenAndOffsets(children, slot, scopedSlot) {
5256
- var headerOffset = 0;
5257
- var footerOffset = 0;
5258
- var header = getSlot(slot, scopedSlot, "header");
5382
+ try {
5383
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
5384
+ _arr.push(_s.value);
5259
5385
 
5260
- if (header) {
5261
- headerOffset = header.length;
5262
- children = children ? [].concat(_toConsumableArray(header), _toConsumableArray(children)) : _toConsumableArray(header);
5386
+ if (i && _arr.length === i) break;
5387
+ }
5388
+ } catch (err) {
5389
+ _d = true;
5390
+ _e = err;
5391
+ } finally {
5392
+ try {
5393
+ if (!_n && _i["return"] != null) _i["return"]();
5394
+ } finally {
5395
+ if (_d) throw _e;
5396
+ }
5263
5397
  }
5264
5398
 
5265
- var footer = getSlot(slot, scopedSlot, "footer");
5399
+ return _arr;
5400
+ }
5401
+ // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js
5402
+ function _arrayLikeToArray(arr, len) {
5403
+ if (len == null || len > arr.length) len = arr.length;
5266
5404
 
5267
- if (footer) {
5268
- footerOffset = footer.length;
5269
- children = children ? [].concat(_toConsumableArray(children), _toConsumableArray(footer)) : _toConsumableArray(footer);
5405
+ for (var i = 0, arr2 = new Array(len); i < len; i++) {
5406
+ arr2[i] = arr[i];
5270
5407
  }
5271
5408
 
5272
- return {
5273
- children: children,
5274
- headerOffset: headerOffset,
5275
- footerOffset: footerOffset
5276
- };
5409
+ return arr2;
5277
5410
  }
5411
+ // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
5278
5412
 
5279
- function getComponentAttributes($attrs, componentData) {
5280
- var attributes = null;
5281
-
5282
- var update = function update(name, value) {
5283
- attributes = buildAttribute(attributes, name, value);
5284
- };
5285
-
5286
- var attrs = Object.keys($attrs).filter(function (key) {
5287
- return key === "id" || key.startsWith("data-");
5288
- }).reduce(function (res, key) {
5289
- res[key] = $attrs[key];
5290
- return res;
5291
- }, {});
5292
- update("attrs", attrs);
5293
-
5294
- if (!componentData) {
5295
- return attributes;
5296
- }
5297
-
5298
- var on = componentData.on,
5299
- props = componentData.props,
5300
- componentDataAttrs = componentData.attrs;
5301
- update("on", on);
5302
- update("props", props);
5303
- Object.assign(attributes.attrs, componentDataAttrs);
5304
- return attributes;
5413
+ function _unsupportedIterableToArray(o, minLen) {
5414
+ if (!o) return;
5415
+ if (typeof o === "string") return _arrayLikeToArray(o, minLen);
5416
+ var n = Object.prototype.toString.call(o).slice(8, -1);
5417
+ if (n === "Object" && o.constructor) n = o.constructor.name;
5418
+ if (n === "Map" || n === "Set") return Array.from(o);
5419
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
5420
+ }
5421
+ // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableRest.js
5422
+ function _nonIterableRest() {
5423
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5305
5424
  }
5425
+ // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/slicedToArray.js
5306
5426
 
5307
- var eventsListened = ["Start", "Add", "Remove", "Update", "End"];
5308
- var eventsToEmit = ["Choose", "Unchoose", "Sort", "Filter", "Clone"];
5309
- var readonlyProperties = ["Move"].concat(eventsListened, eventsToEmit).map(function (evt) {
5310
- return "on" + evt;
5311
- });
5312
- var draggingElement = null;
5313
- var props = {
5314
- options: Object,
5315
- list: {
5316
- type: Array,
5317
- required: false,
5318
- default: null
5319
- },
5320
- value: {
5321
- type: Array,
5322
- required: false,
5323
- default: null
5324
- },
5325
- noTransitionOnDrag: {
5326
- type: Boolean,
5327
- default: false
5328
- },
5329
- clone: {
5330
- type: Function,
5331
- default: function _default(original) {
5332
- return original;
5333
- }
5334
- },
5335
- element: {
5336
- type: String,
5337
- default: "div"
5338
- },
5339
- tag: {
5340
- type: String,
5341
- default: null
5342
- },
5343
- move: {
5344
- type: Function,
5345
- default: null
5346
- },
5347
- componentData: {
5348
- type: Object,
5349
- required: false,
5350
- default: null
5351
- }
5352
- };
5353
- var draggableComponent = {
5354
- name: "draggable",
5355
- inheritAttrs: false,
5356
- props: props,
5357
- data: function data() {
5358
- return {
5359
- transitionMode: false,
5360
- noneFunctionalComponentMode: false
5361
- };
5362
- },
5363
- render: function render(h) {
5364
- var slots = this.$slots.default;
5365
- this.transitionMode = vuedraggable_isTransition(slots);
5366
5427
 
5367
- var _computeChildrenAndOf = computeChildrenAndOffsets(slots, this.$slots, this.$scopedSlots),
5368
- children = _computeChildrenAndOf.children,
5369
- headerOffset = _computeChildrenAndOf.headerOffset,
5370
- footerOffset = _computeChildrenAndOf.footerOffset;
5371
5428
 
5372
- this.headerOffset = headerOffset;
5373
- this.footerOffset = footerOffset;
5374
- var attributes = getComponentAttributes(this.$attrs, this.componentData);
5375
- return h(this.getTag(), attributes, children);
5376
- },
5377
- created: function created() {
5378
- if (this.list !== null && this.value !== null) {
5379
- helper["b" /* console */].error("Value and list props are mutually exclusive! Please set one or another.");
5380
- }
5381
5429
 
5382
- if (this.element !== "div") {
5383
- helper["b" /* console */].warn("Element props is deprecated please use tag props instead. See https://github.com/SortableJS/Vue.Draggable/blob/master/documentation/migrate.md#element-props");
5384
- }
5430
+ function _slicedToArray(arr, i) {
5431
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
5432
+ }
5433
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es7.array.includes.js
5434
+ __webpack_require__("6762");
5385
5435
 
5386
- if (this.options !== undefined) {
5387
- helper["b" /* console */].warn("Options props is deprecated, add sortable options directly as vue.draggable item, or use v-bind. See https://github.com/SortableJS/Vue.Draggable/blob/master/documentation/migrate.md#options-props");
5388
- }
5389
- },
5390
- mounted: function mounted() {
5391
- var _this3 = this;
5436
+ // EXTERNAL MODULE: ./node_modules/core-js/modules/es6.string.includes.js
5437
+ __webpack_require__("2fdb");
5392
5438
 
5393
- this.noneFunctionalComponentMode = this.getTag().toLowerCase() !== this.$el.nodeName.toLowerCase() && !this.getIsFunctional();
5439
+ // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js
5394
5440
 
5395
- if (this.noneFunctionalComponentMode && this.transitionMode) {
5396
- throw new Error("Transition-group inside component is not supported. Please alter tag value or remove transition-group. Current tag value: ".concat(this.getTag()));
5397
- }
5441
+ function _arrayWithoutHoles(arr) {
5442
+ if (Array.isArray(arr)) return _arrayLikeToArray(arr);
5443
+ }
5444
+ // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
5445
+ function _iterableToArray(iter) {
5446
+ if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter);
5447
+ }
5448
+ // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js
5449
+ function _nonIterableSpread() {
5450
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5451
+ }
5452
+ // CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/toConsumableArray.js
5398
5453
 
5399
- var optionsAdded = {};
5400
- eventsListened.forEach(function (elt) {
5401
- optionsAdded["on" + elt] = delegateAndEmit.call(_this3, elt);
5402
- });
5403
- eventsToEmit.forEach(function (elt) {
5404
- optionsAdded["on" + elt] = emit.bind(_this3, elt);
5405
- });
5406
- var attributes = Object.keys(this.$attrs).reduce(function (res, key) {
5407
- res[Object(helper["a" /* camelize */])(key)] = _this3.$attrs[key];
5408
- return res;
5409
- }, {});
5410
- var options = Object.assign({}, this.options, attributes, optionsAdded, {
5411
- onMove: function onMove(evt, originalEvent) {
5412
- return _this3.onDragMove(evt, originalEvent);
5413
- }
5414
- });
5415
- !("draggable" in options) && (options.draggable = ">*");
5416
- this._sortable = new external_commonjs_sortablejs_commonjs2_sortablejs_amd_sortablejs_root_Sortable_default.a(this.rootContainer, options);
5417
- this.computeIndexes();
5418
- },
5419
- beforeDestroy: function beforeDestroy() {
5420
- if (this._sortable !== undefined) this._sortable.destroy();
5421
- },
5422
- computed: {
5423
- rootContainer: function rootContainer() {
5424
- return this.transitionMode ? this.$el.children[0] : this.$el;
5425
- },
5426
- realList: function realList() {
5427
- return this.list ? this.list : this.value;
5428
- }
5429
- },
5430
- watch: {
5431
- options: {
5432
- handler: function handler(newOptionValue) {
5433
- this.updateOptions(newOptionValue);
5434
- },
5435
- deep: true
5436
- },
5437
- $attrs: {
5438
- handler: function handler(newOptionValue) {
5439
- this.updateOptions(newOptionValue);
5440
- },
5441
- deep: true
5442
- },
5443
- realList: function realList() {
5444
- this.computeIndexes();
5445
- }
5446
- },
5447
- methods: {
5448
- getIsFunctional: function getIsFunctional() {
5449
- var fnOptions = this._vnode.fnOptions;
5450
- return fnOptions && fnOptions.functional;
5451
- },
5452
- getTag: function getTag() {
5453
- return this.tag || this.element;
5454
- },
5455
- updateOptions: function updateOptions(newOptionValue) {
5456
- for (var property in newOptionValue) {
5457
- var value = Object(helper["a" /* camelize */])(property);
5458
5454
 
5459
- if (readonlyProperties.indexOf(value) === -1) {
5460
- this._sortable.option(value, newOptionValue[property]);
5461
- }
5462
- }
5463
- },
5464
- getChildrenNodes: function getChildrenNodes() {
5465
- if (this.noneFunctionalComponentMode) {
5466
- return this.$children[0].$slots.default;
5467
- }
5468
5455
 
5469
- var rawNodes = this.$slots.default;
5470
- return this.transitionMode ? rawNodes[0].child.$slots.default : rawNodes;
5471
- },
5472
- computeIndexes: function computeIndexes() {
5473
- var _this4 = this;
5474
5456
 
5475
- this.$nextTick(function () {
5476
- _this4.visibleIndexes = _computeIndexes(_this4.getChildrenNodes(), _this4.rootContainer.children, _this4.transitionMode, _this4.footerOffset);
5477
- });
5478
- },
5479
- getUnderlyingVm: function getUnderlyingVm(htmlElt) {
5480
- var index = computeVmIndex(this.getChildrenNodes() || [], htmlElt);
5457
+ function _toConsumableArray(arr) {
5458
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
5459
+ }
5460
+ // EXTERNAL MODULE: external {"commonjs":"sortablejs","commonjs2":"sortablejs","amd":"sortablejs","root":"Sortable"}
5461
+ var external_commonjs_sortablejs_commonjs2_sortablejs_amd_sortablejs_root_Sortable_ = __webpack_require__("a352");
5462
+ var external_commonjs_sortablejs_commonjs2_sortablejs_amd_sortablejs_root_Sortable_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_sortablejs_commonjs2_sortablejs_amd_sortablejs_root_Sortable_);
5481
5463
 
5482
- if (index === -1) {
5483
- //Edge case during move callback: related element might be
5484
- //an element different from collection
5485
- return null;
5486
- }
5464
+ // EXTERNAL MODULE: ./src/util/helper.js
5465
+ var helper = __webpack_require__("c649");
5487
5466
 
5488
- var element = this.realList[index];
5489
- return {
5490
- index: index,
5491
- element: element
5492
- };
5493
- },
5494
- getUnderlyingPotencialDraggableComponent: function getUnderlyingPotencialDraggableComponent(_ref) {
5495
- var vue = _ref.__vue__;
5467
+ // CONCATENATED MODULE: ./src/vuedraggable.js
5496
5468
 
5497
- if (!vue || !vue.$options || !isTransitionName(vue.$options._componentTag)) {
5498
- if (!("realList" in vue) && vue.$children.length === 1 && "realList" in vue.$children[0]) return vue.$children[0];
5499
- return vue;
5500
- }
5501
5469
 
5502
- return vue.$parent;
5503
- },
5504
- emitChanges: function emitChanges(evt) {
5505
- var _this5 = this;
5506
5470
 
5507
- this.$nextTick(function () {
5508
- _this5.$emit("change", evt);
5509
- });
5510
- },
5511
- alterList: function alterList(onList) {
5512
- if (this.list) {
5513
- onList(this.list);
5514
- return;
5515
- }
5516
5471
 
5517
- var newList = _toConsumableArray(this.value);
5518
5472
 
5519
- onList(newList);
5520
- this.$emit("input", newList);
5521
- },
5522
- spliceList: function spliceList() {
5523
- var _arguments = arguments;
5524
5473
 
5525
- var spliceList = function spliceList(list) {
5526
- return list.splice.apply(list, _toConsumableArray(_arguments));
5527
- };
5528
5474
 
5529
- this.alterList(spliceList);
5530
- },
5531
- updatePosition: function updatePosition(oldIndex, newIndex) {
5532
- var updatePosition = function updatePosition(list) {
5533
- return list.splice(newIndex, 0, list.splice(oldIndex, 1)[0]);
5534
- };
5535
5475
 
5536
- this.alterList(updatePosition);
5537
- },
5538
- getRelatedContextFromMoveEvent: function getRelatedContextFromMoveEvent(_ref2) {
5539
- var to = _ref2.to,
5540
- related = _ref2.related;
5541
- var component = this.getUnderlyingPotencialDraggableComponent(to);
5542
5476
 
5543
- if (!component) {
5544
- return {
5545
- component: component
5546
- };
5547
- }
5548
5477
 
5549
- var list = component.realList;
5550
- var context = {
5551
- list: list,
5552
- component: component
5553
- };
5554
5478
 
5555
- if (to !== related && list && component.getUnderlyingVm) {
5556
- var destination = component.getUnderlyingVm(related);
5557
5479
 
5558
- if (destination) {
5559
- return Object.assign(destination, context);
5560
- }
5561
- }
5480
+ function buildAttribute(object, propName, value) {
5481
+ if (value === undefined) {
5482
+ return object;
5483
+ }
5562
5484
 
5563
- return context;
5564
- },
5565
- getVmIndex: function getVmIndex(domIndex) {
5566
- var indexes = this.visibleIndexes;
5567
- var numberIndexes = indexes.length;
5568
- return domIndex > numberIndexes - 1 ? numberIndexes : indexes[domIndex];
5569
- },
5570
- getComponent: function getComponent() {
5571
- return this.$slots.default[0].componentInstance;
5572
- },
5573
- resetTransitionData: function resetTransitionData(index) {
5574
- if (!this.noTransitionOnDrag || !this.transitionMode) {
5575
- return;
5576
- }
5485
+ object = object || {};
5486
+ object[propName] = value;
5487
+ return object;
5488
+ }
5577
5489
 
5578
- var nodes = this.getChildrenNodes();
5579
- nodes[index].data = null;
5580
- var transitionContainer = this.getComponent();
5581
- transitionContainer.children = [];
5582
- transitionContainer.kept = undefined;
5583
- },
5584
- onDragStart: function onDragStart(evt) {
5585
- this.context = this.getUnderlyingVm(evt.item);
5586
- evt.item._underlying_vm_ = this.clone(this.context.element);
5587
- draggingElement = evt.item;
5588
- },
5589
- onDragAdd: function onDragAdd(evt) {
5590
- var element = evt.item._underlying_vm_;
5490
+ function computeVmIndex(vnodes, element) {
5491
+ return vnodes.map(function (elt) {
5492
+ return elt.elm;
5493
+ }).indexOf(element);
5494
+ }
5591
5495
 
5592
- if (element === undefined) {
5593
- return;
5594
- }
5496
+ function _computeIndexes(slots, children, isTransition, footerOffset) {
5497
+ if (!slots) {
5498
+ return [];
5499
+ }
5595
5500
 
5596
- Object(helper["d" /* removeNode */])(evt.item);
5597
- var newIndex = this.getVmIndex(evt.newIndex);
5598
- this.spliceList(newIndex, 0, element);
5599
- this.computeIndexes();
5600
- var added = {
5601
- element: element,
5602
- newIndex: newIndex
5603
- };
5604
- this.emitChanges({
5605
- added: added
5606
- });
5607
- },
5608
- onDragRemove: function onDragRemove(evt) {
5609
- Object(helper["c" /* insertNodeAt */])(this.rootContainer, evt.item, evt.oldIndex);
5501
+ var elmFromNodes = slots.map(function (elt) {
5502
+ return elt.elm;
5503
+ });
5504
+ var footerIndex = children.length - footerOffset;
5610
5505
 
5611
- if (evt.pullMode === "clone") {
5612
- Object(helper["d" /* removeNode */])(evt.clone);
5613
- return;
5614
- }
5506
+ var rawIndexes = _toConsumableArray(children).map(function (elt, idx) {
5507
+ return idx >= footerIndex ? elmFromNodes.length : elmFromNodes.indexOf(elt);
5508
+ });
5615
5509
 
5616
- var oldIndex = this.context.index;
5617
- this.spliceList(oldIndex, 1);
5618
- var removed = {
5619
- element: this.context.element,
5620
- oldIndex: oldIndex
5621
- };
5622
- this.resetTransitionData(oldIndex);
5623
- this.emitChanges({
5624
- removed: removed
5625
- });
5626
- },
5627
- onDragUpdate: function onDragUpdate(evt) {
5628
- Object(helper["d" /* removeNode */])(evt.item);
5629
- Object(helper["c" /* insertNodeAt */])(evt.from, evt.item, evt.oldIndex);
5630
- var oldIndex = this.context.index;
5631
- var newIndex = this.getVmIndex(evt.newIndex);
5632
- this.updatePosition(oldIndex, newIndex);
5633
- var moved = {
5634
- element: this.context.element,
5635
- oldIndex: oldIndex,
5636
- newIndex: newIndex
5637
- };
5638
- this.emitChanges({
5639
- moved: moved
5640
- });
5641
- },
5642
- updateProperty: function updateProperty(evt, propertyName) {
5643
- evt.hasOwnProperty(propertyName) && (evt[propertyName] += this.headerOffset);
5644
- },
5645
- computeFutureIndex: function computeFutureIndex(relatedContext, evt) {
5646
- if (!relatedContext.element) {
5647
- return 0;
5648
- }
5510
+ return isTransition ? rawIndexes.filter(function (ind) {
5511
+ return ind !== -1;
5512
+ }) : rawIndexes;
5513
+ }
5649
5514
 
5650
- var domChildren = _toConsumableArray(evt.to.children).filter(function (el) {
5651
- return el.style["display"] !== "none";
5652
- });
5515
+ function emit(evtName, evtData) {
5516
+ var _this = this;
5653
5517
 
5654
- var currentDOMIndex = domChildren.indexOf(evt.related);
5655
- var currentIndex = relatedContext.component.getVmIndex(currentDOMIndex);
5656
- var draggedInList = domChildren.indexOf(draggingElement) !== -1;
5657
- return draggedInList || !evt.willInsertAfter ? currentIndex : currentIndex + 1;
5658
- },
5659
- onDragMove: function onDragMove(evt, originalEvent) {
5660
- var onMove = this.move;
5518
+ this.$nextTick(function () {
5519
+ return _this.$emit(evtName.toLowerCase(), evtData);
5520
+ });
5521
+ }
5661
5522
 
5662
- if (!onMove || !this.realList) {
5663
- return true;
5664
- }
5523
+ function delegateAndEmit(evtName) {
5524
+ var _this2 = this;
5665
5525
 
5666
- var relatedContext = this.getRelatedContextFromMoveEvent(evt);
5667
- var draggedContext = this.context;
5668
- var futureIndex = this.computeFutureIndex(relatedContext, evt);
5669
- Object.assign(draggedContext, {
5670
- futureIndex: futureIndex
5671
- });
5672
- var sendEvt = Object.assign({}, evt, {
5673
- relatedContext: relatedContext,
5674
- draggedContext: draggedContext
5675
- });
5676
- return onMove(sendEvt, originalEvent);
5677
- },
5678
- onDragEnd: function onDragEnd() {
5679
- this.computeIndexes();
5680
- draggingElement = null;
5526
+ return function (evtData) {
5527
+ if (_this2.realList !== null) {
5528
+ _this2["onDrag" + evtName](evtData);
5681
5529
  }
5682
- }
5683
- };
5684
5530
 
5685
- if (typeof window !== "undefined" && "Vue" in window) {
5686
- window.Vue.component("draggable", draggableComponent);
5531
+ emit.call(_this2, evtName, evtData);
5532
+ };
5687
5533
  }
5688
5534
 
5689
- /* harmony default export */ var vuedraggable = (draggableComponent);
5690
- // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
5535
+ function isTransitionName(name) {
5536
+ return ["transition-group", "TransitionGroup"].includes(name);
5537
+ }
5691
5538
 
5539
+ function vuedraggable_isTransition(slots) {
5540
+ if (!slots || slots.length !== 1) {
5541
+ return false;
5542
+ }
5692
5543
 
5693
- /* harmony default export */ __webpack_exports__["default"] = (vuedraggable);
5544
+ var _slots = _slicedToArray(slots, 1),
5545
+ componentOptions = _slots[0].componentOptions;
5694
5546
 
5547
+ if (!componentOptions) {
5548
+ return false;
5549
+ }
5550
+
5551
+ return isTransitionName(componentOptions.tag);
5552
+ }
5695
5553
 
5554
+ function getSlot(slot, scopedSlot, key) {
5555
+ return slot[key] || (scopedSlot[key] ? scopedSlot[key]() : undefined);
5556
+ }
5696
5557
 
5697
- /***/ })
5558
+ function computeChildrenAndOffsets(children, slot, scopedSlot) {
5559
+ var headerOffset = 0;
5560
+ var footerOffset = 0;
5561
+ var header = getSlot(slot, scopedSlot, "header");
5698
5562
 
5699
- /******/ })["default"];
5700
- });
5563
+ if (header) {
5564
+ headerOffset = header.length;
5565
+ children = children ? [].concat(_toConsumableArray(header), _toConsumableArray(children)) : _toConsumableArray(header);
5566
+ }
5701
5567
 
5702
- });
5568
+ var footer = getSlot(slot, scopedSlot, "footer");
5703
5569
 
5704
- let __clone = function (data) {
5705
- return JSON.parse(JSON.stringify(data));
5706
- };
5570
+ if (footer) {
5571
+ footerOffset = footer.length;
5572
+ children = children ? [].concat(_toConsumableArray(children), _toConsumableArray(footer)) : _toConsumableArray(footer);
5573
+ }
5707
5574
 
5708
- let __assign = function () {
5709
- __assign = Object.assign || function __assign(t) {
5710
- for (let s, i = 1, n = arguments.length; i < n; i++) {
5711
- s = arguments[i];
5575
+ return {
5576
+ children: children,
5577
+ headerOffset: headerOffset,
5578
+ footerOffset: footerOffset
5579
+ };
5580
+ }
5712
5581
 
5713
- for (let p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
5714
- }
5582
+ function getComponentAttributes($attrs, componentData) {
5583
+ var attributes = null;
5715
5584
 
5716
- return t;
5585
+ var update = function update(name, value) {
5586
+ attributes = buildAttribute(attributes, name, value);
5717
5587
  };
5718
5588
 
5719
- return __assign.apply(this, arguments);
5720
- };
5589
+ var attrs = Object.keys($attrs).filter(function (key) {
5590
+ return key === "id" || key.startsWith("data-");
5591
+ }).reduce(function (res, key) {
5592
+ res[key] = $attrs[key];
5593
+ return res;
5594
+ }, {});
5595
+ update("attrs", attrs);
5721
5596
 
5722
- let __mergeInputInMapOfArrays = function (inputs, formConfigInputs) {
5723
- for (let dataType in formConfigInputs) {
5724
- let foundInputs = inputs[dataType];
5597
+ if (!componentData) {
5598
+ return attributes;
5599
+ }
5725
5600
 
5726
- if (foundInputs) {
5727
- __mergeInputsInArray(foundInputs, formConfigInputs[dataType]);
5728
- } else {
5729
- inputs[dataType] = formConfigInputs[dataType];
5601
+ var on = componentData.on,
5602
+ props = componentData.props,
5603
+ componentDataAttrs = componentData.attrs;
5604
+ update("on", on);
5605
+ update("props", props);
5606
+ Object.assign(attributes.attrs, componentDataAttrs);
5607
+ return attributes;
5608
+ }
5609
+
5610
+ var eventsListened = ["Start", "Add", "Remove", "Update", "End"];
5611
+ var eventsToEmit = ["Choose", "Unchoose", "Sort", "Filter", "Clone"];
5612
+ var readonlyProperties = ["Move"].concat(eventsListened, eventsToEmit).map(function (evt) {
5613
+ return "on" + evt;
5614
+ });
5615
+ var draggingElement = null;
5616
+ var props = {
5617
+ options: Object,
5618
+ list: {
5619
+ type: Array,
5620
+ required: false,
5621
+ default: null
5622
+ },
5623
+ value: {
5624
+ type: Array,
5625
+ required: false,
5626
+ default: null
5627
+ },
5628
+ noTransitionOnDrag: {
5629
+ type: Boolean,
5630
+ default: false
5631
+ },
5632
+ clone: {
5633
+ type: Function,
5634
+ default: function _default(original) {
5635
+ return original;
5730
5636
  }
5637
+ },
5638
+ element: {
5639
+ type: String,
5640
+ default: "div"
5641
+ },
5642
+ tag: {
5643
+ type: String,
5644
+ default: null
5645
+ },
5646
+ move: {
5647
+ type: Function,
5648
+ default: null
5649
+ },
5650
+ componentData: {
5651
+ type: Object,
5652
+ required: false,
5653
+ default: null
5731
5654
  }
5732
5655
  };
5656
+ var draggableComponent = {
5657
+ name: "draggable",
5658
+ inheritAttrs: false,
5659
+ props: props,
5660
+ data: function data() {
5661
+ return {
5662
+ transitionMode: false,
5663
+ noneFunctionalComponentMode: false
5664
+ };
5665
+ },
5666
+ render: function render(h) {
5667
+ var slots = this.$slots.default;
5668
+ this.transitionMode = vuedraggable_isTransition(slots);
5733
5669
 
5734
- let __mergeInputsInMap = function (inputs, formConfigInputs) {
5735
- for (let name in formConfigInputs) {
5736
- inputs[name] = __assign(inputs[name] ? inputs[name] : {}, formConfigInputs[name] ? formConfigInputs[name] : {});
5737
- }
5738
- };
5670
+ var _computeChildrenAndOf = computeChildrenAndOffsets(slots, this.$slots, this.$scopedSlots),
5671
+ children = _computeChildrenAndOf.children,
5672
+ headerOffset = _computeChildrenAndOf.headerOffset,
5673
+ footerOffset = _computeChildrenAndOf.footerOffset;
5739
5674
 
5740
- let __mergeInputsInArray = function (inputs, formConfigInputs) {
5741
- formConfigInputs.forEach(input => {
5742
- let index = inputs.findIndex(item => item.name === input.name);
5675
+ this.headerOffset = headerOffset;
5676
+ this.footerOffset = footerOffset;
5677
+ var attributes = getComponentAttributes(this.$attrs, this.componentData);
5678
+ return h(this.getTag(), attributes, children);
5679
+ },
5680
+ created: function created() {
5681
+ if (this.list !== null && this.value !== null) {
5682
+ helper["b" /* console */].error("Value and list props are mutually exclusive! Please set one or another.");
5683
+ }
5743
5684
 
5744
- if (index >= 0) {
5745
- inputs[index] = input;
5746
- } else {
5747
- inputs.push(input);
5685
+ if (this.element !== "div") {
5686
+ helper["b" /* console */].warn("Element props is deprecated please use tag props instead. See https://github.com/SortableJS/Vue.Draggable/blob/master/documentation/migrate.md#element-props");
5748
5687
  }
5749
- });
5750
- };
5751
5688
 
5752
- let __applyDefaultProps = function (input) {
5753
- for (let propName in input.props) {
5754
- input.propsData[propName] = input.props[propName].default;
5755
- }
5756
- };
5689
+ if (this.options !== undefined) {
5690
+ helper["b" /* console */].warn("Options props is deprecated, add sortable options directly as vue.draggable item, or use v-bind. See https://github.com/SortableJS/Vue.Draggable/blob/master/documentation/migrate.md#options-props");
5691
+ }
5692
+ },
5693
+ mounted: function mounted() {
5694
+ var _this3 = this;
5757
5695
 
5758
- let __applyRefProps = function (input, refConfig) {
5759
- if (refConfig !== null && refConfig !== void 0 && refConfig.propsData) {
5760
- for (let propName in refConfig.propsData) {
5761
- input.propsData[propName] = refConfig.propsData[propName];
5696
+ this.noneFunctionalComponentMode = this.getTag().toLowerCase() !== this.$el.nodeName.toLowerCase() && !this.getIsFunctional();
5697
+
5698
+ if (this.noneFunctionalComponentMode && this.transitionMode) {
5699
+ throw new Error("Transition-group inside component is not supported. Please alter tag value or remove transition-group. Current tag value: ".concat(this.getTag()));
5762
5700
  }
5763
- }
5764
- };
5765
5701
 
5766
- let fcInputs = {
5767
- text: {
5768
- text: 'Текст',
5769
- name: 'text',
5770
- type: 'b-form-input',
5771
- props: {
5772
- placeholder: {
5773
- type: 'string',
5774
- default: null,
5775
- label: 'Надпись внутри',
5776
- visible: true
5777
- },
5778
- type: {
5779
- type: 'string',
5780
- default: 'text',
5781
- label: 'Тип данных',
5782
- visible: false
5702
+ var optionsAdded = {};
5703
+ eventsListened.forEach(function (elt) {
5704
+ optionsAdded["on" + elt] = delegateAndEmit.call(_this3, elt);
5705
+ });
5706
+ eventsToEmit.forEach(function (elt) {
5707
+ optionsAdded["on" + elt] = emit.bind(_this3, elt);
5708
+ });
5709
+ var attributes = Object.keys(this.$attrs).reduce(function (res, key) {
5710
+ res[Object(helper["a" /* camelize */])(key)] = _this3.$attrs[key];
5711
+ return res;
5712
+ }, {});
5713
+ var options = Object.assign({}, this.options, attributes, optionsAdded, {
5714
+ onMove: function onMove(evt, originalEvent) {
5715
+ return _this3.onDragMove(evt, originalEvent);
5783
5716
  }
5717
+ });
5718
+ !("draggable" in options) && (options.draggable = ">*");
5719
+ this._sortable = new external_commonjs_sortablejs_commonjs2_sortablejs_amd_sortablejs_root_Sortable_default.a(this.rootContainer, options);
5720
+ this.computeIndexes();
5721
+ },
5722
+ beforeDestroy: function beforeDestroy() {
5723
+ if (this._sortable !== undefined) this._sortable.destroy();
5724
+ },
5725
+ computed: {
5726
+ rootContainer: function rootContainer() {
5727
+ return this.transitionMode ? this.$el.children[0] : this.$el;
5784
5728
  },
5785
- propsData: {},
5786
- defaultValue: null
5729
+ realList: function realList() {
5730
+ return this.list ? this.list : this.value;
5731
+ }
5787
5732
  },
5788
- number: {
5789
- text: 'Число',
5790
- name: 'number',
5791
- type: 'b-form-input',
5792
- props: {
5793
- placeholder: {
5794
- type: 'string',
5795
- default: null,
5796
- label: 'Надпись внутри',
5797
- visible: true
5733
+ watch: {
5734
+ options: {
5735
+ handler: function handler(newOptionValue) {
5736
+ this.updateOptions(newOptionValue);
5798
5737
  },
5799
- type: {
5800
- type: 'string',
5801
- default: 'number',
5802
- label: 'Тип данных',
5803
- visible: false
5804
- }
5738
+ deep: true
5739
+ },
5740
+ $attrs: {
5741
+ handler: function handler(newOptionValue) {
5742
+ this.updateOptions(newOptionValue);
5743
+ },
5744
+ deep: true
5745
+ },
5746
+ realList: function realList() {
5747
+ this.computeIndexes();
5748
+ }
5749
+ },
5750
+ methods: {
5751
+ getIsFunctional: function getIsFunctional() {
5752
+ var fnOptions = this._vnode.fnOptions;
5753
+ return fnOptions && fnOptions.functional;
5754
+ },
5755
+ getTag: function getTag() {
5756
+ return this.tag || this.element;
5805
5757
  },
5806
- propsData: {},
5807
- defaultValue: null
5808
- },
5809
- memo: {
5810
- text: 'Большой текст',
5811
- name: 'memo',
5812
- type: 'b-form-textarea',
5813
- props: {
5814
- placeholder: {
5815
- type: 'string',
5816
- default: null,
5817
- label: 'Надпись внутри',
5818
- visible: true
5758
+ updateOptions: function updateOptions(newOptionValue) {
5759
+ for (var property in newOptionValue) {
5760
+ var value = Object(helper["a" /* camelize */])(property);
5761
+
5762
+ if (readonlyProperties.indexOf(value) === -1) {
5763
+ this._sortable.option(value, newOptionValue[property]);
5764
+ }
5819
5765
  }
5820
5766
  },
5821
- propsData: {},
5822
- defaultValue: null
5823
- },
5824
- date: {
5825
- text: 'Дата',
5826
- name: 'date',
5827
- type: 'rb-date-picker-input',
5828
- props: {},
5829
- propsData: {},
5830
- defaultValue: null
5831
- },
5832
- phone: {
5833
- text: 'Телефон',
5834
- name: 'phone',
5835
- type: 'rb-phone-input',
5836
- props: {
5837
- placeholder: {
5838
- type: 'string',
5839
- default: 'Телефон',
5840
- label: 'Надпись внутри',
5841
- visible: true
5767
+ getChildrenNodes: function getChildrenNodes() {
5768
+ if (this.noneFunctionalComponentMode) {
5769
+ return this.$children[0].$slots.default;
5842
5770
  }
5771
+
5772
+ var rawNodes = this.$slots.default;
5773
+ return this.transitionMode ? rawNodes[0].child.$slots.default : rawNodes;
5843
5774
  },
5844
- propsData: {},
5845
- defaultValue: null
5846
- }
5847
- };
5848
- let fcPrimitiveInputs = {
5849
- text: [__clone(fcInputs.text), __clone(fcInputs.number), __clone(fcInputs.memo), __clone(fcInputs.phone)],
5850
- memo: [__clone(fcInputs.memo), __clone(fcInputs.text)],
5851
- number: [__clone(fcInputs.text), __clone(fcInputs.number)],
5852
- date: [__clone(fcInputs.date)]
5853
- };
5854
- let fcDictInputs = [];
5855
- let fcRefInputs = {};
5856
- let fcRefInputConfigs = {};
5857
- let baseConfig = {
5858
- inputs: __clone(fcInputs),
5859
- primitiveInputs: __clone(fcPrimitiveInputs),
5860
- dictInputs: __clone(fcDictInputs),
5861
- refInputs: __clone(fcRefInputs),
5862
- refInputConfigs: __clone(fcRefInputConfigs),
5863
- rules: [],
5864
- icons: {
5865
- iconExpandFacet: 'icon-chevron-up',
5866
- iconCollapseFacet: 'icon-chevron-down',
5867
- iconCloseFieldSidebar: 'icon-chevron-right',
5868
- iconOpenFieldSidebar: 'icon-chevron-left',
5869
- iconAdd: 'icon-add',
5870
- iconEdit: 'icon-edit',
5871
- iconDelete: 'icon-delete',
5872
- iconDrag: 'icon-reorder'
5873
- },
5874
- ruleContext: {}
5875
- };
5876
- const UtFormConstructor = {
5877
- config: {},
5775
+ computeIndexes: function computeIndexes() {
5776
+ var _this4 = this;
5878
5777
 
5879
- init(formConfig) {
5880
- this.config = __clone(baseConfig);
5778
+ this.$nextTick(function () {
5779
+ _this4.visibleIndexes = _computeIndexes(_this4.getChildrenNodes(), _this4.rootContainer.children, _this4.transitionMode, _this4.footerOffset);
5780
+ });
5781
+ },
5782
+ getUnderlyingVm: function getUnderlyingVm(htmlElt) {
5783
+ var index = computeVmIndex(this.getChildrenNodes() || [], htmlElt);
5881
5784
 
5882
- if (formConfig) {
5883
- if (formConfig.inputs) {
5884
- __mergeInputsInMap(this.config.inputs, formConfig.inputs);
5785
+ if (index === -1) {
5786
+ //Edge case during move callback: related element might be
5787
+ //an element different from collection
5788
+ return null;
5885
5789
  }
5886
5790
 
5887
- if (formConfig.primitiveInputs) {
5888
- __mergeInputInMapOfArrays(this.config.primitiveInputs, formConfig.primitiveInputs);
5791
+ var element = this.realList[index];
5792
+ return {
5793
+ index: index,
5794
+ element: element
5795
+ };
5796
+ },
5797
+ getUnderlyingPotencialDraggableComponent: function getUnderlyingPotencialDraggableComponent(_ref) {
5798
+ var vue = _ref.__vue__;
5799
+
5800
+ if (!vue || !vue.$options || !isTransitionName(vue.$options._componentTag)) {
5801
+ if (!("realList" in vue) && vue.$children.length === 1 && "realList" in vue.$children[0]) return vue.$children[0];
5802
+ return vue;
5889
5803
  }
5890
5804
 
5891
- if (formConfig.dictInputs) {
5892
- __mergeInputsInArray(this.config.dictInputs, formConfig.dictInputs);
5805
+ return vue.$parent;
5806
+ },
5807
+ emitChanges: function emitChanges(evt) {
5808
+ var _this5 = this;
5809
+
5810
+ this.$nextTick(function () {
5811
+ _this5.$emit("change", evt);
5812
+ });
5813
+ },
5814
+ alterList: function alterList(onList) {
5815
+ if (this.list) {
5816
+ onList(this.list);
5817
+ return;
5893
5818
  }
5894
5819
 
5895
- if (formConfig.refInputs) {
5896
- __mergeInputInMapOfArrays(this.config.refInputs, formConfig.refInputs);
5820
+ var newList = _toConsumableArray(this.value);
5821
+
5822
+ onList(newList);
5823
+ this.$emit("input", newList);
5824
+ },
5825
+ spliceList: function spliceList() {
5826
+ var _arguments = arguments;
5827
+
5828
+ var spliceList = function spliceList(list) {
5829
+ return list.splice.apply(list, _toConsumableArray(_arguments));
5830
+ };
5831
+
5832
+ this.alterList(spliceList);
5833
+ },
5834
+ updatePosition: function updatePosition(oldIndex, newIndex) {
5835
+ var updatePosition = function updatePosition(list) {
5836
+ return list.splice(newIndex, 0, list.splice(oldIndex, 1)[0]);
5837
+ };
5838
+
5839
+ this.alterList(updatePosition);
5840
+ },
5841
+ getRelatedContextFromMoveEvent: function getRelatedContextFromMoveEvent(_ref2) {
5842
+ var to = _ref2.to,
5843
+ related = _ref2.related;
5844
+ var component = this.getUnderlyingPotencialDraggableComponent(to);
5845
+
5846
+ if (!component) {
5847
+ return {
5848
+ component: component
5849
+ };
5897
5850
  }
5898
5851
 
5899
- if (formConfig.refInputConfigs) {
5900
- this.config.refInputConfigs = formConfig.refInputConfigs;
5852
+ var list = component.realList;
5853
+ var context = {
5854
+ list: list,
5855
+ component: component
5856
+ };
5857
+
5858
+ if (to !== related && list && component.getUnderlyingVm) {
5859
+ var destination = component.getUnderlyingVm(related);
5860
+
5861
+ if (destination) {
5862
+ return Object.assign(destination, context);
5863
+ }
5901
5864
  }
5902
5865
 
5903
- if (formConfig.icons) {
5904
- this.config.icons = __assign(this.config.icons, formConfig.icons);
5866
+ return context;
5867
+ },
5868
+ getVmIndex: function getVmIndex(domIndex) {
5869
+ var indexes = this.visibleIndexes;
5870
+ var numberIndexes = indexes.length;
5871
+ return domIndex > numberIndexes - 1 ? numberIndexes : indexes[domIndex];
5872
+ },
5873
+ getComponent: function getComponent() {
5874
+ return this.$slots.default[0].componentInstance;
5875
+ },
5876
+ resetTransitionData: function resetTransitionData(index) {
5877
+ if (!this.noTransitionOnDrag || !this.transitionMode) {
5878
+ return;
5905
5879
  }
5906
5880
 
5907
- if (formConfig.rules) {
5908
- this.config.rules = formConfig.rules;
5881
+ var nodes = this.getChildrenNodes();
5882
+ nodes[index].data = null;
5883
+ var transitionContainer = this.getComponent();
5884
+ transitionContainer.children = [];
5885
+ transitionContainer.kept = undefined;
5886
+ },
5887
+ onDragStart: function onDragStart(evt) {
5888
+ this.context = this.getUnderlyingVm(evt.item);
5889
+ evt.item._underlying_vm_ = this.clone(this.context.element);
5890
+ draggingElement = evt.item;
5891
+ },
5892
+ onDragAdd: function onDragAdd(evt) {
5893
+ var element = evt.item._underlying_vm_;
5894
+
5895
+ if (element === undefined) {
5896
+ return;
5909
5897
  }
5910
5898
 
5911
- if (formConfig.ruleContext) {
5912
- this.config.ruleContext = formConfig.ruleContext;
5899
+ Object(helper["d" /* removeNode */])(evt.item);
5900
+ var newIndex = this.getVmIndex(evt.newIndex);
5901
+ this.spliceList(newIndex, 0, element);
5902
+ this.computeIndexes();
5903
+ var added = {
5904
+ element: element,
5905
+ newIndex: newIndex
5906
+ };
5907
+ this.emitChanges({
5908
+ added: added
5909
+ });
5910
+ },
5911
+ onDragRemove: function onDragRemove(evt) {
5912
+ Object(helper["c" /* insertNodeAt */])(this.rootContainer, evt.item, evt.oldIndex);
5913
+
5914
+ if (evt.pullMode === "clone") {
5915
+ Object(helper["d" /* removeNode */])(evt.clone);
5916
+ return;
5917
+ }
5918
+
5919
+ var oldIndex = this.context.index;
5920
+ this.spliceList(oldIndex, 1);
5921
+ var removed = {
5922
+ element: this.context.element,
5923
+ oldIndex: oldIndex
5924
+ };
5925
+ this.resetTransitionData(oldIndex);
5926
+ this.emitChanges({
5927
+ removed: removed
5928
+ });
5929
+ },
5930
+ onDragUpdate: function onDragUpdate(evt) {
5931
+ Object(helper["d" /* removeNode */])(evt.item);
5932
+ Object(helper["c" /* insertNodeAt */])(evt.from, evt.item, evt.oldIndex);
5933
+ var oldIndex = this.context.index;
5934
+ var newIndex = this.getVmIndex(evt.newIndex);
5935
+ this.updatePosition(oldIndex, newIndex);
5936
+ var moved = {
5937
+ element: this.context.element,
5938
+ oldIndex: oldIndex,
5939
+ newIndex: newIndex
5940
+ };
5941
+ this.emitChanges({
5942
+ moved: moved
5943
+ });
5944
+ },
5945
+ updateProperty: function updateProperty(evt, propertyName) {
5946
+ evt.hasOwnProperty(propertyName) && (evt[propertyName] += this.headerOffset);
5947
+ },
5948
+ computeFutureIndex: function computeFutureIndex(relatedContext, evt) {
5949
+ if (!relatedContext.element) {
5950
+ return 0;
5913
5951
  }
5914
- }
5915
- },
5916
-
5917
- getInputTypes(field) {
5918
- if (!field) {
5919
- return [];
5920
- }
5921
-
5922
- if (field.dict && !this.config.refInputs[field.ref]) {
5923
- return this.config.dictInputs;
5924
- }
5925
-
5926
- if (field.ref) {
5927
- return this.config.refInputs[field.ref];
5928
- }
5929
-
5930
- return this.config.primitiveInputs[field.type];
5931
- },
5932
5952
 
5933
- getDefaultInput(field) {
5934
- let input = null;
5935
-
5936
- if (field.ref && this.config.refInputs[field.ref]) {
5937
- input = __clone(this.config.refInputs[field.ref][0]);
5953
+ var domChildren = _toConsumableArray(evt.to.children).filter(function (el) {
5954
+ return el.style["display"] !== "none";
5955
+ });
5938
5956
 
5939
- __applyDefaultProps(input);
5957
+ var currentDOMIndex = domChildren.indexOf(evt.related);
5958
+ var currentIndex = relatedContext.component.getVmIndex(currentDOMIndex);
5959
+ var draggedInList = domChildren.indexOf(draggingElement) !== -1;
5960
+ return draggedInList || !evt.willInsertAfter ? currentIndex : currentIndex + 1;
5961
+ },
5962
+ onDragMove: function onDragMove(evt, originalEvent) {
5963
+ var onMove = this.move;
5940
5964
 
5941
- if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
5942
- __applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
5965
+ if (!onMove || !this.realList) {
5966
+ return true;
5943
5967
  }
5944
- } else if (field.dict) {
5945
- input = __clone(this.config.dictInputs[0]);
5946
- input.props.dict.default = field.ref;
5947
-
5948
- __applyDefaultProps(input);
5949
- } else {
5950
- input = __clone(this.config.primitiveInputs[field.type][0]);
5951
5968
 
5952
- __applyDefaultProps(input);
5969
+ var relatedContext = this.getRelatedContextFromMoveEvent(evt);
5970
+ var draggedContext = this.context;
5971
+ var futureIndex = this.computeFutureIndex(relatedContext, evt);
5972
+ Object.assign(draggedContext, {
5973
+ futureIndex: futureIndex
5974
+ });
5975
+ var sendEvt = Object.assign({}, evt, {
5976
+ relatedContext: relatedContext,
5977
+ draggedContext: draggedContext
5978
+ });
5979
+ return onMove(sendEvt, originalEvent);
5980
+ },
5981
+ onDragEnd: function onDragEnd() {
5982
+ this.computeIndexes();
5983
+ draggingElement = null;
5953
5984
  }
5985
+ }
5986
+ };
5954
5987
 
5955
- return input;
5956
- },
5957
-
5958
- getInputTypeByName(name, field) {
5959
- let input = JSON.parse(JSON.stringify(this.config.inputs[name]));
5960
-
5961
- if (field.ref && this.config.refInputs[field.ref]) {
5962
- __applyDefaultProps(input);
5963
-
5964
- if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
5965
- __applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
5966
- }
5967
- } else if (field.dict) {
5968
- input.props.dict.default = field.ref;
5988
+ if (typeof window !== "undefined" && "Vue" in window) {
5989
+ window.Vue.component("draggable", draggableComponent);
5990
+ }
5969
5991
 
5970
- __applyDefaultProps(input);
5971
- } else {
5972
- __applyDefaultProps(input);
5973
- }
5992
+ /* harmony default export */ var vuedraggable = (draggableComponent);
5993
+ // CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
5974
5994
 
5975
- input.propsData['ref'] = field.name;
5976
- return input;
5977
- },
5978
5995
 
5979
- getAvailableFieldRules(field) {
5980
- return this.config.rules.filter(rule => {
5981
- return !rule.fields || rule.fields.length === 0 || rule.fields.indexOf(field.name) >= 0;
5982
- });
5983
- },
5996
+ /* harmony default export */ __webpack_exports__["default"] = (vuedraggable);
5984
5997
 
5985
- getRuleContext() {
5986
- return this.config.ruleContext;
5987
- },
5988
5998
 
5989
- runRule(context, script) {
5990
- let appendScript = `
5991
- var doc = this.form.doc;
5992
- var form = this.form;
5993
- var event = this.event;
5994
- var eventName = this.eventName;
5995
-
5996
- `;
5997
5999
 
5998
- let func = function (script) {
5999
- return eval(script);
6000
- };
6000
+ /***/ })
6001
6001
 
6002
- func.call(context, appendScript + script);
6003
- }
6002
+ /******/ })["default"];
6003
+ });
6004
6004
 
6005
- };
6005
+ });
6006
6006
 
6007
6007
  //
6008
6008
  var script$4 = {
@@ -6230,44 +6230,187 @@ for (let i = 0; i < 256; ++i) {
6230
6230
  byteToHex.push((i + 0x100).toString(16).substr(1));
6231
6231
  }
6232
6232
 
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
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
+ }
6245
+
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];
6261
+ }
6262
+
6263
+ return buf;
6264
+ }
6265
+
6266
+ return stringify(rnds);
6267
+ }
6268
+
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
+ });
6299
+ }
6300
+ }
6301
+
6302
+ },
6303
+
6304
+ created() {
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
+ });
6313
+ }
6314
+ }
6315
+
6316
+ };
6317
+
6318
+ /* script */
6319
+ const __vue_script__$3 = script$3;
6320
+ /* template */
6321
+
6322
+ var __vue_render__$3 = function () {
6323
+ var _vm = this;
6324
+
6325
+ var _h = _vm.$createElement;
6326
+
6327
+ var _c = _vm._self._c || _h;
6328
+
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 */
6241
6388
 
6242
- if (!validate(uuid)) {
6243
- throw TypeError('Stringified UUID is invalid');
6244
- }
6389
+ const __vue_inject_styles__$3 = undefined;
6390
+ /* scoped */
6245
6391
 
6246
- return uuid;
6247
- }
6392
+ const __vue_scope_id__$3 = undefined;
6393
+ /* module identifier */
6248
6394
 
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`
6395
+ const __vue_module_identifier__$3 = undefined;
6396
+ /* functional template */
6252
6397
 
6253
- rnds[6] = rnds[6] & 0x0f | 0x40;
6254
- rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
6398
+ const __vue_is_functional_template__$3 = false;
6399
+ /* style inject */
6255
6400
 
6256
- if (buf) {
6257
- offset = offset || 0;
6401
+ /* style inject SSR */
6258
6402
 
6259
- for (let i = 0; i < 16; ++i) {
6260
- buf[offset + i] = rnds[i];
6261
- }
6403
+ /* style inject shadow dom */
6262
6404
 
6263
- return buf;
6264
- }
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);
6265
6409
 
6266
- return stringify(rnds);
6267
- }
6410
+ var DocForm = __vue_component__$4;
6268
6411
 
6269
6412
  //
6270
- var script$3 = {
6413
+ var script$2 = {
6271
6414
  name: 'FieldRuleFormModal',
6272
6415
  components: {
6273
6416
  DocForm
@@ -6397,7 +6540,7 @@ var script$3 = {
6397
6540
 
6398
6541
  addCallInputFunction(field) {
6399
6542
  let r = this.innerRule;
6400
- let setVariableScript = `form.$refs['${field.name}'].Название функции();`;
6543
+ let setVariableScript = `form.$refs['${field.name}'][0].Название функции();`;
6401
6544
  r.script = r.script ? r.script + setVariableScript : setVariableScript;
6402
6545
  },
6403
6546
 
@@ -6434,10 +6577,10 @@ var script$3 = {
6434
6577
  };
6435
6578
 
6436
6579
  /* script */
6437
- const __vue_script__$3 = script$3;
6580
+ const __vue_script__$2 = script$2;
6438
6581
  /* template */
6439
6582
 
6440
- var __vue_render__$3 = function () {
6583
+ var __vue_render__$2 = function () {
6441
6584
  var _vm = this;
6442
6585
 
6443
6586
  var _h = _vm.$createElement;
@@ -6668,34 +6811,34 @@ var __vue_render__$3 = function () {
6668
6811
  })], 1) : _vm._e()], 1)], 1)], 1);
6669
6812
  };
6670
6813
 
6671
- var __vue_staticRenderFns__$3 = [];
6814
+ var __vue_staticRenderFns__$2 = [];
6672
6815
  /* style */
6673
6816
 
6674
- const __vue_inject_styles__$3 = undefined;
6817
+ const __vue_inject_styles__$2 = undefined;
6675
6818
  /* scoped */
6676
6819
 
6677
- const __vue_scope_id__$3 = undefined;
6820
+ const __vue_scope_id__$2 = undefined;
6678
6821
  /* module identifier */
6679
6822
 
6680
- const __vue_module_identifier__$3 = undefined;
6823
+ const __vue_module_identifier__$2 = undefined;
6681
6824
  /* functional template */
6682
6825
 
6683
- const __vue_is_functional_template__$3 = false;
6826
+ const __vue_is_functional_template__$2 = false;
6684
6827
  /* style inject */
6685
6828
 
6686
6829
  /* style inject SSR */
6687
6830
 
6688
6831
  /* style inject shadow dom */
6689
6832
 
6690
- const __vue_component__$4 = /*#__PURE__*/normalizeComponent({
6691
- render: __vue_render__$3,
6692
- staticRenderFns: __vue_staticRenderFns__$3
6693
- }, __vue_inject_styles__$3, __vue_script__$3, __vue_scope_id__$3, __vue_is_functional_template__$3, __vue_module_identifier__$3, false, undefined, undefined, undefined);
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);
6694
6837
 
6695
- var FieldRuleFormModal = __vue_component__$4;
6838
+ var FieldRuleFormModal = __vue_component__$3;
6696
6839
 
6697
6840
  //
6698
- var script$2 = {
6841
+ var script$1 = {
6699
6842
  name: 'DocTemplateFieldSidebar',
6700
6843
  components: {
6701
6844
  FieldRuleFormModal
@@ -6852,10 +6995,10 @@ var script$2 = {
6852
6995
  };
6853
6996
 
6854
6997
  /* script */
6855
- const __vue_script__$2 = script$2;
6998
+ const __vue_script__$1 = script$1;
6856
6999
  /* template */
6857
7000
 
6858
- var __vue_render__$2 = function () {
7001
+ var __vue_render__$1 = function () {
6859
7002
  var _vm = this;
6860
7003
 
6861
7004
  var _h = _vm.$createElement;
@@ -7115,34 +7258,34 @@ var __vue_render__$2 = function () {
7115
7258
  })], 1);
7116
7259
  };
7117
7260
 
7118
- var __vue_staticRenderFns__$2 = [];
7261
+ var __vue_staticRenderFns__$1 = [];
7119
7262
  /* style */
7120
7263
 
7121
- const __vue_inject_styles__$2 = undefined;
7264
+ const __vue_inject_styles__$1 = undefined;
7122
7265
  /* scoped */
7123
7266
 
7124
- const __vue_scope_id__$2 = undefined;
7267
+ const __vue_scope_id__$1 = undefined;
7125
7268
  /* module identifier */
7126
7269
 
7127
- const __vue_module_identifier__$2 = undefined;
7270
+ const __vue_module_identifier__$1 = undefined;
7128
7271
  /* functional template */
7129
7272
 
7130
- const __vue_is_functional_template__$2 = false;
7273
+ const __vue_is_functional_template__$1 = false;
7131
7274
  /* style inject */
7132
7275
 
7133
7276
  /* style inject SSR */
7134
7277
 
7135
7278
  /* style inject shadow dom */
7136
7279
 
7137
- const __vue_component__$3 = /*#__PURE__*/normalizeComponent({
7138
- render: __vue_render__$2,
7139
- staticRenderFns: __vue_staticRenderFns__$2
7140
- }, __vue_inject_styles__$2, __vue_script__$2, __vue_scope_id__$2, __vue_is_functional_template__$2, __vue_module_identifier__$2, false, undefined, undefined, undefined);
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);
7141
7284
 
7142
- var DocTemplateFieldSidebar = __vue_component__$3;
7285
+ var DocTemplateFieldSidebar = __vue_component__$2;
7143
7286
 
7144
7287
  //
7145
- var script$1 = {
7288
+ var script = {
7146
7289
  name: 'DocTemplateConstructor',
7147
7290
  components: {
7148
7291
  DocTemplateFacetList,
@@ -7336,10 +7479,10 @@ var script$1 = {
7336
7479
  };
7337
7480
 
7338
7481
  /* script */
7339
- const __vue_script__$1 = script$1;
7482
+ const __vue_script__ = script;
7340
7483
  /* template */
7341
7484
 
7342
- var __vue_render__$1 = function () {
7485
+ var __vue_render__ = function () {
7343
7486
  var _vm = this;
7344
7487
 
7345
7488
  var _h = _vm.$createElement;
@@ -7570,149 +7713,6 @@ var __vue_render__$1 = function () {
7570
7713
  })], 1)], 1);
7571
7714
  };
7572
7715
 
7573
- var __vue_staticRenderFns__$1 = [];
7574
- /* style */
7575
-
7576
- const __vue_inject_styles__$1 = undefined;
7577
- /* scoped */
7578
-
7579
- const __vue_scope_id__$1 = undefined;
7580
- /* module identifier */
7581
-
7582
- const __vue_module_identifier__$1 = undefined;
7583
- /* functional template */
7584
-
7585
- const __vue_is_functional_template__$1 = false;
7586
- /* style inject */
7587
-
7588
- /* style inject SSR */
7589
-
7590
- /* style inject shadow dom */
7591
-
7592
- const __vue_component__$1 = /*#__PURE__*/normalizeComponent({
7593
- render: __vue_render__$1,
7594
- staticRenderFns: __vue_staticRenderFns__$1
7595
- }, __vue_inject_styles__$1, __vue_script__$1, __vue_scope_id__$1, __vue_is_functional_template__$1, __vue_module_identifier__$1, false, undefined, undefined, undefined);
7596
-
7597
- var __vue_component__$2 = __vue_component__$1;
7598
-
7599
- //
7600
- var script = {
7601
- name: 'DocForm',
7602
- props: {
7603
- formConfig: Object,
7604
- applyDefaultValues: {
7605
- type: Boolean,
7606
- default: true
7607
- },
7608
- doc: {
7609
- type: Object,
7610
- default: () => ({})
7611
- },
7612
- validationState: {
7613
- type: Object,
7614
- default: () => ({})
7615
- }
7616
- },
7617
- methods: {
7618
- onEventFired(eventName, event, field) {
7619
- if (field.rules) {
7620
- field.rules.forEach(rule => {
7621
- if (rule.event === eventName && rule.script) {
7622
- let ruleContext = UtFormConstructor.getRuleContext();
7623
- ruleContext.form = this;
7624
- ruleContext.event = event;
7625
- ruleContext.eventName = eventName;
7626
- UtFormConstructor.runRule(ruleContext, rule.script);
7627
- }
7628
- });
7629
- }
7630
- }
7631
-
7632
- },
7633
-
7634
- created() {
7635
- if (this.applyDefaultValues) {
7636
- this.formConfig.sections.forEach(r => {
7637
- r.columns.forEach(c => {
7638
- c.fields.forEach(f => {
7639
- this.$set(this.doc, f.name, f.defaultValue == null ? null : f.defaultValue);
7640
- });
7641
- });
7642
- });
7643
- }
7644
- }
7645
-
7646
- };
7647
-
7648
- /* script */
7649
- const __vue_script__ = script;
7650
- /* template */
7651
-
7652
- var __vue_render__ = function () {
7653
- var _vm = this;
7654
-
7655
- var _h = _vm.$createElement;
7656
-
7657
- var _c = _vm._self._c || _h;
7658
-
7659
- return _c('b-form', {
7660
- staticClass: "rb-doc-form"
7661
- }, _vm._l(_vm.formConfig.sections, function (section) {
7662
- return _c('div', {
7663
- key: section.labelRu,
7664
- staticClass: "rb-form-section"
7665
- }, [_c('h4', [_vm._v(_vm._s(section.labelRu))]), _vm._v(" "), _c('div', {
7666
- staticClass: "d-flex flex-row"
7667
- }, _vm._l(section.columns, function (column) {
7668
- return _c('div', {
7669
- key: column.index,
7670
- staticClass: "rb-form-column"
7671
- }, [_vm._l(column.fields, function (field) {
7672
- return [field.visible ? _c('b-form-row', {
7673
- key: field.name
7674
- }, [_c('b-col', {
7675
- attrs: {
7676
- "lg": "12"
7677
- }
7678
- }, [_c('b-form-group', {
7679
- ref: "inputContainer",
7680
- refInFor: true,
7681
- attrs: {
7682
- "label": field.labelRu
7683
- }
7684
- }, [_c(field.input.type, _vm._b({
7685
- ref: field.name,
7686
- refInFor: true,
7687
- tag: "component",
7688
- attrs: {
7689
- "disabled": !field.editable,
7690
- "state": _vm.validationState[field.name]
7691
- },
7692
- on: {
7693
- "input": function ($event) {
7694
- return _vm.onEventFired('input', $event, field);
7695
- },
7696
- "change": function ($event) {
7697
- return _vm.onEventFired('change', $event, field);
7698
- },
7699
- "click": function ($event) {
7700
- return _vm.onEventFired('click', $event, field);
7701
- }
7702
- },
7703
- model: {
7704
- value: _vm.doc[field.name],
7705
- callback: function ($$v) {
7706
- _vm.$set(_vm.doc, field.name, $$v);
7707
- },
7708
- expression: "doc[field.name]"
7709
- }
7710
- }, 'component', field.input.propsData, false))], 1)], 1)], 1) : _vm._e()];
7711
- })], 2);
7712
- }), 0)]);
7713
- }), 0);
7714
- };
7715
-
7716
7716
  var __vue_staticRenderFns__ = [];
7717
7717
  /* style */
7718
7718
 
@@ -7737,17 +7737,19 @@ const __vue_component__ = /*#__PURE__*/normalizeComponent({
7737
7737
  staticRenderFns: __vue_staticRenderFns__
7738
7738
  }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, false, undefined, undefined, undefined);
7739
7739
 
7740
- var DocForm = __vue_component__;
7740
+ var __vue_component__$1 = __vue_component__;
7741
7741
 
7742
7742
  /* eslint-disable import/prefer-default-export */
7743
7743
 
7744
7744
  var components = /*#__PURE__*/Object.freeze({
7745
7745
  __proto__: null,
7746
7746
  UtFormConfig: UtFormConfig,
7747
+ UtFormConstructor: UtFormConstructor,
7747
7748
  DocTemplateSectionModal: DocTemplateSectionModal,
7748
7749
  DocTemplateFacetList: DocTemplateFacetList,
7749
7750
  DocTemplateFieldSidebar: DocTemplateFieldSidebar,
7750
- DocTemplateConstructor: __vue_component__$2,
7751
+ DocTemplateConstructor: __vue_component__$1,
7752
+ FieldRuleFormModal: FieldRuleFormModal,
7751
7753
  DocForm: DocForm
7752
7754
  });
7753
7755
 
@@ -7760,4 +7762,4 @@ const install = function installRbDocumentFormConstructor(Vue) {
7760
7762
  });
7761
7763
  }; // Create module definition for Vue.use()
7762
7764
 
7763
- export { DocForm, __vue_component__$2 as DocTemplateConstructor, DocTemplateFacetList, DocTemplateFieldSidebar, DocTemplateSectionModal, UtFormConfig, install as default };
7765
+ export { DocForm, __vue_component__$1 as DocTemplateConstructor, DocTemplateFacetList, DocTemplateFieldSidebar, DocTemplateSectionModal, FieldRuleFormModal, UtFormConfig, UtFormConstructor, install as default };