@myrtex-org/form 1.1.38 → 1.1.39

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.
@@ -22,7 +22,6 @@ import * as i2$2 from '@angular/forms';
22
22
  import { FormsModule } from '@angular/forms';
23
23
  import { provideNgxMask } from 'ngx-mask';
24
24
  import { v4 } from 'uuid';
25
- import CustomStore from 'devextreme/data/custom_store';
26
25
  import * as i2$3 from 'devextreme-angular';
27
26
  import { DxDataGridModule } from 'devextreme-angular';
28
27
  import * as i3 from 'devextreme-angular/ui/nested';
@@ -1452,7 +1451,6 @@ class BaseFieldComponent {
1452
1451
  _initModel() {
1453
1452
  if (this.valueMode === 'manual') {
1454
1453
  this.model = cloneDeep(getValueModel(this.settings, this.manualValues)) || defaultValueModel(this.settings);
1455
- this._customInit();
1456
1454
  }
1457
1455
  else {
1458
1456
  this.model = defaultValueModel(this.settings);
@@ -1688,7 +1686,7 @@ class InputDateComponent extends BaseFieldComponent {
1688
1686
  this._isInit = false;
1689
1687
  this._isUpdatingInternal = false;
1690
1688
  this._format = '';
1691
- this.dateModel = null;
1689
+ this.dateModel = '';
1692
1690
  this.modelCounter = 0;
1693
1691
  }
1694
1692
  get getInvalid() {
@@ -1817,10 +1815,6 @@ class InputDateComponent extends BaseFieldComponent {
1817
1815
  }
1818
1816
  _customInit() {
1819
1817
  if (this.settings.options.range) {
1820
- console.log('Модели в _customInit:', {
1821
- start: this.modelStart?.value,
1822
- end: this.modelEnd?.value
1823
- });
1824
1818
  if (!this.modelStart) {
1825
1819
  this.modelStart = defaultValueModel(this.settings);
1826
1820
  }
@@ -1833,13 +1827,7 @@ class InputDateComponent extends BaseFieldComponent {
1833
1827
  }
1834
1828
  if (this.settings.options.range) {
1835
1829
  if (this.modelStart?.value && this.modelEnd?.value) {
1836
- // ПРЕОБРАЗУЕМ В DATE:
1837
- const d1 = new Date(this.modelStart.value);
1838
- const d2 = new Date(this.modelEnd.value);
1839
- this.dateModel = [
1840
- isNaN(d1.getTime()) ? null : d1,
1841
- isNaN(d2.getTime()) ? null : d2
1842
- ];
1830
+ this.dateModel = [this.modelStart.value, this.modelEnd.value];
1843
1831
  this.modelCounter = this._getDaysDifference(this.modelStart.value, this.modelEnd.value);
1844
1832
  }
1845
1833
  else if (!this.modelStart?.value && !this.modelEnd?.value) {
@@ -1851,41 +1839,9 @@ class InputDateComponent extends BaseFieldComponent {
1851
1839
  else {
1852
1840
  this.dateModel = this.model.value;
1853
1841
  }
1854
- console.log('Финальный DateModel для календаря:', this.dateModel);
1855
1842
  this._isInit = true;
1856
1843
  this._detector.markForCheck();
1857
1844
  }
1858
- _initModel() {
1859
- console.log('Доступные системные имена в строке:', this.manualValues.map(x => x.sysName));
1860
- console.log('Системное имя текущего компонента:', this.settings.sysName);
1861
- // 1. Стандартная инициализация запишет значение в this.model
1862
- super._initModel();
1863
- if (this.valueMode === 'manual' && this.settings.options.range) {
1864
- // Берем значение из основной модели, которую нашел super._initModel()
1865
- const rawValue = this.model?.value;
1866
- let startVal = null;
1867
- let endVal = null;
1868
- // Проверяем, в каком виде лежат данные (массив или строка через запятую)
1869
- if (Array.isArray(rawValue)) {
1870
- [startVal, endVal] = rawValue;
1871
- }
1872
- else if (typeof rawValue === 'string' && rawValue.includes(',')) {
1873
- [startVal, endVal] = rawValue.split(',');
1874
- }
1875
- else if (typeof rawValue === 'string' && rawValue.length > 0) {
1876
- // На случай если там одна дата, а мы ждем две
1877
- startVal = rawValue;
1878
- }
1879
- // Инициализируем модели для Start и End на базе основной модели
1880
- this.modelStart = { ...structuredClone(this.model), value: startVal };
1881
- this.modelEnd = { ...structuredClone(this.model), value: endVal };
1882
- // Принудительно устанавливаем суффиксы, если ваша логика сохранения их все же ждет
1883
- // Если нет - можно оставить как есть (this.settings.sysName)
1884
- this.modelStart.sysName = `${this.settings.sysName}_start`;
1885
- this.modelEnd.sysName = `${this.settings.sysName}_end`;
1886
- this._customInit();
1887
- }
1888
- }
1889
1845
  _getDaysDifference(startDate, endDate) {
1890
1846
  const start = new Date(startDate);
1891
1847
  const end = new Date(endDate);
@@ -2382,8 +2338,6 @@ const getRowModel = (model) => {
2382
2338
  class InputTableComponent {
2383
2339
  constructor() {
2384
2340
  this.type = ComponentType.InputTable;
2385
- this._referenceService = inject(ReferenceService);
2386
- this._lookupsCache = new Map();
2387
2341
  this._store = inject(Store);
2388
2342
  this._detector = inject(ChangeDetectorRef);
2389
2343
  this._modalService = inject(ModalService);
@@ -2473,7 +2427,6 @@ class InputTableComponent {
2473
2427
  }
2474
2428
  editRow(event) {
2475
2429
  const findRow = this.model.data.find(item => item.id === event.row.data.id);
2476
- console.log(this.settings, 'this.settings');
2477
2430
  if (findRow) {
2478
2431
  this._modalService.open(InputTableModalComponent, {
2479
2432
  title: 'Редактирование строки',
@@ -2592,29 +2545,6 @@ class InputTableComponent {
2592
2545
  displayExpr: 'displayValue'
2593
2546
  };
2594
2547
  }
2595
- if (component.type === ComponentType.InputSelect) {
2596
- const selectModel = component;
2597
- if (selectModel.options.manual) {
2598
- column.lookup = {
2599
- dataSource: selectModel.options.items,
2600
- valueExpr: 'value',
2601
- displayExpr: 'text'
2602
- };
2603
- }
2604
- else if (selectModel.options.directory?.[0]) {
2605
- const directoryName = selectModel.options.directory[0];
2606
- column.lookup = {
2607
- // Оборачиваем в CustomStore для соответствия типам DevExtreme
2608
- dataSource: new CustomStore({
2609
- key: 'value',
2610
- load: () => this.getLookupData(directoryName),
2611
- byKey: (key) => this.getLookupData(directoryName).then(items => items.find(i => i.value === key))
2612
- }),
2613
- valueExpr: 'value',
2614
- displayExpr: 'text'
2615
- };
2616
- }
2617
- }
2618
2548
  if (this.settings.options.groups.length) {
2619
2549
  const findIdx = this.settings.options.groups.findIndex(x => x === component.sysName);
2620
2550
  if (findIdx !== -1) {
@@ -2623,27 +2553,6 @@ class InputTableComponent {
2623
2553
  }
2624
2554
  return column;
2625
2555
  }
2626
- getLookupData(directoryName) {
2627
- // Проверяем кэш
2628
- if (this._lookupsCache.has(directoryName)) {
2629
- return Promise.resolve(this._lookupsCache.get(directoryName));
2630
- }
2631
- // Запрашиваем данные (используем тот же objectId, что и в модалке)
2632
- // Убедитесь, что objectId доступен в этом компоненте
2633
- return new Promise((resolve) => {
2634
- this._referenceService.getReferences(directoryName, this.objectId).subscribe({
2635
- next: (result) => {
2636
- const items = (result?.rows || []).map((row) => ({
2637
- value: row.a,
2638
- text: row.b
2639
- }));
2640
- this._lookupsCache.set(directoryName, items);
2641
- resolve(items);
2642
- },
2643
- error: () => resolve([])
2644
- });
2645
- });
2646
- }
2647
2556
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "17.3.12", ngImport: i0, type: InputTableComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2648
2557
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "17.3.12", type: InputTableComponent, selector: "app-input-table", inputs: { values: "values", data: "data" }, outputs: { changed: "changed" }, viewQueries: [{ propertyName: "dataGrid", first: true, predicate: ["dataGrid"], descendants: true }, { propertyName: "editTemplate", first: true, predicate: ["editTemplate"], descendants: true }], ngImport: i0, template: "@if (settings) {\r\n <div class=\"input-table-content w-100\">\r\n @if (settings.options.label) {\r\n <mrx-label\r\n [required]=\"settings.options.required\"\r\n [tooltip]=\"settings.options.tooltip || ''\"\r\n >\r\n {{ settings.options.label }}\r\n </mrx-label>\r\n }\r\n\r\n <dx-data-grid\r\n #dataGrid\r\n [dataSource]=\"dataSource\"\r\n [columns]=\"columns\"\r\n [disabled]=\"disabled\"\r\n noDataText=\"\u041D\u0435\u0442 \u0434\u0430\u043D\u043D\u044B\u0445\"\r\n style=\"width: 100%\"\r\n [wordWrapEnabled]=\"true\"\r\n [columnAutoWidth]=\"true\"\r\n [class.noData]=\"isRedNoData\"\r\n >\r\n <dxo-toolbar>\r\n <dxi-item location=\"after\">\r\n <div *dxTemplate class=\"add-row\">\r\n <mrx-button\r\n [size]=\"'medium'\"\r\n [type]=\"'secondary'\"\r\n [customClasses]=\"'mb-3'\"\r\n (mrxClick)=\"createRow()\"\r\n >{{settings.options.addBtnTitle}}\r\n </mrx-button>\r\n </div>\r\n </dxi-item>\r\n </dxo-toolbar>\r\n\r\n <div *dxTemplate=\"let buttonData of 'editButtonTemplate'\">\r\n <span class=\"mrx-icon icon-edit icon-font-16 cursor-pointer\" (click)=\"editRow(buttonData)\"></span>\r\n </div>\r\n\r\n <div *dxTemplate=\"let buttonData of 'deleteButtonTemplate'\">\r\n <span class=\"mrx-icon icon-delete icon-font-16 cursor-pointer\" (click)=\"deleteRow(buttonData)\"></span>\r\n </div>\r\n\r\n @if (dataSource.length) {\r\n <dxo-summary>\r\n @for (component of settings.components; track component.id; let first = $first) {\r\n @if (!first) {\r\n @if (showTotal(component)) {\r\n <dxi-group-item\r\n [column]=\"component.sysName\"\r\n summaryType=\"sum\"\r\n displayFormat=\"\u0418\u0442\u043E\u0433\u043E: {0}\"\r\n [showInGroupFooter]=\"true\"\r\n [alignByColumn]=\"true\">\r\n </dxi-group-item>\r\n\r\n <dxi-total-item \r\n [column]=\"component.sysName\" \r\n displayFormat=\"{0}\"\r\n summaryType=\"sum\"\r\n ></dxi-total-item>\r\n }\r\n\r\n @for (component of component.components; track component.id) {\r\n @if (showTotal(component)) {\r\n <dxi-group-item\r\n [column]=\"component.sysName\"\r\n summaryType=\"sum\"\r\n displayFormat=\"\u0418\u0442\u043E\u0433\u043E: {0}\"\r\n [showInGroupFooter]=\"true\"\r\n [alignByColumn]=\"true\">\r\n </dxi-group-item>\r\n }\r\n\r\n @for (component of component.components; track component.id) {\r\n @if (showTotal(component)) {\r\n <dxi-group-item\r\n [column]=\"component.sysName\"\r\n summaryType=\"sum\"\r\n displayFormat=\"\u0418\u0442\u043E\u0433\u043E: {0}\"\r\n [showInGroupFooter]=\"true\"\r\n [alignByColumn]=\"true\">\r\n </dxi-group-item>\r\n }\r\n }\r\n }\r\n } @else {\r\n @if (hasAnyTotal) { \r\n <dxi-total-item\r\n [column]=\"component.sysName\"\r\n [cssClass]=\"'text-bold'\"\r\n [displayFormat]=\"showTotal(component) ? '{0}' : '\u0418\u0422\u041E\u0413\u041E'\"\r\n [summaryType]=\"showTotal(component) ? 'sum' : undefined\"\r\n ></dxi-total-item>\r\n }\r\n }\r\n }\r\n </dxo-summary>\r\n }\r\n </dx-data-grid>\r\n\r\n @if(!!settings.options.maxRows) {\r\n <mrx-hint-error-message\r\n message=\"\u041C\u0430\u043A\u0441\u0438\u043C\u0430\u043B\u044C\u043D\u043E\u0435 \u043A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0441\u0442\u0440\u043E\u043A: {{ settings.options.maxRows }}\"\r\n [maxValue]=\"settings.options.maxRows\"\r\n [value]=\"rowsCount\"\r\n ></mrx-hint-error-message>\r\n }\r\n\r\n <ng-template #editTemplate let-cellInfo=\"cellInfo\">\r\n <div class=\"d-flex align-items-center justify-content-center\" style=\"gap: 4px\">\r\n <span class=\"mrx-icon icon-edit icon-font-16 cursor-pointer\" (click)=\"editRow(cellInfo)\"></span>\r\n <span class=\"mrx-icon icon-delete icon-font-16 cursor-pointer\" (click)=\"deleteRow(cellInfo)\"></span>\r\n </div>\r\n </ng-template>\r\n </div>\r\n}\r\n\r\n\r\n", styles: [":host::ng-deep .input-table-content .noData .dx-datagrid-nodata{color:var(--system-text-negative, #8E2100)}:host::ng-deep .input-table-content .dx-datagrid{padding:0}:host::ng-deep .input-table-content .dx-datagrid-header-panel{display:flex;align-items:center;min-height:40px;padding:0}:host::ng-deep .input-table-content .dx-datagrid-rowsview{border-bottom:none}:host::ng-deep .input-table-content .dx-datagrid-rowsview.dx-empty{border-bottom:1px solid #ddd;height:48px}:host::ng-deep .input-table-content .dx-datagrid .dx-datagrid-total-footer{border-top:none;border-left:none;border-right:none}:host::ng-deep .input-table-content .dx-datagrid .dx-datagrid-total-footer .dx-datagrid-content{padding:0}:host::ng-deep .input-table-content .dx-datagrid .dx-datagrid-total-footer .dx-datagrid-content table,:host::ng-deep .input-table-content .dx-datagrid .dx-datagrid-total-footer .dx-datagrid-content th,:host::ng-deep .input-table-content .dx-datagrid .dx-datagrid-total-footer .dx-datagrid-content td{border:1px solid #ddd;border-top:none;border-collapse:collapse}:host::ng-deep .input-table-content .dx-datagrid .dx-datagrid-total-footer .dx-datagrid-content table{border-top:none}:host::ng-deep .input-table-content .dx-datagrid .dx-datagrid-total-footer .dx-datagrid-content .dx-datagrid-summary-item{font-weight:400}:host::ng-deep .input-table-content .dx-datagrid .dx-datagrid-headers{position:relative;top:0;border-top:1px solid var(--neutral-bg-divider)}:host::ng-deep .input-table-content .dx-datagrid .dx-datagrid-headers td.dx-command-expand.dx-datagrid-group-space{border-right:none!important;border-right-color:transparent}:host::ng-deep .input-table-content .dx-datagrid .dx-datagrid-total-footer td.dx-command-expand.dx-datagrid-group-space{border-right-color:transparent}:host::ng-deep .input-table-content .dx-datagrid .dx-row>td,:host::ng-deep .input-table-content .dx-datagrid .page-wrapper .dx-treelist-container .dx-row>td{color:var(--neutral-text-secondary, #4D5157);font-family:var(--body-md-bold-font-family, \"PT Sans\");font-size:var(--body-md-bold-font-size, 14px);font-weight:var(--body-md-bold-font-weight, 700);line-height:var(--body-md-bold-line-height, 16px)}:host::ng-deep .input-table-content .dx-datagrid .dx-row.dx-data-row.dx-column-lines>td{color:var(--neutral-text-tertiary, #71767E);font-family:var(--body-md-font-family, \"PT Sans\");font-size:var(--body-md-font-size, 14px);font-weight:var(--body-md-font-weight, 400);line-height:var(--body-md-line-height, 20px)}:host::ng-deep .custom-cell-controls .dx-template-wrapper{display:inline-flex}\n"], dependencies: [{ kind: "component", type: i1$2.LabelComponent, selector: "mrx-label", inputs: ["requiredHidden", "required", "boldLabel", "disabled", "placeholder", "label", "customClasses", "triggerTextPosition", "isPublicInfo", "publicInfoTooltip", "isSwitch", "switchLabel", "switchValue", "switchSize", "isCheckbox", "checkboxLabel", "checkboxValue", "counter", "linkText", "linkPrevent", "linkType", "linkMonochrome", "href", "triggerType", "tooltip", "tooltipInitialVisible", "isSaveToStorage"], outputs: ["changeSwitchValue", "changeCheckboxValue", "clickedLink"] }, { kind: "component", type: i1$2.ButtonComponent, selector: "mrx-button", inputs: ["size", "type", "color", "iconPosition", "active", "disabled", "isLoading", "iconOnly", "customClasses", "label", "icon", "iconClass", "buttonType", "href", "target", "routerLink", "queryParams"], outputs: ["mrxClick"] }, { kind: "component", type: i2$3.DxDataGridComponent, selector: "dx-data-grid", inputs: ["accessKey", "activeStateEnabled", "allowColumnReordering", "allowColumnResizing", "autoNavigateToFocusedRow", "cacheEnabled", "cellHintEnabled", "columnAutoWidth", "columnChooser", "columnFixing", "columnHidingEnabled", "columnMinWidth", "columnResizingMode", "columns", "columnWidth", "customizeColumns", "dataRowTemplate", "dataSource", "dateSerializationFormat", "disabled", "editing", "elementAttr", "errorRowEnabled", "export", "filterBuilder", "filterBuilderPopup", "filterPanel", "filterRow", "filterSyncEnabled", "filterValue", "focusedColumnIndex", "focusedRowEnabled", "focusedRowIndex", "focusedRowKey", "grouping", "groupPanel", "headerFilter", "height", "highlightChanges", "hint", "hoverStateEnabled", "keyboardNavigation", "keyExpr", "loadPanel", "masterDetail", "noDataText", "pager", "paging", "remoteOperations", "renderAsync", "repaintChangesOnly", "rowAlternationEnabled", "rowDragging", "rowTemplate", "rtlEnabled", "scrolling", "searchPanel", "selectedRowKeys", "selection", "selectionFilter", "showBorders", "showColumnHeaders", "showColumnLines", "showRowLines", "sortByGroupSummaryInfo", "sorting", "stateStoring", "summary", "syncLookupFilterValues", "tabIndex", "toolbar", "twoWayBindingEnabled", "visible", "width", "wordWrapEnabled"], outputs: ["onAdaptiveDetailRowPreparing", "onCellClick", "onCellDblClick", "onCellHoverChanged", "onCellPrepared", "onContentReady", "onContextMenuPreparing", "onDataErrorOccurred", "onDisposing", "onEditCanceled", "onEditCanceling", "onEditingStart", "onEditorPrepared", "onEditorPreparing", "onExporting", "onFocusedCellChanged", "onFocusedCellChanging", "onFocusedRowChanged", "onFocusedRowChanging", "onInitialized", "onInitNewRow", "onKeyDown", "onOptionChanged", "onRowClick", "onRowCollapsed", "onRowCollapsing", "onRowDblClick", "onRowExpanded", "onRowExpanding", "onRowInserted", "onRowInserting", "onRowPrepared", "onRowRemoved", "onRowRemoving", "onRowUpdated", "onRowUpdating", "onRowValidating", "onSaved", "onSaving", "onSelectionChanged", "onToolbarPreparing", "accessKeyChange", "activeStateEnabledChange", "allowColumnReorderingChange", "allowColumnResizingChange", "autoNavigateToFocusedRowChange", "cacheEnabledChange", "cellHintEnabledChange", "columnAutoWidthChange", "columnChooserChange", "columnFixingChange", "columnHidingEnabledChange", "columnMinWidthChange", "columnResizingModeChange", "columnsChange", "columnWidthChange", "customizeColumnsChange", "dataRowTemplateChange", "dataSourceChange", "dateSerializationFormatChange", "disabledChange", "editingChange", "elementAttrChange", "errorRowEnabledChange", "exportChange", "filterBuilderChange", "filterBuilderPopupChange", "filterPanelChange", "filterRowChange", "filterSyncEnabledChange", "filterValueChange", "focusedColumnIndexChange", "focusedRowEnabledChange", "focusedRowIndexChange", "focusedRowKeyChange", "groupingChange", "groupPanelChange", "headerFilterChange", "heightChange", "highlightChangesChange", "hintChange", "hoverStateEnabledChange", "keyboardNavigationChange", "keyExprChange", "loadPanelChange", "masterDetailChange", "noDataTextChange", "pagerChange", "pagingChange", "remoteOperationsChange", "renderAsyncChange", "repaintChangesOnlyChange", "rowAlternationEnabledChange", "rowDraggingChange", "rowTemplateChange", "rtlEnabledChange", "scrollingChange", "searchPanelChange", "selectedRowKeysChange", "selectionChange", "selectionFilterChange", "showBordersChange", "showColumnHeadersChange", "showColumnLinesChange", "showRowLinesChange", "sortByGroupSummaryInfoChange", "sortingChange", "stateStoringChange", "summaryChange", "syncLookupFilterValuesChange", "tabIndexChange", "toolbarChange", "twoWayBindingEnabledChange", "visibleChange", "widthChange", "wordWrapEnabledChange"] }, { kind: "component", type: i3.DxiItemComponent, selector: "dxi-item", inputs: ["disabled", "html", "icon", "template", "text", "title", "titleTemplate", "visible", "onClick", "stylingMode", "type", "baseSize", "box", "ratio", "shrink", "elementAttr", "hint", "beginGroup", "closeMenuOnClick", "items", "selectable", "selected", "colSpan", "cssClass", "dataField", "editorOptions", "editorType", "helpText", "isRequired", "itemType", "label", "name", "validationRules", "visibleIndex", "alignItemLabels", "caption", "colCount", "colCountByScreen", "tabPanelOptions", "tabs", "badge", "tabTemplate", "buttonOptions", "horizontalAlignment", "verticalAlignment", "locateInMenu", "location", "menuItemTemplate", "options", "showText", "widget", "height", "width", "imageAlt", "imageSrc", "acceptedValues", "formatName", "formatValues", "key", "showChevron", "linkAttr", "url", "heightRatio", "widthRatio", "expanded", "hasItems", "id", "parentId"] }, { kind: "component", type: i3.DxoSummaryComponent, selector: "dxo-summary", inputs: ["calculateCustomSummary", "groupItems", "recalculateWhileEditing", "skipEmptyValues", "texts", "totalItems"] }, { kind: "component", type: i3.DxiGroupItemComponent, selector: "dxi-group-item", inputs: ["alignByColumn", "column", "customizeText", "displayFormat", "name", "showInColumn", "showInGroupFooter", "skipEmptyValues", "summaryType", "valueFormat"] }, { kind: "component", type: i3.DxiTotalItemComponent, selector: "dxi-total-item", inputs: ["alignment", "column", "cssClass", "customizeText", "displayFormat", "name", "showInColumn", "skipEmptyValues", "summaryType", "valueFormat"] }, { kind: "component", type: i3.DxoToolbarComponent, selector: "dxo-toolbar", inputs: ["disabled", "items", "visible", "fileSelectionItems", "container", "multiline"] }, { kind: "directive", type: i4.DxTemplateDirective, selector: "[dxTemplate]", inputs: ["dxTemplateOf"] }, { kind: "component", type: i1$2.HintErrorMessageComponent, selector: "mrx-hint-error-message", inputs: ["message", "value", "maxValue", "minValue", "minLength", "maxLength", "checkInvalid"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
2649
2558
  }