@voicenter-team/voicenter-ui-plus 4.0.0-beta.7 → 4.0.0-beta.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.
Files changed (70) hide show
  1. package/MIGRATION_v3.md +196 -196
  2. package/README.md +3 -1
  3. package/library/assets/components/VcFileUploader/VcFileUploaderSimple.css +1 -1
  4. package/library/assets/components/VcJsonSchema/Components/JsonSchemaEditor.css +1 -1
  5. package/library/assets/components/VcLoading/Loaders/Circles.css +1 -1
  6. package/library/assets/components/VcLoading/Loaders/DotSpinner.css +1 -1
  7. package/library/assets/components/VcLoading/Loaders/LdsSpinner.css +1 -1
  8. package/library/assets/components/VcLoading/Loaders/LoadIcon.css +1 -1
  9. package/library/assets/components/VcLoading/Loaders/Stretch.css +1 -1
  10. package/library/assets/components/VcLoading/VcLoading.css +1 -1
  11. package/library/assets/components/VcMdEditor/ParameterNode.css +1 -1
  12. package/library/assets/components/VcSegmented/VcSegmented.css +1 -1
  13. package/library/assets/components/VcSkeletonLoader/Loaders/Card.css +1 -1
  14. package/library/assets/components/VcSkeletonLoader/Loaders/Circle.css +1 -1
  15. package/library/assets/components/VcSkeletonLoader/Loaders/Row.css +1 -1
  16. package/library/assets/components/VcSkeletonLoader/Loaders/Square.css +1 -1
  17. package/library/assets/components/VcSkeletonLoader/Loaders/Text.css +1 -1
  18. package/library/assets/components/VcTimeInput/VcTimeInput.css +1 -1
  19. package/library/components/VcCheckbox/VcCheckbox.vue.mjs +1 -1
  20. package/library/components/VcCheckbox/VcCheckboxButton.vue.mjs +1 -1
  21. package/library/components/VcDatePicker/VcDatePicker.vue.mjs +1 -1
  22. package/library/components/VcDropdown/VcDropdownItem.vue.mjs +1 -1
  23. package/library/components/VcFileUploader/VcFileUploaderSimple.vue.mjs +1 -1
  24. package/library/components/VcForm/VcForm.vue.mjs +1 -1
  25. package/library/components/VcForm/VcFormItem.vue.mjs +1 -1
  26. package/library/components/VcHtmlEditor/VcHtmlEditorToolbar.vue.mjs +1 -1
  27. package/library/components/VcInput/VcInput.vue.mjs +1 -1
  28. package/library/components/VcJsonSchema/Components/JsonSchemaEditor.vue.mjs +1 -1
  29. package/library/components/VcLoading/Loaders/Circles.vue.mjs +1 -1
  30. package/library/components/VcLoading/Loaders/DotSpinner.vue.mjs +1 -1
  31. package/library/components/VcLoading/Loaders/DotSpinner.vue2.mjs +2 -2
  32. package/library/components/VcLoading/Loaders/LdsSpinner.vue.mjs +1 -1
  33. package/library/components/VcLoading/Loaders/LoadIcon.vue.mjs +1 -1
  34. package/library/components/VcLoading/Loaders/Stretch.vue.mjs +1 -1
  35. package/library/components/VcLoading/Loaders/Stretch.vue2.mjs +1 -1
  36. package/library/components/VcLoading/VcLoading.vue.mjs +1 -1
  37. package/library/components/VcMdEditor/ParameterNode.vue.mjs +1 -1
  38. package/library/components/VcMdEditor/VcMdEditor.vue.mjs +1 -1
  39. package/library/components/VcMdEditor/VcMdEditorToolbar.vue.mjs +1 -1
  40. package/library/components/VcMessage/reactions/VcMessageReactionBar.vue.mjs +1 -1
  41. package/library/components/VcRadio/VcRadio.vue.mjs +1 -1
  42. package/library/components/VcSegmented/VcSegmented.vue.mjs +1 -1
  43. package/library/components/VcSelect/VcSelect.vue.mjs +1 -1
  44. package/library/components/VcSkeletonLoader/Loaders/Card.vue.mjs +1 -1
  45. package/library/components/VcSkeletonLoader/Loaders/Circle.vue.mjs +1 -1
  46. package/library/components/VcSkeletonLoader/Loaders/Row.vue.mjs +1 -1
  47. package/library/components/VcSkeletonLoader/Loaders/Square.vue.mjs +1 -1
  48. package/library/components/VcSkeletonLoader/Loaders/Text.vue.mjs +1 -1
  49. package/library/components/VcSlider/VcSlider.vue.mjs +1 -1
  50. package/library/components/VcTimeInput/VcTimeInput.vue.mjs +117 -9
  51. package/library/index.mjs.gz +0 -0
  52. package/library/localization/index.mjs.gz +0 -0
  53. package/library/plugin.mjs.gz +0 -0
  54. package/library/style.css +16 -16
  55. package/library/style.css.br +0 -0
  56. package/library/style.css.gz +0 -0
  57. package/library/theme/index.mjs.gz +0 -0
  58. package/library/types/components/VcTimeInput/VcTimeInput.vue.d.ts +20 -6
  59. package/library/types/localization/locales/en.json.d.ts +415 -415
  60. package/library/types/theme/themes.json.d.ts +72 -72
  61. package/library/utils/jsonSchema/index.mjs.gz +0 -0
  62. package/package.json +311 -311
  63. package/src/theme/index.ts +101 -101
  64. package/src/theme/tailwindScheme.js +78 -78
  65. package/src/theme/theme.types.ts +31 -31
  66. package/src/theme/themeMerge.ts +63 -63
  67. package/src/theme/themes.json +72 -72
  68. package/tailwind.config.d.ts +5 -5
  69. package/tailwind.config.js +178 -178
  70. /package/library/assets/node_modules/element-plus/theme-chalk/src/{date-picker.css → tooltip.css} +0 -0
