@vipl520/dk-ui 1.0.26 → 1.0.27

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -24754,7 +24754,6 @@ const tableProps = {
24754
24754
  },
24755
24755
  type: Array
24756
24756
  }
24757
- // ...ElTableNext.props,
24758
24757
  };
24759
24758
 
24760
24759
  /**!
@@ -30505,6 +30504,7 @@ var _sfc_main$d = /* @__PURE__ */ defineComponent({
30505
30504
  loading: _ctx.row.loading,
30506
30505
  "inactive-value": "0",
30507
30506
  "active-value": "1",
30507
+ size: "small",
30508
30508
  onChange: onChangeField
30509
30509
  }, null, 8, ["model-value", "loading"])) : createCommentVNode("v-if", true),
30510
30510
  createCommentVNode(" \u5355\u56FE "),
@@ -2,7 +2,7 @@
2
2
  "$schema": "http://json.schemastore.org/web-types",
3
3
  "framework": "vue",
4
4
  "name": "dk",
5
- "version": "1.0.25",
5
+ "version": "1.0.26",
6
6
  "js-types-syntax": "typescript",
7
7
  "description-markup": "markdown",
8
8
  "contributions": {
@@ -104,6 +104,7 @@ var _sfc_main = /* @__PURE__ */ defineComponent({
104
104
  loading: _ctx.row.loading,
105
105
  "inactive-value": "0",
106
106
  "active-value": "1",
107
+ size: "small",
107
108
  onChange: onChangeField
108
109
  }, null, 8, ["model-value", "loading"])) : createCommentVNode("v-if", true),
109
110
  createCommentVNode(" \u5355\u56FE "),
