zi-ming-ui 1.0.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/demo.html ADDED
@@ -0,0 +1 @@
1
+ <!doctype html><meta charset="utf-8"><title>zi-ming-ui demo</title><script src="./zi-ming-ui.umd.js"></script><link rel="stylesheet" href="./zi-ming-ui.css"><script>console.log(zi-ming-ui)</script>
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "zi-ming-ui",
3
+ "version": "1.0.0",
4
+ "description": "一个可以临时增加的水平单选组件",
5
+ "main": "zi-ming-ui.common.js",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1"
8
+ },
9
+ "keywords": [],
10
+ "author": "",
11
+ "license": "ISC"
12
+ }
@@ -0,0 +1,579 @@
1
+ /******/ (function() { // webpackBootstrap
2
+ /******/ "use strict";
3
+ /******/ var __webpack_modules__ = ({
4
+
5
+ /***/ 89:
6
+ /***/ (function(__unused_webpack_module, exports) {
7
+
8
+ var __webpack_unused_export__;
9
+
10
+
11
+ __webpack_unused_export__ = ({
12
+ value: true
13
+ });
14
+ // runtime helper for setting properties on components
15
+ // in a tree-shakable way
16
+ exports.Z = (sfc, props) => {
17
+ const target = sfc.__vccOpts || sfc;
18
+ for (const [key, val] of props) {
19
+ target[key] = val;
20
+ }
21
+ return target;
22
+ };
23
+
24
+ /***/ })
25
+
26
+ /******/ });
27
+ /************************************************************************/
28
+ /******/ // The module cache
29
+ /******/ var __webpack_module_cache__ = {};
30
+ /******/
31
+ /******/ // The require function
32
+ /******/ function __webpack_require__(moduleId) {
33
+ /******/ // Check if module is in cache
34
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
35
+ /******/ if (cachedModule !== undefined) {
36
+ /******/ return cachedModule.exports;
37
+ /******/ }
38
+ /******/ // Create a new module (and put it into the cache)
39
+ /******/ var module = __webpack_module_cache__[moduleId] = {
40
+ /******/ // no module.id needed
41
+ /******/ // no module.loaded needed
42
+ /******/ exports: {}
43
+ /******/ };
44
+ /******/
45
+ /******/ // Execute the module function
46
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
47
+ /******/
48
+ /******/ // Return the exports of the module
49
+ /******/ return module.exports;
50
+ /******/ }
51
+ /******/
52
+ /************************************************************************/
53
+ /******/ /* webpack/runtime/define property getters */
54
+ /******/ !function() {
55
+ /******/ // define getter functions for harmony exports
56
+ /******/ __webpack_require__.d = function(exports, definition) {
57
+ /******/ for(var key in definition) {
58
+ /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
59
+ /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
60
+ /******/ }
61
+ /******/ }
62
+ /******/ };
63
+ /******/ }();
64
+ /******/
65
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
66
+ /******/ !function() {
67
+ /******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }
68
+ /******/ }();
69
+ /******/
70
+ /******/ /* webpack/runtime/make namespace object */
71
+ /******/ !function() {
72
+ /******/ // define __esModule on exports
73
+ /******/ __webpack_require__.r = function(exports) {
74
+ /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
75
+ /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
76
+ /******/ }
77
+ /******/ Object.defineProperty(exports, '__esModule', { value: true });
78
+ /******/ };
79
+ /******/ }();
80
+ /******/
81
+ /******/ /* webpack/runtime/publicPath */
82
+ /******/ !function() {
83
+ /******/ __webpack_require__.p = "";
84
+ /******/ }();
85
+ /******/
86
+ /************************************************************************/
87
+ var __webpack_exports__ = {};
88
+ // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
89
+ !function() {
90
+ // ESM COMPAT FLAG
91
+ __webpack_require__.r(__webpack_exports__);
92
+
93
+ // EXPORTS
94
+ __webpack_require__.d(__webpack_exports__, {
95
+ "default": function() { return /* binding */ entry_lib; }
96
+ });
97
+
98
+ ;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/setPublicPath.js
99
+ /* eslint-disable no-var */
100
+ // This file is imported into lib/wc client bundles.
101
+
102
+ if (typeof window !== 'undefined') {
103
+ var currentScript = window.document.currentScript
104
+ if (false) { var getCurrentScript; }
105
+
106
+ var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
107
+ if (src) {
108
+ __webpack_require__.p = src[1] // eslint-disable-line
109
+ }
110
+ }
111
+
112
+ // Indicate to webpack that this file can be concatenated
113
+ /* harmony default export */ var setPublicPath = (null);
114
+
115
+ ;// CONCATENATED MODULE: external {"commonjs":"vue","commonjs2":"vue","root":"Vue"}
116
+ var external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject = require("vue");
117
+ ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/package/horiz-radio-self-naming/index.vue?vue&type=template&id=f06df04a&scoped=true
118
+
119
+ const _withScopeId = n => ((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.pushScopeId)("data-v-f06df04a"), n = n(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.popScopeId)(), n);
120
+ const _hoisted_1 = {
121
+ class: "radio-group-container"
122
+ };
123
+ const _hoisted_2 = {
124
+ class: "header"
125
+ };
126
+ const _hoisted_3 = {
127
+ class: "radio-grid"
128
+ };
129
+ const _hoisted_4 = ["onClick"];
130
+ const _hoisted_5 = /*#__PURE__*/_withScopeId(() => /*#__PURE__*/(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", {
131
+ class: "radio-visual"
132
+ }, null, -1));
133
+ const _hoisted_6 = {
134
+ class: "option-label"
135
+ };
136
+ const _hoisted_7 = {
137
+ class: "edit-option"
138
+ };
139
+ const _hoisted_8 = ["value", "onFocus", "onBlur", "onInput", "onKeydown"];
140
+ const _hoisted_9 = ["onClick"];
141
+ const _hoisted_10 = {
142
+ key: 0,
143
+ class: "grid-item new-option"
144
+ };
145
+ const _hoisted_11 = {
146
+ class: "edit-option new-option-input"
147
+ };
148
+ const _hoisted_12 = /*#__PURE__*/_withScopeId(() => /*#__PURE__*/(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", {
149
+ class: "add-btn"
150
+ }, "+", -1));
151
+ const _hoisted_13 = [_hoisted_12];
152
+ const _hoisted_14 = {
153
+ key: 0,
154
+ class: "confirm-modal"
155
+ };
156
+ const _hoisted_15 = {
157
+ class: "confirm-content"
158
+ };
159
+ const _hoisted_16 = /*#__PURE__*/_withScopeId(() => /*#__PURE__*/(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("h3", null, "确认放弃", -1));
160
+ const _hoisted_17 = /*#__PURE__*/_withScopeId(() => /*#__PURE__*/(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("p", null, "您未入内容,是否放弃新增选项?", -1));
161
+ const _hoisted_18 = {
162
+ class: "confirm-buttons"
163
+ };
164
+ const _hoisted_19 = {
165
+ key: 1,
166
+ class: "demo-controls"
167
+ };
168
+ const _hoisted_20 = {
169
+ class: "demo-stats"
170
+ };
171
+ const _hoisted_21 = {
172
+ class: "mode-toggle"
173
+ };
174
+ const _hoisted_22 = /*#__PURE__*/_withScopeId(() => /*#__PURE__*/(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("span", null, "当前模式:", -1));
175
+ const _hoisted_23 = {
176
+ class: "toggle-buttons"
177
+ };
178
+ const _hoisted_24 = {
179
+ class: "demo-options"
180
+ };
181
+ function render(_ctx, _cache, $props, $setup, $data, $options) {
182
+ const _component_tips = (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.resolveComponent)("tips");
183
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)("div", _hoisted_1, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", _hoisted_2, [!$data.isEditMode ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)("div", {
184
+ key: 0,
185
+ class: "edit-btn",
186
+ onClick: _cache[0] || (_cache[0] = $event => $data.isEditMode = true)
187
+ }, "编辑")) : ((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)("div", {
188
+ key: 1,
189
+ class: "edit-btn edit-save-btn",
190
+ onClick: _cache[1] || (_cache[1] = $event => $data.isEditMode = false)
191
+ }, "完成"))]), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", _hoisted_3, [!$data.isEditMode ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(true), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)(external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.Fragment, {
192
+ key: 0
193
+ }, (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.renderList)($data.options, option => {
194
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)("div", {
195
+ key: option.id,
196
+ class: (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.normalizeClass)(['grid-item', {
197
+ selected: $props.modelValue === option.id
198
+ }]),
199
+ onClick: $event => $options.handleOptionSelect(option.id)
200
+ }, [_hoisted_5, (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", _hoisted_6, (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.toDisplayString)(option.name), 1)], 10, _hoisted_4);
201
+ }), 128)) : ((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)(external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.Fragment, {
202
+ key: 1
203
+ }, [((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(true), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)(external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.Fragment, null, (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.renderList)($data.options, option => {
204
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)("div", {
205
+ key: option.id,
206
+ class: (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.normalizeClass)(['grid-item', {
207
+ 'editing-focus': $data.editingFocusId === option.id
208
+ }])
209
+ }, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", _hoisted_7, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("input", {
210
+ type: "text",
211
+ class: "edit-input",
212
+ value: option.name,
213
+ onFocus: $event => $options.handleEditFocus(option.id),
214
+ onBlur: $event => $options.handleEditBlur(option.id, $event),
215
+ onInput: $event => $options.handleEditInput(option.id, $event),
216
+ onKeydown: (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.withKeys)($event => $options.handleSaveOption(option.id, $event), ["enter"]),
217
+ spellcheck: "false",
218
+ ref_for: true,
219
+ ref: "editInputs"
220
+ }, null, 40, _hoisted_8), $data.editingFocusId === option.id ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)("div", {
221
+ key: 0,
222
+ class: "save-btn",
223
+ onClick: $event => $options.handleSaveOption(option.id)
224
+ }, " 保存 ", 8, _hoisted_9)) : (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createCommentVNode)("", true)])], 2);
225
+ }), 128)), $data.isAddingNew ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)("div", _hoisted_10, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", _hoisted_11, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.withDirectives)((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("input", {
226
+ type: "text",
227
+ class: "edit-input new-input",
228
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = $event => $data.newOptionText = $event),
229
+ onFocus: _cache[3] || (_cache[3] = (...args) => $options.handleNewOptionFocus && $options.handleNewOptionFocus(...args)),
230
+ onBlur: _cache[4] || (_cache[4] = (...args) => $options.handleNewOptionBlur && $options.handleNewOptionBlur(...args)),
231
+ onKeydown: _cache[5] || (_cache[5] = (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.withKeys)((...args) => $options.handleSaveNewOption && $options.handleSaveNewOption(...args), ["enter"])),
232
+ placeholder: "请输入新选项",
233
+ spellcheck: "false",
234
+ ref: "newOptionInput"
235
+ }, null, 544), [[external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.vModelText, $data.newOptionText, void 0, {
236
+ trim: true
237
+ }]]), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", {
238
+ class: "save-btn",
239
+ onClick: _cache[6] || (_cache[6] = (...args) => $options.handleSaveNewOption && $options.handleSaveNewOption(...args))
240
+ }, "保存")])])) : (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createCommentVNode)("", true), !$data.isAddingNew ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)("div", {
241
+ key: 1,
242
+ class: "grid-item add-option",
243
+ onClick: _cache[7] || (_cache[7] = (...args) => $options.handleAddClick && $options.handleAddClick(...args))
244
+ }, _hoisted_13)) : (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createCommentVNode)("", true)], 64))]), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createVNode)(_component_tips, {
245
+ modelValue: $data.showInputTips,
246
+ "onUpdate:modelValue": _cache[8] || (_cache[8] = $event => $data.showInputTips = $event)
247
+ }, {
248
+ default: (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.withCtx)(() => [(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createTextVNode)(" 单击选项文字,进行输入,并编辑 ")]),
249
+ _: 1
250
+ }, 8, ["modelValue"]), $data.showDiscardConfirm ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)("div", _hoisted_14, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", _hoisted_15, [_hoisted_16, _hoisted_17, (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", _hoisted_18, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", {
251
+ class: "confirm-btn cancel",
252
+ onClick: _cache[9] || (_cache[9] = (...args) => $options.handleCancelDiscard && $options.handleCancelDiscard(...args))
253
+ }, "继续输入"), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", {
254
+ class: "confirm-btn confirm",
255
+ onClick: _cache[10] || (_cache[10] = (...args) => $options.handleConfirmDiscard && $options.handleConfirmDiscard(...args))
256
+ }, "放弃新增")])])])) : (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createCommentVNode)("", true), $data.isDebug ? ((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)("div", _hoisted_19, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", _hoisted_20, " 当前选中: 选项" + (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.toDisplayString)($props.modelValue) + " | 编辑聚焦: " + (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.toDisplayString)($data.editingFocusId ? '选项' + $data.editingFocusId : '无') + " | 新增: " + (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.toDisplayString)($data.isAddingNew ? '是' : '否'), 1), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", _hoisted_21, [_hoisted_22, (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", _hoisted_23, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", {
257
+ class: (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.normalizeClass)(['mode-btn', {
258
+ active: !$data.isEditMode
259
+ }]),
260
+ onClick: _cache[11] || (_cache[11] = $event => $data.isEditMode = false)
261
+ }, " 正常模式 ", 2), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", {
262
+ class: (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.normalizeClass)(['mode-btn', {
263
+ active: $data.isEditMode
264
+ }]),
265
+ onClick: _cache[12] || (_cache[12] = $event => $data.isEditMode = true)
266
+ }, " 编辑模式 ", 2)])]), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", _hoisted_24, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", {
267
+ class: (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.normalizeClass)(['demo-btn', {
268
+ active: $data.editingFocusId !== null
269
+ }]),
270
+ onClick: _cache[13] || (_cache[13] = $event => $data.editingFocusId = $data.editingFocusId === 1 ? null : 1)
271
+ }, (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.toDisplayString)($data.editingFocusId === 1 ? '取消' : '设置') + "选项聚焦 ", 3), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", {
272
+ class: (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.normalizeClass)(['demo-btn', {
273
+ active: $data.isAddingNew
274
+ }]),
275
+ onClick: _cache[14] || (_cache[14] = $event => $data.isAddingNew = !$data.isAddingNew)
276
+ }, (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.toDisplayString)($data.isAddingNew ? '隐藏' : '显示') + "新增选项 ", 3), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", {
277
+ class: (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.normalizeClass)(['demo-btn', {
278
+ active: $data.showDiscardConfirm
279
+ }]),
280
+ onClick: _cache[15] || (_cache[15] = $event => $data.showDiscardConfirm = !$data.showDiscardConfirm)
281
+ }, (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.toDisplayString)($data.showDiscardConfirm ? '隐藏' : '显示') + "确认弹窗 ", 3), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementVNode)("div", {
282
+ class: (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.normalizeClass)(['demo-btn', {
283
+ active: $data.isFewOptions
284
+ }]),
285
+ onClick: _cache[16] || (_cache[16] = (...args) => $options.toggleOptionsCount && $options.toggleOptionsCount(...args))
286
+ }, " 显示 " + (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.toDisplayString)($data.isFewOptions ? '12' : '3') + " 个选项 ", 3)])])) : (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createCommentVNode)("", true)]);
287
+ }
288
+ ;// CONCATENATED MODULE: ./src/package/horiz-radio-self-naming/index.vue?vue&type=template&id=f06df04a&scoped=true
289
+
290
+ ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/vue-loader/dist/templateLoader.js??ruleSet[1].rules[3]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/package/tips/index.vue?vue&type=template&id=1e8c4bc7&scoped=true
291
+
292
+ const tipsvue_type_template_id_1e8c4bc7_scoped_true_withScopeId = n => (_pushScopeId("data-v-1e8c4bc7"), n = n(), _popScopeId(), n);
293
+ const tipsvue_type_template_id_1e8c4bc7_scoped_true_hoisted_1 = {
294
+ class: "to_input_tips"
295
+ };
296
+ function tipsvue_type_template_id_1e8c4bc7_scoped_true_render(_ctx, _cache, $props, $setup, $data, $options) {
297
+ return (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.withDirectives)(((0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.openBlock)(), (0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.createElementBlock)("div", tipsvue_type_template_id_1e8c4bc7_scoped_true_hoisted_1, [(0,external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.renderSlot)(_ctx.$slots, "default", {}, undefined, true)], 512)), [[external_commonjs_vue_commonjs2_vue_root_Vue_namespaceObject.vShow, $props.modelValue]]);
298
+ }
299
+ ;// CONCATENATED MODULE: ./src/package/tips/index.vue?vue&type=template&id=1e8c4bc7&scoped=true
300
+
301
+ ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/package/tips/index.vue?vue&type=script&lang=js
302
+ /* harmony default export */ var tipsvue_type_script_lang_js = ({
303
+ props: {
304
+ modelValue: {
305
+ type: Boolean,
306
+ default: false
307
+ },
308
+ delay: {
309
+ type: Number,
310
+ default: 2000
311
+ }
312
+ },
313
+ watch: {
314
+ modelValue(n, o) {
315
+ if (n) {
316
+ setTimeout(() => {
317
+ this.$emit('update:modelValue', false);
318
+ }, this.delay);
319
+ }
320
+ }
321
+ }
322
+ });
323
+ ;// CONCATENATED MODULE: ./src/package/tips/index.vue?vue&type=script&lang=js
324
+
325
+ ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/package/tips/index.vue?vue&type=style&index=0&id=1e8c4bc7&scoped=true&lang=css
326
+ // extracted by mini-css-extract-plugin
327
+
328
+ ;// CONCATENATED MODULE: ./src/package/tips/index.vue?vue&type=style&index=0&id=1e8c4bc7&scoped=true&lang=css
329
+
330
+ // EXTERNAL MODULE: ./node_modules/vue-loader/dist/exportHelper.js
331
+ var exportHelper = __webpack_require__(89);
332
+ ;// CONCATENATED MODULE: ./src/package/tips/index.vue
333
+
334
+
335
+
336
+
337
+ ;
338
+
339
+
340
+ const __exports__ = /*#__PURE__*/(0,exportHelper/* default */.Z)(tipsvue_type_script_lang_js, [['render',tipsvue_type_template_id_1e8c4bc7_scoped_true_render],['__scopeId',"data-v-1e8c4bc7"]])
341
+
342
+ /* harmony default export */ var tips = (__exports__);
343
+ ;// CONCATENATED MODULE: ./node_modules/thread-loader/dist/cjs.js!./node_modules/babel-loader/lib/index.js??clonedRuleSet-40.use[1]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/package/horiz-radio-self-naming/index.vue?vue&type=script&lang=js
344
+
345
+ /* harmony default export */ var horiz_radio_self_namingvue_type_script_lang_js = ({
346
+ name: 'FixedWidthGridRadioGroup',
347
+ props: {
348
+ modelValue: [String, Number],
349
+ list: [Function],
350
+ add: [Function],
351
+ update: [Function]
352
+ },
353
+ components: {
354
+ tips: tips
355
+ },
356
+ data() {
357
+ return {
358
+ isDebug: false,
359
+ showInputTips: null,
360
+ isEditMode: false,
361
+ selectedOption: 1,
362
+ editingFocusId: null,
363
+ isAddingNew: false,
364
+ showDiscardConfirm: false,
365
+ newOptionText: '',
366
+ isFewOptions: false,
367
+ options: [],
368
+ editValues: {},
369
+ // 用于存储编辑中的值
370
+ originalValues: {} // 用于存储编辑前的值
371
+ };
372
+ },
373
+
374
+ mounted() {
375
+ // 初始化编辑值
376
+ this.getData();
377
+ },
378
+ watch: {
379
+ isEditMode(n, o) {
380
+ if (n) {
381
+ this.showInputTips = true;
382
+ }
383
+ },
384
+ options(n, o) {
385
+ if (n) {
386
+ n.forEach(option => {
387
+ this.originalValues[option.id] = option.name;
388
+ });
389
+ } else {
390
+ this.editValues = [];
391
+ this.originalValues = [];
392
+ }
393
+ }
394
+ },
395
+ methods: {
396
+ getData(data) {
397
+ this.list(data).then(res => {
398
+ console.log('getData', res?.data?.rows);
399
+ this.options = res?.data?.rows;
400
+ });
401
+ },
402
+ toggleOptionsCount() {
403
+ this.isFewOptions = !this.isFewOptions;
404
+ },
405
+ handleOptionSelect(id) {
406
+ if (!this.isEditMode) {
407
+ this.$emit('update:modelValue', id);
408
+ this.$emit('change', this.options.find(it => it.id == id));
409
+ }
410
+ },
411
+ handleEditFocus(id) {
412
+ this.editingFocusId = id;
413
+ // 存储原始值
414
+ this.originalValues[id] = this.editValues[id] || this.options.find(opt => opt.id === id)?.name || '';
415
+ },
416
+ handleEditBlur(id, event) {
417
+ // 延迟处理,避免与保存按钮点击冲突
418
+ setTimeout(() => {
419
+ if (this.editingFocusId === id) {
420
+ // 如果没有点击保存,恢复原始值
421
+ if (this.editValues[id] !== this.originalValues[id]) {
422
+ this.editValues[id] = this.originalValues[id];
423
+ // 更新DOM
424
+ if (event.target) {
425
+ event.target.value = this.originalValues[id];
426
+ }
427
+ }
428
+ this.editingFocusId = null;
429
+ }
430
+ }, 500);
431
+ },
432
+ handleEditInput(id, event) {
433
+ this.editValues[id] = event.target.value.trim();
434
+ },
435
+ handleSaveOption(id) {
436
+ console.log(this.editValues, id);
437
+ const newName = this.editValues[id]?.trim() || '';
438
+ const originalOption = this.options.find(opt => opt.id === id);
439
+ if (newName && originalOption && newName !== originalOption.name) {
440
+ // 在实际应用中,这里应该更新数据
441
+ console.log(`保存选项 ${id}: ${newName}`);
442
+ // 示例:更新选项名称
443
+ originalOption.name = newName;
444
+ this.originalValues[id] = newName;
445
+ this.update({
446
+ id,
447
+ name: newName
448
+ }).then(res => {});
449
+ }
450
+ this.editingFocusId = null;
451
+ },
452
+ handleAddClick() {
453
+ this.isAddingNew = true;
454
+ this.newOptionText = '';
455
+
456
+ // 聚焦到新输入框
457
+ this.$nextTick(() => {
458
+ if (this.$refs.newOptionInput) {
459
+ this.$refs.newOptionInput.focus();
460
+ }
461
+ });
462
+ },
463
+ handleNewOptionFocus() {
464
+ // 新增选项聚焦时不需要特殊处理
465
+ },
466
+ handleNewOptionBlur(event) {
467
+ const text = this.newOptionText.trim();
468
+ if (!text) {
469
+ this.showDiscardConfirm = true;
470
+ }
471
+ },
472
+ handleSaveNewOption() {
473
+ const newName = this.newOptionText.trim();
474
+ if (newName) {
475
+ this.$emit('toadd', newName);
476
+ console.log(`添加新选项: ${newName}`);
477
+ this.add({
478
+ name: newName
479
+ }).then(res => {
480
+ this.isAddingNew = false;
481
+ this.newOptionText = '';
482
+ this.showDiscardConfirm = false;
483
+ this.getData();
484
+ }).catch(res => {
485
+ console.error('添加新选项 失败了');
486
+ });
487
+ }
488
+ },
489
+ handleCancelDiscard() {
490
+ this.showDiscardConfirm = false;
491
+
492
+ // 重新聚焦到输入框
493
+ this.$nextTick(() => {
494
+ if (this.$refs.newOptionInput) {
495
+ this.$refs.newOptionInput.focus();
496
+ }
497
+ });
498
+ },
499
+ handleConfirmDiscard() {
500
+ this.isAddingNew = false;
501
+ this.newOptionText = '';
502
+ this.showDiscardConfirm = false;
503
+ },
504
+ cancelNewOption() {
505
+ this.isAddingNew = false;
506
+ this.newOptionText = '';
507
+ this.showDiscardConfirm = false;
508
+ }
509
+ }
510
+ });
511
+ ;// CONCATENATED MODULE: ./src/package/horiz-radio-self-naming/index.vue?vue&type=script&lang=js
512
+
513
+ ;// CONCATENATED MODULE: ./node_modules/mini-css-extract-plugin/dist/loader.js??clonedRuleSet-12.use[0]!./node_modules/css-loader/dist/cjs.js??clonedRuleSet-12.use[1]!./node_modules/vue-loader/dist/stylePostLoader.js!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-12.use[2]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./src/package/horiz-radio-self-naming/index.vue?vue&type=style&index=0&id=f06df04a&scoped=true&lang=css
514
+ // extracted by mini-css-extract-plugin
515
+
516
+ ;// CONCATENATED MODULE: ./src/package/horiz-radio-self-naming/index.vue?vue&type=style&index=0&id=f06df04a&scoped=true&lang=css
517
+
518
+ ;// CONCATENATED MODULE: ./src/package/horiz-radio-self-naming/index.vue
519
+
520
+
521
+
522
+
523
+ ;
524
+
525
+
526
+ const horiz_radio_self_naming_exports_ = /*#__PURE__*/(0,exportHelper/* default */.Z)(horiz_radio_self_namingvue_type_script_lang_js, [['render',render],['__scopeId',"data-v-f06df04a"]])
527
+
528
+ /* harmony default export */ var horiz_radio_self_naming = (horiz_radio_self_naming_exports_);
529
+ ;// CONCATENATED MODULE: ./src/package/public-js/letter.js
530
+ // package/public-js/letter.js
531
+ // 处理首字母大小
532
+ function handleFirstUpperCase(str) {
533
+ return str.replace(/( |^)[a-z]/g, L => L.toUpperCase());
534
+ }
535
+ function letter_handleDrawDownHump(str) {
536
+ return str;
537
+ }
538
+ ;// CONCATENATED MODULE: ./src/package/public-js/num.js
539
+ // package/public-js/num.js
540
+ // 四舍五入Math.round(number)
541
+ function handleRoundOff(val) {
542
+ return val && Math.round(val);
543
+ }
544
+ ;// CONCATENATED MODULE: ./src/package/public-js/index.js
545
+ // package/public-js/index.js
546
+
547
+
548
+ /* harmony default export */ var public_js = ({
549
+ handleFirstUpperCase: handleFirstUpperCase,
550
+ handleDrawDownHump,
551
+ handleRoundOff: handleRoundOff
552
+ });
553
+ ;// CONCATENATED MODULE: ./src/package/index.js
554
+ //package/index.js
555
+ // 引入封装好的组件
556
+ // 引入封装好的方法
557
+ const coms = [horiz_radio_self_naming]; // 将来如果有其它组件,都可以写到这个数组里
558
+
559
+ // 批量组件注册
560
+ const install = function (Vue) {
561
+ coms.forEach(com => {
562
+ Vue.component(com.name, com);
563
+ });
564
+ };
565
+ /* harmony default export */ var src_package = ({
566
+ install,
567
+ publicjs: public_js
568
+ }); // 这个方法以后再使用的时候可以被use调用
569
+ ;// CONCATENATED MODULE: ./node_modules/@vue/cli-service/lib/commands/build/entry-lib.js
570
+
571
+
572
+ /* harmony default export */ var entry_lib = (src_package);
573
+
574
+
575
+ }();
576
+ module.exports = __webpack_exports__;
577
+ /******/ })()
578
+ ;
579
+ //# sourceMappingURL=zi-ming-ui.common.js.map