jky-component-lib 0.0.98 → 0.0.99

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 (53) hide show
  1. package/dist/es/add-input/style.css +1 -1
  2. package/dist/es/amap/ATrackPlayback.vue.d.ts +69 -0
  3. package/dist/es/amap/ATrackPlayback.vue.js +237 -0
  4. package/dist/es/amap/ATrackPlayback.vue3.js +5 -0
  5. package/dist/es/amap/index.d.ts +3 -1
  6. package/dist/es/amap/index.js +5 -0
  7. package/dist/es/amap/style.css +2 -13
  8. package/dist/es/amap/style3.css +14 -0
  9. package/dist/es/components.js +4 -1
  10. package/dist/es/form/Form.vue.d.ts +3 -3
  11. package/dist/es/form/Form.vue.js +88 -155
  12. package/dist/es/form/FormItem.vue.js +3 -1
  13. package/dist/es/form/SelectTable.vue.js +14 -5
  14. package/dist/es/form/style.css +1 -21
  15. package/dist/es/index.js +7 -2
  16. package/dist/es/package.json.js +1 -1
  17. package/dist/es/page-table/ActionColumn.vue.d.ts +11 -0
  18. package/dist/es/page-table/ActionColumn.vue.js +137 -0
  19. package/dist/es/page-table/ActionColumn.vue3.js +5 -0
  20. package/dist/es/page-table/PageTable.vue.d.ts +35 -26
  21. package/dist/es/page-table/PageTable.vue.js +84 -33
  22. package/dist/es/page-table/index.d.ts +3 -1
  23. package/dist/es/page-table/index.js +4 -0
  24. package/dist/es/page-table/style.css +9 -0
  25. package/dist/es/style.css +88 -0
  26. package/dist/es/styles.css +1 -1
  27. package/dist/lib/add-input/style.css +1 -1
  28. package/dist/lib/amap/ATrackPlayback.vue.d.ts +69 -0
  29. package/dist/lib/amap/ATrackPlayback.vue.js +237 -0
  30. package/dist/lib/amap/ATrackPlayback.vue3.js +5 -0
  31. package/dist/lib/amap/index.d.ts +3 -1
  32. package/dist/lib/amap/index.js +5 -0
  33. package/dist/lib/amap/style.css +2 -13
  34. package/dist/lib/amap/style3.css +14 -0
  35. package/dist/lib/components.js +32 -30
  36. package/dist/lib/form/Form.vue.d.ts +3 -3
  37. package/dist/lib/form/Form.vue.js +86 -153
  38. package/dist/lib/form/FormItem.vue.js +3 -1
  39. package/dist/lib/form/SelectTable.vue.js +13 -4
  40. package/dist/lib/form/style.css +1 -21
  41. package/dist/lib/index.js +25 -20
  42. package/dist/lib/package.json.js +1 -1
  43. package/dist/lib/page-table/ActionColumn.vue.d.ts +11 -0
  44. package/dist/lib/page-table/ActionColumn.vue.js +137 -0
  45. package/dist/lib/page-table/ActionColumn.vue3.js +5 -0
  46. package/dist/lib/page-table/PageTable.vue.d.ts +35 -26
  47. package/dist/lib/page-table/PageTable.vue.js +83 -32
  48. package/dist/lib/page-table/index.d.ts +3 -1
  49. package/dist/lib/page-table/index.js +4 -0
  50. package/dist/lib/page-table/style.css +9 -0
  51. package/dist/lib/style.css +88 -0
  52. package/dist/lib/styles.css +1 -1
  53. package/package.json +1 -1
