UNPKG

armisa-models

Version:
324 lines (323 loc) 12.7 kB
"use strict"; var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; }; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var _GridViewMergCaptionColumn_visible; Object.defineProperty(exports, "__esModule", { value: true }); exports.GridViewMergCaptionColumn = exports.GridViewColumn = exports.LockUnLockColumn = exports.NumberIconColumn = exports.IconColumn = exports.AmountColumn = exports.NumberColumn = exports.DateColumn = exports.NumberOfCheckColumn = exports.QTYColumn = exports.IdColumn = exports.MergeColumns = exports.RowColumn = exports.CountColumn = exports.StringColumn = exports.VisitorColumn = exports.CapitalistColumn = exports.StakeholderColumn = exports.SaleManagerColumn = exports.PurchaseOfficerColumn = exports.PersonColumn = exports.DriveColumn = exports.CashColumn = exports.CarColumn = exports.BranchColumn = exports.BankColumn = exports.CostCenterColumn = exports.CustomerColumn = exports.DetailedAccountColumn = exports.AccountColumn = void 0; function AccountColumn(_props) { return null; } exports.AccountColumn = AccountColumn; function DetailedAccountColumn(_props) { return null; } exports.DetailedAccountColumn = DetailedAccountColumn; function CustomerColumn(_props) { return null; } exports.CustomerColumn = CustomerColumn; function CostCenterColumn(_props) { return null; } exports.CostCenterColumn = CostCenterColumn; function BankColumn(_props) { return null; } exports.BankColumn = BankColumn; function BranchColumn(_props) { return null; } exports.BranchColumn = BranchColumn; function CarColumn(_props) { return null; } exports.CarColumn = CarColumn; function CashColumn(_props) { return null; } exports.CashColumn = CashColumn; function DriveColumn(_props) { return null; } exports.DriveColumn = DriveColumn; function PersonColumn(_props) { return null; } exports.PersonColumn = PersonColumn; function PurchaseOfficerColumn(_props) { return null; } exports.PurchaseOfficerColumn = PurchaseOfficerColumn; function SaleManagerColumn(_props) { return null; } exports.SaleManagerColumn = SaleManagerColumn; function StakeholderColumn(_props) { return null; } exports.StakeholderColumn = StakeholderColumn; function CapitalistColumn(_props) { return null; } exports.CapitalistColumn = CapitalistColumn; function VisitorColumn(_props) { return null; } exports.VisitorColumn = VisitorColumn; function StringColumn(_props) { return null; } exports.StringColumn = StringColumn; function CountColumn(_props) { return null; } exports.CountColumn = CountColumn; function RowColumn(_props) { return null; } exports.RowColumn = RowColumn; function MergeColumns(_props) { return null; } exports.MergeColumns = MergeColumns; function IdColumn(_props) { return null; } exports.IdColumn = IdColumn; function QTYColumn(_props) { return null; } exports.QTYColumn = QTYColumn; function NumberOfCheckColumn(_props) { return null; } exports.NumberOfCheckColumn = NumberOfCheckColumn; function DateColumn(_props) { return null; } exports.DateColumn = DateColumn; function NumberColumn(_props) { return null; } exports.NumberColumn = NumberColumn; function AmountColumn(_props) { return null; } exports.AmountColumn = AmountColumn; function IconColumn(_props) { return null; } exports.IconColumn = IconColumn; function NumberIconColumn(_props) { return null; } exports.NumberIconColumn = NumberIconColumn; function LockUnLockColumn(_props) { return null; } exports.LockUnLockColumn = LockUnLockColumn; class GridViewColumn { get any() { return this; } constructor(gridViewFactory, child, headerCaption, headerIcon, fieldName, width, autoHideIfEmpty, filterFieldName, sortable, changeVisibility, saveVisibility, onPrepareShowValue, onPrepareSetColor, calcSummery, visible, isFillEmptySpace, defaultIcon, sizeOfIcon, colorOfIcon, onOnDoublClick) { this.gridViewFactory = gridViewFactory; this.headerCaption = headerCaption; this.headerIcon = headerIcon; this.fieldName = fieldName; this.width = width; this.autoHideIfEmpty = autoHideIfEmpty; this.filterFieldName = filterFieldName; this.sortable = sortable; this.changeVisibility = changeVisibility; this.saveVisibility = saveVisibility; this.onPrepareShowValue = onPrepareShowValue; this.onPrepareSetColor = onPrepareSetColor; this.calcSummery = calcSummery; this.defaultIcon = defaultIcon; this.sizeOfIcon = sizeOfIcon; this.colorOfIcon = colorOfIcon; this.onOnDoublClick = onOnDoublClick; this.isCellValueEmpty = (row) => { const cellValue = row.getProp(this.fieldName); if (!cellValue) { return true; } switch (this.columnType) { case 'QTY': case 'QTYView': case 'amount': case 'count': case 'id': case 'row': if (+cellValue === 0) return true; default: if (cellValue === '') return true; } return false; }; this.initialzed = false; this.headerText = 'none'; this.visible = true; this.isFillEmptySpace = false; this.getType = (child) => { if (child.type === AccountColumn) { return 'BaseStructuralGetByCode'; } else if (child.type === DetailedAccountColumn) { return 'BaseInheritedDetailedAccountCode'; } else if (child.type === CustomerColumn) { return 'BaseInheritedDetailedAccountCode'; } else if (child.type === CostCenterColumn) { return 'BaseInheritedDetailedAccountCode'; } else if (child.type === BankColumn) { return 'BaseInheritedDetailedAccountCode'; } else if (child.type === BranchColumn) { return 'BaseInheritedDetailedAccountCode'; } else if (child.type === CarColumn) { return 'BaseInheritedDetailedAccountCode'; } else if (child.type === CashColumn) { return 'BaseInheritedDetailedAccountCode'; } else if (child.type === DriveColumn) { return 'BaseInheritedDetailedAccountCode'; } else if (child.type === PersonColumn) { return 'BaseInheritedDetailedAccountCode'; } else if (child.type === PurchaseOfficerColumn) { return 'BaseInheritedDetailedAccountCode'; } else if (child.type === SaleManagerColumn) { return 'BaseInheritedDetailedAccountCode'; } else if (child.type === StakeholderColumn) { return 'BaseInheritedDetailedAccountCode'; } else if (child.type === CapitalistColumn) { return 'BaseInheritedDetailedAccountCode'; } else if (child.type === VisitorColumn) { return 'BaseInheritedDetailedAccountCode'; } else if (child.type === StringColumn) { return 'text'; } else if (child.type === CountColumn) { return 'count'; } else if (child.type === QTYColumn) { return 'QTY'; } else if (child.type === QTYColumn) { return 'text'; } else if (child.type === DateColumn) { return 'date'; } else if (child.type === NumberColumn) { return 'text'; } else if (child.type === AmountColumn) { return 'amount'; } else if (child.type === RowColumn) { return 'row'; } else if (child.type === IdColumn) { return 'id'; } else if (child.type === IconColumn) { return 'icon'; } else if (child.type === NumberIconColumn) { return 'numberIconColumn'; } else if (child.type === LockUnLockColumn) { return 'lockUnLock'; } return 'text'; }; this.checkHeaderTextIfNeedUpdate = (newCaption) => { this.headerCaption = newCaption; this.getHeaderText(); }; this.getHeaderText = () => { if (typeof this.headerCaption === 'string') { this.headerText = this.headerCaption; } else { this.headerText = this.gridViewFactory.mainStateManager.getCaptionNaming(this.headerCaption); } }; this.index = this.gridViewFactory.columns.length; this.columnType = this.getType(child); this.keyOfColumn = this.fieldName + this.index.toString(); this.visible = typeof visible === 'boolean' ? visible : true; if (this.autoHideIfEmpty) { this.visible = false; } // if (saveVisibility) { // const result = this.mainStateFactory.pageData.getUserOption(fieldName); // this.visible = result === 'true' ? true : result === 'false' ? false : this.visible; // } switch (this.columnType) { case 'text': this.isFillEmptySpace = isFillEmptySpace ? isFillEmptySpace : false; this.width = width ? width : 120; break; } this.getHeaderText(); } } exports.GridViewColumn = GridViewColumn; class GridViewMergCaptionColumn { constructor(gridViewFactory, headerCaption, visible, changeVisibility, saveVisibility) { this.gridViewFactory = gridViewFactory; this.headerCaption = headerCaption; this.changeVisibility = changeVisibility; this.saveVisibility = saveVisibility; this.columns = null; _GridViewMergCaptionColumn_visible.set(this, true); this.headerText = 'none'; this.getHeaderText = (gridViewFactory) => { if (typeof this.headerCaption === 'string') { this.headerText = this.headerCaption; } else { this.headerText = gridViewFactory.mainStateManager.getCaptionNaming(this.headerCaption); } }; if (this.gridViewFactory.mergeCaptionColumns === null) { this.gridViewFactory.mergeCaptionColumns = []; } this.index = this.gridViewFactory.mergeCaptionColumns.length; __classPrivateFieldSet(this, _GridViewMergCaptionColumn_visible, typeof visible === 'boolean' ? visible : true, "f"); this.getHeaderText(gridViewFactory); } set visible(value) { __classPrivateFieldSet(this, _GridViewMergCaptionColumn_visible, value, "f"); this.columns?.forEach(c => c.visible = value); } get visible() { return __classPrivateFieldGet(this, _GridViewMergCaptionColumn_visible, "f"); } } exports.GridViewMergCaptionColumn = GridViewMergCaptionColumn; _GridViewMergCaptionColumn_visible = new WeakMap();