2.11.97 • Published 1 year ago

@taktikorg/dolorem-hic v2.11.97

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

@taktikorg/dolorem-hic

Common Utils For React Component.

NPM version npm download build status Codecov bundle size dumi

Install

@taktikorg/dolorem-hic

API

createChainedFunction

(...functions): Function

Create a function which will call all the functions with it's arguments from left to right.

import createChainedFunction from '@taktikorg/dolorem-hic/lib/createChainedFunction';

deprecated

(prop: string, instead: string, component: string): void

Log an error message to warn developers that prop is deprecated.

import deprecated from '@taktikorg/dolorem-hic/lib/deprecated';

getContainerRenderMixin

(config: Object): Object

To generate a mixin which will render specific component into specific container automatically.

import getContainerRenderMixin from '@taktikorg/dolorem-hic/lib/getContainerRenderMixin';

Fields in config and their meanings.

FieldTypeDescriptionDefault
autoMountbooleanWhether to render component into container automaticallytrue
autoDestroybooleanWhether to remove container automatically while the component is unmountedtrue
isVisible(instance): booleanA function to get current visibility of the component-
isForceRender(instance): booleanA function to determine whether to render popup even it's not visible-
getComponent(instance, extra): ReactNodeA function to get the component which will be rendered into container-
getContainer(instance): HTMLElementA function to get the container

Portal

Render children to the specific container;

import Portal from '@taktikorg/dolorem-hic/lib/Portal';

Props:

PropTypeDescriptionDefault
childrenReactChildrenContent render to the container-
getContainer(): HTMLElementA function to get the container-

getScrollBarSize

(fresh?: boolean): number

Get the width of scrollbar.

import getScrollBarSize from '@taktikorg/dolorem-hic/lib/getScrollBarSize';

guid

(): string

To generate a global unique id across current application.

import guid from '@taktikorg/dolorem-hic/lib/guid';

pickAttrs

(props: Object): Object

Pick valid HTML attributes and events from props.

import pickAttrs from '@taktikorg/dolorem-hic/lib/pickAttrs';

warn

(msg: string): void

A shallow wrapper of console.warn.

import warn from '@taktikorg/dolorem-hic/lib/warn';

warning

(valid: boolean, msg: string): void

A shallow wrapper of warning, but only warning once for the same message.

import warning, { noteOnce } from '@taktikorg/dolorem-hic/lib/warning';

warning(false, '[antd Component] test hello world');

// Low level note
noteOnce(false, '[antd Component] test hello world');

Children

A collection of functions to operate React elements' children.

Children/mapSelf

(children): children

Return a shallow copy of children.

import mapSelf from '@taktikorg/dolorem-hic/lib/Children/mapSelf';

Children/toArray

(children: ReactNode[]): ReactNode[]

Convert children into an array.

import toArray from '@taktikorg/dolorem-hic/lib/Children/toArray';

Dom

A collection of functions to operate DOM elements.

Dom/addEventlistener

(target: ReactNode, eventType: string, listener: Function): { remove: Function }

A shallow wrapper of add-dom-event-listener.

import addEventlistener from '@taktikorg/dolorem-hic/lib/Dom/addEventlistener';

Dom/canUseDom

(): boolean

Check if DOM is available.

import canUseDom from '@taktikorg/dolorem-hic/lib/Dom/canUseDom';

Dom/class

A collection of functions to operate DOM nodes' class name.

  • hasClass(node: HTMLElement, className: string): boolean
  • addClass(node: HTMLElement, className: string): void
  • removeClass(node: HTMLElement, className: string): void
import cssClass from '@taktikorg/dolorem-hic/lib/Dom/class;

Dom/contains

(root: HTMLElement, node: HTMLElement): boolean

Check if node is equal to root or in the subtree of root.

import contains from '@taktikorg/dolorem-hic/lib/Dom/contains';

Dom/css

A collection of functions to get or set css styles.

  • get(node: HTMLElement, name?: string): any
  • set(node: HTMLElement, name?: string, value: any) | set(node, object)
  • getOuterWidth(el: HTMLElement): number
  • getOuterHeight(el: HTMLElement): number
  • getDocSize(): { width: number, height: number }
  • getClientSize(): { width: number, height: number }
  • getScroll(): { scrollLeft: number, scrollTop: number }
  • getOffset(node: HTMLElement): { left: number, top: number }
