bkui-vue 0.0.1-beta.84 → 0.0.1-beta.85

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 (86) hide show
  1. package/dist/index.cjs.js +27 -27
  2. package/dist/index.esm.js +327 -413
  3. package/dist/index.umd.js +29 -29
  4. package/dist/style.css +1 -1
  5. package/lib/alert/alert.css +3 -3
  6. package/lib/alert/alert.less +5 -3
  7. package/lib/alert/alert.variable.css +3 -3
  8. package/lib/alert/index.js +1 -1
  9. package/lib/badge/badge.d.ts +1 -1
  10. package/lib/badge/index.d.ts +4 -4
  11. package/lib/button/button.d.ts +1 -1
  12. package/lib/button/index.d.ts +4 -4
  13. package/lib/cascader/cascader.d.ts +2 -2
  14. package/lib/cascader/index.d.ts +7 -7
  15. package/lib/checkbox/index.js +1 -1
  16. package/lib/date-picker/date-picker.d.ts +1 -1
  17. package/lib/date-picker/index.d.ts +4 -4
  18. package/lib/date-picker/index.js +1 -1
  19. package/lib/dialog/dialog.d.ts +1 -1
  20. package/lib/dialog/index.d.ts +4 -4
  21. package/lib/dropdown/dropdown.d.ts +2 -2
  22. package/lib/dropdown/index.d.ts +7 -7
  23. package/lib/form/form-item.d.ts +3 -3
  24. package/lib/form/form.d.ts +23 -9
  25. package/lib/form/index.d.ts +44 -21
  26. package/lib/form/index.js +1 -1
  27. package/lib/form/type.d.ts +5 -4
  28. package/lib/form/validator.d.ts +1 -0
  29. package/lib/input/index.d.ts +20 -20
  30. package/lib/input/index.js +1 -1
  31. package/lib/input/input.d.ts +6 -6
  32. package/lib/link/index.d.ts +7 -7
  33. package/lib/link/link.d.ts +2 -2
  34. package/lib/message/messageConstructor.d.ts +1 -1
  35. package/lib/notify/notifyConstructor.d.ts +2 -2
  36. package/lib/pagination/index.d.ts +4 -4
  37. package/lib/pagination/index.js +1 -1
  38. package/lib/pagination/pagination.d.ts +1 -1
  39. package/lib/popover/index.d.ts +13 -13
  40. package/lib/popover/popover.d.ts +4 -4
  41. package/lib/progress/index.d.ts +4 -4
  42. package/lib/progress/progress.d.ts +1 -1
  43. package/lib/radio/index.js +1 -1
  44. package/lib/rate/index.js +1 -1
  45. package/lib/resize-layout/index.d.ts +7 -7
  46. package/lib/resize-layout/resize-layout.d.ts +2 -2
  47. package/lib/select/index.d.ts +34 -87
  48. package/lib/select/index.js +1 -1
  49. package/lib/select/option.d.ts +2 -7
  50. package/lib/select/optionGroup.d.ts +1 -1
  51. package/lib/select/select.d.ts +6 -14
  52. package/lib/shared/index.d.ts +2 -0
  53. package/lib/shared/index.js +1 -1
  54. package/lib/shared/token.d.ts +4 -2
  55. package/lib/switcher/index.d.ts +4 -4
  56. package/lib/switcher/index.js +1 -1
  57. package/lib/switcher/switcher.d.ts +1 -1
  58. package/lib/tab/index.d.ts +5 -5
  59. package/lib/tab/tab-panel.d.ts +1 -1
  60. package/lib/tab/tab.d.ts +1 -1
  61. package/lib/table/const.d.ts +3 -1
  62. package/lib/table/index.d.ts +68 -2
  63. package/lib/table/index.js +1 -1
  64. package/lib/table/props.d.ts +24 -0
  65. package/lib/table/table.d.ts +30 -0
  66. package/lib/table/utils.d.ts +7 -0
  67. package/lib/tag-input/index.d.ts +11 -11
  68. package/lib/tag-input/index.js +1 -1
  69. package/lib/tag-input/tag-input.d.ts +3 -3
  70. package/lib/transfer/const.d.ts +5 -0
  71. package/lib/transfer/index.d.ts +164 -150
  72. package/lib/transfer/index.js +1 -1
  73. package/lib/transfer/props.d.ts +54 -0
  74. package/lib/transfer/transfer.css +6 -6
  75. package/lib/transfer/transfer.d.ts +70 -95
  76. package/lib/transfer/transfer.less +4 -4
  77. package/lib/transfer/transfer.variable.css +6 -6
  78. package/lib/tree/index.js +1 -1
  79. package/lib/upload/upload-list.d.ts +1 -1
  80. package/lib/upload/upload-trigger.d.ts +1 -1
  81. package/lib/upload/upload.d.ts +1 -1
  82. package/lib/virtual-render/index.js +1 -1
  83. package/package.json +1 -1
  84. package/lib/form/common.d.ts +0 -3
  85. package/lib/styles/mixins/clearfix.css +0 -8
  86. package/lib/use-form.d.ts +0 -3
package/dist/index.esm.js CHANGED
@@ -33,7 +33,7 @@ var __publicField = (obj, key, value) => {
33
33
  __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
34
34
  return value;
35
35
  };
36
- import { createVNode, h as h$1, mergeProps, defineComponent, reactive, ref, computed, watch, onMounted, onBeforeUnmount, getCurrentInstance, nextTick, Transition, provide, inject, createTextVNode, withDirectives, vShow, isVNode, Fragment, toRefs, customRef, onBeforeMount, toRef, vModelText, resolveDirective, watchEffect, onUpdated, render, onUnmounted, Teleport, withModifiers } from "vue";
36
+ import { inject, createVNode, h as h$1, mergeProps, defineComponent, reactive, ref, computed, watch, onMounted, onBeforeUnmount, getCurrentInstance, nextTick, Transition, provide, createTextVNode, withDirectives, vShow, isVNode, Fragment, toRefs, customRef, onBeforeMount, toRef, vModelText, resolveDirective, watchEffect, onUpdated, render, onUnmounted, Teleport, toRaw, withModifiers } from "vue";
37
37
  var reset = "";
38
38
  var alert = "";
39
39
  var affix = "";
@@ -1292,7 +1292,7 @@ function orderModifiers(modifiers) {
1292
1292
  }));
1293
1293
  }, []);
1294
1294
  }
