@jetlinks-web/components 2.1.0 → 2.1.1

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.
@@ -348,8 +348,9 @@ const __sfc_main__ = Object.assign({
348
348
  _createVNode(Header, {
349
349
  columns: myColumns.value,
350
350
  style: _normalizeStyle({ width: tableStyle.width }),
351
- rowKey: _ctx.rowKey
352
- }, null, 8 /* PROPS */, ["columns", "style", "rowKey"]),
351
+ rowKey: _ctx.rowKey,
352
+ searchColumns: _ctx.searchColumns
353
+ }, null, 8 /* PROPS */, ["columns", "style", "rowKey", "searchColumns"]),
353
354
  _createElementVNode("div", {
354
355
  class: "jetlinks-edit-table-header-scroll-hidden",
355
356
  style: _normalizeStyle({ width: _unref(scrollWidth) + 'px' })
@@ -0,0 +1,213 @@
1
+ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) {
2
+ const op = ops[i];
3
+ const fn = ops[i + 1];
4
+ i += 2;
5
+ if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
6
+ return undefined;
7
+ }
8
+ if (op === 'access' || op === 'optionalAccess') {
9
+ lastAccessLHS = value;
10
+ value = fn(value);
11
+ }
12
+ else if (op === 'call' || op === 'optionalCall') {
13
+ value = fn((...args) => value.call(lastAccessLHS, ...args));
14
+ lastAccessLHS = undefined;
15
+ }
16
+ } return value; }
17
+ /* Analyzed bindings: {
18
+ "name": "props",
19
+ "required": "props",
20
+ "onBeforeUnmount": "setup-const",
21
+ "computed": "setup-const",
22
+ "reactive": "setup-const",
23
+ "watch": "setup-const",
24
+ "defineOptions": "setup-const",
25
+ "get": "setup-maybe-ref",
26
+ "isArray": "setup-maybe-ref",
27
+ "useProvideFormItemContext": "setup-maybe-ref",
28
+ "useInjectError": "setup-maybe-ref",
29
+ "useInjectForm": "setup-maybe-ref",
30
+ "TABLE_FORM_ITEM_ERROR": "setup-maybe-ref",
31
+ "props": "setup-reactive-const",
32
+ "emit": "setup-const",
33
+ "context": "setup-maybe-ref",
34
+ "globalErrorMessage": "setup-maybe-ref",
35
+ "hideTimer": "setup-let",
36
+ "eventKey": "setup-ref",
37
+ "errorMap": "setup-reactive-const",
38
+ "filedId": "setup-ref",
39
+ "filedName": "setup-ref",
40
+ "filedValue": "setup-ref",
41
+ "popContainer": "setup-const",
42
+ "removeTimer": "setup-const",
43
+ "showErrorTip": "setup-const",
44
+ "hideErrorTip": "setup-const",
45
+ "validateRules": "setup-const",
46
+ "onFieldBlur": "setup-const",
47
+ "onFieldChange": "setup-const"
48
+ } */
49
+ 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";
50
+ const _withScopeId = n => (_pushScopeId("data-v-1722999077877"), n = n(), _popScopeId(), n);
51
+ const _hoisted_1 = { style: { "color": "#1d2129" } };
52
+ const _hoisted_2 = {
53
+ key: 0,
54
+ class: "table-form-error-target"
55
+ };
56
+ const _hoisted_3 = ["id"];
57
+ import { onBeforeUnmount, computed, reactive, watch, } from "vue";
58
+ import { get, isArray } from 'lodash-es';
59
+ import { useProvideFormItemContext } from 'ant-design-vue/es/form/FormItemContext';
60
+ import { useInjectError, useInjectForm } from "./hooks";
61
+ import { TABLE_FORM_ITEM_ERROR } from "./consts";
62
+ const __sfc_main__ = Object.assign({
63
+ name: 'JEditTableFormItem'
64
+ }, {
65
+ props: {
66
+ name: {
67
+ type: [String, Array],
68
+ default: undefined
69
+ },
70
+ required: {
71
+ type: Boolean,
72
+ default: false
73
+ }
74
+ },
75
+ emits: ['change'],
76
+ setup(__props, { emit: __emit }) {
77
+ const props = __props;
78
+ const emit = __emit;
79
+ const context = useInjectForm();
80
+ const globalErrorMessage = useInjectError();
81
+ let hideTimer;
82
+ const eventKey = computed(() => {
83
+ const names = isArray(props.name) ? props.name : [props.name];
84
+ return names.join('-');
85
+ });
86
+ const errorMap = reactive({
87
+ message: '',
88
+ visible: false
89
+ });
90
+ const filedId = computed(() => {
91
+ const names = isArray(props.name) ? props.name : [props.name];
92
+ return names.join('_');
93
+ });
94
+ const filedName = computed(() => {
95
+ const names = isArray(props.name) ? props.name : [props.name];
96
+ const _rules = context.rules.value;
97
+ let tempKey = undefined;
98
+ for (const key of names) {
99
+ if (key in _rules) {
100
+ tempKey = key;
101
+ }
102
+ }
103
+ return tempKey;
104
+ });
105
+ const filedValue = computed(() => {
106
+ return get(context.dataSource.value, props.name);
107
+ });
108
+ provide(TABLE_FORM_ITEM_ERROR, errorMap);
109
+ const popContainer = (e) => {
110
+ return e;
111
+ };
112
+ const removeTimer = () => {
113
+ if (hideTimer) {
114
+ window.clearTimeout(hideTimer);
115
+ hideTimer = null;
116
+ }
117
+ };
118
+ const showErrorTip = (msg) => {
119
+ removeTimer();
120
+ errorMap.message = msg;
121
+ errorMap.visible = true;
122
+ };
123
+ const hideErrorTip = () => {
124
+ errorMap.visible = false;
125
+ removeTimer();
126
+ hideTimer = setTimeout(() => {
127
+ errorMap.message = '';
128
+ }, 300);
129
+ };
130
+ const validateRules = () => {
131
+ let index = 0;
132
+ if (isArray(props.name)) {
133
+ index = props.name[0];
134
+ }
135
+ const promise = context.validateItem({ [filedName.value]: get(context.dataSource.value, props.name) }, index);
136
+ promise.catch(res => {
137
+ const error = _optionalChain([res, 'optionalAccess', _2 => _2.filter, 'call', _3 => _3(item => item.field === filedName.value)]) || [];
138
+ if (error.length === 0) {
139
+ hideErrorTip();
140
+ context.removeFieldError(eventKey.value);
141
+ }
142
+ else {
143
+ removeTimer();
144
+ errorMap.message = _optionalChain([error, 'access', _4 => _4[0], 'optionalAccess', _5 => _5.message]) || errorMap.message;
145
+ errorMap.visible = !!error.length;
146
+ context.addFieldError(eventKey.value, errorMap.message);
147
+ }
148
+ return errorMap.message;
149
+ });
150
+ return promise;
151
+ };
152
+ const onFieldBlur = () => {
153
+ // validateRules()
154
+ };
155
+ const onFieldChange = () => {
156
+ validateRules();
157
+ emit('change');
158
+ };
159
+ watch(() => globalErrorMessage.value, (val) => {
160
+ if (val[eventKey.value]) {
161
+ showErrorTip(val[eventKey.value]);
162
+ }
163
+ else {
164
+ hideErrorTip();
165
+ }
166
+ }, { immediate: true, deep: true });
167
+ useProvideFormItemContext({
168
+ id: filedId,
169
+ onFieldChange,
170
+ onFieldBlur,
171
+ }, computed(() => get(context.dataSource.value, props.name)));
172
+ onBeforeUnmount(() => {
173
+ hideErrorTip();
174
+ });
175
+ watch(() => [filedName.value, props.name], () => {
176
+ context.addField(eventKey.value, {
177
+ filedName: filedName.value,
178
+ eventKey: eventKey.value,
179
+ names: props.name,
180
+ validateRules,
181
+ showErrorTip
182
+ });
183
+ }, { immediate: true });
184
+ return (_ctx, _cache) => {
185
+ const _component_a_tooltip = _resolveComponent("a-tooltip");
186
+ return (_openBlock(), _createElementBlock(_Fragment, null, [
187
+ _createVNode(_component_a_tooltip, {
188
+ color: "#ffffff",
189
+ "get-popup-container": popContainer,
190
+ arrowPointAtCenter: true
191
+ }, {
192
+ title: _withCtx(() => [
193
+ _createElementVNode("span", _hoisted_1, _toDisplayString(errorMap.message), 1 /* TEXT */)
194
+ ]),
195
+ default: _withCtx(() => [
196
+ (errorMap.visible)
197
+ ? (_openBlock(), _createElementBlock("div", _hoisted_2))
198
+ : _createCommentVNode("v-if", true)
199
+ ]),
200
+ _: 1 /* STABLE */
201
+ }),
202
+ _createElementVNode("div", {
203
+ id: eventKey.value,
204
+ style: { "position": "relative" },
205
+ class: _normalizeClass({ 'edit-table-form-has-error': errorMap.message })
206
+ }, [
207
+ _renderSlot(_ctx.$slots, "default")
208
+ ], 10 /* CLASS, PROPS */, _hoisted_3)
209
+ ], 64 /* STABLE_FRAGMENT */));
210
+ };
211
+ }
212
+ });
213
+ export default __sfc_main__;
@@ -78,7 +78,7 @@ const __sfc_main__ = Object.assign({
78
78
  style: {
79
79
  type: Object,
80
80
  default: undefined
81
- }
81
+ },
82
82
  },
