@lucky-apps/client-ui 0.0.0-stage → 3.2.6

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/package.json CHANGED
@@ -1,6 +1,31 @@
1
1
  {
2
2
  "name": "@lucky-apps/client-ui",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "3.2.6",
4
+ "description": "Host-provided Vue UI primitives for Lucky Apps plugins",
5
+ "private": false,
6
+ "type": "module",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./src/index.ts",
10
+ "default": "./src/index.ts"
11
+ },
12
+ "./package.json": "./package.json"
13
+ },
14
+ "files": [
15
+ "src"
16
+ ],
17
+ "keywords": [
18
+ "cordis",
19
+ "lucky-app"
20
+ ],
21
+ "license": "MIT",
22
+ "peerDependencies": {
23
+ "@element-plus/icons-vue": "^2.3.2",
24
+ "element-plus": "^2.14.0",
25
+ "vue": "^3.5.0"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public",
29
+ "registry": "https://registry.npmjs.org/"
30
+ }
31
+ }
@@ -0,0 +1,251 @@
1
+ <script setup lang="ts">
2
+ import { computed } from 'vue'
3
+ import { Close } from '@element-plus/icons-vue'
4
+
5
+ defineOptions({ name: 'AppDialog' })
6
+
7
+ const visible = defineModel({ type: Boolean, default: false })
8
+
9
+ const props = defineProps({
10
+ title: { type: String, default: '' },
11
+ subtitle: { type: String, default: '' },
12
+ icon: { type: String, default: '' },
13
+ width: { type: String, default: '760px' },
14
+ /** 撑满视口高度(IDE / 设计器) */
15
+ fillHeight: { type: Boolean, default: false },
16
+ fullscreen: { type: Boolean, default: false },
17
+ showFooter: { type: Boolean, default: false },
18
+ closeOnClickModal: { type: Boolean, default: false },
19
+ closeOnPressEscape: { type: Boolean, default: true },
20
+ destroyOnClose: { type: Boolean, default: true },
21
+ beforeClose: { type: Function, default: null },
22
+ })
23
+
24
+ const emit = defineEmits(['closed', 'close'])
25
+
26
+ const dialogStyle = computed(() => ({
27
+ width: props.fullscreen ? '100vw' : props.width,
28
+ maxWidth: props.fullscreen ? '100vw' : 'calc(100vw - 32px)',
29
+ ...(props.fullscreen ? { height: '100vh', maxHeight: '100vh' } : {}),
30
+ }))
31
+
32
+ function close() {
33
+ if (props.beforeClose) {
34
+ props.beforeClose(() => {
35
+ emit('close')
36
+ visible.value = false
37
+ })
38
+ return
39
+ }
40
+ emit('close')
41
+ visible.value = false
42
+ }
43
+ </script>
44
+
45
+ <template>
46
+ <el-dialog
47
+ v-model="visible"
48
+ :class="['wr-app-dialog', { 'is-fill': fillHeight, 'is-fullscreen': fullscreen }]"
49
+ :style="dialogStyle"
50
+ :show-close="false"
51
+ :destroy-on-close="destroyOnClose"
52
+ :close-on-click-modal="closeOnClickModal"
53
+ :close-on-press-escape="closeOnPressEscape"
54
+ append-to-body
55
+ align-center
56
+ @closed="emit('closed')"
57
+ >
58
+ <template #header>
59
+ <header class="wr-dialog-header">
60
+ <div class="wr-dialog-heading">
61
+ <span v-if="icon" class="wr-dialog-icon">
62
+ <el-icon :size="17"><component :is="icon" /></el-icon>
63
+ </span>
64
+ <slot name="icon" />
65
+ <div class="wr-dialog-title">
66
+ <h2>{{ title }}</h2>
67
+ <p v-if="subtitle">{{ subtitle }}</p>
68
+ </div>
69
+ </div>
70
+ <div class="wr-dialog-actions">
71
+ <slot name="actions" />
72
+ <button type="button" class="wr-dialog-close" aria-label="关闭" @click="close">
73
+ <el-icon :size="16"><Close /></el-icon>
74
+ </button>
75
+ </div>
76
+ </header>
77
+ </template>
78
+
79
+ <el-scrollbar v-if="!fillHeight" class="wr-dialog-body">
80
+ <div class="wr-dialog-body-inner">
81
+ <slot />
82
+ </div>
83
+ </el-scrollbar>
84
+ <div v-else class="wr-dialog-body">
85
+ <slot />
86
+ </div>
87
+
88
+ <template v-if="showFooter" #footer>
89
+ <footer class="wr-dialog-footer">
90
+ <slot name="footer" />
91
+ </footer>
92
+ </template>
93
+ </el-dialog>
94
+ </template>
95
+
96
+ <style>
97
+ .wr-app-dialog {
98
+ display: flex;
99
+ flex-direction: column;
100
+ padding: 0;
101
+ border-radius: 14px;
102
+ overflow: hidden;
103
+ background: var(--el-bg-color);
104
+ }
105
+
106
+ .wr-app-dialog.is-fill {
107
+ height: calc(100vh - 40px);
108
+ max-height: calc(100vh - 40px);
109
+ }
110
+
111
+ .wr-app-dialog.is-fullscreen {
112
+ height: 100vh;
113
+ max-height: 100vh;
114
+ border-radius: 0;
115
+ }
116
+
117
+ .wr-app-dialog .el-dialog__header {
118
+ padding: 0;
119
+ margin: 0;
120
+ flex: none;
121
+ }
122
+
123
+ .wr-app-dialog .el-dialog__body {
124
+ flex: 1;
125
+ min-height: 0;
126
+ display: flex;
127
+ flex-direction: column;
128
+ padding: 0;
129
+ overflow: hidden;
130
+ color: var(--el-text-color-regular);
131
+ }
132
+
133
+ .wr-app-dialog .el-dialog__footer {
134
+ flex: none;
135
+ padding: 0;
136
+ }
137
+
138
+ .wr-dialog-header {
139
+ display: flex;
140
+ align-items: center;
141
+ justify-content: space-between;
142
+ gap: 16px;
143
+ padding: 14px 18px;
144
+ border-bottom: 1px solid var(--el-border-color-lighter);
145
+ background: var(--el-bg-color);
146
+ }
147
+
148
+ .wr-dialog-heading {
149
+ display: flex;
150
+ align-items: center;
151
+ gap: 10px;
152
+ min-width: 0;
153
+ }
154
+
155
+ .wr-dialog-icon {
156
+ display: grid;
157
+ place-items: center;
158
+ width: 32px;
159
+ height: 32px;
160
+ flex: none;
161
+ border-radius: 9px;
162
+ color: var(--el-color-primary);
163
+ background: var(--el-color-primary-light-9);
164
+ }
165
+
166
+ .wr-dialog-title {
167
+ min-width: 0;
168
+ }
169
+
170
+ .wr-dialog-title h2 {
171
+ margin: 0;
172
+ font-size: 15px;
173
+ line-height: 1.35;
174
+ font-weight: 650;
175
+ color: var(--el-text-color-primary);
176
+ white-space: nowrap;
177
+ overflow: hidden;
178
+ text-overflow: ellipsis;
179
+ }
180
+
181
+ .wr-dialog-title p {
182
+ margin: 2px 0 0;
183
+ font-size: 12px;
184
+ line-height: 1.4;
185
+ color: var(--el-text-color-secondary);
186
+ white-space: nowrap;
187
+ overflow: hidden;
188
+ text-overflow: ellipsis;
189
+ }
190
+
191
+ .wr-dialog-actions {
192
+ display: flex;
193
+ align-items: center;
194
+ gap: 8px;
195
+ flex: none;
196
+ }
197
+
198
+ .wr-dialog-actions .el-button + .el-button {
199
+ margin-left: 0;
200
+ }
201
+
202
+ .wr-dialog-close {
203
+ display: grid;
204
+ place-items: center;
205
+ width: 28px;
206
+ height: 28px;
207
+ padding: 0;
208
+ border: 0;
209
+ border-radius: 7px;
210
+ background: transparent;
211
+ color: var(--el-text-color-secondary);
212
+ cursor: pointer;
213
+ transition: background-color 0.15s ease, color 0.15s ease;
214
+ }
215
+
216
+ .wr-dialog-close:hover {
217
+ color: var(--el-text-color-primary);
218
+ background: var(--el-fill-color-light);
219
+ }
220
+
221
+ .wr-dialog-body {
222
+ flex: 1;
223
+ min-height: 0;
224
+ display: flex;
225
+ flex-direction: column;
226
+ overflow: hidden;
227
+ }
228
+
229
+ .wr-dialog-body > * {
230
+ min-height: 0;
231
+ }
232
+
233
+ .wr-dialog-body-inner {
234
+ display: flex;
235
+ flex-direction: column;
236
+ }
237
+
238
+ .wr-dialog-footer {
239
+ display: flex;
240
+ align-items: center;
241
+ justify-content: flex-end;
242
+ gap: 8px;
243
+ padding: 12px 18px;
244
+ border-top: 1px solid var(--el-border-color-lighter);
245
+ background: var(--el-bg-color);
246
+ }
247
+
248
+ .wr-dialog-footer .el-button + .el-button {
249
+ margin-left: 0;
250
+ }
251
+ </style>
package/src/index.ts ADDED
@@ -0,0 +1,21 @@
1
+ /// <reference path="./vue-shim.d.ts" />
2
+ import type { DefineComponent } from 'vue'
3
+ import AppDialogComponent from './AppDialog.vue'
4
+
5
+ export interface AppDialogProps {
6
+ modelValue?: boolean
7
+ title?: string
8
+ subtitle?: string
9
+ icon?: string
10
+ width?: string
11
+ /** 撑满视口高度(IDE / 设计器) */
12
+ fillHeight?: boolean
13
+ fullscreen?: boolean
14
+ showFooter?: boolean
15
+ closeOnClickModal?: boolean
16
+ closeOnPressEscape?: boolean
17
+ destroyOnClose?: boolean
18
+ beforeClose?: ((done: () => void) => void) | null
19
+ }
20
+
21
+ export const AppDialog = AppDialogComponent as unknown as DefineComponent<AppDialogProps, {}, any>
@@ -0,0 +1,5 @@
1
+ declare module '*.vue' {
2
+ import type { DefineComponent } from 'vue'
3
+ const component: DefineComponent<Record<string, unknown>, Record<string, unknown>, any>
4
+ export default component
5
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.