ps-toolkit-ui 1.11.91 → 1.11.93

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.
@@ -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";
@@ -905,7 +908,24 @@
905
908
  })(exports.TableOptionType || (exports.TableOptionType = {}));
906
909
  (function (TableRowStatus) {
907
910
  TableRowStatus[TableRowStatus["Unread"] = 1] = "Unread";
908
- })(exports.TableRowStatus || (exports.TableRowStatus = {}));
911
+ })(exports.TableRowStatus || (exports.TableRowStatus = {}));
912
+ (function (FileIcons) {
913
+ FileIcons["jpeg"] = "fa-duotone fa-file-image";
914
+ FileIcons["jpg"] = "fa-duotone fa-file-image";
915
+ FileIcons["png"] = "fa-duotone fa-file-image";
916
+ FileIcons["doc"] = "fa-duotone fa-file-word";
917
+ FileIcons["docx"] = "fa-duotone fa-file-word";
918
+ FileIcons["xls"] = "fa-duotone fa-file-excel";
919
+ FileIcons["xlsx"] = "fa-duotone fa-file-excel";
920
+ FileIcons["csv"] = "fa-duotone fa-file-csv";
921
+ FileIcons["ppt"] = "fa-duotone fa-file-powerpoint";
922
+ FileIcons["pptx"] = "fa-duotone fa-file-powerpoint";
923
+ FileIcons["txt"] = "fa-duotone fa-file-lines";
924
+ FileIcons["pdf"] = "fa-duotone fa-file-pdf";
925
+ FileIcons["file"] = "fa-duotone fa-file";
926
+ FileIcons["zip"] = "fa-duotone fa-file-zipper";
927
+ FileIcons["rar"] = "fa-duotone fa-file-zipper";
928
+ })(exports.FileIcons || (exports.FileIcons = {}));
909
929
 
910
930
  // @dynamic
911
931
  var HelperClass = /** @class */ (function () {
@@ -1982,7 +2002,6 @@
1982
2002
  this.onChange = null;
1983
2003
  this.hover = -1;
1984
2004
  this.visible = true;
1985
- this.exportPdf = false;
1986
2005
  this.open = false;
1987
2006
  this.multiple = false;
1988
2007
  this.onlyChild = true;
@@ -2448,16 +2467,13 @@
2448
2467
  }
2449
2468
  });
2450
2469
  service.currentCountAll.subscribe(function (c) {
2451
- console.log(_this.currentSidebar, 111);
2452
2470
  if (_this.currentSidebar) {
2453
- console.log(_this.currentSidebar.countAll, c, 222);
2454
2471
  _this.currentSidebar.countAll += c;
2455
2472
  }
2456
2473
  });
2457
2474
  }
2458
2475
  SidebarComponent.prototype.setActive = function () {
2459
2476
  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
2477
  this.currentSidebar = this.getSidebarActive(this.sidebar, active);
2462
2478
  };
2463
2479
  SidebarComponent.prototype.ngOnInit = function () {
@@ -4271,24 +4287,8 @@
4271
4287
  var result = {};
4272
4288
  result[_this.inp.name] = _this.inp.name;
4273
4289
  if (_this.inp.value && typeof _this.inp.value !== 'string') {
4274
- if (!_this.inp.exportPdf) {
4275
- result[_this.inp.name + 'File'] = _this.inp.value.filter(function (x) { return typeof x !== 'string'; });
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
- }
4290
+ result[_this.inp.name + 'File'] = _this.inp.value.filter(function (x) { return typeof x !== 'string'; });
4291
+ return result;
4292
4292
  }
4293
4293
  return result;
4294
4294
  };
@@ -8026,6 +8026,137 @@
8026
8026
  inputBase: [{ type: core.ViewChild, args: ['inputBase',] }]
8027
8027
  };
8028
8028
 