83
83
  setup(__props) {
84
84
  const props = __props;
@@ -232,8 +232,9 @@ const __sfc_main__ = Object.assign({
232
232
  key: 0,
233
233
  searchKey: searchData.key,
234
234
  rowKey: _ctx.rowKey,
235
+ columns: _ctx.searchColumns,
235
236
  onClose: _cache[0] || (_cache[0] = $event => (searchData.visible = false))
236
- }, null, 8 /* PROPS */, ["searchKey", "rowKey"]))
237
+ }, null, 8 /* PROPS */, ["searchKey", "rowKey", "columns"]))
237
238
  : _createCommentVNode("v-if", true)
238
239
  ], 64 /* STABLE_FRAGMENT */));
239
240
  };
@@ -17,6 +17,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
17
17
  /* Analyzed bindings: {
18
18
  "searchKey": "props",
19
19
  "rowKey": "props",
20
+ "columns": "props",
20
21
  "Table": "setup-const",
21
22
  "useTableDataSource": "setup-maybe-ref",
22
23
  "useTableTool": "setup-maybe-ref",
@@ -39,7 +40,6 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
39
40
  "tableHeight": "setup-ref",
40
41
  "selectedRowKeys": "setup-ref",
41
42
  "tableRef": "setup-ref",
42
- "columns": "setup-const",
43
43
  "selectedTableRow": "setup-const",
44
44
  "handleFilterArray": "setup-const",
45
45
  "search": "setup-const",
@@ -73,6 +73,10 @@ const __sfc_main__ = Object.assign({
73
73
  rowKey: {
74
74
  type: String,
75
75
  default: 'id'
76
+ },
77
+ columns: {
78
+ type: Array,
79
+ default: () => []
76
80
  }
77
81
  },
78
82
  emits: ['close'],
@@ -89,16 +93,6 @@ const __sfc_main__ = Object.assign({
89
93
  const tableHeight = ref(230);
90
94
  const selectedRowKeys = ref([]);
91
95
  const tableRef = ref();
92
- const columns = [
93
- {
94
- title: '标识',
95
- dataIndex: 'id',
96
- },
97
- {
98
- title: '名称',
99
- dataIndex: 'name',
100
- }
101
- ];
102
96
  const selectedTableRow = (record) => {
103
97
  tableTool.scrollTo({
104
98
  ...record,
@@ -238,7 +232,7 @@ const __sfc_main__ = Object.assign({
238
232
  ref_key: "tableRef",
239
233
  ref: tableRef,
240
234
  "data-source": filterArray.value,
241
- columns: columns,
235
+ columns: __props.columns,
242
236
  height: tableHeight.value,
243
237
  disableMenu: false,
244
238
  cellHeight: 36,
@@ -270,7 +264,7 @@ const __sfc_main__ = Object.assign({
270
264
  }, 1024 /* DYNAMIC_SLOTS */)
