bge-ui 1.4.4 → 1.4.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/dist/index.js +25 -11
- package/dist/message/method.d.ts +1 -1
- package/dist/style.css +11 -15
- package/package.json +1 -1
- package/src/input/index.vue +1 -1
- package/src/message/index.vue +25 -12
- package/src/message/method.ts +19 -8
package/dist/index.js
CHANGED
|
@@ -6292,7 +6292,7 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
|
|
|
6292
6292
|
class: normalizeClass(["bge-input__suffix", { suffix: !!unref(suffixSlot) }])
|
|
6293
6293
|
}, [
|
|
6294
6294
|
createElementVNode("span", _hoisted_6$5, [
|
|
6295
|
-
input.value ? (openBlock(), createBlock(_sfc_main$27, {
|
|
6295
|
+
input.value && !__props.readonly && !__props.disabled ? (openBlock(), createBlock(_sfc_main$27, {
|
|
6296
6296
|
key: 0,
|
|
6297
6297
|
class: "bge-input__icon clear",
|
|
6298
6298
|
onMouseover: _cache[2] || (_cache[2] = withModifiers(($event) => hoverClear(true), ["prevent"])),
|
|
@@ -8570,6 +8570,10 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
8570
8570
|
default: "",
|
|
8571
8571
|
required: true
|
|
8572
8572
|
},
|
|
8573
|
+
styleType: {
|
|
8574
|
+
type: String,
|
|
8575
|
+
default: "message"
|
|
8576
|
+
},
|
|
8573
8577
|
type: {
|
|
8574
8578
|
type: String,
|
|
8575
8579
|
default: "info",
|
|
@@ -8621,7 +8625,10 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
8621
8625
|
stopTimer == null ? void 0 : stopTimer();
|
|
8622
8626
|
}
|
|
8623
8627
|
const getInstance = (id) => {
|
|
8624
|
-
const idx = props.instances.findIndex((instance) =>
|
|
8628
|
+
const idx = props.instances.findIndex((instance) => {
|
|
8629
|
+
console.log(id, instance.id);
|
|
8630
|
+
return instance.id === id;
|
|
8631
|
+
});
|
|
8625
8632
|
const current = props.instances[idx];
|
|
8626
8633
|
let prev;
|
|
8627
8634
|
if (idx > 0) {
|
|
@@ -8674,7 +8681,7 @@ const _sfc_main$o = /* @__PURE__ */ defineComponent({
|
|
|
8674
8681
|
id: __props.id,
|
|
8675
8682
|
ref_key: "messageRef",
|
|
8676
8683
|
ref: messageRef,
|
|
8677
|
-
class: normalizeClass(`bge-message ${__props.type}`),
|
|
8684
|
+
class: normalizeClass(`bge-message ${__props.type} ${__props.styleType}`),
|
|
8678
8685
|
style: normalizeStyle(customStyle.value),
|
|
8679
8686
|
role: "alert",
|
|
8680
8687
|
onMouseenter: clearTimer,
|
|
@@ -8721,9 +8728,12 @@ const messageDefaults = {
|
|
|
8721
8728
|
repeatNum: 1,
|
|
8722
8729
|
appendTo
|
|
8723
8730
|
};
|
|
8724
|
-
let
|
|
8725
|
-
|
|
8731
|
+
let seedMessage = 1;
|
|
8732
|
+
let seedNotification = 1;
|
|
8733
|
+
const instancesMessage = shallowReactive([]);
|
|
8734
|
+
const instancesNotification = shallowReactive([]);
|
|
8726
8735
|
const closeMessage = (instance) => {
|
|
8736
|
+
const instances = instance.props.styleType === "notification" ? instancesNotification : instancesMessage;
|
|
8727
8737
|
const idx = instances.indexOf(instance);
|
|
8728
8738
|
if (idx === -1)
|
|
8729
8739
|
return;
|
|
@@ -8735,11 +8745,13 @@ function isFunction(functionToCheck) {
|
|
|
8735
8745
|
return functionToCheck && {}.toString.call(functionToCheck) === "[object Function]";
|
|
8736
8746
|
}
|
|
8737
8747
|
function createMessage(_options = {}, context) {
|
|
8738
|
-
const
|
|
8748
|
+
const instances = _options.styleType === "notification" ? instancesNotification : instancesMessage;
|
|
8749
|
+
const id = `message_${_options.styleType || "message"}_${_options.styleType === "notification" ? seedNotification++ : seedMessage++}`;
|
|
8739
8750
|
const normalized = {
|
|
8740
8751
|
...messageDefaults,
|
|
8741
8752
|
..._options
|
|
8742
8753
|
};
|
|
8754
|
+
console.log(_options.styleType === "notification", instances, id);
|
|
8743
8755
|
const { appendTo: appendTo2, ...options } = normalized;
|
|
8744
8756
|
const userOnClose = normalized.onClose;
|
|
8745
8757
|
const container = document.createElement("div");
|
|
@@ -8784,10 +8796,11 @@ function createMessage(_options = {}, context) {
|
|
|
8784
8796
|
return instance;
|
|
8785
8797
|
}
|
|
8786
8798
|
const message$1 = (options = {}, context) => {
|
|
8799
|
+
const normalized = typeof options === "string" ? { message: options } : { ...options };
|
|
8800
|
+
const instances = options.styleType === "notification" ? instancesNotification : instancesMessage;
|
|
8787
8801
|
if (instances.length >= 10) {
|
|
8788
8802
|
return { close: () => void 0 };
|
|
8789
8803
|
}
|
|
8790
|
-
const normalized = typeof options === "string" ? { message: options } : { ...options };
|
|
8791
8804
|
const instance = createMessage(normalized, context);
|
|
8792
8805
|
instances.push(instance);
|
|
8793
8806
|
return instance.handler;
|
|
@@ -8798,8 +8811,9 @@ messageTypes.forEach((type4) => {
|
|
|
8798
8811
|
return message$1({ ...normalized, type: type4 }, appContext);
|
|
8799
8812
|
};
|
|
8800
8813
|
});
|
|
8801
|
-
function closeAll(type4) {
|
|
8802
|
-
|
|
8814
|
+
function closeAll(type4, styleType = "message") {
|
|
8815
|
+
const instances = styleType === "notification" ? instancesNotification : instancesMessage;
|
|
8816
|
+
for (const instance of instances[styleType]) {
|
|
8803
8817
|
if (!type4 || type4 === instance.props.type) {
|
|
8804
8818
|
instance.handler.close();
|
|
8805
8819
|
}
|
|
@@ -17966,7 +17980,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
17966
17980
|
},
|
|
17967
17981
|
setup(__props) {
|
|
17968
17982
|
const props = __props;
|
|
17969
|
-
const
|
|
17983
|
+
const instances = computed(
|
|
17970
17984
|
() => props.multiCalendars > 0 ? [...Array(props.multiCalendars).keys()] : [0]
|
|
17971
17985
|
);
|
|
17972
17986
|
const calendarInstanceClassWrapper = computed(() => ({
|
|
@@ -17981,7 +17995,7 @@ const _sfc_main$f = /* @__PURE__ */ defineComponent({
|
|
|
17981
17995
|
"dp--flex-display-collapsed": _ctx.collapse
|
|
17982
17996
|
})
|
|
17983
17997
|
}, [
|
|
17984
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
17998
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(instances.value, (instance, i) => {
|
|
17985
17999
|
return openBlock(), createElementBlock("div", {
|
|
17986
18000
|
key: instance,
|
|
17987
18001
|
class: normalizeClass(calendarInstanceClassWrapper.value)
|
package/dist/message/method.d.ts
CHANGED
package/dist/style.css
CHANGED
|
@@ -1259,28 +1259,24 @@ to {
|
|
|
1259
1259
|
transition: opacity 0.3s, transform 0.4s, top 0.4s;
|
|
1260
1260
|
padding: var(--layout-x-2, 8px) var(--layout-x-4, 16px);
|
|
1261
1261
|
overflow: hidden;
|
|
1262
|
-
color: var(--
|
|
1263
|
-
/* shadow1 */
|
|
1262
|
+
color: var(--tc-title, #FFF);
|
|
1264
1263
|
box-shadow: var(--shadow1, "0px 12px 40px 0px rgba(0, 0, 0, 0.08)");
|
|
1264
|
+
background: var(--bg-notification, #232B33);
|
|
1265
1265
|
}
|
|
1266
|
-
.bge-message.
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
.bge-message.error {
|
|
1270
|
-
background: var(--bg-red, #D14770);
|
|
1266
|
+
.bge-message.notification {
|
|
1267
|
+
transform: translateX(-100%);
|
|
1268
|
+
left: calc(100% - 24px);
|
|
1271
1269
|
}
|
|
1272
1270
|
.bge-message.error p {
|
|
1273
|
-
width: calc(100% -
|
|
1274
|
-
}
|
|
1275
|
-
.bge-message.success {
|
|
1276
|
-
background: var(--bg-green, #00A389);
|
|
1271
|
+
width: calc(100% - 28px);
|
|
1277
1272
|
}
|
|
1278
1273
|
.bge-message.success p {
|
|
1279
|
-
width: calc(100% -
|
|
1274
|
+
width: calc(100% - 28px);
|
|
1280
1275
|
}
|
|
1281
1276
|
.bge-message .bge-message__icon {
|
|
1282
|
-
vertical-align:
|
|
1283
|
-
margin-right:
|
|
1277
|
+
vertical-align: top;
|
|
1278
|
+
margin-right: 8px;
|
|
1279
|
+
margin-top: 2px;
|
|
1284
1280
|
flex-shrink: 0;
|
|
1285
1281
|
display: inline-block;
|
|
1286
1282
|
}
|
|
@@ -1292,7 +1288,7 @@ to {
|
|
|
1292
1288
|
vertical-align: middle;
|
|
1293
1289
|
white-space: nowrap;
|
|
1294
1290
|
overflow: hidden;
|
|
1295
|
-
color: var(--
|
|
1291
|
+
color: var(--tc-title, #FFF);
|
|
1296
1292
|
text-overflow: ellipsis;
|
|
1297
1293
|
font-size: 14px;
|
|
1298
1294
|
font-style: normal;
|
package/package.json
CHANGED
package/src/input/index.vue
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
@change="handleChange" @input="handleInput" />
|
|
15
15
|
<span class="bge-input__suffix" :class="{ suffix: !!suffixSlot }">
|
|
16
16
|
<span class="bge-input__suffix-inner">
|
|
17
|
-
<mono-close class="bge-input__icon clear" v-if="input" @mouseover.prevent="hoverClear(true)"
|
|
17
|
+
<mono-close class="bge-input__icon clear" v-if="input && !readonly && !disabled" @mouseover.prevent="hoverClear(true)"
|
|
18
18
|
@mouseout.prevent="hoverClear(false)" @click="handelClear" size="20" />
|
|
19
19
|
<slot v-if="type !== 'textarea'" name="suffix" />
|
|
20
20
|
</span>
|
package/src/message/index.vue
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<transition name="fade" @before-leave="onClose" @after-leave="$emit('destroy')">
|
|
3
|
-
<div v-show="visible" :id="id" ref="messageRef" :class="`bge-message ${type}`" :style="customStyle" role="alert"
|
|
3
|
+
<div v-show="visible" :id="id" ref="messageRef" :class="`bge-message ${type} ${styleType}`" :style="customStyle" role="alert"
|
|
4
4
|
@mouseenter="clearTimer" @mouseleave="startTimer">
|
|
5
5
|
<component v-if="icon" :is="icon" class="bge-message__icon" :size="20" />
|
|
6
6
|
<slot>
|
|
@@ -33,6 +33,10 @@ const props: any = defineProps({
|
|
|
33
33
|
default: '',
|
|
34
34
|
required: true
|
|
35
35
|
},
|
|
36
|
+
styleType: {
|
|
37
|
+
type: String,
|
|
38
|
+
default: 'message'
|
|
39
|
+
},
|
|
36
40
|
type: {
|
|
37
41
|
type: String,
|
|
38
42
|
default: 'info',
|
|
@@ -74,7 +78,10 @@ function clearTimer() {
|
|
|
74
78
|
}
|
|
75
79
|
|
|
76
80
|
const getInstance = (id: string) => {
|
|
77
|
-
const idx = props.instances.findIndex((instance: {id: String}) =>
|
|
81
|
+
const idx = props.instances.findIndex((instance: {id: String}) => {
|
|
82
|
+
console.log(id, instance.id)
|
|
83
|
+
return instance.id === id
|
|
84
|
+
})
|
|
78
85
|
const current = props.instances[idx]
|
|
79
86
|
let prev: any | undefined
|
|
80
87
|
if (idx > 0) {
|
|
@@ -136,33 +143,39 @@ defineExpose({
|
|
|
136
143
|
transition: opacity 0.3s, transform 0.4s, top 0.4s;
|
|
137
144
|
padding: var(--layout-x-2, 8px) var(--layout-x-4, 16px);
|
|
138
145
|
overflow: hidden;
|
|
139
|
-
color: var(--
|
|
140
|
-
/* shadow1 */
|
|
146
|
+
color: var(--tc-title, #FFF);
|
|
141
147
|
box-shadow: var(--shadow1, '0px 12px 40px 0px rgba(0, 0, 0, 0.08)');
|
|
148
|
+
background: var(--bg-notification, #232B33);
|
|
149
|
+
|
|
150
|
+
&.notification {
|
|
151
|
+
transform: translateX(-100%);
|
|
152
|
+
left: calc(100% - 24px);
|
|
153
|
+
}
|
|
142
154
|
|
|
143
155
|
&.info {
|
|
144
|
-
background: var(--bg-tooltip, #53677A);
|
|
156
|
+
// background: var(--bg-tooltip, #53677A);
|
|
145
157
|
}
|
|
146
158
|
|
|
147
159
|
&.error {
|
|
148
|
-
background: var(--bg-red, #D14770);
|
|
160
|
+
// background: var(--bg-red, #D14770);
|
|
149
161
|
|
|
150
162
|
p {
|
|
151
|
-
width: calc(100% -
|
|
163
|
+
width: calc(100% - 28px)
|
|
152
164
|
}
|
|
153
165
|
}
|
|
154
166
|
|
|
155
167
|
&.success {
|
|
156
|
-
background: var(--bg-green, #00A389);
|
|
168
|
+
// background: var(--bg-green, #00A389);
|
|
157
169
|
|
|
158
170
|
p {
|
|
159
|
-
width: calc(100% -
|
|
171
|
+
width: calc(100% - 28px)
|
|
160
172
|
}
|
|
161
173
|
}
|
|
162
174
|
|
|
163
175
|
.bge-message__icon {
|
|
164
|
-
vertical-align:
|
|
165
|
-
margin-right:
|
|
176
|
+
vertical-align: top;
|
|
177
|
+
margin-right: 8px;
|
|
178
|
+
margin-top: 2px;
|
|
166
179
|
flex-shrink: 0;
|
|
167
180
|
display: inline-block;
|
|
168
181
|
}
|
|
@@ -175,7 +188,7 @@ defineExpose({
|
|
|
175
188
|
vertical-align: middle;
|
|
176
189
|
white-space: nowrap;
|
|
177
190
|
overflow: hidden;
|
|
178
|
-
color: var(--
|
|
191
|
+
color: var(--tc-title, #FFF);
|
|
179
192
|
text-overflow: ellipsis;
|
|
180
193
|
font-size: 14px;
|
|
181
194
|
font-style: normal;
|
package/src/message/method.ts
CHANGED
|
@@ -29,11 +29,19 @@ const messageDefaults = {
|
|
|
29
29
|
appendTo,
|
|
30
30
|
} as const
|
|
31
31
|
|
|
32
|
-
let
|
|
32
|
+
let seedMessage = 1
|
|
33
|
+
let seedNotification = 1
|
|
33
34
|
|
|
34
|
-
const instances: any
|
|
35
|
+
// const instances: any = shallowReactive({
|
|
36
|
+
// message: [],
|
|
37
|
+
// notification: []
|
|
38
|
+
// })
|
|
39
|
+
|
|
40
|
+
const instancesMessage: any = shallowReactive([])
|
|
41
|
+
const instancesNotification : any = shallowReactive([])
|
|
35
42
|
|
|
36
43
|
const closeMessage = (instance: any) => {
|
|
44
|
+
const instances = instance.props.styleType === 'notification' ? instancesNotification : instancesMessage
|
|
37
45
|
const idx = instances.indexOf(instance)
|
|
38
46
|
if (idx === -1) return
|
|
39
47
|
|
|
@@ -47,12 +55,13 @@ function isFunction(functionToCheck: any) {
|
|
|
47
55
|
}
|
|
48
56
|
|
|
49
57
|
function createMessage(_options: any = {}, context?: AppContext | null) {
|
|
50
|
-
const
|
|
58
|
+
const instances = _options.styleType === 'notification' ? instancesNotification : instancesMessage
|
|
59
|
+
const id = `message_${_options.styleType || 'message'}_${_options.styleType === 'notification' ? seedNotification ++ : seedMessage++}`
|
|
51
60
|
const normalized = {
|
|
52
61
|
...messageDefaults,
|
|
53
62
|
..._options,
|
|
54
63
|
}
|
|
55
|
-
|
|
64
|
+
console.log(_options.styleType === 'notification', instances, id)
|
|
56
65
|
const { appendTo, ...options } = normalized
|
|
57
66
|
|
|
58
67
|
const userOnClose = normalized.onClose
|
|
@@ -112,11 +121,12 @@ function createMessage(_options: any = {}, context?: AppContext | null) {
|
|
|
112
121
|
}
|
|
113
122
|
|
|
114
123
|
const message: any &
|
|
115
|
-
Partial<any> & { _context: AppContext | null } = (options = {}, context: any) => {
|
|
124
|
+
Partial<any> & { _context: AppContext | null } = (options:any = {}, context: any) => {
|
|
125
|
+
const normalized: any = typeof options === 'string' ? { message: options } : { ...options }
|
|
126
|
+
const instances = options.styleType === 'notification' ? instancesNotification : instancesMessage
|
|
116
127
|
if (instances.length >= 10) {
|
|
117
128
|
return { close: () => undefined }
|
|
118
129
|
}
|
|
119
|
-
const normalized: any = typeof options === 'string' ? { message: options } : { ...options }
|
|
120
130
|
const instance = createMessage(normalized, context)
|
|
121
131
|
|
|
122
132
|
instances.push(instance)
|
|
@@ -131,8 +141,9 @@ messageTypes.forEach((type: any) => {
|
|
|
131
141
|
}
|
|
132
142
|
})
|
|
133
143
|
|
|
134
|
-
export function closeAll(type?: any): void {
|
|
135
|
-
|
|
144
|
+
export function closeAll(type?: any, styleType: string = 'message'): void {
|
|
145
|
+
const instances = styleType === 'notification' ? instancesNotification : instancesMessage
|
|
146
|
+
for (const instance of instances[styleType]) {
|
|
136
147
|
if (!type || type === instance.props.type) {
|
|
137
148
|
instance.handler.close()
|
|
138
149
|
}
|