common_component_library_vue 0.1.0 → 0.1.2
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.
- package/dist-lib/common-component-library-vue.css +1 -1
- package/dist-lib/common-component-library-vue.mjs +587 -167
- package/dist-lib/common-component-library-vue.umd.js +1 -1
- package/dist-lib/types/components/Table/CcTable.vue.d.ts +73 -0
- package/dist-lib/types/index.d.ts +100 -1
- package/package.json +3 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Fragment as e, Teleport as t, Transition as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s,
|
|
1
|
+
import { Fragment as e, Teleport as t, Transition as n, computed as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createStaticVNode as c, createTextVNode as l, createVNode as u, defineComponent as d, mergeModels as f, nextTick as ee, normalizeClass as p, normalizeStyle as m, onBeforeUnmount as h, onMounted as te, openBlock as g, reactive as _, ref as v, renderList as y, renderSlot as b, resolveDynamicComponent as x, toDisplayString as S, useCssVars as C, useModel as w, vModelCheckbox as T, vModelRadio as E, vModelSelect as ne, vModelText as re, watch as D, withCtx as O, withDirectives as k, withModifiers as A } from "vue";
|
|
2
2
|
//#region src/components/Spinner/CcSpinner.vue?vue&type=script&setup=true&lang.ts
|
|
3
|
-
var
|
|
3
|
+
var ie = ["width", "height"], ae = /*@__PURE__*/ d({
|
|
4
4
|
__name: "CcSpinner",
|
|
5
5
|
props: {
|
|
6
6
|
size: { default: 20 },
|
|
7
7
|
color: { default: "var(--cc-primary)" }
|
|
8
8
|
},
|
|
9
9
|
setup(e) {
|
|
10
|
-
return
|
|
10
|
+
return C((e) => ({ f2187a8a: e.color })), (t, n) => (g(), o("svg", {
|
|
11
11
|
class: "cc-spinner",
|
|
12
12
|
width: e.size,
|
|
13
13
|
height: e.size,
|
|
@@ -29,16 +29,16 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
29
29
|
stroke: "currentColor",
|
|
30
30
|
"stroke-width": "3",
|
|
31
31
|
"stroke-linecap": "round"
|
|
32
|
-
}, null, -1)]], 8,
|
|
32
|
+
}, null, -1)]], 8, ie));
|
|
33
33
|
}
|
|
34
|
-
}),
|
|
34
|
+
}), j = (e, t) => {
|
|
35
35
|
let n = e.__vccOpts || e;
|
|
36
36
|
for (let [e, r] of t) n[e] = r;
|
|
37
37
|
return n;
|
|
38
|
-
},
|
|
38
|
+
}, M = /*#__PURE__*/ j(ae, [["__scopeId", "data-v-00c109fa"]]), oe = {
|
|
39
39
|
key: 0,
|
|
40
40
|
class: "cc-btn__spinner"
|
|
41
|
-
},
|
|
41
|
+
}, N = { class: "cc-btn__content" }, P = /*#__PURE__*/ j(/* @__PURE__ */ d({
|
|
42
42
|
__name: "CcButton",
|
|
43
43
|
props: {
|
|
44
44
|
variant: { default: "primary" },
|
|
@@ -62,7 +62,7 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
62
62
|
},
|
|
63
63
|
emits: ["click"],
|
|
64
64
|
setup(e, { emit: t }) {
|
|
65
|
-
let n = e, c = t,
|
|
65
|
+
let n = e, c = t, l = r(() => n.variant === "primary" || n.variant === "on-dark" ? "var(--cc-on-primary)" : "var(--cc-primary)");
|
|
66
66
|
function d(e) {
|
|
67
67
|
if (n.disabled || n.loading) {
|
|
68
68
|
e.preventDefault();
|
|
@@ -70,8 +70,8 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
70
70
|
}
|
|
71
71
|
c("click", e);
|
|
72
72
|
}
|
|
73
|
-
return (t, n) => (
|
|
74
|
-
class:
|
|
73
|
+
return (t, n) => (g(), i(x(e.href ? "a" : "button"), {
|
|
74
|
+
class: p(["cc-btn", [
|
|
75
75
|
`cc-btn--${e.variant}`,
|
|
76
76
|
`cc-btn--${e.size}`,
|
|
77
77
|
{
|
|
@@ -87,10 +87,10 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
87
87
|
"aria-busy": e.loading,
|
|
88
88
|
onClick: d
|
|
89
89
|
}, {
|
|
90
|
-
default:
|
|
90
|
+
default: O(() => [e.loading ? (g(), o("span", oe, [u(M, {
|
|
91
91
|
size: e.size === "sm" ? 14 : 16,
|
|
92
|
-
color:
|
|
93
|
-
}, null, 8, ["size", "color"])])) : a("", !0), s("span",
|
|
92
|
+
color: l.value
|
|
93
|
+
}, null, 8, ["size", "color"])])) : a("", !0), s("span", N, [b(t.$slots, "default", {}, void 0, !0)])]),
|
|
94
94
|
_: 3
|
|
95
95
|
}, 8, [
|
|
96
96
|
"class",
|
|
@@ -102,10 +102,10 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
102
102
|
"aria-busy"
|
|
103
103
|
]));
|
|
104
104
|
}
|
|
105
|
-
}), [["__scopeId", "data-v-deb42261"]]),
|
|
105
|
+
}), [["__scopeId", "data-v-deb42261"]]), F = ["for"], I = {
|
|
106
106
|
key: 0,
|
|
107
107
|
class: "cc-input__prefix tnum"
|
|
108
|
-
},
|
|
108
|
+
}, L = [
|
|
109
109
|
"id",
|
|
110
110
|
"type",
|
|
111
111
|
"value",
|
|
@@ -119,13 +119,13 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
119
119
|
"max",
|
|
120
120
|
"step",
|
|
121
121
|
"aria-invalid"
|
|
122
|
-
],
|
|
122
|
+
], R = {
|
|
123
123
|
key: 1,
|
|
124
124
|
class: "cc-input__message cc-input__message--error"
|
|
125
|
-
},
|
|
125
|
+
}, se = {
|
|
126
126
|
key: 2,
|
|
127
127
|
class: "cc-input__message"
|
|
128
|
-
},
|
|
128
|
+
}, z = /*#__PURE__*/ j(/* @__PURE__ */ d({
|
|
129
129
|
__name: "CcInput",
|
|
130
130
|
props: {
|
|
131
131
|
modelValue: { default: "" },
|
|
@@ -161,16 +161,16 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
161
161
|
function l(e) {
|
|
162
162
|
i("update:modelValue", e.target.value);
|
|
163
163
|
}
|
|
164
|
-
return (t, n) => (
|
|
164
|
+
return (t, n) => (g(), o("div", { class: p(["cc-input", {
|
|
165
165
|
"cc-input--error": c.value,
|
|
166
166
|
"cc-input--disabled": e.disabled
|
|
167
167
|
}]) }, [
|
|
168
|
-
e.label ? (
|
|
168
|
+
e.label ? (g(), o("label", {
|
|
169
169
|
key: 0,
|
|
170
170
|
class: "cc-input__label",
|
|
171
171
|
for: e.name
|
|
172
|
-
},
|
|
173
|
-
s("div", { class:
|
|
172
|
+
}, S(e.label), 9, F)) : a("", !0),
|
|
173
|
+
s("div", { class: p(["cc-input__field", { "cc-input__field--prefix": e.prefix }]) }, [e.prefix ? (g(), o("span", I, S(e.prefix), 1)) : a("", !0), s("input", {
|
|
174
174
|
id: e.name,
|
|
175
175
|
class: "cc-input__control tnum",
|
|
176
176
|
type: e.type,
|
|
@@ -189,11 +189,11 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
189
189
|
onFocus: n[0] ||= (e) => i("focus", e),
|
|
190
190
|
onBlur: n[1] ||= (e) => i("blur", e),
|
|
191
191
|
onChange: n[2] ||= (e) => i("change", e)
|
|
192
|
-
}, null, 40,
|
|
193
|
-
e.error ? (
|
|
192
|
+
}, null, 40, L)], 2),
|
|
193
|
+
e.error ? (g(), o("p", R, S(e.error), 1)) : e.hint ? (g(), o("p", se, S(e.hint), 1)) : a("", !0)
|
|
194
194
|
], 2));
|
|
195
195
|
}
|
|
196
|
-
}), [["__scopeId", "data-v-4b6c01de"]]),
|
|
196
|
+
}), [["__scopeId", "data-v-4b6c01de"]]), ce = ["for"], le = [
|
|
197
197
|
"id",
|
|
198
198
|
"value",
|
|
199
199
|
"name",
|
|
@@ -203,13 +203,13 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
203
203
|
"readonly",
|
|
204
204
|
"autocomplete",
|
|
205
205
|
"aria-invalid"
|
|
206
|
-
],
|
|
206
|
+
], B = {
|
|
207
207
|
key: 1,
|
|
208
208
|
class: "cc-textarea__message cc-textarea__message--error"
|
|
209
|
-
},
|
|
209
|
+
}, ue = {
|
|
210
210
|
key: 2,
|
|
211
211
|
class: "cc-textarea__message"
|
|
212
|
-
},
|
|
212
|
+
}, V = /*#__PURE__*/ j(/* @__PURE__ */ d({
|
|
213
213
|
__name: "CcTextarea",
|
|
214
214
|
props: {
|
|
215
215
|
modelValue: { default: "" },
|
|
@@ -239,15 +239,15 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
239
239
|
function l(e) {
|
|
240
240
|
i("update:modelValue", e.target.value);
|
|
241
241
|
}
|
|
242
|
-
return (t, n) => (
|
|
242
|
+
return (t, n) => (g(), o("div", { class: p(["cc-textarea", {
|
|
243
243
|
"cc-textarea--error": c.value,
|
|
244
244
|
"cc-textarea--disabled": e.disabled
|
|
245
245
|
}]) }, [
|
|
246
|
-
e.label ? (
|
|
246
|
+
e.label ? (g(), o("label", {
|
|
247
247
|
key: 0,
|
|
248
248
|
class: "cc-textarea__label",
|
|
249
249
|
for: e.name
|
|
250
|
-
},
|
|
250
|
+
}, S(e.label), 9, ce)) : a("", !0),
|
|
251
251
|
s("textarea", {
|
|
252
252
|
id: e.name,
|
|
253
253
|
class: "cc-textarea__control",
|
|
@@ -262,28 +262,28 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
262
262
|
onInput: l,
|
|
263
263
|
onFocus: n[0] ||= (e) => i("focus", e),
|
|
264
264
|
onBlur: n[1] ||= (e) => i("blur", e)
|
|
265
|
-
}, null, 40,
|
|
266
|
-
e.error ? (
|
|
265
|
+
}, null, 40, le),
|
|
266
|
+
e.error ? (g(), o("p", B, S(e.error), 1)) : e.hint ? (g(), o("p", ue, S(e.hint), 1)) : a("", !0)
|
|
267
267
|
], 2));
|
|
268
268
|
}
|
|
269
|
-
}), [["__scopeId", "data-v-9840d15e"]]),
|
|
269
|
+
}), [["__scopeId", "data-v-9840d15e"]]), H = ["for"], de = { class: "cc-select__wrap" }, U = [
|
|
270
270
|
"id",
|
|
271
271
|
"value",
|
|
272
272
|
"name",
|
|
273
273
|
"disabled",
|
|
274
274
|
"aria-invalid"
|
|
275
|
-
],
|
|
275
|
+
], W = {
|
|
276
276
|
key: 0,
|
|
277
277
|
value: "",
|
|
278
278
|
disabled: "",
|
|
279
279
|
selected: ""
|
|
280
|
-
},
|
|
280
|
+
}, G = ["value", "disabled"], K = {
|
|
281
281
|
key: 1,
|
|
282
282
|
class: "cc-select__message cc-select__message--error"
|
|
283
|
-
},
|
|
283
|
+
}, fe = {
|
|
284
284
|
key: 2,
|
|
285
285
|
class: "cc-select__message"
|
|
286
|
-
},
|
|
286
|
+
}, q = /*#__PURE__*/ j(/* @__PURE__ */ d({
|
|
287
287
|
__name: "CcSelect",
|
|
288
288
|
props: {
|
|
289
289
|
modelValue: { default: "" },
|
|
@@ -305,16 +305,16 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
305
305
|
let t = e.target;
|
|
306
306
|
c("update:modelValue", t.value), c("change", e);
|
|
307
307
|
}
|
|
308
|
-
return (n, r) => (
|
|
308
|
+
return (n, r) => (g(), o("div", { class: p(["cc-select", {
|
|
309
309
|
"cc-select--error": l.value,
|
|
310
310
|
"cc-select--disabled": t.disabled
|
|
311
311
|
}]) }, [
|
|
312
|
-
t.label ? (
|
|
312
|
+
t.label ? (g(), o("label", {
|
|
313
313
|
key: 0,
|
|
314
314
|
class: "cc-select__label",
|
|
315
315
|
for: t.name
|
|
316
|
-
},
|
|
317
|
-
s("div",
|
|
316
|
+
}, S(t.label), 9, H)) : a("", !0),
|
|
317
|
+
s("div", de, [s("select", {
|
|
318
318
|
id: t.name,
|
|
319
319
|
class: "cc-select__control",
|
|
320
320
|
value: t.modelValue,
|
|
@@ -322,11 +322,11 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
322
322
|
disabled: t.disabled,
|
|
323
323
|
"aria-invalid": l.value || void 0,
|
|
324
324
|
onChange: u
|
|
325
|
-
}, [t.placeholder ? (
|
|
325
|
+
}, [t.placeholder ? (g(), o("option", W, S(t.placeholder), 1)) : a("", !0), (g(!0), o(e, null, y(t.options, (e) => (g(), o("option", {
|
|
326
326
|
key: String(e.value),
|
|
327
327
|
value: e.value,
|
|
328
328
|
disabled: e.disabled
|
|
329
|
-
},
|
|
329
|
+
}, S(e.label), 9, G))), 128))], 40, U), r[0] ||= s("svg", {
|
|
330
330
|
class: "cc-select__chevron",
|
|
331
331
|
width: "16",
|
|
332
332
|
height: "16",
|
|
@@ -340,19 +340,19 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
340
340
|
"stroke-linecap": "round",
|
|
341
341
|
"stroke-linejoin": "round"
|
|
342
342
|
})], -1)]),
|
|
343
|
-
t.error ? (
|
|
343
|
+
t.error ? (g(), o("p", K, S(t.error), 1)) : t.hint ? (g(), o("p", fe, S(t.hint), 1)) : a("", !0)
|
|
344
344
|
], 2));
|
|
345
345
|
}
|
|
346
|
-
}), [["__scopeId", "data-v-0e1871e6"]]),
|
|
346
|
+
}), [["__scopeId", "data-v-0e1871e6"]]), J = [
|
|
347
347
|
"aria-checked",
|
|
348
348
|
"aria-label",
|
|
349
349
|
"disabled"
|
|
350
|
-
],
|
|
350
|
+
], Y = {
|
|
351
351
|
key: 0,
|
|
352
352
|
class: "cc-switch__label"
|
|
353
|
-
},
|
|
353
|
+
}, X = /*#__PURE__*/ j(/* @__PURE__ */ d({
|
|
354
354
|
__name: "CcSwitch",
|
|
355
|
-
props: /*@__PURE__*/
|
|
355
|
+
props: /*@__PURE__*/ f({
|
|
356
356
|
label: { default: void 0 },
|
|
357
357
|
disabled: {
|
|
358
358
|
type: Boolean,
|
|
@@ -368,13 +368,13 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
368
368
|
}),
|
|
369
369
|
emits: ["update:modelValue"],
|
|
370
370
|
setup(e) {
|
|
371
|
-
let t =
|
|
371
|
+
let t = w(e, "modelValue"), n = e;
|
|
372
372
|
function r() {
|
|
373
373
|
n.disabled || (t.value = !t.value);
|
|
374
374
|
}
|
|
375
|
-
return (n, i) => (
|
|
375
|
+
return (n, i) => (g(), o("button", {
|
|
376
376
|
type: "button",
|
|
377
|
-
class:
|
|
377
|
+
class: p(["cc-switch", [`cc-switch--${e.size}`, {
|
|
378
378
|
"cc-switch--checked": t.value,
|
|
379
379
|
"cc-switch--disabled": e.disabled
|
|
380
380
|
}]]),
|
|
@@ -383,14 +383,14 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
383
383
|
"aria-label": e.label || "switch",
|
|
384
384
|
disabled: e.disabled,
|
|
385
385
|
onClick: r
|
|
386
|
-
}, [i[0] ||= s("span", { class: "cc-switch__track" }, [s("span", { class: "cc-switch__knob" })], -1), e.label ? (
|
|
386
|
+
}, [i[0] ||= s("span", { class: "cc-switch__track" }, [s("span", { class: "cc-switch__knob" })], -1), e.label ? (g(), o("span", Y, S(e.label), 1)) : a("", !0)], 10, J));
|
|
387
387
|
}
|
|
388
|
-
}), [["__scopeId", "data-v-cb8ad6ea"]]),
|
|
388
|
+
}), [["__scopeId", "data-v-cb8ad6ea"]]), Z = ["disabled"], pe = {
|
|
389
389
|
key: 0,
|
|
390
390
|
class: "cc-checkbox__label"
|
|
391
|
-
},
|
|
391
|
+
}, Q = /*#__PURE__*/ j(/* @__PURE__ */ d({
|
|
392
392
|
__name: "CcCheckbox",
|
|
393
|
-
props: /*@__PURE__*/
|
|
393
|
+
props: /*@__PURE__*/ f({
|
|
394
394
|
label: { default: void 0 },
|
|
395
395
|
disabled: {
|
|
396
396
|
type: Boolean,
|
|
@@ -405,14 +405,14 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
405
405
|
}),
|
|
406
406
|
emits: ["update:modelValue"],
|
|
407
407
|
setup(e) {
|
|
408
|
-
let t =
|
|
409
|
-
return (n, r) => (
|
|
410
|
-
|
|
408
|
+
let t = w(e, "modelValue");
|
|
409
|
+
return (n, r) => (g(), o("label", { class: p(["cc-checkbox", { "cc-checkbox--disabled": e.disabled }]) }, [
|
|
410
|
+
k(s("input", {
|
|
411
411
|
"onUpdate:modelValue": r[0] ||= (e) => t.value = e,
|
|
412
412
|
type: "checkbox",
|
|
413
413
|
class: "cc-checkbox__native",
|
|
414
414
|
disabled: e.disabled
|
|
415
|
-
}, null, 8,
|
|
415
|
+
}, null, 8, Z), [[T, t.value]]),
|
|
416
416
|
r[1] ||= s("span", {
|
|
417
417
|
class: "cc-checkbox__box",
|
|
418
418
|
"aria-hidden": "true"
|
|
@@ -429,16 +429,16 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
429
429
|
"stroke-linecap": "round",
|
|
430
430
|
"stroke-linejoin": "round"
|
|
431
431
|
})])], -1),
|
|
432
|
-
e.label ? (
|
|
433
|
-
|
|
432
|
+
e.label ? (g(), o("span", pe, S(e.label), 1)) : a("", !0),
|
|
433
|
+
b(n.$slots, "default", {}, void 0, !0)
|
|
434
434
|
], 2));
|
|
435
435
|
}
|
|
436
|
-
}), [["__scopeId", "data-v-bf838053"]]),
|
|
436
|
+
}), [["__scopeId", "data-v-bf838053"]]), me = ["value", "disabled"], he = {
|
|
437
437
|
key: 0,
|
|
438
438
|
class: "cc-radio__label"
|
|
439
|
-
},
|
|
439
|
+
}, ge = /*#__PURE__*/ j(/* @__PURE__ */ d({
|
|
440
440
|
__name: "CcRadio",
|
|
441
|
-
props: /*@__PURE__*/
|
|
441
|
+
props: /*@__PURE__*/ f({
|
|
442
442
|
value: {},
|
|
443
443
|
label: { default: void 0 },
|
|
444
444
|
disabled: {
|
|
@@ -451,36 +451,36 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
451
451
|
}),
|
|
452
452
|
emits: ["update:modelValue"],
|
|
453
453
|
setup(e) {
|
|
454
|
-
let t =
|
|
455
|
-
return (n, r) => (
|
|
456
|
-
|
|
454
|
+
let t = w(e, "modelValue");
|
|
455
|
+
return (n, r) => (g(), o("label", { class: p(["cc-radio", { "cc-radio--disabled": e.disabled }]) }, [
|
|
456
|
+
k(s("input", {
|
|
457
457
|
"onUpdate:modelValue": r[0] ||= (e) => t.value = e,
|
|
458
458
|
type: "radio",
|
|
459
459
|
class: "cc-radio__native",
|
|
460
460
|
value: e.value,
|
|
461
461
|
disabled: e.disabled
|
|
462
|
-
}, null, 8,
|
|
462
|
+
}, null, 8, me), [[E, t.value]]),
|
|
463
463
|
r[1] ||= s("span", {
|
|
464
464
|
class: "cc-radio__dot",
|
|
465
465
|
"aria-hidden": "true"
|
|
466
466
|
}, null, -1),
|
|
467
|
-
e.label ? (
|
|
468
|
-
|
|
467
|
+
e.label ? (g(), o("span", he, S(e.label), 1)) : a("", !0),
|
|
468
|
+
b(n.$slots, "default", {}, void 0, !0)
|
|
469
469
|
], 2));
|
|
470
470
|
}
|
|
471
|
-
}), [["__scopeId", "data-v-0a6c4d47"]]),
|
|
471
|
+
}), [["__scopeId", "data-v-0a6c4d47"]]), _e = {
|
|
472
472
|
key: 0,
|
|
473
473
|
class: "cc-card__header"
|
|
474
|
-
},
|
|
474
|
+
}, ve = {
|
|
475
475
|
key: 0,
|
|
476
476
|
class: "cc-card__title"
|
|
477
|
-
},
|
|
477
|
+
}, ye = {
|
|
478
478
|
key: 1,
|
|
479
479
|
class: "cc-card__desc"
|
|
480
|
-
},
|
|
480
|
+
}, be = { class: "cc-card__body" }, xe = {
|
|
481
481
|
key: 0,
|
|
482
482
|
class: "cc-card__footer"
|
|
483
|
-
},
|
|
483
|
+
}, Se = /*#__PURE__*/ j(/* @__PURE__ */ d({
|
|
484
484
|
__name: "CcCard",
|
|
485
485
|
props: {
|
|
486
486
|
variant: { default: "feature" },
|
|
@@ -492,16 +492,16 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
492
492
|
}
|
|
493
493
|
},
|
|
494
494
|
setup(e) {
|
|
495
|
-
return (t, n) => (
|
|
496
|
-
|
|
497
|
-
s("div",
|
|
498
|
-
t.$slots.footer ? (
|
|
495
|
+
return (t, n) => (g(), o("article", { class: p(["cc-card", [`cc-card--${e.variant}`, { "cc-card--flush": e.flush }]]) }, [
|
|
496
|
+
b(t.$slots, "header", {}, () => [e.title || e.description ? (g(), o("header", _e, [e.title ? (g(), o("h3", ve, S(e.title), 1)) : a("", !0), e.description ? (g(), o("p", ye, S(e.description), 1)) : a("", !0)])) : a("", !0)], !0),
|
|
497
|
+
s("div", be, [b(t.$slots, "default", {}, void 0, !0)]),
|
|
498
|
+
t.$slots.footer ? (g(), o("footer", xe, [b(t.$slots, "footer", {}, void 0, !0)])) : a("", !0)
|
|
499
499
|
], 2));
|
|
500
500
|
}
|
|
501
|
-
}), [["__scopeId", "data-v-7f39ac3e"]]),
|
|
501
|
+
}), [["__scopeId", "data-v-7f39ac3e"]]), Ce = {
|
|
502
502
|
key: 0,
|
|
503
503
|
class: "cc-tag__dot"
|
|
504
|
-
},
|
|
504
|
+
}, we = /*#__PURE__*/ j(/* @__PURE__ */ d({
|
|
505
505
|
__name: "CcTag",
|
|
506
506
|
props: {
|
|
507
507
|
variant: { default: "soft" },
|
|
@@ -518,15 +518,15 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
518
518
|
emits: ["close"],
|
|
519
519
|
setup(e, { emit: t }) {
|
|
520
520
|
let n = t;
|
|
521
|
-
return (t, r) => (
|
|
522
|
-
e.dot ? (
|
|
523
|
-
|
|
524
|
-
e.closable ? (
|
|
521
|
+
return (t, r) => (g(), o("span", { class: p(["cc-tag", [`cc-tag--${e.variant}`, `cc-tag--${e.size}`]]) }, [
|
|
522
|
+
e.dot ? (g(), o("span", Ce)) : a("", !0),
|
|
523
|
+
b(t.$slots, "default", {}, void 0, !0),
|
|
524
|
+
e.closable ? (g(), o("button", {
|
|
525
525
|
key: 1,
|
|
526
526
|
type: "button",
|
|
527
527
|
class: "cc-tag__close",
|
|
528
528
|
"aria-label": "close tag",
|
|
529
|
-
onClick: r[0] ||=
|
|
529
|
+
onClick: r[0] ||= A((e) => n("close", e), ["stop"])
|
|
530
530
|
}, [...r[1] ||= [s("svg", {
|
|
531
531
|
width: "10",
|
|
532
532
|
height: "10",
|
|
@@ -541,7 +541,7 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
541
541
|
})], -1)]])) : a("", !0)
|
|
542
542
|
], 2));
|
|
543
543
|
}
|
|
544
|
-
}), [["__scopeId", "data-v-858b2086"]]),
|
|
544
|
+
}), [["__scopeId", "data-v-858b2086"]]), Te = { class: "cc-badge__text tnum" }, Ee = /*#__PURE__*/ j(/* @__PURE__ */ d({
|
|
545
545
|
__name: "CcBadge",
|
|
546
546
|
props: {
|
|
547
547
|
count: { default: 0 },
|
|
@@ -558,15 +558,15 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
558
558
|
let e = Number(t.count);
|
|
559
559
|
return Number.isNaN(e) ? String(t.count) : e > t.max ? `${t.max}+` : String(e);
|
|
560
560
|
});
|
|
561
|
-
return (t, r) => (
|
|
561
|
+
return (t, r) => (g(), o("span", { class: p(["cc-badge", [`cc-badge--${e.variant}`, { "cc-badge--dot-only": e.dot }]]) }, [s("span", Te, S(n.value), 1)], 2));
|
|
562
562
|
}
|
|
563
|
-
}), [["__scopeId", "data-v-466a4bd0"]]),
|
|
563
|
+
}), [["__scopeId", "data-v-466a4bd0"]]), De = { class: "cc-alert__content" }, Oe = {
|
|
564
564
|
key: 0,
|
|
565
565
|
class: "cc-alert__title"
|
|
566
|
-
},
|
|
566
|
+
}, ke = {
|
|
567
567
|
key: 1,
|
|
568
568
|
class: "cc-alert__desc"
|
|
569
|
-
},
|
|
569
|
+
}, Ae = /*#__PURE__*/ j(/* @__PURE__ */ d({
|
|
570
570
|
__name: "CcAlert",
|
|
571
571
|
props: {
|
|
572
572
|
variant: { default: "info" },
|
|
@@ -578,7 +578,7 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
578
578
|
}
|
|
579
579
|
},
|
|
580
580
|
setup(e) {
|
|
581
|
-
let t = e, n =
|
|
581
|
+
let t = e, n = v(!0), i = r(() => {
|
|
582
582
|
switch (t.variant) {
|
|
583
583
|
case "success": return "var(--cc-success)";
|
|
584
584
|
case "warning": return "var(--cc-warning)";
|
|
@@ -586,14 +586,14 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
586
586
|
default: return "var(--cc-primary)";
|
|
587
587
|
}
|
|
588
588
|
});
|
|
589
|
-
return (t, r) => n.value ? (
|
|
589
|
+
return (t, r) => n.value ? (g(), o("div", {
|
|
590
590
|
key: 0,
|
|
591
|
-
class:
|
|
591
|
+
class: p(["cc-alert", `cc-alert--${e.variant}`]),
|
|
592
592
|
role: "alert"
|
|
593
593
|
}, [
|
|
594
594
|
s("span", {
|
|
595
595
|
class: "cc-alert__icon",
|
|
596
|
-
style:
|
|
596
|
+
style: m({ color: i.value }),
|
|
597
597
|
"aria-hidden": "true"
|
|
598
598
|
}, [...r[1] ||= [s("svg", {
|
|
599
599
|
width: "16",
|
|
@@ -620,8 +620,8 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
620
620
|
fill: "currentColor"
|
|
621
621
|
})
|
|
622
622
|
], -1)]], 4),
|
|
623
|
-
s("div",
|
|
624
|
-
e.closable ? (
|
|
623
|
+
s("div", De, [e.title ? (g(), o("p", Oe, S(e.title), 1)) : a("", !0), e.description || t.$slots.default ? (g(), o("p", ke, [b(t.$slots, "default", {}, () => [l(S(e.description), 1)], !0)])) : a("", !0)]),
|
|
624
|
+
e.closable ? (g(), o("button", {
|
|
625
625
|
key: 0,
|
|
626
626
|
type: "button",
|
|
627
627
|
class: "cc-alert__close",
|
|
@@ -641,13 +641,13 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
641
641
|
})], -1)]])) : a("", !0)
|
|
642
642
|
], 2)) : a("", !0);
|
|
643
643
|
}
|
|
644
|
-
}), [["__scopeId", "data-v-8671adaf"]]), je = ["aria-label"],
|
|
644
|
+
}), [["__scopeId", "data-v-8671adaf"]]), je = ["aria-label"], Me = { class: "cc-modal__header" }, Ne = {
|
|
645
645
|
key: 0,
|
|
646
646
|
class: "cc-modal__title"
|
|
647
|
-
},
|
|
647
|
+
}, Pe = { class: "cc-modal__body" }, Fe = {
|
|
648
648
|
key: 0,
|
|
649
649
|
class: "cc-modal__footer"
|
|
650
|
-
},
|
|
650
|
+
}, Ie = /*#__PURE__*/ j(/* @__PURE__ */ d({
|
|
651
651
|
__name: "CcModal",
|
|
652
652
|
props: {
|
|
653
653
|
visible: {
|
|
@@ -675,38 +675,38 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
675
675
|
"close"
|
|
676
676
|
],
|
|
677
677
|
setup(e, { emit: r }) {
|
|
678
|
-
let c = e,
|
|
678
|
+
let c = e, l = r, d = v(null);
|
|
679
679
|
function f() {
|
|
680
|
-
|
|
680
|
+
l("update:visible", !1), l("close");
|
|
681
681
|
}
|
|
682
|
-
function
|
|
682
|
+
function p(e) {
|
|
683
683
|
e.key === "Escape" && c.visible && c.closable && f();
|
|
684
684
|
}
|
|
685
|
-
function
|
|
685
|
+
function _(e) {
|
|
686
686
|
c.maskClosable && e.target === e.currentTarget && f();
|
|
687
687
|
}
|
|
688
|
-
return
|
|
689
|
-
e ? (
|
|
688
|
+
return D(() => c.visible, async (e) => {
|
|
689
|
+
e ? (l("open"), await ee(), d.value?.focus(), document.body.style.overflow = "hidden") : document.body.style.overflow = "";
|
|
690
690
|
}), te(() => {
|
|
691
|
-
document.addEventListener("keydown",
|
|
692
|
-
}),
|
|
693
|
-
document.removeEventListener("keydown",
|
|
694
|
-
}), (r, c) => (
|
|
695
|
-
default:
|
|
691
|
+
document.addEventListener("keydown", p);
|
|
692
|
+
}), h(() => {
|
|
693
|
+
document.removeEventListener("keydown", p), document.body.style.overflow = "";
|
|
694
|
+
}), (r, c) => (g(), i(t, { to: "body" }, [u(n, { name: "cc-modal" }, {
|
|
695
|
+
default: O(() => [e.visible ? (g(), o("div", {
|
|
696
696
|
key: 0,
|
|
697
697
|
class: "cc-modal",
|
|
698
|
-
onClick:
|
|
698
|
+
onClick: A(_, ["self"])
|
|
699
699
|
}, [s("div", {
|
|
700
700
|
ref_key: "panel",
|
|
701
701
|
ref: d,
|
|
702
702
|
class: "cc-modal__panel",
|
|
703
|
-
style:
|
|
703
|
+
style: m({ maxWidth: e.width }),
|
|
704
704
|
role: "dialog",
|
|
705
705
|
"aria-modal": "true",
|
|
706
706
|
"aria-label": e.title || "dialog",
|
|
707
707
|
tabindex: "-1"
|
|
708
708
|
}, [
|
|
709
|
-
s("header",
|
|
709
|
+
s("header", Me, [e.title ? (g(), o("h3", Ne, S(e.title), 1)) : a("", !0), e.closable ? (g(), o("button", {
|
|
710
710
|
key: 1,
|
|
711
711
|
type: "button",
|
|
712
712
|
class: "cc-modal__close",
|
|
@@ -724,13 +724,13 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
724
724
|
"stroke-width": "1.4",
|
|
725
725
|
"stroke-linecap": "round"
|
|
726
726
|
})], -1)]])) : a("", !0)]),
|
|
727
|
-
s("div",
|
|
728
|
-
r.$slots.footer ? (
|
|
727
|
+
s("div", Pe, [b(r.$slots, "default", {}, void 0, !0)]),
|
|
728
|
+
r.$slots.footer ? (g(), o("footer", Fe, [b(r.$slots, "footer", {}, void 0, !0)])) : a("", !0)
|
|
729
729
|
], 12, je)])) : a("", !0)]),
|
|
730
730
|
_: 3
|
|
731
731
|
})]));
|
|
732
732
|
}
|
|
733
|
-
}), [["__scopeId", "data-v-d2a6d4fd"]]),
|
|
733
|
+
}), [["__scopeId", "data-v-d2a6d4fd"]]), Le = /*#__PURE__*/ j(/* @__PURE__ */ d({
|
|
734
734
|
__name: "CcTooltip",
|
|
735
735
|
props: {
|
|
736
736
|
content: { default: void 0 },
|
|
@@ -738,81 +738,501 @@ var ae = ["width", "height"], oe = /*@__PURE__*/ u({
|
|
|
738
738
|
delay: { default: 0 }
|
|
739
739
|
},
|
|
740
740
|
setup(e) {
|
|
741
|
-
let t = e, n =
|
|
742
|
-
function
|
|
741
|
+
let t = e, n = v(!1), i = null, s = r(() => n.value);
|
|
742
|
+
function c() {
|
|
743
743
|
t.delay > 0 ? i = setTimeout(() => n.value = !0, t.delay) : n.value = !0;
|
|
744
744
|
}
|
|
745
745
|
function u() {
|
|
746
746
|
i && clearTimeout(i), n.value = !1;
|
|
747
747
|
}
|
|
748
|
-
return (t, n) => (
|
|
748
|
+
return (t, n) => (g(), o("span", {
|
|
749
749
|
class: "cc-tooltip",
|
|
750
|
-
onMouseenter:
|
|
750
|
+
onMouseenter: c,
|
|
751
751
|
onMouseleave: u,
|
|
752
|
-
onFocusin:
|
|
752
|
+
onFocusin: c,
|
|
753
753
|
onFocusout: u
|
|
754
|
-
}, [
|
|
754
|
+
}, [b(t.$slots, "default", {}, void 0, !0), s.value && (e.content || t.$slots.tip) ? (g(), o("span", {
|
|
755
755
|
key: 0,
|
|
756
|
-
class:
|
|
756
|
+
class: p(["cc-tooltip__bubble", `cc-tooltip--${e.placement}`]),
|
|
757
757
|
role: "tooltip"
|
|
758
|
-
}, [
|
|
758
|
+
}, [b(t.$slots, "tip", {}, () => [l(S(e.content), 1)], !0)], 2)) : a("", !0)], 32));
|
|
759
759
|
}
|
|
760
|
-
}), [["__scopeId", "data-v-2befb04b"]]),
|
|
760
|
+
}), [["__scopeId", "data-v-2befb04b"]]), Re = {
|
|
761
761
|
key: 0,
|
|
762
762
|
class: "cc-divider__label"
|
|
763
|
-
},
|
|
763
|
+
}, ze = /*#__PURE__*/ j(/* @__PURE__ */ d({
|
|
764
764
|
__name: "CcDivider",
|
|
765
765
|
props: {
|
|
766
766
|
orientation: { default: "horizontal" },
|
|
767
767
|
height: { default: "1em" }
|
|
768
768
|
},
|
|
769
769
|
setup(e) {
|
|
770
|
-
return (t, n) => (
|
|
771
|
-
class:
|
|
770
|
+
return (t, n) => (g(), o("div", {
|
|
771
|
+
class: p(["cc-divider", [`cc-divider--${e.orientation}`]]),
|
|
772
772
|
role: "separator",
|
|
773
|
-
style:
|
|
774
|
-
}, [t.$slots.default ? (
|
|
773
|
+
style: m(e.orientation === "vertical" ? { height: e.height } : void 0)
|
|
774
|
+
}, [t.$slots.default ? (g(), o("span", Re, [b(t.$slots, "default", {}, void 0, !0)])) : a("", !0)], 6));
|
|
775
|
+
}
|
|
776
|
+
}), [["__scopeId", "data-v-c42961cd"]]), Be = { class: "cc-table" }, Ve = { class: "cc-table__toolbar" }, He = { class: "cc-table__filters" }, Ue = {
|
|
777
|
+
key: 0,
|
|
778
|
+
class: "cc-table__filter"
|
|
779
|
+
}, We = { class: "cc-table__filter-label" }, Ge = ["onUpdate:modelValue"], Ke = ["value"], qe = {
|
|
780
|
+
key: 1,
|
|
781
|
+
class: "cc-table__filter"
|
|
782
|
+
}, Je = { class: "cc-table__filter-label" }, Ye = ["onUpdate:modelValue", "placeholder"], Xe = { class: "cc-table__settings" }, Ze = { class: "cc-table__settings-panel" }, Qe = { class: "cc-table__settings-section" }, $e = { class: "cc-table__density" }, et = ["onClick"], tt = { class: "cc-table__settings-section" }, nt = { class: "cc-table__settings-cols" }, rt = [
|
|
783
|
+
"draggable",
|
|
784
|
+
"onDragstart",
|
|
785
|
+
"onDragover",
|
|
786
|
+
"onDrop"
|
|
787
|
+
], it = ["checked", "indeterminate"], at = {
|
|
788
|
+
key: 1,
|
|
789
|
+
class: "cc-table__th-title"
|
|
790
|
+
}, ot = {
|
|
791
|
+
key: 0,
|
|
792
|
+
class: "cc-table__drag-handle",
|
|
793
|
+
width: "10",
|
|
794
|
+
height: "14",
|
|
795
|
+
viewBox: "0 0 10 14",
|
|
796
|
+
fill: "none",
|
|
797
|
+
"aria-hidden": "true"
|
|
798
|
+
}, st = { key: 0 }, ct = ["colspan"], lt = [
|
|
799
|
+
"checked",
|
|
800
|
+
"aria-label",
|
|
801
|
+
"onChange"
|
|
802
|
+
], ut = { class: "cc-table__footer" }, dt = { class: "cc-table__total" }, ft = { class: "cc-table__pager" }, pt = ["value"], mt = ["disabled"], ht = ["onClick"], gt = {
|
|
803
|
+
key: 1,
|
|
804
|
+
class: "cc-table__page-ellipsis"
|
|
805
|
+
}, _t = ["disabled"], vt = "__selection__", yt = 48, $ = /*#__PURE__*/ j(/* @__PURE__ */ d({
|
|
806
|
+
__name: "CcTable",
|
|
807
|
+
props: /*@__PURE__*/ f({
|
|
808
|
+
columns: {},
|
|
809
|
+
data: {},
|
|
810
|
+
rowKey: { default: "id" },
|
|
811
|
+
tableKey: { default: "default" },
|
|
812
|
+
showSelection: {
|
|
813
|
+
type: Boolean,
|
|
814
|
+
default: !0
|
|
815
|
+
},
|
|
816
|
+
pageSizeOptions: { default: () => [
|
|
817
|
+
10,
|
|
818
|
+
20,
|
|
819
|
+
50
|
|
820
|
+
] },
|
|
821
|
+
defaultDensity: { default: "medium" },
|
|
822
|
+
emptyText: { default: "暂无数据" },
|
|
823
|
+
maxHeight: { default: void 0 }
|
|
824
|
+
}, {
|
|
825
|
+
selectedKeys: { default: () => [] },
|
|
826
|
+
selectedKeysModifiers: {}
|
|
827
|
+
}),
|
|
828
|
+
emits: /*@__PURE__*/ f(["selection-change"], ["update:selectedKeys"]),
|
|
829
|
+
setup(t, { emit: n }) {
|
|
830
|
+
let d = t, f = w(t, "selectedKeys"), ee = n, h = [
|
|
831
|
+
{
|
|
832
|
+
label: "大",
|
|
833
|
+
value: "large"
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
label: "中",
|
|
837
|
+
value: "medium"
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
label: "小",
|
|
841
|
+
value: "small"
|
|
842
|
+
}
|
|
843
|
+
], x = r(() => `cc-table:${d.tableKey}`), C = v([]), T = _({}), E = v(d.defaultDensity), A = v(!1);
|
|
844
|
+
function ie() {
|
|
845
|
+
let e = null;
|
|
846
|
+
try {
|
|
847
|
+
let t = localStorage.getItem(x.value);
|
|
848
|
+
t && (e = JSON.parse(t));
|
|
849
|
+
} catch {
|
|
850
|
+
e = null;
|
|
851
|
+
}
|
|
852
|
+
let t = d.columns.map((e) => e.key), n = (e?.order ?? []).filter((e) => t.includes(e));
|
|
853
|
+
C.value = [...n, ...t.filter((e) => !n.includes(e))];
|
|
854
|
+
for (let n of t) T[n] = e?.visibility?.[n] ?? !0;
|
|
855
|
+
e?.density && h.some((t) => t.value === e.density) && (E.value = e.density);
|
|
856
|
+
}
|
|
857
|
+
function ae() {
|
|
858
|
+
let e = {
|
|
859
|
+
v: 1,
|
|
860
|
+
order: C.value,
|
|
861
|
+
visibility: { ...T },
|
|
862
|
+
density: E.value
|
|
863
|
+
};
|
|
864
|
+
try {
|
|
865
|
+
localStorage.setItem(x.value, JSON.stringify(e));
|
|
866
|
+
} catch {}
|
|
867
|
+
}
|
|
868
|
+
function j() {
|
|
869
|
+
C.value = d.columns.map((e) => e.key);
|
|
870
|
+
for (let e of d.columns.map((e) => e.key)) T[e] = !0;
|
|
871
|
+
E.value = d.defaultDensity, A.value = !1;
|
|
872
|
+
}
|
|
873
|
+
D([
|
|
874
|
+
C,
|
|
875
|
+
T,
|
|
876
|
+
E
|
|
877
|
+
], ae, { deep: !0 }), D(() => d.columns.map((e) => e.key), (e) => {
|
|
878
|
+
for (let t of e) C.value.includes(t) || C.value.push(t), T[t] === void 0 && (T[t] = !0);
|
|
879
|
+
});
|
|
880
|
+
function M(e) {
|
|
881
|
+
return e.width ?? 140;
|
|
882
|
+
}
|
|
883
|
+
let oe = r(() => d.columns.filter((e) => !e.fixed)), N = r(() => {
|
|
884
|
+
let e = new Map(C.value.map((e, t) => [e, t]));
|
|
885
|
+
return d.columns.filter((e) => !e.fixed).filter((e) => T[e.key] !== !1).sort((t, n) => (e.get(t.key) ?? 0) - (e.get(n.key) ?? 0));
|
|
886
|
+
}), F = r(() => {
|
|
887
|
+
let e = [], t = (e) => ({
|
|
888
|
+
key: e.key,
|
|
889
|
+
title: e.title,
|
|
890
|
+
width: M(e),
|
|
891
|
+
slot: e.slot ?? "",
|
|
892
|
+
align: e.align ?? "left",
|
|
893
|
+
fixed: e.fixed,
|
|
894
|
+
filterable: e.filterable,
|
|
895
|
+
filterType: e.filterType ?? "text",
|
|
896
|
+
filterOptions: e.filterOptions,
|
|
897
|
+
formatter: e.formatter
|
|
898
|
+
});
|
|
899
|
+
d.showSelection && e.push({
|
|
900
|
+
key: vt,
|
|
901
|
+
title: "",
|
|
902
|
+
width: yt,
|
|
903
|
+
slot: "",
|
|
904
|
+
align: "center",
|
|
905
|
+
left: 0,
|
|
906
|
+
isSelection: !0
|
|
907
|
+
});
|
|
908
|
+
let n = d.columns.filter((e) => e.fixed === "left"), r = d.showSelection ? yt : 0;
|
|
909
|
+
n.forEach((i, a) => {
|
|
910
|
+
e.push({
|
|
911
|
+
...t(i),
|
|
912
|
+
left: r,
|
|
913
|
+
isLastLeftFixed: a === n.length - 1
|
|
914
|
+
}), r += M(i);
|
|
915
|
+
});
|
|
916
|
+
for (let n of N.value) e.push(t(n));
|
|
917
|
+
let i = d.columns.filter((e) => e.fixed === "right"), a = 0, o = /* @__PURE__ */ new Map();
|
|
918
|
+
for (let e = i.length - 1; e >= 0; e--) o.set(i[e].key, a), a += M(i[e]);
|
|
919
|
+
for (let n of i) e.push({
|
|
920
|
+
...t(n),
|
|
921
|
+
right: o.get(n.key)
|
|
922
|
+
});
|
|
923
|
+
return e;
|
|
924
|
+
}), I = v(null), L = v(null);
|
|
925
|
+
function R(e) {
|
|
926
|
+
return !e.fixed && !e.isSelection;
|
|
927
|
+
}
|
|
928
|
+
function se(e, t) {
|
|
929
|
+
R(e) && (I.value = e.key, L.value = null, t.dataTransfer && (t.dataTransfer.effectAllowed = "move", t.dataTransfer.setData("text/plain", e.key)));
|
|
930
|
+
}
|
|
931
|
+
function z(e, t) {
|
|
932
|
+
I.value && e.key !== I.value && R(e) && (t.preventDefault(), t.dataTransfer && (t.dataTransfer.dropEffect = "move"), L.value = e.key);
|
|
933
|
+
}
|
|
934
|
+
function ce(e, t) {
|
|
935
|
+
t.preventDefault();
|
|
936
|
+
let n = I.value;
|
|
937
|
+
if (!n || n === e.key) return;
|
|
938
|
+
let r = N.value.map((e) => e.key), i = r.indexOf(n), a = r.indexOf(e.key);
|
|
939
|
+
if (i < 0 || a < 0) return;
|
|
940
|
+
let o = [...r];
|
|
941
|
+
o.splice(i, 1);
|
|
942
|
+
let s = i < a ? a - 1 : a;
|
|
943
|
+
o.splice(s, 0, n);
|
|
944
|
+
let c = d.columns.filter((e) => e.fixed === "left").map((e) => e.key), l = d.columns.filter((e) => e.fixed === "right").map((e) => e.key);
|
|
945
|
+
C.value = [
|
|
946
|
+
...c,
|
|
947
|
+
...o,
|
|
948
|
+
...l
|
|
949
|
+
], L.value = null;
|
|
950
|
+
}
|
|
951
|
+
function le() {
|
|
952
|
+
I.value = null, L.value = null;
|
|
953
|
+
}
|
|
954
|
+
let B = _({}), ue = r(() => F.value.filter((e) => e.filterable && !e.isSelection)), V = r(() => Object.values(B).some((e) => e !== "")), H = r(() => {
|
|
955
|
+
let e = Object.entries(B).filter(([, e]) => e !== "");
|
|
956
|
+
return e.length ? d.data.filter((t) => e.every(([e, n]) => {
|
|
957
|
+
let r = t[e];
|
|
958
|
+
return r == null ? !1 : d.columns.find((t) => t.key === e)?.filterType === "select" ? String(r) === n : String(r).toLowerCase().includes(n.toLowerCase());
|
|
959
|
+
})) : d.data;
|
|
960
|
+
});
|
|
961
|
+
function de() {
|
|
962
|
+
for (let e of Object.keys(B)) B[e] = "";
|
|
963
|
+
W.value = 1;
|
|
964
|
+
}
|
|
965
|
+
let U = v(d.pageSizeOptions[0] ?? 10), W = v(1), G = r(() => Math.max(1, Math.ceil(H.value.length / U.value))), K = r(() => H.value.slice((W.value - 1) * U.value, W.value * U.value)), fe = r(() => {
|
|
966
|
+
let e = G.value, t = W.value;
|
|
967
|
+
if (e <= 7) return Array.from({ length: e }, (e, t) => t + 1);
|
|
968
|
+
let n = [.../* @__PURE__ */ new Set([
|
|
969
|
+
1,
|
|
970
|
+
e,
|
|
971
|
+
t - 1,
|
|
972
|
+
t,
|
|
973
|
+
t + 1
|
|
974
|
+
])].filter((t) => t >= 1 && t <= e).sort((e, t) => e - t), r = [], i = 0;
|
|
975
|
+
for (let e of n) e - i > 1 && r.push("…"), r.push(e), i = e;
|
|
976
|
+
return r;
|
|
977
|
+
});
|
|
978
|
+
D([H, U], () => {
|
|
979
|
+
W.value > G.value && (W.value = G.value);
|
|
980
|
+
});
|
|
981
|
+
function q(e) {
|
|
982
|
+
W.value = Math.min(Math.max(1, e), G.value);
|
|
983
|
+
}
|
|
984
|
+
function J(e) {
|
|
985
|
+
let t = e[d.rowKey];
|
|
986
|
+
return t == null ? JSON.stringify(e) : String(t);
|
|
987
|
+
}
|
|
988
|
+
function Y(e) {
|
|
989
|
+
return f.value.includes(J(e));
|
|
990
|
+
}
|
|
991
|
+
function X(e) {
|
|
992
|
+
let t = J(e);
|
|
993
|
+
f.value.includes(t) ? f.value = f.value.filter((e) => e !== t) : f.value = [...f.value, t];
|
|
994
|
+
}
|
|
995
|
+
let Z = r(() => K.value.length > 0 && K.value.every((e) => Y(e))), pe = r(() => !Z.value && K.value.some((e) => Y(e)));
|
|
996
|
+
function me() {
|
|
997
|
+
if (Z.value) {
|
|
998
|
+
let e = new Set(K.value.map((e) => J(e)));
|
|
999
|
+
f.value = f.value.filter((t) => !e.has(t));
|
|
1000
|
+
} else {
|
|
1001
|
+
let e = new Set(f.value);
|
|
1002
|
+
for (let t of K.value) e.add(J(t));
|
|
1003
|
+
f.value = [...e];
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
D(f, (e) => {
|
|
1007
|
+
let t = e.map((e) => d.data.find((t) => J(t) === e)).filter((e) => !!e);
|
|
1008
|
+
ee("selection-change", e, t);
|
|
1009
|
+
}, { deep: !0 });
|
|
1010
|
+
function he(e, t) {
|
|
1011
|
+
let n = t[e.key];
|
|
1012
|
+
return n == null ? "—" : e.formatter ? e.formatter(n, t) : String(n);
|
|
1013
|
+
}
|
|
1014
|
+
return te(ie), (n, r) => (g(), o("div", Be, [
|
|
1015
|
+
s("div", Ve, [s("div", He, [(g(!0), o(e, null, y(ue.value, (t) => (g(), o(e, { key: t.key }, [t.filterType === "select" ? (g(), o("label", Ue, [s("span", We, S(t.title), 1), k(s("select", {
|
|
1016
|
+
"onUpdate:modelValue": (e) => B[t.key] = e,
|
|
1017
|
+
class: "cc-table__filter-control"
|
|
1018
|
+
}, [r[5] ||= s("option", { value: "" }, "全部", -1), (g(!0), o(e, null, y(t.filterOptions, (e) => (g(), o("option", {
|
|
1019
|
+
key: String(e.value),
|
|
1020
|
+
value: String(e.value)
|
|
1021
|
+
}, S(e.label), 9, Ke))), 128))], 8, Ge), [[ne, B[t.key]]])])) : (g(), o("label", qe, [s("span", Je, S(t.title), 1), k(s("input", {
|
|
1022
|
+
"onUpdate:modelValue": (e) => B[t.key] = e,
|
|
1023
|
+
class: "cc-table__filter-control",
|
|
1024
|
+
type: "text",
|
|
1025
|
+
placeholder: `搜索${t.title}`
|
|
1026
|
+
}, null, 8, Ye), [[re, B[t.key]]])]))], 64))), 128)), V.value ? (g(), i(P, {
|
|
1027
|
+
key: 0,
|
|
1028
|
+
size: "sm",
|
|
1029
|
+
variant: "ghost",
|
|
1030
|
+
onClick: de
|
|
1031
|
+
}, {
|
|
1032
|
+
default: O(() => [...r[6] ||= [l(" 重置 ", -1)]]),
|
|
1033
|
+
_: 1
|
|
1034
|
+
})) : a("", !0)]), s("div", Xe, [u(P, {
|
|
1035
|
+
size: "sm",
|
|
1036
|
+
variant: "secondary",
|
|
1037
|
+
onClick: r[0] ||= (e) => A.value = !A.value
|
|
1038
|
+
}, {
|
|
1039
|
+
default: O(() => [...r[7] ||= [l(" 列设置 ", -1)]]),
|
|
1040
|
+
_: 1
|
|
1041
|
+
}), A.value ? (g(), o(e, { key: 0 }, [s("div", {
|
|
1042
|
+
class: "cc-table__backdrop",
|
|
1043
|
+
onClick: r[1] ||= (e) => A.value = !1
|
|
1044
|
+
}), s("div", Ze, [
|
|
1045
|
+
s("div", Qe, [r[8] ||= s("div", { class: "cc-table__settings-title" }, "表格密度", -1), s("div", $e, [(g(), o(e, null, y(h, (e) => s("button", {
|
|
1046
|
+
key: e.value,
|
|
1047
|
+
type: "button",
|
|
1048
|
+
class: p(["cc-table__density-btn", { "cc-table__density-btn--active": E.value === e.value }]),
|
|
1049
|
+
onClick: (t) => E.value = e.value
|
|
1050
|
+
}, S(e.label), 11, et)), 64))])]),
|
|
1051
|
+
s("div", tt, [r[9] ||= s("div", { class: "cc-table__settings-title" }, "显示列", -1), s("div", nt, [(g(!0), o(e, null, y(oe.value, (e) => (g(), i(Q, {
|
|
1052
|
+
key: e.key,
|
|
1053
|
+
modelValue: T[e.key],
|
|
1054
|
+
"onUpdate:modelValue": (t) => T[e.key] = t
|
|
1055
|
+
}, {
|
|
1056
|
+
default: O(() => [l(S(e.title), 1)]),
|
|
1057
|
+
_: 2
|
|
1058
|
+
}, 1032, ["modelValue", "onUpdate:modelValue"]))), 128))])]),
|
|
1059
|
+
s("button", {
|
|
1060
|
+
type: "button",
|
|
1061
|
+
class: "cc-table__settings-reset",
|
|
1062
|
+
onClick: j
|
|
1063
|
+
}, "恢复默认")
|
|
1064
|
+
])], 64)) : a("", !0)])]),
|
|
1065
|
+
s("div", {
|
|
1066
|
+
class: "cc-table__scroll",
|
|
1067
|
+
style: m({ maxHeight: t.maxHeight })
|
|
1068
|
+
}, [s("table", { class: p(["cc-table__table", `cc-table--${E.value}`]) }, [
|
|
1069
|
+
s("colgroup", null, [(g(!0), o(e, null, y(F.value, (e) => (g(), o("col", {
|
|
1070
|
+
key: e.key,
|
|
1071
|
+
style: m({ width: `${e.width}px` })
|
|
1072
|
+
}, null, 4))), 128))]),
|
|
1073
|
+
s("thead", null, [s("tr", null, [(g(!0), o(e, null, y(F.value, (e) => (g(), o("th", {
|
|
1074
|
+
key: e.key,
|
|
1075
|
+
class: p(["cc-table__th", [
|
|
1076
|
+
`cc-table__cell--${e.align}`,
|
|
1077
|
+
{ "cc-table__th--fixed-left": e.fixed === "left" || e.isSelection },
|
|
1078
|
+
{ "cc-table__th--fixed-left-end": e.isLastLeftFixed },
|
|
1079
|
+
{ "cc-table__th--fixed-right": e.fixed === "right" },
|
|
1080
|
+
{ "cc-table__th--draggable": R(e) },
|
|
1081
|
+
{ "cc-table__th--dragging": I.value === e.key },
|
|
1082
|
+
{ "cc-table__th--drop-target": L.value === e.key }
|
|
1083
|
+
]]),
|
|
1084
|
+
style: m({
|
|
1085
|
+
left: e.left == null ? void 0 : `${e.left}px`,
|
|
1086
|
+
right: e.right == null ? void 0 : `${e.right}px`
|
|
1087
|
+
}),
|
|
1088
|
+
draggable: R(e),
|
|
1089
|
+
onDragstart: (t) => se(e, t),
|
|
1090
|
+
onDragover: (t) => z(e, t),
|
|
1091
|
+
onDrop: (t) => ce(e, t),
|
|
1092
|
+
onDragend: le
|
|
1093
|
+
}, [e.isSelection ? (g(), o("input", {
|
|
1094
|
+
key: 0,
|
|
1095
|
+
type: "checkbox",
|
|
1096
|
+
class: "cc-table__check",
|
|
1097
|
+
checked: Z.value,
|
|
1098
|
+
indeterminate: pe.value,
|
|
1099
|
+
"aria-label": "选择本页全部",
|
|
1100
|
+
onChange: me
|
|
1101
|
+
}, null, 40, it)) : (g(), o("span", at, [l(S(e.title) + " ", 1), R(e) ? (g(), o("svg", ot, [...r[10] ||= [c("<circle cx=\"3\" cy=\"2.5\" r=\"1\" fill=\"currentColor\" data-v-e1238af3></circle><circle cx=\"7\" cy=\"2.5\" r=\"1\" fill=\"currentColor\" data-v-e1238af3></circle><circle cx=\"3\" cy=\"7\" r=\"1\" fill=\"currentColor\" data-v-e1238af3></circle><circle cx=\"7\" cy=\"7\" r=\"1\" fill=\"currentColor\" data-v-e1238af3></circle><circle cx=\"3\" cy=\"11.5\" r=\"1\" fill=\"currentColor\" data-v-e1238af3></circle><circle cx=\"7\" cy=\"11.5\" r=\"1\" fill=\"currentColor\" data-v-e1238af3></circle>", 6)]])) : a("", !0)]))], 46, rt))), 128))])]),
|
|
1102
|
+
s("tbody", null, [K.value.length ? a("", !0) : (g(), o("tr", st, [s("td", {
|
|
1103
|
+
class: "cc-table__empty",
|
|
1104
|
+
colspan: F.value.length
|
|
1105
|
+
}, S(t.emptyText), 9, ct)])), (g(!0), o(e, null, y(K.value, (t) => (g(), o("tr", {
|
|
1106
|
+
key: J(t),
|
|
1107
|
+
class: "cc-table__row"
|
|
1108
|
+
}, [(g(!0), o(e, null, y(F.value, (r) => (g(), o("td", {
|
|
1109
|
+
key: r.key,
|
|
1110
|
+
class: p(["cc-table__td", [
|
|
1111
|
+
`cc-table__cell--${r.align}`,
|
|
1112
|
+
{ "cc-table__td--fixed-left": r.fixed === "left" || r.isSelection },
|
|
1113
|
+
{ "cc-table__td--fixed-left-end": r.isLastLeftFixed },
|
|
1114
|
+
{ "cc-table__td--fixed-right": r.fixed === "right" }
|
|
1115
|
+
]]),
|
|
1116
|
+
style: m({
|
|
1117
|
+
left: r.left == null ? void 0 : `${r.left}px`,
|
|
1118
|
+
right: r.right == null ? void 0 : `${r.right}px`
|
|
1119
|
+
})
|
|
1120
|
+
}, [r.isSelection ? (g(), o("input", {
|
|
1121
|
+
key: 0,
|
|
1122
|
+
type: "checkbox",
|
|
1123
|
+
class: "cc-table__check",
|
|
1124
|
+
checked: Y(t),
|
|
1125
|
+
"aria-label": `选择第 ${J(t)} 行`,
|
|
1126
|
+
onChange: (e) => X(t)
|
|
1127
|
+
}, null, 40, lt)) : r.slot ? b(n.$slots, r.slot, {
|
|
1128
|
+
row: t,
|
|
1129
|
+
value: t[r.key]
|
|
1130
|
+
}, void 0, !0, 1) : (g(), o(e, { key: 2 }, [l(S(he(r, t)), 1)], 64))], 6))), 128))]))), 128))])
|
|
1131
|
+
], 2)], 4),
|
|
1132
|
+
s("div", ut, [s("span", dt, "共 " + S(H.value.length) + " 条", 1), s("div", ft, [
|
|
1133
|
+
r[13] ||= s("span", { class: "cc-table__pager-size" }, "每页", -1),
|
|
1134
|
+
k(s("select", {
|
|
1135
|
+
"onUpdate:modelValue": r[2] ||= (e) => U.value = e,
|
|
1136
|
+
class: "cc-table__pagesize"
|
|
1137
|
+
}, [(g(!0), o(e, null, y(t.pageSizeOptions, (e) => (g(), o("option", {
|
|
1138
|
+
key: e,
|
|
1139
|
+
value: e
|
|
1140
|
+
}, S(e), 9, pt))), 128))], 512), [[
|
|
1141
|
+
ne,
|
|
1142
|
+
U.value,
|
|
1143
|
+
void 0,
|
|
1144
|
+
{ number: !0 }
|
|
1145
|
+
]]),
|
|
1146
|
+
r[14] ||= s("span", { class: "cc-table__pager-size" }, "条", -1),
|
|
1147
|
+
s("button", {
|
|
1148
|
+
type: "button",
|
|
1149
|
+
class: "cc-table__page-btn",
|
|
1150
|
+
disabled: W.value <= 1,
|
|
1151
|
+
"aria-label": "上一页",
|
|
1152
|
+
onClick: r[3] ||= (e) => q(W.value - 1)
|
|
1153
|
+
}, [...r[11] ||= [s("svg", {
|
|
1154
|
+
width: "14",
|
|
1155
|
+
height: "14",
|
|
1156
|
+
viewBox: "0 0 16 16",
|
|
1157
|
+
fill: "none",
|
|
1158
|
+
"aria-hidden": "true"
|
|
1159
|
+
}, [s("path", {
|
|
1160
|
+
d: "M10 4l-4 4 4 4",
|
|
1161
|
+
stroke: "currentColor",
|
|
1162
|
+
"stroke-width": "1.6",
|
|
1163
|
+
"stroke-linecap": "round",
|
|
1164
|
+
"stroke-linejoin": "round"
|
|
1165
|
+
})], -1)]], 8, mt),
|
|
1166
|
+
(g(!0), o(e, null, y(fe.value, (t, n) => (g(), o(e, { key: `${t}-${n}` }, [t === "…" ? (g(), o("span", gt, "…")) : (g(), o("button", {
|
|
1167
|
+
key: 0,
|
|
1168
|
+
type: "button",
|
|
1169
|
+
class: p(["cc-table__page-btn cc-table__page-btn--num", { "cc-table__page-btn--active": W.value === t }]),
|
|
1170
|
+
onClick: (e) => q(t)
|
|
1171
|
+
}, S(t), 11, ht))], 64))), 128)),
|
|
1172
|
+
s("button", {
|
|
1173
|
+
type: "button",
|
|
1174
|
+
class: "cc-table__page-btn",
|
|
1175
|
+
disabled: W.value >= G.value,
|
|
1176
|
+
"aria-label": "下一页",
|
|
1177
|
+
onClick: r[4] ||= (e) => q(W.value + 1)
|
|
1178
|
+
}, [...r[12] ||= [s("svg", {
|
|
1179
|
+
width: "14",
|
|
1180
|
+
height: "14",
|
|
1181
|
+
viewBox: "0 0 16 16",
|
|
1182
|
+
fill: "none",
|
|
1183
|
+
"aria-hidden": "true"
|
|
1184
|
+
}, [s("path", {
|
|
1185
|
+
d: "M6 4l4 4-4 4",
|
|
1186
|
+
stroke: "currentColor",
|
|
1187
|
+
"stroke-width": "1.6",
|
|
1188
|
+
"stroke-linecap": "round",
|
|
1189
|
+
"stroke-linejoin": "round"
|
|
1190
|
+
})], -1)]], 8, _t)
|
|
1191
|
+
])])
|
|
1192
|
+
]));
|
|
775
1193
|
}
|
|
776
|
-
}), [["__scopeId", "data-v-
|
|
1194
|
+
}), [["__scopeId", "data-v-e1238af3"]]);
|
|
777
1195
|
//#endregion
|
|
778
1196
|
//#region src/index.ts
|
|
779
|
-
function
|
|
1197
|
+
function bt(e) {
|
|
780
1198
|
let t = [
|
|
781
|
-
["CcButton",
|
|
782
|
-
["CcInput",
|
|
783
|
-
["CcTextarea",
|
|
784
|
-
["CcSelect",
|
|
785
|
-
["CcSwitch",
|
|
786
|
-
["CcCheckbox",
|
|
787
|
-
["CcRadio",
|
|
788
|
-
["CcCard",
|
|
789
|
-
["CcTag",
|
|
790
|
-
["CcBadge",
|
|
791
|
-
["CcAlert",
|
|
792
|
-
["CcModal",
|
|
793
|
-
["CcTooltip",
|
|
794
|
-
["CcSpinner",
|
|
795
|
-
["CcDivider",
|
|
1199
|
+
["CcButton", P],
|
|
1200
|
+
["CcInput", z],
|
|
1201
|
+
["CcTextarea", V],
|
|
1202
|
+
["CcSelect", q],
|
|
1203
|
+
["CcSwitch", X],
|
|
1204
|
+
["CcCheckbox", Q],
|
|
1205
|
+
["CcRadio", ge],
|
|
1206
|
+
["CcCard", Se],
|
|
1207
|
+
["CcTag", we],
|
|
1208
|
+
["CcBadge", Ee],
|
|
1209
|
+
["CcAlert", Ae],
|
|
1210
|
+
["CcModal", Ie],
|
|
1211
|
+
["CcTooltip", Le],
|
|
1212
|
+
["CcSpinner", M],
|
|
1213
|
+
["CcDivider", ze],
|
|
1214
|
+
["CcTable", $]
|
|
796
1215
|
];
|
|
797
1216
|
for (let [n, r] of t) e.component(n, r);
|
|
798
1217
|
}
|
|
799
|
-
var
|
|
800
|
-
install:
|
|
801
|
-
CcButton:
|
|
802
|
-
CcInput:
|
|
803
|
-
CcTextarea:
|
|
804
|
-
CcSelect:
|
|
805
|
-
CcSwitch:
|
|
806
|
-
CcCheckbox:
|
|
807
|
-
CcRadio:
|
|
808
|
-
CcCard:
|
|
809
|
-
CcTag:
|
|
810
|
-
CcBadge:
|
|
811
|
-
CcAlert:
|
|
812
|
-
CcModal:
|
|
813
|
-
CcTooltip:
|
|
814
|
-
CcSpinner:
|
|
815
|
-
CcDivider:
|
|
1218
|
+
var xt = {
|
|
1219
|
+
install: bt,
|
|
1220
|
+
CcButton: P,
|
|
1221
|
+
CcInput: z,
|
|
1222
|
+
CcTextarea: V,
|
|
1223
|
+
CcSelect: q,
|
|
1224
|
+
CcSwitch: X,
|
|
1225
|
+
CcCheckbox: Q,
|
|
1226
|
+
CcRadio: ge,
|
|
1227
|
+
CcCard: Se,
|
|
1228
|
+
CcTag: we,
|
|
1229
|
+
CcBadge: Ee,
|
|
1230
|
+
CcAlert: Ae,
|
|
1231
|
+
CcModal: Ie,
|
|
1232
|
+
CcTooltip: Le,
|
|
1233
|
+
CcSpinner: M,
|
|
1234
|
+
CcDivider: ze,
|
|
1235
|
+
CcTable: $
|
|
816
1236
|
};
|
|
817
1237
|
//#endregion
|
|
818
|
-
export {
|
|
1238
|
+
export { Ae as CcAlert, Ee as CcBadge, P as CcButton, Se as CcCard, Q as CcCheckbox, ze as CcDivider, z as CcInput, Ie as CcModal, ge as CcRadio, q as CcSelect, M as CcSpinner, X as CcSwitch, $ as CcTable, we as CcTag, V as CcTextarea, Le as CcTooltip, xt as default, bt as install };
|