sun-card-design 1.1.37 → 1.1.39

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.
Files changed (162) hide show
  1. package/README.md +114 -112
  2. package/dist/mobile/sun-card-design-mobile.es11.js +3 -3
  3. package/dist/mobile/sun-card-design-mobile.es3.js +4 -4
  4. package/dist/mobile/sun-card-design-mobile.es4.js +5 -5
  5. package/dist/mobile/sun-card-design-mobile.es56.js +3 -4
  6. package/dist/mobile/sun-card-design-mobile.es6.js +2 -10
  7. package/dist/pc/sun-card-design-pc.es11.js +3 -3
  8. package/dist/pc/sun-card-design-pc.es3.js +4 -4
  9. package/dist/pc/sun-card-design-pc.es4.js +5 -5
  10. package/dist/pc/sun-card-design-pc.es56.js +3 -4
  11. package/dist/pc/sun-card-design-pc.es6.js +2 -10
  12. package/dist/public/sun-card-design.css +1 -1
  13. package/package.json +98 -96
  14. package/dist/public/sun-card-designer.css +0 -1
  15. package/dist/sun-card-designer.es.js +0 -25
  16. package/dist/sun-card-designer.es10.js +0 -167
  17. package/dist/sun-card-designer.es11.js +0 -197
  18. package/dist/sun-card-designer.es12.js +0 -203
  19. package/dist/sun-card-designer.es13.js +0 -130
  20. package/dist/sun-card-designer.es14.js +0 -120
  21. package/dist/sun-card-designer.es151.js +0 -4
  22. package/dist/sun-card-designer.es152.js +0 -4
  23. package/dist/sun-card-designer.es153.js +0 -4
  24. package/dist/sun-card-designer.es154.js +0 -4
  25. package/dist/sun-card-designer.es155.js +0 -82
  26. package/dist/sun-card-designer.es156.js +0 -91
  27. package/dist/sun-card-designer.es157.js +0 -92
  28. package/dist/sun-card-designer.es158.js +0 -191
  29. package/dist/sun-card-designer.es159.js +0 -86
  30. package/dist/sun-card-designer.es16.js +0 -10
  31. package/dist/sun-card-designer.es160.js +0 -238
  32. package/dist/sun-card-designer.es161.js +0 -113
  33. package/dist/sun-card-designer.es162.js +0 -49
  34. package/dist/sun-card-designer.es163.js +0 -43
  35. package/dist/sun-card-designer.es164.js +0 -39
  36. package/dist/sun-card-designer.es165.js +0 -46
  37. package/dist/sun-card-designer.es166.js +0 -58
  38. package/dist/sun-card-designer.es167.js +0 -56
  39. package/dist/sun-card-designer.es168.js +0 -58
  40. package/dist/sun-card-designer.es169.js +0 -73
  41. package/dist/sun-card-designer.es17.js +0 -333
  42. package/dist/sun-card-designer.es170.js +0 -59
  43. package/dist/sun-card-designer.es171.js +0 -69
  44. package/dist/sun-card-designer.es172.js +0 -182
  45. package/dist/sun-card-designer.es173.js +0 -176
  46. package/dist/sun-card-designer.es174.js +0 -184
  47. package/dist/sun-card-designer.es175.js +0 -409
  48. package/dist/sun-card-designer.es176.js +0 -365
  49. package/dist/sun-card-designer.es177.js +0 -70
  50. package/dist/sun-card-designer.es178.js +0 -68
  51. package/dist/sun-card-designer.es179.js +0 -184
  52. package/dist/sun-card-designer.es18.js +0 -68
  53. package/dist/sun-card-designer.es180.js +0 -193
  54. package/dist/sun-card-designer.es181.js +0 -193
  55. package/dist/sun-card-designer.es182.js +0 -193
  56. package/dist/sun-card-designer.es184.js +0 -228
  57. package/dist/sun-card-designer.es185.js +0 -71
  58. package/dist/sun-card-designer.es19.js +0 -611
  59. package/dist/sun-card-designer.es196.js +0 -4
  60. package/dist/sun-card-designer.es20.js +0 -225
  61. package/dist/sun-card-designer.es201.js +0 -125
  62. package/dist/sun-card-designer.es21.js +0 -69
  63. package/dist/sun-card-designer.es22.js +0 -719
  64. package/dist/sun-card-designer.es220.js +0 -63
  65. package/dist/sun-card-designer.es221.js +0 -80
  66. package/dist/sun-card-designer.es222.js +0 -82
  67. package/dist/sun-card-designer.es223.js +0 -94
  68. package/dist/sun-card-designer.es224.js +0 -87
  69. package/dist/sun-card-designer.es225.js +0 -226
  70. package/dist/sun-card-designer.es226.js +0 -105
  71. package/dist/sun-card-designer.es227.js +0 -45
  72. package/dist/sun-card-designer.es228.js +0 -31
  73. package/dist/sun-card-designer.es229.js +0 -29
  74. package/dist/sun-card-designer.es23.js +0 -211
  75. package/dist/sun-card-designer.es230.js +0 -32
  76. package/dist/sun-card-designer.es231.js +0 -46
  77. package/dist/sun-card-designer.es232.js +0 -42
  78. package/dist/sun-card-designer.es233.js +0 -44
  79. package/dist/sun-card-designer.es234.js +0 -61
  80. package/dist/sun-card-designer.es235.js +0 -46
  81. package/dist/sun-card-designer.es236.js +0 -54
  82. package/dist/sun-card-designer.es237.js +0 -130
  83. package/dist/sun-card-designer.es238.js +0 -127
  84. package/dist/sun-card-designer.es239.js +0 -132
  85. package/dist/sun-card-designer.es24.js +0 -265
  86. package/dist/sun-card-designer.es240.js +0 -375
  87. package/dist/sun-card-designer.es241.js +0 -348
  88. package/dist/sun-card-designer.es242.js +0 -69
  89. package/dist/sun-card-designer.es243.js +0 -65
  90. package/dist/sun-card-designer.es244.js +0 -87
  91. package/dist/sun-card-designer.es245.js +0 -98
  92. package/dist/sun-card-designer.es246.js +0 -98
  93. package/dist/sun-card-designer.es247.js +0 -98
  94. package/dist/sun-card-designer.es25.js +0 -857
  95. package/dist/sun-card-designer.es26.js +0 -768
  96. package/dist/sun-card-designer.es260.js +0 -125
  97. package/dist/sun-card-designer.es27.js +0 -264
  98. package/dist/sun-card-designer.es273.js +0 -192
  99. package/dist/sun-card-designer.es28.js +0 -809
  100. package/dist/sun-card-designer.es29.js +0 -220
  101. package/dist/sun-card-designer.es3.js +0 -506
  102. package/dist/sun-card-designer.es30.js +0 -809
  103. package/dist/sun-card-designer.es31.js +0 -220
  104. package/dist/sun-card-designer.es32.js +0 -820
  105. package/dist/sun-card-designer.es33.js +0 -225
  106. package/dist/sun-card-designer.es34.js +0 -69
  107. package/dist/sun-card-designer.es35.js +0 -375
  108. package/dist/sun-card-designer.es36.js +0 -186
  109. package/dist/sun-card-designer.es37.js +0 -119
  110. package/dist/sun-card-designer.es38.js +0 -354
  111. package/dist/sun-card-designer.es39.js +0 -127
  112. package/dist/sun-card-designer.es4.js +0 -365
  113. package/dist/sun-card-designer.es40.js +0 -100
  114. package/dist/sun-card-designer.es41.js +0 -214
  115. package/dist/sun-card-designer.es42.js +0 -119
  116. package/dist/sun-card-designer.es43.js +0 -250
  117. package/dist/sun-card-designer.es44.js +0 -118
  118. package/dist/sun-card-designer.es45.js +0 -64
  119. package/dist/sun-card-designer.es46.js +0 -223
  120. package/dist/sun-card-designer.es47.js +0 -196
  121. package/dist/sun-card-designer.es48.js +0 -77
  122. package/dist/sun-card-designer.es49.js +0 -85
  123. package/dist/sun-card-designer.es5.js +0 -317
  124. package/dist/sun-card-designer.es50.js +0 -85
  125. package/dist/sun-card-designer.es51.js +0 -64
  126. package/dist/sun-card-designer.es52.js +0 -283
  127. package/dist/sun-card-designer.es53.js +0 -64
  128. package/dist/sun-card-designer.es54.js +0 -142
  129. package/dist/sun-card-designer.es55.js +0 -52
  130. package/dist/sun-card-designer.es56.js +0 -85
  131. package/dist/sun-card-designer.es57.js +0 -258
  132. package/dist/sun-card-designer.es58.js +0 -226
  133. package/dist/sun-card-designer.es59.js +0 -169
  134. package/dist/sun-card-designer.es6.js +0 -190
  135. package/dist/sun-card-designer.es60.js +0 -280
  136. package/dist/sun-card-designer.es61.js +0 -168
  137. package/dist/sun-card-designer.es62.js +0 -219
  138. package/dist/sun-card-designer.es63.js +0 -168
  139. package/dist/sun-card-designer.es64.js +0 -275
  140. package/dist/sun-card-designer.es65.js +0 -760
  141. package/dist/sun-card-designer.es66.js +0 -272
  142. package/dist/sun-card-designer.es67.js +0 -559
  143. package/dist/sun-card-designer.es68.js +0 -124
  144. package/dist/sun-card-designer.es69.js +0 -528
  145. package/dist/sun-card-designer.es7.js +0 -65
  146. package/dist/sun-card-designer.es70.js +0 -185
  147. package/dist/sun-card-designer.es71.js +0 -107
  148. package/dist/sun-card-designer.es72.js +0 -153
  149. package/dist/sun-card-designer.es73.js +0 -315
  150. package/dist/sun-card-designer.es74.js +0 -114
  151. package/dist/sun-card-designer.es76.js +0 -4211
  152. package/dist/sun-card-designer.es79.js +0 -4
  153. package/dist/sun-card-designer.es8.js +0 -171
  154. package/dist/sun-card-designer.es80.js +0 -4
  155. package/dist/sun-card-designer.es81.js +0 -4
  156. package/dist/sun-card-designer.es84.js +0 -228
  157. package/dist/sun-card-designer.es87.js +0 -52
  158. package/dist/sun-card-designer.es88.js +0 -52
  159. package/dist/sun-card-designer.es9.js +0 -207
  160. package/dist/sun-card-designer.es91.js +0 -344
  161. package/dist/sun-card-designer.es92.js +0 -199
  162. package/dist/sun-card-designer.es95.js +0 -180
