dinocollab-core 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rollupPluginBabelHelpers.js +1 -487
- package/dist/_virtual/_rollupPluginBabelHelpers.js.map +1 -1
- package/dist/api-context/alert-global.js +1 -165
- package/dist/api-context/alert-global.js.map +1 -1
- package/dist/api-context/drawer-global.js +1 -111
- package/dist/api-context/drawer-global.js.map +1 -1
- package/dist/api-context/global-modal.js +1 -94
- package/dist/api-context/global-modal.js.map +1 -1
- package/dist/api-context/popover-global.js +1 -109
- package/dist/api-context/popover-global.js.map +1 -1
- package/dist/api-context/popover.js +1 -93
- package/dist/api-context/popover.js.map +1 -1
- package/dist/api-context/ui.units.js +1 -22
- package/dist/api-context/ui.units.js.map +1 -1
- package/dist/components/breadcrumbs.js +1 -64
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/copy-to-clipboard.js +1 -111
- package/dist/components/copy-to-clipboard.js.map +1 -1
- package/dist/components/create.multi-select-dropdown.js +2 -0
- package/dist/components/create.multi-select-dropdown.js.map +1 -0
- package/dist/components/help-tooltip.js +1 -103
- package/dist/components/help-tooltip.js.map +1 -1
- package/dist/components/image-with-fallback.js +1 -50
- package/dist/components/image-with-fallback.js.map +1 -1
- package/dist/components/text-editor.js +1 -117
- package/dist/components/text-editor.js.map +1 -1
- package/dist/components/text-editor.preview.js +1 -26
- package/dist/components/text-editor.preview.js.map +1 -1
- package/dist/filter-bar/base.js +2 -0
- package/dist/filter-bar/base.js.map +1 -0
- package/dist/filter-bar/create.filter-bar.js +2 -0
- package/dist/filter-bar/create.filter-bar.js.map +1 -0
- package/dist/filter-bar/create.filter-menu.js +2 -0
- package/dist/filter-bar/create.filter-menu.js.map +1 -0
- package/dist/filter-bar/create.filter-panel.js +2 -0
- package/dist/filter-bar/create.filter-panel.js.map +1 -0
- package/dist/filter-bar/create.filtered.js +2 -0
- package/dist/filter-bar/create.filtered.js.map +1 -0
- package/dist/filter-bar/create.sort-menu.js +2 -0
- package/dist/filter-bar/create.sort-menu.js.map +1 -0
- package/dist/filter-bar/demo.js +2 -0
- package/dist/filter-bar/demo.js.map +1 -0
- package/dist/filter-bar/types.js +2 -0
- package/dist/filter-bar/types.js.map +1 -0
- package/dist/filter-bar/ui.units.js +2 -0
- package/dist/filter-bar/ui.units.js.map +1 -0
- package/dist/form/create.autocomplete.chips.js +1 -227
- package/dist/form/create.autocomplete.chips.js.map +1 -1
- package/dist/form/create.date-expired.js +1 -210
- package/dist/form/create.date-expired.js.map +1 -1
- package/dist/form/create.date-picker.js +1 -127
- package/dist/form/create.date-picker.js.map +1 -1
- package/dist/form/create.form-base.js +1 -140
- package/dist/form/create.form-base.js.map +1 -1
- package/dist/form/create.form-comfirm.js +1 -130
- package/dist/form/create.form-comfirm.js.map +1 -1
- package/dist/form/create.form-grid-layout.js +1 -187
- package/dist/form/create.form-grid-layout.js.map +1 -1
- package/dist/form/create.form-grid-layout.units.js +1 -41
- package/dist/form/create.form-grid-layout.units.js.map +1 -1
- package/dist/form/create.input.file.js +1 -78
- package/dist/form/create.input.file.js.map +1 -1
- package/dist/form/create.input.js +1 -275
- package/dist/form/create.input.js.map +1 -1
- package/dist/form/create.select-simple.js +1 -113
- package/dist/form/create.select-simple.js.map +1 -1
- package/dist/form/create.select-with-api.js +1 -276
- package/dist/form/create.select-with-api.js.map +1 -1
- package/dist/form/create.text-editor.js +1 -180
- package/dist/form/create.text-editor.js.map +1 -1
- package/dist/form/dino-form.js +1 -40
- package/dist/form/dino-form.js.map +1 -1
- package/dist/form/helper.js +1 -156
- package/dist/form/helper.js.map +1 -1
- package/dist/form/modal-wrapper.js +1 -81
- package/dist/form/modal-wrapper.js.map +1 -1
- package/dist/form/validator.js +1 -189
- package/dist/form/validator.js.map +1 -1
- package/dist/hooks/index.js +1 -47
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.js +1 -32
- package/dist/index.js.map +1 -1
- package/dist/redux/create.hoc-lazy.js +1 -70
- package/dist/redux/create.hoc-lazy.js.map +1 -1
- package/dist/redux/dino.js +1 -10
- package/dist/redux/dino.js.map +1 -1
- package/dist/redux/types.js +1 -8
- package/dist/redux/types.js.map +1 -1
- package/dist/redux/ui.error-page.js +1 -88
- package/dist/redux/ui.error-page.js.map +1 -1
- package/dist/redux/vector-404.webp.js +1 -3
- package/dist/redux/vector-404.webp.js.map +1 -1
- package/dist/table/context.js +1 -14
- package/dist/table/context.js.map +1 -1
- package/dist/table/create.action-row.js +1 -143
- package/dist/table/create.action-row.js.map +1 -1
- package/dist/table/create.table.js +1 -245
- package/dist/table/create.table.js.map +1 -1
- package/dist/table/custom.filter-operators.js +1 -88
- package/dist/table/custom.filter-operators.js.map +1 -1
- package/dist/table/dino.js +1 -135
- package/dist/table/dino.js.map +1 -1
- package/dist/table/helpers.js +1 -114
- package/dist/table/helpers.js.map +1 -1
- package/dist/table/model-filter.js +1 -22
- package/dist/table/model-filter.js.map +1 -1
- package/dist/table/toolbar-pannel.js +1 -142
- package/dist/table/toolbar-pannel.js.map +1 -1
- package/dist/table/ui.buttons.js +1 -66
- package/dist/table/ui.buttons.js.map +1 -1
- package/dist/table/ui.units.js +1 -247
- package/dist/table/ui.units.js.map +1 -1
- package/dist/table-grid/create.table-grid.js +2 -0
- package/dist/table-grid/create.table-grid.js.map +1 -0
- package/dist/table-grid/dino.js +2 -0
- package/dist/table-grid/dino.js.map +1 -0
- package/dist/table-grid/helpers.js +2 -0
- package/dist/table-grid/helpers.js.map +1 -0
- package/dist/table-grid/item-actions.js +2 -0
- package/dist/table-grid/item-actions.js.map +1 -0
- package/dist/table-grid/toolbar-pannel.js +2 -0
- package/dist/table-grid/toolbar-pannel.js.map +1 -0
- package/dist/types/{lab → components}/create.multi-select-dropdown.d.ts +5 -5
- package/dist/types/components/index.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lab/{create.select-mul-with-api/index.d.ts → select-mul-with-api/create.select-mul-with-api.d.ts} +1 -1
- package/dist/types/lab/select-mul-with-api/index.d.ts +2 -0
- package/dist/types/lab/{create.select-mul-with-api → select-mul-with-api}/types.d.ts +1 -1
- package/dist/types/{lab/table-grid → table-grid}/item-actions.d.ts +1 -1
- package/dist/types/{lab/table-grid → table-grid}/toolbar-pannel.d.ts +1 -1
- package/dist/types/{lab/table-grid → table-grid}/types.d.ts +1 -1
- package/dist/utils/dayjs-config.js +1 -11
- package/dist/utils/dayjs-config.js.map +1 -1
- package/dist/utils/helpers.js +1 -198
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/json-object.js +1 -37
- package/dist/utils/json-object.js.map +1 -1
- package/dist/utils/query-param.js +1 -171
- package/dist/utils/query-param.js.map +1 -1
- package/package.json +3 -8
- package/dist/index.d.ts +0 -928
- /package/dist/types/{lab/filter-bar → filter-bar}/base.d.ts +0 -0
- /package/dist/types/{lab/filter-bar → filter-bar}/create.filter-bar.d.ts +0 -0
- /package/dist/types/{lab/filter-bar → filter-bar}/create.filter-menu.d.ts +0 -0
- /package/dist/types/{lab/filter-bar → filter-bar}/create.filter-panel.d.ts +0 -0
- /package/dist/types/{lab/filter-bar → filter-bar}/create.filtered.d.ts +0 -0
- /package/dist/types/{lab/filter-bar → filter-bar}/create.sort-menu.d.ts +0 -0
- /package/dist/types/{lab/filter-bar → filter-bar}/demo.d.ts +0 -0
- /package/dist/types/{lab/filter-bar → filter-bar}/index.d.ts +0 -0
- /package/dist/types/{lab/filter-bar → filter-bar}/types.d.ts +0 -0
- /package/dist/types/{lab/filter-bar → filter-bar}/ui.units.d.ts +0 -0
- /package/dist/types/lab/{create.select-mul-with-api → select-mul-with-api}/table-custom.d.ts +0 -0
- /package/dist/types/lab/{create.select-mul-with-api → select-mul-with-api}/ui.units.d.ts +0 -0
- /package/dist/types/{lab/table-grid → table-grid}/create.table-grid.d.ts +0 -0
- /package/dist/types/{lab/table-grid → table-grid}/demo.d.ts +0 -0
- /package/dist/types/{lab/table-grid → table-grid}/dino.d.ts +0 -0
- /package/dist/types/{lab/table-grid → table-grid}/helpers.d.ts +0 -0
- /package/dist/types/{lab/table-grid → table-grid}/index.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.js","sources":["../../src/form/validator.ts"],"sourcesContent":["import { formatFileSize } from '../utils'\r\n\r\nexport type IModelBase = { [key: string]: any }\r\n\r\nexport enum SingleRuleValidate {\r\n Required = 'Required',\r\n Regex = 'Regex',\r\n RequiredValue = 'RequiredValue',\r\n Array = 'Array',\r\n Number = 'Number',\r\n Email = 'Email',\r\n PhoneNumber = 'PhoneNumber',\r\n Url = 'Url',\r\n File = 'File',\r\n FileRequired = 'FileRequired',\r\n Custom = 'Custom'\r\n}\r\n\r\nconst MessageDefault = {\r\n Required: 'The {0} is required',\r\n Regex: 'The {0} is not match {1}',\r\n RequiredValue: 'the {0} is not equal {1}',\r\n Array: 'The {0} is not valid',\r\n Number: '{0} must be a number',\r\n Email: 'The {0} is not valid',\r\n PhoneNumber: 'The {0} is not valid',\r\n Url: 'The {0} is not valid',\r\n File: 'File size must be less than {1}',\r\n FileRequired: 'The {0} is required',\r\n Custom: 'Error Custom'\r\n}\r\n\r\nexport interface IRuleOptions {\r\n File: {\r\n maxSize: number\r\n // toal size of files\r\n all?: boolean\r\n }\r\n}\r\n\r\nexport const mapRuleOptions = <TK extends keyof IRuleOptions>(key: TK, options?: IRuleOptions[TK]) => options\r\n\r\nexport interface IRuleOption<TModel = any> {\r\n rule: SingleRuleValidate\r\n message?: string\r\n Value?: RegExp | ((value: any, model: TModel) => boolean) | number | Array<any> | boolean\r\n options?: any\r\n}\r\n\r\nexport interface IConfigValue<TModel = any> {\r\n Rules: IRuleOption<TModel>[]\r\n label?: string\r\n}\r\n\r\nexport interface IModelError {\r\n message: string\r\n error: boolean\r\n}\r\n\r\nexport type IFormValidatorConfig<TModel> = {\r\n [key in keyof Extract<TModel, IModelBase>]?: IConfigValue<TModel>\r\n}\r\n\r\nexport type IPartialError<TModel> = {\r\n [key in keyof TModel]?: IRuleOption<TModel>[]\r\n}\r\n\r\nexport default class FormValidator<TModel> {\r\n configs: IFormValidatorConfig<TModel>\r\n constructor(configs: IFormValidatorConfig<TModel>) {\r\n this.configs = configs\r\n }\r\n\r\n static initial = <T>(configs: IFormValidatorConfig<T>) => new FormValidator(configs)\r\n\r\n AddRules = (key: keyof TModel, ...rule: IRuleOption<TModel>[]) => {\r\n let fieldConfig = this.configs[key]\r\n if (!fieldConfig) {\r\n fieldConfig = { Rules: [] }\r\n this.configs[key] = fieldConfig\r\n }\r\n fieldConfig.Rules.push(...rule)\r\n return this\r\n }\r\n\r\n Required = (RuleOption: IRuleOption, value: any) => {\r\n return value === null || value === undefined || value === ''\r\n }\r\n Regex = (RuleOption: IRuleOption, value: string, Regex: RegExp) => {\r\n if (!value) return false\r\n return !(RuleOption.Value as RegExp).test(value)\r\n }\r\n RequiredValue = (RuleOption: IRuleOption, value: any) => {\r\n if (!value) return false\r\n return value !== RuleOption.Value\r\n }\r\n Custom = (RuleOption: IRuleOption, value: any, model: any) => {\r\n if (typeof RuleOption.Value === 'function') {\r\n return RuleOption.Value(value, model)\r\n }\r\n return true\r\n }\r\n Array = (RuleOption: IRuleOption, value: any) => {\r\n if (!value) return false\r\n if (typeof RuleOption.Value === 'number') {\r\n return Array.isArray(value) ? value.length <= RuleOption.Value : true\r\n }\r\n return true\r\n }\r\n Number = (RuleOption: IRuleOption, value: any) => {\r\n if (!value) return false\r\n return isNaN(Number(value))\r\n }\r\n Email = (RuleOption: IRuleOption, value: any) => {\r\n if (!value) return false\r\n const regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$/\r\n return !regex.test(value)\r\n }\r\n PhoneNumber = (RuleOption: IRuleOption, value: any) => {\r\n if (!value) return false\r\n const phoneRegex = /^(\\+?\\d{1,4}[\\s-]?)?((\\(\\d{1,4}\\))|\\d{1,4})[\\s-]?\\d{1,4}[\\s-]?\\d{1,9}$/\r\n return !phoneRegex.test((value ?? '').trim())\r\n }\r\n Url = (RuleOption: IRuleOption, value: any) => {\r\n if (!value) return false\r\n try {\r\n new URL(value)\r\n return false\r\n } catch (err) {\r\n return true\r\n }\r\n }\r\n File = (RuleOption: IRuleOption, value: any) => {\r\n if (!value) return false\r\n const options = mapRuleOptions('File', RuleOption.options)\r\n const files: File[] = Array.isArray(value) ? value : [value]\r\n if (!options) return false\r\n if (options.all === true) {\r\n const size = files.reduce((a, b) => {\r\n a += b.size\r\n return a\r\n }, 0)\r\n return size > options.maxSize\r\n } else {\r\n return files.some((x) => x.size > options.maxSize)\r\n }\r\n }\r\n FileRequired = (RuleOption: IRuleOption, value: any) => {\r\n const files: File[] = Array.isArray(value) ? value : [value]\r\n return !!files.filter((x) => !!x).some((x) => x.size <= 0)\r\n }\r\n RenderMessage = (RuleOption: IRuleOption, key: string, label?: string) => {\r\n if (!RuleOption.message) {\r\n RuleOption.message = MessageDefault[RuleOption.rule].replace('{0}', label ?? key)\r\n switch (RuleOption.rule) {\r\n case SingleRuleValidate.Regex: {\r\n RuleOption.message = RuleOption.message.replace('{1}', (RuleOption.Value as RegExp).source)\r\n break\r\n }\r\n case SingleRuleValidate.RequiredValue: {\r\n RuleOption.message = RuleOption.message.replace('{1}', RuleOption.Value?.toString() ?? '')\r\n break\r\n }\r\n case SingleRuleValidate.File: {\r\n const options = mapRuleOptions('File', RuleOption.options)\r\n if (options?.all === true) {\r\n RuleOption.message = `Total file size must be less than ${formatFileSize((options?.maxSize ?? 0) / 1024)}`\r\n } else {\r\n RuleOption.message = RuleOption.message.replace('{1}', formatFileSize((options?.maxSize ?? 0) / 1024))\r\n }\r\n break\r\n }\r\n default:\r\n break\r\n }\r\n }\r\n RuleOption.message = RuleOption.message.replace('{0}', key)\r\n return RuleOption\r\n }\r\n run = (model: TModel) => {\r\n const keys = Object.keys(this.configs)\r\n const data: IPartialError<TModel> = {}\r\n keys.forEach((key) => {\r\n const config = this.configs[key]\r\n if (!config) return\r\n const tmp = this.Executed(config, (model as any)[key], model)\r\n if (tmp.length < 1) return\r\n ;(data as any)[key] = tmp.map((x) => this.RenderMessage(x, key, config.label))\r\n })\r\n return data\r\n }\r\n Executed = (Config: IConfigValue, valueField: any, model: any) => {\r\n return Config.Rules.filter((Value) => {\r\n const action = (this as any)[Value.rule.toString()]\r\n return action && action(Value, valueField, model)\r\n })\r\n }\r\n}\r\n\r\nexport const createFormValidator = <TModel>() => {\r\n return new FormValidator<Partial<TModel>>({})\r\n}\r\n"],"names":["SingleRuleValidate","MessageDefault","Required","Regex","RequiredValue","Array","Number","Email","PhoneNumber","Url","File","FileRequired","Custom","mapRuleOptions","key","options","FormValidator","_createClass","configs","_this","_classCallCheck","_defineProperty","_fieldConfig$Rules","fieldConfig","Rules","_len","arguments","length","rule","_key","push","apply","RuleOption","value","undefined","Value","test","model","isArray","isNaN","regex","phoneRegex","trim","URL","err","files","all","size","reduce","a","b","maxSize","some","x","filter","label","message","replace","source","_RuleOption$Value$toS","_RuleOption$Value","toString","_options$maxSize","concat","formatFileSize","_options$maxSize2","keys","Object","data","forEach","config","tmp","Executed","map","RenderMessage","Config","valueField","action","_FormValidator","createFormValidator"],"mappings":";;;;;;IAIYA;AAAZ,CAAA,UAAYA,kBAAkB,EAAA;AAC5BA,EAAAA,kBAAA,CAAA,UAAA,CAAA,GAAA,UAAqB;AACrBA,EAAAA,kBAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACfA,EAAAA,kBAAA,CAAA,eAAA,CAAA,GAAA,eAA+B;AAC/BA,EAAAA,kBAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACfA,EAAAA,kBAAA,CAAA,QAAA,CAAA,GAAA,QAAiB;AACjBA,EAAAA,kBAAA,CAAA,OAAA,CAAA,GAAA,OAAe;AACfA,EAAAA,kBAAA,CAAA,aAAA,CAAA,GAAA,aAA2B;AAC3BA,EAAAA,kBAAA,CAAA,KAAA,CAAA,GAAA,KAAW;AACXA,EAAAA,kBA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.js","sources":["../../src/form/validator.ts"],"sourcesContent":["import { formatFileSize } from '../utils'\r\n\r\nexport type IModelBase = { [key: string]: any }\r\n\r\nexport enum SingleRuleValidate {\r\n Required = 'Required',\r\n Regex = 'Regex',\r\n RequiredValue = 'RequiredValue',\r\n Array = 'Array',\r\n Number = 'Number',\r\n Email = 'Email',\r\n PhoneNumber = 'PhoneNumber',\r\n Url = 'Url',\r\n File = 'File',\r\n FileRequired = 'FileRequired',\r\n Custom = 'Custom'\r\n}\r\n\r\nconst MessageDefault = {\r\n Required: 'The {0} is required',\r\n Regex: 'The {0} is not match {1}',\r\n RequiredValue: 'the {0} is not equal {1}',\r\n Array: 'The {0} is not valid',\r\n Number: '{0} must be a number',\r\n Email: 'The {0} is not valid',\r\n PhoneNumber: 'The {0} is not valid',\r\n Url: 'The {0} is not valid',\r\n File: 'File size must be less than {1}',\r\n FileRequired: 'The {0} is required',\r\n Custom: 'Error Custom'\r\n}\r\n\r\nexport interface IRuleOptions {\r\n File: {\r\n maxSize: number\r\n // toal size of files\r\n all?: boolean\r\n }\r\n}\r\n\r\nexport const mapRuleOptions = <TK extends keyof IRuleOptions>(key: TK, options?: IRuleOptions[TK]) => options\r\n\r\nexport interface IRuleOption<TModel = any> {\r\n rule: SingleRuleValidate\r\n message?: string\r\n Value?: RegExp | ((value: any, model: TModel) => boolean) | number | Array<any> | boolean\r\n options?: any\r\n}\r\n\r\nexport interface IConfigValue<TModel = any> {\r\n Rules: IRuleOption<TModel>[]\r\n label?: string\r\n}\r\n\r\nexport interface IModelError {\r\n message: string\r\n error: boolean\r\n}\r\n\r\nexport type IFormValidatorConfig<TModel> = {\r\n [key in keyof Extract<TModel, IModelBase>]?: IConfigValue<TModel>\r\n}\r\n\r\nexport type IPartialError<TModel> = {\r\n [key in keyof TModel]?: IRuleOption<TModel>[]\r\n}\r\n\r\nexport default class FormValidator<TModel> {\r\n configs: IFormValidatorConfig<TModel>\r\n constructor(configs: IFormValidatorConfig<TModel>) {\r\n this.configs = configs\r\n }\r\n\r\n static initial = <T>(configs: IFormValidatorConfig<T>) => new FormValidator(configs)\r\n\r\n AddRules = (key: keyof TModel, ...rule: IRuleOption<TModel>[]) => {\r\n let fieldConfig = this.configs[key]\r\n if (!fieldConfig) {\r\n fieldConfig = { Rules: [] }\r\n this.configs[key] = fieldConfig\r\n }\r\n fieldConfig.Rules.push(...rule)\r\n return this\r\n }\r\n\r\n Required = (RuleOption: IRuleOption, value: any) => {\r\n return value === null || value === undefined || value === ''\r\n }\r\n Regex = (RuleOption: IRuleOption, value: string, Regex: RegExp) => {\r\n if (!value) return false\r\n return !(RuleOption.Value as RegExp).test(value)\r\n }\r\n RequiredValue = (RuleOption: IRuleOption, value: any) => {\r\n if (!value) return false\r\n return value !== RuleOption.Value\r\n }\r\n Custom = (RuleOption: IRuleOption, value: any, model: any) => {\r\n if (typeof RuleOption.Value === 'function') {\r\n return RuleOption.Value(value, model)\r\n }\r\n return true\r\n }\r\n Array = (RuleOption: IRuleOption, value: any) => {\r\n if (!value) return false\r\n if (typeof RuleOption.Value === 'number') {\r\n return Array.isArray(value) ? value.length <= RuleOption.Value : true\r\n }\r\n return true\r\n }\r\n Number = (RuleOption: IRuleOption, value: any) => {\r\n if (!value) return false\r\n return isNaN(Number(value))\r\n }\r\n Email = (RuleOption: IRuleOption, value: any) => {\r\n if (!value) return false\r\n const regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$/\r\n return !regex.test(value)\r\n }\r\n PhoneNumber = (RuleOption: IRuleOption, value: any) => {\r\n if (!value) return false\r\n const phoneRegex = /^(\\+?\\d{1,4}[\\s-]?)?((\\(\\d{1,4}\\))|\\d{1,4})[\\s-]?\\d{1,4}[\\s-]?\\d{1,9}$/\r\n return !phoneRegex.test((value ?? '').trim())\r\n }\r\n Url = (RuleOption: IRuleOption, value: any) => {\r\n if (!value) return false\r\n try {\r\n new URL(value)\r\n return false\r\n } catch (err) {\r\n return true\r\n }\r\n }\r\n File = (RuleOption: IRuleOption, value: any) => {\r\n if (!value) return false\r\n const options = mapRuleOptions('File', RuleOption.options)\r\n const files: File[] = Array.isArray(value) ? value : [value]\r\n if (!options) return false\r\n if (options.all === true) {\r\n const size = files.reduce((a, b) => {\r\n a += b.size\r\n return a\r\n }, 0)\r\n return size > options.maxSize\r\n } else {\r\n return files.some((x) => x.size > options.maxSize)\r\n }\r\n }\r\n FileRequired = (RuleOption: IRuleOption, value: any) => {\r\n const files: File[] = Array.isArray(value) ? value : [value]\r\n return !!files.filter((x) => !!x).some((x) => x.size <= 0)\r\n }\r\n RenderMessage = (RuleOption: IRuleOption, key: string, label?: string) => {\r\n if (!RuleOption.message) {\r\n RuleOption.message = MessageDefault[RuleOption.rule].replace('{0}', label ?? key)\r\n switch (RuleOption.rule) {\r\n case SingleRuleValidate.Regex: {\r\n RuleOption.message = RuleOption.message.replace('{1}', (RuleOption.Value as RegExp).source)\r\n break\r\n }\r\n case SingleRuleValidate.RequiredValue: {\r\n RuleOption.message = RuleOption.message.replace('{1}', RuleOption.Value?.toString() ?? '')\r\n break\r\n }\r\n case SingleRuleValidate.File: {\r\n const options = mapRuleOptions('File', RuleOption.options)\r\n if (options?.all === true) {\r\n RuleOption.message = `Total file size must be less than ${formatFileSize((options?.maxSize ?? 0) / 1024)}`\r\n } else {\r\n RuleOption.message = RuleOption.message.replace('{1}', formatFileSize((options?.maxSize ?? 0) / 1024))\r\n }\r\n break\r\n }\r\n default:\r\n break\r\n }\r\n }\r\n RuleOption.message = RuleOption.message.replace('{0}', key)\r\n return RuleOption\r\n }\r\n run = (model: TModel) => {\r\n const keys = Object.keys(this.configs)\r\n const data: IPartialError<TModel> = {}\r\n keys.forEach((key) => {\r\n const config = this.configs[key]\r\n if (!config) return\r\n const tmp = this.Executed(config, (model as any)[key], model)\r\n if (tmp.length < 1) return\r\n ;(data as any)[key] = tmp.map((x) => this.RenderMessage(x, key, config.label))\r\n })\r\n return data\r\n }\r\n Executed = (Config: IConfigValue, valueField: any, model: any) => {\r\n return Config.Rules.filter((Value) => {\r\n const action = (this as any)[Value.rule.toString()]\r\n return action && action(Value, valueField, model)\r\n })\r\n }\r\n}\r\n\r\nexport const createFormValidator = <TModel>() => {\r\n return new FormValidator<Partial<TModel>>({})\r\n}\r\n"],"names":["SingleRuleValidate","MessageDefault","Required","Regex","RequiredValue","Array","Number","Email","PhoneNumber","Url","File","FileRequired","Custom","mapRuleOptions","key","options","FormValidator","_createClass","configs","_this","this","_classCallCheck","_defineProperty","_fieldConfig$Rules","fieldConfig","Rules","_len","arguments","length","rule","_key","push","apply","RuleOption","value","Value","test","model","isArray","isNaN","trim","URL","err","files","all","reduce","a","b","size","maxSize","some","x","filter","label","message","replace","source","_RuleOption$Value$toS","_RuleOption$Value","toString","_options$maxSize","_options$maxSize2","concat","formatFileSize","keys","Object","data","forEach","config","tmp","Executed","map","RenderMessage","Config","valueField","action","_FormValidator","createFormValidator"],"mappings":"2OAIYA,GAAZ,SAAYA,GACVA,EAAA,SAAA,WACAA,EAAA,MAAA,QACAA,EAAA,cAAA,gBACAA,EAAA,MAAA,QACAA,EAAA,OAAA,SACAA,EAAA,MAAA,QACAA,EAAA,YAAA,cACAA,EAAA,IAAA,MACAA,EAAA,KAAA,OACAA,EAAA,aAAA,eACAA,EAAA,OAAA,QACD,CAZD,CAAYA,IAAAA,EAYX,CAAA,IAED,IAAMC,EAAiB,CACrBC,SAAU,sBACVC,MAAO,2BACPC,cAAe,2BACfC,MAAO,uBACPC,OAAQ,uBACRC,MAAO,uBACPC,YAAa,uBACbC,IAAK,uBACLC,KAAM,kCACNC,aAAc,sBACdC,OAAQ,gBAWGC,EAAiB,SAAgCC,EAASC,GAA0B,OAAKA,CAAO,EA2BxFC,EAAaC,GAEhC,SAAAD,EAAYE,GAAqC,IAAAC,EAAAC,KAAAC,OAAAL,GAAAM,EAAAF,KAAA,YAMtC,SAACN,GAAqD,IAAAS,EAC3DC,EAAcL,EAAKD,QAAQJ,GAC1BU,IACHA,E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,aAAO,EAAPA,EAASkC,eAAOY,IAAAA,EAAAA,EAAI,GAAK,OASxG,OADA5B,EAAWqB,QAAUrB,EAAWqB,QAAQC,QAAQ,MAAOzC,GAChDmB,KACRX,EAAAF,KAAA,OACK,SAACiB,GACL,IAAM2B,EAAOC,OAAOD,KAAK7C,EAAKD,SACxBgD,EAA8B,CAAE,EAQtC,OAPAF,EAAKG,SAAQ,SAACrD,GACZ,IAAMsD,EAASjD,EAAKD,QAAQJ,GAC5B,GAAKsD,EAAL,CACA,IAAMC,EAAMlD,EAAKmD,SAASF,EAAS/B,EAAcvB,GAAMuB,GACnDgC,EAAIzC,OAAS,IACfsC,EAAapD,GAAOuD,EAAIE,KAAI,SAACpB,GAAC,OAAKhC,EAAKqD,cAAcrB,EAAGrC,EAAKsD,EAAOf,UAH1D,CAIf,IACOa,KACR5C,mBACU,SAACmD,EAAsBC,EAAiBrC,GACjD,OAAOoC,EAAOhD,MAAM2B,QAAO,SAACjB,GAC1B,IAAMwC,EAAUxD,EAAagB,EAAMN,KAAK8B,YACxC,OAAOgB,GAAUA,EAAOxC,EAAOuC,EAAYrC,EAC7C,OA7HAjB,KAAKF,QAAUA,CACjB,IAAC0D,EAJkB5D,EAAaM,EAAbN,EAMF,WAAA,SAAIE,GAAgC,OAAK,IAAIF,EAAcE,EAAQ,QA8HzE2D,EAAsB,WACjC,OAAO,IAAI7D,EAA+B,GAC5C"}
|
package/dist/hooks/index.js
CHANGED
|
@@ -1,48 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useState, useEffect } from 'react';
|
|
3
|
-
|
|
4
|
-
var useCheckScrolled = function useCheckScrolled() {
|
|
5
|
-
var _useState = useState(false),
|
|
6
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
7
|
-
isScrolled = _useState2[0],
|
|
8
|
-
setIsScrolled = _useState2[1];
|
|
9
|
-
useEffect(function () {
|
|
10
|
-
var handleScroll = function handleScroll() {
|
|
11
|
-
var scrolled = window.scrollY > 0;
|
|
12
|
-
if (scrolled !== isScrolled) setIsScrolled(scrolled);
|
|
13
|
-
};
|
|
14
|
-
window.addEventListener('scroll', handleScroll);
|
|
15
|
-
return function () {
|
|
16
|
-
return window.removeEventListener('scroll', handleScroll);
|
|
17
|
-
};
|
|
18
|
-
}, [isScrolled]);
|
|
19
|
-
useEffect(function () {
|
|
20
|
-
var scrolled = window.scrollY > 0;
|
|
21
|
-
if (scrolled !== isScrolled) setIsScrolled(scrolled);
|
|
22
|
-
}, []);
|
|
23
|
-
return {
|
|
24
|
-
isScrolled: isScrolled
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
var useDebounce = function useDebounce(value, delay) {
|
|
28
|
-
var _useState3 = useState(value),
|
|
29
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
30
|
-
debouncedValue = _useState4[0],
|
|
31
|
-
setDebouncedValue = _useState4[1];
|
|
32
|
-
useEffect(function () {
|
|
33
|
-
if (delay <= 0) {
|
|
34
|
-
setDebouncedValue(value);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
var handler = setTimeout(function () {
|
|
38
|
-
setDebouncedValue(value);
|
|
39
|
-
}, delay);
|
|
40
|
-
return function () {
|
|
41
|
-
clearTimeout(handler);
|
|
42
|
-
};
|
|
43
|
-
}, [value, delay]);
|
|
44
|
-
return debouncedValue;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
export { useCheckScrolled, useDebounce };
|
|
1
|
+
import{slicedToArray as r}from"../_virtual/_rollupPluginBabelHelpers.js";import{useState as n,useEffect as o}from"react";var t=function(){var t=n(!1),e=r(t,2),i=e[0],u=e[1];return o((function(){var r=function(){var r=window.scrollY>0;r!==i&&u(r)};return window.addEventListener("scroll",r),function(){return window.removeEventListener("scroll",r)}}),[i]),o((function(){var r=window.scrollY>0;r!==i&&u(r)}),[]),{isScrolled:i}},e=function(t,e){var i=n(t),u=r(i,2),l=u[0],c=u[1];return o((function(){if(!(e<=0)){var r=setTimeout((function(){c(t)}),e);return function(){clearTimeout(r)}}c(t)}),[t,e]),l};export{t as useCheckScrolled,e as useDebounce};
|
|
48
2
|
//# sourceMappingURL=index.js.map
|
package/dist/hooks/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/hooks/index.ts"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps*/\r\nimport { useEffect, useState } from 'react'\r\n\r\nexport const useCheckScrolled = () => {\r\n const [isScrolled, setIsScrolled] = useState(false)\r\n\r\n useEffect(() => {\r\n const handleScroll = () => {\r\n const scrolled = window.scrollY > 0\r\n if (scrolled !== isScrolled) setIsScrolled(scrolled)\r\n }\r\n\r\n window.addEventListener('scroll', handleScroll)\r\n return () => window.removeEventListener('scroll', handleScroll)\r\n }, [isScrolled])\r\n\r\n useEffect(() => {\r\n const scrolled = window.scrollY > 0\r\n if (scrolled !== isScrolled) setIsScrolled(scrolled)\r\n }, [])\r\n\r\n return { isScrolled }\r\n}\r\n\r\nexport const useDebounce = <T>(value: T, delay: number): T => {\r\n const [debouncedValue, setDebouncedValue] = useState<T>(value)\r\n\r\n useEffect(() => {\r\n if (delay <= 0) {\r\n setDebouncedValue(value)\r\n return\r\n }\r\n\r\n const handler = setTimeout(() => {\r\n setDebouncedValue(value)\r\n }, delay)\r\n\r\n return () => {\r\n clearTimeout(handler)\r\n }\r\n }, [value, delay])\r\n\r\n return debouncedValue\r\n}\r\n"],"names":["useCheckScrolled","_useState","useState","_useState2","_slicedToArray","isScrolled","setIsScrolled","useEffect","handleScroll","scrolled","window","scrollY","addEventListener","removeEventListener","useDebounce","value","delay","_useState3","_useState4","debouncedValue","setDebouncedValue","handler","setTimeout","clearTimeout"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/hooks/index.ts"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps*/\r\nimport { useEffect, useState } from 'react'\r\n\r\nexport const useCheckScrolled = () => {\r\n const [isScrolled, setIsScrolled] = useState(false)\r\n\r\n useEffect(() => {\r\n const handleScroll = () => {\r\n const scrolled = window.scrollY > 0\r\n if (scrolled !== isScrolled) setIsScrolled(scrolled)\r\n }\r\n\r\n window.addEventListener('scroll', handleScroll)\r\n return () => window.removeEventListener('scroll', handleScroll)\r\n }, [isScrolled])\r\n\r\n useEffect(() => {\r\n const scrolled = window.scrollY > 0\r\n if (scrolled !== isScrolled) setIsScrolled(scrolled)\r\n }, [])\r\n\r\n return { isScrolled }\r\n}\r\n\r\nexport const useDebounce = <T>(value: T, delay: number): T => {\r\n const [debouncedValue, setDebouncedValue] = useState<T>(value)\r\n\r\n useEffect(() => {\r\n if (delay <= 0) {\r\n setDebouncedValue(value)\r\n return\r\n }\r\n\r\n const handler = setTimeout(() => {\r\n setDebouncedValue(value)\r\n }, delay)\r\n\r\n return () => {\r\n clearTimeout(handler)\r\n }\r\n }, [value, delay])\r\n\r\n return debouncedValue\r\n}\r\n"],"names":["useCheckScrolled","_useState","useState","_useState2","_slicedToArray","isScrolled","setIsScrolled","useEffect","handleScroll","scrolled","window","scrollY","addEventListener","removeEventListener","useDebounce","value","delay","_useState3","_useState4","debouncedValue","setDebouncedValue","handler","setTimeout","clearTimeout"],"mappings":"6HAGaA,EAAmB,WAC9B,IAAAC,EAAoCC,GAAS,GAAMC,EAAAC,EAAAH,EAAA,GAA5CI,EAAUF,EAAA,GAAEG,EAAaH,EAAA,GAiBhC,OAfAI,GAAU,WACR,IAAMC,EAAe,WACnB,IAAMC,EAAWC,OAAOC,QAAU,EAC9BF,IAAaJ,GAAYC,EAAcG,EAC5C,EAGD,OADAC,OAAOE,iBAAiB,SAAUJ,GAC3B,WAAA,OAAME,OAAOG,oBAAoB,SAAUL,EAAa,CACjE,GAAG,CAACH,IAEJE,GAAU,WACR,IAAME,EAAWC,OAAOC,QAAU,EAC9BF,IAAaJ,GAAYC,EAAcG,EAC5C,GAAE,IAEI,CAAEJ,WAAAA,EACX,EAEaS,EAAc,SAAIC,EAAUC,GACvC,IAAAC,EAA4Cf,EAAYa,GAAMG,EAAAd,EAAAa,EAAA,GAAvDE,EAAcD,EAAA,GAAEE,EAAiBF,EAAA,GAiBxC,OAfAX,GAAU,WACR,KAAIS,GAAS,GAAb,CAKA,IAAMK,EAAUC,YAAW,WACzBF,EAAkBL,EACnB,GAAEC,GAEH,OAAO,WACLO,aAAaF,EACd,CARA,CAFCD,EAAkBL,EAWtB,GAAG,CAACA,EAAOC,IAEJG,CACT"}
|
package/dist/index.js
CHANGED
|
@@ -1,33 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export { AlertDialog, default as AlertGlobal, ApiAlertContext } from './api-context/alert-global.js';
|
|
3
|
-
export { default as DrawerGlobal } from './api-context/drawer-global.js';
|
|
4
|
-
export { default as GlobalModal, GlobalModalContext, MapGlobalModalContext, withApiGlobalModalConsumerContext, withApiGlobalModalContext } from './api-context/global-modal.js';
|
|
5
|
-
export { MapPopoverGlobalContext, default as PopoverGlobal, PopoverGlobalApi, PopoverGlobalContext, PopoverGlobalProvider, withPopoverGlobalContext } from './api-context/popover-global.js';
|
|
6
|
-
export { default as Breadcrumbs } from './components/breadcrumbs.js';
|
|
7
|
-
export { default as CopyToClipboard } from './components/copy-to-clipboard.js';
|
|
8
|
-
export { default as ImageWithFallback } from './components/image-with-fallback.js';
|
|
9
|
-
export { default as HelpTooltip, HelpTooltipWrap } from './components/help-tooltip.js';
|
|
10
|
-
export { default as TextEditorPreview } from './components/text-editor.preview.js';
|
|
11
|
-
export { default as TextEditor, textEditorClasses } from './components/text-editor.js';
|
|
12
|
-
export { default as FormValidator, SingleRuleValidate, createFormValidator, mapRuleOptions } from './form/validator.js';
|
|
13
|
-
export { default as DinoForm } from './form/dino-form.js';
|
|
14
|
-
export { convertFormDataToJson, getErrorMessage } from './form/helper.js';
|
|
15
|
-
export { useCheckScrolled, useDebounce } from './hooks/index.js';
|
|
16
|
-
export { ELazyStatus } from './redux/types.js';
|
|
17
|
-
export { default as DinoRedux } from './redux/dino.js';
|
|
18
|
-
export { default as CreateHocLazy, EmptyComponent, defaultOptionHocLazy } from './redux/create.hoc-lazy.js';
|
|
19
|
-
export { ELogic, EOperator, EOrder } from './table/model-filter.js';
|
|
20
|
-
import 'react/jsx-runtime';
|
|
21
|
-
import 'react';
|
|
22
|
-
import '@mui/material';
|
|
23
|
-
import '@mui/icons-material/Edit';
|
|
24
|
-
import '@mui/icons-material/Delete';
|
|
25
|
-
export { decodeBase64, encodeBase64, fetchDelay, formatCapitalizeFirstText, formatCurrency, formatDatetime, formatFileSize, formatNumberWithCommas, mergeClasses, mergeObjects, sleep, tryParseArray, tryParseIntRequired, tryParseObject, windowScrollToTop } from './utils/helpers.js';
|
|
26
|
-
export { default as JObject } from './utils/json-object.js';
|
|
27
|
-
export { QueryParam } from './utils/query-param.js';
|
|
28
|
-
import './utils/dayjs-config.js';
|
|
29
|
-
export { default as CreateTable } from './table/create.table.js';
|
|
30
|
-
export { default as DinoTable } from './table/dino.js';
|
|
31
|
-
export { dinoTableClasses } from './table/helpers.js';
|
|
32
|
-
export { default as dayjsCustom } from 'dayjs';
|
|
1
|
+
export{default as ApiPopover,ApiPopoverContext,MapApiPopoverContext,withApiPopoverContext}from"./api-context/popover.js";export{AlertDialog,default as AlertGlobal,ApiAlertContext}from"./api-context/alert-global.js";export{default as DrawerGlobal}from"./api-context/drawer-global.js";export{default as GlobalModal,GlobalModalContext,MapGlobalModalContext,withApiGlobalModalConsumerContext,withApiGlobalModalContext}from"./api-context/global-modal.js";export{MapPopoverGlobalContext,default as PopoverGlobal,PopoverGlobalApi,PopoverGlobalContext,PopoverGlobalProvider,withPopoverGlobalContext}from"./api-context/popover-global.js";export{default as Breadcrumbs}from"./components/breadcrumbs.js";export{default as CopyToClipboard}from"./components/copy-to-clipboard.js";export{default as CreateMultiSelectDropdown}from"./components/create.multi-select-dropdown.js";export{default as ImageWithFallback}from"./components/image-with-fallback.js";export{default as HelpTooltip,HelpTooltipWrap}from"./components/help-tooltip.js";export{default as TextEditorPreview}from"./components/text-editor.preview.js";export{default as TextEditor,textEditorClasses}from"./components/text-editor.js";export{default as FormValidator,SingleRuleValidate,createFormValidator,mapRuleOptions}from"./form/validator.js";export{default as DinoForm}from"./form/dino-form.js";export{convertFormDataToJson,getErrorMessage}from"./form/helper.js";export{useCheckScrolled,useDebounce}from"./hooks/index.js";export{ELazyStatus}from"./redux/types.js";export{default as DinoRedux}from"./redux/dino.js";export{default as CreateHocLazy,EmptyComponent,defaultOptionHocLazy}from"./redux/create.hoc-lazy.js";export{ELogic,EOperator,EOrder}from"./table/model-filter.js";import"react/jsx-runtime";import"react";import"@mui/material";import"@mui/icons-material/Edit";import"@mui/icons-material/Delete";export{decodeBase64,encodeBase64,fetchDelay,formatCapitalizeFirstText,formatCurrency,formatDatetime,formatFileSize,formatNumberWithCommas,mergeClasses,mergeObjects,sleep,tryParseArray,tryParseIntRequired,tryParseObject,windowScrollToTop}from"./utils/helpers.js";export{default as JObject}from"./utils/json-object.js";export{QueryParam}from"./utils/query-param.js";import"./utils/dayjs-config.js";export{default as CreateTable}from"./table/create.table.js";export{default as DinoTable}from"./table/dino.js";export{dinoTableClasses}from"./table/helpers.js";export{default as DinoTableGrid}from"./table-grid/dino.js";export{default as dayjsCustom}from"dayjs";
|
|
33
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,71 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
-
import { Component } from 'react';
|
|
4
|
-
import { ELazyStatus } from './types.js';
|
|
5
|
-
import UIErrorPage from './ui.error-page.js';
|
|
6
|
-
|
|
7
|
-
var EmptyComponent = function EmptyComponent(_ref) {
|
|
8
|
-
var children = _ref.children;
|
|
9
|
-
return jsx(Fragment, {
|
|
10
|
-
children: children
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
var defaultOptionHocLazy = {
|
|
14
|
-
LazySpinner: EmptyComponent
|
|
15
|
-
};
|
|
16
|
-
var CreateHocLazy = function CreateHocLazy(ChildComponent, options) {
|
|
17
|
-
var HocComponent = /*#__PURE__*/function (_Component) {
|
|
18
|
-
function HocComponent(props) {
|
|
19
|
-
var _this;
|
|
20
|
-
_classCallCheck(this, HocComponent);
|
|
21
|
-
_this = _callSuper(this, HocComponent, [props]);
|
|
22
|
-
_defineProperty(_this, "initialParam", function () {
|
|
23
|
-
var _options$param, _this$props$param, _this$props;
|
|
24
|
-
var oData = (_options$param = options === null || options === void 0 ? void 0 : options.param) !== null && _options$param !== void 0 ? _options$param : {};
|
|
25
|
-
var pData = (_this$props$param = (_this$props = _this.props) === null || _this$props === void 0 ? void 0 : _this$props.param) !== null && _this$props$param !== void 0 ? _this$props$param : {};
|
|
26
|
-
return Object.assign({}, oData, pData);
|
|
27
|
-
});
|
|
28
|
-
_defineProperty(_this, "componentDidMount", function () {
|
|
29
|
-
if (_this.props.fetchData) {
|
|
30
|
-
var _this$tokenSources;
|
|
31
|
-
var param = _this.initialParam();
|
|
32
|
-
(_this$tokenSources = _this.tokenSources) === null || _this$tokenSources === void 0 || _this$tokenSources.abort();
|
|
33
|
-
_this.tokenSources = new AbortController();
|
|
34
|
-
_this.fetchSource = _this.props.fetchData(param, _this.tokenSources.signal);
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
_this.optionsMerge = Object.assign({}, defaultOptionHocLazy, options);
|
|
38
|
-
return _this;
|
|
39
|
-
}
|
|
40
|
-
_inherits(HocComponent, _Component);
|
|
41
|
-
return _createClass(HocComponent, [{
|
|
42
|
-
key: "render",
|
|
43
|
-
value: function render() {
|
|
44
|
-
var OptionsMerge = this.optionsMerge;
|
|
45
|
-
switch (this.props.status) {
|
|
46
|
-
case ELazyStatus.Loading:
|
|
47
|
-
case ELazyStatus.Loaded:
|
|
48
|
-
return jsx(OptionsMerge.LazySpinner, {
|
|
49
|
-
loading: this.props.status === ELazyStatus.Loading,
|
|
50
|
-
children: jsx(ChildComponent, _objectSpread2({}, this.props))
|
|
51
|
-
});
|
|
52
|
-
case ELazyStatus.Error:
|
|
53
|
-
return jsx(UIErrorPage, {});
|
|
54
|
-
default:
|
|
55
|
-
return jsx("div", {});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}, {
|
|
59
|
-
key: "componentWillUnmount",
|
|
60
|
-
value: function componentWillUnmount() {
|
|
61
|
-
var _this$tokenSources2, _this$fetchSource;
|
|
62
|
-
(_this$tokenSources2 = this.tokenSources) === null || _this$tokenSources2 === void 0 || _this$tokenSources2.abort();
|
|
63
|
-
((_this$fetchSource = this.fetchSource) === null || _this$fetchSource === void 0 ? void 0 : _this$fetchSource.abort) && this.fetchSource.abort();
|
|
64
|
-
}
|
|
65
|
-
}]);
|
|
66
|
-
}(Component);
|
|
67
|
-
return HocComponent;
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
export { EmptyComponent, CreateHocLazy as default, defaultOptionHocLazy };
|
|
1
|
+
import{inherits as r,createClass as t,objectSpread2 as e,classCallCheck as o,callSuper as n,defineProperty as i}from"../_virtual/_rollupPluginBabelHelpers.js";import{jsx as a,Fragment as s}from"react/jsx-runtime";import{Component as u}from"react";import{ELazyStatus as l}from"./types.js";import c from"./ui.error-page.js";var p=function(r){var t=r.children;return a(s,{children:t})},d={LazySpinner:p},f=function(s,p){return function(){function f(r){var t;return o(this,f),t=n(this,f,[r]),i(t,"initialParam",(function(){var r,e,o,n=null!==(r=null==p?void 0:p.param)&&void 0!==r?r:{},i=null!==(e=null===(o=t.props)||void 0===o?void 0:o.param)&&void 0!==e?e:{};return Object.assign({},n,i)})),i(t,"componentDidMount",(function(){if(t.props.fetchData){var r,e=t.initialParam();null===(r=t.tokenSources)||void 0===r||r.abort(),t.tokenSources=new AbortController,t.fetchSource=t.props.fetchData(e,t.tokenSources.signal)}})),t.optionsMerge=Object.assign({},d,p),t}return r(f,u),t(f,[{key:"render",value:function(){var r=this.optionsMerge;switch(this.props.status){case l.Loading:case l.Loaded:return a(r.LazySpinner,{loading:this.props.status===l.Loading,children:a(s,e({},this.props))});case l.Error:return a(c,{});default:return a("div",{})}}},{key:"componentWillUnmount",value:function(){var r,t;null===(r=this.tokenSources)||void 0===r||r.abort(),(null===(t=this.fetchSource)||void 0===t?void 0:t.abort)&&this.fetchSource.abort()}}])}()};export{p as EmptyComponent,f as default,d as defaultOptionHocLazy};
|
|
71
2
|
//# sourceMappingURL=create.hoc-lazy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.hoc-lazy.js","sources":["../../src/redux/create.hoc-lazy.tsx"],"sourcesContent":["import React, { Component, ComponentType, PropsWithChildren } from 'react'\r\nimport { IErrorViewDefaultProps, IHocLazyWrapperProps } from './ui.units'\r\nimport { ELazyStatus, IDinoReduxDispatch, IDinoReduxState, IReturnDispatch } from './types'\r\nimport UIErrorPage from './ui.error-page'\r\n\r\nexport interface IHocLazyBase<T> extends IDinoReduxState, IDinoReduxDispatch<T> {}\r\n\r\nexport interface IHocLazyBaseOptions {\r\n ErrorScreen?: React.ComponentType<IErrorViewDefaultProps>\r\n LazySpinner: React.ComponentType<PropsWithChildren<IHocLazyWrapperProps>>\r\n}\r\n\r\nexport interface IHocLazyOtherProps<T> {\r\n param?: T\r\n}\r\n\r\nexport interface IHocLazyOptions<T> extends IHocLazyOtherProps<T>, Omit<IHocLazyBaseOptions, 'LazySpinner'> {\r\n LazySpinner?: React.ComponentType<PropsWithChildren<IHocLazyWrapperProps>>\r\n}\r\n\r\nexport const EmptyComponent: React.FC<React.PropsWithChildren<any>> = ({ children }) => <>{children}</>\r\n\r\nexport const defaultOptionHocLazy: IHocLazyBaseOptions = {\r\n LazySpinner: EmptyComponent\r\n}\r\n\r\nconst CreateHocLazy = function <P extends IHocLazyBase<T>, T = any>(\r\n ChildComponent: React.ComponentType<P>,\r\n options?: IHocLazyOptions<T>\r\n): ComponentType<P> {\r\n type TProps = P & IHocLazyOtherProps<T>\r\n class HocComponent extends Component<TProps> {\r\n optionsMerge: IHocLazyBaseOptions\r\n tokenSources?: AbortController\r\n fetchSource?: IReturnDispatch\r\n constructor(props: TProps) {\r\n super(props)\r\n this.optionsMerge = Object.assign({}, defaultOptionHocLazy, options) as IHocLazyBaseOptions\r\n }\r\n\r\n render() {\r\n const { optionsMerge: OptionsMerge } = this\r\n switch (this.props.status) {\r\n case ELazyStatus.Loading:\r\n case ELazyStatus.Loaded:\r\n return (\r\n <OptionsMerge.LazySpinner loading={this.props.status === ELazyStatus.Loading}>\r\n <ChildComponent {...this.props} />\r\n </OptionsMerge.LazySpinner>\r\n )\r\n case ELazyStatus.Error:\r\n return <UIErrorPage />\r\n default:\r\n return <div></div>\r\n }\r\n }\r\n\r\n initialParam = (): T => {\r\n const oData = options?.param ?? {}\r\n const pData = this.props?.param ?? {}\r\n return Object.assign({}, oData, pData) as T\r\n }\r\n\r\n componentDidMount = () => {\r\n if (this.props.fetchData) {\r\n const param = this.initialParam()\r\n this.tokenSources?.abort()\r\n this.tokenSources = new AbortController()\r\n this.fetchSource = this.props.fetchData(param, this.tokenSources.signal)\r\n }\r\n }\r\n\r\n componentWillUnmount() {\r\n this.tokenSources?.abort()\r\n this.fetchSource?.abort && this.fetchSource.abort()\r\n }\r\n }\r\n return HocComponent\r\n}\r\nexport default CreateHocLazy\r\n"],"names":["EmptyComponent","_ref","children","_jsx","_Fragment","defaultOptionHocLazy","LazySpinner","CreateHocLazy","ChildComponent","options","HocComponent","
|
|
1
|
+
{"version":3,"file":"create.hoc-lazy.js","sources":["../../src/redux/create.hoc-lazy.tsx"],"sourcesContent":["import React, { Component, ComponentType, PropsWithChildren } from 'react'\r\nimport { IErrorViewDefaultProps, IHocLazyWrapperProps } from './ui.units'\r\nimport { ELazyStatus, IDinoReduxDispatch, IDinoReduxState, IReturnDispatch } from './types'\r\nimport UIErrorPage from './ui.error-page'\r\n\r\nexport interface IHocLazyBase<T> extends IDinoReduxState, IDinoReduxDispatch<T> {}\r\n\r\nexport interface IHocLazyBaseOptions {\r\n ErrorScreen?: React.ComponentType<IErrorViewDefaultProps>\r\n LazySpinner: React.ComponentType<PropsWithChildren<IHocLazyWrapperProps>>\r\n}\r\n\r\nexport interface IHocLazyOtherProps<T> {\r\n param?: T\r\n}\r\n\r\nexport interface IHocLazyOptions<T> extends IHocLazyOtherProps<T>, Omit<IHocLazyBaseOptions, 'LazySpinner'> {\r\n LazySpinner?: React.ComponentType<PropsWithChildren<IHocLazyWrapperProps>>\r\n}\r\n\r\nexport const EmptyComponent: React.FC<React.PropsWithChildren<any>> = ({ children }) => <>{children}</>\r\n\r\nexport const defaultOptionHocLazy: IHocLazyBaseOptions = {\r\n LazySpinner: EmptyComponent\r\n}\r\n\r\nconst CreateHocLazy = function <P extends IHocLazyBase<T>, T = any>(\r\n ChildComponent: React.ComponentType<P>,\r\n options?: IHocLazyOptions<T>\r\n): ComponentType<P> {\r\n type TProps = P & IHocLazyOtherProps<T>\r\n class HocComponent extends Component<TProps> {\r\n optionsMerge: IHocLazyBaseOptions\r\n tokenSources?: AbortController\r\n fetchSource?: IReturnDispatch\r\n constructor(props: TProps) {\r\n super(props)\r\n this.optionsMerge = Object.assign({}, defaultOptionHocLazy, options) as IHocLazyBaseOptions\r\n }\r\n\r\n render() {\r\n const { optionsMerge: OptionsMerge } = this\r\n switch (this.props.status) {\r\n case ELazyStatus.Loading:\r\n case ELazyStatus.Loaded:\r\n return (\r\n <OptionsMerge.LazySpinner loading={this.props.status === ELazyStatus.Loading}>\r\n <ChildComponent {...this.props} />\r\n </OptionsMerge.LazySpinner>\r\n )\r\n case ELazyStatus.Error:\r\n return <UIErrorPage />\r\n default:\r\n return <div></div>\r\n }\r\n }\r\n\r\n initialParam = (): T => {\r\n const oData = options?.param ?? {}\r\n const pData = this.props?.param ?? {}\r\n return Object.assign({}, oData, pData) as T\r\n }\r\n\r\n componentDidMount = () => {\r\n if (this.props.fetchData) {\r\n const param = this.initialParam()\r\n this.tokenSources?.abort()\r\n this.tokenSources = new AbortController()\r\n this.fetchSource = this.props.fetchData(param, this.tokenSources.signal)\r\n }\r\n }\r\n\r\n componentWillUnmount() {\r\n this.tokenSources?.abort()\r\n this.fetchSource?.abort && this.fetchSource.abort()\r\n }\r\n }\r\n return HocComponent\r\n}\r\nexport default CreateHocLazy\r\n"],"names":["EmptyComponent","_ref","children","_jsx","_Fragment","defaultOptionHocLazy","LazySpinner","CreateHocLazy","ChildComponent","options","HocComponent","props","_this","_classCallCheck","_callSuper","_defineProperty","_options$param","_this$props$param","_this$props","oData","param","pData","Object","assign","fetchData","_this$tokenSources","initialParam","tokenSources","abort","AbortController","fetchSource","signal","optionsMerge","_inherits","Component","_createClass","key","value","OptionsMerge","this","status","ELazyStatus","Loading","Loaded","loading","_objectSpread","Error","UIErrorPage","_this$tokenSources2","_this$fetchSource"],"mappings":"sUAoBaA,EAAyD,SAA3CC,GAAA,IAA8CC,EAAQD,EAARC,SAAQ,OAAOC,EAAGC,EAAA,CAAAF,SAAAA,GAAY,EAE1FG,EAA4C,CACvDC,YAAaN,GAGTO,EAAgB,SACpBC,EACAC,GAiDA,kBA1CE,SAAAC,EAAYC,GAAa,IAAAC,EAEoE,OAFpEC,OAAAH,GACvBE,EAAAE,EAAAJ,KAAAA,GAAMC,IAAMI,EAAAH,EAAA,gBAqBC,WAAQ,IAAAI,EAAAC,EAAAC,EACfC,EAAsBH,QAAjBA,EAAGP,aAAO,EAAPA,EAASW,iBAAKJ,EAAAA,EAAI,CAAE,EAC5BK,EAAyB,QAApBJ,EAAa,QAAbC,EAAGN,EAAKD,aAALO,IAAUA,OAAVA,EAAAA,EAAYE,aAAKH,IAAAA,EAAAA,EAAI,CAAE,EACrC,OAAOK,OAAOC,OAAO,GAAIJ,EAAOE,MACjCN,EAAAH,EAAA,qBAEmB,WAClB,GAAIA,EAAKD,MAAMa,UAAW,CAAA,IAAAC,EAClBL,EAAQR,EAAKc,eACF,QAAjBD,EAAAb,EAAKe,oBAAY,IAAAF,GAAjBA,EAAmBG,QACnBhB,EAAKe,aAAe,IAAIE,gBACxBjB,EAAKkB,YAAclB,EAAKD,MAAMa,UAAUJ,EAAOR,EAAKe,aAAaI,OAClE,KAhCDnB,EAAKoB,aAAeV,OAAOC,OAAO,CAAE,EAAElB,EAAsBI,GAA+BG,CAC7F,CAAC,OAAAqB,EAAAvB,EAPwBwB,GAOxBC,EAAAzB,EAAA,CAAA,CAAA0B,IAAA,SAAAC,MAED,WACE,IAAsBC,EAAiBC,KAA/BP,aACR,OAAQO,KAAK5B,MAAM6B,QACjB,KAAKC,EAAYC,QACjB,KAAKD,EAAYE,OACf,OACExC,EAACmC,EAAahC,YAAY,CAAAsC,QAASL,KAAK5B,MAAM6B,SAAWC,EAAYC,QACnExC,SAAAC,EAACK,EAAcqC,EAAK,CAAA,EAAAN,KAAK5B,UAG/B,KAAK8B,EAAYK,MACf,OAAO3C,EAAC4C,EAAW,IACrB,QACE,OAAO5C,YAEb,GAAC,CAAAiC,IAAA,uBAAAC,MAiBD,WAAoB,IAAAW,EAAAC,EACD,QAAjBD,EAAIT,KAACZ,oBAAY,IAAAqB,GAAjBA,EAAmBpB,SACH,QAAhBqB,EAAIV,KAACT,mBAALmB,IAAgBA,OAAhBA,EAAAA,EAAkBrB,QAASW,KAAKT,YAAYF,OAC9C,IAAC,GAGL"}
|
package/dist/redux/dino.js
CHANGED
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import CreateHocLazy from './create.hoc-lazy.js';
|
|
3
|
-
|
|
4
|
-
var DinoReduxBase = /*#__PURE__*/_createClass(function DinoReduxBase() {
|
|
5
|
-
_classCallCheck(this, DinoReduxBase);
|
|
6
|
-
_defineProperty(this, "createHocLazy", CreateHocLazy);
|
|
7
|
-
});
|
|
8
|
-
var DinoRedux = new DinoReduxBase();
|
|
9
|
-
|
|
10
|
-
export { DinoRedux as default };
|
|
1
|
+
import{createClass as a,classCallCheck as e,defineProperty as r}from"../_virtual/_rollupPluginBabelHelpers.js";import s from"./create.hoc-lazy.js";var l=new(a((function a(){e(this,a),r(this,"createHocLazy",s)})));export{l as default};
|
|
11
2
|
//# sourceMappingURL=dino.js.map
|
package/dist/redux/dino.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dino.js","sources":["../../src/redux/dino.ts"],"sourcesContent":["import CreateHocLazy from './create.hoc-lazy'\r\n\r\nclass DinoReduxBase {\r\n createHocLazy = CreateHocLazy\r\n}\r\n\r\nconst DinoRedux = new DinoReduxBase()\r\n\r\nexport default DinoRedux\r\n"],"names":["
|
|
1
|
+
{"version":3,"file":"dino.js","sources":["../../src/redux/dino.ts"],"sourcesContent":["import CreateHocLazy from './create.hoc-lazy'\r\n\r\nclass DinoReduxBase {\r\n createHocLazy = CreateHocLazy\r\n}\r\n\r\nconst DinoRedux = new DinoReduxBase()\r\n\r\nexport default DinoRedux\r\n"],"names":["DinoRedux","_createClass","DinoReduxBase","_classCallCheck","_defineProperty","CreateHocLazy"],"mappings":"mJAA6C,IAMvCA,EAAY,IAJCC,GAAA,SAAAC,IAAAC,OAAAD,GAAAE,uBACDC,EAAa"}
|
package/dist/redux/types.js
CHANGED
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
var ELazyStatus;
|
|
2
|
-
(function (ELazyStatus) {
|
|
3
|
-
ELazyStatus["Loading"] = "Loading";
|
|
4
|
-
ELazyStatus["Loaded"] = "Loaded";
|
|
5
|
-
ELazyStatus["Error"] = "Error";
|
|
6
|
-
})(ELazyStatus || (ELazyStatus = {}));
|
|
7
|
-
|
|
8
|
-
export { ELazyStatus };
|
|
1
|
+
var o;!function(o){o.Loading="Loading",o.Loaded="Loaded",o.Error="Error"}(o||(o={}));export{o as ELazyStatus};
|
|
9
2
|
//# sourceMappingURL=types.js.map
|
package/dist/redux/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../../src/redux/types.ts"],"sourcesContent":["export enum ELazyStatus {\r\n Loading = 'Loading',\r\n Loaded = 'Loaded',\r\n Error = 'Error'\r\n}\r\n\r\nexport interface IDinoReduxState {\r\n status: ELazyStatus\r\n requestedId?: string\r\n}\r\n\r\nexport interface IReturnDispatch {\r\n abort?: () => void\r\n}\r\n\r\nexport interface IDinoReduxDispatch<P = any> {\r\n fetchData?: (params?: P, signal?: AbortSignal) => IReturnDispatch\r\n setStatus: (status: ELazyStatus) => void\r\n}\r\n\r\nexport interface IBaseActions<T, Id extends keyof T> {\r\n create: (value: Partial<T>, signal?: AbortSignal) => Promise<void>\r\n update: (id: T[Id], value: Partial<T>, signal?: AbortSignal) => Promise<void>\r\n delete: (id: T[Id], value?: Partial<T>, signal?: AbortSignal) => Promise<void>\r\n}\r\n\r\nexport type IDinoReduxActions<T, Id extends keyof T, K extends keyof IBaseActions<T, Id> = keyof IBaseActions<T, Id>> = Pick<IBaseActions<T, Id>, K>\r\n"],"names":["ELazyStatus"],"mappings":"IAAYA
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../../src/redux/types.ts"],"sourcesContent":["export enum ELazyStatus {\r\n Loading = 'Loading',\r\n Loaded = 'Loaded',\r\n Error = 'Error'\r\n}\r\n\r\nexport interface IDinoReduxState {\r\n status: ELazyStatus\r\n requestedId?: string\r\n}\r\n\r\nexport interface IReturnDispatch {\r\n abort?: () => void\r\n}\r\n\r\nexport interface IDinoReduxDispatch<P = any> {\r\n fetchData?: (params?: P, signal?: AbortSignal) => IReturnDispatch\r\n setStatus: (status: ELazyStatus) => void\r\n}\r\n\r\nexport interface IBaseActions<T, Id extends keyof T> {\r\n create: (value: Partial<T>, signal?: AbortSignal) => Promise<void>\r\n update: (id: T[Id], value: Partial<T>, signal?: AbortSignal) => Promise<void>\r\n delete: (id: T[Id], value?: Partial<T>, signal?: AbortSignal) => Promise<void>\r\n}\r\n\r\nexport type IDinoReduxActions<T, Id extends keyof T, K extends keyof IBaseActions<T, Id> = keyof IBaseActions<T, Id>> = Pick<IBaseActions<T, Id>, K>\r\n"],"names":["ELazyStatus"],"mappings":"IAAYA,GAAZ,SAAYA,GACVA,EAAA,QAAA,UACAA,EAAA,OAAA,SACAA,EAAA,MAAA,OACD,CAJD,CAAYA,IAAAA,EAIX,CAAA"}
|
|
@@ -1,89 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { styled, Box, Button, Stack, Typography } from '@mui/material';
|
|
4
|
-
import ArrowRightAltIcon from '@mui/icons-material/ArrowRightAlt';
|
|
5
|
-
import Error404Vector from './vector-404.webp.js';
|
|
6
|
-
|
|
7
|
-
var _excluded = ["children"];
|
|
8
|
-
var UIErrorPage = function UIErrorPage() {
|
|
9
|
-
return jsxs(Stack, {
|
|
10
|
-
sx: {
|
|
11
|
-
alignItems: 'center'
|
|
12
|
-
},
|
|
13
|
-
children: [jsx(WrapImage, {
|
|
14
|
-
children: jsx("img", {
|
|
15
|
-
src: Error404Vector,
|
|
16
|
-
alt: 'error-404-vector'
|
|
17
|
-
})
|
|
18
|
-
}), jsx(Typography, {
|
|
19
|
-
variant: 'subtitle1',
|
|
20
|
-
component: 'p',
|
|
21
|
-
sx: {
|
|
22
|
-
textAlign: 'center',
|
|
23
|
-
mt: '20px'
|
|
24
|
-
},
|
|
25
|
-
children: "Sorry, page not found or connection to server lost. Please come back later...."
|
|
26
|
-
}), jsx(CustomButton, {
|
|
27
|
-
href: '/',
|
|
28
|
-
children: "Back to home page"
|
|
29
|
-
})]
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
var WrapImage = styled(function (_ref) {
|
|
33
|
-
var children = _ref.children,
|
|
34
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
35
|
-
return jsx(Box, _objectSpread2(_objectSpread2({}, props), {}, {
|
|
36
|
-
children: jsx("div", {
|
|
37
|
-
children: children
|
|
38
|
-
})
|
|
39
|
-
}));
|
|
40
|
-
})({
|
|
41
|
-
width: '100%',
|
|
42
|
-
maxWidth: '560px',
|
|
43
|
-
flex: '0 0 auto',
|
|
44
|
-
'& > div': {
|
|
45
|
-
width: '100%',
|
|
46
|
-
paddingBottom: '100%',
|
|
47
|
-
position: 'relative'
|
|
48
|
-
},
|
|
49
|
-
'& img': {
|
|
50
|
-
position: 'absolute',
|
|
51
|
-
top: 0,
|
|
52
|
-
left: 0,
|
|
53
|
-
width: '100%',
|
|
54
|
-
height: '100%'
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
var CustomButton = styled(function (p) {
|
|
58
|
-
return jsx(Button, _objectSpread2({
|
|
59
|
-
component: 'a',
|
|
60
|
-
color: 'inherit',
|
|
61
|
-
variant: 'contained',
|
|
62
|
-
size: 'large',
|
|
63
|
-
endIcon: jsx(ArrowRightAltIcon, {
|
|
64
|
-
fontSize: 'small'
|
|
65
|
-
})
|
|
66
|
-
}, p));
|
|
67
|
-
})({
|
|
68
|
-
backgroundColor: 'var(--color-black)',
|
|
69
|
-
color: 'var(--color-text-light)',
|
|
70
|
-
minWidth: '250px',
|
|
71
|
-
marginTop: '24px',
|
|
72
|
-
height: '56px',
|
|
73
|
-
textTransform: 'none',
|
|
74
|
-
fontWeight: 600,
|
|
75
|
-
transition: '0.3s',
|
|
76
|
-
'&:hover': {
|
|
77
|
-
backgroundColor: 'var(--color-black2)',
|
|
78
|
-
color: 'var(--color-text-light)'
|
|
79
|
-
},
|
|
80
|
-
'& .MuiButton-icon.MuiButton-endIcon': {
|
|
81
|
-
transition: '0.3s'
|
|
82
|
-
},
|
|
83
|
-
'&:hover .MuiButton-icon.MuiButton-endIcon': {
|
|
84
|
-
marginLeft: '16px'
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
export { UIErrorPage as default };
|
|
1
|
+
import{objectWithoutProperties as t,objectSpread2 as o}from"../_virtual/_rollupPluginBabelHelpers.js";import{jsx as r,jsxs as e}from"react/jsx-runtime";import{styled as i,Box as n,Button as a,Stack as l,Typography as c}from"@mui/material";import m from"@mui/icons-material/ArrowRightAlt";import u from"./vector-404.webp.js";var h=["children"],p=function(){return e(l,{sx:{alignItems:"center"},children:[r(s,{children:r("img",{src:u,alt:"error-404-vector"})}),r(c,{variant:"subtitle1",component:"p",sx:{textAlign:"center",mt:"20px"},children:"Sorry, page not found or connection to server lost. Please come back later...."}),r(d,{href:"/",children:"Back to home page"})]})},s=i((function(e){var i=e.children,a=t(e,h);return r(n,o(o({},a),{},{children:r("div",{children:i})}))}))({width:"100%",maxWidth:"560px",flex:"0 0 auto","& > div":{width:"100%",paddingBottom:"100%",position:"relative"},"& img":{position:"absolute",top:0,left:0,width:"100%",height:"100%"}}),d=i((function(t){return r(a,o({component:"a",color:"inherit",variant:"contained",size:"large",endIcon:r(m,{fontSize:"small"})},t))}))({backgroundColor:"var(--color-black)",color:"var(--color-text-light)",minWidth:"250px",marginTop:"24px",height:"56px",textTransform:"none",fontWeight:600,transition:"0.3s","&:hover":{backgroundColor:"var(--color-black2)",color:"var(--color-text-light)"},"& .MuiButton-icon.MuiButton-endIcon":{transition:"0.3s"},"&:hover .MuiButton-icon.MuiButton-endIcon":{marginLeft:"16px"}});export{p as default};
|
|
89
2
|
//# sourceMappingURL=ui.error-page.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.error-page.js","sources":["../../src/redux/ui.error-page.tsx"],"sourcesContent":["import React, { FC } from 'react'\r\nimport { Box, BoxProps, Button, ButtonProps, Stack, styled, Typography } from '@mui/material'\r\nimport ArrowRightAltIcon from '@mui/icons-material/ArrowRightAlt'\r\nimport Error404Vector from './vector-404.webp'\r\n\r\nconst UIErrorPage: FC = () => (\r\n <Stack sx={{ alignItems: 'center' }}>\r\n <WrapImage>\r\n <img src={Error404Vector} alt='error-404-vector' />\r\n </WrapImage>\r\n <Typography variant='subtitle1' component='p' sx={{ textAlign: 'center', mt: '20px' }}>\r\n Sorry, page not found or connection to server lost. Please come back later....\r\n </Typography>\r\n <CustomButton href='/'>Back to home page</CustomButton>\r\n </Stack>\r\n)\r\nexport default UIErrorPage\r\n\r\nconst WrapImage = styled(({ children, ...props }: BoxProps) => (\r\n <Box {...props}>\r\n <div>{children}</div>\r\n </Box>\r\n))({\r\n width: '100%',\r\n maxWidth: '560px',\r\n flex: '0 0 auto',\r\n '& > div': {\r\n width: '100%',\r\n paddingBottom: '100%',\r\n position: 'relative'\r\n },\r\n '& img': {\r\n position: 'absolute',\r\n top: 0,\r\n left: 0,\r\n width: '100%',\r\n height: '100%'\r\n }\r\n})\r\n\r\nconst CustomButton = styled((p: ButtonProps & { href: string }) => {\r\n return <Button component='a' color='inherit' variant='contained' size='large' endIcon={<ArrowRightAltIcon fontSize='small' />} {...p} />\r\n})({\r\n backgroundColor: 'var(--color-black)',\r\n color: 'var(--color-text-light)',\r\n minWidth: '250px',\r\n marginTop: '24px',\r\n height: '56px',\r\n textTransform: 'none',\r\n fontWeight: 600,\r\n transition: '0.3s',\r\n '&:hover': {\r\n backgroundColor: 'var(--color-black2)',\r\n color: 'var(--color-text-light)'\r\n },\r\n '& .MuiButton-icon.MuiButton-endIcon': {\r\n transition: '0.3s'\r\n },\r\n '&:hover .MuiButton-icon.MuiButton-endIcon': {\r\n marginLeft: '16px'\r\n }\r\n})\r\n"],"names":["UIErrorPage","_jsxs","Stack","sx","alignItems","children","_jsx","WrapImage","src","Error404Vector","alt","Typography","variant","component","textAlign","mt","CustomButton","href","styled","_ref","props","_objectWithoutProperties","_excluded","Box","_objectSpread","width","maxWidth","flex","paddingBottom","position","top","left","height","p","Button","color","size","endIcon","ArrowRightAltIcon","fontSize","backgroundColor","minWidth","marginTop","textTransform","fontWeight","transition","marginLeft"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ui.error-page.js","sources":["../../src/redux/ui.error-page.tsx"],"sourcesContent":["import React, { FC } from 'react'\r\nimport { Box, BoxProps, Button, ButtonProps, Stack, styled, Typography } from '@mui/material'\r\nimport ArrowRightAltIcon from '@mui/icons-material/ArrowRightAlt'\r\nimport Error404Vector from './vector-404.webp'\r\n\r\nconst UIErrorPage: FC = () => (\r\n <Stack sx={{ alignItems: 'center' }}>\r\n <WrapImage>\r\n <img src={Error404Vector} alt='error-404-vector' />\r\n </WrapImage>\r\n <Typography variant='subtitle1' component='p' sx={{ textAlign: 'center', mt: '20px' }}>\r\n Sorry, page not found or connection to server lost. Please come back later....\r\n </Typography>\r\n <CustomButton href='/'>Back to home page</CustomButton>\r\n </Stack>\r\n)\r\nexport default UIErrorPage\r\n\r\nconst WrapImage = styled(({ children, ...props }: BoxProps) => (\r\n <Box {...props}>\r\n <div>{children}</div>\r\n </Box>\r\n))({\r\n width: '100%',\r\n maxWidth: '560px',\r\n flex: '0 0 auto',\r\n '& > div': {\r\n width: '100%',\r\n paddingBottom: '100%',\r\n position: 'relative'\r\n },\r\n '& img': {\r\n position: 'absolute',\r\n top: 0,\r\n left: 0,\r\n width: '100%',\r\n height: '100%'\r\n }\r\n})\r\n\r\nconst CustomButton = styled((p: ButtonProps & { href: string }) => {\r\n return <Button component='a' color='inherit' variant='contained' size='large' endIcon={<ArrowRightAltIcon fontSize='small' />} {...p} />\r\n})({\r\n backgroundColor: 'var(--color-black)',\r\n color: 'var(--color-text-light)',\r\n minWidth: '250px',\r\n marginTop: '24px',\r\n height: '56px',\r\n textTransform: 'none',\r\n fontWeight: 600,\r\n transition: '0.3s',\r\n '&:hover': {\r\n backgroundColor: 'var(--color-black2)',\r\n color: 'var(--color-text-light)'\r\n },\r\n '& .MuiButton-icon.MuiButton-endIcon': {\r\n transition: '0.3s'\r\n },\r\n '&:hover .MuiButton-icon.MuiButton-endIcon': {\r\n marginLeft: '16px'\r\n }\r\n})\r\n"],"names":["UIErrorPage","_jsxs","Stack","sx","alignItems","children","_jsx","WrapImage","src","Error404Vector","alt","Typography","variant","component","textAlign","mt","CustomButton","href","styled","_ref","props","_objectWithoutProperties","_excluded","Box","_objectSpread","width","maxWidth","flex","paddingBottom","position","top","left","height","p","Button","color","size","endIcon","ArrowRightAltIcon","fontSize","backgroundColor","minWidth","marginTop","textTransform","fontWeight","transition","marginLeft"],"mappings":"uVAKMA,EAAkB,WAAP,OACfC,EAACC,EAAM,CAAAC,GAAI,CAAEC,WAAY,UAAUC,SAAA,CACjCC,EAACC,EACC,CAAAF,SAAAC,EAAA,MAAA,CAAKE,IAAKC,EAAgBC,IAAI,uBAEhCJ,EAACK,EAAU,CAACC,QAAQ,YAAYC,UAAU,IAAIV,GAAI,CAAEW,UAAW,SAAUC,GAAI,QAEhEV,SAAA,mFACbC,EAACU,EAAa,CAAAC,KAAK,IAAoCZ,SAAA,wBACjD,EAIJE,EAAYW,GAAO,SAAAC,GAAA,IAAGd,EAAQc,EAARd,SAAae,EAAKC,EAAAF,EAAAG,GAAA,OAC5ChB,EAACiB,EAAGC,EAAAA,KAAKJ,GAAK,GAAA,CAAAf,SACZC,EAAM,MAAA,CAAAD,SAAAA,MACF,GAHUa,CAIf,CACDO,MAAO,OACPC,SAAU,QACVC,KAAM,WACN,UAAW,CACTF,MAAO,OACPG,cAAe,OACfC,SAAU,YAEZ,QAAS,CACPA,SAAU,WACVC,IAAK,EACLC,KAAM,EACNN,MAAO,OACPO,OAAQ,UAINhB,EAAeE,GAAO,SAACe,GAC3B,OAAO3B,EAAC4B,EAAMV,EAAA,CAACX,UAAU,IAAIsB,MAAM,UAAUvB,QAAQ,YAAYwB,KAAK,QAAQC,QAAS/B,EAACgC,EAAiB,CAACC,SAAS,WAAgBN,GACrI,GAFqBf,CAElB,CACDsB,gBAAiB,qBACjBL,MAAO,0BACPM,SAAU,QACVC,UAAW,OACXV,OAAQ,OACRW,cAAe,OACfC,WAAY,IACZC,WAAY,OACZ,UAAW,CACTL,gBAAiB,sBACjBL,MAAO,2BAET,sCAAuC,CACrCU,WAAY,QAEd,4CAA6C,CAC3CC,WAAY"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vector-404.webp.js","sources":["../../src/redux/vector-404.webp"],"sourcesContent":["export default \"vector-404265a04f4f9c8be1f.webp\""],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"vector-404.webp.js","sources":["../../src/redux/vector-404.webp"],"sourcesContent":["export default \"vector-404265a04f4f9c8be1f.webp\""],"names":["Error404Vector"],"mappings":"AAAA,IAAeA,EAAA"}
|
package/dist/table/context.js
CHANGED
|
@@ -1,15 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createContext } from 'react';
|
|
3
|
-
|
|
4
|
-
var TableBaseContext = /*#__PURE__*/createContext({
|
|
5
|
-
showModal: function showModal() {},
|
|
6
|
-
closeModal: function closeModal() {}
|
|
7
|
-
});
|
|
8
|
-
var MapTableBaseContext = function MapTableBaseContext(context) {
|
|
9
|
-
return jsx(TableBaseContext.Consumer, {
|
|
10
|
-
children: context
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export { MapTableBaseContext, TableBaseContext };
|
|
1
|
+
import{jsx as o}from"react/jsx-runtime";import{createContext as r}from"react";var n=r({showModal:function(){},closeModal:function(){}}),t=function(r){return o(n.Consumer,{children:r})};export{t as MapTableBaseContext,n as TableBaseContext};
|
|
15
2
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sources":["../../src/table/context.tsx"],"sourcesContent":["import React, { createContext } from 'react'\r\nimport { TCloseModal, TShowModal } from '../api-context'\r\n\r\nexport interface ITableBaseContext {\r\n showModal: TShowModal\r\n closeModal: TCloseModal\r\n}\r\n\r\nexport const TableBaseContext = createContext<ITableBaseContext>({\r\n showModal: () => {},\r\n closeModal: () => {}\r\n})\r\n\r\nexport const MapTableBaseContext = (context: (context: ITableBaseContext) => React.ReactNode) => (\r\n <TableBaseContext.Consumer>{context}</TableBaseContext.Consumer>\r\n)\r\n"],"names":["TableBaseContext","createContext","showModal","closeModal","MapTableBaseContext","context","_jsx","Consumer"],"mappings":"
|
|
1
|
+
{"version":3,"file":"context.js","sources":["../../src/table/context.tsx"],"sourcesContent":["import React, { createContext } from 'react'\r\nimport { TCloseModal, TShowModal } from '../api-context'\r\n\r\nexport interface ITableBaseContext {\r\n showModal: TShowModal\r\n closeModal: TCloseModal\r\n}\r\n\r\nexport const TableBaseContext = createContext<ITableBaseContext>({\r\n showModal: () => {},\r\n closeModal: () => {}\r\n})\r\n\r\nexport const MapTableBaseContext = (context: (context: ITableBaseContext) => React.ReactNode) => (\r\n <TableBaseContext.Consumer>{context}</TableBaseContext.Consumer>\r\n)\r\n"],"names":["TableBaseContext","createContext","showModal","closeModal","MapTableBaseContext","context","_jsx","Consumer"],"mappings":"8EAQaA,IAAAA,EAAmBC,EAAiC,CAC/DC,UAAW,WAAQ,EACnBC,WAAY,WAAK,IAGNC,EAAsB,SAACC,GAAwD,OAC1FC,EAACN,EAAiBO,mBAAUF,GAAoC"}
|