bm-admin-ui 1.0.55-alpha → 1.0.56-alpha

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.
Files changed (35) hide show
  1. package/es/components/button/index.d.ts +1 -1
  2. package/es/components/button/src/button.vue.d.ts +1 -1
  3. package/es/components/editor/index.d.ts +1 -1
  4. package/es/components/editor/src/editor.vue.d.ts +1 -1
  5. package/es/components/form-create/index.js +45 -61
  6. package/es/components/form-designer/index.js +4 -0
  7. package/es/components/search-filter/index.d.ts +1 -1
  8. package/es/components/search-filter/src/search-filter.vue.d.ts +1 -1
  9. package/es/components/select-all/index.d.ts +1 -1
  10. package/es/components/select-all/src/selectAll.vue.d.ts +1 -1
  11. package/es/components/staffs-selector/index.d.ts +1 -1
  12. package/es/components/staffs-selector/src/staffs-selector.vue.d.ts +1 -1
  13. package/lib/components/button/index.d.ts +1 -1
  14. package/lib/components/button/src/button.vue.d.ts +1 -1
  15. package/lib/components/editor/index.d.ts +1 -1
  16. package/lib/components/editor/src/editor.vue.d.ts +1 -1
  17. package/lib/components/form-create/index.js +44 -60
  18. package/lib/components/form-designer/index.js +4 -0
  19. package/lib/components/search-filter/index.d.ts +1 -1
  20. package/lib/components/search-filter/src/search-filter.vue.d.ts +1 -1
  21. package/lib/components/select-all/index.d.ts +1 -1
  22. package/lib/components/select-all/src/selectAll.vue.d.ts +1 -1
  23. package/lib/components/staffs-selector/index.d.ts +1 -1
  24. package/lib/components/staffs-selector/src/staffs-selector.vue.d.ts +1 -1
  25. package/package.json +1 -1
  26. package/types/components/button/index.d.ts +1 -1
  27. package/types/components/button/src/button.vue.d.ts +1 -1
  28. package/types/components/editor/index.d.ts +1 -1
  29. package/types/components/editor/src/editor.vue.d.ts +1 -1
  30. package/types/components/search-filter/index.d.ts +1 -1
  31. package/types/components/search-filter/src/search-filter.vue.d.ts +1 -1
  32. package/types/components/select-all/index.d.ts +1 -1
  33. package/types/components/select-all/src/selectAll.vue.d.ts +1 -1
  34. package/types/components/staffs-selector/index.d.ts +1 -1
  35. package/types/components/staffs-selector/src/staffs-selector.vue.d.ts +1 -1
@@ -78,7 +78,7 @@ declare const BmButton: import("bm-admin-ui/es/utils/with-install").SFCWithInsta
78
78
  onMousedown: {
79
79
  type: import("vue").PropType<(event: MouseEvent) => void>;
80
80
  };
81
- }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "htmlType" | "loading" | "disabled" | "ghost" | "block" | "danger">;
81
+ }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "disabled" | "loading" | "htmlType" | "ghost" | "block" | "danger">;
82
82
  $attrs: {
83
83
  [x: string]: unknown;
84
84
  };
@@ -80,7 +80,7 @@ declare const _default: import("vue").DefineComponent<{
80
80
  onMousedown: {
81
81
  type: import("vue").PropType<(event: MouseEvent) => void>;
82
82
  };
83
- }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "htmlType" | "loading" | "disabled" | "ghost" | "block" | "danger">;
83
+ }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "disabled" | "loading" | "htmlType" | "ghost" | "block" | "danger">;
84
84
  $attrs: {
85
85
  [x: string]: unknown;
86
86
  };
@@ -294,8 +294,8 @@ declare const BmEditor: import("bm-admin-ui/es/utils/with-install").SFCWithInsta
294
294
  onReady?: ((...args: any[]) => any) | undefined;
295
295
  onGetCount?: ((...args: any[]) => any) | undefined;
