@cimom/ci-web-plugins-commom 1.0.15 → 1.0.17
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/CI.Web.Plugins.Commom.css +2 -2
- package/dist/DhtmlxGanttPro/README.md +1 -1
- package/dist/HeaderDropdown/README.md +302 -0
- package/dist/HeaderDropdown/index.js +1 -0
- package/dist/_virtual/_commonjsHelpers/index.js +1 -0
- package/dist/_virtual/array-set/index.js +1 -0
- package/dist/_virtual/base64/index.js +1 -0
- package/dist/_virtual/base64-vlq/index.js +1 -0
- package/dist/_virtual/binary-search/index.js +1 -0
- package/dist/_virtual/mapping-list/index.js +1 -0
- package/dist/_virtual/picocolors/index.js +1 -0
- package/dist/_virtual/postcss/index.js +1 -0
- package/dist/_virtual/quick-sort/index.js +1 -0
- package/dist/_virtual/source-map/index.js +1 -0
- package/dist/_virtual/source-map-consumer/index.js +1 -0
- package/dist/_virtual/source-map-generator/index.js +1 -0
- package/dist/_virtual/source-node/index.js +1 -0
- package/dist/_virtual/symbols/index.js +1 -0
- package/dist/_virtual/util/index.js +1 -0
- package/dist/components/DhtmlxGanttPro/index.vue/index2.js +1 -1
- package/dist/components/DhtmlxGanttPro/index.vue/index3.js +1 -1
- package/dist/components/HeaderDropdown/index.vue/index.js +1 -0
- package/dist/components/HeaderDropdown/index.vue/index2.js +1 -0
- package/dist/components/HeaderDropdown.vue/index.js +1 -0
- package/dist/components/HeaderDropdown.vue/index2.js +1 -0
- package/dist/components/VxeTablePro/index.vue/index2.js +1 -1
- package/dist/index/index.js +1 -1
- package/dist/node_modules/nanoid/non-secure/index/index.js +1 -0
- package/dist/node_modules/picocolors/picocolors/index.js +1 -0
- package/dist/node_modules/postcss/lib/at-rule/index.js +1 -0
- package/dist/node_modules/postcss/lib/comment/index.js +1 -0
- package/dist/node_modules/postcss/lib/container/index.js +1 -0
- package/dist/node_modules/postcss/lib/css-syntax-error/index.js +1 -0
- package/dist/node_modules/postcss/lib/declaration/index.js +1 -0
- package/dist/node_modules/postcss/lib/document/index.js +1 -0
- package/dist/node_modules/postcss/lib/fromJSON/index.js +1 -0
- package/dist/node_modules/postcss/lib/input/index.js +1 -0
- package/dist/node_modules/postcss/lib/lazy-result/index.js +1 -0
- package/dist/node_modules/postcss/lib/list/index.js +1 -0
- package/dist/node_modules/postcss/lib/map-generator/index.js +1 -0
- package/dist/node_modules/postcss/lib/no-work-result/index.js +1 -0
- package/dist/node_modules/postcss/lib/node/index.js +1 -0
- package/dist/node_modules/postcss/lib/parse/index.js +1 -0
- package/dist/node_modules/postcss/lib/parser/index.js +1 -0
- package/dist/node_modules/postcss/lib/postcss/index.js +1 -0
- package/dist/node_modules/postcss/lib/postcss/index2.js +1 -0
- package/dist/node_modules/postcss/lib/previous-map/index.js +1 -0
- package/dist/node_modules/postcss/lib/processor/index.js +1 -0
- package/dist/node_modules/postcss/lib/result/index.js +1 -0
- package/dist/node_modules/postcss/lib/root/index.js +1 -0
- package/dist/node_modules/postcss/lib/rule/index.js +1 -0
- package/dist/node_modules/postcss/lib/stringifier/index.js +1 -0
- package/dist/node_modules/postcss/lib/stringify/index.js +1 -0
- package/dist/node_modules/postcss/lib/symbols/index.js +1 -0
- package/dist/node_modules/postcss/lib/terminal-highlight/index.js +1 -0
- package/dist/node_modules/postcss/lib/tokenize/index.js +1 -0
- package/dist/node_modules/postcss/lib/warn-once/index.js +1 -0
- package/dist/node_modules/postcss/lib/warning/index.js +1 -0
- package/dist/node_modules/source-map-js/lib/array-set/index.js +1 -0
- package/dist/node_modules/source-map-js/lib/base64/index.js +1 -0
- package/dist/node_modules/source-map-js/lib/base64-vlq/index.js +1 -0
- package/dist/node_modules/source-map-js/lib/binary-search/index.js +1 -0
- package/dist/node_modules/source-map-js/lib/mapping-list/index.js +1 -0
- package/dist/node_modules/source-map-js/lib/quick-sort/index.js +1 -0
- package/dist/node_modules/source-map-js/lib/source-map-consumer/index.js +1 -0
- package/dist/node_modules/source-map-js/lib/source-map-generator/index.js +1 -0
- package/dist/node_modules/source-map-js/lib/source-node/index.js +1 -0
- package/dist/node_modules/source-map-js/lib/util/index.js +1 -0
- package/dist/node_modules/source-map-js/source-map/index.js +1 -0
- package/package.json +6 -3
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
# HeaderDropdown 组件使用说明
|
|
2
|
+
|
|
3
|
+
## 简介
|
|
4
|
+
|
|
5
|
+
`HeaderDropdown` 是一个用于表格列头的下拉菜单组件,提供了丰富的表格操作功能,包括导入导出、排序、列设置、样式调整等。该组件与 `VxeTablePro` 配合使用,通过传入 `tableRef` 来操作底层表格实例。
|
|
6
|
+
|
|
7
|
+
## 安装
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @cimom/ci-web-plugins-commom
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## 使用方法
|
|
14
|
+
|
|
15
|
+
### 基础用法
|
|
16
|
+
|
|
17
|
+
```vue
|
|
18
|
+
<script setup>
|
|
19
|
+
import { ref } from 'vue'
|
|
20
|
+
import HeaderDropdown from '@cimom/ci-web-plugins-commom/HeaderDropdown'
|
|
21
|
+
import VxeTablePro from '@cimom/ci-web-plugins-commom/VxeTablePro'
|
|
22
|
+
|
|
23
|
+
const tableRef = ref(null)
|
|
24
|
+
|
|
25
|
+
// 自定义导出
|
|
26
|
+
function handleExport() {
|
|
27
|
+
console.log('自定义导出逻辑')
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// 自定义导入
|
|
31
|
+
function handleImport() {
|
|
32
|
+
console.log('自定义导入逻辑')
|
|
33
|
+
}
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<template>
|
|
37
|
+
<VxeTablePro ref="tableRef" :data="tableData">
|
|
38
|
+
<vxe-column field="name" title="姓名">
|
|
39
|
+
<template #header>
|
|
40
|
+
<HeaderDropdown
|
|
41
|
+
:table-ref="tableRef"
|
|
42
|
+
title="姓名"
|
|
43
|
+
:column="{ field: 'name' }"
|
|
44
|
+
:header-config="{
|
|
45
|
+
import: true,
|
|
46
|
+
export: true,
|
|
47
|
+
custom: true,
|
|
48
|
+
lineHeight: true,
|
|
49
|
+
fullscreen: true
|
|
50
|
+
}"
|
|
51
|
+
:on-export="handleExport"
|
|
52
|
+
:on-import="handleImport"
|
|
53
|
+
/>
|
|
54
|
+
</template>
|
|
55
|
+
</vxe-column>
|
|
56
|
+
</VxeTablePro>
|
|
57
|
+
</template>
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Props 参数说明
|
|
61
|
+
|
|
62
|
+
### 必需参数
|
|
63
|
+
|
|
64
|
+
| 参数名 | 类型 | 说明 |
|
|
65
|
+
|--------|------|------|
|
|
66
|
+
| `tableRef` | Object | VxeTablePro 组件的 ref 实例,用于操作表格 |
|
|
67
|
+
|
|
68
|
+
### 可选参数
|
|
69
|
+
|
|
70
|
+
| 参数名 | 类型 | 默认值 | 说明 |
|
|
71
|
+
|--------|------|--------|------|
|
|
72
|
+
| `title` | String | `null` | 列头标题文本 |
|
|
73
|
+
| `column` | Object | `null` | 列配置对象,包含 `field` 等属性,用于锁定/解锁列功能 |
|
|
74
|
+
|
|
75
|
+
### headerConfig 配置项
|
|
76
|
+
|
|
77
|
+
通过 `headerConfig` 对象控制菜单项的显示,所有配置项均为 `Boolean` 类型:
|
|
78
|
+
|
|
79
|
+
| 配置项 | 类型 | 默认值 | 说明 |
|
|
80
|
+
|--------|------|--------|------|
|
|
81
|
+
| `import` | Boolean | `false` | 显示"导入"菜单项 |
|
|
82
|
+
| `export` | Boolean | `false` | 显示"导出"菜单项 |
|
|
83
|
+
| `lineHeight` | Boolean | `false` | 显示"行高"设置菜单项 |
|
|
84
|
+
| `custom` | Boolean | `false` | 显示"列设置"菜单项 |
|
|
85
|
+
| `resetCustom` | Boolean | `false` | 显示"重置列"菜单项 |
|
|
86
|
+
| `save` | Boolean | `false` | 显示"保存布局"菜单项 |
|
|
87
|
+
| `feedback` | Boolean | `false` | 显示"样式"菜单项(斑马纹、边框) |
|
|
88
|
+
| `chart` | Boolean | `false` | 显示"排版"菜单项(表格尺寸) |
|
|
89
|
+
| `fullscreen` | Boolean | `false` | 显示"全屏"菜单项 |
|
|
90
|
+
| `print` | Boolean | `false` | 显示"打印"菜单项 |
|
|
91
|
+
| `lock` | Boolean | `false` | 显示"锁定"菜单项(固定列到左侧) |
|
|
92
|
+
| `unlock` | Boolean | `false` | 显示"解锁"菜单项(取消固定列) |
|
|
93
|
+
|
|
94
|
+
### 回调函数
|
|
95
|
+
|
|
96
|
+
所有回调函数均为可选,如果提供了函数则显示对应菜单项并执行自定义逻辑,否则使用默认行为:
|
|
97
|
+
|
|
98
|
+
| 函数名 | 参数 | 说明 |
|
|
99
|
+
|--------|------|------|
|
|
100
|
+
| `onImport` | `()` | 自定义导入逻辑 |
|
|
101
|
+
| `onExport` | `()` | 自定义导出逻辑 |
|
|
102
|
+
| `onAsc` | `()` | 正序排序回调 |
|
|
103
|
+
| `onDesc` | `()` | 倒序排序回调 |
|
|
104
|
+
| `onFullscreen` | `()` | 全屏回调 |
|
|
105
|
+
| `onPrint` | `()` | 打印回调 |
|
|
106
|
+
| `onCustom` | `()` | 列设置回调 |
|
|
107
|
+
| `onIndividual` | `(tableId, storeData)` | 保存个人布局回调,参数:表格ID、存储数据 |
|
|
108
|
+
| `onAll` | `(tableId, storeData)` | 保存所有布局回调,参数:表格ID、存储数据 |
|
|
109
|
+
| `refreshCustom` | `(tableId)` | 刷新布局回调,参数:表格ID |
|
|
110
|
+
| `searchCustom` | `()` | 刷新回调 |
|
|
111
|
+
|
|
112
|
+
## 功能说明
|
|
113
|
+
|
|
114
|
+
### 1. 导入/导出
|
|
115
|
+
|
|
116
|
+
- **导入**:点击后触发 `onImport` 回调,如果未提供则调用 `tableRef.openImport()`
|
|
117
|
+
- **导出**:点击后触发 `onExport` 回调,如果未提供则调用 `tableRef.exportData()` 进行默认导出
|
|
118
|
+
|
|
119
|
+
### 2. 排序
|
|
120
|
+
|
|
121
|
+
- **正序(接口)**:触发 `onAsc` 回调,用于服务端排序
|
|
122
|
+
- **倒序(接口)**:触发 `onDesc` 回调,用于服务端排序
|
|
123
|
+
|
|
124
|
+
### 3. 行高设置
|
|
125
|
+
|
|
126
|
+
当 `headerConfig.lineHeight` 为 `true` 时显示,支持通过数字输入框调整表格行高(范围:1-200)。
|
|
127
|
+
|
|
128
|
+
### 4. 列设置
|
|
129
|
+
|
|
130
|
+
- **列设置**:打开列自定义配置弹窗(需要 VxeTablePro 支持)
|
|
131
|
+
- **重置列**:重置列配置为默认状态,并保存到 localStorage
|
|
132
|
+
|
|
133
|
+
### 5. 保存布局
|
|
134
|
+
|
|
135
|
+
当 `headerConfig.save` 为 `true` 时显示,包含子菜单:
|
|
136
|
+
- **保存个人**:调用 `onIndividual(tableId, storeData)` 保存个人配置
|
|
137
|
+
- **保存所有**:调用 `onAll(tableId, storeData)` 保存全局配置
|
|
138
|
+
|
|
139
|
+
存储数据结构:
|
|
140
|
+
```javascript
|
|
141
|
+
{
|
|
142
|
+
resizableData: {}, // 列宽配置
|
|
143
|
+
sortData: {}, // 列排序顺序
|
|
144
|
+
visibleData: {}, // 列显示/隐藏
|
|
145
|
+
fixedData: {}, // 固定列配置
|
|
146
|
+
basicConfig: { // 基础配置(边框、行高、斑马纹、尺寸)
|
|
147
|
+
border: true,
|
|
148
|
+
lineHeight: 36,
|
|
149
|
+
stripe: false,
|
|
150
|
+
cellStyle: 'mini'
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
### 6. 样式设置
|
|
156
|
+
|
|
157
|
+
当 `headerConfig.feedback` 为 `true` 时显示,包含:
|
|
158
|
+
- **启用斑马纹**:切换表格斑马纹样式
|
|
159
|
+
- **启用边框**:切换表格边框显示
|
|
160
|
+
|
|
161
|
+
### 7. 排版设置
|
|
162
|
+
|
|
163
|
+
当 `headerConfig.chart` 为 `true` 时显示,支持切换表格尺寸:
|
|
164
|
+
- **默认**:`default`
|
|
165
|
+
- **中**:`medium`
|
|
166
|
+
- **小**:`small`
|
|
167
|
+
- **迷你**:`mini`
|
|
168
|
+
|
|
169
|
+
### 8. 其他功能
|
|
170
|
+
|
|
171
|
+
- **更新布局**:刷新表格布局配置
|
|
172
|
+
- **刷新**:触发 `searchCustom` 回调
|
|
173
|
+
- **全屏**:切换表格全屏显示
|
|
174
|
+
- **打印**:触发 `onPrint` 回调
|
|
175
|
+
- **锁定/解锁**:固定/取消固定当前列到左侧
|
|
176
|
+
|
|
177
|
+
## 完整示例
|
|
178
|
+
|
|
179
|
+
```vue
|
|
180
|
+
<script setup>
|
|
181
|
+
import { ref, reactive } from 'vue'
|
|
182
|
+
import HeaderDropdown from '@cimom/ci-web-plugins-commom/HeaderDropdown'
|
|
183
|
+
import VxeTablePro from '@cimom/ci-web-plugins-commom/VxeTablePro'
|
|
184
|
+
|
|
185
|
+
const tableRef = ref(null)
|
|
186
|
+
const tableData = reactive([
|
|
187
|
+
{ id: '10001', name: '张三', sex: '男', age: 28 },
|
|
188
|
+
{ id: '10002', name: '李四', sex: '女', age: 22 }
|
|
189
|
+
])
|
|
190
|
+
|
|
191
|
+
// 自定义导出
|
|
192
|
+
function handleExport() {
|
|
193
|
+
tableRef.value?.exportData({
|
|
194
|
+
filename: '用户数据',
|
|
195
|
+
type: 'xlsx'
|
|
196
|
+
})
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// 保存个人布局
|
|
200
|
+
function handleSaveIndividual(tableId, storeData) {
|
|
201
|
+
console.log('保存个人布局:', tableId, storeData)
|
|
202
|
+
// 发送到服务器保存
|
|
203
|
+
// api.saveUserLayout(tableId, storeData)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// 保存所有布局
|
|
207
|
+
function handleSaveAll(tableId, storeData) {
|
|
208
|
+
console.log('保存所有布局:', tableId, storeData)
|
|
209
|
+
// 发送到服务器保存
|
|
210
|
+
// api.saveGlobalLayout(tableId, storeData)
|
|
211
|
+
}
|
|
212
|
+
</script>
|
|
213
|
+
|
|
214
|
+
<template>
|
|
215
|
+
<VxeTablePro
|
|
216
|
+
ref="tableRef"
|
|
217
|
+
:data="tableData"
|
|
218
|
+
id="my-table"
|
|
219
|
+
>
|
|
220
|
+
<vxe-column field="name" title="姓名" width="120">
|
|
221
|
+
<template #header>
|
|
222
|
+
<HeaderDropdown
|
|
223
|
+
:table-ref="tableRef"
|
|
224
|
+
title="姓名"
|
|
225
|
+
:column="{ field: 'name' }"
|
|
226
|
+
:header-config="{
|
|
227
|
+
import: true,
|
|
228
|
+
export: true,
|
|
229
|
+
custom: true,
|
|
230
|
+
resetCustom: true,
|
|
231
|
+
save: true,
|
|
232
|
+
lineHeight: true,
|
|
233
|
+
feedback: true,
|
|
234
|
+
chart: true,
|
|
235
|
+
fullscreen: true,
|
|
236
|
+
print: true,
|
|
237
|
+
lock: true,
|
|
238
|
+
unlock: true
|
|
239
|
+
}"
|
|
240
|
+
:on-export="handleExport"
|
|
241
|
+
:on-individual="handleSaveIndividual"
|
|
242
|
+
:on-all="handleSaveAll"
|
|
243
|
+
/>
|
|
244
|
+
</template>
|
|
245
|
+
</vxe-column>
|
|
246
|
+
<vxe-column field="sex" title="性别" width="80" />
|
|
247
|
+
<vxe-column field="age" title="年龄" width="80" />
|
|
248
|
+
</VxeTablePro>
|
|
249
|
+
</template>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## 数据持久化
|
|
253
|
+
|
|
254
|
+
组件会自动将以下配置保存到 `localStorage`:
|
|
255
|
+
|
|
256
|
+
- **基础配置**:存储在 `tableId` 键下,包含边框、行高、斑马纹、尺寸等
|
|
257
|
+
- **列配置**:存储在 `VXE_CUSTOM_STORE` 键下,包含列宽、排序、显示状态、固定列等
|
|
258
|
+
|
|
259
|
+
### 读取配置
|
|
260
|
+
|
|
261
|
+
```javascript
|
|
262
|
+
// 读取基础配置
|
|
263
|
+
const basicConfig = JSON.parse(localStorage.getItem(tableId))
|
|
264
|
+
|
|
265
|
+
// 读取列配置
|
|
266
|
+
const customStorageKey = 'VXE_CUSTOM_STORE'
|
|
267
|
+
const storage = JSON.parse(localStorage.getItem(customStorageKey))
|
|
268
|
+
const columnConfig = storage[tableId]
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
## 注意事项
|
|
272
|
+
|
|
273
|
+
1. **tableRef 必需**:组件需要 `tableRef` 才能正常工作,确保传入正确的 VxeTablePro 实例
|
|
274
|
+
2. **列配置对象**:使用锁定/解锁功能时,需要传入 `column` 对象,包含 `field` 属性
|
|
275
|
+
3. **表格 ID**:确保 VxeTablePro 设置了 `id` 属性,用于数据持久化
|
|
276
|
+
4. **回调函数**:所有回调函数都是可选的,未提供时会使用默认行为
|
|
277
|
+
|
|
278
|
+
## 与 VxeTablePro 集成
|
|
279
|
+
|
|
280
|
+
HeaderDropdown 组件设计用于与 VxeTablePro 配合使用:
|
|
281
|
+
|
|
282
|
+
```vue
|
|
283
|
+
<template>
|
|
284
|
+
<VxeTablePro ref="tableRef" id="my-table" :data="data">
|
|
285
|
+
<vxe-column field="name" title="姓名">
|
|
286
|
+
<template #header>
|
|
287
|
+
<HeaderDropdown :table-ref="tableRef" :header-config="{ export: true }" />
|
|
288
|
+
</template>
|
|
289
|
+
</vxe-column>
|
|
290
|
+
</VxeTablePro>
|
|
291
|
+
</template>
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
通过 `tableRef` 可以访问 VxeTablePro 的所有方法,包括:
|
|
295
|
+
- `exportData()` - 导出数据
|
|
296
|
+
- `openImport()` - 打开导入
|
|
297
|
+
- `toggleFullscreen()` - 切换全屏
|
|
298
|
+
- `vxeTableProRef` - 底层 vxe-table 实例
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
> 组件打包采用 `rollup.config.js`,产物位于 `dist/HeaderDropdown` 目录,按需引入即可。
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"../components/HeaderDropdown/index.vue/index.js";export{default}from"../components/HeaderDropdown/index.vue/index2.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}export{e as getDefaultExportFromCjs};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r={};export{r as __exports};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r={};export{r as __exports};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r={};export{r as __exports};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r={};export{r as __exports};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r={};export{r as __exports};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e={exports:{}};export{e as __module};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getDefaultExportFromCjs as s}from"../_commonjsHelpers/index.js";import{__require as o}from"../../node_modules/postcss/lib/postcss/index2.js";var e=s(o());export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r={};export{r as __exports};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r={};export{r as __exports};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r={};export{r as __exports};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r={};export{r as __exports};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r={};export{r as __exports};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r={};export{r as __exports};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r={};export{r as __exports};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ref as e,watch as t,onMounted as a,nextTick as n,onBeforeUnmount as l}from"vue";import{gantt as d}from"dhtmlx-gantt";var r={name:"DhtmlxGanttPro",props:{width:{type:[String,Number],default:"100%"},height:{type:[String,Number],default:"500px"},data:{type:Array,default:()=>[]},links:{type:Array,default:()=>[]},config:{type:Object,default:()=>({})},readonly:{type:Boolean,default:!1},locale:{type:String,default:"cn"},theme:{type:String,default:"default"}},emits:["task-click","task-dblclick","task-change","task-add","task-delete","data-loaded","data-error","view-change","scale-change"],setup(r,{emit:s}){const o=e(null);let c=!1;const i=()=>({date_format:"%Y-%m-%d",scale_unit:"day",date_scale:"%m/%d",subscales:[{unit:"month",step:1,date:"%Y年%m月"}],columns:[{name:"text",label:"任务名称",width:150,tree:!0},{name:"start_date",label:"开始时间",width:80},{name:"duration",label:"工期",width:60},{name:"progress",label:"进度",width:60}],...r.config}),k=async()=>{if(!c&&o.value)try{o.value.innerHTML="";const e=i();Object.assign(d.config,e),"cn"===r.locale&&Object.assign(d.locale,"cn"===r.locale?{date:{month_full:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],month_short:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],day_full:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],day_short:["日","一","二","三","四","五","六"]},labels:{new_task:"新任务",icon_save:"保存",icon_cancel:"取消",icon_details:"详细信息",icon_edit:"编辑",icon_delete:"删除",confirm_closing:"",confirm_deleting:"确定删除任务吗?",section_description:"描述",section_time:"时间段",section_type:"类型"}}:{}),r.readonly&&(d.config.readonly=!0),h(),await n(),d.init(o.value),c=!0,r.data.length>0&&f(),s("data-loaded",{data:r.data,links:r.links})}catch(e){console.error("DhtmlxGanttPro 初始化失败:",e),s("data-error",e)}},h=()=>{d.attachEvent("onTaskClick",((e,t)=>{const a=d.getTask(e);return s("task-click",{task:a,event:t}),!0})),d.attachEvent("onTaskDblClick",((e,t)=>{const a=d.getTask(e);return s("task-dblclick",{task:a,event:t}),!r.readonly})),d.attachEvent("onAfterTaskUpdate",((e,t)=>{s("task-change",{id:e,task:t})})),d.attachEvent("onAfterTaskAdd",((e,t)=>{s("task-add",{id:e,task:t})})),d.attachEvent("onAfterTaskDelete",(e=>{s("task-delete",{id:e})})),d.attachEvent("onViewChange",(e=>{s("view-change",{mode:e})})),d.attachEvent("onScaleConfigChange",(()=>{s("scale-change")}))},f=()=>{if(c)try{d.clearAll(),d.parse({data:r.data,links:r.links})}catch(e){console.error("DhtmlxGanttPro 数据加载失败:",e),s("data-error",e)}};t((()=>r.readonly),(e=>{c&&(d.config.readonly=e,d.render())})),a((()=>{n((()=>{k()}))})),l((()=>{o.value&&(o.value.innerHTML=""),c=!1}));return{ganttContainer:o,...{getGanttInstance:()=>d,refresh:()=>{if(c){const e=i();Object.assign(d.config,e),f(),d.render()}},getSelectedTask:()=>d.getSelectedTask(),addTask:e=>{if(c&&!r.readonly)return d.addTask(e)},updateTask:(e,t)=>{if(c&&!r.readonly)return d.updateTask(e,t)},deleteTask:e=>{if(c&&!r.readonly)return d.deleteTask(e)},fitToTask:()=>{c&&d.showTask(d.getTaskByIndex(0).id)}}}}};export{r as default};
|
|
1
|
+
import{ref as e,watch as t,onMounted as a,nextTick as n,onBeforeUnmount as l}from"vue";import{gantt as d}from"dhtmlx-gantt";var r={name:"DhtmlxGanttPro",props:{width:{type:[String,Number],default:"100%"},height:{type:[String,Number],default:"500px"},data:{type:Array,default:()=>[]},links:{type:Array,default:()=>[]},config:{type:Object,default:()=>({})},readonly:{type:Boolean,default:!1},locale:{type:String,default:"cn"},theme:{type:String,default:"default"}},emits:["task-click","task-dblclick","task-change","task-add","task-delete","data-loaded","data-error","view-change","scale-change"],setup(r,{emit:s}){const o=e(null);let c=!1;const i=()=>({date_format:"%Y-%m-%d",scale_unit:"day",date_scale:"%m/%d",subscales:[{unit:"month",step:1,date:"%Y年%m月"}],columns:[{name:"text",label:"任务名称",width:150,tree:!0},{name:"start_date",label:"开始时间",width:80},{name:"duration",label:"工期",width:60},{name:"progress",label:"进度",width:60}],...r.config}),k=async()=>{if(!c&&o.value)try{o.value.innerHTML="";const e=i();Object.assign(d.config,e),"cn"===r.locale&&Object.assign(d.locale,"cn"===r.locale?{date:{month_full:["一月","二月","三月","四月","五月","六月","七月","八月","九月","十月","十一月","十二月"],month_short:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],day_full:["星期日","星期一","星期二","星期三","星期四","星期五","星期六"],day_short:["日","一","二","三","四","五","六"]},labels:{new_task:"新任务",icon_save:"保存",icon_cancel:"取消",icon_details:"详细信息",icon_edit:"编辑",icon_delete:"删除",confirm_closing:"",confirm_deleting:"确定删除任务吗?",section_description:"描述",section_time:"时间段",section_type:"类型"}}:{}),r.readonly&&(d.config.readonly=!0),h(),await n(),d.init(o.value),c=!0,r.data.length>0&&f(),s("data-loaded",{data:r.data,links:r.links})}catch(e){console.error("DhtmlxGanttPro 初始化失败:",e),s("data-error",e)}},h=()=>{d.attachEvent("onTaskClick",((e,t)=>{const a=d.getTask(e);return s("task-click",{task:a,event:t}),!0})),d.attachEvent("onTaskDblClick",((e,t)=>{const a=d.getTask(e);return s("task-dblclick",{task:a,event:t}),!r.readonly})),d.attachEvent("onAfterTaskUpdate",((e,t)=>{s("task-change",{id:e,task:t})})),d.attachEvent("onAfterTaskAdd",((e,t)=>{s("task-add",{id:e,task:t})})),d.attachEvent("onAfterTaskDelete",(e=>{s("task-delete",{id:e})})),d.attachEvent("onViewChange",(e=>{s("view-change",{mode:e})})),d.attachEvent("onScaleConfigChange",(()=>{s("scale-change")}))},f=()=>{if(c)try{d.clearAll(),d.parse({data:r.data,links:r.links})}catch(e){console.error("DhtmlxGanttPro 数据加载失败:",e),s("data-error",e)}};t((()=>r.readonly),(e=>{c&&(d.config.readonly=e,d.render())})),a((()=>{n((()=>{k()}))})),l((()=>{o.value&&(o.value.innerHTML=""),c=!1}));return{ganttContainer:o,...{getGanttInstance:()=>d,refresh:()=>{if(c){const e=i();Object.assign(d.config,e),f(),d.render()}},reloadData:()=>{c&&f()},getSelectedTask:()=>d.getSelectedTask(),addTask:e=>{if(c&&!r.readonly)return d.addTask(e)},updateTask:(e,t)=>{if(c&&!r.readonly)return d.updateTask(e,t)},deleteTask:e=>{if(c&&!r.readonly)return d.deleteTask(e)},fitToTask:()=>{c&&d.showTask(d.getTaskByIndex(0).id)}}}}};export{r as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createElementBlock as t,openBlock as n,
|
|
1
|
+
import{createElementBlock as t,openBlock as n,createCommentVNode as i,createElementVNode as e,normalizeStyle as h}from"vue";const r={class:"dhtmlx-gantt-pro"};function o(o,a,g,l,s,c){return n(),t("div",r,[i(" {{ height }} "),e("div",{ref:"ganttContainer",style:h({width:g.width,height:g.height}),class:"gantt-container"},null,4)])}export{o as render};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./index2.js";e.__scopeId="data-v-6680c8f1",e.__file="src/components/HeaderDropdown/index.vue";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{ref as e,computed as a,onMounted as t,resolveComponent as l,createElementBlock as o,openBlock as n,createElementVNode as r,toDisplayString as i,createVNode as s,withCtx as d,createCommentVNode as m,createBlock as f,createTextVNode as c,withModifiers as u}from"vue";const p={class:"header-dropdown"},b={style:{display:"inline-block"}},y={style:{display:"flex"}},v={style:{display:"flex"}},g={style:{display:"flex"}},x={style:{display:"flex"}},R={style:{display:"flex"}},h={style:{display:"flex"}},k={style:{display:"flex"}},C={style:{display:"flex"}},_={class:"menu-trigger-wrapper"},w={style:{display:"flex"}},S={class:"menu-trigger-wrapper"},B={style:{display:"flex"}},z={class:"menu-trigger-wrapper"},D={style:{display:"flex"}},P={style:{display:"flex"}},T={style:{display:"flex"}},F={style:{display:"flex"}},I={style:{display:"flex"}},E={style:{display:"flex"}};var N={__name:"index",props:{onImport:Function,onExport:Function,onAsc:Function,onDesc:Function,onFullscreen:Function,onPrint:Function,onCustom:Function,onAll:Function,onIndividual:Function,refreshCustom:Function,searchCustom:Function,tableRef:{type:Object,default:null},title:{type:String,default:null},column:{type:Object,default:null},headerConfig:{type:Object,import:{type:Boolean,default:!1},export:{type:Boolean,default:!1},lineHeight:{type:Boolean,default:!1},custom:{type:Boolean,default:!1},resetCustom:{type:Boolean,default:!1},save:{type:Boolean,default:!1},feedback:{type:Boolean,default:!1},chart:{type:Boolean,default:!1},fullscreen:{type:Boolean,default:!1},print:{type:Boolean,default:!1},lock:{type:Boolean,default:!1},unlock:{type:Boolean,default:!1}}},setup(N){const O=N,V=e(!1),H=e(36),A=e(!1),J=e(!0),L=e("mini");e(null),a((()=>!!O.onExport||!!O.tableRef));const j=e=>{O.tableRef?.toolbarRef?(O.tableRef.vxeTableProRef.resetCustom(e),localStorage.setItem(O.tableRef.vxeTableProRef.id,JSON.stringify({border:!0,lineHeight:36,stripe:!1,cellStyle:"mini"})),le()):console.warn("无法导出:缺少 tableRef 或 exportData 方法")},M=()=>{const e=document.getElementsByClassName("dropdown-trigger-icon"),a=document.getElementsByClassName("dropdownRight");e[0].style.opacity=1,a[0].style.borderLeft="1px solid #ddd"},U=()=>{if(0==V.value){const e=document.getElementsByClassName("dropdown-trigger-icon"),a=document.getElementsByClassName("dropdownRight");e[0].style.opacity=0,a[0].style.borderLeft="0px solid #ddd"}},q=e=>{V.value=e;const a=document.getElementsByClassName("dropdown-trigger-icon"),t=document.getElementsByClassName("dropdownRight");1==e?(a[0].style.opacity=1,t[0].style.borderLeft="1px solid #ddd"):(a[0].style.opacity=0,t[0].style.borderLeft="0px solid #ddd")},G=e(null),K=(e,a)=>{switch(e){case"import":O.onImport?O.onImport():O.tableRef?.openImport?O.tableRef.openImport():console.warn("无法导出:缺少 tableRef 或 exportData 方法");break;case"export":O.onExport?O.onExport():O.tableRef?.exportData?O.tableRef.exportData({filename:"表格数据",sheetName:"Sheet1",type:"csv"}):(console.warn("无法导出:缺少 tableRef 或 exportData 方法"),ElMessage?.warning?.("导出失败:表格实例不可用"));break;case"asc":O.onAsc?.();break;case"desc":O.onDesc?.();break;case"fullscreen":O.tableRef?O.tableRef.toggleFullscreen():console.warn("无法导出:缺少 tableRef 或 exportData 方法");break;case"print":O.onPrint?O.onPrint():O.tableRef?.toolbarRef?O.tableRef.vxeTableProRef.resetCustom():console.warn("无法导出:缺少 tableRef 或 exportData 方法");break;case"custom":O.onCustom?O.onCustom():(e=>{O.tableRef?.toolbarRef?O.tableRef.vxeTableProRef.customOpenEvent(e):console.warn("无法导出:缺少 tableRef 或 exportData 方法")})(a);break;case"resetCustom":j(!0);break;case"save":break;case"lineHeight":G.value?.handleOpen();break;case"refreshCustom":O.refreshCustom?O.refreshCustom(O.tableRef.vxeTableProRef.id):j(!0);break;case"searchCustom":O.searchCustom&&O.searchCustom();break;case"lock":O.tableRef.vxeTableProRef.setColumnFixed(O.column.field,"left");break;case"unlock":O.tableRef.vxeTableProRef.clearColumnFixed(O.column.field)}},Q=(e,a)=>{switch(e){case"cellStyle":ee();break;case"stripeStyle":te();break;case"smallStyle":W();break;case"mediumStyle":X();break;case"miniStyle":Y();break;case"largeStyle":Z();break;case"local":defaultlocal();break;case"individual":let e=O.tableRef.vxeTableProRef.getCustomStoreData();var t=JSON.parse(localStorage.getItem(O.tableRef.vxeTableProRef.id));e.basicConfig=t,O.onIndividual?.(O.tableRef.vxeTableProRef.id,e);break;case"all":let a=O.tableRef.vxeTableProRef.getCustomStoreData();var l=JSON.parse(localStorage.getItem(O.tableRef.vxeTableProRef.id));a.basicConfig=l,O.onAll?.(O.tableRef.vxeTableProRef.id,a)}},W=e=>{O.tableRef?(L.value="small",ae(),O.tableRef.sizeBool("small")):console.warn("无法导出:缺少 tableRef 或 exportData 方法")},X=e=>{O.tableRef?(L.value="medium",ae(),O.tableRef.sizeBool("medium")):console.warn("无法导出:缺少 tableRef 或 exportData 方法")},Y=e=>{O.tableRef?(L.value="mini",ae(),O.tableRef.sizeBool("mini")):console.warn("无法导出:缺少 tableRef 或 exportData 方法")},Z=e=>{O.tableRef?(O.tableRef.sizeBool("default"),L.value="default",ae()):console.warn("无法导出:缺少 tableRef 或 exportData 方法")},$=e=>{O.tableRef?(O.tableRef.changelineHeight(e),ae()):console.warn("无法导出:缺少 tableRef 或 exportData 方法")},ee=e=>{O.tableRef?setTimeout((()=>{O.tableRef.borderBool(J.value),ae()}),500):console.warn("无法导出:缺少 tableRef 或 exportData 方法")},ae=()=>{localStorage.setItem(O.tableRef.vxeTableProRef.id,JSON.stringify({border:J.value,lineHeight:H.value,stripe:A.value,cellStyle:L.value}))},te=e=>{O.tableRef?setTimeout((()=>{O.tableRef.scriptBool(A.value),ae()}),500):console.warn("无法导出:缺少 tableRef 或 exportData 方法")},le=()=>{try{if(localStorage.getItem(O.tableRef.vxeTableProRef.id)){var e=JSON.parse(localStorage.getItem(O.tableRef.vxeTableProRef.id));setTimeout((()=>{J.value=e?.border,A.value=e.stripe,L.value=e.cellStyle||"default",H.value=e.lineHeight||36,O.tableRef.scriptBool(A.value),O.tableRef.borderBool(J.value),O.tableRef.changelineHeight(H.value),O.tableRef.sizeBool(L.value)}),100)}}catch(e){}};return t((()=>{le()})),(e,a)=>{const t=l("vxe-icon"),V=l("el-dropdown-item"),L=l("el-input-number"),j=l("el-dropdown-menu"),W=l("el-dropdown"),X=l("el-checkbox");return n(),o("div",p,[r("span",b,i(N.title),1),r("div",{class:"dropdownRight",onMouseleave:U,onMouseenter:M},[s(W,{ref_key:"dropdown",ref:G,trigger:"click",onCommand:K,onVisibleChange:q},{dropdown:d((()=>[s(j,null,{default:d((()=>[m(" 导入 "),O.headerConfig.import?(n(),f(V,{key:0,command:"import"},{default:d((()=>[r("div",y,[s(t,{name:"upload",size:"16"}),a[12]||(a[12]=r("div",{style:{"margin-top":"-3px"}},"导入",-1))])])),_:1})):m("v-if",!0),m(" 导出 "),O.headerConfig.export?(n(),f(V,{key:1,command:"export"},{default:d((()=>[r("div",v,[s(t,{name:"download",size:"16"}),a[13]||(a[13]=r("div",{style:{"margin-top":"-3px"}},"导出",-1))])])),_:1})):m("v-if",!0),m(" 正序 "),O.onAsc?(n(),f(V,{key:2,command:"asc"},{default:d((()=>[r("div",g,[s(t,{name:"sort-alpha-asc",size:"16"}),a[14]||(a[14]=r("div",{style:{"margin-top":"-3px"}},"正序(接口)",-1))])])),_:1})):m("v-if",!0),m(" 倒序 "),O.onDesc?(n(),f(V,{key:3,command:"desc"},{default:d((()=>[r("div",x,[s(t,{name:"sort-alpha-desc",size:"16"}),a[15]||(a[15]=r("div",{style:{"margin-top":"-3px"}},"倒序(接口)",-1))])])),_:1})):m("v-if",!0),O.headerConfig.lineHeight?(n(),f(V,{key:4,command:"lineHeight"},{default:d((()=>[r("div",R,[s(t,{name:"number",size:"16",style:{"margin-top":"7px"}}),r("div",null,[a[16]||(a[16]=c("行高: ")),s(L,{modelValue:H.value,"onUpdate:modelValue":a[0]||(a[0]=e=>H.value=e),min:1,max:200,style:{width:"100px"},"controls-position":"right",onChange:$},null,8,["modelValue"])])])])),_:1})):m("v-if",!0),O.headerConfig.custom?(n(),f(V,{key:5,command:"custom",onClick:a[1]||(a[1]=e=>K("custom",e))},{default:d((()=>[r("div",h,[s(t,{name:"setting",size:"16"}),a[17]||(a[17]=r("div",{style:{"margin-top":"-3px"}},"列设置",-1))])])),_:1})):m("v-if",!0),O.headerConfig.resetCustom?(n(),f(V,{key:6,command:"resetCustom",onClick:a[2]||(a[2]=e=>K("resetCustom",e))},{default:d((()=>[r("div",k,[s(t,{name:"repeat",size:"16"}),a[18]||(a[18]=r("div",{style:{"margin-top":"-3px"}},"重置列",-1))])])),_:1})):m("v-if",!0),O.headerConfig.save?(n(),f(V,{key:7,command:"save",onClick:a[4]||(a[4]=e=>K("save",e))},{default:d((()=>[r("div",C,[s(t,{name:"save",size:"16"}),a[19]||(a[19]=r("div",{style:{"margin-top":"-3px",width:"100px","margin-right":"35px"}},"保存布局",-1))]),s(W,{placement:"right-start","fallback-placements":["bottom-start"],onCommand:Q,trigger:"hover",onClick:a[3]||(a[3]=u((()=>{}),["stop"]))},{dropdown:d((()=>[s(j,{class:"style-sub-menu"},{default:d((()=>[O.onIndividual?(n(),f(V,{key:0,command:"individual"},{default:d((()=>a[20]||(a[20]=[c("保存个人")]))),_:1,__:[20]})):m("v-if",!0),O.onAll?(n(),f(V,{key:1,command:"all"},{default:d((()=>a[21]||(a[21]=[c("保存所有")]))),_:1,__:[21]})):m("v-if",!0)])),_:1})])),default:d((()=>[r("div",_,[s(t,{name:"caret-right"})])])),_:1})])),_:1})):m("v-if",!0),O.headerConfig.feedback?(n(),f(V,{key:8,command:"feedback"},{default:d((()=>[r("div",w,[s(t,{name:"feedback",size:"16"}),a[22]||(a[22]=r("div",{style:{"margin-top":"-3px",width:"100px","margin-right":"35px"}},"样式",-1))]),s(W,{placement:"right-start","fallback-placements":["bottom-start"],onCommand:Q,trigger:"hover",onClick:a[7]||(a[7]=u((()=>{}),["stop"]))},{dropdown:d((()=>[s(j,{class:"style-sub-menu"},{default:d((()=>[s(V,{command:"stripeStyle"},{default:d((()=>[s(X,{modelValue:A.value,"onUpdate:modelValue":a[5]||(a[5]=e=>A.value=e)},{default:d((()=>a[23]||(a[23]=[c("启用斑马纹")]))),_:1,__:[23]},8,["modelValue"])])),_:1}),s(V,{command:"cellStyle"},{default:d((()=>[s(X,{modelValue:J.value,"onUpdate:modelValue":a[6]||(a[6]=e=>J.value=e)},{default:d((()=>a[24]||(a[24]=[c("启用边框")]))),_:1,__:[24]},8,["modelValue"])])),_:1})])),_:1})])),default:d((()=>[r("div",S,[s(t,{name:"caret-right"})])])),_:1})])),_:1})):m("v-if",!0),O.headerConfig.chart?(n(),f(V,{key:9,command:"chart"},{default:d((()=>[r("div",B,[s(t,{name:"chart-bar-x",size:"16"}),a[25]||(a[25]=r("div",{style:{"margin-top":"-3px",width:"100px","margin-right":"35px"}},"排版",-1))]),s(W,{placement:"right-start","fallback-placements":["bottom-start"],onCommand:Q,trigger:"hover",onClick:a[8]||(a[8]=u((()=>{}),["stop"]))},{dropdown:d((()=>[s(j,{class:"style-sub-menu"},{default:d((()=>[s(V,{command:"largeStyle"},{default:d((()=>a[26]||(a[26]=[c("默认")]))),_:1,__:[26]}),s(V,{command:"mediumStyle"},{default:d((()=>a[27]||(a[27]=[c("中")]))),_:1,__:[27]}),s(V,{command:"smallStyle"},{default:d((()=>a[28]||(a[28]=[c("小")]))),_:1,__:[28]}),s(V,{command:"miniStyle"},{default:d((()=>a[29]||(a[29]=[c("迷你")]))),_:1,__:[29]})])),_:1})])),default:d((()=>[r("div",z,[s(t,{name:"caret-right"})])])),_:1})])),_:1})):m("v-if",!0),O.refreshCustom?(n(),f(V,{key:10,command:"refreshCustom",onClick:a[9]||(a[9]=e=>K("refreshCustom",e))},{default:d((()=>[r("div",D,[s(t,{name:"refresh",size:"16"}),a[30]||(a[30]=r("div",{style:{"margin-top":"-3px"}},"更新布局",-1))])])),_:1})):m("v-if",!0),O.searchCustom?(n(),f(V,{key:11,command:"searchCustom"},{default:d((()=>[r("div",P,[s(t,{name:"repeat",size:"16"}),a[31]||(a[31]=r("div",{style:{"margin-top":"-3px"}},"刷新",-1))])])),_:1})):m("v-if",!0),m(" 全屏 "),O.headerConfig.fullscreen?(n(),f(V,{key:12,command:"fullscreen"},{default:d((()=>[r("div",T,[s(t,{name:"zoom-out",size:"16"}),a[32]||(a[32]=r("div",{style:{"margin-top":"-3px"}},"全屏",-1))])])),_:1})):m("v-if",!0),m(" 打印 "),O.headerConfig.print?(n(),f(V,{key:13,command:"print"},{default:d((()=>[r("div",F,[s(t,{name:"print",size:"16"}),a[33]||(a[33]=r("div",{style:{"margin-top":"-3px"}},"打印",-1))])])),_:1})):m("v-if",!0),O.headerConfig.lock?(n(),f(V,{key:14,command:"lock",onClick:a[10]||(a[10]=e=>K("lock",e))},{default:d((()=>[r("div",I,[s(t,{name:"lock",size:"16"}),a[34]||(a[34]=r("div",{style:{"margin-top":"-3px"}},"锁定",-1))])])),_:1})):m("v-if",!0),O.headerConfig.unlock?(n(),f(V,{key:15,command:"unlock",onClick:a[11]||(a[11]=e=>K("unlock",e))},{default:d((()=>[r("div",E,[s(t,{name:"unlock",size:"16"}),a[35]||(a[35]=r("div",{style:{"margin-top":"-3px"}},"解锁",-1))])])),_:1})):m("v-if",!0)])),_:1})])),default:d((()=>[s(t,{class:"dropdown-trigger-icon",tabindex:"-1",style:{"margin-top":"4px"},name:"caret-down"})])),_:1},512)],32)])}}};export{N as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import e from"./index2.js";e.__scopeId="data-v-75fa2cee",e.__file="src/components/HeaderDropdown.vue";export{e as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{computed as e,resolveComponent as o,createElementBlock as t,openBlock as n,createTextVNode as a,createVNode as l,toDisplayString as r,withCtx as c,withModifiers as s,createCommentVNode as u,createBlock as d}from"vue";import"../../node_modules/postcss/lib/postcss/index.js";const p={class:"header-dropdown"};var m={__name:"HeaderDropdown",props:{onImport:Function,onExport:Function,onAsc:Function,onDesc:Function,onFullscreen:Function,onPrint:Function,onCustom:Function,tableRef:{type:Object,default:null},title:{type:String,default:null}},setup(m){const f=m,i=e((()=>!!f.onExport||!!f.tableRef)),b=(e,o)=>{switch(e){case"import":f.onImport?.();break;case"export":f.onExport?f.onExport():f.tableRef?.exportData?f.tableRef.exportData({filename:"表格数据",sheetName:"Sheet1",type:"csv"}):(console.warn("无法导出:缺少 tableRef 或 exportData 方法"),ElMessage?.warning?.("导出失败:表格实例不可用"));break;case"asc":f.onAsc?.();break;case"desc":f.onDesc?.();break;case"fullscreen":f.onFullscreen?f.onFullscreen():f.tableRef?f.tableRef.toggleFullscreen():console.warn("无法导出:缺少 tableRef 或 exportData 方法");break;case"print":f.onPrint?f.onPrint():f.tableRef?.toolbarRef?f.tableRef.vxeTableProRef.openPrint():console.warn("无法导出:缺少 tableRef 或 exportData 方法");break;case"custom":f.onCustom?f.onCustom():(e=>{f.tableRef?.toolbarRef?f.tableRef.vxeTableProRef.customOpenEvent(e):console.warn("无法导出:缺少 tableRef 或 exportData 方法")})(o)}};return(e,_)=>{const x=o("vxe-icon"),R=o("el-dropdown-item"),v=o("el-dropdown-menu"),w=o("el-dropdown");return n(),t("div",p,[a(r(m.title)+" ",1),l(w,{onCommand:b},{dropdown:c((()=>[l(v,null,{default:c((()=>[u(" 导入 "),f.onImport?(n(),d(R,{key:0,command:"import"},{default:c((()=>_[2]||(_[2]=[a(" 导入 ")]))),_:1,__:[2]})):u("v-if",!0),u(" 导出 "),i.value?(n(),d(R,{key:1,command:"export"},{default:c((()=>_[3]||(_[3]=[a(" 导出 ")]))),_:1,__:[3]})):u("v-if",!0),u(" 正序 "),f.onAsc?(n(),d(R,{key:2,command:"asc"},{default:c((()=>_[4]||(_[4]=[a(" 正序 ")]))),_:1,__:[4]})):u("v-if",!0),u(" 倒序 "),f.onDesc?(n(),d(R,{key:3,command:"desc"},{default:c((()=>_[5]||(_[5]=[a(" 倒序 ")]))),_:1,__:[5]})):u("v-if",!0),l(R,{command:"custom",onClick:_[1]||(_[1]=e=>b("custom",e))},{default:c((()=>_[6]||(_[6]=[a(" 列设置 ")]))),_:1,__:[6]}),u(" 全屏 "),l(R,{command:"fullscreen"},{default:c((()=>_[7]||(_[7]=[a(" 全屏 ")]))),_:1,__:[7]}),u(" 打印 "),l(R,{command:"print"},{default:c((()=>_[8]||(_[8]=[a(" 打印 ")]))),_:1,__:[8]})])),_:1})])),default:c((()=>[l(x,{onMousedown:_[0]||(_[0]=s((()=>{}),["prevent"])),style:{"margin-top":"4px"},name:"caret-down"})])),_:1})])}}};export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ref as e,reactive as t,useAttrs as o,computed as l,onMounted as n,nextTick as r,resolveComponent as s,createElementBlock as u,openBlock as c,createCommentVNode as a,createBlock as i,createVNode as m,mergeProps as v,toHandlers as f,createSlots as d,renderList as g,withCtx as p,renderSlot as b,normalizeProps as x,guardReactiveProps as h}from"vue";const E={id:"VxeTablePro"};var F={__name:"index",props:{},setup(F,{expose:k}){const y={};e("");const _=e(!0),w=e(null),R=t({storage:_.value,mode:"default"}),S=o(),I=e(!1),T=e(!0),q=e("mini"),z=l((()=>{const e={...y};return Object.keys(S).forEach((t=>{t.startsWith("on")||(e[t]=S[t])})),e})),O=l((()=>{const e={};return Object.keys(S).forEach((t=>{t.startsWith("on")&&(e[t]=S[t])})),e})),P=l((()=>!1!==S.toolbar)),B=l((()=>({custom:!1,print:!1,export:!1,import:!1,zoom:!1,refresh:!1,...S["toolbar-config"]}))),L=l((()=>!1!==P.value)),V=l((()=>S["refresh-options"]||null)),C=e(null),J=e(null);n((async()=>{await r();const e=C.value,t=J.value?.getInstance?.()||J.value;e&&t&&(e.connect?.(t),console.log("[VxeTablePro] 已连接工具栏"))}));const N=()=>{const e=!!(document.fullscreenElement||document.webkitFullscreenElement||document.msFullscreenElement);console.log("全屏状态:",e?"是":"否")};return document.addEventListener("fullscreenchange",N),document.addEventListener("webkitfullscreenchange",N),document.addEventListener("msfullscreenchange",N),k({Instance:function(){return C.value},vxeTableProRef:C,toolbarRef:J,toggleFullscreen:()=>{const e=document.getElementById(C.value.id);if(console.log(e),!e)return void console.warn("未找到 id 为 VxeTablePro 的元素");document.fullscreenElement||document.webkitFullscreenElement||document.msFullscreenElement?document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen():e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.msRequestFullscreen&&e.msRequestFullscreen()},scriptBool:e=>{I.value=e},sizeBool:e=>{q.value=e},borderBool:e=>{T.value=e},changelineHeight:e=>{w.value=e},saveToLocalStorage:(e,t)=>{try{const o="VXE_CUSTOM_STORE",l=localStorage.getItem(o);let n={};if(l)try{n=JSON.parse(l);n._v}catch(e){n={_v:1}}else n={_v:1};n[e]=t,localStorage.setItem(o,JSON.stringify(n)),t.basicConfig&&localStorage.setItem(e,JSON.stringify(t.basicConfig)),location.reload()}catch(e){console.error("保存失败:",e)}},exportData(e){C.value?.exportData?.(e)},openImport(e){C.value?.openImport?.(e)}}),(e,t)=>{const o=s("vxe-toolbar"),l=s("vxe-table");return c(),u("div",E,[a(" 内置工具栏:原样透传所有配置 "),L.value?(c(),i(o,{key:0,ref_key:"toolbarRef",ref:J,custom:!!B.value.custom,print:!!B.value.print,export:!!B.value.export,import:!!B.value.import,zoom:!!B.value.zoom,refresh:!!B.value.refresh&&{query:V.value}},null,8,["custom","print","export","import","zoom","refresh"])):a("v-if",!0),a(" 主表格 "),m(l,v({stripe:I.value,size:q.value,border:T.value,storage:_.value},z.value,f(O.value),{ref_key:"vxeTableProRef",ref:C,"cell-config":{height:w.value},"custom-config":R}),d({_:2},[g(e.$slots,((t,o)=>({name:o,fn:p((t=>[b(e.$slots,o,x(h(t)))]))})))]),1040,["stripe","size","border","storage","cell-config","custom-config"])])}}};export{F as default};
|
package/dist/index/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"../components/HelloPlugin.vue/index.js";import"../components/HelloWorld.vue/index.js";import"../components/VxeGridPro/index.vue/index.js";import"../components/VxeTablePro/index.vue/index.js";import"../components/VxeModalPro/index.vue/index.js";import"../components/SearchPro/index.vue/index.js";import"../components/DhtmlxGanttPro/index.vue/index.js";import o from"../components/HelloPlugin.vue/index2.js";import e from"../components/HelloWorld.vue/index2.js";import n from"../components/VxeGridPro/index.vue/index2.js";import r from"../components/VxeTablePro/index.vue/index2.js";import t from"../components/VxeModalPro/index.vue/index2.js";import i from"../components/SearchPro/index.vue/index2.js";import m from"../components/DhtmlxGanttPro/index.vue/index2.js";var
|
|
1
|
+
import"../components/HelloPlugin.vue/index.js";import"../components/HelloWorld.vue/index.js";import"../components/VxeGridPro/index.vue/index.js";import"../components/VxeTablePro/index.vue/index.js";import"../components/VxeModalPro/index.vue/index.js";import"../components/SearchPro/index.vue/index.js";import"../components/DhtmlxGanttPro/index.vue/index.js";import"../components/HeaderDropdown/index.vue/index.js";import o from"../components/HelloPlugin.vue/index2.js";import e from"../components/HelloWorld.vue/index2.js";import n from"../components/VxeGridPro/index.vue/index2.js";import r from"../components/VxeTablePro/index.vue/index2.js";import t from"../components/VxeModalPro/index.vue/index2.js";import i from"../components/SearchPro/index.vue/index2.js";import m from"../components/DhtmlxGanttPro/index.vue/index2.js";import d from"../components/HeaderDropdown/index.vue/index2.js";var p={install(p){p.component("HelloPlugin",o),p.component("HelloWorld",e),p.component("VxeGridPro",n),p.component("VxeTablePro",r),p.component("VxeModalPro",t),p.component("SearchPro",i),p.component("DhtmlxGanttPro",m),p.component("HeaderDropdown",d)}};export{m as DhtmlxGanttPro,d as HeaderDropdown,o as HelloPlugin,e as HelloWorld,i as SearchPro,n as VxeGridPro,t as VxeModalPro,r as VxeTablePro,p as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var r,t;function e(){if(t)return r;t=1;return r={nanoid:(r=21)=>{let t="",e=0|r;for(;e--;)t+="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict"[64*Math.random()|0];return t},customAlphabet:(r,t=21)=>(e=t)=>{let n="",a=0|e;for(;a--;)n+=r[Math.random()*r.length|0];return n}}}export{e as __require};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__module as m}from"../../../_virtual/picocolors/index.js";var e;function r(){if(e)return m.exports;e=1;let r=process||{},t=r.argv||[],g=r.env||{},i=!(g.NO_COLOR||t.includes("--no-color"))&&(!!g.FORCE_COLOR||t.includes("--color")||"win32"===r.platform||(r.stdout||{}).isTTY&&"dumb"!==g.TERM||!!g.CI),l=(m,e,r=m)=>t=>{let g=""+t,i=g.indexOf(e,m.length);return~i?m+n(g,e,r,i)+e:m+g+e},n=(m,e,r,t)=>{let g="",i=0;do{g+=m.substring(i,t)+r,i=t+e.length,t=m.indexOf(e,i)}while(~t);return g+m.substring(i)},o=(m=i)=>{let e=m?l:()=>String;return{isColorSupported:m,reset:e("[0m","[0m"),bold:e("[1m","[22m","[22m[1m"),dim:e("[2m","[22m","[22m[2m"),italic:e("[3m","[23m"),underline:e("[4m","[24m"),inverse:e("[7m","[27m"),hidden:e("[8m","[28m"),strikethrough:e("[9m","[29m"),black:e("[30m","[39m"),red:e("[31m","[39m"),green:e("[32m","[39m"),yellow:e("[33m","[39m"),blue:e("[34m","[39m"),magenta:e("[35m","[39m"),cyan:e("[36m","[39m"),white:e("[37m","[39m"),gray:e("[90m","[39m"),bgBlack:e("[40m","[49m"),bgRed:e("[41m","[49m"),bgGreen:e("[42m","[49m"),bgYellow:e("[43m","[49m"),bgBlue:e("[44m","[49m"),bgMagenta:e("[45m","[49m"),bgCyan:e("[46m","[49m"),bgWhite:e("[47m","[49m"),blackBright:e("[90m","[39m"),redBright:e("[91m","[39m"),greenBright:e("[92m","[39m"),yellowBright:e("[93m","[39m"),blueBright:e("[94m","[39m"),magentaBright:e("[95m","[39m"),cyanBright:e("[96m","[39m"),whiteBright:e("[97m","[39m"),bgBlackBright:e("[100m","[49m"),bgRedBright:e("[101m","[49m"),bgGreenBright:e("[102m","[49m"),bgYellowBright:e("[103m","[49m"),bgBlueBright:e("[104m","[49m"),bgMagentaBright:e("[105m","[49m"),bgCyanBright:e("[106m","[49m"),bgWhiteBright:e("[107m","[49m")}};return m.exports=o(),m.exports.createColors=o,m.exports}export{r as __require};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__require as e}from"../container/index.js";var r,t;function s(){if(t)return r;t=1;let s=e();class n extends s{constructor(e){super(e),this.type="atrule"}append(...e){return this.proxyOf.nodes||(this.nodes=[]),super.append(...e)}prepend(...e){return this.proxyOf.nodes||(this.nodes=[]),super.prepend(...e)}}return r=n,n.default=n,s.registerAtRule(n),r}export{s as __require};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__require as e}from"../node/index.js";var r,t;function n(){if(t)return r;t=1;let n=e();class s extends n{constructor(e){super(e),this.type="comment"}}return r=s,s.default=s,r}export{n as __require};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__require as e}from"../comment/index.js";import{__require as t}from"../declaration/index.js";import{__require as r}from"../node/index.js";import{__require as s}from"../symbols/index.js";var i,o;function n(){if(o)return i;o=1;let n,l,a,p,f=e(),h=t(),d=r(),{isClean:y,my:u}=s();function x(e){return e.map((e=>(e.nodes&&(e.nodes=x(e.nodes)),delete e.source,e)))}function c(e){if(e[y]=!1,e.proxyOf.nodes)for(let t of e.proxyOf.nodes)c(t)}class m extends d{get first(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}get last(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}append(...e){for(let t of e){let e=this.normalize(t,this.last);for(let t of e)this.proxyOf.nodes.push(t)}return this.markDirty(),this}cleanRaws(e){if(super.cleanRaws(e),this.nodes)for(let t of this.nodes)t.cleanRaws(e)}each(e){if(!this.proxyOf.nodes)return;let t,r,s=this.getIterator();for(;this.indexes[s]<this.proxyOf.nodes.length&&(t=this.indexes[s],r=e(this.proxyOf.nodes[t],t),!1!==r);)this.indexes[s]+=1;return delete this.indexes[s],r}every(e){return this.nodes.every(e)}getIterator(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;let e=this.lastEach;return this.indexes[e]=0,e}getProxyProcessor(){return{get:(e,t)=>"proxyOf"===t?e:e[t]?"each"===t||"string"==typeof t&&t.startsWith("walk")?(...r)=>e[t](...r.map((e=>"function"==typeof e?(t,r)=>e(t.toProxy(),r):e))):"every"===t||"some"===t?r=>e[t](((e,...t)=>r(e.toProxy(),...t))):"root"===t?()=>e.root().toProxy():"nodes"===t?e.nodes.map((e=>e.toProxy())):"first"===t||"last"===t?e[t].toProxy():e[t]:e[t],set:(e,t,r)=>(e[t]===r||(e[t]=r,"name"!==t&&"params"!==t&&"selector"!==t||e.markDirty()),!0)}}index(e){return"number"==typeof e?e:(e.proxyOf&&(e=e.proxyOf),this.proxyOf.nodes.indexOf(e))}insertAfter(e,t){let r,s=this.index(e),i=this.normalize(t,this.proxyOf.nodes[s]).reverse();s=this.index(e);for(let e of i)this.proxyOf.nodes.splice(s+1,0,e);for(let e in this.indexes)r=this.indexes[e],s<r&&(this.indexes[e]=r+i.length);return this.markDirty(),this}insertBefore(e,t){let r,s=this.index(e),i=0===s&&"prepend",o=this.normalize(t,this.proxyOf.nodes[s],i).reverse();s=this.index(e);for(let e of o)this.proxyOf.nodes.splice(s,0,e);for(let e in this.indexes)r=this.indexes[e],s<=r&&(this.indexes[e]=r+o.length);return this.markDirty(),this}normalize(e,t){if("string"==typeof e)e=x(l(e).nodes);else if(void 0===e)e=[];else if(Array.isArray(e)){e=e.slice(0);for(let t of e)t.parent&&t.parent.removeChild(t,"ignore")}else if("root"===e.type&&"document"!==this.type){e=e.nodes.slice(0);for(let t of e)t.parent&&t.parent.removeChild(t,"ignore")}else if(e.type)e=[e];else if(e.prop){if(void 0===e.value)throw new Error("Value field is missed in node creation");"string"!=typeof e.value&&(e.value=String(e.value)),e=[new h(e)]}else if(e.selector||e.selectors)e=[new p(e)];else if(e.name)e=[new n(e)];else{if(!e.text)throw new Error("Unknown node type in node creation");e=[new f(e)]}return e.map((e=>(e[u]||m.rebuild(e),(e=e.proxyOf).parent&&e.parent.removeChild(e),e[y]&&c(e),e.raws||(e.raws={}),void 0===e.raws.before&&t&&void 0!==t.raws.before&&(e.raws.before=t.raws.before.replace(/\S/g,"")),e.parent=this.proxyOf,e)))}prepend(...e){e=e.reverse();for(let t of e){let e=this.normalize(t,this.first,"prepend").reverse();for(let t of e)this.proxyOf.nodes.unshift(t);for(let t in this.indexes)this.indexes[t]=this.indexes[t]+e.length}return this.markDirty(),this}push(e){return e.parent=this,this.proxyOf.nodes.push(e),this}removeAll(){for(let e of this.proxyOf.nodes)e.parent=void 0;return this.proxyOf.nodes=[],this.markDirty(),this}removeChild(e){let t;e=this.index(e),this.proxyOf.nodes[e].parent=void 0,this.proxyOf.nodes.splice(e,1);for(let r in this.indexes)t=this.indexes[r],t>=e&&(this.indexes[r]=t-1);return this.markDirty(),this}replaceValues(e,t,r){return r||(r=t,t={}),this.walkDecls((s=>{t.props&&!t.props.includes(s.prop)||t.fast&&!s.value.includes(t.fast)||(s.value=s.value.replace(e,r))})),this.markDirty(),this}some(e){return this.nodes.some(e)}walk(e){return this.each(((t,r)=>{let s;try{s=e(t,r)}catch(e){throw t.addToError(e)}return!1!==s&&t.walk&&(s=t.walk(e)),s}))}walkAtRules(e,t){return t?e instanceof RegExp?this.walk(((r,s)=>{if("atrule"===r.type&&e.test(r.name))return t(r,s)})):this.walk(((r,s)=>{if("atrule"===r.type&&r.name===e)return t(r,s)})):(t=e,this.walk(((e,r)=>{if("atrule"===e.type)return t(e,r)})))}walkComments(e){return this.walk(((t,r)=>{if("comment"===t.type)return e(t,r)}))}walkDecls(e,t){return t?e instanceof RegExp?this.walk(((r,s)=>{if("decl"===r.type&&e.test(r.prop))return t(r,s)})):this.walk(((r,s)=>{if("decl"===r.type&&r.prop===e)return t(r,s)})):(t=e,this.walk(((e,r)=>{if("decl"===e.type)return t(e,r)})))}walkRules(e,t){return t?e instanceof RegExp?this.walk(((r,s)=>{if("rule"===r.type&&e.test(r.selector))return t(r,s)})):this.walk(((r,s)=>{if("rule"===r.type&&r.selector===e)return t(r,s)})):(t=e,this.walk(((e,r)=>{if("rule"===e.type)return t(e,r)})))}}return m.registerParse=e=>{l=e},m.registerRule=e=>{p=e},m.registerAtRule=e=>{n=e},m.registerRoot=e=>{a=e},i=m,m.default=m,m.rebuild=e=>{"atrule"===e.type?Object.setPrototypeOf(e,n.prototype):"rule"===e.type?Object.setPrototypeOf(e,p.prototype):"decl"===e.type?Object.setPrototypeOf(e,h.prototype):"comment"===e.type?Object.setPrototypeOf(e,f.prototype):"root"===e.type&&Object.setPrototypeOf(e,a.prototype),e[u]=!0,e.nodes&&e.nodes.forEach((e=>{m.rebuild(e)}))},i}export{n as __require};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__require as e}from"../../../picocolors/picocolors/index.js";import{__require as t}from"../terminal-highlight/index.js";var i,s;function r(){if(s)return i;s=1;let r=e(),n=t();class l extends Error{constructor(e,t,i,s,r,n){super(e),this.name="CssSyntaxError",this.reason=e,r&&(this.file=r),s&&(this.source=s),n&&(this.plugin=n),void 0!==t&&void 0!==i&&("number"==typeof t?(this.line=t,this.column=i):(this.line=t.line,this.column=t.column,this.endLine=i.line,this.endColumn=i.column)),this.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(this,l)}setMessage(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",void 0!==this.line&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason}showSourceCode(e){if(!this.source)return"";let t=this.source;null==e&&(e=r.isColorSupported);let i=e=>e,s=e=>e,l=e=>e;if(e){let{bold:e,gray:t,red:o}=r.createColors(!0);s=t=>e(o(t)),i=e=>t(e),n&&(l=e=>n(e))}let o=t.split(/\r?\n/),h=Math.max(this.line-3,0),a=Math.min(this.line+2,o.length),u=String(a).length;return o.slice(h,a).map(((e,t)=>{let r=h+1+t,n=" "+(" "+r).slice(-u)+" | ";if(r===this.line){if(e.length>160){let t=20,r=Math.max(0,this.column-t),o=Math.max(this.column+t,this.endColumn+t),h=e.slice(r,o),a=i(n.replace(/\d/g," "))+e.slice(0,Math.min(this.column-1,t-1)).replace(/[^\t]/g," ");return s(">")+i(n)+l(h)+"\n "+a+s("^")}let t=i(n.replace(/\d/g," "))+e.slice(0,this.column-1).replace(/[^\t]/g," ");return s(">")+i(n)+l(e)+"\n "+t+s("^")}return" "+i(n)+l(e)})).join("\n")}toString(){let e=this.showSourceCode();return e&&(e="\n\n"+e+"\n"),this.name+": "+this.message+e}}return i=l,l.default=l,i}export{r as __require};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__require as e}from"../node/index.js";var r,t;function i(){if(t)return r;t=1;let i=e();class s extends i{get variable(){return this.prop.startsWith("--")||"$"===this.prop[0]}constructor(e){e&&void 0!==e.value&&"string"!=typeof e.value&&(e={...e,value:String(e.value)}),super(e),this.type="decl"}}return r=s,s.default=s,r}export{i as __require};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__require as e}from"../container/index.js";var r,t;function s(){if(t)return r;t=1;let s,n,i=e();class o extends i{constructor(e){super({type:"document",...e}),this.nodes||(this.nodes=[])}toResult(e={}){return new s(new n,this,e).stringify()}}return o.registerLazyResult=e=>{s=e},o.registerProcessor=e=>{n=e},r=o,o.default=o,r}export{s as __require};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__require as r}from"../at-rule/index.js";import{__require as e}from"../comment/index.js";import{__require as t}from"../declaration/index.js";import{__require as o}from"../input/index.js";import{__require as i}from"../previous-map/index.js";import{__require as n}from"../root/index.js";import{__require as u}from"../rule/index.js";var p,s;function m(){if(s)return p;s=1;let m=r(),_=e(),a=t(),f=o(),d=i(),l=n(),y=u();function c(r,e){if(Array.isArray(r))return r.map((r=>c(r)));let{inputs:t,...o}=r;if(t){e=[];for(let r of t){let t={...r,__proto__:f.prototype};t.map&&(t.map={...t.map,__proto__:d.prototype}),e.push(t)}}if(o.nodes&&(o.nodes=r.nodes.map((r=>c(r,e)))),o.source){let{inputId:r,...t}=o.source;o.source=t,null!=r&&(o.source.input=e[r])}if("root"===o.type)return new l(o);if("decl"===o.type)return new a(o);if("rule"===o.type)return new y(o);if("comment"===o.type)return new _(o);if("atrule"===o.type)return new m(o);throw new Error("Unknown node type: "+r.type)}return p=c,c.default=c,p}export{m as __require};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__require as e}from"../../../nanoid/non-secure/index/index.js";import i from"path";import{__require as t}from"../../../source-map-js/source-map/index.js";import o from"url";import{__require as n}from"../css-syntax-error/index.js";import{__require as s}from"../previous-map/index.js";import{__require as r}from"../terminal-highlight/index.js";var l,f;function u(){if(f)return l;f=1;let{nanoid:u}=e(),{isAbsolute:m,resolve:c}=i,{SourceMapConsumer:h,SourceMapGenerator:a}=t(),{fileURLToPath:p,pathToFileURL:d}=o,g=n(),C=s(),S=r(),v=Symbol("lineToIndexCache"),L=Boolean(h&&a),_=Boolean(c&&m);function w(e){if(e[v])return e[v];let i=e.css.split("\n"),t=new Array(i.length),o=0;for(let e=0,n=i.length;e<n;e++)t[e]=o,o+=i[e].length+1;return e[v]=t,t}class b{get from(){return this.file||this.id}constructor(e,i={}){if(null==e||"object"==typeof e&&!e.toString)throw new Error(`PostCSS received ${e} instead of CSS string`);if(this.css=e.toString(),"\ufeff"===this.css[0]||""===this.css[0]?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,this.document=this.css,i.document&&(this.document=i.document.toString()),i.from&&(!_||/^\w+:\/\//.test(i.from)||m(i.from)?this.file=i.from:this.file=c(i.from)),_&&L){let e=new C(this.css,i);if(e.text){this.map=e;let i=e.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+u(6)+">"),this.map&&(this.map.file=this.from)}error(e,i,t,o={}){let n,s,r,l,f;if(i&&"object"==typeof i){let e=i,o=t;if("number"==typeof e.offset){l=e.offset;let o=this.fromOffset(l);i=o.line,t=o.col}else i=e.line,t=e.column,l=this.fromLineAndColumn(i,t);if("number"==typeof o.offset){r=o.offset;let e=this.fromOffset(r);s=e.line,n=e.col}else s=o.line,n=o.column,r=this.fromLineAndColumn(o.line,o.column)}else if(t)l=this.fromLineAndColumn(i,t);else{l=i;let e=this.fromOffset(l);i=e.line,t=e.col}let u=this.origin(i,t,s,n);return f=u?new g(e,void 0===u.endLine?u.line:{column:u.column,line:u.line},void 0===u.endLine?u.column:{column:u.endColumn,line:u.endLine},u.source,u.file,o.plugin):new g(e,void 0===s?i:{column:t,line:i},void 0===s?t:{column:n,line:s},this.css,this.file,o.plugin),f.input={column:t,endColumn:n,endLine:s,endOffset:r,line:i,offset:l,source:this.css},this.file&&(d&&(f.input.url=d(this.file).toString()),f.input.file=this.file),f}fromLineAndColumn(e,i){return w(this)[e-1]+i-1}fromOffset(e){let i=w(this),t=0;if(e>=i[i.length-1])t=i.length-1;else{let o,n=i.length-2;for(;t<n;)if(o=t+(n-t>>1),e<i[o])n=o-1;else{if(!(e>=i[o+1])){t=o;break}t=o+1}}return{col:e-i[t]+1,line:t+1}}mapResolve(e){return/^\w+:\/\//.test(e)?e:c(this.map.consumer().sourceRoot||this.map.root||".",e)}origin(e,i,t,o){if(!this.map)return!1;let n,s,r=this.map.consumer(),l=r.originalPositionFor({column:i,line:e});if(!l.source)return!1;"number"==typeof t&&(n=r.originalPositionFor({column:o,line:t})),s=m(l.source)?d(l.source):new URL(l.source,this.map.consumer().sourceRoot||d(this.map.mapFile));let f={column:l.column,endColumn:n&&n.column,endLine:n&&n.line,line:l.line,url:s.toString()};if("file:"===s.protocol){if(!p)throw new Error("file: protocol is not available in this PostCSS build");f.file=p(s)}let u=r.sourceContentFor(l.source);return u&&(f.source=u),f}toJSON(){let e={};for(let i of["hasBOM","css","file","id"])null!=this[i]&&(e[i]=this[i]);return this.map&&(e.map={...this.map},e.map.consumerCache&&(e.map.consumerCache=void 0)),e}}return l=b,b.default=b,S&&S.registerInput&&S.registerInput(b),l}export{u as __require};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__require as t}from"../container/index.js";import{__require as e}from"../document/index.js";import{__require as r}from"../map-generator/index.js";import{__require as s}from"../parse/index.js";import{__require as i}from"../result/index.js";import{__require as o}from"../root/index.js";import{__require as n}from"../stringify/index.js";import{__require as l}from"../symbols/index.js";import{__require as h}from"../warn-once/index.js";var u,c;function p(){if(c)return u;c=1;let p=t(),a=e(),f=r(),d=s(),y=i(),g=o(),m=n(),{isClean:x,my:w}=l(),E=h();const v={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},P={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},S={Once:!0,postcssPlugin:!0,prepare:!0};function _(t){return"object"==typeof t&&"function"==typeof t.then}function O(t){let e=!1,r=v[t.type];return"decl"===t.type?e=t.prop.toLowerCase():"atrule"===t.type&&(e=t.name.toLowerCase()),e&&t.append?[r,r+"-"+e,0,r+"Exit",r+"Exit-"+e]:e?[r,r+"-"+e,r+"Exit",r+"Exit-"+e]:t.append?[r,0,r+"Exit"]:[r,r+"Exit"]}function j(t){let e;return e="document"===t.type?["Document",0,"DocumentExit"]:"root"===t.type?["Root",0,"RootExit"]:O(t),{eventIndex:0,events:e,iterator:0,node:t,visitorIndex:0,visitors:[]}}function R(t){return t[x]=!1,t.nodes&&t.nodes.forEach((t=>R(t))),t}let b={};class C{get content(){return this.stringify().content}get css(){return this.stringify().css}get map(){return this.stringify().map}get messages(){return this.sync().messages}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){return this.sync().root}get[Symbol.toStringTag](){return"LazyResult"}constructor(t,e,r){let s;if(this.stringified=!1,this.processed=!1,"object"!=typeof e||null===e||"root"!==e.type&&"document"!==e.type)if(e instanceof C||e instanceof y)s=R(e.root),e.map&&(void 0===r.map&&(r.map={}),r.map.inline||(r.map.inline=!1),r.map.prev=e.map);else{let t=d;r.syntax&&(t=r.syntax.parse),r.parser&&(t=r.parser),t.parse&&(t=t.parse);try{s=t(e,r)}catch(t){this.processed=!0,this.error=t}s&&!s[w]&&p.rebuild(s)}else s=R(e);this.result=new y(t,s,r),this.helpers={...b,postcss:b,result:this.result},this.plugins=this.processor.plugins.map((t=>"object"==typeof t&&t.prepare?{...t,...t.prepare(this.result)}:t))}async(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}getAsyncError(){throw new Error("Use process(css).then(cb) to work with async plugins")}handleError(t,e){let r=this.result.lastPlugin;try{if(e&&e.addToError(t),this.error=t,"CssSyntaxError"!==t.name||t.plugin){if(r.postcssVersion&&"production"!==process.env.NODE_ENV){let t=r.postcssPlugin,e=r.postcssVersion,s=this.result.processor.version,i=e.split("."),o=s.split(".");(i[0]!==o[0]||parseInt(i[1])>parseInt(o[1]))&&console.error("Unknown error from PostCSS plugin. Your current PostCSS version is "+s+", but "+t+" uses "+e+". Perhaps this is the source of the error below.")}}else t.plugin=r.postcssPlugin,t.setMessage()}catch(t){console&&console.error&&console.error(t)}return t}prepareVisitors(){this.listeners={};let t=(t,e,r)=>{this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push([t,r])};for(let e of this.plugins)if("object"==typeof e)for(let r in e){if(!P[r]&&/^[A-Z]/.test(r))throw new Error(`Unknown event ${r} in ${e.postcssPlugin}. Try to update PostCSS (${this.processor.version} now).`);if(!S[r])if("object"==typeof e[r])for(let s in e[r])t(e,"*"===s?r:r+"-"+s.toLowerCase(),e[r][s]);else"function"==typeof e[r]&&t(e,r,e[r])}this.hasListener=Object.keys(this.listeners).length>0}async runAsync(){this.plugin=0;for(let t=0;t<this.plugins.length;t++){let e=this.plugins[t],r=this.runOnRoot(e);if(_(r))try{await r}catch(t){throw this.handleError(t)}}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[x];){t[x]=!0;let e=[j(t)];for(;e.length>0;){let t=this.visitTick(e);if(_(t))try{await t}catch(t){let r=e[e.length-1].node;throw this.handleError(t,r)}}}if(this.listeners.OnceExit)for(let[e,r]of this.listeners.OnceExit){this.result.lastPlugin=e;try{if("document"===t.type){let e=t.nodes.map((t=>r(t,this.helpers)));await Promise.all(e)}else await r(t,this.helpers)}catch(t){throw this.handleError(t)}}}return this.processed=!0,this.stringify()}runOnRoot(t){this.result.lastPlugin=t;try{if("object"==typeof t&&t.Once){if("document"===this.result.root.type){let e=this.result.root.nodes.map((e=>t.Once(e,this.helpers)));return _(e[0])?Promise.all(e):e}return t.Once(this.result.root,this.helpers)}if("function"==typeof t)return t(this.result.root,this.result)}catch(t){throw this.handleError(t)}}stringify(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();let t=this.result.opts,e=m;t.syntax&&(e=t.syntax.stringify),t.stringifier&&(e=t.stringifier),e.stringify&&(e=e.stringify);let r=new f(e,this.result.root,this.result.opts).generate();return this.result.css=r[0],this.result.map=r[1],this.result}sync(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(let t of this.plugins){if(_(this.runOnRoot(t)))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){let t=this.result.root;for(;!t[x];)t[x]=!0,this.walkSync(t);if(this.listeners.OnceExit)if("document"===t.type)for(let e of t.nodes)this.visitSync(this.listeners.OnceExit,e);else this.visitSync(this.listeners.OnceExit,t)}return this.result}then(t,e){return"production"!==process.env.NODE_ENV&&("from"in this.opts||E("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(t,e)}toString(){return this.css}visitSync(t,e){for(let[r,s]of t){let t;this.result.lastPlugin=r;try{t=s(e,this.helpers)}catch(t){throw this.handleError(t,e.proxyOf)}if("root"!==e.type&&"document"!==e.type&&!e.parent)return!0;if(_(t))throw this.getAsyncError()}}visitTick(t){let e=t[t.length-1],{node:r,visitors:s}=e;if("root"!==r.type&&"document"!==r.type&&!r.parent)return void t.pop();if(s.length>0&&e.visitorIndex<s.length){let[t,i]=s[e.visitorIndex];e.visitorIndex+=1,e.visitorIndex===s.length&&(e.visitors=[],e.visitorIndex=0),this.result.lastPlugin=t;try{return i(r.toProxy(),this.helpers)}catch(t){throw this.handleError(t,r)}}if(0!==e.iterator){let s,i=e.iterator;for(;s=r.nodes[r.indexes[i]];)if(r.indexes[i]+=1,!s[x])return s[x]=!0,void t.push(j(s));e.iterator=0,delete r.indexes[i]}let i=e.events;for(;e.eventIndex<i.length;){let t=i[e.eventIndex];if(e.eventIndex+=1,0===t)return void(r.nodes&&r.nodes.length&&(r[x]=!0,e.iterator=r.getIterator()));if(this.listeners[t])return void(e.visitors=this.listeners[t])}t.pop()}walkSync(t){t[x]=!0;let e=O(t);for(let r of e)if(0===r)t.nodes&&t.each((t=>{t[x]||this.walkSync(t)}));else{let e=this.listeners[r];if(e&&this.visitSync(e,t.toProxy()))return}}warnings(){return this.sync().warnings()}}return C.registerPostcss=t=>{b=t},u=C,C.default=C,g.registerLazyResult(C),a.registerLazyResult(C),u}export{p as __require};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var t,r;function e(){if(r)return t;r=1;let e={comma:t=>e.split(t,[","],!0),space:t=>e.split(t,[" ","\n","\t"]),split(t,r,e){let i=[],u="",l=!1,s=0,n=!1,p="",a=!1;for(let e of t)a?a=!1:"\\"===e?a=!0:n?e===p&&(n=!1):'"'===e||"'"===e?(n=!0,p=e):"("===e?s+=1:")"===e?s>0&&(s-=1):0===s&&r.includes(e)&&(l=!0),l?(""!==u&&i.push(u.trim()),u="",l=!1):u+=e;return(e||""!==u)&&i.push(u.trim()),i}};return t=e,e.default=e,t}export{e as __require};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"path";import{__require as s}from"../../../source-map-js/source-map/index.js";import i from"url";import{__require as e}from"../input/index.js";var o,n;function r(){if(n)return o;n=1;let{dirname:r,relative:a,resolve:p,sep:h}=t,{SourceMapConsumer:l,SourceMapGenerator:u}=s(),{pathToFileURL:m}=i,c=e(),g=Boolean(l&&u),d=Boolean(r&&p&&a&&h);return o=class{constructor(t,s,i,e){this.stringify=t,this.mapOpts=i.map||{},this.root=s,this.opts=i,this.css=e,this.originalCSS=e,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}addAnnotation(){let t;t=this.isInline()?"data:application/json;base64,"+this.toBase64(this.map.toString()):"string"==typeof this.mapOpts.annotation?this.mapOpts.annotation:"function"==typeof this.mapOpts.annotation?this.mapOpts.annotation(this.opts.to,this.root):this.outputFile()+".map";let s="\n";this.css.includes("\r\n")&&(s="\r\n"),this.css+=s+"/*# sourceMappingURL="+t+" */"}applyPrevMaps(){for(let t of this.previous()){let s,i=this.toUrl(this.path(t.file)),e=t.root||r(t.file);!1===this.mapOpts.sourcesContent?(s=new l(t.text),s.sourcesContent&&(s.sourcesContent=null)):s=t.consumer(),this.map.applySourceMap(s,i,this.toUrl(this.path(e)))}}clearAnnotation(){if(!1!==this.mapOpts.annotation)if(this.root){let t;for(let s=this.root.nodes.length-1;s>=0;s--)t=this.root.nodes[s],"comment"===t.type&&t.text.startsWith("# sourceMappingURL=")&&this.root.removeChild(s)}else this.css&&(this.css=this.css.replace(/\n*\/\*#[\S\s]*?\*\/$/gm,""))}generate(){if(this.clearAnnotation(),d&&g&&this.isMap())return this.generateMap();{let t="";return this.stringify(this.root,(s=>{t+=s})),[t]}}generateMap(){if(this.root)this.generateString();else if(1===this.previous().length){let t=this.previous()[0].consumer();t.file=this.outputFile(),this.map=u.fromSourceMap(t,{ignoreInvalidMapping:!0})}else this.map=new u({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]}generateString(){this.css="",this.map=new u({file:this.outputFile(),ignoreInvalidMapping:!0});let t,s,i=1,e=1,o="<no source>",n={generated:{column:0,line:0},original:{column:0,line:0},source:""};this.stringify(this.root,((r,a,p)=>{if(this.css+=r,a&&"end"!==p&&(n.generated.line=i,n.generated.column=e-1,a.source&&a.source.start?(n.source=this.sourcePath(a),n.original.line=a.source.start.line,n.original.column=a.source.start.column-1,this.map.addMapping(n)):(n.source=o,n.original.line=1,n.original.column=0,this.map.addMapping(n))),s=r.match(/\n/g),s?(i+=s.length,t=r.lastIndexOf("\n"),e=r.length-t):e+=r.length,a&&"start"!==p){let t=a.parent||{raws:{}};("decl"===a.type||"atrule"===a.type&&!a.nodes)&&a===t.last&&!t.raws.semicolon||(a.source&&a.source.end?(n.source=this.sourcePath(a),n.original.line=a.source.end.line,n.original.column=a.source.end.column-1,n.generated.line=i,n.generated.column=e-2,this.map.addMapping(n)):(n.source=o,n.original.line=1,n.original.column=0,n.generated.line=i,n.generated.column=e-1,this.map.addMapping(n)))}}))}isAnnotation(){return!!this.isInline()||(void 0!==this.mapOpts.annotation?this.mapOpts.annotation:!this.previous().length||this.previous().some((t=>t.annotation)))}isInline(){if(void 0!==this.mapOpts.inline)return this.mapOpts.inline;let t=this.mapOpts.annotation;return(void 0===t||!0===t)&&(!this.previous().length||this.previous().some((t=>t.inline)))}isMap(){return void 0!==this.opts.map?!!this.opts.map:this.previous().length>0}isSourcesContent(){return void 0!==this.mapOpts.sourcesContent?this.mapOpts.sourcesContent:!this.previous().length||this.previous().some((t=>t.withContent()))}outputFile(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"}path(t){if(this.mapOpts.absolute)return t;if(60===t.charCodeAt(0))return t;if(/^\w+:\/\//.test(t))return t;let s=this.memoizedPaths.get(t);if(s)return s;let i=this.opts.to?r(this.opts.to):".";"string"==typeof this.mapOpts.annotation&&(i=r(p(i,this.mapOpts.annotation)));let e=a(i,t);return this.memoizedPaths.set(t,e),e}previous(){if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk((t=>{if(t.source&&t.source.input.map){let s=t.source.input.map;this.previousMaps.includes(s)||this.previousMaps.push(s)}}));else{let t=new c(this.originalCSS,this.opts);t.map&&this.previousMaps.push(t.map)}return this.previousMaps}setSourcesContent(){let t={};if(this.root)this.root.walk((s=>{if(s.source){let i=s.source.input.from;if(i&&!t[i]){t[i]=!0;let e=this.usesFileUrls?this.toFileUrl(i):this.toUrl(this.path(i));this.map.setSourceContent(e,s.source.input.css)}}}));else if(this.css){let t=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(t,this.css)}}sourcePath(t){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(t.source.input.from):this.toUrl(this.path(t.source.input.from))}toBase64(t){return Buffer?Buffer.from(t).toString("base64"):window.btoa(unescape(encodeURIComponent(t)))}toFileUrl(t){let s=this.memoizedFileURLs.get(t);if(s)return s;if(m){let s=m(t).toString();return this.memoizedFileURLs.set(t,s),s}throw new Error("`map.absolute` option is not available in this PostCSS build")}toUrl(t){let s=this.memoizedURLs.get(t);if(s)return s;"\\"===h&&(t=t.replace(/\\/g,"/"));let i=encodeURI(t).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(t,i),i}}}export{r as __require};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__require as t}from"../map-generator/index.js";import{__require as r}from"../parse/index.js";import{__require as s}from"../result/index.js";import{__require as e}from"../stringify/index.js";import{__require as i}from"../warn-once/index.js";var o,n;function h(){if(n)return o;n=1;let h=t(),u=r();const c=s();let a=e(),l=i();class p{get content(){return this.result.css}get css(){return this.result.css}get map(){return this.result.map}get messages(){return[]}get opts(){return this.result.opts}get processor(){return this.result.processor}get root(){if(this._root)return this._root;let t,r=u;try{t=r(this._css,this._opts)}catch(t){this.error=t}if(this.error)throw this.error;return this._root=t,t}get[Symbol.toStringTag](){return"NoWorkResult"}constructor(t,r,s){let e;r=r.toString(),this.stringified=!1,this._processor=t,this._css=r,this._opts=s,this._map=void 0;let i=a;this.result=new c(this._processor,e,this._opts),this.result.css=r;let o=this;Object.defineProperty(this.result,"root",{get:()=>o.root});let n=new h(i,e,this._opts,r);if(n.isMap()){let[t,r]=n.generate();t&&(this.result.css=t),r&&(this.result.map=r)}else n.clearAnnotation(),this.result.css=n.css}async(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)}catch(t){return this.async().catch(t)}finally(t){return this.async().then(t,t)}sync(){if(this.error)throw this.error;return this.result}then(t,r){return"production"!==process.env.NODE_ENV&&("from"in this._opts||l("Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.")),this.async().then(t,r)}toString(){return this._css}warnings(){return[]}}return o=p,p.default=p,o}export{h as __require};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__require as t}from"../css-syntax-error/index.js";import{__require as e}from"../stringifier/index.js";import{__require as r}from"../stringify/index.js";import{__require as n}from"../symbols/index.js";var s,i;function o(){if(i)return s;i=1;let o=t(),u=e(),l=r(),{isClean:h,my:c}=n();function a(t,e){let r=new t.constructor;for(let n in t){if(!Object.prototype.hasOwnProperty.call(t,n))continue;if("proxyCache"===n)continue;let s=t[n],i=typeof s;"parent"===n&&"object"===i?e&&(r[n]=e):"source"===n?r[n]=s:Array.isArray(s)?r[n]=s.map((t=>a(t,r))):("object"===i&&null!==s&&(s=a(s)),r[n]=s)}return r}function f(t,e){if(e&&void 0!==e.offset)return e.offset;let r=1,n=1,s=0;for(let i=0;i<t.length;i++){if(n===e.line&&r===e.column){s=i;break}"\n"===t[i]?(r=1,n+=1):r+=1}return s}class p{get proxyOf(){return this}constructor(t={}){this.raws={},this[h]=!1,this[c]=!0;for(let e in t)if("nodes"===e){this.nodes=[];for(let r of t[e])"function"==typeof r.clone?this.append(r.clone()):this.append(r)}else this[e]=t[e]}addToError(t){if(t.postcssNode=this,t.stack&&this.source&&/\n\s{4}at /.test(t.stack)){let e=this.source;t.stack=t.stack.replace(/\n\s{4}at /,`$&${e.input.from}:${e.start.line}:${e.start.column}$&`)}return t}after(t){return this.parent.insertAfter(this,t),this}assign(t={}){for(let e in t)this[e]=t[e];return this}before(t){return this.parent.insertBefore(this,t),this}cleanRaws(t){delete this.raws.before,delete this.raws.after,t||delete this.raws.between}clone(t={}){let e=a(this);for(let r in t)e[r]=t[r];return e}cloneAfter(t={}){let e=this.clone(t);return this.parent.insertAfter(this,e),e}cloneBefore(t={}){let e=this.clone(t);return this.parent.insertBefore(this,e),e}error(t,e={}){if(this.source){let{end:r,start:n}=this.rangeBy(e);return this.source.input.error(t,{column:n.column,line:n.line},{column:r.column,line:r.line},e)}return new o(t)}getProxyProcessor(){return{get:(t,e)=>"proxyOf"===e?t:"root"===e?()=>t.root().toProxy():t[e],set:(t,e,r)=>(t[e]===r||(t[e]=r,"prop"!==e&&"value"!==e&&"name"!==e&&"params"!==e&&"important"!==e&&"text"!==e||t.markDirty()),!0)}}markClean(){this[h]=!0}markDirty(){if(this[h]){this[h]=!1;let t=this;for(;t=t.parent;)t[h]=!1}}next(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t+1]}positionBy(t={}){let e=this.source.start;if(t.index)e=this.positionInside(t.index);else if(t.word){let r="document"in this.source.input?this.source.input.document:this.source.input.css,n=r.slice(f(r,this.source.start),f(r,this.source.end)).indexOf(t.word);-1!==n&&(e=this.positionInside(n))}return e}positionInside(t){let e=this.source.start.column,r=this.source.start.line,n="document"in this.source.input?this.source.input.document:this.source.input.css,s=f(n,this.source.start),i=s+t;for(let t=s;t<i;t++)"\n"===n[t]?(e=1,r+=1):e+=1;return{column:e,line:r,offset:i}}prev(){if(!this.parent)return;let t=this.parent.index(this);return this.parent.nodes[t-1]}rangeBy(t={}){let e="document"in this.source.input?this.source.input.document:this.source.input.css,r={column:this.source.start.column,line:this.source.start.line,offset:f(e,this.source.start)},n=this.source.end?{column:this.source.end.column+1,line:this.source.end.line,offset:"number"==typeof this.source.end.offset?this.source.end.offset:f(e,this.source.end)+1}:{column:r.column+1,line:r.line,offset:r.offset+1};if(t.word){let s=e.slice(f(e,this.source.start),f(e,this.source.end)).indexOf(t.word);-1!==s&&(r=this.positionInside(s),n=this.positionInside(s+t.word.length))}else t.start?r={column:t.start.column,line:t.start.line,offset:f(e,t.start)}:t.index&&(r=this.positionInside(t.index)),t.end?n={column:t.end.column,line:t.end.line,offset:f(e,t.end)}:"number"==typeof t.endIndex?n=this.positionInside(t.endIndex):t.index&&(n=this.positionInside(t.index+1));return(n.line<r.line||n.line===r.line&&n.column<=r.column)&&(n={column:r.column+1,line:r.line,offset:r.offset+1}),{end:n,start:r}}raw(t,e){return(new u).raw(this,t,e)}remove(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this}replaceWith(...t){if(this.parent){let e=this,r=!1;for(let n of t)n===this?r=!0:r?(this.parent.insertAfter(e,n),e=n):this.parent.insertBefore(e,n);r||this.remove()}return this}root(){let t=this;for(;t.parent&&"document"!==t.parent.type;)t=t.parent;return t}toJSON(t,e){let r={},n=null==e;e=e||new Map;let s=0;for(let t in this){if(!Object.prototype.hasOwnProperty.call(this,t))continue;if("parent"===t||"proxyCache"===t)continue;let n=this[t];if(Array.isArray(n))r[t]=n.map((t=>"object"==typeof t&&t.toJSON?t.toJSON(null,e):t));else if("object"==typeof n&&n.toJSON)r[t]=n.toJSON(null,e);else if("source"===t){if(null==n)continue;let i=e.get(n.input);null==i&&(i=s,e.set(n.input,s),s++),r[t]={end:n.end,inputId:i,start:n.start}}else r[t]=n}return n&&(r.inputs=[...e.keys()].map((t=>t.toJSON()))),r}toProxy(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache}toString(t=l){t.stringify&&(t=t.stringify);let e="";return t(this,(t=>{e+=t})),e}warn(t,e,r={}){let n={node:this};for(let t in r)n[t]=r[t];return t.warn(e,n)}}return s=p,p.default=p,s}export{o as __require};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{__require as r}from"../container/index.js";import{__require as s}from"../input/index.js";import{__require as e}from"../parser/index.js";var t,a;function i(){if(a)return t;a=1;let i=r(),o=s(),n=e();function p(r,s){let e=new o(r,s),t=new n(e);try{t.parse()}catch(r){throw"production"!==process.env.NODE_ENV&&"CssSyntaxError"===r.name&&s&&s.from&&(/\.scss$/i.test(s.from)?r.message+="\nYou tried to parse SCSS with the standard CSS parser; try again with the postcss-scss parser":/\.sass/i.test(s.from)?r.message+="\nYou tried to parse Sass with the standard CSS parser; try again with the postcss-sass parser":/\.less$/i.test(s.from)&&(r.message+="\nYou tried to parse Less with the standard CSS parser; try again with the postcss-less parser")),r}return t.root}return t=p,p.default=p,i.registerParse(p),t}export{i as __require};
|