knt-shared 1.2.3 → 1.2.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, ref, unref, watch, onMounted, nextTick, resolveComponent, createVNode, mergeProps, createSlots, withCtx, renderSlot, createBlock, createCommentVNode, toDisplayString, createTextVNode, reactive, onBeforeUnmount, normalizeProps, guardReactiveProps, Fragment, renderList, resolveDynamicComponent, withDirectives, vShow, withModifiers, h, onUnmounted } from "vue";
1
+ import { getCurrentInstance, inject, defineComponent, computed, createElementBlock, openBlock, normalizeStyle, normalizeClass, createElementVNode, useCssVars, ref, unref, watch, onMounted, nextTick, resolveComponent, createVNode, mergeProps, createSlots, withCtx, renderSlot, createBlock, createCommentVNode, toDisplayString, createTextVNode, reactive, onBeforeUnmount, normalizeProps, guardReactiveProps, Fragment, renderList, resolveDynamicComponent, withDirectives, vShow, withModifiers, h, onUnmounted } 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 } from "@arco-design/web-vue";
3
3
  const configProviderInjectionKey = Symbol("ArcoConfigProvider");
4
4
  const CLASS_PREFIX = "arco";
@@ -708,6 +708,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
708
708
  },
709
709
  emits: ["register", "update:modelValue", "change", "success", "handleSuccess", "error", "handlError", "progress", "remove", "preview", "exceed"],
710
710
  setup(__props, { expose: __expose, emit: __emit }) {
711
+ useCssVars((_ctx) => ({
712
+ "v439946ba": cardSizeValue.value
713
+ }));
711
714
  const props = __props;
712
715
  const emit = __emit;
713
716
  const uploadRef = ref();
@@ -727,6 +730,9 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
727
730
  }
728
731
  return false;
729
732
  });
