ps-toolkit-ui 1.11.91 → 1.11.92
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/bundles/ps-toolkit-ui.umd.js +146 -31
- package/bundles/ps-toolkit-ui.umd.js.map +1 -1
- package/bundles/ps-toolkit-ui.umd.min.js +1 -1
- package/bundles/ps-toolkit-ui.umd.min.js.map +1 -1
- package/esm2015/lib/classes/enum.class.js +2 -1
- package/esm2015/lib/classes/form.class.js +1 -2
- package/esm2015/lib/classes/string.class.js +3 -1
- package/esm2015/lib/components/form/file/form.file.component.js +3 -19
- package/esm2015/lib/components/form/uploader/form.uploader.component.js +122 -0
- package/esm2015/lib/components/sidebar/sidebar.component.js +1 -4
- package/esm2015/lib/ps-toolkit-ui.module.js +8 -7
- package/esm2015/ps-toolkit-ui.js +4 -4
- package/esm2015/public-api.js +2 -1
- package/fesm2015/ps-toolkit-ui.js +130 -29
- package/fesm2015/ps-toolkit-ui.js.map +1 -1
- package/lib/classes/enum.class.d.ts +2 -1
- package/lib/classes/form.class.d.ts +0 -1
- package/lib/classes/string.class.d.ts +2 -0
- package/lib/components/form/uploader/form.uploader.component.d.ts +18 -0
- package/package.json +1 -1
- package/ps-toolkit-ui.d.ts +3 -3
- package/ps-toolkit-ui.metadata.json +1 -1
- package/public-api.d.ts +1 -0
- package/src/assets/styles/base.css +1 -1
|
@@ -288,6 +288,8 @@
|
|
|
288
288
|
Waiting: 'انتظار',
|
|
289
289
|
Required: 'را وارد کنید',
|
|
290
290
|
Invalid: 'نامعتبر است',
|
|
291
|
+
UploaderTitle: 'برای آپلود فایل <span class="f-w-700 c-primary">کلیک کنید</span> و یا فایل خود را به اینجا کشیده و رها کنید',
|
|
292
|
+
UploaderMaxLength: 'حداکثر اندازه برای آپلود {}MB',
|
|
291
293
|
FormErrorRequired: '{} را وارد کنید',
|
|
292
294
|
FormErrorInvalid: '{} نامعتبر است',
|
|
293
295
|
FormErrorLength: 'طول {} باید {} کاراکتر باشد',
|
|
@@ -796,6 +798,7 @@
|
|
|
796
798
|
InputType[InputType["Toggle"] = 45] = "Toggle";
|
|
797
799
|
InputType[InputType["BillNumber"] = 46] = "BillNumber";
|
|
798
800
|
InputType[InputType["Ckeditor"] = 47] = "Ckeditor";
|
|
801
|
+
InputType[InputType["Uploader"] = 48] = "Uploader";
|
|
799
802
|
})(exports.InputType || (exports.InputType = {}));
|
|
800
803
|
(function (OperationEnum) {
|
|
801
804
|
OperationEnum[OperationEnum["All"] = -1] = "All";
|
|
@@ -1982,7 +1985,6 @@
|
|
|
1982
1985
|
this.onChange = null;
|
|
1983
1986
|
this.hover = -1;
|
|
1984
1987
|
this.visible = true;
|
|
1985
|
-
this.exportPdf = false;
|
|
1986
1988
|
this.open = false;
|
|
1987
1989
|
this.multiple = false;
|
|
1988
1990
|
this.onlyChild = true;
|
|
@@ -2448,16 +2450,13 @@
|
|
|
2448
2450
|
}
|
|
2449
2451
|
});
|
|
2450
2452
|
service.currentCountAll.subscribe(function (c) {
|
|
2451
|
-
console.log(_this.currentSidebar, 111);
|
|
2452
2453
|
if (_this.currentSidebar) {
|
|
2453
|
-
console.log(_this.currentSidebar.countAll, c, 222);
|
|
2454
2454
|
_this.currentSidebar.countAll += c;
|
|
2455
2455
|
}
|
|
2456
2456
|
});
|
|
2457
2457
|
}
|
|
2458
2458
|
SidebarComponent.prototype.setActive = function () {
|
|
2459
2459
|
var active = HelperClass.getData('active', this.router.routerState, this.router.routerState.root)[0];
|
|
2460
|
-
console.log(this.sidebar, active, this.getSidebarActive(this.sidebar, active));
|
|
2461
2460
|
this.currentSidebar = this.getSidebarActive(this.sidebar, active);
|
|
2462
2461
|
};
|
|
2463
2462
|
SidebarComponent.prototype.ngOnInit = function () {
|
|
@@ -4271,24 +4270,8 @@
|
|
|
4271
4270
|
var result = {};
|
|
4272
4271
|
result[_this.inp.name] = _this.inp.name;
|
|
4273
4272
|
if (_this.inp.value && typeof _this.inp.value !== 'string') {
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
return result;
|
|
4277
|
-
}
|
|
4278
|
-
else {
|
|
4279
|
-
// const doc = new jsPDF();
|
|
4280
|
-
// let y = 5;
|
|
4281
|
-
// for (const img of this.inp.value) {
|
|
4282
|
-
// const i = await this.getPdfImage(img);
|
|
4283
|
-
// if (y + i.h > 287) {
|
|
4284
|
-
// doc.addPage();
|
|
4285
|
-
// y = 5;
|
|
4286
|
-
// }
|
|
4287
|
-
// doc.addImage(i.base64, 'JPEG', 5, y, i.w, i.h);
|
|
4288
|
-
// y += i.h + 5;
|
|
4289
|
-
// }
|
|
4290
|
-
// return doc.output('blob');
|
|
4291
|
-
}
|
|
4273
|
+
result[_this.inp.name + 'File'] = _this.inp.value.filter(function (x) { return typeof x !== 'string'; });
|
|
4274
|
+
return result;
|
|
4292
4275
|
}
|
|
4293
4276
|
return result;
|
|
4294
4277
|
};
|
|
@@ -8026,6 +8009,137 @@
|
|
|
8026
8009
|
inputBase: [{ type: core.ViewChild, args: ['inputBase',] }]
|
|
8027
8010
|
};
|
|
8028
8011
|
|
|
8012
|
+
var FormUploaderComponent = /** @class */ (function () {
|
|
8013
|
+
function FormUploaderComponent() {
|
|
8014
|
+
this.changeIndex = new core.EventEmitter();
|
|
8015
|
+
this.id = HelperClass.random(10);
|
|
8016
|
+
}
|
|
8017
|
+
FormUploaderComponent.prototype.ngOnInit = function () {
|
|
8018
|
+
var _this = this;
|
|
8019
|
+
this.inp.setValue = function (v) {
|
|
8020
|
+
_this.inp.value = v;
|
|
8021
|
+
};
|
|
8022
|
+
this.inp.isValid = function () {
|
|
8023
|
+
_this.inp.error = null;
|
|
8024
|
+
if (_this.inp.required && !_this.inp.value) {
|
|
8025
|
+
_this.inp.error = exports.InputError.Required;
|
|
8026
|
+
return false;
|
|
8027
|
+
}
|
|
8028
|
+
if (!_this.inp.required && !_this.inp.value) {
|
|
8029
|
+
return true;
|
|
8030
|
+
}
|
|
8031
|
+
if (_this.inp.allowed != null && _this.inp.value != null && typeof _this.inp.value !== 'string' &&
|
|
8032
|
+
_this.inp.value.filter(function (x) { return typeof x !== 'string'; }).map(function (x) { return _this.inp.allowed.includes(x.name.split('.').pop().toLowerCase()); }).filter(function (x) { return !x; }).length > 0) {
|
|
8033
|
+
_this.inp.error = exports.InputError.NotAllowed;
|
|
8034
|
+
return false;
|
|
8035
|
+
}
|
|
8036
|
+
if (_this.inp.maxLength !== -1 && _this.inp.value != null && typeof _this.inp.value !== 'string' &&
|
|
8037
|
+
_this.inp.value.map(function (x) { return x.size > _this.inp.maxLength * 1024; }).filter(function (x) { return x; }).length > 0) {
|
|
8038
|
+
_this.inp.error = exports.InputError.MaxContent;
|
|
8039
|
+
return false;
|
|
8040
|
+
}
|
|
8041
|
+
return true;
|
|
8042
|
+
};
|
|
8043
|
+
this.inp.clear = function () {
|
|
8044
|
+
_this.inp.error = null;
|
|
8045
|
+
_this.inp.value = _this.inp.default;
|
|
8046
|
+
};
|
|
8047
|
+
this.inp.data = function () {
|
|
8048
|
+
var result = {};
|
|
8049
|
+
result[_this.inp.name] = _this.inp.name;
|
|
8050
|
+
if (_this.inp.value && typeof _this.inp.value !== 'string') {
|
|
8051
|
+
result[_this.inp.name + 'File'] = _this.inp.value.filter(function (x) { return typeof x !== 'string'; });
|
|
8052
|
+
return result;
|
|
8053
|
+
}
|
|
8054
|
+
return result;
|
|
8055
|
+
};
|
|
8056
|
+
this.inp.focus = function () {
|
|
8057
|
+
_this.onClick();
|
|
8058
|
+
};
|
|
8059
|
+
};
|
|
8060
|
+
FormUploaderComponent.prototype.getPdfImage = function (file) {
|
|
8061
|
+
return new Promise(function (resolve, reject) {
|
|
8062
|
+
var reader = new FileReader();
|
|
8063
|
+
reader.readAsDataURL(file);
|
|
8064
|
+
reader.onload = function () {
|
|
8065
|
+
var i = new Image();
|
|
8066
|
+
i.src = window.URL.createObjectURL(file);
|
|
8067
|
+
i.onload = function () {
|
|
8068
|
+
var w = i.width;
|
|
8069
|
+
var h = i.height;
|
|
8070
|
+
if (w > 200) {
|
|
8071
|
+
h = (200 * h) / w;
|
|
8072
|
+
w = 200;
|
|
8073
|
+
}
|
|
8074
|
+
if (h > 287) {
|
|
8075
|
+
w = (287 * w) / h;
|
|
8076
|
+
h = 287;
|
|
8077
|
+
}
|
|
8078
|
+
resolve({ base64: reader.result.toString(), w: w, h: h });
|
|
8079
|
+
};
|
|
8080
|
+
};
|
|
8081
|
+
reader.onerror = function (error) { return reject(error); };
|
|
8082
|
+
});
|
|
8083
|
+
};
|
|
8084
|
+
FormUploaderComponent.prototype.onClick = function () {
|
|
8085
|
+
$__namespace(this.inputBase.nativeElement).focus();
|
|
8086
|
+
};
|
|
8087
|
+
FormUploaderComponent.prototype.onChange = function (e) {
|
|
8088
|
+
var e_1, _a;
|
|
8089
|
+
this.inp.error = null;
|
|
8090
|
+
var v = [];
|
|
8091
|
+
try {
|
|
8092
|
+
for (var _b = __values(e.target.files), _c = _b.next(); !_c.done; _c = _b.next()) {
|
|
8093
|
+
var f = _c.value;
|
|
8094
|
+
v.push(f);
|
|
8095
|
+
}
|
|
8096
|
+
}
|
|
8097
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
8098
|
+
finally {
|
|
8099
|
+
try {
|
|
8100
|
+
if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
|
8101
|
+
}
|
|
8102
|
+
finally { if (e_1) throw e_1.error; }
|
|
8103
|
+
}
|
|
8104
|
+
this.inp.value = v;
|
|
8105
|
+
this.changeIndex.emit('Tab');
|
|
8106
|
+
};
|
|
8107
|
+
FormUploaderComponent.prototype.onKeyDown = function (e) {
|
|
8108
|
+
var code = e.keyCode || e.which;
|
|
8109
|
+
if (code === 9 || code === 13) {
|
|
8110
|
+
e.preventDefault();
|
|
8111
|
+
this.changeIndex.emit(e.shiftKey ? 'ShiftTab' : 'Tab');
|
|
8112
|
+
}
|
|
8113
|
+
};
|
|
8114
|
+
FormUploaderComponent.prototype.onFocusIn = function () {
|
|
8115
|
+
$__namespace(this.inputBase.nativeElement).focus();
|
|
8116
|
+
};
|
|
8117
|
+
FormUploaderComponent.prototype.title = function () {
|
|
8118
|
+
if (this.inp.value == null || (this.inp.value instanceof Array && this.inp.value.length === 0)) {
|
|
8119
|
+
return this.inp.l('FileNotSelected');
|
|
8120
|
+
}
|
|
8121
|
+
var t = typeof this.inp.value === 'string' ? this.inp.value : this.inp.value.map(function (x) { return typeof x === 'string' ? x : x.name; }).join(', ');
|
|
8122
|
+
var l = typeof this.inp.value === 'string' ? 1 : this.inp.value.length;
|
|
8123
|
+
return this.inp.l('FileSelected', [l, t]);
|
|
8124
|
+
};
|
|
8125
|
+
return FormUploaderComponent;
|
|
8126
|
+
}());
|
|
8127
|
+
FormUploaderComponent.decorators = [
|
|
8128
|
+
{ type: core.Component, args: [{
|
|
8129
|
+
selector: 'lib-form-uploader',
|
|
8130
|
+
template: "<label #inputDiv [id]=\"id + 'FileInput'\" [for]=\"id + 'FileInputBase'\" [className]=\"'form-input-con file w-100' + (inp.error == null ? '' : ' error') + (inp.value != null && inp.value != '' ? ' has-value' : '') + ' ' + inp.class\">\r\n <div class=\"form-input\" (click)=\"onClick()\">\r\n <div *ngIf=\"inp.displayLabel\" class=\"label\"><i *ngIf=\"inp.required\" class=\"fas fa-star-of-life required-icon\"></i>{{inp.getLabel()}}</div>\r\n <input #inputBaseFile class=\"input-base-file\" type=\"file\" [id]=\"id + 'FileInputBase'\" [multiple]=\"inp.multiple\" (change)=\"onChange($event)\">\r\n <input #inputBase type=\"text\" class=\"input-base\" (keydown)=\"onKeyDown($event)\" (focusin)=\"onFocusIn()\">\r\n <div class=\"control\">\r\n <div class=\"title\">{{title()}}</div>\r\n <div class=\"button\">{{inp.multiple ? inp.l(\"ChooseFiles\") : inp.l(\"ChooseFile\")}}</div>\r\n </div>\r\n <i *ngIf=\"inp.icon != null || inp.loading\" #inputIcon [className]=\"(inp.loading ? 'fa-duotone fa-spin fa-spinner' : inp.icon) + ' icon'\"></i>\r\n </div>\r\n</label>\r\n",
|
|
8131
|
+
styles: [".form-input-con.file{-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;cursor:pointer;padding:0 15px;position:relative}.form-input-con.file .form-input{float:right;position:relative;width:100%}.form-input-con.file .form-input .input-base,.form-input-con.file .form-input .input-base-file{cursor:pointer;height:0;opacity:0;position:absolute;right:50%;top:50%;width:0;z-index:1}.form-input-con.file .form-input .control{background-color:#fff;border:var(--border-input);border-radius:var(--border-radius-base);float:left;font-size:11px;height:35px;line-height:35px;overflow:hidden;padding:0 135px 0 35px;position:relative;text-align:center;text-overflow:ellipsis;white-space:nowrap;width:100%;z-index:2}.form-input-con.file .form-input .control .title{float:right;width:100%}.form-input-con.file .form-input .control:hover,.form-input-con.file .form-input .input-base:focus+.control{border:var(--border-input-dark);outline:none}.form-input-con.file .form-input .button:hover,.form-input-con.file .form-input .control:hover .button,.form-input-con.file .form-input .input-base:focus+.control .button{background-color:var(--green-dark)}.form-input-con.file .form-input i.icon{bottom:0;color:var(--primary);font-size:13px;height:35px;left:0;line-height:35px;position:absolute;text-align:center;width:35px;z-index:2}.form-input-con.file .form-input .label{-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;cursor:default;direction:rtl;float:right;font-size:12px;height:20px;line-height:20px;margin-bottom:3px;padding:0 10px;text-align:right;width:100%}.form-input-con.file .form-input .label .required-icon{color:var(--red);font-size:9px;height:20px;line-height:20px;text-align:center;width:20px}.form-input-con.file .form-input .button{background-color:var(--green);border-radius:0 var(--border-radius-base) var(--border-radius-base) 0;bottom:0;color:#fff;font-size:10px;height:35px;line-height:35px;position:absolute;right:0;text-align:center;width:100px;z-index:2}.form-input-con.file.error .form-input .control{border:var(--border-input-red)}.form-input-con.file.error .form-input .label{color:var(--red);font-size:10px}.form-input-con.file.error .form-input .control,.form-input-con.file.error .form-input .icon{color:var(--red)}.form-input-con.file.h-35{height:35px}.form-input-con.file.has-value.h-35 .form-input .control{direction:ltr;font-size:9px;height:35px}.form-input-con.file.h-35 .form-input .button,.form-input-con.file.h-35 .form-input i.icon{height:35px;line-height:35px}.form-input-con.file.h-30{height:30px}.form-input-con.file.h-30 .form-input .control{direction:ltr;font-size:9px;height:30px;line-height:30px}.form-input-con.file.h-30 .form-input .button,.form-input-con.file.h-30 .form-input i.icon{height:30px;line-height:30px}"]
|
|
8132
|
+
},] }
|
|
8133
|
+
];
|
|
8134
|
+
FormUploaderComponent.ctorParameters = function () { return []; };
|
|
8135
|
+
FormUploaderComponent.propDecorators = {
|
|
8136
|
+
inp: [{ type: core.Input }],
|
|
8137
|
+
changeIndex: [{ type: core.Output }],
|
|
8138
|
+
inputDiv: [{ type: core.ViewChild, args: ['inputDiv',] }],
|
|
8139
|
+
inputBaseFile: [{ type: core.ViewChild, args: ['inputBaseFile',] }],
|
|
8140
|
+
inputBase: [{ type: core.ViewChild, args: ['inputBase',] }]
|
|
8141
|
+
};
|
|
8142
|
+
|
|
8029
8143
|
var PsToolkitUiModule = /** @class */ (function () {
|
|
8030
8144
|
function PsToolkitUiModule() {
|
|
8031
8145
|
}
|
|
@@ -8047,9 +8161,9 @@
|
|
|
8047
8161
|
FormIconComponent, FormButtonComponent, FormDatetimeComponent, FormPlaqueComponent, SubHeaderComponent, FooterComponent, StepsComponent,
|
|
8048
8162
|
FormFileComponent, FormSelectComponent, FormTableComponent, FormLabelComponent, AccordionComponent, FormRadioComponent, HeaderComponent,
|
|
8049
8163
|
TooltipComponent, ConfirmComponent, TableComponent, ModalComponent, FormComponent, TableRowComponent, FormTreeComponent, AlertComponent,
|
|
8050
|
-
FormTimeComponent,
|
|
8051
|
-
SafeStylePipe, LoginComponent, LoadingComponent,
|
|
8052
|
-
ClockComponent, ChartComponent, SafeHtmlPipe, FormTagComponent, ErrorComponent, FormCkeditorComponent, FormToggleComponent
|
|
8164
|
+
FormTimeComponent, NotificationComponent, FormFingerComponent, FormVehicleSearchComponent, FormVehicleComponent, FormUploaderComponent,
|
|
8165
|
+
SafeStylePipe, LoginComponent, LoadingComponent, NotfoundComponent, LayoutComponent, FormHiddenComponent, CalendarComponent,
|
|
8166
|
+
ClockComponent, ChartComponent, SafeHtmlPipe, FormTagComponent, ErrorComponent, FormCkeditorComponent, FormToggleComponent, FormStarComponent
|
|
8053
8167
|
],
|
|
8054
8168
|
imports: [
|
|
8055
8169
|
common.CommonModule,
|
|
@@ -8064,9 +8178,9 @@
|
|
|
8064
8178
|
FormIconComponent, FormButtonComponent, FormDatetimeComponent, FormPlaqueComponent, SubHeaderComponent, FooterComponent, StepsComponent,
|
|
8065
8179
|
FormFileComponent, FormSelectComponent, FormTableComponent, FormLabelComponent, AccordionComponent, FormRadioComponent, HeaderComponent,
|
|
8066
8180
|
TooltipComponent, ConfirmComponent, TableComponent, ModalComponent, FormComponent, TableRowComponent, FormTreeComponent, AlertComponent,
|
|
8067
|
-
FormTimeComponent,
|
|
8068
|
-
LoginComponent, LoadingComponent,
|
|
8069
|
-
ClockComponent, ChartComponent, FormTagComponent, ErrorComponent, FormCkeditorComponent, FormToggleComponent
|
|
8181
|
+
FormTimeComponent, NotificationComponent, FormFingerComponent, FormVehicleSearchComponent, FormVehicleComponent, FormUploaderComponent,
|
|
8182
|
+
LoginComponent, LoadingComponent, NotfoundComponent, LayoutComponent, FormHiddenComponent, CalendarComponent,
|
|
8183
|
+
ClockComponent, ChartComponent, FormTagComponent, ErrorComponent, FormCkeditorComponent, FormToggleComponent, FormStarComponent
|
|
8070
8184
|
]
|
|
8071
8185
|
},] }
|
|
8072
8186
|
];
|
|
@@ -8746,6 +8860,7 @@
|
|
|
8746
8860
|
exports.FormTimeComponent = FormTimeComponent;
|
|
8747
8861
|
exports.FormToggleComponent = FormToggleComponent;
|
|
8748
8862
|
exports.FormTreeComponent = FormTreeComponent;
|
|
8863
|
+
exports.FormUploaderComponent = FormUploaderComponent;
|
|
8749
8864
|
exports.FormVehicleComponent = FormVehicleComponent;
|
|
8750
8865
|
exports.FormVehicleSearchComponent = FormVehicleSearchComponent;
|
|
8751
8866
|
exports.HeaderComponent = HeaderComponent;
|
|
@@ -8784,9 +8899,9 @@
|
|
|
8784
8899
|
exports.ɵe = TableLoadingComponent;
|
|
8785
8900
|
exports.ɵf = FormTreeItemComponent;
|
|
8786
8901
|
exports.ɵg = TableRowComponent;
|
|
8787
|
-
exports.ɵh =
|
|
8788
|
-
exports.ɵi =
|
|
8789
|
-
exports.ɵj =
|
|
8902
|
+
exports.ɵh = NotificationComponent;
|
|
8903
|
+
exports.ɵi = SafeStylePipe;
|
|
8904
|
+
exports.ɵj = LoginComponent;
|
|
8790
8905
|
exports.ɵk = FormHiddenComponent;
|
|
8791
8906
|
exports.ɵl = CalendarComponent;
|
|
8792
8907
|
exports.ɵm = ClockComponent;
|