knt-shared 1.5.2 → 1.5.4

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.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { getCurrentInstance, inject, defineComponent, computed, createElementBlock, openBlock, normalizeStyle, normalizeClass, createElementVNode, resolveComponent, createCommentVNode, createVNode, createBlock, unref, reactive, Fragment, renderList, withModifiers, ref, watch, onMounted, onUnmounted, withDirectives, vModelText, vShow, toDisplayString, withCtx, createTextVNode, useCssVars, nextTick, mergeProps, createSlots, renderSlot, onBeforeUnmount, toRef, normalizeProps, guardReactiveProps, h, resolveDynamicComponent, useSlots } from "vue";
1
+ import { getCurrentInstance, inject, defineComponent, computed, createElementBlock, openBlock, normalizeStyle, normalizeClass, createElementVNode, resolveComponent, createCommentVNode, createVNode, createBlock, unref, reactive, Fragment, renderList, withModifiers, ref, watch, onMounted, onUnmounted, withDirectives, vModelText, vShow, toDisplayString, withCtx, createTextVNode, useCssVars, nextTick, renderSlot, mergeProps, createSlots, onBeforeUnmount, toRef, normalizeProps, guardReactiveProps, h, resolveDynamicComponent, useSlots } from "vue";
2
2
  import { Message, Transfer, Mention, Upload, Rate, Slider, Switch, RangePicker, TimePicker, DatePicker, TreeSelect, Cascader, CheckboxGroup, Checkbox, RadioGroup, Radio, Select, AutoComplete, Textarea, InputPassword, InputNumber, Input, ImagePreviewGroup, Image, Modal } from "@arco-design/web-vue";
3
3
  const configProviderInjectionKey = Symbol("ArcoConfigProvider");
4
4
  const CLASS_PREFIX = "arco";
@@ -1585,7 +1585,7 @@ const _hoisted_4$3 = {
1585
1585
  const _hoisted_5$3 = { class: "progress-bar" };
1586
1586
  const _hoisted_6$2 = { class: "controls-bottom" };
1587
1587
  const _hoisted_7$2 = { class: "controls-left" };
1588
- const _hoisted_8 = { class: "volume-slider-container" };
1588
+ const _hoisted_8$1 = { class: "volume-slider-container" };
1589
1589
  const _hoisted_9 = { class: "time-display" };
1590
1590
  const _hoisted_10 = { class: "controls-right" };
1591
1591
  const _hoisted_11 = { class: "control-button" };
@@ -1876,7 +1876,7 @@ const _sfc_main$b = /* @__PURE__ */ defineComponent({
1876
1876
  size: 20
1877
1877
  }))
1878
1878
  ]),
