예제 #1
0
        public override Value Evaluate()
        {
            var stack    = State.Stack;
            var value    = stack.Pop(true, LOCATION);
            var variable = stack.Pop <Variable>(false, LOCATION);

            value = value.AssignmentValue();
            value = new BoundValue(variable.Name, value);
            return(value);
        }
        public static IElement <TTag> For <TTag>(
            this IElement <TTag> element,
            BoundValue value,
            bool formItemWrapper    = true,
            bool tooltipDescription = true)
            where TTag : ElementTag
        {
            if (value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            element = element.VModel(value);

            // Create the form item wrapper
            VueInstanceBoundValue instanceValue = value as VueInstanceBoundValue;

            if (formItemWrapper)
            {
                IElement <FormItem> formItem = element.Tag.Helper.FormItem();
                if (instanceValue != null)
                {
                    formItem = formItem
                               .Label(instanceValue.Metadata.DisplayName)
                               .Required(instanceValue.Metadata.IsRequired);

                    // Set the validation property
                    if (instanceValue.Instance.TagData.TryGetValue(ValidationErrorsKey, out object validationErrorsProperty))
                    {
                        formItem = formItem.Error((BoundValue)$"{validationErrorsProperty}['{value.Value}']");
                    }
                }

                // Add the form item as a parent
                element = element.Parent(formItem);
            }

            // Create the tooltip description
            if (tooltipDescription && !string.IsNullOrWhiteSpace(instanceValue?.Metadata.Description))
            {
                element = element.Child(
                    element.Tag.Helper.Tooltip()
                    .Content(instanceValue.Metadata.Description)
                    .Html("<i class=\"el-icon-information\"></i>"),
                    ChildPosition.AfterClosing);
            }

            return(element);
        }
예제 #3
0
파일: Program.cs 프로젝트: yuba/ValueRange
        static void Main(string[] args)
        {
            BoundValue <int> u1 = new BoundValue <int> .UpperBoundValue(1);

            BoundValue <int> u2 = new BoundValue <int> .UpperBoundValue(2);

            BoundValue <int> u3 = new BoundValue <int> .UpperBoundValue(3);

            BoundValue <int> l2 = new BoundValue <int> .LowerBoundValue(2);

            BoundValue <int> pi = new BoundValue <int> .PositiveInfiniteValue();

            BoundValue <int> ni = new BoundValue <int> .NegativeInfiniteValue();

            Console.Out.WriteLine("^1 < v2 == " + (u1 < l2));
            Console.Out.WriteLine("^2 < v2 == " + (u2 < l2));
            Console.Out.WriteLine("^3 < v2 == " + (u3 < l2));
            Console.Out.WriteLine();

            Console.Out.WriteLine("^1 > v2 == " + (u1 > l2));
            Console.Out.WriteLine("^2 > v2 == " + (u2 > l2));
            Console.Out.WriteLine("^3 > v2 == " + (u3 > l2));
            Console.Out.WriteLine();

            Console.Out.WriteLine("^1 >= v2 == " + (u1 >= l2));
            Console.Out.WriteLine("^2 >= v2 == " + (u2 >= l2));
            Console.Out.WriteLine("^3 >= v2 == " + (u3 >= l2));
            Console.Out.WriteLine();

            Console.Out.WriteLine("^1 == v2 == " + (u1 == l2));
            Console.Out.WriteLine("^2 == v2 == " + (u2 == l2));
            Console.Out.WriteLine("^3 == v2 == " + (u3 == l2));
            Console.Out.WriteLine();

            Console.Out.WriteLine("+∞ > v2 == " + (pi > l2));
            Console.Out.WriteLine("^2 > +∞ == " + (u2 > pi));
            Console.Out.WriteLine("-∞ > v2 == " + (ni > l2));
            Console.Out.WriteLine("-∞ > +∞ == " + (ni > pi));
            Console.Out.WriteLine("-∞ < +∞ == " + (ni < pi));
            Console.Out.WriteLine();

            var range = (2 <= Range <int> .That < 3);

            Console.Out.WriteLine(range);
            Console.Out.WriteLine(Range <int> .That > 0);


            Console.In.ReadLine();
        }
예제 #4
0
파일: Program.cs 프로젝트: yuba/ValueRange
        static void Main(string[] args)
        {
            BoundValue<int> u1 = new BoundValue<int>.UpperBoundValue(1);
            BoundValue<int> u2 = new BoundValue<int>.UpperBoundValue(2);
            BoundValue<int> u3 = new BoundValue<int>.UpperBoundValue(3);
            BoundValue<int> l2 = new BoundValue<int>.LowerBoundValue(2);
            BoundValue<int> pi = new BoundValue<int>.PositiveInfiniteValue();
            BoundValue<int> ni = new BoundValue<int>.NegativeInfiniteValue();

            Console.Out.WriteLine("^1 < v2 == " + (u1 < l2));
            Console.Out.WriteLine("^2 < v2 == " + (u2 < l2));
            Console.Out.WriteLine("^3 < v2 == " + (u3 < l2));
            Console.Out.WriteLine();

            Console.Out.WriteLine("^1 > v2 == " + (u1 > l2));
            Console.Out.WriteLine("^2 > v2 == " + (u2 > l2));
            Console.Out.WriteLine("^3 > v2 == " + (u3 > l2));
            Console.Out.WriteLine();

            Console.Out.WriteLine("^1 >= v2 == " + (u1 >= l2));
            Console.Out.WriteLine("^2 >= v2 == " + (u2 >= l2));
            Console.Out.WriteLine("^3 >= v2 == " + (u3 >= l2));
            Console.Out.WriteLine();

            Console.Out.WriteLine("^1 == v2 == " + (u1 == l2));
            Console.Out.WriteLine("^2 == v2 == " + (u2 == l2));
            Console.Out.WriteLine("^3 == v2 == " + (u3 == l2));
            Console.Out.WriteLine();

            Console.Out.WriteLine("+∞ > v2 == " + (pi > l2));
            Console.Out.WriteLine("^2 > +∞ == " + (u2 > pi));
            Console.Out.WriteLine("-∞ > v2 == " + (ni > l2));
            Console.Out.WriteLine("-∞ > +∞ == " + (ni > pi));
            Console.Out.WriteLine("-∞ < +∞ == " + (ni < pi));
            Console.Out.WriteLine();

            var range = (2 <= Range<int>.That < 3);
            Console.Out.WriteLine(range);
            Console.Out.WriteLine(Range<int>.That > 0);

            Console.In.ReadLine();
        }
예제 #5
0
 public static IElement <Table> EmptyText(this IElement <Table> element, BoundValue emptyText) => element.Attribute("empty-text", emptyText);
예제 #6
0
 public static IElement <Tooltip> Offset(this IElement <Tooltip> element, BoundValue <int> offset) => element.Attribute("offest", offset);
예제 #7
0
 public static IElement <Table> ShowSummary(this IElement <Table> element, BoundValue <bool> showSummary) => element.Attribute("show-summary", showSummary);
예제 #8
0
 public static IElement <Table> SummaryMethod(this IElement <Table> element, BoundValue summaryMethod) => element.Attribute("summary-method", summaryMethod);
예제 #9
0
 public static IElement <Table> Fit(this IElement <Table> element, BoundValue <bool> fit) => element.Attribute("fit", fit);
예제 #10
0
 public static IElement <Table> DefaultSort(this IElement <Table> element, BoundValue defaultSort) => element.Attribute("default-sort", defaultSort);
예제 #11
0
 public static IElement <Table> Stripe(this IElement <Table> element, BoundValue <bool> stripe) => element.Attribute("stripe", stripe);
예제 #12
0
 public static IElement <Table> Border(this IElement <Table> element, BoundValue <bool> border) => element.Attribute("border", border);
예제 #13
0
 public static IElement <Table> MaxHeight(this IElement <Table> element, BoundValue <int> maxHeight) => element.Attribute("max-height", maxHeight);
예제 #14
0
 public static IElement <Table> Height(this IElement <Table> element, BoundValue <int> height) => element.Attribute("height", height);
예제 #15
0
        // Attributes

        public static IElement <Table> Data(this IElement <Table> element, BoundValue data) => element.Attribute("data", data);
예제 #16
0
 public static IElement <Table> DefaultExpandAll(this IElement <Table> element, BoundValue <bool> defaultExpandAll) => element.Attribute("default-expand-all", defaultExpandAll);
예제 #17
0
 public static IElement <Table> ShowHeader(this IElement <Table> element, BoundValue <bool> showHeader) => element.Attribute("show-header", showHeader);
예제 #18
0
 public static IElement <Table> ExpandRowKeys(this IElement <Table> element, BoundValue expandRowKeys) => element.Attribute("expand-row-keys", expandRowKeys);
예제 #19
0
 public static IElement <Table> HighlightCurrentRow(this IElement <Table> element, BoundValue <bool> highlightCurrentRow) => element.Attribute("highlight-current-row", highlightCurrentRow);
예제 #20
0
 public static IElement <Table> TooltipEffect(this IElement <Table> element, BoundValue tooltipEffect) => element.Attribute("tooltip-effect", tooltipEffect);
예제 #21
0
 public static IElement <Tooltip> Effect(this IElement <Tooltip> element, BoundValue effect) => element.Attribute("effect", effect);
예제 #22
0
 public static IElement <Table> SumText(this IElement <Table> element, BoundValue sumText) => element.Attribute("sum-text", sumText);
예제 #23
0
 public static IElement <Tooltip> Placement(this IElement <Tooltip> element, BoundValue placement) => element.Attribute("placement", placement);
예제 #24
0
 public static IElement <Table> CurrentRowKey(this IElement <Table> element, BoundValue <int> currentRowKey) => element.Attribute("current-row-key", currentRowKey);
예제 #25
0
 public static IElement <Row> Tag(this IElement <Row> element, BoundValue tag) => element.Attribute("tag", tag);
예제 #26
0
 public static IElement <Tooltip> Content(this IElement <Tooltip> element, BoundValue content) => element.Attribute("content", content);
예제 #27
0
 public static IElement <Table> RowClassName(this IElement <Table> element, BoundValue rowClassName) => element.Attribute("row-class-name", rowClassName);
예제 #28
0
 public static IElement <Tooltip> Disabled(this IElement <Tooltip> element, BoundValue <bool> disabled) => element.Attribute("disabled", disabled);
예제 #29
0
 public static IElement <Table> RowStyle(this IElement <Table> element, BoundValue rowStyle) => element.Attribute("row-style", rowStyle);
예제 #30
0
 public static IElement <Tooltip> OpenDelay(this IElement <Tooltip> element, BoundValue <int> openDelay) => element.Attribute("open-delay", openDelay);
예제 #31
0
 public static IElement <Table> RowKey(this IElement <Table> element, BoundValue rowKey) => element.Attribute("row-key", rowKey);