uniapp-dyckui 4.1.6 → 4.1.8

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.mjs CHANGED
@@ -84,14 +84,34 @@ const _export_sfc = (sfc, props) => {
84
84
  const Button = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-02c23a30"]]);
85
85
  const _hoisted_1$9 = { class: "dialog-content" };
86
86
  const _hoisted_2$8 = { class: "dialog-icon" };
87
- const _hoisted_3$8 = ["src"];
87
+ const _hoisted_3$8 = {
88
+ key: 0,
89
+ class: "iconfont dialog-icon-custom"
90
+ };
88
91
  const _hoisted_4$5 = {
89
92
  key: 1,
93
+ class: "iconfont dialog-button-primary icon-shouji"
94
+ };
95
+ const _hoisted_5$4 = {
96
+ key: 2,
97
+ class: "iconfont dialog-button-primary icon-xianshiqi"
98
+ };
99
+ const _hoisted_6$4 = {
100
+ key: 3,
101
+ class: "iconfont dialog-button-primary icon-xianshiqi1"
102
+ };
103
+ const _hoisted_7$2 = {
104
+ key: 4,
105
+ class: "iconfont dialog-button-primary icon-lianjiewangzhi"
106
+ };
107
+ const _hoisted_8$2 = ["src"];
108
+ const _hoisted_9$1 = {
109
+ key: 6,
90
110
  class: "default-icon"
91
111
  };
92
- const _hoisted_5$4 = { class: "dialog-title" };
93
- const _hoisted_6$4 = { class: "dialog-description" };
94
- const _hoisted_7$2 = { class: "dialog-buttons" };
112
+ const _hoisted_10$1 = { class: "dialog-title" };
113
+ const _hoisted_11$1 = { class: "dialog-description" };
114
+ const _hoisted_12$1 = { class: "dialog-buttons" };
95
115
  const _sfc_main$9 = /* @__PURE__ */ defineComponent({
96
116
  __name: "index",
97
117
  props: {
@@ -100,6 +120,8 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
100
120
  title: { default: "" },
101
121
  description: { default: "" },
102
122
  icon: { default: "" },
123
+ iconType: { default: void 0 },
124
+ customIcon: { default: "" },
103
125
  mask: { type: Boolean, default: true },
104
126
  maskOpacity: { default: 0.5 },
105
127
  closeOnMaskClick: { type: Boolean, default: true }
@@ -107,7 +129,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
107
129
  emits: ["update:modelValue", "confirm", "cancel"],
108
130
  setup(__props, { emit: __emit }) {
109
131
  useCssVars((_ctx) => ({
110
- "v1f434a4e": _ctx.maskOpacity
132
+ "ec110036": _ctx.maskOpacity
111
133
  }));
112
134
  const props = __props;
113
135
  const emit = __emit;
@@ -144,17 +166,19 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
144
166
  }, [
145
167
  createElementVNode("view", _hoisted_1$9, [
146
168
  createElementVNode("view", _hoisted_2$8, [
147
- __props.icon ? (openBlock(), createElementBlock("image", {
148
- key: 0,
149
- src: __props.icon,
150
- alt: "dialog-icon"
151
- }, null, 8, _hoisted_3$8)) : (openBlock(), createElementBlock("view", _hoisted_4$5))
169
+ renderSlot(_ctx.$slots, "icon", {}, () => [
170
+ __props.customIcon ? (openBlock(), createElementBlock("text", _hoisted_3$8, toDisplayString(__props.customIcon), 1)) : __props.iconType === "phone" ? (openBlock(), createElementBlock("text", _hoisted_4$5)) : __props.iconType === "screen" ? (openBlock(), createElementBlock("text", _hoisted_5$4)) : __props.iconType === "links" ? (openBlock(), createElementBlock("text", _hoisted_6$4)) : __props.iconType === "links2" ? (openBlock(), createElementBlock("text", _hoisted_7$2)) : __props.icon ? (openBlock(), createElementBlock("image", {
171
+ key: 5,
172
+ src: __props.icon,
173
+ alt: "dialog-icon"
174
+ }, null, 8, _hoisted_8$2)) : (openBlock(), createElementBlock("view", _hoisted_9$1))
175
+ ], true)
152
176
  ]),
153
- createElementVNode("text", _hoisted_5$4, toDisplayString(__props.title), 1),
154
- createElementVNode("text", _hoisted_6$4, toDisplayString(__props.description), 1)
177
+ createElementVNode("view", _hoisted_10$1, toDisplayString(__props.title), 1),
178
+ createElementVNode("text", _hoisted_11$1, toDisplayString(__props.description), 1)
155
179
  ]),
156
180
  _cache[1] || (_cache[1] = createElementVNode("view", { class: "dialog-divider" }, null, -1)),
157
- createElementVNode("view", _hoisted_7$2, [
181
+ createElementVNode("view", _hoisted_12$1, [
158
182
  __props.type === "open-app" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
159
183
  createElementVNode("view", {
160
184
  class: "dialog-button dialog-button-cancel",
@@ -184,7 +208,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
184
208
  };
185
209
  }
186
210
  });
187
- const Dialog = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-a2785685"]]);
211
+ const Dialog = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-1151ef29"]]);
188
212
  const _hoisted_1$8 = {
189
213
  key: 0,
190
214
  class: "sw-divider__text"
@@ -793,7 +817,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
793
817
  };
794
818
  }
795
819
  });
796
- const Popup = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-687daa34"]]);
820
+ const Popup = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-5d3c3e08"]]);
797
821
  const _hoisted_1$2 = {
798
822
  key: 0,
799
823
  class: "refresh-content"
@@ -1216,19 +1240,19 @@ const _hoisted_4 = {
1216
1240
  };
1217
1241
  const _hoisted_5 = {
1218
1242
  key: 0,
1219
- class: "sw-toast__icon--success"
1243
+ class: "sw-toast__icon--success iconfont icon-zhengqueshixin"
1220
1244
  };
1221
1245
  const _hoisted_6 = {
1222
1246
  key: 1,
1223
- class: "sw-toast__icon--fail"
1247
+ class: "sw-toast__icon--fail iconfont icon-shanchu"
1224
1248
  };
1225
1249
  const _hoisted_7 = {
1226
1250
  key: 2,
1227
- class: "sw-toast__custom-icon"
1251
+ class: "sw-toast__icon--warning iconfont icon-jurassic_warn"
1228
1252
  };
1229
1253
  const _hoisted_8 = {
1230
- key: 2,
1231
- class: "sw-toast__text"
1254
+ key: 3,
1255
+ class: "sw-toast__custom-icon"
1232
1256
  };
1233
1257
  const _sfc_main = /* @__PURE__ */ defineComponent({
1234
1258
  __name: "index",
@@ -1242,7 +1266,12 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1242
1266
  icon: { type: Boolean, default: true },
1243
1267
  customIcon: { default: "" },
1244
1268
  large: { type: Boolean, default: false },
1245
- customStyle: { default: () => ({}) }
1269
+ customStyle: { default: () => ({}) },
1270
+ countdown: { type: Boolean, default: false },
1271
+ countdownSeconds: { default: 5 },
1272
+ countdownParentheses: { type: Boolean, default: false },
1273
+ countdownSuffix: { default: "" },
1274
+ longText: { type: Boolean, default: false }
1246
1275
  },
1247
1276
  emits: ["update:modelValue", "close", "click"],
1248
1277
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -1250,8 +1279,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1250
1279
  const emit = __emit;
1251
1280
  const toastRef = ref(null);
1252
1281
  let timer = null;
1282
+ let countdownTimer = null;
1253
1283
  const showToast = ref(props.modelValue);
1254
1284
  const isClosing = ref(false);
1285
+ const currentCountdown = ref(props.countdownSeconds);
1286
+ const originalMessage = ref(props.message);
1255
1287
  const showIcon = computed(() => {
1256
1288
  if (props.loading)
1257
1289
  return true;
@@ -1259,21 +1291,35 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1259
1291
  return props.icon;
1260
1292
  return true;
1261
1293
  });
1294
+ const displayMessage = computed(() => {
1295
+ if (props.countdown && showToast.value) {
1296
+ let countdownPart = "";
1297
+ if (props.countdownParentheses) {
1298
+ countdownPart = `(${currentCountdown.value}秒${props.countdownSuffix})`;
1299
+ } else {
1300
+ countdownPart = `${currentCountdown.value}秒${props.countdownSuffix}`;
1301
+ }
1302
+ return `${originalMessage.value || ""} ${countdownPart}`;
1303
+ }
1304
+ return props.message;
1305
+ });
1262
1306
  function onClick() {
1263
1307
  emit("click");
1264
1308
  }
1265
1309
  function close() {
1266
1310
  if (!showToast.value)
1267
1311
  return;
1312
+ clearCountdownTimer();
1268
1313
  isClosing.value = true;
1269
1314
  emit("close");
1270
1315
  }
1271
1316
  function startTimer() {
1272
1317
  clearTimer();
1273
- if (props.duration > 0 && !props.loading) {
1318
+ const actualDuration = props.countdown && props.countdownSeconds > 0 ? props.countdownSeconds * 1e3 : props.duration;
1319
+ if (actualDuration > 0 && !props.loading) {
1274
1320
  timer = setTimeout(() => {
1275
1321
  close();
1276
- }, props.duration);
1322
+ }, actualDuration);
1277
1323
  }
1278
1324
  }
1279
1325
  function clearTimer() {
@@ -1282,6 +1328,29 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1282
1328
  timer = null;
1283
1329
  }
1284
1330
  }
1331
+ function startCountdown() {
1332
+ clearCountdownTimer();
1333
+ if (props.countdown && props.countdownSeconds > 0) {
1334
+ currentCountdown.value = props.countdownSeconds;
1335
+ originalMessage.value = props.message;
1336
+ countdownTimer = setInterval(() => {
1337
+ currentCountdown.value--;
1338
+ if (currentCountdown.value <= 0) {
1339
+ clearCountdownTimer();
1340
+ if (props.duration > 0) {
1341
+ close();
1342
+ }
1343
+ }
1344
+ }, 1e3);
1345
+ }
1346
+ }
1347
+ function clearCountdownTimer() {
1348
+ if (countdownTimer) {
1349
+ clearInterval(countdownTimer);
1350
+ countdownTimer = null;
1351
+ }
1352
+ currentCountdown.value = props.countdownSeconds;
1353
+ }
1285
1354
  function handleTransitionEnd() {
1286
1355
  if (isClosing.value) {
1287
1356
  showToast.value = false;
@@ -1294,6 +1363,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1294
1363
  showToast.value = true;
1295
1364
  isClosing.value = false;
1296
1365
  startTimer();
1366
+ if (props.countdown) {
1367
+ startCountdown();
1368
+ }
1297
1369
  } else {
1298
1370
  close();
1299
1371
  }
@@ -1301,15 +1373,29 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1301
1373
  watch(() => props.message, () => {
1302
1374
  if (showToast.value && !props.loading) {
1303
1375
  startTimer();
1376
+ if (props.countdown) {
1377
+ originalMessage.value = props.message;
1378
+ }
1379
+ }
1380
+ });
1381
+ watch([() => props.countdown, () => props.countdownSeconds], () => {
1382
+ if (showToast.value && props.countdown) {
1383
+ startCountdown();
1384
+ } else {
1385
+ clearCountdownTimer();
1304
1386
  }
1305
1387
  });
1306
1388
  onMounted(() => {
1307
1389
  if (props.modelValue) {
1308
1390
  startTimer();
1391
+ if (props.countdown) {
1392
+ startCountdown();
1393
+ }
1309
1394
  }
1310
1395
  });
1311
1396
  onUnmounted(() => {
1312
1397
  clearTimer();
1398
+ clearCountdownTimer();
1313
1399
  });
1314
1400
  __expose({
1315
1401
  /**
@@ -1336,16 +1422,19 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
1336
1422
  __props.loading ? (openBlock(), createElementBlock("view", _hoisted_1, [
1337
1423
  !__props.customIcon ? (openBlock(), createElementBlock("text", _hoisted_2)) : (openBlock(), createElementBlock("text", _hoisted_3, toDisplayString(__props.customIcon), 1))
1338
1424
  ])) : showIcon.value ? (openBlock(), createElementBlock("view", _hoisted_4, [
1339
- __props.type === "success" ? (openBlock(), createElementBlock("text", _hoisted_5, "✓")) : __props.type === "fail" ? (openBlock(), createElementBlock("text", _hoisted_6, "")) : __props.customIcon ? (openBlock(), createElementBlock("text", _hoisted_7, toDisplayString(__props.customIcon), 1)) : createCommentVNode("", true)
1425
+ __props.type === "success" ? (openBlock(), createElementBlock("text", _hoisted_5)) : __props.type === "fail" ? (openBlock(), createElementBlock("text", _hoisted_6)) : __props.type === "warning" ? (openBlock(), createElementBlock("text", _hoisted_7)) : __props.customIcon ? (openBlock(), createElementBlock("text", _hoisted_8, toDisplayString(__props.customIcon), 1)) : createCommentVNode("", true)
1340
1426
  ])) : createCommentVNode("", true),
1341
- __props.message ? (openBlock(), createElementBlock("text", _hoisted_8, toDisplayString(__props.message), 1)) : createCommentVNode("", true)
1427
+ displayMessage.value ? (openBlock(), createElementBlock("text", {
1428
+ key: 2,
1429
+ class: normalizeClass(["sw-toast__text", { "sw-toast__text--long": __props.longText }])
1430
+ }, toDisplayString(displayMessage.value), 3)) : createCommentVNode("", true)
1342
1431
  ], 38)), [
1343
1432
  [vShow, showToast.value]
1344
1433
  ]);
1345
1434
  };
1346
1435
  }
1347
1436
  });
1348
- const Toast = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-3bcd294c"]]);
1437
+ const Toast = /* @__PURE__ */ _export_sfc(_sfc_main, [["__scopeId", "data-v-78362f19"]]);
1349
1438
  const index = {
1350
1439
  Button,
1351
1440
  Dialog,