@@ -1,63 +0,0 @@
1
- import { createElementBlock, openBlock, normalizeStyle, createCommentVNode, createElementVNode, toDisplayString, unref } from "vue";
2
- import { renderTextByVariables } from "./sun-card-designer.es185.js";
3
- /* empty css */
4
- import _export_sfc from "./sun-card-designer.es16.js";
5
- const _sfc_main = {
6
- __name: "titleComp",
7
- props: ["record", "columnsIndex"],
8
- setup(__props) {
9
- const props = __props;
10
- const formatPx = (value, fallback) => {
11
- const fallbackValue = typeof fallback === "number" ? `${fallback}px` : fallback;
12
- if (value === void 0 || value === null || value === "") return fallbackValue;
13
- if (typeof value === "number") return `${value}px`;
14
- if (typeof value === "string") {
15
- const trimmed = value.trim();
16
- if (!trimmed) return fallbackValue;
17
- if (/^-?\d+(\.\d+)?$/.test(trimmed)) return `${trimmed}px`;
18
- return trimmed;
19
- }
20
- return fallbackValue;
21
- };
22
- const getAlign = () => {
23
- const obj = {
24
- "left": "flex-start",
25
- "center": "center",
26
- "right": "flex-end"
27
- };
28
- return obj[props.record.options.style.align];
29
- };
30
- return (_ctx, _cache) => {
31
- return openBlock(), createElementBlock("div", {
32
- class: "main-title",
33
- style: normalizeStyle({ justifyContent: getAlign(), padding: `${props.record.options?.style?.tbPadding || 0}px ${props.record.options?.style?.lrPadding || 0}px` })
34
- }, [
35
- props.record.options.hasLine ? (openBlock(), createElementBlock("div", {
36
- key: 0,
37
- class: "line",
38
- style: normalizeStyle({
39
- background: props.record.options.hasLineStyle.background,
40
- width: formatPx(props.record.options.hasLineStyle?.width, 5),
41
- height: formatPx(
42
- props.record.options.hasLineStyle?.height,
43
- props.record.options.style.size ?? 16
44
- ),
45
- borderRadius: formatPx(props.record.options.hasLineStyle?.borderRadius, 1),
46
- marginRight: formatPx(props.record.options.hasLineStyle?.marginRight, 6)
47
- })
48
- }, null, 4)) : createCommentVNode("", true),
49
- createElementVNode("div", {
50
- style: normalizeStyle({
51
- fontWeight: "500",
52
- fontSize: props.record.options.style.size + "px",
53
- color: props.record.options.style.color
54
- })
55
- }, toDisplayString(unref(renderTextByVariables)(props.record.options.defaultValue, props.columnsIndex)), 5)
56
- ], 4);
57
- };
58
- }
59
- };
60
- const Title = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-79bf6de4"]]);
61
- export {
62
- Title as default
63
- };
@@ -1,80 +0,0 @@
1
- import { createElementBlock, openBlock, normalizeStyle, createCommentVNode, createElementVNode, createTextVNode, toDisplayString, unref } from "vue";
2
- import { renderTextByVariables } from "./sun-card-designer.es185.js";
3
- /* empty css */
4
- import _export_sfc from "./sun-card-designer.es16.js";
5
- const _hoisted_1 = {
6
- key: 0,
7
- style: { "font-weight": "600" }
8
- };
9
- const _sfc_main = {
10
- __name: "textComp",
11
- props: ["record", "columnsIndex"],
12
- emits: ["clickEvent"],
13
- setup(__props, { emit: __emit }) {
14
- const props = __props;
15
- const emit = __emit;
16
- const formatPx = (value, fallback) => {
17
- const fallbackValue = typeof fallback === "number" ? `${fallback}px` : fallback;
18
- if (value === void 0 || value === null || value === "") return fallbackValue;
19
- if (typeof value === "number") return `${value}px`;
20
- if (typeof value === "string") {
21
- const trimmed = value.trim();
22
- if (!trimmed) return fallbackValue;
23
- if (/^-?\d+(\.\d+)?$/.test(trimmed)) return `${trimmed}px`;
24
- return trimmed;
25
- }
26
- return fallbackValue;
27
- };
28
- const getAlign = () => {
29
- const obj = {
30
- "left": "flex-start",
31
- "center": "center",
32
- "right": "flex-end"
33
- };
34
- return obj[props.record.options.style.textAlign];
35
- };
36
- const onClick = () => {
37
- if (props.record.options.clickEvent) {
38
- emit("clickEvent", props.record);
39
- }
40
- };
41
- return (_ctx, _cache) => {
42
- return openBlock(), createElementBlock("div", {
43
- class: "main-text",
44
- style: normalizeStyle({ justifyContent: getAlign(), padding: `${props.record.options?.style?.tbPadding || 0}px ${props.record.options?.style?.lrPadding || 0}px` })
45
- }, [
46
- props.record.options.hasLine ? (openBlock(), createElementBlock("div", {
47
- key: 0,
48
- class: "line",
49
- style: normalizeStyle({
50
- background: props.record.options.hasLineStyle.background,
51
- width: formatPx(props.record.options.hasLineStyle?.width, 4),
52
- height: formatPx(
53
- props.record.options.hasLineStyle?.height,
54
- props.record.options.style.textSize || "14px"
55
- ),
56
- borderRadius: formatPx(props.record.options.hasLineStyle?.borderRadius, 2),
57
- marginRight: formatPx(props.record.options.hasLineStyle?.marginRight, 6)
58
- })
59
- }, null, 4)) : createCommentVNode("", true),
60
- createElementVNode("div", {
61
- style: normalizeStyle({
62
- color: props.record.options.style.textColor,
63
- fontSize: props.record.options.style.textSize,
64
- textAlign: props.record.options.style.textAlign,
65
- textDecoration: props.record.options.style.underline,
66
- textIndent: props.record.options.style.textIndent + "em"
67
- }),
68
- onClick
69
- }, [
70
- props.record.options.hasTitle ? (openBlock(), createElementBlock("span", _hoisted_1, toDisplayString(props.record.options.titleValue), 1)) : createCommentVNode("", true),
71
- createTextVNode(" " + toDisplayString(unref(renderTextByVariables)(props.record.options.defaultValue, props.columnsIndex)), 1)
72
- ], 4)
73
- ], 4);
74
- };
75
- }
76
- };
77
- const Text = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-22d09589"]]);
78
- export {
79
- Text as default
80
- };
@@ -1,82 +0,0 @@
1
- import { resolveComponent, createElementBlock, openBlock, normalizeStyle, createVNode, createSlots, withCtx, createTextVNode, toDisplayString, unref, createBlock, resolveDynamicComponent } from "vue";
2
- import { renderTextByVariables } from "./sun-card-designer.es185.js";
3
- import { EditOutlined, DeleteOutlined, CloseOutlined, CheckOutlined, ClearOutlined, DownloadOutlined, SearchOutlined } from "@ant-design/icons-vue";
4
- /* empty css */
5
- import _export_sfc from "./sun-card-designer.es16.js";
6
- const _sfc_main = {
7
- __name: "buttonComp",
8
- props: ["record", "columnsIndex"],
9
- emits: ["clickEvent"],
10
- setup(__props, { emit: __emit }) {
11
- const props = __props;
12
- const iconMap = {
13
- SearchOutlined,
14
- DownloadOutlined,
15
- ClearOutlined,
16
- CheckOutlined,
17
- CloseOutlined,
18
- DeleteOutlined,
19
- EditOutlined
20
- };
21
- const emit = __emit;
22
- const getWidth = () => {
23
- const obj = {
24
- auto: "auto",
25
- all: "100%",
26
- fixed: props.record.options.style.widthValue + "px"
27
- };
28
- return obj[props.record.options.style.widthType];
29
- };
30
- const getAlign = () => {
31
- const obj = {
32
- left: "flex-start",
33
- center: "center",
34
- right: "flex-end"
35
- };
36
- return obj[props.record.options.style.align];
37
- };
38
- const onClick = () => {
39
- emit("clickEvent", props.record);
40
- };
41
- return (_ctx, _cache) => {
42
- const _component_a_button = resolveComponent("a-button");
43
- return openBlock(), createElementBlock("div", {
44
- class: "main-button",
45
- style: normalizeStyle({
46
- justifyContent: getAlign(),
47
- padding: `${props.record.options?.style?.tbPadding || 0}px ${props.record.options?.style?.lrPadding || 0}px`
48
- })
49
- }, [
50
- createVNode(_component_a_button, {
51
- type: "primary",
52
- size: props.record.options.style.size,
53
- style: normalizeStyle({
54
- background: props.record.options.style.background,
55
- color: props.record.options.style.color,
56
- borderRadius: props.record.options.style.borderRadius + "px",
57
- width: getWidth(),
58
- float: props.record.options.style.align
59
- }),
60
- onClick
61
- }, createSlots({
62
- default: withCtx(() => [
63
- createTextVNode(" " + toDisplayString(unref(renderTextByVariables)(props.record.options.defaultValue, props.columnsIndex)), 1)
64
- ]),
65
- _: 2
66
- }, [
67
- props.record.options.style.iconName ? {
68
- name: "icon",
69
- fn: withCtx(() => [
70
- (openBlock(), createBlock(resolveDynamicComponent(iconMap[props.record.options.style.iconName])))
71
- ]),
72
- key: "0"
73
- } : void 0
74
- ]), 1032, ["size", "style"])
75
- ], 4);
76
- };
77
- }
78
- };
79
- const Button = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-a265d74a"]]);
80
- export {
81
- Button as default
82
- };
@@ -1,94 +0,0 @@
1
- import { resolveComponent, createElementBlock, openBlock, normalizeStyle, createVNode, withCtx, Fragment, renderList, createBlock, createElementVNode } from "vue";
2
- import FormItem from "./sun-card-designer.es184.js";
3
- /* empty css */
4
- import _export_sfc from "./sun-card-designer.es16.js";
5
- const _hoisted_1 = ["onClick"];
6
- const _sfc_main = {
7
- __name: "gridComp",
8
- props: ["record", "recordData", "columnsIndex"],
9
- emits: ["clickEvent", "clickColumnsEvent", "fileUpdateEvent"],
10
- setup(__props, { emit: __emit }) {
11
- const props = __props;
12
- const emit = __emit;
13
- const getIndex = (index) => {
14
- if (index !== void 0) {
15
- return index;
16
- }
17
- return props.columnsIndex;
18
- };
19
- const onClick = (record) => {
20
- emit("clickEvent", record);
21
- };
22
- const onUpdate = (record) => {
23
- emit("fileUpdateEvent", record);
24
- };
25
- const onClickColumns = (record) => {
26
- if (!record.options.clickEvent) return;
27
- emit("clickColumnsEvent", record);
28
- };
29
- const getBackground = () => {
30
- if (isGradientColor(props.recordData.config.background)) {
31
- return "none";
32
- }
33
- return props.recordData.config.background;
34
- };
35
- function isGradientColor(color) {
36
- return /^(linear|radial)-gradient\(.*\)$/.test(color);
37
- }
38
- return (_ctx, _cache) => {
39
- const _component_a_col = resolveComponent("a-col");
40
- const _component_a_row = resolveComponent("a-row");
41
- return openBlock(), createElementBlock("div", {
42
- class: "main-grid",
43
- style: normalizeStyle({ background: getBackground() })
44
- }, [
45
- createVNode(_component_a_row, {
46
- gutter: [props.record.options.style.lrGutter, props.record.options.style.tbGutter]
47
- }, {
48
- default: withCtx(() => [
49
- (openBlock(true), createElementBlock(Fragment, null, renderList(props.record.columns, (item, index) => {
50
- return openBlock(), createBlock(_component_a_col, {
51
- key: index.toString(),
52
- flex: props.record.columns[index].flex,
53
- span: props.record.options.mode === "auto" ? 24 / props.record.options.autoNumber : 24,
54
- style: normalizeStyle({ flex: props.record.options.mode === "vertical" ? props.record.columns[index].flex : _ctx.none })
55
- }, {
56
- default: withCtx(() => [
57
- createElementVNode("div", {
58
- class: "box",
59
- style: normalizeStyle({
60
- background: props.record.options.style.background,
61
- border: props.record.options.style?.borderColor === "none" ? "none" : "1px solid " + (props.record.options.style?.borderColor || "transparent"),
62
- borderRadius: props.record.options.style.borderRadius + "px",
63
- padding: props.record.options.style.tbPadding + "px " + props.record.options.style.lrPadding + "px",
64
- justifyContent: props.record.options.style?.alignItems || "start",
65
- minHeight: props.record.options.style?.minHeight + "px" || "48px",
66
- boxShadow: props.record.options.style?.boxShadow || null
67
- }),
68
- onClick: ($event) => onClickColumns(item)
69
- }, [
70
- (openBlock(true), createElementBlock(Fragment, null, renderList(item.list, (element, index2) => {
71
- return openBlock(), createBlock(FormItem, {
72
- record: element,
73
- key: index2,
74
- columnsIndex: getIndex(item.index),
75
- onClickEvent: onClick,
76
- onFileUpdateEvent: onUpdate
77
- }, null, 8, ["record", "columnsIndex"]);
78
- }), 128))
79
- ], 12, _hoisted_1)
80
- ]),
81
- _: 2
82
- }, 1032, ["flex", "span", "style"]);
83
- }), 128))
84
- ]),
85
- _: 1
86
- }, 8, ["gutter"])
87
- ], 4);
88
- };
89
- }
90
- };
91
- const Grid = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-812d703d"]]);
92
- export {
93
- Grid as default
94
- };
@@ -1,87 +0,0 @@
1
- import { resolveComponent, createElementBlock, openBlock, normalizeStyle, createElementVNode, createCommentVNode, unref, normalizeClass, toDisplayString, createVNode, withCtx, createTextVNode } from "vue";
2
- import { fileIconSvg } from "./sun-card-designer.es6.js";
3
- import { renderTextByVariables } from "./sun-card-designer.es185.js";
4
- /* empty css */
5
- import _export_sfc from "./sun-card-designer.es16.js";
6
- const _hoisted_1 = ["innerHTML"];
7
- const _sfc_main = {
8
- __name: "fileComp",
9
- props: ["record", "columnsIndex"],
10
- emits: ["clickEvent", "fileUpdateEvent"],
11
- setup(__props, { emit: __emit }) {
12
- const props = __props;
13
- const emit = __emit;
14
- const onClick = () => {
15
- emit("clickEvent", props.record);
16
- };
17
- const onUpdate = () => {
18
- emit("fileUpdateEvent", props.record);
19
- };
20
- const toPx = (v) => typeof v === "number" ? `${v}px` : v || void 0;
21
- const colorSafe = (v) => v && typeof v === "string" ? v : "#000000";
22
- return (_ctx, _cache) => {
23
- const _component_a_button = resolveComponent("a-button");
24
- return openBlock(), createElementBlock("div", {
25
- class: "main-title",
26
- style: normalizeStyle({ padding: `${props.record.options?.style?.tbPadding || 2}px ${props.record.options?.style?.lrPadding || 2}px` })
27
- }, [
28
- createElementVNode("div", null, [
29
- createElementVNode("div", {
30
- class: "file-box",
31
- onClick
32
- }, [
33
- createElementVNode("div", {
34
- class: normalizeClass(["file-icon", { "align-center": !props.record.options.subtitle }]),
35
- style: normalizeStyle({ color: colorSafe(props.record.options.style.iconColor) }),
36
- innerHTML: unref(fileIconSvg)()
37
- }, null, 14, _hoisted_1),
38
- createElementVNode("div", {
39
- class: normalizeClass(["name", { "align-center": !props.record.options.subtitle }]),
40
- style: normalizeStyle({
41
- fontSize: toPx(props.record.options.style.nameSize),
42
- fontWeight: props.record.options.style.nameWeight,
43
- color: colorSafe(props.record.options.style.nameColor)
44
- })
45
- }, toDisplayString(unref(renderTextByVariables)(props.record.options.defaultValue, props.columnsIndex)), 7),
46
- props.record.options.subtitle ? (openBlock(), createElementBlock("div", {
47
- key: 0,
48
- class: "subtitle",
49
- style: normalizeStyle({
50
- fontSize: toPx(props.record.options.style.subtitleSize),
51
- color: colorSafe(props.record.options.style.subtitleColor)
52
- })
53
- }, toDisplayString(unref(renderTextByVariables)(props.record.options.subtitle, props.columnsIndex)), 5)) : createCommentVNode("", true)
54
- ]),
55
- createElementVNode("div", {
56
- class: "content",
57
- style: normalizeStyle({
58
- fontSize: toPx(props.record.options.style.contentSize),
59
- marginTop: "6px",
60
- marginLeft: "6px",
61
- color: colorSafe(props.record.options.style.contentColor)
62
- })
63
- }, toDisplayString(unref(renderTextByVariables)(props.record.options.content, props.columnsIndex)), 5),
64
- props.record.options?.isUpdate ? (openBlock(), createElementBlock("div", {
65
- key: 0,
66
- style: { "margin-top": "8px" },
67
- onClick: onUpdate
68
- }, [
69
- createVNode(_component_a_button, {
70
- type: "primary",
71
- size: "small"
72
- }, {
73
- default: withCtx(() => [
74
- createTextVNode(toDisplayString(props.record.options.updateText), 1)
75
- ]),
76
- _: 1
77
- })
78
- ])) : createCommentVNode("", true)
79
- ])
80
- ], 4);
81
- };
82
- }
83
- };
84
- const File = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-42f0f48a"]]);
85
- export {
86
- File as default
87
- };
@@ -1,226 +0,0 @@
1
- import { ref, computed, resolveComponent, createElementBlock, openBlock, normalizeStyle, createCommentVNode, createVNode, createElementVNode, withModifiers, withCtx, createTextVNode, h, unref, toDisplayString, Fragment, renderList } from "vue";
2
- import { UploadOutlined } from "@ant-design/icons-vue";
3
- import { message } from "ant-design-vue";
4
- /* empty css */
5
- import _export_sfc from "./sun-card-designer.es16.js";
6
- const _hoisted_1 = {
7
- key: 0,
8
- class: "upload-progress"
9
- };
10
- const _hoisted_2 = { class: "progress-text-container" };
11
- const _hoisted_3 = {
12
- key: 1,
13
- class: "file-list"
14
- };
15
- const _hoisted_4 = { class: "file-item-name" };
16
- const _sfc_main = {
17
- __name: "uploadComp",
18
- props: ["record"],
19
- setup(__props) {
20
- const props = __props;
21
- const fileList = ref([]);
22
- const uploadControllers = ref(/* @__PURE__ */ new Map());
23
- const currentUploadingUid = ref(null);
24
- const isUploading = computed(() => !!currentUploadingUid.value);
25
- const buttonColor = computed(() => {
26
- return props.record.options?.style?.buttonColor;
27
- });
28
- const buttonSize = computed(() => {
29
- return props.record.options?.style?.buttonSize;
30
- });
31
- const acceptTypes = computed(() => {
32
- if (!props.record.options?.format || !Array.isArray(props.record.options.format) || props.record.options.format.length === 0) {
33
- return "";
34
- }
35
- const formatMap = {
36
- pdf: ".pdf",
37
- word: ".doc,.docx",
38
- excle: ".xls,.xlsx",
39
- txt: ".txt",
40
- ppt: ".ppt,.pptx"
41
- };
42
- return props.record.options.format.map((format) => formatMap[format] || `.${format}`).join(",");
43
- });
44
- const beforeUpload = (file) => {
45
- const isValidType = checkFileType(file);
46
- if (!isValidType) {
47
- const allowedFormats = props.record.options?.format || [];
48
- const formatNames = {
49
- pdf: "PDF",
50
- word: "Word",
51
- excle: "Excel",
52
- txt: "TXT",
53
- ppt: "PPT"
54
- };
55
- const formatText = allowedFormats.map((f) => formatNames[f] || f.toUpperCase()).join("、");
56
- if (formatText) {
57
- message.error(`只支持 ${formatText} 格式的文件`);
58
- } else {
59
- message.error("请先配置允许的文件格式");
60
- }
61
- return false;
62
- }
63
- return true;
64
- };
65
- const checkFileType = (file) => {
66
- if (!props.record.options?.format || !Array.isArray(props.record.options.format) || props.record.options.format.length === 0) {
67
- return false;
68
- }
69
- const fileName = (file.name || file.fileName || "").toLowerCase();
70
- if (!fileName) {
71
- return false;
72
- }
73
- const allowedFormats = props.record.options.format;
74
- const formatExtensions = {
75
- pdf: [".pdf"],
76
- word: [".doc", ".docx"],
77
- excle: [".xls", ".xlsx"],
78
- txt: [".txt"],
79
- ppt: [".ppt", ".pptx"]
80
- };
81
- const allowedExtensions = allowedFormats.reduce((exts, format) => {
82
- if (formatExtensions[format]) {
83
- exts.push(...formatExtensions[format]);
84
- }
85
- return exts;
86
- }, []);
87
- if (allowedExtensions.length === 0) {
88
- return false;
89
- }
90
- const isValid = allowedExtensions.some((ext) => fileName.endsWith(ext));
91
- console.log("文件类型检查:", {
92
- fileName,
93
- allowedFormats,
94
- allowedExtensions,
95
- isValid
96
- });
97
- return isValid;
98
- };
99
- const customRequest = (options) => {
100
- const { file, onSuccess, onProgress } = options;
101
- ({ uid: file.uid, name: file.name });
102
- currentUploadingUid.value = file.uid;
103
- let progress = 0;
104
- const timer = setInterval(() => {
105
- progress = Math.min(progress + 8 + Math.random() * 6, 99);
106
- onProgress({ percent: progress });
107
- }, 200);
108
- const doneTimer = setTimeout(() => {
109
- clearInterval(timer);
110
- uploadControllers.value.delete(file.uid);
111
- fileList.value.push({ uid: file.uid, name: file.name });
112
- message.success("上传成功");
113
- onSuccess({ url: URL.createObjectURL(file), name: file.name });
114
- if (currentUploadingUid.value === file.uid) currentUploadingUid.value = null;
115
- }, 2e3);
116
- uploadControllers.value.set(file.uid, { timer, doneTimer });
117
- };
118
- const onCancelUpload = () => {
119
- const uid = currentUploadingUid.value;
120
- if (!uid) return;
121
- const ctrl = uploadControllers.value.get(uid);
122
- if (ctrl) {
123
- if (ctrl.timer) clearInterval(ctrl.timer);
124
- if (ctrl.doneTimer) clearTimeout(ctrl.doneTimer);
125
- uploadControllers.value.delete(uid);
126
- }
127
- const item = fileList.value.find((f) => f.uid === uid);
128
- if (item) {
129
- item.status = "cancelled";
130
- item.percent = 0;
131
- }
132
- currentUploadingUid.value = null;
133
- message.info("已取消上传");
134
- };
135
- const removeFile = (uid) => {
136
- const item = fileList.value.find((f) => f.uid === uid);
137
- if (item && item.status === "uploading") {
138
- currentUploadingUid.value = uid;
139
- onCancelUpload();
140
- }
141
- fileList.value = fileList.value.filter((f) => f.uid !== uid);
142
- };
143
- return (_ctx, _cache) => {
144
- const _component_a_button = resolveComponent("a-button");
145
- const _component_a_upload = resolveComponent("a-upload");
146
- return openBlock(), createElementBlock("div", {
147
- class: "upload-comp",
148
- style: normalizeStyle({ padding: `${props.record.options?.style?.tbPadding || 0}px ${props.record.options?.style?.lrPadding || 0}px` })
149
- }, [
150
- isUploading.value ? (openBlock(), createElementBlock("div", _hoisted_1, [
151
- _cache[2] || (_cache[2] = createElementVNode("div", { class: "spinner" }, null, -1)),
152
- createElementVNode("div", _hoisted_2, [
153
- _cache[1] || (_cache[1] = createElementVNode("div", { class: "progress-text" }, "文件导入中...", -1)),
154
- createVNode(_component_a_button, {
155
- class: "cancel-btn",
156
- onClick: withModifiers(onCancelUpload, ["stop"]),
157
- size: "small"
158
- }, {
159
- default: withCtx(() => [..._cache[0] || (_cache[0] = [
160
- createTextVNode("取消", -1)
161
- ])]),
162
- _: 1
163
- })
164
- ])
165
- ])) : createCommentVNode("", true),
166
- createVNode(_component_a_upload, {
167
- accept: acceptTypes.value,
168
- multiple: true,
169
- "before-upload": beforeUpload,
170
- "custom-request": customRequest,
171
- "show-upload-list": false,
172
- disabled: false
173
- }, {
174
- default: withCtx(() => [
175
- createVNode(_component_a_button, {
176
- type: "primary",
177
- style: normalizeStyle({
178
- backgroundColor: buttonColor.value,
179
- borderColor: buttonColor.value,
180
- fontSize: buttonSize.value + "px",
181
- height: "auto",
182
- padding: "4px 12px",
183
- minHeight: "28px"
184
- }),
185
- icon: h(unref(UploadOutlined))
186
- }, {
187
- icon: withCtx(() => [
188
- createVNode(unref(UploadOutlined))
189
- ]),
190
- default: withCtx(() => [
191
- createTextVNode(" " + toDisplayString(props.record.options?.style?.buttonText), 1)
192
- ]),
193
- _: 1
194
- }, 8, ["style", "icon"])
195
- ]),
196
- _: 1
197
- }, 8, ["accept"]),
198
- fileList.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_3, [
199
- (openBlock(true), createElementBlock(Fragment, null, renderList(fileList.value, (file) => {
200
- return openBlock(), createElementBlock("div", {
201
- class: "file-item",
202
- key: file.uid
203
- }, [
204
- createElementVNode("span", _hoisted_4, toDisplayString(file.name), 1),
205
- createVNode(_component_a_button, {
206
- type: "link",
207
- danger: "",
208
- size: "small",
209
- onClick: withModifiers(($event) => removeFile(file.uid), ["stop"])
210
- }, {
211
- default: withCtx(() => [..._cache[3] || (_cache[3] = [
212
- createTextVNode("删除", -1)
213
- ])]),
214
- _: 1
215
- }, 8, ["onClick"])
216
- ]);
217
- }), 128))
218
- ])) : createCommentVNode("", true)
219
- ], 4);
220
- };
221
- }
222
- };
223
- const Upload = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-4363e2fe"]]);
224
- export {
225
- Upload as default
226
- };