@jetlinks-web/components 2.3.9 → 2.4.0

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.
@@ -1,5 +1,6 @@
1
1
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
2
2
  import { configProviderProps } from 'ant-design-vue/es/config-provider/context';
3
+ import "@jetlinks-web/constants";
3
4
  export var configProps = function configProps() {
4
5
  return _objectSpread(_objectSpread({}, configProviderProps()), {}, {
5
6
  IconConfig: {
@@ -7,6 +8,12 @@ export var configProps = function configProps() {
7
8
  },
8
9
  MapConfig: {
9
10
  type: Object
11
+ },
12
+ SearchConfig: {
13
+ type: Object
14
+ },
15
+ PermissionButtonConfig: {
16
+ type: Object
10
17
  }
11
18
  });
12
19
  };
@@ -2,7 +2,7 @@ import { createVNode as _createVNode } from "vue";
2
2
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
3
  import { defineComponent, provide, reactive, h } from 'vue';
4
4
  import { configProps } from './context';
5
- import { ComponentsEnum, MAPConfig } from '@jetlinks-web/constants';
5
+ import { ComponentsEnum, MAPConfig, PermissionButtonConfig, SearchConfig } from '@jetlinks-web/constants';
6
6
  import { ConfigProvider } from 'ant-design-vue';
7
7
  import { omit } from 'lodash-es';
8
8
  import Empty from '../Empty';
@@ -14,10 +14,15 @@ var JConfigProvider = defineComponent({
14
14
  var slots = _ref.slots;
15
15
  var _iconConfig = reactive(props.IconConfig || {});
16
16
  var _mapConfig = reactive(props.MapConfig || {});
17
+ var _searchConfig = reactive(props.SearchConfig || {});
18
+ var _PermissionButtonConfig = reactive(props.PermissionButtonConfig || {});
17
19
  provide(ComponentsEnum.Icon, _iconConfig); // 全局Icon 配置
18
20
  provide(MAPConfig, _mapConfig); // 全局地图配置
21
+ provide(SearchConfig, _searchConfig); // 全局搜索配置
22
+ provide(PermissionButtonConfig, _PermissionButtonConfig); // 权限组件
23
+ console.log('_PermissionButtonConfig', _PermissionButtonConfig, props.PermissionButtonConfig);
19
24
  return function () {
20
- return h(ConfigProvider, _objectSpread({}, omit(props, ['IconConfig', 'MapConfig'])), {
25
+ return h(ConfigProvider, _objectSpread({}, omit(props, ['IconConfig', 'MapConfig', 'SearchConfig'])), {
21
26
  default: slots.default,
22
27
  renderEmpty: function renderEmpty() {
23
28
  var _slots$renderEmpty;
@@ -48,7 +48,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
48
48
  "onFieldChange": "setup-const"
49
49
  } */
50
50
  import { toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, createVNode as _createVNode, renderSlot as _renderSlot, normalizeClass as _normalizeClass, Fragment as _Fragment, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
51
- const _withScopeId = n => (_pushScopeId("data-v-1725970194654"), n = n(), _popScopeId(), n);
51
+ const _withScopeId = n => (_pushScopeId("data-v-1726059568155"), n = n(), _popScopeId(), n);
52
52
  const _hoisted_1 = { style: { "color": "#1d2129" } };
53
53
  const _hoisted_2 = {
54
54
  key: 0,
@@ -6,7 +6,7 @@
6
6
  } */
7
7
  import { defineComponent as _defineComponent } from 'vue';
8
8
  import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
9
- const _withScopeId = n => (_pushScopeId("data-v-1725970195230"), n = n(), _popScopeId(), n);
9
+ const _withScopeId = n => (_pushScopeId("data-v-1726059568705"), n = n(), _popScopeId(), n);
10
10
  const _hoisted_1 = { class: "full-page-warp-content" };
11
11
  import { ref } from 'vue';
12
12
  import { useElementBounding } from '@vueuse/core';
@@ -0,0 +1,79 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
+ import { createVNode, render as vueRender, h } from 'vue';
4
+ import { destroyFns } from './index';
5
+ import 'lodash-es';
6
+ var confirm = function confirm(config, components) {
7
+ var container = document.createDocumentFragment();
8
+ var confirmDialogInstance = null;
9
+ var currentConfig = _objectSpread(_objectSpread({}, config), {}, {
10
+ visible: true
11
+ });
12
+ function destroy() {
13
+ if (confirmDialogInstance) {
14
+ // destroy
15
+ vueRender(null, container);
16
+ confirmDialogInstance.component.update();
17
+ confirmDialogInstance = null;
18
+ }
19
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
20
+ args[_key] = arguments[_key];
21
+ }
22
+ var triggerCancel = args.some(function (param) {
23
+ return param && param.triggerCancel;
24
+ });
25
+ if (config.onCancel && triggerCancel) {
26
+ config.onCancel.apply(config, args);
27
+ }
28
+ for (var i = 0; i < destroyFns.length; i++) {
29
+ var fn = destroyFns[i];
30
+ if (fn === close) {
31
+ destroyFns.splice(i, 1);
32
+ break;
33
+ }
34
+ }
35
+ }
36
+ function close() {
37
+ var _this = this;
38
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
39
+ args[_key2] = arguments[_key2];
40
+ }
41
+ currentConfig = _objectSpread(_objectSpread({}, currentConfig), {}, {
42
+ visible: false,
43
+ afterClose: function afterClose() {
44
+ if (typeof config.afterClose === 'function') {
45
+ config.afterClose();
46
+ }
47
+ destroy.apply(_this, args);
48
+ }
49
+ });
50
+ update(currentConfig);
51
+ }
52
+ function update(configUpdate) {
53
+ if (typeof configUpdate === 'function') {
54
+ currentConfig = configUpdate(currentConfig);
55
+ } else {
56
+ currentConfig = _objectSpread(_objectSpread({}, currentConfig), configUpdate);
57
+ }
58
+ if (confirmDialogInstance) {
59
+ _extends(confirmDialogInstance.component.props, currentConfig);
60
+ confirmDialogInstance.component.update();
61
+ }
62
+ }
63
+ var Wrapper = function Wrapper(p) {
64
+ return h(components, _objectSpread({}, p));
65
+ };
66
+ function render(props) {
67
+ var vm = createVNode(Wrapper, _objectSpread({}, props));
68
+ vm.appContext = config.parentContext || config.appContext || vm.appContext;
69
+ vueRender(vm, container);
70
+ return vm;
71
+ }
72
+ confirmDialogInstance = render(currentConfig);
73
+ destroyFns.push(close);
74
+ return {
75
+ destroy: close,
76
+ update: update
77
+ };
78
+ };
79
+ export default confirm;
@@ -2,12 +2,14 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
3
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
4
4
  var _excluded = ["popConfirm", "tooltip", "hasPermission", "noPermissionTitle"];
5
- import { h, defineComponent, computed } from "vue";
5
+ import { h, defineComponent, computed, inject } from "vue";
6
6
  import { Button, Tooltip, Modal } from 'ant-design-vue';
7
7
  import "ant-design-vue/es";
8
8
  import { omit } from "lodash-es";
9
9
  import { buttonProps } from "ant-design-vue/es/button/button";
10
10
  import { usePermission } from '@jetlinks-web/hooks';
11
+ import confirm from './confirm';
12
+ import { PermissionButtonConfig } from "@jetlinks-web/constants";
11
13
  var definedProps = _objectSpread({
12
14
  tooltip: {
13
15
  type: Object
@@ -26,6 +28,7 @@ var definedProps = _objectSpread({
26
28
  type: String
27
29
  }
28
30
  }, omit(buttonProps(), 'icon'));
31
+ export var destroyFns = [];
29
32
  var PermissionButton = defineComponent({
30
33
  name: 'JPermissionButton',
31
34
  // @ts-ignore
@@ -35,6 +38,9 @@ var PermissionButton = defineComponent({
35
38
  var slots = _ref.slots;
36
39
  var _usePermission = usePermission(props.hasPermission),
37
40
  hasPerm = _usePermission.hasPerm;
41
+ var context = inject(PermissionButtonConfig, {
42
+ components: undefined
43
+ });
38
44
  var permission = computed(function () {
39
45
  if (!props.hasPermission || props.hasPermission === true) {
40
46
  return true;
@@ -58,19 +64,24 @@ var PermissionButton = defineComponent({
58
64
  noPermissionTitle = props.noPermissionTitle,
59
65
  buttonProps = _objectWithoutProperties(props, _excluded);
60
66
  if (popConfirm) {
67
+ console.log('context', context);
61
68
  buttonProps.onClick = function () {
62
- Modal.confirm({
63
- title: popConfirm.title,
64
- content: popConfirm.content,
65
- onOk: function onOk() {
66
- var _popConfirm$onConfirm;
67
- return (_popConfirm$onConfirm = popConfirm.onConfirm) === null || _popConfirm$onConfirm === void 0 ? void 0 : _popConfirm$onConfirm.call(popConfirm);
68
- },
69
- onCancel: function onCancel() {
70
- var _popConfirm$onCancel;
71
- (_popConfirm$onCancel = popConfirm.onCancel) === null || _popConfirm$onCancel === void 0 ? void 0 : _popConfirm$onCancel.call(popConfirm);
72
- }
73
- });
69
+ if (context.components) {
70
+ confirm(popConfirm, context.components);
71
+ } else {
72
+ Modal.confirm({
73
+ title: popConfirm.title,
74
+ content: popConfirm.content,
75
+ onOk: function onOk() {
76
+ var _popConfirm$onConfirm;
77
+ return (_popConfirm$onConfirm = popConfirm.onConfirm) === null || _popConfirm$onConfirm === void 0 ? void 0 : _popConfirm$onConfirm.call(popConfirm);
78
+ },
79
+ onCancel: function onCancel() {
80
+ var _popConfirm$onCancel;
81
+ (_popConfirm$onCancel = popConfirm.onCancel) === null || _popConfirm$onCancel === void 0 ? void 0 : _popConfirm$onCancel.call(popConfirm);
82
+ }
83
+ });
84
+ }
74
85
  };
75
86
  }
76
87
  var button = !slots.button ? h(Button, _objectSpread(_objectSpread({}, buttonProps), {}, {
@@ -10,7 +10,7 @@
10
10
  "onClick": "setup-const"
11
11
  } */
12
12
  import { unref as _unref, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
13
- const _withScopeId = n => (_pushScopeId("data-v-1725970196627"), n = n(), _popScopeId(), n);
13
+ const _withScopeId = n => (_pushScopeId("data-v-1726059570162"), n = n(), _popScopeId(), n);
14
14
  const _hoisted_1 = ["onClick"];
15
15
  const __sfc_main__ = Object.assign({
16
16
  name: 'JRadioButton',
@@ -21,7 +21,7 @@
21
21
  } */
22
22
  import { defineComponent as _defineComponent } from 'vue';
23
23
  import { unref as _unref, createVNode as _createVNode, withCtx as _withCtx, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
24
- const _withScopeId = n => (_pushScopeId("data-v-1725970197062"), n = n(), _popScopeId(), n);
24
+ const _withScopeId = n => (_pushScopeId("data-v-1726059570482"), n = n(), _popScopeId(), n);
25
25
  const _hoisted_1 = {
26
26
  key: 0,
27
27
  style: { "width": "240px" }
package/es/Search/Item.js CHANGED
@@ -78,7 +78,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
78
78
  } */
79
79
  import { defineComponent as _defineComponent } from 'vue';
80
80
  import { unref as _unref, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementBlock as _createElementBlock, createVNode as _createVNode, Fragment as _Fragment, normalizeStyle as _normalizeStyle, mergeProps as _mergeProps, resolveDynamicComponent as _resolveDynamicComponent, withCtx as _withCtx, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
81
- const _withScopeId = n => (_pushScopeId("data-v-1725970196437"), n = n(), _popScopeId(), n);
81
+ const _withScopeId = n => (_pushScopeId("data-v-1726059569799"), n = n(), _popScopeId(), n);
82
82
  const _hoisted_1 = { class: "JSearch-item" };
83
83
  const _hoisted_2 = {
84
84
  key: 0,
@@ -277,7 +277,6 @@ const __sfc_main__ = _defineComponent({
277
277
  value: item.column,
278
278
  };
279
279
  });
280
- console.log(props.onlyValue);
281
280
  if (!props.onlyValue) {
282
281
  // 获取第一个值
283
282
  const sortColumn = cloneDeep(props.columns);
@@ -317,7 +316,6 @@ const __sfc_main__ = _defineComponent({
317
316
  termsModel.value = undefined;
318
317
  };
319
318
  watch(() => props.columns, () => {
320
- console.log(props.columns);
321
319
  if (props.columns) {
322
320
  handleItem();
323
321
  }
@@ -7,6 +7,7 @@
7
7
  "labelWidth": "props",
8
8
  "resetText": "props",
9
9
  "submitText": "props",
10
+ "align": "props",
10
11
  "JColumnsProps": "setup-maybe-ref",
11
12
  "SearchItemData": "setup-maybe-ref",
12
13
  "SearchProps": "setup-maybe-ref",
@@ -20,14 +21,20 @@
20
21
  "reactive": "setup-const",
21
22
  "ref": "setup-const",
22
23
  "provide": "setup-const",
24
+ "watch": "setup-const",
25
+ "computed": "setup-const",
26
+ "inject": "setup-const",
23
27
  "termsParamsFormat": "setup-maybe-ref",
24
28
  "SearchItem": "setup-const",
25
29
  "optionsMapKey": "setup-maybe-ref",
30
+ "SearchConfig": "setup-maybe-ref",
26
31
  "props": "setup-reactive-const",
27
32
  "columnOptionMap": "setup-ref",
28
33
  "emit": "setup-const",
29
34
  "terms": "setup-reactive-const",
30
35
  "searchItems": "setup-ref",
36
+ "context": "setup-maybe-ref",
37
+ "footerStyles": "setup-ref",
31
38
  "itemValueChange": "setup-const",
32
39
  "handleItems": "setup-const",
33
40
  "searchSubmit": "setup-const",
@@ -36,15 +43,16 @@
36
43
  } */
37
44
  import { defineComponent as _defineComponent } from 'vue';
38
45
  import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createVNode as _createVNode, unref as _unref, withCtx as _withCtx, createBlock as _createBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
39
- const _withScopeId = n => (_pushScopeId("data-v-1725970196539"), n = n(), _popScopeId(), n);
46
+ const _withScopeId = n => (_pushScopeId("data-v-1726059569957"), n = n(), _popScopeId(), n);
40
47
  const _hoisted_1 = { class: "JSearch-content simple" };
41
48
  const _hoisted_2 = { class: "JSearch-items" };
42
49
  import { Button, Row, Col, Form, FormItemRest, } from 'ant-design-vue';
43
50
  import { set } from 'lodash-es';
44
- import { reactive, ref, provide } from 'vue';
51
+ import { reactive, ref, provide, watch, computed, inject } from 'vue';
45
52
  import { termsParamsFormat } from './util';
46
53
  import SearchItem from './Item.js';
47
54
  import { optionsMapKey } from './setting';
55
+ import { SearchConfig } from '@jetlinks-web/constants';
48
56
  const __sfc_main__ = _defineComponent({
49
57
  ...{
50
58
  name: 'JSearch',
@@ -84,6 +92,10 @@ const __sfc_main__ = _defineComponent({
84
92
  type: String,
85
93
  default: '搜索',
86
94
  },
95
+ align: {
96
+ type: String,
97
+ default: 'value'
98
+ }
87
99
  },
88
100
  emits: ["search"],
89
101
  setup(__props, { emit: __emit }) {
@@ -93,6 +105,14 @@ const __sfc_main__ = _defineComponent({
93
105
  // 当前查询条件
94
106
  const terms = reactive({ terms: [] });
95
107
  const searchItems = ref([]); // 当前查询条件列表
108
+ const context = inject(SearchConfig, { align: props.align });
109
+ const footerStyles = computed(() => {
110
+ const align = context.align || props.align;
111
+ if (align === 'value') {
112
+ return { paddingLeft: `${props.labelWidth + 8}px` };
113
+ }
114
+ return {};
115
+ });
96
116
  provide(optionsMapKey, columnOptionMap);
97
117
  const itemValueChange = (value, index) => {
98
118
  set(terms.terms, [index], value);
@@ -159,7 +179,9 @@ const __sfc_main__ = _defineComponent({
159
179
  emit('search', []);
160
180
  }
161
181
  };
162
- handleItems();
182
+ watch(() => props.columns, () => {
183
+ handleItems();
184
+ }, { immediate: true, deep: true });
163
185
  return (_ctx, _cache) => {
164
186
  return (_openBlock(), _createBlock(_unref(Form), {
165
187
  model: terms,
@@ -205,9 +227,7 @@ const __sfc_main__ = _defineComponent({
205
227
  }, () => [
206
228
  _createElementVNode("div", {
207
229
  class: "JSearch-footer--btns",
208
- style: _normalizeStyle({
209
- paddingLeft: `${__props.labelWidth + 8}px`,
210
- })
230
+ style: _normalizeStyle(footerStyles.value)
211
231
  }, [
212
232
  _createVNode(_unref(Button), {
213
233
  type: "stroke",
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.configProps = void 0;
8
8
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
9
  var _context = require("ant-design-vue/es/config-provider/context");
10
+ require("@jetlinks-web/constants");
10
11
  var configProps = exports.configProps = function configProps() {
11
12
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _context.configProviderProps)()), {}, {
12
13
  IconConfig: {
@@ -14,6 +15,12 @@ var configProps = exports.configProps = function configProps() {
14
15
  },
15
16
  MapConfig: {
16
17
  type: Object
18
+ },
19
+ SearchConfig: {
20
+ type: Object
21
+ },
22
+ PermissionButtonConfig: {
23
+ type: Object
17
24
  }
18
25
  });
19
26
  };
@@ -20,10 +20,15 @@ var JConfigProvider = (0, _vue.defineComponent)({
20
20
  var slots = _ref.slots;
21
21
  var _iconConfig = (0, _vue.reactive)(props.IconConfig || {});
22
22
  var _mapConfig = (0, _vue.reactive)(props.MapConfig || {});
23
+ var _searchConfig = (0, _vue.reactive)(props.SearchConfig || {});
24
+ var _PermissionButtonConfig = (0, _vue.reactive)(props.PermissionButtonConfig || {});
23
25
  (0, _vue.provide)(_constants.ComponentsEnum.Icon, _iconConfig); // 全局Icon 配置
24
26
  (0, _vue.provide)(_constants.MAPConfig, _mapConfig); // 全局地图配置
27
+ (0, _vue.provide)(_constants.SearchConfig, _searchConfig); // 全局搜索配置
28
+ (0, _vue.provide)(_constants.PermissionButtonConfig, _PermissionButtonConfig); // 权限组件
29
+ console.log('_PermissionButtonConfig', _PermissionButtonConfig, props.PermissionButtonConfig);
25
30
  return function () {
26
- return (0, _vue.h)(_antDesignVue.ConfigProvider, (0, _objectSpread2.default)({}, (0, _lodashEs.omit)(props, ['IconConfig', 'MapConfig'])), {
31
+ return (0, _vue.h)(_antDesignVue.ConfigProvider, (0, _objectSpread2.default)({}, (0, _lodashEs.omit)(props, ['IconConfig', 'MapConfig', 'SearchConfig'])), {
27
32
  default: slots.default,
28
33
  renderEmpty: function renderEmpty() {
29
34
  var _slots$renderEmpty;
@@ -48,7 +48,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
48
48
  "onFieldChange": "setup-const"
49
49
  } */
50
50
  import { toDisplayString as _toDisplayString, createElementVNode as _createElementVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, resolveComponent as _resolveComponent, withCtx as _withCtx, createVNode as _createVNode, renderSlot as _renderSlot, normalizeClass as _normalizeClass, Fragment as _Fragment, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
51
- const _withScopeId = n => (_pushScopeId("data-v-1725970194627"), n = n(), _popScopeId(), n);
51
+ const _withScopeId = n => (_pushScopeId("data-v-1726059568128"), n = n(), _popScopeId(), n);
52
52
  const _hoisted_1 = { style: { "color": "#1d2129" } };
53
53
  const _hoisted_2 = {
54
54
  key: 0,
@@ -6,7 +6,7 @@
6
6
  } */
7
7
  import { defineComponent as _defineComponent } from 'vue';
8
8
  import { unref as _unref, renderSlot as _renderSlot, createElementVNode as _createElementVNode, normalizeStyle as _normalizeStyle, openBlock as _openBlock, createElementBlock as _createElementBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
9
- const _withScopeId = n => (_pushScopeId("data-v-1725970195223"), n = n(), _popScopeId(), n);
9
+ const _withScopeId = n => (_pushScopeId("data-v-1726059568700"), n = n(), _popScopeId(), n);
10
10
  const _hoisted_1 = { class: "full-page-warp-content" };
11
11
  import { ref } from 'vue';
12
12
  import { useElementBounding } from '@vueuse/core';
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.default = void 0;
8
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
10
+ var _vue = require("vue");
11
+ var _index = require("./index");
12
+ require("lodash");
13
+ var confirm = function confirm(config, components) {
14
+ var container = document.createDocumentFragment();
15
+ var confirmDialogInstance = null;
16
+ var currentConfig = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, config), {}, {
17
+ visible: true
18
+ });
19
+ function destroy() {
20
+ if (confirmDialogInstance) {
21
+ // destroy
22
+ (0, _vue.render)(null, container);
23
+ confirmDialogInstance.component.update();
24
+ confirmDialogInstance = null;
25
+ }
26
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
27
+ args[_key] = arguments[_key];
28
+ }
29
+ var triggerCancel = args.some(function (param) {
30
+ return param && param.triggerCancel;
31
+ });
32
+ if (config.onCancel && triggerCancel) {
33
+ config.onCancel.apply(config, args);
34
+ }
35
+ for (var i = 0; i < _index.destroyFns.length; i++) {
36
+ var fn = _index.destroyFns[i];
37
+ if (fn === close) {
38
+ _index.destroyFns.splice(i, 1);
39
+ break;
40
+ }
41
+ }
42
+ }
43
+ function close() {
44
+ var _this = this;
45
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
46
+ args[_key2] = arguments[_key2];
47
+ }
48
+ currentConfig = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, currentConfig), {}, {
49
+ visible: false,
50
+ afterClose: function afterClose() {
51
+ if (typeof config.afterClose === 'function') {
52
+ config.afterClose();
53
+ }
54
+ destroy.apply(_this, args);
55
+ }
56
+ });
57
+ update(currentConfig);
58
+ }
59
+ function update(configUpdate) {
60
+ if (typeof configUpdate === 'function') {
61
+ currentConfig = configUpdate(currentConfig);
62
+ } else {
63
+ currentConfig = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, currentConfig), configUpdate);
64
+ }
65
+ if (confirmDialogInstance) {
66
+ (0, _extends2.default)(confirmDialogInstance.component.props, currentConfig);
67
+ confirmDialogInstance.component.update();
68
+ }
69
+ }
70
+ var Wrapper = function Wrapper(p) {
71
+ return (0, _vue.h)(components, (0, _objectSpread2.default)({}, p));
72
+ };
73
+ function render(props) {
74
+ var vm = (0, _vue.createVNode)(Wrapper, (0, _objectSpread2.default)({}, props));
75
+ vm.appContext = config.parentContext || config.appContext || vm.appContext;
76
+ (0, _vue.render)(vm, container);
77
+ return vm;
78
+ }
79
+ confirmDialogInstance = render(currentConfig);
80
+ _index.destroyFns.push(close);
81
+ return {
82
+ destroy: close,
83
+ update: update
84
+ };
85
+ };
86
+ var _default = exports.default = confirm;
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = void 0;
7
+ exports.destroyFns = exports.default = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
10
10
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
@@ -14,6 +14,8 @@ require("ant-design-vue/es");
14
14
  var _lodashEs = require("lodash");
15
15
  var _button = require("ant-design-vue/es/button/button");
16
16
  var _hooks = require("@jetlinks-web/hooks");
17
+ var _confirm = _interopRequireDefault(require("./confirm"));
18
+ var _constants = require("@jetlinks-web/constants");
17
19
  var _excluded = ["popConfirm", "tooltip", "hasPermission", "noPermissionTitle"];
18
20
  var definedProps = (0, _objectSpread2.default)({
19
21
  tooltip: {
@@ -33,6 +35,7 @@ var definedProps = (0, _objectSpread2.default)({
33
35
  type: String
34
36
  }
35
37
  }, (0, _lodashEs.omit)((0, _button.buttonProps)(), 'icon'));
38
+ var destroyFns = exports.destroyFns = [];
36
39
  var PermissionButton = (0, _vue.defineComponent)({
37
40
  name: 'JPermissionButton',
38
41
  // @ts-ignore
@@ -42,6 +45,9 @@ var PermissionButton = (0, _vue.defineComponent)({
42
45
  var slots = _ref.slots;
43
46
  var _usePermission = (0, _hooks.usePermission)(props.hasPermission),
44
47
  hasPerm = _usePermission.hasPerm;
48
+ var context = (0, _vue.inject)(_constants.PermissionButtonConfig, {
49
+ components: undefined
50
+ });
45
51
  var permission = (0, _vue.computed)(function () {
46
52
  if (!props.hasPermission || props.hasPermission === true) {
47
53
  return true;
@@ -65,19 +71,24 @@ var PermissionButton = (0, _vue.defineComponent)({
65
71
  noPermissionTitle = props.noPermissionTitle,
66
72
  buttonProps = (0, _objectWithoutProperties2.default)(props, _excluded);
67
73
  if (popConfirm) {
74
+ console.log('context', context);
68
75
  buttonProps.onClick = function () {
69
- _antDesignVue.Modal.confirm({
70
- title: popConfirm.title,
71
- content: popConfirm.content,
72
- onOk: function onOk() {
73
- var _popConfirm$onConfirm;
74
- return (_popConfirm$onConfirm = popConfirm.onConfirm) === null || _popConfirm$onConfirm === void 0 ? void 0 : _popConfirm$onConfirm.call(popConfirm);
75
- },
76
- onCancel: function onCancel() {
77
- var _popConfirm$onCancel;
78
- (_popConfirm$onCancel = popConfirm.onCancel) === null || _popConfirm$onCancel === void 0 ? void 0 : _popConfirm$onCancel.call(popConfirm);
79
- }
80
- });
76
+ if (context.components) {
77
+ (0, _confirm.default)(popConfirm, context.components);
78
+ } else {
79
+ _antDesignVue.Modal.confirm({
80
+ title: popConfirm.title,
81
+ content: popConfirm.content,
82
+ onOk: function onOk() {
83
+ var _popConfirm$onConfirm;
84
+ return (_popConfirm$onConfirm = popConfirm.onConfirm) === null || _popConfirm$onConfirm === void 0 ? void 0 : _popConfirm$onConfirm.call(popConfirm);
85
+ },
86
+ onCancel: function onCancel() {
87
+ var _popConfirm$onCancel;
88
+ (_popConfirm$onCancel = popConfirm.onCancel) === null || _popConfirm$onCancel === void 0 ? void 0 : _popConfirm$onCancel.call(popConfirm);
89
+ }
90
+ });
91
+ }
81
92
  };
82
93
  }
83
94
  var button = !slots.button ? (0, _vue.h)(_antDesignVue.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, buttonProps), {}, {
@@ -10,7 +10,7 @@
10
10
  "onClick": "setup-const"
11
11
  } */
12
12
  import { unref as _unref, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, toDisplayString as _toDisplayString, normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
13
- const _withScopeId = n => (_pushScopeId("data-v-1725970196617"), n = n(), _popScopeId(), n);
13
+ const _withScopeId = n => (_pushScopeId("data-v-1726059570170"), n = n(), _popScopeId(), n);
14
14
  const _hoisted_1 = ["onClick"];
15
15
  const __sfc_main__ = Object.assign({
16
16
  name: 'JRadioButton',
@@ -21,7 +21,7 @@
21
21
  } */
22
22
  import { defineComponent as _defineComponent } from 'vue';
23
23
  import { unref as _unref, createVNode as _createVNode, withCtx as _withCtx, createTextVNode as _createTextVNode, openBlock as _openBlock, createElementBlock as _createElementBlock, createCommentVNode as _createCommentVNode, createBlock as _createBlock, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
24
- const _withScopeId = n => (_pushScopeId("data-v-1725970197074"), n = n(), _popScopeId(), n);
24
+ const _withScopeId = n => (_pushScopeId("data-v-1726059570504"), n = n(), _popScopeId(), n);
25
25
  const _hoisted_1 = {
26
26
  key: 0,
27
27
  style: { "width": "240px" }
@@ -78,7 +78,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
78
78
  } */
79
79
  import { defineComponent as _defineComponent } from 'vue';
80
80
  import { unref as _unref, openBlock as _openBlock, createBlock as _createBlock, createCommentVNode as _createCommentVNode, toDisplayString as _toDisplayString, createElementBlock as _createElementBlock, createVNode as _createVNode, Fragment as _Fragment, normalizeStyle as _normalizeStyle, mergeProps as _mergeProps, resolveDynamicComponent as _resolveDynamicComponent, withCtx as _withCtx, createElementVNode as _createElementVNode, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
81
- const _withScopeId = n => (_pushScopeId("data-v-1725970196374"), n = n(), _popScopeId(), n);
81
+ const _withScopeId = n => (_pushScopeId("data-v-1726059569871"), n = n(), _popScopeId(), n);
82
82
  const _hoisted_1 = { class: "JSearch-item" };
83
83
  const _hoisted_2 = {
84
84
  key: 0,
@@ -277,7 +277,6 @@ const __sfc_main__ = _defineComponent({
277
277
  value: item.column,
278
278
  };
279
279
  });
280
- console.log(props.onlyValue);
281
280
  if (!props.onlyValue) {
282
281
  // 获取第一个值
283
282
  const sortColumn = cloneDeep(props.columns);
@@ -317,7 +316,6 @@ const __sfc_main__ = _defineComponent({
317
316
  termsModel.value = undefined;
318
317
  };
319
318
  watch(() => props.columns, () => {
320
- console.log(props.columns);
321
319
  if (props.columns) {
322
320
  handleItem();
323
321
  }
@@ -7,6 +7,7 @@
7
7
  "labelWidth": "props",
8
8
  "resetText": "props",
9
9
  "submitText": "props",
10
+ "align": "props",
10
11
  "JColumnsProps": "setup-maybe-ref",
11
12
  "SearchItemData": "setup-maybe-ref",
12
13
  "SearchProps": "setup-maybe-ref",
@@ -20,14 +21,20 @@
20
21
  "reactive": "setup-const",
21
22
  "ref": "setup-const",
22
23
  "provide": "setup-const",
24
+ "watch": "setup-const",
25
+ "computed": "setup-const",
26
+ "inject": "setup-const",
23
27
  "termsParamsFormat": "setup-maybe-ref",
24
28
  "SearchItem": "setup-const",
25
29
  "optionsMapKey": "setup-maybe-ref",
30
+ "SearchConfig": "setup-maybe-ref",
26
31
  "props": "setup-reactive-const",
27
32
  "columnOptionMap": "setup-ref",
28
33
  "emit": "setup-const",
29
34
  "terms": "setup-reactive-const",
30
35
  "searchItems": "setup-ref",
36
+ "context": "setup-maybe-ref",
37
+ "footerStyles": "setup-ref",
31
38
  "itemValueChange": "setup-const",
32
39
  "handleItems": "setup-const",
33
40
  "searchSubmit": "setup-const",
@@ -36,15 +43,16 @@
36
43
  } */
37
44
  import { defineComponent as _defineComponent } from 'vue';
38
45
  import { renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, createVNode as _createVNode, unref as _unref, withCtx as _withCtx, createBlock as _createBlock, renderSlot as _renderSlot, toDisplayString as _toDisplayString, createTextVNode as _createTextVNode, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, normalizeClass as _normalizeClass, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
39
- const _withScopeId = n => (_pushScopeId("data-v-1725970196510"), n = n(), _popScopeId(), n);
46
+ const _withScopeId = n => (_pushScopeId("data-v-1726059569983"), n = n(), _popScopeId(), n);
40
47
  const _hoisted_1 = { class: "JSearch-content simple" };
41
48
  const _hoisted_2 = { class: "JSearch-items" };
42
49
  import { Button, Row, Col, Form, FormItemRest, } from 'ant-design-vue';
43
50
  import { set } from 'lodash-es';
44
- import { reactive, ref, provide } from 'vue';
51
+ import { reactive, ref, provide, watch, computed, inject } from 'vue';
45
52
  import { termsParamsFormat } from './util';
46
53
  import SearchItem from './Item.js';
47
54
  import { optionsMapKey } from './setting';
55
+ import { SearchConfig } from '@jetlinks-web/constants';
48
56
  const __sfc_main__ = _defineComponent({
49
57
  ...{
50
58
  name: 'JSearch',
@@ -84,6 +92,10 @@ const __sfc_main__ = _defineComponent({
84
92
  type: String,
85
93
  default: '搜索',
86
94
  },
95
+ align: {
96
+ type: String,
97
+ default: 'value'
98
+ }
87
99
  },
88
100
  emits: ["search"],
89
101
  setup(__props, { emit: __emit }) {
@@ -93,6 +105,14 @@ const __sfc_main__ = _defineComponent({
93
105
  // 当前查询条件
94
106
  const terms = reactive({ terms: [] });
95
107
  const searchItems = ref([]); // 当前查询条件列表
108
+ const context = inject(SearchConfig, { align: props.align });
109
+ const footerStyles = computed(() => {
110
+ const align = context.align || props.align;
111
+ if (align === 'value') {
112
+ return { paddingLeft: `${props.labelWidth + 8}px` };
113
+ }
114
+ return {};
115
+ });
96
116
  provide(optionsMapKey, columnOptionMap);
97
117
  const itemValueChange = (value, index) => {
98
118
  set(terms.terms, [index], value);
@@ -159,7 +179,9 @@ const __sfc_main__ = _defineComponent({
159
179
  emit('search', []);
160
180
  }
161
181
  };
162
- handleItems();
182
+ watch(() => props.columns, () => {
183
+ handleItems();
184
+ }, { immediate: true, deep: true });
163
185
  return (_ctx, _cache) => {
164
186
  return (_openBlock(), _createBlock(_unref(Form), {
165
187
  model: terms,
@@ -205,9 +227,7 @@ const __sfc_main__ = _defineComponent({
205
227
  }, () => [
206
228
  _createElementVNode("div", {
207
229
  class: "JSearch-footer--btns",
208
- style: _normalizeStyle({
209
- paddingLeft: `${__props.labelWidth + 8}px`,
210
- })
230
+ style: _normalizeStyle(footerStyles.value)
211
231
  }, [
212
232
  _createVNode(_unref(Button), {
213
233
  type: "stroke",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetlinks-web/components",
3
- "version": "2.3.9",
3
+ "version": "2.4.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -152,9 +152,9 @@
152
152
  "webpack-dev-server": "^4.0.0",
153
153
  "webpack-merge": "^5.0.0",
154
154
  "webpackbar": "^5.0.2",
155
- "@jetlinks-web/constants": "^1.0.3",
156
- "@jetlinks-web/utils": "^1.2.1",
157
- "@jetlinks-web/hooks": "^1.0.16"
155
+ "@jetlinks-web/hooks": "^1.0.16",
156
+ "@jetlinks-web/constants": "^1.0.5",
157
+ "@jetlinks-web/utils": "^1.2.1"
158
158
  },
159
159
  "publishConfig": {
160
160
  "registry": "https://registry.npmjs.org/",