@weitutech/by-components 1.1.87 → 1.1.89

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.
@@ -60506,6 +60506,8 @@ __webpack_require__.d(__webpack_exports__, {
60506
60506
  ByCommonSelector: function() { return /* reexport */ ByCommonSelector; },
60507
60507
  ByCustomDatePicker: function() { return /* reexport */ custom_date_picker; },
60508
60508
  ByDatePickerRange: function() { return /* reexport */ date_picker_range; },
60509
+ ByDialog: function() { return /* reexport */ ByDialog; },
60510
+ ByDialogService: function() { return /* reexport */ by_dialog_ByDialogService; },
60509
60511
  ByFoldSearch: function() { return /* reexport */ fold_search; },
60510
60512
  ByForm: function() { return /* reexport */ form_form; },
60511
60513
  ByPageSearch: function() { return /* reexport */ page_search; },
@@ -76930,6 +76932,207 @@ var ByTreeSearch_component = normalizeComponent(
76930
76932
  )
76931
76933
 
76932
76934
  /* harmony default export */ var ByTreeSearch = (ByTreeSearch_component.exports);
76935
+ ;// ./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-40.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/by-dialog/ByDialog.vue?vue&type=template&id=0d08276a
76936
+ var ByDialogvue_type_template_id_0d08276a_render = function render() {
76937
+ var _vm = this,
76938
+ _c = _vm._self._c;
76939
+ return _c('el-dialog', _vm._g(_vm._b({
76940
+ class: ['by-dialog', _vm.customClass],
76941
+ attrs: {
76942
+ "visible": _vm.dialogVisible,
76943
+ "title": _vm.title
76944
+ },
76945
+ on: {
76946
+ "update:visible": function ($event) {
76947
+ _vm.dialogVisible = $event;
76948
+ },
76949
+ "close": _vm.handleClose
76950
+ }
76951
+ }, 'el-dialog', _vm.dialogAttrs, false), _vm.$listeners), [_c('div', {
76952
+ staticClass: "by-dialog__body"
76953
+ }, [_vm._t("default", function () {
76954
+ return [_vm.content ? _c('div', {
76955
+ staticClass: "by-dialog__content"
76956
+ }, [_vm._v(_vm._s(_vm.content))]) : _vm._e()];
76957
+ })], 2), _vm.showFooter ? _c('div', {
76958
+ staticClass: "by-dialog__footer"
76959
+ }, [_vm._t("footer", function () {
76960
+ return [_c('div', {
76961
+ staticClass: "by-dialog__buttons"
76962
+ }, _vm._l(_vm.buttons, function (button, index) {
76963
+ return _c('el-button', {
76964
+ key: index,
76965
+ class: button.class,
76966
+ style: button.style,
76967
+ attrs: {
76968
+ "type": button.type || 'default',
76969
+ "size": button.size || 'medium',
76970
+ "loading": button.loading,
76971
+ "disabled": button.disabled,
76972
+ "icon": button.icon
76973
+ },
76974
+ on: {
76975
+ "click": function ($event) {
76976
+ return _vm.handleButtonClick(button, index);
76977
+ }
76978
+ }
76979
+ }, [_vm._v(" " + _vm._s(button.text) + " ")]);
76980
+ }), 1)];
76981
+ })], 2) : _vm._e()]);
76982
+ };
76983
+ var ByDialogvue_type_template_id_0d08276a_staticRenderFns = [];
76984
+
76985
+ ;// ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.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/by-dialog/ByDialog.vue?vue&type=script&lang=js
76986
+ /* harmony default export */ var ByDialogvue_type_script_lang_js = ({
76987
+ name: 'ByDialog',
76988
+ inheritAttrs: false,
76989
+ props: {
76990
+ // 是否显示弹窗
76991
+ visible: {
76992
+ type: Boolean,
76993
+ default: false
76994
+ },
76995
+ width: {
76996
+ type: String,
76997
+ default: '600px'
76998
+ },
76999
+ // 标题
77000
+ title: {
77001
+ type: String,
77002
+ default: ''
77003
+ },
77004
+ // 内容(当没有插槽时使用)
77005
+ content: {
77006
+ type: String,
77007
+ default: ''
77008
+ },
77009
+ // 是否显示底部按钮区域
77010
+ showFooter: {
77011
+ type: Boolean,
77012
+ default: true
77013
+ },
77014
+ // 是否点击模态层关闭弹窗
77015
+ closeOnClickModal: {
77016
+ type: Boolean,
77017
+ default: false
77018
+ },
77019
+ // 按钮配置
77020
+ buttons: {
77021
+ type: Array,
77022
+ default() {
77023
+ return [{
77024
+ text: '取消',
77025
+ type: 'default',
77026
+ action: 'cancel'
77027
+ }, {
77028
+ text: '确定',
77029
+ type: 'primary',
77030
+ action: 'confirm'
77031
+ }];
77032
+ }
77033
+ },
77034
+ // 自定义类名
77035
+ customClass: {
77036
+ type: String,
77037
+ default: ''
77038
+ }
77039
+ },
77040
+ data() {
77041
+ return {
77042
+ internalVisible: false
77043
+ };
77044
+ },
77045
+ computed: {
77046
+ dialogVisible: {
77047
+ get() {
77048
+ return this.internalVisible;
77049
+ },
77050
+ set(value) {
77051
+ this.internalVisible = value;
77052
+ if (!value) {
77053
+ this.$emit('update:visible', false);
77054
+ }
77055
+ }
77056
+ },
77057
+ dialogAttrs() {
77058
+ const {
77059
+ visible,
77060
+ content,
77061
+ showFooter,
77062
+ buttons,
77063
+ customClass,
77064
+ closeOnClickModal,
77065
+ ...attrs
77066
+ } = this.$attrs;
77067
+ return {
77068
+ width: this.width,
77069
+ top: '15vh',
77070
+ closeOnClickModal: this.closeOnClickModal,
77071
+ ...attrs
77072
+ };
77073
+ }
77074
+ },
77075
+ watch: {
77076
+ visible: {
77077
+ immediate: true,
77078
+ handler(newVal) {
77079
+ this.internalVisible = newVal;
77080
+ }
77081
+ }
77082
+ },
77083
+ methods: {
77084
+ handleClose() {
77085
+ this.internalVisible = false;
77086
+ this.$emit('update:visible', false);
77087
+ this.$emit('close');
77088
+ },
77089
+ handleButtonClick(button, index) {
77090
+ const {
77091
+ action,
77092
+ callback
77093
+ } = button;
77094
+ if (callback && typeof callback === 'function') {
77095
+ const result = callback();
77096
+ if (result === false) {
77097
+ return; // 阻止默认行为
77098
+ }
77099
+ }
77100
+ if (action) {
77101
+ this.$emit(action, button, index);
77102
+ }
77103
+
77104
+ // 如果是确认或取消按钮,默认关闭弹窗
77105
+ if (action === 'confirm' || action === 'cancel') {
77106
+ this.$emit('update:visible', false);
77107
+ }
77108
+ }
77109
+ }
77110
+ });
77111
+ ;// ./src/components/by-dialog/ByDialog.vue?vue&type=script&lang=js
77112
+ /* harmony default export */ var by_dialog_ByDialogvue_type_script_lang_js = (ByDialogvue_type_script_lang_js);
77113
+ ;// ./src/components/by-dialog/ByDialog.vue
77114
+
77115
+
77116
+
77117
+
77118
+
77119
+ /* normalize component */
77120
+ ;
77121
+ var ByDialog_component = normalizeComponent(
77122
+ by_dialog_ByDialogvue_type_script_lang_js,
77123
+ ByDialogvue_type_template_id_0d08276a_render,
77124
+ ByDialogvue_type_template_id_0d08276a_staticRenderFns,
77125
+ false,
77126
+ null,
77127
+ null,
77128
+ null
77129
+
77130
+ )
77131
+
77132
+ /* harmony default export */ var ByDialog = (ByDialog_component.exports);
77133
+ // EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
77134
+ var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__(1719);
77135
+ var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
76933
77136
  ;// ./node_modules/dom-zindex/es/index.esm.js
76934
77137
  var winDom = null;
76935
77138
  var bodyEl = null;
@@ -77087,6 +77290,237 @@ var DomZIndex = {
77087
77290
  };
77088
77291
  updateVar();
77089
77292
  /* harmony default export */ var index_esm = (DomZIndex);
77293
+ ;// ./src/components/by-dialog/ByDialogService.js
77294
+
77295
+
77296
+ /**
77297
+ * @title
77298
+ * @description ByDialogService - 弹窗服务
77299
+ * @date 2025-09-02
77300
+ * @author heqican
77301
+ *
77302
+ * 提供两种使用方式:
77303
+ * 1. 模板中使用 <by-dialog> 组件
77304
+ * 2. JavaScript 中调用 this.$byDialog.xxx() 方法
77305
+ *
77306
+ * 安装:Vue.use(ByComponents) // 会自动安装
77307
+ *
77308
+ * 使用示例:
77309
+ * this.$byDialog.alert('提示内容')
77310
+ * this.$byDialog.confirm('确定要删除吗?')
77311
+ * this.$byDialog.alert('内容', '标题', { width: '500px' })
77312
+ *
77313
+ * API 方法:
77314
+ * - alert(content, title, options) - 警告弹窗
77315
+ * - confirm(content, title, options) - 确认弹窗
77316
+ * - success(content, title, options) - 成功提示弹窗
77317
+ * - error(content, title, options) - 错误提示弹窗
77318
+ * - info(content, title, options) - 信息提示弹窗
77319
+ * - custom(options) - 自定义弹窗
77320
+ *
77321
+ * 注意:所有方法都返回 Promise
77322
+ *
77323
+ */
77324
+
77325
+
77326
+
77327
+
77328
+
77329
+ // 延迟创建 ByDialog 构造函数,确保 Element UI 已安装
77330
+ let DialogConstructor = null;
77331
+ function getDialogConstructor() {
77332
+ if (!DialogConstructor) {
77333
+ DialogConstructor = external_commonjs_vue_commonjs2_vue_root_Vue_default().extend(ByDialog);
77334
+ }
77335
+ return DialogConstructor;
77336
+ }
77337
+ const defaultOptions = {
77338
+ title: '',
77339
+ content: '',
77340
+ width: '400px',
77341
+ top: '15vh',
77342
+ modal: true,
77343
+ lockScroll: true,
77344
+ closeOnClickModal: false,
77345
+ closeOnPressEscape: true,
77346
+ showClose: true,
77347
+ center: false,
77348
+ customClass: '',
77349
+ showFooter: true,
77350
+ buttons: []
77351
+ };
77352
+
77353
+ // 创建弹窗实例
77354
+ function createMessageBox(options) {
77355
+ const Constructor = getDialogConstructor();
77356
+ const instance = new Constructor({
77357
+ propsData: {
77358
+ ...defaultOptions,
77359
+ ...options,
77360
+ visible: true
77361
+ }
77362
+ });
77363
+
77364
+ // 设置 z-index
77365
+ instance.$mount();
77366
+ const zIndex = index_esm.getNext();
77367
+ instance.$el.style.zIndex = zIndex;
77368
+
77369
+ // 添加到 body
77370
+ document.body.appendChild(instance.$el);
77371
+ return instance;
77372
+ }
77373
+
77374
+ // 销毁弹窗实例
77375
+ function destroyMessageBox(instance) {
77376
+ if (instance && instance.$el && instance.$el.parentNode) {
77377
+ instance.$el.parentNode.removeChild(instance.$el);
77378
+ instance.$destroy();
77379
+ }
77380
+ }
77381
+
77382
+ // 通用弹窗方法
77383
+ function showMessageBox(options) {
77384
+ return new Promise((resolve, reject) => {
77385
+ const instance = createMessageBox(options);
77386
+
77387
+ // 监听按钮点击事件
77388
+ instance.$on('confirm', (button, index) => {
77389
+ destroyMessageBox(instance);
77390
+ resolve({
77391
+ action: 'confirm',
77392
+ button,
77393
+ index
77394
+ });
77395
+ });
77396
+ instance.$on('cancel', (button, index) => {
77397
+ destroyMessageBox(instance);
77398
+ resolve({
77399
+ action: 'cancel',
77400
+ button,
77401
+ index
77402
+ });
77403
+ });
77404
+ instance.$on('close', () => {
77405
+ destroyMessageBox(instance);
77406
+ resolve({
77407
+ action: 'close'
77408
+ });
77409
+ });
77410
+
77411
+ // 监听其他自定义按钮事件
77412
+ if (options.buttons) {
77413
+ options.buttons.forEach((button, index) => {
77414
+ if (button.action && button.action !== 'confirm' && button.action !== 'cancel') {
77415
+ instance.$on(button.action, (btn, btnIndex) => {
77416
+ destroyMessageBox(instance);
77417
+ resolve({
77418
+ action: button.action,
77419
+ button: btn,
77420
+ index: btnIndex
77421
+ });
77422
+ });
77423
+ }
77424
+ });
77425
+ }
77426
+ });
77427
+ }
77428
+
77429
+ // 警告弹窗
77430
+ function ByDialogService_alert(content, title = '提示', options = {}) {
77431
+ return showMessageBox({
77432
+ title,
77433
+ content,
77434
+ buttons: [{
77435
+ text: '确定',
77436
+ type: 'primary',
77437
+ action: 'confirm'
77438
+ }],
77439
+ ...options
77440
+ });
77441
+ }
77442
+
77443
+ // 确认弹窗
77444
+ function ByDialogService_confirm(content, title = '确认', options = {}) {
77445
+ return showMessageBox({
77446
+ title,
77447
+ content,
77448
+ buttons: [{
77449
+ text: '取消',
77450
+ type: 'default',
77451
+ action: 'cancel'
77452
+ }, {
77453
+ text: '确定',
77454
+ type: 'primary',
77455
+ action: 'confirm'
77456
+ }],
77457
+ ...options
77458
+ });
77459
+ }
77460
+
77461
+ // 成功提示弹窗
77462
+ function success(content, title = '成功', options = {}) {
77463
+ return showMessageBox({
77464
+ title,
77465
+ content,
77466
+ buttons: [{
77467
+ text: '确定',
77468
+ type: 'primary',
77469
+ action: 'confirm'
77470
+ }],
77471
+ ...options
77472
+ });
77473
+ }
77474
+
77475
+ // 错误提示弹窗
77476
+ function error(content, title = '错误', options = {}) {
77477
+ return showMessageBox({
77478
+ title,
77479
+ content,
77480
+ buttons: [{
77481
+ text: '确定',
77482
+ type: 'primary',
77483
+ action: 'confirm'
77484
+ }],
77485
+ ...options
77486
+ });
77487
+ }
77488
+
77489
+ // 信息提示弹窗
77490
+ function info(content, title = '信息', options = {}) {
77491
+ return showMessageBox({
77492
+ title,
77493
+ content,
77494
+ buttons: [{
77495
+ text: '确定',
77496
+ type: 'primary',
77497
+ action: 'confirm'
77498
+ }],
77499
+ ...options
77500
+ });
77501
+ }
77502
+
77503
+ // 自定义弹窗
77504
+ function custom(options) {
77505
+ return showMessageBox(options);
77506
+ }
77507
+
77508
+ // 创建 ByDialogService 对象
77509
+ const ByDialogService = {
77510
+ alert: ByDialogService_alert,
77511
+ confirm: ByDialogService_confirm,
77512
+ success,
77513
+ error,
77514
+ info,
77515
+ custom,
77516
+ show: showMessageBox
77517
+ };
77518
+
77519
+ // 原型注入$byDialog,使得能够使用this.$byDialog.xxx()
77520
+ ByDialogService.install = function (Vue) {
77521
+ Vue.prototype.$byDialog = ByDialogService;
77522
+ };
77523
+ /* harmony default export */ var by_dialog_ByDialogService = (ByDialogService);
77090
77524
  ;// ./src/index.js
77091
77525
 
77092
77526
 
@@ -77104,6 +77538,8 @@ updateVar();
77104
77538
 
77105
77539
 
77106
77540
 
77541
+
77542
+
77107
77543
  const components = {
77108
77544
  ByPager: pager,
77109
77545
  ByTable: table,
@@ -77116,7 +77552,8 @@ const components = {
77116
77552
  ByToolBar: ByToolBar,
77117
77553
  ByCommonSelector: ByCommonSelector,
77118
77554
  ByBatchQuerySelector: BatchQuerySelector,
77119
- ByTreeSearch: ByTreeSearch
77555
+ ByTreeSearch: ByTreeSearch,
77556
+ ByDialog: ByDialog
77120
77557
  };
77121
77558
 
77122
77559
  // 设置当前 z-index 起始值
@@ -77127,6 +77564,9 @@ const install = Vue => {
77127
77564
  // 同时注册小写版本
77128
77565
  Vue.component(name.toLowerCase(), components[name]);
77129
77566
  });
77567
+
77568
+ // 安装 ByDialogService 插件
77569
+ Vue.use(by_dialog_ByDialogService);
77130
77570
  };
77131
77571
 
77132
77572
  // 支持直接通过 script 标签引入