@@ -1 +1 @@
1
- {"version":3,"file":"FieldRender.vue2.mjs","sources":["../../../../src/table/src/components/FieldRender.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkFieldRender',\n});\n</script>\n<template>\n <!--图标-->\n <div v-if=\"field.render == 'icon'\">\n <dk-icon v-if=\"fieldValue || field.default\" :icon=\"fieldValue ? fieldValue : field.default\" />\n <span v-else>-</span>\n </div>\n\n <!--开关-->\n <el-switch\n v-if=\"field.render == 'switch' && fieldValue !== ''\"\n :model-value=\"fieldValue.toString()\"\n :loading=\"row.loading\"\n inactive-value=\"0\"\n active-value=\"1\"\n @change=\"onChangeField\"\n ></el-switch>\n\n <!-- 单图 -->\n <div v-if=\"field.render == 'image' && fieldValue\" class=\"ba-render-image\">\n <el-image\n :hide-on-click-modal=\"true\"\n :preview-teleported=\"true\"\n :preview-src-list=\"[fieldValue]\"\n :src=\"fieldValue\"\n fit=\"cover\"\n style=\"width: 50px; height: 50px\"\n ></el-image>\n </div>\n\n <!--多图片-->\n <div v-if=\"field.render == 'images'\" class=\"ba-render-image\">\n <template v-if=\"Array.isArray(fieldValue) && fieldValue.length\">\n <el-image\n v-for=\"(item, idx) in fieldValue\"\n :key=\"idx\"\n :initial-index=\"idx\"\n :preview-teleported=\"true\"\n :preview-src-list=\"fieldValue\"\n class=\"images-item\"\n :src=\"item\"\n style=\"width: 50px; height: 50px\"\n :hide-on-click-modal=\"true\"\n ></el-image>\n </template>\n </div>\n\n <div v-if=\"field.render == 'tag' && fieldValue !== ''\">\n <el-tag\n :type=\"getTagType(fieldValue, field.custom)\"\n :effect=\"field.effect ?? 'light'\"\n :size=\"field.size ?? 'default'\"\n >\n {{ field.replaceValue ? field.replaceValue[fieldValue] : fieldValue }}\n </el-tag>\n </div>\n\n <!-- tags -->\n <div v-if=\"field.render == 'tags'\">\n <template v-if=\"Array.isArray(fieldValue)\">\n <template v-for=\"(tag, idx) in fieldValue\" :key=\"idx\">\n <el-tag\n v-if=\"tag !== ''\"\n class=\"m-1px\"\n :type=\"getTagType(tag, field.custom)\"\n :effect=\"field.effect ?? 'light'\"\n :size=\"field.size ?? 'default'\"\n >\n {{ field.replaceValue ? field.replaceValue[tag] ?? tag : tag }}</el-tag\n >\n </template>\n </template>\n <template v-else>\n <el-tag\n v-if=\"fieldValue !== ''\"\n class=\"m-1px\"\n :type=\"getTagType(fieldValue, field.custom)\"\n :effect=\"field.effect ?? 'light'\"\n :size=\"field.size ?? 'default'\"\n >\n {{ field.replaceValue ? field.replaceValue[fieldValue] ?? fieldValue : fieldValue }}\n </el-tag>\n </template>\n </div>\n\n <!-- url -->\n <div v-if=\"field.render == 'url' && fieldValue\">\n <el-input :model-value=\"fieldValue\" placeholder=\"链接地址\">\n <template #append>\n <el-button\n @click=\"\n typeof field.click == 'function'\n ? field.click(row, field, fieldValue, column, index)\n : openUrl(fieldValue, field.target)\n \"\n >\n <dk-icon :color=\"'#606266'\" icon=\"Position\" />\n </el-button>\n </template>\n </el-input>\n </div>\n\n <!-- datetime -->\n <div v-if=\"field.render == 'datetime'\">\n {{ !fieldValue ? '-' : timeFormat(fieldValue, field.timeFormat ?? undefined) }}\n </div>\n\n <div v-if=\"field.render == 'time'\">\n {{ fieldValue }}\n </div>\n <div v-if=\"field.render == 'year'\">\n {{ fieldValue }}\n </div>\n <!-- color -->\n <div v-if=\"field.render == 'color'\">\n <div :style=\"{ background: fieldValue }\" class=\"dk-render-color\"></div>\n </div>\n\n <!-- 自定义组件/函数渲染 -->\n <component\n :is=\"field.customRender\"\n v-if=\"field.render == 'customRender'\"\n :render-row=\"row\"\n :render-field=\"field\"\n :render-value=\"fieldValue\"\n :render-column=\"column\"\n :render-index=\"index\"\n />\n\n <!-- 按钮组 -->\n <!-- 只对默认的编辑、删除、排序按钮进行鉴权,其他按钮请通过 display 属性控制按钮是否显示 -->\n <div v-if=\"field.render == 'buttons' && field.buttons\">\n <template v-for=\"(btn, idx) in field.buttons\" :key=\"idx\">\n <template v-if=\"btn.display ? btn.display(row, field) : true\">\n <!-- 常规按钮 未使用-->\n <el-button\n v-if=\"btn.render == 'basicButton'\"\n v-blur\n :class=\"btn.class\"\n class=\"table-operate\"\n :type=\"btn.type\"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.attr\"\n @click=\"onButtonClick(btn)\"\n >\n <dk-icon :icon=\"btn.icon\" />\n <div v-if=\"btn.text\" class=\"table-operate-text\">{{ btn.text }}</div>\n </el-button>\n\n <!-- 带提示信息的按钮 -->\n <el-tooltip\n v-if=\"btn.render == 'tipButton' && ((btn.name == 'edit' && DkTable.auth('edit')) || btn.name != 'edit')\"\n :disabled=\"!(btn.title && !btn.disabledTip)\"\n :content=\"btn.title ?? ''\"\n placement=\"top\"\n :hide-after=\"0\"\n :show-after=\"100\"\n >\n <el-button\n v-blur\n :class=\"btn.class\"\n class=\"table-operate\"\n :type=\"btn.type\"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.attr\"\n @click=\"onButtonClick(btn)\"\n >\n <dk-icon :icon=\"btn.icon\" />\n <div v-if=\"btn.text\" class=\"table-operate-text\">{{ btn.text }}</div>\n </el-button>\n </el-tooltip>\n\n <!-- 带确认框的按钮 -->\n <el-popconfirm\n v-if=\"\n btn.render == 'confirmButton' && ((btn.name == 'delete' && DkTable.auth('del')) || btn.name != 'delete')\n \"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.popconfirm\"\n :hide-after=\"0\"\n :show-after=\"100\"\n @confirm=\"onButtonClick(btn)\"\n >\n <template #reference>\n <div class=\"dk-tooltip-button\">\n <el-tooltip :disabled=\"!btn.title\" :content=\"btn.title ?? ''\" placement=\"top\">\n <el-button\n v-blur\n :class=\"btn.class\"\n class=\"table-operate\"\n :type=\"btn.type\"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.attr\"\n >\n <dk-icon :icon=\"btn.icon\" />\n <div v-if=\"btn.text\" class=\"table-operate-text\">\n {{ btn.text }}\n </div>\n </el-button>\n </el-tooltip>\n </div>\n </template>\n </el-popconfirm>\n\n <!-- 带提示的可拖拽按钮 -->\n <el-tooltip\n v-if=\"\n btn.render == 'moveButton' &&\n ((btn.name == 'weigh-sort' && DkTable.auth('sortable')) || btn.name != 'weigh-sort')\n \"\n :disabled=\"!(btn.title && !btn.disabledTip)\"\n :content=\"btn.title ?? ''\"\n :hide-after=\"0\"\n :show-after=\"100\"\n placement=\"top\"\n >\n <el-button\n :class=\"btn.class\"\n class=\"table-operate move-button\"\n :type=\"btn.type\"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.attr\"\n size=\"small\"\n >\n <dk-icon :icon=\"btn.icon\" />\n <div v-if=\"btn.text\" class=\"table-operate-text\">{{ btn.text }}</div>\n </el-button>\n </el-tooltip>\n </template>\n </template>\n </div>\n</template>\n<script setup lang=\"ts\">\nimport { inject, ref } from 'vue'\nimport type { TableColumnCtx, TagProps } from 'element-plus'\nimport { openUrl, timeFormat } from '@vipl520/utils'\nimport type dkTable from '../../utils/dkTable'\n\nconst DkTable = inject('DkTable') as dkTable\n\ninterface Props {\n row: TableRow\n field: TableColumn\n column: TableColumnCtx<TableRow>\n index: number\n}\nconst props = defineProps<Props>()\n\nconst fieldName: any = ref(props.field.prop)\nconst fieldValue = ref(props.row[fieldName.value] ?? '')\n\nif (fieldName.value && fieldName.value.indexOf('.') > -1) {\n const fieldNameArr = fieldName.value.split('.')\n const val: any = ref(props.row[fieldNameArr[0]])\n for (let index = 1; index < fieldNameArr.length; index++) {\n val.value = val.value ? val.value[fieldNameArr[index]] ?? '' : ''\n }\n fieldValue.value = val.value\n}\n\nconst getTagType = (value: string, custom: any): TagProps['type'] => {\n return custom && custom[value] ? custom[value] : ''\n}\n\nconst onChangeField = (value: any) => {\n DkTable.onTableAction('field-change', {\n ...props,\n value,\n })\n}\n\nconst onButtonClick = (btn: OptButton) => {\n if (typeof btn.click === 'function') {\n btn.click(props.row, props.field)\n return\n }\n DkTable.onTableAction(btn.name, props)\n}\n</script>\n<style scoped></style>\n"],"names":["__MACROS_defineComponent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAA6B,cAAAA,eAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,eAAA;AACR,CAAC,CAAA,CAAA;;;;;;;;;;;AA+OD,IAAM,MAAA,OAAA,GAAU,OAAO,SAAS,CAAA,CAAA;AAUhC,IAAA,MAAM,SAAiB,GAAA,GAAA,CAAI,KAAM,CAAA,KAAA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EAAA,KAAA,CAAM,KAAK,CAAA,CAAA;AAChC,QAAA,OAAA;AAAA,OACF;AACA,MAAQ,OAAA,CAAA,aAAA,CAAc,GAAI,CAAA,IAAA,EAAM,KAAK,CAAA,CAAA;AAAA,KACvC,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"FieldRender.vue2.mjs","sources":["../../../../src/table/src/components/FieldRender.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkFieldRender',\n});\n</script>\n<template>\n <!--图标-->\n <div v-if=\"field.render == 'icon'\">\n <dk-icon v-if=\"fieldValue || field.default\" :icon=\"fieldValue ? fieldValue : field.default\" />\n <span v-else>-</span>\n </div>\n\n <!--开关-->\n <el-switch\n v-if=\"field.render == 'switch' && fieldValue !== ''\"\n :model-value=\"fieldValue.toString()\"\n :loading=\"row.loading\"\n inactive-value=\"0\"\n active-value=\"1\"\n size=\"small\"\n @change=\"onChangeField\"\n ></el-switch>\n\n <!-- 单图 -->\n <div v-if=\"field.render == 'image' && fieldValue\" class=\"ba-render-image\">\n <el-image\n :hide-on-click-modal=\"true\"\n :preview-teleported=\"true\"\n :preview-src-list=\"[fieldValue]\"\n :src=\"fieldValue\"\n fit=\"cover\"\n style=\"width: 50px; height: 50px\"\n ></el-image>\n </div>\n\n <!--多图片-->\n <div v-if=\"field.render == 'images'\" class=\"ba-render-image\">\n <template v-if=\"Array.isArray(fieldValue) && fieldValue.length\">\n <el-image\n v-for=\"(item, idx) in fieldValue\"\n :key=\"idx\"\n :initial-index=\"idx\"\n :preview-teleported=\"true\"\n :preview-src-list=\"fieldValue\"\n class=\"images-item\"\n :src=\"item\"\n style=\"width: 50px; height: 50px\"\n :hide-on-click-modal=\"true\"\n ></el-image>\n </template>\n </div>\n\n <div v-if=\"field.render == 'tag' && fieldValue !== ''\">\n <el-tag\n :type=\"getTagType(fieldValue, field.custom)\"\n :effect=\"field.effect ?? 'light'\"\n :size=\"field.size ?? 'default'\"\n >\n {{ field.replaceValue ? field.replaceValue[fieldValue] : fieldValue }}\n </el-tag>\n </div>\n\n <!-- tags -->\n <div v-if=\"field.render == 'tags'\">\n <template v-if=\"Array.isArray(fieldValue)\">\n <template v-for=\"(tag, idx) in fieldValue\" :key=\"idx\">\n <el-tag\n v-if=\"tag !== ''\"\n class=\"m-1px\"\n :type=\"getTagType(tag, field.custom)\"\n :effect=\"field.effect ?? 'light'\"\n :size=\"field.size ?? 'default'\"\n >\n {{ field.replaceValue ? field.replaceValue[tag] ?? tag : tag }}</el-tag\n >\n </template>\n </template>\n <template v-else>\n <el-tag\n v-if=\"fieldValue !== ''\"\n class=\"m-1px\"\n :type=\"getTagType(fieldValue, field.custom)\"\n :effect=\"field.effect ?? 'light'\"\n :size=\"field.size ?? 'default'\"\n >\n {{ field.replaceValue ? field.replaceValue[fieldValue] ?? fieldValue : fieldValue }}\n </el-tag>\n </template>\n </div>\n\n <!-- url -->\n <div v-if=\"field.render == 'url' && fieldValue\">\n <el-input :model-value=\"fieldValue\" placeholder=\"链接地址\">\n <template #append>\n <el-button\n @click=\"\n typeof field.click == 'function'\n ? field.click(row, field, fieldValue, column, index)\n : openUrl(fieldValue, field.target)\n \"\n >\n <dk-icon :color=\"'#606266'\" icon=\"Position\" />\n </el-button>\n </template>\n </el-input>\n </div>\n\n <!-- datetime -->\n <div v-if=\"field.render == 'datetime'\">\n {{ !fieldValue ? '-' : timeFormat(fieldValue, field.timeFormat ?? undefined) }}\n </div>\n\n <div v-if=\"field.render == 'time'\">\n {{ fieldValue }}\n </div>\n <div v-if=\"field.render == 'year'\">\n {{ fieldValue }}\n </div>\n <!-- color -->\n <div v-if=\"field.render == 'color'\">\n <div :style=\"{ background: fieldValue }\" class=\"dk-render-color\"></div>\n </div>\n\n <!-- 自定义组件/函数渲染 -->\n <component\n :is=\"field.customRender\"\n v-if=\"field.render == 'customRender'\"\n :render-row=\"row\"\n :render-field=\"field\"\n :render-value=\"fieldValue\"\n :render-column=\"column\"\n :render-index=\"index\"\n />\n\n <!-- 按钮组 -->\n <!-- 只对默认的编辑、删除、排序按钮进行鉴权,其他按钮请通过 display 属性控制按钮是否显示 -->\n <div v-if=\"field.render == 'buttons' && field.buttons\">\n <template v-for=\"(btn, idx) in field.buttons\" :key=\"idx\">\n <template v-if=\"btn.display ? btn.display(row, field) : true\">\n <!-- 常规按钮 未使用-->\n <el-button\n v-if=\"btn.render == 'basicButton'\"\n v-blur\n :class=\"btn.class\"\n class=\"table-operate\"\n :type=\"btn.type\"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.attr\"\n @click=\"onButtonClick(btn)\"\n >\n <dk-icon :icon=\"btn.icon\" />\n <div v-if=\"btn.text\" class=\"table-operate-text\">{{ btn.text }}</div>\n </el-button>\n\n <!-- 带提示信息的按钮 -->\n <el-tooltip\n v-if=\"btn.render == 'tipButton' && ((btn.name == 'edit' && DkTable.auth('edit')) || btn.name != 'edit')\"\n :disabled=\"!(btn.title && !btn.disabledTip)\"\n :content=\"btn.title ?? ''\"\n placement=\"top\"\n :hide-after=\"0\"\n :show-after=\"100\"\n >\n <el-button\n v-blur\n :class=\"btn.class\"\n class=\"table-operate\"\n :type=\"btn.type\"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.attr\"\n @click=\"onButtonClick(btn)\"\n >\n <dk-icon :icon=\"btn.icon\" />\n <div v-if=\"btn.text\" class=\"table-operate-text\">{{ btn.text }}</div>\n </el-button>\n </el-tooltip>\n\n <!-- 带确认框的按钮 -->\n <el-popconfirm\n v-if=\"\n btn.render == 'confirmButton' && ((btn.name == 'delete' && DkTable.auth('del')) || btn.name != 'delete')\n \"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.popconfirm\"\n :hide-after=\"0\"\n :show-after=\"100\"\n @confirm=\"onButtonClick(btn)\"\n >\n <template #reference>\n <div class=\"dk-tooltip-button\">\n <el-tooltip :disabled=\"!btn.title\" :content=\"btn.title ?? ''\" placement=\"top\">\n <el-button\n v-blur\n :class=\"btn.class\"\n class=\"table-operate\"\n :type=\"btn.type\"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.attr\"\n >\n <dk-icon :icon=\"btn.icon\" />\n <div v-if=\"btn.text\" class=\"table-operate-text\">\n {{ btn.text }}\n </div>\n </el-button>\n </el-tooltip>\n </div>\n </template>\n </el-popconfirm>\n\n <!-- 带提示的可拖拽按钮 -->\n <el-tooltip\n v-if=\"\n btn.render == 'moveButton' &&\n ((btn.name == 'weigh-sort' && DkTable.auth('sortable')) || btn.name != 'weigh-sort')\n \"\n :disabled=\"!(btn.title && !btn.disabledTip)\"\n :content=\"btn.title ?? ''\"\n :hide-after=\"0\"\n :show-after=\"100\"\n placement=\"top\"\n >\n <el-button\n :class=\"btn.class\"\n class=\"table-operate move-button\"\n :type=\"btn.type\"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.attr\"\n size=\"small\"\n >\n <dk-icon :icon=\"btn.icon\" />\n <div v-if=\"btn.text\" class=\"table-operate-text\">{{ btn.text }}</div>\n </el-button>\n </el-tooltip>\n </template>\n </template>\n </div>\n</template>\n<script setup lang=\"ts\">\nimport { inject, ref } from 'vue'\nimport type { TableColumnCtx, TagProps } from 'element-plus'\nimport { openUrl, timeFormat } from '@vipl520/utils'\nimport type dkTable from '../../utils/dkTable'\n\nconst DkTable = inject('DkTable') as dkTable\n\ninterface Props {\n row: TableRow\n field: TableColumn\n column: TableColumnCtx<TableRow>\n index: number\n}\nconst props = defineProps<Props>()\n\nconst fieldName: any = ref(props.field.prop)\nconst fieldValue = ref(props.row[fieldName.value] ?? '')\n\nif (fieldName.value && fieldName.value.indexOf('.') > -1) {\n const fieldNameArr = fieldName.value.split('.')\n const val: any = ref(props.row[fieldNameArr[0]])\n for (let index = 1; index < fieldNameArr.length; index++) {\n val.value = val.value ? val.value[fieldNameArr[index]] ?? '' : ''\n }\n fieldValue.value = val.value\n}\n\nconst getTagType = (value: string, custom: any): TagProps['type'] => {\n return custom && custom[value] ? custom[value] : ''\n}\n\nconst onChangeField = (value: any) => {\n DkTable.onTableAction('field-change', {\n ...props,\n value,\n })\n}\n\nconst onButtonClick = (btn: OptButton) => {\n if (typeof btn.click === 'function') {\n btn.click(props.row, props.field)\n return\n }\n DkTable.onTableAction(btn.name, props)\n}\n</script>\n<style scoped></style>\n"],"names":["__MACROS_defineComponent"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAA6B,cAAAA,eAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,eAAA;AACR,CAAC,CAAA,CAAA;;;;;;;;;;;AAgPD,IAAM,MAAA,OAAA,GAAU,OAAO,SAAS,CAAA,CAAA;AAUhC,IAAA,MAAM,SAAiB,GAAA,GAAA,CAAI,KAAM,CAAA,KAAA,CAAM,IAAI,CAAA,CAAA;AAC3C,IAAA,MAAM,aAAa,GAAI,CAAA,KAAA,CAAM,IAAI,SAAU,CAAA,KAAK,KAAK,EAAE,CAAA,CAAA;AAEvD,IAAA,IAAI,UAAU,KAAS,IAAA,SAAA,CAAU,MAAM,OAAQ,CAAA,GAAG,IAAI,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -25,7 +25,6 @@ const tableProps = {
25
25
  },
26
26
  type: Array
27
27
  }
