keli-ui 0.0.18 → 0.0.20

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/keli-ui.js CHANGED
@@ -38722,13 +38722,16 @@ const _sfc_main$l = /* @__PURE__ */ defineComponent({
38722
38722
  if (node.data) {
38723
38723
  componentValueMap.nodeValue = node.data.value;
38724
38724
  }
38725
- const response = await fetch(props.detail.optionHttpUrl, {
38725
+ const opt = {
38726
38726
  method: props.detail.optionHttpMethod,
38727
38727
  headers: {
38728
38728
  "Content-Type": "application/json"
38729
- },
38730
- body: JSON.stringify({ ...props.detail.optionHttpParams, ...componentValueMap })
38731
- });
38729
+ }
38730
+ };
38731
+ if (!["get", "GET", "post", "POST"].includes(props.detail.optionHttpMethod)) {
38732
+ opt.body = JSON.stringify({ ...props.detail.optionHttpParams, ...componentValueMap });
38733
+ }
38734
+ const response = await fetch(props.detail.optionHttpUrl, opt);
38732
38735
  let result = {
38733
38736
  code: -5,
38734
38737
  msg: "请求失败",
@@ -38815,17 +38818,20 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
38815
38818
  return;
38816
38819
  options2.loading = true;
38817
38820
  oldComponentValueMap = componentValueMap;
38818
- const response = await fetch(props.detail.optionHttpUrl, {
38821
+ const opt = {
38819
38822
  method: props.detail.optionHttpMethod,
38820
38823
  headers: {
38821
38824
  "Content-Type": "application/json"
38822
- },
38823
- body: JSON.stringify({
38825
+ }
38826
+ };
38827
+ if (!["get", "GET", "post", "POST"].includes(props.detail.optionHttpMethod)) {
38828
+ opt.body = JSON.stringify({
38824
38829
  ...props.detail.optionHttpParams,
38825
38830
  ...componentValueMap,
38826
38831
  prop: props.detail.field
38827
- })
38828
- });
38832
+ });
38833
+ }
38834
+ const response = await fetch(props.detail.optionHttpUrl, opt);
38829
38835
  let result = {
38830
38836
  code: -5,
38831
38837
  msg: "请求失败",
@@ -88528,7 +88534,7 @@ const useMittHook = (fieldName, mittId) => {
88528
88534
  };
88529
88535
  }
88530
88536
  const registerMitt = (func) => {
88531
- if (mittId) {
88537
+ if (mittId && emitter) {
88532
88538
  emitter.on(fieldName + mittId, (_eventData) => {
88533
88539
  if (func) {
88534
88540
  func(_eventData);
@@ -88537,7 +88543,7 @@ const useMittHook = (fieldName, mittId) => {
88537
88543
  }
88538
88544
  };
88539
88545
  const offMitt = () => {
88540
- if (mittId) {
88546
+ if (mittId && emitter) {
88541
88547
  emitter.off(fieldName + mittId);
88542
88548
  }
88543
88549
  };
@@ -88826,23 +88832,27 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
88826
88832
  required: false,
88827
88833
  type: Boolean
88828
88834
  },
88829
- // 数据
88830
- data: {
88831
- required: true,
88832
- default: () => {
88833
- return {};
88834
- },
88835
- type: Object
88836
- },
88837
88835
  // 页面基本配置
88838
88836
  config: {
88837
+ required: false,
88838
+ type: Object,
88839
+ default: () => {
88840
+ return {
88841
+ rowKey: "id",
88842
+ labelWidth: 100
88843
+ };
88844
+ }
88845
+ },
88846
+ // 数据
88847
+ formData: {
88839
88848
  required: true,
88840
88849
  type: Object
88841
88850
  },
88842
88851
  // 表单框架
88843
88852
  frame: {
88844
- required: true,
88845
- type: Array
88853
+ required: false,
88854
+ type: Array,
88855
+ default: () => []
88846
88856
  },
88847
88857
  // 表单验证规则
88848
88858
  formRules: {
@@ -88880,15 +88890,14 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
88880
88890
  type: Number
88881
88891
  },
88882
88892
  "pageIdModifiers": {},
88883
- "data": {
88884
- type: Object,
88885
- default: () => {
88886
- }
88893
+ "formData": {
88894
+ type: Object
88887
88895
  },
88888
- "dataModifiers": {},
88896
+ "formDataModifiers": {},
88889
88897
  "frame": {
88890
- required: true,
88891
- type: Array
88898
+ required: false,
88899
+ type: Array,
88900
+ default: () => []
88892
88901
  },
88893
88902
  "frameModifiers": {},
88894
88903
  "componentShowRule": {
@@ -88899,12 +88908,12 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
88899
88908
  },
88900
88909
  "componentShowRuleModifiers": {}
88901
88910
  }),
88902
- emits: ["update:pageId", "update:data", "update:frame", "update:componentShowRule"],
88911
+ emits: ["update:pageId", "update:formData", "update:frame", "update:componentShowRule"],
88903
88912
  setup(__props, { expose: __expose }) {
88904
88913
  const props = __props;
88905
88914
  const ruleFormRef = useTemplateRef("ruleFormRef");
88906
88915
  const pageIdRef = useModel(__props, "pageId");
88907
- const dataRef = useModel(__props, "data");
88916
+ const dataRef = useModel(__props, "formData");
88908
88917
  const frameRef = useModel(__props, "frame");
88909
88918
  const componentShowRuleModel = useModel(__props, "componentShowRule");
88910
88919
  const mittId = Math.floor(Math.random() * (99999 - 1e4 + 1)) + 1e4;
@@ -88927,7 +88936,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
88927
88936
  };
88928
88937
  const validateForm = async () => {
88929
88938
  if (props.formSaveVerifyJs !== null && props.formSaveVerifyJs !== void 0) {
88930
- const err = props.formSaveVerifyJs(props.data);
88939
+ const err = props.formSaveVerifyJs(dataRef.value);
88931
88940
  if (err) {
88932
88941
  msgTips.alert({
88933
88942
  msg: err,
@@ -89002,7 +89011,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
89002
89011
  ref: ruleFormRef,
89003
89012
  "label-position": __props.config.labelPosition ? __props.config.labelPosition : "right",
89004
89013
  "label-width": __props.config.labelWidth && __props.config.labelWidth > 0 ? __props.config.labelWidth : "auto",
89005
- model: __props.data,
89014
+ model: dataRef.value,
89006
89015
  rules: __props.formRules,
89007
89016
  style: normalizeStyle({
89008
89017
  height: props.embeddedTableList && props.embeddedTableList.length > 0 ? "60%" : "100%"
@@ -89172,7 +89181,7 @@ const _sfc_main$9 = /* @__PURE__ */ defineComponent({
89172
89181
  };
89173
89182
  }
89174
89183
  });
89175
- const FormRenderClient = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-25e7ca41"]]);
89184
+ const FormRenderClient = /* @__PURE__ */ _export_sfc(_sfc_main$9, [["__scopeId", "data-v-30b23a37"]]);
89176
89185
  const _hoisted_1 = { class: "van-doc-demo-block__title" };
89177
89186
  const _sfc_main$8 = /* @__PURE__ */ defineComponent({
89178
89187
  __name: "FormRenderMobile",
@@ -89182,22 +89191,26 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
89182
89191
  type: Boolean
89183
89192
  },
89184
89193
  // 数据
89185
- data: {
89194
+ formData: {
89186
89195
  required: true,
89187
- default: () => {
89188
- return {};
89189
- },
89190
89196
  type: Object
89191
89197
  },
89192
89198
  // 页面基本配置
89193
89199
  config: {
89194
- required: true,
89195
- type: Object
89200
+ required: false,
89201
+ type: Object,
89202
+ default: () => {
89203
+ return {
89204
+ rowKey: "id",
89205
+ labelWidth: 100
89206
+ };
89207
+ }
89196
89208
  },
89197
89209
  // 表单框架
89198
89210
  frame: {
89199
- required: true,
89200
- type: Array
89211
+ required: false,
89212
+ type: Array,
89213
+ default: () => []
89201
89214
  },
89202
89215
  // 表单验证规则
89203
89216
  formRules: {
@@ -89243,7 +89256,8 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
89243
89256
  "dataModifiers": {},
89244
89257
  "frame": {
89245
89258
  required: true,
89246
- type: Array
89259
+ type: Array,
89260
+ default: () => []
89247
89261
  },
89248
89262
  "frameModifiers": {},
89249
89263
  "componentShowRule": {
@@ -89411,7 +89425,7 @@ const _sfc_main$8 = /* @__PURE__ */ defineComponent({
89411
89425
  };
89412
89426
  }
89413
89427
  });
89414
- const FormRenderMobile = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-125f5b9a"]]);
89428
+ const FormRenderMobile = /* @__PURE__ */ _export_sfc(_sfc_main$8, [["__scopeId", "data-v-121f69cc"]]);
89415
89429
  const KeFormRender = isMobileDevice.value ? FormRenderMobile : FormRenderClient;
89416
89430
  KeFormRender.install = (app) => {
89417
89431
  app.component(KeFormRender.__name, KeFormRender);
@@ -89734,17 +89748,20 @@ const useSelectAsync = (params) => {
89734
89748
  }
89735
89749
  loading.value = true;
89736
89750
  oldComponentValueMap = componentValueMap;
89737
- const response = await fetch(props.detail.optionHttpUrl, {
89751
+ const opt = {
89738
89752
  method: props.detail.optionHttpMethod,
89739
89753
  headers: {
89740
89754
  "Content-Type": "application/json"
89741
- },
89742
- body: JSON.stringify({
89755
+ }
89756
+ };
89757
+ if (!["get", "GET", "post", "POST"].includes(props.detail.optionHttpMethod)) {
89758
+ opt.body = JSON.stringify({
89743
89759
  prop: props.detail.field,
89744
89760
  ...props.detail.optionHttpParams,
89745
89761
  ...componentValueMap
89746
- })
89747
- });
89762
+ });
89763
+ }
89764
+ const response = await fetch(props.detail.optionHttpUrl, opt);
89748
89765
  let result = {
89749
89766
  code: -5,
89750
89767
  data: {}
@@ -90083,17 +90100,20 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
90083
90100
  }
90084
90101
  );
90085
90102
  loading.value = true;
90086
- const response = await fetch(props.detail.optionHttpUrl, {
90103
+ const opt = {
90087
90104
  method: props.detail.optionHttpMethod,
90088
90105
  headers: {
90089
90106
  "Content-Type": "application/json"
90090
- },
90091
- body: JSON.stringify({
90107
+ }
90108
+ };
90109
+ if (!["get", "GET", "post", "POST"].includes(props.detail.optionHttpMethod)) {
90110
+ opt.body = JSON.stringify({
90092
90111
  ...props.detail.optionHttpParams,
90093
90112
  ...componentValueMap,
90094
90113
  searchValue: queryStr
90095
- })
90096
- });
90114
+ });
90115
+ }
90116
+ const response = await fetch(props.detail.optionHttpUrl, opt);
90097
90117
  let result = {
90098
90118
  code: -5,
90099
90119
  data: {}