@@ -17,18 +17,6 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
- var __objRest = (source, exclude) => {
21
- var target = {};
22
- for (var prop in source)
23
- if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
24
- target[prop] = source[prop];
25
- if (source != null && __getOwnPropSymbols)
26
- for (var prop of __getOwnPropSymbols(source)) {
27
- if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
28
- target[prop] = source[prop];
29
- }
30
- return target;
31
- };
32
20
  var __async = (__this, __arguments, generator) => {
33
21
  return new Promise((resolve, reject) => {
34
22
  var fulfilled = (value) => {
@@ -49,14 +37,10 @@ var __async = (__this, __arguments, generator) => {
49
37
  step((generator = generator.apply(__this, __arguments)).next());
50
38
  });
51
39
  };
52
- import { defineComponent, useModel, provide, ref, useAttrs, computed, watch, openBlock, createElementBlock, normalizeClass, toDisplayString, createCommentVNode, createVNode, unref, mergeProps, withCtx, Fragment, renderList, createBlock, createElementVNode, createTextVNode, mergeModels } from "vue";
53
- import { ElForm, ElFormItem, ElButton } from "element-plus";
40
+ import { defineComponent, useModel, provide, ref, computed, watch, resolveComponent, openBlock, createBlock, unref, normalizeStyle, normalizeClass, withCtx, createElementBlock, Fragment, renderList, createElementVNode, createTextVNode, toDisplayString, createCommentVNode, createVNode, mergeModels } from "vue";
41
+ import { ElForm } from "element-plus";
54
42
  import _sfc_main$1 from "./FormItem.vue.js";
55
43
  /* empty css */
56
- const _hoisted_1 = {
57
- key: 0,
58
- class: "jky-form__title mb-4 text-xl font-semibold"
59
- };
60
44
  const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
61
45
  name: "JkyForm",
62
46
  inheritAttrs: false
@@ -65,7 +49,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
65
49
  props: /* @__PURE__ */ mergeModels({
66
50
  modelValue: {},
67
51
  items: {},
68
- showTitle: { type: Boolean, default: false },
52
+ showTitle: { type: Boolean },
69
53
  title: {},
70
54
  gutter: { default: 0 },
71
55
  defaultSpan: { default: 24 },
@@ -73,14 +57,14 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
73
57
  grid: { type: [Boolean, Object], default: false },
74
58
  className: {},
75
59
  readonly: { type: Boolean },
76
- disabled: { type: Boolean },
60
+ disabled: { type: Boolean, default: false },
77
61
  watchDeep: { type: Boolean, default: true },
78
62
  showFooter: { type: Boolean, default: true },
79
63
  footerClass: { default: "" },
80
64
  submitText: { default: "提交" },
81
65
  cancelText: { default: "取消" },
82
- submitDisabled: { type: Boolean },
83
- cancelDisabled: { type: Boolean },
66
+ submitDisabled: { type: Boolean, default: false },
67
+ cancelDisabled: { type: Boolean, default: false },
84
68
  showCount: { default: 999 },
85
69
  onValidate: {},
86
70
  onSubmit: {},
@@ -111,50 +95,22 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
111
95
  const modelValue = useModel(__props, "modelValue");
112
96
  provide("formModel", modelValue);
113
97
  const formRef = ref();
114
- const attrs = useAttrs();
115
- const JKY_FORM_PROPS = [
116
- "modelValue",
117
- "items",
118
- "showTitle",
119
- "title",
120
- "gutter",
121
- "defaultSpan",
122
- "responsive",
123
- "readonly",
124
- "disabled",
125
- "watchDeep",
126
- "showFooter",
127
- "footerClass",
128
- "submitText",
129
- "cancelText",
130
- "submitDisabled",
131
- "cancelDisabled",
132
- "onValidate",
133
- "onSubmit",
134
- "onReset",
135
- "grid",
136
- "showCount"
137
- ];
138
- const elFormProps = computed(() => {
139
- const formProps = Object.fromEntries(
140
- Object.entries(props).filter(([key]) => !JKY_FORM_PROPS.includes(key))
141
- );
142
- const _a = attrs, { class: _, style } = _a, restAttrs = __objRest(_a, ["class", "style"]);
143
- return __spreadValues(__spreadValues({ class: props.className || attrs.className || "" }, formProps), restAttrs);
144
- });
145
- const formClass = computed(() => {
146
- return [
147
- "jky-form",
148
- attrs.class
149
- ].filter(Boolean).join(" ");
150
- });
151
- const _elFormClass = computed(() => {
152
- const classes = [];
153
- if (props.inline && props.grid) {
154
- classes.push("jky-form--grid");
98
+ const showAllItems = ref(false);
99
+ const _visibleItems = computed(() => {
100
+ if (!props.items || props.items.length <= props.showCount) {
101
+ return props.items;
102
+ }
103
+ if (showAllItems.value) {
104
+ return props.items;
155
105
  }
156
- return [...classes, props.className || attrs.className || ""];
106
+ return props.items.slice(0, props.showCount);
157
107
  });
108
+ const _showMoreButton = computed(() => {
109
+ return props.items && props.items.length > props.showCount;
110
+ });
111
+ function toggleShowMore() {
112
+ showAllItems.value = !showAllItems.value;
113
+ }
158
114
  const _gridStyle = computed(() => {
159
115
  if (!props.inline || !props.grid || typeof props.grid === "boolean") {
160
116
  return {};
@@ -169,22 +125,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
169
125
  });
170
126
  return style;
171
127
  });
172
- const showAllItems = ref(false);
173
- const visibleItems = computed(() => {
174
- if (!props.items || props.items.length <= props.showCount) {
175
- return props.items;
176
- }
177
- if (showAllItems.value) {
178
- return props.items;
179
- }
180
- return props.items.slice(0, props.showCount);
181
- });
182
- const showMoreButton = computed(() => {
183
- return props.items && props.items.length > props.showCount;
184
- });
185
- function toggleShowMore() {
186
- showAllItems.value = !showAllItems.value;
187
- }
188
128
  watch(
189
129
  () => props.modelValue,
190
130
  (newVal, oldVal) => {
@@ -209,12 +149,6 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
209
149
  }
210
150
  });
211
151
  }
212
- function resetFields() {
213
- var _a, _b;
214
- (_a = formRef.value) == null ? void 0 : _a.resetFields();
215
- emit("reset");
216
- (_b = props.onReset) == null ? void 0 : _b.call(props);
217
- }
218
152
  function clearValidate(props2) {
219
153
  var _a;
220
154
  (_a = formRef.value) == null ? void 0 : _a.clearValidate(props2);
@@ -224,11 +158,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
224
158
  }
225
159
  function handleSubmit() {
226
160
  return __async(this, null, function* () {
227
- var _a, _b;
161
+ var _a;
228
162
  try {
229
163
  yield (_a = formRef.value) == null ? void 0 : _a.validate();
230
164
  emit("submit", __spreadValues({}, modelValue.value));
231
- (_b = props.onSubmit) == null ? void 0 : _b.call(props, __spreadValues({}, modelValue.value));
232
165
  } catch (error) {
233
166
  emit("validate", { valid: false, fields: error.fields });
234
167
  }
@@ -237,85 +170,85 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
237
170
  function handleCancel() {
238
171
  resetFields();
239
172
  }
173
+ function resetFields() {
174
+ var _a;
175
+ (_a = formRef.value) == null ? void 0 : _a.resetFields();
176
+ emit("reset");
177
+ }
240
178
  __expose({
241
179
  validate,
242
- resetFields,
243
180
  clearValidate,
244
181
  getFormInstance,
245
182
  formRef
246
183
  });
247
184
  return (_ctx, _cache) => {
248
- return openBlock(), createElementBlock("div", {
249
- class: normalizeClass(formClass.value)
250
- }, [
251
- __props.showTitle && __props.title ? (openBlock(), createElementBlock("div", _hoisted_1, toDisplayString(__props.title), 1)) : createCommentVNode("", true),
252
- createVNode(unref(ElForm), mergeProps({
253
- ref_key: "formRef",
254
- ref: formRef
255
- }, elFormProps.value, {
256
- model: modelValue.value,
257
- class: _elFormClass.value,
258
- style: _gridStyle.value
259
- }), {
260
- default: withCtx(() => [
261
- (openBlock(true), createElementBlock(Fragment, null, renderList(visibleItems.value, (item) => {
262
- return openBlock(), createBlock(_sfc_main$1, {
263
- key: item.field,
264
- field: item.field,
265
- config: item,
266
- model: modelValue.value,
267
- readonly: __props.readonly,
268
- disabled: __props.disabled
269
- }, null, 8, ["field", "config", "model", "readonly", "disabled"]);
270
- }), 128)),
271
- showMoreButton.value || props.showFooter ? (openBlock(), createBlock(unref(ElFormItem), {
272
- key: 0,
273
- "label-width": 0
274
- }, {
275
- default: withCtx(() => [
276
- createElementVNode("div", {
277
- class: normalizeClass(["w-full flex gap-2", [props.grid && props.inline ? "justify-center" : "justify-end", props.footerClass]])
278
- }, [
279
- showMoreButton.value ? (openBlock(), createBlock(unref(ElButton), {
280
- key: 0,
185
+ const _component_ElButton = resolveComponent("ElButton");
186
+ const _component_ElFormItem = resolveComponent("ElFormItem");
187
+ return openBlock(), createBlock(unref(ElForm), {
188
+ ref_key: "formRef",
189
+ ref: formRef,
190
+ class: normalizeClass(["jky-form", [__props.inline && "jky-form--inline", __props.grid && "jky-form--grid"]]),
191
+ model: modelValue.value,
192
+ style: normalizeStyle(_gridStyle.value)
193
+ }, {
194
+ default: withCtx(() => [
195
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_visibleItems.value, (item) => {
196
+ return openBlock(), createBlock(_sfc_main$1, {
197
+ key: item.field,
198
+ field: item.field,
199
+ config: item,
200
+ model: modelValue.value,
201
+ readonly: __props.readonly,
202
+ disabled: __props.disabled
203
+ }, null, 8, ["field", "config", "model", "readonly", "disabled"]);
204
+ }), 128)),
205
+ _showMoreButton.value || props.showFooter ? (openBlock(), createBlock(_component_ElFormItem, {
206
+ key: 0,
207
+ "label-width": 0
208
+ }, {
209
+ default: withCtx(() => [
210
+ createElementVNode("div", {
211
+ class: normalizeClass(["w-full flex gap-2", [props.grid && props.inline ? "justify-center" : "justify-end", props.footerClass]])
212
+ }, [
213
+ _showMoreButton.value ? (openBlock(), createBlock(_component_ElButton, {
214
+ key: 0,
215
+ type: "primary",
216
+ onClick: toggleShowMore
217
+ }, {
218
+ default: withCtx(() => [
219
+ createTextVNode(toDisplayString(showAllItems.value ? "收起" : `展开 (${props.items.length - props.showCount})`), 1)
220
+ ]),
221
+ _: 1
222
+ })) : createCommentVNode("", true),
223
+ props.showFooter ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
224
+ createVNode(_component_ElButton, {
225
+ disabled: __props.cancelDisabled || __props.disabled,
226
+ onClick: handleCancel
227
+ }, {
228
+ default: withCtx(() => [
229
+ createTextVNode(toDisplayString(__props.cancelText), 1)
230
+ ]),
231
+ _: 1
232
+ }, 8, ["disabled"]),
233
+ createVNode(_component_ElButton, {
281
234
  type: "primary",
282
- onClick: toggleShowMore
235
+ disabled: __props.submitDisabled || __props.disabled,
236
+ loading: false,
237
+ onClick: handleSubmit
283
238
  }, {
284
239
  default: withCtx(() => [
285
- createTextVNode(toDisplayString(showAllItems.value ? "收起" : `展开 (${props.items.length - props.showCount})`), 1)
240
+ createTextVNode(toDisplayString(__props.submitText), 1)
286
241
  ]),
287
242
  _: 1
288
- })) : createCommentVNode("", true),
289
- props.showFooter ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
290
- createVNode(unref(ElButton), {
291
- disabled: __props.cancelDisabled || __props.disabled,
292
- onClick: handleCancel
293
- }, {
294
- default: withCtx(() => [
295
- createTextVNode(toDisplayString(__props.cancelText), 1)
296
- ]),
297
- _: 1
298
- }, 8, ["disabled"]),
299
- createVNode(unref(ElButton), {
300
- type: "primary",
301
- disabled: __props.submitDisabled || __props.disabled,
302
- loading: false,
303
- onClick: handleSubmit
304
- }, {
305
- default: withCtx(() => [
306
- createTextVNode(toDisplayString(__props.submitText), 1)
307
- ]),
308
- _: 1
309
- }, 8, ["disabled"])
310
- ], 64)) : createCommentVNode("", true)
311
- ], 2)
312
- ]),
313
- _: 1
314
- })) : createCommentVNode("", true)
315
- ]),
316
- _: 1
317
- }, 16, ["model", "class", "style"])
318
- ], 2);
243
+ }, 8, ["disabled"])
244
+ ], 64)) : createCommentVNode("", true)
245
+ ], 2)
246
+ ]),
247
+ _: 1
248
+ })) : createCommentVNode("", true)
249
+ ]),
250
+ _: 1
251
+ }, 8, ["class", "model", "style"]);
319
252
  };