296
296
  }, {
297
- disabled: boolean;
298
297
  value: string;
298
+ disabled: boolean;
299
299
  options: {
300
300
  [key: string]: any;
301
301
  };
@@ -294,8 +294,8 @@ declare const _default: import("vue").DefineComponent<{
294
294
  onReady?: ((...args: any[]) => any) | undefined;
295
295
  onGetCount?: ((...args: any[]) => any) | undefined;
296
296
  }, {
297
- disabled: boolean;
298
297
  value: string;
298
+ disabled: boolean;
299
299
  options: {
300
300
  [key: string]: any;
301
301
  };
@@ -6,7 +6,7 @@ import Picture from 'bm-admin-ui/es/components/upload';
6
6
  import BmStaffsSelector from 'bm-admin-ui/es/components/staffs-selector';
7
7
  import { BmTagsDisplay, BmFloatTable } from 'bm-admin-ui/es/components';
8
8
  import { SearchOutlined, CheckCircleFilled, PlusOutlined } from '@ant-design/icons-vue';
9
- import { cloneDeep, floor, debounce } from 'lodash-es';
9
+ import { debounce, cloneDeep, floor } from 'lodash-es';
10
10
  import customParseFormat from 'dayjs/plugin/customParseFormat';
11
11
  import { isNull } from 'bm-admin-ui/es/utils/isNull';
12
12
 
@@ -1354,6 +1354,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1354
1354
  );
1355
1355
  const productInputSlots = reactive([]);
1356
1356
  const formData = computed(() => props.formCreateInject.api.bind());
1357
+ const queryProductInfoDebounce = debounce(handlePressEnter, 300);
1357
1358
  function isShow(key) {
1358
1359
  return props.rule.config.tableAdvancedFeatures.includes(key);
1359
1360
  }
@@ -1437,7 +1438,7 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1437
1438
  default({ row }) {
1438
1439
  if (item.value === "\u5546\u54C1\u56FE\u7247" && row[childField]) {
1439
1440
  return h("img", {
1440
- src: "/cloudStorage/read/read?p=" + row[childField],
1441
+ src: props.extraConfig.common.previewImg(row[childField]),
1441
1442
  style: {
1442
1443
  width: "86px",
1443
1444
  height: "86px",
@@ -1670,6 +1671,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1670
1671
  }
1671
1672
  });
1672
1673
  }
1674
+ function handleProductInputChange(rule, row) {
1675
+ queryProductInfoDebounce(rule, row);
1676
+ }
1673
1677
  watch(
1674
1678
  () => props.rule,
1675
1679
  () => {
@@ -1791,8 +1795,9 @@ const _sfc_main$7 = /* @__PURE__ */ defineComponent({
1791
1795
  "onUpdate:value": ($event) => row[item.field] = $event,
1792
1796
  placeholder: "\u8BF7\u8F93\u5165",
1793
1797
  disabled: item.disabled || pruductInputDisabled(item.config?.dataFiltering),
1794
- onPressEnter: ($event) => handlePressEnter(item, row)
1795
- }, null, 8, ["value", "onUpdate:value", "disabled", "onPressEnter"])
1798
+ onPressEnter: ($event) => handlePressEnter(item, row),
1799
+ onChange: ($event) => handleProductInputChange(item, row)
1800
+ }, null, 8, ["value", "onUpdate:value", "disabled", "onPressEnter", "onChange"])
1796
1801
  ])
1797
1802
  };
1798
1803
  })
@@ -2410,16 +2415,27 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2410
2415
  };
2411
2416
  const unitMap = ["\u652F", "\u74F6", "\u5957", "\u7EC4", "\u7BB1", "\u4E2A", "\u5F20"];
2412
2417
  const formData = computed(() => props.formCreateInject.api.bind());
