knt-shared 1.8.3 → 1.8.5

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, createCommentVNode, createVNode, unref, createBlock, 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, isVNode, useSlots, Teleport, createApp } from "vue";
1
+ import { getCurrentInstance, inject, defineComponent, computed, createElementBlock, openBlock, normalizeStyle, normalizeClass, createElementVNode, useCssVars, createCommentVNode, createVNode, unref, createBlock, reactive, Fragment, renderList, withModifiers, ref, watch, onMounted, onUnmounted, withDirectives, vModelText, vShow, toDisplayString, withCtx, createTextVNode, nextTick, renderSlot, mergeProps, createSlots, onBeforeUnmount, toRef, normalizeProps, guardReactiveProps, h, resolveDynamicComponent, isVNode, useSlots, Teleport, createApp } from "vue";
2
2
  import ArcoVue, { Progress, Spin, Dropdown, Doption, Modal, Upload, Button, Image as Image$1, Message, Select, Cascader, Transfer, Mention, Rate, Slider, Switch, RangePicker, TimePicker, DatePicker, TreeSelect, CheckboxGroup, Checkbox, RadioGroup, Radio, AutoComplete, Textarea, InputPassword, InputNumber, Input, ImagePreviewGroup, Form, Row, Col, FormItem, Tooltip, Space, Divider, Popover, Table, Popconfirm, Link, Descriptions, DescriptionsItem } from "@arco-design/web-vue";
3
3
  const configProviderInjectionKey = Symbol("ArcoConfigProvider");
4
4
  const CLASS_PREFIX = "arco";
