geekplus-digital-ui 0.1.25 → 0.1.26

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.
@@ -1 +1 @@
1
- .d-copy[data-v-b4c0bee4] .el-link__inner{gap:4px}
1
+ .d-copy[data-v-5ec3986a] .el-link__inner{gap:4px}
@@ -1,14 +1,14 @@
1
- import { ref as m, toRef as C, computed as p, onMounted as L, onBeforeUnmount as x, openBlock as a, createBlock as d, unref as f, withModifiers as S, normalizeStyle as M, withCtx as y, createElementBlock as N, normalizeClass as _, createVNode as b, renderSlot as B, createCommentVNode as w } from "vue";
2
- import { useClipboard as R } from "@vueuse/core";
3
- import { ElMessage as $, ElLink as z } from "element-plus";
1
+ import { ref as m, computed as p, onMounted as k, onBeforeUnmount as C, openBlock as a, createBlock as d, unref as f, withModifiers as L, normalizeStyle as S, withCtx as y, createElementBlock as x, normalizeClass as M, createVNode as N, renderSlot as _, createCommentVNode as B } from "vue";
2
+ import { useClipboard as w } from "@vueuse/core";
3
+ import { ElMessage as $, ElLink as b } from "element-plus";
4
4
  import "../../index.js";
5
5
  import "../../../hooks/index.js";
6
- import D from "../../icons/copy-light.vue.js";
6
+ import z from "../../icons/copy-light.vue.js";
7
7
  import './copy.css';/* empty css */
