rb-document-form-constructor 0.1.1 → 0.1.2
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.
|
@@ -214,17 +214,17 @@ const UtFormConfig = {
|
|
|
214
214
|
getDefaultInput(field) {
|
|
215
215
|
let input = null;
|
|
216
216
|
|
|
217
|
-
if (field.
|
|
218
|
-
input = __clone(this.config.dictInputs[0]);
|
|
219
|
-
input.props.dict.default = field.ref;
|
|
220
|
-
this.applyDefaultProps(input);
|
|
221
|
-
} else if (field.ref && this.config.refInputs[field.ref]) {
|
|
217
|
+
if (field.ref && this.config.refInputs[field.ref]) {
|
|
222
218
|
input = __clone(this.config.refInputs[field.ref][0]);
|
|
223
219
|
this.applyDefaultProps(input);
|
|
224
220
|
|
|
225
221
|
if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
|
|
226
222
|
this.applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
|
|
227
223
|
}
|
|
224
|
+
} else if (field.dict) {
|
|
225
|
+
input = __clone(this.config.dictInputs[0]);
|
|
226
|
+
input.props.dict.default = field.ref;
|
|
227
|
+
this.applyDefaultProps(input);
|
|
228
228
|
} else {
|
|
229
229
|
input = __clone(this.config.primitiveInputs[field.type][0]);
|
|
230
230
|
this.applyDefaultProps(input);
|
|
@@ -236,15 +236,15 @@ const UtFormConfig = {
|
|
|
236
236
|
getInputTypeByName(name, field) {
|
|
237
237
|
let input = JSON.parse(JSON.stringify(this.config.inputs[name]));
|
|
238
238
|
|
|
239
|
-
if (field.
|
|
240
|
-
input.props.dict.default = field.ref;
|
|
241
|
-
this.applyDefaultProps(input);
|
|
242
|
-
} else if (field.ref) {
|
|
239
|
+
if (field.ref && this.config.refInputConfigs[field.ref]) {
|
|
243
240
|
this.applyDefaultProps(input);
|
|
244
241
|
|
|
245
242
|
if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
|
|
246
243
|
this.applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
|
|
247
244
|
}
|
|
245
|
+
} else if (field.dict) {
|
|
246
|
+
input.props.dict.default = field.ref;
|
|
247
|
+
this.applyDefaultProps(input);
|
|
248
248
|
} else {
|
|
249
249
|
this.applyDefaultProps(input);
|
|
250
250
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var RbDocumentFormConstructor=function(){"use strict";function t(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function e(e){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?t(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):t(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function n(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var o,r,i=[],a=!0,l=!1;try{for(n=n.call(t);!(a=(o=n.next()).done)&&(i.push(o.value),!e||i.length!==e);a=!0);}catch(t){l=!0,r=t}finally{try{a||null==n.return||n.return()}finally{if(l)throw r}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}var i=function(t){return JSON.parse(JSON.stringify(t))},a=function(){return a=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},a.apply(this,arguments)},l={text:{text:"Текст",name:"text",type:"b-form-input",props:{placeholder:{type:"string",default:null,label:"Надпись внутри",visible:!0},type:{type:"string",default:"text",label:"Тип данных",visible:!1}},propsData:{},defaultValue:null},number:{text:"Число",name:"number",type:"b-form-input",props:{placeholder:{type:"string",default:null,label:"Надпись внутри",visible:!0},type:{type:"string",default:"number",label:"Тип данных",visible:!1}},propsData:{},defaultValue:null},memo:{text:"Большой текст",name:"memo",type:"b-form-textarea",props:{placeholder:{type:"string",default:null,label:"Надпись внутри",visible:!0}},propsData:{},defaultValue:null},date:{text:"Дата",name:"date",type:"rb-date-picker-input",props:{},propsData:{},defaultValue:null},phone:{text:"Телефон",name:"phone",type:"rb-phone-input",props:{placeholder:{type:"string",default:"Телефон",label:"Надпись внутри",visible:!0}},propsData:{},defaultValue:null}},s={text:[i(l.text),i(l.number),i(l.memo),i(l.phone)],memo:[i(l.memo),i(l.text)],number:[i(l.text),i(l.number)],date:[i(l.date)]},c={inputs:i(l),primitiveInputs:i(s),dictInputs:i([]),refInputs:i({}),refInputConfigs:i({}),icons:{iconExpandFacet:"icon-chevron-up",iconCollapseFacet:"icon-chevron-down",iconCloseFieldSidebar:"icon-chevron-right",iconOpenFieldSidebar:"icon-chevron-left",iconAdd:"icon-add",iconEdit:"icon-edit",iconDelete:"icon-delete",iconDrag:"icon-reorder"}},u={config:{},init:function(t){this.config=i(c),t&&(t.inputs&&this.mergeInputsInMap(this.config.inputs,t.inputs),t.primitiveInputs&&this.mergeInputInMapOfArrays(this.config.primitiveInputs,t.primitiveInputs),t.dictInputs&&this.mergeInputsInArray(this.config.dictInputs,t.dictInputs),t.refInputs&&this.mergeInputInMapOfArrays(this.config.refInputs,t.refInputs),t.refInputConfigs&&(this.config.refInputConfigs=t.refInputConfigs),t.icons&&(this.config.icons=a(this.config.icons,t.icons)))},mergeInputInMapOfArrays:function(t,e){for(var n in e){var o=t[n];o?this.mergeInputsInArray(o,e[n]):t[n]=e[n]}},mergeInputsInMap:function(t,e){for(var n in e)t[n]=a(t[n]?t[n]:{},e[n]?e[n]:{})},mergeInputsInArray:function(t,e){e.forEach((function(e){var n=t.findIndex((function(t){return t.name===e.name}));n>=0?t[n]=e:t.push(e)}))},getAllInputTypes:function(){return this.config.inputs},getAllDictInputs:function(){return this.config.dictInputs},getInputTypes:function(t){return t?t.dict?this.config.dictInputs:t.ref?this.config.refInputs[t.ref]:this.config.primitiveInputs[t.type]:[]},getDefaultInput:function(t){var e=null;return t.
|
|
1
|
+
var RbDocumentFormConstructor=function(){"use strict";function t(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function e(e){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?t(Object(r),!0).forEach((function(t){n(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):t(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function n(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var o,r,i=[],a=!0,l=!1;try{for(n=n.call(t);!(a=(o=n.next()).done)&&(i.push(o.value),!e||i.length!==e);a=!0);}catch(t){l=!0,r=t}finally{try{a||null==n.return||n.return()}finally{if(l)throw r}}return i}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return r(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);"Object"===n&&t.constructor&&(n=t.constructor.name);if("Map"===n||"Set"===n)return Array.from(t);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(t,e)}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,o=new Array(e);n<e;n++)o[n]=t[n];return o}var i=function(t){return JSON.parse(JSON.stringify(t))},a=function(){return a=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var r in e=arguments[n])Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t},a.apply(this,arguments)},l={text:{text:"Текст",name:"text",type:"b-form-input",props:{placeholder:{type:"string",default:null,label:"Надпись внутри",visible:!0},type:{type:"string",default:"text",label:"Тип данных",visible:!1}},propsData:{},defaultValue:null},number:{text:"Число",name:"number",type:"b-form-input",props:{placeholder:{type:"string",default:null,label:"Надпись внутри",visible:!0},type:{type:"string",default:"number",label:"Тип данных",visible:!1}},propsData:{},defaultValue:null},memo:{text:"Большой текст",name:"memo",type:"b-form-textarea",props:{placeholder:{type:"string",default:null,label:"Надпись внутри",visible:!0}},propsData:{},defaultValue:null},date:{text:"Дата",name:"date",type:"rb-date-picker-input",props:{},propsData:{},defaultValue:null},phone:{text:"Телефон",name:"phone",type:"rb-phone-input",props:{placeholder:{type:"string",default:"Телефон",label:"Надпись внутри",visible:!0}},propsData:{},defaultValue:null}},s={text:[i(l.text),i(l.number),i(l.memo),i(l.phone)],memo:[i(l.memo),i(l.text)],number:[i(l.text),i(l.number)],date:[i(l.date)]},c={inputs:i(l),primitiveInputs:i(s),dictInputs:i([]),refInputs:i({}),refInputConfigs:i({}),icons:{iconExpandFacet:"icon-chevron-up",iconCollapseFacet:"icon-chevron-down",iconCloseFieldSidebar:"icon-chevron-right",iconOpenFieldSidebar:"icon-chevron-left",iconAdd:"icon-add",iconEdit:"icon-edit",iconDelete:"icon-delete",iconDrag:"icon-reorder"}},u={config:{},init:function(t){this.config=i(c),t&&(t.inputs&&this.mergeInputsInMap(this.config.inputs,t.inputs),t.primitiveInputs&&this.mergeInputInMapOfArrays(this.config.primitiveInputs,t.primitiveInputs),t.dictInputs&&this.mergeInputsInArray(this.config.dictInputs,t.dictInputs),t.refInputs&&this.mergeInputInMapOfArrays(this.config.refInputs,t.refInputs),t.refInputConfigs&&(this.config.refInputConfigs=t.refInputConfigs),t.icons&&(this.config.icons=a(this.config.icons,t.icons)))},mergeInputInMapOfArrays:function(t,e){for(var n in e){var o=t[n];o?this.mergeInputsInArray(o,e[n]):t[n]=e[n]}},mergeInputsInMap:function(t,e){for(var n in e)t[n]=a(t[n]?t[n]:{},e[n]?e[n]:{})},mergeInputsInArray:function(t,e){e.forEach((function(e){var n=t.findIndex((function(t){return t.name===e.name}));n>=0?t[n]=e:t.push(e)}))},getAllInputTypes:function(){return this.config.inputs},getAllDictInputs:function(){return this.config.dictInputs},getInputTypes:function(t){return t?t.dict?this.config.dictInputs:t.ref?this.config.refInputs[t.ref]:this.config.primitiveInputs[t.type]:[]},getDefaultInput:function(t){var e=null;return t.ref&&this.config.refInputs[t.ref]?(e=i(this.config.refInputs[t.ref][0]),this.applyDefaultProps(e),this.config.refInputConfigs[t.ref]&&this.config.refInputConfigs[t.ref][e.name]&&this.applyRefProps(e,this.config.refInputConfigs[t.ref][e.name])):t.dict?((e=i(this.config.dictInputs[0])).props.dict.default=t.ref,this.applyDefaultProps(e)):(e=i(this.config.primitiveInputs[t.type][0]),this.applyDefaultProps(e)),e},getInputTypeByName:function(t,e){var n=JSON.parse(JSON.stringify(this.config.inputs[t]));return e.ref&&this.config.refInputConfigs[e.ref]?(this.applyDefaultProps(n),this.config.refInputConfigs[e.ref]&&this.config.refInputConfigs[e.ref][n.name]&&this.applyRefProps(n,this.config.refInputConfigs[e.ref][n.name])):e.dict?(n.props.dict.default=e.ref,this.applyDefaultProps(n)):this.applyDefaultProps(n),n},applyDefaultProps:function(t){for(var e in t.props)t.propsData[e]=t.props[e].default},applyRefProps:function(t,e){if(null!=e&&e.propsData)for(var n in e.propsData)t.propsData[n]=e.propsData[n]},parseFacets:function(t){var e=[];return t.sections.every((function(t){t.columns.every((function(t){t.fields.forEach((function(t){e.indexOf(t.facet)>=0||e.push(t.facet)}))}))})),e}};function f(t,e,n,o,r,i,a,l,s,c){"boolean"!=typeof a&&(s=l,l=a,a=!1);const u="function"==typeof n?n.options:n;let f;if(t&&t.render&&(u.render=t.render,u.staticRenderFns=t.staticRenderFns,u._compiled=!0,r&&(u.functional=!0)),o&&(u._scopeId=o),i?(f=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),e&&e.call(this,s(t)),t&&t._registeredComponents&&t._registeredComponents.add(i)},u._ssrRegister=f):e&&(f=a?function(t){e.call(this,c(t,this.$root.$options.shadowRoot))}:function(t){e.call(this,l(t))}),f)if(u.functional){const t=u.render;u.render=function(e,n){return f.call(n),t(e,n)}}else{const t=u.beforeCreate;u.beforeCreate=t?[].concat(t,f):[f]}return n}var d=f({render:function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("b-modal",{attrs:{id:"rb-doc-template-section-modal","modal-class":"rb-doc-template-section-modal","ok-title":"Сохранить изменения","cancel-variant":"outline-gray","cancel-title":"Отмена",title:t.title},on:{ok:function(e){return e.preventDefault(),t.onOk.apply(null,arguments)}}},[n("b-form",{on:{submit:function(e){return e.preventDefault(),t.onOk.apply(null,arguments)}}},[n("b-form-row",[n("b-col",{attrs:{lg:"12"}},[n("b-form-group",{attrs:{label:"Наименование секции"}},[n("b-form-input",{model:{value:t.label,callback:function(e){t.label=e},expression:"label"}})],1)],1)],1)],1)],1)},staticRenderFns:[]},undefined,{name:"DocTemplateSectionModal",props:{section:Object,mode:{type:String,default:"ins"},onAfterOk:{type:Function,default:function(){}}},data:function(){return{id:"rb-doc-template-section-modal",label:null}},computed:{title:function(){return"ins"===this.mode?"Добавление секции":"Редактирование секции"}},watch:{section:function(){this.section&&(this.label=this.section.labelRu)}},methods:{onOk:function(){var t=this;this.section.labelRu=this.label,this.onAfterOk&&this.onAfterOk(),this.$nextTick((function(){t.$bvModal.hide(t.id)}))}},created:function(){this.section&&(this.label=this.section.labelRu)}},undefined,false,undefined,!1,void 0,void 0,void 0),p=d;"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self&&self;
|
|
2
2
|
/**!
|
|
3
3
|
* Sortable 1.10.2
|
|
4
4
|
* @author RubaXa <trash@rubaxa.org>
|
|
@@ -320,17 +320,17 @@ var UtFormConfig = {
|
|
|
320
320
|
getDefaultInput: function getDefaultInput(field) {
|
|
321
321
|
var input = null;
|
|
322
322
|
|
|
323
|
-
if (field.
|
|
324
|
-
input = __clone(this.config.dictInputs[0]);
|
|
325
|
-
input.props.dict.default = field.ref;
|
|
326
|
-
this.applyDefaultProps(input);
|
|
327
|
-
} else if (field.ref && this.config.refInputs[field.ref]) {
|
|
323
|
+
if (field.ref && this.config.refInputs[field.ref]) {
|
|
328
324
|
input = __clone(this.config.refInputs[field.ref][0]);
|
|
329
325
|
this.applyDefaultProps(input);
|
|
330
326
|
|
|
331
327
|
if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
|
|
332
328
|
this.applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
|
|
333
329
|
}
|
|
330
|
+
} else if (field.dict) {
|
|
331
|
+
input = __clone(this.config.dictInputs[0]);
|
|
332
|
+
input.props.dict.default = field.ref;
|
|
333
|
+
this.applyDefaultProps(input);
|
|
334
334
|
} else {
|
|
335
335
|
input = __clone(this.config.primitiveInputs[field.type][0]);
|
|
336
336
|
this.applyDefaultProps(input);
|
|
@@ -341,15 +341,15 @@ var UtFormConfig = {
|
|
|
341
341
|
getInputTypeByName: function getInputTypeByName(name, field) {
|
|
342
342
|
var input = JSON.parse(JSON.stringify(this.config.inputs[name]));
|
|
343
343
|
|
|
344
|
-
if (field.
|
|
345
|
-
input.props.dict.default = field.ref;
|
|
346
|
-
this.applyDefaultProps(input);
|
|
347
|
-
} else if (field.ref) {
|
|
344
|
+
if (field.ref && this.config.refInputConfigs[field.ref]) {
|
|
348
345
|
this.applyDefaultProps(input);
|
|
349
346
|
|
|
350
347
|
if (this.config.refInputConfigs[field.ref] && this.config.refInputConfigs[field.ref][input.name]) {
|
|
351
348
|
this.applyRefProps(input, this.config.refInputConfigs[field.ref][input.name]);
|
|
352
349
|
}
|
|
350
|
+
} else if (field.dict) {
|
|
351
|
+
input.props.dict.default = field.ref;
|
|
352
|
+
this.applyDefaultProps(input);
|
|
353
353
|
} else {
|
|
354
354
|
this.applyDefaultProps(input);
|
|
355
355
|
}
|