dom-render 1.0.81 → 1.0.82

Sign up to get free protection for your applications and to get access to all the features.
package/RawSet.d.ts CHANGED
@@ -145,5 +145,7 @@ export declare class RawSet {
145
145
  static isExporesion(data: string | null): boolean;
146
146
  static exporesionGrouops(data: string | null): RegExpExecArray[];
147
147
  static styleTransformLocal(styleBody: string | string[], id: string, styleTagWrap?: boolean, locale?: boolean): string;
148
+ static metaStart(id: string): string;
149
+ static metaEnd(id: string): string;
148
150
  static destroy(obj: any | undefined, parameter: any[], config: Config, destroyOptions?: (DestroyOptionType | string)[]): void;
149
151
  }
package/RawSet.js CHANGED
@@ -118,7 +118,7 @@ var RawSet = /** @class */ (function () {
118
118
  // console.log('usingTriggerVariable----------->', usingTriggerVariables)
119
119
  return usingTriggerVariables;
120
120
  };
121
- // 중요 render
121
+ // 중요 render 처리 부분
122
122
  RawSet.prototype.render = function (obj, config) {
123
123
  var _this = this;
124
124
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
@@ -234,6 +234,33 @@ var RawSet = /** @class */ (function () {
234
234
  }
235
235
  for (var _q = 0, onElementInitCallBacks_1 = onElementInitCallBacks; _q < onElementInitCallBacks_1.length; _q++) {
236
236
  var it_2 = onElementInitCallBacks_1[_q];
237
+ // 중요 style isolation 나중에 :scope로 대체 가능할듯.
238
+ Array.from(window.document.styleSheets).filter(function (it) { return it.ownerNode && it.ownerNode instanceof Element && it.ownerNode.getAttribute('id') && !it.ownerNode.getAttribute('completed'); }).forEach(function (it) {
239
+ var _a;
240
+ var styleElement = it.ownerNode;
241
+ var id = (_a = styleElement.getAttribute('id')) === null || _a === void 0 ? void 0 : _a.split('-')[0];
242
+ if (id) {
243
+ // console.log('------->', id)
244
+ var start_1 = "#".concat(id, "-start");
245
+ var end_1 = "#".concat(id, "-end");
246
+ Array.from(it.cssRules).filter(function (it) { return it.constructor.name === 'CSSStyleRule'; }).forEach(function (it) {
247
+ var rule = it;
248
+ // rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ *) ${rule.selectorText}`;
249
+ // rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ ${rule.selectorText})`;
250
+ // console.log('-----', rule, rule.selectorText)
251
+ if (!rule.selectorText.startsWith(':root')) {
252
+ rule.selectorText = "".concat(start_1, " ~ ").concat(rule.selectorText, ":not(").concat(start_1, " ~ ").concat(end_1, " ~ *)");
253
+ // if (rule.selectorText.startsWith('.')) {
254
+ // rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ *)${rule.selectorText}`;
255
+ // } else {
256
+ // rule.selectorText = `${rule.selectorText} ~ ${start} ~ *:not(${start} ~ ${end} ~ *)`;
257
+ // }
258
+ }
259
+ // console.log(rule.selectorText);
260
+ });
261
+ }
262
+ it.ownerNode.setAttribute('completed', 'true');
263
+ });
237
264
  (_g = (_f = (_e = (_d = it_2.targetElement) === null || _d === void 0 ? void 0 : _d.__render) === null || _e === void 0 ? void 0 : _e.component) === null || _f === void 0 ? void 0 : _f.onInitRender) === null || _g === void 0 ? void 0 : _g.call(_f, Object.freeze({ render: (_h = it_2.targetElement) === null || _h === void 0 ? void 0 : _h.__render, creatorMetaData: (_j = it_2.targetElement) === null || _j === void 0 ? void 0 : _j.__creatorMetaData }));
238
265
  (_k = config === null || config === void 0 ? void 0 : config.onElementInit) === null || _k === void 0 ? void 0 : _k.call(config, it_2.name, obj, this, it_2.targetElement);
239
266
  }
@@ -530,7 +557,10 @@ var RawSet = /** @class */ (function () {
530
557
  var n = element.cloneNode(true);
531
558
  if (set) {
532
559
  var id = RandomUtils_1.RandomUtils.getRandomString(20);
533
- n.innerHTML = RawSet.styleTransformLocal((_a = set.styles) !== null && _a !== void 0 ? _a : [], id, true, set.styleLocale) + ((_b = set.template) !== null && _b !== void 0 ? _b : '');
560
+ var style = RawSet.styleTransformLocal((_a = set.styles) !== null && _a !== void 0 ? _a : [], id, true, set.styleLocale);
561
+ var metaStart = RawSet.metaStart(id);
562
+ var metaEnd = RawSet.metaEnd(id);
563
+ n.innerHTML = metaStart + style + ((_b = set.template) !== null && _b !== void 0 ? _b : '') + metaEnd;
534
564
  // dr-on-create onCreateRender
535
565
  var onCreate = element.getAttribute("".concat(EventManager_1.EventManager.attrPrefix, "on-create"));
536
566
  var renderScript = '';
@@ -685,8 +715,10 @@ var RawSet = /** @class */ (function () {
685
715
  __render: render
686
716
  }));
687
717
  }
688
- var innerHTML = RawSet.styleTransformLocal(styles, componentKey, true, styleLocale) + (applayTemplate !== null && applayTemplate !== void 0 ? applayTemplate : '');
689
- element.innerHTML = innerHTML;
718
+ var style = RawSet.styleTransformLocal(styles, componentKey, true, styleLocale);
719
+ var metaStart = RawSet.metaStart(componentKey);
720
+ var metaEnd = RawSet.metaEnd(componentKey);
721
+ element.innerHTML = metaStart + style + (applayTemplate !== null && applayTemplate !== void 0 ? applayTemplate : '') + metaEnd;
690
722
  // console.log('------>', element.innerHTML, obj)
691
723
  var data = RawSet.drThisCreate(element, "this.__domrender_components.".concat(componentKey), '', true, obj, config);
692
724
  // 넘어온 innerHTML에 this가 있는걸 다시 복호화해서 제대로 작동하도록한다.
@@ -712,6 +744,7 @@ var RawSet = /** @class */ (function () {
712
744
  var reg = /(?:[$#]\{(?:(([$#]\{)??[^$#]?[^{]*?)\}[$#]))/g;
713
745
  return StringUtils_1.StringUtils.regexExec(reg, data !== null && data !== void 0 ? data : '');
714
746
  };
747
+ // 중요 스타일 적용 부분
715
748
  RawSet.styleTransformLocal = function (styleBody, id, styleTagWrap, locale) {
716
749
  if (styleTagWrap === void 0) { styleTagWrap = true; }
717
750
  if (locale === void 0) { locale = false; }
@@ -733,10 +766,16 @@ var RawSet = /** @class */ (function () {
733
766
  });
734
767
  }
735
768
  if (styleTagWrap) {
736
- styleBody = "<style id='".concat(id, "' domstyle>").concat(styleBody, "</style>");
769
+ styleBody = "<style id='".concat(id, "-style' domstyle>").concat(styleBody, "</style>");
737
770
  }
738
771
  return styleBody;
739
772
  };
773
+ RawSet.metaStart = function (id) {
774
+ return "<meta id='".concat(id, "-start' />");
775
+ };
776
+ RawSet.metaEnd = function (id) {
777
+ return "<meta id='".concat(id, "-end' />");
778
+ };
740
779
  RawSet.destroy = function (obj, parameter, config, destroyOptions) {
741
780
  var _a;
742
781
  if (destroyOptions === void 0) { destroyOptions = []; }
package/dist/bundle.js CHANGED
@@ -1213,7 +1213,7 @@ var Validator = /** @class */ (function () {
1213
1213
  target.value = this._value;
1214
1214
  }
1215
1215
  catch (e) {
1216
- console.log('set value function is blocked ');
1216
+ console.error('set value function is blocked ');
1217
1217
  }
1218
1218
  }
1219
1219
  if (this.getAutoValidAction()) {
@@ -1755,6 +1755,7 @@ var DrTargetElement = /** @class */ (function (_super) {
1755
1755
  targetElement: targetElement,
1756
1756
  creatorMetaData: targetElement.__creatorMetaData
1757
1757
  });
1758
+ // console.log(document.body.innerHTML);
1758
1759
  (_e = targetElement === null || targetElement === void 0 ? void 0 : targetElement.complete) === null || _e === void 0 ? void 0 : _e.call(targetElement, this.elementSource.element, this.source.obj, this.rawSet);
1759
1760
  }
1760
1761
  return exports.ExecuteState.EXECUTE;
@@ -1875,7 +1876,7 @@ var RawSet = /** @class */ (function () {
1875
1876
  // console.log('usingTriggerVariable----------->', usingTriggerVariables)
1876
1877
  return usingTriggerVariables;
1877
1878
  };
1878
- // 중요 render
1879
+ // 중요 render 처리 부분
1879
1880
  RawSet.prototype.render = function (obj, config) {
1880
1881
  var _this = this;
1881
1882
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
@@ -1991,6 +1992,33 @@ var RawSet = /** @class */ (function () {
1991
1992
  }
1992
1993
  for (var _q = 0, onElementInitCallBacks_1 = onElementInitCallBacks; _q < onElementInitCallBacks_1.length; _q++) {
1993
1994
  var it_2 = onElementInitCallBacks_1[_q];
1995
+ // 중요 style isolation 나중에 :scope로 대체 가능할듯.
1996
+ Array.from(window.document.styleSheets).filter(function (it) { return it.ownerNode && it.ownerNode instanceof Element && it.ownerNode.getAttribute('id') && !it.ownerNode.getAttribute('completed'); }).forEach(function (it) {
1997
+ var _a;
1998
+ var styleElement = it.ownerNode;
1999
+ var id = (_a = styleElement.getAttribute('id')) === null || _a === void 0 ? void 0 : _a.split('-')[0];
2000
+ if (id) {
2001
+ // console.log('------->', id)
2002
+ var start_1 = "#".concat(id, "-start");
2003
+ var end_1 = "#".concat(id, "-end");
2004
+ Array.from(it.cssRules).filter(function (it) { return it.constructor.name === 'CSSStyleRule'; }).forEach(function (it) {
2005
+ var rule = it;
2006
+ // rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ *) ${rule.selectorText}`;
2007
+ // rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ ${rule.selectorText})`;
2008
+ // console.log('-----', rule, rule.selectorText)
2009
+ if (!rule.selectorText.startsWith(':root')) {
2010
+ rule.selectorText = "".concat(start_1, " ~ ").concat(rule.selectorText, ":not(").concat(start_1, " ~ ").concat(end_1, " ~ *)");
2011
+ // if (rule.selectorText.startsWith('.')) {
2012
+ // rule.selectorText = `${start} ~ *:not(${start} ~ ${end} ~ *)${rule.selectorText}`;
2013
+ // } else {
2014
+ // rule.selectorText = `${rule.selectorText} ~ ${start} ~ *:not(${start} ~ ${end} ~ *)`;
2015
+ // }
2016
+ }
2017
+ // console.log(rule.selectorText);
2018
+ });
2019
+ }
2020
+ it.ownerNode.setAttribute('completed', 'true');
2021
+ });
1994
2022
  (_g = (_f = (_e = (_d = it_2.targetElement) === null || _d === void 0 ? void 0 : _d.__render) === null || _e === void 0 ? void 0 : _e.component) === null || _f === void 0 ? void 0 : _f.onInitRender) === null || _g === void 0 ? void 0 : _g.call(_f, Object.freeze({ render: (_h = it_2.targetElement) === null || _h === void 0 ? void 0 : _h.__render, creatorMetaData: (_j = it_2.targetElement) === null || _j === void 0 ? void 0 : _j.__creatorMetaData }));
1995
2023
  (_k = config === null || config === void 0 ? void 0 : config.onElementInit) === null || _k === void 0 ? void 0 : _k.call(config, it_2.name, obj, this, it_2.targetElement);
1996
2024
  }
@@ -2287,7 +2315,10 @@ var RawSet = /** @class */ (function () {
2287
2315
  var n = element.cloneNode(true);
2288
2316
  if (set) {
2289
2317
  var id = RandomUtils.getRandomString(20);
2290
- n.innerHTML = RawSet.styleTransformLocal((_a = set.styles) !== null && _a !== void 0 ? _a : [], id, true, set.styleLocale) + ((_b = set.template) !== null && _b !== void 0 ? _b : '');
2318
+ var style = RawSet.styleTransformLocal((_a = set.styles) !== null && _a !== void 0 ? _a : [], id, true, set.styleLocale);
2319
+ var metaStart = RawSet.metaStart(id);
2320
+ var metaEnd = RawSet.metaEnd(id);
2321
+ n.innerHTML = metaStart + style + ((_b = set.template) !== null && _b !== void 0 ? _b : '') + metaEnd;
2291
2322
  // dr-on-create onCreateRender
2292
2323
  var onCreate = element.getAttribute("".concat(EventManager.attrPrefix, "on-create"));
2293
2324
  var renderScript = '';
@@ -2442,8 +2473,10 @@ var RawSet = /** @class */ (function () {
2442
2473
  __render: render
2443
2474
  }));
2444
2475
  }
2445
- var innerHTML = RawSet.styleTransformLocal(styles, componentKey, true, styleLocale) + (applayTemplate !== null && applayTemplate !== void 0 ? applayTemplate : '');
2446
- element.innerHTML = innerHTML;
2476
+ var style = RawSet.styleTransformLocal(styles, componentKey, true, styleLocale);
2477
+ var metaStart = RawSet.metaStart(componentKey);
2478
+ var metaEnd = RawSet.metaEnd(componentKey);
2479
+ element.innerHTML = metaStart + style + (applayTemplate !== null && applayTemplate !== void 0 ? applayTemplate : '') + metaEnd;
2447
2480
  // console.log('------>', element.innerHTML, obj)
2448
2481
  var data = RawSet.drThisCreate(element, "this.__domrender_components.".concat(componentKey), '', true, obj, config);
2449
2482
  // 넘어온 innerHTML에 this가 있는걸 다시 복호화해서 제대로 작동하도록한다.
@@ -2469,6 +2502,7 @@ var RawSet = /** @class */ (function () {
2469
2502
  var reg = /(?:[$#]\{(?:(([$#]\{)??[^$#]?[^{]*?)\}[$#]))/g;
2470
2503
  return StringUtils.regexExec(reg, data !== null && data !== void 0 ? data : '');
2471
2504
  };
2505
+ // 중요 스타일 적용 부분
2472
2506
  RawSet.styleTransformLocal = function (styleBody, id, styleTagWrap, locale) {
2473
2507
  if (styleTagWrap === void 0) { styleTagWrap = true; }
2474
2508
  if (locale === void 0) { locale = false; }
@@ -2490,10 +2524,16 @@ var RawSet = /** @class */ (function () {
2490
2524
  });
2491
2525
  }
2492
2526
  if (styleTagWrap) {
2493
- styleBody = "<style id='".concat(id, "' domstyle>").concat(styleBody, "</style>");
2527
+ styleBody = "<style id='".concat(id, "-style' domstyle>").concat(styleBody, "</style>");
2494
2528
  }
2495
2529
  return styleBody;
2496
2530
  };
2531
+ RawSet.metaStart = function (id) {
2532
+ return "<meta id='".concat(id, "-start' />");
2533
+ };
2534
+ RawSet.metaEnd = function (id) {
2535
+ return "<meta id='".concat(id, "-end' />");
2536
+ };
2497
2537
  RawSet.destroy = function (obj, parameter, config, destroyOptions) {
2498
2538
  var _a;
2499
2539
  if (destroyOptions === void 0) { destroyOptions = []; }
@@ -3258,7 +3298,7 @@ var Messenger = /** @class */ (function () {
3258
3298
  this.config.window.addEventListener(Messenger.EVENT_PUBLISH_KEY, function (e) {
3259
3299
  var _a, _b;
3260
3300
  var detail = e.detail;
3261
- console.log('--->', detail);
3301
+ // console.log('--->', detail)
3262
3302
  var rtns = [];
3263
3303
  (_a = _this.getChannels(detail.key)) === null || _a === void 0 ? void 0 : _a.forEach(function (it) {
3264
3304
  try {
@@ -3275,7 +3315,7 @@ var Messenger = /** @class */ (function () {
3275
3315
  });
3276
3316
  this.config.window.addEventListener(Messenger.EVENT_SUBSCRIBE_KEY, function (e) {
3277
3317
  var detail = e.detail;
3278
- console.log('--->', detail);
3318
+ // console.log('--->', detail)
3279
3319
  var channel = _this.createChannel(detail.obj, detail.key);
3280
3320
  detail.init(channel, channel.subscribe(detail.subscribe));
3281
3321
  });
@@ -3301,7 +3341,7 @@ var Messenger = /** @class */ (function () {
3301
3341
  if (obj) {
3302
3342
  this.channels.forEach(function (it) {
3303
3343
  if (it.obj === obj) {
3304
- console.log('dddddddddddd', obj);
3344
+ // console.log('dddddddddddd', obj)
3305
3345
  _this.deleteChannel(it);
3306
3346
  }
3307
3347
  });
@@ -3451,18 +3491,18 @@ var Appender = /** @class */ (function () {
3451
3491
  return Appender;
3452
3492
  }());
3453
3493
 
3454
- var CheckedValidator = /** @class */ (function (_super) {
3455
- __extends(CheckedValidator, _super);
3456
- function CheckedValidator(value, target, event, autoValid) {
3494
+ var AllCheckedValidatorArray = /** @class */ (function (_super) {
3495
+ __extends(AllCheckedValidatorArray, _super);
3496
+ function AllCheckedValidatorArray(value, target, event, autoValid) {
3457
3497
  if (autoValid === void 0) { autoValid = true; }
3458
3498
  return _super.call(this, value, target, event, autoValid) || this;
3459
3499
  }
3460
- CheckedValidator.prototype.valid = function () {
3461
- var _a, _b;
3462
- return (_b = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.checked) !== null && _b !== void 0 ? _b : false;
3500
+ AllCheckedValidatorArray.prototype.valid = function () {
3501
+ var _a;
3502
+ return !(((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length > 0);
3463
3503
  };
3464
- return CheckedValidator;
3465
- }(Validator));
3504
+ return AllCheckedValidatorArray;
3505
+ }(ValidatorArray));
3466
3506
 
3467
3507
  var AllUnCheckedValidatorArray = /** @class */ (function (_super) {
3468
3508
  __extends(AllUnCheckedValidatorArray, _super);
@@ -3492,18 +3532,18 @@ var CountEqualsCheckedValidatorArray = /** @class */ (function (_super) {
3492
3532
  return CountEqualsCheckedValidatorArray;
3493
3533
  }(ValidatorArray));
3494
3534
 
3495
- var AllCheckedValidatorArray = /** @class */ (function (_super) {
3496
- __extends(AllCheckedValidatorArray, _super);
3497
- function AllCheckedValidatorArray(value, target, event, autoValid) {
3535
+ var CheckedValidator = /** @class */ (function (_super) {
3536
+ __extends(CheckedValidator, _super);
3537
+ function CheckedValidator(value, target, event, autoValid) {
3498
3538
  if (autoValid === void 0) { autoValid = true; }
3499
3539
  return _super.call(this, value, target, event, autoValid) || this;
3500
3540
  }
3501
- AllCheckedValidatorArray.prototype.valid = function () {
3502
- var _a;
3503
- return !(((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length > 0);
3541
+ CheckedValidator.prototype.valid = function () {
3542
+ var _a, _b;
3543
+ return (_b = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.checked) !== null && _b !== void 0 ? _b : false;
3504
3544
  };
3505
- return AllCheckedValidatorArray;
3506
- }(ValidatorArray));
3545
+ return CheckedValidator;
3546
+ }(Validator));
3507
3547
 
3508
3548
  var CountGreaterThanCheckedValidatorArray = /** @class */ (function (_super) {
3509
3549
  __extends(CountGreaterThanCheckedValidatorArray, _super);
@@ -3520,21 +3560,6 @@ var CountGreaterThanCheckedValidatorArray = /** @class */ (function (_super) {
3520
3560
  return CountGreaterThanCheckedValidatorArray;
3521
3561
  }(ValidatorArray));
3522
3562
 
3523
- var CountEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
3524
- __extends(CountEqualsUnCheckedValidatorArray, _super);
3525
- function CountEqualsUnCheckedValidatorArray(count, value, target, event, autoValid) {
3526
- if (autoValid === void 0) { autoValid = true; }
3527
- var _this = _super.call(this, value, target, event, autoValid) || this;
3528
- _this.count = count;
3529
- return _this;
3530
- }
3531
- CountEqualsUnCheckedValidatorArray.prototype.valid = function () {
3532
- var _a;
3533
- return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length === this.count;
3534
- };
3535
- return CountEqualsUnCheckedValidatorArray;
3536
- }(ValidatorArray));
3537
-
3538
3563
  var CountGreaterThanEqualsCheckedValidatorArray = /** @class */ (function (_super) {
3539
3564
  __extends(CountGreaterThanEqualsCheckedValidatorArray, _super);
3540
3565
  function CountGreaterThanEqualsCheckedValidatorArray(count, value, target, event, autoValid) {
@@ -3565,34 +3590,34 @@ var CountGreaterThanEqualsUnCheckedValidatorArray = /** @class */ (function (_su
3565
3590
  return CountGreaterThanEqualsUnCheckedValidatorArray;
3566
3591
  }(ValidatorArray));
3567
3592
 
3568
- var CountGreaterThanUnCheckedValidatorArray = /** @class */ (function (_super) {
3569
- __extends(CountGreaterThanUnCheckedValidatorArray, _super);
3570
- function CountGreaterThanUnCheckedValidatorArray(count, value, target, event, autoValid) {
3593
+ var CountLessThanCheckedValidatorArray = /** @class */ (function (_super) {
3594
+ __extends(CountLessThanCheckedValidatorArray, _super);
3595
+ function CountLessThanCheckedValidatorArray(count, value, target, event, autoValid) {
3571
3596
  if (autoValid === void 0) { autoValid = true; }
3572
3597
  var _this = _super.call(this, value, target, event, autoValid) || this;
3573
3598
  _this.count = count;
3574
3599
  return _this;
3575
3600
  }
3576
- CountGreaterThanUnCheckedValidatorArray.prototype.valid = function () {
3601
+ CountLessThanCheckedValidatorArray.prototype.valid = function () {
3577
3602
  var _a;
3578
- return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length > this.count;
3603
+ return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length < this.count;
3579
3604
  };
3580
- return CountGreaterThanUnCheckedValidatorArray;
3605
+ return CountLessThanCheckedValidatorArray;
3581
3606
  }(ValidatorArray));
3582
3607
 
3583
- var CountLessThanCheckedValidatorArray = /** @class */ (function (_super) {
3584
- __extends(CountLessThanCheckedValidatorArray, _super);
3585
- function CountLessThanCheckedValidatorArray(count, value, target, event, autoValid) {
3608
+ var CountGreaterThanUnCheckedValidatorArray = /** @class */ (function (_super) {
3609
+ __extends(CountGreaterThanUnCheckedValidatorArray, _super);
3610
+ function CountGreaterThanUnCheckedValidatorArray(count, value, target, event, autoValid) {
3586
3611
  if (autoValid === void 0) { autoValid = true; }
3587
3612
  var _this = _super.call(this, value, target, event, autoValid) || this;
3588
3613
  _this.count = count;
3589
3614
  return _this;
3590
3615
  }
3591
- CountLessThanCheckedValidatorArray.prototype.valid = function () {
3616
+ CountGreaterThanUnCheckedValidatorArray.prototype.valid = function () {
3592
3617
  var _a;
3593
- return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return it.checked; }).length < this.count;
3618
+ return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length > this.count;
3594
3619
  };
3595
- return CountLessThanCheckedValidatorArray;
3620
+ return CountGreaterThanUnCheckedValidatorArray;
3596
3621
  }(ValidatorArray));
3597
3622
 
3598
3623
  var CountLessThanEqualsCheckedValidatorArray = /** @class */ (function (_super) {
@@ -3610,52 +3635,35 @@ var CountLessThanEqualsCheckedValidatorArray = /** @class */ (function (_super)
3610
3635
  return CountLessThanEqualsCheckedValidatorArray;
3611
3636
  }(ValidatorArray));
3612
3637
 
3613
- var CountLessThanEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
3614
- __extends(CountLessThanEqualsUnCheckedValidatorArray, _super);
3615
- function CountLessThanEqualsUnCheckedValidatorArray(count, value, target, event, autoValid) {
3638
+ var CountEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
3639
+ __extends(CountEqualsUnCheckedValidatorArray, _super);
3640
+ function CountEqualsUnCheckedValidatorArray(count, value, target, event, autoValid) {
3616
3641
  if (autoValid === void 0) { autoValid = true; }
3617
3642
  var _this = _super.call(this, value, target, event, autoValid) || this;
3618
3643
  _this.count = count;
3619
3644
  return _this;
3620
3645
  }
3621
- CountLessThanEqualsUnCheckedValidatorArray.prototype.valid = function () {
3646
+ CountEqualsUnCheckedValidatorArray.prototype.valid = function () {
3622
3647
  var _a;
3623
- return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length <= this.count;
3648
+ return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length === this.count;
3624
3649
  };
3625
- return CountLessThanEqualsUnCheckedValidatorArray;
3650
+ return CountEqualsUnCheckedValidatorArray;
3626
3651
  }(ValidatorArray));
3627
3652
 
3628
- var FormValidator = /** @class */ (function (_super) {
3629
- __extends(FormValidator, _super);
3630
- function FormValidator(target, event, autoValid) {
3631
- if (autoValid === void 0) { autoValid = true; }
3632
- return _super.call(this, undefined, target, event, autoValid) || this;
3633
- }
3634
- FormValidator.prototype.validAction = function () {
3635
- return _super.prototype.childValidAction.call(this);
3636
- };
3637
- FormValidator.prototype.valid = function () {
3638
- return this.childValid();
3639
- };
3640
- FormValidator.prototype.reset = function () {
3641
- this.targetReset();
3642
- };
3643
- return FormValidator;
3644
- }(Validator));
3645
-
3646
- var EmptyValidator = /** @class */ (function (_super) {
3647
- __extends(EmptyValidator, _super);
3648
- function EmptyValidator(value, target, event, autoValid) {
3653
+ var CountLessThanUnCheckedValidatorArray = /** @class */ (function (_super) {
3654
+ __extends(CountLessThanUnCheckedValidatorArray, _super);
3655
+ function CountLessThanUnCheckedValidatorArray(count, value, target, event, autoValid) {
3649
3656
  if (autoValid === void 0) { autoValid = true; }
3650
- return _super.call(this, value, target, event, autoValid) || this;
3657
+ var _this = _super.call(this, value, target, event, autoValid) || this;
3658
+ _this.count = count;
3659
+ return _this;
3651
3660
  }
3652
- EmptyValidator.prototype.valid = function () {
3653
- var _a, _b;
3654
- var value = this.value;
3655
- return value === undefined || value === null || ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) <= 0;
3661
+ CountLessThanUnCheckedValidatorArray.prototype.valid = function () {
3662
+ var _a;
3663
+ return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length < this.count;
3656
3664
  };
3657
- return EmptyValidator;
3658
- }(Validator));
3665
+ return CountLessThanUnCheckedValidatorArray;
3666
+ }(ValidatorArray));
3659
3667
 
3660
3668
  var CountUnCheckedValidatorArray = /** @class */ (function (_super) {
3661
3669
  __extends(CountUnCheckedValidatorArray, _super);
@@ -3672,21 +3680,35 @@ var CountUnCheckedValidatorArray = /** @class */ (function (_super) {
3672
3680
  return CountUnCheckedValidatorArray;
3673
3681
  }(ValidatorArray));
3674
3682
 
3675
- var CountLessThanUnCheckedValidatorArray = /** @class */ (function (_super) {
3676
- __extends(CountLessThanUnCheckedValidatorArray, _super);
3677
- function CountLessThanUnCheckedValidatorArray(count, value, target, event, autoValid) {
3683
+ var CountLessThanEqualsUnCheckedValidatorArray = /** @class */ (function (_super) {
3684
+ __extends(CountLessThanEqualsUnCheckedValidatorArray, _super);
3685
+ function CountLessThanEqualsUnCheckedValidatorArray(count, value, target, event, autoValid) {
3678
3686
  if (autoValid === void 0) { autoValid = true; }
3679
3687
  var _this = _super.call(this, value, target, event, autoValid) || this;
3680
3688
  _this.count = count;
3681
3689
  return _this;
3682
3690
  }
3683
- CountLessThanUnCheckedValidatorArray.prototype.valid = function () {
3691
+ CountLessThanEqualsUnCheckedValidatorArray.prototype.valid = function () {
3684
3692
  var _a;
3685
- return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length < this.count;
3693
+ return ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(function (it) { return !it.checked; }).length <= this.count;
3686
3694
  };
3687
- return CountLessThanUnCheckedValidatorArray;
3695
+ return CountLessThanEqualsUnCheckedValidatorArray;
3688
3696
  }(ValidatorArray));
3689
3697
 
3698
+ var EmptyValidator = /** @class */ (function (_super) {
3699
+ __extends(EmptyValidator, _super);
3700
+ function EmptyValidator(value, target, event, autoValid) {
3701
+ if (autoValid === void 0) { autoValid = true; }
3702
+ return _super.call(this, value, target, event, autoValid) || this;
3703
+ }
3704
+ EmptyValidator.prototype.valid = function () {
3705
+ var _a, _b;
3706
+ var value = this.value;
3707
+ return value === undefined || value === null || ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) <= 0;
3708
+ };
3709
+ return EmptyValidator;
3710
+ }(Validator));
3711
+
3690
3712
  var ExcludeCheckedValidatorArray = /** @class */ (function (_super) {
3691
3713
  __extends(ExcludeCheckedValidatorArray, _super);
3692
3714
  function ExcludeCheckedValidatorArray(include, allRequired, value, target, event, autoValid) {
@@ -3709,35 +3731,6 @@ var ExcludeCheckedValidatorArray = /** @class */ (function (_super) {
3709
3731
  return ExcludeCheckedValidatorArray;
3710
3732
  }(ValidatorArray));
3711
3733
 
3712
- var MultipleValidator = /** @class */ (function (_super) {
3713
- __extends(MultipleValidator, _super);
3714
- function MultipleValidator(validators, value, target, event, autoValid) {
3715
- if (autoValid === void 0) { autoValid = true; }
3716
- var _this = _super.call(this, value, target, event, autoValid) || this;
3717
- _this.validators = validators.map(function (it) {
3718
- it.setAutoValid(false);
3719
- it.setAutoValidAction(false);
3720
- return it;
3721
- });
3722
- _this.validators.forEach(function (it) {
3723
- it.set(_this.value, _this.getTarget(), _this.getEvent());
3724
- });
3725
- return _this;
3726
- }
3727
- MultipleValidator.prototype.changeValue = function (value) {
3728
- var _this = this;
3729
- this.validators.forEach(function (it) { return it.set(_this.value, _this.getTarget(), _this.getEvent()); });
3730
- };
3731
- MultipleValidator.prototype.validAction = function () {
3732
- return !(this.validators.filter(function (it) { return !it.validAction(); }).length > 0);
3733
- };
3734
- MultipleValidator.prototype.valid = function () {
3735
- // console.log('mm', this.validators)
3736
- return !(this.validators.filter(function (it) { return !it.valid(); }).length > 0);
3737
- };
3738
- return MultipleValidator;
3739
- }(Validator));
3740
-
3741
3734
  var IncludeCheckedValidatorArray = /** @class */ (function (_super) {
3742
3735
  __extends(IncludeCheckedValidatorArray, _super);
3743
3736
  function IncludeCheckedValidatorArray(include, allRequired, value, target, event, autoValid) {
@@ -3772,6 +3765,67 @@ var PassValidator = /** @class */ (function (_super) {
3772
3765
  return PassValidator;
3773
3766
  }(Validator));
3774
3767
 
3768
+ var FormValidator = /** @class */ (function (_super) {
3769
+ __extends(FormValidator, _super);
3770
+ function FormValidator(target, event, autoValid) {
3771
+ if (autoValid === void 0) { autoValid = true; }
3772
+ return _super.call(this, undefined, target, event, autoValid) || this;
3773
+ }
3774
+ FormValidator.prototype.validAction = function () {
3775
+ return _super.prototype.childValidAction.call(this);
3776
+ };
3777
+ FormValidator.prototype.valid = function () {
3778
+ return this.childValid();
3779
+ };
3780
+ FormValidator.prototype.reset = function () {
3781
+ this.targetReset();
3782
+ };
3783
+ return FormValidator;
3784
+ }(Validator));
3785
+
3786
+ var RequiredValidator = /** @class */ (function (_super) {
3787
+ __extends(RequiredValidator, _super);
3788
+ function RequiredValidator(value, target, event, autoValid) {
3789
+ if (autoValid === void 0) { autoValid = true; }
3790
+ return _super.call(this, value, target, event, autoValid) || this;
3791
+ }
3792
+ RequiredValidator.prototype.valid = function () {
3793
+ var value = this.value;
3794
+ // console.log('required', value, value !== undefined && value !== null)
3795
+ return value !== undefined && value !== null;
3796
+ };
3797
+ return RequiredValidator;
3798
+ }(Validator));
3799
+
3800
+ var MultipleValidator = /** @class */ (function (_super) {
3801
+ __extends(MultipleValidator, _super);
3802
+ function MultipleValidator(validators, value, target, event, autoValid) {
3803
+ if (autoValid === void 0) { autoValid = true; }
3804
+ var _this = _super.call(this, value, target, event, autoValid) || this;
3805
+ _this.validators = validators.map(function (it) {
3806
+ it.setAutoValid(false);
3807
+ it.setAutoValidAction(false);
3808
+ return it;
3809
+ });
3810
+ _this.validators.forEach(function (it) {
3811
+ it.set(_this.value, _this.getTarget(), _this.getEvent());
3812
+ });
3813
+ return _this;
3814
+ }
3815
+ MultipleValidator.prototype.changeValue = function (value) {
3816
+ var _this = this;
3817
+ this.validators.forEach(function (it) { return it.set(_this.value, _this.getTarget(), _this.getEvent()); });
3818
+ };
3819
+ MultipleValidator.prototype.validAction = function () {
3820
+ return !(this.validators.filter(function (it) { return !it.validAction(); }).length > 0);
3821
+ };
3822
+ MultipleValidator.prototype.valid = function () {
3823
+ // console.log('mm', this.validators)
3824
+ return !(this.validators.filter(function (it) { return !it.valid(); }).length > 0);
3825
+ };
3826
+ return MultipleValidator;
3827
+ }(Validator));
3828
+
3775
3829
  var RegExpTestValidator = /** @class */ (function (_super) {
3776
3830
  __extends(RegExpTestValidator, _super);
3777
3831
  function RegExpTestValidator(regexp, value, target, event, autoValid) {
@@ -3795,47 +3849,39 @@ var RegExpTestValidator = /** @class */ (function (_super) {
3795
3849
  return RegExpTestValidator;
3796
3850
  }(Validator));
3797
3851
 
3798
- var RequiredValidator = /** @class */ (function (_super) {
3799
- __extends(RequiredValidator, _super);
3800
- function RequiredValidator(value, target, event, autoValid) {
3801
- if (autoValid === void 0) { autoValid = true; }
3802
- return _super.call(this, value, target, event, autoValid) || this;
3803
- }
3804
- RequiredValidator.prototype.valid = function () {
3805
- var value = this.value;
3806
- // console.log('required', value, value !== undefined && value !== null)
3807
- return value !== undefined && value !== null;
3808
- };
3809
- return RequiredValidator;
3810
- }(Validator));
3811
-
3812
- var NotEmptyValidator = /** @class */ (function (_super) {
3813
- __extends(NotEmptyValidator, _super);
3814
- function NotEmptyValidator(value, target, event, autoValid) {
3852
+ var UnCheckedValidator = /** @class */ (function (_super) {
3853
+ __extends(UnCheckedValidator, _super);
3854
+ function UnCheckedValidator(value, target, event, autoValid) {
3815
3855
  if (autoValid === void 0) { autoValid = true; }
3816
3856
  return _super.call(this, value, target, event, autoValid) || this;
3817
3857
  }
3818
- NotEmptyValidator.prototype.valid = function () {
3858
+ UnCheckedValidator.prototype.valid = function () {
3819
3859
  var _a, _b;
3820
- var value = this.value;
3821
- // console.log('NotEmptyValidator', value, value !== undefined && value !== null && ((value as any)?.length ?? 0) > 0)
3822
- return value !== undefined && value !== null && ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
3860
+ return !((_b = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.checked) !== null && _b !== void 0 ? _b : false);
3823
3861
  };
3824
- return NotEmptyValidator;
3862
+ return UnCheckedValidator;
3825
3863
  }(Validator));
3826
3864
 
3827
- var ValidValidator = /** @class */ (function (_super) {
3828
- __extends(ValidValidator, _super);
3829
- function ValidValidator(validCallBack, value, target, event, autoValid) {
3865
+ var NotRegExpTestValidator = /** @class */ (function (_super) {
3866
+ __extends(NotRegExpTestValidator, _super);
3867
+ function NotRegExpTestValidator(regexp, value, target, event, autoValid) {
3830
3868
  if (autoValid === void 0) { autoValid = true; }
3831
3869
  var _this = _super.call(this, value, target, event, autoValid) || this;
3832
- _this.validCallBack = validCallBack;
3870
+ _this.regexp = DomRenderProxy.final(regexp);
3833
3871
  return _this;
3834
3872
  }
3835
- ValidValidator.prototype.valid = function (value, target, event) {
3836
- return this.validCallBack(value, target, event);
3873
+ NotRegExpTestValidator.prototype.valid = function () {
3874
+ var _a;
3875
+ var value = this.value;
3876
+ var regExp = (_a = this.regexp._DomRender_origin) !== null && _a !== void 0 ? _a : this.regexp;
3877
+ if (value) {
3878
+ return !regExp.test(value);
3879
+ }
3880
+ else {
3881
+ return true;
3882
+ }
3837
3883
  };
3838
- return ValidValidator;
3884
+ return NotRegExpTestValidator;
3839
3885
  }(Validator));
3840
3886
 
3841
3887
  var ValidMultipleValidator = /** @class */ (function (_super) {
@@ -3853,31 +3899,33 @@ var ValidMultipleValidator = /** @class */ (function (_super) {
3853
3899
  return ValidMultipleValidator;
3854
3900
  }(MultipleValidator));
3855
3901
 
3856
- var ValidValidatorArray = /** @class */ (function (_super) {
3857
- __extends(ValidValidatorArray, _super);
3858
- function ValidValidatorArray(validCallBack, value, target, event, autoValid) {
3902
+ var NotEmptyValidator = /** @class */ (function (_super) {
3903
+ __extends(NotEmptyValidator, _super);
3904
+ function NotEmptyValidator(value, target, event, autoValid) {
3859
3905
  if (autoValid === void 0) { autoValid = true; }
3860
- var _this = _super.call(this, value, target, event, autoValid) || this;
3861
- _this.validCallBack = validCallBack;
3862
- return _this;
3906
+ return _super.call(this, value, target, event, autoValid) || this;
3863
3907
  }
3864
- ValidValidatorArray.prototype.valid = function () {
3865
- return this.validCallBack(this.value, this.getTarget(), this.getEvent());
3908
+ NotEmptyValidator.prototype.valid = function () {
3909
+ var _a, _b;
3910
+ var value = this.value;
3911
+ // console.log('NotEmptyValidator', value, value !== undefined && value !== null && ((value as any)?.length ?? 0) > 0)
3912
+ return value !== undefined && value !== null && ((_b = (_a = value) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
3866
3913
  };
3867
- return ValidValidatorArray;
3868
- }(ValidatorArray));
3914
+ return NotEmptyValidator;
3915
+ }(Validator));
3869
3916
 
3870
- var UnCheckedValidator = /** @class */ (function (_super) {
3871
- __extends(UnCheckedValidator, _super);
3872
- function UnCheckedValidator(value, target, event, autoValid) {
3917
+ var ValidValidator = /** @class */ (function (_super) {
3918
+ __extends(ValidValidator, _super);
3919
+ function ValidValidator(validCallBack, value, target, event, autoValid) {
3873
3920
  if (autoValid === void 0) { autoValid = true; }
3874
- return _super.call(this, value, target, event, autoValid) || this;
3921
+ var _this = _super.call(this, value, target, event, autoValid) || this;
3922
+ _this.validCallBack = validCallBack;
3923
+ return _this;
3875
3924
  }
3876
- UnCheckedValidator.prototype.valid = function () {
3877
- var _a, _b;
3878
- return !((_b = (_a = this.getTarget()) === null || _a === void 0 ? void 0 : _a.checked) !== null && _b !== void 0 ? _b : false);
3925
+ ValidValidator.prototype.valid = function (value, target, event) {
3926
+ return this.validCallBack(value, target, event);
3879
3927
  };
3880
- return UnCheckedValidator;
3928
+ return ValidValidator;
3881
3929
  }(Validator));
3882
3930
 
3883
3931
  var ValueEqualsValidator = /** @class */ (function (_super) {
@@ -3894,27 +3942,19 @@ var ValueEqualsValidator = /** @class */ (function (_super) {
3894
3942
  return ValueEqualsValidator;
3895
3943
  }(Validator));
3896
3944
 
3897
- var NotRegExpTestValidator = /** @class */ (function (_super) {
3898
- __extends(NotRegExpTestValidator, _super);
3899
- function NotRegExpTestValidator(regexp, value, target, event, autoValid) {
3945
+ var ValidValidatorArray = /** @class */ (function (_super) {
3946
+ __extends(ValidValidatorArray, _super);
3947
+ function ValidValidatorArray(validCallBack, value, target, event, autoValid) {
3900
3948
  if (autoValid === void 0) { autoValid = true; }
3901
3949
  var _this = _super.call(this, value, target, event, autoValid) || this;
3902
- _this.regexp = DomRenderProxy.final(regexp);
3950
+ _this.validCallBack = validCallBack;
3903
3951
  return _this;
3904
3952
  }
3905
- NotRegExpTestValidator.prototype.valid = function () {
3906
- var _a;
3907
- var value = this.value;
3908
- var regExp = (_a = this.regexp._DomRender_origin) !== null && _a !== void 0 ? _a : this.regexp;
3909
- if (value) {
3910
- return !regExp.test(value);
3911
- }
3912
- else {
3913
- return true;
3914
- }
3953
+ ValidValidatorArray.prototype.valid = function () {
3954
+ return this.validCallBack(this.value, this.getTarget(), this.getEvent());
3915
3955
  };
3916
- return NotRegExpTestValidator;
3917
- }(Validator));
3956
+ return ValidValidatorArray;
3957
+ }(ValidatorArray));
3918
3958
 
3919
3959
  var ValueNotEqualsValidator = /** @class */ (function (_super) {
3920
3960
  __extends(ValueNotEqualsValidator, _super);
@@ -127,7 +127,7 @@ var Messenger = /** @class */ (function () {
127
127
  this.config.window.addEventListener(Messenger.EVENT_PUBLISH_KEY, function (e) {
128
128
  var _a, _b;
129
129
  var detail = e.detail;
130
- console.log('--->', detail);
130
+ // console.log('--->', detail)
131
131
  var rtns = [];
132
132
  (_a = _this.getChannels(detail.key)) === null || _a === void 0 ? void 0 : _a.forEach(function (it) {
133
133
  try {
@@ -144,7 +144,7 @@ var Messenger = /** @class */ (function () {
144
144
  });
145
145
  this.config.window.addEventListener(Messenger.EVENT_SUBSCRIBE_KEY, function (e) {
146
146
  var detail = e.detail;
147
- console.log('--->', detail);
147
+ // console.log('--->', detail)
148
148
  var channel = _this.createChannel(detail.obj, detail.key);
149
149
  detail.init(channel, channel.subscribe(detail.subscribe));
150
150
  });
@@ -170,7 +170,7 @@ var Messenger = /** @class */ (function () {
170
170
  if (obj) {
171
171
  this.channels.forEach(function (it) {
172
172
  if (it.obj === obj) {
173
- console.log('dddddddddddd', obj);
173
+ // console.log('dddddddddddd', obj)
174
174
  _this.deleteChannel(it);
175
175
  }
176
176
  });
@@ -80,6 +80,7 @@ var DrTargetElement = /** @class */ (function (_super) {
80
80
  targetElement: targetElement,
81
81
  creatorMetaData: targetElement.__creatorMetaData
82
82
  });
83
+ // console.log(document.body.innerHTML);
83
84
  (_e = targetElement === null || targetElement === void 0 ? void 0 : targetElement.complete) === null || _e === void 0 ? void 0 : _e.call(targetElement, this.elementSource.element, this.source.obj, this.rawSet);
84
85
  }
85
86
  return OperatorRender_1.ExecuteState.EXECUTE;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dom-render",
3
- "version": "1.0.81",
3
+ "version": "1.0.82",
4
4
  "main": "DomRender.js",
5
5
  "license": "MIT",
6
6
  "description": "dom-render",
@@ -93,7 +93,7 @@ var Validator = /** @class */ (function () {
93
93
  target.value = this._value;
94
94
  }
95
95
  catch (e) {
96
- console.log('set value function is blocked ');
96
+ console.error('set value function is blocked ');
97
97
  }
98
98
  }
99
99
  if (this.getAutoValidAction()) {