@opentinyvue/vue-form 2.21.0

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/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 - present TinyVue Authors.
4
+ Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/index.d.ts ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright (c) 2022 - present TinyVue Authors.
3
+ * Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license.
6
+ *
7
+ * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
8
+ * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
9
+ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10
+ *
11
+ */
12
+ import Form from './src/index';
13
+ export default Form;
package/lib/index.js ADDED
@@ -0,0 +1,159 @@
1
+ function _extends() {
2
+ return _extends = Object.assign ? Object.assign.bind() : function(n) {
3
+ for (var e = 1; e < arguments.length; e++) {
4
+ var t = arguments[e];
5
+ for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
6
+ }
7
+ return n;
8
+ }, _extends.apply(null, arguments);
9
+ }
10
+ import { defineComponent, $prefix, $setup, $props } from "@opentinyvue/vue-common";
11
+ import PcTemplate from "./pc.js";
12
+ import MobileTemplate from "./mobile.js";
13
+ import MobileFirstTemplate from "./mobile-first.js";
14
+ var template = function template2(mode) {
15
+ var _process$env;
16
+ var tinyMode = typeof process === "object" ? (_process$env = process.env) == null ? void 0 : _process$env.TINY_MODE : null;
17
+ if ("pc" === (tinyMode || mode)) {
18
+ return PcTemplate;
19
+ }
20
+ if ("mobile" === (tinyMode || mode)) {
21
+ return MobileTemplate;
22
+ }
23
+ if ("mobile-first" === (tinyMode || mode)) {
24
+ return MobileFirstTemplate;
25
+ }
26
+ return PcTemplate;
27
+ };
28
+ var formProps = _extends({}, $props, {
29
+ model: Object,
30
+ rules: Object,
31
+ inlineMessage: {
32
+ type: Boolean,
33
+ default: void 0
34
+ },
35
+ messageType: String,
36
+ statusIcon: Boolean,
37
+ showMessage: {
38
+ type: Boolean,
39
+ default: true
40
+ },
41
+ validatePosition: {
42
+ type: String,
43
+ default: "right"
44
+ },
45
+ size: String,
46
+ disabled: Boolean,
47
+ validateOnRuleChange: {
48
+ type: [Boolean, String],
49
+ validator: function validator(value) {
50
+ return typeof value === "boolean" || ["deep"].includes(value);
51
+ },
52
+ default: true
53
+ },
54
+ hideRequiredAsterisk: {
55
+ type: Boolean,
56
+ default: void 0
57
+ },
58
+ labelPosition: {
59
+ type: String,
60
+ default: "right",
61
+ validator: function validator2(value) {
62
+ return ["left", "top", "right"].includes(value);
63
+ }
64
+ },
65
+ labelWidth: {
66
+ type: String,
67
+ // 默认值挪到design中
68
+ default: ""
69
+ },
70
+ labelAlign: {
71
+ type: Boolean,
72
+ default: false
73
+ },
74
+ contentOffset: Number,
75
+ labelSuffix: {
76
+ type: String,
77
+ default: ""
78
+ },
79
+ inline: {
80
+ type: Boolean,
81
+ default: false
82
+ },
83
+ responsiveLayout: {
84
+ type: Boolean,
85
+ default: false
86
+ },
87
+ validateType: {
88
+ type: String,
89
+ default: "tip",
90
+ validator: function validator3(value) {
91
+ return Boolean(~["tip", "text"].indexOf(value));
92
+ }
93
+ },
94
+ validateIcon: Object,
95
+ manual: {
96
+ type: Boolean,
97
+ default: false
98
+ },
99
+ appendToBody: {
100
+ type: Boolean,
101
+ default: void 0
102
+ },
103
+ popperOptions: {
104
+ type: Object,
105
+ default: function _default() {
106
+ return {};
107
+ }
108
+ },
109
+ displayOnly: {
110
+ type: Boolean,
111
+ default: false
112
+ },
113
+ showAutoWidth: {
114
+ type: Boolean,
115
+ default: false
116
+ },
117
+ showEmptyValue: {
118
+ type: Boolean,
119
+ default: true
120
+ },
121
+ validateTag: {
122
+ type: Boolean,
123
+ default: false
124
+ },
125
+ overflowTitle: {
126
+ type: Boolean,
127
+ default: false
128
+ },
129
+ wrapFragment: {
130
+ type: String,
131
+ default: "div"
132
+ },
133
+ tooltipConfig: {
134
+ type: Object,
135
+ default: function _default2() {
136
+ return {};
137
+ }
138
+ }
139
+ });
140
+ var Form = defineComponent({
141
+ name: $prefix + "Form",
142
+ componentName: "Form",
143
+ props: formProps,
144
+ setup: function setup(props, context) {
145
+ return $setup({
146
+ props,
147
+ context,
148
+ template
149
+ });
150
+ }
151
+ });
152
+ var version = "2.21.0";
153
+ Form.install = function(Vue) {
154
+ Vue.component(Form.name, Form);
155
+ };
156
+ Form.version = version;
157
+ export {
158
+ Form as default
159
+ };
@@ -0,0 +1,102 @@
1
+ import { renderless, api } from '@opentinyvue/vue-renderless/form/vue';
2
+ import { defineComponent, props, setup } from '@opentinyvue/vue-common';
3
+ import Tooltip from '@opentinyvue/vue-tooltip';
4
+
5
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
6
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
7
+ if (render) {
8
+ options.render = render;
9
+ options.staticRenderFns = staticRenderFns;
10
+ options._compiled = true;
11
+ }
12
+ var hook;
13
+ if (injectStyles) {
14
+ hook = injectStyles;
15
+ }
16
+ if (hook) {
17
+ if (options.functional) {
18
+ options._injectStyles = hook;
19
+ var originalRender = options.render;
20
+ options.render = function renderWithStyleInjection(h, context) {
21
+ hook.call(context);
22
+ return originalRender(h, context);
23
+ };
24
+ } else {
25
+ var existing = options.beforeCreate;
26
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
27
+ }
28
+ }
29
+ return {
30
+ exports: scriptExports,
31
+ options
32
+ };
33
+ }
34
+
35
+ var __vue2_script = defineComponent({
36
+ components: {
37
+ TinyTooltip: Tooltip
38
+ },
39
+ provide: function provide() {
40
+ return {
41
+ TinyMode: "mobile-first"
42
+ };
43
+ },
44
+ props: [].concat(props, ["validateOnRuleChange", "hideRequiredAsterisk", "model", "rules", "inlineMessage", "messageType", "statusIcon", "labelPosition", "showMessage", "size", "disabled", "labelWidth", "contentOffset", "labelSuffix", "inline", "responsiveLayout", "validateType", "validateIcon", "manual", "appendToBody", "popperOptions", "displayOnly", "showEmptyValue", "tooltipConfig"]),
45
+ setup: function setup$1(props2, context) {
46
+ return setup({
47
+ props: props2,
48
+ context,
49
+ renderless,
50
+ api
51
+ });
52
+ }
53
+ });
54
+ var render = function render2() {
55
+ var _vm = this;
56
+ var _h = _vm.$createElement;
57
+ var _c = _vm._self._c || _h;
58
+ return _c("form", {
59
+ staticClass: "w-full overflow-hidden",
60
+ class: {
61
+ "overflow-x-visible": _vm.labelPosition === "top" && !_vm.hideRequiredAsterisk,
62
+ "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4": _vm.inline
63
+ },
64
+ attrs: {
65
+ "data-tag": "tiny-form"
66
+ },
67
+ on: {
68
+ "submit": function submit($event) {
69
+ $event.preventDefault();
70
+ }
71
+ }
72
+ }, [_vm._t("default"), _vm.displayOnly ? _c("tiny-tooltip", {
73
+ ref: "tooltip",
74
+ attrs: {
75
+ "popper-class": _vm.tooltipConfig.popperClass || "absolute",
76
+ "manual": true,
77
+ "effect": _vm.tooltipConfig.effect || "light",
78
+ "content": _vm.state.displayedValue,
79
+ "placement": _vm.tooltipConfig.placement || "top"
80
+ },
81
+ model: {
82
+ value: _vm.state.tooltipVisible,
83
+ callback: function callback($$v) {
84
+ _vm.$set(_vm.state, "tooltipVisible", $$v);
85
+ },
86
+ expression: "state.tooltipVisible"
87
+ }
88
+ }) : _vm._e()], 2);
89
+ };
90
+ var staticRenderFns = [];
91
+ var __cssModules = {};
92
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
93
+ function __vue2_injectStyles(context) {
94
+ for (var o in __cssModules) {
95
+ this[o] = __cssModules[o];
96
+ }
97
+ }
98
+ var mobileFirst = /* @__PURE__ */ function() {
99
+ return __component__.exports;
100
+ }();
101
+
102
+ export { mobileFirst as default };
package/lib/mobile.js ADDED
@@ -0,0 +1,77 @@
1
+ import { renderless, api } from '@opentinyvue/vue-renderless/form/vue';
2
+ import { defineComponent, props, setup } from '@opentinyvue/vue-common';
3
+ import '@opentinyvue/vue-theme-mobile/form/index.css';
4
+ import '@opentinyvue/vue-theme-mobile/form-item/index.css';
5
+
6
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
7
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
8
+ if (render) {
9
+ options.render = render;
10
+ options.staticRenderFns = staticRenderFns;
11
+ options._compiled = true;
12
+ }
13
+ var hook;
14
+ if (injectStyles) {
15
+ hook = injectStyles;
16
+ }
17
+ if (hook) {
18
+ if (options.functional) {
19
+ options._injectStyles = hook;
20
+ var originalRender = options.render;
21
+ options.render = function renderWithStyleInjection(h, context) {
22
+ hook.call(context);
23
+ return originalRender(h, context);
24
+ };
25
+ } else {
26
+ var existing = options.beforeCreate;
27
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
28
+ }
29
+ }
30
+ return {
31
+ exports: scriptExports,
32
+ options
33
+ };
34
+ }
35
+
36
+ var __vue2_script = defineComponent({
37
+ props: [].concat(props, ["validatePosition", "validateOnRuleChange", "hideRequiredAsterisk", "model", "rules", "inlineMessage", "messageType", "statusIcon", "labelPosition", "labelAlign", "showMessage", "size", "disabled", "labelWidth", "contentOffset", "labelSuffix", "inline", "responsiveLayout", "validateType", "validateIcon", "manual"]),
38
+ setup: function setup$1(props2, context) {
39
+ return setup({
40
+ props: props2,
41
+ context,
42
+ renderless,
43
+ api
44
+ });
45
+ }
46
+ });
47
+ var render = function render2() {
48
+ var _vm = this;
49
+ var _h = _vm.$createElement;
50
+ var _c = _vm._self._c || _h;
51
+ return _c("form", {
52
+ staticClass: "tiny-mobile-form",
53
+ class: [_vm.labelPosition ? "tiny-mobile-form--label-" + _vm.labelPosition : "", {
54
+ "tiny-mobile-form--inline": _vm.inline
55
+ }, {
56
+ "label-align": _vm.labelAlign
57
+ }],
58
+ on: {
59
+ "submit": function submit($event) {
60
+ $event.preventDefault();
61
+ }
62
+ }
63
+ }, [_vm._t("default")], 2);
64
+ };
65
+ var staticRenderFns = [];
66
+ var __cssModules = {};
67
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
68
+ function __vue2_injectStyles(context) {
69
+ for (var o in __cssModules) {
70
+ this[o] = __cssModules[o];
71
+ }
72
+ }
73
+ var mobile = /* @__PURE__ */ function() {
74
+ return __component__.exports;
75
+ }();
76
+
77
+ export { mobile as default };
package/lib/pc.js ADDED
@@ -0,0 +1,102 @@
1
+ import { renderless, api } from '@opentinyvue/vue-renderless/form/vue';
2
+ import { defineComponent, props, setup } from '@opentinyvue/vue-common';
3
+ import Tooltip from '@opentinyvue/vue-tooltip';
4
+ import '@opentinyvue/vue-theme/form/index.css';
5
+ import '@opentinyvue/vue-theme/form-item/index.css';
6
+
7
+ function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
8
+ var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
9
+ if (render) {
10
+ options.render = render;
11
+ options.staticRenderFns = staticRenderFns;
12
+ options._compiled = true;
13
+ }
14
+ var hook;
15
+ if (injectStyles) {
16
+ hook = injectStyles;
17
+ }
18
+ if (hook) {
19
+ if (options.functional) {
20
+ options._injectStyles = hook;
21
+ var originalRender = options.render;
22
+ options.render = function renderWithStyleInjection(h, context) {
23
+ hook.call(context);
24
+ return originalRender(h, context);
25
+ };
26
+ } else {
27
+ var existing = options.beforeCreate;
28
+ options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
29
+ }
30
+ }
31
+ return {
32
+ exports: scriptExports,
33
+ options
34
+ };
35
+ }
36
+
37
+ var __vue2_script = defineComponent({
38
+ components: {
39
+ TinyTooltip: Tooltip
40
+ },
41
+ props: [].concat(props, ["validateOnRuleChange", "hideRequiredAsterisk", "model", "rules", "inlineMessage", "messageType", "statusIcon", "labelPosition", "labelAlign", "showMessage", "size", "disabled", "labelWidth", "contentOffset", "labelSuffix", "inline", "responsiveLayout", "validateType", "validateIcon", "manual", "appendToBody", "popperOptions", "displayOnly", "showAutoWidth", "showEmptyValue", "validateTag", "overflowTitle", "tooltipConfig"]),
42
+ setup: function setup$1(props2, context) {
43
+ return setup({
44
+ props: props2,
45
+ context,
46
+ renderless,
47
+ api
48
+ });
49
+ }
50
+ });
51
+ var render = function render2() {
52
+ var _vm = this;
53
+ var _h = _vm.$createElement;
54
+ var _c = _vm._self._c || _h;
55
+ return _c("form", {
56
+ staticClass: "tiny-form",
57
+ class: [_vm.labelPosition ? "tiny-form--label-" + _vm.labelPosition : "", {
58
+ "tiny-form--inline": _vm.inline
59
+ }, {
60
+ "label-align": _vm.labelAlign
61
+ }, {
62
+ "has-required": _vm.state.hasRequired
63
+ }, {
64
+ "asterisk-form": _vm.labelPosition === "top" && !_vm.state.hideRequiredAsterisk
65
+ }, {
66
+ "is-display-only": _vm.state.isDisplayOnly
67
+ }],
68
+ on: {
69
+ "submit": function submit($event) {
70
+ $event.preventDefault();
71
+ }
72
+ }
73
+ }, [_vm._t("default"), _vm.overflowTitle ? _c("tiny-tooltip", _vm._b({
74
+ ref: "tooltip",
75
+ attrs: {
76
+ "manual": true,
77
+ "effect": _vm.tooltipConfig.effect || "light",
78
+ "content": _vm.state.displayedValue,
79
+ "placement": _vm.tooltipConfig.placement || "top"
80
+ },
81
+ model: {
82
+ value: _vm.state.tooltipVisible,
83
+ callback: function callback($$v) {
84
+ _vm.$set(_vm.state, "tooltipVisible", $$v);
85
+ },
86
+ expression: "state.tooltipVisible"
87
+ }
88
+ }, "tiny-tooltip", _vm.tooltipConfig, false)) : _vm._e()], 2);
89
+ };
90
+ var staticRenderFns = [];
91
+ var __cssModules = {};
92
+ var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
93
+ function __vue2_injectStyles(context) {
94
+ for (var o in __cssModules) {
95
+ this[o] = __cssModules[o];
96
+ }
97
+ }
98
+ var pc = /* @__PURE__ */ function() {
99
+ return __component__.exports;
100
+ }();
101
+
102
+ export { pc as default };
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@opentinyvue/vue-form",
3
+ "version": "2.21.0",
4
+ "description": "",
5
+ "main": "./lib/index.js",
6
+ "module": "./lib/index.js",
7
+ "sideEffects": false,
8
+ "type": "module",
9
+ "dependencies": {
10
+ "@opentinyvue/vue-common": "~2.21.0",
11
+ "@opentinyvue/vue-renderless": "~3.21.0",
12
+ "@opentinyvue/vue-tooltip": "~2.21.0",
13
+ "@opentinyvue/vue-theme-mobile": "~3.21.0",
14
+ "@opentinyvue/vue-theme": "~3.21.0"
15
+ },
16
+ "license": "MIT",
17
+ "types": "index.d.ts",
18
+ "scripts": {
19
+ "build": "pnpm -w build:ui $npm_package_name",
20
+ "//postversion": "pnpm build"
21
+ }
22
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1,109 @@
1
+ export declare const formProps: {
2
+ model: ObjectConstructor;
3
+ rules: ObjectConstructor;
4
+ inlineMessage: {
5
+ type: BooleanConstructor;
6
+ default: undefined;
7
+ };
8
+ messageType: StringConstructor;
9
+ statusIcon: BooleanConstructor;
10
+ showMessage: {
11
+ type: BooleanConstructor;
12
+ default: boolean;
13
+ };
14
+ validatePosition: {
15
+ type: StringConstructor;
16
+ default: string;
17
+ };
18
+ size: StringConstructor;
19
+ disabled: BooleanConstructor;
20
+ validateOnRuleChange: {
21
+ type: (StringConstructor | BooleanConstructor)[];
22
+ validator: (value: string | boolean) => boolean;
23
+ default: boolean;
24
+ };
25
+ hideRequiredAsterisk: {
26
+ type: BooleanConstructor;
27
+ default: undefined;
28
+ };
29
+ labelPosition: {
30
+ type: StringConstructor;
31
+ default: string;
32
+ validator: (value: string) => boolean;
33
+ };
34
+ labelWidth: {
35
+ type: StringConstructor;
36
+ default: string;
37
+ };
38
+ labelAlign: {
39
+ type: BooleanConstructor;
40
+ default: boolean;
41
+ };
42
+ contentOffset: NumberConstructor;
43
+ labelSuffix: {
44
+ type: StringConstructor;
45
+ default: string;
46
+ };
47
+ inline: {
48
+ type: BooleanConstructor;
49
+ default: boolean;
50
+ };
51
+ responsiveLayout: {
52
+ type: BooleanConstructor;
53
+ default: boolean;
54
+ };
55
+ validateType: {
56
+ type: StringConstructor;
57
+ default: string;
58
+ validator(value: string): boolean;
59
+ };
60
+ validateIcon: ObjectConstructor;
61
+ manual: {
62
+ type: BooleanConstructor;
63
+ default: boolean;
64
+ };
65
+ appendToBody: {
66
+ type: BooleanConstructor;
67
+ default: undefined;
68
+ };
69
+ popperOptions: {
70
+ type: ObjectConstructor;
71
+ default: () => {};
72
+ };
73
+ displayOnly: {
74
+ type: BooleanConstructor;
75
+ default: boolean;
76
+ };
77
+ showAutoWidth: {
78
+ type: BooleanConstructor;
79
+ default: boolean;
80
+ };
81
+ showEmptyValue: {
82
+ type: BooleanConstructor;
83
+ default: boolean;
84
+ };
85
+ validateTag: {
86
+ type: BooleanConstructor;
87
+ default: boolean;
88
+ };
89
+ overflowTitle: {
90
+ type: BooleanConstructor;
91
+ default: boolean;
92
+ };
93
+ wrapFragment: {
94
+ type: StringConstructor;
95
+ default: string;
96
+ };
97
+ tooltipConfig: {
98
+ type: ObjectConstructor;
99
+ default: () => {};
100
+ };
101
+ tiny_mode: StringConstructor;
102
+ tiny_mode_root: BooleanConstructor;
103
+ tiny_template: (ObjectConstructor | FunctionConstructor)[];
104
+ tiny_renderless: FunctionConstructor;
105
+ tiny_theme: StringConstructor;
106
+ tiny_chart_theme: ObjectConstructor;
107
+ };
108
+ declare const _default: any;
109
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;
@@ -0,0 +1,2 @@
1
+ declare const _default: any;
2
+ export default _default;