@@ -1,8 +1,8 @@
1
1
  import '../../assets/components/VcTimeInput/VcTimeInput.css';
2
- import { defineComponent, ref, reactive, computed, watch, onMounted, openBlock, createElementBlock, normalizeStyle, unref, createElementVNode, normalizeClass, withDirectives, createVNode, toDisplayString, createCommentVNode, withModifiers, vModelText } from "vue";
2
+ import { defineComponent, ref, reactive, computed, watch, onMounted, openBlock, createElementBlock, normalizeStyle, unref, createElementVNode, normalizeClass, withDirectives, createVNode, toDisplayString, createCommentVNode, withModifiers, vModelText, createBlock } from "vue";
3
3
  import _sfc_main$1 from "../VcIcon/VcIcon.vue.mjs";
4
4
  import '../../assets/components/VcIcon/VcIcon.css';/* empty css */
5
- import { Minus, Plus } from "@lucide/vue";
5
+ import { Minus, X, Plus } from "@lucide/vue";
6
6
  import { longPress } from "../../directives/long-press.mjs";
7
7
  import useInputBase from "../../composables/input/useInputBase.mjs";
8
8
  import { DEFAULT_COLOR } from "../../enum/inputDefaults.mjs";
@@ -24,6 +24,10 @@ const _hoisted_7 = {
24
24
  };
25
25
  const _hoisted_8 = { class: "divider" };
26
26
  const _hoisted_9 = ["disabled"];
27
+ const _hoisted_10 = {
28
+ key: 0,
29
+ class: "vc-time-input__clearable"
30
+ };
27
31
  const CLASS_FOR_COLOR = "vc-time-input-color--";
