@qin-ui/antd-vue-pro 1.1.12 → 1.1.14

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.
@@ -1,4 +1,4 @@
1
- import { inject, ref, h as h$1, getCurrentInstance, nextTick, reactive, defineComponent, createVNode, shallowRef, watch, unref, provide, watchEffect, onBeforeUnmount, computed, isRef, Fragment, Comment, Text, isVNode, onMounted, cloneVNode, Transition, withDirectives, resolveDirective, onUpdated, onUnmounted, toRef, withModifiers, vShow, onBeforeMount, Teleport, TransitionGroup, toRaw, resolveComponent, openBlock, createBlock, mergeProps, withCtx, createElementBlock, renderList, resolveDynamicComponent, normalizeProps, createSlots, createTextVNode, createCommentVNode, useAttrs, renderSlot, toDisplayString, shallowReactive } from "vue";
1
+ import { inject, ref, h as h$1, getCurrentInstance, nextTick, reactive, defineComponent, createVNode, shallowRef, watch, unref, provide, watchEffect, onBeforeUnmount, computed, isRef, Fragment, Comment, Text, isVNode, onMounted, cloneVNode, Transition, withDirectives, resolveDirective, onUpdated, onUnmounted, toRef, withModifiers, vShow, onBeforeMount, Teleport, TransitionGroup, toRaw, resolveComponent, openBlock, createBlock, mergeProps, withCtx, createElementBlock, renderList, resolveDynamicComponent, createSlots, createTextVNode, createCommentVNode, useAttrs, normalizeProps, renderSlot, toDisplayString, shallowReactive } from "vue";
2
2
  import { Input, Textarea, InputSearch, InputPassword, InputNumber, Select, Cascader, DatePicker as DatePicker$1, RangePicker, TimePicker as TimePicker$1, CheckboxGroup, RadioGroup, Switch, Slider, TreeSelect, Transfer, Row as Row$1, Col as Col$1, FormItem as FormItem$1, message, Form as Form$2 } from "ant-design-vue";
3
3
  import { INIT_PROPS_MAP, useInjectProps, INJECT_KEYS } from "../component-provider/index.js";
4
4
  var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
@@ -15744,15 +15744,15 @@ const UPDATE_ACTIVE_PATH = Symbol(
15744
15744
  "setActivePath"
15745
15745
  );
15746
15746
  const RULE_TYPE_MAP = /* @__PURE__ */ new Map([
15747
- ["value", "字段赋值"],
15748
- ["hidden", "字段隐藏/显示"],
15749
- ["disabled", "字段禁用/启用"],
15750
- ["options", "字段选项枚举变更"],
15751
- ["validateRule", "字段校验规则变更"],
15752
- ["fieldMergeOverrides", "字段配置变更"],
15753
- ["validate", "字段触发校验"],
15754
- ["clearValidate", "字段触发清除校验"],
15755
- ["message", "字段触发提示"]
15747
+ ["setValue", "字段赋值"],
15748
+ ["setHidden", "字段隐藏/显示"],
15749
+ ["setDisabled", "字段禁用/启用"],
15750
+ ["setOptions", "字段选项枚举变更"],
15751
+ ["setRules", "字段校验规则变更"],
15752
+ ["setField", "字段配置变更"],
15753
+ ["triggerValidate", "字段触发校验"],
15754
+ ["triggerClearValidate", "字段触发清除校验"],
15755
+ ["triggerMessage", "字段触发提示"]
15756
15756
  ]);
15757
15757
  const FunctionRegexp = /^\s*function\s*\w*\s*\([^)]*\)\s*{([\s\S]*)}/g;
15758
15758
  const ArrowFunctionRegexp = /^\s*(?:\([^)]*\)|\w+)\s*=>\s*\(?({[\s\S]*}|[^;]*)\)?/g;