1295
- function debounce(fn2) {
1295
+ function debounce$1(fn2) {
1296
1296
  var pending;
1297
1297
  return function() {
1298
1298
  if (!pending) {
@@ -1406,7 +1406,7 @@ function popperGenerator(generatorOptions) {
1406
1406
  }
1407
1407
  }
1408
1408
  },
1409
- update: debounce(function() {
1409
+ update: debounce$1(function() {
1410
1410
  return new Promise(function(resolve) {
1411
1411
  instance.forceUpdate();
1412
1412
  resolve(state);
@@ -1454,12 +1454,6 @@ var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyS
1454
1454
  var createPopper = /* @__PURE__ */ popperGenerator({
1455
1455
  defaultModifiers
1456
1456
  });
1457
- function isNullOrUndef(value) {
1458
- return value === null || typeof value === "undefined";
1459
- }
1460
- function isEmpty(value, IncludeNullUndefined = true) {
1461
- return value === "" || (IncludeNullUndefined ? isNullOrUndef(value) : false);
1462
- }
1463
1457
  function isArray(value) {
1464
1458
  if (Array.isArray(value)) {
1465
1459
  return true;
@@ -2322,6 +2316,10 @@ class PropTypes extends propTypesNS {
2322
2316
  });
2323
2317
  }
2324
2318
  }
2319
+ const formKey = Symbol("form");
2320
+ const formItemKey = Symbol("formItem");
2321
+ const useForm = () => inject(formKey);
2322
+ const useFormItem = () => inject(formItemKey, EMPTY_OBJ);
2325
2323
  function classes(dynamicCls, constCls = "") {
2326
2324
  return Object.entries(dynamicCls).filter((entry) => entry[1]).map((entry) => entry[0]).join(" ").concat(constCls ? ` ${constCls}` : "");
2327
2325
  }
@@ -2350,6 +2348,34 @@ const withInstallProps = (component, childComponents, isProps = false) => {
2350
2348
  function resolveClassName(clsName, prefix = "bk") {
2351
2349
  return `${prefix}-${clsName}`;
2352
2350
  }
2351
+ function debounce(delay = 300, fn2, immediate = false) {
2352
+ let timeout;
2353
+ let result;
2354
+ const debounced = function() {
2355
+ const ctx = this;
2356
+ const args = arguments;
2357
+ if (timeout)
2358
+ clearTimeout(timeout);
2359
+ if (immediate) {
2360
+ const applyImmediate = !timeout;
2361
+ timeout = setTimeout(() => {
2362
+ timeout = null;
2363
+ }, delay);
2364
+ if (applyImmediate)
2365
+ result = fn2.apply(ctx, args);
2366
+ } else {
2367
+ timeout = setTimeout(() => {
2368
+ fn2.apply(ctx, args);
2369
+ }, delay);
2370
+ }
2371
+ return result;
2372
+ };
2373
+ debounced.cancel = function() {
2374
+ clearTimeout(timeout);
2375
+ timeout = null;
2376
+ };
2377
+ return debounced;
2378
+ }
2353
2379
  function filterProperty(data2, filter) {
2354
2380
  return JSON.parse(JSON.stringify(data2, (key, value) => {
2355
2381
  if (filter.includes(key)) {
@@ -2840,6 +2866,7 @@ var Component$C = defineComponent({
2840
2866
  };
2841
2867
  },
2842
2868
  render() {
2869
+ var _a, _b;
2843
2870
  if (!this.state.visible) {
2844
2871
  return null;
2845
2872
  }
@@ -2847,7 +2874,7 @@ var Component$C = defineComponent({
2847
2874
  const closeButtonClasses = classes({
2848
2875
  "bk-alert-close": true,
2849
2876
  "close-text": renderCloseText,
2850
- "icon-close": !renderCloseText
2877
+ "bk-alert-close-icon": !renderCloseText
2851
2878
  });
2852
2879
  const typeClass = classes({
2853
2880
  "bk-alert": true,
@@ -2863,12 +2890,12 @@ var Component$C = defineComponent({
2863
2890
  "class": "bk-alert-content"
2864
2891
  }, [createVNode("div", {
2865
2892
  "class": "bk-alert-title"
2866
- }, [this.title]), createVNode("div", {
2893
+ }, [this.$slots.title ? this.$slots.title() : this.title]), createVNode("div", {
2867
2894
  "class": "bk-alert-description"
2868
- }, null)]), this.closable && createVNode("span", {
2895
+ }, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)])]), this.closable && createVNode("span", {
2869
2896
  "class": closeButtonClasses,
2870
2897
  "onClick": this.handleClose
2871
- }, [this.closeText])])]);
2898
+ }, [this.closeText ? this.closeText : createVNode(closeLine, null, null)])])]);
2872
2899
  }
2873
2900
  });
2874
2901
  const BkAlert = withInstall(Component$C);
@@ -6925,7 +6952,7 @@ var lodash = { exports: {} };
6925
6952
  function isElement2(value) {
6926
6953
  return isObjectLike(value) && value.nodeType === 1 && !isPlainObject2(value);
6927
6954
  }
6928
- function isEmpty2(value) {
6955
+ function isEmpty(value) {
6929
6956
  if (value == null) {
6930
6957
  return true;
6931
6958
  }
@@ -8055,7 +8082,7 @@ var lodash = { exports: {} };
8055
8082
  lodash2.isBuffer = isBuffer;
8056
8083
  lodash2.isDate = isDate2;
8057
8084
  lodash2.isElement = isElement2;
8058
- lodash2.isEmpty = isEmpty2;
8085
+ lodash2.isEmpty = isEmpty;
8059
8086
  lodash2.isEqual = isEqual;
8060
8087
  lodash2.isEqualWith = isEqualWith;
8061
8088
  lodash2.isError = isError;
@@ -8983,6 +9010,7 @@ var Component$u = defineComponent({
8983
9010
  props: inputType,
8984
9011
  emits: inputEmitEventsType,
8985
9012
  setup(props, ctx) {
9013
+ const formItem = useFormItem();
8986
9014
  const isFocused = ref(false);
8987
9015
  const isCNInput = ref(false);
8988
9016
  const isTextArea = computed(() => props.type === "textarea");
@@ -9035,20 +9063,25 @@ var Component$u = defineComponent({
9035
9063
  clear
9036
9064
  });
9037
9065
  function clear() {
9066
+ var _a2;
9038
9067
  ctx.emit(EVENTS$2.UPDATE, "");
9039
9068
  ctx.emit(EVENTS$2.CHANGE, "");
9040
9069
  ctx.emit(EVENTS$2.CLEAR);
9070
+ (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change");
9041
9071
  }
9042
9072
  function handleFocus(e) {
9043
9073
  isFocused.value = true;
9044
9074
  ctx.emit(EVENTS$2.FOCUS, e);
9045
9075
  }
9046
9076
  function handleBlur(e) {
9077
+ var _a2;
9047
9078
  isFocused.value = false;
9048
9079
  ctx.emit(EVENTS$2.BLUR, e);
9080
+ (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur");
9049
9081
  }
9050
9082
  function eventHandler(eventName) {
9051
9083
  return (e) => {
9084
+ var _a2;
9052
9085
  if (e.code === "Enter" || e.key === "Enter" || e.keyCode === 13) {
9053
9086
  ctx.emit(EVENTS$2.ENTER, e.target.value, e);
9054
9087
  }
@@ -9058,6 +9091,9 @@ var Component$u = defineComponent({
9058
9091
  ctx.emit(EVENTS$2.UPDATE, isNumberInput.value ? +e.target.value : e.target.value);
9059
9092
  }
9060
9093
  ctx.emit(eventName, e.target.value, e);
9094
+ if (eventName === EVENTS$2.INPUT) {
9095
+ (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change");
9096
+ }
9061
9097
  };
9062
9098
  }
9063
9099
  const [handleKeyup, handleKeydown, handleKeyPress, handlePaste, handleChange, handleInput] = [EVENTS$2.KEYUP, EVENTS$2.KEYDOWN, EVENTS$2.KEYPRESS, EVENTS$2.PASTE, EVENTS$2.CHANGE, EVENTS$2.INPUT].map(eventHandler);
@@ -9270,6 +9306,7 @@ const useCheckbox = () => {
9270
9306
  props,
9271
9307
  emit
9272
9308
  } = currentInstance;
9309
+ const formItem = useFormItem();
9273
9310
  const checkboxGroup = inject(checkboxGroupKey, EMPTY_OBJ);
9274
9311
  const isGroup = !isEmptyObj(checkboxGroup);
9275
9312
  const isChecked = ref(props.checked);
@@ -9299,6 +9336,7 @@ const useCheckbox = () => {
9299
9336
  isChecked.value = value;
9300
9337
  };
9301
9338
  const handleChange = (event) => {
9339
+ var _a;
9302
9340
  if (isDisabled.value) {
9303
9341
  return;
9304
9342
  }
@@ -9310,6 +9348,7 @@ const useCheckbox = () => {
9310
9348
  if (isGroup) {
9311
9349
  checkboxGroup.handleChange();
9312
9350
  }
9351
+ (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change");
9313
9352
  nextTick(() => {
9314
9353
  if ($targetInput.checked !== isChecked.value) {
9315
9354
  $targetInput.checked = isChecked.value;
@@ -10485,6 +10524,7 @@ const useRadio = () => {
10485
10524
  props,
10486
10525
  emit
10487
10526
  } = currentInstance;
10527
+ const formItem = useFormItem();
10488
10528
  const radioGroup = inject(radioGroupKey, EMPTY_OBJ);
10489
10529
  const isGroup = !isEmptyObj(radioGroup);
10490
10530
  const isChecked = ref(props.checked);
@@ -10512,6 +10552,7 @@ const useRadio = () => {
10512
10552
  isChecked.value = value;
10513
10553
  };
10514
10554
  const handleChange = (event) => {
10555
+ var _a;
10515
10556
  if (isDisabled.value) {
10516
10557
  return;
10517
10558
  }
@@ -10523,6 +10564,7 @@ const useRadio = () => {
10523
10564
  if (isGroup) {
10524
10565
  radioGroup.handleChange(currentInstance.proxy);
10525
10566
  }
10567
+ (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change");
10526
10568
  nextTick(() => {
10527
10569
  if ($targetInput.checked !== isChecked.value) {
10528
10570
  $targetInput.checked = isChecked.value;
@@ -10791,12 +10833,15 @@ var Component$i = defineComponent({
10791
10833
  setup(props, {
10792
10834
  emit
10793
10835
  }) {
10836
+ const formItem = useFormItem();
10794
10837
  const hoverRate = ref(0);
10795
10838
  const chooseRate = (val) => {
10839
+ var _a;
10796
10840
  if (!props.editable)
10797
10841
  return;
10798
10842
  emit("update:modelValue", val);
10799
10843
  emit("change", val);
10844
+ (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change");
10800
10845
  };
10801
10846
  const changeHover = (val) => {
10802
10847
  hoverRate.value = val;
@@ -11133,7 +11178,7 @@ var BkOption = defineComponent({
11133
11178
  name: "Option",
11134
11179
  props: {
11135
11180
  value: PropTypes.any,
11136
- label: PropTypes.string,
11181
+ label: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
11137
11182
  disabled: PropTypes.bool.def(false)
11138
11183
  },
11139
11184
  setup(props) {
@@ -11862,6 +11907,7 @@ var Component$f = defineComponent({
11862
11907
  multipleMode,
11863
11908
  allowCreate
11864
11909
  } = toRefs(props);
11910
+ const formItem = useFormItem();
11865
11911
  const inputRef = ref();
11866
11912
  const popoverRef = ref();
11867
11913
  const selectTagInputRef = ref();
@@ -11971,10 +12017,12 @@ var Component$f = defineComponent({
11971
12017
  searchLoading
11972
12018
  } = useRemoteSearch(isRemoteSearch.value ? remoteMethod.value : defaultSearchMethod, initActiveOptionValue);
11973
12019
  const emitChange = (val) => {
12020
+ var _a;
11974
12021
  if (val === modelValue.value)
11975
12022
  return;
11976
12023
  emit("change", val);
11977
12024
  emit("update:modelValue", val);
12025
+ (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change");
11978
12026
  };
11979
12027
  const handleTogglePopover = () => {
11980
12028
  if (isDisabled.value)
@@ -11988,7 +12036,7 @@ var Component$f = defineComponent({
11988
12036
  searchKey.value = value;
11989
12037
  };
11990
12038
  const handleInputEnter = (value, e) => {
11991
- if (!allowCreate.value || !value || filterable.value && options.value.find((data3) => toLowerCase(data3.label) === toLowerCase(value)))
12039
+ if (!allowCreate.value || !value || filterable.value && options.value.find((data3) => toLowerCase(String(data3.label)) === toLowerCase(value)))
11992
12040
  return;
11993
12041
  const data2 = optionsMap.value.get(value);
11994
12042
  if (data2)
@@ -12605,6 +12653,7 @@ var Component$c = defineComponent({
12605
12653
  setup(props, {
12606
12654
  emit
12607
12655
  }) {
12656
+ const formItem = useFormItem();
12608
12657
  const isLoading = ref(false);
12609
12658
  const isChecked = computed(() => props.trueValue === localValue.value);
12610
12659
  const isModelValue = ref(props.modelValue !== false);
@@ -12646,8 +12695,10 @@ var Component$c = defineComponent({
12646
12695
  const lastValue = isChecked.value ? props.falseValue : props.trueValue;
12647
12696
  const lastChecked = !isChecked.value;
12648
12697
  const trigger = () => {
12698
+ var _a;
12649
12699
  emit("update:modelValue", lastValue);
12650
12700
  emit("change", lastChecked);
12701
+ (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change");
12651
12702
  };
12652
12703
  let goodJob = true;
12653
12704
  if (typeof props.preCheck === "function") {
@@ -12777,7 +12828,7 @@ function computedVirtualIndex(lineHeight, callback, pagination2, el, event) {
12777
12828
  }
12778
12829
  if (elScrollTop !== scrollTop || targetStartIndex !== startIndex || targetEndIndex !== endIndex) {
12779
12830
  const bottom2 = el.scrollHeight - el.offsetHeight - el.scrollTop;
12780
- typeof callback === "function" && callback(event, targetStartIndex, targetEndIndex, elScrollTop, translateY, elScrollLeft, { bottom: bottom2 });
12831
+ typeof callback === "function" && callback(event, targetStartIndex, targetEndIndex, elScrollTop, translateY, elScrollLeft, { bottom: bottom2 >= 0 ? bottom2 : 0 });
12781
12832
  }
12782
12833
  }
12783
12834
  function visibleRender(e, wrapper, binding) {
@@ -12786,7 +12837,7 @@ function visibleRender(e, wrapper, binding) {
12786
12837
  const elScrollTop = wrapper.scrollTop;
12787
12838
  const elScrollLeft = wrapper.scrollLeft;
12788
12839
  const bottom2 = wrapper.scrollHeight - wrapper.offsetHeight - wrapper.scrollTop;
12789
- handleScrollCallback(e, null, null, elScrollTop, elScrollTop, elScrollLeft, { bottom: bottom2 });
12840
+ handleScrollCallback(e, null, null, elScrollTop, elScrollTop, elScrollLeft, { bottom: bottom2 >= 0 ? bottom2 : 0 });
12790
12841
  return;
12791
12842
  }
12792
12843
  const { startIndex, endIndex, groupItemCount, count, scrollTop } = pagination2;
@@ -12982,6 +13033,7 @@ var EMITEVENTS = /* @__PURE__ */ ((EMITEVENTS2) => {
12982
13033
  EMITEVENTS2["PAGE_LIMIT_CHANGE"] = "pageLimitChange";
12983
13034
  EMITEVENTS2["PAGE_VALUE_CHANGE"] = "pageValueChange";
12984
13035
  EMITEVENTS2["SETTING_CHANGE"] = "settingChange";
13036
+ EMITEVENTS2["SCROLL_BOTTOM"] = "scrollBottom";
12985
13037
  return EMITEVENTS2;
12986
13038
  })(EMITEVENTS || {});
12987
13039
  const EMPTY$1 = (..._args) => true;
@@ -12993,7 +13045,8 @@ const EMIT_EVENT_TYPES = {
12993
13045
  ["rowDblClick"]: EMPTY$1,
12994
13046
  ["pageLimitChange"]: EMPTY$1,
12995
13047
  ["pageValueChange"]: EMPTY$1,
12996
- ["settingChange"]: EMPTY$1
13048
+ ["settingChange"]: EMPTY$1,
13049
+ ["scrollBottom"]: EMPTY$1
12997
13050
  };
12998
13051
  const resolvePropVal = (prop, key, args) => {
12999
13052
  if (Object.prototype.hasOwnProperty.call(prop, key)) {
@@ -13147,6 +13200,18 @@ const getRowText = (row, key, column) => {
13147
13200
  }
13148
13201
  return row[key];
13149
13202
  };
13203
+ const formatPropAsArray = (prop, args) => {
13204
+ if (Array.isArray(prop)) {
13205
+ return prop;
13206
+ }
13207
+ if (typeof prop === "string" || typeof prop === "object") {
13208
+ return [prop];
13209
+ }
13210
+ if (typeof prop === "function") {
13211
+ return formatPropAsArray(Reflect.apply(prop, globalThis, args), args);
13212
+ }
13213
+ return [];
13214
+ };
13150
13215
  const resolveActiveColumns = (props) => {
13151
13216
  if (props.columnPick !== "disabled") {
13152
13217
  if (props.columnPick === "multi") {
@@ -13507,7 +13572,11 @@ const tableProps = {
13507
13572
  limit: PropTypes.number.def(void 0),
13508
13573
  size: PropTypes.size(["small", "default", "large"]).def("default"),
13509
13574
  sizeList: PropTypes.shape([]).def(void 0)
13510
- })]).def(false)
13575
+ })]).def(false),
13576
+ rowClass: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]).def({}),
13577
+ rowStyle: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]).def({}),
13578
+ cellStyle: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]).def({}),
13579
+ cellClass: PropTypes.oneOfType([PropTypes.string, PropTypes.object, PropTypes.func]).def({})
13511
13580
  };
13512
13581
  function _isSlot$2(s2) {
13513
13582
  return typeof s2 === "function" || Object.prototype.toString.call(s2) === "[object Object]" && !isVNode(s2);
@@ -13748,14 +13817,6 @@ var useSmallList = () => {
13748
13817
  }
13749
13818
  localCurrent.value = localCurrent.value + 1;
13750
13819
  };
13751
- const setSelection = () => {
13752
- nextTick(() => {
13753
- inputRef.value.focus();
13754
- const range = window.getSelection();
13755
- range.selectAllChildren(inputRef.value);
13756
- range.collapseToEnd();
13757
- });
13758
- };
13759
13820
  const handlePageEditorFocus = () => {
13760
13821
  isFocused.value = true;
13761
13822
  };
@@ -13773,13 +13834,11 @@ var useSmallList = () => {
13773
13834
  return;
13774
13835
  }
13775
13836
  inputMemo = value;
13776
- setSelection();
13777
13837
  };
13778
13838
  const handlePageEditorKeydown = (event) => {
13779
13839
  if (["Enter", "NumpadEnter"].includes(event.code)) {
13780
13840
  event.preventDefault();
13781
13841
  handlePageEditorBlur();
13782
- setSelection();
13783
13842
  }
13784
13843
  };
13785
13844
  const handlePageChange = (item) => {
@@ -14538,25 +14597,31 @@ class TableRender {
14538
14597
  getFixedColumnStyleResolve
14539
14598
  } = useFixedColumn(this.props, this.colgroups);
14540
14599
  return createVNode("tbody", null, [rows.map((row, rowIndex) => {
14541
- const rowStyle = {
14600
+ const rowStyle = [...formatPropAsArray(this.props.rowStyle, [row, rowIndex, this]), {
14542
14601
  "--row-height": `${this.getRowHeight(row, rowIndex)}px`
14543
- };
14602
+ }];
14603
+ const rowClass = [...formatPropAsArray(this.props.rowClass, [row, rowIndex, this])];
14544
14604
  const {
14545
14605
  resolveFixedColumnStyle,
14546
14606
  fixedoffset
14547
14607
  } = getFixedColumnStyleResolve();
14548
14608
  return createVNode("tr", {
14549
14609
  "style": rowStyle,
14610
+ "class": rowClass,
14550
14611
  "onClick": (e) => this.handleRowClick(e, row, rowIndex, rows),
14551
14612
  "onDblclick": (e) => this.handleRowDblClick(e, row, rowIndex, rows)
14552
- }, [this.filterColgroups.map((column, index) => createVNode("td", {
14553
- "class": this.getColumnClass(column, index),
14554
- "style": resolveFixedColumnStyle(column, fixedoffset),
14555
- "colspan": 1,
14556
- "rowspan": 1
14557
- }, [createVNode("div", {
14558
- "class": "cell"
14559
- }, [this.renderCell(row, column, rowIndex, rows)])]))]);
14613
+ }, [this.filterColgroups.map((column, index) => {
14614
+ const cellStyle = [resolveFixedColumnStyle(column, fixedoffset), ...formatPropAsArray(this.props.cellStyle, [column, index, row, rowIndex, this])];
14615
+ const cellClass = [this.getColumnClass(column, index), ...formatPropAsArray(this.props.cellClass, [column, index, row, rowIndex, this])];
14616
+ return createVNode("td", {
14617
+ "class": cellClass,
14618
+ "style": cellStyle,
14619
+ "colspan": 1,
14620
+ "rowspan": 1
14621
+ }, [createVNode("div", {
14622
+ "class": "cell"
14623
+ }, [this.renderCell(row, column, rowIndex, rows)])]);
14624
+ })]);
14560
14625
  })]);
14561
14626
  }
14562
14627
  handleRowClick(e, row, index, rows) {
@@ -14668,7 +14733,9 @@ const useClass = (props, root, reactiveProp, pageData) => {
14668
14733
  const updateBorderClass = (root2) => {
14669
14734
  if (root2) {
14670
14735
  const tableBody = root2.querySelector(".bk-table-body table");
14671
- hasScrollY.value = tableBody.offsetHeight > root2.offsetHeight;
14736
+ if (tableBody) {
14737
+ hasScrollY.value = tableBody.offsetHeight > root2.offsetHeight;
14738
+ }
14672
14739
  }
14673
14740
  };
14674
14741
  return {
@@ -14799,6 +14866,8 @@ var Component$9 = defineComponent({
14799
14866
  });
14800
14867
  });
14801
14868
  const handleScrollChanged = (args) => {
14869
+ var _a2;
14870
+ const preBottom = (_a2 = reactiveProp.pos.bottom) != null ? _a2 : 0;
14802
14871
  const pagination2 = args[1];
14803
14872
  const {
14804
14873
  translateX,
@@ -14808,6 +14877,17 @@ var Component$9 = defineComponent({
14808
14877
  reactiveProp.scrollTranslateY = translateY;
14809
14878
  reactiveProp.scrollTranslateX = translateX;
14810
14879
  reactiveProp.pos = pos;
14880
+ const {
14881
+ bottom: bottom2
14882
+ } = pos;
14883
+ if (bottom2 <= 2 && preBottom !== bottom2) {
14884
+ debounce(60, () => {
14885
+ ctx.emit(EMITEVENTS.SCROLL_BOTTOM, __spreadProps(__spreadValues({}, pos), {
14886
+ translateX,
14887
+ translateY
14888
+ }));
14889
+ }, true)();
14890
+ }
14811
14891
  };
14812
14892
  onMounted(() => {
14813
14893
  observerIns = observerResize(root.value, () => {
@@ -14833,6 +14913,13 @@ var Component$9 = defineComponent({
14833
14913
  [resolveClassName("table-body-content")]: true,
14834
14914
  "with-virtual-render": props.virtualEnabled
14835
14915
  };
14916
+ const resizeColumnClass = {
14917
+ [resolveClassName("drag-column")]: true,
14918
+ "offset-x": true
14919
+ };
14920
+ const loadingRowClass = {
14921
+ [resolveClassName("table-loading_bottom")]: true
14922
+ };
14836
14923
  return () => createVNode("div", {
14837
14924
  "class": tableClass.value,
14838
14925
  "style": wrapperStyle.value,
@@ -14859,8 +14946,10 @@ var Component$9 = defineComponent({
14859
14946
  createVNode("div", {
14860
14947
  "class": fixedWrapperClass
14861
14948
  }, [renderFixedColumns(), createVNode("div", {
14862
- "class": "bk-drag-column offset-x",
14949
+ "class": resizeColumnClass,
14863
14950
  "style": dragOffsetXStyle.value
14951
+ }, null), createVNode("div", {
14952
+ "class": loadingRowClass
14864
14953
  }, null)]),
14865
14954
  createVNode("div", {
14866
14955
  "class": footerClass.value
@@ -15050,6 +15139,7 @@ var Component$8 = defineComponent({
15050
15139
  setup(props, {
15051
15140
  emit
15052
15141
  }) {
15142
+ const formItem = useFormItem();
15053
15143
  const state = reactive({
15054
15144
  isEdit: false,
15055
15145
  isHover: false,
@@ -15334,6 +15424,7 @@ var Component$8 = defineComponent({
15334
15424
  };
15335
15425
  const handleBlur = () => {
15336
15426
  timer.value = setTimeout(() => {
15427
+ var _a;
15337
15428
  const inputValue = curInputValue.value;
15338
15429
  clearInput();
15339
15430
  state.isEdit = false;
@@ -15360,6 +15451,7 @@ var Component$8 = defineComponent({
15360
15451
  }
15361
15452
  popoverProps.isShow = false;
15362
15453
  emit("blur", inputValue, tagList.value);
15454
+ (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "blur");
15363
15455
  }, 50);
15364
15456
  };
15365
15457
  const handleTagSelected = (item, type, e) => {
@@ -15383,9 +15475,11 @@ var Component$8 = defineComponent({
15383
15475
  tagInputRef.value.style.width = `${INPUT_MIN_WIDTH}px`;
15384
15476
  };
15385
15477
  const handleChange = (type, data2) => {
15478
+ var _a;
15386
15479
  emit("change", tagList.value);
15387
15480
  emit(type, data2);
15388
15481
  emit("update:modelValue", tagList.value);
15482
+ (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change");
15389
15483
  };
15390
15484
  const handleClear = (e) => {
15391
15485
  e.stopPropagation();
@@ -20474,6 +20568,7 @@ var Component$5 = defineComponent({
20474
20568
  slots,
20475
20569
  emit
20476
20570
  }) {
20571
+ const formItem = useFormItem();
20477
20572
  const isRange = props.type.includes("range");
20478
20573
  const emptyArray = isRange ? [null, null] : [null];
20479
20574
  let initialValue = isAllEmptyArr((isRange ? props.modelValue : [props.modelValue]) || []) ? emptyArray : parseDate(props.modelValue, props.type, props.multiple, props.format);
@@ -20673,11 +20768,12 @@ var Component$5 = defineComponent({
20673
20768
  };
20674
20769
  const emitChange = (type) => {
20675
20770
  nextTick(() => {
20676
- var _a;
20771
+ var _a, _b;
20677
20772
  emit("change", publicStringValue.value, type);
20678
20773
  emit("update:modelValue", publicVModelValue.value);
20774
+ (_a = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a.call(formItem, "change");
20679
20775
  if (props.type.indexOf("time") < 0) {
20680
- (_a = inputRef == null ? void 0 : inputRef.value) == null ? void 0 : _a.blur();
20776
+ (_b = inputRef == null ? void 0 : inputRef.value) == null ? void 0 : _b.blur();
20681
20777
  }
20682
20778
  });
20683
20779
  };
@@ -20714,7 +20810,7 @@ var Component$5 = defineComponent({
20714
20810
  (_a = pickerPanelRef == null ? void 0 : pickerPanelRef.value) == null ? void 0 : _a.reset();
20715
20811
  };
20716
20812
  const handleBlur = (e) => {
20717
- var _a;
20813
+ var _a, _b;
20718
20814
  if (state.internalFocus) {
20719
20815
  state.internalFocus = false;
20720
20816
  return;
@@ -20728,6 +20824,7 @@ var Component$5 = defineComponent({
20728
20824
  state.internalValue = state.internalValue.slice();
20729
20825
  reset2();
20730
20826
  (_a = pickerPanelRef == null ? void 0 : pickerPanelRef.value) == null ? void 0 : _a.onToggleVisibility(false);
20827
+ (_b = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _b.call(formItem, "blur");
20731
20828
  };
20732
20829
  const handleKeydown = (e) => {
20733
20830
  const {
@@ -20995,359 +21092,169 @@ var Component$5 = defineComponent({
20995
21092
  }
20996
21093
  });
20997
21094
  const BkDatePicker = withInstall(Component$5);
20998
- ({
20999
- title: Array,
21000
- extCls: PropTypes.string,
21001
- settingKey: PropTypes.string,
21002
- displayKey: PropTypes.string,
21003
- searchPlaceholder: PropTypes.string,
21004
- showOverflowTips: PropTypes.bool,
21005
- searchable: PropTypes.bool,
21006
- sortKey: PropTypes.string,
21007
- sortable: PropTypes.bool,
21008
- sourceList: Array,
21009
- targetList: Array,
21010
- emptyContent: Array
21011
- });
21095
+ var ArrayType = /* @__PURE__ */ ((ArrayType2) => {
21096
+ ArrayType2["OBJECT_ARRAY"] = "objectArray";
21097
+ ArrayType2["BASE_ARRAY"] = "baseArray";
21098
+ ArrayType2["NOT_ARRAY"] = "notArray";
21099
+ return ArrayType2;
21100
+ })(ArrayType || {});
21101
+ const transferProps = {
21102
+ title: PropTypes.arrayOf(PropTypes.string).def([]),
21103
+ extCls: PropTypes.string.def(""),
21104
+ searchPlaceholder: PropTypes.string.def(""),
21105
+ settingKey: PropTypes.string.def("id"),
21106
+ displayKey: PropTypes.string.def("value"),
21107
+ sortKey: PropTypes.string.def("value"),
21108
+ showOverflowTips: PropTypes.bool.def(false),
21109
+ searchable: PropTypes.bool.def(false),
21110
+ sortable: PropTypes.bool.def(false),
21111
+ sourceList: PropTypes.arrayOf(PropTypes.any).def([]),
21112
+ targetList: PropTypes.arrayOf(PropTypes.any).def([]),
21113
+ emptyContent: PropTypes.arrayOf(PropTypes.string).def([])
21114
+ };
21115
+ function useTransferData(sourceData, targetList, settingCode) {
21116
+ const selectList = ref([]);
21117
+ const selectedList = ref([]);
21118
+ const transformData = () => {
21119
+ sourceData.value.forEach((s2) => {
21120
+ const keyId = s2[settingCode.value];
21121
+ if (targetList.value.includes(keyId)) {
21122
+ selectedList.value.push(s2);
21123
+ } else {
21124
+ selectList.value.push(s2);
21125
+ }
21126
+ });
21127
+ };
21128
+ transformData();
21129
+ watch(() => [sourceData, targetList, settingCode], transformData);
21130
+ return {
21131
+ selectList,
21132
+ selectedList
21133
+ };
21134
+ }
21135
+ function useSelectListSearch(selectList, displayCode) {
21136
+ const selectSearchQuery = ref("");
21137
+ const selectListSearch = computed(() => {
21138
+ return selectList.value.filter((select2) => {
21139
+ const val = select2[displayCode.value];
21140
+ if (val instanceof Object)
21141
+ return false;
21142
+ return val.toString().includes(selectSearchQuery.value);
21143
+ });
21144
+ });
21145
+ return {
21146
+ selectSearchQuery,
21147
+ selectListSearch
21148
+ };
21149
+ }
21012
21150
  var Component$4 = defineComponent({
21013
21151
  name: "Transfer",
21014
- props: {
21015
- title: {
21016
- type: Array,
21017
- default: () => []
21018
- },
21019
- extCls: {
21020
- type: String,
21021
- default: ""
21022
- },
21023
- searchPlaceholder: {
21024
- type: String,
21025
- default: ""
21026
- },
21027
- settingKey: {
21028
- type: String,
21029
- default: "id"
21030
- },
21031
- displayKey: {
21032
- type: String,
21033
- default: "value"
21034
- },
21035
- sortKey: {
21036
- type: String,
21037
- default: ""
21038
- },
21039
- showOverflowTips: {
21040
- type: Boolean,
21041
- default: false
21042
- },
21043
- searchable: {
21044
- type: Boolean,
21045
- default: false
21046
- },
21047
- sortable: {
21048
- type: Boolean,
21049
- default: false
21050
- },
21051
- sourceList: {
21052
- type: Array,
21053
- default: () => []
21054
- },
21055
- targetList: {
21056
- type: Array,
21057
- default: () => []
21058
- },
21059
- emptyContent: {
21060
- type: Array,
21061
- default: () => []
21062
- }
21063
- },
21064
- emits: ["change"],
21065
- slots: ["left-header", "right-header", "source-option", "target-option", "left-empty-content", "right-empty-content"],
21152
+ props: transferProps,
21153
+ emits: ["change", "update:targetList"],
21066
21154
  setup(props, {
21067
21155
  emit
21068
21156
  }) {
21069
- let sortList = [];
21070
- let sortCode = props.sortKey;
21071
- let isSortFlag = props.sortable;
21072
- const keyword = ref("");
21073
- const transferRef = ref(null);
21074
- const dataList = ref([]);
21075
- const hasSelectedList = ref([]);
21076
- const leftHoverIndex = ref(-1);
21077
- const rightHoverIndex = ref(-1);
21078
- const typeFlag = computed(() => {
21079
- if (!props.sourceList || !Array.isArray(props.sourceList)) {
21080
- return "empty";
21081
- }
21082
- const str = props.sourceList.toString();
21083
- if (str.indexOf("[object Object]") !== -1) {
21084
- return true;
21085
- }
21086
- return false;
21087
- });
21088
- const settingCode = computed(() => {
21089
- if (!typeFlag.value) {
21090
- return "index";
21091
- }
21092
- return props.settingKey;
21093
- });
21094
- const displayCode = computed(() => {
21095
- if (!typeFlag.value) {
21096
- return "value";
21097
- }
21098
- return props.displayKey;
21099
- });
21100
- const displayDataList = computed(() => {
21101
- if (keyword.value) {
21102
- return dataList.value.filter((item) => !isEmpty(item[displayCode.value]) && String(item[displayCode.value]).indexOf(keyword.value) > -1);
21103
- }
21104
- return dataList.value;
21105
- });
21106
- watch(() => props.sourceList, () => {
21107
- if (typeFlag.value !== "empty") {
21108
- initData();
21109
- initSort();
21157
+ const sourceListType = computed(() => {
21158
+ if (Array.isArray(props.sourceList)) {
21159
+ const isObjectArray = props.sourceList.every((s2) => s2.toString().includes("[object Object]"));
21160
+ return isObjectArray ? ArrayType.OBJECT_ARRAY : ArrayType.BASE_ARRAY;
21161
+ }
21162
+ return ArrayType.NOT_ARRAY;
21163
+ });
21164
+ const settingCode = computed(() => sourceListType.value === ArrayType.BASE_ARRAY ? "value" : props.settingKey);
21165
+ const displayCode = computed(() => sourceListType.value === ArrayType.BASE_ARRAY ? "value" : props.displayKey);
21166
+ const sortCode = computed(() => props.sortKey || displayCode.value);
21167
+ const sourceData = computed(() => {
21168
+ switch (sourceListType.value) {
21169
+ case ArrayType.BASE_ARRAY:
21170
+ return [...new Set(props.sourceList)].map((s2) => ({
21171
+ value: s2
21172
+ }));
21173
+ case ArrayType.OBJECT_ARRAY:
21174
+ return [...props.sourceList];
21175
+ default:
21176
+ return [];
21110
21177
  }
21111
- }, {
21112
- deep: true
21113
- });
21114
- watch(() => props.targetList, () => {
21115
- initData();
21116
- initSort();
21117
- }, {
21118
- deep: true
21119
- });
21120
- watch(() => [displayCode.value, settingCode.value], () => {
21121
- initData();
21122
21178
  });
21123
- watch(() => props.sortKey, (value) => {
21124
- sortCode = value;
21125
- initSort();
21126
- });
21127
- watch(() => props.sortable, (value) => {
21128
- isSortFlag = value;
21129
- initSort();
21179
+ const {
21180
+ targetList
21181
+ } = toRefs(props);
21182
+ const {
21183
+ selectList,
21184
+ selectedList
21185
+ } = useTransferData(sourceData, targetList, settingCode);
21186
+ const {
21187
+ selectSearchQuery,
21188
+ selectListSearch
21189
+ } = useSelectListSearch(selectList, displayCode);
21190
+ const selectListSort = computed(() => {
21191
+ return [...selectListSearch.value].sort((a2, b2) => {
21192
+ const va = a2[sortCode.value];
21193
+ const vb = b2[sortCode.value];
21194
+ return va > vb ? 1 : -1;
21195
+ });
21130
21196
  });
21131
- const initData = () => {
21132
- if (typeFlag.value !== "empty") {
21133
- if (!typeFlag.value) {
21134
- generalInit();
21135
- } else {
21136
- init();
21137
- }
21138
- }
21139
- };
21140
- const generalInit = () => {
21141
- if (!props.targetList.length || props.targetList.length > props.sourceList.length) {
21142
- const list = [];
21143
- for (let i = 0; i < props.sourceList.length; i++) {
21144
- list.push({
21145
- index: i,
21146
- value: props.sourceList[i]
21147
- });
21148
- }
21149
- dataList.value = [...list];
21150
- hasSelectedList.value.splice(0, hasSelectedList.value.length, ...[]);
21151
- emit("change", dataList.value, [], []);
21152
- } else {
21153
- const list = [];
21154
- const valueList = [];
21155
- for (let i = 0; i < props.sourceList.length; i++) {
21156
- list.push({
21157
- index: i,
21158
- value: props.sourceList[i]
21159
- });
21160
- }
21161
- props.targetList.forEach((target) => {
21162
- const matchItem = list.find((val) => val.value === target);
21163
- if (matchItem) {
21164
- valueList.push(matchItem);
21165
- }
21166
- });
21167
- hasSelectedList.value = [...valueList];
21168
- const result = list.filter((item1) => valueList.every((item2) => item2.index !== item1.index));
21169
- dataList.value = [...result];
21170
- emit("change", dataList.value, [...handleListFormat(hasSelectedList.value, false)], []);
21171
- }
21172
- };
21173
- const init = () => {
21174
- if (!props.targetList.length || props.targetList.length > props.sourceList.length) {
21175
- dataList.value.splice(0, dataList.value.length, ...props.sourceList);
21176
- hasSelectedList.value = [];
21177
- emit("change", dataList.value, [], []);
21178
- } else {
21179
- const result = props.sourceList.filter((item1) => props.targetList.every((item2) => item2 !== item1[settingCode.value]));
21180
- const hasTempList = [];
21181
- props.sourceList.forEach((item1) => {
21182
- props.targetList.forEach((item2) => {
21183
- if (item1[settingCode.value] === item2) {
21184
- hasTempList.push(item1);
21185
- }
21186
- });
21187
- });
21188
- hasSelectedList.value = [...hasTempList];
21189
- dataList.value = [...result];
21190
- const list = [...handleListFormat(hasSelectedList.value)];
21191
- emit("change", dataList.value, hasSelectedList.value, list);
21192
- }
21193
- };
21194
- const initSort = () => {
21195
- let templateList = [];
21196
- if (!typeFlag.value) {
21197
- sortCode = isSortFlag ? "index" : "";
21198
- for (let k2 = 0; k2 < props.sourceList.length; k2++) {
21199
- templateList.push({
21200
- index: k2,
21201
- value: props.sourceList[k2]
21202
- });
21203
- }
21204
- } else {
21205
- if (!isSortFlag) {
21206
- sortCode = "";
21207
- }
21208
- templateList = [...props.sourceList];
21209
- }
21210
- if (sortCode) {
21211
- const arr = [];
21212
- templateList.forEach((item) => {
21213
- arr.push(item[sortCode]);
21214
- });
21215
- sortList = [...arr];
21216
- if (sortList.length === props.sourceList.length) {
21217
- const list = [...dataList.value];
21218
- dataList.value = [...sortDataList(list, sortCode, sortList)];
21219
- }
21220
- }
21221
- };
21222
- const handleItemChange = () => {
21223
- const sourceList = dataList.value;
21224
- const targetList = !typeFlag.value ? [...handleListFormat(hasSelectedList.value, false)] : hasSelectedList.value;
21225
- const targetValueList = !typeFlag.value ? [] : [...handleListFormat(hasSelectedList.value)];
21226
- emit("change", sourceList, targetList, targetValueList);
21227
- };
21228
- const handleListFormat = (list, objectType = true) => {
21229
- const templateList = [];
21230
- if (!list.length) {
21231
- return [];
21232
- }
21233
- const dataList2 = [...list];
21234
- dataList2.forEach((item) => {
21235
- if (objectType) {
21236
- for (const [key, value] of Object.entries(item)) {
21237
- if (key === settingCode.value) {
21238
- templateList.push(value);
21239
- }
21240
- }
21241
- } else {
21242
- templateList.push(item.value);
21243
- }
21197
+ const selectedListSort = computed(() => {
21198
+ return [...selectedList.value].sort((a2, b2) => {
21199
+ const va = a2[sortCode.value];
21200
+ const vb = b2[sortCode.value];
21201
+ return va > vb ? 1 : -1;
21244
21202
  });
21245
- return templateList;
21246
- };
21203
+ });
21247
21204
  const allToRight = () => {
21248
- leftHoverIndex.value = -1;
21249
- const curDisplayDataList = displayDataList.value;
21250
- const selectedList = hasSelectedList.value;
21251
- curDisplayDataList.forEach((transferItem) => {
21252
- selectedList.push(transferItem);
21253
- removeFromDataList(transferItem);
21254
- });
21255
- if (sortList.length === props.sourceList.length) {
21256
- hasSelectedList.value = [...sortDataList(selectedList, sortCode, sortList)];
21257
- } else {
21258
- hasSelectedList.value = [...selectedList];
21259
- }
21260
- handleItemChange();
21205
+ selectList.value = [];
21206
+ selectedList.value = [...sourceData.value];
21207
+ handleEmitUpdateTargetList();
21261
21208
  };
21262
21209
  const allToLeft = () => {
21263
- rightHoverIndex.value = -1;
21264
- const selectedList = hasSelectedList.value;
21265
- const curDataList = dataList.value;
21266
- while (selectedList.length) {
21267
- const transferItem = selectedList.shift();
21268
- curDataList.push(transferItem);
21269
- if (sortList.length === props.sourceList.length) {
21270
- dataList.value = [...sortDataList(curDataList, sortCode, sortList)];
21271
- } else {
21272
- dataList.value = [...curDataList];
21273
- }
21274
- }
21275
- handleItemChange();
21210
+ selectList.value = [...sourceData.value];
21211
+ selectedList.value = [];
21212
+ handleEmitUpdateTargetList();
21213
+ };
21214
+ const handleItemClick = (itemKey, isLeft) => {
21215
+ const from = isLeft ? selectList : selectedList;
21216
+ const to = isLeft ? selectedList : selectList;
21217
+ const index = from.value.findIndex((item) => item[settingCode.value] === itemKey);
21218
+ to.value.push(...from.value.splice(index, 1));
21219
+ handleEmitUpdateTargetList();
21220
+ };
21221
+ const handleEmitUpdateTargetList = () => {
21222
+ const restList = selectList.value.map((item) => item[settingCode.value]);
21223
+ const targetList2 = selectedList.value.map((item) => item[settingCode.value]);
21224
+ emit("update:targetList", targetList2);
21225
+ emit("change", sourceListType.value === ArrayType.BASE_ARRAY ? restList : selectList.value.map((v2) => toRaw(v2)), sourceListType.value === ArrayType.BASE_ARRAY ? targetList2 : selectedList.value.map((v2) => toRaw(v2)), targetList2);
21276
21226
  };
21277
- const sortDataList = (list, key, sortList2) => {
21278
- const arr = sortList2;
21279
- return list.sort((a2, b2) => arr.indexOf(a2[key]) - arr.indexOf(b2[key]) >= 0);
21280
- };
21281
- const removeFromDataList = (removeItem) => {
21282
- dataList.value = dataList.value.filter((item) => item[settingCode.value] !== removeItem[settingCode.value]);
21283
- };
21284
- const handleItemMouseEvent = (type, event, isLeft, index) => {
21285
- event.preventDefault();
21286
- event.stopPropagation();
21287
- const hoverIndex = type === "over" ? index : -1;
21288
- isLeft ? leftHoverIndex.value = hoverIndex : rightHoverIndex.value = hoverIndex;
21289
- };
21290
- const handleItemClick = (event, index, isLeft) => {
21291
- event.preventDefault();
21292
- event.stopPropagation();
21293
- isLeft ? leftHoverIndex.value = -1 : rightHoverIndex.value = -1;
21294
- const transferItem = isLeft ? displayDataList.value[index] : hasSelectedList.value.splice(index, 1)[0];
21295
- const selectedList = isLeft ? hasSelectedList.value : dataList.value;
21296
- selectedList.push(transferItem);
21297
- isLeft && removeFromDataList(transferItem);
21298
- const newList = sortList.length === props.sourceList.length ? [...sortDataList(selectedList, sortCode, sortList)] : [...selectedList];
21299
- isLeft ? hasSelectedList.value = [...newList] : dataList.value = [...newList];
21300
- handleItemChange();
21301
- };
21302
- if (typeFlag.value !== "empty") {
21303
- if (!typeFlag.value) {
21304
- generalInit();
21305
- } else {
21306
- init();
21307
- }
21308
- initSort();
21309
- }
21310
21227
  return {
21311
- keyword,
21312
- transferRef,
21313
- dataList,
21228
+ selectSearchQuery,
21229
+ selectListSearch,
21230
+ selectedList,
21231
+ selectListSort,
21232
+ selectedListSort,
21233
+ settingCode,
21234
+ displayCode,
21314
21235
  allToRight,
21315
21236
  allToLeft,
21316
- displayDataList,
21317
- displayCode,
21318
- leftHoverIndex,
21319
- rightHoverIndex,
21320
- handleItemMouseEvent,
21321
- handleItemClick,
21322
- hasSelectedList
21237
+ handleItemClick
21323
21238
  };
21324
21239
  },
21325
21240
  render() {
21326
- const {
21327
- extCls,
21328
- title,
21329
- emptyContent,
21330
- searchable,
21331
- searchPlaceholder
21332
- } = this.$props;
21241
+ const leftList = this.sortable ? this.selectListSort : this.selectListSearch;
21242
+ const rightList = this.sortable ? this.selectedListSort : this.selectedList;
21333
21243
  const getHeaderHtml = (dirct) => {
21334
21244
  var _a, _b;
21335
21245
  const isLeft = dirct === "left-header";
21336
- const titleText = isLeft ? `${(_a = title[0]) != null ? _a : "\u5DE6\u4FA7\u5217\u8868"}` : `${(_b = title[1]) != null ? _b : "\u53F3\u4FA7\u5217\u8868"}`;
21337
- const isDisabled = isLeft ? !this.dataList.length : !this.hasSelectedList.length;
21246
+ const titleText = isLeft ? `${(_a = this.title[0]) != null ? _a : "\u5DE6\u4FA7\u5217\u8868"}` : `${(_b = this.title[1]) != null ? _b : "\u53F3\u4FA7\u5217\u8868"}`;
21247
+ const isDisabled = isLeft ? !leftList.length : !rightList.length;
21338
21248
  const headerClick = () => {
21339
- if (isLeft && this.dataList.length) {
21340
- this.allToRight();
21341
- }
21342
- if (!isLeft && this.hasSelectedList.length) {
21343
- this.allToLeft();
21344
- }
21249
+ if (isDisabled)
21250
+ return;
21251
+ isLeft ? this.allToRight() : this.allToLeft();
21345
21252
  };
21346
21253
  return this.$slots[dirct] ? createVNode("div", {
21347
21254
  "class": "slot-header"
21348
21255
  }, [this.$slots[dirct]()]) : createVNode("div", {
21349
21256
  "class": "header"
21350
- }, [`${titleText}\uFF08\u5171${this.dataList.length}\u6761\uFF09`, createVNode("span", {
21257
+ }, [`${titleText}\uFF08\u5171${isLeft ? leftList.length : rightList.length}\u6761\uFF09`, createVNode("span", {
21351
21258
  "class": {
21352
21259
  disabled: isDisabled
21353
21260
  },
@@ -21357,20 +21264,19 @@ var Component$4 = defineComponent({
21357
21264
  const getEmptyHtml = (dirct) => {
21358
21265
  var _a;
21359
21266
  const isLeft = dirct === "left-empty-content";
21360
- const emptyText = (_a = isLeft ? emptyContent[0] : emptyContent[1]) != null ? _a : isLeft ? "\u65E0\u6570\u636E" : "\u672A\u9009\u62E9\u4EFB\u4F55\u9879";
21267
+ const emptyText = (_a = isLeft ? this.emptyContent[0] : this.emptyContent[1]) != null ? _a : isLeft ? "\u65E0\u6570\u636E" : "\u672A\u9009\u62E9\u4EFB\u4F55\u9879";
21361
21268
  return this.$slots[dirct] ? createVNode("div", null, [this.$slots[dirct]()]) : createVNode("div", {
21362
21269
  "class": "empty"
21363
21270
  }, [emptyText]);
21364
21271
  };
21365
- const getDefaultListHtml = (item, index, isLeft = true) => {
21366
- const hoverIndex = isLeft ? this.leftHoverIndex : this.rightHoverIndex;
21272
+ const getDefaultListHtml = (item, isLeft = true) => {
21367
21273
  return createVNode("div", {
21368
21274
  "class": "item-content"
21369
21275
  }, [createVNode("span", {
21370
21276
  "class": "content-text",
21371
21277
  "title": item[this.displayCode]
21372
21278
  }, [item[this.displayCode]]), createVNode("span", {
21373
- "class": ["icon-wrapper", index === hoverIndex ? "hover" : ""]
21279
+ "class": "icon-wrapper"
21374
21280
  }, [isLeft ? createVNode(arrowsRight, {
21375
21281
  "class": "bk-icon"
21376
21282
  }, null) : createVNode(error, {
@@ -21379,33 +21285,30 @@ var Component$4 = defineComponent({
21379
21285
  };
21380
21286
  const getListContentHtml = (dirct) => {
21381
21287
  const isLeft = dirct === "left";
21382
- const list = isLeft ? this.displayDataList : this.hasSelectedList;
21288
+ const list = isLeft ? leftList : rightList;
21383
21289
  const slotName = isLeft ? "source-option" : "target-option";
21384
21290
  const emptySlotName = isLeft ? "left-empty-content" : "right-empty-content";
21385
21291
  return list.length ? createVNode("ul", {
21386
- "class": ["content", searchable && isLeft ? "is-search" : ""]
21387
- }, [list.map((item, index) => {
21292
+ "class": ["content", this.searchable && isLeft ? "is-search" : ""]
21293
+ }, [list.map((item) => {
21388
21294
  var _a, _b, _c;
21389
21295
  return createVNode("li", {
21390
- "key": index,
21391
- "class": [!!this.$slots[slotName] ? "custom-item" : ""],
21392
- "onClick": (event) => this.handleItemClick(event, index, isLeft),
21393
- "onMouseover": (event) => this.handleItemMouseEvent("over", event, isLeft, index),
21394
- "onMouseleave": (event) => this.handleItemMouseEvent("leave", event, isLeft, index)
21395
- }, [(_c = (_b = (_a = this.$slots)[slotName]) == null ? void 0 : _b.call(_a, item)) != null ? _c : getDefaultListHtml(item, index, isLeft)]);
21296
+ "key": item[this.settingCode],
21297
+ "class": [this.$slots[slotName] ? "custom-item" : ""],
21298
+ "onClick": () => this.handleItemClick(item[this.settingCode], isLeft)
21299
+ }, [(_c = (_b = (_a = this.$slots)[slotName]) == null ? void 0 : _b.call(_a, item)) != null ? _c : getDefaultListHtml(item, isLeft)]);
21396
21300
  })]) : getEmptyHtml(emptySlotName);
21397
21301
  };
21398
21302
  return createVNode("div", {
21399
- "class": ["bk-transfer", extCls],
21400
- "ref": "transferRef"
21303
+ "class": ["bk-transfer", this.extCls]
21401
21304
  }, [createVNode("div", {
21402
21305
  "class": "source-list"
21403
- }, [getHeaderHtml("left-header"), searchable && createVNode(BkInput, {
21404
- "modelValue": this.keyword,
21405
- "onUpdate:modelValue": ($event) => this.keyword = $event,
21306
+ }, [getHeaderHtml("left-header"), this.searchable && createVNode(BkInput, {
21307
+ "modelValue": this.selectSearchQuery,
21308
+ "onUpdate:modelValue": ($event) => this.selectSearchQuery = $event,
21406
21309
  "class": "transfer-search-input",
21407
21310
  "clearable": true,
21408
- "placeholder": searchPlaceholder || "\u8BF7\u8F93\u5165\u641C\u7D22\u5173\u952E\u5B57",
21311
+ "placeholder": this.searchPlaceholder || "\u8BF7\u8F93\u5165\u641C\u7D22\u5173\u952E\u5B57",
21409
21312
  "type": "search",
21410
21313
  "left-icon": "bk-icon icon-search"
21411
21314
  }, null), getListContentHtml("left")]), createVNode("div", {
@@ -21505,7 +21408,7 @@ const treeProps = {
21505
21408
  draggable: PropTypes.bool.def(false),
21506
21409
  dragSort: PropTypes.bool.def(false),
21507
21410
  selectable: PropTypes.bool.def(true),
21508
- selected: PropTypes.oneOfType([PropTypes.string, PropTypes.number, PropTypes.object]).def(null),
21411
+ selected: PropTypes.oneOfType([PropTypes.string, null, PropTypes.number, PropTypes.object]).def(null),
21509
21412
  autoCheckChildren: PropTypes.bool.def(true)
21510
21413
  };
21511
21414
  var useEmpty = (props, {
@@ -22739,15 +22642,12 @@ var ComposeFormItem = defineComponent({
22739
22642
  }, childrenArr);
22740
22643
  }
22741
22644
  });
22742
- const formKey$1 = Symbol("form");
22743
- const getFormKey = () => formKey$1;
22744
- const formKey = getFormKey();
22745
22645
  const formProps = {
22746
22646
  formType: PropTypes.oneOf(["default", "vertical"]).def("default"),
22747
22647
  labelWidth: PropTypes.oneOfType([Number, String]),
22748
22648
  labelPosition: PropTypes.oneOf(["left", "center", "right"]),
22749
22649
  model: PropTypes.object,
22750
- rules: PropTypes.array
22650
+ rules: PropTypes.object
22751
22651
  };
22752
22652
  var Form = defineComponent({
22753
22653
  name: "Form",
@@ -22831,9 +22731,9 @@ var Form = defineComponent({
22831
22731
  }, [(_b = (_a = this.$slots).default) == null ? void 0 : _b.call(_a)]);
22832
22732
  }
22833
22733
  });
22834
- var validator = {
22734
+ var defaultValidator = {
22835
22735
  required: (value) => {
22836
- console.log("required");
22736
+ console.log("required", value, value !== "" && value !== void 0 && value !== null);
22837
22737
  return value !== "" && value !== void 0 && value !== null;
22838
22738
  },
22839
22739
  min: (value, min2) => {
@@ -22851,6 +22751,10 @@ var validator = {
22851
22751
  maxlength: (value, maxlength) => {
22852
22752
  console.log("maxlength");
22853
22753
  return value.length <= maxlength;
22754
+ },
22755
+ pattern: (value, pattern) => {
22756
+ console.log("pattern");
22757
+ return pattern.test(value);
22854
22758
  }
22855
22759
  };
22856
22760
  const formItemProps = {
@@ -22873,35 +22777,35 @@ const getRulesFromProps = (props) => {
22873
22777
  const rules = [];
22874
22778
  if (props.required) {
22875
22779
  rules.push({
22876
- validator: validator.required,
22780
+ validator: defaultValidator.required,
22877
22781
  message: `${props.label}\u4E0D\u80FD\u4E3A\u7A7A`,
22878
22782
  trigger: "blur"
22879
22783
  });
22880
22784
  }
22881
22785
  if (props.email) {
22882
22786
  rules.push({
22883
- validator: validator.email,
22787
+ validator: defaultValidator.email,
22884
22788
  message: `${props.label}\u683C\u5F0F\u4E0D\u6B63\u786E`,
22885
22789
  trigger: "blur"
22886
22790
  });
22887
22791
  }
22888
22792
  if (Number(props.max) > -1) {
22889
22793
  rules.push({
22890
- validator: (value) => validator.max(value, props.max),
22794
+ validator: (value) => defaultValidator.max(value, props.max),
22891
22795
  message: `${props.label}\u6700\u5927\u503C${props.max}`,
22892
22796
  trigger: "blur"
22893
22797
  });
22894
22798
  }
22895
22799
  if (Number(props.min) > -1) {
22896
22800
  rules.push({
22897
- validator: (value) => validator.min(value, props.min),
22801
+ validator: (value) => defaultValidator.min(value, props.min),
22898
22802
  message: `${props.label}\u6700\u5C0F\u503C${props.min}`,
22899
22803
  trigger: "blur"
22900
22804
  });
22901
22805
  }
22902
22806
  if (Number(props.maxlength) > -1) {
22903
22807
  rules.push({
22904
- validator: (value) => validator.maxlength(value, props.maxlength),
22808
+ validator: (value) => defaultValidator.maxlength(value, props.maxlength),
22905
22809
  message: `${props.label}\u6700\u5927\u957F\u5EA6${props.maxlength}`,
22906
22810
  trigger: "blur"
22907
22811
  });
@@ -22909,27 +22813,32 @@ const getRulesFromProps = (props) => {
22909
22813
  return rules;
22910
22814
  };
22911
22815
  const mergeRules = (configRules, propsRules) => {
22912
- const formatConfigRules = configRules.map((rule) => {
22816
+ const formatConfigRules = configRules.reduce((result, rule) => {
22913
22817
  let rulevalidator;
22914
22818
  if (rule.required) {
22915
- rulevalidator = validator.required;
22819
+ rulevalidator = defaultValidator.required;
22916
22820
  } else if (rule.email) {
22917
- rulevalidator = validator.email;
22821
+ rulevalidator = defaultValidator.email;
22918
22822
  } else if (Number(rule.max) > -1) {
22919
- rulevalidator = (value) => validator.max(value, rule.max);
22823
+ rulevalidator = (value) => defaultValidator.max(value, rule.max);
22920
22824
  } else if (Number(rule.min) > -1) {
22921
- rulevalidator = (value) => validator.min(value, rule.max);
22825
+ rulevalidator = (value) => defaultValidator.min(value, rule.max);
22922
22826
  } else if (Number(rule.maxlength) > -1) {
22923
- rulevalidator = (value) => validator.min(value, rule.max);
22827
+ rulevalidator = (value) => defaultValidator.min(value, rule.max);
22828
+ } else if (Object.prototype.toString.call(rule.pattern) === "[object RegExp]") {
22829
+ rulevalidator = (value) => defaultValidator.pattern(value, rule.pattern);
22830
+ } else if (Object.prototype.toString.call(rule.validator) === "[object Function]") {
22831
+ rulevalidator = rule.validator;
22924
22832
  } else {
22925
- rulevalidator = () => true;
22833
+ return result;
22926
22834
  }
22927
- return {
22835
+ result.push({
22928
22836
  validator: rulevalidator,
22929
22837
  message: rule.message,
22930
22838
  trigger: rule.trigger
22931
- };
22932
- });
22839
+ });
22840
+ return result;
22841
+ }, []);
22933
22842
  return [...propsRules, ...formatConfigRules];
22934
22843
  };
22935
22844
  const getTriggerRules = (trigger, rules) => rules.reduce((result, rule) => {
@@ -22956,7 +22865,7 @@ var FormItem = defineComponent({
22956
22865
  isError: false,
22957
22866
  errorMessage: ""
22958
22867
  });
22959
- const form2 = inject(formKey);
22868
+ const form2 = useForm();
22960
22869
  const isForm = Boolean(form2);
22961
22870
  const labelStyles = computed(() => {
22962
22871
  const styles = {
@@ -22989,6 +22898,7 @@ var FormItem = defineComponent({
22989
22898
  rules = props.rules;
22990
22899
  }
22991
22900
  rules = getTriggerRules(trigger, mergeRules(rules, getRulesFromProps(props)));
22901
+ console.log(rules);
22992
22902
  const value = form2.props.model[props.property];
22993
22903
  const doValidate = (() => {
22994
22904
  let stepIndex = -1;
@@ -23022,6 +22932,10 @@ var FormItem = defineComponent({
23022
22932
  state.isError = false;
23023
22933
  state.errorMessage = "";
23024
22934
  };
22935
+ provide(formItemKey, __spreadProps(__spreadValues({}, props), {
22936
+ validate,
22937
+ clearValidate
22938
+ }));
23025
22939
  onMounted(() => {
23026
22940
  if (isForm) {
23027
22941
  form2.register(currentInstance.proxy);