@@ -2303,12 +2303,24 @@ const _sfc_main$h = /* @__PURE__ */ defineComponent({
2303
2303
  },
2304
2304
  emits: ["dragstart", "dragend", "preview", "remove"],
2305
2305
  setup(__props, { emit: __emit }) {
2306
+ useCssVars((_ctx) => ({
2307
+ "v6adf0568": _ctx.cardSize + 10 + "px"
2308
+ }));
2306
2309
  const props = __props;
2307
2310
  const emit = __emit;
2308
2311
  const isVideoFile = (file) => {
2309
2312
  if (!file.url && !file.name) return false;
2310
2313
  const fileName = file.name || "";
2311
- const videoExtensions = [".mp4", ".avi", ".mov", ".wmv", ".flv", ".mkv", ".webm", ".m4v"];
2314
+ const videoExtensions = [
2315
+ ".mp4",
2316
+ ".avi",
2317
+ ".mov",
2318
+ ".wmv",
2319
+ ".flv",
2320
+ ".mkv",
2321
+ ".webm",
2322
+ ".m4v"
2323
+ ];
2312
2324
  return videoExtensions.some((ext) => fileName.toLowerCase().endsWith(ext));
2313
2325
  };
2314
2326
  const handleDragStart = (event) => {
@@ -2386,7 +2398,7 @@ const _export_sfc = (sfc, props) => {
2386
2398
  }
2387
2399
  return target;
2388
2400
  };
2389
- const SortableFileItem = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-17fb6dd9"]]);
2401
+ const SortableFileItem = /* @__PURE__ */ _export_sfc(_sfc_main$h, [["__scopeId", "data-v-c8377d24"]]);
2390
2402
  const _hoisted_1$b = { class: "sortable-file-list" };
2391
2403
  const _sfc_main$g = /* @__PURE__ */ defineComponent({
2392
2404
  ...{
@@ -9313,7 +9325,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9313
9325
  schema: {},
9314
9326
  data: {},
9315
9327
  helpMessageOptions: {},
9316
- labelAlign: { default: "left" },
9328
+ labelAlign: {},
9317
9329
  size: { default: "medium" },
9318
9330
  bordered: { type: Boolean, default: true },
9319
9331
  layout: { default: "horizontal" },
@@ -9324,7 +9336,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9324
9336
  extra: {},
9325
9337
  tableLayout: {},
9326
9338
  labelStyle: {},
9327
- valueStyle: {}
9339
+ valueStyle: {},
9340
+ showEmptyText: { type: Boolean, default: false },
9341
+ emptyText: { default: "-" }
9328
9342
  },
9329
9343
  emits: ["register"],
9330
9344
  setup(__props, { expose: __expose, emit: __emit }) {
@@ -9344,21 +9358,59 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9344
9358
  data: {
9345
9359
  type: Object,
9346
9360
  default: () => ({})
9361
+ },
9362
+ showEmptyText: {
9363
+ type: Boolean,
9364
+ default: false
9365
+ },
9366
+ emptyText: {
9367
+ type: String,
9368
+ default: "-"
9347
9369
  }
9348
9370
  },
9349
9371
  setup(props2) {
9350
9372
  return () => {
9351
9373
  const result = props2.render(props2.value, props2.data);
9352
- if (typeof result === "string" || typeof result === "number") {
9353
- return h("span", result);
9374
+ if (isEmptyValue(result)) {
9375
+ return props2.showEmptyText ? h("span", props2.emptyText) : null;
9376
+ }
9377
+ if (typeof result === "string" || typeof result === "number" || typeof result === "boolean") {
9378
+ return h("span", String(result));
9354
9379
  }
9355
9380
  return result;
9356
9381
  };
9357
9382
  }
9358
9383
  });
9384
+ const isEmptyValue = (value) => {
9385
+ return value === "" || value === null || value === void 0;
9386
+ };
9359
9387
  const getProps = computed(() => {
9360
9388
  return { ...props, ...unref(propsRef) };
9361
9389
  });
9390
+ const getDisplayValue = (value) => {
9391
+ const propsData = unref(getProps);
9392
+ if (isEmptyValue(value)) {
9393
+ return propsData.showEmptyText ? propsData.emptyText ?? "-" : "";
9394
+ }
9395
+ return value;
9396
+ };
9397
+ const getResolvedAlign = computed(() => {
9398
+ const propsData = unref(getProps);
9399
+ const { align, labelAlign } = propsData;
9400
+ if (!labelAlign) {
9401
+ return align;
9402
+ }
9403
+ if (align && typeof align === "object") {
9404
+ return {
9405
+ ...align,
9406
+ label: labelAlign
9407
+ };
9408
+ }
9409
+ return {
9410
+ label: labelAlign,
9411
+ value: align
9412
+ };
9413
+ });
9362
9414
  const getBindValue = computed(() => {
9363
9415
  const propsData = unref(getProps);
9364
9416
  return {
@@ -9366,9 +9418,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9366
9418
  size: propsData.size,
9367
9419
  bordered: propsData.bordered,
9368
9420
  layout: propsData.layout,
9369
- labelAlign: propsData.labelAlign,
9370
- align: propsData.align,
9371
- colon: propsData.colon,
9421
+ align: unref(getResolvedAlign),
9372
9422
  style: propsData.style,
9373
9423
  class: propsData.class,
9374
9424
  tableLayout: propsData.tableLayout,
@@ -9397,6 +9447,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9397
9447
  }
9398
9448
  return data[field];
9399
9449
  };
9450
+ const getLabelText = (label) => {
9451
+ const propsData = unref(getProps);
9452
+ if (!propsData.colon || /[::]\s*$/.test(label)) {
9453
+ return label;
9454
+ }
9455
+ return `${label}:`;
9456
+ };
9400
9457
  const getLabelStyle = (item) => {
9401
9458
  const style = { ...item.labelStyle };
9402
9459
  if (item.labelMinWidth) {
@@ -9478,7 +9535,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9478
9535
  label: withCtx(() => [
9479
9536
  createElementVNode("div", {
9480
9537
  style: normalizeStyle(getLabelStyle(item))
9481
- }, toDisplayString(item.label), 5)
9538
+ }, toDisplayString(getLabelText(item.label)), 5)
9482
9539
  ]),
9483
9540
  default: withCtx(() => [
9484
9541
  createElementVNode("div", {
@@ -9488,9 +9545,11 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9488
9545
  key: 0,
9489
9546
  render: item.render,
9490
9547
  value: getFieldValue(item.field),
9491
- data: getProps.value.data || {}
9492
- }, null, 8, ["render", "value", "data"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
9493
- createTextVNode(toDisplayString(getFieldValue(item.field)), 1)
9548
+ data: getProps.value.data || {},
9549
+ "show-empty-text": getProps.value.showEmptyText,
9550
+ "empty-text": getProps.value.emptyText || "-"
9551
+ }, null, 8, ["render", "value", "data", "show-empty-text", "empty-text"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
9552
+ createTextVNode(toDisplayString(getDisplayValue(getFieldValue(item.field))), 1)
9494
9553
  ], 64))
9495
9554
  ], 4)
9496
9555
  ]),
@@ -9504,7 +9563,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
9504
9563
  };
9505
9564
  }
9506
9565
  });
9507
- const BasicDescription = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-f93aecf8"]]);
9566
+ const BasicDescription = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-93ccbd39"]]);
9508
9567
  function useDescription(props) {
9509
9568
  const descriptionRef = ref(null);
9510
9569
  const loadedRef = ref(false);