datastake-daf 0.6.254 → 0.6.255
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/components/index.css +1 -1
- package/dist/components/index.js +340 -29
- package/package.json +1 -1
- package/src/@daf/core/components/Dashboard/Steps/Steps.stories.js +5 -0
- package/src/@daf/core/components/Dashboard/Steps/index.jsx +29 -8
- package/src/@daf/core/components/EditForm/storyConfig.js +1 -1
- package/src/@daf/core/components/EditForm/storyConfig1.js +249 -244
- package/src/@daf/core/components/PdfForm/index.js +311 -21
- package/src/@daf/core/components/PdfForm/style.scss +50 -6
- package/.env +0 -8
- package/.vscode/settings.json +0 -13
package/dist/components/index.js
CHANGED
|
@@ -15422,35 +15422,327 @@ const PdfForm = _ref3 => {
|
|
|
15422
15422
|
return organizedSections;
|
|
15423
15423
|
};
|
|
15424
15424
|
const organizedForm = React.useMemo(() => organizeFormByHeaders(form), [form]);
|
|
15425
|
+
|
|
15426
|
+
// Constants for height calculations (same as PdfView)
|
|
15427
|
+
const PAGE_HEIGHT = 1587;
|
|
15428
|
+
const FOOTER_HEIGHT = 70;
|
|
15429
|
+
const HEADER_HEIGHT = 100;
|
|
15430
|
+
|
|
15431
|
+
// Detect if running in headless/Puppeteer environment (more conservative detection)
|
|
15432
|
+
const isPuppeteerEnvironment = () => {
|
|
15433
|
+
if (typeof window === 'undefined') return false;
|
|
15434
|
+
|
|
15435
|
+
// Only trigger on explicit URL parameters (most reliable)
|
|
15436
|
+
return window.location.search.includes('puppeteer=true') || window.location.search.includes('headless=true') || window.location.search.includes('pdf=true') ||
|
|
15437
|
+
// Only very specific headless browser indicators
|
|
15438
|
+
window.navigator.webdriver === true && window.navigator.userAgent.includes('HeadlessChrome');
|
|
15439
|
+
};
|
|
15440
|
+
|
|
15441
|
+
// Debug function to log detection results (can be removed later)
|
|
15442
|
+
const debugEnvironment = () => {
|
|
15443
|
+
if (typeof window !== 'undefined' && window.console) {
|
|
15444
|
+
console.log('Environment Detection:', {
|
|
15445
|
+
isPuppeteer: isPuppeteerEnvironment(),
|
|
15446
|
+
userAgent: window.navigator.userAgent,
|
|
15447
|
+
webdriver: window.navigator.webdriver,
|
|
15448
|
+
resizeObserver: !!window.ResizeObserver,
|
|
15449
|
+
urlParams: window.location.search
|
|
15450
|
+
});
|
|
15451
|
+
}
|
|
15452
|
+
};
|
|
15453
|
+
|
|
15454
|
+
// Conservative height estimation for Puppeteer compatibility
|
|
15455
|
+
const estimateTreeNodeHeight = function (key, config, value) {
|
|
15456
|
+
let level = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
15457
|
+
const isPuppeteer = isPuppeteerEnvironment();
|
|
15458
|
+
// Call debug only once to avoid spam
|
|
15459
|
+
if (level === 0 && key === Object.keys(form)[0]) {
|
|
15460
|
+
debugEnvironment();
|
|
15461
|
+
}
|
|
15462
|
+
|
|
15463
|
+
// Appropriate base heights for each environment
|
|
15464
|
+
const baseHeight = isPuppeteer ? 35 : 25; // Less aggressive for normal browsers
|
|
15465
|
+
const indentHeight = level * (isPuppeteer ? 3 : 2); // Normal indent for browsers
|
|
15466
|
+
let totalHeight = baseHeight + indentHeight;
|
|
15467
|
+
|
|
15468
|
+
// Type-based adjustments - less aggressive for normal browsers
|
|
15469
|
+
if ((config === null || config === void 0 ? void 0 : config.type) === 'header') {
|
|
15470
|
+
totalHeight += isPuppeteer ? 25 : 12;
|
|
15471
|
+
} else if ((config === null || config === void 0 ? void 0 : config.type) === 'textarea') {
|
|
15472
|
+
totalHeight += isPuppeteer ? 60 : 30;
|
|
15473
|
+
} else if ((config === null || config === void 0 ? void 0 : config.type) === 'dataLink' || (config === null || config === void 0 ? void 0 : config.type) === 'dataLinkGroup') {
|
|
15474
|
+
totalHeight += isPuppeteer ? 35 : 15;
|
|
15475
|
+
} else if ((config === null || config === void 0 ? void 0 : config.type) === 'groupInputs') {
|
|
15476
|
+
totalHeight += isPuppeteer ? 40 : 20;
|
|
15477
|
+
}
|
|
15478
|
+
|
|
15479
|
+
// Content height estimation - appropriate for each environment
|
|
15480
|
+
if (value && typeof value === 'string') {
|
|
15481
|
+
if (value.length > 100) {
|
|
15482
|
+
const multiplier = isPuppeteer ? 20 : 12; // Less aggressive for browsers
|
|
15483
|
+
totalHeight += Math.ceil(value.length / 50) * multiplier;
|
|
15484
|
+
} else if (value.length > 30) {
|
|
15485
|
+
totalHeight += isPuppeteer ? 25 : 10; // Much less for normal browsers
|
|
15486
|
+
}
|
|
15487
|
+
}
|
|
15488
|
+
|
|
15489
|
+
// Add height for children recursively with appropriate multiplier
|
|
15490
|
+
if (config !== null && config !== void 0 && config.inputs) {
|
|
15491
|
+
const childKeys = Object.keys(config.inputs).filter(childKey => {
|
|
15492
|
+
const childConfig = config.inputs[childKey];
|
|
15493
|
+
// Check showIf condition
|
|
15494
|
+
if (childConfig !== null && childConfig !== void 0 && childConfig.showIf && !evaluateShowIfCondition(childConfig.showIf, data)) {
|
|
15495
|
+
return false;
|
|
15496
|
+
}
|
|
15497
|
+
return true;
|
|
15498
|
+
}).sort((a, b) => {
|
|
15499
|
+
var _config$inputs$a3, _config$inputs$b3;
|
|
15500
|
+
const positionA = ((_config$inputs$a3 = config.inputs[a]) === null || _config$inputs$a3 === void 0 ? void 0 : _config$inputs$a3.position) || 0;
|
|
15501
|
+
const positionB = ((_config$inputs$b3 = config.inputs[b]) === null || _config$inputs$b3 === void 0 ? void 0 : _config$inputs$b3.position) || 0;
|
|
15502
|
+
return positionA - positionB;
|
|
15503
|
+
});
|
|
15504
|
+
let childrenHeight = 0;
|
|
15505
|
+
childKeys.forEach(childKey => {
|
|
15506
|
+
const childConfig = config.inputs[childKey];
|
|
15507
|
+
const childValue = (value === null || value === void 0 ? void 0 : value[childKey]) || (data === null || data === void 0 ? void 0 : data[childKey]);
|
|
15508
|
+
childrenHeight += estimateTreeNodeHeight(childKey, childConfig, childValue, level + 1);
|
|
15509
|
+
});
|
|
15510
|
+
|
|
15511
|
+
// Only add safety multiplier for Puppeteer
|
|
15512
|
+
totalHeight += childrenHeight * (isPuppeteer ? 1.3 : 1.0);
|
|
15513
|
+
}
|
|
15514
|
+
|
|
15515
|
+
// Handle array/repeated content
|
|
15516
|
+
if (Array.isArray(value)) {
|
|
15517
|
+
value.forEach(itemValue => {
|
|
15518
|
+
const multiplier = isPuppeteer ? 1.1 : 1.0; // No buffer for normal browsers
|
|
15519
|
+
totalHeight += estimateTreeNodeHeight(key, config, itemValue, level) * multiplier;
|
|
15520
|
+
});
|
|
15521
|
+
}
|
|
15522
|
+
return Math.ceil(totalHeight);
|
|
15523
|
+
};
|
|
15524
|
+
|
|
15525
|
+
// Helper function to split section based on height constraints (goes deep if needed)
|
|
15526
|
+
const createHeightConstrainedSections = (sectionKey, section) => {
|
|
15527
|
+
const isPuppeteer = isPuppeteerEnvironment();
|
|
15528
|
+
|
|
15529
|
+
// Environment-appropriate height limits
|
|
15530
|
+
const BASE_BUFFER = isPuppeteer ? 300 : 100; // Much smaller buffer for normal browsers
|
|
15531
|
+
const MAX_SECTION_HEIGHT = PAGE_HEIGHT - HEADER_HEIGHT - FOOTER_HEIGHT - BASE_BUFFER;
|
|
15532
|
+
const subSections = [];
|
|
15533
|
+
|
|
15534
|
+
// Get all top-level items in the section with detailed analysis
|
|
15535
|
+
const topLevelItems = Object.keys(section).filter(key => !(key === 'id' || key === 'label' || key === 'position' || key === 'subTitle')).map(key => {
|
|
15536
|
+
var _section$key;
|
|
15537
|
+
return {
|
|
15538
|
+
key,
|
|
15539
|
+
config: section[key],
|
|
15540
|
+
estimatedHeight: estimateTreeNodeHeight(key, section[key], data === null || data === void 0 ? void 0 : data[key]),
|
|
15541
|
+
canSplit: ((_section$key = section[key]) === null || _section$key === void 0 ? void 0 : _section$key.inputs) && Object.keys(section[key].inputs).length > 1 // Can this item be further split?
|
|
15542
|
+
};
|
|
15543
|
+
}).sort((a, b) => {
|
|
15544
|
+
var _a$config, _b$config;
|
|
15545
|
+
return (((_a$config = a.config) === null || _a$config === void 0 ? void 0 : _a$config.position) || 0) - (((_b$config = b.config) === null || _b$config === void 0 ? void 0 : _b$config.position) || 0);
|
|
15546
|
+
});
|
|
15547
|
+
let currentSubSection = _objectSpread2({}, section);
|
|
15548
|
+
|
|
15549
|
+
// Remove all items from the base section structure
|
|
15550
|
+
Object.keys(section).forEach(key => {
|
|
15551
|
+
if (!(key === 'id' || key === 'label' || key === 'position' || key === 'subTitle')) {
|
|
15552
|
+
delete currentSubSection[key];
|
|
15553
|
+
}
|
|
15554
|
+
});
|
|
15555
|
+
let currentHeight = 80; // Base height for section header
|
|
15556
|
+
let subSectionIndex = 0;
|
|
15557
|
+
topLevelItems.forEach((item, index) => {
|
|
15558
|
+
const {
|
|
15559
|
+
key,
|
|
15560
|
+
config,
|
|
15561
|
+
estimatedHeight,
|
|
15562
|
+
canSplit
|
|
15563
|
+
} = item;
|
|
15564
|
+
|
|
15565
|
+
// Environment-appropriate splitting thresholds
|
|
15566
|
+
const SPLIT_THRESHOLD = isPuppeteer ? 0.6 : 0.85; // Less aggressive for browsers
|
|
15567
|
+
const CHILD_MAX_HEIGHT = isPuppeteer ? 0.4 : 0.7;
|
|
15568
|
+
|
|
15569
|
+
// If a single item is too large and can be split, split it at the child level
|
|
15570
|
+
if (estimatedHeight > MAX_SECTION_HEIGHT * SPLIT_THRESHOLD && canSplit) {
|
|
15571
|
+
// Split this large item into smaller parts
|
|
15572
|
+
const childSplits = splitLargeItem(key, config, data === null || data === void 0 ? void 0 : data[key], MAX_SECTION_HEIGHT * CHILD_MAX_HEIGHT);
|
|
15573
|
+
childSplits.forEach((splitItem, splitIndex) => {
|
|
15574
|
+
// Check if current subsection has room
|
|
15575
|
+
if (currentHeight + splitItem.estimatedHeight > MAX_SECTION_HEIGHT && Object.keys(currentSubSection).length > 4) {
|
|
15576
|
+
// Save current sub-section
|
|
15577
|
+
subSections.push({
|
|
15578
|
+
key: "".concat(sectionKey, "_part_").concat(subSectionIndex),
|
|
15579
|
+
section: _objectSpread2({}, currentSubSection),
|
|
15580
|
+
title: section.label
|
|
15581
|
+
});
|
|
15582
|
+
|
|
15583
|
+
// Start new sub-section
|
|
15584
|
+
currentSubSection = {
|
|
15585
|
+
id: section.id,
|
|
15586
|
+
label: section.label,
|
|
15587
|
+
position: section.position + subSectionIndex + 1,
|
|
15588
|
+
subTitle: section.subTitle
|
|
15589
|
+
};
|
|
15590
|
+
currentHeight = 80;
|
|
15591
|
+
subSectionIndex++;
|
|
15592
|
+
}
|
|
15593
|
+
|
|
15594
|
+
// Add split item to current sub-section
|
|
15595
|
+
currentSubSection[splitItem.key] = splitItem.config;
|
|
15596
|
+
currentHeight += splitItem.estimatedHeight;
|
|
15597
|
+
});
|
|
15598
|
+
} else {
|
|
15599
|
+
// Regular processing for items that fit or can't be split
|
|
15600
|
+
// Check if adding this item would exceed height limit
|
|
15601
|
+
if (currentHeight + estimatedHeight > MAX_SECTION_HEIGHT && Object.keys(currentSubSection).length > 4) {
|
|
15602
|
+
// Save current sub-section
|
|
15603
|
+
subSections.push({
|
|
15604
|
+
key: "".concat(sectionKey, "_part_").concat(subSectionIndex),
|
|
15605
|
+
section: _objectSpread2({}, currentSubSection),
|
|
15606
|
+
title: section.label
|
|
15607
|
+
});
|
|
15608
|
+
|
|
15609
|
+
// Start new sub-section
|
|
15610
|
+
currentSubSection = {
|
|
15611
|
+
id: section.id,
|
|
15612
|
+
label: section.label,
|
|
15613
|
+
position: section.position + subSectionIndex + 1,
|
|
15614
|
+
subTitle: section.subTitle
|
|
15615
|
+
};
|
|
15616
|
+
currentHeight = 80;
|
|
15617
|
+
subSectionIndex++;
|
|
15618
|
+
}
|
|
15619
|
+
|
|
15620
|
+
// Add item to current sub-section
|
|
15621
|
+
currentSubSection[key] = config;
|
|
15622
|
+
currentHeight += estimatedHeight;
|
|
15623
|
+
}
|
|
15624
|
+
});
|
|
15625
|
+
|
|
15626
|
+
// Add the final sub-section if it has content
|
|
15627
|
+
if (Object.keys(currentSubSection).length > 4) {
|
|
15628
|
+
subSections.push({
|
|
15629
|
+
key: subSectionIndex === 0 ? sectionKey : "".concat(sectionKey, "_part_").concat(subSectionIndex),
|
|
15630
|
+
section: currentSubSection,
|
|
15631
|
+
title: section.label
|
|
15632
|
+
});
|
|
15633
|
+
}
|
|
15634
|
+
return subSections.length > 0 ? subSections : [{
|
|
15635
|
+
key: sectionKey,
|
|
15636
|
+
section: section,
|
|
15637
|
+
title: section.label
|
|
15638
|
+
}];
|
|
15639
|
+
};
|
|
15640
|
+
|
|
15641
|
+
// Helper function to split large items at the child level
|
|
15642
|
+
const splitLargeItem = (parentKey, parentConfig, parentValue, maxHeight) => {
|
|
15643
|
+
if (!(parentConfig !== null && parentConfig !== void 0 && parentConfig.inputs)) {
|
|
15644
|
+
return [{
|
|
15645
|
+
key: parentKey,
|
|
15646
|
+
config: parentConfig,
|
|
15647
|
+
estimatedHeight: estimateTreeNodeHeight(parentKey, parentConfig, parentValue)
|
|
15648
|
+
}];
|
|
15649
|
+
}
|
|
15650
|
+
const childItems = Object.keys(parentConfig.inputs).filter(childKey => {
|
|
15651
|
+
const childConfig = parentConfig.inputs[childKey];
|
|
15652
|
+
return !(childConfig !== null && childConfig !== void 0 && childConfig.showIf) || evaluateShowIfCondition(childConfig.showIf, data);
|
|
15653
|
+
}).map(childKey => ({
|
|
15654
|
+
key: childKey,
|
|
15655
|
+
config: parentConfig.inputs[childKey],
|
|
15656
|
+
estimatedHeight: estimateTreeNodeHeight(childKey, parentConfig.inputs[childKey], parentValue === null || parentValue === void 0 ? void 0 : parentValue[childKey])
|
|
15657
|
+
})).sort((a, b) => {
|
|
15658
|
+
var _a$config2, _b$config2;
|
|
15659
|
+
return (((_a$config2 = a.config) === null || _a$config2 === void 0 ? void 0 : _a$config2.position) || 0) - (((_b$config2 = b.config) === null || _b$config2 === void 0 ? void 0 : _b$config2.position) || 0);
|
|
15660
|
+
});
|
|
15661
|
+
const splits = [];
|
|
15662
|
+
let currentSplit = {
|
|
15663
|
+
key: "".concat(parentKey, "_part_0"),
|
|
15664
|
+
config: _objectSpread2(_objectSpread2({}, parentConfig), {}, {
|
|
15665
|
+
inputs: {}
|
|
15666
|
+
}),
|
|
15667
|
+
estimatedHeight: 40 // Base height for parent structure
|
|
15668
|
+
};
|
|
15669
|
+
let splitIndex = 0;
|
|
15670
|
+
childItems.forEach(child => {
|
|
15671
|
+
if (currentSplit.estimatedHeight + child.estimatedHeight > maxHeight && Object.keys(currentSplit.config.inputs).length > 0) {
|
|
15672
|
+
splits.push(currentSplit);
|
|
15673
|
+
splitIndex++;
|
|
15674
|
+
currentSplit = {
|
|
15675
|
+
key: "".concat(parentKey, "_part_").concat(splitIndex),
|
|
15676
|
+
config: _objectSpread2(_objectSpread2({}, parentConfig), {}, {
|
|
15677
|
+
label: parentConfig.label,
|
|
15678
|
+
inputs: {}
|
|
15679
|
+
}),
|
|
15680
|
+
estimatedHeight: 40
|
|
15681
|
+
};
|
|
15682
|
+
}
|
|
15683
|
+
currentSplit.config.inputs[child.key] = child.config;
|
|
15684
|
+
currentSplit.estimatedHeight += child.estimatedHeight;
|
|
15685
|
+
});
|
|
15686
|
+
if (Object.keys(currentSplit.config.inputs).length > 0) {
|
|
15687
|
+
splits.push(currentSplit);
|
|
15688
|
+
}
|
|
15689
|
+
return splits.length > 0 ? splits : [{
|
|
15690
|
+
key: parentKey,
|
|
15691
|
+
config: parentConfig,
|
|
15692
|
+
estimatedHeight: estimateTreeNodeHeight(parentKey, parentConfig, parentValue)
|
|
15693
|
+
}];
|
|
15694
|
+
};
|
|
15425
15695
|
const pdfConfig = React.useMemo(() => {
|
|
15426
15696
|
const sections = [];
|
|
15697
|
+
const isPuppeteer = isPuppeteerEnvironment();
|
|
15698
|
+
|
|
15699
|
+
// Apply Puppeteer-specific class to document body if needed
|
|
15700
|
+
if (typeof document !== 'undefined') {
|
|
15701
|
+
if (isPuppeteer) {
|
|
15702
|
+
document.body.setAttribute('data-puppeteer', 'true');
|
|
15703
|
+
} else {
|
|
15704
|
+
document.body.removeAttribute('data-puppeteer');
|
|
15705
|
+
}
|
|
15706
|
+
}
|
|
15427
15707
|
Object.keys(organizedForm).forEach(sectionKey => {
|
|
15428
15708
|
const section = organizedForm[sectionKey];
|
|
15429
15709
|
if (typeof section !== 'object' || !section.label) {
|
|
15430
15710
|
return;
|
|
15431
15711
|
}
|
|
15432
|
-
|
|
15433
|
-
|
|
15434
|
-
|
|
15435
|
-
|
|
15436
|
-
|
|
15437
|
-
|
|
15438
|
-
|
|
15439
|
-
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
|
|
15443
|
-
|
|
15444
|
-
|
|
15445
|
-
|
|
15446
|
-
|
|
15447
|
-
|
|
15448
|
-
|
|
15449
|
-
|
|
15450
|
-
|
|
15451
|
-
|
|
15452
|
-
|
|
15453
|
-
|
|
15712
|
+
|
|
15713
|
+
// Create height-constrained sub-sections
|
|
15714
|
+
const subSections = createHeightConstrainedSections(sectionKey, section);
|
|
15715
|
+
subSections.forEach(_ref4 => {
|
|
15716
|
+
let {
|
|
15717
|
+
key,
|
|
15718
|
+
section: subSection,
|
|
15719
|
+
title
|
|
15720
|
+
} = _ref4;
|
|
15721
|
+
sections.push({
|
|
15722
|
+
render: () => /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
15723
|
+
className: "pdf-form-section ".concat(isPuppeteer ? 'puppeteer-mode' : ''),
|
|
15724
|
+
children: /*#__PURE__*/jsxRuntime.jsx(PdfFormContent, {
|
|
15725
|
+
form: {
|
|
15726
|
+
[key]: _objectSpread2(_objectSpread2({}, subSection), {}, {
|
|
15727
|
+
label: title
|
|
15728
|
+
})
|
|
15729
|
+
},
|
|
15730
|
+
data: data,
|
|
15731
|
+
t: t,
|
|
15732
|
+
user: user,
|
|
15733
|
+
title: formName,
|
|
15734
|
+
source: source,
|
|
15735
|
+
version: version,
|
|
15736
|
+
getApiBaseUrl: getApiBaseUrl,
|
|
15737
|
+
getAppHeader: getAppHeader,
|
|
15738
|
+
app: app
|
|
15739
|
+
})
|
|
15740
|
+
}, key),
|
|
15741
|
+
style: {
|
|
15742
|
+
marginBottom: '20px',
|
|
15743
|
+
padding: '0 20px'
|
|
15744
|
+
}
|
|
15745
|
+
});
|
|
15454
15746
|
});
|
|
15455
15747
|
});
|
|
15456
15748
|
return sections;
|
|
@@ -20505,12 +20797,29 @@ const DAFSteps = _ref => {
|
|
|
20505
20797
|
let {
|
|
20506
20798
|
direction = "vertical",
|
|
20507
20799
|
current = 0,
|
|
20508
|
-
items = []
|
|
20800
|
+
items = [],
|
|
20801
|
+
scrollThreshold = 4
|
|
20509
20802
|
} = _ref;
|
|
20510
|
-
|
|
20511
|
-
|
|
20512
|
-
|
|
20513
|
-
|
|
20803
|
+
const shouldScroll = items.length > scrollThreshold;
|
|
20804
|
+
const scrollableStyles = shouldScroll ? _objectSpread2(_objectSpread2({}, direction === "vertical" ? {
|
|
20805
|
+
maxHeight: "300px",
|
|
20806
|
+
overflowY: "auto",
|
|
20807
|
+
overflowX: "hidden"
|
|
20808
|
+
} : {
|
|
20809
|
+
maxWidth: "100%",
|
|
20810
|
+
overflowX: "auto",
|
|
20811
|
+
overflowY: "hidden",
|
|
20812
|
+
whiteSpace: "nowrap"
|
|
20813
|
+
}), {}, {
|
|
20814
|
+
padding: "8px",
|
|
20815
|
+
marginRight: direction === "vertical" ? "-8px" : "0",
|
|
20816
|
+
paddingRight: direction === "vertical" ? "16px" : "8px"
|
|
20817
|
+
}) : {};
|
|
20818
|
+
return /*#__PURE__*/jsxRuntime.jsx(Widget, {
|
|
20819
|
+
title: "Life Cycle",
|
|
20820
|
+
className: "with-border-header",
|
|
20821
|
+
children: /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
20822
|
+
style: scrollableStyles,
|
|
20514
20823
|
children: /*#__PURE__*/jsxRuntime.jsx(antd.Steps, {
|
|
20515
20824
|
direction: direction,
|
|
20516
20825
|
current: current,
|
|
@@ -20525,12 +20834,14 @@ DAFSteps.propTypes = {
|
|
|
20525
20834
|
items: PropTypes__default["default"].arrayOf(PropTypes__default["default"].shape({
|
|
20526
20835
|
title: PropTypes__default["default"].string.isRequired,
|
|
20527
20836
|
description: PropTypes__default["default"].string
|
|
20528
|
-
}))
|
|
20837
|
+
})),
|
|
20838
|
+
scrollThreshold: PropTypes__default["default"].number
|
|
20529
20839
|
};
|
|
20530
20840
|
DAFSteps.defaultProps = {
|
|
20531
20841
|
direction: "vertical",
|
|
20532
20842
|
current: 0,
|
|
20533
|
-
items: []
|
|
20843
|
+
items: [],
|
|
20844
|
+
scrollThreshold: 4
|
|
20534
20845
|
};
|
|
20535
20846
|
|
|
20536
20847
|
/**
|
package/package.json
CHANGED
|
@@ -17,6 +17,11 @@ VerticalSteps.args = {
|
|
|
17
17
|
{ title: "Step 1", description: "This is the first step" },
|
|
18
18
|
{ title: "Step 2", description: "This is the second step" },
|
|
19
19
|
{ title: "Step 3", description: "This is the third step" },
|
|
20
|
+
{ title: "Step 3", description: "This is the third step" },
|
|
21
|
+
{ title: "Step 3", description: "This is the third step" },
|
|
22
|
+
{ title: "Step 3", description: "This is the third step" },
|
|
23
|
+
{ title: "Step 3", description: "This is the third step" },
|
|
24
|
+
{ title: "Step 3", description: "This is the third step" },
|
|
20
25
|
],
|
|
21
26
|
};
|
|
22
27
|
|
|
@@ -3,16 +3,35 @@ import { Steps } from "antd";
|
|
|
3
3
|
import Widget from "../../Dashboard/Widget/index.jsx";
|
|
4
4
|
import PropTypes from "prop-types";
|
|
5
5
|
|
|
6
|
-
const DAFSteps = ({ direction = "vertical", current = 0, items = [] }) => {
|
|
6
|
+
const DAFSteps = ({ direction = "vertical", current = 0, items = [], scrollThreshold = 4 }) => {
|
|
7
|
+
const shouldScroll = items.length > scrollThreshold;
|
|
8
|
+
|
|
9
|
+
const scrollableStyles = shouldScroll ? {
|
|
10
|
+
...(direction === "vertical" ? {
|
|
11
|
+
maxHeight: "300px",
|
|
12
|
+
overflowY: "auto",
|
|
13
|
+
overflowX: "hidden"
|
|
14
|
+
} : {
|
|
15
|
+
maxWidth: "100%",
|
|
16
|
+
overflowX: "auto",
|
|
17
|
+
overflowY: "hidden",
|
|
18
|
+
whiteSpace: "nowrap"
|
|
19
|
+
}),
|
|
20
|
+
padding: "8px",
|
|
21
|
+
marginRight: direction === "vertical" ? "-8px" : "0",
|
|
22
|
+
paddingRight: direction === "vertical" ? "16px" : "8px"
|
|
23
|
+
} : {};
|
|
24
|
+
|
|
7
25
|
return (
|
|
8
|
-
|
|
9
|
-
<
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
26
|
+
<Widget title="Life Cycle" className="with-border-header">
|
|
27
|
+
<div style={scrollableStyles}>
|
|
28
|
+
<Steps
|
|
29
|
+
direction={direction}
|
|
30
|
+
current={current}
|
|
31
|
+
items={items}
|
|
32
|
+
/>
|
|
33
|
+
</div>
|
|
14
34
|
</Widget>
|
|
15
|
-
</>
|
|
16
35
|
);
|
|
17
36
|
};
|
|
18
37
|
|
|
@@ -25,12 +44,14 @@ DAFSteps.propTypes = {
|
|
|
25
44
|
description: PropTypes.string,
|
|
26
45
|
})
|
|
27
46
|
),
|
|
47
|
+
scrollThreshold: PropTypes.number,
|
|
28
48
|
};
|
|
29
49
|
|
|
30
50
|
DAFSteps.defaultProps = {
|
|
31
51
|
direction: "vertical",
|
|
32
52
|
current: 0,
|
|
33
53
|
items: [],
|
|
54
|
+
scrollThreshold: 4,
|
|
34
55
|
};
|
|
35
56
|
|
|
36
57
|
export default DAFSteps;
|