8
- import I from "../../../_virtual/_plugin-vue_export-helper.js";
9
- import { useLocale as V } from "../../../hooks/use-locale/index.js";
10
- import { DIcon as j } from "../../icon/index.js";
11
- const H = /* @__PURE__ */ Object.assign({
8
+ import D from "../../../_virtual/_plugin-vue_export-helper.js";
9
+ import { useLocale as I } from "../../../hooks/use-locale/index.js";
10
+ import { DIcon as R } from "../../icon/index.js";
11
+ const V = /* @__PURE__ */ Object.assign({
12
12
  name: "DCopy"
13
13
  }, {
14
14
  __name: "copy",
@@ -28,63 +28,63 @@ const H = /* @__PURE__ */ Object.assign({
28
28
  }
29
29
  // 触发元素显示的dom,不设置就一直显示
30
30
  },
31
- setup(n, { expose: v }) {
32
- const r = n, l = m(null), s = m(!1), g = C(r, "text"), { copy: E } = R({
33
- source: g
34
- }), { t: h } = V(), e = p(() => {
31
+ setup(r, { expose: v }) {
32
+ const n = r, l = m(null), s = m(!1), { copy: g } = w({
33
+ source: n.text
34
+ }), { t: E } = I(), e = p(() => {
35
35
  const o = l.value?.$el ?? l.value;
36
- if (!r.triggerElement || !o)
36
+ if (!n.triggerElement || !o)
37
37
  return null;
38
38
  let t = o.parentNode;
39
39
  for (; t; ) {
40
- if (t.matches(r.triggerElement))
40
+ if (t.matches(n.triggerElement))
41
41
  return t;
42
42
  t = t.parentNode;
43
43
  }
44
44
  return null;
45
- }), k = p(() => ({
46
- display: r.triggerElement && !s.value ? "none" : ""
45
+ }), h = p(() => ({
46
+ display: n.triggerElement && !s.value ? "none" : ""
47
47
  })), i = () => {
48
- E().then(() => {
49
- $.success(h("d.copy.success"));
48
+ g().then(() => {
49
+ $.success(E("d.copy.success"));
50
50
  });
51
51
  }, u = () => {
52
52
  s.value = !0;
53
53
  }, c = () => {
54
54
  s.value = !1;
55
55
  };
56
- return L(() => {
56
+ return k(() => {
57
57
  e.value && (e.value.addEventListener("mouseenter", u), e.value.addEventListener("mouseleave", c));
58
- }), x(() => {
58
+ }), C(() => {
59
59
  e.value && (e.value.removeEventListener("mouseenter", u), e.value.removeEventListener("mouseleave", c));
60
60
  }), v({
61
61
  rootRef: l,
62
62
  handleCopy: i
63
- }), (o, t) => (a(), d(f(z), {
63
+ }), (o, t) => (a(), d(f(b), {
64
64
  ref_key: "rootRef",
65
65
  ref: l,
66
66
  class: "d-copy",
67
- type: n.type,
67
+ type: r.type,
68
68
  underline: "never",
69
- style: M(k.value),
70
- onClick: S(i, ["stop"])
69
+ style: S(h.value),
70
+ onClick: L(i, ["stop"])
71
71
  }, {
72
72
  default: y(() => [
73
- n.icon ? (a(), N("i", {
73
+ r.icon ? (a(), x("i", {
74
74
  key: 0,
75
- class: _(n.icon)
76
- }, null, 2)) : (a(), d(f(j), { key: 1 }, {
75
+ class: M(r.icon)
76
+ }, null, 2)) : (a(), d(f(R), { key: 1 }, {
77
77
  default: y(() => [
78
- b(D)
78
+ N(z)
79
79
  ]),
80
80
  _: 1
81
81
  })),
82
- o.$slots.default ? B(o.$slots, "default", { key: 2 }, void 0, !0) : w("", !0)
82
+ o.$slots.default ? _(o.$slots, "default", { key: 2 }, void 0, !0) : B("", !0)
83
83
  ]),
84
84
  _: 3
85
85
  }, 8, ["type", "style"]));
86
86
  }
87
- }), T = /* @__PURE__ */ I(H, [["__scopeId", "data-v-b4c0bee4"]]);
87
+ }), P = /* @__PURE__ */ D(V, [["__scopeId", "data-v-5ec3986a"]]);
88
88
  export {
89
- T as default
89
+ P as default
90
90
  };
@@ -1,5 +1,6 @@
1
1
  export * from './copy';
2
2
  export * from './fold-text';
3
3
  export * from './icon-tip';
4
+ export * from './inline-edit';
4
5
  export * from './upload';
5
6
  export * from './icon';
@@ -1,12 +1,14 @@
1
1
  import { DCopy as p } from "./copy/index.js";
2
2
  import { DFoldText as t } from "./fold-text/index.js";
3
3
  import { DIconTip as f } from "./icon-tip/index.js";
4
- import { DUpload as D } from "./upload/index.js";
5
- import { DIcon as d } from "./icon/index.js";
4
+ import { DInlineEdit as D } from "./inline-edit/index.js";
5
+ import { DUpload as d } from "./upload/index.js";
6
+ import { DIcon as l } from "./icon/index.js";
6
7
  export {
7
8
  p as DCopy,
8
9
  t as DFoldText,
9
- d as DIcon,
10
+ l as DIcon,
10
11
  f as DIconTip,
11
- D as DUpload
12
+ D as DInlineEdit,
13
+ d as DUpload
12
14
  };
@@ -0,0 +1,73 @@
1
+ export const DInlineEdit: {
2
+ new (...args: any[]): import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{}> & Readonly<{}>, {
3
+ editable: import('vue').Ref<boolean, boolean>;
4
+ $emit: (event: "focus" | "blur", ...args: any[]) => void;
5
+ disabled: boolean;
6
+ trigger: string;
7
+ autofocus: boolean;
8
+ outsideIgnore: unknown[];
9
+ beforeClose?: Function;
10
+ focusTarget?: string | Function;
11
+ $props: {
12
+ readonly disabled?: boolean;
13
+ readonly trigger?: string;
14
+ readonly autofocus?: boolean;
15
+ readonly outsideIgnore?: unknown[];
16
+ readonly beforeClose?: Function;
17
+ readonly focusTarget?: string | Function;
18
+ };
19
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, import('vue').PublicProps, {}, true, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
20
+ rootRef: HTMLDivElement;
21
+ editorRef: HTMLDivElement;
22
+ }, HTMLDivElement, import('vue').ComponentProvideOptions, {
23
+ P: {};
24
+ B: {};
25
+ D: {};
26
+ C: {};
27
+ M: {};
28
+ Defaults: {};
29
+ }, Readonly<{}> & Readonly<{}>, {
30
+ editable: import('vue').Ref<boolean, boolean>;
31
+ $emit: (event: "focus" | "blur", ...args: any[]) => void;
32
+ disabled: boolean;
33
+ trigger: string;
34
+ autofocus: boolean;
35
+ outsideIgnore: unknown[];
36
+ beforeClose?: Function;
37
+ focusTarget?: string | Function;
38
+ $props: {
39
+ readonly disabled?: boolean;
40
+ readonly trigger?: string;
41
+ readonly autofocus?: boolean;
42
+ readonly outsideIgnore?: unknown[];
43
+ readonly beforeClose?: Function;
44
+ readonly focusTarget?: string | Function;
45
+ };
46
+ }, {}, {}, {}, {}>;
47
+ __isFragment?: never;
48
+ __isTeleport?: never;
49
+ __isSuspense?: never;
50
+ } & import('vue').ComponentOptionsBase<Readonly<{}> & Readonly<{}>, {
51
+ editable: import('vue').Ref<boolean, boolean>;
52
+ $emit: (event: "focus" | "blur", ...args: any[]) => void;
53
+ disabled: boolean;
54
+ trigger: string;
55
+ autofocus: boolean;
56
+ outsideIgnore: unknown[];
57
+ beforeClose?: Function;
58
+ focusTarget?: string | Function;
59
+ $props: {
60
+ readonly disabled?: boolean;
61
+ readonly trigger?: string;
62
+ readonly autofocus?: boolean;
63
+ readonly outsideIgnore?: unknown[];
64
+ readonly beforeClose?: Function;
65
+ readonly focusTarget?: string | Function;
66
+ };
67
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, {}, {}, string, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, import('vue').ComponentProvideOptions> & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & (new () => {
68
+ $slots: {
69
+ editor?(_: {}): any;
70
+ default?(_: {}): any;
71
+ };
72
+ });
73
+ export default DInlineEdit;
@@ -0,0 +1,6 @@
1
+ import t from "./src/inline-edit.vue.js";
2
+ const n = t;
3
+ export {
4
+ n as DInlineEdit,
5
+ n as default
6
+ };
@@ -0,0 +1 @@
1
+ .d-inline-edit .text-hover[data-v-db4be4cc]{border-radius:4px;cursor:text}.d-inline-edit .text-hover[data-v-db4be4cc]:hover{box-shadow:0 0 0 1px var(--el-border-color) inset}
@@ -0,0 +1,38 @@
1
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
2
+ export default _default;
3
+ type __VLS_WithTemplateSlots<T, S> = T & (new () => {
4
+ $slots: S;
5
+ });
6
+ declare const __VLS_component: import('vue').DefineComponent<{}, {
7
+ editable: import('vue').Ref<boolean, boolean>;
8
+ $emit: (event: "focus" | "blur", ...args: any[]) => void;
9
+ disabled: boolean;
10
+ trigger: string;
11
+ autofocus: boolean;
12
+ outsideIgnore: unknown[];
13
+ beforeClose?: Function;
14
+ focusTarget?: string | Function;
15
+ $props: {
16
+ readonly disabled?: boolean;
17
+ readonly trigger?: string;
18
+ readonly autofocus?: boolean;
19
+ readonly outsideIgnore?: unknown[];
20
+ readonly beforeClose?: Function;
21
+ readonly focusTarget?: string | Function;
22
+ };
23
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {
24
+ rootRef: HTMLDivElement;
25
+ editorRef: HTMLDivElement;
26
+ }, HTMLDivElement>;
27
+ type __VLS_TemplateResult = {
28
+ attrs: Partial<{}>;
29
+ slots: {
30
+ editor?(_: {}): any;
31
+ default?(_: {}): any;
32
+ };
33
+ refs: {
34
+ rootRef: HTMLDivElement;
35
+ editorRef: HTMLDivElement;
36
+ };
37
+ rootEl: HTMLDivElement;
38
+ };
@@ -0,0 +1,112 @@
1
+ import { ref as f, nextTick as k, openBlock as d, createElementBlock as p, renderSlot as C, normalizeClass as x } from "vue";
2
+ import { onClickOutside as R } from "@vueuse/core";
3
+ import { isFunction as n } from "lodash-es";
4
+ import './inline-edit.css';/* empty css */
5
+ import w from "../../../_virtual/_plugin-vue_export-helper.js";
6
+ const v = 'input:not([disabled]), textarea:not([disabled]), [contenteditable="true"], [tabindex]:not([tabindex="-1"])', B = /* @__PURE__ */ Object.assign({
7
+ name: "DInlineEdit"
8
+ }, {
9
+ __name: "inline-edit",
10
+ props: {
11
+ disabled: Boolean,
12
+ trigger: {
13
+ type: String,
14
+ default: "click",
15
+ validator: (s) => ["click", "dblclick"].includes(s)
16
+ },
17
+ beforeClose: {
18
+ type: Function
19
+ },
20
+ autofocus: {
21
+ type: Boolean,
22
+ default: !0
23
+ },
24
+ focusTarget: {
25
+ type: [String, Function]
26
+ },
27
+ outsideIgnore: {
28
+ type: Array,
29
+ default: () => [],
30
+ validator: (s) => s.every((u) => typeof u == "string")
31
+ }
32
+ },
33
+ emits: ["focus", "blur"],
34
+ setup(s, { expose: u, emit: E }) {
35
+ const _ = [".el-popper"], t = s, b = E, y = f(null), l = f(null), o = f(!1), S = [
36
+ ..._,
37
+ ...t.outsideIgnore
38
+ ], c = (e) => e?.querySelector ? e.querySelector(v) : null, a = (e) => {
39
+ if (!e)
40
+ return !1;
41
+ if (e.$el && n(e.focus))
42
+ return e.focus(), !0;
43
+ const r = e.$el ?? e;
44
+ if (!r)
45
+ return !1;
46
+ const i = c(r);
47
+ return i && n(i.focus) ? (i.focus(), !0) : n(r.matches) && r.matches(v) && n(r.focus) ? (r.focus(), !0) : !1;
48
+ }, g = () => {
49
+ const e = l.value;
50
+ if (!e || !t.focusTarget)
51
+ return null;
52
+ if (n(t.focusTarget))
53
+ return t.focusTarget(e);
54
+ try {
55
+ return e.querySelector(t.focusTarget);
56
+ } catch {
57
+ return null;
58
+ }
59
+ }, T = async () => {
60
+ if (!t.autofocus)
61
+ return;
62
+ await k();
63
+ const e = g();
64
+ if (a(e))
65
+ return;
66
+ const r = c(l.value);
67
+ if (a(r))
68
+ return;
69
+ await k();
70
+ const i = g() ?? c(l.value);
71
+ a(i);
72
+ }, m = async () => {
73
+ t.disabled || (o.value = !0, b("focus"), await T());
74
+ }, F = () => {
75
+ t.trigger === "click" && m();
76
+ }, h = () => {
77
+ t.trigger === "dblclick" && m();
78
+ }, I = async () => n(t.beforeClose) ? await t.beforeClose() !== !1 : !0, O = async () => {
79
+ o.value && await I() && (o.value = !1, b("blur"));
80
+ };
81
+ return R(y, async () => {
82
+ o.value && await O();
83
+ }, {
84
+ ignore: S
85
+ }), u({
86
+ editable: o
87
+ }), (e, r) => (d(), p("div", {
88
+ ref_key: "rootRef",
89
+ ref: y,
90
+ class: "d-inline-edit"
91
+ }, [
92
+ o.value ? (d(), p("div", {
93
+ key: 0,
94
+ ref_key: "editorRef",
95
+ ref: l,
96
+ class: "editor"
97
+ }, [
98
+ C(e.$slots, "editor", {}, void 0, !0)
99
+ ], 512)) : (d(), p("div", {
100
+ key: 1,
101
+ class: x(["text", { "text-hover": !t.disabled }]),
102
+ onClick: F,
103
+ onDblclick: h
104
+ }, [
105
+ C(e.$slots, "default", {}, void 0, !0)
106
+ ], 34))
107
+ ], 512));
108
+ }
109
+ }), j = /* @__PURE__ */ w(B, [["__scopeId", "data-v-db4be4cc"]]);
110
+ export {
111
+ j as default
112
+ };
package/index.js CHANGED
@@ -2,24 +2,26 @@ import { install as o } from "./install.js";
2
2
  import "./components/index.js";
3
3
  import "./hooks/index.js";
4
4
  import { setComponentRegistry as x, setGlobalConfig as i } from "./config/index.js";
5
- import { DCopy as n } from "./components/copy/index.js";
5
+ import { DCopy as l } from "./components/copy/index.js";
6
6
  import { DFoldText as a } from "./components/fold-text/index.js";
7
- import { DIcon as d } from "./components/icon/index.js";
7
+ import { DIcon as D } from "./components/icon/index.js";
8
8
  import { DIconTip as u } from "./components/icon-tip/index.js";
9
- import { DUpload as g } from "./components/upload/index.js";
10
- import { useActivated as I } from "./hooks/use-activated/index.js";
11
- import { useLocale as b } from "./hooks/use-locale/index.js";
9
+ import { DInlineEdit as I } from "./components/inline-edit/index.js";
10
+ import { DUpload as y } from "./components/upload/index.js";
11
+ import { useActivated as b } from "./hooks/use-activated/index.js";
12
+ import { useLocale as A } from "./hooks/use-locale/index.js";
12
13
  const p = { install: o };
13
14
  export {
14
- n as DCopy,
15
+ l as DCopy,
15
16
  a as DFoldText,
16
- d as DIcon,
17
+ D as DIcon,
17
18
  u as DIconTip,
18
- g as DUpload,
19
+ I as DInlineEdit,
20
+ y as DUpload,
19
21
  p as default,
20
22
  o as install,
21
23
  x as setComponentRegistry,
22
24
  i as setGlobalConfig,
23
- I as useActivated,
24
- b as useLocale
25
+ b as useActivated,
26
+ A as useLocale
25
27
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "geekplus-digital-ui",
3
- "version": "0.1.25",
3
+ "version": "0.1.26",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "module": "index.js",