@vue-interface/input-field 0.11.4 → 0.11.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/input-field.es.js
CHANGED
package/dist/input-field.umd.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(h,p){typeof exports=="object"&&typeof module!="undefined"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(h=typeof globalThis!="undefined"?globalThis:h||self,p(h.InputField={}))})(this,function(h){"use strict";var p={props:{dropShadow:[Boolean,String],dropShadowableClassPrefix:{type:String,default:"drop-shadow"},shadow:[Boolean,String],shadowableClassPrefix:{type:String,default:"shadow"}},computed:{shadowableClass(){const
|
|
1
|
+
(function(h,p){typeof exports=="object"&&typeof module!="undefined"?p(exports):typeof define=="function"&&define.amd?define(["exports"],p):(h=typeof globalThis!="undefined"?globalThis:h||self,p(h.InputField={}))})(this,function(h){"use strict";var p={props:{dropShadow:[Boolean,String],dropShadowableClassPrefix:{type:String,default:"drop-shadow"},shadow:[Boolean,String],shadowableClassPrefix:{type:String,default:"shadow"}},computed:{shadowableClass(){const e=this.dropShadow===!0?"":this.dropShadow&&`-${this.dropShadow}`,t=this.shadow===!0?"":this.shadow&&`-${this.shadow}`;return{[`${this.dropShadowableClassPrefix}${e}`]:!!this.dropShadow,[`${this.shadowableClassPrefix}${t}`]:!!this.shadow}}}};/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
12
12
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
13
13
|
PERFORMANCE OF THIS SOFTWARE.
|
|
14
|
-
***************************************************************************** */var y=function(){return y=Object.assign||function(
|
|
15
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var g=function(){return g=Object.assign||function(r){for(var i,n=1,o=arguments.length;n<o;n++){i=arguments[n];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])}return r},g.apply(this,arguments)};function X(
|
|
14
|
+
***************************************************************************** */var y=function(){return y=Object.assign||function(t){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},y.apply(this,arguments)};function z(e){return e.toLowerCase()}var N=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],L=/[^A-Z0-9]+/gi;function B(e,t){t===void 0&&(t={});for(var r=t.splitRegexp,i=r===void 0?N:r,n=t.stripRegexp,o=n===void 0?L:n,s=t.transform,c=s===void 0?z:s,a=t.delimiter,u=a===void 0?" ":a,d=$($(e,i,"$1\0$2"),o,"\0"),f=0,l=d.length;d.charAt(f)==="\0";)f++;for(;d.charAt(l-1)==="\0";)l--;return d.slice(f,l).split("\0").map(c).join(u)}function $(e,t,r){return t instanceof RegExp?e.replace(t,r):t.reduce(function(i,n){return i.replace(n,r)},e)}function V(e,t){return t===void 0&&(t={}),B(e,y({delimiter:"."},t))}function w(e,t){return t===void 0&&(t={}),V(e,y({delimiter:"-"},t))}function C(e,t,r="-"){const i=t.toString().replace(new RegExp(`^${e}${r}?`),"");return[w(i),e].filter(n=>!!n).join(r)}function A(e){return!Array.isArray(e)&&typeof e=="object"}var H={directives:{bindEvents:{bind(e,t,r){if(e.addEventListener("focus",()=>{r.context.hasFocus=!0}),e.addEventListener("blur",()=>{r.context.hasFocus=!1}),e.addEventListener(e.tagName==="SELECT"?"change":"input",i=>{r.context.isEmpty=!e.value,r.context.currentValue=e.value}),r.context.hasChanged=!!e.value,r.context.bindEvents.forEach(i=>{e.addEventListener(i,n=>{r.context.$emit(i,n)})}),e.tagName==="SELECT"){const i=e.querySelector('[value=""]');i&&i.value===e.value&&(r.context.defaultEmpty=!0)}}}},mixins:[p],inheritAttrs:!1,props:{activity:{type:Boolean,default:!1},bindEvents:{type:Array,default(){return["focus","blur","change","click","keypress","keyup","keydown","progress","paste"]}},componentName:{type:String,default(){return this.$options.name}},defaultControlClass:{type:String,default:"form-control"},defaultValue:{default:null},error:[Boolean,String],errors:{type:Object,default(){return{}}},feedback:[String,Array],group:{type:Boolean,default:!0},helpText:[Number,String],hideLabel:Boolean,indicator:{type:String,default:"spinner"},indicatorSize:String,inline:Boolean,invalid:Boolean,label:[Number,String],labelClass:{type:[Object,String],default:"form-label"},pill:Boolean,plaintext:Boolean,size:String,spacing:String,valid:Boolean,value:{default:null}},data(){return{currentValue:this.value||this.defaultValue,defaultEmpty:!1,hasChanged:!1,hasFocus:!1,isEmpty:!(this.value||this.defaultValue)}},computed:{id(){return this.$attrs.id||this.$attrs.name},controlAttributes(){return Object.keys(this.$attrs).concat([["id",this.id],["class",this.controlClasses]]).reduce((e,t)=>(Array.isArray(t)?e[t[0]]=t[1]:e[t]=this[t]||this.$attrs[t],e),{})},controlClass(){return this.defaultControlClass},controlSizeClass(){return C(this.size,this.controlClass)},formGroupClasses(){return{[w(this.componentName)]:!!this.componentName,[this.size&&C(this.size,this.componentName)]:!!this.size,"default-empty":this.defaultEmpty,"form-group":this.group,[this.size&&C(this.size,"form-group")]:!!this.size,"has-activity":this.activity,"has-changed":this.hasChanged,"has-focus":this.hasFocus,"is-empty":this.isEmpty,"is-invalid":!!(this.invalid||this.invalidFeedback),"is-valid":!!(this.valid||this.validFeedback)}},controlClasses(){return Object.assign({[this.controlClass]:!!this.controlClass,[this.controlSizeClass]:!!this.controlSizeClass,"form-control-icon":!!this.$slots.icon,"is-valid":!!(this.valid||this.validFeedback),"is-invalid":!!(this.invalid||this.invalidFeedback),[this.pillClasses]:this.pill,[this.plaintextClass]:this.plaintext,[this.spacing]:!!this.spacing},this.shadowableClass)},hasDefaultSlot(){return!!this.$slots.default},invalidFeedback(){if(this.error)return this.error;const e=this.getFieldErrors();return Array.isArray(e)?e.filter(t=>t&&typeof t=="string").join("<br>"):e},pillClasses(){return"rounded rounded-pill"},plaintextClass(){return"form-control-plaintext"},validFeedback(){return Array.isArray(this.feedback)?this.feedback.join("<br>"):this.feedback}},watch:{hasFocus(){this.getInputField().readOnly||(this.hasChanged=!0)},value(e){this.currentValue=e},currentValue(){this.hasChanged=!0}},mounted(){this.value===null&&this.defaultValue!==null&&this.$emit("input",this.defaultValue)},methods:{blur(){this.getInputField()&&this.getInputField().blur()},focus(){this.getInputField()&&this.getInputField().focus()},getInputField(){return this.$el.querySelector(".form-control, input, select, textarea")},getFieldErrors(){let e=this.error||this.errors;return A(this.errors)&&(e=this.errors[this.$attrs.name||this.$attrs.id]),!e||Array.isArray(e)||A(e)?e:[e]},onInput(e){this.$emit("input",e.target.value),this.$emit("update:value",e.target.value)}}};function v(e){return v=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},v(e)}function M(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function E(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function W(e,t,r){return t&&E(e.prototype,t),r&&E(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function S(e,t){return S=Object.setPrototypeOf||function(i,n){return i.__proto__=n,i},S(e,t)}function Z(){if(typeof Reflect=="undefined"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function m(e,t,r){return Z()?m=Reflect.construct:m=function(n,o,s){var c=[null];c.push.apply(c,o);var a=Function.bind.apply(n,c),u=new a;return s&&S(u,s.prototype),u},m.apply(null,arguments)}function F(e,t){return D(e)||G(e,t)||U(e,t)||q()}function D(e){if(Array.isArray(e))return e}function G(e,t){var r=e==null?null:typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var i=[],n=!0,o=!1,s,c;try{for(r=r.call(e);!(n=(s=r.next()).done)&&(i.push(s.value),!(t&&i.length===t));n=!0);}catch(a){o=!0,c=a}finally{try{!n&&r.return!=null&&r.return()}finally{if(o)throw c}}return i}}function U(e,t){if(!!e){if(typeof e=="string")return R(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);if(r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set")return Array.from(e);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return R(e,t)}}function R(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,i=new Array(t);r<t;r++)i[r]=e[r];return i}function q(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
15
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var g=function(){return g=Object.assign||function(r){for(var i,n=1,o=arguments.length;n<o;n++){i=arguments[n];for(var s in i)Object.prototype.hasOwnProperty.call(i,s)&&(r[s]=i[s])}return r},g.apply(this,arguments)};function X(e){return e.toLowerCase()}var J=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],K=/[^A-Z0-9]+/gi;function Q(e,t){t===void 0&&(t={});for(var r=t.splitRegexp,i=r===void 0?J:r,n=t.stripRegexp,o=n===void 0?K:n,s=t.transform,c=s===void 0?X:s,a=t.delimiter,u=a===void 0?" ":a,d=T(T(e,i,"$1\0$2"),o,"\0"),f=0,l=d.length;d.charAt(f)==="\0";)f++;for(;d.charAt(l-1)==="\0";)l--;return d.slice(f,l).split("\0").map(c).join(u)}function T(e,t,r){return t instanceof RegExp?e.replace(t,r):t.reduce(function(i,n){return i.replace(n,r)},e)}function Y(e,t){return t===void 0&&(t={}),Q(e,g({delimiter:"."},t))}function b(e,t){return t===void 0&&(t={}),Y(e,g({delimiter:"-"},t))}var P=function(){function e(){var t=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};M(this,e),this.components={},Object.entries(r).forEach(function(i){var n=F(i,2),o=n[0],s=n[1];t.register(o,s)})}return W(e,[{key:"validate",value:function(r){if(v(r)==="object"||typeof r=="function")return r;throw new Error("Invalid data type `".concat(v(r),"`. Should be type `object` or `function`."))}},{key:"get",value:function(r){var i=this.components[r=b(r)];if(i)return i;throw new Error('"'.concat(r,'" has not been registered yet!'))}},{key:"register",value:function(r,i){var n=this;return v(r)==="object"?(Object.entries(r).forEach(function(o){var s=F(o,2),c=s[0],a=s[1];n.register(b(c),a)}),this):(this.components[b(r)]=this.validate(i),this)}},{key:"remove",value:function(r){return delete this.components[b(r)],this}},{key:"reset",value:function(){return this.components={},this}}]),e}();function ee(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return m(P,t)}const x=ee();var te=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{staticClass:"activity-indicator",class:e.classes,style:e.style},[r("div",{staticClass:"activity-indicator-content"},[r(e.component,{tag:"component",staticClass:"mx-auto"}),e.label?r("div",{staticClass:"activity-indicator-label"},[e._v(" "+e._s(e.label)+" ")]):e._e()],1)])},re=[],_e="";function k(e,t,r,i,n,o,s,c){var a=typeof e=="function"?e.options:e;t&&(a.render=t,a.staticRenderFns=r,a._compiled=!0),i&&(a.functional=!0),o&&(a._scopeId="data-v-"+o);var u;if(s?(u=function(l){l=l||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext,!l&&typeof __VUE_SSR_CONTEXT__!="undefined"&&(l=__VUE_SSR_CONTEXT__),n&&n.call(this,l),l&&l._registeredComponents&&l._registeredComponents.add(s)},a._ssrRegister=u):n&&(u=c?function(){n.call(this,(a.functional?this.parent:this).$root.$options.shadowRoot)}:n),u)if(a.functional){a._injectStyles=u;var d=a.render;a.render=function(he,j){return u.call(j),d(he,j)}}else{var f=a.beforeCreate;a.beforeCreate=f?[].concat(f,u):[u]}return{exports:e,options:a}}function _(e,t="px"){return e!=null&&e!==!1&&isFinite(e)?`${e}${t}`:e}const ie={name:"ActivityIndicator",props:{absolute:Boolean,center:Boolean,label:String,size:{type:String,default:"md"},registry:{type:P,default(){return x}},type:{type:String,required:!0},height:[String,Number],maxHeight:[String,Number],minHeight:[String,Number],width:[String,Number],maxWidth:[String,Number],minWidth:[String,Number]},computed:{classes(){return{"activity-indicator-center":this.center,"activity-indicator-absolute":this.absolute,[this.size&&`activity-indicator-${this.size}`]:!!this.size}},style(){return{width:_(this.width),maxWidth:_(this.maxWidth),minWidth:_(this.minWidth),height:_(this.height),maxHeight:_(this.maxHeight),minHeight:_(this.minHeight)}},component(){return()=>{console.log(x);const e=x.get(this.type);return e instanceof Promise?e:typeof e=="function"?e():Promise.resolve(e)}}}},O={};var ne=k(ie,te,re,!1,ae,null,null,null);function ae(e){for(let t in O)this[t]=O[t]}var se=function(){return ne.exports}(),pe="",ve="",ye="",me="",ge="",be="",Ce="",Se="",xe="",$e="",we="",Ae="",Ee="",Fe="",oe=function(){var e=this,t=e.$createElement,r=e._self._c||t;return r("div",{class:e.formGroupClasses},[e._t("label",function(){return[e.label||e.$attrs.placeholder?r("label",{ref:"label",class:e.labelClass,attrs:{for:e.id},domProps:{innerHTML:e._s(e.label||e.$attrs.placeholder)},on:{click:e.focus}}):e._e()]}),r("div",{staticClass:"form-group-inner"},[e._t("control",function(){return[e.$slots.icon?r("div",{staticClass:"form-group-inner-icon",on:{click:function(i){return e.$refs.field.focus()}}},[e._t("icon")],2):e._e(),r("input",e._b({directives:[{name:"bind-events",rawName:"v-bind-events"}],ref:"field",domProps:{value:e.currentValue},on:{input:e.onInput}},"input",e.controlAttributes,!1))]}),e._t("activity",function(){return[r("transition",{attrs:{name:"input-field-fade"}},[e.activity?r("activity-indicator",{key:"activity",ref:"activity",attrs:{type:e.indicator,size:e.indicatorSize||e.size}}):e._e()],1)]})],2),e._t("feedback",function(){return[e.invalidFeedback?r("div",{staticClass:"invalid-feedback",attrs:{invalid:""},domProps:{innerHTML:e._s(e.invalidFeedback)}}):e.validFeedback?r("div",{staticClass:"valid-feedback",attrs:{valid:""},domProps:{innerHTML:e._s(e.validFeedback)}}):e._e()]}),e._t("help",function(){return[e.helpText?r("small",{ref:"help"},[e._v(" "+e._s(e.helpText)+" ")]):e._e()]})],2)},le=[],Re="";const ue={name:"InputField",components:{ActivityIndicator:se},mixins:[H]},I={};var ce=k(ue,oe,le,!1,de,null,null,null);function de(e){for(let t in I)this[t]=I[t]}var fe=function(){return ce.exports}();h.InputField=fe,Object.defineProperty(h,"__esModule",{value:!0}),h[Symbol.toStringTag]="Module"});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-interface/input-field",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.5",
|
|
4
4
|
"description": "A Vue input field component.",
|
|
5
5
|
"files": [
|
|
6
6
|
"index.js",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"homepage": "https://github.com/vue-interface/input-field/docs#readme",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@vue-interface/activity-indicator": "^1.0.
|
|
43
|
+
"@vue-interface/activity-indicator": "^1.0.3",
|
|
44
44
|
"@vue-interface/form-control": "^0.11.5",
|
|
45
45
|
"vue": "^2.6.14"
|
|
46
46
|
},
|