@qynpm/ui 0.0.2 → 1.0.4

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 (74) hide show
  1. package/README.md +183 -8
  2. package/dist/_virtual/plugin-vue_export-helper.cjs +1 -0
  3. package/dist/_virtual/plugin-vue_export-helper.mjs +9 -0
  4. package/dist/index.cjs +1 -0
  5. package/dist/index.mjs +17 -0
  6. package/dist/lib/dialog/index.vue.cjs +1 -0
  7. package/dist/lib/dialog/index.vue.mjs +326 -0
  8. package/dist/lib/index.cjs +1 -0
  9. package/dist/lib/index.mjs +40 -0
  10. package/dist/lib/qy-action-bar/index.vue.cjs +1 -0
  11. package/dist/lib/qy-action-bar/index.vue.mjs +56 -0
  12. package/dist/lib/qy-form-section/index.vue.cjs +1 -0
  13. package/dist/lib/qy-form-section/index.vue.mjs +89 -0
  14. package/dist/lib/qy-input/index.vue.cjs +1 -0
  15. package/dist/lib/qy-input/index.vue.mjs +142 -0
  16. package/dist/lib/qy-record-quote-search/index.vue.cjs +1 -0
  17. package/dist/lib/qy-record-quote-search/index.vue.mjs +206 -0
  18. package/dist/lib/qy-search-input/index.vue.cjs +1 -0
  19. package/dist/lib/qy-search-input/index.vue.mjs +277 -0
  20. package/dist/lib/qy-select/index.vue.cjs +1 -0
  21. package/dist/lib/qy-select/index.vue.mjs +137 -0
  22. package/dist/lib/remark-image/index.vue.cjs +1 -0
  23. package/dist/lib/remark-image/index.vue.mjs +198 -0
  24. package/dist/lib/remark-image/utils.cjs +1 -0
  25. package/dist/lib/remark-image/utils.mjs +22 -0
  26. package/dist/lib/upload/index.vue.cjs +1 -0
  27. package/dist/lib/upload/index.vue.mjs +382 -0
  28. package/dist/lib/utils/auth.cjs +1 -0
  29. package/dist/lib/utils/auth.mjs +8 -0
  30. package/dist/lib/utils/install.cjs +1 -0
  31. package/dist/lib/utils/install.mjs +8 -0
  32. package/dist/node_modules/.pnpm/js-cookie@3.0.1/node_modules/js-cookie/dist/js.cookie.cjs +1 -0
  33. package/dist/node_modules/.pnpm/js-cookie@3.0.1/node_modules/js-cookie/dist/js.cookie.mjs +74 -0
  34. package/dist/qy-action-bar/index.cjs +1 -0
  35. package/dist/qy-action-bar/index.mjs +6 -0
  36. package/dist/qy-dialog/index.cjs +1 -0
  37. package/dist/qy-dialog/index.mjs +6 -0
  38. package/dist/qy-form-section/index.cjs +1 -0
  39. package/dist/qy-form-section/index.mjs +6 -0
  40. package/dist/qy-input/index.cjs +1 -0
  41. package/dist/qy-input/index.mjs +6 -0
  42. package/dist/qy-record-quote-search/index.cjs +1 -0
  43. package/dist/qy-record-quote-search/index.mjs +6 -0
  44. package/dist/qy-remark-image/index.cjs +2 -0
  45. package/dist/qy-remark-image/index.mjs +7 -0
  46. package/dist/qy-search-input/index.cjs +1 -0
  47. package/dist/qy-search-input/index.mjs +6 -0
  48. package/dist/qy-select/index.cjs +1 -0
  49. package/dist/qy-select/index.mjs +6 -0
  50. package/dist/qy-upload/index.cjs +1 -0
  51. package/dist/qy-upload/index.mjs +6 -0
  52. package/index.d.ts +16 -4
  53. package/package.json +60 -7
  54. package/qy-action-bar/index.d.ts +5 -0
  55. package/qy-action-bar/index.js +4 -0
  56. package/qy-dialog/index.d.ts +5 -0
  57. package/qy-dialog/index.js +4 -0
  58. package/qy-form-section/index.d.ts +5 -0
  59. package/qy-form-section/index.js +4 -0
  60. package/qy-input/index.d.ts +5 -0
  61. package/qy-input/index.js +4 -0
  62. package/qy-record-quote-search/index.d.ts +5 -0
  63. package/qy-record-quote-search/index.js +4 -0
  64. package/qy-remark-image/index.d.ts +5 -0
  65. package/qy-remark-image/index.js +4 -0
  66. package/qy-search-input/index.d.ts +5 -0
  67. package/qy-search-input/index.js +4 -0
  68. package/qy-select/index.d.ts +5 -0
  69. package/qy-select/index.js +4 -0
  70. package/qy-upload/index.d.ts +5 -0
  71. package/qy-upload/index.js +4 -0
  72. package/dist/ui.es.js +0 -994
  73. package/dist/ui.umd.js +0 -2
  74. package/index.js +0 -9
