imm-element-ui 2.3.3 → 2.3.5

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.
@@ -9314,7 +9314,9 @@ class PageFormComponent extends AmComponent {
9314
9314
  this.mergePageFormData(data);
9315
9315
  });
9316
9316
  this.pageFormService.updateDataByKey$.pipe(takeUntil(this.destroy$)).subscribe(({ key, value }) => {
9317
- this.mergePageFormData({ [key]: value });
9317
+ this.mergeUpsert(value);
9318
+ this.refreshSlotRenderStates();
9319
+ this.cdr.markForCheck();
9318
9320
  });
9319
9321
  }
9320
9322
  mergePageFormData(data) {
@@ -9345,6 +9347,54 @@ class PageFormComponent extends AmComponent {
9345
9347
  }
9346
9348
  });
9347
9349
  }
9350
+ // 插槽组件 更新upsert
9351
+ mergeUpsert(payload) {
9352
+ const { action, field, headerName, newValue, oldValue, recordIndex, index, data } = payload;
9353
+ let sub = this.upsertPrm.subsert[index];
9354
+ if (action == 'add') {
9355
+ let mainField = this.gridList()[index]['gridOptions']['mainField'];
9356
+ console.log('mainField', mainField, field, recordIndex);
9357
+ sub['maptmp']?.set(recordIndex, { ...data });
9358
+ if (field == mainField) {
9359
+ sub['logtmp']?.set(recordIndex + field, { newValue: newValue, id: 0, label: headerName });
9360
+ }
9361
+ }
9362
+ else if (action === 'edit') {
9363
+ let o;
9364
+ if (sub['maptmp']?.has(recordIndex)) {
9365
+ o = sub['maptmp']?.get(recordIndex);
9366
+ Object.assign(o, { [field]: newValue });
9367
+ }
9368
+ else {
9369
+ o = { id: data['id'], [field]: newValue };
9370
+ }
9371
+ sub['maptmp']?.set(recordIndex, o);
9372
+ sub['logtmp']?.set(recordIndex + field, {
9373
+ newValue: newValue,
9374
+ oldValue: oldValue,
9375
+ id: data['id'],
9376
+ label: headerName,
9377
+ });
9378
+ }
9379
+ else if (action === 'delete') {
9380
+ if (sub['maptmp']?.has(recordIndex)) {
9381
+ let data = sub['maptmp']?.get(recordIndex);
9382
+ data[field] && (delete data[field]);
9383
+ let keys = Object.keys(data);
9384
+ (keys.length == 0) && (sub['maptmp']?.delete(recordIndex));
9385
+ }
9386
+ if (sub['logtmp']?.get(recordIndex + field)) {
9387
+ sub['logtmp']?.delete(recordIndex + field);
9388
+ }
9389
+ }
9390
+ let dt = [];
9391
+ sub['maptmp']?.forEach((value, key) => {
9392
+ dt.push(value);
9393
+ });
9394
+ sub['subData'] = dt;
9395
+ console.log('upsert-----', this.upsertPrm);
9396
+ this.action.saveSignal.set(true);
9397
+ }
9348
9398
  ngAfterViewInit() {
9349
9399
  this.i18n.change.subscribe((res) => {
9350
9400
  this.stepsVisible = false;
@@ -9747,6 +9797,7 @@ class PageFormComponent extends AmComponent {
9747
9797
  context.model = grid.type === 'grid' ? this.getPrm.data?.[grid.subDataKey] : this.subFormModel[grid.subDataKey] || {};
9748
9798
  context.upsert = this.upsertPrm;
9749
9799
  context.active = this.indexValue === index;
9800
+ context.gridDisable = this.gridDisable;
9750
9801
  return context;
9751
9802
  }
9752
9803
  resolveSlotKey(grid) {
@@ -9766,8 +9817,25 @@ class PageFormComponent extends AmComponent {
9766
9817
  this.dataSourceShow();
9767
9818
  }
9768
9819
  delRowClickHandler(grid) {
9769
- this.pageFormService.removeData(grid.subDataKey, this.pageFormService.getSelectedRows(), grid);
9770
- this.pageFormService.setSelectedRows([]);
9820
+ const selectItem = this.pageFormService.getSelectedRows() || [];
9821
+ console.log('seletc-----', selectItem);
9822
+ let ids = [];
9823
+ if (grid.slotKey === 'gantt') {
9824
+ ids = selectItem.filter((v) => v.id && typeof v.id === 'number').map((v) => v.id);
9825
+ }
9826
+ else {
9827
+ ids = selectItem.filter((v) => v.id).map((v) => v.id);
9828
+ }
9829
+ if (ids.length > 0) {
9830
+ this.web_remove({ modelName: grid.gridOptions.modelName, ids }).subscribe(res => {
9831
+ this.pageFormService.removeData(grid.subDataKey, this.pageFormService.getSelectedRows(), grid);
9832
+ this.pageFormService.setSelectedRows([]);
9833
+ });
9834
+ }
9835
+ else {
9836
+ this.pageFormService.removeData(grid.subDataKey, this.pageFormService.getSelectedRows(), grid);
9837
+ this.pageFormService.setSelectedRows([]);
9838
+ }
9771
9839
  }
9772
9840
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.13", ngImport: i0, type: PageFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
9773
9841
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "18.2.13", type: PageFormComponent, isStandalone: true, selector: "app-page-form", inputs: { addVisible: { classPropertyName: "addVisible", publicName: "addVisible", isSignal: true, isRequired: false, transformFunction: null }, gridList: { classPropertyName: "gridList", publicName: "gridList", isSignal: true, isRequired: false, transformFunction: null }, form: { classPropertyName: "form", publicName: "form", isSignal: true, isRequired: true, transformFunction: null }, getPrmInput: { classPropertyName: "getPrmInput", publicName: "getPrmInput", isSignal: true, isRequired: true, transformFunction: null }, statusSteps: { classPropertyName: "statusSteps", publicName: "statusSteps", isSignal: true, isRequired: false, transformFunction: null }, statusKey: { classPropertyName: "statusKey", publicName: "statusKey", isSignal: true, isRequired: false, transformFunction: null }, hrefBtnList: { classPropertyName: "hrefBtnList", publicName: "hrefBtnList", isSignal: true, isRequired: false, transformFunction: null }, setTitle: { classPropertyName: "setTitle", publicName: "setTitle", isSignal: true, isRequired: false, transformFunction: null }, actionList: { classPropertyName: "actionList", publicName: "actionList", isSignal: true, isRequired: false, transformFunction: null }, modelLog: { classPropertyName: "modelLog", publicName: "modelLog", isSignal: true, isRequired: false, transformFunction: null }, formDisabled: { classPropertyName: "formDisabled", publicName: "formDisabled", isSignal: true, isRequired: false, transformFunction: null }, statusConf: { classPropertyName: "statusConf", publicName: "statusConf", isSignal: true, isRequired: false, transformFunction: null }, formDetail: { classPropertyName: "formDetail", publicName: "formDetail", isSignal: true, isRequired: false, transformFunction: null }, saveFunc: { classPropertyName: "saveFunc", publicName: "saveFunc", isSignal: true, isRequired: false, transformFunction: null }, configNewPath: { classPropertyName: "configNewPath", publicName: "configNewPath", isSignal: true, isRequired: false, transformFunction: null }, authLevel: { classPropertyName: "authLevel", publicName: "authLevel", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "window:resize": "onResize()" } }, providers: [], queries: [{ propertyName: "pageFormSlots", predicate: PageFormSlotDirective, descendants: true }], viewQueries: [{ propertyName: "cForm", first: true, predicate: ["cForm"], descendants: true }, { propertyName: "customGrid", predicate: ["customGrid"], descendants: true }, { propertyName: "tabForm", predicate: ["tabForm"], descendants: true }], usesInheritance: true, ngImport: i0, template: "<div class=\"md:overflow-hidden\">\n\t<div class=\"flex md:flex-wrap lg:flex-nowrap items-center md:justify-between py-1 px-1 border-b-[1px] border-[#dbdbdb] bg-white\">\n\t\t<div class=\"lg:basis-1/3 order-1\">\n\t\t\t<app-crumb-action\n\t\t\t\t[addVisible]=\"addVisible()\"\n\t\t\t\t[newUrl]=\"newUrl\"\n\t\t\t\t[isShowCog]=\"true\"\n\t\t\t\t[outlined]=\"true\"\n\t\t\t\t[authLevel]=\"authLevel()\"\n\t\t\t\t[actionList]=\"actionList()\"\n\t\t\t\t[configNewPath]=\"configNewPath()\"\n\t\t\t\t[data]=\"getPrm.data ?? {}\"\n\t\t\t\t[saveBtnDisable]=\"saveBtnDisable\"\n\t\t\t\t(actionEvent)=\"authClick($event)\"\n\t\t\t\t(saveEvent)=\"submitForm()\">\n\t\t\t</app-crumb-action>\n\t\t</div>\n\n\t\t<div class=\"basis-1/5 lg:basis-2/3 order-2 lg:order-2 md:order-last md:basis-full md:mt-[6px]\">\n\t\t\t<href-btn-list\n\t\t\t\t[hrefs]=\"hrefBtnList()\"\n\t\t\t\t(hrefClick)=\"goRun($event)\"></href-btn-list>\n\t\t\t<!-- @if (id) {\n\t\t\t\t@for (btn of hrefBtnList(); track btn) {\n\t\t\t\t\t<p-button\n\t\t\t\t\t\t[variant]=\"btn?.variant\"\n\t\t\t\t\t\t[severity]=\"btn?.severity\"\n\t\t\t\t\t\tclass=\"mr-[6px]\"\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t[icon]=\"btn?.icon\"\n\t\t\t\t\t\tlabel=\"{{ btn.i18nKey ? i18n.fanyi(btn.i18nKey) : btn.label }}\"\n\t\t\t\t\t\t(click)=\"goRun(btn)\">\n\t\t\t\t\t</p-button>\n\t\t\t\t}\n\t\t\t} -->\n\t\t</div>\n\t\t<div class=\"basis-1/3 order-3 flex flex-row-reverse\">\n\t\t\t@if (modelLog()) {\n\t\t\t\t<div class=\"hidden md:block\">\n\t\t\t\t\t<span\n\t\t\t\t\t\t[class]=\"'iconfont icon-sidebar icon-sidebar-' + sidebarMode()\"\n\t\t\t\t\t\t(click)=\"toggleLog()\"></span>\n\t\t\t\t</div>\n\t\t\t}\n\t\t</div>\n\t</div>\n\t<div class=\"flex\">\n\t\t<div class=\"px-2 flex flex-wrap items-center flex-1\">\n\t\t\t<div class=\"hidden md:basis-1/3 py-1 basis-full md:flex items-center flex-row order-1\">\n\t\t\t\t@for (action of actionList(); let i = $index; track action) {\n\t\t\t\t\t<p-button\n\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t[icon]=\"getPrm.data?.icon\"\n\t\t\t\t\t\t[loading]=\"action.loading\"\n\t\t\t\t\t\t[label]=\"action.i18nKey ? (action.i18nKey | translate) : action.label\"\n\t\t\t\t\t\t[disabled]=\"action.btnDisabled ? action.btnDisabled(getPrm.data) : false\"\n\t\t\t\t\t\t[styleClass]=\"\n\t\t\t\t\t\t\t(action.auth || 0) > (authLevel() || 0) || !!action.btnHidden?.(getPrm.data)\n\t\t\t\t\t\t\t\t? 'form-action hidden'\n\t\t\t\t\t\t\t\t: 'form-action block mr-[.5rem]'\n\t\t\t\t\t\t\"\n\t\t\t\t\t\t(onClick)=\"action.onClick != '' && action.onClick?.(getPrm.data, action)\">\n\t\t\t\t\t</p-button>\n\t\t\t\t}\n\t\t\t</div>\n\t\t\t<div class=\"md:basis-2/3 basis-full flex md:flex-row-reverse flex-row md:order-2 order-first w-full\">\n\t\t\t\t@if (stepsVisible) {\n\t\t\t\t\t<custom-steps\n\t\t\t\t\t\t#customSteps\n\t\t\t\t\t\tclass=\"w-full\"\n\t\t\t\t\t\t[steps]=\"statusSteps()\"\n\t\t\t\t\t\t[modelLog]=\"showLog()\"\n\t\t\t\t\t\t[current]=\"getPrm.data && getPrm.data[statusKey()] !== undefined ? getPrm.data[statusKey()] : 0\"\n\t\t\t\t\t\t[authLevel]=\"authLevel()\"\n\t\t\t\t\t\t[isClick]=\"this.statusConf().isClick\"\n\t\t\t\t\t\t(change)=\"statusChange($event, customSteps)\">\n\t\t\t\t\t</custom-steps>\n\t\t\t\t}\n\t\t\t</div>\n\t\t</div>\n\t\t@if (showLog()) {\n\t\t\t<div class=\"lg:w-[400px] md:w-[300px] hidden md:block\"></div>\n\t\t}\n\t</div>\n\t<div class=\"main flex flex-wrap\">\n\t\t<div class=\"w-full md:flex-1 md:h-full md:overflow-y-auto\">\n\t\t\t<div class=\"bg-white mx-2 form-panel\">\n\t\t\t\t<div class=\"p-2 flex-1\">\n\t\t\t\t\t<form [formGroup]=\"form().form!\">\n\t\t\t\t\t\t<custom-form\n\t\t\t\t\t\t\t#cForm\n\t\t\t\t\t\t\t[options]=\"formOptions\"\n\t\t\t\t\t\t\t[upsert]=\"upsertPrm\"\n\t\t\t\t\t\t\t[model]=\"getPrm.data ?? {}\"></custom-form>\n\t\t\t\t\t</form>\n\t\t\t\t</div>\n\t\t\t\t@if (gridList() && gridList().length > 0) {\n\t\t\t\t\t<div class=\"relative mb-2\">\n\t\t\t\t\t\t<p-tabs [(value)]=\"indexValue\">\n\t\t\t\t\t\t\t<p-tablist>\n\t\t\t\t\t\t\t\t@for (fchild of gridList(); let i = $index; track fchild.gridOptions?.modelName || fchild.subDataKey || fchild.slotKey || $index) {\n\t\t\t\t\t\t\t\t\t<p-tab\n\t\t\t\t\t\t\t\t\t\t[value]=\"i\"\n\t\t\t\t\t\t\t\t\t\t(click)=\"tabClick()\">\n\t\t\t\t\t\t\t\t\t\t{{ fchild.i18nKey ? i18n.fanyi(fchild.i18nKey) : fchild.title }}\n\t\t\t\t\t\t\t\t\t</p-tab>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</p-tablist>\n\t\t\t\t\t\t</p-tabs>\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t\t@for (grid of gridList(); let i = $index; track grid.gridOptions?.modelName || grid.subDataKey || grid.slotKey || $index) {\n\t\t\t\t\t@let slotState = slotRenderStates[i];\n\t\t\t\t\t@let slot = slotState?.slot;\n\t\t\t\t\t<div [hidden]=\"indexValue != i\" [style.height]=\"slot ? grid.gridOptions.scrollHeight : null\">\n\t\t\t\t\t\t@if (slot && indexValue === i) {\n\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"slot.templateRef; context: slotState.context\"> </ng-container>\n\t\t\t\t\t\t\t<div class=\"flex justify-end py-[5px] pr-[8px]\">\n\t\t\t\t\t\t\t\t@if (grid.subTableSource != 'none') {\n\t\t\t\t\t\t\t\t\t<p-button\n\t\t\t\t\t\t\t\t\t\ticon=\"pi pi-plus\"\n\t\t\t\t\t\t\t\t\t\t[text]=\"true\"\n\t\t\t\t\t\t\t\t\t\tseverity=\"success\"\n\t\t\t\t\t\t\t\t\t\t[disabled]=\"gridDisable\"\n\t\t\t\t\t\t\t\t\t\t(onClick)=\"addRowClickHandler(grid)\" />\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t@if (grid.showDelete) {\n\t\t\t\t\t\t\t\t\t<p-button\n\t\t\t\t\t\t\t\t\t\ticon=\"pi pi-trash\"\n\t\t\t\t\t\t\t\t\t\t[text]=\"true\"\n\t\t\t\t\t\t\t\t\t\tseverity=\"danger\"\n\t\t\t\t\t\t\t\t\t\t[disabled]=\"gridDisable\"\n\t\t\t\t\t\t\t\t\t\t(onClick)=\"delRowClickHandler(grid)\" />\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t@if (grid.type == 'grid') {\n\t\t\t\t\t\t\t\t<custom-grid\n\t\t\t\t\t\t\t\t\t#customGrid\n\t\t\t\t\t\t\t\t\t[rowData]=\"getPrm.data?.[grid.subDataKey!]\"\n\t\t\t\t\t\t\t\t\t[upsert]=\"upsertPrm\"\n\t\t\t\t\t\t\t\t\t(deleteEmit)=\"delRows($event)\"\n\t\t\t\t\t\t\t\t\t[addType]=\"grid.subTableSource\"\n\t\t\t\t\t\t\t\t\t(addEmit)=\"dataSourceShow()\"\n\t\t\t\t\t\t\t\t\t[gridOptions]=\"grid.gridOptions\"\n\t\t\t\t\t\t\t\t\t[gridDisable]=\"gridDisable\"\n\t\t\t\t\t\t\t\t\t[authLevel]=\"authLevel()\"\n\t\t\t\t\t\t\t\t\t[showDelete]=\"grid.showDelete\"\n\t\t\t\t\t\t\t\t\t[selectData]=\"grid.selectData\"\n\t\t\t\t\t\t\t\t\t[addSort]=\"grid.addSort\">\n\t\t\t\t\t\t\t\t</custom-grid>\n\t\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t\t<custom-form\n\t\t\t\t\t\t\t\t\t#tabForm\n\t\t\t\t\t\t\t\t\t[options]=\"grid\"\n\t\t\t\t\t\t\t\t\t[upsert]=\"upsertPrm\"\n\t\t\t\t\t\t\t\t\t[model]=\"subFormModel[grid.subDataKey!] || {}\">\n\t\t\t\t\t\t\t\t</custom-form>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t</div>\n\t\t\t\t}\n\t\t\t</div>\n\t\t</div>\n\t\t@if (showLog()) {\n\t\t\t<div class=\"w-full lg:w-[400px] md:w-[300px] md:h-full md:overflow-y-auto hidden md:block\">\n\t\t\t\t<custom-log [logs]=\"getPrm.data?.log ?? []\"></custom-log>\n\t\t\t</div>\n\t\t}\n\t</div>\n</div>\n<row-selector\n\t[(visible)]=\"visible\"\n\t[searchPrm]=\"dialogSearchPrm\"\n\t[gridOptions]=\"selectOptions\"\n\t[selectionKeys]=\"selectionKeys\"\n\t(onOk)=\"onOk($event)\"\n\t(cancelSelect)=\"onCancelSelected($event)\">\n</row-selector>\n", styles: ["@charset \"UTF-8\";.main{height:calc(100vh - 128px)}:host ::ng-deep .main .ag-root-wrapper{border-left:none!important;border-right:none!important;border-bottom:none!important}:host ::ng-deep .form-action{background:#e7e9ed!important;color:var(--ag-text-color)!important;border-color:#e7e9ed!important}:host ::ng-deep .form-action:not(:disabled):hover{background-color:#d8dadd!important;border-color:#d8dadd}.form-panel{border:solid 1px #dbdbdb}.icon-sidebar{color:#334155;padding:2.5px}.icon-sidebar:hover{color:var(--p-primary-color);cursor:pointer}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$3.NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: ButtonModule }, { kind: "component", type: i2$4.Button, selector: "p-button", inputs: ["type", "iconPos", "icon", "badge", "label", "disabled", "loading", "loadingIcon", "raised", "rounded", "text", "plain", "severity", "outlined", "link", "tabindex", "size", "variant", "style", "styleClass", "badgeClass", "badgeSeverity", "ariaLabel", "autofocus", "fluid", "buttonProps"], outputs: ["onClick", "onFocus", "onBlur"] }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: i2$2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2$2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2$2.FormGroupDirective, selector: "[formGroup]", inputs: ["formGroup"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: FormComponent, selector: "custom-form", inputs: ["options", "model", "upsert"] }, { kind: "component", type: LogComponent, selector: "custom-log", inputs: ["logs", "id"] }, { kind: "component", type: CrumbActionComponent, selector: "app-crumb-action", inputs: ["isShowCog", "addVisible", "importVisible", "exportVisible", "newUrl", "configNewPath", "onExport", "outlined", "isList", "authLevel", "actionList", "data", "menus", "saveBtnDisable"], outputs: ["saveEvent", "cancelEvent", "actionEvent"] }, { kind: "component", type: StepsComponent, selector: "custom-steps", inputs: ["modelLog", "needSelfAdjusting", "steps", "current", "authLevel", "isClick"], outputs: ["change"] }, { kind: "component", type: GridComponent, selector: "custom-grid", inputs: ["gridOptions", "selectionKeys", "upsert", "rowData", "searchPrm", "addType", "selectData", "showAct", "actPos", "authLevel", "showDelete", "gridDisable", "addSort"], outputs: ["deleteEmit", "addEmit"] }, { kind: "ngmodule", type: TabsModule }, { kind: "component", type: i4.Tabs, selector: "p-tabs", inputs: ["value", "scrollable", "lazy", "selectOnFocus", "showNavigators", "tabindex"], outputs: ["valueChange"] }, { kind: "component", type: i4.TabList, selector: "p-tablist" }, { kind: "component", type: i4.Tab, selector: "p-tab", inputs: ["value", "disabled"], outputs: ["valueChange"] }, { kind: "component", type: RowSelectorComponent$1, selector: "row-selector", inputs: ["title", "selectionKeys", "gridOptions", "searchPrm", "visible", "showSearch"], outputs: ["onOk", "visibleChange", "cancelSelect"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }, { kind: "component", type: HrefBtnListComponent, selector: "href-btn-list", inputs: ["hrefs"], outputs: ["hrefClick"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }