@qynpm/ui 1.0.21 → 1.0.23

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 (123) hide show
  1. package/README.md +451 -352
  2. package/dist/index.cjs +8 -2
  3. package/dist/index.mjs +36 -27
  4. package/dist/qy-action-bar/index.cjs +1 -1
  5. package/dist/qy-action-bar/index.mjs +1 -1
  6. package/dist/qy-autocomplete/index.cjs +1 -1
  7. package/dist/qy-autocomplete/index.mjs +4 -2
  8. package/dist/qy-button/index.cjs +2 -0
  9. package/dist/qy-button/index.mjs +5 -0
  10. package/dist/qy-checkbox/index.cjs +1 -1
  11. package/dist/qy-checkbox/index.mjs +4 -2
  12. package/dist/qy-date-picker/index.cjs +1 -1
  13. package/dist/qy-date-picker/index.mjs +4 -2
  14. package/dist/qy-dialog/index.cjs +1 -1
  15. package/dist/qy-dialog/index.mjs +2 -2
  16. package/dist/qy-dropdown/index.cjs +2 -0
  17. package/dist/qy-dropdown/index.mjs +5 -0
  18. package/dist/qy-form-section/index.cjs +1 -1
  19. package/dist/qy-form-section/index.mjs +1 -1
  20. package/dist/qy-image/index.cjs +1 -1
  21. package/dist/qy-image/index.mjs +3 -1
  22. package/dist/qy-image-preview/index.cjs +1 -1
  23. package/dist/qy-image-preview/index.mjs +6 -3
  24. package/dist/qy-image-upload/index.cjs +1 -1
  25. package/dist/qy-image-upload/index.mjs +1 -1
  26. package/dist/qy-input/index.cjs +2 -1
  27. package/dist/qy-input/index.mjs +2 -1
  28. package/dist/qy-input-number/index.cjs +1 -1
  29. package/dist/qy-input-number/index.mjs +4 -2
  30. package/dist/qy-legacy-selection-dialog/index.cjs +1 -1
  31. package/dist/qy-legacy-selection-dialog/index.mjs +1 -1
  32. package/dist/qy-menu-actions/index.cjs +1 -1
  33. package/dist/qy-menu-actions/index.mjs +2 -2
  34. package/dist/qy-money-input/index.cjs +1 -1
  35. package/dist/qy-money-input/index.mjs +2 -2
  36. package/dist/qy-radio-group/index.cjs +1 -1
  37. package/dist/qy-radio-group/index.mjs +1 -1
  38. package/dist/qy-record-quote-search/index.cjs +1 -1
  39. package/dist/qy-record-quote-search/index.mjs +2 -2
  40. package/dist/qy-remark-image/index.cjs +1 -1
  41. package/dist/qy-remark-image/index.mjs +2 -2
  42. package/dist/qy-remote-select/index.cjs +1 -1
  43. package/dist/qy-remote-select/index.mjs +1 -1
  44. package/dist/qy-search-input/index.cjs +1 -1
  45. package/dist/qy-search-input/index.mjs +1 -1
  46. package/dist/qy-select/index.cjs +1 -1
  47. package/dist/qy-select/index.mjs +4 -2
  48. package/dist/qy-selection-dialog/index.cjs +1 -1
  49. package/dist/qy-selection-dialog/index.mjs +2 -2
  50. package/dist/qy-table-column-settings/index.cjs +1 -1
  51. package/dist/qy-table-column-settings/index.mjs +2 -2
  52. package/dist/qy-tree-select/index.cjs +1 -1
  53. package/dist/qy-tree-select/index.mjs +4 -2
  54. package/dist/qy-upload/index.cjs +1 -1
  55. package/dist/qy-upload/index.mjs +1 -1
  56. package/dist/shared/_plugin-vue_export-helper-BHFhmbuH.cjs +1 -0
  57. package/dist/shared/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
  58. package/dist/shared/index-B3U7dqMt.cjs +1 -0
  59. package/dist/shared/index-BO5aWk3f.cjs +1 -0
  60. package/dist/shared/index-BXlQSIWX.mjs +119 -0
  61. package/dist/shared/index-BbpD7hM0.cjs +1 -0
  62. package/dist/shared/index-CRZsiNVW.cjs +1 -0
  63. package/dist/shared/index-CSxCewXP.mjs +127 -0
  64. package/dist/shared/index-CagHZ25z.mjs +162 -0
  65. package/dist/shared/index-D3l7tLgw.cjs +1 -0
  66. package/dist/shared/{index-BWIOoRpy.mjs → index-D7lMppIb.mjs} +1 -1
  67. package/dist/shared/index-DyK6vf5h.cjs +1 -0
  68. package/dist/shared/{index-B4JNbDHG.mjs → index-NCpeoBUZ.mjs} +1 -1
  69. package/dist/shared/index-ZLoAI88M.mjs +3418 -0
  70. package/dist/shared/index.vue_vue_type_script_setup_true_lang-5gku7Zwv.cjs +1 -0
  71. package/dist/shared/index.vue_vue_type_script_setup_true_lang-BJakDlgd.mjs +70 -0
  72. package/dist/shared/index.vue_vue_type_script_setup_true_lang-C-Pf9TJ0.mjs +152 -0
  73. package/dist/shared/index.vue_vue_type_script_setup_true_lang-CKp87br2.cjs +1 -0
  74. package/dist/shared/index.vue_vue_type_script_setup_true_lang-CelW13DE.cjs +1 -0
  75. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DA1Nh7U1.mjs +130 -0
  76. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DEpXmMj5.mjs +162 -0
  77. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DNEVwqm7.cjs +1 -0
  78. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DWS8bsiP.cjs +1 -0
  79. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DfKTEci_.cjs +1 -0
  80. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DoL8xnpo.mjs +48 -0
  81. package/dist/shared/index.vue_vue_type_script_setup_true_lang-EiHoQBXt.mjs +94 -0
  82. package/dist/shared/index.vue_vue_type_script_setup_true_lang-gTkP1LWg.mjs +61 -0
  83. package/dist/shared/index.vue_vue_type_script_setup_true_lang-svvSFv2K.cjs +1 -0
  84. package/dist/shared/index.vue_vue_type_style_index_0_lang-B_A4Nq6v.cjs +1 -0
  85. package/dist/shared/index.vue_vue_type_style_index_0_lang-DKFiK2fQ.mjs +152 -0
  86. package/dist/shared/install-CxBnxbuN.mjs +8 -0
  87. package/dist/shared/install-c8il9DQv.cjs +1 -0
  88. package/dist/shared/utils-D2KAQCCB.cjs +1 -0
  89. package/dist/shared/utils-DUntDntI.mjs +112 -0
  90. package/index.d.ts +45 -41
  91. package/package.json +41 -26
  92. package/qy-button/index.d.ts +34 -0
  93. package/qy-dropdown/index.d.ts +40 -0
  94. package/dist/shared/index-B7ZgDgHR.cjs +0 -1
  95. package/dist/shared/index-COjhEDRy.cjs +0 -1
  96. package/dist/shared/index-CQPIT5by.cjs +0 -1
  97. package/dist/shared/index-D6KfrXN6.mjs +0 -4429
  98. package/dist/shared/install-DMq9RQ-h.mjs +0 -15
  99. package/dist/shared/install-DNgKRKb2.cjs +0 -1
  100. package/qy-action-bar/index.js +0 -1
  101. package/qy-autocomplete/index.js +0 -1
  102. package/qy-checkbox/index.js +0 -1
  103. package/qy-date-picker/index.js +0 -1
  104. package/qy-dialog/index.js +0 -1
  105. package/qy-form-section/index.js +0 -1
  106. package/qy-image/index.js +0 -1
  107. package/qy-image-preview/index.js +0 -1
  108. package/qy-image-upload/index.js +0 -1
  109. package/qy-input/index.js +0 -1
  110. package/qy-input-number/index.js +0 -1
  111. package/qy-legacy-selection-dialog/index.js +0 -1
  112. package/qy-menu-actions/index.js +0 -7
  113. package/qy-money-input/index.js +0 -1
  114. package/qy-radio-group/index.js +0 -1
  115. package/qy-record-quote-search/index.js +0 -1
  116. package/qy-remark-image/index.js +0 -1
  117. package/qy-remote-select/index.js +0 -1
  118. package/qy-search-input/index.js +0 -1
  119. package/qy-select/index.js +0 -1
  120. package/qy-selection-dialog/index.js +0 -1
  121. package/qy-table-column-settings/index.js +0 -10
  122. package/qy-tree-select/index.js +0 -1
  123. package/qy-upload/index.js +0 -1
