orion-design 0.1.9 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +5 -5
- package/dist/components/Button/index.js +11 -10
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Form/FileInput/FileInput.vue.d.ts +1 -1
- package/dist/components/Form/Form.d.ts +1 -0
- package/dist/components/Form/Form.js.map +1 -1
- package/dist/components/Form/LovInput/LovInput.d.ts +20 -0
- package/dist/components/Form/LovInput/LovInput.js +5 -0
- package/dist/components/Form/LovInput/LovInput.js.map +1 -0
- package/dist/components/Form/LovInput/LovInput.vue.d.ts +5351 -0
- package/dist/components/Form/LovInput/hooks/useLov.d.ts +1 -0
- package/dist/components/Form/LovInput/hooks/useLov.js +9 -0
- package/dist/components/Form/LovInput/hooks/useLov.js.map +1 -0
- package/dist/components/Form/LovInput/index.d.ts +2 -0
- package/dist/components/Form/LovInput/index.js +7 -0
- package/dist/components/Form/LovInput/index.js.map +1 -0
- package/dist/components/Form/hooks/FormItemValidateTrigger.d.ts +15 -0
- package/dist/components/Form/hooks/FormItemValidateTrigger.js +18 -0
- package/dist/components/Form/hooks/FormItemValidateTrigger.js.map +1 -0
- package/dist/components/Form/hooks/index.d.ts +10 -0
- package/dist/components/Form/hooks/index.js +83 -0
- package/dist/components/Form/hooks/index.js.map +1 -0
- package/dist/components/Form/index.d.ts +3 -0
- package/dist/components/Form/index.js +328 -244
- package/dist/components/Form/index.js.map +1 -1
- package/dist/components/Pagetable/Pagetable.d.ts +16 -1
- package/dist/components/Pagetable/columns/PagetableCellButton.d.ts +7 -7
- package/dist/components/Pagetable/index.d.ts +12 -1
- package/dist/components/Pagetable/index.js +243 -236
- package/dist/components/Pagetable/index.js.map +1 -1
- package/dist/components/Pagetable/utils/index.js +51 -154
- package/dist/components/Pagetable/utils/index.js.map +1 -1
- package/dist/components/Querytable/Querytable.d.ts +64 -0
- package/dist/components/Querytable/columns/QuerytableCellButton.d.ts +24 -0
- package/dist/components/Querytable/columns/QuerytableColumnButtongroup.d.ts +78 -0
- package/dist/components/Querytable/columns/QuerytableColumnDate.d.ts +101 -0
- package/dist/components/Querytable/columns/QuerytableColumnDiy.d.ts +78 -0
- package/dist/components/Querytable/columns/QuerytableColumnIndex.d.ts +5 -0
- package/dist/components/Querytable/columns/QuerytableColumnMultiselect.d.ts +109 -0
- package/dist/components/Querytable/columns/QuerytableColumnNumber.d.ts +114 -0
- package/dist/components/Querytable/columns/QuerytableColumnSingleselect.d.ts +109 -0
- package/dist/components/Querytable/columns/QuerytableColumnString.d.ts +75 -0
- package/dist/components/Querytable/columns/QuerytableColumngroup.d.ts +35 -0
- package/dist/components/Querytable/hooks/useColumns.d.ts +1 -0
- package/dist/components/Querytable/hooks/useColumns.js +96 -0
- package/dist/components/Querytable/hooks/useColumns.js.map +1 -0
- package/dist/components/Querytable/index.d.ts +66 -0
- package/dist/components/Querytable/index.js +510 -0
- package/dist/components/Querytable/index.js.map +1 -0
- package/dist/components/Querytable/interface.d.ts +10 -0
- package/dist/components/Querytable/interface.js +2 -0
- package/dist/components/Querytable/interface.js.map +1 -0
- package/dist/components/Querytable/utils/index.d.ts +15 -0
- package/dist/components/Querytable/utils/index.js +66 -0
- package/dist/components/Querytable/utils/index.js.map +1 -0
- package/dist/components/_util/arrays.js.map +1 -1
- package/dist/components/_util/browser.js.map +1 -1
- package/dist/components/_util/dom/aria.js.map +1 -1
- package/dist/components/_util/dom/element.js.map +1 -1
- package/dist/components/_util/dom/event.js.map +1 -1
- package/dist/components/_util/dom/position.js.map +1 -1
- package/dist/components/_util/dom/scroll.js.map +1 -1
- package/dist/components/_util/dom/style.js.map +1 -1
- package/dist/components/_util/easings.js.map +1 -1
- package/dist/components/_util/error.js.map +1 -1
- package/dist/components/_util/i18n.js.map +1 -1
- package/dist/components/_util/objects.js.map +1 -1
- package/dist/components/_util/raf.js.map +1 -1
- package/dist/components/_util/rand.js.map +1 -1
- package/dist/components/_util/strings.js.map +1 -1
- package/dist/components/_util/throttleByRaf.js.map +1 -1
- package/dist/components/_util/types.js.map +1 -1
- package/dist/components/_util/typescript.js.map +1 -1
- package/dist/components/_util/vue/global-node.js.map +1 -1
- package/dist/components/_util/vue/icon.js.map +1 -1
- package/dist/components/_util/vue/install.js.map +1 -1
- package/dist/components/_util/vue/props/runtime.js.map +1 -1
- package/dist/components/_util/vue/refs.js.map +1 -1
- package/dist/components/_util/vue/size.js.map +1 -1
- package/dist/components/_util/vue/validator.js.map +1 -1
- package/dist/components/_util/vue/vnode.js.map +1 -1
- package/dist/components/components.d.ts +2 -0
- package/dist/components/components.js +8 -6
- package/dist/components/components.js.map +1 -1
- package/dist/components/index.js +15 -13
- package/dist/components/index.js.map +1 -1
- package/dist/{components-CutWiB7Q.js → components-OIbu7HLW.js} +26 -24
- package/dist/{components-CutWiB7Q.js.map → components-OIbu7HLW.js.map} +1 -1
- package/dist/index-CC0EuWhe.js +108 -0
- package/dist/index-CC0EuWhe.js.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.js +14 -12
- package/dist/index.js.map +1 -1
- package/dist/version/version.d.ts +1 -1
- package/dist/version/version.js +1 -1
- package/dist/version/version.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/Form/hooks/useForm.d.ts +0 -10
- package/dist/components/Form/hooks/useForm.js +0 -82
- package/dist/components/Form/hooks/useForm.js.map +0 -1
@@ -1,82 +0,0 @@
|
|
1
|
-
import { inject as x, getCurrentInstance as s, computed as n } from "vue";
|
2
|
-
import { formContextKey as C } from "../Form.js";
|
3
|
-
import M from "../../../Throne/index.js";
|
4
|
-
import { castArray as p, isString as V, isArray as F } from "lodash-es";
|
5
|
-
import f from "../../../error/OrionError.js";
|
6
|
-
const u = () => x(C), j = () => {
|
7
|
-
const e = u(), { props: r } = s();
|
8
|
-
return n(() => r.span ? r.span : e.itemSpan);
|
9
|
-
}, q = () => {
|
10
|
-
const e = u(), { props: r, type: t } = s(), { name: o, label: l, required: c } = r;
|
11
|
-
let d = "change";
|
12
|
-
return t.extendOptions && t.extendOptions.trigger && (d = t.extendOptions.trigger), n(() => {
|
13
|
-
const i = [];
|
14
|
-
let a = !0;
|
15
|
-
return c && (r.rules && (i.push(...p(r.rules)), a = !i.some((m) => Object.keys(m).includes("required"))), e.rules && e.rules[o] && (a = !p(e.rules[o]).some((g) => Object.keys(g).includes("required")))), a && i.push({
|
16
|
-
required: !0,
|
17
|
-
message: `必填项[${l || o}]不能为空`,
|
18
|
-
trigger: d
|
19
|
-
}), i;
|
20
|
-
});
|
21
|
-
}, D = () => {
|
22
|
-
const e = u(), { props: r } = s(), { disabled: t } = r;
|
23
|
-
return n(() => e.disabled || t);
|
24
|
-
}, R = () => {
|
25
|
-
let e;
|
26
|
-
const { props: r } = s(), { code: t } = r;
|
27
|
-
if (t)
|
28
|
-
if (V(t))
|
29
|
-
e = M.getCode(t).value;
|
30
|
-
else if (F(t))
|
31
|
-
e = t;
|
32
|
-
else
|
33
|
-
throw new f("code类型错误");
|
34
|
-
else throw new f("code为空");
|
35
|
-
return n(() => e);
|
36
|
-
}, S = () => {
|
37
|
-
const e = u(), { props: r } = s(), { name: t } = r;
|
38
|
-
return n({
|
39
|
-
get: () => {
|
40
|
-
const o = e.modelValue[t];
|
41
|
-
return o || "";
|
42
|
-
},
|
43
|
-
set: (o) => {
|
44
|
-
o ? e.updateModelValue(t, o) : e.updateModelValue(t, "");
|
45
|
-
}
|
46
|
-
});
|
47
|
-
}, k = () => {
|
48
|
-
const e = u(), { props: r } = s(), { name: t } = r;
|
49
|
-
return n({
|
50
|
-
get: () => {
|
51
|
-
const o = e.modelValue[t];
|
52
|
-
if (o)
|
53
|
-
return o.split(",");
|
54
|
-
},
|
55
|
-
set: (o) => {
|
56
|
-
o ? e.updateModelValue(t, o.join(",")) : e.updateModelValue(t, "");
|
57
|
-
}
|
58
|
-
});
|
59
|
-
}, w = () => {
|
60
|
-
const e = u(), { props: r } = s(), { name: t } = r;
|
61
|
-
return n({
|
62
|
-
get: () => {
|
63
|
-
const o = e.modelValue[t];
|
64
|
-
return o ? o == "1" : !1;
|
65
|
-
},
|
66
|
-
set: (o) => {
|
67
|
-
const l = e.modelValue[t], c = o ? "1" : "0";
|
68
|
-
(l || o) && e.updateModelValue(t, c);
|
69
|
-
}
|
70
|
-
});
|
71
|
-
};
|
72
|
-
export {
|
73
|
-
w as useFormBooleanModel,
|
74
|
-
R as useFormCode,
|
75
|
-
u as useFormContext,
|
76
|
-
S as useFormDirectModel,
|
77
|
-
D as useFormDisabled,
|
78
|
-
k as useFormMultiModel,
|
79
|
-
q as useFormRules,
|
80
|
-
j as useFormSpan
|
81
|
-
};
|
82
|
-
//# sourceMappingURL=useForm.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"useForm.js","sources":["../../../../src/components/Form/hooks/useForm.ts"],"sourcesContent":["import { inject, getCurrentInstance, computed } from 'vue'\r\nimport { formContextKey, FormItemRule } from '../Form'\r\nimport Throne from '../../../Throne'\r\nimport { CodeItem } from '../../types'\r\nimport { castArray, isArray, isString } from 'lodash-es'\r\nimport OrionError from '../../../error/OrionError'\r\n\r\nconst useFormContext = () => {\r\n return inject(formContextKey)\r\n}\r\n\r\nconst useFormSpan = () => {\r\n const formContext = useFormContext()!\r\n const { props } = getCurrentInstance()!\r\n\r\n return computed(() => (props.span ? (props.span as number) : formContext.itemSpan))\r\n}\r\n\r\nconst useFormRules = () => {\r\n const formContext = useFormContext()!\r\n const { props, type } = getCurrentInstance()!\r\n const { name, label, required } = props\r\n let trigger = 'change'\r\n if (type['extendOptions'] && type['extendOptions']['trigger']) {\r\n trigger = type['extendOptions']['trigger']\r\n }\r\n\r\n return computed(() => {\r\n const rules: FormItemRule[] = []\r\n let flag = true\r\n\r\n if (required) {\r\n if (props.rules) {\r\n rules.push(...castArray(props.rules))\r\n flag = !rules.some((rule) => Object.keys(rule).includes('required'))\r\n }\r\n if (formContext.rules && formContext.rules[name as string]) {\r\n const formRules = castArray(formContext.rules[name as string])\r\n flag = !formRules.some((rule) => Object.keys(rule).includes('required'))\r\n }\r\n }\r\n\r\n if (flag) {\r\n rules.push({\r\n required: true,\r\n message: `必填项[${label ? label : name}]不能为空`,\r\n trigger: trigger,\r\n })\r\n }\r\n\r\n return rules\r\n })\r\n}\r\n\r\nconst useFormDisabled = () => {\r\n const formContext = useFormContext()!\r\n const { props } = getCurrentInstance()!\r\n const { disabled } = props\r\n return computed(() => formContext.disabled || (disabled as boolean))\r\n}\r\n\r\nconst useFormCode = () => {\r\n let codeData: Array<CodeItem>\r\n const { props } = getCurrentInstance()!\r\n const { code } = props\r\n if (!code) {\r\n throw new OrionError('code为空')\r\n } else if (isString(code)) {\r\n codeData = Throne.getCode(code).value\r\n } else if (isArray<CodeItem>(code)) {\r\n codeData = code\r\n } else {\r\n throw new OrionError('code类型错误')\r\n }\r\n return computed(() => codeData)\r\n}\r\n\r\nconst useFormDirectModel = () => {\r\n const formContext = useFormContext()!\r\n const { props } = getCurrentInstance()!\r\n const { name } = props\r\n\r\n return computed<string>({\r\n get: () => {\r\n const value = formContext.modelValue[name as string]\r\n if (!value) {\r\n return ''\r\n }\r\n return value as string\r\n },\r\n set: (newValue) => {\r\n if (!newValue) {\r\n formContext.updateModelValue(name as string, '')\r\n } else {\r\n formContext.updateModelValue(name as string, newValue)\r\n }\r\n },\r\n })\r\n}\r\n\r\nconst useFormMultiModel = () => {\r\n const formContext = useFormContext()!\r\n const { props } = getCurrentInstance()!\r\n const { name } = props\r\n\r\n return computed<string[] | undefined>({\r\n get: () => {\r\n const value = formContext.modelValue[name as string]\r\n if (!value) {\r\n return undefined\r\n }\r\n return (value as string).split(',')\r\n },\r\n set: (newValue) => {\r\n if (!newValue) {\r\n formContext.updateModelValue(name as string, '')\r\n } else {\r\n formContext.updateModelValue(name as string, newValue.join(','))\r\n }\r\n },\r\n })\r\n}\r\n\r\nconst useFormBooleanModel = () => {\r\n const formContext = useFormContext()!\r\n const { props } = getCurrentInstance()!\r\n const { name } = props\r\n\r\n return computed<boolean>({\r\n get: () => {\r\n const value = formContext.modelValue[name as string]\r\n if (!value) {\r\n return false\r\n }\r\n return (value as string) == '1'\r\n },\r\n set: (_newValue) => {\r\n const oldValue = formContext.modelValue[name as string]\r\n const newValue = _newValue ? '1' : '0'\r\n if (oldValue) {\r\n formContext.updateModelValue(name as string, newValue)\r\n } else {\r\n if (_newValue) {\r\n formContext.updateModelValue(name as string, newValue)\r\n }\r\n }\r\n },\r\n })\r\n}\r\n\r\nexport { useFormContext, useFormSpan, useFormRules, useFormDisabled, useFormCode, useFormDirectModel, useFormMultiModel, useFormBooleanModel }\r\n"],"names":["useFormContext","inject","formContextKey","useFormSpan","formContext","props","getCurrentInstance","computed","useFormRules","type","name","label","required","trigger","rules","flag","castArray","rule","useFormDisabled","disabled","useFormCode","codeData","code","isString","Throne","isArray","OrionError","useFormDirectModel","value","newValue","useFormMultiModel","useFormBooleanModel","_newValue","oldValue"],"mappings":";;;;;AAOA,MAAMA,IAAiB,MACdC,EAAOC,CAAc,GAGxBC,IAAc,MAAM;AACxB,QAAMC,IAAcJ,KACd,EAAE,OAAAK,MAAUC;AAElB,SAAOC,EAAS,MAAOF,EAAM,OAAQA,EAAM,OAAkBD,EAAY,QAAS;AACpF,GAEMI,IAAe,MAAM;AACzB,QAAMJ,IAAcJ,KACd,EAAE,OAAAK,GAAO,MAAAI,EAAK,IAAIH,EAAmB,GACrC,EAAE,MAAAI,GAAM,OAAAC,GAAO,UAAAC,EAAA,IAAaP;AAClC,MAAIQ,IAAU;AACd,SAAIJ,EAAK,iBAAoBA,EAAK,cAAiB,YACvCI,IAAAJ,EAAK,cAAiB,UAG3BF,EAAS,MAAM;AACpB,UAAMO,IAAwB,CAAA;AAC9B,QAAIC,IAAO;AAEX,WAAIH,MACEP,EAAM,UACRS,EAAM,KAAK,GAAGE,EAAUX,EAAM,KAAK,CAAC,GAC7BU,IAAA,CAACD,EAAM,KAAK,CAACG,MAAS,OAAO,KAAKA,CAAI,EAAE,SAAS,UAAU,CAAC,IAEjEb,EAAY,SAASA,EAAY,MAAMM,CAAc,MAEhD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