271
265
  ]),
272
266
  _: 1 /* STABLE */
273
- }, 8 /* PROPS */, ["data-source", "height", "rowSelection"])
267
+ }, 8 /* PROPS */, ["data-source", "columns", "height", "rowSelection"])
274
268
  ]))
275
269
  : _createCommentVNode("v-if", true),
276
270
  (visible.value)
@@ -1,9 +1,11 @@
1
1
  import EditTable from './EditTable.js';
2
2
  import EditTableBody from './Body.js';
3
3
  import EditTableHeader from './Header.js';
4
+ import FormItem from './FormItem.js';
4
5
  EditTable.install = function (app) {
5
6
  app.component(EditTable.name, EditTable);
6
7
  app.component(EditTableBody.name, EditTableBody);
7
8
  app.component(EditTableHeader.name, EditTableHeader);
9
+ app.component(FormItem.name, FormItem);
8
10
  };
9
11
  export default EditTable;
@@ -9,6 +9,18 @@ export var defaultProps = function defaultProps() {
9
9
  default: function _default() {
10
10
  return [];
11
11
  }
12
+ },
13
+ searchColumns: {
14
+ type: Array,
15
+ default: function _default() {
16
+ return [{
17
+ title: '标识',
18
+ dataIndex: 'id'
19
+ }, {
20
+ title: '名称',
21
+ dataIndex: 'name'
22
+ }];
23
+ }
12
24
  }
