bge-ui 1.4.5 → 1.4.7

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
@@ -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) => instance.id === id);
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 seed = 1;
8725
- const instances = shallowReactive([]);
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 id = `message_${seed++}`;
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
- for (const instance of instances) {
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 instances2 = computed(
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(instances2.value, (instance, i) => {
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)
@@ -1,3 +1,3 @@
1
- export declare function closeAll(type?: any): void;
1
+ export declare function closeAll(type?: any, styleType?: string): void;
2
2
  declare const _default: any;
3
3
  export default _default;
package/dist/style.css CHANGED
@@ -1259,28 +1259,25 @@ 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(--persistent-white, #FFF);
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.info {
1267
- background: var(--bg-tooltip, #53677A);
1268
- }
1269
- .bge-message.error {
1270
- background: var(--bg-red, #D14770);
1266
+ .bge-message.notification {
1267
+ transform: unset;
1268
+ left: unset;
1269
+ right: 24px;
1271
1270
  }
1272
1271
  .bge-message.error p {
1273
- width: calc(100% - 24px);
1274
- }
1275
- .bge-message.success {
1276
- background: var(--bg-green, #00A389);
1272
+ width: calc(100% - 28px);
1277
1273
  }
1278
1274
  .bge-message.success p {
1279
- width: calc(100% - 24px);
1275
+ width: calc(100% - 28px);
1280
1276
  }
1281
1277
  .bge-message .bge-message__icon {
1282
- vertical-align: middle;
1283
- margin-right: 4px;
1278
+ vertical-align: top;
1279
+ margin-right: 8px;
1280
+ margin-top: 2px;
1284
1281
  flex-shrink: 0;
1285
1282
  display: inline-block;
1286
1283
  }
@@ -1292,7 +1289,7 @@ to {
1292
1289
  vertical-align: middle;
1293
1290
  white-space: nowrap;
1294
1291
  overflow: hidden;
1295
- color: var(--persistent-white, #FFF);
1292
+ color: var(--tc-title, #FFF);
1296
1293
  text-overflow: ellipsis;
1297
1294
  font-size: 14px;
1298
1295
  font-style: normal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bge-ui",
3
- "version": "1.4.5",
3
+ "version": "1.4.7",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -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}) => instance.id === id)
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,40 @@ 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(--persistent-white, #FFF);
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: unset;
152
+ left: unset;
153
+ right: 24px;
154
+ }
142
155
 
143
156
  &.info {
144
- background: var(--bg-tooltip, #53677A);
157
+ // background: var(--bg-tooltip, #53677A);
145
158
  }
146
159
 
147
160
  &.error {
148
- background: var(--bg-red, #D14770);
161
+ // background: var(--bg-red, #D14770);
149
162
 
150
163
  p {
151
- width: calc(100% - 24px)
164
+ width: calc(100% - 28px)
152
165
  }
153
166
  }
154
167
 
155
168
  &.success {
156
- background: var(--bg-green, #00A389);
169
+ // background: var(--bg-green, #00A389);
157
170
 
158
171
  p {
159
- width: calc(100% - 24px)
172
+ width: calc(100% - 28px)
160
173
  }
161
174
  }
162
175
 
163
176
  .bge-message__icon {
164
- vertical-align: middle;
165
- margin-right: 4px;
177
+ vertical-align: top;
178
+ margin-right: 8px;
179
+ margin-top: 2px;
166
180
  flex-shrink: 0;
167
181
  display: inline-block;
168
182
  }
@@ -175,7 +189,7 @@ defineExpose({
175
189
  vertical-align: middle;
176
190
  white-space: nowrap;
177
191
  overflow: hidden;
178
- color: var(--persistent-white, #FFF);
192
+ color: var(--tc-title, #FFF);
179
193
  text-overflow: ellipsis;
180
194
  font-size: 14px;
181
195
  font-style: normal;
@@ -29,11 +29,19 @@ const messageDefaults = {
29
29
  appendTo,
30
30
  } as const
31
31
 
32
- let seed = 1
32
+ let seedMessage = 1
33
+ let seedNotification = 1
33
34
 
34
- const instances: any[] = shallowReactive([])
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 id = `message_${seed++}`
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
- for (const instance of instances) {
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
  }