hisonvue 1.0.0
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/LICENSE +21 -0
- package/README.md +248 -0
- package/dist/HAccordion-CPtgQUK0.js +1 -0
- package/dist/HAccordion-ll-4cIAw.mjs +262 -0
- package/dist/HBaggie-D6omQoFh.js +1 -0
- package/dist/HBaggie-D_7mEiuV.mjs +283 -0
- package/dist/HBanner-DmcMOFqS.mjs +420 -0
- package/dist/HBanner-Io4SdGGs.js +1 -0
- package/dist/HButton-DAVuDmOQ.js +1 -0
- package/dist/HButton-DAriO81x.mjs +256 -0
- package/dist/HCalendar-DKwGatUk.js +2 -0
- package/dist/HCalendar-w18iIB90.mjs +3387 -0
- package/dist/HCaption-6CbSqRA7.js +1 -0
- package/dist/HCaption-DwsXHDNK.mjs +275 -0
- package/dist/HChart-C86JXUyW.js +1 -0
- package/dist/HChart-CcArHFr0.mjs +179 -0
- package/dist/HDrawer-DG1O42iF.mjs +439 -0
- package/dist/HDrawer-U5VC_okK.js +1 -0
- package/dist/HDropdown-Bs7AfefJ.mjs +393 -0
- package/dist/HDropdown-D4RAGmjE.js +1 -0
- package/dist/HFileset-BGuP9O4l.mjs +578 -0
- package/dist/HFileset-CuPR6Hwf.js +2 -0
- package/dist/HGap-BPAdnOQz.js +1 -0
- package/dist/HGap-DzGrfWVt.mjs +233 -0
- package/dist/HGrid-BiIhVCv_.mjs +345 -0
- package/dist/HGrid-C3EV_pgM.js +1 -0
- package/dist/HImagebox-D_DKeCrO.mjs +654 -0
- package/dist/HImagebox-t_UdFjQO.js +2 -0
- package/dist/HInput-BEyJqYkD.mjs +1103 -0
- package/dist/HInput-DMGLY473.js +1 -0
- package/dist/HInputGroup-D37WTYoI.mjs +281 -0
- package/dist/HInputGroup-Dcfr23sZ.js +1 -0
- package/dist/HLabel-B2FOqSiS.mjs +369 -0
- package/dist/HLabel-Dm48mSwn.js +1 -0
- package/dist/HLayout-BbCEm_aO.mjs +196 -0
- package/dist/HLayout-C1e4BZ_K.js +1 -0
- package/dist/HList-CAeYb-hz.mjs +419 -0
- package/dist/HList-eNXmMf27.js +1 -0
- package/dist/HModal-BDBEEpKm.mjs +778 -0
- package/dist/HModal-GODLq3wH.js +1 -0
- package/dist/HNote-CWnUjt3_.mjs +934 -0
- package/dist/HNote-D_Xwu9oL.js +1 -0
- package/dist/HPagination-Db_L9wv-.js +1 -0
- package/dist/HPagination-e5e2a5GS.mjs +496 -0
- package/dist/HParagraph-BRuSeOMU.js +1 -0
- package/dist/HParagraph-DYuB-qjY.mjs +463 -0
- package/dist/HPopup-Brp1FVpm.mjs +431 -0
- package/dist/HPopup-ChkoI3xm.js +1 -0
- package/dist/HSpinner-DDtU9PL_.js +1 -0
- package/dist/HSpinner-DOq2k5kT.mjs +281 -0
- package/dist/HTable-DGFnzD4u.js +1 -0
- package/dist/HTable-GCDP5O_J.mjs +620 -0
- package/dist/_plugin-vue_export-helper-BHFhmbuH.js +1 -0
- package/dist/_plugin-vue_export-helper-CHgC5LLL.mjs +9 -0
- package/dist/ar.es-CKau4tBl.js +5 -0
- package/dist/ar.es-XxSuE68c.mjs +57 -0
- package/dist/bg.es-BJ7fu6yy.mjs +57 -0
- package/dist/bg.es-Melqx1M5.js +5 -0
- package/dist/bn.es-CYlBkxc5.mjs +57 -0
- package/dist/bn.es-ClbAZ4WP.js +5 -0
- package/dist/bs.es-KjOcbE96.js +5 -0
- package/dist/bs.es-yMnaKmdi.mjs +57 -0
- package/dist/ca.es-BaGTENcW.js +5 -0
- package/dist/ca.es-DIhlxmQc.mjs +67 -0
- package/dist/cs.es-BN8oxRXQ.mjs +57 -0
- package/dist/cs.es-ChOlHqBr.js +5 -0
- package/dist/da.es-DJB5lAli.mjs +57 -0
- package/dist/da.es-DOFXbf8-.js +5 -0
- package/dist/de.es-DwE82Kaw.js +5 -0
- package/dist/de.es-glb8GeJh.mjs +57 -0
- package/dist/drag-and-drop.es-4ttM1tRs.js +5 -0
- package/dist/drag-and-drop.es-Ckzp6XEn.mjs +183 -0
- package/dist/el.es-CNrCgzYI.js +5 -0
- package/dist/el.es-_bBZf22h.mjs +76 -0
- package/dist/en.es-CV9nmQGr.mjs +57 -0
- package/dist/en.es-CgL601qd.js +5 -0
- package/dist/es.es-CZjcWK54.mjs +57 -0
- package/dist/es.es-IdFGKY7Q.js +5 -0
- package/dist/et.es-BygWmV3P.js +5 -0
- package/dist/et.es-CjvQAzNF.mjs +57 -0
- package/dist/fa.es-DW_0SmsT.js +5 -0
- package/dist/fa.es-DykeFwDA.mjs +57 -0
- package/dist/fi.es-Bl7Pp7AO.mjs +57 -0
- package/dist/fi.es-pgfJlZ8i.js +5 -0
- package/dist/fr.es-CNKVhFfO.mjs +57 -0
- package/dist/fr.es-OENguFuM.js +5 -0
- package/dist/he.es-bixEnAeH.js +5 -0
- package/dist/he.es-nF4GFhjH.mjs +57 -0
- package/dist/hisonvue.cjs.js +1 -0
- package/dist/hisonvue.css +1 -0
- package/dist/hisonvue.d.ts +19934 -0
- package/dist/hisonvue.es.js +114 -0
- package/dist/hr.es-CkRAP94O.js +5 -0
- package/dist/hr.es-QFfz660j.mjs +57 -0
- package/dist/hu.es-Ck2rE01V.mjs +57 -0
- package/dist/hu.es-DG6HeiQJ.js +5 -0
- package/dist/id.es-D4tPi6wP.js +5 -0
- package/dist/id.es-Je7FEUJ5.mjs +57 -0
- package/dist/index-BmKMHsSZ.js +153 -0
- package/dist/index-DUh7pai4.mjs +19976 -0
- package/dist/is.es-CDFqLYCV.js +5 -0
- package/dist/is.es-bzprHvXI.mjs +57 -0
- package/dist/it.es-BHgrw_C6.js +5 -0
- package/dist/it.es-CJtfqmNS.mjs +57 -0
- package/dist/ja.es-BaiGjqZ6.mjs +57 -0
- package/dist/ja.es-D-lxWwyb.js +5 -0
- package/dist/ka.es-CnnB6q4A.js +5 -0
- package/dist/ka.es-x9QJo_dl.mjs +57 -0
- package/dist/ko.es-6c447eTS.mjs +57 -0
- package/dist/ko.es-b18aaB3V.js +5 -0
- package/dist/lt.es-2twYdvmJ.mjs +57 -0
- package/dist/lt.es-BY9UQ6wZ.js +5 -0
- package/dist/mn.es-BLQRG1uu.mjs +57 -0
- package/dist/mn.es-YFS7gSdf.js +5 -0
- package/dist/nl.es-BEx-4hnj.js +5 -0
- package/dist/nl.es-bB1qWR_S.mjs +57 -0
- package/dist/no.es-BQnRWlWR.js +5 -0
- package/dist/no.es-CWDVXpTf.mjs +57 -0
- package/dist/pl.es-CKCsZ_02.js +5 -0
- package/dist/pl.es-Dzct23w9.mjs +57 -0
- package/dist/pt-br.es-BeBuiitI.mjs +57 -0
- package/dist/pt-br.es-oH7qh6Fd.js +5 -0
- package/dist/pt-pt.es-BeBuiitI.mjs +57 -0
- package/dist/pt-pt.es-DLk5I0ej.js +5 -0
- package/dist/ro.es-DfMVJ30M.mjs +57 -0
- package/dist/ro.es-DgTen1Dh.js +5 -0
- package/dist/ru.es-Bv9UvrBe.mjs +67 -0
- package/dist/ru.es-jGIQfREl.js +5 -0
- package/dist/scrollManager-BGnq4wyt.mjs +14 -0
- package/dist/scrollManager-CEEWQwoK.js +1 -0
- package/dist/setButtonCssEvent-B9WTs2X7.js +1 -0
- package/dist/setButtonCssEvent-dBs1GcAh.mjs +70 -0
- package/dist/sk.es-CUOTpLuL.mjs +57 -0
- package/dist/sk.es-D2bhVb26.js +5 -0
- package/dist/sl.es-DeIGgZbR.mjs +57 -0
- package/dist/sl.es-TV8Uraa1.js +5 -0
- package/dist/sq.es-CQJJrZHv.mjs +67 -0
- package/dist/sq.es-Cc65zxbr.js +5 -0
- package/dist/sr.es-CKS0AkiW.mjs +57 -0
- package/dist/sr.es-D5VNA_GW.js +5 -0
- package/dist/sv.es-ChHQRrAe.mjs +57 -0
- package/dist/sv.es-dBeK_DZs.js +5 -0
- package/dist/tr.es-B3v90gVv.mjs +57 -0
- package/dist/tr.es-BUz4S13G.js +5 -0
- package/dist/uk.es-B8uaeLcK.js +5 -0
- package/dist/uk.es-CiR4NnbN.mjs +67 -0
- package/dist/vi.es-2OFMtbQI.js +5 -0
- package/dist/vi.es-DFDi5l7p.mjs +67 -0
- package/dist/zh-cn.es-9cbEAuAi.mjs +67 -0
- package/dist/zh-cn.es-fDHCbCIg.js +5 -0
- package/dist/zh-hk.es-COzeh5F8.js +5 -0
- package/dist/zh-hk.es-z0tio4jE.mjs +67 -0
- package/nuxt/module.mjs +39 -0
- package/nuxt/plugin.mjs +21 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 hisondev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files hisonvue, to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
# HisonVue
|
|
2
|
+
|
|
3
|
+
A **Vue 3 UI component library** designed for enterprise-grade apps.
|
|
4
|
+
Built on top of [**hisonjs**](https://github.com/hisondev/hisonjs), it bridges **frontend components** and **backend-ready data utilities** into one unified ecosystem.
|
|
5
|
+
|
|
6
|
+
## ✨ About
|
|
7
|
+
|
|
8
|
+
**HisonVue** provides a comprehensive set of UI components with **runtime APIs**, **global theming**, and **SSR compatibility**. It extends the capabilities of [hisonjs](https://www.npmjs.com/package/hisonjs), meaning you not only get visual components but also access to data modeling, API-link communication, utilities, and security features.
|
|
9
|
+
|
|
10
|
+
* Written in **TypeScript** with full IntelliSense support
|
|
11
|
+
* Works with **Vue CLI, Vite, Nuxt 3 (SSR)** out of the box
|
|
12
|
+
* Tree-shakable and modular imports
|
|
13
|
+
* CSS variables & responsive class system (`hison-col-*`, `hison-size-*`, `hison-color-*`)
|
|
14
|
+
* Runtime control for every component via `hison.component.getXxx(id)`
|
|
15
|
+
* Extends `hisonjs` → brings **utils, data models, API-link, shield security**
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## 📦 Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install hisonvue
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Import the global CSS once:
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
import 'hisonvue/style.css'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## 🚀 Usage
|
|
34
|
+
|
|
35
|
+
### 1️⃣ Global registration (Vue 3 / Vite / Vue CLI)
|
|
36
|
+
|
|
37
|
+
```ts
|
|
38
|
+
import { createApp } from 'vue'
|
|
39
|
+
import App from './App.vue'
|
|
40
|
+
import { hisonvue, getDefaultHisonConfig, Size, type HisonConfig } from 'hisonvue'
|
|
41
|
+
import 'hisonvue/style.css'
|
|
42
|
+
|
|
43
|
+
const app = createApp(App)
|
|
44
|
+
|
|
45
|
+
// Customize global configuration
|
|
46
|
+
const hisonConfig: HisonConfig = getDefaultHisonConfig()
|
|
47
|
+
hisonConfig.componentStyle.primaryColor = '#123456'
|
|
48
|
+
hisonConfig.componentStyle.size = Size.s
|
|
49
|
+
|
|
50
|
+
app.use(hisonvue, hisonConfig)
|
|
51
|
+
app.mount('#app')
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
✅ Once registered globally, you can use any component:
|
|
55
|
+
|
|
56
|
+
```vue
|
|
57
|
+
<HButton id="b1" text="Click" class="hison-color-primary" />
|
|
58
|
+
<HLayout class="hison-col-12">
|
|
59
|
+
<HLabel text="Hello World" />
|
|
60
|
+
</HLayout>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
### 2️⃣ Nuxt 3 integration (SSR-ready)
|
|
66
|
+
|
|
67
|
+
HisonVue ships with an SSR-safe wrapper (`createSSRClientOnly`). For Nuxt, register via plugin:
|
|
68
|
+
|
|
69
|
+
**`/plugins/hisonvue.client.ts`**
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
import { defineNuxtPlugin } from '#app'
|
|
73
|
+
import { hisonvue, getDefaultHisonConfig, Size, type HisonConfig } from 'hisonvue'
|
|
74
|
+
import 'hisonvue/style.css'
|
|
75
|
+
|
|
76
|
+
export default defineNuxtPlugin((nuxtApp) => {
|
|
77
|
+
const config: HisonConfig = getDefaultHisonConfig()
|
|
78
|
+
config.componentStyle.primaryColor = '#165DFF'
|
|
79
|
+
config.componentStyle.size = Size.m
|
|
80
|
+
config.componentStyle.invertColor = false
|
|
81
|
+
|
|
82
|
+
nuxtApp.vueApp.use(hisonvue, config)
|
|
83
|
+
})
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
✅ Components are globally available in SSR without hydration errors.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
### 3️⃣ Runtime control with `hison.component`
|
|
91
|
+
|
|
92
|
+
Every component is registered with a unique `id`. Use that to access methods:
|
|
93
|
+
|
|
94
|
+
```vue
|
|
95
|
+
<HButton id="b1" text="Left" class="hison-color-primary" />
|
|
96
|
+
<HButton id="b2" text="Right" class="hison-color-warning" />
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
```ts
|
|
100
|
+
import { hison } from 'hisonvue'
|
|
101
|
+
|
|
102
|
+
// Toggle border
|
|
103
|
+
const b1 = hison.component.getButton('b1')!
|
|
104
|
+
b1.setBorder(!b1.isBorder())
|
|
105
|
+
|
|
106
|
+
// Open a modal
|
|
107
|
+
const modal = hison.component.getModal('modal01')
|
|
108
|
+
modal?.open()
|
|
109
|
+
modal?.setCaption('Hello Modal')
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
### 4️⃣ Global theming with `hison.style`
|
|
115
|
+
|
|
116
|
+
Change theme dynamically at runtime:
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
hison.style.setPrimaryColor('#009688')
|
|
120
|
+
hison.style.setSize(Size.l)
|
|
121
|
+
hison.style.setInvertColor(true)
|
|
122
|
+
|
|
123
|
+
console.log(hison.style.getPrimaryHoverColor())
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
### 5️⃣ CSS Event Hooks (`hison.cssEvent`)
|
|
129
|
+
|
|
130
|
+
Attach global before/after hooks for Button/Input/Textbox events:
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
hison.cssEvent.setButtonOnBefoerClick((e) => {
|
|
134
|
+
console.log('before click', e)
|
|
135
|
+
return true // false cancels the click
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
hison.cssEvent.setButtonOnAfterClick((e) => {
|
|
139
|
+
console.log('after click', e)
|
|
140
|
+
})
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
⚠️ Note: `Befoer` is intentionally spelled this way in the API — use as-is.
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## 📚 Available Components
|
|
148
|
+
|
|
149
|
+
HisonVue provides **20+ UI components**:
|
|
150
|
+
|
|
151
|
+
* **Layout**: `HLayout`, `HGap`, `HModal`, `HPopup`, `HBanner`, `HAccordion`
|
|
152
|
+
* **Form**: `HInput`, `HInputGroup`, `HFileset`, `HImagebox`, `HDropdown`
|
|
153
|
+
* **UI Elements**: `HButton`, `HLabel`, `HList`, `HParagraph`, `HBaggie`, `HCaption`
|
|
154
|
+
* **Data Views**: `HGrid` (via vanillagrid2), `HTable`, `HNote` (via vanillanote2), `HChart` (via Chart.js), `HCalendar` (via vue-cal)
|
|
155
|
+
* **Feedback**: `HSpinner`, `HPagination`, `HDrawer`
|
|
156
|
+
|
|
157
|
+
Each component exposes a **typed methods object** via `hison.component.getXxx(id)`.
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## ⚙️ Global Configuration (`HisonConfig`)
|
|
162
|
+
|
|
163
|
+
`getDefaultHisonConfig()` returns a fully typed configuration object you can customize.
|
|
164
|
+
|
|
165
|
+
* **UtilsConfig** → date/time/number formatting defaults
|
|
166
|
+
* **ShieldConfig** → security: block devtools, restrict IPs, freeze objects
|
|
167
|
+
* **DataConfig** → control how values are copied into `DataModel`
|
|
168
|
+
* **LinkConfig** → API-link defaults, before/after hooks
|
|
169
|
+
* **ComponentStyle** → global theme (colors, sizes, fonts)
|
|
170
|
+
* **Component** → external libs (vanillanote2, vanillagrid2, chart.js)
|
|
171
|
+
* **Event.cssEvent** → global CSS hooks
|
|
172
|
+
|
|
173
|
+
Example:
|
|
174
|
+
|
|
175
|
+
```ts
|
|
176
|
+
const cfg = getDefaultHisonConfig()
|
|
177
|
+
cfg.componentStyle.primaryColor = '#222'
|
|
178
|
+
cfg.componentStyle.size = Size.s
|
|
179
|
+
cfg.link.timeout = 15000
|
|
180
|
+
cfg.shield.isPossibleOpenDevTool = false
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## 🔗 Extended Hison Interface
|
|
186
|
+
|
|
187
|
+
HisonVue exports a singleton `hison` that **extends** `hisonjs.Hison`:
|
|
188
|
+
|
|
189
|
+
✅ All **hisonjs** features:
|
|
190
|
+
|
|
191
|
+
* `utils` (string/date/number helpers)
|
|
192
|
+
* `data` (DataWrapper, DataModel)
|
|
193
|
+
* `link` (API communication with Spring backend)
|
|
194
|
+
* `shield` (security: devtool blocking, freeze, URL/IP restrictions)
|
|
195
|
+
|
|
196
|
+
➕ Additional Vue features:
|
|
197
|
+
|
|
198
|
+
* `component.getXxx(id)` → runtime control of every Vue component
|
|
199
|
+
* `style.setXxx/getXxx` → global theming API
|
|
200
|
+
* `cssEvent.setXxx` → global before/after hooks for UI events
|
|
201
|
+
* File upload defaults: `setMaxFilesetSize`, `setMaxFilesetTotalSize`
|
|
202
|
+
|
|
203
|
+
This makes **hisonvue** a **fullstack bridge** between Vue frontend and Spring backend.
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## ✅ Example Fullstack Flow
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
import { hison } from 'hisonvue'
|
|
211
|
+
|
|
212
|
+
// Build request
|
|
213
|
+
define const req = new hison.data.DataWrapper({ userId: 1 })
|
|
214
|
+
|
|
215
|
+
// Send to Spring backend via api-link
|
|
216
|
+
const api = new hison.link.ApiPost("UserService.getUser")
|
|
217
|
+
const resp = await api.call(req)
|
|
218
|
+
|
|
219
|
+
// Update UI
|
|
220
|
+
const btn = hison.component.getButton('saveBtn')
|
|
221
|
+
btn?.setDisable(true)
|
|
222
|
+
|
|
223
|
+
const note = hison.component.getNote('editor')
|
|
224
|
+
note?.setNoteData(resp.data)
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
---
|
|
228
|
+
|
|
229
|
+
## 🛠 Build & Test (Contributors)
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
git clone https://github.com/hisondev/hisonvue.git
|
|
233
|
+
cd hisonvue
|
|
234
|
+
npm install
|
|
235
|
+
|
|
236
|
+
# Build library
|
|
237
|
+
npm run build
|
|
238
|
+
|
|
239
|
+
# Run playgrounds
|
|
240
|
+
cd playground && npm run dev
|
|
241
|
+
cd ../playground-nuxt && npm run dev
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## 📄 License
|
|
247
|
+
|
|
248
|
+
MIT © hisondev
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),l=require("./index-BmKMHsSZ.js"),V=require("./setButtonCssEvent-B9WTs2X7.js"),q=require("./_plugin-vue_export-helper-BHFhmbuH.js"),z={id:{type:String,required:!1},class:{type:[String,Array,Object],required:!1},style:{type:[String,Object,Array],required:!1},headerStyle:{type:[String,Object,Array],required:!1},contentStyle:{type:[String,Object,Array],required:!1},visible:{type:Boolean,default:!0},defaultOpen:{type:Boolean,default:!1},title:{type:String,default:""},textAlign:{type:String,default:"left",validator:n=>l.TEXT_ALIGN_VALUES.includes(n)},animate:{type:Boolean,default:!0},duration:{type:Number,default:220,validator:n=>Number.isFinite(n)&&n>=0},easing:{type:String,default:"ease"},tabIndex:{type:[Number,String],default:null,validator:n=>n===null||n===""||!isNaN(+n)&&isFinite(+n)}},R=t.defineComponent({name:"HAccordion",props:z,inheritAttrs:!1,emits:["mounted","responsive-change","open","close","toggle"],setup(n,{emit:i}){const a=n.id||l.getUUID(),b=`haccordion:${a}`,s=t.ref(null),N=t.ref(null),r=l.useDevice(),v=t.ref(!!n.visible),f=t.ref(n.title??""),u=t.ref(!!n.defaultOpen),g=t.ref(n.textAlign??"left"),m=t.ref(n.animate??!0),h=t.ref(n.duration??500),y=t.ref(n.easing??"ease"),p=t.ref(n.tabIndex!==null&&n.tabIndex!==""?Number(n.tabIndex):null),B=t.computed(()=>v.value?"":"hison-display-none"),c=t.ref([]),E=()=>{c.value=l.extractResponsiveClasses(l.toClassString(n.class)||"",r.value),l.getIndexSpecificClassNameFromClassList(c.value,"col")===-1&&c.value.push("hison-col-12"),l.addComponentNameToClass(c.value,"size",l.hisonCloser.componentStyle.size),l.addComponentNameToClass(c.value,"color","primary")},L=t.computed(()=>({"--hacc-duration":`${h.value}ms`,"--hacc-easing":y.value})),x=t.computed(()=>({})),$=t.computed(()=>({textAlign:g.value})),C=e=>{u.value||(u.value,u.value=!0,i("open",e??null,d.value))},S=e=>{var O;if(!u.value)return;const o=document.activeElement,A=N.value;A&&o&&A.contains(o)&&((O=s.value)==null||O.focus()),u.value=!1,i("close",e??null,d.value)},I=e=>u.value?S(e):C(e),k=e=>{i("toggle",e,d.value),I(e)},d=t.ref(null),T=()=>{l.hisonCloser.component.accordionList[a]&&l.hisonCloser.component.accordionList[a].isHisonvueComponent&&console.warn(`[Hisonvue] The accordion ID is at risk of being duplicated. ${a}`),l.registerReloadable(b,()=>{w(),t.nextTick(T)}),s.value&&V.addButtonCssEvent(s.value),E(),d.value={isHisonvueComponent:!0,getId:()=>a,getType:()=>"accordion",isVisible:()=>v.value,setVisible:e=>{v.value=!!e},isOpen:()=>u.value,open:C,close:S,toggle:I,getTitle:()=>f.value,setTitle:e=>{f.value=e??""},getTextAlign:()=>g.value,setTextAlign:e=>{(e==="left"||e==="center"||e==="right")&&(g.value=e)},getAnimate:()=>m.value,setAnimate:e=>{m.value=!!e},getDuration:()=>h.value,setDuration:e=>{const o=Number(e);Number.isFinite(o)&&o>=0&&(h.value=o)},getEasing:()=>y.value,setEasing:e=>{typeof e=="string"&&(y.value=e)},getTabIndex:()=>p.value,setTabIndex:e=>{p.value=e!=null?Number(e):null},focus:()=>{var e;(e=s.value)==null||e.focus()},reload:()=>l.reloadHisonComponent(b)},l.hisonCloser.component.accordionList[a]=d.value,i("mounted",d.value)},w=()=>{var e;l.unregisterReloadable(b),s.value&&V.removeButtonCssEvent(s.value),(e=l.hisonCloser.component)!=null&&e.accordionList&&delete l.hisonCloser.component.accordionList[a]};return t.onMounted(T),t.onBeforeUnmount(w),t.watch(r,e=>{E(),i("responsive-change",e)}),t.watch(()=>n.visible,e=>{e!==v.value&&(v.value=!!e)}),t.watch(()=>n.title,e=>{const o=e??"";o!==f.value&&(f.value=o)}),t.watch(()=>n.defaultOpen,e=>e?C(null):S(null)),t.watch(()=>n.textAlign,e=>{(e==="left"||e==="center"||e==="right")&&e!==g.value&&(g.value=e)}),t.watch(()=>n.animate,e=>{const o=!!e;o!==m.value&&(m.value=o)}),t.watch(()=>n.duration,e=>{const o=Number(e);Number.isFinite(o)&&o>=0&&o!==h.value&&(h.value=o)}),t.watch(()=>n.easing,e=>{typeof e=="string"&&e!==y.value&&(y.value=e)}),t.watch(()=>n.tabIndex,e=>{const o=e===null||e===""?null:Number(e);o!==p.value&&(p.value=o)}),t.watch(()=>n.class,()=>E()),{headerRef:s,contentRef:N,props:n,visibleClass:B,responsiveClassList:c,isOpen:u,title:f,headerBoxStyle:x,titleInlineStyle:$,rootInlineStyle:L,animate:m,tabIndex:p,onToggleClick:k,open:C,close:S,toggle:I}}}),H=["aria-expanded","tabindex"],D={class:"hison-accordion-toggle"},j=["inert"],F={class:"hison-accordion-panel"},M={class:"hison-accordion-panel-inner"};function U(n,i,a,b,s,N){return t.openBlock(),t.createElementBlock("div",{class:t.normalizeClass(["hison-wrapper",...n.responsiveClassList,n.visibleClass])},[t.createElementVNode("div",{class:t.normalizeClass(["hison-accordion",n.isOpen?"hison-open":"",n.animate?"":"hison-no-anim"]),style:t.normalizeStyle([n.rootInlineStyle,n.props.style])},[t.createElementVNode("div",{ref:"headerRef",class:"hison-accordion-header",style:t.normalizeStyle([n.headerBoxStyle,n.props.headerStyle]),role:"button","aria-expanded":n.isOpen?"true":"false",tabindex:n.tabIndex??void 0,onClick:i[0]||(i[0]=r=>n.onToggleClick(r)),onKeydown:[i[1]||(i[1]=t.withKeys(t.withModifiers(r=>n.onToggleClick(r),["prevent"]),["enter"])),i[2]||(i[2]=t.withKeys(t.withModifiers(r=>n.onToggleClick(r),["prevent"]),["space"]))]},[t.createElementVNode("div",{class:"hison-accordion-title",style:t.normalizeStyle([n.titleInlineStyle])},[t.renderSlot(n.$slots,"title",{},()=>[t.createTextVNode(t.toDisplayString(n.title),1)])],4),t.createElementVNode("div",D,[t.renderSlot(n.$slots,"toggle",{},()=>[i[3]||(i[3]=t.createElementVNode("span",{class:"hison-dropdown-caret"},"▾",-1))])])],44,H),t.createElementVNode("div",{ref:"contentRef",class:"hison-accordion-content",style:t.normalizeStyle(n.props.contentStyle),role:"region",inert:!n.isOpen||void 0},[t.createElementVNode("div",F,[t.createElementVNode("div",M,[t.renderSlot(n.$slots,"default")])])],12,j)],6)],2)}const K=q._export_sfc(R,[["render",U]]);exports.default=K;
|
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { defineComponent as M, ref as o, computed as T, onMounted as K, onBeforeUnmount as G, watch as i, nextTick as P, createElementBlock as X, openBlock as J, normalizeClass as w, createElementVNode as c, normalizeStyle as N, withKeys as D, withModifiers as H, renderSlot as L, createTextVNode as Q, toDisplayString as W } from "vue";
|
|
2
|
+
import { T as Y, g as Z, u as _, e as ee, t as te, a as ne, b as q, h as f, r as le, c as oe, d as ie } from "./index-DUh7pai4.mjs";
|
|
3
|
+
import { a as ae, r as se } from "./setButtonCssEvent-dBs1GcAh.mjs";
|
|
4
|
+
import { _ as re } from "./_plugin-vue_export-helper-CHgC5LLL.mjs";
|
|
5
|
+
const ue = {
|
|
6
|
+
/**
|
|
7
|
+
* Unique identifier for the accordion.
|
|
8
|
+
* - Retrieve methods via `hison.component.getAccordion(id)`
|
|
9
|
+
* - ⚠️ Duplicate `id` will throw at mount time
|
|
10
|
+
*/
|
|
11
|
+
id: { type: String, required: !1 },
|
|
12
|
+
/**
|
|
13
|
+
* Custom class applied to the root container.
|
|
14
|
+
* - Supports responsive classes: `hison-col-*`, `hison-size-*`, `hison-color-*` with `-mb|-tb|-pc|-wd`
|
|
15
|
+
*/
|
|
16
|
+
class: {
|
|
17
|
+
type: [String, Array, Object],
|
|
18
|
+
required: !1
|
|
19
|
+
},
|
|
20
|
+
/**
|
|
21
|
+
* Inline style for the root.
|
|
22
|
+
*/
|
|
23
|
+
style: {
|
|
24
|
+
type: [String, Object, Array],
|
|
25
|
+
required: !1
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* Inline style for header box.
|
|
29
|
+
*/
|
|
30
|
+
headerStyle: {
|
|
31
|
+
type: [String, Object, Array],
|
|
32
|
+
required: !1
|
|
33
|
+
},
|
|
34
|
+
/**
|
|
35
|
+
* Inline style for content box.
|
|
36
|
+
*/
|
|
37
|
+
contentStyle: {
|
|
38
|
+
type: [String, Object, Array],
|
|
39
|
+
required: !1
|
|
40
|
+
},
|
|
41
|
+
/**
|
|
42
|
+
* Visibility of the accordion.
|
|
43
|
+
*/
|
|
44
|
+
visible: { type: Boolean, default: !0 },
|
|
45
|
+
/**
|
|
46
|
+
* Initial open state.
|
|
47
|
+
*/
|
|
48
|
+
defaultOpen: { type: Boolean, default: !1 },
|
|
49
|
+
/**
|
|
50
|
+
* Header text (used when no `#title` slot is provided).
|
|
51
|
+
*/
|
|
52
|
+
title: { type: String, default: "" },
|
|
53
|
+
/**
|
|
54
|
+
* Text alignment for the header title area.
|
|
55
|
+
* - 'left' | 'center' | 'right'
|
|
56
|
+
*/
|
|
57
|
+
textAlign: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: "left",
|
|
60
|
+
validator: (t) => Y.includes(t)
|
|
61
|
+
},
|
|
62
|
+
/**
|
|
63
|
+
* Animate expand/collapse.
|
|
64
|
+
*/
|
|
65
|
+
animate: { type: Boolean, default: !0 },
|
|
66
|
+
/**
|
|
67
|
+
* Animation duration in ms.
|
|
68
|
+
*/
|
|
69
|
+
duration: {
|
|
70
|
+
type: Number,
|
|
71
|
+
default: 220,
|
|
72
|
+
validator: (t) => Number.isFinite(t) && t >= 0
|
|
73
|
+
},
|
|
74
|
+
/**
|
|
75
|
+
* CSS timing function (e.g., 'ease', 'linear', 'ease-in-out', 'cubic-bezier(...)', etc.)
|
|
76
|
+
*/
|
|
77
|
+
easing: { type: String, default: "ease" },
|
|
78
|
+
/**
|
|
79
|
+
* Controls keyboard focus order of the element.
|
|
80
|
+
* - `0` enables natural tab navigation, positive numbers set custom order.
|
|
81
|
+
* - `null` or `''` removes tabindex (not focusable).
|
|
82
|
+
*/
|
|
83
|
+
tabIndex: {
|
|
84
|
+
type: [Number, String],
|
|
85
|
+
default: null,
|
|
86
|
+
validator: (t) => t === null || t === "" || !isNaN(+t) && isFinite(+t)
|
|
87
|
+
}
|
|
88
|
+
}, ce = M({
|
|
89
|
+
name: "HAccordion",
|
|
90
|
+
props: ue,
|
|
91
|
+
inheritAttrs: !1,
|
|
92
|
+
emits: ["mounted", "responsive-change", "open", "close", "toggle"],
|
|
93
|
+
setup(t, { emit: l }) {
|
|
94
|
+
const a = t.id || Z(), C = `haccordion:${a}`, s = o(null), O = o(null), r = _(), g = o(!!t.visible), m = o(t.title ?? ""), u = o(!!t.defaultOpen), y = o(t.textAlign ?? "left"), p = o(t.animate ?? !0), b = o(t.duration ?? 500), h = o(t.easing ?? "ease"), S = o(
|
|
95
|
+
t.tabIndex !== null && t.tabIndex !== "" ? Number(t.tabIndex) : null
|
|
96
|
+
), F = T(() => g.value ? "" : "hison-display-none"), d = o([]), B = () => {
|
|
97
|
+
d.value = ee(te(t.class) || "", r.value), ne(d.value, "col") === -1 && d.value.push("hison-col-12"), q(d.value, "size", f.componentStyle.size), q(d.value, "color", "primary");
|
|
98
|
+
}, V = T(() => ({
|
|
99
|
+
"--hacc-duration": `${b.value}ms`,
|
|
100
|
+
"--hacc-easing": h.value
|
|
101
|
+
})), j = T(() => ({})), z = T(() => ({ textAlign: y.value })), I = (e) => {
|
|
102
|
+
u.value || (u.value, u.value = !0, l("open", e ?? null, v.value));
|
|
103
|
+
}, A = (e) => {
|
|
104
|
+
var R;
|
|
105
|
+
if (!u.value) return;
|
|
106
|
+
const n = document.activeElement, x = O.value;
|
|
107
|
+
x && n && x.contains(n) && ((R = s.value) == null || R.focus()), u.value = !1, l("close", e ?? null, v.value);
|
|
108
|
+
}, E = (e) => u.value ? A(e) : I(e), U = (e) => {
|
|
109
|
+
l("toggle", e, v.value), E(e);
|
|
110
|
+
}, v = o(null), $ = () => {
|
|
111
|
+
f.component.accordionList[a] && f.component.accordionList[a].isHisonvueComponent && console.warn(`[Hisonvue] The accordion ID is at risk of being duplicated. ${a}`), le(C, () => {
|
|
112
|
+
k(), P($);
|
|
113
|
+
}), s.value && ae(s.value), B(), v.value = {
|
|
114
|
+
isHisonvueComponent: !0,
|
|
115
|
+
getId: () => a,
|
|
116
|
+
getType: () => "accordion",
|
|
117
|
+
isVisible: () => g.value,
|
|
118
|
+
setVisible: (e) => {
|
|
119
|
+
g.value = !!e;
|
|
120
|
+
},
|
|
121
|
+
isOpen: () => u.value,
|
|
122
|
+
open: I,
|
|
123
|
+
close: A,
|
|
124
|
+
toggle: E,
|
|
125
|
+
getTitle: () => m.value,
|
|
126
|
+
setTitle: (e) => {
|
|
127
|
+
m.value = e ?? "";
|
|
128
|
+
},
|
|
129
|
+
getTextAlign: () => y.value,
|
|
130
|
+
setTextAlign: (e) => {
|
|
131
|
+
(e === "left" || e === "center" || e === "right") && (y.value = e);
|
|
132
|
+
},
|
|
133
|
+
getAnimate: () => p.value,
|
|
134
|
+
setAnimate: (e) => {
|
|
135
|
+
p.value = !!e;
|
|
136
|
+
},
|
|
137
|
+
getDuration: () => b.value,
|
|
138
|
+
setDuration: (e) => {
|
|
139
|
+
const n = Number(e);
|
|
140
|
+
Number.isFinite(n) && n >= 0 && (b.value = n);
|
|
141
|
+
},
|
|
142
|
+
getEasing: () => h.value,
|
|
143
|
+
setEasing: (e) => {
|
|
144
|
+
typeof e == "string" && (h.value = e);
|
|
145
|
+
},
|
|
146
|
+
getTabIndex: () => S.value,
|
|
147
|
+
setTabIndex: (e) => {
|
|
148
|
+
S.value = e != null ? Number(e) : null;
|
|
149
|
+
},
|
|
150
|
+
focus: () => {
|
|
151
|
+
var e;
|
|
152
|
+
(e = s.value) == null || e.focus();
|
|
153
|
+
},
|
|
154
|
+
reload: () => oe(C)
|
|
155
|
+
}, f.component.accordionList[a] = v.value, l("mounted", v.value);
|
|
156
|
+
}, k = () => {
|
|
157
|
+
var e;
|
|
158
|
+
ie(C), s.value && se(s.value), (e = f.component) != null && e.accordionList && delete f.component.accordionList[a];
|
|
159
|
+
};
|
|
160
|
+
return K($), G(k), i(r, (e) => {
|
|
161
|
+
B(), l("responsive-change", e);
|
|
162
|
+
}), i(() => t.visible, (e) => {
|
|
163
|
+
e !== g.value && (g.value = !!e);
|
|
164
|
+
}), i(() => t.title, (e) => {
|
|
165
|
+
const n = e ?? "";
|
|
166
|
+
n !== m.value && (m.value = n);
|
|
167
|
+
}), i(() => t.defaultOpen, (e) => e ? I(null) : A(null)), i(() => t.textAlign, (e) => {
|
|
168
|
+
(e === "left" || e === "center" || e === "right") && e !== y.value && (y.value = e);
|
|
169
|
+
}), i(() => t.animate, (e) => {
|
|
170
|
+
const n = !!e;
|
|
171
|
+
n !== p.value && (p.value = n);
|
|
172
|
+
}), i(() => t.duration, (e) => {
|
|
173
|
+
const n = Number(e);
|
|
174
|
+
Number.isFinite(n) && n >= 0 && n !== b.value && (b.value = n);
|
|
175
|
+
}), i(() => t.easing, (e) => {
|
|
176
|
+
typeof e == "string" && e !== h.value && (h.value = e);
|
|
177
|
+
}), i(() => t.tabIndex, (e) => {
|
|
178
|
+
const n = e === null || e === "" ? null : Number(e);
|
|
179
|
+
n !== S.value && (S.value = n);
|
|
180
|
+
}), i(() => t.class, () => B()), {
|
|
181
|
+
headerRef: s,
|
|
182
|
+
contentRef: O,
|
|
183
|
+
props: t,
|
|
184
|
+
visibleClass: F,
|
|
185
|
+
responsiveClassList: d,
|
|
186
|
+
isOpen: u,
|
|
187
|
+
title: m,
|
|
188
|
+
headerBoxStyle: j,
|
|
189
|
+
titleInlineStyle: z,
|
|
190
|
+
rootInlineStyle: V,
|
|
191
|
+
animate: p,
|
|
192
|
+
tabIndex: S,
|
|
193
|
+
onToggleClick: U,
|
|
194
|
+
open: I,
|
|
195
|
+
close: A,
|
|
196
|
+
toggle: E
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
}), de = ["aria-expanded", "tabindex"], ve = { class: "hison-accordion-toggle" }, fe = ["inert"], ge = { class: "hison-accordion-panel" }, me = { class: "hison-accordion-panel-inner" };
|
|
200
|
+
function ye(t, l, a, C, s, O) {
|
|
201
|
+
return J(), X("div", {
|
|
202
|
+
class: w([
|
|
203
|
+
"hison-wrapper",
|
|
204
|
+
...t.responsiveClassList,
|
|
205
|
+
t.visibleClass
|
|
206
|
+
])
|
|
207
|
+
}, [
|
|
208
|
+
c("div", {
|
|
209
|
+
class: w([
|
|
210
|
+
"hison-accordion",
|
|
211
|
+
t.isOpen ? "hison-open" : "",
|
|
212
|
+
t.animate ? "" : "hison-no-anim"
|
|
213
|
+
]),
|
|
214
|
+
style: N([t.rootInlineStyle, t.props.style])
|
|
215
|
+
}, [
|
|
216
|
+
c("div", {
|
|
217
|
+
ref: "headerRef",
|
|
218
|
+
class: "hison-accordion-header",
|
|
219
|
+
style: N([t.headerBoxStyle, t.props.headerStyle]),
|
|
220
|
+
role: "button",
|
|
221
|
+
"aria-expanded": t.isOpen ? "true" : "false",
|
|
222
|
+
tabindex: t.tabIndex ?? void 0,
|
|
223
|
+
onClick: l[0] || (l[0] = (r) => t.onToggleClick(r)),
|
|
224
|
+
onKeydown: [
|
|
225
|
+
l[1] || (l[1] = D(H((r) => t.onToggleClick(r), ["prevent"]), ["enter"])),
|
|
226
|
+
l[2] || (l[2] = D(H((r) => t.onToggleClick(r), ["prevent"]), ["space"]))
|
|
227
|
+
]
|
|
228
|
+
}, [
|
|
229
|
+
c("div", {
|
|
230
|
+
class: "hison-accordion-title",
|
|
231
|
+
style: N([t.titleInlineStyle])
|
|
232
|
+
}, [
|
|
233
|
+
L(t.$slots, "title", {}, () => [
|
|
234
|
+
Q(W(t.title), 1)
|
|
235
|
+
])
|
|
236
|
+
], 4),
|
|
237
|
+
c("div", ve, [
|
|
238
|
+
L(t.$slots, "toggle", {}, () => [
|
|
239
|
+
l[3] || (l[3] = c("span", { class: "hison-dropdown-caret" }, "▾", -1))
|
|
240
|
+
])
|
|
241
|
+
])
|
|
242
|
+
], 44, de),
|
|
243
|
+
c("div", {
|
|
244
|
+
ref: "contentRef",
|
|
245
|
+
class: "hison-accordion-content",
|
|
246
|
+
style: N(t.props.contentStyle),
|
|
247
|
+
role: "region",
|
|
248
|
+
inert: !t.isOpen || void 0
|
|
249
|
+
}, [
|
|
250
|
+
c("div", ge, [
|
|
251
|
+
c("div", me, [
|
|
252
|
+
L(t.$slots, "default")
|
|
253
|
+
])
|
|
254
|
+
])
|
|
255
|
+
], 12, fe)
|
|
256
|
+
], 6)
|
|
257
|
+
], 2);
|
|
258
|
+
}
|
|
259
|
+
const Ce = /* @__PURE__ */ re(ce, [["render", ye]]);
|
|
260
|
+
export {
|
|
261
|
+
Ce as default
|
|
262
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),s=require("./index-BmKMHsSZ.js"),T=require("./setButtonCssEvent-B9WTs2X7.js"),H=require("./_plugin-vue_export-helper-BHFhmbuH.js"),P={id:{type:String,required:!1},class:{type:[String,Array,Object],required:!1},style:{type:[String,Object,Array],required:!1},visible:{type:Boolean,default:!0},baggieVisible:{type:Boolean,default:!0},zIndex:{type:Number,default:1e3},position:{type:String,default:s.ScreenPosition.topRight,validator:e=>s.SCREEN_POSITION_VALUES.includes(e)},text:{type:String,required:!1},backgroundType:{type:String,default:s.BackgroundType.filled,validator:e=>s.BACKGROUND_TYPE_VALUES.includes(e)},border:{type:Boolean,default:!0},shape:{type:String,default:"rounded",validator:e=>["square","rounded","circle"].includes(e)},tabIndex:{type:[Number,String],default:null,validator:e=>e===null||e===""||!isNaN(+e)&&isFinite(+e)},buttonEnabled:{type:Boolean,default:!1}},x=t.defineComponent({name:"HBaggie",props:P,inheritAttrs:!1,emits:["mounted","responsive-change","click","mousedown","mouseup","mouseover","mouseout"],setup(e,{emit:a}){const l=e.id||s.getUUID(),h=`hbaggie:${l}`,B=s.useDevice(),w=t.ref(null),i=t.ref(null),g=t.ref(e.visible),b=t.ref(e.baggieVisible),r=t.ref(e.zIndex??1e3),c=t.ref(e.position),v=t.ref(e.text??""),f=t.ref(e.border??!0),m=t.ref(e.backgroundType||s.BackgroundType.filled),d=t.ref(e.shape||"rounded"),y=t.ref(e.tabIndex!==null&&e.tabIndex!==""?Number(e.tabIndex):null),u=t.ref(e.buttonEnabled??!1),V=t.computed(()=>g.value?"":"hison-display-none"),M=t.computed(()=>b.value?"":"hison-display-none"),$=t.computed(()=>f.value?"hison-border":""),q=t.computed(()=>{switch(m.value){case s.BackgroundType.transparent:return"hison-bg-transparent";case s.BackgroundType.empty:return"hison-bg-empty";default:return"hison-bg-filled"}}),z=t.computed(()=>d.value==="circle"?"hison-baggie-shape-circle":d.value==="square"?"hison-baggie-shape-square":"hison-baggie-shape-rounded"),C=t.ref([]),S=()=>{C.value=s.extractResponsiveClasses(s.toClassString(e.class)||"",B.value),s.addComponentNameToClass(C.value,"size",s.hisonCloser.componentStyle.size),s.addComponentNameToClass(C.value,"color","primary")},A=t.computed(()=>`hison-baggie-pos-${c.value}`),R=t.computed(()=>({zIndex:r.value})),K=t.computed(()=>({zIndex:r.value+1})),k=(n=!0)=>{const o=i.value;o&&(T.removeButtonCssEvent(o),n&&u.value&&T.addButtonCssEvent(o))},I=n=>{u.value&&a("click",n,t.unref(p))},L=()=>{u.value&&I(new MouseEvent("click"))},p=t.ref(null),E=()=>{s.hisonCloser.component.baggieList[l]&&s.hisonCloser.component.baggieList[l].isHisonvueComponent&&console.warn(`[Hisonvue] The baggie ID is at risk of being duplicated. ${l}`),s.registerReloadable(h,()=>{N(),t.nextTick(E)}),S(),t.nextTick(()=>k(!0)),p.value={isHisonvueComponent:!0,getId:()=>l,getType:()=>"baggie",isVisible:()=>g.value,setVisible:n=>{g.value=n},isBaggieVisible:()=>b.value,setBaggieVisible:n=>{b.value=n},getZIndex:()=>r.value,setZIndex:n=>{r.value=n},getPosition:()=>c.value,setPosition:n=>{c.value=n},getText:()=>v.value,setText:n=>{v.value=n},isBorder:()=>f.value,setBorder:n=>{f.value=n},getBackgroundType:()=>m.value,setBackgroundType:n=>{m.value=n},getShape:()=>d.value,setShape:n=>{d.value=n},getTabIndex:()=>y.value,setTabIndex:n=>{y.value=n!=null?Number(n):null},isButtonEnabled:()=>u.value,setButtonEnabled:n=>{u.value=n,t.nextTick(()=>k(!0))},reload:()=>s.reloadHisonComponent(h)},s.hisonCloser.component.baggieList[l]=p.value,a("mounted",p.value)},N=()=>{s.unregisterReloadable(h);const n=i.value;n&&T.removeButtonCssEvent(n),delete s.hisonCloser.component.baggieList[l]};return t.onMounted(E),t.onBeforeUnmount(N),t.watch(B,n=>{S(),a("responsive-change",n)}),t.watch(()=>e.visible,n=>{n!==g.value&&(g.value=!!n)}),t.watch(()=>e.baggieVisible,n=>{n!==b.value&&(b.value=!!n,t.nextTick(()=>k(!0)))}),t.watch(()=>e.zIndex,n=>{const o=Number(n);Number.isFinite(o)&&o!==r.value&&(r.value=o)}),t.watch(()=>e.position,n=>{typeof n=="string"&&n!==c.value&&(c.value=n)}),t.watch(()=>e.text,n=>{const o=n??"";o!==v.value&&(v.value=o)}),t.watch(()=>e.border,n=>{const o=!!n;o!==f.value&&(f.value=o)}),t.watch(()=>e.backgroundType,n=>{n&&n!==m.value&&(m.value=n)}),t.watch(()=>e.shape,n=>{(n==="square"||n==="rounded"||n==="circle")&&n!==d.value&&(d.value=n)}),t.watch(()=>e.tabIndex,n=>{const o=n===null||n===""?null:Number(n);o!==y.value&&(y.value=o)}),t.watch(()=>e.buttonEnabled,n=>{const o=!!n;o!==u.value&&(u.value=o,t.nextTick(()=>k(!0)))}),t.watch(()=>e.class,()=>S()),{id:l,props:e,anchorRef:w,baggieRef:i,text:v,visibleClass:V,baggieVisibleClass:M,responsiveClassList:C,backgroundTypeClass:q,borderClass:$,shapeClass:z,positionClass:A,anchorStyle:R,badgeStyle:K,baggieMethods:t.computed(()=>t.unref(p)),tabIndex:y,buttonEnabled:u,onClick:I,onKeyActivate:L}}}),O={class:"hison-baggie-target"},U=["tabindex"],D={key:1,class:"hison-baggie-text"};function j(e,a,l,h,B,w){return t.openBlock(),t.createElementBlock("span",{ref:"anchorRef",class:t.normalizeClass(["hison-baggie-anchor",e.visibleClass,...e.responsiveClassList]),style:t.normalizeStyle(e.anchorStyle),onMousedown:a[3]||(a[3]=i=>e.$emit("mousedown",i,e.baggieMethods)),onMouseup:a[4]||(a[4]=i=>e.$emit("mouseup",i,e.baggieMethods)),onMouseover:a[5]||(a[5]=i=>e.$emit("mouseover",i,e.baggieMethods)),onMouseout:a[6]||(a[6]=i=>e.$emit("mouseout",i,e.baggieMethods))},[t.createElementVNode("span",O,[t.renderSlot(e.$slots,"default")]),e.baggieVisible?(t.openBlock(),t.createElementBlock("div",{key:0,ref:"baggieRef",class:t.normalizeClass(["hison-baggie",e.positionClass,e.backgroundTypeClass,e.borderClass,e.shapeClass,e.baggieVisibleClass,e.buttonEnabled?"hison-baggie-button":null]),style:t.normalizeStyle([e.badgeStyle,e.props.style]),role:"status",tabindex:e.tabIndex??void 0,onClick:a[0]||(a[0]=(...i)=>e.onClick&&e.onClick(...i)),onKeydown:[a[1]||(a[1]=t.withKeys(t.withModifiers((...i)=>e.onKeyActivate&&e.onKeyActivate(...i),["prevent"]),["enter"])),a[2]||(a[2]=t.withKeys(t.withModifiers((...i)=>e.onKeyActivate&&e.onKeyActivate(...i),["prevent"]),["space"]))]},[e.$slots.badge?t.renderSlot(e.$slots,"badge",{key:0}):(t.openBlock(),t.createElementBlock("span",D,t.toDisplayString(e.text),1))],46,U)):t.createCommentVNode("",!0)],38)}const F=H._export_sfc(x,[["render",j]]);exports.default=F;
|