@veltra/desktop 1.7.12 → 1.7.15
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/components/batch-edit/batch-edit-form.js +9 -3
- package/dist/components/batch-edit/batch-edit-form.js.map +1 -1
- package/dist/components/batch-edit/batch-edit-list.js +2 -1
- package/dist/components/batch-edit/batch-edit-list.js.map +1 -1
- package/dist/components/batch-edit/batch-edit.js +57 -30
- package/dist/components/batch-edit/batch-edit.js.map +1 -1
- package/dist/components/batch-edit/helper.d.ts +1 -2
- package/dist/components/batch-edit/style.d.ts +1 -0
- package/dist/components/batch-edit/style.js +1 -0
- package/dist/components/batch-edit/style2.css +14 -0
- package/dist/components/batch-edit/use-dialog-effect.js +20 -0
- package/dist/components/batch-edit/use-dialog-effect.js.map +1 -0
- package/dist/components/batch-edit/use-edit-state.js +22 -3
- package/dist/components/batch-edit/use-edit-state.js.map +1 -1
- package/dist/components/batch-edit/use-handlers.js +5 -0
- package/dist/components/batch-edit/use-handlers.js.map +1 -1
- package/dist/components/batch-edit/use-shortcut-key.js +5 -2
- package/dist/components/batch-edit/use-shortcut-key.js.map +1 -1
- package/dist/components/condition-editor/core/evaluator.d.ts +4 -5
- package/dist/components/contextmenu/api.d.ts +1 -2
- package/dist/components/contextmenu/di.d.ts +2 -3
- package/dist/components/file-viewer/file-viewer.js +21 -14
- package/dist/components/file-viewer/file-viewer.js.map +1 -1
- package/dist/components/file-viewer/helper.js +2 -0
- package/dist/components/file-viewer/helper.js.map +1 -1
- package/dist/components/file-viewer/previewers/ofd-previewer.js +196 -0
- package/dist/components/file-viewer/previewers/ofd-previewer.js.map +1 -0
- package/dist/components/file-viewer/style2.css +27 -0
- package/dist/components/loading/directive.d.ts +1 -2
- package/dist/components/message/message.d.ts +1 -2
- package/dist/components/message-confirm/message-confirm.d.ts +1 -2
- package/dist/components/notification/notification.d.ts +1 -2
- package/dist/components/table/node/col.js +19 -0
- package/dist/components/table/node/col.js.map +1 -1
- package/dist/components/table/table-cell.js +2 -0
- package/dist/components/table/table-cell.js.map +1 -1
- package/dist/components/table/table-foot.js +2 -0
- package/dist/components/table/table-foot.js.map +1 -1
- package/dist/components/table/table-head.js +1 -0
- package/dist/components/table/table-head.js.map +1 -1
- package/dist/components/table/table-row.js +2 -0
- package/dist/components/table/table-row.js.map +1 -1
- package/dist/components/table/use-columns.d.ts +1 -2
- package/dist/components/table-editor/style2.css +23 -3
- package/dist/components/table-editor/table-editor.js +213 -63
- package/dist/components/table-editor/table-editor.js.map +1 -1
- package/dist/components/tip/style2.css +63 -0
- package/dist/components/tip/tip.js +6 -1
- package/dist/components/tip/tip.js.map +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/install.d.ts +3 -3
- package/dist/packages/ofd-core/dist/color.js +69 -0
- package/dist/packages/ofd-core/dist/color.js.map +1 -0
- package/dist/packages/ofd-core/dist/ctm.js +55 -0
- package/dist/packages/ofd-core/dist/ctm.js.map +1 -0
- package/dist/packages/ofd-core/dist/error.js +14 -0
- package/dist/packages/ofd-core/dist/error.js.map +1 -0
- package/dist/packages/ofd-core/dist/font.js +384 -0
- package/dist/packages/ofd-core/dist/font.js.map +1 -0
- package/dist/packages/ofd-core/dist/index.js +6 -0
- package/dist/packages/ofd-core/dist/number.js +13 -0
- package/dist/packages/ofd-core/dist/number.js.map +1 -0
- package/dist/packages/ofd-core/dist/page-objects.js +181 -0
- package/dist/packages/ofd-core/dist/page-objects.js.map +1 -0
- package/dist/packages/ofd-core/dist/parse.js +65 -0
- package/dist/packages/ofd-core/dist/parse.js.map +1 -0
- package/dist/packages/ofd-core/dist/render.js +361 -0
- package/dist/packages/ofd-core/dist/render.js.map +1 -0
- package/dist/packages/ofd-core/dist/xml.js +199 -0
- package/dist/packages/ofd-core/dist/xml.js.map +1 -0
- package/dist/packages/ofd-core/dist/zip.js +93 -0
- package/dist/packages/ofd-core/dist/zip.js.map +1 -0
- package/dist/style.d.ts +1 -1
- package/dist/style.js +1 -1
- package/dist/types/action.d.ts +7 -8
- package/dist/types/animation.d.ts +4 -5
- package/dist/types/auto-complete.d.ts +4 -5
- package/dist/types/badge.d.ts +4 -5
- package/dist/types/batch-edit.d.ts +15 -10
- package/dist/types/breadcrumb.d.ts +6 -7
- package/dist/types/button.d.ts +5 -6
- package/dist/types/calendar.d.ts +7 -8
- package/dist/types/card.d.ts +7 -8
- package/dist/types/cascade.d.ts +6 -7
- package/dist/types/check-tag.d.ts +4 -5
- package/dist/types/checkbox-group.d.ts +3 -4
- package/dist/types/checkbox.d.ts +5 -6
- package/dist/types/code-editor.d.ts +5 -6
- package/dist/types/collapse.d.ts +6 -7
- package/dist/types/condition-editor.d.ts +11 -12
- package/dist/types/contextmenu.d.ts +5 -6
- package/dist/types/css-transition.d.ts +4 -5
- package/dist/types/date-panel.d.ts +3 -4
- package/dist/types/date-picker.d.ts +5 -6
- package/dist/types/date-range-picker.d.ts +6 -7
- package/dist/types/dialog.d.ts +5 -6
- package/dist/types/drawer.d.ts +6 -7
- package/dist/types/dropdown.d.ts +4 -5
- package/dist/types/dual-nav.d.ts +6 -7
- package/dist/types/empty.d.ts +4 -5
- package/dist/types/expression-editor.d.ts +6 -7
- package/dist/types/file-picker.d.ts +4 -5
- package/dist/types/file-viewer.d.ts +6 -7
- package/dist/types/float-button.d.ts +5 -6
- package/dist/types/form-item.d.ts +3 -4
- package/dist/types/form.d.ts +4 -5
- package/dist/types/gantt-chart.d.ts +4 -5
- package/dist/types/grid-input.d.ts +4 -5
- package/dist/types/grid.d.ts +7 -8
- package/dist/types/group-input.d.ts +4 -5
- package/dist/types/group-nav.d.ts +3 -4
- package/dist/types/icon.d.ts +3 -4
- package/dist/types/image-cropper.d.ts +9 -10
- package/dist/types/index.d.ts +4 -4
- package/dist/types/input.d.ts +4 -5
- package/dist/types/layout.d.ts +4 -5
- package/dist/types/list.d.ts +4 -5
- package/dist/types/loading.d.ts +5 -6
- package/dist/types/message-confirm.d.ts +8 -9
- package/dist/types/message.d.ts +8 -9
- package/dist/types/multi-auto-complete.d.ts +4 -5
- package/dist/types/multi-select.d.ts +4 -5
- package/dist/types/multi-tree-select.d.ts +4 -5
- package/dist/types/nav.d.ts +5 -6
- package/dist/types/node-render.d.ts +2 -3
- package/dist/types/notification.d.ts +8 -9
- package/dist/types/number-input.d.ts +3 -4
- package/dist/types/number-range-input.d.ts +4 -5
- package/dist/types/number.d.ts +3 -4
- package/dist/types/paginator.d.ts +4 -5
- package/dist/types/palette.d.ts +7 -8
- package/dist/types/password-input.d.ts +4 -5
- package/dist/types/pop-confirm.d.ts +4 -5
- package/dist/types/pop.d.ts +4 -5
- package/dist/types/progress-nodes.d.ts +4 -5
- package/dist/types/progress.d.ts +4 -5
- package/dist/types/quick-batch-edit.d.ts +4 -5
- package/dist/types/radio-group.d.ts +4 -5
- package/dist/types/radio.d.ts +4 -5
- package/dist/types/rich-text-editor.d.ts +6 -7
- package/dist/types/scroll.d.ts +5 -6
- package/dist/types/segment.d.ts +5 -6
- package/dist/types/select.d.ts +4 -5
- package/dist/types/slider.d.ts +4 -5
- package/dist/types/steps.d.ts +5 -6
- package/dist/types/switch.d.ts +4 -5
- package/dist/types/table-editor.d.ts +30 -10
- package/dist/types/table.d.ts +23 -13
- package/dist/types/tabs.d.ts +13 -14
- package/dist/types/tag.d.ts +3 -4
- package/dist/types/text-editor.d.ts +5 -6
- package/dist/types/text.d.ts +4 -5
- package/dist/types/textarea.d.ts +4 -5
- package/dist/types/theme.d.ts +3 -4
- package/dist/types/tip.d.ts +11 -8
- package/dist/types/tree-select.d.ts +4 -5
- package/dist/types/tree.d.ts +6 -6
- package/dist/types/watermark.d.ts +4 -5
- package/package.json +8 -7
- package/src/components/batch-edit/__test__/batch-edit.test.ts +191 -4
- package/src/components/batch-edit/batch-edit-form.vue +17 -3
- package/src/components/batch-edit/batch-edit-list.vue +2 -1
- package/src/components/batch-edit/batch-edit.vue +22 -4
- package/src/components/batch-edit/style.scss +20 -0
- package/src/components/batch-edit/style.ts +1 -0
- package/src/components/batch-edit/use-dialog-effect.ts +9 -3
- package/src/components/batch-edit/use-edit-state.ts +32 -4
- package/src/components/batch-edit/use-handlers.ts +10 -0
- package/src/components/batch-edit/use-shortcut-key.ts +6 -2
- package/src/components/file-viewer/__test__/helper.test.ts +13 -0
- package/src/components/file-viewer/file-viewer.vue +23 -16
- package/src/components/file-viewer/helper.ts +2 -0
- package/src/components/file-viewer/previewers/ofd-previewer.vue +216 -0
- package/src/components/file-viewer/style.scss +33 -0
- package/src/components/table/__test__/column-style.test.ts +67 -0
- package/src/components/table/node/col.ts +30 -1
- package/src/components/table/table-cell.vue +7 -2
- package/src/components/table/table-foot.vue +2 -0
- package/src/components/table/table-head.tsx +1 -0
- package/src/components/table/table-row.tsx +2 -0
- package/src/components/table-editor/__test__/table-editor.test.ts +471 -0
- package/src/components/table-editor/style.scss +42 -4
- package/src/components/table-editor/table-editor.vue +265 -38
- package/src/components/tip/style.scss +15 -0
- package/src/components/tip/tip.vue +1 -1
- package/src/types/batch-edit.ts +6 -0
- package/src/types/file-viewer.ts +1 -1
- package/src/types/table-editor.ts +29 -7
- package/src/types/table.ts +12 -0
- package/src/types/tip.ts +6 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-editor.js","names":["$slots"],"sources":["../../../src/components/table-editor/table-editor.vue"],"sourcesContent":["<template>\n <u-table\n :columns=\"internalColumns\"\n :data=\"modelValue || []\"\n :class=\"cls.b\"\n :stripe=\"false\"\n show-index\n :slots=\"$slots\"\n >\n <template #column:__operation=\"{ row }\">\n <ButtonCommonProps tag=\"div\" style=\"display: flex; justify-content: center; gap: 8px\">\n <u-button type=\"danger\" @click=\"handleDelete(row.index)\" :icon=\"Minus\" title=\"移除\" />\n <u-button :icon=\"Plus\" @click=\"handleCreate(row.index)\" title=\"新增到下一行\" />\n <u-button :icon=\"Copy\" @click=\"handleCopy(row)\" title=\"复制到下一行\" />\n </ButtonCommonProps>\n </template>\n\n <!-- <template #header:__operation> </template> -->\n\n <template #empty>\n <div style=\"text-align: center; padding: 4px 0\">\n <u-button\n text\n size=\"small\"\n type=\"primary\"\n v-if=\"!modelValue.length\"\n :icon=\"Plus\"\n @click=\"handleCreate()\"\n >添加</u-button\n >\n </div>\n </template>\n </u-table>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useComponentProps } from '@veltra/compositions'\nimport { Copy, Minus, Plus } from '@veltra/icons/normal'\nimport { bem } from '@veltra/utils'\nimport { computed } from 'vue'\n\nimport type { TableEditorProps, TableEditorEmits, TableColumn } from '../../types'\nimport { UButton } from '../button'\nimport { UTable } from '../table'\nimport type { TableRowNode } from '../table/node/row'\n\ndefineOptions({ name: 'UTableEditor' })\n\nconst { columns = [], modelValue = [] } = defineProps<TableEditorProps>()\nconst emit = defineEmits<TableEditorEmits>()\n\nconst cls = bem('table-editor')\n\nconst ButtonCommonProps = useComponentProps({\n size: 'small',\n circle: true,\n text: true,\n type: 'primary'\n})\n\nconst actionColumn: TableColumn = {\n key: '__operation',\n name: '操作', // 使用name而不是title\n width: 120,\n align: 'center',\n fixed: 'right',\n resizable: false\n}\n\n// 内部列定义,添加编辑和删除操作列\nconst internalColumns = computed(() => {\n return [...columns, actionColumn]\n})\n\nfunction handleCreate(index?: number) {\n if (index !== undefined) {\n emit('update:modelValue', [\n ...modelValue.slice(0, index + 1),\n {},\n ...modelValue.slice(index + 1)\n ])\n } else {\n emit('update:modelValue', [...modelValue, {}])\n }\n}\n\nfunction handleCopy(row: TableRowNode) {\n emit('update:modelValue', [\n ...modelValue.slice(0, row.index + 1),\n JSON.parse(JSON.stringify(row.data)),\n ...modelValue.slice(row.index + 1)\n ])\n}\n\nfunction handleDelete(index: number) {\n emit(\n 'update:modelValue',\n modelValue.filter((_, i) => i !== index)\n )\n}\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiDA,MAAM,OAAO;EAEb,MAAM,MAAM,IAAI,cAAc;EAE9B,MAAM,oBAAoB,kBAAkB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MAAA,KAAA;OAAO,OAAM;;MAC7E,YAAyE,MAAA,WAAA,GAAA;OAA9D,MAAM,MAAA,IAAA;OAAO,UAAK,WAAE,aAAa,IAAI,KAAK;OAAG,OAAM;;MAC9D,YAAiE,MAAA,WAAA,GAAA;OAAtD,MAAM,MAAA,IAAA;OAAO,UAAK,WAAE,WAAW,GAAG;OAAG,OAAM;;;;;IAM/C,OAAK,cAWR,CAVN,mBAUM,OAVN,YAUM,CALK,CAAA,QAAA,WAAW,UAJpB,UAAA,GAAA,YAQC,MAAA,WAAA,GAAA;;KAPC,MAAA;KACA,MAAK;KACL,MAAK;KAEJ,MAAM,MAAA,IAAA;KACN,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,aAAY;;KACnB,SAAA,cAAE,CAAA,GAAA,OAAA,OAAA,OAAA,KAAA,CAAF,gBAAA,MAAE,EAAA,CAAA,EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"table-editor.js","names":[],"sources":["../../../src/components/table-editor/table-editor.vue"],"sourcesContent":["<template>\n <u-table\n v-bind=\"tableProps\"\n :columns=\"internalColumns\"\n :data=\"modelValue\"\n :class=\"cls.b\"\n :stripe=\"false\"\n show-index\n >\n <!-- 其余插槽(header:* / row:expand / foot / append 等)透传给 u-table;column:* 与 empty 由组件接管 -->\n <template v-for=\"name in passSlotNames\" :key=\"name\" #[name]=\"scope\">\n <slot :name=\"name\" v-bind=\"scope\" />\n </template>\n\n <template #column:__operation=\"{ row }\">\n <div :class=\"cls.e('operations')\">\n <u-button\n text\n size=\"small\"\n type=\"danger\"\n :icon=\"Minus\"\n title=\"移除\"\n @click=\"handleDelete(row.index)\"\n />\n <u-button\n text\n size=\"small\"\n :icon=\"Plus\"\n title=\"新增到下一行\"\n @click=\"handleCreate(row.index)\"\n />\n <u-button text size=\"small\" :icon=\"Copy\" title=\"复制到下一行\" @click=\"handleCopy(row)\" />\n </div>\n </template>\n\n <template #empty>\n <div style=\"text-align: center; padding: 4px 0\">\n <u-button\n v-if=\"!props.readonly\"\n text\n size=\"small\"\n type=\"primary\"\n :icon=\"Plus\"\n @click=\"handleCreate()\"\n >\n 添加\n </u-button>\n </div>\n </template>\n </u-table>\n</template>\n\n<script lang=\"ts\" setup>\nimport { o } from '@cat-kit/core'\nimport { Copy, Minus, Plus, Warning } from '@veltra/icons/normal'\nimport { bem } from '@veltra/utils'\nimport { computed, h, shallowRef, toRaw, triggerRef, useSlots, watch } from 'vue'\n\nimport type {\n TableEditorProps,\n TableEditorEmits,\n TableEditorColumn,\n _TableEditorExposed,\n TableColumn,\n TableColumnNode,\n TableColumnRenderContext,\n TableColumnSlotsScope,\n RenderReturn\n} from '../../types'\nimport { UButton } from '../button'\nimport { validateField } from '../form-item/validate'\nimport { UIcon } from '../icon'\nimport { UTable } from '../table'\nimport type { TableRowNode } from '../table/node/row'\nimport { UTip } from '../tip'\n\ndefineOptions({ name: 'UTableEditor' })\n\ndefineSlots<{\n [key: `column:${string}`]: (props: TableColumnSlotsScope) => any\n [key: `header:${string}`]: (props: { column: TableColumnNode }) => any\n}>()\n\nconst props = defineProps<TableEditorProps>()\nconst emit = defineEmits<TableEditorEmits>()\n\nconst columns = computed(() => props.columns ?? [])\nconst modelValue = computed(() => props.modelValue ?? [])\n\n/** 转发给 u-table 的表格属性;columns / modelValue / readonly 为编辑器自用,stripe / showIndex 被覆盖 */\nconst tableProps = computed(() => {\n const rest: Record<string, any> = { ...props }\n delete rest.columns\n delete rest.modelValue\n delete rest.readonly\n return rest\n})\n\nconst cls = bem('table-editor')\n\nconst slots = useSlots()\n\nconst actionColumn: TableColumn = {\n key: '__operation',\n name: '操作',\n width: 104,\n align: 'center',\n fixed: 'right',\n resizable: false\n}\n\n/**\n * 内部列定义:单元格渲染挂在列的 render 上(用户列自带的 render 优先),\n * 配置了 rules 的列包装 nameRender 追加校验标识,非只读时末尾追加操作列。\n * 列 key 带上只读态后缀:u-table 行内单元格在 props 值相等时可能跳过子组件补丁,\n * 只读切换改用挂载键直接重挂单元格,确保控件在编辑/只读形态间可靠切换。\n */\nconst internalColumns = computed<TableColumn[]>(() => {\n const list = columns.value.map((column) => ({\n ...column,\n key: `${column.key}${props.readonly ? ':ro' : ''}`,\n nameRender: column.rules ? headerCell(column) : column.nameRender,\n render: column.render ?? ((ctx: TableColumnRenderContext) => editCell(column, ctx))\n }))\n return props.readonly ? list : [...list, actionColumn]\n})\n\n/** 透传给 u-table 的插槽名:column:* 经 editCell 注入 model、empty 由组件接管,其余透传 */\nconst passSlotNames = Object.keys(slots).filter(\n (name) => !name.startsWith('column:') && name !== 'empty'\n)\n\n/**\n * 带校验的列表头包装:required 时列名前渲染红星;该列存在未通过项时文字标红并追加\n * 感叹号图标,悬停经 UTip 气泡展示各行错误明细;`#header:key` 插槽 / nameRender 内容替代列名。\n * 渲染函数内读取 columnErrors 建立响应依赖,错误出现/消失即时更新表头。\n */\nfunction headerCell(column: TableEditorColumn) {\n return (ctx: { column: TableColumnNode }): RenderReturn => {\n const messages = columnErrors.value.get(column.key)\n const nodes = [\n h(\n 'span',\n { class: [cls.e('header-text'), bem.is('error', !!messages?.length)] },\n slots[`header:${column.key}`]?.(ctx) ?? column.nameRender?.(ctx) ?? column.name\n )\n ]\n\n if (column.rules?.required) {\n nodes.unshift(h('span', { class: cls.e('required-mark'), 'aria-hidden': 'true' }, '*'))\n }\n\n if (messages?.length) {\n nodes.push(\n h(\n UTip,\n { key: 'header-error-tip' },\n {\n default: () =>\n h(UIcon, { size: 14, class: cls.e('header-icon') }, { default: () => h(Warning) }),\n content: () => messages.map((message) => h('div', { key: message }, message))\n }\n )\n )\n }\n\n return nodes\n }\n}\n\n// --- 按列校验 ---\n\n/** 行数据(以原始对象为键)→ 列 key → 错误信息 */\nconst cellErrors = shallowRef(new Map<Record<string, any>, Map<string, string>>())\n\n/** 行节点 data 可能是响应式代理,统一取原始对象作为键 */\nconst errorRowKey = (rowData: Record<string, any>) => toRaw(rowData) as Record<string, any>\n\nfunction setCellError(rowData: Record<string, any>, key: string, message: string | undefined) {\n const row = errorRowKey(rowData)\n const rowErrors = cellErrors.value.get(row)\n\n if (!message) {\n if (!rowErrors?.delete(key)) return\n } else {\n if (rowErrors?.get(key) === message) return\n if (rowErrors) rowErrors.set(key, message)\n else cellErrors.value.set(row, new Map([[key, message]]))\n }\n\n triggerRef(cellErrors)\n}\n\n/** 丢弃同一单元格过期的异步校验结果 */\nconst validateSeqs = new WeakMap<Record<string, any>, Map<string, number>>()\n\n/** 单元格级校验:以行数据为 formData、列 key 为 field,结果同步到错误状态 */\nasync function validateCell(\n rowData: Record<string, any>,\n key: string,\n rules: TableEditorColumn['rules']\n) {\n if (!rules) return\n\n const row = errorRowKey(rowData)\n let seqs = validateSeqs.get(row)\n if (!seqs) {\n seqs = new Map()\n validateSeqs.set(row, seqs)\n }\n const seq = (seqs.get(key) ?? 0) + 1\n seqs.set(key, seq)\n\n const message = await validateField(rowData, key, rules)\n if (seqs.get(key) !== seq) return\n // 校验是异步的,期间行可能已被移出模型(整体替换/删除);\n // 把结果写回「死行」会绕过清理 watch 永久残留,直接丢弃\n if (!modelValue.value.some((item) => errorRowKey(item) === row)) return\n\n setCellError(row, key, message)\n}\n\n/**\n * 整表校验:自上而下逐行校验,某行存在未通过项即停止校验其后的行(懒校验)。\n * 全部通过 resolve true,否则 resolve false。\n */\nasync function validate() {\n const ruleColumns = columns.value.filter((column) => column.rules)\n\n for (const row of modelValue.value) {\n await Promise.all(ruleColumns.map((column) => validateCell(row, column.key, column.rules)))\n if (cellErrors.value.get(errorRowKey(row))?.size) return false\n }\n\n return true\n}\n\n// 行删除(或整体替换)后,同步清理已不存在的行数据上的错误\nwatch(modelValue, (rows) => {\n if (!cellErrors.value.size) return\n\n const aliveRows = new Set(rows.map(errorRowKey))\n const next = new Map<Record<string, any>, Map<string, string>>()\n let changed = false\n\n for (const [row, errors] of cellErrors.value) {\n if (aliveRows.has(row)) next.set(row, errors)\n else changed = true\n }\n\n if (changed) cellErrors.value = next\n})\n\n/** 列 key → 该列全部未通过信息(带行序号),驱动表头错误标识 */\nconst columnErrors = computed(() => {\n const map = new Map<string, string[]>()\n if (!cellErrors.value.size) return map\n\n for (const [row, errors] of cellErrors.value) {\n const index = modelValue.value.findIndex((item) => errorRowKey(item) === row)\n const label = index >= 0 ? `第 ${index + 1} 行:` : ''\n for (const [key, message] of errors) {\n const list = map.get(key) ?? []\n list.push(`${label}${message}`)\n map.set(key, list)\n }\n }\n return map\n})\n\n// --- 单元格渲染 ---\n\n/** 声明了 `#column:key` 插槽的列调用编辑插槽(注入 model),未声明的渲染字段原始值 */\nfunction editCell(column: TableEditorColumn, ctx: TableColumnRenderContext): RenderReturn {\n const editSlot = slots[`column:${column.key}`]\n // 内部列 key 带只读态后缀,u-table 按 key 取到的 val 失效,这里按原始列 key 重取\n const val = o(ctx.rowData).get(column.key)\n if (!editSlot) return val\n const scope = { ...ctx, val }\n return editSlot({ ...scope, model: createCellModel(column, scope) })\n}\n\n/**\n * 单元格编辑 model:值先原地写回行数据(行节点与 DOM 得以复用,输入不丢焦点),\n * 再以浅拷贝数组经 update:modelValue 通知宿主,维持 v-model 契约。\n * 只读下注入 readonly: true 且不提供写回通道,值不可修改;\n * 列配置了 rules 时,控件的 change 事件(如失焦提交)触发单元格级校验,输入过程不校验。\n */\nfunction createCellModel(column: TableEditorColumn, ctx: TableColumnRenderContext) {\n const { rowData, val } = ctx\n const key = column.key\n const rules = column.rules\n return {\n modelValue: val,\n ...(props.readonly\n ? { readonly: true }\n : {\n 'onUpdate:modelValue': (value: any) => {\n rowData[key] = value\n emit('update:modelValue', [...modelValue.value])\n }\n }),\n ...(rules ? { onChange: () => void validateCell(rowData, key, rules) } : {})\n }\n}\n\nfunction handleCreate(index?: number) {\n const at = index !== undefined ? index + 1 : modelValue.value.length\n emit('update:modelValue', [...modelValue.value.slice(0, at), {}, ...modelValue.value.slice(at)])\n}\n\nfunction handleCopy(row: TableRowNode) {\n emit('update:modelValue', [\n ...modelValue.value.slice(0, row.index + 1),\n JSON.parse(JSON.stringify(row.data)),\n ...modelValue.value.slice(row.index + 1)\n ])\n}\n\nfunction handleDelete(index: number) {\n emit(\n 'update:modelValue',\n modelValue.value.filter((_, i) => i !== index)\n )\n}\n\ndefineExpose<_TableEditorExposed>({ validate })\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmFA,MAAM,QAAQ;EACd,MAAM,OAAO;EAEb,MAAM,UAAU,eAAe,MAAM,WAAW,CAAC,CAAC;EAClD,MAAM,aAAa,eAAe,MAAM,cAAc,CAAC,CAAC;;EAGxD,MAAM,aAAa,eAAe;GAChC,MAAM,OAA4B,EAAE,GAAG,MAAM;GAC7C,OAAO,KAAK;GACZ,OAAO,KAAK;GACZ,OAAO,KAAK;GACZ,OAAO;EACT,CAAC;EAED,MAAM,MAAM,IAAI,cAAc;EAE9B,MAAM,QAAQ,SAAS;EAEvB,MAAM,eAA4B;GAChC,KAAK;GACL,MAAM;GACN,OAAO;GACP,OAAO;GACP,OAAO;GACP,WAAW;EACb;;;;;;;EAQA,MAAM,kBAAkB,eAA8B;GACpD,MAAM,OAAO,QAAQ,MAAM,KAAK,YAAY;IAC1C,GAAG;IACH,KAAK,GAAG,OAAO,MAAM,MAAM,WAAW,QAAQ;IAC9C,YAAY,OAAO,QAAQ,WAAW,MAAM,IAAI,OAAO;IACvD,QAAQ,OAAO,YAAY,QAAkC,SAAS,QAAQ,GAAG;GACnF,EAAE;GACF,OAAO,MAAM,WAAW,OAAO,CAAC,GAAG,MAAM,YAAY;EACvD,CAAC;;EAGD,MAAM,gBAAgB,OAAO,KAAK,KAAK,CAAC,CAAC,QACtC,SAAS,CAAC,KAAK,WAAW,SAAS,KAAK,SAAS,OACpD;;;;;;EAOA,SAAS,WAAW,QAA2B;GAC7C,QAAQ,QAAmD;IACzD,MAAM,WAAW,aAAa,MAAM,IAAI,OAAO,GAAG;IAClD,MAAM,QAAQ,CACZ,EACE,QACA,EAAE,OAAO,CAAC,IAAI,EAAE,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AA,MAAA,aAAA,IAAR,SAAI;;KAAgC;KACnD,IAAA,SAD2D,UAAK,CAChE,WAAoC,KAAA,QAAvB,MAAI,eAAA,mBAAU,KAAK,CAAA,CAAA,CAAA,CAAA"}
|
|
@@ -56,6 +56,69 @@
|
|
|
56
56
|
font-size: var(--u-font-size-main-large);
|
|
57
57
|
padding: var(--u-gap-large);
|
|
58
58
|
}
|
|
59
|
+
.u-tip--color-primary {
|
|
60
|
+
color: var(--u-text-color-white);
|
|
61
|
+
}
|
|
62
|
+
.u-tip--color-primary::after {
|
|
63
|
+
background-color: var(--u-color-primary);
|
|
64
|
+
}
|
|
65
|
+
.u-tip--color-primary .u-tip__arrow {
|
|
66
|
+
background-color: var(--u-color-primary);
|
|
67
|
+
}
|
|
68
|
+
.u-tip--color-success {
|
|
69
|
+
color: var(--u-text-color-white);
|
|
70
|
+
}
|
|
71
|
+
.u-tip--color-success::after {
|
|
72
|
+
background-color: var(--u-color-success);
|
|
73
|
+
}
|
|
74
|
+
.u-tip--color-success .u-tip__arrow {
|
|
75
|
+
background-color: var(--u-color-success);
|
|
76
|
+
}
|
|
77
|
+
.u-tip--color-warning {
|
|
78
|
+
color: var(--u-text-color-white);
|
|
79
|
+
}
|
|
80
|
+
.u-tip--color-warning::after {
|
|
81
|
+
background-color: var(--u-color-warning);
|
|
82
|
+
}
|
|
83
|
+
.u-tip--color-warning .u-tip__arrow {
|
|
84
|
+
background-color: var(--u-color-warning);
|
|
85
|
+
}
|
|
86
|
+
.u-tip--color-danger {
|
|
87
|
+
color: var(--u-text-color-white);
|
|
88
|
+
}
|
|
89
|
+
.u-tip--color-danger::after {
|
|
90
|
+
background-color: var(--u-color-danger);
|
|
91
|
+
}
|
|
92
|
+
.u-tip--color-danger .u-tip__arrow {
|
|
93
|
+
background-color: var(--u-color-danger);
|
|
94
|
+
}
|
|
95
|
+
.u-tip--color-info {
|
|
96
|
+
color: var(--u-text-color-white);
|
|
97
|
+
}
|
|
98
|
+
.u-tip--color-info::after {
|
|
99
|
+
background-color: var(--u-color-info);
|
|
100
|
+
}
|
|
101
|
+
.u-tip--color-info .u-tip__arrow {
|
|
102
|
+
background-color: var(--u-color-info);
|
|
103
|
+
}
|
|
104
|
+
.u-tip--color-disabled {
|
|
105
|
+
color: var(--u-text-color-white);
|
|
106
|
+
}
|
|
107
|
+
.u-tip--color-disabled::after {
|
|
108
|
+
background-color: var(--u-color-disabled);
|
|
109
|
+
}
|
|
110
|
+
.u-tip--color-disabled .u-tip__arrow {
|
|
111
|
+
background-color: var(--u-color-disabled);
|
|
112
|
+
}
|
|
113
|
+
.u-tip--color-default {
|
|
114
|
+
color: var(--u-text-color-white);
|
|
115
|
+
}
|
|
116
|
+
.u-tip--color-default::after {
|
|
117
|
+
background-color: var(--u-color-default);
|
|
118
|
+
}
|
|
119
|
+
.u-tip--color-default .u-tip__arrow {
|
|
120
|
+
background-color: var(--u-color-default);
|
|
121
|
+
}
|
|
59
122
|
|
|
60
123
|
.tip-enter-active,
|
|
61
124
|
.tip-leave-active {
|
|
@@ -13,6 +13,7 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
13
13
|
type: Boolean,
|
|
14
14
|
default: void 0
|
|
15
15
|
},
|
|
16
|
+
type: {},
|
|
16
17
|
content: { default: "" },
|
|
17
18
|
style: {},
|
|
18
19
|
class: {},
|
|
@@ -33,7 +34,11 @@ const _sfc_main = /*@__PURE__*/ defineComponent({
|
|
|
33
34
|
const slots = useSlots();
|
|
34
35
|
const { size } = useFallbackProps([props], { size: "default" });
|
|
35
36
|
const contentClass = computed(() => {
|
|
36
|
-
const fixed = [
|
|
37
|
+
const fixed = [
|
|
38
|
+
cls.e("content"),
|
|
39
|
+
cls.m(size.value),
|
|
40
|
+
props.type && cls.m("color-" + props.type)
|
|
41
|
+
];
|
|
37
42
|
const className = props.class;
|
|
38
43
|
if (!Array.isArray(className)) return [...fixed, className];
|
|
39
44
|
return [...fixed, ...className];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tip.js","names":[],"sources":["../../../src/components/tip/tip.vue"],"sourcesContent":["<template>\n <!-- 触发 -->\n <UNodeRender v-bind=\"eventsHandlers\" :content=\"renderDefaultSlotTrigger()\" ref=\"triggerRef\" />\n\n <!-- 弹出内容 -->\n <teleport :to=\"`#${popperContainerId}`\">\n <transition name=\"tip\">\n <component\n v-if=\"tipVisible\"\n :is=\"contentTag\"\n :class=\"contentClass\"\n :style=\"[style, { zIndex: zIndex() }]\"\n ref=\"contentRef\"\n @mouseenter=\"eventsHandlers.onMouseenter\"\n @mouseleave=\"eventsHandlers.onMouseleave\"\n @click.stop\n v-click-outside=\"handleClickOutside\"\n >\n <UNodeRender v-if=\"externalNode\" :content=\"externalNode\" />\n\n <slot name=\"content\">{{ content }}</slot>\n\n <div :class=\"cls.e('arrow')\" v-if=\"!hideArrow\" ref=\"arrowRef\"></div>\n </component>\n </transition>\n </teleport>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useFallbackProps, usePop } from '@veltra/compositions'\nimport { vClickOutside } from '@veltra/directives'\nimport { bem, extractNormalVNodes, zIndex } from '@veltra/utils'\nimport { shallowRef, computed, useSlots, onBeforeUnmount, toRef, watch, nextTick } from 'vue'\n\nimport type { TipProps, ComponentSize, TipEmits } from '../../types'\nimport { UNodeRender } from '../node-render'\nimport { useNest } from './use-nest'\n\ndefineOptions({ name: 'UTip' })\n\nconst props = withDefaults(defineProps<TipProps>(), {\n content: '',\n trigger: 'hover',\n direction: 'top',\n alignment: 'center',\n contentTag: 'div',\n visible: undefined,\n showDelay: 0\n})\n\nconst emit = defineEmits<TipEmits>()\n\nconst cls = bem('tip')\nconst slots = useSlots()\nconst { size } = useFallbackProps([props], { size: 'default' as ComponentSize })\n\nconst contentClass = computed(() => {\n const fixed = [cls.e('content'), cls.m(size.value)]\n const className = props.class\n if (!Array.isArray(className)) {\n return [...fixed, className]\n }\n return [...fixed, ...className]\n})\n\nconst triggerRef = shallowRef<InstanceType<typeof UNodeRender>>()\nconst contentRef = shallowRef<HTMLElement>()\nconst arrowRef = shallowRef<HTMLElement>()\n\nconst _visible = shallowRef(false)\n\nconst visible = computed(() => {\n return props.visible !== undefined ? props.visible : _visible.value\n})\n\nfunction updateVisible(v: boolean) {\n if (props.visible === undefined) {\n _visible.value = v\n } else {\n emit('update:visible', v)\n }\n}\n\nconst tipVisible = useNest(visible)\n\nfunction renderDefaultSlotTrigger() {\n const nodes = slots.default?.()\n if (!nodes?.length) return null\n return extractNormalVNodes(nodes)[0]\n}\n\nconst eventsHandlers = computed(() => {\n const { trigger, disabled } = props\n\n const handlers: Record<string, Function> = {}\n\n if (disabled) return handlers\n\n if (trigger === 'click') {\n handlers.onClick = open\n } else if (trigger === 'hover') {\n handlers.onMouseenter = open\n handlers.onMouseleave = close\n }\n\n return handlers\n})\n\nconst handleClickOutside = (e: MouseEvent) => {\n if (props.trigger === 'hover') return\n\n // 点击的元素在触发元素中则啥也\n if (props.trigger === 'click' && triggerDom.value.contains(e.target as Node)) {\n return\n }\n close()\n}\n\nlet openTimer: ReturnType<typeof setTimeout> | undefined\nlet closeTimer: ReturnType<typeof setTimeout> | undefined\n\nfunction clearOpenTimer() {\n if (openTimer !== undefined) {\n clearTimeout(openTimer)\n openTimer = undefined\n }\n}\n\nfunction clearCloseTimer() {\n if (closeTimer !== undefined) {\n clearTimeout(closeTimer)\n closeTimer = undefined\n }\n}\n\n/** 弹出 */\nconst open = (e?: PointerEvent) => {\n e?.stopPropagation()\n clearCloseTimer()\n\n const delay = props.trigger === 'hover' ? props.showDelay : 0\n if (delay <= 0) {\n clearOpenTimer()\n updateVisible(true)\n return\n }\n\n clearOpenTimer()\n openTimer = setTimeout(() => {\n openTimer = undefined\n updateVisible(true)\n }, delay)\n}\n/** 关闭 */\nconst close = () => {\n clearOpenTimer()\n\n if (props.trigger === 'hover') {\n closeTimer = setTimeout(() => {\n closeTimer = undefined\n updateVisible(false)\n }, 250)\n } else {\n updateVisible(false)\n }\n}\n\nconst triggerDom = computed(() => {\n return props.triggerDom || triggerRef.value?.$el\n})\n\nconst { update, popperContainerId } = usePop({\n triggerRef: triggerDom,\n contentRef,\n arrowRef,\n direction: toRef(() => props.direction),\n alignment: toRef(() => props.alignment),\n onTriggerPositionChange() {\n close()\n }\n})\n\nwatch(triggerDom, (dom) => {\n // TODO: 看起来不是很优雅\n if (dom?.nodeType === Node.ELEMENT_NODE && visible.value) {\n nextTick(() => {\n void update()\n })\n }\n})\n\n/** 外部节点 */\nconst externalNode = shallowRef<any>()\n\nonBeforeUnmount(() => {\n clearOpenTimer()\n clearCloseTimer()\n})\n</script>\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"tip.js","names":[],"sources":["../../../src/components/tip/tip.vue"],"sourcesContent":["<template>\n <!-- 触发 -->\n <UNodeRender v-bind=\"eventsHandlers\" :content=\"renderDefaultSlotTrigger()\" ref=\"triggerRef\" />\n\n <!-- 弹出内容 -->\n <teleport :to=\"`#${popperContainerId}`\">\n <transition name=\"tip\">\n <component\n v-if=\"tipVisible\"\n :is=\"contentTag\"\n :class=\"contentClass\"\n :style=\"[style, { zIndex: zIndex() }]\"\n ref=\"contentRef\"\n @mouseenter=\"eventsHandlers.onMouseenter\"\n @mouseleave=\"eventsHandlers.onMouseleave\"\n @click.stop\n v-click-outside=\"handleClickOutside\"\n >\n <UNodeRender v-if=\"externalNode\" :content=\"externalNode\" />\n\n <slot name=\"content\">{{ content }}</slot>\n\n <div :class=\"cls.e('arrow')\" v-if=\"!hideArrow\" ref=\"arrowRef\"></div>\n </component>\n </transition>\n </teleport>\n</template>\n\n<script lang=\"ts\" setup>\nimport { useFallbackProps, usePop } from '@veltra/compositions'\nimport { vClickOutside } from '@veltra/directives'\nimport { bem, extractNormalVNodes, zIndex } from '@veltra/utils'\nimport { shallowRef, computed, useSlots, onBeforeUnmount, toRef, watch, nextTick } from 'vue'\n\nimport type { TipProps, ComponentSize, TipEmits } from '../../types'\nimport { UNodeRender } from '../node-render'\nimport { useNest } from './use-nest'\n\ndefineOptions({ name: 'UTip' })\n\nconst props = withDefaults(defineProps<TipProps>(), {\n content: '',\n trigger: 'hover',\n direction: 'top',\n alignment: 'center',\n contentTag: 'div',\n visible: undefined,\n showDelay: 0\n})\n\nconst emit = defineEmits<TipEmits>()\n\nconst cls = bem('tip')\nconst slots = useSlots()\nconst { size } = useFallbackProps([props], { size: 'default' as ComponentSize })\n\nconst contentClass = computed(() => {\n const fixed = [cls.e('content'), cls.m(size.value), props.type && cls.m('color-' + props.type)]\n const className = props.class\n if (!Array.isArray(className)) {\n return [...fixed, className]\n }\n return [...fixed, ...className]\n})\n\nconst triggerRef = shallowRef<InstanceType<typeof UNodeRender>>()\nconst contentRef = shallowRef<HTMLElement>()\nconst arrowRef = shallowRef<HTMLElement>()\n\nconst _visible = shallowRef(false)\n\nconst visible = computed(() => {\n return props.visible !== undefined ? props.visible : _visible.value\n})\n\nfunction updateVisible(v: boolean) {\n if (props.visible === undefined) {\n _visible.value = v\n } else {\n emit('update:visible', v)\n }\n}\n\nconst tipVisible = useNest(visible)\n\nfunction renderDefaultSlotTrigger() {\n const nodes = slots.default?.()\n if (!nodes?.length) return null\n return extractNormalVNodes(nodes)[0]\n}\n\nconst eventsHandlers = computed(() => {\n const { trigger, disabled } = props\n\n const handlers: Record<string, Function> = {}\n\n if (disabled) return handlers\n\n if (trigger === 'click') {\n handlers.onClick = open\n } else if (trigger === 'hover') {\n handlers.onMouseenter = open\n handlers.onMouseleave = close\n }\n\n return handlers\n})\n\nconst handleClickOutside = (e: MouseEvent) => {\n if (props.trigger === 'hover') return\n\n // 点击的元素在触发元素中则啥也\n if (props.trigger === 'click' && triggerDom.value.contains(e.target as Node)) {\n return\n }\n close()\n}\n\nlet openTimer: ReturnType<typeof setTimeout> | undefined\nlet closeTimer: ReturnType<typeof setTimeout> | undefined\n\nfunction clearOpenTimer() {\n if (openTimer !== undefined) {\n clearTimeout(openTimer)\n openTimer = undefined\n }\n}\n\nfunction clearCloseTimer() {\n if (closeTimer !== undefined) {\n clearTimeout(closeTimer)\n closeTimer = undefined\n }\n}\n\n/** 弹出 */\nconst open = (e?: PointerEvent) => {\n e?.stopPropagation()\n clearCloseTimer()\n\n const delay = props.trigger === 'hover' ? props.showDelay : 0\n if (delay <= 0) {\n clearOpenTimer()\n updateVisible(true)\n return\n }\n\n clearOpenTimer()\n openTimer = setTimeout(() => {\n openTimer = undefined\n updateVisible(true)\n }, delay)\n}\n/** 关闭 */\nconst close = () => {\n clearOpenTimer()\n\n if (props.trigger === 'hover') {\n closeTimer = setTimeout(() => {\n closeTimer = undefined\n updateVisible(false)\n }, 250)\n } else {\n updateVisible(false)\n }\n}\n\nconst triggerDom = computed(() => {\n return props.triggerDom || triggerRef.value?.$el\n})\n\nconst { update, popperContainerId } = usePop({\n triggerRef: triggerDom,\n contentRef,\n arrowRef,\n direction: toRef(() => props.direction),\n alignment: toRef(() => props.alignment),\n onTriggerPositionChange() {\n close()\n }\n})\n\nwatch(triggerDom, (dom) => {\n // TODO: 看起来不是很优雅\n if (dom?.nodeType === Node.ELEMENT_NODE && visible.value) {\n nextTick(() => {\n void update()\n })\n }\n})\n\n/** 外部节点 */\nconst externalNode = shallowRef<any>()\n\nonBeforeUnmount(() => {\n clearOpenTimer()\n clearCloseTimer()\n})\n</script>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCA,MAAM,QAAQ;EAUd,MAAM,OAAO;EAEb,MAAM,MAAM,IAAI,KAAK;EACrB,MAAM,QAAQ,SAAS;EACvB,MAAM,EAAE,SAAS,iBAAiB,CAAC,KAAK,GAAG,EAAE,MAAM,UAA2B,CAAC;EAE/E,MAAM,eAAe,eAAe;GAClC,MAAM,QAAQ;IAAC,IAAI,EAAE,SAAS;IAAG,IAAI,EAAE,KAAK,KAAK;IAAG,MAAM,QAAQ,IAAI,EAAE,WAAW,MAAM,IAAI;GAAC;GAC9F,MAAM,YAAY,MAAM;GACxB,IAAI,CAAC,MAAM,QAAQ,SAAS,GAC1B,OAAO,CA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A,CAAA,CAAA;MAC5B,SAAA;MAAJ,KAAI;MACH,cAAY,eAAA,MAAe;MAC3B,cAAY,eAAA,MAAe;MAC3B,SAAK,OAAA,OAAA,OAAA,KAAA,oBAAN,CAAA,GAAW,CAAA,MAAA,CAAA;;MAGX,SAAA,cAA2D;OAAxC,aAAA,SAAnB,UAAA,GAAA,YAA2D,MAAA,UAAA,GAAA;;QAAzB,SAAS,aAAA;;OAE3C,WAAyC,KAAA,QAAA,WAAA,CAAA,SAAA,CAAjB,gBAAA,gBAAA,QAAA,OAAO,GAAA,CAAA,CAAA,CAAA;OAEK,CAAA,QAAA,aAApC,UAAA,GAAA,mBAAoE,OAAA;;QAA9D,OAAK,eAAE,MAAA,GAAA,CAAG,CAAC,EAAC,OAAA,CAAA;QAAiC,SAAA;QAAJ,KAAI;;;;;;;;;KANlC,CAAA,IAAA,CAAA,CAAA,MAAA,aAAA,GAAA,kBAAkB,CAAA,CAAA,IAAA,mBAAA,QAAA,IAAA,CAAA,CAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -102,7 +102,7 @@ import { ScrollEmits, ScrollExposed, ScrollPosition, ScrollProps, _ScrollExposed
|
|
|
102
102
|
import { WatermarkEmits, WatermarkExposed, WatermarkProps, _WatermarkExposed } from "./types/watermark.js";
|
|
103
103
|
import { ProgressEmits, ProgressExposed, ProgressProps, _ProgressExposed } from "./types/progress.js";
|
|
104
104
|
import { ProgressNodesEmits, ProgressNodesExposed, ProgressNodesProps, _ProgressNodesExposed } from "./types/progress-nodes.js";
|
|
105
|
-
import { TipAlign, TipDirection, TipEmits, TipExposed, TipProps, _TipExposed } from "./types/tip.js";
|
|
105
|
+
import { TipAlign, TipDirection, TipEmits, TipExposed, TipProps, TipType, _TipExposed } from "./types/tip.js";
|
|
106
106
|
import { PopConfirmEmits, PopConfirmExposed, PopConfirmProps, _PopConfirmExposed } from "./types/pop-confirm.js";
|
|
107
107
|
import { TabItem, TabsEmits, TabsExposed, TabsHorizontalEmits, TabsHorizontalExposed, TabsHorizontalProps, TabsProps, TabsVerticalEmits, TabsVerticalExposed, TabsVerticalProps, _TabsExposed, _TabsHorizontalExposed, _TabsVerticalExposed } from "./types/tabs.js";
|
|
108
108
|
import { BarType, TextEditorEmits, TextEditorExposed, TextEditorProps, _TextEditorExposed } from "./types/text-editor.js";
|
|
@@ -114,7 +114,7 @@ import { ButtonEmits, ButtonExposed, ButtonProps, ButtonType, _ButtonExposed } f
|
|
|
114
114
|
import { DatePanelEmits, DatePanelProps, PanelType } from "./types/date-panel.js";
|
|
115
115
|
import { DialogEmits, DialogExposed, DialogProps, DialogTransition, _DialogExposed } from "./types/dialog.js";
|
|
116
116
|
import { ActionEmits, ActionExposed, ActionGroupExposed, ActionGroupProps, ActionProps, _ActionExposed, _ActionGroupExposed } from "./types/action.js";
|
|
117
|
-
import { TableColumn, TableColumnAlign, TableColumnNode, TableColumnRenderContext, TableColumnSlotsScope, TableEmits, TableExposed, TableProps, TableRow, TableRowSlotsScope, TableSummaryContext, _TableExposed } from "./types/table.js";
|
|
117
|
+
import { TableColumn, TableColumnAlign, TableColumnNode, TableColumnRenderContext, TableColumnSlotsScope, TableColumnStyle, TableEmits, TableExposed, TableProps, TableRow, TableRowSlotsScope, TableSummaryContext, _TableExposed } from "./types/table.js";
|
|
118
118
|
import { BatchEditColumn, BatchEditEmits, BatchEditExposed, BatchEditFeature, BatchEditFormStatus, BatchEditProps, BatchEditSlots, BatchEditStates, _BatchEditExposed } from "./types/batch-edit.js";
|
|
119
119
|
import { BreadcrumbEmits, BreadcrumbExposed, BreadcrumbItem, BreadcrumbProps, BreadcrumbSlotScope, _BreadcrumbExposed } from "./types/breadcrumb.js";
|
|
120
120
|
import { ListEmits, ListExposed, ListProps, _ListExposed } from "./types/list.js";
|
|
@@ -136,7 +136,7 @@ import { MultiTreeSelectEmits, MultiTreeSelectExposed, MultiTreeSelectProps, _Mu
|
|
|
136
136
|
import { CodeEditorEmits, CodeEditorExposed, CodeEditorLang, CodeEditorProps, _CodeEditorExposed } from "./types/code-editor.js";
|
|
137
137
|
import { TextEmits, TextExposed, TextProps, _TextExposed } from "./types/text.js";
|
|
138
138
|
import { CheckboxGroupEmits, CheckboxGroupExposed, CheckboxGroupProps } from "./types/checkbox-group.js";
|
|
139
|
-
import { TableEditorEmits, TableEditorExposed, TableEditorProps, _TableEditorExposed } from "./types/table-editor.js";
|
|
139
|
+
import { TableEditorColumn, TableEditorEmits, TableEditorExposed, TableEditorProps, _TableEditorExposed } from "./types/table-editor.js";
|
|
140
140
|
import { NavEmits, NavExposed, NavItem, NavProps, _NavExposed } from "./types/nav.js";
|
|
141
141
|
import { DualNavEmits, DualNavExposed, DualNavProps, DualNavRailVariant, DualNavRootItem, _DualNavExposed } from "./types/dual-nav.js";
|
|
142
142
|
import { GroupNavEmits, GroupNavGroup, GroupNavProps } from "./types/group-nav.js";
|
|
@@ -185,4 +185,4 @@ import { defineBatchEditColumns } from "./components/batch-edit/helper.js";
|
|
|
185
185
|
import { defineTableColumns } from "./components/table/use-columns.js";
|
|
186
186
|
import "./components/index.js";
|
|
187
187
|
export * from "@veltra/utils";
|
|
188
|
-
export { type ActionEmits, type ActionExposed, type ActionGroupExposed, type ActionGroupProps, type ActionProps, type AnimationEmits, type AnimationExposed, type AnimationProps, type AutoCompleteEmits, type AutoCompleteExposed, type AutoCompleteProps, type BadgeEmits, type BadgeExposed, type BadgeProps, type BarType, type BatchEditColumn, type BatchEditEmits, type BatchEditExposed, type BatchEditFeature, type BatchEditFormStatus, type BatchEditProps, type BatchEditSlots, type BatchEditStates, type BreadcrumbEmits, type BreadcrumbExposed, type BreadcrumbItem, type BreadcrumbProps, type BreadcrumbSlotScope, type BreakCols, type Breakpoint, type ButtonEmits, type ButtonExposed, type ButtonProps, type ButtonType, type CalendarDay, type CalendarEmits, type CalendarExposed, type CalendarMonth, type CalendarProps, type CalendarYear, type CardActionProps, type CardContentProps, type CardCoverProps, type CardEmits, type CardExposed, type CardProps, type CascadeEmits, type CascadeExposed, type CascadeNode, type CascadeProps, type CheckTagEmits, type CheckTagExposed, type CheckTagProps, type CheckboxButtonEmits, type CheckboxButtonProps, type CheckboxEmits, type CheckboxExposed, type CheckboxGroupEmits, type CheckboxGroupExposed, type CheckboxGroupProps, type CheckboxProps, type CodeEditorEmits, type CodeEditorExposed, type CodeEditorLang, type CodeEditorProps, type CollapseEmits, type CollapseItemEmits, type CollapseItemProps, type CollapseModelValue, type CollapseProps, type CollapseValue, type ConditionConnector, type ConditionEditorEmits, type ConditionEditorExposed, type ConditionEditorProps, type EvaluateOptions as ConditionEvaluateOptions, type ConditionExpression, type ConditionField, type ConditionGroup, type ConditionLeaf, type ConditionNode, type ConditionValue, type ContextmenuEmits, type ContextmenuExposed, type ContextmenuItem, ContextmenuPanelDIKey, type ContextmenuProps, ContextmenuRootDIKey, type CssTransitionEmits, type CssTransitionExposed, type CssTransitionProps, type DatePanelEmits, type DatePanelProps, type DatePickerDataType, type DatePickerEmits, type DatePickerExposed, type DatePickerProps, type DateRangePickerDataType, type DateRangePickerEmits, type DateRangePickerExposed, type DateRangePickerProps, type DateRangeValue, type DialogEmits, type DialogExposed, type DialogProps, type DialogTransition, type DrawerDirection, type DrawerEmits, type DrawerExposed, type DrawerMode, type DrawerProps, type DropdownEmits, type DropdownExposed, type DropdownProps, type DualNavEmits, type DualNavExposed, type DualNavProps, type DualNavRailVariant, type DualNavRootItem, type EmptyEmits, type EmptyExposed, type EmptyProps, type ExpressionEditorEmits, type ExpressionEditorExposed, type ExpressionEditorProps, type ExpressionSelectableLevels, type FileViewerEmits, type FileViewerExposed, type FileViewerItem, type FileViewerKind, type FileViewerProps, type FloatButtonEmits, type FloatButtonExposed, type FloatButtonItem, type FloatButtonProps, type FormEmits, type FormExposed, type FormItemEmits, type FormItemExposed, type FormItemProps, type FormProps, type GanttChartEmits, type GanttChartExposed, type GanttChartProps, type GridEmits, type GridExposed, type GridInputEmits, type GridInputExposed, type GridInputProps, type GridItemProps, type GridProps, type GroupInputEmits, type GroupInputExposed, type GroupInputProps, type GroupNavEmits, type GroupNavGroup, type GroupNavProps, type IconEmits, type IconExposed, type IconProps, type ImageCropperChangePayload, type ImageCropperCropTransform, type ImageCropperEmits, type ImageCropperExposed, type ImageCropperProps, type ImageCropperResult, type ImageCropperResultOptions, type ImageCropperSelection, type InputEmits, type InputExposed, type InputProps, type LayoutEmits, type LayoutExposed, type LayoutProps, type ListEmits, type ListExposed, type ListProps, type LoadingEmits, type LoadingExposed, type LoadingProps, type LoadingType, type Message, type MessageConfirm, type MessageConfirmAction, type MessageConfirmEmits, type MessageConfirmExposed, type MessageConfirmInstance, type MessageConfirmOptions, type MessageConfirmProps, type MessageEmits, type MessageExposed, type MessageInstance, type MessageOptions, type MessageProps, type MessageType, type MultiAutoCompleteEmits, type MultiAutoCompleteExposed, type MultiAutoCompleteProps, type MultiSelectEmits, type MultiSelectExposed, type MultiSelectProps, type MultiTreeSelectEmits, type MultiTreeSelectExposed, type MultiTreeSelectProps, type NavEmits, type NavExposed, type NavItem, type NavProps, type NodeRenderExposed, type NodeRenderProps, type Notification, type NotificationEmits, type NotificationExposed, type NotificationInstance, type NotificationOptions, type NotificationPosition, type NotificationProps, type NumberEmits, type NumberExposed, type NumberInputEmits, type NumberInputExposed, type NumberInputProps, type NumberProps, type NumberRangeInputEmits, type NumberRangeInputExposed, type NumberRangeInputProps, type NumberRangeTuple, type PaginatorEmits, type PaginatorExposed, type PaginatorProps, type PaletteColorType, type PaletteEmits, type PaletteExposed, type PaletteHSV, type PaletteProps, type PaletteRGB, type PanelItem, type PanelType, type PasswordInputEmits, type PasswordInputExposed, type PasswordInputProps, type PopConfirmEmits, type PopConfirmExposed, type PopConfirmProps, type PopEmits, type PopExposed, type PopProps, type ProgressEmits, type ProgressExposed, type ProgressNodesEmits, type ProgressNodesExposed, type ProgressNodesProps, type ProgressProps, type QuickBatchEditEmits, type QuickBatchEditExposed, type QuickBatchEditProps, type RadioEmits, type RadioExposed, type RadioGroupEmits, type RadioGroupExposed, type RadioGroupProps, type RadioProps, type RichTextEditorEmits, type RichTextEditorExposed, type RichTextEditorProps, type RichTextFormat, type ScrollEmits, type ScrollExposed, type ScrollPosition, type ScrollProps, type SegmentEmits, type SegmentExposed, type SegmentItem, type SegmentProps, type SelectEmits, type SelectExposed, type SelectProps, type SliderEmits, type SliderExposed, type SliderProps, type StepsEmits, type StepsExposed, type StepsProps, type StepsSlotScope, type SwitchEmits, type SwitchExposed, type SwitchProps, type TabItem, type TableColumn, type TableColumnAlign, type TableColumnNode, type TableColumnRenderContext, type TableColumnSlotsScope, type TableEditorEmits, type TableEditorExposed, type TableEditorProps, type TableEmits, type TableExposed, type TableProps, type TableRow, type TableRowSlotsScope, type TableSummaryContext, type TabsEmits, type TabsExposed, type TabsHorizontalEmits, type TabsHorizontalExposed, type TabsHorizontalProps, type TabsProps, type TabsVerticalEmits, type TabsVerticalExposed, type TabsVerticalProps, type TagEmits, type TagExposed, type TagProps, type TextEditorEmits, type TextEditorExposed, type TextEditorProps, type TextEmits, type TextExposed, type TextProps, type TextareaEmits, type TextareaExposed, type TextareaProps, type ThemeExposed, type ThemeProps, type TipAlign, type TipDirection, type TipEmits, type TipExposed, type TipProps, type ToolbarItem, type TreeEmit, type TreeExposed, type TreeNode, type TreeNodeProps, type TreeProps, type TreeSelectEmits, type TreeSelectExposed, type TreeSelectProps, _sfc_main as UAction, action_group_default as UActionGroup, _sfc_main$1 as UAutoComplete, _sfc_main$2 as UBadge, _sfc_main$3 as UBatchEdit, _sfc_main$4 as UBreadcrumb, _sfc_main$5 as UButton, _sfc_main$6 as UButtonGroup, _sfc_main$7 as UCalendar, _sfc_main$8 as UCard, _sfc_main$9 as UCardAction, _sfc_main$10 as UCardContent, _sfc_main$11 as UCardCover, _sfc_main$12 as UCardHeader, _sfc_main$13 as UCascade, _sfc_main$14 as UCheckTag, _sfc_main$15 as UCheckbox, _sfc_main$16 as UCheckboxButton, _sfc_main$17 as UCheckboxGroup, _sfc_main$18 as UCodeEditor, _sfc_main$19 as UCollapse, _sfc_main$20 as UCollapseItem, _sfc_main$21 as UConditionEditor, _sfc_main$22 as UContextmenu, _sfc_main$23 as UDatePanel, _sfc_main$24 as UDatePicker, _sfc_main$25 as UDateRangePicker, _sfc_main$26 as UDialog, _sfc_main$27 as UDrawer, _sfc_main$28 as UDropdown, _sfc_main$29 as UDualNav, _sfc_main$30 as UEmpty, _sfc_main$31 as UExpressionEditor, _sfc_main$32 as UFilePicker, _sfc_main$33 as UFileViewer, _sfc_main$34 as UFloatButton, form_default as UForm, form_item_default as UFormItem, _sfc_main$35 as UGanttChart, _sfc_main$36 as UGrid, _sfc_main$37 as UGridInput, _sfc_main$38 as UGridItem, _sfc_main$39 as UGroupInput, _sfc_main$40 as UGroupNav, _sfc_main$41 as UIcon, _sfc_main$42 as UImageCropper, input_default as UInput, _sfc_main$43 as UKbd, _sfc_main$44 as ULayout, _sfc_main$45 as UList, _sfc_main$46 as UListItem, _sfc_main$47 as ULoading, _sfc_main$48 as UMessage, _sfc_main$49 as UMessageConfirm, _sfc_main$50 as UMultiSelect, _sfc_main$51 as UMultiTreeSelect, _sfc_main$52 as UNav, _sfc_main$53 as UNavItem, _sfc_main$54 as UNavSub, NodeRender as UNodeRender, _sfc_main$55 as UNotification, _sfc_main$56 as UNumber, _sfc_main$57 as UNumberInput, _sfc_main$58 as UNumberRangeInput, _sfc_main$59 as UPaginator, _sfc_main$60 as UPalette, _sfc_main$61 as UPasswordInput, _sfc_main$62 as UPopConfirm, _sfc_main$63 as UProgress, _sfc_main$64 as UProgressNodes, _sfc_main$65 as URadio, _sfc_main$66 as URadioGroup, _sfc_main$67 as URichTextEditor, _sfc_main$68 as UScroll, _sfc_main$69 as USegment, _sfc_main$70 as USelect, _sfc_main$71 as USlider, _sfc_main$72 as USteps, _sfc_main$73 as USwitch, _sfc_main$74 as UTable, _sfc_main$75 as UTableEditor, _sfc_main$76 as UTabs, _sfc_main$77 as UTabsHorizontal, _sfc_main$78 as UTabsVertical, _sfc_main$79 as UTag, _sfc_main$80 as UText, _sfc_main$81 as UTextarea, _sfc_main$82 as UTheme, _sfc_main$83 as UTip, _sfc_main$84 as UTree, _sfc_main$85 as UTreeSelect, _sfc_main$86 as UWatermark, type UploaderEmits, type UploaderExposed, type UploaderProps, type VariableItem, type WatermarkEmits, type WatermarkExposed, type WatermarkProps, type _ActionExposed, type _ActionGroupExposed, type _AnimationExposed, type _AutoCompleteExposed, type _BadgeExposed, type _BatchEditExposed, type _BreadcrumbExposed, type _ButtonExposed, type _CalendarExposed, type _CardExposed, type _CascadeExposed, type _CheckTagExposed, type _CodeEditorExposed, type _ConditionEditorExposed, type _ContextmenuExposed, type _CssTransitionExposed, type _DatePickerExposed, type _DateRangePickerExposed, type _DialogExposed, type _DrawerExposed, type _DropdownExposed, type _DualNavExposed, type _EmptyExposed, type _ExpressionEditorExposed, type _FileViewerExposed, type _FloatButtonExposed, type _FormExposed, type _GanttChartExposed, type _GridExposed, type _GridInputExposed, type _GroupInputExposed, type _ImageCropperExposed, type _InputExposed, type _LayoutExposed, type _ListExposed, type _LoadingExposed, type _MessageConfirmExposed, type _MessageExposed, type _MultiAutoCompleteExposed, type _MultiSelectExposed, type _MultiTreeSelectExposed, type _NavExposed, type _NotificationExposed, type _PaginatorExposed, type _PaletteExposed, type _PasswordInputExposed, type _PopConfirmExposed, type _PopExposed, type _ProgressExposed, type _ProgressNodesExposed, type _QuickBatchEditExposed, type _RadioExposed, type _RadioGroupExposed, type _RichTextEditorExposed, type _ScrollExposed, type _SegmentExposed, type _SelectExposed, type _SliderExposed, type _StepsExposed, type _SwitchExposed, type _TableEditorExposed, type _TableExposed, type _TabsExposed, type _TabsHorizontalExposed, type _TabsVerticalExposed, type _TextEditorExposed, type _TextExposed, type _TextareaExposed, type _ThemeExposed, type _TipExposed, type _TreeExposed, type _TreeSelectExposed, type _UploaderExposed, type _WatermarkExposed, contextmenu, createEmptyGroup, createEmptyLeaf, defineBatchEditColumns, defineTableColumns, evaluate as evaluateConditionExpression, message, messageConfirm, notification, vLoading };
|
|
188
|
+
export { type ActionEmits, type ActionExposed, type ActionGroupExposed, type ActionGroupProps, type ActionProps, type AnimationEmits, type AnimationExposed, type AnimationProps, type AutoCompleteEmits, type AutoCompleteExposed, type AutoCompleteProps, type BadgeEmits, type BadgeExposed, type BadgeProps, type BarType, type BatchEditColumn, type BatchEditEmits, type BatchEditExposed, type BatchEditFeature, type BatchEditFormStatus, type BatchEditProps, type BatchEditSlots, type BatchEditStates, type BreadcrumbEmits, type BreadcrumbExposed, type BreadcrumbItem, type BreadcrumbProps, type BreadcrumbSlotScope, type BreakCols, type Breakpoint, type ButtonEmits, type ButtonExposed, type ButtonProps, type ButtonType, type CalendarDay, type CalendarEmits, type CalendarExposed, type CalendarMonth, type CalendarProps, type CalendarYear, type CardActionProps, type CardContentProps, type CardCoverProps, type CardEmits, type CardExposed, type CardProps, type CascadeEmits, type CascadeExposed, type CascadeNode, type CascadeProps, type CheckTagEmits, type CheckTagExposed, type CheckTagProps, type CheckboxButtonEmits, type CheckboxButtonProps, type CheckboxEmits, type CheckboxExposed, type CheckboxGroupEmits, type CheckboxGroupExposed, type CheckboxGroupProps, type CheckboxProps, type CodeEditorEmits, type CodeEditorExposed, type CodeEditorLang, type CodeEditorProps, type CollapseEmits, type CollapseItemEmits, type CollapseItemProps, type CollapseModelValue, type CollapseProps, type CollapseValue, type ConditionConnector, type ConditionEditorEmits, type ConditionEditorExposed, type ConditionEditorProps, type EvaluateOptions as ConditionEvaluateOptions, type ConditionExpression, type ConditionField, type ConditionGroup, type ConditionLeaf, type ConditionNode, type ConditionValue, type ContextmenuEmits, type ContextmenuExposed, type ContextmenuItem, ContextmenuPanelDIKey, type ContextmenuProps, ContextmenuRootDIKey, type CssTransitionEmits, type CssTransitionExposed, type CssTransitionProps, type DatePanelEmits, type DatePanelProps, type DatePickerDataType, type DatePickerEmits, type DatePickerExposed, type DatePickerProps, type DateRangePickerDataType, type DateRangePickerEmits, type DateRangePickerExposed, type DateRangePickerProps, type DateRangeValue, type DialogEmits, type DialogExposed, type DialogProps, type DialogTransition, type DrawerDirection, type DrawerEmits, type DrawerExposed, type DrawerMode, type DrawerProps, type DropdownEmits, type DropdownExposed, type DropdownProps, type DualNavEmits, type DualNavExposed, type DualNavProps, type DualNavRailVariant, type DualNavRootItem, type EmptyEmits, type EmptyExposed, type EmptyProps, type ExpressionEditorEmits, type ExpressionEditorExposed, type ExpressionEditorProps, type ExpressionSelectableLevels, type FileViewerEmits, type FileViewerExposed, type FileViewerItem, type FileViewerKind, type FileViewerProps, type FloatButtonEmits, type FloatButtonExposed, type FloatButtonItem, type FloatButtonProps, type FormEmits, type FormExposed, type FormItemEmits, type FormItemExposed, type FormItemProps, type FormProps, type GanttChartEmits, type GanttChartExposed, type GanttChartProps, type GridEmits, type GridExposed, type GridInputEmits, type GridInputExposed, type GridInputProps, type GridItemProps, type GridProps, type GroupInputEmits, type GroupInputExposed, type GroupInputProps, type GroupNavEmits, type GroupNavGroup, type GroupNavProps, type IconEmits, type IconExposed, type IconProps, type ImageCropperChangePayload, type ImageCropperCropTransform, type ImageCropperEmits, type ImageCropperExposed, type ImageCropperProps, type ImageCropperResult, type ImageCropperResultOptions, type ImageCropperSelection, type InputEmits, type InputExposed, type InputProps, type LayoutEmits, type LayoutExposed, type LayoutProps, type ListEmits, type ListExposed, type ListProps, type LoadingEmits, type LoadingExposed, type LoadingProps, type LoadingType, type Message, type MessageConfirm, type MessageConfirmAction, type MessageConfirmEmits, type MessageConfirmExposed, type MessageConfirmInstance, type MessageConfirmOptions, type MessageConfirmProps, type MessageEmits, type MessageExposed, type MessageInstance, type MessageOptions, type MessageProps, type MessageType, type MultiAutoCompleteEmits, type MultiAutoCompleteExposed, type MultiAutoCompleteProps, type MultiSelectEmits, type MultiSelectExposed, type MultiSelectProps, type MultiTreeSelectEmits, type MultiTreeSelectExposed, type MultiTreeSelectProps, type NavEmits, type NavExposed, type NavItem, type NavProps, type NodeRenderExposed, type NodeRenderProps, type Notification, type NotificationEmits, type NotificationExposed, type NotificationInstance, type NotificationOptions, type NotificationPosition, type NotificationProps, type NumberEmits, type NumberExposed, type NumberInputEmits, type NumberInputExposed, type NumberInputProps, type NumberProps, type NumberRangeInputEmits, type NumberRangeInputExposed, type NumberRangeInputProps, type NumberRangeTuple, type PaginatorEmits, type PaginatorExposed, type PaginatorProps, type PaletteColorType, type PaletteEmits, type PaletteExposed, type PaletteHSV, type PaletteProps, type PaletteRGB, type PanelItem, type PanelType, type PasswordInputEmits, type PasswordInputExposed, type PasswordInputProps, type PopConfirmEmits, type PopConfirmExposed, type PopConfirmProps, type PopEmits, type PopExposed, type PopProps, type ProgressEmits, type ProgressExposed, type ProgressNodesEmits, type ProgressNodesExposed, type ProgressNodesProps, type ProgressProps, type QuickBatchEditEmits, type QuickBatchEditExposed, type QuickBatchEditProps, type RadioEmits, type RadioExposed, type RadioGroupEmits, type RadioGroupExposed, type RadioGroupProps, type RadioProps, type RichTextEditorEmits, type RichTextEditorExposed, type RichTextEditorProps, type RichTextFormat, type ScrollEmits, type ScrollExposed, type ScrollPosition, type ScrollProps, type SegmentEmits, type SegmentExposed, type SegmentItem, type SegmentProps, type SelectEmits, type SelectExposed, type SelectProps, type SliderEmits, type SliderExposed, type SliderProps, type StepsEmits, type StepsExposed, type StepsProps, type StepsSlotScope, type SwitchEmits, type SwitchExposed, type SwitchProps, type TabItem, type TableColumn, type TableColumnAlign, type TableColumnNode, type TableColumnRenderContext, type TableColumnSlotsScope, type TableColumnStyle, type TableEditorColumn, type TableEditorEmits, type TableEditorExposed, type TableEditorProps, type TableEmits, type TableExposed, type TableProps, type TableRow, type TableRowSlotsScope, type TableSummaryContext, type TabsEmits, type TabsExposed, type TabsHorizontalEmits, type TabsHorizontalExposed, type TabsHorizontalProps, type TabsProps, type TabsVerticalEmits, type TabsVerticalExposed, type TabsVerticalProps, type TagEmits, type TagExposed, type TagProps, type TextEditorEmits, type TextEditorExposed, type TextEditorProps, type TextEmits, type TextExposed, type TextProps, type TextareaEmits, type TextareaExposed, type TextareaProps, type ThemeExposed, type ThemeProps, type TipAlign, type TipDirection, type TipEmits, type TipExposed, type TipProps, type TipType, type ToolbarItem, type TreeEmit, type TreeExposed, type TreeNode, type TreeNodeProps, type TreeProps, type TreeSelectEmits, type TreeSelectExposed, type TreeSelectProps, _sfc_main as UAction, action_group_default as UActionGroup, _sfc_main$1 as UAutoComplete, _sfc_main$2 as UBadge, _sfc_main$3 as UBatchEdit, _sfc_main$4 as UBreadcrumb, _sfc_main$5 as UButton, _sfc_main$6 as UButtonGroup, _sfc_main$7 as UCalendar, _sfc_main$8 as UCard, _sfc_main$9 as UCardAction, _sfc_main$10 as UCardContent, _sfc_main$11 as UCardCover, _sfc_main$12 as UCardHeader, _sfc_main$13 as UCascade, _sfc_main$14 as UCheckTag, _sfc_main$15 as UCheckbox, _sfc_main$16 as UCheckboxButton, _sfc_main$17 as UCheckboxGroup, _sfc_main$18 as UCodeEditor, _sfc_main$19 as UCollapse, _sfc_main$20 as UCollapseItem, _sfc_main$21 as UConditionEditor, _sfc_main$22 as UContextmenu, _sfc_main$23 as UDatePanel, _sfc_main$24 as UDatePicker, _sfc_main$25 as UDateRangePicker, _sfc_main$26 as UDialog, _sfc_main$27 as UDrawer, _sfc_main$28 as UDropdown, _sfc_main$29 as UDualNav, _sfc_main$30 as UEmpty, _sfc_main$31 as UExpressionEditor, _sfc_main$32 as UFilePicker, _sfc_main$33 as UFileViewer, _sfc_main$34 as UFloatButton, form_default as UForm, form_item_default as UFormItem, _sfc_main$35 as UGanttChart, _sfc_main$36 as UGrid, _sfc_main$37 as UGridInput, _sfc_main$38 as UGridItem, _sfc_main$39 as UGroupInput, _sfc_main$40 as UGroupNav, _sfc_main$41 as UIcon, _sfc_main$42 as UImageCropper, input_default as UInput, _sfc_main$43 as UKbd, _sfc_main$44 as ULayout, _sfc_main$45 as UList, _sfc_main$46 as UListItem, _sfc_main$47 as ULoading, _sfc_main$48 as UMessage, _sfc_main$49 as UMessageConfirm, _sfc_main$50 as UMultiSelect, _sfc_main$51 as UMultiTreeSelect, _sfc_main$52 as UNav, _sfc_main$53 as UNavItem, _sfc_main$54 as UNavSub, NodeRender as UNodeRender, _sfc_main$55 as UNotification, _sfc_main$56 as UNumber, _sfc_main$57 as UNumberInput, _sfc_main$58 as UNumberRangeInput, _sfc_main$59 as UPaginator, _sfc_main$60 as UPalette, _sfc_main$61 as UPasswordInput, _sfc_main$62 as UPopConfirm, _sfc_main$63 as UProgress, _sfc_main$64 as UProgressNodes, _sfc_main$65 as URadio, _sfc_main$66 as URadioGroup, _sfc_main$67 as URichTextEditor, _sfc_main$68 as UScroll, _sfc_main$69 as USegment, _sfc_main$70 as USelect, _sfc_main$71 as USlider, _sfc_main$72 as USteps, _sfc_main$73 as USwitch, _sfc_main$74 as UTable, _sfc_main$75 as UTableEditor, _sfc_main$76 as UTabs, _sfc_main$77 as UTabsHorizontal, _sfc_main$78 as UTabsVertical, _sfc_main$79 as UTag, _sfc_main$80 as UText, _sfc_main$81 as UTextarea, _sfc_main$82 as UTheme, _sfc_main$83 as UTip, _sfc_main$84 as UTree, _sfc_main$85 as UTreeSelect, _sfc_main$86 as UWatermark, type UploaderEmits, type UploaderExposed, type UploaderProps, type VariableItem, type WatermarkEmits, type WatermarkExposed, type WatermarkProps, type _ActionExposed, type _ActionGroupExposed, type _AnimationExposed, type _AutoCompleteExposed, type _BadgeExposed, type _BatchEditExposed, type _BreadcrumbExposed, type _ButtonExposed, type _CalendarExposed, type _CardExposed, type _CascadeExposed, type _CheckTagExposed, type _CodeEditorExposed, type _ConditionEditorExposed, type _ContextmenuExposed, type _CssTransitionExposed, type _DatePickerExposed, type _DateRangePickerExposed, type _DialogExposed, type _DrawerExposed, type _DropdownExposed, type _DualNavExposed, type _EmptyExposed, type _ExpressionEditorExposed, type _FileViewerExposed, type _FloatButtonExposed, type _FormExposed, type _GanttChartExposed, type _GridExposed, type _GridInputExposed, type _GroupInputExposed, type _ImageCropperExposed, type _InputExposed, type _LayoutExposed, type _ListExposed, type _LoadingExposed, type _MessageConfirmExposed, type _MessageExposed, type _MultiAutoCompleteExposed, type _MultiSelectExposed, type _MultiTreeSelectExposed, type _NavExposed, type _NotificationExposed, type _PaginatorExposed, type _PaletteExposed, type _PasswordInputExposed, type _PopConfirmExposed, type _PopExposed, type _ProgressExposed, type _ProgressNodesExposed, type _QuickBatchEditExposed, type _RadioExposed, type _RadioGroupExposed, type _RichTextEditorExposed, type _ScrollExposed, type _SegmentExposed, type _SelectExposed, type _SliderExposed, type _StepsExposed, type _SwitchExposed, type _TableEditorExposed, type _TableExposed, type _TabsExposed, type _TabsHorizontalExposed, type _TabsVerticalExposed, type _TextEditorExposed, type _TextExposed, type _TextareaExposed, type _ThemeExposed, type _TipExposed, type _TreeExposed, type _TreeSelectExposed, type _UploaderExposed, type _WatermarkExposed, contextmenu, createEmptyGroup, createEmptyLeaf, defineBatchEditColumns, defineTableColumns, evaluate as evaluateConditionExpression, message, messageConfirm, notification, vLoading };
|
package/dist/install.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import "./style.js";
|
|
2
2
|
import { App, Plugin } from "vue";
|
|
3
3
|
//#region src/install.d.ts
|
|
4
|
-
declare function install(app: App): void;
|
|
5
|
-
declare const UltraUI: Plugin;
|
|
4
|
+
export declare function install(app: App): void;
|
|
5
|
+
export declare const UltraUI: Plugin;
|
|
6
6
|
//#endregion
|
|
7
|
-
export { UltraUI
|
|
7
|
+
export { UltraUI as default };
|
|
8
8
|
//# sourceMappingURL=install.d.ts.map
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { parseNumberList } from "./ctm.js";
|
|
2
|
+
//#region ../ofd-core/dist/color.js
|
|
3
|
+
/**
|
|
4
|
+
* OFD 颜色解析(GB/T 33190 颜色描述)转 CSS 颜色。
|
|
5
|
+
*
|
|
6
|
+
* 支持的声明形式:
|
|
7
|
+
* - `#RRGGBB`:CSS 十六进制,原样返回
|
|
8
|
+
* - 灰度:`g 128` / `gray 128` / 单个数值 `128`
|
|
9
|
+
* - RGB:`rgb 255 0 0` / `255 0 0` / 逗号分隔 `255,0,0`
|
|
10
|
+
* - CMYK:`cmyk 0 255 255 0` / `0 255 255 0`,转 RGB 输出
|
|
11
|
+
* - 末尾可带一个透明度通道(0-255),有则输出 `rgba()`
|
|
12
|
+
*/
|
|
13
|
+
/** 解析 OFD 颜色声明为 CSS 颜色;无法识别返回 null,由调用方决定默认值 */
|
|
14
|
+
function parseOfdColor(value) {
|
|
15
|
+
const text = value?.trim();
|
|
16
|
+
if (!text) return null;
|
|
17
|
+
if (text.startsWith("#")) return text;
|
|
18
|
+
const tokens = text.toLowerCase().split(/[\s,]+/).filter((token) => token !== "");
|
|
19
|
+
if (tokens.length === 0) return null;
|
|
20
|
+
const named = CHANNEL_COUNT_BY_NAME[tokens[0]];
|
|
21
|
+
if (named !== void 0) return toCssColor(tokens.slice(1), named);
|
|
22
|
+
const channelCount = UNNAMED_CHANNEL_COUNT[tokens.length];
|
|
23
|
+
return channelCount === void 0 ? null : toCssColor(tokens, channelCount);
|
|
24
|
+
}
|
|
25
|
+
const CHANNEL_COUNT_BY_NAME = {
|
|
26
|
+
g: 1,
|
|
27
|
+
gray: 1,
|
|
28
|
+
rgb: 3,
|
|
29
|
+
cmyk: 4
|
|
30
|
+
};
|
|
31
|
+
/** 无前缀时按数值个数推断通道数;末位可能是透明度通道 */
|
|
32
|
+
const UNNAMED_CHANNEL_COUNT = {
|
|
33
|
+
1: 1,
|
|
34
|
+
2: 1,
|
|
35
|
+
3: 3,
|
|
36
|
+
4: 4,
|
|
37
|
+
5: 4
|
|
38
|
+
};
|
|
39
|
+
/** 按通道数把 0-255 通道值列表转成 CSS 颜色;末位之后的透明度通道可选 */
|
|
40
|
+
function toCssColor(tokens, channels) {
|
|
41
|
+
const values = parseNumberList(tokens.join(" "));
|
|
42
|
+
if (values.length < channels || values.length > channels + 1) return null;
|
|
43
|
+
const clamped = values.map((value) => Math.round(Math.min(255, Math.max(0, value))));
|
|
44
|
+
const alpha = values.length === channels + 1 ? clamped[channels] / 255 : null;
|
|
45
|
+
const [r, g, b] = channels === 1 ? [
|
|
46
|
+
clamped[0],
|
|
47
|
+
clamped[0],
|
|
48
|
+
clamped[0]
|
|
49
|
+
] : toRgb(clamped, channels);
|
|
50
|
+
return alpha === null ? `rgb(${r} ${g} ${b})` : `rgba(${r} ${g} ${b} / ${+alpha.toFixed(3)})`;
|
|
51
|
+
}
|
|
52
|
+
/** CMYK 转 RGB:r = 255·(1−c)·(1−k);channels 为 3 时直取 RGB */
|
|
53
|
+
function toRgb(clamped, channels) {
|
|
54
|
+
if (channels === 3) return [
|
|
55
|
+
clamped[0],
|
|
56
|
+
clamped[1],
|
|
57
|
+
clamped[2]
|
|
58
|
+
];
|
|
59
|
+
const [c, m, y, k] = clamped;
|
|
60
|
+
return [
|
|
61
|
+
Math.round(255 * (1 - c / 255) * (1 - k / 255)),
|
|
62
|
+
Math.round(255 * (1 - m / 255) * (1 - k / 255)),
|
|
63
|
+
Math.round(255 * (1 - y / 255) * (1 - k / 255))
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { parseOfdColor };
|
|
68
|
+
|
|
69
|
+
//# sourceMappingURL=color.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"color.js","names":[],"sources":["../../../../../ofd-core/dist/color.js"],"sourcesContent":["import { parseNumberList } from \"./ctm.js\";\n//#region src/color.ts\n/**\n* OFD 颜色解析(GB/T 33190 颜色描述)转 CSS 颜色。\n*\n* 支持的声明形式:\n* - `#RRGGBB`:CSS 十六进制,原样返回\n* - 灰度:`g 128` / `gray 128` / 单个数值 `128`\n* - RGB:`rgb 255 0 0` / `255 0 0` / 逗号分隔 `255,0,0`\n* - CMYK:`cmyk 0 255 255 0` / `0 255 255 0`,转 RGB 输出\n* - 末尾可带一个透明度通道(0-255),有则输出 `rgba()`\n*/\n/** 解析 OFD 颜色声明为 CSS 颜色;无法识别返回 null,由调用方决定默认值 */\nfunction parseOfdColor(value) {\n\tconst text = value?.trim();\n\tif (!text) return null;\n\tif (text.startsWith(\"#\")) return text;\n\tconst tokens = text.toLowerCase().split(/[\\s,]+/).filter((token) => token !== \"\");\n\tif (tokens.length === 0) return null;\n\tconst named = CHANNEL_COUNT_BY_NAME[tokens[0]];\n\tif (named !== void 0) return toCssColor(tokens.slice(1), named);\n\tconst channelCount = UNNAMED_CHANNEL_COUNT[tokens.length];\n\treturn channelCount === void 0 ? null : toCssColor(tokens, channelCount);\n}\nconst CHANNEL_COUNT_BY_NAME = {\n\tg: 1,\n\tgray: 1,\n\trgb: 3,\n\tcmyk: 4\n};\n/** 无前缀时按数值个数推断通道数;末位可能是透明度通道 */\nconst UNNAMED_CHANNEL_COUNT = {\n\t1: 1,\n\t2: 1,\n\t3: 3,\n\t4: 4,\n\t5: 4\n};\n/** 按通道数把 0-255 通道值列表转成 CSS 颜色;末位之后的透明度通道可选 */\nfunction toCssColor(tokens, channels) {\n\tconst values = parseNumberList(tokens.join(\" \"));\n\tif (values.length < channels || values.length > channels + 1) return null;\n\tconst clamped = values.map((value) => Math.round(Math.min(255, Math.max(0, value))));\n\tconst alpha = values.length === channels + 1 ? clamped[channels] / 255 : null;\n\tconst [r, g, b] = channels === 1 ? [\n\t\tclamped[0],\n\t\tclamped[0],\n\t\tclamped[0]\n\t] : toRgb(clamped, channels);\n\treturn alpha === null ? `rgb(${r} ${g} ${b})` : `rgba(${r} ${g} ${b} / ${+alpha.toFixed(3)})`;\n}\n/** CMYK 转 RGB:r = 255·(1−c)·(1−k);channels 为 3 时直取 RGB */\nfunction toRgb(clamped, channels) {\n\tif (channels === 3) return [\n\t\tclamped[0],\n\t\tclamped[1],\n\t\tclamped[2]\n\t];\n\tconst [c, m, y, k] = clamped;\n\treturn [\n\t\tMath.round(255 * (1 - c / 255) * (1 - k / 255)),\n\t\tMath.round(255 * (1 - m / 255) * (1 - k / 255)),\n\t\tMath.round(255 * (1 - y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AAE,GAAG,EAAE,KAAK,CAAC,MAAM,QAAQ,CAAC,EAAE;AAC5F;;AAEA,SAAS,MAAM,SAAS,UAAU;CACjC,IAAI,aAAa,GAAG,OAAO;EAC1B,QAAQ;EACR,QAAQ;EACR,QAAQ;CACT;CACA,MAAM,CAAC,GAAG,GAAG,GAAG,KAAK;CACrB,OAAO;EACN,KAAK,MAAM,OAAO,IAAI,IAAI,QAAQ,IAAI,IAAI,IAAI;EAC9C,KAAK,MAAM,OAAO,IAAI,IAAI,QAAQ,IAAI,IAAI,IAAI;EAC9C,KAAK,MAAM,OAAO,IAAI,IAAI,QAAQ,IAAI,IAAI,IAAI;CAC/C;AACD"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//#region ../ofd-core/dist/ctm.js
|
|
2
|
+
/** 单位矩阵:不改变任何坐标 */
|
|
3
|
+
const IDENTITY_MATRIX = [
|
|
4
|
+
1,
|
|
5
|
+
0,
|
|
6
|
+
0,
|
|
7
|
+
1,
|
|
8
|
+
0,
|
|
9
|
+
0
|
|
10
|
+
];
|
|
11
|
+
/** 矩阵乘法:`multiplyMatrix(outer, inner)` 等价于先 inner 后 outer */
|
|
12
|
+
function multiplyMatrix(outer, inner) {
|
|
13
|
+
const [a1, b1, c1, d1, e1, f1] = outer;
|
|
14
|
+
const [a2, b2, c2, d2, e2, f2] = inner;
|
|
15
|
+
return [
|
|
16
|
+
a1 * a2 + c1 * b2,
|
|
17
|
+
b1 * a2 + d1 * b2,
|
|
18
|
+
a1 * c2 + c1 * d2,
|
|
19
|
+
b1 * c2 + d1 * d2,
|
|
20
|
+
a1 * e2 + c1 * f2 + e1,
|
|
21
|
+
b1 * e2 + d1 * f2 + f1
|
|
22
|
+
];
|
|
23
|
+
}
|
|
24
|
+
/** 解析 `CTM` 属性;缺失或不合法返回 null(渲染时按单位矩阵处理) */
|
|
25
|
+
function parseMatrix(value) {
|
|
26
|
+
const numbers = parseNumberList(value);
|
|
27
|
+
return numbers.length === 6 ? [
|
|
28
|
+
numbers[0],
|
|
29
|
+
numbers[1],
|
|
30
|
+
numbers[2],
|
|
31
|
+
numbers[3],
|
|
32
|
+
numbers[4],
|
|
33
|
+
numbers[5]
|
|
34
|
+
] : null;
|
|
35
|
+
}
|
|
36
|
+
/** 解析 `Boundary="x y w h"` 属性;缺失或不完整返回 null */
|
|
37
|
+
function parseBoundary(value) {
|
|
38
|
+
const numbers = parseNumberList(value);
|
|
39
|
+
if (numbers.length !== 4) return null;
|
|
40
|
+
return {
|
|
41
|
+
x: numbers[0],
|
|
42
|
+
y: numbers[1],
|
|
43
|
+
width: numbers[2],
|
|
44
|
+
height: numbers[3]
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
/** 按空白或逗号切分数值列表(CTM / Boundary / DeltaX / DashPattern 共用) */
|
|
48
|
+
function parseNumberList(value) {
|
|
49
|
+
if (!value) return [];
|
|
50
|
+
return value.trim().split(/[\s,]+/).filter((token) => token !== "").map((token) => Number(token)).filter((number) => Number.isFinite(number));
|
|
51
|
+
}
|
|
52
|
+
//#endregion
|
|
53
|
+
export { IDENTITY_MATRIX, multiplyMatrix, parseBoundary, parseMatrix, parseNumberList };
|
|
54
|
+
|
|
55
|
+
//# sourceMappingURL=ctm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ctm.js","names":[],"sources":["../../../../../ofd-core/dist/ctm.js"],"sourcesContent":["//#region src/ctm.ts\n/** 单位矩阵:不改变任何坐标 */\nconst IDENTITY_MATRIX = [\n\t1,\n\t0,\n\t0,\n\t1,\n\t0,\n\t0\n];\n/** 矩阵乘法:`multiplyMatrix(outer, inner)` 等价于先 inner 后 outer */\nfunction multiplyMatrix(outer, inner) {\n\tconst [a1, b1, c1, d1, e1, f1] = outer;\n\tconst [a2, b2, c2, d2, e2, f2] = inner;\n\treturn [\n\t\ta1 * a2 + c1 * b2,\n\t\tb1 * a2 + d1 * b2,\n\t\ta1 * c2 + c1 * d2,\n\t\tb1 * c2 + d1 * d2,\n\t\ta1 * e2 + c1 * f2 + e1,\n\t\tb1 * e2 + d1 * f2 + f1\n\t];\n}\n/** 解析 `CTM` 属性;缺失或不合法返回 null(渲染时按单位矩阵处理) */\nfunction parseMatrix(value) {\n\tconst numbers = parseNumberList(value);\n\treturn numbers.length === 6 ? [\n\t\tnumbers[0],\n\t\tnumbers[1],\n\t\tnumbers[2],\n\t\tnumbers[3],\n\t\tnumbers[4],\n\t\tnumbers[5]\n\t] : null;\n}\n/** 解析 `Boundary=\"x y w h\"` 属性;缺失或不完整返回 null */\nfunction parseBoundary(value) {\n\tconst numbers = parseNumberList(value);\n\tif (numbers.length !== 4) return null;\n\treturn {\n\t\tx: numbers[0],\n\t\ty: numbers[1],\n\t\twidth: numbers[2],\n\t\theight: numbers[3]\n\t};\n}\n/** 按空白或逗号切分数值列表(CTM / Boundary / DeltaX / DashPattern 共用) */\nfunction parseNumberList(value) {\n\tif (!value) return [];\n\treturn value.trim().split(/[\\s,]+/).filter((token) => token !== \"\").map((token) => Number(token)).filter((number) => Number.isFinite(number));\n}\n//#endregion\nexport { IDENTITY_MATRIX, multiplyMatrix, parseBoundary, parseMatrix, parseNumberList };\n\n//# sourceMappingURL=ctm.js.map"],"mappings":";;AAEA,MAAM,kBAAkB;CACvB;CACA;CACA;CACA;CACA;CACA;AACD;;AAEA,SAAS,eAAe,OAAO,OAAO;CACrC,MAAM,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,MAAM;CACjC,MAAM,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,MAAM;CACjC,OAAO;EACN,KAAK,KAAK,KAAK;EACf,KAAK,KAAK,KAAK;EACf,KAAK,KAAK,KAAK;EACf,KAAK,KAAK,KAAK;EACf,KAAK,KAAK,KAAK,KAAK;EACpB,KAAK,KAAK,KAAK,KAAK;CACrB;AACD;;AAEA,SAAS,YAAY,OAAO;CAC3B,MAAM,UAAU,gBAAgB,KAAK;CACrC,OAAO,QAAQ,WAAW,IAAI;EAC7B,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;EACR,QAAQ;CACT,IAAI;AACL;;AAEA,SAAS,cAAc,OAAO;CAC7B,MAAM,UAAU,gBAAgB,KAAK;CACrC,IAAI,QAAQ,WAAW,GAAG,OAAO;CACjC,OAAO;EACN,GAAG,QAAQ;EACX,GAAG,QAAQ;EACX,OAAO,QAAQ;EACf,QAAQ,QAAQ;CACjB;AACD;;AAEA,SAAS,gBAAgB,OAAO;CAC/B,IAAI,CAAC,OAAO,OAAO,CAAC;CACpB,OAAO,MAAM,KAAK,CAAC,CAAC,MAAM,QAAQ,CAAC,CAAC,QAAQ,UAAU,UAAU,EAAE,CAAC,CAAC,KAAK,UAAU,OAAO,KAAK,CAAC,CAAC,CAAC,QAAQ,WAAW,OAAO,SAAS,MAAM,CAAC;AAC7I"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region ../ofd-core/dist/error.js
|
|
2
|
+
/** OFD 解析失败抛出的类型化错误:靠 `reason` 分类,不靠解析 message */
|
|
3
|
+
var OfdParseError = class extends Error {
|
|
4
|
+
reason;
|
|
5
|
+
constructor(reason, message, options) {
|
|
6
|
+
super(message, options);
|
|
7
|
+
this.name = "OfdParseError";
|
|
8
|
+
this.reason = reason;
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { OfdParseError };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=error.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error.js","names":[],"sources":["../../../../../ofd-core/dist/error.js"],"sourcesContent":["//#region src/error.ts\n/** OFD 解析失败抛出的类型化错误:靠 `reason` 分类,不靠解析 message */\nvar OfdParseError = class extends Error {\n\treason;\n\tconstructor(reason, message, options) {\n\t\tsuper(message, options);\n\t\tthis.name = \"OfdParseError\";\n\t\tthis.reason = reason;\n\t}\n};\n//#endregion\nexport { OfdParseError };\n\n//# sourceMappingURL=error.js.map"],"mappings":";;AAEA,IAAI,gBAAgB,cAAc,MAAM;CACvC;CACA,YAAY,QAAQ,SAAS,SAAS;EACrC,MAAM,SAAS,OAAO;EACtB,KAAK,OAAO;EACZ,KAAK,SAAS;CACf;AACD"}
|