@qynpm/ui 1.0.6 → 1.0.8

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 (85) hide show
  1. package/dist/index.cjs +2 -2
  2. package/dist/index.mjs +21 -54
  3. package/dist/qy-action-bar/index.cjs +1 -1
  4. package/dist/qy-action-bar/index.mjs +2 -4
  5. package/dist/qy-date-picker/index.cjs +1 -0
  6. package/dist/qy-date-picker/index.mjs +4 -0
  7. package/dist/qy-dialog/index.cjs +1 -1
  8. package/dist/qy-dialog/index.mjs +2 -4
  9. package/dist/qy-form-section/index.cjs +1 -1
  10. package/dist/qy-form-section/index.mjs +2 -4
  11. package/dist/qy-input/index.cjs +1 -1
  12. package/dist/qy-input/index.mjs +2 -4
  13. package/dist/qy-input-number/index.cjs +1 -0
  14. package/dist/qy-input-number/index.mjs +4 -0
  15. package/dist/qy-money-input/index.cjs +1 -1
  16. package/dist/qy-money-input/index.mjs +2 -4
  17. package/dist/qy-radio-group/index.cjs +1 -1
  18. package/dist/qy-radio-group/index.mjs +2 -4
  19. package/dist/qy-record-quote-search/index.cjs +1 -1
  20. package/dist/qy-record-quote-search/index.mjs +2 -4
  21. package/dist/qy-remark-image/index.cjs +1 -1
  22. package/dist/qy-remark-image/index.mjs +2 -4
  23. package/dist/qy-remote-select/index.cjs +1 -1
  24. package/dist/qy-remote-select/index.mjs +2 -4
  25. package/dist/qy-search-input/index.cjs +1 -1
  26. package/dist/qy-search-input/index.mjs +2 -4
  27. package/dist/qy-select/index.cjs +1 -1
  28. package/dist/qy-select/index.mjs +2 -4
  29. package/dist/qy-upload/index.cjs +1 -1
  30. package/dist/qy-upload/index.mjs +2 -4
  31. package/dist/qy-voucher-upload/index.cjs +1 -1
  32. package/dist/qy-voucher-upload/index.mjs +2 -4
  33. package/dist/shared/index-C5EAafC0.cjs +1 -0
  34. package/dist/shared/index-DB0Fuuxi.mjs +2784 -0
  35. package/index.d.ts +20 -16
  36. package/package.json +13 -1
  37. package/qy-action-bar/index.js +1 -4
  38. package/qy-date-picker/index.d.ts +5 -0
  39. package/qy-date-picker/index.js +1 -0
  40. package/qy-dialog/index.js +1 -4
  41. package/qy-form-section/index.js +1 -4
  42. package/qy-input/index.js +1 -4
  43. package/qy-input-number/index.d.ts +5 -0
  44. package/qy-input-number/index.js +1 -0
  45. package/qy-money-input/index.js +1 -15
  46. package/qy-radio-group/index.js +1 -15
  47. package/qy-record-quote-search/index.js +1 -4
  48. package/qy-remark-image/index.js +1 -4
  49. package/qy-remote-select/index.js +1 -15
  50. package/qy-search-input/index.js +1 -4
  51. package/qy-select/index.js +1 -4
  52. package/qy-upload/index.js +1 -4
  53. package/qy-voucher-upload/index.js +1 -15
  54. package/dist/shared/_plugin-vue_export-helper-BHFhmbuH.cjs +0 -1
  55. package/dist/shared/_plugin-vue_export-helper-CHgC5LLL.mjs +0 -9
  56. package/dist/shared/index-Bw9kVFsm.mjs +0 -56
  57. package/dist/shared/index-BzV4959-.mjs +0 -205
  58. package/dist/shared/index-C0ADdL4S.mjs +0 -88
  59. package/dist/shared/index-CBSjmD0C.mjs +0 -217
  60. package/dist/shared/index-CJb1S7CP.cjs +0 -1
  61. package/dist/shared/index-CO8lz02r.cjs +0 -1
  62. package/dist/shared/index-ClPxDFKd.cjs +0 -1
  63. package/dist/shared/index-CtOqRiaj.cjs +0 -1
  64. package/dist/shared/index-DXB7_Tb5.cjs +0 -1
  65. package/dist/shared/index-DeWkPj3O.mjs +0 -484
  66. package/dist/shared/index-PUYQxK94.mjs +0 -123
  67. package/dist/shared/index-UzZbxoqZ.cjs +0 -1
  68. package/dist/shared/index-a90QeEC4.cjs +0 -1
  69. package/dist/shared/index-wW02nNOp.mjs +0 -277
  70. package/dist/shared/index.vue_vue_type_script_setup_true_lang-BcZg8D-y.mjs +0 -214
  71. package/dist/shared/index.vue_vue_type_script_setup_true_lang-BmeBeCu0.mjs +0 -162
  72. package/dist/shared/index.vue_vue_type_script_setup_true_lang-C85575cL.cjs +0 -1
  73. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DkYwdYdF.mjs +0 -90
  74. package/dist/shared/index.vue_vue_type_script_setup_true_lang-Do5SZ8yS.cjs +0 -1
  75. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DpZzyX5f.cjs +0 -1
  76. package/dist/shared/index.vue_vue_type_script_setup_true_lang-DuUkOqwY.cjs +0 -1
  77. package/dist/shared/index.vue_vue_type_script_setup_true_lang-Dvh1BFaR.mjs +0 -143
  78. package/dist/shared/index.vue_vue_type_script_setup_true_lang-RtfqJ73A.mjs +0 -171
  79. package/dist/shared/index.vue_vue_type_script_setup_true_lang-VVjCLNMD.cjs +0 -1
  80. package/dist/shared/index.vue_vue_type_style_index_0_lang-DpIL_6vO.mjs +0 -325
  81. package/dist/shared/index.vue_vue_type_style_index_0_lang-haqCjB5x.cjs +0 -1
  82. package/dist/shared/install-CxBnxbuN.mjs +0 -8
  83. package/dist/shared/install-c8il9DQv.cjs +0 -1
  84. package/dist/shared/js.cookie-CojEIxHg.cjs +0 -1
  85. package/dist/shared/js.cookie-OLEfuq_g.mjs +0 -74
