shineout 1.12.6-beta.4 → 1.12.6-beta.5
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/css/Cascader/index.d.ts +1 -2
- package/css/index.d.ts +1 -1
- package/css/index.js +1 -1
- package/css/utils/expose.js +15 -36
- package/css/utils/vars-inject.js +59 -9
- package/dist/shineout.js +4091 -3552
- package/dist/shineout.js.map +1 -1
- package/dist/shineout.min.js +1 -1
- package/es/Cascader/index.d.ts +1 -2
- package/es/index.d.ts +1 -1
- package/es/index.js +1 -1
- package/es/utils/expose.js +16 -37
- package/es/utils/vars-inject.js +51 -9
- package/lib/Cascader/index.d.ts +1 -2
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/utils/expose.js +15 -36
- package/lib/utils/vars-inject.js +59 -9
- package/package.json +1 -1
package/css/Cascader/index.d.ts
CHANGED
|
@@ -223,8 +223,7 @@ export interface CascaderProps<Item, Value> extends StandardProps, FormItemStand
|
|
|
223
223
|
}
|
|
224
224
|
|
|
225
225
|
interface componentRef {
|
|
226
|
-
close: () => void
|
|
227
|
-
[propName: string]: any;
|
|
226
|
+
close: () => void
|
|
228
227
|
}
|
|
229
228
|
|
|
230
229
|
declare class Cascader<Item = any, Value = string[]> extends React.Component<CascaderProps<Item, Value>, {}> {
|
package/css/index.d.ts
CHANGED
package/css/index.js
CHANGED
package/css/utils/expose.js
CHANGED
|
@@ -64,7 +64,12 @@ function resetTheme() {
|
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
function
|
|
67
|
+
function setStyle(options, custom, config) {
|
|
68
|
+
if (config === void 0) {
|
|
69
|
+
config = {};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
(0, _varsInject.setThemeConfig)(config);
|
|
68
73
|
(0, _varsInject.cleanStyleObj)();
|
|
69
74
|
|
|
70
75
|
if (!options) {
|
|
@@ -90,45 +95,19 @@ function setStyleWithTag(options, custom) {
|
|
|
90
95
|
}
|
|
91
96
|
}
|
|
92
97
|
|
|
93
|
-
(
|
|
98
|
+
if (config.injectType === 'tag') {
|
|
99
|
+
var id = (0, _varsInject.injectTag)(custom);
|
|
100
|
+
return function () {
|
|
101
|
+
document.getElementById(id).remove();
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return function () {};
|
|
94
106
|
}
|
|
95
107
|
|
|
96
108
|
var style = {
|
|
97
109
|
getClassname: getClassname,
|
|
98
|
-
setStyle:
|
|
99
|
-
if (custom === void 0) {
|
|
100
|
-
custom = {};
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
if ((0, _varsInject.getInjectType)() === 'tag') {
|
|
104
|
-
setStyleWithTag(options, custom);
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
if (!options) {
|
|
109
|
-
resetTheme();
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
for (var _iterator2 = (0, _objects.entries)(options), _isArray2 = Array.isArray(_iterator2), _i2 = 0, _iterator2 = _isArray2 ? _iterator2 : _iterator2[Symbol.iterator]();;) {
|
|
114
|
-
var _ref3;
|
|
115
|
-
|
|
116
|
-
if (_isArray2) {
|
|
117
|
-
if (_i2 >= _iterator2.length) break;
|
|
118
|
-
_ref3 = _iterator2[_i2++];
|
|
119
|
-
} else {
|
|
120
|
-
_i2 = _iterator2.next();
|
|
121
|
-
if (_i2.done) break;
|
|
122
|
-
_ref3 = _i2.value;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
var _ref4 = _ref3,
|
|
126
|
-
key = _ref4[0],
|
|
127
|
-
values = _ref4[1];
|
|
128
|
-
var setterName = "set" + (0, _strings.capitalize)(key);
|
|
129
|
-
if (_cssAccessors.default[key] && _cssAccessors.default[key][setterName]) _cssAccessors.default[key][setterName](values);
|
|
130
|
-
}
|
|
131
|
-
},
|
|
110
|
+
setStyle: setStyle,
|
|
132
111
|
cleanCache: _cssAccessors.cleanCache,
|
|
133
112
|
setInjectType: _varsInject.setInjectType,
|
|
134
113
|
getInjectType: _varsInject.getInjectType
|
package/css/utils/vars-inject.js
CHANGED
|
@@ -5,6 +5,9 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
exports.__esModule = true;
|
|
6
6
|
exports.getInjectType = getInjectType;
|
|
7
7
|
exports.setInjectType = setInjectType;
|
|
8
|
+
exports.setThemeConfig = setThemeConfig;
|
|
9
|
+
exports.getThemeConfig = getThemeConfig;
|
|
10
|
+
exports.getThemeTarget = getThemeTarget;
|
|
8
11
|
exports.cleanStyleObj = cleanStyleObj;
|
|
9
12
|
exports.injectTag = injectTag;
|
|
10
13
|
exports.default = void 0;
|
|
@@ -17,6 +20,10 @@ var _config = require("../config");
|
|
|
17
20
|
|
|
18
21
|
var _objects = require("./objects");
|
|
19
22
|
|
|
23
|
+
var _is = require("./is");
|
|
24
|
+
|
|
25
|
+
var _hash = _interopRequireDefault(require("./hash"));
|
|
26
|
+
|
|
20
27
|
var _styles = require("../Pagination/styles");
|
|
21
28
|
|
|
22
29
|
var _styles2 = require("../Checkbox/styles");
|
|
@@ -53,16 +60,50 @@ var _styles17 = require("../Tag/styles");
|
|
|
53
60
|
|
|
54
61
|
var _expose = require("../styles/expose");
|
|
55
62
|
|
|
63
|
+
var config = {
|
|
64
|
+
injectType: 'body',
|
|
65
|
+
target: undefined
|
|
66
|
+
};
|
|
56
67
|
var computedCache = {};
|
|
57
|
-
var injectType = 'body';
|
|
58
68
|
var styleObj = {};
|
|
59
69
|
|
|
60
70
|
function getInjectType() {
|
|
61
|
-
return injectType;
|
|
71
|
+
return config.injectType;
|
|
62
72
|
}
|
|
63
73
|
|
|
64
74
|
function setInjectType(type) {
|
|
65
|
-
injectType = type;
|
|
75
|
+
config.injectType = type;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function setThemeConfig(c) {
|
|
79
|
+
if (c === void 0) {
|
|
80
|
+
c = {};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
Object.keys(c).forEach(function (key) {
|
|
84
|
+
if (key in config) {
|
|
85
|
+
config[key] = c[key];
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function getThemeConfig(name) {
|
|
91
|
+
return config[name];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function getThemeTarget() {
|
|
95
|
+
var target = config.target;
|
|
96
|
+
if (!target) return document.body;
|
|
97
|
+
|
|
98
|
+
if ((0, _is.isFunc)(target)) {
|
|
99
|
+
target = config.target();
|
|
100
|
+
} else if (typeof target === 'string') {
|
|
101
|
+
target = document.querySelector(target);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (target instanceof HTMLElement) return target;
|
|
105
|
+
console.error("cont not find theme target dom from \"" + config.target + "\"");
|
|
106
|
+
return document.body;
|
|
66
107
|
}
|
|
67
108
|
|
|
68
109
|
function cleanStyleObj() {
|
|
@@ -74,8 +115,13 @@ function injectTag(custom) {
|
|
|
74
115
|
custom = {};
|
|
75
116
|
}
|
|
76
117
|
|
|
77
|
-
|
|
78
|
-
|
|
118
|
+
if (config.target && typeof config.target !== 'string') {
|
|
119
|
+
console.error('The target of themeConfig must use string when injectType = "tag"');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
var selector = config.target || 'body';
|
|
123
|
+
var id = "__shineoutThemeStyleContainer__" + (0, _hash.default)(selector);
|
|
124
|
+
var styleText = selector + "{" + Object.keys((0, _objectSpread2.default)({}, styleObj, custom)).map(function (key) {
|
|
79
125
|
return key + ": " + styleObj[key];
|
|
80
126
|
}).join(';') + "}";
|
|
81
127
|
var el = document.getElementById(id);
|
|
@@ -89,6 +135,8 @@ function injectTag(custom) {
|
|
|
89
135
|
stylee.innerText = styleText;
|
|
90
136
|
document.head.appendChild(stylee);
|
|
91
137
|
}
|
|
138
|
+
|
|
139
|
+
return id;
|
|
92
140
|
}
|
|
93
141
|
|
|
94
142
|
function getProperty(name, cache) {
|
|
@@ -122,15 +170,17 @@ function setBodyProperty(colors, value) {
|
|
|
122
170
|
cssVar = _ref2[0],
|
|
123
171
|
cssValue = _ref2[1];
|
|
124
172
|
|
|
125
|
-
if (injectType === 'body') {
|
|
173
|
+
if (config.injectType === 'body') {
|
|
174
|
+
var target = getThemeTarget();
|
|
175
|
+
|
|
126
176
|
if (value === undefined) {
|
|
127
|
-
|
|
177
|
+
target.style.removeProperty(cssVar);
|
|
128
178
|
} else {
|
|
129
|
-
|
|
179
|
+
target.style.setProperty(cssVar, cssValue);
|
|
130
180
|
}
|
|
131
181
|
}
|
|
132
182
|
|
|
133
|
-
if (injectType === 'tag') {
|
|
183
|
+
if (config.injectType === 'tag') {
|
|
134
184
|
if (value === undefined) {
|
|
135
185
|
delete styleObj[cssVar];
|
|
136
186
|
} else {
|