13
25
  };
14
26
  };
@@ -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-1722997806474"), n = n(), _popScopeId(), n);
9
+ const _withScopeId = n => (_pushScopeId("data-v-1722999078250"), 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';
@@ -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-1722997808659"), n = n(), _popScopeId(), n);
24
+ const _withScopeId = n => (_pushScopeId("data-v-1722999080365"), 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-1722997808112"), n = n(), _popScopeId(), n);
81
+ const _withScopeId = n => (_pushScopeId("data-v-1722999079745"), n = n(), _popScopeId(), n);
82
82
  const _hoisted_1 = { class: "JSearch-item" };
83
83
  const _hoisted_2 = {
84
84
  key: 0,
@@ -36,7 +36,7 @@
36
36
  } */
37
37
  import { defineComponent as _defineComponent } from 'vue';
38
38
  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-1722997808265"), n = n(), _popScopeId(), n);
39
+ const _withScopeId = n => (_pushScopeId("data-v-1722999079821"), n = n(), _popScopeId(), n);
40
40
  const _hoisted_1 = { class: "JSearch-content simple" };
41
41
  const _hoisted_2 = { class: "JSearch-items" };
42
42
  import { Button, Row, Col, Form, FormItemRest, } from 'ant-design-vue';
@@ -348,8 +348,9 @@ const __sfc_main__ = Object.assign({
348
348
  _createVNode(Header, {
349
349
  columns: myColumns.value,
350
350
  style: _normalizeStyle({ width: tableStyle.width }),
351
- rowKey: _ctx.rowKey
352
- }, null, 8 /* PROPS */, ["columns", "style", "rowKey"]),
351
+ rowKey: _ctx.rowKey,
352
+ searchColumns: _ctx.searchColumns
353
+ }, null, 8 /* PROPS */, ["columns", "style", "rowKey", "searchColumns"]),
353
354
  _createElementVNode("div", {
354
355
  class: "jetlinks-edit-table-header-scroll-hidden",
355
356
  style: _normalizeStyle({ width: _unref(scrollWidth) + 'px' })
@@ -0,0 +1,213 @@
1
+ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) {
2
+ const op = ops[i];
3
+ const fn = ops[i + 1];
4
+ i += 2;
5
+ if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) {
6
+ return undefined;
7
+ }
8
+ if (op === 'access' || op === 'optionalAccess') {
9
+ lastAccessLHS = value;
10
+ value = fn(value);
11
+ }
12
+ else if (op === 'call' || op === 'optionalCall') {
13
+ value = fn((...args) => value.call(lastAccessLHS, ...args));
14
+ lastAccessLHS = undefined;
15
+ }
16
+ } return value; }
17
+ /* Analyzed bindings: {
18
+ "name": "props",
19
+ "required": "props",
20
+ "onBeforeUnmount": "setup-const",
21
+ "computed": "setup-const",
22
+ "reactive": "setup-const",
23
+ "watch": "setup-const",
24
+ "defineOptions": "setup-const",
25
+ "get": "setup-maybe-ref",
26
+ "isArray": "setup-maybe-ref",
27
+ "useProvideFormItemContext": "setup-maybe-ref",
28
+ "useInjectError": "setup-maybe-ref",
29
+ "useInjectForm": "setup-maybe-ref",
30
+ "TABLE_FORM_ITEM_ERROR": "setup-maybe-ref",
31
+ "props": "setup-reactive-const",
32
+ "emit": "setup-const",
33
+ "context": "setup-maybe-ref",
34
+ "globalErrorMessage": "setup-maybe-ref",
35
+ "hideTimer": "setup-let",
36
+ "eventKey": "setup-ref",
37
+ "errorMap": "setup-reactive-const",
38
+ "filedId": "setup-ref",
39
+ "filedName": "setup-ref",
40
+ "filedValue": "setup-ref",
41
+ "popContainer": "setup-const",
42
+ "removeTimer": "setup-const",
43
+ "showErrorTip": "setup-const",
44
+ "hideErrorTip": "setup-const",
45
+ "validateRules": "setup-const",
46
+ "onFieldBlur": "setup-const",
47
+ "onFieldChange": "setup-const"
48
+ } */
49
+ 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";
50
+ const _withScopeId = n => (_pushScopeId("data-v-1722999077850"), n = n(), _popScopeId(), n);
51
+ const _hoisted_1 = { style: { "color": "#1d2129" } };
52
+ const _hoisted_2 = {
53
+ key: 0,
54
+ class: "table-form-error-target"
55
+ };
56
+ const _hoisted_3 = ["id"];
57
+ import { onBeforeUnmount, computed, reactive, watch, } from "vue";
58
+ import { get, isArray } from 'lodash-es';
59
+ import { useProvideFormItemContext } from 'ant-design-vue/es/form/FormItemContext';
60
+ import { useInjectError, useInjectForm } from "./hooks";
61
+ import { TABLE_FORM_ITEM_ERROR } from "./consts";
62
+ const __sfc_main__ = Object.assign({
63
+ name: 'JEditTableFormItem'
64
+ }, {
65
+ props: {
66
+ name: {
67
+ type: [String, Array],
68
+ default: undefined
69
+ },
70
+ required: {
71
+ type: Boolean,
72
+ default: false
73
+ }
74
+ },
75
+ emits: ['change'],
76
+ setup(__props, { emit: __emit }) {
77
+ const props = __props;
78
+ const emit = __emit;
79
+ const context = useInjectForm();
80
+ const globalErrorMessage = useInjectError();
81
+ let hideTimer;
82
+ const eventKey = computed(() => {
83
+ const names = isArray(props.name) ? props.name : [props.name];
84
+ return names.join('-');
85
+ });
86
+ const errorMap = reactive({
87
+ message: '',
88
+ visible: false
89
+ });
90
+ const filedId = computed(() => {
91
+ const names = isArray(props.name) ? props.name : [props.name];
92
+ return names.join('_');
93
+ });
94
+ const filedName = computed(() => {
95
+ const names = isArray(props.name) ? props.name : [props.name];
96
+ const _rules = context.rules.value;
97
+ let tempKey = undefined;
98
+ for (const key of names) {
99
+ if (key in _rules) {
100
+ tempKey = key;
101
+ }
102
+ }
103
+ return tempKey;
104
+ });
105
+ const filedValue = computed(() => {
106
+ return get(context.dataSource.value, props.name);
107
+ });
108
+ provide(TABLE_FORM_ITEM_ERROR, errorMap);
109
+ const popContainer = (e) => {
110
+ return e;
111
+ };
112
+ const removeTimer = () => {
113
+ if (hideTimer) {
114
+ window.clearTimeout(hideTimer);
115
+ hideTimer = null;
116
+ }
117
+ };
118
+ const showErrorTip = (msg) => {
119
+ removeTimer();
120
+ errorMap.message = msg;
121
+ errorMap.visible = true;
122
+ };
123
+ const hideErrorTip = () => {
124
+ errorMap.visible = false;
125
+ removeTimer();
126
+ hideTimer = setTimeout(() => {
127
+ errorMap.message = '';
128
+ }, 300);
129
+ };
130
+ const validateRules = () => {
131
+ let index = 0;
132
+ if (isArray(props.name)) {
133
+ index = props.name[0];
134
+ }
135
+ const promise = context.validateItem({ [filedName.value]: get(context.dataSource.value, props.name) }, index);
136
+ promise.catch(res => {
137
+ const error = _optionalChain([res, 'optionalAccess', _2 => _2.filter, 'call', _3 => _3(item => item.field === filedName.value)]) || [];
138
+ if (error.length === 0) {
139
+ hideErrorTip();
140
+ context.removeFieldError(eventKey.value);
141
+ }
142
+ else {
143
+ removeTimer();
144
+ errorMap.message = _optionalChain([error, 'access', _4 => _4[0], 'optionalAccess', _5 => _5.message]) || errorMap.message;
145
+ errorMap.visible = !!error.length;
146
+ context.addFieldError(eventKey.value, errorMap.message);
147
+ }
148
+ return errorMap.message;
149
+ });
150
+ return promise;
151
+ };
152
+ const onFieldBlur = () => {
153
+ // validateRules()
154
+ };
155
+ const onFieldChange = () => {
156
+ validateRules();
157
+ emit('change');
158
+ };
159
+ watch(() => globalErrorMessage.value, (val) => {
160
+ if (val[eventKey.value]) {
161
+ showErrorTip(val[eventKey.value]);
162
+ }
163
+ else {
164
+ hideErrorTip();
165
+ }
166
+ }, { immediate: true, deep: true });
167
+ useProvideFormItemContext({
168
+ id: filedId,
169
+ onFieldChange,
170
+ onFieldBlur,
171
+ }, computed(() => get(context.dataSource.value, props.name)));
172
+ onBeforeUnmount(() => {
173
+ hideErrorTip();
174
+ });
175
+ watch(() => [filedName.value, props.name], () => {
176
+ context.addField(eventKey.value, {
177
+ filedName: filedName.value,
178
+ eventKey: eventKey.value,
179
+ names: props.name,
180
+ validateRules,
181
+ showErrorTip
182
+ });
183
+ }, { immediate: true });
184
+ return (_ctx, _cache) => {
185
+ const _component_a_tooltip = _resolveComponent("a-tooltip");
186
+ return (_openBlock(), _createElementBlock(_Fragment, null, [
187
+ _createVNode(_component_a_tooltip, {
188
+ color: "#ffffff",
189
+ "get-popup-container": popContainer,
190
+ arrowPointAtCenter: true
191
+ }, {
192
+ title: _withCtx(() => [
193
+ _createElementVNode("span", _hoisted_1, _toDisplayString(errorMap.message), 1 /* TEXT */)
194
+ ]),
195
+ default: _withCtx(() => [
196
+ (errorMap.visible)
197
+ ? (_openBlock(), _createElementBlock("div", _hoisted_2))
198
+ : _createCommentVNode("v-if", true)
199
+ ]),
200
+ _: 1 /* STABLE */
201
+ }),
202
+ _createElementVNode("div", {
203
+ id: eventKey.value,
204
+ style: { "position": "relative" },
205
+ class: _normalizeClass({ 'edit-table-form-has-error': errorMap.message })
206
+ }, [
207
+ _renderSlot(_ctx.$slots, "default")
208
+ ], 10 /* CLASS, PROPS */, _hoisted_3)
209
+ ], 64 /* STABLE_FRAGMENT */));
210
+ };
211
+ }
212
+ });
213
+ export default __sfc_main__;
@@ -78,7 +78,7 @@ const __sfc_main__ = Object.assign({
78
78
  style: {
79
79
  type: Object,
80
80
  default: undefined
81
- }
81
+ },
82
82
  },
83
83
  setup(__props) {
84
84
  const props = __props;
@@ -232,8 +232,9 @@ const __sfc_main__ = Object.assign({
232
232
  key: 0,
233
233
  searchKey: searchData.key,
234
234
  rowKey: _ctx.rowKey,
235
+ columns: _ctx.searchColumns,
235
236
  onClose: _cache[0] || (_cache[0] = $event => (searchData.visible = false))
236
- }, null, 8 /* PROPS */, ["searchKey", "rowKey"]))
237
+ }, null, 8 /* PROPS */, ["searchKey", "rowKey", "columns"]))
237
238
  : _createCommentVNode("v-if", true)