@@ -1,90 +0,0 @@
1
- import { defineComponent as z, useAttrs as G, ref as $, computed as t, createBlock as f, openBlock as u, unref as n, mergeProps as m, withCtx as b, renderSlot as c, createElementBlock as E, Fragment as S, renderList as _, resolveDynamicComponent as w, createTextVNode as P, toDisplayString as A } from "vue";
2
- import { ElRadioButton as D, ElRadio as N, ElRadioGroup as O } from "element-plus";
3
- const I = /* @__PURE__ */ z({
4
- name: "QyRadioGroup",
5
- inheritAttrs: !1,
6
- __name: "index",
7
- props: {
8
- modelValue: { type: [String, Number, Boolean, null], default: void 0 },
9
- options: { default: () => [] },
10
- labelKey: { default: "label" },
11
- valueKey: { default: "value" },
12
- disabledKey: { default: "disabled" },
13
- disabled: { type: Boolean, default: !1 },
14
- size: { default: "default" },
15
- name: { default: void 0 },
16
- type: { default: "radio" },
17
- border: { type: Boolean, default: !1 }
18
- },
19
- emits: ["update:modelValue", "change"],
20
- setup(v, { expose: y, emit: i }) {
21
- const a = v, r = i, g = G(), s = $(null), h = t(
22
- () => a.type === "button" ? D : N
23
- ), B = t(
24
- () => (a.options || []).map((e) => ({
25
- raw: e,
26
- label: (e == null ? void 0 : e[a.labelKey]) ?? (e == null ? void 0 : e.label) ?? (e == null ? void 0 : e.value) ?? "",
27
- value: (e == null ? void 0 : e[a.valueKey]) ?? (e == null ? void 0 : e.value) ?? (e == null ? void 0 : e.label),
28
- disabled: !!(e != null && e[a.disabledKey])
29
- }))
30
- );
31
- function R(e) {
32
- const d = {
33
- value: e.value,
34
- label: e.value,
35
- disabled: e.disabled
36
- };
37
- return a.type === "button" ? d : {
38
- ...d,
39
- border: a.border
40
- };
41
- }
42
- function k(e, d) {
43
- return `${String(e.value ?? e.label ?? "")}-${d}`;
44
- }
45
- function o(e) {
46
- r("update:modelValue", e);
47
- }
48
- function K(e) {
49
- r("change", e);
50
- }
51
- function V() {
52
- return s.value;
53
- }
54
- return y({
55
- getRadioGroupInstance: V
56
- }), (e, d) => (u(), f(n(O), m({
57
- ref_key: "radioGroupRef",
58
- ref: s
59
- }, n(g), {
60
- "model-value": e.modelValue,
61
- disabled: e.disabled,
62
- size: e.size,
63
- name: e.name,
64
- "onUpdate:modelValue": o,
65
- onChange: K
66
- }), {
67
- default: b(() => [
68
- e.$slots.default ? c(e.$slots, "default", { key: 0 }) : (u(!0), E(S, { key: 1 }, _(B.value, (l, C) => (u(), f(w(h.value), m({
69
- key: k(l, C)
70
- }, { ref_for: !0 }, R(l)), {
71
- default: b(() => [
72
- c(e.$slots, "option", {
73
- option: l.raw,
74
- label: l.label,
75
- value: l.value,
76
- disabled: l.disabled
77
- }, () => [
78
- P(A(l.label), 1)
79
- ])
80
- ]),
81
- _: 2
82
- }, 1040))), 128))
83
- ]),
84
- _: 3
85
- }, 16, ["model-value", "disabled", "size", "name"]));
86
- }
87
- });
88
- export {
89
- I as _
90
- };
@@ -1 +0,0 @@
1
- "use strict";const t=require("vue"),T=require("element-plus"),q=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(c,{expose:d,emit:p}){const a=c,u=p,m=t.useAttrs(),l=t.ref(null),r=t.ref(o(a.modelValue)),h=t.computed(()=>o(a.modelValue));t.watch(()=>a.modelValue,e=>{r.value=o(e)});function o(e){return e==null?"":String(e)}function v(e){return a.removeSpace?e.replace(/\s+/g,""):e}function s(e,n){return a.trimMode!==n?e:e.trim()}function f(e){return v(o(e))}function i(e){r.value=e,u("update:modelValue",e)}function V(e){const n=f(e);i(n)}function x(e){r.value=o(e),u("input",o(e))}function g(e){const n=s(f(e),"change");n!==o(a.modelValue)&&i(n),u("change",n)}function y(e){u("focus",e)}function C(e){const n=s(r.value,"blur");n!==o(a.modelValue)&&i(n),u("blur",e)}function S(){r.value="",u("update:modelValue",""),u("clear")}function $(e){u("enter",e)}function k(){var e,n;(n=(e=l.value)==null?void 0:e.focus)==null||n.call(e)}function w(){var e,n;(n=(e=l.value)==null?void 0:e.blur)==null||n.call(e)}function I(){var e,n;(n=(e=l.value)==null?void 0:e.select)==null||n.call(e)}function b(){var e,n;(n=(e=l.value)==null?void 0:e.clear)==null||n.call(e)}function z(){var e,n;(n=(e=l.value)==null?void 0:e.resizeTextarea)==null||n.call(e)}function B(){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 d({focus:k,blur:w,select:I,clear:b,resizeTextarea:z,getNativeInput:B,getTextarea:M}),(e,n)=>(t.openBlock(),t.createBlock(t.unref(T.ElInput),t.mergeProps({ref_key:"inputRef",ref:l},t.unref(m),{"model-value":h.value,"onUpdate:modelValue":V,onInput:x,onChange:g,onFocus:y,onBlur:C,onClear:S,onKeydown:t.withKeys($,["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=q;
@@ -1 +0,0 @@
1
- "use strict";const l=require("vue"),n=require("element-plus"),T=l.defineComponent({name:"QySelect",inheritAttrs:!1,__name:"index",props:{modelValue:{type:[String,Number,Boolean,Array,null],default:void 0},options:{default:()=>[]},labelKey:{default:"label"},valueKey:{default:"value"},disabledKey:{default:"disabled"},placeholder:{default:"请选择"},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},filterable:{type:Boolean,default:!1},multiple:{type:Boolean,default:!1},collapseTags:{type:Boolean,default:!1},collapseTagsTooltip:{type:Boolean,default:!1},autoSelectSingle:{type:Boolean,default:!1},size:{default:"default"},teleported:{type:Boolean,default:!0},appendTo:{default:"body"},fitInputWidth:{type:Boolean,default:!0},popperClass:{default:""}},emits:["update:modelValue","change","clear","visible-change","focus","blur"],setup(o,{expose:f,emit:i}){const t=o,u=i,c=l.useAttrs(),p=l.useSlots(),r=l.ref(null),m=l.computed(()=>["qy-select__popper",t.popperClass].filter(Boolean).join(" ")),d=l.computed(()=>(t.options||[]).map(e=>({raw:e,label:(e==null?void 0:e[t.labelKey])??(e==null?void 0:e.label)??(e==null?void 0:e.value)??"",value:(e==null?void 0:e[t.valueKey])??(e==null?void 0:e.value)??(e==null?void 0:e.label),disabled:!!(e!=null&&e[t.disabledKey])}))),b=l.computed(()=>{const e=p.default;return e?e().some(a=>a.type!==l.Comment):!1});function y(e){return Array.isArray(e)?e.length===0:e===""||e===null||e===void 0}l.watch([d,()=>t.modelValue,()=>t.autoSelectSingle,()=>t.disabled,()=>t.multiple],([e])=>{if(!t.autoSelectSingle||t.disabled||!y(t.modelValue)||e.length!==1)return;const[a]=e;if(a.disabled)return;const s=t.multiple?[a.value]:a.value;u("update:modelValue",s),u("change",s)},{immediate:!0});function g(e,a){return`${String(e.value??e.label??"")}-${a}`}function h(e){u("update:modelValue",e)}function v(e){u("change",e)}function B(){u("clear")}function S(e){u("visible-change",e)}function C(e){u("focus",e)}function k(e){u("blur",e)}function V(){var e,a;(a=(e=r.value)==null?void 0:e.focus)==null||a.call(e)}function $(){var e,a;(a=(e=r.value)==null?void 0:e.blur)==null||a.call(e)}return f({focus:V,blur:$}),(e,a)=>(l.openBlock(),l.createBlock(l.unref(n.ElSelect),l.mergeProps({ref_key:"selectRef",ref:r},l.unref(c),{"model-value":e.modelValue,placeholder:e.placeholder,disabled:e.disabled,clearable:e.clearable,filterable:e.filterable,multiple:e.multiple,"collapse-tags":e.collapseTags,"collapse-tags-tooltip":e.collapseTagsTooltip,size:e.size,teleported:e.teleported,"fit-input-width":e.fitInputWidth,"popper-class":m.value,"append-to":e.appendTo,"onUpdate:modelValue":h,onChange:v,onClear:B,onVisibleChange:S,onFocus:C,onBlur:k}),l.createSlots({default:l.withCtx(()=>[b.value?l.renderSlot(e.$slots,"default",{key:0}):(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:1},l.renderList(d.value,(s,w)=>(l.openBlock(),l.createBlock(l.unref(n.ElOption),{key:g(s,w),label:s.label,value:s.value,disabled:s.disabled},null,8,["label","value","disabled"]))),128))]),_:2},[e.$slots.prefix?{name:"prefix",fn:l.withCtx(()=>[l.renderSlot(e.$slots,"prefix")]),key:"0"}:void 0,e.$slots.empty?{name:"empty",fn:l.withCtx(()=>[l.renderSlot(e.$slots,"empty")]),key:"1"}:void 0,e.$slots.loading?{name:"loading",fn:l.withCtx(()=>[l.renderSlot(e.$slots,"loading")]),key:"2"}:void 0,e.$slots.tag?{name:"tag",fn:l.withCtx(s=>[l.renderSlot(e.$slots,"tag",l.normalizeProps(l.guardReactiveProps(s)))]),key:"3"}:void 0]),1040,["model-value","placeholder","disabled","clearable","filterable","multiple","collapse-tags","collapse-tags-tooltip","size","teleported","fit-input-width","popper-class","append-to"]))}});exports._sfc_main=T;
@@ -1 +0,0 @@
1
- "use strict";const l=require("vue"),P=require("./index.vue_vue_type_script_setup_true_lang-DpZzyX5f.cjs"),U=l.defineComponent({name:"QyRemoteSelect",inheritAttrs:!1,__name:"index",props:{modelValue:{type:[String,Number,Boolean,Array,null],default:void 0},fetchMethod:{},defaultOptions:{default:()=>[]},labelKey:{default:"label"},valueKey:{default:"value"},disabledKey:{default:"disabled"},placeholder:{default:"请选择"},disabled:{type:Boolean,default:!1},clearable:{type:Boolean,default:!0},multiple:{type:Boolean,default:!1},collapseTags:{type:Boolean,default:!1},collapseTagsTooltip:{type:Boolean,default:!1},autoSelectSingle:{type:Boolean,default:!1},size:{default:"default"},teleported:{type:Boolean,default:!0},appendTo:{default:"body"},fitInputWidth:{type:Boolean,default:!0},popperClass:{default:""},debounce:{default:300},minLength:{default:1},remoteOnFocus:{type:Boolean,default:!1},remoteShowSuffix:{type:Boolean,default:!0},loading:{type:Boolean,default:!1},reserveSelectedOption:{type:Boolean,default:!0}},emits:["update:modelValue","change","clear","visible-change","focus","blur","options-change","loading-change","error"],setup(S,{expose:O,emit:B}){const a=S,o=B,V=l.useAttrs(),p=l.ref(null),s=l.ref([]),v=l.ref(new Map),m=l.ref(!1),d=l.ref("");let i=0,u=null;const C=l.computed(()=>a.loading||m.value),h=l.ref(!1),r=l.computed(()=>{const e=new Map,t=n=>{e.set(y(n),n)};return a.defaultOptions.forEach(t),a.reserveSelectedOption&&v.value.forEach(n=>t(n)),s.value.forEach(t),Array.from(e.values())});l.watch(()=>a.defaultOptions,e=>{e.forEach(f)},{immediate:!0}),l.watch(()=>a.modelValue,()=>{r.value.forEach(f)},{immediate:!0});function y(e){return(e==null?void 0:e[a.valueKey])??(e==null?void 0:e.value)??(e==null?void 0:e.label)}function w(e){return Array.isArray(a.modelValue)?a.modelValue.includes(e):a.modelValue===e}function f(e){if(!a.reserveSelectedOption)return;const t=y(e);w(t)&&v.value.set(t,e)}function T(e){return a.disabled?!1:e?e.length>=a.minLength:a.remoteOnFocus}function g(e){m.value!==e&&(m.value=e,o("loading-change",e))}async function c(e){if(d.value=e,!T(e)){i+=1,s.value=[],g(!1),o("options-change",r.value);return}const t=++i;g(!0);try{const n=await a.fetchMethod(e);if(t!==i)return;s.value=Array.isArray(n)?n:[],s.value.forEach(f),o("options-change",r.value)}catch(n){if(t!==i)return;s.value=[],o("error",n),o("options-change",r.value)}finally{t===i&&g(!1)}}function b(){h.value||(h.value=!0,c(""))}function k(e){u&&(clearTimeout(u),u=null),u=setTimeout(()=>{c(e)},a.debounce)}function F(){h.value=!0,c("")}function $(){c(d.value)}function A(e){o("update:modelValue",e)}function K(e){r.value.forEach(f),o("change",e)}function E(){o("clear")}function M(e){e&&a.remoteOnFocus&&!d.value&&b(),o("visible-change",e)}function I(e){a.remoteOnFocus&&!d.value&&b(),o("focus",e)}function R(e){o("blur",e)}function z(){var e,t;(t=(e=p.value)==null?void 0:e.focus)==null||t.call(e)}function L(){var e,t;(t=(e=p.value)==null?void 0:e.blur)==null||t.call(e)}function q(){o("update:modelValue",a.multiple?[]:""),o("clear")}return l.onBeforeUnmount(()=>{u&&clearTimeout(u)}),O({focus:z,blur:L,clear:q,retryFetch:$,fetchDefaultOptions:F}),(e,t)=>(l.openBlock(),l.createBlock(P._sfc_main,l.mergeProps({ref_key:"selectRef",ref:p},l.unref(V),{"model-value":e.modelValue,options:r.value,"label-key":e.labelKey,"value-key":e.valueKey,"disabled-key":e.disabledKey,placeholder:e.placeholder,disabled:e.disabled,clearable:e.clearable,filterable:!0,multiple:e.multiple,"collapse-tags":e.collapseTags,"collapse-tags-tooltip":e.collapseTagsTooltip,"auto-select-single":e.autoSelectSingle,size:e.size,teleported:e.teleported,"append-to":e.appendTo,"fit-input-width":e.fitInputWidth,"popper-class":e.popperClass,remote:"","remote-show-suffix":e.remoteShowSuffix,"remote-method":k,loading:C.value,"onUpdate:modelValue":A,onChange:K,onClear:E,onVisibleChange:M,onFocus:I,onBlur:R}),l.createSlots({default:l.withCtx(()=>[e.$slots.default?l.renderSlot(e.$slots,"default",{key:0}):l.createCommentVNode("",!0)]),_:2},[e.$slots.prefix?{name:"prefix",fn:l.withCtx(()=>[l.renderSlot(e.$slots,"prefix")]),key:"0"}:void 0,e.$slots.empty?{name:"empty",fn:l.withCtx(()=>[l.renderSlot(e.$slots,"empty")]),key:"1"}:void 0,e.$slots.loading?{name:"loading",fn:l.withCtx(()=>[l.renderSlot(e.$slots,"loading")]),key:"2"}:void 0,e.$slots.tag?{name:"tag",fn:l.withCtx(n=>[l.renderSlot(e.$slots,"tag",l.normalizeProps(l.guardReactiveProps(n)))]),key:"3"}:void 0]),1040,["model-value","options","label-key","value-key","disabled-key","placeholder","disabled","clearable","multiple","collapse-tags","collapse-tags-tooltip","auto-select-single","size","teleported","append-to","fit-input-width","popper-class","remote-show-suffix","loading"]))}});exports._sfc_main=U;
@@ -1,143 +0,0 @@
1
- import { defineComponent as F, useAttrs as K, ref as d, computed as R, watch as U, createBlock as N, openBlock as P, unref as p, mergeProps as Q, withKeys as _, createSlots as j, withCtx as r, renderSlot as i } from "vue";
2
- import { ElInput as q } from "element-plus";
3
- const H = /* @__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(m, { expose: V, emit: h }) {
14
- const l = m, t = h, v = K(), u = d(null), a = d(o(l.modelValue)), g = R(() => o(l.modelValue));
15
- U(
16
- () => l.modelValue,
17
- (e) => {
18
- a.value = o(e);
19
- }
20
- );
21
- function o(e) {
22
- return e == null ? "" : String(e);
23
- }
24
- function y(e) {
25
- return l.removeSpace ? e.replace(/\s+/g, "") : e;
26
- }
27
- function f(e, n) {
28
- return l.trimMode !== n ? e : e.trim();
29
- }
30
- function c(e) {
31
- return y(o(e));
32
- }
33
- function s(e) {
34
- a.value = e, t("update:modelValue", e);
35
- }
36
- function x(e) {
37
- const n = c(e);
38
- s(n);
39
- }
40
- function $(e) {
41
- a.value = o(e), t("input", o(e));
42
- }
43
- function k(e) {
44
- const n = f(c(e), "change");
45
- n !== o(l.modelValue) && s(n), t("change", n);
46
- }
47
- function C(e) {
48
- t("focus", e);
49
- }
50
- function I(e) {
51
- const n = f(a.value, "blur");
52
- n !== o(l.modelValue) && s(n), t("blur", e);
53
- }
54
- function S() {
55
- a.value = "", t("update:modelValue", ""), t("clear");
56
- }
57
- function b(e) {
58
- t("enter", e);
59
- }
60
- function z() {
61
- var e, n;
62
- (n = (e = u.value) == null ? void 0 : e.focus) == null || n.call(e);
63
- }
64
- function B() {
65
- var e, n;
66
- (n = (e = u.value) == null ? void 0 : e.blur) == null || n.call(e);
67
- }
68
- function w() {
69
- var e, n;
70
- (n = (e = u.value) == null ? void 0 : e.select) == null || n.call(e);
71
- }
72
- function M() {
73
- var e, n;
74
- (n = (e = u.value) == null ? void 0 : e.clear) == null || n.call(e);
75
- }
76
- function T() {
77
- var e, n;
78
- (n = (e = u.value) == null ? void 0 : e.resizeTextarea) == null || n.call(e);
79
- }
80
- function A() {
81
- var e;
82
- return ((e = u.value) == null ? void 0 : e.input) || null;
83
- }
84
- function E() {
85
- var e;
86
- return ((e = u.value) == null ? void 0 : e.textarea) || null;
87
- }
88
- return V({
89
- // 暴露 Element Plus 常用输入框方法,方便业务弹窗做聚焦、选中和 textarea 重算高度。
90
- focus: z,
91
- blur: B,
92
- select: w,
93
- clear: M,
94
- resizeTextarea: T,
95
- getNativeInput: A,
96
- getTextarea: E
97
- }), (e, n) => (P(), N(p(q), Q({
98
- ref_key: "inputRef",
99
- ref: u
100
- }, p(v), {
101
- "model-value": g.value,
102
- "onUpdate:modelValue": x,
103
- onInput: $,
104
- onChange: k,
105
- onFocus: C,
106
- onBlur: I,
107
- onClear: S,
108
- onKeydown: _(b, ["enter"])
109
- }), j({ _: 2 }, [
110
- e.$slots.prefix ? {
111
- name: "prefix",
112
- fn: r(() => [
113
- i(e.$slots, "prefix")
114
- ]),
115
- key: "0"
116
- } : void 0,
117
- e.$slots.suffix ? {
118
- name: "suffix",
119
- fn: r(() => [
120
- i(e.$slots, "suffix")
121
- ]),
122
- key: "1"
123
- } : void 0,
124
- e.$slots.prepend ? {
125
- name: "prepend",
126
- fn: r(() => [
127
- i(e.$slots, "prepend")
128
- ]),
129
- key: "2"
130
- } : void 0,
131
- e.$slots.append ? {
132
- name: "append",
133
- fn: r(() => [
134
- i(e.$slots, "append")
135
- ]),
136
- key: "3"
137
- } : void 0
138
- ]), 1040, ["model-value"]));
139
- }
140
- });
141
- export {
142
- H as _
143
- };
@@ -1,171 +0,0 @@
1
- import { defineComponent as U, useAttrs as D, ref as v, computed as Q, watch as _, createBlock as j, openBlock as q, unref as x, mergeProps as G, withKeys as H, createSlots as J, withCtx as m, renderSlot as p } from "vue";
2
- import { ElInput as L } from "element-plus";
3
- const X = /* @__PURE__ */ U({
4
- name: "QyMoneyInput",
5
- inheritAttrs: !1,
6
- __name: "index",
7
- props: {
8
- modelValue: { default: "" },
9
- precision: { default: 2 },
10
- min: { default: void 0 },
11
- max: { default: void 0 },
12
- allowNegative: { type: Boolean, default: !1 },
13
- formatTrigger: { default: "blur" },
14
- emptyValue: { default: "" }
15
- },
16
- emits: ["update:modelValue", "input", "change", "focus", "blur", "clear", "enter"],
17
- setup(b, { expose: N, emit: $ }) {
18
- const t = b, l = $, M = D(), a = v(null), s = v(o(t.modelValue)), k = Q(() => o(t.modelValue));
19
- _(
20
- () => t.modelValue,
21
- (e) => {
22
- s.value = o(e);
23
- }
24
- );
25
- function o(e) {
26
- return e == null ? "" : String(e);
27
- }
28
- function V(e) {
29
- return Number.isFinite(e) ? Math.max(0, Math.floor(e)) : 2;
30
- }
31
- function c(e) {
32
- const n = o(e);
33
- let i = "", f = !1, y = !1;
34
- const h = V(t.precision);
35
- for (let r = 0; r < n.length; r += 1) {
36
- const u = n[r];
37
- if (u >= "0" && u <= "9") {
38
- i += u;
39
- continue;
40
- }
41
- if (u === "." && h > 0 && !f) {
42
- i += u, f = !0;
43
- continue;
44
- }
45
- u === "-" && t.allowNegative && r === 0 && !y && (i += u, y = !0);
46
- }
47
- if (h > 0 && f) {
48
- const [r, u = ""] = i.split(".");
49
- return `${r}.${u.slice(0, h)}`;
50
- }
51
- return i;
52
- }
53
- function w(e) {
54
- let n = e;
55
- return typeof t.min == "number" && Number.isFinite(t.min) && (n = Math.max(n, t.min)), typeof t.max == "number" && Number.isFinite(t.max) && (n = Math.min(n, t.max)), n;
56
- }
57
- function g(e) {
58
- const n = c(e);
59
- if (!n || n === "-" || n === ".")
60
- return o(t.emptyValue);
61
- const i = Number(n);
62
- if (Number.isNaN(i)) return o(t.emptyValue);
63
- const f = V(t.precision);
64
- return w(i).toFixed(f);
65
- }
66
- function d(e) {
67
- s.value = e, l("update:modelValue", e);
68
- }
69
- function C(e) {
70
- const n = c(e);
71
- d(n);
72
- }
73
- function F(e) {
74
- const n = c(e);
75
- s.value = n, l("input", n);
76
- }
77
- function I(e) {
78
- const n = t.formatTrigger === "change" ? g(e) : c(e);
79
- n !== o(t.modelValue) && d(n), l("change", n);
80
- }
81
- function B(e) {
82
- l("focus", e);
83
- }
84
- function z(e) {
85
- if (t.formatTrigger === "blur") {
86
- const n = g(s.value);
87
- n !== o(t.modelValue) && d(n);
88
- }
89
- l("blur", e);
90
- }
91
- function A() {
92
- const e = o(t.emptyValue);
93
- s.value = e, l("update:modelValue", e), l("clear");
94
- }
95
- function S(e) {
96
- l("enter", e);
97
- }
98
- function T() {
99
- var e, n;
100
- (n = (e = a.value) == null ? void 0 : e.focus) == null || n.call(e);
101
- }
102
- function E() {
103
- var e, n;
104
- (n = (e = a.value) == null ? void 0 : e.blur) == null || n.call(e);
105
- }
106
- function K() {
107
- var e, n;
108
- (n = (e = a.value) == null ? void 0 : e.select) == null || n.call(e);
109
- }
110
- function P() {
111
- var e, n;
112
- (n = (e = a.value) == null ? void 0 : e.clear) == null || n.call(e);
113
- }
114
- function R() {
115
- var e;
116
- return ((e = a.value) == null ? void 0 : e.input) || null;
117
- }
118
- return N({
119
- focus: T,
120
- blur: E,
121
- select: K,
122
- clear: P,
123
- getNativeInput: R
124
- }), (e, n) => (q(), j(x(L), G({
125
- ref_key: "inputRef",
126
- ref: a
127
- }, x(M), {
128
- "model-value": k.value,
129
- inputmode: "decimal",
130
- "onUpdate:modelValue": C,
131
- onInput: F,
132
- onChange: I,
133
- onFocus: B,
134
- onBlur: z,
135
- onClear: A,
136
- onKeydown: H(S, ["enter"])
137
- }), J({ _: 2 }, [
138
- e.$slots.prefix ? {
139
- name: "prefix",
140
- fn: m(() => [
141
- p(e.$slots, "prefix")
142
- ]),
143
- key: "0"
144
- } : void 0,
145
- e.$slots.suffix ? {
146
- name: "suffix",
147
- fn: m(() => [
148
- p(e.$slots, "suffix")
149
- ]),
150
- key: "1"
151
- } : void 0,
152
- e.$slots.prepend ? {
153
- name: "prepend",
154
- fn: m(() => [
155
- p(e.$slots, "prepend")
156
- ]),
157
- key: "2"
158
- } : void 0,
159
- e.$slots.append ? {
160
- name: "append",
161
- fn: m(() => [
162
- p(e.$slots, "append")
163
- ]),
164
- key: "3"
165
- } : void 0
166
- ]), 1040, ["model-value"]));
167
- }
168
- });
169
- export {
170
- X as _
171
- };
@@ -1 +0,0 @@
1
- "use strict";const t=require("vue"),q=require("element-plus"),E=t.defineComponent({name:"QyMoneyInput",inheritAttrs:!1,__name:"index",props:{modelValue:{default:""},precision:{default:2},min:{default:void 0},max:{default:void 0},allowNegative:{type:Boolean,default:!1},formatTrigger:{default:"blur"},emptyValue:{default:""}},emits:["update:modelValue","input","change","focus","blur","clear","enter"],setup(g,{expose:v,emit:y}){const u=g,i=y,b=t.useAttrs(),r=t.ref(null),f=t.ref(o(u.modelValue)),N=t.computed(()=>o(u.modelValue));t.watch(()=>u.modelValue,e=>{f.value=o(e)});function o(e){return e==null?"":String(e)}function h(e){return Number.isFinite(e)?Math.max(0,Math.floor(e)):2}function d(e){const n=o(e);let a="",c=!1,x=!1;const p=h(u.precision);for(let s=0;s<n.length;s+=1){const l=n[s];if(l>="0"&&l<="9"){a+=l;continue}if(l==="."&&p>0&&!c){a+=l,c=!0;continue}l==="-"&&u.allowNegative&&s===0&&!x&&(a+=l,x=!0)}if(p>0&&c){const[s,l=""]=a.split(".");return`${s}.${l.slice(0,p)}`}return a}function $(e){let n=e;return typeof u.min=="number"&&Number.isFinite(u.min)&&(n=Math.max(n,u.min)),typeof u.max=="number"&&Number.isFinite(u.max)&&(n=Math.min(n,u.max)),n}function V(e){const n=d(e);if(!n||n==="-"||n===".")return o(u.emptyValue);const a=Number(n);if(Number.isNaN(a))return o(u.emptyValue);const c=h(u.precision);return $(a).toFixed(c)}function m(e){f.value=e,i("update:modelValue",e)}function w(e){const n=d(e);m(n)}function C(e){const n=d(e);f.value=n,i("input",n)}function M(e){const n=u.formatTrigger==="change"?V(e):d(e);n!==o(u.modelValue)&&m(n),i("change",n)}function k(e){i("focus",e)}function F(e){if(u.formatTrigger==="blur"){const n=V(f.value);n!==o(u.modelValue)&&m(n)}i("blur",e)}function I(){const e=o(u.emptyValue);f.value=e,i("update:modelValue",e),i("clear")}function S(e){i("enter",e)}function B(){var e,n;(n=(e=r.value)==null?void 0:e.focus)==null||n.call(e)}function z(){var e,n;(n=(e=r.value)==null?void 0:e.blur)==null||n.call(e)}function A(){var e,n;(n=(e=r.value)==null?void 0:e.select)==null||n.call(e)}function P(){var e,n;(n=(e=r.value)==null?void 0:e.clear)==null||n.call(e)}function T(){var e;return((e=r.value)==null?void 0:e.input)||null}return v({focus:B,blur:z,select:A,clear:P,getNativeInput:T}),(e,n)=>(t.openBlock(),t.createBlock(t.unref(q.ElInput),t.mergeProps({ref_key:"inputRef",ref:r},t.unref(b),{"model-value":N.value,inputmode:"decimal","onUpdate:modelValue":w,onInput:C,onChange:M,onFocus:k,onBlur:F,onClear:I,onKeydown:t.withKeys(S,["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=E;