@opentinyvue/vue-checkbox-button 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 CHANGED
@@ -54,7 +54,7 @@ var CheckboxButton = defineComponent({
54
54
  });
55
55
  }
56
56
  });
57
- var version = "2.21.0";
57
+ var version = "3.21.0";
58
58
  CheckboxButton.model = {
59
59
  prop: "modelValue",
60
60
  event: "update:modelValue"
package/lib/pc.js CHANGED
@@ -1,37 +1,41 @@
1
1
  import { renderless, api } from '@opentinyvue/vue-renderless/checkbox-button/vue';
2
2
  import { defineComponent, props, setup } from '@opentinyvue/vue-common';
3
+ import { openBlock, createElementBlock, normalizeClass, withDirectives, vModelCheckbox, normalizeStyle, renderSlot, createTextVNode, toDisplayString, createCommentVNode } from 'vue';
3
4
 
4
- function normalizeComponent(scriptExports, render, staticRenderFns, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
5
- var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
6
- if (render) {
7
- options.render = render;
8
- options.staticRenderFns = staticRenderFns;
9
- options._compiled = true;
5
+ function _createForOfIteratorHelperLoose(r, e) {
6
+ var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
7
+ if (t) return (t = t.call(r)).next.bind(t);
8
+ if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) {
9
+ t && (r = t);
10
+ var o = 0;
11
+ return function() {
12
+ return o >= r.length ? { done: true } : { done: false, value: r[o++] };
13
+ };
10
14
  }
11
- var hook;
12
- if (injectStyles) {
13
- hook = injectStyles;
14
- }
15
- if (hook) {
16
- if (options.functional) {
17
- options._injectStyles = hook;
18
- var originalRender = options.render;
19
- options.render = function renderWithStyleInjection(h, context) {
20
- hook.call(context);
21
- return originalRender(h, context);
22
- };
23
- } else {
24
- var existing = options.beforeCreate;
25
- options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
26
- }
15
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
16
+ }
17
+ function _unsupportedIterableToArray(r, a) {
18
+ if (r) {
19
+ if ("string" == typeof r) return _arrayLikeToArray(r, a);
20
+ var t = {}.toString.call(r).slice(8, -1);
21
+ 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;
27
22
  }
28
- return {
29
- exports: scriptExports,
30
- options
31
- };
32
23
  }
24
+ function _arrayLikeToArray(r, a) {
25
+ (null == a || a > r.length) && (a = r.length);
26
+ for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
27
+ return n;
28
+ }
29
+ var _export_sfc = function _export_sfc2(sfc, props) {
30
+ var target = sfc.__vccOpts || sfc;
31
+ for (var _iterator = _createForOfIteratorHelperLoose(props), _step; !(_step = _iterator()).done; ) {
32
+ var _step$value = _step.value, key = _step$value[0], val = _step$value[1];
33
+ target[key] = val;
34
+ }
35
+ return target;
36
+ };
33
37
 
34
- var __vue2_script = defineComponent({
38
+ var _sfc_main = /* @__PURE__ */ defineComponent({
35
39
  emits: ["change", "update:modelValue"],
36
40
  props: [].concat(props, ["modelValue", "label", "text", "events", "disabled", "checked", "name", "trueLabel", "falseLabel", "tabindex"]),
37
41
  setup: function setup$1(props2, context) {
@@ -43,120 +47,80 @@ var __vue2_script = defineComponent({
43
47
  });
44
48
  }
45
49
  });
46
- var render = function render2() {
47
- var _vm = this;
48
- var _h = _vm.$createElement;
49
- var _c = _vm._self._c || _h;
50
- return _c("label", {
51
- staticClass: "tiny-checkbox-button",
52
- class: [_vm.state.size ? "tiny-checkbox-button--" + _vm.state.size : "", {
53
- "is-disabled": _vm.state.isDisabled
50
+ var _hoisted_1 = ["aria-checked", "aria-disabled"];
51
+ var _hoisted_2 = ["name", "tabindex", "disabled", "true-value", "false-value"];
52
+ var _hoisted_3 = ["name", "tabindex", "disabled", "value"];
53
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
54
+ return openBlock(), createElementBlock("label", {
55
+ class: normalizeClass(["tiny-checkbox-button", [_ctx.state.size ? "tiny-checkbox-button--" + _ctx.state.size : "", {
56
+ "is-disabled": _ctx.state.isDisabled
54
57
  }, {
55
- "is-checked": _vm.state.isChecked
58
+ "is-checked": _ctx.state.isChecked
56
59
  }, {
57
- "is-focus": _vm.state.focus
58
- }],
59
- attrs: {
60
- "role": "checkbox",
61
- "aria-checked": _vm.state.isChecked,
62
- "aria-disabled": _vm.state.isDisabled
63
- }
64
- }, [_vm.trueLabel || _vm.falseLabel ? _c("input", {
65
- directives: [{
66
- name: "model",
67
- rawName: "v-model",
68
- value: _vm.state.model,
69
- expression: "state.model"
70
- }],
71
- staticClass: "tiny-checkbox-button__original",
72
- attrs: {
73
- "type": "checkbox",
74
- "name": _vm.name,
75
- "tabindex": _vm.tabindex,
76
- "disabled": _vm.state.isDisabled,
77
- "true-value": _vm.trueLabel,
78
- "false-value": _vm.falseLabel
60
+ "is-focus": _ctx.state.focus
61
+ }]]),
62
+ role: "checkbox",
63
+ "aria-checked": _ctx.state.isChecked,
64
+ "aria-disabled": _ctx.state.isDisabled
65
+ }, [_ctx.trueLabel || _ctx.falseLabel ? withDirectives((openBlock(), createElementBlock("input", {
66
+ key: 0,
67
+ class: "tiny-checkbox-button__original",
68
+ type: "checkbox",
69
+ name: _ctx.name,
70
+ tabindex: _ctx.tabindex,
71
+ disabled: _ctx.state.isDisabled,
72
+ "true-value": _ctx.trueLabel,
73
+ "false-value": _ctx.falseLabel,
74
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = function($event) {
75
+ return _ctx.state.model = $event;
76
+ }),
77
+ onChange: _cache[1] || (_cache[1] = function() {
78
+ return _ctx.handleChange && _ctx.handleChange.apply(_ctx, arguments);
79
+ }),
80
+ onFocus: _cache[2] || (_cache[2] = function($event) {
81
+ return _ctx.state.focus = true;
82
+ }),
83
+ onBlur: _cache[3] || (_cache[3] = function($event) {
84
+ return _ctx.state.focus = false;
85
+ })
86
+ }, null, 40, _hoisted_2)), [[vModelCheckbox, _ctx.state.model]]) : withDirectives((openBlock(), createElementBlock("input", {
87
+ key: 1,
88
+ class: "tiny-checkbox-button__original",
89
+ type: "checkbox",
90
+ name: _ctx.name,
91
+ tabindex: _ctx.tabindex,
92
+ disabled: _ctx.state.isDisabled,
93
+ value: _ctx.label,
94
+ "onUpdate:modelValue": _cache[4] || (_cache[4] = function($event) {
95
+ return _ctx.state.model = $event;
96
+ }),
97
+ onChange: _cache[5] || (_cache[5] = function() {
98
+ return _ctx.handleChange && _ctx.handleChange.apply(_ctx, arguments);
99
+ }),
100
+ onFocus: _cache[6] || (_cache[6] = function($event) {
101
+ return _ctx.state.focus = true;
102
+ }),
103
+ onBlur: _cache[7] || (_cache[7] = function($event) {
104
+ return _ctx.state.focus = false;
105
+ })
106
+ }, null, 40, _hoisted_3)), [[vModelCheckbox, _ctx.state.model]]), _ctx.slots.default || _ctx.state.isShowText ? (openBlock(), createElementBlock(
107
+ "span",
108
+ {
109
+ key: 2,
110
+ class: "tiny-checkbox-button__inner",
111
+ style: normalizeStyle(_ctx.state.isChecked ? _ctx.state.activeStyle : null)
79
112
  },
80
- domProps: {
81
- "checked": Array.isArray(_vm.state.model) ? _vm._i(_vm.state.model, null) > -1 : _vm._q(_vm.state.model, _vm.trueLabel)
82
- },
83
- on: {
84
- "change": [function($event) {
85
- var $$a = _vm.state.model, $$el = $event.target, $$c = $$el.checked ? _vm.trueLabel : _vm.falseLabel;
86
- if (Array.isArray($$a)) {
87
- var $$v = null, $$i = _vm._i($$a, $$v);
88
- if ($$el.checked) {
89
- $$i < 0 && _vm.$set(_vm.state, "model", $$a.concat([$$v]));
90
- } else {
91
- $$i > -1 && _vm.$set(_vm.state, "model", $$a.slice(0, $$i).concat($$a.slice($$i + 1)));
92
- }
93
- } else {
94
- _vm.$set(_vm.state, "model", $$c);
95
- }
96
- }, _vm.handleChange],
97
- "focus": function focus($event) {
98
- _vm.state.focus = true;
99
- },
100
- "blur": function blur($event) {
101
- _vm.state.focus = false;
102
- }
103
- }
104
- }) : _c("input", {
105
- directives: [{
106
- name: "model",
107
- rawName: "v-model",
108
- value: _vm.state.model,
109
- expression: "state.model"
110
- }],
111
- staticClass: "tiny-checkbox-button__original",
112
- attrs: {
113
- "type": "checkbox",
114
- "name": _vm.name,
115
- "tabindex": _vm.tabindex,
116
- "disabled": _vm.state.isDisabled
117
- },
118
- domProps: {
119
- "value": _vm.label,
120
- "checked": Array.isArray(_vm.state.model) ? _vm._i(_vm.state.model, _vm.label) > -1 : _vm.state.model
121
- },
122
- on: {
123
- "change": [function($event) {
124
- var $$a = _vm.state.model, $$el = $event.target, $$c = $$el.checked ? true : false;
125
- if (Array.isArray($$a)) {
126
- var $$v = _vm.label, $$i = _vm._i($$a, $$v);
127
- if ($$el.checked) {
128
- $$i < 0 && _vm.$set(_vm.state, "model", $$a.concat([$$v]));
129
- } else {
130
- $$i > -1 && _vm.$set(_vm.state, "model", $$a.slice(0, $$i).concat($$a.slice($$i + 1)));
131
- }
132
- } else {
133
- _vm.$set(_vm.state, "model", $$c);
134
- }
135
- }, _vm.handleChange],
136
- "focus": function focus($event) {
137
- _vm.state.focus = true;
138
- },
139
- "blur": function blur($event) {
140
- _vm.state.focus = false;
141
- }
142
- }
143
- }), _vm.slots.default || _vm.state.isShowText ? _c("span", {
144
- staticClass: "tiny-checkbox-button__inner",
145
- style: _vm.state.isChecked ? _vm.state.activeStyle : null
146
- }, [_vm._t("default", function() {
147
- return [_vm._v(_vm._s(_vm.state.showText))];
148
- })], 2) : _vm._e()]);
149
- };
150
- var staticRenderFns = [];
151
- var __cssModules = {};
152
- var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles);
153
- function __vue2_injectStyles(context) {
154
- for (var o in __cssModules) {
155
- this[o] = __cssModules[o];
156
- }
113
+ [renderSlot(_ctx.$slots, "default", {}, function() {
114
+ return [createTextVNode(
115
+ toDisplayString(_ctx.state.showText),
116
+ 1
117
+ /* TEXT */
118
+ )];
119
+ })],
120
+ 4
121
+ /* STYLE */
122
+ )) : createCommentVNode("v-if", true)], 10, _hoisted_1);
157
123
  }
158
- var pc = /* @__PURE__ */ function() {
159
- return __component__.exports;
160
- }();
124
+ var pc = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
161
125
 
162
126
  export { pc as default };
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@opentinyvue/vue-checkbox-button",
3
- "version": "2.21.0",
3
+ "version": "3.21.0",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "module": "./lib/index.js",
7
7
  "sideEffects": false,
8
8
  "type": "module",
9
9
  "dependencies": {
10
- "@opentinyvue/vue-common": "~2.21.0",
10
+ "@opentinyvue/vue-common": "~3.21.0",
11
11
  "@opentinyvue/vue-renderless": "~3.21.0",
12
12
  "@opentinyvue/vue-theme": "~3.21.0"
13
13
  },
package/src/index.d.ts CHANGED
@@ -1,2 +1,69 @@
1
- declare const _default: any;
1
+ declare const _default: import("@vue/runtime-core").DefineComponent<{
2
+ _constants: {
3
+ type: ObjectConstructor;
4
+ default: () => {
5
+ CHECKBOX_GROUP: string;
6
+ };
7
+ };
8
+ modelValue: {};
9
+ label: {};
10
+ disabled: BooleanConstructor;
11
+ checked: BooleanConstructor;
12
+ name: StringConstructor;
13
+ trueLabel: (StringConstructor | NumberConstructor)[];
14
+ falseLabel: (StringConstructor | NumberConstructor)[];
15
+ text: StringConstructor;
16
+ events: {
17
+ type: ObjectConstructor;
18
+ default: () => {};
19
+ };
20
+ tabindex: {
21
+ type: StringConstructor;
22
+ default: string;
23
+ };
24
+ tiny_mode: StringConstructor;
25
+ tiny_mode_root: BooleanConstructor;
26
+ tiny_template: (ObjectConstructor | FunctionConstructor)[];
27
+ tiny_renderless: FunctionConstructor;
28
+ tiny_theme: StringConstructor;
29
+ tiny_chart_theme: ObjectConstructor;
30
+ }, () => import("@vue/runtime-core").VNode<import("@vue/runtime-core").RendererNode, import("@vue/runtime-core").RendererElement, {
31
+ [key: string]: any;
32
+ }>, unknown, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, {}, string, import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<{
33
+ _constants: {
34
+ type: ObjectConstructor;
35
+ default: () => {
36
+ CHECKBOX_GROUP: string;
37
+ };
38
+ };
39
+ modelValue: {};
40
+ label: {};
41
+ disabled: BooleanConstructor;
42
+ checked: BooleanConstructor;
43
+ name: StringConstructor;
44
+ trueLabel: (StringConstructor | NumberConstructor)[];
45
+ falseLabel: (StringConstructor | NumberConstructor)[];
46
+ text: StringConstructor;
47
+ events: {
48
+ type: ObjectConstructor;
49
+ default: () => {};
50
+ };
51
+ tabindex: {
52
+ type: StringConstructor;
53
+ default: string;
54
+ };
55
+ tiny_mode: StringConstructor;
56
+ tiny_mode_root: BooleanConstructor;
57
+ tiny_template: (ObjectConstructor | FunctionConstructor)[];
58
+ tiny_renderless: FunctionConstructor;
59
+ tiny_theme: StringConstructor;
60
+ tiny_chart_theme: ObjectConstructor;
61
+ }>>, {
62
+ disabled: boolean;
63
+ tiny_mode_root: boolean;
64
+ _constants: Record<string, any>;
65
+ tabindex: string;
66
+ events: Record<string, any>;
67
+ checked: boolean;
68
+ }, {}>;
2
69
  export default _default;
package/src/pc.vue.d.ts CHANGED
@@ -1,2 +1,68 @@
1
- declare const _default: any;
1
+ declare const _default: import("@vue/runtime-core").DefineComponent<Readonly<{
2
+ name?: any;
3
+ label?: any;
4
+ disabled?: any;
5
+ text?: any;
6
+ tiny_mode?: any;
7
+ tiny_mode_root?: any;
8
+ tiny_template?: any;
9
+ tiny_renderless?: any;
10
+ _constants?: any;
11
+ tiny_theme?: any;
12
+ tiny_chart_theme?: any;
13
+ modelValue?: any;
14
+ tabindex?: any;
15
+ events?: any;
16
+ checked?: any;
17
+ trueLabel?: any;
18
+ falseLabel?: any;
19
+ }>, {
20
+ t: (this: any, path: any, options?: any) => any;
21
+ vm: any;
22
+ f: (props: any, attrs?: {}) => {};
23
+ a: (attrs: any, filters: any, include: any) => {};
24
+ d: (props: any) => void;
25
+ dp: (props: any) => void;
26
+ gcls: (key: any) => any;
27
+ m: (...cssClasses: any[]) => string;
28
+ }, unknown, {}, {}, import("@vue/runtime-core").ComponentOptionsMixin, import("@vue/runtime-core").ComponentOptionsMixin, ("change" | "update:modelValue")[], "change" | "update:modelValue", import("@vue/runtime-core").PublicProps, Readonly<import("@vue/runtime-core").ExtractPropTypes<Readonly<{
29
+ name?: any;
30
+ label?: any;
31
+ disabled?: any;
32
+ text?: any;
33
+ tiny_mode?: any;
34
+ tiny_mode_root?: any;
35
+ tiny_template?: any;
36
+ tiny_renderless?: any;
37
+ _constants?: any;
38
+ tiny_theme?: any;
39
+ tiny_chart_theme?: any;
40
+ modelValue?: any;
41
+ tabindex?: any;
42
+ events?: any;
43
+ checked?: any;
44
+ trueLabel?: any;
45
+ falseLabel?: any;
46
+ }>>> & {
47
+ onChange?: ((...args: any[]) => any) | undefined;
48
+ "onUpdate:modelValue"?: ((...args: any[]) => any) | undefined;
49
+ }, {
50
+ readonly name?: any;
51
+ readonly label?: any;
52
+ readonly disabled?: any;
53
+ readonly text?: any;
54
+ readonly tiny_mode?: any;
55
+ readonly tiny_mode_root?: any;
56
+ readonly tiny_template?: any;
57
+ readonly tiny_renderless?: any;
58
+ readonly _constants?: any;
59
+ readonly tiny_theme?: any;
60
+ readonly tiny_chart_theme?: any;
61
+ readonly modelValue?: any;
62
+ readonly tabindex?: any;
63
+ readonly events?: any;
64
+ readonly checked?: any;
65
+ readonly trueLabel?: any;
66
+ readonly falseLabel?: any;
67
+ }, {}>;
2
68
  export default _default;