ngx-rs-ant 0.8.4 → 0.8.8

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.
@@ -262,7 +262,7 @@ class PluginManager {
262
262
  if (this.activeItems.indexOf($event.target) < 0) {
263
263
  return;
264
264
  }
265
- this.activeItem.next({ boxItem, index, style, config: config.config });
265
+ this.activeItem.next({ boxItem, index, style, config: config.config, componentRef });
266
266
  $event.target.classList.add('plugin-active');
267
267
  });
268
268
  activeComponentRef.instance.itemRemove.subscribe(() => {
@@ -296,9 +296,14 @@ class ItemConfigComponent {
296
296
  if (pluginType === 'form') {
297
297
  instance.fieldTree = this.fieldTree;
298
298
  }
299
- instance.configChange.subscribe(() => {
300
- const componentRef = PluginManager.createComponent(item.boxItem, item.index, item.style, item.config);
301
- componentRef.location.nativeElement.click();
299
+ instance.configChange.subscribe((reload) => {
300
+ if (reload) {
301
+ const componentRef = PluginManager.createComponent(item.boxItem, item.index, item.style, item.config);
302
+ componentRef.location.nativeElement.click();
303
+ }
304
+ else {
305
+ Object.assign(item.componentRef.instance, item.config.pluginConfig);
306
+ }
302
307
  });
303
308
  });
304
309
  }
@@ -1165,9 +1170,8 @@ class ModalComponent {
1165
1170
  }
1166
1171
  show() {
1167
1172
  // 若存在多层模态框,仅保留最上层遮罩颜色,下层遮罩设置为透明
1168
- const parentElement = this.elementRef.nativeElement.parentElement;
1169
1173
  const nodeName = this.elementRef.nativeElement.nodeName;
1170
- const modals = parentElement.querySelectorAll(nodeName);
1174
+ const modals = this._parentViewContainerRef.element.nativeElement.querySelectorAll(nodeName);
1171
1175
  for (let i = 0; i < modals.length; i++) {
1172
1176
  if (i === modals.length - 1) {
1173
1177
  modals[i].querySelector('.modal-backdrop').style.backgroundColor = 'rgba(37, 43, 58, 0.05)';
@@ -1182,9 +1186,8 @@ class ModalComponent {
1182
1186
  }
1183
1187
  ngOnDestroy() {
1184
1188
  // 若存在多层模态框,下一层遮罩设置为不透明
1185
- const parentElement = this.elementRef.nativeElement.parentElement;
1186
1189
  const nodeName = this.elementRef.nativeElement.nodeName;
1187
- const nextModal = parentElement.querySelector(nodeName + ':nth-last-child(2)');
1190
+ const nextModal = this._parentViewContainerRef.element.nativeElement.querySelector(nodeName + ':nth-last-child(2)');
1188
1191
  if (nextModal) {
1189
1192
  nextModal.querySelector('.modal-backdrop').style.backgroundColor = 'rgba(37, 43, 58, 0.05)';
1190
1193
  }
@@ -1319,6 +1322,7 @@ class ModalService {
1319
1322
  };
1320
1323
  modalRef.instance.title = title;
1321
1324
  modalRef.instance.size = size;
1325
+ modalRef.instance._parentViewContainerRef = viewContainerRef;
1322
1326
  modalRef.instance.contentTemplate = contentTemplate;
1323
1327
  modalRef.instance.contentTemplateContext = contentTemplateContext;
1324
1328
  modalRef.instance.footerTemplate = footerTemplate;