tg-controls_cli 0.0.8 → 0.0.9
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 +145 -91
- package/dist/myLib.common.js.map +1 -1
- package/dist/myLib.css +1 -1
- package/dist/myLib.umd.js +145 -91
- 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
|
@@ -22248,6 +22248,17 @@ module.exports = JSON.parse("{\"code\":\"sk\",\"messages\":{\"alpha\":\"{_field_
|
|
|
22248
22248
|
|
|
22249
22249
|
// extracted by mini-css-extract-plugin
|
|
22250
22250
|
|
|
22251
|
+
/***/ }),
|
|
22252
|
+
|
|
22253
|
+
/***/ "719a":
|
|
22254
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
22255
|
+
|
|
22256
|
+
"use strict";
|
|
22257
|
+
/* 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_6aec890d_prod_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("836d");
|
|
22258
|
+
/* 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_6aec890d_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_6aec890d_prod_scoped_true_lang_css___WEBPACK_IMPORTED_MODULE_0__);
|
|
22259
|
+
/* unused harmony reexport * */
|
|
22260
|
+
|
|
22261
|
+
|
|
22251
22262
|
/***/ }),
|
|
22252
22263
|
|
|
22253
22264
|
/***/ "7234":
|
|
@@ -22326,6 +22337,13 @@ module.exports = function (argument) {
|
|
|
22326
22337
|
};
|
|
22327
22338
|
|
|
22328
22339
|
|
|
22340
|
+
/***/ }),
|
|
22341
|
+
|
|
22342
|
+
/***/ "836d":
|
|
22343
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
22344
|
+
|
|
22345
|
+
// extracted by mini-css-extract-plugin
|
|
22346
|
+
|
|
22329
22347
|
/***/ }),
|
|
22330
22348
|
|
|
22331
22349
|
/***/ "83ab":
|
|
@@ -28982,78 +29000,55 @@ 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=6aec890d&scoped=true&
|
|
29004
|
+
var FileFieldvue_type_template_id_6aec890d_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', {
|
|
29008
|
+
staticClass: "file-upload"
|
|
29009
|
+
}, [_c('div', {
|
|
29010
|
+
staticClass: "file-upload__area"
|
|
29011
|
+
}, [_c('div', [_c('input', {
|
|
28991
29012
|
attrs: {
|
|
28992
|
-
"
|
|
28993
|
-
"
|
|
28994
|
-
"
|
|
29013
|
+
"type": "file",
|
|
29014
|
+
"id": "customFile",
|
|
29015
|
+
"disabled": _vm.fieldInfo.disabled,
|
|
29016
|
+
"multiple": _vm.canUploadMultipleFile()
|
|
28995
29017
|
},
|
|
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
|
-
});
|
|
29018
|
+
on: {
|
|
29019
|
+
"change": function ($event) {
|
|
29020
|
+
return _vm.onChange($event);
|
|
29021
|
+
}
|
|
29022
|
+
}
|
|
29023
|
+
}), _vm.errors.length > 0 ? _c('div', _vm._l(_vm.errors, function (error, index) {
|
|
29024
|
+
return _c('div', {
|
|
29025
|
+
key: index,
|
|
29026
|
+
staticClass: "file-upload__error"
|
|
29027
|
+
}, [_c('span', [_vm._v(_vm._s(error))])]);
|
|
29028
|
+
}), 0) : _vm._e()]), _vm._l(_vm.previewFiles, function (file, index) {
|
|
29029
|
+
return _c('div', {
|
|
29030
|
+
key: index,
|
|
29031
|
+
staticClass: "upload-preview"
|
|
29032
|
+
}, [file.isImage ? _c('img', {
|
|
29033
|
+
staticClass: "file-image",
|
|
29034
|
+
attrs: {
|
|
29035
|
+
"src": file.url,
|
|
29036
|
+
"alt": ""
|
|
29037
|
+
}
|
|
29038
|
+
}) : _vm._e(), !file.isImage ? _c('div', {
|
|
29039
|
+
staticClass: "file-extention"
|
|
29040
|
+
}, [_vm._v(" " + _vm._s(file.fileExtention) + " ")]) : _vm._e(), _c('span', {
|
|
29041
|
+
staticClass: "file-name"
|
|
29042
|
+
}, [_vm._v(" " + _vm._s(file.name) + _vm._s(file.isImage ? `.${file.fileExtention}` : "") + " ")])]);
|
|
29043
|
+
})], 2)]);
|
|
29050
29044
|
};
|
|
29051
|
-
var
|
|
29045
|
+
var FileFieldvue_type_template_id_6aec890d_scoped_true_staticRenderFns = [];
|
|
29052
29046
|
|
|
29053
|
-
// CONCATENATED MODULE: ./src/components/FileField.vue?vue&type=template&id=
|
|
29047
|
+
// CONCATENATED MODULE: ./src/components/FileField.vue?vue&type=template&id=6aec890d&scoped=true&
|
|
29054
29048
|
|
|
29055
29049
|
// 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
29050
|
|
|
29051
|
+
|
|
29057
29052
|
/* harmony default export */ var FileFieldvue_type_script_lang_js_ = ({
|
|
29058
29053
|
components: {
|
|
29059
29054
|
Field: ValidationProvider
|
|
@@ -29070,7 +29065,19 @@ var FileFieldvue_type_template_id_9506f218_staticRenderFns = [];
|
|
|
29070
29065
|
},
|
|
29071
29066
|
data: function () {
|
|
29072
29067
|
return {
|
|
29073
|
-
|
|
29068
|
+
maxSize: 0,
|
|
29069
|
+
accept: '',
|
|
29070
|
+
errors: [],
|
|
29071
|
+
file: {
|
|
29072
|
+
name: "",
|
|
29073
|
+
size: 0,
|
|
29074
|
+
type: "",
|
|
29075
|
+
fileExtention: "",
|
|
29076
|
+
url: "",
|
|
29077
|
+
isImage: false,
|
|
29078
|
+
isUploaded: false
|
|
29079
|
+
},
|
|
29080
|
+
previewFiles: []
|
|
29074
29081
|
};
|
|
29075
29082
|
},
|
|
29076
29083
|
mounted: function () {
|
|
@@ -29078,40 +29085,83 @@ var FileFieldvue_type_template_id_9506f218_staticRenderFns = [];
|
|
|
29078
29085
|
if (this.fieldInfo.placeholder) {
|
|
29079
29086
|
this.fileName = this.fieldInfo.placeholder;
|
|
29080
29087
|
}
|
|
29088
|
+
if (this.fieldInfo && this.fieldInfo.config && this.fieldInfo.config.hasOwnProperty('maxSize')) {
|
|
29089
|
+
this.maxSize = this.fieldInfo.config.maxSize;
|
|
29090
|
+
}
|
|
29091
|
+
if (this.fieldInfo && this.fieldInfo.config && this.fieldInfo.config.hasOwnProperty('accept')) {
|
|
29092
|
+
this.accept = this.fieldInfo.config.accept;
|
|
29093
|
+
}
|
|
29081
29094
|
},
|
|
29082
29095
|
methods: {
|
|
29083
|
-
onChange
|
|
29084
|
-
|
|
29085
|
-
|
|
29086
|
-
|
|
29087
|
-
|
|
29088
|
-
|
|
29089
|
-
|
|
29090
|
-
|
|
29091
|
-
|
|
29092
|
-
|
|
29093
|
-
|
|
29094
|
-
|
|
29095
|
-
|
|
29096
|
+
onChange(e) {
|
|
29097
|
+
this.errors = [];
|
|
29098
|
+
// Check if file is selected
|
|
29099
|
+
if (e.target.files && e.target.files[0]) {
|
|
29100
|
+
// Check if file is valid
|
|
29101
|
+
for (let index = 0; index < e.target.files.length; index++) {
|
|
29102
|
+
const file = e.target.files[index];
|
|
29103
|
+
if (this.isFileValid(file)) {
|
|
29104
|
+
// Get uploaded file
|
|
29105
|
+
// Get file size
|
|
29106
|
+
var fileSize = Math.round(file.size / 1024 / 1024 * 100) / 100;
|
|
29107
|
+
// Get file extention
|
|
29108
|
+
var fileExtention = file.name.split(".").pop();
|
|
29109
|
+
// Get file name
|
|
29110
|
+
var fileName = file.name.split(".").shift();
|
|
29111
|
+
// Check if file is an image
|
|
29112
|
+
var isImage = ["jpg", "jpeg", "png", "gif"].includes(fileExtention);
|
|
29113
|
+
// Print to console
|
|
29114
|
+
console.log(fileSize, fileExtention, fileName, isImage);
|
|
29115
|
+
// Load the FileReader API
|
|
29116
|
+
let reader = new FileReader();
|
|
29117
|
+
reader.addEventListener("load", () => {
|
|
29118
|
+
// Set file data
|
|
29119
|
+
this.file = {
|
|
29120
|
+
name: fileName,
|
|
29121
|
+
size: fileSize,
|
|
29122
|
+
type: file.type,
|
|
29123
|
+
fileExtention: fileExtention,
|
|
29124
|
+
isImage: isImage,
|
|
29125
|
+
url: reader.result,
|
|
29126
|
+
isUploaded: true
|
|
29127
|
+
};
|
|
29128
|
+
this.previewFiles.push(this.file);
|
|
29129
|
+
}, false);
|
|
29130
|
+
// Read uploaded file
|
|
29131
|
+
reader.readAsDataURL(file);
|
|
29132
|
+
} else {
|
|
29133
|
+
console.log("Invalid file");
|
|
29134
|
+
}
|
|
29135
|
+
}
|
|
29136
|
+
if (this.errors.length == 0) {
|
|
29137
|
+
this.fieldInfo.value = e.target.files;
|
|
29138
|
+
if (this.fieldInfo && this.fieldInfo.config && this.fieldInfo.config.onChange) {
|
|
29139
|
+
this.fieldInfo.config.onChange(e, this.fieldInfo);
|
|
29140
|
+
}
|
|
29141
|
+
}
|
|
29096
29142
|
}
|
|
29097
29143
|
},
|
|
29098
|
-
|
|
29099
|
-
if (
|
|
29100
|
-
|
|
29144
|
+
isFileSizeValid(fileSize) {
|
|
29145
|
+
if (fileSize <= this.maxSize) {
|
|
29146
|
+
console.log("File size is valid");
|
|
29147
|
+
} else {
|
|
29148
|
+
this.errors.push(`File size should be less than ${this.maxSize} MB`);
|
|
29101
29149
|
}
|
|
29102
29150
|
},
|
|
29103
|
-
|
|
29104
|
-
if (this.
|
|
29105
|
-
|
|
29151
|
+
isFileTypeValid(fileExtention) {
|
|
29152
|
+
if (this.accept.split(",").includes(fileExtention)) {
|
|
29153
|
+
console.log("File type is valid");
|
|
29106
29154
|
} else {
|
|
29107
|
-
|
|
29155
|
+
this.errors.push(`File type should be ${this.accept}`);
|
|
29108
29156
|
}
|
|
29109
29157
|
},
|
|
29110
|
-
|
|
29111
|
-
|
|
29112
|
-
|
|
29158
|
+
isFileValid(file) {
|
|
29159
|
+
this.isFileSizeValid(Math.round(file.size / 1024 / 1024 * 100) / 100);
|
|
29160
|
+
this.isFileTypeValid(file.name.split(".").pop());
|
|
29161
|
+
if (this.errors.length === 0) {
|
|
29162
|
+
return true;
|
|
29113
29163
|
} else {
|
|
29114
|
-
return
|
|
29164
|
+
return false;
|
|
29115
29165
|
}
|
|
29116
29166
|
},
|
|
29117
29167
|
canUploadMultipleFile() {
|
|
@@ -29124,21 +29174,25 @@ var FileFieldvue_type_template_id_9506f218_staticRenderFns = [];
|
|
|
29124
29174
|
});
|
|
29125
29175
|
// CONCATENATED MODULE: ./src/components/FileField.vue?vue&type=script&lang=js&
|
|
29126
29176
|
/* harmony default export */ var components_FileFieldvue_type_script_lang_js_ = (FileFieldvue_type_script_lang_js_);
|
|
29177
|
+
// EXTERNAL MODULE: ./src/components/FileField.vue?vue&type=style&index=0&id=6aec890d&prod&scoped=true&lang=css&
|
|
29178
|
+
var FileFieldvue_type_style_index_0_id_6aec890d_prod_scoped_true_lang_css_ = __webpack_require__("719a");
|
|
29179
|
+
|
|
29127
29180
|
// CONCATENATED MODULE: ./src/components/FileField.vue
|
|
29128
29181
|
|
|
29129
29182
|
|
|
29130
29183
|
|
|
29131
29184
|
|
|
29132
29185
|
|
|
29186
|
+
|
|
29133
29187
|
/* normalize component */
|
|
29134
29188
|
|
|
29135
29189
|
var FileField_component = normalizeComponent(
|
|
29136
29190
|
components_FileFieldvue_type_script_lang_js_,
|
|
29137
|
-
|
|
29138
|
-
|
|
29191
|
+
FileFieldvue_type_template_id_6aec890d_scoped_true_render,
|
|
29192
|
+
FileFieldvue_type_template_id_6aec890d_scoped_true_staticRenderFns,
|
|
29139
29193
|
false,
|
|
29140
29194
|
null,
|
|
29141
|
-
|
|
29195
|
+
"6aec890d",
|
|
29142
29196
|
null
|
|
29143
29197
|
|
|
29144
29198
|
)
|