jky-component-lib 0.0.140 → 0.0.142

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 (63) hide show
  1. package/dist/es/amap/AClusterMarker/AClusterMarker.vue.d.ts +55 -0
  2. package/dist/es/amap/AClusterMarker/AClusterMarker.vue.js +202 -0
  3. package/dist/es/amap/AClusterMarker/AClusterMarker.vue2.js +4 -0
  4. package/dist/es/amap/AClusterMarker/index.d.ts +4 -0
  5. package/dist/es/amap/AClusterMarker/index.js +7 -0
  6. package/dist/es/amap/AMap.vue.d.ts +2 -2
  7. package/dist/es/amap/AMap.vue.js +3 -1
  8. package/dist/es/amap/AMapPicker/AMapPicker.vue.js +1 -1
  9. package/dist/es/amap/AMarker.vue.d.ts +1 -1
  10. package/dist/es/amap/index.d.ts +5 -1
  11. package/dist/es/amap/index.js +4 -0
  12. package/dist/es/amap/style.css +6 -2
  13. package/dist/es/amap/style3.css +2 -6
  14. package/dist/es/code-mirror-editor/CodeMirrorEditor.vue.d.ts +0 -1
  15. package/dist/es/code-mirror-editor/CodeMirrorEditor.vue.js +5 -7
  16. package/dist/es/code-mirror-editor/style.css +0 -38
  17. package/dist/es/components.d.ts +1 -0
  18. package/dist/es/components.js +6 -2
  19. package/dist/es/draggable/Draggable.vue.d.ts +78 -0
  20. package/dist/es/draggable/Draggable.vue.js +130 -0
  21. package/dist/es/draggable/Draggable.vue3.js +5 -0
  22. package/dist/es/draggable/index.d.ts +4 -0
  23. package/dist/es/draggable/index.js +8 -0
  24. package/dist/es/draggable/style.css +16 -0
  25. package/dist/es/form/items/SelectTableItem.vue.d.ts +6 -0
  26. package/dist/es/index.js +6 -1
  27. package/dist/es/package.json.js +1 -1
  28. package/dist/es/page-table/ActionColumn.vue.js +4 -3
  29. package/dist/es/page-table/PageTable.vue.js +6 -1
  30. package/dist/es/style.css +195 -0
  31. package/dist/es/styles.css +1 -1
  32. package/dist/lib/amap/AClusterMarker/AClusterMarker.vue.d.ts +55 -0
  33. package/dist/lib/amap/AClusterMarker/AClusterMarker.vue.js +202 -0
  34. package/dist/lib/amap/AClusterMarker/AClusterMarker.vue2.js +4 -0
  35. package/dist/lib/amap/AClusterMarker/index.d.ts +4 -0
  36. package/dist/lib/amap/AClusterMarker/index.js +7 -0
  37. package/dist/lib/amap/AMap.vue.d.ts +2 -2
  38. package/dist/lib/amap/AMap.vue.js +3 -1
  39. package/dist/lib/amap/AMapPicker/AMapPicker.vue.js +1 -1
  40. package/dist/lib/amap/AMarker.vue.d.ts +1 -1
  41. package/dist/lib/amap/index.d.ts +5 -1
  42. package/dist/lib/amap/index.js +4 -0
  43. package/dist/lib/amap/style.css +6 -2
  44. package/dist/lib/amap/style3.css +2 -6
  45. package/dist/lib/code-mirror-editor/CodeMirrorEditor.vue.d.ts +0 -1
  46. package/dist/lib/code-mirror-editor/CodeMirrorEditor.vue.js +4 -6
  47. package/dist/lib/code-mirror-editor/style.css +0 -38
  48. package/dist/lib/components.d.ts +1 -0
  49. package/dist/lib/components.js +59 -55
  50. package/dist/lib/draggable/Draggable.vue.d.ts +78 -0
  51. package/dist/lib/draggable/Draggable.vue.js +130 -0
  52. package/dist/lib/draggable/Draggable.vue3.js +5 -0
  53. package/dist/lib/draggable/index.d.ts +4 -0
  54. package/dist/lib/draggable/index.js +8 -0
  55. package/dist/lib/draggable/style.css +16 -0
  56. package/dist/lib/form/items/SelectTableItem.vue.d.ts +6 -0
  57. package/dist/lib/index.js +42 -37
  58. package/dist/lib/package.json.js +1 -1
  59. package/dist/lib/page-table/ActionColumn.vue.js +4 -3
  60. package/dist/lib/page-table/PageTable.vue.js +6 -1
  61. package/dist/lib/style.css +195 -0
  62. package/dist/lib/styles.css +1 -1
  63. package/package.json +1 -1
