@opentinyvue/vue-checkbox 2.21.0 → 3.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/lib/index.js +1 -1
- package/lib/mobile-first.js +141 -173
- package/lib/mobile.js +111 -152
- package/lib/pc.js +131 -178
- package/package.json +4 -4
- package/src/index.d.ts +139 -2
- package/src/mobile-first.vue.d.ts +89 -1
- package/src/mobile.vue.d.ts +75 -1
- package/src/pc.vue.d.ts +84 -1
package/lib/index.js
CHANGED
package/lib/mobile-first.js
CHANGED
|
@@ -1,38 +1,42 @@
|
|
|
1
1
|
import { renderless, api } from '@opentinyvue/vue-renderless/checkbox/vue';
|
|
2
2
|
import { defineComponent, props, setup } from '@opentinyvue/vue-common';
|
|
3
3
|
import { iconHalfselect, iconCheckedSur, iconCheck } from '@opentinyvue/vue-icon';
|
|
4
|
+
import { resolveComponent, openBlock, createElementBlock, mergeProps, createElementVNode, normalizeClass, createVNode, withDirectives, withModifiers, vModelCheckbox, renderSlot, createTextVNode, toDisplayString, Fragment, createCommentVNode } from 'vue';
|
|
4
5
|
|
|
5
|
-
function
|
|
6
|
-
var
|
|
7
|
-
if (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
function _createForOfIteratorHelperLoose(r, e) {
|
|
7
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
8
|
+
if (t) return (t = t.call(r)).next.bind(t);
|
|
9
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
|
10
|
+
t && (r = t);
|
|
11
|
+
var o = 0;
|
|
12
|
+
return function() {
|
|
13
|
+
return o >= r.length ? { done: true } : { done: false, value: r[o++] };
|
|
14
|
+
};
|
|
11
15
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
}
|
|
16
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
17
|
+
}
|
|
18
|
+
function _unsupportedIterableToArray(r, a) {
|
|
19
|
+
if (r) {
|
|
20
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
21
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
22
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
28
23
|
}
|
|
29
|
-
return {
|
|
30
|
-
exports: scriptExports,
|
|
31
|
-
options
|
|
32
|
-
};
|
|
33
24
|
}
|
|
25
|
+
function _arrayLikeToArray(r, a) {
|
|
26
|
+
(null == a || a > r.length) && (a = r.length);
|
|
27
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
28
|
+
return n;
|
|
29
|
+
}
|
|
30
|
+
var _export_sfc = function _export_sfc2(sfc, props) {
|
|
31
|
+
var target = sfc.__vccOpts || sfc;
|
|
32
|
+
for (var _iterator = _createForOfIteratorHelperLoose(props), _step; !(_step = _iterator()).done; ) {
|
|
33
|
+
var _step$value = _step.value, key = _step$value[0], val = _step$value[1];
|
|
34
|
+
target[key] = val;
|
|
35
|
+
}
|
|
36
|
+
return target;
|
|
37
|
+
};
|
|
34
38
|
|
|
35
|
-
var
|
|
39
|
+
var _sfc_main = defineComponent({
|
|
36
40
|
inheritAttrs: false,
|
|
37
41
|
emits: ["update:modelValue", "change", "complete"],
|
|
38
42
|
props: [].concat(props, ["modelValue", "text", "events", "label", "indeterminate", "disabled", "checked", "name", "trueLabel", "falseLabel", "id", "controls", "size", "border", "validateEvent", "customClass", "displayOnly"]),
|
|
@@ -50,154 +54,118 @@ var __vue2_script = defineComponent({
|
|
|
50
54
|
});
|
|
51
55
|
}
|
|
52
56
|
});
|
|
53
|
-
var
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
class:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
name: "model",
|
|
140
|
-
rawName: "v-model",
|
|
141
|
-
value: _vm.state.model,
|
|
142
|
-
expression: "state.model"
|
|
143
|
-
}],
|
|
144
|
-
staticClass: "absolute left-0 right-0 top-0 bottom-0 w-0 h-0 -z-10 opacity-0",
|
|
145
|
-
attrs: {
|
|
146
|
-
"type": "checkbox",
|
|
147
|
-
"aria-hidden": _vm.indeterminate ? "true" : "false",
|
|
148
|
-
"disabled": _vm.state.inputDisabled,
|
|
149
|
-
"name": _vm.name
|
|
57
|
+
var _hoisted_1 = ["id"];
|
|
58
|
+
var _hoisted_2 = ["role", "aria-checked"];
|
|
59
|
+
var _hoisted_3 = {
|
|
60
|
+
tabindex: "1"
|
|
61
|
+
};
|
|
62
|
+
var _hoisted_4 = ["aria-hidden", "name", "disabled", "true-value", "false-value"];
|
|
63
|
+
var _hoisted_5 = ["aria-hidden", "disabled", "value", "name"];
|
|
64
|
+
var _hoisted_6 = {
|
|
65
|
+
key: 0,
|
|
66
|
+
class: "text-color-text-primary cursor-default"
|
|
67
|
+
};
|
|
68
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
69
|
+
var _component_icon_check = resolveComponent("icon-check");
|
|
70
|
+
var _component_icon_halfselect = resolveComponent("icon-halfselect");
|
|
71
|
+
var _component_icon_checked_sur = resolveComponent("icon-checked-sur");
|
|
72
|
+
return openBlock(), createElementBlock("label", mergeProps({
|
|
73
|
+
"data-tag": "tiny-checkbox",
|
|
74
|
+
class: _ctx.m("inline-flex sm:items-center text-sm leading-5 cursor-pointer", _ctx.state.size !== "mini" ? "sm:text-sm" : "sm:text-xs", {
|
|
75
|
+
"sm:py-2": _ctx.state.vertical
|
|
76
|
+
}, _ctx.state.isDisplayOnly || _ctx.state.isGroupDisplayOnly ? _ctx.state.isChecked ? "cursor-default after:content-[';'] after:inline-block last:after:content-['']" : "hidden" : "", _ctx.state.showLabel ? "inline-flex" : "", _ctx.customClass),
|
|
77
|
+
id: _ctx.id,
|
|
78
|
+
tabindex: "-1"
|
|
79
|
+
}, _ctx.a(_ctx.$attrs, ["class", "style", "onClick"], true)), [createElementVNode("span", {
|
|
80
|
+
class: normalizeClass(["relative w-7 h-7 mr-2 sm:mr-0 sm:p-0", _ctx.state.size === "medium" ? "sm:w-6 sm:h-6" : "sm:h-4 sm:w-4", _ctx.state.isDisplayOnly || _ctx.state.isGroupDisplayOnly ? "hidden" : ""]),
|
|
81
|
+
role: _ctx.indeterminate ? "checkbox" : false,
|
|
82
|
+
"aria-checked": _ctx.indeterminate ? "mixed" : false
|
|
83
|
+
}, [createElementVNode("span", _hoisted_3, [createVNode(_component_icon_check, {
|
|
84
|
+
"data-tag": "icon-check",
|
|
85
|
+
class: normalizeClass(_ctx.m("w-5 h-5 absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 z-0", _ctx.state.size === "medium" ? "sm:w-6 sm:h-6" : "sm:w-4 sm:h-4", _ctx.state.isDisabled ? "[&_path:nth-of-type(2)]:fill-color-icon-disabled [&_path:nth-of-type(1)]:fill-color-bg-3 cursor-not-allowed" : "[&_path:nth-of-type(1)]:fill-color-icon-inverse [&_path:nth-of-type(2)]:fill-color-none-hover"))
|
|
86
|
+
}, null, 8, ["class"]), createVNode(_component_icon_halfselect, {
|
|
87
|
+
"data-tag": "icon-halfselect",
|
|
88
|
+
class: normalizeClass(_ctx.m("w-5 h-5 absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 transition-all [&_path:nth-of-type(2)]:fill-color-icon-inverse", _ctx.indeterminate ? "opacity-100 scale-100 z-10" : "opacity-0 scale-0 z-0", _ctx.state.isDisabled ? "[&_path:nth-of-type(1)]:fill-color-brand-disabled cursor-not-allowed" : "[&_path:nth-of-type(1)]:fill-color-brand [&_path:nth-of-type(1)]:shadow-xsm", _ctx.state.size === "medium" ? "sm:w-6 sm:h-6" : "sm:w-4 sm:h-4"))
|
|
89
|
+
}, null, 8, ["class"]), createVNode(_component_icon_checked_sur, {
|
|
90
|
+
"data-tag": "icon-checked-sur",
|
|
91
|
+
class: normalizeClass(_ctx.m("w-5 h-5", _ctx.state.size === "medium" ? "sm:w-6 sm:h-6" : "sm:w-4 sm:h-4", "absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 transition-all [&_path:nth-of-type(2)]:fill-color-icon-inverse", _ctx.state.isChecked && !_ctx.indeterminate ? "opacity-100 scale-100 z-10" : "opacity-0 scale-0 z-0", _ctx.state.isDisabled ? "[&_path:nth-of-type(1)]:fill-color-brand-disabled cursor-not-allowed" : "[&_path:nth-of-type(1)]:fill-color-brand [&_path:nth-of-type(2)]:shadow-xsm"))
|
|
92
|
+
}, null, 8, ["class"])]), _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
|
|
93
|
+
key: 0,
|
|
94
|
+
class: "absolute left-0 right-0 top-0 bottom-0 w-0 h-0 -z-10 opacity-0",
|
|
95
|
+
type: "checkbox",
|
|
96
|
+
"aria-hidden": _ctx.indeterminate ? "true" : "false",
|
|
97
|
+
name: _ctx.name,
|
|
98
|
+
disabled: _ctx.state.inputDisabled,
|
|
99
|
+
"true-value": _ctx.trueLabel,
|
|
100
|
+
"false-value": _ctx.falseLabel,
|
|
101
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = function($event) {
|
|
102
|
+
return _ctx.state.model = $event;
|
|
103
|
+
}),
|
|
104
|
+
onChange: _cache[1] || (_cache[1] = withModifiers(function() {
|
|
105
|
+
return _ctx.handleChange && _ctx.handleChange.apply(_ctx, arguments);
|
|
106
|
+
}, ["stop"])),
|
|
107
|
+
onFocus: _cache[2] || (_cache[2] = function($event) {
|
|
108
|
+
return _ctx.state.focus = true;
|
|
109
|
+
}),
|
|
110
|
+
onBlur: _cache[3] || (_cache[3] = function($event) {
|
|
111
|
+
return _ctx.state.focus = false;
|
|
112
|
+
}),
|
|
113
|
+
onClick: _cache[4] || (_cache[4] = withModifiers(function() {
|
|
114
|
+
}, ["stop"]))
|
|
115
|
+
}, null, 40, _hoisted_4)), [[vModelCheckbox, _ctx.state.model]]) : withDirectives((openBlock(), createElementBlock("input", {
|
|
116
|
+
key: 1,
|
|
117
|
+
class: "absolute left-0 right-0 top-0 bottom-0 w-0 h-0 -z-10 opacity-0",
|
|
118
|
+
type: "checkbox",
|
|
119
|
+
"aria-hidden": _ctx.indeterminate ? "true" : "false",
|
|
120
|
+
disabled: _ctx.state.inputDisabled,
|
|
121
|
+
value: _ctx.label,
|
|
122
|
+
name: _ctx.name,
|
|
123
|
+
"onUpdate:modelValue": _cache[5] || (_cache[5] = function($event) {
|
|
124
|
+
return _ctx.state.model = $event;
|
|
125
|
+
}),
|
|
126
|
+
onChange: _cache[6] || (_cache[6] = withModifiers(function() {
|
|
127
|
+
return _ctx.handleChange && _ctx.handleChange.apply(_ctx, arguments);
|
|
128
|
+
}, ["stop"])),
|
|
129
|
+
onFocus: _cache[7] || (_cache[7] = function($event) {
|
|
130
|
+
return _ctx.state.focus = true;
|
|
131
|
+
}),
|
|
132
|
+
onBlur: _cache[8] || (_cache[8] = function($event) {
|
|
133
|
+
return _ctx.state.focus = false;
|
|
134
|
+
}),
|
|
135
|
+
onClick: _cache[9] || (_cache[9] = withModifiers(function() {
|
|
136
|
+
}, ["stop"]))
|
|
137
|
+
}, null, 40, _hoisted_5)), [[vModelCheckbox, _ctx.state.model]])], 10, _hoisted_2), _ctx.slots.default && _ctx.slots.default() || _ctx.text || _ctx.label ? (openBlock(), createElementBlock(
|
|
138
|
+
"span",
|
|
139
|
+
{
|
|
140
|
+
key: 0,
|
|
141
|
+
ref: "label",
|
|
142
|
+
class: normalizeClass(_ctx.m("py-0 pl-0 sm:pl-2 mr-5 flex-1 leading-7 sm:leading-none", _ctx.state.isDisabled ? "cursor-not-allowed text-color-text-secondary" : "text-color-text-primary", _ctx.state.isDisplayOnly || _ctx.state.isGroupDisplayOnly ? "p-0 sm:p-0 m-0 text-color-text-primary cursor-default" : ""))
|
|
150
143
|
},
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
144
|
+
[renderSlot(_ctx.$slots, "default", {}, function() {
|
|
145
|
+
return [createTextVNode(
|
|
146
|
+
toDisplayString(_ctx.text || _ctx.label),
|
|
147
|
+
1
|
|
148
|
+
/* TEXT */
|
|
149
|
+
)];
|
|
150
|
+
})],
|
|
151
|
+
2
|
|
152
|
+
/* CLASS */
|
|
153
|
+
)) : (openBlock(), createElementBlock(
|
|
154
|
+
Fragment,
|
|
155
|
+
{
|
|
156
|
+
key: 1
|
|
154
157
|
},
|
|
155
|
-
|
|
156
|
-
"
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
} else {
|
|
166
|
-
_vm.$set(_vm.state, "model", $$c);
|
|
167
|
-
}
|
|
168
|
-
}, function($event) {
|
|
169
|
-
$event.stopPropagation();
|
|
170
|
-
return _vm.handleChange.apply(null, arguments);
|
|
171
|
-
}],
|
|
172
|
-
"focus": function focus($event) {
|
|
173
|
-
_vm.state.focus = true;
|
|
174
|
-
},
|
|
175
|
-
"blur": function blur($event) {
|
|
176
|
-
_vm.state.focus = false;
|
|
177
|
-
},
|
|
178
|
-
"click": function click($event) {
|
|
179
|
-
$event.stopPropagation();
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
})]), _vm.slots.default && _vm.slots.default() || _vm.text || _vm.label ? _c("span", {
|
|
183
|
-
ref: "label",
|
|
184
|
-
class: _vm.m("py-0 pl-0 sm:pl-2 mr-5 flex-1 leading-7 sm:leading-none", _vm.state.isDisabled ? "cursor-not-allowed text-color-text-secondary" : "text-color-text-primary", _vm.state.isDisplayOnly || _vm.state.isGroupDisplayOnly ? "p-0 sm:p-0 m-0 text-color-text-primary cursor-default" : "")
|
|
185
|
-
}, [_vm._t("default", function() {
|
|
186
|
-
return [_vm._v(_vm._s(_vm.text || _vm.label))];
|
|
187
|
-
})], 2) : [_vm.state.isDisplayOnly ? _c("span", {
|
|
188
|
-
staticClass: "text-color-text-primary cursor-default"
|
|
189
|
-
}, [_vm._v(" " + _vm._s(_vm.state.displayLabel))]) : _vm._e()]], 2);
|
|
190
|
-
};
|
|
191
|
-
var staticRenderFns = [];
|
|
192
|
-
var __cssModules = {};
|
|
193
|
-
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
|
|
194
|
-
function __vue2_injectStyles(context) {
|
|
195
|
-
for (var o in __cssModules) {
|
|
196
|
-
this[o] = __cssModules[o];
|
|
197
|
-
}
|
|
158
|
+
[_ctx.state.isDisplayOnly ? (openBlock(), createElementBlock(
|
|
159
|
+
"span",
|
|
160
|
+
_hoisted_6,
|
|
161
|
+
toDisplayString(_ctx.state.displayLabel),
|
|
162
|
+
1
|
|
163
|
+
/* TEXT */
|
|
164
|
+
)) : createCommentVNode("v-if", true)],
|
|
165
|
+
64
|
|
166
|
+
/* STABLE_FRAGMENT */
|
|
167
|
+
))], 16, _hoisted_1);
|
|
198
168
|
}
|
|
199
|
-
var mobileFirst = /* @__PURE__ */
|
|
200
|
-
return __component__.exports;
|
|
201
|
-
}();
|
|
169
|
+
var mobileFirst = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
202
170
|
|
|
203
171
|
export { mobileFirst as default };
|
package/lib/mobile.js
CHANGED
|
@@ -1,38 +1,42 @@
|
|
|
1
1
|
import { renderless, api } from '@opentinyvue/vue-renderless/checkbox/vue';
|
|
2
2
|
import { defineComponent, props, setup } from '@opentinyvue/vue-common';
|
|
3
3
|
import '@opentinyvue/vue-theme-mobile/checkbox/index.css';
|
|
4
|
+
import { openBlock, createElementBlock, normalizeClass, createElementVNode, withDirectives, withModifiers, vModelCheckbox, renderSlot, createTextVNode, toDisplayString, createCommentVNode } from 'vue';
|
|
4
5
|
|
|
5
|
-
function
|
|
6
|
-
var
|
|
7
|
-
if (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
function _createForOfIteratorHelperLoose(r, e) {
|
|
7
|
+
var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
8
|
+
if (t) return (t = t.call(r)).next.bind(t);
|
|
9
|
+
if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
|
|
10
|
+
t && (r = t);
|
|
11
|
+
var o = 0;
|
|
12
|
+
return function() {
|
|
13
|
+
return o >= r.length ? { done: true } : { done: false, value: r[o++] };
|
|
14
|
+
};
|
|
11
15
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
}
|
|
16
|
+
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
17
|
+
}
|
|
18
|
+
function _unsupportedIterableToArray(r, a) {
|
|
19
|
+
if (r) {
|
|
20
|
+
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
21
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
22
|
+
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
28
23
|
}
|
|
29
|
-
return {
|
|
30
|
-
exports: scriptExports,
|
|
31
|
-
options
|
|
32
|
-
};
|
|
33
24
|
}
|
|
25
|
+
function _arrayLikeToArray(r, a) {
|
|
26
|
+
(null == a || a > r.length) && (a = r.length);
|
|
27
|
+
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
28
|
+
return n;
|
|
29
|
+
}
|
|
30
|
+
var _export_sfc = function _export_sfc2(sfc, props) {
|
|
31
|
+
var target = sfc.__vccOpts || sfc;
|
|
32
|
+
for (var _iterator = _createForOfIteratorHelperLoose(props), _step; !(_step = _iterator()).done; ) {
|
|
33
|
+
var _step$value = _step.value, key = _step$value[0], val = _step$value[1];
|
|
34
|
+
target[key] = val;
|
|
35
|
+
}
|
|
36
|
+
return target;
|
|
37
|
+
};
|
|
34
38
|
|
|
35
|
-
var
|
|
39
|
+
var _sfc_main = defineComponent({
|
|
36
40
|
props: [].concat(props, ["modelValue", "text", "events", "label", "indeterminate", "disabled", "checked", "name", "trueLabel", "falseLabel", "id", "iconPosition"]),
|
|
37
41
|
emits: ["update:modelValue", "change", "complete", "click"],
|
|
38
42
|
setup: function setup$1(props2, context) {
|
|
@@ -44,132 +48,87 @@ var __vue2_script = defineComponent({
|
|
|
44
48
|
});
|
|
45
49
|
}
|
|
46
50
|
});
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
}, [_c("span", {
|
|
64
|
-
staticClass: "tiny-mobile-checkbox__input",
|
|
65
|
-
attrs: {
|
|
66
|
-
"tabindex": _vm.indeterminate ? 0 : false,
|
|
67
|
-
"role": _vm.indeterminate ? "checkbox" : false,
|
|
68
|
-
"aria-checked": _vm.indeterminate ? "mixed" : false
|
|
69
|
-
}
|
|
70
|
-
}, [_c("span", {
|
|
71
|
-
staticClass: "tiny-mobile-checkbox__inner"
|
|
72
|
-
}), _vm.trueLabel || _vm.falseLabel ? _c("input", {
|
|
73
|
-
directives: [{
|
|
74
|
-
name: "model",
|
|
75
|
-
rawName: "v-model",
|
|
76
|
-
value: _vm.state.model,
|
|
77
|
-
expression: "state.model"
|
|
78
|
-
}],
|
|
79
|
-
staticClass: "tiny-mobile-checkbox__original",
|
|
80
|
-
attrs: {
|
|
81
|
-
"type": "checkbox",
|
|
82
|
-
"aria-hidden": _vm.indeterminate ? "true" : "false",
|
|
83
|
-
"name": _vm.name,
|
|
84
|
-
"disabled": _vm.state.isDisabled,
|
|
85
|
-
"true-value": _vm.trueLabel,
|
|
86
|
-
"false-value": _vm.falseLabel
|
|
87
|
-
},
|
|
88
|
-
domProps: {
|
|
89
|
-
"checked": Array.isArray(_vm.state.model) ? _vm._i(_vm.state.model, null) > -1 : _vm._q(_vm.state.model, _vm.trueLabel)
|
|
90
|
-
},
|
|
91
|
-
on: {
|
|
92
|
-
"change": [function($event) {
|
|
93
|
-
var $$a = _vm.state.model, $$el = $event.target, $$c = $$el.checked ? _vm.trueLabel : _vm.falseLabel;
|
|
94
|
-
if (Array.isArray($$a)) {
|
|
95
|
-
var $$v = null, $$i = _vm._i($$a, $$v);
|
|
96
|
-
if ($$el.checked) {
|
|
97
|
-
$$i < 0 && _vm.$set(_vm.state, "model", $$a.concat([$$v]));
|
|
98
|
-
} else {
|
|
99
|
-
$$i > -1 && _vm.$set(_vm.state, "model", $$a.slice(0, $$i).concat($$a.slice($$i + 1)));
|
|
100
|
-
}
|
|
101
|
-
} else {
|
|
102
|
-
_vm.$set(_vm.state, "model", $$c);
|
|
103
|
-
}
|
|
104
|
-
}, function($event) {
|
|
105
|
-
$event.stopPropagation();
|
|
106
|
-
return _vm.handleChange.apply(null, arguments);
|
|
107
|
-
}],
|
|
108
|
-
"focus": function focus($event) {
|
|
109
|
-
_vm.state.focus = true;
|
|
110
|
-
},
|
|
111
|
-
"blur": function blur($event) {
|
|
112
|
-
_vm.state.focus = false;
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}) : _c("input", {
|
|
116
|
-
directives: [{
|
|
117
|
-
name: "model",
|
|
118
|
-
rawName: "v-model",
|
|
119
|
-
value: _vm.state.model,
|
|
120
|
-
expression: "state.model"
|
|
121
|
-
}],
|
|
122
|
-
staticClass: "tiny-mobile-checkbox__original",
|
|
123
|
-
attrs: {
|
|
124
|
-
"type": "checkbox",
|
|
125
|
-
"aria-hidden": _vm.indeterminate ? "true" : "false",
|
|
126
|
-
"disabled": _vm.state.isDisabled,
|
|
127
|
-
"name": _vm.name
|
|
128
|
-
},
|
|
129
|
-
domProps: {
|
|
130
|
-
"value": _vm.label,
|
|
131
|
-
"checked": Array.isArray(_vm.state.model) ? _vm._i(_vm.state.model, _vm.label) > -1 : _vm.state.model
|
|
132
|
-
},
|
|
133
|
-
on: {
|
|
134
|
-
"change": [function($event) {
|
|
135
|
-
var $$a = _vm.state.model, $$el = $event.target, $$c = $$el.checked ? true : false;
|
|
136
|
-
if (Array.isArray($$a)) {
|
|
137
|
-
var $$v = _vm.label, $$i = _vm._i($$a, $$v);
|
|
138
|
-
if ($$el.checked) {
|
|
139
|
-
$$i < 0 && _vm.$set(_vm.state, "model", $$a.concat([$$v]));
|
|
140
|
-
} else {
|
|
141
|
-
$$i > -1 && _vm.$set(_vm.state, "model", $$a.slice(0, $$i).concat($$a.slice($$i + 1)));
|
|
142
|
-
}
|
|
143
|
-
} else {
|
|
144
|
-
_vm.$set(_vm.state, "model", $$c);
|
|
145
|
-
}
|
|
146
|
-
}, function($event) {
|
|
147
|
-
$event.stopPropagation();
|
|
148
|
-
return _vm.handleChange.apply(null, arguments);
|
|
149
|
-
}],
|
|
150
|
-
"focus": function focus($event) {
|
|
151
|
-
_vm.state.focus = true;
|
|
152
|
-
},
|
|
153
|
-
"blur": function blur($event) {
|
|
154
|
-
_vm.state.focus = false;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
})]), _vm.slots.default && _vm.slots.default() || _vm.state.isShowText ? _c("span", {
|
|
158
|
-
staticClass: "tiny-mobile-checkbox__label"
|
|
159
|
-
}, [_vm._t("default", function() {
|
|
160
|
-
return [_vm._v(_vm._s(_vm.state.showText))];
|
|
161
|
-
})], 2) : _vm._e()]);
|
|
51
|
+
var _hoisted_1 = ["id"];
|
|
52
|
+
var _hoisted_2 = ["tabindex", "role", "aria-checked"];
|
|
53
|
+
var _hoisted_3 = /* @__PURE__ */ createElementVNode(
|
|
54
|
+
"span",
|
|
55
|
+
{
|
|
56
|
+
class: "tiny-mobile-checkbox__inner"
|
|
57
|
+
},
|
|
58
|
+
null,
|
|
59
|
+
-1
|
|
60
|
+
/* HOISTED */
|
|
61
|
+
);
|
|
62
|
+
var _hoisted_4 = ["aria-hidden", "name", "disabled", "true-value", "false-value"];
|
|
63
|
+
var _hoisted_5 = ["aria-hidden", "disabled", "value", "name"];
|
|
64
|
+
var _hoisted_6 = {
|
|
65
|
+
key: 0,
|
|
66
|
+
class: "tiny-mobile-checkbox__label"
|
|
162
67
|
};
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
68
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
69
|
+
return openBlock(), createElementBlock("label", {
|
|
70
|
+
class: normalizeClass(["tiny-mobile-checkbox", {
|
|
71
|
+
"is-disabled": _ctx.state.isDisabled,
|
|
72
|
+
"is-checked": _ctx.state.isChecked,
|
|
73
|
+
"is-indeterminate": _ctx.indeterminate,
|
|
74
|
+
"is-focus": _ctx.state.focus,
|
|
75
|
+
"icon-position-top": _ctx.state.iconPosition === "top"
|
|
76
|
+
}]),
|
|
77
|
+
id: _ctx.id
|
|
78
|
+
}, [createElementVNode("span", {
|
|
79
|
+
class: "tiny-mobile-checkbox__input",
|
|
80
|
+
tabindex: _ctx.indeterminate ? 0 : false,
|
|
81
|
+
role: _ctx.indeterminate ? "checkbox" : false,
|
|
82
|
+
"aria-checked": _ctx.indeterminate ? "mixed" : false
|
|
83
|
+
}, [_hoisted_3, _ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
|
|
84
|
+
key: 0,
|
|
85
|
+
class: "tiny-mobile-checkbox__original",
|
|
86
|
+
type: "checkbox",
|
|
87
|
+
"aria-hidden": _ctx.indeterminate ? "true" : "false",
|
|
88
|
+
name: _ctx.name,
|
|
89
|
+
disabled: _ctx.state.isDisabled,
|
|
90
|
+
"true-value": _ctx.trueLabel,
|
|
91
|
+
"false-value": _ctx.falseLabel,
|
|
92
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = function($event) {
|
|
93
|
+
return _ctx.state.model = $event;
|
|
94
|
+
}),
|
|
95
|
+
onChange: _cache[1] || (_cache[1] = withModifiers(function() {
|
|
96
|
+
return _ctx.handleChange && _ctx.handleChange.apply(_ctx, arguments);
|
|
97
|
+
}, ["stop"])),
|
|
98
|
+
onFocus: _cache[2] || (_cache[2] = function($event) {
|
|
99
|
+
return _ctx.state.focus = true;
|
|
100
|
+
}),
|
|
101
|
+
onBlur: _cache[3] || (_cache[3] = function($event) {
|
|
102
|
+
return _ctx.state.focus = false;
|
|
103
|
+
})
|
|
104
|
+
}, null, 40, _hoisted_4)), [[vModelCheckbox, _ctx.state.model]]) : withDirectives((openBlock(), createElementBlock("input", {
|
|
105
|
+
key: 1,
|
|
106
|
+
class: "tiny-mobile-checkbox__original",
|
|
107
|
+
type: "checkbox",
|
|
108
|
+
"aria-hidden": _ctx.indeterminate ? "true" : "false",
|
|
109
|
+
disabled: _ctx.state.isDisabled,
|
|
110
|
+
value: _ctx.label,
|
|
111
|
+
name: _ctx.name,
|
|
112
|
+
"onUpdate:modelValue": _cache[4] || (_cache[4] = function($event) {
|
|
113
|
+
return _ctx.state.model = $event;
|
|
114
|
+
}),
|
|
115
|
+
onChange: _cache[5] || (_cache[5] = withModifiers(function() {
|
|
116
|
+
return _ctx.handleChange && _ctx.handleChange.apply(_ctx, arguments);
|
|
117
|
+
}, ["stop"])),
|
|
118
|
+
onFocus: _cache[6] || (_cache[6] = function($event) {
|
|
119
|
+
return _ctx.state.focus = true;
|
|
120
|
+
}),
|
|
121
|
+
onBlur: _cache[7] || (_cache[7] = function($event) {
|
|
122
|
+
return _ctx.state.focus = false;
|
|
123
|
+
})
|
|
124
|
+
}, null, 40, _hoisted_5)), [[vModelCheckbox, _ctx.state.model]])], 8, _hoisted_2), _ctx.slots.default && _ctx.slots.default() || _ctx.state.isShowText ? (openBlock(), createElementBlock("span", _hoisted_6, [renderSlot(_ctx.$slots, "default", {}, function() {
|
|
125
|
+
return [createTextVNode(
|
|
126
|
+
toDisplayString(_ctx.state.showText),
|
|
127
|
+
1
|
|
128
|
+
/* TEXT */
|
|
129
|
+
)];
|
|
130
|
+
})])) : createCommentVNode("v-if", true)], 10, _hoisted_1);
|
|
170
131
|
}
|
|
171
|
-
var mobile = /* @__PURE__ */
|
|
172
|
-
return __component__.exports;
|
|
173
|
-
}();
|
|
132
|
+
var mobile = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
174
133
|
|
|
175
134
|
export { mobile as default };
|