@vue-interface/select-field 0.11.0 → 0.13.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.
- package/dist/select-field.css +1 -0
- package/dist/select-field.es.js +803 -0
- package/dist/select-field.umd.js +15 -0
- package/index.js +5 -2
- package/package.json +27 -25
- package/src/SelectField.vue +158 -40
- package/.eslintrc.js +0 -53
- package/babel.config.js +0 -11
- package/dist/SelectField.common.js +0 -5520
- package/dist/SelectField.common.js.map +0 -1
- package/dist/SelectField.css +0 -1
- package/dist/SelectField.umd.js +0 -5530
- package/dist/SelectField.umd.js.map +0 -1
- package/dist/SelectField.umd.min.js +0 -2
- package/dist/SelectField.umd.min.js.map +0 -1
- package/dist/demo.html +0 -19
- package/docs/.vuepress/config.js +0 -44
- package/docs/.vuepress/dist/404.html +0 -19
- package/docs/.vuepress/dist/assets/css/0.styles.275ee968.css +0 -1
- package/docs/.vuepress/dist/assets/img/search.83621669.svg +0 -1
- package/docs/.vuepress/dist/assets/js/10.5d93d289.js +0 -1
- package/docs/.vuepress/dist/assets/js/11.97ab3884.js +0 -1
- package/docs/.vuepress/dist/assets/js/2.f3d148c3.js +0 -1
- package/docs/.vuepress/dist/assets/js/3.81681fff.js +0 -1
- package/docs/.vuepress/dist/assets/js/4.82fa7382.js +0 -1
- package/docs/.vuepress/dist/assets/js/5.3dae6ad4.js +0 -1
- package/docs/.vuepress/dist/assets/js/6.6a04f815.js +0 -1
- package/docs/.vuepress/dist/assets/js/7.c033cb49.js +0 -1
- package/docs/.vuepress/dist/assets/js/8.6d6eb599.js +0 -1
- package/docs/.vuepress/dist/assets/js/9.eaefe866.js +0 -1
- package/docs/.vuepress/dist/assets/js/app.7ed065d3.js +0 -13
- package/docs/.vuepress/dist/examples/index.html +0 -21
- package/docs/.vuepress/dist/examples/test.html +0 -17
- package/docs/.vuepress/dist/index.html +0 -53
- package/docs/.vuepress/dist/options.html +0 -41
- package/docs/.vuepress/dist/tailwindcss.html +0 -85
- package/docs/README.md +0 -17
- package/docs/examples/README.md +0 -3
- package/docs/options.md +0 -46
- package/docs/tailwindcss.md +0 -76
- package/index.html +0 -219
- package/main.vue +0 -8
- package/postcss.config.js +0 -1
- package/public/favicon.ico +0 -0
- package/public/index.html +0 -17
- package/src/css/SelectField.css +0 -2
- package/tailwind.config.js +0 -11
- package/vue.config.js +0 -11
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
(function(_,h){typeof exports=="object"&&typeof module!="undefined"?h(exports):typeof define=="function"&&define.amd?define(["exports"],h):(_=typeof globalThis!="undefined"?globalThis:_||self,h(_.SelectField={}))})(this,function(_){"use strict";function h(e){return h=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},h(e)}function N(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function $(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function L(e,t,r){return t&&$(e.prototype,t),r&&$(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function S(e,t){return S=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},S(e,t)}function B(){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 B()?m=Reflect.construct:m=function(i,o,s){var c=[null];c.push.apply(c,o);var a=Function.bind.apply(i,c),u=new a;return s&&S(u,s.prototype),u},m.apply(null,arguments)}function w(e,t){return V(e)||H(e,t)||M(e,t)||W()}function V(e){if(Array.isArray(e))return e}function H(e,t){var r=e==null?null:typeof Symbol!="undefined"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n=[],i=!0,o=!1,s,c;try{for(r=r.call(e);!(i=(s=r.next()).done)&&(n.push(s.value),!(t&&n.length===t));i=!0);}catch(a){o=!0,c=a}finally{try{!i&&r.return!=null&&r.return()}finally{if(o)throw c}}return n}}function M(e,t){if(!!e){if(typeof e=="string")return A(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 A(e,t)}}function A(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function W(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
|
+
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 n,i=1,o=arguments.length;i<o;i++){n=arguments[i];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])}return r},g.apply(this,arguments)};function Z(e){return e.toLowerCase()}var q=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],D=/[^A-Z0-9]+/gi;function G(e,t){t===void 0&&(t={});for(var r=t.splitRegexp,n=r===void 0?q:r,i=t.stripRegexp,o=i===void 0?D:i,s=t.transform,c=s===void 0?Z:s,a=t.delimiter,u=a===void 0?" ":a,d=E(E(e,n,"$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(e,t,r){return t instanceof RegExp?e.replace(t,r):t.reduce(function(n,i){return n.replace(i,r)},e)}function U(e,t){return t===void 0&&(t={}),G(e,g({delimiter:"."},t))}function b(e,t){return t===void 0&&(t={}),U(e,g({delimiter:"-"},t))}var F=function(){function e(){var t=this,r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};N(this,e),this.components={},Object.entries(r).forEach(function(n){var i=w(n,2),o=i[0],s=i[1];t.register(o,s)})}return L(e,[{key:"validate",value:function(r){if(h(r)==="object"||typeof r=="function")return r;throw new Error("Invalid data type `".concat(h(r),"`. Should be type `object` or `function`."))}},{key:"get",value:function(r){var n=this.components[r=b(r)];if(n)return n;throw new Error('"'.concat(r,'" has not been registered yet!'))}},{key:"register",value:function(r,n){var i=this;return h(r)==="object"?(Object.entries(r).forEach(function(o){var s=w(o,2),c=s[0],a=s[1];i.register(b(c),a)}),this):(this.components[b(r)]=this.validate(n),this)}},{key:"remove",value:function(r){return delete this.components[b(r)],this}},{key:"reset",value:function(){return this.components={},this}}]),e}();function X(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return m(F,t)}const O=X();var J=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)])},K=[],ve="";function R(e,t,r,n,i,o,s,c){var a=typeof e=="function"?e.options:e;t&&(a.render=t,a.staticRenderFns=r,a._compiled=!0),n&&(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__),i&&i.call(this,l),l&&l._registeredComponents&&l._registeredComponents.add(s)},a._ssrRegister=u):i&&(u=c?function(){i.call(this,(a.functional?this.parent:this).$root.$options.shadowRoot)}:i),u)if(a.functional){a._injectStyles=u;var d=a.render;a.render=function(pe,I){return u.call(I),d(pe,I)}}else{var f=a.beforeCreate;a.beforeCreate=f?[].concat(f,u):[u]}return{exports:e,options:a}}function p(e,t="px"){return e!=null&&e!==!1&&isFinite(e)?`${e}${t}`:e}const Q={name:"ActivityIndicator",props:{absolute:Boolean,center:Boolean,label:String,size:{type:String,default:"md"},registry:{type:F,default(){return O}},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:p(this.width),maxWidth:p(this.maxWidth),minWidth:p(this.minWidth),height:p(this.height),maxHeight:p(this.maxHeight),minHeight:p(this.minHeight)}},component(){return()=>{const e=O.get(this.type);return e instanceof Promise?e:typeof e=="function"?e():Promise.resolve(e)}}}},T={};var Y=R(Q,J,K,!1,ee,null,null,null);function ee(e){for(let t in T)this[t]=T[t]}var te=function(){return Y.exports}(),ye="",me="",ge="",be="",Ce="",Se="",xe="",$e="",we="",Ae="",Ee="",Fe="",Oe="",Re="",re={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}}}};/*! *****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
***************************************************************************** */var C=function(){return C=Object.assign||function(t){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(t[o]=r[o])}return t},C.apply(this,arguments)};function ne(e){return e.toLowerCase()}var ie=[/([a-z0-9])([A-Z])/g,/([A-Z])([A-Z][a-z])/g],ae=/[^A-Z0-9]+/gi;function se(e,t){t===void 0&&(t={});for(var r=t.splitRegexp,n=r===void 0?ie:r,i=t.stripRegexp,o=i===void 0?ae:i,s=t.transform,c=s===void 0?ne:s,a=t.delimiter,u=a===void 0?" ":a,d=P(P(e,n,"$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 P(e,t,r){return t instanceof RegExp?e.replace(t,r):t.reduce(function(n,i){return n.replace(i,r)},e)}function oe(e,t){return t===void 0&&(t={}),se(e,C({delimiter:"."},t))}function j(e,t){return t===void 0&&(t={}),oe(e,C({delimiter:"-"},t))}const y={};function v(...e){if(!e.length)return y;const[t,r]=e;return typeof t=="string"?typeof y[t]!="undefined"?y[t]:r:Array.isArray(t)?t.reduce((n,i)=>Object.assign(n,{[i]:y[i]}),{}):Object.assign(y,...e)}function x(e,t,r="-"){const n=t.toString().replace(new RegExp(`^${e}${r}?`),"");return[j(n),e].filter(i=>!!i).join(r)}function k(e){return!Array.isArray(e)&&typeof e=="object"}var le={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",n=>{r.context.isEmpty=!e.value,r.context.currentValue=e.value}),r.context.hasChanged=!!e.value,r.context.bindEvents.forEach(n=>{e.addEventListener(n,i=>{r.context.$emit(n,i)})}),e.tagName==="SELECT"){const n=e.querySelector('[value=""]');n&&n.value===e.value&&(r.context.defaultEmpty=!0)}}}},mixins:[re],inheritAttrs:!1,props:{activity:{type:Boolean,default:!1},animated:{type:Boolean,default:()=>v("animated",!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:()=>v("defaultControlClass","form-control")},defaultValue:{default:()=>v("defaultValue",null)},error:[String,Array,Boolean],errors:{type:[Array,Object,Boolean],default(){return{}}},feedback:[String,Array],group:{type:Boolean,default:()=>v("group",!0)},helpText:[Number,String],hideLabel:Boolean,indicator:{type:String,default:()=>v("indicator","spinner")},indicatorSize:String,inline:Boolean,invalid:Boolean,label:[Number,String],labelClass:{type:[Object,String],default:()=>v("labelClass","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 x(this.size,this.controlClass)},formGroupClasses(){return{[j(this.componentName)]:!!this.componentName,[this.size&&x(this.size,this.componentName)]:!!this.size,animated:this.animated,"default-empty":this.defaultEmpty,"form-group":this.group,[this.size&&x(this.size,"form-group")]:!!this.size,"has-activity":this.activity,"has-changed":this.hasChanged,"has-focus":this.hasFocus,"has-icon":!!this.$slots.icon,"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 null;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.shouldChangeOnFocus()&&(this.hasChanged=!0)},value(e){this.currentValue=e},currentValue(){this.hasChanged=!0},defaultEmpty(){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 this.errors&&k(this.errors)&&(e=this.errors[this.$attrs.name||this.$attrs.id]),!e||Array.isArray(e)||k(e)?e:[e]},shouldChangeOnFocus(){return!this.getInputField().readOnly},onInput(e){this.$emit("input",e.target.value),this.$emit("update:value",e.target.value)}}},ue=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?r("label",{ref:"label",class:e.labelClass,attrs:{for:e.id},domProps:{innerHTML:e._s(e.label)},on:{click:e.focus}}):e._e()]}),r("div",{staticClass:"form-group-inner"},[e._t("control",function(){var n;return[e.$slots.icon?r("div",{staticClass:"form-group-inner-icon",on:{click:e.focus}},[e._t("icon")],2):e._e(),r("select",e._b({directives:[{name:"bind-events",rawName:"v-bind-events"}],ref:"field",domProps:{value:e.currentValue},on:{input:e.onInput}},"select",Object.assign((n={},n.disabled=e.$attrs.readonly,n),e.controlAttributes),!1),[e._t("default")],2)]}),e._t("activity",function(){return[r("transition",{attrs:{name:"select-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)},ce=[],Te="";const de={name:"SelectField",components:{ActivityIndicator:te},mixins:[le],props:{defaultControlClass:{type:String,default:"form-select"}},computed:{controlClass(){return this.plaintext?`${this.defaultControlClass}-plaintext`:this.defaultControlClass}},mounted(){const e=this.$el.querySelector("[selected]");e&&(this.currentValue=e.value,this.$emit("input",this.currentValue),this.$emit("update:value",this.currentValue))},methods:{shouldChangeOnFocus(){return!1}}},z={};var fe=R(de,ue,ce,!1,he,null,null,null);function he(e){for(let t in z)this[t]=z[t]}var _e=function(){return fe.exports}();_.SelectField=_e,Object.defineProperty(_,"__esModule",{value:!0}),_[Symbol.toStringTag]="Module"});
|
package/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,22 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vue-interface/select-field",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.13.0",
|
|
4
4
|
"description": "A Vue select field component.",
|
|
5
|
-
"
|
|
5
|
+
"files": [
|
|
6
|
+
"index.js",
|
|
7
|
+
"dist",
|
|
8
|
+
"src"
|
|
9
|
+
],
|
|
10
|
+
"main": "./dist/select-field.umd.js",
|
|
11
|
+
"module": "./index.js",
|
|
12
|
+
"browserslist": "last 2 versions, > 0.5%, ie >= 11",
|
|
6
13
|
"scripts": {
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"
|
|
10
|
-
"lint": "vue-cli-service lint",
|
|
11
|
-
"fix": "vue-cli-service lint --fix",
|
|
14
|
+
"dev": "vite",
|
|
15
|
+
"build": "vite build",
|
|
16
|
+
"preview": "vite preview",
|
|
12
17
|
"pre-release": "npm run build; git add . -A; git commit -m 'pre-release commit'",
|
|
13
18
|
"release-patch": "npm run pre-release && npm version patch -m \"%s\" && npm run release;",
|
|
14
19
|
"release-minor": "npm run pre-release && npm version minor -m \"%s\" && npm run release;",
|
|
15
20
|
"release-major": "npm run pre-release && npm version major -m \"%s\" && npm run release;",
|
|
16
|
-
"release": "git add . -A; git commit; git push --tags origin; npm publish;"
|
|
17
|
-
"test": "echo \"Error: no test specified\" && exit 1",
|
|
18
|
-
"docs:dev": "./node_modules/.bin/vuepress dev docs",
|
|
19
|
-
"docs:build": "./node_modules/.bin/vuepress build docs"
|
|
21
|
+
"release": "git add . -A; git commit; git push --tags origin; npm publish;"
|
|
20
22
|
},
|
|
21
23
|
"repository": {
|
|
22
24
|
"type": "git",
|
|
@@ -37,22 +39,22 @@
|
|
|
37
39
|
},
|
|
38
40
|
"homepage": "https://github.com/vue-interface/select-field/docs#readme",
|
|
39
41
|
"dependencies": {
|
|
40
|
-
"@vue-interface/activity-indicator": "^0.
|
|
41
|
-
"@vue-interface/form-control": "^0.
|
|
42
|
-
"
|
|
43
|
-
"tailwindcss": "^1.6.0",
|
|
44
|
-
"vue": "^2.6.11"
|
|
42
|
+
"@vue-interface/activity-indicator": "^1.0.0",
|
|
43
|
+
"@vue-interface/form-control": "^0.12.0",
|
|
44
|
+
"vue": "^2.6.14"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@
|
|
48
|
-
"
|
|
49
|
-
"@vuepress/plugin-register-components": "^1.5.0",
|
|
47
|
+
"@rollup/plugin-babel": "^5.3.0",
|
|
48
|
+
"autoprefixer": "^10.4.2",
|
|
50
49
|
"babel-eslint": "^10.1.0",
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
50
|
+
"babel-preset-vue": "^2.0.2",
|
|
51
|
+
"change-case": "^4.1.2",
|
|
52
|
+
"eslint": "^6.7.2",
|
|
53
|
+
"eslint-plugin-vue": "^6.2.2",
|
|
54
|
+
"pascalcase": "^2.0.0",
|
|
55
|
+
"postcss": "^8.4.6",
|
|
56
|
+
"tailwindcss": "^3.0.18",
|
|
57
|
+
"vite": "^2.7.2",
|
|
58
|
+
"vite-plugin-vue2": "^1.9.3"
|
|
57
59
|
}
|
|
58
60
|
}
|
package/src/SelectField.vue
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div :class="formGroupClasses">
|
|
3
3
|
<slot name="label">
|
|
4
|
-
<label
|
|
4
|
+
<label
|
|
5
|
+
v-if="label"
|
|
6
|
+
ref="label"
|
|
7
|
+
:for="id"
|
|
8
|
+
:class="labelClass"
|
|
9
|
+
@click="focus"
|
|
10
|
+
v-html="label" />
|
|
5
11
|
</slot>
|
|
6
12
|
|
|
7
13
|
<div class="form-group-inner">
|
|
8
14
|
<slot name="control">
|
|
9
|
-
<div v-if="$slots.icon" class="
|
|
15
|
+
<div v-if="$slots.icon" class="form-group-inner-icon" @click="focus">
|
|
10
16
|
<slot name="icon" />
|
|
11
17
|
</div>
|
|
12
18
|
<select
|
|
13
19
|
ref="field"
|
|
14
20
|
v-bind-events
|
|
15
|
-
v-bind="controlAttributes"
|
|
21
|
+
v-bind="Object.assign({['disabled']: $attrs.readonly}, controlAttributes)"
|
|
16
22
|
:value="currentValue"
|
|
17
23
|
@input="onInput">
|
|
18
24
|
<slot />
|
|
@@ -20,25 +26,28 @@
|
|
|
20
26
|
</slot>
|
|
21
27
|
|
|
22
28
|
<slot name="activity">
|
|
23
|
-
<transition name="
|
|
24
|
-
<activity-indicator
|
|
29
|
+
<transition name="select-field-fade">
|
|
30
|
+
<activity-indicator
|
|
31
|
+
v-if="activity"
|
|
32
|
+
key="activity"
|
|
33
|
+
ref="activity"
|
|
34
|
+
:type="indicator"
|
|
35
|
+
:size="indicatorSize || size" />
|
|
25
36
|
</transition>
|
|
26
37
|
</slot>
|
|
27
38
|
</div>
|
|
28
39
|
|
|
29
40
|
<slot name="feedback">
|
|
30
41
|
<div
|
|
31
|
-
v-if="
|
|
32
|
-
class="valid-feedback"
|
|
33
|
-
valid>
|
|
34
|
-
{{ validFeedback }}
|
|
35
|
-
</div>
|
|
36
|
-
<div
|
|
37
|
-
v-else-if="invalidFeedback"
|
|
42
|
+
v-if="invalidFeedback"
|
|
38
43
|
class="invalid-feedback"
|
|
39
|
-
invalid
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
invalid
|
|
45
|
+
v-html="invalidFeedback" />
|
|
46
|
+
<div
|
|
47
|
+
v-else-if="validFeedback"
|
|
48
|
+
class="valid-feedback"
|
|
49
|
+
valid
|
|
50
|
+
v-html="validFeedback" />
|
|
42
51
|
</slot>
|
|
43
52
|
|
|
44
53
|
<slot name="help">
|
|
@@ -50,15 +59,9 @@
|
|
|
50
59
|
</template>
|
|
51
60
|
|
|
52
61
|
<script>
|
|
53
|
-
import { ActivityIndicator
|
|
62
|
+
import { ActivityIndicator } from '@vue-interface/activity-indicator';
|
|
63
|
+
import { FormControl } from '@vue-interface/form-control';
|
|
54
64
|
|
|
55
|
-
import FormControl from '@vue-interface/form-control';
|
|
56
|
-
|
|
57
|
-
const CUSTOM_SELECT_PREFIX = 'custom-select-';
|
|
58
|
-
|
|
59
|
-
register({
|
|
60
|
-
dots: Dots
|
|
61
|
-
});
|
|
62
65
|
|
|
63
66
|
export default {
|
|
64
67
|
|
|
@@ -88,19 +91,26 @@ export default {
|
|
|
88
91
|
computed: {
|
|
89
92
|
|
|
90
93
|
controlClass() {
|
|
91
|
-
|
|
92
|
-
|
|
94
|
+
return this.plaintext ?
|
|
95
|
+
`${this.defaultControlClass}-plaintext`
|
|
93
96
|
: this.defaultControlClass;
|
|
94
|
-
|
|
95
|
-
return this.plaintext ? `${controlClass}-plaintext` : controlClass;
|
|
96
97
|
},
|
|
98
|
+
},
|
|
97
99
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
100
|
+
mounted() {
|
|
101
|
+
const selected = this.$el.querySelector('[selected]');
|
|
102
|
+
|
|
103
|
+
if(selected) {
|
|
104
|
+
this.currentValue = selected.value;
|
|
105
|
+
|
|
106
|
+
this.$emit('input', this.currentValue);
|
|
107
|
+
this.$emit('update:value', this.currentValue);
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
methods: {
|
|
112
|
+
shouldChangeOnFocus() {
|
|
113
|
+
return false;
|
|
104
114
|
}
|
|
105
115
|
}
|
|
106
116
|
|
|
@@ -108,15 +118,123 @@ export default {
|
|
|
108
118
|
</script>
|
|
109
119
|
|
|
110
120
|
<style>
|
|
111
|
-
.
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
121
|
+
.select-field,
|
|
122
|
+
.select-field .form-group-inner {
|
|
123
|
+
position: relative;
|
|
124
|
+
transition: all .25s ease-in-out;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.select-field .activity-indicator {
|
|
128
|
+
position: absolute;
|
|
129
|
+
right: 1.25em;
|
|
130
|
+
top: 50%;
|
|
131
|
+
transform: translate(-1rem, -50%);
|
|
132
|
+
transition: all .15s ease-in;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.select-field .activity-indicator-xs {
|
|
136
|
+
font-size: .5em;
|
|
137
|
+
right: 2em;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.select-field.has-activity .form-control-xs {
|
|
141
|
+
padding-right: 3.75em;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.select-field .activity-indicator-sm {
|
|
145
|
+
font-size: .5em;
|
|
146
|
+
right: 2em;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.select-field.has-activity .form-control-sm {
|
|
150
|
+
padding-right: 3em;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.select-field .activity-indicator-md {
|
|
154
|
+
font-size: .666em;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.select-field.has-activity .form-control-md {
|
|
158
|
+
padding-right: 3em;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
.select-field .activity-indicator-lg {
|
|
162
|
+
font-size: .75em;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.select-field.has-activity .form-control-lg {
|
|
166
|
+
padding-right: 3em;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.select-field .activity-indicator-xl {
|
|
170
|
+
font-size: 1em;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.select-field.has-activity .activity-indicator-xl ~ .form-control-xl {
|
|
174
|
+
padding-right: 3.75em;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.select-field .activity-indicator {
|
|
178
|
+
opacity: 1;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
.select-field .select-field-fade-enter,
|
|
182
|
+
.select-field .select-field-fade-leave-to {
|
|
183
|
+
opacity: 0;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.select-field.is-valid .valid-feedback,
|
|
187
|
+
.select-field.is-invalid .invalid-feedback {
|
|
188
|
+
display: flex;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.select-field .form-control-icon {
|
|
192
|
+
padding-left: 2em;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.select-field .form-group-inner-icon {
|
|
196
|
+
position: absolute;
|
|
197
|
+
top: 50%;
|
|
198
|
+
left: .666em;
|
|
199
|
+
width: 1rem;
|
|
200
|
+
font-size: 1em;
|
|
201
|
+
transform: translateY(-50%);
|
|
202
|
+
display: flex;
|
|
203
|
+
align-items: center;
|
|
204
|
+
justify-content: center;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.select-field-sm .form-group-inner-icon {
|
|
208
|
+
position: absolute;
|
|
209
|
+
top: 50%;
|
|
210
|
+
left: .666rem;
|
|
211
|
+
width: .75em;
|
|
212
|
+
font-size: 1.5em;
|
|
213
|
+
transform: translateY(-50%);
|
|
214
|
+
display: flex;
|
|
215
|
+
align-items: center;
|
|
216
|
+
justify-content: center;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.select-field-lg .form-group-inner-icon {
|
|
220
|
+
position: absolute;
|
|
221
|
+
top: 50%;
|
|
222
|
+
left: .666rem;
|
|
223
|
+
width: 1.25em;
|
|
224
|
+
font-size: 1em;
|
|
225
|
+
transform: translateY(-50%);
|
|
226
|
+
display: flex;
|
|
227
|
+
align-items: center;
|
|
228
|
+
justify-content: center;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.select-field .activity-indicator {
|
|
232
|
+
opacity: 1;
|
|
115
233
|
}
|
|
116
234
|
|
|
117
|
-
|
|
118
|
-
.
|
|
119
|
-
|
|
235
|
+
.select-field .select-field-fade-enter,
|
|
236
|
+
.select-field .select-field-fade-leave-to {
|
|
237
|
+
opacity: 0;
|
|
120
238
|
}
|
|
121
239
|
</style>
|
|
122
240
|
|
package/.eslintrc.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: [
|
|
3
|
-
'plugin:vue/recommended'
|
|
4
|
-
],
|
|
5
|
-
parserOptions: {
|
|
6
|
-
'parser': 'babel-eslint'
|
|
7
|
-
},
|
|
8
|
-
// add your custom rules here
|
|
9
|
-
rules: {
|
|
10
|
-
'vue/no-v-html': 0,
|
|
11
|
-
'vue/require-default-prop': 0,
|
|
12
|
-
"vue/max-attributes-per-line": ["error", {
|
|
13
|
-
"singleline": 5,
|
|
14
|
-
"multiline": {
|
|
15
|
-
"max": 1,
|
|
16
|
-
"allowFirstLine": true
|
|
17
|
-
}
|
|
18
|
-
}],
|
|
19
|
-
"vue/html-indent": ["error", 4, {
|
|
20
|
-
"attribute": 1,
|
|
21
|
-
"baseIndent": 1,
|
|
22
|
-
"closeBracket": 1,
|
|
23
|
-
"alignAttributesVertically": false,
|
|
24
|
-
"ignores": []
|
|
25
|
-
}],
|
|
26
|
-
"vue/html-closing-bracket-newline": ["error", {
|
|
27
|
-
"singleline": "never",
|
|
28
|
-
"multiline": "never"
|
|
29
|
-
}],
|
|
30
|
-
// Ensure no space after keywords like if.
|
|
31
|
-
'keyword-spacing': ["error", {
|
|
32
|
-
"overrides": {
|
|
33
|
-
"if": { "after": false },
|
|
34
|
-
"for": { "after": false },
|
|
35
|
-
"while": { "after": false }
|
|
36
|
-
}
|
|
37
|
-
}],
|
|
38
|
-
// Use alternative brace style
|
|
39
|
-
'brace-style': ['error', 'stroustrup'],
|
|
40
|
-
// No spaces before parens
|
|
41
|
-
'space-before-function-paren': ['error', 'never'],
|
|
42
|
-
// Indent for tabs because spaces suck
|
|
43
|
-
'indent': ['error', 4],
|
|
44
|
-
// Semi colons always where they need to be
|
|
45
|
-
'semi': [2,'always'],
|
|
46
|
-
// allow paren-less arrow functions
|
|
47
|
-
'arrow-parens': 0,
|
|
48
|
-
// allow async-await
|
|
49
|
-
'generator-star-spacing': 0,
|
|
50
|
-
// allow debugger during development
|
|
51
|
-
'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0
|
|
52
|
-
}
|
|
53
|
-
};
|