8029
+ var FormUploaderComponent = /** @class */ (function () {
8030
+ function FormUploaderComponent() {
8031
+ this.changeIndex = new core.EventEmitter();
8032
+ this.id = HelperClass.random(10);
8033
+ }
8034
+ FormUploaderComponent.prototype.ngOnInit = function () {
8035
+ var _this = this;
8036
+ this.inp.setValue = function (v) {
8037
+ _this.inp.value = v;
8038
+ };
8039
+ this.inp.isValid = function () {
8040
+ _this.inp.error = null;
8041
+ if (_this.inp.required && !_this.inp.value) {
8042
+ _this.inp.error = exports.InputError.Required;
8043
+ return false;
8044
+ }
8045
+ if (!_this.inp.required && !_this.inp.value) {
8046
+ return true;
8047
+ }
8048
+ if (_this.inp.allowed != null && _this.inp.value != null && typeof _this.inp.value !== 'string' &&
8049
+ _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) {
8050
+ _this.inp.error = exports.InputError.NotAllowed;
8051
+ return false;
8052
+ }
8053
+ if (_this.inp.maxLength !== -1 && _this.inp.value != null && typeof _this.inp.value !== 'string' &&
8054
+ _this.inp.value.map(function (x) { return x.size > _this.inp.maxLength * 1024; }).filter(function (x) { return x; }).length > 0) {
8055
+ _this.inp.error = exports.InputError.MaxContent;
8056
+ return false;
8057
+ }
8058
+ return true;
8059
+ };
8060
+ this.inp.clear = function () {
8061
+ _this.inp.error = null;
8062
+ _this.inp.value = _this.inp.default;
8063
+ };
8064
+ this.inp.data = function () {
8065
+ var result = {};
8066
+ result[_this.inp.name] = _this.inp.name;
8067
+ if (_this.inp.value && typeof _this.inp.value !== 'string') {
8068
+ result[_this.inp.name + 'File'] = _this.inp.value.filter(function (x) { return typeof x !== 'string'; });
8069
+ return result;
8070
+ }
8071
+ return result;
8072
+ };
8073
+ this.inp.focus = function () {
8074
+ _this.onClick();
8075
+ };
8076
+ };
8077
+ FormUploaderComponent.prototype.getPdfImage = function (file) {
8078
+ return new Promise(function (resolve, reject) {
8079
+ var reader = new FileReader();
8080
+ reader.readAsDataURL(file);
8081
+ reader.onload = function () {
8082
+ var i = new Image();
8083
+ i.src = window.URL.createObjectURL(file);
8084
+ i.onload = function () {
8085
+ var w = i.width;
8086
+ var h = i.height;
8087
+ if (w > 200) {
8088
+ h = (200 * h) / w;
8089
+ w = 200;
8090
+ }
8091
+ if (h > 287) {
8092
+ w = (287 * w) / h;
8093
+ h = 287;
8094
+ }
8095
+ resolve({ base64: reader.result.toString(), w: w, h: h });
8096
+ };
8097
+ };
8098
+ reader.onerror = function (error) { return reject(error); };
8099
+ });
8100
+ };
8101
+ FormUploaderComponent.prototype.onClick = function () {
8102
+ $__namespace(this.inputBase.nativeElement).focus();
8103
+ };
8104
+ FormUploaderComponent.prototype.onChange = function (e) {
8105
+ var e_1, _a;
8106
+ this.inp.error = null;
8107
+ var v = [];
8108
+ try {
8109
+ for (var _b = __values(e.target.files), _c = _b.next(); !_c.done; _c = _b.next()) {
8110
+ var f = _c.value;
8111
+ v.push(f);
8112
+ }
8113
+ }
8114
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
8115
+ finally {
8116
+ try {
8117
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
8118
+ }
8119
+ finally { if (e_1) throw e_1.error; }
8120
+ }
8121
+ this.inp.value = v;
8122
+ this.changeIndex.emit('Tab');
8123
+ };
8124
+ FormUploaderComponent.prototype.onKeyDown = function (e) {
8125
+ var code = e.keyCode || e.which;
8126
+ if (code === 9 || code === 13) {
8127
+ e.preventDefault();
8128
+ this.changeIndex.emit(e.shiftKey ? 'ShiftTab' : 'Tab');
8129
+ }
8130
+ };
8131
+ FormUploaderComponent.prototype.onFocusIn = function () {
8132
+ $__namespace(this.inputBase.nativeElement).focus();
8133
+ };
8134
+ FormUploaderComponent.prototype.title = function () {
8135
+ if (this.inp.value == null || (this.inp.value instanceof Array && this.inp.value.length === 0)) {
8136
+ return this.inp.l('FileNotSelected');
8137
+ }
8138
+ var t = typeof this.inp.value === 'string' ? this.inp.value : this.inp.value.map(function (x) { return typeof x === 'string' ? x : x.name; }).join(', ');
8139
+ var l = typeof this.inp.value === 'string' ? 1 : this.inp.value.length;
8140
+ return this.inp.l('FileSelected', [l, t]);
8141
+ };
8142
+ return FormUploaderComponent;
8143
+ }());
8144
+ FormUploaderComponent.decorators = [
8145
+ { type: core.Component, args: [{
8146
+ selector: 'lib-form-uploader',
8147
+ 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",
8148
+ 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}"]
8149
+ },] }
8150
+ ];
8151
+ FormUploaderComponent.ctorParameters = function () { return []; };
8152
+ FormUploaderComponent.propDecorators = {
8153
+ inp: [{ type: core.Input }],
8154
+ changeIndex: [{ type: core.Output }],
8155
+ inputDiv: [{ type: core.ViewChild, args: ['inputDiv',] }],
8156
+ inputBaseFile: [{ type: core.ViewChild, args: ['inputBaseFile',] }],
8157
+ inputBase: [{ type: core.ViewChild, args: ['inputBase',] }]
8158
+ };
8159
+
8029
8160
  var PsToolkitUiModule = /** @class */ (function () {
8030
8161
  function PsToolkitUiModule() {
8031
8162
  }
@@ -8047,9 +8178,9 @@
8047
8178
  FormIconComponent, FormButtonComponent, FormDatetimeComponent, FormPlaqueComponent, SubHeaderComponent, FooterComponent, StepsComponent,
8048
8179
  FormFileComponent, FormSelectComponent, FormTableComponent, FormLabelComponent, AccordionComponent, FormRadioComponent, HeaderComponent,
8049
8180
  TooltipComponent, ConfirmComponent, TableComponent, ModalComponent, FormComponent, TableRowComponent, FormTreeComponent, AlertComponent,
8050
- FormTimeComponent, NotfoundComponent, FormFingerComponent, FormVehicleSearchComponent, FormVehicleComponent, FormStarComponent,
8051
- SafeStylePipe, LoginComponent, LoadingComponent, NotificationComponent, LayoutComponent, FormHiddenComponent, CalendarComponent,
8052
- ClockComponent, ChartComponent, SafeHtmlPipe, FormTagComponent, ErrorComponent, FormCkeditorComponent, FormToggleComponent
8181
+ FormTimeComponent, NotificationComponent, FormFingerComponent, FormVehicleSearchComponent, FormVehicleComponent, FormUploaderComponent,
8182
+ SafeStylePipe, LoginComponent, LoadingComponent, NotfoundComponent, LayoutComponent, FormHiddenComponent, CalendarComponent,
8183
+ ClockComponent, ChartComponent, SafeHtmlPipe, FormTagComponent, ErrorComponent, FormCkeditorComponent, FormToggleComponent, FormStarComponent
8053
8184
  ],
8054
8185
  imports: [
8055
8186
  common.CommonModule,
@@ -8064,9 +8195,9 @@
8064
8195
  FormIconComponent, FormButtonComponent, FormDatetimeComponent, FormPlaqueComponent, SubHeaderComponent, FooterComponent, StepsComponent,
8065
8196
  FormFileComponent, FormSelectComponent, FormTableComponent, FormLabelComponent, AccordionComponent, FormRadioComponent, HeaderComponent,
8066
8197
  TooltipComponent, ConfirmComponent, TableComponent, ModalComponent, FormComponent, TableRowComponent, FormTreeComponent, AlertComponent,
8067
- FormTimeComponent, NotfoundComponent, FormFingerComponent, FormVehicleSearchComponent, FormVehicleComponent, FormStarComponent,
8068
- LoginComponent, LoadingComponent, NotificationComponent, LayoutComponent, FormHiddenComponent, CalendarComponent,
8069
- ClockComponent, ChartComponent, FormTagComponent, ErrorComponent, FormCkeditorComponent, FormToggleComponent
8198
+ FormTimeComponent, NotificationComponent, FormFingerComponent, FormVehicleSearchComponent, FormVehicleComponent, FormUploaderComponent,
8199
+ LoginComponent, LoadingComponent, NotfoundComponent, LayoutComponent, FormHiddenComponent, CalendarComponent,
8200
+ ClockComponent, ChartComponent, FormTagComponent, ErrorComponent, FormCkeditorComponent, FormToggleComponent, FormStarComponent
8070
8201
  ]
8071
8202
  },] }
