ps-toolkit-ui 0.0.112 → 0.0.113
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 +91 -75
- 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 +17 -14
- package/esm2015/lib/classes/permission.class.js +10 -6
- package/esm2015/lib/classes/table.class.js +45 -46
- package/esm2015/lib/components/base.component.js +2 -2
- package/fesm2015/ps-toolkit-ui.js +70 -64
- package/fesm2015/ps-toolkit-ui.js.map +1 -1
- package/lib/classes/enum.class.d.ts +11 -9
- package/lib/classes/permission.class.d.ts +5 -3
- package/package.json +1 -1
- package/ps-toolkit-ui.metadata.json +1 -1
|
@@ -469,20 +469,23 @@ var PermissionTypeEnum;
|
|
|
469
469
|
PermissionTypeEnum[PermissionTypeEnum["Form"] = -1] = "Form";
|
|
470
470
|
PermissionTypeEnum[PermissionTypeEnum["Item"] = 0] = "Item";
|
|
471
471
|
PermissionTypeEnum[PermissionTypeEnum["Access"] = 1] = "Access";
|
|
472
|
-
PermissionTypeEnum[PermissionTypeEnum["
|
|
473
|
-
PermissionTypeEnum[PermissionTypeEnum["Option"] = 3] = "Option";
|
|
474
|
-
PermissionTypeEnum[PermissionTypeEnum["OptionLink"] = 4] = "OptionLink";
|
|
475
|
-
PermissionTypeEnum[PermissionTypeEnum["OptionLinkNewTab"] = 5] = "OptionLinkNewTab";
|
|
476
|
-
PermissionTypeEnum[PermissionTypeEnum["OptionReport"] = 6] = "OptionReport";
|
|
477
|
-
PermissionTypeEnum[PermissionTypeEnum["OptionFile"] = 7] = "OptionFile";
|
|
478
|
-
PermissionTypeEnum[PermissionTypeEnum["OptionModal"] = 8] = "OptionModal";
|
|
479
|
-
PermissionTypeEnum[PermissionTypeEnum["OptionConfirm"] = 9] = "OptionConfirm";
|
|
472
|
+
PermissionTypeEnum[PermissionTypeEnum["Option"] = 2] = "Option";
|
|
480
473
|
})(PermissionTypeEnum || (PermissionTypeEnum = {}));
|
|
481
|
-
var
|
|
482
|
-
(function (
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
474
|
+
var PermissionInputActionEnum;
|
|
475
|
+
(function (PermissionInputActionEnum) {
|
|
476
|
+
PermissionInputActionEnum[PermissionInputActionEnum["None"] = 0] = "None";
|
|
477
|
+
PermissionInputActionEnum[PermissionInputActionEnum["Link"] = 1] = "Link";
|
|
478
|
+
PermissionInputActionEnum[PermissionInputActionEnum["LinkNewTab"] = 2] = "LinkNewTab";
|
|
479
|
+
PermissionInputActionEnum[PermissionInputActionEnum["Report"] = 3] = "Report";
|
|
480
|
+
PermissionInputActionEnum[PermissionInputActionEnum["File"] = 4] = "File";
|
|
481
|
+
PermissionInputActionEnum[PermissionInputActionEnum["Modal"] = 5] = "Modal";
|
|
482
|
+
PermissionInputActionEnum[PermissionInputActionEnum["Confirm"] = 6] = "Confirm";
|
|
483
|
+
})(PermissionInputActionEnum || (PermissionInputActionEnum = {}));
|
|
484
|
+
var PermissionInputTypeEnum;
|
|
485
|
+
(function (PermissionInputTypeEnum) {
|
|
486
|
+
PermissionInputTypeEnum[PermissionInputTypeEnum["Icon"] = 0] = "Icon";
|
|
487
|
+
PermissionInputTypeEnum[PermissionInputTypeEnum["Button"] = 1] = "Button";
|
|
488
|
+
})(PermissionInputTypeEnum || (PermissionInputTypeEnum = {}));
|
|
486
489
|
var VehicleType;
|
|
487
490
|
(function (VehicleType) {
|
|
488
491
|
VehicleType[VehicleType["Car"] = 1] = "Car";
|
|
@@ -4261,11 +4264,12 @@ FormSelectComponent.propDecorators = {
|
|
|
4261
4264
|
};
|
|
4262
4265
|
|
|
4263
4266
|
class PermissionClass {
|
|
4264
|
-
constructor(Name = '', Icon = '', Type = null,
|
|
4267
|
+
constructor(Name = '', Icon = '', Type = null, InputType = null, InputAction = null, Area = '', Controller = '', Action = '', Condition = null, Accesses = []) {
|
|
4265
4268
|
this.Name = Name;
|
|
4266
4269
|
this.Icon = Icon;
|
|
4267
4270
|
this.Type = Type;
|
|
4268
|
-
this.
|
|
4271
|
+
this.InputType = InputType;
|
|
4272
|
+
this.InputAction = InputAction;
|
|
4269
4273
|
this.Area = Area;
|
|
4270
4274
|
this.Controller = Controller;
|
|
4271
4275
|
this.Action = Action;
|
|
@@ -4281,17 +4285,20 @@ class PermissionClass {
|
|
|
4281
4285
|
hasAccess(a) {
|
|
4282
4286
|
return this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Access).length > 0;
|
|
4283
4287
|
}
|
|
4288
|
+
getAccesses() {
|
|
4289
|
+
return this.Accesses.filter(x => x.Type === PermissionTypeEnum.Access);
|
|
4290
|
+
}
|
|
4284
4291
|
delete(a) {
|
|
4285
4292
|
this.Accesses = this.Accesses.filter(x => x.Action !== a);
|
|
4286
4293
|
}
|
|
4287
4294
|
hasOption(a) {
|
|
4288
|
-
return this.Accesses.filter(x => x.Action === a && x.Type
|
|
4295
|
+
return this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Option).length > 0;
|
|
4289
4296
|
}
|
|
4290
4297
|
getOptions() {
|
|
4291
|
-
return this.Accesses.filter(x => x.Type
|
|
4298
|
+
return this.Accesses.filter(x => x.Type === PermissionTypeEnum.Option);
|
|
4292
4299
|
}
|
|
4293
4300
|
getOption(a) {
|
|
4294
|
-
const c = this.Accesses.filter(x => x.Action === a && x.Type
|
|
4301
|
+
const c = this.Accesses.filter(x => x.Action === a && x.Type === PermissionTypeEnum.Option);
|
|
4295
4302
|
return c.length > 0 ? c[0] : null;
|
|
4296
4303
|
}
|
|
4297
4304
|
getUrl() {
|
|
@@ -6000,7 +6007,7 @@ class BaseComponent {
|
|
|
6000
6007
|
return p.length > 0 ? this.getPermissionClass(p[0]) : null;
|
|
6001
6008
|
}
|
|
6002
6009
|
getPermissionClass(p) {
|
|
6003
|
-
return new PermissionClass(p.Name, p.Icon, p.Type, p.
|
|
6010
|
+
return new PermissionClass(p.Name, p.Icon, p.Type, p.InputType, p.InputAction, this.app.area, p.Controller, p.Action, p.Condition, this.getPermissionAccessesClass(p.Id));
|
|
6004
6011
|
}
|
|
6005
6012
|
getPermissionAccessesClass(parentId) {
|
|
6006
6013
|
return this.app.currentUser.Permissions.filter(x => x.ParentId === parentId).map(x => this.getPermissionClass(x));
|
|
@@ -6147,50 +6154,49 @@ class TableClass {
|
|
|
6147
6154
|
this.permission = false;
|
|
6148
6155
|
return;
|
|
6149
6156
|
}
|
|
6150
|
-
const
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6159
|
-
|
|
6157
|
+
for (const access of this.permissions.getAccesses()) {
|
|
6158
|
+
const accessInp = new InputClass(this.environment, this.l, access.Name, access.Icon, access.InputType === PermissionInputTypeEnum.Button ? InputType.Button : InputType.Icon, 'w-u h-30');
|
|
6159
|
+
if (access.Action === 'Insert') {
|
|
6160
|
+
if (this.form) {
|
|
6161
|
+
this.form.url = this.form.baseUrl = this.url + 'Insert';
|
|
6162
|
+
if (!this.form.onTop) {
|
|
6163
|
+
accessInp.onClick = () => {
|
|
6164
|
+
this.form.onSuccessBase = () => {
|
|
6165
|
+
this.modal.hide();
|
|
6166
|
+
this.load();
|
|
6167
|
+
};
|
|
6168
|
+
this.showInsertModal();
|
|
6160
6169
|
};
|
|
6161
|
-
this.
|
|
6162
|
-
}
|
|
6163
|
-
|
|
6170
|
+
this.buttons.unshift(accessInp);
|
|
6171
|
+
}
|
|
6172
|
+
else {
|
|
6173
|
+
this.form.displayLabel = false;
|
|
6174
|
+
}
|
|
6164
6175
|
}
|
|
6165
6176
|
else {
|
|
6166
|
-
this.
|
|
6177
|
+
this.buttons.unshift(accessInp);
|
|
6178
|
+
if (this.modal) {
|
|
6179
|
+
accessInp.onClick = () => {
|
|
6180
|
+
this.modal.show();
|
|
6181
|
+
};
|
|
6182
|
+
}
|
|
6183
|
+
else {
|
|
6184
|
+
accessInp.url = this.url + 'Insert';
|
|
6185
|
+
}
|
|
6167
6186
|
}
|
|
6168
6187
|
}
|
|
6169
|
-
else {
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
insert.url = this.url + 'Insert';
|
|
6178
|
-
}
|
|
6188
|
+
else if (access.InputAction === PermissionInputActionEnum.Report) {
|
|
6189
|
+
const p = new PermissionClass();
|
|
6190
|
+
p.RelatedId = 'Index';
|
|
6191
|
+
p.Area = this.permissions.Area;
|
|
6192
|
+
p.Controller = 'Print';
|
|
6193
|
+
p.Action = this.permissions.Controller;
|
|
6194
|
+
accessInp.url = '/Report' + p.getUrl();
|
|
6195
|
+
accessInp.urlNewTab = true;
|
|
6179
6196
|
}
|
|
6197
|
+
this.buttons.push(accessInp);
|
|
6180
6198
|
}
|
|
6181
|
-
|
|
6182
|
-
if (reportAccess != null) {
|
|
6183
|
-
const report = new InputClass(this.environment, this.l, reportAccess.Name, reportAccess.Icon, InputType.Button, 'm-h-5');
|
|
6184
|
-
const p = new PermissionClass();
|
|
6185
|
-
p.RelatedId = 'Index';
|
|
6186
|
-
p.Area = this.permissions.Area;
|
|
6187
|
-
p.Controller = 'Print';
|
|
6188
|
-
p.Action = this.permissions.Controller;
|
|
6189
|
-
report.url = '/Report' + p.getUrl();
|
|
6190
|
-
report.urlNewTab = true;
|
|
6191
|
-
this.extraButtons.push(report);
|
|
6192
|
-
}
|
|
6193
|
-
if ((this.permissions.hasAccess('Insert') || this.permissions.hasAccess('Update')) && this.form) {
|
|
6199
|
+
if ((this.permissions.hasAccess('Insert') || this.permissions.hasOption('Update')) && this.form) {
|
|
6194
6200
|
this.form.addButtons('Save', 'green', true, this.permissions.Type === PermissionTypeEnum.Form ? (data) => {
|
|
6195
6201
|
if (data.Id) {
|
|
6196
6202
|
const i = this.rows.findIndex(x => x.Id === data.Id);
|
|
@@ -6222,18 +6228,18 @@ class TableClass {
|
|
|
6222
6228
|
if (this.options.filter(x => x.name === option.Name).length > 0) {
|
|
6223
6229
|
continue;
|
|
6224
6230
|
}
|
|
6225
|
-
const opt = new InputClass(this.environment, this.l, option.Name, option.Icon, option.
|
|
6231
|
+
const opt = new InputClass(this.environment, this.l, option.Name, option.Icon, option.InputType === PermissionInputTypeEnum.Icon ? InputType.Icon : InputType.Button, 'blue h-25 m-h-5 d-ib va-m f-u');
|
|
6226
6232
|
opt.condition = option.Condition;
|
|
6227
|
-
if (option.
|
|
6233
|
+
if (option.InputAction === PermissionInputActionEnum.Link || option.InputAction === PermissionInputActionEnum.LinkNewTab) {
|
|
6228
6234
|
const p = new PermissionClass();
|
|
6229
6235
|
p.RelatedId = this.permissions.RelatedId;
|
|
6230
6236
|
p.Area = this.permissions.Area;
|
|
6231
6237
|
p.Controller = option.Controller ? option.Controller : this.permissions.Controller;
|
|
6232
6238
|
p.Action = this.permissions.Action;
|
|
6233
6239
|
opt.url = p.getUrl() + option.Action + '/{}';
|
|
6234
|
-
opt.urlNewTab = option.
|
|
6240
|
+
opt.urlNewTab = option.InputAction === PermissionInputActionEnum.LinkNewTab;
|
|
6235
6241
|
}
|
|
6236
|
-
else if (option.
|
|
6242
|
+
else if (option.InputAction === PermissionInputActionEnum.Modal) {
|
|
6237
6243
|
opt.modal = option.Modal;
|
|
6238
6244
|
opt.onClick = (btn) => {
|
|
6239
6245
|
if (opt.modal.table) {
|
|
@@ -6278,7 +6284,7 @@ class TableClass {
|
|
|
6278
6284
|
}
|
|
6279
6285
|
};
|
|
6280
6286
|
}
|
|
6281
|
-
else if (option.
|
|
6287
|
+
else if (option.InputAction === PermissionInputActionEnum.Report) {
|
|
6282
6288
|
const p = new PermissionClass();
|
|
6283
6289
|
p.RelatedId = 'Index';
|
|
6284
6290
|
p.Area = this.permissions.Area;
|
|
@@ -6287,7 +6293,7 @@ class TableClass {
|
|
|
6287
6293
|
opt.url = '/Report' + p.getUrl() + '/{}';
|
|
6288
6294
|
opt.urlNewTab = true;
|
|
6289
6295
|
}
|
|
6290
|
-
else if (option.
|
|
6296
|
+
else if (option.InputAction === PermissionInputActionEnum.File) {
|
|
6291
6297
|
const p = new PermissionClass();
|
|
6292
6298
|
p.RelatedId = this.permissions.RelatedId;
|
|
6293
6299
|
p.Area = this.permissions.Area;
|
|
@@ -6296,7 +6302,7 @@ class TableClass {
|
|
|
6296
6302
|
opt.url = '/File' + p.getUrl() + '/{}';
|
|
6297
6303
|
opt.urlNewTab = true;
|
|
6298
6304
|
}
|
|
6299
|
-
else if (option.
|
|
6305
|
+
else if (option.InputAction === PermissionInputActionEnum.Confirm) {
|
|
6300
6306
|
opt.onClick = (btn) => {
|
|
6301
6307
|
const p = new PermissionClass();
|
|
6302
6308
|
p.RelatedId = this.permissions.RelatedId;
|
|
@@ -6348,5 +6354,5 @@ class TableRowClass {
|
|
|
6348
6354
|
* Generated bundle index. Do not edit.
|
|
6349
6355
|
*/
|
|
6350
6356
|
|
|
6351
|
-
export { AccordionClass, AccordionComponent, AccordionRowClass, AlertComponent, BaseComponent, ConfirmComponent, DayClass, EnumUtils, FooterComponent, FormBankCardComponent, FormButtonComponent, FormCarComponent, FormCarSearchComponent, FormCheckboxComponent, FormClass, FormComponent, FormDateComponent, FormDatetimeComponent, FormFileComponent, FormFingerComponent, FormIconComponent, FormLabelComponent, FormPlaqueComponent, FormPlaqueSelectComponent, FormRadioComponent, FormSelectComponent, FormTableComponent, FormTextareaComponent, FormTextboxComponent, FormTimeComponent, FormTreeComponent, HeaderComponent, HelperClass, InputClass, InputError, InputType, LangClass, LayoutComponent, LoadingComponent, LoginClass, LoginStepClass, Method, ModalClass, ModalComponent, NotfoundComponent, OperationEnum, OptionClass, PaymentStatusEnum, PermissionClass,
|
|
6357
|
+
export { AccordionClass, AccordionComponent, AccordionRowClass, AlertComponent, BaseComponent, ConfirmComponent, DayClass, EnumUtils, FooterComponent, FormBankCardComponent, FormButtonComponent, FormCarComponent, FormCarSearchComponent, FormCheckboxComponent, FormClass, FormComponent, FormDateComponent, FormDatetimeComponent, FormFileComponent, FormFingerComponent, FormIconComponent, FormLabelComponent, FormPlaqueComponent, FormPlaqueSelectComponent, FormRadioComponent, FormSelectComponent, FormTableComponent, FormTextareaComponent, FormTextboxComponent, FormTimeComponent, FormTreeComponent, HeaderComponent, HelperClass, InputClass, InputError, InputType, LangClass, LayoutComponent, LoadingComponent, LoginClass, LoginStepClass, Method, ModalClass, ModalComponent, NotfoundComponent, OperationEnum, OptionClass, PaymentStatusEnum, PermissionClass, PermissionInputActionEnum, PermissionInputTypeEnum, PermissionTypeEnum, Progress, PsToolkitUiModule, RequestClass, ResultStatusEnum, SidebarClass, SidebarComponent, StatusEnum, StepsClass, StepsComponent, StepsItemClass, SubHeaderComponent, TableClass, TableCollClass, TableCollType, TableComponent, TableOptionType, TableRowClass, TooltipComponent, TreeRowClass, UserType, VehicleType, FormSelectItemComponent as ɵa, TablePaginationComponent as ɵb, SidebarItemComponent as ɵc, PsToolkitUiConfigService as ɵd, TableLoadingComponent as ɵe, FormTreeItemComponent as ɵf, TableRowComponent as ɵg, TableReportComponent as ɵh, SafeStylePipe as ɵi, LoginComponent as ɵj, NotificationComponent as ɵk };
|
|
6352
6358
|
//# sourceMappingURL=ps-toolkit-ui.js.map
|