tg-controls_cli 0.0.8 → 0.0.10
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/myLib.common.js +169 -90
- package/dist/myLib.common.js.map +1 -1
- package/dist/myLib.css +1 -1
- package/dist/myLib.umd.js +169 -90
- package/dist/myLib.umd.js.map +1 -1
- package/dist/myLib.umd.min.js +2 -2
- package/dist/myLib.umd.min.js.map +1 -1
- package/package.json +1 -1
package/dist/myLib.common.js
CHANGED
|
@@ -22631,6 +22631,13 @@ module.exports = DESCRIPTORS && fails(function () {
|
|
|
22631
22631
|
});
|
|
22632
22632
|
|
|
22633
22633
|
|
|
22634
|
+
/***/ }),
|
|
22635
|
+
|
|
22636
|
+
/***/ "b372":
|
|
22637
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
22638
|
+
|
|
22639
|
+
// extracted by mini-css-extract-plugin
|
|
22640
|
+
|
|
22634
22641
|
/***/ }),
|
|
22635
22642
|
|
|
22636
22643
|
/***/ "b42e":
|
|
@@ -24054,6 +24061,17 @@ module.exports = JSON.parse("{\"code\":\"ro\",\"messages\":{\"alpha\":\"Câmpul
|
|
|
24054
24061
|
|
|
24055
24062
|
module.exports = JSON.parse("{\"code\":\"sv\",\"messages\":{\"alpha\":\"Fältet {_field_} får bara innehålla alfabetiska tecken\",\"alpha_dash\":\"Fältet {_field_} får bara innehålla alfanumeriska tecken såväl som snedstreck och understreck\",\"alpha_num\":\"Fältet {_field_} får bara innehålla alfanumeriska tecken\",\"alpha_spaces\":\"Fältet {_field_} får bara innehålla alfabetiska tecken och mellanslag\",\"between\":\"Fältet {_field_} måste vara mellan {min} och {max}\",\"confirmed\":\"Fältet {_field_} matchar inte {target}\",\"digits\":\"Fältet {_field_} måste vara numeriskt och innehålla exakt {length} siffor\",\"dimensions\":\"Fältet {_field_} måste vara {width} pixlar bred och {height} pixlar hög\",\"email\":\"Fältet {_field_} måste vara en giltig e-postadress\",\"excluded\":\"Fältet {_field_} måste vara ett godkänt alternativ\",\"ext\":\"Fältet {_field_} måste vara en godkänd fil\",\"image\":\"Fältet {_field_} måste vara en bildfil\",\"integer\":\"Fältet {_field_} måste vara ett heltal\",\"length\":\"Fältet {_field_} måste vara {length} långt\",\"oneOf\":\"Fältet {_field_} måste vara ett godkänt alternativ\",\"max\":\"Fältet {_field_} får inte vara längre än {length} tecken\",\"mimes\":\"Fältet {_field_} måste ha en filändelse\",\"min\":\"Fältet {_field_} måste minst vara {length} tecken\",\"numeric\":\"Fältet {_field_} får bara innehålla numeriska tecken\",\"regex\":\"Fältet {_field_} har en felaktig formatering\",\"required\":\"Fältet {_field_} är obligatoriskt\",\"required_if\":\"Fältet {_field_} är obligatoriskt\",\"size\":\"Fältet {_field_} måste vara mindre än {size}KB\",\"double\":\"Fältet {_field_} måste vara ett giltigt decimal\"}}");
|
|
24056
24063
|
|
|
24064
|
+
/***/ }),
|
|
24065
|
+
|
|
24066
|
+
/***/ "eeee":
|
|
24067
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
24068
|
+
|
|
24069
|
+
"use strict";
|
|
24070
|
+
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_7_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_7_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_FileField_vue_vue_type_style_index_0_id_610fb118_prod_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("b372");
|
|
24071
|
+
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_7_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_7_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_FileField_vue_vue_type_style_index_0_id_610fb118_prod_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_7_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_7_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_7_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_1_0_node_modules_vue_loader_lib_index_js_vue_loader_options_FileField_vue_vue_type_style_index_0_id_610fb118_prod_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__);
|
|
24072
|
+
/* unused harmony reexport * */
|
|
24073
|
+
|
|
24074
|
+
|
|
24057
24075
|
/***/ }),
|
|
24058
24076
|
|
|
24059
24077
|
/***/ "f551":
|
|
@@ -28982,78 +29000,74 @@ var ColorField_component = normalizeComponent(
|
|
|
28982
29000
|
)
|
|
28983
29001
|
|
|
28984
29002
|
/* harmony default export */ var ColorField = (ColorField_component.exports);
|
|
28985
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"c1dfe90e-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/FileField.vue?vue&type=template&id=
|
|
28986
|
-
var
|
|
29003
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"c1dfe90e-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/FileField.vue?vue&type=template&id=610fb118&scoped=true&
|
|
29004
|
+
var FileFieldvue_type_template_id_610fb118_scoped_true_render = function render() {
|
|
28987
29005
|
var _vm = this,
|
|
28988
29006
|
_c = _vm._self._c;
|
|
28989
|
-
return _c('
|
|
28990
|
-
staticClass: "
|
|
29007
|
+
return _c('div', [_c('div', {
|
|
29008
|
+
staticClass: "col-12 mb-2 mt-2"
|
|
29009
|
+
}, [_c('label', [_vm._v("Allowed File Type:")]), _vm._l(_vm.fieldInfo.config.accept, function (fileTypeInfo) {
|
|
29010
|
+
return _c('div', {
|
|
29011
|
+
staticClass: "mx-2 d-inline-block doc-ico-legend"
|
|
29012
|
+
}, [_c('em', {
|
|
29013
|
+
staticClass: "fa text-primary",
|
|
29014
|
+
class: fileTypeInfo.iconClass,
|
|
29015
|
+
attrs: {
|
|
29016
|
+
"id": "helpText"
|
|
29017
|
+
}
|
|
29018
|
+
}), _vm._v(" " + _vm._s(fileTypeInfo.fileType) + " ")]);
|
|
29019
|
+
})], 2), _c('div', {
|
|
29020
|
+
staticClass: "file-upload",
|
|
28991
29021
|
attrs: {
|
|
28992
|
-
"
|
|
28993
|
-
|
|
28994
|
-
|
|
29022
|
+
"id": "fileAttachment"
|
|
29023
|
+
}
|
|
29024
|
+
}, [_c('div', {
|
|
29025
|
+
staticClass: "file-upload__area",
|
|
29026
|
+
on: {
|
|
29027
|
+
"click": _vm.openFilePopup
|
|
29028
|
+
}
|
|
29029
|
+
}, [_c('div', [_c('span', [_vm._v("Drop files here to upload")]), _c('input', {
|
|
29030
|
+
staticClass: "d-none",
|
|
29031
|
+
attrs: {
|
|
29032
|
+
"type": "file",
|
|
29033
|
+
"id": "customFile",
|
|
29034
|
+
"disabled": _vm.fieldInfo.disabled,
|
|
29035
|
+
"multiple": _vm.canUploadMultipleFile()
|
|
28995
29036
|
},
|
|
28996
|
-
|
|
28997
|
-
|
|
28998
|
-
|
|
28999
|
-
|
|
29000
|
-
|
|
29001
|
-
|
|
29002
|
-
|
|
29003
|
-
|
|
29004
|
-
|
|
29005
|
-
|
|
29006
|
-
|
|
29007
|
-
|
|
29008
|
-
|
|
29009
|
-
|
|
29010
|
-
|
|
29011
|
-
|
|
29012
|
-
|
|
29013
|
-
|
|
29014
|
-
|
|
29015
|
-
|
|
29016
|
-
|
|
29017
|
-
|
|
29018
|
-
|
|
29019
|
-
|
|
29020
|
-
|
|
29021
|
-
|
|
29022
|
-
}), _c('label', {
|
|
29023
|
-
staticClass: "custom-file-label",
|
|
29024
|
-
attrs: {
|
|
29025
|
-
"for": "customFile"
|
|
29026
|
-
}
|
|
29027
|
-
}, [_vm._v(_vm._s(_vm.fileName))])]), _vm.showAddIcon() ? _c('div', {
|
|
29028
|
-
staticClass: "ml-2 mt-1"
|
|
29029
|
-
}, [_c('a', {
|
|
29030
|
-
class: _vm.addButtonClass()
|
|
29031
|
-
}, [_c('i', {
|
|
29032
|
-
class: _vm.addIconClass(),
|
|
29033
|
-
attrs: {
|
|
29034
|
-
"alt": "+"
|
|
29035
|
-
},
|
|
29036
|
-
on: {
|
|
29037
|
-
"click": function ($event) {
|
|
29038
|
-
return _vm.onAddButtonClick($event);
|
|
29039
|
-
}
|
|
29040
|
-
}
|
|
29041
|
-
})])]) : _vm._e(), errors[0] ? _c('span', {
|
|
29042
|
-
staticClass: "invalid-feedback",
|
|
29043
|
-
attrs: {
|
|
29044
|
-
"name": _vm.fieldInfo.name
|
|
29045
|
-
}
|
|
29046
|
-
}, [_vm._v(_vm._s(errors[0]))]) : _vm._e()];
|
|
29047
|
-
}
|
|
29048
|
-
}])
|
|
29049
|
-
});
|
|
29037
|
+
on: {
|
|
29038
|
+
"change": function ($event) {
|
|
29039
|
+
return _vm.onChange($event);
|
|
29040
|
+
}
|
|
29041
|
+
}
|
|
29042
|
+
}), _vm.errors.length > 0 ? _c('div', _vm._l(_vm.errors, function (error, index) {
|
|
29043
|
+
return _c('div', {
|
|
29044
|
+
key: index,
|
|
29045
|
+
staticClass: "file-upload__error"
|
|
29046
|
+
}, [_c('span', [_vm._v(_vm._s(error))])]);
|
|
29047
|
+
}), 0) : _vm._e()]), _vm._l(_vm.previewFiles, function (file, index) {
|
|
29048
|
+
return _c('div', {
|
|
29049
|
+
key: index,
|
|
29050
|
+
staticClass: "upload-preview"
|
|
29051
|
+
}, [file.isImage ? _c('img', {
|
|
29052
|
+
staticClass: "file-image",
|
|
29053
|
+
attrs: {
|
|
29054
|
+
"src": file.url,
|
|
29055
|
+
"alt": ""
|
|
29056
|
+
}
|
|
29057
|
+
}) : _vm._e(), !file.isImage ? _c('div', {
|
|
29058
|
+
staticClass: "file-extention"
|
|
29059
|
+
}, [_vm._v(" " + _vm._s(file.fileExtention) + " ")]) : _vm._e(), _c('span', {
|
|
29060
|
+
staticClass: "file-name"
|
|
29061
|
+
}, [_vm._v(" " + _vm._s(file.name) + _vm._s(file.isImage ? `.${file.fileExtention}` : "") + " ")])]);
|
|
29062
|
+
})], 2)])]);
|
|
29050
29063
|
};
|
|
29051
|
-
var
|
|
29064
|
+
var FileFieldvue_type_template_id_610fb118_scoped_true_staticRenderFns = [];
|
|
29052
29065
|
|
|
29053
|
-
// CONCATENATED MODULE: ./src/components/FileField.vue?vue&type=template&id=
|
|
29066
|
+
// CONCATENATED MODULE: ./src/components/FileField.vue?vue&type=template&id=610fb118&scoped=true&
|
|
29054
29067
|
|
|
29055
29068
|
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js??ref--13-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--1-0!./node_modules/vue-loader/lib??vue-loader-options!./src/components/FileField.vue?vue&type=script&lang=js&
|
|
29056
29069
|
|
|
29070
|
+
|
|
29057
29071
|
/* harmony default export */ var FileFieldvue_type_script_lang_js_ = ({
|
|
29058
29072
|
components: {
|
|
29059
29073
|
Field: ValidationProvider
|
|
@@ -29070,7 +29084,19 @@ var FileFieldvue_type_template_id_9506f218_staticRenderFns = [];
|
|
|
29070
29084
|
},
|
|
29071
29085
|
data: function () {
|
|
29072
29086
|
return {
|
|
29073
|
-
|
|
29087
|
+
maxSize: 0,
|
|
29088
|
+
accept: '',
|
|
29089
|
+
errors: [],
|
|
29090
|
+
file: {
|
|
29091
|
+
name: "",
|
|
29092
|
+
size: 0,
|
|
29093
|
+
type: "",
|
|
29094
|
+
fileExtention: "",
|
|
29095
|
+
url: "",
|
|
29096
|
+
isImage: false,
|
|
29097
|
+
isUploaded: false
|
|
29098
|
+
},
|
|
29099
|
+
previewFiles: []
|
|
29074
29100
|
};
|
|
29075
29101
|
},
|
|
29076
29102
|
mounted: function () {
|
|
@@ -29078,40 +29104,89 @@ var FileFieldvue_type_template_id_9506f218_staticRenderFns = [];
|
|
|
29078
29104
|
if (this.fieldInfo.placeholder) {
|
|
29079
29105
|
this.fileName = this.fieldInfo.placeholder;
|
|
29080
29106
|
}
|
|
29107
|
+
if (this.fieldInfo && this.fieldInfo.config && this.fieldInfo.config.hasOwnProperty('maxSize')) {
|
|
29108
|
+
this.maxSize = this.fieldInfo.config.maxSize;
|
|
29109
|
+
}
|
|
29110
|
+
if (this.fieldInfo && this.fieldInfo.config && this.fieldInfo.config.hasOwnProperty('accept')) {
|
|
29111
|
+
this.accept = Array.prototype.map.call(this.fieldInfo.config.accept, function (item) {
|
|
29112
|
+
return item.fileType;
|
|
29113
|
+
}).join(",");
|
|
29114
|
+
console.log(this.accept);
|
|
29115
|
+
}
|
|
29081
29116
|
},
|
|
29082
29117
|
methods: {
|
|
29083
|
-
|
|
29084
|
-
|
|
29085
|
-
this.fileName = e.target.files[0].name;
|
|
29086
|
-
}
|
|
29087
|
-
this.fieldInfo.value = e.target.files;
|
|
29088
|
-
if (this.fieldInfo && this.fieldInfo.config && this.fieldInfo.config.onChange) {
|
|
29089
|
-
this.fieldInfo.config.onChange(e, this.fieldInfo);
|
|
29090
|
-
}
|
|
29118
|
+
openFilePopup() {
|
|
29119
|
+
document.querySelectorAll('[type="file"]')[0].click();
|
|
29091
29120
|
},
|
|
29092
|
-
|
|
29093
|
-
|
|
29094
|
-
if
|
|
29095
|
-
|
|
29121
|
+
onChange(e) {
|
|
29122
|
+
this.errors = [];
|
|
29123
|
+
// Check if file is selected
|
|
29124
|
+
if (e.target.files && e.target.files[0]) {
|
|
29125
|
+
// Check if file is valid
|
|
29126
|
+
for (let index = 0; index < e.target.files.length; index++) {
|
|
29127
|
+
const file = e.target.files[index];
|
|
29128
|
+
if (this.isFileValid(file)) {
|
|
29129
|
+
// Get uploaded file
|
|
29130
|
+
// Get file size
|
|
29131
|
+
var fileSize = Math.round(file.size / 1024 / 1024 * 100) / 100;
|
|
29132
|
+
// Get file extention
|
|
29133
|
+
var fileExtention = file.name.split(".").pop();
|
|
29134
|
+
// Get file name
|
|
29135
|
+
var fileName = file.name.split(".").shift();
|
|
29136
|
+
// Check if file is an image
|
|
29137
|
+
var isImage = ["jpg", "jpeg", "png", "gif"].includes(fileExtention);
|
|
29138
|
+
// Print to console
|
|
29139
|
+
console.log(fileSize, fileExtention, fileName, isImage);
|
|
29140
|
+
// Load the FileReader API
|
|
29141
|
+
let reader = new FileReader();
|
|
29142
|
+
reader.addEventListener("load", () => {
|
|
29143
|
+
// Set file data
|
|
29144
|
+
this.file = {
|
|
29145
|
+
name: fileName,
|
|
29146
|
+
size: fileSize,
|
|
29147
|
+
type: file.type,
|
|
29148
|
+
fileExtention: fileExtention,
|
|
29149
|
+
isImage: isImage,
|
|
29150
|
+
url: reader.result,
|
|
29151
|
+
isUploaded: true
|
|
29152
|
+
};
|
|
29153
|
+
this.previewFiles.push(this.file);
|
|
29154
|
+
}, false);
|
|
29155
|
+
// Read uploaded file
|
|
29156
|
+
reader.readAsDataURL(file);
|
|
29157
|
+
} else {
|
|
29158
|
+
console.log("Invalid file");
|
|
29159
|
+
}
|
|
29160
|
+
}
|
|
29161
|
+
if (this.errors.length == 0) {
|
|
29162
|
+
this.fieldInfo.value = e.target.files;
|
|
29163
|
+
if (this.fieldInfo && this.fieldInfo.config && this.fieldInfo.config.onChange) {
|
|
29164
|
+
this.fieldInfo.config.onChange(e, this.fieldInfo);
|
|
29165
|
+
}
|
|
29166
|
+
}
|
|
29096
29167
|
}
|
|
29097
29168
|
},
|
|
29098
|
-
|
|
29099
|
-
if (
|
|
29100
|
-
|
|
29169
|
+
isFileSizeValid(fileSize) {
|
|
29170
|
+
if (fileSize <= this.maxSize) {
|
|
29171
|
+
console.log("File size is valid");
|
|
29172
|
+
} else {
|
|
29173
|
+
this.errors.push(`File size should be less than ${this.maxSize} MB`);
|
|
29101
29174
|
}
|
|
29102
29175
|
},
|
|
29103
|
-
|
|
29104
|
-
if (this.
|
|
29105
|
-
|
|
29176
|
+
isFileTypeValid(fileExtention) {
|
|
29177
|
+
if (this.accept.split(",").includes(fileExtention)) {
|
|
29178
|
+
console.log("File type is valid");
|
|
29106
29179
|
} else {
|
|
29107
|
-
|
|
29180
|
+
this.errors.push(`File type should be ${this.accept}`);
|
|
29108
29181
|
}
|
|
29109
29182
|
},
|
|
29110
|
-
|
|
29111
|
-
|
|
29112
|
-
|
|
29183
|
+
isFileValid(file) {
|
|
29184
|
+
this.isFileSizeValid(Math.round(file.size / 1024 / 1024 * 100) / 100);
|
|
29185
|
+
this.isFileTypeValid(file.name.split(".").pop());
|
|
29186
|
+
if (this.errors.length === 0) {
|
|
29187
|
+
return true;
|
|
29113
29188
|
} else {
|
|
29114
|
-
return
|
|
29189
|
+
return false;
|
|
29115
29190
|
}
|
|
29116
29191
|
},
|
|
29117
29192
|
canUploadMultipleFile() {
|
|
@@ -29124,21 +29199,25 @@ var FileFieldvue_type_template_id_9506f218_staticRenderFns = [];
|
|
|
29124
29199
|
});
|
|
29125
29200
|
// CONCATENATED MODULE: ./src/components/FileField.vue?vue&type=script&lang=js&
|
|
29126
29201
|
/* harmony default export */ var components_FileFieldvue_type_script_lang_js_ = (FileFieldvue_type_script_lang_js_);
|
|
29202
|
+
// EXTERNAL MODULE: ./src/components/FileField.vue?vue&type=style&index=0&id=610fb118&prod&scoped=true&lang=css&
|
|
29203
|
+
var FileFieldvue_type_style_index_0_id_610fb118_prod_scoped_true_lang_css_ = __webpack_require__("eeee");
|
|
29204
|
+
|
|
29127
29205
|
// CONCATENATED MODULE: ./src/components/FileField.vue
|
|
29128
29206
|
|
|
29129
29207
|
|
|
29130
29208
|
|
|
29131
29209
|
|
|
29132
29210
|
|
|
29211
|
+
|
|
29133
29212
|
/* normalize component */
|
|
29134
29213
|
|
|
29135
29214
|
var FileField_component = normalizeComponent(
|
|
29136
29215
|
components_FileFieldvue_type_script_lang_js_,
|
|
29137
|
-
|
|
29138
|
-
|
|
29216
|
+
FileFieldvue_type_template_id_610fb118_scoped_true_render,
|
|
29217
|
+
FileFieldvue_type_template_id_610fb118_scoped_true_staticRenderFns,
|
|
29139
29218
|
false,
|
|
29140
29219
|
null,
|
|
29141
|
-
|
|
29220
|
+
"610fb118",
|
|
29142
29221
|
null
|
|
29143
29222
|
|
|
29144
29223
|
)
|