28
- // ...ElTableNext.props,
29
28
  };
30
29
 
31
30
  export { tableProps };
@@ -1 +1 @@
1
- {"version":3,"file":"props.mjs","sources":["../../../src/table/src/props.ts"],"sourcesContent":["import type { ExtractPropTypes } from 'vue'\n// import ElTableNext from 'el-table-next'\n\nexport const tableProps = {\n tableApi: {\n default: '',\n type: String,\n },\n cacheTable: {\n default: true,\n type: Boolean,\n },\n tableBefore: {\n default: () => {\n return {}\n },\n type: Object,\n },\n tableAfter: {\n default: () => {\n return {}\n },\n type: Object,\n },\n buttons: {\n default: () => {\n return ['refresh', 'add', 'export_csv', 'edit', 'delete', 'comSearch', 'quickSearch', 'columnDisplay']\n },\n type: Array,\n },\n // ...ElTableNext.props,\n}\n\nexport type TableProps = ExtractPropTypes<typeof tableProps>\n"],"names":[],"mappings":"AAGO,MAAM,UAAa,GAAA;AAAA,EACxB,QAAU,EAAA;AAAA,IACR,OAAS,EAAA,EAAA;AAAA,IACT,IAAM,EAAA,MAAA;AAAA,GACR;AAAA,EACA,UAAY,EAAA;AAAA,IACV,OAAS,EAAA,IAAA;AAAA,IACT,IAAM,EAAA,OAAA;AAAA,GACR;AAAA,EACA,WAAa,EAAA;AAAA,IACX,SAAS,MAAM;AACb,MAAA,OAAO,EAAC,CAAA;AAAA,KACV;AAAA,IACA,IAAM,EAAA,MAAA;AAAA,GACR;AAAA,EACA,UAAY,EAAA;AAAA,IACV,SAAS,MAAM;AACb,MAAA,OAAO,EAAC,CAAA;AAAA,KACV;AAAA,IACA,IAAM,EAAA,MAAA;AAAA,GACR;AAAA,EACA,OAAS,EAAA;AAAA,IACP,SAAS,MAAM;AACb,MAAO,OAAA,CAAC,WAAW,KAAO,EAAA,YAAA,EAAc,QAAQ,QAAU,EAAA,WAAA,EAAa,eAAe,eAAe,CAAA,CAAA;AAAA,KACvG;AAAA,IACA,IAAM,EAAA,KAAA;AAAA,GACR;AAAA;AAEF;;;;"}
1
+ {"version":3,"file":"props.mjs","sources":["../../../src/table/src/props.ts"],"sourcesContent":["import type { ExtractPropTypes } from 'vue'\n// import ElTableNext from 'el-table-next'\n\nexport const tableProps = {\n tableApi: {\n default: '',\n type: String,\n },\n cacheTable: {\n default: true,\n type: Boolean,\n },\n tableBefore: {\n default: () => {\n return {}\n },\n type: Object,\n },\n tableAfter: {\n default: () => {\n return {}\n },\n type: Object,\n },\n buttons: {\n default: () => {\n return ['refresh', 'add', 'export_csv', 'edit', 'delete', 'comSearch', 'quickSearch', 'columnDisplay']\n },\n type: Array,\n },\n}\n\nexport type TableProps = ExtractPropTypes<typeof tableProps>\n"],"names":[],"mappings":"AAGO,MAAM,UAAa,GAAA;AAAA,EACxB,QAAU,EAAA;AAAA,IACR,OAAS,EAAA,EAAA;AAAA,IACT,IAAM,EAAA,MAAA;AAAA,GACR;AAAA,EACA,UAAY,EAAA;AAAA,IACV,OAAS,EAAA,IAAA;AAAA,IACT,IAAM,EAAA,OAAA;AAAA,GACR;AAAA,EACA,WAAa,EAAA;AAAA,IACX,SAAS,MAAM;AACb,MAAA,OAAO,EAAC,CAAA;AAAA,KACV;AAAA,IACA,IAAM,EAAA,MAAA;AAAA,GACR;AAAA,EACA,UAAY,EAAA;AAAA,IACV,SAAS,MAAM;AACb,MAAA,OAAO,EAAC,CAAA;AAAA,KACV;AAAA,IACA,IAAM,EAAA,MAAA;AAAA,GACR;AAAA,EACA,OAAS,EAAA;AAAA,IACP,SAAS,MAAM;AACb,MAAO,OAAA,CAAC,WAAW,KAAO,EAAA,YAAA,EAAc,QAAQ,QAAU,EAAA,WAAA,EAAa,eAAe,eAAe,CAAA,CAAA;AAAA,KACvG;AAAA,IACA,IAAM,EAAA,KAAA;AAAA,GACR;AACF;;;;"}
@@ -108,6 +108,7 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
108
108
  loading: _ctx.row.loading,