@@ -0,0 +1,56 @@
1
+ import { defineComponent as i, computed as n, createElementBlock as t, openBlock as o, normalizeStyle as u, normalizeClass as f, createCommentVNode as s, renderSlot as a } from "vue";
2
+ /* empty css */
3
+ import c from "../../_virtual/plugin-vue_export-helper.mjs";
4
+ const p = {
5
+ key: 0,
6
+ class: "qy-action-bar__left"
7
+ }, y = {
8
+ key: 1,
9
+ class: "qy-action-bar__center"
10
+ }, m = {
11
+ key: 2,
12
+ class: "qy-action-bar__right"
13
+ }, b = i({
14
+ name: "QyActionBar",
15
+ __name: "index",
16
+ props: {
17
+ sticky: { type: Boolean, default: !0 },
18
+ offsetBottom: { default: 0 },
19
+ bordered: { type: Boolean, default: !0 },
20
+ shadow: { type: Boolean, default: !1 },
21
+ wrap: { type: Boolean, default: !0 },
22
+ justify: { default: "between" },
23
+ background: { default: "#fff" }
24
+ },
25
+ setup(d) {
26
+ const r = d, l = n(() => ({
27
+ bottom: `${r.offsetBottom}px`,
28
+ background: r.background
29
+ }));
30
+ return (e, k) => (o(), t("div", {
31
+ class: f(["qy-action-bar", [
32
+ `is-justify-${e.justify}`,
33
+ {
34
+ "is-sticky": e.sticky,
35
+ "is-bordered": e.bordered,
36
+ "is-shadow": e.shadow,
37
+ "is-wrap": e.wrap
38
+ }
39
+ ]]),
40
+ style: u(l.value)
41
+ }, [
42
+ e.$slots.left ? (o(), t("div", p, [
43
+ a(e.$slots, "left", {}, void 0, !0)
44
+ ])) : s("", !0),
45
+ e.$slots.default ? (o(), t("div", y, [
46
+ a(e.$slots, "default", {}, void 0, !0)
47
+ ])) : s("", !0),
48
+ e.$slots.right ? (o(), t("div", m, [
49
+ a(e.$slots, "right", {}, void 0, !0)
50
+ ])) : s("", !0)
51
+ ], 6));
52
+ }
53
+ }), v = /* @__PURE__ */ c(b, [["__scopeId", "data-v-86002d5a"]]);
54
+ export {
55
+ v as default
56
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");;/* empty css */const d=require("../../_virtual/plugin-vue_export-helper.cjs"),c={class:"qy-form-section__heading"},u={key:0,class:"qy-form-section__title"},p={key:0,class:"qy-form-section__description"},m={class:"qy-form-section__actions"},f=e.defineComponent({name:"QyFormSection",__name:"index",props:{title:{default:""},description:{default:""},tip:{default:""},tipType:{default:"info"},collapsible:{type:Boolean,default:!1},defaultExpanded:{type:Boolean,default:!0},bordered:{type:Boolean,default:!0},background:{default:"white"},bodyClass:{default:""},headerClass:{default:""}},emits:["toggle"],setup(i,{emit:a}){const l=i,r=a,o=e.ref(l.defaultExpanded);e.watch(()=>l.defaultExpanded,t=>{o.value=t});function s(){l.collapsible&&(o.value=!o.value,r("toggle",o.value))}function n(){l.collapsible&&s()}return(t,b)=>(e.openBlock(),e.createElementBlock("section",{class:e.normalizeClass(["qy-form-section",[`is-bg-${t.background}`,{"is-bordered":t.bordered,"is-collapsible":t.collapsible}]])},[e.createElementVNode("header",{class:e.normalizeClass(["qy-form-section__header",t.headerClass]),onClick:n},[e.createElementVNode("div",c,[e.renderSlot(t.$slots,"title",{},()=>[t.title?(e.openBlock(),e.createElementBlock("div",u,e.toDisplayString(t.title),1)):e.createCommentVNode("",!0)],!0),e.renderSlot(t.$slots,"description",{},()=>[t.description?(e.openBlock(),e.createElementBlock("div",p,e.toDisplayString(t.description),1)):e.createCommentVNode("",!0)],!0)]),e.createElementVNode("div",m,[e.renderSlot(t.$slots,"actions",{},void 0,!0),t.collapsible?(e.openBlock(),e.createElementBlock("button",{key:0,type:"button",class:"qy-form-section__toggle",onClick:e.withModifiers(s,["stop"])},e.toDisplayString(o.value?"收起":"展开"),1)):e.createCommentVNode("",!0)])],2),e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["qy-form-section__body",t.bodyClass])},[e.renderSlot(t.$slots,"tip",{},()=>[t.tip?(e.openBlock(),e.createElementBlock("div",{key:0,class:e.normalizeClass(["qy-form-section__tip",`is-${t.tipType}`])},e.toDisplayString(t.tip),3)):e.createCommentVNode("",!0)],!0),e.renderSlot(t.$slots,"default",{},void 0,!0)],2),[[e.vShow,o.value]])],2))}}),y=d.default(f,[["__scopeId","data-v-0185ba6c"]]);exports.default=y;
@@ -0,0 +1,89 @@
1
+ import { defineComponent as y, ref as b, watch as v, createElementBlock as o, openBlock as s, normalizeClass as a, createElementVNode as d, withDirectives as h, renderSlot as i, createCommentVNode as n, toDisplayString as r, withModifiers as _, vShow as g } from "vue";
2
+ /* empty css */
3
+ import k from "../../_virtual/plugin-vue_export-helper.mjs";
4
+ const C = { class: "qy-form-section__heading" }, q = {
5
+ key: 0,
6
+ class: "qy-form-section__title"
7
+ }, $ = {
8
+ key: 0,
9
+ class: "qy-form-section__description"
10
+ }, E = { class: "qy-form-section__actions" }, w = y({
11
+ name: "QyFormSection",
12
+ __name: "index",
13
+ props: {
14
+ title: { default: "" },
15
+ description: { default: "" },
16
+ tip: { default: "" },
17
+ tipType: { default: "info" },
18
+ collapsible: { type: Boolean, default: !1 },
19
+ defaultExpanded: { type: Boolean, default: !0 },
20
+ bordered: { type: Boolean, default: !0 },
21
+ background: { default: "white" },
22
+ bodyClass: { default: "" },
23
+ headerClass: { default: "" }
24
+ },
25
+ emits: ["toggle"],
26
+ setup(c, { emit: p }) {
27
+ const l = c, f = p, t = b(l.defaultExpanded);
28
+ v(
29
+ () => l.defaultExpanded,
30
+ (e) => {
31
+ t.value = e;
32
+ }
33
+ );
34
+ function u() {
35
+ l.collapsible && (t.value = !t.value, f("toggle", t.value));
36
+ }
37
+ function m() {
38
+ l.collapsible && u();
39
+ }
40
+ return (e, B) => (s(), o("section", {
41
+ class: a(["qy-form-section", [
42
+ `is-bg-${e.background}`,
43
+ {
44
+ "is-bordered": e.bordered,
45
+ "is-collapsible": e.collapsible
46
+ }
47
+ ]])
48
+ }, [
49
+ d("header", {
50
+ class: a(["qy-form-section__header", e.headerClass]),
51
+ onClick: m
52
+ }, [
53
+ d("div", C, [
54
+ i(e.$slots, "title", {}, () => [
55
+ e.title ? (s(), o("div", q, r(e.title), 1)) : n("", !0)
56
+ ], !0),
57
+ i(e.$slots, "description", {}, () => [
58
+ e.description ? (s(), o("div", $, r(e.description), 1)) : n("", !0)
59
+ ], !0)
60
+ ]),
61
+ d("div", E, [
62
+ i(e.$slots, "actions", {}, void 0, !0),
63
+ e.collapsible ? (s(), o("button", {
64
+ key: 0,
65
+ type: "button",
66
+ class: "qy-form-section__toggle",
67
+ onClick: _(u, ["stop"])
68
+ }, r(t.value ? "收起" : "展开"), 1)) : n("", !0)
69
+ ])
70
+ ], 2),
71
+ h(d("div", {
72
+ class: a(["qy-form-section__body", e.bodyClass])
73
+ }, [
74
+ i(e.$slots, "tip", {}, () => [
75
+ e.tip ? (s(), o("div", {
76
+ key: 0,
77
+ class: a(["qy-form-section__tip", `is-${e.tipType}`])
78
+ }, r(e.tip), 3)) : n("", !0)
79
+ ], !0),
80
+ i(e.$slots, "default", {}, void 0, !0)
81
+ ], 2), [
82
+ [g, t.value]
83
+ ])
84
+ ], 2));
85
+ }
86
+ }), N = /* @__PURE__ */ k(w, [["__scopeId", "data-v-0185ba6c"]]);
87
+ export {
88
+ N as default
89
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),T=require("element-plus"),P=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:c,emit:p}){const r=d,u=p,m=t.useAttrs(),l=t.ref(null),a=t.ref(o(r.modelValue)),h=t.computed(()=>o(r.modelValue));t.watch(()=>r.modelValue,e=>{a.value=o(e)});function o(e){return e==null?"":String(e)}function v(e){return r.removeSpace?e.replace(/\s+/g,""):e}function s(e,n){return r.trimMode!==n?e:e.trim()}function f(e){return v(o(e))}function i(e){a.value=e,u("update:modelValue",e)}function V(e){const n=f(e);i(n)}function g(e){a.value=o(e),u("input",o(e))}function x(e){const n=s(f(e),"change");n!==o(r.modelValue)&&i(n),u("change",n)}function y(e){u("focus",e)}function S(e){const n=s(a.value,"blur");n!==o(r.modelValue)&&i(n),u("blur",e)}function C(){a.value="",u("update:modelValue",""),u("clear")}function $(e){u("enter",e)}function b(){var e,n;(n=(e=l.value)==null?void 0:e.focus)==null||n.call(e)}function k(){var e,n;(n=(e=l.value)==null?void 0:e.blur)==null||n.call(e)}function w(){var e,n;(n=(e=l.value)==null?void 0:e.select)==null||n.call(e)}function I(){var e,n;(n=(e=l.value)==null?void 0:e.clear)==null||n.call(e)}function M(){var e,n;(n=(e=l.value)==null?void 0:e.resizeTextarea)==null||n.call(e)}function z(){var e;return((e=l.value)==null?void 0:e.input)||null}function B(){var e;return((e=l.value)==null?void 0:e.textarea)||null}return c({focus:b,blur:k,select:w,clear:I,resizeTextarea:M,getNativeInput:z,getTextarea:B}),(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:g,onChange:x,onFocus:y,onBlur:S,onClear:C,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.default=P;
@@ -0,0 +1,142 @@
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 j, createSlots as q, withCtx as r, renderSlot as i } from "vue";
2
+ import { ElInput as D } from "element-plus";
3
+ const J = 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
+ focus: z,
90
+ blur: B,
91
+ select: w,
92
+ clear: M,
93
+ resizeTextarea: T,
94
+ getNativeInput: A,
95
+ getTextarea: E
96
+ }), (e, n) => (P(), N(p(D), Q({
97
+ ref_key: "inputRef",
98
+ ref: u
99
+ }, p(v), {
100
+ "model-value": g.value,
101
+ "onUpdate:modelValue": x,
102
+ onInput: $,
103
+ onChange: k,
104
+ onFocus: C,
105
+ onBlur: I,
106
+ onClear: S,
107
+ onKeydown: j(b, ["enter"])
108
+ }), q({ _: 2 }, [
109
+ e.$slots.prefix ? {
110
+ name: "prefix",
111
+ fn: r(() => [
112
+ i(e.$slots, "prefix")
113
+ ]),
114
+ key: "0"
115
+ } : void 0,
116
+ e.$slots.suffix ? {
117
+ name: "suffix",
118
+ fn: r(() => [
119
+ i(e.$slots, "suffix")
120
+ ]),
121
+ key: "1"
122
+ } : void 0,
123
+ e.$slots.prepend ? {
124
+ name: "prepend",
125
+ fn: r(() => [
126
+ i(e.$slots, "prepend")
127
+ ]),
128
+ key: "2"
129
+ } : void 0,
130
+ e.$slots.append ? {
131
+ name: "append",
132
+ fn: r(() => [
133
+ i(e.$slots, "append")
134
+ ]),
135
+ key: "3"
136
+ } : void 0
137
+ ]), 1040, ["model-value"]));
138
+ }
139
+ });
140
+ export {
141
+ J as default
142
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("vue"),Q=require("../qy-search-input/index.vue.cjs");;/* empty css */const O=require("../../_virtual/plugin-vue_export-helper.cjs"),T={class:"qy-record-quote-search"},A={key:0,class:"qy-record-quote-search__header"},P={key:0,class:"qy-record-quote-search__label"},R={key:1,class:"qy-record-quote-search__description"},L=t.defineComponent({name:"QyRecordQuoteSearch",inheritAttrs:!1,__name:"index",props:{modelValue:{default:""},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},placeholder:{default:"请输入报价单号"},buttonText:{default:"查询报价单"},autoNormalize:{type:Boolean,default:!0},showStatus:{type:Boolean,default:!0},status:{default:"default"},statusText:{default:""},suggestions:{default:()=>[]},fetchSuggestions:{type:[Function,null],default:null},fetchSuggestionsMethod:{type:[Function,null],default:null},debounce:{default:300},minLength:{default:1},searchOnSelect:{type:Boolean,default:!0},searchMethod:{type:[Function,null],default:null},extractMethod:{type:[Function,null],default:null},normalizeMethod:{type:[Function,null],default:null},label:{default:"报价单号"},description:{default:""},trimMode:{default:"blur"}},emits:["update:modelValue","search","clear","normalize","enter","select","error","success"],setup(y,{expose:v,emit:S}){const r=y,l=S,b=t.useAttrs(),u=t.ref(null),d=t.ref(!1),i=t.computed(()=>r.statusText||""),V=t.computed(()=>r.loading||d.value);function a(e){return e==null?"":String(e)}function k(e){const o=a(e).trim(),n=c(o),s=n.match(/BJ\d{8}[A-Z0-9]{4}/i);return s?s[0]:n}function c(e){return a(e).replace(/\s+/g,"").trim().toUpperCase()}function f(e){return r.extractMethod?r.extractMethod(e):k(e)}function h(e){return r.normalizeMethod?r.normalizeMethod(e):c(e)}function m(e,o){const n=a(e),s=f(n),g=r.autoNormalize?h(s):s;return l("normalize",{rawValue:n,code:g}),{rawValue:n,code:g,item:o}}function C(e){l("update:modelValue",e)}async function p(e){if(l("search",e),!!r.searchMethod){d.value=!0;try{const o=await r.searchMethod(e);l("success",o)}catch(o){l("error",o)}finally{d.value=!1}}}function B(e){const o=m(e);o.code!==a(r.modelValue)&&l("update:modelValue",o.code),p(o)}function M(){l("clear")}function E(e){l("enter",e)}function q(e){if(l("select",e),!r.searchOnSelect)return;const o=m(e.value,e);o.code!==a(r.modelValue)&&l("update:modelValue",o.code),p(o)}function $(e){l("error",e)}function z(){var e,o;(o=(e=u.value)==null?void 0:e.focus)==null||o.call(e)}function F(){var e,o;(o=(e=u.value)==null?void 0:e.blur)==null||o.call(e)}function w(){var e,o;(o=(e=u.value)==null?void 0:e.select)==null||o.call(e)}function N(){var e,o;(o=(e=u.value)==null?void 0:e.clear)==null||o.call(e)}return v({focus:z,blur:F,select:w,clear:N,extractQuoteOrderCode:f,normalizeQuoteOrderCode:h}),(e,o)=>(t.openBlock(),t.createElementBlock("div",T,[t.renderSlot(e.$slots,"label",{},()=>[e.label||e.description?(t.openBlock(),t.createElementBlock("div",A,[e.label?(t.openBlock(),t.createElementBlock("div",P,t.toDisplayString(e.label),1)):t.createCommentVNode("",!0),e.description?(t.openBlock(),t.createElementBlock("div",R,t.toDisplayString(e.description),1)):t.createCommentVNode("",!0)])):t.createCommentVNode("",!0)],!0),t.createVNode(Q.default,t.mergeProps({ref_key:"searchRef",ref:u},t.unref(b),{"model-value":e.modelValue,loading:V.value,disabled:e.disabled,placeholder:e.placeholder,"remove-space":!0,"trim-mode":e.trimMode,"button-text":e.buttonText,suggestions:e.suggestions,"fetch-suggestions":e.fetchSuggestions,"fetch-suggestions-method":e.fetchSuggestionsMethod,debounce:e.debounce,"min-length":e.minLength,"search-on-select":!1,"onUpdate:modelValue":C,onSearch:B,onClear:M,onEnter:E,onSelect:q,onError:$}),t.createSlots({_:2},[e.$slots.prefix?{name:"prefix",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"prefix",{},void 0,!0)]),key:"0"}:void 0,e.$slots.suffix?{name:"suffix",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"suffix",{},void 0,!0)]),key:"1"}:void 0,e.$slots.item?{name:"item",fn:t.withCtx(n=>[t.renderSlot(e.$slots,"item",t.normalizeProps(t.guardReactiveProps(n)),void 0,!0)]),key:"2"}:void 0,e.$slots.empty?{name:"empty",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"empty",{},void 0,!0)]),key:"3"}:void 0,e.$slots.loading?{name:"loading",fn:t.withCtx(()=>[t.renderSlot(e.$slots,"loading",{},void 0,!0)]),key:"4"}:void 0]),1040,["model-value","loading","disabled","placeholder","trim-mode","button-text","suggestions","fetch-suggestions","fetch-suggestions-method","debounce","min-length"]),e.showStatus&&i.value?t.renderSlot(e.$slots,"status",{key:0,status:e.status,statusText:i.value},()=>[t.createElementVNode("div",{class:t.normalizeClass(["qy-record-quote-search__status",`is-${e.status}`])},t.toDisplayString(i.value),3)],!0):t.createCommentVNode("",!0)]))}}),D=O.default(L,[["__scopeId","data-v-8bc26d3a"]]);exports.default=D;
@@ -0,0 +1,206 @@
1
+ import { defineComponent as U, useAttrs as I, ref as M, computed as $, createElementBlock as i, openBlock as c, renderSlot as r, createVNode as D, createCommentVNode as f, toDisplayString as p, mergeProps as J, unref as Z, createSlots as j, withCtx as d, normalizeProps as G, guardReactiveProps as H, createElementVNode as K, normalizeClass as W } from "vue";
2
+ import X from "../qy-search-input/index.vue.mjs";
3
+ /* empty css */
4
+ import Y from "../../_virtual/plugin-vue_export-helper.mjs";
5
+ const _ = { class: "qy-record-quote-search" }, x = {
6
+ key: 0,
7
+ class: "qy-record-quote-search__header"
8
+ }, ee = {
9
+ key: 0,
10
+ class: "qy-record-quote-search__label"
11
+ }, te = {
12
+ key: 1,
13
+ class: "qy-record-quote-search__description"
14
+ }, oe = U({
15
+ name: "QyRecordQuoteSearch",
16
+ inheritAttrs: !1,
17
+ __name: "index",
18
+ props: {
19
+ modelValue: { default: "" },
20
+ loading: { type: Boolean, default: !1 },
21
+ disabled: { type: Boolean, default: !1 },
22
+ placeholder: { default: "请输入报价单号" },
23
+ buttonText: { default: "查询报价单" },
24
+ autoNormalize: { type: Boolean, default: !0 },
25
+ showStatus: { type: Boolean, default: !0 },
26
+ status: { default: "default" },
27
+ statusText: { default: "" },
28
+ suggestions: { default: () => [] },
29
+ fetchSuggestions: { type: [Function, null], default: null },
30
+ fetchSuggestionsMethod: { type: [Function, null], default: null },
31
+ debounce: { default: 300 },
32
+ minLength: { default: 1 },
33
+ searchOnSelect: { type: Boolean, default: !0 },
34
+ searchMethod: { type: [Function, null], default: null },
35
+ extractMethod: { type: [Function, null], default: null },
36
+ normalizeMethod: { type: [Function, null], default: null },
37
+ label: { default: "报价单号" },
38
+ description: { default: "" },
39
+ trimMode: { default: "blur" }
40
+ },
41
+ emits: ["update:modelValue", "search", "clear", "normalize", "enter", "select", "error", "success"],
42
+ setup(k, { expose: z, emit: E }) {
43
+ const o = k, a = E, F = I(), l = M(null), h = M(!1), m = $(() => o.statusText || ""), C = $(() => o.loading || h.value);
44
+ function u(e) {
45
+ return e == null ? "" : String(e);
46
+ }
47
+ function q(e) {
48
+ const t = u(e).trim(), n = g(t), s = n.match(/BJ\d{8}[A-Z0-9]{4}/i);
49
+ return s ? s[0] : n;
50
+ }
51
+ function g(e) {
52
+ return u(e).replace(/\s+/g, "").trim().toUpperCase();
53
+ }
54
+ function y(e) {
55
+ return o.extractMethod ? o.extractMethod(e) : q(e);
56
+ }
57
+ function v(e) {
58
+ return o.normalizeMethod ? o.normalizeMethod(e) : g(e);
59
+ }
60
+ function b(e, t) {
61
+ const n = u(e), s = y(n), V = o.autoNormalize ? v(s) : s;
62
+ return a("normalize", { rawValue: n, code: V }), {
63
+ rawValue: n,
64
+ code: V,
65
+ item: t
66
+ };
67
+ }
68
+ function B(e) {
69
+ a("update:modelValue", e);
70
+ }
71
+ async function S(e) {
72
+ if (a("search", e), !!o.searchMethod) {
73
+ h.value = !0;
74
+ try {
75
+ const t = await o.searchMethod(e);
76
+ a("success", t);
77
+ } catch (t) {
78
+ a("error", t);
79
+ } finally {
80
+ h.value = !1;
81
+ }
82
+ }
83
+ }
84
+ function Q(e) {
85
+ const t = b(e);
86
+ t.code !== u(o.modelValue) && a("update:modelValue", t.code), S(t);
87
+ }
88
+ function A() {
89
+ a("clear");
90
+ }
91
+ function N(e) {
92
+ a("enter", e);
93
+ }
94
+ function O(e) {
95
+ if (a("select", e), !o.searchOnSelect) return;
96
+ const t = b(e.value, e);
97
+ t.code !== u(o.modelValue) && a("update:modelValue", t.code), S(t);
98
+ }
99
+ function T(e) {
100
+ a("error", e);
101
+ }
102
+ function w() {
103
+ var e, t;
104
+ (t = (e = l.value) == null ? void 0 : e.focus) == null || t.call(e);
105
+ }
106
+ function R() {
107
+ var e, t;
108
+ (t = (e = l.value) == null ? void 0 : e.blur) == null || t.call(e);
109
+ }
110
+ function L() {
111
+ var e, t;
112
+ (t = (e = l.value) == null ? void 0 : e.select) == null || t.call(e);
113
+ }
114
+ function P() {
115
+ var e, t;
116
+ (t = (e = l.value) == null ? void 0 : e.clear) == null || t.call(e);
117
+ }
118
+ return z({
119
+ focus: w,
120
+ blur: R,
121
+ select: L,
122
+ clear: P,
123
+ extractQuoteOrderCode: y,
124
+ normalizeQuoteOrderCode: v
125
+ }), (e, t) => (c(), i("div", _, [
126
+ r(e.$slots, "label", {}, () => [
127
+ e.label || e.description ? (c(), i("div", x, [
128
+ e.label ? (c(), i("div", ee, p(e.label), 1)) : f("", !0),
129
+ e.description ? (c(), i("div", te, p(e.description), 1)) : f("", !0)
130
+ ])) : f("", !0)
131
+ ], !0),
132
+ D(X, J({
133
+ ref_key: "searchRef",
134
+ ref: l
135
+ }, Z(F), {
136
+ "model-value": e.modelValue,
137
+ loading: C.value,
138
+ disabled: e.disabled,
139
+ placeholder: e.placeholder,
140
+ "remove-space": !0,
141
+ "trim-mode": e.trimMode,
142
+ "button-text": e.buttonText,
143
+ suggestions: e.suggestions,
144
+ "fetch-suggestions": e.fetchSuggestions,
145
+ "fetch-suggestions-method": e.fetchSuggestionsMethod,
146
+ debounce: e.debounce,
147
+ "min-length": e.minLength,
148
+ "search-on-select": !1,
149
+ "onUpdate:modelValue": B,
150
+ onSearch: Q,
151
+ onClear: A,
152
+ onEnter: N,
153
+ onSelect: O,
154
+ onError: T
155
+ }), j({ _: 2 }, [
156
+ e.$slots.prefix ? {
157
+ name: "prefix",
158
+ fn: d(() => [
159
+ r(e.$slots, "prefix", {}, void 0, !0)
160
+ ]),
161
+ key: "0"
162
+ } : void 0,
163
+ e.$slots.suffix ? {
164
+ name: "suffix",
165
+ fn: d(() => [
166
+ r(e.$slots, "suffix", {}, void 0, !0)
167
+ ]),
168
+ key: "1"
169
+ } : void 0,
170
+ e.$slots.item ? {
171
+ name: "item",
172
+ fn: d((n) => [
173
+ r(e.$slots, "item", G(H(n)), void 0, !0)
174
+ ]),
175
+ key: "2"
176
+ } : void 0,
177
+ e.$slots.empty ? {
178
+ name: "empty",
179
+ fn: d(() => [
180
+ r(e.$slots, "empty", {}, void 0, !0)
181
+ ]),
182
+ key: "3"
183
+ } : void 0,
184
+ e.$slots.loading ? {
185
+ name: "loading",
186
+ fn: d(() => [
187
+ r(e.$slots, "loading", {}, void 0, !0)
188
+ ]),
189
+ key: "4"
190
+ } : void 0
191
+ ]), 1040, ["model-value", "loading", "disabled", "placeholder", "trim-mode", "button-text", "suggestions", "fetch-suggestions", "fetch-suggestions-method", "debounce", "min-length"]),
192
+ e.showStatus && m.value ? r(e.$slots, "status", {
193
+ key: 0,
194
+ status: e.status,
195
+ statusText: m.value
196
+ }, () => [
197
+ K("div", {
198
+ class: W(["qy-record-quote-search__status", `is-${e.status}`])
199
+ }, p(m.value), 3)
200
+ ], !0) : f("", !0)
201
+ ]));
202
+ }
203
+ }), ue = /* @__PURE__ */ Y(oe, [["__scopeId", "data-v-8bc26d3a"]]);
204
+ export {
205
+ ue as default
206
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const n=require("vue"),w=require("element-plus");;/* empty css */const X=require("../../_virtual/plugin-vue_export-helper.cjs"),Y={class:"qy-search-input__item"},Z=["innerHTML"],ee={key:0,class:"qy-search-input__item-description"},te=n.defineComponent({name:"QySearchInput",inheritAttrs:!1,__name:"index",props:{modelValue:{default:""},loading:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1},placeholder:{default:"请输入搜索内容"},removeSpace:{type:Boolean,default:!1},trimMode:{default:"none"},clearable:{type:Boolean,default:!0},buttonText:{default:"搜索"},buttonProps:{default:()=>({})},suggestions:{default:()=>[]},fetchSuggestions:{type:[Function,null],default:null},fetchSuggestionsMethod:{type:[Function,null],default:null},debounce:{default:300},minLength:{default:1},triggerOnFocus:{type:Boolean,default:!1},searchOnEnter:{type:Boolean,default:!0},searchOnSelect:{type:Boolean,default:!1},highlightKeyword:{type:Boolean,default:!0},teleported:{type:Boolean,default:!0},appendTo:{default:"body"},popperClass:{default:""},fitInputWidth:{type:Boolean,default:!0}},emits:["update:modelValue","search","clear","input","change","focus","blur","enter","select","visible-change","suggestions-change","error"],setup(B,{expose:k,emit:C}){const o=B,a=C,$=n.useAttrs(),s=n.ref(null),c=n.ref(u(o.modelValue)),p=n.computed(()=>u(o.modelValue)),M=n.computed(()=>["qy-search-input__popper",o.popperClass].filter(Boolean).join(" ")),E=n.computed(()=>u(o.modelValue)),f=n.ref("");n.watch(()=>o.modelValue,e=>{c.value=u(e)});function u(e){return e==null?"":String(e)}function F(e){return o.removeSpace?e.replace(/\s+/g,""):e}function v(e,t){return o.trimMode!==t?e:e.trim()}function g(e){return F(u(e))}function h(e){c.value=e,a("update:modelValue",e)}function y(e,t=""){return{...e,label:e.label||e.value,value:e.value||e.label,description:e.description||t}}function m(e=[]){return e.flatMap(t=>{if(Array.isArray(t.items)){const l=t;return l.items.map(r=>y(r,l.groupLabel))}return y(t)})}function T(e){const t=e.toLowerCase();return l=>[l.label,l.value,l.description].filter(Boolean).some(r=>String(r).toLowerCase().includes(t))}function I(e){return e?e.length>=o.minLength:o.triggerOnFocus}function i(e){a("suggestions-change",e),a("visible-change",e.length>0)}async function L(e){if(!I(e))return i([]),[];if(o.fetchSuggestionsMethod){const r=await new Promise(d=>{var S;(S=o.fetchSuggestionsMethod)==null||S.call(o,e,J=>{d(m(J))})});return i(r),r}if(o.fetchSuggestions){const r=await o.fetchSuggestions(e),d=m(Array.isArray(r)?r:[]);return i(d),d}const t=m(o.suggestions),l=e?t.filter(T(e)):t;return i(l),l}async function P(e,t){f.value=e;try{const l=await L(e);t(l)}catch(l){a("error",l),i([]),t([])}}function O(){var e,t;f.value&&((t=(e=s.value)==null?void 0:e.getData)==null||t.call(e,f.value))}function _(e){const t=g(e);h(t)}function A(e){const t=g(e);c.value=t,a("input",t)}function q(e){const t=v(g(e),"change");t!==u(o.modelValue)&&h(t),a("change",t)}function z(e){a("focus",e)}function D(e){const t=v(c.value,"blur");t!==u(o.modelValue)&&h(t),a("blur",e),a("visible-change",!1)}function H(){c.value="",a("update:modelValue",""),a("clear"),i([])}function K(e){a("enter",e),o.searchOnEnter&&b()}function b(){a("search",u(o.modelValue))}function N(e){a("select",e),o.searchOnSelect&&a("search",e.value)}function V(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function R(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function x(e){const t=V(e||"");if(!o.highlightKeyword||!p.value)return t;const l=R(V(p.value));return l?t.replace(new RegExp(`(${l})`,"ig"),'<mark class="qy-search-input__mark">$1</mark>'):t}function Q(){var e,t;(t=(e=s.value)==null?void 0:e.focus)==null||t.call(e)}function j(){var e,t;(t=(e=s.value)==null?void 0:e.blur)==null||t.call(e)}function U(){var e,t,l;(l=(t=(e=s.value)==null?void 0:e.inputRef)==null?void 0:t.select)==null||l.call(t)}function W(){var e,t;(t=(e=s.value)==null?void 0:e.clear)==null||t.call(e)}function G(){var e,t;(t=(e=s.value)==null?void 0:e.close)==null||t.call(e)}return k({focus:Q,blur:j,select:U,clear:W,closePanel:G,retryFetch:O}),(e,t)=>(n.openBlock(),n.createElementBlock("div",{class:n.normalizeClass(["qy-search-input",{"is-disabled":e.disabled}])},[n.createVNode(n.unref(w.ElAutocomplete),n.mergeProps({ref_key:"autocompleteRef",ref:s},n.unref($),{"model-value":E.value,disabled:e.disabled,placeholder:e.placeholder,clearable:e.clearable,debounce:e.debounce,"fetch-suggestions":P,"trigger-on-focus":e.triggerOnFocus,teleported:e.teleported,"fit-input-width":e.fitInputWidth,"popper-class":M.value,"append-to":e.appendTo,"value-key":"value","onUpdate:modelValue":_,onInput:A,onChange:q,onFocus:z,onBlur:D,onClear:H,onSelect:N,onKeydown:n.withKeys(K,["enter"])}),n.createSlots({append:n.withCtx(()=>[e.$slots.append?n.renderSlot(e.$slots,"append",{key:0},void 0,!0):(n.openBlock(),n.createBlock(n.unref(w.ElButton),n.mergeProps({key:1},e.buttonProps,{loading:e.loading,disabled:e.disabled,onClick:b}),{default:n.withCtx(()=>[n.createTextVNode(n.toDisplayString(e.buttonText),1)]),_:1},16,["loading","disabled"]))]),default:n.withCtx(({item:l})=>[n.renderSlot(e.$slots,"item",{item:l,keyword:p.value},()=>[n.createElementVNode("div",Y,[n.createElementVNode("div",{class:"qy-search-input__item-label",innerHTML:x(l.label||l.value||"")},null,8,Z),l.description?(n.openBlock(),n.createElementBlock("div",ee,n.toDisplayString(l.description),1)):n.createCommentVNode("",!0)])],!0)]),_:2},[e.$slots.prefix?{name:"prefix",fn:n.withCtx(()=>[n.renderSlot(e.$slots,"prefix",{},void 0,!0)]),key:"0"}:void 0,e.$slots.suffix?{name:"suffix",fn:n.withCtx(()=>[n.renderSlot(e.$slots,"suffix",{},void 0,!0)]),key:"1"}:void 0,e.$slots.prepend?{name:"prepend",fn:n.withCtx(()=>[n.renderSlot(e.$slots,"prepend",{},void 0,!0)]),key:"2"}:void 0]),1040,["model-value","disabled","placeholder","clearable","debounce","trigger-on-focus","teleported","fit-input-width","popper-class","append-to"])],2))}}),ne=X.default(te,[["__scopeId","data-v-47c6430a"]]);exports.default=ne;