28
32
  const _sfc_main = /* @__PURE__ */ defineComponent({
29
33
  ...{
@@ -40,10 +44,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
40
44
  emptyDataText: { default: "" },
41
45
  placeholder: { default: "" },
42
46
  allowMouseWheel: { type: Boolean, default: false },
47
+ clearable: { type: Boolean, default: false },
43
48
  format: { default: "hh:mm:ss" },
44
49
  id: { default: void 0 },
45
50
  disabled: { type: Boolean, default: false },
46
- clearable: { type: Boolean },
47
51
  isError: { type: Boolean, default: false },
48
52
  emptyText: {},
49
53
  prefixIcon: {},
@@ -53,7 +57,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
53
57
  prefixIconColor: {},
54
58
  color: { default: DEFAULT_COLOR }
55
59
  },
56
- emits: ["input", "update:modelValue"],
60
+ emits: ["input", "update:modelValue", "clear"],
57
61
  setup(__props, { emit: __emit }) {
58
62
  const UNIT_OF = {
59
63
  hh: "hours",
@@ -61,6 +65,11 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
61
65
  ss: "seconds"
62
66
  };
63
67
  const vLongPress = { ...longPress };
68
+ const EMPTY_TIME = {
69
+ hours: "",
70
+ minutes: "",
71
+ seconds: ""
72
+ };
64
73
  const props = __props;
65
74
  const emit = __emit;
66
75
  const { maxWidthStyle, inputClasses } = useInputBase(props, {
@@ -78,21 +87,45 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
78
87
  const timeModel = computed(() => {
79
88
  return props.modelValue || 0;
80
89
  });
90
+ const isEmptyModel = computed(() => {
91
+ return props.clearable && (props.modelValue === void 0 || props.modelValue === null);
92
+ });
93
+ const shownModel = computed(() => {
94
+ return isEmptyModel.value ? void 0 : timeModel.value;
95
+ });
96
+ const isEmpty = computed(() => {
97
+ return props.clearable && !hasTime(timeSettingModel);
98
+ });
99
+ const showClear = computed(() => {
100
+ return !isEmpty.value && !props.disabled;
101
+ });
81
102
  const disabledDecreaseBtn = computed(() => {
103
+ if (isEmpty.value) {
104
+ return props.disabled;
105
+ }
82
106
  const _time = timeModel.value;
83
107
  return _time <= props.minValue || props.disabled;
84
108
  });
85
109
  const disabledIncreaseBtn = computed(() => {
110
+ if (isEmpty.value) {
111
+ return props.disabled;
112
+ }
86
113
  const _time = timeModel.value;
87
114
  return props.maxValue !== 0 && _time >= props.maxValue || props.disabled;
88
115
  });
89
116
  const hideInputs = computed(() => {
117
+ if (props.clearable) {
118
+ return !isFocus.value && isEmpty.value && !!(props.emptyDataText || props.placeholder);
119
+ }
90
120
  const _time = props.modelValue || timeModel.value;
91
121
  return !!(!isFocus.value && _time === 0 && props.emptyDataText);
92
122
  });
93
123
  const units = computed(() => props.format.split(":").map((part) => UNIT_OF[part]).filter((unit) => !!unit));
94
124
  const lastUnit = computed(() => units.value[units.value.length - 1] ?? "seconds");
95
125
  function clearHiddenUnits() {
126
+ if (props.clearable && units.value.every((unit) => timeSettingModel[unit] === "")) {
127
+ return;
128
+ }
96
129
  const order = ["hours", "minutes", "seconds"];
97
130
  order.slice(order.indexOf(lastUnit.value) + 1).forEach((unit) => {
98
131
  timeSettingModel[unit] = "00";
@@ -176,10 +209,64 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
176
209
  seconds: seconds2
177
210
  };
178
211
  }
212
+ function hasTime(time) {
213
+ return time.hours !== "" || time.minutes !== "" || time.seconds !== "";
214
+ }
215
+ function hasBlankPart(time) {
216
+ return time.hours === "" || time.minutes === "" || time.seconds === "";
217
+ }
218
+ function setEmptyTime() {
219
+ timeSettingModel.hours = EMPTY_TIME.hours;
220
+ timeSettingModel.minutes = EMPTY_TIME.minutes;
221
+ timeSettingModel.seconds = EMPTY_TIME.seconds;
222
+ }
223
+ function fillBlankParts() {
224
+ const zero = setFormatValue(0);
225
+ if (timeSettingModel.hours === "") {
226
+ timeSettingModel.hours = zero;
227
+ }
228
+ if (timeSettingModel.minutes === "") {
229
+ timeSettingModel.minutes = zero;
230
+ }
231
+ if (timeSettingModel.seconds === "") {
232
+ timeSettingModel.seconds = zero;
233
+ }
234
+ }
235
+ function normaliseTimePart(val, type) {
236
+ if (isEmpty.value) {
237
+ return;
238
+ }
239
+ timeSettingModel[type] = updateTimeInput(val, type);
240
+ if (props.clearable) {
241
+ fillBlankParts();
242
+ }
243
+ }
244
+ function clampTime(time) {
245
+ if (props.maxValue > 0 && time > props.maxValue) {
246
+ return props.maxValue;
247
+ }
248
+ return Math.max(time, props.minValue, 0);
249
+ }
250
+ function stepFromEmpty(delta) {
251
+ setTimeData(clampTime(delta));
252
+ }
253
+ function onClear() {
254
+ setEmptyTime();
255
+ emit("update:modelValue", void 0);
256
+ emit("input", {
257
+ seconds: void 0,
258
+ string: { ...EMPTY_TIME }
259
+ });
260
+ emit("clear");
261
+ }
179
262
  function decrease() {
180
263
  if (disabledDecreaseBtn.value) {
181
264
  return;
182
265
  }
266
+ if (isEmpty.value) {
267
+ stepFromEmpty(-props.step);
268
+ return;
269
+ }
183
270
  let _nevTime = timeModel.value - props.step;
184
271
  if (_nevTime <= 0) {
185
272
  _nevTime = 0;
@@ -192,6 +279,10 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
192
279
  if (disabledIncreaseBtn.value) {
193
280
  return;
194
281
  }
282
+ if (isEmpty.value) {
283
+ stepFromEmpty(props.step);
284
+ return;
285
+ }
195
286
  let _nevTime = timeModel.value + props.step;
196
287
  if (props.maxValue > 0 && _nevTime >= props.maxValue) {
197
288
  _nevTime = props.maxValue;
@@ -207,7 +298,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
207
298
  watch(
208
299
  () => timeSettingModel.seconds,
209
300
  (val) => {
210
- timeSettingModel.seconds = updateTimeInput(val, "seconds");
301
+ normaliseTimePart(val, "seconds");
211
302
  },
212
303
  {
213
304
  immediate: true
@@ -216,7 +307,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
216
307
  watch(
217
308
  () => timeSettingModel.minutes,
218
309
  (val) => {
219
- timeSettingModel.minutes = updateTimeInput(val, "minutes");
310
+ normaliseTimePart(val, "minutes");
220
311
  },
221
312
  {
222
313
  immediate: true
@@ -225,16 +316,18 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
225
316
  watch(
226
317
  () => timeSettingModel.hours,
227
318
  (val) => {
228
- timeSettingModel.hours = updateTimeInput(val, "hours");
319
+ normaliseTimePart(val, "hours");
229
320
  },
230
321
  {
231
322
  immediate: true
232
323
  }
233
324
  );
234
325
  watch(
235
- timeModel,
326
+ shownModel,
236
327
  (val) => {
237
- if (props.maxValue > 0 && val > props.maxValue) {
328
+ if (val === void 0) {
329
+ setEmptyTime();
330
+ } else if (props.maxValue > 0 && val > props.maxValue) {
238
331
  setTimeData(props.maxValue);
239
332
  } else if (val < props.minValue) {
240
333
  setTimeData(props.minValue);
@@ -247,6 +340,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
247
340
  watch(
248
341
  timeSettingModel,
249
342
  (val) => {
343
+ if (props.clearable && hasBlankPart(val)) {
344
+ return;
345
+ }
250
346
  const _seconds = getSecondsOfTime(val);
251
347
  emit("update:modelValue", _seconds);
252
348
  emit("input", {
@@ -257,6 +353,9 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
257
353
  { deep: true }
258
354
  );
259
355
  onMounted(() => {
356
+ if (isEmptyModel.value) {
357
+ return;
358
+ }
260
359
  if (timeModel.value < props.minValue) {
261
360
  const res = {
262
361
  seconds: props.minValue || 0,
@@ -377,6 +476,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
377
476
  ]) : createCommentVNode("", true)
378
477
  ], 32)
379
478
  ]),
479
+ __props.clearable ? (openBlock(), createElementBlock("div", _hoisted_10, [
480
+ showClear.value ? (openBlock(), createBlock(_sfc_main$1, {
481
+ key: 0,
482
+ icon: unref(X),
483
+ class: "icon-xs",
484
+ "data-test": "clear-button",
485
+ onClick: onClear
486
+ }, null, 8, ["icon"])) : createCommentVNode("", true)
487
+ ])) : createCommentVNode("", true),
380
488
  withDirectives((openBlock(), createElementBlock("div", {
381
489
  class: normalizeClass(["vc-time-input__btn-increase", {
382
490
  "is-disabled": disabledIncreaseBtn.value
Binary file
Binary file
Binary file