lsp-grid 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +34 -0
- package/dist/cjs/app-globals-Bfsg1bDt.js +16 -0
- package/dist/cjs/app-globals-Bfsg1bDt.js.map +1 -0
- package/dist/cjs/cell-renderer-DtuYp7tj.js +106 -0
- package/dist/cjs/cell-renderer-DtuYp7tj.js.map +1 -0
- package/dist/cjs/column.drag.plugin-BIptTmfz.js +2554 -0
- package/dist/cjs/column.drag.plugin-BIptTmfz.js.map +1 -0
- package/dist/cjs/column.service-BnVSAfcu.js +1391 -0
- package/dist/cjs/column.service-BnVSAfcu.js.map +1 -0
- package/dist/cjs/data.store-CrF4Nf9q.js +3615 -0
- package/dist/cjs/data.store-CrF4Nf9q.js.map +1 -0
- package/dist/cjs/debounce-DgeyTQM0.js +498 -0
- package/dist/cjs/debounce-DgeyTQM0.js.map +1 -0
- package/dist/cjs/edit.utils-Bw-E3Fj6.js +118 -0
- package/dist/cjs/edit.utils-Bw-E3Fj6.js.map +1 -0
- package/dist/cjs/events-D0Syn6ut.js +46 -0
- package/dist/cjs/events-D0Syn6ut.js.map +1 -0
- package/dist/cjs/filter.button-CaAAXq-6.js +49 -0
- package/dist/cjs/filter.button-CaAAXq-6.js.map +1 -0
- package/dist/cjs/header-cell-renderer-DhRJqZ-w.js +356 -0
- package/dist/cjs/header-cell-renderer-DhRJqZ-w.js.map +1 -0
- package/dist/cjs/index-VM40U6Gh.js +2549 -0
- package/dist/cjs/index-VM40U6Gh.js.map +1 -0
- package/dist/cjs/index.cjs.js +346 -0
- package/dist/cjs/index.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +19 -0
- package/dist/cjs/loader.cjs.js.map +1 -0
- package/dist/cjs/revo-grid.cjs.entry.js +2187 -0
- package/dist/cjs/revo-grid.cjs.entry.js.map +1 -0
- package/dist/cjs/revo-grid.cjs.js +31 -0
- package/dist/cjs/revo-grid.cjs.js.map +1 -0
- package/dist/cjs/revo-grid.entry.cjs.js.map +1 -0
- package/dist/cjs/revogr-attribution.revogr-extra.revogr-focus.revogr-overlay-selection.revogr-row-headers.revogr-scroll-virtual.revogr-temp-range.entry.cjs.js.map +1 -0
- package/dist/cjs/revogr-attribution_7.cjs.entry.js +1463 -0
- package/dist/cjs/revogr-attribution_7.cjs.entry.js.map +1 -0
- package/dist/cjs/revogr-clipboard.revogr-edit.revogr-order-editor.entry.cjs.js.map +1 -0
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js +456 -0
- package/dist/cjs/revogr-clipboard_3.cjs.entry.js.map +1 -0
- package/dist/cjs/revogr-data.revogr-header.revogr-viewport-scroll.vnode-html.entry.cjs.js.map +1 -0
- package/dist/cjs/revogr-data_4.cjs.entry.js +948 -0
- package/dist/cjs/revogr-data_4.cjs.entry.js.map +1 -0
- package/dist/cjs/revogr-filter-panel.cjs.entry.js +382 -0
- package/dist/cjs/revogr-filter-panel.cjs.entry.js.map +1 -0
- package/dist/cjs/revogr-filter-panel.entry.cjs.js.map +1 -0
- package/dist/cjs/row-header-utils-DL640c7x.js +420 -0
- package/dist/cjs/row-header-utils-DL640c7x.js.map +1 -0
- package/dist/cjs/text-editor-DWChyeVV.js +81 -0
- package/dist/cjs/text-editor-DWChyeVV.js.map +1 -0
- package/dist/cjs/throttle-Bb1Bbfd1.js +278 -0
- package/dist/cjs/throttle-Bb1Bbfd1.js.map +1 -0
- package/dist/cjs/viewport.helpers-CI6uB8tu.js +59 -0
- package/dist/cjs/viewport.helpers-CI6uB8tu.js.map +1 -0
- package/dist/collection/collection-manifest.json +28 -0
- package/dist/collection/components/attribution/revogr-attribution.js +20 -0
- package/dist/collection/components/attribution/revogr-attribution.js.map +1 -0
- package/dist/collection/components/clipboard/revogr-clipboard.js +396 -0
- package/dist/collection/components/clipboard/revogr-clipboard.js.map +1 -0
- package/dist/collection/components/data/cell-renderer.js +44 -0
- package/dist/collection/components/data/cell-renderer.js.map +1 -0
- package/dist/collection/components/data/column.service.js +293 -0
- package/dist/collection/components/data/column.service.js.map +1 -0
- package/dist/collection/components/data/revogr-data-style.css +75 -0
- package/dist/collection/components/data/revogr-data.js +697 -0
- package/dist/collection/components/data/revogr-data.js.map +1 -0
- package/dist/collection/components/data/row-highlight.plugin.js +51 -0
- package/dist/collection/components/data/row-highlight.plugin.js.map +1 -0
- package/dist/collection/components/data/row-renderer.js +16 -0
- package/dist/collection/components/data/row-renderer.js.map +1 -0
- package/dist/collection/components/editors/edit.utils.js +13 -0
- package/dist/collection/components/editors/edit.utils.js.map +1 -0
- package/dist/collection/components/editors/revogr-edit-style.css +16 -0
- package/dist/collection/components/editors/revogr-edit.js +346 -0
- package/dist/collection/components/editors/revogr-edit.js.map +1 -0
- package/dist/collection/components/editors/text-editor.js +74 -0
- package/dist/collection/components/editors/text-editor.js.map +1 -0
- package/dist/collection/components/extra/revogr-extra.js +125 -0
- package/dist/collection/components/extra/revogr-extra.js.map +1 -0
- package/dist/collection/components/header/header-cell-renderer.js +34 -0
- package/dist/collection/components/header/header-cell-renderer.js.map +1 -0
- package/dist/collection/components/header/header-group-renderer.js +25 -0
- package/dist/collection/components/header/header-group-renderer.js.map +1 -0
- package/dist/collection/components/header/header-renderer.js +61 -0
- package/dist/collection/components/header/header-renderer.js.map +1 -0
- package/dist/collection/components/header/resizable.directive.js +237 -0
- package/dist/collection/components/header/resizable.directive.js.map +1 -0
- package/dist/collection/components/header/resizable.element.js +38 -0
- package/dist/collection/components/header/resizable.element.js.map +1 -0
- package/dist/collection/components/header/revogr-header-style.css +144 -0
- package/dist/collection/components/header/revogr-header.js +573 -0
- package/dist/collection/components/header/revogr-header.js.map +1 -0
- package/dist/collection/components/order/order-renderer.js +50 -0
- package/dist/collection/components/order/order-renderer.js.map +1 -0
- package/dist/collection/components/order/order-row.service.js +72 -0
- package/dist/collection/components/order/order-row.service.js.map +1 -0
- package/dist/collection/components/order/revogr-order-editor.js +461 -0
- package/dist/collection/components/order/revogr-order-editor.js.map +1 -0
- package/dist/collection/components/overlay/autofill.service.js +224 -0
- package/dist/collection/components/overlay/autofill.service.js.map +1 -0
- package/dist/collection/components/overlay/keyboard.service.js +158 -0
- package/dist/collection/components/overlay/keyboard.service.js.map +1 -0
- package/dist/collection/components/overlay/revogr-overlay-selection.js +1515 -0
- package/dist/collection/components/overlay/revogr-overlay-selection.js.map +1 -0
- package/dist/collection/components/overlay/revogr-overlay-style.css +95 -0
- package/dist/collection/components/overlay/selection.utils.js +136 -0
- package/dist/collection/components/overlay/selection.utils.js.map +1 -0
- package/dist/collection/components/revoGrid/grid.helpers.js +33 -0
- package/dist/collection/components/revoGrid/grid.helpers.js.map +1 -0
- package/dist/collection/components/revoGrid/plugin.service.js +81 -0
- package/dist/collection/components/revoGrid/plugin.service.js.map +1 -0
- package/dist/collection/components/revoGrid/revo-grid-style.css +567 -0
- package/dist/collection/components/revoGrid/revo-grid.js +3671 -0
- package/dist/collection/components/revoGrid/revo-grid.js.map +1 -0
- package/dist/collection/components/revoGrid/viewport.helpers.js +49 -0
- package/dist/collection/components/revoGrid/viewport.helpers.js.map +1 -0
- package/dist/collection/components/revoGrid/viewport.resize.service.js +55 -0
- package/dist/collection/components/revoGrid/viewport.resize.service.js.map +1 -0
- package/dist/collection/components/revoGrid/viewport.scrolling.service.js +90 -0
- package/dist/collection/components/revoGrid/viewport.scrolling.service.js.map +1 -0
- package/dist/collection/components/revoGrid/viewport.service.js +237 -0
- package/dist/collection/components/revoGrid/viewport.service.js.map +1 -0
- package/dist/collection/components/rowHeaders/revogr-row-headers.js +291 -0
- package/dist/collection/components/rowHeaders/revogr-row-headers.js.map +1 -0
- package/dist/collection/components/rowHeaders/row-header-render.js +5 -0
- package/dist/collection/components/rowHeaders/row-header-render.js.map +1 -0
- package/dist/collection/components/scroll/revogr-viewport-scroll-style.css +69 -0
- package/dist/collection/components/scroll/revogr-viewport-scroll.js +601 -0
- package/dist/collection/components/scroll/revogr-viewport-scroll.js.map +1 -0
- package/dist/collection/components/scrollable/autohide-scroll.plugin.js +44 -0
- package/dist/collection/components/scrollable/autohide-scroll.plugin.js.map +1 -0
- package/dist/collection/components/scrollable/revogr-scroll-style.css +34 -0
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js +295 -0
- package/dist/collection/components/scrollable/revogr-scroll-virtual.js.map +1 -0
- package/dist/collection/components/selectionFocus/revogr-focus-style.css +7 -0
- package/dist/collection/components/selectionFocus/revogr-focus.js +400 -0
- package/dist/collection/components/selectionFocus/revogr-focus.js.map +1 -0
- package/dist/collection/components/selectionTempRange/revogr-temp-range-style.css +28 -0
- package/dist/collection/components/selectionTempRange/revogr-temp-range.js +171 -0
- package/dist/collection/components/selectionTempRange/revogr-temp-range.js.map +1 -0
- package/dist/collection/components/vnode/vnode-converter.js +84 -0
- package/dist/collection/components/vnode/vnode-converter.js.map +1 -0
- package/dist/collection/components/vnode/vnode.utils.js +18 -0
- package/dist/collection/components/vnode/vnode.utils.js.map +1 -0
- package/dist/collection/global/global.js +19 -0
- package/dist/collection/global/global.js.map +1 -0
- package/dist/collection/index.js +13 -0
- package/dist/collection/index.js.map +1 -0
- package/dist/collection/plugins/add-rows-on-paste.plugin.js +40 -0
- package/dist/collection/plugins/add-rows-on-paste.plugin.js.map +1 -0
- package/dist/collection/plugins/base.plugin.js +90 -0
- package/dist/collection/plugins/base.plugin.js.map +1 -0
- package/dist/collection/plugins/column.auto-size.plugin.js +225 -0
- package/dist/collection/plugins/column.auto-size.plugin.js.map +1 -0
- package/dist/collection/plugins/column.stretch.plugin.js +96 -0
- package/dist/collection/plugins/column.stretch.plugin.js.map +1 -0
- package/dist/collection/plugins/dispatcher.js +40 -0
- package/dist/collection/plugins/dispatcher.js.map +1 -0
- package/dist/collection/plugins/export/csv.js +72 -0
- package/dist/collection/plugins/export/csv.js.map +1 -0
- package/dist/collection/plugins/export/export.plugin.js +157 -0
- package/dist/collection/plugins/export/export.plugin.js.map +1 -0
- package/dist/collection/plugins/export/types.js +2 -0
- package/dist/collection/plugins/export/types.js.map +1 -0
- package/dist/collection/plugins/filter/conditions/equal.js +21 -0
- package/dist/collection/plugins/filter/conditions/equal.js.map +1 -0
- package/dist/collection/plugins/filter/conditions/number/greaterThan.js +14 -0
- package/dist/collection/plugins/filter/conditions/number/greaterThan.js.map +1 -0
- package/dist/collection/plugins/filter/conditions/number/greaterThanOrEqual.js +11 -0
- package/dist/collection/plugins/filter/conditions/number/greaterThanOrEqual.js.map +1 -0
- package/dist/collection/plugins/filter/conditions/number/lessThan.js +16 -0
- package/dist/collection/plugins/filter/conditions/number/lessThan.js.map +1 -0
- package/dist/collection/plugins/filter/conditions/number/lessThanOrEqual.js +11 -0
- package/dist/collection/plugins/filter/conditions/number/lessThanOrEqual.js.map +1 -0
- package/dist/collection/plugins/filter/conditions/set.js +7 -0
- package/dist/collection/plugins/filter/conditions/set.js.map +1 -0
- package/dist/collection/plugins/filter/conditions/string/beginswith.js +21 -0
- package/dist/collection/plugins/filter/conditions/string/beginswith.js.map +1 -0
- package/dist/collection/plugins/filter/conditions/string/contains.js +25 -0
- package/dist/collection/plugins/filter/conditions/string/contains.js.map +1 -0
- package/dist/collection/plugins/filter/filter.button.js +28 -0
- package/dist/collection/plugins/filter/filter.button.js.map +1 -0
- package/dist/collection/plugins/filter/filter.indexed.js +49 -0
- package/dist/collection/plugins/filter/filter.indexed.js.map +1 -0
- package/dist/collection/plugins/filter/filter.panel.js +610 -0
- package/dist/collection/plugins/filter/filter.panel.js.map +1 -0
- package/dist/collection/plugins/filter/filter.plugin.js +388 -0
- package/dist/collection/plugins/filter/filter.plugin.js.map +1 -0
- package/dist/collection/plugins/filter/filter.style.css +165 -0
- package/dist/collection/plugins/filter/filter.types.js +9 -0
- package/dist/collection/plugins/filter/filter.types.js.map +1 -0
- package/dist/collection/plugins/groupingRow/grouping.const.js +16 -0
- package/dist/collection/plugins/groupingRow/grouping.const.js.map +1 -0
- package/dist/collection/plugins/groupingRow/grouping.row.expand.service.js +79 -0
- package/dist/collection/plugins/groupingRow/grouping.row.expand.service.js.map +1 -0
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js +245 -0
- package/dist/collection/plugins/groupingRow/grouping.row.plugin.js.map +1 -0
- package/dist/collection/plugins/groupingRow/grouping.row.renderer.js +38 -0
- package/dist/collection/plugins/groupingRow/grouping.row.renderer.js.map +1 -0
- package/dist/collection/plugins/groupingRow/grouping.row.types.js +2 -0
- package/dist/collection/plugins/groupingRow/grouping.row.types.js.map +1 -0
- package/dist/collection/plugins/groupingRow/grouping.service.js +178 -0
- package/dist/collection/plugins/groupingRow/grouping.service.js.map +1 -0
- package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js +61 -0
- package/dist/collection/plugins/groupingRow/grouping.trimmed.service.js.map +1 -0
- package/dist/collection/plugins/index.js +15 -0
- package/dist/collection/plugins/index.js.map +1 -0
- package/dist/collection/plugins/moveColumn/column.drag.plugin.js +175 -0
- package/dist/collection/plugins/moveColumn/column.drag.plugin.js.map +1 -0
- package/dist/collection/plugins/moveColumn/order-column.handler.js +71 -0
- package/dist/collection/plugins/moveColumn/order-column.handler.js.map +1 -0
- package/dist/collection/plugins/rtl/rtl.plugin.js +110 -0
- package/dist/collection/plugins/rtl/rtl.plugin.js.map +1 -0
- package/dist/collection/plugins/sorting/sorting.func.js +82 -0
- package/dist/collection/plugins/sorting/sorting.func.js.map +1 -0
- package/dist/collection/plugins/sorting/sorting.plugin.js +224 -0
- package/dist/collection/plugins/sorting/sorting.plugin.js.map +1 -0
- package/dist/collection/plugins/sorting/sorting.sign.js +9 -0
- package/dist/collection/plugins/sorting/sorting.sign.js.map +1 -0
- package/dist/collection/plugins/sorting/sorting.types.js +2 -0
- package/dist/collection/plugins/sorting/sorting.types.js.map +1 -0
- package/dist/collection/plugins/wcag/index.js +84 -0
- package/dist/collection/plugins/wcag/index.js.map +1 -0
- package/dist/collection/serve/controller.js +344 -0
- package/dist/collection/serve/data.js +201 -0
- package/dist/collection/services/cell.helpers.js +12 -0
- package/dist/collection/services/cell.helpers.js.map +1 -0
- package/dist/collection/services/column.data.provider.js +119 -0
- package/dist/collection/services/column.data.provider.js.map +1 -0
- package/dist/collection/services/data.provider.js +89 -0
- package/dist/collection/services/data.provider.js.map +1 -0
- package/dist/collection/services/dimension.provider.js +176 -0
- package/dist/collection/services/dimension.provider.js.map +1 -0
- package/dist/collection/services/local.scroll.service.js +124 -0
- package/dist/collection/services/local.scroll.service.js.map +1 -0
- package/dist/collection/services/local.scroll.timer.js +81 -0
- package/dist/collection/services/local.scroll.timer.js.map +1 -0
- package/dist/collection/services/selection.store.connector.js +307 -0
- package/dist/collection/services/selection.store.connector.js.map +1 -0
- package/dist/collection/services/viewport.provider.js +17 -0
- package/dist/collection/services/viewport.provider.js.map +1 -0
- package/dist/collection/store/dataSource/data.proxy.js +45 -0
- package/dist/collection/store/dataSource/data.proxy.js.map +1 -0
- package/dist/collection/store/dataSource/data.store.js +144 -0
- package/dist/collection/store/dataSource/data.store.js.map +1 -0
- package/dist/collection/store/dataSource/index.js +7 -0
- package/dist/collection/store/dataSource/index.js.map +1 -0
- package/dist/collection/store/dataSource/trimmed.plugin.js +34 -0
- package/dist/collection/store/dataSource/trimmed.plugin.js.map +1 -0
- package/dist/collection/store/dimension/dimension.helpers.js +101 -0
- package/dist/collection/store/dimension/dimension.helpers.js.map +1 -0
- package/dist/collection/store/dimension/dimension.recalculate.plugin.js +35 -0
- package/dist/collection/store/dimension/dimension.recalculate.plugin.js.map +1 -0
- package/dist/collection/store/dimension/dimension.store.js +109 -0
- package/dist/collection/store/dimension/dimension.store.js.map +1 -0
- package/dist/collection/store/dimension/dimension.trim.plugin.js +61 -0
- package/dist/collection/store/dimension/dimension.trim.plugin.js.map +1 -0
- package/dist/collection/store/dimension/index.js +6 -0
- package/dist/collection/store/dimension/index.js.map +1 -0
- package/dist/collection/store/index.js +17 -0
- package/dist/collection/store/index.js.map +1 -0
- package/dist/collection/store/selection/index.js +6 -0
- package/dist/collection/store/selection/index.js.map +1 -0
- package/dist/collection/store/selection/selection.helpers.js +53 -0
- package/dist/collection/store/selection/selection.helpers.js.map +1 -0
- package/dist/collection/store/selection/selection.store.js +85 -0
- package/dist/collection/store/selection/selection.store.js.map +1 -0
- package/dist/collection/store/vp/index.js +6 -0
- package/dist/collection/store/vp/index.js.map +1 -0
- package/dist/collection/store/vp/viewport.helpers.js +251 -0
- package/dist/collection/store/vp/viewport.helpers.js.map +1 -0
- package/dist/collection/store/vp/viewport.store.js +151 -0
- package/dist/collection/store/vp/viewport.store.js.map +1 -0
- package/dist/collection/themeManager/theme.compact.js +9 -0
- package/dist/collection/themeManager/theme.compact.js.map +1 -0
- package/dist/collection/themeManager/theme.default.js +9 -0
- package/dist/collection/themeManager/theme.default.js.map +1 -0
- package/dist/collection/themeManager/theme.material.js +9 -0
- package/dist/collection/themeManager/theme.material.js.map +1 -0
- package/dist/collection/themeManager/theme.service.js +53 -0
- package/dist/collection/themeManager/theme.service.js.map +1 -0
- package/dist/collection/types/dimension.js +2 -0
- package/dist/collection/types/dimension.js.map +1 -0
- package/dist/collection/types/events.js +118 -0
- package/dist/collection/types/events.js.map +1 -0
- package/dist/collection/types/index.js +12 -0
- package/dist/collection/types/index.js.map +1 -0
- package/dist/collection/types/interfaces.js +2 -0
- package/dist/collection/types/interfaces.js.map +1 -0
- package/dist/collection/types/plugin.js +2 -0
- package/dist/collection/types/plugin.js.map +1 -0
- package/dist/collection/types/plugin.types.js +2 -0
- package/dist/collection/types/plugin.types.js.map +1 -0
- package/dist/collection/types/selection.js +2 -0
- package/dist/collection/types/selection.js.map +1 -0
- package/dist/collection/types/theme.js +2 -0
- package/dist/collection/types/theme.js.map +1 -0
- package/dist/collection/types/viewport.interfaces.js +2 -0
- package/dist/collection/types/viewport.interfaces.js.map +1 -0
- package/dist/collection/utils/browser.js +7 -0
- package/dist/collection/utils/browser.js.map +1 -0
- package/dist/collection/utils/closest.polifill.js +22 -0
- package/dist/collection/utils/closest.polifill.js.map +1 -0
- package/dist/collection/utils/column.utils.js +153 -0
- package/dist/collection/utils/column.utils.js.map +1 -0
- package/dist/collection/utils/consts.js +26 -0
- package/dist/collection/utils/consts.js.map +1 -0
- package/dist/collection/utils/events.js +39 -0
- package/dist/collection/utils/events.js.map +1 -0
- package/dist/collection/utils/header.utils.js +24 -0
- package/dist/collection/utils/header.utils.js.map +1 -0
- package/dist/collection/utils/index.js +140 -0
- package/dist/collection/utils/index.js.map +1 -0
- package/dist/collection/utils/key.codes.js +80 -0
- package/dist/collection/utils/key.codes.js.map +1 -0
- package/dist/collection/utils/key.utils.js +90 -0
- package/dist/collection/utils/key.utils.js.map +1 -0
- package/dist/collection/utils/mobile.js +7 -0
- package/dist/collection/utils/mobile.js.map +1 -0
- package/dist/collection/utils/platform.js +9 -0
- package/dist/collection/utils/platform.js.map +1 -0
- package/dist/collection/utils/row-header-utils.js +9 -0
- package/dist/collection/utils/row-header-utils.js.map +1 -0
- package/dist/collection/utils/store.types.js +2 -0
- package/dist/collection/utils/store.types.js.map +1 -0
- package/dist/collection/utils/store.utils.js +15 -0
- package/dist/collection/utils/store.utils.js.map +1 -0
- package/dist/esm/app-globals-FBz64o-g.js +14 -0
- package/dist/esm/app-globals-FBz64o-g.js.map +1 -0
- package/dist/esm/cell-renderer-Ca_PCGjJ.js +98 -0
- package/dist/esm/cell-renderer-Ca_PCGjJ.js.map +1 -0
- package/dist/esm/column.drag.plugin-BtuUyB-2.js +2528 -0
- package/dist/esm/column.drag.plugin-BtuUyB-2.js.map +1 -0
- package/dist/esm/column.service-CTqFIQUy.js +1343 -0
- package/dist/esm/column.service-CTqFIQUy.js.map +1 -0
- package/dist/esm/data.store-B-lvmoFH.js +3553 -0
- package/dist/esm/data.store-B-lvmoFH.js.map +1 -0
- package/dist/esm/debounce-DTUQ1fY7.js +488 -0
- package/dist/esm/debounce-DTUQ1fY7.js.map +1 -0
- package/dist/esm/edit.utils-CyCANCLB.js +103 -0
- package/dist/esm/edit.utils-CyCANCLB.js.map +1 -0
- package/dist/esm/events-CKtYJJSv.js +43 -0
- package/dist/esm/events-CKtYJJSv.js.map +1 -0
- package/dist/esm/filter.button-CjABZQgg.js +39 -0
- package/dist/esm/filter.button-CjABZQgg.js.map +1 -0
- package/dist/esm/header-cell-renderer-DnjpJuXq.js +351 -0
- package/dist/esm/header-cell-renderer-DnjpJuXq.js.map +1 -0
- package/dist/esm/index-BAoInZ4V.js +2519 -0
- package/dist/esm/index-BAoInZ4V.js.map +1 -0
- package/dist/esm/index.js +181 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/loader.js.map +1 -0
- package/dist/esm/revo-grid.entry.js +2185 -0
- package/dist/esm/revo-grid.entry.js.map +1 -0
- package/dist/esm/revo-grid.js +27 -0
- package/dist/esm/revo-grid.js.map +1 -0
- package/dist/esm/revogr-attribution.revogr-extra.revogr-focus.revogr-overlay-selection.revogr-row-headers.revogr-scroll-virtual.revogr-temp-range.entry.js.map +1 -0
- package/dist/esm/revogr-attribution_7.entry.js +1455 -0
- package/dist/esm/revogr-attribution_7.entry.js.map +1 -0
- package/dist/esm/revogr-clipboard.revogr-edit.revogr-order-editor.entry.js.map +1 -0
- package/dist/esm/revogr-clipboard_3.entry.js +452 -0
- package/dist/esm/revogr-clipboard_3.entry.js.map +1 -0
- package/dist/esm/revogr-data.revogr-header.revogr-viewport-scroll.vnode-html.entry.js.map +1 -0
- package/dist/esm/revogr-data_4.entry.js +943 -0
- package/dist/esm/revogr-data_4.entry.js.map +1 -0
- package/dist/esm/revogr-filter-panel.entry.js +380 -0
- package/dist/esm/revogr-filter-panel.entry.js.map +1 -0
- package/dist/esm/row-header-utils-vnoLGj5A.js +407 -0
- package/dist/esm/row-header-utils-vnoLGj5A.js.map +1 -0
- package/dist/esm/text-editor-Cp7lwBZi.js +79 -0
- package/dist/esm/text-editor-Cp7lwBZi.js.map +1 -0
- package/dist/esm/throttle-DiUrHjcY.js +273 -0
- package/dist/esm/throttle-DiUrHjcY.js.map +1 -0
- package/dist/esm/viewport.helpers-Ch4AQMMg.js +53 -0
- package/dist/esm/viewport.helpers-Ch4AQMMg.js.map +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/revo-grid/app-globals-FBz64o-g.js +14 -0
- package/dist/revo-grid/app-globals-FBz64o-g.js.map +1 -0
- package/dist/revo-grid/cell-renderer-Ca_PCGjJ.js +98 -0
- package/dist/revo-grid/cell-renderer-Ca_PCGjJ.js.map +1 -0
- package/dist/revo-grid/column.drag.plugin-BtuUyB-2.js +2528 -0
- package/dist/revo-grid/column.drag.plugin-BtuUyB-2.js.map +1 -0
- package/dist/revo-grid/column.service-CTqFIQUy.js +1343 -0
- package/dist/revo-grid/column.service-CTqFIQUy.js.map +1 -0
- package/dist/revo-grid/data.store-B-lvmoFH.js +3553 -0
- package/dist/revo-grid/data.store-B-lvmoFH.js.map +1 -0
- package/dist/revo-grid/debounce-DTUQ1fY7.js +488 -0
- package/dist/revo-grid/debounce-DTUQ1fY7.js.map +1 -0
- package/dist/revo-grid/edit.utils-CyCANCLB.js +103 -0
- package/dist/revo-grid/edit.utils-CyCANCLB.js.map +1 -0
- package/dist/revo-grid/events-CKtYJJSv.js +43 -0
- package/dist/revo-grid/events-CKtYJJSv.js.map +1 -0
- package/dist/revo-grid/filter.button-CjABZQgg.js +39 -0
- package/dist/revo-grid/filter.button-CjABZQgg.js.map +1 -0
- package/dist/revo-grid/header-cell-renderer-DnjpJuXq.js +351 -0
- package/dist/revo-grid/header-cell-renderer-DnjpJuXq.js.map +1 -0
- package/dist/revo-grid/index-BAoInZ4V.js +2490 -0
- package/dist/revo-grid/index-BAoInZ4V.js.map +1 -0
- package/dist/revo-grid/index.esm.js +181 -0
- package/dist/revo-grid/index.esm.js.map +1 -0
- package/dist/revo-grid/loader.esm.js.map +1 -0
- package/dist/revo-grid/revo-grid.entry.esm.js.map +1 -0
- package/dist/revo-grid/revo-grid.entry.js +2185 -0
- package/dist/revo-grid/revo-grid.entry.js.map +1 -0
- package/dist/revo-grid/revo-grid.esm.js +27 -0
- package/dist/revo-grid/revo-grid.esm.js.map +1 -0
- package/dist/revo-grid/revogr-attribution.revogr-extra.revogr-focus.revogr-overlay-selection.revogr-row-headers.revogr-scroll-virtual.revogr-temp-range.entry.esm.js.map +1 -0
- package/dist/revo-grid/revogr-attribution_7.entry.js +1455 -0
- package/dist/revo-grid/revogr-attribution_7.entry.js.map +1 -0
- package/dist/revo-grid/revogr-clipboard.revogr-edit.revogr-order-editor.entry.esm.js.map +1 -0
- package/dist/revo-grid/revogr-clipboard_3.entry.js +452 -0
- package/dist/revo-grid/revogr-clipboard_3.entry.js.map +1 -0
- package/dist/revo-grid/revogr-data.revogr-header.revogr-viewport-scroll.vnode-html.entry.esm.js.map +1 -0
- package/dist/revo-grid/revogr-data_4.entry.js +943 -0
- package/dist/revo-grid/revogr-data_4.entry.js.map +1 -0
- package/dist/revo-grid/revogr-filter-panel.entry.esm.js.map +1 -0
- package/dist/revo-grid/revogr-filter-panel.entry.js +380 -0
- package/dist/revo-grid/revogr-filter-panel.entry.js.map +1 -0
- package/dist/revo-grid/row-header-utils-vnoLGj5A.js +407 -0
- package/dist/revo-grid/row-header-utils-vnoLGj5A.js.map +1 -0
- package/dist/revo-grid/text-editor-Cp7lwBZi.js +79 -0
- package/dist/revo-grid/text-editor-Cp7lwBZi.js.map +1 -0
- package/dist/revo-grid/throttle-DiUrHjcY.js +273 -0
- package/dist/revo-grid/throttle-DiUrHjcY.js.map +1 -0
- package/dist/revo-grid/viewport.helpers-Ch4AQMMg.js +53 -0
- package/dist/revo-grid/viewport.helpers-Ch4AQMMg.js.map +1 -0
- package/dist/types/components/attribution/revogr-attribution.d.ts +12 -0
- package/dist/types/components/clipboard/revogr-clipboard.d.ts +89 -0
- package/dist/types/components/data/cell-renderer.d.ts +12 -0
- package/dist/types/components/data/column.service.d.ts +61 -0
- package/dist/types/components/data/revogr-data.d.ts +107 -0
- package/dist/types/components/data/row-highlight.plugin.d.ts +10 -0
- package/dist/types/components/data/row-renderer.d.ts +12 -0
- package/dist/types/components/editors/edit.utils.d.ts +3 -0
- package/dist/types/components/editors/revogr-edit.d.ts +63 -0
- package/dist/types/components/editors/text-editor.d.ts +43 -0
- package/dist/types/components/extra/revogr-extra.d.ts +38 -0
- package/dist/types/components/header/header-cell-renderer.d.ts +9 -0
- package/dist/types/components/header/header-group-renderer.d.ts +15 -0
- package/dist/types/components/header/header-renderer.d.ts +16 -0
- package/dist/types/components/header/resizable.directive.d.ts +55 -0
- package/dist/types/components/header/resizable.element.d.ts +5 -0
- package/dist/types/components/header/revogr-header.d.ts +90 -0
- package/dist/types/components/order/order-renderer.d.ts +29 -0
- package/dist/types/components/order/order-row.service.d.ts +27 -0
- package/dist/types/components/order/revogr-order-editor.d.ts +56 -0
- package/dist/types/components/overlay/autofill.service.d.ts +80 -0
- package/dist/types/components/overlay/keyboard.service.d.ts +28 -0
- package/dist/types/components/overlay/revogr-overlay-selection.d.ts +278 -0
- package/dist/types/components/overlay/selection.utils.d.ts +47 -0
- package/dist/types/components/revoGrid/grid.helpers.d.ts +17 -0
- package/dist/types/components/revoGrid/plugin.service.d.ts +37 -0
- package/dist/types/components/revoGrid/revo-grid.d.ts +686 -0
- package/dist/types/components/revoGrid/viewport.helpers.d.ts +39 -0
- package/dist/types/components/revoGrid/viewport.resize.service.d.ts +17 -0
- package/dist/types/components/revoGrid/viewport.scrolling.service.d.ts +20 -0
- package/dist/types/components/revoGrid/viewport.service.d.ts +59 -0
- package/dist/types/components/rowHeaders/revogr-row-headers.d.ts +51 -0
- package/dist/types/components/rowHeaders/row-header-render.d.ts +9 -0
- package/dist/types/components/scroll/revogr-viewport-scroll.d.ts +117 -0
- package/dist/types/components/scrollable/autohide-scroll.plugin.d.ts +22 -0
- package/dist/types/components/scrollable/revogr-scroll-virtual.d.ts +43 -0
- package/dist/types/components/selectionFocus/revogr-focus.d.ts +58 -0
- package/dist/types/components/selectionTempRange/revogr-temp-range.d.ts +28 -0
- package/dist/types/components/vnode/vnode-converter.d.ts +19 -0
- package/dist/types/components/vnode/vnode.utils.d.ts +9 -0
- package/dist/types/components.d.ts +2583 -0
- package/dist/types/global/global.d.ts +1 -0
- package/dist/types/index.d.ts +9 -0
- package/dist/types/plugins/add-rows-on-paste.plugin.d.ts +14 -0
- package/dist/types/plugins/base.plugin.d.ts +51 -0
- package/dist/types/plugins/column.auto-size.plugin.d.ts +55 -0
- package/dist/types/plugins/column.stretch.plugin.d.ts +20 -0
- package/dist/types/plugins/dispatcher.d.ts +20 -0
- package/dist/types/plugins/export/csv.d.ts +9 -0
- package/dist/types/plugins/export/export.plugin.d.ts +24 -0
- package/dist/types/plugins/export/types.d.ts +23 -0
- package/dist/types/plugins/filter/conditions/equal.d.ts +4 -0
- package/dist/types/plugins/filter/conditions/number/greaterThan.d.ts +3 -0
- package/dist/types/plugins/filter/conditions/number/greaterThanOrEqual.d.ts +3 -0
- package/dist/types/plugins/filter/conditions/number/lessThan.d.ts +3 -0
- package/dist/types/plugins/filter/conditions/number/lessThanOrEqual.d.ts +3 -0
- package/dist/types/plugins/filter/conditions/set.d.ts +4 -0
- package/dist/types/plugins/filter/conditions/string/beginswith.d.ts +3 -0
- package/dist/types/plugins/filter/conditions/string/contains.d.ts +4 -0
- package/dist/types/plugins/filter/filter.button.d.ts +14 -0
- package/dist/types/plugins/filter/filter.indexed.d.ts +20 -0
- package/dist/types/plugins/filter/filter.panel.d.ts +53 -0
- package/dist/types/plugins/filter/filter.plugin.d.ts +73 -0
- package/dist/types/plugins/filter/filter.types.d.ts +129 -0
- package/dist/types/plugins/groupingRow/grouping.const.d.ts +12 -0
- package/dist/types/plugins/groupingRow/grouping.row.expand.service.d.ts +15 -0
- package/dist/types/plugins/groupingRow/grouping.row.plugin.d.ts +39 -0
- package/dist/types/plugins/groupingRow/grouping.row.renderer.d.ts +6 -0
- package/dist/types/plugins/groupingRow/grouping.row.types.d.ts +103 -0
- package/dist/types/plugins/groupingRow/grouping.service.d.ts +36 -0
- package/dist/types/plugins/groupingRow/grouping.trimmed.service.d.ts +10 -0
- package/dist/types/plugins/index.d.ts +11 -0
- package/dist/types/plugins/moveColumn/column.drag.plugin.d.ts +42 -0
- package/dist/types/plugins/moveColumn/order-column.handler.d.ts +16 -0
- package/dist/types/plugins/rtl/rtl.plugin.d.ts +37 -0
- package/dist/types/plugins/sorting/sorting.func.d.ts +9 -0
- package/dist/types/plugins/sorting/sorting.plugin.d.ts +48 -0
- package/dist/types/plugins/sorting/sorting.sign.d.ts +6 -0
- package/dist/types/plugins/sorting/sorting.types.d.ts +14 -0
- package/dist/types/plugins/wcag/index.d.ts +26 -0
- package/dist/types/services/cell.helpers.d.ts +2 -0
- package/dist/types/services/column.data.provider.d.ts +27 -0
- package/dist/types/services/data.provider.d.ts +36 -0
- package/dist/types/services/dimension.provider.d.ts +66 -0
- package/dist/types/services/local.scroll.service.d.ts +36 -0
- package/dist/types/services/local.scroll.timer.d.ts +32 -0
- package/dist/types/services/selection.store.connector.d.ts +79 -0
- package/dist/types/services/viewport.provider.d.ts +7 -0
- package/dist/types/stencil-public-runtime.d.ts +1709 -0
- package/dist/types/store/dataSource/data.proxy.d.ts +14 -0
- package/dist/types/store/dataSource/data.store.d.ts +74 -0
- package/dist/types/store/dataSource/index.d.ts +3 -0
- package/dist/types/store/dataSource/trimmed.plugin.d.ts +12 -0
- package/dist/types/store/dimension/dimension.helpers.d.ts +24 -0
- package/dist/types/store/dimension/dimension.recalculate.plugin.d.ts +9 -0
- package/dist/types/store/dimension/dimension.store.d.ts +21 -0
- package/dist/types/store/dimension/dimension.trim.plugin.d.ts +13 -0
- package/dist/types/store/dimension/index.d.ts +2 -0
- package/dist/types/store/index.d.ts +8 -0
- package/dist/types/store/selection/index.d.ts +2 -0
- package/dist/types/store/selection/selection.helpers.d.ts +6 -0
- package/dist/types/store/selection/selection.store.d.ts +22 -0
- package/dist/types/store/vp/index.d.ts +7 -0
- package/dist/types/store/vp/viewport.helpers.d.ts +54 -0
- package/dist/types/store/vp/viewport.store.d.ts +26 -0
- package/dist/types/themeManager/theme.compact.d.ts +4 -0
- package/dist/types/themeManager/theme.default.d.ts +4 -0
- package/dist/types/themeManager/theme.material.d.ts +4 -0
- package/dist/types/themeManager/theme.service.d.ts +13 -0
- package/dist/types/types/dimension.d.ts +8 -0
- package/dist/types/types/events.d.ts +2 -0
- package/dist/types/types/index.d.ts +8 -0
- package/dist/types/types/interfaces.d.ts +768 -0
- package/dist/types/types/plugin.d.ts +9 -0
- package/dist/types/types/plugin.types.d.ts +48 -0
- package/dist/types/types/selection.d.ts +178 -0
- package/dist/types/types/theme.d.ts +7 -0
- package/dist/types/types/viewport.interfaces.d.ts +45 -0
- package/dist/types/utils/browser.d.ts +1 -0
- package/dist/types/utils/closest.polifill.d.ts +0 -0
- package/dist/types/utils/column.utils.d.ts +52 -0
- package/dist/types/utils/consts.d.ts +22 -0
- package/dist/types/utils/events.d.ts +5 -0
- package/dist/types/utils/header.utils.d.ts +2 -0
- package/dist/types/utils/index.d.ts +32 -0
- package/dist/types/utils/key.codes.d.ts +73 -0
- package/dist/types/utils/key.utils.d.ts +13 -0
- package/dist/types/utils/mobile.d.ts +1 -0
- package/dist/types/utils/platform.d.ts +4 -0
- package/dist/types/utils/row-header-utils.d.ts +2 -0
- package/dist/types/utils/store.types.d.ts +97 -0
- package/dist/types/utils/store.utils.d.ts +10 -0
- package/hydrate/index.d.ts +273 -0
- package/hydrate/index.js +33890 -0
- package/hydrate/index.mjs +33882 -0
- package/hydrate/package.json +12 -0
- package/loader/cdn.js +4 -0
- package/loader/index.cjs.js +4 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +4 -0
- package/loader/index.js +5 -0
- package/package.json +101 -0
- package/react/dist/index.d.ts +6191 -0
- package/react/dist/react-datagrid.js +260 -0
- package/react/dist/react-datagrid.umd.cjs +272 -0
- package/standalone/column.service.js +1345 -0
- package/standalone/column.service.js.map +1 -0
- package/standalone/consts.js +30 -0
- package/standalone/consts.js.map +1 -0
- package/standalone/data.store.js +3099 -0
- package/standalone/data.store.js.map +1 -0
- package/standalone/debounce.js +215 -0
- package/standalone/debounce.js.map +1 -0
- package/standalone/dimension.helpers.js +229 -0
- package/standalone/dimension.helpers.js.map +1 -0
- package/standalone/filter.button.js +39 -0
- package/standalone/filter.button.js.map +1 -0
- package/standalone/index.d.ts +68 -0
- package/standalone/index.js +217 -0
- package/standalone/index.js.map +1 -0
- package/standalone/index2.js +140 -0
- package/standalone/index2.js.map +1 -0
- package/standalone/local.scroll.timer.js +207 -0
- package/standalone/local.scroll.timer.js.map +1 -0
- package/standalone/platform.js +90 -0
- package/standalone/platform.js.map +1 -0
- package/standalone/revo-grid.d.ts +11 -0
- package/standalone/revo-grid.js +4884 -0
- package/standalone/revo-grid.js.map +1 -0
- package/standalone/revogr-attribution.d.ts +11 -0
- package/standalone/revogr-attribution.js +12 -0
- package/standalone/revogr-attribution.js.map +1 -0
- package/standalone/revogr-attribution2.js +32 -0
- package/standalone/revogr-attribution2.js.map +1 -0
- package/standalone/revogr-clipboard.d.ts +11 -0
- package/standalone/revogr-clipboard.js +12 -0
- package/standalone/revogr-clipboard.js.map +1 -0
- package/standalone/revogr-clipboard2.js +164 -0
- package/standalone/revogr-clipboard2.js.map +1 -0
- package/standalone/revogr-data.d.ts +11 -0
- package/standalone/revogr-data.js +12 -0
- package/standalone/revogr-data.js.map +1 -0
- package/standalone/revogr-data2.js +378 -0
- package/standalone/revogr-data2.js.map +1 -0
- package/standalone/revogr-edit.d.ts +11 -0
- package/standalone/revogr-edit.js +12 -0
- package/standalone/revogr-edit.js.map +1 -0
- package/standalone/revogr-edit2.js +334 -0
- package/standalone/revogr-edit2.js.map +1 -0
- package/standalone/revogr-extra.d.ts +11 -0
- package/standalone/revogr-extra.js +12 -0
- package/standalone/revogr-extra.js.map +1 -0
- package/standalone/revogr-extra2.js +73 -0
- package/standalone/revogr-extra2.js.map +1 -0
- package/standalone/revogr-filter-panel.d.ts +11 -0
- package/standalone/revogr-filter-panel.js +411 -0
- package/standalone/revogr-filter-panel.js.map +1 -0
- package/standalone/revogr-focus.d.ts +11 -0
- package/standalone/revogr-focus.js +12 -0
- package/standalone/revogr-focus.js.map +1 -0
- package/standalone/revogr-focus2.js +112 -0
- package/standalone/revogr-focus2.js.map +1 -0
- package/standalone/revogr-header.d.ts +11 -0
- package/standalone/revogr-header.js +12 -0
- package/standalone/revogr-header.js.map +1 -0
- package/standalone/revogr-header2.js +707 -0
- package/standalone/revogr-header2.js.map +1 -0
- package/standalone/revogr-order-editor.d.ts +11 -0
- package/standalone/revogr-order-editor.js +12 -0
- package/standalone/revogr-order-editor.js.map +1 -0
- package/standalone/revogr-order-editor2.js +201 -0
- package/standalone/revogr-order-editor2.js.map +1 -0
- package/standalone/revogr-overlay-selection.d.ts +11 -0
- package/standalone/revogr-overlay-selection.js +12 -0
- package/standalone/revogr-overlay-selection.js.map +1 -0
- package/standalone/revogr-overlay-selection2.js +972 -0
- package/standalone/revogr-overlay-selection2.js.map +1 -0
- package/standalone/revogr-row-headers.d.ts +11 -0
- package/standalone/revogr-row-headers.js +12 -0
- package/standalone/revogr-row-headers.js.map +1 -0
- package/standalone/revogr-row-headers2.js +520 -0
- package/standalone/revogr-row-headers2.js.map +1 -0
- package/standalone/revogr-scroll-virtual.d.ts +11 -0
- package/standalone/revogr-scroll-virtual.js +12 -0
- package/standalone/revogr-scroll-virtual.js.map +1 -0
- package/standalone/revogr-scroll-virtual2.js +184 -0
- package/standalone/revogr-scroll-virtual2.js.map +1 -0
- package/standalone/revogr-temp-range.d.ts +11 -0
- package/standalone/revogr-temp-range.js +12 -0
- package/standalone/revogr-temp-range.js.map +1 -0
- package/standalone/revogr-temp-range2.js +93 -0
- package/standalone/revogr-temp-range2.js.map +1 -0
- package/standalone/revogr-viewport-scroll.d.ts +11 -0
- package/standalone/revogr-viewport-scroll.js +12 -0
- package/standalone/revogr-viewport-scroll.js.map +1 -0
- package/standalone/revogr-viewport-scroll2.js +421 -0
- package/standalone/revogr-viewport-scroll2.js.map +1 -0
- package/standalone/selection.utils.js +179 -0
- package/standalone/selection.utils.js.map +1 -0
- package/standalone/throttle.js +75 -0
- package/standalone/throttle.js.map +1 -0
- package/standalone/toNumber.js +282 -0
- package/standalone/toNumber.js.map +1 -0
- package/standalone/vnode-converter.js +46 -0
- package/standalone/vnode-converter.js.map +1 -0
- package/standalone/vnode-html.d.ts +11 -0
- package/standalone/vnode-html.js +12 -0
- package/standalone/vnode-html.js.map +1 -0
|
@@ -0,0 +1,3553 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Built by LevelSkill.Pro
|
|
3
|
+
*/
|
|
4
|
+
import { a as isObject, b as baseGetTag, r as root, S as Symbol, i as isObjectLike, f as freeGlobal, c as isSymbol, t as toNumber } from './debounce-DTUQ1fY7.js';
|
|
5
|
+
import { a as getRenderingRef, f as forceUpdate } from './index-BAoInZ4V.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Todo:
|
|
9
|
+
* Refactor proxy plugin: when items changed outside proxy get recalculated
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Proxy plugin for data source.
|
|
13
|
+
*
|
|
14
|
+
* This plugin is used keep sortint in the data source, even when trimming is applied sorting has to be preserved.
|
|
15
|
+
*/
|
|
16
|
+
const proxyPlugin = (store) => ({
|
|
17
|
+
/**
|
|
18
|
+
* Set the value of a property in the store.
|
|
19
|
+
* If the key is 'proxyItems' it will filter the items in the data source according to the new value.
|
|
20
|
+
* The new value should be an array of numbers representing the indexes of the items that should be visible.
|
|
21
|
+
* The method will return a new array of numbers with the indexes of the items that should be visible.
|
|
22
|
+
* The method will also update the 'items' property of the store with the new array.
|
|
23
|
+
*/
|
|
24
|
+
set(k, newVal) {
|
|
25
|
+
if (k !== 'proxyItems') {
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Getting existing collection of items (trimmed and filtered)
|
|
30
|
+
* Mark indexes as visible
|
|
31
|
+
*/
|
|
32
|
+
const oldItems = store.get('items').reduce((r, v) => {
|
|
33
|
+
r.add(v);
|
|
34
|
+
return r;
|
|
35
|
+
}, new Set());
|
|
36
|
+
/**
|
|
37
|
+
* Check if new values where present in items, keep filtering and trimming
|
|
38
|
+
*/
|
|
39
|
+
const newItems = newVal.reduce((r, i) => {
|
|
40
|
+
if (oldItems.has(i)) {
|
|
41
|
+
r.push(i);
|
|
42
|
+
}
|
|
43
|
+
return r;
|
|
44
|
+
}, []);
|
|
45
|
+
store.set('items', newItems);
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* The base implementation of `_.findIndex` and `_.findLastIndex` without
|
|
51
|
+
* support for iteratee shorthands.
|
|
52
|
+
*
|
|
53
|
+
* @private
|
|
54
|
+
* @param {Array} array The array to inspect.
|
|
55
|
+
* @param {Function} predicate The function invoked per iteration.
|
|
56
|
+
* @param {number} fromIndex The index to search from.
|
|
57
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
58
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
59
|
+
*/
|
|
60
|
+
function baseFindIndex(array, predicate, fromIndex, fromRight) {
|
|
61
|
+
var length = array.length,
|
|
62
|
+
index = fromIndex + (-1);
|
|
63
|
+
|
|
64
|
+
while ((++index < length)) {
|
|
65
|
+
if (predicate(array[index], index, array)) {
|
|
66
|
+
return index;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return -1;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Removes all key-value entries from the list cache.
|
|
74
|
+
*
|
|
75
|
+
* @private
|
|
76
|
+
* @name clear
|
|
77
|
+
* @memberOf ListCache
|
|
78
|
+
*/
|
|
79
|
+
function listCacheClear() {
|
|
80
|
+
this.__data__ = [];
|
|
81
|
+
this.size = 0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Performs a
|
|
86
|
+
* [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
|
|
87
|
+
* comparison between two values to determine if they are equivalent.
|
|
88
|
+
*
|
|
89
|
+
* @static
|
|
90
|
+
* @memberOf _
|
|
91
|
+
* @since 4.0.0
|
|
92
|
+
* @category Lang
|
|
93
|
+
* @param {*} value The value to compare.
|
|
94
|
+
* @param {*} other The other value to compare.
|
|
95
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
96
|
+
* @example
|
|
97
|
+
*
|
|
98
|
+
* var object = { 'a': 1 };
|
|
99
|
+
* var other = { 'a': 1 };
|
|
100
|
+
*
|
|
101
|
+
* _.eq(object, object);
|
|
102
|
+
* // => true
|
|
103
|
+
*
|
|
104
|
+
* _.eq(object, other);
|
|
105
|
+
* // => false
|
|
106
|
+
*
|
|
107
|
+
* _.eq('a', 'a');
|
|
108
|
+
* // => true
|
|
109
|
+
*
|
|
110
|
+
* _.eq('a', Object('a'));
|
|
111
|
+
* // => false
|
|
112
|
+
*
|
|
113
|
+
* _.eq(NaN, NaN);
|
|
114
|
+
* // => true
|
|
115
|
+
*/
|
|
116
|
+
function eq(value, other) {
|
|
117
|
+
return value === other || (value !== value && other !== other);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Gets the index at which the `key` is found in `array` of key-value pairs.
|
|
122
|
+
*
|
|
123
|
+
* @private
|
|
124
|
+
* @param {Array} array The array to inspect.
|
|
125
|
+
* @param {*} key The key to search for.
|
|
126
|
+
* @returns {number} Returns the index of the matched value, else `-1`.
|
|
127
|
+
*/
|
|
128
|
+
function assocIndexOf(array, key) {
|
|
129
|
+
var length = array.length;
|
|
130
|
+
while (length--) {
|
|
131
|
+
if (eq(array[length][0], key)) {
|
|
132
|
+
return length;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return -1;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/** Used for built-in method references. */
|
|
139
|
+
var arrayProto = Array.prototype;
|
|
140
|
+
|
|
141
|
+
/** Built-in value references. */
|
|
142
|
+
var splice = arrayProto.splice;
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Removes `key` and its value from the list cache.
|
|
146
|
+
*
|
|
147
|
+
* @private
|
|
148
|
+
* @name delete
|
|
149
|
+
* @memberOf ListCache
|
|
150
|
+
* @param {string} key The key of the value to remove.
|
|
151
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
152
|
+
*/
|
|
153
|
+
function listCacheDelete(key) {
|
|
154
|
+
var data = this.__data__,
|
|
155
|
+
index = assocIndexOf(data, key);
|
|
156
|
+
|
|
157
|
+
if (index < 0) {
|
|
158
|
+
return false;
|
|
159
|
+
}
|
|
160
|
+
var lastIndex = data.length - 1;
|
|
161
|
+
if (index == lastIndex) {
|
|
162
|
+
data.pop();
|
|
163
|
+
} else {
|
|
164
|
+
splice.call(data, index, 1);
|
|
165
|
+
}
|
|
166
|
+
--this.size;
|
|
167
|
+
return true;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Gets the list cache value for `key`.
|
|
172
|
+
*
|
|
173
|
+
* @private
|
|
174
|
+
* @name get
|
|
175
|
+
* @memberOf ListCache
|
|
176
|
+
* @param {string} key The key of the value to get.
|
|
177
|
+
* @returns {*} Returns the entry value.
|
|
178
|
+
*/
|
|
179
|
+
function listCacheGet(key) {
|
|
180
|
+
var data = this.__data__,
|
|
181
|
+
index = assocIndexOf(data, key);
|
|
182
|
+
|
|
183
|
+
return index < 0 ? undefined : data[index][1];
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Checks if a list cache value for `key` exists.
|
|
188
|
+
*
|
|
189
|
+
* @private
|
|
190
|
+
* @name has
|
|
191
|
+
* @memberOf ListCache
|
|
192
|
+
* @param {string} key The key of the entry to check.
|
|
193
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
194
|
+
*/
|
|
195
|
+
function listCacheHas(key) {
|
|
196
|
+
return assocIndexOf(this.__data__, key) > -1;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Sets the list cache `key` to `value`.
|
|
201
|
+
*
|
|
202
|
+
* @private
|
|
203
|
+
* @name set
|
|
204
|
+
* @memberOf ListCache
|
|
205
|
+
* @param {string} key The key of the value to set.
|
|
206
|
+
* @param {*} value The value to set.
|
|
207
|
+
* @returns {Object} Returns the list cache instance.
|
|
208
|
+
*/
|
|
209
|
+
function listCacheSet(key, value) {
|
|
210
|
+
var data = this.__data__,
|
|
211
|
+
index = assocIndexOf(data, key);
|
|
212
|
+
|
|
213
|
+
if (index < 0) {
|
|
214
|
+
++this.size;
|
|
215
|
+
data.push([key, value]);
|
|
216
|
+
} else {
|
|
217
|
+
data[index][1] = value;
|
|
218
|
+
}
|
|
219
|
+
return this;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Creates an list cache object.
|
|
224
|
+
*
|
|
225
|
+
* @private
|
|
226
|
+
* @constructor
|
|
227
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
228
|
+
*/
|
|
229
|
+
function ListCache(entries) {
|
|
230
|
+
var index = -1,
|
|
231
|
+
length = entries == null ? 0 : entries.length;
|
|
232
|
+
|
|
233
|
+
this.clear();
|
|
234
|
+
while (++index < length) {
|
|
235
|
+
var entry = entries[index];
|
|
236
|
+
this.set(entry[0], entry[1]);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Add methods to `ListCache`.
|
|
241
|
+
ListCache.prototype.clear = listCacheClear;
|
|
242
|
+
ListCache.prototype['delete'] = listCacheDelete;
|
|
243
|
+
ListCache.prototype.get = listCacheGet;
|
|
244
|
+
ListCache.prototype.has = listCacheHas;
|
|
245
|
+
ListCache.prototype.set = listCacheSet;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Removes all key-value entries from the stack.
|
|
249
|
+
*
|
|
250
|
+
* @private
|
|
251
|
+
* @name clear
|
|
252
|
+
* @memberOf Stack
|
|
253
|
+
*/
|
|
254
|
+
function stackClear() {
|
|
255
|
+
this.__data__ = new ListCache;
|
|
256
|
+
this.size = 0;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* Removes `key` and its value from the stack.
|
|
261
|
+
*
|
|
262
|
+
* @private
|
|
263
|
+
* @name delete
|
|
264
|
+
* @memberOf Stack
|
|
265
|
+
* @param {string} key The key of the value to remove.
|
|
266
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
267
|
+
*/
|
|
268
|
+
function stackDelete(key) {
|
|
269
|
+
var data = this.__data__,
|
|
270
|
+
result = data['delete'](key);
|
|
271
|
+
|
|
272
|
+
this.size = data.size;
|
|
273
|
+
return result;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/**
|
|
277
|
+
* Gets the stack value for `key`.
|
|
278
|
+
*
|
|
279
|
+
* @private
|
|
280
|
+
* @name get
|
|
281
|
+
* @memberOf Stack
|
|
282
|
+
* @param {string} key The key of the value to get.
|
|
283
|
+
* @returns {*} Returns the entry value.
|
|
284
|
+
*/
|
|
285
|
+
function stackGet(key) {
|
|
286
|
+
return this.__data__.get(key);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Checks if a stack value for `key` exists.
|
|
291
|
+
*
|
|
292
|
+
* @private
|
|
293
|
+
* @name has
|
|
294
|
+
* @memberOf Stack
|
|
295
|
+
* @param {string} key The key of the entry to check.
|
|
296
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
297
|
+
*/
|
|
298
|
+
function stackHas(key) {
|
|
299
|
+
return this.__data__.has(key);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/** `Object#toString` result references. */
|
|
303
|
+
var asyncTag = '[object AsyncFunction]',
|
|
304
|
+
funcTag$1 = '[object Function]',
|
|
305
|
+
genTag = '[object GeneratorFunction]',
|
|
306
|
+
proxyTag = '[object Proxy]';
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* Checks if `value` is classified as a `Function` object.
|
|
310
|
+
*
|
|
311
|
+
* @static
|
|
312
|
+
* @memberOf _
|
|
313
|
+
* @since 0.1.0
|
|
314
|
+
* @category Lang
|
|
315
|
+
* @param {*} value The value to check.
|
|
316
|
+
* @returns {boolean} Returns `true` if `value` is a function, else `false`.
|
|
317
|
+
* @example
|
|
318
|
+
*
|
|
319
|
+
* _.isFunction(_);
|
|
320
|
+
* // => true
|
|
321
|
+
*
|
|
322
|
+
* _.isFunction(/abc/);
|
|
323
|
+
* // => false
|
|
324
|
+
*/
|
|
325
|
+
function isFunction(value) {
|
|
326
|
+
if (!isObject(value)) {
|
|
327
|
+
return false;
|
|
328
|
+
}
|
|
329
|
+
// The use of `Object#toString` avoids issues with the `typeof` operator
|
|
330
|
+
// in Safari 9 which returns 'object' for typed arrays and other constructors.
|
|
331
|
+
var tag = baseGetTag(value);
|
|
332
|
+
return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
/** Used to detect overreaching core-js shims. */
|
|
336
|
+
var coreJsData = root['__core-js_shared__'];
|
|
337
|
+
|
|
338
|
+
/** Used to detect methods masquerading as native. */
|
|
339
|
+
var maskSrcKey = (function() {
|
|
340
|
+
var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || '');
|
|
341
|
+
return uid ? ('Symbol(src)_1.' + uid) : '';
|
|
342
|
+
}());
|
|
343
|
+
|
|
344
|
+
/**
|
|
345
|
+
* Checks if `func` has its source masked.
|
|
346
|
+
*
|
|
347
|
+
* @private
|
|
348
|
+
* @param {Function} func The function to check.
|
|
349
|
+
* @returns {boolean} Returns `true` if `func` is masked, else `false`.
|
|
350
|
+
*/
|
|
351
|
+
function isMasked(func) {
|
|
352
|
+
return !!maskSrcKey && (maskSrcKey in func);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
/** Used for built-in method references. */
|
|
356
|
+
var funcProto$1 = Function.prototype;
|
|
357
|
+
|
|
358
|
+
/** Used to resolve the decompiled source of functions. */
|
|
359
|
+
var funcToString$1 = funcProto$1.toString;
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Converts `func` to its source code.
|
|
363
|
+
*
|
|
364
|
+
* @private
|
|
365
|
+
* @param {Function} func The function to convert.
|
|
366
|
+
* @returns {string} Returns the source code.
|
|
367
|
+
*/
|
|
368
|
+
function toSource(func) {
|
|
369
|
+
if (func != null) {
|
|
370
|
+
try {
|
|
371
|
+
return funcToString$1.call(func);
|
|
372
|
+
} catch (e) {}
|
|
373
|
+
try {
|
|
374
|
+
return (func + '');
|
|
375
|
+
} catch (e) {}
|
|
376
|
+
}
|
|
377
|
+
return '';
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
|
+
* Used to match `RegExp`
|
|
382
|
+
* [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
|
|
383
|
+
*/
|
|
384
|
+
var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
|
385
|
+
|
|
386
|
+
/** Used to detect host constructors (Safari). */
|
|
387
|
+
var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
|
388
|
+
|
|
389
|
+
/** Used for built-in method references. */
|
|
390
|
+
var funcProto = Function.prototype,
|
|
391
|
+
objectProto$9 = Object.prototype;
|
|
392
|
+
|
|
393
|
+
/** Used to resolve the decompiled source of functions. */
|
|
394
|
+
var funcToString = funcProto.toString;
|
|
395
|
+
|
|
396
|
+
/** Used to check objects for own properties. */
|
|
397
|
+
var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
|
|
398
|
+
|
|
399
|
+
/** Used to detect if a method is native. */
|
|
400
|
+
var reIsNative = RegExp('^' +
|
|
401
|
+
funcToString.call(hasOwnProperty$7).replace(reRegExpChar, '\\$&')
|
|
402
|
+
.replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
|
403
|
+
);
|
|
404
|
+
|
|
405
|
+
/**
|
|
406
|
+
* The base implementation of `_.isNative` without bad shim checks.
|
|
407
|
+
*
|
|
408
|
+
* @private
|
|
409
|
+
* @param {*} value The value to check.
|
|
410
|
+
* @returns {boolean} Returns `true` if `value` is a native function,
|
|
411
|
+
* else `false`.
|
|
412
|
+
*/
|
|
413
|
+
function baseIsNative(value) {
|
|
414
|
+
if (!isObject(value) || isMasked(value)) {
|
|
415
|
+
return false;
|
|
416
|
+
}
|
|
417
|
+
var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
|
|
418
|
+
return pattern.test(toSource(value));
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
/**
|
|
422
|
+
* Gets the value at `key` of `object`.
|
|
423
|
+
*
|
|
424
|
+
* @private
|
|
425
|
+
* @param {Object} [object] The object to query.
|
|
426
|
+
* @param {string} key The key of the property to get.
|
|
427
|
+
* @returns {*} Returns the property value.
|
|
428
|
+
*/
|
|
429
|
+
function getValue(object, key) {
|
|
430
|
+
return object == null ? undefined : object[key];
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Gets the native function at `key` of `object`.
|
|
435
|
+
*
|
|
436
|
+
* @private
|
|
437
|
+
* @param {Object} object The object to query.
|
|
438
|
+
* @param {string} key The key of the method to get.
|
|
439
|
+
* @returns {*} Returns the function if it's native, else `undefined`.
|
|
440
|
+
*/
|
|
441
|
+
function getNative(object, key) {
|
|
442
|
+
var value = getValue(object, key);
|
|
443
|
+
return baseIsNative(value) ? value : undefined;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
/* Built-in method references that are verified to be native. */
|
|
447
|
+
var Map$1 = getNative(root, 'Map');
|
|
448
|
+
|
|
449
|
+
/* Built-in method references that are verified to be native. */
|
|
450
|
+
var nativeCreate = getNative(Object, 'create');
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Removes all key-value entries from the hash.
|
|
454
|
+
*
|
|
455
|
+
* @private
|
|
456
|
+
* @name clear
|
|
457
|
+
* @memberOf Hash
|
|
458
|
+
*/
|
|
459
|
+
function hashClear() {
|
|
460
|
+
this.__data__ = nativeCreate ? nativeCreate(null) : {};
|
|
461
|
+
this.size = 0;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* Removes `key` and its value from the hash.
|
|
466
|
+
*
|
|
467
|
+
* @private
|
|
468
|
+
* @name delete
|
|
469
|
+
* @memberOf Hash
|
|
470
|
+
* @param {Object} hash The hash to modify.
|
|
471
|
+
* @param {string} key The key of the value to remove.
|
|
472
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
473
|
+
*/
|
|
474
|
+
function hashDelete(key) {
|
|
475
|
+
var result = this.has(key) && delete this.__data__[key];
|
|
476
|
+
this.size -= result ? 1 : 0;
|
|
477
|
+
return result;
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
481
|
+
var HASH_UNDEFINED$2 = '__lodash_hash_undefined__';
|
|
482
|
+
|
|
483
|
+
/** Used for built-in method references. */
|
|
484
|
+
var objectProto$8 = Object.prototype;
|
|
485
|
+
|
|
486
|
+
/** Used to check objects for own properties. */
|
|
487
|
+
var hasOwnProperty$6 = objectProto$8.hasOwnProperty;
|
|
488
|
+
|
|
489
|
+
/**
|
|
490
|
+
* Gets the hash value for `key`.
|
|
491
|
+
*
|
|
492
|
+
* @private
|
|
493
|
+
* @name get
|
|
494
|
+
* @memberOf Hash
|
|
495
|
+
* @param {string} key The key of the value to get.
|
|
496
|
+
* @returns {*} Returns the entry value.
|
|
497
|
+
*/
|
|
498
|
+
function hashGet(key) {
|
|
499
|
+
var data = this.__data__;
|
|
500
|
+
if (nativeCreate) {
|
|
501
|
+
var result = data[key];
|
|
502
|
+
return result === HASH_UNDEFINED$2 ? undefined : result;
|
|
503
|
+
}
|
|
504
|
+
return hasOwnProperty$6.call(data, key) ? data[key] : undefined;
|
|
505
|
+
}
|
|
506
|
+
|
|
507
|
+
/** Used for built-in method references. */
|
|
508
|
+
var objectProto$7 = Object.prototype;
|
|
509
|
+
|
|
510
|
+
/** Used to check objects for own properties. */
|
|
511
|
+
var hasOwnProperty$5 = objectProto$7.hasOwnProperty;
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Checks if a hash value for `key` exists.
|
|
515
|
+
*
|
|
516
|
+
* @private
|
|
517
|
+
* @name has
|
|
518
|
+
* @memberOf Hash
|
|
519
|
+
* @param {string} key The key of the entry to check.
|
|
520
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
521
|
+
*/
|
|
522
|
+
function hashHas(key) {
|
|
523
|
+
var data = this.__data__;
|
|
524
|
+
return nativeCreate ? (data[key] !== undefined) : hasOwnProperty$5.call(data, key);
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
528
|
+
var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* Sets the hash `key` to `value`.
|
|
532
|
+
*
|
|
533
|
+
* @private
|
|
534
|
+
* @name set
|
|
535
|
+
* @memberOf Hash
|
|
536
|
+
* @param {string} key The key of the value to set.
|
|
537
|
+
* @param {*} value The value to set.
|
|
538
|
+
* @returns {Object} Returns the hash instance.
|
|
539
|
+
*/
|
|
540
|
+
function hashSet(key, value) {
|
|
541
|
+
var data = this.__data__;
|
|
542
|
+
this.size += this.has(key) ? 0 : 1;
|
|
543
|
+
data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
|
|
544
|
+
return this;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Creates a hash object.
|
|
549
|
+
*
|
|
550
|
+
* @private
|
|
551
|
+
* @constructor
|
|
552
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
553
|
+
*/
|
|
554
|
+
function Hash(entries) {
|
|
555
|
+
var index = -1,
|
|
556
|
+
length = entries == null ? 0 : entries.length;
|
|
557
|
+
|
|
558
|
+
this.clear();
|
|
559
|
+
while (++index < length) {
|
|
560
|
+
var entry = entries[index];
|
|
561
|
+
this.set(entry[0], entry[1]);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
// Add methods to `Hash`.
|
|
566
|
+
Hash.prototype.clear = hashClear;
|
|
567
|
+
Hash.prototype['delete'] = hashDelete;
|
|
568
|
+
Hash.prototype.get = hashGet;
|
|
569
|
+
Hash.prototype.has = hashHas;
|
|
570
|
+
Hash.prototype.set = hashSet;
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Removes all key-value entries from the map.
|
|
574
|
+
*
|
|
575
|
+
* @private
|
|
576
|
+
* @name clear
|
|
577
|
+
* @memberOf MapCache
|
|
578
|
+
*/
|
|
579
|
+
function mapCacheClear() {
|
|
580
|
+
this.size = 0;
|
|
581
|
+
this.__data__ = {
|
|
582
|
+
'hash': new Hash,
|
|
583
|
+
'map': new (Map$1 || ListCache),
|
|
584
|
+
'string': new Hash
|
|
585
|
+
};
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* Checks if `value` is suitable for use as unique object key.
|
|
590
|
+
*
|
|
591
|
+
* @private
|
|
592
|
+
* @param {*} value The value to check.
|
|
593
|
+
* @returns {boolean} Returns `true` if `value` is suitable, else `false`.
|
|
594
|
+
*/
|
|
595
|
+
function isKeyable(value) {
|
|
596
|
+
var type = typeof value;
|
|
597
|
+
return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean')
|
|
598
|
+
? (value !== '__proto__')
|
|
599
|
+
: (value === null);
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Gets the data for `map`.
|
|
604
|
+
*
|
|
605
|
+
* @private
|
|
606
|
+
* @param {Object} map The map to query.
|
|
607
|
+
* @param {string} key The reference key.
|
|
608
|
+
* @returns {*} Returns the map data.
|
|
609
|
+
*/
|
|
610
|
+
function getMapData(map, key) {
|
|
611
|
+
var data = map.__data__;
|
|
612
|
+
return isKeyable(key)
|
|
613
|
+
? data[typeof key == 'string' ? 'string' : 'hash']
|
|
614
|
+
: data.map;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Removes `key` and its value from the map.
|
|
619
|
+
*
|
|
620
|
+
* @private
|
|
621
|
+
* @name delete
|
|
622
|
+
* @memberOf MapCache
|
|
623
|
+
* @param {string} key The key of the value to remove.
|
|
624
|
+
* @returns {boolean} Returns `true` if the entry was removed, else `false`.
|
|
625
|
+
*/
|
|
626
|
+
function mapCacheDelete(key) {
|
|
627
|
+
var result = getMapData(this, key)['delete'](key);
|
|
628
|
+
this.size -= result ? 1 : 0;
|
|
629
|
+
return result;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Gets the map value for `key`.
|
|
634
|
+
*
|
|
635
|
+
* @private
|
|
636
|
+
* @name get
|
|
637
|
+
* @memberOf MapCache
|
|
638
|
+
* @param {string} key The key of the value to get.
|
|
639
|
+
* @returns {*} Returns the entry value.
|
|
640
|
+
*/
|
|
641
|
+
function mapCacheGet(key) {
|
|
642
|
+
return getMapData(this, key).get(key);
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* Checks if a map value for `key` exists.
|
|
647
|
+
*
|
|
648
|
+
* @private
|
|
649
|
+
* @name has
|
|
650
|
+
* @memberOf MapCache
|
|
651
|
+
* @param {string} key The key of the entry to check.
|
|
652
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
653
|
+
*/
|
|
654
|
+
function mapCacheHas(key) {
|
|
655
|
+
return getMapData(this, key).has(key);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
|
+
* Sets the map `key` to `value`.
|
|
660
|
+
*
|
|
661
|
+
* @private
|
|
662
|
+
* @name set
|
|
663
|
+
* @memberOf MapCache
|
|
664
|
+
* @param {string} key The key of the value to set.
|
|
665
|
+
* @param {*} value The value to set.
|
|
666
|
+
* @returns {Object} Returns the map cache instance.
|
|
667
|
+
*/
|
|
668
|
+
function mapCacheSet(key, value) {
|
|
669
|
+
var data = getMapData(this, key),
|
|
670
|
+
size = data.size;
|
|
671
|
+
|
|
672
|
+
data.set(key, value);
|
|
673
|
+
this.size += data.size == size ? 0 : 1;
|
|
674
|
+
return this;
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* Creates a map cache object to store key-value pairs.
|
|
679
|
+
*
|
|
680
|
+
* @private
|
|
681
|
+
* @constructor
|
|
682
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
683
|
+
*/
|
|
684
|
+
function MapCache(entries) {
|
|
685
|
+
var index = -1,
|
|
686
|
+
length = entries == null ? 0 : entries.length;
|
|
687
|
+
|
|
688
|
+
this.clear();
|
|
689
|
+
while (++index < length) {
|
|
690
|
+
var entry = entries[index];
|
|
691
|
+
this.set(entry[0], entry[1]);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
// Add methods to `MapCache`.
|
|
696
|
+
MapCache.prototype.clear = mapCacheClear;
|
|
697
|
+
MapCache.prototype['delete'] = mapCacheDelete;
|
|
698
|
+
MapCache.prototype.get = mapCacheGet;
|
|
699
|
+
MapCache.prototype.has = mapCacheHas;
|
|
700
|
+
MapCache.prototype.set = mapCacheSet;
|
|
701
|
+
|
|
702
|
+
/** Used as the size to enable large array optimizations. */
|
|
703
|
+
var LARGE_ARRAY_SIZE = 200;
|
|
704
|
+
|
|
705
|
+
/**
|
|
706
|
+
* Sets the stack `key` to `value`.
|
|
707
|
+
*
|
|
708
|
+
* @private
|
|
709
|
+
* @name set
|
|
710
|
+
* @memberOf Stack
|
|
711
|
+
* @param {string} key The key of the value to set.
|
|
712
|
+
* @param {*} value The value to set.
|
|
713
|
+
* @returns {Object} Returns the stack cache instance.
|
|
714
|
+
*/
|
|
715
|
+
function stackSet(key, value) {
|
|
716
|
+
var data = this.__data__;
|
|
717
|
+
if (data instanceof ListCache) {
|
|
718
|
+
var pairs = data.__data__;
|
|
719
|
+
if (!Map$1 || (pairs.length < LARGE_ARRAY_SIZE - 1)) {
|
|
720
|
+
pairs.push([key, value]);
|
|
721
|
+
this.size = ++data.size;
|
|
722
|
+
return this;
|
|
723
|
+
}
|
|
724
|
+
data = this.__data__ = new MapCache(pairs);
|
|
725
|
+
}
|
|
726
|
+
data.set(key, value);
|
|
727
|
+
this.size = data.size;
|
|
728
|
+
return this;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
/**
|
|
732
|
+
* Creates a stack cache object to store key-value pairs.
|
|
733
|
+
*
|
|
734
|
+
* @private
|
|
735
|
+
* @constructor
|
|
736
|
+
* @param {Array} [entries] The key-value pairs to cache.
|
|
737
|
+
*/
|
|
738
|
+
function Stack(entries) {
|
|
739
|
+
var data = this.__data__ = new ListCache(entries);
|
|
740
|
+
this.size = data.size;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
// Add methods to `Stack`.
|
|
744
|
+
Stack.prototype.clear = stackClear;
|
|
745
|
+
Stack.prototype['delete'] = stackDelete;
|
|
746
|
+
Stack.prototype.get = stackGet;
|
|
747
|
+
Stack.prototype.has = stackHas;
|
|
748
|
+
Stack.prototype.set = stackSet;
|
|
749
|
+
|
|
750
|
+
/** Used to stand-in for `undefined` hash values. */
|
|
751
|
+
var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* Adds `value` to the array cache.
|
|
755
|
+
*
|
|
756
|
+
* @private
|
|
757
|
+
* @name add
|
|
758
|
+
* @memberOf SetCache
|
|
759
|
+
* @alias push
|
|
760
|
+
* @param {*} value The value to cache.
|
|
761
|
+
* @returns {Object} Returns the cache instance.
|
|
762
|
+
*/
|
|
763
|
+
function setCacheAdd(value) {
|
|
764
|
+
this.__data__.set(value, HASH_UNDEFINED);
|
|
765
|
+
return this;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
/**
|
|
769
|
+
* Checks if `value` is in the array cache.
|
|
770
|
+
*
|
|
771
|
+
* @private
|
|
772
|
+
* @name has
|
|
773
|
+
* @memberOf SetCache
|
|
774
|
+
* @param {*} value The value to search for.
|
|
775
|
+
* @returns {number} Returns `true` if `value` is found, else `false`.
|
|
776
|
+
*/
|
|
777
|
+
function setCacheHas(value) {
|
|
778
|
+
return this.__data__.has(value);
|
|
779
|
+
}
|
|
780
|
+
|
|
781
|
+
/**
|
|
782
|
+
*
|
|
783
|
+
* Creates an array cache object to store unique values.
|
|
784
|
+
*
|
|
785
|
+
* @private
|
|
786
|
+
* @constructor
|
|
787
|
+
* @param {Array} [values] The values to cache.
|
|
788
|
+
*/
|
|
789
|
+
function SetCache(values) {
|
|
790
|
+
var index = -1,
|
|
791
|
+
length = values == null ? 0 : values.length;
|
|
792
|
+
|
|
793
|
+
this.__data__ = new MapCache;
|
|
794
|
+
while (++index < length) {
|
|
795
|
+
this.add(values[index]);
|
|
796
|
+
}
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// Add methods to `SetCache`.
|
|
800
|
+
SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
|
|
801
|
+
SetCache.prototype.has = setCacheHas;
|
|
802
|
+
|
|
803
|
+
/**
|
|
804
|
+
* A specialized version of `_.some` for arrays without support for iteratee
|
|
805
|
+
* shorthands.
|
|
806
|
+
*
|
|
807
|
+
* @private
|
|
808
|
+
* @param {Array} [array] The array to iterate over.
|
|
809
|
+
* @param {Function} predicate The function invoked per iteration.
|
|
810
|
+
* @returns {boolean} Returns `true` if any element passes the predicate check,
|
|
811
|
+
* else `false`.
|
|
812
|
+
*/
|
|
813
|
+
function arraySome(array, predicate) {
|
|
814
|
+
var index = -1,
|
|
815
|
+
length = array == null ? 0 : array.length;
|
|
816
|
+
|
|
817
|
+
while (++index < length) {
|
|
818
|
+
if (predicate(array[index], index, array)) {
|
|
819
|
+
return true;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
return false;
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
/**
|
|
826
|
+
* Checks if a `cache` value for `key` exists.
|
|
827
|
+
*
|
|
828
|
+
* @private
|
|
829
|
+
* @param {Object} cache The cache to query.
|
|
830
|
+
* @param {string} key The key of the entry to check.
|
|
831
|
+
* @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
|
|
832
|
+
*/
|
|
833
|
+
function cacheHas(cache, key) {
|
|
834
|
+
return cache.has(key);
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
838
|
+
var COMPARE_PARTIAL_FLAG$5 = 1,
|
|
839
|
+
COMPARE_UNORDERED_FLAG$3 = 2;
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* A specialized version of `baseIsEqualDeep` for arrays with support for
|
|
843
|
+
* partial deep comparisons.
|
|
844
|
+
*
|
|
845
|
+
* @private
|
|
846
|
+
* @param {Array} array The array to compare.
|
|
847
|
+
* @param {Array} other The other array to compare.
|
|
848
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
849
|
+
* @param {Function} customizer The function to customize comparisons.
|
|
850
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
851
|
+
* @param {Object} stack Tracks traversed `array` and `other` objects.
|
|
852
|
+
* @returns {boolean} Returns `true` if the arrays are equivalent, else `false`.
|
|
853
|
+
*/
|
|
854
|
+
function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
|
|
855
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$5,
|
|
856
|
+
arrLength = array.length,
|
|
857
|
+
othLength = other.length;
|
|
858
|
+
|
|
859
|
+
if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
|
|
860
|
+
return false;
|
|
861
|
+
}
|
|
862
|
+
// Check that cyclic values are equal.
|
|
863
|
+
var arrStacked = stack.get(array);
|
|
864
|
+
var othStacked = stack.get(other);
|
|
865
|
+
if (arrStacked && othStacked) {
|
|
866
|
+
return arrStacked == other && othStacked == array;
|
|
867
|
+
}
|
|
868
|
+
var index = -1,
|
|
869
|
+
result = true,
|
|
870
|
+
seen = (bitmask & COMPARE_UNORDERED_FLAG$3) ? new SetCache : undefined;
|
|
871
|
+
|
|
872
|
+
stack.set(array, other);
|
|
873
|
+
stack.set(other, array);
|
|
874
|
+
|
|
875
|
+
// Ignore non-index properties.
|
|
876
|
+
while (++index < arrLength) {
|
|
877
|
+
var arrValue = array[index],
|
|
878
|
+
othValue = other[index];
|
|
879
|
+
|
|
880
|
+
if (customizer) {
|
|
881
|
+
var compared = isPartial
|
|
882
|
+
? customizer(othValue, arrValue, index, other, array, stack)
|
|
883
|
+
: customizer(arrValue, othValue, index, array, other, stack);
|
|
884
|
+
}
|
|
885
|
+
if (compared !== undefined) {
|
|
886
|
+
if (compared) {
|
|
887
|
+
continue;
|
|
888
|
+
}
|
|
889
|
+
result = false;
|
|
890
|
+
break;
|
|
891
|
+
}
|
|
892
|
+
// Recursively compare arrays (susceptible to call stack limits).
|
|
893
|
+
if (seen) {
|
|
894
|
+
if (!arraySome(other, function(othValue, othIndex) {
|
|
895
|
+
if (!cacheHas(seen, othIndex) &&
|
|
896
|
+
(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
|
|
897
|
+
return seen.push(othIndex);
|
|
898
|
+
}
|
|
899
|
+
})) {
|
|
900
|
+
result = false;
|
|
901
|
+
break;
|
|
902
|
+
}
|
|
903
|
+
} else if (!(
|
|
904
|
+
arrValue === othValue ||
|
|
905
|
+
equalFunc(arrValue, othValue, bitmask, customizer, stack)
|
|
906
|
+
)) {
|
|
907
|
+
result = false;
|
|
908
|
+
break;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
stack['delete'](array);
|
|
912
|
+
stack['delete'](other);
|
|
913
|
+
return result;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
/** Built-in value references. */
|
|
917
|
+
var Uint8Array = root.Uint8Array;
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
* Converts `map` to its key-value pairs.
|
|
921
|
+
*
|
|
922
|
+
* @private
|
|
923
|
+
* @param {Object} map The map to convert.
|
|
924
|
+
* @returns {Array} Returns the key-value pairs.
|
|
925
|
+
*/
|
|
926
|
+
function mapToArray(map) {
|
|
927
|
+
var index = -1,
|
|
928
|
+
result = Array(map.size);
|
|
929
|
+
|
|
930
|
+
map.forEach(function(value, key) {
|
|
931
|
+
result[++index] = [key, value];
|
|
932
|
+
});
|
|
933
|
+
return result;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
|
+
* Converts `set` to an array of its values.
|
|
938
|
+
*
|
|
939
|
+
* @private
|
|
940
|
+
* @param {Object} set The set to convert.
|
|
941
|
+
* @returns {Array} Returns the values.
|
|
942
|
+
*/
|
|
943
|
+
function setToArray(set) {
|
|
944
|
+
var index = -1,
|
|
945
|
+
result = Array(set.size);
|
|
946
|
+
|
|
947
|
+
set.forEach(function(value) {
|
|
948
|
+
result[++index] = value;
|
|
949
|
+
});
|
|
950
|
+
return result;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
954
|
+
var COMPARE_PARTIAL_FLAG$4 = 1,
|
|
955
|
+
COMPARE_UNORDERED_FLAG$2 = 2;
|
|
956
|
+
|
|
957
|
+
/** `Object#toString` result references. */
|
|
958
|
+
var boolTag$1 = '[object Boolean]',
|
|
959
|
+
dateTag$1 = '[object Date]',
|
|
960
|
+
errorTag$1 = '[object Error]',
|
|
961
|
+
mapTag$2 = '[object Map]',
|
|
962
|
+
numberTag$1 = '[object Number]',
|
|
963
|
+
regexpTag$1 = '[object RegExp]',
|
|
964
|
+
setTag$2 = '[object Set]',
|
|
965
|
+
stringTag$1 = '[object String]',
|
|
966
|
+
symbolTag = '[object Symbol]';
|
|
967
|
+
|
|
968
|
+
var arrayBufferTag$1 = '[object ArrayBuffer]',
|
|
969
|
+
dataViewTag$2 = '[object DataView]';
|
|
970
|
+
|
|
971
|
+
/** Used to convert symbols to primitives and strings. */
|
|
972
|
+
var symbolProto$1 = Symbol ? Symbol.prototype : undefined,
|
|
973
|
+
symbolValueOf = symbolProto$1 ? symbolProto$1.valueOf : undefined;
|
|
974
|
+
|
|
975
|
+
/**
|
|
976
|
+
* A specialized version of `baseIsEqualDeep` for comparing objects of
|
|
977
|
+
* the same `toStringTag`.
|
|
978
|
+
*
|
|
979
|
+
* **Note:** This function only supports comparing values with tags of
|
|
980
|
+
* `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`.
|
|
981
|
+
*
|
|
982
|
+
* @private
|
|
983
|
+
* @param {Object} object The object to compare.
|
|
984
|
+
* @param {Object} other The other object to compare.
|
|
985
|
+
* @param {string} tag The `toStringTag` of the objects to compare.
|
|
986
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
987
|
+
* @param {Function} customizer The function to customize comparisons.
|
|
988
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
989
|
+
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
|
990
|
+
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
991
|
+
*/
|
|
992
|
+
function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
|
|
993
|
+
switch (tag) {
|
|
994
|
+
case dataViewTag$2:
|
|
995
|
+
if ((object.byteLength != other.byteLength) ||
|
|
996
|
+
(object.byteOffset != other.byteOffset)) {
|
|
997
|
+
return false;
|
|
998
|
+
}
|
|
999
|
+
object = object.buffer;
|
|
1000
|
+
other = other.buffer;
|
|
1001
|
+
|
|
1002
|
+
case arrayBufferTag$1:
|
|
1003
|
+
if ((object.byteLength != other.byteLength) ||
|
|
1004
|
+
!equalFunc(new Uint8Array(object), new Uint8Array(other))) {
|
|
1005
|
+
return false;
|
|
1006
|
+
}
|
|
1007
|
+
return true;
|
|
1008
|
+
|
|
1009
|
+
case boolTag$1:
|
|
1010
|
+
case dateTag$1:
|
|
1011
|
+
case numberTag$1:
|
|
1012
|
+
// Coerce booleans to `1` or `0` and dates to milliseconds.
|
|
1013
|
+
// Invalid dates are coerced to `NaN`.
|
|
1014
|
+
return eq(+object, +other);
|
|
1015
|
+
|
|
1016
|
+
case errorTag$1:
|
|
1017
|
+
return object.name == other.name && object.message == other.message;
|
|
1018
|
+
|
|
1019
|
+
case regexpTag$1:
|
|
1020
|
+
case stringTag$1:
|
|
1021
|
+
// Coerce regexes to strings and treat strings, primitives and objects,
|
|
1022
|
+
// as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring
|
|
1023
|
+
// for more details.
|
|
1024
|
+
return object == (other + '');
|
|
1025
|
+
|
|
1026
|
+
case mapTag$2:
|
|
1027
|
+
var convert = mapToArray;
|
|
1028
|
+
|
|
1029
|
+
case setTag$2:
|
|
1030
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$4;
|
|
1031
|
+
convert || (convert = setToArray);
|
|
1032
|
+
|
|
1033
|
+
if (object.size != other.size && !isPartial) {
|
|
1034
|
+
return false;
|
|
1035
|
+
}
|
|
1036
|
+
// Assume cyclic values are equal.
|
|
1037
|
+
var stacked = stack.get(object);
|
|
1038
|
+
if (stacked) {
|
|
1039
|
+
return stacked == other;
|
|
1040
|
+
}
|
|
1041
|
+
bitmask |= COMPARE_UNORDERED_FLAG$2;
|
|
1042
|
+
|
|
1043
|
+
// Recursively compare objects (susceptible to call stack limits).
|
|
1044
|
+
stack.set(object, other);
|
|
1045
|
+
var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
|
|
1046
|
+
stack['delete'](object);
|
|
1047
|
+
return result;
|
|
1048
|
+
|
|
1049
|
+
case symbolTag:
|
|
1050
|
+
if (symbolValueOf) {
|
|
1051
|
+
return symbolValueOf.call(object) == symbolValueOf.call(other);
|
|
1052
|
+
}
|
|
1053
|
+
}
|
|
1054
|
+
return false;
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* Appends the elements of `values` to `array`.
|
|
1059
|
+
*
|
|
1060
|
+
* @private
|
|
1061
|
+
* @param {Array} array The array to modify.
|
|
1062
|
+
* @param {Array} values The values to append.
|
|
1063
|
+
* @returns {Array} Returns `array`.
|
|
1064
|
+
*/
|
|
1065
|
+
function arrayPush(array, values) {
|
|
1066
|
+
var index = -1,
|
|
1067
|
+
length = values.length,
|
|
1068
|
+
offset = array.length;
|
|
1069
|
+
|
|
1070
|
+
while (++index < length) {
|
|
1071
|
+
array[offset + index] = values[index];
|
|
1072
|
+
}
|
|
1073
|
+
return array;
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
/**
|
|
1077
|
+
* Checks if `value` is classified as an `Array` object.
|
|
1078
|
+
*
|
|
1079
|
+
* @static
|
|
1080
|
+
* @memberOf _
|
|
1081
|
+
* @since 0.1.0
|
|
1082
|
+
* @category Lang
|
|
1083
|
+
* @param {*} value The value to check.
|
|
1084
|
+
* @returns {boolean} Returns `true` if `value` is an array, else `false`.
|
|
1085
|
+
* @example
|
|
1086
|
+
*
|
|
1087
|
+
* _.isArray([1, 2, 3]);
|
|
1088
|
+
* // => true
|
|
1089
|
+
*
|
|
1090
|
+
* _.isArray(document.body.children);
|
|
1091
|
+
* // => false
|
|
1092
|
+
*
|
|
1093
|
+
* _.isArray('abc');
|
|
1094
|
+
* // => false
|
|
1095
|
+
*
|
|
1096
|
+
* _.isArray(_.noop);
|
|
1097
|
+
* // => false
|
|
1098
|
+
*/
|
|
1099
|
+
var isArray = Array.isArray;
|
|
1100
|
+
|
|
1101
|
+
/**
|
|
1102
|
+
* The base implementation of `getAllKeys` and `getAllKeysIn` which uses
|
|
1103
|
+
* `keysFunc` and `symbolsFunc` to get the enumerable property names and
|
|
1104
|
+
* symbols of `object`.
|
|
1105
|
+
*
|
|
1106
|
+
* @private
|
|
1107
|
+
* @param {Object} object The object to query.
|
|
1108
|
+
* @param {Function} keysFunc The function to get the keys of `object`.
|
|
1109
|
+
* @param {Function} symbolsFunc The function to get the symbols of `object`.
|
|
1110
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
1111
|
+
*/
|
|
1112
|
+
function baseGetAllKeys(object, keysFunc, symbolsFunc) {
|
|
1113
|
+
var result = keysFunc(object);
|
|
1114
|
+
return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
|
|
1115
|
+
}
|
|
1116
|
+
|
|
1117
|
+
/**
|
|
1118
|
+
* A specialized version of `_.filter` for arrays without support for
|
|
1119
|
+
* iteratee shorthands.
|
|
1120
|
+
*
|
|
1121
|
+
* @private
|
|
1122
|
+
* @param {Array} [array] The array to iterate over.
|
|
1123
|
+
* @param {Function} predicate The function invoked per iteration.
|
|
1124
|
+
* @returns {Array} Returns the new filtered array.
|
|
1125
|
+
*/
|
|
1126
|
+
function arrayFilter(array, predicate) {
|
|
1127
|
+
var index = -1,
|
|
1128
|
+
length = array == null ? 0 : array.length,
|
|
1129
|
+
resIndex = 0,
|
|
1130
|
+
result = [];
|
|
1131
|
+
|
|
1132
|
+
while (++index < length) {
|
|
1133
|
+
var value = array[index];
|
|
1134
|
+
if (predicate(value, index, array)) {
|
|
1135
|
+
result[resIndex++] = value;
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
return result;
|
|
1139
|
+
}
|
|
1140
|
+
|
|
1141
|
+
/**
|
|
1142
|
+
* This method returns a new empty array.
|
|
1143
|
+
*
|
|
1144
|
+
* @static
|
|
1145
|
+
* @memberOf _
|
|
1146
|
+
* @since 4.13.0
|
|
1147
|
+
* @category Util
|
|
1148
|
+
* @returns {Array} Returns the new empty array.
|
|
1149
|
+
* @example
|
|
1150
|
+
*
|
|
1151
|
+
* var arrays = _.times(2, _.stubArray);
|
|
1152
|
+
*
|
|
1153
|
+
* console.log(arrays);
|
|
1154
|
+
* // => [[], []]
|
|
1155
|
+
*
|
|
1156
|
+
* console.log(arrays[0] === arrays[1]);
|
|
1157
|
+
* // => false
|
|
1158
|
+
*/
|
|
1159
|
+
function stubArray() {
|
|
1160
|
+
return [];
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
/** Used for built-in method references. */
|
|
1164
|
+
var objectProto$6 = Object.prototype;
|
|
1165
|
+
|
|
1166
|
+
/** Built-in value references. */
|
|
1167
|
+
var propertyIsEnumerable$1 = objectProto$6.propertyIsEnumerable;
|
|
1168
|
+
|
|
1169
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1170
|
+
var nativeGetSymbols = Object.getOwnPropertySymbols;
|
|
1171
|
+
|
|
1172
|
+
/**
|
|
1173
|
+
* Creates an array of the own enumerable symbols of `object`.
|
|
1174
|
+
*
|
|
1175
|
+
* @private
|
|
1176
|
+
* @param {Object} object The object to query.
|
|
1177
|
+
* @returns {Array} Returns the array of symbols.
|
|
1178
|
+
*/
|
|
1179
|
+
var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
|
|
1180
|
+
if (object == null) {
|
|
1181
|
+
return [];
|
|
1182
|
+
}
|
|
1183
|
+
object = Object(object);
|
|
1184
|
+
return arrayFilter(nativeGetSymbols(object), function(symbol) {
|
|
1185
|
+
return propertyIsEnumerable$1.call(object, symbol);
|
|
1186
|
+
});
|
|
1187
|
+
};
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* The base implementation of `_.times` without support for iteratee shorthands
|
|
1191
|
+
* or max array length checks.
|
|
1192
|
+
*
|
|
1193
|
+
* @private
|
|
1194
|
+
* @param {number} n The number of times to invoke `iteratee`.
|
|
1195
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
1196
|
+
* @returns {Array} Returns the array of results.
|
|
1197
|
+
*/
|
|
1198
|
+
function baseTimes(n, iteratee) {
|
|
1199
|
+
var index = -1,
|
|
1200
|
+
result = Array(n);
|
|
1201
|
+
|
|
1202
|
+
while (++index < n) {
|
|
1203
|
+
result[index] = iteratee(index);
|
|
1204
|
+
}
|
|
1205
|
+
return result;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
/** `Object#toString` result references. */
|
|
1209
|
+
var argsTag$2 = '[object Arguments]';
|
|
1210
|
+
|
|
1211
|
+
/**
|
|
1212
|
+
* The base implementation of `_.isArguments`.
|
|
1213
|
+
*
|
|
1214
|
+
* @private
|
|
1215
|
+
* @param {*} value The value to check.
|
|
1216
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
1217
|
+
*/
|
|
1218
|
+
function baseIsArguments(value) {
|
|
1219
|
+
return isObjectLike(value) && baseGetTag(value) == argsTag$2;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
/** Used for built-in method references. */
|
|
1223
|
+
var objectProto$5 = Object.prototype;
|
|
1224
|
+
|
|
1225
|
+
/** Used to check objects for own properties. */
|
|
1226
|
+
var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
|
|
1227
|
+
|
|
1228
|
+
/** Built-in value references. */
|
|
1229
|
+
var propertyIsEnumerable = objectProto$5.propertyIsEnumerable;
|
|
1230
|
+
|
|
1231
|
+
/**
|
|
1232
|
+
* Checks if `value` is likely an `arguments` object.
|
|
1233
|
+
*
|
|
1234
|
+
* @static
|
|
1235
|
+
* @memberOf _
|
|
1236
|
+
* @since 0.1.0
|
|
1237
|
+
* @category Lang
|
|
1238
|
+
* @param {*} value The value to check.
|
|
1239
|
+
* @returns {boolean} Returns `true` if `value` is an `arguments` object,
|
|
1240
|
+
* else `false`.
|
|
1241
|
+
* @example
|
|
1242
|
+
*
|
|
1243
|
+
* _.isArguments(function() { return arguments; }());
|
|
1244
|
+
* // => true
|
|
1245
|
+
*
|
|
1246
|
+
* _.isArguments([1, 2, 3]);
|
|
1247
|
+
* // => false
|
|
1248
|
+
*/
|
|
1249
|
+
var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) {
|
|
1250
|
+
return isObjectLike(value) && hasOwnProperty$4.call(value, 'callee') &&
|
|
1251
|
+
!propertyIsEnumerable.call(value, 'callee');
|
|
1252
|
+
};
|
|
1253
|
+
|
|
1254
|
+
/**
|
|
1255
|
+
* This method returns `false`.
|
|
1256
|
+
*
|
|
1257
|
+
* @static
|
|
1258
|
+
* @memberOf _
|
|
1259
|
+
* @since 4.13.0
|
|
1260
|
+
* @category Util
|
|
1261
|
+
* @returns {boolean} Returns `false`.
|
|
1262
|
+
* @example
|
|
1263
|
+
*
|
|
1264
|
+
* _.times(2, _.stubFalse);
|
|
1265
|
+
* // => [false, false]
|
|
1266
|
+
*/
|
|
1267
|
+
function stubFalse() {
|
|
1268
|
+
return false;
|
|
1269
|
+
}
|
|
1270
|
+
|
|
1271
|
+
/** Detect free variable `exports`. */
|
|
1272
|
+
var freeExports$1 = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
1273
|
+
|
|
1274
|
+
/** Detect free variable `module`. */
|
|
1275
|
+
var freeModule$1 = freeExports$1 && typeof module == 'object' && module && !module.nodeType && module;
|
|
1276
|
+
|
|
1277
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
1278
|
+
var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
|
|
1279
|
+
|
|
1280
|
+
/** Built-in value references. */
|
|
1281
|
+
var Buffer = moduleExports$1 ? root.Buffer : undefined;
|
|
1282
|
+
|
|
1283
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1284
|
+
var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined;
|
|
1285
|
+
|
|
1286
|
+
/**
|
|
1287
|
+
* Checks if `value` is a buffer.
|
|
1288
|
+
*
|
|
1289
|
+
* @static
|
|
1290
|
+
* @memberOf _
|
|
1291
|
+
* @since 4.3.0
|
|
1292
|
+
* @category Lang
|
|
1293
|
+
* @param {*} value The value to check.
|
|
1294
|
+
* @returns {boolean} Returns `true` if `value` is a buffer, else `false`.
|
|
1295
|
+
* @example
|
|
1296
|
+
*
|
|
1297
|
+
* _.isBuffer(new Buffer(2));
|
|
1298
|
+
* // => true
|
|
1299
|
+
*
|
|
1300
|
+
* _.isBuffer(new Uint8Array(2));
|
|
1301
|
+
* // => false
|
|
1302
|
+
*/
|
|
1303
|
+
var isBuffer = nativeIsBuffer || stubFalse;
|
|
1304
|
+
|
|
1305
|
+
/** Used as references for various `Number` constants. */
|
|
1306
|
+
var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
|
1307
|
+
|
|
1308
|
+
/** Used to detect unsigned integer values. */
|
|
1309
|
+
var reIsUint = /^(?:0|[1-9]\d*)$/;
|
|
1310
|
+
|
|
1311
|
+
/**
|
|
1312
|
+
* Checks if `value` is a valid array-like index.
|
|
1313
|
+
*
|
|
1314
|
+
* @private
|
|
1315
|
+
* @param {*} value The value to check.
|
|
1316
|
+
* @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
|
|
1317
|
+
* @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
|
|
1318
|
+
*/
|
|
1319
|
+
function isIndex(value, length) {
|
|
1320
|
+
var type = typeof value;
|
|
1321
|
+
length = length == null ? MAX_SAFE_INTEGER$1 : length;
|
|
1322
|
+
|
|
1323
|
+
return !!length &&
|
|
1324
|
+
(type == 'number' ||
|
|
1325
|
+
(type != 'symbol' && reIsUint.test(value))) &&
|
|
1326
|
+
(value > -1 && value % 1 == 0 && value < length);
|
|
1327
|
+
}
|
|
1328
|
+
|
|
1329
|
+
/** Used as references for various `Number` constants. */
|
|
1330
|
+
var MAX_SAFE_INTEGER = 9007199254740991;
|
|
1331
|
+
|
|
1332
|
+
/**
|
|
1333
|
+
* Checks if `value` is a valid array-like length.
|
|
1334
|
+
*
|
|
1335
|
+
* **Note:** This method is loosely based on
|
|
1336
|
+
* [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
|
|
1337
|
+
*
|
|
1338
|
+
* @static
|
|
1339
|
+
* @memberOf _
|
|
1340
|
+
* @since 4.0.0
|
|
1341
|
+
* @category Lang
|
|
1342
|
+
* @param {*} value The value to check.
|
|
1343
|
+
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
|
|
1344
|
+
* @example
|
|
1345
|
+
*
|
|
1346
|
+
* _.isLength(3);
|
|
1347
|
+
* // => true
|
|
1348
|
+
*
|
|
1349
|
+
* _.isLength(Number.MIN_VALUE);
|
|
1350
|
+
* // => false
|
|
1351
|
+
*
|
|
1352
|
+
* _.isLength(Infinity);
|
|
1353
|
+
* // => false
|
|
1354
|
+
*
|
|
1355
|
+
* _.isLength('3');
|
|
1356
|
+
* // => false
|
|
1357
|
+
*/
|
|
1358
|
+
function isLength(value) {
|
|
1359
|
+
return typeof value == 'number' &&
|
|
1360
|
+
value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
/** `Object#toString` result references. */
|
|
1364
|
+
var argsTag$1 = '[object Arguments]',
|
|
1365
|
+
arrayTag$1 = '[object Array]',
|
|
1366
|
+
boolTag = '[object Boolean]',
|
|
1367
|
+
dateTag = '[object Date]',
|
|
1368
|
+
errorTag = '[object Error]',
|
|
1369
|
+
funcTag = '[object Function]',
|
|
1370
|
+
mapTag$1 = '[object Map]',
|
|
1371
|
+
numberTag = '[object Number]',
|
|
1372
|
+
objectTag$2 = '[object Object]',
|
|
1373
|
+
regexpTag = '[object RegExp]',
|
|
1374
|
+
setTag$1 = '[object Set]',
|
|
1375
|
+
stringTag = '[object String]',
|
|
1376
|
+
weakMapTag$1 = '[object WeakMap]';
|
|
1377
|
+
|
|
1378
|
+
var arrayBufferTag = '[object ArrayBuffer]',
|
|
1379
|
+
dataViewTag$1 = '[object DataView]',
|
|
1380
|
+
float32Tag = '[object Float32Array]',
|
|
1381
|
+
float64Tag = '[object Float64Array]',
|
|
1382
|
+
int8Tag = '[object Int8Array]',
|
|
1383
|
+
int16Tag = '[object Int16Array]',
|
|
1384
|
+
int32Tag = '[object Int32Array]',
|
|
1385
|
+
uint8Tag = '[object Uint8Array]',
|
|
1386
|
+
uint8ClampedTag = '[object Uint8ClampedArray]',
|
|
1387
|
+
uint16Tag = '[object Uint16Array]',
|
|
1388
|
+
uint32Tag = '[object Uint32Array]';
|
|
1389
|
+
|
|
1390
|
+
/** Used to identify `toStringTag` values of typed arrays. */
|
|
1391
|
+
var typedArrayTags = {};
|
|
1392
|
+
typedArrayTags[float32Tag] = typedArrayTags[float64Tag] =
|
|
1393
|
+
typedArrayTags[int8Tag] = typedArrayTags[int16Tag] =
|
|
1394
|
+
typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] =
|
|
1395
|
+
typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] =
|
|
1396
|
+
typedArrayTags[uint32Tag] = true;
|
|
1397
|
+
typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] =
|
|
1398
|
+
typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] =
|
|
1399
|
+
typedArrayTags[dataViewTag$1] = typedArrayTags[dateTag] =
|
|
1400
|
+
typedArrayTags[errorTag] = typedArrayTags[funcTag] =
|
|
1401
|
+
typedArrayTags[mapTag$1] = typedArrayTags[numberTag] =
|
|
1402
|
+
typedArrayTags[objectTag$2] = typedArrayTags[regexpTag] =
|
|
1403
|
+
typedArrayTags[setTag$1] = typedArrayTags[stringTag] =
|
|
1404
|
+
typedArrayTags[weakMapTag$1] = false;
|
|
1405
|
+
|
|
1406
|
+
/**
|
|
1407
|
+
* The base implementation of `_.isTypedArray` without Node.js optimizations.
|
|
1408
|
+
*
|
|
1409
|
+
* @private
|
|
1410
|
+
* @param {*} value The value to check.
|
|
1411
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
1412
|
+
*/
|
|
1413
|
+
function baseIsTypedArray(value) {
|
|
1414
|
+
return isObjectLike(value) &&
|
|
1415
|
+
isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
/**
|
|
1419
|
+
* The base implementation of `_.unary` without support for storing metadata.
|
|
1420
|
+
*
|
|
1421
|
+
* @private
|
|
1422
|
+
* @param {Function} func The function to cap arguments for.
|
|
1423
|
+
* @returns {Function} Returns the new capped function.
|
|
1424
|
+
*/
|
|
1425
|
+
function baseUnary(func) {
|
|
1426
|
+
return function(value) {
|
|
1427
|
+
return func(value);
|
|
1428
|
+
};
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
/** Detect free variable `exports`. */
|
|
1432
|
+
var freeExports = typeof exports == 'object' && exports && !exports.nodeType && exports;
|
|
1433
|
+
|
|
1434
|
+
/** Detect free variable `module`. */
|
|
1435
|
+
var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module;
|
|
1436
|
+
|
|
1437
|
+
/** Detect the popular CommonJS extension `module.exports`. */
|
|
1438
|
+
var moduleExports = freeModule && freeModule.exports === freeExports;
|
|
1439
|
+
|
|
1440
|
+
/** Detect free variable `process` from Node.js. */
|
|
1441
|
+
var freeProcess = moduleExports && freeGlobal.process;
|
|
1442
|
+
|
|
1443
|
+
/** Used to access faster Node.js helpers. */
|
|
1444
|
+
var nodeUtil = (function() {
|
|
1445
|
+
try {
|
|
1446
|
+
// Use `util.types` for Node.js 10+.
|
|
1447
|
+
var types = freeModule && freeModule.require && freeModule.require('util').types;
|
|
1448
|
+
|
|
1449
|
+
if (types) {
|
|
1450
|
+
return types;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
// Legacy `process.binding('util')` for Node.js < 10.
|
|
1454
|
+
return freeProcess && freeProcess.binding && freeProcess.binding('util');
|
|
1455
|
+
} catch (e) {}
|
|
1456
|
+
}());
|
|
1457
|
+
|
|
1458
|
+
/* Node.js helper references. */
|
|
1459
|
+
var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
|
|
1460
|
+
|
|
1461
|
+
/**
|
|
1462
|
+
* Checks if `value` is classified as a typed array.
|
|
1463
|
+
*
|
|
1464
|
+
* @static
|
|
1465
|
+
* @memberOf _
|
|
1466
|
+
* @since 3.0.0
|
|
1467
|
+
* @category Lang
|
|
1468
|
+
* @param {*} value The value to check.
|
|
1469
|
+
* @returns {boolean} Returns `true` if `value` is a typed array, else `false`.
|
|
1470
|
+
* @example
|
|
1471
|
+
*
|
|
1472
|
+
* _.isTypedArray(new Uint8Array);
|
|
1473
|
+
* // => true
|
|
1474
|
+
*
|
|
1475
|
+
* _.isTypedArray([]);
|
|
1476
|
+
* // => false
|
|
1477
|
+
*/
|
|
1478
|
+
var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
|
|
1479
|
+
|
|
1480
|
+
/** Used for built-in method references. */
|
|
1481
|
+
var objectProto$4 = Object.prototype;
|
|
1482
|
+
|
|
1483
|
+
/** Used to check objects for own properties. */
|
|
1484
|
+
var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
|
|
1485
|
+
|
|
1486
|
+
/**
|
|
1487
|
+
* Creates an array of the enumerable property names of the array-like `value`.
|
|
1488
|
+
*
|
|
1489
|
+
* @private
|
|
1490
|
+
* @param {*} value The value to query.
|
|
1491
|
+
* @param {boolean} inherited Specify returning inherited property names.
|
|
1492
|
+
* @returns {Array} Returns the array of property names.
|
|
1493
|
+
*/
|
|
1494
|
+
function arrayLikeKeys(value, inherited) {
|
|
1495
|
+
var isArr = isArray(value),
|
|
1496
|
+
isArg = !isArr && isArguments(value),
|
|
1497
|
+
isBuff = !isArr && !isArg && isBuffer(value),
|
|
1498
|
+
isType = !isArr && !isArg && !isBuff && isTypedArray(value),
|
|
1499
|
+
skipIndexes = isArr || isArg || isBuff || isType,
|
|
1500
|
+
result = skipIndexes ? baseTimes(value.length, String) : [],
|
|
1501
|
+
length = result.length;
|
|
1502
|
+
|
|
1503
|
+
for (var key in value) {
|
|
1504
|
+
if ((hasOwnProperty$3.call(value, key)) &&
|
|
1505
|
+
!(skipIndexes && (
|
|
1506
|
+
// Safari 9 has enumerable `arguments.length` in strict mode.
|
|
1507
|
+
key == 'length' ||
|
|
1508
|
+
// Node.js 0.10 has enumerable non-index properties on buffers.
|
|
1509
|
+
(isBuff && (key == 'offset' || key == 'parent')) ||
|
|
1510
|
+
// PhantomJS 2 has enumerable non-index properties on typed arrays.
|
|
1511
|
+
(isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) ||
|
|
1512
|
+
// Skip index properties.
|
|
1513
|
+
isIndex(key, length)
|
|
1514
|
+
))) {
|
|
1515
|
+
result.push(key);
|
|
1516
|
+
}
|
|
1517
|
+
}
|
|
1518
|
+
return result;
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
/** Used for built-in method references. */
|
|
1522
|
+
var objectProto$3 = Object.prototype;
|
|
1523
|
+
|
|
1524
|
+
/**
|
|
1525
|
+
* Checks if `value` is likely a prototype object.
|
|
1526
|
+
*
|
|
1527
|
+
* @private
|
|
1528
|
+
* @param {*} value The value to check.
|
|
1529
|
+
* @returns {boolean} Returns `true` if `value` is a prototype, else `false`.
|
|
1530
|
+
*/
|
|
1531
|
+
function isPrototype(value) {
|
|
1532
|
+
var Ctor = value && value.constructor,
|
|
1533
|
+
proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$3;
|
|
1534
|
+
|
|
1535
|
+
return value === proto;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
/**
|
|
1539
|
+
* Creates a unary function that invokes `func` with its argument transformed.
|
|
1540
|
+
*
|
|
1541
|
+
* @private
|
|
1542
|
+
* @param {Function} func The function to wrap.
|
|
1543
|
+
* @param {Function} transform The argument transform.
|
|
1544
|
+
* @returns {Function} Returns the new function.
|
|
1545
|
+
*/
|
|
1546
|
+
function overArg(func, transform) {
|
|
1547
|
+
return function(arg) {
|
|
1548
|
+
return func(transform(arg));
|
|
1549
|
+
};
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1552
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
1553
|
+
var nativeKeys = overArg(Object.keys, Object);
|
|
1554
|
+
|
|
1555
|
+
/** Used for built-in method references. */
|
|
1556
|
+
var objectProto$2 = Object.prototype;
|
|
1557
|
+
|
|
1558
|
+
/** Used to check objects for own properties. */
|
|
1559
|
+
var hasOwnProperty$2 = objectProto$2.hasOwnProperty;
|
|
1560
|
+
|
|
1561
|
+
/**
|
|
1562
|
+
* The base implementation of `_.keys` which doesn't treat sparse arrays as dense.
|
|
1563
|
+
*
|
|
1564
|
+
* @private
|
|
1565
|
+
* @param {Object} object The object to query.
|
|
1566
|
+
* @returns {Array} Returns the array of property names.
|
|
1567
|
+
*/
|
|
1568
|
+
function baseKeys(object) {
|
|
1569
|
+
if (!isPrototype(object)) {
|
|
1570
|
+
return nativeKeys(object);
|
|
1571
|
+
}
|
|
1572
|
+
var result = [];
|
|
1573
|
+
for (var key in Object(object)) {
|
|
1574
|
+
if (hasOwnProperty$2.call(object, key) && key != 'constructor') {
|
|
1575
|
+
result.push(key);
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
return result;
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1581
|
+
/**
|
|
1582
|
+
* Checks if `value` is array-like. A value is considered array-like if it's
|
|
1583
|
+
* not a function and has a `value.length` that's an integer greater than or
|
|
1584
|
+
* equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.
|
|
1585
|
+
*
|
|
1586
|
+
* @static
|
|
1587
|
+
* @memberOf _
|
|
1588
|
+
* @since 4.0.0
|
|
1589
|
+
* @category Lang
|
|
1590
|
+
* @param {*} value The value to check.
|
|
1591
|
+
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
|
|
1592
|
+
* @example
|
|
1593
|
+
*
|
|
1594
|
+
* _.isArrayLike([1, 2, 3]);
|
|
1595
|
+
* // => true
|
|
1596
|
+
*
|
|
1597
|
+
* _.isArrayLike(document.body.children);
|
|
1598
|
+
* // => true
|
|
1599
|
+
*
|
|
1600
|
+
* _.isArrayLike('abc');
|
|
1601
|
+
* // => true
|
|
1602
|
+
*
|
|
1603
|
+
* _.isArrayLike(_.noop);
|
|
1604
|
+
* // => false
|
|
1605
|
+
*/
|
|
1606
|
+
function isArrayLike(value) {
|
|
1607
|
+
return value != null && isLength(value.length) && !isFunction(value);
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
/**
|
|
1611
|
+
* Creates an array of the own enumerable property names of `object`.
|
|
1612
|
+
*
|
|
1613
|
+
* **Note:** Non-object values are coerced to objects. See the
|
|
1614
|
+
* [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)
|
|
1615
|
+
* for more details.
|
|
1616
|
+
*
|
|
1617
|
+
* @static
|
|
1618
|
+
* @since 0.1.0
|
|
1619
|
+
* @memberOf _
|
|
1620
|
+
* @category Object
|
|
1621
|
+
* @param {Object} object The object to query.
|
|
1622
|
+
* @returns {Array} Returns the array of property names.
|
|
1623
|
+
* @example
|
|
1624
|
+
*
|
|
1625
|
+
* function Foo() {
|
|
1626
|
+
* this.a = 1;
|
|
1627
|
+
* this.b = 2;
|
|
1628
|
+
* }
|
|
1629
|
+
*
|
|
1630
|
+
* Foo.prototype.c = 3;
|
|
1631
|
+
*
|
|
1632
|
+
* _.keys(new Foo);
|
|
1633
|
+
* // => ['a', 'b'] (iteration order is not guaranteed)
|
|
1634
|
+
*
|
|
1635
|
+
* _.keys('hi');
|
|
1636
|
+
* // => ['0', '1']
|
|
1637
|
+
*/
|
|
1638
|
+
function keys(object) {
|
|
1639
|
+
return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
/**
|
|
1643
|
+
* Creates an array of own enumerable property names and symbols of `object`.
|
|
1644
|
+
*
|
|
1645
|
+
* @private
|
|
1646
|
+
* @param {Object} object The object to query.
|
|
1647
|
+
* @returns {Array} Returns the array of property names and symbols.
|
|
1648
|
+
*/
|
|
1649
|
+
function getAllKeys(object) {
|
|
1650
|
+
return baseGetAllKeys(object, keys, getSymbols);
|
|
1651
|
+
}
|
|
1652
|
+
|
|
1653
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
1654
|
+
var COMPARE_PARTIAL_FLAG$3 = 1;
|
|
1655
|
+
|
|
1656
|
+
/** Used for built-in method references. */
|
|
1657
|
+
var objectProto$1 = Object.prototype;
|
|
1658
|
+
|
|
1659
|
+
/** Used to check objects for own properties. */
|
|
1660
|
+
var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
|
|
1661
|
+
|
|
1662
|
+
/**
|
|
1663
|
+
* A specialized version of `baseIsEqualDeep` for objects with support for
|
|
1664
|
+
* partial deep comparisons.
|
|
1665
|
+
*
|
|
1666
|
+
* @private
|
|
1667
|
+
* @param {Object} object The object to compare.
|
|
1668
|
+
* @param {Object} other The other object to compare.
|
|
1669
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
1670
|
+
* @param {Function} customizer The function to customize comparisons.
|
|
1671
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
1672
|
+
* @param {Object} stack Tracks traversed `object` and `other` objects.
|
|
1673
|
+
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
1674
|
+
*/
|
|
1675
|
+
function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
|
|
1676
|
+
var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3,
|
|
1677
|
+
objProps = getAllKeys(object),
|
|
1678
|
+
objLength = objProps.length,
|
|
1679
|
+
othProps = getAllKeys(other),
|
|
1680
|
+
othLength = othProps.length;
|
|
1681
|
+
|
|
1682
|
+
if (objLength != othLength && !isPartial) {
|
|
1683
|
+
return false;
|
|
1684
|
+
}
|
|
1685
|
+
var index = objLength;
|
|
1686
|
+
while (index--) {
|
|
1687
|
+
var key = objProps[index];
|
|
1688
|
+
if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
|
|
1689
|
+
return false;
|
|
1690
|
+
}
|
|
1691
|
+
}
|
|
1692
|
+
// Check that cyclic values are equal.
|
|
1693
|
+
var objStacked = stack.get(object);
|
|
1694
|
+
var othStacked = stack.get(other);
|
|
1695
|
+
if (objStacked && othStacked) {
|
|
1696
|
+
return objStacked == other && othStacked == object;
|
|
1697
|
+
}
|
|
1698
|
+
var result = true;
|
|
1699
|
+
stack.set(object, other);
|
|
1700
|
+
stack.set(other, object);
|
|
1701
|
+
|
|
1702
|
+
var skipCtor = isPartial;
|
|
1703
|
+
while (++index < objLength) {
|
|
1704
|
+
key = objProps[index];
|
|
1705
|
+
var objValue = object[key],
|
|
1706
|
+
othValue = other[key];
|
|
1707
|
+
|
|
1708
|
+
if (customizer) {
|
|
1709
|
+
var compared = isPartial
|
|
1710
|
+
? customizer(othValue, objValue, key, other, object, stack)
|
|
1711
|
+
: customizer(objValue, othValue, key, object, other, stack);
|
|
1712
|
+
}
|
|
1713
|
+
// Recursively compare objects (susceptible to call stack limits).
|
|
1714
|
+
if (!(compared === undefined
|
|
1715
|
+
? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack))
|
|
1716
|
+
: compared
|
|
1717
|
+
)) {
|
|
1718
|
+
result = false;
|
|
1719
|
+
break;
|
|
1720
|
+
}
|
|
1721
|
+
skipCtor || (skipCtor = key == 'constructor');
|
|
1722
|
+
}
|
|
1723
|
+
if (result && !skipCtor) {
|
|
1724
|
+
var objCtor = object.constructor,
|
|
1725
|
+
othCtor = other.constructor;
|
|
1726
|
+
|
|
1727
|
+
// Non `Object` object instances with different constructors are not equal.
|
|
1728
|
+
if (objCtor != othCtor &&
|
|
1729
|
+
('constructor' in object && 'constructor' in other) &&
|
|
1730
|
+
!(typeof objCtor == 'function' && objCtor instanceof objCtor &&
|
|
1731
|
+
typeof othCtor == 'function' && othCtor instanceof othCtor)) {
|
|
1732
|
+
result = false;
|
|
1733
|
+
}
|
|
1734
|
+
}
|
|
1735
|
+
stack['delete'](object);
|
|
1736
|
+
stack['delete'](other);
|
|
1737
|
+
return result;
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
/* Built-in method references that are verified to be native. */
|
|
1741
|
+
var DataView = getNative(root, 'DataView');
|
|
1742
|
+
|
|
1743
|
+
/* Built-in method references that are verified to be native. */
|
|
1744
|
+
var Promise$1 = getNative(root, 'Promise');
|
|
1745
|
+
|
|
1746
|
+
/* Built-in method references that are verified to be native. */
|
|
1747
|
+
var Set$1 = getNative(root, 'Set');
|
|
1748
|
+
|
|
1749
|
+
/* Built-in method references that are verified to be native. */
|
|
1750
|
+
var WeakMap = getNative(root, 'WeakMap');
|
|
1751
|
+
|
|
1752
|
+
/** `Object#toString` result references. */
|
|
1753
|
+
var mapTag = '[object Map]',
|
|
1754
|
+
objectTag$1 = '[object Object]',
|
|
1755
|
+
promiseTag = '[object Promise]',
|
|
1756
|
+
setTag = '[object Set]',
|
|
1757
|
+
weakMapTag = '[object WeakMap]';
|
|
1758
|
+
|
|
1759
|
+
var dataViewTag = '[object DataView]';
|
|
1760
|
+
|
|
1761
|
+
/** Used to detect maps, sets, and weakmaps. */
|
|
1762
|
+
var dataViewCtorString = toSource(DataView),
|
|
1763
|
+
mapCtorString = toSource(Map$1),
|
|
1764
|
+
promiseCtorString = toSource(Promise$1),
|
|
1765
|
+
setCtorString = toSource(Set$1),
|
|
1766
|
+
weakMapCtorString = toSource(WeakMap);
|
|
1767
|
+
|
|
1768
|
+
/**
|
|
1769
|
+
* Gets the `toStringTag` of `value`.
|
|
1770
|
+
*
|
|
1771
|
+
* @private
|
|
1772
|
+
* @param {*} value The value to query.
|
|
1773
|
+
* @returns {string} Returns the `toStringTag`.
|
|
1774
|
+
*/
|
|
1775
|
+
var getTag = baseGetTag;
|
|
1776
|
+
|
|
1777
|
+
// Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6.
|
|
1778
|
+
if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) ||
|
|
1779
|
+
(Map$1 && getTag(new Map$1) != mapTag) ||
|
|
1780
|
+
(Promise$1 && getTag(Promise$1.resolve()) != promiseTag) ||
|
|
1781
|
+
(Set$1 && getTag(new Set$1) != setTag) ||
|
|
1782
|
+
(WeakMap && getTag(new WeakMap) != weakMapTag)) {
|
|
1783
|
+
getTag = function(value) {
|
|
1784
|
+
var result = baseGetTag(value),
|
|
1785
|
+
Ctor = result == objectTag$1 ? value.constructor : undefined,
|
|
1786
|
+
ctorString = Ctor ? toSource(Ctor) : '';
|
|
1787
|
+
|
|
1788
|
+
if (ctorString) {
|
|
1789
|
+
switch (ctorString) {
|
|
1790
|
+
case dataViewCtorString: return dataViewTag;
|
|
1791
|
+
case mapCtorString: return mapTag;
|
|
1792
|
+
case promiseCtorString: return promiseTag;
|
|
1793
|
+
case setCtorString: return setTag;
|
|
1794
|
+
case weakMapCtorString: return weakMapTag;
|
|
1795
|
+
}
|
|
1796
|
+
}
|
|
1797
|
+
return result;
|
|
1798
|
+
};
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1801
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
1802
|
+
var COMPARE_PARTIAL_FLAG$2 = 1;
|
|
1803
|
+
|
|
1804
|
+
/** `Object#toString` result references. */
|
|
1805
|
+
var argsTag = '[object Arguments]',
|
|
1806
|
+
arrayTag = '[object Array]',
|
|
1807
|
+
objectTag = '[object Object]';
|
|
1808
|
+
|
|
1809
|
+
/** Used for built-in method references. */
|
|
1810
|
+
var objectProto = Object.prototype;
|
|
1811
|
+
|
|
1812
|
+
/** Used to check objects for own properties. */
|
|
1813
|
+
var hasOwnProperty = objectProto.hasOwnProperty;
|
|
1814
|
+
|
|
1815
|
+
/**
|
|
1816
|
+
* A specialized version of `baseIsEqual` for arrays and objects which performs
|
|
1817
|
+
* deep comparisons and tracks traversed objects enabling objects with circular
|
|
1818
|
+
* references to be compared.
|
|
1819
|
+
*
|
|
1820
|
+
* @private
|
|
1821
|
+
* @param {Object} object The object to compare.
|
|
1822
|
+
* @param {Object} other The other object to compare.
|
|
1823
|
+
* @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details.
|
|
1824
|
+
* @param {Function} customizer The function to customize comparisons.
|
|
1825
|
+
* @param {Function} equalFunc The function to determine equivalents of values.
|
|
1826
|
+
* @param {Object} [stack] Tracks traversed `object` and `other` objects.
|
|
1827
|
+
* @returns {boolean} Returns `true` if the objects are equivalent, else `false`.
|
|
1828
|
+
*/
|
|
1829
|
+
function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
|
|
1830
|
+
var objIsArr = isArray(object),
|
|
1831
|
+
othIsArr = isArray(other),
|
|
1832
|
+
objTag = objIsArr ? arrayTag : getTag(object),
|
|
1833
|
+
othTag = othIsArr ? arrayTag : getTag(other);
|
|
1834
|
+
|
|
1835
|
+
objTag = objTag == argsTag ? objectTag : objTag;
|
|
1836
|
+
othTag = othTag == argsTag ? objectTag : othTag;
|
|
1837
|
+
|
|
1838
|
+
var objIsObj = objTag == objectTag,
|
|
1839
|
+
othIsObj = othTag == objectTag,
|
|
1840
|
+
isSameTag = objTag == othTag;
|
|
1841
|
+
|
|
1842
|
+
if (isSameTag && isBuffer(object)) {
|
|
1843
|
+
if (!isBuffer(other)) {
|
|
1844
|
+
return false;
|
|
1845
|
+
}
|
|
1846
|
+
objIsArr = true;
|
|
1847
|
+
objIsObj = false;
|
|
1848
|
+
}
|
|
1849
|
+
if (isSameTag && !objIsObj) {
|
|
1850
|
+
stack || (stack = new Stack);
|
|
1851
|
+
return (objIsArr || isTypedArray(object))
|
|
1852
|
+
? equalArrays(object, other, bitmask, customizer, equalFunc, stack)
|
|
1853
|
+
: equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
|
|
1854
|
+
}
|
|
1855
|
+
if (!(bitmask & COMPARE_PARTIAL_FLAG$2)) {
|
|
1856
|
+
var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'),
|
|
1857
|
+
othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__');
|
|
1858
|
+
|
|
1859
|
+
if (objIsWrapped || othIsWrapped) {
|
|
1860
|
+
var objUnwrapped = objIsWrapped ? object.value() : object,
|
|
1861
|
+
othUnwrapped = othIsWrapped ? other.value() : other;
|
|
1862
|
+
|
|
1863
|
+
stack || (stack = new Stack);
|
|
1864
|
+
return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
|
|
1865
|
+
}
|
|
1866
|
+
}
|
|
1867
|
+
if (!isSameTag) {
|
|
1868
|
+
return false;
|
|
1869
|
+
}
|
|
1870
|
+
stack || (stack = new Stack);
|
|
1871
|
+
return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
|
|
1872
|
+
}
|
|
1873
|
+
|
|
1874
|
+
/**
|
|
1875
|
+
* The base implementation of `_.isEqual` which supports partial comparisons
|
|
1876
|
+
* and tracks traversed objects.
|
|
1877
|
+
*
|
|
1878
|
+
* @private
|
|
1879
|
+
* @param {*} value The value to compare.
|
|
1880
|
+
* @param {*} other The other value to compare.
|
|
1881
|
+
* @param {boolean} bitmask The bitmask flags.
|
|
1882
|
+
* 1 - Unordered comparison
|
|
1883
|
+
* 2 - Partial comparison
|
|
1884
|
+
* @param {Function} [customizer] The function to customize comparisons.
|
|
1885
|
+
* @param {Object} [stack] Tracks traversed `value` and `other` objects.
|
|
1886
|
+
* @returns {boolean} Returns `true` if the values are equivalent, else `false`.
|
|
1887
|
+
*/
|
|
1888
|
+
function baseIsEqual(value, other, bitmask, customizer, stack) {
|
|
1889
|
+
if (value === other) {
|
|
1890
|
+
return true;
|
|
1891
|
+
}
|
|
1892
|
+
if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) {
|
|
1893
|
+
return value !== value && other !== other;
|
|
1894
|
+
}
|
|
1895
|
+
return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
1899
|
+
var COMPARE_PARTIAL_FLAG$1 = 1,
|
|
1900
|
+
COMPARE_UNORDERED_FLAG$1 = 2;
|
|
1901
|
+
|
|
1902
|
+
/**
|
|
1903
|
+
* The base implementation of `_.isMatch` without support for iteratee shorthands.
|
|
1904
|
+
*
|
|
1905
|
+
* @private
|
|
1906
|
+
* @param {Object} object The object to inspect.
|
|
1907
|
+
* @param {Object} source The object of property values to match.
|
|
1908
|
+
* @param {Array} matchData The property names, values, and compare flags to match.
|
|
1909
|
+
* @param {Function} [customizer] The function to customize comparisons.
|
|
1910
|
+
* @returns {boolean} Returns `true` if `object` is a match, else `false`.
|
|
1911
|
+
*/
|
|
1912
|
+
function baseIsMatch(object, source, matchData, customizer) {
|
|
1913
|
+
var index = matchData.length,
|
|
1914
|
+
length = index;
|
|
1915
|
+
|
|
1916
|
+
if (object == null) {
|
|
1917
|
+
return !length;
|
|
1918
|
+
}
|
|
1919
|
+
object = Object(object);
|
|
1920
|
+
while (index--) {
|
|
1921
|
+
var data = matchData[index];
|
|
1922
|
+
if ((data[2])
|
|
1923
|
+
? data[1] !== object[data[0]]
|
|
1924
|
+
: !(data[0] in object)
|
|
1925
|
+
) {
|
|
1926
|
+
return false;
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
while (++index < length) {
|
|
1930
|
+
data = matchData[index];
|
|
1931
|
+
var key = data[0],
|
|
1932
|
+
objValue = object[key],
|
|
1933
|
+
srcValue = data[1];
|
|
1934
|
+
|
|
1935
|
+
if (data[2]) {
|
|
1936
|
+
if (objValue === undefined && !(key in object)) {
|
|
1937
|
+
return false;
|
|
1938
|
+
}
|
|
1939
|
+
} else {
|
|
1940
|
+
var stack = new Stack;
|
|
1941
|
+
var result;
|
|
1942
|
+
if (!(result === undefined
|
|
1943
|
+
? baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG$1 | COMPARE_UNORDERED_FLAG$1, customizer, stack)
|
|
1944
|
+
: result
|
|
1945
|
+
)) {
|
|
1946
|
+
return false;
|
|
1947
|
+
}
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
return true;
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
/**
|
|
1954
|
+
* Checks if `value` is suitable for strict equality comparisons, i.e. `===`.
|
|
1955
|
+
*
|
|
1956
|
+
* @private
|
|
1957
|
+
* @param {*} value The value to check.
|
|
1958
|
+
* @returns {boolean} Returns `true` if `value` if suitable for strict
|
|
1959
|
+
* equality comparisons, else `false`.
|
|
1960
|
+
*/
|
|
1961
|
+
function isStrictComparable(value) {
|
|
1962
|
+
return value === value && !isObject(value);
|
|
1963
|
+
}
|
|
1964
|
+
|
|
1965
|
+
/**
|
|
1966
|
+
* Gets the property names, values, and compare flags of `object`.
|
|
1967
|
+
*
|
|
1968
|
+
* @private
|
|
1969
|
+
* @param {Object} object The object to query.
|
|
1970
|
+
* @returns {Array} Returns the match data of `object`.
|
|
1971
|
+
*/
|
|
1972
|
+
function getMatchData(object) {
|
|
1973
|
+
var result = keys(object),
|
|
1974
|
+
length = result.length;
|
|
1975
|
+
|
|
1976
|
+
while (length--) {
|
|
1977
|
+
var key = result[length],
|
|
1978
|
+
value = object[key];
|
|
1979
|
+
|
|
1980
|
+
result[length] = [key, value, isStrictComparable(value)];
|
|
1981
|
+
}
|
|
1982
|
+
return result;
|
|
1983
|
+
}
|
|
1984
|
+
|
|
1985
|
+
/**
|
|
1986
|
+
* A specialized version of `matchesProperty` for source values suitable
|
|
1987
|
+
* for strict equality comparisons, i.e. `===`.
|
|
1988
|
+
*
|
|
1989
|
+
* @private
|
|
1990
|
+
* @param {string} key The key of the property to get.
|
|
1991
|
+
* @param {*} srcValue The value to match.
|
|
1992
|
+
* @returns {Function} Returns the new spec function.
|
|
1993
|
+
*/
|
|
1994
|
+
function matchesStrictComparable(key, srcValue) {
|
|
1995
|
+
return function(object) {
|
|
1996
|
+
if (object == null) {
|
|
1997
|
+
return false;
|
|
1998
|
+
}
|
|
1999
|
+
return object[key] === srcValue &&
|
|
2000
|
+
(srcValue !== undefined || (key in Object(object)));
|
|
2001
|
+
};
|
|
2002
|
+
}
|
|
2003
|
+
|
|
2004
|
+
/**
|
|
2005
|
+
* The base implementation of `_.matches` which doesn't clone `source`.
|
|
2006
|
+
*
|
|
2007
|
+
* @private
|
|
2008
|
+
* @param {Object} source The object of property values to match.
|
|
2009
|
+
* @returns {Function} Returns the new spec function.
|
|
2010
|
+
*/
|
|
2011
|
+
function baseMatches(source) {
|
|
2012
|
+
var matchData = getMatchData(source);
|
|
2013
|
+
if (matchData.length == 1 && matchData[0][2]) {
|
|
2014
|
+
return matchesStrictComparable(matchData[0][0], matchData[0][1]);
|
|
2015
|
+
}
|
|
2016
|
+
return function(object) {
|
|
2017
|
+
return object === source || baseIsMatch(object, source, matchData);
|
|
2018
|
+
};
|
|
2019
|
+
}
|
|
2020
|
+
|
|
2021
|
+
/** Used to match property names within property paths. */
|
|
2022
|
+
var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,
|
|
2023
|
+
reIsPlainProp = /^\w*$/;
|
|
2024
|
+
|
|
2025
|
+
/**
|
|
2026
|
+
* Checks if `value` is a property name and not a property path.
|
|
2027
|
+
*
|
|
2028
|
+
* @private
|
|
2029
|
+
* @param {*} value The value to check.
|
|
2030
|
+
* @param {Object} [object] The object to query keys on.
|
|
2031
|
+
* @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
|
2032
|
+
*/
|
|
2033
|
+
function isKey(value, object) {
|
|
2034
|
+
if (isArray(value)) {
|
|
2035
|
+
return false;
|
|
2036
|
+
}
|
|
2037
|
+
var type = typeof value;
|
|
2038
|
+
if (type == 'number' || type == 'symbol' || type == 'boolean' ||
|
|
2039
|
+
value == null || isSymbol(value)) {
|
|
2040
|
+
return true;
|
|
2041
|
+
}
|
|
2042
|
+
return reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
|
2043
|
+
(object != null && value in Object(object));
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
/** Error message constants. */
|
|
2047
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
2048
|
+
|
|
2049
|
+
/**
|
|
2050
|
+
* Creates a function that memoizes the result of `func`. If `resolver` is
|
|
2051
|
+
* provided, it determines the cache key for storing the result based on the
|
|
2052
|
+
* arguments provided to the memoized function. By default, the first argument
|
|
2053
|
+
* provided to the memoized function is used as the map cache key. The `func`
|
|
2054
|
+
* is invoked with the `this` binding of the memoized function.
|
|
2055
|
+
*
|
|
2056
|
+
* **Note:** The cache is exposed as the `cache` property on the memoized
|
|
2057
|
+
* function. Its creation may be customized by replacing the `_.memoize.Cache`
|
|
2058
|
+
* constructor with one whose instances implement the
|
|
2059
|
+
* [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
|
|
2060
|
+
* method interface of `clear`, `delete`, `get`, `has`, and `set`.
|
|
2061
|
+
*
|
|
2062
|
+
* @static
|
|
2063
|
+
* @memberOf _
|
|
2064
|
+
* @since 0.1.0
|
|
2065
|
+
* @category Function
|
|
2066
|
+
* @param {Function} func The function to have its output memoized.
|
|
2067
|
+
* @param {Function} [resolver] The function to resolve the cache key.
|
|
2068
|
+
* @returns {Function} Returns the new memoized function.
|
|
2069
|
+
* @example
|
|
2070
|
+
*
|
|
2071
|
+
* var object = { 'a': 1, 'b': 2 };
|
|
2072
|
+
* var other = { 'c': 3, 'd': 4 };
|
|
2073
|
+
*
|
|
2074
|
+
* var values = _.memoize(_.values);
|
|
2075
|
+
* values(object);
|
|
2076
|
+
* // => [1, 2]
|
|
2077
|
+
*
|
|
2078
|
+
* values(other);
|
|
2079
|
+
* // => [3, 4]
|
|
2080
|
+
*
|
|
2081
|
+
* object.a = 2;
|
|
2082
|
+
* values(object);
|
|
2083
|
+
* // => [1, 2]
|
|
2084
|
+
*
|
|
2085
|
+
* // Modify the result cache.
|
|
2086
|
+
* values.cache.set(object, ['a', 'b']);
|
|
2087
|
+
* values(object);
|
|
2088
|
+
* // => ['a', 'b']
|
|
2089
|
+
*
|
|
2090
|
+
* // Replace `_.memoize.Cache`.
|
|
2091
|
+
* _.memoize.Cache = WeakMap;
|
|
2092
|
+
*/
|
|
2093
|
+
function memoize(func, resolver) {
|
|
2094
|
+
if (typeof func != 'function' || (resolver != null && typeof resolver != 'function')) {
|
|
2095
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
2096
|
+
}
|
|
2097
|
+
var memoized = function() {
|
|
2098
|
+
var args = arguments,
|
|
2099
|
+
key = resolver ? resolver.apply(this, args) : args[0],
|
|
2100
|
+
cache = memoized.cache;
|
|
2101
|
+
|
|
2102
|
+
if (cache.has(key)) {
|
|
2103
|
+
return cache.get(key);
|
|
2104
|
+
}
|
|
2105
|
+
var result = func.apply(this, args);
|
|
2106
|
+
memoized.cache = cache.set(key, result) || cache;
|
|
2107
|
+
return result;
|
|
2108
|
+
};
|
|
2109
|
+
memoized.cache = new (memoize.Cache || MapCache);
|
|
2110
|
+
return memoized;
|
|
2111
|
+
}
|
|
2112
|
+
|
|
2113
|
+
// Expose `MapCache`.
|
|
2114
|
+
memoize.Cache = MapCache;
|
|
2115
|
+
|
|
2116
|
+
/** Used as the maximum memoize cache size. */
|
|
2117
|
+
var MAX_MEMOIZE_SIZE = 500;
|
|
2118
|
+
|
|
2119
|
+
/**
|
|
2120
|
+
* A specialized version of `_.memoize` which clears the memoized function's
|
|
2121
|
+
* cache when it exceeds `MAX_MEMOIZE_SIZE`.
|
|
2122
|
+
*
|
|
2123
|
+
* @private
|
|
2124
|
+
* @param {Function} func The function to have its output memoized.
|
|
2125
|
+
* @returns {Function} Returns the new memoized function.
|
|
2126
|
+
*/
|
|
2127
|
+
function memoizeCapped(func) {
|
|
2128
|
+
var result = memoize(func, function(key) {
|
|
2129
|
+
if (cache.size === MAX_MEMOIZE_SIZE) {
|
|
2130
|
+
cache.clear();
|
|
2131
|
+
}
|
|
2132
|
+
return key;
|
|
2133
|
+
});
|
|
2134
|
+
|
|
2135
|
+
var cache = result.cache;
|
|
2136
|
+
return result;
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
/** Used to match property names within property paths. */
|
|
2140
|
+
var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
|
|
2141
|
+
|
|
2142
|
+
/** Used to match backslashes in property paths. */
|
|
2143
|
+
var reEscapeChar = /\\(\\)?/g;
|
|
2144
|
+
|
|
2145
|
+
/**
|
|
2146
|
+
* Converts `string` to a property path array.
|
|
2147
|
+
*
|
|
2148
|
+
* @private
|
|
2149
|
+
* @param {string} string The string to convert.
|
|
2150
|
+
* @returns {Array} Returns the property path array.
|
|
2151
|
+
*/
|
|
2152
|
+
var stringToPath = memoizeCapped(function(string) {
|
|
2153
|
+
var result = [];
|
|
2154
|
+
if (string.charCodeAt(0) === 46 /* . */) {
|
|
2155
|
+
result.push('');
|
|
2156
|
+
}
|
|
2157
|
+
string.replace(rePropName, function(match, number, quote, subString) {
|
|
2158
|
+
result.push(quote ? subString.replace(reEscapeChar, '$1') : (number || match));
|
|
2159
|
+
});
|
|
2160
|
+
return result;
|
|
2161
|
+
});
|
|
2162
|
+
|
|
2163
|
+
/**
|
|
2164
|
+
* A specialized version of `_.map` for arrays without support for iteratee
|
|
2165
|
+
* shorthands.
|
|
2166
|
+
*
|
|
2167
|
+
* @private
|
|
2168
|
+
* @param {Array} [array] The array to iterate over.
|
|
2169
|
+
* @param {Function} iteratee The function invoked per iteration.
|
|
2170
|
+
* @returns {Array} Returns the new mapped array.
|
|
2171
|
+
*/
|
|
2172
|
+
function arrayMap(array, iteratee) {
|
|
2173
|
+
var index = -1,
|
|
2174
|
+
length = array == null ? 0 : array.length,
|
|
2175
|
+
result = Array(length);
|
|
2176
|
+
|
|
2177
|
+
while (++index < length) {
|
|
2178
|
+
result[index] = iteratee(array[index], index, array);
|
|
2179
|
+
}
|
|
2180
|
+
return result;
|
|
2181
|
+
}
|
|
2182
|
+
|
|
2183
|
+
/** Used to convert symbols to primitives and strings. */
|
|
2184
|
+
var symbolProto = Symbol ? Symbol.prototype : undefined,
|
|
2185
|
+
symbolToString = symbolProto ? symbolProto.toString : undefined;
|
|
2186
|
+
|
|
2187
|
+
/**
|
|
2188
|
+
* The base implementation of `_.toString` which doesn't convert nullish
|
|
2189
|
+
* values to empty strings.
|
|
2190
|
+
*
|
|
2191
|
+
* @private
|
|
2192
|
+
* @param {*} value The value to process.
|
|
2193
|
+
* @returns {string} Returns the string.
|
|
2194
|
+
*/
|
|
2195
|
+
function baseToString(value) {
|
|
2196
|
+
// Exit early for strings to avoid a performance hit in some environments.
|
|
2197
|
+
if (typeof value == 'string') {
|
|
2198
|
+
return value;
|
|
2199
|
+
}
|
|
2200
|
+
if (isArray(value)) {
|
|
2201
|
+
// Recursively convert values (susceptible to call stack limits).
|
|
2202
|
+
return arrayMap(value, baseToString) + '';
|
|
2203
|
+
}
|
|
2204
|
+
if (isSymbol(value)) {
|
|
2205
|
+
return symbolToString ? symbolToString.call(value) : '';
|
|
2206
|
+
}
|
|
2207
|
+
var result = (value + '');
|
|
2208
|
+
return (result == '0' && (1 / value) == -Infinity) ? '-0' : result;
|
|
2209
|
+
}
|
|
2210
|
+
|
|
2211
|
+
/**
|
|
2212
|
+
* Converts `value` to a string. An empty string is returned for `null`
|
|
2213
|
+
* and `undefined` values. The sign of `-0` is preserved.
|
|
2214
|
+
*
|
|
2215
|
+
* @static
|
|
2216
|
+
* @memberOf _
|
|
2217
|
+
* @since 4.0.0
|
|
2218
|
+
* @category Lang
|
|
2219
|
+
* @param {*} value The value to convert.
|
|
2220
|
+
* @returns {string} Returns the converted string.
|
|
2221
|
+
* @example
|
|
2222
|
+
*
|
|
2223
|
+
* _.toString(null);
|
|
2224
|
+
* // => ''
|
|
2225
|
+
*
|
|
2226
|
+
* _.toString(-0);
|
|
2227
|
+
* // => '-0'
|
|
2228
|
+
*
|
|
2229
|
+
* _.toString([1, 2, 3]);
|
|
2230
|
+
* // => '1,2,3'
|
|
2231
|
+
*/
|
|
2232
|
+
function toString(value) {
|
|
2233
|
+
return value == null ? '' : baseToString(value);
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2236
|
+
/**
|
|
2237
|
+
* Casts `value` to a path array if it's not one.
|
|
2238
|
+
*
|
|
2239
|
+
* @private
|
|
2240
|
+
* @param {*} value The value to inspect.
|
|
2241
|
+
* @param {Object} [object] The object to query keys on.
|
|
2242
|
+
* @returns {Array} Returns the cast property path array.
|
|
2243
|
+
*/
|
|
2244
|
+
function castPath(value, object) {
|
|
2245
|
+
if (isArray(value)) {
|
|
2246
|
+
return value;
|
|
2247
|
+
}
|
|
2248
|
+
return isKey(value, object) ? [value] : stringToPath(toString(value));
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2251
|
+
/**
|
|
2252
|
+
* Converts `value` to a string key if it's not a string or symbol.
|
|
2253
|
+
*
|
|
2254
|
+
* @private
|
|
2255
|
+
* @param {*} value The value to inspect.
|
|
2256
|
+
* @returns {string|symbol} Returns the key.
|
|
2257
|
+
*/
|
|
2258
|
+
function toKey(value) {
|
|
2259
|
+
if (typeof value == 'string' || isSymbol(value)) {
|
|
2260
|
+
return value;
|
|
2261
|
+
}
|
|
2262
|
+
var result = (value + '');
|
|
2263
|
+
return (result == '0' && (1 / value) == -Infinity) ? '-0' : result;
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
/**
|
|
2267
|
+
* The base implementation of `_.get` without support for default values.
|
|
2268
|
+
*
|
|
2269
|
+
* @private
|
|
2270
|
+
* @param {Object} object The object to query.
|
|
2271
|
+
* @param {Array|string} path The path of the property to get.
|
|
2272
|
+
* @returns {*} Returns the resolved value.
|
|
2273
|
+
*/
|
|
2274
|
+
function baseGet(object, path) {
|
|
2275
|
+
path = castPath(path, object);
|
|
2276
|
+
|
|
2277
|
+
var index = 0,
|
|
2278
|
+
length = path.length;
|
|
2279
|
+
|
|
2280
|
+
while (object != null && index < length) {
|
|
2281
|
+
object = object[toKey(path[index++])];
|
|
2282
|
+
}
|
|
2283
|
+
return (index && index == length) ? object : undefined;
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2286
|
+
/**
|
|
2287
|
+
* Gets the value at `path` of `object`. If the resolved value is
|
|
2288
|
+
* `undefined`, the `defaultValue` is returned in its place.
|
|
2289
|
+
*
|
|
2290
|
+
* @static
|
|
2291
|
+
* @memberOf _
|
|
2292
|
+
* @since 3.7.0
|
|
2293
|
+
* @category Object
|
|
2294
|
+
* @param {Object} object The object to query.
|
|
2295
|
+
* @param {Array|string} path The path of the property to get.
|
|
2296
|
+
* @param {*} [defaultValue] The value returned for `undefined` resolved values.
|
|
2297
|
+
* @returns {*} Returns the resolved value.
|
|
2298
|
+
* @example
|
|
2299
|
+
*
|
|
2300
|
+
* var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
|
2301
|
+
*
|
|
2302
|
+
* _.get(object, 'a[0].b.c');
|
|
2303
|
+
* // => 3
|
|
2304
|
+
*
|
|
2305
|
+
* _.get(object, ['a', '0', 'b', 'c']);
|
|
2306
|
+
* // => 3
|
|
2307
|
+
*
|
|
2308
|
+
* _.get(object, 'a.b.c', 'default');
|
|
2309
|
+
* // => 'default'
|
|
2310
|
+
*/
|
|
2311
|
+
function get(object, path, defaultValue) {
|
|
2312
|
+
var result = object == null ? undefined : baseGet(object, path);
|
|
2313
|
+
return result === undefined ? defaultValue : result;
|
|
2314
|
+
}
|
|
2315
|
+
|
|
2316
|
+
/**
|
|
2317
|
+
* The base implementation of `_.hasIn` without support for deep paths.
|
|
2318
|
+
*
|
|
2319
|
+
* @private
|
|
2320
|
+
* @param {Object} [object] The object to query.
|
|
2321
|
+
* @param {Array|string} key The key to check.
|
|
2322
|
+
* @returns {boolean} Returns `true` if `key` exists, else `false`.
|
|
2323
|
+
*/
|
|
2324
|
+
function baseHasIn(object, key) {
|
|
2325
|
+
return object != null && key in Object(object);
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
/**
|
|
2329
|
+
* Checks if `path` exists on `object`.
|
|
2330
|
+
*
|
|
2331
|
+
* @private
|
|
2332
|
+
* @param {Object} object The object to query.
|
|
2333
|
+
* @param {Array|string} path The path to check.
|
|
2334
|
+
* @param {Function} hasFunc The function to check properties.
|
|
2335
|
+
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
2336
|
+
*/
|
|
2337
|
+
function hasPath(object, path, hasFunc) {
|
|
2338
|
+
path = castPath(path, object);
|
|
2339
|
+
|
|
2340
|
+
var index = -1,
|
|
2341
|
+
length = path.length,
|
|
2342
|
+
result = false;
|
|
2343
|
+
|
|
2344
|
+
while (++index < length) {
|
|
2345
|
+
var key = toKey(path[index]);
|
|
2346
|
+
if (!(result = object != null && hasFunc(object, key))) {
|
|
2347
|
+
break;
|
|
2348
|
+
}
|
|
2349
|
+
object = object[key];
|
|
2350
|
+
}
|
|
2351
|
+
if (result || ++index != length) {
|
|
2352
|
+
return result;
|
|
2353
|
+
}
|
|
2354
|
+
length = object == null ? 0 : object.length;
|
|
2355
|
+
return !!length && isLength(length) && isIndex(key, length) &&
|
|
2356
|
+
(isArray(object) || isArguments(object));
|
|
2357
|
+
}
|
|
2358
|
+
|
|
2359
|
+
/**
|
|
2360
|
+
* Checks if `path` is a direct or inherited property of `object`.
|
|
2361
|
+
*
|
|
2362
|
+
* @static
|
|
2363
|
+
* @memberOf _
|
|
2364
|
+
* @since 4.0.0
|
|
2365
|
+
* @category Object
|
|
2366
|
+
* @param {Object} object The object to query.
|
|
2367
|
+
* @param {Array|string} path The path to check.
|
|
2368
|
+
* @returns {boolean} Returns `true` if `path` exists, else `false`.
|
|
2369
|
+
* @example
|
|
2370
|
+
*
|
|
2371
|
+
* var object = _.create({ 'a': _.create({ 'b': 2 }) });
|
|
2372
|
+
*
|
|
2373
|
+
* _.hasIn(object, 'a');
|
|
2374
|
+
* // => true
|
|
2375
|
+
*
|
|
2376
|
+
* _.hasIn(object, 'a.b');
|
|
2377
|
+
* // => true
|
|
2378
|
+
*
|
|
2379
|
+
* _.hasIn(object, ['a', 'b']);
|
|
2380
|
+
* // => true
|
|
2381
|
+
*
|
|
2382
|
+
* _.hasIn(object, 'b');
|
|
2383
|
+
* // => false
|
|
2384
|
+
*/
|
|
2385
|
+
function hasIn(object, path) {
|
|
2386
|
+
return object != null && hasPath(object, path, baseHasIn);
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
/** Used to compose bitmasks for value comparisons. */
|
|
2390
|
+
var COMPARE_PARTIAL_FLAG = 1,
|
|
2391
|
+
COMPARE_UNORDERED_FLAG = 2;
|
|
2392
|
+
|
|
2393
|
+
/**
|
|
2394
|
+
* The base implementation of `_.matchesProperty` which doesn't clone `srcValue`.
|
|
2395
|
+
*
|
|
2396
|
+
* @private
|
|
2397
|
+
* @param {string} path The path of the property to get.
|
|
2398
|
+
* @param {*} srcValue The value to match.
|
|
2399
|
+
* @returns {Function} Returns the new spec function.
|
|
2400
|
+
*/
|
|
2401
|
+
function baseMatchesProperty(path, srcValue) {
|
|
2402
|
+
if (isKey(path) && isStrictComparable(srcValue)) {
|
|
2403
|
+
return matchesStrictComparable(toKey(path), srcValue);
|
|
2404
|
+
}
|
|
2405
|
+
return function(object) {
|
|
2406
|
+
var objValue = get(object, path);
|
|
2407
|
+
return (objValue === undefined && objValue === srcValue)
|
|
2408
|
+
? hasIn(object, path)
|
|
2409
|
+
: baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
|
|
2410
|
+
};
|
|
2411
|
+
}
|
|
2412
|
+
|
|
2413
|
+
/**
|
|
2414
|
+
* This method returns the first argument it receives.
|
|
2415
|
+
*
|
|
2416
|
+
* @static
|
|
2417
|
+
* @since 0.1.0
|
|
2418
|
+
* @memberOf _
|
|
2419
|
+
* @category Util
|
|
2420
|
+
* @param {*} value Any value.
|
|
2421
|
+
* @returns {*} Returns `value`.
|
|
2422
|
+
* @example
|
|
2423
|
+
*
|
|
2424
|
+
* var object = { 'a': 1 };
|
|
2425
|
+
*
|
|
2426
|
+
* console.log(_.identity(object) === object);
|
|
2427
|
+
* // => true
|
|
2428
|
+
*/
|
|
2429
|
+
function identity(value) {
|
|
2430
|
+
return value;
|
|
2431
|
+
}
|
|
2432
|
+
|
|
2433
|
+
/**
|
|
2434
|
+
* The base implementation of `_.property` without support for deep paths.
|
|
2435
|
+
*
|
|
2436
|
+
* @private
|
|
2437
|
+
* @param {string} key The key of the property to get.
|
|
2438
|
+
* @returns {Function} Returns the new accessor function.
|
|
2439
|
+
*/
|
|
2440
|
+
function baseProperty(key) {
|
|
2441
|
+
return function(object) {
|
|
2442
|
+
return object == null ? undefined : object[key];
|
|
2443
|
+
};
|
|
2444
|
+
}
|
|
2445
|
+
|
|
2446
|
+
/**
|
|
2447
|
+
* A specialized version of `baseProperty` which supports deep paths.
|
|
2448
|
+
*
|
|
2449
|
+
* @private
|
|
2450
|
+
* @param {Array|string} path The path of the property to get.
|
|
2451
|
+
* @returns {Function} Returns the new accessor function.
|
|
2452
|
+
*/
|
|
2453
|
+
function basePropertyDeep(path) {
|
|
2454
|
+
return function(object) {
|
|
2455
|
+
return baseGet(object, path);
|
|
2456
|
+
};
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
/**
|
|
2460
|
+
* Creates a function that returns the value at `path` of a given object.
|
|
2461
|
+
*
|
|
2462
|
+
* @static
|
|
2463
|
+
* @memberOf _
|
|
2464
|
+
* @since 2.4.0
|
|
2465
|
+
* @category Util
|
|
2466
|
+
* @param {Array|string} path The path of the property to get.
|
|
2467
|
+
* @returns {Function} Returns the new accessor function.
|
|
2468
|
+
* @example
|
|
2469
|
+
*
|
|
2470
|
+
* var objects = [
|
|
2471
|
+
* { 'a': { 'b': 2 } },
|
|
2472
|
+
* { 'a': { 'b': 1 } }
|
|
2473
|
+
* ];
|
|
2474
|
+
*
|
|
2475
|
+
* _.map(objects, _.property('a.b'));
|
|
2476
|
+
* // => [2, 1]
|
|
2477
|
+
*
|
|
2478
|
+
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
|
|
2479
|
+
* // => [1, 2]
|
|
2480
|
+
*/
|
|
2481
|
+
function property(path) {
|
|
2482
|
+
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
|
|
2483
|
+
}
|
|
2484
|
+
|
|
2485
|
+
/**
|
|
2486
|
+
* The base implementation of `_.iteratee`.
|
|
2487
|
+
*
|
|
2488
|
+
* @private
|
|
2489
|
+
* @param {*} [value=_.identity] The value to convert to an iteratee.
|
|
2490
|
+
* @returns {Function} Returns the iteratee.
|
|
2491
|
+
*/
|
|
2492
|
+
function baseIteratee(value) {
|
|
2493
|
+
// Don't store the `typeof` result in a variable to avoid a JIT bug in Safari 9.
|
|
2494
|
+
// See https://bugs.webkit.org/show_bug.cgi?id=156034 for more details.
|
|
2495
|
+
if (typeof value == 'function') {
|
|
2496
|
+
return value;
|
|
2497
|
+
}
|
|
2498
|
+
if (value == null) {
|
|
2499
|
+
return identity;
|
|
2500
|
+
}
|
|
2501
|
+
if (typeof value == 'object') {
|
|
2502
|
+
return isArray(value)
|
|
2503
|
+
? baseMatchesProperty(value[0], value[1])
|
|
2504
|
+
: baseMatches(value);
|
|
2505
|
+
}
|
|
2506
|
+
return property(value);
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
/** Used as references for various `Number` constants. */
|
|
2510
|
+
var INFINITY = 1 / 0,
|
|
2511
|
+
MAX_INTEGER = 1.7976931348623157e+308;
|
|
2512
|
+
|
|
2513
|
+
/**
|
|
2514
|
+
* Converts `value` to a finite number.
|
|
2515
|
+
*
|
|
2516
|
+
* @static
|
|
2517
|
+
* @memberOf _
|
|
2518
|
+
* @since 4.12.0
|
|
2519
|
+
* @category Lang
|
|
2520
|
+
* @param {*} value The value to convert.
|
|
2521
|
+
* @returns {number} Returns the converted number.
|
|
2522
|
+
* @example
|
|
2523
|
+
*
|
|
2524
|
+
* _.toFinite(3.2);
|
|
2525
|
+
* // => 3.2
|
|
2526
|
+
*
|
|
2527
|
+
* _.toFinite(Number.MIN_VALUE);
|
|
2528
|
+
* // => 5e-324
|
|
2529
|
+
*
|
|
2530
|
+
* _.toFinite(Infinity);
|
|
2531
|
+
* // => 1.7976931348623157e+308
|
|
2532
|
+
*
|
|
2533
|
+
* _.toFinite('3.2');
|
|
2534
|
+
* // => 3.2
|
|
2535
|
+
*/
|
|
2536
|
+
function toFinite(value) {
|
|
2537
|
+
if (!value) {
|
|
2538
|
+
return value === 0 ? value : 0;
|
|
2539
|
+
}
|
|
2540
|
+
value = toNumber(value);
|
|
2541
|
+
if (value === INFINITY || value === -Infinity) {
|
|
2542
|
+
var sign = (value < 0 ? -1 : 1);
|
|
2543
|
+
return sign * MAX_INTEGER;
|
|
2544
|
+
}
|
|
2545
|
+
return value === value ? value : 0;
|
|
2546
|
+
}
|
|
2547
|
+
|
|
2548
|
+
/**
|
|
2549
|
+
* This method is like `_.find` except that it returns the index of the first
|
|
2550
|
+
* element `predicate` returns truthy for instead of the element itself.
|
|
2551
|
+
*
|
|
2552
|
+
* @static
|
|
2553
|
+
* @memberOf _
|
|
2554
|
+
* @since 1.1.0
|
|
2555
|
+
* @category Array
|
|
2556
|
+
* @param {Array} array The array to inspect.
|
|
2557
|
+
* @param {Function} [predicate=_.identity] The function invoked per iteration.
|
|
2558
|
+
* @param {number} [fromIndex=0] The index to search from.
|
|
2559
|
+
* @returns {number} Returns the index of the found element, else `-1`.
|
|
2560
|
+
* @example
|
|
2561
|
+
*
|
|
2562
|
+
* var users = [
|
|
2563
|
+
* { 'user': 'barney', 'active': false },
|
|
2564
|
+
* { 'user': 'fred', 'active': false },
|
|
2565
|
+
* { 'user': 'pebbles', 'active': true }
|
|
2566
|
+
* ];
|
|
2567
|
+
*
|
|
2568
|
+
* _.findIndex(users, function(o) { return o.user == 'barney'; });
|
|
2569
|
+
* // => 0
|
|
2570
|
+
*
|
|
2571
|
+
* // The `_.matches` iteratee shorthand.
|
|
2572
|
+
* _.findIndex(users, { 'user': 'fred', 'active': false });
|
|
2573
|
+
* // => 1
|
|
2574
|
+
*
|
|
2575
|
+
* // The `_.matchesProperty` iteratee shorthand.
|
|
2576
|
+
* _.findIndex(users, ['active', false]);
|
|
2577
|
+
* // => 0
|
|
2578
|
+
*
|
|
2579
|
+
* // The `_.property` iteratee shorthand.
|
|
2580
|
+
* _.findIndex(users, 'active');
|
|
2581
|
+
* // => 2
|
|
2582
|
+
*/
|
|
2583
|
+
function findIndex(array, predicate, fromIndex) {
|
|
2584
|
+
var length = array == null ? 0 : array.length;
|
|
2585
|
+
if (!length) {
|
|
2586
|
+
return -1;
|
|
2587
|
+
}
|
|
2588
|
+
var index = 0 ;
|
|
2589
|
+
return baseFindIndex(array, baseIteratee(predicate), index);
|
|
2590
|
+
}
|
|
2591
|
+
|
|
2592
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
2593
|
+
var nativeCeil = Math.ceil,
|
|
2594
|
+
nativeMax = Math.max;
|
|
2595
|
+
|
|
2596
|
+
/**
|
|
2597
|
+
* The base implementation of `_.range` and `_.rangeRight` which doesn't
|
|
2598
|
+
* coerce arguments.
|
|
2599
|
+
*
|
|
2600
|
+
* @private
|
|
2601
|
+
* @param {number} start The start of the range.
|
|
2602
|
+
* @param {number} end The end of the range.
|
|
2603
|
+
* @param {number} step The value to increment or decrement by.
|
|
2604
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
2605
|
+
* @returns {Array} Returns the range of numbers.
|
|
2606
|
+
*/
|
|
2607
|
+
function baseRange(start, end, step, fromRight) {
|
|
2608
|
+
var index = -1,
|
|
2609
|
+
length = nativeMax(nativeCeil((end - start) / (step || 1)), 0),
|
|
2610
|
+
result = Array(length);
|
|
2611
|
+
|
|
2612
|
+
while (length--) {
|
|
2613
|
+
result[++index] = start;
|
|
2614
|
+
start += step;
|
|
2615
|
+
}
|
|
2616
|
+
return result;
|
|
2617
|
+
}
|
|
2618
|
+
|
|
2619
|
+
/**
|
|
2620
|
+
* Checks if the given arguments are from an iteratee call.
|
|
2621
|
+
*
|
|
2622
|
+
* @private
|
|
2623
|
+
* @param {*} value The potential iteratee value argument.
|
|
2624
|
+
* @param {*} index The potential iteratee index or key argument.
|
|
2625
|
+
* @param {*} object The potential iteratee object argument.
|
|
2626
|
+
* @returns {boolean} Returns `true` if the arguments are from an iteratee call,
|
|
2627
|
+
* else `false`.
|
|
2628
|
+
*/
|
|
2629
|
+
function isIterateeCall(value, index, object) {
|
|
2630
|
+
if (!isObject(object)) {
|
|
2631
|
+
return false;
|
|
2632
|
+
}
|
|
2633
|
+
var type = typeof index;
|
|
2634
|
+
if (type == 'number'
|
|
2635
|
+
? (isArrayLike(object) && isIndex(index, object.length))
|
|
2636
|
+
: (type == 'string' && index in object)
|
|
2637
|
+
) {
|
|
2638
|
+
return eq(object[index], value);
|
|
2639
|
+
}
|
|
2640
|
+
return false;
|
|
2641
|
+
}
|
|
2642
|
+
|
|
2643
|
+
/**
|
|
2644
|
+
* Creates a `_.range` or `_.rangeRight` function.
|
|
2645
|
+
*
|
|
2646
|
+
* @private
|
|
2647
|
+
* @param {boolean} [fromRight] Specify iterating from right to left.
|
|
2648
|
+
* @returns {Function} Returns the new range function.
|
|
2649
|
+
*/
|
|
2650
|
+
function createRange(fromRight) {
|
|
2651
|
+
return function(start, end, step) {
|
|
2652
|
+
if (step && typeof step != 'number' && isIterateeCall(start, end, step)) {
|
|
2653
|
+
end = step = undefined;
|
|
2654
|
+
}
|
|
2655
|
+
// Ensure the sign of `-0` is preserved.
|
|
2656
|
+
start = toFinite(start);
|
|
2657
|
+
if (end === undefined) {
|
|
2658
|
+
end = start;
|
|
2659
|
+
start = 0;
|
|
2660
|
+
} else {
|
|
2661
|
+
end = toFinite(end);
|
|
2662
|
+
}
|
|
2663
|
+
step = step === undefined ? (start < end ? 1 : -1) : toFinite(step);
|
|
2664
|
+
return baseRange(start, end, step);
|
|
2665
|
+
};
|
|
2666
|
+
}
|
|
2667
|
+
|
|
2668
|
+
/**
|
|
2669
|
+
* Creates an array of numbers (positive and/or negative) progressing from
|
|
2670
|
+
* `start` up to, but not including, `end`. A step of `-1` is used if a negative
|
|
2671
|
+
* `start` is specified without an `end` or `step`. If `end` is not specified,
|
|
2672
|
+
* it's set to `start` with `start` then set to `0`.
|
|
2673
|
+
*
|
|
2674
|
+
* **Note:** JavaScript follows the IEEE-754 standard for resolving
|
|
2675
|
+
* floating-point values which can produce unexpected results.
|
|
2676
|
+
*
|
|
2677
|
+
* @static
|
|
2678
|
+
* @since 0.1.0
|
|
2679
|
+
* @memberOf _
|
|
2680
|
+
* @category Util
|
|
2681
|
+
* @param {number} [start=0] The start of the range.
|
|
2682
|
+
* @param {number} end The end of the range.
|
|
2683
|
+
* @param {number} [step=1] The value to increment or decrement by.
|
|
2684
|
+
* @returns {Array} Returns the range of numbers.
|
|
2685
|
+
* @see _.inRange, _.rangeRight
|
|
2686
|
+
* @example
|
|
2687
|
+
*
|
|
2688
|
+
* _.range(4);
|
|
2689
|
+
* // => [0, 1, 2, 3]
|
|
2690
|
+
*
|
|
2691
|
+
* _.range(-4);
|
|
2692
|
+
* // => [0, -1, -2, -3]
|
|
2693
|
+
*
|
|
2694
|
+
* _.range(1, 5);
|
|
2695
|
+
* // => [1, 2, 3, 4]
|
|
2696
|
+
*
|
|
2697
|
+
* _.range(0, 20, 5);
|
|
2698
|
+
* // => [0, 5, 10, 15]
|
|
2699
|
+
*
|
|
2700
|
+
* _.range(0, -4, -1);
|
|
2701
|
+
* // => [0, -1, -2, -3]
|
|
2702
|
+
*
|
|
2703
|
+
* _.range(1, 4, 0);
|
|
2704
|
+
* // => [1, 1, 1]
|
|
2705
|
+
*
|
|
2706
|
+
* _.range(0);
|
|
2707
|
+
* // => []
|
|
2708
|
+
*/
|
|
2709
|
+
var range$1 = createRange();
|
|
2710
|
+
|
|
2711
|
+
const appendToMap = (map, propName, value) => {
|
|
2712
|
+
const items = map.get(propName);
|
|
2713
|
+
if (!items) {
|
|
2714
|
+
map.set(propName, [value]);
|
|
2715
|
+
}
|
|
2716
|
+
else if (!items.includes(value)) {
|
|
2717
|
+
items.push(value);
|
|
2718
|
+
}
|
|
2719
|
+
};
|
|
2720
|
+
const debounce = (fn, ms) => {
|
|
2721
|
+
let timeoutId;
|
|
2722
|
+
return (...args) => {
|
|
2723
|
+
if (timeoutId) {
|
|
2724
|
+
clearTimeout(timeoutId);
|
|
2725
|
+
}
|
|
2726
|
+
timeoutId = setTimeout(() => {
|
|
2727
|
+
timeoutId = 0;
|
|
2728
|
+
fn(...args);
|
|
2729
|
+
}, ms);
|
|
2730
|
+
};
|
|
2731
|
+
};
|
|
2732
|
+
|
|
2733
|
+
/**
|
|
2734
|
+
* Check if a possible element isConnected.
|
|
2735
|
+
* The property might not be there, so we check for it.
|
|
2736
|
+
*
|
|
2737
|
+
* We want it to return true if isConnected is not a property,
|
|
2738
|
+
* otherwise we would remove these elements and would not update.
|
|
2739
|
+
*
|
|
2740
|
+
* Better leak in Edge than to be useless.
|
|
2741
|
+
*/
|
|
2742
|
+
const isConnected = (maybeElement) => !('isConnected' in maybeElement) || maybeElement.isConnected;
|
|
2743
|
+
const cleanupElements = debounce((map) => {
|
|
2744
|
+
for (let key of map.keys()) {
|
|
2745
|
+
map.set(key, map.get(key).filter(isConnected));
|
|
2746
|
+
}
|
|
2747
|
+
}, 2_000);
|
|
2748
|
+
const stencilSubscription = () => {
|
|
2749
|
+
if (typeof getRenderingRef !== 'function') {
|
|
2750
|
+
// If we are not in a stencil project, we do nothing.
|
|
2751
|
+
// This function is not really exported by @stencil/core.
|
|
2752
|
+
return {};
|
|
2753
|
+
}
|
|
2754
|
+
const elmsToUpdate = new Map();
|
|
2755
|
+
return {
|
|
2756
|
+
dispose: () => elmsToUpdate.clear(),
|
|
2757
|
+
get: (propName) => {
|
|
2758
|
+
const elm = getRenderingRef();
|
|
2759
|
+
if (elm) {
|
|
2760
|
+
appendToMap(elmsToUpdate, propName, elm);
|
|
2761
|
+
}
|
|
2762
|
+
},
|
|
2763
|
+
set: (propName) => {
|
|
2764
|
+
const elements = elmsToUpdate.get(propName);
|
|
2765
|
+
if (elements) {
|
|
2766
|
+
elmsToUpdate.set(propName, elements.filter(forceUpdate));
|
|
2767
|
+
}
|
|
2768
|
+
cleanupElements(elmsToUpdate);
|
|
2769
|
+
},
|
|
2770
|
+
reset: () => {
|
|
2771
|
+
elmsToUpdate.forEach((elms) => elms.forEach(forceUpdate));
|
|
2772
|
+
cleanupElements(elmsToUpdate);
|
|
2773
|
+
},
|
|
2774
|
+
};
|
|
2775
|
+
};
|
|
2776
|
+
|
|
2777
|
+
const unwrap = (val) => (typeof val === 'function' ? val() : val);
|
|
2778
|
+
const createObservableMap = (defaultState, shouldUpdate = (a, b) => a !== b) => {
|
|
2779
|
+
const unwrappedState = unwrap(defaultState);
|
|
2780
|
+
let states = new Map(Object.entries(unwrappedState ?? {}));
|
|
2781
|
+
const handlers = {
|
|
2782
|
+
dispose: [],
|
|
2783
|
+
get: [],
|
|
2784
|
+
set: [],
|
|
2785
|
+
reset: [],
|
|
2786
|
+
};
|
|
2787
|
+
// Track onChange listeners to enable removeListener functionality
|
|
2788
|
+
const changeListeners = new Map();
|
|
2789
|
+
const reset = () => {
|
|
2790
|
+
// When resetting the state, the default state may be a function - unwrap it to invoke it.
|
|
2791
|
+
// otherwise, the state won't be properly reset
|
|
2792
|
+
states = new Map(Object.entries(unwrap(defaultState) ?? {}));
|
|
2793
|
+
handlers.reset.forEach((cb) => cb());
|
|
2794
|
+
};
|
|
2795
|
+
const dispose = () => {
|
|
2796
|
+
// Call first dispose as resetting the state would
|
|
2797
|
+
// cause less updates ;)
|
|
2798
|
+
handlers.dispose.forEach((cb) => cb());
|
|
2799
|
+
reset();
|
|
2800
|
+
};
|
|
2801
|
+
const get = (propName) => {
|
|
2802
|
+
handlers.get.forEach((cb) => cb(propName));
|
|
2803
|
+
return states.get(propName);
|
|
2804
|
+
};
|
|
2805
|
+
const set = (propName, value) => {
|
|
2806
|
+
const oldValue = states.get(propName);
|
|
2807
|
+
if (shouldUpdate(value, oldValue, propName)) {
|
|
2808
|
+
states.set(propName, value);
|
|
2809
|
+
handlers.set.forEach((cb) => cb(propName, value, oldValue));
|
|
2810
|
+
}
|
|
2811
|
+
};
|
|
2812
|
+
const state = (typeof Proxy === 'undefined'
|
|
2813
|
+
? {}
|
|
2814
|
+
: new Proxy(unwrappedState, {
|
|
2815
|
+
get(_, propName) {
|
|
2816
|
+
return get(propName);
|
|
2817
|
+
},
|
|
2818
|
+
ownKeys(_) {
|
|
2819
|
+
return Array.from(states.keys());
|
|
2820
|
+
},
|
|
2821
|
+
getOwnPropertyDescriptor() {
|
|
2822
|
+
return {
|
|
2823
|
+
enumerable: true,
|
|
2824
|
+
configurable: true,
|
|
2825
|
+
};
|
|
2826
|
+
},
|
|
2827
|
+
has(_, propName) {
|
|
2828
|
+
return states.has(propName);
|
|
2829
|
+
},
|
|
2830
|
+
set(_, propName, value) {
|
|
2831
|
+
set(propName, value);
|
|
2832
|
+
return true;
|
|
2833
|
+
},
|
|
2834
|
+
}));
|
|
2835
|
+
const on = (eventName, callback) => {
|
|
2836
|
+
handlers[eventName].push(callback);
|
|
2837
|
+
return () => {
|
|
2838
|
+
removeFromArray(handlers[eventName], callback);
|
|
2839
|
+
};
|
|
2840
|
+
};
|
|
2841
|
+
const onChange = (propName, cb) => {
|
|
2842
|
+
const setHandler = (key, newValue) => {
|
|
2843
|
+
if (key === propName) {
|
|
2844
|
+
cb(newValue);
|
|
2845
|
+
}
|
|
2846
|
+
};
|
|
2847
|
+
const resetHandler = () => cb(unwrap(defaultState)[propName]);
|
|
2848
|
+
// Register the handlers
|
|
2849
|
+
const unSet = on('set', setHandler);
|
|
2850
|
+
const unReset = on('reset', resetHandler);
|
|
2851
|
+
// Track the relationship between the user callback and internal handlers
|
|
2852
|
+
changeListeners.set(cb, { setHandler, resetHandler, propName });
|
|
2853
|
+
return () => {
|
|
2854
|
+
unSet();
|
|
2855
|
+
unReset();
|
|
2856
|
+
changeListeners.delete(cb);
|
|
2857
|
+
};
|
|
2858
|
+
};
|
|
2859
|
+
const use = (...subscriptions) => {
|
|
2860
|
+
const unsubs = subscriptions.reduce((unsubs, subscription) => {
|
|
2861
|
+
if (subscription.set) {
|
|
2862
|
+
unsubs.push(on('set', subscription.set));
|
|
2863
|
+
}
|
|
2864
|
+
if (subscription.get) {
|
|
2865
|
+
unsubs.push(on('get', subscription.get));
|
|
2866
|
+
}
|
|
2867
|
+
if (subscription.reset) {
|
|
2868
|
+
unsubs.push(on('reset', subscription.reset));
|
|
2869
|
+
}
|
|
2870
|
+
if (subscription.dispose) {
|
|
2871
|
+
unsubs.push(on('dispose', subscription.dispose));
|
|
2872
|
+
}
|
|
2873
|
+
return unsubs;
|
|
2874
|
+
}, []);
|
|
2875
|
+
return () => unsubs.forEach((unsub) => unsub());
|
|
2876
|
+
};
|
|
2877
|
+
const forceUpdate = (key) => {
|
|
2878
|
+
const oldValue = states.get(key);
|
|
2879
|
+
handlers.set.forEach((cb) => cb(key, oldValue, oldValue));
|
|
2880
|
+
};
|
|
2881
|
+
const removeListener = (propName, listener) => {
|
|
2882
|
+
const listenerInfo = changeListeners.get(listener);
|
|
2883
|
+
if (listenerInfo && listenerInfo.propName === propName) {
|
|
2884
|
+
// Remove the specific handlers that were created for this listener
|
|
2885
|
+
removeFromArray(handlers.set, listenerInfo.setHandler);
|
|
2886
|
+
removeFromArray(handlers.reset, listenerInfo.resetHandler);
|
|
2887
|
+
changeListeners.delete(listener);
|
|
2888
|
+
}
|
|
2889
|
+
};
|
|
2890
|
+
return {
|
|
2891
|
+
state,
|
|
2892
|
+
get,
|
|
2893
|
+
set,
|
|
2894
|
+
on,
|
|
2895
|
+
onChange,
|
|
2896
|
+
use,
|
|
2897
|
+
dispose,
|
|
2898
|
+
reset,
|
|
2899
|
+
forceUpdate,
|
|
2900
|
+
removeListener,
|
|
2901
|
+
};
|
|
2902
|
+
};
|
|
2903
|
+
const removeFromArray = (array, item) => {
|
|
2904
|
+
const index = array.indexOf(item);
|
|
2905
|
+
if (index >= 0) {
|
|
2906
|
+
array[index] = array[array.length - 1];
|
|
2907
|
+
array.length--;
|
|
2908
|
+
}
|
|
2909
|
+
};
|
|
2910
|
+
|
|
2911
|
+
const createStore = (defaultState, shouldUpdate) => {
|
|
2912
|
+
const map = createObservableMap(defaultState, shouldUpdate);
|
|
2913
|
+
map.use(stencilSubscription());
|
|
2914
|
+
return map;
|
|
2915
|
+
};
|
|
2916
|
+
|
|
2917
|
+
/**
|
|
2918
|
+
* Hide items from main collection
|
|
2919
|
+
* But keep them in store
|
|
2920
|
+
*/
|
|
2921
|
+
const trimmedPlugin = (store) => ({
|
|
2922
|
+
set(k, newVal) {
|
|
2923
|
+
switch (k) {
|
|
2924
|
+
case 'trimmed': {
|
|
2925
|
+
// full sorted items list
|
|
2926
|
+
const proxy = store.get('proxyItems');
|
|
2927
|
+
const trimmed = gatherTrimmedItems(newVal);
|
|
2928
|
+
// filter our physical indexes which are not trimmed
|
|
2929
|
+
const newItems = proxy.filter(v => !trimmed[v]);
|
|
2930
|
+
// set trimmed items in store
|
|
2931
|
+
store.set('items', newItems);
|
|
2932
|
+
break;
|
|
2933
|
+
}
|
|
2934
|
+
}
|
|
2935
|
+
},
|
|
2936
|
+
});
|
|
2937
|
+
function gatherTrimmedItems(trimmedItems) {
|
|
2938
|
+
const trimmed = {};
|
|
2939
|
+
for (let trimmedKey in trimmedItems) {
|
|
2940
|
+
// trimmed overweight not trimmed
|
|
2941
|
+
for (let t in trimmedItems[trimmedKey]) {
|
|
2942
|
+
trimmed[t] = trimmed[t] || trimmedItems[trimmedKey][t];
|
|
2943
|
+
}
|
|
2944
|
+
}
|
|
2945
|
+
return trimmed;
|
|
2946
|
+
}
|
|
2947
|
+
|
|
2948
|
+
/**
|
|
2949
|
+
* Sets the given data on the specified store.
|
|
2950
|
+
*
|
|
2951
|
+
* @param store - The store to set data on.
|
|
2952
|
+
* @param data - The data to set on the store.
|
|
2953
|
+
*/
|
|
2954
|
+
function setStore(store, data) {
|
|
2955
|
+
Object.entries(data).forEach(([key, value]) => {
|
|
2956
|
+
store.set(key, value);
|
|
2957
|
+
});
|
|
2958
|
+
}
|
|
2959
|
+
|
|
2960
|
+
/** Used as references for the maximum length and index of an array. */
|
|
2961
|
+
var MAX_ARRAY_LENGTH$1 = 4294967295,
|
|
2962
|
+
MAX_ARRAY_INDEX = MAX_ARRAY_LENGTH$1 - 1;
|
|
2963
|
+
|
|
2964
|
+
/* Built-in method references for those with the same name as other `lodash` methods. */
|
|
2965
|
+
var nativeFloor = Math.floor,
|
|
2966
|
+
nativeMin = Math.min;
|
|
2967
|
+
|
|
2968
|
+
/**
|
|
2969
|
+
* The base implementation of `_.sortedIndexBy` and `_.sortedLastIndexBy`
|
|
2970
|
+
* which invokes `iteratee` for `value` and each element of `array` to compute
|
|
2971
|
+
* their sort ranking. The iteratee is invoked with one argument; (value).
|
|
2972
|
+
*
|
|
2973
|
+
* @private
|
|
2974
|
+
* @param {Array} array The sorted array to inspect.
|
|
2975
|
+
* @param {*} value The value to evaluate.
|
|
2976
|
+
* @param {Function} iteratee The iteratee invoked per element.
|
|
2977
|
+
* @param {boolean} [retHighest] Specify returning the highest qualified index.
|
|
2978
|
+
* @returns {number} Returns the index at which `value` should be inserted
|
|
2979
|
+
* into `array`.
|
|
2980
|
+
*/
|
|
2981
|
+
function baseSortedIndexBy(array, value, iteratee, retHighest) {
|
|
2982
|
+
var low = 0,
|
|
2983
|
+
high = array == null ? 0 : array.length;
|
|
2984
|
+
if (high === 0) {
|
|
2985
|
+
return 0;
|
|
2986
|
+
}
|
|
2987
|
+
|
|
2988
|
+
value = iteratee(value);
|
|
2989
|
+
var valIsNaN = value !== value,
|
|
2990
|
+
valIsNull = value === null,
|
|
2991
|
+
valIsSymbol = isSymbol(value),
|
|
2992
|
+
valIsUndefined = value === undefined;
|
|
2993
|
+
|
|
2994
|
+
while (low < high) {
|
|
2995
|
+
var mid = nativeFloor((low + high) / 2),
|
|
2996
|
+
computed = iteratee(array[mid]),
|
|
2997
|
+
othIsDefined = computed !== undefined,
|
|
2998
|
+
othIsNull = computed === null,
|
|
2999
|
+
othIsReflexive = computed === computed,
|
|
3000
|
+
othIsSymbol = isSymbol(computed);
|
|
3001
|
+
|
|
3002
|
+
if (valIsNaN) {
|
|
3003
|
+
var setLow = othIsReflexive;
|
|
3004
|
+
} else if (valIsUndefined) {
|
|
3005
|
+
setLow = othIsReflexive && (othIsDefined);
|
|
3006
|
+
} else if (valIsNull) {
|
|
3007
|
+
setLow = othIsReflexive && othIsDefined && (!othIsNull);
|
|
3008
|
+
} else if (valIsSymbol) {
|
|
3009
|
+
setLow = othIsReflexive && othIsDefined && !othIsNull && (!othIsSymbol);
|
|
3010
|
+
} else if (othIsNull || othIsSymbol) {
|
|
3011
|
+
setLow = false;
|
|
3012
|
+
} else {
|
|
3013
|
+
setLow = (computed < value);
|
|
3014
|
+
}
|
|
3015
|
+
if (setLow) {
|
|
3016
|
+
low = mid + 1;
|
|
3017
|
+
} else {
|
|
3018
|
+
high = mid;
|
|
3019
|
+
}
|
|
3020
|
+
}
|
|
3021
|
+
return nativeMin(high, MAX_ARRAY_INDEX);
|
|
3022
|
+
}
|
|
3023
|
+
|
|
3024
|
+
/** Used as references for the maximum length and index of an array. */
|
|
3025
|
+
var MAX_ARRAY_LENGTH = 4294967295,
|
|
3026
|
+
HALF_MAX_ARRAY_LENGTH = MAX_ARRAY_LENGTH >>> 1;
|
|
3027
|
+
|
|
3028
|
+
/**
|
|
3029
|
+
* The base implementation of `_.sortedIndex` and `_.sortedLastIndex` which
|
|
3030
|
+
* performs a binary search of `array` to determine the index at which `value`
|
|
3031
|
+
* should be inserted into `array` in order to maintain its sort order.
|
|
3032
|
+
*
|
|
3033
|
+
* @private
|
|
3034
|
+
* @param {Array} array The sorted array to inspect.
|
|
3035
|
+
* @param {*} value The value to evaluate.
|
|
3036
|
+
* @param {boolean} [retHighest] Specify returning the highest qualified index.
|
|
3037
|
+
* @returns {number} Returns the index at which `value` should be inserted
|
|
3038
|
+
* into `array`.
|
|
3039
|
+
*/
|
|
3040
|
+
function baseSortedIndex(array, value, retHighest) {
|
|
3041
|
+
var low = 0,
|
|
3042
|
+
high = array == null ? low : array.length;
|
|
3043
|
+
|
|
3044
|
+
if (typeof value == 'number' && value === value && high <= HALF_MAX_ARRAY_LENGTH) {
|
|
3045
|
+
while (low < high) {
|
|
3046
|
+
var mid = (low + high) >>> 1,
|
|
3047
|
+
computed = array[mid];
|
|
3048
|
+
|
|
3049
|
+
if (computed !== null && !isSymbol(computed) &&
|
|
3050
|
+
((computed < value))) {
|
|
3051
|
+
low = mid + 1;
|
|
3052
|
+
} else {
|
|
3053
|
+
high = mid;
|
|
3054
|
+
}
|
|
3055
|
+
}
|
|
3056
|
+
return high;
|
|
3057
|
+
}
|
|
3058
|
+
return baseSortedIndexBy(array, value, identity);
|
|
3059
|
+
}
|
|
3060
|
+
|
|
3061
|
+
/**
|
|
3062
|
+
* Uses a binary search to determine the lowest index at which `value`
|
|
3063
|
+
* should be inserted into `array` in order to maintain its sort order.
|
|
3064
|
+
*
|
|
3065
|
+
* @static
|
|
3066
|
+
* @memberOf _
|
|
3067
|
+
* @since 0.1.0
|
|
3068
|
+
* @category Array
|
|
3069
|
+
* @param {Array} array The sorted array to inspect.
|
|
3070
|
+
* @param {*} value The value to evaluate.
|
|
3071
|
+
* @returns {number} Returns the index at which `value` should be inserted
|
|
3072
|
+
* into `array`.
|
|
3073
|
+
* @example
|
|
3074
|
+
*
|
|
3075
|
+
* _.sortedIndex([30, 50], 40);
|
|
3076
|
+
* // => 1
|
|
3077
|
+
*/
|
|
3078
|
+
function sortedIndex(array, value) {
|
|
3079
|
+
return baseSortedIndex(array, value);
|
|
3080
|
+
}
|
|
3081
|
+
|
|
3082
|
+
/**
|
|
3083
|
+
* Pre-calculation
|
|
3084
|
+
* Dimension custom sizes for each cell
|
|
3085
|
+
* Keeps only changed sizes, skips origin size
|
|
3086
|
+
*/
|
|
3087
|
+
function calculateDimensionData(originItemSize, newSizes = {}) {
|
|
3088
|
+
const positionIndexes = [];
|
|
3089
|
+
const positionIndexToItem = {};
|
|
3090
|
+
const indexToItem = {};
|
|
3091
|
+
// prepare order sorted new sizes and calculate changed real size
|
|
3092
|
+
const newIndexes = Object.keys(newSizes).map(Number).sort((a, b) => a - b);
|
|
3093
|
+
let previous;
|
|
3094
|
+
for (let i = 0; i < newIndexes.length; i++) {
|
|
3095
|
+
const itemIndex = newIndexes[i];
|
|
3096
|
+
const newItem = {
|
|
3097
|
+
itemIndex,
|
|
3098
|
+
start: 0,
|
|
3099
|
+
end: 0,
|
|
3100
|
+
};
|
|
3101
|
+
// if previous item was changed too
|
|
3102
|
+
if (previous) {
|
|
3103
|
+
const itemsBetween = (itemIndex - previous.itemIndex - 1) * originItemSize;
|
|
3104
|
+
newItem.start = itemsBetween + previous.end;
|
|
3105
|
+
}
|
|
3106
|
+
else {
|
|
3107
|
+
newItem.start = itemIndex * originItemSize;
|
|
3108
|
+
}
|
|
3109
|
+
newItem.end = newItem.start + newSizes[itemIndex];
|
|
3110
|
+
positionIndexes.push(newItem.start);
|
|
3111
|
+
indexToItem[itemIndex] = positionIndexToItem[i] = newItem;
|
|
3112
|
+
previous = newItem;
|
|
3113
|
+
}
|
|
3114
|
+
return {
|
|
3115
|
+
indexes: newIndexes,
|
|
3116
|
+
positionIndexes: [...positionIndexes],
|
|
3117
|
+
positionIndexToItem: Object.assign({}, positionIndexToItem),
|
|
3118
|
+
indexToItem,
|
|
3119
|
+
};
|
|
3120
|
+
}
|
|
3121
|
+
/**
|
|
3122
|
+
* Calculate item by position
|
|
3123
|
+
*/
|
|
3124
|
+
const getItemByPosition = ({ indexes, positionIndexes, originItemSize, positionIndexToItem, }, pos) => {
|
|
3125
|
+
const item = {
|
|
3126
|
+
itemIndex: 0,
|
|
3127
|
+
start: 0,
|
|
3128
|
+
end: 0,
|
|
3129
|
+
};
|
|
3130
|
+
const currentPlace = indexes.length ? sortedIndex(positionIndexes, pos) : 0;
|
|
3131
|
+
// not found or first index
|
|
3132
|
+
if (!currentPlace) {
|
|
3133
|
+
item.itemIndex = Math.floor(pos / originItemSize);
|
|
3134
|
+
item.start = item.itemIndex * originItemSize;
|
|
3135
|
+
item.end = item.start + originItemSize;
|
|
3136
|
+
return item;
|
|
3137
|
+
}
|
|
3138
|
+
const positionItem = positionIndexToItem[currentPlace - 1];
|
|
3139
|
+
// if item has specified size
|
|
3140
|
+
if (positionItem.end > pos) {
|
|
3141
|
+
return positionItem;
|
|
3142
|
+
}
|
|
3143
|
+
// special size item was present before
|
|
3144
|
+
const relativePos = pos - positionItem.end;
|
|
3145
|
+
const relativeIndex = Math.floor(relativePos / originItemSize);
|
|
3146
|
+
item.itemIndex = positionItem.itemIndex + 1 + relativeIndex;
|
|
3147
|
+
item.start = positionItem.end + relativeIndex * originItemSize;
|
|
3148
|
+
item.end = item.start + originItemSize;
|
|
3149
|
+
return item;
|
|
3150
|
+
};
|
|
3151
|
+
function getItemByIndex(dimension, index) {
|
|
3152
|
+
let item = {
|
|
3153
|
+
itemIndex: index,
|
|
3154
|
+
start: 0,
|
|
3155
|
+
end: 0,
|
|
3156
|
+
};
|
|
3157
|
+
// if item has specified size
|
|
3158
|
+
if (dimension.indexToItem[index]) {
|
|
3159
|
+
return dimension.indexToItem[index];
|
|
3160
|
+
}
|
|
3161
|
+
const currentPlace = dimension.indexes.length
|
|
3162
|
+
? sortedIndex(dimension.indexes, index)
|
|
3163
|
+
: 0;
|
|
3164
|
+
// not found or first index
|
|
3165
|
+
if (!currentPlace) {
|
|
3166
|
+
item.start = item.itemIndex * dimension.originItemSize;
|
|
3167
|
+
item.end = item.start + dimension.originItemSize;
|
|
3168
|
+
return item;
|
|
3169
|
+
}
|
|
3170
|
+
// special size item was present before
|
|
3171
|
+
const positionItem = dimension.indexToItem[dimension.indexes[currentPlace - 1]];
|
|
3172
|
+
item.start =
|
|
3173
|
+
positionItem.end +
|
|
3174
|
+
(index - positionItem.itemIndex - 1) * dimension.originItemSize;
|
|
3175
|
+
item.end = item.start + dimension.originItemSize;
|
|
3176
|
+
return item;
|
|
3177
|
+
}
|
|
3178
|
+
|
|
3179
|
+
const MIN_COL_SIZE = 30;
|
|
3180
|
+
const RESIZE_INTERVAL = 40;
|
|
3181
|
+
const DATA_COL = 'data-rgCol';
|
|
3182
|
+
const DATA_ROW = 'data-rgRow';
|
|
3183
|
+
const DISABLED_CLASS = 'disabled';
|
|
3184
|
+
const CELL_CLASS = 'rgCell';
|
|
3185
|
+
const ROW_HEADER_TYPE = 'rowHeaders';
|
|
3186
|
+
const HEADER_CLASS = 'rgHeaderCell';
|
|
3187
|
+
const HEADER_SORTABLE_CLASS = 'sortable';
|
|
3188
|
+
const HEADER_ROW_CLASS = 'header-rgRow';
|
|
3189
|
+
const HEADER_ACTUAL_ROW_CLASS = 'actual-rgRow';
|
|
3190
|
+
const DRAG_ICON_CLASS = 'revo-drag-icon';
|
|
3191
|
+
const DRAGGABLE_CLASS = 'revo-draggable';
|
|
3192
|
+
const FOCUS_CLASS = 'focused-cell';
|
|
3193
|
+
const SELECTION_BORDER_CLASS = 'selection-border-range';
|
|
3194
|
+
const MOBILE_CLASS = 'mobile-handler';
|
|
3195
|
+
const TMP_SELECTION_BG_CLASS = 'temp-bg-range';
|
|
3196
|
+
const CELL_HANDLER_CLASS = 'autofill-handle';
|
|
3197
|
+
const EDIT_INPUT_WR = 'edit-input-wrapper';
|
|
3198
|
+
const DRAGG_TEXT = 'Draggable item';
|
|
3199
|
+
const GRID_INTERNALS = '__rvgr';
|
|
3200
|
+
const ROW_FOCUSED_CLASS = 'focused-rgRow';
|
|
3201
|
+
|
|
3202
|
+
var codes;
|
|
3203
|
+
(function (codes) {
|
|
3204
|
+
codes[codes["MOUSE_LEFT"] = 1] = "MOUSE_LEFT";
|
|
3205
|
+
codes[codes["MOUSE_RIGHT"] = 3] = "MOUSE_RIGHT";
|
|
3206
|
+
codes[codes["MOUSE_MIDDLE"] = 2] = "MOUSE_MIDDLE";
|
|
3207
|
+
codes[codes["BACKSPACE"] = 8] = "BACKSPACE";
|
|
3208
|
+
codes[codes["COMMA"] = 188] = "COMMA";
|
|
3209
|
+
codes[codes["INSERT"] = 45] = "INSERT";
|
|
3210
|
+
codes[codes["DELETE"] = 46] = "DELETE";
|
|
3211
|
+
codes[codes["END"] = 35] = "END";
|
|
3212
|
+
codes[codes["ENTER"] = 13] = "ENTER";
|
|
3213
|
+
codes[codes["ESCAPE"] = 27] = "ESCAPE";
|
|
3214
|
+
codes[codes["CONTROL"] = 17] = "CONTROL";
|
|
3215
|
+
codes[codes["COMMAND_LEFT"] = 91] = "COMMAND_LEFT";
|
|
3216
|
+
codes[codes["COMMAND_RIGHT"] = 93] = "COMMAND_RIGHT";
|
|
3217
|
+
codes[codes["COMMAND_FIREFOX"] = 224] = "COMMAND_FIREFOX";
|
|
3218
|
+
codes[codes["ALT"] = 18] = "ALT";
|
|
3219
|
+
codes[codes["HOME"] = 36] = "HOME";
|
|
3220
|
+
codes[codes["PAGE_DOWN"] = 34] = "PAGE_DOWN";
|
|
3221
|
+
codes[codes["PAGE_UP"] = 33] = "PAGE_UP";
|
|
3222
|
+
codes[codes["PERIOD"] = 190] = "PERIOD";
|
|
3223
|
+
codes[codes["SPACE"] = 32] = "SPACE";
|
|
3224
|
+
codes[codes["SHIFT"] = 16] = "SHIFT";
|
|
3225
|
+
codes[codes["CAPS_LOCK"] = 20] = "CAPS_LOCK";
|
|
3226
|
+
codes[codes["TAB"] = 9] = "TAB";
|
|
3227
|
+
codes[codes["ARROW_RIGHT"] = 39] = "ARROW_RIGHT";
|
|
3228
|
+
codes[codes["ARROW_LEFT"] = 37] = "ARROW_LEFT";
|
|
3229
|
+
codes[codes["ARROW_UP"] = 38] = "ARROW_UP";
|
|
3230
|
+
codes[codes["ARROW_DOWN"] = 40] = "ARROW_DOWN";
|
|
3231
|
+
codes[codes["F1"] = 112] = "F1";
|
|
3232
|
+
codes[codes["F2"] = 113] = "F2";
|
|
3233
|
+
codes[codes["F3"] = 114] = "F3";
|
|
3234
|
+
codes[codes["F4"] = 115] = "F4";
|
|
3235
|
+
codes[codes["F5"] = 116] = "F5";
|
|
3236
|
+
codes[codes["F6"] = 117] = "F6";
|
|
3237
|
+
codes[codes["F7"] = 118] = "F7";
|
|
3238
|
+
codes[codes["F8"] = 119] = "F8";
|
|
3239
|
+
codes[codes["F9"] = 120] = "F9";
|
|
3240
|
+
codes[codes["F10"] = 121] = "F10";
|
|
3241
|
+
codes[codes["F11"] = 122] = "F11";
|
|
3242
|
+
codes[codes["F12"] = 123] = "F12";
|
|
3243
|
+
codes[codes["A"] = 65] = "A";
|
|
3244
|
+
codes[codes["C"] = 67] = "C";
|
|
3245
|
+
codes[codes["D"] = 68] = "D";
|
|
3246
|
+
codes[codes["F"] = 70] = "F";
|
|
3247
|
+
codes[codes["L"] = 76] = "L";
|
|
3248
|
+
codes[codes["O"] = 79] = "O";
|
|
3249
|
+
codes[codes["P"] = 80] = "P";
|
|
3250
|
+
codes[codes["S"] = 83] = "S";
|
|
3251
|
+
codes[codes["V"] = 86] = "V";
|
|
3252
|
+
codes[codes["X"] = 88] = "X";
|
|
3253
|
+
})(codes || (codes = {}));
|
|
3254
|
+
var codesLetter;
|
|
3255
|
+
(function (codesLetter) {
|
|
3256
|
+
codesLetter["ENTER"] = "Enter";
|
|
3257
|
+
codesLetter["ENTER_NUM"] = "NumpadEnter";
|
|
3258
|
+
codesLetter["A"] = "KeyA";
|
|
3259
|
+
codesLetter["C"] = "KeyC";
|
|
3260
|
+
codesLetter["X"] = "KeyX";
|
|
3261
|
+
codesLetter["V"] = "KeyV";
|
|
3262
|
+
codesLetter["ESCAPE"] = "Escape";
|
|
3263
|
+
codesLetter["TAB"] = "Tab";
|
|
3264
|
+
codesLetter["BACKSPACE"] = "Backspace";
|
|
3265
|
+
codesLetter["DELETE"] = "Delete";
|
|
3266
|
+
codesLetter["ARROW_RIGHT"] = "ArrowRight";
|
|
3267
|
+
codesLetter["ARROW_LEFT"] = "ArrowLeft";
|
|
3268
|
+
codesLetter["ARROW_UP"] = "ArrowUp";
|
|
3269
|
+
codesLetter["ARROW_DOWN"] = "ArrowDown";
|
|
3270
|
+
codesLetter["SHIFT"] = "Shift";
|
|
3271
|
+
})(codesLetter || (codesLetter = {}));
|
|
3272
|
+
var keyValues;
|
|
3273
|
+
(function (keyValues) {
|
|
3274
|
+
keyValues["ENTER"] = "Enter";
|
|
3275
|
+
keyValues["TAB"] = "Tab";
|
|
3276
|
+
})(keyValues || (keyValues = {}));
|
|
3277
|
+
var KeyCodesEnum = codes;
|
|
3278
|
+
|
|
3279
|
+
var osPlatform;
|
|
3280
|
+
(function (osPlatform) {
|
|
3281
|
+
osPlatform["mac"] = "Mac";
|
|
3282
|
+
})(osPlatform || (osPlatform = {}));
|
|
3283
|
+
var OsPlatform = osPlatform;
|
|
3284
|
+
|
|
3285
|
+
/* Generate range on size */
|
|
3286
|
+
function range(size, startAt = 0) {
|
|
3287
|
+
const res = [];
|
|
3288
|
+
const end = startAt + size;
|
|
3289
|
+
for (let i = startAt; i < end; i++) {
|
|
3290
|
+
res.push(i);
|
|
3291
|
+
}
|
|
3292
|
+
return res;
|
|
3293
|
+
}
|
|
3294
|
+
/* Check is right click on mouse event */
|
|
3295
|
+
function checkIsRightClick(e) {
|
|
3296
|
+
return ('button' in e && e.button === 2) || ('which' in e && e.which === 3);
|
|
3297
|
+
}
|
|
3298
|
+
/* Check is focus on specific element */
|
|
3299
|
+
function isFocusOnSpecificElement(elements) {
|
|
3300
|
+
return elements.some(cls => { var _a; return (_a = document.activeElement) === null || _a === void 0 ? void 0 : _a.closest(cls); });
|
|
3301
|
+
}
|
|
3302
|
+
/* Find index position in array */
|
|
3303
|
+
function findPositionInArray(el, compareFn) {
|
|
3304
|
+
return (function (arr) {
|
|
3305
|
+
let m = 0;
|
|
3306
|
+
let n = arr.length - 1;
|
|
3307
|
+
while (m <= n) {
|
|
3308
|
+
const k = (n + m) >> 1;
|
|
3309
|
+
const cmp = compareFn(el, arr[k]);
|
|
3310
|
+
if (cmp > 0) {
|
|
3311
|
+
m = k + 1;
|
|
3312
|
+
}
|
|
3313
|
+
else if (cmp < 0) {
|
|
3314
|
+
n = k - 1;
|
|
3315
|
+
}
|
|
3316
|
+
else {
|
|
3317
|
+
return k;
|
|
3318
|
+
}
|
|
3319
|
+
}
|
|
3320
|
+
return -m - 1;
|
|
3321
|
+
})(this);
|
|
3322
|
+
}
|
|
3323
|
+
/**
|
|
3324
|
+
* Sorted push
|
|
3325
|
+
*/
|
|
3326
|
+
function pushSorted(arr, el, fn) {
|
|
3327
|
+
arr.splice(findPositionInArray.bind(arr)(el, fn), 0, el);
|
|
3328
|
+
return arr;
|
|
3329
|
+
}
|
|
3330
|
+
// (arr1[index1] < arr2[index2])
|
|
3331
|
+
function simpleCompare(el1, el2) {
|
|
3332
|
+
return el1 < el2;
|
|
3333
|
+
}
|
|
3334
|
+
/**
|
|
3335
|
+
* Merge sorted array helper function
|
|
3336
|
+
*/
|
|
3337
|
+
function mergeSortedArray(arr1, arr2, compareFn = simpleCompare) {
|
|
3338
|
+
const merged = [];
|
|
3339
|
+
let index1 = 0;
|
|
3340
|
+
let index2 = 0;
|
|
3341
|
+
let current = 0;
|
|
3342
|
+
while (current < arr1.length + arr2.length) {
|
|
3343
|
+
let isArr1Depleted = index1 >= arr1.length;
|
|
3344
|
+
let isArr2Depleted = index2 >= arr2.length;
|
|
3345
|
+
if (!isArr1Depleted &&
|
|
3346
|
+
(isArr2Depleted || compareFn(arr1[index1], arr2[index2]))) {
|
|
3347
|
+
merged[current] = arr1[index1];
|
|
3348
|
+
index1++;
|
|
3349
|
+
}
|
|
3350
|
+
else {
|
|
3351
|
+
merged[current] = arr2[index2];
|
|
3352
|
+
index2++;
|
|
3353
|
+
}
|
|
3354
|
+
current++;
|
|
3355
|
+
}
|
|
3356
|
+
return merged;
|
|
3357
|
+
}
|
|
3358
|
+
/**
|
|
3359
|
+
* Calculate system scrollbar size
|
|
3360
|
+
*/
|
|
3361
|
+
function getScrollbarSize(document) {
|
|
3362
|
+
// Create a temporary div container and append it to the body
|
|
3363
|
+
const container = document.createElement('div');
|
|
3364
|
+
// Apply styling to ensure the div is scrollable
|
|
3365
|
+
container.style.overflow = 'scroll';
|
|
3366
|
+
container.style.visibility = 'hidden'; // make sure the container isn't visible
|
|
3367
|
+
container.style.position = 'absolute';
|
|
3368
|
+
container.style.top = '-9999px'; // move it out of the screen
|
|
3369
|
+
container.style.width = '50px'; // arbitrary width
|
|
3370
|
+
container.style.height = '50px'; // arbitrary height
|
|
3371
|
+
// Append the div to the body
|
|
3372
|
+
document.body.appendChild(container);
|
|
3373
|
+
// Calculate the width of the scrollbar
|
|
3374
|
+
const scrollbarWidth = container.offsetWidth - container.clientWidth;
|
|
3375
|
+
// Remove the div from the body after calculation
|
|
3376
|
+
document.body.removeChild(container);
|
|
3377
|
+
// Return the calculated width of the scrollbar
|
|
3378
|
+
return scrollbarWidth;
|
|
3379
|
+
}
|
|
3380
|
+
/* Scale a value between 2 ranges
|
|
3381
|
+
*
|
|
3382
|
+
* Sample:
|
|
3383
|
+
* // 55 from a 0-100 range to a 0-1000 range (Ranges don't have to be positive)
|
|
3384
|
+
* const n = scaleValue(55, [0,100], [0,1000]);
|
|
3385
|
+
*
|
|
3386
|
+
* Ranges of two values
|
|
3387
|
+
* @from
|
|
3388
|
+
* @to
|
|
3389
|
+
*
|
|
3390
|
+
* ~~ return value does the equivalent of Math.floor but faster.
|
|
3391
|
+
*/
|
|
3392
|
+
function scaleValue(value, from, to) {
|
|
3393
|
+
return ((to[1] - to[0]) * (value - from[0])) / (from[1] - from[0]) + to[0];
|
|
3394
|
+
}
|
|
3395
|
+
/**
|
|
3396
|
+
* Async timeout
|
|
3397
|
+
*/
|
|
3398
|
+
async function timeout(delay = 0) {
|
|
3399
|
+
await new Promise((r) => {
|
|
3400
|
+
setTimeout(() => r(), delay);
|
|
3401
|
+
});
|
|
3402
|
+
}
|
|
3403
|
+
/**
|
|
3404
|
+
* Type script mixins
|
|
3405
|
+
*/
|
|
3406
|
+
function applyMixins(derivedCtor, constructors) {
|
|
3407
|
+
constructors.forEach(baseCtor => {
|
|
3408
|
+
Object.getOwnPropertyNames(baseCtor.prototype).forEach(name => {
|
|
3409
|
+
Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name) ||
|
|
3410
|
+
Object.create(null));
|
|
3411
|
+
});
|
|
3412
|
+
});
|
|
3413
|
+
}
|
|
3414
|
+
|
|
3415
|
+
/**
|
|
3416
|
+
* Data store
|
|
3417
|
+
* Manage the state of a data source and provide methods for updating, adding, and refreshing the data.
|
|
3418
|
+
*/
|
|
3419
|
+
class DataStore {
|
|
3420
|
+
get store() {
|
|
3421
|
+
return this.dataStore;
|
|
3422
|
+
}
|
|
3423
|
+
constructor(type, storeData) {
|
|
3424
|
+
const store = (this.dataStore = createStore(Object.assign({ items: [], proxyItems: [], source: [], groupingDepth: 0, groups: {}, type, trimmed: {}, groupingCustomRenderer: undefined }, storeData)));
|
|
3425
|
+
store.use(proxyPlugin(store));
|
|
3426
|
+
store.use(trimmedPlugin(store));
|
|
3427
|
+
}
|
|
3428
|
+
/**
|
|
3429
|
+
* full data source update
|
|
3430
|
+
* @param source - data column/rgRow source
|
|
3431
|
+
* @param grouping - grouping information if present
|
|
3432
|
+
*/
|
|
3433
|
+
updateData(source, grouping, silent = false) {
|
|
3434
|
+
// during full update we do drop trim
|
|
3435
|
+
if (!silent) {
|
|
3436
|
+
this.store.set('trimmed', {});
|
|
3437
|
+
}
|
|
3438
|
+
// clear items
|
|
3439
|
+
this.store.set('items', []);
|
|
3440
|
+
const items = range$1(0, (source === null || source === void 0 ? void 0 : source.length) || 0);
|
|
3441
|
+
// set proxy first
|
|
3442
|
+
setStore(this.store, {
|
|
3443
|
+
source,
|
|
3444
|
+
proxyItems: [...items],
|
|
3445
|
+
});
|
|
3446
|
+
// update data items
|
|
3447
|
+
this.store.set('items', items);
|
|
3448
|
+
// apply grouping if present
|
|
3449
|
+
if (grouping) {
|
|
3450
|
+
setStore(this.store, {
|
|
3451
|
+
groupingDepth: grouping.depth,
|
|
3452
|
+
groups: grouping.groups,
|
|
3453
|
+
groupingCustomRenderer: grouping.customRenderer,
|
|
3454
|
+
});
|
|
3455
|
+
}
|
|
3456
|
+
}
|
|
3457
|
+
addTrimmed(some) {
|
|
3458
|
+
let trimmed = this.store.get('trimmed');
|
|
3459
|
+
trimmed = Object.assign(Object.assign({}, trimmed), some);
|
|
3460
|
+
setStore(this.store, { trimmed });
|
|
3461
|
+
}
|
|
3462
|
+
setSourceData(items, mutate = true) {
|
|
3463
|
+
setSourceByVirtualIndex(this.store, items, mutate);
|
|
3464
|
+
}
|
|
3465
|
+
// local data update
|
|
3466
|
+
setData(input) {
|
|
3467
|
+
const data = Object.assign({}, input);
|
|
3468
|
+
setStore(this.store, data);
|
|
3469
|
+
}
|
|
3470
|
+
refresh() {
|
|
3471
|
+
const source = this.store.get('source');
|
|
3472
|
+
this.store.set('source', [...source]);
|
|
3473
|
+
}
|
|
3474
|
+
}
|
|
3475
|
+
/**
|
|
3476
|
+
* get physical index by virtual
|
|
3477
|
+
* @param store - store to process
|
|
3478
|
+
*/
|
|
3479
|
+
function getPhysical(store, virtualIndex) {
|
|
3480
|
+
const items = store.get('items');
|
|
3481
|
+
return items[virtualIndex];
|
|
3482
|
+
}
|
|
3483
|
+
/**
|
|
3484
|
+
* get all visible items
|
|
3485
|
+
* @param store - store to process
|
|
3486
|
+
*/
|
|
3487
|
+
function getVisibleSourceItem(store) {
|
|
3488
|
+
const source = store.get('source');
|
|
3489
|
+
return store.get('items').map(v => source[v]);
|
|
3490
|
+
}
|
|
3491
|
+
/**
|
|
3492
|
+
* get mapped item from source
|
|
3493
|
+
* @param store - store to process
|
|
3494
|
+
* @param virtualIndex - virtual index to process
|
|
3495
|
+
*/
|
|
3496
|
+
const getSourceItem = (store, virtualIndex) => {
|
|
3497
|
+
const source = store.get('source');
|
|
3498
|
+
return source[getSourcePhysicalIndex(store, virtualIndex)];
|
|
3499
|
+
};
|
|
3500
|
+
/**
|
|
3501
|
+
* Get physical index from virtual index
|
|
3502
|
+
*/
|
|
3503
|
+
const getSourcePhysicalIndex = (store, virtualIndex) => {
|
|
3504
|
+
const items = store.get('items');
|
|
3505
|
+
return items[virtualIndex];
|
|
3506
|
+
};
|
|
3507
|
+
/**
|
|
3508
|
+
* Apply silently item/model/row value to data source
|
|
3509
|
+
* @param store - data source with changes
|
|
3510
|
+
* @param modelByIndex - collection of rows/values with virtual indexes to setup/replace in store/data source
|
|
3511
|
+
* @param mutate - if true, store will be mutated and whole viewport will be re-rendered
|
|
3512
|
+
*/
|
|
3513
|
+
function setSourceByVirtualIndex(store, modelByIndex, mutate = true) {
|
|
3514
|
+
const items = store.get('items');
|
|
3515
|
+
const source = store.get('source');
|
|
3516
|
+
for (let virtualIndex in modelByIndex) {
|
|
3517
|
+
const realIndex = items[virtualIndex];
|
|
3518
|
+
const item = modelByIndex[virtualIndex];
|
|
3519
|
+
source[realIndex] = item;
|
|
3520
|
+
}
|
|
3521
|
+
if (mutate) {
|
|
3522
|
+
store.set('source', [...source]);
|
|
3523
|
+
}
|
|
3524
|
+
}
|
|
3525
|
+
/**
|
|
3526
|
+
* set item to source
|
|
3527
|
+
* @param store - store to process
|
|
3528
|
+
* @param modelByIndex - collection of rows with physical indexes to setup
|
|
3529
|
+
* @param mutate - if true, store will be mutated and whole viewport will be re-rendered
|
|
3530
|
+
*/
|
|
3531
|
+
function setSourceByPhysicalIndex(store, modelByIndex, mutate = true) {
|
|
3532
|
+
const source = store.get('source');
|
|
3533
|
+
for (let index in modelByIndex) {
|
|
3534
|
+
source[index] = modelByIndex[index];
|
|
3535
|
+
}
|
|
3536
|
+
if (mutate) {
|
|
3537
|
+
store.set('source', [...source]);
|
|
3538
|
+
}
|
|
3539
|
+
}
|
|
3540
|
+
function setItems(store, items) {
|
|
3541
|
+
store.set('items', items);
|
|
3542
|
+
}
|
|
3543
|
+
function getSourceItemVirtualIndexByProp(store, prop) {
|
|
3544
|
+
const items = store.get('items');
|
|
3545
|
+
const source = store.get('source');
|
|
3546
|
+
const physicalIndex = findIndex(source, { prop });
|
|
3547
|
+
return items.indexOf(physicalIndex);
|
|
3548
|
+
}
|
|
3549
|
+
|
|
3550
|
+
export { baseProperty as $, DATA_ROW as A, DISABLED_CLASS as B, CELL_CLASS as C, DataStore as D, ROW_HEADER_TYPE as E, HEADER_SORTABLE_CLASS as F, HEADER_ROW_CLASS as G, HEADER_CLASS as H, HEADER_ACTUAL_ROW_CLASS as I, DRAG_ICON_CLASS as J, DRAGGABLE_CLASS as K, FOCUS_CLASS as L, MIN_COL_SIZE as M, MOBILE_CLASS as N, CELL_HANDLER_CLASS as O, EDIT_INPUT_WR as P, DRAGG_TEXT as Q, RESIZE_INTERVAL as R, SELECTION_BORDER_CLASS as S, TMP_SELECTION_BG_CLASS as T, GRID_INTERNALS as U, ROW_FOCUSED_CLASS as V, codesLetter as W, keyValues as X, createStore as Y, identity as Z, isArray as _, getVisibleSourceItem as a, isArrayLike as a0, getTag as a1, baseKeys as a2, KeyCodesEnum as a3, OsPlatform as a4, getNative as a5, baseIteratee as a6, toFinite as a7, keys as a8, isIterateeCall as a9, getSourceItem as b, getSourcePhysicalIndex as c, setSourceByPhysicalIndex as d, setItems as e, getSourceItemVirtualIndexByProp as f, getPhysical as g, gatherTrimmedItems as h, calculateDimensionData as i, getItemByPosition as j, getItemByIndex as k, checkIsRightClick as l, isFocusOnSpecificElement as m, findPositionInArray as n, pushSorted as o, proxyPlugin as p, mergeSortedArray as q, range as r, setSourceByVirtualIndex as s, trimmedPlugin as t, getScrollbarSize as u, scaleValue as v, timeout as w, applyMixins as x, setStore as y, DATA_COL as z };
|
|
3551
|
+
//# sourceMappingURL=data.store-B-lvmoFH.js.map
|
|
3552
|
+
|
|
3553
|
+
//# sourceMappingURL=data.store-B-lvmoFH.js.map
|