@ditari/bsui 5.1.19 → 5.1.20
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/cjs/components/action-bar/ActionBar.vue.cjs +10 -0
- package/dist/cjs/components/action-bar/ActionBar.vue.cjs.map +1 -0
- package/dist/cjs/components/action-bar/ActionBar.vue.d.ts +47 -0
- package/dist/cjs/components/action-bar/ActionBar.vue2.cjs +114 -0
- package/dist/cjs/components/action-bar/ActionBar.vue2.cjs.map +1 -0
- package/dist/cjs/components/action-bar/index.cjs +16 -0
- package/dist/cjs/components/action-bar/index.cjs.map +1 -0
- package/dist/cjs/components/action-bar/index.d.ts +4 -0
- package/dist/cjs/components/form/FormLayout.cjs +147 -23
- package/dist/cjs/components/form/FormLayout.cjs.map +1 -1
- package/dist/cjs/components/form/FormLayout.d.ts +61 -0
- package/dist/cjs/components/index.cjs +6 -0
- package/dist/cjs/components/index.cjs.map +1 -1
- package/dist/cjs/components/index.d.ts +2 -0
- package/dist/cjs/components/select/Select.vue2.cjs +0 -3
- package/dist/cjs/components/select/Select.vue2.cjs.map +1 -1
- package/dist/cjs/components/tools-bar/ToolsBar.vue.cjs +10 -0
- package/dist/cjs/components/tools-bar/ToolsBar.vue.cjs.map +1 -0
- package/dist/cjs/components/tools-bar/ToolsBar.vue.d.ts +27 -0
- package/dist/cjs/components/tools-bar/ToolsBar.vue2.cjs +124 -0
- package/dist/cjs/components/tools-bar/ToolsBar.vue2.cjs.map +1 -0
- package/dist/cjs/components/tools-bar/index.cjs +16 -0
- package/dist/cjs/components/tools-bar/index.cjs.map +1 -0
- package/dist/cjs/components/tools-bar/index.d.ts +4 -0
- package/dist/cjs/index.cjs +5 -0
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/components/action-bar/ActionBar.vue.d.ts +47 -0
- package/dist/esm/components/action-bar/ActionBar.vue.mjs +6 -0
- package/dist/esm/components/action-bar/ActionBar.vue.mjs.map +1 -0
- package/dist/esm/components/action-bar/ActionBar.vue2.mjs +110 -0
- package/dist/esm/components/action-bar/ActionBar.vue2.mjs.map +1 -0
- package/dist/esm/components/action-bar/index.d.ts +4 -0
- package/dist/esm/components/action-bar/index.mjs +11 -0
- package/dist/esm/components/action-bar/index.mjs.map +1 -0
- package/dist/esm/components/form/FormLayout.d.ts +61 -0
- package/dist/esm/components/form/FormLayout.mjs +149 -25
- package/dist/esm/components/form/FormLayout.mjs.map +1 -1
- package/dist/esm/components/index.d.ts +2 -0
- package/dist/esm/components/index.mjs +4 -0
- package/dist/esm/components/index.mjs.map +1 -1
- package/dist/esm/components/select/Select.vue2.mjs +0 -3
- package/dist/esm/components/select/Select.vue2.mjs.map +1 -1
- package/dist/esm/components/tools-bar/ToolsBar.vue.d.ts +27 -0
- package/dist/esm/components/tools-bar/ToolsBar.vue.mjs +6 -0
- package/dist/esm/components/tools-bar/ToolsBar.vue.mjs.map +1 -0
- package/dist/esm/components/tools-bar/ToolsBar.vue2.mjs +120 -0
- package/dist/esm/components/tools-bar/ToolsBar.vue2.mjs.map +1 -0
- package/dist/esm/components/tools-bar/index.d.ts +4 -0
- package/dist/esm/components/tools-bar/index.mjs +11 -0
- package/dist/esm/components/tools-bar/index.mjs.map +1 -0
- package/dist/esm/index.mjs +3 -0
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/components/action-bar/ActionBar.vue.d.ts +47 -0
- package/dist/types/components/action-bar/ActionBar.vue.d.ts.map +1 -0
- package/dist/types/components/action-bar/index.d.ts +4 -0
- package/dist/types/components/action-bar/index.d.ts.map +1 -0
- package/dist/types/components/form/FormLayout.d.ts +61 -0
- package/dist/types/components/form/FormLayout.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/components/tools-bar/ToolsBar.vue.d.ts +27 -0
- package/dist/types/components/tools-bar/ToolsBar.vue.d.ts.map +1 -0
- package/dist/types/components/tools-bar/index.d.ts +4 -0
- package/dist/types/components/tools-bar/index.d.ts.map +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +2 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
require('./action-bar/index.cjs');
|
|
3
4
|
require('./card/index.cjs');
|
|
4
5
|
require('./date/index.cjs');
|
|
5
6
|
require('./dic/index.cjs');
|
|
@@ -10,10 +11,12 @@ require('./select/index.cjs');
|
|
|
10
11
|
require('./tab/index.cjs');
|
|
11
12
|
require('./table/index.cjs');
|
|
12
13
|
var index = require('./table-form/index.cjs');
|
|
14
|
+
require('./tools-bar/index.cjs');
|
|
13
15
|
var DicReplace = require('./dic/DicReplace.cjs');
|
|
14
16
|
var Select_vue_vue_type_script_setup_true_lang = require('./select/Select.vue2.cjs');
|
|
15
17
|
var Tab_vue_vue_type_script_setup_true_lang = require('./tab/Tab.vue2.cjs');
|
|
16
18
|
var Table = require('./table/Table.cjs');
|
|
19
|
+
var ActionBar_vue_vue_type_script_setup_true_lang = require('./action-bar/ActionBar.vue2.cjs');
|
|
17
20
|
var Card = require('./card/Card.cjs');
|
|
18
21
|
var RangePicker_vue_vue_type_script_setup_true_lang = require('./date/RangePicker.vue2.cjs');
|
|
19
22
|
var FormLayout = require('./form/FormLayout.cjs');
|
|
@@ -29,6 +32,7 @@ var List = require('./layout/List.cjs');
|
|
|
29
32
|
var Show = require('./layout/Show.cjs');
|
|
30
33
|
var _interface = require('./table-form/interface.cjs');
|
|
31
34
|
var TableFormItem = require('./table-form/TableFormItem.cjs');
|
|
35
|
+
var ToolsBar_vue_vue_type_script_setup_true_lang = require('./tools-bar/ToolsBar.vue2.cjs');
|
|
32
36
|
|
|
33
37
|
"use strict";
|
|
34
38
|
|
|
@@ -37,6 +41,7 @@ exports.DicRep = DicReplace.default;
|
|
|
37
41
|
exports.Select = Select_vue_vue_type_script_setup_true_lang.default;
|
|
38
42
|
exports.Tab = Tab_vue_vue_type_script_setup_true_lang.default;
|
|
39
43
|
exports.Table = Table.default;
|
|
44
|
+
exports.ActionBar = ActionBar_vue_vue_type_script_setup_true_lang.default;
|
|
40
45
|
exports.Card = Card.Card;
|
|
41
46
|
exports.RangePicker = RangePicker_vue_vue_type_script_setup_true_lang.default;
|
|
42
47
|
exports.FormLayout = FormLayout.default;
|
|
@@ -54,4 +59,5 @@ exports.DEFAULT_STYLES_CONFIG = _interface.DEFAULT_STYLES_CONFIG;
|
|
|
54
59
|
exports.tableFormItemProps = _interface.tableFormItemProps;
|
|
55
60
|
exports.tableFormProps = _interface.tableFormProps;
|
|
56
61
|
exports.TableFormItem = TableFormItem.TableFormItem;
|
|
62
|
+
exports.ToolsBar = ToolsBar_vue_vue_type_script_setup_true_lang.default;
|
|
57
63
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./action-bar";
|
|
1
2
|
export * from "./card";
|
|
2
3
|
export * from "./date";
|
|
3
4
|
export { default as DicRep } from "./dic";
|
|
@@ -8,4 +9,5 @@ export { default as Select } from "./select";
|
|
|
8
9
|
export { default as Tab } from "./tab";
|
|
9
10
|
export { default as Table } from "./table";
|
|
10
11
|
export * from "./table-form";
|
|
12
|
+
export * from "./tools-bar";
|
|
11
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -50,9 +50,6 @@ var _sfc_main = /* @__PURE__ */ vue.defineComponent({
|
|
|
50
50
|
(name) => name === route.name
|
|
51
51
|
);
|
|
52
52
|
const fetchDic = vue.inject("fetchDic", (name) => __async(null, null, function* () {
|
|
53
|
-
console.warn(
|
|
54
|
-
`fetchDic \u672A\u6CE8\u5165\uFF0C\u4F7F\u7528\u9ED8\u8BA4\u5B9E\u73B0\uFF0Cname: ${name}`
|
|
55
|
-
);
|
|
56
53
|
return [];
|
|
57
54
|
}));
|
|
58
55
|
let dicData = [...getDicByKey(props.name)];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.vue2.cjs","sources":["../../../../src/components/select/Select.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n inject,\n onActivated,\n onMounted,\n ref,\n watch\n} from \"vue\";\nimport { useRoute } from \"vue-router\";\n\nimport {\n useDicStore,\n useKeepAliveStore\n} from \"@ditari/store\";\n\ninterface DicItem {\n value: string | number;\n label: string;\n}\n\nconst props = defineProps({\n value: { required: true, default: undefined },\n name: { type: String, required: true, default: \"\" },\n disabled: { type: Boolean, required: false, default: false },\n placeholder: { type: String, required: false, default: \"请填写默认占位符啊!\" },\n include: { type: Array, required: false, default: () => [] }\n});\n\nconst emits = defineEmits([\"update:value\", \"change\", \"select\"]);\n\nconst { getDicByKey } = useDicStore();\nconst { get: keepNames } = useKeepAliveStore();\n\nconst { modelValue, data, onSelect, onChange } =\n useSelect();\n\nfunction useSelect() {\n const route = useRoute();\n const loadingStatus = ref(false);\n // 判断使用组件的页面是否被缓存\n const isKeepAlive = keepNames.some(\n (name: string) => name === route.name\n );\n // 注入 fetchDic,提供默认值\n const fetchDic = inject<\n (name: string) => Promise<unknown[]>\n >(\"fetchDic\", async (name: string) => {\n console.warn(\n
|
|
1
|
+
{"version":3,"file":"Select.vue2.cjs","sources":["../../../../src/components/select/Select.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n inject,\n onActivated,\n onMounted,\n ref,\n watch\n} from \"vue\";\nimport { useRoute } from \"vue-router\";\n\nimport {\n useDicStore,\n useKeepAliveStore\n} from \"@ditari/store\";\n\ninterface DicItem {\n value: string | number;\n label: string;\n}\n\nconst props = defineProps({\n value: { required: true, default: undefined },\n name: { type: String, required: true, default: \"\" },\n disabled: { type: Boolean, required: false, default: false },\n placeholder: { type: String, required: false, default: \"请填写默认占位符啊!\" },\n include: { type: Array, required: false, default: () => [] }\n});\n\nconst emits = defineEmits([\"update:value\", \"change\", \"select\"]);\n\nconst { getDicByKey } = useDicStore();\nconst { get: keepNames } = useKeepAliveStore();\n\nconst { modelValue, data, onSelect, onChange } =\n useSelect();\n\nfunction useSelect() {\n const route = useRoute();\n const loadingStatus = ref(false);\n // 判断使用组件的页面是否被缓存\n const isKeepAlive = keepNames.some(\n (name: string) => name === route.name\n );\n // 注入 fetchDic,提供默认值\n const fetchDic = inject<\n (name: string) => Promise<unknown[]>\n >(\"fetchDic\", async (name: string) => {\n // console.warn(\n // `fetchDic 未注入,使用默认实现,name: ${name}`\n // );\n return [];\n });\n\n // 字典数据\n let dicData: DicItem[] = [...getDicByKey(props.name)];\n const data = ref<DicItem[]>(dicData);\n\n // 取值\n const modelValue = ref<string | number | undefined>(\n props.value\n );\n\n onActivated(() => {\n // 缓存页面被激活的时候调用\n loadDicData();\n });\n\n onMounted(() => {\n if (!isKeepAlive) {\n // 未缓存页面 挂载的时候调用\n loadDicData();\n }\n });\n\n // 监听value值的变化\n watch(\n () => props.value,\n val => {\n modelValue.value = val;\n }\n );\n\n setTimeout(() => {\n if (!loadingStatus.value) {\n loadDicData();\n }\n }, 1000);\n\n // 请求字典数据的函数\n async function loadDicData() {\n try {\n loadingStatus.value = true;\n // 调用注入进来的fetchDic方法\n await fetchDic(props.name);\n dicData = [...getDicByKey(props.name)];\n\n if (props.include.length > 0) {\n data.value = dicData.filter((item: DicItem) => {\n return props.include.some(\n (i: string | number) => i === item.value\n );\n });\n } else {\n data.value = dicData;\n }\n } catch (error) {\n console.error(\"获取字典数据失败:\", error);\n }\n }\n\n // 监听用户搜索事件\n const onSearch = (keywords: string) => {\n sendWorkerSearch(keywords);\n };\n\n // 发送搜索到webworker\n function sendWorkerSearch(keywords: string) {\n keywords = keywords ?? \"\";\n data.value = dicData\n .filter((item: DicItem) => {\n return (\n item.value\n .toString()\n .toLowerCase()\n .indexOf(keywords.toLowerCase()) !== -1 ||\n item.label\n .toLowerCase()\n .includes(keywords.toLowerCase())\n );\n })\n .slice(0, 10);\n if (data.value.length === 0) {\n data.value = [...dicData].slice(0, 10);\n }\n }\n\n // 监听下拉选择事件\n const onSelect = (value: string | number) => {\n // 发射选择的数据\n emits(\"update:value\", value);\n // 处理下拉后返回数据的\n onSelectHandler();\n };\n\n // 监听数据改变\n const onChange = () => {\n emits(\"update:value\", modelValue.value);\n emits(\"change\", modelValue.value);\n };\n\n /**\n * 根据当前选中的value匹配对应的整条数据\n * 然后返回给父组件\n */\n function onSelectHandler() {\n const dicList = getDicByKey(props.name);\n const rs = dicList.find(\n (obj: DicItem) => obj.value === modelValue.value\n );\n emits(\"select\", rs);\n }\n\n watch(\n () => props.include,\n (val: Array<string | number>) => {\n if (val.length > 0) {\n // 只过滤出来include包含的数据\n data.value = dicData.filter((item: DicItem) => {\n return val.some(\n (i: string | number) => i === item.value\n );\n });\n } else {\n data.value = dicData;\n }\n },\n {\n immediate: true\n }\n );\n\n return {\n data,\n modelValue,\n onSearch,\n onSelect,\n onChange\n };\n}\n\n/**\n * 过滤筛选\n * @param inputValue\n * @param options\n */\nconst onFilterOption = (\n inputValue: string,\n options: DicItem\n) => {\n return (\n options.value\n .toString()\n .toLowerCase()\n .indexOf(inputValue.toLowerCase()) !== -1 ||\n options.label\n .toLowerCase()\n .includes(inputValue.toLowerCase())\n );\n};\n</script>\n\n<template>\n <a-select\n v-model:value=\"modelValue\"\n style=\"width: 100%\"\n allow-clear\n show-search\n :options=\"data\"\n :placeholder=\"placeholder\"\n :disabled=\"disabled\"\n :filter-option=\"onFilterOption\"\n @select=\"onSelect\"\n @change=\"onChange\"\n >\n </a-select>\n</template>\n\n<style scoped></style>\n"],"names":["useDicStore","useKeepAliveStore","useRoute","ref","inject","data","modelValue","onActivated","onMounted","watch","onSelect","onChange","_createBlock","_unref"],"mappings":";;;;;;;;;;;;;;;;;;;;;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
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var ToolsBar_vue_vue_type_script_setup_true_lang = require('./ToolsBar.vue2.cjs');
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
|
|
9
|
+
exports.default = ToolsBar_vue_vue_type_script_setup_true_lang.default;
|
|
10
|
+
//# sourceMappingURL=ToolsBar.vue.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolsBar.vue.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type VNode } from "vue";
|
|
2
|
+
interface ButtonItem {
|
|
3
|
+
title: string;
|
|
4
|
+
onClick?: () => void;
|
|
5
|
+
icon?: string | (() => VNode);
|
|
6
|
+
isUpload?: boolean;
|
|
7
|
+
attrs?: Record<string, unknown>;
|
|
8
|
+
uploadAttrs?: Record<string, unknown>;
|
|
9
|
+
}
|
|
10
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
11
|
+
buttonGroups: {
|
|
12
|
+
type: ArrayConstructor;
|
|
13
|
+
required: true;
|
|
14
|
+
};
|
|
15
|
+
}>, {
|
|
16
|
+
props: any;
|
|
17
|
+
getIconContent: (item: ButtonItem) => VNode<import("vue").RendererNode, import("vue").RendererElement, {
|
|
18
|
+
[key: string]: any;
|
|
19
|
+
}> | null;
|
|
20
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
21
|
+
buttonGroups: {
|
|
22
|
+
type: ArrayConstructor;
|
|
23
|
+
required: true;
|
|
24
|
+
};
|
|
25
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
26
|
+
export default _default;
|
|
27
|
+
//# sourceMappingURL=ToolsBar.vue.d.ts.map
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var vue = require('vue');
|
|
6
|
+
|
|
7
|
+
"use strict";
|
|
8
|
+
var __defProp = Object.defineProperty;
|
|
9
|
+
var __defProps = Object.defineProperties;
|
|
10
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
11
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
12
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
14
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
15
|
+
var __spreadValues = (a, b) => {
|
|
16
|
+
for (var prop in b || (b = {}))
|
|
17
|
+
if (__hasOwnProp.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
if (__getOwnPropSymbols)
|
|
20
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
21
|
+
if (__propIsEnum.call(b, prop))
|
|
22
|
+
__defNormalProp(a, prop, b[prop]);
|
|
23
|
+
}
|
|
24
|
+
return a;
|
|
25
|
+
};
|
|
26
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
27
|
+
var _sfc_main = /* @__PURE__ */ vue.defineComponent(__spreadProps(__spreadValues({}, {
|
|
28
|
+
name: "DToolsBar"
|
|
29
|
+
}), {
|
|
30
|
+
__name: "ToolsBar",
|
|
31
|
+
props: {
|
|
32
|
+
buttonGroups: { type: Array, required: true }
|
|
33
|
+
},
|
|
34
|
+
setup(__props) {
|
|
35
|
+
const props = __props;
|
|
36
|
+
function getIconContent(item) {
|
|
37
|
+
if (!item.icon) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
if (typeof item.icon === "function") {
|
|
41
|
+
return item.icon();
|
|
42
|
+
} else {
|
|
43
|
+
return vue.h(vue.resolveComponent("action-icon-font"), { type: item.icon });
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return (_ctx, _cache) => {
|
|
47
|
+
const _component_a_button = vue.resolveComponent("a-button");
|
|
48
|
+
const _component_a_upload = vue.resolveComponent("a-upload");
|
|
49
|
+
const _component_a_space = vue.resolveComponent("a-space");
|
|
50
|
+
return vue.openBlock(), vue.createBlock(_component_a_space, null, {
|
|
51
|
+
default: vue.withCtx(() => [
|
|
52
|
+
(vue.openBlock(true), vue.createElementBlock(
|
|
53
|
+
vue.Fragment,
|
|
54
|
+
null,
|
|
55
|
+
vue.renderList(__props.buttonGroups, (item, index) => {
|
|
56
|
+
return vue.openBlock(), vue.createElementBlock("div", { key: index }, [
|
|
57
|
+
item.isUpload ? (vue.openBlock(), vue.createBlock(
|
|
58
|
+
_component_a_upload,
|
|
59
|
+
vue.mergeProps({
|
|
60
|
+
key: 0,
|
|
61
|
+
ref_for: true
|
|
62
|
+
}, item.uploadAttrs),
|
|
63
|
+
{
|
|
64
|
+
default: vue.withCtx(() => [
|
|
65
|
+
vue.createVNode(
|
|
66
|
+
_component_a_button,
|
|
67
|
+
vue.mergeProps({ ref_for: true }, item.attrs),
|
|
68
|
+
{
|
|
69
|
+
icon: vue.withCtx(() => [
|
|
70
|
+
item.icon ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(getIconContent(item)), { key: 0 })) : vue.createCommentVNode("v-if", true)
|
|
71
|
+
]),
|
|
72
|
+
default: vue.withCtx(() => [
|
|
73
|
+
vue.createTextVNode(
|
|
74
|
+
" " + vue.toDisplayString(item.title),
|
|
75
|
+
1
|
|
76
|
+
/* TEXT */
|
|
77
|
+
)
|
|
78
|
+
]),
|
|
79
|
+
_: 2
|
|
80
|
+
/* DYNAMIC */
|
|
81
|
+
},
|
|
82
|
+
1040
|
|
83
|
+
/* FULL_PROPS, DYNAMIC_SLOTS */
|
|
84
|
+
)
|
|
85
|
+
]),
|
|
86
|
+
_: 2
|
|
87
|
+
/* DYNAMIC */
|
|
88
|
+
},
|
|
89
|
+
1040
|
|
90
|
+
/* FULL_PROPS, DYNAMIC_SLOTS */
|
|
91
|
+
)) : (vue.openBlock(), vue.createBlock(_component_a_button, vue.mergeProps({
|
|
92
|
+
key: 1,
|
|
93
|
+
ref_for: true
|
|
94
|
+
}, item.attrs, {
|
|
95
|
+
onClick: item.onClick
|
|
96
|
+
}), {
|
|
97
|
+
icon: vue.withCtx(() => [
|
|
98
|
+
item.icon ? (vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(getIconContent(item)), { key: 0 })) : vue.createCommentVNode("v-if", true)
|
|
99
|
+
]),
|
|
100
|
+
default: vue.withCtx(() => [
|
|
101
|
+
vue.createTextVNode(
|
|
102
|
+
" " + vue.toDisplayString(item.title),
|
|
103
|
+
1
|
|
104
|
+
/* TEXT */
|
|
105
|
+
)
|
|
106
|
+
]),
|
|
107
|
+
_: 2
|
|
108
|
+
/* DYNAMIC */
|
|
109
|
+
}, 1040, ["onClick"]))
|
|
110
|
+
]);
|
|
111
|
+
}),
|
|
112
|
+
128
|
|
113
|
+
/* KEYED_FRAGMENT */
|
|
114
|
+
))
|
|
115
|
+
]),
|
|
116
|
+
_: 1
|
|
117
|
+
/* STABLE */
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
}));
|
|
122
|
+
|
|
123
|
+
exports.default = _sfc_main;
|
|
124
|
+
//# sourceMappingURL=ToolsBar.vue2.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToolsBar.vue2.cjs","sources":["../../../../src/components/tools-bar/ToolsBar.vue"],"sourcesContent":["<script setup lang=\"ts\">\r\n import { h, resolveComponent, type VNode } from \"vue\";\r\n\r\n defineOptions({\r\n name: \"DToolsBar\"\r\n });\r\n\r\n interface ButtonItem {\r\n title: string;\r\n onClick?: () => void;\r\n icon?: string | (() => VNode);\r\n // 是否是上传按钮\r\n isUpload?: boolean;\r\n // 用于支持a-button 额外属性透传\r\n attrs?: Record<string, unknown>;\r\n // 用于支持a-upload 额外属性透传\r\n uploadAttrs?: Record<string, unknown>;\r\n }\r\n\r\n const props = defineProps({\n buttonGroups: { type: Array, required: true }\n});\r\n\r\n // 获取要渲染的内容\r\n function getIconContent(item: ButtonItem) {\r\n if (!item.icon) {\r\n return null;\r\n }\r\n\r\n if (typeof item.icon === \"function\") {\r\n // 执行函数获取 VNode\r\n return item.icon();\r\n } else {\r\n // 渲染图标组件\r\n return h(resolveComponent(\"action-icon-font\"), { type: item.icon });\r\n }\r\n }\r\n</script>\r\n\r\n<template>\r\n <a-space>\r\n <div v-for=\"(item, index) in buttonGroups\" :key=\"index\">\r\n <a-upload v-if=\"item.isUpload\" v-bind=\"item.uploadAttrs\">\r\n <a-button v-bind=\"item.attrs\">\r\n <template #icon>\r\n <component :is=\"getIconContent(item)\" v-if=\"item.icon\" />\r\n </template>\r\n {{ item.title }}\r\n </a-button>\r\n </a-upload>\r\n <a-button v-else v-bind=\"item.attrs\" @click=\"item.onClick\">\r\n <template #icon>\r\n <component :is=\"getIconContent(item)\" v-if=\"item.icon\" />\r\n </template>\r\n {{ item.title }}\r\n </a-button>\r\n </div>\r\n </a-space>\r\n</template>\r\n\r\n<style lang=\"scss\" scoped></style>\r\n"],"names":["h","resolveComponent","_createBlock","_openBlock","_createElementBlock","_Fragment","_renderList","_mergeProps","_createVNode","_resolveDynamicComponent","_toDisplayString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmBE,IAAA,MAAM,KAAA,GAAQ,OAAA;AAKd,IAAA,SAAS,eAAe,IAAA,EAAkB;AACxC,MAAA,IAAI,CAAC,KAAK,IAAA,EAAM;AACd,QAAA,OAAO,IAAA;AAAA,MACT;AAEA,MAAA,IAAI,OAAO,IAAA,CAAK,IAAA,KAAS,UAA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ACC,MACZ;AAAA,oBAD8C,KAAK,IAAA,qBAAjDL,eAAA,CAAyDO,4BAAzC,cAAA,CAAe,IAAI,CAAA,CAAA,EAAA,EAAA,GAAA,EAAA,CAAA,EAAA,CAAA;;uCAC1B,MACX;AAAA;sBADW,GAAA,GACXC,mBAAA,CAAG,IAAA,CAAK,KAAK,CAAA;AAAA,sBAAA;AAAA;AAAA;AAAA;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
require('./ToolsBar.vue.cjs');
|
|
6
|
+
var ToolsBar_vue_vue_type_script_setup_true_lang = require('./ToolsBar.vue2.cjs');
|
|
7
|
+
|
|
8
|
+
"use strict";
|
|
9
|
+
ToolsBar_vue_vue_type_script_setup_true_lang.default.install = function(app) {
|
|
10
|
+
app.component(ToolsBar_vue_vue_type_script_setup_true_lang.default.name, ToolsBar_vue_vue_type_script_setup_true_lang.default);
|
|
11
|
+
return app;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.ToolsBar = ToolsBar_vue_vue_type_script_setup_true_lang.default;
|
|
15
|
+
exports.default = ToolsBar_vue_vue_type_script_setup_true_lang.default;
|
|
16
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../src/components/tools-bar/index.ts"],"sourcesContent":["import ToolsBar from \"./ToolsBar.vue\";\r\nimport type { App } from \"vue\";\r\n\r\nToolsBar.install = function (app: App) {\r\n app.component(ToolsBar.name!, ToolsBar);\r\n return app;\r\n};\r\n\r\nexport { ToolsBar };\r\nexport default ToolsBar;\r\n"],"names":["ToolsBar"],"mappings":";;;;;;;;AAGAA,oDAAA,CAAS,OAAA,GAAU,SAAU,GAAA,EAAU;AACrC,EAAA,GAAA,CAAI,SAAA,CAAUA,oDAAA,CAAS,IAAA,EAAOA,oDAAQ,CAAA;AACtC,EAAA,OAAO,GAAA;AACT,CAAA;;;;;"}
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -7,6 +7,7 @@ var DicReplace = require('./components/dic/DicReplace.cjs');
|
|
|
7
7
|
var Select_vue_vue_type_script_setup_true_lang = require('./components/select/Select.vue2.cjs');
|
|
8
8
|
var Tab_vue_vue_type_script_setup_true_lang = require('./components/tab/Tab.vue2.cjs');
|
|
9
9
|
var Table = require('./components/table/Table.cjs');
|
|
10
|
+
var ActionBar_vue_vue_type_script_setup_true_lang = require('./components/action-bar/ActionBar.vue2.cjs');
|
|
10
11
|
var Card = require('./components/card/Card.cjs');
|
|
11
12
|
var RangePicker_vue_vue_type_script_setup_true_lang = require('./components/date/RangePicker.vue2.cjs');
|
|
12
13
|
var FormLayout = require('./components/form/FormLayout.cjs');
|
|
@@ -23,9 +24,11 @@ var Show = require('./components/layout/Show.cjs');
|
|
|
23
24
|
var _interface = require('./components/table-form/interface.cjs');
|
|
24
25
|
var index$1 = require('./components/table-form/index.cjs');
|
|
25
26
|
var TableFormItem = require('./components/table-form/TableFormItem.cjs');
|
|
27
|
+
var ToolsBar_vue_vue_type_script_setup_true_lang = require('./components/tools-bar/ToolsBar.vue2.cjs');
|
|
26
28
|
|
|
27
29
|
"use strict";
|
|
28
30
|
const install = (app) => {
|
|
31
|
+
console.log("install", index$2);
|
|
29
32
|
Object.keys(index$2).forEach((key) => {
|
|
30
33
|
const component = index$2[key];
|
|
31
34
|
const plugin = component;
|
|
@@ -43,6 +46,7 @@ exports.DicRep = DicReplace.default;
|
|
|
43
46
|
exports.Select = Select_vue_vue_type_script_setup_true_lang.default;
|
|
44
47
|
exports.Tab = Tab_vue_vue_type_script_setup_true_lang.default;
|
|
45
48
|
exports.Table = Table.default;
|
|
49
|
+
exports.ActionBar = ActionBar_vue_vue_type_script_setup_true_lang.default;
|
|
46
50
|
exports.Card = Card.Card;
|
|
47
51
|
exports.RangePicker = RangePicker_vue_vue_type_script_setup_true_lang.default;
|
|
48
52
|
exports.FormLayout = FormLayout.default;
|
|
@@ -61,6 +65,7 @@ exports.tableFormItemProps = _interface.tableFormItemProps;
|
|
|
61
65
|
exports.tableFormProps = _interface.tableFormProps;
|
|
62
66
|
exports.TableForm = index$1.TableForm;
|
|
63
67
|
exports.TableFormItem = TableFormItem.TableFormItem;
|
|
68
|
+
exports.ToolsBar = ToolsBar_vue_vue_type_script_setup_true_lang.default;
|
|
64
69
|
exports.default = index;
|
|
65
70
|
exports.install = install;
|
|
66
71
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["import * as components from \"./components\";\r\nimport type { App, DefineComponent, Plugin } from \"vue\";\r\n\r\n// import { version } from \"../package.json\";\r\n\r\nexport * from \"./components\";\r\n\r\n// 定义组件类型,确保每个组件都可能具有 `install` 方法\r\ntype ComponentWithInstall = DefineComponent<\r\n never,\r\n never,\r\n never\r\n> & {\r\n install?: (app: App) => void;\r\n};\r\n\r\nexport const install = (app: App) => {\r\n Object.keys(components).forEach(key => {\r\n const component = components[\r\n key as keyof typeof components\r\n ] as ComponentWithInstall;\r\n // 类型断言,告诉 TypeScript component 可能是一个插件\r\n const plugin = component as Plugin;\r\n // 如果组件有 install 方法,则按插件安装\r\n if (plugin.install) {\r\n app.use(plugin);\r\n }\r\n });\r\n};\r\n\r\nexport default {\r\n // version,\r\n install\r\n};\r\n"],"names":["components"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../src/index.ts"],"sourcesContent":["import * as components from \"./components\";\r\nimport type { App, DefineComponent, Plugin } from \"vue\";\r\n\r\n// import { version } from \"../package.json\";\r\n\r\nexport * from \"./components\";\r\n\r\n// 定义组件类型,确保每个组件都可能具有 `install` 方法\r\ntype ComponentWithInstall = DefineComponent<\r\n never,\r\n never,\r\n never\r\n> & {\r\n install?: (app: App) => void;\r\n};\r\n\r\nexport const install = (app: App) => {\r\n\r\n console.log(\"install\", components);\r\n Object.keys(components).forEach(key => {\r\n const component = components[\r\n key as keyof typeof components\r\n ] as ComponentWithInstall;\r\n // 类型断言,告诉 TypeScript component 可能是一个插件\r\n const plugin = component as Plugin;\r\n // 如果组件有 install 方法,则按插件安装\r\n if (plugin.install) {\r\n app.use(plugin);\r\n }\r\n });\r\n};\r\n\r\nexport default {\r\n // version,\r\n install\r\n};\r\n"],"names":["components"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBO,MAAM,OAAA,GAAU,CAAC,GAAA,KAAa;AAEnC,EAAA,OAAA,CAAQ,GAAA,CAAI,WAAWA,OAAU,CAAA;AACjC,EAAA,MAAA,CAAO,IAAA,CAAKA,OAAU,CAAA,CAAE,OAAA,CAAQ,CAAA,GAAA,KAAO;AACrC,IAAA,MAAM,SAAA,GAAYA,QAChB,GACF,CAAA;AAEA,IAAA,MAAM,MAAA,GAAS,SAAA;AAEf,IAAA,IAAI,OAAO,OAAA,EAAS;AAClB,MAAA,GAAA,CAAI,IAAI,MAAM,CAAA;AAAA,IAChB;AAAA,EACF,CAAC,CAAA;AACH;AAEA,YAAe;AAAA;AAAA,EAEb;AACF,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type VNode } from "vue";
|
|
2
|
+
interface ButtonItem {
|
|
3
|
+
title: string | VNode;
|
|
4
|
+
status?: boolean | ((record: {
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}) => boolean);
|
|
7
|
+
onClick?: (record: {
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
}) => void;
|
|
10
|
+
onEvent?: (record: {
|
|
11
|
+
[key: string]: unknown;
|
|
12
|
+
}) => void;
|
|
13
|
+
}
|
|
14
|
+
declare const _default: import("vue").DefineComponent<import("vue").ExtractPropTypes<{
|
|
15
|
+
buttonGroups: {
|
|
16
|
+
type: ArrayConstructor;
|
|
17
|
+
required: false;
|
|
18
|
+
};
|
|
19
|
+
actions: {
|
|
20
|
+
type: ArrayConstructor;
|
|
21
|
+
required: false;
|
|
22
|
+
};
|
|
23
|
+
record: {
|
|
24
|
+
type: ObjectConstructor;
|
|
25
|
+
required: true;
|
|
26
|
+
};
|
|
27
|
+
}>, {
|
|
28
|
+
props: any;
|
|
29
|
+
isShow: (item: ButtonItem) => boolean;
|
|
30
|
+
visibleButtons: import("vue").ComputedRef<ButtonItem[]>;
|
|
31
|
+
showDivider: (item: ButtonItem) => boolean;
|
|
32
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
|
|
33
|
+
buttonGroups: {
|
|
34
|
+
type: ArrayConstructor;
|
|
35
|
+
required: false;
|
|
36
|
+
};
|
|
37
|
+
actions: {
|
|
38
|
+
type: ArrayConstructor;
|
|
39
|
+
required: false;
|
|
40
|
+
};
|
|
41
|
+
record: {
|
|
42
|
+
type: ObjectConstructor;
|
|
43
|
+
required: true;
|
|
44
|
+
};
|
|
45
|
+
}>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
46
|
+
export default _default;
|
|
47
|
+
//# sourceMappingURL=ActionBar.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionBar.vue.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { defineComponent, computed, resolveComponent, createElementBlock, openBlock, withModifiers, Fragment, renderList, createCommentVNode, createBlock, resolveDynamicComponent, createTextVNode, toDisplayString } from 'vue';
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defProps = Object.defineProperties;
|
|
6
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
10
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
11
|
+
var __spreadValues = (a, b) => {
|
|
12
|
+
for (var prop in b || (b = {}))
|
|
13
|
+
if (__hasOwnProp.call(b, prop))
|
|
14
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
|
+
if (__getOwnPropSymbols)
|
|
16
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
17
|
+
if (__propIsEnum.call(b, prop))
|
|
18
|
+
__defNormalProp(a, prop, b[prop]);
|
|
19
|
+
}
|
|
20
|
+
return a;
|
|
21
|
+
};
|
|
22
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
23
|
+
const _hoisted_1 = ["onClick"];
|
|
24
|
+
var _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
|
|
25
|
+
name: "DActionBar"
|
|
26
|
+
}), {
|
|
27
|
+
__name: "ActionBar",
|
|
28
|
+
props: {
|
|
29
|
+
buttonGroups: { type: Array, required: false },
|
|
30
|
+
actions: { type: Array, required: false },
|
|
31
|
+
record: { type: Object, required: true }
|
|
32
|
+
},
|
|
33
|
+
setup(__props) {
|
|
34
|
+
const props = __props;
|
|
35
|
+
const isShow = (item) => {
|
|
36
|
+
var _a;
|
|
37
|
+
if (typeof item.status === "function") {
|
|
38
|
+
return item.status(props.record);
|
|
39
|
+
}
|
|
40
|
+
return (_a = item.status) != null ? _a : true;
|
|
41
|
+
};
|
|
42
|
+
const visibleButtons = computed(() => {
|
|
43
|
+
const groups = props.actions || props.buttonGroups || [];
|
|
44
|
+
return groups.filter((item) => isShow(item));
|
|
45
|
+
});
|
|
46
|
+
const showDivider = (item) => {
|
|
47
|
+
if (!isShow(item)) {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
const visibleIndex = visibleButtons.value.findIndex((v) => v.title === item.title);
|
|
51
|
+
return visibleIndex !== -1 && visibleIndex < visibleButtons.value.length - 1;
|
|
52
|
+
};
|
|
53
|
+
return (_ctx, _cache) => {
|
|
54
|
+
const _component_a_divider = resolveComponent("a-divider");
|
|
55
|
+
return openBlock(), createElementBlock("div", {
|
|
56
|
+
onClick: _cache[0] || (_cache[0] = withModifiers(() => {
|
|
57
|
+
}, ["stop"]))
|
|
58
|
+
}, [
|
|
59
|
+
(openBlock(true), createElementBlock(
|
|
60
|
+
Fragment,
|
|
61
|
+
null,
|
|
62
|
+
renderList(__props.actions || __props.buttonGroups || [], (item, index) => {
|
|
63
|
+
return openBlock(), createElementBlock(
|
|
64
|
+
Fragment,
|
|
65
|
+
{ key: index },
|
|
66
|
+
[
|
|
67
|
+
isShow(item) ? (openBlock(), createElementBlock("a", {
|
|
68
|
+
key: 0,
|
|
69
|
+
onClick: withModifiers(($event) => {
|
|
70
|
+
var _a;
|
|
71
|
+
return (_a = item.onClick || item.onEvent) == null ? void 0 : _a(__props.record);
|
|
72
|
+
}, ["stop"])
|
|
73
|
+
}, [
|
|
74
|
+
item.title instanceof Object ? (openBlock(), createBlock(resolveDynamicComponent(item.title), {
|
|
75
|
+
key: 0,
|
|
76
|
+
record: __props.record
|
|
77
|
+
}, null, 8, ["record"])) : (openBlock(), createElementBlock(
|
|
78
|
+
Fragment,
|
|
79
|
+
{ key: 1 },
|
|
80
|
+
[
|
|
81
|
+
createTextVNode(
|
|
82
|
+
toDisplayString(item.title),
|
|
83
|
+
1
|
|
84
|
+
/* TEXT */
|
|
85
|
+
)
|
|
86
|
+
],
|
|
87
|
+
64
|
|
88
|
+
/* STABLE_FRAGMENT */
|
|
89
|
+
))
|
|
90
|
+
], 8, _hoisted_1)) : createCommentVNode("v-if", true),
|
|
91
|
+
showDivider(item) ? (openBlock(), createBlock(_component_a_divider, {
|
|
92
|
+
key: 1,
|
|
93
|
+
type: "vertical",
|
|
94
|
+
style: { "border-color": "#3e7fff", "border-width": "2px" }
|
|
95
|
+
})) : createCommentVNode("v-if", true)
|
|
96
|
+
],
|
|
97
|
+
64
|
|
98
|
+
/* STABLE_FRAGMENT */
|
|
99
|
+
);
|
|
100
|
+
}),
|
|
101
|
+
128
|
|
102
|
+
/* KEYED_FRAGMENT */
|
|
103
|
+
))
|
|
104
|
+
]);
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
}));
|
|
108
|
+
|
|
109
|
+
export { _sfc_main as default };
|
|
110
|
+
//# sourceMappingURL=ActionBar.vue2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionBar.vue2.mjs","sources":["../../../../src/components/action-bar/ActionBar.vue"],"sourcesContent":["<script setup lang=\"ts\">\r\n import { computed, type VNode } from \"vue\";\r\n\r\n defineOptions({\r\n name: \"DActionBar\"\r\n });\r\n\r\n interface ButtonItem {\r\n title: string | VNode;\r\n status?: boolean | ((record: { [key: string]: unknown }) => boolean);\r\n onClick?: (record: { [key: string]: unknown }) => void;\r\n onEvent?: (record: { [key: string]: unknown }) => void; // 别名,为了向后兼容\r\n }\r\n\r\n // 2. 普通的 Props 声明\r\n const props = defineProps({\n buttonGroups: { type: Array, required: false },\n actions: { type: Array, required: false },\n record: { type: Object, required: true }\n});\r\n\r\n /**\r\n * 判断按钮是否显示\r\n */\r\n const isShow = (item: ButtonItem): boolean => {\r\n if (typeof item.status === \"function\") {\r\n return item.status(props.record);\r\n }\r\n return item.status ?? true;\r\n };\r\n\r\n /**\r\n * 过滤出当前真正显示的按钮列表\r\n */\r\n const visibleButtons = computed(() => {\r\n const groups: ButtonItem[] = props.actions || props.buttonGroups || [];\r\n return groups.filter((item: ButtonItem) => isShow(item));\r\n });\r\n\r\n /**\r\n * 判断分隔线状态\r\n */\r\n const showDivider = (item: ButtonItem): boolean => {\r\n if (!isShow(item)) {\r\n return false;\r\n }\r\n\r\n // 逻辑保持不变:在可见列表里找自己\r\n const visibleIndex = visibleButtons.value.findIndex((v: ButtonItem) => v.title === item.title);\r\n return visibleIndex !== -1 && visibleIndex < visibleButtons.value.length - 1;\r\n };\r\n</script>\r\n\r\n<template>\r\n <div @click.stop>\r\n <template v-for=\"(item, index) in actions || buttonGroups || []\" :key=\"index\">\r\n <a v-if=\"isShow(item)\" @click.stop=\"(item.onClick || item.onEvent)?.(record)\">\r\n <template v-if=\"item.title instanceof Object\">\r\n <component :is=\"item.title\" :record=\"record\" />\r\n </template>\r\n <template v-else>\r\n {{ item.title }}\r\n </template>\r\n </a>\r\n <a-divider\r\n v-if=\"showDivider(item)\"\r\n type=\"vertical\"\r\n style=\"border-color: #3e7fff; border-width: 2px\"\r\n />\r\n </template>\r\n </div>\r\n</template>\r\n"],"names":["_createElementBlock","_openBlock","_Fragment","_withModifiers","_createBlock","_resolveDynamicComponent","_createTextVNode","_toDisplayString"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeE,IAAA,MAAM,KAAA,GAAQ,OAAA;AASd,IAAA,MAAM,MAAA,GAAS,CAAC,IAAA,KAA8B;;AAC5C,MAAA,IAAI,OAAO,IAAA,CAAK,MAAA,KAAW,UAAA,EAAY;AACrC,QAAA,OAAO,IAAA,CAAK,MAAA,CAAO,KAAA,CAAM,MAAM,CAAA;AAAA,MACjC;AACA,MAAA,OAAA,CAAO,EAAA,GAAA,IAAA,CAAK,WAAL,IAAA,GAAA,EAAA,GAAe,IAAA;AAAA,IACxB,CAAA;AAKA,IAAA,MAAM,cAAA,GAAiB,SAAS,MAAM;AACpC,MAAA,MAAM,MAAA,GAAuB,KAAA,CAAM,OAAA,IAAW,KAAA,CAAM,gBAAgB,EAAC;AACrE,MAAA,OAAO,OAAO,MAAA,CAAO,CAAC,IAAA,KAAqB,MAAA,CAAO,IAAI,CAAC,CAAA;AAAA,IACzD,CAAC,CAAA;A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A,oBAAA;AAAA,sBADNI,eAAA;AAAA,wBAAAC,eAAA,CAAA,KAAK,KAAK,CAAA;AAAA,wBAAA;AAAA;AAAA;AAAA;;;;;gBAIT,YAAY,IAAI,CAAA,iBADxBH,YAIE,oBAAA,EAAA;AAAA;kBAFA,IAAA,EAAK,UAAA;AAAA,kBACL,KAAA,EAAA,EAAA,cAAA,EAAA,SAAA,EAAA,gBAAA,KAAA;AAAA;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import './ActionBar.vue.mjs';
|
|
2
|
+
import _sfc_main from './ActionBar.vue2.mjs';
|
|
3
|
+
|
|
4
|
+
"use strict";
|
|
5
|
+
_sfc_main.install = function(app) {
|
|
6
|
+
app.component(_sfc_main.name, _sfc_main);
|
|
7
|
+
return app;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export { _sfc_main as ActionBar, _sfc_main as default };
|
|
11
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../../../../src/components/action-bar/index.ts"],"sourcesContent":["import ActionBar from \"./ActionBar.vue\";\r\nimport type { App } from \"vue\";\r\n\r\nActionBar.install = function (app: App) {\r\n app.component(ActionBar.name!, ActionBar);\r\n return app;\r\n};\r\n\r\nexport { ActionBar };\r\nexport default ActionBar;\r\n"],"names":["ActionBar"],"mappings":";;;;AAGAA,SAAA,CAAU,OAAA,GAAU,SAAU,GAAA,EAAU;AACtC,EAAA,GAAA,CAAI,SAAA,CAAUA,SAAA,CAAU,IAAA,EAAOA,SAAS,CAAA;AACxC,EAAA,OAAO,GAAA;AACT,CAAA;;;;"}
|