import css from '@taktikorg/dolorem-hic/lib/Dom/css';

Dom/focus

A collection of functions to operate focus status of DOM node.

  • saveLastFocusNode(): void
  • clearLastFocusNode(): void
  • backLastFocusNode(): void
  • getFocusNodeList(node: HTMLElement): HTMLElement[] get a list of focusable nodes from the subtree of node.
  • limitTabRange(node: HTMLElement, e: Event): void
import focus from '@taktikorg/dolorem-hic/lib/Dom/focus';

Dom/support

{ animation: boolean | Object, transition: boolean | Object }

A flag to tell whether current environment supports animationend or transitionend.

import support from '@taktikorg/dolorem-hic/lib/Dom/support';

KeyCode

Enum

Enum of KeyCode, please check the definition of it.

import KeyCode from '@taktikorg/dolorem-hic/lib/KeyCode';

KeyCode.isTextModifyingKeyEvent

(e: Event): boolean

Whether text and modified key is entered at the same time.

KeyCode.isCharacterKey

(keyCode: KeyCode): boolean

Whether character is entered.

ScrollLocker

ScrollLocker<{lock: (options: {container: HTMLElement}) => void, unLock: () => void}>

improve shake when page scroll bar hidden.

ScrollLocker change body style, and add a class ant-scrolling-effect when called, so if you page look abnormal, please check this;

import ScrollLocker from '@taktikorg/dolorem-hic/lib/Dom/scrollLocker';

const scrollLocker = new ScrollLocker();

// lock
scrollLocker.lock()

// unLock
scrollLocker.unLock()

License

MIT

springtostringtagidlehttpstestingautoscalingMapformlockfile@@toStringTagObject.valuesistslibclassnamesutilitiessqsassertUnderscorenopeterminalobjArrayBufferfast-deep-cloneiereworkbrowserES2018feednumberassertsinputflagURLformstranspileutilschromium.gitignorereadableweakmapes5fpsreversedquerypackage_.extendswfs3snsemitMicrosoftintrinsicjson-schemachaiES6code pointsbundlerautoprefixerECMAScript 2016core-jsstarterhasOwnECMAScript 2022containsloggingpushRxJScryptoviewasterisksbindpnpm9ES8removeeverycloneestreefunctionsexpressionenumerableawsfpdirmodulesdroptypedESnextfullinstallwalkslicekinesischaractersSystem.globalasciipluginmanagerrangeerrorcompareperformanteast-asian-widthtypanioninspectproxyreverseentriesparsesettermodulereducergetintrinsicInt32Arrayloggerdraglook-uptrimLeftdotenvponyfillisConcatSpreadableECMAScript 2018ES2021waitmkdirpeffect-tsdependencieselbcolumnsqueuetesterexecuteerrorbddnegative zerovalidatorpropertieses-shim APIwebcircularArrayBuffer.prototype.sliceWebSocketinvariantkeysmomenttrimEndavatyped arrayvariablesfindupclass-validatorfile systemcall-boundbingetterefficienttypeFloat32ArrayYAMLaccessorTypedArraynativesubprocesstrimbusymulti-packageomitassertionclassesbuffertoobjectsomegetOwnPropertyDescriptorclassnameECMAScript 2020ECMAScript 6matchAllconfigfast-copySetansiparentsnpmignorereact poseforkl10nscheme-validationboundvalidatedom-testing-librarytypedarraysqueueMicrotaskcall-bindArray.prototype.findLaststructuredClonesetPrototypeOfRxforEachES7javascriptrandomregularemrdebugstylereal-timeidentifiersArraygdprperformancematcheventsextraFloat64Arraytapepostcss-pluginyamlRFC-6455codesimportwhichrapidmove6to5apollocollection__proto__binarywalkingTypeScriptpromiseignoreredux-toolkitmake dirpositiveaccessibilityeslintconfigtoStringTages-shimsebsglobalThispruneimmutablees2018toArraytoolsArray.prototype.flattenxtermbyteObservablezodproprestfulES2022functionalexecfileECMAScript 7styleguidetypesdefinePropertygenericsregexpsesemojisharedarraybuffer.envcloudformationstringifyinternalserializerreact-testing-libraryES2019mkdirjsonbrowserslistawesomesaucedataquerystringlocaldeepcopyfast-deep-copyuser-streamsgesturesnameswhatwgpicomatchformattingrobustfunctionstableUint8ClampedArrayvpcAsyncIteratorObjectparentloglocationlistenersfindbyteOffsetObject.isreduceECMAScript 2015curlfastagentObservablesincludespostcssSymbol.toStringTagObject.entrieshelpersrmdirspecurlkeysyntaxreact animationRegExp#flagsiamECMAScript 5sinatragraphqlespreedeepgrouptermwgetformatmatchesprotobufdeep-cloneasynchasOwnPropertylibphonenumberglobaljsuuidtraverseinternal slotsettingsfullwidthcheckbrowserlistposeajvdirectoryartnegativestringpatchtoSortedeventEmittertoReversedexecastES2017streamflagses2016private datafromUint16ArraysyntaxerrorbyteLength3dvalidunicodeeslint-plugina11ypurekarmagroupByenvironmenttapdeepclonegetArray.prototype.filtertypeofthreegitignoreelasticachestylingdependency managervalidationindicatorsetkoreanInt8Arrayjson-schema-validationcommandertacitupjsdiffcolorsrssxmlHyBicurriedTypeBoxlanguagevisualcommand-linepreprocessorUint8ArrayxhrStyleSheetmonorepoESjshintrestown
2.11.97