8072
8203
  ];
@@ -8746,6 +8877,7 @@
8746
8877
  exports.FormTimeComponent = FormTimeComponent;
8747
8878
  exports.FormToggleComponent = FormToggleComponent;
8748
8879
  exports.FormTreeComponent = FormTreeComponent;
8880
+ exports.FormUploaderComponent = FormUploaderComponent;
8749
8881
  exports.FormVehicleComponent = FormVehicleComponent;
8750
8882
  exports.FormVehicleSearchComponent = FormVehicleSearchComponent;
8751
8883
  exports.HeaderComponent = HeaderComponent;
@@ -8784,9 +8916,9 @@
8784
8916
  exports.ɵe = TableLoadingComponent;
8785
8917
  exports.ɵf = FormTreeItemComponent;
8786
8918
  exports.ɵg = TableRowComponent;
8787
- exports.ɵh = SafeStylePipe;
8788
- exports.ɵi = LoginComponent;
8789
- exports.ɵj = NotificationComponent;
8919
+ exports.ɵh = NotificationComponent;
8920
+ exports.ɵi = SafeStylePipe;
8921
+ exports.ɵj = LoginComponent;
8790
8922
  exports.ɵk = FormHiddenComponent;
8791
8923
  exports.ɵl = CalendarComponent;
8792
8924
  exports.ɵm = ClockComponent;