@operato/data-grist 10.3.3 → 10.4.0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"data-report.js","sourceRoot":"","sources":["../../src/data-report.ts"],"names":[],"mappings":";AAAA,OAAO,wCAAwC,CAAA;AAE/C,OAAO,EAAE,UAAU,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACrF,OAAO,OAAO,MAAM,SAAS,CAAA;AAE7B,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAGhE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAA;AACpF,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAA;AAExD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAGpD,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IAAnC;;QAyCuB,SAAI,GAAc,SAAS,CAAA;QAGD,cAAS,GAAY,KAAK,CAAA;QAEvE,UAAK,GAAc,SAAS,CAAA;QAC5B,YAAO,GAAgB,WAAW,CAAA;QAC1B,iBAAY,GAAY,KAAK,CAAA;IA4WhD,CAAC;IApWC,IAAI,IAAI;QACN,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,iBAAiB;QACf,KAAK,CAAC,iBAAiB,EAAE,CAAA;QAEzB,IAAI,CAAC,YAAY,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,CAAA;IAC5C,CAAC;IAED,oBAAoB;;QAClB,KAAK,CAAC,oBAAoB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2CAAmC;AAC1B;IAAhB,KAAK,EAAE;gDAAsC;AAK5B;IAAjB,KAAK,CAAC,SAAS,CAAC;0CAA6B;AACjB;IAA5B,UAAU,CAAC,OAAO,CAAC;wCAAoC;AAtD7C,UAAU;IADtB,aAAa,CAAC,WAAW,CAAC;GACd,UAAU,CA4ZtB","sourcesContent":["import './data-report/data-report-component.js'\n\nimport { LitElement, PropertyValues, css, html } from 'lit'\nimport { customElement, property, query, queryAsync, state } from 'lit/decorators.js'\nimport i18next from 'i18next'\n\nimport { ScrollbarStyles, SpinnerStyles } from '@operato/styles'\n\nimport { GristConfig, GristData, GristRecord, GroupConfig } from './types.js'\nimport { ZERO_CONFIG, ZERO_DATA, ZERO_PAGINATION } from './configure/zero-config.js'\nimport { pulltorefresh } from '@operato/pull-to-refresh'\nimport { DataConsumer } from './data-consumer.js'\nimport { DataProvider } from './data-provider.js'\nimport { DataReportComponent } from './data-report/data-report-component.js'\nimport { buildColumn } from './configure/column-builder.js'\nimport { buildConfig } from './configure/config-builder.js'\n\n@customElement('ox-report')\nexport class DataReport extends LitElement implements DataConsumer {\n static styles = [\n ScrollbarStyles,\n SpinnerStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n background-color: var(--report-background-color);\n padding: var(--report-padding);\n min-height: 120px;\n\n overflow: hidden;\n\n /* for pulltorefresh controller */\n position: relative;\n }\n\n #wrap {\n flex: 1;\n display: flex;\n flex-direction: column;\n overflow: auto;\n }\n\n ox-report-component {\n flex: 1;\n }\n\n ox-empty-note {\n display: block;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n `\n ]\n\n @property({ type: Object }) config: any\n @property({ type: Object }) data: GristData = ZERO_DATA\n @property({ type: Object }) fetchHandler: any\n @property({ type: Object }) fetchOptions: any\n @property({ type: Boolean, attribute: 'auto-fetch' }) autoFetch: boolean = false\n\n @state() _data: GristData = ZERO_DATA\n @state() _config: GristConfig = ZERO_CONFIG\n @state() private _showSpinner: boolean = false\n\n private dataProvider?: DataProvider\n private pulltorefreshHandle?: any\n\n @query('#report') report!: DataReportComponent\n @queryAsync('#wrap') private wrap!: Promise<HTMLElement>\n\n get mode(): 'REPORT' {\n return 'REPORT'\n }\n\n connectedCallback() {\n super.connectedCallback()\n\n this.dataProvider = new DataProvider(this)\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n\n this.resetPullToRefresh()\n this.dataProvider?.dispose()\n }\n\n private resetPullToRefresh() {\n if (this.pulltorefreshHandle) {\n this.pulltorefreshHandle()\n delete this.pulltorefreshHandle\n }\n }\n\n private async setPullToRefresh() {\n this.resetPullToRefresh()\n if (this.fetchHandler) {\n this.pulltorefreshHandle = pulltorefresh({\n container: await this.wrap,\n scrollable: this.report.pullToRefreshTarget,\n refresh: () => {\n return this.fetch(true)\n }\n })\n }\n }\n\n async firstUpdated() {\n if (this.fetchHandler && this.autoFetch) {\n await this.requestUpdate()\n this.fetch(true)\n }\n }\n\n render() {\n var oops = !this._showSpinner && (!this._data || !this._data.records || this._data.records.length == 0)\n\n return html`\n ${oops ? html` <ox-empty-note title=\"NO RECORDS\"></ox-empty-note> ` : html``}\n\n <div id=\"wrap\">\n <ox-report-component id=\"report\" .config=${this._config} .data=${this._data}> </ox-report-component>\n </div>\n\n <div id=\"spinner\" ?show=${this._showSpinner}></div>\n `\n }\n\n async fetch(reset = true) {\n if (!this._config) {\n /* avoid to be here */\n console.warn('report is not configured yet.')\n return\n }\n\n if (reset) {\n /*\n * scroll 의 현재위치에 의해서 scroll 이벤트가 발생할 수 있으므로, 이를 방지하기 위해서 스크롤의 위치를 TOP으로 옮긴다.\n * (scroll 이 첫페이지 크기 이상으로 내려가 있는 경우, 첫페이지부터 다시 표시하는 경우에, scroll 이벤트가 발생한다.)\n */\n this.report.scrollTop = 0\n }\n\n if (this.dataProvider) {\n await this.dataProvider.attach(reset)\n }\n }\n\n async updated(changes: PropertyValues<this>) {\n if (changes.has('config')) {\n this._config = buildConfig({\n ...this.config\n })\n\n this.dataProvider && (this.dataProvider.sorters = this._config.sorters)\n this.fetch()\n }\n\n if (changes.has('fetchHandler')) {\n this.dataProvider && (this.dataProvider.fetchHandler = this.fetchHandler)\n await this.setPullToRefresh()\n }\n\n if (changes.has('fetchOptions')) {\n this.dataProvider && (this.dataProvider.fetchOptions = this.fetchOptions)\n }\n\n if (changes.has('data')) {\n this.reset()\n }\n }\n\n get dirtyData() {\n return (this.report as any)?.data || {}\n }\n\n showSpinner() {\n this._showSpinner = true\n }\n\n hideSpinner() {\n this._showSpinner = false\n }\n\n focus() {\n super.focus()\n\n this.report?.focus()\n }\n\n /**\n * Forced internal data to be reflected on the screen\n * Data changing through a normal method is automatically reflected on the screen, so it is a method that does not need to be used in general.\nTherefore, it will be deprecated.\n * @deprecated\n * @method\n */\n refresh() {\n this.requestUpdate()\n }\n\n reset() {\n var {\n limit = ZERO_PAGINATION.limit,\n page = ZERO_PAGINATION.page,\n total = ZERO_PAGINATION.total,\n records = []\n } = this.data\n\n this._data = {\n limit,\n page,\n total,\n records: this.sortByGroups(records).map((record, idx) => {\n return {\n ...record,\n __seq__: (page - 1) * limit + idx + 1\n }\n })\n }\n }\n\n sortByGroups(sortedRecords: GristRecord[]) {\n var { groups, totals } = this._config.rows\n var { columns } = this._config\n\n var getColumnIndex = (name: string | number) =>\n columns.filter(column => !column.hidden).findIndex(column => column.name == name)\n\n var groupFieldsForTotalRecord: GroupConfig[] = [\n /* add a group total record to the front. */\n {\n column: '*',\n title: i18next.exists('text.ox-data-report-grand-total')\n ? i18next.t('text.ox-data-report-grand-total')\n : 'grand total',\n align: 'right',\n rowspan: 1\n },\n ...groups\n ].map(group => {\n return {\n ...group,\n titleColumn: buildColumn({\n record: {\n align: group.align || 'right'\n }\n })\n }\n })\n let lastGroupValues\n let reportRecords = []\n let totalicRecords: { [idx: string]: GroupConfig }[] = sortedRecords[0]\n ? (() => {\n /* 처음 만드는 total records */\n let record = sortedRecords[0]\n let totalBase = totals.reduce(\n (base, field) => {\n base[field] =\n columns.find(col => col.name == field)?.rowCount && (record[field] === 0 || record[field])\n ? 1\n : record[field]\n return base\n },\n {} as { [totalField: string]: number }\n )\n let groupBase = {} as { [idx: string]: GroupConfig }\n\n return groupFieldsForTotalRecord.map((group, idx) => {\n groupBase[group.column] = record[group.column]\n\n return {\n ...totalBase,\n ...groupBase,\n [group.column]: record[group.column],\n '*': {\n titleColumn: group.titleColumn,\n value: group.title,\n groupName: group.column,\n /* 이 레코드 그룹에 해당하는 첫번째 레코드의 행 번호(1 부터 시작하는 번호임.) - grid layout의 row 지정에 사용됨. */\n row: 1,\n rowspan: 1,\n /* 이 레코드 그룹의 컬럼에 해당하는 열 번호(1 부터 시작하는 번호임.) - grid layout의 column 지정에 사용됨. */\n column:\n group.column !== '*'\n ? getColumnIndex(group.column) + 1\n : getColumnIndex(groups[0].column) + 1 /* grand total 은 첫번째 그룹 컬럼을 사용한다. */,\n colspan:\n group.column !== '*' ? groupFieldsForTotalRecord.length - idx : groupFieldsForTotalRecord.length - 1\n }\n }\n })\n })()\n : [\n {\n '*': {\n titleColumn: groupFieldsForTotalRecord[0].titleColumn,\n value: i18next.exists('text.ox-data-report-grand-total')\n ? i18next.t('text.ox-data-report-grand-total')\n : 'grand total',\n groupName: '*',\n row: 1,\n rowspan: 1,\n column: 1,\n colspan: 0\n } as GroupConfig\n }\n ]\n\n var row = 0\n\n for (let record of sortedRecords) {\n let groupValues = groups.reduce(\n (base, group) => {\n base[group.column] = record[group.column]\n return base\n },\n {} as { [groupColumn: string]: string | number }\n )\n let isSameGroupRecord = true\n let totalsStack = [] as { idx: string; record: any }[]\n let groupBase = {} as { [idx: string]: any }\n\n row++\n\n if (lastGroupValues) {\n for (let idx in groupFieldsForTotalRecord) {\n let group = groupFieldsForTotalRecord[idx]\n let totalRecord: {\n [idx: string]: GroupConfig | number\n } = totalicRecords[idx]\n\n groupBase[group.column] = record[group.column]\n\n if (\n group.column == '*' ||\n (isSameGroupRecord && groupValues[group.column] === lastGroupValues[group.column])\n ) {\n for (let field of totals) {\n totalRecord[field] +=\n columns.find(col => col.name == field)?.rowCount && (record[field] === 0 || record[field])\n ? 1\n : record[field]\n }\n\n ;(totalRecord['*'] as GroupConfig).rowspan++\n\n continue\n }\n\n /* to avoid from floating point calculation problem */\n totals.forEach(field => {\n totalRecord[field] = Math.round((totalRecord[field] as number) * 100) / 100\n })\n\n isSameGroupRecord = false\n\n totalsStack.push({\n idx,\n record: totals.reduce(\n (sum, field) => {\n sum[field] =\n columns.find(col => col.name == field)?.rowCount && (record[field] === 0 || record[field])\n ? 1\n : record[field]\n return sum\n },\n {\n ...groupBase,\n [group.column]: record[group.column],\n '*': {\n titleColumn: group.titleColumn,\n groupName: group.column,\n value: group.title,\n row,\n rowspan: 1,\n column: getColumnIndex(group.column) + 1,\n colspan: totalicRecords[idx]['*'].colspan\n }\n }\n )\n })\n }\n\n totalsStack\n .reverse()\n .map(({ record, idx }) => {\n reportRecords.push(totalicRecords[Number(idx)])\n totalicRecords[Number(idx)] = {}\n\n if (record['*'].value) {\n totalicRecords.forEach(record => record['*'] && record['*'].rowspan++)\n row++\n }\n\n return { record, idx }\n })\n .forEach(({ record, idx }) => {\n record['*'].row = row\n totalicRecords[Number(idx)] = record\n })\n }\n\n reportRecords.push(record)\n\n lastGroupValues = groupValues\n }\n\n /* 마지막 남은 토탈 레코드들을 추가한다. */\n var poped: any\n while ((poped = totalicRecords.pop())) {\n /* to avoid from floating point calculation problem */\n totals.forEach(field => {\n poped[field] = Math.round(poped[field] * 100) / 100\n })\n\n reportRecords.push(poped)\n if (poped['*'].value) {\n totalicRecords.forEach(record => record['*'].rowspan++)\n }\n }\n\n return reportRecords\n }\n\n checkDirties() {}\n}\n"]}
1
+ {"version":3,"file":"data-report.js","sourceRoot":"","sources":["../../src/data-report.ts"],"names":[],"mappings":";AAAA,OAAO,wCAAwC,CAAA;AAE/C,OAAO,EAAE,UAAU,EAAkB,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAA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":["import './data-report/data-report-component.js'\n\nimport { LitElement, PropertyValues, css, html } from 'lit'\nimport { customElement, property, query, queryAsync, state } from 'lit/decorators.js'\nimport i18next from 'i18next'\n\nimport { ScrollbarStyles, SpinnerStyles } from '@operato/styles'\n\nimport { GristConfig, GristData, GristRecord, GroupConfig } from './types.js'\nimport { ZERO_CONFIG, ZERO_DATA, ZERO_PAGINATION } from './configure/zero-config.js'\nimport { pulltorefresh } from '@operato/pull-to-refresh'\nimport { DataConsumer } from './data-consumer.js'\nimport { DataProvider } from './data-provider.js'\nimport { DataReportComponent } from './data-report/data-report-component.js'\nimport { buildColumn } from './configure/column-builder.js'\nimport { buildConfig } from './configure/config-builder.js'\n\n@customElement('ox-report')\nexport class DataReport extends LitElement implements DataConsumer {\n static styles = [\n ScrollbarStyles,\n SpinnerStyles,\n css`\n :host {\n display: flex;\n flex-direction: column;\n box-sizing: border-box;\n background-color: var(--report-background-color);\n padding: var(--report-padding);\n min-height: 120px;\n\n overflow: hidden;\n\n /* for pulltorefresh controller */\n position: relative;\n }\n\n #wrap {\n flex: 1;\n display: flex;\n flex-direction: column;\n overflow: auto;\n }\n\n ox-report-component {\n flex: 1;\n }\n\n ox-empty-note {\n display: block;\n position: absolute;\n left: 50%;\n top: 50%;\n transform: translate(-50%, -50%);\n }\n `\n ]\n\n @property({ type: Object }) config: any\n @property({ type: Object }) data: GristData = ZERO_DATA\n @property({ type: Object }) fetchHandler: any\n @property({ type: Object }) fetchOptions: any\n @property({ type: Boolean, attribute: 'auto-fetch' }) autoFetch: boolean = false\n\n @state() _data: GristData = ZERO_DATA\n @state() _config: GristConfig = ZERO_CONFIG\n @state() private _showSpinner: boolean = false\n\n private dataProvider?: DataProvider\n private pulltorefreshHandle?: any\n\n @query('#report') report!: DataReportComponent\n @queryAsync('#wrap') private wrap!: Promise<HTMLElement>\n\n get mode(): 'REPORT' {\n return 'REPORT'\n }\n\n connectedCallback() {\n super.connectedCallback()\n\n this.dataProvider = new DataProvider(this)\n }\n\n disconnectedCallback() {\n super.disconnectedCallback()\n\n this.resetPullToRefresh()\n this.dataProvider?.dispose()\n }\n\n private resetPullToRefresh() {\n if (this.pulltorefreshHandle) {\n this.pulltorefreshHandle()\n delete this.pulltorefreshHandle\n }\n }\n\n private async setPullToRefresh() {\n this.resetPullToRefresh()\n if (this.fetchHandler) {\n this.pulltorefreshHandle = pulltorefresh({\n container: await this.wrap,\n scrollable: this.report.pullToRefreshTarget,\n refresh: () => {\n return this.fetch(true)\n }\n })\n }\n }\n\n async firstUpdated() {\n if (this.fetchHandler && this.autoFetch) {\n await this.requestUpdate()\n this.fetch(true)\n }\n }\n\n render() {\n var oops = !this._showSpinner && (!this._data || !this._data.records || this._data.records.length == 0)\n\n return html`\n ${oops ? html` <ox-empty-note title=${i18next.t('text.grid-no-records', { defaultValue: 'NO RECORDS' })}></ox-empty-note> ` : html``}\n\n <div id=\"wrap\">\n <ox-report-component id=\"report\" .config=${this._config} .data=${this._data}> </ox-report-component>\n </div>\n\n <div id=\"spinner\" ?show=${this._showSpinner}></div>\n `\n }\n\n async fetch(reset = true) {\n if (!this._config) {\n /* avoid to be here */\n console.warn('report is not configured yet.')\n return\n }\n\n if (reset) {\n /*\n * scroll 의 현재위치에 의해서 scroll 이벤트가 발생할 수 있으므로, 이를 방지하기 위해서 스크롤의 위치를 TOP으로 옮긴다.\n * (scroll 이 첫페이지 크기 이상으로 내려가 있는 경우, 첫페이지부터 다시 표시하는 경우에, scroll 이벤트가 발생한다.)\n */\n this.report.scrollTop = 0\n }\n\n if (this.dataProvider) {\n await this.dataProvider.attach(reset)\n }\n }\n\n async updated(changes: PropertyValues<this>) {\n if (changes.has('config')) {\n this._config = buildConfig({\n ...this.config\n })\n\n this.dataProvider && (this.dataProvider.sorters = this._config.sorters)\n this.fetch()\n }\n\n if (changes.has('fetchHandler')) {\n this.dataProvider && (this.dataProvider.fetchHandler = this.fetchHandler)\n await this.setPullToRefresh()\n }\n\n if (changes.has('fetchOptions')) {\n this.dataProvider && (this.dataProvider.fetchOptions = this.fetchOptions)\n }\n\n if (changes.has('data')) {\n this.reset()\n }\n }\n\n get dirtyData() {\n return (this.report as any)?.data || {}\n }\n\n showSpinner() {\n this._showSpinner = true\n }\n\n hideSpinner() {\n this._showSpinner = false\n }\n\n focus() {\n super.focus()\n\n this.report?.focus()\n }\n\n /**\n * Forced internal data to be reflected on the screen\n * Data changing through a normal method is automatically reflected on the screen, so it is a method that does not need to be used in general.\nTherefore, it will be deprecated.\n * @deprecated\n * @method\n */\n refresh() {\n this.requestUpdate()\n }\n\n reset() {\n var {\n limit = ZERO_PAGINATION.limit,\n page = ZERO_PAGINATION.page,\n total = ZERO_PAGINATION.total,\n records = []\n } = this.data\n\n this._data = {\n limit,\n page,\n total,\n records: this.sortByGroups(records).map((record, idx) => {\n return {\n ...record,\n __seq__: (page - 1) * limit + idx + 1\n }\n })\n }\n }\n\n sortByGroups(sortedRecords: GristRecord[]) {\n var { groups, totals } = this._config.rows\n var { columns } = this._config\n\n var getColumnIndex = (name: string | number) =>\n columns.filter(column => !column.hidden).findIndex(column => column.name == name)\n\n var groupFieldsForTotalRecord: GroupConfig[] = [\n /* add a group total record to the front. */\n {\n column: '*',\n title: i18next.exists('text.ox-data-report-grand-total')\n ? i18next.t('text.ox-data-report-grand-total')\n : 'grand total',\n align: 'right',\n rowspan: 1\n },\n ...groups\n ].map(group => {\n return {\n ...group,\n titleColumn: buildColumn({\n record: {\n align: group.align || 'right'\n }\n })\n }\n })\n let lastGroupValues\n let reportRecords = []\n let totalicRecords: { [idx: string]: GroupConfig }[] = sortedRecords[0]\n ? (() => {\n /* 처음 만드는 total records */\n let record = sortedRecords[0]\n let totalBase = totals.reduce(\n (base, field) => {\n base[field] =\n columns.find(col => col.name == field)?.rowCount && (record[field] === 0 || record[field])\n ? 1\n : record[field]\n return base\n },\n {} as { [totalField: string]: number }\n )\n let groupBase = {} as { [idx: string]: GroupConfig }\n\n return groupFieldsForTotalRecord.map((group, idx) => {\n groupBase[group.column] = record[group.column]\n\n return {\n ...totalBase,\n ...groupBase,\n [group.column]: record[group.column],\n '*': {\n titleColumn: group.titleColumn,\n value: group.title,\n groupName: group.column,\n /* 이 레코드 그룹에 해당하는 첫번째 레코드의 행 번호(1 부터 시작하는 번호임.) - grid layout의 row 지정에 사용됨. */\n row: 1,\n rowspan: 1,\n /* 이 레코드 그룹의 컬럼에 해당하는 열 번호(1 부터 시작하는 번호임.) - grid layout의 column 지정에 사용됨. */\n column:\n group.column !== '*'\n ? getColumnIndex(group.column) + 1\n : getColumnIndex(groups[0].column) + 1 /* grand total 은 첫번째 그룹 컬럼을 사용한다. */,\n colspan:\n group.column !== '*' ? groupFieldsForTotalRecord.length - idx : groupFieldsForTotalRecord.length - 1\n }\n }\n })\n })()\n : [\n {\n '*': {\n titleColumn: groupFieldsForTotalRecord[0].titleColumn,\n value: i18next.exists('text.ox-data-report-grand-total')\n ? i18next.t('text.ox-data-report-grand-total')\n : 'grand total',\n groupName: '*',\n row: 1,\n rowspan: 1,\n column: 1,\n colspan: 0\n } as GroupConfig\n }\n ]\n\n var row = 0\n\n for (let record of sortedRecords) {\n let groupValues = groups.reduce(\n (base, group) => {\n base[group.column] = record[group.column]\n return base\n },\n {} as { [groupColumn: string]: string | number }\n )\n let isSameGroupRecord = true\n let totalsStack = [] as { idx: string; record: any }[]\n let groupBase = {} as { [idx: string]: any }\n\n row++\n\n if (lastGroupValues) {\n for (let idx in groupFieldsForTotalRecord) {\n let group = groupFieldsForTotalRecord[idx]\n let totalRecord: {\n [idx: string]: GroupConfig | number\n } = totalicRecords[idx]\n\n groupBase[group.column] = record[group.column]\n\n if (\n group.column == '*' ||\n (isSameGroupRecord && groupValues[group.column] === lastGroupValues[group.column])\n ) {\n for (let field of totals) {\n totalRecord[field] +=\n columns.find(col => col.name == field)?.rowCount && (record[field] === 0 || record[field])\n ? 1\n : record[field]\n }\n\n ;(totalRecord['*'] as GroupConfig).rowspan++\n\n continue\n }\n\n /* to avoid from floating point calculation problem */\n totals.forEach(field => {\n totalRecord[field] = Math.round((totalRecord[field] as number) * 100) / 100\n })\n\n isSameGroupRecord = false\n\n totalsStack.push({\n idx,\n record: totals.reduce(\n (sum, field) => {\n sum[field] =\n columns.find(col => col.name == field)?.rowCount && (record[field] === 0 || record[field])\n ? 1\n : record[field]\n return sum\n },\n {\n ...groupBase,\n [group.column]: record[group.column],\n '*': {\n titleColumn: group.titleColumn,\n groupName: group.column,\n value: group.title,\n row,\n rowspan: 1,\n column: getColumnIndex(group.column) + 1,\n colspan: totalicRecords[idx]['*'].colspan\n }\n }\n )\n })\n }\n\n totalsStack\n .reverse()\n .map(({ record, idx }) => {\n reportRecords.push(totalicRecords[Number(idx)])\n totalicRecords[Number(idx)] = {}\n\n if (record['*'].value) {\n totalicRecords.forEach(record => record['*'] && record['*'].rowspan++)\n row++\n }\n\n return { record, idx }\n })\n .forEach(({ record, idx }) => {\n record['*'].row = row\n totalicRecords[Number(idx)] = record\n })\n }\n\n reportRecords.push(record)\n\n lastGroupValues = groupValues\n }\n\n /* 마지막 남은 토탈 레코드들을 추가한다. */\n var poped: any\n while ((poped = totalicRecords.pop())) {\n /* to avoid from floating point calculation problem */\n totals.forEach(field => {\n poped[field] = Math.round(poped[field] * 100) / 100\n })\n\n reportRecords.push(poped)\n if (poped['*'].value) {\n totalicRecords.forEach(record => record['*'].rowspan++)\n }\n }\n\n return reportRecords\n }\n\n checkDirties() {}\n}\n"]}