238
239
  ], 64 /* STABLE_FRAGMENT */));
239
240
  };
@@ -17,6 +17,7 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
17
17
  /* Analyzed bindings: {
18
18
  "searchKey": "props",
19
19
  "rowKey": "props",
20
+ "columns": "props",
20
21
  "Table": "setup-const",
21
22
  "useTableDataSource": "setup-maybe-ref",
22
23
  "useTableTool": "setup-maybe-ref",
@@ -39,7 +40,6 @@ function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]
39
40
  "tableHeight": "setup-ref",
40
41
  "selectedRowKeys": "setup-ref",
41
42
  "tableRef": "setup-ref",
42
- "columns": "setup-const",
43
43
  "selectedTableRow": "setup-const",
44
44
  "handleFilterArray": "setup-const",
45
45
  "search": "setup-const",
@@ -73,6 +73,10 @@ const __sfc_main__ = Object.assign({
73
73
  rowKey: {
74
74
  type: String,
75
75
  default: 'id'
76
+ },
77
+ columns: {
78
+ type: Array,
79
+ default: () => []
76
80
  }
77
81
  },
78
82
  emits: ['close'],
@@ -89,16 +93,6 @@ const __sfc_main__ = Object.assign({
89
93
  const tableHeight = ref(230);
90
94
  const selectedRowKeys = ref([]);
91
95
  const tableRef = ref();
92
- const columns = [
93
- {
94
- title: '标识',
95
- dataIndex: 'id',
96
- },
97
- {
98
- title: '名称',
99
- dataIndex: 'name',
100
- }
101
- ];
102
96
  const selectedTableRow = (record) => {
103
97
  tableTool.scrollTo({
104
98
  ...record,
@@ -238,7 +232,7 @@ const __sfc_main__ = Object.assign({
238
232
  ref_key: "tableRef",
239
233
  ref: tableRef,
240
234
  "data-source": filterArray.value,
241
- columns: columns,
235
+ columns: __props.columns,
242
236
  height: tableHeight.value,
243
237
  disableMenu: false,
244
238
  cellHeight: 36,
@@ -270,7 +264,7 @@ const __sfc_main__ = Object.assign({
270
264
  }, 1024 /* DYNAMIC_SLOTS */)
