@dinert/element-plus 1.1.4 → 1.1.6
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/dist/element-plus.umd.js +1 -1
- package/dist/element-plus.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/es/packages/components/table-page/src/index.mjs +5 -4
- package/es/packages/components/table-page/src/index.mjs.map +1 -1
- package/es/packages/hooks/TablePage/index.mjs +1 -1
- package/es/packages/hooks/TablePage/index.mjs.map +1 -1
- package/es/packages/hooks/UseDialog/index.mjs +26 -0
- package/es/packages/hooks/UseDialog/index.mjs.map +1 -0
- package/es/packages/hooks/UseForm/index.mjs +35 -0
- package/es/packages/hooks/UseForm/index.mjs.map +1 -0
- package/es/packages/index.mjs +20 -16
- package/es/packages/index.mjs.map +1 -1
- package/es/src/components/form/types/index.d.ts +1 -1
- package/es/src/components/table/types/index.d.ts +2 -0
- package/es/src/hooks/TablePage/index.d.ts +1 -0
- package/es/src/hooks/UseDialog/index.d.ts +28 -0
- package/es/src/hooks/UseForm/index.d.ts +11 -0
- package/es/src/index.d.ts +4 -0
- package/es/style.css +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/src/components/form/types/index.d.ts +1 -1
- package/lib/src/components/table/types/index.d.ts +2 -0
- package/lib/src/hooks/TablePage/index.d.ts +1 -0
- package/lib/src/hooks/UseDialog/index.d.ts +28 -0
- package/lib/src/hooks/UseForm/index.d.ts +11 -0
- package/lib/src/index.d.ts +4 -0
- package/lib/style.css +1 -1
- package/package.json +1 -1
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.tree-item{width:100%}.tree-item .el-tooltip__trigger{display:block;overflow:hidden;width:100%;text-align:left;text-overflow:ellipsis;white-space:nowrap}.el-popover-classify{overflow-y:auto;margin:0;padding:0;list-style:none}.el-popover-classify li{margin:0;padding:0;list-style:none}.el-popover-classify li:first-child{border-bottom:1px solid var(--el-fill-color);line-height:32px}.el-popover-classify>.el-tree>.el-tree-node>.el-tree-node__content>.el-tree-node__expand-icon.is-leaf{display:none}.el-popover-classify .el-tree-node__children{overflow:unset}.dinert-table{display:flex;padding:20px;height:100%;border-radius:var(--el-bg-radius);background-color:var(--el-bg-color);flex-direction:column;box-sizing:border-box}.dinert-table .dinert-table-header{display:flex;justify-content:space-between;margin-bottom:12px;text-align:right}.dinert-table .dinert-table-header .el-popover-classify li .el-checkbox{width:100%;line-height:24px;height:24px}.dinert-table .dinert-table-header .dinert-table-header-left{text-align:left}.dinert-table .dinert-table-body{flex:1;height:0}.dinert-table .dinert-table-body .el-table .el-popper{max-width:50%}.dinert-table .dinert-table-body .el-table .el-table__header .el-table__cell.setting .setting-icon{display:inline-block}.dinert-table .dinert-table-body .el-table .el-table__header .el-table__cell .cell{color:var(--zp-color-secondary-text-title)}.dinert-table .dinert-table-body .el-table .el-table__header .el-table__cell .cell .setting-icon{vertical-align:-1px;margin-left:4px;cursor:pointer}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper td{color:var(--zp-color-secondary-text-title)}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper td .cell.el-tooltip>.cell-item{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper td .cell.el-tooltip>.cell-item .cell-item-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .el-dropdown{vertical-align:-2px}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell{display:flex;justify-content:center;align-items:center}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .el-button{margin-right:8px;margin-left:0}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .el-button:focus-visible{outline:none}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .el-svg-icon{font-size:14px;color:var(--el-color-primary);cursor:pointer;flex:1}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .el-svg-icon.delete{color:var(--el-color-danger)}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .svg-icon{width:16px;height:16px;vertical-align:-2px;flex:1;color:var(--el-color-primary);cursor:pointer;fill:var(--el-color-primary)}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .svg-icon.f-14{width:14px;height:14px}.dinert-table .dinert-table-footer{display:flex;margin-top:16px}.dinert-table .dinert-table-footer .el-pagination{display:flex;flex-wrap:wrap}.el-form{display:flex;overflow:hidden;padding:0;min-height:50px;border-radius:4px;background-color:var(--el-bg-color);transition:all .3s cubic-bezier(.645,.045,.355,1);box-sizing:content-box}.
|
|
1
|
+
.tree-item{width:100%}.tree-item .el-tooltip__trigger{display:block;overflow:hidden;width:100%;text-align:left;text-overflow:ellipsis;white-space:nowrap}.el-popover-classify{overflow-y:auto;margin:0;padding:0;list-style:none}.el-popover-classify li{margin:0;padding:0;list-style:none}.el-popover-classify li:first-child{border-bottom:1px solid var(--el-fill-color);line-height:32px}.el-popover-classify>.el-tree>.el-tree-node>.el-tree-node__content>.el-tree-node__expand-icon.is-leaf{display:none}.el-popover-classify .el-tree-node__children{overflow:unset}.dinert-table{display:flex;padding:20px;height:100%;border-radius:var(--el-bg-radius);background-color:var(--el-bg-color);flex-direction:column;box-sizing:border-box}.dinert-table .dinert-table-header{display:flex;justify-content:space-between;margin-bottom:12px;text-align:right}.dinert-table .dinert-table-header .el-popover-classify li .el-checkbox{width:100%;line-height:24px;height:24px}.dinert-table .dinert-table-header .dinert-table-header-left{text-align:left}.dinert-table .dinert-table-body{flex:1;height:0}.dinert-table .dinert-table-body .el-table .el-popper{max-width:50%}.dinert-table .dinert-table-body .el-table .el-table__header .el-table__cell.setting .setting-icon{display:inline-block}.dinert-table .dinert-table-body .el-table .el-table__header .el-table__cell .cell{color:var(--zp-color-secondary-text-title)}.dinert-table .dinert-table-body .el-table .el-table__header .el-table__cell .cell .setting-icon{vertical-align:-1px;margin-left:4px;cursor:pointer}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper td{color:var(--zp-color-secondary-text-title)}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper td .cell.el-tooltip>.cell-item{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper td .cell.el-tooltip>.cell-item .cell-item-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .el-dropdown{vertical-align:-2px}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell{display:flex;justify-content:center;align-items:center}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .el-button{margin-right:8px;margin-left:0}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .el-button:focus-visible{outline:none}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .el-svg-icon{font-size:14px;color:var(--el-color-primary);cursor:pointer;flex:1}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .el-svg-icon.delete{color:var(--el-color-danger)}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .svg-icon{width:16px;height:16px;vertical-align:-2px;flex:1;color:var(--el-color-primary);cursor:pointer;fill:var(--el-color-primary)}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .svg-icon.f-14{width:14px;height:14px}.dinert-table .dinert-table-footer{display:flex;margin-top:16px}.dinert-table .dinert-table-footer .el-pagination{display:flex;flex-wrap:wrap}.dinert-form.el-form{display:flex;overflow:hidden;padding:0;min-height:50px;border-radius:4px;background-color:var(--el-bg-color);transition:all .3s cubic-bezier(.645,.045,.355,1);box-sizing:content-box}.dinert-form.el-form.packUp{max-height:50px}.dinert-form.el-form.near .el-form-left .el-col{display:flex;align-items:center;margin-right:10px;width:auto;max-width:unset;flex:unset}.dinert-form.el-form.near .el-form-right.isArrow{width:230px;flex:0 0 230px}.dinert-form.el-form.dialog .el-form-left{flex:1}.dinert-form.el-form.dialog .el-form-left .el-col .label-text>div{width:100%}.dinert-form.el-form .el-form-left .el-col .label-text .el-radio.is-bordered,.dinert-form.el-form .el-form-left .el-col .label-text .el-checkbox.is-bordered{margin-right:16px}.dinert-form.el-form .el-form-left .el-col .label-text .el-date-editor{width:210px}.dinert-form.el-form .el-form-left .el-col .label-text .el-date-editor--daterange{width:260px}.dinert-form.el-form .el-form-left .el-col .label-text>.el-input{width:210px}.dinert-form.el-form .el-form-left .el-col .label-text>.el-select{width:210px}.dinert-form.el-form .el-form-left .el-col .label-text .el-date-editor--datetimerange{width:400px}.dinert-form.el-form .el-form-right{display:flex;margin-left:24px}.dinert-form.el-form .el-form-right .el-form-right-operation{padding:0}.dinert-form.el-form .el-form-right .el-form-right-operation.el-button.is-text{padding-right:0;background-color:unset}.dinert-form.el-form div.el-form-item{position:relative;display:flex;margin-right:0;margin-bottom:18px;width:100%}.dinert-form.el-form div.el-form-item.show-label .label-text{overflow:unset;text-overflow:unset;white-space:unset}.dinert-form.el-form div.el-form-item.label-wrap .el-form-item__label{height:auto}.dinert-form.el-form div.el-form-item.label-wrap .el-form-item__label .label-text{display:inline;text-align:left;white-space:normal}.dinert-form.el-form .el-form-item__content{flex:1;margin-left:0}.dinert-form.el-form .el-form-item__content .el-tooltip__trigger,.dinert-form.el-form .el-form-item__content .el-input-number{width:100%}.dinert-form.el-form .el-form-item__content .el-input-number .el-input__inner{text-align:center}.dinert-form.el-form .el-form-item__content .el-textarea .el-textarea__inner{height:80px}.dinert-form.el-form .el-form-item__content .el-date-editor,.dinert-form.el-form .el-form-item__content .el-date-editor .el-input__wrapper{width:100%;box-sizing:border-box}.dinert-form.el-form .el-form-item__content .el-input__inner{overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap}.dinert-form.el-form .el-form-item__content .el-form-item__label{overflow:hidden;width:80px;max-width:80px;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dinert-form.el-form .el-form-item__content .el-form-item__label .el-tooltip,.dinert-form.el-form .el-form-item__content .el-form-item__label .el-tooltip .label-text{display:inline}.dinert-table-page{display:flex;flex-direction:column;box-sizing:border-box}.dinert-table-page.text-wrap .el-table__header .cell{white-space:pre-wrap}.dinert-table-page.text-wrap .el-table__body .el-table__row td>.cell,.dinert-table-page.text-wrap .el-table__body .el-table__row td>.cell>.cell-item,.dinert-table-page.text-wrap .el-table__body .el-table__row td .cell.el-tooltip>.cell-item{white-space:pre-wrap}.dinert-table-page.text-wrap .el-table__body .el-table__row .el-button>span{text-align:left}.dinert-table-page.text-wrap .el-table__body .el-table__row span{white-space:pre-wrap;line-height:23px}.dinert-table-page.header-center .el-table__header .el-table__cell{text-align:center}.dinert-table-page.near .el-form-left{flex:unset}.dinert-table-page.near .el-form-left .el-col{margin-right:16px;width:auto;max-width:unset;flex:unset}.dinert-table-page.near .dinert-table-footer .el-pagination{margin-left:auto}.dinert-table-page.maxWidthAuto .el-form .el-form-item .el-form-item__label{max-width:unset}.dinert-table-page .dinert-form{padding:20px 20px 0;max-height:300px}.dinert-table-page .dinert-table{padding-top:0;height:0;flex:1}.dinert-tooltip.el-tooltip__trigger{display:block;height:100%}.dinert-tooltip.el-tooltip__trigger .text-tooltip{position:absolute;left:-999999999999px}.dinert-tooltip.el-tooltip__trigger .label-text{display:block;overflow:hidden;width:100%;height:100%;text-overflow:ellipsis;white-space:nowrap}.el-overlay.autoHeight .el-dialog{height:80%}.el-overlay.notPadding .el-dialog__body{padding:0}.el-overlay .el-dialog{top:10%;display:flex;min-width:310px;max-height:80%;border-radius:4px;flex-direction:column;--el-dialog-margin-top: 0;--el-dialog-padding-primary: 0}.el-overlay .el-dialog.is-fullscreen{top:unset;max-height:unset}.el-overlay .el-dialog__headerbtn{right:0;width:40px;height:100%;color:var(--el-color-info)}.el-overlay .el-dialog .full{position:absolute;top:-1.5px;right:34px;display:flex;justify-content:center;align-items:center;width:40px;height:100%;font-size:var(--el-message-close-size, 16px);border:none;color:var(--el-color-info);background:transparent;outline:none;cursor:pointer}.el-overlay .el-dialog .full:hover .icon{fill:var(--el-color-primary);color:var(--el-color-primary)}.el-overlay .el-dialog .full .icon{overflow:hidden;width:14px;height:14px;vertical-align:-.15em;fill:var(--el-color-info)}.el-overlay .el-dialog__header{position:relative;margin-right:0;padding:16px 24px;height:54px;box-sizing:border-box}.el-overlay .el-dialog__body{display:flex;overflow-y:auto;padding:24px;flex-direction:column;flex:1;word-wrap:break-word}.el-overlay .el-dialog__body>.el-form{overflow:unset}.el-overlay .el-dialog__footer{display:flex;justify-content:center;align-items:center;clear:both;padding:12px 24px 16px}.el-overlay .el-dialog__footer .el-button{margin:0}.el-overlay .el-dialog__footer .el-button+.el-button{margin-left:12px}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as i, ref as r, createVNode as n } from "vue";
|
|
2
2
|
import { DinertTable as h } from "../../table/index.mjs";
|
|
3
3
|
import { DinertForm as f } from "../../form/index.mjs";
|
|
4
4
|
import "../../../assets/scss/dinert-table-page.scss.mjs";
|
|
5
|
-
const b = /* @__PURE__ */
|
|
5
|
+
const b = /* @__PURE__ */ i({
|
|
6
6
|
name: "dinert-table-page",
|
|
7
7
|
props: {
|
|
8
8
|
form: {
|
|
@@ -38,9 +38,9 @@ const b = /* @__PURE__ */ l({
|
|
|
38
38
|
tableRef: e,
|
|
39
39
|
formRef: t,
|
|
40
40
|
onUnFold: () => {
|
|
41
|
-
const
|
|
41
|
+
const l = setTimeout(() => {
|
|
42
42
|
var s;
|
|
43
|
-
(s = e.value) == null || s.resizeTaleHeightFn(), clearTimeout(
|
|
43
|
+
(s = e.value) == null || s.resizeTaleHeightFn(), clearTimeout(l);
|
|
44
44
|
}, 300);
|
|
45
45
|
}
|
|
46
46
|
};
|
|
@@ -60,6 +60,7 @@ const b = /* @__PURE__ */ l({
|
|
|
60
60
|
}
|
|
61
61
|
}, [this.search && n(f, {
|
|
62
62
|
form: this.form,
|
|
63
|
+
class: "near",
|
|
63
64
|
onSearchFn: () => this.$emit("SearchFn"),
|
|
64
65
|
onResetFn: () => this.$emit("ResetFn"),
|
|
65
66
|
onUnFold: this.onUnFold,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../../packages/components/table-page/src/index.tsx"],"sourcesContent":["import {defineComponent, ref} from 'vue'\n\nimport DinertTable from '@packages/components/table'\nimport DinertForm from '@packages/components/form'\n\nimport type {RewriteTableProps, HeaderListProps} from '@packages/components/table/types/index'\nimport type {PropType} from 'vue'\nimport type {RewriteFormProps} from '@packages/components/form/types'\n\nimport '@packages/assets/scss/dinert-table-page.scss'\n\n\nexport default defineComponent({\n name: 'dinert-table-page',\n props: {\n form: {\n type: Object as PropType<RewriteFormProps>,\n default: () => ({})\n },\n table: {\n type: Object as PropType<RewriteTableProps>,\n default: () => ({})\n },\n search: {\n type: Boolean,\n default: true\n },\n footer: {\n type: Boolean,\n default: true\n },\n header: {\n type: [Object, Boolean] as PropType<HeaderListProps | boolean>,\n default: true\n },\n tableSlot: {\n type: Boolean,\n default: false\n }\n },\n emits: ['SizeChange', 'CurrentChange', 'SearchFn', 'ResetFn', 'CheckedChange'],\n setup() {\n\n const tablePageDom = ref<HTMLElement>()\n const tableRef = ref<InstanceType<typeof DinertTable>>()\n const formRef = ref<InstanceType<typeof DinertForm>>()\n\n const onUnFold = () => {\n const timer = setTimeout(() => {\n tableRef.value?.resizeTaleHeightFn()\n clearTimeout(timer)\n }, 300)\n }\n\n return {\n tablePageDom,\n tableRef,\n formRef,\n onUnFold\n }\n },\n render() {\n const slots = this.tableSlot ? this.$slots : {\n ...this.$slots,\n default: (scope: any) => this.$slots[(scope.prop)]?.(scope)\n }\n\n return (\n <section class={['dinert-table-page', this.search ? 'search' : '']} ref={el => {this.tablePageDom = el}}>\n {this.search\n && <DinertForm form={this.form}\n v-slots={this.$slots}\n onSearchFn={() => this.$emit('SearchFn')}\n onResetFn={() => this.$emit('ResetFn')}\n onUnFold={this.onUnFold}\n ref={el => {this.formRef = el}}></DinertForm>\n }\n <DinertTable\n ref={el => {this.tableRef = el}}\n table={this.table}\n header={this.header}\n footer={this.footer}\n tableSlot={this.tableSlot}\n v-slots={slots}\n onSizeChange={(val: number) => this.$emit('SizeChange', val)}\n onCurrentChange={(val: number) => this.$emit('CurrentChange', val)}\n onCheckedChange={(data: Node, checked: boolean, childChecked: boolean) => this.$emit('CheckedChange', data, checked, childChecked)}\n >\n </DinertTable>\n </section>\n )\n }\n})\n"],"names":["defineComponent","name","props","form","type","Object","default","table","search","Boolean","footer","header","tableSlot","emits","setup","tablePageDom","ref","tableRef","formRef","onUnFold","timer","setTimeout","value","resizeTaleHeightFn","clearTimeout","render","slots","$slots","scope","_b","_a","prop","_createVNode","el","DinertForm","onSearchFn","$emit","onResetFn","DinertTable","val","onCheckedChange","data","checked","childChecked"],"mappings":";;;;AAYA,MAAeA,sBAAgB;AAAA,EAC3BC,MAAM;AAAA,EACNC,OAAO;AAAA,IACHC,MAAM;AAAA,MACFC,MAAMC;AAAAA,MACNC,SAASA,OAAO,CAAA;AAAA,IACnB;AAAA,IACDC,OAAO;AAAA,MACHH,MAAMC;AAAAA,MACNC,SAASA,OAAO,CAAA;AAAA,IACnB;AAAA,IACDE,QAAQ;AAAA,MACJJ,MAAMK;AAAAA,MACNH,SAAS;AAAA,IACZ;AAAA,IACDI,QAAQ;AAAA,MACJN,MAAMK;AAAAA,MACNH,SAAS;AAAA,IACZ;AAAA,IACDK,QAAQ;AAAA,MACJP,MAAM,CAACC,QAAQI,OAAO;AAAA,MACtBH,SAAS;AAAA,IACZ;AAAA,IACDM,WAAW;AAAA,MACPR,MAAMK;AAAAA,MACNH,SAAS;AAAA,IACb;AAAA,EACH;AAAA,EACDO,OAAO,CAAC,cAAc,iBAAiB,YAAY,WAAW,eAAe;AAAA,EAC7EC,QAAQ;AAEJ,UAAMC,IAAeC,KACfC,IAAWD,KACXE,IAAUF;AAShB,WAAO;AAAA,MACHD,cAAAA;AAAAA,MACAE,UAAAA;AAAAA,MACAC,SAAAA;AAAAA,MACAC,UAXaA,MAAM;AACnB,cAAMC,IAAQC,WAAW,MAAM;;AAC3BJ,WAAAA,IAAAA,EAASK,UAATL,QAAAA,EAAgBM,sBAChBC,aAAaJ,CAAK;AAAA,QACrB,GAAE,GAAG;AAAA;;EASb;AAAA,EACDK,SAAS;AACL,UAAMC,IAAQ,KAAKd,YAAY,KAAKe,SAAS;AAAA,MACzC,GAAG,KAAKA;AAAAA,MACRrB,SAAUsB,CAAAA,MAAU;;AAAK,gBAAAC,KAAAC,IAAA,KAAKH,QAAQC,EAAMG,UAAnB,gBAAAF,EAAA,KAAAC,GAA4BF;AAAAA;AAAAA;AAGzD,WAAAI,EAAA,WAAA;AAAA,MAAA,OACoB,CAAC,qBAAqB,KAAKxB,SAAS,WAAW,EAAE;AAAA,MAAC,KAAOyB,CAAAA,MAAM;AAAC,aAAKlB,eAAekB;AAAAA,MAAE;AAAA,IAAC,GAAA,CAClG,KAAKzB,UAAMwB,EAAAE,GAAA;AAAA,MAAA,MACS,KAAK/B;AAAAA,MAAI,
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../../packages/components/table-page/src/index.tsx"],"sourcesContent":["import {defineComponent, ref} from 'vue'\n\nimport DinertTable from '@packages/components/table'\nimport DinertForm from '@packages/components/form'\n\nimport type {RewriteTableProps, HeaderListProps} from '@packages/components/table/types/index'\nimport type {PropType} from 'vue'\nimport type {RewriteFormProps} from '@packages/components/form/types'\n\nimport '@packages/assets/scss/dinert-table-page.scss'\n\n\nexport default defineComponent({\n name: 'dinert-table-page',\n props: {\n form: {\n type: Object as PropType<RewriteFormProps>,\n default: () => ({})\n },\n table: {\n type: Object as PropType<RewriteTableProps>,\n default: () => ({})\n },\n search: {\n type: Boolean,\n default: true\n },\n footer: {\n type: Boolean,\n default: true\n },\n header: {\n type: [Object, Boolean] as PropType<HeaderListProps | boolean>,\n default: true\n },\n tableSlot: {\n type: Boolean,\n default: false\n }\n },\n emits: ['SizeChange', 'CurrentChange', 'SearchFn', 'ResetFn', 'CheckedChange'],\n setup() {\n\n const tablePageDom = ref<HTMLElement>()\n const tableRef = ref<InstanceType<typeof DinertTable>>()\n const formRef = ref<InstanceType<typeof DinertForm>>()\n\n const onUnFold = () => {\n const timer = setTimeout(() => {\n tableRef.value?.resizeTaleHeightFn()\n clearTimeout(timer)\n }, 300)\n }\n\n return {\n tablePageDom,\n tableRef,\n formRef,\n onUnFold\n }\n },\n render() {\n const slots = this.tableSlot ? this.$slots : {\n ...this.$slots,\n default: (scope: any) => this.$slots[(scope.prop)]?.(scope)\n }\n\n return (\n <section class={['dinert-table-page', this.search ? 'search' : '']} ref={el => {this.tablePageDom = el}}>\n {this.search\n && <DinertForm form={this.form}\n class=\"near\"\n v-slots={this.$slots}\n onSearchFn={() => this.$emit('SearchFn')}\n onResetFn={() => this.$emit('ResetFn')}\n onUnFold={this.onUnFold}\n ref={el => {this.formRef = el}}></DinertForm>\n }\n <DinertTable\n ref={el => {this.tableRef = el}}\n table={this.table}\n header={this.header}\n footer={this.footer}\n tableSlot={this.tableSlot}\n v-slots={slots}\n onSizeChange={(val: number) => this.$emit('SizeChange', val)}\n onCurrentChange={(val: number) => this.$emit('CurrentChange', val)}\n onCheckedChange={(data: Node, checked: boolean, childChecked: boolean) => this.$emit('CheckedChange', data, checked, childChecked)}\n >\n </DinertTable>\n </section>\n )\n }\n})\n"],"names":["defineComponent","name","props","form","type","Object","default","table","search","Boolean","footer","header","tableSlot","emits","setup","tablePageDom","ref","tableRef","formRef","onUnFold","timer","setTimeout","value","resizeTaleHeightFn","clearTimeout","render","slots","$slots","scope","_b","_a","prop","_createVNode","el","DinertForm","onSearchFn","$emit","onResetFn","DinertTable","val","onCheckedChange","data","checked","childChecked"],"mappings":";;;;AAYA,MAAeA,sBAAgB;AAAA,EAC3BC,MAAM;AAAA,EACNC,OAAO;AAAA,IACHC,MAAM;AAAA,MACFC,MAAMC;AAAAA,MACNC,SAASA,OAAO,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/B;AAAAA,MAAI,OAAA;AAAA,MAAA,YAGdgC,MAAM,KAAKC,MAAM,UAAU;AAAA,MAAC,WAC7BC,MAAM,KAAKD,MAAM,SAAS;AAAA,MAAC,UAC5B,KAAKjB;AAAAA,MAAQ,KAClBc,CAAAA,MAAM;AAAC,aAAKf,UAAUe;AAAAA,MAAE;AAAA,IAAC,GAJrB,KAAKN,MAAM,GAIyBK,EAAAM,GAAA;AAAA,MAAA,KAGxCL,CAAAA,MAAM;AAAC,aAAKhB,WAAWgB;AAAAA,MAAG;AAAA,MAAA,OACxB,KAAK1B;AAAAA,MAAK,QACT,KAAKI;AAAAA,MAAM,QACX,KAAKD;AAAAA,MAAM,WACR,KAAKE;AAAAA,MAAS,cAEV2B,CAAAA,MAAgB,KAAKH,MAAM,cAAcG,CAAG;AAAA,MAAC,iBAC1CA,CAAAA,MAAgB,KAAKH,MAAM,iBAAiBG,CAAG;AAAA,MAAC,iBACjDC,CAACC,GAAYC,GAAkBC,MAA0B,KAAKP,MAAM,iBAAiBK,GAAMC,GAASC,CAAY;AAAA,IAAC,GAHzHjB,CAAK,CAAA,CAAA;AAAA,EAQ9B;AACJ,CAAC;"}
|
|
@@ -3,7 +3,7 @@ import { getUuid as b } from "../../utils/tools.mjs";
|
|
|
3
3
|
import i from "lodash";
|
|
4
4
|
class v {
|
|
5
5
|
constructor(e) {
|
|
6
|
-
this.selecTableDatas = s([]), this.lastSelectDatas = s([]), this.ids = s([]), this.tablePageRef = s(null), this.tableRef = s(null), this.tableOriginRef = s(null), this.formRef = s(null), this.formOriginRef = s(null), this.defaultOptions = {
|
|
6
|
+
this.dialogForm = s({ formItem: {}, model: {} }), this.selecTableDatas = s([]), this.lastSelectDatas = s([]), this.ids = s([]), this.tablePageRef = s(null), this.tableRef = s(null), this.tableOriginRef = s(null), this.formRef = s(null), this.formOriginRef = s(null), this.defaultOptions = {
|
|
7
7
|
table: {
|
|
8
8
|
rowKey: "id",
|
|
9
9
|
className: "table_page" + b(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../../../packages/hooks/TablePage/index.ts"],"sourcesContent":["\nimport {Ref, onMounted, ref} from 'vue'\n\nimport type {DinertTablePageProps, AjaxTableProps} from './types'\n\nimport TablePageComponent from '@packages/components/table-page/index'\nimport TableComponent from '@packages/components/table/index'\nimport FormComponent from '@packages/components/form/index'\nimport {getUuid} from '@packages/utils/tools'\nimport lodash from 'lodash'\nimport {MergeProp} from '@packages/components/form/types/utils'\n\n/**\n * T 表格data数据格式\n * D 表单model的数据格式\n * FI 表单formItem的数据格式\n * P 发起请求的数据格式\n * R 请求回来的数据格式\n */\n\nclass TablePage<T, D = any, FI = any, P = object, R = any> {\n showSearch: Ref<DinertTablePageProps['search']>\n table: Ref<DinertTablePageProps<T, D, FI>['table']>\n form: Ref<DinertTablePageProps<T, D, FI>['form']>\n footer: Ref<DinertTablePageProps['footer']>\n header: Ref<DinertTablePageProps['header']>\n\n selecTableDatas: Ref<T[]> = ref([])\n lastSelectDatas: Ref<T[]> = ref([])\n\n options: DinertTablePageProps<T, D, FI>\n\n ids: Ref<string[]> = ref([])\n\n params: P | any\n oldParams: P | any\n\n tablePageRef: Ref<InstanceType<typeof TablePageComponent> | null> = ref(null)\n\n tableRef: Ref<InstanceType<typeof TablePageComponent>['tableRef'] | null> = ref(null) // DinertTable的Dom\n tableOriginRef: Ref<InstanceType<typeof TableComponent>['tableRef'] | null> = ref(null) // elTable的Dom\n\n formRef: Ref<(InstanceType<typeof TablePageComponent>['formRef']) | null> = ref(null) // DinertForm的Dom\n formOriginRef: Ref<(InstanceType<typeof FormComponent>['formRef']) | null> = ref(null) // elForm的Dom\n\n private readonly defaultOptions: DinertTablePageProps<T, D, FI> = {\n table: {\n rowKey: 'id',\n className: 'table_page' + getUuid(),\n tableColumns: [],\n data: [],\n key: true,\n border: true,\n pagination: {\n total: 0,\n currentPage: 1,\n pageSize: 10,\n pageSizes: [10, 20, 30, 50, 100],\n },\n },\n form: {\n model: {},\n formItem: {}\n },\n footer: false,\n search: false\n }\n\n\n private readonly firstOptions: DinertTablePageProps<T, D, FI> = {\n table: {\n tableColumns: [],\n data: [],\n key: true,\n pagination: {}\n },\n form: {model: {}, formItem: {}}\n }\n\n\n constructor(options: DinertTablePageProps<T, D, FI> & {initMounteFlag?: boolean}) {\n\n this.options = lodash.defaultsDeep(lodash.cloneDeep(options), this.defaultOptions)\n\n this.firstOptions = lodash.cloneDeep(this.options)\n\n this.table = ref<DinertTablePageProps<T, D, FI>['table'] | any>(this.options.table)\n\n this.form = ref<DinertTablePageProps<T, D, FI>['form'] | any>(this.options.form)\n\n this.footer = ref<DinertTablePageProps<T, D, FI>['footer']>(this.options.footer)\n\n this.header = ref<DinertTablePageProps<T, D, FI>['header']>(this.options.header)\n\n this.showSearch = ref<DinertTablePageProps<T, D, FI>['search']>(this.options.search)\n\n this.params = {}\n this.oldParams = {};\n\n // 在组件挂载时调用\n ([undefined, true].includes(options.initMounteFlag)) && this.initMonunt()\n\n // 监听表格选择的方法,方便表格数据回显\n this.tableSelectEvent()\n }\n\n initMonunt() {\n onMounted(() => {\n this.tableRef.value = this.tablePageRef.value?.tableRef\n this.tableOriginRef.value = this.tablePageRef.value?.tableRef?.tableRef\n\n this.formRef.value = this.tablePageRef.value?.formRef\n this.formOriginRef.value = this.tablePageRef.value?.formRef?.formRef\n })\n }\n\n // 获取请求参数\n getTableParams: (params: P) => (Partial<P>) = () => ({} as P)\n ajaxTableDataAfter: (res: R) => void = () => undefined\n\n sizeChange(size: number) {\n\n const pageSize = this.table.value.pagination.pageSize\n this.table.value.pagination.pageSize = size\n const pagination = this.table.value.pagination\n if ((pageSize as any) > size\n || (pagination.currentPage as any) <= Math.ceil((pagination.total as any) / (pagination.pageSize as any))) {\n this.search({name: 'size', pageSize: size})\n }\n\n }\n\n currentChange(currentPage: number) {\n this.table.value.pagination.currentPage = currentPage\n this.search({name: 'current', currentPage})\n }\n\n async getTableData(options: (MergeProp<P, AjaxTableProps>)) {\n const res = await this.ajaxTableData(options)\n this.changeTableData(res)\n\n typeof this.ajaxTableDataAfter === 'function' && this.ajaxTableDataAfter(res)\n\n this.table.value.key = !this.table.value.key\n return res\n }\n\n // 获取请求的所有参数\n getAjaxTableDataParams(options: MergeProp<P, AjaxTableProps> | any): MergeProp<P, AjaxTableProps> {\n this.params = this.getTableParams(options)\n\n const isSame = lodash.isEqual(this.params, this.oldParams) // 判断当前提交的参数和上一次提交的参数是否相同\n\n if (options.name === 'search') {\n if (!isSame) {\n this.table.value.pagination.currentPage = 1\n this.params = this.getTableParams(options)\n }\n\n this.oldParams = lodash.cloneDeep(this.params)\n } else if (options.name === 'reset') {\n this.resetPagination()\n this.params = this.getTableParams(options)\n\n this.oldParams = lodash.cloneDeep(this.params)\n } else if (options.name === 'delete') {\n if (this.table.value.data && this.table.value.data.length) {\n if (this.table.value.data.length === 1 && (this.table.value as any).pagination.currentPage > 1) {\n this.table.value.pagination.currentPage = (this.table.value.pagination as any).currentPage - 1\n\n this.params = this.getTableParams(options)\n }\n }\n } else if (['current', 'size', 'reset'].includes(options.name || '')) {\n this.oldParams = lodash.cloneDeep(this.params)\n }\n\n if (!['size', 'current'].includes(options.name || '') || !this.table.value.rowKey) {\n this.selecTableDatas.value = []\n }\n\n return this.params\n }\n\n // 请求\n ajaxTableData(options: (MergeProp<P, AjaxTableProps>)): Promise<R> {\n return new Promise(resolve => {\n resolve(this.getAjaxTableDataParams(options) as any)\n })\n }\n\n changeTableData(res: R | any) {\n if (res && res.data && res.data.length) {\n for (let i = 0; i < res.data.length; i++) {\n res.data[i].index = i + 1 + (res.pageNum as number) * (res.pageSize as number)\n }\n this.table.value.data = res.data\n this.table.value.pagination.total = res.total\n }\n }\n\n\n // 查询\n search(options: (P & AjaxTableProps) | any = {name: 'search'}) {\n\n for (const prop in this.form.value?.model) {\n if ([null, undefined, ''].includes((this.form.value.model as any)[prop])) {\n delete this.form.value?.model[prop]\n }\n }\n return this.getTableData(options)\n }\n\n // 重置查询\n resetSearch(options: (P & AjaxTableProps) | any = {name: 'reset'}) {\n this.resetParams()\n this.search(options)\n }\n\n\n // 重置分页参数\n resetPagination() {\n this.table.value.pagination = {...this.defaultOptions.table.pagination}\n }\n\n // 重置表格请求参数\n resetParams() {\n if (lodash.isEmpty(this.firstOptions.form?.model)) { // 判断查询的默认参数是否为空\n for (const prop in this.form.value?.model) {\n delete this.form.value?.model[prop]\n }\n } else {\n for (const prop in this.form.value?.model) {\n delete this.form.value?.model[prop]\n }\n for (const prop in this.firstOptions.form?.model) {\n this.form.value.model[prop] = this.firstOptions.form?.model[prop]\n }\n }\n }\n\n // 清空参数\n clearParams() {\n for (const prop in this.form.value?.model) {\n delete this.form.value.model[prop]\n }\n }\n\n // 根据key获取表格中的数据\n getTableDataKeys(key: string = 'id') {\n this.ids.value = lodash.map(this.table.value.data || [], key)\n return this.ids.value\n }\n\n // 回显选中\n echoOperations() {\n const rowKey = this.table.value.rowKey as any\n const keys = (this.selecTableDatas.value || []).map((item: any) => item[rowKey])\n if (this.tablePageRef.value) {\n (this.table.value.data || []).forEach((item: any) => {\n if (keys.includes(item[rowKey])) {\n this.tablePageRef.value?.tableRef?.tableRef?.toggleRowSelection(item, true)\n } else {\n this.tablePageRef.value?.tableRef?.tableRef?.toggleRowSelection(item, false)\n }\n })\n }\n\n }\n\n // 懒加载使用\n lazyAddKey<T = any>(arr: any = [], children: string = 'children'): T {\n return arr.map((item: any) => {\n if (item[children]) {\n item.children2 = [...item[children]]\n item.hasChildren = true\n delete item[children]\n }\n return {\n ...item,\n children2: item.children2 ? this.lazyAddKey(item.children2) : []\n }\n })\n }\n\n // 监听表格选择事件,包括全选和单选\n tableSelectEvent() {\n const rowKey: any = this.table.value.rowKey\n if (this.table.value) {\n if (!this.table.value.onSelect) {\n this.table.value.onSelect = (selection: T[]) => {\n if (rowKey) {\n this.table.value.data.forEach((item: any) => {\n for (let i = 0; i < this.selecTableDatas.value.length; i++) {\n if (item[rowKey] === (this.selecTableDatas.value[i]as any)[rowKey]) {\n this.selecTableDatas.value.splice(i, 1)\n }\n }\n })\n this.selecTableDatas.value = lodash.uniqBy(selection.concat(this.selecTableDatas.value), rowKey)\n } else {\n this.selecTableDatas.value = selection\n }\n }\n }\n if (!this.table.value['onSelect-all']) {\n this.table.value['onSelect-all'] = (selection: T[]) => {\n if (rowKey) {\n if (selection.length === 0) {\n this.table.value.data.forEach((item: any) => {\n for (let i = 0; i < this.selecTableDatas.value.length; i++) {\n if (item[rowKey] === (this.selecTableDatas.value[i] as any)[rowKey]) {\n this.selecTableDatas.value.splice(i, 1)\n }\n }\n })\n } else {\n this.selecTableDatas.value = lodash.uniqBy(selection.concat(this.selecTableDatas.value), rowKey)\n }\n\n } else {\n this.selecTableDatas.value = selection\n }\n }\n }\n }\n }\n}\n\n\nexport default TablePage\n"],"names":["TablePage","options","ref","getUuid","lodash","onMounted","_a","_c","_b","_d","_f","_e","size","pageSize","pagination","currentPage","res","isSame","resolve","i","prop","_g","key","rowKey","keys","item","arr","children","selection"],"mappings":";;;AAoBA,MAAMA,EAAqD;AAAA,EA4DvD,YAAYC,GAAsE;AArDtD,SAAA,kBAAAC,EAAI,CAAA,CAAE,GACN,KAAA,kBAAAA,EAAI,CAAA,CAAE,GAIb,KAAA,MAAAA,EAAI,CAAA,CAAE,GAK3B,KAAA,eAAoEA,EAAI,IAAI,GAE5E,KAAA,WAA4EA,EAAI,IAAI,GACpF,KAAA,iBAA8EA,EAAI,IAAI,GAEtF,KAAA,UAA4EA,EAAI,IAAI,GACpF,KAAA,gBAA6EA,EAAI,IAAI,GAErF,KAAiB,iBAAiD;AAAA,MAC9D,OAAO;AAAA,QACH,QAAQ;AAAA,QACR,WAAW,eAAeC,EAAQ;AAAA,QAClC,cAAc,CAAC;AAAA,QACf,MAAM,CAAC;AAAA,QACP,KAAK;AAAA,QACL,QAAQ;AAAA,QACR,YAAY;AAAA,UACR,OAAO;AAAA,UACP,aAAa;AAAA,UACb,UAAU;AAAA,UACV,WAAW,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AM,cAAc,MAChC,KAAK,MAAM,MAAM,cAAc,IAAI,CAACA,MAAmB;AACnD,MAAIL,IACIK,EAAU,WAAW,IACrB,KAAK,MAAM,MAAM,KAAK,QAAQ,CAACH,MAAc;AACzC,iBAASN,IAAI,GAAGA,IAAI,KAAK,gBAAgB,MAAM,QAAQA;AAC/C,UAAAM,EAAKF,CAAM,MAAO,KAAK,gBAAgB,MAAMJ,CAAC,EAAUI,CAAM,KAC9D,KAAK,gBAAgB,MAAM,OAAOJ,GAAG,CAAC;AAAA,MAE9C,CACH,IAEI,KAAA,gBAAgB,QAAQf,EAAO,OAAOwB,EAAU,OAAO,KAAK,gBAAgB,KAAK,GAAGL,CAAM,IAInG,KAAK,gBAAgB,QAAQK;AAAA,IACjC;AAAA,EAIhB;AACJ;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../packages/hooks/TablePage/index.ts"],"sourcesContent":["\nimport {Ref, onMounted, ref} from 'vue'\n\nimport type {DinertTablePageProps, AjaxTableProps} from './types'\n\nimport TablePageComponent from '@packages/components/table-page/index'\nimport TableComponent from '@packages/components/table/index'\nimport FormComponent from '@packages/components/form/index'\nimport {getUuid} from '@packages/utils/tools'\nimport lodash from 'lodash'\nimport {MergeProp} from '@packages/components/form/types/utils'\n\n/**\n * T 表格data数据格式\n * D 表单model的数据格式\n * FI 表单formItem的数据格式\n * P 发起请求的数据格式\n * R 请求回来的数据格式\n */\n\nclass TablePage<T, D = any, FI = any, P = object, R = any> {\n dialogForm: Ref<DinertTablePageProps<T, T, FI>['form']> = ref({formItem: {}, model: {}})\n showSearch: Ref<DinertTablePageProps['search']>\n table: Ref<DinertTablePageProps<T, D, FI>['table']>\n form: Ref<DinertTablePageProps<T, D, FI>['form']>\n footer: Ref<DinertTablePageProps['footer']>\n header: Ref<DinertTablePageProps['header']>\n\n selecTableDatas: Ref<T[]> = ref([])\n lastSelectDatas: Ref<T[]> = ref([])\n\n options: DinertTablePageProps<T, D, FI>\n\n ids: Ref<string[]> = ref([])\n\n params: P | any\n oldParams: P | any\n\n tablePageRef: Ref<InstanceType<typeof TablePageComponent> | null> = ref(null)\n\n tableRef: Ref<InstanceType<typeof TablePageComponent>['tableRef'] | null> = ref(null) // DinertTable的Dom\n tableOriginRef: Ref<InstanceType<typeof TableComponent>['tableRef'] | null> = ref(null) // elTable的Dom\n\n formRef: Ref<(InstanceType<typeof TablePageComponent>['formRef']) | null> = ref(null) // DinertForm的Dom\n formOriginRef: Ref<(InstanceType<typeof FormComponent>['formRef']) | null> = ref(null) // elForm的Dom\n\n private readonly defaultOptions: DinertTablePageProps<T, D, FI> = {\n table: {\n rowKey: 'id',\n className: 'table_page' + getUuid(),\n tableColumns: [],\n data: [],\n key: true,\n border: true,\n pagination: {\n total: 0,\n currentPage: 1,\n pageSize: 10,\n pageSizes: [10, 20, 30, 50, 100],\n },\n },\n form: {\n model: {},\n formItem: {}\n },\n footer: false,\n search: false\n }\n\n\n private readonly firstOptions: DinertTablePageProps<T, D, FI> = {\n table: {\n tableColumns: [],\n data: [],\n key: true,\n pagination: {}\n },\n form: {model: {}, formItem: {}}\n }\n\n\n constructor(options: DinertTablePageProps<T, D, FI> & {initMounteFlag?: boolean}) {\n\n this.options = lodash.defaultsDeep(lodash.cloneDeep(options), this.defaultOptions)\n\n this.firstOptions = lodash.cloneDeep(this.options)\n\n this.table = ref<DinertTablePageProps<T, D, FI>['table'] | any>(this.options.table)\n\n this.form = ref<DinertTablePageProps<T, D, FI>['form'] | any>(this.options.form)\n\n this.footer = ref<DinertTablePageProps<T, D, FI>['footer']>(this.options.footer)\n\n this.header = ref<DinertTablePageProps<T, D, FI>['header']>(this.options.header)\n\n this.showSearch = ref<DinertTablePageProps<T, D, FI>['search']>(this.options.search)\n\n this.params = {}\n this.oldParams = {};\n\n // 在组件挂载时调用\n ([undefined, true].includes(options.initMounteFlag)) && this.initMonunt()\n\n // 监听表格选择的方法,方便表格数据回显\n this.tableSelectEvent()\n }\n\n initMonunt() {\n onMounted(() => {\n this.tableRef.value = this.tablePageRef.value?.tableRef\n this.tableOriginRef.value = this.tablePageRef.value?.tableRef?.tableRef\n\n this.formRef.value = this.tablePageRef.value?.formRef\n this.formOriginRef.value = this.tablePageRef.value?.formRef?.formRef\n })\n }\n\n // 获取请求参数\n getTableParams: (params: P) => (Partial<P>) = () => ({} as P)\n ajaxTableDataAfter: (res: R) => void = () => undefined\n\n sizeChange(size: number) {\n\n const pageSize = this.table.value.pagination.pageSize\n this.table.value.pagination.pageSize = size\n const pagination = this.table.value.pagination\n if ((pageSize as any) > size\n || (pagination.currentPage as any) <= Math.ceil((pagination.total as any) / (pagination.pageSize as any))) {\n this.search({name: 'size', pageSize: size})\n }\n\n }\n\n currentChange(currentPage: number) {\n this.table.value.pagination.currentPage = currentPage\n this.search({name: 'current', currentPage})\n }\n\n async getTableData(options: (MergeProp<P, AjaxTableProps>)) {\n const res = await this.ajaxTableData(options)\n this.changeTableData(res)\n\n typeof this.ajaxTableDataAfter === 'function' && this.ajaxTableDataAfter(res)\n\n this.table.value.key = !this.table.value.key\n return res\n }\n\n // 获取请求的所有参数\n getAjaxTableDataParams(options: MergeProp<P, AjaxTableProps> | any): MergeProp<P, AjaxTableProps> {\n this.params = this.getTableParams(options)\n\n const isSame = lodash.isEqual(this.params, this.oldParams) // 判断当前提交的参数和上一次提交的参数是否相同\n\n if (options.name === 'search') {\n if (!isSame) {\n this.table.value.pagination.currentPage = 1\n this.params = this.getTableParams(options)\n }\n\n this.oldParams = lodash.cloneDeep(this.params)\n } else if (options.name === 'reset') {\n this.resetPagination()\n this.params = this.getTableParams(options)\n\n this.oldParams = lodash.cloneDeep(this.params)\n } else if (options.name === 'delete') {\n if (this.table.value.data && this.table.value.data.length) {\n if (this.table.value.data.length === 1 && (this.table.value as any).pagination.currentPage > 1) {\n this.table.value.pagination.currentPage = (this.table.value.pagination as any).currentPage - 1\n\n this.params = this.getTableParams(options)\n }\n }\n } else if (['current', 'size', 'reset'].includes(options.name || '')) {\n this.oldParams = lodash.cloneDeep(this.params)\n }\n\n if (!['size', 'current'].includes(options.name || '') || !this.table.value.rowKey) {\n this.selecTableDatas.value = []\n }\n\n return this.params\n }\n\n // 请求\n ajaxTableData(options: (MergeProp<P, AjaxTableProps>)): Promise<R> {\n return new Promise(resolve => {\n resolve(this.getAjaxTableDataParams(options) as any)\n })\n }\n\n changeTableData(res: R | any) {\n if (res && res.data && res.data.length) {\n for (let i = 0; i < res.data.length; i++) {\n res.data[i].index = i + 1 + (res.pageNum as number) * (res.pageSize as number)\n }\n this.table.value.data = res.data\n this.table.value.pagination.total = res.total\n }\n }\n\n\n // 查询\n search(options: (P & AjaxTableProps) | any = {name: 'search'}) {\n\n for (const prop in this.form.value?.model) {\n if ([null, undefined, ''].includes((this.form.value.model as any)[prop])) {\n delete this.form.value?.model[prop]\n }\n }\n return this.getTableData(options)\n }\n\n // 重置查询\n resetSearch(options: (P & AjaxTableProps) | any = {name: 'reset'}) {\n this.resetParams()\n this.search(options)\n }\n\n\n // 重置分页参数\n resetPagination() {\n this.table.value.pagination = {...this.defaultOptions.table.pagination}\n }\n\n // 重置表格请求参数\n resetParams() {\n if (lodash.isEmpty(this.firstOptions.form?.model)) { // 判断查询的默认参数是否为空\n for (const prop in this.form.value?.model) {\n delete this.form.value?.model[prop]\n }\n } else {\n for (const prop in this.form.value?.model) {\n delete this.form.value?.model[prop]\n }\n for (const prop in this.firstOptions.form?.model) {\n this.form.value.model[prop] = this.firstOptions.form?.model[prop]\n }\n }\n }\n\n // 清空参数\n clearParams() {\n for (const prop in this.form.value?.model) {\n delete this.form.value.model[prop]\n }\n }\n\n // 根据key获取表格中的数据\n getTableDataKeys(key: string = 'id') {\n this.ids.value = lodash.map(this.table.value.data || [], key)\n return this.ids.value\n }\n\n // 回显选中\n echoOperations() {\n const rowKey = this.table.value.rowKey as any\n const keys = (this.selecTableDatas.value || []).map((item: any) => item[rowKey])\n if (this.tablePageRef.value) {\n (this.table.value.data || []).forEach((item: any) => {\n if (keys.includes(item[rowKey])) {\n this.tablePageRef.value?.tableRef?.tableRef?.toggleRowSelection(item, true)\n } else {\n this.tablePageRef.value?.tableRef?.tableRef?.toggleRowSelection(item, false)\n }\n })\n }\n\n }\n\n // 懒加载使用\n lazyAddKey<T = any>(arr: any = [], children: string = 'children'): T {\n return arr.map((item: any) => {\n if (item[children]) {\n item.children2 = [...item[children]]\n item.hasChildren = true\n delete item[children]\n }\n return {\n ...item,\n children2: item.children2 ? this.lazyAddKey(item.children2) : []\n }\n })\n }\n\n // 监听表格选择事件,包括全选和单选\n tableSelectEvent() {\n const rowKey: any = this.table.value.rowKey\n if (this.table.value) {\n if (!this.table.value.onSelect) {\n this.table.value.onSelect = (selection: T[]) => {\n if (rowKey) {\n this.table.value.data.forEach((item: any) => {\n for (let i = 0; i < this.selecTableDatas.value.length; i++) {\n if (item[rowKey] === (this.selecTableDatas.value[i]as any)[rowKey]) {\n this.selecTableDatas.value.splice(i, 1)\n }\n }\n })\n this.selecTableDatas.value = lodash.uniqBy(selection.concat(this.selecTableDatas.value), rowKey)\n } else {\n this.selecTableDatas.value = selection\n }\n }\n }\n if (!this.table.value['onSelect-all']) {\n this.table.value['onSelect-all'] = (selection: T[]) => {\n if (rowKey) {\n if (selection.length === 0) {\n this.table.value.data.forEach((item: any) => {\n for (let i = 0; i < this.selecTableDatas.value.length; i++) {\n if (item[rowKey] === (this.selecTableDatas.value[i] as any)[rowKey]) {\n this.selecTableDatas.value.splice(i, 1)\n }\n }\n })\n } else {\n this.selecTableDatas.value = lodash.uniqBy(selection.concat(this.selecTableDatas.value), rowKey)\n }\n\n } else {\n this.selecTableDatas.value = selection\n }\n }\n }\n }\n }\n}\n\n\nexport default TablePage\n"],"names":["TablePage","options","ref","getUuid","lodash","onMounted","_a","_c","_b","_d","_f","_e","size","pageSize","pagination","currentPage","res","isSame","resolve","i","prop","_g","key","rowKey","keys","item","arr","children","selection"],"mappings":";;;AAoBA,MAAMA,EAAqD;AAAA,EA6DvD,YAAYC,GAAsE;AA5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l({ formItem: {}, model: {} }), this.dialogFormRef = l(null), this.defaultOptions = {
|
|
6
|
+
modelValue: !1,
|
|
7
|
+
modalClass: ""
|
|
8
|
+
}, this.options = {}, this.options = s.defaultsDeep(s.cloneDeep(t), this.defaultOptions), this.fullscreen = l(this.options.fullscreen), this.modelValue = l(this.options.modelValue), this.modalClass = l(this.options.modalClass), this.width = l(this.options.width), this.title = l(this.options.title);
|
|
9
|
+
}
|
|
10
|
+
// 打开弹窗
|
|
11
|
+
openDialog() {
|
|
12
|
+
this.title.value = this.modalClass.value === "add" ? "新增" : this.modalClass.value === "edit" ? "编辑" : this.title.value, this.modelValue.value = !0;
|
|
13
|
+
}
|
|
14
|
+
// 关闭弹窗
|
|
15
|
+
closeDialog() {
|
|
16
|
+
this.modelValue.value = !1;
|
|
17
|
+
}
|
|
18
|
+
// 取消
|
|
19
|
+
cancel() {
|
|
20
|
+
this.closeDialog();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
a as default
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../packages/hooks/UseDialog/index.ts"],"sourcesContent":["\nimport type {RewriteDialogProps, DinertTablePageProps, DinertForm} from '@packages/index'\nimport type {DialogEmits} from 'element-plus'\nimport lodash from 'lodash'\nimport {ref, Ref} from 'vue'\n\nclass UseDialog<T, R = any> {\n dialogForm: Ref<DinertTablePageProps<T, any, any>['form']> = ref({formItem: {}, model: {}})\n dialogFormRef: Ref<R | {formRef: InstanceType<typeof DinertForm>} | null> = ref(null)\n\n modelValue: Ref<RewriteDialogProps['modelValue']>\n modalClass: Ref<string>\n width: Ref<RewriteDialogProps['width']>\n title: Ref<RewriteDialogProps['title']>\n fullscreen: Ref<RewriteDialogProps['fullscreen']>\n\n opened?: DialogEmits['opened']\n open?: DialogEmits['open']\n openAutoFocus?: DialogEmits['openAutoFocus']\n closeAutoFocus?: DialogEmits['closeAutoFocus']\n close?: DialogEmits['close']\n closed?: DialogEmits['closed']\n save?: () => void\n\n defaultOptions: RewriteDialogProps = {\n modelValue: false,\n modalClass: ''\n }\n\n options: RewriteDialogProps = {}\n constructor(options: RewriteDialogProps = {}) {\n\n this.options = lodash.defaultsDeep(lodash.cloneDeep(options), this.defaultOptions)\n this.fullscreen = ref(this.options.fullscreen)\n this.modelValue = ref(this.options.modelValue)\n this.modalClass = ref((this.options.modalClass as string))\n this.width = ref(this.options.width)\n this.title = ref(this.options.title)\n }\n\n // 打开弹窗\n openDialog() {\n\n this.title.value = this.modalClass.value === 'add' ? '新增' : this.modalClass.value === 'edit' ? '编辑' : this.title.value\n this.modelValue.value = true\n }\n\n // 关闭弹窗\n closeDialog() {\n this.modelValue.value = false\n }\n\n // 取消\n cancel() {\n this.closeDialog()\n }\n}\n\nexport default UseDialog\n"],"names":["UseDialog","options","ref","lodash"],"mappings":";;AAMA,MAAMA,EAAsB;AAAA,EAwBxB,YAAYC,IAA8B,IAAI;AAvBe,SAAA,aAAAC,EAAI,EAAC,UAAU,CAAA,GAAI,OAAO,IAAG,GAC1F,KAAA,gBAA4EA,EAAI,IAAI,GAgB/C,KAAA,iBAAA;AAAA,MACjC,YAAY;AAAA,MACZ,YAAY;AAAA,IAAA,GAGhB,KAAA,UAA8B,IAGrB,KAAA,UAAUC,EAAO,aAAaA,EAAO,UAAUF,CAAO,GAAG,KAAK,cAAc,GACjF,KAAK,aAAaC,EAAI,KAAK,QAAQ,UAAU,GAC7C,KAAK,aAAaA,EAAI,KAAK,QAAQ,UAAU,GAC7C,KAAK,aAAaA,EAAK,KAAK,QAAQ,UAAqB,GACzD,KAAK,QAAQA,EAAI,KAAK,QAAQ,KAAK,GACnC,KAAK,QAAQA,EAAI,KAAK,QAAQ,KAAK;AAAA,EACvC;AAAA;AAAA,EAGA,aAAa;AAET,SAAK,MAAM,QAAQ,KAAK,WAAW,UAAU,QAAQ,OAAO,KAAK,WAAW,UAAU,SAAS,OAAO,KAAK,MAAM,OACjH,KAAK,WAAW,QAAQ;AAAA,EAC5B;AAAA;AAAA,EAGA,cAAc;AACV,SAAK,WAAW,QAAQ;AAAA,EAC5B;AAAA;AAAA,EAGA,SAAS;AACL,SAAK,YAAY;AAAA,EACrB;AACJ;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import t from "lodash";
|
|
2
|
+
import { ref as o } from "vue";
|
|
3
|
+
class m {
|
|
4
|
+
constructor(s) {
|
|
5
|
+
this.formRef = o(null), this.options = {
|
|
6
|
+
form: {
|
|
7
|
+
model: {},
|
|
8
|
+
formItem: {}
|
|
9
|
+
}
|
|
10
|
+
}, this.defaultOptions = {
|
|
11
|
+
form: {
|
|
12
|
+
inline: !0,
|
|
13
|
+
labelWidth: "80px",
|
|
14
|
+
colLayout: {
|
|
15
|
+
xl: 24,
|
|
16
|
+
// ≥1920px
|
|
17
|
+
lg: 24,
|
|
18
|
+
// ≥1200px
|
|
19
|
+
md: 24,
|
|
20
|
+
// ≥992px
|
|
21
|
+
sm: 24,
|
|
22
|
+
// ≥768px
|
|
23
|
+
xs: 24
|
|
24
|
+
// <768px
|
|
25
|
+
},
|
|
26
|
+
model: {},
|
|
27
|
+
formItem: {}
|
|
28
|
+
}
|
|
29
|
+
}, this.options = t.defaultsDeep(t.cloneDeep(s), this.defaultOptions), this.form = o(this.options.form), this.search = o(this.options.search);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
export {
|
|
33
|
+
m as default
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../packages/hooks/UseForm/index.ts"],"sourcesContent":["import {DinertFormProps, DinertForm} from '@packages/index'\nimport lodash from 'lodash'\nimport {Ref, ref} from 'vue'\nclass UseForm<D, FI> {\n form: Ref<DinertFormProps<D, FI>['form']>\n formRef: Ref<InstanceType<typeof DinertForm> | null> = ref(null)\n search: Ref<DinertFormProps<D, FI>['search']>\n options: DinertFormProps<D, FI> = {\n form: {\n model: {},\n formItem: {}\n }\n }\n defaultOptions: DinertFormProps<D, FI> = {\n form: {\n inline: true,\n labelWidth: '80px',\n colLayout: {\n xl: 24, // ≥1920px\n lg: 24, // ≥1200px\n md: 24, // ≥992px\n sm: 24, // ≥768px\n xs: 24, // <768px\n },\n model: {},\n formItem: {}\n }\n }\n constructor(options: DinertFormProps<D, FI>) {\n this.options = lodash.defaultsDeep(lodash.cloneDeep(options), this.defaultOptions)\n\n this.form = ref<DinertFormProps<D, FI>['form'] | any>(this.options.form)\n this.search = ref<DinertFormProps<D, FI>['search']>(this.options.search)\n }\n}\n\nexport default UseForm\n"],"names":["UseForm","options","ref","lodash"],"mappings":";;AAGA,MAAMA,EAAe;AAAA,EAyBjB,YAAYC,GAAiC;AAvB7C,SAAA,UAAuDC,EAAI,IAAI,GAE7B,KAAA,UAAA;AAAA,MAC9B,MAAM;AAAA,QACF,OAAO,CAAC;AAAA,QACR,UAAU,CAAC;AAAA,MACf;AAAA,IAAA,GAEqC,KAAA,iBAAA;AAAA,MACrC,MAAM;AAAA,QACF,QAAQ;AAAA,QACR,YAAY;AAAA,QACZ,WAAW;AAAA,UACP,IAAI;AAAA;AAAA,UACJ,IAAI;AAAA;AAAA,UACJ,IAAI;AAAA;AAAA,UACJ,IAAI;AAAA;AAAA,UACJ,IAAI;AAAA;AAAA,QACR;AAAA,QACA,OAAO,CAAC;AAAA,QACR,UAAU,CAAC;AAAA,MACf;AAAA,IAAA,GAGK,KAAA,UAAUC,EAAO,aAAaA,EAAO,UAAUF,CAAO,GAAG,KAAK,cAAc,GAEjF,KAAK,OAAOC,EAA0C,KAAK,QAAQ,IAAI,GACvE,KAAK,SAASA,EAAsC,KAAK,QAAQ,MAAM;AAAA,EAC3E;AACJ;"}
|
package/es/packages/index.mjs
CHANGED
|
@@ -1,23 +1,27 @@
|
|
|
1
1
|
import * as o from "./components/index.mjs";
|
|
2
2
|
import t from "./hooks/TablePage/index.mjs";
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
import m from "./hooks/UseDialog/index.mjs";
|
|
4
|
+
import i from "./hooks/UseForm/index.mjs";
|
|
5
|
+
import { DinertTable as c } from "./components/table/index.mjs";
|
|
6
|
+
import { DinertTablePage as b } from "./components/table-page/index.mjs";
|
|
7
|
+
import { DinertForm as U } from "./components/form/index.mjs";
|
|
8
|
+
import { DinertTooltip as F } from "./components/tooltip/index.mjs";
|
|
9
|
+
import { DinertDialog as d } from "./components/dialog/index.mjs";
|
|
10
|
+
const l = t, f = m, p = i, D = {
|
|
11
|
+
install: (r) => {
|
|
12
|
+
for (const e in o)
|
|
13
|
+
r.use(o[e]);
|
|
12
14
|
}
|
|
13
15
|
};
|
|
14
16
|
export {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
d as DinertDialog,
|
|
18
|
+
U as DinertForm,
|
|
19
|
+
c as DinertTable,
|
|
20
|
+
b as DinertTablePage,
|
|
21
|
+
F as DinertTooltip,
|
|
22
|
+
l as TablePage,
|
|
23
|
+
f as UseDialog,
|
|
24
|
+
p as UseForm,
|
|
25
|
+
D as default
|
|
22
26
|
};
|
|
23
27
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../packages/index.ts"],"sourcesContent":["import {Plugin, App} from 'vue'\nimport * as components from './components/index'\nimport TablePage2 from './hooks/TablePage/index'\n\nexport * from './components/index'\nexport const TablePage = TablePage2\nexport * from './hooks/TablePage/types/index'\n\n\nconst myPlugin: Plugin = {\n install: (app: App) => {\n for (const name in components) {\n app.use((components as any)[name])\n }\n }\n}\n\nexport default myPlugin\n"],"names":["TablePage","TablePage2","myPlugin","app","name","components"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../packages/index.ts"],"sourcesContent":["import {Plugin, App} from 'vue'\nimport * as components from './components/index'\nimport TablePage2 from './hooks/TablePage/index'\nimport UseDialog2 from './hooks/UseDialog/index'\nimport UseForm2 from './hooks/UseForm/index'\n\nexport * from './components/index'\nexport const TablePage = TablePage2\nexport const UseDialog = UseDialog2\nexport const UseForm = UseForm2\nexport * from './hooks/TablePage/types/index'\n\n\nconst myPlugin: Plugin = {\n install: (app: App) => {\n for (const name in components) {\n app.use((components as any)[name])\n }\n }\n}\n\nexport default myPlugin\n"],"names":["TablePage","TablePage2","UseDialog","UseDialog2","UseForm","UseForm2","myPlugin","app","name","components"],"mappings":";;;;;;;;;AAOO,MAAMA,IAAYC,GACZC,IAAYC,GACZC,IAAUC,GAIjBC,IAAmB;AAAA,EACrB,SAAS,CAACC,MAAa;AACnB,eAAWC,KAAQC;AACX,MAAAF,EAAA,IAAKE,EAAmBD,CAAI,CAAC;AAAA,EAEzC;AACJ;"}
|
|
@@ -51,7 +51,7 @@ type ToString<T> = {
|
|
|
51
51
|
[P in keyof T]: T[P] extends keyof RewriteFormItemPropsMap ? string : T[P];
|
|
52
52
|
};
|
|
53
53
|
type FormItemMap<D, FI> = {
|
|
54
|
-
[P in keyof ToModelItem<D, FI>]: CustomFormItemProps<MergeProp<
|
|
54
|
+
[P in keyof ToModelItem<D, FI>]: CustomFormItemProps<MergeProp<FI, D>, any[], ToModelItem<D, FI>[P] extends keyof RewriteFormItemPropsMap ? ToModelItem<D, FI>[P] : keyof RewriteFormItemPropsMap>;
|
|
55
55
|
};
|
|
56
56
|
export interface RewriteFormProps<D = any, FI = any> extends Omit<Partial<FormProps>, 'model'> {
|
|
57
57
|
model: Partial<MergeProp<D, ToString<FI>>>;
|
|
@@ -16,6 +16,7 @@ export interface OperationsProps<T = any> extends Partial<ButtonProps> {
|
|
|
16
16
|
click?: (scope: ScopeProps<T>, column: RewriteTableColumnCtx<T>, item: OperationsProps<T>) => void;
|
|
17
17
|
sort?: number;
|
|
18
18
|
confirm?: Partial<PopconfirmProps>;
|
|
19
|
+
key?: string;
|
|
19
20
|
}
|
|
20
21
|
export interface RewriteTableColumnCtx<T = any> extends Omit<Partial<TableColumnCtx<T>>, 'children'> {
|
|
21
22
|
type?: 'default' | 'selection' | 'index' | 'expand';
|
|
@@ -51,6 +52,7 @@ export interface HeaderListProps extends Partial<ButtonProps> {
|
|
|
51
52
|
click?: (item: HeaderListProps) => void;
|
|
52
53
|
sort?: number;
|
|
53
54
|
show?: boolean | ((item: HeaderListProps) => boolean);
|
|
55
|
+
key?: string;
|
|
54
56
|
}
|
|
55
57
|
export interface TablePageProps<T = any> {
|
|
56
58
|
header?: boolean | {
|
|
@@ -12,6 +12,7 @@ import { MergeProp } from '../../components/form/types/utils';
|
|
|
12
12
|
* R 请求回来的数据格式
|
|
13
13
|
*/
|
|
14
14
|
declare class TablePage<T, D = any, FI = any, P = object, R = any> {
|
|
15
|
+
dialogForm: Ref<DinertTablePageProps<T, T, FI>['form']>;
|
|
15
16
|
showSearch: Ref<DinertTablePageProps['search']>;
|
|
16
17
|
table: Ref<DinertTablePageProps<T, D, FI>['table']>;
|
|
17
18
|
form: Ref<DinertTablePageProps<T, D, FI>['form']>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { RewriteDialogProps, DinertTablePageProps, DinertForm } from '../../index';
|
|
2
|
+
import type { DialogEmits } from 'element-plus';
|
|
3
|
+
import { Ref } from 'vue';
|
|
4
|
+
declare class UseDialog<T, R = any> {
|
|
5
|
+
dialogForm: Ref<DinertTablePageProps<T, any, any>['form']>;
|
|
6
|
+
dialogFormRef: Ref<R | {
|
|
7
|
+
formRef: InstanceType<typeof DinertForm>;
|
|
8
|
+
} | null>;
|
|
9
|
+
modelValue: Ref<RewriteDialogProps['modelValue']>;
|
|
10
|
+
modalClass: Ref<string>;
|
|
11
|
+
width: Ref<RewriteDialogProps['width']>;
|
|
12
|
+
title: Ref<RewriteDialogProps['title']>;
|
|
13
|
+
fullscreen: Ref<RewriteDialogProps['fullscreen']>;
|
|
14
|
+
opened?: DialogEmits['opened'];
|
|
15
|
+
open?: DialogEmits['open'];
|
|
16
|
+
openAutoFocus?: DialogEmits['openAutoFocus'];
|
|
17
|
+
closeAutoFocus?: DialogEmits['closeAutoFocus'];
|
|
18
|
+
close?: DialogEmits['close'];
|
|
19
|
+
closed?: DialogEmits['closed'];
|
|
20
|
+
save?: () => void;
|
|
21
|
+
defaultOptions: RewriteDialogProps;
|
|
22
|
+
options: RewriteDialogProps;
|
|
23
|
+
constructor(options?: RewriteDialogProps);
|
|
24
|
+
openDialog(): void;
|
|
25
|
+
closeDialog(): void;
|
|
26
|
+
cancel(): void;
|
|
27
|
+
}
|
|
28
|
+
export default UseDialog;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DinertFormProps, DinertForm } from '../../index';
|
|
2
|
+
import { Ref } from 'vue';
|
|
3
|
+
declare class UseForm<D, FI> {
|
|
4
|
+
form: Ref<DinertFormProps<D, FI>['form']>;
|
|
5
|
+
formRef: Ref<InstanceType<typeof DinertForm> | null>;
|
|
6
|
+
search: Ref<DinertFormProps<D, FI>['search']>;
|
|
7
|
+
options: DinertFormProps<D, FI>;
|
|
8
|
+
defaultOptions: DinertFormProps<D, FI>;
|
|
9
|
+
constructor(options: DinertFormProps<D, FI>);
|
|
10
|
+
}
|
|
11
|
+
export default UseForm;
|
package/es/src/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Plugin } from 'vue';
|
|
2
2
|
import TablePage2 from './hooks/TablePage/index';
|
|
3
|
+
import UseDialog2 from './hooks/UseDialog/index';
|
|
4
|
+
import UseForm2 from './hooks/UseForm/index';
|
|
3
5
|
export * from './components/index';
|
|
4
6
|
export declare const TablePage: typeof TablePage2;
|
|
7
|
+
export declare const UseDialog: typeof UseDialog2;
|
|
8
|
+
export declare const UseForm: typeof UseForm2;
|
|
5
9
|
export * from './hooks/TablePage/types/index';
|
|
6
10
|
declare const myPlugin: Plugin;
|
|
7
11
|
export default myPlugin;
|
package/es/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.tree-item{width:100%}.tree-item .el-tooltip__trigger{display:block;overflow:hidden;width:100%;text-align:left;text-overflow:ellipsis;white-space:nowrap}.el-popover-classify{overflow-y:auto;margin:0;padding:0;list-style:none}.el-popover-classify li{margin:0;padding:0;list-style:none}.el-popover-classify li:first-child{border-bottom:1px solid var(--el-fill-color);line-height:32px}.el-popover-classify>.el-tree>.el-tree-node>.el-tree-node__content>.el-tree-node__expand-icon.is-leaf{display:none}.el-popover-classify .el-tree-node__children{overflow:unset}.dinert-table{display:flex;padding:20px;height:100%;border-radius:var(--el-bg-radius);background-color:var(--el-bg-color);flex-direction:column;box-sizing:border-box}.dinert-table .dinert-table-header{display:flex;justify-content:space-between;margin-bottom:12px;text-align:right}.dinert-table .dinert-table-header .el-popover-classify li .el-checkbox{width:100%;line-height:24px;height:24px}.dinert-table .dinert-table-header .dinert-table-header-left{text-align:left}.dinert-table .dinert-table-body{flex:1;height:0}.dinert-table .dinert-table-body .el-table .el-popper{max-width:50%}.dinert-table .dinert-table-body .el-table .el-table__header .el-table__cell.setting .setting-icon{display:inline-block}.dinert-table .dinert-table-body .el-table .el-table__header .el-table__cell .cell{color:var(--zp-color-secondary-text-title)}.dinert-table .dinert-table-body .el-table .el-table__header .el-table__cell .cell .setting-icon{vertical-align:-1px;margin-left:4px;cursor:pointer}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper td{color:var(--zp-color-secondary-text-title)}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper td .cell.el-tooltip>.cell-item{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper td .cell.el-tooltip>.cell-item .cell-item-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .el-dropdown{vertical-align:-2px}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell{display:flex;justify-content:center;align-items:center}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .el-button{margin-right:8px;margin-left:0}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .el-button:focus-visible{outline:none}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .el-svg-icon{font-size:14px;color:var(--el-color-primary);cursor:pointer;flex:1}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .el-svg-icon.delete{color:var(--el-color-danger)}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .svg-icon{width:16px;height:16px;vertical-align:-2px;flex:1;color:var(--el-color-primary);cursor:pointer;fill:var(--el-color-primary)}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .svg-icon.f-14{width:14px;height:14px}.dinert-table .dinert-table-footer{display:flex;margin-top:16px}.dinert-table .dinert-table-footer .el-pagination{display:flex;flex-wrap:wrap}.dinert-table-page{display:flex;flex-direction:column;box-sizing:border-box}.dinert-table-page.text-wrap .el-table__header .cell{white-space:pre-wrap}.dinert-table-page.text-wrap .el-table__body .el-table__row td>.cell,.dinert-table-page.text-wrap .el-table__body .el-table__row td>.cell>.cell-item,.dinert-table-page.text-wrap .el-table__body .el-table__row td .cell.el-tooltip>.cell-item{white-space:pre-wrap}.dinert-table-page.text-wrap .el-table__body .el-table__row .el-button>span{text-align:left}.dinert-table-page.text-wrap .el-table__body .el-table__row span{white-space:pre-wrap;line-height:23px}.dinert-table-page.header-center .el-table__header .el-table__cell{text-align:center}.dinert-table-page.near .el-form-left{flex:unset}.dinert-table-page.near .el-form-left .el-col{margin-right:16px;width:auto;max-width:unset;flex:unset}.dinert-table-page.near .dinert-table-footer .el-pagination{margin-left:auto}.dinert-table-page.maxWidthAuto .el-form .el-form-item .el-form-item__label{max-width:unset}.dinert-table-page .dinert-form{padding:20px 20px 0;max-height:300px}.dinert-table-page .dinert-table{padding-top:0;height:0;flex:1}.el-form{display:flex;overflow:hidden;padding:0;min-height:50px;border-radius:4px;background-color:var(--el-bg-color);transition:all .3s cubic-bezier(.645,.045,.355,1);box-sizing:content-box}.
|
|
1
|
+
.tree-item{width:100%}.tree-item .el-tooltip__trigger{display:block;overflow:hidden;width:100%;text-align:left;text-overflow:ellipsis;white-space:nowrap}.el-popover-classify{overflow-y:auto;margin:0;padding:0;list-style:none}.el-popover-classify li{margin:0;padding:0;list-style:none}.el-popover-classify li:first-child{border-bottom:1px solid var(--el-fill-color);line-height:32px}.el-popover-classify>.el-tree>.el-tree-node>.el-tree-node__content>.el-tree-node__expand-icon.is-leaf{display:none}.el-popover-classify .el-tree-node__children{overflow:unset}.dinert-table{display:flex;padding:20px;height:100%;border-radius:var(--el-bg-radius);background-color:var(--el-bg-color);flex-direction:column;box-sizing:border-box}.dinert-table .dinert-table-header{display:flex;justify-content:space-between;margin-bottom:12px;text-align:right}.dinert-table .dinert-table-header .el-popover-classify li .el-checkbox{width:100%;line-height:24px;height:24px}.dinert-table .dinert-table-header .dinert-table-header-left{text-align:left}.dinert-table .dinert-table-body{flex:1;height:0}.dinert-table .dinert-table-body .el-table .el-popper{max-width:50%}.dinert-table .dinert-table-body .el-table .el-table__header .el-table__cell.setting .setting-icon{display:inline-block}.dinert-table .dinert-table-body .el-table .el-table__header .el-table__cell .cell{color:var(--zp-color-secondary-text-title)}.dinert-table .dinert-table-body .el-table .el-table__header .el-table__cell .cell .setting-icon{vertical-align:-1px;margin-left:4px;cursor:pointer}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper td{color:var(--zp-color-secondary-text-title)}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper td .cell.el-tooltip>.cell-item{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper td .cell.el-tooltip>.cell-item .cell-item-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .el-dropdown{vertical-align:-2px}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell{display:flex;justify-content:center;align-items:center}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .el-button{margin-right:8px;margin-left:0}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .el-button:focus-visible{outline:none}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .el-svg-icon{font-size:14px;color:var(--el-color-primary);cursor:pointer;flex:1}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .el-svg-icon.delete{color:var(--el-color-danger)}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .svg-icon{width:16px;height:16px;vertical-align:-2px;flex:1;color:var(--el-color-primary);cursor:pointer;fill:var(--el-color-primary)}.dinert-table .dinert-table-body .el-table .el-table__body-wrapper .operations .cell .svg-icon.f-14{width:14px;height:14px}.dinert-table .dinert-table-footer{display:flex;margin-top:16px}.dinert-table .dinert-table-footer .el-pagination{display:flex;flex-wrap:wrap}.dinert-table-page{display:flex;flex-direction:column;box-sizing:border-box}.dinert-table-page.text-wrap .el-table__header .cell{white-space:pre-wrap}.dinert-table-page.text-wrap .el-table__body .el-table__row td>.cell,.dinert-table-page.text-wrap .el-table__body .el-table__row td>.cell>.cell-item,.dinert-table-page.text-wrap .el-table__body .el-table__row td .cell.el-tooltip>.cell-item{white-space:pre-wrap}.dinert-table-page.text-wrap .el-table__body .el-table__row .el-button>span{text-align:left}.dinert-table-page.text-wrap .el-table__body .el-table__row span{white-space:pre-wrap;line-height:23px}.dinert-table-page.header-center .el-table__header .el-table__cell{text-align:center}.dinert-table-page.near .el-form-left{flex:unset}.dinert-table-page.near .el-form-left .el-col{margin-right:16px;width:auto;max-width:unset;flex:unset}.dinert-table-page.near .dinert-table-footer .el-pagination{margin-left:auto}.dinert-table-page.maxWidthAuto .el-form .el-form-item .el-form-item__label{max-width:unset}.dinert-table-page .dinert-form{padding:20px 20px 0;max-height:300px}.dinert-table-page .dinert-table{padding-top:0;height:0;flex:1}.dinert-form.el-form{display:flex;overflow:hidden;padding:0;min-height:50px;border-radius:4px;background-color:var(--el-bg-color);transition:all .3s cubic-bezier(.645,.045,.355,1);box-sizing:content-box}.dinert-form.el-form.packUp{max-height:50px}.dinert-form.el-form.near .el-form-left .el-col{display:flex;align-items:center;margin-right:10px;width:auto;max-width:unset;flex:unset}.dinert-form.el-form.near .el-form-right.isArrow{width:230px;flex:0 0 230px}.dinert-form.el-form.dialog .el-form-left{flex:1}.dinert-form.el-form.dialog .el-form-left .el-col .label-text>div{width:100%}.dinert-form.el-form .el-form-left .el-col .label-text .el-radio.is-bordered,.dinert-form.el-form .el-form-left .el-col .label-text .el-checkbox.is-bordered{margin-right:16px}.dinert-form.el-form .el-form-left .el-col .label-text .el-date-editor{width:210px}.dinert-form.el-form .el-form-left .el-col .label-text .el-date-editor--daterange{width:260px}.dinert-form.el-form .el-form-left .el-col .label-text>.el-input{width:210px}.dinert-form.el-form .el-form-left .el-col .label-text>.el-select{width:210px}.dinert-form.el-form .el-form-left .el-col .label-text .el-date-editor--datetimerange{width:400px}.dinert-form.el-form .el-form-right{display:flex;margin-left:24px}.dinert-form.el-form .el-form-right .el-form-right-operation{padding:0}.dinert-form.el-form .el-form-right .el-form-right-operation.el-button.is-text{padding-right:0;background-color:unset}.dinert-form.el-form div.el-form-item{position:relative;display:flex;margin-right:0;margin-bottom:18px;width:100%}.dinert-form.el-form div.el-form-item.show-label .label-text{overflow:unset;text-overflow:unset;white-space:unset}.dinert-form.el-form div.el-form-item.label-wrap .el-form-item__label{height:auto}.dinert-form.el-form div.el-form-item.label-wrap .el-form-item__label .label-text{display:inline;text-align:left;white-space:normal}.dinert-form.el-form .el-form-item__content{flex:1;margin-left:0}.dinert-form.el-form .el-form-item__content .el-tooltip__trigger,.dinert-form.el-form .el-form-item__content .el-input-number{width:100%}.dinert-form.el-form .el-form-item__content .el-input-number .el-input__inner{text-align:center}.dinert-form.el-form .el-form-item__content .el-textarea .el-textarea__inner{height:80px}.dinert-form.el-form .el-form-item__content .el-date-editor,.dinert-form.el-form .el-form-item__content .el-date-editor .el-input__wrapper{width:100%;box-sizing:border-box}.dinert-form.el-form .el-form-item__content .el-input__inner{overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap}.dinert-form.el-form .el-form-item__content .el-form-item__label{overflow:hidden;width:80px;max-width:80px;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dinert-form.el-form .el-form-item__content .el-form-item__label .el-tooltip,.dinert-form.el-form .el-form-item__content .el-form-item__label .el-tooltip .label-text{display:inline}.el-overlay.autoHeight .el-dialog{height:80%}.el-overlay.notPadding .el-dialog__body{padding:0}.el-overlay .el-dialog{top:10%;display:flex;min-width:310px;max-height:80%;border-radius:4px;flex-direction:column;--el-dialog-margin-top: 0;--el-dialog-padding-primary: 0}.el-overlay .el-dialog.is-fullscreen{top:unset;max-height:unset}.el-overlay .el-dialog__headerbtn{right:0;width:40px;height:100%;color:var(--el-color-info)}.el-overlay .el-dialog .full{position:absolute;top:-1.5px;right:34px;display:flex;justify-content:center;align-items:center;width:40px;height:100%;font-size:var(--el-message-close-size, 16px);border:none;color:var(--el-color-info);background:transparent;outline:none;cursor:pointer}.el-overlay .el-dialog .full:hover .icon{fill:var(--el-color-primary);color:var(--el-color-primary)}.el-overlay .el-dialog .full .icon{overflow:hidden;width:14px;height:14px;vertical-align:-.15em;fill:var(--el-color-info)}.el-overlay .el-dialog__header{position:relative;margin-right:0;padding:16px 24px;height:54px;box-sizing:border-box}.el-overlay .el-dialog__body{display:flex;overflow-y:auto;padding:24px;flex-direction:column;flex:1;word-wrap:break-word}.el-overlay .el-dialog__body>.el-form{overflow:unset}.el-overlay .el-dialog__footer{display:flex;justify-content:center;align-items:center;clear:both;padding:12px 24px 16px}.el-overlay .el-dialog__footer .el-button{margin:0}.el-overlay .el-dialog__footer .el-button+.el-button{margin-left:12px}.dinert-tooltip.el-tooltip__trigger{display:block;height:100%}.dinert-tooltip.el-tooltip__trigger .text-tooltip{position:absolute;left:-999999999999px}.dinert-tooltip.el-tooltip__trigger .label-text{display:block;overflow:hidden;width:100%;height:100%;text-overflow:ellipsis;white-space:nowrap}
|