109
109
  "inactive-value": "0",
110
110
  "active-value": "1",
111
+ size: "small",
111
112
  onChange: onChangeField
112
113
  }, null, 8, ["model-value", "loading"])) : vue.createCommentVNode("v-if", true),
113
114
  vue.createCommentVNode(" \u5355\u56FE "),
@@ -1 +1 @@
1
- {"version":3,"file":"FieldRender.vue2.js","sources":["../../../../src/table/src/components/FieldRender.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkFieldRender',\n});\n</script>\n<template>\n <!--图标-->\n <div v-if=\"field.render == 'icon'\">\n <dk-icon v-if=\"fieldValue || field.default\" :icon=\"fieldValue ? fieldValue : field.default\" />\n <span v-else>-</span>\n </div>\n\n <!--开关-->\n <el-switch\n v-if=\"field.render == 'switch' && fieldValue !== ''\"\n :model-value=\"fieldValue.toString()\"\n :loading=\"row.loading\"\n inactive-value=\"0\"\n active-value=\"1\"\n @change=\"onChangeField\"\n ></el-switch>\n\n <!-- 单图 -->\n <div v-if=\"field.render == 'image' && fieldValue\" class=\"ba-render-image\">\n <el-image\n :hide-on-click-modal=\"true\"\n :preview-teleported=\"true\"\n :preview-src-list=\"[fieldValue]\"\n :src=\"fieldValue\"\n fit=\"cover\"\n style=\"width: 50px; height: 50px\"\n ></el-image>\n </div>\n\n <!--多图片-->\n <div v-if=\"field.render == 'images'\" class=\"ba-render-image\">\n <template v-if=\"Array.isArray(fieldValue) && fieldValue.length\">\n <el-image\n v-for=\"(item, idx) in fieldValue\"\n :key=\"idx\"\n :initial-index=\"idx\"\n :preview-teleported=\"true\"\n :preview-src-list=\"fieldValue\"\n class=\"images-item\"\n :src=\"item\"\n style=\"width: 50px; height: 50px\"\n :hide-on-click-modal=\"true\"\n ></el-image>\n </template>\n </div>\n\n <div v-if=\"field.render == 'tag' && fieldValue !== ''\">\n <el-tag\n :type=\"getTagType(fieldValue, field.custom)\"\n :effect=\"field.effect ?? 'light'\"\n :size=\"field.size ?? 'default'\"\n >\n {{ field.replaceValue ? field.replaceValue[fieldValue] : fieldValue }}\n </el-tag>\n </div>\n\n <!-- tags -->\n <div v-if=\"field.render == 'tags'\">\n <template v-if=\"Array.isArray(fieldValue)\">\n <template v-for=\"(tag, idx) in fieldValue\" :key=\"idx\">\n <el-tag\n v-if=\"tag !== ''\"\n class=\"m-1px\"\n :type=\"getTagType(tag, field.custom)\"\n :effect=\"field.effect ?? 'light'\"\n :size=\"field.size ?? 'default'\"\n >\n {{ field.replaceValue ? field.replaceValue[tag] ?? tag : tag }}</el-tag\n >\n </template>\n </template>\n <template v-else>\n <el-tag\n v-if=\"fieldValue !== ''\"\n class=\"m-1px\"\n :type=\"getTagType(fieldValue, field.custom)\"\n :effect=\"field.effect ?? 'light'\"\n :size=\"field.size ?? 'default'\"\n >\n {{ field.replaceValue ? field.replaceValue[fieldValue] ?? fieldValue : fieldValue }}\n </el-tag>\n </template>\n </div>\n\n <!-- url -->\n <div v-if=\"field.render == 'url' && fieldValue\">\n <el-input :model-value=\"fieldValue\" placeholder=\"链接地址\">\n <template #append>\n <el-button\n @click=\"\n typeof field.click == 'function'\n ? field.click(row, field, fieldValue, column, index)\n : openUrl(fieldValue, field.target)\n \"\n >\n <dk-icon :color=\"'#606266'\" icon=\"Position\" />\n </el-button>\n </template>\n </el-input>\n </div>\n\n <!-- datetime -->\n <div v-if=\"field.render == 'datetime'\">\n {{ !fieldValue ? '-' : timeFormat(fieldValue, field.timeFormat ?? undefined) }}\n </div>\n\n <div v-if=\"field.render == 'time'\">\n {{ fieldValue }}\n </div>\n <div v-if=\"field.render == 'year'\">\n {{ fieldValue }}\n </div>\n <!-- color -->\n <div v-if=\"field.render == 'color'\">\n <div :style=\"{ background: fieldValue }\" class=\"dk-render-color\"></div>\n </div>\n\n <!-- 自定义组件/函数渲染 -->\n <component\n :is=\"field.customRender\"\n v-if=\"field.render == 'customRender'\"\n :render-row=\"row\"\n :render-field=\"field\"\n :render-value=\"fieldValue\"\n :render-column=\"column\"\n :render-index=\"index\"\n />\n\n <!-- 按钮组 -->\n <!-- 只对默认的编辑、删除、排序按钮进行鉴权,其他按钮请通过 display 属性控制按钮是否显示 -->\n <div v-if=\"field.render == 'buttons' && field.buttons\">\n <template v-for=\"(btn, idx) in field.buttons\" :key=\"idx\">\n <template v-if=\"btn.display ? btn.display(row, field) : true\">\n <!-- 常规按钮 未使用-->\n <el-button\n v-if=\"btn.render == 'basicButton'\"\n v-blur\n :class=\"btn.class\"\n class=\"table-operate\"\n :type=\"btn.type\"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.attr\"\n @click=\"onButtonClick(btn)\"\n >\n <dk-icon :icon=\"btn.icon\" />\n <div v-if=\"btn.text\" class=\"table-operate-text\">{{ btn.text }}</div>\n </el-button>\n\n <!-- 带提示信息的按钮 -->\n <el-tooltip\n v-if=\"btn.render == 'tipButton' && ((btn.name == 'edit' && DkTable.auth('edit')) || btn.name != 'edit')\"\n :disabled=\"!(btn.title && !btn.disabledTip)\"\n :content=\"btn.title ?? ''\"\n placement=\"top\"\n :hide-after=\"0\"\n :show-after=\"100\"\n >\n <el-button\n v-blur\n :class=\"btn.class\"\n class=\"table-operate\"\n :type=\"btn.type\"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.attr\"\n @click=\"onButtonClick(btn)\"\n >\n <dk-icon :icon=\"btn.icon\" />\n <div v-if=\"btn.text\" class=\"table-operate-text\">{{ btn.text }}</div>\n </el-button>\n </el-tooltip>\n\n <!-- 带确认框的按钮 -->\n <el-popconfirm\n v-if=\"\n btn.render == 'confirmButton' && ((btn.name == 'delete' && DkTable.auth('del')) || btn.name != 'delete')\n \"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.popconfirm\"\n :hide-after=\"0\"\n :show-after=\"100\"\n @confirm=\"onButtonClick(btn)\"\n >\n <template #reference>\n <div class=\"dk-tooltip-button\">\n <el-tooltip :disabled=\"!btn.title\" :content=\"btn.title ?? ''\" placement=\"top\">\n <el-button\n v-blur\n :class=\"btn.class\"\n class=\"table-operate\"\n :type=\"btn.type\"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.attr\"\n >\n <dk-icon :icon=\"btn.icon\" />\n <div v-if=\"btn.text\" class=\"table-operate-text\">\n {{ btn.text }}\n </div>\n </el-button>\n </el-tooltip>\n </div>\n </template>\n </el-popconfirm>\n\n <!-- 带提示的可拖拽按钮 -->\n <el-tooltip\n v-if=\"\n btn.render == 'moveButton' &&\n ((btn.name == 'weigh-sort' && DkTable.auth('sortable')) || btn.name != 'weigh-sort')\n \"\n :disabled=\"!(btn.title && !btn.disabledTip)\"\n :content=\"btn.title ?? ''\"\n :hide-after=\"0\"\n :show-after=\"100\"\n placement=\"top\"\n >\n <el-button\n :class=\"btn.class\"\n class=\"table-operate move-button\"\n :type=\"btn.type\"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.attr\"\n size=\"small\"\n >\n <dk-icon :icon=\"btn.icon\" />\n <div v-if=\"btn.text\" class=\"table-operate-text\">{{ btn.text }}</div>\n </el-button>\n </el-tooltip>\n </template>\n </template>\n </div>\n</template>\n<script setup lang=\"ts\">\nimport { inject, ref } from 'vue'\nimport type { TableColumnCtx, TagProps } from 'element-plus'\nimport { openUrl, timeFormat } from '@vipl520/utils'\nimport type dkTable from '../../utils/dkTable'\n\nconst DkTable = inject('DkTable') as dkTable\n\ninterface Props {\n row: TableRow\n field: TableColumn\n column: TableColumnCtx<TableRow>\n index: number\n}\nconst props = defineProps<Props>()\n\nconst fieldName: any = ref(props.field.prop)\nconst fieldValue = ref(props.row[fieldName.value] ?? '')\n\nif (fieldName.value && fieldName.value.indexOf('.') > -1) {\n const fieldNameArr = fieldName.value.split('.')\n const val: any = ref(props.row[fieldNameArr[0]])\n for (let index = 1; index < fieldNameArr.length; index++) {\n val.value = val.value ? val.value[fieldNameArr[index]] ?? '' : ''\n }\n fieldValue.value = val.value\n}\n\nconst getTagType = (value: string, custom: any): TagProps['type'] => {\n return custom && custom[value] ? custom[value] : ''\n}\n\nconst onChangeField = (value: any) => {\n DkTable.onTableAction('field-change', {\n ...props,\n value,\n })\n}\n\nconst onButtonClick = (btn: OptButton) => {\n if (typeof btn.click === 'function') {\n btn.click(props.row, props.field)\n return\n }\n DkTable.onTableAction(btn.name, props)\n}\n</script>\n<style scoped></style>\n"],"names":["__MACROS_defineComponent","inject","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAA6B,cAAAA,mBAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,eAAA;AACR,CAAC,CAAA,CAAA;;;;;;;;;;;AA+OD,IAAM,MAAA,OAAA,GAAUC,WAAO,SAAS,CAAA,CAAA;AAUhC,IAAA,MAAM,SAAiB,GAAAC,OAAA,CAAI,KAAM,CAAA,KAAA,CAAM,IAAI,CAAA,CAAA;AAC3C,IAAA,MAAM,aAAaA,OAAI,CAAA,KAAA,CAAM,IAAI,SAAU,CAAA,KAAK,KAAK,EAAE,CAAA,CAAA;AAEvD,IAAA,IAAI,UAAU,KAAS,IAAA,SAAA,CAAU,MAAM,OAAQ,CAAA,GAAG,IAAI,CAAI,CAAA,EAAA;AACxD,MAAA,MAAM,YAAe,GAAA,SAAA,CAAU,KAAM,CAAA,KAAA,CAAM,GAAG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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"FieldRender.vue2.js","sources":["../../../../src/table/src/components/FieldRender.vue"],"sourcesContent":["<script lang=\"ts\">\nimport { defineComponent as __MACROS_defineComponent } from \"vue\";\nexport default /*#__PURE__*/ __MACROS_defineComponent({\n name: 'DkFieldRender',\n});\n</script>\n<template>\n <!--图标-->\n <div v-if=\"field.render == 'icon'\">\n <dk-icon v-if=\"fieldValue || field.default\" :icon=\"fieldValue ? fieldValue : field.default\" />\n <span v-else>-</span>\n </div>\n\n <!--开关-->\n <el-switch\n v-if=\"field.render == 'switch' && fieldValue !== ''\"\n :model-value=\"fieldValue.toString()\"\n :loading=\"row.loading\"\n inactive-value=\"0\"\n active-value=\"1\"\n size=\"small\"\n @change=\"onChangeField\"\n ></el-switch>\n\n <!-- 单图 -->\n <div v-if=\"field.render == 'image' && fieldValue\" class=\"ba-render-image\">\n <el-image\n :hide-on-click-modal=\"true\"\n :preview-teleported=\"true\"\n :preview-src-list=\"[fieldValue]\"\n :src=\"fieldValue\"\n fit=\"cover\"\n style=\"width: 50px; height: 50px\"\n ></el-image>\n </div>\n\n <!--多图片-->\n <div v-if=\"field.render == 'images'\" class=\"ba-render-image\">\n <template v-if=\"Array.isArray(fieldValue) && fieldValue.length\">\n <el-image\n v-for=\"(item, idx) in fieldValue\"\n :key=\"idx\"\n :initial-index=\"idx\"\n :preview-teleported=\"true\"\n :preview-src-list=\"fieldValue\"\n class=\"images-item\"\n :src=\"item\"\n style=\"width: 50px; height: 50px\"\n :hide-on-click-modal=\"true\"\n ></el-image>\n </template>\n </div>\n\n <div v-if=\"field.render == 'tag' && fieldValue !== ''\">\n <el-tag\n :type=\"getTagType(fieldValue, field.custom)\"\n :effect=\"field.effect ?? 'light'\"\n :size=\"field.size ?? 'default'\"\n >\n {{ field.replaceValue ? field.replaceValue[fieldValue] : fieldValue }}\n </el-tag>\n </div>\n\n <!-- tags -->\n <div v-if=\"field.render == 'tags'\">\n <template v-if=\"Array.isArray(fieldValue)\">\n <template v-for=\"(tag, idx) in fieldValue\" :key=\"idx\">\n <el-tag\n v-if=\"tag !== ''\"\n class=\"m-1px\"\n :type=\"getTagType(tag, field.custom)\"\n :effect=\"field.effect ?? 'light'\"\n :size=\"field.size ?? 'default'\"\n >\n {{ field.replaceValue ? field.replaceValue[tag] ?? tag : tag }}</el-tag\n >\n </template>\n </template>\n <template v-else>\n <el-tag\n v-if=\"fieldValue !== ''\"\n class=\"m-1px\"\n :type=\"getTagType(fieldValue, field.custom)\"\n :effect=\"field.effect ?? 'light'\"\n :size=\"field.size ?? 'default'\"\n >\n {{ field.replaceValue ? field.replaceValue[fieldValue] ?? fieldValue : fieldValue }}\n </el-tag>\n </template>\n </div>\n\n <!-- url -->\n <div v-if=\"field.render == 'url' && fieldValue\">\n <el-input :model-value=\"fieldValue\" placeholder=\"链接地址\">\n <template #append>\n <el-button\n @click=\"\n typeof field.click == 'function'\n ? field.click(row, field, fieldValue, column, index)\n : openUrl(fieldValue, field.target)\n \"\n >\n <dk-icon :color=\"'#606266'\" icon=\"Position\" />\n </el-button>\n </template>\n </el-input>\n </div>\n\n <!-- datetime -->\n <div v-if=\"field.render == 'datetime'\">\n {{ !fieldValue ? '-' : timeFormat(fieldValue, field.timeFormat ?? undefined) }}\n </div>\n\n <div v-if=\"field.render == 'time'\">\n {{ fieldValue }}\n </div>\n <div v-if=\"field.render == 'year'\">\n {{ fieldValue }}\n </div>\n <!-- color -->\n <div v-if=\"field.render == 'color'\">\n <div :style=\"{ background: fieldValue }\" class=\"dk-render-color\"></div>\n </div>\n\n <!-- 自定义组件/函数渲染 -->\n <component\n :is=\"field.customRender\"\n v-if=\"field.render == 'customRender'\"\n :render-row=\"row\"\n :render-field=\"field\"\n :render-value=\"fieldValue\"\n :render-column=\"column\"\n :render-index=\"index\"\n />\n\n <!-- 按钮组 -->\n <!-- 只对默认的编辑、删除、排序按钮进行鉴权,其他按钮请通过 display 属性控制按钮是否显示 -->\n <div v-if=\"field.render == 'buttons' && field.buttons\">\n <template v-for=\"(btn, idx) in field.buttons\" :key=\"idx\">\n <template v-if=\"btn.display ? btn.display(row, field) : true\">\n <!-- 常规按钮 未使用-->\n <el-button\n v-if=\"btn.render == 'basicButton'\"\n v-blur\n :class=\"btn.class\"\n class=\"table-operate\"\n :type=\"btn.type\"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.attr\"\n @click=\"onButtonClick(btn)\"\n >\n <dk-icon :icon=\"btn.icon\" />\n <div v-if=\"btn.text\" class=\"table-operate-text\">{{ btn.text }}</div>\n </el-button>\n\n <!-- 带提示信息的按钮 -->\n <el-tooltip\n v-if=\"btn.render == 'tipButton' && ((btn.name == 'edit' && DkTable.auth('edit')) || btn.name != 'edit')\"\n :disabled=\"!(btn.title && !btn.disabledTip)\"\n :content=\"btn.title ?? ''\"\n placement=\"top\"\n :hide-after=\"0\"\n :show-after=\"100\"\n >\n <el-button\n v-blur\n :class=\"btn.class\"\n class=\"table-operate\"\n :type=\"btn.type\"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.attr\"\n @click=\"onButtonClick(btn)\"\n >\n <dk-icon :icon=\"btn.icon\" />\n <div v-if=\"btn.text\" class=\"table-operate-text\">{{ btn.text }}</div>\n </el-button>\n </el-tooltip>\n\n <!-- 带确认框的按钮 -->\n <el-popconfirm\n v-if=\"\n btn.render == 'confirmButton' && ((btn.name == 'delete' && DkTable.auth('del')) || btn.name != 'delete')\n \"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.popconfirm\"\n :hide-after=\"0\"\n :show-after=\"100\"\n @confirm=\"onButtonClick(btn)\"\n >\n <template #reference>\n <div class=\"dk-tooltip-button\">\n <el-tooltip :disabled=\"!btn.title\" :content=\"btn.title ?? ''\" placement=\"top\">\n <el-button\n v-blur\n :class=\"btn.class\"\n class=\"table-operate\"\n :type=\"btn.type\"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.attr\"\n >\n <dk-icon :icon=\"btn.icon\" />\n <div v-if=\"btn.text\" class=\"table-operate-text\">\n {{ btn.text }}\n </div>\n </el-button>\n </el-tooltip>\n </div>\n </template>\n </el-popconfirm>\n\n <!-- 带提示的可拖拽按钮 -->\n <el-tooltip\n v-if=\"\n btn.render == 'moveButton' &&\n ((btn.name == 'weigh-sort' && DkTable.auth('sortable')) || btn.name != 'weigh-sort')\n \"\n :disabled=\"!(btn.title && !btn.disabledTip)\"\n :content=\"btn.title ?? ''\"\n :hide-after=\"0\"\n :show-after=\"100\"\n placement=\"top\"\n >\n <el-button\n :class=\"btn.class\"\n class=\"table-operate move-button\"\n :type=\"btn.type\"\n :disabled=\"btn.disabled && btn.disabled(row, field)\"\n v-bind=\"btn.attr\"\n size=\"small\"\n >\n <dk-icon :icon=\"btn.icon\" />\n <div v-if=\"btn.text\" class=\"table-operate-text\">{{ btn.text }}</div>\n </el-button>\n </el-tooltip>\n </template>\n </template>\n </div>\n</template>\n<script setup lang=\"ts\">\nimport { inject, ref } from 'vue'\nimport type { TableColumnCtx, TagProps } from 'element-plus'\nimport { openUrl, timeFormat } from '@vipl520/utils'\nimport type dkTable from '../../utils/dkTable'\n\nconst DkTable = inject('DkTable') as dkTable\n\ninterface Props {\n row: TableRow\n field: TableColumn\n column: TableColumnCtx<TableRow>\n index: number\n}\nconst props = defineProps<Props>()\n\nconst fieldName: any = ref(props.field.prop)\nconst fieldValue = ref(props.row[fieldName.value] ?? '')\n\nif (fieldName.value && fieldName.value.indexOf('.') > -1) {\n const fieldNameArr = fieldName.value.split('.')\n const val: any = ref(props.row[fieldNameArr[0]])\n for (let index = 1; index < fieldNameArr.length; index++) {\n val.value = val.value ? val.value[fieldNameArr[index]] ?? '' : ''\n }\n fieldValue.value = val.value\n}\n\nconst getTagType = (value: string, custom: any): TagProps['type'] => {\n return custom && custom[value] ? custom[value] : ''\n}\n\nconst onChangeField = (value: any) => {\n DkTable.onTableAction('field-change', {\n ...props,\n value,\n })\n}\n\nconst onButtonClick = (btn: OptButton) => {\n if (typeof btn.click === 'function') {\n btn.click(props.row, props.field)\n return\n }\n DkTable.onTableAction(btn.name, props)\n}\n</script>\n<style scoped></style>\n"],"names":["__MACROS_defineComponent","inject","ref"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAA6B,cAAAA,mBAAyB,CAAA;AAAA,EACpD,IAAM,EAAA,eAAA;AACR,CAAC,CAAA,CAAA;;;;;;;;;;;AAgPD,IAAM,MAAA,OAAA,GAAUC,WAAO,SAAS,CAAA,CAAA;AAUhC,IAAA,MAAM,SAAiB,GAAAC,OAAA,CAAI,KAAM,CAAA,KAAA,CAAM,IAAI,CAAA,CAAA;AAC3C,IAAA,MAAM,aAAaA,OAAI,CAAA,KAAA,CAAM,IAAI,SAAU,CAAA,KAAK,KAAK,EAAE,CAAA,CAAA;AAEvD,IAAA,IAAI,UAAU,KAAS,IAAA,SAAA,CAAU,MAAM,OAAQ,CAAA,GAAG,IAAI,CAAI,CAAA,EAAA;AACxD,MAAA,MAAM,YAAe,GAAA,SAAA,CAAU,KAAM,CAAA,KAAA,CAAM,GAAG,CAAA,CAAA;AAC9C,MAAA,MAAM,MAAWA,OAAI,CAAA,KAAA,CAAM,IAAI,YAAa,CAAA,CAAC,CAAC,CAAC,CAAA,CAAA;AAC/C,MAAA,KAAA,IAAS,KAAQ,GAAA,CAAA,EAAG,KAAQ,GAAA,YAAA,CAAa,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -27,7 +27,6 @@ const tableProps = {
27
27
  },
28
28
  type: Array
29
29
  }
30
- // ...ElTableNext.props,
31
30
  };
