rb-document-form-constructor 0.1.2 → 0.1.3

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.
@@ -200,7 +200,7 @@ const UtFormConfig = {
200
200
  return [];
201
201
  }
202
202
 
203
- if (field.dict) {
203
+ if (field.dict && !this.config.refInputs[field.ref]) {
204
204
  return this.config.dictInputs;
205
205
  }
206
206
 
@@ -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.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;
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.refInputs[t.ref]?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>
@@ -307,7 +307,7 @@ var UtFormConfig = {
307
307
  return [];
308
308
  }
309
309
 
310
- if (field.dict) {
310
+ if (field.dict && !this.config.refInputs[field.ref]) {
311
311
  return this.config.dictInputs;
312
312
  }
313
313
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rb-document-form-constructor",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "",
5
5
  "main": "dist/rb-document-form-constructor.ssr.js",
6
6
  "browser": "dist/rb-document-form-constructor.esm.js",