1 year ago

2.11.96

1 year ago

2.11.95

1 year ago

2.11.94

1 year ago

2.10.94

1 year ago

2.10.93

1 year ago

2.10.92

1 year ago

2.10.91

1 year ago

2.10.90

1 year ago

2.10.89

1 year ago

2.9.89

1 year ago

2.8.89

1 year ago

2.8.88

1 year ago

2.7.88

1 year ago

2.7.87

1 year ago

2.7.86

1 year ago

2.7.85

1 year ago

2.7.84

1 year ago

2.7.83

1 year ago

2.7.82

1 year ago

2.7.81

1 year ago

2.7.80

1 year ago

2.7.79

1 year ago

2.6.79

1 year ago

2.6.78

1 year ago

2.6.77

1 year ago

2.6.76

1 year ago

2.6.75

1 year ago

2.6.74

1 year ago

2.6.73

1 year ago

2.6.72

1 year ago

2.6.71

1 year ago

2.6.70

1 year ago

2.6.69

1 year ago

2.6.68

1 year ago

2.6.67

1 year ago

2.5.67

1 year ago

2.4.67

1 year ago

2.4.66

1 year ago

2.4.65

1 year ago

2.4.64

1 year ago

2.4.63

1 year ago

2.4.62

1 year ago

2.4.61

1 year ago

2.4.60

1 year ago

2.4.59

1 year ago

2.4.58

1 year ago

2.4.57

1 year ago

2.4.56

1 year ago

2.4.55

1 year ago

2.3.55

1 year ago

2.3.54

1 year ago

2.3.53

1 year ago

2.3.52

1 year ago

2.3.51

1 year ago

2.3.50

1 year ago

2.3.49

1 year ago

2.3.48

1 year ago

2.3.47

1 year ago

2.3.46

1 year ago

2.3.45

1 year ago

1.3.45

1 year ago

1.3.44

1 year ago

1.3.43

1 year ago

1.3.42

1 year ago

1.3.41

1 year ago

1.3.40

1 year ago

1.3.39

1 year ago

1.3.38

1 year ago

1.3.37

1 year ago

1.3.36

1 year ago

1.3.35

1 year ago

1.3.34

1 year ago

1.3.33

1 year ago

1.3.32

1 year ago

1.2.32

1 year ago

1.2.31

1 year ago

1.2.30

1 year ago

1.2.29

1 year ago

1.2.28

1 year ago

1.2.27

1 year ago

1.2.26

1 year ago

1.2.25

1 year ago

1.2.24

1 year ago

1.1.24

1 year ago

1.1.23

1 year ago

1.1.22

1 year ago

1.1.21

1 year ago

1.1.20

1 year ago

1.1.19

1 year ago

1.1.18

1 year ago

1.1.17

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago