@blueking/bkui-form 1.0.1-beta.3 → 1.0.1-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/dist/adapter/common/FieldGroupWrap.d.ts +209 -0
- package/dist/adapter/field/ArrayField.d.ts +147 -0
- package/dist/adapter/field/BooleanField.d.ts +145 -0
- package/dist/adapter/field/CompositionField.d.ts +151 -0
- package/dist/adapter/field/FieldProps.d.ts +70 -0
- package/dist/adapter/field/NumberField.d.ts +145 -0
- package/dist/adapter/field/ObjectField.d.ts +147 -0
- package/dist/adapter/field/SchemaField.d.ts +145 -0
- package/dist/adapter/field/StringField.d.ts +4 -0
- package/dist/adapter/widget/ArrayWidget.d.ts +154 -0
- package/dist/adapter/widget/ButtonWidget.d.ts +16 -0
- package/dist/adapter/widget/CheckboxWidget.d.ts +34 -0
- package/dist/adapter/widget/CollapseGroupWidget.d.ts +196 -0
- package/dist/adapter/widget/ColorPickerWidget.d.ts +8 -0
- package/dist/adapter/widget/InputWidget.d.ts +30 -0
- package/dist/adapter/widget/KeyValueArrayWidget.d.ts +157 -0
- package/dist/adapter/widget/RadioWidget.d.ts +37 -0
- package/dist/adapter/widget/SelectWidget.d.ts +37 -0
- package/dist/adapter/widget/SwitchWidget.d.ts +10 -0
- package/dist/adapter/widget/TabGroupWidget.d.ts +187 -0
- package/dist/adapter/widget/TableWidget.d.ts +154 -0
- package/dist/adapter/widget/Widget.d.ts +182 -0
- package/dist/controller/form.d.ts +141 -0
- package/dist/controller/props.d.ts +62 -0
- package/dist/core/events.d.ts +10 -0
- package/dist/core/expression.d.ts +13 -0
- package/dist/core/form.d.ts +5 -0
- package/dist/core/lang.d.ts +1 -0
- package/dist/core/layout.d.ts +20 -0
- package/dist/core/lifecycle.d.ts +0 -0
- package/dist/core/path.d.ts +9 -0
- package/dist/core/proxy.d.ts +3 -0
- package/dist/core/reaction.d.ts +5 -0
- package/dist/core/register.d.ts +19 -0
- package/dist/core/schema.d.ts +26 -0
- package/dist/core/validator.d.ts +35 -0
- package/dist/core/widgetTree.d.ts +40 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.es.js +7443 -0
- package/dist/index.umd.js +12 -0
- package/dist/style.css +1 -0
- package/dist/util/fetch.d.ts +10 -0
- package/dist/util/index.d.ts +23 -0
- package/package.json +24 -12
- package/esm/adapter/common/FieldGroupWrap.tsx.js +0 -199
- package/esm/adapter/field/ArrayField.tsx.js +0 -55
- package/esm/adapter/field/BooleanField.tsx.js +0 -41
- package/esm/adapter/field/CompositionField.tsx.js +0 -113
- package/esm/adapter/field/FieldProps.ts.js +0 -85
- package/esm/adapter/field/NumberField.tsx.js +0 -19
- package/esm/adapter/field/ObjectField.tsx.js +0 -58
- package/esm/adapter/field/SchemaField.tsx.js +0 -28
- package/esm/adapter/field/StringField.tsx.js +0 -4
- package/esm/adapter/widget/ArrayWidget.ts.js +0 -196
- package/esm/adapter/widget/ButtonWidget.ts.js +0 -76
- package/esm/adapter/widget/CheckboxWidget.ts.js +0 -101
- package/esm/adapter/widget/CollapseGroupWidget.ts.js +0 -140
- package/esm/adapter/widget/ColorPickerWidget.ts.js +0 -71
- package/esm/adapter/widget/InputWidget.ts.js +0 -79
- package/esm/adapter/widget/KeyValueArrayWidget.tsx.js +0 -156
- package/esm/adapter/widget/RadioWidget.ts.js +0 -98
- package/esm/adapter/widget/SelectWidget.ts.js +0 -98
- package/esm/adapter/widget/SwitchWidget.ts.js +0 -73
- package/esm/adapter/widget/TabGroupWidget.ts.js +0 -145
- package/esm/adapter/widget/TableWidget.ts.js +0 -205
- package/esm/adapter/widget/Widget.ts.js +0 -497
- package/esm/assets/fonts/iconcool.eot +0 -0
- package/esm/assets/fonts/iconcool.svg +0 -53
- package/esm/assets/fonts/iconcool.ttf +0 -0
- package/esm/assets/fonts/iconcool.woff +0 -0
- package/esm/assets/style.css +0 -43
- package/esm/controller/form.css +0 -164
- package/esm/controller/form.tsx.js +0 -159
- package/esm/controller/props.ts.js +0 -75
- package/esm/core/events.ts.js +0 -74
- package/esm/core/expression.ts.js +0 -67
- package/esm/core/lang.ts.js +0 -25
- package/esm/core/layout.ts.js +0 -149
- package/esm/core/path.ts.js +0 -60
- package/esm/core/proxy.ts.js +0 -10
- package/esm/core/reaction.ts.js +0 -116
- package/esm/core/register.ts.js +0 -74
- package/esm/core/schema.ts.js +0 -302
- package/esm/core/validator.ts.js +0 -248
- package/esm/core/widgetTree.ts.js +0 -163
- package/esm/index.ts.js +0 -6
- package/esm/node_modules/@blueking/cli-service/dist/lib/path.js +0 -35
- package/esm/node_modules/@blueking/cli-service/dist/lib/util.js +0 -233
- package/esm/node_modules/@blueking/cli-service/dist/tools/rust/helper/path.js +0 -172
- package/esm/node_modules/ajv/dist/ajv.js +0 -50
- package/esm/node_modules/ajv/dist/compile/codegen/code.js +0 -156
- package/esm/node_modules/ajv/dist/compile/codegen/index.js +0 -697
- package/esm/node_modules/ajv/dist/compile/codegen/scope.js +0 -143
- package/esm/node_modules/ajv/dist/compile/errors.js +0 -123
- package/esm/node_modules/ajv/dist/compile/index.js +0 -242
- package/esm/node_modules/ajv/dist/compile/names.js +0 -28
- package/esm/node_modules/ajv/dist/compile/ref_error.js +0 -12
- package/esm/node_modules/ajv/dist/compile/resolve.js +0 -155
- package/esm/node_modules/ajv/dist/compile/rules.js +0 -26
- package/esm/node_modules/ajv/dist/compile/util.js +0 -178
- package/esm/node_modules/ajv/dist/compile/validate/applicability.js +0 -19
- package/esm/node_modules/ajv/dist/compile/validate/boolSchema.js +0 -50
- package/esm/node_modules/ajv/dist/compile/validate/dataType.js +0 -203
- package/esm/node_modules/ajv/dist/compile/validate/defaults.js +0 -35
- package/esm/node_modules/ajv/dist/compile/validate/index.js +0 -520
- package/esm/node_modules/ajv/dist/compile/validate/keyword.js +0 -124
- package/esm/node_modules/ajv/dist/compile/validate/subschema.js +0 -81
- package/esm/node_modules/ajv/dist/core.js +0 -618
- package/esm/node_modules/ajv/dist/refs/data.json +0 -13
- package/esm/node_modules/ajv/dist/refs/json-schema-draft-07.json +0 -151
- package/esm/node_modules/ajv/dist/runtime/equal.js +0 -7
- package/esm/node_modules/ajv/dist/runtime/ucs2length.js +0 -24
- package/esm/node_modules/ajv/dist/runtime/uri.js +0 -6
- package/esm/node_modules/ajv/dist/runtime/validation_error.js +0 -11
- package/esm/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +0 -49
- package/esm/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +0 -106
- package/esm/node_modules/ajv/dist/vocabularies/applicator/allOf.js +0 -23
- package/esm/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +0 -12
- package/esm/node_modules/ajv/dist/vocabularies/applicator/contains.js +0 -95
- package/esm/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +0 -85
- package/esm/node_modules/ajv/dist/vocabularies/applicator/if.js +0 -66
- package/esm/node_modules/ajv/dist/vocabularies/applicator/index.js +0 -44
- package/esm/node_modules/ajv/dist/vocabularies/applicator/items.js +0 -52
- package/esm/node_modules/ajv/dist/vocabularies/applicator/items2020.js +0 -30
- package/esm/node_modules/ajv/dist/vocabularies/applicator/not.js +0 -26
- package/esm/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +0 -60
- package/esm/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +0 -75
- package/esm/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +0 -12
- package/esm/node_modules/ajv/dist/vocabularies/applicator/properties.js +0 -54
- package/esm/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +0 -38
- package/esm/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +0 -13
- package/esm/node_modules/ajv/dist/vocabularies/code.js +0 -131
- package/esm/node_modules/ajv/dist/vocabularies/core/id.js +0 -10
- package/esm/node_modules/ajv/dist/vocabularies/core/index.js +0 -16
- package/esm/node_modules/ajv/dist/vocabularies/core/ref.js +0 -122
- package/esm/node_modules/ajv/dist/vocabularies/discriminator/index.js +0 -104
- package/esm/node_modules/ajv/dist/vocabularies/discriminator/types.js +0 -9
- package/esm/node_modules/ajv/dist/vocabularies/draft7.js +0 -17
- package/esm/node_modules/ajv/dist/vocabularies/format/format.js +0 -92
- package/esm/node_modules/ajv/dist/vocabularies/format/index.js +0 -6
- package/esm/node_modules/ajv/dist/vocabularies/metadata.js +0 -18
- package/esm/node_modules/ajv/dist/vocabularies/validation/const.js +0 -25
- package/esm/node_modules/ajv/dist/vocabularies/validation/enum.js +0 -48
- package/esm/node_modules/ajv/dist/vocabularies/validation/index.js +0 -33
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitItems.js +0 -24
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitLength.js +0 -27
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +0 -27
- package/esm/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +0 -24
- package/esm/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +0 -26
- package/esm/node_modules/ajv/dist/vocabularies/validation/pattern.js +0 -24
- package/esm/node_modules/ajv/dist/vocabularies/validation/required.js +0 -79
- package/esm/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +0 -64
- package/esm/node_modules/ajv-formats/dist/formats.js +0 -173
- package/esm/node_modules/ajv-formats/dist/index.js +0 -37
- package/esm/node_modules/ajv-formats/dist/limit.js +0 -69
- package/esm/node_modules/ajv-i18n/localize/zh/index.js +0 -154
- package/esm/node_modules/fast-deep-equal/index.js +0 -46
- package/esm/node_modules/fast-uri/index.js +0 -303
- package/esm/node_modules/fast-uri/lib/schemes.js +0 -188
- package/esm/node_modules/fast-uri/lib/scopedChars.js +0 -30
- package/esm/node_modules/fast-uri/lib/utils.js +0 -244
- package/esm/node_modules/json-schema-traverse/index.js +0 -89
- package/esm/node_modules/semver/classes/comparator.js +0 -143
- package/esm/node_modules/semver/classes/range.js +0 -557
- package/esm/node_modules/semver/classes/semver.js +0 -333
- package/esm/node_modules/semver/functions/clean.js +0 -8
- package/esm/node_modules/semver/functions/cmp.js +0 -54
- package/esm/node_modules/semver/functions/coerce.js +0 -62
- package/esm/node_modules/semver/functions/compare-build.js +0 -9
- package/esm/node_modules/semver/functions/compare-loose.js +0 -5
- package/esm/node_modules/semver/functions/compare.js +0 -7
- package/esm/node_modules/semver/functions/diff.js +0 -60
- package/esm/node_modules/semver/functions/eq.js +0 -5
- package/esm/node_modules/semver/functions/gt.js +0 -5
- package/esm/node_modules/semver/functions/gte.js +0 -5
- package/esm/node_modules/semver/functions/inc.js +0 -21
- package/esm/node_modules/semver/functions/lt.js +0 -5
- package/esm/node_modules/semver/functions/lte.js +0 -5
- package/esm/node_modules/semver/functions/major.js +0 -5
- package/esm/node_modules/semver/functions/minor.js +0 -5
- package/esm/node_modules/semver/functions/neq.js +0 -5
- package/esm/node_modules/semver/functions/parse.js +0 -18
- package/esm/node_modules/semver/functions/patch.js +0 -5
- package/esm/node_modules/semver/functions/prerelease.js +0 -8
- package/esm/node_modules/semver/functions/rcompare.js +0 -5
- package/esm/node_modules/semver/functions/rsort.js +0 -5
- package/esm/node_modules/semver/functions/satisfies.js +0 -12
- package/esm/node_modules/semver/functions/sort.js +0 -5
- package/esm/node_modules/semver/functions/valid.js +0 -8
- package/esm/node_modules/semver/index.js +0 -91
- package/esm/node_modules/semver/internal/constants.js +0 -37
- package/esm/node_modules/semver/internal/debug.js +0 -11
- package/esm/node_modules/semver/internal/identifiers.js +0 -29
- package/esm/node_modules/semver/internal/lrucache.js +0 -42
- package/esm/node_modules/semver/internal/parse-options.js +0 -17
- package/esm/node_modules/semver/internal/re.js +0 -223
- package/esm/node_modules/semver/ranges/gtr.js +0 -6
- package/esm/node_modules/semver/ranges/intersects.js +0 -9
- package/esm/node_modules/semver/ranges/ltr.js +0 -6
- package/esm/node_modules/semver/ranges/max-satisfying.js +0 -27
- package/esm/node_modules/semver/ranges/min-satisfying.js +0 -26
- package/esm/node_modules/semver/ranges/min-version.js +0 -63
- package/esm/node_modules/semver/ranges/outside.js +0 -82
- package/esm/node_modules/semver/ranges/simplify.js +0 -49
- package/esm/node_modules/semver/ranges/subset.js +0 -249
- package/esm/node_modules/semver/ranges/to-comparators.js +0 -10
- package/esm/node_modules/semver/ranges/valid.js +0 -13
- package/esm/util/fetch.ts.js +0 -190
- package/esm/util/index.ts.js +0 -276
package/esm/util/index.ts.js
DELETED
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
function _define_property(obj, key, value) {
|
|
2
|
-
if (key in obj) {
|
|
3
|
-
Object.defineProperty(obj, key, {
|
|
4
|
-
value: value,
|
|
5
|
-
enumerable: true,
|
|
6
|
-
configurable: true,
|
|
7
|
-
writable: true
|
|
8
|
-
});
|
|
9
|
-
} else {
|
|
10
|
-
obj[key] = value;
|
|
11
|
-
}
|
|
12
|
-
return obj;
|
|
13
|
-
}
|
|
14
|
-
function _object_spread(target) {
|
|
15
|
-
for(var i = 1; i < arguments.length; i++){
|
|
16
|
-
var source = arguments[i] != null ? arguments[i] : {};
|
|
17
|
-
var ownKeys = Object.keys(source);
|
|
18
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
19
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
20
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
21
|
-
}));
|
|
22
|
-
}
|
|
23
|
-
ownKeys.forEach(function(key) {
|
|
24
|
-
_define_property(target, key, source[key]);
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
return target;
|
|
28
|
-
}
|
|
29
|
-
// eslint-disable-next-line no-new-func
|
|
30
|
-
export const isRegExp = (regExpStr)=>{
|
|
31
|
-
var _this;
|
|
32
|
-
return ((_this = new Function(`return ${regExpStr};`)()) === null || _this === void 0 ? void 0 : _this.constructor) === RegExp;
|
|
33
|
-
};
|
|
34
|
-
export const isObj = (val)=>Object.prototype.toString.call(val) === '[object Object]';
|
|
35
|
-
export const globalThisPolyfill = function globalSelf() {
|
|
36
|
-
try {
|
|
37
|
-
if (typeof self !== 'undefined') {
|
|
38
|
-
return self;
|
|
39
|
-
}
|
|
40
|
-
} catch (e) {}
|
|
41
|
-
try {
|
|
42
|
-
if (typeof window !== 'undefined') {
|
|
43
|
-
return window;
|
|
44
|
-
}
|
|
45
|
-
} catch (e) {}
|
|
46
|
-
try {
|
|
47
|
-
if (typeof global !== 'undefined') {
|
|
48
|
-
return global;
|
|
49
|
-
}
|
|
50
|
-
} catch (e) {}
|
|
51
|
-
// eslint-disable-next-line no-new-func
|
|
52
|
-
return Function('return this')();
|
|
53
|
-
}();
|
|
54
|
-
export const getBrowserlanguage = ()=>{
|
|
55
|
-
if (!globalThisPolyfill.navigator) {
|
|
56
|
-
return 'zh';
|
|
57
|
-
}
|
|
58
|
-
return globalThisPolyfill.navigator.browserlanguage || globalThisPolyfill.navigator.language || 'zh';
|
|
59
|
-
};
|
|
60
|
-
export const hasOwnProperty = (obj, key)=>Object.prototype.hasOwnProperty.call(obj, key);
|
|
61
|
-
export const valueType = (value)=>{
|
|
62
|
-
if (Array.isArray(value)) {
|
|
63
|
-
return 'array';
|
|
64
|
-
}
|
|
65
|
-
if (typeof value === 'string') {
|
|
66
|
-
return 'string';
|
|
67
|
-
}
|
|
68
|
-
if (typeof value === 'boolean') {
|
|
69
|
-
return 'boolean';
|
|
70
|
-
}
|
|
71
|
-
if (!isNaN(value)) {
|
|
72
|
-
return 'number';
|
|
73
|
-
}
|
|
74
|
-
if (value === null) {
|
|
75
|
-
return 'null';
|
|
76
|
-
}
|
|
77
|
-
if (typeof value === 'object') {
|
|
78
|
-
return 'object';
|
|
79
|
-
}
|
|
80
|
-
return typeof value;
|
|
81
|
-
};
|
|
82
|
-
export const merge = (target, source)=>{
|
|
83
|
-
if (isObj(source)) {
|
|
84
|
-
return Object.keys(source).reduce((pre, key)=>{
|
|
85
|
-
pre[key] = merge((target === null || target === void 0 ? void 0 : target[key]) || {}, source[key]);
|
|
86
|
-
return pre;
|
|
87
|
-
}, JSON.parse(JSON.stringify(target)));
|
|
88
|
-
}
|
|
89
|
-
if (Array.isArray(source)) {
|
|
90
|
-
target = Array.isArray(target) ? target : [];
|
|
91
|
-
return source.map((item, index)=>{
|
|
92
|
-
if (target[index]) {
|
|
93
|
-
return merge(target[index], item);
|
|
94
|
-
}
|
|
95
|
-
return item;
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
return source;
|
|
99
|
-
};
|
|
100
|
-
export function intersection(arr1, arr2) {
|
|
101
|
-
return arr1.filter((item)=>arr2.includes(item));
|
|
102
|
-
}
|
|
103
|
-
// 最大公约数
|
|
104
|
-
export function gcd(a, b) {
|
|
105
|
-
if (b === 0) return a;
|
|
106
|
-
return gcd(b, a % b);
|
|
107
|
-
}
|
|
108
|
-
// 最小公倍数
|
|
109
|
-
export function scm(a, b) {
|
|
110
|
-
return a * b / gcd(a, b);
|
|
111
|
-
}
|
|
112
|
-
// 获取type对应的初始化值
|
|
113
|
-
export function initializationValue(type, defaultInitValue = {
|
|
114
|
-
integer: undefined,
|
|
115
|
-
number: undefined
|
|
116
|
-
}) {
|
|
117
|
-
switch(type){
|
|
118
|
-
case 'any':
|
|
119
|
-
return undefined;
|
|
120
|
-
case 'array':
|
|
121
|
-
return [];
|
|
122
|
-
case 'boolean':
|
|
123
|
-
return false;
|
|
124
|
-
case 'integer':
|
|
125
|
-
return defaultInitValue.integer;
|
|
126
|
-
case 'null':
|
|
127
|
-
return null;
|
|
128
|
-
case 'number':
|
|
129
|
-
return defaultInitValue.number;
|
|
130
|
-
case 'object':
|
|
131
|
-
return {};
|
|
132
|
-
case 'string':
|
|
133
|
-
return '';
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
function isObject(obj) {
|
|
137
|
-
return Object.prototype.toString.call(obj) === '[object Object]';
|
|
138
|
-
}
|
|
139
|
-
function mergeObject(target, source) {
|
|
140
|
-
const result = _object_spread({}, target); // 创建一个新对象以保持原对象不变
|
|
141
|
-
for (const [key, value] of Object.entries(source)){
|
|
142
|
-
if (isObject(value) && key in target) {
|
|
143
|
-
// 如果值是一个对象,并且键存在于目标对象中,则递归合并这个值
|
|
144
|
-
result[key] = mergeObject(result[key], value);
|
|
145
|
-
} else {
|
|
146
|
-
// 否则,直接设置值
|
|
147
|
-
result[key] = value;
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
return result;
|
|
151
|
-
}
|
|
152
|
-
export function mergeDeep(target, ...sources) {
|
|
153
|
-
return sources.reduce(mergeObject, target);
|
|
154
|
-
}
|
|
155
|
-
function isArguments(object) {
|
|
156
|
-
return Object.prototype.toString.call(object) === '[object Arguments]';
|
|
157
|
-
}
|
|
158
|
-
export function deepEquals(a, b, ca = [], cb = []) {
|
|
159
|
-
// Partially extracted from node-deeper and adapted to exclude comparison
|
|
160
|
-
// checks for functions.
|
|
161
|
-
// https://github.com/othiym23/node-deeper
|
|
162
|
-
if (a === b) {
|
|
163
|
-
return true;
|
|
164
|
-
}
|
|
165
|
-
if (typeof a === 'function' || typeof b === 'function') {
|
|
166
|
-
// Assume all functions are equivalent
|
|
167
|
-
// see https://github.com/mozilla-services/react-jsonschema-form/issues/255
|
|
168
|
-
return true;
|
|
169
|
-
}
|
|
170
|
-
if (typeof a !== 'object' || typeof b !== 'object') {
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
if (a === null || b === null) {
|
|
174
|
-
return false;
|
|
175
|
-
}
|
|
176
|
-
if (a instanceof Date && b instanceof Date) {
|
|
177
|
-
return a.getTime() === b.getTime();
|
|
178
|
-
}
|
|
179
|
-
if (a instanceof RegExp && b instanceof RegExp) {
|
|
180
|
-
return a.source === b.source && a.global === b.global && a.multiline === b.multiline && a.lastIndex === b.lastIndex && a.ignoreCase === b.ignoreCase;
|
|
181
|
-
}
|
|
182
|
-
if (isArguments(a) || isArguments(b)) {
|
|
183
|
-
if (!(isArguments(a) && isArguments(b))) {
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
const { slice } = Array.prototype;
|
|
187
|
-
return deepEquals(slice.call(a), slice.call(b), ca, cb);
|
|
188
|
-
}
|
|
189
|
-
if (a.constructor !== b.constructor) {
|
|
190
|
-
return false;
|
|
191
|
-
}
|
|
192
|
-
const ka = Object.keys(a);
|
|
193
|
-
const kb = Object.keys(b);
|
|
194
|
-
// don't bother with stack acrobatics if there's nothing there
|
|
195
|
-
if (ka.length === 0 && kb.length === 0) {
|
|
196
|
-
return true;
|
|
197
|
-
}
|
|
198
|
-
if (ka.length !== kb.length) {
|
|
199
|
-
return false;
|
|
200
|
-
}
|
|
201
|
-
let cal = ca.length;
|
|
202
|
-
// eslint-disable-next-line no-plusplus
|
|
203
|
-
while(cal--){
|
|
204
|
-
if (ca[cal] === a) {
|
|
205
|
-
return cb[cal] === b;
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
ca.push(a);
|
|
209
|
-
cb.push(b);
|
|
210
|
-
ka.sort();
|
|
211
|
-
kb.sort();
|
|
212
|
-
// eslint-disable-next-line no-plusplus
|
|
213
|
-
for(let j = ka.length - 1; j >= 0; j--){
|
|
214
|
-
if (ka[j] !== kb[j]) {
|
|
215
|
-
return false;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
let key;
|
|
219
|
-
// eslint-disable-next-line no-plusplus
|
|
220
|
-
for(let k = ka.length - 1; k >= 0; k--){
|
|
221
|
-
key = ka[k];
|
|
222
|
-
if (!deepEquals(a[key], b[key], ca, cb)) {
|
|
223
|
-
return false;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
226
|
-
ca.pop();
|
|
227
|
-
cb.pop();
|
|
228
|
-
return true;
|
|
229
|
-
}
|
|
230
|
-
export function orderProperties(properties, order) {
|
|
231
|
-
if (!Array.isArray(order) || !order.length) {
|
|
232
|
-
return properties;
|
|
233
|
-
}
|
|
234
|
-
const arrayToHash = (arr)=>arr.reduce((prev, curr)=>{
|
|
235
|
-
prev[curr] = true;
|
|
236
|
-
return prev;
|
|
237
|
-
}, {});
|
|
238
|
-
const errorPropList = (arr)=>arr.length > 1 ? `properties '${arr.join('\', \'')}'` : `property '${arr[0]}'`;
|
|
239
|
-
const propertyHash = arrayToHash(properties);
|
|
240
|
-
const orderFiltered = order.filter((prop)=>prop === '*' || propertyHash[prop]);
|
|
241
|
-
const orderHash = arrayToHash(orderFiltered);
|
|
242
|
-
const rest = properties.filter((prop)=>!orderHash[prop]);
|
|
243
|
-
const restIndex = orderFiltered.indexOf('*');
|
|
244
|
-
if (restIndex === -1) {
|
|
245
|
-
if (rest.length) {
|
|
246
|
-
throw new Error(`uiSchema order list does not contain ${errorPropList(rest)}`);
|
|
247
|
-
}
|
|
248
|
-
return orderFiltered;
|
|
249
|
-
}
|
|
250
|
-
if (restIndex !== orderFiltered.lastIndexOf('*')) {
|
|
251
|
-
throw new Error('uiSchema order list contains more than one wildcard item');
|
|
252
|
-
}
|
|
253
|
-
const complete = [
|
|
254
|
-
...orderFiltered
|
|
255
|
-
];
|
|
256
|
-
complete.splice(restIndex, 1, ...rest);
|
|
257
|
-
return complete;
|
|
258
|
-
}
|
|
259
|
-
export function upperFirstLetter(str) {
|
|
260
|
-
if (!str) return str;
|
|
261
|
-
return `${str.slice(0, 1).toUpperCase()}${str.slice(1)}`;
|
|
262
|
-
}
|
|
263
|
-
export const getCookie = (name)=>{
|
|
264
|
-
const cookies = document.cookie.split(';');
|
|
265
|
-
for(let i = 0; i < cookies.length; i++){
|
|
266
|
-
const cookie = cookies[i];
|
|
267
|
-
const [key, value] = cookie.split('=');
|
|
268
|
-
if (key.trim() === name) {
|
|
269
|
-
return value;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
return null;
|
|
273
|
-
};
|
|
274
|
-
export function capitalizeFirstLetter(string) {
|
|
275
|
-
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
276
|
-
}
|