@studio-west/component-sw 0.13.16 → 0.13.18

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/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { n as e } from "./SwIcon-Ce_Lj65y.js";
1
+ import { n as e } from "./SwIcon-B-HHyuxu.js";
2
2
  import { Transition as t, computed as n, createApp as r, createBlock as i, createCommentVNode as a, createElementBlock as o, createElementVNode as s, createTextVNode as c, defineAsyncComponent as l, h as u, normalizeClass as d, onMounted as f, onUnmounted as p, openBlock as m, ref as h, renderSlot as g, toDisplayString as _, unref as v, useSlots as y, withCtx as b } from "vue";
3
3
  //#region src/components/SwAlert.vue
4
4
  var x = { class: "body" }, S = { class: "text" }, C = { key: 0 }, w = {
@@ -129,21 +129,23 @@ function M(e = {}) {
129
129
  //#endregion
130
130
  //#region src/index.ts
131
131
  var N = /* #__PURE__ */ Object.assign({
132
- "./components/SwButton.vue": () => import("./SwButton-DBj7jzhd.js").then((e) => e.n),
132
+ "./components/SwBadge.vue": () => import("./SwBadge-BOqWsTgl.js"),
133
+ "./components/SwButton.vue": () => import("./SwButton-DpOGpsBS.js").then((e) => e.n),
133
134
  "./components/SwButtonGroup.vue": () => import("./SwButtonGroup-Ck8aedFL.js"),
134
135
  "./components/SwCollapse.vue": () => import("./SwCollapse-DrCfi6Ly.js"),
135
136
  "./components/SwDatePicker.vue": () => import("./SwDatePicker-BwgaZLnR.js"),
136
- "./components/SwDropdown.vue": () => import("./SwDropdown-D5nIZEAM.js"),
137
- "./components/SwDropdownItem.vue": () => import("./SwDropdownItem-09XdzVHh.js"),
138
- "./components/SwFile.vue": () => import("./SwFile-BTNWhEX-.js"),
137
+ "./components/SwDropdown.vue": () => import("./SwDropdown-DpedC6Bn.js"),
138
+ "./components/SwDropdownItem.vue": () => import("./SwDropdownItem-DthBPUxn.js"),
139
+ "./components/SwFile.vue": () => import("./SwFile-DfeOYJQc.js"),
139
140
  "./components/SwFormItem.vue": () => import("./SwFormItem-SuqNvXBQ.js"),
140
- "./components/SwGide.vue": () => import("./SwGide-BScP5PoP.js"),
141
- "./components/SwIcon.vue": () => import("./SwIcon-Ce_Lj65y.js").then((e) => e.t),
142
- "./components/SwInput.vue": () => import("./SwInput-D5cZvb4H.js"),
141
+ "./components/SwGide.vue": () => import("./SwGide-BjQbQiBI.js"),
142
+ "./components/SwIcon.vue": () => import("./SwIcon-B-HHyuxu.js").then((e) => e.t),
143
+ "./components/SwInput.vue": () => import("./SwInput-BQXnoovf.js"),
143
144
  "./components/SwMenu.vue": () => import("./SwMenu-Dohv0z9N.js"),
144
- "./components/SwMessage.vue": () => import("./SwMessage-BRYFF_qT.js"),
145
+ "./components/SwMessage.vue": () => import("./SwMessage-BghpMRWc.js"),
146
+ "./components/SwPagination.vue": () => import("./SwPagination-jTW9BD5P.js"),
145
147
  "./components/SwSection.vue": () => import("./SwSection-Ck1GYU_A.js"),
146
- "./components/SwSelect.vue": () => import("./SwSelect-Bo9kUY7P.js"),
148
+ "./components/SwSelect.vue": () => import("./SwSelect-DDNh3p6B.js"),
147
149
  "./components/SwSkeleton.vue": () => import("./SwSkeleton-DsjPQpL2.js"),
148
150
  "./components/SwSkeletonItem.vue": () => import("./SwSkeletonItem-DOBVXQbh.js"),
149
151
  "./components/SwSlider.vue": () => import("./SwSlider-Cl9pwY6h.js"),
@@ -151,7 +153,8 @@ var N = /* #__PURE__ */ Object.assign({
151
153
  "./components/SwTable.vue": () => import("./SwTable-DE3cDsvN.js"),
152
154
  "./components/SwTableColumn.vue": () => import("./SwTableColumn-DQT28erv.js"),
153
155
  "./components/SwTabs.vue": () => import("./SwTabs-A6JIa-Kl.js"),
154
- "./components/SwTabsPane.vue": () => import("./SwTabsPane-CDBFh3D3.js")
156
+ "./components/SwTabsPane.vue": () => import("./SwTabsPane-CDBFh3D3.js"),
157
+ "./components/SwTag.vue": () => import("./SwTag-DjZlthUS.js")
155
158
  }), P = { SwAlert: w };
156
159
  for (let e in N) {
157
160
  let t = e.split("/").pop().replace(".vue", "").replace(/-(\w)/g, (e, t) => t.toUpperCase());
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@studio-west/component-sw",
3
- "version": "0.13.16",
3
+ "version": "0.13.18",
4
4
  "description": "Vue components of Component-SW collection.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -35,7 +35,11 @@
35
35
  "build:panel": "bash scripts/with-node.sh vite build --mode panel",
36
36
  "preview:panel": "bash scripts/with-node.sh vite preview --mode panel",
37
37
  "type-check": "bash scripts/with-node.sh vue-tsc --noEmit",
38
- "test:ssr": "bash scripts/with-node.sh node scripts/ssr-safe.mjs"
38
+ "test:ssr": "bash scripts/with-node.sh node scripts/ssr-safe.mjs",
39
+ "prepublishOnly": "npm run type-check && npm run build && npm run test:ssr",
40
+ "release:patch": "npm version patch && npm publish",
41
+ "release:minor": "npm version minor && npm publish",
42
+ "release:major": "npm version major && npm publish"
39
43
  },
40
44
  "dependencies": {
41
45
  "axios": "^1.18.1",
@@ -51,7 +55,7 @@
51
55
  "vue-tsc": "^3.3.8"
52
56
  },
53
57
  "author": "Alexander Efimov",
54
- "license": "MIT",
58
+ "license": "ISC",
55
59
  "publishConfig": {
56
60
  "access": "public"
57
61
  },
package/types/index.d.ts CHANGED
@@ -69,6 +69,8 @@ export interface SwInputProps {
69
69
  minlength?: number
70
70
  inputSize?: number
71
71
  autofocus?: boolean
72
+ clearable?: boolean
73
+ rows?: number
72
74
  }
73
75
 
74
76
  export interface SwSwitchProps {
@@ -88,6 +90,40 @@ export interface SwSelectProps {
88
90
  token?: string
89
91
  }
90
92
 
93
+ export interface SwTagProps {
94
+ class?: string
95
+ size?: 'large' | 'small' | ''
96
+ type?: 'primary' | 'success' | 'info' | 'warning' | 'danger' | ''
97
+ label?: string
98
+ before?: string
99
+ closable?: boolean
100
+ round?: boolean
101
+ disabled?: boolean
102
+ }
103
+
104
+ export interface SwBadgeProps {
105
+ class?: string
106
+ type?: 'primary' | 'success' | 'info' | 'warning' | 'danger' | ''
107
+ value?: number | string
108
+ max?: number
109
+ isDot?: boolean
110
+ showZero?: boolean
111
+ hidden?: boolean
112
+ }
113
+
114
+ export interface SwPaginationProps {
115
+ class?: string
116
+ size?: 'large' | 'small' | ''
117
+ total?: number
118
+ pageSize?: number
119
+ pagerCount?: number
120
+ disabled?: boolean
121
+ showTotal?: boolean
122
+ showSize?: boolean
123
+ pageSizes?: number[]
124
+ modelValue?: number
125
+ }
126
+
91
127
  export interface SwMenuProps {
92
128
  menuItems: Record<string, any> | Array<{ [componentName: string]: any }>
93
129
  class?: string
@@ -115,6 +151,9 @@ export type SwButton = DefineComponent<SwButtonProps>
115
151
  export type SwInput = DefineComponent<SwInputProps>
116
152
  export type SwSwitch = DefineComponent<SwSwitchProps>
117
153
  export type SwSelect = DefineComponent<SwSelectProps>
154
+ export type SwTag = DefineComponent<SwTagProps>
155
+ export type SwBadge = DefineComponent<SwBadgeProps>
156
+ export type SwPagination = DefineComponent<SwPaginationProps>
118
157
  export type SwMenu = DefineComponent<SwMenuProps>
119
158
  export type SwFile = DefineComponent<SwFileProps>
120
159
 
@@ -125,6 +164,9 @@ declare module 'vue' {
125
164
  SwInput: SwInput
126
165
  SwSwitch: SwSwitch
127
166
  SwSelect: SwSelect
167
+ SwTag: SwTag
168
+ SwBadge: SwBadge
169
+ SwPagination: SwPagination
128
170
  // Add other components as needed
129
171
  SwAlert: DefineComponent
130
172
  SwButtonGroup: DefineComponent
@@ -1,131 +0,0 @@
1
- import { Teleport as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, mergeModels as a, normalizeClass as o, normalizeStyle as s, onMounted as c, onUnmounted as l, openBlock as u, ref as d, renderSlot as f, unref as p, useModel as m, watchEffect as h, withModifiers as g } from "vue";
2
- //#region src/components/SwDropdown.vue
3
- var _ = ["id"], v = {
4
- __name: "SwDropdown",
5
- props: /*@__PURE__*/ a({
6
- class: {
7
- type: String,
8
- default: ""
9
- },
10
- size: {
11
- type: String,
12
- default: ""
13
- },
14
- type: {
15
- type: String,
16
- default: ""
17
- },
18
- trigger: {
19
- type: String,
20
- default: "click"
21
- },
22
- placement: {
23
- type: String,
24
- default: "bottom-left"
25
- },
26
- maxWidth: {
27
- type: Number,
28
- default: 0
29
- }
30
- }, {
31
- modelValue: {},
32
- modelModifiers: {}
33
- }),
34
- emits: ["update:modelValue"],
35
- setup(a, { expose: v }) {
36
- let y = a, b = m(a, "modelValue"), x = d(null), S = d(null), C = d({}), w = d(""), T = Math.ceil(Math.random() * 1e3), E = d(0), D = t(() => {
37
- let e = ["sw-dropdown"];
38
- return y.size.length > 0 && e.push("sw-" + y.size), y.type.length > 0 && e.push("sw-" + y.type), e;
39
- }), O = new ResizeObserver(() => {
40
- b.value && E.value++, E.value > 99 && (E.value = 1);
41
- });
42
- h(() => {
43
- if (!b.value || !S.value || !x.value) return;
44
- E.value < 2 && O.observe(S.value);
45
- let e = window.pageYOffset || document.documentElement.scrollTop, t = window.pageXOffset || document.documentElement.scrollLeft;
46
- document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.left = `-${t}px`, document.body.style.position = "", document.body.style.top = "", document.body.style.left = "", document.documentElement.scrollTop = e, document.documentElement.scrollLeft = t;
47
- let n = x.value.getBoundingClientRect(), r = window.innerWidth, i = window.innerHeight, a = S.value.offsetHeight, o = S.value.offsetWidth, s = n.left + n.width / 2 + t, c = n.top + n.height / 2 + e, l = n.height / 2 + 8, [u, d] = y.placement.split("-", 2);
48
- switch (u) {
49
- case "bottom":
50
- c = e + i - a - l - 8 < c ? c - l - a : c + l, d === void 0 && (s -= o / 2);
51
- break;
52
- case "top":
53
- c = e + a + l + 8 > c ? c + l : c - l - a, d === void 0 && (s -= o / 2);
54
- break;
55
- case "left":
56
- s - o - n.width / 2 - 8 < 0 ? s + n.width / 2 + 8 + o < r ? (s = s + n.width / 2 + 8, c -= a / 2) : (c = e + a + l + 8 > c ? c + l : c - l - a, s = s + n.width / 2 < r ? s + n.width / 2 - o : s - o / 2) : (s = s - o - n.width / 2 - 8, c -= a / 2);
57
- break;
58
- case "right":
59
- s + n.width / 2 + 8 + o > r ? s - o - n.width / 2 - 8 > 0 ? (s = s - o - n.width / 2 - 8, c -= a / 2) : (c = e + a + l + 8 > c ? c + l : c - l - a, s -= n.width / 2) : (s = s + n.width / 2 + 8, c -= a / 2);
60
- break;
61
- }
62
- switch (d) {
63
- case "left":
64
- s = t + r - 8 > s - n.width / 2 + o ? s - n.width / 2 : s - o + n.width / 2;
65
- break;
66
- case "right":
67
- s = 8 < s + n.width / 2 - o ? s - o + n.width / 2 : s - n.width / 2;
68
- break;
69
- }
70
- s < 0 && (s = 0), c < 0 && (c = 0);
71
- let f = n.left + n.width / 2 + t, p = n.top + n.height / 2 + e, m = s + o / 2 - f, h = c + a / 2 - p, g;
72
- g = Math.abs(h) >= Math.abs(m) ? h > 0 ? "top" : "bottom" : m > 0 ? "left" : "right";
73
- let _ = g === "top" || g === "bottom" ? Math.max(12, Math.min(o - 12, f - s)) : Math.max(12, Math.min(a - 12, p - c));
74
- w.value = `arrow-${g}`;
75
- let v = 0;
76
- for (let e = x.value; e && e !== document.documentElement; e = e.parentElement) {
77
- let t = getComputedStyle(e).zIndex;
78
- if (t === "auto") continue;
79
- let n = Number.parseInt(t, 10);
80
- if (!Number.isNaN(n)) {
81
- v = n;
82
- break;
83
- }
84
- }
85
- C.value = {
86
- position: "absolute",
87
- top: `${c}px`,
88
- left: `${s}px`,
89
- maxWidth: y.maxWidth > 0 ? `${y.maxWidth}px` : "",
90
- "--sw-dropdown-arrow": `${_}px`,
91
- "--sw-z-index": String(v)
92
- };
93
- }, { flush: "post" });
94
- let k = () => {
95
- y.trigger === "click" && (b.value = !b.value);
96
- }, A = () => {
97
- y.trigger === "hover" && (b.value = !b.value);
98
- }, j = () => {
99
- y.trigger === "context" && (b.value = !b.value);
100
- }, M = () => {
101
- b.value && E.value++, E.value > 99 && (E.value = 1);
102
- };
103
- v({ handleResize: M });
104
- let N = (e) => {
105
- y.trigger !== "none" && !e.target.closest(`[id="${T}"]`) && x.value && !x.value.contains(e.target) && (b.value = !1);
106
- };
107
- return c(() => {
108
- window.addEventListener("resize", M), document.documentElement.ontouchstart === void 0 ? document.documentElement.addEventListener("click", N, !0) : document.documentElement.addEventListener("touchstart", N, !0), window.onscrollend === void 0 ? window.addEventListener("scroll", M) : window.addEventListener("scrollend", M);
109
- }), l(() => {
110
- O.disconnect(), window.removeEventListener("resize", M), document.documentElement.ontouchstart === void 0 ? document.documentElement.removeEventListener("click", N) : document.documentElement.removeEventListener("touchstart", N), window.onscrollend === void 0 ? window.removeEventListener("scroll", M) : window.removeEventListener("scrollend", M);
111
- }), (t, a) => (u(), i("div", {
112
- class: o(D.value),
113
- onClick: a[0] ||= (e) => k(),
114
- onMouseover: a[1] ||= g((e) => A(), ["stop"]),
115
- onMouseleave: a[2] ||= g((e) => A(), ["stop"]),
116
- onContextmenu: a[3] ||= g((e) => j(), ["stop"]),
117
- ref_key: "dropdownRef",
118
- ref: x
119
- }, [f(t.$slots, "default"), (u(), n(e, { to: "body" }, [b.value ? (u(), i("ul", {
120
- key: 0,
121
- ref_key: "popupRef",
122
- ref: S,
123
- id: p(T),
124
- class: o(["sw-dropdown-popup", [y.class, w.value]]),
125
- style: s(C.value),
126
- tabindex: "-1"
127
- }, [f(t.$slots, "dropdown")], 14, _)) : r("", !0)]))], 34));
128
- }
129
- };
130
- //#endregion
131
- export { v as default };
@@ -1,104 +0,0 @@
1
- import { n as e } from "./utils-qzwUfWRX.js";
2
- import { n as t } from "./SwIcon-Ce_Lj65y.js";
3
- import { computed as n, createBlock as r, createCommentVNode as i, createElementBlock as a, createElementVNode as o, createTextVNode as s, defineComponent as c, mergeModels as l, mergeProps as u, normalizeClass as d, openBlock as f, ref as p, renderSlot as m, toDisplayString as h, useModel as g, vModelDynamic as _, watch as v, withDirectives as y } from "vue";
4
- //#region src/components/SwInput.vue?vue&type=script&setup=true&lang.ts
5
- var b = ["for"], x = {
6
- key: 0,
7
- title: "Это поле обязательно для заполнения."
8
- }, S = [
9
- "required",
10
- "placeholder",
11
- "type",
12
- "inputmode",
13
- "id",
14
- "name",
15
- "size",
16
- "maxlength",
17
- "minlength",
18
- "autofocus"
19
- ], C = /* @__PURE__ */ c({
20
- __name: "SwInput",
21
- props: /*@__PURE__*/ l({
22
- before: { default: "" },
23
- after: { default: "" },
24
- placeholder: { default: "" },
25
- label: { default: "" },
26
- name: {},
27
- class: { default: "" },
28
- size: { default: "" },
29
- type: { default: "text" },
30
- inputMode: { default: "text" },
31
- required: {
32
- type: Boolean,
33
- default: !1
34
- },
35
- maxlength: { default: 128 },
36
- minlength: { default: 1 },
37
- inputSize: { default: 60 },
38
- autofocus: {
39
- type: Boolean,
40
- default: !1
41
- }
42
- }, {
43
- modelValue: {},
44
- modelModifiers: {}
45
- }),
46
- emits: /*@__PURE__*/ l([
47
- "suffix",
48
- "prefix",
49
- "focusInput"
50
- ], ["update:modelValue"]),
51
- setup(c, { emit: l }) {
52
- let C = g(c, "modelValue"), w = c, T = l, E = p(!1), D = n(() => (C.value?.length ?? 0) > 0), O = n(() => {
53
- let e = ["sw-input"];
54
- return w.size.length > 0 && e.push("sw-" + w.size), w.class.length > 0 && e.push(w.class), (E.value || D.value) && e.push("sw-input--active"), e;
55
- }), k = (e) => {
56
- E.value = !0, T("focusInput"), e.target.setSelectionRange(C.value?.length || 0, C.value?.length || 0);
57
- }, A = () => {
58
- E.value = !1;
59
- }, j = () => {
60
- T("suffix");
61
- }, M = () => {
62
- T("prefix");
63
- }, N = (t, n) => {
64
- if (w.type !== "phone" || t == null) return;
65
- let r = e(t, n);
66
- r !== t && (C.value = r);
67
- };
68
- return v(C, (e, t) => {
69
- N(e, t);
70
- }), (e, n) => (f(), a("div", { class: d(O.value) }, [
71
- w.before.length > 0 ? (f(), r(t, {
72
- key: 0,
73
- "icon-class": w.before,
74
- onClick: M
75
- }, null, 8, ["icon-class"])) : m(e.$slots, "prefix", {}, void 0, void 0, 1),
76
- w.label.length > 0 ? (f(), a("label", {
77
- key: 2,
78
- for: w.name
79
- }, [s(h(w.label), 1), w.required ? (f(), a("span", x, "*")) : i("", !0)], 8, b)) : i("", !0),
80
- y(o("input", u({
81
- "onUpdate:modelValue": n[0] ||= (e) => C.value = e,
82
- required: w.required,
83
- placeholder: w.required && w.label.length === 0 ? w.placeholder + "*" : w.placeholder,
84
- type: w.type,
85
- inputmode: w.inputMode,
86
- id: w.name,
87
- name: w.name,
88
- size: w.inputSize,
89
- onFocus: k,
90
- onBlur: A,
91
- maxlength: w.maxlength,
92
- minlength: w.minlength,
93
- autofocus: w.autofocus
94
- }, e.$attrs), null, 16, S), [[_, C.value]]),
95
- w.after.length > 0 ? (f(), r(t, {
96
- key: 3,
97
- "icon-class": w.after,
98
- onClick: j
99
- }, null, 8, ["icon-class"])) : m(e.$slots, "suffix", {}, void 0, void 0, 4)
100
- ], 2));
101
- }
102
- });
103
- //#endregion
104
- export { C as default };