@weitutech/by-components 1.1.87 → 1.1.88

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,181 @@ 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=626ef2a2
76936
+ var ByDialogvue_type_template_id_626ef2a2_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.visible,
76943
+ "title": _vm.title
76944
+ },
76945
+ on: {
76946
+ "update:visible": function ($event) {
76947
+ _vm.visible = $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 || 'small',
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_626ef2a2_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
+ computed: {
77041
+ dialogAttrs() {
77042
+ const {
77043
+ visible,
77044
+ content,
77045
+ showFooter,
77046
+ buttons,
77047
+ customClass,
77048
+ closeOnClickModal,
77049
+ ...attrs
77050
+ } = this.$attrs;
77051
+ return {
77052
+ width: this.width,
77053
+ top: '15vh',
77054
+ closeOnClickModal: this.closeOnClickModal,
77055
+ ...attrs
77056
+ };
77057
+ }
77058
+ },
77059
+ methods: {
77060
+ handleClose() {
77061
+ this.$emit('close');
77062
+ },
77063
+ handleButtonClick(button, index) {
77064
+ const {
77065
+ action,
77066
+ callback
77067
+ } = button;
77068
+ if (callback && typeof callback === 'function') {
77069
+ const result = callback();
77070
+ if (result === false) {
77071
+ return; // 阻止默认行为
77072
+ }
77073
+ }
77074
+ if (action) {
77075
+ this.$emit(action, button, index);
77076
+ }
77077
+
77078
+ // 如果是确认或取消按钮,默认关闭弹窗
77079
+ if (action === 'confirm' || action === 'cancel') {
77080
+ this.$emit('update:visible', false);
77081
+ }
77082
+ }
77083
+ }
77084
+ });
77085
+ ;// ./src/components/by-dialog/ByDialog.vue?vue&type=script&lang=js
77086
+ /* harmony default export */ var by_dialog_ByDialogvue_type_script_lang_js = (ByDialogvue_type_script_lang_js);
77087
+ ;// ./src/components/by-dialog/ByDialog.vue
77088
+
77089
+
77090
+
77091
+
77092
+
77093
+ /* normalize component */
77094
+ ;
77095
+ var ByDialog_component = normalizeComponent(
77096
+ by_dialog_ByDialogvue_type_script_lang_js,
77097
+ ByDialogvue_type_template_id_626ef2a2_render,
77098
+ ByDialogvue_type_template_id_626ef2a2_staticRenderFns,
77099
+ false,
77100
+ null,
77101
+ null,
77102
+ null
77103
+
77104
+ )
77105
+
77106
+ /* harmony default export */ var ByDialog = (ByDialog_component.exports);
77107
+ // EXTERNAL MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
77108
+ var external_commonjs_vue_commonjs2_vue_root_Vue_ = __webpack_require__(1719);
77109
+ var external_commonjs_vue_commonjs2_vue_root_Vue_default = /*#__PURE__*/__webpack_require__.n(external_commonjs_vue_commonjs2_vue_root_Vue_);
76933
77110
  ;// ./node_modules/dom-zindex/es/index.esm.js
76934
77111
  var winDom = null;
76935
77112
  var bodyEl = null;
@@ -77087,6 +77264,230 @@ var DomZIndex = {
77087
77264
  };
77088
77265
  updateVar();
77089
77266
  /* harmony default export */ var index_esm = (DomZIndex);