@@ -15840,14 +15840,17 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
15840
15840
  return openBlock(), createElementBlock(Fragment, {
15841
15841
  key: getPath(field.key) || index2
15842
15842
  }, [
15843
- field && !field.hidden ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.grid ? unref(Col$1) : unref(_sfc_main$2)), normalizeProps(mergeProps({ key: 0 }, _ctx.grid ? unref(withDefaultGridItem)(field) : void 0)), {
15843
+ field && !field.hidden ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.grid ? unref(Col$1) : unref(_sfc_main$2)), mergeProps({
15844
+ key: 0,
15845
+ ref_for: true
15846
+ }, _ctx.grid ? unref(withDefaultGridItem)(field) : void 0), {
15844
15847
  default: withCtx(() => [
15845
15848
  createVNode(unref(_sfc_main$2), {
15846
15849
  component: field.container,
15847
15850
  path: getPath(field.key)
15848
15851
  }, {
15849
15852
  default: withCtx(() => [
15850
- createVNode(unref(FormItem$1), mergeProps(withDefault(field), {
15853
+ createVNode(unref(FormItem$1), mergeProps({ ref_for: true }, withDefault(field), {
15851
15854
  ref_for: true,
15852
15855
  ref: (el) => setFormItemRef(el, field),
15853
15856
  class: field.className,
@@ -15865,7 +15868,10 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
15865
15868
  disabled: field.disabled
15866
15869
  }, null, 8, ["grid", "fields", "path", "disabled"])) : !field.component ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
15867
15870
  createTextVNode(' missing "component" prop ')
15868
- ], 64)) : (openBlock(), createBlock(unref(BaseField), mergeProps({ key: 2 }, unref(omitFormItemProps)(field), {
15871
+ ], 64)) : (openBlock(), createBlock(unref(BaseField), mergeProps({
15872
+ key: 2,
15873
+ ref_for: true
15874
+ }, unref(omitFormItemProps)(field), {
15869
15875
  label: field.label,
15870
15876
  path: getPath(field.key)
15871
15877
  }), null, 16, ["label", "path"]))
@@ -15876,7 +15882,10 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
15876
15882
  return {
15877
15883
  name,
15878
15884
  fn: withCtx(() => [
15879
- unref(FORM_ITEM_SLOT_KEYS).includes(name) ? (openBlock(), createBlock(unref(_sfc_main$1), mergeProps({ key: 0 }, { path: getPath(field.key) }, { component: slot }), null, 16, ["component"])) : createCommentVNode("", true)
15885
+ unref(FORM_ITEM_SLOT_KEYS).includes(name) ? (openBlock(), createBlock(unref(_sfc_main$1), mergeProps({
15886
+ key: 0,
15887
+ ref_for: true
15888
+ }, { path: getPath(field.key) }, { component: slot }), null, 16, ["component"])) : createCommentVNode("", true)
15880
15889
  ])
15881
15890
  };
15882
15891
  })
@@ -16038,7 +16047,10 @@ const useFormData = (initFormData) => {
16038
16047
  };
16039
16048
  const useFormRef = () => {
16040
16049
  const formRef = ref();
16041
- return { formRef };
16050
+ const setFormRef = (val) => {
16051
+ formRef.value = val;
16052
+ };
16053
+ return { formRef, setFormRef };
16042
16054
  };
16043
16055
  const useForm = (initFormData = {}, initFields = []) => {
16044
16056
  return {
@@ -16193,21 +16205,21 @@ async function runRules(rules2, baseParam) {
16193
16205
  [`${path}`, ["gray"]]
16194
16206
  ]);
16195
16207
  switch (type4) {
16196
- case "value": {
16208
+ case "setValue": {
16197
16209
  form.setFormData(path, value);
16198
16210
  nextTick(() => run(path, "onUpdateValue"));
16199
16211
  break;
16200
16212
  }
16201
- case "hidden":
16202
- form.setField(path, (preField) => ({ ...preField, hidden: value }));
16213
+ case "setHidden":
16214
+ form.setField(path, { hidden: value });
16203
16215
  break;
16204
- case "disabled":
16205
- form.setField(path, (preField) => ({ ...preField, disabled: value }));
16216
+ case "setDisabled":
16217
+ form.setField(path, { disabled: value });
16206
16218
  break;
16207
- case "options":
16208
- form.setField(path, (preField) => ({ ...preField, options: value }));
16219
+ case "setOptions":
16220
+ form.setField(path, { options: value });
16209
16221
  break;
16210
- case "validateRule": {
16222
+ case "setRules": {
16211
16223
  const validateRule2 = [];
16212
16224
  for (let validateRuleIndex = 0; validateRuleIndex < value.length; validateRuleIndex += 1) {
16213
16225
  const validateRuleItem = value[validateRuleIndex];
@@ -16233,14 +16245,14 @@ async function runRules(rules2, baseParam) {
16233
16245
  form.setField(path, (preField) => ({ ...preField, rule: validateRule2 }));
16234
16246
  break;
16235
16247
  }
16236
- case "fieldMergeOverrides":
16248
+ case "setField":
16237
16249
  form.setField(path, (preField) => ({ ...preField, ...value }));
16238
16250
  break;
16239
- case "validate":
16251
+ case "triggerValidate":
16240
16252
  break;
16241
- case "clearValidate":
16253
+ case "triggerClearValidate":
16242
16254
  break;
16243
- case "message":
16255
+ case "triggerMessage":
16244
16256
  message2.info(value);
16245
16257
  break;
16246
16258
  default: {
@@ -16279,8 +16291,8 @@ const runCommands = async ({ path, trigger, ...baseParam }) => {
16279
16291
  ]);
16280
16292
  for (let logicIndex = 0; logicIndex < logics.length; logicIndex += 1) {
16281
16293
  const logic = logics[logicIndex];
16282
- const { conditions, rules: rules2 } = logic;
16283
- if (conditions.length === 0 || rules2.length === 0)
16294
+ const { conditions, actions } = logic;
16295
+ if (conditions.length === 0 || actions.length === 0)
16284
16296
  return;
16285
16297
  logQueue.push([
16286
16298
  [`逻辑${logicIndex + 1}:`, ["large", "purple"]],
@@ -16294,7 +16306,7 @@ const runCommands = async ({ path, trigger, ...baseParam }) => {
16294
16306
  return;
16295
16307
  const conditionsValid = await validateConditions(conditions, baseParam);
16296
16308
  if (conditionsValid) {
16297
- await runRules(rules2, baseParam);
16309
+ await runRules(actions, baseParam);
16298
16310
  }
16299
16311
  }
16300
16312
  logQueue.push([
@@ -16432,8 +16444,6 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
16432
16444
  const methods = { ...rewriteMethod("onUpdateValue") };
16433
16445
  switch (compType) {
16434
16446
  case "input":
16435
- Object.assign(methods, rewriteMethod("onBlur"), rewriteMethod("onFocus"));
16436
- break;
16437
16447
  case "input-number":
16438
16448
  Object.assign(methods, rewriteMethod("onBlur"), rewriteMethod("onFocus"));
16439
16449
  break;
@@ -16455,12 +16465,6 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
16455
16465
  return;
16456
16466
  updateRefs == null ? void 0 : updateRefs("fieldRefs", props.path, el);
16457
16467
  };
16458
- onMounted(() => {
16459
- var _a, _b, _c;
16460
- if (attrs.autoCommand && ((_b = (_a = attrs.autoCommand) == null ? void 0 : _a.onInit) == null ? void 0 : _b.length) > 0) {
16461
- (_c = command == null ? void 0 : command.value) == null ? void 0 : _c.run(props.path, "onInit");
16462
- }
16463
- });
16464
16468
  function handleFocus(...args) {
16465
16469
  var _a;
16466
16470
  updateActivePath == null ? void 0 : updateActivePath(props.path);
@@ -16499,7 +16503,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
16499
16503
  };
16500
16504
  }
16501
16505
  });
16502
- const index_vue_vue_type_style_index_0_scoped_9a3bf1a0_lang = "";
16506
+ const index_vue_vue_type_style_index_0_scoped_f87938bb_lang = "";
16503
16507
  const _export_sfc = (sfc, props) => {
16504
16508
  const target = sfc.__vccOpts || sfc;
16505
16509
  for (const [key, val] of props) {
@@ -16507,7 +16511,7 @@ const _export_sfc = (sfc, props) => {
16507
16511
  }
16508
16512
  return target;
16509
16513
  };
16510
- const BaseField = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-9a3bf1a0"]]);
16514
+ const BaseField = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-f87938bb"]]);
16511
16515
  const _sfc_main$2 = /* @__PURE__ */ defineComponent({
16512
16516
  ...{
16513
16517
  name: "ContainerFragment",
@@ -16609,14 +16613,17 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
16609
16613
  updateActivePath(path);
16610
16614
  };
16611
16615
  const command = computed(() => {
16612
- return props.form && !props.autoCommandDisabled ? useCommand({
16613
- refs: exposed.refs,
16614
- form: props.form
16615
- }) : null;
16616
+ return props.form && !props.autoCommandDisabled ? useCommand({ refs: exposed.refs, form: props.form }) : null;
16616
16617
  });
16617
16618
  const formInstanceRef = ref(null);
16618
16619
  onMounted(() => {
16620
+ var _a;
16619
16621
  Object.assign(exposed, formInstanceRef.value);
16622
+ if (props.form) {
16623
+ if (props.form.setFormRef && !((_a = props.form.formRef) == null ? void 0 : _a.value)) {
16624
+ props.form.setFormRef(exposed);
16625
+ }
16626
+ }
16620
16627
  });
16621
16628
  provide(FORM_DATA, _formData);
16622
16629
  provide(UPDATE_FORM_DATA, updateFormData);
package/es/form/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { l, B, d, i, C, b, f, F, k, G, R, e, j, U, h, _, m, p, n, s, q, u, r, t } from "./index-b2d126ee.js";
1
+ import { l, B, d, i, C, b, f, F, k, G, R, e, j, U, h, _, m, p, n, s, q, u, r, t } from "./index-297bff03.js";
2
2
  import "vue";
3
3
  import "ant-design-vue";
4
4
  import "../component-provider/index.js";