@tiny-design/react 1.0.4 → 1.0.9
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/LICENSE +21 -0
- package/README.md +107 -0
- package/es/alert/style/_index.scss +0 -0
- package/es/alert/style/_mixin.scss +0 -0
- package/es/avatar/style/_index.scss +0 -0
- package/es/back-top/style/_index.scss +0 -0
- package/es/badge/style/_index.scss +0 -0
- package/es/breadcrumb/style/_index.scss +0 -0
- package/es/button/style/_index.scss +0 -0
- package/es/button/style/_mixin.scss +0 -0
- package/es/button/style/index.css +1 -1
- package/es/carousel/style/_index.scss +0 -0
- package/es/checkbox/style/_index.scss +0 -0
- package/es/collapse/style/_index.scss +0 -0
- package/es/date-picker/style/_index.scss +0 -0
- package/es/divider/style/_index.scss +0 -0
- package/es/empty/style/_index.scss +0 -0
- package/es/flip/style/_index.scss +0 -0
- package/es/form/style/_index.scss +0 -0
- package/es/grid/style/_index.scss +0 -0
- package/es/index.d.ts +2 -2
- package/es/index.js +2 -2
- package/es/input/style/_index.scss +0 -0
- package/es/input/style/_mixin.scss +0 -0
- package/es/input-number/style/_index.scss +0 -0
- package/es/input-password/style/_index.scss +0 -0
- package/es/layout/sidebar.js +2 -5
- package/es/layout/sidebar.js.map +1 -1
- package/es/layout/style/_index.scss +0 -0
- package/es/list/list.js.map +1 -1
- package/es/loader/style/_index.scss +0 -0
- package/es/loading-bar/style/_index.scss +0 -0
- package/es/message/style/_index.scss +0 -0
- package/es/modal/style/_index.scss +0 -0
- package/es/native-select/style/_index.scss +0 -0
- package/es/notification/style/_index.scss +0 -0
- package/es/overlay/style/_index.scss +0 -0
- package/es/pop-confirm/style/_index.scss +0 -0
- package/es/popover/style/_index.scss +0 -0
- package/es/popup/style/_index.scss +0 -0
- package/es/progress/style/_index.scss +0 -0
- package/es/radio/style/_index.scss +0 -0
- package/es/rate/rate.js +2 -5
- package/es/rate/rate.js.map +1 -1
- package/es/rate/style/_index.scss +0 -0
- package/es/split/style/_index.scss +0 -0
- package/es/style/_component.scss +1 -1
- package/es/style/base.css +12 -3
- package/es/style/index.scss +0 -0
- package/es/switch/style/_index.scss +0 -0
- package/es/switch/style/_mixin.scss +0 -0
- package/es/switch/style/index.css +3 -3
- package/es/table/table.js.map +1 -1
- package/es/tag/style/_index.scss +0 -0
- package/es/textarea/style/_index.scss +0 -0
- package/es/time-picker/style/_index.scss +0 -0
- package/es/timeline/style/_index.scss +0 -0
- package/es/tooltip/style/_index.scss +0 -0
- package/es/typography/style/_index.scss +0 -0
- package/es/with-spin/index.d.ts +1 -0
- package/es/with-spin/style/_index.scss +5 -0
- package/es/with-spin/style/index.css +3 -0
- package/es/with-spin/with-spin.d.ts +9 -0
- package/es/with-spin/with-spin.js +20 -0
- package/es/with-spin/with-spin.js.map +1 -0
- package/lib/alert/style/_index.scss +0 -0
- package/lib/alert/style/_mixin.scss +0 -0
- package/lib/avatar/style/_index.scss +0 -0
- package/lib/back-top/style/_index.scss +0 -0
- package/lib/badge/style/_index.scss +0 -0
- package/lib/breadcrumb/style/_index.scss +0 -0
- package/lib/button/style/_index.scss +0 -0
- package/lib/button/style/_mixin.scss +0 -0
- package/lib/button/style/index.css +1 -1
- package/lib/carousel/style/_index.scss +0 -0
- package/lib/checkbox/style/_index.scss +0 -0
- package/lib/collapse/style/_index.scss +0 -0
- package/lib/date-picker/style/_index.scss +0 -0
- package/lib/divider/style/_index.scss +0 -0
- package/lib/empty/style/_index.scss +0 -0
- package/lib/flip/style/_index.scss +0 -0
- package/lib/form/style/_index.scss +0 -0
- package/lib/grid/style/_index.scss +0 -0
- package/lib/index.d.ts +2 -2
- package/lib/index.js +96 -96
- package/lib/input/style/_index.scss +0 -0
- package/lib/input/style/_mixin.scss +0 -0
- package/lib/input-number/style/_index.scss +0 -0
- package/lib/input-password/style/_index.scss +0 -0
- package/lib/layout/sidebar.js +2 -5
- package/lib/layout/sidebar.js.map +1 -1
- package/lib/layout/style/_index.scss +0 -0
- package/lib/list/list.js.map +1 -1
- package/lib/loader/style/_index.scss +0 -0
- package/lib/loading-bar/style/_index.scss +0 -0
- package/lib/message/style/_index.scss +0 -0
- package/lib/modal/style/_index.scss +0 -0
- package/lib/native-select/style/_index.scss +0 -0
- package/lib/notification/style/_index.scss +0 -0
- package/lib/overlay/style/_index.scss +0 -0
- package/lib/pop-confirm/style/_index.scss +0 -0
- package/lib/popover/style/_index.scss +0 -0
- package/lib/popup/style/_index.scss +0 -0
- package/lib/progress/style/_index.scss +0 -0
- package/lib/radio/style/_index.scss +0 -0
- package/lib/rate/rate.js +2 -5
- package/lib/rate/rate.js.map +1 -1
- package/lib/rate/style/_index.scss +0 -0
- package/lib/split/style/_index.scss +0 -0
- package/lib/style/_component.scss +1 -1
- package/lib/style/base.css +12 -3
- package/lib/style/index.scss +0 -0
- package/lib/switch/style/_index.scss +0 -0
- package/lib/switch/style/_mixin.scss +0 -0
- package/lib/switch/style/index.css +3 -3
- package/lib/table/table.js.map +1 -1
- package/lib/tag/style/_index.scss +0 -0
- package/lib/textarea/style/_index.scss +0 -0
- package/lib/time-picker/style/_index.scss +0 -0
- package/lib/timeline/style/_index.scss +0 -0
- package/lib/tooltip/style/_index.scss +0 -0
- package/lib/typography/style/_index.scss +0 -0
- package/lib/with-spin/style/_index.scss +5 -0
- package/lib/with-spin/style/index.css +3 -0
- package/lib/with-spin/with-spin.d.ts +9 -0
- package/lib/with-spin/with-spin.js +22 -0
- package/lib/with-spin/with-spin.js.map +1 -0
- package/package.json +19 -15
- package/es/icon/icon.d.ts +0 -8
- package/es/icon/icon.js +0 -25
- package/es/icon/icon.js.map +0 -1
- package/es/icon/index.d.ts +0 -1
- package/es/icon/index.js +0 -9
- package/es/icon/index.js.map +0 -1
- package/es/icon/style/_index.scss +0 -16
- package/es/icon/style/index.css +0 -987
- package/es/icon/types.d.ts +0 -15
- package/lib/icon/icon.d.ts +0 -8
- package/lib/icon/icon.js +0 -28
- package/lib/icon/icon.js.map +0 -1
- package/lib/icon/index.js +0 -8
- package/lib/icon/index.js.map +0 -1
- package/lib/icon/style/_index.scss +0 -16
- package/lib/icon/style/index.css +0 -987
- package/lib/icon/types.d.ts +0 -15
- /package/es/{icon → with-spin}/style/index.d.ts +0 -0
- /package/es/{icon → with-spin}/style/index.js +0 -0
- /package/lib/{icon → with-spin}/style/index.d.ts +0 -0
- /package/lib/{icon → with-spin}/style/index.js +0 -0
package/es/table/table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","names":["Pagination"],"sources":["../../src/table/table.tsx"],"sourcesContent":["import React, { useState, useEffect, useContext, useMemo } from 'react';\nimport classNames from 'classnames';\nimport { ConfigContext } from '../config-provider/config-context';\nimport { getPrefixCls } from '../_utils/general';\nimport { useVirtualScroll } from '../_utils/use-virtual-scroll';\nimport Pagination from '../pagination';\nimport { TableProps, ColumnType, SortOrder } from './types';\n\nconst ROW_HEIGHT_MAP = { sm: 40, md: 48, lg: 56 } as const;\n\nconst getRowKey = <T,>(record: T, rowKey: string | ((record: T) => React.Key), index: number): React.Key => {\n if (typeof rowKey === 'function') return rowKey(record);\n const key = (record as any)[rowKey];\n return key !== undefined ? key : index;\n};\n\nconst getValue = <T,>(record: T, dataIndex: string): any => {\n return (record as any)[dataIndex];\n};\n\nconst Table = React.forwardRef<HTMLDivElement, TableProps>((props, ref) => {\n const {\n columns,\n dataSource = [],\n rowKey = 'key',\n loading = false,\n bordered = false,\n size,\n scroll,\n virtual = false,\n height,\n itemHeight: itemHeightProp,\n rowSelection,\n pagination,\n onChange,\n emptyText = 'No Data',\n showHeader = true,\n rowClassName,\n onRow,\n prefixCls: customisedCls,\n className,\n style,\n ...otherProps\n } = props;\n\n const configContext = useContext(ConfigContext);\n const prefixCls = getPrefixCls('table', configContext.prefixCls, customisedCls);\n const tableSize = size || configContext.componentSize || 'md';\n\n if (virtual && height == null) {\n console.warn('[tiny-ui: Table] `height` is required when `virtual` is enabled.');\n }\n\n const isVirtual = virtual && height != null;\n\n // Sorting\n const [sortField, setSortField] = useState<string | undefined>();\n const [sortOrder, setSortOrder] = useState<SortOrder>(null);\n\n // Pagination\n const [currentPage, setCurrentPage] = useState(1);\n const pageSize = pagination && pagination.pageSize ? pagination.pageSize : 10;\n\n // Selection\n const [selectedKeys, setSelectedKeys] = useState<React.Key[]>(\n rowSelection?.selectedRowKeys ?? []\n );\n\n useEffect(() => {\n if (rowSelection?.selectedRowKeys) {\n setSelectedKeys(rowSelection.selectedRowKeys);\n }\n }, [rowSelection?.selectedRowKeys]);\n\n // Initialize default sort\n useEffect(() => {\n for (const col of columns) {\n if (col.defaultSortOrder) {\n setSortField(col.dataIndex);\n setSortOrder(col.defaultSortOrder);\n break;\n }\n }\n }, []);\n\n const sortedData = useMemo(() => {\n if (!sortField || !sortOrder) return [...dataSource];\n const col = columns.find((c) => c.dataIndex === sortField);\n if (!col?.sorter) return [...dataSource];\n const sorted = [...dataSource];\n const sorterFn =\n typeof col.sorter === 'function'\n ? col.sorter\n : (a: any, b: any) => {\n const va = getValue(a, sortField);\n const vb = getValue(b, sortField);\n if (va < vb) return -1;\n if (va > vb) return 1;\n return 0;\n };\n sorted.sort((a, b) => {\n const result = sorterFn(a, b);\n return sortOrder === 'descend' ? -result : result;\n });\n return sorted;\n }, [dataSource, sortField, sortOrder, columns]);\n\n const rowHeight = itemHeightProp ?? ROW_HEIGHT_MAP[tableSize] ?? ROW_HEIGHT_MAP.md;\n const { visibleRange, totalHeight, offsetY, onScroll } = useVirtualScroll({\n itemCount: sortedData.length,\n itemHeight: rowHeight,\n containerHeight: height ?? 0,\n });\n\n const paginatedData = useMemo(() => {\n if (isVirtual) return sortedData;\n if (pagination === false) return sortedData;\n const page = pagination?.current ?? currentPage;\n const start = (page - 1) * pageSize;\n return sortedData.slice(start, start + pageSize);\n }, [sortedData, pagination, currentPage, pageSize, isVirtual]);\n\n const paginationConfig = pagination && typeof pagination === 'object' ? pagination : undefined;\n const totalItems = paginationConfig?.total ?? dataSource.length;\n const activePage = paginationConfig?.current ?? currentPage;\n\n const handleSort = (col: ColumnType) => {\n if (!col.sorter) return;\n let newOrder: SortOrder;\n if (sortField !== col.dataIndex) {\n newOrder = 'ascend';\n } else if (sortOrder === 'ascend') {\n newOrder = 'descend';\n } else if (sortOrder === 'descend') {\n newOrder = null;\n } else {\n newOrder = 'ascend';\n }\n setSortField(newOrder ? col.dataIndex : undefined);\n setSortOrder(newOrder);\n onChange?.({ current: activePage, pageSize }, { field: col.dataIndex, order: newOrder });\n };\n\n const handlePageChange = (page: number) => {\n setCurrentPage(page);\n pagination && pagination.onChange?.(page, pageSize);\n onChange?.({ current: page, pageSize }, { field: sortField, order: sortOrder });\n };\n\n const handleSelectAll = () => {\n if (!rowSelection) return;\n const allKeys = paginatedData.map((record, i) => getRowKey(record, rowKey, i));\n const allSelected = allKeys.every((k) => selectedKeys.includes(k));\n const newKeys = allSelected ? [] : allKeys;\n if (!rowSelection.selectedRowKeys) {\n setSelectedKeys(newKeys);\n }\n const newRows = allSelected ? [] : paginatedData;\n rowSelection.onChange?.(newKeys, newRows);\n };\n\n const handleSelectRow = (record: any, key: React.Key) => {\n if (!rowSelection) return;\n const isRadio = rowSelection.type === 'radio';\n let newKeys: React.Key[];\n if (isRadio) {\n newKeys = [key];\n } else {\n newKeys = selectedKeys.includes(key)\n ? selectedKeys.filter((k) => k !== key)\n : [...selectedKeys, key];\n }\n if (!rowSelection.selectedRowKeys) {\n setSelectedKeys(newKeys);\n }\n const newRows = dataSource.filter((r, i) => newKeys.includes(getRowKey(r, rowKey, i)));\n rowSelection.onChange?.(newKeys, newRows);\n };\n\n const cls = classNames(prefixCls, className, {\n [`${prefixCls}_bordered`]: bordered,\n [`${prefixCls}_${tableSize}`]: tableSize,\n [`${prefixCls}_loading`]: loading,\n });\n\n const tableStyle: React.CSSProperties = {};\n if (scroll?.x) tableStyle.minWidth = scroll.x;\n\n const wrapperStyle: React.CSSProperties = {};\n if (isVirtual) {\n wrapperStyle.height = height;\n wrapperStyle.overflowY = 'auto';\n } else if (scroll?.y) {\n wrapperStyle.maxHeight = scroll.y;\n wrapperStyle.overflowY = 'auto';\n }\n\n const allPageKeys = paginatedData.map((r, i) => getRowKey(r, rowKey, i));\n const allSelected = allPageKeys.length > 0 && allPageKeys.every((k) => selectedKeys.includes(k));\n const someSelected = allPageKeys.some((k) => selectedKeys.includes(k));\n\n const colCount = columns.length + (rowSelection ? 1 : 0);\n\n const renderRow = (record: any, rowIndex: number) => {\n const key = getRowKey(record, rowKey, rowIndex);\n const isSelected = selectedKeys.includes(key);\n const rowCls = classNames(`${prefixCls}__row`, {\n [`${prefixCls}__row_selected`]: isSelected,\n }, typeof rowClassName === 'function' ? rowClassName(record, rowIndex) : rowClassName);\n const rowProps = onRow?.(record, rowIndex) ?? {};\n return (\n <tr key={key} className={rowCls} {...rowProps}>\n {rowSelection && (\n <td className={`${prefixCls}__cell ${prefixCls}__selection-col`}>\n <input\n type={rowSelection.type === 'radio' ? 'radio' : 'checkbox'}\n checked={isSelected}\n onChange={() => handleSelectRow(record, key)}\n aria-label={`Select row ${rowIndex + 1}`}\n />\n </td>\n )}\n {columns.map((col, colIndex) => {\n const colKey = col.key ?? col.dataIndex ?? colIndex;\n const value = getValue(record, col.dataIndex);\n const tdCls = classNames(`${prefixCls}__cell`, col.className, {\n [`${prefixCls}__cell_ellipsis`]: col.ellipsis,\n [`${prefixCls}__cell_align-${col.align}`]: col.align,\n });\n return (\n <td key={colKey} className={tdCls} style={{ width: col.width }}>\n {col.render ? col.render(value, record, rowIndex) : value}\n </td>\n );\n })}\n </tr>\n );\n };\n\n const renderTbody = () => {\n if (loading) {\n return (\n <tr>\n <td\n className={`${prefixCls}__cell ${prefixCls}__loading-cell`}\n colSpan={colCount}\n >\n Loading...\n </td>\n </tr>\n );\n }\n\n if (isVirtual) {\n if (sortedData.length === 0) {\n return (\n <tr>\n <td className={`${prefixCls}__cell ${prefixCls}__empty-cell`} colSpan={colCount}>\n {emptyText}\n </td>\n </tr>\n );\n }\n const [start, end] = visibleRange;\n const topHeight = offsetY;\n const bottomHeight = totalHeight - offsetY - (end - start + 1) * rowHeight;\n return (\n <>\n {topHeight > 0 && (\n <tr className={`${prefixCls}__row_spacer`}>\n <td colSpan={colCount} style={{ height: topHeight }} />\n </tr>\n )}\n {sortedData.slice(start, end + 1).map((record, i) => renderRow(record, start + i))}\n {bottomHeight > 0 && (\n <tr className={`${prefixCls}__row_spacer`}>\n <td colSpan={colCount} style={{ height: Math.max(0, bottomHeight) }} />\n </tr>\n )}\n </>\n );\n }\n\n if (paginatedData.length === 0) {\n return (\n <tr>\n <td\n className={`${prefixCls}__cell ${prefixCls}__empty-cell`}\n colSpan={colCount}\n >\n {emptyText}\n </td>\n </tr>\n );\n }\n\n return paginatedData.map((record, rowIndex) => renderRow(record, rowIndex));\n };\n\n const theadCls = classNames(`${prefixCls}__thead`, {\n [`${prefixCls}__thead_sticky`]: isVirtual,\n });\n\n const showPagination = pagination !== false && !isVirtual;\n\n return (\n <div {...otherProps} ref={ref} className={cls} style={style}>\n <div\n className={`${prefixCls}__wrapper`}\n style={wrapperStyle}\n onScroll={isVirtual ? onScroll : undefined}\n >\n <table className={`${prefixCls}__table`} style={tableStyle}>\n {showHeader && (\n <thead className={theadCls}>\n <tr>\n {rowSelection && (\n <th className={`${prefixCls}__cell ${prefixCls}__selection-col`}>\n {rowSelection.type !== 'radio' && (\n <input\n type=\"checkbox\"\n checked={allSelected}\n ref={(el) => { if (el) el.indeterminate = someSelected && !allSelected; }}\n onChange={handleSelectAll}\n aria-label=\"Select all\"\n />\n )}\n </th>\n )}\n {columns.map((col, i) => {\n const key = col.key ?? col.dataIndex ?? i;\n const thCls = classNames(`${prefixCls}__cell`, col.className, {\n [`${prefixCls}__cell_sortable`]: !!col.sorter,\n [`${prefixCls}__cell_align-${col.align}`]: col.align,\n });\n return (\n <th\n key={key}\n className={thCls}\n style={{ width: col.width }}\n onClick={() => handleSort(col)}\n >\n <span className={`${prefixCls}__col-title`}>{col.title}</span>\n {col.sorter && (\n <span className={`${prefixCls}__sorter`}>\n <span className={classNames(`${prefixCls}__sorter-icon`, {\n [`${prefixCls}__sorter-icon_active`]: sortField === col.dataIndex && sortOrder === 'ascend',\n })}>▲</span>\n <span className={classNames(`${prefixCls}__sorter-icon`, {\n [`${prefixCls}__sorter-icon_active`]: sortField === col.dataIndex && sortOrder === 'descend',\n })}>▼</span>\n </span>\n )}\n </th>\n );\n })}\n </tr>\n </thead>\n )}\n <tbody className={`${prefixCls}__tbody`}>\n {renderTbody()}\n </tbody>\n </table>\n </div>\n {showPagination && (\n <Pagination\n current={activePage}\n total={totalItems}\n pageSize={pageSize}\n align={paginationConfig?.align ?? 'right'}\n size={paginationConfig?.size}\n disabled={paginationConfig?.disabled}\n onChange={(page) => handlePageChange(page)}\n style={{ padding: '16px 0' }}\n />\n )}\n </div>\n );\n});\n\nTable.displayName = 'Table';\nexport default Table;\n"],"mappings":";;;;;;;;AAQA,MAAM,iBAAiB;CAAE,IAAI;CAAI,IAAI;CAAI,IAAI;CAAI;AAEjD,MAAM,aAAiB,QAAW,QAA6C,UAA6B;AAC1G,KAAI,OAAO,WAAW,WAAY,QAAO,OAAO,OAAO;CACvD,MAAM,MAAO,OAAe;AAC5B,QAAO,QAAQ,KAAA,IAAY,MAAM;;AAGnC,MAAM,YAAgB,QAAW,cAA2B;AAC1D,QAAQ,OAAe;;AAGzB,MAAM,QAAQ,MAAM,YAAwC,OAAO,QAAQ;CACzE,MAAM,EACJ,SACA,aAAa,EAAE,EACf,SAAS,OACT,UAAU,OACV,WAAW,OACX,MACA,QACA,UAAU,OACV,QACA,YAAY,gBACZ,cACA,YACA,UACA,YAAY,WACZ,aAAa,MACb,cACA,OACA,WAAW,eACX,WACA,OACA,GAAG,eACD;CAEJ,MAAM,gBAAgB,WAAW,cAAc;CAC/C,MAAM,YAAY,aAAa,SAAS,cAAc,WAAW,cAAc;CAC/E,MAAM,YAAY,QAAQ,cAAc,iBAAiB;AAEzD,KAAI,WAAW,UAAU,K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QAAQ,KAAK,KAAK,MAAM;MACvB,MAAM,MAAM,IAAI,OAAO,IAAI,aAAa;AAKxC,aACE,qBAAC,MAAD;OAEE,WAPU,WAAW,GAAG,UAAU,SAAS,IAAI,WAAW;SAC3D,GAAG,UAAU,mBAAmB,CAAC,CAAC,IAAI;SACtC,GAAG,UAAU,eAAe,IAAI,UAAU,IAAI;QAChD,CAAC;OAKE,OAAO,EAAE,OAAO,IAAI,OAAO;OAC3B,eAAe,WAAW,IAAI;iBAJhC,CAME,oBAAC,QAAD;QAAM,WAAW,GAAG,UAAU;kBAAe,IAAI;QAAa,CAAA,EAC7D,IAAI,UACH,qBAAC,QAAD;QAAM,WAAW,GAAG,UAAU;kBAA9B,CACE,oBAAC,QAAD;SAAM,WAAW,WAAW,GAAG,UAAU,gBAAgB,GACtD,GAAG,UAAU,wBAAwB,cAAc,IAAI,aAAa,cAAc,UACpF,CAAC;mBAAE;SAAQ,CAAA,EACZ,oBAAC,QAAD;SAAM,WAAW,WAAW,GAAG,UAAU,gBAAgB,GACtD,GAAG,UAAU,wBAAwB,cAAc,IAAI,aAAa,cAAc,WACpF,CAAC;mBAAE;SAAQ,CAAA,CACP;UAEN;SAhBE,IAgBF;OAEP,CACC,EAAA,CAAA;KACC,CAAA,EAEV,oBAAC,SAAD;KAAO,WAAW,GAAG,UAAU;eAC5B,aAAa;KACR,CAAA,CACF;;GACJ,CAAA,EACL,kBACC,oBAACA,oBAAD;GACE,SAAS;GACT,OAAO;GACG;GACV,OAAO,kBAAkB,SAAS;GAClC,MAAM,kBAAkB;GACxB,UAAU,kBAAkB;GAC5B,WAAW,SAAS,iBAAiB,KAAK;GAC1C,OAAO,EAAE,SAAS,UAAU;GAC5B,CAAA,CAEA;;EAER;AAEF,MAAM,cAAc"}
|
|
1
|
+
{"version":3,"file":"table.js","names":["Pagination"],"sources":["../../src/table/table.tsx"],"sourcesContent":["import React, { useState, useEffect, useContext, useMemo } from 'react';\nimport classNames from 'classnames';\nimport { ConfigContext } from '../config-provider/config-context';\nimport { getPrefixCls } from '../_utils/general';\nimport { useVirtualScroll } from '../_utils/use-virtual-scroll';\nimport Pagination from '../pagination';\nimport { TableProps, ColumnType, SortOrder } from './types';\n\nconst ROW_HEIGHT_MAP = { sm: 40, md: 48, lg: 56 } as const;\n\nconst getRowKey = <T,>(record: T, rowKey: string | ((record: T) => React.Key), index: number): React.Key => {\n if (typeof rowKey === 'function') return rowKey(record);\n const key = (record as any)[rowKey];\n return key !== undefined ? key : index;\n};\n\nconst getValue = <T,>(record: T, dataIndex: string): any => {\n return (record as any)[dataIndex];\n};\n\nconst Table = React.forwardRef<HTMLDivElement, TableProps>((props, ref) => {\n const {\n columns,\n dataSource = [],\n rowKey = 'key',\n loading = false,\n bordered = false,\n size,\n scroll,\n virtual = false,\n height,\n itemHeight: itemHeightProp,\n rowSelection,\n pagination,\n onChange,\n emptyText = 'No Data',\n showHeader = true,\n rowClassName,\n onRow,\n prefixCls: customisedCls,\n className,\n style,\n ...otherProps\n } = props;\n\n const configContext = useContext(ConfigContext);\n const prefixCls = getPrefixCls('table', configContext.prefixCls, customisedCls);\n const tableSize = size || configContext.componentSize || 'md';\n\n if (virtual && height == null) {\n console.warn('[tiny-design: Table] `height` is required when `virtual` is enabled.');\n }\n\n const isVirtual = virtual && height != null;\n\n // Sorting\n const [sortField, setSortField] = useState<string | undefined>();\n const [sortOrder, setSortOrder] = useState<SortOrder>(null);\n\n // Pagination\n const [currentPage, setCurrentPage] = useState(1);\n const pageSize = pagination && pagination.pageSize ? pagination.pageSize : 10;\n\n // Selection\n const [selectedKeys, setSelectedKeys] = useState<React.Key[]>(\n rowSelection?.selectedRowKeys ?? []\n );\n\n useEffect(() => {\n if (rowSelection?.selectedRowKeys) {\n setSelectedKeys(rowSelection.selectedRowKeys);\n }\n }, [rowSelection?.selectedRowKeys]);\n\n // Initialize default sort\n useEffect(() => {\n for (const col of columns) {\n if (col.defaultSortOrder) {\n setSortField(col.dataIndex);\n setSortOrder(col.defaultSortOrder);\n break;\n }\n }\n }, []);\n\n const sortedData = useMemo(() => {\n if (!sortField || !sortOrder) return [...dataSource];\n const col = columns.find((c) => c.dataIndex === sortField);\n if (!col?.sorter) return [...dataSource];\n const sorted = [...dataSource];\n const sorterFn =\n typeof col.sorter === 'function'\n ? col.sorter\n : (a: any, b: any) => {\n const va = getValue(a, sortField);\n const vb = getValue(b, sortField);\n if (va < vb) return -1;\n if (va > vb) return 1;\n return 0;\n };\n sorted.sort((a, b) => {\n const result = sorterFn(a, b);\n return sortOrder === 'descend' ? -result : result;\n });\n return sorted;\n }, [dataSource, sortField, sortOrder, columns]);\n\n const rowHeight = itemHeightProp ?? ROW_HEIGHT_MAP[tableSize] ?? ROW_HEIGHT_MAP.md;\n const { visibleRange, totalHeight, offsetY, onScroll } = useVirtualScroll({\n itemCount: sortedData.length,\n itemHeight: rowHeight,\n containerHeight: height ?? 0,\n });\n\n const paginatedData = useMemo(() => {\n if (isVirtual) return sortedData;\n if (pagination === false) return sortedData;\n const page = pagination?.current ?? currentPage;\n const start = (page - 1) * pageSize;\n return sortedData.slice(start, start + pageSize);\n }, [sortedData, pagination, currentPage, pageSize, isVirtual]);\n\n const paginationConfig = pagination && typeof pagination === 'object' ? pagination : undefined;\n const totalItems = paginationConfig?.total ?? dataSource.length;\n const activePage = paginationConfig?.current ?? currentPage;\n\n const handleSort = (col: ColumnType) => {\n if (!col.sorter) return;\n let newOrder: SortOrder;\n if (sortField !== col.dataIndex) {\n newOrder = 'ascend';\n } else if (sortOrder === 'ascend') {\n newOrder = 'descend';\n } else if (sortOrder === 'descend') {\n newOrder = null;\n } else {\n newOrder = 'ascend';\n }\n setSortField(newOrder ? col.dataIndex : undefined);\n setSortOrder(newOrder);\n onChange?.({ current: activePage, pageSize }, { field: col.dataIndex, order: newOrder });\n };\n\n const handlePageChange = (page: number) => {\n setCurrentPage(page);\n pagination && pagination.onChange?.(page, pageSize);\n onChange?.({ current: page, pageSize }, { field: sortField, order: sortOrder });\n };\n\n const handleSelectAll = () => {\n if (!rowSelection) return;\n const allKeys = paginatedData.map((record, i) => getRowKey(record, rowKey, i));\n const allSelected = allKeys.every((k) => selectedKeys.includes(k));\n const newKeys = allSelected ? [] : allKeys;\n if (!rowSelection.selectedRowKeys) {\n setSelectedKeys(newKeys);\n }\n const newRows = allSelected ? [] : paginatedData;\n rowSelection.onChange?.(newKeys, newRows);\n };\n\n const handleSelectRow = (record: any, key: React.Key) => {\n if (!rowSelection) return;\n const isRadio = rowSelection.type === 'radio';\n let newKeys: React.Key[];\n if (isRadio) {\n newKeys = [key];\n } else {\n newKeys = selectedKeys.includes(key)\n ? selectedKeys.filter((k) => k !== key)\n : [...selectedKeys, key];\n }\n if (!rowSelection.selectedRowKeys) {\n setSelectedKeys(newKeys);\n }\n const newRows = dataSource.filter((r, i) => newKeys.includes(getRowKey(r, rowKey, i)));\n rowSelection.onChange?.(newKeys, newRows);\n };\n\n const cls = classNames(prefixCls, className, {\n [`${prefixCls}_bordered`]: bordered,\n [`${prefixCls}_${tableSize}`]: tableSize,\n [`${prefixCls}_loading`]: loading,\n });\n\n const tableStyle: React.CSSProperties = {};\n if (scroll?.x) tableStyle.minWidth = scroll.x;\n\n const wrapperStyle: React.CSSProperties = {};\n if (isVirtual) {\n wrapperStyle.height = height;\n wrapperStyle.overflowY = 'auto';\n } else if (scroll?.y) {\n wrapperStyle.maxHeight = scroll.y;\n wrapperStyle.overflowY = 'auto';\n }\n\n const allPageKeys = paginatedData.map((r, i) => getRowKey(r, rowKey, i));\n const allSelected = allPageKeys.length > 0 && allPageKeys.every((k) => selectedKeys.includes(k));\n const someSelected = allPageKeys.some((k) => selectedKeys.includes(k));\n\n const colCount = columns.length + (rowSelection ? 1 : 0);\n\n const renderRow = (record: any, rowIndex: number) => {\n const key = getRowKey(record, rowKey, rowIndex);\n const isSelected = selectedKeys.includes(key);\n const rowCls = classNames(`${prefixCls}__row`, {\n [`${prefixCls}__row_selected`]: isSelected,\n }, typeof rowClassName === 'function' ? rowClassName(record, rowIndex) : rowClassName);\n const rowProps = onRow?.(record, rowIndex) ?? {};\n return (\n <tr key={key} className={rowCls} {...rowProps}>\n {rowSelection && (\n <td className={`${prefixCls}__cell ${prefixCls}__selection-col`}>\n <input\n type={rowSelection.type === 'radio' ? 'radio' : 'checkbox'}\n checked={isSelected}\n onChange={() => handleSelectRow(record, key)}\n aria-label={`Select row ${rowIndex + 1}`}\n />\n </td>\n )}\n {columns.map((col, colIndex) => {\n const colKey = col.key ?? col.dataIndex ?? colIndex;\n const value = getValue(record, col.dataIndex);\n const tdCls = classNames(`${prefixCls}__cell`, col.className, {\n [`${prefixCls}__cell_ellipsis`]: col.ellipsis,\n [`${prefixCls}__cell_align-${col.align}`]: col.align,\n });\n return (\n <td key={colKey} className={tdCls} style={{ width: col.width }}>\n {col.render ? col.render(value, record, rowIndex) : value}\n </td>\n );\n })}\n </tr>\n );\n };\n\n const renderTbody = () => {\n if (loading) {\n return (\n <tr>\n <td\n className={`${prefixCls}__cell ${prefixCls}__loading-cell`}\n colSpan={colCount}\n >\n Loading...\n </td>\n </tr>\n );\n }\n\n if (isVirtual) {\n if (sortedData.length === 0) {\n return (\n <tr>\n <td className={`${prefixCls}__cell ${prefixCls}__empty-cell`} colSpan={colCount}>\n {emptyText}\n </td>\n </tr>\n );\n }\n const [start, end] = visibleRange;\n const topHeight = offsetY;\n const bottomHeight = totalHeight - offsetY - (end - start + 1) * rowHeight;\n return (\n <>\n {topHeight > 0 && (\n <tr className={`${prefixCls}__row_spacer`}>\n <td colSpan={colCount} style={{ height: topHeight }} />\n </tr>\n )}\n {sortedData.slice(start, end + 1).map((record, i) => renderRow(record, start + i))}\n {bottomHeight > 0 && (\n <tr className={`${prefixCls}__row_spacer`}>\n <td colSpan={colCount} style={{ height: Math.max(0, bottomHeight) }} />\n </tr>\n )}\n </>\n );\n }\n\n if (paginatedData.length === 0) {\n return (\n <tr>\n <td\n className={`${prefixCls}__cell ${prefixCls}__empty-cell`}\n colSpan={colCount}\n >\n {emptyText}\n </td>\n </tr>\n );\n }\n\n return paginatedData.map((record, rowIndex) => renderRow(record, rowIndex));\n };\n\n const theadCls = classNames(`${prefixCls}__thead`, {\n [`${prefixCls}__thead_sticky`]: isVirtual,\n });\n\n const showPagination = pagination !== false && !isVirtual;\n\n return (\n <div {...otherProps} ref={ref} className={cls} style={style}>\n <div\n className={`${prefixCls}__wrapper`}\n style={wrapperStyle}\n onScroll={isVirtual ? onScroll : undefined}\n >\n <table className={`${prefixCls}__table`} style={tableStyle}>\n {showHeader && (\n <thead className={theadCls}>\n <tr>\n {rowSelection && (\n <th className={`${prefixCls}__cell ${prefixCls}__selection-col`}>\n {rowSelection.type !== 'radio' && (\n <input\n type=\"checkbox\"\n checked={allSelected}\n ref={(el) => { if (el) el.indeterminate = someSelected && !allSelected; }}\n onChange={handleSelectAll}\n aria-label=\"Select all\"\n />\n )}\n </th>\n )}\n {columns.map((col, i) => {\n const key = col.key ?? col.dataIndex ?? i;\n const thCls = classNames(`${prefixCls}__cell`, col.className, {\n [`${prefixCls}__cell_sortable`]: !!col.sorter,\n [`${prefixCls}__cell_align-${col.align}`]: col.align,\n });\n return (\n <th\n key={key}\n className={thCls}\n style={{ width: col.width }}\n onClick={() => handleSort(col)}\n >\n <span className={`${prefixCls}__col-title`}>{col.title}</span>\n {col.sorter && (\n <span className={`${prefixCls}__sorter`}>\n <span className={classNames(`${prefixCls}__sorter-icon`, {\n [`${prefixCls}__sorter-icon_active`]: sortField === col.dataIndex && sortOrder === 'ascend',\n })}>▲</span>\n <span className={classNames(`${prefixCls}__sorter-icon`, {\n [`${prefixCls}__sorter-icon_active`]: sortField === col.dataIndex && sortOrder === 'descend',\n })}>▼</span>\n </span>\n )}\n </th>\n );\n })}\n </tr>\n </thead>\n )}\n <tbody className={`${prefixCls}__tbody`}>\n {renderTbody()}\n </tbody>\n </table>\n </div>\n {showPagination && (\n <Pagination\n current={activePage}\n total={totalItems}\n pageSize={pageSize}\n align={paginationConfig?.align ?? 'right'}\n size={paginationConfig?.size}\n disabled={paginationConfig?.disabled}\n onChange={(page) => handlePageChange(page)}\n style={{ padding: '16px 0' }}\n />\n )}\n </div>\n );\n});\n\nTable.displayName = 'Table';\nexport default Table;\n"],"mappings":";;;;;;;;AAQA,MAAM,iBAAiB;CAAE,IAAI;CAAI,IAAI;CAAI,IAAI;CAAI;AAEjD,MAAM,aAAiB,QAAW,QAA6C,UAA6B;AAC1G,KAAI,OAAO,WAAW,WAAY,QAAO,OAAO,OAAO;CACvD,MAAM,MAAO,OAAe;AAC5B,QAAO,QAAQ,KAAA,IAAY,MAAM;;AAGnC,MAAM,YAAgB,QAAW,cAA2B;AAC1D,QAAQ,OAAe;;AAGzB,MAAM,QAAQ,MAAM,YAAwC,OAAO,QAAQ;CACzE,MAAM,EACJ,SACA,aAAa,EAAE,EACf,SAAS,OACT,UAAU,OACV,WAAW,OACX,MACA,QACA,UAAU,OACV,QACA,YAAY,gBACZ,cACA,YACA,UACA,YAAY,WACZ,aAAa,MACb,cACA,OACA,WAAW,eACX,WACA,OACA,GAAG,eACD;CAEJ,MAAM,gBAAgB,WAAW,cAAc;CAC/C,MAAM,YAAY,aAAa,SAAS,cAAc,WAAW,cAAc;CAC/E,MAAM,YAAY,QAAQ,cAAc,iBAAiB;AAEzD,KAAI,WAAW,UAAU,KACvB,SAAQ,KAAK,uEAAuE;CAGtF,MAAM,YAAY,WAAW,UAAU;CAGvC,MAAM,CAAC,WAAW,gBAAgB,UAA8B;CAChE,MAAM,CAAC,WAAW,gBAAgB,SAAoB,KAAK;CAG3D,MAAM,CAAC,aAAa,kBAAkB,SAAS,EAAE;CACjD,MAAM,WAAW,cAAc,WAAW,WAAW,WAAW,WAAW;CAG3E,MAAM,CAAC,cAAc,mBAAmB,SACtC,cAAc,mBAAmB,EAAE,CACpC;AAED,iBAAgB;AACd,MAAI,cAAc,gBAChB,iBAAgB,aAAa,gBAAgB;IAE9C,CAAC,cAAc,gBAAgB,CAAC;AAGnC,iBAAgB;AACd,OAAK,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G,UAAU;kBAA9B,CACE,oBAAC,QAAD;SAAM,WAAW,WAAW,GAAG,UAAU,gBAAgB,GACtD,GAAG,UAAU,wBAAwB,cAAc,IAAI,aAAa,cAAc,UACpF,CAAC;mBAAE;SAAQ,CAAA,EACZ,oBAAC,QAAD;SAAM,WAAW,WAAW,GAAG,UAAU,gBAAgB,GACtD,GAAG,UAAU,wBAAwB,cAAc,IAAI,aAAa,cAAc,WACpF,CAAC;mBAAE;SAAQ,CAAA,CACP;UAEN;SAhBE,IAgBF;OAEP,CACC,EAAA,CAAA;KACC,CAAA,EAEV,oBAAC,SAAD;KAAO,WAAW,GAAG,UAAU;eAC5B,aAAa;KACR,CAAA,CACF;;GACJ,CAAA,EACL,kBACC,oBAACA,oBAAD;GACE,SAAS;GACT,OAAO;GACG;GACV,OAAO,kBAAkB,SAAS;GAClC,MAAM,kBAAkB;GACxB,UAAU,kBAAkB;GAC5B,WAAW,SAAS,iBAAiB,KAAK;GAC1C,OAAO,EAAE,SAAS,UAAU;GAC5B,CAAA,CAEA;;EAER;AAEF,MAAM,cAAc"}
|
package/es/tag/style/_index.scss
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import { withSpin } from "./with-spin.js";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ForwardRefExoticComponent, RefAttributes } from "react";
|
|
2
|
+
import { IconProps } from "@tiny-design/icons";
|
|
3
|
+
|
|
4
|
+
//#region src/with-spin/with-spin.d.ts
|
|
5
|
+
type IconComponent = ForwardRefExoticComponent<IconProps & RefAttributes<SVGSVGElement>>;
|
|
6
|
+
declare function withSpin(Icon: IconComponent): IconComponent;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { withSpin };
|
|
9
|
+
//# sourceMappingURL=with-spin.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { forwardRef } from "react";
|
|
2
|
+
import classNames from "classnames";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
//#region src/with-spin/with-spin.tsx
|
|
5
|
+
function withSpin(Icon) {
|
|
6
|
+
const SpinIcon = forwardRef((props, ref) => {
|
|
7
|
+
const { className, ...rest } = props;
|
|
8
|
+
return /* @__PURE__ */ jsx(Icon, {
|
|
9
|
+
ref,
|
|
10
|
+
className: classNames("ty-icon-spin", className),
|
|
11
|
+
...rest
|
|
12
|
+
});
|
|
13
|
+
});
|
|
14
|
+
SpinIcon.displayName = `withSpin(${Icon.displayName || "Icon"})`;
|
|
15
|
+
return SpinIcon;
|
|
16
|
+
}
|
|
17
|
+
//#endregion
|
|
18
|
+
export { withSpin };
|
|
19
|
+
|
|
20
|
+
//# sourceMappingURL=with-spin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-spin.js","names":[],"sources":["../../src/with-spin/with-spin.tsx"],"sourcesContent":["import { forwardRef, type ForwardRefExoticComponent, type RefAttributes } from 'react';\nimport type { IconProps } from '@tiny-design/icons';\nimport classNames from 'classnames';\n\ntype IconComponent = ForwardRefExoticComponent<IconProps & RefAttributes<SVGSVGElement>>;\n\nexport function withSpin(Icon: IconComponent): IconComponent {\n const SpinIcon = forwardRef<SVGSVGElement, IconProps>((props, ref) => {\n const { className, ...rest } = props;\n\n return (\n <Icon\n ref={ref}\n className={classNames('ty-icon-spin', className)}\n {...rest}\n />\n );\n });\n\n const name = Icon.displayName || 'Icon';\n SpinIcon.displayName = `withSpin(${name})`;\n\n return SpinIcon;\n}\n"],"mappings":";;;;AAMA,SAAgB,SAAS,MAAoC;CAC3D,MAAM,WAAW,YAAsC,OAAO,QAAQ;EACpE,MAAM,EAAE,WAAW,GAAG,SAAS;AAE/B,SACE,oBAAC,MAAD;GACO;GACL,WAAW,WAAW,gBAAgB,UAAU;GAChD,GAAI;GACJ,CAAA;GAEJ;AAGF,UAAS,cAAc,YADV,KAAK,eAAe,OACO;AAExC,QAAO"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
height: 1em;
|
|
52
52
|
position: relative;
|
|
53
53
|
border-width: 2px;
|
|
54
|
-
border-color:
|
|
54
|
+
border-color: currentcolor currentcolor transparent transparent;
|
|
55
55
|
border-style: solid;
|
|
56
56
|
border-radius: 50%;
|
|
57
57
|
animation: ty-rotate-reverse 600ms infinite linear;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/index.d.ts
CHANGED
|
@@ -28,7 +28,6 @@ import { Empty } from "./empty/empty.js";
|
|
|
28
28
|
import { Flex } from "./flex/flex.js";
|
|
29
29
|
import { DefaultFlip } from "./flip/index.js";
|
|
30
30
|
import { DefaultForm } from "./form/index.js";
|
|
31
|
-
import { Icon } from "./icon/icon.js";
|
|
32
31
|
import { Image } from "./image/image.js";
|
|
33
32
|
import { DefaultInput } from "./input/index.js";
|
|
34
33
|
import { InputNumber } from "./input-number/input-number.js";
|
|
@@ -81,8 +80,9 @@ import { Tree } from "./tree/tree.js";
|
|
|
81
80
|
import { DefaultTypo } from "./typography/index.js";
|
|
82
81
|
import { Upload } from "./upload/upload.js";
|
|
83
82
|
import { withLocale } from "./intl-provider/with-locale.js";
|
|
83
|
+
import { withSpin } from "./with-spin/with-spin.js";
|
|
84
84
|
import { en_US } from "./locale/en_US.js";
|
|
85
85
|
import { zh_CN } from "./locale/zh_CN.js";
|
|
86
86
|
import { useLocale } from "./_utils/use-locale.js";
|
|
87
87
|
import { ThemeMode, useTheme } from "./_utils/use-theme.js";
|
|
88
|
-
export { Alert, DefaultAnchor as Anchor, AspectRatio, AutoComplete, DefaultAvatar as Avatar, BackTop, Badge, DefaultBreadcrumb as Breadcrumb, DefaultButton as Button, Calendar, DefaultCard as Card, DefaultCarousel as Carousel, Cascader, DefaultCheckbox as Checkbox, Col, DefaultCollapse as Collapse, ColorPicker, ConfigProvider, CopyToClipboard, Countdown, DatePicker, DefaultDesc as Descriptions, Divider, Drawer, Dropdown, Empty, Flex, DefaultFlip as Flip, DefaultForm as Form,
|
|
88
|
+
export { Alert, DefaultAnchor as Anchor, AspectRatio, AutoComplete, DefaultAvatar as Avatar, BackTop, Badge, DefaultBreadcrumb as Breadcrumb, DefaultButton as Button, Calendar, DefaultCard as Card, DefaultCarousel as Carousel, Cascader, DefaultCheckbox as Checkbox, Col, DefaultCollapse as Collapse, ColorPicker, ConfigProvider, CopyToClipboard, Countdown, DatePicker, DefaultDesc as Descriptions, Divider, Drawer, Dropdown, Empty, Flex, DefaultFlip as Flip, DefaultForm as Form, Image, DefaultInput as Input, InputNumber, InputPassword, IntlProvider, Keyboard, DefaultLayout as Layout, Link, DefaultList as List, Loader, _default as LoadingBar, type Locale, DefaultMenu as Menu, messageContainer as Message, ModalWithContext as Modal, DefaultSelect as NativeSelect, notificationContainer as Notification, Overlay, Pagination, PopConfirm, Popover, Progress, DefaultRadio as Radio, Rate, Result, Row, ScrollIndicator, Segmented, DefaultSelect$1 as Select, Skeleton, Slider, Space, DefaultSpeedDial as SpeedDial, Split, SplitButton, Statistic, DefaultSteps as Steps, Sticky, StrengthIndicator, Switch, Table, DefaultTabs as Tabs, DefaultTag as Tag, Textarea, type ThemeMode, TimePicker, DefaultTimeline as Timeline, Tooltip, Transfer, Transition, Tree, DefaultTypo as Typography, Upload, en_US, useLocale, useTheme, withLocale, withSpin, zh_CN };
|
package/lib/index.js
CHANGED
|
@@ -35,55 +35,55 @@ const require_index$28 = require("./empty/index.js");
|
|
|
35
35
|
const require_index$29 = require("./flex/index.js");
|
|
36
36
|
const require_index$30 = require("./flip/index.js");
|
|
37
37
|
const require_index$31 = require("./form/index.js");
|
|
38
|
-
const require_index$32 = require("./
|
|
39
|
-
const require_index$33 = require("./
|
|
40
|
-
const require_index$34 = require("./input/index.js");
|
|
41
|
-
const require_index$35 = require("./input-
|
|
42
|
-
const require_index$36 = require("./
|
|
43
|
-
const require_index$37 = require("./
|
|
44
|
-
const require_index$38 = require("./
|
|
45
|
-
const require_index$39 = require("./
|
|
46
|
-
const require_index$40 = require("./
|
|
47
|
-
const require_index$41 = require("./
|
|
48
|
-
const require_index$42 = require("./
|
|
49
|
-
const require_index$43 = require("./
|
|
50
|
-
const require_index$44 = require("./
|
|
51
|
-
const require_index$45 = require("./
|
|
52
|
-
const require_index$46 = require("./
|
|
53
|
-
const require_index$47 = require("./
|
|
54
|
-
const require_index$48 = require("./
|
|
55
|
-
const require_index$49 = require("./
|
|
56
|
-
const require_index$50 = require("./
|
|
57
|
-
const require_index$51 = require("./
|
|
58
|
-
const require_index$52 = require("./
|
|
59
|
-
const require_index$53 = require("./
|
|
60
|
-
const require_index$54 = require("./
|
|
61
|
-
const require_index$55 = require("./
|
|
62
|
-
const require_index$56 = require("./
|
|
63
|
-
const require_index$57 = require("./
|
|
64
|
-
const require_index$58 = require("./
|
|
65
|
-
const require_index$59 = require("./
|
|
66
|
-
const require_index$60 = require("./
|
|
67
|
-
const require_index$61 = require("./
|
|
68
|
-
const require_index$62 = require("./split/index.js");
|
|
69
|
-
const require_index$63 = require("./
|
|
70
|
-
const require_index$64 = require("./
|
|
71
|
-
const require_index$65 = require("./
|
|
72
|
-
const require_index$66 = require("./
|
|
73
|
-
const require_index$67 = require("./
|
|
74
|
-
const require_index$68 = require("./
|
|
75
|
-
const require_index$69 = require("./
|
|
76
|
-
const require_index$70 = require("./
|
|
77
|
-
const require_index$71 = require("./
|
|
78
|
-
const require_index$72 = require("./
|
|
79
|
-
const require_index$73 = require("./
|
|
80
|
-
const require_index$74 = require("./
|
|
81
|
-
const require_index$75 = require("./
|
|
82
|
-
const require_index$76 = require("./
|
|
83
|
-
const require_index$77 = require("./
|
|
84
|
-
const require_index$78 = require("./
|
|
85
|
-
const require_index$79 = require("./upload/index.js");
|
|
38
|
+
const require_index$32 = require("./image/index.js");
|
|
39
|
+
const require_index$33 = require("./input/index.js");
|
|
40
|
+
const require_index$34 = require("./input-number/index.js");
|
|
41
|
+
const require_index$35 = require("./input-password/index.js");
|
|
42
|
+
const require_index$36 = require("./keyboard/index.js");
|
|
43
|
+
const require_index$37 = require("./layout/index.js");
|
|
44
|
+
const require_index$38 = require("./link/index.js");
|
|
45
|
+
const require_index$39 = require("./pagination/index.js");
|
|
46
|
+
const require_index$40 = require("./list/index.js");
|
|
47
|
+
const require_index$41 = require("./loader/index.js");
|
|
48
|
+
const require_index$42 = require("./loading-bar/index.js");
|
|
49
|
+
const require_index$43 = require("./menu/index.js");
|
|
50
|
+
const require_index$44 = require("./message/index.js");
|
|
51
|
+
const require_index$45 = require("./native-select/index.js");
|
|
52
|
+
const require_index$46 = require("./row/index.js");
|
|
53
|
+
const require_index$47 = require("./modal/index.js");
|
|
54
|
+
const require_index$48 = require("./notification/index.js");
|
|
55
|
+
const require_index$49 = require("./popover/index.js");
|
|
56
|
+
const require_index$50 = require("./pop-confirm/index.js");
|
|
57
|
+
const require_index$51 = require("./progress/index.js");
|
|
58
|
+
const require_index$52 = require("./radio/index.js");
|
|
59
|
+
const require_index$53 = require("./rate/index.js");
|
|
60
|
+
const require_index$54 = require("./result/index.js");
|
|
61
|
+
const require_index$55 = require("./scroll-indicator/index.js");
|
|
62
|
+
const require_index$56 = require("./segmented/index.js");
|
|
63
|
+
const require_index$57 = require("./select/index.js");
|
|
64
|
+
const require_index$58 = require("./skeleton/index.js");
|
|
65
|
+
const require_index$59 = require("./tooltip/index.js");
|
|
66
|
+
const require_index$60 = require("./slider/index.js");
|
|
67
|
+
const require_index$61 = require("./split/index.js");
|
|
68
|
+
const require_index$62 = require("./split-button/index.js");
|
|
69
|
+
const require_index$63 = require("./space/index.js");
|
|
70
|
+
const require_index$64 = require("./speed-dial/index.js");
|
|
71
|
+
const require_index$65 = require("./steps/index.js");
|
|
72
|
+
const require_index$66 = require("./statistic/index.js");
|
|
73
|
+
const require_index$67 = require("./strength-indicator/index.js");
|
|
74
|
+
const require_index$68 = require("./switch/index.js");
|
|
75
|
+
const require_index$69 = require("./table/index.js");
|
|
76
|
+
const require_index$70 = require("./tabs/index.js");
|
|
77
|
+
const require_index$71 = require("./tag/index.js");
|
|
78
|
+
const require_index$72 = require("./textarea/index.js");
|
|
79
|
+
const require_index$73 = require("./timeline/index.js");
|
|
80
|
+
const require_index$74 = require("./time-picker/index.js");
|
|
81
|
+
const require_index$75 = require("./transfer/index.js");
|
|
82
|
+
const require_index$76 = require("./tree/index.js");
|
|
83
|
+
const require_index$77 = require("./typography/index.js");
|
|
84
|
+
const require_index$78 = require("./upload/index.js");
|
|
86
85
|
const require_with_locale = require("./intl-provider/with-locale.js");
|
|
86
|
+
const require_with_spin = require("./with-spin/with-spin.js");
|
|
87
87
|
const require_zh_CN = require("./locale/zh_CN.js");
|
|
88
88
|
const require_use_theme = require("./_utils/use-theme.js");
|
|
89
89
|
exports.Alert = require_index$1;
|
|
@@ -115,60 +115,60 @@ exports.Empty = require_index$28;
|
|
|
115
115
|
exports.Flex = require_index$29;
|
|
116
116
|
exports.Flip = require_index$30;
|
|
117
117
|
exports.Form = require_index$31;
|
|
118
|
-
exports.
|
|
119
|
-
exports.
|
|
120
|
-
exports.
|
|
121
|
-
exports.
|
|
122
|
-
exports.InputPassword = require_index$36;
|
|
118
|
+
exports.Image = require_index$32;
|
|
119
|
+
exports.Input = require_index$33;
|
|
120
|
+
exports.InputNumber = require_index$34;
|
|
121
|
+
exports.InputPassword = require_index$35;
|
|
123
122
|
exports.IntlProvider = require_index$15;
|
|
124
|
-
exports.Keyboard = require_index$
|
|
125
|
-
exports.Layout = require_index$
|
|
126
|
-
exports.Link = require_index$
|
|
127
|
-
exports.List = require_index$
|
|
128
|
-
exports.Loader = require_index$
|
|
129
|
-
exports.LoadingBar = require_index$
|
|
130
|
-
exports.Menu = require_index$
|
|
131
|
-
exports.Message = require_index$
|
|
132
|
-
exports.Modal = require_index$
|
|
133
|
-
exports.NativeSelect = require_index$
|
|
134
|
-
exports.Notification = require_index$
|
|
123
|
+
exports.Keyboard = require_index$36;
|
|
124
|
+
exports.Layout = require_index$37;
|
|
125
|
+
exports.Link = require_index$38;
|
|
126
|
+
exports.List = require_index$40;
|
|
127
|
+
exports.Loader = require_index$41;
|
|
128
|
+
exports.LoadingBar = require_index$42;
|
|
129
|
+
exports.Menu = require_index$43;
|
|
130
|
+
exports.Message = require_index$44;
|
|
131
|
+
exports.Modal = require_index$47;
|
|
132
|
+
exports.NativeSelect = require_index$45;
|
|
133
|
+
exports.Notification = require_index$48;
|
|
135
134
|
exports.Overlay = require_index$26;
|
|
136
|
-
exports.Pagination = require_index$
|
|
137
|
-
exports.PopConfirm = require_index$
|
|
138
|
-
exports.Popover = require_index$
|
|
139
|
-
exports.Progress = require_index$
|
|
140
|
-
exports.Radio = require_index$
|
|
141
|
-
exports.Rate = require_index$
|
|
142
|
-
exports.Result = require_index$
|
|
143
|
-
exports.Row = require_index$
|
|
144
|
-
exports.ScrollIndicator = require_index$
|
|
145
|
-
exports.Segmented = require_index$
|
|
146
|
-
exports.Select = require_index$
|
|
147
|
-
exports.Skeleton = require_index$
|
|
148
|
-
exports.Slider = require_index$
|
|
149
|
-
exports.Space = require_index$
|
|
150
|
-
exports.SpeedDial = require_index$
|
|
151
|
-
exports.Split = require_index$
|
|
152
|
-
exports.SplitButton = require_index$
|
|
153
|
-
exports.Statistic = require_index$
|
|
154
|
-
exports.Steps = require_index$
|
|
135
|
+
exports.Pagination = require_index$39;
|
|
136
|
+
exports.PopConfirm = require_index$50;
|
|
137
|
+
exports.Popover = require_index$49;
|
|
138
|
+
exports.Progress = require_index$51;
|
|
139
|
+
exports.Radio = require_index$52;
|
|
140
|
+
exports.Rate = require_index$53;
|
|
141
|
+
exports.Result = require_index$54;
|
|
142
|
+
exports.Row = require_index$46;
|
|
143
|
+
exports.ScrollIndicator = require_index$55;
|
|
144
|
+
exports.Segmented = require_index$56;
|
|
145
|
+
exports.Select = require_index$57;
|
|
146
|
+
exports.Skeleton = require_index$58;
|
|
147
|
+
exports.Slider = require_index$60;
|
|
148
|
+
exports.Space = require_index$63;
|
|
149
|
+
exports.SpeedDial = require_index$64;
|
|
150
|
+
exports.Split = require_index$61;
|
|
151
|
+
exports.SplitButton = require_index$62;
|
|
152
|
+
exports.Statistic = require_index$66;
|
|
153
|
+
exports.Steps = require_index$65;
|
|
155
154
|
exports.Sticky = require_index$2;
|
|
156
|
-
exports.StrengthIndicator = require_index$
|
|
157
|
-
exports.Switch = require_index$
|
|
158
|
-
exports.Table = require_index$
|
|
159
|
-
exports.Tabs = require_index$
|
|
160
|
-
exports.Tag = require_index$
|
|
161
|
-
exports.Textarea = require_index$
|
|
162
|
-
exports.TimePicker = require_index$
|
|
163
|
-
exports.Timeline = require_index$
|
|
164
|
-
exports.Tooltip = require_index$
|
|
165
|
-
exports.Transfer = require_index$
|
|
155
|
+
exports.StrengthIndicator = require_index$67;
|
|
156
|
+
exports.Switch = require_index$68;
|
|
157
|
+
exports.Table = require_index$69;
|
|
158
|
+
exports.Tabs = require_index$70;
|
|
159
|
+
exports.Tag = require_index$71;
|
|
160
|
+
exports.Textarea = require_index$72;
|
|
161
|
+
exports.TimePicker = require_index$74;
|
|
162
|
+
exports.Timeline = require_index$73;
|
|
163
|
+
exports.Tooltip = require_index$59;
|
|
164
|
+
exports.Transfer = require_index$75;
|
|
166
165
|
exports.Transition = require_index;
|
|
167
|
-
exports.Tree = require_index$
|
|
168
|
-
exports.Typography = require_index$
|
|
169
|
-
exports.Upload = require_index$
|
|
166
|
+
exports.Tree = require_index$76;
|
|
167
|
+
exports.Typography = require_index$77;
|
|
168
|
+
exports.Upload = require_index$78;
|
|
170
169
|
exports.en_US = require_en_US;
|
|
171
170
|
exports.useLocale = require_use_locale.useLocale;
|
|
172
171
|
exports.useTheme = require_use_theme.useTheme;
|
|
173
172
|
exports.withLocale = require_with_locale.withLocale;
|
|
173
|
+
exports.withSpin = require_with_spin.withSpin;
|
|
174
174
|
exports.zh_CN = require_zh_CN;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/lib/layout/sidebar.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const require_runtime = require("../_virtual/_rolldown/runtime.js");
|
|
2
2
|
const require_config_context = require("../config-provider/config-context.js");
|
|
3
3
|
const require_general = require("../_utils/general.js");
|
|
4
|
-
const require_index = require("../icon/index.js");
|
|
5
4
|
const require_sidebar_context = require("./sidebar-context.js");
|
|
6
5
|
let react = require("react");
|
|
7
6
|
react = require_runtime.__toESM(react);
|
|
8
7
|
let classnames = require("classnames");
|
|
9
8
|
classnames = require_runtime.__toESM(classnames);
|
|
10
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
let _tiny_design_icons = require("@tiny-design/icons");
|
|
11
11
|
//#region src/layout/sidebar.tsx
|
|
12
12
|
const Sidebar = react.default.forwardRef((props, ref) => {
|
|
13
13
|
const { defaultCollapsed = false, width = 200, collapsedWidth = 70, theme = "light", trigger = null, collapsible = false, onCollapse, className, style, children, prefixCls: customisedCls, ...otherProps } = props;
|
|
@@ -35,10 +35,7 @@ const Sidebar = react.default.forwardRef((props, ref) => {
|
|
|
35
35
|
className: `${prefixCls}__trigger`,
|
|
36
36
|
onClick: _collapseBtnOnClick,
|
|
37
37
|
"aria-label": "Toggle sidebar",
|
|
38
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
39
|
-
name: "left",
|
|
40
|
-
className: `${prefixCls}__trigger-icon`
|
|
41
|
-
})
|
|
38
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tiny_design_icons.IconLeft, { className: `${prefixCls}__trigger-icon` })
|
|
42
39
|
});
|
|
43
40
|
};
|
|
44
41
|
(0, react.useEffect)(() => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.js","names":["React","SidebarContext","getPrefixCls","ConfigContext","
|
|
1
|
+
{"version":3,"file":"sidebar.js","names":["React","SidebarContext","getPrefixCls","ConfigContext","IconLeft"],"sources":["../../src/layout/sidebar.tsx"],"sourcesContent":["import React from 'react';\nimport { useState, useContext, useEffect } from 'react';\nimport classNames from 'classnames';\nimport { IconLeft } from '@tiny-design/icons';\nimport { SidebarContext } from './sidebar-context';\nimport { ConfigContext } from '../config-provider/config-context';\nimport { getPrefixCls } from '../_utils/general';\nimport { SidebarProps } from './types';\n\nconst Sidebar = React.forwardRef<HTMLDivElement, SidebarProps>(\n (props: SidebarProps, ref): JSX.Element => {\n const {\n defaultCollapsed = false,\n width = 200,\n collapsedWidth = 70,\n theme = 'light',\n trigger = null,\n collapsible = false,\n onCollapse,\n className,\n style,\n children,\n prefixCls: customisedCls,\n ...otherProps\n } = props;\n\n const [sideCollapsed, setSideCollapsed] = useState(\n 'collapsed' in props ? props.collapsed : defaultCollapsed\n );\n const sidebarContext = useContext(SidebarContext);\n const sidebarWidth = sideCollapsed ? collapsedWidth : width;\n\n const outerStyle = {\n ...style,\n width: sidebarWidth,\n maxWidth: sidebarWidth,\n minWidth: sidebarWidth,\n };\n\n const configContext = useContext(ConfigContext);\n const prefixCls = getPrefixCls('layout-sidebar', configContext.prefixCls, customisedCls);\n const cls = classNames(prefixCls, className, {\n [`${prefixCls}_light`]: theme === 'light',\n });\n\n const _collapseBtnOnClick = () => {\n const collapsedVal = !sideCollapsed;\n if (!('collapsed' in props)) {\n setSideCollapsed(collapsedVal);\n }\n onCollapse && onCollapse(collapsedVal);\n };\n\n const renderTrigger = () => {\n if (!collapsible) {\n return null;\n }\n\n if (trigger) {\n return trigger;\n }\n\n return (\n <button type=\"button\" className={`${prefixCls}__trigger`} onClick={_collapseBtnOnClick} aria-label=\"Toggle sidebar\">\n <IconLeft className={`${prefixCls}__trigger-icon`} />\n </button>\n );\n };\n\n useEffect(() => {\n 'collapsed' in props && setSideCollapsed(props.collapsed);\n sidebarContext.addSidebar();\n\n return () => {\n sidebarContext.removeSidebar();\n };\n }, [props, sidebarContext]);\n\n return (\n <div {...otherProps} ref={ref} className={cls} style={outerStyle}>\n <div className={`${prefixCls}__children`}>{children}</div>\n {renderTrigger()}\n </div>\n );\n }\n);\n\nSidebar.displayName = 'Sidebar';\n\nexport default Sidebar;\n"],"mappings":";;;;;;;;;;;AASA,MAAM,UAAUA,MAAAA,QAAM,YACnB,OAAqB,QAAqB;CACzC,MAAM,EACJ,mBAAmB,OACnB,QAAQ,KACR,iBAAiB,IACjB,QAAQ,SACR,UAAU,MACV,cAAc,OACd,YACA,WACA,OACA,UACA,WAAW,eACX,GAAG,eACD;CAEJ,MAAM,CAAC,eAAe,qBAAA,GAAA,MAAA,UACpB,eAAe,QAAQ,MAAM,YAAY,iBAC1C;CACD,MAAM,kBAAA,GAAA,MAAA,YAA4BC,wBAAAA,eAAe;CACjD,MAAM,eAAe,gBAAgB,iBAAiB;CAEtD,MAAM,aAAa;EACjB,GAAG;EACH,OAAO;EACP,UAAU;EACV,UAAU;EACX;CAGD,MAAM,YAAYC,gBAAAA,aAAa,mBAAA,GAAA,MAAA,YADEC,uBAAAA,cAAc,CACgB,WAAW,cAAc;CACxF,MAAM,OAAA,GAAA,WAAA,SAAiB,WAAW,WAAW,GAC1C,GAAG,UAAU,UAAU,UAAU,SACnC,CAAC;CAEF,MAAM,4BAA4B;EAChC,MAAM,eAAe,CAAC;AACtB,MAAI,EAAE,eAAe,OACnB,kBAAiB,aAAa;AAEhC,gBAAc,WAAW,aAAa;;CAGxC,MAAM,sBAAsB;AAC1B,MAAI,CAAC,YACH,QAAO;AAGT,MAAI,QACF,QAAO;AAGT,SACE,iBAAA,GAAA,kBAAA,KAAC,UAAD;GAAQ,MAAK;GAAS,WAAW,GAAG,UAAU;GAAY,SAAS;GAAqB,cAAW;aACjG,iBAAA,GAAA,kBAAA,KAACC,mBAAAA,UAAD,EAAU,WAAW,GAAG,UAAU,iBAAmB,CAAA;GAC9C,CAAA;;AAIb,EAAA,GAAA,MAAA,iBAAgB;AACd,iBAAe,SAAS,iBAAiB,MAAM,UAAU;AACzD,iBAAe,YAAY;AAE3B,eAAa;AACX,kBAAe,eAAe;;IAE/B,CAAC,OAAO,eAAe,CAAC;AAE3B,QACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;EAAK,GAAI;EAAiB;EAAK,WAAW;EAAK,OAAO;YAAtD,CACE,iBAAA,GAAA,kBAAA,KAAC,OAAD;GAAK,WAAW,GAAG,UAAU;GAAc;GAAe,CAAA,EACzD,eAAe,CACZ;;EAGX;AAED,QAAQ,cAAc"}
|
|
File without changes
|
package/lib/list/list.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","names":["React","ConfigContext","getPrefixCls","useVirtualScroll","Pagination"],"sources":["../../src/list/list.tsx"],"sourcesContent":["import React, { useContext, useState } from 'react';\nimport classNames from 'classnames';\nimport { ConfigContext } from '../config-provider/config-context';\nimport { getPrefixCls } from '../_utils/general';\nimport { useVirtualScroll } from '../_utils/use-virtual-scroll';\nimport Pagination from '../pagination';\nimport { ListProps } from './types';\n\nconst ITEM_HEIGHT_MAP = { sm: 41, md: 49, lg: 57 } as const;\n\nconst List = React.forwardRef<HTMLDivElement, ListProps>((props, ref) => {\n const {\n dataSource = [],\n renderItem,\n header,\n footer,\n loading = false,\n bordered = false,\n split = true,\n size,\n grid,\n locale,\n virtual = false,\n height,\n itemHeight: itemHeightProp,\n pagination,\n prefixCls: customisedCls,\n className,\n style,\n children,\n ...otherProps\n } = props;\n\n const configContext = useContext(ConfigContext);\n const prefixCls = getPrefixCls('list', configContext.prefixCls, customisedCls);\n const listSize = size || configContext.componentSize || 'md';\n\n if (virtual && height == null) {\n console.warn('[tiny-
|
|
1
|
+
{"version":3,"file":"list.js","names":["React","ConfigContext","getPrefixCls","useVirtualScroll","Pagination"],"sources":["../../src/list/list.tsx"],"sourcesContent":["import React, { useContext, useState } from 'react';\nimport classNames from 'classnames';\nimport { ConfigContext } from '../config-provider/config-context';\nimport { getPrefixCls } from '../_utils/general';\nimport { useVirtualScroll } from '../_utils/use-virtual-scroll';\nimport Pagination from '../pagination';\nimport { ListProps } from './types';\n\nconst ITEM_HEIGHT_MAP = { sm: 41, md: 49, lg: 57 } as const;\n\nconst List = React.forwardRef<HTMLDivElement, ListProps>((props, ref) => {\n const {\n dataSource = [],\n renderItem,\n header,\n footer,\n loading = false,\n bordered = false,\n split = true,\n size,\n grid,\n locale,\n virtual = false,\n height,\n itemHeight: itemHeightProp,\n pagination,\n prefixCls: customisedCls,\n className,\n style,\n children,\n ...otherProps\n } = props;\n\n const configContext = useContext(ConfigContext);\n const prefixCls = getPrefixCls('list', configContext.prefixCls, customisedCls);\n const listSize = size || configContext.componentSize || 'md';\n\n if (virtual && height == null) {\n console.warn('[tiny-design: List] `height` is required when `virtual` is enabled.');\n }\n if (virtual && grid) {\n console.warn('[tiny-design: List] `virtual` is not supported with `grid` mode. Falling back to normal rendering.');\n }\n\n const isVirtual = virtual && height != null && !grid;\n\n const [currentPage, setCurrentPage] = useState(1);\n const pageSize = pagination && pagination.pageSize ? pagination.pageSize : 10;\n\n const itemHeight = itemHeightProp ?? ITEM_HEIGHT_MAP[listSize] ?? ITEM_HEIGHT_MAP.md;\n const { visibleRange, totalHeight, offsetY, onScroll } = useVirtualScroll({\n itemCount: dataSource.length,\n itemHeight,\n containerHeight: height ?? 0,\n });\n\n const cls = classNames(prefixCls, className, {\n [`${prefixCls}_${listSize}`]: listSize,\n [`${prefixCls}_bordered`]: bordered,\n [`${prefixCls}_split`]: split,\n [`${prefixCls}_loading`]: loading,\n [`${prefixCls}_grid`]: grid,\n });\n\n const paginatedData = () => {\n if (!pagination) return dataSource;\n const page = pagination.current ?? currentPage;\n const start = (page - 1) * pageSize;\n return dataSource.slice(start, start + pageSize);\n };\n\n const handlePageChange = (page: number) => {\n setCurrentPage(page);\n pagination && pagination.onChange?.(page, pageSize);\n };\n\n const renderItems = () => {\n if (isVirtual) {\n if (dataSource.length === 0) {\n return (\n <div className={`${prefixCls}__empty`}>\n {locale?.emptyText ?? 'No Data'}\n </div>\n );\n }\n if (renderItem) {\n const [start, end] = visibleRange;\n const visibleItems = dataSource.slice(start, end + 1).map((item, i) => renderItem(item, start + i));\n return (\n <div style={{ height: totalHeight, position: 'relative' }}>\n <div style={{ position: 'absolute', top: 0, left: 0, right: 0, transform: `translateY(${offsetY}px)` }}>\n {visibleItems}\n </div>\n </div>\n );\n }\n return children;\n }\n\n const items = paginatedData();\n if (items.length === 0 && !children) {\n return (\n <div className={`${prefixCls}__empty`}>\n {locale?.emptyText ?? 'No Data'}\n </div>\n );\n }\n if (renderItem) {\n const rendered = items.map((item, index) => renderItem(item, index));\n if (grid) {\n return (\n <div\n className={`${prefixCls}__grid`}\n style={{\n display: 'grid',\n gridTemplateColumns: `repeat(${grid.column || 3}, 1fr)`,\n gap: grid.gutter ? `${grid.gutter}px` : undefined,\n }}\n >\n {rendered}\n </div>\n );\n }\n return rendered;\n }\n return children;\n };\n\n const showPagination = pagination && !isVirtual;\n const paginationConfig = pagination && typeof pagination === 'object' ? pagination : undefined;\n const totalItems = paginationConfig?.total ?? dataSource.length;\n const activePage = paginationConfig?.current ?? currentPage;\n\n const bodyCls = classNames(`${prefixCls}__body`, {\n [`${prefixCls}__body_virtual`]: isVirtual,\n });\n\n const bodyStyle: React.CSSProperties | undefined = isVirtual\n ? { height, overflowY: 'auto' }\n : undefined;\n\n return (\n <div {...otherProps} ref={ref} className={cls} style={style}>\n {header && <div className={`${prefixCls}__header`}>{header}</div>}\n <div className={bodyCls} style={bodyStyle} onScroll={isVirtual ? onScroll : undefined}>\n {loading ? (\n <div className={`${prefixCls}__loading`}>Loading...</div>\n ) : (\n renderItems()\n )}\n </div>\n {footer && <div className={`${prefixCls}__footer`}>{footer}</div>}\n {showPagination && (\n <Pagination\n current={activePage}\n total={totalItems}\n pageSize={pageSize}\n align={paginationConfig?.align ?? 'right'}\n size={paginationConfig?.size}\n disabled={paginationConfig?.disabled}\n onChange={(page) => handlePageCh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mBAAmB,cAAc,OAAO,eAAe,WAAW,aAAa,KAAA;CACrF,MAAM,aAAa,kBAAkB,SAAS,WAAW;CACzD,MAAM,aAAa,kBAAkB,WAAW;CAEhD,MAAM,WAAA,GAAA,WAAA,SAAqB,GAAG,UAAU,SAAS,GAC9C,GAAG,UAAU,kBAAkB,WACjC,CAAC;CAEF,MAAM,YAA6C,YAC/C;EAAE;EAAQ,WAAW;EAAQ,GAC7B,KAAA;AAEJ,QACE,iBAAA,GAAA,kBAAA,MAAC,OAAD;EAAK,GAAI;EAAiB;EAAK,WAAW;EAAY;YAAtD;GACG,UAAU,iBAAA,GAAA,kBAAA,KAAC,OAAD;IAAK,WAAW,GAAG,UAAU;cAAY;IAAa,CAAA;GACjE,iBAAA,GAAA,kBAAA,KAAC,OAAD;IAAK,WAAW;IAAS,OAAO;IAAW,UAAU,YAAY,WAAW,KAAA;cACzE,UACC,iBAAA,GAAA,kBAAA,KAAC,OAAD;KAAK,WAAW,GAAG,UAAU;eAAY;KAAgB,CAAA,GAEzD,aAAa;IAEX,CAAA;GACL,UAAU,iBAAA,GAAA,kBAAA,KAAC,OAAD;IAAK,WAAW,GAAG,UAAU;cAAY;IAAa,CAAA;GAChE,kBACC,iBAAA,GAAA,kBAAA,KAACC,cAAAA,SAAD;IACE,SAAS;IACT,OAAO;IACG;IACV,OAAO,kBAAkB,SAAS;IAClC,MAAM,kBAAkB;IACxB,UAAU,kBAAkB;IAC5B,WAAW,SAAS,iBAAiB,KAAK;IAC1C,OAAO,EAAE,SAAS,IAAI;IACtB,CAAA;GAEA;;EAER;AAEF,KAAK,cAAc"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|