tntd 3.0.0-beta.9 → 3.0.1
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/es/array-input/index.js +57 -42
- package/es/array-input/index.js.map +1 -1
- package/es/array-input/index.less +4 -1
- package/es/button/button.js +3 -7
- package/es/button/button.js.map +1 -1
- package/es/button/button.less +17 -12
- package/es/collapse/collapse.less +3 -3
- package/es/date-picker/index.less +6 -6
- package/es/date-picker/style/Calendar.less +1 -1
- package/es/date-picker/style/RangePicker.less +3 -3
- package/es/descriptions/descriptions.js +36 -18
- package/es/descriptions/descriptions.js.map +1 -1
- package/es/descriptions/descriptions.less +6 -2
- package/es/descriptions/style/index.less +1 -0
- package/es/drawer/drawer.js +32 -22
- package/es/drawer/drawer.js.map +1 -1
- package/es/drawer/index.less +13 -14
- package/es/drawer/style/drawer.less +2 -4
- package/es/form/form.less +12 -6
- package/es/form/style/index.less +6 -6
- package/es/handle-icon/index.js +201 -0
- package/es/handle-icon/index.js.map +1 -0
- package/es/handle-icon/index.less +53 -0
- package/es/icon/style/style.less +1 -1
- package/es/index.js +1 -0
- package/es/index.js.map +1 -1
- package/es/input/input.js +10 -6
- package/es/input/input.js.map +1 -1
- package/es/input/style/mixin.less +1 -2
- package/es/locale/en_US.js +3 -0
- package/es/locale/en_US.js.map +1 -1
- package/es/locale/zh_CN.js +3 -0
- package/es/locale/zh_CN.js.map +1 -1
- package/es/mentions/style/index.less +1 -0
- package/es/modal/style/confirm.less +6 -10
- package/es/modal/style/modal.less +1 -1
- package/es/page-container/index.js +1 -1
- package/es/page-container/index.js.map +1 -1
- package/es/page-container/index.less +1 -0
- package/es/page-loading/index.js +1 -1
- package/es/page-loading/index.js.map +1 -1
- package/es/query-form/Field/SelectInput.js +4 -22
- package/es/query-form/Field/SelectInput.js.map +1 -1
- package/es/query-form/Field/fieldsMap.js +2 -2
- package/es/query-form/Field/fieldsMap.js.map +1 -1
- package/es/query-form/Field/index.js +0 -1
- package/es/query-form/Field/index.js.map +1 -1
- package/es/query-form/index.js +127 -117
- package/es/query-form/index.js.map +1 -1
- package/es/query-form/index.less +9 -12
- package/es/{query-form → query-form-backup}/Field/Composition/index.less +1 -1
- package/es/query-form-backup/index.less +90 -0
- package/es/query-list-scene/QueryForm.js +1 -3
- package/es/query-list-scene/QueryForm.js.map +1 -1
- package/es/select/select.js +5 -3
- package/es/select/select.js.map +1 -1
- package/es/select/select.less +1 -3
- package/es/select/style/index.less +7 -6
- package/es/spin/index.js +3 -2
- package/es/spin/index.js.map +1 -1
- package/es/spin/spin.js +36 -0
- package/es/spin/spin.js.map +1 -0
- package/es/spin/spin.less +9 -0
- package/es/style/themes/default.less +1 -1
- package/es/table/expand.less +49 -0
- package/es/table/hooks/index.js +2 -1
- package/es/table/hooks/index.js.map +1 -1
- package/es/table/hooks/use-expand-fixed.js +80 -0
- package/es/table/hooks/use-expand-fixed.js.map +1 -0
- package/es/table/index.js +1 -0
- package/es/table/index.js.map +1 -1
- package/es/table/style/index.less +58 -88
- package/es/table/table.js +48 -14
- package/es/table/table.js.map +1 -1
- package/es/table/table.less +13 -22
- package/es/table/table.stories.js +413 -2
- package/es/table/table.stories.js.map +1 -1
- package/es/table/utils.js +11 -0
- package/es/table/utils.js.map +1 -1
- package/es/table-container/index.js +1 -1
- package/es/table-container/index.js.map +1 -1
- package/es/table-container/index.less +14 -14
- package/es/tabs/tabs.js +9 -1
- package/es/tabs/tabs.js.map +1 -1
- package/es/tabs/tabs.less +52 -62
- package/es/tabs-container/index.js +1 -1
- package/es/tabs-container/index.js.map +1 -1
- package/es/tag/color.less +28 -18
- package/es/tag/index.js +1 -1
- package/es/tag/index.js.map +1 -1
- package/es/tag/tag.less +41 -5
- package/es/title/index.js +4 -3
- package/es/title/index.js.map +1 -1
- package/es/tntd-action/Action.js +58 -12
- package/es/tntd-action/Action.js.map +1 -1
- package/es/tntd-action/index.less +5 -3
- package/es/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js +5 -11
- package/es/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js.map +1 -1
- package/es/tntd-cascader/AntdCascader/index.less +14 -2
- package/es/tntd-cascader/rc-cascader/OptionList/Column.js +3 -2
- package/es/tntd-cascader/rc-cascader/OptionList/Column.js.map +1 -1
- package/es/tntd-cascader/rc-cascader/OptionList/index.js +1 -0
- package/es/tntd-cascader/rc-cascader/OptionList/index.js.map +1 -1
- package/es/tntd-form/FormItem/ItemHolder.js +1 -6
- package/es/tntd-form/FormItem/ItemHolder.js.map +1 -1
- package/es/tntd-form/FormItemLabel.js +2 -0
- package/es/tntd-form/FormItemLabel.js.map +1 -1
- package/es/tntd-select/index.js +13 -9
- package/es/tntd-select/index.js.map +1 -1
- package/es/tntd-select/index.less +7 -0
- package/es/tooltip/index.js +1 -0
- package/es/tooltip/index.js.map +1 -1
- package/es/tooltip/index.less +1 -2
- package/lib/array-input/index.d.ts +1 -12
- package/lib/array-input/index.d.ts.map +1 -1
- package/lib/array-input/index.js +62 -55
- package/lib/array-input/index.js.map +1 -1
- package/lib/array-input/index.less +4 -1
- package/lib/button/button.d.ts.map +1 -1
- package/lib/button/button.js +3 -15
- package/lib/button/button.js.map +1 -1
- package/lib/button/button.less +17 -12
- package/lib/collapse/collapse.less +3 -3
- package/lib/date-picker/index.less +6 -6
- package/lib/date-picker/style/Calendar.less +1 -1
- package/lib/date-picker/style/RangePicker.less +3 -3
- package/lib/descriptions/descriptions.d.ts.map +1 -1
- package/lib/descriptions/descriptions.js +40 -20
- package/lib/descriptions/descriptions.js.map +1 -1
- package/lib/descriptions/descriptions.less +6 -2
- package/lib/descriptions/style/index.less +1 -0
- package/lib/drawer/drawer.d.ts +3 -0
- package/lib/drawer/drawer.d.ts.map +1 -1
- package/lib/drawer/drawer.js +30 -20
- package/lib/drawer/drawer.js.map +1 -1
- package/lib/drawer/index.less +13 -14
- package/lib/drawer/style/drawer.less +2 -4
- package/lib/form/form.less +12 -6
- package/lib/form/style/index.less +6 -6
- package/lib/handle-icon/index.d.ts +7 -0
- package/lib/handle-icon/index.d.ts.map +1 -0
- package/lib/handle-icon/index.js +221 -0
- package/lib/handle-icon/index.js.map +1 -0
- package/lib/handle-icon/index.less +53 -0
- package/lib/icon/style/style.less +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +7 -0
- package/lib/index.js.map +1 -1
- package/lib/input/input.js +8 -4
- package/lib/input/input.js.map +1 -1
- package/lib/input/style/mixin.less +1 -2
- package/lib/locale/default.d.ts +3 -0
- package/lib/locale/default.d.ts.map +1 -1
- package/lib/locale/en_US.d.ts +3 -0
- package/lib/locale/en_US.d.ts.map +1 -1
- package/lib/locale/en_US.js +3 -0
- package/lib/locale/en_US.js.map +1 -1
- package/lib/locale/zh_CN.d.ts +3 -0
- package/lib/locale/zh_CN.d.ts.map +1 -1
- package/lib/locale/zh_CN.js +3 -0
- package/lib/locale/zh_CN.js.map +1 -1
- package/lib/mentions/style/index.less +1 -0
- package/lib/modal/style/confirm.less +6 -10
- package/lib/modal/style/modal.less +1 -1
- package/lib/page-container/index.js +1 -1
- package/lib/page-container/index.js.map +1 -1
- package/lib/page-container/index.less +1 -0
- package/lib/page-loading/index.js +1 -1
- package/lib/page-loading/index.js.map +1 -1
- package/lib/query-form/Field/SelectInput.d.ts.map +1 -1
- package/lib/query-form/Field/SelectInput.js +3 -15
- package/lib/query-form/Field/SelectInput.js.map +1 -1
- package/lib/query-form/Field/fieldsMap.d.ts +3 -6
- package/lib/query-form/Field/fieldsMap.js +2 -2
- package/lib/query-form/Field/fieldsMap.js.map +1 -1
- package/lib/query-form/Field/index.d.ts.map +1 -1
- package/lib/query-form/Field/index.js +0 -1
- package/lib/query-form/Field/index.js.map +1 -1
- package/lib/query-form/index.d.ts +7 -4
- package/lib/query-form/index.d.ts.map +1 -1
- package/lib/query-form/index.js +149 -143
- package/lib/query-form/index.js.map +1 -1
- package/lib/query-form/index.less +9 -12
- package/lib/{query-form → query-form-backup}/Field/Composition/index.less +1 -1
- package/lib/query-form-backup/index.less +90 -0
- package/lib/query-list-scene/QueryForm.js +2 -3
- package/lib/query-list-scene/QueryForm.js.map +1 -1
- package/lib/select/select.d.ts.map +1 -1
- package/lib/select/select.js +4 -2
- package/lib/select/select.js.map +1 -1
- package/lib/select/select.less +1 -3
- package/lib/select/style/index.less +7 -6
- package/lib/spin/index.d.ts +3 -2
- package/lib/spin/index.d.ts.map +1 -1
- package/lib/spin/index.js +4 -6
- package/lib/spin/index.js.map +1 -1
- package/lib/spin/spin.d.ts +9 -0
- package/lib/spin/spin.d.ts.map +1 -0
- package/lib/spin/spin.js +44 -0
- package/lib/spin/spin.js.map +1 -0
- package/lib/spin/spin.less +9 -0
- package/lib/style/themes/default.less +1 -1
- package/lib/table/expand.less +49 -0
- package/lib/table/hooks/index.d.ts +1 -0
- package/lib/table/hooks/index.d.ts.map +1 -1
- package/lib/table/hooks/index.js +11 -0
- package/lib/table/hooks/index.js.map +1 -1
- package/lib/table/hooks/use-expand-fixed.d.ts +4 -0
- package/lib/table/hooks/use-expand-fixed.d.ts.map +1 -0
- package/lib/table/hooks/use-expand-fixed.js +110 -0
- package/lib/table/hooks/use-expand-fixed.js.map +1 -0
- package/lib/table/index.d.ts +1 -0
- package/lib/table/index.d.ts.map +1 -1
- package/lib/table/index.js +1 -0
- package/lib/table/index.js.map +1 -1
- package/lib/table/style/index.less +58 -88
- package/lib/table/table.d.ts +3 -1
- package/lib/table/table.d.ts.map +1 -1
- package/lib/table/table.js +49 -11
- package/lib/table/table.js.map +1 -1
- package/lib/table/table.less +13 -22
- package/lib/table/table.stories.d.ts +106 -29
- package/lib/table/table.stories.d.ts.map +1 -1
- package/lib/table/table.stories.js +426 -3
- package/lib/table/table.stories.js.map +1 -1
- package/lib/table/utils.d.ts +1 -0
- package/lib/table/utils.d.ts.map +1 -1
- package/lib/table/utils.js +13 -0
- package/lib/table/utils.js.map +1 -1
- package/lib/table-container/index.d.ts.map +1 -1
- package/lib/table-container/index.js +1 -1
- package/lib/table-container/index.js.map +1 -1
- package/lib/table-container/index.less +14 -14
- package/lib/tabs/tabs.d.ts.map +1 -1
- package/lib/tabs/tabs.js +8 -0
- package/lib/tabs/tabs.js.map +1 -1
- package/lib/tabs/tabs.less +52 -62
- package/lib/tabs-container/index.js +1 -1
- package/lib/tabs-container/index.js.map +1 -1
- package/lib/tag/color.less +28 -18
- package/lib/tag/index.js +1 -1
- package/lib/tag/index.js.map +1 -1
- package/lib/tag/tag.less +41 -5
- package/lib/title/index.d.ts +1 -0
- package/lib/title/index.d.ts.map +1 -1
- package/lib/title/index.js +3 -2
- package/lib/title/index.js.map +1 -1
- package/lib/tntd-action/Action.d.ts +1 -1
- package/lib/tntd-action/Action.js +63 -13
- package/lib/tntd-action/Action.js.map +1 -1
- package/lib/tntd-action/index.less +5 -3
- package/lib/tntd-cascader/AntdCascader/component/defaultRenderEmpty.d.ts.map +1 -1
- package/lib/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js +5 -11
- package/lib/tntd-cascader/AntdCascader/component/defaultRenderEmpty.js.map +1 -1
- package/lib/tntd-cascader/AntdCascader/index.less +14 -2
- package/lib/tntd-cascader/rc-cascader/OptionList/Column.d.ts +1 -1
- package/lib/tntd-cascader/rc-cascader/OptionList/Column.d.ts.map +1 -1
- package/lib/tntd-cascader/rc-cascader/OptionList/Column.js +3 -2
- package/lib/tntd-cascader/rc-cascader/OptionList/Column.js.map +1 -1
- package/lib/tntd-cascader/rc-cascader/OptionList/index.d.ts.map +1 -1
- package/lib/tntd-cascader/rc-cascader/OptionList/index.js +1 -0
- package/lib/tntd-cascader/rc-cascader/OptionList/index.js.map +1 -1
- package/lib/tntd-form/FormItem/ItemHolder.js +1 -6
- package/lib/tntd-form/FormItem/ItemHolder.js.map +1 -1
- package/lib/tntd-form/FormItemLabel.d.ts.map +1 -1
- package/lib/tntd-form/FormItemLabel.js +2 -0
- package/lib/tntd-form/FormItemLabel.js.map +1 -1
- package/lib/tntd-select/index.d.ts.map +1 -1
- package/lib/tntd-select/index.js +12 -8
- package/lib/tntd-select/index.js.map +1 -1
- package/lib/tntd-select/index.less +7 -0
- package/lib/tooltip/index.d.ts +1 -0
- package/lib/tooltip/index.d.ts.map +1 -1
- package/lib/tooltip/index.js +1 -0
- package/lib/tooltip/index.js.map +1 -1
- package/lib/tooltip/index.less +1 -2
- package/package.json +4 -3
- package/themes/default/variables.less +2 -2
- package/themes/default/variablesVar.less +2 -2
- package/es/array-input/1.png +0 -1
- package/es/array-input/111.gif +0 -0
- package/es/array-input/icon.js +0 -25
- package/es/array-input/icon.js.map +0 -1
- package/es/query-form/Field/Composition/FieldPopover.js +0 -308
- package/es/query-form/Field/Composition/FieldPopover.js.map +0 -1
- package/es/query-form/Field/Composition/Select.js +0 -104
- package/es/query-form/Field/Composition/Select.js.map +0 -1
- package/es/query-form/Field/Composition/index.js +0 -299
- package/es/query-form/Field/Composition/index.js.map +0 -1
- package/es/query-form/Field/Composition/utils.js +0 -19
- package/es/query-form/Field/Composition/utils.js.map +0 -1
- package/lib/array-input/1.png +0 -1
- package/lib/array-input/111.gif +0 -0
- package/lib/array-input/icon.d.ts +0 -4
- package/lib/array-input/icon.d.ts.map +0 -1
- package/lib/array-input/icon.js +0 -32
- package/lib/array-input/icon.js.map +0 -1
- package/lib/query-form/Field/Composition/FieldPopover.d.ts +0 -19
- package/lib/query-form/Field/Composition/FieldPopover.d.ts.map +0 -1
- package/lib/query-form/Field/Composition/FieldPopover.js +0 -347
- package/lib/query-form/Field/Composition/FieldPopover.js.map +0 -1
- package/lib/query-form/Field/Composition/Select.d.ts +0 -4
- package/lib/query-form/Field/Composition/Select.d.ts.map +0 -1
- package/lib/query-form/Field/Composition/Select.js +0 -128
- package/lib/query-form/Field/Composition/Select.js.map +0 -1
- package/lib/query-form/Field/Composition/index.d.ts +0 -14
- package/lib/query-form/Field/Composition/index.d.ts.map +0 -1
- package/lib/query-form/Field/Composition/index.js +0 -349
- package/lib/query-form/Field/Composition/index.js.map +0 -1
- package/lib/query-form/Field/Composition/utils.d.ts +0 -6
- package/lib/query-form/Field/Composition/utils.d.ts.map +0 -1
- package/lib/query-form/Field/Composition/utils.js +0 -27
- package/lib/query-form/Field/Composition/utils.js.map +0 -1
- /package/es/{query-form → query-form-backup}/Field/Composition/FieldPopover.less +0 -0
- /package/lib/{query-form → query-form-backup}/Field/Composition/FieldPopover.less +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-expand-fixed.js","sourceRoot":"","sources":["../../../src/table/hooks/use-expand-fixed.ts"],"names":[],"mappings":";;;AAAA,iCAAyC;AACzC,oCAAyC;AAUlC,MAAM,cAAc,GAAG,GAAG,EAAE;IACjC,MAAM,WAAW,GAAG,IAAA,cAAM,EAAU,IAAA,sBAAc,GAAE,CAAC,CAAA;IACrD,MAAM,YAAY,GAAG,IAAA,cAAM,EAAgB,IAAI,CAAC,CAAA;IAChD,MAAM,eAAe,GAAG,IAAA,cAAM,EAAS;QACrC,IAAI,EAAE,IAAI;QACV,KAAK,EAAE,IAAI;QACX,IAAI,EAAE,IAAI;KACX,CAAC,CAAA;IACF,MAAM,SAAS,GAAG,IAAA,cAAM,EAAwB,IAAI,CAAC,CAAA;IACrD,MAAM,QAAQ,GAAG,IAAA,cAAM,EAA0B,IAAI,CAAC,CAAA;IAEtD,MAAM,MAAM,GAAG,CAAC,GAAgC,EAAE,EAAE;QAClD,MAAM,IAAI,GACP,QAAQ,CAAC,aAAa,CACrB,IAAI,WAAW,CAAC,OAAO,qCAAqC,GAAG,cAAc,CAC3D;YACnB,QAAQ,CAAC,aAAa,CACrB,IAAI,WAAW,CAAC,OAAO,sCAAsC,GAAG,cAAc,CAC5D,CAAA;QACtB,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAClC,IAAI,WAAW,CAAC,OAAO,0CAA0C,GAAG,cAAc,CACjE,CAAA;QACnB,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CACjC,IAAI,WAAW,CAAC,OAAO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AAc,kBAgG1B;AAEM,MAAM,UAAU,GAAG,CACxB,MAAW,EACX,MAAyD,EACzD,EAAE;IACF,IAAI,GAAG,GAAoB,EAAE,CAAA;IAC7B,IAAI,OAAO,MAAM,KAAK,UAAU,EAAE;QAChC,GAAG,GAAG,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;KAC9B;SAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE;QACrC,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;KACrB;IAED,OAAO,GAAG,CAAA;AACZ,CAAC,CAAA;AAZY,QAAA,UAAU,cAYtB","sourcesContent":["import { useEffect, useRef } from 'react'\nimport { makeRandomCode } from '../utils'\n\nexport type keyType = string | number | null\n\ninterface OldDom {\n main: HTMLDivElement | null\n right: HTMLDivElement | null\n left: HTMLDivElement | null\n}\n\nexport const useExpandFixed = () => {\n const curTableKey = useRef<keyType>(makeRandomCode())\n const activeKeyRef = useRef<string | null>(null)\n const oldActiveKeyRef = useRef<OldDom>({\n main: null,\n right: null,\n left: null,\n })\n const container = useRef<HTMLDivElement | null>(null)\n const observer = useRef<MutationObserver | null>(null)\n\n const getDom = (key: string | number | undefined) => {\n const main =\n (document.querySelector(\n `.${curTableKey.current} .ant-table-scroll [data-row-key=\"${key}-extra-row\"]`\n ) as HTMLDivElement) ||\n (document.querySelector(\n `.${curTableKey.current} .ant-table-default [data-row-key=\"${key}-extra-row\"]`\n ) as HTMLDivElement)\n const right = document.querySelector(\n `.${curTableKey.current} .ant-table-fixed-right [data-row-key=\"${key}-extra-row\"]`\n ) as HTMLDivElement\n const left = document.querySelector(\n `.${curTableKey.current} .ant-table-fixed-left [data-row-key=\"${key}-extra-row\"]`\n ) as HTMLDivElement\n return [main, right, left]\n }\n\n const expand = async () => {\n const [main, right, left] = getDom(String(activeKeyRef.current) || '')\n const border = 2\n const height = main?.offsetHeight - border || 0\n if (right) {\n right.setAttribute('style', `display: inline-block; height: ${height}px; overflow: hidden;`)\n }\n\n if (left) {\n left.setAttribute('style', `display: inline-block; height: ${height}px; overflow: hidden;`)\n }\n\n if (main) {\n // 解决 expandIconAsCell为true 且 iconCell的td元素为display: none;时, 展开内容滚动到最右边,会多出一部分iconCell所占据的空间 的问题\n const td = main.childNodes[1] as HTMLDivElement\n\n const colspan = td.getAttribute('colspan') || 0\n const Oldcolspan = td.getAttribute('oldcolspan') || 0\n const newColspan = Oldcolspan ? Oldcolspan : Number(colspan) + 1 + ''\n if (!Oldcolspan) td.setAttribute('oldcolspan', newColspan)\n\n td.setAttribute('colspan', newColspan)\n //\n }\n\n oldActiveKeyRef.current = {\n main,\n right,\n left,\n }\n }\n\n const ob = () => {\n const classname = curTableKey.current\n if (!classname) return\n\n container.current = document.querySelector(\n `.${classname}.ant-table-wrapper.collapse-panel > .ant-spin-nested-loading > .ant-spin-container > .ant-table`\n ) as HTMLDivElement\n\n observer.current = new MutationObserver(expand)\n if(container.current) {\n observer.current.observe(container.current, {\n childList: true, // 子节点的变动\n attributes: true,\n })\n }\n }\n\n const setChangedKey = (key: string) => {\n activeKeyRef.current = key\n }\n\n const trigger = (key: string) => {\n setChangedKey(key)\n const className = curTableKey.current\n if (!className) return\n const dom = document?.querySelector(\n `.${className}.ant-table-wrapper.collapse-panel > .ant-spin-nested-loading > .ant-spin-container > .ant-table`\n )\n dom?.setAttribute('c-data', 'Mutation')\n }\n\n useEffect(() => {\n ob()\n }, [curTableKey.current])\n\n return [curTableKey.current, trigger as (key: string) => void] as const\n}\n\nexport const findRowKey = (\n record: any,\n rowKey: string | ((record: any, index: number) => string)\n) => {\n let res: string | number = ''\n if (typeof rowKey === 'function') {\n res = [record].map(rowKey)[0]\n } else if (typeof rowKey === 'string') {\n res = record[rowKey]\n }\n\n return res\n}\n"]}
|
package/lib/table/index.d.ts
CHANGED
package/lib/table/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAA;AAChB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,cAAc,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/table/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAA;AAChB,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAC/B,OAAO,cAAc,CAAA;AACrB,OAAO,eAAe,CAAA;AAEtB,cAAc,SAAS,CAAA;AAEvB,eAAe,KAAK,CAAA"}
|
package/lib/table/index.js
CHANGED
package/lib/table/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/table/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mBAAgB;AAChB,mCAA+B;AAC/B,wBAAqB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/table/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mBAAgB;AAChB,mCAA+B;AAC/B,wBAAqB;AACrB,yBAAsB;AAEtB,0CAAuB;AAEvB,kBAAe,aAAK,CAAA","sourcesContent":["import './style'\nimport { Table } from './table'\nimport './table.less'\nimport './expand.less'\n\nexport * from './table'\n\nexport default Table\n"]}
|
|
@@ -95,7 +95,7 @@
|
|
|
95
95
|
.@{table-prefix-cls}-column-sorter-up,
|
|
96
96
|
.@{table-prefix-cls}-column-sorter-down {
|
|
97
97
|
.iconfont-size-under-12px(11px);
|
|
98
|
-
|
|
98
|
+
font-size: 12px !important;
|
|
99
99
|
display: block;
|
|
100
100
|
height: 1em;
|
|
101
101
|
line-height: 1em;
|
|
@@ -233,7 +233,7 @@
|
|
|
233
233
|
transition: all 0.3s, height 0s;
|
|
234
234
|
&.@{table-prefix-cls}-row-hover,
|
|
235
235
|
&:hover {
|
|
236
|
-
&:not(.@{table-prefix-cls}-expanded-row)
|
|
236
|
+
&:not(.@{table-prefix-cls}-expanded-row) {
|
|
237
237
|
box-shadow: 0px 0px 5px -5px rgba(0, 0, 0, 0.05), 0px 0px 25px 0px rgba(0, 0, 0, 0.1);
|
|
238
238
|
position: relative;
|
|
239
239
|
> td {
|
|
@@ -243,45 +243,16 @@
|
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
|
|
246
|
-
&-thead > tr,
|
|
247
|
-
&-tbody > tr {
|
|
248
|
-
transition: all 0.3s, height 0s;
|
|
249
|
-
// &.@{table-prefix-cls}-row-hover,
|
|
250
|
-
// &:hover {
|
|
251
|
-
// &:not(.@{table-prefix-cls}-expanded-row):not(.@{table-prefix-cls}-row-selected) {
|
|
252
|
-
// box-shadow: 0px 0px 5px -5px rgba(0, 0, 0, 0.05), 0px 0px 25px 0px rgba(0, 0, 0, 0.1);
|
|
253
|
-
// position: relative;
|
|
254
|
-
// > td {
|
|
255
|
-
// background: @table-row-hover-bg;
|
|
256
|
-
// }
|
|
257
|
-
// }
|
|
258
|
-
// }
|
|
259
|
-
&.@{table-prefix-cls}-row-selected > td {
|
|
260
|
-
&.@{table-prefix-cls}-column-sort {
|
|
261
|
-
background: @table-body-selected-sort-bg;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
&:hover {
|
|
265
|
-
&.@{table-prefix-cls}-row-selected > td {
|
|
266
|
-
background: @table-selected-row-hover-bg;
|
|
267
|
-
&.@{table-prefix-cls}-column-sort {
|
|
268
|
-
background: @table-body-selected-sort-bg;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
246
|
&-thead > tr:hover {
|
|
275
247
|
background: none;
|
|
276
248
|
}
|
|
277
249
|
|
|
278
250
|
&-footer {
|
|
279
|
-
position: relative;
|
|
251
|
+
// position: relative;
|
|
280
252
|
padding: @table-padding-vertical @table-padding-horizontal;
|
|
281
253
|
color: @table-footer-color;
|
|
282
254
|
background: @table-footer-bg;
|
|
283
255
|
border-top: @border-width-base @border-style-base @border-color-split;
|
|
284
|
-
border-radius: 0 0 @table-border-radius-base @table-border-radius-base;
|
|
285
256
|
&::before {
|
|
286
257
|
position: absolute;
|
|
287
258
|
top: -1px;
|
|
@@ -293,26 +264,25 @@
|
|
|
293
264
|
}
|
|
294
265
|
}
|
|
295
266
|
|
|
296
|
-
&.@{table-prefix-cls}-bordered &-footer {
|
|
297
|
-
|
|
298
|
-
}
|
|
267
|
+
// &.@{table-prefix-cls}-bordered &-footer {
|
|
268
|
+
// border: @border-width-base @border-style-base @border-color-split;
|
|
269
|
+
// }
|
|
299
270
|
|
|
300
271
|
&-title {
|
|
301
|
-
position: relative;
|
|
302
|
-
top: 1px;
|
|
272
|
+
// position: relative;
|
|
273
|
+
// top: 1px;
|
|
303
274
|
padding: @table-padding-vertical 0;
|
|
304
|
-
border-radius: @table-border-radius-base @table-border-radius-base 0 0;
|
|
305
275
|
}
|
|
306
276
|
|
|
307
277
|
&.@{table-prefix-cls}-bordered &-title {
|
|
308
278
|
padding-right: @table-padding-horizontal;
|
|
309
279
|
padding-left: @table-padding-horizontal;
|
|
310
|
-
border: @border-width-base @border-style-base @border-color-split;
|
|
280
|
+
border-bottom: @border-width-base @border-style-base @border-color-split;
|
|
311
281
|
}
|
|
312
282
|
|
|
313
283
|
&-title + &-content {
|
|
314
284
|
position: relative;
|
|
315
|
-
border-radius: @table-border-radius-base @table-border-radius-base 0 0;
|
|
285
|
+
// border-radius: @table-border-radius-base @table-border-radius-base 0 0;
|
|
316
286
|
|
|
317
287
|
.@{table-prefix-cls}-bordered & {
|
|
318
288
|
&,
|
|
@@ -336,8 +306,22 @@
|
|
|
336
306
|
}
|
|
337
307
|
|
|
338
308
|
&-tbody > tr.@{table-prefix-cls}-row-selected td {
|
|
339
|
-
color: @table-selected-row-color;
|
|
340
|
-
background: @table-selected-row-bg;
|
|
309
|
+
// color: @table-selected-row-color;
|
|
310
|
+
// background: @table-selected-row-bg;
|
|
311
|
+
&.@{table-prefix-cls}-selection-column {
|
|
312
|
+
position: relative;
|
|
313
|
+
&::after {
|
|
314
|
+
content: ' ';
|
|
315
|
+
width: 4px;
|
|
316
|
+
height: calc(100% - 10px);
|
|
317
|
+
background: @blue-5;
|
|
318
|
+
display: block;
|
|
319
|
+
position: absolute;
|
|
320
|
+
top: 5px;
|
|
321
|
+
left: 0;
|
|
322
|
+
border-radius: 0 4px 4px 0;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
341
325
|
}
|
|
342
326
|
|
|
343
327
|
&-thead > tr > th.@{table-prefix-cls}-column-sort {
|
|
@@ -397,41 +381,26 @@
|
|
|
397
381
|
}
|
|
398
382
|
|
|
399
383
|
&-bordered {
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
.@{table-prefix-cls}-
|
|
404
|
-
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
}
|
|
412
|
-
|
|
413
|
-
.@{table-prefix-cls}-fixed-right table {
|
|
414
|
-
.@{table-prefix-cls}-hide-cell-borders & {
|
|
415
|
-
border-left: 0;
|
|
416
|
-
}
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
.@{table-prefix-cls}-body > table {
|
|
420
|
-
border-radius: @border-radius-base;
|
|
421
|
-
}
|
|
384
|
+
border: @border-width-base @border-style-base @border-color-split;
|
|
385
|
+
border-radius: @border-radius-base;
|
|
386
|
+
overflow: hidden;
|
|
387
|
+
// .@{table-prefix-cls}-header > table,
|
|
388
|
+
// .@{table-prefix-cls}-body > table,
|
|
389
|
+
// .@{table-prefix-cls}-fixed-left table,
|
|
390
|
+
// .@{table-prefix-cls}-fixed-right table {
|
|
391
|
+
// border: @border-width-base @border-style-base @border-color-split;
|
|
392
|
+
// border-right: 0;
|
|
393
|
+
// border-bottom: 0;
|
|
394
|
+
// }
|
|
422
395
|
|
|
423
396
|
&.@{table-prefix-cls}-empty {
|
|
424
397
|
.@{table-prefix-cls}-body > table {
|
|
425
398
|
border-radius: @border-radius-base @border-radius-base 0 0;
|
|
426
399
|
}
|
|
427
400
|
.@{table-prefix-cls}-placeholder {
|
|
428
|
-
border: @border-width-base @border-style-base @border-color-split;
|
|
429
|
-
border-
|
|
430
|
-
border-
|
|
431
|
-
.@{table-prefix-cls}-has-footer & {
|
|
432
|
-
border-bottom: none;
|
|
433
|
-
border-radius: 0;
|
|
434
|
-
}
|
|
401
|
+
// border-right: @border-width-base @border-style-base @border-color-split;
|
|
402
|
+
// border-left: @border-width-base @border-style-base @border-color-split;
|
|
403
|
+
border-bottom: 0;
|
|
435
404
|
}
|
|
436
405
|
}
|
|
437
406
|
|
|
@@ -459,24 +428,27 @@
|
|
|
459
428
|
.@{table-prefix-cls}-tbody > tr > td {
|
|
460
429
|
border-right: @border-width-base @border-style-base @border-color-split;
|
|
461
430
|
&:last-child {
|
|
462
|
-
border-right:
|
|
431
|
+
border-right: 0;
|
|
463
432
|
}
|
|
464
433
|
}
|
|
465
|
-
.@{table-prefix-cls}-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
&:
|
|
469
|
-
border-
|
|
434
|
+
.@{table-prefix-cls}-fixed-left {
|
|
435
|
+
.@{table-prefix-cls}-thead > tr > th,
|
|
436
|
+
.@{table-prefix-cls}-tbody > tr > td {
|
|
437
|
+
&:last-child {
|
|
438
|
+
border-right: @border-width-base @border-style-base @border-color-split;
|
|
470
439
|
}
|
|
471
440
|
}
|
|
472
441
|
}
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
442
|
+
.@{table-prefix-cls}-content:has(.@{table-prefix-cls}-fixed-right) .@{table-prefix-cls}-scroll {
|
|
443
|
+
.@{table-prefix-cls}-thead > tr > th {
|
|
444
|
+
&:last-child {
|
|
445
|
+
border-right: @border-width-base @border-style-base @border-color-split;
|
|
446
|
+
}
|
|
478
447
|
}
|
|
479
448
|
}
|
|
449
|
+
.@{table-prefix-cls}-tbody > tr:last-child > td {
|
|
450
|
+
border-bottom: 0;
|
|
451
|
+
}
|
|
480
452
|
}
|
|
481
453
|
|
|
482
454
|
&-placeholder {
|
|
@@ -488,12 +460,9 @@
|
|
|
488
460
|
font-size: @font-size-base;
|
|
489
461
|
text-align: center;
|
|
490
462
|
background: @component-background;
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
border-radius: @border-radius-base;
|
|
494
|
-
.@{table-prefix-cls}-has-footer & {
|
|
495
|
-
border-radius: 0;
|
|
496
|
-
}
|
|
463
|
+
border-top: @border-width-base @border-style-base @border-color-split;
|
|
464
|
+
border-bottom: @border-width-base @border-style-base @border-color-split;
|
|
465
|
+
// border-radius: 0 0 @border-radius-base @border-radius-base;
|
|
497
466
|
}
|
|
498
467
|
|
|
499
468
|
&-pagination.@{ant-prefix}-pagination {
|
|
@@ -681,6 +650,7 @@
|
|
|
681
650
|
&-scroll {
|
|
682
651
|
overflow: auto;
|
|
683
652
|
overflow-x: hidden;
|
|
653
|
+
border-radius: @border-radius-base @border-radius-base 0 0;
|
|
684
654
|
table {
|
|
685
655
|
min-width: 100%;
|
|
686
656
|
|
package/lib/table/table.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export declare type TableProps<T> = Omit<AntdTableProps<T>, 'locale'> & {
|
|
|
7
7
|
enableToolbar?: boolean;
|
|
8
8
|
showCellBorders?: boolean;
|
|
9
9
|
striped?: boolean;
|
|
10
|
+
sticky?: boolean;
|
|
10
11
|
shadowed?: boolean;
|
|
11
12
|
locale?: AntdTableProps<T>['locale'] & {
|
|
12
13
|
loadingDescription?: string;
|
|
@@ -15,11 +16,12 @@ export declare type TableProps<T> = Omit<AntdTableProps<T>, 'locale'> & {
|
|
|
15
16
|
refresh?(): void;
|
|
16
17
|
unUpperConverted?: boolean;
|
|
17
18
|
unTooltip?: boolean;
|
|
19
|
+
smallPadding?: boolean;
|
|
18
20
|
upperCaseIgnore?: string[];
|
|
19
21
|
rowClassName?: (record: T, index: number) => string;
|
|
20
22
|
};
|
|
21
23
|
export declare const Table: {
|
|
22
|
-
<T>({ className, locale, bordered, size, storageKey, columns, children, shadowed, striped, showCellBorders, enableToolbar, refresh, upperCaseIgnore, unUpperConverted, unTooltip, rowClassName, ...rest }: TableProps<T>): React.JSX.Element;
|
|
24
|
+
<T>({ className, locale, bordered, size, storageKey, columns, children, sticky, shadowed, striped, showCellBorders, enableToolbar, refresh, upperCaseIgnore, unUpperConverted, unTooltip, smallPadding, rowClassName, ...rest }: TableProps<T>): React.JSX.Element;
|
|
23
25
|
Column: typeof Column;
|
|
24
26
|
ColumnGroup: typeof ColumnGroup;
|
|
25
27
|
displayName: string;
|
package/lib/table/table.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/table/table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,IAAI,cAAc,EAI7B,MAAM,eAAe,CAAA;AAEtB,OAAO,MAAM,MAAM,sBAAsB,CAAA;AACzC,OAAO,WAAW,MAAM,2BAA2B,CAAA;AAEnD,OAAO,
|
|
1
|
+
{"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../src/table/table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,UAAU,IAAI,cAAc,EAI7B,MAAM,eAAe,CAAA;AAEtB,OAAO,MAAM,MAAM,sBAAsB,CAAA;AACzC,OAAO,WAAW,MAAM,2BAA2B,CAAA;AAEnD,OAAO,KAAoC,MAAM,OAAO,CAAA;AAoBxD,oBAAY,UAAU,CAAC,CAAC,IAAI,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG;QACrC,kBAAkB,CAAC,EAAE,MAAM,CAAA;QAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;KACnB,CAAA;IACD,OAAO,CAAC,IAAI,IAAI,CAAA;IAChB,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;IAC1B,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;CACpD,CAAA;AAmBD,eAAO,MAAM,KAAK;;;;;;CAiQjB,CAAA"}
|
package/lib/table/table.js
CHANGED
|
@@ -21,6 +21,7 @@ var _utils = require("./utils");
|
|
|
21
21
|
var _lang = require("../utils/lang");
|
|
22
22
|
var _totalShower = require("./total-shower");
|
|
23
23
|
var _prevLocale = require("../prev-locale");
|
|
24
|
+
var _rcResizeObserver = _interopRequireDefault(require("rc-resize-observer"));
|
|
24
25
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
25
26
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
26
27
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
@@ -77,6 +78,8 @@ var Table = exports.Table = function Table(_a) {
|
|
|
77
78
|
storageKey = _a.storageKey,
|
|
78
79
|
columns = _a.columns,
|
|
79
80
|
children = _a.children,
|
|
81
|
+
_a$sticky = _a.sticky,
|
|
82
|
+
sticky = _a$sticky === void 0 ? false : _a$sticky,
|
|
80
83
|
shadowed = _a.shadowed,
|
|
81
84
|
_a$striped = _a.striped,
|
|
82
85
|
striped = _a$striped === void 0 ? true : _a$striped,
|
|
@@ -88,8 +91,9 @@ var Table = exports.Table = function Table(_a) {
|
|
|
88
91
|
upperCaseIgnore = _a.upperCaseIgnore,
|
|
89
92
|
unUpperConverted = _a.unUpperConverted,
|
|
90
93
|
unTooltip = _a.unTooltip,
|
|
94
|
+
smallPadding = _a.smallPadding,
|
|
91
95
|
rowClassName = _a.rowClassName,
|
|
92
|
-
rest = __rest(_a, ["className", "locale", "bordered", "size", "storageKey", "columns", "children", "shadowed", "striped", "showCellBorders", "enableToolbar", "refresh", "upperCaseIgnore", "unUpperConverted", "unTooltip", "rowClassName"]);
|
|
96
|
+
rest = __rest(_a, ["className", "locale", "bordered", "size", "storageKey", "columns", "children", "sticky", "shadowed", "striped", "showCellBorders", "enableToolbar", "refresh", "upperCaseIgnore", "unUpperConverted", "unTooltip", "smallPadding", "rowClassName"]);
|
|
93
97
|
var tableContainer = (0, _react.useRef)(null);
|
|
94
98
|
// const [innerSize, setInnerSize] = useLocalStorage<TableProps<T>['size']>(
|
|
95
99
|
// TABLE_SIZE_STORAGE_KEY,
|
|
@@ -107,7 +111,6 @@ var Table = exports.Table = function Table(_a) {
|
|
|
107
111
|
var _a;
|
|
108
112
|
if (striped || rowClassName || ((_a = rest.rowSelection) === null || _a === void 0 ? void 0 : _a.getCheckboxProps)) {
|
|
109
113
|
return function (record, index) {
|
|
110
|
-
var _a;
|
|
111
114
|
var back = [];
|
|
112
115
|
if (rowClassName) {
|
|
113
116
|
if ((0, _isFunction2["default"])(rowClassName)) {
|
|
@@ -119,17 +122,21 @@ var Table = exports.Table = function Table(_a) {
|
|
|
119
122
|
if (striped && index % 2 === 1) {
|
|
120
123
|
back.push("".concat(prefixCls, "-row-even"));
|
|
121
124
|
}
|
|
122
|
-
if (
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}
|
|
125
|
+
// if (rest.rowSelection?.getCheckboxProps) {
|
|
126
|
+
// const checkboxProps: any = rest.rowSelection.getCheckboxProps(record)
|
|
127
|
+
// if (checkboxProps && checkboxProps.disabled) {
|
|
128
|
+
// back.push(`${prefixCls}-row-disabled`)
|
|
129
|
+
// }
|
|
130
|
+
// }
|
|
128
131
|
return back.join(' ');
|
|
129
132
|
};
|
|
130
133
|
}
|
|
131
134
|
return rowClassName;
|
|
132
135
|
};
|
|
136
|
+
var _useState = (0, _react.useState)(Number),
|
|
137
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
138
|
+
fixedWidth = _useState2[0],
|
|
139
|
+
setFixedWidth = _useState2[1];
|
|
133
140
|
var lang = (0, _prevLocale.getLanguage)();
|
|
134
141
|
var newColumns = displayColumns;
|
|
135
142
|
// 非中文做处理
|
|
@@ -209,6 +216,32 @@ var Table = exports.Table = function Table(_a) {
|
|
|
209
216
|
// setInnerSize(size)
|
|
210
217
|
// }
|
|
211
218
|
// }, [setInnerSize, size])
|
|
219
|
+
/**
|
|
220
|
+
* expand 与 fix 兼容,expand悬浮
|
|
221
|
+
*/
|
|
222
|
+
var _useExpandFixed = (0, _hooks.useExpandFixed)(),
|
|
223
|
+
_useExpandFixed2 = _slicedToArray(_useExpandFixed, 2),
|
|
224
|
+
tableKey = _useExpandFixed2[0],
|
|
225
|
+
trigger = _useExpandFixed2[1];
|
|
226
|
+
var stickyProps = (0, _react.useMemo)(function () {
|
|
227
|
+
return {
|
|
228
|
+
onExpandedRowsChange: function onExpandedRowsChange(arg) {
|
|
229
|
+
var key = arg && arg[arg.length - 1];
|
|
230
|
+
if (rest === null || rest === void 0 ? void 0 : rest.onExpandedRowsChange) rest === null || rest === void 0 ? void 0 : rest.onExpandedRowsChange([Number(key)]);
|
|
231
|
+
// 触发MutationObserver监听
|
|
232
|
+
trigger(key);
|
|
233
|
+
},
|
|
234
|
+
expandedRowRender: (rest === null || rest === void 0 ? void 0 : rest.expandedRowRender) ? function (record, index, indent, expanded) {
|
|
235
|
+
var padding = 0;
|
|
236
|
+
return _react["default"].createElement("div", {
|
|
237
|
+
className: "ant-table-expanded-row-fixed",
|
|
238
|
+
style: {
|
|
239
|
+
width: fixedWidth + padding
|
|
240
|
+
}
|
|
241
|
+
}, (rest === null || rest === void 0 ? void 0 : rest.expandedRowRender) && (rest === null || rest === void 0 ? void 0 : rest.expandedRowRender(record, index, indent, expanded)));
|
|
242
|
+
} : undefined
|
|
243
|
+
};
|
|
244
|
+
}, [rest === null || rest === void 0 ? void 0 : rest.expandedRowRender, rest === null || rest === void 0 ? void 0 : rest.onExpandedRowsChange, trigger]);
|
|
212
245
|
return _react["default"].createElement(_context.TableContext.Provider, {
|
|
213
246
|
value: {
|
|
214
247
|
// size: innerSize,
|
|
@@ -230,16 +263,21 @@ var Table = exports.Table = function Table(_a) {
|
|
|
230
263
|
}, function (localeObject) {
|
|
231
264
|
// const locale = localeObject as Record<string, string>
|
|
232
265
|
// const paginationConfig = pagination ? getDefaultPagination(locale) : pagination
|
|
233
|
-
return _react["default"].createElement(
|
|
266
|
+
return _react["default"].createElement(_rcResizeObserver["default"], {
|
|
267
|
+
onResize: function onResize(_ref2) {
|
|
268
|
+
var width = _ref2.width;
|
|
269
|
+
setFixedWidth(width);
|
|
270
|
+
}
|
|
271
|
+
}, _react["default"].createElement(_table["default"], Object.assign({
|
|
234
272
|
className: (0, _classnames["default"])(
|
|
235
273
|
// prefixCls,
|
|
236
|
-
'tnt-table-wrapper', _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-borderless"), !bordered), "".concat(prefixCls, "-hide-cell-borders"), !showCellBorders), "".concat(prefixCls, "-size-small"), size === 'small'), "".concat(prefixCls, "-size-middle"), size === 'middle'), "".concat(prefixCls, "-striped"), striped), "".concat(prefixCls, "-shadowed"), shadowed), "".concat(prefixCls, "-has-footer"), rest.footer), className),
|
|
274
|
+
'tnt-table-wrapper', "".concat(tableKey, " collapse-panel"), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-borderless"), !bordered), "".concat(prefixCls, "-hide-cell-borders"), !showCellBorders), "".concat(prefixCls, "-size-small"), size === 'small'), "".concat(prefixCls, "-size-middle"), size === 'middle'), "".concat(prefixCls, "-striped"), striped), "".concat(prefixCls, "-shadowed"), shadowed), "".concat(prefixCls, "-has-footer"), rest.footer), "".concat(prefixCls, "-small-padding"), smallPadding), "".concat(prefixCls, "-sticky"), sticky), className),
|
|
237
275
|
locale: locale,
|
|
238
276
|
bordered: bordered,
|
|
239
277
|
size: size,
|
|
240
278
|
columns: newColumns,
|
|
241
279
|
rowClassName: getRowClassName(prefixCls)
|
|
242
|
-
}, rest));
|
|
280
|
+
}, rest, sticky ? stickyProps : {})));
|
|
243
281
|
}));
|
|
244
282
|
}));
|
|
245
283
|
};
|
package/lib/table/table.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../src/table/table.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAAwD;AACxD,4FAAmE;AAOnE,0DAAoD;AACpD,kEAAyC;AACzC,4EAAmD;AACnD,4DAAmC;AACnC,+CAA2D;AAC3D,mCAA6C;AAC7C,2DAAkC;AAClC,uCAAwC;AACxC,mCAA0C;AAC1C,mCAA0C;AAC1C,wCAA8C;AAC9C,iDAA4C;AAC5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,OAAO;4BACjC,CAAC,GAAG,SAAS,WAAW,CAAC,EAAE,QAAQ;4BACnC,CAAC,GAAG,SAAS,aAAa,CAAC,EAAE,IAAI,CAAC,MAAM;yBACzC,EACD,SAAS,CACV,EACD,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,UAAU,EACnB,YAAY,EAAE,eAAe,CAAC,SAAS,CAAC,IACpC,IAAI,EACR,CACH,CAAA;gBACH,CAAC,CACc,CACb,CACP,CAAA;QACH,CAAC,CACc,CACK,CACzB,CAAA;AACH,CAAC,CAAA;AAxNY,QAAA,KAAK,SAwNjB;AAED,aAAK,CAAC,MAAM,GAAG,gBAAM,CAAA;AACrB,aAAK,CAAC,WAAW,GAAG,qBAAW,CAAA;AAC/B,aAAK,CAAC,WAAW,GAAG,OAAO,CAAA;AAC3B,aAAK,CAAC,cAAc,GAAG,qBAAc,CAAA","sourcesContent":["import { ConfigConsumer } from 'antd/lib/config-provider'\nimport LocaleReceiver from 'antd/lib/locale-provider/LocaleReceiver'\nimport type {\n TableProps as AntdTableProps,\n ColumnProps,\n TableStateFilters,\n SortOrder,\n} from 'antd/lib/table'\nimport { default as AntdTable } from 'antd/lib/table'\nimport Column from 'antd/lib/table/Column'\nimport ColumnGroup from 'antd/lib/table/ColumnGroup'\nimport classNames from 'classnames'\nimport React, { useCallback, useMemo, useRef } from 'react'\nimport { isFunction, isString } from 'lodash'\nimport Ellipsis from '../ellipsis'\nimport { TableContext } from './context'\nimport { useColumnSetting } from './hooks'\nimport { normalizeColumns } from './utils'\nimport { titleCaseUpper } from '../utils/lang'\nimport { TotalShower } from './total-shower'\nimport { getLanguage } from '../prev-locale'\n\nconst sizeWidthMap = {\n default: 40, //20\n middle: 20, //10\n small: 20, //10\n xs: 16, // 8\n}\n\nexport type TableProps<T> = Omit<AntdTableProps<T>, 'locale'> & {\n storageKey?: string\n enableToolbar?: boolean\n showCellBorders?: boolean\n striped?: boolean\n shadowed?: boolean\n locale?: AntdTableProps<T>['locale'] & {\n loadingDescription?: string\n emptyText?: string\n }\n refresh?(): void\n unUpperConverted?: boolean // 不要转换表头\n unTooltip?: boolean // 不要tooltip\n upperCaseIgnore?: string[]\n rowClassName?: (record: T, index: number) => string\n}\n\nconst getDefaultPagination = (locale: NonNullable<AntdTableProps<unknown>['locale']>) => ({\n showTotal: (total: number) => <TotalShower total={total} locale={locale} />,\n})\n\n// 判断是否是特殊的tooltip\n// const checkIsPrompt = (dom: any): boolean => {\n// let isPrompt: boolean = false\n// if (React.isValidElement(dom)) {\n// if (dom?.type && typeof dom?.type === 'function') {\n// if (['Tooltip', 'Popconfirm'].includes(dom?.type?.name)) {\n// isPrompt = true\n// }\n// }\n// }\n// return isPrompt\n// }\n\nexport const Table = <T,>({\n className,\n locale,\n bordered,\n size,\n storageKey,\n columns,\n children,\n shadowed,\n striped = true,\n showCellBorders = false,\n // pagination,\n enableToolbar = false,\n refresh,\n upperCaseIgnore,\n unUpperConverted, // 强制不要转换\n unTooltip,\n rowClassName,\n ...rest\n}: TableProps<T>) => {\n const tableContainer = useRef<HTMLDivElement>(null)\n // const [innerSize, setInnerSize] = useLocalStorage<TableProps<T>['size']>(\n // TABLE_SIZE_STORAGE_KEY,\n // 'default'\n // )\n const normalizedColumns = useMemo(\n () => columns || normalizeColumns<T>(children as React.ReactChildren),\n [children, columns]\n )\n const [displayColumns, columnSetting, setColumnSetting] = useColumnSetting(\n normalizedColumns,\n storageKey\n )\n\n const getRowClassName = (prefixCls: string) => {\n if (striped || rowClassName || rest.rowSelection?.getCheckboxProps) {\n return (record: T, index: number) => {\n const back = []\n if (rowClassName) {\n if (isFunction(rowClassName)) {\n back.push(rowClassName(record, index))\n } else if (isString(rowClassName)) {\n back.push(rowClassName)\n }\n }\n if (striped && index % 2 === 1) {\n back.push(`${prefixCls}-row-even`)\n }\n if (rest.rowSelection?.getCheckboxProps) {\n const checkboxProps: any = rest.rowSelection.getCheckboxProps(record)\n if (checkboxProps && checkboxProps.disabled) {\n back.push(`${prefixCls}-row-disabled`)\n }\n }\n return back.join(' ')\n }\n }\n return rowClassName\n }\n\n const lang = getLanguage()\n let newColumns = displayColumns\n // 非中文做处理\n if (lang !== 'cn') {\n if (!unUpperConverted) {\n newColumns = displayColumns?.map((column) => {\n return {\n ...column,\n title: (options: {\n filters: TableStateFilters\n sortOrder?: SortOrder\n sortColumn?: ColumnProps<T> | null\n }) => {\n let title = column.title\n if (typeof title === 'function') {\n title = title(options)\n }\n\n if (React.isValidElement(title)) {\n const renderChildren = (children: [] | string): React.ReactNode => {\n if (React.isValidElement(children) || Array.isArray(children)) {\n return React?.Children?.map(children, (child) => {\n if (React.isValidElement(child)) {\n const childProps = (child.props || {}) as any\n return React.cloneElement(child, {\n ...childProps,\n children: childProps.children?.length\n ? renderChildren(childProps.children)\n : childProps.children,\n title: titleCaseUpper(childProps?.title, upperCaseIgnore),\n })\n } else {\n return titleCaseUpper(child, upperCaseIgnore)\n }\n })\n }\n\n return titleCaseUpper(children, upperCaseIgnore)\n }\n\n return renderChildren(title.props.children)\n }\n\n if (typeof title === 'string') {\n return titleCaseUpper(title, upperCaseIgnore)\n }\n },\n }\n })\n }\n if (!unTooltip) {\n newColumns = newColumns?.map((column) => {\n if (!(column.width && !String(column.width).includes('%'))) {\n return column\n } else {\n return {\n ...column,\n title: (options: {\n filters: TableStateFilters\n sortOrder?: SortOrder\n sortColumn?: ColumnProps<T> | null\n }) => {\n let title = column.title\n if (typeof title === 'function') {\n title = title(options)\n }\n\n let widthLimitObj = {}\n if (column.width && !String(column.width).includes('%')) {\n let width = column.width\n if (typeof width === 'string') {\n width = width?.replace(/[^\\d]/g, ' ')\n }\n widthLimitObj = {\n widthLimit:\n Number(width) -\n Number(sizeWidthMap[size || 'default']) -\n (column.sorter ? 20 : 0),\n }\n }\n return (\n <Ellipsis\n {...widthLimitObj}\n placement={column?.placement || 'topLeft'}\n title={title}\n />\n )\n },\n }\n }\n })\n }\n }\n\n /**\n * update the innerSize when props size changes\n */\n // useEffect(() => {\n // if (size) {\n // setInnerSize(size)\n // }\n // }, [setInnerSize, size])\n\n return (\n <TableContext.Provider\n value={{\n // size: innerSize,\n tableContainer,\n columnSetting,\n refresh,\n upperCaseIgnore,\n // setSize: setInnerSize,\n setColumnSetting,\n }}\n >\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n const prefixCls = getPrefixCls('table')\n return (\n <div ref={tableContainer}>\n <LocaleReceiver componentName=\"Table\" defaultLocale={locale}>\n {(localeObject) => {\n // const locale = localeObject as Record<string, string>\n // const paginationConfig = pagination ? getDefaultPagination(locale) : pagination\n return (\n <AntdTable\n className={classNames(\n // prefixCls,\n 'tnt-table-wrapper',\n {\n [`${prefixCls}-borderless`]: !bordered,\n [`${prefixCls}-hide-cell-borders`]: !showCellBorders,\n [`${prefixCls}-size-small`]: size === 'small',\n [`${prefixCls}-size-middle`]: size === 'middle',\n [`${prefixCls}-striped`]: striped,\n [`${prefixCls}-shadowed`]: shadowed,\n [`${prefixCls}-has-footer`]: rest.footer,\n },\n className\n )}\n locale={locale}\n bordered={bordered}\n size={size}\n columns={newColumns}\n rowClassName={getRowClassName(prefixCls)}\n {...rest}\n />\n )\n }}\n </LocaleReceiver>\n </div>\n )\n }}\n </ConfigConsumer>\n </TableContext.Provider>\n )\n}\n\nTable.Column = Column\nTable.ColumnGroup = ColumnGroup\nTable.displayName = 'Table'\nTable.titleCaseUpper = titleCaseUpper\n"]}
|
|
1
|
+
{"version":3,"file":"table.js","sourceRoot":"","sources":["../../src/table/table.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6DAAwD;AACxD,4FAAmE;AAOnE,0DAAoD;AACpD,kEAAyC;AACzC,4EAAmD;AACnD,4DAAmC;AACnC,+CAAwD;AACxD,mCAA6C;AAC7C,2DAAkC;AAClC,uCAAwC;AACxC,mCAA0D;AAE1D,mCAA0C;AAC1C,wCAA8C;AAC9C,iD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EAAE,IAAI,KAAK,OAAO;gCAC7C,CAAC,GAAG,SAAS,cAAc,CAAC,EAAE,IAAI,KAAK,QAAQ;gCAC/C,CAAC,GAAG,SAAS,UAAU,CAAC,EAAE,OAAO;gCACjC,CAAC,GAAG,SAAS,WAAW,CAAC,EAAE,QAAQ;gCACnC,CAAC,GAAG,SAAS,aAAa,CAAC,EAAE,IAAI,CAAC,MAAM;gCACxC,CAAC,GAAG,SAAS,gBAAgB,CAAC,EAAE,YAAY;gCAC5C,CAAC,GAAG,SAAS,SAAS,CAAC,EAAE,MAAM;6BAChC,EACD,SAAS,CACV,EACD,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,QAAQ,EAClB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,UAAU,EACnB,YAAY,EAAE,eAAe,CAAC,SAAS,CAAC,IACpC,IAAI,EACJ,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC,EAC/B,CACa,CAClB,CAAA;gBACH,CAAC,CACc,CACb,CACP,CAAA;QACH,CAAC,CACc,CACK,CACzB,CAAA;AACH,CAAC,CAAA;AAjQY,QAAA,KAAK,SAiQjB;AAED,aAAK,CAAC,MAAM,GAAG,gBAAM,CAAA;AACrB,aAAK,CAAC,WAAW,GAAG,qBAAW,CAAA;AAC/B,aAAK,CAAC,WAAW,GAAG,OAAO,CAAA;AAC3B,aAAK,CAAC,cAAc,GAAG,qBAAc,CAAA","sourcesContent":["import { ConfigConsumer } from 'antd/lib/config-provider'\nimport LocaleReceiver from 'antd/lib/locale-provider/LocaleReceiver'\nimport type {\n TableProps as AntdTableProps,\n ColumnProps,\n TableStateFilters,\n SortOrder,\n} from 'antd/lib/table'\nimport { default as AntdTable } from 'antd/lib/table'\nimport Column from 'antd/lib/table/Column'\nimport ColumnGroup from 'antd/lib/table/ColumnGroup'\nimport classNames from 'classnames'\nimport React, { useMemo, useRef, useState } from 'react'\nimport { isFunction, isString } from 'lodash'\nimport Ellipsis from '../ellipsis'\nimport { TableContext } from './context'\nimport { useColumnSetting, useExpandFixed } from './hooks'\nimport type { keyType } from './hooks'\nimport { normalizeColumns } from './utils'\nimport { titleCaseUpper } from '../utils/lang'\nimport { TotalShower } from './total-shower'\nimport { getLanguage } from '../prev-locale'\nimport ResizeObserver from 'rc-resize-observer'\nimport { debounce } from 'lodash'\n\nconst sizeWidthMap = {\n default: 40, //20\n middle: 20, //10\n small: 20, //10\n xs: 16, // 8\n}\n\nexport type TableProps<T> = Omit<AntdTableProps<T>, 'locale'> & {\n storageKey?: string\n enableToolbar?: boolean\n showCellBorders?: boolean\n striped?: boolean\n sticky?: boolean\n shadowed?: boolean\n locale?: AntdTableProps<T>['locale'] & {\n loadingDescription?: string\n emptyText?: string\n }\n refresh?(): void\n unUpperConverted?: boolean // 不要转换表头\n unTooltip?: boolean // 不要tooltip\n smallPadding?: boolean // 缩小间距\n upperCaseIgnore?: string[]\n rowClassName?: (record: T, index: number) => string\n}\n\nconst getDefaultPagination = (locale: NonNullable<AntdTableProps<unknown>['locale']>) => ({\n showTotal: (total: number) => <TotalShower total={total} locale={locale} />,\n})\n\n// 判断是否是特殊的tooltip\n// const checkIsPrompt = (dom: any): boolean => {\n// let isPrompt: boolean = false\n// if (React.isValidElement(dom)) {\n// if (dom?.type && typeof dom?.type === 'function') {\n// if (['Tooltip', 'Popconfirm'].includes(dom?.type?.name)) {\n// isPrompt = true\n// }\n// }\n// }\n// return isPrompt\n// }\n\nexport const Table = <T,>({\n className,\n locale,\n bordered,\n size,\n storageKey,\n columns,\n children,\n sticky = false,\n shadowed,\n striped = true,\n showCellBorders = false,\n // pagination,\n enableToolbar = false,\n refresh,\n upperCaseIgnore,\n unUpperConverted, // 强制不要转换\n unTooltip,\n smallPadding,\n rowClassName,\n ...rest\n}: TableProps<T>) => {\n const tableContainer = useRef<HTMLDivElement>(null)\n // const [innerSize, setInnerSize] = useLocalStorage<TableProps<T>['size']>(\n // TABLE_SIZE_STORAGE_KEY,\n // 'default'\n // )\n\n const normalizedColumns = useMemo(\n () => columns || normalizeColumns<T>(children as React.ReactChildren),\n [children, columns]\n )\n const [displayColumns, columnSetting, setColumnSetting] = useColumnSetting(\n normalizedColumns,\n storageKey\n )\n\n const getRowClassName = (prefixCls: string) => {\n if (striped || rowClassName || rest.rowSelection?.getCheckboxProps) {\n return (record: T, index: number) => {\n const back = []\n if (rowClassName) {\n if (isFunction(rowClassName)) {\n back.push(rowClassName(record, index))\n } else if (isString(rowClassName)) {\n back.push(rowClassName)\n }\n }\n if (striped && index % 2 === 1) {\n back.push(`${prefixCls}-row-even`)\n }\n // if (rest.rowSelection?.getCheckboxProps) {\n // const checkboxProps: any = rest.rowSelection.getCheckboxProps(record)\n // if (checkboxProps && checkboxProps.disabled) {\n // back.push(`${prefixCls}-row-disabled`)\n // }\n // }\n return back.join(' ')\n }\n }\n return rowClassName\n }\n const [fixedWidth, setFixedWidth] = useState(Number)\n\n const lang = getLanguage()\n let newColumns = displayColumns\n // 非中文做处理\n if (lang !== 'cn') {\n if (!unUpperConverted) {\n newColumns = displayColumns?.map((column) => {\n return {\n ...column,\n title: (options: {\n filters: TableStateFilters\n sortOrder?: SortOrder\n sortColumn?: ColumnProps<T> | null\n }) => {\n let title = column.title\n if (typeof title === 'function') {\n title = title(options)\n }\n\n if (React.isValidElement(title)) {\n const renderChildren = (children: [] | string): React.ReactNode => {\n if (React.isValidElement(children) || Array.isArray(children)) {\n return React?.Children?.map(children, (child) => {\n if (React.isValidElement(child)) {\n const childProps = (child.props || {}) as any\n return React.cloneElement(child, {\n ...childProps,\n children: childProps.children?.length\n ? renderChildren(childProps.children)\n : childProps.children,\n title: titleCaseUpper(childProps?.title, upperCaseIgnore),\n })\n } else {\n return titleCaseUpper(child, upperCaseIgnore)\n }\n })\n }\n\n return titleCaseUpper(children, upperCaseIgnore)\n }\n\n return renderChildren(title.props.children)\n }\n\n if (typeof title === 'string') {\n return titleCaseUpper(title, upperCaseIgnore)\n }\n },\n }\n })\n }\n if (!unTooltip) {\n newColumns = newColumns?.map((column) => {\n if (!(column.width && !String(column.width).includes('%'))) {\n return column\n } else {\n return {\n ...column,\n title: (options: {\n filters: TableStateFilters\n sortOrder?: SortOrder\n sortColumn?: ColumnProps<T> | null\n }) => {\n let title = column.title\n if (typeof title === 'function') {\n title = title(options)\n }\n\n let widthLimitObj = {}\n if (column.width && !String(column.width).includes('%')) {\n let width = column.width\n if (typeof width === 'string') {\n width = width?.replace(/[^\\d]/g, ' ')\n }\n widthLimitObj = {\n widthLimit:\n Number(width) -\n Number(sizeWidthMap[size || 'default']) -\n (column.sorter ? 20 : 0),\n }\n }\n return (\n <Ellipsis\n {...widthLimitObj}\n placement={column?.placement || 'topLeft'}\n title={title}\n />\n )\n },\n }\n }\n })\n }\n }\n\n /**\n * update the innerSize when props size changes\n */\n // useEffect(() => {\n // if (size) {\n // setInnerSize(size)\n // }\n // }, [setInnerSize, size])\n\n /**\n * expand 与 fix 兼容,expand悬浮\n */\n const [tableKey, trigger] = useExpandFixed()\n\n const stickyProps = useMemo(() => {\n return {\n onExpandedRowsChange: (arg: string[] | number[]) => {\n const key: keyType = arg && arg[arg.length - 1]\n if (rest?.onExpandedRowsChange) rest?.onExpandedRowsChange([Number(key)])\n // 触发MutationObserver监听\n trigger(key as string)\n },\n expandedRowRender: rest?.expandedRowRender\n ? (record: T, index: number, indent: number, expanded: boolean) => {\n const padding = 0\n return (\n <div className=\"ant-table-expanded-row-fixed\" style={{ width: fixedWidth + padding }}>\n {rest?.expandedRowRender &&\n rest?.expandedRowRender(record, index, indent, expanded)}\n </div>\n )\n }\n : undefined,\n }\n }, [rest?.expandedRowRender, rest?.onExpandedRowsChange, trigger])\n\n return (\n <TableContext.Provider\n value={{\n // size: innerSize,\n tableContainer,\n columnSetting,\n refresh,\n upperCaseIgnore,\n // setSize: setInnerSize,\n setColumnSetting,\n }}\n >\n <ConfigConsumer>\n {({ getPrefixCls }) => {\n const prefixCls = getPrefixCls('table')\n return (\n <div ref={tableContainer}>\n <LocaleReceiver componentName=\"Table\" defaultLocale={locale}>\n {(localeObject) => {\n // const locale = localeObject as Record<string, string>\n // const paginationConfig = pagination ? getDefaultPagination(locale) : pagination\n return (\n <ResizeObserver\n onResize={({ width }) => {\n setFixedWidth(width)\n }}\n >\n <AntdTable\n className={classNames(\n // prefixCls,\n 'tnt-table-wrapper',\n `${tableKey} collapse-panel`,\n {\n [`${prefixCls}-borderless`]: !bordered,\n [`${prefixCls}-hide-cell-borders`]: !showCellBorders,\n [`${prefixCls}-size-small`]: size === 'small',\n [`${prefixCls}-size-middle`]: size === 'middle',\n [`${prefixCls}-striped`]: striped,\n [`${prefixCls}-shadowed`]: shadowed,\n [`${prefixCls}-has-footer`]: rest.footer,\n [`${prefixCls}-small-padding`]: smallPadding,\n [`${prefixCls}-sticky`]: sticky,\n },\n className\n )}\n locale={locale}\n bordered={bordered}\n size={size}\n columns={newColumns}\n rowClassName={getRowClassName(prefixCls)}\n {...rest}\n {...(sticky ? stickyProps : {})}\n />\n </ResizeObserver>\n )\n }}\n </LocaleReceiver>\n </div>\n )\n }}\n </ConfigConsumer>\n </TableContext.Provider>\n )\n}\n\nTable.Column = Column\nTable.ColumnGroup = ColumnGroup\nTable.displayName = 'Table'\nTable.titleCaseUpper = titleCaseUpper\n"]}
|
package/lib/table/table.less
CHANGED
|
@@ -8,25 +8,9 @@
|
|
|
8
8
|
background-color: @white;
|
|
9
9
|
border-radius: @border-radius-base;
|
|
10
10
|
|
|
11
|
-
.@{table-prefix-cls}-tbody > tr {
|
|
12
|
-
&.@{table-prefix-cls}-row-disabled {
|
|
13
|
-
&:hover,
|
|
14
|
-
& {
|
|
15
|
-
td {
|
|
16
|
-
background-color: @table-disabled-row-bg;
|
|
17
|
-
color: @table-disabled-row-text-color;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
11
|
&.@{table-prefix-cls}-borderless {
|
|
24
12
|
.@{table-prefix-cls}-small {
|
|
25
13
|
border: none;
|
|
26
|
-
|
|
27
|
-
> .ant-table-content .ant-table-row:last-child td {
|
|
28
|
-
// border-bottom: @border-width-base @border-style-base @border-color-split;
|
|
29
|
-
}
|
|
30
14
|
}
|
|
31
15
|
}
|
|
32
16
|
|
|
@@ -34,11 +18,16 @@
|
|
|
34
18
|
box-shadow: @table-borderless-shadow;
|
|
35
19
|
}
|
|
36
20
|
|
|
21
|
+
&.@{table-prefix-cls}-small-padding{
|
|
22
|
+
.@{table-prefix-cls}-tbody > tr > td {
|
|
23
|
+
padding-top: 8px;
|
|
24
|
+
padding-bottom: 8px;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
37
28
|
&.@{table-prefix-cls}-striped {
|
|
38
29
|
.@{table-prefix-cls}-tbody
|
|
39
|
-
> .@{table-prefix-cls}-row-even:not(:hover):not(.@{table-prefix-cls}-row-
|
|
40
|
-
.@{table-prefix-cls}-row-disabled
|
|
41
|
-
):not(.@{table-prefix-cls}-row-hover)
|
|
30
|
+
> .@{table-prefix-cls}-row-even:not(:hover):not(.@{table-prefix-cls}-row-hover)
|
|
42
31
|
> td {
|
|
43
32
|
background: @bg-grey-first;
|
|
44
33
|
}
|
|
@@ -52,9 +41,9 @@
|
|
|
52
41
|
}
|
|
53
42
|
|
|
54
43
|
&.@{table-prefix-cls}-hide-cell-borders {
|
|
55
|
-
.@{table-prefix-cls}-thead > tr > th
|
|
56
|
-
.@{table-prefix-cls}-tbody > tr > td
|
|
57
|
-
border-right: none;
|
|
44
|
+
.@{table-prefix-cls}-thead > tr > th,
|
|
45
|
+
.@{table-prefix-cls}-tbody > tr > td {
|
|
46
|
+
border-right: none !important;
|
|
58
47
|
}
|
|
59
48
|
}
|
|
60
49
|
&.@{table-prefix-cls}-hide-cell-borders {
|
|
@@ -97,6 +86,8 @@
|
|
|
97
86
|
.@{table-prefix-cls}-placeholder {
|
|
98
87
|
padding-top: @table-padding-horizontal;
|
|
99
88
|
padding-bottom: @table-padding-horizontal;
|
|
89
|
+
border-bottom: 0;
|
|
90
|
+
border-top: 0;
|
|
100
91
|
}
|
|
101
92
|
|
|
102
93
|
// customize the loading of table
|