cnhis-design-vue 3.1.15-beta.1 → 3.1.15-beta.10
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/es/packages/annotation-edit/src/AnnotationEdit.js +2 -1
- package/es/packages/big-table/index.d.ts +8 -11
- package/es/packages/big-table/src/BigTable.vue.d.ts +24 -19
- package/es/packages/big-table/src/BigTable.vue_vue_type_script_setup_true_lang.js +17 -11
- package/es/packages/big-table/src/bigTableProps.d.ts +4 -3
- package/es/packages/big-table/src/bigTableProps.js +1 -1
- package/es/packages/big-table/src/components/edit-form/edit-date.js +2 -1
- package/es/packages/big-table/src/components/edit-form/edit-select.js +2 -1
- package/es/packages/big-table/src/components/edit-form/edit-separate.js +8 -1
- package/es/packages/big-table/src/components/edit-form/edit-separate.vue.d.ts +2 -1
- package/es/packages/big-table/src/hooks/useAnnotation.d.ts +4 -0
- package/es/packages/big-table/src/hooks/useAnnotation.js +21 -0
- package/es/packages/big-table/src/hooks/useColumnConfigAdaptor.js +7 -2
- package/es/packages/big-table/src/hooks/useEdit.d.ts +2 -1
- package/es/packages/big-table/style/index.css +27 -1
- package/es/packages/bpmn-workflow/src/BpmnWorkflow.js +2 -2
- package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/BpmnRenderer.js +8 -8
- package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomContextPadProvider.js +2 -2
- package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomPalette.js +1 -1
- package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomRenderer.js +4 -3
- package/es/packages/bpmn-workflow/src/custom/customModeler/customBpmn/CustomRules.js +2 -2
- package/es/packages/bpmn-workflow/src/custom/customModeler/index.js +1 -1
- package/es/packages/bpmn-workflow/src/custom/customOtherModule/CustomPopupMenu.js +2 -2
- package/es/packages/bpmn-workflow/src/custom/customOtherModule/zoomScroll.js +3 -3
- package/es/packages/button-print/src/utils/print.d.ts +1 -1
- package/es/packages/button-print/src/utils/print.js +1 -1
- package/es/packages/fabric-chart/index.d.ts +1 -0
- package/es/packages/fabric-chart/src/FabricChart.js +17 -17
- package/es/packages/fabric-chart/src/FabricChart.vue.d.ts +12 -10
- package/es/packages/fabric-chart/src/hooks/useCenter.js +7 -5
- package/es/packages/fabric-chart/src/hooks/useCumputedPoint.js +4 -2
- package/es/packages/fabric-chart/src/hooks/useDraw.js +1 -0
- package/es/packages/fabric-chart/src/hooks/useLeft.js +5 -4
- package/es/packages/field-set/index.d.ts +4365 -0
- package/es/packages/field-set/src/FieldSet.js +53 -54
- package/es/packages/field-set/src/FieldSet.vue.d.ts +4365 -0
- package/es/packages/field-set/style/index.css +0 -9
- package/es/packages/form-config/index.d.ts +12111 -0
- package/es/packages/form-config/index.js +10 -0
- package/es/packages/form-config/src/FormConfig.js +113 -0
- package/es/packages/form-config/src/FormConfig.vue.d.ts +12113 -0
- package/es/packages/form-config/src/components/FormConfigCreator.js +97 -0
- package/es/packages/form-config/src/components/FormConfigCreator.vue.d.ts +5094 -0
- package/es/packages/form-config/src/components/FormConfigEdit.js +81 -0
- package/es/packages/form-config/src/components/FormConfigEdit.vue.d.ts +3591 -0
- package/es/packages/form-config/src/constants/index.d.ts +28 -0
- package/es/packages/form-config/src/constants/index.js +28 -0
- package/es/packages/form-config/src/hooks/index.d.ts +2 -0
- package/es/packages/form-config/src/hooks/index.js +2 -0
- package/es/packages/form-config/src/hooks/useConfigurationField.d.ts +6 -0
- package/es/packages/form-config/src/hooks/useConfigurationField.js +103 -0
- package/es/packages/form-config/src/hooks/usePresetRenderer.d.ts +5 -0
- package/es/packages/form-config/src/hooks/usePresetRenderer.js +117 -0
- package/es/packages/form-config/src/hooks/useSortable.d.ts +11 -0
- package/es/packages/form-config/src/hooks/useSortable.js +31 -0
- package/es/packages/form-config/src/types/index.d.ts +18 -0
- package/es/packages/form-config/src/types/index.js +1 -0
- package/es/packages/form-config/style/index.css +108 -0
- package/es/packages/form-render/index.d.ts +24 -3
- package/es/packages/form-render/src/FormRender.js +10 -6
- package/es/packages/form-render/src/FormRender.vue.d.ts +24 -3
- package/es/packages/form-render/src/components/renderer/cascader.js +7 -7
- package/es/packages/form-render/src/components/renderer/combination/hooks/useDeepValidate.d.ts +5 -0
- package/es/packages/form-render/src/components/renderer/combination/hooks/useDeepValidate.js +32 -0
- package/es/packages/form-render/src/components/renderer/{combination.d.ts → combination/index.d.ts} +7 -1
- package/es/packages/form-render/src/components/renderer/combination/index.js +157 -0
- package/es/packages/form-render/src/components/renderer/complex.d.ts +2 -0
- package/es/packages/form-render/src/components/renderer/complex.js +2 -5
- package/es/packages/form-render/src/components/renderer/date.d.ts +29 -0
- package/es/packages/form-render/src/components/renderer/date.js +63 -56
- package/es/packages/form-render/src/components/renderer/formItem.js +3 -3
- package/es/packages/form-render/src/components/renderer/index.js +1 -1
- package/es/packages/form-render/src/components/renderer/radio.js +4 -1
- package/es/packages/form-render/src/components/renderer/select.d.ts +9 -0
- package/es/packages/form-render/src/components/renderer/select.js +28 -17
- package/es/packages/form-render/src/constants/index.d.ts +2 -1
- package/es/packages/form-render/src/hooks/useAnchor.d.ts +7 -6
- package/es/packages/form-render/src/hooks/useAnchor.js +1 -2
- package/es/packages/form-render/src/hooks/useAsyncQueue.d.ts +6 -1
- package/es/packages/form-render/src/hooks/useAsyncQueue.js +12 -7
- package/es/packages/form-render/src/hooks/useCommonInjection.d.ts +6 -0
- package/es/packages/form-render/src/hooks/useCommonInjection.js +19 -0
- package/es/packages/form-render/src/hooks/useFieldListAdaptor.js +4 -5
- package/es/packages/form-render/src/hooks/useFormContext.d.ts +3 -3
- package/es/packages/form-render/src/hooks/useFormContext.js +21 -3
- package/es/packages/form-render/src/hooks/useFormRenderLifeCycle.d.ts +13 -0
- package/es/packages/form-render/src/hooks/useFormRenderLifeCycle.js +10 -0
- package/es/packages/form-render/src/types/fieldItem.d.ts +16 -0
- package/es/packages/form-render/src/types/index.d.ts +30 -2
- package/es/packages/form-render/src/utils/index.d.ts +7 -5
- package/es/packages/form-render/src/utils/index.js +59 -11
- package/es/packages/form-render/style/index.css +11 -10
- package/es/packages/form-table/src/hooks/useNuiThemeOverrides.js +1 -1
- package/es/packages/index.css +147 -21
- package/es/packages/index.d.ts +3 -1
- package/es/packages/index.js +4 -1
- package/es/packages/info-header/index.d.ts +1 -3
- package/es/packages/info-header/src/HiddenContent.js +1 -1
- package/es/packages/info-header/src/HiddenContent.vue.d.ts +1 -3
- package/es/packages/info-header/src/InfoHeader.vue.d.ts +1 -3
- package/es/packages/info-header/style/index.css +1 -1
- package/es/packages/shortcut-provider/index.d.ts +2 -11
- package/es/packages/shortcut-provider/src/ShortcutProvider.js +1 -5
- package/es/packages/shortcut-provider/src/ShortcutProvider.vue.d.ts +2 -11
- package/es/packages/shortcut-provider/src/hooks/useShortcuts.d.ts +11 -8
- package/es/packages/shortcut-provider/src/hooks/useShortcuts.js +44 -28
- package/es/packages/shortcut-provider/src/types/index.d.ts +32 -4
- package/es/packages/shortcut-provider/src/utils/index.d.ts +3 -0
- package/es/packages/shortcut-provider/src/utils/index.js +15 -5
- package/es/packages/shortcut-setter/index.d.ts +32 -9
- package/es/packages/shortcut-setter/src/ShortcutSetter.vue.d.ts +32 -9
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.js +8 -6
- package/es/packages/shortcut-setter/src/ShortcutSetterItem.vue.d.ts +8 -6
- package/es/src/utils/state.d.ts +29 -0
- package/es/src/utils/state.js +44 -0
- package/package.json +10 -1
- package/es/_virtual/_commonjsHelpers.js +0 -7
- package/es/_virtual/css.escape.js +0 -3
- package/es/_virtual/inherits.js +0 -3
- package/es/_virtual/inherits_browser.js +0 -3
- package/es/node_modules/@formily/path/esm/contexts.js +0 -22
- package/es/node_modules/@formily/path/esm/destructor.js +0 -124
- package/es/node_modules/@formily/path/esm/index.js +0 -579
- package/es/node_modules/@formily/path/esm/matcher.js +0 -199
- package/es/node_modules/@formily/path/esm/parser.js +0 -402
- package/es/node_modules/@formily/path/esm/shared.js +0 -73
- package/es/node_modules/@formily/path/esm/tokenizer.js +0 -287
- package/es/node_modules/@formily/path/esm/tokens.js +0 -240
- package/es/node_modules/@formily/path/esm/types.js +0 -17
- package/es/node_modules/css.escape/css.escape.js +0 -110
- package/es/node_modules/date-fns/esm/_lib/defaultOptions/index.js +0 -6
- package/es/node_modules/date-fns/esm/_lib/getTimezoneOffsetInMilliseconds/index.js +0 -18
- package/es/node_modules/date-fns/esm/_lib/getUTCISOWeek/index.js +0 -17
- package/es/node_modules/date-fns/esm/_lib/getUTCISOWeekYear/index.js +0 -27
- package/es/node_modules/date-fns/esm/_lib/getUTCWeek/index.js +0 -17
- package/es/node_modules/date-fns/esm/_lib/getUTCWeekYear/index.js +0 -38
- package/es/node_modules/date-fns/esm/_lib/requiredArgs/index.js +0 -7
- package/es/node_modules/date-fns/esm/_lib/setUTCDay/index.js +0 -27
- package/es/node_modules/date-fns/esm/_lib/setUTCISODay/index.js +0 -23
- package/es/node_modules/date-fns/esm/_lib/setUTCISOWeek/index.js +0 -15
- package/es/node_modules/date-fns/esm/_lib/setUTCWeek/index.js +0 -15
- package/es/node_modules/date-fns/esm/_lib/startOfUTCISOWeek/index.js +0 -15
- package/es/node_modules/date-fns/esm/_lib/startOfUTCISOWeekYear/index.js +0 -15
- package/es/node_modules/date-fns/esm/_lib/startOfUTCWeek/index.js +0 -25
- package/es/node_modules/date-fns/esm/_lib/startOfUTCWeekYear/index.js +0 -21
- package/es/node_modules/date-fns/esm/_lib/toInteger/index.js +0 -15
- package/es/node_modules/date-fns/esm/compareAsc/index.js +0 -52
- package/es/node_modules/date-fns/esm/constants/index.js +0 -40
- package/es/node_modules/date-fns/esm/differenceInCalendarDays/index.js +0 -49
- package/es/node_modules/date-fns/esm/differenceInCalendarMonths/index.js +0 -35
- package/es/node_modules/date-fns/esm/differenceInCalendarYears/index.js +0 -33
- package/es/node_modules/date-fns/esm/differenceInDays/index.js +0 -86
- package/es/node_modules/date-fns/esm/differenceInMonths/index.js +0 -59
- package/es/node_modules/date-fns/esm/differenceInYears/index.js +0 -43
- package/es/node_modules/date-fns/esm/endOfDay/index.js +0 -30
- package/es/node_modules/date-fns/esm/endOfMonth/index.js +0 -32
- package/es/node_modules/date-fns/esm/isLastDayOfMonth/index.js +0 -30
- package/es/node_modules/date-fns/esm/parse/_lib/Parser.js +0 -32
- package/es/node_modules/date-fns/esm/parse/_lib/Setter.js +0 -37
- package/es/node_modules/date-fns/esm/parse/_lib/constants.js +0 -48
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/AMPMMidnightParser.js +0 -55
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/AMPMParser.js +0 -55
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/DateParser.js +0 -55
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/DayOfYearParser.js +0 -52
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/DayParser.js +0 -80
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/DayPeriodParser.js +0 -56
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/EraParser.js +0 -53
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/ExtendedYearParser.js +0 -30
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/FractionOfSecondParser.js +0 -29
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour0To11Parser.js +0 -48
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour0to23Parser.js +0 -41
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour1To24Parser.js +0 -42
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/Hour1to12Parser.js +0 -50
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISODayParser.js +0 -99
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneParser.js +0 -46
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOTimezoneWithZParser.js +0 -46
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekParser.js +0 -43
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/ISOWeekYearParser.js +0 -33
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/LocalDayParser.js +0 -96
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekParser.js +0 -43
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/LocalWeekYearParser.js +0 -61
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/MinuteParser.js +0 -41
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/MonthParser.js +0 -80
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/QuarterParser.js +0 -73
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/SecondParser.js +0 -41
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/StandAloneLocalDayParser.js +0 -96
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/StandAloneMonthParser.js +0 -80
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/StandAloneQuarterParser.js +0 -73
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/TimestampMillisecondsParser.js +0 -26
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/TimestampSecondsParser.js +0 -26
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/YearParser.js +0 -66
- package/es/node_modules/date-fns/esm/parse/_lib/parsers/index.js +0 -109
- package/es/node_modules/date-fns/esm/parse/_lib/utils.js +0 -133
- package/es/node_modules/date-fns/esm/startOfDay/index.js +0 -30
- package/es/node_modules/date-fns/esm/toDate/index.js +0 -55
- package/es/node_modules/diagram-js/lib/command/CommandInterceptor.js +0 -139
- package/es/node_modules/diagram-js/lib/draw/BaseRenderer.js +0 -88
- package/es/node_modules/diagram-js/lib/features/popup-menu/PopupMenu.js +0 -591
- package/es/node_modules/diagram-js/lib/features/rules/RuleProvider.js +0 -88
- package/es/node_modules/diagram-js/lib/navigation/movecanvas/MoveCanvas.js +0 -120
- package/es/node_modules/diagram-js/lib/navigation/movecanvas/index.js +0 -8
- package/es/node_modules/diagram-js/lib/navigation/zoomscroll/ZoomScroll.js +0 -227
- package/es/node_modules/diagram-js/lib/navigation/zoomscroll/ZoomUtil.js +0 -24
- package/es/node_modules/diagram-js/lib/util/ClickTrap.js +0 -23
- package/es/node_modules/diagram-js/lib/util/Cursor.js +0 -20
- package/es/node_modules/diagram-js/lib/util/Event.js +0 -22
- package/es/node_modules/diagram-js/lib/util/Math.js +0 -9
- package/es/node_modules/diagram-js/lib/util/Mouse.js +0 -30
- package/es/node_modules/diagram-js/lib/util/Platform.js +0 -5
- package/es/node_modules/diagram-js/lib/util/PositionUtil.js +0 -8
- package/es/node_modules/diagram-js/lib/util/RenderUtil.js +0 -25
- package/es/node_modules/diagram-js/lib/util/SvgTransformUtil.js +0 -48
- package/es/node_modules/ids/dist/index.esm.js +0 -164
- package/es/node_modules/inherits/inherits.js +0 -19
- package/es/node_modules/inherits/inherits_browser.js +0 -38
- package/es/node_modules/inherits-browser/dist/index.es.js +0 -3
- package/es/node_modules/min-dash/dist/index.esm.js +0 -169
- package/es/node_modules/min-dom/dist/index.esm.js +0 -588
- package/es/node_modules/tiny-svg/dist/index.esm.js +0 -525
- package/es/packages/form-render/src/components/renderer/combination.js +0 -168
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
import { isWildcardOperator, isExpandOperator, isDotOperator, isIdentifier, isIgnoreExpression, isDestructorExpression, isGroupExpression, isRangeExpression } from './types.js';
|
|
2
|
-
import { isEqual, toArr, isSegmentEqual } from './shared.js';
|
|
3
|
-
|
|
4
|
-
var Matcher = /** @class */ (function () {
|
|
5
|
-
function Matcher(tree, record) {
|
|
6
|
-
this.tree = tree;
|
|
7
|
-
this.stack = [];
|
|
8
|
-
this.excluding = false;
|
|
9
|
-
this.wildcards = [];
|
|
10
|
-
this.record = record;
|
|
11
|
-
}
|
|
12
|
-
Matcher.prototype.next = function (node, pos) {
|
|
13
|
-
var isLastToken = pos === this.path.length - 1;
|
|
14
|
-
// const isOverToken = pos > this.path.length
|
|
15
|
-
if (node.after) {
|
|
16
|
-
// if (isOverToken) {
|
|
17
|
-
// return false
|
|
18
|
-
// }
|
|
19
|
-
return this.matchNode(node.after, pos);
|
|
20
|
-
}
|
|
21
|
-
if (isWildcardOperator(node) && !node.filter) {
|
|
22
|
-
if (this.excluding) {
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
if (pos === 0 || node.optional)
|
|
27
|
-
return true;
|
|
28
|
-
return !!this.take(pos);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
if (isLastToken) {
|
|
32
|
-
return !!this.take(pos);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
var wildcard = this.wildcards.pop();
|
|
36
|
-
if (wildcard && wildcard.after) {
|
|
37
|
-
return this.next(wildcard, pos);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return false;
|
|
41
|
-
};
|
|
42
|
-
Matcher.prototype.shot = function () {
|
|
43
|
-
var _a;
|
|
44
|
-
if (((_a = this.record) === null || _a === void 0 ? void 0 : _a.score) >= 0) {
|
|
45
|
-
this.record.score++;
|
|
46
|
-
}
|
|
47
|
-
};
|
|
48
|
-
Matcher.prototype.take = function (pos) {
|
|
49
|
-
var _a;
|
|
50
|
-
return String((_a = this.path[pos]) !== null && _a !== void 0 ? _a : '');
|
|
51
|
-
};
|
|
52
|
-
Matcher.prototype.matchExcludeIdentifier = function (matched, node, pos) {
|
|
53
|
-
var isLastToken = pos === this.path.length - 1;
|
|
54
|
-
var isContainToken = pos < this.path.length;
|
|
55
|
-
if (!node.after) {
|
|
56
|
-
this.excluding = false;
|
|
57
|
-
}
|
|
58
|
-
if (matched) {
|
|
59
|
-
if (node.after) {
|
|
60
|
-
return this.next(node, pos);
|
|
61
|
-
}
|
|
62
|
-
if (isLastToken) {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (isLastToken) {
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
return isContainToken;
|
|
70
|
-
};
|
|
71
|
-
Matcher.prototype.matchIdentifier = function (node, pos) {
|
|
72
|
-
var current = this.take(pos);
|
|
73
|
-
var matched = false;
|
|
74
|
-
if (isExpandOperator(node.after)) {
|
|
75
|
-
if (current.indexOf(node.value) === 0) {
|
|
76
|
-
this.shot();
|
|
77
|
-
matched = true;
|
|
78
|
-
}
|
|
79
|
-
if (this.excluding) {
|
|
80
|
-
return this.matchExcludeIdentifier(matched, node.after, pos);
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
return matched && this.next(node.after, pos);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
else if (current === node.value) {
|
|
87
|
-
this.shot();
|
|
88
|
-
matched = true;
|
|
89
|
-
}
|
|
90
|
-
if (this.excluding) {
|
|
91
|
-
return this.matchExcludeIdentifier(matched, node, pos);
|
|
92
|
-
}
|
|
93
|
-
else {
|
|
94
|
-
return matched && this.next(node, pos);
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
Matcher.prototype.matchIgnoreExpression = function (node, pos) {
|
|
98
|
-
return isEqual(node.value, this.take(pos)) && this.next(node, pos);
|
|
99
|
-
};
|
|
100
|
-
Matcher.prototype.matchDestructorExpression = function (node, pos) {
|
|
101
|
-
return isEqual(node.source, this.take(pos)) && this.next(node, pos);
|
|
102
|
-
};
|
|
103
|
-
Matcher.prototype.matchExpandOperator = function (node, pos) {
|
|
104
|
-
return this.next(node, pos);
|
|
105
|
-
};
|
|
106
|
-
Matcher.prototype.matchWildcardOperator = function (node, pos) {
|
|
107
|
-
var matched = false;
|
|
108
|
-
if (node.filter) {
|
|
109
|
-
this.stack.push(node);
|
|
110
|
-
matched = this.matchNode(node.filter, pos);
|
|
111
|
-
this.stack.pop();
|
|
112
|
-
}
|
|
113
|
-
else {
|
|
114
|
-
matched = this.next(node, pos);
|
|
115
|
-
}
|
|
116
|
-
return matched;
|
|
117
|
-
};
|
|
118
|
-
Matcher.prototype.matchGroupExpression = function (node, pos) {
|
|
119
|
-
var _this = this;
|
|
120
|
-
var excluding = false;
|
|
121
|
-
if (node.isExclude) {
|
|
122
|
-
excluding = !this.excluding;
|
|
123
|
-
}
|
|
124
|
-
return toArr(node.value)[excluding ? 'every' : 'some'](function (item) {
|
|
125
|
-
_this.wildcards = _this.stack.slice();
|
|
126
|
-
_this.excluding = excluding;
|
|
127
|
-
return _this.matchNode(item, pos);
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
Matcher.prototype.matchRangeExpression = function (node, pos) {
|
|
131
|
-
var current = Number(this.take(pos));
|
|
132
|
-
if (node.start) {
|
|
133
|
-
if (node.end) {
|
|
134
|
-
return (current >= Number(node.start.value) &&
|
|
135
|
-
current <= Number(node.end.value));
|
|
136
|
-
}
|
|
137
|
-
else {
|
|
138
|
-
return current >= Number(node.start.value);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
if (node.end) {
|
|
143
|
-
return current <= Number(node.end.value);
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
this.wildcards = this.stack.slice();
|
|
147
|
-
return this.next(node, pos);
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
Matcher.prototype.matchNode = function (node, pos) {
|
|
152
|
-
if (pos === void 0) { pos = 0; }
|
|
153
|
-
if (isDotOperator(node)) {
|
|
154
|
-
return this.next(node, pos + 1);
|
|
155
|
-
}
|
|
156
|
-
else if (isIdentifier(node)) {
|
|
157
|
-
return this.matchIdentifier(node, pos);
|
|
158
|
-
}
|
|
159
|
-
else if (isIgnoreExpression(node)) {
|
|
160
|
-
return this.matchIgnoreExpression(node, pos);
|
|
161
|
-
}
|
|
162
|
-
else if (isDestructorExpression(node)) {
|
|
163
|
-
return this.matchDestructorExpression(node, pos);
|
|
164
|
-
}
|
|
165
|
-
else if (isExpandOperator(node)) {
|
|
166
|
-
return this.matchExpandOperator(node, pos);
|
|
167
|
-
}
|
|
168
|
-
else if (isWildcardOperator(node)) {
|
|
169
|
-
return this.matchWildcardOperator(node, pos);
|
|
170
|
-
}
|
|
171
|
-
else if (isGroupExpression(node)) {
|
|
172
|
-
return this.matchGroupExpression(node, pos);
|
|
173
|
-
}
|
|
174
|
-
else if (isRangeExpression(node)) {
|
|
175
|
-
return this.matchRangeExpression(node, pos);
|
|
176
|
-
}
|
|
177
|
-
return false;
|
|
178
|
-
};
|
|
179
|
-
Matcher.prototype.match = function (path) {
|
|
180
|
-
this.path = path;
|
|
181
|
-
return { matched: this.matchNode(this.tree), record: this.record };
|
|
182
|
-
};
|
|
183
|
-
Matcher.matchSegments = function (source, target, record) {
|
|
184
|
-
if (source.length !== target.length)
|
|
185
|
-
return { matched: false, record: record };
|
|
186
|
-
var match = function (pos) {
|
|
187
|
-
if (pos === void 0) { pos = 0; }
|
|
188
|
-
var current = isSegmentEqual(source[pos], target[pos]);
|
|
189
|
-
if ((record === null || record === void 0 ? void 0 : record.score) >= 0) {
|
|
190
|
-
record.score++;
|
|
191
|
-
}
|
|
192
|
-
return current && (pos < source.length - 1 ? match(pos + 1) : true);
|
|
193
|
-
};
|
|
194
|
-
return { matched: match(), record: record };
|
|
195
|
-
};
|
|
196
|
-
return Matcher;
|
|
197
|
-
}());
|
|
198
|
-
|
|
199
|
-
export { Matcher };
|
|
@@ -1,402 +0,0 @@
|
|
|
1
|
-
import { Tokenizer } from './tokenizer.js';
|
|
2
|
-
import { eofTok, dotTok, bracketDLTok, starTok, dbStarTok, expandTok, nameTok, bracketLTok, braceLTok, bracketRTok, parenLTok, braceRTok, colonTok, parenRTok, bangTok, commaTok } from './tokens.js';
|
|
3
|
-
import { destructorContext, bracketArrayContext } from './contexts.js';
|
|
4
|
-
import { setDestructor, parseDestructorRules } from './destructor.js';
|
|
5
|
-
import { isNumberLike } from './shared.js';
|
|
6
|
-
|
|
7
|
-
var __extends = (undefined && undefined.__extends) || (function () {
|
|
8
|
-
var extendStatics = function (d, b) {
|
|
9
|
-
extendStatics = Object.setPrototypeOf ||
|
|
10
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
11
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
12
|
-
return extendStatics(d, b);
|
|
13
|
-
};
|
|
14
|
-
return function (d, b) {
|
|
15
|
-
if (typeof b !== "function" && b !== null)
|
|
16
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
17
|
-
extendStatics(d, b);
|
|
18
|
-
function __() { this.constructor = d; }
|
|
19
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
20
|
-
};
|
|
21
|
-
})();
|
|
22
|
-
var createTreeBySegments = function (segments, afterNode) {
|
|
23
|
-
if (segments === void 0) { segments = []; }
|
|
24
|
-
var segLen = segments.length;
|
|
25
|
-
var build = function (start) {
|
|
26
|
-
if (start === void 0) { start = 0; }
|
|
27
|
-
var after = start < segLen - 1 ? build(start + 1) : afterNode;
|
|
28
|
-
var dot = after && {
|
|
29
|
-
type: 'DotOperator',
|
|
30
|
-
after: after,
|
|
31
|
-
};
|
|
32
|
-
return {
|
|
33
|
-
type: 'Identifier',
|
|
34
|
-
value: segments[start],
|
|
35
|
-
after: dot,
|
|
36
|
-
};
|
|
37
|
-
};
|
|
38
|
-
return build();
|
|
39
|
-
};
|
|
40
|
-
var calculate = function (a, b, operator) {
|
|
41
|
-
if (isNumberLike(a) && isNumberLike(b)) {
|
|
42
|
-
if (operator === '+')
|
|
43
|
-
return String(Number(a) + Number(b));
|
|
44
|
-
if (operator === '-')
|
|
45
|
-
return String(Number(a) - Number(b));
|
|
46
|
-
if (operator === '*')
|
|
47
|
-
return String(Number(a) * Number(b));
|
|
48
|
-
if (operator === '/')
|
|
49
|
-
return String(Number(a) / Number(b));
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
if (operator === '+')
|
|
53
|
-
return String(a) + String(b);
|
|
54
|
-
if (operator === '-')
|
|
55
|
-
return 'NaN';
|
|
56
|
-
if (operator === '*')
|
|
57
|
-
return 'NaN';
|
|
58
|
-
if (operator === '/')
|
|
59
|
-
return 'NaN';
|
|
60
|
-
}
|
|
61
|
-
return String(Number(b));
|
|
62
|
-
};
|
|
63
|
-
var Parser = /** @class */ (function (_super) {
|
|
64
|
-
__extends(Parser, _super);
|
|
65
|
-
function Parser(input, base) {
|
|
66
|
-
var _this = _super.call(this, input) || this;
|
|
67
|
-
_this.isMatchPattern = false;
|
|
68
|
-
_this.isWildMatchPattern = false;
|
|
69
|
-
_this.haveExcludePattern = false;
|
|
70
|
-
_this.haveRelativePattern = false;
|
|
71
|
-
_this.base = base;
|
|
72
|
-
return _this;
|
|
73
|
-
}
|
|
74
|
-
Parser.prototype.parse = function () {
|
|
75
|
-
var node;
|
|
76
|
-
this.data = {
|
|
77
|
-
segments: [],
|
|
78
|
-
};
|
|
79
|
-
if (!this.eat(eofTok)) {
|
|
80
|
-
this.next();
|
|
81
|
-
node = this.parseAtom(this.state.type);
|
|
82
|
-
}
|
|
83
|
-
this.data.tree = node;
|
|
84
|
-
return node;
|
|
85
|
-
};
|
|
86
|
-
Parser.prototype.append = function (parent, node) {
|
|
87
|
-
if (parent && node) {
|
|
88
|
-
parent.after = node;
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
Parser.prototype.parseAtom = function (type) {
|
|
92
|
-
switch (type) {
|
|
93
|
-
case braceLTok:
|
|
94
|
-
case bracketLTok:
|
|
95
|
-
if (this.includesContext(destructorContext)) {
|
|
96
|
-
if (type === braceLTok) {
|
|
97
|
-
return this.parseObjectPattern();
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
return this.parseArrayPattern();
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return this.parseDestructorExpression();
|
|
104
|
-
case nameTok:
|
|
105
|
-
return this.parseIdentifier();
|
|
106
|
-
case expandTok:
|
|
107
|
-
return this.parseExpandOperator();
|
|
108
|
-
case dbStarTok:
|
|
109
|
-
case starTok:
|
|
110
|
-
return this.parseWildcardOperator();
|
|
111
|
-
case bracketDLTok:
|
|
112
|
-
return this.parseIgnoreExpression();
|
|
113
|
-
case dotTok:
|
|
114
|
-
return this.parseDotOperator();
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
Parser.prototype.pushSegments = function (key) {
|
|
118
|
-
this.data.segments.push(key);
|
|
119
|
-
};
|
|
120
|
-
Parser.prototype.parseIdentifier = function () {
|
|
121
|
-
var node = {
|
|
122
|
-
type: 'Identifier',
|
|
123
|
-
value: this.state.value,
|
|
124
|
-
};
|
|
125
|
-
var hasNotInDestructor = !this.includesContext(destructorContext) &&
|
|
126
|
-
!this.isMatchPattern &&
|
|
127
|
-
!this.isWildMatchPattern;
|
|
128
|
-
this.next();
|
|
129
|
-
if (this.includesContext(bracketArrayContext)) {
|
|
130
|
-
if (this.state.type !== bracketRTok) {
|
|
131
|
-
throw this.unexpect();
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
this.state.context.pop();
|
|
135
|
-
this.next();
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
else if (hasNotInDestructor) {
|
|
139
|
-
this.pushSegments(node.value);
|
|
140
|
-
}
|
|
141
|
-
if (this.state.type === bracketLTok) {
|
|
142
|
-
this.next();
|
|
143
|
-
if (this.state.type !== nameTok) {
|
|
144
|
-
throw this.unexpect();
|
|
145
|
-
}
|
|
146
|
-
this.state.context.push(bracketArrayContext);
|
|
147
|
-
var isNumberKey = false;
|
|
148
|
-
if (/^\d+$/.test(this.state.value)) {
|
|
149
|
-
isNumberKey = true;
|
|
150
|
-
}
|
|
151
|
-
var value = this.state.value;
|
|
152
|
-
this.pushSegments(isNumberKey ? Number(value) : value);
|
|
153
|
-
var after = this.parseAtom(this.state.type);
|
|
154
|
-
if (isNumberKey) {
|
|
155
|
-
after.arrayIndex = true;
|
|
156
|
-
}
|
|
157
|
-
this.append(node, after);
|
|
158
|
-
}
|
|
159
|
-
else {
|
|
160
|
-
this.append(node, this.parseAtom(this.state.type));
|
|
161
|
-
}
|
|
162
|
-
return node;
|
|
163
|
-
};
|
|
164
|
-
Parser.prototype.parseExpandOperator = function () {
|
|
165
|
-
var node = {
|
|
166
|
-
type: 'ExpandOperator',
|
|
167
|
-
};
|
|
168
|
-
this.isMatchPattern = true;
|
|
169
|
-
this.isWildMatchPattern = true;
|
|
170
|
-
this.data.segments = [];
|
|
171
|
-
this.next();
|
|
172
|
-
this.append(node, this.parseAtom(this.state.type));
|
|
173
|
-
return node;
|
|
174
|
-
};
|
|
175
|
-
Parser.prototype.parseWildcardOperator = function () {
|
|
176
|
-
var node = {
|
|
177
|
-
type: 'WildcardOperator',
|
|
178
|
-
};
|
|
179
|
-
if (this.state.type === dbStarTok) {
|
|
180
|
-
node.optional = true;
|
|
181
|
-
}
|
|
182
|
-
this.isMatchPattern = true;
|
|
183
|
-
this.isWildMatchPattern = true;
|
|
184
|
-
this.data.segments = [];
|
|
185
|
-
this.next();
|
|
186
|
-
if (this.state.type === parenLTok) {
|
|
187
|
-
node.filter = this.parseGroupExpression(node);
|
|
188
|
-
}
|
|
189
|
-
else if (this.state.type === bracketLTok) {
|
|
190
|
-
node.filter = this.parseRangeExpression(node);
|
|
191
|
-
}
|
|
192
|
-
this.append(node, this.parseAtom(this.state.type));
|
|
193
|
-
return node;
|
|
194
|
-
};
|
|
195
|
-
Parser.prototype.parseDestructorExpression = function () {
|
|
196
|
-
var _this = this;
|
|
197
|
-
var node = {
|
|
198
|
-
type: 'DestructorExpression',
|
|
199
|
-
};
|
|
200
|
-
this.state.context.push(destructorContext);
|
|
201
|
-
var startPos = this.state.pos - 1;
|
|
202
|
-
node.value =
|
|
203
|
-
this.state.type === braceLTok
|
|
204
|
-
? this.parseObjectPattern()
|
|
205
|
-
: this.parseArrayPattern();
|
|
206
|
-
var endPos = this.state.pos;
|
|
207
|
-
this.state.context.pop();
|
|
208
|
-
node.source = this.input
|
|
209
|
-
.substring(startPos, endPos)
|
|
210
|
-
.replace(/\[\s*([\+\-\*\/])?\s*([^,\]\s]*)\s*\]/, function (match, operator, target) {
|
|
211
|
-
if (_this.relative !== undefined) {
|
|
212
|
-
if (operator) {
|
|
213
|
-
if (target) {
|
|
214
|
-
return calculate(_this.relative, target, operator);
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
return calculate(_this.relative, 1, operator);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
if (target) {
|
|
222
|
-
return calculate(_this.relative, target, '+');
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
return String(_this.relative);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
return match;
|
|
230
|
-
})
|
|
231
|
-
.replace(/\s*\.\s*/g, '')
|
|
232
|
-
.replace(/\s*/g, '');
|
|
233
|
-
if (this.relative === undefined) {
|
|
234
|
-
setDestructor(node.source, parseDestructorRules(node));
|
|
235
|
-
}
|
|
236
|
-
this.relative = undefined;
|
|
237
|
-
this.pushSegments(node.source);
|
|
238
|
-
this.next();
|
|
239
|
-
this.append(node, this.parseAtom(this.state.type));
|
|
240
|
-
return node;
|
|
241
|
-
};
|
|
242
|
-
Parser.prototype.parseArrayPattern = function () {
|
|
243
|
-
var node = {
|
|
244
|
-
type: 'ArrayPattern',
|
|
245
|
-
elements: [],
|
|
246
|
-
};
|
|
247
|
-
this.next();
|
|
248
|
-
node.elements = this.parseArrayPatternElements();
|
|
249
|
-
return node;
|
|
250
|
-
};
|
|
251
|
-
Parser.prototype.parseArrayPatternElements = function () {
|
|
252
|
-
var nodes = [];
|
|
253
|
-
while (this.state.type !== bracketRTok && this.state.type !== eofTok) {
|
|
254
|
-
nodes.push(this.parseAtom(this.state.type));
|
|
255
|
-
if (this.state.type === bracketRTok) {
|
|
256
|
-
if (this.includesContext(destructorContext)) {
|
|
257
|
-
this.next();
|
|
258
|
-
}
|
|
259
|
-
return nodes;
|
|
260
|
-
}
|
|
261
|
-
this.next();
|
|
262
|
-
}
|
|
263
|
-
return nodes;
|
|
264
|
-
};
|
|
265
|
-
Parser.prototype.parseObjectPattern = function () {
|
|
266
|
-
var node = {
|
|
267
|
-
type: 'ObjectPattern',
|
|
268
|
-
properties: [],
|
|
269
|
-
};
|
|
270
|
-
this.next();
|
|
271
|
-
node.properties = this.parseObjectProperties();
|
|
272
|
-
return node;
|
|
273
|
-
};
|
|
274
|
-
Parser.prototype.parseObjectProperties = function () {
|
|
275
|
-
var nodes = [];
|
|
276
|
-
while (this.state.type !== braceRTok && this.state.type !== eofTok) {
|
|
277
|
-
var node = {
|
|
278
|
-
type: 'ObjectPatternProperty',
|
|
279
|
-
key: this.parseAtom(this.state.type),
|
|
280
|
-
};
|
|
281
|
-
nodes.push(node);
|
|
282
|
-
if (this.state.type === colonTok) {
|
|
283
|
-
this.next();
|
|
284
|
-
node.value = this.parseAtom(this.state.type);
|
|
285
|
-
}
|
|
286
|
-
if (this.state.type === braceRTok) {
|
|
287
|
-
if (this.includesContext(destructorContext)) {
|
|
288
|
-
this.next();
|
|
289
|
-
}
|
|
290
|
-
return nodes;
|
|
291
|
-
}
|
|
292
|
-
this.next();
|
|
293
|
-
}
|
|
294
|
-
return nodes;
|
|
295
|
-
};
|
|
296
|
-
Parser.prototype.parseDotOperator = function () {
|
|
297
|
-
var node = {
|
|
298
|
-
type: 'DotOperator',
|
|
299
|
-
};
|
|
300
|
-
var prevToken = this.type_;
|
|
301
|
-
if (!prevToken && this.base) {
|
|
302
|
-
if (this.base.isMatchPattern) {
|
|
303
|
-
throw new Error('Base path must be an absolute path.');
|
|
304
|
-
}
|
|
305
|
-
this.data.segments = this.base.toArr();
|
|
306
|
-
while (this.state.type === dotTok) {
|
|
307
|
-
this.relative = this.data.segments.pop();
|
|
308
|
-
this.haveRelativePattern = true;
|
|
309
|
-
this.next();
|
|
310
|
-
}
|
|
311
|
-
return createTreeBySegments(this.data.segments.slice(), this.parseAtom(this.state.type));
|
|
312
|
-
}
|
|
313
|
-
else {
|
|
314
|
-
this.next();
|
|
315
|
-
}
|
|
316
|
-
this.append(node, this.parseAtom(this.state.type));
|
|
317
|
-
return node;
|
|
318
|
-
};
|
|
319
|
-
Parser.prototype.parseIgnoreExpression = function () {
|
|
320
|
-
this.next();
|
|
321
|
-
var value = String(this.state.value).replace(/\s*/g, '');
|
|
322
|
-
var node = {
|
|
323
|
-
type: 'IgnoreExpression',
|
|
324
|
-
value: value,
|
|
325
|
-
};
|
|
326
|
-
this.pushSegments(value);
|
|
327
|
-
this.next();
|
|
328
|
-
this.append(node, this.parseAtom(this.state.type));
|
|
329
|
-
this.next();
|
|
330
|
-
return node;
|
|
331
|
-
};
|
|
332
|
-
Parser.prototype.parseGroupExpression = function (parent) {
|
|
333
|
-
var node = {
|
|
334
|
-
type: 'GroupExpression',
|
|
335
|
-
value: [],
|
|
336
|
-
};
|
|
337
|
-
this.isMatchPattern = true;
|
|
338
|
-
this.data.segments = [];
|
|
339
|
-
this.next();
|
|
340
|
-
loop: while (true) {
|
|
341
|
-
switch (this.state.type) {
|
|
342
|
-
case commaTok:
|
|
343
|
-
this.next();
|
|
344
|
-
break;
|
|
345
|
-
case bangTok:
|
|
346
|
-
node.isExclude = true;
|
|
347
|
-
this.haveExcludePattern = true;
|
|
348
|
-
this.next();
|
|
349
|
-
break;
|
|
350
|
-
case eofTok:
|
|
351
|
-
break loop;
|
|
352
|
-
case parenRTok:
|
|
353
|
-
break loop;
|
|
354
|
-
default:
|
|
355
|
-
node.value.push(this.parseAtom(this.state.type));
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
this.next();
|
|
359
|
-
this.append(parent, this.parseAtom(this.state.type));
|
|
360
|
-
return node;
|
|
361
|
-
};
|
|
362
|
-
Parser.prototype.parseRangeExpression = function (parent) {
|
|
363
|
-
var node = {
|
|
364
|
-
type: 'RangeExpression',
|
|
365
|
-
};
|
|
366
|
-
this.next();
|
|
367
|
-
this.isMatchPattern = true;
|
|
368
|
-
this.data.segments = [];
|
|
369
|
-
var start = false, hasColon = false;
|
|
370
|
-
loop: while (true) {
|
|
371
|
-
switch (this.state.type) {
|
|
372
|
-
case colonTok:
|
|
373
|
-
hasColon = true;
|
|
374
|
-
start = true;
|
|
375
|
-
this.next();
|
|
376
|
-
break;
|
|
377
|
-
case bracketRTok:
|
|
378
|
-
if (!hasColon && !node.end) {
|
|
379
|
-
node.end = node.start;
|
|
380
|
-
}
|
|
381
|
-
break loop;
|
|
382
|
-
case commaTok:
|
|
383
|
-
throw this.unexpect();
|
|
384
|
-
case eofTok:
|
|
385
|
-
break loop;
|
|
386
|
-
default:
|
|
387
|
-
if (!start) {
|
|
388
|
-
node.start = this.parseAtom(this.state.type);
|
|
389
|
-
}
|
|
390
|
-
else {
|
|
391
|
-
node.end = this.parseAtom(this.state.type);
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
this.next();
|
|
396
|
-
this.append(parent, this.parseAtom(this.state.type));
|
|
397
|
-
return node;
|
|
398
|
-
};
|
|
399
|
-
return Parser;
|
|
400
|
-
}(Tokenizer));
|
|
401
|
-
|
|
402
|
-
export { Parser };
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
var toString = Object.prototype.toString;
|
|
2
|
-
var isType = function (type) {
|
|
3
|
-
return function (obj) {
|
|
4
|
-
return toString.call(obj) === "[object ".concat(type, "]");
|
|
5
|
-
};
|
|
6
|
-
};
|
|
7
|
-
var isFn = isType('Function');
|
|
8
|
-
var isArr = Array.isArray || isType('Array');
|
|
9
|
-
var isStr = isType('String');
|
|
10
|
-
var isNum = isType('Number');
|
|
11
|
-
var isObj = function (val) { return typeof val === 'object'; };
|
|
12
|
-
var isRegExp = isType('RegExp');
|
|
13
|
-
var isNumberLike = function (t) {
|
|
14
|
-
return isNum(t) || /^(\d+)(\.\d+)?$/.test(t);
|
|
15
|
-
};
|
|
16
|
-
var isArray = isArr;
|
|
17
|
-
var keyList = Object.keys;
|
|
18
|
-
var hasProp = Object.prototype.hasOwnProperty;
|
|
19
|
-
var toArr = function (val) {
|
|
20
|
-
return Array.isArray(val) ? val : val !== undefined ? [val] : [];
|
|
21
|
-
};
|
|
22
|
-
var isEqual = function (a, b) {
|
|
23
|
-
if (a === b) {
|
|
24
|
-
return true;
|
|
25
|
-
}
|
|
26
|
-
if (a && b && typeof a === 'object' && typeof b === 'object') {
|
|
27
|
-
var arrA = isArray(a);
|
|
28
|
-
var arrB = isArray(b);
|
|
29
|
-
var i = void 0;
|
|
30
|
-
var length = void 0;
|
|
31
|
-
var key = void 0;
|
|
32
|
-
if (arrA && arrB) {
|
|
33
|
-
length = a.length;
|
|
34
|
-
if (length !== b.length) {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
for (i = length; i-- !== 0;) {
|
|
38
|
-
if (!isEqual(a[i], b[i])) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
if (arrA !== arrB) {
|
|
45
|
-
return false;
|
|
46
|
-
}
|
|
47
|
-
var keys = keyList(a);
|
|
48
|
-
length = keys.length;
|
|
49
|
-
if (length !== keyList(b).length) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
for (i = length; i-- !== 0;) {
|
|
53
|
-
if (!hasProp.call(b, keys[i])) {
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
for (i = length; i-- !== 0;) {
|
|
58
|
-
key = keys[i];
|
|
59
|
-
if (!isEqual(a[key], b[key])) {
|
|
60
|
-
return false;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
return true;
|
|
64
|
-
}
|
|
65
|
-
return a !== a && b !== b;
|
|
66
|
-
};
|
|
67
|
-
var isSegmentEqual = function (a, b) {
|
|
68
|
-
a = typeof a === 'symbol' ? a : "".concat(a);
|
|
69
|
-
b = typeof b === 'symbol' ? b : "".concat(b);
|
|
70
|
-
return a === b;
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
export { isArr, isEqual, isFn, isNum, isNumberLike, isObj, isRegExp, isSegmentEqual, isStr, toArr };
|