271
265
  ]),
272
266
  _: 1 /* STABLE */
273
- }, 8 /* PROPS */, ["data-source", "height", "rowSelection"])
267
+ }, 8 /* PROPS */, ["data-source", "columns", "height", "rowSelection"])
274
268
  ]))
275
269
  : _createCommentVNode("v-if", true),
276
270
  (visible.value)
@@ -8,9 +8,11 @@ exports.default = void 0;
8
8
  var _EditTable = _interopRequireDefault(require("./EditTable.js"));
9
9
  var _Body = _interopRequireDefault(require("./Body.js"));
10
10
  var _Header = _interopRequireDefault(require("./Header.js"));
11
+ var _FormItem = _interopRequireDefault(require("./FormItem.js"));
11
12
  _EditTable.default.install = function (app) {
12
13
  app.component(_EditTable.default.name, _EditTable.default);
13
14
  app.component(_Body.default.name, _Body.default);
14
15
  app.component(_Header.default.name, _Header.default);
16
+ app.component(_FormItem.default.name, _FormItem.default);
15
17
  };
16
18
  var _default = exports.default = _EditTable.default;
@@ -15,6 +15,18 @@ var defaultProps = exports.defaultProps = function defaultProps() {
15
15
  default: function _default() {
16
16
  return [];
17
17
  }
18
+ },
19
+ searchColumns: {
20
+ type: Array,
21
+ default: function _default() {
22
+ return [{
23
+ title: '标识',
24
+ dataIndex: 'id'
25
+ }, {
26
+ title: '名称',
27
+ dataIndex: 'name'
28
+ }];
29
+ }
18
30
  }
