d2coreui 23.0.56 → 23.0.58
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.
- package/CHANGELOG.md +41 -0
- package/README.md +154 -154
- package/components/date/dateRangeInputAdvancedPanel.js +5 -5
- package/components/date/dateRangeInputAdvancedPanel.js.map +1 -1
- package/components/date/dateRangeInputConfirm.js +5 -5
- package/components/date/dateRangeInputConfirm.js.map +1 -1
- package/components/date/dateTimeInput.d.ts +12 -3
- package/components/date/dateTimeInput.js +72 -11
- package/components/date/dateTimeInput.js.map +1 -1
- package/components/grid/config/columnTransfer.js +61 -43
- package/components/grid/config/columnTransfer.js.map +1 -1
- package/components/grid/config/dataGridEditor.d.ts +4 -3
- package/components/grid/config/dataGridEditor.js +16 -4
- package/components/grid/config/dataGridEditor.js.map +1 -1
- package/components/grid/dataGrid.d.ts +20 -5
- package/components/grid/dataGrid.js +13 -7
- package/components/grid/dataGrid.js.map +1 -1
- package/components/grid/export/contextMenu.d.ts +3 -2
- package/components/grid/export/contextMenu.js.map +1 -1
- package/components/grid/export/worker/pdfExport.js.map +1 -1
- package/components/grid/extendedDataGrid.d.ts +11 -4
- package/components/grid/extendedDataGrid.js +34 -24
- package/components/grid/extendedDataGrid.js.map +1 -1
- package/components/grid/header/simpleHeader.d.ts +1 -1
- package/components/grid/header/simpleHeader.js +3 -2
- package/components/grid/header/simpleHeader.js.map +1 -1
- package/components/input/autoCompleteInput.d.ts +3 -0
- package/components/input/autoCompleteInput.js +18 -3
- package/components/input/autoCompleteInput.js.map +1 -1
- package/components/modal/impl/draggableModal.d.ts +1 -1
- package/components/modal/impl/draggableModal.js.map +1 -1
- package/components/modal/impl/draggableModalInner.js +23 -11
- package/components/modal/impl/draggableModalInner.js.map +1 -1
- package/components/modal/impl/draggableModalReducer.d.ts +2 -3
- package/components/modal/impl/draggableModalReducer.js +9 -7
- package/components/modal/impl/draggableModalReducer.js.map +1 -1
- package/components/modal/impl/draggableModalStyles.js +126 -126
- package/components/modal/impl/draggableModalStyles.js.map +1 -1
- package/components/modal/impl/resizeHandle.js.map +1 -1
- package/components/modal/modalDialog.d.ts +3 -2
- package/components/modal/modalDialog.js +3 -2
- package/components/modal/modalDialog.js.map +1 -1
- package/i18n/components.cs.json +2 -0
- package/i18n/components.sk.json +2 -0
- package/i18n/components.uk.json +2 -0
- package/package.json +1 -1
- package/style/index.less +240 -240
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"columnTransfer.js","sourceRoot":"","sources":["../../../../../components/grid/config/columnTransfer.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,QAAQ,EAAE,IAAI,EAAe,MAAM,MAAM,CAAA;AACjD,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,IAAI,MAAM,kBAAkB,CAAA;AACnC,OAAO,gBAAgB,MAAM,4CAA4C,CAAC;AAI1E,OAAO,UAAU,MAAM,mBAAmB,CAAC;AAE3C,gCAAgC;AAChC,MAAM,SAAS,GAAG,CAAC,YAAyB,EAAE,QAAgB,EAAE,EAAE;IAC9D,OAAO,YAAY,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC;AAIF,SAAS,YAAY,CAAC,YAA0B,EAAE,EAAE,cAAwB,EAAE;IAC1E,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,EAAoB,EAAgB,EAAE;YAAtC,EAAC,QAAQ,OAAW,EAAN,KAAK,cAAnB,YAAoB,CAAD;QAAoB,OAAA,iCACtD,KAAK,KACR,GAAG,EAAE,KAAK,CAAC,GAAa,EACxB,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAa,CAAC,EACnD,QAAQ,EAAE,YAAY,CAAC,QAAQ,EAAE,WAAW,CAAC,IAC/C,CAAA;KAAA,CAAC,CAAC;AACR,CAAC;AAED,SAAS,kBAAkB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AO,CAAC,CAAC;4BACpE,CAAC,GACH,CACA,CACT,CAAC;gBACN,CAAC;YACL,CAAC,CACM,CACd,CAAC;QACN,CAAC;IACL,CAAC;IAAA,CAAC;;AAvKY,2BAAY,GAAG;IACzB,IAAI,sCAAyB;CAChC,CAAC;eAHe,cAAc","sourcesContent":["import React from \"react\";\r\nimport {Transfer, Tree, TreeDataNode} from 'antd'\r\nimport _head from \"lodash/head\";\r\nimport i18n from \"d2core/i18n/i18n\"\r\nimport DragSortingTable from \"d2coreui/components/table/dragSortingTable\";\r\nimport {ColDef, ColumnState, GridApi} from \"ag-grid-community\";\r\nimport {TableRowSelection} from \"antd/es/table/interface\";\r\nimport {TransferItem} from \"antd/lib/transfer\";\r\nimport difference from \"lodash/difference\";\r\n\r\n// Customize ColumnNode Transfer\r\nconst isChecked = (selectedKeys: React.Key[], eventKey: string) => {\r\n return selectedKeys.indexOf(eventKey) !== -1;\r\n};\r\n\r\ntype TreeNodeType = TreeDataNode & ColumnNode;\r\n\r\nfunction generateTree(treeNodes: ColumnNode[] = [], checkedKeys: string[] = []): TreeNodeType[] {\r\n return treeNodes.map(({children, ...props}): TreeNodeType => ({\r\n ...props,\r\n key: props.key as string,\r\n disabled: checkedKeys.includes(props.key as string),\r\n children: generateTree(children, checkedKeys),\r\n }));\r\n}\r\n\r\nfunction generateSimpleTree(treeNodes: ColumnNode[] = []): TreeNodeType[] {\r\n return treeNodes.map(({children, ...props}) => ({\r\n ...props,\r\n key: props.key as string,\r\n children: generateSimpleTree(children)\r\n }));\r\n}\r\n\r\nfunction getColumns(columnDefinitions: ColDef[], gridApi: GridApi): ColumnNode[] {\r\n // noinspection UnnecessaryLocalVariableJS\r\n const columns = columnDefinitions.map((columnDef) => {\r\n const id = columnDef.colId ? columnDef.colId : (columnDef.field ? columnDef.field : \"\");\r\n const group = (columnDef as any).group;\r\n const column = id ? gridApi.getColumn(id) : null;\r\n return {\r\n key: id,\r\n title: (column && gridApi.getDisplayNameForColumn(column, \"columnToolPanel\")) || columnDef.headerName || id,\r\n description: columnDef.headerTooltip,\r\n group: group\r\n };\r\n });\r\n return columns;\r\n}\r\n\r\nfunction getColumnsTree(columns: ColumnNode[], filteredItems: ColumnNode[] | undefined = undefined): ColumnNode[] {\r\n const columnsDefinitionTree: ColumnNode[] = [];\r\n columns.forEach((column) => {\r\n const itemPresent = filteredItems ? (filteredItems.filter((filteredItem) => {\r\n return filteredItem.key === column.key\r\n }).length > 0) : true;\r\n if (!itemPresent) {\r\n return;\r\n }\r\n if (!column.group) {\r\n columnsDefinitionTree.push({key: column.key, title: column.title});\r\n return;\r\n }\r\n let parent = _head(columnsDefinitionTree.filter((parentNode) => parentNode.key === (\"_group_\" + column.group)));\r\n if (!parent) {\r\n parent = {key: \"_group_\" + column.group, title: column.group};\r\n columnsDefinitionTree.push(parent)\r\n }\r\n if (!parent.children) {\r\n parent.children = [];\r\n }\r\n parent.children.push({key: column.key, title: column.title});\r\n });\r\n return columnsDefinitionTree;\r\n}\r\n\r\ninterface ColumnNode extends TransferItem {\r\n group?: string\r\n children?: ColumnNode[]\r\n}\r\n\r\n/** Layout of {@link ColumnTransfer}. */\r\nexport const enum ColumnTransferType {\r\n /** Checkable tree of columns grouped by `DataGridColDef.group`; checking a column shows it. Column order cannot be changed. */\r\n SIMPLE = \"simple\",\r\n /** Two-list transfer: hidden columns as a grouped tree on the left, shown columns on the right, where they can be reordered by drag and drop. */\r\n FULL = \"full\"\r\n}\r\n\r\n/** Properties of {@link ColumnTransfer}. */\r\nexport interface ColumnTransferProps {\r\n /** Column definitions of the grid; a column is identified by `colId`, or by `field` when `colId` is not set, and grouped by its `group` (see `DataGridColDef`). */\r\n columnDefinitions: ColDef[]\r\n /** Current column state of the grid; columns without `hide` are shown as visible. */\r\n columnModel: ColumnState[]\r\n /** API of the grid whose columns are edited; every change is applied to it immediately. */\r\n gridApi: GridApi\r\n /**\r\n * Layout of the editor.\r\n * @default ColumnTransferType.FULL\r\n */\r\n type?: ColumnTransferType,\r\n /** Height in pixels of the {@link ColumnTransferType.FULL} layout; the lists get 100 pixels less. Also forwarded to the antd `Transfer`. */\r\n height?: number\r\n}\r\n\r\n/**\r\n * Editor of the visibility and order of ag-grid columns, used by the grid's column configuration dialog and settings drawer.\r\n * It does not keep its own copy of the changes: showing, hiding and moving a column is applied to `gridApi` at once,\r\n * so the caller re-renders it with the new `columnModel` (e.g. from ag-grid column events).\r\n */\r\nexport default class ColumnTransfer extends React.Component<ColumnTransferProps> {\r\n public static defaultProps = {\r\n type: ColumnTransferType.FULL\r\n };\r\n\r\n constructor(props: Readonly<ColumnTransferProps>) {\r\n super(props);\r\n this.onChange = this.onChange.bind(this);\r\n }\r\n\r\n /** antd `Transfer` change handler: shows (`direction` `\"right\"`) or hides the moved columns; a moved group key applies to all columns of the group. */\r\n onChange(_: React.Key[], direction: string, moveKeys: React.Key[]) {\r\n moveKeys.forEach((columnKey) => {\r\n if (typeof columnKey === \"string\") {\r\n if (columnKey.indexOf(\"_group_\") >= 0) {\r\n const columnsTree: ColumnNode[] = getColumnsTree(getColumns(this.props.columnDefinitions, this.props.gridApi));\r\n const columnGroup: ColumnNode | undefined = _head(columnsTree.filter((columnGroup) => {\r\n return columnGroup.key === columnKey;\r\n }));\r\n if (columnGroup && columnGroup.children) {\r\n columnGroup.children.forEach((column) => {\r\n this.props.gridApi.setColumnsVisible([column.key as string], direction === \"right\");\r\n });\r\n }\r\n } else {\r\n this.props.gridApi.setColumnsVisible([columnKey], direction === \"right\");\r\n }\r\n }\r\n });\r\n };\r\n\r\n render() {\r\n const {columnDefinitions, columnModel, gridApi, type, ...restProps} = this.props;\r\n const columns = getColumns(columnDefinitions, gridApi);\r\n const visibleColumnIds = columnModel.filter((column) => !column.hide).map((column) => column.colId) as string[];\r\n if (type === ColumnTransferType.SIMPLE) {\r\n const columnsTree = getColumnsTree(columns);\r\n return (<Tree<TreeNodeType>\r\n blockNode\r\n checkable\r\n defaultExpandAll\r\n checkedKeys={visibleColumnIds}\r\n onCheck={(selectedKeys, {node,},) => {\r\n const selectedColumnId: string = (node as any).props?.eventKey ? (node as any).props.eventKey : \"\";\r\n const visible = Array.isArray(selectedKeys) && selectedKeys.indexOf(selectedColumnId) >= 0;\r\n if (selectedColumnId.indexOf(\"_group_\") >= 0) {\r\n const columnGroup: ColumnNode | undefined = _head(columnsTree.filter((columnGroup) => {\r\n return columnGroup.key === selectedColumnId;\r\n }));\r\n if (columnGroup && columnGroup.children) {\r\n columnGroup.children.forEach((column) => {\r\n this.props.gridApi.setColumnsVisible([column.key as string], visible);\r\n });\r\n }\r\n } else {\r\n this.props.gridApi.setColumnsVisible([selectedColumnId], visible);\r\n }\r\n }}\r\n treeData={generateSimpleTree(columnsTree)}\r\n />);\r\n } else {\r\n const titles = [<b>{i18n(\"Hidden Columns\")}:</b>, <b>{i18n(\"Shown Columns\")}:</b>] as unknown as string[]; // special hack to overcome typescript titles attribute in Transfer component could be also [ReactElement, ReactElement]\r\n return (\r\n <Transfer {...restProps}\r\n style={{height: this.props.height, minHeight: 100}}\r\n locale={{\r\n itemUnit: \"\",\r\n itemsUnit: \"\",\r\n notFoundContent: i18n('The column list is empty'),\r\n searchPlaceholder: i18n('Column Name')\r\n }}\r\n targetKeys={visibleColumnIds}\r\n dataSource={columns}\r\n className=\"tree-transfer\"\r\n render={item => item.title ? item.title : null}\r\n showSelectAll={true}\r\n titles={titles}\r\n filterOption={(inputValue, item) => !!item.title && item.title.toLowerCase().indexOf(inputValue.toLowerCase()) > -1}\r\n showSearch\r\n onChange={this.onChange}>\r\n {({direction, onItemSelect, selectedKeys, filteredItems, onItemSelectAll}) => {\r\n if (direction === 'left') {\r\n const checkedKeys = [...selectedKeys];\r\n const columnsTree = getColumnsTree(columns, filteredItems);\r\n const selectNode = (node: ColumnNode, checked: boolean) => {\r\n if (node.children?.length) {\r\n onItemSelectAll(node.children.map((child) => child.key as string), checked);\r\n } else {\r\n onItemSelect(node.key as string, checked);\r\n }\r\n };\r\n return (\r\n <div style={{\r\n overflowY: \"auto\",\r\n height: (this.props.height ? this.props.height : 100) - 100\r\n }}>\r\n <Tree<TreeNodeType>\r\n key={columnsTree.filter((node) => node.children).map((node) => node.key).join()}\r\n blockNode\r\n checkable\r\n defaultExpandAll\r\n checkedKeys={checkedKeys}\r\n onCheck={(_, {node, checked}) => {\r\n selectNode(node, checked);\r\n }}\r\n onSelect={(_, {node}) => {\r\n const keys = node.children?.length ? node.children.map((child) => child.key as string) : [node.key as string];\r\n selectNode(node, !keys.every((key) => isChecked(checkedKeys, key)));\r\n }}\r\n treeData={generateTree(columnsTree, visibleColumnIds)}\r\n />\r\n </div>\r\n );\r\n } else {\r\n const rowSelection: TableRowSelection<ColumnNode> = {\r\n getCheckboxProps: item => {\r\n return {disabled: !!item.disabled};\r\n },\r\n onChange(selectedRowKeys) {\r\n const addedKeys = difference(selectedRowKeys, selectedKeys) as string[];\r\n const removedKeys = difference(selectedKeys, selectedRowKeys) as string[];\r\n if (addedKeys.length > 0) {\r\n onItemSelectAll(addedKeys, true);\r\n }\r\n if (removedKeys.length > 0) {\r\n onItemSelectAll(removedKeys, false);\r\n }\r\n },\r\n preserveSelectedRowKeys: true,\r\n selectedRowKeys: selectedKeys,\r\n };\r\n\r\n return (\r\n <div style={{\r\n overflowY: \"auto\",\r\n height: (this.props.height ? this.props.height : 100) - 100\r\n }}>\r\n <DragSortingTable<ColumnNode>\r\n showHeader={false}\r\n pagination={false}\r\n rowSelection={rowSelection}\r\n columns={[\r\n {\r\n dataIndex: 'title',\r\n title: 'Name',\r\n },\r\n ]}\r\n dataSource={filteredItems}\r\n size=\"small\"\r\n onRow={({key, disabled: itemDisabled}) => ({\r\n onClick: () => {\r\n if (itemDisabled) {\r\n return;\r\n }\r\n onItemSelect(key as string, !selectedKeys.includes(key as string));\r\n },\r\n })}\r\n onMoveRow={(column: ColumnNode, _: number, toIndex: number) => {\r\n this.props.gridApi.moveColumns([column.key as string], toIndex);\r\n }}\r\n />\r\n </div>\r\n );\r\n }\r\n }}\r\n </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AAC;oCACD,YAAY,CAAC,GAAa,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAa,CAAC,CAAC,CAAC;gCACvE,CAAC;6BACJ,CAAC,EACF,SAAS,EAAE,CAAC,MAAkB,EAAE,CAAS,EAAE,OAAe,EAAE,EAAE;gCAC1D,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,GAAa,CAAC,EAAE,OAAO,CAAC,CAAC;4BACpE,CAAC,GACH,CACA,CACT,CAAC;gBACN,CAAC;YACL,CAAC,CACM,CACd,CAAC;QACN,CAAC;IACL,CAAC;IAAA,CAAC;;AAvJY,2BAAY,GAAG;IACzB,IAAI,sCAAyB;CAChC,CAAC;eAHe,cAAc","sourcesContent":["import React from \"react\";\r\nimport {Transfer, Tree, TreeDataNode} from 'antd'\r\nimport _head from \"lodash/head\";\r\nimport i18n from \"d2core/i18n/i18n\"\r\nimport DragSortingTable from \"d2coreui/components/table/dragSortingTable\";\r\nimport {ColDef, ColumnState, GridApi} from \"ag-grid-community\";\r\nimport {TableRowSelection} from \"antd/es/table/interface\";\r\nimport {TransferItem} from \"antd/lib/transfer\";\r\nimport difference from \"lodash/difference\";\r\n\r\ntype TreeNodeType = TreeDataNode & ColumnNode;\r\n\r\nfunction generateTree(treeNodes: ColumnNode[] = [], checkedKeys: string[] = []): TreeNodeType[] {\r\n return treeNodes.map(({children, ...props}): TreeNodeType => ({\r\n ...props,\r\n key: props.key as string,\r\n disabled: !!props.disabled || checkedKeys.includes(props.key as string),\r\n children: generateTree(children, checkedKeys),\r\n }));\r\n}\r\n\r\nfunction generateSimpleTree(treeNodes: ColumnNode[] = []): TreeNodeType[] {\r\n return treeNodes.map(({children, ...props}) => ({\r\n ...props,\r\n key: props.key as string,\r\n children: generateSimpleTree(children)\r\n }));\r\n}\r\n\r\nfunction getColumns(columnDefinitions: ColDef[], gridApi: GridApi): ColumnNode[] {\r\n // noinspection UnnecessaryLocalVariableJS\r\n const columns = columnDefinitions.map((columnDef) => {\r\n const id = columnDef.colId ? columnDef.colId : (columnDef.field ? columnDef.field : \"\");\r\n const group = (columnDef as any).group;\r\n const column = id ? gridApi.getColumn(id) : null;\r\n return {\r\n key: id,\r\n title: (column && gridApi.getDisplayNameForColumn(column, \"columnToolPanel\")) || columnDef.headerName || id,\r\n description: columnDef.headerTooltip,\r\n group: group,\r\n // ag-grid's lockVisible blocks only its own UI, so this editor has to honour it itself; the merged\r\n // definition of the grid column also includes lockVisible from defaultColDef or a column type\r\n disabled: !!column?.getColDef().lockVisible\r\n };\r\n });\r\n return columns;\r\n}\r\n\r\n/** Returns the keys of the columns of `nodes` whose visibility can be changed (i.e. without `lockVisible`). */\r\nfunction getUnlockedKeys(nodes: ColumnNode[]): string[] {\r\n return nodes.filter((node) => !node.disabled).map((node) => node.key as string);\r\n}\r\n\r\n/**\r\n * Returns the tree's checked keys for a `checkStrictly` tree: `checkedKeys` plus the groups with all columns in them,\r\n * and the groups with some columns in them as half checked. The group state is computed here, because rc-tree leaves\r\n * disabled (locked) columns out of it - a group with an unchecked locked column would show as fully checked.\r\n */\r\nfunction getTreeCheckedKeys(tree: ColumnNode[], checkedKeys: string[]): { checked: string[], halfChecked: string[] } {\r\n const checked = [...checkedKeys];\r\n const halfChecked: string[] = [];\r\n tree.forEach((node) => {\r\n if (node.children?.length) {\r\n const checkedCount = node.children.filter((child) => checkedKeys.includes(child.key as string)).length;\r\n if (checkedCount === node.children.length) {\r\n checked.push(node.key as string);\r\n } else if (checkedCount > 0) {\r\n halfChecked.push(node.key as string);\r\n }\r\n }\r\n });\r\n return {checked, halfChecked};\r\n}\r\n\r\n/**\r\n * Returns the keys a click on `node` toggles (a group toggles its unlocked columns) and their new state: unchecked when\r\n * all of them are checked, otherwise checked. A group with a locked column in the other state stays half checked, so\r\n * rc-tree's `checked` of the click cannot be used - it would always be `true` for it.\r\n */\r\nfunction getToggle(node: ColumnNode, checkedKeys: string[]): { keys: string[], checked: boolean } {\r\n const keys = node.children?.length ? getUnlockedKeys(node.children) : [node.key as string];\r\n return {keys, checked: !keys.every((key) => checkedKeys.includes(key))};\r\n}\r\n\r\nfunction getColumnsTree(columns: ColumnNode[], filteredItems: ColumnNode[] | undefined = undefined): ColumnNode[] {\r\n const columnsDefinitionTree: ColumnNode[] = [];\r\n columns.forEach((column) => {\r\n const itemPresent = filteredItems ? (filteredItems.filter((filteredItem) => {\r\n return filteredItem.key === column.key\r\n }).length > 0) : true;\r\n if (!itemPresent) {\r\n return;\r\n }\r\n if (!column.group) {\r\n columnsDefinitionTree.push({key: column.key, title: column.title, disabled: column.disabled});\r\n return;\r\n }\r\n let parent = _head(columnsDefinitionTree.filter((parentNode) => parentNode.key === (\"_group_\" + column.group)));\r\n if (!parent) {\r\n parent = {key: \"_group_\" + column.group, title: column.group};\r\n columnsDefinitionTree.push(parent)\r\n }\r\n if (!parent.children) {\r\n parent.children = [];\r\n }\r\n parent.children.push({key: column.key, title: column.title, disabled: column.disabled});\r\n });\r\n // a group whose columns are all locked cannot be checked either\r\n columnsDefinitionTree.forEach((node) => {\r\n if (node.children) {\r\n node.disabled = node.children.every((child) => child.disabled);\r\n }\r\n });\r\n return columnsDefinitionTree;\r\n}\r\n\r\ninterface ColumnNode extends TransferItem {\r\n group?: string\r\n children?: ColumnNode[]\r\n}\r\n\r\n/** Layout of {@link ColumnTransfer}. */\r\nexport const enum ColumnTransferType {\r\n /** Checkable tree of columns grouped by `DataGridColDef.group`; checking a column shows it. Column order cannot be changed. */\r\n SIMPLE = \"simple\",\r\n /** Two-list transfer: hidden columns as a grouped tree on the left, shown columns on the right, where they can be reordered by drag and drop. */\r\n FULL = \"full\"\r\n}\r\n\r\n/** Properties of {@link ColumnTransfer}. */\r\nexport interface ColumnTransferProps {\r\n /** Column definitions of the grid; a column is identified by `colId`, or by `field` when `colId` is not set, and grouped by its `group` (see `DataGridColDef`). */\r\n columnDefinitions: ColDef[]\r\n /** Current column state of the grid; columns without `hide` are shown as visible. */\r\n columnModel: ColumnState[]\r\n /** API of the grid whose columns are edited; every change is applied to it immediately. */\r\n gridApi: GridApi\r\n /**\r\n * Layout of the editor.\r\n * @default ColumnTransferType.FULL\r\n */\r\n type?: ColumnTransferType,\r\n /** Height in pixels of the {@link ColumnTransferType.FULL} layout; the lists get 100 pixels less. Also forwarded to the antd `Transfer`. */\r\n height?: number\r\n}\r\n\r\n/**\r\n * Editor of the visibility and order of ag-grid columns, used by the grid's column configuration dialog and settings drawer.\r\n * It does not keep its own copy of the changes: showing, hiding and moving a column is applied to `gridApi` at once,\r\n * so the caller re-renders it with the new `columnModel` (e.g. from ag-grid column events).\r\n */\r\nexport default class ColumnTransfer extends React.Component<ColumnTransferProps> {\r\n public static defaultProps = {\r\n type: ColumnTransferType.FULL\r\n };\r\n\r\n constructor(props: Readonly<ColumnTransferProps>) {\r\n super(props);\r\n this.onChange = this.onChange.bind(this);\r\n }\r\n\r\n /** antd `Transfer` change handler: shows (`direction` `\"right\"`) or hides the moved columns; a moved group key applies to all columns of the group. */\r\n onChange(_: React.Key[], direction: string, moveKeys: React.Key[]) {\r\n moveKeys.forEach((columnKey) => {\r\n if (typeof columnKey === \"string\") {\r\n if (columnKey.indexOf(\"_group_\") >= 0) {\r\n const columnsTree: ColumnNode[] = getColumnsTree(getColumns(this.props.columnDefinitions, this.props.gridApi));\r\n const columnGroup: ColumnNode | undefined = _head(columnsTree.filter((columnGroup) => {\r\n return columnGroup.key === columnKey;\r\n }));\r\n if (columnGroup && columnGroup.children) {\r\n this.props.gridApi.setColumnsVisible(getUnlockedKeys(columnGroup.children), direction === \"right\");\r\n }\r\n } else {\r\n this.props.gridApi.setColumnsVisible([columnKey], direction === \"right\");\r\n }\r\n }\r\n });\r\n };\r\n\r\n render() {\r\n const {columnDefinitions, columnModel, gridApi, type, ...restProps} = this.props;\r\n const columns = getColumns(columnDefinitions, gridApi);\r\n const visibleColumnIds = columnModel.filter((column) => !column.hide).map((column) => column.colId) as string[];\r\n if (type === ColumnTransferType.SIMPLE) {\r\n const columnsTree = getColumnsTree(columns);\r\n return (<Tree<TreeNodeType>\r\n blockNode\r\n checkable\r\n checkStrictly\r\n defaultExpandAll\r\n checkedKeys={getTreeCheckedKeys(columnsTree, visibleColumnIds)}\r\n onCheck={(_, {node}) => {\r\n const {keys, checked} = getToggle(node, visibleColumnIds);\r\n this.props.gridApi.setColumnsVisible(keys, checked);\r\n }}\r\n treeData={generateSimpleTree(columnsTree)}\r\n />);\r\n } else {\r\n const titles = [<b>{i18n(\"Hidden Columns\")}:</b>, <b>{i18n(\"Shown Columns\")}:</b>] as unknown as string[]; // special hack to overcome typescript titles attribute in Transfer component could be also [ReactElement, ReactElement]\r\n return (\r\n <Transfer {...restProps}\r\n style={{height: this.props.height, minHeight: 100}}\r\n locale={{\r\n itemUnit: \"\",\r\n itemsUnit: \"\",\r\n notFoundContent: i18n('The column list is empty'),\r\n searchPlaceholder: i18n('Column Name')\r\n }}\r\n targetKeys={visibleColumnIds}\r\n dataSource={columns}\r\n className=\"tree-transfer\"\r\n render={item => item.title ? item.title : null}\r\n showSelectAll={true}\r\n titles={titles}\r\n filterOption={(inputValue, item) => !!item.title && item.title.toLowerCase().indexOf(inputValue.toLowerCase()) > -1}\r\n showSearch\r\n onChange={this.onChange}>\r\n {({direction, onItemSelect, selectedKeys, filteredItems, onItemSelectAll}) => {\r\n if (direction === 'left') {\r\n const checkedKeys = selectedKeys as string[];\r\n const columnsTree = getColumnsTree(columns, filteredItems);\r\n const toggleNode = (node: ColumnNode) => {\r\n const {keys, checked} = getToggle(node, checkedKeys);\r\n onItemSelectAll(keys, checked);\r\n };\r\n return (\r\n <div style={{\r\n overflowY: \"auto\",\r\n height: (this.props.height ? this.props.height : 100) - 100\r\n }}>\r\n <Tree<TreeNodeType>\r\n key={columnsTree.filter((node) => node.children).map((node) => node.key).join()}\r\n blockNode\r\n checkable\r\n checkStrictly\r\n defaultExpandAll\r\n checkedKeys={getTreeCheckedKeys(columnsTree, checkedKeys)}\r\n onCheck={(_, {node}) => toggleNode(node)}\r\n onSelect={(_, {node}) => {\r\n if (!node.disabled) {\r\n toggleNode(node);\r\n }\r\n }}\r\n treeData={generateTree(columnsTree, visibleColumnIds)}\r\n />\r\n </div>\r\n );\r\n } else {\r\n const rowSelection: TableRowSelection<ColumnNode> = {\r\n getCheckboxProps: item => {\r\n return {disabled: !!item.disabled};\r\n },\r\n onChange(selectedRowKeys) {\r\n const addedKeys = difference(selectedRowKeys, selectedKeys) as string[];\r\n const removedKeys = difference(selectedKeys, selectedRowKeys) as string[];\r\n if (addedKeys.length > 0) {\r\n onItemSelectAll(addedKeys, true);\r\n }\r\n if (removedKeys.length > 0) {\r\n onItemSelectAll(removedKeys, false);\r\n }\r\n },\r\n preserveSelectedRowKeys: true,\r\n selectedRowKeys: selectedKeys,\r\n };\r\n\r\n return (\r\n <div style={{\r\n overflowY: \"auto\",\r\n height: (this.props.height ? this.props.height : 100) - 100\r\n }}>\r\n <DragSortingTable<ColumnNode>\r\n showHeader={false}\r\n pagination={false}\r\n rowSelection={rowSelection}\r\n columns={[\r\n {\r\n dataIndex: 'title',\r\n title: 'Name',\r\n },\r\n ]}\r\n dataSource={filteredItems}\r\n size=\"small\"\r\n onRow={({key, disabled: itemDisabled}) => ({\r\n onClick: () => {\r\n if (itemDisabled) {\r\n return;\r\n }\r\n onItemSelect(key as string, !selectedKeys.includes(key as string));\r\n },\r\n })}\r\n onMoveRow={(column: ColumnNode, _: number, toIndex: number) => {\r\n this.props.gridApi.moveColumns([column.key as string], toIndex);\r\n }}\r\n />\r\n </div>\r\n );\r\n }\r\n }}\r\n </Transfer>\r\n );\r\n }\r\n };\r\n}\r\n\r\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CollapseProps } from 'antd';
|
|
3
|
+
import { ResolvedUtcOffsetMode } from "d2core/i18n/localeHolder";
|
|
3
4
|
import { RowStyleRule } from "d2coreui/components/grid/cell/tableDefaultRowStyleRules";
|
|
4
5
|
import { ColumnState, GridApi } from "ag-grid-community";
|
|
5
6
|
import { DataGridColDef } from "../dataGrid";
|
|
@@ -27,10 +28,10 @@ interface DataGridEditorProps {
|
|
|
27
28
|
showYear: boolean;
|
|
28
29
|
/** Value of `showYear` restored by the revert button. */
|
|
29
30
|
defaultShowYear: boolean;
|
|
30
|
-
/**
|
|
31
|
-
showUtcOffset:
|
|
31
|
+
/** When date-time columns show the UTC offset. */
|
|
32
|
+
showUtcOffset: ResolvedUtcOffsetMode;
|
|
32
33
|
/** Value of `showUtcOffset` restored by the revert button. */
|
|
33
|
-
defaultShowUtcOffset:
|
|
34
|
+
defaultShowUtcOffset: ResolvedUtcOffsetMode;
|
|
34
35
|
/** Row style rules restored (as a deep copy) by the revert button of the row styling section; without them the button does nothing. */
|
|
35
36
|
defaultRowStyleRules?: RowStyleRule[];
|
|
36
37
|
/** Row style rules edited in the row styling section, one {@link RowStylePicker} per rule. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { DownloadOutlined, SaveOutlined, SettingOutlined } from "@ant-design/icons";
|
|
3
|
-
import { Button, Collapse, Drawer, InputNumber, notification, Space, Switch } from 'antd';
|
|
3
|
+
import { Button, Collapse, Drawer, InputNumber, notification, Select, Space, Switch } from 'antd';
|
|
4
4
|
import i18n from "d2core/i18n/i18n";
|
|
5
5
|
import ColumnTransfer from "./columnTransfer";
|
|
6
6
|
import RowStylePicker from "./rowStylePicker";
|
|
@@ -9,6 +9,13 @@ import { ModalDialog } from "d2coreui/components/modal/modalDialog";
|
|
|
9
9
|
import { UndoIcon } from "d2coreui/components/icons/undoIcon";
|
|
10
10
|
import PlatformSpecific from "d2coreui/components/platformSpecific";
|
|
11
11
|
const REVERT_BUTTON_STYLE = { marginTop: -5 };
|
|
12
|
+
// the configuration is stored, and older readers take any string as true
|
|
13
|
+
function toConfigurationValue(mode) {
|
|
14
|
+
if (mode === "none") {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
return mode === "offset" ? true : mode;
|
|
18
|
+
}
|
|
12
19
|
/**
|
|
13
20
|
* Advanced settings drawer of `DataGrid`, opened from its settings menu. Its collapsible sections let the user
|
|
14
21
|
* save, export or revert the window configuration (through {@link PlatformSpecific}), switch paging and date-time
|
|
@@ -113,7 +120,7 @@ export default class DataGridEditor extends React.Component {
|
|
|
113
120
|
}
|
|
114
121
|
this.props.dataGrid.showMilliseconds(this.props.defaultShowMilliseconds);
|
|
115
122
|
this.props.dataGrid.showYear(this.props.defaultShowYear);
|
|
116
|
-
this.props.dataGrid.showUtcOffset(this.props.defaultShowUtcOffset);
|
|
123
|
+
this.props.dataGrid.showUtcOffset(toConfigurationValue(this.props.defaultShowUtcOffset));
|
|
117
124
|
} })),
|
|
118
125
|
children: (React.createElement(Space, { direction: "vertical", style: { width: "100%" } },
|
|
119
126
|
React.createElement("div", { style: { width: "100%" } },
|
|
@@ -152,8 +159,13 @@ export default class DataGridEditor extends React.Component {
|
|
|
152
159
|
React.createElement("div", { style: { width: "100%" } },
|
|
153
160
|
React.createElement("span", null, i18n("Show time with time zone")),
|
|
154
161
|
React.createElement("span", { style: { float: "right" } },
|
|
155
|
-
React.createElement(
|
|
156
|
-
|
|
162
|
+
React.createElement(Select, { size: "small", popupMatchSelectWidth: false, value: this.props.showUtcOffset, options: [
|
|
163
|
+
{ value: "none", label: i18n("No") },
|
|
164
|
+
{ value: "hourLetter", label: i18n("A2:00 / B2:00 at the change to winter time") },
|
|
165
|
+
{ value: "offset", label: i18n("Yes") },
|
|
166
|
+
{ value: "offsetInFold", label: i18n("Only at the change to winter time") },
|
|
167
|
+
], onChange: (value) => {
|
|
168
|
+
this.props.dataGrid.showUtcOffset(toConfigurationValue(value));
|
|
157
169
|
} })))))
|
|
158
170
|
};
|
|
159
171
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dataGridEditor.js","sourceRoot":"","sources":["../../../../../components/grid/config/dataGridEditor.tsx"],"names":[],"mappings":"A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ACpF,kBAAkB,CAAC,YAA0B,EAAE,KAAa;QACxD,OAAO,CACH,oBAAC,cAAc,IAAC,GAAG,EAAE,mBAAmB,GAAG,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,YAAY,EAAE,EAAE;gBACrG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC;gBAC/C,IAAI,IAAI,CAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC;oBACnC,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;gBAC/D,CAAC;YACL,CAAC,GAAG,CACP,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React from \"react\";\r\nimport {DownloadOutlined, SaveOutlined, SettingOutlined} from \"@ant-design/icons\";\r\nimport {Button, Collapse, CollapseProps, Drawer, InputNumber, notification, Space, Switch} from 'antd';\r\nimport i18n from \"d2core/i18n/i18n\"\r\nimport ColumnTransfer, {ColumnTransferType} from \"./columnTransfer\";\r\nimport RowStylePicker from \"./rowStylePicker\";\r\nimport cloneDeep from \"lodash/cloneDeep\"\r\nimport {RowStyleRule} from \"d2coreui/components/grid/cell/tableDefaultRowStyleRules\";\r\nimport {ColDef, ColumnState, GridApi} from \"ag-grid-community\";\r\nimport {DataGridColDef} from \"../dataGrid\";\r\nimport {ModalDialog, ModalDialogMode} from \"d2coreui/components/modal/modalDialog\";\r\nimport {UndoIcon} from \"d2coreui/components/icons/undoIcon\";\r\nimport PlatformSpecific from \"d2coreui/components/platformSpecific\";\r\n\r\nconst REVERT_BUTTON_STYLE = {marginTop: -5};\r\n\r\n/** Properties of {@link DataGridEditor}. */\r\ninterface DataGridEditorProps {\r\n /** The owning `DataGrid`; its `changePagination`, `showMilliseconds`, `showYear` and `showUtcOffset` methods apply the general settings. */\r\n dataGrid: any\r\n /** API of the grid; column changes and the column revert are applied to it directly. */\r\n gridApi: GridApi\r\n /** Column definitions of the grid, listed in the columns section. */\r\n columnDefinitions: DataGridColDef[]\r\n /** Current column state of the grid, determines which columns are checked as visible. */\r\n columnModel: ColumnState[]\r\n\r\n /** Number of rows per page currently displayed; the fixed page size shown in the editor. Its value at mount is used when switching from automatic to fixed paging (20 if it is not greater than 1). */\r\n currentPageSize: number\r\n /** Configured page size: `-1` no paging, `0` automatic, a positive number fixed. */\r\n paginationPageSize: number\r\n /** Page size restored by the revert button of the general section; `0` (automatic) when not set. */\r\n paginationDefaultPageSize?: number\r\n /** Whether date-time columns show milliseconds. */\r\n showMilliseconds: boolean\r\n /** Value of `showMilliseconds` restored by the revert button. */\r\n defaultShowMilliseconds: boolean\r\n /** Whether date columns show the year. */\r\n showYear: boolean\r\n /** Value of `showYear` restored by the revert button. */\r\n defaultShowYear: boolean\r\n /** Whether date-time columns show the UTC offset. */\r\n showUtcOffset: boolean\r\n /** Value of `showUtcOffset` restored by the revert button. */\r\n defaultShowUtcOffset: boolean\r\n\r\n /** Row style rules restored (as a deep copy) by the revert button of the row styling section; without them the button does nothing. */\r\n defaultRowStyleRules?: RowStyleRule[]\r\n /** Row style rules edited in the row styling section, one {@link RowStylePicker} per rule. */\r\n rowStyleRules: RowStyleRule[]\r\n\r\n /** Called after a rule was edited, with the same `rowStyleRules` array modified in place, or with a copy of `defaultRowStyleRules` on revert. */\r\n onChangeRowStyleRules?(rowStyleRules: RowStyleRule[]): void\r\n\r\n /** Whether the drawer is open. */\r\n visible: boolean\r\n\r\n /** Called with `false` when the user closes the drawer. */\r\n onTableConfigVisible(visible: boolean): void\r\n}\r\n\r\ninterface DataGridEditorState {\r\n targetKeys: string[]\r\n initialPageSize: number\r\n windowName: string\r\n configurationChangesDisabled: boolean\r\n}\r\n\r\n/**\r\n * Advanced settings drawer of `DataGrid`, opened from its settings menu. Its collapsible sections let the user\r\n * save, export or revert the window configuration (through {@link PlatformSpecific}), switch paging and date-time\r\n * formatting, show/hide columns (a {@link ColumnTransfer}) and edit the row style rules. Changes are applied immediately;\r\n * saving the window configuration is disabled when {@link PlatformSpecific} disallows configuration changes.\r\n */\r\nexport default class DataGridEditor extends React.Component<DataGridEditorProps, DataGridEditorState> {\r\n constructor(props: Readonly<DataGridEditorProps>) {\r\n super(props);\r\n this.state = {\r\n targetKeys: [],\r\n initialPageSize: props.currentPageSize,\r\n windowName: \"\",\r\n configurationChangesDisabled: PlatformSpecific.INSTANCE.configurationChangesDisabled()\r\n };\r\n this.onChange = this.onChange.bind(this);\r\n }\r\n\r\n componentDidMount() {\r\n this.setState({\r\n initialPageSize: this.props.currentPageSize,\r\n windowName: PlatformSpecific.INSTANCE.getCurrentWindowName()\r\n });\r\n }\r\n\r\n /** Stores the given keys in the component state; not used by the rendered UI. */\r\n onChange(targetKeys: string[]) {\r\n this.setState({targetKeys});\r\n };\r\n\r\n render() {\r\n return (\r\n <Drawer\r\n title={<div style={{width: \"100%\", paddingRight: 24}}>\r\n <SettingOutlined/> {i18n(\"Advanced Settings\")}\r\n </div>}\r\n placement=\"right\"\r\n closable={true}\r\n mask={true}\r\n width={340}\r\n onClose={() => {\r\n this.props.onTableConfigVisible(false);\r\n }}\r\n open={this.props.visible}\r\n style={{borderTop: \"1px solid #ddd\"}}\r\n styles={{\r\n body: {padding: 0},\r\n mask: {background: \"transparent\"}\r\n }}\r\n >\r\n <Collapse defaultActiveKey={[]}\r\n bordered={false}\r\n items={[\r\n this.getWindowSettingsPanel(),\r\n this.renderTableGeneralSettingsPanel(),\r\n this.renderTableColumnSettingsPanel(),\r\n this.props.rowStyleRules && this.renderRowsPanel(),\r\n ]} />\r\n </Drawer>\r\n );\r\n }\r\n\r\n /** Returns the window configuration section (save, export, revert to predefined or factory state). */\r\n getWindowSettingsPanel(): NonNullable<CollapseProps['items']>[number] {\r\n return {\r\n key: \"window-settings\",\r\n label: <span style={{fontWeight: 500}}>{i18n(\"Window\") + \" \\\"\" + this.state.windowName + \" \\\"\"}</span>,\r\n extra: (\r\n <Button\r\n title={i18n(\"Revert configuration to predefined state\")} icon={<UndoIcon/>} key=\"revert\"\r\n style={REVERT_BUTTON_STYLE}\r\n danger\r\n ghost\r\n onClick={(e) => {\r\n e.stopPropagation();\r\n e.nativeEvent.stopImmediatePropagation();\r\n PlatformSpecific.INSTANCE.reloadPageInPredefinedState();\r\n }}/>\r\n ),\r\n children: (\r\n <>\r\n <div style={{paddingRight: 16, paddingLeft: 16, paddingBottom: 8}}>\r\n <Button type=\"primary\" style={{width: \"100%\"}}\r\n disabled={this.state.configurationChangesDisabled}\r\n title={i18n(\"Save current window configuration for current user\")}\r\n onClick={() => {\r\n ModalDialog.confirm({\r\n mode: ModalDialogMode.YES_NO,\r\n title: <span\r\n style={{whiteSpace: \"nowrap\"}}>{i18n(\"Save Window Configuration\") + \"?\"}</span>,\r\n width: 400,\r\n onOk: () => {\r\n PlatformSpecific.INSTANCE.saveWindowConfiguration();\r\n notification['success']({\r\n message: i18n(\"Window configuration saved successfully\"),\r\n })\r\n },\r\n });\r\n\r\n }}>\r\n <SaveOutlined/>{i18n(\"Save Window Configuration\")}\r\n </Button>\r\n </div>\r\n <div style={{paddingRight: 16, paddingLeft: 16, paddingBottom: 8}}>\r\n <Button style={{width: \"100%\"}}\r\n title={i18n(\"Export current window configuration to file\")}\r\n onClick={() => {\r\n PlatformSpecific.INSTANCE.exportWindowConfiguration();\r\n }}>\r\n <DownloadOutlined/>{i18n(\"Export Window Configuration\")}\r\n </Button>\r\n </div>\r\n <div style={{paddingRight: 16, paddingLeft: 16, paddingBottom: 8}}>\r\n <Button danger ghost\r\n style={{width: \"100%\"}}\r\n onClick={() => {\r\n PlatformSpecific.INSTANCE.reloadPageInFactoryState();\r\n }}>\r\n <UndoIcon/>{i18n(\"Revert to factory configuration\")}\r\n </Button>\r\n </div>\r\n </>\r\n )\r\n };\r\n }\r\n\r\n /** Returns the general table section (paging, year, milliseconds and UTC offset in date-time values). */\r\n renderTableGeneralSettingsPanel(): NonNullable<CollapseProps['items']>[number] {\r\n const paginationEnabled = this.props.paginationPageSize >= 0;\r\n const automaticPagination = this.props.paginationPageSize === 0;\r\n return {\r\n key: \"general\",\r\n label: <span style={{fontWeight: 500}}>{i18n(\"Table - General Settings\")}</span>,\r\n extra: (\r\n <Button\r\n title={i18n(\"Revert configuration to predefined state\")} icon={<UndoIcon/>}\r\n key=\"revert\"\r\n style={REVERT_BUTTON_STYLE}\r\n danger\r\n ghost\r\n onClick={(e) => {\r\n e.stopPropagation();\r\n e.nativeEvent.stopImmediatePropagation();\r\n if (this.props.paginationDefaultPageSize !== undefined) {\r\n this.props.dataGrid.changePagination(this.props.paginationDefaultPageSize);\r\n } else {\r\n this.props.dataGrid.changePagination(0);\r\n }\r\n this.props.dataGrid.showMilliseconds(this.props.defaultShowMilliseconds);\r\n this.props.dataGrid.showYear(this.props.defaultShowYear);\r\n this.props.dataGrid.showUtcOffset(this.props.defaultShowUtcOffset);\r\n }}/>\r\n ),\r\n children: (\r\n <Space direction=\"vertical\" style={{width: \"100%\"}}>\r\n <div style={{width: \"100%\"}}>\r\n <span>{i18n(\"Pagination\")}</span>\r\n <span style={{float: \"right\"}}>\r\n <Switch checkedChildren={i18n(\"Enabled\") + \" \"}\r\n unCheckedChildren={i18n(\" \" + i18n(\"Disabled\"))}\r\n checked={paginationEnabled}\r\n onChange={(checked) => {\r\n this.props.dataGrid.changePagination(checked ? 0 : -1);\r\n }}/>\r\n </span>\r\n </div>\r\n <div style={{width: \"100%\"}}>\r\n <span>{i18n(\"Page Size\")}</span>\r\n <span style={{float: \"right\"}}>\r\n <InputNumber\r\n size=\"small\"\r\n style={{\r\n width: 70,\r\n display: !paginationEnabled || automaticPagination ? \"none\" : \"\",\r\n marginLeft: 8\r\n }}\r\n placeholder=\"size\"\r\n className=\"custom\"\r\n value={this.props.currentPageSize}\r\n onChange={(pageSize) => {\r\n if (pageSize) {\r\n this.props.dataGrid.changePagination(pageSize);\r\n }\r\n }}\r\n />\r\n <Switch disabled={!paginationEnabled}\r\n style={{minWidth: 100}}\r\n checkedChildren={i18n(\"Automatic\") + \" \"}\r\n unCheckedChildren={i18n(\" \" + i18n(\"Fixed\"))}\r\n checked={!paginationEnabled || automaticPagination}\r\n onChange={(checked) => {\r\n this.props.dataGrid.changePagination(checked ? 0 : (this.state.initialPageSize > 1 ? this.state.initialPageSize : 20));\r\n }}/>\r\n </span>\r\n </div>\r\n <div style={{width: \"100%\"}}>\r\n <span>{i18n(\"Show time with year\")}</span>\r\n <span style={{float: \"right\"}}>\r\n <Switch checkedChildren={i18n(\"Yes\") + \" \"}\r\n unCheckedChildren={i18n(\" \" + i18n(\"No\"))}\r\n checked={this.props.showYear}\r\n onChange={(checked) => {\r\n this.props.dataGrid.showYear(checked);\r\n }}/>\r\n </span>\r\n </div>\r\n <div style={{width: \"100%\"}}>\r\n <span>{i18n(\"Show time with milliseconds\")}</span>\r\n <span style={{float: \"right\"}}>\r\n <Switch checkedChildren={i18n(\"Yes\") + \" \"}\r\n unCheckedChildren={i18n(\" \" + i18n(\"No\"))}\r\n checked={this.props.showMilliseconds}\r\n onChange={(checked) => {\r\n this.props.dataGrid.showMilliseconds(checked);\r\n }}/>\r\n </span>\r\n </div>\r\n <div style={{width: \"100%\"}}>\r\n <span>{i18n(\"Show time with time zone\")}</span>\r\n <span style={{float: \"right\"}}>\r\n <Switch checkedChildren={i18n(\"Yes\") + \" \"}\r\n unCheckedChildren={i18n(\" \" + i18n(\"No\"))}\r\n checked={this.props.showUtcOffset}\r\n onChange={(checked) => {\r\n this.props.dataGrid.showUtcOffset(checked);\r\n }}/>\r\n </span>\r\n </div>\r\n </Space>\r\n )\r\n };\r\n }\r\n\r\n /** Returns the column visibility section; its revert button resets the ag-grid column state. */\r\n renderTableColumnSettingsPanel(): NonNullable<CollapseProps['items']>[number] {\r\n return {\r\n key: \"columns\",\r\n label: <span style={{fontWeight: 500}}>{i18n(\"Table - Columns\")}</span>,\r\n extra: (\r\n <Button\r\n title={i18n(\"Revert configuration to predefined state\")} icon={<UndoIcon/>}\r\n key=\"revert\"\r\n style={REVERT_BUTTON_STYLE}\r\n danger\r\n ghost\r\n onClick={(e) => {\r\n e.stopPropagation();\r\n e.nativeEvent.stopImmediatePropagation();\r\n this.props.gridApi.resetColumnState();\r\n }}/>\r\n ),\r\n children: (\r\n <ColumnTransfer\r\n columnDefinitions={this.props.columnDefinitions as ColDef[]}\r\n columnModel={this.props.columnModel}\r\n type={ColumnTransferType.SIMPLE}\r\n gridApi={this.props.gridApi}\r\n />\r\n )\r\n };\r\n }\r\n\r\n /** Returns the row styling section. */\r\n renderRowsPanel(): NonNullable<CollapseProps['items']>[number] {\r\n return {\r\n key: \"rows\",\r\n label: <span style={{fontWeight: 500}}>{i18n(\"Table - Rows Styling\")}</span>,\r\n extra: (\r\n <Button\r\n title={i18n(\"Revert configuration to predefined state\")} icon={<UndoIcon/>}\r\n key=\"revert\"\r\n style={REVERT_BUTTON_STYLE}\r\n danger\r\n ghost\r\n onClick={(e) => {\r\n e.stopPropagation();\r\n e.nativeEvent.stopImmediatePropagation();\r\n if (this.props.defaultRowStyleRules) {\r\n const rowStyleRules = cloneDeep(this.props.defaultRowStyleRules);\r\n if (this.props.onChangeRowStyleRules) {\r\n this.props.onChangeRowStyleRules(rowStyleRules);\r\n }\r\n }\r\n }}/>\r\n ),\r\n children: (\r\n <div>\r\n {this.props.rowStyleRules.map((rowStyleRule, index) => this.renderRowStyleRule(rowStyleRule, index))}\r\n </div>\r\n )\r\n };\r\n }\r\n\r\n /** Renders the {@link RowStylePicker} of the rule at `index` of `rowStyleRules`. */\r\n renderRowStyleRule(rowStyleRule: RowStyleRule, index: number) {\r\n return (\r\n <RowStylePicker key={\"row-style-picker-\" + index} rowStyleRule={rowStyleRule} onChange={(rowStyleRule) => {\r\n this.props.rowStyleRules[index] = rowStyleRule;\r\n if (this.props.onChangeRowStyleRules) {\r\n this.props.onChangeRowStyleRules(this.props.rowStyleRules);\r\n }\r\n }}/>\r\n );\r\n }\r\n}"]}
|
|
1
|
+
{"version":3,"file":"dataGridEditor.js","sour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CAAC,eAAe,EAAE,CAAC;oBACpB,CAAC,CAAC,WAAW,CAAC,wBAAwB,EAAE,CAAC;oBACzC,IAAI,IAAI,CAAC,KAAK,CAAC,oBAAoB,EAAE,CAAC;wBAClC,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;wBACjE,IAAI,IAAI,CAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC;4BACnC,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,aAAa,CAAC,CAAC;wBACpD,CAAC;oBACL,CAAC;gBACL,CAAC,GAAG,CACX;YACD,QAAQ,EAAE,CACN,iCACK,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,YAAY,EAAE,KAAK,CAAC,CAAC,CAClG,CACT;SACJ,CAAC;IACN,CAAC;IAED,oFAAoF;IACpF,kBAAkB,CAAC,YAA0B,EAAE,KAAa;QACxD,OAAO,CACH,oBAAC,cAAc,IAAC,GAAG,EAAE,mBAAmB,GAAG,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,YAAY,EAAE,EAAE;gBACrG,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC;gBAC/C,IAAI,IAAI,CAAC,KAAK,CAAC,qBAAqB,EAAE,CAAC;oBACnC,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;gBAC/D,CAAC;YACL,CAAC,GAAG,CACP,CAAC;IACN,CAAC;CACJ","sourcesContent":["import React from \"react\";\r\nimport {DownloadOutlined, SaveOutlined, SettingOutlined} from \"@ant-design/icons\";\r\nimport {Button, Collapse, CollapseProps, Drawer, InputNumber, notification, Select, Space, Switch} from 'antd';\r\nimport i18n from \"d2core/i18n/i18n\"\r\nimport {ResolvedUtcOffsetMode, UtcOffsetMode} from \"d2core/i18n/localeHolder\";\r\nimport ColumnTransfer, {ColumnTransferType} from \"./columnTransfer\";\r\nimport RowStylePicker from \"./rowStylePicker\";\r\nimport cloneDeep from \"lodash/cloneDeep\"\r\nimport {RowStyleRule} from \"d2coreui/components/grid/cell/tableDefaultRowStyleRules\";\r\nimport {ColDef, ColumnState, GridApi} from \"ag-grid-community\";\r\nimport {DataGridColDef} from \"../dataGrid\";\r\nimport {ModalDialog, ModalDialogMode} from \"d2coreui/components/modal/modalDialog\";\r\nimport {UndoIcon} from \"d2coreui/components/icons/undoIcon\";\r\nimport PlatformSpecific from \"d2coreui/components/platformSpecific\";\r\n\r\nconst REVERT_BUTTON_STYLE = {marginTop: -5};\r\n\r\n/** Properties of {@link DataGridEditor}. */\r\ninterface DataGridEditorProps {\r\n /** The owning `DataGrid`; its `changePagination`, `showMilliseconds`, `showYear` and `showUtcOffset` methods apply the general settings. */\r\n dataGrid: any\r\n /** API of the grid; column changes and the column revert are applied to it directly. */\r\n gridApi: GridApi\r\n /** Column definitions of the grid, listed in the columns section. */\r\n columnDefinitions: DataGridColDef[]\r\n /** Current column state of the grid, determines which columns are checked as visible. */\r\n columnModel: ColumnState[]\r\n\r\n /** Number of rows per page currently displayed; the fixed page size shown in the editor. Its value at mount is used when switching from automatic to fixed paging (20 if it is not greater than 1). */\r\n currentPageSize: number\r\n /** Configured page size: `-1` no paging, `0` automatic, a positive number fixed. */\r\n paginationPageSize: number\r\n /** Page size restored by the revert button of the general section; `0` (automatic) when not set. */\r\n paginationDefaultPageSize?: number\r\n /** Whether date-time columns show milliseconds. */\r\n showMilliseconds: boolean\r\n /** Value of `showMilliseconds` restored by the revert button. */\r\n defaultShowMilliseconds: boolean\r\n /** Whether date columns show the year. */\r\n showYear: boolean\r\n /** Value of `showYear` restored by the revert button. */\r\n defaultShowYear: boolean\r\n /** When date-time columns show the UTC offset. */\r\n showUtcOffset: ResolvedUtcOffsetMode\r\n /** Value of `showUtcOffset` restored by the revert button. */\r\n defaultShowUtcOffset: ResolvedUtcOffsetMode\r\n\r\n /** Row style rules restored (as a deep copy) by the revert button of the row styling section; without them the button does nothing. */\r\n defaultRowStyleRules?: RowStyleRule[]\r\n /** Row style rules edited in the row styling section, one {@link RowStylePicker} per rule. */\r\n rowStyleRules: RowStyleRule[]\r\n\r\n /** Called after a rule was edited, with the same `rowStyleRules` array modified in place, or with a copy of `defaultRowStyleRules` on revert. */\r\n onChangeRowStyleRules?(rowStyleRules: RowStyleRule[]): void\r\n\r\n /** Whether the drawer is open. */\r\n visible: boolean\r\n\r\n /** Called with `false` when the user closes the drawer. */\r\n onTableConfigVisible(visible: boolean): void\r\n}\r\n\r\ninterface DataGridEditorState {\r\n targetKeys: string[]\r\n initialPageSize: number\r\n windowName: string\r\n configurationChangesDisabled: boolean\r\n}\r\n\r\n// the configuration is stored, and older readers take any string as true\r\nfunction toConfigurationValue(mode: ResolvedUtcOffsetMode): UtcOffsetMode {\r\n if (mode === \"none\") {\r\n return false;\r\n }\r\n return mode === \"offset\" ? true : mode;\r\n}\r\n\r\n/**\r\n * Advanced settings drawer of `DataGrid`, opened from its settings menu. Its collapsible sections let the user\r\n * save, export or revert the window configuration (through {@link PlatformSpecific}), switch paging and date-time\r\n * formatting, show/hide columns (a {@link ColumnTransfer}) and edit the row style rules. Changes are applied immediately;\r\n * saving the window configuration is disabled when {@link PlatformSpecific} disallows configuration changes.\r\n */\r\nexport default class DataGridEditor extends React.Component<DataGridEditorProps, DataGridEditorState> {\r\n constructor(props: Readonly<DataGridEditorProps>) {\r\n super(props);\r\n this.state = {\r\n targetKeys: [],\r\n initialPageSize: props.currentPageSize,\r\n windowName: \"\",\r\n configurationChangesDisabled: PlatformSpecific.INSTANCE.configurationChangesDisabled()\r\n };\r\n this.onChange = this.onChange.bind(this);\r\n }\r\n\r\n componentDidMount() {\r\n this.setState({\r\n initialPageSize: this.props.currentPageSize,\r\n windowName: PlatformSpecific.INSTANCE.getCurrentWindowName()\r\n });\r\n }\r\n\r\n /** Stores the given keys in the component state; not used by the rendered UI. */\r\n onChange(targetKeys: string[]) {\r\n this.setState({targetKeys});\r\n };\r\n\r\n render() {\r\n return (\r\n <Drawer\r\n title={<div style={{width: \"100%\", paddingRight: 24}}>\r\n <SettingOutlined/> {i18n(\"Advanced Settings\")}\r\n </div>}\r\n placement=\"right\"\r\n closable={true}\r\n mask={true}\r\n width={340}\r\n onClose={() => {\r\n this.props.onTableConfigVisible(false);\r\n }}\r\n open={this.props.visible}\r\n style={{borderTop: \"1px solid #ddd\"}}\r\n styles={{\r\n body: {padding: 0},\r\n mask: {background: \"transparent\"}\r\n }}\r\n >\r\n <Collapse defaultActiveKey={[]}\r\n bordered={false}\r\n items={[\r\n this.getWindowSettingsPanel(),\r\n this.renderTableGeneralSettingsPanel(),\r\n this.renderTableColumnSettingsPanel(),\r\n this.props.rowStyleRules && this.renderRowsPanel(),\r\n ]} />\r\n </Drawer>\r\n );\r\n }\r\n\r\n /** Returns the window configuration section (save, export, revert to predefined or factory state). */\r\n getWindowSettingsPanel(): NonNullable<CollapseProps['items']>[number] {\r\n return {\r\n key: \"window-settings\",\r\n label: <span style={{fontWeight: 500}}>{i18n(\"Window\") + \" \\\"\" + this.state.windowName + \" \\\"\"}</span>,\r\n extra: (\r\n <Button\r\n title={i18n(\"Revert configuration to predefined state\")} icon={<UndoIcon/>} key=\"revert\"\r\n style={REVERT_BUTTON_STYLE}\r\n danger\r\n ghost\r\n onClick={(e) => {\r\n e.stopPropagation();\r\n e.nativeEvent.stopImmediatePropagation();\r\n PlatformSpecific.INSTANCE.reloadPageInPredefinedState();\r\n }}/>\r\n ),\r\n children: (\r\n <>\r\n <div style={{paddingRight: 16, paddingLeft: 16, paddingBottom: 8}}>\r\n <Button type=\"primary\" style={{width: \"100%\"}}\r\n disabled={this.state.configurationChangesDisabled}\r\n title={i18n(\"Save current window configuration for current user\")}\r\n onClick={() => {\r\n ModalDialog.confirm({\r\n mode: ModalDialogMode.YES_NO,\r\n title: <span\r\n style={{whiteSpace: \"nowrap\"}}>{i18n(\"Save Window Configuration\") + \"?\"}</span>,\r\n width: 400,\r\n onOk: () => {\r\n PlatformSpecific.INSTANCE.saveWindowConfiguration();\r\n notification['success']({\r\n message: i18n(\"Window configuration saved successfully\"),\r\n })\r\n },\r\n });\r\n\r\n }}>\r\n <SaveOutlined/>{i18n(\"Save Window Configuration\")}\r\n </Button>\r\n </div>\r\n <div style={{paddingRight: 16, paddingLeft: 16, paddingBottom: 8}}>\r\n <Button style={{width: \"100%\"}}\r\n title={i18n(\"Export current window configuration to file\")}\r\n onClick={() => {\r\n PlatformSpecific.INSTANCE.exportWindowConfiguration();\r\n }}>\r\n <DownloadOutlined/>{i18n(\"Export Window Configuration\")}\r\n </Button>\r\n </div>\r\n <div style={{paddingRight: 16, paddingLeft: 16, paddingBottom: 8}}>\r\n <Button danger ghost\r\n style={{width: \"100%\"}}\r\n onClick={() => {\r\n PlatformSpecific.INSTANCE.reloadPageInFactoryState();\r\n }}>\r\n <UndoIcon/>{i18n(\"Revert to factory configuration\")}\r\n </Button>\r\n </div>\r\n </>\r\n )\r\n };\r\n }\r\n\r\n /** Returns the general table section (paging, year, milliseconds and UTC offset in date-time values). */\r\n renderTableGeneralSettingsPanel(): NonNullable<CollapseProps['items']>[number] {\r\n const paginationEnabled = this.props.paginationPageSize >= 0;\r\n const automaticPagination = this.props.paginationPageSize === 0;\r\n return {\r\n key: \"general\",\r\n label: <span style={{fontWeight: 500}}>{i18n(\"Table - General Settings\")}</span>,\r\n extra: (\r\n <Button\r\n title={i18n(\"Revert configuration to predefined state\")} icon={<UndoIcon/>}\r\n key=\"revert\"\r\n style={REVERT_BUTTON_STYLE}\r\n danger\r\n ghost\r\n onClick={(e) => {\r\n e.stopPropagation();\r\n e.nativeEvent.stopImmediatePropagation();\r\n if (this.props.paginationDefaultPageSize !== undefined) {\r\n this.props.dataGrid.changePagination(this.props.paginationDefaultPageSize);\r\n } else {\r\n this.props.dataGrid.changePagination(0);\r\n }\r\n this.props.dataGrid.showMilliseconds(this.props.defaultShowMilliseconds);\r\n this.props.dataGrid.showYear(this.props.defaultShowYear);\r\n this.props.dataGrid.showUtcOffset(toConfigurationValue(this.props.defaultShowUtcOffset));\r\n }}/>\r\n ),\r\n children: (\r\n <Space direction=\"vertical\" style={{width: \"100%\"}}>\r\n <div style={{width: \"100%\"}}>\r\n <span>{i18n(\"Pagination\")}</span>\r\n <span style={{float: \"right\"}}>\r\n <Switch checkedChildren={i18n(\"Enabled\") + \" \"}\r\n unCheckedChildren={i18n(\" \" + i18n(\"Disabled\"))}\r\n checked={paginationEnabled}\r\n onChange={(checked) => {\r\n this.props.dataGrid.changePagination(checked ? 0 : -1);\r\n }}/>\r\n </span>\r\n </div>\r\n <div style={{width: \"100%\"}}>\r\n <span>{i18n(\"Page Size\")}</span>\r\n <span style={{float: \"right\"}}>\r\n <InputNumber\r\n size=\"small\"\r\n style={{\r\n width: 70,\r\n display: !paginationEnabled || automaticPagination ? \"none\" : \"\",\r\n marginLeft: 8\r\n }}\r\n placeholder=\"size\"\r\n className=\"custom\"\r\n value={this.props.currentPageSize}\r\n onChange={(pageSize) => {\r\n if (pageSize) {\r\n this.props.dataGrid.changePagination(pageSize);\r\n }\r\n }}\r\n />\r\n <Switch disabled={!paginationEnabled}\r\n style={{minWidth: 100}}\r\n checkedChildren={i18n(\"Automatic\") + \" \"}\r\n unCheckedChildren={i18n(\" \" + i18n(\"Fixed\"))}\r\n checked={!paginationEnabled || automaticPagination}\r\n onChange={(checked) => {\r\n this.props.dataGrid.changePagination(checked ? 0 : (this.state.initialPageSize > 1 ? this.state.initialPageSize : 20));\r\n }}/>\r\n </span>\r\n </div>\r\n <div style={{width: \"100%\"}}>\r\n <span>{i18n(\"Show time with year\")}</span>\r\n <span style={{float: \"right\"}}>\r\n <Switch checkedChildren={i18n(\"Yes\") + \" \"}\r\n unCheckedChildren={i18n(\" \" + i18n(\"No\"))}\r\n checked={this.props.showYear}\r\n onChange={(checked) => {\r\n this.props.dataGrid.showYear(checked);\r\n }}/>\r\n </span>\r\n </div>\r\n <div style={{width: \"100%\"}}>\r\n <span>{i18n(\"Show time with milliseconds\")}</span>\r\n <span style={{float: \"right\"}}>\r\n <Switch checkedChildren={i18n(\"Yes\") + \" \"}\r\n unCheckedChildren={i18n(\" \" + i18n(\"No\"))}\r\n checked={this.props.showMilliseconds}\r\n onChange={(checked) => {\r\n this.props.dataGrid.showMilliseconds(checked);\r\n }}/>\r\n </span>\r\n </div>\r\n <div style={{width: \"100%\"}}>\r\n <span>{i18n(\"Show time with time zone\")}</span>\r\n <span style={{float: \"right\"}}>\r\n <Select size=\"small\"\r\n popupMatchSelectWidth={false}\r\n value={this.props.showUtcOffset}\r\n options={[\r\n {value: \"none\", label: i18n(\"No\")},\r\n {value: \"hourLetter\", label: i18n(\"A2:00 / B2:00 at the change to winter time\")},\r\n {value: \"offset\", label: i18n(\"Yes\")},\r\n {value: \"offsetInFold\", label: i18n(\"Only at the change to winter time\")},\r\n ]}\r\n onChange={(value: ResolvedUtcOffsetMode) => {\r\n this.props.dataGrid.showUtcOffset(toConfigurationValue(value));\r\n }}/>\r\n </span>\r\n </div>\r\n </Space>\r\n )\r\n };\r\n }\r\n\r\n /** Returns the column visibility section; its revert button resets the ag-grid column state. */\r\n renderTableColumnSettingsPanel(): NonNullable<CollapseProps['items']>[number] {\r\n return {\r\n key: \"columns\",\r\n label: <span style={{fontWeight: 500}}>{i18n(\"Table - Columns\")}</span>,\r\n extra: (\r\n <Button\r\n title={i18n(\"Revert configuration to predefined state\")} icon={<UndoIcon/>}\r\n key=\"revert\"\r\n style={REVERT_BUTTON_STYLE}\r\n danger\r\n ghost\r\n onClick={(e) => {\r\n e.stopPropagation();\r\n e.nativeEvent.stopImmediatePropagation();\r\n this.props.gridApi.resetColumnState();\r\n }}/>\r\n ),\r\n children: (\r\n <ColumnTransfer\r\n columnDefinitions={this.props.columnDefinitions as ColDef[]}\r\n columnModel={this.props.columnModel}\r\n type={ColumnTransferType.SIMPLE}\r\n gridApi={this.props.gridApi}\r\n />\r\n )\r\n };\r\n }\r\n\r\n /** Returns the row styling section. */\r\n renderRowsPanel(): NonNullable<CollapseProps['items']>[number] {\r\n return {\r\n key: \"rows\",\r\n label: <span style={{fontWeight: 500}}>{i18n(\"Table - Rows Styling\")}</span>,\r\n extra: (\r\n <Button\r\n title={i18n(\"Revert configuration to predefined state\")} icon={<UndoIcon/>}\r\n key=\"revert\"\r\n style={REVERT_BUTTON_STYLE}\r\n danger\r\n ghost\r\n onClick={(e) => {\r\n e.stopPropagation();\r\n e.nativeEvent.stopImmediatePropagation();\r\n if (this.props.defaultRowStyleRules) {\r\n const rowStyleRules = cloneDeep(this.props.defaultRowStyleRules);\r\n if (this.props.onChangeRowStyleRules) {\r\n this.props.onChangeRowStyleRules(rowStyleRules);\r\n }\r\n }\r\n }}/>\r\n ),\r\n children: (\r\n <div>\r\n {this.props.rowStyleRules.map((rowStyleRule, index) => this.renderRowStyleRule(rowStyleRule, index))}\r\n </div>\r\n )\r\n };\r\n }\r\n\r\n /** Renders the {@link RowStylePicker} of the rule at `index` of `rowStyleRules`. */\r\n renderRowStyleRule(rowStyleRule: RowStyleRule, index: number) {\r\n return (\r\n <RowStylePicker key={\"row-style-picker-\" + index} rowStyleRule={rowStyleRule} onChange={(rowStyleRule) => {\r\n this.props.rowStyleRules[index] = rowStyleRule;\r\n if (this.props.onChangeRowStyleRules) {\r\n this.props.onChangeRowStyleRules(this.props.rowStyleRules);\r\n }\r\n }}/>\r\n );\r\n }\r\n}"]}
|
|
@@ -4,9 +4,19 @@ import { AgGridReact } from "ag-grid-react";
|
|
|
4
4
|
import 'd2coreui/style/ag-grid/aggrid-adaptations.css';
|
|
5
5
|
import { ContextMenuProps, PageOrientation } from "d2coreui/components/grid/export/contextMenu";
|
|
6
6
|
import { CellClassParams, CellFocusedEvent, CellMouseDownEvent, CellMouseOverEvent, ColDef, ColTypeDef, ColGroupDef, Column, ColumnEvent, NewColumnsLoadedEvent, ColumnState, FilterChangedEvent, FilterModifiedEvent, GridApi, GridOptions, GridReadyEvent, IRowNode, PaginationChangedEvent, RowClassParams, RowPinnedType, RowStyle, ViewportChangedEvent } from "ag-grid-community";
|
|
7
|
+
import { UtcOffsetMode } from "d2core/i18n/localeHolder";
|
|
7
8
|
import { GridRowStyle, RowStyleRule } from "d2coreui/components/grid/cell/tableDefaultRowStyleRules";
|
|
8
9
|
import ProgressPopup from "d2coreui/components/grid/export/progressPopup";
|
|
9
10
|
import WildcardQuickFilterEngine from "./filter/wildcardQuickFilterEngine";
|
|
11
|
+
declare module "antd/es/theme/interface/alias" {
|
|
12
|
+
interface AliasToken {
|
|
13
|
+
/**
|
|
14
|
+
* Background of the odd rows of `DataGrid` / `ExtendedDataGrid` with the default theme, set through
|
|
15
|
+
* `ConfigProvider` `theme.token`. Unset, odd rows have `colorBgContainer` like the even ones (no striping).
|
|
16
|
+
*/
|
|
17
|
+
gridOddRowBg?: string;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
10
20
|
/**
|
|
11
21
|
* Separator for joining several parts into one cell value (e.g. name and status).
|
|
12
22
|
* When a string cell value contains it (after the first character), clipboard copy of several rows and export
|
|
@@ -58,6 +68,7 @@ export type FilterRenderer = (value: string, changeValue: (newValue: string) =>
|
|
|
58
68
|
* resizable, uses the built-in `simpleHeader` header component (column menu with pin/autosize/hide/reset/columns
|
|
59
69
|
* configuration), enables the floating filter only when the column (or one of its `type`s) defines one and the column
|
|
60
70
|
* search is visible, and takes `hide` from the current column state when the column is already known.
|
|
71
|
+
* ag-grid's `lockVisible` is honoured by the grid's own column menu and columns configuration dialog.
|
|
61
72
|
*
|
|
62
73
|
* Besides ag-grid's own, these values can be used in `type`: `numberColumn` (localized number, fraction digits from
|
|
63
74
|
* `cellRendererParams.fractionDigits`), `dateColumn`, `dateTimeColumn`, `fromNowDateTimeColumn` (D2000 unix time values,
|
|
@@ -282,15 +293,19 @@ export interface DataGridProps<TData = any> extends Omit<GridOptions<TData>, "co
|
|
|
282
293
|
* `hideYear`. Update `hideYear` and then call `callback` so the grid re-renders its rows.
|
|
283
294
|
*/
|
|
284
295
|
onShowYear?(show: boolean, callback: () => void): void;
|
|
285
|
-
/**
|
|
286
|
-
|
|
296
|
+
/**
|
|
297
|
+
* How date-time columns tell apart the instants of the hour repeated at the end of the daylight saving time - see
|
|
298
|
+
* `UtcOffsetMode` of `d2core/i18n/localeHolder`; without it the global mode of `LocaleHolder.setUtcOffsetMode`
|
|
299
|
+
* applies (controlled, see {@link DataGridProps.onShowUtcOffset}).
|
|
300
|
+
*/
|
|
301
|
+
showUtcOffset?: UtcOffsetMode;
|
|
287
302
|
/** Value of `showUtcOffset` restored when the table configuration is reset to defaults. */
|
|
288
|
-
defaultShowUtcOffset?:
|
|
303
|
+
defaultShowUtcOffset?: UtcOffsetMode;
|
|
289
304
|
/**
|
|
290
305
|
* Called when the user toggles the UTC offset in the table configuration panel. Update `showUtcOffset` and then
|
|
291
306
|
* call `callback` so the grid re-renders its rows.
|
|
292
307
|
*/
|
|
293
|
-
onShowUtcOffset?(show:
|
|
308
|
+
onShowUtcOffset?(show: UtcOffsetMode, callback: () => void): void;
|
|
294
309
|
/** Toolbar export menu customization; the built-in items export all displayed rows to TXT, CSV, PDF or the clipboard. */
|
|
295
310
|
exportMenu?: {
|
|
296
311
|
/** Transforms the default menu items, e.g. to add or remove entries. */
|
|
@@ -480,7 +495,7 @@ export default class DataGrid<TData extends {
|
|
|
480
495
|
/** Requests showing/hiding the year via `props.onShowYear` and redraws the rows once the parent calls back. */
|
|
481
496
|
showYear(showYear: boolean): void;
|
|
482
497
|
/** Requests showing/hiding the UTC offset via `props.onShowUtcOffset` and redraws the rows once the parent calls back. */
|
|
483
|
-
showUtcOffset(showUtcOffset:
|
|
498
|
+
showUtcOffset(showUtcOffset: UtcOffsetMode): void;
|
|
484
499
|
/**
|
|
485
500
|
* Applies a new row height (and header/floating filter height derived from `fontSize`, unless given in props),
|
|
486
501
|
* redraws the grid (reloading an infinite datasource) and calls `props.onRowHeightChanged`.
|
|
@@ -1217,10 +1217,11 @@ class DataGrid extends React.Component {
|
|
|
1217
1217
|
const tableContent = [];
|
|
1218
1218
|
const convert = (data) => data.map((row) => row.join('\t')).join('\r\n');
|
|
1219
1219
|
const columns = this.gridApi.getAllDisplayedColumns().map((column) => {
|
|
1220
|
+
var _a, _b;
|
|
1220
1221
|
const columnTypes = column.getColDef().type;
|
|
1221
1222
|
return {
|
|
1222
1223
|
column: column,
|
|
1223
|
-
displayName: column.getColDef().headerName,
|
|
1224
|
+
displayName: (_b = (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getDisplayNameForColumn(column, null)) !== null && _b !== void 0 ? _b : column.getColDef().headerName,
|
|
1224
1225
|
isDateField: columnTypes && columnTypes.indexOf("dateColumn") >= 0,
|
|
1225
1226
|
isDateTimeField: columnTypes && columnTypes.indexOf("dateTimeColumn") >= 0
|
|
1226
1227
|
};
|
|
@@ -1308,10 +1309,11 @@ class DataGrid extends React.Component {
|
|
|
1308
1309
|
}
|
|
1309
1310
|
const tableContent = [];
|
|
1310
1311
|
const columns = this.gridApi.getAllDisplayedColumns().map((column) => {
|
|
1312
|
+
var _a, _b;
|
|
1311
1313
|
const columnTypes = column.getColDef().type;
|
|
1312
1314
|
return {
|
|
1313
1315
|
column: column,
|
|
1314
|
-
displayName: column.getColDef().headerName,
|
|
1316
|
+
displayName: (_b = (_a = this.gridApi) === null || _a === void 0 ? void 0 : _a.getDisplayNameForColumn(column, null)) !== null && _b !== void 0 ? _b : column.getColDef().headerName,
|
|
1315
1317
|
isDateField: columnTypes && columnTypes.indexOf("dateColumn") >= 0,
|
|
1316
1318
|
isDateTimeField: columnTypes && columnTypes.indexOf("dateTimeColumn") >= 0
|
|
1317
1319
|
};
|
|
@@ -1581,7 +1583,8 @@ class DataGrid extends React.Component {
|
|
|
1581
1583
|
style.color = `rgba(${style.color.r},${style.color.g},${style.color.b},${style.color.a})`;
|
|
1582
1584
|
}
|
|
1583
1585
|
if (!style.backgroundColor) {
|
|
1584
|
-
|
|
1586
|
+
// "" removes a stale inline color (ag-grid skips null) without overriding the theme's odd-row background
|
|
1587
|
+
style.backgroundColor = "";
|
|
1585
1588
|
}
|
|
1586
1589
|
else if (typeof style.backgroundColor === "object") {
|
|
1587
1590
|
style.backgroundColor = `rgba(${style.backgroundColor.r},${style.backgroundColor.g},${style.backgroundColor.b},${style.backgroundColor.a})`;
|
|
@@ -1692,7 +1695,7 @@ class DataGrid extends React.Component {
|
|
|
1692
1695
|
React.createElement(Dropdown, { trigger: ["click"], menu: getContextMenu({
|
|
1693
1696
|
showMilliseconds: !!this.props.showMilliseconds,
|
|
1694
1697
|
showYear: !this.props.hideYear,
|
|
1695
|
-
showUtcOffset:
|
|
1698
|
+
showUtcOffset: LocaleHolder.resolveUtcOffsetMode(this.props.showUtcOffset),
|
|
1696
1699
|
renderer: (_b = this.props.exportMenu) === null || _b === void 0 ? void 0 : _b.renderer,
|
|
1697
1700
|
onClick: (_c = this.props.exportMenu) === null || _c === void 0 ? void 0 : _c.onClick,
|
|
1698
1701
|
onExported: (_d = this.props.exportMenu) === null || _d === void 0 ? void 0 : _d.onExported,
|
|
@@ -1834,7 +1837,7 @@ class DataGrid extends React.Component {
|
|
|
1834
1837
|
}
|
|
1835
1838
|
;
|
|
1836
1839
|
render() {
|
|
1837
|
-
const _a = this.props, { onGridReady, columnDefs, disableColumnDefsPreprocessing, onColumnsChanged, paging, onPaginationChanged, onViewportChanged, selectedIds, search, toolbar, filter, onFilterChanged, onFilterModified, onCellFocused, onSortChanged, components, tableConfigVisible, onTableConfigVisible, noRecordsOverlayRenderer, loadingOverlayRenderer, onRowDataUpdated, rowStyleRules, onChangeRowStyleRules, defaultShowMilliseconds, onShowMilliseconds, defaultHideYear, onShowYear, suppressLoadingOverlay, defaultColDef, headerHeight, rowData, rowDataManualMode, gridRef, quickFilterParser, quickFilterMatcher, rowSelection, contextMenu, settingsMenu, exportMenu, panelStyle, tablePanelStyle, onColumnDefsAdapted, tableOverlayRenderer, onKeyPressed, theme } = _a, passedProperties = __rest(_a, ["onGridReady", "columnDefs", "disableColumnDefsPreprocessing", "onColumnsChanged", "paging", "onPaginationChanged", "onViewportChanged", "selectedIds", "search", "toolbar", "filter", "onFilterChanged", "onFilterModified", "onCellFocused", "onSortChanged", "components", "tableConfigVisible", "onTableConfigVisible", "noRecordsOverlayRenderer", "loadingOverlayRenderer", "onRowDataUpdated", "rowStyleRules", "onChangeRowStyleRules", "defaultShowMilliseconds", "onShowMilliseconds", "defaultHideYear", "onShowYear", "suppressLoadingOverlay", "defaultColDef", "headerHeight", "rowData", "rowDataManualMode", "gridRef", "quickFilterParser", "quickFilterMatcher", "rowSelection", "contextMenu", "settingsMenu", "exportMenu", "panelStyle", "tablePanelStyle", "onColumnDefsAdapted", "tableOverlayRenderer", "onKeyPressed", "theme"]);
|
|
1840
|
+
const _a = this.props, { onGridReady, columnDefs, disableColumnDefsPreprocessing, onColumnsChanged, paging, onPaginationChanged, onViewportChanged, selectedIds, search, toolbar, filter, onFilterChanged, onFilterModified, onCellFocused, onSortChanged, components, tableConfigVisible, onTableConfigVisible, noRecordsOverlayRenderer, loadingOverlayRenderer, onRowDataUpdated, onLoadData, rowStyleRules, defaultRowStyleRules, onChangeRowStyleRules, showMilliseconds, defaultShowMilliseconds, onShowMilliseconds, hideYear, defaultHideYear, onShowYear, showUtcOffset, defaultShowUtcOffset, onShowUtcOffset, suppressLoadingOverlay, defaultColDef, headerHeight, rowData, rowDataManualMode, gridRef, quickFilterParser, quickFilterMatcher, rowSelection, contextMenu, settingsMenu, exportMenu, panelStyle, tablePanelStyle, onColumnDefsAdapted, tableOverlayRenderer, onKeyPressed, theme } = _a, passedProperties = __rest(_a, ["onGridReady", "columnDefs", "disableColumnDefsPreprocessing", "onColumnsChanged", "paging", "onPaginationChanged", "onViewportChanged", "selectedIds", "search", "toolbar", "filter", "onFilterChanged", "onFilterModified", "onCellFocused", "onSortChanged", "components", "tableConfigVisible", "onTableConfigVisible", "noRecordsOverlayRenderer", "loadingOverlayRenderer", "onRowDataUpdated", "onLoadData", "rowStyleRules", "defaultRowStyleRules", "onChangeRowStyleRules", "showMilliseconds", "defaultShowMilliseconds", "onShowMilliseconds", "hideYear", "defaultHideYear", "onShowYear", "showUtcOffset", "defaultShowUtcOffset", "onShowUtcOffset", "suppressLoadingOverlay", "defaultColDef", "headerHeight", "rowData", "rowDataManualMode", "gridRef", "quickFilterParser", "quickFilterMatcher", "rowSelection", "contextMenu", "settingsMenu", "exportMenu", "panelStyle", "tablePanelStyle", "onColumnDefsAdapted", "tableOverlayRenderer", "onKeyPressed", "theme"]);
|
|
1838
1841
|
let key;
|
|
1839
1842
|
let paginationPageSize = undefined;
|
|
1840
1843
|
if (paging.pageSize > 0) {
|
|
@@ -1889,7 +1892,7 @@ class DataGrid extends React.Component {
|
|
|
1889
1892
|
onlySelectedNodes: true,
|
|
1890
1893
|
showMilliseconds: !!this.props.showMilliseconds,
|
|
1891
1894
|
showYear: !this.props.hideYear,
|
|
1892
|
-
showUtcOffset:
|
|
1895
|
+
showUtcOffset: LocaleHolder.resolveUtcOffsetMode(this.props.showUtcOffset),
|
|
1893
1896
|
renderer: (_a = this.props.contextMenu) === null || _a === void 0 ? void 0 : _a.renderer,
|
|
1894
1897
|
onClick: (_b = this.props.contextMenu) === null || _b === void 0 ? void 0 : _b.onClick,
|
|
1895
1898
|
getExportContent: this.getExportContent,
|
|
@@ -1917,7 +1920,7 @@ class DataGrid extends React.Component {
|
|
|
1917
1920
|
}), tableOverlayRenderer === null || tableOverlayRenderer === void 0 ? void 0 :
|
|
1918
1921
|
tableOverlayRenderer())),
|
|
1919
1922
|
!!this.gridApi && !!this.gridApi && this.state.pageSize !== null &&
|
|
1920
|
-
React.createElement(DataGridEditor, { dataGrid: this, gridApi: this.gridApi, columnDefinitions: leafColumnDefs, columnModel: this.state.columnModel, visible: !!this.props.tableConfigVisible, onTableConfigVisible: this.showTableConfiguration, paginationPageSize: paging.pageSize, paginationDefaultPageSize: paging.defaultPageSize, currentPageSize: this.state.pageSize, showMilliseconds: !!this.props.showMilliseconds, defaultShowMilliseconds: !!this.props.defaultShowMilliseconds, showYear: !this.props.hideYear, defaultShowYear: !this.props.defaultHideYear, showUtcOffset:
|
|
1923
|
+
React.createElement(DataGridEditor, { dataGrid: this, gridApi: this.gridApi, columnDefinitions: leafColumnDefs, columnModel: this.state.columnModel, visible: !!this.props.tableConfigVisible, onTableConfigVisible: this.showTableConfiguration, paginationPageSize: paging.pageSize, paginationDefaultPageSize: paging.defaultPageSize, currentPageSize: this.state.pageSize, showMilliseconds: !!this.props.showMilliseconds, defaultShowMilliseconds: !!this.props.defaultShowMilliseconds, showYear: !this.props.hideYear, defaultShowYear: !this.props.defaultHideYear, showUtcOffset: LocaleHolder.resolveUtcOffsetMode(this.props.showUtcOffset), defaultShowUtcOffset: LocaleHolder.resolveUtcOffsetMode(this.props.defaultShowUtcOffset), rowStyleRules: this.props.rowStyleRules, defaultRowStyleRules: this.props.defaultRowStyleRules, onChangeRowStyleRules: onChangeRowStyleRules }),
|
|
1921
1924
|
!!this.gridApi && React.createElement(ModalDialog, { mode: "OK_CANCEL" /* ModalDialogMode.OK_CANCEL */, open: this.state.columnsConfigVisible, initialWidth: 700, initialHeight: this.state.columnTransferHeight, title: React.createElement("span", null,
|
|
1922
1925
|
React.createElement(ControlOutlined, { style: {
|
|
1923
1926
|
color: "#faad14",
|
|
@@ -1950,11 +1953,13 @@ DataGrid.defaultProps = {
|
|
|
1950
1953
|
DataGrid.EMPTY_STYLE = {};
|
|
1951
1954
|
export default DataGrid;
|
|
1952
1955
|
function getAgGridThemeFromAntd(algorithm, token) {
|
|
1956
|
+
var _a;
|
|
1953
1957
|
const isDark = algorithm === theme.darkAlgorithm;
|
|
1954
1958
|
let agTheme = isDark ? themeBalham.withPart(colorSchemeDark) : themeBalham;
|
|
1955
1959
|
return agTheme.withParams({
|
|
1956
1960
|
accentColor: token.colorPrimary,
|
|
1957
1961
|
backgroundColor: token.colorBgContainer,
|
|
1962
|
+
oddRowBackgroundColor: (_a = token.gridOddRowBg) !== null && _a !== void 0 ? _a : token.colorBgContainer,
|
|
1958
1963
|
foregroundColor: token.colorText,
|
|
1959
1964
|
selectedRowBackgroundColor: token.controlItemBgActive,
|
|
1960
1965
|
rowHoverColor: token.controlItemBgHover,
|
|
@@ -1971,6 +1976,7 @@ function agThemeEquals(newArgs, lastArgs) {
|
|
|
1971
1976
|
// Only compare the tokens you actually use in your function
|
|
1972
1977
|
return (newToken.colorPrimary === lastToken.colorPrimary &&
|
|
1973
1978
|
newToken.colorBgContainer === lastToken.colorBgContainer &&
|
|
1979
|
+
newToken.gridOddRowBg === lastToken.gridOddRowBg &&
|
|
1974
1980
|
newToken.colorText === lastToken.colorText &&
|
|
1975
1981
|
newToken.controlItemBgActive === lastToken.controlItemBgActive &&
|
|
1976
1982
|
newToken.controlItemBgHover === lastToken.controlItemBgHover &&
|