320
253
  }
321
254
  }));
@@ -366,7 +366,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
366
366
  }
367
367
  // 表格选择器
368
368
  case "select-table":
369
- return h(_sfc_main$1, __spreadValues(__spreadValues({}, commonProps), componentProps.value));
369
+ return h(_sfc_main$1, __spreadProps(__spreadValues(__spreadValues({}, commonProps), componentProps.value), {
370
+ labelWidth: formItemProps.value.labelWidth
371
+ }));
370
372
  case "rate":
371
373
  return h(ElRate, __spreadValues(__spreadValues({}, commonProps), componentProps.value));
372
374
  case "input-number": {
@@ -37,12 +37,11 @@ var __async = (__this, __arguments, generator) => {
37
37
  step((generator = generator.apply(__this, __arguments)).next());
38
38
  });
39
39
  };
40
- import { defineComponent, ref, computed, watch, openBlock, createElementBlock, createElementVNode, Fragment, renderList, createBlock, unref, withCtx, createTextVNode, toDisplayString, createCommentVNode, withDirectives, createVNode, mergeProps, vShow } from "vue";
40
+ import { defineComponent, ref, computed, watch, openBlock, createElementBlock, createElementVNode, Fragment, renderList, createBlock, unref, withCtx, createTextVNode, toDisplayString, createCommentVNode, withDirectives, normalizeStyle, createVNode, mergeProps, vShow } from "vue";
41
41
  import { ElTag, ElButton } from "element-plus";