1879
- withDirectives(createElementVNode("div", _hoisted_8, [
1879
+ withDirectives(createElementVNode("div", _hoisted_8$1, [
1880
1880
  withDirectives(createElementVNode("input", {
1881
1881
  "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => volume.value = $event),
1882
1882
  type: "range",
@@ -2017,24 +2017,28 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
2017
2017
  const VideoPreviewModal = /* @__PURE__ */ _export_sfc(_sfc_main$a, [["__scopeId", "data-v-0ae4ec5c"]]);
2018
2018
  const _hoisted_1$5 = { class: "basic-upload" };
2019
2019
  const _hoisted_2$4 = {
2020
+ key: 0,
2021
+ class: "upload-empty-state"
2022
+ };
2023
+ const _hoisted_3$2 = {
2020
2024
  key: 0,
2021
2025
  class: "upload-text"
2022
2026
  };
2023
- const _hoisted_3$2 = { class: "upload-tip" };
2024
- const _hoisted_4$2 = {
2025
- key: 1,
2027
+ const _hoisted_4$2 = { class: "upload-tip" };
2028
+ const _hoisted_5$2 = {
2029
+ key: 2,
2026
2030
  class: "sortable-upload-container"
2027
2031
  };
2028
- const _hoisted_5$2 = {
2032
+ const _hoisted_6$1 = {
2029
2033
  key: 0,
2030
2034
  class: "upload-text"
2031
2035
  };
2032
- const _hoisted_6$1 = {
2036
+ const _hoisted_7$1 = {
2033
2037
  key: 1,
2034
2038
  class: "upload-tip sortable-tip"
2035
2039
  };
2036
- const _hoisted_7$1 = {
2037
- key: 4,
2040
+ const _hoisted_8 = {
2041
+ key: 5,
2038
2042
  class: "inline-video-preview"
2039
2043
  };
2040
2044
  const _sfc_main$9 = /* @__PURE__ */ defineComponent({
@@ -2091,12 +2095,14 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2091
2095
  muted: false,
2092
2096
  controls: true,
2093
2097
  preload: "metadata"
2094
- }) }
2098
+ }) },
2099
+ emptyText: { default: "-" },
2100
+ showEmptyState: { type: Boolean, default: true }
2095
2101
  },
2096
2102
  emits: ["register", "update:modelValue", "change", "success", "handleSuccess", "error", "handlError", "progress", "remove", "preview", "exceed", "sortChange"],
2097
2103
  setup(__props, { expose: __expose, emit: __emit }) {
2098
2104
  useCssVars((_ctx) => ({
2099
- "v51ea86e4": cardSizeValue.value
2105
+ "v0ec95933": cardSizeValue.value
2100
2106
  }));
2101
2107
  const props = __props;
2102
2108
  const emit = __emit;
@@ -2126,6 +2132,10 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2126
2132
  }
2127
2133
  return false;
2128
2134
  });
2135
+ const shouldShowEmptyState = computed(() => {
2136
+ const propsData = unref(getProps);
2137
+ return propsData.showEmptyState && (propsData.disabled || propsData.readonly) && fileListRef.value.length === 0;
2138
+ });
2129
2139
  const cardSizeValue = computed(() => {
2130
2140
  return `${getProps.value.cardSize || 80}px`;
2131
2141
  });
@@ -2565,8 +2575,12 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2565
2575
  const _component_a_upload = resolveComponent("a-upload");
2566
2576
  const _component_a_image = resolveComponent("a-image");
2567
2577
  return openBlock(), createElementBlock("div", _hoisted_1$5, [
2568
- !shouldUseSortable.value ? (openBlock(), createBlock(_component_a_upload, mergeProps({
2569
- key: 0,
2578
+ shouldShowEmptyState.value ? (openBlock(), createElementBlock("div", _hoisted_2$4, [
2579
+ renderSlot(_ctx.$slots, "empty", {}, () => [
2580
+ createTextVNode(toDisplayString(getProps.value.emptyText), 1)
2581
+ ], true)
2582
+ ])) : !shouldUseSortable.value ? (openBlock(), createBlock(_component_a_upload, mergeProps({
2583
+ key: 1,
2570
2584
  ref_key: "uploadRef",
2571
2585
  ref: uploadRef
2572
2586
  }, getBindValue.value, {
@@ -2590,7 +2604,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2590
2604
  })
2591
2605
  }, [
2592
2606
  createVNode(unref(IconPlus), { size: 16 }),
2593
- getProps.value.uploadButtonText ? (openBlock(), createElementBlock("div", _hoisted_2$4, toDisplayString(getProps.value.uploadButtonText), 1)) : createCommentVNode("", true)
2607
+ getProps.value.uploadButtonText ? (openBlock(), createElementBlock("div", _hoisted_3$2, toDisplayString(getProps.value.uploadButtonText), 1)) : createCommentVNode("", true)
2594
2608
  ], 4)) : (openBlock(), createBlock(_component_a_button, {
2595
2609
  key: 1,
2596
2610
  type: getProps.value.uploadButtonType || "primary"
@@ -2618,7 +2632,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2618
2632
  name: "tip",
2619
2633
  fn: withCtx(() => [
2620
2634
  renderSlot(_ctx.$slots, "tip", {}, () => [
2621
- createElementVNode("div", _hoisted_3$2, toDisplayString(getProps.value.tip), 1)
2635
+ createElementVNode("div", _hoisted_4$2, toDisplayString(getProps.value.tip), 1)
2622
2636
  ], true)
2623
2637
  ]),
2624
2638
  key: "2"
@@ -2630,7 +2644,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2630
2644
  ]),
2631
2645
  key: "3"
2632
2646
  } : void 0
2633
- ]), 1040, ["file-list"])) : (openBlock(), createElementBlock("div", _hoisted_4$2, [
2647
+ ]), 1040, ["file-list"])) : (openBlock(), createElementBlock("div", _hoisted_5$2, [
2634
2648
  fileListRef.value.length > 0 ? (openBlock(), createBlock(SortableFileList, {
2635
2649
  key: 0,
2636
2650
  "file-list": fileListRef.value,
@@ -2664,17 +2678,17 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2664
2678
  })
2665
2679
  }, [
2666
2680
  createVNode(unref(IconPlus), { size: 16 }),
2667
- getProps.value.uploadButtonText ? (openBlock(), createElementBlock("div", _hoisted_5$2, toDisplayString(getProps.value.uploadButtonText), 1)) : createCommentVNode("", true)
2681
+ getProps.value.uploadButtonText ? (openBlock(), createElementBlock("div", _hoisted_6$1, toDisplayString(getProps.value.uploadButtonText), 1)) : createCommentVNode("", true)
2668
2682
  ], 4)
2669
2683
  ], true)
2670
2684
  ]),
2671
2685
  key: "0"
2672
2686
  } : void 0
2673
2687
  ]), 1040, ["file-list"]),
