@abp/ng.theme.shared 7.1.0-rc.1 → 7.1.0-rc.2

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.
Files changed (65) hide show
  1. package/esm2020/extensions/lib/adapters/date-time.adapter.mjs +3 -3
  2. package/esm2020/extensions/lib/components/abstract-actions/abstract-actions.component.mjs +1 -1
  3. package/esm2020/extensions/lib/components/extensible-form/extensible-form-prop.component.mjs +3 -3
  4. package/esm2020/extensions/lib/components/extensible-form/extensible-form.component.mjs +1 -1
  5. package/esm2020/extensions/lib/components/extensible-table/extensible-table.component.mjs +4 -4
  6. package/esm2020/extensions/lib/components/grid-actions/grid-actions.component.mjs +1 -1
  7. package/esm2020/extensions/lib/components/page-toolbar/page-toolbar.component.mjs +8 -3
  8. package/esm2020/extensions/lib/models/actions.mjs +2 -2
  9. package/esm2020/extensions/lib/models/entity-actions.mjs +2 -2
  10. package/esm2020/extensions/lib/models/entity-props.mjs +13 -6
  11. package/esm2020/extensions/lib/models/form-props.mjs +3 -3
  12. package/esm2020/extensions/lib/models/internal/object-extensions.mjs +1 -1
  13. package/esm2020/extensions/lib/models/props.mjs +1 -1
  14. package/esm2020/extensions/lib/models/toolbar-actions.mjs +1 -1
  15. package/esm2020/extensions/lib/pipes/create-injector.pipe.mjs +2 -2
  16. package/esm2020/extensions/lib/utils/actions.util.mjs +1 -1
  17. package/esm2020/extensions/lib/utils/enum.util.mjs +1 -1
  18. package/esm2020/extensions/lib/utils/form-props.util.mjs +2 -2
  19. package/esm2020/extensions/lib/utils/props.util.mjs +1 -1
  20. package/esm2020/extensions/lib/utils/state.util.mjs +11 -11
  21. package/esm2020/lib/components/breadcrumb/breadcrumb.component.mjs +2 -2
  22. package/esm2020/lib/components/confirmation/confirmation.component.mjs +5 -2
  23. package/esm2020/lib/components/password/password.component.mjs +1 -1
  24. package/esm2020/lib/directives/index.mjs +2 -1
  25. package/esm2020/lib/directives/visible.directive.mjs +63 -0
  26. package/esm2020/lib/models/nav-item.mjs +1 -2
  27. package/esm2020/lib/services/abstract-menu.service.mjs +1 -1
  28. package/esm2020/lib/services/confirmation.service.mjs +1 -1
  29. package/esm2020/lib/theme-shared.module.mjs +7 -3
  30. package/esm2020/lib/tokens/confirmation-icons.token.mjs +2 -1
  31. package/extensions/lib/adapters/date-time.adapter.d.ts +3 -3
  32. package/extensions/lib/components/abstract-actions/abstract-actions.component.d.ts +2 -2
  33. package/extensions/lib/components/extensible-form/extensible-form-prop.component.d.ts +1 -1
  34. package/extensions/lib/components/extensible-table/extensible-table.component.d.ts +1 -1
  35. package/extensions/lib/components/grid-actions/grid-actions.component.d.ts +1 -1
  36. package/extensions/lib/components/page-toolbar/page-toolbar.component.d.ts +5 -2
  37. package/extensions/lib/models/actions.d.ts +6 -5
  38. package/extensions/lib/models/entity-props.d.ts +3 -3
  39. package/extensions/lib/models/form-props.d.ts +2 -2
  40. package/extensions/lib/models/internal/object-extensions.d.ts +1 -1
  41. package/extensions/lib/models/props.d.ts +4 -3
  42. package/extensions/lib/models/toolbar-actions.d.ts +2 -2
  43. package/extensions/lib/tokens/extensions.token.d.ts +1 -1
  44. package/extensions/lib/utils/actions.util.d.ts +1 -1
  45. package/extensions/lib/utils/enum.util.d.ts +2 -2
  46. package/extensions/lib/utils/form-props.util.d.ts +2 -2
  47. package/extensions/lib/utils/props.util.d.ts +3 -2
  48. package/extensions/lib/utils/state.util.d.ts +3 -3
  49. package/fesm2015/abp-ng.theme.shared-extensions.mjs +33 -21
  50. package/fesm2015/abp-ng.theme.shared-extensions.mjs.map +1 -1
  51. package/fesm2015/abp-ng.theme.shared.mjs +73 -6
  52. package/fesm2015/abp-ng.theme.shared.mjs.map +1 -1
  53. package/fesm2020/abp-ng.theme.shared-extensions.mjs +33 -21
  54. package/fesm2020/abp-ng.theme.shared-extensions.mjs.map +1 -1
  55. package/fesm2020/abp-ng.theme.shared.mjs +72 -6
  56. package/fesm2020/abp-ng.theme.shared.mjs.map +1 -1
  57. package/lib/components/confirmation/confirmation.component.d.ts +1 -1
  58. package/lib/components/password/password.component.d.ts +1 -1
  59. package/lib/directives/index.d.ts +1 -0
  60. package/lib/directives/visible.directive.d.ts +18 -0
  61. package/lib/models/nav-item.d.ts +4 -2
  62. package/lib/services/abstract-menu.service.d.ts +2 -1
  63. package/lib/theme-shared.module.d.ts +8 -7
  64. package/lib/tokens/confirmation-icons.token.d.ts +1 -0
  65. package/package.json +3 -3
