bkui-vue 0.0.1-beta.426 → 0.0.1-beta.428

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -17488,10 +17488,11 @@ const tableProps = {
17488
17488
  var Column = defineComponent({
17489
17489
  name: "TableColumn",
17490
17490
  props: __spreadProps(__spreadValues({}, IColumnType), {
17491
- prop: PropTypes.oneOfType([PropTypes.func.def(() => ""), PropTypes.string.def("")])
17491
+ prop: PropTypes.oneOfType([PropTypes.func.def(() => ""), PropTypes.string.def("")]),
17492
+ index: PropTypes.number.def(void 0)
17492
17493
  }),
17493
17494
  setup(props2) {
17494
- const initColumns = inject(PROVIDE_KEY_INIT_COL, (_column, _remove = false) => {
17495
+ const initColumns = inject(PROVIDE_KEY_INIT_COL, (_col, _rm = false) => {
17495
17496
  }, false);
17496
17497
  const bkTableCache = inject(PROVIDE_KEY_TB_CACHE, {
17497
17498
  queueStack: (_2, fn2) => fn2 == null ? void 0 : fn2()
@@ -17506,13 +17507,20 @@ var Column = defineComponent({
17506
17507
  };
17507
17508
  },
17508
17509
  unmounted() {
17509
- this.updateColumnDefine();
17510
+ this.updateColumnDefine(true);
17510
17511
  },
17511
17512
  mounted() {
17512
17513
  this.updateColumnDefine();
17513
17514
  },
17514
17515
  methods: {
17515
- updateColumnDefine() {
17516
+ updateColumnDefine(unmounted = false) {
17517
+ if (this.$props.index !== void 0 && typeof this.$props.index === "number") {
17518
+ this.updateColumnDefineByIndex(unmounted);
17519
+ return;
17520
+ }
17521
+ this.updateColumnDefineByParent();
17522
+ },
17523
+ updateColumnDefineByParent() {
17516
17524
  const fn2 = () => {
17517
17525
  const selfVnode = this._;
17518
17526
  const colList = selfVnode.parent.vnode.children.default() || [];
@@ -17543,6 +17551,13 @@ var Column = defineComponent({
17543
17551
  if (typeof this.bkTableCache.queueStack === "function") {
17544
17552
  this.bkTableCache.queueStack(BK_COLUMN_UPDATE_DEFINE, fn2);
17545
17553
  }
17554
+ },
17555
+ updateColumnDefineByIndex(unmounted = false) {
17556
+ const resolveProp = __spreadProps(__spreadValues({}, this.$props), {
17557
+ field: this.$props.prop || this.$props.field,
17558
+ render: this.$slots.default
17559
+ });
17560
+ this.initColumns(unref(resolveProp), unmounted);
17546
17561
  }
17547
17562
  },
17548
17563
  render() {
@@ -20139,15 +20154,27 @@ var useColumn = (props2, targetColumns) => {
20139
20154
  resolveColumns = column;
20140
20155
  }
20141
20156
  if (!remove) {
20142
- const resetColumns = resolveColumns.map((col) => {
20143
- const exist = targetColumns.find((tc) => tc.label === col.label && tc.field === col.field);
20144
- if (exist) {
20145
- return exist;
20157
+ let needToSort = false;
20158
+ resolveColumns.forEach((col) => {
20159
+ if (col.index !== void 0 && col.index >= 0) {
20160
+ needToSort = true;
20161
+ const oldIndex = targetColumns.findIndex((tc) => tc.label === col.label && tc.field === col.field);
20162
+ if (oldIndex >= 0) {
20163
+ targetColumns.splice(oldIndex, 1);
20164
+ }
20165
+ targetColumns.push(col);
20166
+ } else {
20167
+ const index2 = targetColumns.findIndex((tc) => tc.label === col.label && tc.field === col.field);
20168
+ if (index2 >= 0) {
20169
+ targetColumns.splice(index2, 1, col);
20170
+ } else {
20171
+ targetColumns.push(col);
20172
+ }
20146
20173
  }
20147
- return unref(col);
20148
20174
  });
20149
- targetColumns.length = 0;
20150
- targetColumns.push(...resetColumns);
20175
+ if (needToSort) {
20176
+ targetColumns.sort((col1, col2) => col1.index - col2.index);
20177
+ }
20151
20178
  } else {
20152
20179
  resolveColumns.forEach((col) => {
20153
20180
  const matchColIndex = targetColumns.findIndex((c2) => c2.label === col.label && c2.field === col.field);
@@ -21351,6 +21378,7 @@ const tagProps = () => ({
21351
21378
  allowNextFocus: PropTypes.bool.def(true),
21352
21379
  allowAutoMatch: PropTypes.bool.def(false),
21353
21380
  showClearOnlyHover: PropTypes.bool.def(false),
21381
+ isAsyncList: PropTypes.bool.def(false),
21354
21382
  leftSpace: PropTypes.number.def(0),
21355
21383
  createTagValidator: {
21356
21384
  type: Function
@@ -21624,7 +21652,8 @@ var Component$e = defineComponent({
21624
21652
  modelValue,
21625
21653
  displayKey,
21626
21654
  allowCreate,
21627
- trigger
21655
+ trigger,
21656
+ isAsyncList
21628
21657
  } = props2;
21629
21658
  listState.selectedTagList = [];
21630
21659
  listState.localList = flatList.value;
@@ -21645,6 +21674,13 @@ var Component$e = defineComponent({
21645
21674
  listState.localList = listState.localList.filter((val) => !modelValueMap[val[saveKey]]);
21646
21675
  }
21647
21676
  }
21677
+ if (isAsyncList && curInputValue.value) {
21678
+ filterData(curInputValue.value);
21679
+ if (pageState.curPageList.length) {
21680
+ popoverProps.isShow = true;
21681
+ }
21682
+ return;
21683
+ }
21648
21684
  if (trigger === "focus") {
21649
21685
  filterData();
21650
21686
  }
@@ -32338,23 +32374,7 @@ var Component$8 = defineComponent({
32338
32374
  }), [[resolveDirective("bk-tooltips"), collapseTooltip.join(", ")]])]);
32339
32375
  };
32340
32376
  const textRender = () => this.multiple ? null : createVNode("span", null, [this.selectedText]);
32341
- return createVNode("div", {
32342
- "class": [resolveClassName("cascader-wrapper"), this.floatMode ? "float-mode" : ""]
32343
- }, [createVNode("div", {
32344
- "class": [resolveClassName("cascader"), this.extCls, {
32345
- "is-unselected": this.modelValue.length === 0,
32346
- "is-hover": this.isHover,
32347
- "is-filterable": this.filterable,
32348
- "is-focus": this.isFocus,
32349
- "is-disabled": this.disabled,
32350
- "is-simplicity": this.behavior === "simplicity"
32351
- }],
32352
- "tabindex": "0",
32353
- "data-placeholder": this.placeholder,
32354
- "onMouseenter": this.setHover,
32355
- "onMouseleave": this.cancelHover,
32356
- "ref": "bkCascaderRef"
32357
- }, [suffixIcon(), createVNode(BkPopover, {
32377
+ const popoverRender = () => createVNode(BkPopover, {
32358
32378
  "placement": "bottom-start",
32359
32379
  "theme": `light ${resolveClassName("cascader-popover")}`,
32360
32380
  "trigger": "click",
@@ -32366,7 +32386,9 @@ var Component$8 = defineComponent({
32366
32386
  "onAfterShow": this.popoverChangeEmitter,
32367
32387
  "boundary": "body"
32368
32388
  }, {
32369
- default: () => createVNode("div", {
32389
+ default: () => this.$slots.trigger ? this.$slots.trigger({
32390
+ selected: this.modelValue
32391
+ }) : createVNode("div", {
32370
32392
  "class": [resolveClassName("cascader-name"), "bk-scroll-y"]
32371
32393
  }, [this.multiple && this.selectedTags.length > 0 && renderTags(), this.filterable ? (this.isCollapse || this.selectedTags.length === 0) && createVNode("input", {
32372
32394
  "class": [resolveClassName("cascader-search-input"), {
@@ -32397,7 +32419,24 @@ var Component$8 = defineComponent({
32397
32419
  "class": resolveClassName("cascader-node-name")
32398
32420
  }, [scope.node.name])
32399
32421
  })])
32400
- })])]);
32422
+ });
32423
+ return createVNode("div", {
32424
+ "class": [resolveClassName("cascader-wrapper"), this.floatMode ? "float-mode" : ""]
32425
+ }, [this.$slots.trigger ? popoverRender() : createVNode("div", {
32426
+ "class": [resolveClassName("cascader"), this.extCls, {
32427
+ "is-unselected": this.modelValue.length === 0,
32428
+ "is-hover": this.isHover,
32429
+ "is-filterable": this.filterable,
32430
+ "is-focus": this.isFocus,
32431
+ "is-disabled": this.disabled,
32432
+ "is-simplicity": this.behavior === "simplicity"
32433
+ }],
32434
+ "tabindex": "0",
32435
+ "data-placeholder": this.placeholder,
32436
+ "onMouseenter": this.setHover,
32437
+ "onMouseleave": this.cancelHover,
32438
+ "ref": "bkCascaderRef"
32439
+ }, [suffixIcon(), popoverRender()])]);
32401
32440
  }
32402
32441
  });
32403
32442
  const BkCascader = withInstallProps(Component$8, { CascaderPanel });