@weitutech/by-components 1.1.132 → 1.1.134

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.
@@ -60524,6 +60524,7 @@ __webpack_require__.d(__webpack_exports__, {
60524
60524
  ByForm: function() { return /* reexport */ form_form; },
60525
60525
  ByPageSearch: function() { return /* reexport */ page_search; },
60526
60526
  ByPager: function() { return /* reexport */ pager; },
60527
+ ByPopoverSelector: function() { return /* reexport */ ByPopoverSelector; },
60527
60528
  BySelect: function() { return /* reexport */ comps_select; },
60528
60529
  ByTable: function() { return /* reexport */ table; },
60529
60530
  ByToolBar: function() { return /* reexport */ ByToolBar; },
@@ -80284,6 +80285,420 @@ var ByFloatingMenu_component = normalizeComponent(
80284
80285
  )
80285
80286
 
80286
80287
  /* harmony default export */ var ByFloatingMenu = (ByFloatingMenu_component.exports);
80288
+ ;// ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"ffbc40de-vue-loader-template"}!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/templateLoader.js??ruleSet[1].rules[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/popover-selector/ByPopoverSelector.vue?vue&type=template&id=686db86e&scoped=true
80289
+ var ByPopoverSelectorvue_type_template_id_686db86e_scoped_true_render = function render() {
80290
+ var _vm = this,
80291
+ _c = _vm._self._c;
80292
+ return _c('div', {
80293
+ staticClass: "by-popover-selector"
80294
+ }, [_c('el-popover', {
80295
+ ref: "popover",
80296
+ attrs: {
80297
+ "placement": _vm.placement,
80298
+ "width": _vm.popoverWidth,
80299
+ "trigger": "click",
80300
+ "disabled": _vm.disabled,
80301
+ "popper-class": "by-popover-selector-popover"
80302
+ },
80303
+ on: {
80304
+ "show": _vm.handleShow,
80305
+ "hide": _vm.handleHide
80306
+ },
80307
+ model: {
80308
+ value: _vm.visible,
80309
+ callback: function ($$v) {
80310
+ _vm.visible = $$v;
80311
+ },
80312
+ expression: "visible"
80313
+ }
80314
+ }, [_c('div', {
80315
+ staticClass: "popover-content"
80316
+ }, [_vm.title ? _c('div', {
80317
+ staticClass: "popover-title"
80318
+ }, [_vm._v(" " + _vm._s(_vm.title) + " ")]) : _vm._e(), _c('div', {
80319
+ staticClass: "options-container",
80320
+ class: {
80321
+ 'multi-column': _vm.isMultiColumn
80322
+ }
80323
+ }, [!_vm.multiple ? _c('el-radio-group', {
80324
+ staticClass: "options-group",
80325
+ on: {
80326
+ "change": _vm.handleSingleChange
80327
+ },
80328
+ model: {
80329
+ value: _vm.selectedValue,
80330
+ callback: function ($$v) {
80331
+ _vm.selectedValue = $$v;
80332
+ },
80333
+ expression: "selectedValue"
80334
+ }
80335
+ }, _vm._l(_vm.displayOptions, function (item, index) {
80336
+ return _c('div', {
80337
+ key: item.id || item.value || index,
80338
+ staticClass: "option-item",
80339
+ class: {
80340
+ 'disabled': item.disabled
80341
+ }
80342
+ }, [_c('el-radio', {
80343
+ staticClass: "option-radio",
80344
+ attrs: {
80345
+ "label": item.id || item.value,
80346
+ "disabled": item.disabled
80347
+ }
80348
+ }, [_vm._v(" " + _vm._s(item.name || item.label) + " ")])], 1);
80349
+ }), 0) : _c('el-checkbox-group', {
80350
+ staticClass: "options-group",
80351
+ on: {
80352
+ "change": _vm.handleMultipleChange
80353
+ },
80354
+ model: {
80355
+ value: _vm.selectedValues,
80356
+ callback: function ($$v) {
80357
+ _vm.selectedValues = $$v;
80358
+ },
80359
+ expression: "selectedValues"
80360
+ }
80361
+ }, _vm._l(_vm.displayOptions, function (item, index) {
80362
+ return _c('div', {
80363
+ key: item.id || item.value || index,
80364
+ staticClass: "option-item",
80365
+ class: {
80366
+ 'disabled': item.disabled
80367
+ }
80368
+ }, [_c('el-checkbox', {
80369
+ staticClass: "option-checkbox",
80370
+ attrs: {
80371
+ "label": item.id || item.value,
80372
+ "disabled": item.disabled
80373
+ }
80374
+ }, [_vm._v(" " + _vm._s(item.name || item.label) + " ")])], 1);
80375
+ }), 0)], 1), _c('div', {
80376
+ staticClass: "popover-footer"
80377
+ }, [_c('el-button', {
80378
+ attrs: {
80379
+ "size": "small"
80380
+ },
80381
+ on: {
80382
+ "click": _vm.handleCancel
80383
+ }
80384
+ }, [_vm._v(" " + _vm._s(_vm.cancelText) + " ")]), _c('el-button', {
80385
+ staticClass: "confirm-button",
80386
+ staticStyle: {
80387
+ "min-width": "60px !important",
80388
+ "height": "32px !important",
80389
+ "visibility": "visible !important",
80390
+ "display": "inline-block !important",
80391
+ "opacity": "1 !important",
80392
+ "background-color": "#409eff !important",
80393
+ "border-color": "#409eff !important",
80394
+ "color": "#ffffff !important"
80395
+ },
80396
+ attrs: {
80397
+ "type": _vm.hasSelection ? 'primary' : 'default',
80398
+ "size": "small",
80399
+ "disabled": !_vm.hasSelection
80400
+ },
80401
+ on: {
80402
+ "click": _vm.handleConfirm
80403
+ }
80404
+ }, [_vm._v(" " + _vm._s(_vm.confirmText) + " ")])], 1)]), _c('el-button', {
80405
+ class: ['trigger-button', {
80406
+ 'tiny-button': _vm.tiny
80407
+ }],
80408
+ attrs: {
80409
+ "slot": "reference",
80410
+ "type": _vm.buttonType,
80411
+ "plain": "",
80412
+ "size": _vm.tiny ? 'mini' : _vm.buttonSize,
80413
+ "disabled": _vm.disabled,
80414
+ "loading": _vm.loading
80415
+ },
80416
+ slot: "reference"
80417
+ }, [_vm._v(" " + _vm._s(_vm.dynamicButtonText) + " ")])], 1)], 1);
80418
+ };
80419
+ var ByPopoverSelectorvue_type_template_id_686db86e_scoped_true_staticRenderFns = [];
80420
+
80421
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-82.use[1]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/popover-selector/ByPopoverSelector.vue?vue&type=script&lang=js
80422
+
80423
+
80424
+
80425
+
80426
+ /* harmony default export */ var ByPopoverSelectorvue_type_script_lang_js = ({
80427
+ name: 'ByPopoverSelector',
80428
+ props: {
80429
+ // 数据源
80430
+ options: {
80431
+ type: Array,
80432
+ default: () => []
80433
+ },
80434
+ // 当前选中的值(单选)
80435
+ value: {
80436
+ type: [String, Number],
80437
+ default: null
80438
+ },
80439
+ // 当前选中的值(多选)
80440
+ values: {
80441
+ type: Array,
80442
+ default: () => []
80443
+ },
80444
+ // 是否多选
80445
+ multiple: {
80446
+ type: Boolean,
80447
+ default: false
80448
+ },
80449
+ // 弹出层标题
80450
+ title: {
80451
+ type: String,
80452
+ default: ''
80453
+ },
80454
+ // 按钮文本
80455
+ buttonText: {
80456
+ type: String,
80457
+ default: '选择'
80458
+ },
80459
+ // 按钮类型
80460
+ buttonType: {
80461
+ type: String,
80462
+ default: 'default'
80463
+ },
80464
+ // 按钮尺寸
80465
+ buttonSize: {
80466
+ type: String,
80467
+ default: 'small'
80468
+ },
80469
+ // 是否使用超小按钮
80470
+ tiny: {
80471
+ type: Boolean,
80472
+ default: false
80473
+ },
80474
+ // 弹出层位置
80475
+ placement: {
80476
+ type: String,
80477
+ default: 'bottom-start'
80478
+ },
80479
+ // 弹出层宽度
80480
+ popoverWidth: {
80481
+ type: [String, Number],
80482
+ default: 300
80483
+ },
80484
+ // 是否禁用
80485
+ disabled: {
80486
+ type: Boolean,
80487
+ default: false
80488
+ },
80489
+ // 是否加载中
80490
+ loading: {
80491
+ type: Boolean,
80492
+ default: false
80493
+ },
80494
+ // 确认按钮文本
80495
+ confirmText: {
80496
+ type: String,
80497
+ default: '确定'
80498
+ },
80499
+ // 取消按钮文本
80500
+ cancelText: {
80501
+ type: String,
80502
+ default: '取消'
80503
+ },
80504
+ // 选项的键名配置
80505
+ optionProps: {
80506
+ type: Object,
80507
+ default: () => ({
80508
+ label: 'name',
80509
+ value: 'id',
80510
+ disabled: 'disabled'
80511
+ })
80512
+ }
80513
+ },
80514
+ data() {
80515
+ return {
80516
+ visible: false,
80517
+ selectedValue: null,
80518
+ selectedValues: [],
80519
+ tempSelectedValue: null,
80520
+ tempSelectedValues: []
80521
+ };
80522
+ },
80523
+ computed: {
80524
+ // 处理后的选项数据
80525
+ processedOptions() {
80526
+ return this.options.map(item => {
80527
+ if (typeof item === 'string') {
80528
+ return {
80529
+ id: item,
80530
+ name: item,
80531
+ disabled: false
80532
+ };
80533
+ }
80534
+ return {
80535
+ id: item[this.optionProps.value] || item.id,
80536
+ name: item[this.optionProps.label] || item.name || item.label,
80537
+ disabled: item[this.optionProps.disabled] || item.disabled || false
80538
+ };
80539
+ });
80540
+ },
80541
+ // 显示的选项
80542
+ displayOptions() {
80543
+ return this.processedOptions;
80544
+ },
80545
+ // 是否多列显示
80546
+ isMultiColumn() {
80547
+ return false; // 不再使用多列布局
80548
+ },
80549
+ // 是否有选中项
80550
+ hasSelection() {
80551
+ if (this.multiple) {
80552
+ return this.tempSelectedValues.length > 0;
80553
+ } else {
80554
+ return this.tempSelectedValue !== null && this.tempSelectedValue !== undefined;
80555
+ }
80556
+ },
80557
+ // 当前选中的选项
80558
+ selectedOptions() {
80559
+ if (this.multiple) {
80560
+ return this.processedOptions.filter(option => this.selectedValues.includes(option.id));
80561
+ } else {
80562
+ return this.processedOptions.find(option => option.id === this.selectedValue);
80563
+ }
80564
+ },
80565
+ // 动态按钮文本
80566
+ dynamicButtonText() {
80567
+ if (this.multiple) {
80568
+ // 多选模式保持默认文本
80569
+ return this.buttonText;
80570
+ } else {
80571
+ // 单选模式显示选中项名称
80572
+ const selectedOption = this.selectedOptions;
80573
+ return selectedOption ? selectedOption.name : this.buttonText;
80574
+ }
80575
+ }
80576
+ },
80577
+ watch: {
80578
+ value: {
80579
+ handler(newVal) {
80580
+ this.selectedValue = newVal;
80581
+ this.tempSelectedValue = newVal;
80582
+ },
80583
+ immediate: true
80584
+ },
80585
+ values: {
80586
+ handler(newVal) {
80587
+ this.selectedValues = [...newVal];
80588
+ this.tempSelectedValues = [...newVal];
80589
+ },
80590
+ immediate: true
80591
+ }
80592
+ },
80593
+ methods: {
80594
+ // 处理弹出层显示
80595
+ handleShow() {
80596
+ // 重置临时选择
80597
+ this.tempSelectedValue = this.selectedValue;
80598
+ this.tempSelectedValues = [...this.selectedValues];
80599
+ this.$emit('show');
80600
+ },
80601
+ // 处理弹出层隐藏
80602
+ handleHide() {
80603
+ this.$emit('hide');
80604
+ },
80605
+ // 处理单选变化
80606
+ handleSingleChange(value) {
80607
+ this.tempSelectedValue = value;
80608
+ },
80609
+ // 处理多选变化
80610
+ handleMultipleChange(values) {
80611
+ this.tempSelectedValues = [...values];
80612
+ },
80613
+ // 处理确认
80614
+ handleConfirm() {
80615
+ if (this.multiple) {
80616
+ this.selectedValues = [...this.tempSelectedValues];
80617
+ this.$emit('input', this.selectedValues);
80618
+ this.$emit('change', this.selectedValues, this.getSelectedOptions(this.selectedValues));
80619
+ } else {
80620
+ this.selectedValue = this.tempSelectedValue;
80621
+ this.$emit('input', this.selectedValue);
80622
+ this.$emit('change', this.selectedValue, this.getSelectedOption(this.selectedValue));
80623
+ }
80624
+ this.visible = false;
80625
+ this.$emit('confirm', this.multiple ? this.selectedValues : this.selectedValue);
80626
+ },
80627
+ // 处理取消
80628
+ handleCancel() {
80629
+ // 恢复临时选择
80630
+ this.tempSelectedValue = this.selectedValue;
80631
+ this.tempSelectedValues = [...this.selectedValues];
80632
+ this.visible = false;
80633
+ this.$emit('cancel');
80634
+ },
80635
+ // 获取选中的选项对象(单选)
80636
+ getSelectedOption(value) {
80637
+ return this.processedOptions.find(option => option.id === value);
80638
+ },
80639
+ // 获取选中的选项对象(多选)
80640
+ getSelectedOptions(values) {
80641
+ return this.processedOptions.filter(option => values.includes(option.id));
80642
+ },
80643
+ // 清空选择
80644
+ clear() {
80645
+ if (this.multiple) {
80646
+ this.selectedValues = [];
80647
+ this.tempSelectedValues = [];
80648
+ this.$emit('input', []);
80649
+ this.$emit('change', [], []);
80650
+ } else {
80651
+ this.selectedValue = null;
80652
+ this.tempSelectedValue = null;
80653
+ this.$emit('input', null);
80654
+ this.$emit('change', null, null);
80655
+ }
80656
+ },
80657
+ // 设置选择
80658
+ setSelection(value) {
80659
+ if (this.multiple) {
80660
+ const values = Array.isArray(value) ? value : [value];
80661
+ this.selectedValues = [...values];
80662
+ this.tempSelectedValues = [...values];
80663
+ this.$emit('input', values);
80664
+ this.$emit('change', values, this.getSelectedOptions(values));
80665
+ } else {
80666
+ this.selectedValue = value;
80667
+ this.tempSelectedValue = value;
80668
+ this.$emit('input', value);
80669
+ this.$emit('change', value, this.getSelectedOption(value));
80670
+ }
80671
+ }
80672
+ }
80673
+ });
80674
+ ;// ./src/components/popover-selector/ByPopoverSelector.vue?vue&type=script&lang=js
80675
+ /* harmony default export */ var popover_selector_ByPopoverSelectorvue_type_script_lang_js = (ByPopoverSelectorvue_type_script_lang_js);
80676
+ ;// ./node_modules/@vue/cli-service/node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-64.use[0]!./node_modules/@vue/cli-service/node_modules/css-loader/dist/cjs.js??clonedRuleSet-64.use[1]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/loaders/stylePostLoader.js!./node_modules/@vue/cli-service/node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-64.use[2]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-64.use[3]!./node_modules/cache-loader/dist/cjs.js??ruleSet[0].use[0]!./node_modules/@vue/cli-service/node_modules/@vue/vue-loader-v15/lib/index.js??vue-loader-options!./src/components/popover-selector/ByPopoverSelector.vue?vue&type=style&index=0&id=686db86e&prod&lang=scss&scoped=true
80677
+ // extracted by mini-css-extract-plugin
80678
+
80679
+ ;// ./src/components/popover-selector/ByPopoverSelector.vue?vue&type=style&index=0&id=686db86e&prod&lang=scss&scoped=true
80680
+
80681
+ ;// ./src/components/popover-selector/ByPopoverSelector.vue
80682
+
80683
+
80684
+
80685
+ ;
80686
+
80687
+
80688
+ /* normalize component */
80689
+
80690
+ var ByPopoverSelector_component = normalizeComponent(
80691
+ popover_selector_ByPopoverSelectorvue_type_script_lang_js,
80692
+ ByPopoverSelectorvue_type_template_id_686db86e_scoped_true_render,
80693
+ ByPopoverSelectorvue_type_template_id_686db86e_scoped_true_staticRenderFns,
80694
+ false,
80695
+ null,
80696
+ "686db86e",
80697
+ null
80698
+
80699
+ )
80700
+
80701
+ /* harmony default export */ var ByPopoverSelector = (ByPopoverSelector_component.exports);
80287
80702
  ;// ./src/index.js
80288
80703
 
80289
80704
 
@@ -80304,6 +80719,7 @@ var ByFloatingMenu_component = normalizeComponent(
80304
80719
 
80305
80720
 
80306
80721
 
80722
+
80307
80723
 
80308
80724
  const components = {
80309
80725
  ByPager: pager,
@@ -80320,7 +80736,8 @@ const components = {
80320
80736
  ByTreeSearch: ByTreeSearch,
80321
80737
  ByDialog: ByDialog,
80322
80738
  ByCascaderPanel: ByCascaderPanel,
80323
- ByFloatingMenu: ByFloatingMenu
80739
+ ByFloatingMenu: ByFloatingMenu,
80740
+ ByPopoverSelector: ByPopoverSelector
80324
80741
  };
80325
80742
 
80326
80743
  // 设置当前 z-index 起始值