vue2-components-plus 1.0.36 → 1.0.37
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.
- package/dist/ComponentDemo/DialogDemo.md +13 -10
- package/dist/ComponentDemo/DialogDemo.vue +20 -10
- package/dist/ComponentDemo/FormDemo.md +17 -3
- package/dist/ComponentDemo/FormDemo.vue +97 -80
- package/dist/vue2-components-plus.css +1 -1
- package/dist/vue2-components-plus.es5.js +30 -13
- package/dist/vue2-components-plus.js +30 -13
- package/dist/vue2-components-plus.umd.cjs +1 -1
- package/package.json +1 -1
|
@@ -80,7 +80,7 @@ const instance = window.NsDialog(
|
|
|
80
80
|
| `close` | `Function` | `null` | `el-dialog` 的 `close` 阶段回调 |
|
|
81
81
|
| `closed` | `Function` | `null` | `el-dialog` 的 `closed` 阶段回调;工厂会在这里销毁实例 |
|
|
82
82
|
| `draggable` | `Boolean` | `false` | 是否允许拖拽标题栏 |
|
|
83
|
-
| `confirm` | `Function` | `null` |
|
|
83
|
+
| `confirm` | `Function` | `null` | 点击默认确认按钮时的回调,签名为 `(closeFn, contentRef, loadingProxy)` |
|
|
84
84
|
| `x` | `Number \| String` | `null` | 固定定位 `left` |
|
|
85
85
|
| `y` | `Number \| String` | `null` | 固定定位 `top` |
|
|
86
86
|
| `maxSize` | `Function` | `null` | 存在时显示最大化按钮,函数返回最大化后的宽高坐标 |
|
|
@@ -108,6 +108,7 @@ const instance = window.NsDialog(
|
|
|
108
108
|
- 若 `footerCloseOnly=true`,默认底部只显示关闭按钮
|
|
109
109
|
- 点击默认确认按钮后会执行 `dealConfirm`
|
|
110
110
|
- 若未配置 `confirm`,按钮只会短暂进入 loading 后立即结束,不会自动关闭
|
|
111
|
+
- 若配置了 `confirm` 且不调用 `closeFn()`,需要在业务侧手动 `loadingProxy.value = false` 结束 loading
|
|
111
112
|
- 若 `confirm` 中调用了 `closeFn()`,组件会关闭,并自动弹出一次 `操作成功`
|
|
112
113
|
|
|
113
114
|
### 5.4 `immediately=true` 的真实行为
|
|
@@ -137,13 +138,13 @@ const instance = window.NsDialog(
|
|
|
137
138
|
### 6.1 常规模式
|
|
138
139
|
|
|
139
140
|
```js
|
|
140
|
-
confirm(closeFn, contentRef, loadingProxy) {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
141
|
+
confirm: async (closeFn, contentRef, loadingProxy) => {
|
|
142
|
+
const data = await contentRef.getFormData()
|
|
143
|
+
if (!data) {
|
|
144
|
+
loadingProxy.value = false
|
|
145
|
+
return
|
|
146
|
+
}
|
|
147
|
+
closeFn()
|
|
147
148
|
}
|
|
148
149
|
```
|
|
149
150
|
|
|
@@ -153,13 +154,14 @@ confirm(closeFn, contentRef, loadingProxy) {
|
|
|
153
154
|
|---|---|
|
|
154
155
|
| `closeFn` | 调用后关闭弹窗,仅在 `immediately=false` 时有意义 |
|
|
155
156
|
| `contentRef` | 内容组件实例,可调用其公开方法 |
|
|
156
|
-
| `loadingProxy` |
|
|
157
|
+
| `loadingProxy` | 可读写对象,使用 `loadingProxy.value = false` 可在校验失败时取消确认按钮 loading(仅在 `immediately=false` 时传入) |
|
|
157
158
|
|
|
158
159
|
### 6.3 更稳妥的生成策略
|
|
159
160
|
|
|
160
161
|
- 如果需要异步校验后再关闭,用 `immediately=false`
|
|
161
162
|
- 内容组件应暴露公开方法,例如 `getFormData`
|
|
162
163
|
- 让 `confirm` 只负责校验、提交和决定是否调用 `closeFn`
|
|
164
|
+
- 在校验失败或捕获异常时,显式设置 `loadingProxy.value = false`
|
|
163
165
|
- 不要假设 `confirm` 返回 Promise 后会被组件自动等待;当前实现不会自动处理返回值
|
|
164
166
|
|
|
165
167
|
## 7. 实例对象能力
|
|
@@ -293,9 +295,10 @@ const openDialog = () => {
|
|
|
293
295
|
console.log('内容组件事件', payload)
|
|
294
296
|
},
|
|
295
297
|
},
|
|
296
|
-
confirm: async (closeFn, contentRef) => {
|
|
298
|
+
confirm: async (closeFn, contentRef, loadingProxy) => {
|
|
297
299
|
const result = await contentRef.getFormData()
|
|
298
300
|
if (!result) {
|
|
301
|
+
loadingProxy.value = false
|
|
299
302
|
return
|
|
300
303
|
}
|
|
301
304
|
closeFn()
|
|
@@ -147,18 +147,18 @@ const openDialog = (options = {}) => {
|
|
|
147
147
|
class: 'dialog-demo-instance',
|
|
148
148
|
dom: FormDemo,
|
|
149
149
|
width: options.width || '900px',
|
|
150
|
-
height: options.height || '
|
|
150
|
+
height: options.height || '1500px',
|
|
151
151
|
dialogPadding: [10, 10],
|
|
152
152
|
modal: options.modal !== undefined ? options.modal : false,
|
|
153
153
|
draggable: true,
|
|
154
|
-
maxSize: () => ({
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
}),
|
|
160
|
-
x: `calc(50% - 450px)`,
|
|
161
|
-
y: `calc(50% - 250px)`,
|
|
154
|
+
// maxSize: () => ({
|
|
155
|
+
// width: '100%',
|
|
156
|
+
// height: '100%',
|
|
157
|
+
// x: 0,
|
|
158
|
+
// y: 0,
|
|
159
|
+
// }),
|
|
160
|
+
// x: `calc(50% - 450px)`,
|
|
161
|
+
// y: `calc(50% - 250px)`,
|
|
162
162
|
option: {
|
|
163
163
|
readOnly,
|
|
164
164
|
insideDialog: true,
|
|
@@ -174,10 +174,20 @@ const openDialog = (options = {}) => {
|
|
|
174
174
|
domRef.showToast('弹窗内容已加载完成')
|
|
175
175
|
}
|
|
176
176
|
},
|
|
177
|
-
confirm: (closeFn, componentRef) => {
|
|
177
|
+
confirm: async (closeFn, componentRef, loading) => {
|
|
178
178
|
if (componentRef && typeof componentRef.showToast === 'function') {
|
|
179
179
|
componentRef.showToast('点击了弹窗底部确认按钮')
|
|
180
180
|
}
|
|
181
|
+
let validateResult = true
|
|
182
|
+
if (componentRef && typeof componentRef.getFormData === 'function') {
|
|
183
|
+
validateResult = await componentRef.getFormData()
|
|
184
|
+
}
|
|
185
|
+
if (validateResult === false) {
|
|
186
|
+
if (loading && Object.prototype.hasOwnProperty.call(loading, 'value')) {
|
|
187
|
+
loading.value = false
|
|
188
|
+
}
|
|
189
|
+
return
|
|
190
|
+
}
|
|
181
191
|
setTimeout(() => {
|
|
182
192
|
if (typeof closeFn === 'function') {
|
|
183
193
|
closeFn()
|
|
@@ -22,13 +22,14 @@
|
|
|
22
22
|
|
|
23
23
|
```vue
|
|
24
24
|
<template>
|
|
25
|
-
<el-form ref="shellForm" :model="state"
|
|
25
|
+
<el-form ref="shellForm" :model="state">
|
|
26
26
|
<NsFormTitle title="基础信息">
|
|
27
27
|
<NsForm
|
|
28
28
|
ref="formRef"
|
|
29
29
|
:rows="state.rows"
|
|
30
30
|
formPropKey="rows"
|
|
31
31
|
model="vertical"
|
|
32
|
+
:labelPosition="labelPosition"
|
|
32
33
|
labelWidth="120"
|
|
33
34
|
gapH="16px"
|
|
34
35
|
gapV="12px"
|
|
@@ -41,6 +42,7 @@
|
|
|
41
42
|
import { reactive, ref } from 'vue'
|
|
42
43
|
|
|
43
44
|
const formRef = ref(null)
|
|
45
|
+
const labelPosition = ref('left')
|
|
44
46
|
|
|
45
47
|
const state = reactive({
|
|
46
48
|
rows: [
|
|
@@ -86,6 +88,14 @@ const state = reactive({
|
|
|
86
88
|
| `valueEmptyTag` | `String` | `'--'` | 空值占位 |
|
|
87
89
|
| `formPropKey` | `String` | `'rows'` | 生成内部 `el-form-item.prop` 的前缀 |
|
|
88
90
|
| `hasPoint` | `Boolean` | `false` | 是否统一显示红色星号 |
|
|
91
|
+
| `labelPosition` | `String` | `'left'` | 标签方向,支持 `left / top / right` |
|
|
92
|
+
|
|
93
|
+
### 4.1 `labelPosition` 说明
|
|
94
|
+
|
|
95
|
+
- 该属性控制的是 `NsForm` 自己渲染的标签布局,不是外层 `el-form-item` 的标签布局
|
|
96
|
+
- 支持值为 `left`、`top`、`right`
|
|
97
|
+
- 默认值是 `left`
|
|
98
|
+
- 当使用 `top` 时,标签会显示在字段内容上方
|
|
89
99
|
|
|
90
100
|
## 5. `rows` 数据结构
|
|
91
101
|
|
|
@@ -290,6 +300,7 @@ field.slots = {
|
|
|
290
300
|
| 上传字段 | `value + params.fileList + delValue` |
|
|
291
301
|
| 联动字段 | `events.change` |
|
|
292
302
|
| 只读切换 | `readOnly` + `params.formatter` |
|
|
303
|
+
| 标签方向 | `labelPosition` 在 `left / top / right` 间切换 |
|
|
293
304
|
| 数据操作 | `getFormKvData / setFormData / resetForm` |
|
|
294
305
|
| 节点访问 | `getFormNodeByKey / getFormNodeRefByKey` |
|
|
295
306
|
|
|
@@ -301,6 +312,7 @@ field.slots = {
|
|
|
301
312
|
- 自定义指令统一放在 `params['v-xxx']`
|
|
302
313
|
- 上传场景必须同步维护 `value` 和 `params.fileList`
|
|
303
314
|
- 联动逻辑优先写在 `field.events.change`
|
|
315
|
+
- 需要控制标签方向时,优先使用 `NsForm.labelPosition`,不要依赖外层 `el-form` 的 `label-position`
|
|
304
316
|
- 不要把 `initDefaultValues()` 当成“强制重建全部默认值”的方法
|
|
305
317
|
|
|
306
318
|
## 15. 推荐 Prompt
|
|
@@ -312,7 +324,7 @@ field.slots = {
|
|
|
312
324
|
3) 每个字段遵循 key、label、value、component、params、events 结构;
|
|
313
325
|
4) 演示 params.options、params.rules、params.formatter、params['v-length.range'];
|
|
314
326
|
5) 演示 getFormKvData、setFormData、resetForm(true)、getFormNodeByKey、getFormNodeRefByKey;
|
|
315
|
-
6) 演示 readOnly 切换;
|
|
327
|
+
6) 演示 readOnly 与 labelPosition(left/top/right) 切换;
|
|
316
328
|
7) 代码风格与当前仓库一致,不使用 TS,不虚构不存在的方法。
|
|
317
329
|
```
|
|
318
330
|
|
|
@@ -320,7 +332,7 @@ field.slots = {
|
|
|
320
332
|
|
|
321
333
|
```vue
|
|
322
334
|
<template>
|
|
323
|
-
<el-form ref="shellForm" :model="state"
|
|
335
|
+
<el-form ref="shellForm" :model="state">
|
|
324
336
|
<NsFormTitle title="基础信息">
|
|
325
337
|
<NsForm
|
|
326
338
|
ref="formRef"
|
|
@@ -328,6 +340,7 @@ field.slots = {
|
|
|
328
340
|
formPropKey="rows"
|
|
329
341
|
model="vertical"
|
|
330
342
|
:readOnly="readOnly"
|
|
343
|
+
:labelPosition="labelPosition"
|
|
331
344
|
labelWidth="120"
|
|
332
345
|
gapH="16px"
|
|
333
346
|
gapV="12px"
|
|
@@ -349,6 +362,7 @@ import { reactive, ref, nextTick } from 'vue'
|
|
|
349
362
|
const shellForm = ref(null)
|
|
350
363
|
const formRef = ref(null)
|
|
351
364
|
const readOnly = ref(false)
|
|
365
|
+
const labelPosition = ref('left')
|
|
352
366
|
|
|
353
367
|
const state = reactive({
|
|
354
368
|
rows: [
|
|
@@ -24,15 +24,23 @@
|
|
|
24
24
|
<el-button type="primary" @click="getFormData">获取表单数据</el-button>
|
|
25
25
|
<el-button @click="loadDetailData()">模拟详情回填</el-button>
|
|
26
26
|
<el-button @click="resetFormData()">重置表单</el-button>
|
|
27
|
-
<el-button @click="inspectFormNode">查看节点配置</el-button>
|
|
28
|
-
<el-button @click="inspectFormNodeRef">查看节点实例</el-button>
|
|
29
|
-
<el-button @click="rebuildDefaultValues">重建默认值快照</el-button>
|
|
27
|
+
<el-button @click="inspectFormNode">查看节点配置</el-button>
|
|
28
|
+
<el-button @click="inspectFormNodeRef">查看节点实例</el-button>
|
|
29
|
+
<el-button @click="rebuildDefaultValues">重建默认值快照</el-button>
|
|
30
30
|
<el-button @click="toggleReadOnly">切换只读</el-button>
|
|
31
31
|
<el-button @click="notifyInnerButton">触发自定义事件</el-button>
|
|
32
32
|
<el-button v-if="insideDialog" type="danger" plain @click="emit('close')">从内容区关闭弹窗</el-button>
|
|
33
33
|
</div>
|
|
34
|
+
<div class="toolbar toolbar--compact">
|
|
35
|
+
<span class="toolbar__label">标签方向</span>
|
|
36
|
+
<el-radio-group v-model="labelPosition" size="small">
|
|
37
|
+
<el-radio-button label="left">left</el-radio-button>
|
|
38
|
+
<el-radio-button label="top">top</el-radio-button>
|
|
39
|
+
<el-radio-button label="right">right</el-radio-button>
|
|
40
|
+
</el-radio-group>
|
|
41
|
+
</div>
|
|
34
42
|
|
|
35
|
-
<el-form ref="shellForm" :model="formState"
|
|
43
|
+
<el-form ref="shellForm" :model="formState" class="shell-form">
|
|
36
44
|
<NsFormTitle title="模型参数">
|
|
37
45
|
<NsForm
|
|
38
46
|
ref="row1Ref"
|
|
@@ -44,7 +52,8 @@
|
|
|
44
52
|
labelColor="#606266"
|
|
45
53
|
labelWidth="140"
|
|
46
54
|
gapH="20px"
|
|
47
|
-
gapV="
|
|
55
|
+
gapV="20px"
|
|
56
|
+
:labelPosition="labelPosition"
|
|
48
57
|
/>
|
|
49
58
|
</NsFormTitle>
|
|
50
59
|
|
|
@@ -59,7 +68,8 @@
|
|
|
59
68
|
labelColor="#606266"
|
|
60
69
|
labelWidth="140"
|
|
61
70
|
gapH="20px"
|
|
62
|
-
gapV="
|
|
71
|
+
gapV="20px"
|
|
72
|
+
:labelPosition="labelPosition"
|
|
63
73
|
/>
|
|
64
74
|
</NsFormTitle>
|
|
65
75
|
|
|
@@ -74,7 +84,8 @@
|
|
|
74
84
|
labelColor="#606266"
|
|
75
85
|
labelWidth="140"
|
|
76
86
|
gapH="20px"
|
|
77
|
-
gapV="
|
|
87
|
+
gapV="20px"
|
|
88
|
+
:labelPosition="labelPosition"
|
|
78
89
|
/>
|
|
79
90
|
</NsFormTitle>
|
|
80
91
|
|
|
@@ -89,7 +100,8 @@
|
|
|
89
100
|
labelColor="#606266"
|
|
90
101
|
labelWidth="140"
|
|
91
102
|
gapH="20px"
|
|
92
|
-
gapV="
|
|
103
|
+
gapV="20px"
|
|
104
|
+
:labelPosition="labelPosition"
|
|
93
105
|
/>
|
|
94
106
|
</NsFormTitle>
|
|
95
107
|
|
|
@@ -104,7 +116,8 @@
|
|
|
104
116
|
labelColor="#606266"
|
|
105
117
|
labelWidth="140"
|
|
106
118
|
gapH="20px"
|
|
107
|
-
gapV="
|
|
119
|
+
gapV="20px"
|
|
120
|
+
:labelPosition="labelPosition"
|
|
108
121
|
/>
|
|
109
122
|
</NsFormTitle>
|
|
110
123
|
</el-form>
|
|
@@ -221,38 +234,32 @@ function createRows() {
|
|
|
221
234
|
},
|
|
222
235
|
},
|
|
223
236
|
],
|
|
224
|
-
[
|
|
225
|
-
{
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
'v-length.range': { min: 1, max: 16, int: true },
|
|
251
|
-
},
|
|
252
|
-
},
|
|
253
|
-
],
|
|
254
|
-
},
|
|
255
|
-
],
|
|
237
|
+
[
|
|
238
|
+
{
|
|
239
|
+
key: 'inferMode',
|
|
240
|
+
label: '推理模式',
|
|
241
|
+
value: 'fast',
|
|
242
|
+
component: 'ElSelect',
|
|
243
|
+
params: {
|
|
244
|
+
clearable: true,
|
|
245
|
+
options: [
|
|
246
|
+
{ label: '快速', value: 'fast' },
|
|
247
|
+
{ label: '平衡', value: 'balanced' },
|
|
248
|
+
{ label: '高精度', value: 'accurate' },
|
|
249
|
+
],
|
|
250
|
+
},
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
key: 'batchSize',
|
|
254
|
+
label: '批量大小',
|
|
255
|
+
value: '1',
|
|
256
|
+
component: 'ElInput',
|
|
257
|
+
params: {
|
|
258
|
+
clearable: true,
|
|
259
|
+
'v-length.range': { min: 1, max: 16, int: true },
|
|
260
|
+
},
|
|
261
|
+
},
|
|
262
|
+
],
|
|
256
263
|
]
|
|
257
264
|
}
|
|
258
265
|
|
|
@@ -501,8 +508,8 @@ function createDetailData() {
|
|
|
501
508
|
modelName: 'helmet-detector-v2',
|
|
502
509
|
confidence: '0.72',
|
|
503
510
|
iou: '0.33',
|
|
504
|
-
inferMode: 'accurate',
|
|
505
|
-
batchSize: '4',
|
|
511
|
+
inferMode: 'accurate',
|
|
512
|
+
batchSize: '4',
|
|
506
513
|
timeInterval: '3',
|
|
507
514
|
stuck_threshold: ['component', 'table'],
|
|
508
515
|
maxRetries: '5',
|
|
@@ -528,6 +535,7 @@ function createDetailData() {
|
|
|
528
535
|
}
|
|
529
536
|
|
|
530
537
|
const demoReadOnly = ref(props.readOnly)
|
|
538
|
+
const labelPosition = ref('left')
|
|
531
539
|
const outputText = ref('')
|
|
532
540
|
const uploadFileList = ref([])
|
|
533
541
|
const formState = reactive({
|
|
@@ -722,40 +730,40 @@ const notifyInnerButton = () => {
|
|
|
722
730
|
emit('btnClick', collectFormData())
|
|
723
731
|
proxy.$message.success('已触发自定义事件')
|
|
724
732
|
}
|
|
725
|
-
|
|
726
|
-
const inspectFormNode = () => {
|
|
727
|
-
if (!row1Ref.value || typeof row1Ref.value.getFormNodeByKey !== 'function') {
|
|
728
|
-
proxy.$message.warning('表单实例尚未就绪')
|
|
729
|
-
return
|
|
730
|
-
}
|
|
731
|
-
const node = row1Ref.value.getFormNodeByKey('modelName')
|
|
732
|
-
proxy.$message.info(node ? '已找到字段节点:' + node.label : '未找到字段节点 modelName')
|
|
733
|
-
}
|
|
734
|
-
|
|
735
|
-
const inspectFormNodeRef = () => {
|
|
736
|
-
if (!row1Ref.value || typeof row1Ref.value.getFormNodeRefByKey !== 'function') {
|
|
737
|
-
proxy.$message.warning('表单实例尚未就绪')
|
|
738
|
-
return
|
|
739
|
-
}
|
|
740
|
-
const nodeRef = row1Ref.value.getFormNodeRefByKey('modelName')
|
|
741
|
-
if (!nodeRef) {
|
|
742
|
-
proxy.$message.warning('未找到字段实例 modelName')
|
|
743
|
-
return
|
|
744
|
-
}
|
|
745
|
-
if (typeof nodeRef.focus === 'function') {
|
|
746
|
-
nodeRef.focus()
|
|
747
|
-
}
|
|
748
|
-
proxy.$message.success('已获取 modelName 对应组件实例')
|
|
749
|
-
}
|
|
750
|
-
|
|
751
|
-
const rebuildDefaultValues = () => {
|
|
752
|
-
getFormRefs().forEach((refInstance) => {
|
|
753
|
-
if (refInstance && typeof refInstance.initDefaultValues === 'function') {
|
|
754
|
-
refInstance.initDefaultValues()
|
|
755
|
-
}
|
|
756
|
-
})
|
|
757
|
-
proxy.$message.success('已重建默认值快照')
|
|
758
|
-
}
|
|
733
|
+
|
|
734
|
+
const inspectFormNode = () => {
|
|
735
|
+
if (!row1Ref.value || typeof row1Ref.value.getFormNodeByKey !== 'function') {
|
|
736
|
+
proxy.$message.warning('表单实例尚未就绪')
|
|
737
|
+
return
|
|
738
|
+
}
|
|
739
|
+
const node = row1Ref.value.getFormNodeByKey('modelName')
|
|
740
|
+
proxy.$message.info(node ? '已找到字段节点:' + node.label : '未找到字段节点 modelName')
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
const inspectFormNodeRef = () => {
|
|
744
|
+
if (!row1Ref.value || typeof row1Ref.value.getFormNodeRefByKey !== 'function') {
|
|
745
|
+
proxy.$message.warning('表单实例尚未就绪')
|
|
746
|
+
return
|
|
747
|
+
}
|
|
748
|
+
const nodeRef = row1Ref.value.getFormNodeRefByKey('modelName')
|
|
749
|
+
if (!nodeRef) {
|
|
750
|
+
proxy.$message.warning('未找到字段实例 modelName')
|
|
751
|
+
return
|
|
752
|
+
}
|
|
753
|
+
if (typeof nodeRef.focus === 'function') {
|
|
754
|
+
nodeRef.focus()
|
|
755
|
+
}
|
|
756
|
+
proxy.$message.success('已获取 modelName 对应组件实例')
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
const rebuildDefaultValues = () => {
|
|
760
|
+
getFormRefs().forEach((refInstance) => {
|
|
761
|
+
if (refInstance && typeof refInstance.initDefaultValues === 'function') {
|
|
762
|
+
refInstance.initDefaultValues()
|
|
763
|
+
}
|
|
764
|
+
})
|
|
765
|
+
proxy.$message.success('已重建默认值快照')
|
|
766
|
+
}
|
|
759
767
|
|
|
760
768
|
const normalizeUploadList = (fileList) =>
|
|
761
769
|
(fileList || []).map((item) => {
|
|
@@ -841,9 +849,9 @@ defineExpose({
|
|
|
841
849
|
resetFormData,
|
|
842
850
|
loadDetailData,
|
|
843
851
|
showToast,
|
|
844
|
-
inspectFormNode,
|
|
845
|
-
inspectFormNodeRef,
|
|
846
|
-
rebuildDefaultValues,
|
|
852
|
+
inspectFormNode,
|
|
853
|
+
inspectFormNodeRef,
|
|
854
|
+
rebuildDefaultValues,
|
|
847
855
|
})
|
|
848
856
|
</script>
|
|
849
857
|
|
|
@@ -889,6 +897,15 @@ defineExpose({
|
|
|
889
897
|
margin-bottom: 20px;
|
|
890
898
|
}
|
|
891
899
|
|
|
900
|
+
.toolbar--compact {
|
|
901
|
+
margin-top: -8px;
|
|
902
|
+
}
|
|
903
|
+
|
|
904
|
+
.toolbar__label {
|
|
905
|
+
font-size: 13px;
|
|
906
|
+
color: #606266;
|
|
907
|
+
}
|
|
908
|
+
|
|
892
909
|
.shell-form {
|
|
893
910
|
display: flex;
|
|
894
911
|
flex-direction: column;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
html,body{margin:0;padding:0}*{box-sizing:border-box}:root{--matrix-form-title-width: 18px;--matrix-form-title-height: 18px;--matrix-form-title-gap: 8px;--matrix-form-title-color: #303133;--matrix-form-title-margin-bottom: 12px;--matrix-form-title-content-padding: 0;--matrix-form-title-icon: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAOCAYAAADJ7fe0AAAAAXNSR0IArs4c6QAAAElJREFUOE9jZMABOKv/HwVJfW9ltCbEZqSpIbgMxyaO4hJCzkb3GsxA6htCiheQ1TKS6wXqG0KuF1Bcgswh12uDKHZomuxJCR8ApFSZL0U+kogAAAAASUVORK5CYII=);--matrix-dialog-bk-color: #ffffff;--matrix-dialog-border-radius: 8px;--matrix-dialog-box-shadow: 0 12px 32px rgba(31, 35, 41, .12);--matrix-dialog-header-bg-color: #f5f7fa;--matrix-dialog-header-text-color: #303133;--matrix-dialog-header-height: 54px;--matrix-dialog-padding-top-bottom: 16px;--matrix-dialog-padding-left-right: 20px;--matrix-dialog-footer-gap: 12px}.ns-dialog-plus-modal{background-color:#00000073}.ns-dynamic-form[data-v-
|
|
1
|
+
html,body{margin:0;padding:0}*{box-sizing:border-box}:root{--matrix-form-title-width: 18px;--matrix-form-title-height: 18px;--matrix-form-title-gap: 8px;--matrix-form-title-color: #303133;--matrix-form-title-margin-bottom: 12px;--matrix-form-title-content-padding: 0;--matrix-form-title-icon: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAOCAYAAADJ7fe0AAAAAXNSR0IArs4c6QAAAElJREFUOE9jZMABOKv/HwVJfW9ltCbEZqSpIbgMxyaO4hJCzkb3GsxA6htCiheQ1TKS6wXqG0KuF1Bcgswh12uDKHZomuxJCR8ApFSZL0U+kogAAAAASUVORK5CYII=);--matrix-dialog-bk-color: #ffffff;--matrix-dialog-border-radius: 8px;--matrix-dialog-box-shadow: 0 12px 32px rgba(31, 35, 41, .12);--matrix-dialog-header-bg-color: #f5f7fa;--matrix-dialog-header-text-color: #303133;--matrix-dialog-header-height: 54px;--matrix-dialog-padding-top-bottom: 16px;--matrix-dialog-padding-left-right: 20px;--matrix-dialog-footer-gap: 12px}.ns-dialog-plus-modal{background-color:#00000073}.ns-dynamic-form[data-v-6ad4d76c]{width:100%}.ns-dynamic-form__row[data-v-6ad4d76c]{display:flex;flex-wrap:wrap;gap:var(--ns-form-col-gap)}.ns-dynamic-form__item[data-v-6ad4d76c]{display:flex;align-items:flex-start;padding:0}.ns-dynamic-form__item.has-children[data-v-6ad4d76c]{align-items:stretch}.ns-dynamic-form.is-vertical .ns-dynamic-form__item[data-v-6ad4d76c],.ns-dynamic-form__child[data-v-6ad4d76c]{background:var(--ns-form-background-color);border-radius:4px}.ns-dynamic-form__label[data-v-6ad4d76c],.ns-dynamic-form__group-label[data-v-6ad4d76c]{flex:none;width:var(--ns-form-label-width);min-height:var(--ns-form-item-height);line-height:var(--ns-form-item-height);padding-right:12px;color:var(--ns-form-label-color);word-break:break-all}.ns-dynamic-form__group-label[data-v-6ad4d76c]{width:var(--ns-form-super-label-width);color:var(--ns-form-label-color)}.ns-dynamic-form.is-label-top .ns-dynamic-form__item[data-v-6ad4d76c],.ns-dynamic-form.is-label-top .ns-dynamic-form__child[data-v-6ad4d76c]{flex-direction:column;align-items:stretch}.ns-dynamic-form.is-label-top .ns-dynamic-form__label[data-v-6ad4d76c],.ns-dynamic-form.is-label-top .ns-dynamic-form__group-label[data-v-6ad4d76c]{width:100%;min-height:auto;line-height:1.5;margin-bottom:6px;padding-right:0}.ns-dynamic-form__label.has-point[data-v-6ad4d76c]:before{content:"*";color:#f56c6c;margin-right:4px}.ns-dynamic-form__value[data-v-6ad4d76c]{flex:1;min-width:0;line-height:var(--ns-form-item-height)}.ns-dynamic-form__children[data-v-6ad4d76c]{flex:1}.ns-dynamic-form__child[data-v-6ad4d76c]{display:flex;padding:6px 0}.ns-dynamic-form__form-item[data-v-6ad4d76c]{margin-bottom:0}.ns-dynamic-form__form-item[data-v-6ad4d76c] .el-form-item__content{line-height:normal}.ns-dynamic-form.is-table[data-v-6ad4d76c]{border:1px solid #ebeef5;border-bottom:0}.ns-dynamic-form.is-table .ns-dynamic-form__row[data-v-6ad4d76c]{gap:0;margin-bottom:0!important}.ns-dynamic-form.is-table .ns-dynamic-form__item[data-v-6ad4d76c]{padding:12px;border-right:1px solid #ebeef5;border-bottom:1px solid #ebeef5}.ns-dynamic-form.is-table .ns-dynamic-form__item[data-v-6ad4d76c]:last-child{border-right:0}.ns-form-title[data-v-29c80ec1]{width:100%;display:flex;flex-direction:column;margin-bottom:var(--matrix-form-title-margin-bottom)}.ns-form-title__header[data-v-29c80ec1]{display:flex;align-items:center;gap:var(--matrix-form-title-gap);margin-bottom:var(--matrix-form-title-margin-bottom);color:var(--matrix-form-title-color)}.ns-form-title__icon[data-v-29c80ec1]{display:inline-block;width:var(--matrix-form-title-width);height:var(--matrix-form-title-height);border-radius:4px;background:var(--matrix-form-title-icon) no-repeat center center / 100% auto}.ns-form-title__text[data-v-29c80ec1]{font-size:18px;font-weight:500;color:var(--matrix-form-title-color)}.ns-form-title__content[data-v-29c80ec1]{width:100%}.page-search[data-v-cebdda8d]{margin-bottom:16px;padding:16px 16px 0;background:#fff;border-radius:4px}.page-search__actions[data-v-cebdda8d]{display:flex;align-items:center}.page-search__actions[data-v-cebdda8d] .el-form-item{display:flex;align-items:center;min-height:40px}.page-search__actions[data-v-cebdda8d] .el-form-item__content{display:flex;align-items:center;flex-wrap:nowrap;white-space:nowrap}.page-search__actions[data-v-cebdda8d] .el-button{white-space:nowrap}.page-search__form[data-v-cebdda8d]{width:100%}.page-search__row[data-v-cebdda8d]{flex-wrap:wrap;align-items:flex-start}.page-search__form[data-v-cebdda8d] .el-form-item{display:flex;align-items:center;width:100%;margin-right:0}.page-search__form[data-v-cebdda8d] .el-form-item__label{float:none;white-space:nowrap;padding-right:12px}.page-search__form[data-v-cebdda8d] .el-form-item__content{flex:1;min-width:0}.page-search__form[data-v-cebdda8d] .el-form-item__content>.el-input,.page-search__form[data-v-cebdda8d] .el-form-item__content>.el-textarea,.page-search__form[data-v-cebdda8d] .el-form-item__content>.el-select,.page-search__form[data-v-cebdda8d] .el-form-item__content>.el-date-editor,.page-search__form[data-v-cebdda8d] .el-form-item__content>.el-cascader,.page-search__form[data-v-cebdda8d] .el-form-item__content>.el-autocomplete,.page-search__form[data-v-cebdda8d] .el-form-item__content>.el-input-number,.page-search__form[data-v-cebdda8d] .el-form-item__content>.el-slider{width:100%}.page-table[data-v-d962dc48]{display:flex;flex-direction:column;width:100%;min-height:0}.page-table__main[data-v-d962dc48]{flex:1;min-height:0}.page-table__table[data-v-d962dc48]{width:100%}.page-table__table--no-border[data-v-d962dc48] .el-table:after,.page-table__table--no-border[data-v-d962dc48] .el-table--border:after{width:0}.page-table__table--no-border[data-v-d962dc48] .el-table__header-wrapper th,.page-table__table--no-border[data-v-d962dc48] .el-table__body-wrapper td{border-right:0}.page-table__header[data-v-d962dc48]{display:flex;align-items:center;justify-content:space-between;margin-bottom:12px}.page-table__actions[data-v-d962dc48]{display:flex;align-items:center;gap:8px}.page-table__pagination[data-v-d962dc48]{display:flex;justify-content:flex-end;margin-top:16px}.page-table__empty[data-v-d962dc48]{padding:24px 0;color:#909399;text-align:center}.page-container[data-v-df3951e4]{display:flex;flex-direction:column;width:100%;height:100%;min-height:0}.page-container .page-table[data-v-df3951e4]{flex:1;min-height:0}.ns-dialog-plus__header[data-v-6762dc10]{display:flex;align-items:center;justify-content:space-between;min-height:var(--matrix-dialog-header-height);cursor:default}.ns-dialog-plus__title[data-v-6762dc10]{flex:1;font-size:16px;font-weight:600;color:var(--matrix-dialog-header-text-color)}.dialog-controls[data-v-6762dc10]{display:flex;align-items:center;gap:8px}.dialog-icon[data-v-6762dc10]{display:flex;align-items:center;justify-content:center;width:28px;height:28px;border-radius:6px;color:var(--matrix-dialog-header-text-color);cursor:pointer;transition:background-color .2s ease,color .2s ease}.dialog-icon[data-v-6762dc10]:hover{background:rgba(0,0,0,.06);color:var(--matrix-color-primary, #409eff)}.dialog-close[data-v-6762dc10]:hover{color:#f56c6c}.ns-dialog-plus__body[data-v-6762dc10]{min-height:60px;flex:1 1 auto;min-width:0}.ns-dialog-plus__footer[data-v-6762dc10]{display:flex;justify-content:flex-end;gap:var(--matrix-dialog-footer-gap)}[data-v-6762dc10] .ns-dialog-plus{overflow:hidden;border-radius:var(--matrix-dialog-border-radius);box-shadow:var(--matrix-dialog-box-shadow)}[data-v-6762dc10] .ns-dialog-plus .el-dialog__header,[data-v-6762dc10] .ns-dialog-plus .el-dialog__footer{flex:0 0 auto}[data-v-6762dc10] .ns-dialog-plus .el-dialog__header{padding:0 20px;background:var(--matrix-dialog-header-bg-color)}[data-v-6762dc10] .ns-dialog-plus .el-dialog__body{padding:0;display:flex;flex:1 1 auto;min-height:0;overflow:hidden}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
function _defineAccessor(e, r, n, t) { var c = { configurable: !0, enumerable: !0 }; return c[e] = t, Object.defineProperty(r, n, c); }
|
|
2
1
|
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
3
2
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
4
3
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
@@ -559,7 +558,7 @@ function isNotNull(value) {
|
|
|
559
558
|
}
|
|
560
559
|
return !(value === "" || value === null || typeof value === "undefined" || value === "null" || value === "undefined" || String(value).trim() === "" || String(value).trim() === "undefined");
|
|
561
560
|
}
|
|
562
|
-
var
|
|
561
|
+
var DynamicForm_vue_vue_type_style_index_0_scoped_6ad4d76c_lang = "";
|
|
563
562
|
function normalizeComponent(scriptExports, render7, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
564
563
|
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
565
564
|
if (render7) {
|
|
@@ -693,6 +692,10 @@ var _sfc_main$5 = {
|
|
|
693
692
|
hasPoint: {
|
|
694
693
|
type: Boolean,
|
|
695
694
|
default: false
|
|
695
|
+
},
|
|
696
|
+
labelPosition: {
|
|
697
|
+
type: String,
|
|
698
|
+
default: "left"
|
|
696
699
|
}
|
|
697
700
|
},
|
|
698
701
|
data: function data() {
|
|
@@ -702,12 +705,19 @@ var _sfc_main$5 = {
|
|
|
702
705
|
},
|
|
703
706
|
computed: {
|
|
704
707
|
formClassList: function formClassList() {
|
|
708
|
+
var labelPosition = this.normalizedLabelPosition;
|
|
705
709
|
return {
|
|
706
710
|
"is-vertical": this.model.indexOf("vertical") > -1,
|
|
707
711
|
"is-table": this.model.indexOf("table") > -1,
|
|
708
|
-
"is-readonly": this.readOnly
|
|
712
|
+
"is-readonly": this.readOnly,
|
|
713
|
+
"is-label-left": labelPosition === "left",
|
|
714
|
+
"is-label-right": labelPosition === "right",
|
|
715
|
+
"is-label-top": labelPosition === "top"
|
|
709
716
|
};
|
|
710
717
|
},
|
|
718
|
+
normalizedLabelPosition: function normalizedLabelPosition() {
|
|
719
|
+
return ["left", "right", "top"].includes(this.labelPosition) ? this.labelPosition : "left";
|
|
720
|
+
},
|
|
711
721
|
wrapperStyle: function wrapperStyle() {
|
|
712
722
|
return {
|
|
713
723
|
"--ns-form-label-width": this.normalizeSize(this.labelWidth),
|
|
@@ -727,13 +737,15 @@ var _sfc_main$5 = {
|
|
|
727
737
|
labelStyle: function labelStyle() {
|
|
728
738
|
return {
|
|
729
739
|
width: this.normalizeSize(this.labelWidth),
|
|
730
|
-
color: this.labelColor
|
|
740
|
+
color: this.labelColor,
|
|
741
|
+
textAlign: this.normalizedLabelPosition === "right" ? "right" : "left"
|
|
731
742
|
};
|
|
732
743
|
},
|
|
733
744
|
groupLabelStyle: function groupLabelStyle() {
|
|
734
745
|
return {
|
|
735
746
|
width: this.normalizeSize(this.superLabelWidth),
|
|
736
|
-
color: this.labelColor
|
|
747
|
+
color: this.labelColor,
|
|
748
|
+
textAlign: this.normalizedLabelPosition === "right" ? "right" : "left"
|
|
737
749
|
};
|
|
738
750
|
},
|
|
739
751
|
valueStyle: function valueStyle() {
|
|
@@ -1142,7 +1154,7 @@ var _sfc_render$5 = function render() {
|
|
|
1142
1154
|
}), 0) : _vm._e();
|
|
1143
1155
|
};
|
|
1144
1156
|
var _sfc_staticRenderFns$5 = [];
|
|
1145
|
-
var __component__$5 = /* @__PURE__ */normalizeComponent(_sfc_main$5, _sfc_render$5, _sfc_staticRenderFns$5, false, null, "
|
|
1157
|
+
var __component__$5 = /* @__PURE__ */normalizeComponent(_sfc_main$5, _sfc_render$5, _sfc_staticRenderFns$5, false, null, "6ad4d76c", null, null);
|
|
1146
1158
|
var NsForm = __component__$5.exports;
|
|
1147
1159
|
var ThemeVar2 = /*#__PURE__*/_createClass(function ThemeVar2() {
|
|
1148
1160
|
_classCallCheck(this, ThemeVar2);
|
|
@@ -2675,7 +2687,7 @@ var NsTableContainer = __component__$1.exports;
|
|
|
2675
2687
|
Vue2.component(component.name, component);
|
|
2676
2688
|
};
|
|
2677
2689
|
});
|
|
2678
|
-
var
|
|
2690
|
+
var NsDialog_vue_vue_type_style_index_0_scoped_6762dc10_lang = "";
|
|
2679
2691
|
var _sfc_main = {
|
|
2680
2692
|
name: "NsDialogComponent",
|
|
2681
2693
|
props: {
|
|
@@ -3151,6 +3163,15 @@ var _sfc_main = {
|
|
|
3151
3163
|
},
|
|
3152
3164
|
dealConfirm: function dealConfirm() {
|
|
3153
3165
|
var _this25 = this;
|
|
3166
|
+
var vm = this;
|
|
3167
|
+
var loadingController = {
|
|
3168
|
+
get value() {
|
|
3169
|
+
return vm.footerLoading;
|
|
3170
|
+
},
|
|
3171
|
+
set value(nextValue) {
|
|
3172
|
+
vm.footerLoading = !!nextValue;
|
|
3173
|
+
}
|
|
3174
|
+
};
|
|
3154
3175
|
this.footerLoading = true;
|
|
3155
3176
|
if (!this.confirm) {
|
|
3156
3177
|
this.footerLoading = false;
|
|
@@ -3166,11 +3187,7 @@ var _sfc_main = {
|
|
|
3166
3187
|
_this25.footerLoading = false;
|
|
3167
3188
|
_this25.visible = false;
|
|
3168
3189
|
_this25.$message && _this25.$message.success && _this25.$message.success("操作成功");
|
|
3169
|
-
}, this.$refs.contentRef,
|
|
3170
|
-
value: this.footerLoading
|
|
3171
|
-
}, "value", function (nextValue) {
|
|
3172
|
-
this.footerLoading = nextValue;
|
|
3173
|
-
}));
|
|
3190
|
+
}, this.$refs.contentRef, loadingController);
|
|
3174
3191
|
},
|
|
3175
3192
|
handleKeydown: function handleKeydown(event) {
|
|
3176
3193
|
if (!this.visible || !this.showFooter) return;
|
|
@@ -3316,7 +3333,7 @@ var _sfc_render = function render6() {
|
|
|
3316
3333
|
}, [_vm._v(_vm._s(_vm.footerButtonText.confirm))]) : _vm._e()]], 2) : _vm._e()]);
|
|
3317
3334
|
};
|
|
3318
3335
|
var _sfc_staticRenderFns = [];
|
|
3319
|
-
var __component__ = /* @__PURE__ */normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "
|
|
3336
|
+
var __component__ = /* @__PURE__ */normalizeComponent(_sfc_main, _sfc_render, _sfc_staticRenderFns, false, null, "6762dc10", null, null);
|
|
3320
3337
|
var NsDialogComponent = __component__.exports;
|
|
3321
3338
|
var dialogInstances = typeof window !== "undefined" ? window.__dialogInstances = window.__dialogInstances || [] : [];
|
|
3322
3339
|
var externalVue = Vue;
|
|
@@ -518,7 +518,7 @@ function isNotNull(value) {
|
|
|
518
518
|
}
|
|
519
519
|
return !(value === "" || value === null || typeof value === "undefined" || value === "null" || value === "undefined" || String(value).trim() === "" || String(value).trim() === "undefined");
|
|
520
520
|
}
|
|
521
|
-
const
|
|
521
|
+
const DynamicForm_vue_vue_type_style_index_0_scoped_6ad4d76c_lang = "";
|
|
522
522
|
function normalizeComponent(scriptExports, render7, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
|
|
523
523
|
var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
|
|
524
524
|
if (render7) {
|
|
@@ -649,6 +649,10 @@ const _sfc_main$5 = {
|
|
|
649
649
|
hasPoint: {
|
|
650
650
|
type: Boolean,
|
|
651
651
|
default: false
|
|
652
|
+
},
|
|
653
|
+
labelPosition: {
|
|
654
|
+
type: String,
|
|
655
|
+
default: "left"
|
|
652
656
|
}
|
|
653
657
|
},
|
|
654
658
|
data() {
|
|
@@ -658,12 +662,19 @@ const _sfc_main$5 = {
|
|
|
658
662
|
},
|
|
659
663
|
computed: {
|
|
660
664
|
formClassList() {
|
|
665
|
+
const labelPosition = this.normalizedLabelPosition;
|
|
661
666
|
return {
|
|
662
667
|
"is-vertical": this.model.indexOf("vertical") > -1,
|
|
663
668
|
"is-table": this.model.indexOf("table") > -1,
|
|
664
|
-
"is-readonly": this.readOnly
|
|
669
|
+
"is-readonly": this.readOnly,
|
|
670
|
+
"is-label-left": labelPosition === "left",
|
|
671
|
+
"is-label-right": labelPosition === "right",
|
|
672
|
+
"is-label-top": labelPosition === "top"
|
|
665
673
|
};
|
|
666
674
|
},
|
|
675
|
+
normalizedLabelPosition() {
|
|
676
|
+
return ["left", "right", "top"].includes(this.labelPosition) ? this.labelPosition : "left";
|
|
677
|
+
},
|
|
667
678
|
wrapperStyle() {
|
|
668
679
|
return {
|
|
669
680
|
"--ns-form-label-width": this.normalizeSize(this.labelWidth),
|
|
@@ -683,13 +694,15 @@ const _sfc_main$5 = {
|
|
|
683
694
|
labelStyle() {
|
|
684
695
|
return {
|
|
685
696
|
width: this.normalizeSize(this.labelWidth),
|
|
686
|
-
color: this.labelColor
|
|
697
|
+
color: this.labelColor,
|
|
698
|
+
textAlign: this.normalizedLabelPosition === "right" ? "right" : "left"
|
|
687
699
|
};
|
|
688
700
|
},
|
|
689
701
|
groupLabelStyle() {
|
|
690
702
|
return {
|
|
691
703
|
width: this.normalizeSize(this.superLabelWidth),
|
|
692
|
-
color: this.labelColor
|
|
704
|
+
color: this.labelColor,
|
|
705
|
+
textAlign: this.normalizedLabelPosition === "right" ? "right" : "left"
|
|
693
706
|
};
|
|
694
707
|
},
|
|
695
708
|
valueStyle() {
|
|
@@ -995,7 +1008,7 @@ var __component__$5 = /* @__PURE__ */ normalizeComponent(
|
|
|
995
1008
|
_sfc_staticRenderFns$5,
|
|
996
1009
|
false,
|
|
997
1010
|
null,
|
|
998
|
-
"
|
|
1011
|
+
"6ad4d76c",
|
|
999
1012
|
null,
|
|
1000
1013
|
null
|
|
1001
1014
|
);
|
|
@@ -2258,7 +2271,7 @@ const NsTableContainer = __component__$1.exports;
|
|
|
2258
2271
|
Vue2.component(component.name, component);
|
|
2259
2272
|
};
|
|
2260
2273
|
});
|
|
2261
|
-
const
|
|
2274
|
+
const NsDialog_vue_vue_type_style_index_0_scoped_6762dc10_lang = "";
|
|
2262
2275
|
const _sfc_main = {
|
|
2263
2276
|
name: "NsDialogComponent",
|
|
2264
2277
|
props: {
|
|
@@ -2711,6 +2724,15 @@ const _sfc_main = {
|
|
|
2711
2724
|
}
|
|
2712
2725
|
},
|
|
2713
2726
|
dealConfirm() {
|
|
2727
|
+
const vm = this;
|
|
2728
|
+
const loadingController = {
|
|
2729
|
+
get value() {
|
|
2730
|
+
return vm.footerLoading;
|
|
2731
|
+
},
|
|
2732
|
+
set value(nextValue) {
|
|
2733
|
+
vm.footerLoading = !!nextValue;
|
|
2734
|
+
}
|
|
2735
|
+
};
|
|
2714
2736
|
this.footerLoading = true;
|
|
2715
2737
|
if (!this.confirm) {
|
|
2716
2738
|
this.footerLoading = false;
|
|
@@ -2729,12 +2751,7 @@ const _sfc_main = {
|
|
|
2729
2751
|
this.$message && this.$message.success && this.$message.success("操作成功");
|
|
2730
2752
|
},
|
|
2731
2753
|
this.$refs.contentRef,
|
|
2732
|
-
|
|
2733
|
-
value: this.footerLoading,
|
|
2734
|
-
set value(nextValue) {
|
|
2735
|
-
this.footerLoading = nextValue;
|
|
2736
|
-
}
|
|
2737
|
-
}
|
|
2754
|
+
loadingController
|
|
2738
2755
|
);
|
|
2739
2756
|
},
|
|
2740
2757
|
handleKeydown(event) {
|
|
@@ -2802,7 +2819,7 @@ var __component__ = /* @__PURE__ */ normalizeComponent(
|
|
|
2802
2819
|
_sfc_staticRenderFns,
|
|
2803
2820
|
false,
|
|
2804
2821
|
null,
|
|
2805
|
-
"
|
|
2822
|
+
"6762dc10",
|
|
2806
2823
|
null,
|
|
2807
2824
|
null
|
|
2808
2825
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Vue2ComponentsPlus={},e.Vue)}(this,function(e,t){"use strict";var i=Object.defineProperty,n=Object.defineProperties,l=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,o=(e,t,n)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t)=>{for(var i in t||(t={}))a.call(t,i)&&o(e,i,t[i]);if(r)for(var i of r(t))s.call(t,i)&&o(e,i,t[i]);return e},c=(e,t)=>n(e,l(t)),u=(e,t)=>{var i={};for(var n in e)a.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&r)for(var n of r(e))t.indexOf(n)<0&&s.call(e,n)&&(i[n]=e[n]);return i};function h(e,t,i=!0){let n="",l=!1,r=!1;return String(e||"").split("").forEach((e,t)=>{if("-"!==e)if("."!==e){if(/^\d$/.test(e)){"0"!==(l?n.slice(1):n)||"0"===e||r||(n=l?"-":""),n+=e}}else 0===t||r||"-"===n[n.length-1]||(n+=e,r=!0);else i&&0===t&&!l&&(n+=e,l=!0)}),n.slice(0,t)}function p(e,t){if(t.int){const i=function(e,t,i){let n="",l=!1;const r=null!==i.min&&i.min<0;return String(e||"").split("").forEach((e,t)=>{"-"!==e?/^\d$/.test(e)&&("0"===(l?n.slice(1):n)&&"0"!==e&&(n=l?"-":""),n+=e):r&&0===t&&!l&&(n+=e,l=!0)}),n.slice(0,t)}(e,t.maxLength||50,t);if(""===i||"-"===i)return i;const n=parseInt(i,10);return Number.isNaN(n)?"":null!==t.min&&n<t.min?String(Math.ceil(t.min)):null!==t.max&&n>t.max?String(Math.floor(t.max)):i}const i=null!==t.min&&t.min<0,n=h(e,t.maxLength||50,i);if(""===n||"-"===n||"."===n)return n;const l=parseFloat(n);return Number.isNaN(l)?"":null!==t.min&&l<t.min?String(t.min):null!==t.max&&l>t.max?String(t.max):n}function f(e){return e?"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e:e.querySelector("input, textarea"):null}function m(e,t){if(!e)return;const i=function(e){const t={maxLength:50,pattern:null,min:null,max:null,int:!1},i=e.value;return"number"==typeof i?c(d({},t),{maxLength:i}):i&&"object"==typeof i?{maxLength:i.maxLength||t.maxLength,pattern:i.pattern||null,min:"number"==typeof i.min?i.min:null,max:"number"==typeof i.max?i.max:null,int:!!i.int}:t}(t);let n=e.value||"";n=t.modifiers.range?p(n,i):t.modifiers.number?h(n,i.maxLength):t.modifiers.regex&&i.pattern?function(e,t,i){let n="";return String(e||"").split("").forEach(e=>{if(n.length>=t)return;const l=n+e;i.test(l)&&(n=l)}),n}(n,i.maxLength,i.pattern):String(n).slice(0,i.maxLength),n!==e.value&&(e.value=n,e.dispatchEvent(new Event("input",{bubbles:!0})))}function g(e){e.directive("sline",{inserted(e){e.style.whiteSpace="nowrap",e.style.overflow="hidden",e.style.textOverflow="ellipsis",e.style.display="inline-block",e.style.maxWidth="100%"}}),e.directive("permission",{inserted(e,t){let i=[];try{i=JSON.parse(sessionStorage.getItem("btnsPermission")||localStorage.getItem("btnsPermission")||"[]")}catch(r){i=[]}Array.isArray(i)||(i=[]);const n=t.modifiers.class?"class":"id",l=!!t.modifiers.display;("class"===n?i.some(t=>e.classList.contains(t)):i.includes(e.getAttribute("id")))||(l?e.style.display="none":(e.style.visibility="hidden",e.style.pointerEvents="none"))}}),e.directive("length",{inserted(e,t){!function(e,t){const i=f(e);if(!i)return;let n=!1;const l=()=>{n=!0},r=()=>{n=!1,m(i,t)},a=()=>{n||m(i,t)};i.addEventListener("compositionstart",l),i.addEventListener("compositionend",r),i.addEventListener("input",a),m(i,t),e.__nsLengthHandlers={inputEl:i,handleCompositionStart:l,handleCompositionEnd:r,handleInput:a}}(e,t)},componentUpdated(e,t){m(f(e),t)},unbind(e){!function(e){const t=e.__nsLengthHandlers;t&&(t.inputEl.removeEventListener("compositionstart",t.handleCompositionStart),t.inputEl.removeEventListener("compositionend",t.handleCompositionEnd),t.inputEl.removeEventListener("input",t.handleInput),delete e.__nsLengthHandlers)}(e)}}),e.directive("event-unuse",{inserted(e){e.style.pointerEvents="none"}}),e.directive("event-use",{inserted(e){e.style.pointerEvents="auto"}})}let y=class{};function v(){if("undefined"==typeof document)return y.VARS;if(Object.keys(y.VARS).length>0)return y.VARS;const e={};return Array.from(document.styleSheets||[]).forEach(t=>{let i=[];try{i=Array.from(t.cssRules||[])}catch(n){i=[]}i.forEach(t=>{":root"===t.selectorText&&Array.from(t.style||[]).filter(e=>0===e.indexOf("--matrix-")).forEach(i=>{e[i]=t.style.getPropertyValue(i).trim()})})}),y.VARS=e,e}function b(e,t){const i=String("string"==typeof e?e:e&&e.name?e.name:"").replace(/-/g,"").toLowerCase();return t.some(e=>i===e.toLowerCase())}y.VARS={};function S(e){return!!Array.isArray(e)||(0===e||"0"===e||!(""===e||null==e||"null"===e||"undefined"===e||""===String(e).trim()||"undefined"===String(e).trim()))}function w(e,t,i,n,l,r,a,s){var o,d="function"==typeof e?e.options:e;if(t&&(d.render=t,d.staticRenderFns=i,d._compiled=!0),n&&(d.functional=!0),r&&(d._scopeId="data-v-"+r),a?(o=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),l&&l.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},d._ssrRegister=o):l&&(o=s?function(){l.call(this,(d.functional?this.parent:this).$root.$options.shadowRoot)}:l),o)if(d.functional){d._injectStyles=o;var c=d.render;d.render=function(e,t){return o.call(t),c(e,t)}}else{var u=d.beforeCreate;d.beforeCreate=u?[].concat(u,o):[o]}return{exports:e,options:d}}function C(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(e=>C(e));const t={};return Object.keys(e).forEach(i=>{t[i]=C(e[i])}),t}function R(e){return String("string"==typeof e?e:e&&e.name?e.name:"").replace(/-/g,"").toLowerCase()}const $=w({name:"NsForm",components:{FormFieldRenderer:{name:"NsFormFieldRenderer",inheritAttrs:!1,props:{field:{type:Object,required:!0},value:{default:void 0}},mounted(){this.emitRef()},updated(){this.emitRef()},methods:{emitRef(){this.$emit("ref",this.$refs.control||null)},getComponent(){return(e=this.field.component)?"string"==typeof e?"string"!=typeof(t=e)?t:t.indexOf("-")>-1?t.toLowerCase():t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase():e:"span";var e,t},isUpload(){return b(this.field.component,["elupload"])},rendersOptionsByChildren(){return b(this.field.component,["elselect","elradiogroup","elcheckboxgroup"])},isFullWidthComponent(){return b(this.field.component,["elinput","elselect","elcascader","eldatepicker","eltimepicker","elinputnumber","elautocomplete"])},buildProps(){const e=this.field.params||{},t={};return Object.keys(e).forEach(i=>{0!==i.indexOf("v-")&&"rules"!==i&&"style"!==i&&("options"===i&&this.rendersOptionsByChildren()||(t[i]=e[i]))}),this.isUpload()||(t.value=this.value),t},buildStyle(){const e=this.field.params||{},t=d(d({},this.field.style||{}),e.style||{});return this.isFullWidthComponent()&&void 0===t.width&&(t.width="100%"),t},buildDirectives(){const e=this.field.params||{};return Object.keys(e).filter(e=>0===e.indexOf("v-")).map(t=>{const[,i]=t.split("v-"),[n,...l]=i.split("."),r={};return l.forEach(e=>{r[e]=!0}),{name:n,value:e[t],modifiers:r}})},buildEvents(){const e=this.field.events||{},t={};if(Object.keys(e).forEach(i=>{t[i]=(...t)=>{e[i](...t)}}),!this.isUpload()){const e=t.input;t.input=(t,...i)=>{this.$emit("input",t),e&&e(t,...i)}}return t},buildScopedSlots(){const e=this.field.slots||{},t={};return Object.keys(e).forEach(i=>{"function"==typeof e[i]&&(t[i]=t=>e[i](t))}),t},renderOptionNodes(e){const t=(this.field.params||{}).options||[],i=this.getComponent();return Array.isArray(t)&&0!==t.length?b(i,["elselect"])?t.map((t,i)=>e("el-option",{key:void 0!==t.value?t.value:i,props:{label:t.label,value:t.value,disabled:t.disabled}})):b(i,["elradiogroup"])?t.map((t,i)=>e("el-radio",{key:void 0!==t.value?t.value:i,props:{label:t.value,disabled:t.disabled}},[t.label])):b(i,["elcheckboxgroup"])?t.map((t,i)=>e("el-checkbox",{key:void 0!==t.value?t.value:i,props:{label:t.value,disabled:t.disabled}},[t.label])):[]:[]}},render(e){const t=this.getComponent(),i=[],n=this.field.slots||{};return Object.keys(n).forEach(e=>{var t,l;"function"==typeof n[e]&&i.push(...(t=n[e]({field:this.field,value:this.value}),l=e,t?(Array.isArray(t)?t:[t]).map(e=>function(e,t){return e&&"default"!==t?((e.data||(e.data={})).slot=t,e):e}(e,l)).filter(Boolean):[]))}),e(t,{ref:"control",props:this.buildProps(),style:this.buildStyle(),on:this.buildEvents(),directives:this.buildDirectives(),scopedSlots:this.buildScopedSlots()},[...this.renderOptionNodes(e),...i])}}},props:{model:{type:String,default:""},readOnly:{type:Boolean,default:!1},labelWidth:{type:String,default:"80px"},superLabelWidth:{type:String,default:"30px"},labelColor:{type:String,default:"#0A7BFF"},gapH:{type:String,default:"10px"},gapV:{type:String,default:"10px"},height:{type:String,default:"32px"},rows:{type:Array,default:()=>[]},backgroundColor:{type:String,default:""},valueEmptyTag:{type:String,default:"--"},formPropKey:{type:String,default:"rows"},hasPoint:{type:Boolean,default:!1}},data:()=>({componentRefs:{}}),computed:{formClassList(){return{"is-vertical":this.model.indexOf("vertical")>-1,"is-table":this.model.indexOf("table")>-1,"is-readonly":this.readOnly}},wrapperStyle(){return{"--ns-form-label-width":this.normalizeSize(this.labelWidth),"--ns-form-super-label-width":this.normalizeSize(this.superLabelWidth),"--ns-form-label-color":this.labelColor,"--ns-form-row-gap":this.gapV,"--ns-form-col-gap":this.gapH,"--ns-form-item-height":this.normalizeSize(this.height),"--ns-form-background-color":this.backgroundColor||"#ffffff"}},rowStyle(){return{marginBottom:this.model.indexOf("table")>-1?"0":this.gapV}},labelStyle(){return{width:this.normalizeSize(this.labelWidth),color:this.labelColor}},groupLabelStyle(){return{width:this.normalizeSize(this.superLabelWidth),color:this.labelColor}},valueStyle(){return{minHeight:this.normalizeSize(this.height)}}},watch:{rows:{handler(e){this.initializeDefaultValues(e)},deep:!0,immediate:!0}},methods:{walkFields(e){(this.rows||[]).forEach((t,i)=>{(t||[]).forEach((t,n)=>{e(t,i,n,null,null),(t.children||[]).forEach((l,r)=>{e(l,i,n,r,t)})})})},initializeDefaultValues(e){(e||[]).forEach(e=>{(e||[]).forEach(e=>{e&&e.key&&void 0===e.defaultValue&&this.$set(e,"defaultValue",C(e.value)),(e.children||[]).forEach(e=>{e&&e.key&&void 0===e.defaultValue&&this.$set(e,"defaultValue",C(e.value))})})})},normalizeSize:e=>null==e||""===e?"":/^\d+$/.test(String(e))?`${e}px`:String(e),hasChildren:e=>Array.isArray(e.children)&&e.children.length>0,getItemStyle(e,t){if(0===e.span)return{display:"none"};if("string"==typeof e.span&&e.span.indexOf("%")>-1)return{flex:`0 0 ${e.span}`,maxWidth:e.span};if(void 0!==e.span&&null!==e.span&&""!==e.span){const t=Number(e.span);if(!Number.isNaN(t)){const e=t>24?`${t}px`:t/24*100+"%";return{flex:`0 0 ${e}`,maxWidth:e}}}const i=`calc(${100/((t||[]).filter(e=>e&&0!==e.span).length||1)}% - ${this.gapH})`;return{flex:`0 0 ${i}`,maxWidth:i}},getFieldRules(e){return this.readOnly?[]:e.params&&e.params.rules||[]},isRequiredField(e){return!(!e||this.readOnly)&&("boolean"==typeof e.required?e.required:this.getFieldRules(e).some(e=>e&&e.required))},getFieldRequired(e){return!(!e||this.readOnly)&&(e&&"boolean"==typeof e.required?e.required:void 0)},updateFieldValue(e,t){this.$set(e,"value",t)},setComponentRef(e,t){e&&e.key&&(this.$set(e,"ref",t),this.$set(this.componentRefs,e.key,t))},showReadOnlyText(e){return this.readOnly&&!(e&&e.readOnlyUseComponent)},normalizeDisplayValue(e,t){return S(e)?Array.isArray(e)?e.join(","):e:t&&t.valueEmptyTag||this.valueEmptyTag},getReadOnlyDisplayValue(e){var t,i,n;return e?"function"==typeof(null==(t=e.params)?void 0:t.formatter)?e.params.formatter(e.value,e)||this.valueEmptyTag:S(e.value)?this.isUploadComponent(e)?(e.value||[]).map(e=>e.fileName||e.name||e.filePath).filter(Boolean).join(",")||e.valueEmptyTag||this.valueEmptyTag:this.isSwitchComponent(e)?e.value?(null==(i=e.params)?void 0:i.activeText)||"是":(null==(n=e.params)?void 0:n.inactiveText)||"否":this.isSelectLikeComponent(e)?this.getOptionDisplayText(e):this.isCascaderComponent(e)?this.getCascaderDisplayValue(e):Array.isArray(e.value)?e.value.join(","):e.value:e.valueEmptyTag||this.valueEmptyTag:this.valueEmptyTag},getOptionDisplayText(e){var t;const i=(null==(t=e.params)?void 0:t.options)||[],n=e.value;return(Array.isArray(n)?n:"string"==typeof n&&n.indexOf(",")>-1?n.split(",").filter(Boolean):[n]).map(e=>{const t=i.find(t=>t.value===e);return t?t.label:e}).filter(e=>null!=e&&""!==e).join(",")||e.valueEmptyTag||this.valueEmptyTag},getCascaderDisplayValue(e){var t,i,n,l;const r=e.params||{},a=r.options||[],s={value:(null==(t=r.props)?void 0:t.value)||"value",label:(null==(i=r.props)?void 0:i.label)||"label",children:(null==(n=r.props)?void 0:n.children)||"children",multiple:!!(null==(l=r.props)?void 0:l.multiple),separator:r.separator||" / "},o=e=>{const t=[];let i=a;return(e=>Array.isArray(e)?e:"string"==typeof e&&e.indexOf(",")>-1?e.split(",").filter(Boolean):[e])(e).forEach(e=>{const n=(i||[]).find(t=>t[s.value]===e);n&&(t.push(n[s.label]),i=n[s.children])}),t.join(s.separator)};return s.multiple&&Array.isArray(e.value)&&Array.isArray(e.value[0])?e.value.map(e=>o(e)).join(","):o(e.value)},isSelectLikeComponent:e=>["elselect","elradiogroup","elcheckboxgroup"].includes(R(e.component)),isSwitchComponent:e=>"elswitch"===R(e.component),isCascaderComponent:e=>"elcascader"===R(e.component),isUploadComponent:e=>"elupload"===R(e.component),getFormNodeByKey(e){for(let t=0;t<this.rows.length;t+=1){const i=this.rows[t];for(let t=0;t<i.length;t+=1){const n=i[t];if(n.key===e)return n;for(let t=0;t<(n.children||[]).length;t+=1){const i=n.children[t];if(i.key===e)return i}}}return null},getFormNodeRefByKey(e){return this.componentRefs[e]||null},getFormKvData(){const e={};return this.walkFields(t=>{t&&t.key&&(e[t.key]=Array.isArray(t.value)&&Array.isArray(t.delValue)?t.value.concat(t.delValue):t.value)}),e},resetForm(e=!1){this.walkFields(t=>{var i,n;if(!t||!t.key)return;const l=C(t.value),r=void 0!==t.defaultValue?C(t.defaultValue):Array.isArray(t.value)?[]:"boolean"!=typeof t.value&&("number"==typeof t.value?0:"");this.$set(t,"value",r),void 0!==t.delValue&&this.$set(t,"delValue",[]),t.params&&Array.isArray(t.params.fileList)&&t.params.fileList.splice(0,t.params.fileList.length),e&&JSON.stringify(l)!==JSON.stringify(r)&&("function"==typeof(null==(i=t.events)?void 0:i.change)&&this.$nextTick(()=>t.events.change(r)),"function"==typeof(null==(n=t.events)?void 0:n.input)&&this.$nextTick(()=>t.events.input(r)))})},setFormData(e){e&&"object"==typeof e&&this.walkFields(t=>{if(!t||!t.key||!Object.prototype.hasOwnProperty.call(e,t.key))return;let i=C(e[t.key]);if(this.isCascaderComponent(t)&&"string"==typeof i&&i.indexOf(",")>-1&&(i=i.split(",").filter(Boolean)),this.$set(t,"value",i),this.isUploadComponent(t)){const e=Array.isArray(i)?C(i):[];t.params&&this.$set(t.params,"fileList",e)}})},initDefaultValues(){this.initializeDefaultValues(this.rows)}}},function(){var e=this,t=e._self._c;return e.rows&&e.rows.length?t("div",{staticClass:"ns-dynamic-form",class:e.formClassList,style:e.wrapperStyle},e._l(e.rows,function(i,n){return t("div",{key:`row-${n}`,staticClass:"ns-dynamic-form__row",style:e.rowStyle},e._l(i,function(l,r){return t("div",{key:l.key||`${n}-${r}`,staticClass:"ns-dynamic-form__item",class:{"has-children":e.hasChildren(l)},style:e.getItemStyle(l,i)},[e.hasChildren(l)?[!l.hideLabel&&l.label?t("div",{staticClass:"ns-dynamic-form__group-label",style:e.groupLabelStyle},[e._v(" "+e._s(l.label)+" ")]):e._e(),t("div",{staticClass:"ns-dynamic-form__children"},e._l(l.children,function(i,l){return t("div",{key:i.key||`${n}-${r}-${l}`,staticClass:"ns-dynamic-form__child"},[!i.hideLabel&&i.label?t("div",{staticClass:"ns-dynamic-form__label",class:{"has-point":e.hasPoint||e.isRequiredField(i)},style:e.labelStyle},[e._v(" "+e._s(i.label)+" ")]):e._e(),t("div",{staticClass:"ns-dynamic-form__value",style:e.valueStyle},[e.showReadOnlyText(i)?[t("span",{directives:[{name:"sline",rawName:"v-sline"}]},[e._v(e._s(e.getReadOnlyDisplayValue(i)))])]:i.component?[t("el-form-item",{staticClass:"ns-dynamic-form__form-item",attrs:{"label-width":"0px",prop:`${e.formPropKey}.${n}.${r}.children.${l}.value`,rules:e.getFieldRules(i),required:e.getFieldRequired(i)}},[t("form-field-renderer",{attrs:{field:i,value:i.value},on:{input:function(t){return e.updateFieldValue(i,t)},ref:function(t){return e.setComponentRef(i,t)}}})],1)]:[t("span",{directives:[{name:"sline",rawName:"v-sline"}]},[e._v(e._s(e.normalizeDisplayValue(i.value,i)))])]],2)])}),0)]:[!l.hideLabel&&l.label?t("div",{staticClass:"ns-dynamic-form__label",class:{"has-point":e.hasPoint||e.isRequiredField(l)},style:e.labelStyle},[e._v(" "+e._s(l.label)+" ")]):e._e(),t("div",{staticClass:"ns-dynamic-form__value",style:e.valueStyle},[e.showReadOnlyText(l)?[t("span",{directives:[{name:"sline",rawName:"v-sline"}]},[e._v(e._s(e.getReadOnlyDisplayValue(l)))])]:l.component?[t("el-form-item",{staticClass:"ns-dynamic-form__form-item",attrs:{"label-width":"0px",prop:`${e.formPropKey}.${n}.${r}.value`,rules:e.getFieldRules(l),required:e.getFieldRequired(l)}},[t("form-field-renderer",{attrs:{field:l,value:l.value},on:{input:function(t){return e.updateFieldValue(l,t)},ref:function(t){return e.setComponentRef(l,t)}}})],1)]:[t("span",{directives:[{name:"sline",rawName:"v-sline"}]},[e._v(e._s(e.normalizeDisplayValue(l.value,l)))])]],2)]],2)}),0)}),0):e._e()},[],!1,null,"4efb4504",null,null).exports;class x{}x.VARS={};const _=w({name:"NsFormTitle",props:{title:{type:String,default:""}},mounted(){!function(){if("undefined"==typeof document)return x.VARS;if(Object.keys(x.VARS).length>0)return x.VARS;const e={};Array.from(document.styleSheets||[]).forEach(t=>{let i=[];try{i=Array.from(t.cssRules||[])}catch(n){i=[]}i.forEach(t=>{":root"===t.selectorText&&Array.from(t.style||[]).filter(e=>0===e.indexOf("--matrix-")).forEach(i=>{e[i]=t.style.getPropertyValue(i).trim()})})}),x.VARS=e}()}},function(){var e=this,t=e._self._c;return t("div",{staticClass:"ns-form-title"},[t("div",{staticClass:"ns-form-title__header"},[e._t("title",function(){return[t("span",{staticClass:"ns-form-title__icon"}),t("span",{staticClass:"ns-form-title__text"},[e._v(e._s(e.title))])]})],2),t("div",{staticClass:"ns-form-title__content"},[e._t("default")],2)])},[],!1,null,"29c80ec1",null,null).exports;function P(e){const i=t.getCurrentInstance();return{handleFormatFileList:function(e,t){const n=function(e){var t;return(null==(t=null==e?void 0:e.proxy)?void 0:t.$ImageBaseUrl)||""}(i),l=Array.isArray(t)?t:[];return l.forEach(e=>{e.filePath&&!e.url&&(e.url=`${n}${e.filePath}`),e.name||(e.name=e.fileName||e.name||e.filePath||"未命名文件")}),e&&e.params&&(e.params.fileList=l),e&&(e.value=l.slice()),l},handleRemoveFile:function(t,i,n,l=e.rows){const r=k(l,n);if(!r)return i;const a=(i||[]).map(e=>c(d({},e),{fileName:e.response?e.response.data.fileName:e.fileName,filePath:e.response?e.response.data.filePath:e.filePath,fileSize:e.response?e.response.data.fileSize:e.fileSize}));return Array.isArray(r.delValue)||(r.delValue=[]),t.response||"success"!==t.status||r.delValue.push(c(d({},t),{isDelete:1})),r.value=a,r.params&&(r.params.fileList=i||[]),i},handleFileSuccessFile:function(t,i,n,l,r=e.rows){const a=k(r,l);return a?(Array.isArray(a.value)||(a.value=[]),i&&"success"===i.status&&t&&t.data&&a.value.push(d({},t.data)),a.params&&(a.params.fileList=n||[]),n):n},handleCheckFileRequire:function(e,i,n,l="rows"){const r=k(e,i);r&&!Array.isArray(r.value)&&(r.value=[]);const a=function(e,t,i="rows"){for(let n=0;n<e.length;n+=1){const l=e[n];for(let e=0;e<l.length;e+=1){const r=l[e];if(r.key===t)return`${i}.${n}.${e}.value`;if(Array.isArray(r.children))for(let l=0;l<r.children.length;l+=1)if(r.children[l].key===t)return`${i}.${n}.${e}.children.${l}.value`}}return null}(e,i,l);t.nextTick(()=>{const e=n&&(n.value||n);a&&e&&"function"==typeof e.validateField&&e.validateField(a)})}}}function D(e){e.install=function(t){t.component(e.name,e)}}D($),D(_);const z=$.install;function A(e){const t={};return(e||[]).forEach(e=>{(e||[]).forEach(e=>{e&&e.key&&(t[e.key]=Array.isArray(e.value)&&Array.isArray(e.delValue)?e.value.concat(e.delValue):e.value),(e.children||[]).forEach(e=>{e&&e.key&&(t[e.key]=Array.isArray(e.value)&&Array.isArray(e.delValue)?e.value.concat(e.delValue):e.value)})})}),t}function k(e,t){for(let i=0;i<(e||[]).length;i+=1){const n=e[i]||[];for(let e=0;e<n.length;e+=1){const i=n[e];if(i&&i.key===t)return i;const l=i&&i.children||[];for(let e=0;e<l.length;e+=1)if(l[e]&&l[e].key===t)return l[e]}}return null}function E(e,t){const i=k(e,t);return i&&i.ref||null}$.install=function(e){g(e),z(e)},"undefined"!=typeof globalThis&&(globalThis.getAllFormKvData=A,globalThis.getAllFormNodeByKey=k,globalThis.getAllFormNodeRefByKey=E);const O={name:"NsSlotRenderer",functional:!0,props:{renderer:{type:Function,default:null},scope:{type:Object,default:()=>({})}},render(e,t){const i=t.props.renderer;return i?i(t.props.scope||{}):null}};const N=w({name:"NsSearch",components:{SlotRenderer:O},inheritAttrs:!1,props:{items:{type:Array,default:()=>[]},externalParams:{type:Object,default:()=>({})},defaultSpan:{type:Number,default:6},showCollapse:{type:Boolean,default:!0},collapseLimit:{type:Number,default:3},slotRenderers:{type:Object,default:()=>({})}},data:()=>({formData:{},isCollapsed:!0}),computed:{itemsPerRow(){const e=Number(this.defaultSpan||6),t=Number.isFinite(e)&&e>0?e:6;return Math.max(1,Math.floor(24/t))},visibleItems(){if(!this.showCollapse||!this.isCollapsed)return this.items;const e=this.items||[];let t=Math.min(Number(this.collapseLimit||0),e.length);return t>0&&t%this.itemsPerRow===0&&e.length>t&&(t-=1),e.slice(0,Math.max(t,1))}},watch:{items:{handler(){this.initFormData()},deep:!0,immediate:!0},externalParams:{handler(){this.formData=d(d({},this.formData),this.externalParams)},deep:!0,immediate:!0}},methods:{normalizeComponent(e){return"string"==typeof e?"string"!=typeof(t=e)?t:t.indexOf("-")>-1?t.toLowerCase():t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase():e;var t},initFormData(){const e={};(this.items||[]).forEach(t=>{e[t.prop]=void 0!==t.defaultValue?t.defaultValue:void 0}),this.formData=d(d({},e),this.externalParams)},isSlotItem:e=>e&&("slot"===e.type||!0===e.slot||"string"==typeof e.slot),getSlotRenderer(e){const t="string"==typeof e.slot?e.slot:e.slotName||e.prop;return this.slotRenderers[t]||null},isSelectComponent(e){return"el-select"===String(this.normalizeComponent(e.component||"")||"")},handleSearch(){this.$emit("search",c(d({},this.formData),{_resetPage:!0}))},handleReset(){const e={};(this.items||[]).forEach(t=>{e[t.prop]=void 0!==t.defaultValue?t.defaultValue:void 0}),this.formData=d(d({},e),this.externalParams),this.$emit("search",c(d({},this.formData),{_resetPage:!0})),this.$emit("reset")},toggleCollapse(){this.isCollapsed=!this.isCollapsed},getFormData(){return d({},this.formData)},setFormData(e){this.formData=d(d({},this.formData),e||{})},resetForm(){this.handleReset()},validate(){return this.$refs.formRef&&this.$refs.formRef.validate?this.$refs.formRef.validate():Promise.resolve(!0)},clearValidate(e){this.$refs.formRef&&this.$refs.formRef.clearValidate&&this.$refs.formRef.clearValidate(e)}}},function(){var e=this,t=e._self._c;return t("div",{staticClass:"page-search"},[t("el-form",e._b({ref:"formRef",staticClass:"page-search__form",attrs:{inline:!0,model:e.formData}},"el-form",e.$attrs,!1),[t("el-row",{staticClass:"page-search__row",attrs:{gutter:16,type:"flex"}},[e._l(e.visibleItems,function(i,n){return t("el-col",{key:i.prop||n,attrs:{span:i.span||e.defaultSpan}},[t("el-form-item",e._b({attrs:{label:i.label,prop:i.prop}},"el-form-item",i.formItemAttrs||{},!1),[e.isSlotItem(i)?t("slot-renderer",{attrs:{renderer:e.getSlotRenderer(i),scope:{formData:e.formData,item:i}}}):t(e.normalizeComponent(i.component||"el-input"),e._g(e._b({tag:"component",model:{value:e.formData[i.prop],callback:function(t){e.$set(e.formData,i.prop,t)},expression:"formData[item.prop]"}},"component",i.attrs||{},!1),i.events||{}),[e.isSelectComponent(i)?e._l(i.children||[],function(e,i){return t("el-option",{key:void 0!==e.value?e.value:i,attrs:{label:e.label,value:e.value,disabled:e.disabled}})}):e._e()],2)],1)],1)}),t("el-col",{staticClass:"page-search__actions",attrs:{span:e.defaultSpan}},[t("el-form-item",{attrs:{"label-width":"0"}},[t("el-button",{attrs:{type:"primary"},on:{click:e.handleSearch}},[e._v("查询")]),t("el-button",{on:{click:e.handleReset}},[e._v("重置")]),e.slotRenderers["actions-after-reset"]?t("slot-renderer",{attrs:{renderer:e.slotRenderers["actions-after-reset"],scope:{formData:e.formData,handleSearch:e.handleSearch,handleReset:e.handleReset,isCollapsed:e.isCollapsed}}}):e._e(),e.showCollapse&&e.items.length>e.collapseLimit?t("el-button",{attrs:{type:"text"},on:{click:e.toggleCollapse}},[t("span",[e._v(e._s(e.isCollapsed?"展开":"收起"))]),t("i",{class:e.isCollapsed?"el-icon-arrow-down":"el-icon-arrow-up"})]):e._e()],1)],1)],2)],1)],1)},[],!1,null,"cebdda8d",null,null).exports,K=["children","slot","headerSlot","buttons","enum","type","imageWidth","imageHeight","linkText"],F={name:"NsTableColumn",props:{column:{type:Object,required:!0},slotRenderers:{type:Object,default:()=>({})}},methods:{getColumnProps(e){const t=d({},e);return K.forEach(e=>delete t[e]),t},getRenderer(e){return e?this.slotRenderers[e]:null},getCellValue:(e,t)=>t.prop?e[t.prop]:void 0,isVisible:(e,t)=>"function"==typeof e.show?!1!==e.show(t):void 0===e.show||!!e.show,isDisabled:(e,t)=>"function"==typeof e.disabled?!!e.disabled(t):!!e.disabled,renderActionButtons(e,t,i){return(Array.isArray(i.buttons)?i.buttons:[]).filter(e=>this.isVisible(e,t.row)).map((n,l)=>{const r=this.getRenderer(n.slot);return r?r(c(d({},t),{row:t.row,column:i,button:n})):e("el-button",{key:n.label||l,props:{size:n.size||"mini",type:n.link?"text":n.type||"text",icon:"string"==typeof n.icon?n.icon:void 0,disabled:this.isDisabled(n,t.row)},on:{click:()=>{"function"==typeof n.handler&&n.handler(t.row,t.$index),this.$emit("button-click",t.row,i,n)}}},[n.label])})},renderTag(e,t,i){const n=this.getCellValue(t.row,i),l="function"==typeof i.tagType?i.tagType(t.row,n):i.tagType,r="function"==typeof i.formatter?i.formatter(t.row,i,n):this.resolveEnumText(i,n);return e("el-tag",{props:{type:l||"info",size:i.tagSize||"small"}},[r])},renderImage(e,t,i){const n=this.getCellValue(t.row,i);return n?e("img",{style:{width:i.imageWidth||"40px",height:i.imageHeight||"40px",objectFit:"cover",borderRadius:"4px"},attrs:{src:n,alt:i.label||"image"}}):"-"},renderLink(e,t,i){const n=this.getRenderer(i.slot);if(n)return n(t);const l=this.getCellValue(t.row,i);return e("el-button",{props:{type:"text"},on:{click:()=>this.$emit("link-click",t.row,i)}},[i.linkText||l||"-"])},resolveEnumText(e,t){const i=e.enum||e.options||[];if(!Array.isArray(i))return t;const n=i.find(e=>e.value===t);return n?n.label:t},renderDefaultCell(e,t,i){const n=this.getRenderer(i.slot);if(n)return n(t);if("action"===i.type)return e("div",{class:"ns-table-column__actions"},this.renderActionButtons(e,t,i));if("tag"===i.type)return this.renderTag(e,t,i);if("image"===i.type)return this.renderImage(e,t,i);if("link"===i.type)return this.renderLink(e,t,i);const l=this.getCellValue(t.row,i);return"function"==typeof i.formatter?i.formatter(t.row,i,l):i.enum?this.resolveEnumText(i,l):null==l||""===l?"-":l},renderColumn(e,t){const i=Array.isArray(t.children)?t.children.map((t,i)=>e(F,{key:t.prop||t.label||i,props:{column:t,slotRenderers:this.slotRenderers},on:{"link-click":(...e)=>this.$emit("link-click",...e),"button-click":(...e)=>this.$emit("button-click",...e)}})):[],n=this.getRenderer(t.headerSlot);return e("el-table-column",{props:this.getColumnProps(t),scopedSlots:i.length?n?{header:n}:void 0:d({default:i=>this.renderDefaultCell(e,i,t)},n?{header:n}:{})},i)}},render(e){return this.renderColumn(e,this.column)}},L={total:0,currentPage:1,pageSize:10},T={totalKey:"total",currentPageKey:"currentPage",pageSizeKey:"pageSize"};function B(e={}){return d(d({},L),e)}function V(e,t={}){const i=d(d({},T),t);return{[i.totalKey]:e.total,[i.currentPageKey]:e.currentPage,[i.pageSizeKey]:e.pageSize}}function M(e){return e.total=0,e.currentPage=1,e.pageSize=10,e}const j=["add","selection-change","sort-change","row-click","size-change","current-change","link-click"];const I=w({name:"NsTable",components:{SlotRenderer:O,TableColumn:F},inheritAttrs:!1,props:{tableData:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},actionButtons:{type:Array,default:()=>[]},showAddButton:{type:Boolean,default:!0},addButtonText:{type:String,default:"新增"},showHeaderToolbar:{type:Boolean,default:!0},showSelection:{type:Boolean,default:!1},showIndex:{type:Boolean,default:!1},border:{type:Boolean,default:!0},stripe:{type:Boolean,default:!1},height:{type:[String,Number],default:void 0},maxHeight:{type:[String,Number],default:void 0},autoHeight:{type:Boolean,default:!0},rowKey:{type:[String,Function],default:void 0},defaultExpandAll:{type:Boolean,default:!1},highlightCurrentRow:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},showPagination:{type:Boolean,default:!0},total:{type:Number,default:0},currentPage:{type:Number,default:null},pageSize:{type:Number,default:null},pageSizes:{type:Array,default:()=>[10,20,50,100]},paginationLayout:{type:String,default:"total, sizes, prev, pager, next, jumper"},pageNumberKey:{type:String,default:"currentPage"},pageSizeKey:{type:String,default:"pageSize"},pageTotalKey:{type:String,default:"total"},slotRenderers:{type:Object,default:()=>({})}},data:()=>({internalPagination:B()}),computed:{currentPageModel(){return null===this.currentPage?this.internalPagination.currentPage:this.currentPage},pageSizeModel(){return null===this.pageSize?this.internalPagination.pageSize:this.pageSize},mergedAttrs(){return this.$attrs||{}},mergedListeners(){const e=d({},this.$listeners||{});return j.forEach(t=>delete e[t]),e},resolvedHeight(){return void 0!==this.height?this.height:this.autoHeight&&void 0===this.maxHeight?"100%":void 0},resolvedMaxHeight(){if(void 0!==this.maxHeight)return this.maxHeight}},watch:{currentPage:{handler(e){null!==e&&(this.internalPagination.currentPage=e)},immediate:!0},pageSize:{handler(e){null!==e&&(this.internalPagination.pageSize=e)},immediate:!0}},methods:{handleAdd(){this.$emit("add")},handleSelectionChange(e){this.$emit("selection-change",e)},handleSortChange(e){this.$emit("sort-change",e)},handleRowClick(e,t,i){this.$emit("row-click",e,t,i)},handleSizeChange(e){this.internalPagination.pageSize=e,this.$emit("update:pageSize",e),this.$emit("size-change",e)},handleCurrentChange(e){this.internalPagination.currentPage=e,this.$emit("update:currentPage",e),this.$emit("current-change",e)},handleLinkClick(e,t){this.$emit("link-click",e,t)},getIndex(e){if(!this.showPagination)return e+1;return(Number(this.currentPageModel||1)-1)*Number(this.pageSizeModel||10)+e+1},getSelectionRows(){return this.$refs.tableRef&&this.$refs.tableRef.selection?this.$refs.tableRef.selection:[]},getSelectionKeys(){const e=this.getSelectionRows();return this.rowKey?e.map(e=>"function"==typeof this.rowKey?this.rowKey(e):e[this.rowKey]):e},setSelectionRows(e){this.$refs.tableRef&&(this.$refs.tableRef.clearSelection(),(e||[]).forEach(e=>{this.$refs.tableRef.toggleRowSelection(e,!0)}))},setSelectionKeys(e){this.$refs.tableRef&&this.rowKey&&(this.$refs.tableRef.clearSelection(),(e||[]).forEach(e=>{const t=(this.tableData||[]).find(t=>("function"==typeof this.rowKey?this.rowKey(t):t[this.rowKey])===e);t&&this.$refs.tableRef.toggleRowSelection(t,!0)}))},isRowSelected(e){return this.getSelectionRows().includes(e)},isKeySelected(e){return this.getSelectionKeys().includes(e)},clearSelection(){this.$refs.tableRef&&this.$refs.tableRef.clearSelection()},toggleRowSelection(e,t){this.$refs.tableRef&&this.$refs.tableRef.toggleRowSelection(e,t)},toggleAllSelection(){this.$refs.tableRef&&this.$refs.tableRef.toggleAllSelection()},selectAll(){this.toggleAllSelection()},clearAllSelection(){this.clearSelection()},clearSort(){this.$refs.tableRef&&this.$refs.tableRef.clearSort&&this.$refs.tableRef.clearSort()},clearFilter(e){this.$refs.tableRef&&this.$refs.tableRef.clearFilter&&this.$refs.tableRef.clearFilter(e)},doLayout(){this.$refs.tableRef&&this.$refs.tableRef.doLayout&&this.$refs.tableRef.doLayout()},sort(e,t){this.$refs.tableRef&&this.$refs.tableRef.sort&&this.$refs.tableRef.sort(e,t)},resetPage(){this.internalPagination.currentPage=1,this.$emit("update:currentPage",1)},setPage(e){this.internalPagination.currentPage=e,this.$emit("update:currentPage",e)},setPageSize(e){this.internalPagination.pageSize=e,this.$emit("update:pageSize",e)},getPagination(){return{[this.pageTotalKey]:this.total,[this.pageNumberKey]:this.currentPageModel,[this.pageSizeKey]:this.pageSizeModel}},setPagination(e){void 0!==e.currentPage&&this.setPage(e.currentPage),void 0!==e.pageSize&&this.setPageSize(e.pageSize)}}},function(){var e=this,t=e._self._c;return t("div",{staticClass:"page-table"},[e.showHeaderToolbar?t("div",{staticClass:"page-table__header"},[t("slot-renderer",{attrs:{renderer:e.slotRenderers["header-left"],scope:{tableData:e.tableData}}}),t("div",{staticClass:"page-table__actions"},[t("slot-renderer",{attrs:{renderer:e.slotRenderers["header-actions"],scope:{tableData:e.tableData}}}),e.showAddButton&&!e.slotRenderers["header-actions"]?t("el-button",{attrs:{type:"primary",size:"small"},on:{click:e.handleAdd}},[e._v(" "+e._s(e.addButtonText)+" ")]):e._e()],1)],1):e._e(),t("div",{staticClass:"page-table__main"},[t("el-table",e._g(e._b({directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],ref:"tableRef",class:["page-table__table",{"page-table__table--no-border":!e.border}],attrs:{data:e.tableData,border:e.border,stripe:e.stripe,height:e.resolvedHeight,"max-height":e.resolvedMaxHeight,"row-key":e.rowKey,"default-expand-all":e.defaultExpandAll,"highlight-current-row":e.highlightCurrentRow},on:{"selection-change":e.handleSelectionChange,"sort-change":e.handleSortChange,"row-click":e.handleRowClick}},"el-table",e.mergedAttrs,!1),e.mergedListeners),[e.showSelection?t("el-table-column",{attrs:{type:"selection",width:"55","reserve-selection":!!e.rowKey}}):e._e(),e.showIndex?t("el-table-column",{attrs:{type:"index",label:"序号",width:"60",index:e.getIndex}}):e._e(),e._l(e.columns,function(i,n){return t("table-column",{key:i.prop||i.label||n,attrs:{column:i,"slot-renderers":e.slotRenderers},on:{"link-click":e.handleLinkClick}})}),t("template",{slot:"empty"},[e.slotRenderers.empty?t("slot-renderer",{attrs:{renderer:e.slotRenderers.empty,scope:{tableData:e.tableData}}}):t("div",{staticClass:"page-table__empty"},[e._v("暂无数据")])],1)],2)],1),e.showPagination?t("div",{staticClass:"page-table__pagination"},[t("el-pagination",{attrs:{background:"","current-page":e.currentPageModel,"page-size":e.pageSizeModel,"page-sizes":e.pageSizes,total:e.total,layout:e.paginationLayout},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}})],1):e._e()])},[],!1,null,"d962dc48",null,null).exports;const H=w({name:"NsTableContainer",components:{PageSearch:N,PageTable:I},props:{showSearch:{type:Boolean,default:!0},externalSearchParams:{type:Object,default:()=>({})},searchItems:{type:Array,default:()=>[]},tableData:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},actionButtons:{type:Array,default:()=>[]},total:{type:Number,default:0},currentPage:{type:Number,default:null},pageSize:{type:Number,default:null},pageNumberKey:{type:String,default:"currentPage"},pageSizeKey:{type:String,default:"pageSize"},pageTotalKey:{type:String,default:"total"},searchProps:{type:Object,default:()=>({})},tableProps:{type:Object,default:()=>({})},loadData:{type:Function,default:null}},data:()=>({internalPagination:B(),pendingSelectionKeys:new Set,selectionRowMap:{},isSyncingSelection:!1}),computed:{currentPageModel(){return null===this.currentPage?this.internalPagination.currentPage:this.currentPage},pageSizeModel(){return null===this.pageSize?this.internalPagination.pageSize:this.pageSize},currentRowKey(){return this.tableProps&&this.tableProps.rowKey}},watch:{currentPage:{handler(e){null!==e&&(this.internalPagination.currentPage=e)},immediate:!0},pageSize:{handler(e){null!==e&&(this.internalPagination.pageSize=e)},immediate:!0},tableData:{handler(){this.$nextTick(()=>{this.syncSelectionToCurrentPage()})},deep:!0,immediate:!0}},methods:{getRowKey(e){return this.currentRowKey?"function"==typeof this.currentRowKey?this.currentRowKey(e):e[this.currentRowKey]:e},resetSelectionState(){this.pendingSelectionKeys=new Set,this.selectionRowMap={},this.$refs.tableRef&&this.$refs.tableRef.clearSelection&&this.$refs.tableRef.clearSelection()},syncSelectionToCurrentPage(){this.currentRowKey&&this.$refs.tableRef&&(this.isSyncingSelection=!0,this.$refs.tableRef.clearSelection(),(this.tableData||[]).forEach(e=>{const t=this.getRowKey(e);this.pendingSelectionKeys.has(t)&&(this.$set(this.selectionRowMap,t,e),this.$refs.tableRef.toggleRowSelection(e,!0))}),this.$nextTick(()=>{this.isSyncingSelection=!1}))},handleSearch(e){if(this.resetSelectionState(),e&&e._resetPage){const t=e,{_resetPage:i}=t,n=u(t,["_resetPage"]);return this.internalPagination.currentPage=1,this.$emit("update:currentPage",1),void this.$emit("search",n)}this.$emit("search",e)},handleReset(){this.resetSelectionState(),this.$emit("reset")},handleAdd(){this.$emit("add")},handleSizeChange(e){this.internalPagination.pageSize=e,this.$emit("update:pageSize",e),this.$emit("size-change",e),this.$emit("page-change",{currentPage:this.currentPageModel,pageSize:e}),this.loadData&&this.loadData()},handleCurrentChange(e){this.internalPagination.currentPage=e,this.$emit("update:currentPage",e),this.$emit("current-change",e),this.$emit("page-change",{currentPage:e,pageSize:this.pageSizeModel}),this.loadData&&this.loadData()},handleSelectionChange(e){if(this.isSyncingSelection)return;if(!this.currentRowKey)return void this.$emit("selection-change",e);(this.tableData||[]).map(e=>this.getRowKey(e)).forEach(e=>{this.pendingSelectionKeys.delete(e),this.$delete(this.selectionRowMap,e)}),(e||[]).forEach(e=>{const t=this.getRowKey(e);this.pendingSelectionKeys.add(t),this.$set(this.selectionRowMap,t,e)}),this.$emit("selection-change",Object.values(this.selectionRowMap))},handleSortChange(e){this.$emit("sort-change",e)},handleRowClick(e,t,i){this.$emit("row-click",e,t,i)},handleLinkClick(e,t){this.$emit("link-click",e,t)},initSearchAndLoad(){this.$nextTick(()=>{this.showSearch&&this.$refs.searchRef?this.$emit("search",this.$refs.searchRef.getFormData()):this.loadData&&this.loadData()})},getSearchFormData(){return this.$refs.searchRef?this.$refs.searchRef.getFormData():{}},setSearchFormData(e){this.$refs.searchRef&&this.$refs.searchRef.setFormData(e)},resetSearchForm(){this.$refs.searchRef&&this.$refs.searchRef.resetForm()},validateSearchForm(){return this.$refs.searchRef?this.$refs.searchRef.validate():Promise.resolve(!0)},getPagination(){return{[this.pageTotalKey]:this.total,[this.pageNumberKey]:this.currentPageModel,[this.pageSizeKey]:this.pageSizeModel}},getSelectionRows(){var e,t;return this.currentRowKey?Object.values(this.selectionRowMap):(null==(t=null==(e=this.$refs.tableRef)?void 0:e.getSelectionRows)?void 0:t.call(e))||[]},getSelectionKeys(){var e,t;return this.currentRowKey?Array.from(this.pendingSelectionKeys):(null==(t=null==(e=this.$refs.tableRef)?void 0:e.getSelectionKeys)?void 0:t.call(e))||[]},setSelectionRows(e){this.currentRowKey?(this.pendingSelectionKeys=new Set,this.selectionRowMap={},(e||[]).forEach(e=>{const t=this.getRowKey(e);this.pendingSelectionKeys.add(t),this.$set(this.selectionRowMap,t,e)}),this.syncSelectionToCurrentPage()):this.$refs.tableRef&&this.$refs.tableRef.setSelectionRows(e)},setSelectionKeys(e){this.currentRowKey?(this.pendingSelectionKeys=new Set(e||[]),(this.tableData||[]).forEach(e=>{const t=this.getRowKey(e);this.pendingSelectionKeys.has(t)&&this.$set(this.selectionRowMap,t,e)}),this.syncSelectionToCurrentPage()):this.$refs.tableRef&&this.$refs.tableRef.setSelectionKeys(e)},clearAllSelection(){this.resetSelectionState()},selectAll(){this.$refs.tableRef&&(this.currentRowKey?((this.tableData||[]).forEach(e=>{const t=this.getRowKey(e);this.pendingSelectionKeys.add(t),this.$set(this.selectionRowMap,t,e)}),this.$refs.tableRef.setSelectionRows(this.tableData)):this.$refs.tableRef.selectAll())},isRowSelected(e){var t,i;return this.currentRowKey?this.pendingSelectionKeys.has(this.getRowKey(e)):null==(i=null==(t=this.$refs.tableRef)?void 0:t.isRowSelected)?void 0:i.call(t,e)},isKeySelected(e){var t,i;return this.currentRowKey?this.pendingSelectionKeys.has(e):null==(i=null==(t=this.$refs.tableRef)?void 0:t.isKeySelected)?void 0:i.call(t,e)}}},function(){var e=this,t=e._self._c;return t("div",{staticClass:"page-container"},[e.showSearch?t("page-search",e._b({ref:"searchRef",attrs:{items:e.searchItems,"external-params":e.externalSearchParams,"slot-renderers":e.$scopedSlots},on:{search:e.handleSearch,reset:e.handleReset}},"page-search",e.searchProps,!1)):e._e(),t("page-table",e._b({ref:"tableRef",attrs:{"table-data":e.tableData,columns:e.columns,"action-buttons":e.actionButtons,total:e.total,"current-page":e.currentPageModel,"page-size":e.pageSizeModel,"page-number-key":e.pageNumberKey,"page-size-key":e.pageSizeKey,"page-total-key":e.pageTotalKey,"slot-renderers":e.$scopedSlots},on:{add:e.handleAdd,"selection-change":e.handleSelectionChange,"sort-change":e.handleSortChange,"row-click":e.handleRowClick,"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange,"link-click":e.handleLinkClick}},"page-table",e.tableProps,!1))],1)},[],!1,null,"df3951e4",null,null).exports;[H,N,I].forEach(e=>{e.install=function(t){t.component(e.name,e)}});var W=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{visible:e.visible,width:e.normalizedWidth,modal:e.modal,"modal-class":e.modalClassName,"show-close":!1,"append-to-body":!1,"close-on-click-modal":e.closeOnClickModal,"custom-class":e.dialogCustomClass},on:{"update:visible":function(t){e.visible=t},close:e.dealClose,closed:e.dealClosed}},[t("div",{staticClass:"ns-dialog-plus__header",attrs:{slot:"title"},on:{mousedown:e.handleDragStart},slot:"title"},[t("div",{staticClass:"ns-dialog-plus__title"},[e.resolvedHeaderDom?t(e.resolvedHeaderDom,e._g(e._b({tag:"component"},"component",e.headerOption,!1),e.mergeEvents(e.headerEvents))):[e._v(e._s(e.currentTitle))]],2),t("div",{staticClass:"dialog-controls"},[e.showMaximizeButton?t("span",{staticClass:"dialog-icon dialog-maximize",attrs:{title:"最大化/还原"},on:{click:function(t){return t.stopPropagation(),e.toggleMaximize.apply(null,arguments)}}},[e.isMaximized?t("i",{staticClass:"el-icon-zoom-out"}):t("i",{staticClass:"el-icon-full-screen"})]):e._e(),t("span",{staticClass:"dialog-icon dialog-close",attrs:{title:"关闭"},on:{click:function(t){return t.stopPropagation(),e.closeDialog.apply(null,arguments)}}},[t("i",{staticClass:"el-icon-close"})])])]),t("div",{staticClass:"ns-dialog-plus__body",style:e.bodyStyle},[t(e.resolvedDom,e._g(e._b({ref:"contentRef",tag:"component"},"component",e.currentOption,!1),e.mergeEvents(e.events)))],1),e.showFooter?t("div",{staticClass:"ns-dialog-plus__footer",attrs:{slot:"footer"},slot:"footer"},[e.resolvedFooterDom?t(e.resolvedFooterDom,e._g(e._b({tag:"component"},"component",e.footerOption,!1),e.mergeEvents(e.footerEvents))):[e.footerButtonReverse&&!e.footerCloseOnly?t("el-button",{attrs:{type:"primary",loading:e.footerLoading},on:{click:e.dealConfirm}},[e._v(e._s(e.footerButtonText.confirm))]):e._e(),t("el-button",{on:{click:e.closeDialog}},[e._v(e._s(e.footerButtonText.close))]),e.footerButtonReverse||e.footerCloseOnly?e._e():t("el-button",{attrs:{type:"primary",loading:e.footerLoading},on:{click:e.dealConfirm}},[e._v(e._s(e.footerButtonText.confirm))])]],2):e._e()])};const q=w({name:"NsDialogComponent",props:{className:{type:String,default:""},title:{type:String,default:""},width:{type:[Number,String],default:500},height:{type:[Number,String],default:""},modal:{type:Boolean,default:!0},dialogPadding:{type:[Number,String,Array],default:-1},modalColor:{type:String,default:"rgba(0, 0, 0, 0.45)"},closeOnClickModal:{type:Boolean,default:!0},dom:{type:[Object,Function],default:null},option:{type:Object,default:()=>({})},events:{type:Object,default:()=>({})},domCompleted:{type:Function,default:null},headerDom:{type:[Object,Function],default:null},headerOption:{type:Object,default:()=>({})},headerEvents:{type:Object,default:()=>({})},showFooter:{type:Boolean,default:!0},footerDom:{type:[Object,Function],default:null},footerOption:{type:Object,default:()=>({})},footerTitle:{type:Object,default:()=>({close:"取消",confirm:"确定"})},footerEvents:{type:Object,default:()=>({})},footerButtonReverse:{type:Boolean,default:!1},footerCloseOnly:{type:Boolean,default:!1},immediately:{type:Boolean,default:!1},close:{type:Function,default:null},closed:{type:Function,default:null},draggable:{type:Boolean,default:!1},confirm:{type:Function,default:null},x:{type:[Number,String],default:null},y:{type:[Number,String],default:null},maxSize:{type:Function,default:null},dialogInstance:{type:Object,default:null},containerId:{type:String,default:""}},data(){return{visible:!1,currentTitle:this.title,currentOption:d({},this.option),currentWidth:this.width,currentHeight:this.height,currentX:this.x,currentY:this.y,footerLoading:!1,isMaximized:!1,originalSize:{width:this.width,height:this.height,x:this.x,y:this.y},dragContext:null,domCompletedCalled:!1}},computed:{normalizedWidth(){return this.normalizeSize(this.currentWidth||this.width||500)},bodyStyle(){const e=this.resolvePadding();return this.currentHeight?{padding:e,height:"100%",minHeight:0,overflow:"auto",flex:"1 1 auto"}:{padding:e,minHeight:"auto",maxHeight:"none",overflow:"auto"}},dialogCustomClass(){return["ns-dialog-plus",this.className,this.hasAbsolutePosition?"ns-dialog-plus--absolute":""].filter(Boolean).join(" ")},modalClassName(){return`ns-dialog-plus-modal ns-dialog-plus-modal--${this.containerId}`},resolvedDom(){return this.resolveComponent(this.dom)},resolvedHeaderDom(){return this.resolveComponent(this.headerDom)},resolvedFooterDom(){return this.resolveComponent(this.footerDom)},footerButtonText(){var e,t;return{close:(null==(e=this.footerTitle)?void 0:e.close)||"取消",confirm:(null==(t=this.footerTitle)?void 0:t.confirm)||"确定"}},showMaximizeButton(){return"function"==typeof this.maxSize},hasAbsolutePosition(){return null!==this.currentX||null!==this.currentY}},watch:{option:{handler(e){this.currentOption=d({},e)},deep:!0},title(e){this.currentTitle=e},width(e){this.isMaximized||(this.currentWidth=e)},height(e){this.isMaximized||(this.currentHeight=e)},x(e){this.isMaximized||(this.currentX=e)},y(e){this.isMaximized||(this.currentY=e)},visible(){this.$nextTick(()=>{this.applyDialogLayout(),this.syncDialogInstance(),this.triggerDomCompleted()})}},mounted(){v(),this.visible=!0,this.updateModalStyle(),this.syncDialogInstance(),this.$nextTick(()=>{this.applyDialogLayout(),this.triggerDomCompleted()}),document.addEventListener("keydown",this.handleKeydown),window.addEventListener("resize",this.applyDialogLayout)},updated(){this.syncDialogInstance(),this.triggerDomCompleted(),this.$nextTick(()=>{this.applyDialogLayout()})},beforeDestroy(){document.removeEventListener("keydown",this.handleKeydown),window.removeEventListener("resize",this.applyDialogLayout),this.removeDragListeners(),this.removeModalStyle()},methods:{normalizeSize(e){if(null==e||""===e)return"";if("number"==typeof e&&isFinite(e))return`${e}px`;const t=String(e).trim();return""===t?"":Number.isNaN(Number(t))?t:`${Number(t)}px`},resolvePadding(){return Array.isArray(this.dialogPadding)?this.dialogPadding.map(e=>this.normalizeSize(e)).join(" "):-1===this.dialogPadding||"-1"===this.dialogPadding?"16px 20px":this.normalizeSize(this.dialogPadding)},resolveComponent:e=>e?e.default?e.default:"function"==typeof e.then?()=>e:e:null,mergeEvents(e={}){return c(d({},e),{close:()=>this.closeDialog()})},resolveDialogElement(){return this.$el&&this.$el.querySelector?this.$el.querySelector(".el-dialog"):null},resolveWrapperElement(){return this.$el&&this.$el.querySelector?this.$el.querySelector(".el-dialog__wrapper"):null},applyDialogLayout(){const e=this.resolveDialogElement();if(!e)return;const t=this.resolveWrapperElement();t&&(t.style.display="",t.style.alignItems="",t.style.justifyContent=""),this.currentHeight?(e.style.height=this.normalizeSize(this.currentHeight),e.style.display="flex",e.style.flexDirection="column"):e.style.height="";const i=e.getBoundingClientRect().height,n=i>=window.innerHeight?20:Math.max((window.innerHeight-i)/2,0);this.hasAbsolutePosition?(e.style.position="fixed",e.style.margin="0",null!==this.currentX?e.style.left=this.normalizeSize(this.currentX):e.style.left="",null!==this.currentY?e.style.top=this.normalizeSize(this.currentY):e.style.top=`${n}px`):(e.style.position="relative",e.style.left="",e.style.top=`${n}px`,e.style.margin="0 auto")},updateModalStyle(){if(!this.containerId)return;let e=document.getElementById(`style-${this.containerId}`);e||(e=document.createElement("style"),e.id=`style-${this.containerId}`,document.head.appendChild(e)),e.textContent=`.${this.modalClassName.replace(/ /g,".")} { background-color: ${this.modalColor} !important; }`},removeModalStyle(){if(!this.containerId)return;const e=document.getElementById(`style-${this.containerId}`);e&&e.parentNode&&e.parentNode.removeChild(e)},syncDialogInstance(){this.dialogInstance&&(this.dialogInstance.domRef=this.$refs.contentRef||null,this.dialogInstance.updateOption=(e={})=>{Object.prototype.hasOwnProperty.call(e,"title")&&(this.currentTitle=e.title),Object.prototype.hasOwnProperty.call(e,"width")&&(this.currentWidth=e.width),Object.prototype.hasOwnProperty.call(e,"height")&&(this.currentHeight=e.height),Object.prototype.hasOwnProperty.call(e,"x")&&(this.currentX=e.x),Object.prototype.hasOwnProperty.call(e,"y")&&(this.currentY=e.y);const t=d({},e);delete t.title,delete t.width,delete t.height,delete t.x,delete t.y,this.currentOption=d(d({},this.currentOption),t)},this.dialogInstance.callMethod=(e,...t)=>{const i=this.$refs.contentRef;if(i&&"function"==typeof i[e])return i[e](...t)},this.dialogInstance.close=()=>this.closeDialog())},triggerDomCompleted(){this.domCompletedCalled||this.$refs.contentRef&&(this.domCompletedCalled=!0,"function"==typeof this.domCompleted&&this.domCompleted(this.$refs.contentRef))},toggleMaximize(){if(this.showMaximizeButton){if(this.isMaximized)this.currentWidth=this.originalSize.width,this.currentHeight=this.originalSize.height,this.currentX=this.originalSize.x,this.currentY=this.originalSize.y,this.isMaximized=!1;else{this.originalSize={width:this.currentWidth,height:this.currentHeight,x:this.currentX,y:this.currentY};const e=this.maxSize&&this.maxSize()||{};this.currentWidth=e.width||"100vw",this.currentHeight=e.height||"100vh",this.currentX=void 0!==e.x?e.x:0,this.currentY=void 0!==e.y?e.y:0,this.isMaximized=!0}this.$nextTick(()=>this.applyDialogLayout())}},closeDialog(){this.visible=!1},dealClose(){"function"==typeof this.close&&this.close()},dealClosed(){"function"==typeof this.closed&&this.closed()},dealConfirm(){if(this.footerLoading=!0,this.confirm)return this.immediately?(this.footerLoading=!1,this.visible=!1,void this.confirm(null,this.$refs.contentRef)):void this.confirm(()=>{this.footerLoading=!1,this.visible=!1,this.$message&&this.$message.success&&this.$message.success("操作成功")},this.$refs.contentRef,{value:this.footerLoading,set value(e){this.footerLoading=e}});this.footerLoading=!1},handleKeydown(e){this.visible&&this.showFooter&&("Enter"!==e.key||this.footerDom||this.footerCloseOnly||(e.preventDefault(),this.dealConfirm()))},handleDragStart(e){if(!this.draggable||0!==e.button)return;const t=this.resolveDialogElement();if(!t)return;const i=t.getBoundingClientRect();this.currentX=i.left,this.currentY=i.top,this.dragContext={startX:e.clientX,startY:e.clientY,originX:i.left,originY:i.top},document.addEventListener("mousemove",this.handleDragMove),document.addEventListener("mouseup",this.handleDragEnd)},handleDragMove(e){if(!this.dragContext)return;const t=e.clientX-this.dragContext.startX,i=e.clientY-this.dragContext.startY;this.currentX=this.dragContext.originX+t,this.currentY=this.dragContext.originY+i,this.applyDialogLayout()},handleDragEnd(){this.removeDragListeners()},removeDragListeners(){document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd),this.dragContext=null}}},W,[],!1,null,"47430166",null,null).exports,X="undefined"!=typeof window?window.__dialogInstances=window.__dialogInstances||[]:[];let Y=t,U=null,J=null,Z=0;function G(e,t=[]){return e||(t.find(Boolean)||null)}function Q(e,t={}){return G(t.store,[e&&e.$store,e&&e.$options&&e.$options.store,e&&e.store,U])}function ee(e,t={}){return G(t.pinia,[e&&e.$pinia,e&&e.$options&&e.$options.pinia,e&&e.pinia,J])}function te(e,t={}){if(!e)return;const i=function(e){return e?e.extend?e:e.constructor&&e.constructor.extend?e.constructor:null:null}(e);i&&(Y=i),U=Q(e,t),J=ee(e,t)}function ie(e){if(!e||e.destroyed)return;e.destroyed=!0;const t=e.vm;t&&!t._isDestroyed&&t.$destroy();const i=e.rootEl||t&&t.$el;i&&e.element&&i.parentNode===e.element&&e.element.removeChild(i),e.element&&e.element.parentNode&&e.element.parentNode.removeChild(e.element),e.vm=null,e.domRef=null,e.rootEl=null,e.updateOption=()=>{},e.callMethod=()=>{},e.close=()=>{},function(e){const t=X.findIndex(t=>t.id===e.id);t>-1&&X.splice(t,1)}(e)}function ne(){X.slice().forEach(e=>{e&&"function"==typeof e.close&&e.close()})}function le(e,i=!0,n="#app"){if(!e||!e.dom)return!1;const l=(r=n,"undefined"==typeof document?null:document.querySelector(r)||document.body);var r;if(!l)return!1;const a=this&&this._isVue?this:null,s=e,{store:o,pinia:h}=s,p=u(s,["store","pinia"]),f=Q(a,{store:o}),m=ee(a,{pinia:h}),g=p.id||`ns-dialog-${Date.now()}-${Z++}`,y=document.createElement("div");y.id=g,l.appendChild(y);const v={id:g,class:p.class||"",element:y,vm:null,rootEl:null,destroyed:!1,domRef:null,updateOption:()=>{},callMethod:()=>{},close:()=>{}},b=(Y||t).extend(q),S={propsData:c(d({},p),{className:p.class||"",modal:i,footerButtonReverse:!0,containerId:g,dialogInstance:v,close:()=>{"function"==typeof p.close&&p.close()},closed:()=>{try{"function"==typeof p.closed&&p.closed()}finally{ie(v)}}})};f&&(S.store=f),m&&(S.pinia=m);const w=new b(S);return v.vm=w,v.close=()=>{v.destroyed||w&&"function"==typeof w.closeDialog&&w.closeDialog()},X.push(v),w.$mount(),w.$el&&(v.rootEl=w.$el,y.appendChild(w.$el)),v}const re=[$,_,H,N,I];function ae(e,t={}){ae.installed||(ae.installed=!0,g(e),re.forEach(t=>{t&&t.name&&e.component(t.name,t)}),te(e,t),v(),e&&e.prototype&&(e.prototype.$NsDialog=le,e.prototype.$closeAllNsDialog=ne),"undefined"!=typeof window&&(window.NsDialog=le,window.closeAllNsDialog=ne))}const se={install:ae,NsForm:$,NsFormTitle:_,NsTableContainer:H,NsSearch:N,NsTable:I,NsDialog:le,closeAllNsDialog:ne,setExternalApp:te,useFileUpload:P,getAllFormNodeByKey:k,getAllFormKvData:A,getAllFormNodeRefByKey:E,createPagination:B,createPaginationWithCustomKeys:V,resetPagination:M};e.NsDialog=le,e.NsForm=$,e.NsFormTitle=_,e.NsSearch=N,e.NsTable=I,e.NsTableContainer=H,e.closeAllNsDialog=ne,e.createPagination=B,e.createPaginationWithCustomKeys=V,e.default=se,e.getAllFormKvData=A,e.getAllFormNodeByKey=k,e.getAllFormNodeRefByKey=E,e.install=ae,e.resetPagination=M,e.setExternalApp=te,e.useFileUpload=P,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vue")):"function"==typeof define&&define.amd?define(["exports","vue"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Vue2ComponentsPlus={},e.Vue)}(this,function(e,t){"use strict";var i=Object.defineProperty,n=Object.defineProperties,l=Object.getOwnPropertyDescriptors,r=Object.getOwnPropertySymbols,a=Object.prototype.hasOwnProperty,s=Object.prototype.propertyIsEnumerable,o=(e,t,n)=>t in e?i(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t)=>{for(var i in t||(t={}))a.call(t,i)&&o(e,i,t[i]);if(r)for(var i of r(t))s.call(t,i)&&o(e,i,t[i]);return e},c=(e,t)=>n(e,l(t)),u=(e,t)=>{var i={};for(var n in e)a.call(e,n)&&t.indexOf(n)<0&&(i[n]=e[n]);if(null!=e&&r)for(var n of r(e))t.indexOf(n)<0&&s.call(e,n)&&(i[n]=e[n]);return i};function h(e,t,i=!0){let n="",l=!1,r=!1;return String(e||"").split("").forEach((e,t)=>{if("-"!==e)if("."!==e){if(/^\d$/.test(e)){"0"!==(l?n.slice(1):n)||"0"===e||r||(n=l?"-":""),n+=e}}else 0===t||r||"-"===n[n.length-1]||(n+=e,r=!0);else i&&0===t&&!l&&(n+=e,l=!0)}),n.slice(0,t)}function p(e,t){if(t.int){const i=function(e,t,i){let n="",l=!1;const r=null!==i.min&&i.min<0;return String(e||"").split("").forEach((e,t)=>{"-"!==e?/^\d$/.test(e)&&("0"===(l?n.slice(1):n)&&"0"!==e&&(n=l?"-":""),n+=e):r&&0===t&&!l&&(n+=e,l=!0)}),n.slice(0,t)}(e,t.maxLength||50,t);if(""===i||"-"===i)return i;const n=parseInt(i,10);return Number.isNaN(n)?"":null!==t.min&&n<t.min?String(Math.ceil(t.min)):null!==t.max&&n>t.max?String(Math.floor(t.max)):i}const i=null!==t.min&&t.min<0,n=h(e,t.maxLength||50,i);if(""===n||"-"===n||"."===n)return n;const l=parseFloat(n);return Number.isNaN(l)?"":null!==t.min&&l<t.min?String(t.min):null!==t.max&&l>t.max?String(t.max):n}function f(e){return e?"INPUT"===e.tagName||"TEXTAREA"===e.tagName?e:e.querySelector("input, textarea"):null}function m(e,t){if(!e)return;const i=function(e){const t={maxLength:50,pattern:null,min:null,max:null,int:!1},i=e.value;return"number"==typeof i?c(d({},t),{maxLength:i}):i&&"object"==typeof i?{maxLength:i.maxLength||t.maxLength,pattern:i.pattern||null,min:"number"==typeof i.min?i.min:null,max:"number"==typeof i.max?i.max:null,int:!!i.int}:t}(t);let n=e.value||"";n=t.modifiers.range?p(n,i):t.modifiers.number?h(n,i.maxLength):t.modifiers.regex&&i.pattern?function(e,t,i){let n="";return String(e||"").split("").forEach(e=>{if(n.length>=t)return;const l=n+e;i.test(l)&&(n=l)}),n}(n,i.maxLength,i.pattern):String(n).slice(0,i.maxLength),n!==e.value&&(e.value=n,e.dispatchEvent(new Event("input",{bubbles:!0})))}function g(e){e.directive("sline",{inserted(e){e.style.whiteSpace="nowrap",e.style.overflow="hidden",e.style.textOverflow="ellipsis",e.style.display="inline-block",e.style.maxWidth="100%"}}),e.directive("permission",{inserted(e,t){let i=[];try{i=JSON.parse(sessionStorage.getItem("btnsPermission")||localStorage.getItem("btnsPermission")||"[]")}catch(r){i=[]}Array.isArray(i)||(i=[]);const n=t.modifiers.class?"class":"id",l=!!t.modifiers.display;("class"===n?i.some(t=>e.classList.contains(t)):i.includes(e.getAttribute("id")))||(l?e.style.display="none":(e.style.visibility="hidden",e.style.pointerEvents="none"))}}),e.directive("length",{inserted(e,t){!function(e,t){const i=f(e);if(!i)return;let n=!1;const l=()=>{n=!0},r=()=>{n=!1,m(i,t)},a=()=>{n||m(i,t)};i.addEventListener("compositionstart",l),i.addEventListener("compositionend",r),i.addEventListener("input",a),m(i,t),e.__nsLengthHandlers={inputEl:i,handleCompositionStart:l,handleCompositionEnd:r,handleInput:a}}(e,t)},componentUpdated(e,t){m(f(e),t)},unbind(e){!function(e){const t=e.__nsLengthHandlers;t&&(t.inputEl.removeEventListener("compositionstart",t.handleCompositionStart),t.inputEl.removeEventListener("compositionend",t.handleCompositionEnd),t.inputEl.removeEventListener("input",t.handleInput),delete e.__nsLengthHandlers)}(e)}}),e.directive("event-unuse",{inserted(e){e.style.pointerEvents="none"}}),e.directive("event-use",{inserted(e){e.style.pointerEvents="auto"}})}let y=class{};function v(){if("undefined"==typeof document)return y.VARS;if(Object.keys(y.VARS).length>0)return y.VARS;const e={};return Array.from(document.styleSheets||[]).forEach(t=>{let i=[];try{i=Array.from(t.cssRules||[])}catch(n){i=[]}i.forEach(t=>{":root"===t.selectorText&&Array.from(t.style||[]).filter(e=>0===e.indexOf("--matrix-")).forEach(i=>{e[i]=t.style.getPropertyValue(i).trim()})})}),y.VARS=e,e}function b(e,t){const i=String("string"==typeof e?e:e&&e.name?e.name:"").replace(/-/g,"").toLowerCase();return t.some(e=>i===e.toLowerCase())}y.VARS={};function S(e){return!!Array.isArray(e)||(0===e||"0"===e||!(""===e||null==e||"null"===e||"undefined"===e||""===String(e).trim()||"undefined"===String(e).trim()))}function w(e,t,i,n,l,r,a,s){var o,d="function"==typeof e?e.options:e;if(t&&(d.render=t,d.staticRenderFns=i,d._compiled=!0),n&&(d.functional=!0),r&&(d._scopeId="data-v-"+r),a?(o=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),l&&l.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},d._ssrRegister=o):l&&(o=s?function(){l.call(this,(d.functional?this.parent:this).$root.$options.shadowRoot)}:l),o)if(d.functional){d._injectStyles=o;var c=d.render;d.render=function(e,t){return o.call(t),c(e,t)}}else{var u=d.beforeCreate;d.beforeCreate=u?[].concat(u,o):[o]}return{exports:e,options:d}}function C(e){if(null===e||"object"!=typeof e)return e;if(Array.isArray(e))return e.map(e=>C(e));const t={};return Object.keys(e).forEach(i=>{t[i]=C(e[i])}),t}function R(e){return String("string"==typeof e?e:e&&e.name?e.name:"").replace(/-/g,"").toLowerCase()}const $=w({name:"NsForm",components:{FormFieldRenderer:{name:"NsFormFieldRenderer",inheritAttrs:!1,props:{field:{type:Object,required:!0},value:{default:void 0}},mounted(){this.emitRef()},updated(){this.emitRef()},methods:{emitRef(){this.$emit("ref",this.$refs.control||null)},getComponent(){return(e=this.field.component)?"string"==typeof e?"string"!=typeof(t=e)?t:t.indexOf("-")>-1?t.toLowerCase():t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase():e:"span";var e,t},isUpload(){return b(this.field.component,["elupload"])},rendersOptionsByChildren(){return b(this.field.component,["elselect","elradiogroup","elcheckboxgroup"])},isFullWidthComponent(){return b(this.field.component,["elinput","elselect","elcascader","eldatepicker","eltimepicker","elinputnumber","elautocomplete"])},buildProps(){const e=this.field.params||{},t={};return Object.keys(e).forEach(i=>{0!==i.indexOf("v-")&&"rules"!==i&&"style"!==i&&("options"===i&&this.rendersOptionsByChildren()||(t[i]=e[i]))}),this.isUpload()||(t.value=this.value),t},buildStyle(){const e=this.field.params||{},t=d(d({},this.field.style||{}),e.style||{});return this.isFullWidthComponent()&&void 0===t.width&&(t.width="100%"),t},buildDirectives(){const e=this.field.params||{};return Object.keys(e).filter(e=>0===e.indexOf("v-")).map(t=>{const[,i]=t.split("v-"),[n,...l]=i.split("."),r={};return l.forEach(e=>{r[e]=!0}),{name:n,value:e[t],modifiers:r}})},buildEvents(){const e=this.field.events||{},t={};if(Object.keys(e).forEach(i=>{t[i]=(...t)=>{e[i](...t)}}),!this.isUpload()){const e=t.input;t.input=(t,...i)=>{this.$emit("input",t),e&&e(t,...i)}}return t},buildScopedSlots(){const e=this.field.slots||{},t={};return Object.keys(e).forEach(i=>{"function"==typeof e[i]&&(t[i]=t=>e[i](t))}),t},renderOptionNodes(e){const t=(this.field.params||{}).options||[],i=this.getComponent();return Array.isArray(t)&&0!==t.length?b(i,["elselect"])?t.map((t,i)=>e("el-option",{key:void 0!==t.value?t.value:i,props:{label:t.label,value:t.value,disabled:t.disabled}})):b(i,["elradiogroup"])?t.map((t,i)=>e("el-radio",{key:void 0!==t.value?t.value:i,props:{label:t.value,disabled:t.disabled}},[t.label])):b(i,["elcheckboxgroup"])?t.map((t,i)=>e("el-checkbox",{key:void 0!==t.value?t.value:i,props:{label:t.value,disabled:t.disabled}},[t.label])):[]:[]}},render(e){const t=this.getComponent(),i=[],n=this.field.slots||{};return Object.keys(n).forEach(e=>{var t,l;"function"==typeof n[e]&&i.push(...(t=n[e]({field:this.field,value:this.value}),l=e,t?(Array.isArray(t)?t:[t]).map(e=>function(e,t){return e&&"default"!==t?((e.data||(e.data={})).slot=t,e):e}(e,l)).filter(Boolean):[]))}),e(t,{ref:"control",props:this.buildProps(),style:this.buildStyle(),on:this.buildEvents(),directives:this.buildDirectives(),scopedSlots:this.buildScopedSlots()},[...this.renderOptionNodes(e),...i])}}},props:{model:{type:String,default:""},readOnly:{type:Boolean,default:!1},labelWidth:{type:String,default:"80px"},superLabelWidth:{type:String,default:"30px"},labelColor:{type:String,default:"#0A7BFF"},gapH:{type:String,default:"10px"},gapV:{type:String,default:"10px"},height:{type:String,default:"32px"},rows:{type:Array,default:()=>[]},backgroundColor:{type:String,default:""},valueEmptyTag:{type:String,default:"--"},formPropKey:{type:String,default:"rows"},hasPoint:{type:Boolean,default:!1},labelPosition:{type:String,default:"left"}},data:()=>({componentRefs:{}}),computed:{formClassList(){const e=this.normalizedLabelPosition;return{"is-vertical":this.model.indexOf("vertical")>-1,"is-table":this.model.indexOf("table")>-1,"is-readonly":this.readOnly,"is-label-left":"left"===e,"is-label-right":"right"===e,"is-label-top":"top"===e}},normalizedLabelPosition(){return["left","right","top"].includes(this.labelPosition)?this.labelPosition:"left"},wrapperStyle(){return{"--ns-form-label-width":this.normalizeSize(this.labelWidth),"--ns-form-super-label-width":this.normalizeSize(this.superLabelWidth),"--ns-form-label-color":this.labelColor,"--ns-form-row-gap":this.gapV,"--ns-form-col-gap":this.gapH,"--ns-form-item-height":this.normalizeSize(this.height),"--ns-form-background-color":this.backgroundColor||"#ffffff"}},rowStyle(){return{marginBottom:this.model.indexOf("table")>-1?"0":this.gapV}},labelStyle(){return{width:this.normalizeSize(this.labelWidth),color:this.labelColor,textAlign:"right"===this.normalizedLabelPosition?"right":"left"}},groupLabelStyle(){return{width:this.normalizeSize(this.superLabelWidth),color:this.labelColor,textAlign:"right"===this.normalizedLabelPosition?"right":"left"}},valueStyle(){return{minHeight:this.normalizeSize(this.height)}}},watch:{rows:{handler(e){this.initializeDefaultValues(e)},deep:!0,immediate:!0}},methods:{walkFields(e){(this.rows||[]).forEach((t,i)=>{(t||[]).forEach((t,n)=>{e(t,i,n,null,null),(t.children||[]).forEach((l,r)=>{e(l,i,n,r,t)})})})},initializeDefaultValues(e){(e||[]).forEach(e=>{(e||[]).forEach(e=>{e&&e.key&&void 0===e.defaultValue&&this.$set(e,"defaultValue",C(e.value)),(e.children||[]).forEach(e=>{e&&e.key&&void 0===e.defaultValue&&this.$set(e,"defaultValue",C(e.value))})})})},normalizeSize:e=>null==e||""===e?"":/^\d+$/.test(String(e))?`${e}px`:String(e),hasChildren:e=>Array.isArray(e.children)&&e.children.length>0,getItemStyle(e,t){if(0===e.span)return{display:"none"};if("string"==typeof e.span&&e.span.indexOf("%")>-1)return{flex:`0 0 ${e.span}`,maxWidth:e.span};if(void 0!==e.span&&null!==e.span&&""!==e.span){const t=Number(e.span);if(!Number.isNaN(t)){const e=t>24?`${t}px`:t/24*100+"%";return{flex:`0 0 ${e}`,maxWidth:e}}}const i=`calc(${100/((t||[]).filter(e=>e&&0!==e.span).length||1)}% - ${this.gapH})`;return{flex:`0 0 ${i}`,maxWidth:i}},getFieldRules(e){return this.readOnly?[]:e.params&&e.params.rules||[]},isRequiredField(e){return!(!e||this.readOnly)&&("boolean"==typeof e.required?e.required:this.getFieldRules(e).some(e=>e&&e.required))},getFieldRequired(e){return!(!e||this.readOnly)&&(e&&"boolean"==typeof e.required?e.required:void 0)},updateFieldValue(e,t){this.$set(e,"value",t)},setComponentRef(e,t){e&&e.key&&(this.$set(e,"ref",t),this.$set(this.componentRefs,e.key,t))},showReadOnlyText(e){return this.readOnly&&!(e&&e.readOnlyUseComponent)},normalizeDisplayValue(e,t){return S(e)?Array.isArray(e)?e.join(","):e:t&&t.valueEmptyTag||this.valueEmptyTag},getReadOnlyDisplayValue(e){var t,i,n;return e?"function"==typeof(null==(t=e.params)?void 0:t.formatter)?e.params.formatter(e.value,e)||this.valueEmptyTag:S(e.value)?this.isUploadComponent(e)?(e.value||[]).map(e=>e.fileName||e.name||e.filePath).filter(Boolean).join(",")||e.valueEmptyTag||this.valueEmptyTag:this.isSwitchComponent(e)?e.value?(null==(i=e.params)?void 0:i.activeText)||"是":(null==(n=e.params)?void 0:n.inactiveText)||"否":this.isSelectLikeComponent(e)?this.getOptionDisplayText(e):this.isCascaderComponent(e)?this.getCascaderDisplayValue(e):Array.isArray(e.value)?e.value.join(","):e.value:e.valueEmptyTag||this.valueEmptyTag:this.valueEmptyTag},getOptionDisplayText(e){var t;const i=(null==(t=e.params)?void 0:t.options)||[],n=e.value;return(Array.isArray(n)?n:"string"==typeof n&&n.indexOf(",")>-1?n.split(",").filter(Boolean):[n]).map(e=>{const t=i.find(t=>t.value===e);return t?t.label:e}).filter(e=>null!=e&&""!==e).join(",")||e.valueEmptyTag||this.valueEmptyTag},getCascaderDisplayValue(e){var t,i,n,l;const r=e.params||{},a=r.options||[],s={value:(null==(t=r.props)?void 0:t.value)||"value",label:(null==(i=r.props)?void 0:i.label)||"label",children:(null==(n=r.props)?void 0:n.children)||"children",multiple:!!(null==(l=r.props)?void 0:l.multiple),separator:r.separator||" / "},o=e=>{const t=[];let i=a;return(e=>Array.isArray(e)?e:"string"==typeof e&&e.indexOf(",")>-1?e.split(",").filter(Boolean):[e])(e).forEach(e=>{const n=(i||[]).find(t=>t[s.value]===e);n&&(t.push(n[s.label]),i=n[s.children])}),t.join(s.separator)};return s.multiple&&Array.isArray(e.value)&&Array.isArray(e.value[0])?e.value.map(e=>o(e)).join(","):o(e.value)},isSelectLikeComponent:e=>["elselect","elradiogroup","elcheckboxgroup"].includes(R(e.component)),isSwitchComponent:e=>"elswitch"===R(e.component),isCascaderComponent:e=>"elcascader"===R(e.component),isUploadComponent:e=>"elupload"===R(e.component),getFormNodeByKey(e){for(let t=0;t<this.rows.length;t+=1){const i=this.rows[t];for(let t=0;t<i.length;t+=1){const n=i[t];if(n.key===e)return n;for(let t=0;t<(n.children||[]).length;t+=1){const i=n.children[t];if(i.key===e)return i}}}return null},getFormNodeRefByKey(e){return this.componentRefs[e]||null},getFormKvData(){const e={};return this.walkFields(t=>{t&&t.key&&(e[t.key]=Array.isArray(t.value)&&Array.isArray(t.delValue)?t.value.concat(t.delValue):t.value)}),e},resetForm(e=!1){this.walkFields(t=>{var i,n;if(!t||!t.key)return;const l=C(t.value),r=void 0!==t.defaultValue?C(t.defaultValue):Array.isArray(t.value)?[]:"boolean"!=typeof t.value&&("number"==typeof t.value?0:"");this.$set(t,"value",r),void 0!==t.delValue&&this.$set(t,"delValue",[]),t.params&&Array.isArray(t.params.fileList)&&t.params.fileList.splice(0,t.params.fileList.length),e&&JSON.stringify(l)!==JSON.stringify(r)&&("function"==typeof(null==(i=t.events)?void 0:i.change)&&this.$nextTick(()=>t.events.change(r)),"function"==typeof(null==(n=t.events)?void 0:n.input)&&this.$nextTick(()=>t.events.input(r)))})},setFormData(e){e&&"object"==typeof e&&this.walkFields(t=>{if(!t||!t.key||!Object.prototype.hasOwnProperty.call(e,t.key))return;let i=C(e[t.key]);if(this.isCascaderComponent(t)&&"string"==typeof i&&i.indexOf(",")>-1&&(i=i.split(",").filter(Boolean)),this.$set(t,"value",i),this.isUploadComponent(t)){const e=Array.isArray(i)?C(i):[];t.params&&this.$set(t.params,"fileList",e)}})},initDefaultValues(){this.initializeDefaultValues(this.rows)}}},function(){var e=this,t=e._self._c;return e.rows&&e.rows.length?t("div",{staticClass:"ns-dynamic-form",class:e.formClassList,style:e.wrapperStyle},e._l(e.rows,function(i,n){return t("div",{key:`row-${n}`,staticClass:"ns-dynamic-form__row",style:e.rowStyle},e._l(i,function(l,r){return t("div",{key:l.key||`${n}-${r}`,staticClass:"ns-dynamic-form__item",class:{"has-children":e.hasChildren(l)},style:e.getItemStyle(l,i)},[e.hasChildren(l)?[!l.hideLabel&&l.label?t("div",{staticClass:"ns-dynamic-form__group-label",style:e.groupLabelStyle},[e._v(" "+e._s(l.label)+" ")]):e._e(),t("div",{staticClass:"ns-dynamic-form__children"},e._l(l.children,function(i,l){return t("div",{key:i.key||`${n}-${r}-${l}`,staticClass:"ns-dynamic-form__child"},[!i.hideLabel&&i.label?t("div",{staticClass:"ns-dynamic-form__label",class:{"has-point":e.hasPoint||e.isRequiredField(i)},style:e.labelStyle},[e._v(" "+e._s(i.label)+" ")]):e._e(),t("div",{staticClass:"ns-dynamic-form__value",style:e.valueStyle},[e.showReadOnlyText(i)?[t("span",{directives:[{name:"sline",rawName:"v-sline"}]},[e._v(e._s(e.getReadOnlyDisplayValue(i)))])]:i.component?[t("el-form-item",{staticClass:"ns-dynamic-form__form-item",attrs:{"label-width":"0px",prop:`${e.formPropKey}.${n}.${r}.children.${l}.value`,rules:e.getFieldRules(i),required:e.getFieldRequired(i)}},[t("form-field-renderer",{attrs:{field:i,value:i.value},on:{input:function(t){return e.updateFieldValue(i,t)},ref:function(t){return e.setComponentRef(i,t)}}})],1)]:[t("span",{directives:[{name:"sline",rawName:"v-sline"}]},[e._v(e._s(e.normalizeDisplayValue(i.value,i)))])]],2)])}),0)]:[!l.hideLabel&&l.label?t("div",{staticClass:"ns-dynamic-form__label",class:{"has-point":e.hasPoint||e.isRequiredField(l)},style:e.labelStyle},[e._v(" "+e._s(l.label)+" ")]):e._e(),t("div",{staticClass:"ns-dynamic-form__value",style:e.valueStyle},[e.showReadOnlyText(l)?[t("span",{directives:[{name:"sline",rawName:"v-sline"}]},[e._v(e._s(e.getReadOnlyDisplayValue(l)))])]:l.component?[t("el-form-item",{staticClass:"ns-dynamic-form__form-item",attrs:{"label-width":"0px",prop:`${e.formPropKey}.${n}.${r}.value`,rules:e.getFieldRules(l),required:e.getFieldRequired(l)}},[t("form-field-renderer",{attrs:{field:l,value:l.value},on:{input:function(t){return e.updateFieldValue(l,t)},ref:function(t){return e.setComponentRef(l,t)}}})],1)]:[t("span",{directives:[{name:"sline",rawName:"v-sline"}]},[e._v(e._s(e.normalizeDisplayValue(l.value,l)))])]],2)]],2)}),0)}),0):e._e()},[],!1,null,"6ad4d76c",null,null).exports;class x{}x.VARS={};const _=w({name:"NsFormTitle",props:{title:{type:String,default:""}},mounted(){!function(){if("undefined"==typeof document)return x.VARS;if(Object.keys(x.VARS).length>0)return x.VARS;const e={};Array.from(document.styleSheets||[]).forEach(t=>{let i=[];try{i=Array.from(t.cssRules||[])}catch(n){i=[]}i.forEach(t=>{":root"===t.selectorText&&Array.from(t.style||[]).filter(e=>0===e.indexOf("--matrix-")).forEach(i=>{e[i]=t.style.getPropertyValue(i).trim()})})}),x.VARS=e}()}},function(){var e=this,t=e._self._c;return t("div",{staticClass:"ns-form-title"},[t("div",{staticClass:"ns-form-title__header"},[e._t("title",function(){return[t("span",{staticClass:"ns-form-title__icon"}),t("span",{staticClass:"ns-form-title__text"},[e._v(e._s(e.title))])]})],2),t("div",{staticClass:"ns-form-title__content"},[e._t("default")],2)])},[],!1,null,"29c80ec1",null,null).exports;function P(e){const i=t.getCurrentInstance();return{handleFormatFileList:function(e,t){const n=function(e){var t;return(null==(t=null==e?void 0:e.proxy)?void 0:t.$ImageBaseUrl)||""}(i),l=Array.isArray(t)?t:[];return l.forEach(e=>{e.filePath&&!e.url&&(e.url=`${n}${e.filePath}`),e.name||(e.name=e.fileName||e.name||e.filePath||"未命名文件")}),e&&e.params&&(e.params.fileList=l),e&&(e.value=l.slice()),l},handleRemoveFile:function(t,i,n,l=e.rows){const r=k(l,n);if(!r)return i;const a=(i||[]).map(e=>c(d({},e),{fileName:e.response?e.response.data.fileName:e.fileName,filePath:e.response?e.response.data.filePath:e.filePath,fileSize:e.response?e.response.data.fileSize:e.fileSize}));return Array.isArray(r.delValue)||(r.delValue=[]),t.response||"success"!==t.status||r.delValue.push(c(d({},t),{isDelete:1})),r.value=a,r.params&&(r.params.fileList=i||[]),i},handleFileSuccessFile:function(t,i,n,l,r=e.rows){const a=k(r,l);return a?(Array.isArray(a.value)||(a.value=[]),i&&"success"===i.status&&t&&t.data&&a.value.push(d({},t.data)),a.params&&(a.params.fileList=n||[]),n):n},handleCheckFileRequire:function(e,i,n,l="rows"){const r=k(e,i);r&&!Array.isArray(r.value)&&(r.value=[]);const a=function(e,t,i="rows"){for(let n=0;n<e.length;n+=1){const l=e[n];for(let e=0;e<l.length;e+=1){const r=l[e];if(r.key===t)return`${i}.${n}.${e}.value`;if(Array.isArray(r.children))for(let l=0;l<r.children.length;l+=1)if(r.children[l].key===t)return`${i}.${n}.${e}.children.${l}.value`}}return null}(e,i,l);t.nextTick(()=>{const e=n&&(n.value||n);a&&e&&"function"==typeof e.validateField&&e.validateField(a)})}}}function D(e){e.install=function(t){t.component(e.name,e)}}D($),D(_);const z=$.install;function A(e){const t={};return(e||[]).forEach(e=>{(e||[]).forEach(e=>{e&&e.key&&(t[e.key]=Array.isArray(e.value)&&Array.isArray(e.delValue)?e.value.concat(e.delValue):e.value),(e.children||[]).forEach(e=>{e&&e.key&&(t[e.key]=Array.isArray(e.value)&&Array.isArray(e.delValue)?e.value.concat(e.delValue):e.value)})})}),t}function k(e,t){for(let i=0;i<(e||[]).length;i+=1){const n=e[i]||[];for(let e=0;e<n.length;e+=1){const i=n[e];if(i&&i.key===t)return i;const l=i&&i.children||[];for(let e=0;e<l.length;e+=1)if(l[e]&&l[e].key===t)return l[e]}}return null}function E(e,t){const i=k(e,t);return i&&i.ref||null}$.install=function(e){g(e),z(e)},"undefined"!=typeof globalThis&&(globalThis.getAllFormKvData=A,globalThis.getAllFormNodeByKey=k,globalThis.getAllFormNodeRefByKey=E);const O={name:"NsSlotRenderer",functional:!0,props:{renderer:{type:Function,default:null},scope:{type:Object,default:()=>({})}},render(e,t){const i=t.props.renderer;return i?i(t.props.scope||{}):null}};const N=w({name:"NsSearch",components:{SlotRenderer:O},inheritAttrs:!1,props:{items:{type:Array,default:()=>[]},externalParams:{type:Object,default:()=>({})},defaultSpan:{type:Number,default:6},showCollapse:{type:Boolean,default:!0},collapseLimit:{type:Number,default:3},slotRenderers:{type:Object,default:()=>({})}},data:()=>({formData:{},isCollapsed:!0}),computed:{itemsPerRow(){const e=Number(this.defaultSpan||6),t=Number.isFinite(e)&&e>0?e:6;return Math.max(1,Math.floor(24/t))},visibleItems(){if(!this.showCollapse||!this.isCollapsed)return this.items;const e=this.items||[];let t=Math.min(Number(this.collapseLimit||0),e.length);return t>0&&t%this.itemsPerRow===0&&e.length>t&&(t-=1),e.slice(0,Math.max(t,1))}},watch:{items:{handler(){this.initFormData()},deep:!0,immediate:!0},externalParams:{handler(){this.formData=d(d({},this.formData),this.externalParams)},deep:!0,immediate:!0}},methods:{normalizeComponent(e){return"string"==typeof e?"string"!=typeof(t=e)?t:t.indexOf("-")>-1?t.toLowerCase():t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase():e;var t},initFormData(){const e={};(this.items||[]).forEach(t=>{e[t.prop]=void 0!==t.defaultValue?t.defaultValue:void 0}),this.formData=d(d({},e),this.externalParams)},isSlotItem:e=>e&&("slot"===e.type||!0===e.slot||"string"==typeof e.slot),getSlotRenderer(e){const t="string"==typeof e.slot?e.slot:e.slotName||e.prop;return this.slotRenderers[t]||null},isSelectComponent(e){return"el-select"===String(this.normalizeComponent(e.component||"")||"")},handleSearch(){this.$emit("search",c(d({},this.formData),{_resetPage:!0}))},handleReset(){const e={};(this.items||[]).forEach(t=>{e[t.prop]=void 0!==t.defaultValue?t.defaultValue:void 0}),this.formData=d(d({},e),this.externalParams),this.$emit("search",c(d({},this.formData),{_resetPage:!0})),this.$emit("reset")},toggleCollapse(){this.isCollapsed=!this.isCollapsed},getFormData(){return d({},this.formData)},setFormData(e){this.formData=d(d({},this.formData),e||{})},resetForm(){this.handleReset()},validate(){return this.$refs.formRef&&this.$refs.formRef.validate?this.$refs.formRef.validate():Promise.resolve(!0)},clearValidate(e){this.$refs.formRef&&this.$refs.formRef.clearValidate&&this.$refs.formRef.clearValidate(e)}}},function(){var e=this,t=e._self._c;return t("div",{staticClass:"page-search"},[t("el-form",e._b({ref:"formRef",staticClass:"page-search__form",attrs:{inline:!0,model:e.formData}},"el-form",e.$attrs,!1),[t("el-row",{staticClass:"page-search__row",attrs:{gutter:16,type:"flex"}},[e._l(e.visibleItems,function(i,n){return t("el-col",{key:i.prop||n,attrs:{span:i.span||e.defaultSpan}},[t("el-form-item",e._b({attrs:{label:i.label,prop:i.prop}},"el-form-item",i.formItemAttrs||{},!1),[e.isSlotItem(i)?t("slot-renderer",{attrs:{renderer:e.getSlotRenderer(i),scope:{formData:e.formData,item:i}}}):t(e.normalizeComponent(i.component||"el-input"),e._g(e._b({tag:"component",model:{value:e.formData[i.prop],callback:function(t){e.$set(e.formData,i.prop,t)},expression:"formData[item.prop]"}},"component",i.attrs||{},!1),i.events||{}),[e.isSelectComponent(i)?e._l(i.children||[],function(e,i){return t("el-option",{key:void 0!==e.value?e.value:i,attrs:{label:e.label,value:e.value,disabled:e.disabled}})}):e._e()],2)],1)],1)}),t("el-col",{staticClass:"page-search__actions",attrs:{span:e.defaultSpan}},[t("el-form-item",{attrs:{"label-width":"0"}},[t("el-button",{attrs:{type:"primary"},on:{click:e.handleSearch}},[e._v("查询")]),t("el-button",{on:{click:e.handleReset}},[e._v("重置")]),e.slotRenderers["actions-after-reset"]?t("slot-renderer",{attrs:{renderer:e.slotRenderers["actions-after-reset"],scope:{formData:e.formData,handleSearch:e.handleSearch,handleReset:e.handleReset,isCollapsed:e.isCollapsed}}}):e._e(),e.showCollapse&&e.items.length>e.collapseLimit?t("el-button",{attrs:{type:"text"},on:{click:e.toggleCollapse}},[t("span",[e._v(e._s(e.isCollapsed?"展开":"收起"))]),t("i",{class:e.isCollapsed?"el-icon-arrow-down":"el-icon-arrow-up"})]):e._e()],1)],1)],2)],1)],1)},[],!1,null,"cebdda8d",null,null).exports,K=["children","slot","headerSlot","buttons","enum","type","imageWidth","imageHeight","linkText"],L={name:"NsTableColumn",props:{column:{type:Object,required:!0},slotRenderers:{type:Object,default:()=>({})}},methods:{getColumnProps(e){const t=d({},e);return K.forEach(e=>delete t[e]),t},getRenderer(e){return e?this.slotRenderers[e]:null},getCellValue:(e,t)=>t.prop?e[t.prop]:void 0,isVisible:(e,t)=>"function"==typeof e.show?!1!==e.show(t):void 0===e.show||!!e.show,isDisabled:(e,t)=>"function"==typeof e.disabled?!!e.disabled(t):!!e.disabled,renderActionButtons(e,t,i){return(Array.isArray(i.buttons)?i.buttons:[]).filter(e=>this.isVisible(e,t.row)).map((n,l)=>{const r=this.getRenderer(n.slot);return r?r(c(d({},t),{row:t.row,column:i,button:n})):e("el-button",{key:n.label||l,props:{size:n.size||"mini",type:n.link?"text":n.type||"text",icon:"string"==typeof n.icon?n.icon:void 0,disabled:this.isDisabled(n,t.row)},on:{click:()=>{"function"==typeof n.handler&&n.handler(t.row,t.$index),this.$emit("button-click",t.row,i,n)}}},[n.label])})},renderTag(e,t,i){const n=this.getCellValue(t.row,i),l="function"==typeof i.tagType?i.tagType(t.row,n):i.tagType,r="function"==typeof i.formatter?i.formatter(t.row,i,n):this.resolveEnumText(i,n);return e("el-tag",{props:{type:l||"info",size:i.tagSize||"small"}},[r])},renderImage(e,t,i){const n=this.getCellValue(t.row,i);return n?e("img",{style:{width:i.imageWidth||"40px",height:i.imageHeight||"40px",objectFit:"cover",borderRadius:"4px"},attrs:{src:n,alt:i.label||"image"}}):"-"},renderLink(e,t,i){const n=this.getRenderer(i.slot);if(n)return n(t);const l=this.getCellValue(t.row,i);return e("el-button",{props:{type:"text"},on:{click:()=>this.$emit("link-click",t.row,i)}},[i.linkText||l||"-"])},resolveEnumText(e,t){const i=e.enum||e.options||[];if(!Array.isArray(i))return t;const n=i.find(e=>e.value===t);return n?n.label:t},renderDefaultCell(e,t,i){const n=this.getRenderer(i.slot);if(n)return n(t);if("action"===i.type)return e("div",{class:"ns-table-column__actions"},this.renderActionButtons(e,t,i));if("tag"===i.type)return this.renderTag(e,t,i);if("image"===i.type)return this.renderImage(e,t,i);if("link"===i.type)return this.renderLink(e,t,i);const l=this.getCellValue(t.row,i);return"function"==typeof i.formatter?i.formatter(t.row,i,l):i.enum?this.resolveEnumText(i,l):null==l||""===l?"-":l},renderColumn(e,t){const i=Array.isArray(t.children)?t.children.map((t,i)=>e(L,{key:t.prop||t.label||i,props:{column:t,slotRenderers:this.slotRenderers},on:{"link-click":(...e)=>this.$emit("link-click",...e),"button-click":(...e)=>this.$emit("button-click",...e)}})):[],n=this.getRenderer(t.headerSlot);return e("el-table-column",{props:this.getColumnProps(t),scopedSlots:i.length?n?{header:n}:void 0:d({default:i=>this.renderDefaultCell(e,i,t)},n?{header:n}:{})},i)}},render(e){return this.renderColumn(e,this.column)}},F={total:0,currentPage:1,pageSize:10},T={totalKey:"total",currentPageKey:"currentPage",pageSizeKey:"pageSize"};function B(e={}){return d(d({},F),e)}function V(e,t={}){const i=d(d({},T),t);return{[i.totalKey]:e.total,[i.currentPageKey]:e.currentPage,[i.pageSizeKey]:e.pageSize}}function M(e){return e.total=0,e.currentPage=1,e.pageSize=10,e}const j=["add","selection-change","sort-change","row-click","size-change","current-change","link-click"];const I=w({name:"NsTable",components:{SlotRenderer:O,TableColumn:L},inheritAttrs:!1,props:{tableData:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},actionButtons:{type:Array,default:()=>[]},showAddButton:{type:Boolean,default:!0},addButtonText:{type:String,default:"新增"},showHeaderToolbar:{type:Boolean,default:!0},showSelection:{type:Boolean,default:!1},showIndex:{type:Boolean,default:!1},border:{type:Boolean,default:!0},stripe:{type:Boolean,default:!1},height:{type:[String,Number],default:void 0},maxHeight:{type:[String,Number],default:void 0},autoHeight:{type:Boolean,default:!0},rowKey:{type:[String,Function],default:void 0},defaultExpandAll:{type:Boolean,default:!1},highlightCurrentRow:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},showPagination:{type:Boolean,default:!0},total:{type:Number,default:0},currentPage:{type:Number,default:null},pageSize:{type:Number,default:null},pageSizes:{type:Array,default:()=>[10,20,50,100]},paginationLayout:{type:String,default:"total, sizes, prev, pager, next, jumper"},pageNumberKey:{type:String,default:"currentPage"},pageSizeKey:{type:String,default:"pageSize"},pageTotalKey:{type:String,default:"total"},slotRenderers:{type:Object,default:()=>({})}},data:()=>({internalPagination:B()}),computed:{currentPageModel(){return null===this.currentPage?this.internalPagination.currentPage:this.currentPage},pageSizeModel(){return null===this.pageSize?this.internalPagination.pageSize:this.pageSize},mergedAttrs(){return this.$attrs||{}},mergedListeners(){const e=d({},this.$listeners||{});return j.forEach(t=>delete e[t]),e},resolvedHeight(){return void 0!==this.height?this.height:this.autoHeight&&void 0===this.maxHeight?"100%":void 0},resolvedMaxHeight(){if(void 0!==this.maxHeight)return this.maxHeight}},watch:{currentPage:{handler(e){null!==e&&(this.internalPagination.currentPage=e)},immediate:!0},pageSize:{handler(e){null!==e&&(this.internalPagination.pageSize=e)},immediate:!0}},methods:{handleAdd(){this.$emit("add")},handleSelectionChange(e){this.$emit("selection-change",e)},handleSortChange(e){this.$emit("sort-change",e)},handleRowClick(e,t,i){this.$emit("row-click",e,t,i)},handleSizeChange(e){this.internalPagination.pageSize=e,this.$emit("update:pageSize",e),this.$emit("size-change",e)},handleCurrentChange(e){this.internalPagination.currentPage=e,this.$emit("update:currentPage",e),this.$emit("current-change",e)},handleLinkClick(e,t){this.$emit("link-click",e,t)},getIndex(e){if(!this.showPagination)return e+1;return(Number(this.currentPageModel||1)-1)*Number(this.pageSizeModel||10)+e+1},getSelectionRows(){return this.$refs.tableRef&&this.$refs.tableRef.selection?this.$refs.tableRef.selection:[]},getSelectionKeys(){const e=this.getSelectionRows();return this.rowKey?e.map(e=>"function"==typeof this.rowKey?this.rowKey(e):e[this.rowKey]):e},setSelectionRows(e){this.$refs.tableRef&&(this.$refs.tableRef.clearSelection(),(e||[]).forEach(e=>{this.$refs.tableRef.toggleRowSelection(e,!0)}))},setSelectionKeys(e){this.$refs.tableRef&&this.rowKey&&(this.$refs.tableRef.clearSelection(),(e||[]).forEach(e=>{const t=(this.tableData||[]).find(t=>("function"==typeof this.rowKey?this.rowKey(t):t[this.rowKey])===e);t&&this.$refs.tableRef.toggleRowSelection(t,!0)}))},isRowSelected(e){return this.getSelectionRows().includes(e)},isKeySelected(e){return this.getSelectionKeys().includes(e)},clearSelection(){this.$refs.tableRef&&this.$refs.tableRef.clearSelection()},toggleRowSelection(e,t){this.$refs.tableRef&&this.$refs.tableRef.toggleRowSelection(e,t)},toggleAllSelection(){this.$refs.tableRef&&this.$refs.tableRef.toggleAllSelection()},selectAll(){this.toggleAllSelection()},clearAllSelection(){this.clearSelection()},clearSort(){this.$refs.tableRef&&this.$refs.tableRef.clearSort&&this.$refs.tableRef.clearSort()},clearFilter(e){this.$refs.tableRef&&this.$refs.tableRef.clearFilter&&this.$refs.tableRef.clearFilter(e)},doLayout(){this.$refs.tableRef&&this.$refs.tableRef.doLayout&&this.$refs.tableRef.doLayout()},sort(e,t){this.$refs.tableRef&&this.$refs.tableRef.sort&&this.$refs.tableRef.sort(e,t)},resetPage(){this.internalPagination.currentPage=1,this.$emit("update:currentPage",1)},setPage(e){this.internalPagination.currentPage=e,this.$emit("update:currentPage",e)},setPageSize(e){this.internalPagination.pageSize=e,this.$emit("update:pageSize",e)},getPagination(){return{[this.pageTotalKey]:this.total,[this.pageNumberKey]:this.currentPageModel,[this.pageSizeKey]:this.pageSizeModel}},setPagination(e){void 0!==e.currentPage&&this.setPage(e.currentPage),void 0!==e.pageSize&&this.setPageSize(e.pageSize)}}},function(){var e=this,t=e._self._c;return t("div",{staticClass:"page-table"},[e.showHeaderToolbar?t("div",{staticClass:"page-table__header"},[t("slot-renderer",{attrs:{renderer:e.slotRenderers["header-left"],scope:{tableData:e.tableData}}}),t("div",{staticClass:"page-table__actions"},[t("slot-renderer",{attrs:{renderer:e.slotRenderers["header-actions"],scope:{tableData:e.tableData}}}),e.showAddButton&&!e.slotRenderers["header-actions"]?t("el-button",{attrs:{type:"primary",size:"small"},on:{click:e.handleAdd}},[e._v(" "+e._s(e.addButtonText)+" ")]):e._e()],1)],1):e._e(),t("div",{staticClass:"page-table__main"},[t("el-table",e._g(e._b({directives:[{name:"loading",rawName:"v-loading",value:e.loading,expression:"loading"}],ref:"tableRef",class:["page-table__table",{"page-table__table--no-border":!e.border}],attrs:{data:e.tableData,border:e.border,stripe:e.stripe,height:e.resolvedHeight,"max-height":e.resolvedMaxHeight,"row-key":e.rowKey,"default-expand-all":e.defaultExpandAll,"highlight-current-row":e.highlightCurrentRow},on:{"selection-change":e.handleSelectionChange,"sort-change":e.handleSortChange,"row-click":e.handleRowClick}},"el-table",e.mergedAttrs,!1),e.mergedListeners),[e.showSelection?t("el-table-column",{attrs:{type:"selection",width:"55","reserve-selection":!!e.rowKey}}):e._e(),e.showIndex?t("el-table-column",{attrs:{type:"index",label:"序号",width:"60",index:e.getIndex}}):e._e(),e._l(e.columns,function(i,n){return t("table-column",{key:i.prop||i.label||n,attrs:{column:i,"slot-renderers":e.slotRenderers},on:{"link-click":e.handleLinkClick}})}),t("template",{slot:"empty"},[e.slotRenderers.empty?t("slot-renderer",{attrs:{renderer:e.slotRenderers.empty,scope:{tableData:e.tableData}}}):t("div",{staticClass:"page-table__empty"},[e._v("暂无数据")])],1)],2)],1),e.showPagination?t("div",{staticClass:"page-table__pagination"},[t("el-pagination",{attrs:{background:"","current-page":e.currentPageModel,"page-size":e.pageSizeModel,"page-sizes":e.pageSizes,total:e.total,layout:e.paginationLayout},on:{"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange}})],1):e._e()])},[],!1,null,"d962dc48",null,null).exports;const H=w({name:"NsTableContainer",components:{PageSearch:N,PageTable:I},props:{showSearch:{type:Boolean,default:!0},externalSearchParams:{type:Object,default:()=>({})},searchItems:{type:Array,default:()=>[]},tableData:{type:Array,default:()=>[]},columns:{type:Array,default:()=>[]},actionButtons:{type:Array,default:()=>[]},total:{type:Number,default:0},currentPage:{type:Number,default:null},pageSize:{type:Number,default:null},pageNumberKey:{type:String,default:"currentPage"},pageSizeKey:{type:String,default:"pageSize"},pageTotalKey:{type:String,default:"total"},searchProps:{type:Object,default:()=>({})},tableProps:{type:Object,default:()=>({})},loadData:{type:Function,default:null}},data:()=>({internalPagination:B(),pendingSelectionKeys:new Set,selectionRowMap:{},isSyncingSelection:!1}),computed:{currentPageModel(){return null===this.currentPage?this.internalPagination.currentPage:this.currentPage},pageSizeModel(){return null===this.pageSize?this.internalPagination.pageSize:this.pageSize},currentRowKey(){return this.tableProps&&this.tableProps.rowKey}},watch:{currentPage:{handler(e){null!==e&&(this.internalPagination.currentPage=e)},immediate:!0},pageSize:{handler(e){null!==e&&(this.internalPagination.pageSize=e)},immediate:!0},tableData:{handler(){this.$nextTick(()=>{this.syncSelectionToCurrentPage()})},deep:!0,immediate:!0}},methods:{getRowKey(e){return this.currentRowKey?"function"==typeof this.currentRowKey?this.currentRowKey(e):e[this.currentRowKey]:e},resetSelectionState(){this.pendingSelectionKeys=new Set,this.selectionRowMap={},this.$refs.tableRef&&this.$refs.tableRef.clearSelection&&this.$refs.tableRef.clearSelection()},syncSelectionToCurrentPage(){this.currentRowKey&&this.$refs.tableRef&&(this.isSyncingSelection=!0,this.$refs.tableRef.clearSelection(),(this.tableData||[]).forEach(e=>{const t=this.getRowKey(e);this.pendingSelectionKeys.has(t)&&(this.$set(this.selectionRowMap,t,e),this.$refs.tableRef.toggleRowSelection(e,!0))}),this.$nextTick(()=>{this.isSyncingSelection=!1}))},handleSearch(e){if(this.resetSelectionState(),e&&e._resetPage){const t=e,{_resetPage:i}=t,n=u(t,["_resetPage"]);return this.internalPagination.currentPage=1,this.$emit("update:currentPage",1),void this.$emit("search",n)}this.$emit("search",e)},handleReset(){this.resetSelectionState(),this.$emit("reset")},handleAdd(){this.$emit("add")},handleSizeChange(e){this.internalPagination.pageSize=e,this.$emit("update:pageSize",e),this.$emit("size-change",e),this.$emit("page-change",{currentPage:this.currentPageModel,pageSize:e}),this.loadData&&this.loadData()},handleCurrentChange(e){this.internalPagination.currentPage=e,this.$emit("update:currentPage",e),this.$emit("current-change",e),this.$emit("page-change",{currentPage:e,pageSize:this.pageSizeModel}),this.loadData&&this.loadData()},handleSelectionChange(e){if(this.isSyncingSelection)return;if(!this.currentRowKey)return void this.$emit("selection-change",e);(this.tableData||[]).map(e=>this.getRowKey(e)).forEach(e=>{this.pendingSelectionKeys.delete(e),this.$delete(this.selectionRowMap,e)}),(e||[]).forEach(e=>{const t=this.getRowKey(e);this.pendingSelectionKeys.add(t),this.$set(this.selectionRowMap,t,e)}),this.$emit("selection-change",Object.values(this.selectionRowMap))},handleSortChange(e){this.$emit("sort-change",e)},handleRowClick(e,t,i){this.$emit("row-click",e,t,i)},handleLinkClick(e,t){this.$emit("link-click",e,t)},initSearchAndLoad(){this.$nextTick(()=>{this.showSearch&&this.$refs.searchRef?this.$emit("search",this.$refs.searchRef.getFormData()):this.loadData&&this.loadData()})},getSearchFormData(){return this.$refs.searchRef?this.$refs.searchRef.getFormData():{}},setSearchFormData(e){this.$refs.searchRef&&this.$refs.searchRef.setFormData(e)},resetSearchForm(){this.$refs.searchRef&&this.$refs.searchRef.resetForm()},validateSearchForm(){return this.$refs.searchRef?this.$refs.searchRef.validate():Promise.resolve(!0)},getPagination(){return{[this.pageTotalKey]:this.total,[this.pageNumberKey]:this.currentPageModel,[this.pageSizeKey]:this.pageSizeModel}},getSelectionRows(){var e,t;return this.currentRowKey?Object.values(this.selectionRowMap):(null==(t=null==(e=this.$refs.tableRef)?void 0:e.getSelectionRows)?void 0:t.call(e))||[]},getSelectionKeys(){var e,t;return this.currentRowKey?Array.from(this.pendingSelectionKeys):(null==(t=null==(e=this.$refs.tableRef)?void 0:e.getSelectionKeys)?void 0:t.call(e))||[]},setSelectionRows(e){this.currentRowKey?(this.pendingSelectionKeys=new Set,this.selectionRowMap={},(e||[]).forEach(e=>{const t=this.getRowKey(e);this.pendingSelectionKeys.add(t),this.$set(this.selectionRowMap,t,e)}),this.syncSelectionToCurrentPage()):this.$refs.tableRef&&this.$refs.tableRef.setSelectionRows(e)},setSelectionKeys(e){this.currentRowKey?(this.pendingSelectionKeys=new Set(e||[]),(this.tableData||[]).forEach(e=>{const t=this.getRowKey(e);this.pendingSelectionKeys.has(t)&&this.$set(this.selectionRowMap,t,e)}),this.syncSelectionToCurrentPage()):this.$refs.tableRef&&this.$refs.tableRef.setSelectionKeys(e)},clearAllSelection(){this.resetSelectionState()},selectAll(){this.$refs.tableRef&&(this.currentRowKey?((this.tableData||[]).forEach(e=>{const t=this.getRowKey(e);this.pendingSelectionKeys.add(t),this.$set(this.selectionRowMap,t,e)}),this.$refs.tableRef.setSelectionRows(this.tableData)):this.$refs.tableRef.selectAll())},isRowSelected(e){var t,i;return this.currentRowKey?this.pendingSelectionKeys.has(this.getRowKey(e)):null==(i=null==(t=this.$refs.tableRef)?void 0:t.isRowSelected)?void 0:i.call(t,e)},isKeySelected(e){var t,i;return this.currentRowKey?this.pendingSelectionKeys.has(e):null==(i=null==(t=this.$refs.tableRef)?void 0:t.isKeySelected)?void 0:i.call(t,e)}}},function(){var e=this,t=e._self._c;return t("div",{staticClass:"page-container"},[e.showSearch?t("page-search",e._b({ref:"searchRef",attrs:{items:e.searchItems,"external-params":e.externalSearchParams,"slot-renderers":e.$scopedSlots},on:{search:e.handleSearch,reset:e.handleReset}},"page-search",e.searchProps,!1)):e._e(),t("page-table",e._b({ref:"tableRef",attrs:{"table-data":e.tableData,columns:e.columns,"action-buttons":e.actionButtons,total:e.total,"current-page":e.currentPageModel,"page-size":e.pageSizeModel,"page-number-key":e.pageNumberKey,"page-size-key":e.pageSizeKey,"page-total-key":e.pageTotalKey,"slot-renderers":e.$scopedSlots},on:{add:e.handleAdd,"selection-change":e.handleSelectionChange,"sort-change":e.handleSortChange,"row-click":e.handleRowClick,"size-change":e.handleSizeChange,"current-change":e.handleCurrentChange,"link-click":e.handleLinkClick}},"page-table",e.tableProps,!1))],1)},[],!1,null,"df3951e4",null,null).exports;[H,N,I].forEach(e=>{e.install=function(t){t.component(e.name,e)}});var W=function(){var e=this,t=e._self._c;return t("el-dialog",{attrs:{visible:e.visible,width:e.normalizedWidth,modal:e.modal,"modal-class":e.modalClassName,"show-close":!1,"append-to-body":!1,"close-on-click-modal":e.closeOnClickModal,"custom-class":e.dialogCustomClass},on:{"update:visible":function(t){e.visible=t},close:e.dealClose,closed:e.dealClosed}},[t("div",{staticClass:"ns-dialog-plus__header",attrs:{slot:"title"},on:{mousedown:e.handleDragStart},slot:"title"},[t("div",{staticClass:"ns-dialog-plus__title"},[e.resolvedHeaderDom?t(e.resolvedHeaderDom,e._g(e._b({tag:"component"},"component",e.headerOption,!1),e.mergeEvents(e.headerEvents))):[e._v(e._s(e.currentTitle))]],2),t("div",{staticClass:"dialog-controls"},[e.showMaximizeButton?t("span",{staticClass:"dialog-icon dialog-maximize",attrs:{title:"最大化/还原"},on:{click:function(t){return t.stopPropagation(),e.toggleMaximize.apply(null,arguments)}}},[e.isMaximized?t("i",{staticClass:"el-icon-zoom-out"}):t("i",{staticClass:"el-icon-full-screen"})]):e._e(),t("span",{staticClass:"dialog-icon dialog-close",attrs:{title:"关闭"},on:{click:function(t){return t.stopPropagation(),e.closeDialog.apply(null,arguments)}}},[t("i",{staticClass:"el-icon-close"})])])]),t("div",{staticClass:"ns-dialog-plus__body",style:e.bodyStyle},[t(e.resolvedDom,e._g(e._b({ref:"contentRef",tag:"component"},"component",e.currentOption,!1),e.mergeEvents(e.events)))],1),e.showFooter?t("div",{staticClass:"ns-dialog-plus__footer",attrs:{slot:"footer"},slot:"footer"},[e.resolvedFooterDom?t(e.resolvedFooterDom,e._g(e._b({tag:"component"},"component",e.footerOption,!1),e.mergeEvents(e.footerEvents))):[e.footerButtonReverse&&!e.footerCloseOnly?t("el-button",{attrs:{type:"primary",loading:e.footerLoading},on:{click:e.dealConfirm}},[e._v(e._s(e.footerButtonText.confirm))]):e._e(),t("el-button",{on:{click:e.closeDialog}},[e._v(e._s(e.footerButtonText.close))]),e.footerButtonReverse||e.footerCloseOnly?e._e():t("el-button",{attrs:{type:"primary",loading:e.footerLoading},on:{click:e.dealConfirm}},[e._v(e._s(e.footerButtonText.confirm))])]],2):e._e()])};const q=w({name:"NsDialogComponent",props:{className:{type:String,default:""},title:{type:String,default:""},width:{type:[Number,String],default:500},height:{type:[Number,String],default:""},modal:{type:Boolean,default:!0},dialogPadding:{type:[Number,String,Array],default:-1},modalColor:{type:String,default:"rgba(0, 0, 0, 0.45)"},closeOnClickModal:{type:Boolean,default:!0},dom:{type:[Object,Function],default:null},option:{type:Object,default:()=>({})},events:{type:Object,default:()=>({})},domCompleted:{type:Function,default:null},headerDom:{type:[Object,Function],default:null},headerOption:{type:Object,default:()=>({})},headerEvents:{type:Object,default:()=>({})},showFooter:{type:Boolean,default:!0},footerDom:{type:[Object,Function],default:null},footerOption:{type:Object,default:()=>({})},footerTitle:{type:Object,default:()=>({close:"取消",confirm:"确定"})},footerEvents:{type:Object,default:()=>({})},footerButtonReverse:{type:Boolean,default:!1},footerCloseOnly:{type:Boolean,default:!1},immediately:{type:Boolean,default:!1},close:{type:Function,default:null},closed:{type:Function,default:null},draggable:{type:Boolean,default:!1},confirm:{type:Function,default:null},x:{type:[Number,String],default:null},y:{type:[Number,String],default:null},maxSize:{type:Function,default:null},dialogInstance:{type:Object,default:null},containerId:{type:String,default:""}},data(){return{visible:!1,currentTitle:this.title,currentOption:d({},this.option),currentWidth:this.width,currentHeight:this.height,currentX:this.x,currentY:this.y,footerLoading:!1,isMaximized:!1,originalSize:{width:this.width,height:this.height,x:this.x,y:this.y},dragContext:null,domCompletedCalled:!1}},computed:{normalizedWidth(){return this.normalizeSize(this.currentWidth||this.width||500)},bodyStyle(){const e=this.resolvePadding();return this.currentHeight?{padding:e,height:"100%",minHeight:0,overflow:"auto",flex:"1 1 auto"}:{padding:e,minHeight:"auto",maxHeight:"none",overflow:"auto"}},dialogCustomClass(){return["ns-dialog-plus",this.className,this.hasAbsolutePosition?"ns-dialog-plus--absolute":""].filter(Boolean).join(" ")},modalClassName(){return`ns-dialog-plus-modal ns-dialog-plus-modal--${this.containerId}`},resolvedDom(){return this.resolveComponent(this.dom)},resolvedHeaderDom(){return this.resolveComponent(this.headerDom)},resolvedFooterDom(){return this.resolveComponent(this.footerDom)},footerButtonText(){var e,t;return{close:(null==(e=this.footerTitle)?void 0:e.close)||"取消",confirm:(null==(t=this.footerTitle)?void 0:t.confirm)||"确定"}},showMaximizeButton(){return"function"==typeof this.maxSize},hasAbsolutePosition(){return null!==this.currentX||null!==this.currentY}},watch:{option:{handler(e){this.currentOption=d({},e)},deep:!0},title(e){this.currentTitle=e},width(e){this.isMaximized||(this.currentWidth=e)},height(e){this.isMaximized||(this.currentHeight=e)},x(e){this.isMaximized||(this.currentX=e)},y(e){this.isMaximized||(this.currentY=e)},visible(){this.$nextTick(()=>{this.applyDialogLayout(),this.syncDialogInstance(),this.triggerDomCompleted()})}},mounted(){v(),this.visible=!0,this.updateModalStyle(),this.syncDialogInstance(),this.$nextTick(()=>{this.applyDialogLayout(),this.triggerDomCompleted()}),document.addEventListener("keydown",this.handleKeydown),window.addEventListener("resize",this.applyDialogLayout)},updated(){this.syncDialogInstance(),this.triggerDomCompleted(),this.$nextTick(()=>{this.applyDialogLayout()})},beforeDestroy(){document.removeEventListener("keydown",this.handleKeydown),window.removeEventListener("resize",this.applyDialogLayout),this.removeDragListeners(),this.removeModalStyle()},methods:{normalizeSize(e){if(null==e||""===e)return"";if("number"==typeof e&&isFinite(e))return`${e}px`;const t=String(e).trim();return""===t?"":Number.isNaN(Number(t))?t:`${Number(t)}px`},resolvePadding(){return Array.isArray(this.dialogPadding)?this.dialogPadding.map(e=>this.normalizeSize(e)).join(" "):-1===this.dialogPadding||"-1"===this.dialogPadding?"16px 20px":this.normalizeSize(this.dialogPadding)},resolveComponent:e=>e?e.default?e.default:"function"==typeof e.then?()=>e:e:null,mergeEvents(e={}){return c(d({},e),{close:()=>this.closeDialog()})},resolveDialogElement(){return this.$el&&this.$el.querySelector?this.$el.querySelector(".el-dialog"):null},resolveWrapperElement(){return this.$el&&this.$el.querySelector?this.$el.querySelector(".el-dialog__wrapper"):null},applyDialogLayout(){const e=this.resolveDialogElement();if(!e)return;const t=this.resolveWrapperElement();t&&(t.style.display="",t.style.alignItems="",t.style.justifyContent=""),this.currentHeight?(e.style.height=this.normalizeSize(this.currentHeight),e.style.display="flex",e.style.flexDirection="column"):e.style.height="";const i=e.getBoundingClientRect().height,n=i>=window.innerHeight?20:Math.max((window.innerHeight-i)/2,0);this.hasAbsolutePosition?(e.style.position="fixed",e.style.margin="0",null!==this.currentX?e.style.left=this.normalizeSize(this.currentX):e.style.left="",null!==this.currentY?e.style.top=this.normalizeSize(this.currentY):e.style.top=`${n}px`):(e.style.position="relative",e.style.left="",e.style.top=`${n}px`,e.style.margin="0 auto")},updateModalStyle(){if(!this.containerId)return;let e=document.getElementById(`style-${this.containerId}`);e||(e=document.createElement("style"),e.id=`style-${this.containerId}`,document.head.appendChild(e)),e.textContent=`.${this.modalClassName.replace(/ /g,".")} { background-color: ${this.modalColor} !important; }`},removeModalStyle(){if(!this.containerId)return;const e=document.getElementById(`style-${this.containerId}`);e&&e.parentNode&&e.parentNode.removeChild(e)},syncDialogInstance(){this.dialogInstance&&(this.dialogInstance.domRef=this.$refs.contentRef||null,this.dialogInstance.updateOption=(e={})=>{Object.prototype.hasOwnProperty.call(e,"title")&&(this.currentTitle=e.title),Object.prototype.hasOwnProperty.call(e,"width")&&(this.currentWidth=e.width),Object.prototype.hasOwnProperty.call(e,"height")&&(this.currentHeight=e.height),Object.prototype.hasOwnProperty.call(e,"x")&&(this.currentX=e.x),Object.prototype.hasOwnProperty.call(e,"y")&&(this.currentY=e.y);const t=d({},e);delete t.title,delete t.width,delete t.height,delete t.x,delete t.y,this.currentOption=d(d({},this.currentOption),t)},this.dialogInstance.callMethod=(e,...t)=>{const i=this.$refs.contentRef;if(i&&"function"==typeof i[e])return i[e](...t)},this.dialogInstance.close=()=>this.closeDialog())},triggerDomCompleted(){this.domCompletedCalled||this.$refs.contentRef&&(this.domCompletedCalled=!0,"function"==typeof this.domCompleted&&this.domCompleted(this.$refs.contentRef))},toggleMaximize(){if(this.showMaximizeButton){if(this.isMaximized)this.currentWidth=this.originalSize.width,this.currentHeight=this.originalSize.height,this.currentX=this.originalSize.x,this.currentY=this.originalSize.y,this.isMaximized=!1;else{this.originalSize={width:this.currentWidth,height:this.currentHeight,x:this.currentX,y:this.currentY};const e=this.maxSize&&this.maxSize()||{};this.currentWidth=e.width||"100vw",this.currentHeight=e.height||"100vh",this.currentX=void 0!==e.x?e.x:0,this.currentY=void 0!==e.y?e.y:0,this.isMaximized=!0}this.$nextTick(()=>this.applyDialogLayout())}},closeDialog(){this.visible=!1},dealClose(){"function"==typeof this.close&&this.close()},dealClosed(){"function"==typeof this.closed&&this.closed()},dealConfirm(){const e=this,t={get value(){return e.footerLoading},set value(t){e.footerLoading=!!t}};if(this.footerLoading=!0,this.confirm)return this.immediately?(this.footerLoading=!1,this.visible=!1,void this.confirm(null,this.$refs.contentRef)):void this.confirm(()=>{this.footerLoading=!1,this.visible=!1,this.$message&&this.$message.success&&this.$message.success("操作成功")},this.$refs.contentRef,t);this.footerLoading=!1},handleKeydown(e){this.visible&&this.showFooter&&("Enter"!==e.key||this.footerDom||this.footerCloseOnly||(e.preventDefault(),this.dealConfirm()))},handleDragStart(e){if(!this.draggable||0!==e.button)return;const t=this.resolveDialogElement();if(!t)return;const i=t.getBoundingClientRect();this.currentX=i.left,this.currentY=i.top,this.dragContext={startX:e.clientX,startY:e.clientY,originX:i.left,originY:i.top},document.addEventListener("mousemove",this.handleDragMove),document.addEventListener("mouseup",this.handleDragEnd)},handleDragMove(e){if(!this.dragContext)return;const t=e.clientX-this.dragContext.startX,i=e.clientY-this.dragContext.startY;this.currentX=this.dragContext.originX+t,this.currentY=this.dragContext.originY+i,this.applyDialogLayout()},handleDragEnd(){this.removeDragListeners()},removeDragListeners(){document.removeEventListener("mousemove",this.handleDragMove),document.removeEventListener("mouseup",this.handleDragEnd),this.dragContext=null}}},W,[],!1,null,"6762dc10",null,null).exports,X="undefined"!=typeof window?window.__dialogInstances=window.__dialogInstances||[]:[];let Y=t,U=null,J=null,Z=0;function G(e,t=[]){return e||(t.find(Boolean)||null)}function Q(e,t={}){return G(t.store,[e&&e.$store,e&&e.$options&&e.$options.store,e&&e.store,U])}function ee(e,t={}){return G(t.pinia,[e&&e.$pinia,e&&e.$options&&e.$options.pinia,e&&e.pinia,J])}function te(e,t={}){if(!e)return;const i=function(e){return e?e.extend?e:e.constructor&&e.constructor.extend?e.constructor:null:null}(e);i&&(Y=i),U=Q(e,t),J=ee(e,t)}function ie(e){if(!e||e.destroyed)return;e.destroyed=!0;const t=e.vm;t&&!t._isDestroyed&&t.$destroy();const i=e.rootEl||t&&t.$el;i&&e.element&&i.parentNode===e.element&&e.element.removeChild(i),e.element&&e.element.parentNode&&e.element.parentNode.removeChild(e.element),e.vm=null,e.domRef=null,e.rootEl=null,e.updateOption=()=>{},e.callMethod=()=>{},e.close=()=>{},function(e){const t=X.findIndex(t=>t.id===e.id);t>-1&&X.splice(t,1)}(e)}function ne(){X.slice().forEach(e=>{e&&"function"==typeof e.close&&e.close()})}function le(e,i=!0,n="#app"){if(!e||!e.dom)return!1;const l=(r=n,"undefined"==typeof document?null:document.querySelector(r)||document.body);var r;if(!l)return!1;const a=this&&this._isVue?this:null,s=e,{store:o,pinia:h}=s,p=u(s,["store","pinia"]),f=Q(a,{store:o}),m=ee(a,{pinia:h}),g=p.id||`ns-dialog-${Date.now()}-${Z++}`,y=document.createElement("div");y.id=g,l.appendChild(y);const v={id:g,class:p.class||"",element:y,vm:null,rootEl:null,destroyed:!1,domRef:null,updateOption:()=>{},callMethod:()=>{},close:()=>{}},b=(Y||t).extend(q),S={propsData:c(d({},p),{className:p.class||"",modal:i,footerButtonReverse:!0,containerId:g,dialogInstance:v,close:()=>{"function"==typeof p.close&&p.close()},closed:()=>{try{"function"==typeof p.closed&&p.closed()}finally{ie(v)}}})};f&&(S.store=f),m&&(S.pinia=m);const w=new b(S);return v.vm=w,v.close=()=>{v.destroyed||w&&"function"==typeof w.closeDialog&&w.closeDialog()},X.push(v),w.$mount(),w.$el&&(v.rootEl=w.$el,y.appendChild(w.$el)),v}const re=[$,_,H,N,I];function ae(e,t={}){ae.installed||(ae.installed=!0,g(e),re.forEach(t=>{t&&t.name&&e.component(t.name,t)}),te(e,t),v(),e&&e.prototype&&(e.prototype.$NsDialog=le,e.prototype.$closeAllNsDialog=ne),"undefined"!=typeof window&&(window.NsDialog=le,window.closeAllNsDialog=ne))}const se={install:ae,NsForm:$,NsFormTitle:_,NsTableContainer:H,NsSearch:N,NsTable:I,NsDialog:le,closeAllNsDialog:ne,setExternalApp:te,useFileUpload:P,getAllFormNodeByKey:k,getAllFormKvData:A,getAllFormNodeRefByKey:E,createPagination:B,createPaginationWithCustomKeys:V,resetPagination:M};e.NsDialog=le,e.NsForm=$,e.NsFormTitle=_,e.NsSearch=N,e.NsTable=I,e.NsTableContainer=H,e.closeAllNsDialog=ne,e.createPagination=B,e.createPaginationWithCustomKeys=V,e.default=se,e.getAllFormKvData=A,e.getAllFormNodeByKey=k,e.getAllFormNodeRefByKey=E,e.install=ae,e.resetPagination=M,e.setExternalApp=te,e.useFileUpload=P,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|