42
42
  import { JkyPageTable } from "../page-table/index.js";
43
43
  const _hoisted_1 = { class: "jky-select-table" };
44
44
  const _hoisted_2 = { class: "jky-select-table__tags" };
45
- const _hoisted_3 = { class: "jky-select-table__dropdown" };
46
45
  const __default__ = {
47
46
  name: "JkySelectTable"
48
47
  };
@@ -171,6 +170,13 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues(_
171
170
  selectedRows: selectedRows.value
172
171
  });
173
172
  });
173
+ const _tableOffsetStyle = computed(() => {
174
+ const labelWidth = props.labelWidth || 100;
175
+ const width = typeof labelWidth === "number" ? `${labelWidth}px` : labelWidth;
176
+ return {
177
+ transform: `translateX(-${width})`
178
+ };
179
+ });
174
180
  return (_ctx, _cache) => {
175
181
  return openBlock(), createElementBlock("div", _hoisted_1, [
176
182
  createElementVNode("div", _hoisted_2, [
@@ -199,13 +205,16 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues(_
199
205
  _: 1
200
206
  })) : createCommentVNode("", true)
201
207
  ]),
202
- withDirectives(createElementVNode("div", _hoisted_3, [
203
- createVNode(unref(JkyPageTable), mergeProps(pageTableProps.value, {
208
+ withDirectives(createElementVNode("div", {
209
+ class: "jky-select-table__dropdown w-full",
210
+ style: normalizeStyle(_tableOffsetStyle.value)
211
+ }, [
212
+ createVNode(unref(JkyPageTable), mergeProps({ class: "w-full" }, pageTableProps.value, {
204
213
  selection: true,
205
214
  "selected-rows": selectedRows.value,
206
215
  onSelectionChange: handleSelectionChange
207
216
  }), null, 16, ["selected-rows"])
208
- ], 512), [
217
+ ], 4), [
209
218
  [vShow, showTable.value]
210
219
  ])
211
220
  ]);
@@ -1,4 +1,4 @@
1
- :root {
1
+ .jky-form, :root {
2
2
  /* 表单组件间距 */
3
3
  /* --jky-form-item-gap: 12px; */
4
4
  --jky-form-item-border-width: 4px;
@@ -67,23 +67,3 @@
67
67
  grid-template-columns: repeat(var(--jky-form-grid-cols-3xl, var(--jky-form-grid-cols-2xl)), minmax(0, 1fr));
68
68
  }
69
69
  }
70
- .jky-form__title {
71
- /* 表单标题样式 */
72
- }
73
-
74
-
75
- /* FormItem 组件样式 */
76
- .jky-form-item {
77
- /* 表单项容器样式 */
78
- }
79
- .jky-form-item--no-label {
80
- /* 表单项标题样式(无 label 时) */
81
- /* border-left: var(--jky-form-item-border-width) solid var(--jky-form-item-border-color); */
82
- /* background-color: var(--jky-form-item-bg-color); */
83
- /* padding-left: var(--jky-form-item-border-width); */
84
- }
85
- .jky-form-item__title {
86
- /* 表单项标题样式(无 label 时) */
87
- }
88
- .jky-form-item__title--no-label {
89
- }
package/dist/es/index.js CHANGED
@@ -4,7 +4,10 @@ import { createInstaller } from "./utils/installer.js";
4
4
  import { JkyComponentLibResolver } from "./resolver.js";
5
5
  import { default as default2 } from "./amap/AMarker.vue.js";
6
6
  /* empty css */
7
- import { JkyAMap, JkyAMarker } from "./amap/index.js";
7
+ import { default as default3 } from "./amap/ATrackPlayback.vue.js";
8
+ /* empty css */
9
+ import { JkyAMap, JkyAMarker, JkyATrackPlayback } from "./amap/index.js";
10
+ import { JkyActionColumn, JkyPageTable } from "./page-table/index.js";
8
11
  import { JkyAddInput } from "./add-input/index.js";
9
12
  import { JkyButton } from "./button/index.js";
10
13
  import { JkyButtonNav } from "./button-nav/index.js";
@@ -14,7 +17,6 @@ import { JkyMenu } from "./menu/index.js";
14
17
  import { JkyModal } from "./modal/index.js";
15
18
  import { JkyPageHeader } from "./page-header/index.js";
16
19
  import { JkyPageLayout } from "./page-layout/index.js";
17
- import { JkyPageTable } from "./page-table/index.js";
18
20
  import { JkyRichEditor } from "./rich-editor/index.js";
19
21
  import { JkySayHello } from "./say-hello/index.js";
20
22
  import { JkyTabs } from "./tabs/index.js";
@@ -25,8 +27,11 @@ const install = installer.install;
25
27
  const version = installer.version;
26
28
  export {
27
29
  default2 as AMarker,
30
+ default3 as ATrackPlayback,
28
31
  JkyAMap,
29
32
  JkyAMarker,
33
+ JkyATrackPlayback,
34
+ JkyActionColumn,
30
35
  JkyAddInput,
31
36
  JkyButton,
32
37
  JkyButtonNav,
@@ -1,4 +1,4 @@
1
- const version = "0.0.98";
1
+ const version = "0.0.99";
2
2
  export {
3
3
  version
4
4
  };
@@ -0,0 +1,11 @@
1
+ import { ActionColumnButtonConfig, ActionColumnConfig, ActionColumnProps } from './types';
2
+ declare const _default: import('vue').DefineComponent<ActionColumnProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
3
+ click: (button: ActionColumnButtonConfig, row: any, index: number) => any;
4
+ }, string, import('vue').PublicProps, Readonly<ActionColumnProps> & Readonly<{
5
+ onClick?: ((button: ActionColumnButtonConfig, row: any, index: number) => any) | undefined;
6
+ }>, {
7
+ index: number;
8
+ row: any;
9
+ config: ActionColumnConfig;
10
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
11
+ export default _default;
@@ -0,0 +1,137 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import { defineComponent, computed, openBlock, createElementBlock, Fragment, renderList, createBlock, unref, normalizeClass, withCtx, createTextVNode, toDisplayString, createVNode, createElementVNode, createCommentVNode } from "vue";
21
+ import { ElButton, ElDropdown, ElDropdownMenu, ElDropdownItem } from "element-plus";
22
+ const _hoisted_1 = { class: "jky-action-column flex gap-2 items-center" };
23
+ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
24
+ name: "JkyActionColumn"
25
+ }), {
26
+ __name: "ActionColumn",
27
+ props: {
28
+ row: { default: () => ({}) },
29
+ index: { default: 0 },
30
+ config: { default: () => ({}) }
31
+ },
32
+ emits: ["click"],
33
+ setup(__props, { emit: __emit }) {
34
+ const props = __props;
35
+ const emit = __emit;
36
+ const mergedConfig = computed(() => __spreadValues({
37
+ label: "操作",
38
+ width: "auto",
39
+ fixed: "right",
40
+ buttonLimit: 3,
41
+ moreButtonText: "更多",
42
+ buttons: []
43
+ }, props.config));
44
+ function isButtonVisible(button) {
45
+ if (button.hidden === void 0)
46
+ return true;
47
+ if (typeof button.hidden === "boolean")
48
+ return !button.hidden;
49
+ return !button.hidden(props.row, props.index);
50
+ }
51
+ const visibleButtons = computed(() => {
52
+ if (!mergedConfig.value.buttons)
53
+ return [];
54
+ return mergedConfig.value.buttons.filter((button) => isButtonVisible(button));
55
+ });
56
+ const displayButtons = computed(() => {
57
+ const limit = mergedConfig.value.buttonLimit || 3;
58
+ return visibleButtons.value.slice(0, limit);
59
+ });
60
+ const collapsedButtons = computed(() => {
61
+ const limit = mergedConfig.value.buttonLimit || 3;
62
+ return visibleButtons.value.slice(limit);
63
+ });
64
+ function handleButtonClick(button) {
65
+ if (button.onClick) {
66
+ button.onClick({
67
+ row: props.row,
68
+ index: props.index
69
+ });
70
+ }
71
+ emit("click", button, props.row, props.index);
72
+ }
73
+ return (_ctx, _cache) => {
74
+ return openBlock(), createElementBlock("div", _hoisted_1, [
75
+ (openBlock(true), createElementBlock(Fragment, null, renderList(displayButtons.value, (button) => {
76
+ return openBlock(), createBlock(unref(ElButton), {
77
+ key: button.label,
78
+ type: button.type || "primary",
79
+ size: button.size || "small",
80
+ disabled: button.disabled,
81
+ icon: button.icon,
82
+ plain: button.plain,
83
+ class: normalizeClass(button.class),
84
+ text: "",
85
+ onClick: ($event) => handleButtonClick(button)
86
+ }, {
87
+ default: withCtx(() => [
88
+ createTextVNode(toDisplayString(button.label), 1)
89
+ ]),
90
+ _: 2
91
+ }, 1032, ["type", "size", "disabled", "icon", "plain", "class", "onClick"]);
92
+ }), 128)),
93
+ collapsedButtons.value.length > 0 ? (openBlock(), createBlock(unref(ElDropdown), {
94
+ key: 0,
95
+ trigger: "click"
96
+ }, {
97
+ dropdown: withCtx(() => [
98
+ createVNode(unref(ElDropdownMenu), null, {
99
+ default: withCtx(() => [
100
+ (openBlock(true), createElementBlock(Fragment, null, renderList(collapsedButtons.value, (button) => {
101
+ return openBlock(), createBlock(unref(ElDropdownItem), {
102
+ key: button.label,
103
+ disabled: button.disabled,
104
+ onClick: ($event) => handleButtonClick(button)
105
+ }, {
106
+ default: withCtx(() => [
107
+ createTextVNode(toDisplayString(button.label), 1)
108
+ ]),
109
+ _: 2
110
+ }, 1032, ["disabled", "onClick"]);
111
+ }), 128))
112
+ ]),
113
+ _: 1
114
+ })
115
+ ]),
116
+ default: withCtx(() => [
117
+ createVNode(unref(ElButton), {
118
+ text: "",
119
+ type: "primary",
120
+ size: "small"
121
+ }, {
122
+ default: withCtx(() => [
123
+ createTextVNode(toDisplayString(mergedConfig.value.moreButtonText) + " ", 1),
124
+ _cache[0] || (_cache[0] = createElementVNode("span", { class: "i-ep-arrow-down ml-1" }, null, -1))
125
+ ]),
126
+ _: 1
127
+ })
128
+ ]),
129
+ _: 1
130
+ })) : createCommentVNode("", true)
131
+ ]);
132
+ };
133
+ }
134
+ }));
135
+ export {
136
+ _sfc_main as default
137
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./ActionColumn.vue.js";
2
+ /* empty css */
3
+ export {
4
+ _sfc_main as default
5
+ };