tntd 3.0.0-beta.16 → 3.0.0-beta.19
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/descriptions/descriptions.js +20 -16
- 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 +9 -3
- package/es/drawer/drawer.js.map +1 -1
- package/es/handle-icon/index.js +11 -5
- package/es/handle-icon/index.js.map +1 -1
- package/es/handle-icon/index.less +7 -2
- package/es/page-container/index.js +1 -1
- package/es/page-container/index.js.map +1 -1
- package/es/page-loading/index.js +1 -1
- package/es/page-loading/index.js.map +1 -1
- package/es/query-form/Field/Checkbox.js +1 -1
- package/es/query-form/Field/Checkbox.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 +332 -149
- package/es/query-form/index.js.map +1 -1
- package/es/query-form/index.less +60 -17
- package/es/query-form-backup/Field/Composition/FieldPopover.less +35 -0
- package/es/query-form-backup/Field/Composition/index.less +114 -0
- package/es/query-form-backup/index.less +90 -0
- package/es/table/expand.less +51 -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 +76 -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 +17 -31
- package/es/table/table.js +115 -14
- package/es/table/table.js.map +1 -1
- package/es/table/table.less +8 -19
- 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/tabs-container/index.js +1 -1
- package/es/tabs-container/index.js.map +1 -1
- package/es/title/index.js +4 -3
- package/es/title/index.js.map +1 -1
- package/es/tntd-action/Action.js +57 -11
- package/es/tntd-action/Action.js.map +1 -1
- package/es/tntd-action/index.less +5 -3
- package/lib/descriptions/descriptions.d.ts.map +1 -1
- package/lib/descriptions/descriptions.js +23 -18
- 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 +2 -0
- package/lib/drawer/drawer.d.ts.map +1 -1
- package/lib/drawer/drawer.js +8 -2
- package/lib/drawer/drawer.js.map +1 -1
- package/lib/handle-icon/index.d.ts.map +1 -1
- package/lib/handle-icon/index.js +11 -4
- package/lib/handle-icon/index.js.map +1 -1
- package/lib/handle-icon/index.less +7 -2
- package/lib/page-container/index.js +1 -1
- package/lib/page-container/index.js.map +1 -1
- package/lib/page-loading/index.js +1 -1
- package/lib/page-loading/index.js.map +1 -1
- package/lib/query-form/Field/Checkbox.js +1 -1
- package/lib/query-form/Field/Checkbox.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 +27 -15
- package/lib/query-form/index.d.ts.map +1 -1
- package/lib/query-form/index.js +356 -171
- package/lib/query-form/index.js.map +1 -1
- package/lib/query-form/index.less +60 -17
- package/lib/query-form-backup/Field/Composition/FieldPopover.less +35 -0
- package/lib/query-form-backup/Field/Composition/index.less +114 -0
- package/lib/query-form-backup/index.less +90 -0
- package/lib/table/expand.less +51 -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 +106 -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 +17 -31
- package/lib/table/table.d.ts +4 -1
- package/lib/table/table.d.ts.map +1 -1
- package/lib/table/table.js +112 -11
- package/lib/table/table.js.map +1 -1
- package/lib/table/table.less +8 -19
- 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/tabs-container/index.js +1 -1
- package/lib/tabs-container/index.js.map +1 -1
- 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.js +62 -12
- package/lib/tntd-action/Action.js.map +1 -1
- package/lib/tntd-action/index.less +5 -3
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/query-form/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAmE;AACnE,4DAA2B;AAC3B,oEAA2C;AAC3C,oDAA2B;AAC3B,sEAA6C;AAC7C,wDAA+B;AAC/B,uDAA8B;AAC9B,mDAA0B;AAC1B,gDAAqD;AAErD,wBAAqB;AAErB,MAAM,SAAS,GAAG,eAAe,CAAA;AAEjC,SAAS,SAAS,CAAC,EAC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,EACpB,UAAU,EAAE,WAAW,EACvB,aAAa,EAAE,qBAAqB,EACpC,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,OAAO,CAAC,OAAO,GACrB,CACE,CACP,CACI,CACH,CACP,CAAA;AACH,CAAC;AAED,SAAS,CAAC,KAAK,GAAG,eAAK,CAAA;AACvB,SAAS,CAAC,OAAO,GAAG,iBAAO,CAAA;AAC3B,SAAS,CAAC,UAAU,GAAG,uBAAa,CAAA;AAEpC,kBAAe,SAAS,CAAA","sourcesContent":["import React, { useMemo, useRef, useEffect, useState } from 'react'\nimport cn from 'classnames'\nimport createActions from './createActions'\nimport Field from './Field'\nimport Composition from './Field/Composition'\nimport useForm from './useForm'\nimport Button from '../button'\nimport Form from '../form'\nimport { getLanguage, getText } from '../prev-locale'\n\nimport './index.less'\n\nconst clsPrefix = 'tnt-queryform'\n\nfunction QueryForm({\n form,\n className = '',\n initialValues: _initialValues,\n language,\n onSearch,\n onReset,\n onChange,\n renderActions,\n extraActions,\n children,\n showSearch = false,\n showReset = false,\n showFieldCount = 3,\n minGroupCount = 3, // 最小聚合个数\n}) {\n const [initialValues, setInitialValues] = useState(_initialValues || {})\n const formRef = useRef(form || createActions())\n\n useEffect(() => {\n const _search = (params = {}) => {\n onSearch({\n ...formRef.current.getValues(),\n ...params,\n })\n }\n formRef.current.setData('initialValues', initialValues)\n formRef.current.setData('values', initialValues)\n formRef.current.on('search', _search)\n return () => {\n formRef.current.off('search', _search)\n }\n }, [])\n\n const _getText = (key) => {\n return getText(key, language || getLanguage())\n }\n const _onSearch = () => {\n onSearch?.(formRef.current.getValues())\n }\n\n const _onReset = () => {\n formRef.current.setValues({ ...initialValues })\n onReset?.(initialValues)\n setInitialValues({ ...initialValues })\n }\n\n const _onFieldChange = (name, value, ...rest) => {\n const values = formRef.current.getValues()\n const newValues = {\n ...values,\n [name]: value,\n }\n const changedInfo = { name, value, preValue: values?.[name] }\n formRef.current.setData('values', newValues)\n onChange && onChange(newValues, changedInfo, ...rest)\n }\n\n const _onCompositionFieldChange = (value, deleteKeys, ...rest) => {\n const values = formRef.current.getValues()\n const newValues = {\n ...values,\n ...value,\n }\n if (deleteKeys?.length) {\n deleteKeys?.forEach((key) => {\n if (values?.[key]) {\n delete newValues[key]\n }\n })\n }\n formRef.current.setData('values', newValues)\n if (onChange) {\n Object.keys(values)?.forEach((key) => {\n if (JSON.stringify(value[key]) !== JSON.stringify(values[key] || '')) {\n const changedInfo = { name: key, value: value[key], preValue: values?.[key] }\n onChange(newValues, changedInfo, ...rest)\n }\n })\n }\n }\n\n const [groupFields, outFields, rightChildren, compositionInitValues] = useMemo(() => {\n let groupFields = []\n let outFields = []\n let otherFields = []\n const rightChildren = []\n const compositionInitValues = {}\n React.Children.map(children, (child) => {\n if (child) {\n if (child.props?.align === 'right') {\n rightChildren.push(child)\n return\n } else if (child.props?.isGroup === false) {\n outFields.push(child)\n } else {\n groupFields.push(child)\n }\n otherFields.push(child)\n }\n })\n if (groupFields.length <= minGroupCount) {\n groupFields = []\n outFields = otherFields\n } else {\n // 初始值\n for (let i = 0; i < groupFields.length; i++) {\n const name = groupFields[i].props?.name\n if (initialValues[name] !== undefined) {\n compositionInitValues[name] = initialValues[name]\n }\n }\n }\n return [groupFields, outFields, rightChildren, compositionInitValues]\n }, [children, minGroupCount, initialValues])\n\n const isGroupMode = groupFields.length > 0\n const hasOutField = outFields.length > 0\n const showExtra = rightChildren.length > 0 || extraActions\n\n return (\n <div className={cn(clsPrefix, { [className]: className })}>\n <Form layout=\"inline\">\n <div className={`${clsPrefix}-top`}>\n <div className={`${clsPrefix}-top-body`}>\n {hasOutField ? (\n outFields.map((child, i) =>\n React.cloneElement(child, {\n form: formRef.current,\n initialValue: initialValues?.[child.props?.name],\n onChange: _onFieldChange,\n key: i,\n })\n )\n ) : isGroupMode ? (\n <Composition\n clsPrefix={clsPrefix}\n fieldItems={groupFields}\n initialValues={compositionInitValues}\n onChange={_onCompositionFieldChange}\n form={formRef.current}\n />\n ) : null}\n\n {renderActions ? (\n renderActions()\n ) : (\n <>\n {showSearch && (\n <Button type=\"primary\" onClick={_onSearch}>\n {_getText('search')}\n </Button>\n )}\n {showReset && <Button onClick={_onReset}>{_getText('reset')}</Button>}\n </>\n )}\n </div>\n {showExtra && (\n <div className={`${clsPrefix}-extra`}>\n {rightChildren}\n {extraActions}\n </div>\n )}\n </div>\n {isGroupMode && hasOutField && (\n <div className={`${clsPrefix}-bottom`}>\n <Composition\n clsPrefix={clsPrefix}\n fieldItems={groupFields}\n initialValues={compositionInitValues}\n onChange={_onCompositionFieldChange}\n form={formRef.current}\n />\n </div>\n )}\n </Form>\n </div>\n )\n}\n\nQueryForm.Field = Field\nQueryForm.useForm = useForm\nQueryForm.createForm = createActions\n\nexport default QueryForm\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/query-form/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4DAAmC;AACnC,mCAAiC;AACjC,+CAAwC;AACxC,oEAA2C;AAC3C,oDAA2B;AAC3B,wDAA+B;AAE/B,qDAA4B;AAC5B,uDAA8B;AAC9B,uDAA8B;AAC9B,mDAA0B;AAC1B,gDAAqD;AACrD,6DAA+B;AAE/B,wBAAqB;AAErB,MAAM,SAAS,GAAG,eAAe,CAAA;AAEjC,MAAM,SAAU,SAAQ,eAAK,CAAC,aAAa;IACzC,YAAY,KAAK;QACf,KAAK,CAAC,KAAK,CAAC,CAAA;QA6Kd;;;;mBAAiB,IAAA,iBAAQ,EAAC,GAAG,EAAE;gBAC7B,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC,SAAS,CAAA;gBAElC,IAAI,OAAO,EAAE;oBACX,UAAU,CAAC,GAAG,EAAE;wBACd,IAAI,CAAC,QAAQ,CAAC;4BACZ,QAAQ,EAAE,IAAI,CAAC,qBAAqB,EAAE;yBACvC,CAAC,CAAA;oBACJ,CAAC,EAAE,EAAE,CAAC,CAAA;iBACP;YACH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AO,IAAI,IAAI,CAAC,qBAAqB,EAAE,EAAE;gBAC3C,IAAI,CAAC,QAAQ,CAAC;oBACZ,QAAQ,EAAE,IAAI;iBACf,CAAC,CAAA;aACH;YAED,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAA;SACrD;aAAM;YACL,IAAI,CAAC,4BAA4B,EAAE,CAAA;YACnC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,WAAW,EAAE,IAAI,CAAC,4BAA4B,CAAC,CAAA;YAC5D,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE,IAAI,CAAC,4BAA4B,CAAC,CAAA;SAC5D;IACH,CAAC;IAED,oBAAoB;;QAClB,MAAA,IAAI,CAAC,oBAAoB,oDAAI,CAAA;QAC7B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,IAAI,CAAC,4BAA4B,CAAC,CAAA;QAC7D,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,4BAA4B,CAAC,CAAA;QAC5D,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IACtC,CAAC;CACF;AAED,SAAS,CAAC,KAAK,GAAG,eAAK,CAAA;AACvB,SAAS,CAAC,OAAO,GAAG,iBAAO,CAAA;AAC3B,SAAS,CAAC,UAAU,GAAG,uBAAa,CAAA;AAEpC,kBAAe,SAAS,CAAA","sourcesContent":["import classnames from 'classnames'\nimport { debounce } from 'lodash'\nimport React, { createRef } from 'react'\nimport createActions from './createActions'\nimport Field from './Field'\nimport useForm from './useForm'\n\nimport Badge from '../badge'\nimport Button from '../button'\nimport Drawer from '../drawer'\nimport Form from '../form'\nimport { getLanguage, getText } from '../prev-locale'\nimport Icon from '../tntd-icon'\n\nimport './index.less'\n\nconst clsPrefix = 'tnt-queryform'\n\nclass QueryForm extends React.PureComponent {\n constructor(props) {\n super(props)\n const { form, initialValues, showExpand = true, renderActions, defaultExpanded } = props\n this.state = {\n showMore: false,\n expanded: defaultExpanded || !showExpand || renderActions ? true : false,\n drawerVisible: false,\n drawerFieldsValueCount: 0,\n }\n this.fieldsRef = createRef()\n this.formBoxRef = createRef()\n\n this.form = form || createActions()\n this.form.setData('initialValues', initialValues)\n this.form.setData('values', { ...initialValues })\n }\n\n render() {\n const {\n children,\n className = '',\n initialValues = {},\n renderActions,\n showSearch = true,\n showReset = true,\n showFieldCount,\n drawerProps = {},\n size,\n } = this.props\n const extraActions = this.props.extraActions\n const { expanded, showMore, drawerVisible, drawerFieldsValueCount } = this.state\n const renderFormActions =\n renderActions ||\n (() => (\n <>\n {showFieldCount && (\n <Badge count={drawerFieldsValueCount}>\n <Button onClick={this.onShowDrawer}>\n <Icon type=\"filter\" />\n {this.getText('moreFiltering')}\n </Button>\n </Badge>\n )}\n {showSearch && (\n <Button type=\"primary\" onClick={this.onSearch}>\n {this.getText('search')}\n </Button>\n )}\n {showReset && <Button onClick={this.onReset}>{this.getText('reset')}</Button>}\n {showMore && !showFieldCount && (\n <Button className=\"expand-link\" type=\"link\" onClick={this.onToggleExpand}>\n {this.getText(expanded ? 'collapse' : 'expand')}\n </Button>\n )}\n {React.Children.map(\n children,\n (child) => child && child?.props?.align === 'right' && React.cloneElement(child)\n )}\n </>\n ))\n\n return (\n <div ref={this.formBoxRef} className={classnames(clsPrefix, { [className]: className })}>\n <Form layout=\"inline\" className={classnames({ expanded: !showMore || expanded, showMore })}>\n <div ref={this.fieldsRef}>\n {React.Children.map(\n children,\n (child, index) =>\n child &&\n child?.props?.align !== 'right' &&\n (!showFieldCount || showFieldCount > index) &&\n React.cloneElement(child, {\n form: this.form,\n initialValue: initialValues?.[child.props?.name],\n onChange: this.onFieldChange,\n })\n )}\n </div>\n <div className={`${clsPrefix}-actions`}>{renderFormActions()}</div>\n {showFieldCount && (\n <Drawer\n title={this.getText('moreFiltering')}\n visible={drawerVisible}\n onClose={() => this.setState({ drawerVisible: false })}\n width={300}\n size={size}\n getContainer={false}\n {...drawerProps}\n className={classnames(`${clsPrefix}-drawer`, {\n 'large-size': size === 'large',\n [className]: className,\n })}\n >\n {React.Children.map(\n children,\n (child, index) =>\n child &&\n index >= showFieldCount &&\n React.cloneElement(child, {\n form: this.form,\n isFieldInDrawer: true,\n initialValue: initialValues?.[child.props.name],\n onChange: this.onFieldChange,\n onSearch: this.onSearch,\n })\n )}\n <Button type=\"primary\" onClick={this.onSearch}>\n {this.getText('search')}\n </Button>\n <Button onClick={this.onReset}>{this.getText('reset')}</Button>\n </Drawer>\n )}\n </Form>\n {extraActions && <div className={`${clsPrefix}-extra`}>{extraActions}</div>}\n </div>\n )\n }\n\n getText(key) {\n return getText(key, this.props.language || getLanguage())\n }\n\n isFieldsWidthOverflow() {\n const { current } = this.fieldsRef\n\n if (current) {\n return (\n parseFloat(window.getComputedStyle(current).width, 10) <\n [].reduce.call(\n current.children,\n (acc, cur) => {\n const { margin, width } = window.getComputedStyle(cur)\n const marginArray = margin.split(' ').map((str) => parseFloat(str, 10))\n acc += parseFloat(width, 10) + marginArray[1]\n return acc\n },\n 0\n )\n )\n }\n\n return false\n }\n\n updateFieldHeight() {\n const { formBoxRef, fieldsRef } = this\n const getFieldHeight = () => {\n const { current } = fieldsRef\n let height = '32px'\n\n if (current && current.children?.[0]) {\n height = window.getComputedStyle(current.children[0]).height\n }\n\n return height\n }\n const queryFormActionsDom = formBoxRef?.current?.querySelector(`.${clsPrefix}-actions`)\n const queryFormExtraDom = formBoxRef?.current?.querySelector(`.${clsPrefix}-extra`)\n const formItemsDomList = fieldsRef?.current?.querySelectorAll('.ant-form-item-control')\n const fieldHeight = getFieldHeight()\n\n fieldsRef.current.style.height = fieldHeight\n ;[queryFormActionsDom, queryFormExtraDom].forEach((item) => {\n item &&\n Object.assign(item.style, {\n height: fieldHeight,\n lineHeight: fieldHeight,\n })\n })\n ;[].forEach.call(formItemsDomList, (item) => {\n item.style.lineHeight = fieldHeight\n })\n }\n\n onWindowResize = debounce(() => {\n const { current } = this.fieldsRef\n\n if (current) {\n setTimeout(() => {\n this.setState({\n showMore: this.isFieldsWidthOverflow(),\n })\n }, 25)\n }\n }, 50)\n\n search = (params) => {\n this.props.onSearch({\n ...this.form.getValues(),\n ...params,\n })\n }\n\n onSearch = () => {\n this.props.onSearch?.(this.form.getValues())\n }\n\n onReset = () => {\n const { initialValues, onReset } = this.props\n\n this.form.setValues({ ...initialValues })\n this.updateDrawerFieldsValueCount()\n onReset?.(initialValues)\n }\n\n onToggleExpand = () => {\n this.setState({\n expanded: !this.state.expanded,\n })\n this.props.onToggleExpand?.(!this.state.expanded)\n }\n\n onShowDrawer = () => {\n this.setState({ drawerVisible: true })\n }\n\n onFieldChange = (name, value, ...rest) => {\n const values = this.form.getValues()\n const newValues = {\n ...values,\n [name]: value,\n }\n const changedInfo = { name, value, preValue: values?.[name] }\n const { onChange } = this.props\n\n this.form.setData('values', newValues)\n\n onChange && onChange(newValues, changedInfo, ...rest)\n this.updateDrawerFieldsValueCount(newValues)\n }\n\n updateDrawerFieldsValueCount = () => {\n const values = this.form.getValues()\n const { showFieldCount, children } = this.props\n\n if (showFieldCount) {\n const drawerFieldsValueCount = children.reduce((acc, cur, index) => {\n if (index >= showFieldCount && values?.[cur?.props?.name]) {\n acc++\n }\n return acc\n }, 0)\n\n if (drawerFieldsValueCount !== this.state.drawerFieldsValueCount) {\n this.setState({\n drawerFieldsValueCount,\n })\n }\n }\n }\n\n addResizeListener = () => {\n if ('ResizeObserver' in window) {\n const { current } = this.fieldsRef;\n if (current) {\n const observer = new ResizeObserver(this.onWindowResize);\n\n observer.observe(current)\n\n return () => observer.disconnect()\n }\n } else {\n window.addEventListener('resize', this.onWindowResize)\n return () => window.removeEventListener('resize', this.onWindowResize)\n }\n }\n\n componentDidMount() {\n const { current } = this.fieldsRef\n const { showFieldCount, showExpand = true } = this.props\n\n this.updateFieldHeight()\n\n this.form.on('search', this.search)\n\n // 未设置第一行显示数量且禁止了展开操作 或 自定义了操作区域,则不需要处理展开计算逻辑\n // || renderActions\n if (!showFieldCount && !showExpand) {\n return\n }\n\n if (!showFieldCount) {\n if (current && this.isFieldsWidthOverflow()) {\n this.setState({\n showMore: true,\n })\n }\n\n this.removeResizeListener = this.addResizeListener()\n } else {\n this.updateDrawerFieldsValueCount()\n this.form.on('setValues', this.updateDrawerFieldsValueCount)\n this.form.on('setValue', this.updateDrawerFieldsValueCount)\n }\n }\n\n componentWillUnmount() {\n this.removeResizeListener?.()\n this.form.off('setValues', this.updateDrawerFieldsValueCount)\n this.form.off('setValue', this.updateDrawerFieldsValueCount)\n this.form.off('search', this.search)\n }\n}\n\nQueryForm.Field = Field\nQueryForm.useForm = useForm\nQueryForm.createForm = createActions\n\nexport default QueryForm\n"]}
|
|
@@ -1,30 +1,73 @@
|
|
|
1
1
|
.tnt-queryform {
|
|
2
|
-
|
|
3
|
-
display: flex;
|
|
4
|
-
&-body {
|
|
5
|
-
flex: 1;
|
|
6
|
-
.ant-btn {
|
|
7
|
-
margin-right: 10px;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
}
|
|
2
|
+
display: flex;
|
|
11
3
|
|
|
12
4
|
&-extra {
|
|
5
|
+
line-height: 32px;
|
|
6
|
+
margin-left: 12px;
|
|
13
7
|
& > * {
|
|
14
|
-
margin-left:
|
|
8
|
+
margin-left: 8px;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&-actions {
|
|
13
|
+
align-items: center;
|
|
14
|
+
display: inline-block;
|
|
15
|
+
height: 32px;
|
|
16
|
+
line-height: 32px;
|
|
17
|
+
|
|
18
|
+
& > *:not(.expand-link) {
|
|
19
|
+
margin-right: 10px;
|
|
20
|
+
}
|
|
21
|
+
& > .expand-link {
|
|
22
|
+
padding: 0;
|
|
23
|
+
margin-right: 0;
|
|
24
|
+
}
|
|
25
|
+
& > .ant-badge {
|
|
26
|
+
.tnt-icon {
|
|
27
|
+
margin-right: 8px;
|
|
28
|
+
}
|
|
15
29
|
}
|
|
16
30
|
}
|
|
17
31
|
|
|
18
32
|
.ant-form {
|
|
19
|
-
|
|
33
|
+
display: inline-block;
|
|
34
|
+
margin-bottom: 12px;
|
|
35
|
+
display: flex;
|
|
36
|
+
flex: 1;
|
|
20
37
|
&.ant-form-inline {
|
|
21
38
|
flex-wrap: unset;
|
|
22
|
-
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
& > div:nth-child(1) {
|
|
42
|
+
height: 32px;
|
|
43
|
+
overflow: hidden;
|
|
44
|
+
.ant-form-item-label {
|
|
45
|
+
label {
|
|
46
|
+
// bottom: 4px;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
&.expanded {
|
|
52
|
+
& > div:nth-child(1) {
|
|
53
|
+
height: auto !important;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
&.showMore {
|
|
58
|
+
& > div:nth-child(1) {
|
|
59
|
+
.ant-form-item {
|
|
60
|
+
margin-bottom: 12px;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
& > div:nth-child(2) {
|
|
66
|
+
display: flex;
|
|
23
67
|
}
|
|
24
68
|
|
|
25
69
|
&.ant-form-inline .ant-form-item {
|
|
26
70
|
margin-right: 10px;
|
|
27
|
-
margin-bottom: @margin-sm;
|
|
28
71
|
display: inline-block;
|
|
29
72
|
}
|
|
30
73
|
|
|
@@ -32,7 +75,7 @@
|
|
|
32
75
|
// min-width: 160px;
|
|
33
76
|
line-height: unset;
|
|
34
77
|
.ant-calendar-picker-input {
|
|
35
|
-
padding: 0
|
|
78
|
+
padding: 0 11px;
|
|
36
79
|
}
|
|
37
80
|
.ant-form-item-children {
|
|
38
81
|
& > .ant-input,
|
|
@@ -45,7 +88,7 @@
|
|
|
45
88
|
}
|
|
46
89
|
|
|
47
90
|
&-drawer {
|
|
48
|
-
margin-top:
|
|
91
|
+
margin-top: 50px;
|
|
49
92
|
&.large-size {
|
|
50
93
|
margin-top: 60px;
|
|
51
94
|
}
|
|
@@ -60,7 +103,7 @@
|
|
|
60
103
|
.ant-form-item {
|
|
61
104
|
display: block;
|
|
62
105
|
margin-right: 0;
|
|
63
|
-
margin-bottom:
|
|
106
|
+
margin-bottom: 20px;
|
|
64
107
|
width: 100%;
|
|
65
108
|
}
|
|
66
109
|
.ant-form-item-label {
|
|
@@ -82,7 +125,7 @@
|
|
|
82
125
|
width: 100%;
|
|
83
126
|
margin-bottom: 10px;
|
|
84
127
|
&.ant-btn-primary {
|
|
85
|
-
margin-top:
|
|
128
|
+
margin-top: 20px;
|
|
86
129
|
}
|
|
87
130
|
}
|
|
88
131
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.tnt-queryform-field-popover {
|
|
2
|
+
min-width: 280px;
|
|
3
|
+
.ant-popover-inner-content {
|
|
4
|
+
padding: @padding-sm 0;
|
|
5
|
+
}
|
|
6
|
+
.ant-calendar-picker {
|
|
7
|
+
margin: @margin-xxs 0;
|
|
8
|
+
}
|
|
9
|
+
label {
|
|
10
|
+
color: tint(@text-color, 50%);
|
|
11
|
+
margin-bottom: @margin-xs;
|
|
12
|
+
display: block;
|
|
13
|
+
padding: 0 @padding-sm;
|
|
14
|
+
}
|
|
15
|
+
.ant-select-dropdown-menu {
|
|
16
|
+
&-item {
|
|
17
|
+
padding: @padding-xxs @padding-sm;
|
|
18
|
+
&:hover {
|
|
19
|
+
background-color: @bg-color-quaternary;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
&-content {
|
|
24
|
+
padding: @padding-xxs @padding-sm;
|
|
25
|
+
}
|
|
26
|
+
.ant-select-selected-icon {
|
|
27
|
+
position: absolute;
|
|
28
|
+
right: @margin-base;
|
|
29
|
+
top: @margin-xs;
|
|
30
|
+
color: @blue-6;
|
|
31
|
+
}
|
|
32
|
+
.tnt-highlight {
|
|
33
|
+
color: @blue-6;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
@import '../../../style/themes/index';
|
|
2
|
+
@import '../../../style/mixins/index';
|
|
3
|
+
@import '../../../input/style/mixin';
|
|
4
|
+
|
|
5
|
+
.tnt-queryform-composition-input {
|
|
6
|
+
// width: 100%;
|
|
7
|
+
max-height: 162px;
|
|
8
|
+
overflow-x: hidden;
|
|
9
|
+
cursor: text;
|
|
10
|
+
padding: 2px @padding-xl;
|
|
11
|
+
position: relative;
|
|
12
|
+
box-sizing: border-box;
|
|
13
|
+
background-color: @select-background;
|
|
14
|
+
border: @border-width-base @border-style-base @select-border-color;
|
|
15
|
+
border-top-width: calc(@border-width-base + 0.02px);
|
|
16
|
+
border-radius: @border-radius-base;
|
|
17
|
+
outline: none;
|
|
18
|
+
transition: all 0.3s @ease-in-out;
|
|
19
|
+
user-select: none;
|
|
20
|
+
margin-bottom: @margin-sm;
|
|
21
|
+
|
|
22
|
+
&-prefix {
|
|
23
|
+
position: absolute;
|
|
24
|
+
left: @padding-sm;
|
|
25
|
+
top: 50%;
|
|
26
|
+
transform: translateY(-50%);
|
|
27
|
+
i.anticon {
|
|
28
|
+
color: tint(@bg-color-spotilight, 50%);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&-width {
|
|
33
|
+
height: 0;
|
|
34
|
+
opacity: 0;
|
|
35
|
+
width: auto;
|
|
36
|
+
position: absolute;
|
|
37
|
+
max-width: 100%;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&-items {
|
|
41
|
+
float: left;
|
|
42
|
+
padding: 0;
|
|
43
|
+
list-style: none;
|
|
44
|
+
margin: 0;
|
|
45
|
+
width: 100%;
|
|
46
|
+
&-item {
|
|
47
|
+
padding: 3px 0;
|
|
48
|
+
}
|
|
49
|
+
li {
|
|
50
|
+
float: left;
|
|
51
|
+
line-height: 1;
|
|
52
|
+
}
|
|
53
|
+
&-input {
|
|
54
|
+
.inputClass {
|
|
55
|
+
background: none;
|
|
56
|
+
border: none !important;
|
|
57
|
+
outline: none;
|
|
58
|
+
box-shadow: none !important;
|
|
59
|
+
width: 150px !important;
|
|
60
|
+
height: 26px;
|
|
61
|
+
line-height: 26px;
|
|
62
|
+
padding: 0;
|
|
63
|
+
input {
|
|
64
|
+
border: none !important;
|
|
65
|
+
outline: none !important;
|
|
66
|
+
box-shadow: none !important;
|
|
67
|
+
height: 26px;
|
|
68
|
+
line-height: 26px;
|
|
69
|
+
padding: 0;
|
|
70
|
+
}
|
|
71
|
+
textarea {
|
|
72
|
+
padding: 0;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
.inputClass-with-placeholder {
|
|
76
|
+
min-width: 398px !important;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
&-clear {
|
|
81
|
+
position: absolute;
|
|
82
|
+
right: @margin-sm;
|
|
83
|
+
top: 50%;
|
|
84
|
+
transform: translateY(-50%);
|
|
85
|
+
display: none;
|
|
86
|
+
i.anticon {
|
|
87
|
+
color: tint(@bg-color-spotilight, 50%);
|
|
88
|
+
}
|
|
89
|
+
&:hover {
|
|
90
|
+
.anticon {
|
|
91
|
+
color: @text-color-secondary !important;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
&:hover {
|
|
96
|
+
border-color: @blue-6;
|
|
97
|
+
outline: 0;
|
|
98
|
+
.tnt-queryform-composition-input-clear {
|
|
99
|
+
display: block;
|
|
100
|
+
}
|
|
101
|
+
// box-shadow: 0 0 0 2px rgb(18 107 251 / 20%);
|
|
102
|
+
}
|
|
103
|
+
&:focus,
|
|
104
|
+
&:active {
|
|
105
|
+
border-color: @blue-5;
|
|
106
|
+
outline: 0;
|
|
107
|
+
// box-shadow: 0 0 0 2px rgb(18 107 251 / 20%);
|
|
108
|
+
}
|
|
109
|
+
.ant-tag {
|
|
110
|
+
padding: 0 @padding-xs;
|
|
111
|
+
border: none;
|
|
112
|
+
background: @fill-color-tertiary;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
.tnt-queryform {
|
|
2
|
+
&-top {
|
|
3
|
+
display: flex;
|
|
4
|
+
&-body {
|
|
5
|
+
flex: 1;
|
|
6
|
+
.ant-btn {
|
|
7
|
+
margin-right: 10px;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
&-extra {
|
|
13
|
+
& > * {
|
|
14
|
+
margin-left: 10px;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.ant-form {
|
|
19
|
+
// margin-bottom: @margin-sm;
|
|
20
|
+
&.ant-form-inline {
|
|
21
|
+
flex-wrap: unset;
|
|
22
|
+
position: relative;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&.ant-form-inline .ant-form-item {
|
|
26
|
+
margin-right: 10px;
|
|
27
|
+
margin-bottom: @margin-sm;
|
|
28
|
+
display: inline-block;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.ant-form-item-control {
|
|
32
|
+
// min-width: 160px;
|
|
33
|
+
line-height: unset;
|
|
34
|
+
.ant-calendar-picker-input {
|
|
35
|
+
padding: 0 @padding-sm;
|
|
36
|
+
}
|
|
37
|
+
.ant-form-item-children {
|
|
38
|
+
& > .ant-input,
|
|
39
|
+
& > .ant-input-affix-wrapper {
|
|
40
|
+
width: 160px;
|
|
41
|
+
// width: 200px;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
&-drawer {
|
|
48
|
+
margin-top: @margin-xxl;
|
|
49
|
+
&.large-size {
|
|
50
|
+
margin-top: 60px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&.ant-drawer.ant-drawer-open {
|
|
54
|
+
.ant-drawer-mask {
|
|
55
|
+
opacity: 0;
|
|
56
|
+
background: unset;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
.ant-drawer-body {
|
|
60
|
+
.ant-form-item {
|
|
61
|
+
display: block;
|
|
62
|
+
margin-right: 0;
|
|
63
|
+
margin-bottom: @margin-md;
|
|
64
|
+
width: 100%;
|
|
65
|
+
}
|
|
66
|
+
.ant-form-item-label {
|
|
67
|
+
display: block;
|
|
68
|
+
text-align: left;
|
|
69
|
+
line-height: 22px;
|
|
70
|
+
margin-bottom: 10px;
|
|
71
|
+
}
|
|
72
|
+
.ant-form-item-control-wrapper,
|
|
73
|
+
.ant-form-item-control,
|
|
74
|
+
.ant-calendar-picker,
|
|
75
|
+
.ant-input {
|
|
76
|
+
min-width: 100%;
|
|
77
|
+
width: 100%;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
& > .ant-btn {
|
|
81
|
+
display: block;
|
|
82
|
+
width: 100%;
|
|
83
|
+
margin-bottom: 10px;
|
|
84
|
+
&.ant-btn-primary {
|
|
85
|
+
margin-top: @margin-md;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
@table-prefix-cls: ~'@{ant-prefix}-table';
|
|
2
|
+
@pagination-prefix-cls: ~'@{ant-prefix}-pagination';
|
|
3
|
+
@spin-prefix-cls: ~'@{ant-prefix}-spin';
|
|
4
|
+
@table-borderless-shadow: 0 0 14px rgba(0, 0, 0, 0.08);
|
|
5
|
+
|
|
6
|
+
// .@{table-prefix-cls} {
|
|
7
|
+
.tnt-table-wrapper {
|
|
8
|
+
// customize the fixed of table
|
|
9
|
+
&.@{table-prefix-cls}-sticky {
|
|
10
|
+
.@{table-prefix-cls}-scroll,
|
|
11
|
+
.@{table-prefix-cls}-default {
|
|
12
|
+
.@{table-prefix-cls}-body table {
|
|
13
|
+
table-layout: fixed;
|
|
14
|
+
|
|
15
|
+
tr.@{table-prefix-cls}-expanded-row.@{table-prefix-cls}-expanded-row-level-1 {
|
|
16
|
+
position: relative;
|
|
17
|
+
z-index: 10;
|
|
18
|
+
background: #f3f4f6;
|
|
19
|
+
|
|
20
|
+
> td:not([colspan]) {
|
|
21
|
+
display: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// 兼容低版本浏览器
|
|
25
|
+
> td[colspan] {
|
|
26
|
+
background: #fff;
|
|
27
|
+
z-index: 100;
|
|
28
|
+
padding: 0;
|
|
29
|
+
border: none;
|
|
30
|
+
|
|
31
|
+
> .@{table-prefix-cls}-expanded-row-fixed {
|
|
32
|
+
position: sticky;
|
|
33
|
+
left: 0px;
|
|
34
|
+
overflow: hidden;
|
|
35
|
+
padding: 16px;
|
|
36
|
+
background: inherit;
|
|
37
|
+
border-top: 1px solid #e1e6ee;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.@{table-prefix-cls}-fixed-left table {
|
|
45
|
+
width: fit-content;
|
|
46
|
+
}
|
|
47
|
+
.@{table-prefix-cls}-fixed-right table {
|
|
48
|
+
width: fit-content;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/table/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/table/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,oBAAoB,CAAA"}
|
package/lib/table/hooks/index.js
CHANGED
|
@@ -13,4 +13,15 @@ Object.keys(_useColumnSetting).forEach(function (key) {
|
|
|
13
13
|
return _useColumnSetting[key];
|
|
14
14
|
}
|
|
15
15
|
});
|
|
16
|
+
});
|
|
17
|
+
var _useExpandFixed = require("./use-expand-fixed");
|
|
18
|
+
Object.keys(_useExpandFixed).forEach(function (key) {
|
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
|
20
|
+
if (key in exports && exports[key] === _useExpandFixed[key]) return;
|
|
21
|
+
Object.defineProperty(exports, key, {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
get: function get() {
|
|
24
|
+
return _useExpandFixed[key];
|
|
25
|
+
}
|
|
26
|
+
});
|
|
16
27
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/table/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAoC","sourcesContent":["export * from './use-column-setting'\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/table/hooks/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAoC;AACpC,qDAAkC","sourcesContent":["export * from './use-column-setting'\nexport * from './use-expand-fixed'\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare type keyType = string | number | null;
|
|
2
|
+
export declare const useExpandFixed: () => readonly [keyType, (key: string) => void];
|
|
3
|
+
export declare const findRowKey: (record: any, rowKey: string | ((record: any, index: number) => string)) => string | number;
|
|
4
|
+
//# sourceMappingURL=use-expand-fixed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-expand-fixed.d.ts","sourceRoot":"","sources":["../../../src/table/hooks/use-expand-fixed.ts"],"names":[],"mappings":"AAGA,oBAAY,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAA;AAQ5C,eAAO,MAAM,cAAc,iCAkGqB,MAAM,KAAK,IAAI,CAC9D,CAAA;AAED,eAAO,MAAM,UAAU,WACb,GAAG,6BACgB,GAAG,SAAS,MAAM,KAAK,MAAM,qBAUzD,CAAA"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useExpandFixed = exports.findRowKey = void 0;
|
|
8
|
+
var _react = require("react");
|
|
9
|
+
var _utils = require("../utils");
|
|
10
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
11
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
12
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
14
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
18
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
19
|
+
var useExpandFixed = exports.useExpandFixed = function useExpandFixed() {
|
|
20
|
+
var curTableKey = (0, _react.useRef)((0, _utils.makeRandomCode)());
|
|
21
|
+
var activeKeyRef = (0, _react.useRef)(null);
|
|
22
|
+
var oldActiveKeyRef = (0, _react.useRef)({
|
|
23
|
+
main: null,
|
|
24
|
+
right: null,
|
|
25
|
+
left: null
|
|
26
|
+
});
|
|
27
|
+
var container = (0, _react.useRef)(null);
|
|
28
|
+
var observer = (0, _react.useRef)(null);
|
|
29
|
+
var getDom = function getDom(key) {
|
|
30
|
+
var main = document.querySelector(".".concat(curTableKey.current, " .ant-table-scroll [data-row-key=\"").concat(key, "-extra-row\"]")) || document.querySelector(".".concat(curTableKey.current, " .ant-table-default [data-row-key=\"").concat(key, "-extra-row\"]"));
|
|
31
|
+
var right = document.querySelector(".".concat(curTableKey.current, " .ant-table-fixed-right [data-row-key=\"").concat(key, "-extra-row\"]"));
|
|
32
|
+
var left = document.querySelector(".".concat(curTableKey.current, " .ant-table-fixed-left [data-row-key=\"").concat(key, "-extra-row\"]"));
|
|
33
|
+
return [main, right, left];
|
|
34
|
+
};
|
|
35
|
+
var expand = /*#__PURE__*/function () {
|
|
36
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
37
|
+
var _getDom, _getDom2, main, right, left, td, colspan, Oldcolspan, newColspan;
|
|
38
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
39
|
+
while (1) switch (_context.prev = _context.next) {
|
|
40
|
+
case 0:
|
|
41
|
+
_getDom = getDom(String(activeKeyRef.current) || ''), _getDom2 = _slicedToArray(_getDom, 3), main = _getDom2[0], right = _getDom2[1], left = _getDom2[2];
|
|
42
|
+
if (right) {
|
|
43
|
+
right.setAttribute('style', "display: inline-block; height: ".concat((main === null || main === void 0 ? void 0 : main.offsetHeight) || 0, "px; overflow: hidden;"));
|
|
44
|
+
}
|
|
45
|
+
if (left) {
|
|
46
|
+
left.setAttribute('style', "display: inline-block; height: ".concat((main === null || main === void 0 ? void 0 : main.offsetHeight) || 0, "px; overflow: hidden;"));
|
|
47
|
+
}
|
|
48
|
+
if (main) {
|
|
49
|
+
// 解决 expandIconAsCell为true 且 iconCell的td元素为display: none;时, 展开内容滚动到最右边,会多出一部分iconCell所占据的空间 的问题
|
|
50
|
+
td = main.childNodes[1];
|
|
51
|
+
colspan = td.getAttribute('colspan') || 0;
|
|
52
|
+
Oldcolspan = td.getAttribute('oldcolspan') || 0;
|
|
53
|
+
newColspan = Oldcolspan ? Oldcolspan : Number(colspan) + 1 + '';
|
|
54
|
+
if (!Oldcolspan) td.setAttribute('oldcolspan', newColspan);
|
|
55
|
+
td.setAttribute('colspan', newColspan);
|
|
56
|
+
//
|
|
57
|
+
}
|
|
58
|
+
oldActiveKeyRef.current = {
|
|
59
|
+
main: main,
|
|
60
|
+
right: right,
|
|
61
|
+
left: left
|
|
62
|
+
};
|
|
63
|
+
case 5:
|
|
64
|
+
case "end":
|
|
65
|
+
return _context.stop();
|
|
66
|
+
}
|
|
67
|
+
}, _callee);
|
|
68
|
+
}));
|
|
69
|
+
return function expand() {
|
|
70
|
+
return _ref.apply(this, arguments);
|
|
71
|
+
};
|
|
72
|
+
}();
|
|
73
|
+
var ob = function ob() {
|
|
74
|
+
var classname = curTableKey.current;
|
|
75
|
+
if (!classname) return;
|
|
76
|
+
container.current = document.querySelector(".".concat(classname, ".ant-table-wrapper.collapse-panel > .ant-spin-nested-loading > .ant-spin-container > .ant-table"));
|
|
77
|
+
observer.current = new MutationObserver(expand);
|
|
78
|
+
observer.current.observe(container.current, {
|
|
79
|
+
childList: true,
|
|
80
|
+
attributes: true
|
|
81
|
+
});
|
|
82
|
+
};
|
|
83
|
+
var setChangedKey = function setChangedKey(key) {
|
|
84
|
+
activeKeyRef.current = key;
|
|
85
|
+
};
|
|
86
|
+
var trigger = function trigger(key) {
|
|
87
|
+
setChangedKey(key);
|
|
88
|
+
var className = curTableKey.current;
|
|
89
|
+
if (!className) return;
|
|
90
|
+
var dom = document === null || document === void 0 ? void 0 : document.querySelector(".".concat(className, ".ant-table-wrapper.collapse-panel > .ant-spin-nested-loading > .ant-spin-container > .ant-table"));
|
|
91
|
+
dom === null || dom === void 0 ? void 0 : dom.setAttribute('c-data', 'Mutation');
|
|
92
|
+
};
|
|
93
|
+
(0, _react.useEffect)(function () {
|
|
94
|
+
ob();
|
|
95
|
+
}, [curTableKey.current]);
|
|
96
|
+
return [curTableKey.current, trigger];
|
|
97
|
+
};
|
|
98
|
+
var findRowKey = exports.findRowKey = function findRowKey(record, rowKey) {
|
|
99
|
+
var res = '';
|
|
100
|
+
if (typeof rowKey === 'function') {
|
|
101
|
+
res = [record].map(rowKey)[0];
|
|
102
|
+
} else if (typeof rowKey === 'string') {
|
|
103
|
+
res = record[rowKey];
|
|
104
|
+
}
|
|
105
|
+
return res;
|
|
106
|
+
};
|