32
31
 
33
32
  exports.tableProps = tableProps;
@@ -1 +1 @@
1
- {"version":3,"file":"props.js","sources":["../../../src/table/src/props.ts"],"sourcesContent":["import type { ExtractPropTypes } from 'vue'\n// import ElTableNext from 'el-table-next'\n\nexport const tableProps = {\n tableApi: {\n default: '',\n type: String,\n },\n cacheTable: {\n default: true,\n type: Boolean,\n },\n tableBefore: {\n default: () => {\n return {}\n },\n type: Object,\n },\n tableAfter: {\n default: () => {\n return {}\n },\n type: Object,\n },\n buttons: {\n default: () => {\n return ['refresh', 'add', 'export_csv', 'edit', 'delete', 'comSearch', 'quickSearch', 'columnDisplay']\n },\n type: Array,\n },\n // ...ElTableNext.props,\n}\n\nexport type TableProps = ExtractPropTypes<typeof tableProps>\n"],"names":[],"mappings":";;AAGO,MAAM,UAAa,GAAA;AAAA,EACxB,QAAU,EAAA;AAAA,IACR,OAAS,EAAA,EAAA;AAAA,IACT,IAAM,EAAA,MAAA;AAAA,GACR;AAAA,EACA,UAAY,EAAA;AAAA,IACV,OAAS,EAAA,IAAA;AAAA,IACT,IAAM,EAAA,OAAA;AAAA,GACR;AAAA,EACA,WAAa,EAAA;AAAA,IACX,SAAS,MAAM;AACb,MAAA,OAAO,EAAC,CAAA;AAAA,KACV;AAAA,IACA,IAAM,EAAA,MAAA;AAAA,GACR;AAAA,EACA,UAAY,EAAA;AAAA,IACV,SAAS,MAAM;AACb,MAAA,OAAO,EAAC,CAAA;AAAA,KACV;AAAA,IACA,IAAM,EAAA,MAAA;AAAA,GACR;AAAA,EACA,OAAS,EAAA;AAAA,IACP,SAAS,MAAM;AACb,MAAO,OAAA,CAAC,WAAW,KAAO,EAAA,YAAA,EAAc,QAAQ,QAAU,EAAA,WAAA,EAAa,eAAe,eAAe,CAAA,CAAA;AAAA,KACvG;AAAA,IACA,IAAM,EAAA,KAAA;AAAA,GACR;AAAA;AAEF;;;;"}
1
+ {"version":3,"file":"props.js","sources":["../../../src/table/src/props.ts"],"sourcesContent":["import type { ExtractPropTypes } from 'vue'\n// import ElTableNext from 'el-table-next'\n\nexport const tableProps = {\n tableApi: {\n default: '',\n type: String,\n },\n cacheTable: {\n default: true,\n type: Boolean,\n },\n tableBefore: {\n default: () => {\n return {}\n },\n type: Object,\n },\n tableAfter: {\n default: () => {\n return {}\n },\n type: Object,\n },\n buttons: {\n default: () => {\n return ['refresh', 'add', 'export_csv', 'edit', 'delete', 'comSearch', 'quickSearch', 'columnDisplay']\n },\n type: Array,\n },\n}\n\nexport type TableProps = ExtractPropTypes<typeof tableProps>\n"],"names":[],"mappings":";;AAGO,MAAM,UAAa,GAAA;AAAA,EACxB,QAAU,EAAA;AAAA,IACR,OAAS,EAAA,EAAA;AAAA,IACT,IAAM,EAAA,MAAA;AAAA,GACR;AAAA,EACA,UAAY,EAAA;AAAA,IACV,OAAS,EAAA,IAAA;AAAA,IACT,IAAM,EAAA,OAAA;AAAA,GACR;AAAA,EACA,WAAa,EAAA;AAAA,IACX,SAAS,MAAM;AACb,MAAA,OAAO,EAAC,CAAA;AAAA,KACV;AAAA,IACA,IAAM,EAAA,MAAA;AAAA,GACR;AAAA,EACA,UAAY,EAAA;AAAA,IACV,SAAS,MAAM;AACb,MAAA,OAAO,EAAC,CAAA;AAAA,KACV;AAAA,IACA,IAAM,EAAA,MAAA;AAAA,GACR;AAAA,EACA,OAAS,EAAA;AAAA,IACP,SAAS,MAAM;AACb,MAAO,OAAA,CAAC,WAAW,KAAO,EAAA,YAAA,EAAc,QAAQ,QAAU,EAAA,WAAA,EAAa,eAAe,eAAe,CAAA,CAAA;AAAA,KACvG;AAAA,IACA,IAAM,EAAA,KAAA;AAAA,GACR;AACF;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vipl520/dk-ui",
3
- "version": "1.0.26",
3
+ "version": "1.0.27",
4
4
  "description": "Vant extension components.",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.mjs",