| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163 |
- var q = Object.defineProperty, j = Object.defineProperties;
- var G = Object.getOwnPropertyDescriptors;
- var S = Object.getOwnPropertySymbols;
- var J = Object.prototype.hasOwnProperty, K = Object.prototype.propertyIsEnumerable;
- var B = (n, l, a) => l in n ? q(n, l, { enumerable: !0, configurable: !0, writable: !0, value: a }) : n[l] = a, u = (n, l) => {
- for (var a in l || (l = {}))
- J.call(l, a) && B(n, a, l[a]);
- if (S)
- for (var a of S(l))
- K.call(l, a) && B(n, a, l[a]);
- return n;
- }, f = (n, l) => j(n, G(l));
- import { computed as Q, ref as p, watch as W, resolveComponent as X, openBlock as d, createBlock as Y, withCtx as T, createElementVNode as t, toDisplayString as i, createElementBlock as v, Fragment as I, renderList as x, normalizeClass as Z, normalizeStyle as E, createCommentVNode as ee, createVNode as F, unref as te, createTextVNode as se } from "vue";
- import { n as oe, dn as h, dp as k, I as le, dq as ae, B as ne, dr as ce, ds as ue, dt as ie, du as re } from "./index2.js";
- const de = { class: "s-theme-config" }, ve = { class: "section" }, me = { class: "section-title" }, _e = { class: "preset-list" }, pe = ["title", "onClick"], he = { class: "name" }, ge = { class: "theme-container" }, Ce = {
- key: 0,
- class: "disabled-box"
- }, fe = { class: "section" }, ke = { class: "section-title" }, ye = { class: "color-row" }, $e = ["value"], we = { class: "tip" }, be = { class: "section" }, Se = { class: "section-title" }, Be = { class: "customer-grid" }, Te = { class: "cell-label" }, Ie = ["value", "onInput"], xe = { class: "cell-hex" }, Ee = { class: "tip" }, Fe = { class: "actions" }, He = {
- __name: "SThemeConfig",
- props: {
- /**
- * 是否显示,配合 v-model:value 使用
- */
- value: {
- type: Boolean,
- default: !1
- }
- },
- emits: ["update:value", "change"],
- setup(n, { emit: l }) {
- const a = n, g = l, m = Q({
- get: () => a.value,
- set: (e) => g("update:value", e)
- }), y = p(!1), _ = p(h()), H = ae, o = p(u({}, window.$theme || {})), r = p(k()), $ = /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/, L = (e) => $.test(String(e || "").trim()) ? String(e).trim() : "#000000";
- W(
- () => a.value,
- (e) => {
- e && (_.value = h(), o.value = u({}, window.$theme || {}), r.value = k());
- }
- );
- const C = () => {
- const e = re(o.value);
- o.value = u({}, e), g("change", u({}, e));
- }, N = (e) => {
- y.value = e.code !== "customer", o.value = u({}, e), C();
- }, w = (e) => {
- o.value = ce(e), C();
- }, R = (e) => {
- const c = e.target.value;
- o.value = f(u({}, o.value), { color: c });
- }, V = (e) => {
- const c = String(e.target.value || "").trim();
- if (!$.test(c)) {
- o.value = f(u({}, o.value), { color: window.$theme && window.$theme.color || "" });
- return;
- }
- w(c);
- }, z = (e, c) => {
- r.value = ue({ [e]: c }), o.value = u({}, r.value), _.value = h(), C();
- }, D = () => {
- const e = ie();
- o.value = u({}, e), r.value = k(), _.value = h(), g("change", u({}, e));
- }, O = () => {
- m.value = !1;
- }, A = () => {
- m.value = !1;
- };
- return (e, c) => {
- const M = le, P = ne, U = X("s-modal");
- return d(), Y(U, {
- value: m.value,
- "onUpdate:value": c[1] || (c[1] = (s) => m.value = s),
- title: e.$l("主题配置"),
- width: "620px",
- "save-btn-text": e.$l("完成"),
- onHandSave: O,
- onHandCancel: A
- }, {
- default: T(() => [
- t("div", de, [
- t("div", ve, [
- t("div", me, i(e.$l("预设主题")), 1),
- t("div", _e, [
- (d(!0), v(I, null, x(_.value, (s) => (d(), v("div", {
- key: s.name,
- class: Z(["preset-item", { active: o.value.name === s.name }]),
- title: s.color,
- onClick: (b) => N(s)
- }, [
- t("span", {
- class: "dot",
- style: E({ backgroundColor: s.color })
- }, null, 4),
- t("span", he, i(s.name), 1)
- ], 10, pe))), 128))
- ])
- ]),
- t("div", ge, [
- y.value ? (d(), v("div", Ce)) : ee("", !0),
- t("div", fe, [
- t("div", ke, i(e.$l("主题色")), 1),
- t("div", ye, [
- t("input", {
- class: "color-picker",
- type: "color",
- value: o.value.color,
- onInput: c[0] || (c[0] = (s) => w(s.target.value))
- }, null, 40, $e),
- F(M, {
- class: "hex-input",
- value: o.value.color,
- maxlength: 7,
- onChange: R,
- onBlur: V
- }, null, 8, ["value"]),
- t("span", we, i(e.$l("修改后立即生效")), 1)
- ]),
- t("div", {
- class: "theme-preview",
- style: E({ backgroundColor: o.value.color })
- }, null, 4)
- ]),
- t("div", be, [
- t("div", Se, i(e.$l("customer 颜色")), 1),
- t("div", Be, [
- (d(!0), v(I, null, x(te(H), (s) => (d(), v("div", {
- key: s.key,
- class: "customer-cell"
- }, [
- t("span", Te, i(e.$l(s.label)), 1),
- t("input", {
- class: "color-picker small",
- type: "color",
- value: L(r.value[s.key]),
- onInput: (b) => z(s.key, b.target.value)
- }, null, 40, Ie),
- t("span", xe, i(r.value[s.key]), 1)
- ]))), 128))
- ]),
- t("div", Ee, i(e.$l("修改 customer 颜色会自动切换到 customer 主题")), 1)
- ])
- ]),
- t("div", Fe, [
- F(P, {
- size: "small",
- onClick: D
- }, {
- default: T(() => [
- se(i(e.$l("恢复默认")), 1)
- ]),
- _: 1
- })
- ])
- ])
- ]),
- _: 1
- }, 8, ["value", "title", "save-btn-text"]);
- };
- }
- }, Ve = /* @__PURE__ */ oe(He, [["__scopeId", "data-v-e3261ec7"]]);
- export {
- Ve as default
- };
|