@@ -0,0 +1,94 @@
1
+ import { defineComponent as x, useAttrs as K, ref as M, computed as s, unref as r, openBlock as k, createBlock as q, mergeProps as F } from "vue";
2
+ import { ElAutocomplete as I } from "element-plus";
3
+ const T = /* @__PURE__ */ x({
4
+ name: "QyAutocomplete",
5
+ inheritAttrs: !1,
6
+ __name: "index",
7
+ props: {
8
+ modelValue: { default: "" },
9
+ options: { default: () => [] },
10
+ valueKey: { default: "value" },
11
+ labelKey: { default: "label" },
12
+ placeholder: { default: "请输入" },
13
+ disabled: { type: Boolean, default: !1 },
14
+ clearable: { type: Boolean, default: !0 },
15
+ size: { default: void 0 },
16
+ teleported: { type: Boolean, default: !0 },
17
+ appendTo: { default: "body" },
18
+ popperClass: { default: "" },
19
+ filterMethod: { type: Function, default: void 0 }
20
+ },
21
+ emits: ["update:modelValue", "input", "change", "select", "focus", "blur", "clear"],
22
+ setup(t, { expose: f, emit: p }) {
23
+ const n = t, u = p, i = K(), d = M(null), m = s(
24
+ () => ["qy-autocomplete__popper", n.popperClass].filter(Boolean).join(" ")
25
+ ), h = s(() => {
26
+ const e = r(n.options);
27
+ return (Array.isArray(e) ? e : r(e == null ? void 0 : e.value) || []).map((l) => ({
28
+ ...l,
29
+ value: (l == null ? void 0 : l[n.valueKey]) ?? (l == null ? void 0 : l.value) ?? (l == null ? void 0 : l[n.labelKey]) ?? (l == null ? void 0 : l.label) ?? ""
30
+ }));
31
+ });
32
+ function c(e, a) {
33
+ const l = String(e ?? ""), S = h.value.filter((o) => n.filterMethod ? n.filterMethod(l, o) : l ? String(o.value ?? "").includes(l) : !0);
34
+ a(S);
35
+ }
36
+ function b(e) {
37
+ u("update:modelValue", e);
38
+ }
39
+ function y(e) {
40
+ u("input", e);
41
+ }
42
+ function v(e) {
43
+ u("change", e);
44
+ }
45
+ function g(e) {
46
+ u("select", e);
47
+ }
48
+ function B(e) {
49
+ u("focus", e);
50
+ }
51
+ function C(e) {
52
+ u("blur", e);
53
+ }
54
+ function A() {
55
+ u("clear");
56
+ }
57
+ function V() {
58
+ var e, a;
59
+ (a = (e = d.value) == null ? void 0 : e.focus) == null || a.call(e);
60
+ }
61
+ function z() {
62
+ var e, a;
63
+ (a = (e = d.value) == null ? void 0 : e.blur) == null || a.call(e);
64
+ }
65
+ return f({
66
+ querySearch: c,
67
+ focus: V,
68
+ blur: z
69
+ }), (e, a) => (k(), q(r(I), F({
70
+ ref_key: "autocompleteRef",
71
+ ref: d
72
+ }, r(i), {
73
+ "model-value": t.modelValue,
74
+ "fetch-suggestions": c,
75
+ placeholder: t.placeholder,
76
+ disabled: t.disabled,
77
+ clearable: t.clearable,
78
+ size: t.size,
79
+ teleported: t.teleported,
80
+ "append-to": t.appendTo,
81
+ "popper-class": m.value,
82
+ "onUpdate:modelValue": b,
83
+ onInput: y,
84
+ onChange: v,
85
+ onSelect: g,
86
+ onFocus: B,
87
+ onBlur: C,
88
+ onClear: A
89
+ }), null, 16, ["model-value", "placeholder", "disabled", "clearable", "size", "teleported", "append-to", "popper-class"]));
90
+ }
91
+ });
92
+ export {
93
+ T as _
94
+ };
@@ -0,0 +1,61 @@
1
+ import { defineComponent as h, useAttrs as V, ref as g, computed as u, openBlock as x, createBlock as k, unref as y, mergeProps as B, withCtx as v, renderSlot as C } from "vue";
2
+ import { ElCheckbox as z } from "element-plus";
3
+ const F = /* @__PURE__ */ h({
4
+ name: "QyCheckbox",
5
+ inheritAttrs: !1,
6
+ __name: "index",
7
+ props: {
8
+ modelValue: { type: [String, Number, Boolean], default: !1 },
9
+ disabled: { type: Boolean, default: !1 },
10
+ size: { default: void 0 },
11
+ trueValue: { type: [String, Number, Boolean], default: !0 },
12
+ falseValue: { type: [String, Number, Boolean], default: !1 }
13
+ },
14
+ emits: ["update:modelValue", "change", "focus", "blur"],
15
+ setup(l, { expose: n, emit: r }) {
16
+ const t = l, a = r, s = V(), o = g(null), d = u(() => typeof t.trueValue == "boolean" && typeof t.falseValue == "boolean" ? {} : {
17
+ trueValue: t.trueValue,
18
+ falseValue: t.falseValue
19
+ }), f = u(() => ({
20
+ ...s,
21
+ ...d.value
22
+ }));
23
+ function c(e) {
24
+ a("update:modelValue", e);
25
+ }
26
+ function i(e) {
27
+ a("change", e);
28
+ }
29
+ function m(e) {
30
+ a("focus", e);
31
+ }
32
+ function p(e) {
33
+ a("blur", e);
34
+ }
35
+ function b() {
36
+ return o.value;
37
+ }
38
+ return n({
39
+ getCheckboxInstance: b
40
+ }), (e, S) => (x(), k(y(z), B({
41
+ ref_key: "checkboxRef",
42
+ ref: o
43
+ }, f.value, {
44
+ "model-value": l.modelValue,
45
+ disabled: l.disabled,
46
+ size: l.size,
47
+ "onUpdate:modelValue": c,
48
+ onChange: i,
49
+ onFocus: m,
50
+ onBlur: p
51
+ }), {
52
+ default: v(() => [
53
+ C(e.$slots, "default")
54
+ ]),
55
+ _: 3
56
+ }, 16, ["model-value", "disabled", "size"]));
57
+ }
58
+ });
59
+ export {
60
+ F as _
61
+ };
@@ -0,0 +1 @@
1
+ "use strict";const l=require("vue"),R=require("element-plus"),$=l.defineComponent({name:"QyDatePicker",inheritAttrs:!1,__name:"index",props:{modelValue:{default:void 0},type:{default:"date"},placeholder:{default:"请选择日期"},startPlaceholder:{default:"开始时间"},endPlaceholder:{default:"结束时间"},rangeSeparator:{default:"-"},format:{default:void 0},valueFormat:{default:void 0},defaultTime:{default:void 0},disabledDate:{type:Function,default:void 0},shortcuts:{default:void 0},clearable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},size:{default:void 0},teleported:{type:Boolean,default:!0},appendTo:{default:"body"},popperClass:{default:""},normalizeRangeEndTime:{type:Boolean,default:!1}},emits:["update:modelValue","change","clear","calendar-change","panel-change","visible-change","focus","blur"],setup(t,{expose:c,emit:i}){const r=t,n=i,s=l.useAttrs(),o=l.ref(null),f=l.computed(()=>["qy-date-picker__popper",r.popperClass].filter(Boolean).join(" "));function h(e){return Array.isArray(e)}function p(e){const a=new Date(e);return a.getHours()===0&&a.getMinutes()===0&&a.getSeconds()===0&&a.setHours(23,59,59,0),a}function m(e){return/\s00:00:00$/.test(e)?e.replace(/\s00:00:00$/," 23:59:59"):/T00:00:00(?:\.000)?(?:Z|[+-]\d{2}:?\d{2})?$/.test(e)?e.replace(/T00:00:00(\.000)?(Z|[+-]\d{2}:?\d{2})?$/,"T23:59:59$1$2"):e}function u(e){if(!r.normalizeRangeEndTime||!h(e)||e.length<2)return e;const a=[...e],d=a[1];return d instanceof Date?a[1]=p(d):typeof d=="string"&&(a[1]=m(d)),a}function g(e){n("update:modelValue",u(e))}function b(e){n("change",u(e))}function C(){n("clear")}function y(e){n("calendar-change",e)}function v(e,a,d){n("panel-change",e,a,d)}function P(e){n("visible-change",e)}function V(e){n("focus",e)}function z(e){n("blur",e)}function B(){var e,a;(a=(e=o.value)==null?void 0:e.focus)==null||a.call(e)}function T(){var e,a;(a=(e=o.value)==null?void 0:e.blur)==null||a.call(e)}function k(){var e,a;(a=(e=o.value)==null?void 0:e.handleOpen)==null||a.call(e)}function D(){var e,a;(a=(e=o.value)==null?void 0:e.handleClose)==null||a.call(e)}return c({focus:B,blur:T,handleOpen:k,handleClose:D}),(e,a)=>(l.openBlock(),l.createBlock(l.unref(R.ElDatePicker),l.mergeProps({ref_key:"datePickerRef",ref:o},l.unref(s),{"model-value":t.modelValue,type:t.type,placeholder:t.placeholder,"start-placeholder":t.startPlaceholder,"end-placeholder":t.endPlaceholder,"range-separator":t.rangeSeparator,format:t.format,"value-format":t.valueFormat,"default-time":t.defaultTime,"disabled-date":t.disabledDate,shortcuts:t.shortcuts,clearable:t.clearable,disabled:t.disabled,size:t.size,teleported:t.teleported,"append-to":t.appendTo,"popper-class":f.value,"onUpdate:modelValue":g,onChange:b,onClear:C,onCalendarChange:y,onPanelChange:v,onVisibleChange:P,onFocus:V,onBlur:z}),null,16,["model-value","type","placeholder","start-placeholder","end-placeholder","range-separator","format","value-format","default-time","disabled-date","shortcuts","clearable","disabled","size","teleported","append-to","popper-class"]))}});exports._sfc_main=$;
@@ -0,0 +1 @@
1
+ "use strict";const t=require("vue"),T=require("element-plus"),A=t.defineComponent({name:"QyInput",inheritAttrs:!1,__name:"index",props:{modelValue:{default:""},removeSpace:{type:Boolean,default:!1},trimMode:{default:"none"}},emits:["update:modelValue","input","change","focus","blur","clear","enter"],setup(d,{expose:p,emit:m}){const o=d,u=m,v=t.useAttrs(),l=t.ref(null),i=t.ref(a(o.modelValue)),r=t.ref("none"),h=t.computed(()=>a(o.modelValue));t.watch(()=>o.modelValue,e=>{i.value=a(e)});function a(e){return e==null?"":String(e)}function V(e){return o.removeSpace?e.replace(/\s+/g,""):e}function f(e,n){return o.trimMode!==n?e:e.trim()}function c(e){return V(a(e))}function s(e){i.value=e,u("update:modelValue",e)}function g(e){const n=c(e);if(n===""&&r.value==="clear"){r.value="update",i.value="";return}s(n),r.value=n===""?"update":"none"}function x(e){i.value=a(e),u("input",a(e))}function y(e){const n=f(c(e),"change");if(n===""&&r.value!=="none"){u("change",n);return}n!==a(o.modelValue)&&s(n),u("change",n)}function S(e){u("focus",e)}function C(e){const n=f(i.value,"blur");n!==a(o.modelValue)&&s(n),u("blur",e)}function $(){r.value==="none"&&s(""),r.value="clear",u("clear")}function k(e){u("enter",e)}function w(){var e,n;(n=(e=l.value)==null?void 0:e.focus)==null||n.call(e)}function I(){var e,n;(n=(e=l.value)==null?void 0:e.blur)==null||n.call(e)}function b(){var e,n;(n=(e=l.value)==null?void 0:e.select)==null||n.call(e)}function z(){var e,n;(n=(e=l.value)==null?void 0:e.clear)==null||n.call(e)}function B(){var e,n;(n=(e=l.value)==null?void 0:e.resizeTextarea)==null||n.call(e)}function q(){var e;return((e=l.value)==null?void 0:e.input)||null}function M(){var e;return((e=l.value)==null?void 0:e.textarea)||null}return p({focus:w,blur:I,select:b,clear:z,resizeTextarea:B,getNativeInput:q,getTextarea:M}),(e,n)=>(t.openBlock(),t.createBlock(t.unref(T.ElInput),t.mergeProps({ref_key:"inputRef",ref:l,class:"qy-input"},t.unref(v),{"model-value":h.value,"onUpdate:modelValue":g,onInput:x,onChange:y,onFocus:S,onBlur:C,onClear:$,onKeydown:t.withKeys(k,["enter"])}),t.createSlots({_:2},[e.$slots.prefix?{name:"prefix",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"prefix")]),key:"0"}:void 0,e.$slots.suffix?{name:"suffix",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"suffix")]),key:"1"}:void 0,e.$slots.prepend?{name:"prepend",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"prepend")]),key:"2"}:void 0,e.$slots.append?{name:"append",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"append")]),key:"3"}:void 0]),1040,["model-value"]))}});exports._sfc_main=A;
@@ -0,0 +1,152 @@
1
+ import { defineComponent as F, useAttrs as K, ref as c, computed as R, watch as U, openBlock as N, createBlock as P, unref as m, mergeProps as Q, withKeys as _, createSlots as j, withCtx as s, renderSlot as f } from "vue";
2
+ import { ElInput as D } from "element-plus";
3
+ const J = /* @__PURE__ */ F({
4
+ name: "QyInput",
5
+ inheritAttrs: !1,
6
+ __name: "index",
7
+ props: {
8
+ modelValue: { default: "" },
9
+ removeSpace: { type: Boolean, default: !1 },
10
+ trimMode: { default: "none" }
11
+ },
12
+ emits: ["update:modelValue", "input", "change", "focus", "blur", "clear", "enter"],
13
+ setup(v, { expose: h, emit: V }) {
14
+ const l = v, t = V, g = K(), u = c(null), r = c(a(l.modelValue)), o = c("none"), y = R(() => a(l.modelValue));
15
+ U(
16
+ () => l.modelValue,
17
+ (e) => {
18
+ r.value = a(e);
19
+ }
20
+ );
21
+ function a(e) {
22
+ return e == null ? "" : String(e);
23
+ }
24
+ function x(e) {
25
+ return l.removeSpace ? e.replace(/\s+/g, "") : e;
26
+ }
27
+ function p(e, n) {
28
+ return l.trimMode !== n ? e : e.trim();
29
+ }
30
+ function d(e) {
31
+ return x(a(e));
32
+ }
33
+ function i(e) {
34
+ r.value = e, t("update:modelValue", e);
35
+ }
36
+ function $(e) {
37
+ const n = d(e);
38
+ if (n === "" && o.value === "clear") {
39
+ o.value = "update", r.value = "";
40
+ return;
41
+ }
42
+ i(n), o.value = n === "" ? "update" : "none";
43
+ }
44
+ function k(e) {
45
+ r.value = a(e), t("input", a(e));
46
+ }
47
+ function S(e) {
48
+ const n = p(d(e), "change");
49
+ if (n === "" && o.value !== "none") {
50
+ t("change", n);
51
+ return;
52
+ }
53
+ n !== a(l.modelValue) && i(n), t("change", n);
54
+ }
55
+ function C(e) {
56
+ t("focus", e);
57
+ }
58
+ function I(e) {
59
+ const n = p(r.value, "blur");
60
+ n !== a(l.modelValue) && i(n), t("blur", e);
61
+ }
62
+ function b() {
63
+ o.value === "none" && i(""), o.value = "clear", t("clear");
64
+ }
65
+ function z(e) {
66
+ t("enter", e);
67
+ }
68
+ function B() {
69
+ var e, n;
70
+ (n = (e = u.value) == null ? void 0 : e.focus) == null || n.call(e);
71
+ }
72
+ function w() {
73
+ var e, n;
74
+ (n = (e = u.value) == null ? void 0 : e.blur) == null || n.call(e);
75
+ }
76
+ function M() {
77
+ var e, n;
78
+ (n = (e = u.value) == null ? void 0 : e.select) == null || n.call(e);
79
+ }
80
+ function T() {
81
+ var e, n;
82
+ (n = (e = u.value) == null ? void 0 : e.clear) == null || n.call(e);
83
+ }
84
+ function q() {
85
+ var e, n;
86
+ (n = (e = u.value) == null ? void 0 : e.resizeTextarea) == null || n.call(e);
87
+ }
88
+ function A() {
89
+ var e;
90
+ return ((e = u.value) == null ? void 0 : e.input) || null;
91
+ }
92
+ function E() {
93
+ var e;
94
+ return ((e = u.value) == null ? void 0 : e.textarea) || null;
95
+ }
96
+ return h({
97
+ // 暴露 Element Plus 常用输入框方法,方便业务弹窗做聚焦、选中和 textarea 重算高度。
98
+ focus: B,
99
+ blur: w,
100
+ select: M,
101
+ clear: T,
102
+ resizeTextarea: q,
103
+ getNativeInput: A,
104
+ getTextarea: E
105
+ }), (e, n) => (N(), P(m(D), Q({
106
+ ref_key: "inputRef",
107
+ ref: u,
108
+ class: "qy-input"
109
+ }, m(g), {
110
+ "model-value": y.value,
111
+ "onUpdate:modelValue": $,
112
+ onInput: k,
113
+ onChange: S,
114
+ onFocus: C,
115
+ onBlur: I,
116
+ onClear: b,
117
+ onKeydown: _(z, ["enter"])
118
+ }), j({ _: 2 }, [
119
+ e.$slots.prefix ? {
120
+ name: "prefix",
121
+ fn: s(() => [
122
+ f(e.$slots, "prefix")
123
+ ]),
124
+ key: "0"
125
+ } : void 0,
126
+ e.$slots.suffix ? {
127
+ name: "suffix",
128
+ fn: s(() => [
129
+ f(e.$slots, "suffix")
130
+ ]),
131
+ key: "1"
132
+ } : void 0,
133
+ e.$slots.prepend ? {
134
+ name: "prepend",
135
+ fn: s(() => [
136
+ f(e.$slots, "prepend")
137
+ ]),
138
+ key: "2"
139
+ } : void 0,
140
+ e.$slots.append ? {
141
+ name: "append",
142
+ fn: s(() => [
143
+ f(e.$slots, "append")
144
+ ]),
145
+ key: "3"
146
+ } : void 0
147
+ ]), 1040, ["model-value"]));
148
+ }
149
+ });
150
+ export {
151
+ J as _
152
+ };
@@ -0,0 +1,8 @@
1
+ function a(r, i = r == null ? void 0 : r.name) {
2
+ return i && (r.install = (l) => {
3
+ l.component(i, r);
4
+ }), r;
5
+ }
6
+ export {
7
+ a as w
8
+ };
@@ -0,0 +1 @@
1
+ "use strict";function s(i,l=i==null?void 0:i.name){return l&&(i.install=r=>{r.component(l,i)}),i}exports.withInstall=s;
@@ -0,0 +1 @@
1
+ "use strict";const u=require("vue"),m=require("element-plus"),f={w:200,h:200,q:50};function l(t){const r=String(t||"").trim();return r?r.includes("ys.diansan.com")?r.replace(/^http:\/\//,"https://").replace("ys.diansan.com","admin.qiyinbz.com"):r:""}function h(t,r=!0){const n=String(t||"").trim();if(!n)return"";const e=l(n);if(!r)return e;const o=d(r);return n.includes("ys.diansan.com")?`${e}?small=true&style=image/resize,h_${o.h},w_${o.w}`:`${e}?w=${o.w}`}async function w(t,r={}){const n=l(t);if(!n)throw new Error("图片地址不能为空");const e=r.compressor??!0;if(!e)return{src:n,source:"original"};const o=h(t,e),i=r.loadBlob??b,a=r.compressBlob??I;try{return await i(o),{src:o,source:"thumbnail"}}catch{const c=await i(n);return{src:await a(c,d(e)),source:"fallback"}}}function y(t={}){if(typeof document>"u")return{close(){}};const r=g(t.urlList,t.url);if(!r.length)return{close(){}};const n=globalThis.__QY_IMAGE_PREVIEW_CREATE_APP__??u.createApp,e=document.createElement("div"),o=document.body.style.overflow;let i=!1,a;const c=()=>{var s;i||(i=!0,document.body.style.overflow=o,(s=a==null?void 0:a.unmount)==null||s.call(a),e.parentNode&&e.parentNode.removeChild(e))};return document.body.appendChild(e),document.body.style.overflow="hidden",a=n({setup(){return()=>u.h(m.ElImageViewer,{urlList:r,initialIndex:t.initialIndex??0,hideOnClickModal:t.hideOnClickModal??!0,teleport:"body",onClose:c})}}),a.mount(e),{close:c}}function d(t){return{...f,...typeof t=="object"?t:{}}}function g(t,r){return(Array.isArray(t)?t:[r]).map(e=>l(e)).filter(Boolean)}async function b(t){const r=await fetch(t,{redirect:"follow"});if(!r.ok)throw new Error(t);return r.blob()}async function I(t,r){if(typeof document>"u"||typeof Image>"u")return R(t);const n=URL.createObjectURL(t);try{const e=await p(n),o=document.createElement("canvas"),i=v(e,r);return o.width=Math.max(1,Math.round(e.naturalWidth*i)),o.height=Math.max(1,Math.round(e.naturalHeight*i)),o.getContext("2d").drawImage(e,0,0,o.width,o.height),o.toDataURL(t.type||"image/jpeg",r.q/100)}finally{URL.revokeObjectURL(n)}}function p(t){return new Promise((r,n)=>{const e=new Image;e.onload=()=>r(e),e.onerror=n,e.src=t})}function v(t,r){const n=r.w?r.w/t.naturalWidth:1,e=r.h?r.h/t.naturalHeight:1;return Math.min(1,n,e)}function R(t){return new Promise((r,n)=>{const e=new FileReader;e.onloadend=()=>r(e.result),e.onerror=n,e.readAsDataURL(t)})}exports.normalizeImageSrc=l;exports.openQyImagePreview=y;exports.resolveQyImageDisplaySrc=w;
@@ -0,0 +1,112 @@
1
+ import { h as d, createApp as m } from "vue";
2
+ import { ElImageViewer as f } from "element-plus";
3
+ const h = {
4
+ w: 200,
5
+ h: 200,
6
+ q: 50
7
+ };
8
+ function l(t) {
9
+ const r = String(t || "").trim();
10
+ return r ? r.includes("ys.diansan.com") ? r.replace(/^http:\/\//, "https://").replace("ys.diansan.com", "admin.qiyinbz.com") : r : "";
11
+ }
12
+ function w(t, r = !0) {
13
+ const n = String(t || "").trim();
14
+ if (!n) return "";
15
+ const e = l(n);
16
+ if (!r) return e;
17
+ const o = u(r);
18
+ return n.includes("ys.diansan.com") ? `${e}?small=true&style=image/resize,h_${o.h},w_${o.w}` : `${e}?w=${o.w}`;
19
+ }
20
+ async function S(t, r = {}) {
21
+ const n = l(t);
22
+ if (!n) throw new Error("图片地址不能为空");
23
+ const e = r.compressor ?? !0;
24
+ if (!e)
25
+ return {
26
+ src: n,
27
+ source: "original"
28
+ };
29
+ const o = w(t, e), i = r.loadBlob ?? g, a = r.compressBlob ?? b;
30
+ try {
31
+ return await i(o), {
32
+ src: o,
33
+ source: "thumbnail"
34
+ };
35
+ } catch {
36
+ const c = await i(n);
37
+ return {
38
+ src: await a(c, u(e)),
39
+ source: "fallback"
40
+ };
41
+ }
42
+ }
43
+ function _(t = {}) {
44
+ if (typeof document > "u") return { close() {
45
+ } };
46
+ const r = y(t.urlList, t.url);
47
+ if (!r.length) return { close() {
48
+ } };
49
+ const n = globalThis.__QY_IMAGE_PREVIEW_CREATE_APP__ ?? m, e = document.createElement("div"), o = document.body.style.overflow;
50
+ let i = !1, a;
51
+ const c = () => {
52
+ var s;
53
+ i || (i = !0, document.body.style.overflow = o, (s = a == null ? void 0 : a.unmount) == null || s.call(a), e.parentNode && e.parentNode.removeChild(e));
54
+ };
55
+ return document.body.appendChild(e), document.body.style.overflow = "hidden", a = n({
56
+ setup() {
57
+ return () => d(f, {
58
+ urlList: r,
59
+ initialIndex: t.initialIndex ?? 0,
60
+ hideOnClickModal: t.hideOnClickModal ?? !0,
61
+ teleport: "body",
62
+ onClose: c
63
+ });
64
+ }
65
+ }), a.mount(e), { close: c };
66
+ }
67
+ function u(t) {
68
+ return {
69
+ ...h,
70
+ ...typeof t == "object" ? t : {}
71
+ };
72
+ }
73
+ function y(t, r) {
74
+ return (Array.isArray(t) ? t : [r]).map((e) => l(e)).filter(Boolean);
75
+ }
76
+ async function g(t) {
77
+ const r = await fetch(t, { redirect: "follow" });
78
+ if (!r.ok) throw new Error(t);
79
+ return r.blob();
80
+ }
81
+ async function b(t, r) {
82
+ if (typeof document > "u" || typeof Image > "u")
83
+ return v(t);
84
+ const n = URL.createObjectURL(t);
85
+ try {
86
+ const e = await p(n), o = document.createElement("canvas"), i = I(e, r);
87
+ return o.width = Math.max(1, Math.round(e.naturalWidth * i)), o.height = Math.max(1, Math.round(e.naturalHeight * i)), o.getContext("2d").drawImage(e, 0, 0, o.width, o.height), o.toDataURL(t.type || "image/jpeg", r.q / 100);
88
+ } finally {
89
+ URL.revokeObjectURL(n);
90
+ }
91
+ }
92
+ function p(t) {
93
+ return new Promise((r, n) => {
94
+ const e = new Image();
95
+ e.onload = () => r(e), e.onerror = n, e.src = t;
96
+ });
97
+ }
98
+ function I(t, r) {
99
+ const n = r.w ? r.w / t.naturalWidth : 1, e = r.h ? r.h / t.naturalHeight : 1;
100
+ return Math.min(1, n, e);
101
+ }
102
+ function v(t) {
103
+ return new Promise((r, n) => {
104
+ const e = new FileReader();
105
+ e.onloadend = () => r(e.result), e.onerror = n, e.readAsDataURL(t);
106
+ });
107
+ }
108
+ export {
109
+ l as n,
110
+ _ as o,
111
+ S as r
112
+ };
package/index.d.ts CHANGED
@@ -1,26 +1,28 @@
1
1
  import type { App, Plugin } from 'vue'
2
2
 
3
3
  // 根入口类型声明,对应 @qynpm/ui 的命名导出和 app.use(QyUI) 整包注册。
4
- export const QyUpload: Plugin
5
- export const QyImage: Plugin
6
- export const QyImagePreview: Plugin
7
- export const QyImageUpload: Plugin
4
+ export const QyUpload: Plugin
5
+ export const QyImage: Plugin
6
+ export const QyImagePreview: Plugin
7
+ export const QyImageUpload: Plugin
8
8
  export const QyDialog: Plugin
9
+ export const QyButton: Plugin
10
+ export const QyDropdown: Plugin
9
11
  export const QyInput: Plugin
10
12
  export const QyInputNumber: Plugin
11
- export const QyMoneyInput: Plugin
12
- export const QyDatePicker: Plugin
13
- export const QyCheckbox: Plugin
14
- export const QyAutocomplete: Plugin
15
- export const QyMenuActions: Plugin
16
- export const QyTableColumnSettings: Plugin
17
- export const QyRadioGroup: Plugin
13
+ export const QyMoneyInput: Plugin
14
+ export const QyDatePicker: Plugin
15
+ export const QyCheckbox: Plugin
16
+ export const QyAutocomplete: Plugin
17
+ export const QyMenuActions: Plugin
18
+ export const QyTableColumnSettings: Plugin
19
+ export const QyRadioGroup: Plugin
18
20
  export const QyRemoteSelect: Plugin
19
- export const QySearchInput: Plugin
20
- export const QyRecordQuoteSearch: Plugin
21
- export const QySelect: Plugin
22
- export const QyTreeSelect: Plugin
23
- export const QySelectionDialog: Plugin
21
+ export const QySearchInput: Plugin
22
+ export const QyRecordQuoteSearch: Plugin
23
+ export const QySelect: Plugin
24
+ export const QyTreeSelect: Plugin
25
+ export const QySelectionDialog: Plugin
24
26
  export const QyLegacySelectionDialog: Plugin
25
27
  export const QyFormSection: Plugin
26
28
  export const QyActionBar: Plugin
@@ -30,38 +32,40 @@ export function parseRemarkText(remarkText: string): {
30
32
  text: string
31
33
  }
32
34
  export function formatRemarkText(text: string): string
33
- export function parseRemarkWithImage(text: string, imageUrl?: string): string
34
- export function openQyImagePreview(options: {
35
- url?: string
36
- urlList?: string[]
37
- initialIndex?: number
38
- hideOnClickModal?: boolean
39
- }): {
40
- close(): void
41
- }
35
+ export function parseRemarkWithImage(text: string, imageUrl?: string): string
36
+ export function openQyImagePreview(options: {
37
+ url?: string
38
+ urlList?: string[]
39
+ initialIndex?: number
40
+ hideOnClickModal?: boolean
41
+ }): {
42
+ close(): void
43
+ }
42
44
 
43
45
  declare const _default: Plugin & {
44
46
  install(app: App): void
45
- QyUpload: typeof QyUpload
46
- QyImage: typeof QyImage
47
- QyImagePreview: typeof QyImagePreview
48
- QyImageUpload: typeof QyImageUpload
47
+ QyUpload: typeof QyUpload
48
+ QyImage: typeof QyImage
49
+ QyImagePreview: typeof QyImagePreview
50
+ QyImageUpload: typeof QyImageUpload
49
51
  QyDialog: typeof QyDialog
52
+ QyButton: typeof QyButton
53
+ QyDropdown: typeof QyDropdown
50
54
  QyInput: typeof QyInput
51
55
  QyInputNumber: typeof QyInputNumber
52
- QyMoneyInput: typeof QyMoneyInput
53
- QyDatePicker: typeof QyDatePicker
54
- QyCheckbox: typeof QyCheckbox
55
- QyAutocomplete: typeof QyAutocomplete
56
- QyMenuActions: typeof QyMenuActions
57
- QyTableColumnSettings: typeof QyTableColumnSettings
58
- QyRadioGroup: typeof QyRadioGroup
56
+ QyMoneyInput: typeof QyMoneyInput
57
+ QyDatePicker: typeof QyDatePicker
58
+ QyCheckbox: typeof QyCheckbox
59
+ QyAutocomplete: typeof QyAutocomplete
60
+ QyMenuActions: typeof QyMenuActions
61
+ QyTableColumnSettings: typeof QyTableColumnSettings
62
+ QyRadioGroup: typeof QyRadioGroup
59
63
  QyRemoteSelect: typeof QyRemoteSelect
60
- QySearchInput: typeof QySearchInput
61
- QyRecordQuoteSearch: typeof QyRecordQuoteSearch
62
- QySelect: typeof QySelect
63
- QyTreeSelect: typeof QyTreeSelect
64
- QySelectionDialog: typeof QySelectionDialog
64
+ QySearchInput: typeof QySearchInput
65
+ QyRecordQuoteSearch: typeof QyRecordQuoteSearch
66
+ QySelect: typeof QySelect
67
+ QyTreeSelect: typeof QyTreeSelect
68
+ QySelectionDialog: typeof QySelectionDialog
65
69
  QyLegacySelectionDialog: typeof QyLegacySelectionDialog
66
70
  QyFormSection: typeof QyFormSection
67
71
  QyActionBar: typeof QyActionBar
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qynpm/ui",
3
- "version": "1.0.21",
3
+ "version": "1.0.23",
4
4
  "description": "起印公共 UI 组件包。",
5
5
  "author": "qy",
6
6
  "license": "MIT",
@@ -38,6 +38,16 @@
38
38
  "import": "./dist/qy-dialog/index.mjs",
39
39
  "require": "./dist/qy-dialog/index.cjs"
40
40
  },
41
+ "./qy-button": {
42
+ "types": "./qy-button/index.d.ts",
43
+ "import": "./dist/qy-button/index.mjs",
44
+ "require": "./dist/qy-button/index.cjs"
45
+ },
46
+ "./qy-dropdown": {
47
+ "types": "./qy-dropdown/index.d.ts",
48
+ "import": "./dist/qy-dropdown/index.mjs",
49
+ "require": "./dist/qy-dropdown/index.cjs"
50
+ },
41
51
  "./qy-input": {
42
52
  "types": "./qy-input/index.d.ts",
43
53
  "import": "./dist/qy-input/index.mjs",
@@ -138,30 +148,32 @@
138
148
  "index.d.ts",
139
149
  "dist",
140
150
  "README.md",
141
- "qy-upload",
142
- "qy-image",
143
- "qy-image-preview",
144
- "qy-image-upload",
145
- "qy-dialog",
146
- "qy-input",
147
- "qy-input-number",
148
- "qy-money-input",
149
- "qy-date-picker",
150
- "qy-checkbox",
151
- "qy-autocomplete",
152
- "qy-menu-actions",
153
- "qy-table-column-settings",
154
- "qy-radio-group",
155
- "qy-remote-select",
156
- "qy-search-input",
157
- "qy-record-quote-search",
158
- "qy-select",
159
- "qy-tree-select",
160
- "qy-selection-dialog",
161
- "qy-legacy-selection-dialog",
162
- "qy-form-section",
163
- "qy-action-bar",
164
- "qy-remark-image"
151
+ "qy-upload/index.d.ts",
152
+ "qy-image/index.d.ts",
153
+ "qy-image-preview/index.d.ts",
154
+ "qy-image-upload/index.d.ts",
155
+ "qy-dialog/index.d.ts",
156
+ "qy-button/index.d.ts",
157
+ "qy-dropdown/index.d.ts",
158
+ "qy-input/index.d.ts",
159
+ "qy-input-number/index.d.ts",
160
+ "qy-money-input/index.d.ts",
161
+ "qy-date-picker/index.d.ts",
162
+ "qy-checkbox/index.d.ts",
163
+ "qy-autocomplete/index.d.ts",
164
+ "qy-menu-actions/index.d.ts",
165
+ "qy-table-column-settings/index.d.ts",
166
+ "qy-radio-group/index.d.ts",
167
+ "qy-remote-select/index.d.ts",
168
+ "qy-search-input/index.d.ts",
169
+ "qy-record-quote-search/index.d.ts",
170
+ "qy-select/index.d.ts",
171
+ "qy-tree-select/index.d.ts",
172
+ "qy-selection-dialog/index.d.ts",
173
+ "qy-legacy-selection-dialog/index.d.ts",
174
+ "qy-form-section/index.d.ts",
175
+ "qy-action-bar/index.d.ts",
176
+ "qy-remark-image/index.d.ts"
165
177
  ],
166
178
  "publishConfig": {
167
179
  "access": "public"
@@ -182,16 +194,19 @@
182
194
  "@element-plus/icons-vue": "^2.0.0",
183
195
  "@iconify/json": "*",
184
196
  "@vitejs/plugin-vue": "^5.0.0",
197
+ "@vue/test-utils": "^2.4.6",
185
198
  "@vueuse/core": "^10.0.0",
186
199
  "autoprefixer": "^10.4.0",
187
200
  "clsx": "^2.0.0",
188
201
  "element-plus": "^2.0.0",
202
+ "happy-dom": "^17.6.3",
189
203
  "sass": "^1.70.0",
190
204
  "tailwindcss": "3.4.6",
191
205
  "unplugin-auto-import": "^0.18.0",
192
206
  "unplugin-vue-components": "^0.27.0",
193
207
  "vite": "^5.0.0",
194
- "vite-plugin-css-injected-by-js": "^3.5.2"
208
+ "vite-plugin-css-injected-by-js": "^3.5.2",
209
+ "vitest": "^3.2.2"
195
210
  },
196
211
  "scripts": {
197
212
  "dev": "vite",