@opentiny/vue-renderless 3.1.0-alpha.0 → 3.5.0-alpha.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/action-menu/index.js +10 -0
- package/action-menu/vue.js +26 -0
- package/amount/index.js +334 -0
- package/amount/vue.js +206 -0
- package/area/index.js +162 -0
- package/area/vue.js +68 -0
- package/autonavi-map/index.js +28 -0
- package/avatar/index.js +5 -1
- package/avatar/vue.js +2 -1
- package/baidu-map/index.js +28 -0
- package/breadcrumb/index.js +9 -0
- package/breadcrumb/vue.js +25 -3
- package/breadcrumb-item/index.js +26 -0
- package/breadcrumb-item/vue.js +20 -11
- package/bulletin-board/index.js +4 -1
- package/button-group/vue.js +1 -1
- package/calendar/index.js +14 -14
- package/card-template/index.js +1 -1
- package/cascader/index.js +21 -7
- package/cascader/vue.js +1 -2
- package/cascader-node/index.js +3 -1
- package/cascader-panel/index.js +12 -4
- package/cascader-panel/vue.js +1 -2
- package/chart-bar/index.js +533 -0
- package/chart-boxplot/index.js +270 -0
- package/chart-candle/index.js +428 -0
- package/chart-core/deps/constants.js +65 -0
- package/chart-core/deps/numerify.js +286 -0
- package/chart-core/deps/utils.js +205 -0
- package/chart-core/index.js +541 -0
- package/chart-core/modules/animation.js +10 -0
- package/chart-core/modules/extend.js +36 -0
- package/chart-core/modules/mark.js +7 -0
- package/chart-core/vue.js +128 -0
- package/chart-funnel/index.js +155 -0
- package/chart-gauge/index.js +153 -0
- package/chart-graph/index.js +38 -0
- package/chart-heatmap/index.js +407 -0
- package/chart-line/index.js +358 -0
- package/chart-liquidfill/index.js +119 -0
- package/chart-map/index.js +261 -0
- package/chart-pie/index.js +327 -0
- package/chart-radar/index.js +181 -0
- package/chart-sankey/index.js +166 -0
- package/chart-scatter/index.js +360 -0
- package/chart-sunburst/index.js +36 -0
- package/chart-tree/index.js +107 -0
- package/chart-waterfall/index.js +231 -0
- package/chart-wordcloud/index.js +109 -0
- package/checkbox/index.js +4 -4
- package/checkbox-button/index.js +3 -1
- package/common/bigInt.js +5 -2
- package/common/date.js +17 -17
- package/common/deps/date-util.js +15 -5
- package/common/deps/date.js +6 -6
- package/common/deps/dom.js +18 -6
- package/common/deps/eSpaceCtrl.js +286 -0
- package/common/deps/fullscreen/apis.js +22 -22
- package/common/deps/memorize.js +3 -3
- package/common/deps/modal-queue.js +2 -0
- package/common/deps/popper.js +12 -10
- package/common/deps/popup-manager.js +16 -5
- package/common/deps/resize-event.js +6 -2
- package/common/deps/scrollbar-width.js +6 -2
- package/common/deps/tree-model/node.js +30 -10
- package/common/deps/tree-model/tree-store.js +33 -21
- package/common/deps/tree-model/util.js +6 -2
- package/common/deps/upload-ajax.js +7 -1
- package/common/deps/vue-popper.js +2 -2
- package/common/string.js +1 -1
- package/company/index.js +56 -0
- package/company/vue.js +35 -0
- package/country/index.js +54 -0
- package/country/vue.js +35 -0
- package/credit-card-form/index.js +1 -0
- package/currency/index.js +78 -0
- package/currency/vue.js +39 -0
- package/date-panel/index.js +16 -6
- package/date-picker/index.js +9 -5
- package/date-range/index.js +28 -9
- package/date-table/index.js +3 -1
- package/dept/index.js +318 -0
- package/dept/vue.js +163 -0
- package/detail-page/index.js +4 -1
- package/dialog-box/index.js +14 -4
- package/dialog-box/vue.js +7 -3
- package/drop-roles/index.js +73 -0
- package/drop-roles/vue.js +38 -0
- package/dropdown/index.js +5 -4
- package/dropdown/vue.js +5 -3
- package/dropdown-item/index.js +15 -0
- package/dropdown-item/vue.js +27 -13
- package/espace/index.js +129 -0
- package/espace/vue.js +52 -0
- package/exception/index.js +1 -1
- package/file-upload/index.js +336 -291
- package/form/index.js +3 -1
- package/form/vue.js +15 -0
- package/form-item/index.js +15 -5
- package/fullscreen/index.js +4 -4
- package/fullscreen/vue.js +3 -3
- package/grid/core/interceptor.js +4 -7
- package/grid/plugins/export.js +2 -2
- package/grid/plugins/exportExcel.js +28 -10
- package/grid/static/array/findTree.js +1 -1
- package/grid/static/base/helperCreateGetObjects.js +1 -1
- package/grid/static/base/helperEqualCompare.js +2 -2
- package/grid/static/base/helperGetHGSKeys.js +1 -1
- package/grid/static/base/uniqueId.js +1 -1
- package/grid/static/object/assign.js +3 -3
- package/grid/static/string/toString.js +3 -3
- package/hrapprover/index.js +118 -0
- package/hrapprover/vue.js +102 -0
- package/locales/index.js +116 -0
- package/locales/vue.js +46 -0
- package/logon-user/index.js +23 -0
- package/logon-user/vue.js +22 -0
- package/logout/index.js +118 -0
- package/logout/vue.js +22 -0
- package/milestone/index.js +2 -1
- package/mini-picker/index.js +1 -1
- package/mini-picker/vue.js +1 -1
- package/modal/index.js +4 -2
- package/month-table/index.js +2 -2
- package/nav-menu/index.js +2 -2
- package/numeric/index.js +5 -2
- package/package.json +33 -136
- package/pager-item/vue.js +6 -2
- package/picker/index.js +43 -17
- package/picker/timezone.js +2 -2
- package/picker-column/index.js +7 -3
- package/pop-upload/index.js +5 -3
- package/popeditor/index.js +15 -7
- package/popover/index.js +87 -54
- package/popover/vue.js +13 -9
- package/rate/index.js +2 -2
- package/rich-text/clipboard.js +77 -0
- package/rich-text/index.js +176 -0
- package/rich-text/module/file-upload.js +118 -0
- package/rich-text/module/image-drop.js +54 -0
- package/rich-text/module/image-upload.js +84 -0
- package/rich-text/options.js +187 -0
- package/rich-text/table-module.js +557 -0
- package/rich-text/vue.js +149 -0
- package/roles/index.js +87 -0
- package/roles/vue.js +39 -0
- package/search/index.js +32 -27
- package/search/vue.js +7 -2
- package/select/index.js +328 -304
- package/select/vue.js +19 -9
- package/select-dropdown/index.js +1 -1
- package/slider/index.js +9 -11
- package/slider/vue.js +3 -3
- package/split/vue.js +1 -1
- package/tab-nav/index.js +0 -6
- package/tab-nav/vue.js +0 -14
- package/table/index.js +1 -1
- package/text-popup/index.js +6 -4
- package/time/index.js +3 -1
- package/time-range/index.js +6 -2
- package/time-spinner/index.js +15 -5
- package/toggle-menu/index.js +11 -0
- package/toggle-menu/vue.js +2 -1
- package/tooltip/index.js +46 -35
- package/tooltip/vue.js +5 -1
- package/tree/index.js +57 -21
- package/tree-menu/index.js +3 -1
- package/tree-node/index.js +7 -3
- package/upload/index.js +14 -5
- package/user/index.js +634 -0
- package/user/vue.js +113 -0
- package/user-account/index.js +23 -0
- package/user-account/vue.js +25 -0
- package/user-contact/index.js +1 -4
- package/user-head/index.js +33 -11
- package/user-head/vue.js +10 -7
- package/user-link/index.js +43 -0
- package/user-link/vue.js +60 -0
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
var scrollBarWidth;
|
|
2
2
|
var isServer = typeof window === 'undefined';
|
|
3
3
|
export default function () {
|
|
4
|
-
if (isServer)
|
|
5
|
-
|
|
4
|
+
if (isServer) {
|
|
5
|
+
return 0;
|
|
6
|
+
}
|
|
7
|
+
if (scrollBarWidth !== undefined) {
|
|
8
|
+
return scrollBarWidth;
|
|
9
|
+
}
|
|
6
10
|
var container = document.createElement('div');
|
|
7
11
|
container.className = 'tiny-scrollbar';
|
|
8
12
|
container.style.visibility = 'hidden';
|
|
@@ -48,7 +48,9 @@ export var getChildState = function getChildState(node) {
|
|
|
48
48
|
};
|
|
49
49
|
var reInitChecked = function reInitChecked(node) {
|
|
50
50
|
var childNodes = node.childNodes;
|
|
51
|
-
if (childNodes.length === 0)
|
|
51
|
+
if (childNodes.length === 0) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
52
54
|
var _getChildState = getChildState(childNodes),
|
|
53
55
|
all = _getChildState.all,
|
|
54
56
|
none = _getChildState.none,
|
|
@@ -70,7 +72,9 @@ var reInitChecked = function reInitChecked(node) {
|
|
|
70
72
|
});
|
|
71
73
|
}
|
|
72
74
|
var parent = node.parent;
|
|
73
|
-
if (!parent || parent.level === 0)
|
|
75
|
+
if (!parent || parent.level === 0) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
74
78
|
!node.store.checkStrictly && reInitChecked(parent);
|
|
75
79
|
};
|
|
76
80
|
var nodeIdSeed = 0;
|
|
@@ -97,7 +101,9 @@ var Node = function () {
|
|
|
97
101
|
if (!Array.isArray(this.data)) {
|
|
98
102
|
markNodeData(this, this.data);
|
|
99
103
|
}
|
|
100
|
-
if (!this.data)
|
|
104
|
+
if (!this.data) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
101
107
|
this.expandByDefaultKeys();
|
|
102
108
|
var key = store.key,
|
|
103
109
|
lazy = store.lazy,
|
|
@@ -189,7 +195,9 @@ var Node = function () {
|
|
|
189
195
|
var store = this.store,
|
|
190
196
|
data = this.data;
|
|
191
197
|
var nodeKey = store.key;
|
|
192
|
-
if (data)
|
|
198
|
+
if (data) {
|
|
199
|
+
return data[nodeKey];
|
|
200
|
+
}
|
|
193
201
|
return null;
|
|
194
202
|
}
|
|
195
203
|
}, {
|
|
@@ -255,7 +263,9 @@ var Node = function () {
|
|
|
255
263
|
}, {
|
|
256
264
|
key: "insertChild",
|
|
257
265
|
value: function insertChild(child, index, batch) {
|
|
258
|
-
if (!child)
|
|
266
|
+
if (!child) {
|
|
267
|
+
throw new Error('[TINY-Tree] insertChild error: child is required.');
|
|
268
|
+
}
|
|
259
269
|
var insertNode = function insertNode(_ref) {
|
|
260
270
|
var arr = _ref.arr,
|
|
261
271
|
index = _ref.index,
|
|
@@ -416,8 +426,12 @@ var Node = function () {
|
|
|
416
426
|
var forceInit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
417
427
|
var level = this.level,
|
|
418
428
|
data = this.data;
|
|
419
|
-
if (level === 0)
|
|
420
|
-
|
|
429
|
+
if (level === 0) {
|
|
430
|
+
return data;
|
|
431
|
+
}
|
|
432
|
+
if (!data) {
|
|
433
|
+
return null;
|
|
434
|
+
}
|
|
421
435
|
var props = this.store.props;
|
|
422
436
|
var childrenKey = defaultChildrenKey;
|
|
423
437
|
if (props) {
|
|
@@ -439,7 +453,9 @@ var Node = function () {
|
|
|
439
453
|
var _this$store2 = this.store,
|
|
440
454
|
checkStrictly = _this$store2.checkStrictly,
|
|
441
455
|
checkDescendants = _this$store2.checkDescendants;
|
|
442
|
-
if (checkStrictly)
|
|
456
|
+
if (checkStrictly) {
|
|
457
|
+
return;
|
|
458
|
+
}
|
|
443
459
|
var ret = this.setCheckedInner({
|
|
444
460
|
checkDescendants: checkDescendants,
|
|
445
461
|
value: value,
|
|
@@ -453,7 +469,9 @@ var Node = function () {
|
|
|
453
469
|
return;
|
|
454
470
|
}
|
|
455
471
|
var parentNode = this.parent;
|
|
456
|
-
if (!parentNode || parentNode.level === 0)
|
|
472
|
+
if (!parentNode || parentNode.level === 0) {
|
|
473
|
+
return;
|
|
474
|
+
}
|
|
457
475
|
if (!recursion) {
|
|
458
476
|
this.store.lazy ? lazyInitChecked(parentNode) : reInitChecked(parentNode);
|
|
459
477
|
}
|
|
@@ -546,7 +564,9 @@ var Node = function () {
|
|
|
546
564
|
});
|
|
547
565
|
if (!this.store.lazy) {
|
|
548
566
|
oldChildren.forEach(function (item) {
|
|
549
|
-
if (!newChildrenMap[item[NODE_KEY]])
|
|
567
|
+
if (!newChildrenMap[item[NODE_KEY]]) {
|
|
568
|
+
_this5.removeChildByData(item);
|
|
569
|
+
}
|
|
550
570
|
});
|
|
551
571
|
}
|
|
552
572
|
newChildren.forEach(function (_ref3) {
|
|
@@ -54,8 +54,12 @@ var TreeStore = function () {
|
|
|
54
54
|
node.visible = allHidden === false;
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
if (!value)
|
|
58
|
-
|
|
57
|
+
if (!value) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (node.visible && !node.isLeaf && !lazy) {
|
|
61
|
+
node.expand();
|
|
62
|
+
}
|
|
59
63
|
};
|
|
60
64
|
walkTree(this);
|
|
61
65
|
}
|
|
@@ -172,7 +176,9 @@ var TreeStore = function () {
|
|
|
172
176
|
value: function deregisterNode(node) {
|
|
173
177
|
var _this6 = this;
|
|
174
178
|
var key = this.key;
|
|
175
|
-
if (!key || !node || !node.data)
|
|
179
|
+
if (!key || !node || !node.data) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
176
182
|
node.childNodes.forEach(function (child) {
|
|
177
183
|
_this6.deregisterNode(child);
|
|
178
184
|
});
|
|
@@ -182,7 +188,9 @@ var TreeStore = function () {
|
|
|
182
188
|
key: "registerNode",
|
|
183
189
|
value: function registerNode(node) {
|
|
184
190
|
var key = this.key;
|
|
185
|
-
if (!key || !node || !node.data)
|
|
191
|
+
if (!key || !node || !node.data) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
186
194
|
var nodeKey = node.key;
|
|
187
195
|
if (nodeKey !== undefined) {
|
|
188
196
|
this.nodesMap[nodeKey] = node;
|
|
@@ -240,7 +248,9 @@ var TreeStore = function () {
|
|
|
240
248
|
key: "updateChildren",
|
|
241
249
|
value: function updateChildren(key, data) {
|
|
242
250
|
var node = this.nodesMap[key];
|
|
243
|
-
if (!node)
|
|
251
|
+
if (!node) {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
244
254
|
var childNodes = node.childNodes;
|
|
245
255
|
for (var i = childNodes.length - 1; i >= 0; i--) {
|
|
246
256
|
this.remove(childNodes[i].data);
|
|
@@ -253,6 +263,7 @@ var TreeStore = function () {
|
|
|
253
263
|
}, {
|
|
254
264
|
key: "_setCheckedKeys",
|
|
255
265
|
value: function _setCheckedKeys(key) {
|
|
266
|
+
var _this7 = this;
|
|
256
267
|
var leafOnly = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
257
268
|
var checkedKeys = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
258
269
|
var nodes = this._getAllNodes().sort(function (prevNode, nextNode) {
|
|
@@ -263,7 +274,7 @@ var TreeStore = function () {
|
|
|
263
274
|
nodes.forEach(function (node) {
|
|
264
275
|
node.setChecked(false, false);
|
|
265
276
|
});
|
|
266
|
-
|
|
277
|
+
var _loop = function _loop() {
|
|
267
278
|
var node = nodes[i];
|
|
268
279
|
var nodeKey = node.data[key].toString();
|
|
269
280
|
var checked = ~keys.indexOf(nodeKey);
|
|
@@ -277,35 +288,36 @@ var TreeStore = function () {
|
|
|
277
288
|
cache[parentNode.data[key]] = true;
|
|
278
289
|
parentNode = parentNode.parent;
|
|
279
290
|
}
|
|
280
|
-
if (node.isLeaf ||
|
|
291
|
+
if (node.isLeaf || _this7.checkStrictly) {
|
|
281
292
|
node.setChecked(true, false);
|
|
282
293
|
} else if (leafOnly) {
|
|
283
|
-
(
|
|
284
|
-
|
|
285
|
-
var
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
walkTree(node);
|
|
293
|
-
})();
|
|
294
|
+
node.setChecked(false, false);
|
|
295
|
+
var walkTree = function walkTree(node) {
|
|
296
|
+
var childNodes = node.childNodes;
|
|
297
|
+
childNodes.forEach(function (child) {
|
|
298
|
+
!child.isLeaf && child.setChecked(false, false);
|
|
299
|
+
walkTree(child);
|
|
300
|
+
});
|
|
301
|
+
};
|
|
302
|
+
walkTree(node);
|
|
294
303
|
} else {
|
|
295
304
|
node.setChecked(true, true);
|
|
296
305
|
}
|
|
297
306
|
}
|
|
307
|
+
};
|
|
308
|
+
for (var i = 0, len = nodes.length; i < len; i++) {
|
|
309
|
+
_loop();
|
|
298
310
|
}
|
|
299
311
|
}
|
|
300
312
|
}, {
|
|
301
313
|
key: "setDefaultExpandedKeys",
|
|
302
314
|
value: function setDefaultExpandedKeys(keys) {
|
|
303
|
-
var
|
|
315
|
+
var _this8 = this;
|
|
304
316
|
keys = keys || [];
|
|
305
317
|
this.defaultExpandedKeys = keys;
|
|
306
318
|
keys.forEach(function (key) {
|
|
307
|
-
var node =
|
|
308
|
-
node && node.expand(null,
|
|
319
|
+
var node = _this8.getNode(key);
|
|
320
|
+
node && node.expand(null, _this8.autoExpandParent);
|
|
309
321
|
});
|
|
310
322
|
}
|
|
311
323
|
}, {
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
export var NODE_KEY = '$treeNodeId';
|
|
2
2
|
export var getNodeKey = function getNodeKey(key, data) {
|
|
3
|
-
if (!key)
|
|
3
|
+
if (!key) {
|
|
4
|
+
return data[NODE_KEY];
|
|
5
|
+
}
|
|
4
6
|
return data[key];
|
|
5
7
|
};
|
|
6
8
|
export var markNodeData = function markNodeData(node, data) {
|
|
7
|
-
if (!data || data[NODE_KEY])
|
|
9
|
+
if (!data || data[NODE_KEY]) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
8
12
|
Object.defineProperty(data, NODE_KEY, {
|
|
9
13
|
value: node.id,
|
|
10
14
|
enumerable: false,
|
|
@@ -46,7 +46,13 @@ export default (function (option) {
|
|
|
46
46
|
formData.append(key, option.data[key]);
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
if (Array.isArray(option.file)) {
|
|
50
|
+
option.file.forEach(function (file) {
|
|
51
|
+
formData.append(option.filename, file, file.name);
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
formData.append(option.filename, option.file, option.file.name);
|
|
55
|
+
}
|
|
50
56
|
xhr.onerror = function (event) {
|
|
51
57
|
option.onError(event);
|
|
52
58
|
};
|
|
@@ -30,10 +30,11 @@ var getReferMaxZIndex = function getReferMaxZIndex(reference) {
|
|
|
30
30
|
var max = getZIndex(reference);
|
|
31
31
|
var z;
|
|
32
32
|
do {
|
|
33
|
+
var _reference, _reference$parentNode;
|
|
33
34
|
reference = reference.parentNode;
|
|
34
35
|
z = getZIndex(reference);
|
|
35
36
|
max = z > max ? z : max;
|
|
36
|
-
} while (reference !== document.body);
|
|
37
|
+
} while (reference !== document.body && ((_reference = reference) === null || _reference === void 0 ? void 0 : (_reference$parentNode = _reference.parentNode) === null || _reference$parentNode === void 0 ? void 0 : _reference$parentNode.nodeType) !== 11);
|
|
37
38
|
return "".concat(max + 1);
|
|
38
39
|
};
|
|
39
40
|
var appendPopper = function appendPopper(_ref2) {
|
|
@@ -147,7 +148,6 @@ var createPopperFn = function createPopperFn(_ref4) {
|
|
|
147
148
|
state.popperJS.onCreate(function () {
|
|
148
149
|
emit('created', state);
|
|
149
150
|
resetTransformOrigin();
|
|
150
|
-
nextTick(updatePopper);
|
|
151
151
|
});
|
|
152
152
|
if (typeof options.onUpdate === 'function') {
|
|
153
153
|
state.popperJS.onUpdate(options.onUpdate);
|
package/common/string.js
CHANGED
package/company/index.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export var init = function init(_ref) {
|
|
2
|
+
var state = _ref.state,
|
|
3
|
+
props = _ref.props,
|
|
4
|
+
service = _ref.service;
|
|
5
|
+
return function () {
|
|
6
|
+
var _service$fields = service.fields,
|
|
7
|
+
textField = _service$fields.textField,
|
|
8
|
+
valueField = _service$fields.valueField;
|
|
9
|
+
if (state.source) {
|
|
10
|
+
state.options = state.source.map(function (item) {
|
|
11
|
+
return {
|
|
12
|
+
label: item[textField],
|
|
13
|
+
value: item[valueField]
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
} else {
|
|
17
|
+
service.fetchCompany().then(function (data) {
|
|
18
|
+
var list = data || [];
|
|
19
|
+
state.source = props.max ? list.slice(0, props.max) : list;
|
|
20
|
+
state.options = state.source.map(function (item) {
|
|
21
|
+
return {
|
|
22
|
+
label: item[textField],
|
|
23
|
+
value: item[valueField]
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export var change = function change(emit) {
|
|
31
|
+
return function (value) {
|
|
32
|
+
emit('update:modelValue', value);
|
|
33
|
+
emit('change', value);
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
export var initService = function initService(_ref2) {
|
|
37
|
+
var props = _ref2.props,
|
|
38
|
+
service = _ref2.service;
|
|
39
|
+
var _ref3 = service || {},
|
|
40
|
+
_ref3$setting = _ref3.setting,
|
|
41
|
+
setting = _ref3$setting === void 0 ? {} : _ref3$setting,
|
|
42
|
+
fetchCompany = _ref3.fetchCompany;
|
|
43
|
+
var _setting$options = setting.options,
|
|
44
|
+
options = _setting$options === void 0 ? {} : _setting$options;
|
|
45
|
+
var defaultCompanySetting = {
|
|
46
|
+
textField: 'tx_corporation_cn',
|
|
47
|
+
valueField: 'tx_coa'
|
|
48
|
+
};
|
|
49
|
+
var fetchCompanyNoop = function fetchCompanyNoop() {
|
|
50
|
+
return Promise.resolve([]);
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
fetchCompany: props.fetchCompany || fetchCompany || fetchCompanyNoop,
|
|
54
|
+
fields: props.fields || options.Company || defaultCompanySetting
|
|
55
|
+
};
|
|
56
|
+
};
|
package/company/vue.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { init, change, initService } from './index';
|
|
2
|
+
export var api = ['state', 'change', 'clear', 'visibleChange'];
|
|
3
|
+
export var renderless = function renderless(props, _ref, _ref2) {
|
|
4
|
+
var watch = _ref.watch,
|
|
5
|
+
reactive = _ref.reactive;
|
|
6
|
+
var emit = _ref2.emit,
|
|
7
|
+
service = _ref2.service;
|
|
8
|
+
var $service = initService({
|
|
9
|
+
props: props,
|
|
10
|
+
service: service
|
|
11
|
+
});
|
|
12
|
+
var state = reactive({
|
|
13
|
+
options: [],
|
|
14
|
+
source: null,
|
|
15
|
+
selectedValue: props.modelValue
|
|
16
|
+
});
|
|
17
|
+
var api = {
|
|
18
|
+
state: state,
|
|
19
|
+
change: change(emit),
|
|
20
|
+
init: init({
|
|
21
|
+
state: state,
|
|
22
|
+
props: props,
|
|
23
|
+
service: $service
|
|
24
|
+
})
|
|
25
|
+
};
|
|
26
|
+
watch(function () {
|
|
27
|
+
return props.modelValue;
|
|
28
|
+
}, function (propsValue) {
|
|
29
|
+
state.selectedValue = propsValue;
|
|
30
|
+
}, {
|
|
31
|
+
immediate: true
|
|
32
|
+
});
|
|
33
|
+
api.init();
|
|
34
|
+
return api;
|
|
35
|
+
};
|
package/country/index.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export var change = function change(emit) {
|
|
2
|
+
return function (value) {
|
|
3
|
+
emit('update:modelValue', value);
|
|
4
|
+
emit('change', value);
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
export var init = function init(_ref) {
|
|
8
|
+
var state = _ref.state,
|
|
9
|
+
service = _ref.service;
|
|
10
|
+
return function () {
|
|
11
|
+
var _service$fields = service.fields,
|
|
12
|
+
textField = _service$fields.textField,
|
|
13
|
+
valueField = _service$fields.valueField;
|
|
14
|
+
if (state.source) {
|
|
15
|
+
state.options = state.source.map(function (item) {
|
|
16
|
+
return {
|
|
17
|
+
label: item[textField],
|
|
18
|
+
value: item[valueField]
|
|
19
|
+
};
|
|
20
|
+
});
|
|
21
|
+
} else {
|
|
22
|
+
service.fetchCountry().then(function (data) {
|
|
23
|
+
state.source = data || [];
|
|
24
|
+
state.options = state.source.map(function (item) {
|
|
25
|
+
return {
|
|
26
|
+
value: item[valueField],
|
|
27
|
+
label: item[textField]
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export var initService = function initService(_ref2) {
|
|
35
|
+
var props = _ref2.props,
|
|
36
|
+
service = _ref2.service;
|
|
37
|
+
var _ref3 = service || {},
|
|
38
|
+
fetchCountry = _ref3.fetchCountry,
|
|
39
|
+
_ref3$setting = _ref3.setting,
|
|
40
|
+
setting = _ref3$setting === void 0 ? {} : _ref3$setting;
|
|
41
|
+
var _setting$options = setting.options,
|
|
42
|
+
options = _setting$options === void 0 ? {} : _setting$options;
|
|
43
|
+
var defaultCountrySetting = {
|
|
44
|
+
textField: 'territory_short_name',
|
|
45
|
+
valueField: 'territory_code'
|
|
46
|
+
};
|
|
47
|
+
var fetchCountryNoop = function fetchCountryNoop() {
|
|
48
|
+
return Promise.resolve([]);
|
|
49
|
+
};
|
|
50
|
+
return {
|
|
51
|
+
fetchCountry: props.fetchCountry || fetchCountry || fetchCountryNoop,
|
|
52
|
+
fields: props.fields || options.Country || defaultCountrySetting
|
|
53
|
+
};
|
|
54
|
+
};
|
package/country/vue.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { init, change, initService } from './index';
|
|
2
|
+
export var api = ['state', 'change', 'emit'];
|
|
3
|
+
export var renderless = function renderless(props, _ref, _ref2) {
|
|
4
|
+
var watch = _ref.watch,
|
|
5
|
+
reactive = _ref.reactive;
|
|
6
|
+
var service = _ref2.service,
|
|
7
|
+
emit = _ref2.emit;
|
|
8
|
+
var $service = initService({
|
|
9
|
+
props: props,
|
|
10
|
+
service: service
|
|
11
|
+
});
|
|
12
|
+
var state = reactive({
|
|
13
|
+
source: null,
|
|
14
|
+
options: [],
|
|
15
|
+
selectedValue: props.modelValue
|
|
16
|
+
});
|
|
17
|
+
var api = {
|
|
18
|
+
state: state,
|
|
19
|
+
emit: emit,
|
|
20
|
+
change: change(emit),
|
|
21
|
+
init: init({
|
|
22
|
+
state: state,
|
|
23
|
+
service: $service
|
|
24
|
+
})
|
|
25
|
+
};
|
|
26
|
+
watch(function () {
|
|
27
|
+
return props.modelValue;
|
|
28
|
+
}, function (newValue) {
|
|
29
|
+
state.selectedValue = newValue;
|
|
30
|
+
}, {
|
|
31
|
+
immediate: true
|
|
32
|
+
});
|
|
33
|
+
api.init();
|
|
34
|
+
return api;
|
|
35
|
+
};
|
|
@@ -17,6 +17,7 @@ export var changeNumber = function changeNumber(_ref2) {
|
|
|
17
17
|
state = _ref2.state;
|
|
18
18
|
return function (event) {
|
|
19
19
|
state.formData.cardNumber = event.target.value;
|
|
20
|
+
state.mainCardNumber = event.target.value;
|
|
20
21
|
var value = state.formData.cardNumber.replace(/\D/g, '');
|
|
21
22
|
if (/^3[47]\d{0,13}$/.test(value)) {
|
|
22
23
|
state.formData.cardNumber = value.replace(/^(\d{4})(?=\d)/, '$1 ').replace(/^(\d{4}) (\d{6})(?=\d)/, '$1 $2 ');
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { isUndefined, isNull } from '@opentiny/vue-renderless/grid/static';
|
|
2
|
+
import { log } from '@opentiny/vue-renderless/common';
|
|
3
|
+
export var init = function init(_ref) {
|
|
4
|
+
var state = _ref.state,
|
|
5
|
+
service = _ref.service,
|
|
6
|
+
api = _ref.api;
|
|
7
|
+
return function () {
|
|
8
|
+
var _service$fields = service.fields,
|
|
9
|
+
textField = _service$fields.textField,
|
|
10
|
+
valueField = _service$fields.valueField;
|
|
11
|
+
service.fetchCurrency().then(function (data) {
|
|
12
|
+
api.fixServiceData(data).then(function (result) {
|
|
13
|
+
state.options = result.map(function (item) {
|
|
14
|
+
return {
|
|
15
|
+
label: item[textField],
|
|
16
|
+
value: item[valueField]
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export var change = function change(emit) {
|
|
24
|
+
return function (value) {
|
|
25
|
+
emit('update:modelValue', value);
|
|
26
|
+
emit('change', value);
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export var initService = function initService(_ref2) {
|
|
30
|
+
var props = _ref2.props,
|
|
31
|
+
service = _ref2.service;
|
|
32
|
+
var defaultCurrencySetting = {
|
|
33
|
+
textField: 'currency_code',
|
|
34
|
+
valueField: 'currency_code'
|
|
35
|
+
};
|
|
36
|
+
var _ref3 = service || {},
|
|
37
|
+
_ref3$setting = _ref3.setting,
|
|
38
|
+
setting = _ref3$setting === void 0 ? {} : _ref3$setting,
|
|
39
|
+
fetchCurrency = _ref3.fetchCurrency;
|
|
40
|
+
var _setting$options = setting.options,
|
|
41
|
+
options = _setting$options === void 0 ? {} : _setting$options;
|
|
42
|
+
var fetchCurrencyNoop = function fetchCurrencyNoop() {
|
|
43
|
+
return Promise.resolve([]);
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
fetchCurrency: props.fetchCurrency || fetchCurrency || fetchCurrencyNoop,
|
|
47
|
+
fields: props.fields || options.Currency || defaultCurrencySetting
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
export var fixServiceData = function fixServiceData(_ref4) {
|
|
51
|
+
var props = _ref4.props,
|
|
52
|
+
service = _ref4.service;
|
|
53
|
+
return function (data) {
|
|
54
|
+
var _service$fields2 = service.fields,
|
|
55
|
+
textField = _service$fields2.textField,
|
|
56
|
+
valueField = _service$fields2.valueField;
|
|
57
|
+
return new Promise(function (resolve) {
|
|
58
|
+
data = data || [];
|
|
59
|
+
data = Array.isArray(data) ? data : [];
|
|
60
|
+
var result = [];
|
|
61
|
+
data.forEach(function (option) {
|
|
62
|
+
option = option || {};
|
|
63
|
+
var value = option[valueField];
|
|
64
|
+
var text = option[textField];
|
|
65
|
+
if (isUndefined(value) || isNull(value)) {
|
|
66
|
+
if (text) {
|
|
67
|
+
option[valueField] = text;
|
|
68
|
+
} else {
|
|
69
|
+
log('data error. set it to the default value.', 'warn');
|
|
70
|
+
option[textField] = option[valueField] = props.currency;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
result.push(option);
|
|
74
|
+
});
|
|
75
|
+
resolve(result);
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
};
|
package/currency/vue.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { init, fixServiceData, change, initService } from './index';
|
|
2
|
+
export var api = ['state', 'change'];
|
|
3
|
+
export var renderless = function renderless(props, _ref, _ref2) {
|
|
4
|
+
var watch = _ref.watch,
|
|
5
|
+
reactive = _ref.reactive;
|
|
6
|
+
var service = _ref2.service,
|
|
7
|
+
emit = _ref2.emit;
|
|
8
|
+
var api = {};
|
|
9
|
+
var $service = initService({
|
|
10
|
+
props: props,
|
|
11
|
+
service: service
|
|
12
|
+
});
|
|
13
|
+
var state = reactive({
|
|
14
|
+
options: [],
|
|
15
|
+
selectedValue: props.modelValue
|
|
16
|
+
});
|
|
17
|
+
Object.assign(api, {
|
|
18
|
+
state: state,
|
|
19
|
+
change: change(emit),
|
|
20
|
+
fixServiceData: fixServiceData({
|
|
21
|
+
props: props,
|
|
22
|
+
service: $service
|
|
23
|
+
}),
|
|
24
|
+
init: init({
|
|
25
|
+
state: state,
|
|
26
|
+
service: $service,
|
|
27
|
+
api: api
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
watch(function () {
|
|
31
|
+
return props.modelValue;
|
|
32
|
+
}, function (param) {
|
|
33
|
+
state.selectedValue = param;
|
|
34
|
+
}, {
|
|
35
|
+
immediate: true
|
|
36
|
+
});
|
|
37
|
+
api.init();
|
|
38
|
+
return api;
|
|
39
|
+
};
|
package/date-panel/index.js
CHANGED
|
@@ -27,7 +27,9 @@ export var watchValue = function watchValue(_ref2) {
|
|
|
27
27
|
var api = _ref2.api,
|
|
28
28
|
state = _ref2.state;
|
|
29
29
|
return function (value) {
|
|
30
|
-
if (state.selectionMode === DATEPICKER.Dates && state.value)
|
|
30
|
+
if (state.selectionMode === DATEPICKER.Dates && state.value) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
31
33
|
if (isDate(value)) {
|
|
32
34
|
state.date = state.selectionMode === 'week' ? getWeekData(value) : new Date(value);
|
|
33
35
|
} else {
|
|
@@ -74,7 +76,9 @@ export var proxyTimePickerDataProperties = function proxyTimePickerDataPropertie
|
|
|
74
76
|
watch = _ref6.watch;
|
|
75
77
|
return function () {
|
|
76
78
|
var format = function format(timeFormat) {
|
|
77
|
-
if (refs.timepicker)
|
|
79
|
+
if (refs.timepicker) {
|
|
80
|
+
refs.timepicker.state.format = timeFormat;
|
|
81
|
+
}
|
|
78
82
|
};
|
|
79
83
|
var value = function value(_value) {
|
|
80
84
|
if (refs.timepicker) {
|
|
@@ -417,7 +421,9 @@ export var handleVisibleTimeChange = function handleVisibleTimeChange(_ref25) {
|
|
|
417
421
|
if (time && api.checkDateWithinRange(time)) {
|
|
418
422
|
state.date = modifyDate(time, state.year, state.month, state.monthDate);
|
|
419
423
|
state.userInputTime = null;
|
|
420
|
-
if (refs.timepicker)
|
|
424
|
+
if (refs.timepicker) {
|
|
425
|
+
refs.timepicker.state.value = state.date;
|
|
426
|
+
}
|
|
421
427
|
state.timePickerVisible = false;
|
|
422
428
|
api.cusEmit(state.date, true);
|
|
423
429
|
}
|
|
@@ -462,7 +468,9 @@ export var selectTz = function selectTz(_ref29) {
|
|
|
462
468
|
var emit = _ref29.emit,
|
|
463
469
|
state = _ref29.state;
|
|
464
470
|
return function (tz) {
|
|
465
|
-
if (state.timezone.isServiceTimezone)
|
|
471
|
+
if (state.timezone.isServiceTimezone) {
|
|
472
|
+
return;
|
|
473
|
+
}
|
|
466
474
|
state.tz = tz.name;
|
|
467
475
|
state.selectedTz = tz;
|
|
468
476
|
state.showpopup = false;
|
|
@@ -507,7 +515,9 @@ export var debounceChange = debounce(500, function (state, input) {
|
|
|
507
515
|
});
|
|
508
516
|
export var toggleTz = function toggleTz(state) {
|
|
509
517
|
return function () {
|
|
510
|
-
if (state.timezone.isServiceTimezone)
|
|
518
|
+
if (state.timezone.isServiceTimezone) {
|
|
519
|
+
return;
|
|
520
|
+
}
|
|
511
521
|
state.renderTzdata = state.renderTzdata && state.renderTzdata.map(function (item) {
|
|
512
522
|
item.visible = false;
|
|
513
523
|
return item;
|
|
@@ -538,7 +548,7 @@ export var getRenderTz = function getRenderTz(_ref31) {
|
|
|
538
548
|
findTimezoneKey = '';
|
|
539
549
|
} else {
|
|
540
550
|
findTimezoneKey = to > 0 ? '+' : '-';
|
|
541
|
-
findTimezoneKey = findTimezoneKey + fillChar(Math.abs(to)
|
|
551
|
+
findTimezoneKey = findTimezoneKey + fillChar(String(Math.abs(to)), 2) + ':00';
|
|
542
552
|
}
|
|
543
553
|
findTimezoneKey = "(UTC".concat(findTimezoneKey, ")");
|
|
544
554
|
state.renderTzdata.some(function (item) {
|