@@ -0,0 +1,130 @@
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, ref, watch, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, renderSlot } from "vue";
21
+ import { useDraggable } from "@vueuse/core";
22
+ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({}, {
23
+ name: "JkyDraggable"
24
+ }), {
25
+ __name: "Draggable",
26
+ props: {
27
+ disabled: { type: Boolean, default: false },
28
+ initialValue: { default: () => ({ x: 100, y: 100 }) },
29
+ storageKey: { default: "jky-draggable-position" },
30
+ persistPosition: { type: Boolean, default: true },
31
+ boundToViewport: { type: Boolean, default: true },
32
+ viewportMargin: { default: 0 }
33
+ },
34
+ emits: ["start", "move", "end", "change", "click"],
35
+ setup(__props, { expose: __expose, emit: __emit }) {
36
+ const props = __props;
37
+ const emit = __emit;
38
+ const dragRef = ref(null);
39
+ const startPosition = ref(null);
40
+ function getInitialPosition() {
41
+ if (!props.persistPosition) {
42
+ return props.initialValue || { x: 100, y: 100 };
43
+ }
44
+ const saved = localStorage.getItem(props.storageKey);
45
+ if (saved) {
46
+ try {
47
+ return JSON.parse(saved);
48
+ } catch (e) {
49
+ }
50
+ }
51
+ return props.initialValue || { x: 100, y: 100 };
52
+ }
53
+ function savePosition(x2, y2) {
54
+ if (!props.persistPosition)
55
+ return;
56
+ localStorage.setItem(props.storageKey, JSON.stringify({ x: x2, y: y2 }));
57
+ }
58
+ const { x, y, style, isDragging } = useDraggable(dragRef, {
59
+ initialValue: getInitialPosition(),
60
+ disabled: props.disabled,
61
+ preventDefault: true,
62
+ // stopPropagation: true,
63
+ onStart: () => {
64
+ startPosition.value = { x: x.value, y: y.value };
65
+ emit("start", { x: x.value, y: y.value });
66
+ },
67
+ onMove: () => {
68
+ emit("move", { x: x.value, y: y.value });
69
+ },
70
+ onEnd: (position) => {
71
+ savePosition(x.value, y.value);
72
+ emit("end", { x: x.value, y: y.value });
73
+ if (startPosition.value) {
74
+ const dx = Math.abs(position.x - startPosition.value.x);
75
+ const dy = Math.abs(position.y - startPosition.value.y);
76
+ if (dx < 3 && dy < 3) {
77
+ emit("click", new MouseEvent("click"));
78
+ }
79
+ startPosition.value = null;
80
+ }
81
+ }
82
+ });
83
+ watch([x, y], ([newX, newY]) => {
84
+ emit("change", { x: newX, y: newY });
85
+ if (isDragging.value) {
86
+ savePosition(newX, newY);
87
+ }
88
+ });
89
+ watch([x, y], ([newX, newY]) => {
90
+ if (!props.boundToViewport || !dragRef.value)
91
+ return;
92
+ const maxX = window.innerWidth - dragRef.value.offsetWidth - props.viewportMargin;
93
+ const maxY = window.innerHeight - dragRef.value.offsetHeight - props.viewportMargin;
94
+ const clampedX = Math.max(props.viewportMargin, Math.min(newX, maxX));
95
+ const clampedY = Math.max(props.viewportMargin, Math.min(newY, maxY));
96
+ if (clampedX !== newX || clampedY !== newY) {
97
+ x.value = clampedX;
98
+ y.value = clampedY;
99
+ }
100
+ });
101
+ __expose({
102
+ /** 手动保存位置 */
103
+ savePosition: () => savePosition(x.value, y.value),
104
+ /** 重置位置到初始值 */
105
+ resetPosition: () => {
106
+ const initial = props.initialValue || { x: 100, y: 100 };
107
+ x.value = initial.x;
108
+ y.value = initial.y;
109
+ savePosition(initial.x, initial.y);
110
+ },
111
+ /** 获取当前位置 */
112
+ getPosition: () => ({ x: x.value, y: y.value }),
113
+ /** 是否正在拖拽 */
114
+ isDragging: () => isDragging.value
115
+ });
116
+ return (_ctx, _cache) => {
117
+ return openBlock(), createElementBlock("div", {
118
+ ref_key: "dragRef",
119
+ ref: dragRef,
120
+ class: normalizeClass(["jky-draggable fixed z-9999 cursor-move select-none", { "jky-draggable--dragging": unref(isDragging) }]),
121
+ style: normalizeStyle(unref(style))
122
+ }, [
123
+ renderSlot(_ctx.$slots, "default")
124
+ ], 6);
125
+ };
126
+ }
127
+ }));
128
+ export {
129
+ _sfc_main as default
130
+ };
@@ -0,0 +1,5 @@
1
+ import _sfc_main from "./Draggable.vue.js";
2
+ /* empty css */
3
+ export {
4
+ _sfc_main as default
5
+ };
@@ -0,0 +1,4 @@
1
+ import { InstallWithSFC } from '../utils';
2
+ import { default as Draggable } from './Draggable.vue';
3
+ export declare const JkyDraggable: InstallWithSFC<typeof Draggable>;
4
+ export default JkyDraggable;
@@ -0,0 +1,8 @@
1
+ import _sfc_main from "./Draggable.vue.js";
2
+ /* empty css */
3
+ import { installWithSFC } from "../utils/with-install.js";
4
+ const JkyDraggable = installWithSFC(_sfc_main);
5
+ export {
6
+ JkyDraggable,
7
+ JkyDraggable as default
8
+ };
@@ -0,0 +1,16 @@
1
+
2
+ /* 禁止使用 @apply,所有 TailwindCSS 工具类直接写在 class 中 */
3
+ /* 样式文件仅用于定义组件特定的自定义纯 CSS 样式 */
4
+ /* 禁止使用 @apply,所有 TailwindCSS 工具类直接写在 class 中 */
5
+ /* 样式文件仅用于定义组件特定的自定义纯 CSS 样式 */
6
+ :root {
7
+ --jky-draggable-z-index: 9999;
8
+ }
9
+ .jky-draggable {
10
+ user-select: none;
11
+ -webkit-user-select: none;
12
+ touch-action: none;
13
+ }
14
+ .jky-draggable--dragging {
15
+ cursor: grabbing;
16
+ }
@@ -18,6 +18,9 @@ declare function __VLS_template(): {
18
18
  readonly pageSize?: number | undefined;
19
19
  readonly total?: number | undefined;
20
20
  readonly withCard?: boolean | undefined;
21
+ readonly config?: {
22
+ withCard?: boolean;
23
+ } | undefined;
21
24
  readonly title?: string | undefined;
22
25
  readonly filterItems?: import('../../page-table').FilterItemConfig[] | undefined;
23
26
  readonly form?: Record<string, any> | undefined;
@@ -3014,6 +3017,9 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
3014
3017
  readonly pageSize?: number | undefined;
3015
3018
  readonly total?: number | undefined;
3016
3019
  readonly withCard?: boolean | undefined;
3020
+ readonly config?: {
3021
+ withCard?: boolean;
3022
+ } | undefined;
3017
3023
  readonly title?: string | undefined;
3018
3024
  readonly filterItems?: import('../../page-table').FilterItemConfig[] | undefined;
3019
3025
  readonly form?: Record<string, any> | undefined;
package/dist/es/index.js CHANGED
@@ -2,18 +2,20 @@ import { components } from "./components.js";
2
2
  import { createInstaller } from "./utils/installer.js";
3
3
  /* empty css */
4
4
  import { JkyComponentLibResolver } from "./resolver.js";
5
+ import { JkyAClusterMarker } from "./amap/AClusterMarker/index.js";
5
6
  import { default as default2 } from "./amap/AMapPicker/AMapPicker.vue.js";
6
7
  import { default as default3 } from "./amap/AMarker.vue.js";
7
8
  /* empty css */
8
9
  import { default as default4 } from "./amap/ATrackPlayback.vue.js";
9
10
  /* empty css */
10
- import { JkyAMap, JkyAMapPicker, JkyAMarker, JkyATrackPlayback } from "./amap/index.js";
11
+ import { JkyAClusterMarker as JkyAClusterMarker2, JkyAMap, JkyAMapPicker, JkyAMarker, JkyATrackPlayback } from "./amap/index.js";
11
12
  import { JkyAMapPickerItem, JkyForm, JkyFormItem } from "./form/index.js";
12
13
  import { JkyActionColumn, JkyPageTable, JkyPageTableColumn } from "./page-table/index.js";
13
14
  import { JkyAddInput } from "./add-input/index.js";
14
15
  import { JkyButton } from "./button/index.js";
15
16
  import { JkyButtonNav } from "./button-nav/index.js";
16
17
  import { JkyCodeMirrorEditor } from "./code-mirror-editor/index.js";
18
+ import { JkyDraggable } from "./draggable/index.js";
17
19
  import { JkyMenu } from "./menu/index.js";
18
20
  import { JkyModal } from "./modal/index.js";
19
21
  import { JkyPageHeader } from "./page-header/index.js";
@@ -28,9 +30,11 @@ const installer = createInstaller(components);
28
30
  const install = installer.install;
29
31
  const version = installer.version;
30
32
  export {
33
+ JkyAClusterMarker as AClusterMarker,
31
34
  default2 as AMapPicker,
32
35
  default3 as AMarker,
33
36
  default4 as ATrackPlayback,
37
+ JkyAClusterMarker2 as JkyAClusterMarker,
34
38
  JkyAMap,
35
39
  JkyAMapPicker,
36
40
  JkyAMapPickerItem,
@@ -42,6 +46,7 @@ export {
42
46
  JkyButtonNav,
43
47
  JkyCodeMirrorEditor,
44
48
  JkyComponentLibResolver,
49
+ JkyDraggable,
45
50
  JkyForm,
46
51
  JkyFormItem,
47
52
  JkyMenu,
@@ -1,4 +1,4 @@
1
- const version = "0.0.140";
1
+ const version = "0.0.142";
2
2
  export {
3
3
  version
4
4
  };
@@ -39,7 +39,8 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
39
39
  fixed: "right",
40
40
  buttonLimit: 3,
41
41
  moreButtonText: "更多",
42
- buttons: []
42
+ buttons: [],
43
+ trigger: "hover"
43
44
  }, props.config));