19
31
  };
20
32
  };
@@ -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-1722997806466"), n = n(), _popScopeId(), n);
9
+ const _withScopeId = n => (_pushScopeId("data-v-1722999078243"), 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';
@@ -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-1722997808646"), n = n(), _popScopeId(), n);
24
+ const _withScopeId = n => (_pushScopeId("data-v-1722999080380"), 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-1722997808043"), n = n(), _popScopeId(), n);
81
+ const _withScopeId = n => (_pushScopeId("data-v-1722999079674"), n = n(), _popScopeId(), n);
82
82
  const _hoisted_1 = { class: "JSearch-item" };
83
83
  const _hoisted_2 = {
84
84
  key: 0,
@@ -36,7 +36,7 @@
36
36
  } */
37
37
  import { defineComponent as _defineComponent } from 'vue';
38
38
  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-1722997808246"), n = n(), _popScopeId(), n);
39
+ const _withScopeId = n => (_pushScopeId("data-v-1722999079843"), n = n(), _popScopeId(), n);
40
40
  const _hoisted_1 = { class: "JSearch-content simple" };
41
41
  const _hoisted_2 = { class: "JSearch-items" };
42
42
  import { Button, Row, Col, Form, FormItemRest, } from 'ant-design-vue';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jetlinks-web/components",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -136,9 +136,9 @@
136
136
  "webpack-dev-server": "^4.0.0",
137
137
  "webpack-merge": "^5.0.0",
138
138
  "webpackbar": "^5.0.2",
139
+ "@jetlinks-web/utils": "^1.0.7",
139
140
  "@jetlinks-web/constants": "^1.0.2",
140
- "@jetlinks-web/hooks": "^1.0.13",
141
- "@jetlinks-web/utils": "^1.0.7"
141
+ "@jetlinks-web/hooks": "^1.0.13"
142
142
  },
143
143
  "publishConfig": {
144
144
  "registry": "https://registry.npmjs.org/",