web-component-gallery 1.1.43 → 1.1.44
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/amap.umd.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/table.umd.js +1 -1
- package/lib/table/index.vue +2 -2
- package/package.json +1 -1
- package/plugins/lib/table/index.vue +2 -2
- package/plugins/utils/Tree.js +115 -114
package/dist/amap.umd.js
CHANGED
|
@@ -8679,7 +8679,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony default export */
|
|
|
8679
8679
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8680
8680
|
|
|
8681
8681
|
"use strict";
|
|
8682
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var ant_design_vue_es__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ant-design-vue/es */ \"./node_modules/ant-design-vue/es/icon/index.js\");\n/* harmony import */ var ant_design_vue_es__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ant-design-vue/es */ \"./node_modules/ant-design-vue/es/table/index.js\");\n/* harmony import */ var ant_design_vue_es__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ant-design-vue/es */ \"./node_modules/ant-design-vue/es/pagination/index.js\");\n\nconst IconFont = ant_design_vue_es__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createFromIconfontCN({\n scriptUrl: '//at.alicdn.com/t/c/font_4640977_auv55jur50b.js'\n});\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n components: {\n Table: ant_design_vue_es__WEBPACK_IMPORTED_MODULE_1__[\"default\"],\n Pagination: ant_design_vue_es__WEBPACK_IMPORTED_MODULE_2__[\"default\"]\n },\n name: 'uTable',\n data() {\n return {\n pagination: {\n total: 0,\n size: 10,\n current: 1\n },\n tableScrollBody: 600\n };\n },\n props: {\n // 紧凑型和宽松型 \n // relax 宽松型\n // compact 紧凑型\n tableStyle: {\n type: String,\n default: 'compact'\n },\n // compact 紧凑型情况下是否有分割线\n tableSplit: {\n type: Boolean,\n default: true\n },\n // 表格数据\n datas: {\n type: Array,\n default: () => []\n },\n // 选中数据项\n selectedRowKeys: {\n type: Array,\n default: () => []\n },\n // 分页默认值\n paginationParams: {\n type: Object,\n default: () => ({\n total: 0,\n size: 10,\n current: 1\n })\n },\n // 配置分页数据\n pageSizeOptions: {\n type: Array,\n default: () => ['10', '15', '20', '30', '50']\n }\n },\n computed: {\n setAttrs() {\n const h = this.$createElement;\n return {\n pagination: false,\n rowKey: (record, i) => record.id ?? `${this.pagination.current}${i}`,\n rowSelection: {\n selectedRowKeys: this.selectedRowKeys,\n onChange: this.onSelectChange\n },\n locale: {\n emptyText: h(\"div\", {\n \"class\": \"WebComponentTable__List__Empty\"\n }, [h(IconFont, {\n \"attrs\": {\n \"type\": \"icon-zanwushuju\"\n }\n }), h(\"span\", [\"\\u6682\\u65E0\\u6570\\u636E\"])])\n },\n ...this.$attrs\n };\n },\n tableSize() {\n return this.tableStyle == 'compact' ? 'middle' : 'default';\n }\n },\n watch: {\n paginationParams(newValue) {\n this.pagination = {\n ...newValue\n };\n }\n },\n mounted() {\n this.pagination = {\n ...this.paginationParams\n };\n const scrollTimer = setTimeout(() => {\n this.getScrollBodyH();\n clearTimeout(scrollTimer);\n }, 300);\n window.addEventListener('resize', () => this.getScrollBodyH());\n this.removeDomElement();\n },\n destroyed() {\n // window.removeEventListener( 'resize' )\n },\n methods: {\n /** 根据内容高度计算滚动长度 */\n getScrollBodyH() {\n this.tableScrollBody = this.$refs.Table.clientHeight - this.$refs.TableHead.offsetHeight - this.$refs.TablePagination.offsetHeight - 16 - this.$refs.TableListTitle.offsetHeight - document.querySelector('.ant-table-thead').offsetHeight -
|
|
8682
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var ant_design_vue_es__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ant-design-vue/es */ \"./node_modules/ant-design-vue/es/icon/index.js\");\n/* harmony import */ var ant_design_vue_es__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ant-design-vue/es */ \"./node_modules/ant-design-vue/es/table/index.js\");\n/* harmony import */ var ant_design_vue_es__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ant-design-vue/es */ \"./node_modules/ant-design-vue/es/pagination/index.js\");\n\nconst IconFont = ant_design_vue_es__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createFromIconfontCN({\n scriptUrl: '//at.alicdn.com/t/c/font_4640977_auv55jur50b.js'\n});\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n components: {\n Table: ant_design_vue_es__WEBPACK_IMPORTED_MODULE_1__[\"default\"],\n Pagination: ant_design_vue_es__WEBPACK_IMPORTED_MODULE_2__[\"default\"]\n },\n name: 'uTable',\n data() {\n return {\n pagination: {\n total: 0,\n size: 10,\n current: 1\n },\n tableScrollBody: 600\n };\n },\n props: {\n // 紧凑型和宽松型 \n // relax 宽松型\n // compact 紧凑型\n tableStyle: {\n type: String,\n default: 'compact'\n },\n // compact 紧凑型情况下是否有分割线\n tableSplit: {\n type: Boolean,\n default: true\n },\n // 表格数据\n datas: {\n type: Array,\n default: () => []\n },\n // 选中数据项\n selectedRowKeys: {\n type: Array,\n default: () => []\n },\n // 分页默认值\n paginationParams: {\n type: Object,\n default: () => ({\n total: 0,\n size: 10,\n current: 1\n })\n },\n // 配置分页数据\n pageSizeOptions: {\n type: Array,\n default: () => ['10', '15', '20', '30', '50']\n }\n },\n computed: {\n setAttrs() {\n const h = this.$createElement;\n return {\n pagination: false,\n rowKey: (record, i) => record.id ?? `${this.pagination.current}${i}`,\n rowSelection: {\n selectedRowKeys: this.selectedRowKeys,\n onChange: this.onSelectChange\n },\n locale: {\n emptyText: h(\"div\", {\n \"class\": \"WebComponentTable__List__Empty\"\n }, [h(IconFont, {\n \"attrs\": {\n \"type\": \"icon-zanwushuju\"\n }\n }), h(\"span\", [\"\\u6682\\u65E0\\u6570\\u636E\"])])\n },\n ...this.$attrs\n };\n },\n tableSize() {\n return this.tableStyle == 'compact' ? 'middle' : 'default';\n }\n },\n watch: {\n paginationParams(newValue) {\n this.pagination = {\n ...newValue\n };\n }\n },\n mounted() {\n this.pagination = {\n ...this.paginationParams\n };\n const scrollTimer = setTimeout(() => {\n this.getScrollBodyH();\n clearTimeout(scrollTimer);\n }, 300);\n window.addEventListener('resize', () => this.getScrollBodyH());\n this.removeDomElement();\n },\n destroyed() {\n // window.removeEventListener( 'resize' )\n },\n methods: {\n /** 根据内容高度计算滚动长度 */\n getScrollBodyH() {\n this.tableScrollBody = this.$refs.Table.clientHeight - this.$refs.TableHead.offsetHeight - this.$refs.TablePagination.offsetHeight - 16 - this.$refs.TableListTitle.offsetHeight - document.querySelector('.ant-table-thead').offsetHeight - 20;\n /** 20为获取高度时抹掉的小数点后两位的浮动空间(存在叠加多个获取错误的情况) */\n console.log(this.$refs.Table.clientHeight, this.tableScrollBody, 'tableScrollBody滚动高度');\n },\n /** 根据高度判断dom元素是否加载 进行删除 */\n removeDomElement() {\n let domElement;\n this.$refs.Table.querySelectorAll('div').forEach(node => {\n node.className == 'ant-table-title' && (domElement = node);\n });\n !this.$scopedSlots.ATableHead && this.$refs.TableHead.remove();\n !this.$scopedSlots.ATableTitle && (domElement.style.padding = '0');\n },\n onSelectChange(selectedKey, selectedRecord) {\n this.$emit('selectedRecords', selectedKey, selectedRecord);\n },\n paginationChange(current, pageSize) {\n this.pagination = {\n ...this.pagination,\n size: pageSize,\n current\n };\n this.$emit('pageSizeChange', this.pagination);\n }\n }\n});\n\n//# sourceURL=webpack://mui/./plugins/lib/table/index.vue?./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js??vue-loader-options");
|
|
8683
8683
|
|
|
8684
8684
|
/***/ }),
|
|
8685
8685
|
|
package/dist/index.umd.js
CHANGED
|
@@ -8679,7 +8679,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony default export */
|
|
|
8679
8679
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
8680
8680
|
|
|
8681
8681
|
"use strict";
|
|
8682
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var ant_design_vue_es__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ant-design-vue/es */ \"./node_modules/ant-design-vue/es/icon/index.js\");\n/* harmony import */ var ant_design_vue_es__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ant-design-vue/es */ \"./node_modules/ant-design-vue/es/table/index.js\");\n/* harmony import */ var ant_design_vue_es__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ant-design-vue/es */ \"./node_modules/ant-design-vue/es/pagination/index.js\");\n\nconst IconFont = ant_design_vue_es__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createFromIconfontCN({\n scriptUrl: '//at.alicdn.com/t/c/font_4640977_auv55jur50b.js'\n});\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n components: {\n Table: ant_design_vue_es__WEBPACK_IMPORTED_MODULE_1__[\"default\"],\n Pagination: ant_design_vue_es__WEBPACK_IMPORTED_MODULE_2__[\"default\"]\n },\n name: 'uTable',\n data() {\n return {\n pagination: {\n total: 0,\n size: 10,\n current: 1\n },\n tableScrollBody: 600\n };\n },\n props: {\n // 紧凑型和宽松型 \n // relax 宽松型\n // compact 紧凑型\n tableStyle: {\n type: String,\n default: 'compact'\n },\n // compact 紧凑型情况下是否有分割线\n tableSplit: {\n type: Boolean,\n default: true\n },\n // 表格数据\n datas: {\n type: Array,\n default: () => []\n },\n // 选中数据项\n selectedRowKeys: {\n type: Array,\n default: () => []\n },\n // 分页默认值\n paginationParams: {\n type: Object,\n default: () => ({\n total: 0,\n size: 10,\n current: 1\n })\n },\n // 配置分页数据\n pageSizeOptions: {\n type: Array,\n default: () => ['10', '15', '20', '30', '50']\n }\n },\n computed: {\n setAttrs() {\n const h = this.$createElement;\n return {\n pagination: false,\n rowKey: (record, i) => record.id ?? `${this.pagination.current}${i}`,\n rowSelection: {\n selectedRowKeys: this.selectedRowKeys,\n onChange: this.onSelectChange\n },\n locale: {\n emptyText: h(\"div\", {\n \"class\": \"WebComponentTable__List__Empty\"\n }, [h(IconFont, {\n \"attrs\": {\n \"type\": \"icon-zanwushuju\"\n }\n }), h(\"span\", [\"\\u6682\\u65E0\\u6570\\u636E\"])])\n },\n ...this.$attrs\n };\n },\n tableSize() {\n return this.tableStyle == 'compact' ? 'middle' : 'default';\n }\n },\n watch: {\n paginationParams(newValue) {\n this.pagination = {\n ...newValue\n };\n }\n },\n mounted() {\n this.pagination = {\n ...this.paginationParams\n };\n const scrollTimer = setTimeout(() => {\n this.getScrollBodyH();\n clearTimeout(scrollTimer);\n }, 300);\n window.addEventListener('resize', () => this.getScrollBodyH());\n this.removeDomElement();\n },\n destroyed() {\n // window.removeEventListener( 'resize' )\n },\n methods: {\n /** 根据内容高度计算滚动长度 */\n getScrollBodyH() {\n this.tableScrollBody = this.$refs.Table.clientHeight - this.$refs.TableHead.offsetHeight - this.$refs.TablePagination.offsetHeight - 16 - this.$refs.TableListTitle.offsetHeight - document.querySelector('.ant-table-thead').offsetHeight -
|
|
8682
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var ant_design_vue_es__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ant-design-vue/es */ \"./node_modules/ant-design-vue/es/icon/index.js\");\n/* harmony import */ var ant_design_vue_es__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ant-design-vue/es */ \"./node_modules/ant-design-vue/es/table/index.js\");\n/* harmony import */ var ant_design_vue_es__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ant-design-vue/es */ \"./node_modules/ant-design-vue/es/pagination/index.js\");\n\nconst IconFont = ant_design_vue_es__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createFromIconfontCN({\n scriptUrl: '//at.alicdn.com/t/c/font_4640977_auv55jur50b.js'\n});\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n components: {\n Table: ant_design_vue_es__WEBPACK_IMPORTED_MODULE_1__[\"default\"],\n Pagination: ant_design_vue_es__WEBPACK_IMPORTED_MODULE_2__[\"default\"]\n },\n name: 'uTable',\n data() {\n return {\n pagination: {\n total: 0,\n size: 10,\n current: 1\n },\n tableScrollBody: 600\n };\n },\n props: {\n // 紧凑型和宽松型 \n // relax 宽松型\n // compact 紧凑型\n tableStyle: {\n type: String,\n default: 'compact'\n },\n // compact 紧凑型情况下是否有分割线\n tableSplit: {\n type: Boolean,\n default: true\n },\n // 表格数据\n datas: {\n type: Array,\n default: () => []\n },\n // 选中数据项\n selectedRowKeys: {\n type: Array,\n default: () => []\n },\n // 分页默认值\n paginationParams: {\n type: Object,\n default: () => ({\n total: 0,\n size: 10,\n current: 1\n })\n },\n // 配置分页数据\n pageSizeOptions: {\n type: Array,\n default: () => ['10', '15', '20', '30', '50']\n }\n },\n computed: {\n setAttrs() {\n const h = this.$createElement;\n return {\n pagination: false,\n rowKey: (record, i) => record.id ?? `${this.pagination.current}${i}`,\n rowSelection: {\n selectedRowKeys: this.selectedRowKeys,\n onChange: this.onSelectChange\n },\n locale: {\n emptyText: h(\"div\", {\n \"class\": \"WebComponentTable__List__Empty\"\n }, [h(IconFont, {\n \"attrs\": {\n \"type\": \"icon-zanwushuju\"\n }\n }), h(\"span\", [\"\\u6682\\u65E0\\u6570\\u636E\"])])\n },\n ...this.$attrs\n };\n },\n tableSize() {\n return this.tableStyle == 'compact' ? 'middle' : 'default';\n }\n },\n watch: {\n paginationParams(newValue) {\n this.pagination = {\n ...newValue\n };\n }\n },\n mounted() {\n this.pagination = {\n ...this.paginationParams\n };\n const scrollTimer = setTimeout(() => {\n this.getScrollBodyH();\n clearTimeout(scrollTimer);\n }, 300);\n window.addEventListener('resize', () => this.getScrollBodyH());\n this.removeDomElement();\n },\n destroyed() {\n // window.removeEventListener( 'resize' )\n },\n methods: {\n /** 根据内容高度计算滚动长度 */\n getScrollBodyH() {\n this.tableScrollBody = this.$refs.Table.clientHeight - this.$refs.TableHead.offsetHeight - this.$refs.TablePagination.offsetHeight - 16 - this.$refs.TableListTitle.offsetHeight - document.querySelector('.ant-table-thead').offsetHeight - 20;\n /** 20为获取高度时抹掉的小数点后两位的浮动空间(存在叠加多个获取错误的情况) */\n console.log(this.$refs.Table.clientHeight, this.tableScrollBody, 'tableScrollBody滚动高度');\n },\n /** 根据高度判断dom元素是否加载 进行删除 */\n removeDomElement() {\n let domElement;\n this.$refs.Table.querySelectorAll('div').forEach(node => {\n node.className == 'ant-table-title' && (domElement = node);\n });\n !this.$scopedSlots.ATableHead && this.$refs.TableHead.remove();\n !this.$scopedSlots.ATableTitle && (domElement.style.padding = '0');\n },\n onSelectChange(selectedKey, selectedRecord) {\n this.$emit('selectedRecords', selectedKey, selectedRecord);\n },\n paginationChange(current, pageSize) {\n this.pagination = {\n ...this.pagination,\n size: pageSize,\n current\n };\n this.$emit('pageSizeChange', this.pagination);\n }\n }\n});\n\n//# sourceURL=webpack://mui/./plugins/lib/table/index.vue?./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js??vue-loader-options");
|
|
8683
8683
|
|
|
8684
8684
|
/***/ }),
|
|
8685
8685
|
|
package/dist/table.umd.js
CHANGED
|
@@ -4347,7 +4347,7 @@ eval("//\n\nmodule.exports = function shallowEqual(objA, objB, compare, compareC
|
|
|
4347
4347
|
/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {
|
|
4348
4348
|
|
|
4349
4349
|
"use strict";
|
|
4350
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var ant_design_vue_es__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ant-design-vue/es */ \"./node_modules/ant-design-vue/es/icon/index.js\");\n/* harmony import */ var ant_design_vue_es__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ant-design-vue/es */ \"./node_modules/ant-design-vue/es/table/index.js\");\n/* harmony import */ var ant_design_vue_es__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ant-design-vue/es */ \"./node_modules/ant-design-vue/es/pagination/index.js\");\n\nconst IconFont = ant_design_vue_es__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createFromIconfontCN({\n scriptUrl: '//at.alicdn.com/t/c/font_4640977_auv55jur50b.js'\n});\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n components: {\n Table: ant_design_vue_es__WEBPACK_IMPORTED_MODULE_1__[\"default\"],\n Pagination: ant_design_vue_es__WEBPACK_IMPORTED_MODULE_2__[\"default\"]\n },\n name: 'uTable',\n data() {\n return {\n pagination: {\n total: 0,\n size: 10,\n current: 1\n },\n tableScrollBody: 600\n };\n },\n props: {\n // 紧凑型和宽松型 \n // relax 宽松型\n // compact 紧凑型\n tableStyle: {\n type: String,\n default: 'compact'\n },\n // compact 紧凑型情况下是否有分割线\n tableSplit: {\n type: Boolean,\n default: true\n },\n // 表格数据\n datas: {\n type: Array,\n default: () => []\n },\n // 选中数据项\n selectedRowKeys: {\n type: Array,\n default: () => []\n },\n // 分页默认值\n paginationParams: {\n type: Object,\n default: () => ({\n total: 0,\n size: 10,\n current: 1\n })\n },\n // 配置分页数据\n pageSizeOptions: {\n type: Array,\n default: () => ['10', '15', '20', '30', '50']\n }\n },\n computed: {\n setAttrs() {\n const h = this.$createElement;\n return {\n pagination: false,\n rowKey: (record, i) => record.id ?? `${this.pagination.current}${i}`,\n rowSelection: {\n selectedRowKeys: this.selectedRowKeys,\n onChange: this.onSelectChange\n },\n locale: {\n emptyText: h(\"div\", {\n \"class\": \"WebComponentTable__List__Empty\"\n }, [h(IconFont, {\n \"attrs\": {\n \"type\": \"icon-zanwushuju\"\n }\n }), h(\"span\", [\"\\u6682\\u65E0\\u6570\\u636E\"])])\n },\n ...this.$attrs\n };\n },\n tableSize() {\n return this.tableStyle == 'compact' ? 'middle' : 'default';\n }\n },\n watch: {\n paginationParams(newValue) {\n this.pagination = {\n ...newValue\n };\n }\n },\n mounted() {\n this.pagination = {\n ...this.paginationParams\n };\n const scrollTimer = setTimeout(() => {\n this.getScrollBodyH();\n clearTimeout(scrollTimer);\n }, 300);\n window.addEventListener('resize', () => this.getScrollBodyH());\n this.removeDomElement();\n },\n destroyed() {\n // window.removeEventListener( 'resize' )\n },\n methods: {\n /** 根据内容高度计算滚动长度 */\n getScrollBodyH() {\n this.tableScrollBody = this.$refs.Table.clientHeight - this.$refs.TableHead.offsetHeight - this.$refs.TablePagination.offsetHeight - 16 - this.$refs.TableListTitle.offsetHeight - document.querySelector('.ant-table-thead').offsetHeight -
|
|
4350
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var ant_design_vue_es__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ant-design-vue/es */ \"./node_modules/ant-design-vue/es/icon/index.js\");\n/* harmony import */ var ant_design_vue_es__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ant-design-vue/es */ \"./node_modules/ant-design-vue/es/table/index.js\");\n/* harmony import */ var ant_design_vue_es__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ant-design-vue/es */ \"./node_modules/ant-design-vue/es/pagination/index.js\");\n\nconst IconFont = ant_design_vue_es__WEBPACK_IMPORTED_MODULE_0__[\"default\"].createFromIconfontCN({\n scriptUrl: '//at.alicdn.com/t/c/font_4640977_auv55jur50b.js'\n});\n/* harmony default export */ __webpack_exports__[\"default\"] = ({\n components: {\n Table: ant_design_vue_es__WEBPACK_IMPORTED_MODULE_1__[\"default\"],\n Pagination: ant_design_vue_es__WEBPACK_IMPORTED_MODULE_2__[\"default\"]\n },\n name: 'uTable',\n data() {\n return {\n pagination: {\n total: 0,\n size: 10,\n current: 1\n },\n tableScrollBody: 600\n };\n },\n props: {\n // 紧凑型和宽松型 \n // relax 宽松型\n // compact 紧凑型\n tableStyle: {\n type: String,\n default: 'compact'\n },\n // compact 紧凑型情况下是否有分割线\n tableSplit: {\n type: Boolean,\n default: true\n },\n // 表格数据\n datas: {\n type: Array,\n default: () => []\n },\n // 选中数据项\n selectedRowKeys: {\n type: Array,\n default: () => []\n },\n // 分页默认值\n paginationParams: {\n type: Object,\n default: () => ({\n total: 0,\n size: 10,\n current: 1\n })\n },\n // 配置分页数据\n pageSizeOptions: {\n type: Array,\n default: () => ['10', '15', '20', '30', '50']\n }\n },\n computed: {\n setAttrs() {\n const h = this.$createElement;\n return {\n pagination: false,\n rowKey: (record, i) => record.id ?? `${this.pagination.current}${i}`,\n rowSelection: {\n selectedRowKeys: this.selectedRowKeys,\n onChange: this.onSelectChange\n },\n locale: {\n emptyText: h(\"div\", {\n \"class\": \"WebComponentTable__List__Empty\"\n }, [h(IconFont, {\n \"attrs\": {\n \"type\": \"icon-zanwushuju\"\n }\n }), h(\"span\", [\"\\u6682\\u65E0\\u6570\\u636E\"])])\n },\n ...this.$attrs\n };\n },\n tableSize() {\n return this.tableStyle == 'compact' ? 'middle' : 'default';\n }\n },\n watch: {\n paginationParams(newValue) {\n this.pagination = {\n ...newValue\n };\n }\n },\n mounted() {\n this.pagination = {\n ...this.paginationParams\n };\n const scrollTimer = setTimeout(() => {\n this.getScrollBodyH();\n clearTimeout(scrollTimer);\n }, 300);\n window.addEventListener('resize', () => this.getScrollBodyH());\n this.removeDomElement();\n },\n destroyed() {\n // window.removeEventListener( 'resize' )\n },\n methods: {\n /** 根据内容高度计算滚动长度 */\n getScrollBodyH() {\n this.tableScrollBody = this.$refs.Table.clientHeight - this.$refs.TableHead.offsetHeight - this.$refs.TablePagination.offsetHeight - 16 - this.$refs.TableListTitle.offsetHeight - document.querySelector('.ant-table-thead').offsetHeight - 20;\n /** 20为获取高度时抹掉的小数点后两位的浮动空间(存在叠加多个获取错误的情况) */\n console.log(this.$refs.Table.clientHeight, this.tableScrollBody, 'tableScrollBody滚动高度');\n },\n /** 根据高度判断dom元素是否加载 进行删除 */\n removeDomElement() {\n let domElement;\n this.$refs.Table.querySelectorAll('div').forEach(node => {\n node.className == 'ant-table-title' && (domElement = node);\n });\n !this.$scopedSlots.ATableHead && this.$refs.TableHead.remove();\n !this.$scopedSlots.ATableTitle && (domElement.style.padding = '0');\n },\n onSelectChange(selectedKey, selectedRecord) {\n this.$emit('selectedRecords', selectedKey, selectedRecord);\n },\n paginationChange(current, pageSize) {\n this.pagination = {\n ...this.pagination,\n size: pageSize,\n current\n };\n this.$emit('pageSizeChange', this.pagination);\n }\n }\n});\n\n//# sourceURL=webpack://mui/./plugins/lib/table/index.vue?./node_modules/babel-loader/lib/index.js!./node_modules/vue-loader/lib/index.js??vue-loader-options");
|
|
4351
4351
|
|
|
4352
4352
|
/***/ }),
|
|
4353
4353
|
|
package/lib/table/index.vue
CHANGED
|
@@ -158,8 +158,8 @@ export default {
|
|
|
158
158
|
16 -
|
|
159
159
|
this.$refs.TableListTitle.offsetHeight -
|
|
160
160
|
document.querySelector('.ant-table-thead').offsetHeight -
|
|
161
|
-
|
|
162
|
-
/**
|
|
161
|
+
20
|
|
162
|
+
/** 20为获取高度时抹掉的小数点后两位的浮动空间(存在叠加多个获取错误的情况) */
|
|
163
163
|
console.log(this.$refs.Table.clientHeight, this.tableScrollBody, 'tableScrollBody滚动高度')
|
|
164
164
|
},
|
|
165
165
|
/** 根据高度判断dom元素是否加载 进行删除 */
|
package/package.json
CHANGED
|
@@ -158,8 +158,8 @@ export default {
|
|
|
158
158
|
16 -
|
|
159
159
|
this.$refs.TableListTitle.offsetHeight -
|
|
160
160
|
document.querySelector('.ant-table-thead').offsetHeight -
|
|
161
|
-
|
|
162
|
-
/**
|
|
161
|
+
20
|
|
162
|
+
/** 20为获取高度时抹掉的小数点后两位的浮动空间(存在叠加多个获取错误的情况) */
|
|
163
163
|
console.log(this.$refs.Table.clientHeight, this.tableScrollBody, 'tableScrollBody滚动高度')
|
|
164
164
|
},
|
|
165
165
|
/** 根据高度判断dom元素是否加载 进行删除 */
|
package/plugins/utils/Tree.js
CHANGED
|
@@ -6,154 +6,155 @@ const defaultReplaceFields = {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
*
|
|
10
|
-
* @param nodes
|
|
11
|
-
* @param parent
|
|
12
|
-
* @param replaceFields
|
|
9
|
+
* 提取树形结构中的键值集合
|
|
10
|
+
* @param {Array} nodes 树形数据
|
|
11
|
+
* @param {boolean} [parent=false] 是否只提取父节点
|
|
12
|
+
* @param {Object} [replaceFields={}] 字段映射配置
|
|
13
|
+
* @param {string} [replaceFields.children='children'] 子节点字段名
|
|
14
|
+
* @param {string} [replaceFields.key='id'] 键名字段名
|
|
15
|
+
* @returns {Array} 提取的键值数组
|
|
13
16
|
*/
|
|
14
|
-
export function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
})
|
|
17
|
+
export function getTreeKeys(
|
|
18
|
+
nodes = [],
|
|
19
|
+
parent = false,
|
|
20
|
+
{ children = 'children', key = 'id' } = {}
|
|
21
|
+
) {
|
|
22
|
+
const keys = []
|
|
23
|
+
|
|
24
|
+
function traverse(node) {
|
|
25
|
+
const shouldCollect = !parent || node[children]?.length
|
|
26
|
+
if (shouldCollect) keys.push(node[key])
|
|
27
|
+
|
|
28
|
+
if (node[children]?.length) {
|
|
29
|
+
node[children].forEach(traverse)
|
|
30
|
+
}
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return filterNodes
|
|
34
|
-
|
|
33
|
+
nodes.forEach(traverse)
|
|
34
|
+
return keys
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
|
|
38
|
+
|
|
38
39
|
/**
|
|
39
|
-
*
|
|
40
|
-
* @param {
|
|
41
|
-
* @param {
|
|
42
|
-
* @param {string}
|
|
43
|
-
* @param {string}
|
|
40
|
+
* 查找树形结构中符合条件的节点
|
|
41
|
+
* @param {Array} dataSource 树形数据源
|
|
42
|
+
* @param {Array} nodeIds 需要查找的节点ID集合
|
|
43
|
+
* @param {string} [searchField='id'] 节点ID字段名
|
|
44
|
+
* @param {string} [hasField='children'] 子节点字段名
|
|
45
|
+
* @returns {Array} 符合条件的节点数组
|
|
44
46
|
*/
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
export function findCheckNodes(
|
|
48
|
+
dataSource = [],
|
|
49
|
+
nodeIds = [],
|
|
50
|
+
searchField = 'id',
|
|
51
|
+
hasField = 'children'
|
|
52
|
+
) {
|
|
53
|
+
const checkNodes = []
|
|
54
|
+
const idSet = new Set(nodeIds)
|
|
55
|
+
|
|
56
|
+
function traverse(node) {
|
|
57
|
+
if (idSet.has(node[searchField]) && !(hasField in node)) {
|
|
52
58
|
checkNodes.push(node)
|
|
53
59
|
return true
|
|
54
60
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
61
|
+
|
|
62
|
+
if (Array.isArray(node[hasField])) {
|
|
63
|
+
return node[hasField].some(traverse)
|
|
64
|
+
}
|
|
65
|
+
|
|
60
66
|
return false
|
|
61
67
|
}
|
|
62
68
|
|
|
63
|
-
|
|
69
|
+
dataSource.some(traverse)
|
|
70
|
+
return checkNodes
|
|
71
|
+
}
|
|
64
72
|
|
|
65
|
-
if (traverse(dataSource[i], nodeIds)) {
|
|
66
|
-
break
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
73
|
|
|
70
|
-
return checkNodes;
|
|
71
|
-
}
|
|
72
74
|
|
|
73
75
|
/**
|
|
74
|
-
*
|
|
75
|
-
* @param nodes
|
|
76
|
-
* @param
|
|
77
|
-
* @param replaceField
|
|
78
|
-
* @param childNode
|
|
76
|
+
* 拼接树节点指定字段为字符串
|
|
77
|
+
* @param {Array} nodes 树形数据
|
|
78
|
+
* @param {Array} fields 需要拼接的字段数组
|
|
79
|
+
* @param {string} replaceField 拼接后存储的字段名
|
|
80
|
+
* @param {string} childNode 子节点字段名
|
|
81
|
+
* @returns {Array} 处理后的树形数据
|
|
79
82
|
*/
|
|
80
|
-
export function joinTreeMessage(
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
83
|
+
export function joinTreeMessage(
|
|
84
|
+
nodes = [],
|
|
85
|
+
fields = [],
|
|
86
|
+
replaceField = 'message',
|
|
87
|
+
childNode = 'children'
|
|
88
|
+
) {
|
|
89
|
+
if (!Array.isArray(nodes) || !Array.isArray(fields)) return nodes
|
|
90
|
+
|
|
91
|
+
const processNode = (node) => {
|
|
92
|
+
node[replaceField] = fields
|
|
93
|
+
.filter(field => node[field])
|
|
94
|
+
.map(field => node[field])
|
|
95
|
+
.join(' ')
|
|
96
|
+
|
|
97
|
+
if (Array.isArray(node[childNode])) {
|
|
98
|
+
node[childNode].forEach(processNode)
|
|
99
|
+
}
|
|
95
100
|
}
|
|
96
101
|
|
|
97
|
-
|
|
98
|
-
|
|
102
|
+
nodes.forEach(processNode)
|
|
99
103
|
return nodes
|
|
100
|
-
|
|
101
104
|
}
|
|
102
105
|
|
|
103
106
|
|
|
104
107
|
|
|
105
108
|
/**
|
|
106
|
-
*
|
|
107
|
-
* @param tree
|
|
108
|
-
* @param key
|
|
109
|
-
* @param replaceFields
|
|
110
|
-
* {
|
|
111
|
-
children: 'children', // 查找子级字段
|
|
112
|
-
key: 'id' // key的字段
|
|
113
|
-
}
|
|
109
|
+
* 获取树节点对应数据
|
|
110
|
+
* @param {Array} tree 树形数据
|
|
111
|
+
* @param {string|number} key 目标节点Key
|
|
112
|
+
* @param {Object} [replaceFields={}] 字段映射配置
|
|
114
113
|
*/
|
|
115
|
-
export function filterTreeById(
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
114
|
+
export function filterTreeById(
|
|
115
|
+
tree,
|
|
116
|
+
key,
|
|
117
|
+
{ children = 'children', key: idKey = 'id' } = {}
|
|
118
|
+
) {
|
|
119
|
+
for (const node of tree) {
|
|
120
|
+
if (node[idKey] === key) return [node]
|
|
121
|
+
|
|
122
|
+
if (node[children]?.length) {
|
|
123
|
+
const result = filterTreeById(node[children], key, { children, key: idKey })
|
|
124
|
+
if (result.length) return result
|
|
122
125
|
}
|
|
123
|
-
|
|
124
|
-
|
|
126
|
+
}
|
|
127
|
+
return []
|
|
125
128
|
}
|
|
126
129
|
|
|
127
130
|
|
|
128
131
|
/**
|
|
129
|
-
*
|
|
130
|
-
* @param tree
|
|
131
|
-
* @param
|
|
132
|
-
* @param replaceFields
|
|
133
|
-
* {
|
|
134
|
-
children: 'children', // 查找子级字段
|
|
135
|
-
key: 'id' // key的字段
|
|
136
|
-
}
|
|
132
|
+
* 获取树节点所有父级路径
|
|
133
|
+
* @param {Array} tree 树形数据
|
|
134
|
+
* @param {string|number} nodeId 目标节点ID
|
|
135
|
+
* @param {Object} [replaceFields={}] 字段映射配置
|
|
136
|
+
* @param {boolean} [returnObjects=false] 是否返回完整对象
|
|
137
137
|
*/
|
|
138
|
-
export function getAllParents(tree, nodeId,
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
138
|
+
export function getAllParents(tree, nodeId, { children = 'children', key = 'id' } = {}, returnObjects = false) {
|
|
139
|
+
if (!tree?.length) return []
|
|
140
|
+
|
|
141
|
+
// 创建节点映射表提升查找性能
|
|
142
|
+
const nodeMap = new Map()
|
|
143
|
+
const buildMap = (nodes, parentId) => {
|
|
144
|
+
nodes.forEach(node => {
|
|
145
|
+
nodeMap.set(node[key], { ...node, parentId })
|
|
146
|
+
if (node[children]?.length) buildMap(node[children], node[key])
|
|
147
|
+
})
|
|
148
148
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
149
|
+
buildMap(tree)
|
|
150
|
+
|
|
151
|
+
// 回溯构建路径
|
|
152
|
+
const path = []
|
|
153
|
+
let current = nodeMap.get(nodeId)
|
|
154
|
+
while (current) {
|
|
155
|
+
path.unshift(returnObjects ? current : current[key])
|
|
156
|
+
current = current.parentId ? nodeMap.get(current.parentId) : null
|
|
157
157
|
}
|
|
158
|
-
|
|
158
|
+
|
|
159
|
+
return path
|
|
159
160
|
}
|