77267
+ ;// ./src/components/by-dialog/ByDialogService.js
77268
+
77269
+
77270
+ /**
77271
+ * @title
77272
+ * @description ByDialogService - 弹窗服务
77273
+ * @date 2025-09-02
77274
+ * @author heqican
77275
+ *
77276
+ * 提供两种使用方式:
77277
+ * 1. 模板中使用 <by-dialog> 组件
77278
+ * 2. JavaScript 中调用 this.$byDialog.xxx() 方法
77279
+ *
77280
+ * 安装:Vue.use(ByComponents) // 会自动安装
77281
+ *
77282
+ * 使用示例:
77283
+ * this.$byDialog.alert('提示内容')
77284
+ * this.$byDialog.confirm('确定要删除吗?')
77285
+ * this.$byDialog.alert('内容', '标题', { width: '500px' })
77286
+ *
77287
+ * API 方法:
77288
+ * - alert(content, title, options) - 警告弹窗
77289
+ * - confirm(content, title, options) - 确认弹窗
77290
+ * - success(content, title, options) - 成功提示弹窗
77291
+ * - error(content, title, options) - 错误提示弹窗
77292
+ * - info(content, title, options) - 信息提示弹窗
77293
+ * - custom(options) - 自定义弹窗
77294
+ *
77295
+ * 注意:所有方法都返回 Promise
77296
+ *
77297
+ */
77298
+
77299
+
77300
+
77301
+
77302
+
77303
+ // 创建 ByDialog 构造函数
77304
+ const DialogConstructor = external_commonjs_vue_commonjs2_vue_root_Vue_default().extend(ByDialog);
77305
+ const defaultOptions = {
77306
+ title: '',
77307
+ content: '',
77308
+ width: '400px',
77309
+ top: '15vh',
77310
+ modal: true,
77311
+ lockScroll: true,
77312
+ closeOnClickModal: false,
77313
+ closeOnPressEscape: true,
77314
+ showClose: true,
77315
+ center: false,
77316
+ customClass: '',
77317
+ showFooter: true,
77318
+ buttons: []
77319
+ };
77320
+
77321
+ // 创建弹窗实例
77322
+ function createMessageBox(options) {
77323
+ const instance = new DialogConstructor({
77324
+ propsData: {
77325
+ ...defaultOptions,
77326
+ ...options,
77327
+ visible: true
77328
+ }
77329
+ });
77330
+
77331
+ // 设置 z-index
77332
+ instance.$mount();
77333
+ const zIndex = index_esm.getNext();
77334
+ instance.$el.style.zIndex = zIndex;
77335
+
77336
+ // 添加到 body
77337
+ document.body.appendChild(instance.$el);
77338
+ return instance;
77339
+ }
77340
+
77341
+ // 销毁弹窗实例
77342
+ function destroyMessageBox(instance) {
77343
+ if (instance && instance.$el && instance.$el.parentNode) {
77344
+ instance.$el.parentNode.removeChild(instance.$el);
77345
+ instance.$destroy();
77346
+ }
77347
+ }
77348
+
77349
+ // 通用弹窗方法
77350
+ function showMessageBox(options) {
77351
+ return new Promise((resolve, reject) => {
77352
+ const instance = createMessageBox(options);
77353
+
77354
+ // 监听按钮点击事件
77355
+ instance.$on('confirm', (button, index) => {
77356
+ destroyMessageBox(instance);
77357
+ resolve({
77358
+ action: 'confirm',
77359
+ button,
77360
+ index
77361
+ });
77362
+ });
77363
+ instance.$on('cancel', (button, index) => {
77364
+ destroyMessageBox(instance);
77365
+ resolve({
77366
+ action: 'cancel',
77367
+ button,
77368
+ index
77369
+ });
77370
+ });
77371
+ instance.$on('close', () => {
77372
+ destroyMessageBox(instance);
77373
+ resolve({
77374
+ action: 'close'
77375
+ });
77376
+ });
77377
+
77378
+ // 监听其他自定义按钮事件
77379
+ if (options.buttons) {
77380
+ options.buttons.forEach((button, index) => {
77381
+ if (button.action && button.action !== 'confirm' && button.action !== 'cancel') {
77382
+ instance.$on(button.action, (btn, btnIndex) => {
77383
+ destroyMessageBox(instance);
77384
+ resolve({
77385
+ action: button.action,
77386
+ button: btn,
77387
+ index: btnIndex
77388
+ });
77389
+ });
77390
+ }
77391
+ });
77392
+ }
77393
+ });
77394
+ }
77395
+
77396
+ // 警告弹窗
77397
+ function ByDialogService_alert(content, title = '提示', options = {}) {
77398
+ return showMessageBox({
77399
+ title,
77400
+ content,
77401
+ buttons: [{
77402
+ text: '确定',
77403
+ type: 'primary',
77404
+ action: 'confirm'
77405
+ }],
77406
+ ...options
77407
+ });
77408
+ }
77409
+
77410
+ // 确认弹窗
77411
+ function ByDialogService_confirm(content, title = '确认', options = {}) {
77412
+ return showMessageBox({
77413
+ title,
77414
+ content,
77415
+ buttons: [{
77416
+ text: '取消',
77417
+ type: 'default',
77418
+ action: 'cancel'
77419
+ }, {
77420
+ text: '确定',
77421
+ type: 'primary',
77422
+ action: 'confirm'
77423
+ }],
77424
+ ...options
77425
+ });
77426
+ }
77427
+
77428
+ // 成功提示弹窗
77429
+ function success(content, title = '成功', options = {}) {
77430
+ return showMessageBox({
77431
+ title,
77432
+ content,
77433
+ buttons: [{
77434
+ text: '确定',
77435
+ type: 'primary',
77436
+ action: 'confirm'
77437
+ }],
77438
+ ...options
77439
+ });
77440
+ }
77441
+
77442
+ // 错误提示弹窗
77443
+ function error(content, title = '错误', options = {}) {
77444
+ return showMessageBox({
77445
+ title,
77446
+ content,
77447
+ buttons: [{
77448
+ text: '确定',
77449
+ type: 'primary',
77450
+ action: 'confirm'
77451
+ }],
77452
+ ...options
77453
+ });
77454
+ }
77455
+
77456
+ // 信息提示弹窗
77457
+ function info(content, title = '信息', options = {}) {
77458
+ return showMessageBox({
77459
+ title,
77460
+ content,
77461
+ buttons: [{
77462
+ text: '确定',
77463
+ type: 'primary',
77464
+ action: 'confirm'
77465
+ }],
77466
+ ...options
77467
+ });
77468
+ }
77469
+
77470
+ // 自定义弹窗
77471
+ function custom(options) {
77472
+ return showMessageBox(options);
77473
+ }
77474
+
77475
+ // 创建 ByDialogService 对象
77476
+ const ByDialogService = {
77477
+ alert: ByDialogService_alert,
77478
+ confirm: ByDialogService_confirm,
77479
+ success,
77480
+ error,
77481
+ info,
77482
+ custom,
77483
+ show: showMessageBox
77484
+ };
77485
+
77486
+ // 原型注入$byDialog,使得能够使用this.$byDialog.xxx()
77487
+ ByDialogService.install = function (Vue) {
77488
+ Vue.prototype.$byDialog = ByDialogService;
77489
+ };
77490
+ /* harmony default export */ var by_dialog_ByDialogService = (ByDialogService);
77090
77491
  ;// ./src/index.js
77091
77492
 
77092
77493
 
@@ -77104,6 +77505,8 @@ updateVar();
77104
77505
 
77105
77506
 
77106
77507
 
77508
+
77509
+
77107
77510
  const components = {
77108
77511
  ByPager: pager,
77109
77512
  ByTable: table,
@@ -77116,7 +77519,8 @@ const components = {
77116
77519
  ByToolBar: ByToolBar,
77117
77520
  ByCommonSelector: ByCommonSelector,
77118
77521
  ByBatchQuerySelector: BatchQuerySelector,
77119
- ByTreeSearch: ByTreeSearch
77522
+ ByTreeSearch: ByTreeSearch,
77523
+ ByDialog: ByDialog
77120
77524
  };
77121
77525
 
77122
77526
  // 设置当前 z-index 起始值
@@ -77127,6 +77531,9 @@ const install = Vue => {
77127
77531
  // 同时注册小写版本
77128
77532
  Vue.component(name.toLowerCase(), components[name]);
77129
77533
  });
77534
+
77535
+ // 安装 ByDialogService 插件
77536
+ Vue.use(by_dialog_ByDialogService);
77130
77537
  };
77131
77538
 
77132
77539
  // 支持直接通过 script 标签引入