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

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);
@@ -32338,23 +32365,7 @@ var Component$8 = defineComponent({
32338
32365
  }), [[resolveDirective("bk-tooltips"), collapseTooltip.join(", ")]])]);
32339
32366
  };
32340
32367
  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, {
32368
+ const popoverRender = () => createVNode(BkPopover, {
32358
32369
  "placement": "bottom-start",
32359
32370
  "theme": `light ${resolveClassName("cascader-popover")}`,
32360
32371
  "trigger": "click",
@@ -32366,7 +32377,9 @@ var Component$8 = defineComponent({
32366
32377
  "onAfterShow": this.popoverChangeEmitter,
32367
32378
  "boundary": "body"
32368
32379
  }, {
32369
- default: () => createVNode("div", {
32380
+ default: () => this.$slots.trigger ? this.$slots.trigger({
32381
+ selected: this.modelValue
32382
+ }) : createVNode("div", {
32370
32383
  "class": [resolveClassName("cascader-name"), "bk-scroll-y"]
32371
32384
  }, [this.multiple && this.selectedTags.length > 0 && renderTags(), this.filterable ? (this.isCollapse || this.selectedTags.length === 0) && createVNode("input", {
32372
32385
  "class": [resolveClassName("cascader-search-input"), {
@@ -32397,7 +32410,24 @@ var Component$8 = defineComponent({
32397
32410
  "class": resolveClassName("cascader-node-name")
32398
32411
  }, [scope.node.name])
32399
32412
  })])
32400
- })])]);
32413
+ });
32414
+ return createVNode("div", {
32415
+ "class": [resolveClassName("cascader-wrapper"), this.floatMode ? "float-mode" : ""]
32416
+ }, [this.$slots.trigger ? popoverRender() : createVNode("div", {
32417
+ "class": [resolveClassName("cascader"), this.extCls, {
32418
+ "is-unselected": this.modelValue.length === 0,
32419
+ "is-hover": this.isHover,
32420
+ "is-filterable": this.filterable,
32421
+ "is-focus": this.isFocus,
32422
+ "is-disabled": this.disabled,
32423
+ "is-simplicity": this.behavior === "simplicity"
32424
+ }],
32425
+ "tabindex": "0",
32426
+ "data-placeholder": this.placeholder,
32427
+ "onMouseenter": this.setHover,
32428
+ "onMouseleave": this.cancelHover,
32429
+ "ref": "bkCascaderRef"
32430
+ }, [suffixIcon(), popoverRender()])]);
32401
32431
  }
32402
32432
  });
32403
32433
  const BkCascader = withInstallProps(Component$8, { CascaderPanel });