733
+ const cardSizeValue = computed(() => {
734
+ return `${getProps.value.cardSize || 80}px`;
735
+ });
730
736
  const getBindValue = computed(() => {
731
737
  const propsData = unref(getProps);
732
738
  return {
@@ -1118,8 +1124,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
1118
1124
  key: 0,
1119
1125
  class: "upload-card-button",
1120
1126
  style: normalizeStyle({
1121
- width: `${getProps.value.cardSize || 80}px`,
1122
- height: `${getProps.value.cardSize || 80}px`
1127
+ width: cardSizeValue.value,
1128
+ height: cardSizeValue.value
1123
1129
  })
1124
1130
  }, [
1125
1131
  createVNode(unref(IconPlus), { size: 16 }),
@@ -1175,7 +1181,7 @@ const _export_sfc = (sfc, props) => {
1175
1181
  }
1176
1182
  return target;
1177
1183
  };
1178
- const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-1a5a7ff7"]]);
1184
+ const BasicUpload = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__scopeId", "data-v-c83c45f0"]]);
1179
1185
  const componentMap = {
1180
1186
  Input,
1181
1187
  InputNumber,
@@ -1236,6 +1242,15 @@ function getPlaceholder(component, label) {
1236
1242
  }
1237
1243
  return "";
1238
1244
  }
1245
+ function getRules(component, label) {
1246
+ if (componentsNeedPlaceholder.has(component)) {
1247
+ return [{ required: true, message: `请输入${label}` }];
1248
+ }
1249
+ if (componentsNeedSelectPlaceholder.has(component)) {
1250
+ return [{ required: true, message: `请选择${label}` }];
1251
+ }
1252
+ return [];
1253
+ }
1239
1254
  const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1240
1255
  ...{
1241
1256
  name: "BasicForm",
@@ -1338,12 +1353,17 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
1338
1353
  if (schema.disabled !== void 0) {
1339
1354
  disabled = typeof schema.disabled === "boolean" ? schema.disabled : schema.disabled(formModel);
1340
1355
  }
1356
+ let rules = schema.rules;
1357
+ if (schema.required && (!rules || rules.length === 0)) {
1358
+ const componentType = typeof schema.component === "string" ? schema.component : "";
1359
+ rules = getRules(componentType, schema.label);
1360
+ }
1341
1361
  return {
1342
1362
  field: schema.field,
1343
1363
  label: schema.label,
1344
1364
  labelColProps: schema.labelColProps || propsData.labelColProps,
1345
1365
  wrapperColProps: schema.wrapperColProps || propsData.wrapperColProps,
1346
- rules: schema.rules,
1366
+ rules,
1347
1367
  disabled,
1348
1368
  help: schema.help,
1349
1369
  extra: schema.extra,
@@ -1647,7 +1667,6 @@ function useForm(options = {}) {
1647
1667
  () => formInstance.formRef.value,
1648
1668
  (val) => {
1649
1669
  if (val === null) {
1650
- console.log("表单组件已卸载,重置 useForm 状态");
1651
1670
  formRef.value = null;
1652
1671
  loadedRef.value = false;
1653
1672
  if (unwatchFormRef) {
@@ -1679,7 +1698,6 @@ function useForm(options = {}) {
1679
1698
  const form = unref(formRef);
1680
1699
  if (!form) return null;
1681
1700
  if (((_a = form.formRef) == null ? void 0 : _a.value) === null) {
1682
- console.log("检测到失效的表单实例,清理引用");
1683
1701
  formRef.value = null;
1684
1702
  loadedRef.value = false;
1685
1703
  return null;
@@ -3381,7 +3399,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3381
3399
  footer: { type: Boolean, default: true },
3382
3400
  titleAlign: { default: "center" },
3383
3401
  height: {},
3384
- minHeight: { default: 60 },
3402
+ minHeight: { default: 46 },
3385
3403
  useWrapper: { type: Boolean, default: true },
3386
3404
  wrapperFooterOffset: { default: 0 },
3387
3405
  canFullscreen: { type: Boolean, default: false },
@@ -3459,10 +3477,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3459
3477
  const spinStyle = computed(() => {
3460
3478
  const propsData = unref(getProps);
3461
3479
  const style = {
3462
- minHeight: propsData.minHeight ? typeof propsData.minHeight === "number" ? `${propsData.minHeight}px` : propsData.minHeight : "200px",
3463
- pointerEvents: "none"
3464
- // 禁用所有交互
3480
+ minHeight: propsData.minHeight ? typeof propsData.minHeight === "number" ? `${propsData.minHeight}px` : propsData.minHeight : "46px"
3465
3481
  };
3482
+ if (propsData.loading) {
3483
+ style.pointerEvents = "none";
3484
+ }
3466
3485
  return style;
3467
3486
  });
3468
3487
  const getCancelButtonProps = computed(() => {
@@ -3610,10 +3629,9 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3610
3629
  onCancel: handleCancel
3611
3630
  }), createSlots({
3612
3631
  default: withCtx(() => [
3613
- getProps.value.loading ? (openBlock(), createBlock(_component_a_spin, {
3614
- key: 0,
3632
+ createVNode(_component_a_spin, {
3633
+ loading: getProps.value.loading,
3615
3634
  tip: getProps.value.loadingTip,
3616
- loading: true,
3617
3635
  style: normalizeStyle(spinStyle.value),
3618
3636
  class: "w-full"
3619
3637
  }, {
@@ -3627,15 +3645,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3627
3645
  ], 4)) : renderSlot(_ctx.$slots, "default", { key: 1 }, void 0, true)
3628
3646
  ]),
3629
3647
  _: 3
3630
- }, 8, ["tip", "style"])) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
3631
- getProps.value.useWrapper ? (openBlock(), createElementBlock("div", {
3632
- key: 0,
3633
- style: normalizeStyle(wrapperStyle.value),
3634
- class: "modal-wrapper"
3635
- }, [
3636
- renderSlot(_ctx.$slots, "default", {}, void 0, true)
3637
- ], 4)) : renderSlot(_ctx.$slots, "default", { key: 1 }, void 0, true)
3638
- ], 64))
3648
+ }, 8, ["loading", "tip", "style"])
3639
3649
  ]),
3640
3650
  _: 2
3641
3651
  }, [
@@ -3749,7 +3759,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
3749
3759
  };
3750
3760
  }
3751
3761
  });
3752
- const BasicModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-4117f967"]]);
3762
+ const BasicModal = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__scopeId", "data-v-860bd3ac"]]);
3753
3763
  function useModal(props) {
3754
3764
  const modalRef = ref(null);
3755
3765
  const loadedRef = ref(false);