@@ -38,7 +38,7 @@ class DateTimeAdapter {
38
38
  if (!value)
39
39
  return '';
40
40
  const now = new Date();
41
- value = {
41
+ const newValue = {
42
42
  // TODO look for strict mode errors
43
43
  year: now.getUTCFullYear(),
44
44
  month: now.getMonth() + 1,
@@ -49,7 +49,7 @@ class DateTimeAdapter {
49
49
  ...this.value,
50
50
  ...value,
51
51
  };
52
- const date = new Date(value.year, value.month - 1, value.day, value.hour, value.minute, value.second);
52
+ const date = new Date(newValue.year, newValue.month - 1, value.day, value.hour, value.minute, value.second);
53
53
  return new Date(date).toISOString();
54
54
  }
55
55
  }
@@ -222,7 +222,7 @@ class EditFormPropsFactory extends PropsFactory {
222
222
  }
223
223
  class FormProp extends Prop {
224
224
  constructor(options) {
225
- super(options.type, options.name, options.displayName, options.permission, options.visible, options.isExtra, options.template, options.className);
225
+ super(options.type, options.name, options.displayName || '', options.permission || '', options.visible, options.isExtra, options.template, options.className);
226
226
  this.group = options.group;
227
227
  this.className = options.className;
228
228
  this.asyncValidators = options.asyncValidators || (_ => []);
@@ -233,7 +233,7 @@ class FormProp extends Prop {
233
233
  this.options = options.options;
234
234
  this.id = options.id || options.name;
235
235
  const defaultValue = options.defaultValue;
236
- this.defaultValue = isFalsyValue(defaultValue) ? defaultValue : defaultValue || null;
236
+ this.defaultValue = isFalsyValue(defaultValue) ? defaultValue : defaultValue || '';
237
237
  this.displayTextResolver = options.displayTextResolver;
238
238
  }
239
239
  static create(options) {
@@ -457,7 +457,7 @@ class ExtensibleFormPropComponent {
457
457
  this.passwordKey = "ThemeShared.Extensions.PasswordComponent" /* eThemeSharedComponents.PasswordComponent */;
458
458
  this.disabledFn = (data) => false;
459
459
  this.search = (text$) => text$
460
- ? text$.pipe(debounceTime(300), distinctUntilChanged(), switchMap(text => this.prop.options(this.data, text)))
460
+ ? text$.pipe(debounceTime(300), distinctUntilChanged(), switchMap(text => this.prop?.options?.(this.data, text) || of([])))
461
461
  : of([]);
462
462
  this.typeaheadFormatter = (option) => option.key;
463
463
  this.form = groupDirective.form;
@@ -479,7 +479,7 @@ class ExtensibleFormPropComponent {
479
479
  }
480
480
  get isInvalid() {
481
481
  const control = this.form.get(this.prop.name);
482
- return control.touched && control.invalid;
482
+ return control?.touched && control.invalid;
483
483
  }
484
484
  getTypeaheadControls() {
485
485
  const { name } = this.prop;
@@ -631,7 +631,7 @@ class ActionData {
631
631
  }
632
632
  }
633
633
  class Action {
634
- constructor(permission, visible = _ => true, action = _ => { }) {
634
+ constructor(permission, visible = () => true, action = () => { }) {
635
635
  this.permission = permission;
636
636
  this.visible = visible;
637
637
  this.action = action;
@@ -680,7 +680,7 @@ class EntityActionsFactory extends ActionsFactory {
680
680
  }
681
681
  class EntityAction extends Action {
682
682
  constructor(options) {
683
- super(options.permission, options.visible, options.action);
683
+ super(options.permission || '', options.visible, options.action);
684
684
  this.text = options.text;
685
685
  this.icon = options.icon || '';
686
686
  }
@@ -708,14 +708,21 @@ class EntityPropsFactory extends PropsFactory {
708
708
  }
709
709
  class EntityProp extends Prop {
710
710
  constructor(options) {
711
- super(options.type, options.name, options.displayName, options.permission, options.visible, options.isExtra);
711
+ super(options.type, options.name, options.displayName || '', options.permission || '', options.visible, options.isExtra);
712
712
  this.columnWidth = options.columnWidth;
713
713
  this.sortable = options.sortable || false;
714
714
  this.valueResolver =
715
- options.valueResolver || (data => of(escapeHtmlChars(data.record[this.name])));
716
- this.action = options.action;
717
- this.component = options.component;
718
- this.enumList = options.enumList;
715
+ options.valueResolver ||
716
+ (data => of(escapeHtmlChars(data.record[this.name])));
717
+ if (options.action) {
718
+ this.action = options.action;
719
+ }
720
+ if (options.component) {
721
+ this.component = options.component;
722
+ }
723
+ if (options.enumList) {
724
+ this.enumList = options.enumList;
725
+ }
719
726
  }
720
727
  static create(options) {
721
728
  return new EntityProp(options);
@@ -968,7 +975,7 @@ class ExtensibleTableComponent {
968
975
  this.columnWidths = widths;
969
976
  }
970
977
  getDate(value, format) {
971
- return value ? formatDate(value, format, this.locale) : '';
978
+ return value && format ? formatDate(value, format, this.locale) : '';
972
979
  }
973
980
  getIcon(value) {
974
981
  return value
@@ -978,7 +985,7 @@ class ExtensibleTableComponent {
978
985
  getEnum(rowValue, list) {
979
986
  if (!list)
980
987
  return rowValue;
981
- const { key } = list.find(({ value }) => value === rowValue);
988
+ const { key } = list.find(({ value }) => value === rowValue) || {};
982
989
  return key;
983
990
  }
984
991
  getContent(prop, data) {
@@ -993,7 +1000,7 @@ class ExtensibleTableComponent {
993
1000
  case "datetime" /* ePropType.DateTime */:
994
1001
  return this.getDate(value, getShortDateShortTimeFormat(this.config));
995
1002
  case "enum" /* ePropType.Enum */:
996
- return this.getEnum(value, prop.enumList);
1003
+ return this.getEnum(value, prop.enumList || []);
997
1004
  default:
998
1005
  return value;
999
1006
  // More types can be handled in the future
@@ -1058,7 +1065,7 @@ class CreateInjectorPipe {
1058
1065
  transform(_, action, context) {
1059
1066
  const get = (token, notFoundValue, options) => {
1060
1067
  const componentData = context.getData();
1061
- const componentDataCallback = data => {
1068
+ const componentDataCallback = (data) => {
1062
1069
  data = data ?? context.getData();
1063
1070
  return action.action(data);
1064
1071
  };
@@ -1095,6 +1102,11 @@ class PageToolbarComponent extends AbstractActionsComponent {
1095
1102
  this.getData = () => this.data;
1096
1103
  this.trackByFn = (_, item) => item.action || item.component;
1097
1104
  }
1105
+ asToolbarAction(value) {
1106
+ return {
1107
+ value: value,
1108
+ };
1109
+ }
1098
1110
  }
1099
1111
  PageToolbarComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: PageToolbarComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
1100
1112
  PageToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.0.4", type: PageToolbarComponent, selector: "abp-page-toolbar", providers: [
@@ -1102,7 +1114,7 @@ PageToolbarComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", v
1102
1114
  provide: EXTENSIONS_ACTION_TYPE,
1103
1115
  useValue: 'toolbarActions',
1104
1116
  },
1105
- ], exportAs: ["abpPageToolbar"], usesInheritance: true, ngImport: i0, template: "<div class=\"row justify-content-end mx-0 gap-2\" id=\"AbpContentToolbar\">\r\n <div\r\n class=\"col-auto px-0 pt-0 pt-md-2\"\r\n [class.pe-0]=\"last\"\r\n *ngFor=\"let action of actionList; trackBy: trackByFn; let last = last\"\r\n >\r\n <ng-container *ngIf=\"action.visible(data)\">\r\n <ng-container *abpPermission=\"action.permission;runChangeDetection: false\">\r\n <ng-container *ngIf=\"action.component as component; else button\">\r\n <ng-container\r\n *ngComponentOutlet=\"component; injector: record | createInjector: action:this\"\r\n ></ng-container>\r\n </ng-container>\r\n\r\n <ng-template #button>\r\n <button\r\n (click)=\"action.action(data)\"\r\n type=\"button\"\r\n [ngClass]=\"action.btnClass ? action.btnClass : defaultBtnClass\"\r\n class=\"d-inline-flex align-items-center gap-1\"\r\n >\r\n <i [ngClass]=\"action.icon\" [class.me-1]=\"action.icon\"></i>\r\n {{ action.text | abpLocalization }}\r\n </button>\r\n </ng-template>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n</div>\r\n", dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.PermissionDirective, selector: "[abpPermission]", inputs: ["abpPermission", "abpPermissionRunChangeDetection"] }, { kind: "pipe", type: i1.LocalizationPipe, name: "abpLocalization" }, { kind: "pipe", type: CreateInjectorPipe, name: "createInjector" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1117
+ ], exportAs: ["abpPageToolbar"], usesInheritance: true, ngImport: i0, template: "<div class=\"row justify-content-end mx-0 gap-2\" id=\"AbpContentToolbar\">\r\n <div\r\n class=\"col-auto px-0 pt-0 \"\r\n [class.pe-0]=\"last\"\r\n *ngFor=\"let action of actionList; trackBy: trackByFn; let last = last\"\r\n >\r\n <ng-container *ngIf=\"action.visible(data)\">\r\n <ng-container *abpPermission=\"action.permission;runChangeDetection: false\">\r\n <ng-container *ngIf=\"action.component as component; else button\">\r\n <ng-container\r\n *ngComponentOutlet=\"component; injector: record | createInjector: action:this\"\r\n ></ng-container>\r\n </ng-container>\r\n\r\n <ng-template #button>\r\n <ng-container *ngIf=\"asToolbarAction(action).value as toolbarAction\">\r\n <button\r\n (click)=\"action.action(data)\"\r\n type=\"button\"\r\n [ngClass]=\"toolbarAction.btnClass ? toolbarAction.btnClass : defaultBtnClass\"\r\n class=\"d-inline-flex align-items-center gap-1\"\r\n >\r\n <i [ngClass]=\"toolbarAction.icon\" [class.me-1]=\"toolbarAction.icon\"></i>\r\n {{ toolbarAction.text | abpLocalization }}\r\n </button>\r\n </ng-container>\r\n </ng-template>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n</div>\r\n", dependencies: [{ kind: "directive", type: i3.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i3.NgComponentOutlet, selector: "[ngComponentOutlet]", inputs: ["ngComponentOutlet", "ngComponentOutletInjector", "ngComponentOutletContent", "ngComponentOutletNgModule", "ngComponentOutletNgModuleFactory"] }, { kind: "directive", type: i3.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i3.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "directive", type: i1.PermissionDirective, selector: "[abpPermission]", inputs: ["abpPermission", "abpPermissionRunChangeDetection"] }, { kind: "pipe", type: i1.LocalizationPipe, name: "abpLocalization" }, { kind: "pipe", type: CreateInjectorPipe, name: "createInjector" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1106
1118
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImport: i0, type: PageToolbarComponent, decorators: [{
1107
1119
  type: Component,
1108
1120
  args: [{ exportAs: 'abpPageToolbar', selector: 'abp-page-toolbar', providers: [
@@ -1110,7 +1122,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.0.4", ngImpor
1110
1122
  provide: EXTENSIONS_ACTION_TYPE,
1111
1123
  useValue: 'toolbarActions',
1112
1124
  },
1113
- ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"row justify-content-end mx-0 gap-2\" id=\"AbpContentToolbar\">\r\n <div\r\n class=\"col-auto px-0 pt-0 pt-md-2\"\r\n [class.pe-0]=\"last\"\r\n *ngFor=\"let action of actionList; trackBy: trackByFn; let last = last\"\r\n >\r\n <ng-container *ngIf=\"action.visible(data)\">\r\n <ng-container *abpPermission=\"action.permission;runChangeDetection: false\">\r\n <ng-container *ngIf=\"action.component as component; else button\">\r\n <ng-container\r\n *ngComponentOutlet=\"component; injector: record | createInjector: action:this\"\r\n ></ng-container>\r\n </ng-container>\r\n\r\n <ng-template #button>\r\n <button\r\n (click)=\"action.action(data)\"\r\n type=\"button\"\r\n [ngClass]=\"action.btnClass ? action.btnClass : defaultBtnClass\"\r\n class=\"d-inline-flex align-items-center gap-1\"\r\n >\r\n <i [ngClass]=\"action.icon\" [class.me-1]=\"action.icon\"></i>\r\n {{ action.text | abpLocalization }}\r\n </button>\r\n </ng-template>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n</div>\r\n" }]
1125
+ ], changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"row justify-content-end mx-0 gap-2\" id=\"AbpContentToolbar\">\r\n <div\r\n class=\"col-auto px-0 pt-0 \"\r\n [class.pe-0]=\"last\"\r\n *ngFor=\"let action of actionList; trackBy: trackByFn; let last = last\"\r\n >\r\n <ng-container *ngIf=\"action.visible(data)\">\r\n <ng-container *abpPermission=\"action.permission;runChangeDetection: false\">\r\n <ng-container *ngIf=\"action.component as component; else button\">\r\n <ng-container\r\n *ngComponentOutlet=\"component; injector: record | createInjector: action:this\"\r\n ></ng-container>\r\n </ng-container>\r\n\r\n <ng-template #button>\r\n <ng-container *ngIf=\"asToolbarAction(action).value as toolbarAction\">\r\n <button\r\n (click)=\"action.action(data)\"\r\n type=\"button\"\r\n [ngClass]=\"toolbarAction.btnClass ? toolbarAction.btnClass : defaultBtnClass\"\r\n class=\"d-inline-flex align-items-center gap-1\"\r\n >\r\n <i [ngClass]=\"toolbarAction.icon\" [class.me-1]=\"toolbarAction.icon\"></i>\r\n {{ toolbarAction.text | abpLocalization }}\r\n </button>\r\n </ng-container>\r\n </ng-template>\r\n </ng-container>\r\n </ng-container>\r\n </div>\r\n</div>\r\n" }]
1114
1126
  }], ctorParameters: function () { return [{ type: i0.Injector }]; } });
1115
1127
 
1116
1128
  var objectExtensions = /*#__PURE__*/Object.freeze({
@@ -1209,7 +1221,7 @@ function mergeWithDefaultActions(extension, defaultActions, ...contributors) {
1209
1221
  }
1210
1222
 
1211
1223
  function generateFormFromProps(data) {
1212
- const extensions = data.getInjected(ExtensionsService);
1224
+ const extensions = data.getInjected((ExtensionsService));
1213
1225
  const identifier = data.getInjected(EXTENSIONS_IDENTIFIER);
1214
1226
  const form = new UntypedFormGroup({});
1215
1227
  const extraForm = new UntypedFormGroup({});
@@ -1387,7 +1399,7 @@ function createPropertiesToContributorsMapper(generateDisplayName, resource, enu
1387
1399
  if (property.ui.onTable.isVisible) {
1388
1400
  const sortable = Boolean(property.ui.onTable.isSortable);
1389
1401
  const columnWidth = type === "boolean" /* ePropType.Boolean */ ? 150 : 250;
1390
- const valueResolver = type === "enum" /* ePropType.Enum */
1402
+ const valueResolver = type === "enum" /* ePropType.Enum */ && property.type
1391
1403
  ? createEnumValueResolver(property.type, enums[property.type], propName)
1392
1404
  : createExtraPropertyValueResolver(propName);
1393
1405
  const entityProp = new EntityProp({