2674
- getProps.value.tip ? (openBlock(), createElementBlock("div", _hoisted_6$1, toDisplayString(getProps.value.tip), 1)) : createCommentVNode("", true)
2688
+ getProps.value.tip ? (openBlock(), createElementBlock("div", _hoisted_7$1, toDisplayString(getProps.value.tip), 1)) : createCommentVNode("", true)
2675
2689
  ])),
2676
2690
  previewImageUrl.value ? (openBlock(), createBlock(_component_a_image, {
2677
- key: 2,
2691
+ key: 3,
2678
2692
  src: previewImageUrl.value,
2679
2693
  "preview-visible": previewVisible.value,
2680
2694
  "preview-props": { closable: true },
@@ -2682,14 +2696,14 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2682
2696
  onPreviewVisibleChange: _cache[0] || (_cache[0] = (visible) => previewVisible.value = visible)
2683
2697
  }, null, 8, ["src", "preview-visible"])) : createCommentVNode("", true),
2684
2698
  getProps.value.videoPreviewMode === "modal" || !getProps.value.videoPreviewMode ? (openBlock(), createBlock(VideoPreviewModal, {
2685
- key: 3,
2699
+ key: 4,
2686
2700
  visible: previewVideoVisible.value,
2687
2701
  "onUpdate:visible": _cache[1] || (_cache[1] = ($event) => previewVideoVisible.value = $event),
2688
2702
  "video-url": previewVideoUrl.value,
2689
2703
  "file-name": previewFileName.value,
2690
2704
  "player-options": getProps.value.videoPlayerOptions
2691
2705
  }, null, 8, ["visible", "video-url", "file-name", "player-options"])) : createCommentVNode("", true),
2692
- getProps.value.videoPreviewMode === "inline" && previewVideoVisible.value ? (openBlock(), createElementBlock("div", _hoisted_7$1, [
2706
+ getProps.value.videoPreviewMode === "inline" && previewVideoVisible.value ? (openBlock(), createElementBlock("div", _hoisted_8, [
2693
2707
  createVNode(VideoPreview, {
2694
2708
  "video-url": previewVideoUrl.value,
2695
2709
  "player-options": getProps.value.videoPlayerOptions
@@ -2708,7 +2722,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
2708
2722
  };
2709
2723
  }
2710
2724
  });
2711
- const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-6291bab5"]]);
2725
+ const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-9a01fb0b"]]);
2712
2726
  function useUpload(props) {
2713
2727
  const uploadRef = ref(null);
2714
2728
  const fileListRef = ref((props == null ? void 0 : props.defaultFileList) || []);
@@ -8665,6 +8679,44 @@ function arrayToMap(array, options) {
8665
8679
  });
8666
8680
  return map;
8667
8681
  }
8682
+ function transformTree(tree, transform, options) {
8683
+ if (!tree || !Array.isArray(tree) || tree.length === 0) {
8684
+ return [];
8685
+ }
8686
+ const { childrenField = "children" } = options || {};
8687
+ function transformNodes(nodes, level = 0, parent = null, parentPath = [], ancestors = []) {
8688
+ return nodes.map((node, index) => {
8689
+ const currentPath = [...parentPath, index];
8690
+ const children = node[childrenField];
8691
+ const hasChildren = children && Array.isArray(children) && children.length > 0;
8692
+ const context = {
8693
+ level,
8694
+ index,
8695
+ parent,
8696
+ path: currentPath,
8697
+ ancestors,
8698
+ isLeaf: !hasChildren
8699
+ };
8700
+ const transformedNode = transform(node, context);
8701
+ if (hasChildren) {
8702
+ const newAncestors = [...ancestors, node];
8703
+ const transformedChildren = transformNodes(
8704
+ children,
8705
+ level + 1,
8706
+ node,
8707
+ currentPath,
8708
+ newAncestors
8709
+ );
8710
+ return {
8711
+ ...transformedNode,
8712
+ [childrenField]: transformedChildren
8713
+ };
8714
+ }
8715
+ return transformedNode;
8716
+ });
8717
+ }
8718
+ return transformNodes(tree);
8719
+ }
8668
8720
  function isNullOrUnDef(value) {
8669
8721
  return value === null || value === void 0;
8670
8722
  }
@@ -8855,6 +8907,7 @@ export {
8855
8907
  throttle,
8856
8908
  transFormUrlPath,
8857
8909
  transformBackUrl,
8910
+ transformTree,
8858
8911
  transformUploadUrl,
8859
8912
  useApiRequest,
8860
8913
  useDebounce,