2418
+ const debounceFn = debounce(handleBlur, 300);
2419
+ const inputValue = ref(props.defalutValue);
2413
2420
  async function fetch(value) {
2414
- productInfo.value = await props.extraConfig.product.fetch({
2421
+ return productInfo.value = await props.extraConfig.product.fetch({
2415
2422
  productCode: value,
2416
2423
  filterByShopcode: props.dataFiltering
2417
2424
  }) || {};
2418
2425
  }
2419
2426
  function handleBlur(evt) {
2420
2427
  const value = evt.target.value;
2421
- emitChange(value);
2422
- fetch(value);
2428
+ fetch(value).then((result) => {
2429
+ if (Object.keys(result).length) {
2430
+ emitChange(value);
2431
+ } else {
2432
+ emitChange();
2433
+ inputValue.value = "";
2434
+ }
2435
+ });
2436
+ }
2437
+ function handleChange(evt) {
2438
+ debounceFn(evt);
2423
2439
  }
2424
2440
  function getValue(value) {
2425
2441
  return productInfo.value[productInfoKeyMap[value]];
@@ -2460,10 +2476,12 @@ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
2460
2476
  createVNode(unref(Col), { flex: 1 }, {
2461
2477
  default: withCtx(() => [
2462
2478
  createVNode(unref(Input), {
2479
+ value: inputValue.value,
2480
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event),
2463
2481
  placeholder: "\u8BF7\u8F93\u5165",
2464
- value: __props.defalutValue,
2465
2482
  disabled: __props.disabled || inputDisbale(__props.dataFiltering),
2466
- onPressEnter: handleBlur
2483
+ onPressEnter: handleBlur,
2484
+ onChange: handleChange
2467
2485
  }, null, 8, ["value", "disabled"])
2468
2486
  ]),
2469
2487
  _: 1
@@ -2740,45 +2758,27 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2740
2758
  const props = __props;
2741
2759
  const options = ref([]);
2742
2760
  function initOptions() {
2743
- props.config.fetch({ level: 1, relationCode: "" }).then((result) => {
2744
- result.forEach((item) => {
2745
- item.isLeaf = props.format === 1;
2746
- });
2761
+ props.config.fetch().then((result) => {
2762
+ processOptions(result, 1);
2747
2763
  options.value = result;
2748
- return options.value;
2749
- }).then((options2) => {
2750
- if (props.value?.length) {
2751
- if (props.multiple) {
2752
- props.value.forEach((item) => loadValueOptions(item, options2));
2753
- } else {
2754
- loadValueOptions(props.value, options2);
2755
- }
2756
- }
2757
2764
  });
2758
2765
  }
2759
- async function loadData(selectedOptions) {
2760
- const optionLength = selectedOptions.length;
2761
- const targetOption = selectedOptions[optionLength - 1];
2762
- targetOption.loading = true;
2763
- return await props.config.fetch({
2764
- level: optionLength + 1,
2765
- relationCode: targetOption.value
2766
- }).then((result) => {
2767
- result.forEach((item) => {
2768
- item.isLeaf = props.format === optionLength + 1;
2769
- });
2770
- if (result.length) {
2771
- targetOption.children = result;
2772
- } else {
2773
- targetOption.isLeaf = true;
2766
+ function processOptions(options2, level) {
2767
+ options2.forEach((option) => {
2768
+ option.value = option[props.config.fieldNames.value];
2769
+ option.label = option[props.config.fieldNames.label];
2770
+ option.children = option[props.config.fieldNames.children];
2771
+ if (level === props.format) {
2772
+ delete option.children;
2773
+ }
2774
+ if (option.children?.length) {
2775
+ processOptions(option.children, level + 1);
2774
2776
  }
2775
- }).finally(() => {
2776
- targetOption.loading = false;
2777
2777
  });
2778
2778
  }
2779
2779
  function handleChange(value, selectedOptions) {
2780
2780
  const result = cloneDeep(selectedOptions);
2781
- processValue(result);
2781
+ result && processValue(result);
2782
2782
  emits("change", result);
2783
2783
  }
2784
2784
  function processValue(selectedOptions) {
@@ -2804,23 +2804,6 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2804
2804
  return pre;
2805
2805
  }, []);
2806
2806
  }
2807
- async function loadValueOptions(value, options2) {
2808
- const selectedOptions = [];
2809
- for (const option of value) {
2810
- let cur;
2811
- if (selectedOptions.length) {
2812
- cur = selectedOptions[selectedOptions.length - 1].children.find(
2813
- (item) => item.value === option.value
2814
- );
2815
- } else {
2816
- cur = options2.find((item) => item.value === option.value);
2817
- }
2818
- if (!cur.isLeaf) {
2819
- selectedOptions.push(cur);
2820
- await loadData(selectedOptions);
2821
- }
2822
- }
2823
- }
2824
2807
  initOptions();
2825
2808
  return (_ctx, _cache) => {
2826
2809
  return openBlock(), createBlock(unref(Cascader), {
@@ -2828,7 +2811,6 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
2828
2811
  placeholder: "\u8BF7\u8F93\u5165",
2829
2812
  multiple: __props.multiple,
2830
2813
  options: options.value,
2831
- "load-data": loadData,
2832
2814
  "change-on-select": "",
2833
2815
  "get-popup-container": unref(getContainer),
2834
2816
  onChange: handleChange
@@ -2867,6 +2849,7 @@ var materialType = {
2867
2849
  const rule = inject.self;
2868
2850
  rule.value = list;
2869
2851
  rule.props.value = list;
2852
+ inject.api.emit('value-change', inject.api.bind());
2870
2853
  nextTick(() => {
2871
2854
  setTimeout(() => {
2872
2855
  inject.api.validateField(rule.field);
@@ -2904,6 +2887,7 @@ var materialType = {
2904
2887
  const rule = inject.self;
2905
2888
  rule.value = list;
2906
2889
  rule.props.value = list;
2890
+ inject.api.emit('value-change', inject.api.bind());
2907
2891
  nextTick(() => {
2908
2892
  setTimeout(() => {
2909
2893
  inject.api.validateField(rule.field);
@@ -3123,7 +3107,7 @@ var table = {
3123
3107
  change(inject, value) {
3124
3108
  const rule = inject.self;
3125
3109
  rule.value = value;
3126
- inject.api.emit('table-change', inject.api.bind());
3110
+ inject.api.emit('value-change', inject.api.bind());
3127
3111
  },
3128
3112
  },
3129
3113
  validate: [
@@ -3149,7 +3133,7 @@ var table = {
3149
3133
  on: {
3150
3134
  change(inject, value) {
3151
3135
  inject.self.value = value;
3152
- inject.api.emit('table-change', inject.api.bind());
3136
+ inject.api.emit('value-change', inject.api.bind());
3153
3137
  },
3154
3138
  },
3155
3139
  validate: [
@@ -3481,7 +3465,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
3481
3465
  option,
3482
3466
  rule: rule.value,
3483
3467
  "onUpdate:modelValue": handleValue,
3484
- onTableChange: handleValue
3468
+ onValueChange: handleValue
3485
3469
  }, null, 8, ["api", "model-value", "rule"])
3486
3470
  ], 64);
3487
3471
  };
@@ -1264,6 +1264,9 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
1264
1264
  dateValue.value = date;
1265
1265
  emitChange(date);
1266
1266
  }
1267
+ function getPopupContainer() {
1268
+ return document.body;
1269
+ }
1267
1270
  watch(format, () => {
1268
1271
  handleDateChange("");
1269
1272
  });
@@ -1309,6 +1312,7 @@ const _sfc_main$d = /* @__PURE__ */ defineComponent({
1309
1312
  picker: unref(extraProps).picker,
1310
1313
  "show-time": unref(extraProps).showTime,
1311
1314
  placeholder: "\u8BF7\u9009\u62E9",
1315
+ "get-popup-container": getPopupContainer,
1312
1316
  onChange: handleDateChange
1313
1317
  }, null, 8, ["value", "format", "value-format", "picker", "show-time"])) : createCommentVNode("v-if", true)
1314
1318
  ]),
@@ -217,9 +217,9 @@ declare const BmSearchFilter: import("bm-admin-ui/es/utils/with-install").SFCWit
217
217
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
218
218
  onExpand?: ((...args: any[]) => any) | undefined;
219
219
  }, {
220
- loading: boolean;
221
220
  labelCol: Record<string, any>;
222
221
  value: Record<string, any>;
222
+ loading: boolean;
223
223
  showExpandBtn: boolean;
224
224
  showSearchIcon: boolean;
225
225
  expandPlacement: "left" | "right";
@@ -217,9 +217,9 @@ declare const _default: import("vue").DefineComponent<{
217
217
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
218
218
  onExpand?: ((...args: any[]) => any) | undefined;
219
219
  }, {
220
- loading: boolean;
221
220
  labelCol: Record<string, any>;
222
221
  value: Record<string, any>;
222
+ loading: boolean;
223
223
  showExpandBtn: boolean;
224
224
  showSearchIcon: boolean;
225
225
  expandPlacement: "left" | "right";
@@ -210,7 +210,7 @@ declare const BmSelectAll: import("bm-admin-ui/es/utils/with-install").SFCWithIn
210
210
  type: BooleanConstructor;
211
211
  default: any;
212
212
  };
213
- }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "loading" | "disabled" | "bordered" | "choiceTransitionName" | "open" | "virtual" | "dropdownMatchSelectWidth" | "autofocus" | "showSearch" | "defaultOpen" | "allowClear" | "showArrow" | "autoClearSearchValue" | "filterOption" | "defaultActiveFirstOption" | "labelInValue">;
213
+ }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "bordered" | "choiceTransitionName" | "open" | "disabled" | "virtual" | "dropdownMatchSelectWidth" | "autofocus" | "loading" | "showSearch" | "defaultOpen" | "allowClear" | "showArrow" | "autoClearSearchValue" | "filterOption" | "defaultActiveFirstOption" | "labelInValue">;
214
214
  $attrs: {
215
215
  [x: string]: unknown;
216
216
  };
@@ -210,7 +210,7 @@ declare const _default: import("vue").DefineComponent<{
210
210
  type: BooleanConstructor;
211
211
  default: any;
212
212
  };
213
- }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "loading" | "disabled" | "bordered" | "choiceTransitionName" | "open" | "virtual" | "dropdownMatchSelectWidth" | "autofocus" | "showSearch" | "defaultOpen" | "allowClear" | "showArrow" | "autoClearSearchValue" | "filterOption" | "defaultActiveFirstOption" | "labelInValue">;
213
+ }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "bordered" | "choiceTransitionName" | "open" | "disabled" | "virtual" | "dropdownMatchSelectWidth" | "autofocus" | "loading" | "showSearch" | "defaultOpen" | "allowClear" | "showArrow" | "autoClearSearchValue" | "filterOption" | "defaultActiveFirstOption" | "labelInValue">;
214
214
  $attrs: {
215
215
  [x: string]: unknown;
216
216
  };
@@ -1084,9 +1084,9 @@ declare const BmStaffsSelector: import("bm-admin-ui/es/utils/with-install").SFCW
1084
1084
  "onUpdate:visible"?: ((...args: any[]) => any) | undefined;
1085
1085
  "onUpdate:select"?: ((...args: any[]) => any) | undefined;
1086
1086
  }, {
1087
- title: string;
1088
1087
  mode: string;
1089
1088
  showCount: boolean;
1089
+ title: string;
1090
1090
  visible: boolean;
1091
1091
  unitStr: string;
1092
1092
  limit: number;
@@ -1084,9 +1084,9 @@ declare const _default: import("vue").DefineComponent<{
1084
1084
  "onUpdate:visible"?: ((...args: any[]) => any) | undefined;
1085
1085
  "onUpdate:select"?: ((...args: any[]) => any) | undefined;
1086
1086
  }, {
1087
- title: string;
1088
1087
  mode: string;
1089
1088
  showCount: boolean;
1089
+ title: string;
1090
1090
  visible: boolean;
1091
1091
  unitStr: string;
1092
1092
  limit: number;
@@ -78,7 +78,7 @@ declare const BmButton: import("bm-admin-ui/es/utils/with-install").SFCWithInsta
78
78
  onMousedown: {
79
79
  type: import("vue").PropType<(event: MouseEvent) => void>;
80
80
  };
81
- }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "htmlType" | "loading" | "disabled" | "ghost" | "block" | "danger">;
81
+ }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "disabled" | "loading" | "htmlType" | "ghost" | "block" | "danger">;
82
82
  $attrs: {
83
83
  [x: string]: unknown;
84
84
  };
@@ -80,7 +80,7 @@ declare const _default: import("vue").DefineComponent<{
80
80
  onMousedown: {
81
81
  type: import("vue").PropType<(event: MouseEvent) => void>;
82
82
  };
83
- }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "htmlType" | "loading" | "disabled" | "ghost" | "block" | "danger">;
83
+ }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "disabled" | "loading" | "htmlType" | "ghost" | "block" | "danger">;
84
84
  $attrs: {
85
85
  [x: string]: unknown;
86
86
  };
@@ -294,8 +294,8 @@ declare const BmEditor: import("bm-admin-ui/es/utils/with-install").SFCWithInsta
294
294
  onReady?: ((...args: any[]) => any) | undefined;
295
295
  onGetCount?: ((...args: any[]) => any) | undefined;
296
296
  }, {
297
- disabled: boolean;
298
297
  value: string;
298
+ disabled: boolean;
299
299
  options: {
300
300
  [key: string]: any;
301
301
  };
@@ -294,8 +294,8 @@ declare const _default: import("vue").DefineComponent<{
294
294
  onReady?: ((...args: any[]) => any) | undefined;
295
295
  onGetCount?: ((...args: any[]) => any) | undefined;
296
296
  }, {
297
- disabled: boolean;
298
297
  value: string;
298
+ disabled: boolean;
299
299
  options: {
300
300
  [key: string]: any;
301
301
  };
@@ -1365,6 +1365,7 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1365
1365
  );
1366
1366
  const productInputSlots = vue.reactive([]);
1367
1367
  const formData = vue.computed(() => props.formCreateInject.api.bind());
1368
+ const queryProductInfoDebounce = lodashEs.debounce(handlePressEnter, 300);
1368
1369
  function isShow(key) {
1369
1370
  return props.rule.config.tableAdvancedFeatures.includes(key);
1370
1371
  }
@@ -1448,7 +1449,7 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1448
1449
  default({ row }) {
1449
1450
  if (item.value === "\u5546\u54C1\u56FE\u7247" && row[childField]) {
1450
1451
  return vue.h("img", {
1451
- src: "/cloudStorage/read/read?p=" + row[childField],
1452
+ src: props.extraConfig.common.previewImg(row[childField]),
1452
1453
  style: {
1453
1454
  width: "86px",
1454
1455
  height: "86px",
@@ -1681,6 +1682,9 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1681
1682
  }
1682
1683
  });
1683
1684
  }
1685
+ function handleProductInputChange(rule, row) {
1686
+ queryProductInfoDebounce(rule, row);
1687
+ }
1684
1688
  vue.watch(
1685
1689
  () => props.rule,
1686
1690
  () => {
@@ -1802,8 +1806,9 @@ const _sfc_main$7 = /* @__PURE__ */ vue.defineComponent({
1802
1806
  "onUpdate:value": ($event) => row[item.field] = $event,
1803
1807
  placeholder: "\u8BF7\u8F93\u5165",
1804
1808
  disabled: item.disabled || pruductInputDisabled(item.config?.dataFiltering),
1805
- onPressEnter: ($event) => handlePressEnter(item, row)
1806
- }, null, 8, ["value", "onUpdate:value", "disabled", "onPressEnter"])
1809
+ onPressEnter: ($event) => handlePressEnter(item, row),
1810
+ onChange: ($event) => handleProductInputChange(item, row)
1811
+ }, null, 8, ["value", "onUpdate:value", "disabled", "onPressEnter", "onChange"])
1807
1812
  ])
1808
1813
  };
1809
1814
  })
@@ -2421,16 +2426,27 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
2421
2426
  };
2422
2427
  const unitMap = ["\u652F", "\u74F6", "\u5957", "\u7EC4", "\u7BB1", "\u4E2A", "\u5F20"];
2423
2428
  const formData = vue.computed(() => props.formCreateInject.api.bind());
2429
+ const debounceFn = lodashEs.debounce(handleBlur, 300);
2430
+ const inputValue = vue.ref(props.defalutValue);
2424
2431
  async function fetch(value) {
2425
- productInfo.value = await props.extraConfig.product.fetch({
2432
+ return productInfo.value = await props.extraConfig.product.fetch({
2426
2433
  productCode: value,
2427
2434
  filterByShopcode: props.dataFiltering
2428
2435
  }) || {};
2429
2436
  }
2430
2437
  function handleBlur(evt) {
2431
2438
  const value = evt.target.value;
2432
- emitChange(value);
2433
- fetch(value);
2439
+ fetch(value).then((result) => {
2440
+ if (Object.keys(result).length) {
2441
+ emitChange(value);
2442
+ } else {
2443
+ emitChange();
2444
+ inputValue.value = "";
2445
+ }
2446
+ });
2447
+ }
2448
+ function handleChange(evt) {
2449
+ debounceFn(evt);
2434
2450
  }
2435
2451
  function getValue(value) {
2436
2452
  return productInfo.value[productInfoKeyMap[value]];
@@ -2471,10 +2487,12 @@ const _sfc_main$5 = /* @__PURE__ */ vue.defineComponent({
2471
2487
  vue.createVNode(vue.unref(antDesignVue.Col), { flex: 1 }, {
2472
2488
  default: vue.withCtx(() => [
2473
2489
  vue.createVNode(vue.unref(antDesignVue.Input), {
2490
+ value: inputValue.value,
2491
+ "onUpdate:value": _cache[0] || (_cache[0] = ($event) => inputValue.value = $event),
2474
2492
  placeholder: "\u8BF7\u8F93\u5165",
2475
- value: __props.defalutValue,
2476
2493
  disabled: __props.disabled || inputDisbale(__props.dataFiltering),
2477
- onPressEnter: handleBlur
2494
+ onPressEnter: handleBlur,
2495
+ onChange: handleChange
2478
2496
  }, null, 8, ["value", "disabled"])
2479
2497
  ]),
2480
2498
  _: 1
@@ -2751,45 +2769,27 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
2751
2769
  const props = __props;
2752
2770
  const options = vue.ref([]);
2753
2771
  function initOptions() {
2754
- props.config.fetch({ level: 1, relationCode: "" }).then((result) => {
2755
- result.forEach((item) => {
2756
- item.isLeaf = props.format === 1;
2757
- });
2772
+ props.config.fetch().then((result) => {
2773
+ processOptions(result, 1);
2758
2774
  options.value = result;
2759
- return options.value;
2760
- }).then((options2) => {
2761
- if (props.value?.length) {
2762
- if (props.multiple) {
2763
- props.value.forEach((item) => loadValueOptions(item, options2));
2764
- } else {
2765
- loadValueOptions(props.value, options2);
2766
- }
2767
- }
2768
2775
  });
2769
2776
  }
2770
- async function loadData(selectedOptions) {
2771
- const optionLength = selectedOptions.length;
2772
- const targetOption = selectedOptions[optionLength - 1];
2773
- targetOption.loading = true;
2774
- return await props.config.fetch({
2775
- level: optionLength + 1,
2776
- relationCode: targetOption.value
2777
- }).then((result) => {
2778
- result.forEach((item) => {
2779
- item.isLeaf = props.format === optionLength + 1;
2780
- });
2781
- if (result.length) {
2782
- targetOption.children = result;
2783
- } else {
2784
- targetOption.isLeaf = true;
2777
+ function processOptions(options2, level) {
2778
+ options2.forEach((option) => {
2779
+ option.value = option[props.config.fieldNames.value];
2780
+ option.label = option[props.config.fieldNames.label];
2781
+ option.children = option[props.config.fieldNames.children];
2782
+ if (level === props.format) {
2783
+ delete option.children;
2784
+ }
2785
+ if (option.children?.length) {
2786
+ processOptions(option.children, level + 1);
2785
2787
  }
2786
- }).finally(() => {
2787
- targetOption.loading = false;
2788
2788
  });
2789
2789
  }
2790
2790
  function handleChange(value, selectedOptions) {
2791
2791
  const result = lodashEs.cloneDeep(selectedOptions);
2792
- processValue(result);
2792
+ result && processValue(result);
2793
2793
  emits("change", result);
2794
2794
  }
2795
2795
  function processValue(selectedOptions) {
@@ -2815,23 +2815,6 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
2815
2815
  return pre;
2816
2816
  }, []);
2817
2817
  }
2818
- async function loadValueOptions(value, options2) {
2819
- const selectedOptions = [];
2820
- for (const option of value) {
2821
- let cur;
2822
- if (selectedOptions.length) {
2823
- cur = selectedOptions[selectedOptions.length - 1].children.find(
2824
- (item) => item.value === option.value
2825
- );
2826
- } else {
2827
- cur = options2.find((item) => item.value === option.value);
2828
- }
2829
- if (!cur.isLeaf) {
2830
- selectedOptions.push(cur);
2831
- await loadData(selectedOptions);
2832
- }
2833
- }
2834
- }
2835
2818
  initOptions();
2836
2819
  return (_ctx, _cache) => {
2837
2820
  return vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.Cascader), {
@@ -2839,7 +2822,6 @@ const _sfc_main$3 = /* @__PURE__ */ vue.defineComponent({
2839
2822
  placeholder: "\u8BF7\u8F93\u5165",
2840
2823
  multiple: __props.multiple,
2841
2824
  options: options.value,
2842
- "load-data": loadData,
2843
2825
  "change-on-select": "",
2844
2826
  "get-popup-container": vue.unref(getContainer),
2845
2827
  onChange: handleChange
@@ -2878,6 +2860,7 @@ var materialType = {
2878
2860
  const rule = inject.self;
2879
2861
  rule.value = list;
2880
2862
  rule.props.value = list;
2863
+ inject.api.emit('value-change', inject.api.bind());
2881
2864
  vue.nextTick(() => {
2882
2865
  setTimeout(() => {
2883
2866
  inject.api.validateField(rule.field);
@@ -2915,6 +2898,7 @@ var materialType = {
2915
2898
  const rule = inject.self;
2916
2899
  rule.value = list;
2917
2900
  rule.props.value = list;
2901
+ inject.api.emit('value-change', inject.api.bind());
2918
2902
  vue.nextTick(() => {
2919
2903
  setTimeout(() => {
2920
2904
  inject.api.validateField(rule.field);
@@ -3134,7 +3118,7 @@ var table = {
3134
3118
  change(inject, value) {
3135
3119
  const rule = inject.self;
3136
3120
  rule.value = value;
3137
- inject.api.emit('table-change', inject.api.bind());
3121
+ inject.api.emit('value-change', inject.api.bind());
3138
3122
  },
3139
3123
  },
3140
3124
  validate: [
@@ -3160,7 +3144,7 @@ var table = {
3160
3144
  on: {
3161
3145
  change(inject, value) {
3162
3146
  inject.self.value = value;
3163
- inject.api.emit('table-change', inject.api.bind());
3147
+ inject.api.emit('value-change', inject.api.bind());
3164
3148
  },
3165
3149
  },
3166
3150
  validate: [
@@ -3492,7 +3476,7 @@ const _sfc_main = /* @__PURE__ */ vue.defineComponent({
3492
3476
  option,
3493
3477
  rule: rule.value,
3494
3478
  "onUpdate:modelValue": handleValue,
3495
- onTableChange: handleValue
3479
+ onValueChange: handleValue
3496
3480
  }, null, 8, ["api", "model-value", "rule"])
3497
3481
  ], 64);
3498
3482
  };
@@ -1274,6 +1274,9 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
1274
1274
  dateValue.value = date;
1275
1275
  emitChange(date);
1276
1276
  }
1277
+ function getPopupContainer() {
1278
+ return document.body;
1279
+ }
1277
1280
  vue.watch(format, () => {
1278
1281
  handleDateChange("");
1279
1282
  });
@@ -1319,6 +1322,7 @@ const _sfc_main$d = /* @__PURE__ */ vue.defineComponent({
1319
1322
  picker: vue.unref(extraProps).picker,
1320
1323
  "show-time": vue.unref(extraProps).showTime,
1321
1324
  placeholder: "\u8BF7\u9009\u62E9",
1325
+ "get-popup-container": getPopupContainer,
1322
1326
  onChange: handleDateChange
1323
1327
  }, null, 8, ["value", "format", "value-format", "picker", "show-time"])) : vue.createCommentVNode("v-if", true)
1324
1328
  ]),
@@ -217,9 +217,9 @@ declare const BmSearchFilter: import("bm-admin-ui/es/utils/with-install").SFCWit
217
217
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
218
218
  onExpand?: ((...args: any[]) => any) | undefined;
219
219
  }, {
220
- loading: boolean;
221
220
  labelCol: Record<string, any>;
222
221
  value: Record<string, any>;
222
+ loading: boolean;
223
223
  showExpandBtn: boolean;
224
224
  showSearchIcon: boolean;
225
225
  expandPlacement: "left" | "right";
@@ -217,9 +217,9 @@ declare const _default: import("vue").DefineComponent<{
217
217
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
218
218
  onExpand?: ((...args: any[]) => any) | undefined;
219
219
  }, {
220
- loading: boolean;
221
220
  labelCol: Record<string, any>;
222
221
  value: Record<string, any>;
222
+ loading: boolean;
223
223
  showExpandBtn: boolean;
224
224
  showSearchIcon: boolean;
225
225
  expandPlacement: "left" | "right";
@@ -210,7 +210,7 @@ declare const BmSelectAll: import("bm-admin-ui/es/utils/with-install").SFCWithIn
210
210
  type: BooleanConstructor;
211
211
  default: any;
212
212
  };
213
- }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "loading" | "disabled" | "bordered" | "choiceTransitionName" | "open" | "virtual" | "dropdownMatchSelectWidth" | "autofocus" | "showSearch" | "defaultOpen" | "allowClear" | "showArrow" | "autoClearSearchValue" | "filterOption" | "defaultActiveFirstOption" | "labelInValue">;
213
+ }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "bordered" | "choiceTransitionName" | "open" | "disabled" | "virtual" | "dropdownMatchSelectWidth" | "autofocus" | "loading" | "showSearch" | "defaultOpen" | "allowClear" | "showArrow" | "autoClearSearchValue" | "filterOption" | "defaultActiveFirstOption" | "labelInValue">;
214
214
  $attrs: {
215
215
  [x: string]: unknown;
216
216
  };
@@ -210,7 +210,7 @@ declare const _default: import("vue").DefineComponent<{
210
210
  type: BooleanConstructor;
211
211
  default: any;
212
212
  };
213
- }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "loading" | "disabled" | "bordered" | "choiceTransitionName" | "open" | "virtual" | "dropdownMatchSelectWidth" | "autofocus" | "showSearch" | "defaultOpen" | "allowClear" | "showArrow" | "autoClearSearchValue" | "filterOption" | "defaultActiveFirstOption" | "labelInValue">;
213
+ }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "bordered" | "choiceTransitionName" | "open" | "disabled" | "virtual" | "dropdownMatchSelectWidth" | "autofocus" | "loading" | "showSearch" | "defaultOpen" | "allowClear" | "showArrow" | "autoClearSearchValue" | "filterOption" | "defaultActiveFirstOption" | "labelInValue">;
214
214
  $attrs: {
215
215
  [x: string]: unknown;
216
216
  };
@@ -1084,9 +1084,9 @@ declare const BmStaffsSelector: import("bm-admin-ui/es/utils/with-install").SFCW
1084
1084
  "onUpdate:visible"?: ((...args: any[]) => any) | undefined;
1085
1085
  "onUpdate:select"?: ((...args: any[]) => any) | undefined;
1086
1086
  }, {
1087
- title: string;
1088
1087
  mode: string;
1089
1088
  showCount: boolean;
1089
+ title: string;
1090
1090
  visible: boolean;
1091
1091
  unitStr: string;
1092
1092
  limit: number;
@@ -1084,9 +1084,9 @@ declare const _default: import("vue").DefineComponent<{
1084
1084
  "onUpdate:visible"?: ((...args: any[]) => any) | undefined;
1085
1085
  "onUpdate:select"?: ((...args: any[]) => any) | undefined;
1086
1086
  }, {
1087
- title: string;
1088
1087
  mode: string;
1089
1088
  showCount: boolean;
1089
+ title: string;
1090
1090
  visible: boolean;
1091
1091
  unitStr: string;
1092
1092
  limit: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bm-admin-ui",
3
- "version": "1.0.55-alpha",
3
+ "version": "1.0.56-alpha",
4
4
  "private": false,
5
5
  "description": "An Admin Component Library for Bm",
6
6
  "license": "UNLICENSED",
@@ -78,7 +78,7 @@ declare const BmButton: import("bm-admin-ui/es/utils/with-install").SFCWithInsta
78
78
  onMousedown: {
79
79
  type: import("vue").PropType<(event: MouseEvent) => void>;
80
80
  };
81
- }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "htmlType" | "loading" | "disabled" | "ghost" | "block" | "danger">;
81
+ }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "disabled" | "loading" | "htmlType" | "ghost" | "block" | "danger">;
82
82
  $attrs: {
83
83
  [x: string]: unknown;
84
84
  };
@@ -80,7 +80,7 @@ declare const _default: import("vue").DefineComponent<{
80
80
  onMousedown: {
81
81
  type: import("vue").PropType<(event: MouseEvent) => void>;
82
82
  };
83
- }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "htmlType" | "loading" | "disabled" | "ghost" | "block" | "danger">;
83
+ }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "disabled" | "loading" | "htmlType" | "ghost" | "block" | "danger">;
84
84
  $attrs: {
85
85
  [x: string]: unknown;
86
86
  };
@@ -294,8 +294,8 @@ declare const BmEditor: import("bm-admin-ui/es/utils/with-install").SFCWithInsta
294
294
  onReady?: ((...args: any[]) => any) | undefined;
295
295
  onGetCount?: ((...args: any[]) => any) | undefined;
296
296
  }, {
297
- disabled: boolean;
298
297
  value: string;
298
+ disabled: boolean;
299
299
  options: {
300
300
  [key: string]: any;
301
301
  };
@@ -294,8 +294,8 @@ declare const _default: import("vue").DefineComponent<{
294
294
  onReady?: ((...args: any[]) => any) | undefined;
295
295
  onGetCount?: ((...args: any[]) => any) | undefined;
296
296
  }, {
297
- disabled: boolean;
298
297
  value: string;
298
+ disabled: boolean;
299
299
  options: {
300
300
  [key: string]: any;
301
301
  };
@@ -217,9 +217,9 @@ declare const BmSearchFilter: import("bm-admin-ui/es/utils/with-install").SFCWit
217
217
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
218
218
  onExpand?: ((...args: any[]) => any) | undefined;
219
219
  }, {
220
- loading: boolean;
221
220
  labelCol: Record<string, any>;
222
221
  value: Record<string, any>;
222
+ loading: boolean;
223
223
  showExpandBtn: boolean;
224
224
  showSearchIcon: boolean;
225
225
  expandPlacement: "left" | "right";
@@ -217,9 +217,9 @@ declare const _default: import("vue").DefineComponent<{
217
217
  "onUpdate:value"?: ((...args: any[]) => any) | undefined;
218
218
  onExpand?: ((...args: any[]) => any) | undefined;
219
219
  }, {
220
- loading: boolean;
221
220
  labelCol: Record<string, any>;
222
221
  value: Record<string, any>;
222
+ loading: boolean;
223
223
  showExpandBtn: boolean;
224
224
  showSearchIcon: boolean;
225
225
  expandPlacement: "left" | "right";
@@ -210,7 +210,7 @@ declare const BmSelectAll: import("bm-admin-ui/es/utils/with-install").SFCWithIn
210
210
  type: BooleanConstructor;
211
211
  default: any;
212
212
  };
213
- }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "loading" | "disabled" | "bordered" | "choiceTransitionName" | "open" | "virtual" | "dropdownMatchSelectWidth" | "autofocus" | "showSearch" | "defaultOpen" | "allowClear" | "showArrow" | "autoClearSearchValue" | "filterOption" | "defaultActiveFirstOption" | "labelInValue">;
213
+ }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "bordered" | "choiceTransitionName" | "open" | "disabled" | "virtual" | "dropdownMatchSelectWidth" | "autofocus" | "loading" | "showSearch" | "defaultOpen" | "allowClear" | "showArrow" | "autoClearSearchValue" | "filterOption" | "defaultActiveFirstOption" | "labelInValue">;
214
214
  $attrs: {
215
215
  [x: string]: unknown;
216
216
  };
@@ -210,7 +210,7 @@ declare const _default: import("vue").DefineComponent<{
210
210
  type: BooleanConstructor;
211
211
  default: any;
212
212
  };
213
- }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "loading" | "disabled" | "bordered" | "choiceTransitionName" | "open" | "virtual" | "dropdownMatchSelectWidth" | "autofocus" | "showSearch" | "defaultOpen" | "allowClear" | "showArrow" | "autoClearSearchValue" | "filterOption" | "defaultActiveFirstOption" | "labelInValue">;
213
+ }>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "bordered" | "choiceTransitionName" | "open" | "disabled" | "virtual" | "dropdownMatchSelectWidth" | "autofocus" | "loading" | "showSearch" | "defaultOpen" | "allowClear" | "showArrow" | "autoClearSearchValue" | "filterOption" | "defaultActiveFirstOption" | "labelInValue">;
214
214
  $attrs: {
215
215
  [x: string]: unknown;
216
216
  };
@@ -1084,9 +1084,9 @@ declare const BmStaffsSelector: import("bm-admin-ui/es/utils/with-install").SFCW
1084
1084
  "onUpdate:visible"?: ((...args: any[]) => any) | undefined;
1085
1085
  "onUpdate:select"?: ((...args: any[]) => any) | undefined;
1086
1086
  }, {
1087
- title: string;
1088
1087
  mode: string;
1089
1088
  showCount: boolean;
1089
+ title: string;
1090
1090
  visible: boolean;
1091
1091
  unitStr: string;
1092
1092
  limit: number;
@@ -1084,9 +1084,9 @@ declare const _default: import("vue").DefineComponent<{
1084
1084
  "onUpdate:visible"?: ((...args: any[]) => any) | undefined;
1085
1085
  "onUpdate:select"?: ((...args: any[]) => any) | undefined;
1086
1086
  }, {
1087
- title: string;
1088
1087
  mode: string;
1089
1088
  showCount: boolean;
1089
+ title: string;
1090
1090
  visible: boolean;
1091
1091
  unitStr: string;
1092
1092
  limit: number;