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