44
45
  function isButtonVisible(button) {
45
46
  if (button.hidden === void 0)
@@ -98,7 +99,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
98
99
  }), 128)),
99
100
  collapsedButtons.value.length > 0 ? (openBlock(), createBlock(unref(ElDropdown), {
100
101
  key: 0,
101
- trigger: "click"
102
+ trigger: mergedConfig.value.trigger
102
103
  }, {
103
104
  dropdown: withCtx(() => [
104
105
  createVNode(unref(ElDropdownMenu), null, {
@@ -133,7 +134,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
133
134
  })
134
135
  ]),
135
136
  _: 1
136
- })) : createCommentVNode("", true)
137
+ }, 8, ["trigger"])) : createCommentVNode("", true)
137
138
  ]);
138
139
  };
139
140
  }
@@ -53,6 +53,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
53
53
  __name: "PageTable",
54
54
  props: /* @__PURE__ */ mergeModels({
55
55
  withCard: { type: Boolean, default: true },
56
+ config: {},
56
57
  title: { default: "" },
57
58
  filterItems: { default: () => [] },
58
59
  form: {},
@@ -156,6 +157,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
156
157
  }
157
158
  }
158
159
  const sortValue = ref("desc");
160
+ const withCard = computed(() => {
161
+ var _a, _b, _c;
162
+ return (_c = (_b = props.withCard) != null ? _b : (_a = props.config) == null ? void 0 : _a.withCard) != null ? _c : true;
163
+ });
159
164
  const defaultRightButtons = computed(() => {
160
165
  const sortButton = {
161
166
  label: "排序",
@@ -413,7 +418,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent(__spreadProps(__spreadValues({
413
418
  ]),
414
419
  _: 1
415
420
  })) : createCommentVNode("", true),
416
- (openBlock(), createBlock(resolveDynamicComponent(props.withCard ? unref(ElCard) : "div"), { class: "flex-1 min-h-0 jky-page-table__table-card" }, {
421
+ (openBlock(), createBlock(resolveDynamicComponent(withCard.value ? unref(ElCard) : "div"), { class: "flex-1 min-h-0 jky-page-table__table-card" }, {
417
422
  default: withCtx(() => {
418
423
  var _a2, _b2, _c2, _d, _e, _f, _g;
419
424
  return [