@schemx/vue 0.1.20 → 0.1.21
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/README.md +3 -0
- package/dist/components/FormItem/index.d.ts.map +1 -1
- package/dist/hooks/useContext.d.ts.map +1 -1
- package/dist/hooks/useDictionary.d.ts +2 -2
- package/dist/hooks/useDictionary.d.ts.map +1 -1
- package/dist/hooks/useField.d.ts.map +1 -1
- package/dist/hooks/useFieldContext.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +4695 -31
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/utils/helpers.d.ts +26 -0
- package/dist/utils/helpers.d.ts.map +1 -0
- package/package.json +12 -4
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
:root{--schemx-primary-color: #2f6bff;--schemx-primary-color-light: #eaf2ff;--schemx-text-color: #323233;--schemx-text-color-secondary: #666666;--schemx-text-color-placeholder: #c8c9cc;--schemx-
|
|
1
|
+
:root{--schemx-primary-color: #2f6bff;--schemx-primary-color-light: #eaf2ff;--schemx-text-color: #323233;--schemx-text-color-secondary: #666666;--schemx-text-color-placeholder: #c8c9cc;--schemx-readonly-color: #969799;--schemx-disabled-color: #c8c9cc;--schemx-disabled-opacity: .6;--schemx-background-color: #ffffff;--schemx-background-color-light: #f3f4f6;--schemx-border-color: #ebedf0;--schemx-danger-color: #ee0a24;--schemx-success-color: #07c160;--schemx-warning-color: #ff976a;--schemx-padding-base: 4px;--schemx-padding-xs: 8px;--schemx-padding-sm: 12px;--schemx-padding-md: 16px;--schemx-padding-lg: 24px;--schemx-font-size-xs: 10px;--schemx-font-size-sm: 12px;--schemx-font-size-md: 14px;--schemx-font-size-lg: 16px;--schemx-border-radius-xs: 2px;--schemx-border-radius-sm: 4px;--schemx-border-radius-md: 8px;--schemx-border-radius-lg: 12px;--schemx-form-padding-bottom: 15px;--schemx-schemas-padding-inline: 6px;--schemx-item-gap: 16px;--schemx-item-line-height: 1.6;--schemx-item-error-line-height: 1.5714285714285714;--schemx-item-label-color: #666666;--schemx-item-label-top-gap: 4px;--schemx-item-content-padding-inline: 6px;--schemx-item-required-gap: 2px;--schemx-item-error-gap: 6px;--schemx-content-align: right;--schemx-error-align: right;--schemx-group-arrow-size: 5px;--schemx-group-arrow-duration: .2s}.schemx-item-wrapper{position:relative;background-color:var(--schemx-background-color)}.schemx-item-wrapper--first{border-top-left-radius:var(--schemx-border-radius-md);border-top-right-radius:var(--schemx-border-radius-md)}.schemx-item-wrapper--last{border-bottom-left-radius:var(--schemx-border-radius-md);border-bottom-right-radius:var(--schemx-border-radius-md);margin-bottom:var(--schemx-padding-sm)}.is-disabled{opacity:.65}.is-readonly{opacity:1}.schemx-item{display:flex;align-items:flex-start;justify-content:space-between;padding-inline:var(--schemx-padding-md);padding-block:var(--schemx-padding-md);line-height:var(--schemx-item-line-height);gap:var(--schemx-item-gap)}.schemx-item:after{position:absolute;box-sizing:border-box;content:" ";pointer-events:none;right:var(--schemx-padding-md);bottom:0;left:var(--schemx-padding-md);border-bottom:1px solid var(--schemx-border-color);transform:scaleY(.5)}.schemx-item-wrapper--last .schemx-item:after{display:none}.schemx-item--label-left{flex-direction:row}.schemx-item--label-right{flex-direction:row-reverse}.schemx-item--label-right .schemx-item__label{margin-right:0;margin-left:var(--schemx-padding-xs)}.schemx-item--label-top{flex-direction:column}.schemx-item--label-top .schemx-item__label{margin-right:0;margin-bottom:var(--schemx-item-label-top-gap);width:auto}.schemx-item__label{position:relative;display:flex;align-items:center;flex-shrink:0;color:var(--schemx-item-label-color);font-size:var(--schemx-font-size-md);margin-right:var(--schemx-padding-xs);line-height:var(--schemx-item-line-height)}.schemx-item__required{color:var(--schemx-danger-color);margin-right:var(--schemx-item-required-gap);position:absolute;top:2px;left:-8px}.schemx-item__content{flex:1;min-width:0;max-width:70%;padding:0 var(--schemx-item-content-padding-inline)}.schemx-item__control{text-align:var(--schemx-content-align)}.schemx-item__control .schemx-renderer{width:100%}.schemx-item__error{color:var(--schemx-danger-color);font-size:var(--schemx-font-size-sm);text-align:var(--schemx-error-align, right);line-height:var(--schemx-item-error-line-height);margin-top:var(--schemx-item-error-gap)}.schemx-item--label-top>.schemx-item__content{box-sizing:border-box;width:100%;max-width:none}.schemx-group{margin-bottom:var(--schemx-padding-sm);background-color:var(--schemx-background-color);padding:var(--schemx-padding-base) var(--schemx-padding-md);border-radius:var(--schemx-border-radius-md)}.schemx-group__header{display:flex;align-items:center;justify-content:space-between;padding-block:var(--schemx-padding-sm);-webkit-user-select:none;user-select:none}.schemx-group__header--clickable{cursor:pointer}.schemx-group__title{font-size:var(--schemx-font-size-lg);font-weight:500;color:var(--schemx-text-color)}.schemx-group__arrow{display:inline-block;width:0;height:0;border-left:var(--schemx-group-arrow-size) solid transparent;border-right:var(--schemx-group-arrow-size) solid transparent;border-bottom:var(--schemx-group-arrow-size) solid var(--schemx-text-color-secondary);transition:transform var(--schemx-group-arrow-duration) ease}.schemx-group__arrow--down{transform:rotate(180deg)}.schemx-group__body>.schemx-item-wrapper:last-child .schemx-item:after{display:none}.schemx-group__body>.schemx-item-wrapper>.schemx-item{padding-inline:var(--schemx-padding-xs)}.schemx{box-sizing:border-box;padding-bottom:var(--schemx-form-padding-bottom)}.schemx-schemas{background-color:var(--schemx-background-color);padding:var(--schemx-padding-md) var(--schemx-schemas-padding-inline);border-radius:var(--schemx-border-radius-lg)}.schemx-schemas-title{display:flex;align-items:center;padding-left:var(--schemx-padding-md);padding-bottom:var(--schemx-padding-xs)}.schemx-schemas-title-icon{margin-right:var(--schemx-padding-xs)}.schemx-schemas-title-label{font-size:var(--schemx-font-size-md);color:var(--schemx-text-color)}.schemx-renderer-readonly{color:var(--schemx-readonly-color);cursor:default}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SchemxViewSchema } from '@schemx/core';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 判断当前项是否为顶层可见普通字段中的第一个或最后一个。
|
|
5
|
+
*
|
|
6
|
+
* `group` 和不可见字段不参与顶层卡片圆角判断。
|
|
7
|
+
*
|
|
8
|
+
* 使用示例:
|
|
9
|
+
*
|
|
10
|
+
* const list = [
|
|
11
|
+
* { key: 'group-1', type: 'group' },
|
|
12
|
+
* { key: 'a' },
|
|
13
|
+
* { key: 'b' },
|
|
14
|
+
* { key: 'group-2', type: 'group' },
|
|
15
|
+
* { key: 'c' },
|
|
16
|
+
* ]
|
|
17
|
+
*
|
|
18
|
+
* getSectionPosition(list, 'a')
|
|
19
|
+
* // => { found: true, isFirst: true, isLast: false }
|
|
20
|
+
*/
|
|
21
|
+
export declare function getSectionPosition<T extends SchemxViewSchema>(list: T[], currentKey: string): {
|
|
22
|
+
found: boolean;
|
|
23
|
+
isFirst: boolean;
|
|
24
|
+
isLast: boolean;
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAE/C;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,gBAAgB,EAC3D,IAAI,EAAE,CAAC,EAAE,EACT,UAAU,EAAE,MAAM;;;;EA8BnB"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@schemx/vue",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.21",
|
|
5
5
|
"description": "基于 JSON Schema 配置的 Vue 3 动态表单引擎(UI 无关核心)",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"schemx",
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
],
|
|
44
44
|
"sideEffects": [
|
|
45
45
|
"**/*.css",
|
|
46
|
-
"**/*.scss"
|
|
46
|
+
"**/*.scss",
|
|
47
|
+
"**/index.ts"
|
|
47
48
|
],
|
|
48
49
|
"peerDependencies": {
|
|
49
50
|
"vue": "^3.0.0"
|
|
@@ -52,13 +53,20 @@
|
|
|
52
53
|
"classnames": "^2.5.1",
|
|
53
54
|
"csstype": "^3.2.3",
|
|
54
55
|
"dayjs": "^1.11.19",
|
|
55
|
-
"es-toolkit": "^1.
|
|
56
|
+
"es-toolkit": "^1.47.0",
|
|
56
57
|
"@schemx/core": "0.1.23"
|
|
57
58
|
},
|
|
58
59
|
"license": "MIT",
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@vue/test-utils": "^2.4.6",
|
|
62
|
+
"vue": "^3.4.0",
|
|
63
|
+
"zod": "^4.3.6"
|
|
64
|
+
},
|
|
59
65
|
"scripts": {
|
|
60
66
|
"build": "vite build",
|
|
67
|
+
"build:analyze": "ANALYZE=true vite build",
|
|
61
68
|
"test": "vitest run",
|
|
62
|
-
"lint": "eslint \"src/**/*.{ts,tsx,vue,js,jsx}\""
|
|
69
|
+
"lint": "eslint \"src/**/*.{ts,tsx,vue,js,jsx}\"",
|
|
70
|
+
"type-check": "tsc -p tsconfig.json --noEmit"
|
|
63
71
|
}
|
|
64
72
|
}
|